diff --git a/bin/fixqt4headers b/bin/fixqt4headers new file mode 100755 index 00000000000..58b0fdf43db --- /dev/null +++ b/bin/fixqt4headers @@ -0,0 +1,23 @@ +#!/bin/bash + +modules=`ls $QTDIR/include` + +files=`find * -name '*.h' -or -name '*.cpp' -or -name '*.C' -or -name '*.cc' -or -name '*.CC'` + +echo $files + +for module in $modules; do +# once we change other things, change the line from == "QtWidgets" to != "Qt" to get everything fixed + if [ $module == "QtWidgets" ] || [ $module == "QtPrintSupport" ]; then + echo $module ":" + includes=`ls $QTDIR/include/$module` + for i in $includes; do +# echo " fixing " $i + perl -pi -e "s,^#include +<.+/$i>,#include <$module/$i>," $files; +# perl -pi -e 's,^#include +".+/$i",#include "$module/$i",' $files; + done; + fi; +done; + +perl -pi -e 's,,,' $files +perl -pi -e 's,,,' $files diff --git a/config.tests/qpa/wayland/wayland.pro b/config.tests/qpa/wayland/wayland.pro index 0c2b8991bda..6d85073b916 100644 --- a/config.tests/qpa/wayland/wayland.pro +++ b/config.tests/qpa/wayland/wayland.pro @@ -1,4 +1,12 @@ SOURCES = wayland.cpp CONFIG -= qt -INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND + +for(d, QMAKE_INCDIR_WAYLAND) { + exists($$d):INCLUDEPATH += $$d +} + +for(p, QMAKE_LIBDIR_WAYLAND) { + exists($$p):LIBS += -L$$p +} + LIBS += $$QMAKE_LIBS_WAYLAND diff --git a/config.tests/qpa/xcb-poll-for-queued-event/xcb-poll-for-queued-event.cpp b/config.tests/qpa/xcb-poll-for-queued-event/xcb-poll-for-queued-event.cpp new file mode 100644 index 00000000000..d15e5544233 --- /dev/null +++ b/config.tests/qpa/xcb-poll-for-queued-event/xcb-poll-for-queued-event.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +int main(int, char **) +{ + int primaryScreen = 0; + + xcb_connection_t *connection = xcb_connect("", &primaryScreen); + + xcb_generic_event_t *event = xcb_poll_for_queued_event(connection); + + return 0; +} diff --git a/config.tests/qpa/xcb-poll-for-queued-event/xcb-poll-for-queued-event.pro b/config.tests/qpa/xcb-poll-for-queued-event/xcb-poll-for-queued-event.pro new file mode 100644 index 00000000000..6075c55c493 --- /dev/null +++ b/config.tests/qpa/xcb-poll-for-queued-event/xcb-poll-for-queued-event.pro @@ -0,0 +1,5 @@ +SOURCES = xcb-poll-for-queued-event.cpp +CONFIG -= qt + +LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync -lxcb-xfixes + diff --git a/src/plugins/decorations/windows/main.cpp b/config.tests/qpa/xcb-render/xcb-render.cpp similarity index 66% rename from src/plugins/decorations/windows/main.cpp rename to config.tests/qpa/xcb-render/xcb-render.cpp index 8ee8a156e80..9e6c9c847cd 100644 --- a/src/plugins/decorations/windows/main.cpp +++ b/config.tests/qpa/xcb-render/xcb-render.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the plugins of the Qt Toolkit. +** This file is part of the config.tests of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -39,38 +39,34 @@ ** ****************************************************************************/ -#include -#include +#include +#include -QT_BEGIN_NAMESPACE - -class DecorationWindows : public QDecorationPlugin -{ -public: - DecorationWindows(); - - QStringList keys() const; - QDecoration *create(const QString&); -}; - -DecorationWindows::DecorationWindows() - : QDecorationPlugin() -{ +// 'template' is used as a function argument name in xcb_renderutil.h +#define template template_param +// extern "C" is missing too +extern "C" { +#include } +#undef template -QStringList DecorationWindows::keys() const +int main(int, char **) { - return (QStringList() << QLatin1String("Windows")); -} + int primaryScreen = 0; + xcb_generic_error_t *error = 0; -QDecoration* DecorationWindows::create(const QString& s) -{ - if (s.toLower() == QLatin1String("windows")) - return new QDecorationWindows(); + xcb_connection_t *connection = xcb_connect("", &primaryScreen); + xcb_render_query_pict_formats_cookie_t formatsCookie = + xcb_render_query_pict_formats(connection); + + xcb_render_query_pict_formats_reply_t *formatsReply = + xcb_render_query_pict_formats_reply( + connection, + formatsCookie, + &error); + + xcb_render_util_find_standard_format(formatsReply, + XCB_PICT_STANDARD_ARGB_32); return 0; } - -Q_EXPORT_PLUGIN2(qdecorationwindows, DecorationWindows) - -QT_END_NAMESPACE diff --git a/config.tests/qpa/xcb-render/xcb-render.pro b/config.tests/qpa/xcb-render/xcb-render.pro new file mode 100644 index 00000000000..33526fad0d0 --- /dev/null +++ b/config.tests/qpa/xcb-render/xcb-render.pro @@ -0,0 +1,5 @@ +SOURCES = xcb-render.cpp +CONFIG -= qt + +LIBS += -lxcb-render -lxcb-render-util + diff --git a/tests/auto/qtessellator/simple.cpp b/config.tests/qpa/xcb-xlib/xcb-xlib.cpp similarity index 86% rename from tests/auto/qtessellator/simple.cpp rename to config.tests/qpa/xcb-xlib/xcb-xlib.cpp index 1a1d279f949..ede80d63605 100644 --- a/tests/auto/qtessellator/simple.cpp +++ b/config.tests/qpa/xcb-xlib/xcb-xlib.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the test suite of the Qt Toolkit. +** This file is part of the config.tests of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -38,12 +38,15 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "simple.h" -#include "dataparser.h" -#include +#include +#include +#include -FullData simpleData() +int main(int, char **) { - return parseFile(":/simple.data"); + Display *dpy = XOpenDisplay(""); + xcb_connection_t *connection = XGetXCBConnection(dpy); + + return 0; } diff --git a/config.tests/qpa/xcb-xlib/xcb-xlib.pro b/config.tests/qpa/xcb-xlib/xcb-xlib.pro new file mode 100644 index 00000000000..03250b44803 --- /dev/null +++ b/config.tests/qpa/xcb-xlib/xcb-xlib.pro @@ -0,0 +1,5 @@ +SOURCES = xcb-xlib.cpp +CONFIG -= qt + +LIBS += -lxcb -lX11 -lX11-xcb + diff --git a/src/gui/painting/qpaintdevice_qws.cpp b/config.tests/qpa/xcb/xcb.cpp similarity index 82% rename from src/gui/painting/qpaintdevice_qws.cpp rename to config.tests/qpa/xcb/xcb.cpp index 9d5ba6e850c..71b30fea5ab 100644 --- a/src/gui/painting/qpaintdevice_qws.cpp +++ b/config.tests/qpa/xcb/xcb.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the config.tests of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -39,18 +39,19 @@ ** ****************************************************************************/ -#include "qpaintdevice.h" -#include "qpainter.h" -#include "qwidget.h" -#include "qbitmap.h" -#include "qapplication.h" -#include "qwsdisplay_qws.h" +#include +#include +#include +#include +#include +#include +#include -QT_BEGIN_NAMESPACE - -QWSDisplay *QPaintDevice::qwsDisplay() +int main(int, char **) { - return qt_fbdpy; -} + int primaryScreen = 0; -QT_END_NAMESPACE + xcb_connection_t *connection = xcb_connect("", &primaryScreen); + + return 0; +} diff --git a/config.tests/qpa/xcb/xcb.pro b/config.tests/qpa/xcb/xcb.pro new file mode 100644 index 00000000000..ed68bca242f --- /dev/null +++ b/config.tests/qpa/xcb/xcb.pro @@ -0,0 +1,5 @@ +SOURCES = xcb.cpp +CONFIG -= qt + +LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync -lxcb-xfixes + diff --git a/config.tests/unix/opengldesktop/opengldesktop.cpp b/config.tests/unix/opengldesktop/opengldesktop.cpp index af21cfdfda9..eea16b8fbd0 100644 --- a/config.tests/unix/opengldesktop/opengldesktop.cpp +++ b/config.tests/unix/opengldesktop/opengldesktop.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#if defined(Q_OS_MAC) -# include +#ifdef __APPLE__ +#include #else -# include +#include #endif int main(int, char **) diff --git a/configure b/configure index f553f4388a4..dc2e4f09571 100755 --- a/configure +++ b/configure @@ -185,14 +185,12 @@ fi #------------------------------------------------------------------------------- PLATFORM_X11=no -PLATFORM_QWS=maybe -PLATFORM_QPA=maybe +PLATFORM_QWS=no +PLATFORM_QPA=yes BUILD_ON_MAC=no +PLATFORM_MAC=no if [ -d /System/Library/Frameworks/Carbon.framework ]; then - PLATFORM_MAC=maybe BUILD_ON_MAC=yes -else - PLATFORM_MAC=no fi #----------------------------------------------------------------------------- @@ -752,7 +750,8 @@ CFG_DECORATION_PLUGIN_AVAILABLE= CFG_DECORATION_PLUGIN= CFG_XINPUT=runtime CFG_XKB=auto -CFG_XCB=no +CFG_XCB=auto +CFG_XCB_LIMITED=yes CFG_NIS=auto CFG_CUPS=auto CFG_ICONV=auto @@ -1378,9 +1377,9 @@ while [ "$#" -gt 0 ]; do opengl) if [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || - [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then + [ "$VAL" = "es2" ]; then CFG_OPENGL="$VAL" - if [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then + if [ "$VAL" = "es2" ]; then CFG_EGL="yes" fi else @@ -3322,7 +3321,7 @@ if [ '!' -z "$CFG_SDK" ]; then fi # find the default framework value -if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then +if [ "$CFG_ARCH" = "macosx" ]; then if [ "$CFG_FRAMEWORK" = "auto" ]; then CFG_FRAMEWORK="$CFG_SHARED" elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then @@ -3461,7 +3460,7 @@ if [ "$PLATFORM_MAC" = "yes" ] && [ "$XPLATFORM_SYMBIAN" = "no" ]; then fi # find the default framework value -if [ "$PLATFORM_MAC" = "yes" ] && [ "$PLATFORM" != "macx-xlc" ]; then +if [ "$CFG_ARCH" = "macosx" ]; then if [ "$CFG_FRAMEWORK" = "auto" ]; then CFG_FRAMEWORK="$CFG_SHARED" elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then @@ -4179,9 +4178,9 @@ Qt/X11 only: + -opengl ...... Enable OpenGL support. With no parameter, this will auto-detect the "best" OpenGL API to use. If desktop OpenGL is available, it - will be used. Use desktop, es1, or es2 for - to force the use of the Desktop (OpenGL 1.x or 2.x), - OpenGL ES 1.x Common profile, or 2.x APIs instead. + will be used. Use desktop or es2 for + to force the use of the Desktop OpenGL or + OpenGL ES 2 APIs instead. -no-openvg ........ Do not support OpenVG. + -openvg ........... Enable OpenVG support. @@ -4341,9 +4340,9 @@ if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then -no-opengl .......... Do not support OpenGL. -opengl ....... Enable OpenGL ES support - With no parameter, this will attempt to auto-detect OpenGL ES 1.x - or 2.x, or regular desktop OpenGL. - Use es1 or es2 for to override auto-detection. + With no parameter, this will attempt to auto-detect + OpenGL ES 2, or regular desktop OpenGL. + Use es2 for to override auto-detection. EOF fi @@ -5794,7 +5793,7 @@ fi # X11/MINGW/SYMBIAN OpenGL if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" -o "$XPLATFORM_SYMBIAN" = "yes" ]; then - # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es2 = OpenGL ES 2.x) + # auto-detect OpenGL support (es2 = OpenGL ES 2.x) if [ "$CFG_GUI" = "no" ]; then if [ "$CFG_OPENGL" = "auto" ]; then CFG_OPENGL=no @@ -5813,11 +5812,6 @@ if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" -o "$XPLATFORM_SYMBIA if [ "$CFG_EGL" = "no" ]; then CFG_EGL=auto fi - 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 - if [ "$CFG_EGL" = "no" ]; then - CFG_EGL=auto - fi else if [ "$CFG_OPENGL" = "yes" ]; then echo "All the OpenGL functionality tests failed!" @@ -5841,16 +5835,6 @@ if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" -o "$XPLATFORM_SYMBIA *) ;; esac - 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 @@ -6183,14 +6167,14 @@ fi 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 + # auto-detect OpenGL support (es2 = OpenGL ES 2.x) + if [ "$CFG_ARCH" = "macosx" ]; then + CFG_OPENGL=desktop + elif [ "$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!" @@ -6201,16 +6185,6 @@ if [ "$PLATFORM_QPA" = "yes" ]; then 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 if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then @@ -6266,15 +6240,46 @@ if [ "$PLATFORM_QPA" = "yes" ]; then QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null` QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client 2>/dev/null` QMAKE_LIBDIR_WAYLAND=`$PKG_CONFIG --variable=libdir wayland-client 2>/dev/null` + fi - if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then - QMAKE_CFLAGS_WAYLAND="$QMAKE_CFLAGS_WAYLAND `$PKG_CONFIG --cflags xkbcommon 2>/dev/null`" - QMAKE_LIBS_WAYLAND="$QMAKE_LIBS_WAYLAND `$PKG_CONFIG --libs xkbcommon 2>/dev/null`" + # Check we actually have X11 :-) + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then + QT_CONFIG="$QT_CONFIG xlib" + fi + + if [ "$CFG_XCB" != "no" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb "xcb" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_XCB=yes + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-render "xcb-render" $L_FLAGS $I_FLAGS $l_FLAGS; then + QT_CONFIG="$QT_CONFIG xcb-render" + fi + + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-poll-for-queued-event "xcb-poll-for-queued-event" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_XCB_LIMITED=no + QT_CONFIG="$QT_CONFIG xcb-poll-for-queued-event" + fi + + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/xcb-xlib "xcb-xlib" $L_FLAGS $I_FLAGS $l_FLAGS; then + QT_CONFIG="$QT_CONFIG xcb-xlib" + fi else - QMAKE_DEFINES_WAYLAND=QT_NO_WAYLAND_XKB + CFG_XCB=no fi fi + # Detect libxkbcommon + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then + QMAKE_CFLAGS_XKBCOMMON="`$PKG_CONFIG --cflags xkbcommon 2>/dev/null`" + QMAKE_LIBS_XKBCOMMON="`$PKG_CONFIG --libs xkbcommon 2>/dev/null`" + QMAKE_CFLAGS_WAYLAND="$QMAKE_CFLAGS_WAYLAND $QMAKE_CFLAGS_XKBCOMMON" + QMAKE_LIBS_WAYLAND="$QMAKE_LIBS_WAYLAND $QMAKE_LIBS_XKBCOMMON" + QMAKE_CFLAGS_XCB="$QMAKE_CFLAGS_XCB $QMAKE_CFLAGS_XKBCOMMON" + QMAKE_LIBS_XCB="$QMAKE_LIBS_XCB $QMAKE_LIBS_XKBCOMMON" + else + QMAKE_DEFINES_WAYLAND=QT_NO_WAYLAND_XKB + QMAKE_DEFINES_XCB=QT_NO_XCB_XKB + fi + # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero. if [ -n "$QMAKE_CFLAGS_WAYLAND" ] || [ -n "$QMAKE_LIBS_WAYLAND" ]; then QMakeVar set QMAKE_CFLAGS_WAYLAND "$QMAKE_CFLAGS_WAYLAND" @@ -6284,6 +6289,12 @@ if [ "$PLATFORM_QPA" = "yes" ]; then QMakeVar set QMAKE_DEFINES_WAYLAND " $QMAKE_DEFINES_WAYLAND" fi + if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then + QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB" + QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB" + QMakeVar set QMAKE_DEFINES_XCB "$QMAKE_DEFINES_XCB" + fi + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/wayland "Wayland" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_WAYLAND $QMAKE_LIBS_WAYLAND; then QT_CONFIG="$QT_CONFIG wayland" fi @@ -6300,7 +6311,7 @@ fi # QWS if [ "$PLATFORM_QWS" = "yes" ]; then - # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es2 = OpenGL ES 2.x) + # auto-detect OpenGL support (es2 = OpenGL ES 2.x) if [ "$CFG_GUI" = "no" ]; then if [ "$CFG_OPENGL" = "auto" ]; then CFG_OPENGL=no @@ -6315,26 +6326,7 @@ if [ "$PLATFORM_QWS" = "yes" ]; then CFG_EGL=auto 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 - CFG_OPENGL=es1 - else - echo "All the OpenGL ES 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 - 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, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" - echo " ${XQMAKESPEC}." - exit 1 - fi - CFG_EGL=yes 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 @@ -6444,16 +6436,6 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then CFG_EGL=yes fi - # Prefer this variant for ES1 - if [ "$CFG_OPENGL" = "es1" -o "$EGL_VARIANT" = "none" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl4gles1" "EGL (GLES/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then - # EGL specified by QMAKE_*_EGL, included with - EGL_VARIANT=gles - CFG_EGL=yes - CFG_EGL_GLES_INCLUDES=yes - fi - fi - if [ "$EGL_VARIANT" = "none" ]; then if [ "$CFG_EGL" = "yes" ]; then echo "The EGL functionality test failed!" @@ -6465,7 +6447,7 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then fi CFG_EGL=no # If QtOpenGL would be built against OpenGL ES, disable it as we can't to that if EGL is missing - if [ "$CFG_OPENGL" = "es1" -o "$CFG_OPENGL" = "es2" ]; then + if [ "$CFG_OPENGL" = "es2" ]; then CFG_OPENGL=no fi fi @@ -6941,19 +6923,6 @@ fi [ "$XPLATFORM_MINGW" = "yes" ] && CFG_MAC_COCOA="no" [ "$XPLATFORM_SYMBIAN" = "yes" ] && CFG_MAC_COCOA="no" -# set the global Mac deployment target. This is overridden on an arch-by-arch basis -# in some cases, see code further down -case "$PLATFORM,$CFG_MAC_COCOA" in - macx*,yes) - # Cocoa - QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.5 - ;; - macx*,no) - # gcc, Carbon - QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.4 - ;; -esac - # disable Qt 3 support on VxWorks and Symbian case "$XPLATFORM" in unsupported/vxworks*|symbian*) @@ -7036,18 +7005,10 @@ else QT_CONFIG="$QT_CONFIG opengl" fi -if [ "$CFG_OPENGL" = "es1" ] || [ "$CFG_OPENGL" = "es2" ]; then - if [ "$PLATFORM_QWS" = "yes" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS Q_BACKINGSTORE_SUBSURFACES" - fi +if [ "$CFG_OPENGL" = "es2" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES" fi -if [ "$CFG_OPENGL" = "es1" ]; then - QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_1" - QT_CONFIG="$QT_CONFIG opengles1" -fi - if [ "$CFG_OPENGL" = "es2" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_OPENGL_ES_2" QT_CONFIG="$QT_CONFIG opengles2" @@ -7349,7 +7310,7 @@ if [ '!' -z "$I_FLAGS" ]; then fi # turn off exceptions for the compilers that support it -if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then +if [ "$PLATFORM_QWS" = "yes" ]; then COMPILER=`echo $XPLATFORM | cut -f 3- -d-` elif [ "$XPLATFORM" != "$PLATFORM" ]; then COMPILER=`echo $XPLATFORM | cut -f 2- -d-` @@ -7707,9 +7668,7 @@ if [ "$CFG_EXCEPTIONS" = "no" ]; then fi # On Mac, set the minimum deployment target for the different architechtures -# using the Xarch compiler option when supported (10.5 and up). On 10.4 the -# deployment version is set to 10.4 globally using the QMAKE_MACOSX_DEPLOYMENT_TARGET -# env. variable. +# using the Xarch compiler option when supported (10.5 and up). if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" != "no" ] ; then if echo "$CFG_MAC_ARCHS" | grep '\' > /dev/null 2>&1; then QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=10.4" @@ -8529,8 +8488,6 @@ if [ "$PLATFORM_QWS" = "yes" ]; then fi if [ "$CFG_OPENGL" = "desktop" ]; then echo "OpenGL support ......... yes (Desktop OpenGL)" -elif [ "$CFG_OPENGL" = "es1" ]; then - echo "OpenGL support ......... yes (OpenGL ES 1.x Common profile)" elif [ "$CFG_OPENGL" = "es2" ]; then echo "OpenGL support ......... yes (OpenGL ES 2.x)" else @@ -8590,7 +8547,11 @@ if [ "$PLATFORM_MAC" = "yes" ]; then fi echo "ICD support ............ $CFG_ICD" echo "libICU support ......... $CFG_ICU" -echo "Xcb support ............ $CFG_XCB" +if [ "$CFG_XCB_LIMITED" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then + echo "Xcb support ............ limited (old version)" +else + echo "Xcb support ............ $CFG_XCB" +fi echo [ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........... $CFG_PTMALLOC" diff --git a/configure.exe b/configure.exe index cb4373b8dc2..eccff13832a 100644 Binary files a/configure.exe and b/configure.exe differ diff --git a/doc/src/snippets/alphachannel.cpp b/doc/src/snippets/alphachannel.cpp deleted file mode 100644 index d5ec20e60c6..00000000000 --- a/doc/src/snippets/alphachannel.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the 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$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class MyClass : public QWidget -{ -public: - MyClass(QWidget *parent = 0) : QWidget(parent) { } - -protected: - void paintEvent(QPaintEvent *e) - { - /*QRadialGradient rg(50, 50, 50, 50, 50); - rg.setColorAt(0, QColor::fromRgbF(1, 0, 0, 1)); - rg.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0)); - QPainter pmp(&pm); - pmp.fillRect(0, 0, 100, 100, rg); - pmp.end();*/ - - createImage(); - - QPainter p(this); - p.fillRect(rect(), Qt::white); - - p.drawPixmap(0, 0, pixmap); - - p.drawPixmap(100, 0, channelImage); - } - - void createImage() - { -//! [0] - pixmap = QPixmap(100, 100); - pixmap.fill(Qt::transparent); - - QRadialGradient gradient(50, 50, 50, 50, 50); - gradient.setColorAt(0, QColor::fromRgbF(1, 0, 0, 1)); - gradient.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0)); - QPainter painter(&pixmap); - painter.fillRect(0, 0, 100, 100, gradient); - - channelImage = pixmap.alphaChannel(); - update(); -//! [0] - } - - QPixmap channelImage, pixmap; - QSize sizeHint() const { return QSize(500, 500); } -}; - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - MyClass cl; - cl.show(); - QObject::connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); - - int ret = app.exec(); - return ret; -} diff --git a/examples/animation/animatedtiles/animatedtiles.pro b/examples/animation/animatedtiles/animatedtiles.pro index 1287d8b3d0f..791bbf6a229 100644 --- a/examples/animation/animatedtiles/animatedtiles.pro +++ b/examples/animation/animatedtiles/animatedtiles.pro @@ -11,4 +11,5 @@ symbian { TARGET.UID3 = 0xA000D7D1 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/animation/animatedtiles/main.cpp b/examples/animation/animatedtiles/main.cpp index 46b5d1ddc57..c59c981cb11 100644 --- a/examples/animation/animatedtiles/main.cpp +++ b/examples/animation/animatedtiles/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include class Pixmap : public QObject, public QGraphicsPixmapItem diff --git a/examples/animation/animation.pro b/examples/animation/animation.pro index e5fa7c4a565..b17aa0e0fe5 100644 --- a/examples/animation/animation.pro +++ b/examples/animation/animation.pro @@ -14,3 +14,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/animation sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS animation.pro README sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/animation INSTALLS += target sources +QT += widgets diff --git a/examples/animation/appchooser/appchooser.pro b/examples/animation/appchooser/appchooser.pro index 958b1710e38..3969b551e9d 100644 --- a/examples/animation/appchooser/appchooser.pro +++ b/examples/animation/appchooser/appchooser.pro @@ -11,4 +11,5 @@ symbian { TARGET.UID3 = 0xA000E3F5 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/animation/appchooser/main.cpp b/examples/animation/appchooser/main.cpp index 3788533aa88..873054ce5f1 100644 --- a/examples/animation/appchooser/main.cpp +++ b/examples/animation/appchooser/main.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ #include -#include +#include class Pixmap : public QGraphicsWidget @@ -88,7 +88,7 @@ public: { } - virtual void resizeEvent(QResizeEvent *event) + virtual void resizeEvent(QResizeEvent *) { fitInView(sceneRect(), Qt::KeepAspectRatio); } diff --git a/examples/animation/easing/animation.h b/examples/animation/easing/animation.h index f0aef6560b5..5f6c4258272 100644 --- a/examples/animation/easing/animation.h +++ b/examples/animation/easing/animation.h @@ -41,7 +41,7 @@ #ifndef ANIMATION_H #define ANIMATION_H -#include +#include #include diff --git a/examples/animation/easing/easing.pro b/examples/animation/easing/easing.pro index 0d5eaf43861..b26ce300839 100644 --- a/examples/animation/easing/easing.pro +++ b/examples/animation/easing/easing.pro @@ -17,5 +17,6 @@ symbian { TARGET.UID3 = 0xA000E3F6 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/animation/easing/main.cpp b/examples/animation/easing/main.cpp index 66a6958cf22..0d63a3136e2 100644 --- a/examples/animation/easing/main.cpp +++ b/examples/animation/easing/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" int main(int argc, char **argv) diff --git a/examples/animation/easing/window.h b/examples/animation/easing/window.h index 17899a422e8..51fa00d8598 100644 --- a/examples/animation/easing/window.h +++ b/examples/animation/easing/window.h @@ -38,7 +38,8 @@ ** ****************************************************************************/ -#include +#include + #include "ui_form.h" #include "animation.h" diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp index ca1876f95a1..24e5f051d7b 100644 --- a/examples/animation/moveblocks/main.cpp +++ b/examples/animation/moveblocks/main.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ #include -#include +#include //![15] class StateSwitchEvent: public QEvent diff --git a/examples/animation/moveblocks/moveblocks.pro b/examples/animation/moveblocks/moveblocks.pro index ee60e8fcc06..b82370dff6c 100644 --- a/examples/animation/moveblocks/moveblocks.pro +++ b/examples/animation/moveblocks/moveblocks.pro @@ -10,4 +10,5 @@ symbian { TARGET.UID3 = 0xA000E3F7 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/animation/states/main.cpp b/examples/animation/states/main.cpp index d49aa415a76..f37c2bdbbf8 100644 --- a/examples/animation/states/main.cpp +++ b/examples/animation/states/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include class Pixmap : public QGraphicsObject { @@ -69,7 +69,7 @@ public: { } - virtual void resizeEvent(QResizeEvent *event) + virtual void resizeEvent(QResizeEvent *) { fitInView(sceneRect(), Qt::KeepAspectRatio); } diff --git a/examples/animation/states/states.pro b/examples/animation/states/states.pro index 24d69763348..5c0d28163b3 100644 --- a/examples/animation/states/states.pro +++ b/examples/animation/states/states.pro @@ -11,4 +11,5 @@ symbian { TARGET.UID3 = 0xA000E3F8 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/animation/stickman/graphicsview.cpp b/examples/animation/stickman/graphicsview.cpp index 0f7ce5f1c63..0d422ab1d2b 100644 --- a/examples/animation/stickman/graphicsview.cpp +++ b/examples/animation/stickman/graphicsview.cpp @@ -42,8 +42,8 @@ #include "stickman.h" #include -#include -#include +#include +#include GraphicsView::GraphicsView(QWidget *parent) : QGraphicsView(parent), m_editor(0) {} @@ -54,7 +54,7 @@ void GraphicsView::keyPressEvent(QKeyEvent *e) emit keyPressed(Qt::Key(e->key())); } -void GraphicsView::resizeEvent(QResizeEvent *event) +void GraphicsView::resizeEvent(QResizeEvent *) { fitInView(scene()->sceneRect()); } diff --git a/examples/animation/stickman/graphicsview.h b/examples/animation/stickman/graphicsview.h index 400e4a63d49..abd621df43c 100644 --- a/examples/animation/stickman/graphicsview.h +++ b/examples/animation/stickman/graphicsview.h @@ -41,7 +41,7 @@ #ifndef GRAPHICSVIEW_H #define GRAPHICSVIEW -#include +#include class MainWindow; class GraphicsView: public QGraphicsView diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index 8e9dbe1e8b4..791b33eb2ec 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -45,7 +45,7 @@ #include "graphicsview.h" #include -#include +#include class KeyPressTransition: public QSignalTransition { diff --git a/examples/animation/stickman/main.cpp b/examples/animation/stickman/main.cpp index 902e572a0e8..c5c3eb316ba 100644 --- a/examples/animation/stickman/main.cpp +++ b/examples/animation/stickman/main.cpp @@ -46,7 +46,7 @@ #include "rectbutton.h" #include -#include +#include int main(int argc, char **argv) { diff --git a/examples/animation/stickman/rectbutton.cpp b/examples/animation/stickman/rectbutton.cpp index d45e8abefe1..d1bd9e42d1a 100644 --- a/examples/animation/stickman/rectbutton.cpp +++ b/examples/animation/stickman/rectbutton.cpp @@ -51,7 +51,7 @@ RectButton::~RectButton() } -void RectButton::mousePressEvent (QGraphicsSceneMouseEvent *event) +void RectButton::mousePressEvent (QGraphicsSceneMouseEvent *) { emit clicked(); } @@ -63,7 +63,7 @@ QRectF RectButton::boundingRect() const } -void RectButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +void RectButton::paint(QPainter *painter, const QStyleOptionGraphicsItem * /* option */, QWidget * /* widget */) { painter->setBrush(Qt::gray); painter->drawRoundedRect(boundingRect(), 5, 5); diff --git a/examples/animation/stickman/stickman.pro b/examples/animation/stickman/stickman.pro index ba31265055e..340a502c909 100644 --- a/examples/animation/stickman/stickman.pro +++ b/examples/animation/stickman/stickman.pro @@ -24,4 +24,5 @@ symbian { TARGET.UID3 = 0xA000E3F9 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/animation/sub-attaq/boat_p.h b/examples/animation/sub-attaq/boat_p.h index 9022a4ca513..4141671eb0d 100644 --- a/examples/animation/sub-attaq/boat_p.h +++ b/examples/animation/sub-attaq/boat_p.h @@ -58,7 +58,7 @@ #include "graphicsscene.h" // Qt -#include +#include static const int MAX_BOMB = 5; diff --git a/examples/animation/sub-attaq/graphicsscene.cpp b/examples/animation/sub-attaq/graphicsscene.cpp index f82d441068a..d274ca3bde5 100644 --- a/examples/animation/sub-attaq/graphicsscene.cpp +++ b/examples/animation/sub-attaq/graphicsscene.cpp @@ -59,12 +59,12 @@ #include #include #include -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode) diff --git a/examples/animation/sub-attaq/graphicsscene.h b/examples/animation/sub-attaq/graphicsscene.h index e1220a5eb86..198b27101f3 100644 --- a/examples/animation/sub-attaq/graphicsscene.h +++ b/examples/animation/sub-attaq/graphicsscene.h @@ -43,7 +43,7 @@ #define __GRAPHICSSCENE__H__ //Qt -#include +#include #include #include diff --git a/examples/animation/sub-attaq/main.cpp b/examples/animation/sub-attaq/main.cpp index c8e534e7e76..6fdc47ca205 100644 --- a/examples/animation/sub-attaq/main.cpp +++ b/examples/animation/sub-attaq/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/animation/sub-attaq/mainwindow.h b/examples/animation/sub-attaq/mainwindow.h index 933587a262e..0514776b755 100644 --- a/examples/animation/sub-attaq/mainwindow.h +++ b/examples/animation/sub-attaq/mainwindow.h @@ -43,7 +43,7 @@ #define __MAINWINDOW__H__ //Qt -#include +#include class GraphicsScene; QT_BEGIN_NAMESPACE class QGraphicsView; diff --git a/examples/animation/sub-attaq/pixmapitem.h b/examples/animation/sub-attaq/pixmapitem.h index 0a94aab7ebe..f6fced9e975 100644 --- a/examples/animation/sub-attaq/pixmapitem.h +++ b/examples/animation/sub-attaq/pixmapitem.h @@ -46,7 +46,7 @@ #include "graphicsscene.h" //Qt -#include +#include class PixmapItem : public QGraphicsObject { diff --git a/examples/animation/sub-attaq/progressitem.h b/examples/animation/sub-attaq/progressitem.h index bcf708c512f..9a8a5751118 100644 --- a/examples/animation/sub-attaq/progressitem.h +++ b/examples/animation/sub-attaq/progressitem.h @@ -43,7 +43,7 @@ #define PROGRESSITEM_H //Qt -#include +#include class ProgressItem : public QGraphicsTextItem { diff --git a/examples/animation/sub-attaq/states.cpp b/examples/animation/sub-attaq/states.cpp index 462e13b90e1..db509380160 100644 --- a/examples/animation/sub-attaq/states.cpp +++ b/examples/animation/sub-attaq/states.cpp @@ -50,10 +50,10 @@ #include "textinformationitem.h" //Qt -#include -#include +#include +#include #include -#include +#include #include PlayState::PlayState(GraphicsScene *scene, QState *parent) diff --git a/examples/animation/sub-attaq/states.h b/examples/animation/sub-attaq/states.h index cda96031962..4f322cbd571 100644 --- a/examples/animation/sub-attaq/states.h +++ b/examples/animation/sub-attaq/states.h @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include class GraphicsScene; diff --git a/examples/animation/sub-attaq/sub-attaq.pro b/examples/animation/sub-attaq/sub-attaq.pro index ff3040490c7..e994694b549 100644 --- a/examples/animation/sub-attaq/sub-attaq.pro +++ b/examples/animation/sub-attaq/sub-attaq.pro @@ -1,4 +1,4 @@ -contains(QT_CONFIG, opengl):QT += opengl +contains(QT_CONFIG, opengl):QT += opengl widgets HEADERS += boat.h \ bomb.h \ mainwindow.h \ diff --git a/examples/animation/sub-attaq/submarine.h b/examples/animation/sub-attaq/submarine.h index 0d6087dc269..852b63de367 100644 --- a/examples/animation/sub-attaq/submarine.h +++ b/examples/animation/sub-attaq/submarine.h @@ -43,7 +43,7 @@ #define __SUBMARINE__H__ //Qt -#include +#include #include "pixmapitem.h" diff --git a/examples/animation/sub-attaq/submarine_p.h b/examples/animation/sub-attaq/submarine_p.h index f0b370d8788..eb81c6604b7 100644 --- a/examples/animation/sub-attaq/submarine_p.h +++ b/examples/animation/sub-attaq/submarine_p.h @@ -60,7 +60,7 @@ //Qt #include -#include +#include //This state is describing when the boat is moving right class MovementState : public QAnimationState diff --git a/examples/animation/sub-attaq/textinformationitem.h b/examples/animation/sub-attaq/textinformationitem.h index 4b5f71969f9..1c62c8597e4 100644 --- a/examples/animation/sub-attaq/textinformationitem.h +++ b/examples/animation/sub-attaq/textinformationitem.h @@ -43,7 +43,7 @@ #define TEXTINFORMATIONITEM_H //Qt -#include +#include class TextInformationItem : public QGraphicsTextItem { diff --git a/examples/dbus/complexpingpong/complexpingpong.pro b/examples/dbus/complexpingpong/complexpingpong.pro index cd618d549d6..1dfeff92ac4 100644 --- a/examples/dbus/complexpingpong/complexpingpong.pro +++ b/examples/dbus/complexpingpong/complexpingpong.pro @@ -2,3 +2,4 @@ TEMPLATE = subdirs CONFIG += ordered win32:CONFIG += console SUBDIRS = complexping.pro complexpong.pro +QT += widgets diff --git a/examples/dbus/dbus-chat/chat.cpp b/examples/dbus/dbus-chat/chat.cpp index 5cc12caafa3..33ba0f7a3ad 100644 --- a/examples/dbus/dbus-chat/chat.cpp +++ b/examples/dbus/dbus-chat/chat.cpp @@ -39,8 +39,8 @@ ****************************************************************************/ #include "chat.h" -#include -#include +#include +#include #include "chat_adaptor.h" #include "chat_interface.h" diff --git a/examples/dbus/dbus-chat/dbus-chat.pro b/examples/dbus/dbus-chat/dbus-chat.pro index ae2b7fee5d2..3009045e789 100644 --- a/examples/dbus/dbus-chat/dbus-chat.pro +++ b/examples/dbus/dbus-chat/dbus-chat.pro @@ -18,6 +18,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/chat INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example does not work on Symbian platform) simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/dbus.pro b/examples/dbus/dbus.pro index 0ac20ad1658..b3c05597d41 100644 --- a/examples/dbus/dbus.pro +++ b/examples/dbus/dbus.pro @@ -15,4 +15,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus INSTALLS += sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/dbus/pingpong/pingpong.pro b/examples/dbus/pingpong/pingpong.pro index 07fca74c9a5..701e7786764 100644 --- a/examples/dbus/pingpong/pingpong.pro +++ b/examples/dbus/pingpong/pingpong.pro @@ -2,3 +2,4 @@ TEMPLATE = subdirs CONFIG += ordered win32:CONFIG += console SUBDIRS = ping.pro pong.pro +QT += widgets diff --git a/examples/dbus/remotecontrolledcar/car/car.cpp b/examples/dbus/remotecontrolledcar/car/car.cpp index 50f8f24d3e7..d42db25d105 100644 --- a/examples/dbus/remotecontrolledcar/car/car.cpp +++ b/examples/dbus/remotecontrolledcar/car/car.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ #include "car.h" -#include +#include #include static const double Pi = 3.14159265358979323846264338327950288419717; diff --git a/examples/dbus/remotecontrolledcar/car/car.pro b/examples/dbus/remotecontrolledcar/car/car.pro index b7f232f7a25..7ae919ceca4 100644 --- a/examples/dbus/remotecontrolledcar/car/car.pro +++ b/examples/dbus/remotecontrolledcar/car/car.pro @@ -19,6 +19,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar/car INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example does not work on Symbian platform) simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/remotecontrolledcar/car/main.cpp b/examples/dbus/remotecontrolledcar/car/main.cpp index 342a2b0c5d4..df68f6125bf 100644 --- a/examples/dbus/remotecontrolledcar/car/main.cpp +++ b/examples/dbus/remotecontrolledcar/car/main.cpp @@ -40,9 +40,9 @@ #include "car.h" #include "car_adaptor.h" -#include -#include -#include +#include +#include +#include #include int main(int argc, char *argv[]) diff --git a/examples/dbus/remotecontrolledcar/controller/controller.cpp b/examples/dbus/remotecontrolledcar/controller/controller.cpp index 8691aafa92a..1303d9e218a 100644 --- a/examples/dbus/remotecontrolledcar/controller/controller.cpp +++ b/examples/dbus/remotecontrolledcar/controller/controller.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "controller.h" #include "car_interface.h" diff --git a/examples/dbus/remotecontrolledcar/controller/controller.pro b/examples/dbus/remotecontrolledcar/controller/controller.pro index 5edf1a006fc..5e8a82e8a0b 100644 --- a/examples/dbus/remotecontrolledcar/controller/controller.pro +++ b/examples/dbus/remotecontrolledcar/controller/controller.pro @@ -20,6 +20,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar/controlle INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example does not work on Symbian platform) simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/remotecontrolledcar/controller/main.cpp b/examples/dbus/remotecontrolledcar/controller/main.cpp index 5b536117c83..c91edd3056b 100644 --- a/examples/dbus/remotecontrolledcar/controller/main.cpp +++ b/examples/dbus/remotecontrolledcar/controller/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "controller.h" diff --git a/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro b/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro index eec736d74fc..2959170c899 100644 --- a/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro +++ b/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro @@ -8,4 +8,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dbus/remotecontrolledcar INSTALLS += sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/desktop/desktop.pro b/examples/desktop/desktop.pro index 3333578451d..02d3ec88888 100644 --- a/examples/desktop/desktop.pro +++ b/examples/desktop/desktop.pro @@ -9,4 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/desktop INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/desktop/screenshot/screenshot.cpp b/examples/desktop/screenshot/screenshot.cpp index 0d7a18842a8..683682ae522 100644 --- a/examples/desktop/screenshot/screenshot.cpp +++ b/examples/desktop/screenshot/screenshot.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "screenshot.h" diff --git a/examples/desktop/screenshot/screenshot.pro b/examples/desktop/screenshot/screenshot.pro index d86f0381529..1402ad42b98 100644 --- a/examples/desktop/screenshot/screenshot.pro +++ b/examples/desktop/screenshot/screenshot.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/desktop/screenshot INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) maemo5: warning(This example might not fully work on Maemo platform) diff --git a/examples/dialogs/classwizard/classwizard.cpp b/examples/dialogs/classwizard/classwizard.cpp index 5247d7e2ae8..64039ae44fa 100644 --- a/examples/dialogs/classwizard/classwizard.cpp +++ b/examples/dialogs/classwizard/classwizard.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "classwizard.h" diff --git a/examples/dialogs/classwizard/classwizard.pro b/examples/dialogs/classwizard/classwizard.pro index 09cdce2b4c9..6dd1cac37c1 100644 --- a/examples/dialogs/classwizard/classwizard.pro +++ b/examples/dialogs/classwizard/classwizard.pro @@ -10,6 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/classwizard INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) maemo5: warning(This example might not fully work on Maemo platform) diff --git a/examples/dialogs/configdialog/configdialog.cpp b/examples/dialogs/configdialog/configdialog.cpp index 0e1de0c61c0..d0f071440db 100644 --- a/examples/dialogs/configdialog/configdialog.cpp +++ b/examples/dialogs/configdialog/configdialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "configdialog.h" #include "pages.h" diff --git a/examples/dialogs/configdialog/configdialog.pro b/examples/dialogs/configdialog/configdialog.pro index 1a7e9fccf81..51a7f457d7d 100644 --- a/examples/dialogs/configdialog/configdialog.pro +++ b/examples/dialogs/configdialog/configdialog.pro @@ -14,6 +14,7 @@ INSTALLS += target sources symbian: CONFIG += qt_example wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) maemo5: warning(This example might not fully work on Maemo platform) diff --git a/examples/dialogs/configdialog/pages.cpp b/examples/dialogs/configdialog/pages.cpp index f69ec53f830..84949dd0753 100644 --- a/examples/dialogs/configdialog/pages.cpp +++ b/examples/dialogs/configdialog/pages.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "pages.h" diff --git a/examples/dialogs/dialogs.pro b/examples/dialogs/dialogs.pro index 5bdac5a63d6..47444c10f13 100644 --- a/examples/dialogs/dialogs.pro +++ b/examples/dialogs/dialogs.pro @@ -17,4 +17,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs INSTALLS += sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/dialogs/extension/extension.pro b/examples/dialogs/extension/extension.pro index db57fc8361f..5511f371506 100644 --- a/examples/dialogs/extension/extension.pro +++ b/examples/dialogs/extension/extension.pro @@ -9,5 +9,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/extension INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/dialogs/extension/finddialog.cpp b/examples/dialogs/extension/finddialog.cpp index 2ce0391d3ce..0e797edf813 100644 --- a/examples/dialogs/extension/finddialog.cpp +++ b/examples/dialogs/extension/finddialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "finddialog.h" diff --git a/examples/dialogs/findfiles/findfiles.pro b/examples/dialogs/findfiles/findfiles.pro index 865fb8e0bae..c19d47e2711 100644 --- a/examples/dialogs/findfiles/findfiles.pro +++ b/examples/dialogs/findfiles/findfiles.pro @@ -9,4 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/findfiles INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/dialogs/findfiles/window.cpp b/examples/dialogs/findfiles/window.cpp index f700e82d5eb..d2ffd0988e5 100644 --- a/examples/dialogs/findfiles/window.cpp +++ b/examples/dialogs/findfiles/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/dialogs/licensewizard/licensewizard.cpp b/examples/dialogs/licensewizard/licensewizard.cpp index 19a0c069e48..1c9587161b8 100644 --- a/examples/dialogs/licensewizard/licensewizard.cpp +++ b/examples/dialogs/licensewizard/licensewizard.cpp @@ -38,7 +38,9 @@ ** ****************************************************************************/ -#include +#include +#include +#include #include "licensewizard.h" @@ -350,10 +352,12 @@ void ConclusionPage::setVisible(bool visible) void ConclusionPage::printButtonClicked() { +#ifndef QT_NO_PRINTER QPrinter printer; QPrintDialog dialog(&printer, this); if (dialog.exec()) QMessageBox::warning(this, tr("Print License"), tr("As an environmentally friendly measure, the " "license text will not actually be printed.")); +#endif } diff --git a/examples/dialogs/licensewizard/licensewizard.pro b/examples/dialogs/licensewizard/licensewizard.pro index 4c43e7ae911..20b533644eb 100644 --- a/examples/dialogs/licensewizard/licensewizard.pro +++ b/examples/dialogs/licensewizard/licensewizard.pro @@ -10,6 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/licensewizard INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets printsupport maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) maemo5: warning(This example might not fully work on Maemo platform) diff --git a/examples/dialogs/sipdialog/dialog.cpp b/examples/dialogs/sipdialog/dialog.cpp index c6d5a1767fc..3dd37e368bf 100644 --- a/examples/dialogs/sipdialog/dialog.cpp +++ b/examples/dialogs/sipdialog/dialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "dialog.h" diff --git a/examples/dialogs/sipdialog/main.cpp b/examples/dialogs/sipdialog/main.cpp index bd37e33960d..aa1151c0a99 100644 --- a/examples/dialogs/sipdialog/main.cpp +++ b/examples/dialogs/sipdialog/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "dialog.h" diff --git a/examples/dialogs/sipdialog/sipdialog.pro b/examples/dialogs/sipdialog/sipdialog.pro index 989e63734af..cea038ede32 100644 --- a/examples/dialogs/sipdialog/sipdialog.pro +++ b/examples/dialogs/sipdialog/sipdialog.pro @@ -11,6 +11,8 @@ INSTALLS += target sources symbian: CONFIG += qt_example wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib +QT += widgets + maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) maemo5: warning(This example might not fully work on Maemo platform) diff --git a/examples/dialogs/standarddialogs/dialog.cpp b/examples/dialogs/standarddialogs/dialog.cpp index a59b3c5ef75..28fdaaad80c 100644 --- a/examples/dialogs/standarddialogs/dialog.cpp +++ b/examples/dialogs/standarddialogs/dialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "dialog.h" diff --git a/examples/dialogs/standarddialogs/standarddialogs.pro b/examples/dialogs/standarddialogs/standarddialogs.pro index c9fb4a3a5ed..59cd79f413d 100644 --- a/examples/dialogs/standarddialogs/standarddialogs.pro +++ b/examples/dialogs/standarddialogs/standarddialogs.pro @@ -11,4 +11,5 @@ INSTALLS += target sources symbian: CONFIG += qt_example wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/dialogs/tabdialog/tabdialog.cpp b/examples/dialogs/tabdialog/tabdialog.cpp index 5d4d345a0c6..e38946a8ff8 100644 --- a/examples/dialogs/tabdialog/tabdialog.cpp +++ b/examples/dialogs/tabdialog/tabdialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "tabdialog.h" diff --git a/examples/dialogs/tabdialog/tabdialog.pro b/examples/dialogs/tabdialog/tabdialog.pro index 54c95a6becc..4e01a68b96c 100644 --- a/examples/dialogs/tabdialog/tabdialog.pro +++ b/examples/dialogs/tabdialog/tabdialog.pro @@ -10,6 +10,7 @@ INSTALLS += target sources symbian: CONFIG += qt_example wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) maemo5: warning(This example might not fully work on Maemo platform) diff --git a/examples/dialogs/trivialwizard/trivialwizard.cpp b/examples/dialogs/trivialwizard/trivialwizard.cpp index 3dbc039b625..df7d4e6559d 100644 --- a/examples/dialogs/trivialwizard/trivialwizard.cpp +++ b/examples/dialogs/trivialwizard/trivialwizard.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include diff --git a/examples/dialogs/trivialwizard/trivialwizard.pro b/examples/dialogs/trivialwizard/trivialwizard.pro index 0321ac8fdb5..b2a285e95a3 100644 --- a/examples/dialogs/trivialwizard/trivialwizard.pro +++ b/examples/dialogs/trivialwizard/trivialwizard.pro @@ -7,6 +7,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/trivialwizard INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/draganddrop/draganddrop.pro b/examples/draganddrop/draganddrop.pro index 8f737f1918e..6759520ddc6 100644 --- a/examples/draganddrop/draganddrop.pro +++ b/examples/draganddrop/draganddrop.pro @@ -11,3 +11,4 @@ symbian: SUBDIRS -= dropsite sources.files = README *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop INSTALLS += sources +QT += widgets diff --git a/examples/draganddrop/draggableicons/draggableicons.pro b/examples/draganddrop/draggableicons/draggableicons.pro index 36e14b58003..792de0a73ce 100644 --- a/examples/draganddrop/draggableicons/draggableicons.pro +++ b/examples/draganddrop/draggableicons/draggableicons.pro @@ -13,4 +13,5 @@ symbian { TARGET.UID3 = 0xA000C615 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/draganddrop/draggableicons/dragwidget.cpp b/examples/draganddrop/draggableicons/dragwidget.cpp index 46bfff93306..e465e8ada58 100644 --- a/examples/draganddrop/draggableicons/dragwidget.cpp +++ b/examples/draganddrop/draggableicons/dragwidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "dragwidget.h" diff --git a/examples/draganddrop/draggabletext/draggabletext.pro b/examples/draganddrop/draggabletext/draggabletext.pro index 0bc3dd154bb..38c20663a2e 100644 --- a/examples/draganddrop/draggabletext/draggabletext.pro +++ b/examples/draganddrop/draggabletext/draggabletext.pro @@ -15,5 +15,6 @@ symbian { TARGET.UID3 = 0xA000CF64 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/draganddrop/draggabletext/draglabel.cpp b/examples/draganddrop/draggabletext/draglabel.cpp index dff09da14fa..9eb5dfac0b5 100644 --- a/examples/draganddrop/draggabletext/draglabel.cpp +++ b/examples/draganddrop/draggabletext/draglabel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "draglabel.h" diff --git a/examples/draganddrop/draggabletext/dragwidget.cpp b/examples/draganddrop/draggabletext/dragwidget.cpp index 060d41de2d7..5287c998a31 100644 --- a/examples/draganddrop/draggabletext/dragwidget.cpp +++ b/examples/draganddrop/draggabletext/dragwidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "draglabel.h" #include "dragwidget.h" diff --git a/examples/draganddrop/dropsite/droparea.cpp b/examples/draganddrop/dropsite/droparea.cpp index 2a83de888e5..c3cac7bf45c 100644 --- a/examples/draganddrop/dropsite/droparea.cpp +++ b/examples/draganddrop/dropsite/droparea.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "droparea.h" diff --git a/examples/draganddrop/dropsite/dropsite.pro b/examples/draganddrop/dropsite/dropsite.pro index b3be1b64cb9..c725992f26f 100644 --- a/examples/draganddrop/dropsite/dropsite.pro +++ b/examples/draganddrop/dropsite/dropsite.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/draganddrop/dropsite INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) maemo5: warning(This example might not fully work on Maemo platform) diff --git a/examples/draganddrop/dropsite/dropsitewindow.cpp b/examples/draganddrop/dropsite/dropsitewindow.cpp index db7d6e35669..191470207e3 100644 --- a/examples/draganddrop/dropsite/dropsitewindow.cpp +++ b/examples/draganddrop/dropsite/dropsitewindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "droparea.h" #include "dropsitewindow.h" diff --git a/examples/draganddrop/fridgemagnets/draglabel.cpp b/examples/draganddrop/fridgemagnets/draglabel.cpp index 986f0b28c8d..dd5ddb57d9f 100644 --- a/examples/draganddrop/fridgemagnets/draglabel.cpp +++ b/examples/draganddrop/fridgemagnets/draglabel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "draglabel.h" diff --git a/examples/draganddrop/fridgemagnets/dragwidget.cpp b/examples/draganddrop/fridgemagnets/dragwidget.cpp index 19abfb69761..3dcd406174d 100644 --- a/examples/draganddrop/fridgemagnets/dragwidget.cpp +++ b/examples/draganddrop/fridgemagnets/dragwidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "draglabel.h" #include "dragwidget.h" diff --git a/examples/draganddrop/fridgemagnets/fridgemagnets.pro b/examples/draganddrop/fridgemagnets/fridgemagnets.pro index 9a34a5c29c0..481fffd5fec 100644 --- a/examples/draganddrop/fridgemagnets/fridgemagnets.pro +++ b/examples/draganddrop/fridgemagnets/fridgemagnets.pro @@ -16,4 +16,6 @@ symbian { CONFIG += qt_example } +QT += widgets + maemo5: CONFIG += qt_example diff --git a/examples/draganddrop/puzzle/mainwindow.cpp b/examples/draganddrop/puzzle/mainwindow.cpp index 09fcaf7c59c..c00892a0988 100644 --- a/examples/draganddrop/puzzle/mainwindow.cpp +++ b/examples/draganddrop/puzzle/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "mainwindow.h" diff --git a/examples/draganddrop/puzzle/pieceslist.cpp b/examples/draganddrop/puzzle/pieceslist.cpp index 5eb4984146a..181cd56427d 100644 --- a/examples/draganddrop/puzzle/pieceslist.cpp +++ b/examples/draganddrop/puzzle/pieceslist.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "pieceslist.h" diff --git a/examples/draganddrop/puzzle/puzzle.pro b/examples/draganddrop/puzzle/puzzle.pro index fa8ad81b2ab..d084827a451 100644 --- a/examples/draganddrop/puzzle/puzzle.pro +++ b/examples/draganddrop/puzzle/puzzle.pro @@ -27,4 +27,5 @@ wince*: { addFile.path = . DEPLOYMENT += addFile } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/draganddrop/puzzle/puzzlewidget.cpp b/examples/draganddrop/puzzle/puzzlewidget.cpp index e83f248112c..cee2596a61b 100644 --- a/examples/draganddrop/puzzle/puzzlewidget.cpp +++ b/examples/draganddrop/puzzle/puzzlewidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "puzzlewidget.h" diff --git a/examples/effects/blurpicker/blurpicker.cpp b/examples/effects/blurpicker/blurpicker.cpp index 362ec439310..5883c741bef 100644 --- a/examples/effects/blurpicker/blurpicker.cpp +++ b/examples/effects/blurpicker/blurpicker.cpp @@ -40,7 +40,7 @@ #include "blurpicker.h" -#include +#include #include "blureffect.h" diff --git a/examples/effects/blurpicker/blurpicker.pro b/examples/effects/blurpicker/blurpicker.pro index 913dd103063..ca651b8858f 100644 --- a/examples/effects/blurpicker/blurpicker.pro +++ b/examples/effects/blurpicker/blurpicker.pro @@ -7,6 +7,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/blurpicker sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS blurpicker.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/blurpicker INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/effects/effects.pro b/examples/effects/effects.pro index 4b13387902a..db7b8a723e8 100644 --- a/examples/effects/effects.pro +++ b/examples/effects/effects.pro @@ -11,3 +11,4 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS effects.pro README sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects INSTALLS += target sources +QT += widgets diff --git a/examples/effects/fademessage/fademessage.cpp b/examples/effects/fademessage/fademessage.cpp index 158f0491bc3..b6e94e5e2e9 100644 --- a/examples/effects/fademessage/fademessage.cpp +++ b/examples/effects/fademessage/fademessage.cpp @@ -40,7 +40,7 @@ #include "fademessage.h" -#include +#include FadeMessage::FadeMessage(QWidget *parent): QGraphicsView(parent) { diff --git a/examples/effects/fademessage/fademessage.pro b/examples/effects/fademessage/fademessage.pro index 78a4ac652fa..261bee42f99 100644 --- a/examples/effects/fademessage/fademessage.pro +++ b/examples/effects/fademessage/fademessage.pro @@ -15,4 +15,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/fademessage symbian: CONFIG += qt_example maemo5: CONFIG += qt_example +QT += widgets simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/effects/lighting/lighting.cpp b/examples/effects/lighting/lighting.cpp index bd23a2d21a2..4532fafe25f 100644 --- a/examples/effects/lighting/lighting.cpp +++ b/examples/effects/lighting/lighting.cpp @@ -40,7 +40,7 @@ #include "lighting.h" -#include +#include #ifndef M_PI #define M_PI 3.14159265358979323846 diff --git a/examples/effects/lighting/lighting.pro b/examples/effects/lighting/lighting.pro index 1dbb3ee289f..1876a7b3aff 100644 --- a/examples/effects/lighting/lighting.pro +++ b/examples/effects/lighting/lighting.pro @@ -6,6 +6,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/lighting sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS lighting.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/effects/lighting INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/embedded/digiflip/digiflip.cpp b/examples/embedded/digiflip/digiflip.cpp index 895524355e9..38501d3eccc 100644 --- a/examples/embedded/digiflip/digiflip.cpp +++ b/examples/embedded/digiflip/digiflip.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include +#include class Digits: public QWidget { diff --git a/examples/embedded/embedded.pro b/examples/embedded/embedded.pro index 0063c0038ad..8670fcb3a55 100644 --- a/examples/embedded/embedded.pro +++ b/examples/embedded/embedded.pro @@ -10,3 +10,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/embedded INSTALLS += sources symbian: CONFIG += qt_demo +QT += widgets widgets diff --git a/examples/embedded/flickable/flickable.cpp b/examples/embedded/flickable/flickable.cpp index edcc1a73964..0c707a172b0 100644 --- a/examples/embedded/flickable/flickable.cpp +++ b/examples/embedded/flickable/flickable.cpp @@ -42,7 +42,7 @@ #include "flickable.h" #include -#include +#include class FlickableTicker: QObject { diff --git a/examples/embedded/flickable/flickable.pro b/examples/embedded/flickable/flickable.pro index e90e64f89fd..d31e7eba14d 100644 --- a/examples/embedded/flickable/flickable.pro +++ b/examples/embedded/flickable/flickable.pro @@ -10,3 +10,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/embedded/flickable sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/embedded/flickable INSTALLS += target sources +QT += widgets widgets diff --git a/examples/embedded/flickable/main.cpp b/examples/embedded/flickable/main.cpp index 3711a6dc57b..5ecc0c10df5 100644 --- a/examples/embedded/flickable/main.cpp +++ b/examples/embedded/flickable/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include +#include #include "flickable.h" diff --git a/examples/embedded/flightinfo/flightinfo.cpp b/examples/embedded/flightinfo/flightinfo.cpp index 58e71c83761..592357cab44 100644 --- a/examples/embedded/flightinfo/flightinfo.cpp +++ b/examples/embedded/flightinfo/flightinfo.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include +#include #include #include "ui_form.h" diff --git a/examples/embedded/flightinfo/flightinfo.pro b/examples/embedded/flightinfo/flightinfo.pro index 9fce741b9c7..89a7265d411 100644 --- a/examples/embedded/flightinfo/flightinfo.pro +++ b/examples/embedded/flightinfo/flightinfo.pro @@ -3,7 +3,7 @@ TARGET = flightinfo SOURCES = flightinfo.cpp FORMS += form.ui RESOURCES = flightinfo.qrc -QT += network +QT += network widgets symbian { TARGET.UID3 = 0xA000CF74 diff --git a/examples/embedded/lightmaps/lightmaps.cpp b/examples/embedded/lightmaps/lightmaps.cpp index d672530e197..2489ddc8404 100644 --- a/examples/embedded/lightmaps/lightmaps.cpp +++ b/examples/embedded/lightmaps/lightmaps.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include +#include #include #include diff --git a/examples/embedded/lightmaps/lightmaps.pro b/examples/embedded/lightmaps/lightmaps.pro index 7622f885117..1f638b53988 100644 --- a/examples/embedded/lightmaps/lightmaps.pro +++ b/examples/embedded/lightmaps/lightmaps.pro @@ -6,7 +6,7 @@ SOURCES = lightmaps.cpp \ main.cpp \ mapzoom.cpp \ slippymap.cpp -QT += network +QT += network widgets symbian { TARGET.UID3 = 0xA000CF75 diff --git a/examples/embedded/lightmaps/mapzoom.cpp b/examples/embedded/lightmaps/mapzoom.cpp index d01457e3f48..225c54c2a6b 100644 --- a/examples/embedded/lightmaps/mapzoom.cpp +++ b/examples/embedded/lightmaps/mapzoom.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include #include #include "lightmaps.h" #include "mapzoom.h" diff --git a/examples/embedded/lightmaps/slippymap.cpp b/examples/embedded/lightmaps/slippymap.cpp index 8c71f2946a8..e2a2eaa0bcd 100644 --- a/examples/embedded/lightmaps/slippymap.cpp +++ b/examples/embedded/lightmaps/slippymap.cpp @@ -41,7 +41,7 @@ #include -#include +#include #include #include "slippymap.h" diff --git a/examples/embedded/raycasting/raycasting.cpp b/examples/embedded/raycasting/raycasting.cpp index d404044a9a2..0a50fb04194 100644 --- a/examples/embedded/raycasting/raycasting.cpp +++ b/examples/embedded/raycasting/raycasting.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include -#include +#include #include diff --git a/examples/embedded/raycasting/raycasting.pro b/examples/embedded/raycasting/raycasting.pro index 83103a5aad2..181eadf74c9 100644 --- a/examples/embedded/raycasting/raycasting.pro +++ b/examples/embedded/raycasting/raycasting.pro @@ -11,3 +11,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/embedded/raycasting sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/embedded/raycasting INSTALLS += target sources +QT += widgets widgets diff --git a/examples/embedded/styleexample/styleexample.pro b/examples/embedded/styleexample/styleexample.pro index 70942fd4441..5b1273e6aa7 100644 --- a/examples/embedded/styleexample/styleexample.pro +++ b/examples/embedded/styleexample/styleexample.pro @@ -15,3 +15,4 @@ symbian { TARGET.UID3 = 0xA000A63F CONFIG += qt_example } +QT += widgets widgets diff --git a/examples/examples.pro b/examples/examples.pro index 3abcf22af7e..23271ebe532 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,3 +1,5 @@ +Qt += widgets + TEMPLATE = subdirs SUBDIRS = \ network \ @@ -44,16 +46,13 @@ symbian: SUBDIRS = \ gestures \ xml -!contains(QT_CONFIG, no-gui):contains(QT_CONFIG, multimedia) { - SUBDIRS += multimedia -} +qpa:SUBDIRS += qpa wince*|symbian|embedded|x11:!contains(QT_CONFIG, no-gui): SUBDIRS += embedded embedded:SUBDIRS += qws contains(QT_BUILD_PARTS, tools):!contains(QT_CONFIG, no-gui):SUBDIRS += qtestlib contains(QT_CONFIG, opengl): SUBDIRS += opengl -contains(QT_CONFIG, openvg): SUBDIRS += openvg contains(QT_CONFIG, dbus): SUBDIRS += dbus contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows contains(QT_CONFIG, concurrent): SUBDIRS += qtconcurrent @@ -64,4 +63,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES] INSTALLS += sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/gestures/gestures.pro b/examples/gestures/gestures.pro index 1e9e2270f33..b354ec46458 100644 --- a/examples/gestures/gestures.pro +++ b/examples/gestures/gestures.pro @@ -8,3 +8,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/gestures sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS gestures.pro README sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/gestures INSTALLS += target sources +QT += widgets diff --git a/examples/gestures/imagegestures/imagegestures.pro b/examples/gestures/imagegestures/imagegestures.pro index 64810b0aeb4..03fd2e8ff3d 100644 --- a/examples/gestures/imagegestures/imagegestures.pro +++ b/examples/gestures/imagegestures/imagegestures.pro @@ -19,6 +19,7 @@ symbian { TARGET.UID3 = 0xA000D7D0 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example does not work on Symbian platform) maemo5: warning(This example does not work on Maemo platform) diff --git a/examples/gestures/imagegestures/imagewidget.cpp b/examples/gestures/imagegestures/imagewidget.cpp index 8bbb96563eb..e12cb413631 100644 --- a/examples/gestures/imagegestures/imagewidget.cpp +++ b/examples/gestures/imagegestures/imagewidget.cpp @@ -41,7 +41,7 @@ #include "imagewidget.h" -#include +#include //! [constructor] ImageWidget::ImageWidget(QWidget *parent) diff --git a/examples/gestures/imagegestures/imagewidget.h b/examples/gestures/imagegestures/imagewidget.h index fff24fbcdfb..1ee7d02224e 100644 --- a/examples/gestures/imagegestures/imagewidget.h +++ b/examples/gestures/imagegestures/imagewidget.h @@ -43,7 +43,7 @@ #include #include -#include +#include QT_BEGIN_NAMESPACE class QGestureEvent; diff --git a/examples/gestures/imagegestures/main.cpp b/examples/gestures/imagegestures/main.cpp index ca37a733f72..4097a2fb312 100644 --- a/examples/gestures/imagegestures/main.cpp +++ b/examples/gestures/imagegestures/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwidget.h" diff --git a/examples/graphicsview/anchorlayout/anchorlayout.pro b/examples/graphicsview/anchorlayout/anchorlayout.pro index b4a75653e04..abe55f2ef6f 100644 --- a/examples/graphicsview/anchorlayout/anchorlayout.pro +++ b/examples/graphicsview/anchorlayout/anchorlayout.pro @@ -7,6 +7,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/anchorlayout INSTALLS += target sources TARGET = anchorlayout +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/graphicsview/anchorlayout/main.cpp b/examples/graphicsview/anchorlayout/main.cpp index dbe9f198805..f9f93fb961c 100644 --- a/examples/graphicsview/anchorlayout/main.cpp +++ b/examples/graphicsview/anchorlayout/main.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include static QGraphicsProxyWidget *createItem(const QSizeF &minimum = QSizeF(100.0, 100.0), const QSizeF &preferred = QSize(150.0, 100.0), diff --git a/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro b/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro index 32c94ca8c92..88fa8182ab2 100644 --- a/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro +++ b/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro @@ -15,5 +15,6 @@ symbian { TARGET.UID3 = 0xA000A645 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/graphicsview/basicgraphicslayouts/layoutitem.h b/examples/graphicsview/basicgraphicslayouts/layoutitem.h index 448e9bac3f7..3d83d4cd88e 100644 --- a/examples/graphicsview/basicgraphicslayouts/layoutitem.h +++ b/examples/graphicsview/basicgraphicslayouts/layoutitem.h @@ -40,7 +40,7 @@ #ifndef LAYOUTITEM_H #define LAYOUTITEM_H -#include +#include //! [0] class LayoutItem : public QGraphicsLayoutItem, public QGraphicsItem diff --git a/examples/graphicsview/basicgraphicslayouts/main.cpp b/examples/graphicsview/basicgraphicslayouts/main.cpp index 11da1838f34..4a9e8f91b4a 100644 --- a/examples/graphicsview/basicgraphicslayouts/main.cpp +++ b/examples/graphicsview/basicgraphicslayouts/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/graphicsview/basicgraphicslayouts/window.h b/examples/graphicsview/basicgraphicslayouts/window.h index b2166f05527..4efa1ecd3af 100644 --- a/examples/graphicsview/basicgraphicslayouts/window.h +++ b/examples/graphicsview/basicgraphicslayouts/window.h @@ -41,7 +41,7 @@ #ifndef WINDOW_H #define WINDOW_H -#include +#include //! [0] class Window : public QGraphicsWidget { diff --git a/examples/graphicsview/boxes/boxes.pro b/examples/graphicsview/boxes/boxes.pro index 49de5a9e506..176bc3a1cfa 100644 --- a/examples/graphicsview/boxes/boxes.pro +++ b/examples/graphicsview/boxes/boxes.pro @@ -27,7 +27,7 @@ SOURCES += 3rdparty/fbm.c \ RESOURCES += boxes.qrc -QT += opengl +QT += opengl widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/boxes diff --git a/examples/graphicsview/boxes/glbuffers.h b/examples/graphicsview/boxes/glbuffers.h index 6b18d3f1282..1a53fa2c1a3 100644 --- a/examples/graphicsview/boxes/glbuffers.h +++ b/examples/graphicsview/boxes/glbuffers.h @@ -45,7 +45,7 @@ //#include #include "glextensions.h" -#include +#include #include #define BUFFER_OFFSET(i) ((char*)0 + (i)) diff --git a/examples/graphicsview/boxes/gltrianglemesh.h b/examples/graphicsview/boxes/gltrianglemesh.h index ecf6531d85f..f023938b7b1 100644 --- a/examples/graphicsview/boxes/gltrianglemesh.h +++ b/examples/graphicsview/boxes/gltrianglemesh.h @@ -45,7 +45,7 @@ //#include #include "glextensions.h" -#include +#include #include #include "glbuffers.h" diff --git a/examples/graphicsview/boxes/main.cpp b/examples/graphicsview/boxes/main.cpp index 483170801f1..e7dced71d24 100644 --- a/examples/graphicsview/boxes/main.cpp +++ b/examples/graphicsview/boxes/main.cpp @@ -44,7 +44,7 @@ #include "scene.h" -#include +#include #include class GraphicsView : public QGraphicsView diff --git a/examples/graphicsview/boxes/qtbox.h b/examples/graphicsview/boxes/qtbox.h index 56b86a55bba..81ef8ae7d50 100644 --- a/examples/graphicsview/boxes/qtbox.h +++ b/examples/graphicsview/boxes/qtbox.h @@ -42,7 +42,7 @@ #ifndef QTBOX_H #define QTBOX_H -#include +#include #include #include "glbuffers.h" diff --git a/examples/graphicsview/boxes/roundedbox.h b/examples/graphicsview/boxes/roundedbox.h index 54dda820008..e4e7c589d39 100644 --- a/examples/graphicsview/boxes/roundedbox.h +++ b/examples/graphicsview/boxes/roundedbox.h @@ -45,7 +45,7 @@ //#include #include "glextensions.h" -#include +#include #include #include "gltrianglemesh.h" diff --git a/examples/graphicsview/boxes/scene.h b/examples/graphicsview/boxes/scene.h index 96ee908d587..357f955bb66 100644 --- a/examples/graphicsview/boxes/scene.h +++ b/examples/graphicsview/boxes/scene.h @@ -45,7 +45,7 @@ //#include #include "glextensions.h" -#include +#include #include #include "roundedbox.h" diff --git a/examples/graphicsview/boxes/trackball.h b/examples/graphicsview/boxes/trackball.h index 097851a42c0..cc3d5ade34d 100644 --- a/examples/graphicsview/boxes/trackball.h +++ b/examples/graphicsview/boxes/trackball.h @@ -42,7 +42,7 @@ #ifndef TRACKBALL_H #define TRACKBALL_H -#include +#include #include #include diff --git a/examples/graphicsview/chip/chip.cpp b/examples/graphicsview/chip/chip.cpp index 21b63bae2cf..b47069b20c7 100644 --- a/examples/graphicsview/chip/chip.cpp +++ b/examples/graphicsview/chip/chip.cpp @@ -41,7 +41,7 @@ #include "chip.h" -#include +#include Chip::Chip(const QColor &color, int x, int y) { diff --git a/examples/graphicsview/chip/chip.h b/examples/graphicsview/chip/chip.h index ff9f6368436..460969451bb 100644 --- a/examples/graphicsview/chip/chip.h +++ b/examples/graphicsview/chip/chip.h @@ -43,7 +43,7 @@ #define CHIP_H #include -#include +#include class Chip : public QGraphicsItem { diff --git a/examples/graphicsview/chip/chip.pro b/examples/graphicsview/chip/chip.pro index aff551ef9f1..5bf1b88164a 100644 --- a/examples/graphicsview/chip/chip.pro +++ b/examples/graphicsview/chip/chip.pro @@ -4,6 +4,7 @@ HEADERS += mainwindow.h view.h chip.h SOURCES += main.cpp SOURCES += mainwindow.cpp view.cpp chip.cpp +QT += widgets printsupport contains(QT_CONFIG, opengl):QT += opengl build_all:!build_pass { diff --git a/examples/graphicsview/chip/mainwindow.cpp b/examples/graphicsview/chip/mainwindow.cpp index 41117c3d471..a8f4675c132 100644 --- a/examples/graphicsview/chip/mainwindow.cpp +++ b/examples/graphicsview/chip/mainwindow.cpp @@ -43,7 +43,7 @@ #include "view.h" #include "chip.h" -#include +#include MainWindow::MainWindow(QWidget *parent) : QWidget(parent) diff --git a/examples/graphicsview/chip/mainwindow.h b/examples/graphicsview/chip/mainwindow.h index 650e1f1f3c0..a5ea9402d78 100644 --- a/examples/graphicsview/chip/mainwindow.h +++ b/examples/graphicsview/chip/mainwindow.h @@ -42,7 +42,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include QT_FORWARD_DECLARE_CLASS(QGraphicsScene) QT_FORWARD_DECLARE_CLASS(QGraphicsView) diff --git a/examples/graphicsview/chip/view.cpp b/examples/graphicsview/chip/view.cpp index 5634f85d987..072dafaed46 100644 --- a/examples/graphicsview/chip/view.cpp +++ b/examples/graphicsview/chip/view.cpp @@ -41,7 +41,10 @@ #include "view.h" -#include +#include +#include +#include + #ifndef QT_NO_OPENGL #include #endif diff --git a/examples/graphicsview/collidingmice/collidingmice.pro b/examples/graphicsview/collidingmice/collidingmice.pro index 05971c5f6db..1c1c2683cfe 100644 --- a/examples/graphicsview/collidingmice/collidingmice.pro +++ b/examples/graphicsview/collidingmice/collidingmice.pro @@ -17,5 +17,6 @@ symbian { TARGET.UID3 = 0xA000A643 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/graphicsview/collidingmice/main.cpp b/examples/graphicsview/collidingmice/main.cpp index 43594029fa0..561887995eb 100644 --- a/examples/graphicsview/collidingmice/main.cpp +++ b/examples/graphicsview/collidingmice/main.cpp @@ -40,7 +40,7 @@ #include "mouse.h" -#include +#include #include diff --git a/examples/graphicsview/diagramscene/arrow.cpp b/examples/graphicsview/diagramscene/arrow.cpp index 188928d1d83..34142ff71b1 100644 --- a/examples/graphicsview/diagramscene/arrow.cpp +++ b/examples/graphicsview/diagramscene/arrow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "arrow.h" #include diff --git a/examples/graphicsview/diagramscene/diagramitem.cpp b/examples/graphicsview/diagramscene/diagramitem.cpp index cd7ce0c6e18..31c9627f9ab 100644 --- a/examples/graphicsview/diagramscene/diagramitem.cpp +++ b/examples/graphicsview/diagramscene/diagramitem.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "diagramitem.h" #include "arrow.h" diff --git a/examples/graphicsview/diagramscene/diagramscene.cpp b/examples/graphicsview/diagramscene/diagramscene.cpp index 7592224db7c..4ce5c68841d 100644 --- a/examples/graphicsview/diagramscene/diagramscene.cpp +++ b/examples/graphicsview/diagramscene/diagramscene.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "diagramscene.h" #include "arrow.h" diff --git a/examples/graphicsview/diagramscene/diagramscene.pro b/examples/graphicsview/diagramscene/diagramscene.pro index 0703365d076..99cd4dea787 100644 --- a/examples/graphicsview/diagramscene/diagramscene.pro +++ b/examples/graphicsview/diagramscene/diagramscene.pro @@ -21,6 +21,7 @@ INSTALLS += target sources symbian: CONFIG += qt_example maemo5: CONFIG += qt_example +QT += widgets symbian: warning(This example might not fully work on Symbian platform) maemo5: warning(This example might not fully work on Maemo platform) simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/graphicsview/diagramscene/diagramtextitem.cpp b/examples/graphicsview/diagramscene/diagramtextitem.cpp index 588603eda5e..f8858f1f517 100644 --- a/examples/graphicsview/diagramscene/diagramtextitem.cpp +++ b/examples/graphicsview/diagramscene/diagramtextitem.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "diagramtextitem.h" #include "diagramscene.h" diff --git a/examples/graphicsview/diagramscene/main.cpp b/examples/graphicsview/diagramscene/main.cpp index fcd027cb44d..bab04ef1aa0 100644 --- a/examples/graphicsview/diagramscene/main.cpp +++ b/examples/graphicsview/diagramscene/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/graphicsview/diagramscene/mainwindow.cpp b/examples/graphicsview/diagramscene/mainwindow.cpp index 87eb33e7eef..edf7d3c3f30 100644 --- a/examples/graphicsview/diagramscene/mainwindow.cpp +++ b/examples/graphicsview/diagramscene/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "mainwindow.h" diff --git a/examples/graphicsview/dragdroprobot/coloritem.cpp b/examples/graphicsview/dragdroprobot/coloritem.cpp index 81e8f5607be..24b8491a6b5 100644 --- a/examples/graphicsview/dragdroprobot/coloritem.cpp +++ b/examples/graphicsview/dragdroprobot/coloritem.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "coloritem.h" diff --git a/examples/graphicsview/dragdroprobot/dragdroprobot.pro b/examples/graphicsview/dragdroprobot/dragdroprobot.pro index 0fe241dbd2b..db5d94a6004 100644 --- a/examples/graphicsview/dragdroprobot/dragdroprobot.pro +++ b/examples/graphicsview/dragdroprobot/dragdroprobot.pro @@ -18,6 +18,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/dragdroprobot INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/graphicsview/dragdroprobot/main.cpp b/examples/graphicsview/dragdroprobot/main.cpp index c8b84ecb97e..9b6f95c7a25 100644 --- a/examples/graphicsview/dragdroprobot/main.cpp +++ b/examples/graphicsview/dragdroprobot/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "coloritem.h" #include "robot.h" @@ -53,7 +53,7 @@ public: } protected: - virtual void resizeEvent(QResizeEvent *event) + virtual void resizeEvent(QResizeEvent *) { #if defined(Q_OS_SYMBIAN) fitInView(sceneRect(), Qt::KeepAspectRatio); diff --git a/examples/graphicsview/dragdroprobot/robot.cpp b/examples/graphicsview/dragdroprobot/robot.cpp index 9494e7af7f8..df585a948fd 100644 --- a/examples/graphicsview/dragdroprobot/robot.cpp +++ b/examples/graphicsview/dragdroprobot/robot.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "robot.h" diff --git a/examples/graphicsview/elasticnodes/elasticnodes.pro b/examples/graphicsview/elasticnodes/elasticnodes.pro index 965d824c7f1..6b591a8c662 100644 --- a/examples/graphicsview/elasticnodes/elasticnodes.pro +++ b/examples/graphicsview/elasticnodes/elasticnodes.pro @@ -21,6 +21,7 @@ symbian { TARGET.UID3 = 0xA000A642 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/graphicsview/elasticnodes/graphwidget.cpp b/examples/graphicsview/elasticnodes/graphwidget.cpp index f6bf05de31d..48a9784c547 100644 --- a/examples/graphicsview/elasticnodes/graphwidget.cpp +++ b/examples/graphicsview/elasticnodes/graphwidget.cpp @@ -42,7 +42,7 @@ #include "edge.h" #include "node.h" -#include +#include #include diff --git a/examples/graphicsview/elasticnodes/graphwidget.h b/examples/graphicsview/elasticnodes/graphwidget.h index 524ef67b8a0..354967bdd20 100644 --- a/examples/graphicsview/elasticnodes/graphwidget.h +++ b/examples/graphicsview/elasticnodes/graphwidget.h @@ -41,7 +41,7 @@ #ifndef GRAPHWIDGET_H #define GRAPHWIDGET_H -#include +#include class Node; diff --git a/examples/graphicsview/elasticnodes/main.cpp b/examples/graphicsview/elasticnodes/main.cpp index d653da53559..9eb8ba11be3 100644 --- a/examples/graphicsview/elasticnodes/main.cpp +++ b/examples/graphicsview/elasticnodes/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "graphwidget.h" diff --git a/examples/graphicsview/embeddeddialogs/customproxy.cpp b/examples/graphicsview/embeddeddialogs/customproxy.cpp index cbc622a34f2..13f5f654c2b 100644 --- a/examples/graphicsview/embeddeddialogs/customproxy.cpp +++ b/examples/graphicsview/embeddeddialogs/customproxy.cpp @@ -41,7 +41,7 @@ #include "customproxy.h" -#include +#include CustomProxy::CustomProxy(QGraphicsItem *parent, Qt::WindowFlags wFlags) : QGraphicsProxyWidget(parent, wFlags), popupShown(false), currentPopup(0) diff --git a/examples/graphicsview/embeddeddialogs/customproxy.h b/examples/graphicsview/embeddeddialogs/customproxy.h index 1ceaa06bb39..0ac7c7afe49 100644 --- a/examples/graphicsview/embeddeddialogs/customproxy.h +++ b/examples/graphicsview/embeddeddialogs/customproxy.h @@ -43,7 +43,7 @@ #define CUSTOMPROXY_H #include -#include +#include class CustomProxy : public QGraphicsProxyWidget { diff --git a/examples/graphicsview/embeddeddialogs/embeddeddialog.cpp b/examples/graphicsview/embeddeddialogs/embeddeddialog.cpp index f9323079251..f608fc55589 100644 --- a/examples/graphicsview/embeddeddialogs/embeddeddialog.cpp +++ b/examples/graphicsview/embeddeddialogs/embeddeddialog.cpp @@ -42,7 +42,7 @@ #include "embeddeddialog.h" #include "ui_embeddeddialog.h" -#include +#include EmbeddedDialog::EmbeddedDialog(QWidget *parent) : QDialog(parent) diff --git a/examples/graphicsview/embeddeddialogs/embeddeddialog.h b/examples/graphicsview/embeddeddialogs/embeddeddialog.h index b7f8da085ee..1c7051fac95 100644 --- a/examples/graphicsview/embeddeddialogs/embeddeddialog.h +++ b/examples/graphicsview/embeddeddialogs/embeddeddialog.h @@ -42,7 +42,7 @@ #ifndef EMBEDDEDDIALOG_H #define EMBEDDEDDIALOG_H -#include +#include QT_FORWARD_DECLARE_CLASS(Ui_embeddedDialog); diff --git a/examples/graphicsview/embeddeddialogs/embeddeddialogs.pro b/examples/graphicsview/embeddeddialogs/embeddeddialogs.pro index 31386063f6d..1f4ef91946a 100644 --- a/examples/graphicsview/embeddeddialogs/embeddeddialogs.pro +++ b/examples/graphicsview/embeddeddialogs/embeddeddialogs.pro @@ -16,4 +16,5 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.png *.jpg *.plist *.ic sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/embeddeddialogs INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example diff --git a/examples/graphicsview/embeddeddialogs/main.cpp b/examples/graphicsview/embeddeddialogs/main.cpp index e5defb1471b..0dc61a49301 100644 --- a/examples/graphicsview/embeddeddialogs/main.cpp +++ b/examples/graphicsview/embeddeddialogs/main.cpp @@ -42,7 +42,7 @@ #include "customproxy.h" #include "embeddeddialog.h" -#include +#include int main(int argc, char *argv[]) { diff --git a/examples/graphicsview/flowlayout/flowlayout.cpp b/examples/graphicsview/flowlayout/flowlayout.cpp index 0531e4cce56..cb0ca1b2ded 100644 --- a/examples/graphicsview/flowlayout/flowlayout.cpp +++ b/examples/graphicsview/flowlayout/flowlayout.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ #include "flowlayout.h" -#include +#include #include FlowLayout::FlowLayout() diff --git a/examples/graphicsview/flowlayout/flowlayout.h b/examples/graphicsview/flowlayout/flowlayout.h index aff3382c012..67c3315736f 100644 --- a/examples/graphicsview/flowlayout/flowlayout.h +++ b/examples/graphicsview/flowlayout/flowlayout.h @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include class FlowLayout : public QGraphicsLayout { diff --git a/examples/graphicsview/flowlayout/flowlayout.pro b/examples/graphicsview/flowlayout/flowlayout.pro index 5a79a9bae92..f8d1e4871f3 100644 --- a/examples/graphicsview/flowlayout/flowlayout.pro +++ b/examples/graphicsview/flowlayout/flowlayout.pro @@ -7,6 +7,7 @@ QMAKE_PROJECT_NAME = flowlayout_graphicsview # Input HEADERS += flowlayout.h window.h SOURCES += flowlayout.cpp main.cpp window.cpp +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/graphicsview/flowlayout/main.cpp b/examples/graphicsview/flowlayout/main.cpp index cc5eeb6175a..8f5a0faedea 100644 --- a/examples/graphicsview/flowlayout/main.cpp +++ b/examples/graphicsview/flowlayout/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" int main(int argc, char **argv) diff --git a/examples/graphicsview/flowlayout/window.cpp b/examples/graphicsview/flowlayout/window.cpp index 4abe2a55c21..35bd931d39f 100644 --- a/examples/graphicsview/flowlayout/window.cpp +++ b/examples/graphicsview/flowlayout/window.cpp @@ -38,8 +38,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include "flowlayout.h" #include "window.h" diff --git a/examples/graphicsview/flowlayout/window.h b/examples/graphicsview/flowlayout/window.h index c338a142362..7697d708427 100644 --- a/examples/graphicsview/flowlayout/window.h +++ b/examples/graphicsview/flowlayout/window.h @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include class Window : public QGraphicsWidget { Q_OBJECT diff --git a/examples/graphicsview/graphicsview.pro b/examples/graphicsview/graphicsview.pro index 190c48a5969..a9aeb0d17ff 100644 --- a/examples/graphicsview/graphicsview.pro +++ b/examples/graphicsview/graphicsview.pro @@ -28,4 +28,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/graphicsview/padnavigator/flippablepad.cpp b/examples/graphicsview/padnavigator/flippablepad.cpp index ada44dad8f2..78f8281afdb 100644 --- a/examples/graphicsview/padnavigator/flippablepad.cpp +++ b/examples/graphicsview/padnavigator/flippablepad.cpp @@ -40,7 +40,7 @@ #include "flippablepad.h" -#include +#include //! [0] static QRectF boundsFromSize(const QSize &size) diff --git a/examples/graphicsview/padnavigator/main.cpp b/examples/graphicsview/padnavigator/main.cpp index d7d2f563051..9a397c783a9 100644 --- a/examples/graphicsview/padnavigator/main.cpp +++ b/examples/graphicsview/padnavigator/main.cpp @@ -40,7 +40,7 @@ #include "padnavigator.h" -#include +#include //! [0] int main(int argc, char *argv[]) diff --git a/examples/graphicsview/padnavigator/padnavigator.cpp b/examples/graphicsview/padnavigator/padnavigator.cpp index 3e57dcfbe61..b714ebfb71c 100644 --- a/examples/graphicsview/padnavigator/padnavigator.cpp +++ b/examples/graphicsview/padnavigator/padnavigator.cpp @@ -42,7 +42,7 @@ #include "padnavigator.h" #include "splashitem.h" -#include +#include #ifndef QT_NO_OPENGL #include #endif diff --git a/examples/graphicsview/padnavigator/padnavigator.pro b/examples/graphicsview/padnavigator/padnavigator.pro index 5c05e482218..f0287f1f861 100644 --- a/examples/graphicsview/padnavigator/padnavigator.pro +++ b/examples/graphicsview/padnavigator/padnavigator.pro @@ -16,7 +16,7 @@ RESOURCES += \ FORMS += \ form.ui -contains(QT_CONFIG, opengl):QT += opengl +contains(QT_CONFIG, opengl):QT += opengl widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/padnavigator diff --git a/examples/graphicsview/padnavigator/roundrectitem.cpp b/examples/graphicsview/padnavigator/roundrectitem.cpp index 643770f4c6c..0103de47fef 100644 --- a/examples/graphicsview/padnavigator/roundrectitem.cpp +++ b/examples/graphicsview/padnavigator/roundrectitem.cpp @@ -40,7 +40,7 @@ #include "roundrectitem.h" -#include +#include //! [0] RoundRectItem::RoundRectItem(const QRectF &bounds, const QColor &color, diff --git a/examples/graphicsview/padnavigator/splashitem.cpp b/examples/graphicsview/padnavigator/splashitem.cpp index 8cedcd6e60e..ee3b38c1a99 100644 --- a/examples/graphicsview/padnavigator/splashitem.cpp +++ b/examples/graphicsview/padnavigator/splashitem.cpp @@ -40,7 +40,7 @@ #include "splashitem.h" -#include +#include //! [0] SplashItem::SplashItem(QGraphicsItem *parent) diff --git a/examples/graphicsview/simpleanchorlayout/main.cpp b/examples/graphicsview/simpleanchorlayout/main.cpp index cba37d9fb77..ff1ac2ba59c 100644 --- a/examples/graphicsview/simpleanchorlayout/main.cpp +++ b/examples/graphicsview/simpleanchorlayout/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include class Widget : public QGraphicsWidget { diff --git a/examples/graphicsview/simpleanchorlayout/simpleanchorlayout.pro b/examples/graphicsview/simpleanchorlayout/simpleanchorlayout.pro index 26f4c82ff39..80cc3a1a24d 100644 --- a/examples/graphicsview/simpleanchorlayout/simpleanchorlayout.pro +++ b/examples/graphicsview/simpleanchorlayout/simpleanchorlayout.pro @@ -7,6 +7,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/simpleanchorlayout INSTALLS += target sources TARGET = simpleanchorlayout +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro index 81138c4a1b9..5f1dfd38e11 100644 --- a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro +++ b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.pro @@ -12,6 +12,7 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES weatheranchorlayout.pro images sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/graphicsview/weatheranchorlayout INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/ipc/ipc.pro b/examples/ipc/ipc.pro index a9dd9c172e6..3c07ce9af86 100644 --- a/examples/ipc/ipc.pro +++ b/examples/ipc/ipc.pro @@ -9,4 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/ipc INSTALLS += sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/ipc/localfortuneclient/client.cpp b/examples/ipc/localfortuneclient/client.cpp index 86cc0cc0057..2884fac7a7b 100644 --- a/examples/ipc/localfortuneclient/client.cpp +++ b/examples/ipc/localfortuneclient/client.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "client.h" diff --git a/examples/ipc/localfortuneclient/localfortuneclient.pro b/examples/ipc/localfortuneclient/localfortuneclient.pro index 295c9424005..bace9574cf1 100644 --- a/examples/ipc/localfortuneclient/localfortuneclient.pro +++ b/examples/ipc/localfortuneclient/localfortuneclient.pro @@ -1,7 +1,7 @@ HEADERS = client.h SOURCES = client.cpp \ main.cpp -QT += network +QT += network widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/ipc/localfortuneclient diff --git a/examples/ipc/localfortuneserver/localfortuneserver.pro b/examples/ipc/localfortuneserver/localfortuneserver.pro index 55857cf56e3..4c55f3b11d1 100644 --- a/examples/ipc/localfortuneserver/localfortuneserver.pro +++ b/examples/ipc/localfortuneserver/localfortuneserver.pro @@ -1,7 +1,7 @@ HEADERS = server.h SOURCES = server.cpp \ main.cpp -QT += network +QT += network widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/ipc/localfortuneserver diff --git a/examples/ipc/localfortuneserver/server.cpp b/examples/ipc/localfortuneserver/server.cpp index 08dd31d81ef..e68e5de457d 100644 --- a/examples/ipc/localfortuneserver/server.cpp +++ b/examples/ipc/localfortuneserver/server.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include diff --git a/examples/ipc/sharedmemory/sharedmemory.pro b/examples/ipc/sharedmemory/sharedmemory.pro index 9202cb7b7ad..7c5b5dcd291 100644 --- a/examples/ipc/sharedmemory/sharedmemory.pro +++ b/examples/ipc/sharedmemory/sharedmemory.pro @@ -13,6 +13,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/ipc/sharedmemory INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example does not work on Symbian platform) diff --git a/examples/itemviews/addressbook/adddialog.cpp b/examples/itemviews/addressbook/adddialog.cpp index 551e729f9bc..c5baddd1ea6 100644 --- a/examples/itemviews/addressbook/adddialog.cpp +++ b/examples/itemviews/addressbook/adddialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "adddialog.h" //! [0] diff --git a/examples/itemviews/addressbook/addressbook.pro b/examples/itemviews/addressbook/addressbook.pro index 4f182c25aa6..5eeb601d55d 100644 --- a/examples/itemviews/addressbook/addressbook.pro +++ b/examples/itemviews/addressbook/addressbook.pro @@ -20,5 +20,6 @@ symbian { TARGET.UID3 = 0xA000A646 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/itemviews/addressbook/addresswidget.cpp b/examples/itemviews/addressbook/addresswidget.cpp index 40b71f13fdc..d9d3f46fed5 100644 --- a/examples/itemviews/addressbook/addresswidget.cpp +++ b/examples/itemviews/addressbook/addresswidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addresswidget.h" #include "adddialog.h" diff --git a/examples/itemviews/addressbook/main.cpp b/examples/itemviews/addressbook/main.cpp index 76efb01979c..2c01aec78b5 100644 --- a/examples/itemviews/addressbook/main.cpp +++ b/examples/itemviews/addressbook/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" //! [0] diff --git a/examples/itemviews/addressbook/mainwindow.cpp b/examples/itemviews/addressbook/mainwindow.cpp index 336da30d308..0a08b726bb0 100644 --- a/examples/itemviews/addressbook/mainwindow.cpp +++ b/examples/itemviews/addressbook/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" //! [0] diff --git a/examples/itemviews/addressbook/mainwindow.h b/examples/itemviews/addressbook/mainwindow.h index 0134c032bd7..4f925dd1e49 100644 --- a/examples/itemviews/addressbook/mainwindow.h +++ b/examples/itemviews/addressbook/mainwindow.h @@ -41,7 +41,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include #include "addresswidget.h" //! [0] diff --git a/examples/itemviews/addressbook/newaddresstab.cpp b/examples/itemviews/addressbook/newaddresstab.cpp index f3622604abc..3a720f6cb45 100644 --- a/examples/itemviews/addressbook/newaddresstab.cpp +++ b/examples/itemviews/addressbook/newaddresstab.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "newaddresstab.h" #include "adddialog.h" diff --git a/examples/itemviews/basicsortfiltermodel/basicsortfiltermodel.pro b/examples/itemviews/basicsortfiltermodel/basicsortfiltermodel.pro index 9bc0e93a02f..a317f442825 100644 --- a/examples/itemviews/basicsortfiltermodel/basicsortfiltermodel.pro +++ b/examples/itemviews/basicsortfiltermodel/basicsortfiltermodel.pro @@ -10,4 +10,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/basicsortfiltermodel INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/itemviews/basicsortfiltermodel/main.cpp b/examples/itemviews/basicsortfiltermodel/main.cpp index 750a19e55a1..003f6a45f84 100644 --- a/examples/itemviews/basicsortfiltermodel/main.cpp +++ b/examples/itemviews/basicsortfiltermodel/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/itemviews/basicsortfiltermodel/window.cpp b/examples/itemviews/basicsortfiltermodel/window.cpp index f95c9cc48ad..9fcd3630024 100644 --- a/examples/itemviews/basicsortfiltermodel/window.cpp +++ b/examples/itemviews/basicsortfiltermodel/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/itemviews/chart/chart.pro b/examples/itemviews/chart/chart.pro index 75dd621a0db..34d69957c95 100644 --- a/examples/itemviews/chart/chart.pro +++ b/examples/itemviews/chart/chart.pro @@ -18,5 +18,6 @@ symbian { TARGET.UID3 = 0xA000A647 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/itemviews/chart/mainwindow.cpp b/examples/itemviews/chart/mainwindow.cpp index df6f01abc20..b98057e2e33 100644 --- a/examples/itemviews/chart/mainwindow.cpp +++ b/examples/itemviews/chart/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "pieview.h" #include "mainwindow.h" diff --git a/examples/itemviews/chart/pieview.cpp b/examples/itemviews/chart/pieview.cpp index 75c47ac5e96..ff6306e9eaa 100644 --- a/examples/itemviews/chart/pieview.cpp +++ b/examples/itemviews/chart/pieview.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ #include -#include +#include #ifndef M_PI #define M_PI 3.1415927 diff --git a/examples/itemviews/coloreditorfactory/coloreditorfactory.pro b/examples/itemviews/coloreditorfactory/coloreditorfactory.pro index 2b150b43b37..387efd59aae 100644 --- a/examples/itemviews/coloreditorfactory/coloreditorfactory.pro +++ b/examples/itemviews/coloreditorfactory/coloreditorfactory.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/coloreditorfactory INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/itemviews/coloreditorfactory/colorlisteditor.cpp b/examples/itemviews/coloreditorfactory/colorlisteditor.cpp index d8ce45b5abb..ee540c603cc 100644 --- a/examples/itemviews/coloreditorfactory/colorlisteditor.cpp +++ b/examples/itemviews/coloreditorfactory/colorlisteditor.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "colorlisteditor.h" diff --git a/examples/itemviews/coloreditorfactory/main.cpp b/examples/itemviews/coloreditorfactory/main.cpp index 8b7eff429e3..7690ba9c1da 100644 --- a/examples/itemviews/coloreditorfactory/main.cpp +++ b/examples/itemviews/coloreditorfactory/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/itemviews/coloreditorfactory/window.cpp b/examples/itemviews/coloreditorfactory/window.cpp index f234af13675..aa7e9377b5d 100644 --- a/examples/itemviews/coloreditorfactory/window.cpp +++ b/examples/itemviews/coloreditorfactory/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" #include "colorlisteditor.h" diff --git a/examples/itemviews/combowidgetmapper/combowidgetmapper.pro b/examples/itemviews/combowidgetmapper/combowidgetmapper.pro index 0f64715ba85..46fce72ec9c 100644 --- a/examples/itemviews/combowidgetmapper/combowidgetmapper.pro +++ b/examples/itemviews/combowidgetmapper/combowidgetmapper.pro @@ -7,6 +7,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/combowidgetmapper sources.files = $$SOURCES $$HEADERS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/combowidgetmapper INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/itemviews/combowidgetmapper/window.cpp b/examples/itemviews/combowidgetmapper/window.cpp index 667fc4b8d2a..8721a6a8e66 100644 --- a/examples/itemviews/combowidgetmapper/window.cpp +++ b/examples/itemviews/combowidgetmapper/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" //! [Set up widgets] diff --git a/examples/itemviews/customsortfiltermodel/customsortfiltermodel.pro b/examples/itemviews/customsortfiltermodel/customsortfiltermodel.pro index 40cc2237a75..05087f9dda9 100644 --- a/examples/itemviews/customsortfiltermodel/customsortfiltermodel.pro +++ b/examples/itemviews/customsortfiltermodel/customsortfiltermodel.pro @@ -12,4 +12,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/customsortfiltermodel INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/itemviews/customsortfiltermodel/main.cpp b/examples/itemviews/customsortfiltermodel/main.cpp index 4154dbf1f9a..e643062ac0e 100644 --- a/examples/itemviews/customsortfiltermodel/main.cpp +++ b/examples/itemviews/customsortfiltermodel/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp b/examples/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp index 7e914449977..358546350c8 100644 --- a/examples/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp +++ b/examples/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mysortfilterproxymodel.h" diff --git a/examples/itemviews/customsortfiltermodel/window.cpp b/examples/itemviews/customsortfiltermodel/window.cpp index 51fdcb705e7..323eef98ceb 100644 --- a/examples/itemviews/customsortfiltermodel/window.cpp +++ b/examples/itemviews/customsortfiltermodel/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mysortfilterproxymodel.h" #include "window.h" diff --git a/examples/itemviews/dirview/dirview.pro b/examples/itemviews/dirview/dirview.pro index 21a84b3ec42..2401ee91dcf 100644 --- a/examples/itemviews/dirview/dirview.pro +++ b/examples/itemviews/dirview/dirview.pro @@ -7,4 +7,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/dirview INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/itemviews/dirview/main.cpp b/examples/itemviews/dirview/main.cpp index 3500d7bef85..c15040902c9 100644 --- a/examples/itemviews/dirview/main.cpp +++ b/examples/itemviews/dirview/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include int main(int argc, char *argv[]) { diff --git a/examples/itemviews/editabletreemodel/editabletreemodel.pro b/examples/itemviews/editabletreemodel/editabletreemodel.pro index 7f4223feca9..e844994896a 100644 --- a/examples/itemviews/editabletreemodel/editabletreemodel.pro +++ b/examples/itemviews/editabletreemodel/editabletreemodel.pro @@ -16,4 +16,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/editabletreemodel INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/itemviews/editabletreemodel/main.cpp b/examples/itemviews/editabletreemodel/main.cpp index d8b3b9bcf88..c499bb74542 100644 --- a/examples/itemviews/editabletreemodel/main.cpp +++ b/examples/itemviews/editabletreemodel/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/itemviews/editabletreemodel/mainwindow.cpp b/examples/itemviews/editabletreemodel/mainwindow.cpp index 486a9ad1c6e..a6a294e71c4 100644 --- a/examples/itemviews/editabletreemodel/mainwindow.cpp +++ b/examples/itemviews/editabletreemodel/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "treemodel.h" diff --git a/examples/itemviews/editabletreemodel/treemodel.cpp b/examples/itemviews/editabletreemodel/treemodel.cpp index 8b444386232..34168137faf 100644 --- a/examples/itemviews/editabletreemodel/treemodel.cpp +++ b/examples/itemviews/editabletreemodel/treemodel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "treeitem.h" #include "treemodel.h" diff --git a/examples/itemviews/fetchmore/fetchmore.pro b/examples/itemviews/fetchmore/fetchmore.pro index c9f3fe37463..848a12f3c6d 100644 --- a/examples/itemviews/fetchmore/fetchmore.pro +++ b/examples/itemviews/fetchmore/fetchmore.pro @@ -10,5 +10,6 @@ sources.files = $$SOURCES $$HEADERS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/fetchmore INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/itemviews/fetchmore/window.cpp b/examples/itemviews/fetchmore/window.cpp index 29dbf12b216..676a4ae1a83 100644 --- a/examples/itemviews/fetchmore/window.cpp +++ b/examples/itemviews/fetchmore/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "filelistmodel.h" #include "window.h" diff --git a/examples/itemviews/frozencolumn/freezetablewidget.cpp b/examples/itemviews/frozencolumn/freezetablewidget.cpp index 357d387321a..f76575a86d1 100644 --- a/examples/itemviews/frozencolumn/freezetablewidget.cpp +++ b/examples/itemviews/frozencolumn/freezetablewidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "freezetablewidget.h" diff --git a/examples/itemviews/frozencolumn/frozencolumn.pro b/examples/itemviews/frozencolumn/frozencolumn.pro index f16489b7aa1..79eedf787a7 100644 --- a/examples/itemviews/frozencolumn/frozencolumn.pro +++ b/examples/itemviews/frozencolumn/frozencolumn.pro @@ -7,6 +7,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/frozencolumn sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/frozencolumn INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/itemviews/interview/interview.pro b/examples/itemviews/interview/interview.pro index f479dc4f095..fec3ec11685 100644 --- a/examples/itemviews/interview/interview.pro +++ b/examples/itemviews/interview/interview.pro @@ -16,4 +16,5 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES README *.pro images sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/interview INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example diff --git a/examples/itemviews/itemviews.pro b/examples/itemviews/itemviews.pro index 1d5da705d41..3048aa18d67 100644 --- a/examples/itemviews/itemviews.pro +++ b/examples/itemviews/itemviews.pro @@ -23,4 +23,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews INSTALLS += sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/itemviews/pixelator/imagemodel.cpp b/examples/itemviews/pixelator/imagemodel.cpp index abf92ddef5e..d0e315978bb 100644 --- a/examples/itemviews/pixelator/imagemodel.cpp +++ b/examples/itemviews/pixelator/imagemodel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "imagemodel.h" diff --git a/examples/itemviews/pixelator/mainwindow.cpp b/examples/itemviews/pixelator/mainwindow.cpp index 62c6830313f..15bd60e1b46 100644 --- a/examples/itemviews/pixelator/mainwindow.cpp +++ b/examples/itemviews/pixelator/mainwindow.cpp @@ -38,7 +38,9 @@ ** ****************************************************************************/ -#include +#include +#include +#include #include "imagemodel.h" #include "mainwindow.h" diff --git a/examples/itemviews/pixelator/pixelator.pro b/examples/itemviews/pixelator/pixelator.pro index 2464a3e5067..91a78aa1f5e 100644 --- a/examples/itemviews/pixelator/pixelator.pro +++ b/examples/itemviews/pixelator/pixelator.pro @@ -14,4 +14,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/pixelator INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets printsupport maemo5: CONFIG += qt_example diff --git a/examples/itemviews/pixelator/pixeldelegate.cpp b/examples/itemviews/pixelator/pixeldelegate.cpp index 2c026e1a98c..2260553cbb0 100644 --- a/examples/itemviews/pixelator/pixeldelegate.cpp +++ b/examples/itemviews/pixelator/pixeldelegate.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "pixeldelegate.h" diff --git a/examples/itemviews/puzzle/mainwindow.cpp b/examples/itemviews/puzzle/mainwindow.cpp index 6fd5d63987f..9787512cb44 100644 --- a/examples/itemviews/puzzle/mainwindow.cpp +++ b/examples/itemviews/puzzle/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "mainwindow.h" diff --git a/examples/itemviews/puzzle/piecesmodel.cpp b/examples/itemviews/puzzle/piecesmodel.cpp index 520b571f0ac..4c53648210f 100644 --- a/examples/itemviews/puzzle/piecesmodel.cpp +++ b/examples/itemviews/puzzle/piecesmodel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "piecesmodel.h" diff --git a/examples/itemviews/puzzle/puzzle.pro b/examples/itemviews/puzzle/puzzle.pro index c867a50750d..2f15daf7ca2 100644 --- a/examples/itemviews/puzzle/puzzle.pro +++ b/examples/itemviews/puzzle/puzzle.pro @@ -19,5 +19,6 @@ wince* { DEPLOYMENT_PLUGIN += qjpeg qgif qtiff } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/itemviews/puzzle/puzzlewidget.cpp b/examples/itemviews/puzzle/puzzlewidget.cpp index 261e0080a2f..604c73d8f02 100644 --- a/examples/itemviews/puzzle/puzzlewidget.cpp +++ b/examples/itemviews/puzzle/puzzlewidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "puzzlewidget.h" diff --git a/examples/itemviews/simpledommodel/dommodel.cpp b/examples/itemviews/simpledommodel/dommodel.cpp index 7a5e9ca5c0e..2a04f7a840e 100644 --- a/examples/itemviews/simpledommodel/dommodel.cpp +++ b/examples/itemviews/simpledommodel/dommodel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "domitem.h" diff --git a/examples/itemviews/simpledommodel/mainwindow.cpp b/examples/itemviews/simpledommodel/mainwindow.cpp index 9803726d9fb..11517c124b9 100644 --- a/examples/itemviews/simpledommodel/mainwindow.cpp +++ b/examples/itemviews/simpledommodel/mainwindow.cpp @@ -40,7 +40,7 @@ #include #include -#include +#include #include "dommodel.h" #include "mainwindow.h" diff --git a/examples/itemviews/simpledommodel/simpledommodel.pro b/examples/itemviews/simpledommodel/simpledommodel.pro index 85ef37b1ca2..4044ae397dc 100644 --- a/examples/itemviews/simpledommodel/simpledommodel.pro +++ b/examples/itemviews/simpledommodel/simpledommodel.pro @@ -6,7 +6,7 @@ SOURCES = domitem.cpp \ main.cpp \ mainwindow.cpp CONFIG += qt -QT += xml +QT += xml widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/simpledommodel diff --git a/examples/itemviews/simpletreemodel/main.cpp b/examples/itemviews/simpletreemodel/main.cpp index 6401695d00a..15e6bc3e76f 100644 --- a/examples/itemviews/simpletreemodel/main.cpp +++ b/examples/itemviews/simpletreemodel/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "treemodel.h" diff --git a/examples/itemviews/simpletreemodel/simpletreemodel.pro b/examples/itemviews/simpletreemodel/simpletreemodel.pro index 6533b46749a..336544d9fb2 100644 --- a/examples/itemviews/simpletreemodel/simpletreemodel.pro +++ b/examples/itemviews/simpletreemodel/simpletreemodel.pro @@ -13,4 +13,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/simpletreemodel INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/itemviews/simpletreemodel/treemodel.cpp b/examples/itemviews/simpletreemodel/treemodel.cpp index 3041d3b1ef5..de5b6f8d6ed 100644 --- a/examples/itemviews/simpletreemodel/treemodel.cpp +++ b/examples/itemviews/simpletreemodel/treemodel.cpp @@ -45,7 +45,7 @@ models. */ -#include +#include #include "treeitem.h" #include "treemodel.h" diff --git a/examples/itemviews/simplewidgetmapper/simplewidgetmapper.pro b/examples/itemviews/simplewidgetmapper/simplewidgetmapper.pro index 52081155309..b496064234b 100644 --- a/examples/itemviews/simplewidgetmapper/simplewidgetmapper.pro +++ b/examples/itemviews/simplewidgetmapper/simplewidgetmapper.pro @@ -9,4 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/simplewidgetmapper INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/itemviews/simplewidgetmapper/window.cpp b/examples/itemviews/simplewidgetmapper/window.cpp index a6ed1bc984f..c3331b689d3 100644 --- a/examples/itemviews/simplewidgetmapper/window.cpp +++ b/examples/itemviews/simplewidgetmapper/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/itemviews/spinboxdelegate/delegate.cpp b/examples/itemviews/spinboxdelegate/delegate.cpp index 7837cbf6708..ecc4f3eb3b1 100644 --- a/examples/itemviews/spinboxdelegate/delegate.cpp +++ b/examples/itemviews/spinboxdelegate/delegate.cpp @@ -45,7 +45,7 @@ using a spin box widget. */ -#include +#include #include "delegate.h" diff --git a/examples/itemviews/spinboxdelegate/spinboxdelegate.pro b/examples/itemviews/spinboxdelegate/spinboxdelegate.pro index bbee66aa50d..18592526266 100644 --- a/examples/itemviews/spinboxdelegate/spinboxdelegate.pro +++ b/examples/itemviews/spinboxdelegate/spinboxdelegate.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/itemviews/spinboxdelegate INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/itemviews/spreadsheet/main.cpp b/examples/itemviews/spreadsheet/main.cpp index 4c20646f9ca..19bb3791246 100644 --- a/examples/itemviews/spreadsheet/main.cpp +++ b/examples/itemviews/spreadsheet/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include #include "spreadsheet.h" int main(int argc, char** argv) { diff --git a/examples/itemviews/spreadsheet/printview.h b/examples/itemviews/spreadsheet/printview.h index 7c748444830..43a7bb39b7a 100644 --- a/examples/itemviews/spreadsheet/printview.h +++ b/examples/itemviews/spreadsheet/printview.h @@ -43,6 +43,7 @@ #define PRINTVIEW_H #include +class QPrinter; class PrintView : public QTableView { diff --git a/examples/itemviews/spreadsheet/spreadsheet.cpp b/examples/itemviews/spreadsheet/spreadsheet.cpp index 6b99521b7bc..d3e57a5f4fc 100644 --- a/examples/itemviews/spreadsheet/spreadsheet.cpp +++ b/examples/itemviews/spreadsheet/spreadsheet.cpp @@ -39,7 +39,11 @@ ** ****************************************************************************/ -#include +#include +#include +#include +#include + #include "spreadsheet.h" #include "spreadsheetdelegate.h" #include "spreadsheetitem.h" diff --git a/examples/itemviews/spreadsheet/spreadsheet.pro b/examples/itemviews/spreadsheet/spreadsheet.pro index c06972b7601..aaa90e79983 100644 --- a/examples/itemviews/spreadsheet/spreadsheet.pro +++ b/examples/itemviews/spreadsheet/spreadsheet.pro @@ -7,8 +7,9 @@ TARGET = DEPENDPATH += . INCLUDEPATH += . +QT += widgets printsupport CONFIG += qt warn_on -#unix:contains(QT_CONFIG, dbus):QT += dbus +#unix:contains(QT_CONFIG, dbus):QT += dbus widgets # Input HEADERS += printview.h spreadsheet.h spreadsheetdelegate.h spreadsheetitem.h diff --git a/examples/itemviews/spreadsheet/spreadsheetdelegate.cpp b/examples/itemviews/spreadsheet/spreadsheetdelegate.cpp index 6f2f2dd071b..59f340ae3de 100644 --- a/examples/itemviews/spreadsheet/spreadsheetdelegate.cpp +++ b/examples/itemviews/spreadsheet/spreadsheetdelegate.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "spreadsheetdelegate.h" -#include +#include SpreadSheetDelegate::SpreadSheetDelegate(QObject *parent) : QItemDelegate(parent) {} diff --git a/examples/itemviews/spreadsheet/spreadsheetitem.h b/examples/itemviews/spreadsheet/spreadsheetitem.h index b0e7e337ed5..c7764ea1deb 100644 --- a/examples/itemviews/spreadsheet/spreadsheetitem.h +++ b/examples/itemviews/spreadsheet/spreadsheetitem.h @@ -43,7 +43,7 @@ #define SPREADSHEETITEM_H #include -#include +#include #include "spreadsheet.h" class SpreadSheetItem : public QTableWidgetItem diff --git a/examples/itemviews/stardelegate/main.cpp b/examples/itemviews/stardelegate/main.cpp index 4f5c86164e0..a9d5e966559 100644 --- a/examples/itemviews/stardelegate/main.cpp +++ b/examples/itemviews/stardelegate/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "stardelegate.h" #include "stareditor.h" diff --git a/examples/itemviews/stardelegate/stardelegate.cpp b/examples/itemviews/stardelegate/stardelegate.cpp index c784da2ffd5..687ae0da2d9 100644 --- a/examples/itemviews/stardelegate/stardelegate.cpp +++ b/examples/itemviews/stardelegate/stardelegate.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "stardelegate.h" #include "stareditor.h" diff --git a/examples/itemviews/stardelegate/stardelegate.pro b/examples/itemviews/stardelegate/stardelegate.pro index 63d9bcba4b8..56679be0a48 100644 --- a/examples/itemviews/stardelegate/stardelegate.pro +++ b/examples/itemviews/stardelegate/stardelegate.pro @@ -15,6 +15,7 @@ INSTALLS += target sources symbian: CONFIG += qt_example maemo5: CONFIG += qt_example +QT += widgets symbian: warning(This example might not fully work on Symbian platform) maemo5: warning(This example might not fully work on Maemo platform) simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/itemviews/stardelegate/stareditor.cpp b/examples/itemviews/stardelegate/stareditor.cpp index 453c75dbb7b..6a9092c058c 100644 --- a/examples/itemviews/stardelegate/stareditor.cpp +++ b/examples/itemviews/stardelegate/stareditor.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "stareditor.h" #include "starrating.h" diff --git a/examples/itemviews/stardelegate/starrating.cpp b/examples/itemviews/stardelegate/starrating.cpp index 121d4a2ca12..c77a40b3236 100644 --- a/examples/itemviews/stardelegate/starrating.cpp +++ b/examples/itemviews/stardelegate/starrating.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "starrating.h" diff --git a/examples/ja_JP/linguist/hellotr/hellotr.pro b/examples/ja_JP/linguist/hellotr/hellotr.pro index b42e8752d42..ab51bc80825 100644 --- a/examples/ja_JP/linguist/hellotr/hellotr.pro +++ b/examples/ja_JP/linguist/hellotr/hellotr.pro @@ -11,4 +11,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/linguist/hellotr INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/layouts/basiclayouts/basiclayouts.pro b/examples/layouts/basiclayouts/basiclayouts.pro index 2b15787446b..7751e139e78 100644 --- a/examples/layouts/basiclayouts/basiclayouts.pro +++ b/examples/layouts/basiclayouts/basiclayouts.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/layouts/basiclayouts INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/layouts/basiclayouts/dialog.cpp b/examples/layouts/basiclayouts/dialog.cpp index e3cbc089483..91ae01cb0d7 100644 --- a/examples/layouts/basiclayouts/dialog.cpp +++ b/examples/layouts/basiclayouts/dialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "dialog.h" diff --git a/examples/layouts/borderlayout/borderlayout.cpp b/examples/layouts/borderlayout/borderlayout.cpp index e6c2bbc79e9..c83ce0e4769 100644 --- a/examples/layouts/borderlayout/borderlayout.cpp +++ b/examples/layouts/borderlayout/borderlayout.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "borderlayout.h" diff --git a/examples/layouts/borderlayout/borderlayout.pro b/examples/layouts/borderlayout/borderlayout.pro index 19075ab4127..76a939daa4a 100644 --- a/examples/layouts/borderlayout/borderlayout.pro +++ b/examples/layouts/borderlayout/borderlayout.pro @@ -11,4 +11,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/layouts/borderlayout INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/layouts/borderlayout/window.cpp b/examples/layouts/borderlayout/window.cpp index da32600114a..7501a7296c3 100644 --- a/examples/layouts/borderlayout/window.cpp +++ b/examples/layouts/borderlayout/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "borderlayout.h" #include "window.h" diff --git a/examples/layouts/dynamiclayouts/dialog.cpp b/examples/layouts/dynamiclayouts/dialog.cpp index 690e52b8fac..d07903d8aa9 100644 --- a/examples/layouts/dynamiclayouts/dialog.cpp +++ b/examples/layouts/dynamiclayouts/dialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "dialog.h" diff --git a/examples/layouts/dynamiclayouts/dynamiclayouts.pro b/examples/layouts/dynamiclayouts/dynamiclayouts.pro index 44f2b5fdcd9..f6ab7791aa1 100644 --- a/examples/layouts/dynamiclayouts/dynamiclayouts.pro +++ b/examples/layouts/dynamiclayouts/dynamiclayouts.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/layouts/dynamiclayouts INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/layouts/flowlayout/flowlayout.cpp b/examples/layouts/flowlayout/flowlayout.cpp index b570af8e784..ddca09b71b7 100644 --- a/examples/layouts/flowlayout/flowlayout.cpp +++ b/examples/layouts/flowlayout/flowlayout.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "flowlayout.h" //! [1] diff --git a/examples/layouts/flowlayout/flowlayout.pro b/examples/layouts/flowlayout/flowlayout.pro index 6064b5a57c3..f59c4bc835a 100644 --- a/examples/layouts/flowlayout/flowlayout.pro +++ b/examples/layouts/flowlayout/flowlayout.pro @@ -11,4 +11,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/layouts/flowlayout INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/layouts/flowlayout/window.cpp b/examples/layouts/flowlayout/window.cpp index 0c7eb731013..50782b98228 100644 --- a/examples/layouts/flowlayout/window.cpp +++ b/examples/layouts/flowlayout/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "flowlayout.h" #include "window.h" diff --git a/examples/layouts/layouts.pro b/examples/layouts/layouts.pro index 678691ad869..f1940c1421a 100644 --- a/examples/layouts/layouts.pro +++ b/examples/layouts/layouts.pro @@ -10,4 +10,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/layouts INSTALLS += sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/linguist/arrowpad/arrowpad.cpp b/examples/linguist/arrowpad/arrowpad.cpp index 1a5357a3cac..12e41474bf8 100644 --- a/examples/linguist/arrowpad/arrowpad.cpp +++ b/examples/linguist/arrowpad/arrowpad.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "arrowpad.h" diff --git a/examples/linguist/arrowpad/arrowpad.pro b/examples/linguist/arrowpad/arrowpad.pro index f9b7488febe..8181ee07cb7 100644 --- a/examples/linguist/arrowpad/arrowpad.pro +++ b/examples/linguist/arrowpad/arrowpad.pro @@ -16,6 +16,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/linguist/arrowpad INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/linguist/arrowpad/main.cpp b/examples/linguist/arrowpad/main.cpp index dc8cae82512..23f62b2ebf2 100644 --- a/examples/linguist/arrowpad/main.cpp +++ b/examples/linguist/arrowpad/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/linguist/arrowpad/mainwindow.cpp b/examples/linguist/arrowpad/mainwindow.cpp index 8c3ccf2fd3b..9e141904cd0 100644 --- a/examples/linguist/arrowpad/mainwindow.cpp +++ b/examples/linguist/arrowpad/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "arrowpad.h" #include "mainwindow.h" diff --git a/examples/linguist/hellotr/hellotr.pro b/examples/linguist/hellotr/hellotr.pro index 69c28ece8c5..0a3ed48dfb4 100644 --- a/examples/linguist/hellotr/hellotr.pro +++ b/examples/linguist/hellotr/hellotr.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/linguist/hellotr INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/linguist/linguist.pro b/examples/linguist/linguist.pro index 64b214c70c9..416a6e6c9dc 100644 --- a/examples/linguist/linguist.pro +++ b/examples/linguist/linguist.pro @@ -9,4 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/linguist INSTALLS += sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/linguist/trollprint/main.cpp b/examples/linguist/trollprint/main.cpp index 92f163002c3..b2f21319271 100644 --- a/examples/linguist/trollprint/main.cpp +++ b/examples/linguist/trollprint/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/linguist/trollprint/mainwindow.cpp b/examples/linguist/trollprint/mainwindow.cpp index 4ea0db1733f..337b7aa8c41 100644 --- a/examples/linguist/trollprint/mainwindow.cpp +++ b/examples/linguist/trollprint/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "printpanel.h" diff --git a/examples/linguist/trollprint/printpanel.cpp b/examples/linguist/trollprint/printpanel.cpp index af1ff53193b..74ddc18b592 100644 --- a/examples/linguist/trollprint/printpanel.cpp +++ b/examples/linguist/trollprint/printpanel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "printpanel.h" diff --git a/examples/linguist/trollprint/trollprint.pro b/examples/linguist/trollprint/trollprint.pro index e874f5a1fdf..0588424ff76 100644 --- a/examples/linguist/trollprint/trollprint.pro +++ b/examples/linguist/trollprint/trollprint.pro @@ -12,6 +12,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/linguist/trollprint INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/mainwindows/application/application.pro b/examples/mainwindows/application/application.pro index 6b8f80afbb3..f66fa5fb626 100644 --- a/examples/mainwindows/application/application.pro +++ b/examples/mainwindows/application/application.pro @@ -12,6 +12,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/mainwindows/application INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/mainwindows/application/mainwindow.cpp b/examples/mainwindows/application/mainwindow.cpp index 4ebc5c169eb..fd8fa97e68a 100644 --- a/examples/mainwindows/application/mainwindow.cpp +++ b/examples/mainwindows/application/mainwindow.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ //! [0] -#include +#include #include "mainwindow.h" //! [0] diff --git a/examples/mainwindows/dockwidgets/dockwidgets.pro b/examples/mainwindows/dockwidgets/dockwidgets.pro index a45b1e1dcde..6a155f6edd2 100644 --- a/examples/mainwindows/dockwidgets/dockwidgets.pro +++ b/examples/mainwindows/dockwidgets/dockwidgets.pro @@ -10,6 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/mainwindows/dockwidgets INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/mainwindows/dockwidgets/mainwindow.cpp b/examples/mainwindows/dockwidgets/mainwindow.cpp index 296eec22420..5a0c1f6ad9a 100644 --- a/examples/mainwindows/dockwidgets/mainwindow.cpp +++ b/examples/mainwindows/dockwidgets/mainwindow.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ //! [0] -#include +#include #include "mainwindow.h" //! [0] diff --git a/examples/mainwindows/macmainwindow/macmainwindow.h b/examples/mainwindows/macmainwindow/macmainwindow.h index 10ff3b51474..d6f8b4cbdd3 100644 --- a/examples/mainwindows/macmainwindow/macmainwindow.h +++ b/examples/mainwindows/macmainwindow/macmainwindow.h @@ -41,7 +41,7 @@ #ifndef MACMAINWINDOW_H #define MACMAINWINDOW_H -#include +#include #ifdef Q_WS_MAC diff --git a/examples/mainwindows/macmainwindow/macmainwindow.pro b/examples/mainwindows/macmainwindow/macmainwindow.pro index 3ababcca151..8db88375f50 100644 --- a/examples/mainwindows/macmainwindow/macmainwindow.pro +++ b/examples/mainwindows/macmainwindow/macmainwindow.pro @@ -21,3 +21,4 @@ sources.files = $$SOURCES *.pro *.html sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/mainwindows/macmainwindow INSTALLS += target sources } +QT += widgets widgets diff --git a/examples/mainwindows/macmainwindow/main.cpp b/examples/mainwindows/macmainwindow/main.cpp index 34e48470685..c984d803973 100644 --- a/examples/mainwindows/macmainwindow/main.cpp +++ b/examples/mainwindows/macmainwindow/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include +#include #include "macmainwindow.h" #ifdef Q_WS_MAC diff --git a/examples/mainwindows/mainwindow/mainwindow.pro b/examples/mainwindows/mainwindow/mainwindow.pro index 17902246acd..afe03a57889 100644 --- a/examples/mainwindows/mainwindow/mainwindow.pro +++ b/examples/mainwindows/mainwindow/mainwindow.pro @@ -14,4 +14,5 @@ sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.png *.jpg *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/mainwindows/mainwindow INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example diff --git a/examples/mainwindows/mainwindows.pro b/examples/mainwindows/mainwindows.pro index d570a24042f..9ed8e7aaff0 100644 --- a/examples/mainwindows/mainwindows.pro +++ b/examples/mainwindows/mainwindows.pro @@ -15,4 +15,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/mainwindows INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/mainwindows/mdi/mainwindow.cpp b/examples/mainwindows/mdi/mainwindow.cpp index 956eabb230c..816c8094da5 100644 --- a/examples/mainwindows/mdi/mainwindow.cpp +++ b/examples/mainwindows/mdi/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "mdichild.h" diff --git a/examples/mainwindows/mdi/mdi.pro b/examples/mainwindows/mdi/mdi.pro index d545e880bcf..3112128d9b1 100644 --- a/examples/mainwindows/mdi/mdi.pro +++ b/examples/mainwindows/mdi/mdi.pro @@ -12,6 +12,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/mainwindows/mdi INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/mainwindows/mdi/mdichild.cpp b/examples/mainwindows/mdi/mdichild.cpp index 0382b27e234..0b55ee52235 100644 --- a/examples/mainwindows/mdi/mdichild.cpp +++ b/examples/mainwindows/mdi/mdichild.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mdichild.h" diff --git a/examples/mainwindows/menus/mainwindow.cpp b/examples/mainwindows/menus/mainwindow.cpp index 99f1ddcfbf9..eae4e6e9ec7 100644 --- a/examples/mainwindows/menus/mainwindow.cpp +++ b/examples/mainwindows/menus/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/mainwindows/menus/menus.pro b/examples/mainwindows/menus/menus.pro index f64157b5cd2..c004ef73a8e 100644 --- a/examples/mainwindows/menus/menus.pro +++ b/examples/mainwindows/menus/menus.pro @@ -12,6 +12,7 @@ symbian { TARGET.UID3 = 0xA000CF66 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/mainwindows/recentfiles/mainwindow.cpp b/examples/mainwindows/recentfiles/mainwindow.cpp index 623c4a375c6..4a8011d64aa 100644 --- a/examples/mainwindows/recentfiles/mainwindow.cpp +++ b/examples/mainwindows/recentfiles/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/mainwindows/recentfiles/recentfiles.pro b/examples/mainwindows/recentfiles/recentfiles.pro index c3057fd9c01..ecc78f245a5 100644 --- a/examples/mainwindows/recentfiles/recentfiles.pro +++ b/examples/mainwindows/recentfiles/recentfiles.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/mainwindows/recentfiles INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/mainwindows/sdi/mainwindow.cpp b/examples/mainwindows/sdi/mainwindow.cpp index f8811188992..7ae426d68ce 100644 --- a/examples/mainwindows/sdi/mainwindow.cpp +++ b/examples/mainwindows/sdi/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/mainwindows/sdi/sdi.pro b/examples/mainwindows/sdi/sdi.pro index 5a75e2a6cd0..c8687614c29 100644 --- a/examples/mainwindows/sdi/sdi.pro +++ b/examples/mainwindows/sdi/sdi.pro @@ -10,6 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/mainwindows/sdi INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index d87bedb3302..8b2b33affb6 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -1,5 +1,5 @@ TARGET = bearermonitor -QT = core gui network +QT = core gui network widgets HEADERS = sessionwidget.h \ bearermonitor.h diff --git a/examples/network/bearermonitor/main.cpp b/examples/network/bearermonitor/main.cpp index 1358033fc27..cc6d918ee7a 100644 --- a/examples/network/bearermonitor/main.cpp +++ b/examples/network/bearermonitor/main.cpp @@ -38,8 +38,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include "bearermonitor.h" diff --git a/examples/network/blockingfortuneclient/blockingclient.cpp b/examples/network/blockingfortuneclient/blockingclient.cpp index bd2fb829a96..0491433d565 100644 --- a/examples/network/blockingfortuneclient/blockingclient.cpp +++ b/examples/network/blockingfortuneclient/blockingclient.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "blockingclient.h" diff --git a/examples/network/blockingfortuneclient/blockingfortuneclient.pro b/examples/network/blockingfortuneclient/blockingfortuneclient.pro index ea64f00b921..3fe6f7c7abb 100644 --- a/examples/network/blockingfortuneclient/blockingfortuneclient.pro +++ b/examples/network/blockingfortuneclient/blockingfortuneclient.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = blockingclient.h \ fortunethread.h SOURCES = blockingclient.cpp \ diff --git a/examples/network/broadcastreceiver/broadcastreceiver.pro b/examples/network/broadcastreceiver/broadcastreceiver.pro index adef726ed0f..bc6b0ee55ac 100644 --- a/examples/network/broadcastreceiver/broadcastreceiver.pro +++ b/examples/network/broadcastreceiver/broadcastreceiver.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = receiver.h SOURCES = receiver.cpp \ main.cpp diff --git a/examples/network/broadcastreceiver/receiver.cpp b/examples/network/broadcastreceiver/receiver.cpp index 04feffbc80d..e0830283a93 100644 --- a/examples/network/broadcastreceiver/receiver.cpp +++ b/examples/network/broadcastreceiver/receiver.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "receiver.h" diff --git a/examples/network/broadcastsender/broadcastsender.pro b/examples/network/broadcastsender/broadcastsender.pro index d2bf78d4146..0944164e7c6 100644 --- a/examples/network/broadcastsender/broadcastsender.pro +++ b/examples/network/broadcastsender/broadcastsender.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = sender.h SOURCES = sender.cpp \ main.cpp diff --git a/examples/network/broadcastsender/sender.cpp b/examples/network/broadcastsender/sender.cpp index 7ce877d586d..33b34a4a4c5 100644 --- a/examples/network/broadcastsender/sender.cpp +++ b/examples/network/broadcastsender/sender.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "sender.h" diff --git a/examples/network/fortuneclient/client.cpp b/examples/network/fortuneclient/client.cpp index 9eab1c23716..27443659df5 100644 --- a/examples/network/fortuneclient/client.cpp +++ b/examples/network/fortuneclient/client.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "client.h" diff --git a/examples/network/fortuneclient/fortuneclient.pro b/examples/network/fortuneclient/fortuneclient.pro index b8bb2b9b70c..b5cb3b43902 100644 --- a/examples/network/fortuneclient/fortuneclient.pro +++ b/examples/network/fortuneclient/fortuneclient.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = client.h SOURCES = client.cpp \ main.cpp diff --git a/examples/network/fortuneserver/fortuneserver.pro b/examples/network/fortuneserver/fortuneserver.pro index 09dc9773ae3..ed865e4ca55 100644 --- a/examples/network/fortuneserver/fortuneserver.pro +++ b/examples/network/fortuneserver/fortuneserver.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = server.h SOURCES = server.cpp \ main.cpp diff --git a/examples/network/fortuneserver/server.cpp b/examples/network/fortuneserver/server.cpp index edb8c9398c6..9ce6b650e0b 100644 --- a/examples/network/fortuneserver/server.cpp +++ b/examples/network/fortuneserver/server.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include diff --git a/examples/network/googlesuggest/googlesuggest.h b/examples/network/googlesuggest/googlesuggest.h index a5d268a126b..6b4abff5d9b 100644 --- a/examples/network/googlesuggest/googlesuggest.h +++ b/examples/network/googlesuggest/googlesuggest.h @@ -41,7 +41,7 @@ #ifndef GOOGLESUGGEST_H #define GOOGLESUGGEST_H -#include +#include #include #include diff --git a/examples/network/googlesuggest/googlesuggest.pro b/examples/network/googlesuggest/googlesuggest.pro index 0f887318a3a..97866f6f32e 100644 --- a/examples/network/googlesuggest/googlesuggest.pro +++ b/examples/network/googlesuggest/googlesuggest.pro @@ -1,4 +1,4 @@ -QT += network +QT += network widgets SOURCES = main.cpp searchbox.cpp googlesuggest.cpp HEADERS = searchbox.h googlesuggest.h diff --git a/examples/network/http/http.pro b/examples/network/http/http.pro index 7da09799356..6f4b7be0766 100644 --- a/examples/network/http/http.pro +++ b/examples/network/http/http.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS += httpwindow.h SOURCES += httpwindow.cpp \ main.cpp diff --git a/examples/network/http/httpwindow.cpp b/examples/network/http/httpwindow.cpp index 6497a335083..77c1e314c71 100644 --- a/examples/network/http/httpwindow.cpp +++ b/examples/network/http/httpwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "httpwindow.h" diff --git a/examples/network/loopback/dialog.cpp b/examples/network/loopback/dialog.cpp index 14154b47cc0..f9a51268b7b 100644 --- a/examples/network/loopback/dialog.cpp +++ b/examples/network/loopback/dialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "dialog.h" diff --git a/examples/network/loopback/loopback.pro b/examples/network/loopback/loopback.pro index 3565058e120..c96868fb403 100644 --- a/examples/network/loopback/loopback.pro +++ b/examples/network/loopback/loopback.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = dialog.h SOURCES = dialog.cpp \ main.cpp diff --git a/examples/network/multicastreceiver/multicastreceiver.pro b/examples/network/multicastreceiver/multicastreceiver.pro index 958a13f11dd..caeca7ff46e 100644 --- a/examples/network/multicastreceiver/multicastreceiver.pro +++ b/examples/network/multicastreceiver/multicastreceiver.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = receiver.h SOURCES = receiver.cpp \ main.cpp diff --git a/examples/network/multicastreceiver/receiver.cpp b/examples/network/multicastreceiver/receiver.cpp index 77446b93ffe..8db3042a4ed 100644 --- a/examples/network/multicastreceiver/receiver.cpp +++ b/examples/network/multicastreceiver/receiver.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "receiver.h" diff --git a/examples/network/multicastsender/multicastsender.pro b/examples/network/multicastsender/multicastsender.pro index 479251ca0b0..a0cdc61eab5 100644 --- a/examples/network/multicastsender/multicastsender.pro +++ b/examples/network/multicastsender/multicastsender.pro @@ -1,7 +1,7 @@ HEADERS = sender.h SOURCES = sender.cpp \ main.cpp -QT += network +QT += network widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/network/multicastsender diff --git a/examples/network/multicastsender/sender.cpp b/examples/network/multicastsender/sender.cpp index aab94aa42a8..6172f070637 100644 --- a/examples/network/multicastsender/sender.cpp +++ b/examples/network/multicastsender/sender.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "sender.h" diff --git a/examples/network/network-chat/chatdialog.cpp b/examples/network/network-chat/chatdialog.cpp index cdb29ea5187..9ad042e05f3 100644 --- a/examples/network/network-chat/chatdialog.cpp +++ b/examples/network/network-chat/chatdialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "chatdialog.h" diff --git a/examples/network/network-chat/network-chat.pro b/examples/network/network-chat/network-chat.pro index d34da98822d..f6650f1d40f 100644 --- a/examples/network/network-chat/network-chat.pro +++ b/examples/network/network-chat/network-chat.pro @@ -10,7 +10,7 @@ SOURCES = chatdialog.cpp \ peermanager.cpp \ server.cpp FORMS = chatdialog.ui -QT += network +QT += network widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/network/network-chat diff --git a/examples/network/network.pro b/examples/network/network.pro index b8416bb31f6..90079f9b503 100644 --- a/examples/network/network.pro +++ b/examples/network/network.pro @@ -35,4 +35,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/network INSTALLS += sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/network/qftp/ftpwindow.cpp b/examples/network/qftp/ftpwindow.cpp index c0a2b734287..1c0d057c667 100644 --- a/examples/network/qftp/ftpwindow.cpp +++ b/examples/network/qftp/ftpwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "ftpwindow.h" diff --git a/examples/network/qftp/qftp.pro b/examples/network/qftp/qftp.pro index d3f017af524..f0efe630b94 100644 --- a/examples/network/qftp/qftp.pro +++ b/examples/network/qftp/qftp.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = ftpwindow.h SOURCES = ftpwindow.cpp \ main.cpp diff --git a/examples/network/securesocketclient/certificateinfo.h b/examples/network/securesocketclient/certificateinfo.h index 6e60ade4f03..cc5cc34e8a1 100644 --- a/examples/network/securesocketclient/certificateinfo.h +++ b/examples/network/securesocketclient/certificateinfo.h @@ -41,7 +41,7 @@ #ifndef CERTIFICATEINFO_H #define CERTIFICATEINFO_H -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/examples/network/securesocketclient/securesocketclient.pro b/examples/network/securesocketclient/securesocketclient.pro index ae4b15ffbe5..94c01cd757f 100644 --- a/examples/network/securesocketclient/securesocketclient.pro +++ b/examples/network/securesocketclient/securesocketclient.pro @@ -7,7 +7,7 @@ RESOURCES += securesocketclient.qrc FORMS += certificateinfo.ui \ sslclient.ui \ sslerrors.ui -QT += network +QT += network widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/network/securesocketclient diff --git a/examples/network/securesocketclient/sslclient.cpp b/examples/network/securesocketclient/sslclient.cpp index 11e6ffd537d..9d6af86813c 100644 --- a/examples/network/securesocketclient/sslclient.cpp +++ b/examples/network/securesocketclient/sslclient.cpp @@ -43,9 +43,9 @@ #include "ui_sslclient.h" #include "ui_sslerrors.h" -#include -#include -#include +#include +#include +#include #include SslClient::SslClient(QWidget *parent) diff --git a/examples/network/securesocketclient/sslclient.h b/examples/network/securesocketclient/sslclient.h index 33a9a882b6b..4e0bc1891fa 100644 --- a/examples/network/securesocketclient/sslclient.h +++ b/examples/network/securesocketclient/sslclient.h @@ -41,7 +41,7 @@ #ifndef SSLCLIENT_H #define SSLCLIENT_H -#include +#include #include #include diff --git a/examples/network/threadedfortuneserver/dialog.cpp b/examples/network/threadedfortuneserver/dialog.cpp index 27bf253b1ad..e62076130d5 100644 --- a/examples/network/threadedfortuneserver/dialog.cpp +++ b/examples/network/threadedfortuneserver/dialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include diff --git a/examples/network/threadedfortuneserver/threadedfortuneserver.pro b/examples/network/threadedfortuneserver/threadedfortuneserver.pro index 335666bd768..1b4cd598a2f 100644 --- a/examples/network/threadedfortuneserver/threadedfortuneserver.pro +++ b/examples/network/threadedfortuneserver/threadedfortuneserver.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS = dialog.h \ fortuneserver.h \ fortunethread.h diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp index 06dfca1ba2e..3d264eb272c 100644 --- a/examples/network/torrent/mainwindow.cpp +++ b/examples/network/torrent/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addtorrentdialog.h" #include "mainwindow.h" diff --git a/examples/network/torrent/torrent.pro b/examples/network/torrent/torrent.pro index 3565978d8c3..b2da8b6b56a 100644 --- a/examples/network/torrent/torrent.pro +++ b/examples/network/torrent/torrent.pro @@ -1,3 +1,5 @@ +QT += widgets + HEADERS += addtorrentdialog.h \ bencodeparser.h \ connectionmanager.h \ diff --git a/examples/opengl/2dpainting/2dpainting.pro b/examples/opengl/2dpainting/2dpainting.pro index ac88b9940ab..5d361bc1bf2 100644 --- a/examples/opengl/2dpainting/2dpainting.pro +++ b/examples/opengl/2dpainting/2dpainting.pro @@ -1,4 +1,4 @@ -QT += opengl +QT += opengl widgets HEADERS = glwidget.h \ helper.h \ diff --git a/examples/opengl/2dpainting/glwidget.cpp b/examples/opengl/2dpainting/glwidget.cpp index 8b28a6e6a3b..800e947385e 100644 --- a/examples/opengl/2dpainting/glwidget.cpp +++ b/examples/opengl/2dpainting/glwidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "glwidget.h" #include "helper.h" diff --git a/examples/opengl/2dpainting/helper.cpp b/examples/opengl/2dpainting/helper.cpp index 662a4264a78..dc18c60a4be 100644 --- a/examples/opengl/2dpainting/helper.cpp +++ b/examples/opengl/2dpainting/helper.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "helper.h" //! [0] diff --git a/examples/opengl/2dpainting/widget.cpp b/examples/opengl/2dpainting/widget.cpp index 16398147c79..35eedae240a 100644 --- a/examples/opengl/2dpainting/widget.cpp +++ b/examples/opengl/2dpainting/widget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "widget.h" #include "helper.h" diff --git a/examples/opengl/2dpainting/window.cpp b/examples/opengl/2dpainting/window.cpp index d2c8ef706c0..0186670f38f 100644 --- a/examples/opengl/2dpainting/window.cpp +++ b/examples/opengl/2dpainting/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "glwidget.h" #include "widget.h" #include "window.h" diff --git a/examples/opengl/cube/cube.pro b/examples/opengl/cube/cube.pro index a11aaf6bc73..652812b7180 100644 --- a/examples/opengl/cube/cube.pro +++ b/examples/opengl/cube/cube.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui +QT += core gui widgets TARGET = cube TEMPLATE = app diff --git a/examples/opengl/cube/main.cpp b/examples/opengl/cube/main.cpp index c75fd0826a0..ef6efdc4dcd 100644 --- a/examples/opengl/cube/main.cpp +++ b/examples/opengl/cube/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #ifndef QT_NO_OPENGL diff --git a/examples/opengl/cube/mainwidget.cpp b/examples/opengl/cube/mainwidget.cpp index 1116526922c..3f4e9214acf 100644 --- a/examples/opengl/cube/mainwidget.cpp +++ b/examples/opengl/cube/mainwidget.cpp @@ -72,13 +72,13 @@ MainWidget::~MainWidget() void MainWidget::mousePressEvent(QMouseEvent *e) { // Saving mouse press position - mousePressPosition = QVector2D(e->posF()); + mousePressPosition = QVector2D(e->localPos()); } void MainWidget::mouseReleaseEvent(QMouseEvent *e) { // Mouse release position - mouse press position - QVector2D diff = QVector2D(e->posF()) - mousePressPosition; + QVector2D diff = QVector2D(e->localPos()) - mousePressPosition; // Rotation axis is perpendicular to the mouse position difference // vector diff --git a/examples/opengl/framebufferobject2/framebufferobject2.pro b/examples/opengl/framebufferobject2/framebufferobject2.pro index d2787853e09..d3fce133fa1 100644 --- a/examples/opengl/framebufferobject2/framebufferobject2.pro +++ b/examples/opengl/framebufferobject2/framebufferobject2.pro @@ -2,7 +2,7 @@ HEADERS += glwidget.h SOURCES += glwidget.cpp main.cpp RESOURCES += framebufferobject2.qrc -QT += opengl +QT += opengl widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/framebufferobject2 diff --git a/examples/opengl/framebufferobject2/main.cpp b/examples/opengl/framebufferobject2/main.cpp index 12e5a62cdd9..313e683da52 100644 --- a/examples/opengl/framebufferobject2/main.cpp +++ b/examples/opengl/framebufferobject2/main.cpp @@ -38,8 +38,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include "glwidget.h" int main(int argc, char **argv) diff --git a/examples/opengl/grabber/glwidget.cpp b/examples/opengl/grabber/glwidget.cpp index 72039a7b660..52d0b2662a4 100644 --- a/examples/opengl/grabber/glwidget.cpp +++ b/examples/opengl/grabber/glwidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include diff --git a/examples/opengl/grabber/grabber.pro b/examples/opengl/grabber/grabber.pro index e9f371b6ad5..6a73201cd23 100644 --- a/examples/opengl/grabber/grabber.pro +++ b/examples/opengl/grabber/grabber.pro @@ -3,7 +3,7 @@ HEADERS = glwidget.h \ SOURCES = glwidget.cpp \ main.cpp \ mainwindow.cpp -QT += opengl +QT += opengl widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/grabber diff --git a/examples/opengl/grabber/mainwindow.cpp b/examples/opengl/grabber/mainwindow.cpp index d2f3a98dce3..965c49ab1a6 100644 --- a/examples/opengl/grabber/mainwindow.cpp +++ b/examples/opengl/grabber/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "glwidget.h" diff --git a/examples/opengl/hellogl/glwidget.cpp b/examples/opengl/hellogl/glwidget.cpp index 59efb123682..38333d85608 100644 --- a/examples/opengl/hellogl/glwidget.cpp +++ b/examples/opengl/hellogl/glwidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include diff --git a/examples/opengl/hellogl/hellogl.pro b/examples/opengl/hellogl/hellogl.pro index 0c81aae5c19..82372c5d982 100644 --- a/examples/opengl/hellogl/hellogl.pro +++ b/examples/opengl/hellogl/hellogl.pro @@ -8,7 +8,7 @@ SOURCES = glwidget.cpp \ main.cpp \ window.cpp \ qtlogo.cpp -QT += opengl +QT += opengl widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl diff --git a/examples/opengl/hellogl/window.cpp b/examples/opengl/hellogl/window.cpp index ef7cc2ad098..9f7d6be68b0 100644 --- a/examples/opengl/hellogl/window.cpp +++ b/examples/opengl/hellogl/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "glwidget.h" #include "window.h" diff --git a/examples/opengl/hellogl_es/bubble.cpp b/examples/opengl/hellogl_es/bubble.cpp deleted file mode 100644 index 167d9abd926..00000000000 --- a/examples/opengl/hellogl_es/bubble.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the 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 "bubble.h" - -Bubble::Bubble(const QPointF &position, qreal radius, const QPointF &velocity) - : position(position), vel(velocity), radius(radius) -{ - innerColor = randomColor(); - outerColor = randomColor(); - cache = 0; - updateBrush(); -} - -//! [0] -void Bubble::updateCache() -{ - if (cache) - delete cache; - cache = new QImage(qRound(radius * 2 + 2), qRound(radius * 2 + 2), QImage::Format_ARGB32); - cache->fill(0x00000000); - QPainter p(cache); - p.setRenderHint(QPainter::HighQualityAntialiasing); - QPen pen(Qt::white); - pen.setWidth(2); - p.setPen(pen); - p.setBrush(brush); - p.drawEllipse(0, 0, int(2*radius), int(2*radius)); -} -//! [0] - -Bubble::~Bubble() -{ - if (cache) - delete cache; -} - -void Bubble::updateBrush() -{ - QRadialGradient gradient(QPointF(radius, radius), radius, - QPointF(radius*0.5, radius*0.5)); - - gradient.setColorAt(0, QColor(255, 255, 255, 255)); - gradient.setColorAt(0.25, innerColor); - gradient.setColorAt(1, outerColor); - brush = QBrush(gradient); - updateCache(); -} - -//! [1] -void Bubble::drawBubble(QPainter *painter) -{ - painter->save(); - painter->translate(position.x() - radius, position.y() - radius); - painter->setOpacity(0.8); - painter->drawImage(0, 0, *cache); - painter->restore(); -} -//! [1] - -QColor Bubble::randomColor() -{ - int red = int(185 + 70.0*qrand()/(RAND_MAX+1.0)); - int green = int(185 + 70.0*qrand()/(RAND_MAX+1.0)); - int blue = int(205 + 50.0*qrand()/(RAND_MAX+1.0)); - int alpha = int(91 + 100.0*qrand()/(RAND_MAX+1.0)); - - return QColor(red, green, blue, alpha); -} - -void Bubble::move(const QRect &bbox) -{ - position += vel; - qreal leftOverflow = position.x() - radius - bbox.left(); - qreal rightOverflow = position.x() + radius - bbox.right(); - qreal topOverflow = position.y() - radius - bbox.top(); - qreal bottomOverflow = position.y() + radius - bbox.bottom(); - - if (leftOverflow < 0.0) { - position.setX(position.x() - 2 * leftOverflow); - vel.setX(-vel.x()); - } else if (rightOverflow > 0.0) { - position.setX(position.x() - 2 * rightOverflow); - vel.setX(-vel.x()); - } - - if (topOverflow < 0.0) { - position.setY(position.y() - 2 * topOverflow); - vel.setY(-vel.y()); - } else if (bottomOverflow > 0.0) { - position.setY(position.y() - 2 * bottomOverflow); - vel.setY(-vel.y()); - } -} - -QRectF Bubble::rect() -{ - return QRectF(position.x() - radius, position.y() - radius, - 2 * radius, 2 * radius); -} diff --git a/examples/opengl/hellogl_es/bubble.h b/examples/opengl/hellogl_es/bubble.h deleted file mode 100644 index 21f5add43e3..00000000000 --- a/examples/opengl/hellogl_es/bubble.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the 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 BUBBLE_H -#define BUBBLE_H - -#include -#include -#include -#include -#include - -class QPainter; - -class Bubble -{ -public: - Bubble(const QPointF &position, qreal radius, const QPointF &velocity); - ~Bubble(); - - void drawBubble(QPainter *painter); - void updateBrush(); - void move(const QRect &bbox); - void updateCache(); - QRectF rect(); - -private: - QColor randomColor(); - - QBrush brush; - QPointF position; - QPointF vel; - qreal radius; - QColor innerColor; - QColor outerColor; - QImage *cache; -}; - -#endif diff --git a/examples/opengl/hellogl_es/glwidget.cpp b/examples/opengl/hellogl_es/glwidget.cpp deleted file mode 100644 index 80444dfdbec..00000000000 --- a/examples/opengl/hellogl_es/glwidget.cpp +++ /dev/null @@ -1,455 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the 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 "glwidget.h" -#include -#include - -#include "bubble.h" - - -const int bubbleNum = 8; - -inline void CrossProduct(qreal &xOut, qreal &yOut, qreal &zOut, qreal x1, qreal y1, qreal z1, qreal x2, qreal y2, qreal z2) -{ - xOut = y1 * z2 - z1 * y2; - yOut = z1 * x2 - x1 * z2; - zOut = x1 * y2 - y1 * x2; -} - -inline void Normalize(qreal &x, qreal &y, qreal &z) -{ - qreal l = sqrt(x*x + y*y + z*z); - x = x / l; - y = y / l; - z = z / l; -} - -GLWidget::GLWidget(QWidget *parent) - : QGLWidget(parent) -{ - qtLogo = true; - createdVertices = 0; - createdNormals = 0; - m_vertexNumber = 0; - frames = 0; - setAttribute(Qt::WA_PaintOnScreen); - setAttribute(Qt::WA_NoSystemBackground); - setAutoBufferSwap(false); - m_showBubbles = true; -} - -GLWidget::~GLWidget() -{ - if (createdVertices) - delete[] createdVertices; - if (createdNormals) - delete[] createdNormals; -} - -void GLWidget::setScaling(int scale) { - - if (scale > 50) - m_fScale = 1 + qreal(scale -50) / 50 * 0.5; - else if (scale < 50) - m_fScale = 1- (qreal(50 - scale) / 50 * 1/2); - else - m_fScale = 1; -} - -void GLWidget::setLogo() { - qtLogo = true; -} - -void GLWidget::setTexture() { - qtLogo = false; -} - -void GLWidget::showBubbles(bool bubbles) -{ - m_showBubbles = bubbles; -} - -//! [2] -void GLWidget::paintQtLogo() -{ - glDisable(GL_TEXTURE_2D); - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3,GL_FLOAT,0, createdVertices); - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(GL_FLOAT,0,createdNormals); - glDrawArrays(GL_TRIANGLES, 0, m_vertexNumber / 3); -} -//! [2] - -void GLWidget::paintTexturedCube() -{ - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, m_uiTexture); - GLfloat afVertices[] = { - -0.5, 0.5, 0.5, 0.5,-0.5,0.5,-0.5,-0.5,0.5, - 0.5, -0.5, 0.5, -0.5,0.5,0.5,0.5,0.5,0.5, - -0.5, -0.5, -0.5, 0.5,-0.5,-0.5,-0.5,0.5,-0.5, - 0.5, 0.5, -0.5, -0.5,0.5,-0.5,0.5,-0.5,-0.5, - - 0.5, -0.5, -0.5, 0.5,-0.5,0.5,0.5,0.5,-0.5, - 0.5, 0.5, 0.5, 0.5,0.5,-0.5,0.5,-0.5,0.5, - -0.5, 0.5, -0.5, -0.5,-0.5,0.5,-0.5,-0.5,-0.5, - -0.5, -0.5, 0.5, -0.5,0.5,-0.5,-0.5,0.5,0.5, - - 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, - -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, - -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, - 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5 - }; - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3,GL_FLOAT,0,afVertices); - - GLfloat afTexCoord[] = { - 0.0f,0.0f, 1.0f,1.0f, 1.0f,0.0f, - 1.0f,1.0f, 0.0f,0.0f, 0.0f,1.0f, - 1.0f,1.0f, 1.0f,0.0f, 0.0f,1.0f, - 0.0f,0.0f, 0.0f,1.0f, 1.0f,0.0f, - - 1.0f,1.0f, 1.0f,0.0f, 0.0f,1.0f, - 0.0f,0.0f, 0.0f,1.0f, 1.0f,0.0f, - 0.0f,0.0f, 1.0f,1.0f, 1.0f,0.0f, - 1.0f,1.0f, 0.0f,0.0f, 0.0f,1.0f, - - 0.0f,1.0f, 1.0f,0.0f, 1.0f,1.0f, - 1.0f,0.0f, 0.0f,1.0f, 0.0f,0.0f, - 1.0f,0.0f, 1.0f,1.0f, 0.0f,0.0f, - 0.0f,1.0f, 0.0f,0.0f, 1.0f,1.0f - }; - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2,GL_FLOAT,0,afTexCoord); - - GLfloat afNormals[] = { - - 0,0,-1, 0,0,-1, 0,0,-1, - 0,0,-1, 0,0,-1, 0,0,-1, - 0,0,1, 0,0,1, 0,0,1, - 0,0,1, 0,0,1, 0,0,1, - - -1,0,0, -1,0,0, -1,0,0, - -1,0,0, -1,0,0, -1,0,0, - 1,0,0, 1,0,0, 1,0,0, - 1,0,0, 1,0,0, 1,0,0, - - 0,-1,0, 0,-1,0, 0,-1,0, - 0,-1,0, 0,-1,0, 0,-1,0, - 0,1,0, 0,1,0, 0,1,0, - 0,1,0, 0,1,0, 0,1,0 - }; - glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(GL_FLOAT,0,afNormals); - - glDrawArrays(GL_TRIANGLES, 0, 36); -} - -void GLWidget::initializeGL () -{ - glClearColor(0.1f, 0.1f, 0.2f, 1.0f); - - glEnable(GL_TEXTURE_2D); - glGenTextures(1, &m_uiTexture); - m_uiTexture = bindTexture(QImage(":/qt.png")); - - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - - GLfloat aLightPosition[] = {0.0f,0.3f,1.0f,0.0f}; - - glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, aLightPosition); - m_fAngle = 0; - m_fScale = 1; - createGeometry(); - createBubbles(bubbleNum - bubbles.count()); -} - -void GLWidget::paintGL() -{ - createBubbles(bubbleNum - bubbles.count()); - -//! [3] - QPainter painter; - painter.begin(this); - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); -//! [3] - -//! [4] - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - - //Since OpenGL ES does not support glPush/PopAttrib(GL_ALL_ATTRIB_BITS) - //we have to take care of the states ourselves - - glClearColor(0.1f, 0.1f, 0.2f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glEnable(GL_TEXTURE_2D); - - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - - glShadeModel(GL_FLAT); - glFrontFace(GL_CW); - glCullFace(GL_FRONT); - glEnable(GL_CULL_FACE); - glEnable(GL_DEPTH_TEST); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glRotatef(m_fAngle, 0.0f, 1.0f, 0.0f); - glRotatef(m_fAngle, 1.0f, 0.0f, 0.0f); - glRotatef(m_fAngle, 0.0f, 0.0f, 1.0f); - glScalef(m_fScale, m_fScale,m_fScale); - glTranslatef(0.0f,-0.2f,0.0f); - - GLfloat matDiff[] = {0.40f, 1.0f, 0.0f, 1.0f}; - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff); - - if (qtLogo) - paintQtLogo(); - else - paintTexturedCube(); -//! [4] - -//![5] - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - - glDisable(GL_LIGHTING); - glDisable(GL_LIGHT0); - - glDisable(GL_DEPTH_TEST); - glDisable(GL_CULL_FACE); -//![5] - -//! [6] - if (m_showBubbles) - foreach (Bubble *bubble, bubbles) { - bubble->drawBubble(&painter); - } -//! [6] - -//! [7] - QString framesPerSecond; - framesPerSecond.setNum(frames /(time.elapsed() / 1000.0), 'f', 2); - - painter.setPen(Qt::white); - - painter.drawText(20, 40, framesPerSecond + " fps"); - - painter.end(); -//! [7] - -//! [8] - swapBuffers(); -//! [8] - - QMutableListIterator iter(bubbles); - - while (iter.hasNext()) { - Bubble *bubble = iter.next(); - bubble->move(rect()); - } - if (!(frames % 100)) { - time.start(); - frames = 0; - } - m_fAngle += 1.0f; - frames ++; -} - -void GLWidget::createBubbles(int number) -{ - for (int i = 0; i < number; ++i) { - QPointF position(width()*(0.1 + (0.8*qrand()/(RAND_MAX+1.0))), - height()*(0.1 + (0.8*qrand()/(RAND_MAX+1.0)))); - qreal radius = qMin(width(), height())*(0.0175 + 0.0875*qrand()/(RAND_MAX+1.0)); - QPointF velocity(width()*0.0175*(-0.5 + qrand()/(RAND_MAX+1.0)), - height()*0.0175*(-0.5 + qrand()/(RAND_MAX+1.0))); - - bubbles.append(new Bubble(position, radius, velocity)); - } -} - -void GLWidget::createGeometry() -{ - vertices.clear(); - normals.clear(); - - qreal x1 = +0.06f; - qreal y1 = -0.14f; - qreal x2 = +0.14f; - qreal y2 = -0.06f; - qreal x3 = +0.08f; - qreal y3 = +0.00f; - qreal x4 = +0.30f; - qreal y4 = +0.22f; - - quad(x1, y1, x2, y2, y2, x2, y1, x1); - quad(x3, y3, x4, y4, y4, x4, y3, x3); - - extrude(x1, y1, x2, y2); - extrude(x2, y2, y2, x2); - extrude(y2, x2, y1, x1); - extrude(y1, x1, x1, y1); - extrude(x3, y3, x4, y4); - extrude(x4, y4, y4, x4); - extrude(y4, x4, y3, x3); - - const qreal Pi = 3.14159f; - const int NumSectors = 100; - - for (int i = 0; i < NumSectors; ++i) { - qreal angle1 = (i * 2 * Pi) / NumSectors; - qreal x5 = 0.30 * sin(angle1); - qreal y5 = 0.30 * cos(angle1); - qreal x6 = 0.20 * sin(angle1); - qreal y6 = 0.20 * cos(angle1); - - qreal angle2 = ((i + 1) * 2 * Pi) / NumSectors; - qreal x7 = 0.20 * sin(angle2); - qreal y7 = 0.20 * cos(angle2); - qreal x8 = 0.30 * sin(angle2); - qreal y8 = 0.30 * cos(angle2); - - quad(x5, y5, x6, y6, x7, y7, x8, y8); - - extrude(x6, y6, x7, y7); - extrude(x8, y8, x5, y5); - } - -//! [1] - m_vertexNumber = vertices.size(); - createdVertices = new GLfloat[m_vertexNumber]; - createdNormals = new GLfloat[m_vertexNumber]; - for (int i = 0;i < m_vertexNumber;i++) { - createdVertices[i] = vertices.at(i) * 2; - createdNormals[i] = normals.at(i); - } - vertices.clear(); - normals.clear(); -} -//! [1] - -//! [0] -void GLWidget::quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4) -{ - qreal nx, ny, nz; - - vertices << x1 << y1 << -0.05f; - vertices << x2 << y2 << -0.05f; - vertices << x4 << y4 << -0.05f; - - vertices << x3 << y3 << -0.05f; - vertices << x4 << y4 << -0.05f; - vertices << x2 << y2 << -0.05f; - - CrossProduct(nx, ny, nz, x2 - x1, y2 - y1, 0, x4 - x1, y4 - y1, 0); - Normalize(nx, ny, nz); - - normals << nx << ny << nz; - normals << nx << ny << nz; - normals << nx << ny << nz; - - normals << nx << ny << nz; - normals << nx << ny << nz; - normals << nx << ny << nz; - - vertices << x4 << y4 << 0.05f; - vertices << x2 << y2 << 0.05f; - vertices << x1 << y1 << 0.05f; - - vertices << x2 << y2 << 0.05f; - vertices << x4 << y4 << 0.05f; - vertices << x3 << y3 << 0.05f; - - CrossProduct(nx, ny, nz, x2 - x4, y2 - y4, 0, x1 - x4, y1 - y4, 0); - Normalize(nx, ny, nz); - - normals << nx << ny << nz; - normals << nx << ny << nz; - normals << nx << ny << nz; - - normals << nx << ny << nz; - normals << nx << ny << nz; - normals << nx << ny << nz; -} -//! [0] - -void GLWidget::extrude(qreal x1, qreal y1, qreal x2, qreal y2) -{ - qreal nx, ny, nz; - - vertices << x1 << y1 << +0.05f; - vertices << x2 << y2 << +0.05f; - vertices << x1 << y1 << -0.05f; - - vertices << x2 << y2 << -0.05f; - vertices << x1 << y1 << -0.05f; - vertices << x2 << y2 << +0.05f; - - CrossProduct(nx, ny, nz, x2 - x1, y2 - y1, 0.0f, 0.0f, 0.0f, -0.1f); - Normalize(nx, ny, nz); - - normals << nx << ny << nz; - normals << nx << ny << nz; - normals << nx << ny << nz; - - normals << nx << ny << nz; - normals << nx << ny << nz; - normals << nx << ny << nz; -} diff --git a/examples/opengl/hellogl_es/glwidget.h b/examples/opengl/hellogl_es/glwidget.h deleted file mode 100644 index 9908f63fd80..00000000000 --- a/examples/opengl/hellogl_es/glwidget.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the 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 GLWIDGET_H -#define GLWIDGET_H - -#include -#include - - - -class Bubble; -class GLWidget : public QGLWidget { - - Q_OBJECT -public: - GLWidget(QWidget *parent = 0); - ~GLWidget(); -public slots: - void setScaling(int scale); - void setLogo(); - void setTexture(); - void showBubbles(bool); -protected: - void paintGL (); - void initializeGL (); -private: - GLuint m_uiTexture; - qreal m_fAngle; - qreal m_fScale; - bool m_showBubbles; - void paintTexturedCube(); - void paintQtLogo(); - void createGeometry(); - void createBubbles(int number); - void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4); - void extrude(qreal x1, qreal y1, qreal x2, qreal y2); - QList vertices; - QList normals; - GLfloat *createdVertices; - GLfloat *createdNormals; - int m_vertexNumber; - bool qtLogo; - QList bubbles; - int frames; - QTime time; -}; -#endif diff --git a/examples/opengl/hellogl_es/hellogl_es.desktop b/examples/opengl/hellogl_es/hellogl_es.desktop deleted file mode 100644 index 11c1dd795c2..00000000000 --- a/examples/opengl/hellogl_es/hellogl_es.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=Hello GL ES -Exec=/opt/usr/bin/hellogl_es -Icon=hellogl_es -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/opengl/hellogl_es/hellogl_es.pro b/examples/opengl/hellogl_es/hellogl_es.pro deleted file mode 100644 index c25ab302356..00000000000 --- a/examples/opengl/hellogl_es/hellogl_es.pro +++ /dev/null @@ -1,33 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Thu Oct 4 19:01:12 2007 -###################################################################### - -TEMPLATE = app -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp -SOURCES += glwidget.cpp -SOURCES += mainwindow.cpp -SOURCES += bubble.cpp - -HEADERS += glwidget.h -HEADERS += mainwindow.h -HEADERS += bubble.h - -RESOURCES += texture.qrc -QT += opengl - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl_es -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellogl_es.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl_es -INSTALLS += target sources - -symbian: CONFIG += qt_example -maemo5: CONFIG += qt_example - -symbian: warning(This example might not fully work on Symbian platform) -maemo5: warning(This example does not work on Maemo platform) -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/opengl/hellogl_es/main.cpp b/examples/opengl/hellogl_es/main.cpp deleted file mode 100644 index 5693d7ad558..00000000000 --- a/examples/opengl/hellogl_es/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the 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 "mainwindow.h" - -int main( int argc, char ** argv ) -{ - Q_INIT_RESOURCE(texture); - QApplication a( argc, argv ); - MainWindow mw; - mw.showMaximized(); - return a.exec(); -} diff --git a/examples/opengl/hellogl_es/mainwindow.cpp b/examples/opengl/hellogl_es/mainwindow.cpp deleted file mode 100644 index cd253fcd19a..00000000000 --- a/examples/opengl/hellogl_es/mainwindow.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the 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 -#include -#include -#include -#include -#include -#include - -#include "glwidget.h" - -MainWindow::MainWindow() -{ - GLWidget *glwidget = new GLWidget(); - QLabel *label = new QLabel(this); - QTimer *timer = new QTimer(this); - QSlider *slider = new QSlider(this); - slider->setOrientation(Qt::Horizontal); - - slider->setRange(0, 100); - slider->setSliderPosition(50); - timer->setInterval(10); - label->setText("A QGlWidget with OpenGl ES"); - label->setAlignment(Qt::AlignHCenter); - - QGroupBox * groupBox = new QGroupBox(this); - setCentralWidget(groupBox); - groupBox->setTitle("OpenGL ES Example"); - - QGridLayout *layout = new QGridLayout(groupBox); - - layout->addWidget(glwidget,1,0,8,1); - layout->addWidget(label,9,0,1,1); - layout->addWidget(slider, 11,0,1,1); - - groupBox->setLayout(layout); - - QMenu *fileMenu = new QMenu("File"); - QMenu *helpMenu = new QMenu("Help"); - QMenu *showMenu = new QMenu("Show"); - menuBar()->addMenu(fileMenu); - menuBar()->addMenu(showMenu); - menuBar()->addMenu(helpMenu); - QAction *exit = new QAction("Exit", fileMenu); - QAction *aboutQt = new QAction("AboutQt", helpMenu); - QAction *showLogo = new QAction("Show 3D Logo", showMenu); - QAction *showTexture = new QAction("Show 2D Texture", showMenu); - QAction *showBubbles = new QAction("Show bubbles", showMenu); - showBubbles->setCheckable(true); - showBubbles->setChecked(true); - fileMenu->addAction(exit); - helpMenu->addAction(aboutQt); - showMenu->addAction(showLogo); - showMenu->addAction(showTexture); - showMenu->addAction(showBubbles); - - QObject::connect(timer, SIGNAL(timeout()), glwidget, SLOT(updateGL())); - QObject::connect(exit, SIGNAL(triggered(bool)), this, SLOT(close())); - QObject::connect(aboutQt, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt())); - - QObject::connect(showLogo, SIGNAL(triggered(bool)), glwidget, SLOT(setLogo())); - QObject::connect(showTexture, SIGNAL(triggered(bool)), glwidget, SLOT(setTexture())); - QObject::connect(showBubbles, SIGNAL(triggered(bool)), glwidget, SLOT(showBubbles(bool))); - QObject::connect(slider, SIGNAL(valueChanged(int)), glwidget, SLOT(setScaling(int))); - timer->start(); -} diff --git a/examples/opengl/hellogl_es/mainwindow.h b/examples/opengl/hellogl_es/mainwindow.h deleted file mode 100644 index a0a6adfc3ca..00000000000 --- a/examples/opengl/hellogl_es/mainwindow.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the 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 QSlider; -class GLWidget; - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - MainWindow(); - -private: -}; - -#endif diff --git a/examples/opengl/hellogl_es/qt.png b/examples/opengl/hellogl_es/qt.png deleted file mode 100644 index 79e383cf50d..00000000000 Binary files a/examples/opengl/hellogl_es/qt.png and /dev/null differ diff --git a/examples/opengl/hellogl_es/texture.qrc b/examples/opengl/hellogl_es/texture.qrc deleted file mode 100644 index ff1d0e535fd..00000000000 --- a/examples/opengl/hellogl_es/texture.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - qt.png - - diff --git a/examples/opengl/hellogl_es2/bubble.cpp b/examples/opengl/hellogl_es2/bubble.cpp index 167d9abd926..6db14e32bdd 100644 --- a/examples/opengl/hellogl_es2/bubble.cpp +++ b/examples/opengl/hellogl_es2/bubble.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "bubble.h" diff --git a/examples/opengl/hellogl_es2/hellogl_es2.pro b/examples/opengl/hellogl_es2/hellogl_es2.pro index 4061a0f6785..2eef986ed23 100644 --- a/examples/opengl/hellogl_es2/hellogl_es2.pro +++ b/examples/opengl/hellogl_es2/hellogl_es2.pro @@ -17,7 +17,7 @@ HEADERS += mainwindow.h HEADERS += bubble.h RESOURCES += texture.qrc -QT += opengl +QT += opengl widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellogl_es2 diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp new file mode 100644 index 00000000000..10d9d346a6c --- /dev/null +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -0,0 +1,276 @@ +#include "hellowindow.h" + +#include + +#include + +#include + +Renderer::Renderer(const QSurfaceFormat &format, Renderer *share) + : m_initialized(false) + , m_format(format) +{ + m_context = new QOpenGLContext(this); + m_context->setFormat(format); + if (share) + m_context->setShareContext(share->m_context); + m_context->create(); +} + +HelloWindow::HelloWindow(Renderer *renderer) + : m_colorIndex(0) + , m_renderer(renderer) +{ + setSurfaceType(QWindow::OpenGLSurface); + setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); + + setGeometry(QRect(10, 10, 640, 480)); + + setFormat(renderer->format()); + + create(); + + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(render())); + timer->start(10); + + connect(this, SIGNAL(needRender(QSurface *, const QColor &, const QSize &)), + renderer, SLOT(render(QSurface *, const QColor &, const QSize &))); + + updateColor(); +} + +void HelloWindow::mousePressEvent(QMouseEvent *) +{ + updateColor(); +} + +void HelloWindow::render() +{ + emit needRender(this, m_color, size()); +} + +void HelloWindow::updateColor() +{ + QColor colors[] = + { + QColor(100, 255, 0), + QColor(0, 100, 255) + }; + + m_color = colors[m_colorIndex]; + + m_colorIndex++; + if (m_colorIndex >= int(sizeof(colors) / sizeof(colors[0]))) + m_colorIndex = 0; +} + +void Renderer::render(QSurface *surface, const QColor &color, const QSize &viewSize) +{ + if (!m_context->makeCurrent(surface)) + return; + + if (!m_initialized) { + initialize(); + m_initialized = true; + } + + glViewport(0, 0, viewSize.width(), viewSize.height()); + + glClearColor(0.1f, 0.1f, 0.2f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glFrontFace(GL_CW); + glCullFace(GL_FRONT); + glEnable(GL_CULL_FACE); + glEnable(GL_DEPTH_TEST); + + QMatrix4x4 modelview; + modelview.rotate(m_fAngle, 0.0f, 1.0f, 0.0f); + modelview.rotate(m_fAngle, 1.0f, 0.0f, 0.0f); + modelview.rotate(m_fAngle, 0.0f, 0.0f, 1.0f); + modelview.translate(0.0f, -0.2f, 0.0f); + + m_program->bind(); + m_program->setUniformValue(matrixUniform, modelview); + m_program->setUniformValue(colorUniform, color); + paintQtLogo(); + m_program->release(); + + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + + m_context->swapBuffers(surface); + + m_fAngle += 1.0f; +} + +void Renderer::paintQtLogo() +{ + m_program->enableAttributeArray(normalAttr); + m_program->enableAttributeArray(vertexAttr); + m_program->setAttributeArray(vertexAttr, vertices.constData()); + m_program->setAttributeArray(normalAttr, normals.constData()); + glDrawArrays(GL_TRIANGLES, 0, vertices.size()); + m_program->disableAttributeArray(normalAttr); + m_program->disableAttributeArray(vertexAttr); +} + +void Renderer::initialize() +{ + glClearColor(0.1f, 0.1f, 0.2f, 1.0f); + + QOpenGLShader *vshader = new QOpenGLShader(QOpenGLShader::Vertex, this); + const char *vsrc = + "attribute highp vec4 vertex;\n" + "attribute mediump vec3 normal;\n" + "uniform mediump mat4 matrix;\n" + "uniform lowp vec4 sourceColor;\n" + "varying mediump vec4 color;\n" + "void main(void)\n" + "{\n" + " vec3 toLight = normalize(vec3(0.0, 0.3, 1.0));\n" + " float angle = max(dot(normal, toLight), 0.0);\n" + " vec3 col = sourceColor.rgb;\n" + " color = vec4(col * 0.2 + col * 0.8 * angle, 1.0);\n" + " color = clamp(color, 0.0, 1.0);\n" + " gl_Position = matrix * vertex;\n" + "}\n"; + vshader->compileSourceCode(vsrc); + + QOpenGLShader *fshader = new QOpenGLShader(QOpenGLShader::Fragment, this); + const char *fsrc = + "varying mediump vec4 color;\n" + "void main(void)\n" + "{\n" + " gl_FragColor = color;\n" + "}\n"; + fshader->compileSourceCode(fsrc); + + m_program = new QOpenGLShaderProgram; + m_program->addShader(vshader); + m_program->addShader(fshader); + m_program->link(); + + vertexAttr = m_program->attributeLocation("vertex"); + normalAttr = m_program->attributeLocation("normal"); + matrixUniform = m_program->uniformLocation("matrix"); + colorUniform = m_program->uniformLocation("sourceColor"); + + m_fAngle = 0; + createGeometry(); +} + +void Renderer::createGeometry() +{ + vertices.clear(); + normals.clear(); + + qreal x1 = +0.06f; + qreal y1 = -0.14f; + qreal x2 = +0.14f; + qreal y2 = -0.06f; + qreal x3 = +0.08f; + qreal y3 = +0.00f; + qreal x4 = +0.30f; + qreal y4 = +0.22f; + + quad(x1, y1, x2, y2, y2, x2, y1, x1); + quad(x3, y3, x4, y4, y4, x4, y3, x3); + + extrude(x1, y1, x2, y2); + extrude(x2, y2, y2, x2); + extrude(y2, x2, y1, x1); + extrude(y1, x1, x1, y1); + extrude(x3, y3, x4, y4); + extrude(x4, y4, y4, x4); + extrude(y4, x4, y3, x3); + + const qreal Pi = 3.14159f; + const int NumSectors = 100; + + for (int i = 0; i < NumSectors; ++i) { + qreal angle1 = (i * 2 * Pi) / NumSectors; + qreal x5 = 0.30 * qSin(angle1); + qreal y5 = 0.30 * qCos(angle1); + qreal x6 = 0.20 * qSin(angle1); + qreal y6 = 0.20 * qCos(angle1); + + qreal angle2 = ((i + 1) * 2 * Pi) / NumSectors; + qreal x7 = 0.20 * qSin(angle2); + qreal y7 = 0.20 * qCos(angle2); + qreal x8 = 0.30 * qSin(angle2); + qreal y8 = 0.30 * qCos(angle2); + + quad(x5, y5, x6, y6, x7, y7, x8, y8); + + extrude(x6, y6, x7, y7); + extrude(x8, y8, x5, y5); + } + + for (int i = 0;i < vertices.size();i++) + vertices[i] *= 2.0f; +} + +void Renderer::quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4) +{ + vertices << QVector3D(x1, y1, -0.05f); + vertices << QVector3D(x2, y2, -0.05f); + vertices << QVector3D(x4, y4, -0.05f); + + vertices << QVector3D(x3, y3, -0.05f); + vertices << QVector3D(x4, y4, -0.05f); + vertices << QVector3D(x2, y2, -0.05f); + + QVector3D n = QVector3D::normal + (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(x4 - x1, y4 - y1, 0.0f)); + + normals << n; + normals << n; + normals << n; + + normals << n; + normals << n; + normals << n; + + vertices << QVector3D(x4, y4, 0.05f); + vertices << QVector3D(x2, y2, 0.05f); + vertices << QVector3D(x1, y1, 0.05f); + + vertices << QVector3D(x2, y2, 0.05f); + vertices << QVector3D(x4, y4, 0.05f); + vertices << QVector3D(x3, y3, 0.05f); + + n = QVector3D::normal + (QVector3D(x2 - x4, y2 - y4, 0.0f), QVector3D(x1 - x4, y1 - y4, 0.0f)); + + normals << n; + normals << n; + normals << n; + + normals << n; + normals << n; + normals << n; +} + +void Renderer::extrude(qreal x1, qreal y1, qreal x2, qreal y2) +{ + vertices << QVector3D(x1, y1, +0.05f); + vertices << QVector3D(x2, y2, +0.05f); + vertices << QVector3D(x1, y1, -0.05f); + + vertices << QVector3D(x2, y2, -0.05f); + vertices << QVector3D(x1, y1, -0.05f); + vertices << QVector3D(x2, y2, +0.05f); + + QVector3D n = QVector3D::normal + (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(0.0f, 0.0f, -0.1f)); + + normals << n; + normals << n; + normals << n; + + normals << n; + normals << n; + normals << n; +} diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h new file mode 100644 index 00000000000..6ff74112516 --- /dev/null +++ b/examples/opengl/hellowindow/hellowindow.h @@ -0,0 +1,65 @@ +#include + +#include +#include + +#include +#include + +class QOpenGLContext; + +class Renderer : public QObject +{ + Q_OBJECT +public: + Renderer(const QSurfaceFormat &format, Renderer *share = 0); + + QSurfaceFormat format() const { return m_format; } + +public slots: + void render(QSurface *surface, const QColor &color, const QSize &viewSize); + +private: + void initialize(); + + qreal m_fAngle; + bool m_showBubbles; + void paintQtLogo(); + void createGeometry(); + void createBubbles(int number); + void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4); + void extrude(qreal x1, qreal y1, qreal x2, qreal y2); + QVector vertices; + QVector normals; + int vertexAttr; + int normalAttr; + int matrixUniform; + int colorUniform; + + bool m_initialized; + QSurfaceFormat m_format; + QOpenGLContext *m_context; + QOpenGLShaderProgram *m_program; +}; + +class HelloWindow : public QWindow +{ + Q_OBJECT +public: + HelloWindow(Renderer *renderer); + + void updateColor(); + +signals: + void needRender(QSurface *surface, const QColor &color, const QSize &viewSize); + +private slots: + void render(); + +private: + void mousePressEvent(QMouseEvent *); + + int m_colorIndex; + QColor m_color; + Renderer *m_renderer; +}; diff --git a/examples/opengl/hellowindow/hellowindow.pro b/examples/opengl/hellowindow/hellowindow.pro new file mode 100644 index 00000000000..555dc835746 --- /dev/null +++ b/examples/opengl/hellowindow/hellowindow.pro @@ -0,0 +1,18 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Wed Apr 27 16:40:46 2011 +###################################################################### + +TEMPLATE = app +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += hellowindow.h +SOURCES += hellowindow.cpp main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellowindow +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hellowindow.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/hellowindow +INSTALLS += target sources + diff --git a/examples/opengl/hellowindow/main.cpp b/examples/opengl/hellowindow/main.cpp new file mode 100644 index 00000000000..b247807019c --- /dev/null +++ b/examples/opengl/hellowindow/main.cpp @@ -0,0 +1,50 @@ +#include +#include +#include + +#include "hellowindow.h" + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + + QScreen *screen = QGuiApplication::primaryScreen(); + + QRect screenGeometry = screen->availableGeometry(); + + QSurfaceFormat format; + format.setDepthBufferSize(16); + format.setSamples(4); + + QPoint center = QPoint(screenGeometry.center().x(), screenGeometry.top() + 80); + QSize windowSize(400, 320); + int delta = 40; + + Renderer rendererA(format); + Renderer rendererB(format, &rendererA); + + QThread renderThread; + rendererB.moveToThread(&renderThread); + renderThread.start(); + + QObject::connect(qGuiApp, SIGNAL(lastWindowClosed()), &renderThread, SLOT(quit())); + + HelloWindow windowA(&rendererA); + windowA.setGeometry(QRect(center, windowSize).translated(-windowSize.width() - delta / 2, 0)); + windowA.setWindowTitle(QLatin1String("Thread A - Context A")); + windowA.setVisible(true); + + HelloWindow windowB(&rendererA); + windowB.setGeometry(QRect(center, windowSize).translated(delta / 2, 0)); + windowB.setWindowTitle(QLatin1String("Thread A - Context A")); + windowB.setVisible(true); + + HelloWindow windowC(&rendererB); + windowC.setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, windowSize.height() + delta)); + windowC.setWindowTitle(QLatin1String("Thread B - Context B")); + windowC.setVisible(true); + + app.exec(); + + renderThread.wait(); +} diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro index 2a96807102b..5502ee270a8 100644 --- a/examples/opengl/opengl.pro +++ b/examples/opengl/opengl.pro @@ -22,6 +22,11 @@ contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){ textures } +qpa { + SUBDIRS += hellowindow + SUBDIRS += paintedwindow +} + # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS opengl.pro README @@ -29,4 +34,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/opengl/overpainting/bubble.cpp b/examples/opengl/overpainting/bubble.cpp index eb315057fa0..bb6d2b80706 100644 --- a/examples/opengl/overpainting/bubble.cpp +++ b/examples/opengl/overpainting/bubble.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "bubble.h" diff --git a/examples/opengl/overpainting/glwidget.cpp b/examples/opengl/overpainting/glwidget.cpp index ded7bf1cf5f..4572e69644e 100644 --- a/examples/opengl/overpainting/glwidget.cpp +++ b/examples/opengl/overpainting/glwidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include diff --git a/examples/opengl/overpainting/overpainting.pro b/examples/opengl/overpainting/overpainting.pro index 6dfcf28ad1c..1584c3c3d41 100644 --- a/examples/opengl/overpainting/overpainting.pro +++ b/examples/opengl/overpainting/overpainting.pro @@ -1,7 +1,7 @@ VPATH += ../shared INCLUDEPATH += ../shared -QT += opengl +QT += opengl widgets HEADERS = bubble.h \ glwidget.h \ qtlogo.h diff --git a/examples/opengl/paintedwindow/main.cpp b/examples/opengl/paintedwindow/main.cpp new file mode 100644 index 00000000000..345cea7bc5b --- /dev/null +++ b/examples/opengl/paintedwindow/main.cpp @@ -0,0 +1,23 @@ +#include +#include +#include + +#include "paintedwindow.h" + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + + QScreen *screen = QGuiApplication::primaryScreen(); + + QRect screenGeometry = screen->availableGeometry(); + + QPoint center = screenGeometry.center(); + QRect windowRect(0, 0, 640, 480); + + PaintedWindow window; + window.setGeometry(QRect(center - windowRect.center(), windowRect.size())); + window.show(); + + app.exec(); +} diff --git a/examples/opengl/paintedwindow/paintedwindow.cpp b/examples/opengl/paintedwindow/paintedwindow.cpp new file mode 100644 index 00000000000..9b27c569146 --- /dev/null +++ b/examples/opengl/paintedwindow/paintedwindow.cpp @@ -0,0 +1,53 @@ +#include "paintedwindow.h" + +#include +#include +#include +#include + +#include + +PaintedWindow::PaintedWindow() +{ + QSurfaceFormat format; + format.setStencilBufferSize(8); + format.setSamples(4); + + setSurfaceType(QWindow::OpenGLSurface); + setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); + setFormat(format); + + create(); + + m_context = new QOpenGLContext(this); + m_context->setFormat(format); + m_context->create(); +} + +void PaintedWindow::resizeEvent(QResizeEvent *) +{ + paint(); +} + +void PaintedWindow::exposeEvent(QExposeEvent *) +{ + paint(); +} + +void PaintedWindow::paint() +{ + m_context->makeCurrent(this); + + QPainterPath path; + path.addEllipse(0, 0, width(), height()); + + QOpenGLPaintDevice device(size()); + + QPainter painter(&device); + painter.fillRect(0, 0, width(), height(), Qt::white); + painter.setRenderHint(QPainter::Antialiasing); + painter.fillPath(path, Qt::blue); + painter.end(); + + m_context->swapBuffers(this); +} diff --git a/examples/opengl/paintedwindow/paintedwindow.h b/examples/opengl/paintedwindow/paintedwindow.h new file mode 100644 index 00000000000..9da9992a3ed --- /dev/null +++ b/examples/opengl/paintedwindow/paintedwindow.h @@ -0,0 +1,26 @@ +#include + +#include +#include +#include + +#include +#include + +class QOpenGLContext; + +class PaintedWindow : public QWindow +{ + Q_OBJECT +public: + PaintedWindow(); + +private slots: + void paint(); + +private: + void resizeEvent(QResizeEvent *); + void exposeEvent(QExposeEvent *); + + QOpenGLContext *m_context; +}; diff --git a/examples/opengl/paintedwindow/paintedwindow.pro b/examples/opengl/paintedwindow/paintedwindow.pro new file mode 100644 index 00000000000..a3ae3bace50 --- /dev/null +++ b/examples/opengl/paintedwindow/paintedwindow.pro @@ -0,0 +1,18 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Wed Apr 27 16:40:46 2011 +###################################################################### + +TEMPLATE = app +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += paintedwindow.h +SOURCES += paintedwindow.cpp main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/paintedwindow +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS paintedwindow.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/paintedwindow +INSTALLS += target sources + diff --git a/examples/opengl/pbuffers/main.cpp b/examples/opengl/pbuffers/main.cpp index b4f1512cfee..aac6d1939c7 100644 --- a/examples/opengl/pbuffers/main.cpp +++ b/examples/opengl/pbuffers/main.cpp @@ -38,8 +38,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include #include "glwidget.h" diff --git a/examples/opengl/pbuffers/pbuffers.pro b/examples/opengl/pbuffers/pbuffers.pro index 755ed8c6a87..3264be3cef8 100644 --- a/examples/opengl/pbuffers/pbuffers.pro +++ b/examples/opengl/pbuffers/pbuffers.pro @@ -4,7 +4,7 @@ SOURCES += glwidget.cpp \ main.cpp \ cube.cpp RESOURCES += pbuffers.qrc -QT += opengl +QT += opengl widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/pbuffers diff --git a/examples/opengl/pbuffers2/main.cpp b/examples/opengl/pbuffers2/main.cpp index 0abe0b9faa8..573b7f2cda5 100644 --- a/examples/opengl/pbuffers2/main.cpp +++ b/examples/opengl/pbuffers2/main.cpp @@ -38,8 +38,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include "glwidget.h" int main(int argc, char **argv) diff --git a/examples/opengl/pbuffers2/pbuffers2.pro b/examples/opengl/pbuffers2/pbuffers2.pro index d70981879d9..9b30d793b82 100644 --- a/examples/opengl/pbuffers2/pbuffers2.pro +++ b/examples/opengl/pbuffers2/pbuffers2.pro @@ -6,7 +6,7 @@ TEMPLATE = app DEPENDPATH += . INCLUDEPATH += . -QT += opengl svg +QT += opengl svg widgets # Input HEADERS += glwidget.h diff --git a/examples/opengl/samplebuffers/main.cpp b/examples/opengl/samplebuffers/main.cpp index 8d4df924dd4..c9405413274 100644 --- a/examples/opengl/samplebuffers/main.cpp +++ b/examples/opengl/samplebuffers/main.cpp @@ -38,8 +38,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include "glwidget.h" int main(int argc, char **argv) diff --git a/examples/opengl/samplebuffers/samplebuffers.pro b/examples/opengl/samplebuffers/samplebuffers.pro index a8938b9dc11..d8f9ff1cd7e 100644 --- a/examples/opengl/samplebuffers/samplebuffers.pro +++ b/examples/opengl/samplebuffers/samplebuffers.pro @@ -1,7 +1,7 @@ HEADERS += glwidget.h SOURCES += glwidget.cpp main.cpp -QT += opengl +QT += opengl widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/samplebuffers diff --git a/examples/opengl/textures/glwidget.cpp b/examples/opengl/textures/glwidget.cpp index b5374c02000..4e74cf9d1d9 100644 --- a/examples/opengl/textures/glwidget.cpp +++ b/examples/opengl/textures/glwidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "glwidget.h" diff --git a/examples/opengl/textures/glwidget.h b/examples/opengl/textures/glwidget.h index fd9246bef21..86dc8891077 100644 --- a/examples/opengl/textures/glwidget.h +++ b/examples/opengl/textures/glwidget.h @@ -41,7 +41,7 @@ #ifndef GLWIDGET_H #define GLWIDGET_H -#include +#include #include class QGLShaderProgram; diff --git a/examples/opengl/textures/textures.pro b/examples/opengl/textures/textures.pro index 5bb0d5782e1..d8941b38903 100644 --- a/examples/opengl/textures/textures.pro +++ b/examples/opengl/textures/textures.pro @@ -4,7 +4,7 @@ SOURCES = glwidget.cpp \ main.cpp \ window.cpp RESOURCES = textures.qrc -QT += opengl +QT += opengl widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/opengl/textures diff --git a/examples/opengl/textures/window.cpp b/examples/opengl/textures/window.cpp index 50f3afeccec..16f402efabe 100644 --- a/examples/opengl/textures/window.cpp +++ b/examples/opengl/textures/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "glwidget.h" #include "window.h" diff --git a/examples/openvg/README b/examples/openvg/README deleted file mode 100644 index 3f2a60e9e78..00000000000 --- a/examples/openvg/README +++ /dev/null @@ -1,10 +0,0 @@ -Qt provides support for integration with OpenVG implementations on -platforms with appropriate hardware acceleration. - -These examples demonstrate the basic techniques used to take advantage of -OpenVG in Qt applications. In particular, the "star" example shows how -to mix QPainter and OpenVG calls in the same paint event. - - -Documentation for these examples can be found via the Examples -link in the main Qt documentation. diff --git a/examples/openvg/openvg.desktop b/examples/openvg/openvg.desktop deleted file mode 100644 index 186699aef11..00000000000 --- a/examples/openvg/openvg.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=OpenVG Star -Exec=/opt/usr/bin/openvg -Icon=openvg -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/openvg/openvg.pro b/examples/openvg/openvg.pro deleted file mode 100644 index f8c982dbfc3..00000000000 --- a/examples/openvg/openvg.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = star - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/openvg -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS openvg.pro README -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/openvg -INSTALLS += target sources - diff --git a/examples/openvg/star/main.cpp b/examples/openvg/star/main.cpp deleted file mode 100644 index 0f3378e881b..00000000000 --- a/examples/openvg/star/main.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL 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 -#include "starwidget.h" - -int main(int argc, char *argv[]) -{ -#ifdef Q_OS_SYMBIAN - QApplication::setGraphicsSystem("openvg"); -#endif - QApplication app(argc, argv); - StarWidget mw; - mw.show(); - return app.exec(); -} diff --git a/examples/openvg/star/star.pro b/examples/openvg/star/star.pro deleted file mode 100644 index 6ae1238536d..00000000000 --- a/examples/openvg/star/star.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -TARGET = star -CONFIG += qt debug warn_on -QT += openvg -SOURCES = starwidget.cpp main.cpp -HEADERS = starwidget.h -LIBS += $$QMAKE_LIBS_OPENVG \ No newline at end of file diff --git a/examples/openvg/star/starwidget.cpp b/examples/openvg/star/starwidget.cpp deleted file mode 100644 index 93438edb1e7..00000000000 --- a/examples/openvg/star/starwidget.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL 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 "starwidget.h" - -StarWidget::StarWidget(QWidget *parent) - : QWidget(parent) - , path(VG_INVALID_HANDLE) - , pen(Qt::red, 4.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin) - , brush(Qt::yellow) -{ - setMinimumSize(220, 250); - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); -} - -static VGubyte const starSegments[] = { - VG_MOVE_TO_ABS, - VG_LINE_TO_REL, - VG_LINE_TO_REL, - VG_LINE_TO_REL, - VG_LINE_TO_REL, - VG_CLOSE_PATH -}; -static VGfloat const starCoords[] = { - 110, 35, - 50, 160, - -130, -100, - 160, 0, - -130, 100 -}; - -void StarWidget::paintEvent(QPaintEvent *) -{ - QPainter painter; - painter.begin(this); - - // Make sure that we are using the OpenVG paint engine. - if (painter.paintEngine()->type() != QPaintEngine::OpenVG) { -#ifdef Q_WS_QWS - qWarning("Not using OpenVG: use the '-display' option to specify an OpenVG driver"); -#else - qWarning("Not using OpenVG: specify '-graphicssystem OpenVG'"); -#endif - return; - } - - // Select a pen and a brush for drawing the star. - painter.setPen(pen); - painter.setBrush(brush); - - // We want the star border to be anti-aliased. - painter.setRenderHints(QPainter::Antialiasing); - - // Flush the state changes to the OpenVG implementation - // and prepare to perform raw OpenVG calls. - painter.beginNativePainting(); - - // Cache the path if we haven't already or if the path has - // become invalid because the window's context has changed. - if (path == VG_INVALID_HANDLE || !vgGetPathCapabilities(path)) { - path = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 6, // segmentCapacityHint - 10, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - vgAppendPathData(path, sizeof(starSegments), starSegments, starCoords); - } - - // Draw the star directly using the OpenVG API. - vgDrawPath(path, VG_FILL_PATH | VG_STROKE_PATH); - - // Restore normal QPainter operations. - painter.endNativePainting(); - - painter.end(); -} diff --git a/examples/openvg/star/starwidget.h b/examples/openvg/star/starwidget.h deleted file mode 100644 index 70ef5ea1e3c..00000000000 --- a/examples/openvg/star/starwidget.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL 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 STARWIDGET_H -#define STARWIDGET_H - -#include -#include -#include -#include "qvg.h" - -class StarWidget : public QWidget -{ - Q_OBJECT -public: - StarWidget(QWidget *parent = 0); - ~StarWidget() {} - -protected: - void paintEvent(QPaintEvent *); - -private: - VGPath path; - QPen pen; - QBrush brush; -}; - -#endif diff --git a/examples/painting/affine/affine.pro b/examples/painting/affine/affine.pro index 817e5829c23..14418118515 100644 --- a/examples/painting/affine/affine.pro +++ b/examples/painting/affine/affine.pro @@ -3,7 +3,7 @@ HEADERS += xform.h contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { DEFINES += QT_OPENGL_SUPPORT - QT += opengl + QT += opengl widgets } SHARED_FOLDER = ../shared diff --git a/examples/painting/basicdrawing/basicdrawing.pro b/examples/painting/basicdrawing/basicdrawing.pro index 110bf352b23..0e9c6996989 100644 --- a/examples/painting/basicdrawing/basicdrawing.pro +++ b/examples/painting/basicdrawing/basicdrawing.pro @@ -15,6 +15,7 @@ symbian { TARGET.UID3 = 0xA000A649 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/painting/basicdrawing/renderarea.cpp b/examples/painting/basicdrawing/renderarea.cpp index 0906159e0e0..87e6c187d3e 100644 --- a/examples/painting/basicdrawing/renderarea.cpp +++ b/examples/painting/basicdrawing/renderarea.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "renderarea.h" diff --git a/examples/painting/basicdrawing/window.cpp b/examples/painting/basicdrawing/window.cpp index 072c3e08aac..6f750c45d10 100644 --- a/examples/painting/basicdrawing/window.cpp +++ b/examples/painting/basicdrawing/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "renderarea.h" #include "window.h" diff --git a/examples/painting/composition/composition.pro b/examples/painting/composition/composition.pro index 3a552955b48..c8e5ab0af3a 100644 --- a/examples/painting/composition/composition.pro +++ b/examples/painting/composition/composition.pro @@ -8,7 +8,7 @@ include($$SHARED_FOLDER/shared.pri) RESOURCES += composition.qrc contains(QT_CONFIG, opengl) { DEFINES += QT_OPENGL_SUPPORT - QT += opengl + QT += opengl widgets } # install diff --git a/examples/painting/composition/main.cpp b/examples/painting/composition/main.cpp index d6bc170a978..3c6a16aaf54 100644 --- a/examples/painting/composition/main.cpp +++ b/examples/painting/composition/main.cpp @@ -50,9 +50,6 @@ int main(int argc, char **argv) { // Q_INIT_RESOURCE(deform); -#ifdef QT_OPENGL_SUPPORT - QGL::setPreferredPaintEngine(QPaintEngine::OpenGL); -#endif QApplication app(argc, argv); CompositionWidget compWidget(0); diff --git a/examples/painting/concentriccircles/circlewidget.cpp b/examples/painting/concentriccircles/circlewidget.cpp index d801710b99c..1ffab639444 100644 --- a/examples/painting/concentriccircles/circlewidget.cpp +++ b/examples/painting/concentriccircles/circlewidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "circlewidget.h" diff --git a/examples/painting/concentriccircles/concentriccircles.pro b/examples/painting/concentriccircles/concentriccircles.pro index f4b1979ba9d..a8896730142 100644 --- a/examples/painting/concentriccircles/concentriccircles.pro +++ b/examples/painting/concentriccircles/concentriccircles.pro @@ -14,5 +14,6 @@ symbian { TARGET.UID3 = 0xA000A64A CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/painting/concentriccircles/window.cpp b/examples/painting/concentriccircles/window.cpp index a01333be627..c4c5ed8e08a 100644 --- a/examples/painting/concentriccircles/window.cpp +++ b/examples/painting/concentriccircles/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "circlewidget.h" #include "window.h" diff --git a/examples/painting/deform/deform.pro b/examples/painting/deform/deform.pro index 673b2e82884..2bfc5d32cd8 100644 --- a/examples/painting/deform/deform.pro +++ b/examples/painting/deform/deform.pro @@ -9,7 +9,7 @@ RESOURCES += deform.qrc contains(QT_CONFIG, opengl) { DEFINES += QT_OPENGL_SUPPORT - QT += opengl + QT += opengl widgets } # install diff --git a/examples/painting/fontsampler/fontsampler.pro b/examples/painting/fontsampler/fontsampler.pro index 6d93d913e8f..63892a319a9 100644 --- a/examples/painting/fontsampler/fontsampler.pro +++ b/examples/painting/fontsampler/fontsampler.pro @@ -10,4 +10,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting/fontsampler INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets printsupport maemo5: CONFIG += qt_example diff --git a/examples/painting/fontsampler/mainwindow.cpp b/examples/painting/fontsampler/mainwindow.cpp index 96698437b10..9efd307f886 100644 --- a/examples/painting/fontsampler/mainwindow.cpp +++ b/examples/painting/fontsampler/mainwindow.cpp @@ -38,7 +38,10 @@ ** ****************************************************************************/ -#include +#include +#include +#include +#include #include "mainwindow.h" diff --git a/examples/painting/fontsampler/mainwindow.h b/examples/painting/fontsampler/mainwindow.h index 4021ee7c6c5..1b66c3c3703 100644 --- a/examples/painting/fontsampler/mainwindow.h +++ b/examples/painting/fontsampler/mainwindow.h @@ -44,6 +44,7 @@ #include "ui_mainwindowbase.h" QT_BEGIN_NAMESPACE +class QPrinter; class QTextEdit; class QTreeWidget; class QTreeWidgetItem; diff --git a/examples/painting/gradients/gradients.h b/examples/painting/gradients/gradients.h index e1a2bcb41ec..3277c4b21d8 100644 --- a/examples/painting/gradients/gradients.h +++ b/examples/painting/gradients/gradients.h @@ -44,7 +44,7 @@ #include "arthurwidgets.h" -#include +#include class HoverPoints; diff --git a/examples/painting/gradients/gradients.pro b/examples/painting/gradients/gradients.pro index 22a4baac9e7..66f19c0801a 100644 --- a/examples/painting/gradients/gradients.pro +++ b/examples/painting/gradients/gradients.pro @@ -8,7 +8,7 @@ include($$SHARED_FOLDER/shared.pri) RESOURCES += gradients.qrc contains(QT_CONFIG, opengl) { DEFINES += QT_OPENGL_SUPPORT - QT += opengl + QT += opengl widgets } # install diff --git a/examples/painting/imagecomposition/imagecomposer.cpp b/examples/painting/imagecomposition/imagecomposer.cpp index 9488204e30c..e0173ff6d68 100644 --- a/examples/painting/imagecomposition/imagecomposer.cpp +++ b/examples/painting/imagecomposition/imagecomposer.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "imagecomposer.h" diff --git a/examples/painting/imagecomposition/imagecomposition.pro b/examples/painting/imagecomposition/imagecomposition.pro index c1bc7d4454c..e8841ea770e 100644 --- a/examples/painting/imagecomposition/imagecomposition.pro +++ b/examples/painting/imagecomposition/imagecomposition.pro @@ -13,5 +13,6 @@ symbian { TARGET.UID3 = 0xA000A64B CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/painting/painterpaths/painterpaths.pro b/examples/painting/painterpaths/painterpaths.pro index b4233ccafce..6ead35fe5a5 100644 --- a/examples/painting/painterpaths/painterpaths.pro +++ b/examples/painting/painterpaths/painterpaths.pro @@ -15,5 +15,6 @@ symbian { TARGET.UID3 = 0xA000A64C CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/painting/painterpaths/renderarea.cpp b/examples/painting/painterpaths/renderarea.cpp index 977fe30ed0d..9bff70bb411 100644 --- a/examples/painting/painterpaths/renderarea.cpp +++ b/examples/painting/painterpaths/renderarea.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "renderarea.h" diff --git a/examples/painting/painterpaths/window.cpp b/examples/painting/painterpaths/window.cpp index 0a4c1b0ca31..1139ad02580 100644 --- a/examples/painting/painterpaths/window.cpp +++ b/examples/painting/painterpaths/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include diff --git a/examples/painting/painting.pro b/examples/painting/painting.pro index 33d9e354baa..263cc7326b3 100644 --- a/examples/painting/painting.pro +++ b/examples/painting/painting.pro @@ -19,6 +19,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/painting INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example examples_affine.subdir = affine diff --git a/examples/painting/pathstroke/pathstroke.h b/examples/painting/pathstroke/pathstroke.h index f0360b66483..72b897a9948 100644 --- a/examples/painting/pathstroke/pathstroke.h +++ b/examples/painting/pathstroke/pathstroke.h @@ -43,7 +43,7 @@ #define PATHSTROKE_H #include "arthurwidgets.h" -#include +#include class PathStrokeRenderer : public ArthurFrame { diff --git a/examples/painting/pathstroke/pathstroke.pro b/examples/painting/pathstroke/pathstroke.pro index 1d1efdc342e..d3f65963905 100644 --- a/examples/painting/pathstroke/pathstroke.pro +++ b/examples/painting/pathstroke/pathstroke.pro @@ -9,7 +9,7 @@ RESOURCES += pathstroke.qrc contains(QT_CONFIG, opengl) { DEFINES += QT_OPENGL_SUPPORT - QT += opengl + QT += opengl widgets } # install diff --git a/examples/painting/shared/arthurwidgets.cpp b/examples/painting/shared/arthurwidgets.cpp index b3c75f0fc4a..c1abc4bbe7c 100644 --- a/examples/painting/shared/arthurwidgets.cpp +++ b/examples/painting/shared/arthurwidgets.cpp @@ -51,8 +51,6 @@ #include #include -#include - extern QPixmap cached(const QString &img); ArthurFrame::ArthurFrame(QWidget *parent) @@ -83,11 +81,6 @@ ArthurFrame::ArthurFrame(QWidget *parent) // QPalette pal = palette(); // pal.setBrush(backgroundRole(), m_tile); // setPalette(pal); - -#ifdef Q_WS_X11 - QPixmap xRenderPixmap(1, 1); - m_prefer_image = xRenderPixmap.pixmapData()->classId() == QPixmapData::X11Class && !xRenderPixmap.x11PictureHandle(); -#endif } diff --git a/examples/painting/shared/hoverpoints.h b/examples/painting/shared/hoverpoints.h index aff5d2ac753..af755a2a507 100644 --- a/examples/painting/shared/hoverpoints.h +++ b/examples/painting/shared/hoverpoints.h @@ -42,7 +42,7 @@ #ifndef HOVERPOINTS_H #define HOVERPOINTS_H -#include +#include QT_FORWARD_DECLARE_CLASS(QBypassWidget) diff --git a/examples/painting/shared/shared.pro b/examples/painting/shared/shared.pro index e996956880e..8fc58ae8146 100644 --- a/examples/painting/shared/shared.pro +++ b/examples/painting/shared/shared.pro @@ -3,7 +3,7 @@ CONFIG += static contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { DEFINES += QT_OPENGL_SUPPORT - QT += opengl + QT += opengl widgets } build_all:!build_pass { @@ -11,7 +11,7 @@ build_all:!build_pass { CONFIG += release } TARGET = demo_shared -QT += gui-private +QT += widgets SOURCES += \ arthurstyle.cpp\ diff --git a/examples/painting/transformations/renderarea.cpp b/examples/painting/transformations/renderarea.cpp index 568cfde2873..04a6eb511fc 100644 --- a/examples/painting/transformations/renderarea.cpp +++ b/examples/painting/transformations/renderarea.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "renderarea.h" diff --git a/examples/painting/transformations/transformations.pro b/examples/painting/transformations/transformations.pro index d9b0215c66c..2e76a13c5fa 100644 --- a/examples/painting/transformations/transformations.pro +++ b/examples/painting/transformations/transformations.pro @@ -14,6 +14,7 @@ symbian { TARGET.UID3 = 0xA000A64D CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/painting/transformations/window.cpp b/examples/painting/transformations/window.cpp index fc3bcb856d2..24d0a6f5cef 100644 --- a/examples/painting/transformations/window.cpp +++ b/examples/painting/transformations/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/qmake/precompile/precompile.pro b/examples/qmake/precompile/precompile.pro index 6360f06f075..828e912aec4 100644 --- a/examples/qmake/precompile/precompile.pro +++ b/examples/qmake/precompile/precompile.pro @@ -20,3 +20,4 @@ SOURCES = main.cpp \ util.cpp FORMS = mydialog.ui #! [0] +QT += widgets diff --git a/examples/qpa/qpa.pro b/examples/qpa/qpa.pro new file mode 100644 index 00000000000..b1b4428c23d --- /dev/null +++ b/examples/qpa/qpa.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs +SUBDIRS = windows + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qpa +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS qpa.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qpa +INSTALLS += target sources diff --git a/examples/qpa/windows/main.cpp b/examples/qpa/windows/main.cpp new file mode 100644 index 00000000000..e4cd14398c6 --- /dev/null +++ b/examples/qpa/windows/main.cpp @@ -0,0 +1,31 @@ +#include +#include + +#include "window.h" + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + + Window a; + a.setVisible(true); + + Window b; + b.setVisible(true); + + Window child(&b); + child.setVisible(true); + + // create one window on each additional screen as well + + QList screens = app.screens(); + foreach (QScreen *screen, screens) { + if (screen == app.primaryScreen()) + continue; + Window *window = new Window(screen); + window->setVisible(true); + window->setWindowTitle(screen->name()); + } + + return app.exec(); +} diff --git a/examples/qpa/windows/window.cpp b/examples/qpa/windows/window.cpp new file mode 100644 index 00000000000..fecc22034aa --- /dev/null +++ b/examples/qpa/windows/window.cpp @@ -0,0 +1,158 @@ +#include "window.h" + +#include + +#include +#include + +static int colorIndexId = 0; + +QColor colorTable[] = +{ + QColor("#f09f8f"), + QColor("#a2bff2"), + QColor("#c0ef8f") +}; + +Window::Window(QScreen *screen) + : QWindow(screen) + , m_backgroundColorIndex(colorIndexId++) +{ + initialize(); +} + +Window::Window(QWindow *parent) + : QWindow(parent) + , m_backgroundColorIndex(colorIndexId++) +{ + initialize(); +} + +void Window::initialize() +{ + if (parent()) + setGeometry(QRect(160, 120, 320, 240)); + else { + setGeometry(QRect(10, 10, 640, 480)); + + setSizeIncrement(QSize(10, 10)); + setBaseSize(QSize(640, 480)); + setMinimumSize(QSize(240, 160)); + setMaximumSize(QSize(800, 600)); + } + + create(); + m_backingStore = new QBackingStore(this); + + m_image = QImage(geometry().size(), QImage::Format_RGB32); + m_image.fill(colorTable[m_backgroundColorIndex % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba()); + + m_lastPos = QPoint(-1, -1); + m_renderTimer = 0; +} + +void Window::mousePressEvent(QMouseEvent *event) +{ + m_lastPos = event->pos(); +} + +void Window::mouseMoveEvent(QMouseEvent *event) +{ + if (m_lastPos != QPoint(-1, -1)) { + QPainter p(&m_image); + p.setRenderHint(QPainter::Antialiasing); + p.drawLine(m_lastPos, event->pos()); + m_lastPos = event->pos(); + } + + scheduleRender(); +} + +void Window::mouseReleaseEvent(QMouseEvent *event) +{ + if (m_lastPos != QPoint(-1, -1)) { + QPainter p(&m_image); + p.setRenderHint(QPainter::Antialiasing); + p.drawLine(m_lastPos, event->pos()); + m_lastPos = QPoint(-1, -1); + } + + scheduleRender(); +} + +void Window::exposeEvent(QExposeEvent *) +{ + scheduleRender(); +} + +void Window::resizeEvent(QResizeEvent *) +{ + QImage old = m_image; + + int width = qMax(geometry().width(), old.width()); + int height = qMax(geometry().height(), old.height()); + + if (width > old.width() || height > old.height()) { + m_image = QImage(width, height, QImage::Format_RGB32); + m_image.fill(colorTable[(m_backgroundColorIndex) % (sizeof(colorTable) / sizeof(colorTable[0]))].rgba()); + + QPainter p(&m_image); + p.drawImage(0, 0, old); + } + + render(); +} + +void Window::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) { + case Qt::Key_Backspace: + m_text.chop(1); + break; + case Qt::Key_Enter: + case Qt::Key_Return: + m_text.append('\n'); + break; + default: + m_text.append(event->text()); + break; + } + scheduleRender(); +} + +void Window::scheduleRender() +{ + if (!m_renderTimer) + m_renderTimer = startTimer(1); +} + +void Window::timerEvent(QTimerEvent *) +{ + render(); + killTimer(m_renderTimer); + m_renderTimer = 0; +} + +void Window::render() +{ + QRect rect(QPoint(), geometry().size()); + m_backingStore->resize(rect.size()); + + m_backingStore->beginPaint(rect); + + QPaintDevice *device = m_backingStore->paintDevice(); + + QPainter p(device); + p.drawImage(0, 0, m_image); + + QFont font; + font.setPixelSize(32); + + p.setFont(font); + p.drawText(rect, 0, m_text); + + m_backingStore->endPaint(); + m_backingStore->flush(rect); +} + + diff --git a/examples/qpa/windows/window.h b/examples/qpa/windows/window.h new file mode 100644 index 00000000000..bf664d148e0 --- /dev/null +++ b/examples/qpa/windows/window.h @@ -0,0 +1,33 @@ +#include +#include + +class Window : public QWindow +{ +public: + Window(QWindow *parent = 0); + Window(QScreen *screen); + +protected: + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + + void keyPressEvent(QKeyEvent *); + + void exposeEvent(QExposeEvent *); + void resizeEvent(QResizeEvent *); + + void timerEvent(QTimerEvent *); + +private: + void render(); + void scheduleRender(); + void initialize(); + + QString m_text; + QImage m_image; + QPoint m_lastPos; + int m_backgroundColorIndex; + QBackingStore *m_backingStore; + int m_renderTimer; +}; diff --git a/src/opengl/util/generator.pro b/examples/qpa/windows/windows.pro similarity index 52% rename from src/opengl/util/generator.pro rename to examples/qpa/windows/windows.pro index ac71934ecf6..ab59f28a3e5 100644 --- a/src/opengl/util/generator.pro +++ b/examples/qpa/windows/windows.pro @@ -1,13 +1,15 @@ ###################################################################### -# Automatically generated by qmake (2.01a) Thu Oct 19 11:03:24 2006 +# Automatically generated by qmake (2.01a) Wed Apr 27 16:40:46 2011 ###################################################################### TEMPLATE = app -TARGET = generator +TARGET = DEPENDPATH += . INCLUDEPATH += . +CONFIG+=console +QT += gui-private +QT += core-private # Input -SOURCES += generator.cpp - -CONFIG += console +HEADERS += window.h +SOURCES += window.cpp main.cpp diff --git a/examples/qtconcurrent/imagescaling/imagescaling.h b/examples/qtconcurrent/imagescaling/imagescaling.h index 096e880b1b5..5bc9187deaf 100644 --- a/examples/qtconcurrent/imagescaling/imagescaling.h +++ b/examples/qtconcurrent/imagescaling/imagescaling.h @@ -40,7 +40,7 @@ #ifndef IMAGESCALING_H #define IMAGESCALING_H -#include +#include #ifndef QT_NO_CONCURRENT diff --git a/examples/qtconcurrent/imagescaling/imagescaling.pro b/examples/qtconcurrent/imagescaling/imagescaling.pro index ba1cc04d4f6..cb931c7bfb0 100644 --- a/examples/qtconcurrent/imagescaling/imagescaling.pro +++ b/examples/qtconcurrent/imagescaling/imagescaling.pro @@ -15,6 +15,7 @@ INSTALLS += target sources symbian: CONFIG += qt_example wince*: DEPLOYMENT_PLUGIN += qgif qjpeg qtiff +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example does not work on Simulator platform) diff --git a/examples/qtconcurrent/imagescaling/main.cpp b/examples/qtconcurrent/imagescaling/main.cpp index d6ca7e57f00..963422fcb71 100644 --- a/examples/qtconcurrent/imagescaling/main.cpp +++ b/examples/qtconcurrent/imagescaling/main.cpp @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include +#include #ifndef QT_NO_CONCURRENT diff --git a/examples/qtconcurrent/map/map.pro b/examples/qtconcurrent/map/map.pro index 715df396f39..b5976d62730 100644 --- a/examples/qtconcurrent/map/map.pro +++ b/examples/qtconcurrent/map/map.pro @@ -14,6 +14,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/map INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example does not work on Simulator platform) diff --git a/examples/qtconcurrent/progressdialog/main.cpp b/examples/qtconcurrent/progressdialog/main.cpp index d302366380f..8473d057161 100644 --- a/examples/qtconcurrent/progressdialog/main.cpp +++ b/examples/qtconcurrent/progressdialog/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #ifndef QT_NO_CONCURRENT diff --git a/examples/qtconcurrent/progressdialog/progressdialog.pro b/examples/qtconcurrent/progressdialog/progressdialog.pro index afeadd4b271..506a572aa39 100644 --- a/examples/qtconcurrent/progressdialog/progressdialog.pro +++ b/examples/qtconcurrent/progressdialog/progressdialog.pro @@ -13,6 +13,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/progressdialog INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example does not work on Simulator platform) diff --git a/examples/qtconcurrent/qtconcurrent.pro b/examples/qtconcurrent/qtconcurrent.pro index 0d5d0c59834..a1594a26a9e 100644 --- a/examples/qtconcurrent/qtconcurrent.pro +++ b/examples/qtconcurrent/qtconcurrent.pro @@ -15,4 +15,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/qtconcurrent/runfunction/runfunction.pro b/examples/qtconcurrent/runfunction/runfunction.pro index ae87ffe8394..80495e1db21 100644 --- a/examples/qtconcurrent/runfunction/runfunction.pro +++ b/examples/qtconcurrent/runfunction/runfunction.pro @@ -13,6 +13,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/runfunction INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example does not work on Simulator platform) diff --git a/examples/qtconcurrent/wordcount/wordcount.pro b/examples/qtconcurrent/wordcount/wordcount.pro index 1596e9c1eb4..2980792da16 100644 --- a/examples/qtconcurrent/wordcount/wordcount.pro +++ b/examples/qtconcurrent/wordcount/wordcount.pro @@ -13,6 +13,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtconcurrent/wordcount INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example simulator: warning(This example does not work on Simulator platform) diff --git a/examples/qtestlib/qtestlib.pro b/examples/qtestlib/qtestlib.pro index a1331bbca09..025c2b5b9ee 100644 --- a/examples/qtestlib/qtestlib.pro +++ b/examples/qtestlib/qtestlib.pro @@ -8,4 +8,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qtestlib INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/qtestlib/tutorial1/tutorial1.pro b/examples/qtestlib/tutorial1/tutorial1.pro index 54817c05628..ee3d12a1b08 100644 --- a/examples/qtestlib/tutorial1/tutorial1.pro +++ b/examples/qtestlib/tutorial1/tutorial1.pro @@ -11,6 +11,7 @@ symbian { TARGET.UID3 = 0xA000C60B CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/qtestlib/tutorial2/tutorial2.pro b/examples/qtestlib/tutorial2/tutorial2.pro index 3bb540db8f1..d19be2e243b 100644 --- a/examples/qtestlib/tutorial2/tutorial2.pro +++ b/examples/qtestlib/tutorial2/tutorial2.pro @@ -11,6 +11,7 @@ symbian { TARGET.UID3 = 0xA000C60C CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/qtestlib/tutorial3/testgui.cpp b/examples/qtestlib/tutorial3/testgui.cpp index 74b25a8e02c..6618d86c146 100644 --- a/examples/qtestlib/tutorial3/testgui.cpp +++ b/examples/qtestlib/tutorial3/testgui.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ //! [0] -#include +#include #include class TestGui: public QObject diff --git a/examples/qtestlib/tutorial3/tutorial3.pro b/examples/qtestlib/tutorial3/tutorial3.pro index 2997767543b..344b97f4816 100644 --- a/examples/qtestlib/tutorial3/tutorial3.pro +++ b/examples/qtestlib/tutorial3/tutorial3.pro @@ -11,6 +11,7 @@ symbian { TARGET.UID3 = 0xA000C60D CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/qtestlib/tutorial4/testgui.cpp b/examples/qtestlib/tutorial4/testgui.cpp index a1fbbb7d717..66a6cbe7c57 100644 --- a/examples/qtestlib/tutorial4/testgui.cpp +++ b/examples/qtestlib/tutorial4/testgui.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include //! [0] diff --git a/examples/qtestlib/tutorial4/tutorial4.pro b/examples/qtestlib/tutorial4/tutorial4.pro index 9a804369b54..17fa04cf832 100644 --- a/examples/qtestlib/tutorial4/tutorial4.pro +++ b/examples/qtestlib/tutorial4/tutorial4.pro @@ -11,6 +11,7 @@ symbian { TARGET.UID3 = 0xA000C60E CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/qtestlib/tutorial5/benchmarking.cpp b/examples/qtestlib/tutorial5/benchmarking.cpp index 604eb20a507..f844c2e66c1 100644 --- a/examples/qtestlib/tutorial5/benchmarking.cpp +++ b/examples/qtestlib/tutorial5/benchmarking.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include class TestBenchmark : public QObject diff --git a/examples/qtestlib/tutorial5/tutorial5.pro b/examples/qtestlib/tutorial5/tutorial5.pro index 92b4d683a4d..42afe4204cc 100644 --- a/examples/qtestlib/tutorial5/tutorial5.pro +++ b/examples/qtestlib/tutorial5/tutorial5.pro @@ -11,6 +11,7 @@ symbian { TARGET.UID3 = 0xA000C60F CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/qws/dbscreen/dbscreen.pro b/examples/qws/dbscreen/dbscreen.pro index 61fab76a7ba..08d6c41e963 100644 --- a/examples/qws/dbscreen/dbscreen.pro +++ b/examples/qws/dbscreen/dbscreen.pro @@ -9,6 +9,7 @@ HEADERS = dbscreen.h SOURCES = dbscreendriverplugin.cpp \ dbscreen.cpp +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example symbian: warning(This example does not work on Symbian platform) diff --git a/examples/qws/framebuffer/framebuffer.pro b/examples/qws/framebuffer/framebuffer.pro index 2dd2c67db71..1d3235087fd 100644 --- a/examples/qws/framebuffer/framebuffer.pro +++ b/examples/qws/framebuffer/framebuffer.pro @@ -9,6 +9,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qws/framebuffer sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS framebuffer.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qws/framebuffer INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/qws/mousecalibration/mousecalibration.pro b/examples/qws/mousecalibration/mousecalibration.pro index e8f1b6243a4..5637e735bcd 100644 --- a/examples/qws/mousecalibration/mousecalibration.pro +++ b/examples/qws/mousecalibration/mousecalibration.pro @@ -9,6 +9,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qws/mousecalibration sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qws/mousecalibration INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/qws/qws.pro b/examples/qws/qws.pro index 7736625cbe4..06e3aa8ebae 100644 --- a/examples/qws/qws.pro +++ b/examples/qws/qws.pro @@ -7,3 +7,4 @@ SUBDIRS += mousecalibration simpledecoration sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS README *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qws INSTALLS += sources +QT += widgets diff --git a/examples/qws/simpledecoration/analogclock.cpp b/examples/qws/simpledecoration/analogclock.cpp index 4a91e0dc0a3..c922c9fe18d 100644 --- a/examples/qws/simpledecoration/analogclock.cpp +++ b/examples/qws/simpledecoration/analogclock.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "analogclock.h" diff --git a/examples/qws/simpledecoration/mydecoration.cpp b/examples/qws/simpledecoration/mydecoration.cpp index 32db90596ef..907fd6d8c2f 100644 --- a/examples/qws/simpledecoration/mydecoration.cpp +++ b/examples/qws/simpledecoration/mydecoration.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mydecoration.h" /* XPM */ diff --git a/examples/qws/simpledecoration/simpledecoration.pro b/examples/qws/simpledecoration/simpledecoration.pro index 92f41561f77..e26ffd5ad01 100644 --- a/examples/qws/simpledecoration/simpledecoration.pro +++ b/examples/qws/simpledecoration/simpledecoration.pro @@ -10,6 +10,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qws/simpledecoration sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/qws/simpledecoration INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/qws/svgalib/svgalib.pro b/examples/qws/svgalib/svgalib.pro index fde16666eba..7d21b181dd9 100644 --- a/examples/qws/svgalib/svgalib.pro +++ b/examples/qws/svgalib/svgalib.pro @@ -17,6 +17,7 @@ SOURCES = svgalibscreen.cpp \ svgalibpaintdevice.cpp \ svgalibplugin.cpp +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/richtext/calendar/calendar.pro b/examples/richtext/calendar/calendar.pro index 834b2c1a7e3..265e0e94f69 100644 --- a/examples/richtext/calendar/calendar.pro +++ b/examples/richtext/calendar/calendar.pro @@ -12,4 +12,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/richtext/calendar INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/richtext/calendar/main.cpp b/examples/richtext/calendar/main.cpp index 9c1141f0d11..fa94aa3ff20 100644 --- a/examples/richtext/calendar/main.cpp +++ b/examples/richtext/calendar/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/richtext/calendar/mainwindow.cpp b/examples/richtext/calendar/mainwindow.cpp index 60d7c515954..ff65b7e8909 100644 --- a/examples/richtext/calendar/mainwindow.cpp +++ b/examples/richtext/calendar/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/richtext/orderform/detailsdialog.cpp b/examples/richtext/orderform/detailsdialog.cpp index b12de14d303..8f54bb26150 100644 --- a/examples/richtext/orderform/detailsdialog.cpp +++ b/examples/richtext/orderform/detailsdialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "detailsdialog.h" diff --git a/examples/richtext/orderform/main.cpp b/examples/richtext/orderform/main.cpp index a89aa76015e..7aff81d6ad0 100644 --- a/examples/richtext/orderform/main.cpp +++ b/examples/richtext/orderform/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/richtext/orderform/mainwindow.cpp b/examples/richtext/orderform/mainwindow.cpp index e08f3ba9d3e..e94d4e63160 100644 --- a/examples/richtext/orderform/mainwindow.cpp +++ b/examples/richtext/orderform/mainwindow.cpp @@ -38,7 +38,9 @@ ** ****************************************************************************/ -#include +#include +#include +#include #include "detailsdialog.h" #include "mainwindow.h" diff --git a/examples/richtext/orderform/orderform.pro b/examples/richtext/orderform/orderform.pro index a455500bc52..729f66c873c 100644 --- a/examples/richtext/orderform/orderform.pro +++ b/examples/richtext/orderform/orderform.pro @@ -11,4 +11,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/richtext/orderform INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets printsupport maemo5: CONFIG += qt_example diff --git a/examples/richtext/richtext.pro b/examples/richtext/richtext.pro index 7e2720a2c6c..8b36c4ba420 100644 --- a/examples/richtext/richtext.pro +++ b/examples/richtext/richtext.pro @@ -11,4 +11,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/richtext INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/richtext/syntaxhighlighter/highlighter.cpp b/examples/richtext/syntaxhighlighter/highlighter.cpp index b51aa873a6a..d14d0241fef 100644 --- a/examples/richtext/syntaxhighlighter/highlighter.cpp +++ b/examples/richtext/syntaxhighlighter/highlighter.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "highlighter.h" diff --git a/examples/richtext/syntaxhighlighter/mainwindow.cpp b/examples/richtext/syntaxhighlighter/mainwindow.cpp index 0d644899935..298ba3c4723 100644 --- a/examples/richtext/syntaxhighlighter/mainwindow.cpp +++ b/examples/richtext/syntaxhighlighter/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/richtext/syntaxhighlighter/syntaxhighlighter.pro b/examples/richtext/syntaxhighlighter/syntaxhighlighter.pro index c3de7c8baf7..9abd82f40a4 100644 --- a/examples/richtext/syntaxhighlighter/syntaxhighlighter.pro +++ b/examples/richtext/syntaxhighlighter/syntaxhighlighter.pro @@ -17,5 +17,6 @@ wince*: { addFiles.path = . DEPLOYMENT += addFiles } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/richtext/textedit/textedit.h b/examples/richtext/textedit/textedit.h index 6436178ab58..ed2057214e5 100644 --- a/examples/richtext/textedit/textedit.h +++ b/examples/richtext/textedit/textedit.h @@ -52,6 +52,7 @@ QT_FORWARD_DECLARE_CLASS(QFontComboBox) QT_FORWARD_DECLARE_CLASS(QTextEdit) QT_FORWARD_DECLARE_CLASS(QTextCharFormat) QT_FORWARD_DECLARE_CLASS(QMenu) +QT_FORWARD_DECLARE_CLASS(QPrinter) class TextEdit : public QMainWindow { diff --git a/examples/richtext/textedit/textedit.pro b/examples/richtext/textedit/textedit.pro index 328de6e51eb..b364a00f986 100644 --- a/examples/richtext/textedit/textedit.pro +++ b/examples/richtext/textedit/textedit.pro @@ -19,4 +19,5 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.html *.doc images sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/richtext/textedit INSTALLS += target sources +QT += widgets printsupport symbian: CONFIG += qt_example diff --git a/examples/scroller/graphicsview/graphicsview.pro b/examples/scroller/graphicsview/graphicsview.pro index b0b8405293f..ccfb82d0ca4 100644 --- a/examples/scroller/graphicsview/graphicsview.pro +++ b/examples/scroller/graphicsview/graphicsview.pro @@ -6,3 +6,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/scroller/graphicsview sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS graphicsview.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/scroller/graphicsview INSTALLS += target sources +QT += widgets diff --git a/examples/scroller/graphicsview/main.cpp b/examples/scroller/graphicsview/main.cpp index 738a8242699..8f0019a82e1 100644 --- a/examples/scroller/graphicsview/main.cpp +++ b/examples/scroller/graphicsview/main.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ #include -#include +#include #define NUM_ITEMS 100 #define NUM_LISTS 10 diff --git a/examples/scroller/scroller.pro b/examples/scroller/scroller.pro index bac3f265546..993977d5384 100644 --- a/examples/scroller/scroller.pro +++ b/examples/scroller/scroller.pro @@ -1,2 +1,3 @@ TEMPLATE = subdirs SUBDIRS += graphicsview +QT += widgets diff --git a/examples/sql/books/bookdelegate.cpp b/examples/sql/books/bookdelegate.cpp index 566dd819288..a4cf5d3a261 100644 --- a/examples/sql/books/bookdelegate.cpp +++ b/examples/sql/books/bookdelegate.cpp @@ -41,7 +41,7 @@ #include "bookdelegate.h" -#include +#include BookDelegate::BookDelegate(QObject *parent) : QSqlRelationalDelegate(parent), star(QPixmap(":images/star.png")) diff --git a/examples/sql/books/books.pro b/examples/sql/books/books.pro index 42bb2c2ea38..316e2d9372f 100644 --- a/examples/sql/books/books.pro +++ b/examples/sql/books/books.pro @@ -6,7 +6,7 @@ RESOURCES = books.qrc SOURCES = bookdelegate.cpp main.cpp bookwindow.cpp FORMS = bookwindow.ui -QT += sql +QT += sql widgets widgets target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/sql/books sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro images diff --git a/examples/sql/books/bookwindow.h b/examples/sql/books/bookwindow.h index 4cd609650da..781a2f8bb35 100644 --- a/examples/sql/books/bookwindow.h +++ b/examples/sql/books/bookwindow.h @@ -42,7 +42,7 @@ #ifndef BOOKWINDOW_H #define BOOKWINDOW_H -#include +#include #include #include "ui_bookwindow.h" diff --git a/examples/sql/books/main.cpp b/examples/sql/books/main.cpp index 45aa8f87cfb..e08fb156c3f 100644 --- a/examples/sql/books/main.cpp +++ b/examples/sql/books/main.cpp @@ -41,7 +41,7 @@ #include "bookwindow.h" -#include +#include int main(int argc, char * argv[]) { diff --git a/examples/sql/cachedtable/cachedtable.pro b/examples/sql/cachedtable/cachedtable.pro index a51dc951a1a..9b89a910d81 100644 --- a/examples/sql/cachedtable/cachedtable.pro +++ b/examples/sql/cachedtable/cachedtable.pro @@ -2,7 +2,7 @@ HEADERS = ../connection.h \ tableeditor.h SOURCES = main.cpp \ tableeditor.cpp -QT += sql +QT += sql widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/sql/cachedtable diff --git a/examples/sql/cachedtable/tableeditor.cpp b/examples/sql/cachedtable/tableeditor.cpp index 083e5abb825..4f90de12e55 100644 --- a/examples/sql/cachedtable/tableeditor.cpp +++ b/examples/sql/cachedtable/tableeditor.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "tableeditor.h" diff --git a/examples/sql/drilldown/drilldown.pro b/examples/sql/drilldown/drilldown.pro index 272336eb758..8209dd5bd5e 100644 --- a/examples/sql/drilldown/drilldown.pro +++ b/examples/sql/drilldown/drilldown.pro @@ -7,7 +7,7 @@ SOURCES = imageitem.cpp \ informationwindow.cpp \ main.cpp \ view.cpp -QT += sql +QT += sql widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/sql/drilldown diff --git a/examples/sql/drilldown/imageitem.h b/examples/sql/drilldown/imageitem.h index 13d99c38469..f2bd27bc9e8 100644 --- a/examples/sql/drilldown/imageitem.h +++ b/examples/sql/drilldown/imageitem.h @@ -42,7 +42,7 @@ #define IMAGEITEM_H #include -#include +#include //! [0] class ImageItem : public QObject, public QGraphicsPixmapItem diff --git a/examples/sql/drilldown/informationwindow.h b/examples/sql/drilldown/informationwindow.h index 354823f1520..b5cf25a8e04 100644 --- a/examples/sql/drilldown/informationwindow.h +++ b/examples/sql/drilldown/informationwindow.h @@ -41,7 +41,7 @@ #ifndef INFORMATIONWINDOW_H #define INFORMATIONWINDOW_H -#include +#include #include //! [0] diff --git a/examples/sql/drilldown/main.cpp b/examples/sql/drilldown/main.cpp index 9bfa57cbc99..462eb0face4 100644 --- a/examples/sql/drilldown/main.cpp +++ b/examples/sql/drilldown/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "../connection.h" #include "view.h" diff --git a/examples/sql/drilldown/view.h b/examples/sql/drilldown/view.h index 3efe6bb8ce1..98855350bd7 100644 --- a/examples/sql/drilldown/view.h +++ b/examples/sql/drilldown/view.h @@ -41,7 +41,7 @@ #ifndef VIEW_H #define VIEW_H -#include +#include #include class ImageItem; diff --git a/examples/sql/masterdetail/dialog.h b/examples/sql/masterdetail/dialog.h index 5495a115b30..e311554597f 100644 --- a/examples/sql/masterdetail/dialog.h +++ b/examples/sql/masterdetail/dialog.h @@ -41,7 +41,7 @@ #ifndef DIALOG_H #define DIALOG_H -#include +#include #include #include diff --git a/examples/sql/masterdetail/main.cpp b/examples/sql/masterdetail/main.cpp index 55151ebba8d..582910873fa 100644 --- a/examples/sql/masterdetail/main.cpp +++ b/examples/sql/masterdetail/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "database.h" #include "mainwindow.h" diff --git a/examples/sql/masterdetail/mainwindow.cpp b/examples/sql/masterdetail/mainwindow.cpp index 522ee6ce02c..77b869e17c0 100644 --- a/examples/sql/masterdetail/mainwindow.cpp +++ b/examples/sql/masterdetail/mainwindow.cpp @@ -41,7 +41,7 @@ #include "mainwindow.h" #include "dialog.h" -#include +#include #include #include diff --git a/examples/sql/masterdetail/masterdetail.pro b/examples/sql/masterdetail/masterdetail.pro index 3f00d750a37..fcbc642bed2 100644 --- a/examples/sql/masterdetail/masterdetail.pro +++ b/examples/sql/masterdetail/masterdetail.pro @@ -6,8 +6,8 @@ SOURCES = dialog.cpp \ main.cpp \ mainwindow.cpp -QT += sql -QT += xml +QT += sql widgets +QT += xml widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/sql/masterdetail diff --git a/examples/sql/querymodel/customsqlmodel.cpp b/examples/sql/querymodel/customsqlmodel.cpp index 5b09dd634be..534707e8e12 100644 --- a/examples/sql/querymodel/customsqlmodel.cpp +++ b/examples/sql/querymodel/customsqlmodel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "customsqlmodel.h" diff --git a/examples/sql/querymodel/main.cpp b/examples/sql/querymodel/main.cpp index ac1a33f781a..d001fda8663 100644 --- a/examples/sql/querymodel/main.cpp +++ b/examples/sql/querymodel/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "../connection.h" #include "customsqlmodel.h" diff --git a/examples/sql/querymodel/querymodel.pro b/examples/sql/querymodel/querymodel.pro index 8b9923197f9..8e3db2a7685 100644 --- a/examples/sql/querymodel/querymodel.pro +++ b/examples/sql/querymodel/querymodel.pro @@ -4,7 +4,7 @@ HEADERS = ../connection.h \ SOURCES = customsqlmodel.cpp \ editablesqlmodel.cpp \ main.cpp -QT += sql +QT += sql widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/sql/querymodel diff --git a/examples/sql/relationaltablemodel/relationaltablemodel.cpp b/examples/sql/relationaltablemodel/relationaltablemodel.cpp index 8b8ceff4d26..3d8d106ed94 100644 --- a/examples/sql/relationaltablemodel/relationaltablemodel.cpp +++ b/examples/sql/relationaltablemodel/relationaltablemodel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "../connection.h" diff --git a/examples/sql/relationaltablemodel/relationaltablemodel.pro b/examples/sql/relationaltablemodel/relationaltablemodel.pro index a85bc0fbd73..a8bc4fc7a03 100644 --- a/examples/sql/relationaltablemodel/relationaltablemodel.pro +++ b/examples/sql/relationaltablemodel/relationaltablemodel.pro @@ -1,6 +1,6 @@ HEADERS = ../connection.h SOURCES = relationaltablemodel.cpp -QT += sql +QT += sql widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/sql/relationaltablemodel diff --git a/examples/sql/sql.pro b/examples/sql/sql.pro index 43f15e57eb3..68b54e42ca8 100644 --- a/examples/sql/sql.pro +++ b/examples/sql/sql.pro @@ -24,4 +24,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/sql INSTALLS += sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/sql/sqlbrowser/browser.cpp b/examples/sql/sqlbrowser/browser.cpp index 1c537430598..67ceefd20b0 100644 --- a/examples/sql/sqlbrowser/browser.cpp +++ b/examples/sql/sqlbrowser/browser.cpp @@ -42,7 +42,7 @@ #include "browser.h" #include "qsqlconnectiondialog.h" -#include +#include #include Browser::Browser(QWidget *parent) diff --git a/examples/sql/sqlbrowser/connectionwidget.cpp b/examples/sql/sqlbrowser/connectionwidget.cpp index 936f32f29fb..b68a20b309f 100644 --- a/examples/sql/sqlbrowser/connectionwidget.cpp +++ b/examples/sql/sqlbrowser/connectionwidget.cpp @@ -41,7 +41,7 @@ #include "connectionwidget.h" -#include +#include #include ConnectionWidget::ConnectionWidget(QWidget *parent) diff --git a/examples/sql/sqlbrowser/main.cpp b/examples/sql/sqlbrowser/main.cpp index dc006176b70..6e0b1294459 100644 --- a/examples/sql/sqlbrowser/main.cpp +++ b/examples/sql/sqlbrowser/main.cpp @@ -42,7 +42,7 @@ #include "browser.h" #include -#include +#include #include void addConnectionsFromCommandline(const QStringList &args, Browser *browser) diff --git a/examples/sql/sqlbrowser/sqlbrowser.pro b/examples/sql/sqlbrowser/sqlbrowser.pro index 9ec26900adf..73a17b28e7e 100644 --- a/examples/sql/sqlbrowser/sqlbrowser.pro +++ b/examples/sql/sqlbrowser/sqlbrowser.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = sqlbrowser -QT += sql +QT += sql widgets HEADERS = browser.h connectionwidget.h qsqlconnectiondialog.h SOURCES = main.cpp browser.cpp connectionwidget.cpp qsqlconnectiondialog.cpp diff --git a/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro b/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro index a0615bea97a..6d2f028d668 100644 --- a/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro +++ b/examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro @@ -1,7 +1,7 @@ HEADERS = window.h SOURCES = main.cpp \ window.cpp -QT += sql +QT += sql widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/sql/sqlwidgetmapper diff --git a/examples/sql/sqlwidgetmapper/window.cpp b/examples/sql/sqlwidgetmapper/window.cpp index 23954c95c73..4370f508695 100644 --- a/examples/sql/sqlwidgetmapper/window.cpp +++ b/examples/sql/sqlwidgetmapper/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "window.h" diff --git a/examples/sql/tablemodel/tablemodel.cpp b/examples/sql/tablemodel/tablemodel.cpp index a107da07b06..e1a11d140f7 100644 --- a/examples/sql/tablemodel/tablemodel.cpp +++ b/examples/sql/tablemodel/tablemodel.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "../connection.h" diff --git a/examples/sql/tablemodel/tablemodel.pro b/examples/sql/tablemodel/tablemodel.pro index 273a428f38a..b59507db077 100644 --- a/examples/sql/tablemodel/tablemodel.pro +++ b/examples/sql/tablemodel/tablemodel.pro @@ -1,6 +1,6 @@ HEADERS = ../connection.h SOURCES = tablemodel.cpp -QT += sql +QT += sql widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/sql/tablemodel diff --git a/examples/statemachine/eventtransitions/eventtransitions.pro b/examples/statemachine/eventtransitions/eventtransitions.pro index 21b2655dd65..374ef3a72f5 100644 --- a/examples/statemachine/eventtransitions/eventtransitions.pro +++ b/examples/statemachine/eventtransitions/eventtransitions.pro @@ -5,6 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/eventtransitions sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS eventtransitions.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/eventtransitions INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/statemachine/eventtransitions/main.cpp b/examples/statemachine/eventtransitions/main.cpp index 5c0eb8218b3..291c1d441d6 100644 --- a/examples/statemachine/eventtransitions/main.cpp +++ b/examples/statemachine/eventtransitions/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include //! [0] class Window : public QWidget diff --git a/examples/statemachine/rogue/main.cpp b/examples/statemachine/rogue/main.cpp index dc8783c67ec..2939e4a7c5c 100644 --- a/examples/statemachine/rogue/main.cpp +++ b/examples/statemachine/rogue/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/statemachine/rogue/movementtransition.h b/examples/statemachine/rogue/movementtransition.h index be15e386471..f2dcde3375b 100644 --- a/examples/statemachine/rogue/movementtransition.h +++ b/examples/statemachine/rogue/movementtransition.h @@ -41,7 +41,7 @@ #ifndef MOVEMENTTRANSITION_H #define MOVEMENTTRANSITION_H -#include +#include #include "window.h" diff --git a/examples/statemachine/rogue/rogue.pro b/examples/statemachine/rogue/rogue.pro index 3596f173ed9..001f3e44a3e 100644 --- a/examples/statemachine/rogue/rogue.pro +++ b/examples/statemachine/rogue/rogue.pro @@ -9,6 +9,7 @@ sources.files = $$SOURCES $$HEADERS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/rogue INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/statemachine/rogue/window.cpp b/examples/statemachine/rogue/window.cpp index f40b7a020e8..fa62362ecc8 100644 --- a/examples/statemachine/rogue/window.cpp +++ b/examples/statemachine/rogue/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" #include "movementtransition.h" diff --git a/examples/statemachine/statemachine.pro b/examples/statemachine/statemachine.pro index e5b8b757051..a049316e086 100644 --- a/examples/statemachine/statemachine.pro +++ b/examples/statemachine/statemachine.pro @@ -16,3 +16,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS statemachine.pro README sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine INSTALLS += target sources +QT += widgets diff --git a/examples/statemachine/trafficlight/main.cpp b/examples/statemachine/trafficlight/main.cpp index c20e05926f8..353dfb721e7 100644 --- a/examples/statemachine/trafficlight/main.cpp +++ b/examples/statemachine/trafficlight/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include //! [0] class LightWidget : public QWidget diff --git a/examples/statemachine/trafficlight/trafficlight.pro b/examples/statemachine/trafficlight/trafficlight.pro index 6ac90991ea7..9ea94f75f06 100644 --- a/examples/statemachine/trafficlight/trafficlight.pro +++ b/examples/statemachine/trafficlight/trafficlight.pro @@ -5,6 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/trafficlight sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS trafficlight.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/trafficlight INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/statemachine/twowaybutton/main.cpp b/examples/statemachine/twowaybutton/main.cpp index 47343ce4945..3956c2e1c47 100644 --- a/examples/statemachine/twowaybutton/main.cpp +++ b/examples/statemachine/twowaybutton/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include //! [0] int main(int argc, char **argv) diff --git a/examples/statemachine/twowaybutton/twowaybutton.pro b/examples/statemachine/twowaybutton/twowaybutton.pro index 7dd560a743f..3b37be7d9e1 100644 --- a/examples/statemachine/twowaybutton/twowaybutton.pro +++ b/examples/statemachine/twowaybutton/twowaybutton.pro @@ -5,6 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/twowaybutton sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS twowaybutton.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/statemachine/twowaybutton INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/threads/mandelbrot/mandelbrot.pro b/examples/threads/mandelbrot/mandelbrot.pro index d0fb4993afc..0e053af0728 100644 --- a/examples/threads/mandelbrot/mandelbrot.pro +++ b/examples/threads/mandelbrot/mandelbrot.pro @@ -13,4 +13,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/threads/mandelbrot INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/threads/mandelbrot/mandelbrotwidget.cpp b/examples/threads/mandelbrot/mandelbrotwidget.cpp index 47eb473425b..7cee70f547d 100644 --- a/examples/threads/mandelbrot/mandelbrotwidget.cpp +++ b/examples/threads/mandelbrot/mandelbrotwidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include diff --git a/examples/threads/mandelbrot/renderthread.cpp b/examples/threads/mandelbrot/renderthread.cpp index da89f99e5c1..d4f3b8ad50c 100644 --- a/examples/threads/mandelbrot/renderthread.cpp +++ b/examples/threads/mandelbrot/renderthread.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include diff --git a/examples/threads/queuedcustomtype/queuedcustomtype.pro b/examples/threads/queuedcustomtype/queuedcustomtype.pro index 3b1097b177c..415f4f14dd7 100644 --- a/examples/threads/queuedcustomtype/queuedcustomtype.pro +++ b/examples/threads/queuedcustomtype/queuedcustomtype.pro @@ -5,6 +5,7 @@ SOURCES = main.cpp \ block.cpp \ renderthread.cpp \ window.cpp +QT += widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/threads/mandelbrot diff --git a/examples/threads/queuedcustomtype/window.cpp b/examples/threads/queuedcustomtype/window.cpp index 367b75818f5..26a78af969c 100644 --- a/examples/threads/queuedcustomtype/window.cpp +++ b/examples/threads/queuedcustomtype/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" //! [Window constructor start] diff --git a/examples/threads/threads.pro b/examples/threads/threads.pro index 7b5eec6851d..9bdf900f5b0 100644 --- a/examples/threads/threads.pro +++ b/examples/threads/threads.pro @@ -11,4 +11,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/threads INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tools/codecs/codecs.pro b/examples/tools/codecs/codecs.pro index 2e2c9031edb..b906190e0f6 100644 --- a/examples/tools/codecs/codecs.pro +++ b/examples/tools/codecs/codecs.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/codecs INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tools/codecs/mainwindow.cpp b/examples/tools/codecs/mainwindow.cpp index 25eda1d2ba2..bad23e95318 100644 --- a/examples/tools/codecs/mainwindow.cpp +++ b/examples/tools/codecs/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "previewform.h" diff --git a/examples/tools/codecs/previewform.cpp b/examples/tools/codecs/previewform.cpp index 523be6cb0fc..1fc87c978d6 100644 --- a/examples/tools/codecs/previewform.cpp +++ b/examples/tools/codecs/previewform.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "previewform.h" diff --git a/examples/tools/completer/completer.pro b/examples/tools/completer/completer.pro index fd288f3b160..2077ebd750a 100644 --- a/examples/tools/completer/completer.pro +++ b/examples/tools/completer/completer.pro @@ -12,6 +12,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/completer INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tools/completer/mainwindow.cpp b/examples/tools/completer/mainwindow.cpp index 8c848615dcb..d56ed01108f 100644 --- a/examples/tools/completer/mainwindow.cpp +++ b/examples/tools/completer/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "fsmodel.h" #include "mainwindow.h" diff --git a/examples/tools/contiguouscache/contiguouscache.pro b/examples/tools/contiguouscache/contiguouscache.pro index 1787582a3c5..c26f32e3d65 100644 --- a/examples/tools/contiguouscache/contiguouscache.pro +++ b/examples/tools/contiguouscache/contiguouscache.pro @@ -7,6 +7,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/contiguouscache sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS contiguouscache.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/contiguouscache INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tools/customcompleter/customcompleter.pro b/examples/tools/customcompleter/customcompleter.pro index b28272e2a7d..fe417185b9e 100644 --- a/examples/tools/customcompleter/customcompleter.pro +++ b/examples/tools/customcompleter/customcompleter.pro @@ -12,6 +12,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/customcompleter INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tools/customcompleter/mainwindow.cpp b/examples/tools/customcompleter/mainwindow.cpp index c4a7c76e3bc..ecb246f15ba 100644 --- a/examples/tools/customcompleter/mainwindow.cpp +++ b/examples/tools/customcompleter/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "textedit.h" diff --git a/examples/tools/customtype/customtype.pro b/examples/tools/customtype/customtype.pro index 6ea320f9c3f..6542cf54737 100644 --- a/examples/tools/customtype/customtype.pro +++ b/examples/tools/customtype/customtype.pro @@ -1,6 +1,7 @@ HEADERS = message.h SOURCES = main.cpp \ message.cpp +QT += widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/customcompleter diff --git a/examples/tools/customtypesending/customtypesending.pro b/examples/tools/customtypesending/customtypesending.pro index 6bf7d6e74ec..4d11497f0b6 100644 --- a/examples/tools/customtypesending/customtypesending.pro +++ b/examples/tools/customtypesending/customtypesending.pro @@ -3,6 +3,7 @@ HEADERS = message.h \ SOURCES = main.cpp \ message.cpp \ window.cpp +QT += widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/tools/customcompleter diff --git a/examples/tools/customtypesending/window.cpp b/examples/tools/customtypesending/window.cpp index 24845a42798..813fea9b1dc 100644 --- a/examples/tools/customtypesending/window.cpp +++ b/examples/tools/customtypesending/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" //! [Window constructor] diff --git a/examples/tools/echoplugin/echoplugin.pro b/examples/tools/echoplugin/echoplugin.pro index c59f17d782c..66a268f4a01 100644 --- a/examples/tools/echoplugin/echoplugin.pro +++ b/examples/tools/echoplugin/echoplugin.pro @@ -11,4 +11,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/echoplugin INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tools/echoplugin/echowindow/echowindow.cpp b/examples/tools/echoplugin/echowindow/echowindow.cpp index 9e6460a3f71..75e9f161b15 100644 --- a/examples/tools/echoplugin/echowindow/echowindow.cpp +++ b/examples/tools/echoplugin/echowindow/echowindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "echowindow.h" diff --git a/examples/tools/echoplugin/echowindow/echowindow.pro b/examples/tools/echoplugin/echowindow/echowindow.pro index c2e9a31ec76..65aa594b99d 100644 --- a/examples/tools/echoplugin/echowindow/echowindow.pro +++ b/examples/tools/echoplugin/echowindow/echowindow.pro @@ -19,6 +19,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/echoplugin/echowindow INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tools/echoplugin/echowindow/main.cpp b/examples/tools/echoplugin/echowindow/main.cpp index 585c8da6e71..c4659d88135 100644 --- a/examples/tools/echoplugin/echowindow/main.cpp +++ b/examples/tools/echoplugin/echowindow/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "echowindow.h" #include "echointerface.h" diff --git a/examples/tools/echoplugin/plugin/echoplugin.cpp b/examples/tools/echoplugin/plugin/echoplugin.cpp index 099ab81cb18..daa95aa63ce 100644 --- a/examples/tools/echoplugin/plugin/echoplugin.cpp +++ b/examples/tools/echoplugin/plugin/echoplugin.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "echoplugin.h" diff --git a/examples/tools/echoplugin/plugin/plugin.pro b/examples/tools/echoplugin/plugin/plugin.pro index 76bfebeafad..1d98c67698b 100644 --- a/examples/tools/echoplugin/plugin/plugin.pro +++ b/examples/tools/echoplugin/plugin/plugin.pro @@ -19,6 +19,9 @@ symbian { TARGET.EPOCALLOWDLLDATA = 1 } +symbian:TARGET.EPOCALLOWDLLDATA = 1 +QT += widgets +symbian:TARGET.EPOCALLOWDLLDATA = 1 maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) maemo5: warning(This example might not fully work on Maemo platform) diff --git a/examples/tools/i18n/i18n.pro b/examples/tools/i18n/i18n.pro index 366bc4c3276..e315c981ccc 100644 --- a/examples/tools/i18n/i18n.pro +++ b/examples/tools/i18n/i18n.pro @@ -26,6 +26,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/i18n INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tools/i18n/languagechooser.cpp b/examples/tools/i18n/languagechooser.cpp index 888e6aca835..1c034537935 100644 --- a/examples/tools/i18n/languagechooser.cpp +++ b/examples/tools/i18n/languagechooser.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "languagechooser.h" #include "mainwindow.h" diff --git a/examples/tools/i18n/mainwindow.cpp b/examples/tools/i18n/mainwindow.cpp index 8e1b14160fd..34fd99d8680 100644 --- a/examples/tools/i18n/mainwindow.cpp +++ b/examples/tools/i18n/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/tools/inputpanel/inputpanel.pro b/examples/tools/inputpanel/inputpanel.pro index f51dad41baa..370ac5da54c 100644 --- a/examples/tools/inputpanel/inputpanel.pro +++ b/examples/tools/inputpanel/inputpanel.pro @@ -15,6 +15,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/inputpanel INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tools/inputpanel/main.cpp b/examples/tools/inputpanel/main.cpp index 2760e98d792..9d0c350faae 100644 --- a/examples/tools/inputpanel/main.cpp +++ b/examples/tools/inputpanel/main.cpp @@ -38,8 +38,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include //! [main] #include "myinputpanelcontext.h" diff --git a/examples/tools/inputpanel/myinputpanel.h b/examples/tools/inputpanel/myinputpanel.h index c1d5d1ff25c..0d11e9c0382 100644 --- a/examples/tools/inputpanel/myinputpanel.h +++ b/examples/tools/inputpanel/myinputpanel.h @@ -41,7 +41,7 @@ #ifndef MYINPUTPANEL_H #define MYINPUTPANEL_H -#include +#include #include #include "ui_myinputpanelform.h" diff --git a/examples/tools/inputpanel/myinputpanelcontext.h b/examples/tools/inputpanel/myinputpanelcontext.h index bb40e211a73..e69a4960400 100644 --- a/examples/tools/inputpanel/myinputpanelcontext.h +++ b/examples/tools/inputpanel/myinputpanelcontext.h @@ -41,7 +41,7 @@ #ifndef MYINPUTPANELCONTEXT_H #define MYINPUTPANELCONTEXT_H -#include +#include #include "myinputpanel.h" diff --git a/examples/tools/plugandpaint/plugandpaint.pro b/examples/tools/plugandpaint/plugandpaint.pro index e2966de5a3b..d2ab1bad45c 100644 --- a/examples/tools/plugandpaint/plugandpaint.pro +++ b/examples/tools/plugandpaint/plugandpaint.pro @@ -26,6 +26,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/plugandpaint INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tools/plugandpaintplugins/basictools/basictools.pro b/examples/tools/plugandpaintplugins/basictools/basictools.pro index 7289522cbee..2b2f45ae602 100644 --- a/examples/tools/plugandpaintplugins/basictools/basictools.pro +++ b/examples/tools/plugandpaintplugins/basictools/basictools.pro @@ -15,4 +15,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/plugandpaintplugins/basictoo INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp b/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp index a35dae7ab99..3e0af26efa0 100644 --- a/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp +++ b/examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include diff --git a/examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro b/examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro index 88bf7b1aa37..434de1a5e30 100644 --- a/examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro +++ b/examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro @@ -17,4 +17,5 @@ INSTALLS += target sources symbian: CONFIG += qt_example symbian:TARGET.EPOCALLOWDLLDATA = 1 +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp b/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp index 9f8ca486503..e58fde22055 100644 --- a/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp +++ b/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include diff --git a/examples/tools/plugandpaintplugins/plugandpaintplugins.pro b/examples/tools/plugandpaintplugins/plugandpaintplugins.pro index eda965fe955..deda635b892 100644 --- a/examples/tools/plugandpaintplugins/plugandpaintplugins.pro +++ b/examples/tools/plugandpaintplugins/plugandpaintplugins.pro @@ -9,4 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/plugandpaintplugins INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tools/regexp/regexp.pro b/examples/tools/regexp/regexp.pro index 0e84510305a..62ae570ef1b 100644 --- a/examples/tools/regexp/regexp.pro +++ b/examples/tools/regexp/regexp.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/regexp INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tools/regexp/regexpdialog.cpp b/examples/tools/regexp/regexpdialog.cpp index 583c384bdd3..b9468bd49fb 100644 --- a/examples/tools/regexp/regexpdialog.cpp +++ b/examples/tools/regexp/regexpdialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "regexpdialog.h" diff --git a/examples/tools/settingseditor/locationdialog.cpp b/examples/tools/settingseditor/locationdialog.cpp index 6ebf56682c4..dcf190363a4 100644 --- a/examples/tools/settingseditor/locationdialog.cpp +++ b/examples/tools/settingseditor/locationdialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "locationdialog.h" diff --git a/examples/tools/settingseditor/mainwindow.cpp b/examples/tools/settingseditor/mainwindow.cpp index 4b8bc4e2b81..6b875f3a243 100644 --- a/examples/tools/settingseditor/mainwindow.cpp +++ b/examples/tools/settingseditor/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "locationdialog.h" #include "mainwindow.h" diff --git a/examples/tools/settingseditor/settingseditor.pro b/examples/tools/settingseditor/settingseditor.pro index ca9e2cae19a..788b4def0b4 100644 --- a/examples/tools/settingseditor/settingseditor.pro +++ b/examples/tools/settingseditor/settingseditor.pro @@ -15,6 +15,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/settingseditor INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tools/settingseditor/settingstree.cpp b/examples/tools/settingseditor/settingstree.cpp index 1fd80d756bc..892cb305907 100644 --- a/examples/tools/settingseditor/settingstree.cpp +++ b/examples/tools/settingseditor/settingstree.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "settingstree.h" #include "variantdelegate.h" diff --git a/examples/tools/settingseditor/variantdelegate.cpp b/examples/tools/settingseditor/variantdelegate.cpp index 5827b8447fc..e4b532f9fe9 100644 --- a/examples/tools/settingseditor/variantdelegate.cpp +++ b/examples/tools/settingseditor/variantdelegate.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "variantdelegate.h" diff --git a/examples/tools/styleplugin/plugin/plugin.pro b/examples/tools/styleplugin/plugin/plugin.pro index cdcac475910..55ea4e4bba8 100644 --- a/examples/tools/styleplugin/plugin/plugin.pro +++ b/examples/tools/styleplugin/plugin/plugin.pro @@ -23,4 +23,5 @@ INSTALLS += target sources symbian: CONFIG += qt_example symbian:TARGET.EPOCALLOWDLLDATA = 1 +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tools/styleplugin/plugin/simplestyle.cpp b/examples/tools/styleplugin/plugin/simplestyle.cpp index ea672166e24..d897f3a39b8 100644 --- a/examples/tools/styleplugin/plugin/simplestyle.cpp +++ b/examples/tools/styleplugin/plugin/simplestyle.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "simplestyle.h" diff --git a/examples/tools/styleplugin/plugin/simplestyleplugin.cpp b/examples/tools/styleplugin/plugin/simplestyleplugin.cpp index 28dbe5c8578..d5acd082062 100644 --- a/examples/tools/styleplugin/plugin/simplestyleplugin.cpp +++ b/examples/tools/styleplugin/plugin/simplestyleplugin.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "simplestyleplugin.h" #include "simplestyle.h" diff --git a/examples/tools/styleplugin/styleplugin.pro b/examples/tools/styleplugin/styleplugin.pro index 90a36b8c507..6d8c09ffbb4 100644 --- a/examples/tools/styleplugin/styleplugin.pro +++ b/examples/tools/styleplugin/styleplugin.pro @@ -9,4 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/styleplugin INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tools/styleplugin/stylewindow/main.cpp b/examples/tools/styleplugin/stylewindow/main.cpp index 1cf42aa86de..da6e2180000 100644 --- a/examples/tools/styleplugin/stylewindow/main.cpp +++ b/examples/tools/styleplugin/stylewindow/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "stylewindow.h" diff --git a/examples/tools/styleplugin/stylewindow/stylewindow.cpp b/examples/tools/styleplugin/stylewindow/stylewindow.cpp index eb2e3c30076..3a4da984947 100644 --- a/examples/tools/styleplugin/stylewindow/stylewindow.cpp +++ b/examples/tools/styleplugin/stylewindow/stylewindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "stylewindow.h" diff --git a/examples/tools/styleplugin/stylewindow/stylewindow.pro b/examples/tools/styleplugin/stylewindow/stylewindow.pro index 556bc1de75b..cdbe9f65532 100644 --- a/examples/tools/styleplugin/stylewindow/stylewindow.pro +++ b/examples/tools/styleplugin/stylewindow/stylewindow.pro @@ -17,4 +17,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/styleplugin/stylewindow INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tools/tools.pro b/examples/tools/tools.pro index c6e02509347..cfab2f9def6 100644 --- a/examples/tools/tools.pro +++ b/examples/tools/tools.pro @@ -25,4 +25,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tools/treemodelcompleter/mainwindow.cpp b/examples/tools/treemodelcompleter/mainwindow.cpp index 3f832fa6ec6..6d8c7aec804 100644 --- a/examples/tools/treemodelcompleter/mainwindow.cpp +++ b/examples/tools/treemodelcompleter/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "treemodelcompleter.h" #include "mainwindow.h" diff --git a/examples/tools/treemodelcompleter/treemodelcompleter.pro b/examples/tools/treemodelcompleter/treemodelcompleter.pro index fbb4d7cfd7f..c64b44be8f0 100644 --- a/examples/tools/treemodelcompleter/treemodelcompleter.pro +++ b/examples/tools/treemodelcompleter/treemodelcompleter.pro @@ -12,6 +12,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/treemodelcompleter INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tools/undo/undo.pro b/examples/tools/undo/undo.pro index 0c7c40dd5f9..ace6e49e8ac 100644 --- a/examples/tools/undo/undo.pro +++ b/examples/tools/undo/undo.pro @@ -15,4 +15,5 @@ sources.files = $$SOURCES $$HEADERS *.pro icons $$RESOURCES $$FORMS sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/undo INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example diff --git a/examples/tools/undoframework/commands.cpp b/examples/tools/undoframework/commands.cpp index ff7b0b7f1df..03f8b98d740 100644 --- a/examples/tools/undoframework/commands.cpp +++ b/examples/tools/undoframework/commands.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "commands.h" #include "diagramitem.h" diff --git a/examples/tools/undoframework/diagramitem.cpp b/examples/tools/undoframework/diagramitem.cpp index 3e896f39266..815c8dd69e7 100644 --- a/examples/tools/undoframework/diagramitem.cpp +++ b/examples/tools/undoframework/diagramitem.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "diagramitem.h" diff --git a/examples/tools/undoframework/diagramscene.cpp b/examples/tools/undoframework/diagramscene.cpp index 7ffd2db3aca..c60ccc915bd 100644 --- a/examples/tools/undoframework/diagramscene.cpp +++ b/examples/tools/undoframework/diagramscene.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "diagramscene.h" #include "diagramitem.h" diff --git a/examples/tools/undoframework/main.cpp b/examples/tools/undoframework/main.cpp index abfa0aa462e..385311cb1dc 100644 --- a/examples/tools/undoframework/main.cpp +++ b/examples/tools/undoframework/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/tools/undoframework/mainwindow.cpp b/examples/tools/undoframework/mainwindow.cpp index 72c9cc14f41..52a2cffac32 100644 --- a/examples/tools/undoframework/mainwindow.cpp +++ b/examples/tools/undoframework/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "diagramscene.h" diff --git a/examples/tools/undoframework/undoframework.pro b/examples/tools/undoframework/undoframework.pro index f8f127c8ce8..a356ce935e7 100644 --- a/examples/tools/undoframework/undoframework.pro +++ b/examples/tools/undoframework/undoframework.pro @@ -16,6 +16,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tools/undoframework INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/touch/dials/dials.pro b/examples/touch/dials/dials.pro index 30377c76f11..0836c741ab0 100644 --- a/examples/touch/dials/dials.pro +++ b/examples/touch/dials/dials.pro @@ -6,6 +6,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/touch/dials sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS dials.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/touch/dials INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/touch/fingerpaint/fingerpaint.pro b/examples/touch/fingerpaint/fingerpaint.pro index 2b0d9c5ac18..2d11eb7da75 100644 --- a/examples/touch/fingerpaint/fingerpaint.pro +++ b/examples/touch/fingerpaint/fingerpaint.pro @@ -9,6 +9,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/touch/fingerpaint sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS fingerpaint.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/touch/fingerpaint INSTALLS += target sources +QT += widgets printsupport symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/touch/fingerpaint/mainwindow.cpp b/examples/touch/fingerpaint/mainwindow.cpp index 37b7ed73f4c..83885224327 100644 --- a/examples/touch/fingerpaint/mainwindow.cpp +++ b/examples/touch/fingerpaint/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "scribblearea.h" diff --git a/examples/touch/fingerpaint/scribblearea.cpp b/examples/touch/fingerpaint/scribblearea.cpp index f66e61cfd37..a83a9f3f1d6 100644 --- a/examples/touch/fingerpaint/scribblearea.cpp +++ b/examples/touch/fingerpaint/scribblearea.cpp @@ -38,7 +38,9 @@ ** ****************************************************************************/ -#include +#include +#include +#include #include "scribblearea.h" diff --git a/examples/touch/knobs/knobs.pro b/examples/touch/knobs/knobs.pro index f53a9d2a1b7..caa3af098c3 100644 --- a/examples/touch/knobs/knobs.pro +++ b/examples/touch/knobs/knobs.pro @@ -6,6 +6,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/touch/knobs sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS knobs.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/touch/knobs INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/touch/pinchzoom/main.cpp b/examples/touch/pinchzoom/main.cpp index defe0028af8..bf8528c1e48 100644 --- a/examples/touch/pinchzoom/main.cpp +++ b/examples/touch/pinchzoom/main.cpp @@ -41,7 +41,7 @@ #include "graphicsview.h" #include "mouse.h" -#include +#include #include diff --git a/examples/touch/pinchzoom/pinchzoom.pro b/examples/touch/pinchzoom/pinchzoom.pro index e038456aa71..f4145dbdfd1 100644 --- a/examples/touch/pinchzoom/pinchzoom.pro +++ b/examples/touch/pinchzoom/pinchzoom.pro @@ -14,6 +14,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/touch/pinchzoom sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS pinchzoom.pro images sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/touch/pinchzoom INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/touch/touch.pro b/examples/touch/touch.pro index d5983eb581e..515b480f86d 100644 --- a/examples/touch/touch.pro +++ b/examples/touch/touch.pro @@ -1,2 +1,3 @@ TEMPLATE = subdirs SUBDIRS = pinchzoom fingerpaint knobs dials +QT += widgets diff --git a/examples/tutorials/addressbook-fr/addressbook-fr.pro b/examples/tutorials/addressbook-fr/addressbook-fr.pro index 279998b5adb..0ee8387437f 100644 --- a/examples/tutorials/addressbook-fr/addressbook-fr.pro +++ b/examples/tutorials/addressbook-fr/addressbook-fr.pro @@ -6,4 +6,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook-fr sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS addressbook-fr.pro README sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook-fr INSTALLS += target sources +QT += widgets diff --git a/examples/tutorials/addressbook-fr/part1/addressbook.cpp b/examples/tutorials/addressbook-fr/part1/addressbook.cpp index 7ff4c9ea79e..372aa43ed0e 100644 --- a/examples/tutorials/addressbook-fr/part1/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part1/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" //! [constructor and input fields] diff --git a/examples/tutorials/addressbook-fr/part1/main.cpp b/examples/tutorials/addressbook-fr/part1/main.cpp index 970921d5376..a17c894a4bf 100644 --- a/examples/tutorials/addressbook-fr/part1/main.cpp +++ b/examples/tutorials/addressbook-fr/part1/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" //! [main function] diff --git a/examples/tutorials/addressbook-fr/part1/part1.pro b/examples/tutorials/addressbook-fr/part1/part1.pro index 1b1bd7b0f42..9d99ec68521 100644 --- a/examples/tutorials/addressbook-fr/part1/part1.pro +++ b/examples/tutorials/addressbook-fr/part1/part1.pro @@ -7,6 +7,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part1 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS part1.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part1 INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tutorials/addressbook-fr/part2/addressbook.cpp b/examples/tutorials/addressbook-fr/part2/addressbook.cpp index 36023c850ae..04d4b2c693e 100644 --- a/examples/tutorials/addressbook-fr/part2/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part2/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook-fr/part2/main.cpp b/examples/tutorials/addressbook-fr/part2/main.cpp index 970921d5376..a17c894a4bf 100644 --- a/examples/tutorials/addressbook-fr/part2/main.cpp +++ b/examples/tutorials/addressbook-fr/part2/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" //! [main function] diff --git a/examples/tutorials/addressbook-fr/part2/part2.pro b/examples/tutorials/addressbook-fr/part2/part2.pro index 204cc2db581..faa54f8b517 100644 --- a/examples/tutorials/addressbook-fr/part2/part2.pro +++ b/examples/tutorials/addressbook-fr/part2/part2.pro @@ -7,6 +7,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part2 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS part2.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part2 INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tutorials/addressbook-fr/part3/addressbook.cpp b/examples/tutorials/addressbook-fr/part3/addressbook.cpp index 47d312e7ac9..ee57b19b088 100644 --- a/examples/tutorials/addressbook-fr/part3/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part3/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook-fr/part3/main.cpp b/examples/tutorials/addressbook-fr/part3/main.cpp index 2c92e255b81..15991677c2f 100644 --- a/examples/tutorials/addressbook-fr/part3/main.cpp +++ b/examples/tutorials/addressbook-fr/part3/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/addressbook-fr/part3/part3.pro b/examples/tutorials/addressbook-fr/part3/part3.pro index 10193b8b309..1f01b8ac292 100644 --- a/examples/tutorials/addressbook-fr/part3/part3.pro +++ b/examples/tutorials/addressbook-fr/part3/part3.pro @@ -7,6 +7,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part3 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS part3.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part3 INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tutorials/addressbook-fr/part4/addressbook.cpp b/examples/tutorials/addressbook-fr/part4/addressbook.cpp index e88ab6a8e27..047bc6e05c4 100644 --- a/examples/tutorials/addressbook-fr/part4/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part4/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook-fr/part4/main.cpp b/examples/tutorials/addressbook-fr/part4/main.cpp index 2c92e255b81..15991677c2f 100644 --- a/examples/tutorials/addressbook-fr/part4/main.cpp +++ b/examples/tutorials/addressbook-fr/part4/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/addressbook-fr/part4/part4.pro b/examples/tutorials/addressbook-fr/part4/part4.pro index 82765821c6d..312f183c74d 100644 --- a/examples/tutorials/addressbook-fr/part4/part4.pro +++ b/examples/tutorials/addressbook-fr/part4/part4.pro @@ -7,6 +7,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part4 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS part4.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part4 INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tutorials/addressbook-fr/part5/addressbook.cpp b/examples/tutorials/addressbook-fr/part5/addressbook.cpp index 471ffa3663d..3f381766c60 100644 --- a/examples/tutorials/addressbook-fr/part5/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part5/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook-fr/part5/finddialog.cpp b/examples/tutorials/addressbook-fr/part5/finddialog.cpp index 03d4abf1aca..5bba3afd942 100644 --- a/examples/tutorials/addressbook-fr/part5/finddialog.cpp +++ b/examples/tutorials/addressbook-fr/part5/finddialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "finddialog.h" //! [constructor] diff --git a/examples/tutorials/addressbook-fr/part5/main.cpp b/examples/tutorials/addressbook-fr/part5/main.cpp index 2c92e255b81..15991677c2f 100644 --- a/examples/tutorials/addressbook-fr/part5/main.cpp +++ b/examples/tutorials/addressbook-fr/part5/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/addressbook-fr/part5/part5.pro b/examples/tutorials/addressbook-fr/part5/part5.pro index efb36fa9070..34f9b56d7f2 100644 --- a/examples/tutorials/addressbook-fr/part5/part5.pro +++ b/examples/tutorials/addressbook-fr/part5/part5.pro @@ -9,6 +9,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part5 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS part5.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part5 INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tutorials/addressbook-fr/part6/addressbook.cpp b/examples/tutorials/addressbook-fr/part6/addressbook.cpp index a085ab3bed1..354b4827427 100644 --- a/examples/tutorials/addressbook-fr/part6/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part6/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook-fr/part6/finddialog.cpp b/examples/tutorials/addressbook-fr/part6/finddialog.cpp index 9e4342a590a..86d4df92273 100644 --- a/examples/tutorials/addressbook-fr/part6/finddialog.cpp +++ b/examples/tutorials/addressbook-fr/part6/finddialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "finddialog.h" FindDialog::FindDialog(QWidget *parent) diff --git a/examples/tutorials/addressbook-fr/part6/main.cpp b/examples/tutorials/addressbook-fr/part6/main.cpp index 2c92e255b81..15991677c2f 100644 --- a/examples/tutorials/addressbook-fr/part6/main.cpp +++ b/examples/tutorials/addressbook-fr/part6/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/addressbook-fr/part6/part6.pro b/examples/tutorials/addressbook-fr/part6/part6.pro index 4ece4d7280a..81ec20fffeb 100644 --- a/examples/tutorials/addressbook-fr/part6/part6.pro +++ b/examples/tutorials/addressbook-fr/part6/part6.pro @@ -9,6 +9,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part6 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS part6.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part6 INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tutorials/addressbook-fr/part7/addressbook.cpp b/examples/tutorials/addressbook-fr/part7/addressbook.cpp index 68a4b4cc853..73ec3dcf23b 100644 --- a/examples/tutorials/addressbook-fr/part7/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part7/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook-fr/part7/finddialog.cpp b/examples/tutorials/addressbook-fr/part7/finddialog.cpp index 9e4342a590a..86d4df92273 100644 --- a/examples/tutorials/addressbook-fr/part7/finddialog.cpp +++ b/examples/tutorials/addressbook-fr/part7/finddialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "finddialog.h" FindDialog::FindDialog(QWidget *parent) diff --git a/examples/tutorials/addressbook-fr/part7/main.cpp b/examples/tutorials/addressbook-fr/part7/main.cpp index 2c92e255b81..15991677c2f 100644 --- a/examples/tutorials/addressbook-fr/part7/main.cpp +++ b/examples/tutorials/addressbook-fr/part7/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/addressbook-fr/part7/part7.pro b/examples/tutorials/addressbook-fr/part7/part7.pro index 9ba980755bd..921c3136545 100644 --- a/examples/tutorials/addressbook-fr/part7/part7.pro +++ b/examples/tutorials/addressbook-fr/part7/part7.pro @@ -9,6 +9,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part7 sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS part7.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part7 INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tutorials/addressbook/addressbook.pro b/examples/tutorials/addressbook/addressbook.pro index e549844be6c..09972a92cc5 100644 --- a/examples/tutorials/addressbook/addressbook.pro +++ b/examples/tutorials/addressbook/addressbook.pro @@ -8,4 +8,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tutorials/addressbook/part1/addressbook.cpp b/examples/tutorials/addressbook/part1/addressbook.cpp index 7ff4c9ea79e..372aa43ed0e 100644 --- a/examples/tutorials/addressbook/part1/addressbook.cpp +++ b/examples/tutorials/addressbook/part1/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" //! [constructor and input fields] diff --git a/examples/tutorials/addressbook/part1/main.cpp b/examples/tutorials/addressbook/part1/main.cpp index 970921d5376..a17c894a4bf 100644 --- a/examples/tutorials/addressbook/part1/main.cpp +++ b/examples/tutorials/addressbook/part1/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" //! [main function] diff --git a/examples/tutorials/addressbook/part1/part1.pro b/examples/tutorials/addressbook/part1/part1.pro index 1b1bd7b0f42..ba236a146d4 100644 --- a/examples/tutorials/addressbook/part1/part1.pro +++ b/examples/tutorials/addressbook/part1/part1.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part1 INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/addressbook/part2/addressbook.cpp b/examples/tutorials/addressbook/part2/addressbook.cpp index 5fccd12b8ed..a7d50017c68 100644 --- a/examples/tutorials/addressbook/part2/addressbook.cpp +++ b/examples/tutorials/addressbook/part2/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook/part2/main.cpp b/examples/tutorials/addressbook/part2/main.cpp index 970921d5376..a17c894a4bf 100644 --- a/examples/tutorials/addressbook/part2/main.cpp +++ b/examples/tutorials/addressbook/part2/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" //! [main function] diff --git a/examples/tutorials/addressbook/part2/part2.pro b/examples/tutorials/addressbook/part2/part2.pro index 204cc2db581..fc8ba7b1485 100644 --- a/examples/tutorials/addressbook/part2/part2.pro +++ b/examples/tutorials/addressbook/part2/part2.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part2 INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/addressbook/part3/addressbook.cpp b/examples/tutorials/addressbook/part3/addressbook.cpp index 72ca52b1995..b539c017763 100644 --- a/examples/tutorials/addressbook/part3/addressbook.cpp +++ b/examples/tutorials/addressbook/part3/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook/part3/main.cpp b/examples/tutorials/addressbook/part3/main.cpp index 2c92e255b81..15991677c2f 100644 --- a/examples/tutorials/addressbook/part3/main.cpp +++ b/examples/tutorials/addressbook/part3/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/addressbook/part3/part3.pro b/examples/tutorials/addressbook/part3/part3.pro index 10193b8b309..38c1d6ea4b6 100644 --- a/examples/tutorials/addressbook/part3/part3.pro +++ b/examples/tutorials/addressbook/part3/part3.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part3 INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/addressbook/part4/addressbook.cpp b/examples/tutorials/addressbook/part4/addressbook.cpp index bbb5e039878..d82dda74c4d 100644 --- a/examples/tutorials/addressbook/part4/addressbook.cpp +++ b/examples/tutorials/addressbook/part4/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook/part4/main.cpp b/examples/tutorials/addressbook/part4/main.cpp index 2c92e255b81..15991677c2f 100644 --- a/examples/tutorials/addressbook/part4/main.cpp +++ b/examples/tutorials/addressbook/part4/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/addressbook/part4/part4.pro b/examples/tutorials/addressbook/part4/part4.pro index 82765821c6d..9ca4efb124d 100644 --- a/examples/tutorials/addressbook/part4/part4.pro +++ b/examples/tutorials/addressbook/part4/part4.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part4 INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/addressbook/part5/addressbook.cpp b/examples/tutorials/addressbook/part5/addressbook.cpp index 7489e7c9dbc..6342db3f8dd 100644 --- a/examples/tutorials/addressbook/part5/addressbook.cpp +++ b/examples/tutorials/addressbook/part5/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook/part5/finddialog.cpp b/examples/tutorials/addressbook/part5/finddialog.cpp index 03d4abf1aca..5bba3afd942 100644 --- a/examples/tutorials/addressbook/part5/finddialog.cpp +++ b/examples/tutorials/addressbook/part5/finddialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "finddialog.h" //! [constructor] diff --git a/examples/tutorials/addressbook/part5/main.cpp b/examples/tutorials/addressbook/part5/main.cpp index 2c92e255b81..15991677c2f 100644 --- a/examples/tutorials/addressbook/part5/main.cpp +++ b/examples/tutorials/addressbook/part5/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/addressbook/part5/part5.pro b/examples/tutorials/addressbook/part5/part5.pro index efb36fa9070..7d6279557f8 100644 --- a/examples/tutorials/addressbook/part5/part5.pro +++ b/examples/tutorials/addressbook/part5/part5.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part5 INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/addressbook/part6/addressbook.cpp b/examples/tutorials/addressbook/part6/addressbook.cpp index c7dc8e219b9..20425d15c2c 100644 --- a/examples/tutorials/addressbook/part6/addressbook.cpp +++ b/examples/tutorials/addressbook/part6/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook/part6/finddialog.cpp b/examples/tutorials/addressbook/part6/finddialog.cpp index 9e4342a590a..86d4df92273 100644 --- a/examples/tutorials/addressbook/part6/finddialog.cpp +++ b/examples/tutorials/addressbook/part6/finddialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "finddialog.h" FindDialog::FindDialog(QWidget *parent) diff --git a/examples/tutorials/addressbook/part6/main.cpp b/examples/tutorials/addressbook/part6/main.cpp index 2c92e255b81..15991677c2f 100644 --- a/examples/tutorials/addressbook/part6/main.cpp +++ b/examples/tutorials/addressbook/part6/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/addressbook/part6/part6.pro b/examples/tutorials/addressbook/part6/part6.pro index 4ece4d7280a..c9fcb87d91e 100644 --- a/examples/tutorials/addressbook/part6/part6.pro +++ b/examples/tutorials/addressbook/part6/part6.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part6 INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/addressbook/part7/addressbook.cpp b/examples/tutorials/addressbook/part7/addressbook.cpp index 501ad31c5cf..88847f2ea01 100644 --- a/examples/tutorials/addressbook/part7/addressbook.cpp +++ b/examples/tutorials/addressbook/part7/addressbook.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" AddressBook::AddressBook(QWidget *parent) diff --git a/examples/tutorials/addressbook/part7/finddialog.cpp b/examples/tutorials/addressbook/part7/finddialog.cpp index 9e4342a590a..86d4df92273 100644 --- a/examples/tutorials/addressbook/part7/finddialog.cpp +++ b/examples/tutorials/addressbook/part7/finddialog.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "finddialog.h" FindDialog::FindDialog(QWidget *parent) diff --git a/examples/tutorials/addressbook/part7/main.cpp b/examples/tutorials/addressbook/part7/main.cpp index 2c92e255b81..15991677c2f 100644 --- a/examples/tutorials/addressbook/part7/main.cpp +++ b/examples/tutorials/addressbook/part7/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "addressbook.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/addressbook/part7/part7.pro b/examples/tutorials/addressbook/part7/part7.pro index 9ba980755bd..a9183443ff7 100644 --- a/examples/tutorials/addressbook/part7/part7.pro +++ b/examples/tutorials/addressbook/part7/part7.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/addressbook/part7 INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/gettingStarted/gettingStarted.pro b/examples/tutorials/gettingStarted/gettingStarted.pro index 9d10f0f67a2..4ab5f4e6dd5 100644 --- a/examples/tutorials/gettingStarted/gettingStarted.pro +++ b/examples/tutorials/gettingStarted/gettingStarted.pro @@ -1,2 +1,3 @@ TEMPLATE = subdirs SUBDIRS += +QT += widgets diff --git a/examples/tutorials/gettingStarted/gsQt/gsqt.pro b/examples/tutorials/gettingStarted/gsQt/gsqt.pro index ee632f96ff6..3dac79afcea 100755 --- a/examples/tutorials/gettingStarted/gsQt/gsqt.pro +++ b/examples/tutorials/gettingStarted/gsQt/gsqt.pro @@ -11,3 +11,4 @@ sources.files = *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/gettingStarted/gsQt INSTALLS += sources +QT += widgets diff --git a/examples/tutorials/gettingStarted/gsQt/part1/main.cpp b/examples/tutorials/gettingStarted/gsQt/part1/main.cpp index eaf04256d9b..5f5ac7384bb 100755 --- a/examples/tutorials/gettingStarted/gsQt/part1/main.cpp +++ b/examples/tutorials/gettingStarted/gsQt/part1/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include int main(int argv, char **args) diff --git a/examples/tutorials/gettingStarted/gsQt/part2/main.cpp b/examples/tutorials/gettingStarted/gsQt/part2/main.cpp index 24b4d77abc3..c2b94a3d0c9 100755 --- a/examples/tutorials/gettingStarted/gsQt/part2/main.cpp +++ b/examples/tutorials/gettingStarted/gsQt/part2/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include int main(int argv, char **args) { diff --git a/examples/tutorials/gettingStarted/gsQt/part3/main.cpp b/examples/tutorials/gettingStarted/gsQt/part3/main.cpp index 59ff9c40ead..00fb70a4abb 100755 --- a/examples/tutorials/gettingStarted/gsQt/part3/main.cpp +++ b/examples/tutorials/gettingStarted/gsQt/part3/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include class Notepad : public QWidget { diff --git a/examples/tutorials/gettingStarted/gsQt/part4/main.cpp b/examples/tutorials/gettingStarted/gsQt/part4/main.cpp index ba18afb7499..a8cefe5347b 100755 --- a/examples/tutorials/gettingStarted/gsQt/part4/main.cpp +++ b/examples/tutorials/gettingStarted/gsQt/part4/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include class Notepad : public QMainWindow { diff --git a/examples/tutorials/gettingStarted/gsQt/part5/main.cpp b/examples/tutorials/gettingStarted/gsQt/part5/main.cpp index 4a6257d10e5..f25bbd02c10 100755 --- a/examples/tutorials/gettingStarted/gsQt/part5/main.cpp +++ b/examples/tutorials/gettingStarted/gsQt/part5/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include class Notepad : public QMainWindow { diff --git a/examples/tutorials/modelview/1_readonly/1_readonly.pro b/examples/tutorials/modelview/1_readonly/1_readonly.pro index e99956a140b..e794f192be8 100755 --- a/examples/tutorials/modelview/1_readonly/1_readonly.pro +++ b/examples/tutorials/modelview/1_readonly/1_readonly.pro @@ -15,6 +15,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/1_readonly INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp index fdde141b4c2..fb1b6708966 100755 --- a/examples/tutorials/modelview/1_readonly/main.cpp +++ b/examples/tutorials/modelview/1_readonly/main.cpp @@ -40,8 +40,8 @@ //! [Quoting ModelView Tutorial] // main.cpp -#include -#include +#include +#include #include "mymodel.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/modelview/2_formatting/2_formatting.pro b/examples/tutorials/modelview/2_formatting/2_formatting.pro index c6416dc415c..9065100a3c2 100755 --- a/examples/tutorials/modelview/2_formatting/2_formatting.pro +++ b/examples/tutorials/modelview/2_formatting/2_formatting.pro @@ -14,6 +14,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/2_formatting INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/modelview/2_formatting/main.cpp b/examples/tutorials/modelview/2_formatting/main.cpp index fdde141b4c2..fb1b6708966 100755 --- a/examples/tutorials/modelview/2_formatting/main.cpp +++ b/examples/tutorials/modelview/2_formatting/main.cpp @@ -40,8 +40,8 @@ //! [Quoting ModelView Tutorial] // main.cpp -#include -#include +#include +#include #include "mymodel.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro index e5a61fca0ff..58070a5b572 100755 --- a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro +++ b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro @@ -14,6 +14,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/3_changingmode INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/modelview/3_changingmodel/main.cpp b/examples/tutorials/modelview/3_changingmodel/main.cpp index 8a4ab8f6ab9..424c1dc4386 100755 --- a/examples/tutorials/modelview/3_changingmodel/main.cpp +++ b/examples/tutorials/modelview/3_changingmodel/main.cpp @@ -38,8 +38,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include "mymodel.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/modelview/4_headers/4_headers.pro b/examples/tutorials/modelview/4_headers/4_headers.pro index 16f907dc4b6..819daabdfad 100755 --- a/examples/tutorials/modelview/4_headers/4_headers.pro +++ b/examples/tutorials/modelview/4_headers/4_headers.pro @@ -14,6 +14,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/4_headers INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/modelview/4_headers/main.cpp b/examples/tutorials/modelview/4_headers/main.cpp index c89829ab426..9dadb071a7b 100755 --- a/examples/tutorials/modelview/4_headers/main.cpp +++ b/examples/tutorials/modelview/4_headers/main.cpp @@ -38,8 +38,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include #include "mymodel.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/modelview/5_edit/5_edit.pro b/examples/tutorials/modelview/5_edit/5_edit.pro index fadd0e2921e..bab5d49bcec 100755 --- a/examples/tutorials/modelview/5_edit/5_edit.pro +++ b/examples/tutorials/modelview/5_edit/5_edit.pro @@ -16,6 +16,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/5_edit INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/modelview/5_edit/main.cpp b/examples/tutorials/modelview/5_edit/main.cpp index 75246f7dc7c..2a78dd09e99 100755 --- a/examples/tutorials/modelview/5_edit/main.cpp +++ b/examples/tutorials/modelview/5_edit/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/modelview/5_edit/mainwindow.h b/examples/tutorials/modelview/5_edit/mainwindow.h index 37303f82935..7db37919e3d 100755 --- a/examples/tutorials/modelview/5_edit/mainwindow.h +++ b/examples/tutorials/modelview/5_edit/mainwindow.h @@ -41,7 +41,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include QT_BEGIN_NAMESPACE // QT_BEGIN_NAMESPACE / QT_END_NAMESPACE are not needed in Qt user code class QTableView; //forward declaration diff --git a/examples/tutorials/modelview/6_treeview/6_treeview.pro b/examples/tutorials/modelview/6_treeview/6_treeview.pro index 94f301aeae2..3dfc324512e 100755 --- a/examples/tutorials/modelview/6_treeview/6_treeview.pro +++ b/examples/tutorials/modelview/6_treeview/6_treeview.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/6_treeview INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/modelview/6_treeview/main.cpp b/examples/tutorials/modelview/6_treeview/main.cpp index 75246f7dc7c..2a78dd09e99 100755 --- a/examples/tutorials/modelview/6_treeview/main.cpp +++ b/examples/tutorials/modelview/6_treeview/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/modelview/6_treeview/mainwindow.h b/examples/tutorials/modelview/6_treeview/mainwindow.h index 6398485cdaa..4e35a3ffc4e 100755 --- a/examples/tutorials/modelview/6_treeview/mainwindow.h +++ b/examples/tutorials/modelview/6_treeview/mainwindow.h @@ -41,7 +41,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include QT_BEGIN_NAMESPACE // QT_BEGIN_NAMESPACE / QT_END_NAMESPACE are not needed in Qt user code class QTreeView; //forward declarations diff --git a/examples/tutorials/modelview/7_selections/7_selections.pro b/examples/tutorials/modelview/7_selections/7_selections.pro index bbac7abc0a5..1b666d24849 100755 --- a/examples/tutorials/modelview/7_selections/7_selections.pro +++ b/examples/tutorials/modelview/7_selections/7_selections.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/7_selections INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/tutorials/modelview/7_selections/main.cpp b/examples/tutorials/modelview/7_selections/main.cpp index 75246f7dc7c..2a78dd09e99 100755 --- a/examples/tutorials/modelview/7_selections/main.cpp +++ b/examples/tutorials/modelview/7_selections/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" int main(int argc, char *argv[]) diff --git a/examples/tutorials/modelview/7_selections/mainwindow.h b/examples/tutorials/modelview/7_selections/mainwindow.h index 0a30dab0852..e78befbbc0c 100755 --- a/examples/tutorials/modelview/7_selections/mainwindow.h +++ b/examples/tutorials/modelview/7_selections/mainwindow.h @@ -41,7 +41,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include QT_BEGIN_NAMESPACE // QT_BEGIN_NAMESPACE / QT_END_NAMESPACE are not needed in Qt user code class QTreeView; //forward declarations diff --git a/examples/tutorials/modelview/modelview.pro b/examples/tutorials/modelview/modelview.pro index 3dc4bcc01b7..10ac8ae77f5 100755 --- a/examples/tutorials/modelview/modelview.pro +++ b/examples/tutorials/modelview/modelview.pro @@ -14,4 +14,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/tutorials/threads/clock/clock.pro b/examples/tutorials/threads/clock/clock.pro index 5c817b1473b..f59413346d0 100755 --- a/examples/tutorials/threads/clock/clock.pro +++ b/examples/tutorials/threads/clock/clock.pro @@ -12,3 +12,4 @@ INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets diff --git a/examples/tutorials/threads/clock/clockthread.cpp b/examples/tutorials/threads/clock/clockthread.cpp index 01d3f1f6978..f4721d8ed4d 100644 --- a/examples/tutorials/threads/clock/clockthread.cpp +++ b/examples/tutorials/threads/clock/clockthread.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "clockthread.h" //This class starts another thread where it emits a signal for every new second. diff --git a/examples/tutorials/threads/clock/main.cpp b/examples/tutorials/threads/clock/main.cpp index a0f86d6bc7a..99cbd4e693b 100755 --- a/examples/tutorials/threads/clock/main.cpp +++ b/examples/tutorials/threads/clock/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "clockthread.h" //A clock that does time formatting in another thread diff --git a/examples/tutorials/threads/movedobject/movedobject.pro b/examples/tutorials/threads/movedobject/movedobject.pro index e2aa2d1dbbd..f40ab0c012b 100755 --- a/examples/tutorials/threads/movedobject/movedobject.pro +++ b/examples/tutorials/threads/movedobject/movedobject.pro @@ -16,3 +16,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/threads/movedobject INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets diff --git a/examples/tutorials/threads/movedobject/thread.cpp b/examples/tutorials/threads/movedobject/thread.cpp index 6dfe8ff1595..d8a17eefe62 100644 --- a/examples/tutorials/threads/movedobject/thread.cpp +++ b/examples/tutorials/threads/movedobject/thread.cpp @@ -43,7 +43,7 @@ /* * QThread derived class with additional capability to move a QObject to the * new thread, to stop the thread and move the QObject back to the thread where - *it came from. + *it came from. */ Thread::Thread( QObject *parent) @@ -68,7 +68,6 @@ void Thread::launchWorker(QObject *worker) { worker = worker; start(); - int i=0; worker->moveToThread(this); shutDownHelper->moveToThread(this); connect(shutDownHelper, SIGNAL(mapped(int) ), this, SLOT(stopExecutor()), Qt::DirectConnection ); diff --git a/examples/tutorials/threads/threads.pro b/examples/tutorials/threads/threads.pro index d7375135673..64392f80884 100644 --- a/examples/tutorials/threads/threads.pro +++ b/examples/tutorials/threads/threads.pro @@ -6,3 +6,4 @@ SUBDIRS = hellothread \ clock \ movedobject +QT += widgets diff --git a/examples/tutorials/tutorials.pro b/examples/tutorials/tutorials.pro index cb57002082e..e9a5bdd1fa3 100644 --- a/examples/tutorials/tutorials.pro +++ b/examples/tutorials/tutorials.pro @@ -1,2 +1,3 @@ TEMPLATE = subdirs SUBDIRS += addressbook-fr threads addressbook widgets modelview gettingStarted +QT += widgets diff --git a/examples/tutorials/widgets/childwidget/childwidget.pro b/examples/tutorials/widgets/childwidget/childwidget.pro index d1260c74d21..4efc1432c2e 100644 --- a/examples/tutorials/widgets/childwidget/childwidget.pro +++ b/examples/tutorials/widgets/childwidget/childwidget.pro @@ -5,6 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/widgets/childwidget sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS childwidget.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/widgets/childwidget INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tutorials/widgets/childwidget/main.cpp b/examples/tutorials/widgets/childwidget/main.cpp index 15eda9f121d..01e8b3f5d63 100644 --- a/examples/tutorials/widgets/childwidget/main.cpp +++ b/examples/tutorials/widgets/childwidget/main.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ //! [main program] -#include +#include int main(int argc, char *argv[]) { diff --git a/examples/tutorials/widgets/nestedlayouts/main.cpp b/examples/tutorials/widgets/nestedlayouts/main.cpp index 40c63ab1fd1..6783b718a78 100644 --- a/examples/tutorials/widgets/nestedlayouts/main.cpp +++ b/examples/tutorials/widgets/nestedlayouts/main.cpp @@ -40,7 +40,7 @@ //! [main program] //! [first part] -#include +#include int main(int argc, char *argv[]) { diff --git a/examples/tutorials/widgets/nestedlayouts/nestedlayouts.pro b/examples/tutorials/widgets/nestedlayouts/nestedlayouts.pro index 32af4551d54..a5601552d9c 100644 --- a/examples/tutorials/widgets/nestedlayouts/nestedlayouts.pro +++ b/examples/tutorials/widgets/nestedlayouts/nestedlayouts.pro @@ -5,6 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/widgets/nestedlayouts sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS nestedlayouts.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/widgets/nestedlayouts INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tutorials/widgets/toplevel/main.cpp b/examples/tutorials/widgets/toplevel/main.cpp index f7baf0610e4..6b84037ab2d 100644 --- a/examples/tutorials/widgets/toplevel/main.cpp +++ b/examples/tutorials/widgets/toplevel/main.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ //! [main program] -#include +#include int main(int argc, char *argv[]) { diff --git a/examples/tutorials/widgets/toplevel/toplevel.pro b/examples/tutorials/widgets/toplevel/toplevel.pro index d4ea441cc91..a86d05b46cd 100644 --- a/examples/tutorials/widgets/toplevel/toplevel.pro +++ b/examples/tutorials/widgets/toplevel/toplevel.pro @@ -5,6 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/widgets/toplevel sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS toplevel.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/widgets/toplevel INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/tutorials/widgets/widgets.pro b/examples/tutorials/widgets/widgets.pro index c03d43d7c23..3a6e065ffce 100644 --- a/examples/tutorials/widgets/widgets.pro +++ b/examples/tutorials/widgets/widgets.pro @@ -6,3 +6,4 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/widgets sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS widgets.pro README sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/widgets INSTALLS += target sources +QT += widgets diff --git a/examples/tutorials/widgets/windowlayout/main.cpp b/examples/tutorials/widgets/windowlayout/main.cpp index ada9ae73803..bb5ed125b50 100644 --- a/examples/tutorials/widgets/windowlayout/main.cpp +++ b/examples/tutorials/widgets/windowlayout/main.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ //! [main program] -#include +#include int main(int argc, char *argv[]) { diff --git a/examples/tutorials/widgets/windowlayout/windowlayout.pro b/examples/tutorials/widgets/windowlayout/windowlayout.pro index b80f3940926..08613201dcc 100644 --- a/examples/tutorials/widgets/windowlayout/windowlayout.pro +++ b/examples/tutorials/widgets/windowlayout/windowlayout.pro @@ -5,6 +5,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/widgets/windowlayout sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS windowlayout.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/widgets/windowlayout INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/uitools/multipleinheritance/calculatorform.cpp b/examples/uitools/multipleinheritance/calculatorform.cpp index 2963db356a8..ae1312f5580 100644 --- a/examples/uitools/multipleinheritance/calculatorform.cpp +++ b/examples/uitools/multipleinheritance/calculatorform.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "calculatorform.h" diff --git a/examples/uitools/multipleinheritance/multipleinheritance.pro b/examples/uitools/multipleinheritance/multipleinheritance.pro index 4be470bf5f0..7e649674165 100644 --- a/examples/uitools/multipleinheritance/multipleinheritance.pro +++ b/examples/uitools/multipleinheritance/multipleinheritance.pro @@ -14,5 +14,6 @@ symbian { TARGET.UID3 = 0xA000D7C1 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/uitools/textfinder/textfinder.cpp b/examples/uitools/textfinder/textfinder.cpp index 0a69d5e2ddf..041c36f218a 100644 --- a/examples/uitools/textfinder/textfinder.cpp +++ b/examples/uitools/textfinder/textfinder.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ #include -#include +#include #include "textfinder.h" //! [0] diff --git a/examples/uitools/textfinder/textfinder.pro b/examples/uitools/textfinder/textfinder.pro index 73a9f5ea1ef..337b7216e4b 100644 --- a/examples/uitools/textfinder/textfinder.pro +++ b/examples/uitools/textfinder/textfinder.pro @@ -10,6 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/uitools/textfinder INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example does not work on Symbian platform) diff --git a/examples/uitools/uitools.pro b/examples/uitools/uitools.pro index 8a99f61855a..f17de666fbe 100644 --- a/examples/uitools/uitools.pro +++ b/examples/uitools/uitools.pro @@ -10,4 +10,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/uitools INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/webkit/webkit-guide/webkit-guide.pro b/examples/webkit/webkit-guide/webkit-guide.pro index b4291a5e015..6614b6d52c7 100644 --- a/examples/webkit/webkit-guide/webkit-guide.pro +++ b/examples/webkit/webkit-guide/webkit-guide.pro @@ -255,3 +255,4 @@ js/mob_condjs.js \ js/mobile.js \ js/storage.js \ +QT += widgets diff --git a/examples/widgets/analogclock/analogclock.cpp b/examples/widgets/analogclock/analogclock.cpp index 5368a2cbe11..606b962d4c9 100644 --- a/examples/widgets/analogclock/analogclock.cpp +++ b/examples/widgets/analogclock/analogclock.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "analogclock.h" diff --git a/examples/widgets/analogclock/analogclock.pro b/examples/widgets/analogclock/analogclock.pro index 3ba9de8a1f4..c8e1dc916df 100644 --- a/examples/widgets/analogclock/analogclock.pro +++ b/examples/widgets/analogclock/analogclock.pro @@ -12,5 +12,6 @@ symbian { TARGET.UID3 = 0xA000A64F CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/widgets/applicationicon/applicationicon.pro b/examples/widgets/applicationicon/applicationicon.pro index 17cc8b64009..dd4ace3993d 100644 --- a/examples/widgets/applicationicon/applicationicon.pro +++ b/examples/widgets/applicationicon/applicationicon.pro @@ -1,5 +1,5 @@ -QT += core gui +QT += core gui widgets TARGET = applicationicon TEMPLATE = app diff --git a/examples/widgets/applicationicon/main.cpp b/examples/widgets/applicationicon/main.cpp index 566284d82aa..24bc747d184 100644 --- a/examples/widgets/applicationicon/main.cpp +++ b/examples/widgets/applicationicon/main.cpp @@ -38,8 +38,8 @@ ** ****************************************************************************/ -#include -#include +#include +#include int main(int argc, char *argv[]) { diff --git a/examples/widgets/calculator/button.cpp b/examples/widgets/calculator/button.cpp index 7bd17838018..eaf60008935 100644 --- a/examples/widgets/calculator/button.cpp +++ b/examples/widgets/calculator/button.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "button.h" diff --git a/examples/widgets/calculator/calculator.cpp b/examples/widgets/calculator/calculator.cpp index 3fbdf03b9ab..acdb3199528 100644 --- a/examples/widgets/calculator/calculator.cpp +++ b/examples/widgets/calculator/calculator.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include diff --git a/examples/widgets/calculator/calculator.pro b/examples/widgets/calculator/calculator.pro index a23c757aabc..f1e110dfd20 100644 --- a/examples/widgets/calculator/calculator.pro +++ b/examples/widgets/calculator/calculator.pro @@ -14,5 +14,6 @@ symbian { TARGET.UID3 = 0xA000C602 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/widgets/calendarwidget/calendarwidget.pro b/examples/widgets/calendarwidget/calendarwidget.pro index 6a5b862d2d7..6e664cf3533 100644 --- a/examples/widgets/calendarwidget/calendarwidget.pro +++ b/examples/widgets/calendarwidget/calendarwidget.pro @@ -12,6 +12,7 @@ symbian { TARGET.UID3 = 0xA000C603 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/calendarwidget/main.cpp b/examples/widgets/calendarwidget/main.cpp index b14a44f7c6e..76565357ce1 100644 --- a/examples/widgets/calendarwidget/main.cpp +++ b/examples/widgets/calendarwidget/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/widgets/calendarwidget/window.cpp b/examples/widgets/calendarwidget/window.cpp index ad8e63c3ec3..4df7242efa8 100644 --- a/examples/widgets/calendarwidget/window.cpp +++ b/examples/widgets/calendarwidget/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/widgets/charactermap/charactermap.pro b/examples/widgets/charactermap/charactermap.pro index 20a54dd36d2..4baaac1b319 100644 --- a/examples/widgets/charactermap/charactermap.pro +++ b/examples/widgets/charactermap/charactermap.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/charactermap INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/charactermap/characterwidget.cpp b/examples/widgets/charactermap/characterwidget.cpp index 7d515f4f38b..7724421d3c8 100644 --- a/examples/widgets/charactermap/characterwidget.cpp +++ b/examples/widgets/charactermap/characterwidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "characterwidget.h" diff --git a/examples/widgets/charactermap/mainwindow.cpp b/examples/widgets/charactermap/mainwindow.cpp index bdff1274235..20c3bf407e1 100644 --- a/examples/widgets/charactermap/mainwindow.cpp +++ b/examples/widgets/charactermap/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "characterwidget.h" #include "mainwindow.h" diff --git a/examples/widgets/codeeditor/codeeditor.cpp b/examples/widgets/codeeditor/codeeditor.cpp index c7d1405a0e9..8676e48359c 100644 --- a/examples/widgets/codeeditor/codeeditor.cpp +++ b/examples/widgets/codeeditor/codeeditor.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "codeeditor.h" diff --git a/examples/widgets/codeeditor/codeeditor.pro b/examples/widgets/codeeditor/codeeditor.pro index 05f758a7372..caee3f7ca16 100644 --- a/examples/widgets/codeeditor/codeeditor.pro +++ b/examples/widgets/codeeditor/codeeditor.pro @@ -7,6 +7,7 @@ sources.files = $$SOURCES $$HEADERS *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/codeeditor INSTALLS += target sources +QT += widgets symbian: CONFIG += qt_example maemo5: CONFIG += qt_example diff --git a/examples/widgets/codeeditor/main.cpp b/examples/widgets/codeeditor/main.cpp index cd87ac9ec03..8a893244dff 100644 --- a/examples/widgets/codeeditor/main.cpp +++ b/examples/widgets/codeeditor/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "codeeditor.h" diff --git a/examples/widgets/digitalclock/digitalclock.cpp b/examples/widgets/digitalclock/digitalclock.cpp index 7d38ccd15f7..bbedf0f858a 100644 --- a/examples/widgets/digitalclock/digitalclock.cpp +++ b/examples/widgets/digitalclock/digitalclock.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "digitalclock.h" diff --git a/examples/widgets/digitalclock/digitalclock.pro b/examples/widgets/digitalclock/digitalclock.pro index 62346cde8be..9df216e8556 100644 --- a/examples/widgets/digitalclock/digitalclock.pro +++ b/examples/widgets/digitalclock/digitalclock.pro @@ -9,4 +9,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/digitalclock INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/widgets/elidedlabel/elidedlabel.h b/examples/widgets/elidedlabel/elidedlabel.h index bbf284bd519..29fe46fd4c4 100644 --- a/examples/widgets/elidedlabel/elidedlabel.h +++ b/examples/widgets/elidedlabel/elidedlabel.h @@ -41,11 +41,11 @@ #ifndef ELIDEDLABEL_H #define ELIDEDLABEL_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include //! [0] class ElidedLabel : public QFrame diff --git a/examples/widgets/elidedlabel/elidedlabel.pro b/examples/widgets/elidedlabel/elidedlabel.pro index 5b3be58398e..30c308cd7e5 100644 --- a/examples/widgets/elidedlabel/elidedlabel.pro +++ b/examples/widgets/elidedlabel/elidedlabel.pro @@ -1,6 +1,6 @@ # Nokia Qt Examples: elided label example -QT += core gui +QT += core gui widgets TARGET = elidedlabel TEMPLATE = app diff --git a/examples/widgets/elidedlabel/main.cpp b/examples/widgets/elidedlabel/main.cpp index 512ac464305..ee24d39a5a7 100644 --- a/examples/widgets/elidedlabel/main.cpp +++ b/examples/widgets/elidedlabel/main.cpp @@ -40,7 +40,7 @@ #include "testwidget.h" -#include +#include //! [0] int main( int argc, char *argv[] ) diff --git a/examples/widgets/elidedlabel/testwidget.cpp b/examples/widgets/elidedlabel/testwidget.cpp index 79a47f043e5..a915de1875e 100644 --- a/examples/widgets/elidedlabel/testwidget.cpp +++ b/examples/widgets/elidedlabel/testwidget.cpp @@ -41,10 +41,10 @@ #include "testwidget.h" #include "elidedlabel.h" -#include -#include -#include -#include +#include +#include +#include +#include //! [0] TestWidget::TestWidget(QWidget *parent): diff --git a/examples/widgets/elidedlabel/testwidget.h b/examples/widgets/elidedlabel/testwidget.h index 6c43a87edcf..31c5f566cca 100644 --- a/examples/widgets/elidedlabel/testwidget.h +++ b/examples/widgets/elidedlabel/testwidget.h @@ -41,10 +41,10 @@ #ifndef TESTWIDGET_H #define TESTWIDGET_H -#include -#include -#include -#include +#include +#include +#include +#include class ElidedLabel; diff --git a/examples/widgets/groupbox/groupbox.pro b/examples/widgets/groupbox/groupbox.pro index 92f9d461af5..361c037d243 100644 --- a/examples/widgets/groupbox/groupbox.pro +++ b/examples/widgets/groupbox/groupbox.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/groupbox INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/groupbox/window.cpp b/examples/widgets/groupbox/window.cpp index 89531df9fd2..82c042e40e5 100644 --- a/examples/widgets/groupbox/window.cpp +++ b/examples/widgets/groupbox/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/widgets/icons/iconpreviewarea.cpp b/examples/widgets/icons/iconpreviewarea.cpp index 3f3de3d1359..8ff82fcbfb4 100644 --- a/examples/widgets/icons/iconpreviewarea.cpp +++ b/examples/widgets/icons/iconpreviewarea.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "iconpreviewarea.h" diff --git a/examples/widgets/icons/icons.pro b/examples/widgets/icons/icons.pro index 7c0163d36db..17c09f354f3 100644 --- a/examples/widgets/icons/icons.pro +++ b/examples/widgets/icons/icons.pro @@ -25,6 +25,7 @@ wince*: { } DEPLOYMENT += imageFiles } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/icons/iconsizespinbox.cpp b/examples/widgets/icons/iconsizespinbox.cpp index fd3722af8f1..3c6061a1f4f 100644 --- a/examples/widgets/icons/iconsizespinbox.cpp +++ b/examples/widgets/icons/iconsizespinbox.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "iconsizespinbox.h" diff --git a/examples/widgets/icons/imagedelegate.cpp b/examples/widgets/icons/imagedelegate.cpp index 93018eb49b6..20747eac1e5 100644 --- a/examples/widgets/icons/imagedelegate.cpp +++ b/examples/widgets/icons/imagedelegate.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "imagedelegate.h" diff --git a/examples/widgets/icons/mainwindow.cpp b/examples/widgets/icons/mainwindow.cpp index 6dda3c16db9..91ce27646d1 100644 --- a/examples/widgets/icons/mainwindow.cpp +++ b/examples/widgets/icons/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "iconpreviewarea.h" #include "iconsizespinbox.h" diff --git a/examples/widgets/imageviewer/imageviewer.cpp b/examples/widgets/imageviewer/imageviewer.cpp index 8a8aaf9e963..edee9ce00bf 100644 --- a/examples/widgets/imageviewer/imageviewer.cpp +++ b/examples/widgets/imageviewer/imageviewer.cpp @@ -38,7 +38,8 @@ ** ****************************************************************************/ -#include +#include +#include #include "imageviewer.h" diff --git a/examples/widgets/imageviewer/imageviewer.pro b/examples/widgets/imageviewer/imageviewer.pro index df9d1fedbb5..939d60a2085 100644 --- a/examples/widgets/imageviewer/imageviewer.pro +++ b/examples/widgets/imageviewer/imageviewer.pro @@ -16,6 +16,7 @@ symbian: TARGET = imageviewerexample wince*: { DEPLOYMENT_PLUGIN += qjpeg qmng qgif } +QT += widgets printsupport maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/lineedits/lineedits.pro b/examples/widgets/lineedits/lineedits.pro index 146a2abfc73..484ffde462a 100644 --- a/examples/widgets/lineedits/lineedits.pro +++ b/examples/widgets/lineedits/lineedits.pro @@ -12,6 +12,7 @@ symbian { TARGET.UID3 = 0xA000C604 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/lineedits/window.cpp b/examples/widgets/lineedits/window.cpp index 427b6f5f5de..ff6c0a3d8e5 100644 --- a/examples/widgets/lineedits/window.cpp +++ b/examples/widgets/lineedits/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/widgets/movie/movie.pro b/examples/widgets/movie/movie.pro index 468c82fb692..5657efa3c1e 100644 --- a/examples/widgets/movie/movie.pro +++ b/examples/widgets/movie/movie.pro @@ -17,6 +17,7 @@ wince*: { DEPLOYMENT_PLUGIN += qmng } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/movie/movieplayer.cpp b/examples/widgets/movie/movieplayer.cpp index f4d22797296..e12d49763d4 100644 --- a/examples/widgets/movie/movieplayer.cpp +++ b/examples/widgets/movie/movieplayer.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "movieplayer.h" diff --git a/examples/widgets/orientation/main.cpp b/examples/widgets/orientation/main.cpp index 17e0da0066d..29e161d3527 100644 --- a/examples/widgets/orientation/main.cpp +++ b/examples/widgets/orientation/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" //! [0] diff --git a/examples/widgets/orientation/orientation.pro b/examples/widgets/orientation/orientation.pro index af1ea8d770e..91560a3b38b 100644 --- a/examples/widgets/orientation/orientation.pro +++ b/examples/widgets/orientation/orientation.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui +QT += core gui widgets TARGET = orientation TEMPLATE = app diff --git a/examples/widgets/scribble/mainwindow.cpp b/examples/widgets/scribble/mainwindow.cpp index a45bf079288..fb9d42ab31a 100644 --- a/examples/widgets/scribble/mainwindow.cpp +++ b/examples/widgets/scribble/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "scribblearea.h" diff --git a/examples/widgets/scribble/scribble.pro b/examples/widgets/scribble/scribble.pro index 6532e06e288..ef11636efdd 100644 --- a/examples/widgets/scribble/scribble.pro +++ b/examples/widgets/scribble/scribble.pro @@ -11,4 +11,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/scribble INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets printsupport maemo5: CONFIG += qt_example diff --git a/examples/widgets/scribble/scribblearea.cpp b/examples/widgets/scribble/scribblearea.cpp index 5854e34f423..7e76d16eda9 100644 --- a/examples/widgets/scribble/scribblearea.cpp +++ b/examples/widgets/scribble/scribblearea.cpp @@ -38,7 +38,9 @@ ** ****************************************************************************/ -#include +#include +#include +#include #include "scribblearea.h" diff --git a/examples/widgets/shapedclock/shapedclock.cpp b/examples/widgets/shapedclock/shapedclock.cpp index 71c27bff149..77cf6852592 100644 --- a/examples/widgets/shapedclock/shapedclock.cpp +++ b/examples/widgets/shapedclock/shapedclock.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "shapedclock.h" diff --git a/examples/widgets/shapedclock/shapedclock.pro b/examples/widgets/shapedclock/shapedclock.pro index b49dc957590..d7ab454ac72 100644 --- a/examples/widgets/shapedclock/shapedclock.pro +++ b/examples/widgets/shapedclock/shapedclock.pro @@ -12,6 +12,7 @@ symbian { TARGET.UID3 = 0xA000C605 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/sliders/sliders.pro b/examples/widgets/sliders/sliders.pro index 1ef719057b4..7361ba1ed39 100644 --- a/examples/widgets/sliders/sliders.pro +++ b/examples/widgets/sliders/sliders.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/sliders INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/sliders/slidersgroup.cpp b/examples/widgets/sliders/slidersgroup.cpp index 4ead1cc226d..bf05cc1d876 100644 --- a/examples/widgets/sliders/slidersgroup.cpp +++ b/examples/widgets/sliders/slidersgroup.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "slidersgroup.h" diff --git a/examples/widgets/sliders/window.cpp b/examples/widgets/sliders/window.cpp index 9286910a19d..541279a84d1 100644 --- a/examples/widgets/sliders/window.cpp +++ b/examples/widgets/sliders/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "slidersgroup.h" #include "window.h" diff --git a/examples/widgets/softkeys/main.cpp b/examples/widgets/softkeys/main.cpp index 5678eb37edc..c23a3685d90 100644 --- a/examples/widgets/softkeys/main.cpp +++ b/examples/widgets/softkeys/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "softkeys.h" int main(int argc, char *argv[]) diff --git a/examples/widgets/softkeys/softkeys.h b/examples/widgets/softkeys/softkeys.h index 5427e1020f3..6e2b2665ea2 100644 --- a/examples/widgets/softkeys/softkeys.h +++ b/examples/widgets/softkeys/softkeys.h @@ -41,7 +41,7 @@ #ifndef SOFTKEYS_H #define SOFTKEYS_H -#include +#include class MainWindow : public QMainWindow { diff --git a/examples/widgets/softkeys/softkeys.pro b/examples/widgets/softkeys/softkeys.pro index 4bbbc0477fb..e0be830b4d5 100644 --- a/examples/widgets/softkeys/softkeys.pro +++ b/examples/widgets/softkeys/softkeys.pro @@ -13,5 +13,6 @@ symbian { TARGET.UID3 = 0xA000CF6B CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/widgets/spinboxes/spinboxes.pro b/examples/widgets/spinboxes/spinboxes.pro index 5aa3ed5dd18..11d5aa1d41e 100644 --- a/examples/widgets/spinboxes/spinboxes.pro +++ b/examples/widgets/spinboxes/spinboxes.pro @@ -9,6 +9,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/spinboxes INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/spinboxes/window.cpp b/examples/widgets/spinboxes/window.cpp index 095ff5cf792..9a3eb02e959 100644 --- a/examples/widgets/spinboxes/window.cpp +++ b/examples/widgets/spinboxes/window.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "window.h" diff --git a/examples/widgets/styles/norwegianwoodstyle.cpp b/examples/widgets/styles/norwegianwoodstyle.cpp index 9fd0fed0412..637b9a3705a 100644 --- a/examples/widgets/styles/norwegianwoodstyle.cpp +++ b/examples/widgets/styles/norwegianwoodstyle.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "norwegianwoodstyle.h" diff --git a/examples/widgets/styles/styles.pro b/examples/widgets/styles/styles.pro index 7efa0113a15..a3d0e92ee83 100644 --- a/examples/widgets/styles/styles.pro +++ b/examples/widgets/styles/styles.pro @@ -14,6 +14,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/styles INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/styles/widgetgallery.cpp b/examples/widgets/styles/widgetgallery.cpp index 28671598956..82b7e372961 100644 --- a/examples/widgets/styles/widgetgallery.cpp +++ b/examples/widgets/styles/widgetgallery.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "norwegianwoodstyle.h" #include "widgetgallery.h" diff --git a/examples/widgets/stylesheet/main.cpp b/examples/widgets/stylesheet/main.cpp index 3c2aaa280ff..6259969f2d9 100644 --- a/examples/widgets/stylesheet/main.cpp +++ b/examples/widgets/stylesheet/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" diff --git a/examples/widgets/stylesheet/mainwindow.cpp b/examples/widgets/stylesheet/mainwindow.cpp index b7491e26428..221fbcc7650 100644 --- a/examples/widgets/stylesheet/mainwindow.cpp +++ b/examples/widgets/stylesheet/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "stylesheeteditor.h" diff --git a/examples/widgets/stylesheet/mainwindow.h b/examples/widgets/stylesheet/mainwindow.h index ca590ace4ae..7430039594c 100644 --- a/examples/widgets/stylesheet/mainwindow.h +++ b/examples/widgets/stylesheet/mainwindow.h @@ -41,7 +41,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include +#include #include "ui_mainwindow.h" diff --git a/examples/widgets/stylesheet/stylesheet.pro b/examples/widgets/stylesheet/stylesheet.pro index eec7d1a4cef..7d699a654f8 100644 --- a/examples/widgets/stylesheet/stylesheet.pro +++ b/examples/widgets/stylesheet/stylesheet.pro @@ -14,6 +14,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/stylesheet INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/stylesheet/stylesheeteditor.cpp b/examples/widgets/stylesheet/stylesheeteditor.cpp index c1d43ea99b3..36d217cbb40 100644 --- a/examples/widgets/stylesheet/stylesheeteditor.cpp +++ b/examples/widgets/stylesheet/stylesheeteditor.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "stylesheeteditor.h" diff --git a/examples/widgets/tablet/main.cpp b/examples/widgets/tablet/main.cpp index 1e045c81089..a7a054a6662 100644 --- a/examples/widgets/tablet/main.cpp +++ b/examples/widgets/tablet/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "tabletapplication.h" diff --git a/examples/widgets/tablet/mainwindow.cpp b/examples/widgets/tablet/mainwindow.cpp index 8ae34313548..ac2825bcd20 100644 --- a/examples/widgets/tablet/mainwindow.cpp +++ b/examples/widgets/tablet/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "tabletcanvas.h" diff --git a/examples/widgets/tablet/tablet.pro b/examples/widgets/tablet/tablet.pro index 330a50aa4cd..4788fad2c71 100644 --- a/examples/widgets/tablet/tablet.pro +++ b/examples/widgets/tablet/tablet.pro @@ -13,6 +13,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/tablet INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/tablet/tabletapplication.cpp b/examples/widgets/tablet/tabletapplication.cpp index 7f60136b129..2830ef80abd 100644 --- a/examples/widgets/tablet/tabletapplication.cpp +++ b/examples/widgets/tablet/tabletapplication.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "tabletapplication.h" diff --git a/examples/widgets/tablet/tabletcanvas.cpp b/examples/widgets/tablet/tabletcanvas.cpp index 88a582de237..72f13b42ba7 100644 --- a/examples/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/tablet/tabletcanvas.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include #include "tabletcanvas.h" diff --git a/examples/widgets/tetrix/main.cpp b/examples/widgets/tetrix/main.cpp index 622aee9845e..b10764387a8 100644 --- a/examples/widgets/tetrix/main.cpp +++ b/examples/widgets/tetrix/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include diff --git a/examples/widgets/tetrix/tetrix.pro b/examples/widgets/tetrix/tetrix.pro index 559689f2f49..d9fff26fef9 100644 --- a/examples/widgets/tetrix/tetrix.pro +++ b/examples/widgets/tetrix/tetrix.pro @@ -16,5 +16,6 @@ symbian { TARGET.UID3 = 0xA000C606 CONFIG += qt_example } +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/widgets/tetrix/tetrixboard.cpp b/examples/widgets/tetrix/tetrixboard.cpp index 1bb91ee3d70..efdd11f5d89 100644 --- a/examples/widgets/tetrix/tetrixboard.cpp +++ b/examples/widgets/tetrix/tetrixboard.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "tetrixboard.h" diff --git a/examples/widgets/tetrix/tetrixwindow.cpp b/examples/widgets/tetrix/tetrixwindow.cpp index fccb4beff12..e637392521a 100644 --- a/examples/widgets/tetrix/tetrixwindow.cpp +++ b/examples/widgets/tetrix/tetrixwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "tetrixboard.h" #include "tetrixwindow.h" diff --git a/examples/widgets/tooltips/main.cpp b/examples/widgets/tooltips/main.cpp index 2e17f235c6c..5fba6cc1d64 100644 --- a/examples/widgets/tooltips/main.cpp +++ b/examples/widgets/tooltips/main.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "sortingbox.h" diff --git a/examples/widgets/tooltips/shapeitem.cpp b/examples/widgets/tooltips/shapeitem.cpp index 03b49be0ede..65dbfd16ebd 100644 --- a/examples/widgets/tooltips/shapeitem.cpp +++ b/examples/widgets/tooltips/shapeitem.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "shapeitem.h" diff --git a/examples/widgets/tooltips/sortingbox.cpp b/examples/widgets/tooltips/sortingbox.cpp index 083990c1657..f5b45f1d7da 100644 --- a/examples/widgets/tooltips/sortingbox.cpp +++ b/examples/widgets/tooltips/sortingbox.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include diff --git a/examples/widgets/tooltips/tooltips.pro b/examples/widgets/tooltips/tooltips.pro index 823fa0e938b..d19c1d9bc17 100644 --- a/examples/widgets/tooltips/tooltips.pro +++ b/examples/widgets/tooltips/tooltips.pro @@ -12,4 +12,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/tooltips INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/widgets/validators/validators.pro b/examples/widgets/validators/validators.pro index 2713b7d668e..406a5f442a7 100644 --- a/examples/widgets/validators/validators.pro +++ b/examples/widgets/validators/validators.pro @@ -21,6 +21,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/validators INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/widgets/widgets.pro b/examples/widgets/widgets.pro index b7a92d18303..232657eabef 100644 --- a/examples/widgets/widgets.pro +++ b/examples/widgets/widgets.pro @@ -47,4 +47,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/widgets/wiggly/dialog.cpp b/examples/widgets/wiggly/dialog.cpp index a5b376143c3..d2053d84ac0 100644 --- a/examples/widgets/wiggly/dialog.cpp +++ b/examples/widgets/wiggly/dialog.cpp @@ -38,7 +38,8 @@ ** ****************************************************************************/ -#include +#include +#include #include "dialog.h" #include "wigglywidget.h" diff --git a/examples/widgets/wiggly/wiggly.pro b/examples/widgets/wiggly/wiggly.pro index 5e885dd1eb8..8a1bec3100c 100644 --- a/examples/widgets/wiggly/wiggly.pro +++ b/examples/widgets/wiggly/wiggly.pro @@ -1,3 +1,5 @@ +QT += widgets widgets + HEADERS = wigglywidget.h \ dialog.h SOURCES = wigglywidget.cpp \ diff --git a/examples/widgets/wiggly/wigglywidget.cpp b/examples/widgets/wiggly/wigglywidget.cpp index 56a026ade72..b55efaa1fad 100644 --- a/examples/widgets/wiggly/wigglywidget.cpp +++ b/examples/widgets/wiggly/wigglywidget.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "wigglywidget.h" diff --git a/examples/widgets/windowflags/controllerwindow.cpp b/examples/widgets/windowflags/controllerwindow.cpp index c52e2b27c30..b2b929842f4 100644 --- a/examples/widgets/windowflags/controllerwindow.cpp +++ b/examples/widgets/windowflags/controllerwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "controllerwindow.h" diff --git a/examples/widgets/windowflags/previewwindow.cpp b/examples/widgets/windowflags/previewwindow.cpp index 5847af1c637..1cd74619e76 100644 --- a/examples/widgets/windowflags/previewwindow.cpp +++ b/examples/widgets/windowflags/previewwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "previewwindow.h" diff --git a/examples/widgets/windowflags/windowflags.pro b/examples/widgets/windowflags/windowflags.pro index 892bbd79321..9a781cdce32 100644 --- a/examples/widgets/windowflags/windowflags.pro +++ b/examples/widgets/windowflags/windowflags.pro @@ -11,6 +11,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/windowflags INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example symbian: warning(This example might not fully work on Symbian platform) diff --git a/examples/xml/dombookmarks/dombookmarks.pro b/examples/xml/dombookmarks/dombookmarks.pro index 07a8f822520..21eb5c071fd 100644 --- a/examples/xml/dombookmarks/dombookmarks.pro +++ b/examples/xml/dombookmarks/dombookmarks.pro @@ -3,7 +3,7 @@ HEADERS = mainwindow.h \ SOURCES = main.cpp \ mainwindow.cpp \ xbeltree.cpp -QT += xml +QT += xml widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/xml/dombookmarks diff --git a/examples/xml/dombookmarks/mainwindow.cpp b/examples/xml/dombookmarks/mainwindow.cpp index 0a3a3f9c3b5..0c8568332e8 100644 --- a/examples/xml/dombookmarks/mainwindow.cpp +++ b/examples/xml/dombookmarks/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "xbeltree.h" diff --git a/examples/xml/dombookmarks/xbeltree.cpp b/examples/xml/dombookmarks/xbeltree.cpp index 2a072b2d543..67c85aca409 100644 --- a/examples/xml/dombookmarks/xbeltree.cpp +++ b/examples/xml/dombookmarks/xbeltree.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "xbeltree.h" diff --git a/examples/xml/rsslisting/main.cpp b/examples/xml/rsslisting/main.cpp index 78abb92e8d6..7d2b4ca10f6 100644 --- a/examples/xml/rsslisting/main.cpp +++ b/examples/xml/rsslisting/main.cpp @@ -44,7 +44,7 @@ main.cpp Provides the main function for the RSS news reader example. */ -#include +#include #include "rsslisting.h" diff --git a/examples/xml/rsslisting/rsslisting.cpp b/examples/xml/rsslisting/rsslisting.cpp index ffc6d1a6c7c..ba9ff28072c 100644 --- a/examples/xml/rsslisting/rsslisting.cpp +++ b/examples/xml/rsslisting/rsslisting.cpp @@ -55,7 +55,7 @@ its operation, and also allows very large data sources to be read. #include -#include +#include #include #include "rsslisting.h" diff --git a/examples/xml/rsslisting/rsslisting.pro b/examples/xml/rsslisting/rsslisting.pro index 413fdf651e4..551be70db7d 100644 --- a/examples/xml/rsslisting/rsslisting.pro +++ b/examples/xml/rsslisting/rsslisting.pro @@ -1,6 +1,6 @@ HEADERS += rsslisting.h SOURCES += main.cpp rsslisting.cpp -QT += network xml +QT += network xml widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/xml/rsslisting diff --git a/examples/xml/saxbookmarks/mainwindow.cpp b/examples/xml/saxbookmarks/mainwindow.cpp index e5300121e5d..93aae7f9065 100644 --- a/examples/xml/saxbookmarks/mainwindow.cpp +++ b/examples/xml/saxbookmarks/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "xbelgenerator.h" diff --git a/examples/xml/saxbookmarks/saxbookmarks.pro b/examples/xml/saxbookmarks/saxbookmarks.pro index 600b66bca08..22d96f5b96a 100644 --- a/examples/xml/saxbookmarks/saxbookmarks.pro +++ b/examples/xml/saxbookmarks/saxbookmarks.pro @@ -5,7 +5,7 @@ SOURCES = main.cpp \ mainwindow.cpp \ xbelgenerator.cpp \ xbelhandler.cpp -QT += xml +QT += xml widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/xml/saxbookmarks diff --git a/examples/xml/saxbookmarks/xbelgenerator.cpp b/examples/xml/saxbookmarks/xbelgenerator.cpp index a0bfe67f69a..7712d83d10d 100644 --- a/examples/xml/saxbookmarks/xbelgenerator.cpp +++ b/examples/xml/saxbookmarks/xbelgenerator.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "xbelgenerator.h" diff --git a/examples/xml/saxbookmarks/xbelhandler.cpp b/examples/xml/saxbookmarks/xbelhandler.cpp index 09874c9edcb..da65c2bf882 100644 --- a/examples/xml/saxbookmarks/xbelhandler.cpp +++ b/examples/xml/saxbookmarks/xbelhandler.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "xbelhandler.h" diff --git a/examples/xml/streambookmarks/mainwindow.cpp b/examples/xml/streambookmarks/mainwindow.cpp index ac839fe9a0d..780b2b82d10 100644 --- a/examples/xml/streambookmarks/mainwindow.cpp +++ b/examples/xml/streambookmarks/mainwindow.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "mainwindow.h" #include "xbelreader.h" diff --git a/examples/xml/streambookmarks/streambookmarks.pro b/examples/xml/streambookmarks/streambookmarks.pro index 9ccbb619be8..de9b1ab5a1a 100644 --- a/examples/xml/streambookmarks/streambookmarks.pro +++ b/examples/xml/streambookmarks/streambookmarks.pro @@ -5,7 +5,7 @@ SOURCES = main.cpp \ mainwindow.cpp \ xbelreader.cpp \ xbelwriter.cpp -QT += xml +QT += xml widgets # install target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/xml/streambookmarks diff --git a/examples/xml/streambookmarks/xbelreader.cpp b/examples/xml/streambookmarks/xbelreader.cpp index e6d1c64e643..063243528b0 100644 --- a/examples/xml/streambookmarks/xbelreader.cpp +++ b/examples/xml/streambookmarks/xbelreader.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "xbelreader.h" diff --git a/examples/xml/streambookmarks/xbelwriter.cpp b/examples/xml/streambookmarks/xbelwriter.cpp index bd5454c9419..aa100d401e5 100644 --- a/examples/xml/streambookmarks/xbelwriter.cpp +++ b/examples/xml/streambookmarks/xbelwriter.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "xbelwriter.h" diff --git a/examples/xml/xml.pro b/examples/xml/xml.pro index 485e08f8091..3c93131aad3 100644 --- a/examples/xml/xml.pro +++ b/examples/xml/xml.pro @@ -18,4 +18,5 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/xml INSTALLS += target sources symbian: CONFIG += qt_example +QT += widgets maemo5: CONFIG += qt_example diff --git a/examples/xml/xmlstreamlint/xmlstreamlint.pro b/examples/xml/xmlstreamlint/xmlstreamlint.pro index dcc81974416..32e95c5ce51 100644 --- a/examples/xml/xmlstreamlint/xmlstreamlint.pro +++ b/examples/xml/xmlstreamlint/xmlstreamlint.pro @@ -1,6 +1,6 @@ CONFIG += console QT -= gui -QT += xml +QT += xml widgets SOURCES += main.cpp # install diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf index 96cd2399b3c..b22b8520138 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -38,7 +38,6 @@ QMAKE_DEL_FILE = rm -f QMAKE_DEL_DIR = rmdir QMAKE_CHK_DIR_EXISTS = test -d QMAKE_MKDIR = mkdir -p -QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 # overridden to 10.5 for Cocoa on the compiler command line include(unix.conf) diff --git a/mkspecs/common/mac/qplatformdefs.h b/mkspecs/common/mac/qplatformdefs.h index 4a70d99444c..98bb014aede 100644 --- a/mkspecs/common/mac/qplatformdefs.h +++ b/mkspecs/common/mac/qplatformdefs.h @@ -42,6 +42,8 @@ #ifndef QPLATFORMDEFS_H #define QPLATFORMDEFS_H +#define QT_QPA_DEFAULT_PLATFORM_NAME "cocoa" + // Get Qt defines/settings #include "qglobal.h" diff --git a/mkspecs/features/qpa/basicunixfontdatabase.prf b/mkspecs/features/qpa/basicunixfontdatabase.prf new file mode 100644 index 00000000000..65490e03a8a --- /dev/null +++ b/mkspecs/features/qpa/basicunixfontdatabase.prf @@ -0,0 +1,5 @@ +DEFINES += QT_COMPILES_IN_HARFBUZZ + +contains(QT_CONFIG, system-freetype) { + LIBS += -lfreetype +} diff --git a/mkspecs/features/qpa/genericunixfontdatabase.prf b/mkspecs/features/qpa/genericunixfontdatabase.prf new file mode 100644 index 00000000000..20b31a7e67d --- /dev/null +++ b/mkspecs/features/qpa/genericunixfontdatabase.prf @@ -0,0 +1,5 @@ +CONFIG += qpa/basicunixfontdatabase +contains(QT_CONFIG, fontconfig) { + DEFINES += Q_FONTCONFIGDATABASE + LIBS += -lfontconfig +} diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 13dadeb1e92..cb04f941205 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -115,29 +115,20 @@ defineTest(qtAddModule) { unset(LINKAGE) mac { - CONFIG(qt_framework, qt_framework|qt_no_framework) { #forced - QMAKE_FRAMEWORKPATH *= $${MODULE_LIBS} - FRAMEWORK_INCLUDE = $$MODULE_INCLUDES.framework/Headers - !qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) { - INCLUDEPATH -= $$FRAMEWORK_INCLUDE - INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH - } - LINKAGE = -framework $${MODULE_NAME}$${QT_LIBINFIX} - } else:!qt_no_framework { #detection - for(frmwrk_dir, $$list($$MODULE_LIBS $$QMAKE_LIBDIR $$(DYLD_FRAMEWORK_PATH) /Library/Frameworks)) { - exists($${frmwrk_dir}/$${MODULE_NAME}.framework) { + for(frmwrk_dir, $$list($$MODULE_LIBS $$QMAKE_LIBDIR $$(DYLD_FRAMEWORK_PATH) /Library/Frameworks)) { + exists($${frmwrk_dir}/$${MODULE_NAME}.framework) { QMAKE_FRAMEWORKPATH *= $${frmwrk_dir} FRAMEWORK_INCLUDE = $$frmwrk_dir/$${MODULE_NAME}.framework/Headers !qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) { - INCLUDEPATH -= $$FRAMEWORK_INCLUDE - INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH + INCLUDEPATH -= $$FRAMEWORK_INCLUDE + INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH } LINKAGE = -framework $${MODULE_NAME} break() - } - } - } + } + } } + isEmpty(LINKAGE) { # Make sure we can link to uninstalled libraries !isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) { diff --git a/mkspecs/qws/freebsd-generic-g++/qmake.conf b/mkspecs/qws/freebsd-generic-g++/qmake.conf deleted file mode 100644 index d50ce6b7b64..00000000000 --- a/mkspecs/qws/freebsd-generic-g++/qmake.conf +++ /dev/null @@ -1,85 +0,0 @@ -# -# qmake configuration for freebsd-g++ with Qtopia Core -# - -MAKEFILE_GENERATOR = UNIX -TARGET_PLATFORM = unix -TEMPLATE = app -CONFIG += qt warn_on release -QT += core gui network -QMAKE_INCREMENTAL_STYLE = sublib - -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -pipe -QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -Wall -W -QMAKE_CFLAGS_WARN_OFF = -w -QMAKE_CFLAGS_RELEASE = -O2 -fno-default-inline -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -fPIC -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE -QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden - -QMAKE_CXX = g++ -QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_LINUXFB -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_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 - -# Addon software goes into /usr/local on the BSDs, by default we will look there -QMAKE_INCDIR = /usr/local/include -QMAKE_LIBDIR = /usr/local/lib -QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] -QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] -QMAKE_INCDIR_QTOPIA = $(QPEDIR)/include -QMAKE_LIBDIR_QTOPIA = $(QPEDIR)/lib - -QMAKE_LINK = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LINK_C = gcc -QMAKE_LINK_C_SHLIB = gcc -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,-soname, -QMAKE_LFLAGS_THREAD = -pthread -QMAKE_LFLAGS_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -QMAKE_LIBS_QT = -lqte -QMAKE_LIBS_QT_THREAD = -lqte-mt -QMAKE_LIBS_THREAD = -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_QTOPIA = -lqpe -lqtopia - -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - -QMAKE_AR = ar cqs -QMAKE_OBJCOPY = objcopy -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 -include(../../common/unix.conf) -load(qt_config) diff --git a/mkspecs/qws/freebsd-generic-g++/qplatformdefs.h b/mkspecs/qws/freebsd-generic-g++/qplatformdefs.h deleted file mode 100644 index 5e377179144..00000000000 --- a/mkspecs/qws/freebsd-generic-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../freebsd-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-arm-g++/qmake.conf b/mkspecs/qws/linux-arm-g++/qmake.conf deleted file mode 100644 index 7b378133ac3..00000000000 --- a/mkspecs/qws/linux-arm-g++/qmake.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -# qmake configuration for building with arm-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = arm-linux-gcc -QMAKE_CXX = arm-linux-g++ -QMAKE_LINK = arm-linux-g++ -QMAKE_LINK_SHLIB = arm-linux-g++ - -# modifications to linux.conf -QMAKE_AR = arm-linux-ar cqs -QMAKE_OBJCOPY = arm-linux-objcopy -QMAKE_STRIP = arm-linux-strip - -load(qt_config) diff --git a/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf b/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf deleted file mode 100644 index e1ad837361d..00000000000 --- a/mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -# qmake configuration for building with arm-none-linux-gnueabi-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = arm-none-linux-gnueabi-gcc -QMAKE_CXX = arm-none-linux-gnueabi-g++ -QMAKE_LINK = arm-none-linux-gnueabi-g++ -QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++ - -# modifications to linux.conf -QMAKE_AR = arm-none-linux-gnueabi-ar cqs -QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy -QMAKE_STRIP = arm-none-linux-gnueabi-strip - -load(qt_config) diff --git a/mkspecs/qws/linux-arm-gnueabi-g++/qplatformdefs.h b/mkspecs/qws/linux-arm-gnueabi-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-arm-gnueabi-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-armv6-g++/qmake.conf b/mkspecs/qws/linux-armv6-g++/qmake.conf deleted file mode 100644 index 0e2473c26ce..00000000000 --- a/mkspecs/qws/linux-armv6-g++/qmake.conf +++ /dev/null @@ -1,23 +0,0 @@ -# -# qmake configuration for building for ARMv6 devices with arm-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = arm-linux-gcc -QMAKE_CXX = arm-linux-g++ -QMAKE_LINK = arm-linux-g++ -QMAKE_LINK_SHLIB = arm-linux-g++ -QMAKE_CFLAGS += -march=armv6 -QMAKE_CXXFLAGS += -march=armv6 - -# modifications to linux.conf -QMAKE_AR = arm-linux-ar cqs -QMAKE_OBJCOPY = arm-linux-objcopy -QMAKE_STRIP = arm-linux-strip - -load(qt_config) diff --git a/mkspecs/qws/linux-avr32-g++/qmake.conf b/mkspecs/qws/linux-avr32-g++/qmake.conf deleted file mode 100644 index 32c0444de81..00000000000 --- a/mkspecs/qws/linux-avr32-g++/qmake.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -# qmake configuration for building with avr32-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = avr32-linux-gcc -QMAKE_CXX = avr32-linux-g++ -QMAKE_LINK = avr32-linux-g++ -QMAKE_LINK_SHLIB = avr32-linux-g++ - -# modifications to linux.conf -QMAKE_AR = avr32-linux-ar cqs -QMAKE_OBJCOPY = avr32-linux-objcopy -QMAKE_STRIP = avr32-linux-strip - -load(qt_config) diff --git a/mkspecs/qws/linux-avr32-g++/qplatformdefs.h b/mkspecs/qws/linux-avr32-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-avr32-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-cellon-g++/qmake.conf b/mkspecs/qws/linux-cellon-g++/qmake.conf deleted file mode 100644 index ad66c3c342a..00000000000 --- a/mkspecs/qws/linux-cellon-g++/qmake.conf +++ /dev/null @@ -1,30 +0,0 @@ -# -# qmake configuration for linux-g++ using the arm-linux-g++ crosscompiler -# - -# -# qmake configuration for building with arm-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = arm-linux-gcc -QMAKE_CXX = arm-linux-g++ -QMAKE_LINK = arm-linux-g++ -QMAKE_LINK_SHLIB = arm-linux-g++ -QMAKE_CFLAGS = $$QMAKE_CFLAGS -DQT_QWS_CELLON -DQWS -QMAKE_CXXFLAGS = $$QMAKE_CXXFLAGS -DQT_QWS_CELLON -DQWS -QMAKE_CFLAGS_RELEASE ~= s/-O2/-Os/ -QMAKE_CXXFLAGS_RELEASE ~= s/-O2/-Os/ - -# modifications to linux.conf -QMAKE_AR = arm-linux-ar cqs -QMAKE_OBJCOPY = arm-linux-objcopy -QMAKE_STRIP = arm-linux-strip - -load(qt_config) - diff --git a/mkspecs/qws/linux-cellon-g++/qplatformdefs.h b/mkspecs/qws/linux-cellon-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-cellon-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-dm7000-g++/qmake.conf b/mkspecs/qws/linux-dm7000-g++/qmake.conf deleted file mode 100644 index c8970914664..00000000000 --- a/mkspecs/qws/linux-dm7000-g++/qmake.conf +++ /dev/null @@ -1,27 +0,0 @@ -# -# qmake configuration for linux-dm7000-g++, for Dream Multimedia's DM7000S -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = powerpc-tuxbox-linux-gnu-gcc -QMAKE_CFLAGS = -pipe -msoft-float -meabi -QMAKE_CFLAGS_RELEASE = -O2 -mcpu=405 -mmultiple -mstring -QMAKE_CFLAGS_DEBUG = -ggdb3 -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXX = powerpc-tuxbox-linux-gnu-g++ -QMAKE_LINK = powerpc-tuxbox-linux-gnu-g++ -QMAKE_LINK_SHLIB = powerpc-tuxbox-linux-gnu-g++ - -# modifications to linux.conf -QMAKE_AR = powerpc-tuxbox-linux-gnu-ar cqs -QMAKE_OBJCOPY = powerpc-tuxbox-linux-gnu-objcopy -QMAKE_STRIP = powerpc-tuxbox-linux-gnu-strip - -load(qt_config) diff --git a/mkspecs/qws/linux-dm7000-g++/qplatformdefs.h b/mkspecs/qws/linux-dm7000-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-dm7000-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-dm800-g++/qmake.conf b/mkspecs/qws/linux-dm800-g++/qmake.conf deleted file mode 100644 index 002e4c7d564..00000000000 --- a/mkspecs/qws/linux-dm800-g++/qmake.conf +++ /dev/null @@ -1,25 +0,0 @@ -# -# qmake configuration for linux-dm800-g++, for Dream Multimedia's DM800 -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = mipsel-linux-gcc -QMAKE_CXX = mipsel-linux-g++ -QMAKE_LINK = mipsel-linux-g++ -QMAKE_LINK_SHLIB = mipsel-linux-g++ -QMAKE_CFLAGS += -mabi=32 -mips32 -QMAKE_CFLAGS_RELEASE += -fexpensive-optimizations -frename-registers -O2 -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE - -# modifications to linux.conf -QMAKE_AR = mipsel-linux-ar cqs -QMAKE_OBJCOPY = mipsel-linux-objcopy -QMAKE_STRIP = mipsel-linux-strip - -load(qt_config) diff --git a/mkspecs/qws/linux-dm800-g++/qplatformdefs.h b/mkspecs/qws/linux-dm800-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-dm800-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-generic-g++-32/qmake.conf b/mkspecs/qws/linux-generic-g++-32/qmake.conf deleted file mode 100644 index 249c10aae92..00000000000 --- a/mkspecs/qws/linux-generic-g++-32/qmake.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -# qmake configuration for building with arm-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CFLAGS += -m32 -QMAKE_CXXFLAGS += -m32 -QMAKE_LFLAGS += -m32 - -load(qt_config) diff --git a/mkspecs/qws/linux-generic-g++-32/qplatformdefs.h b/mkspecs/qws/linux-generic-g++-32/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-generic-g++-32/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-generic-g++/qmake.conf b/mkspecs/qws/linux-generic-g++/qmake.conf deleted file mode 100644 index e803d0d4024..00000000000 --- a/mkspecs/qws/linux-generic-g++/qmake.conf +++ /dev/null @@ -1,10 +0,0 @@ -# -# qmake configuration for building with g++ -# - -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-generic-g++/qplatformdefs.h b/mkspecs/qws/linux-generic-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-generic-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-ipaq-g++/qmake.conf b/mkspecs/qws/linux-ipaq-g++/qmake.conf deleted file mode 100644 index f9d33b36289..00000000000 --- a/mkspecs/qws/linux-ipaq-g++/qmake.conf +++ /dev/null @@ -1,22 +0,0 @@ -# -# qmake configuration for building with arm-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = arm-linux-gcc -DQT_QWS_IPAQ -QMAKE_CXX = arm-linux-g++ -DQT_QWS_IPAQ -QMAKE_LINK = arm-linux-g++ -QMAKE_LINK_SHLIB = arm-linux-g++ - -# modifications to linux.conf -QMAKE_AR = arm-linux-ar cqs -QMAKE_OBJCOPY = arm-linux-objcopy -QMAKE_STRIP = arm-linux-strip - -load(qt_config) - diff --git a/mkspecs/qws/linux-ipaq-g++/qplatformdefs.h b/mkspecs/qws/linux-ipaq-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-ipaq-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-lsb-g++/qmake.conf b/mkspecs/qws/linux-lsb-g++/qmake.conf deleted file mode 100644 index 988a6ea5c9c..00000000000 --- a/mkspecs/qws/linux-lsb-g++/qmake.conf +++ /dev/null @@ -1,23 +0,0 @@ -# -# qmake configuration for linux-g++ -# - - -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 -QMAKE_CC = lsbcc -QMAKE_CXX = lsbc++ -QMAKE_CFLAGS = -pipe -DQT_LINUXBASE -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -QMAKE_LINK = lsbc++ -QMAKE_LINK_SHLIB = lsbc++ - -load(qt_config) - diff --git a/mkspecs/qws/linux-lsb-g++/qplatformdefs.h b/mkspecs/qws/linux-lsb-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-lsb-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-mips-g++/qmake.conf b/mkspecs/qws/linux-mips-g++/qmake.conf deleted file mode 100644 index 1a8607869f5..00000000000 --- a/mkspecs/qws/linux-mips-g++/qmake.conf +++ /dev/null @@ -1,23 +0,0 @@ -# -# qmake configuration for building with mipsel-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = mips-linux-gcc -QMAKE_CXX = mips-linux-g++ -QMAKE_CFLAGS += -mips32 -QMAKE_CXXFLAGS += -mips32 -QMAKE_LINK = mips-linux-g++ -QMAKE_LINK_SHLIB = mips-linux-g++ - -# modifications to linux.conf -QMAKE_AR = mips-linux-ar cqs -QMAKE_OBJCOPY = mips-linux-objcopy -QMAKE_STRIP = mips-linux-strip - -load(qt_config) diff --git a/mkspecs/qws/linux-mips-g++/qplatformdefs.h b/mkspecs/qws/linux-mips-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-mips-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-nacl-g++/qmake.conf b/mkspecs/qws/linux-nacl-g++/qmake.conf deleted file mode 100644 index 7293a1acfde..00000000000 --- a/mkspecs/qws/linux-nacl-g++/qmake.conf +++ /dev/null @@ -1,29 +0,0 @@ -# -# qmake configuration for building with nacl-g++ -# - -include(../../common/linux.conf) -include(../../common/qws.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) - -QT = core gui - -QMAKE_CC = nacl-gcc -QMAKE_CXX = nacl-g++ -QMAKE_LINK = nacl-g++ -QMAKE_LINK_SHLIB = nacl-g++ -QMAKE_AR = nacl-ar q -QMAKE_OBJCOPY = nacl-objcopy -QMAKE_STRIP = nacl-strip - -# work around linker crash when using PIC -QMAKE_CFLAGS_STATIC_LIB -= -fPIC -QMAKE_CFLAGS_SHLIB -= -fPIC -QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC -QMAKE_CXXFLAGS_SHLIB -= -fPIC - -#QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1 -QMAKE_LIBS_DYNLOAD -= -ldl - -load(qt_config) diff --git a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h deleted file mode 100644 index 0e95be8a558..00000000000 --- a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - -// Get Qt defines/settings - -#define _POSIX_TIMERS - -#include "qglobal.h" - -// extra disabling. -#ifdef __native_client__ -#define QT_NO_FSFILEENGINE -#endif - -#define QT_NO_SOCKET_H - -#define DIR void * -#define PATH_MAX 256 - -#include "../../common/posix/qplatformdefs.h" -#include "qfunctions_nacl.h" -#include - -#undef QT_LSTAT -#define QT_LSTAT QT_STAT - - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/qws/linux-powerpc-g++/qmake.conf b/mkspecs/qws/linux-powerpc-g++/qmake.conf deleted file mode 100644 index 6a6310aa028..00000000000 --- a/mkspecs/qws/linux-powerpc-g++/qmake.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -# qmake configuration for building with g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = powerpc-linux-gcc -QMAKE_CXX = powerpc-linux-g++ -QMAKE_LINK = powerpc-linux-g++ -QMAKE_LINK_SHLIB = powerpc-linux-g++ - -# modifications to linux.conf -QMAKE_AR = powerpc-linux-ar cqs -QMAKE_OBJCOPY = powerpc-linux-objcopy -QMAKE_STRIP = powerpc-linux-strip - -load(qt_config) diff --git a/mkspecs/qws/linux-powerpc-g++/qplatformdefs.h b/mkspecs/qws/linux-powerpc-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-powerpc-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-sh-g++/qmake.conf b/mkspecs/qws/linux-sh-g++/qmake.conf deleted file mode 100644 index 004780a5592..00000000000 --- a/mkspecs/qws/linux-sh-g++/qmake.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -# qmake configuration for building for SH devices with sh3-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = sh3-linux-gcc -QMAKE_CXX = sh3-linux-g++ -QMAKE_LINK = sh3-linux-g++ -QMAKE_LINK_SHLIB = sh3-linux-g++ - -# modifications to linux.conf -QMAKE_AR = sh3-linux-ar cqs -QMAKE_OBJCOPY = sh3-linux-objcopy -QMAKE_STRIP = sh3-linux-strip - -load(qt_config) diff --git a/mkspecs/qws/linux-sh-g++/qplatformdefs.h b/mkspecs/qws/linux-sh-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-sh-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-sh4al-g++/qmake.conf b/mkspecs/qws/linux-sh4al-g++/qmake.conf deleted file mode 100644 index 71f6b3df56b..00000000000 --- a/mkspecs/qws/linux-sh4al-g++/qmake.conf +++ /dev/null @@ -1,24 +0,0 @@ -# -# qmake configuration for building for SH4AL-DSP devices with sh3-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = sh3-linux-gcc -QMAKE_CXX = sh3-linux-g++ -QMAKE_LINK = sh3-linux-g++ -QMAKE_LINK_SHLIB = sh3-linux-g++ -QMAKE_CFLAGS += -m4al -QMAKE_CXXFLAGS += -m4al - - -# modifications to linux.conf -QMAKE_AR = sh3-linux-ar cqs -QMAKE_OBJCOPY = sh3-linux-objcopy -QMAKE_STRIP = sh3-linux-strip - -load(qt_config) diff --git a/mkspecs/qws/linux-sh4al-g++/qplatformdefs.h b/mkspecs/qws/linux-sh4al-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-sh4al-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-sharp-g++/qmake.conf b/mkspecs/qws/linux-sharp-g++/qmake.conf deleted file mode 100644 index 6a000b9c64a..00000000000 --- a/mkspecs/qws/linux-sharp-g++/qmake.conf +++ /dev/null @@ -1,24 +0,0 @@ -# -# qmake configuration for building with arm-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = arm-linux-gcc -QMAKE_CXX = arm-linux-g++ -QMAKE_LINK = arm-linux-g++ -QMAKE_LINK_SHLIB = arm-linux-g++ -QMAKE_CFLAGS += -DQT_QWS_SHARP -DQT_QWS_EBX -QMAKE_CXXFLAGS += -DQT_QWS_SHARP -DQT_QWS_EBX - -# modifications to linux.conf -QMAKE_AR = arm-linux-ar cqs -QMAKE_OBJCOPY = arm-linux-objcopy -QMAKE_STRIP = arm-linux-strip - -load(qt_config) - diff --git a/mkspecs/qws/linux-sharp-g++/qplatformdefs.h b/mkspecs/qws/linux-sharp-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-sharp-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-x86-g++/qmake.conf b/mkspecs/qws/linux-x86-g++/qmake.conf deleted file mode 100644 index 55011ec52bb..00000000000 --- a/mkspecs/qws/linux-x86-g++/qmake.conf +++ /dev/null @@ -1,10 +0,0 @@ -# -# qmake configuration for building with linux-g++ -# - -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-g++/qplatformdefs.h b/mkspecs/qws/linux-x86-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-x86-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-x86_64-g++/qmake.conf b/mkspecs/qws/linux-x86_64-g++/qmake.conf deleted file mode 100644 index e18d0557904..00000000000 --- a/mkspecs/qws/linux-x86_64-g++/qmake.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -# qmake configuration for building with linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CFLAGS += -m64 -QMAKE_CXXFLAGS += -m64 - -load(qt_config) - diff --git a/mkspecs/qws/linux-x86_64-g++/qplatformdefs.h b/mkspecs/qws/linux-x86_64-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-x86_64-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/linux-zylonite-g++/qmake.conf b/mkspecs/qws/linux-zylonite-g++/qmake.conf deleted file mode 100644 index f50b70f945d..00000000000 --- a/mkspecs/qws/linux-zylonite-g++/qmake.conf +++ /dev/null @@ -1,26 +0,0 @@ -# -# qmake configuration for building with arm-linux-g++ -# - -include(../../common/linux.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) -include(../../common/qws.conf) - -# modifications to g++.conf -QMAKE_CC = arm-linux-gcc -QMAKE_CXX = arm-linux-g++ -QMAKE_CFLAGS += -DQT_QWS_ZYLONITE -DQWS -fno-rtti -QMAKE_CXXFLAGS += -DQT_QWS_ZYLONITE -DQWS -fno-rtti -QMAKE_LINK = arm-linux-g++ -QMAKE_LINK_SHLIB = arm-linux-g++ -QMAKE_CFLAGS_RELEASE ~= s/-O2/-Os/ -QMAKE_CXXFLAGS_RELEASE ~= s/-O2/-Os/ - -# modifications to linux.conf -QMAKE_AR = arm-linux-ar cqs -QMAKE_OBJCOPY = arm-linux-objcopy -QMAKE_STRIP = arm-linux-strip - -load(qt_config) - diff --git a/mkspecs/qws/linux-zylonite-g++/qplatformdefs.h b/mkspecs/qws/linux-zylonite-g++/qplatformdefs.h deleted file mode 100644 index 701c3301449..00000000000 --- a/mkspecs/qws/linux-zylonite-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../linux-g++/qplatformdefs.h" diff --git a/mkspecs/qws/macx-generic-g++/qmake.conf b/mkspecs/qws/macx-generic-g++/qmake.conf deleted file mode 100644 index 8dcbb39316f..00000000000 --- a/mkspecs/qws/macx-generic-g++/qmake.conf +++ /dev/null @@ -1,90 +0,0 @@ -# -# qmake configuration for macx-g++ with Qtopia Core -# - -include(../../common/unix.conf) - -MAKEFILE_GENERATOR = UNIX -TARGET_PLATFORM = macx -TEMPLATE = app -CONFIG += qt warn_on release link_prl -QT += core gui network -QMAKE_INCREMENTAL_STYLE = sublib -QMAKE_EXTENSION_SHLIB = dylib - -QMAKE_CC = $(TB)cc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -pipe -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 = 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_LFLAGS_RPATH = - -QMAKE_LIBS = -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 = ar cqs -QMAKE_OBJCOPY = objcopy -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-generic-g++/qplatformdefs.h b/mkspecs/qws/macx-generic-g++/qplatformdefs.h deleted file mode 100644 index c1a4d77a4e0..00000000000 --- a/mkspecs/qws/macx-generic-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../macx-g++/qplatformdefs.h" diff --git a/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib b/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib deleted file mode 100644 index 97609ed0ce6..00000000000 --- a/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib +++ /dev/null @@ -1,18 +0,0 @@ - - - - - CFBundlePackageType - FMWK - CFBundleShortVersionString - @SHORT_VERSION@ - CFBundleGetInfoString - Created by Qt/QMake - CFBundleSignature - @TYPEINFO@ - CFBundleExecutable - @LIBRARY@ - NOTE - Please, do NOT change this file -- It was generated by Qt/QMake. - - diff --git a/mkspecs/qws/macx-iphonedevice-g++/qmake.conf b/mkspecs/qws/macx-iphonedevice-g++/qmake.conf deleted file mode 100644 index 227d24e8382..00000000000 --- a/mkspecs/qws/macx-iphonedevice-g++/qmake.conf +++ /dev/null @@ -1,48 +0,0 @@ -# -# qmake configuration for iphone-device-g++ -# -include(../../common/mac.conf) -include(../../common/gcc-base-macx.conf) -include(../../common/g++-macx.conf) - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl -QT += core gui -QMAKE_INCREMENTAL_STYLE = sublib - -# Do not compile a few things -DEFINES += QT_NO_AUDIO_BACKEND QT_NO_NETWORKPROXY QT_NO_FILESYSTEMWATCHER - -# You may need to change this to point to the iOS SDK you want to use. -QMAKE_IOS_DEV_PATH = /Developer/Platforms/iPhoneOS.platform/Developer -QMAKE_IOS_SDK = $$QMAKE_IOS_DEV_PATH/SDKs/iPhoneOS4.3.sdk -DEFINES += __IPHONE_OS_VERSION_MIN_REQUIRED=40200 - -#clear -QMAKE_MACOSX_DEPLOYMENT_TARGET = - -QMAKE_LIBS_OPENGL_ES1 += -framework OpenGLES -QMAKE_LIBS_OPENGL_ES2 += -framework OpenGLES - -# TARGET_PLATFORM = ios -QMAKE_CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -QMAKE_CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 -QMAKE_LINK = $$QMAKE_CXX -QMAKE_LINK_SHLIB = $$QMAKE_CXX - -QMAKE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_OBJECTIVE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -fobjc-abi-version=2 -fobjc-legacy-dispatch -QMAKE_LFLAGS += -arch armv7 -marm -miphoneos-version-min=4.2 -Wl,-syslibroot,$$QMAKE_IOS_SDK - -QMAKE_INCDIR_OPENGL = -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_OPENGL_QT = - -#QMAKE_RESOURCE = -QMAKE_FIX_RPATH = $$QMAKE_IOS_DEV_PATH/usr/bin/install_name_tool -id -QMAKE_AR = $$QMAKE_IOS_DEV_PATH/usr/bin/ar cq -QMAKE_RANLIB = $$QMAKE_IOS_DEV_PATH/usr/bin/ranlib -s - -load(qt_config) diff --git a/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h b/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h deleted file mode 100644 index 629d57fe103..00000000000 --- a/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.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 qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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 - -#define QT_QPA_DEFAULT_PLATFORM_NAME "uikit" - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib b/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib deleted file mode 100644 index 97609ed0ce6..00000000000 --- a/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib +++ /dev/null @@ -1,18 +0,0 @@ - - - - - CFBundlePackageType - FMWK - CFBundleShortVersionString - @SHORT_VERSION@ - CFBundleGetInfoString - Created by Qt/QMake - CFBundleSignature - @TYPEINFO@ - CFBundleExecutable - @LIBRARY@ - NOTE - Please, do NOT change this file -- It was generated by Qt/QMake. - - diff --git a/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf b/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf deleted file mode 100644 index 93c47862a07..00000000000 --- a/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf +++ /dev/null @@ -1,49 +0,0 @@ -# -# qmake configuration for macx-g++ -# -include(../../common/mac.conf) -include(../../common/gcc-base-macx.conf) -include(../../common/g++-macx.conf) - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl -QT += core gui -QMAKE_INCREMENTAL_STYLE = sublib - -# Do not compile a few things -DEFINES += QT_NO_AUDIO_BACKEND QT_NO_NETWORKPROXY QT_NO_FILESYSTEMWATCHER - -# You may need to change this to point to the iOS SDK you want to use. -QMAKE_IOS_DEV_PATH = /Developer/Platforms/iPhoneSimulator.platform/Developer -QMAKE_IOS_SDK = $$QMAKE_IOS_DEV_PATH/SDKs/iPhoneSimulator4.2.sdk -DEFINES += __IPHONE_OS_VERSION_MIN_REQUIRED=40200 -#clear -QMAKE_MACOSX_DEPLOYMENT_TARGET = - -QMAKE_LIBS_OPENGL_ES1 += -framework OpenGLES -QMAKE_LIBS_OPENGL_ES2 += -framework OpenGLES - -# TARGET_PLATFORM = ios -QMAKE_CC = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -QMAKE_CXX = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 -QMAKE_LINK = $$QMAKE_CXX -QMAKE_LINK_SHLIB = $$QMAKE_CXX - -QMAKE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_OBJECTIVE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK -fobjc-abi-version=2 -fobjc-legacy-dispatch -QMAKE_LFLAGS += -arch i386 -Wl,-syslibroot,$$QMAKE_IOS_SDK - -QMAKE_INCDIR_OPENGL = -QMAKE_LIBS_OPENGL = -QMAKE_LIBS_OPENGL_QT = - -#QMAKE_RESOURCE = -QMAKE_FIX_RPATH = $$QMAKE_IOS_DEV_PATH/usr/bin/install_name_tool -id -QMAKE_AR = $$QMAKE_IOS_DEV_PATH/usr/bin/ar cq -QMAKE_RANLIB = $$QMAKE_IOS_DEV_PATH/usr/bin/ranlib -s - -load(qt_config) - -QMAKE_OBJECTIVE_CFLAGS_X86 += -arch i386 -isysroot $$QMAKE_IOS_SDK -fobjc-abi-version=2 -fobjc-legacy-dispatch diff --git a/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h b/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h deleted file mode 100644 index 629d57fe103..00000000000 --- a/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.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 qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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 - -#define QT_QPA_DEFAULT_PLATFORM_NAME "uikit" - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/qws/macx-nacl-g++/qmake.conf b/mkspecs/qws/macx-nacl-g++/qmake.conf deleted file mode 100644 index 7293a1acfde..00000000000 --- a/mkspecs/qws/macx-nacl-g++/qmake.conf +++ /dev/null @@ -1,29 +0,0 @@ -# -# qmake configuration for building with nacl-g++ -# - -include(../../common/linux.conf) -include(../../common/qws.conf) -include(../../common/gcc-base-unix.conf) -include(../../common/g++-unix.conf) - -QT = core gui - -QMAKE_CC = nacl-gcc -QMAKE_CXX = nacl-g++ -QMAKE_LINK = nacl-g++ -QMAKE_LINK_SHLIB = nacl-g++ -QMAKE_AR = nacl-ar q -QMAKE_OBJCOPY = nacl-objcopy -QMAKE_STRIP = nacl-strip - -# work around linker crash when using PIC -QMAKE_CFLAGS_STATIC_LIB -= -fPIC -QMAKE_CFLAGS_SHLIB -= -fPIC -QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC -QMAKE_CXXFLAGS_SHLIB -= -fPIC - -#QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1 -QMAKE_LIBS_DYNLOAD -= -ldl - -load(qt_config) diff --git a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h deleted file mode 100644 index d72943d3306..00000000000 --- a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMDEFS_H -#define QPLATFORMDEFS_H - - -#define _POSIX_TIMERS - -#include "qglobal.h" - -// extra disabling. -#ifdef __native_client__ -#define QT_NO_FSFILEENGINE -#endif - -#define QT_NO_SOCKET_H - -#define DIR void * -#define PATH_MAX 256 - -#include "../../common/posix/qplatformdefs.h" -#include "qfunctions_nacl.h" -#include - -#undef QT_LSTAT -#define QT_LSTAT QT_STAT - - -#endif // QPLATFORMDEFS_H diff --git a/mkspecs/qws/solaris-generic-g++/qmake.conf b/mkspecs/qws/solaris-generic-g++/qmake.conf deleted file mode 100644 index 3bf7e56447a..00000000000 --- a/mkspecs/qws/solaris-generic-g++/qmake.conf +++ /dev/null @@ -1,89 +0,0 @@ -# -# qmake configuration for solaris-g++ with Qtopia Core -# - -MAKEFILE_GENERATOR = UNIX -TARGET_PLATFORM = unix -TEMPLATE = app -CONFIG += qt warn_on release link_prl -QT += core gui network -QMAKE_INCREMENTAL_STYLE = sublib - -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -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_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 = g++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_SOUND -DQT_NO_QWS_LINUXFB -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_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 = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LINK_C = gcc -QMAKE_LINK_C_SHLIB = gcc -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -shared -QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME = -Wl,-soname, -QMAKE_LFLAGS_THREAD = -QMAKE_LFLAGS_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -lsocket -lnsl -lresolv -QMAKE_LIBS_DYNLOAD = -ldl -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 = -lthread -lrt -QMAKE_LIBS_OPENGL = - -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - -QMAKE_AR = ar cq -QMAKE_OBJCOPY = objcopy -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/solaris-generic-g++/qplatformdefs.h b/mkspecs/qws/solaris-generic-g++/qplatformdefs.h deleted file mode 100644 index 5604dc7e02b..00000000000 --- a/mkspecs/qws/solaris-generic-g++/qplatformdefs.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "../../solaris-g++/qplatformdefs.h" diff --git a/mkspecs/unsupported/macx-clang/qplatformdefs.h b/mkspecs/unsupported/macx-clang/qplatformdefs.h index 154d9c8a4d8..db691159679 100644 --- a/mkspecs/unsupported/macx-clang/qplatformdefs.h +++ b/mkspecs/unsupported/macx-clang/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/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 30d782256c4..49300f31027 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -175,9 +175,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "MOVE = " << var("QMAKE_MOVE") << endl; t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; t << "MKDIR = " << var("QMAKE_MKDIR") << endl; - if(!project->isEmpty("QMAKE_MACOSX_DEPLOYMENT_TARGET")) - t << "export MACOSX_DEPLOYMENT_TARGET = " //exported to children processes - << project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET") << endl; if (!project->isEmpty("QMAKE_SYMBIAN_SHLIB")) { t << "vpath %.dso " << project->values("QMAKE_LIBDIR").join(":") << endl; diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 79794e751c8..12a19119816 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -136,7 +136,6 @@ bootstrap { #Qt code mac { SOURCES += qfilesystemengine_mac.cpp SOURCES += qcore_mac.cpp qsettings_mac.cpp - QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported) LIBS += -framework ApplicationServices } } else:win32 { diff --git a/src/3rdparty/v8 b/src/3rdparty/v8 index 523f03f03b1..dc2cad4f8fc 160000 --- a/src/3rdparty/v8 +++ b/src/3rdparty/v8 @@ -1 +1 @@ -Subproject commit 523f03f03b1ac16d272a13389f8a5654d9ff12e6 +Subproject commit dc2cad4f8fc88c52fcea09b8d0262d35cd32dc44 diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1552f676954..1cfd70112fd 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -289,7 +289,7 @@ namespace QT_NAMESPACE {} #endif #if defined(Q_OS_DARWIN) -# define Q_OS_MAC /* Q_OS_MAC is mostly for compatibility, but also more clear */ +# define Q_OS_MAC # define Q_OS_MACX /* Q_OS_MACX is only for compatibility.*/ # if defined(Q_OS_DARWIN64) # define Q_OS_MAC64 @@ -298,12 +298,6 @@ namespace QT_NAMESPACE {} # endif #endif -#ifdef QT_AUTODETECT_COCOA -# ifdef Q_OS_MAC64 -# define QT_MAC_USE_COCOA 1 -# endif -#endif - #if defined(Q_WS_MAC64) && !defined(QT_MAC_USE_COCOA) && !defined(QT_BUILD_QMAKE) && !defined(QT_BOOTSTRAPPED) #error "You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration." #endif @@ -877,7 +871,9 @@ namespace QT_NAMESPACE {} WIN16 - unsupported */ -#if defined(Q_OS_MSDOS) +#if defined (Q_WS_QPA) + +#elif defined(Q_OS_MSDOS) # define Q_WS_WIN16 # error "Qt requires Win32 and does not work with Windows 3.x" #elif defined(_WIN32_X11_) @@ -897,15 +893,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_QPA) -# define Q_WS_MAC -# define Q_WS_MACX -# if defined(Q_OS_MAC64) -# define Q_WS_MAC64 -# elif defined(Q_OS_MAC32) -# define Q_WS_MAC32 -# endif -# elif defined(Q_OS_SYMBIAN) +# if defined(Q_OS_SYMBIAN) # if !defined(QT_NO_S60) # define Q_WS_S60 # endif @@ -1143,7 +1131,7 @@ redefine to built-in booleans to make autotests work properly */ //defines the type for the WNDPROC on windows //the alignment needs to be forced for sse2 to not crash with mingw -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) # if defined(Q_CC_MINGW) # define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer)) # else @@ -1268,6 +1256,16 @@ class QDataStream; # else # define Q_GUI_EXPORT Q_DECL_IMPORT # endif +# if defined(QT_BUILD_WIDGETS_LIB) +# define Q_WIDGETS_EXPORT Q_DECL_EXPORT +# else +# define Q_WIDGETS_EXPORT Q_DECL_IMPORT +# endif +# if defined(QT_BUILD_PRINTSUPPORT_LIB) +# define Q_PRINTSUPPORT_EXPORT Q_DECL_EXPORT +# else +# define Q_PRINTSUPPORT_EXPORT Q_DECL_IMPORT +# endif # if defined(QT_BUILD_SQL_LIB) # define Q_SQL_EXPORT Q_DECL_EXPORT # else @@ -1283,6 +1281,11 @@ class QDataStream; # else # define Q_SVG_EXPORT Q_DECL_IMPORT # endif +# if defined(QT_BUILD_QTQUICK1_LIB) +# define Q_QTQUICK1_EXPORT Q_DECL_EXPORT +# else +# define Q_QTQUICK1_EXPORT Q_DECL_IMPORT +# endif # if defined(QT_BUILD_DECLARATIVE_LIB) # define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT # else @@ -1352,10 +1355,13 @@ class QDataStream; # elif defined(QT_DLL) /* use a Qt DLL library */ # define Q_CORE_EXPORT Q_DECL_IMPORT # define Q_GUI_EXPORT Q_DECL_IMPORT +# define Q_WIDGETS_EXPORT Q_DECL_IMPORT +# define Q_PRINTSUPPORT_EXPORT Q_DECL_IMPORT # define Q_SQL_EXPORT Q_DECL_IMPORT # define Q_NETWORK_EXPORT Q_DECL_IMPORT # define Q_SVG_EXPORT Q_DECL_IMPORT # define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT +# define Q_QTQUICK1_EXPORT Q_DECL_IMPORT # define Q_CANVAS_EXPORT Q_DECL_IMPORT # define Q_OPENGL_EXPORT Q_DECL_IMPORT # define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT @@ -1384,10 +1390,13 @@ class QDataStream; # if defined(QT_SHARED) # define Q_CORE_EXPORT Q_DECL_EXPORT # define Q_GUI_EXPORT Q_DECL_EXPORT +# define Q_WIDGETS_EXPORT Q_DECL_EXPORT +# define Q_PRINTSUPPORT_EXPORT Q_DECL_EXPORT # define Q_SQL_EXPORT Q_DECL_EXPORT # define Q_NETWORK_EXPORT Q_DECL_EXPORT # define Q_SVG_EXPORT Q_DECL_EXPORT # define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT +# define Q_QTQUICK1_EXPORT Q_DECL_EXPORT # define Q_OPENGL_EXPORT Q_DECL_EXPORT # define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT # define Q_OPENVG_EXPORT Q_DECL_EXPORT @@ -1402,10 +1411,13 @@ class QDataStream; # else # define Q_CORE_EXPORT # define Q_GUI_EXPORT +# define Q_WIDGETS_EXPORT +# define Q_PRINTSUPPORT_EXPORT # define Q_SQL_EXPORT # define Q_NETWORK_EXPORT # define Q_SVG_EXPORT # define Q_DECLARATIVE_EXPORT +# define Q_QTQUICK1_EXPORT # define Q_OPENGL_EXPORT # define Q_MULTIMEDIA_EXPORT # define Q_OPENVG_EXPORT @@ -1433,6 +1445,16 @@ class QDataStream; # else # define Q_GUI_EXPORT_INLINE inline # endif +# if defined(QT_BUILD_WIDGETS_LIB) +# define Q_WIDGETS_EXPORT_INLINE Q_WIDGETS_EXPORT inline +# else +# define Q_WIDGETS_EXPORT_INLINE inline +# endif +# if defined(QT_BUILD_PRINTSUPPORT_LIB) +# define Q_PRINTSUPPORT_EXPORT_INLINE Q_PRINTSUPPORT_EXPORT inline +# else +# define Q_PRINTSUPPORT_EXPORT_INLINE inline +# endif # if defined(QT_BUILD_COMPAT_LIB) # define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline # else @@ -1444,10 +1466,14 @@ class QDataStream; // note: this affects the contents of the DEF files (ie. these functions do not appear) # define Q_CORE_EXPORT_INLINE inline # define Q_GUI_EXPORT_INLINE inline +# define Q_WIDGETS_EXPORT_INLINE inline +# define Q_PRINTSUPPORT_EXPORT_INLINE inline # define Q_COMPAT_EXPORT_INLINE inline #else # define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline # define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline +# define Q_WIDGETS_EXPORT_INLINE Q_WIDGETS_EXPORT inline +# define Q_PRINTSUPPORT_EXPORT_INLINE Q_PRINTSUPPORT_EXPORT inline # define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline #endif @@ -1531,7 +1557,7 @@ public: #else # error "Qt not configured correctly, please run configure" #endif -#if defined(Q_WS_WIN) || defined(Q_OS_CYGWIN) +#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) enum WinVersion { WV_32s = 0x0001, WV_95 = 0x0002, @@ -2017,6 +2043,7 @@ static inline bool qIsNull(float f) return false; \ } #else + # define Q_DUMMY_COMPARISON_OPERATOR(C) #endif diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 9253b19e602..a4b9cf1777f 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -237,13 +237,13 @@ public: Window = 0x00000001, Dialog = 0x00000002 | Window, Sheet = 0x00000004 | Window, - Drawer = 0x00000006 | Window, + Drawer = Sheet | Dialog, Popup = 0x00000008 | Window, - Tool = 0x0000000a | Window, - ToolTip = 0x0000000c | Window, - SplashScreen = 0x0000000e | Window, + Tool = Popup | Dialog, + ToolTip = Popup | Sheet, + SplashScreen = ToolTip | Dialog, Desktop = 0x00000010 | Window, - SubWindow = 0x00000012, + SubWindow = 0x00000012, WindowType_Mask = 0x000000ff, MSWindowsFixedSizeDialogHint = 0x00000100, @@ -258,13 +258,7 @@ public: WindowContextHelpButtonHint = 0x00010000, WindowShadeButtonHint = 0x00020000, WindowStaysOnTopHint = 0x00040000, - // reserved for Qt3Support: - // WMouseNoMask = 0x00080000, - // WDestructiveClose = 0x00100000, - // WStaticContents = 0x00200000, - // WGroupLeader = 0x00400000, - // WShowModal = 0x00800000, - // WNoMousePropagation = 0x01000000, + CustomizeWindowHint = 0x02000000, WindowStaysOnBottomHint = 0x04000000, WindowCloseButtonHint = 0x08000000, @@ -1240,23 +1234,37 @@ public: }; enum InputMethodQuery { - ImMicroFocus, - ImFont, - ImCursorPosition, - ImSurroundingText, - ImCurrentSelection, - ImMaximumTextLength, - ImAnchorPosition + ImEnabled = 0x1, + ImCursorRectangle = 0x2, + ImMicroFocus = 0x2, // deprecated + ImFont = 0x4, + ImCursorPosition = 0x8, + ImSurroundingText = 0x10, + ImCurrentSelection = 0x20, + ImMaximumTextLength = 0x40, + ImAnchorPosition = 0x80, + ImHints = 0x100, + ImPreferredLanguage = 0x200, + + ImPlatformData = 0x80000000, + ImQueryAll = 0xffffffff }; + Q_DECLARE_FLAGS(InputMethodQueries, InputMethodQuery) enum InputMethodHint { ImhNone = 0x0, + ImhHiddenText = 0x1, - ImhNoAutoUppercase = 0x2, - ImhPreferNumbers = 0x4, - ImhPreferUppercase = 0x8, - ImhPreferLowercase = 0x10, - ImhNoPredictiveText = 0x20, + ImhSensitiveData = 0x2, + ImhNoAutoUppercase = 0x4, + ImhPreferNumbers = 0x8, + ImhPreferUppercase = 0x10, + ImhPreferLowercase = 0x20, + ImhNoPredictiveText = 0x40, + + ImhDate = 0x80, + ImhTime = 0x100, + ImhMultiLine = 0x200, ImhDigitsOnly = 0x10000, ImhFormattedNumbersOnly = 0x20000, diff --git a/src/corelib/global/qt_pch.h b/src/corelib/global/qt_pch.h index 738026a9ed2..0926e02af15 100644 --- a/src/corelib/global/qt_pch.h +++ b/src/corelib/global/qt_pch.h @@ -50,7 +50,7 @@ #if defined __cplusplus #include -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN # define _POSIX_ # include # undef _POSIX_ diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 41278f1b91b..9faa9f17b37 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1730,7 +1730,7 @@ QFileInfoList QDir::drives() */ QChar QDir::separator() { -#if defined (Q_FS_FAT) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) +#if defined (Q_FS_FAT) || defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) return QLatin1Char('\\'); #elif defined(Q_OS_UNIX) return QLatin1Char('/'); diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index 79dda1b70af..89c08aeca7a 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -77,7 +77,7 @@ class Q_AUTOTEST_EXPORT QFSFileEnginePrivate : public QAbstractFileEnginePrivate Q_DECLARE_PUBLIC(QFSFileEngine) public: -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN static QString longFileName(const QString &path); #endif @@ -143,7 +143,7 @@ public: int getMapHandle(); #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN HANDLE fileHandle; HANDLE mapHandle; QHash maps; diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index af43ab73204..ddbbbd5286a 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -93,7 +93,7 @@ QT_END_NAMESPACE #include #include -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN #include #endif @@ -764,10 +764,10 @@ QProcessPrivate::QProcessPrivate() dying = false; emittedReadyRead = false; emittedBytesWritten = false; -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN pipeWriter = 0; processFinishedNotifier = 0; -#endif // Q_WS_WIN +#endif // Q_OS_WIN #ifdef Q_OS_UNIX serial = 0; #endif diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 6d8bf20b7ca..d716c7b0f6c 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -171,7 +171,7 @@ CApaCommandLine* QCoreApplicationPrivate::symbianCommandLine() #endif -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) +#if defined(Q_OS_WIN) || defined(Q_WS_MAC) extern QString qAppFileName(); #endif @@ -319,7 +319,7 @@ Q_GLOBAL_STATIC(QCoreApplicationData, coreappdata) QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint flags) : QObjectPrivate(), argc(aargc), argv(aargv), application_type(0), eventFilter(0), - in_exec(false), aboutToQuitEmitted(false) + in_exec(false), aboutToQuitEmitted(false), threadData_clean(false) { app_compile_version = flags & 0xffffff; static const char *const empty = ""; @@ -344,7 +344,12 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint QCoreApplicationPrivate::~QCoreApplicationPrivate() { - if (threadData) { + cleanupThreadData(); +} + +void QCoreApplicationPrivate::cleanupThreadData() +{ + if (threadData && !threadData_clean) { #ifndef QT_NO_THREAD void *data = &threadData->tls; QThreadStorageData::finish((void **)data); @@ -363,6 +368,7 @@ QCoreApplicationPrivate::~QCoreApplicationPrivate() threadData->postEventList.clear(); threadData->postEventList.recursion = 0; threadData->quitNow = false; + threadData_clean = true; } } @@ -578,23 +584,6 @@ void QCoreApplication::flush() \a argc must be greater than zero and \a argv must contain at least one valid character string. */ -QCoreApplication::QCoreApplication(int &argc, char **argv) - : QObject(*new QCoreApplicationPrivate(argc, argv, 0x040000)) -{ - init(); - QCoreApplicationPrivate::eventDispatcher->startingUp(); -#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_LIBRARY) - // Refresh factoryloader, as text codecs are requested during lib path - // resolving process and won't be therefore properly loaded. - // Unknown if this is symbian specific issue. - QFactoryLoader::refreshAll(); -#endif - -#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE) - d_func()->symbianInit(); -#endif -} - QCoreApplication::QCoreApplication(int &argc, char **argv, int _internal) : QObject(*new QCoreApplicationPrivate(argc, argv, _internal)) { @@ -754,20 +743,6 @@ void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on) QCoreApplicationPrivate::attribs |= 1 << attribute; else QCoreApplicationPrivate::attribs &= ~(1 << attribute); -#ifdef Q_OS_MAC - // Turn on the no native menubar here, since we used to - // do this implicitly. We DO NOT flip it off if someone sets - // it to false. - // Ideally, we'd have magic that would be something along the lines of - // "follow MacPluginApplication" unless explicitly set. - // Considering this attribute isn't only at the beginning - // it's unlikely it will ever be a problem, but I want - // to have the behavior documented here. - if (attribute == Qt::AA_MacPluginApplication && on - && !testAttribute(Qt::AA_DontUseNativeMenuBar)) { - setAttribute(Qt::AA_DontUseNativeMenuBar, true); - } -#endif } /*! @@ -1274,7 +1249,7 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority) */ bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN Q_ASSERT(event); Q_ASSERT(receiver); Q_ASSERT(postedEvents); @@ -1965,7 +1940,7 @@ QString QCoreApplication::applicationFilePath() if (!d->cachedApplicationFilePath.isNull()) return d->cachedApplicationFilePath; -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) d->cachedApplicationFilePath = QFileInfo(qAppFileName()).filePath(); return d->cachedApplicationFilePath; #elif defined(Q_WS_MAC) @@ -2160,7 +2135,6 @@ QStringList QCoreApplication::arguments() ; else if (l1arg == "-style" || l1arg == "-session" || - l1arg == "-graphicssystem" || l1arg == "-testability") ++a; else diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index adc70387cc0..04d538d1b33 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -46,7 +46,7 @@ #include #include -#if defined(Q_WS_WIN) && !defined(tagMSG) +#if defined(Q_OS_WIN) && !defined(tagMSG) typedef struct tagMSG MSG; #endif @@ -77,16 +77,7 @@ public: enum { ApplicationFlags = QT_VERSION }; -#if defined(QT_BUILD_CORE_LIB) || defined(qdoc) - QCoreApplication(int &argc, char **argv); // ### Qt5 remove -#endif -#if !defined(qdoc) - QCoreApplication(int &argc, char **argv, int -#if !defined(QT_BUILD_CORE_LIB) - = ApplicationFlags -#endif - ); -#endif + QCoreApplication(int &argc, char **argv, int = ApplicationFlags); ~QCoreApplication(); @@ -157,7 +148,7 @@ public: static void flush(); -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) virtual bool winEventFilter(MSG *message, long *result); #endif @@ -198,11 +189,15 @@ private: friend class QEventDispatcherUNIXPrivate; friend class QApplication; friend class QApplicationPrivate; + friend class QGuiApplication; + friend class QGuiApplicationPrivate; friend class QETWidget; friend class Q3AccelManager; friend class QShortcutMap; friend class QWidget; + friend class QWidgetWindow; friend class QWidgetPrivate; + friend class QCocoaEventDispatcherPrivate; friend bool qt_sendSpontaneousEvent(QObject*, QEvent*); friend Q_CORE_EXPORT QString qAppName(); friend class QClassFactory; @@ -266,7 +261,7 @@ Q_CORE_EXPORT void qAddPostRoutine(QtCleanUpFunction); Q_CORE_EXPORT void qRemovePostRoutine(QtCleanUpFunction); Q_CORE_EXPORT QString qAppName(); // get application name -#if defined(Q_WS_WIN) && !defined(QT_NO_DEBUG_STREAM) +#if defined(Q_OS_WIN) && !defined(QT_NO_DEBUG_STREAM) Q_CORE_EXPORT QString decodeMSG(const MSG &); Q_CORE_EXPORT QDebug operator<<(QDebug, const MSG &); #endif diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 8dff4ed80cb..0914b24a168 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -110,6 +110,7 @@ public: int &argc; char **argv; void appendApplicationPathToLibraryPaths(void); + void cleanupThreadData(); #ifndef QT_NO_TRANSLATION QTranslatorList translators; @@ -120,6 +121,7 @@ public: bool in_exec; bool aboutToQuitEmitted; + bool threadData_clean; QString cachedApplicationDirPath; QString cachedApplicationFilePath; #if defined(Q_OS_SYMBIAN) diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 6a77a74861e..cb6d39a481a 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -240,7 +240,7 @@ void QCoreApplicationPrivate::removePostedTimerEvent(QObject *object, int timerI } } -#if defined(Q_WS_WIN) && !defined(QT_NO_DEBUG_STREAM) +#if defined(Q_OS_WIN) && !defined(QT_NO_DEBUG_STREAM) /***************************************************************************** Convenience functions for convert WM_* messages into human readable strings, including a nifty QDebug operator<< for simpel QDebug() << msg output. diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 20376b9fa49..213f0e4a589 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -126,6 +126,7 @@ QT_BEGIN_NAMESPACE \value Enter Mouse enters widget's boundaries. \value EnterEditFocus An editor widget gains focus for editing. \value EnterWhatsThisMode Send to toplevel widgets when the application enters "What's This?" mode. + \value Expose Sent to a window when its on-screen contents are invalidated and need to be flushed from the backing store. \value FileOpen File open request (QFileOpenEvent). \value FocusIn Widget gains keyboard focus (QFocusEvent). \value FocusOut Widget loses keyboard focus (QFocusEvent). diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 01a5356f737..831a4039752 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -273,7 +273,13 @@ public: ScrollPrepare = 204, Scroll = 205, - OrientationChange = 206, // Screen orientation has changed + Map = 206, + Unmap = 207, + + Expose = 208, + + InputMethodQuery = 209, + OrientationChange = 210, // Screen orientation has changed // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 84663fa5ea5..fc66e9bfd61 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -50,7 +50,6 @@ #include "qvarlengtharray.h" #include "qwineventnotifier_p.h" -#include "qabstracteventdispatcher_p.h" #include "qcoreapplication_p.h" #include #include @@ -280,33 +279,7 @@ int WSAAsyncSelect(SOCKET, HWND, unsigned int, long) class QEventDispatcherWin32Private; -struct QSockNot { - QSocketNotifier *obj; - int fd; -}; -typedef QHash QSNDict; - -struct WinTimerInfo { // internal timer info - QObject *dispatcher; - int timerId; - int interval; - QObject *obj; // - object to receive events - bool inTimerEvent; - int fastTimerId; -}; - -class QZeroTimerEvent : public QTimerEvent -{ -public: - inline QZeroTimerEvent(int timerId) - : QTimerEvent(timerId) - { t = QEvent::ZeroTimerEvent; } -}; - -typedef QList WinTimerVec; // vector of TimerInfo structs -typedef QHash WinTimerDict; // fast dict of timers - -#if !defined(DWORD_PTR) && !defined(Q_WS_WIN64) +#if !defined(DWORD_PTR) && !defined(Q_OS_WIN64) #define DWORD_PTR DWORD #endif @@ -338,47 +311,6 @@ static void resolveTimerAPI() } } - -class QEventDispatcherWin32Private : public QAbstractEventDispatcherPrivate -{ - Q_DECLARE_PUBLIC(QEventDispatcherWin32) -public: - QEventDispatcherWin32Private(); - ~QEventDispatcherWin32Private(); - - DWORD threadId; - - bool interrupt; - - // internal window handle used for socketnotifiers/timers/etc - HWND internalHwnd; - HHOOK getMessageHook; - - // for controlling when to send posted events - QAtomicInt serialNumber; - int lastSerialNumber, sendPostedEventsWindowsTimerId; - QAtomicInt wakeUps; - - // timers - WinTimerVec timerVec; - WinTimerDict timerDict; - void registerTimer(WinTimerInfo *t); - void unregisterTimer(WinTimerInfo *t, bool closingDown = false); - void sendTimerEvent(int timerId); - - // socket notifiers - QSNDict sn_read; - QSNDict sn_write; - QSNDict sn_except; - void doWsaAsyncSelect(int socket); - - QList winEventNotifierList; - void activateEventNotifier(QWinEventNotifier * wen); - - QList queuedUserInputEvents; - QList queuedSocketEvents; -}; - QEventDispatcherWin32Private::QEventDispatcherWin32Private() : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), wakeUps(0) @@ -703,6 +635,10 @@ QEventDispatcherWin32::QEventDispatcherWin32(QObject *parent) { } +QEventDispatcherWin32::QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent) + : QAbstractEventDispatcher(dd, parent) +{ } + QEventDispatcherWin32::~QEventDispatcherWin32() { } diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index 8fa77fdc4ed..4a7aac0c045 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -56,6 +56,8 @@ #include "QtCore/qabstracteventdispatcher.h" #include "QtCore/qt_windows.h" +#include "qabstracteventdispatcher_p.h" + QT_BEGIN_NAMESPACE class QWinEventNotifier; @@ -100,11 +102,80 @@ public: bool event(QEvent *e); +protected: + QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent = 0); + private: friend LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); friend LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int, WPARAM, LPARAM); }; +struct QSockNot { + QSocketNotifier *obj; + int fd; +}; +typedef QHash QSNDict; + +struct WinTimerInfo { // internal timer info + QObject *dispatcher; + int timerId; + int interval; + QObject *obj; // - object to receive events + bool inTimerEvent; + int fastTimerId; +}; + +class QZeroTimerEvent : public QTimerEvent +{ +public: + inline QZeroTimerEvent(int timerId) + : QTimerEvent(timerId) + { t = QEvent::ZeroTimerEvent; } +}; + +typedef QList WinTimerVec; // vector of TimerInfo structs +typedef QHash WinTimerDict; // fast dict of timers + +class Q_CORE_EXPORT QEventDispatcherWin32Private : public QAbstractEventDispatcherPrivate +{ + Q_DECLARE_PUBLIC(QEventDispatcherWin32) +public: + QEventDispatcherWin32Private(); + ~QEventDispatcherWin32Private(); + + DWORD threadId; + + bool interrupt; + + // internal window handle used for socketnotifiers/timers/etc + HWND internalHwnd; + HHOOK getMessageHook; + + // for controlling when to send posted events + QAtomicInt serialNumber; + int lastSerialNumber, sendPostedEventsWindowsTimerId; + QAtomicInt wakeUps; + + // timers + WinTimerVec timerVec; + WinTimerDict timerDict; + void registerTimer(WinTimerInfo *t); + void unregisterTimer(WinTimerInfo *t, bool closingDown = false); + void sendTimerEvent(int timerId); + + // socket notifiers + QSNDict sn_read; + QSNDict sn_write; + QSNDict sn_except; + void doWsaAsyncSelect(int socket); + + QList winEventNotifierList; + void activateEventNotifier(QWinEventNotifier * wen); + + QList queuedUserInputEvents; + QList queuedSocketEvents; +}; + QT_END_NAMESPACE #endif // QEVENTDISPATCHER_WIN_P_H diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index f241903cb93..c97f9d260ed 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -265,19 +265,16 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ QT_ADD_STATIC_METATYPE("QEasingCurve", QMetaType::QEasingCurve), /* All GUI types */ - QT_ADD_STATIC_METATYPE("QColorGroup", 63), QT_ADD_STATIC_METATYPE("QFont", QMetaType::QFont), QT_ADD_STATIC_METATYPE("QPixmap", QMetaType::QPixmap), QT_ADD_STATIC_METATYPE("QBrush", QMetaType::QBrush), QT_ADD_STATIC_METATYPE("QColor", QMetaType::QColor), QT_ADD_STATIC_METATYPE("QPalette", QMetaType::QPalette), - QT_ADD_STATIC_METATYPE("QIcon", QMetaType::QIcon), QT_ADD_STATIC_METATYPE("QImage", QMetaType::QImage), QT_ADD_STATIC_METATYPE("QPolygon", QMetaType::QPolygon), QT_ADD_STATIC_METATYPE("QRegion", QMetaType::QRegion), QT_ADD_STATIC_METATYPE("QBitmap", QMetaType::QBitmap), QT_ADD_STATIC_METATYPE("QCursor", QMetaType::QCursor), - QT_ADD_STATIC_METATYPE("QSizePolicy", QMetaType::QSizePolicy), QT_ADD_STATIC_METATYPE("QKeySequence", QMetaType::QKeySequence), QT_ADD_STATIC_METATYPE("QPen", QMetaType::QPen), QT_ADD_STATIC_METATYPE("QTextLength", QMetaType::QTextLength), @@ -290,6 +287,10 @@ static const struct { const char * typeName; int typeNameLength; int type; } typ QT_ADD_STATIC_METATYPE("QVector4D", QMetaType::QVector4D), QT_ADD_STATIC_METATYPE("QQuaternion", QMetaType::QQuaternion), + /* All Widgets types */ + QT_ADD_STATIC_METATYPE("QIcon", QMetaType::QIcon), + QT_ADD_STATIC_METATYPE("QSizePolicy", QMetaType::QSizePolicy), + /* All Metatype builtins */ QT_ADD_STATIC_METATYPE("void*", QMetaType::VoidStar), QT_ADD_STATIC_METATYPE("long", QMetaType::Long), @@ -338,6 +339,7 @@ struct QMetaTypeGuiHelper #endif }; Q_CORE_EXPORT const QMetaTypeGuiHelper *qMetaTypeGuiHelper = 0; +Q_CORE_EXPORT const QMetaTypeGuiHelper *qMetaTypeWidgetsHelper = 0; class QCustomTypeInfo { @@ -399,14 +401,17 @@ void QMetaType::registerStreamOperators(int idx, SaveOperator saveOp, */ const char *QMetaType::typeName(int type) { - enum { GuiTypeCount = LastGuiType - FirstGuiType }; + enum { GuiTypeCount = LastGuiType - FirstGuiType, + WidgetsTypeCount = LastWidgetsType - FirstWidgetsType }; if (type >= 0 && type <= LastCoreType) { return types[type].typeName; } else if (type >= FirstGuiType && type <= LastGuiType) { return types[type - FirstGuiType + LastCoreType + 1].typeName; + } else if (type >= FirstWidgetsType && type <= LastWidgetsType) { + return types[type - FirstWidgetsType + GuiTypeCount + LastCoreType + 2].typeName; } else if (type >= FirstCoreExtType && type <= LastCoreExtType) { - return types[type - FirstCoreExtType + GuiTypeCount + LastCoreType + 2].typeName; + return types[type - FirstCoreExtType + GuiTypeCount + WidgetsTypeCount + LastCoreType + 3].typeName; } else if (type >= User) { const QVector * const ct = customTypes(); QReadLocker locker(customTypesLock()); @@ -765,13 +770,11 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) case QMetaType::QBrush: case QMetaType::QColor: case QMetaType::QPalette: - case QMetaType::QIcon: case QMetaType::QImage: case QMetaType::QPolygon: case QMetaType::QRegion: case QMetaType::QBitmap: case QMetaType::QCursor: - case QMetaType::QSizePolicy: case QMetaType::QKeySequence: case QMetaType::QPen: case QMetaType::QTextLength: @@ -787,6 +790,12 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) return false; qMetaTypeGuiHelper[type - FirstGuiType].saveOp(stream, data); break; + case QMetaType::QIcon: + case QMetaType::QSizePolicy: + if (!qMetaTypeWidgetsHelper) + return false; + qMetaTypeWidgetsHelper[type - FirstWidgetsType].saveOp(stream, data); + break; default: { const QVector * const ct = customTypes(); if (!ct) @@ -967,13 +976,11 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) case QMetaType::QBrush: case QMetaType::QColor: case QMetaType::QPalette: - case QMetaType::QIcon: case QMetaType::QImage: case QMetaType::QPolygon: case QMetaType::QRegion: case QMetaType::QBitmap: case QMetaType::QCursor: - case QMetaType::QSizePolicy: case QMetaType::QKeySequence: case QMetaType::QPen: case QMetaType::QTextLength: @@ -989,6 +996,12 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) return false; qMetaTypeGuiHelper[type - FirstGuiType].loadOp(stream, data); break; + case QMetaType::QIcon: + case QMetaType::QSizePolicy: + if (!qMetaTypeWidgetsHelper) + return false; + qMetaTypeWidgetsHelper[type - FirstWidgetsType].loadOp(stream, data); + break; default: { const QVector * const ct = customTypes(); if (!ct) @@ -1218,6 +1231,10 @@ void *QMetaType::construct(int type, const void *copy) if (!qMetaTypeGuiHelper) return 0; constr = qMetaTypeGuiHelper[type - FirstGuiType].constr; + } else if (type >= FirstWidgetsType && type <= LastWidgetsType) { + if (!qMetaTypeWidgetsHelper) + return 0; + constr = qMetaTypeWidgetsHelper[type - FirstWidgetsType].constr; } else { const QVector * const ct = customTypes(); QReadLocker locker(customTypesLock()); @@ -1380,6 +1397,12 @@ void QMetaType::destroy(int type, void *data) if (!qMetaTypeGuiHelper) return; destr = qMetaTypeGuiHelper[type - FirstGuiType].destr; + } else if (type >= FirstWidgetsType && type <= LastWidgetsType) { + Q_ASSERT(qMetaTypeWidgetsHelper); + + if (!qMetaTypeWidgetsHelper) + return; + destr = qMetaTypeWidgetsHelper[type - FirstWidgetsType].destr; } else { QReadLocker locker(customTypesLock()); if (type < User || !ct || ct->count() <= type - User) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 767d79a14e9..5df7658a132 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -71,16 +71,20 @@ public: QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, QRegExp = 27, QVariantHash = 28, QEasingCurve = 29, LastCoreType = QEasingCurve, - FirstGuiType = 63 /* QColorGroup */, + FirstGuiType = 64 /* QFont */, QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68, - QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73, - QCursor = 74, QSizePolicy = 75, QKeySequence = 76, QPen = 77, - QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81, - QMatrix4x4 = 82, QVector2D = 83, QVector3D = 84, QVector4D = 85, - QQuaternion = 86, + QImage = 69, QPolygon = 70, QRegion = 71, QBitmap = 72, + QCursor = 73, QKeySequence = 74, QPen = 75, + QTextLength = 76, QTextFormat = 77, QMatrix = 78, QTransform = 79, + QMatrix4x4 = 80, QVector2D = 81, QVector3D = 82, QVector4D = 83, + QQuaternion = 84, LastGuiType = QQuaternion, + FirstWidgetsType = 120, /* QIcon */ + QIcon = 120, QSizePolicy = 121, + LastWidgetsType = QSizePolicy, + FirstCoreExtType = 128 /* VoidStar */, VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132, UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137, diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index b769beac03a..0f314d45f16 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -177,6 +177,7 @@ QObjectPrivate::QObjectPrivate(int version) #endif metaObject = 0; hasGuards = false; + isWindow = false; } QObjectPrivate::~QObjectPrivate() diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 59ff988ba90..591c5c88bff 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -102,7 +102,8 @@ public: uint inEventHandler : 1; //only used if QT_JAMBI_BUILD uint inThreadChangeEvent : 1; uint hasGuards : 1; //true iff there is one or more QPointer attached to this object - uint unused : 22; + uint isWindow : 1; //for QWindow + uint unused : 21; int postedEvents; QMetaObject *metaObject; // assert dynamic }; @@ -144,6 +145,7 @@ public: void setObjectName(const QString &name); inline bool isWidgetType() const { return d_ptr->isWidget; } + inline bool isWindowType() const { return d_ptr->isWindow; } inline bool signalsBlocked() const { return d_ptr->blockSig; } bool blockSignals(bool b); diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index de8f9111f95..e77fc90b92f 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -132,26 +132,27 @@ class Q_CORE_EXPORT QVariant Brush = 66, Color = 67, Palette = 68, - Icon = 69, - Image = 70, - Polygon = 71, - Region = 72, - Bitmap = 73, - Cursor = 74, - SizePolicy = 75, - KeySequence = 76, - Pen = 77, - TextLength = 78, - TextFormat = 79, - Matrix = 80, - Transform = 81, - Matrix4x4 = 82, - Vector2D = 83, - Vector3D = 84, - Vector4D = 85, - Quaternion = 86, + Image = 69, + Polygon = 70, + Region = 71, + Bitmap = 72, + Cursor = 73, + KeySequence = 74, + Pen = 75, + TextLength = 76, + TextFormat = 77, + Matrix = 78, + Transform = 79, + Matrix4x4 = 80, + Vector2D = 81, + Vector3D = 82, + Vector4D = 83, + Quaternion = 84, LastGuiType = Quaternion, + Icon = 120, + SizePolicy = 121, + UserType = 127, LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type }; diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h index 5559489767a..15825c699fa 100644 --- a/src/corelib/plugin/qlibrary_p.h +++ b/src/corelib/plugin/qlibrary_p.h @@ -53,7 +53,7 @@ // We mean it. // -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN # include "QtCore/qt_windows.h" #endif #include "QtCore/qlibrary.h" @@ -72,7 +72,7 @@ class QLibraryPrivate { public: -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN HINSTANCE #else void * diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 02a63bb92d6..aeb118ffe53 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -176,12 +176,12 @@ QThreadPrivate::QThreadPrivate(QThreadData *d) { #if defined (Q_OS_UNIX) thread_id = 0; -#elif defined (Q_WS_WIN) +#elif defined (Q_OS_WIN) handle = 0; id = 0; waiters = 0; #endif -#if defined (Q_WS_WIN) || defined (Q_OS_SYMBIAN) +#if defined (Q_OS_WIN) || defined (Q_OS_SYMBIAN) terminationEnabled = true; terminatePending = false; #endif diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index ac5d6c4a8e6..3d3bc55d714 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -51,7 +51,7 @@ #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) #include #endif -#ifndef Q_WS_WIN +#ifndef Q_OS_WIN #include #endif @@ -2519,7 +2519,7 @@ QString QDateTime::toString(Qt::DateFormat f) const } #ifndef QT_NO_TEXTDATE else if (f == Qt::TextDate) { -#ifndef Q_WS_WIN +#ifndef Q_OS_WIN buf = d->date.shortDayName(d->date.dayOfWeek()); buf += QLatin1Char(' '); buf += d->date.shortMonthName(d->date.month()); diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 36c4ae75a5c..d2bb752c6de 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -39,6 +39,11 @@ ** ****************************************************************************/ +#if !defined(QWS) && defined(Q_OS_MAC) +# include "private/qcore_mac_p.h" +# include +#endif + #include "qglobal.h" #ifndef QT_NO_SYSTEMLOCALE @@ -61,14 +66,10 @@ QT_END_NAMESPACE #include "qstringlist.h" #include "qvariant.h" #include "qstringbuilder.h" -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) # include "qt_windows.h" # include #endif -#if !defined(QWS) && defined(Q_OS_MAC) -# include "private/qcore_mac_p.h" -# include -#endif #include "private/qnumeric_p.h" #include "private/qsystemlibrary_p.h" diff --git a/src/gui/dialogs/qprintdialog_qws.cpp b/src/gui/dialogs/qprintdialog_qws.cpp deleted file mode 100644 index 49e1eaa11d9..00000000000 --- a/src/gui/dialogs/qprintdialog_qws.cpp +++ /dev/null @@ -1,567 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformdefs.h" - -#include -#include "qprintdialog.h" - -#ifndef QT_NO_PRINTDIALOG - -#include "qapplication.h" -#include "qbuttongroup.h" -#include "qradiobutton.h" -#include "qcombobox.h" -#include "qspinbox.h" -#include "qprinter.h" -#include "qlineedit.h" -#include "qdir.h" -#include "qmessagebox.h" -#include "qinputdialog.h" -#include "qlayout.h" -#include "qlabel.h" - -#include "qlibrary.h" - -#ifndef QT_NO_NIS - -#ifndef BOOL_DEFINED -#define BOOL_DEFINED -#endif - -#include -#include - -#endif //QT_NO_NIS - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -typedef void (*QPrintDialogCreator)(QPrintDialog *parent); -Q_GUI_EXPORT QPrintDialogCreator _qt_print_dialog_creator; - -class QPrintDialogPrivate : public QAbstractPrintDialogPrivate -{ - Q_DECLARE_PUBLIC(QPrintDialog) -public: - QButtonGroup *printerOrFile; - bool outputToFile; - QRadioButton *printToPrinterButton; - QRadioButton *printToFileButton; - QLineEdit *fileName; - - QButtonGroup *colorMode; - QRadioButton *printColor; - QRadioButton *printGray; - QPrinter::ColorMode colorMode2; - - QComboBox *orientationCombo, *sizeCombo; - QPrinter::PaperSize pageSize; - QPrinter::Orientation orientation; - - QSpinBox *copies; - int numCopies; - QPrinter::PaperSize indexToPaperSize[QPrinter::NPaperSize]; - - QComboBox *rangeCombo; - QSpinBox *firstPage; - QSpinBox *lastPage; - - QComboBox *pageOrderCombo; - QPrinter::PageOrder pageOrder2; - - QString faxNum; - - void init(); - - void _q_okClicked(); - void _q_printerOrFileSelected(QAbstractButton *b); - void _q_paperSizeSelected(int); - void _q_orientSelected(int); - void _q_pageOrderSelected(int); - void _q_colorModeSelected(QAbstractButton *); - void _q_setNumCopies(int); - void _q_printRangeSelected(int); - void _q_setFirstPage(int); - void _q_setLastPage(int); - void _q_fileNameEditChanged(const QString &text); - - void setupDestination(); - void setupPrinterSettings(); - void setupPaper(); - void setupOptions(); - - void setPrinter(QPrinter *p, bool pickUpSettings); -}; - -static void isc(QPrintDialogPrivate *d, const QString & text, - QPrinter::PaperSize ps); - -void QPrintDialogPrivate::_q_okClicked() -{ - Q_Q(QPrintDialog); -#ifndef QT_NO_MESSAGEBOX - if (outputToFile && fileName->isModified() && QFileInfo(fileName->text()).exists()) { - int confirm = QMessageBox::warning( - q, QPrintDialog::tr("File exists"), - QPrintDialog::tr("Do you want to overwrite it?"), - QMessageBox::Yes, QMessageBox::No); - if (confirm == QMessageBox::No) - return; - } -#endif // QT_NO_MESSAGEBOX - - lastPage->interpretText(); - firstPage->interpretText(); - copies->interpretText(); - if (outputToFile) { - printer->setOutputFileName(fileName->text()); - } - printer->setOrientation(orientation); - printer->setPaperSize(pageSize); - printer->setPageOrder(pageOrder2); - printer->setColorMode(colorMode2); - printer->setCopyCount(numCopies); - - switch ((rangeCombo->itemData(rangeCombo->currentIndex())).toInt()){ - case (int)QPrintDialog::AllPages: - q->setPrintRange(QPrintDialog::AllPages); - q->setFromTo(0, 0); - break; - case (int)QPrintDialog::Selection: - q->setPrintRange(QPrintDialog::Selection); - q->setFromTo(0, 0); - break; - case (int)QPrintDialog::PageRange: - q->setPrintRange(QPrintDialog::PageRange); - q->setFromTo(firstPage->value(), lastPage->value()); - break; - case (int)QPrintDialog::CurrentPage: - q->setPrintRange(QPrintDialog::CurrentPage); - q->setFromTo(0, 0); - break; - } - q->accept(); -} - -void QPrintDialogPrivate::_q_printerOrFileSelected(QAbstractButton *b) -{ - outputToFile = (b == printToFileButton); - if (outputToFile) { - _q_fileNameEditChanged(fileName->text()); - if (!fileName->isModified() && fileName->text().isEmpty()) { - QString file = "print.tiff"; - fileName->setText(file); - fileName->setCursorPosition(file.length()); - fileName->selectAll(); - fileName->setModified(true); // confirm overwrite when OK clicked - - } - fileName->setEnabled(true); - fileName->setFocus(); - } else { - fileName->setText(QString()); - if (fileName->isEnabled()) - fileName->setEnabled(false); - } -} - -void QPrintDialogPrivate::_q_paperSizeSelected(int id) -{ - if (id < QPrinter::NPaperSize) - pageSize = QPrinter::PaperSize(indexToPaperSize[id]); -} - -void QPrintDialogPrivate::_q_orientSelected(int id) -{ - orientation = (QPrinter::Orientation)id; -} - -void QPrintDialogPrivate::_q_pageOrderSelected(int id) -{ - pageOrder2 = (QPrinter::PageOrder)id; -} - -void QPrintDialogPrivate::_q_colorModeSelected(QAbstractButton *b) -{ - colorMode2 = (b == printColor) ? QPrinter::Color : QPrinter::GrayScale; -} - -void QPrintDialogPrivate::_q_setNumCopies(int copies) -{ - numCopies = copies; -} - -void QPrintDialogPrivate::_q_printRangeSelected(int id) -{ - bool enable = (rangeCombo->itemData(id).toInt() == (int)QPrintDialog::PageRange); - firstPage->setEnabled(enable); - lastPage->setEnabled(enable); -} - -void QPrintDialogPrivate::_q_setFirstPage(int fp) -{ - Q_Q(QPrintDialog); - if (printer) { - lastPage->setMinimum(fp); - lastPage->setMaximum(qMax(fp, q->maxPage())); - } -} - -void QPrintDialogPrivate::_q_setLastPage(int lp) -{ - Q_Q(QPrintDialog); - if (printer) { - firstPage->setMinimum(qMin(lp, q->minPage())); - firstPage->setMaximum(lp); - } -} - -void QPrintDialogPrivate::_q_fileNameEditChanged(const QString &text) -{ - Q_UNUSED(text); -} - -void QPrintDialogPrivate::setupDestination() -{ - Q_Q(QPrintDialog); - - // print destinations - printerOrFile = new QButtonGroup(q); - QObject::connect(printerOrFile, SIGNAL(buttonClicked(QAbstractButton*)), - q, SLOT(_q_printerOrFileSelected(QAbstractButton*))); - - printToPrinterButton = q->findChild("printToPrinterButton"); - printerOrFile->addButton(printToPrinterButton); - printToFileButton = q->findChild("printToFileButton"); - printerOrFile->addButton(printToFileButton); - - // file name - fileName = q->findChild("fileName"); - QObject::connect(fileName, SIGNAL(textChanged(QString)), - q, SLOT(_q_fileNameEditChanged(QString))); - - outputToFile = false; -} - -void QPrintDialogPrivate::setupPrinterSettings() -{ - Q_Q(QPrintDialog); - - // color mode - colorMode = new QButtonGroup(q); - QObject::connect(colorMode, SIGNAL(buttonClicked(QAbstractButton*)), - q, SLOT(_q_colorModeSelected(QAbstractButton*))); - - printColor = q->findChild("printColor"); - colorMode->addButton(printColor); - printGray = q->findChild("printGray"); - colorMode->addButton(printGray); -} - -void isc(QPrintDialogPrivate *ptr, const QString & text, QPrinter::PaperSize ps) -{ - if (ptr && !text.isEmpty() && ps < QPrinter::NPaperSize) { - ptr->sizeCombo->addItem(text); - int index = ptr->sizeCombo->count()-1; - if (index >= 0 && index < QPrinter::NPaperSize) - ptr->indexToPaperSize[index] = ps; - } -} - -void QPrintDialogPrivate::setupPaper() -{ - Q_Q(QPrintDialog); - - pageSize = QPrinter::A4; - - // paper orientation - orientationCombo = q->findChild("orientationCombo"); - orientation = QPrinter::Portrait; - QObject::connect(orientationCombo, SIGNAL(activated(int)), - q, SLOT(_q_orientSelected(int))); - - // paper size - sizeCombo = q->findChild("sizeCombo"); - - int n; - for(n=0; nfindChild("copies"); - QObject::connect(copies, SIGNAL(valueChanged(int)), - q, SLOT(_q_setNumCopies(int))); - - // print range - rangeCombo = q->findChild("rangeCombo"); - rangeCombo->addItem(QPrintDialog::tr("Print all"), QPrintDialog::AllPages); - rangeCombo->addItem(QPrintDialog::tr("Print selection"), QPrintDialog::Selection); - rangeCombo->addItem(QPrintDialog::tr("Print range"), QPrintDialog::PageRange); - rangeCombo->addItem(QPrintDialog::tr("Print current page"), QPrintDialog::CurrentPage); - QObject::connect(rangeCombo, SIGNAL(activated(int)), - q, SLOT(_q_printRangeSelected(int))); - - // page range - firstPage = q->findChild("firstPage"); - firstPage->setRange(1, 9999); - firstPage->setValue(1); - QObject::connect(firstPage, SIGNAL(valueChanged(int)), - q, SLOT(_q_setFirstPage(int))); - - lastPage = q->findChild("lastPage"); - lastPage->setRange(1, 9999); - lastPage->setValue(1); - QObject::connect(lastPage, SIGNAL(valueChanged(int)), - q, SLOT(_q_setLastPage(int))); - - // print order - pageOrderCombo = q->findChild("pageOrderCombo"); - QObject::connect(pageOrderCombo, SIGNAL(activated(int)), - q, SLOT(_q_pageOrderSelected(int))); -} - -bool QPrintDialog::eventFilter(QObject *o, QEvent *e) -{ - Q_UNUSED(o); - - Q_D(QPrintDialog); - switch (e->type()){ - case QEvent::KeyPress: - switch (static_cast(e)->key()) { - case Qt::Key_Back: - d->_q_okClicked(); - return true; - } - break; - default: - break; - } - return false; -} - -QPrintDialog::QPrintDialog(QPrinter *printer, QWidget *parent) - : QAbstractPrintDialog(*(new QPrintDialogPrivate), printer, parent) -{ - d_func()->init(); -} - -QPrintDialog::QPrintDialog(QWidget *parent) - : QAbstractPrintDialog(*(new QPrintDialogPrivate), 0, parent) -{ - d_func()->init(); -} - -QPrintDialog::~QPrintDialog() -{ -} - -void QPrintDialogPrivate::setPrinter(QPrinter *p, bool pickUpSettings) -{ - Q_Q(QPrintDialog); - printer = p; - - if (p && pickUpSettings) { - // top to bottom in the old dialog. - // printer or file - outputToFile = !p->outputFileName().isEmpty() && q->isOptionEnabled(QPrintDialog::PrintToFile); - if (outputToFile) - printToFileButton->setChecked(true); - else - printToPrinterButton->setChecked(true); - fileName->setEnabled(outputToFile); - - // file name - if (q->isOptionEnabled(QPrintDialog::PrintToFile)) { - fileName->setText(p->outputFileName()); - fileName->setModified(!fileName->text().isEmpty()); - } else { - printToFileButton->setEnabled(false); - } - - // orientation - orientationCombo->setCurrentIndex((int)p->orientation()); - _q_orientSelected(p->orientation()); - - // page size - int n = 0; - while (n < QPrinter::NPaperSize && - indexToPaperSize[n] != p->pageSize()) - n++; - sizeCombo->setCurrentIndex(n); - _q_paperSizeSelected(n); - - // page order - pageOrder2 = p->pageOrder(); - pageOrderCombo->setCurrentIndex((int)pageOrder2); - - // color mode - colorMode2 = p->colorMode(); - if (colorMode2 == QPrinter::Color) - printColor->setChecked(true); - else - printGray->setChecked(true); - - // number of copies - copies->setValue(p->copyCount()); - _q_setNumCopies(p->copyCount()); - } - - if (p) { - if (!q->isOptionEnabled(QPrintDialog::PrintSelection) - && rangeCombo->findData(QPrintDialog::Selection) > 0) - rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::Selection)); - if (!q->isOptionEnabled(QPrintDialog::PrintPageRange) - && rangeCombo->findData(QPrintDialog::PageRange) > 0) - rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::PageRange)); - if (!q->isOptionEnabled(QPrintDialog::PrintCurrentPage) - && rangeCombo->findData(QPrintDialog::CurrentPage) > 0) - rangeCombo->removeItem(rangeCombo->findData(QPrintDialog::CurrentPage)); - - switch (q->printRange()) { - case QPrintDialog::AllPages: - rangeCombo->setCurrentIndex((int)(QPrintDialog::AllPages)); - break; - case QPrintDialog::Selection: - rangeCombo->setCurrentIndex((int)(QPrintDialog::Selection)); - break; - case QPrintDialog::PageRange: - rangeCombo->setCurrentIndex((int)(QPrintDialog::PageRange)); - break; - case QPrintDialog::CurrentPage: - rangeCombo->setCurrentIndex((int)(QPrintDialog::CurrentPage)); - break; - } - } - - if (p && q->maxPage()) { - int from = q->minPage(); - int to = q->maxPage(); - if (q->printRange() == QPrintDialog::PageRange) { - from = q->fromPage(); - to = q->toPage(); - } - firstPage->setRange(q->minPage(), to); - lastPage->setRange(from, q->maxPage()); - firstPage->setValue(from); - lastPage->setValue(to); - } -} - -int QPrintDialog::exec() -{ - Q_D(QPrintDialog); - d->setPrinter(d->printer, true); - return QDialog::exec(); -} - -void QPrintDialogPrivate::init() -{ - Q_Q(QPrintDialog); - numCopies = 1; - - if (_qt_print_dialog_creator) - (*_qt_print_dialog_creator)(q); - - setupDestination(); - setupPrinterSettings(); - setupPaper(); - setupOptions(); - - setPrinter(printer, true); - - q->installEventFilter(q); -} - -void QPrintDialog::setVisible(bool visible) -{ - QAbstractPrintDialog::setVisible(visible); -} - -QT_END_NAMESPACE - -#include "moc_qprintdialog.cpp" -#include "qrc_qprintdialog.cpp" - -#endif // QT_NO_PRINTDIALOG diff --git a/src/gui/effects/effects.pri b/src/gui/effects/effects.pri deleted file mode 100644 index 0ebf96fccbc..00000000000 --- a/src/gui/effects/effects.pri +++ /dev/null @@ -1,4 +0,0 @@ -HEADERS += effects/qgraphicseffect.h \ - effects/qgraphicseffect_p.h - -SOURCES += effects/qgraphicseffect.cpp diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index 8e8664c679b..ec23da3312d 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -25,19 +25,15 @@ contains(QT_CONFIG, egl): { wince*: SOURCES += egl/qegl_wince.cpp unix { - embedded { - SOURCES += egl/qegl_qws.cpp - } else { - qpa { - SOURCES += egl/qegl_qpa.cpp - } else { - symbian { - SOURCES += egl/qegl_symbian.cpp - } else { - SOURCES += egl/qegl_x11.cpp - } - } - } + qpa { + SOURCES += egl/qegl_qpa.cpp + } else { + symbian { + SOURCES += egl/qegl_symbian.cpp + } else { + SOURCES += egl/qegl_x11.cpp + } + } } } else:symbian { DEFINES += QT_NO_EGL diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 9b0d82e69f9..e0c02aa150c 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -47,7 +47,7 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience of -// the QtOpenGL and QtOpenVG modules. This header file may change from +// the QtGui and QtOpenVG modules. This header file may change from // version to version without notice, or even be removed. // // We mean it. diff --git a/src/gui/egl/qegl_qpa.cpp b/src/gui/egl/qegl_qpa.cpp index 9b99e8b94a9..c3eb044b22e 100644 --- a/src/gui/egl/qegl_qpa.cpp +++ b/src/gui/egl/qegl_qpa.cpp @@ -46,7 +46,6 @@ #if !defined(QT_NO_EGL) -#include #include #include @@ -75,7 +74,7 @@ EGLNativePixmapType QEgl::nativePixmap(QPixmap* pixmap) static QPlatformScreen *screenForDevice(QPaintDevice *device) { - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); + QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration(); QList screens = pi->screens(); @@ -95,7 +94,7 @@ void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev) if (!dev) return; - // Find the QGLScreen for this paint device. + // Find the QOpenGLScreen for this paint device. QPlatformScreen *screen = screenForDevice(dev); if (!screen) return; diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp deleted file mode 100644 index b39f4dc5218..00000000000 --- a/src/gui/egl/qegl_qws.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "qegl_p.h" -#include "qeglcontext_p.h" - -#if !defined(QT_NO_EGL) - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -static QScreen *screenForDevice(QPaintDevice *device) -{ - QScreen *screen = qt_screen; - if (!screen) - return 0; - if (screen->classId() == QScreen::MultiClass) { - int screenNumber; - if (device && device->devType() == QInternal::Widget) - screenNumber = qApp->desktop()->screenNumber(static_cast(device)); - else - screenNumber = 0; - screen = screen->subScreens()[screenNumber]; - } - while (screen->classId() == QScreen::ProxyClass || - screen->classId() == QScreen::TransformedClass) { - screen = static_cast(screen)->screen(); - } - return screen; -} - -// 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. - QScreen *screen = screenForDevice(dev); - if (!screen) - return; - int devType = dev->devType(); - if (devType == QInternal::Image) - setPixelFormat(static_cast(dev)->format()); - else - setPixelFormat(screen->pixelFormat()); -} - -EGLNativeDisplayType QEgl::nativeDisplay() -{ - return EGLNativeDisplayType(EGL_DEFAULT_DISPLAY); -} - -EGLNativeWindowType QEgl::nativeWindow(QWidget* widget) -{ - return (EGLNativeWindowType)(widget->winId()); // Might work -} - -EGLNativePixmapType QEgl::nativePixmap(QPixmap*) -{ - qWarning("QEgl: EGL pixmap surfaces not supported on QWS"); - return (EGLNativePixmapType)0; -} - - -QT_END_NAMESPACE - -#endif // !QT_NO_EGL diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index c0f8a240fb1..4fd8a151576 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include @@ -339,14 +339,14 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg return EGL_NO_SURFACE; } - QX11PixmapData *x11PixmapData = 0; + QX11PlatformPixmap *x11PlatformPixmap = 0; if (devType == QInternal::Pixmap) { - QPixmapData *pmd = static_cast(device)->data_ptr().data(); - if (pmd->classId() == QPixmapData::X11Class) - x11PixmapData = static_cast(pmd); + QPlatformPixmap *pmd = static_cast(device)->data_ptr().data(); + if (pmd->classId() == QPlatformPixmap::X11Class) + x11PlatformPixmap = static_cast(pmd); else { - // TODO: Replace the pixmap's data with a new QX11PixmapData - qWarning("WARNING: Creating an EGL surface on a QPixmap is only supported for QX11PixmapData"); + // TODO: Replace the pixmap's data with a new QX11PlatformPixmap + qWarning("WARNING: Creating an EGL surface on a QPixmap is only supported for QX11PlatformPixmap"); return EGL_NO_SURFACE; } } else if ((devType != QInternal::Widget) && (devType != QInternal::Pbuffer)) { @@ -426,11 +426,11 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg return surf; } - if (x11PixmapData) { + if (x11PlatformPixmap) { // X11 Pixmaps are only created with a depth, so that's all we need to check EGLint configDepth; eglGetConfigAttrib(QEgl::display(), config, EGL_BUFFER_SIZE , &configDepth); - if (x11PixmapData->depth() != configDepth) { + if (x11PlatformPixmap->depth() != configDepth) { // The bit depths are wrong which means the EGLConfig isn't compatable with // this pixmap. So we need to replace the pixmap's existing data with a new // one which is created with the correct depth: @@ -438,13 +438,13 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg #ifndef QT_NO_XRENDER if (configDepth == 32) { qWarning("Warning: EGLConfig's depth (32) != pixmap's depth (%d), converting to ARGB32", - x11PixmapData->depth()); - x11PixmapData->convertToARGB32(true); + x11PlatformPixmap->depth()); + x11PlatformPixmap->convertToARGB32(true); } else #endif { qWarning("Warning: EGLConfig's depth (%d) != pixmap's depth (%d)", - configDepth, x11PixmapData->depth()); + configDepth, x11PlatformPixmap->depth()); } } @@ -458,10 +458,10 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg surfaceAttribs.setValue(EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB); EGLSurface surf = eglCreatePixmapSurface(QEgl::display(), config, - (EGLNativePixmapType) x11PixmapData->handle(), + (EGLNativePixmapType) x11PlatformPixmap->handle(), surfaceAttribs.properties()); - x11PixmapData->gl_surface = (void*)surf; - QImagePixmapCleanupHooks::enableCleanupHooks(x11PixmapData); + x11PlatformPixmap->gl_surface = (void*)surf; + QImagePixmapCleanupHooks::enableCleanupHooks(x11PlatformPixmap); return surf; } diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h index 6cd76b386c4..7ea18627d14 100644 --- a/src/gui/egl/qeglcontext_p.h +++ b/src/gui/egl/qeglcontext_p.h @@ -47,7 +47,7 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience of -// the QtOpenGL and QtOpenVG modules. This header file may change from +// the QtGui and QtOpenVG modules. This header file may change from // version to version without notice, or even be removed. // // We mean it. @@ -109,7 +109,7 @@ private: static void setCurrentContext(QEgl::API api, QEglContext *context); friend class QMeeGoGraphicsSystem; - friend class QMeeGoPixmapData; + friend class QMeeGoPlatformPixmap; }; QT_END_NAMESPACE diff --git a/src/gui/egl/qeglproperties_p.h b/src/gui/egl/qeglproperties_p.h index 2d03cd0494e..d8d64e01a1f 100644 --- a/src/gui/egl/qeglproperties_p.h +++ b/src/gui/egl/qeglproperties_p.h @@ -47,7 +47,7 @@ // ------------- // // This file is not part of the Qt API. It exists for the convenience -// of the QtOpenGL and QtOpenVG modules. This header file may change from +// of the QtGui and QtOpenVG modules. This header file may change from // version to version without notice, or even be removed. // // We mean it. diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri deleted file mode 100644 index 75d693e0b41..00000000000 --- a/src/gui/embedded/directfb.pri +++ /dev/null @@ -1,40 +0,0 @@ -# These defines might be necessary if your DirectFB driver doesn't -# support all of the DirectFB API. -# -#DEFINES += QT_DIRECTFB_SUBSURFACE -#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR -#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER -#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE -#DEFINES += QT_DIRECTFB_IMAGECACHE -#DEFINES += QT_NO_DIRECTFB_WM -#DEFINES += QT_NO_DIRECTFB_LAYER -#DEFINES += QT_DIRECTFB_PALETTE -#DEFINES += QT_NO_DIRECTFB_PREALLOCATED -#DEFINES += QT_NO_DIRECTFB_MOUSE -#DEFINES += QT_NO_DIRECTFB_KEYBOARD -#DEFINES += QT_DIRECTFB_TIMING -#DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION -#DEFINES += QT_NO_DIRECTFB_STRETCHBLIT -DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS|DRAW_ROUNDED_RECT|DRAW_STATICTEXT -#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" -#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" - -HEADERS += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h - -SOURCES += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp \ - $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp - - -QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB -LIBS += $$QT_LIBS_DIRECTFB diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri deleted file mode 100644 index 31f0bc6d509..00000000000 --- a/src/gui/embedded/embedded.pri +++ /dev/null @@ -1,226 +0,0 @@ -# Qt for Embedded Linux - -embedded { - CONFIG -= opengl x11 - LIBS -= -dl - KERNEL_P = kernel - - !mac:HEADERS += embedded/qsoundqss_qws.h - HEADERS += \ - embedded/qcopchannel_qws.h \ - embedded/qdecoration_qws.h \ - embedded/qdecorationfactory_qws.h \ - embedded/qdecorationplugin_qws.h \ - embedded/qdirectpainter_qws.h \ - embedded/qlock_p.h \ - embedded/qscreen_qws.h \ - embedded/qscreenmulti_qws_p.h \ - embedded/qscreenproxy_qws.h \ - embedded/qwindowsystem_qws.h \ - embedded/qwindowsystem_p.h \ - embedded/qwscommand_qws_p.h \ - embedded/qwscursor_qws.h \ - embedded/qwsdisplay_qws.h \ - embedded/qwsdisplay_qws_p.h \ - embedded/qwsevent_qws.h \ - embedded/qwsmanager_qws.h \ - embedded/qwsmanager_p.h \ - embedded/qwsproperty_qws.h \ - embedded/qwsprotocolitem_qws.h \ - embedded/qtransportauth_qws.h \ - embedded/qtransportauth_qws_p.h \ - embedded/qtransportauthdefs_qws.h \ - embedded/qwssocket_qws.h \ - embedded/qwslock_p.h \ - embedded/qwsutils_qws.h \ - embedded/qwssharedmemory_p.h \ - embedded/qwssignalhandler_p.h \ - embedded/qwsembedwidget.h - - !mac:SOURCES += embedded/qsoundqss_qws.cpp - SOURCES += \ - embedded/qcopchannel_qws.cpp \ - embedded/qdecoration_qws.cpp \ - embedded/qdecorationfactory_qws.cpp \ - embedded/qdecorationplugin_qws.cpp \ - embedded/qdirectpainter_qws.cpp \ - embedded/qlock.cpp \ - embedded/qscreen_qws.cpp \ - embedded/qscreenmulti_qws.cpp \ - embedded/qscreenproxy_qws.cpp \ - embedded/qwindowsystem_qws.cpp \ - embedded/qwscommand_qws.cpp \ - embedded/qwscursor_qws.cpp \ - embedded/qwsevent_qws.cpp \ - embedded/qwsmanager_qws.cpp \ - embedded/qwsproperty_qws.cpp \ - embedded/qtransportauth_qws.cpp \ - embedded/qwslock.cpp \ - embedded/qwssharedmemory.cpp \ - embedded/qwssocket_qws.cpp \ - embedded/qwssignalhandler.cpp \ - embedded/qwsembedwidget.cpp - - contains(QT_CONFIG,sxe)|contains(QT_CONFIG,qtopia) { - SOURCES += embedded/qunixsocket.cpp embedded/qunixsocketserver.cpp - HEADERS += embedded/qunixsocket_p.h embedded/qunixsocketserver_p.h - } - -# -# Decorations -# - contains( decorations, default ) { - HEADERS += embedded/qdecorationdefault_qws.h - SOURCES += embedded/qdecorationdefault_qws.cpp - } - contains( decorations, styled ) { - HEADERS += embedded/qdecorationstyled_qws.h - SOURCES += embedded/qdecorationstyled_qws.cpp - } - - contains( decorations, windows ) { - HEADERS += embedded/qdecorationwindows_qws.h - SOURCES += embedded/qdecorationwindows_qws.cpp - } - -# -# Qt for Embedded Linux Drivers -# - HEADERS += embedded/qscreendriverplugin_qws.h \ - embedded/qscreendriverfactory_qws.h \ - embedded/qkbd_qws.h \ - embedded/qkbd_qws_p.h \ - embedded/qkbd_defaultmap_qws_p.h \ - embedded/qkbddriverplugin_qws.h \ - embedded/qkbddriverfactory_qws.h \ - embedded/qmouse_qws.h \ - embedded/qmousedriverplugin_qws.h \ - embedded/qmousedriverfactory_qws.h - - SOURCES += embedded/qscreendriverplugin_qws.cpp \ - embedded/qscreendriverfactory_qws.cpp \ - embedded/qkbd_qws.cpp \ - embedded/qkbddriverplugin_qws.cpp \ - embedded/qkbddriverfactory_qws.cpp \ - embedded/qmouse_qws.cpp \ - embedded/qmousedriverplugin_qws.cpp \ - embedded/qmousedriverfactory_qws.cpp - -# -# Graphics drivers -# - contains( gfx-drivers, linuxfb ) { - HEADERS += embedded/qscreenlinuxfb_qws.h - SOURCES += embedded/qscreenlinuxfb_qws.cpp - } - - contains( gfx-drivers, qnx ) { - HEADERS += embedded/qscreenqnx_qws.h - SOURCES += embedded/qscreenqnx_qws.cpp - LIBS += -lgf - } - - contains( gfx-drivers, integrityfb ) { - HEADERS += embedded/qscreenintegrityfb_qws.h - SOURCES += embedded/qscreenintegrityfb_qws.cpp - LIBS += -lfbdev - } - - contains( gfx-drivers, qvfb ) { - HEADERS += embedded/qscreenvfb_qws.h - SOURCES += embedded/qscreenvfb_qws.cpp - } - - - contains( gfx-drivers, vnc ) { - VNCDIR = $$QT_SOURCE_TREE/src/plugins/gfxdrivers/vnc - INCLUDEPATH += $$VNCDIR - HEADERS += $$VNCDIR/qscreenvnc_qws.h \ - $$VNCDIR/qscreenvnc_p.h - SOURCES += $$VNCDIR/qscreenvnc_qws.cpp - } - - contains( gfx-drivers, transformed ) { - HEADERS += embedded/qscreentransformed_qws.h - SOURCES += embedded/qscreentransformed_qws.cpp - } - - contains( gfx-drivers, directfb ) { - INCLUDEPATH += $$QT_SOURCE_TREE/src/plugins/gfxdrivers/directfb - include($$PWD/directfb.pri) - } -# -# Keyboard drivers -# - contains( kbd-drivers, qvfb ) { - HEADERS +=embedded/qkbdvfb_qws.h - SOURCES +=embedded/qkbdvfb_qws.cpp - !contains( kbd-drivers, qvfb ) { - kbd-drivers += qvfb - } - } - - contains( kbd-drivers, tty ) { - HEADERS +=embedded/qkbdtty_qws.h - SOURCES +=embedded/qkbdtty_qws.cpp - } - - contains( kbd-drivers, linuxinput ) { - HEADERS +=embedded/qkbdlinuxinput_qws.h - SOURCES +=embedded/qkbdlinuxinput_qws.cpp - } - - contains( kbd-drivers, um ) { - HEADERS +=embedded/qkbdum_qws.h - SOURCES +=embedded/qkbdum_qws.cpp - } - - contains( kbd-drivers, qnx ) { - HEADERS += embedded/qkbdqnx_qws.h - SOURCES += embedded/qkbdqnx_qws.cpp - } - - contains( kbd-drivers, integrity ) { - HEADERS += embedded/qkbdintegrity_qws.h - SOURCES += embedded/qkbdintegrity_qws.cpp - } - -# -# Mouse drivers -# - contains( mouse-drivers, qvfb ) { - HEADERS +=embedded/qmousevfb_qws.h - SOURCES +=embedded/qmousevfb_qws.cpp - } - - contains( mouse-drivers, pc ) { - HEADERS +=embedded/qmousepc_qws.h - SOURCES +=embedded/qmousepc_qws.cpp - } - - contains( mouse-drivers, linuxtp ) { - HEADERS +=embedded/qmouselinuxtp_qws.h - SOURCES +=embedded/qmouselinuxtp_qws.cpp - } - - contains( mouse-drivers, tslib ) { - LIBS_PRIVATE += -lts - HEADERS +=embedded/qmousetslib_qws.h - SOURCES +=embedded/qmousetslib_qws.cpp - } - - contains( mouse-drivers, linuxinput ) { - HEADERS +=embedded/qmouselinuxinput_qws.h - SOURCES +=embedded/qmouselinuxinput_qws.cpp - } - - contains( mouse-drivers, qnx ) { - HEADERS += embedded/qmouseqnx_qws.h - SOURCES += embedded/qmouseqnx_qws.cpp - } - - contains( mouse-drivers, integrity ) { - HEADERS += embedded/qmouseintegrity_qws.h - SOURCES += embedded/qmouseintegrity_qws.cpp - } -} diff --git a/src/gui/embedded/qcopchannel_qws.cpp b/src/gui/embedded/qcopchannel_qws.cpp deleted file mode 100644 index abcedeb62af..00000000000 --- a/src/gui/embedded/qcopchannel_qws.cpp +++ /dev/null @@ -1,608 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcopchannel_qws.h" - -#ifndef QT_NO_COP - -#include "qwsdisplay_qws.h" -#include "qwscommand_qws_p.h" -#include "qwindowsystem_qws.h" -#include "qwindowsystem_p.h" -#include "qlist.h" -#include "qmap.h" -#include "qdatastream.h" -#include "qpointer.h" -#include "qmutex.h" - -#include "qdebug.h" - -QT_BEGIN_NAMESPACE - -typedef QMap > QCopServerMap; -static QCopServerMap *qcopServerMap = 0; - -class QCopServerRegexp -{ -public: - QCopServerRegexp( const QString& channel, QWSClient *client ); - QCopServerRegexp( const QCopServerRegexp& other ); - - QString channel; - QWSClient *client; - QRegExp regexp; -}; - -QCopServerRegexp::QCopServerRegexp( const QString& channel, QWSClient *client ) -{ - this->channel = channel; - this->client = client; - this->regexp = QRegExp( channel, Qt::CaseSensitive, QRegExp::Wildcard ); -} - -QCopServerRegexp::QCopServerRegexp( const QCopServerRegexp& other ) -{ - channel = other.channel; - client = other.client; - regexp = other.regexp; -} - -typedef QList QCopServerRegexpList; -static QCopServerRegexpList *qcopServerRegexpList = 0; - -typedef QMap > > QCopClientMap; -static QCopClientMap *qcopClientMap = 0; - -Q_GLOBAL_STATIC(QMutex, qcopClientMapMutex) - -// Determine if a channel name contains wildcard characters. -static bool containsWildcards( const QString& channel ) -{ - return channel.contains(QLatin1Char('*')); -} - -class QCopChannelPrivate -{ -public: - QString channel; -}; - -/*! - \class QCopChannel - \ingroup qws - - \brief The QCopChannel class provides communication capabilities - between clients in \l{Qt for Embedded Linux}. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - The Qt COmmunication Protocol (QCOP) is a many-to-many protocol - for transferring messages across registered channels. A channel is - registered by name, and anyone who wants to can listen to the - channel as well as send messages through it. The QCOP protocol - allows clients to communicate both within the same address space - and between different processes. - - To send messages to a given channel, QCopChannel provides the - static send() function. Using this function alone, the messages - are queued until Qt re-enters the event loop. To immediately flush - all queued messages to the registered listeners, call the static - flush() function. - - To listen to the traffic on a given channel, you typically - instantiate a QCopChannel object for the given channel and connect - to its received() signal that is emitted whenever there is - incoming data. Use the static isRegistered() function to query - the server for the existence of a given channel. QCopChannel - provides the channel() function returning the name of this - QCopChannel object's channel. - - In additon, QCopChannel provides the virtual receive() function - that can be reimplemented to filter the incoming messages and - data. The default implementation simply emits the received() - signal. - - \sa QWSServer, QWSClient, {Qt for Embedded Linux Architecture} -*/ - -/*! - Constructs a QCopChannel object for the specified \a channel, with - the given \a parent. Once created, the channel is registered by - the server. - - \sa isRegistered(), channel() -*/ - -QCopChannel::QCopChannel(const QString& channel, QObject *parent) : - QObject(parent) -{ - init(channel); -} - -#ifdef QT3_SUPPORT -/*! - Use the two argument overload instead, and call the - QObject::setObjectName() function to \a name the instance. -*/ -QCopChannel::QCopChannel(const QString& channel, QObject *parent, const char *name) : - QObject(parent) -{ - setObjectName(QString::fromAscii(name)); - init(channel); -} -#endif - -void QCopChannel::init(const QString& channel) -{ - d = new QCopChannelPrivate; - d->channel = channel; - - if (!qt_fbdpy) { - qFatal("QCopChannel: Must construct a QApplication " - "before QCopChannel"); - return; - } - - { - QMutexLocker locker(qcopClientMapMutex()); - - if (!qcopClientMap) - qcopClientMap = new QCopClientMap; - - // do we need a new channel list ? - QCopClientMap::Iterator it = qcopClientMap->find(channel); - if (it != qcopClientMap->end()) { - it.value().append(this); - return; - } - - it = qcopClientMap->insert(channel, QList< QPointer >()); - it.value().append(QPointer(this)); - } - - // inform server about this channel - qt_fbdpy->registerChannel(channel); -} - -/*! - \internal - - Resend all channel registrations - */ -void QCopChannel::reregisterAll() -{ - if(qcopClientMap) - for(QCopClientMap::Iterator iter = qcopClientMap->begin(); - iter != qcopClientMap->end(); - ++iter) - qt_fbdpy->registerChannel(iter.key()); -} - -/*! - Destroys this QCopChannel object. - - The server is notified that this particular listener has closed - its connection. The server will keep the channel open until the - last registered listener detaches. - - \sa isRegistered(), channel() -*/ - -QCopChannel::~QCopChannel() -{ - QMutexLocker locker(qcopClientMapMutex()); - QCopClientMap::Iterator it = qcopClientMap->find(d->channel); - Q_ASSERT(it != qcopClientMap->end()); - it.value().removeAll(this); - // still any clients connected locally ? - if (it.value().isEmpty()) { - QByteArray data; - QDataStream s(&data, QIODevice::WriteOnly); - s << d->channel; - if (qt_fbdpy) - send(QLatin1String(""), QLatin1String("detach()"), data); - qcopClientMap->remove(d->channel); - } - - delete d; -} - -/*! - Returns the name of this object's channel. - - \sa isRegistered() -*/ - -QString QCopChannel::channel() const -{ - return d->channel; -} - -/*! - \fn void QCopChannel::receive(const QString& message, const QByteArray &data) - - Processes the incoming \a message and \a data. - - This function is called by the server when this object's channel - receives new messages. Note that the default implementation simply - emits the received() signal; reimplement this function to process - the incoming \a message and \a data. - - Note that the format of the given \a data has to be well defined - in order to extract the information it contains. In addition, it - is recommended to use the DCOP convention. This is not a - requirement, but you must ensure that the sender and receiver - agree on the argument types. For example: - - \snippet doc/src/snippets/code/src_gui_embedded_qcopchannel_qws.cpp 0 - - The above code assumes that the \c message is a DCOP-style - function signature and the \c data contains the function's - arguments. - - \sa send(), channel(), received() - */ -void QCopChannel::receive(const QString& msg, const QByteArray &data) -{ - emit received(msg, data); -} - -/*! - \fn void QCopChannel::received(const QString& message, const QByteArray &data) - - This signal is emitted whenever this object's channel receives new - messages (i.e., it is emitted by the receive() function), passing - the incoming \a message and \a data as parameters. - - \sa receive(), channel() -*/ - -/*! - Queries the server for the existence of the given \a channel. Returns true - if the channel is registered; otherwise returns false. - - \sa channel(), send() -*/ - -bool QCopChannel::isRegistered(const QString& channel) -{ - QByteArray data; - QDataStream s(&data, QIODevice::WriteOnly); - s << channel; - if (!send(QLatin1String(""), QLatin1String("isRegistered()"), data)) - return false; - - QWSQCopMessageEvent *e = qt_fbdpy->waitForQCopResponse(); - bool known = e->message == "known"; - delete e; - return known; -} - -/*! - \fn bool QCopChannel::send(const QString& channel, const QString& message) - \overload -*/ - -bool QCopChannel::send(const QString& channel, const QString& msg) -{ - QByteArray data; - return send(channel, msg, data); -} - -/*! - \fn bool QCopChannel::send(const QString& channel, const QString& message, - const QByteArray &data) - - Sends the given \a message on the specified \a channel with the - given \a data. The message will be distributed to all clients - subscribed to the channel. Returns true if the message is sent - successfully; otherwise returns false. - - It is recommended to use the DCOP convention. This is not a - requirement, but you must ensure that the sender and receiver - agree on the argument types. - - Note that QDataStream provides a convenient way to fill the byte - array with auxiliary data. For example: - - \snippet doc/src/snippets/code/src_gui_embedded_qcopchannel_qws.cpp 1 - - In the code above the channel is \c "System/Shell". The \c message - is an arbitrary string, but in the example we've used the DCOP - convention of passing a function signature. Such a signature is - formatted as \c "functionname(types)" where \c types is a list of - zero or more comma-separated type names, with no whitespace, no - consts and no pointer or reference marks, i.e. no "*" or "&". - - \sa receive(), isRegistered() -*/ - -bool QCopChannel::send(const QString& channel, const QString& msg, - const QByteArray &data) -{ - if (!qt_fbdpy) { - qFatal("QCopChannel::send: Must construct a QApplication " - "before using QCopChannel"); - return false; - } - - qt_fbdpy->sendMessage(channel, msg, data); - - return true; -} - -/*! - \since 4.2 - - Flushes all queued messages to the registered listeners. - - Note that this function returns false if no QApplication has been - constructed, otherwise it returns true. - - \sa send() - -*/ -bool QCopChannel::flush() -{ - if (!qt_fbdpy) { - qFatal("QCopChannel::flush: Must construct a QApplication " - "before using QCopChannel"); - return false; - } - - qt_fbdpy->flushCommands(); - - return true; -} - -class QWSServerSignalBridge : public QObject { - Q_OBJECT - -public: - void emitNewChannel(const QString& channel); - void emitRemovedChannel(const QString& channel); - - signals: - void newChannel(const QString& channel); - void removedChannel(const QString& channel); -}; - -void QWSServerSignalBridge::emitNewChannel(const QString& channel){ - emit newChannel(channel); -} - -void QWSServerSignalBridge::emitRemovedChannel(const QString& channel) { - emit removedChannel(channel); -} - -/*! - \internal - Server side: subscribe client \a cl on channel \a ch. -*/ - -void QCopChannel::registerChannel(const QString& ch, QWSClient *cl) -{ - if (!qcopServerMap) - qcopServerMap = new QCopServerMap; - - // do we need a new channel list ? - QCopServerMap::Iterator it = qcopServerMap->find(ch); - if (it == qcopServerMap->end()) - it = qcopServerMap->insert(ch, QList()); - - // If the channel name contains wildcard characters, then we also - // register it on the server regexp matching list. - if (containsWildcards( ch )) { - QCopServerRegexp item(ch, cl); - if (!qcopServerRegexpList) - qcopServerRegexpList = new QCopServerRegexpList; - qcopServerRegexpList->append( item ); - } - - // If this is the first client in the channel, announce the channel as being created. - if (it.value().count() == 0) { - QWSServerSignalBridge* qwsBridge = new QWSServerSignalBridge(); - connect(qwsBridge, SIGNAL(newChannel(QString)), qwsServer, SIGNAL(newChannel(QString))); - qwsBridge->emitNewChannel(ch); - delete qwsBridge; - } - - it.value().append(cl); -} - -/*! - \internal - Server side: unsubscribe \a cl from all channels. -*/ - -void QCopChannel::detach(QWSClient *cl) -{ - if (!qcopServerMap) - return; - - QCopServerMap::Iterator it = qcopServerMap->begin(); - for (; it != qcopServerMap->end(); ++it) { - if (it.value().contains(cl)) { - it.value().removeAll(cl); - // If this was the last client in the channel, announce the channel as dead. - if (it.value().count() == 0) { - QWSServerSignalBridge* qwsBridge = new QWSServerSignalBridge(); - connect(qwsBridge, SIGNAL(removedChannel(QString)), qwsServer, SIGNAL(removedChannel(QString))); - qwsBridge->emitRemovedChannel(it.key()); - delete qwsBridge; - } - } - } - - if (!qcopServerRegexpList) - return; - - QCopServerRegexpList::Iterator it2 = qcopServerRegexpList->begin(); - while(it2 != qcopServerRegexpList->end()) { - if ((*it2).client == cl) - it2 = qcopServerRegexpList->erase(it2); - else - ++it2; - } -} - -/*! - \internal - Server side: transmit the message to all clients registered to the - specified channel. -*/ - -void QCopChannel::answer(QWSClient *cl, const QString& ch, - const QString& msg, const QByteArray &data) -{ - // internal commands - if (ch.isEmpty()) { - if (msg == QLatin1String("isRegistered()")) { - QString c; - QDataStream s(data); - s >> c; - bool known = qcopServerMap && qcopServerMap->contains(c) - && !((*qcopServerMap)[c]).isEmpty(); - // Yes, it's a typo, it's not user-visible, and we choose not to fix it for compatibility - QLatin1String ans = QLatin1String(known ? "known" : "unknown"); - QWSServerPrivate::sendQCopEvent(cl, QLatin1String(""), - ans, data, true); - return; - } else if (msg == QLatin1String("detach()")) { - QString c; - QDataStream s(data); - s >> c; - Q_ASSERT(qcopServerMap); - QCopServerMap::Iterator it = qcopServerMap->find(c); - if (it != qcopServerMap->end()) { - //Q_ASSERT(it.value().contains(cl)); - it.value().removeAll(cl); - if (it.value().isEmpty()) { - // If this was the last client in the channel, announce the channel as dead - QWSServerSignalBridge* qwsBridge = new QWSServerSignalBridge(); - connect(qwsBridge, SIGNAL(removedChannel(QString)), qwsServer, SIGNAL(removedChannel(QString))); - qwsBridge->emitRemovedChannel(it.key()); - delete qwsBridge; - qcopServerMap->erase(it); - } - } - if (qcopServerRegexpList && containsWildcards(c)) { - // Remove references to a wildcarded channel. - QCopServerRegexpList::Iterator it - = qcopServerRegexpList->begin(); - while(it != qcopServerRegexpList->end()) { - if ((*it).client == cl && (*it).channel == c) - it = qcopServerRegexpList->erase(it); - else - ++it; - } - } - return; - } - qWarning("QCopChannel: unknown internal command %s", qPrintable(msg)); - QWSServerPrivate::sendQCopEvent(cl, QLatin1String(""), - QLatin1String("bad"), data); - return; - } - - if (qcopServerMap) { - QList clist = qcopServerMap->value(ch); - for (int i=0; i < clist.size(); ++i) { - QWSClient *c = clist.at(i); - QWSServerPrivate::sendQCopEvent(c, ch, msg, data); - } - } - - if(qcopServerRegexpList && !containsWildcards(ch)) { - // Search for wildcard matches and forward the message on. - QCopServerRegexpList::ConstIterator it = qcopServerRegexpList->constBegin(); - for (; it != qcopServerRegexpList->constEnd(); ++it) { - if ((*it).regexp.exactMatch(ch)) { - QByteArray newData; - { - QDataStream stream - (&newData, QIODevice::WriteOnly | QIODevice::Append); - stream << ch; - stream << msg; - stream << data; - // Stream is flushed and closed at this point. - } - QWSServerPrivate::sendQCopEvent - ((*it).client, (*it).channel, - QLatin1String("forwardedMessage(QString,QString,QByteArray)"), - newData); - } - } - } -} - -/*! - \internal - Client side: distribute received event to the QCop instance managing the - channel. -*/ -void QCopChannel::sendLocally(const QString& ch, const QString& msg, - const QByteArray &data) -{ - Q_ASSERT(qcopClientMap); - - // filter out internal events - if (ch.isEmpty()) - return; - - // feed local clients with received data - QList< QPointer > clients; - { - QMutexLocker locker(qcopClientMapMutex()); - clients = (*qcopClientMap)[ch]; - } - for (int i = 0; i < clients.size(); ++i) { - QCopChannel *channel = (QCopChannel *)clients.at(i); - if ( channel ) - channel->receive(msg, data); - } -} - -QT_END_NAMESPACE - -#include "qcopchannel_qws.moc" - -#endif diff --git a/src/gui/embedded/qcopchannel_qws.h b/src/gui/embedded/qcopchannel_qws.h deleted file mode 100644 index 0ee41b8da51..00000000000 --- a/src/gui/embedded/qcopchannel_qws.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QCOPCHANNEL_QWS_H -#define QCOPCHANNEL_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_COP - -class QWSClient; -class QCopChannelPrivate; - -class Q_GUI_EXPORT QCopChannel : public QObject -{ - Q_OBJECT -public: - explicit QCopChannel(const QString& channel, QObject *parent=0); -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QCopChannel(const QString& channel, QObject *parent, const char *name); -#endif - virtual ~QCopChannel(); - - QString channel() const; - - static bool isRegistered(const QString& channel); - static bool send(const QString& channel, const QString& msg); - static bool send(const QString& channel, const QString& msg, - const QByteArray &data); - - static bool flush(); - - static void sendLocally( const QString& ch, const QString& msg, - const QByteArray &data); - static void reregisterAll(); - - virtual void receive(const QString& msg, const QByteArray &data); - -Q_SIGNALS: - void received(const QString& msg, const QByteArray &data); - -private: - void init(const QString& channel); - - // server side - static void registerChannel(const QString& ch, QWSClient *cl); - static void detach(QWSClient *cl); - static void answer(QWSClient *cl, const QString& ch, - const QString& msg, const QByteArray &data); - // client side - QCopChannelPrivate* d; - - friend class QWSServer; - friend class QWSServerPrivate; - friend class QApplication; -}; - -#endif // QT_NO_COP - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QCOPCHANNEL_QWS_H diff --git a/src/gui/embedded/qdecoration_qws.cpp b/src/gui/embedded/qdecoration_qws.cpp deleted file mode 100644 index ffee6cbb738..00000000000 --- a/src/gui/embedded/qdecoration_qws.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdecoration_qws.h" - -#include "qapplication.h" -#include "qdrawutil.h" -#include "qpainter.h" -#include "qregion.h" -#include "qwhatsthis.h" - -#include "qmenu.h" -#include "private/qwidget_p.h" -#include "qwsmanager_qws.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QDecoration - \ingroup qws - - \brief The QDecoration class is a base class for window - decorations in Qt for Embedded Linux - - Note that this class is non-portable and only available in - \l{Qt for Embedded Linux}. - - \l{Qt for Embedded Linux} provides window management of top level windows - and several ready made decorations (i.e., \c Default, \c Styled - and \c Windows). Custom decorations can be implemented by - subclassing the QDecoration class and creating a decoration plugin - (derived from QDecorationPlugin). The default - implementation of the QDecorationFactory class will automatically - detect the plugin, and load the decoration into the application at - run-time using Qt's \l {How to Create Qt Plugins}{plugin - system}. To actually apply a decoration, use the - QApplication::qwsSetDecoration() function. - - When creating a custom decoration, implement the paint() function - to paint the border and title decoration, and the region() - function to return the regions the decoration - occupies. Reimplement the regionClicked() and - regionDoubleClicked() functions to respond to mouse clicks (the - default implementations responds to (single) clicks on items in a - widget's system menu and double clicks on a widget's title). - - QDecoration provides the DecorationRegion enum that describes the - various regions of the window decoration, and the regionAt() - function to determine the region containing a given point. The - QDecoration class also provides the DecorationState enum - describing the state of a given region, e.g. whether it is active - or not. - - In addition, it is possible to build the system menu for a given - top level widget using the buildSysMenu() function; whenever an - action in this menu is triggered, the menuTriggered() function is - called automatically. - - Finally, the QDecoration class provides a couple of static - functions, startMove() and startResize(), which start a move or - resize action by making the appropriate decoration region active - and grabbing the mouse input. - - \sa QDecorationFactory, QDecorationPlugin, {Qt for Embedded Linux - Architecture} -*/ - -/*! - \fn QDecoration::QDecoration() - - Constructs a decoration object. -*/ - -/*! - \fn QDecoration::~QDecoration() - - Destroys this decoration object. -*/ - -/*! - \enum QDecoration::DecorationRegion - - This enum describes the various regions of the window decoration. - - \value All The entire region used by the window decoration. - - \value Top The top border used to vertically resize the window. - \value Bottom The bottom border used to vertically resize the window. - \value Left The left border used to horizontally resize the window. - \value Right The right border used to horizontally resize the window. - \value TopLeft The top-left corner of the window used to resize the - window both horizontally and vertically. - \value TopRight The top-right corner of the window used to resize the - window both horizontally and vertically. - \value BottomLeft The bottom-left corner of the window used to resize the - window both horizontally and vertically. - \value BottomRight The bottom-right corner of the window used to resize the - window both horizontally and vertically. - \value Borders All the regions used to describe the window's borders. - - \value Title The region containing the window title, used - to move the window by dragging with the mouse cursor. - \value Close The region occupied by the close button. Clicking in this - region closes the window. - \value Minimize The region occupied by the minimize button. Clicking in - this region minimizes the window. - \value Maximize The region occupied by the maximize button. Clicking in - this region maximizes the window. - \value Normalize The region occupied by a button used to restore a window's - normal size. Clicking in this region restores a maximized - window to its previous size. The region used for this - button is often also the Maximize region. - \value Menu The region occupied by the window's menu button. Clicking - in this region opens the window operations (system) menu. - \value Help The region occupied by the window's help button. Clicking - in this region causes the context-sensitive help function - to be enabled. - \value Resize The region used to resize the window. - \value Move The region used to move the window. - \value None No region. - - \sa region(), regionAt(), DecorationState -*/ - -/*! - \enum QDecoration::DecorationState - - This enum describes the various states of a decoration region. - - \value Normal The region is active - \value Disabled The region is inactive. - \value Hover The cursor is hovering over the region. - \value Pressed The region is pressed. - - \sa paint(), DecorationRegion -*/ - -/*! - \fn QRegion QDecoration::region(const QWidget *widget, const QRect & rectangle, int decorationRegion) - - Implement this function to return the region specified by \a - decorationRegion for the given top level \a widget. - - The \a rectangle parameter specifies the rectangle the decoration - is wrapped around. The \a decorationRegion is a bitmask of the - values described by the DecorationRegion enum. - - \sa regionAt(), paint() -*/ - -/*! - \fn QRegion QDecoration::region(const QWidget *widget, int decorationRegion) - \overload -*/ - -/*! - \fn bool QDecoration::paint(QPainter *painter, const QWidget *widget, int decorationRegion, - DecorationState state) - - Implement this function to paint the border and title decoration - for the specified top level \a widget using the given \a painter - and decoration \a state. The specified \a decorationRegion is a - bitmask of the values described by the DecorationRegion enum. - - Note that \l{Qt for Embedded Linux} expects this function to return true if - any of the widget's decorations are repainted; otherwise it should - return false. - - \sa region() -*/ - -/*! - \fn int QDecoration::regionAt(const QWidget *widget, const QPoint &point) - - Returns the type of the first region of the specified top level \a - widget containing the given \a point. - - The return value is one of the DecorationRegion enum's values. Use - the region() function to retrieve the actual region. If none of - the widget's regions contain the point, this function returns \l - None. - - \sa region() -*/ -int QDecoration::regionAt(const QWidget *w, const QPoint &point) -{ - int regions[] = { - TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight, // Borders first - Menu, Title, Help, Minimize, Normalize, Maximize, Close, // then buttons - None - }; - -// char *regions_str[] = { -// "TopLeft", "Top", "TopRight", "Left", "Right", "BottomLeft", "Bottom", "BottomRight", -// "Menu", "Title", "Help", "Minimize", "Normalize", "Maximize", "Close", -// "None" -// }; - - // First check to see if within all regions at all - QRegion reg = region(w, w->geometry(), All); - if (!reg.contains(point)) { - return None; - } - - int i = 0; - while (regions[i]) { - reg = region(w, w->geometry(), regions[i]); - if (reg.contains(point)) { -// qDebug("In region %s", regions_str[i]); - return regions[i]; - } - ++i; - } - return None; -} - -#ifndef QT_NO_MENU -/*! - Builds the system menu for the given top level \a widget, adding - \gui Restore, \gui Move, \gui Size, \gui Minimize, \gui Maximize - and \gui Close actions to the given \a menu. - - \sa menuTriggered() -*/ -void QDecoration::buildSysMenu(QWidget *widget, QMenu *menu) -{ - QDecorationAction *act = new QDecorationAction(QLatin1String("Restore"), - menu, Maximize); - act->setEnabled(widget->windowState() & Qt::WindowMaximized); - menu->addAction(act); - act = new QDecorationAction(QLatin1String("Move"), menu, Move); - act->setEnabled(!(widget->windowState() & Qt::WindowMaximized)); - menu->addAction(act); - menu->addAction(new QDecorationAction(QLatin1String("Size"), menu, Resize)); - act = new QDecorationAction(QLatin1String("Minimize"), menu, Minimize); - menu->addAction(act); - act = new QDecorationAction(QLatin1String("Maximize"), menu, Maximize); - act->setDisabled(widget->windowState() & Qt::WindowMaximized); - menu->addAction(act); - menu->addSeparator(); - menu->addAction(new QDecorationAction(QLatin1String("Close"), menu, Close)); -} - -/*! - This function is called whenever an action in a top level widget's - menu is triggered, and simply calls the regionClicked() function - passing the \a widget and \a action parameters as arguments. - - \sa buildSysMenu() -*/ -void QDecoration::menuTriggered(QWidget *widget, QAction *action) -{ - QDecorationAction *decAction = static_cast(action); - regionClicked(widget, decAction->reg); -} -#endif // QT_NO_MENU - -/*! - \fn void QDecoration::regionClicked(QWidget *widget, int region) - - Handles the event that the specified \a region in the given top - level \a widget is activated by a single click (the \a region - parameter is described using the DecorationRegion enum). - - This function is called whenever a region in a top level widget is - clicked; the default implementation responds to clicks on items in - the system menu, performing the requested actions. - - \sa regionDoubleClicked(), region() -*/ -void QDecoration::regionClicked(QWidget *widget, int reg) -{ - switch(reg) { - case Move: - startMove(widget); - break; - case Resize: - startResize(widget); - break; - case Help: -#ifndef QT_NO_WHATSTHIS - if (QWhatsThis::inWhatsThisMode()) - QWhatsThis::leaveWhatsThisMode(); - else - QWhatsThis::enterWhatsThisMode(); -#endif - break; - case Close: - widget->close(); - break; - case Normalize: - widget->showNormal(); - break; - case Maximize: - if (widget->windowState() & Qt::WindowMaximized) - widget->showNormal(); - else - widget->showMaximized(); - break; - } -} - -/*! - \fn void QDecoration::regionDoubleClicked(QWidget *widget, int region) - - Handles the event that the specified \a region in the given top - level \a widget is activated by a double click (the region - parameter is described using the DecorationRegion enum). - - This function is called whenever a region in a top level widget is - double clicked; the default implementation responds to a double - click on the widget's title, toggling its size between the maximum - and its normal size. - - \sa regionClicked(), region() -*/ -void QDecoration::regionDoubleClicked(QWidget *widget, int reg) -{ - switch(reg) - { - case Title: { - if (widget->windowState() & Qt::WindowMaximized) - widget->showNormal(); - else - widget->showMaximized(); - break; - } - } -} - -/*! - Starts to move the given top level \a widget by making its \l - Title region active and grabbing the mouse input. - - \sa startResize() -*/ -void QDecoration::startMove(QWidget *widget) -{ -#ifdef QT_NO_QWS_MANAGER - Q_UNUSED(widget); -#else - QWSManager *manager = widget->d_func()->topData()->qwsManager; - if (manager) - manager->startMove(); -#endif -} - -/*! - Starts to resize the given top level \a widget by making its \l - BottomRight region active and grabbing the mouse input. - - \sa startMove() -*/ -void QDecoration::startResize(QWidget *widget) -{ -#ifdef QT_NO_QWS_MANAGER - Q_UNUSED(widget); -#else - QWSManager *manager = widget->d_func()->topData()->qwsManager; - if (manager) - manager->startResize(); -#endif -} - - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qdecoration_qws.h b/src/gui/embedded/qdecoration_qws.h deleted file mode 100644 index 5e1d2773a52..00000000000 --- a/src/gui/embedded/qdecoration_qws.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECORATION_QWS_H -#define QDECORATION_QWS_H - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QPopupMenu; -class QMenu; - -#ifndef QT_NO_ACTION -class QDecorationAction : public QAction -{ -public: - QDecorationAction(const QString &text, QObject* parent, int region) - : QAction(text, parent), reg(region) {} - int reg; -}; -#endif // QT_NO_ACTION - -/* - Implements decoration styles -*/ -class Q_GUI_EXPORT QDecoration -{ -public: - QDecoration() {} - virtual ~QDecoration() {} - - /* AABBBBBBBBBBCC Items in DecorationRegion: - AijjjjjjjklmnC - A C A = TopLeft B = Top C = TopRight - D E D = Left E = Right - D E F = BottomLeft H = Bottom G = BottomRight - F G i = Menu j = Title k = Help - FFHHHHHHHHHHGG l = Minimize m = Maximize n = Close - - */ - - enum DecorationRegion { - None = 0x0000000000, All = 0x7fffffff, - TopLeft = 0x0000000001, Top = 0x0000000002, TopRight = 0x0000000004, - Left = 0x0000000008, Right = 0x0000000010, - BottomLeft = 0x0000000020, Bottom = 0x0000000040, BottomRight = 0x0000000080, - Borders = 0x00000000ff, - Menu = 0x0000000100, Title = 0x0000000200, Help = 0x0000000400, - Minimize = 0x0000000800, Maximize = 0x0000001000, Normalize = 0x0000002000, - Close = 0x0000004000, Move = 0x0000008000, Resize = 0x0000010000 - }; - - enum DecorationState { Normal = 0x04, Disabled = 0x08, Hover = 0x01, Pressed = 0x02 }; - - virtual QRegion region(const QWidget *w, const QRect &rect, int decorationRegion = All ) = 0; - QRegion region(const QWidget *w, int decorationRegion = All ) - { return region(w, w->rect(), decorationRegion); } - virtual int regionAt(const QWidget *w, const QPoint &point); - - virtual void regionClicked(QWidget *widget, int region); - virtual void regionDoubleClicked(QWidget *widget, int region); -#ifndef QT_NO_MENU - virtual void buildSysMenu(QWidget *widget, QMenu *menu); - void menuTriggered(QWidget *widget, QAction *action); -#endif - - static void startMove(QWidget *widget); - static void startResize(QWidget *widget); - - virtual bool paint(QPainter *p, const QWidget *w, int decorationRegion = All, - DecorationState state = Normal) = 0; - -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECORATION_QWS_H diff --git a/src/gui/embedded/qdecorationdefault_qws.cpp b/src/gui/embedded/qdecorationdefault_qws.cpp deleted file mode 100644 index 6563d4af899..00000000000 --- a/src/gui/embedded/qdecorationdefault_qws.cpp +++ /dev/null @@ -1,803 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include "qdecorationdefault_qws.h" - -QT_BEGIN_NAMESPACE - -#if !defined(QT_NO_QWS_DECORATION_DEFAULT) || defined(QT_PLUGIN) - -QPixmap *QDecorationDefault::staticHelpPixmap = 0; -QPixmap *QDecorationDefault::staticMenuPixmap = 0; -QPixmap *QDecorationDefault::staticClosePixmap = 0; -QPixmap *QDecorationDefault::staticMinimizePixmap = 0; -QPixmap *QDecorationDefault::staticMaximizePixmap = 0; -QPixmap *QDecorationDefault::staticNormalizePixmap = 0; - -#ifndef QT_NO_IMAGEFORMAT_XPM - -/* XPM */ -static const char * const default_menu_xpm[] = { -/* width height ncolors chars_per_pixel */ -"16 16 11 1", -/* colors */ -" c #000000", -". c #336600", -"X c #666600", -"o c #99CC00", -"O c #999933", -"+ c #333300", -"@ c #669900", -"# c #999900", -"$ c #336633", -"% c #666633", -"& c #99CC33", -/* pixels */ -"oooooooooooooooo", -"oooooooooooooooo", -"ooooo#.++X#ooooo", -"ooooX Xoooo", -"oooX XO#% X&oo", -"oo# Ooo&@O Ooo", -"oo. Xoo#+ @X Xoo", -"oo+ OoO+ +O# +oo", -"oo+ #O+ +## +oo", -"oo. %@ ++ +. Xoo", -"oo# O@OO+ #oo", -"oooX X##$ Ooo", -"ooooX Xoo", -"oooo&OX++X#OXooo", -"oooooooooooooooo", -"oooooooooooooooo" -}; - -static const char * const default_help_xpm[] = { -"16 16 3 1", -" s None c None", -". c #ffffff", -"X c #707070", -" ", -" ", -" ...... ", -" ..XXXXXX ", -" .XX .XX ", -" .XX .XX ", -" ..XX ", -" ..XX ", -" ..XX ", -" .XX ", -" .XX ", -" .. ", -" .XX ", -" .XX ", -" ", -" "}; - -static const char * const default_close_xpm[] = { -"16 16 3 1", -" s None c None", -". c #ffffff", -"X c #707070", -" ", -" ", -" .X .X ", -" .XX .XX ", -" .XX .XX ", -" .XX .XX ", -" .XX.XX ", -" .XXX ", -" .XXX ", -" .XX.XX ", -" .XX .XX ", -" .XX .XX ", -" .XX .XX ", -" .X .X ", -" ", -" "}; - -static const char * const default_maximize_xpm[] = { -"16 16 3 1", -" s None c None", -". c #ffffff", -"X c #707070", -" ", -" ", -" ........... ", -" .XXXXXXXXXX ", -" .X .X ", -" .X .X ", -" .X .X ", -" .X .X ", -" .X .X ", -" .X .X ", -" .X .X ", -" .X........X ", -" .XXXXXXXXXX ", -" ", -" ", -" "}; - -static const char * const default_minimize_xpm[] = { -"16 16 3 1", -" s None c None", -". c #ffffff", -"X c #707070", -" ", -" ", -" ", -" ", -" ", -" ", -" ... ", -" . X ", -" .XX ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; - -static const char * const default_normalize_xpm[] = { -"16 16 3 1", -" s None c None", -". c #ffffff", -"X c #707070", -" ", -" ", -" ........ ", -" .XXXXXXXX ", -" .X .X ", -" .X .X ", -" ....X... .X ", -" .XXXXXXXX .X ", -" .X .XXXX ", -" .X .X ", -" .X .X ", -" .X......X ", -" .XXXXXXXX ", -" ", -" ", -" "}; - -#endif // QT_NO_IMAGEFORMAT_XPM - -/*! - \class QDecorationDefault - \since 4.4 - \ingroup qws - \brief The QDecorationDefault class is a base class providing default window decorations. - - See the documentation for class QDecoration for a detailed - description. This subclass of QDecoration provides standard - icons for the decoration regions. - - Note that this class is non-portable and only available in - \l{Qt for Embedded Linux}. - */ - -/*! - Default constructor. - */ -QDecorationDefault::QDecorationDefault() - : QDecoration() -{ - menu_width = 20; - help_width = 20; - close_width = 20; - minimize_width = 20; - maximize_width = 20; - normalize_width = 20; -} - -/*! - The constructor deletes the static pixmaps. - */ -QDecorationDefault::~QDecorationDefault() -{ - delete staticMenuPixmap; - delete staticClosePixmap; - delete staticMinimizePixmap; - delete staticMaximizePixmap; - delete staticNormalizePixmap; - - // This makes it safe to delete and then create a QDecorationDefault - staticMenuPixmap = 0; - staticClosePixmap = 0; - staticMinimizePixmap = 0; - staticMaximizePixmap = 0; - staticNormalizePixmap = 0; -} - -/*! - \fn const char **QDecorationDefault::xpmForRegion(int region) - - Returns a pointer to the X pixmap for the icon specified by - \a region. An X pixmap is an ASCII-text-based image. The value - of \a region must be one of a subset of the values of enum - DecorationRegion. The supported values are \e Help, \e Menu, - \e Close, \e Minimize, \e Maximize, and \e Normalize. Other - values of \a region cause zero to be returned. - - \sa QDecoration::DecorationRegion - */ -const char **QDecorationDefault::xpmForRegion(int reg) -{ -#ifdef QT_NO_IMAGEFORMAT_XPM - Q_UNUSED(reg); -#else - switch(reg) - { - case Help: - return (const char **)default_help_xpm; - case Menu: - return (const char **)default_menu_xpm; - case Close: - return (const char **)default_close_xpm; - case Minimize: - return (const char **)default_minimize_xpm; - case Maximize: - return (const char **)default_maximize_xpm; - case Normalize: - return (const char **)default_normalize_xpm; - } -#endif - return 0; -} - -/*! - \fn QPixmap QDecorationDefault::pixmapFor(const QWidget *widget, - int decorationRegion, int &xoff, int &yoff) - - Returns a pointer to the QPixmap for the widget specified by \a widget and - \a decorationRegion. The returned QPixmap is constructed from the default - X pixmap obtained from xpmForRegion(). - - \a xoff and \a yoff specify the offset for the pixmap. - - The value of \a decorationRegion must be one of a subset of the values - of enum DecorationRegion. The supported values are \e Help, - \e Menu, \e Close, \e Minimize, \e Maximize, and \e Normalize. - Other values of \a decorationRegion return 0. - - \sa QDecoration::DecorationRegion -*/ -QPixmap QDecorationDefault::pixmapFor(const QWidget *widget, - int decorationRegion, - int &xoff, - int &/*yoff*/) -{ -#ifdef QT_NO_IMAGEFORMAT_XPM - Q_UNUSED(widget); - Q_UNUSED(decorationRegion); - Q_UNUSED(xoff); - return QPixmap(); -#else - static const char **staticHelpPixmapXPM = 0; - static const char **staticMenuPixmapXPM = 0; - static const char **staticClosePixmapXPM = 0; - static const char **staticMinimizePixmapXPM = 0; - static const char **staticMaximizePixmapXPM = 0; - static const char **staticNormalizePixmapXPM = 0; - const char **xpm; - - // Why don't we just use/extend the enum type... - - if (staticHelpPixmapXPM != (xpm = xpmForRegion(Help)) || !staticHelpPixmap) { - staticHelpPixmapXPM = xpm; - staticHelpPixmap = new QPixmap(xpm); - } - if (staticMenuPixmapXPM != (xpm = xpmForRegion(Menu)) || !staticMenuPixmap) { - staticMenuPixmapXPM = xpm; - staticMenuPixmap = new QPixmap(xpm); - } - if (staticClosePixmapXPM != (xpm = xpmForRegion(Close)) || !staticClosePixmap) { - staticClosePixmapXPM = xpm; - staticClosePixmap = new QPixmap(xpm); - } - if (staticMinimizePixmapXPM != (xpm = xpmForRegion(Minimize)) || !staticMinimizePixmap) { - staticMinimizePixmapXPM = xpm; - staticMinimizePixmap = new QPixmap(xpm); - } - if (staticMaximizePixmapXPM != (xpm = xpmForRegion(Maximize)) || !staticMaximizePixmap) { - staticMaximizePixmapXPM = xpm; - staticMaximizePixmap = new QPixmap(xpm); - } - if (staticNormalizePixmapXPM != (xpm = xpmForRegion(Normalize)) || !staticNormalizePixmap) { - staticNormalizePixmapXPM = xpm; - staticNormalizePixmap = new QPixmap(xpm); - } - - const QPixmap *pm = 0; - - switch (decorationRegion) { - case Help: - pm = staticHelpPixmap; - break; - case Menu: - if (!widget->windowIcon().isNull()) - return widget->windowIcon().pixmap(16,16); //##### QIcon::pixmap() needs a size !!!!!!" - if (!pm) { - xoff = 1; - pm = staticMenuPixmap; - } - break; - case Close: - pm = staticClosePixmap; - break; - case Maximize: - pm = staticMaximizePixmap; - break; - case Normalize: - pm = staticNormalizePixmap; - break; - case Minimize: - pm = staticMinimizePixmap; - break; - default: - break; - } - return *pm; -#endif -} - -/*! - \fn int QDecorationDefault::titleBarHeight(const QWidget *widget) - - Returns the title bar height in pixels for the given \a widget. It is the - greater of 20, or the sum of the application font's line spacing value - plus a border width fudge factor. -*/ -int QDecorationDefault::titleBarHeight(const QWidget *) -{ - return qMax(20, QApplication::fontMetrics().height() + BORDER_WIDTH); -} - -/*! - Returns the region specified by \a decorationRegion for the - top-level \a widget. \a rect specifies the rectangle the decoration - wraps. The value of \a decorationRegion is a combination of the - bitmask values of enum DecorationRegion. - */ -QRegion QDecorationDefault::region(const QWidget *widget, - const QRect &rect, - int decorationRegion) -{ - Qt::WindowFlags flags = widget->windowFlags(); - bool hasBorder = !widget->isMaximized(); - bool hasTitle = flags & Qt::WindowTitleHint; - bool hasSysMenu = flags & Qt::WindowSystemMenuHint; - bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint; - bool hasMinimize = flags & Qt::WindowMinimizeButtonHint; - bool hasMaximize = flags & Qt::WindowMaximizeButtonHint; - int state = widget->windowState(); - bool isMinimized = state & Qt::WindowMinimized; - bool isMaximized = state & Qt::WindowMaximized; - - int titleHeight = hasTitle ? titleBarHeight(widget) : 0; - int bw = hasBorder ? BORDER_WIDTH : 0; - int bbw = hasBorder ? BOTTOM_BORDER_WIDTH : 0; - - QRegion region; - switch (decorationRegion) { - case All: { - QRect r(rect.left() - bw, - rect.top() - titleHeight - bw, - rect.width() + 2 * bw, - rect.height() + titleHeight + bw + bbw); - region = r; - region -= rect; - } - break; - - case Title: { - QRect r(rect.left() - + (hasSysMenu ? menu_width : 0), - rect.top() - titleHeight, - rect.width() - - (hasSysMenu ? menu_width : 0) - - close_width - - (hasMaximize ? maximize_width : 0) - - (hasMinimize ? minimize_width : 0) - - (hasContextHelp ? help_width : 0), - - titleHeight); - if (r.width() > 0) - region = r; - } - break; - - case Top: { - QRect r(rect.left() + CORNER_GRAB, - rect.top() - titleHeight - bw, - rect.width() - 2 * CORNER_GRAB, - bw); - region = r; - } - break; - - case Left: { - QRect r(rect.left() - bw, - rect.top() - titleHeight + CORNER_GRAB, - bw, - rect.height() + titleHeight - 2 * CORNER_GRAB); - region = r; - } - break; - - case Right: { - QRect r(rect.right() + 1, - rect.top() - titleHeight + CORNER_GRAB, - bw, - rect.height() + titleHeight - 2 * CORNER_GRAB); - region = r; - } - break; - - case Bottom: { - QRect r(rect.left() + CORNER_GRAB, - rect.bottom() + 1, - rect.width() - 2 * CORNER_GRAB, - bw); - region = r; - } - break; - - case TopLeft: { - QRect r1(rect.left() - bw, - rect.top() - bw - titleHeight, - CORNER_GRAB + bw, - bw); - - QRect r2(rect.left() - bw, - rect.top() - bw - titleHeight, - bw, - CORNER_GRAB + bw); - - region = QRegion(r1) + r2; - } - break; - - case TopRight: { - QRect r1(rect.right() - CORNER_GRAB, - rect.top() - bw - titleHeight, - CORNER_GRAB + bw, - bw); - - QRect r2(rect.right() + 1, - rect.top() - bw - titleHeight, - bw, - CORNER_GRAB + bw); - - region = QRegion(r1) + r2; - } - break; - - case BottomLeft: { - QRect r1(rect.left() - bw, - rect.bottom() + 1, - CORNER_GRAB + bw, - bw); - - QRect r2(rect.left() - bw, - rect.bottom() - CORNER_GRAB, - bw, - CORNER_GRAB + bw); - region = QRegion(r1) + r2; - } - break; - - case BottomRight: { - QRect r1(rect.right() - CORNER_GRAB, - rect.bottom() + 1, - CORNER_GRAB + bw, - bw); - - QRect r2(rect.right() + 1, - rect.bottom() - CORNER_GRAB, - bw, - CORNER_GRAB + bw); - region = QRegion(r1) + r2; - } - break; - - case Menu: { - if (hasSysMenu) { - region = QRect(rect.left(), rect.top() - titleHeight, - menu_width, titleHeight); - } - } - break; - - case Help: { - if (hasContextHelp) { - QRect r(rect.right() - - close_width - - (hasMaximize ? maximize_width : 0) - - (hasMinimize ? minimize_width : 0) - - help_width + 1, rect.top() - titleHeight, - help_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } - } - break; - - - case Minimize: { - if (hasMinimize && !isMinimized) { - QRect r(rect.right() - close_width - - (hasMaximize ? maximize_width : 0) - - minimize_width + 1, rect.top() - titleHeight, - minimize_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } - } - break; - - case Maximize: { - if (hasMaximize && !isMaximized) { - QRect r(rect.right() - close_width - maximize_width + 1, - rect.top() - titleHeight, maximize_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } - } - break; - - case Normalize: { - if (hasMinimize && isMinimized) { - QRect r(rect.right() - close_width - - (hasMaximize ? maximize_width : 0) - - minimize_width + 1, rect.top() - titleHeight, - minimize_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } else if (hasMaximize && isMaximized) { - QRect r(rect.right() - close_width - maximize_width + 1, - rect.top() - titleHeight, maximize_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } - } - break; - - case Close: { - QRect r(rect.right() - close_width + 1, rect.top() - titleHeight, - close_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } - break; - - default: { - int i = 1; - while (i) { - if (i & decorationRegion) - region += this->region(widget, rect, i); - i <<= 1; - } - } - break; - } - - return region; -} - -/*! - Paints the border and title decoration for the top-level \a widget - using the \a painter provided and the decoration \a state. The value - of \a decorationRegion is a combination of the bitmask values of - enum DecorationRegion. - - Note that Qt for Embedded Linux expects this function to return true if any of - the widget's decorations are repainted; otherwise it returns false. - */ -bool QDecorationDefault::paint(QPainter *painter, - const QWidget *widget, - int decorationRegion, - DecorationState state) -{ - if (decorationRegion == None) - return false; - - const QRect titleRect = QDecoration::region(widget, Title).boundingRect(); - const QPalette pal = QApplication::palette(); - int titleHeight = titleRect.height(); - int titleWidth = titleRect.width(); - QRegion oldClipRegion = painter->clipRegion(); - - - Qt::WindowFlags flags = widget->windowFlags(); - bool hasBorder = !widget->isMaximized(); - bool hasTitle = flags & Qt::WindowTitleHint; - bool hasSysMenu = flags & Qt::WindowSystemMenuHint; - bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint; - bool hasMinimize = flags & Qt::WindowMinimizeButtonHint; - bool hasMaximize = flags & Qt::WindowMaximizeButtonHint; - - bool paintAll = (decorationRegion == int(All)); - bool handled = false; - - bool porterDuff = painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff); - - if ((paintAll || decorationRegion & Borders) && state == Normal && hasBorder) { - if (hasTitle) { // reduce flicker - QRect rect(widget->rect()); - QRect r(rect.left(), rect.top() - titleHeight, - rect.width(), titleHeight); - painter->setClipRegion(oldClipRegion - r); - } - QRect br = QDecoration::region(widget).boundingRect(); - if (porterDuff) - painter->setCompositionMode(QPainter::CompositionMode_Source); - qDrawWinPanel(painter, br.x(), br.y(), br.width(), - br.height(), pal, false, - &pal.brush(QPalette::Window)); - if (porterDuff) - painter->setCompositionMode(QPainter::CompositionMode_SourceOver); - handled |= true; - } - - if ((paintAll || decorationRegion & Title && titleWidth > 0) && state == Normal && hasTitle) { - painter->setClipRegion(oldClipRegion); - QBrush titleBrush; - QPen titlePen; - - if (widget == qApp->activeWindow()) { - titleBrush = pal.brush(QPalette::Highlight); - titlePen = pal.color(QPalette::HighlightedText); - } else { - titleBrush = pal.brush(QPalette::Window); - titlePen = pal.color(QPalette::Text); - } - - if (porterDuff) - painter->setCompositionMode(QPainter::CompositionMode_Source); - qDrawShadePanel(painter, - titleRect.x(), titleRect.y(), titleRect.width(), titleRect.height(), - pal, true, 1, &titleBrush); - if (porterDuff) - painter->setCompositionMode(QPainter::CompositionMode_SourceOver); - - painter->setPen(titlePen); - painter->drawText(titleRect.x() + 4, titleRect.y(), - titleRect.width() - 8, titleRect.height(), - Qt::AlignVCenter, windowTitleFor(widget)); - handled |= true; - } - - if (state != Hover) { - painter->setClipRegion(oldClipRegion); - if ((paintAll || decorationRegion & Menu) && hasSysMenu) { - paintButton(painter, widget, Menu, state, pal); - handled |= true; - } - - if ((paintAll || decorationRegion & Help) && hasContextHelp) { - paintButton(painter, widget, Help, state, pal); - handled |= true; - } - - if ((paintAll || decorationRegion & Minimize) && hasMinimize) { - paintButton(painter, widget, Minimize, state, pal); - handled |= true; - } - - if ((paintAll || decorationRegion & Maximize) && hasMaximize) { - paintButton(painter, widget, - ((widget->windowState() & Qt::WindowMaximized)? Normalize : Maximize), - state, pal); - handled |= true; - } - - if (paintAll || decorationRegion & Close) { - paintButton(painter, widget, Close, state, pal); - handled |= true; - } - } - return handled; -} - -/*! - \fn void QDecorationDefault::paintButton(QPainter *painter, const - QWidget *widget, int buttonRegion, DecorationState state, - const QPalette &palette) - - Paints a region of the top-level \a widget. The region is - painted in the specified decoration \a state using the - \a painter and \a palette provided. The region to be painted is specified - by \a buttonRegion, which is a combination of the bitmask values of - DecorationRegion. If the value of \a buttonRegion is one of \e Help, - \e Menu, \e Close, \e Minimize, \e Maximize, and \e Normalize, the - button pixmap for that region is painted. - - \sa pixmapFor() - */ -void QDecorationDefault::paintButton(QPainter *painter, - const QWidget *widget, - int buttonRegion, - DecorationState state, - const QPalette &pal) -{ - int xoff = 2; - int yoff = 2; - - const QPixmap pm = pixmapFor(widget, buttonRegion, xoff, yoff); - QRect brect(QDecoration::region(widget, buttonRegion).boundingRect()); - bool porterDuff = painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff); - - if (state & QDecoration::Pressed) { - if (porterDuff) - painter->setCompositionMode(QPainter::CompositionMode_Source); - qDrawWinPanel(painter, brect, pal, true, &pal.brush(QPalette::Window)); - if (porterDuff) - painter->setCompositionMode(QPainter::CompositionMode_SourceOver); - ++xoff; - ++yoff; - } else { - painter->fillRect(brect, pal.brush(QPalette::Window)); - } - - if (!pm.isNull()) - painter->drawPixmap(brect.x() + xoff, brect.y() + yoff, pm); -} - -extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*); - -/*! - \internal - */ -QString QDecorationDefault::windowTitleFor(const QWidget *widget) const -{ - return qt_setWindowTitle_helperHelper(widget->windowTitle(), widget); -} - -#endif // QT_NO_QWS_DECORATION_DEFAULT - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qdecorationdefault_qws.h b/src/gui/embedded/qdecorationdefault_qws.h deleted file mode 100644 index 5e844b512d1..00000000000 --- a/src/gui/embedded/qdecorationdefault_qws.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECORATIONDEFAULT_QWS_H -#define QDECORATIONDEFAULT_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if !defined(QT_NO_QWS_DECORATION_DEFAULT) || defined(QT_PLUGIN) - -#define CORNER_GRAB 16 -#define BORDER_WIDTH 4 -#define BOTTOM_BORDER_WIDTH BORDER_WIDTH - -class Q_GUI_EXPORT QDecorationDefault : public QDecoration -{ -public: - QDecorationDefault(); - virtual ~QDecorationDefault(); - - virtual QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion = All); - virtual bool paint(QPainter *painter, const QWidget *widget, int decorationRegion = All, - DecorationState state = Normal); - -protected: - virtual int titleBarHeight(const QWidget *widget); - - virtual void paintButton(QPainter *painter, const QWidget *widget, int buttonRegion, - DecorationState state, const QPalette &pal); - virtual QPixmap pixmapFor(const QWidget *widget, int decorationRegion, int &xoff, int &yoff); - virtual const char **xpmForRegion(int region); - - QString windowTitleFor(const QWidget *widget) const; - - int menu_width; - int help_width; - int close_width; - int minimize_width; - int maximize_width; - int normalize_width; - -private: - static QPixmap *staticHelpPixmap; - static QPixmap *staticMenuPixmap; - static QPixmap *staticClosePixmap; - static QPixmap *staticMinimizePixmap; - static QPixmap *staticMaximizePixmap; - static QPixmap *staticNormalizePixmap; - -}; - - -QT_END_NAMESPACE -#endif // QT_NO_QWS_DECORATION_DEFAULT -QT_END_HEADER - -#endif // QDECORATIONDEFAULT_QWS_H diff --git a/src/gui/embedded/qdecorationfactory_qws.cpp b/src/gui/embedded/qdecorationfactory_qws.cpp deleted file mode 100644 index 96ab49c4f14..00000000000 --- a/src/gui/embedded/qdecorationfactory_qws.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdecorationfactory_qws.h" -#include "qdecorationplugin_qws.h" -#include "private/qfactoryloader_p.h" -#include "qmutex.h" - -#include "qapplication.h" -#include "qdecorationdefault_qws.h" -#include "qdecorationwindows_qws.h" -#include "qdecorationstyled_qws.h" - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_LIBRARY -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QDecorationFactoryInterface_iid, - QLatin1String("/decorations"), Qt::CaseInsensitive)) -#endif - - - -/*! - \class QDecorationFactory - \ingroup qws - \ingroup appearance - - \brief The QDecorationFactory class creates window decorations in - Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - QDecorationFactory is used to detect and instantiate the available - decorations, allowing \l{Qt for Embedded Linux} to load the preferred - decoration into the application at runtime. The create() function - returns a QDecoration object representing the decoration - identified by a given key. The valid keys (i.e. the supported - decorations) can be retrieved using the keys() function. - - \l{Qt for Embedded Linux} provides three built-in decorations: \c Default, - \c Styled and \c Windows. In addition, custom decorations can be - added using Qt's \l {How to Create Qt Plugins}{plugin mechanism}, - i.e. by subclassing the QDecoration class and creating a mouse - driver plugin (QDecorationPlugin). - - \sa QDecoration, QDecorationPlugin -*/ - -/*! - Creates the decoration specified by the given \a key. Note that - the keys are case-insensitive. - - \sa keys() -*/ - -QDecoration *QDecorationFactory::create(const QString& key) -{ - QDecoration *ret = 0; - QString decoration = key.toLower(); -#ifndef QT_NO_QWS_DECORATION_DEFAULT - if (decoration == QLatin1String("default")) - ret = new QDecorationDefault; - else -#endif -#ifndef QT_NO_QWS_DECORATION_WINDOWS - if (decoration == QLatin1String("windows")) - ret = new QDecorationWindows; - else -#endif -#ifndef QT_NO_QWS_DECORATION_STYLED - if (decoration == QLatin1String("styled")) - ret = new QDecorationStyled; - else -#endif - { } // Keep these here - they make the #ifdefery above work -#ifndef QT_NO_LIBRARY - if (!ret) { - if (QDecorationFactoryInterface *factory = qobject_cast(loader()->instance(decoration))) { - ret = factory->create(decoration); - } - } -#endif - return ret; -} - -/*! - Returns the list of valid keys, i.e., the available decorations. - - \sa create() -*/ -QStringList QDecorationFactory::keys() -{ - QStringList list; -#ifndef QT_NO_QWS_DECORATION_STYLED - list << QLatin1String("Styled"); -#endif -#ifndef QT_NO_QWS_DECORATION_DEFAULT - list << QLatin1String("Default"); -#endif -#ifndef QT_NO_QWS_DECORATION_WINDOWS - list << QLatin1String("Windows"); -#endif - -#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/embedded/qdecorationplugin_qws.cpp b/src/gui/embedded/qdecorationplugin_qws.cpp deleted file mode 100644 index 042189b308e..00000000000 --- a/src/gui/embedded/qdecorationplugin_qws.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdecorationplugin_qws.h" -#include "qdecoration_qws.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QDecorationPlugin - \ingroup qws - \ingroup plugins - - \brief The QDecorationPlugin class is an abstract base class for - window decoration plugins in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - \l{Qt for Embedded Linux} provides three ready-made decoration styles: \c - Default, \c Styled and \c Windows. Custom decorations can be - implemented by subclassing the QDecoration class and creating a - decoration plugin. - - A decoration plugin can be created by subclassing - QDecorationPlugin and implementing the pure virtual keys() and - create() functions. By exporting the derived class using the - Q_EXPORT_PLUGIN2() macro, the default implementation of the - QDecorationFactory class will automatically detect the plugin and - load the driver into the application at run-time. See \l{How to - Create Qt Plugins} for details. - - To actually apply a decoration, use the - QApplication::qwsSetDecoration() function. - - \sa QDecoration, QDecorationFactory -*/ - -/*! - \fn QStringList QDecorationPlugin::keys() const - - Returns the list of valid keys, i.e., the decorations supported by - this plugin. - - \sa create() -*/ - -/*! - \fn QDecoration *QDecorationPlugin::create(const QString &key) - - Creates a decoration matching the given \a key. Note that keys are - case-insensitive. - - \sa keys() -*/ - -/*! - Constructs a decoration 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. -*/ -QDecorationPlugin::QDecorationPlugin(QObject *parent) - : QObject(parent) -{ -} - -/*! - Destroys the decoration plugin. - - Note that Qt destroys a plugin automatically when it is no longer - used, so there is no need for calling the destructor explicitly. -*/ -QDecorationPlugin::~QDecorationPlugin() -{ -} - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qdecorationplugin_qws.h b/src/gui/embedded/qdecorationplugin_qws.h deleted file mode 100644 index b94bcba0baf..00000000000 --- a/src/gui/embedded/qdecorationplugin_qws.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECORATIONPLUGIN_QWS_H -#define QDECORATIONPLUGIN_QWS_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QDecoration; - -struct Q_GUI_EXPORT QDecorationFactoryInterface : public QFactoryInterface -{ - virtual QDecoration *create(const QString &key) = 0; -}; - -#define QDecorationFactoryInterface_iid "com.trolltech.Qt.QDecorationFactoryInterface" -Q_DECLARE_INTERFACE(QDecorationFactoryInterface, QDecorationFactoryInterface_iid) - -class Q_GUI_EXPORT QDecorationPlugin : public QObject, public QDecorationFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(QDecorationFactoryInterface:QFactoryInterface) - public: - explicit QDecorationPlugin(QObject *parent = 0); - ~QDecorationPlugin(); - - virtual QStringList keys() const = 0; - virtual QDecoration *create(const QString &key) = 0; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECORATIONPLUGIN_QWS_H diff --git a/src/gui/embedded/qdecorationstyled_qws.cpp b/src/gui/embedded/qdecorationstyled_qws.cpp deleted file mode 100644 index 61f11f67e2f..00000000000 --- a/src/gui/embedded/qdecorationstyled_qws.cpp +++ /dev/null @@ -1,313 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include "qdecorationstyled_qws.h" -#include "qstyle.h" -#include "qstyleoption.h" -#include "qpaintengine.h" - -QT_BEGIN_NAMESPACE - -#if !defined(QT_NO_QWS_DECORATION_STYLED) || defined(QT_PLUGIN) - -QDecorationStyled::QDecorationStyled() - : QDecorationDefault() -{ -} - -QDecorationStyled::~QDecorationStyled() -{ -} - -int QDecorationStyled::titleBarHeight(const QWidget *widget) -{ - QStyleOptionTitleBar opt; - opt.subControls = QStyle::SC_TitleBarLabel - | QStyle::SC_TitleBarSysMenu - | QStyle::SC_TitleBarNormalButton - | QStyle::SC_TitleBarContextHelpButton - | QStyle::SC_TitleBarMinButton - | QStyle::SC_TitleBarMaxButton - | QStyle::SC_TitleBarCloseButton; - opt.titleBarFlags = widget->windowFlags(); - opt.direction = QApplication::layoutDirection(); - opt.text = windowTitleFor(widget); - opt.icon = widget->windowIcon(); - opt.rect = widget->rect(); - - QStyle *style = QApplication::style(); - if (!style) - return 18; - - return style->pixelMetric(QStyle::PM_TitleBarHeight, &opt, 0); -} - -bool QDecorationStyled::paint(QPainter *painter, const QWidget *widget, int decorationRegion, - DecorationState state) -{ - if (decorationRegion == None) - return false; - - bool isActive = (widget == qApp->activeWindow()); - QPalette pal = qApp->palette(); - //ideally, the difference between Active and Inactive should be enough, so we shouldn't need to test this - if (!isActive) { - //pal.setCurrentColorGroup(QPalette::Disabled); //Can't do this either, because of palette limitations - //copied from Q3TitleBar: - pal.setColor(QPalette::Inactive, QPalette::Highlight, - pal.color(QPalette::Inactive, QPalette::Dark)); - pal.setColor(QPalette::Inactive, QPalette::Base, - pal.color(QPalette::Inactive, QPalette::Dark)); - pal.setColor(QPalette::Inactive, QPalette::HighlightedText, - pal.color(QPalette::Inactive, QPalette::Window)); - } - - Qt::WindowFlags flags = widget->windowFlags(); - bool hasBorder = !widget->isMaximized(); - bool hasTitle = flags & Qt::WindowTitleHint; - bool hasSysMenu = flags & Qt::WindowSystemMenuHint; - bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint; - bool hasMinimize = flags & Qt::WindowMinimizeButtonHint; - bool hasMaximize = flags & Qt::WindowMaximizeButtonHint; - - bool paintAll = (DecorationRegion(decorationRegion) == All); - bool handled = false; - - QStyle *style = QApplication::style(); - - // In the case of a borderless title bar, the title bar must be expanded one - // borderWidth to the left, right and up. - bool noTitleBorder = style->styleHint(QStyle::SH_TitleBar_NoBorder, 0, widget); - int borderWidth = style->pixelMetric(QStyle::PM_MDIFrameWidth, 0, 0); - int titleHeight = titleBarHeight(widget) + (noTitleBorder ? borderWidth : 0); - int titleExtra = noTitleBorder ? borderWidth : 0; - - if ((paintAll || decorationRegion & Borders) && state == Normal && hasBorder) { - QRegion newClip = painter->clipRegion(); - if (hasTitle) { // reduce flicker - QRect rect(widget->rect()); - QRect r(rect.left() - titleExtra, rect.top() - titleHeight, - rect.width() + 2 * titleExtra, titleHeight); - newClip -= r; - } - if (!newClip.isEmpty()) { - QRect br = QDecoration::region(widget).boundingRect(); - painter->save(); - painter->setClipRegion(newClip); - - QStyleOptionFrame opt; - opt.palette = pal; - opt.rect = br; - opt.lineWidth = borderWidth; - - if (isActive) - opt.state |= QStyle::State_Active; - bool porterDuff = painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff); - if (porterDuff) - painter->setCompositionMode(QPainter::CompositionMode_Source); - painter->fillRect(br, pal.window()); - if (porterDuff) - painter->setCompositionMode(QPainter::CompositionMode_SourceOver); - style->drawPrimitive(QStyle::PE_FrameWindow, &opt, painter, 0); - painter->restore(); - - decorationRegion &= (~Borders); - handled |= true; - } - } - - if (hasTitle) { - painter->save(); - - QStyleOptionTitleBar opt; - opt.subControls = (decorationRegion & Title - ? QStyle::SC_TitleBarLabel : QStyle::SubControl(0)) - | (decorationRegion & Menu - ? QStyle::SC_TitleBarSysMenu : QStyle::SubControl(0)) - | (decorationRegion & Help - ? QStyle::SC_TitleBarContextHelpButton : QStyle::SubControl(0)) - | (decorationRegion & Minimize - ? QStyle::SC_TitleBarMinButton : QStyle::SubControl(0)) - | (decorationRegion & Maximize - ? QStyle::SC_TitleBarMaxButton : QStyle::SubControl(0)) - | (decorationRegion & (Minimize | Maximize) - ? QStyle::SC_TitleBarNormalButton : QStyle::SubControl(0)) - | (decorationRegion & Close - ? QStyle::SC_TitleBarCloseButton : QStyle::SubControl(0)); - opt.titleBarFlags = widget->windowFlags(); - opt.titleBarState = widget->windowState(); - if (isActive) - opt.titleBarState |= QStyle::State_Active; - opt.text = windowTitleFor(widget); - opt.icon = widget->windowIcon(); - opt.palette = pal; - opt.rect = QRect(widget->rect().x() - titleExtra, -titleHeight, - widget->rect().width() + 2 * titleExtra, titleHeight); - - if (paintAll) { - painter->setClipRegion(opt.rect); - } else { - const QRect widgetRect = widget->rect(); - QRegion newClip = opt.rect; - if (!(decorationRegion & Menu) && hasSysMenu) - newClip -= region(widget, widgetRect, Menu); - if (!(decorationRegion & Title) && hasTitle) - newClip -= region(widget, widgetRect, Title); - if (!(decorationRegion & Help) && hasContextHelp) - newClip -= region(widget, widgetRect, Help); - if (!(decorationRegion & Minimize) && hasMinimize) - newClip -= region(widget, widgetRect, Minimize); - if (!(decorationRegion & Maximize) && hasMaximize) - newClip -= region(widget, widgetRect, Maximize); - if (!(decorationRegion & (Minimize | Maximize)) && (hasMaximize | hasMinimize)) - newClip -= region(widget, widgetRect, Normal); - if (!(decorationRegion & Close)) - newClip -= region(widget, widgetRect, Close); - painter->setClipRegion(newClip); - } - - if (state == Pressed) - opt.activeSubControls = opt.subControls; - - style->drawComplexControl(QStyle::CC_TitleBar, &opt, painter, 0); - painter->restore(); - - decorationRegion &= ~(Title | Menu | Help | Normalize | Minimize | Maximize | Close); - handled |= true; - } - - return handled; -} - -QRegion QDecorationStyled::region(const QWidget *widget, const QRect &rect, int decorationRegion) -{ - QStyle *style = QApplication::style(); - - // In the case of a borderless title bar, the title bar must be expanded one - // borderWidth to the left, right and up. - bool noTitleBorder = style->styleHint(QStyle::SH_TitleBar_NoBorder, 0, widget); - int borderWidth = style->pixelMetric(QStyle::PM_MDIFrameWidth, 0, 0); - int titleHeight = titleBarHeight(widget) + (noTitleBorder ? borderWidth : 0); - int titleExtra = noTitleBorder ? borderWidth : 0; - - QRect inside = QRect(rect.x() - titleExtra, rect.top() - titleHeight, - rect.width() + 2 * titleExtra, titleHeight); - - Qt::WindowFlags flags = widget->windowFlags(); - bool hasSysMenu = flags & Qt::WindowSystemMenuHint; - bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint; - bool hasMinimize = flags & Qt::WindowMinimizeButtonHint; - bool hasMaximize = flags & Qt::WindowMaximizeButtonHint; - - QStyleOptionTitleBar opt; - opt.subControls = QStyle::SC_TitleBarLabel - | QStyle::SC_TitleBarSysMenu - | QStyle::SC_TitleBarNormalButton - | QStyle::SC_TitleBarMinButton - | QStyle::SC_TitleBarMaxButton - | QStyle::SC_TitleBarCloseButton; - opt.titleBarFlags = widget->windowFlags(); - opt.direction = QApplication::layoutDirection(); - opt.text = windowTitleFor(widget); - opt.icon = widget->windowIcon(); - opt.rect = inside; - - QRegion region; - switch (decorationRegion) { - case Title: - region = style->subControlRect(QStyle::CC_TitleBar, &opt, - QStyle::SC_TitleBarLabel, 0); - break; - case Menu: - if (hasSysMenu) - region = style->subControlRect(QStyle::CC_TitleBar, &opt, - QStyle::SC_TitleBarSysMenu, 0); - break; - case Help: - if (hasContextHelp) - region = style->subControlRect(QStyle::CC_TitleBar, &opt, - QStyle::SC_TitleBarContextHelpButton, - 0); - break; - case Normalize: - if (hasMaximize | hasMinimize) - region = style->subControlRect(QStyle::CC_TitleBar, &opt, - QStyle::SC_TitleBarNormalButton, - 0); - break; - case Minimize: - if (hasMinimize) - region = style->subControlRect(QStyle::CC_TitleBar, &opt, - QStyle::SC_TitleBarMinButton, - 0); - break; - case Maximize: - if (hasMaximize) - region = style->subControlRect(QStyle::CC_TitleBar, &opt, - QStyle::SC_TitleBarMaxButton, - 0); - break; - case Close: - region = style->subControlRect(QStyle::CC_TitleBar, &opt, - QStyle::SC_TitleBarCloseButton, 0); - break; - - default: - region = QDecorationDefault::region(widget, rect, decorationRegion); - } - - opt.rect = QRect(rect.x() - titleExtra, rect.top() - titleHeight, - rect.width() + 2 * titleExtra, - rect.height() + titleHeight + titleExtra); - - QStyleHintReturnMask mask; - style->styleHint(QStyle::SH_WindowFrame_Mask, &opt, 0, &mask); - - return (mask.region.isEmpty() ? region : (region & mask.region)); -} - -#endif // QT_NO_QWS_DECORATION_STYLED - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qdecorationstyled_qws.h b/src/gui/embedded/qdecorationstyled_qws.h deleted file mode 100644 index 1d5d3c564f4..00000000000 --- a/src/gui/embedded/qdecorationstyled_qws.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECORATIONSTYLED_QWS_H -#define QDECORATIONSTYLED_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if !defined(QT_NO_QWS_DECORATION_STYLED) || defined(QT_PLUGIN) - -class Q_GUI_EXPORT QDecorationStyled : public QDecorationDefault -{ -public: - QDecorationStyled(); - virtual ~QDecorationStyled(); - - QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion = All); - bool paint(QPainter *painter, const QWidget *widget, int decorationRegion = All, - DecorationState state = Normal); - int titleBarHeight(const QWidget *widget); -}; - -#endif // QT_NO_QWS_DECORATION_STYLED - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECORATIONSTYLED_QWS_H diff --git a/src/gui/embedded/qdecorationwindows_qws.cpp b/src/gui/embedded/qdecorationwindows_qws.cpp deleted file mode 100644 index 3de3783beb0..00000000000 --- a/src/gui/embedded/qdecorationwindows_qws.cpp +++ /dev/null @@ -1,407 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include "qdecorationwindows_qws.h" - -QT_BEGIN_NAMESPACE - -#if !defined(QT_NO_QWS_DECORATION_WINDOWS) || defined(QT_PLUGIN) - -#ifndef QT_NO_IMAGEFORMAT_XPM - -/* XPM */ -static const char * const win_close_xpm[] = { -"16 16 4 1", -" s None c None", -". c #000000", -"X c #FFFFFF", -"Y c #707070", -" ", -" ", -" ", -" Y. .Y ", -" .. .. ", -" .. .. ", -" .YY. ", -" Y..Y ", -" .YY. ", -" .. .. ", -" .. .. ", -" Y. .Y ", -" ", -" ", -" ", -" "}; - -static const char * const win_help_xpm[] = { -"16 16 3 1", -" s None c None", -". c #ffffff", -"X c #000000", -" ", -" ", -" ", -" XXXXXX ", -" XX XX ", -" XX XX ", -" XX ", -" XX ", -" XX ", -" XX ", -" ", -" XX ", -" XX ", -" ", -" ", -" "}; - -static const char * const win_maximize_xpm[] = { -"16 16 4 1", -" s None c None", -". c #000000", -"X c #FFFFFF", -"Y c #707070", -" ", -" ", -" ", -" .......... ", -" .......... ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" .......... ", -" ", -" ", -" ", -" "}; - -static const char * const win_minimize_xpm[] = { -"16 16 4 1", -" s None c None", -". c #000000", -"X c #FFFFFF", -"Y c #707070", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ........ ", -" ........ ", -" ", -" ", -" ", -" "}; - -static const char * const win_normalize_xpm[] = { -"16 16 4 1", -" s None c None", -". c #000000", -"X c #FFFFFF", -"Y c #707070", -" ", -" ", -" ......... ", -" ......... ", -" . . ", -" . . ", -" ......... . ", -" ......... . ", -" . . . ", -" . .... ", -" . . ", -" . . ", -" ......... ", -" ", -" ", -" "}; - -#endif // QT_NO_IMAGEFORMAT_XPM - - -QDecorationWindows::QDecorationWindows() - : QDecorationDefault() -{ - menu_width = 16; - help_width = 18; - minimize_width = 18; - maximize_width = 18; - close_width = 18; -} - -QDecorationWindows::~QDecorationWindows() -{ -} - -const char **QDecorationWindows::xpmForRegion(int reg) -{ -#ifdef QT_NO_IMAGEFORMAT_XPM - Q_UNUSED(reg); -#else - switch(reg) - { - case Close: - return (const char **)win_close_xpm; - case Help: - return (const char **)win_help_xpm; - case Minimize: - return (const char **)win_minimize_xpm; - case Maximize: - return (const char **)win_maximize_xpm; - case Normalize: - return (const char **)win_normalize_xpm; - default: - return QDecorationDefault::xpmForRegion(reg); - } -#endif - return 0; -} - -QRegion QDecorationWindows::region(const QWidget *widget, const QRect &rect, int type) -{ - Qt::WindowFlags flags = widget->windowFlags(); - bool hasTitle = flags & Qt::WindowTitleHint; - bool hasSysMenu = flags & Qt::WindowSystemMenuHint; - bool hasContextHelp = flags & Qt::WindowContextHelpButtonHint; - bool hasMinimize = flags & Qt::WindowMinimizeButtonHint; - bool hasMaximize = flags & Qt::WindowMaximizeButtonHint; - const QFontMetrics fontMetrics = QApplication::fontMetrics(); - int titleHeight = hasTitle ? qMax(20, fontMetrics.height()) : 0; - int state = widget->windowState(); - bool isMinimized = state & Qt::WindowMinimized; - bool isMaximized = state & Qt::WindowMaximized; - - QRegion region; - switch (type) { - case Menu: { - if (hasSysMenu) { - region = QRect(rect.left() + 2, rect.top() - titleHeight, - menu_width, titleHeight); - } - } - break; - - case Title: { - QRect r(rect.left() - + (hasSysMenu ? menu_width + 4: 0), - rect.top() - titleHeight, - rect.width() - - (hasSysMenu ? menu_width : 0) - - close_width - - (hasMaximize ? maximize_width : 0) - - (hasMinimize ? minimize_width : 0) - - (hasContextHelp ? help_width : 0) - - 3, - titleHeight); - if (r.width() > 0) - region = r; - } - break; - case Help: { - if (hasContextHelp) { - QRect r(rect.right() - - close_width - - (hasMaximize ? maximize_width : 0) - - (hasMinimize ? minimize_width : 0) - - help_width - 3, rect.top() - titleHeight, - help_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } - } - break; - - case Minimize: { - if (hasMinimize && !isMinimized) { - QRect r(rect.right() - close_width - - (hasMaximize ? maximize_width : 0) - - minimize_width - 3, rect.top() - titleHeight, - minimize_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } - } - break; - - case Maximize: { - if (hasMaximize && !isMaximized) { - QRect r(rect.right() - close_width - maximize_width - 3, - rect.top() - titleHeight, maximize_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } - } - break; - - case Normalize: { - if (hasMinimize && isMinimized) { - QRect r(rect.right() - close_width - - (hasMaximize ? maximize_width : 0) - - minimize_width - 3, rect.top() - titleHeight, - minimize_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } else if (hasMaximize && isMaximized) { - QRect r(rect.right() - close_width - maximize_width - 3, - rect.top() - titleHeight, maximize_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } - } - break; - - case Close: { - QRect r(rect.right() - close_width - 1, rect.top() - titleHeight, - close_width, titleHeight); - if (r.left() > rect.left() + titleHeight) - region = r; - } - break; - - default: - region = QDecorationDefault::region(widget, rect, type); - break; - } - - return region; -} - -bool QDecorationWindows::paint(QPainter *painter, const QWidget *widget, int decorationRegion, - DecorationState state) -{ - if (decorationRegion == None) - return false; - - const QRect titleRect = QDecoration::region(widget, Title).boundingRect(); - const QPalette pal = QApplication::palette(); - QRegion oldClipRegion = painter->clipRegion(); - - bool paintAll = (decorationRegion == int(All)); - if ((paintAll || decorationRegion & Title && titleRect.width() > 0) && state == Normal - && (widget->windowFlags() & Qt::WindowTitleHint) ) { - painter->setClipRegion(oldClipRegion); - QColor fromBrush, toBrush; - QPen titlePen; - - if (widget == qApp->activeWindow() || qApp->activeWindow() == qApp->activePopupWidget()) { - fromBrush = pal.color(QPalette::Highlight); - titlePen = pal.color(QPalette::HighlightedText); - } else { - fromBrush = pal.color(QPalette::Window); - titlePen = pal.color(QPalette::Text); - } - toBrush = fromBrush.lighter(300); - - painter->setPen(Qt::NoPen); - QPoint p1(titleRect.x(), titleRect.y() + titleRect.height()/2); - QPoint p2(titleRect.right(), titleRect.y() + titleRect.height()/2); - QLinearGradient lg(p1, p2); - lg.setColorAt(0, fromBrush); - lg.setColorAt(1, toBrush); - painter->fillRect(titleRect, lg); - - painter->setPen(titlePen); - painter->drawText(titleRect, Qt::AlignVCenter, windowTitleFor(widget)); - decorationRegion ^= Title; - } - - return QDecorationDefault::paint(painter, widget, decorationRegion, state); -} - -void QDecorationWindows::paintButton(QPainter *painter, const QWidget *widget, int buttonRegion, - DecorationState state, const QPalette &pal) -{ - QBrush fromBrush, toBrush; - QPen titlePen; - - if (widget == qApp->activeWindow() || qApp->activeWindow() == qApp->activePopupWidget()) { - fromBrush = pal.brush(QPalette::Highlight); - titlePen = pal.color(QPalette::HighlightedText); - } else { - fromBrush = pal.brush(QPalette::Window); - titlePen = pal.color(QPalette::Text); - } - toBrush = fromBrush.color().lighter(300); - - QRect brect(QDecoration::region(widget, buttonRegion).boundingRect()); - if (buttonRegion != Close && buttonRegion != Menu) - painter->fillRect(brect, toBrush); - else - painter->fillRect(brect.x() - 2, brect.y(), brect.width() + 4, brect.height(), - buttonRegion == Menu ? fromBrush : toBrush); - - int xoff = 1; - int yoff = 2; - const QPixmap pm = pixmapFor(widget, buttonRegion, xoff, yoff); - if (buttonRegion != Menu) { - if (state & Normal) { - qDrawWinPanel(painter, brect.x(), brect.y() + 2, brect.width(), - brect.height() - 4, pal, false, &pal.brush(QPalette::Window)); - } else if (state & Pressed) { - qDrawWinPanel(painter, brect.x(), brect.y() + 2, brect.width(), - brect.height() - 4, pal, true, &pal.brush(QPalette::Window)); - ++xoff; - ++yoff; - } - } else { - xoff = 0; - yoff = 2; - } - - if (!pm.isNull()) - painter->drawPixmap(brect.x() + xoff, brect.y() + yoff, pm); -} - -#endif // QT_NO_QWS_DECORATION_WINDOWS || QT_PLUGIN - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qdecorationwindows_qws.h b/src/gui/embedded/qdecorationwindows_qws.h deleted file mode 100644 index 9678582c029..00000000000 --- a/src/gui/embedded/qdecorationwindows_qws.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECORATIONWINDOWS_QWS_H -#define QDECORATIONWINDOWS_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if !defined(QT_NO_QWS_DECORATION_WINDOWS) || defined(QT_PLUGIN) - -class Q_GUI_EXPORT QDecorationWindows : public QDecorationDefault -{ -public: - QDecorationWindows(); - virtual ~QDecorationWindows(); - - QRegion region(const QWidget *widget, const QRect &rect, int decorationRegion = All); - bool paint(QPainter *painter, const QWidget *widget, int decorationRegion = All, - DecorationState state = Normal); - -protected: - void paintButton(QPainter *painter, const QWidget *widget, int buttonRegion, - DecorationState state, const QPalette &pal); - const char **xpmForRegion(int reg); -}; - -#endif // QT_NO_QWS_DECORATION_WINDOWS - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECORATIONWINDOWS_QWS_H diff --git a/src/gui/embedded/qdirectpainter_qws.cpp b/src/gui/embedded/qdirectpainter_qws.cpp deleted file mode 100644 index 16df36dcf92..00000000000 --- a/src/gui/embedded/qdirectpainter_qws.cpp +++ /dev/null @@ -1,682 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectpainter_qws.h" - -#include "qscreen_qws.h" -#include "private/qobject_p.h" -#include "private/qapplication_p.h" -#include "qwsdisplay_qws.h" -#include "qwidget.h" -#include "qimage.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#ifdef Q_WS_QWS -#ifndef QT_NO_DIRECTPAINTER - -/*! - \class QDirectPainter - \ingroup painting - \ingroup qws - - \brief The QDirectPainter class provides direct access to the - underlying hardware in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - QDirectPainter allows a client application to reserve a region of - the framebuffer and render directly onto the screen. There are two - ways of using the QDirectPainter class: You can either reserve a - region using the provided static functions, or you can instantiate - an object and make use of its more dynamic API. - - \tableofcontents - - \section1 Dynamic Allocation - - By instantiating a QDirectPainter object using the default - QDirectPainter::NonReserved surface flag, the client application - only gets some control over the reserved region, i.e., it can - still render directly onto the screen but the allocated region may - change (for example, if a window with a higher focus requests - parts of the same region). The currently allocated region can be - retrieved using the allocatedRegion() function, while the - requestedRegion() function returns the originally reserved - region. - - - \section1 Static Allocation - - - Using the static approach, the client application gets complete - control over the reserved region, i.e., the affected region will - never be modified by the screen driver. - - To create a static region, pass the QDirectPainter::Reserved - surface flag to the constructor. After the reserved region is - reported through regionChanged(), the allocated region will not - change, unless setRegion() is called. - - If QDirectPainter::ReservedSynchronous is passed to the - constructor, calls to setRegion() will block until the region is - reserved, meaning that allocatedRegion() will be available immediately. - Note that in the current version setRegion() will cause the application - event loop to be entered, potentially causing reentrancy issues. - - \section1 Rendering - - To draw on a given region, the application must first get hold of - a pointer to the framebuffer. In most cases, this pointer can be - retrieved using the QDirectPainter::frameBuffer() function. But - note that if the current screen has subscreens, you must query the - screen driver instead to identify the correct subscreen. A pointer - to the current screen driver can always be retrieved using the - static QScreen::instance() function. Then use QScreen's \l - {QScreen::}{subScreenIndexAt()} and \l {QScreen::}{subScreens()} - functions to access the correct subscreen, and the subscreen's \l - {QScreen::}{base()} function to retrieve a pointer to the - framebuffer. - - Depending on the hardware, it might be necessary to lock the - framebuffer for exclusive use while writing to it. This is - possible using the lock() and unlock() functions. Note that - calling lock() will prevent all other applications from working - until unlock() is called. - - In addition, QDirectPainter provides several functions returning - information about the framebuffer: the linestep() function returns - the length (in bytes) of each scanline of the framebuffer while - the screenDepth(), screenWidth() and screenHeight() function - return the screen metrics. - - \sa QScreen, QWSEmbedWidget, {Qt for Embedded Linux Architecture} -*/ - -/*! - \enum QDirectPainter::SurfaceFlag - - This enum describes the behavior of the region reserved by this - QDirectPainter object. - - \value NonReserved The allocated region may change, e.g., if a - window with a higher focus requests parts of the same region. See - also \l {Dynamic Allocation}. - - \value Reserved The allocated region will never change. See also - \l {Static Allocation}. - - \value ReservedSynchronous The allocated region will never change and - each function that changes the allocated region will be blocking. - - \sa allocatedRegion() -*/ - -/*! - \fn QRegion QDirectPainter::region() - \obsolete - - Use QDirectPainter::allocatedRegion() instead. -*/ - -static inline QScreen *getPrimaryScreen() -{ - QScreen *screen = QScreen::instance(); - if (!screen->base()) { - QList subScreens = screen->subScreens(); - if (subScreens.size() < 1) - return 0; - screen = subScreens.at(0); - } - return screen; -} - -static inline QSize screenS() -{ - QScreen *screen = getPrimaryScreen(); - if (!screen) - return QSize(); - return QSize(screen->width(), screen->height()); -} - -static inline QSize devS() -{ - QScreen *screen = getPrimaryScreen(); - if (!screen) - return QSize(); - return QSize(screen->deviceWidth(), screen->deviceHeight()); -} - - -class QDirectPainterPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QDirectPainter); -public: - - QDirectPainterPrivate() : surface(0), seenRegion(false) {} - - ~QDirectPainterPrivate() { - if (QPaintDevice::qwsDisplay()) { // make sure not in QApplication destructor - qApp->d_func()->directPainters->remove(surface->windowId()); - surface->setGeometry(QRect()); - } - delete surface; - } - - QWSDirectPainterSurface *surface; - QRegion requested_region; - - static QDirectPainter *staticPainter; - bool seenRegion; -}; - -QDirectPainter *QDirectPainterPrivate::staticPainter = 0; - -void qt_directpainter_region(QDirectPainter *dp, const QRegion &alloc, int type) -{ - QDirectPainterPrivate *d = dp->d_func(); - - QRegion r = alloc; - QScreen *screen = d->surface->screen(); - if (screen->isTransformed()) { - const QSize screenSize(screen->width(), screen->height()); - r = screen->mapToDevice(r, screenSize); - } - if (type == QWSRegionEvent::Allocation) { - d->surface->setClipRegion(alloc); - d->seenRegion = true; - if (dp != QDirectPainterPrivate::staticPainter) { - if (!d->surface->flushingRegionEvents) // recursion guard - dp->regionChanged(r); - } - } -} - -#ifndef QT_NO_QWSEMBEDWIDGET -void qt_directpainter_embedevent(QDirectPainter *dp, const QWSEmbedEvent *event) -{ - if (event->type | QWSEmbedEvent::Region) { - QScreen *screen = dp->d_func()->surface->screen(); - QRegion r = event->region; - if (screen->isTransformed()) { - const QSize screenSize(screen->width(), screen->height()); - r = screen->mapToDevice(r, screenSize); - } - dp->setRegion(r); - } -} -#endif - -/*! - Constructs a QDirectPainter object with the given \a parent and - surface \a flag. -*/ -QDirectPainter::QDirectPainter(QObject *parent, SurfaceFlag flag) - :QObject(*new QDirectPainterPrivate, parent) -{ - Q_D(QDirectPainter); - d->surface = new QWSDirectPainterSurface(true, flag); - - if (flag != NonReserved) - d->surface->setReserved(); - - QApplicationPrivate *ad = qApp->d_func(); - if (!ad->directPainters) - ad->directPainters = new QMap; - ad->directPainters->insert(d->surface->windowId(), this); -} - -/*! - Destroys this QDirectPainter object, releasing the reserved region. - - \sa allocatedRegion() -*/ -QDirectPainter::~QDirectPainter() -{ - /* should not be necessary - if (this == QDirectPainterPrivate::staticPainter) - QDirectPainterPrivate::staticPainter = 0; - */ -} - -/*! - \fn void QDirectPainter::setGeometry(const QRect &rectangle) - \since 4.2 - - Request to reserve the given \a rectangle of the framebuffer. - - Note that the actually allocated region might differ from the - requested one, e.g., if the given region overlaps with the - region of another QDirectPainter object. - - \sa geometry(), allocatedRegion(), setRegion() -*/ -void QDirectPainter::setGeometry(const QRect &rect) -{ - setRegion(rect); -} - -/*! - \since 4.2 - - Returns the bounding rectangle of the requested region. - - \sa setGeometry(), requestedRegion() -*/ -QRect QDirectPainter::geometry() const -{ - Q_D(const QDirectPainter); - return d->requested_region.boundingRect(); -} - -/*! - \since 4.2 - - Requests to reserve the given \a region of the framebuffer. - - Note that the actually allocated region might differ from the - requested one, e.g., if the given region overlaps with the region - of another QDirectPainter object. - - \sa requestedRegion(), allocatedRegion(), {Dynamic Allocation} -*/ -void QDirectPainter::setRegion(const QRegion ®ion) -{ - Q_D(QDirectPainter); - d->requested_region = region; - - const QScreen *screen = d->surface->screen(); - if (screen->isTransformed()) { - const QSize devSize(screen->deviceWidth(), screen->deviceHeight()); - const QRegion r = screen->mapFromDevice(region, devSize); - d->surface->setRegion(r); - } else { - d->surface->setRegion(region); - } -} - -/*! - \since 4.2 - - Returns the region requested by this QDirectPainter. - - Note that if the QDirectPainter::Reserved flag is set, the region - returned by this function will always be equivalent to the region - returned by the allocatedRegion() function. Otherwise they might - differ (see \l {Dynamic Allocation} for details). - - \sa geometry(), setRegion(), allocatedRegion() -*/ -QRegion QDirectPainter::requestedRegion() const -{ - Q_D(const QDirectPainter); - return d->requested_region; -} - -/*! - \since 4.2 - - Returns the currently reserved region. - - Note that if the QDirectPainter::Reserved flag is set, the region - returned by this function will always be equivalent to the region - returned by the requestedRegion() function. Otherwise they might - differ (see \l {Dynamic Allocation} for details). - - \sa requestedRegion(), geometry() -*/ -QRegion QDirectPainter::allocatedRegion() const -{ - Q_D(const QDirectPainter); - const QScreen *screen = d->surface->screen(); - if (screen->isTransformed()) { - const QSize screenSize(screen->width(), screen->height()); - return screen->mapToDevice(d->surface->region(), screenSize); - } else { - return d->surface->region(); - } -} - -/*! - \since 4.2 - - Returns the window system identifier of the widget. -*/ -WId QDirectPainter::winId() const -{ - Q_D(const QDirectPainter); - return d->surface->windowId(); -} - -/*! - \fn void QDirectPainter::regionChanged(const QRegion &newRegion) - \since 4.2 - - This function is called when the allocated region changes. - - This function is not called for region changes that happen while the - startPainting() function is executing. - - Note that the given region, \a newRegion, is not guaranteed to be correct at the - time you access the display. To prevent reentrancy problems you should - always call startPainting() before updating the display and then use - allocatedRegion() to retrieve the correct region. - - \sa allocatedRegion(), startPainting(), {Dynamic Allocation} -*/ -void QDirectPainter::regionChanged(const QRegion ®ion) -{ - Q_UNUSED(region); -} - -/*! - \since 4.2 - - Call this function before you start updating the pixels in the - allocated region. The hardware will be notified, if necessary, - that you are about to start painting operations. - - Set \a lockDisplay if you want startPainting() and endPainting() - to lock() and unlock() the display automatically. - - Note that for a NonReserved direct painter, you must call - allocatedRegion() after calling this function, since the allocated - region is only guaranteed to be correct after this function has - returned. - - The regionChanged() function will not be called between startPainting() - and endPainting(). - - \sa endPainting(), flush() -*/ -void QDirectPainter::startPainting(bool lockDisplay) -{ - Q_D(QDirectPainter); - d->surface->setLocking(lockDisplay); - - const QScreen *screen = d->surface->screen(); - if (screen->isTransformed()) { - const QSize devSize(screen->deviceWidth(), screen->deviceHeight()); - const QRegion r = screen->mapFromDevice(d->surface->region(), devSize); - d->surface->beginPaint(r); - } else { - d->surface->beginPaint(d->surface->region()); - } -} - -/*! - \since 4.2 - - Call this function when you are done updating the screen. It will - notify the hardware, if necessary, that your painting operations - have ended. -*/ -void QDirectPainter::endPainting() -{ - Q_D(QDirectPainter); - - const QScreen *screen = d->surface->screen(); - if (screen->isTransformed()) { - const QSize devSize(screen->deviceWidth(), screen->deviceHeight()); - const QRegion r = screen->mapFromDevice(d->surface->region(), devSize); - d->surface->endPaint(r); - } else { - d->surface->endPaint(d->surface->region()); - } -} - -/*! - \since 4.3 - \overload - - This function will automatically call flush() to flush the - \a region to the display before notifying the hardware, if - necessary, that painting operations have ended. -*/ -void QDirectPainter::endPainting(const QRegion ®ion) -{ - endPainting(); - flush(region); -} - -/*! - \since 4.3 - - Flushes the \a region onto the screen. -*/ -void QDirectPainter::flush(const QRegion ®ion) -{ - Q_D(QDirectPainter); - - const QScreen *screen = d->surface->screen(); - if (screen->isTransformed()) { - const QSize devSize(screen->deviceWidth(), screen->deviceHeight()); - const QRegion r = screen->mapFromDevice(region, devSize); - d->surface->flush(0, r, QPoint()); - } else { - d->surface->flush(0, region, QPoint()); - } -} - -/*! - \since 4.2 - - Raises the reserved region to the top of the widget stack. - - After this call the reserved region will be visually in front of - any overlapping widgets. - - \sa lower(), requestedRegion() -*/ -void QDirectPainter::raise() -{ - QWidget::qwsDisplay()->setAltitude(winId(),QWSChangeAltitudeCommand::Raise); -} - -/*! - \since 4.2 - - Lowers the reserved region to the bottom of the widget stack. - - After this call the reserved region will be visually behind (and - therefore obscured by) any overlapping widgets. - - \sa raise(), requestedRegion() -*/ -void QDirectPainter::lower() -{ - QWidget::qwsDisplay()->setAltitude(winId(),QWSChangeAltitudeCommand::Lower); -} - - -/*! - \fn QRegion QDirectPainter::reserveRegion(const QRegion ®ion) - - Attempts to reserve the \a region and returns the region that is - actually reserved. - - This function also releases the previously reserved region if - any. If not released explicitly, the region will be released on - application exit. - - \sa allocatedRegion(), {Static Allocation} - - \obsolete - - Construct a QDirectPainter using QDirectPainter::ReservedSynchronous instead. -*/ -QRegion QDirectPainter::reserveRegion(const QRegion ®) -{ - if (!QDirectPainterPrivate::staticPainter) - QDirectPainterPrivate::staticPainter = new QDirectPainter(qApp, ReservedSynchronous); - - QDirectPainter *dp = QDirectPainterPrivate::staticPainter; - dp->setRegion(reg); - - return dp->allocatedRegion(); -} - -/*! - Returns a pointer to the beginning of the display memory. - - Note that it is the application's responsibility to limit itself - to modifying only the reserved region. - - Do not use this pointer if the current screen has subscreens, - query the screen driver instead: A pointer to the current screen - driver can always be retrieved using the static - QScreen::instance() function. Then use QScreen's \l - {QScreen::}{subScreenIndexAt()} and \l {QScreen::}{subScreens()} - functions to access the correct subscreen, and the subscreen's \l - {QScreen::}{base()} function to retrieve a pointer to the - framebuffer. - - \sa requestedRegion(), allocatedRegion(), linestep() -*/ -uchar* QDirectPainter::frameBuffer() -{ - QScreen *screen = getPrimaryScreen(); - if (!screen) - return 0; - return screen->base(); -} - -/*! - \since 4.2 - - Returns the reserved region. - - \sa reserveRegion(), frameBuffer() - - \obsolete - - Use allocatedRegion() instead. -*/ -QRegion QDirectPainter::reservedRegion() -{ - return QDirectPainterPrivate::staticPainter - ? QDirectPainterPrivate::staticPainter->allocatedRegion() : QRegion(); -} - -/*! - Returns the bit depth of the display. - - \sa screenHeight(), screenWidth() -*/ -int QDirectPainter::screenDepth() -{ - QScreen *screen = getPrimaryScreen(); - if (!screen) - return 0; - return screen->depth(); -} - -/*! - Returns the width of the display in pixels. - - \sa screenHeight(), screenDepth() -*/ -int QDirectPainter::screenWidth() -{ - QScreen *screen = getPrimaryScreen(); - if (!screen) - return 0; - return screen->deviceWidth(); -} - -/*! - Returns the height of the display in pixels. - - \sa screenWidth(), screenDepth() -*/ -int QDirectPainter::screenHeight() -{ - QScreen *screen = getPrimaryScreen(); - if (!screen) - return 0; - return screen->deviceHeight(); -} - -/*! - Returns the length (in bytes) of each scanline of the framebuffer. - - \sa frameBuffer() -*/ -int QDirectPainter::linestep() -{ - QScreen *screen = getPrimaryScreen(); - if (!screen) - return 0; - return screen->linestep(); -} - - -/*! - Locks access to the framebuffer. - - Note that calling this function will prevent all other - applications from updating the display until unlock() is called. - - \sa unlock() -*/ -void QDirectPainter::lock() -{ - QWSDisplay::grab(true); -} -/*! - Unlocks the lock on the framebuffer (set using the lock() - function), allowing other applications to access the screen. - - \sa lock() - */ -void QDirectPainter::unlock() -{ - QWSDisplay::ungrab(); -} - -#endif //QT_NO_DIRECTPAINTER - -#endif - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qdirectpainter_qws.h b/src/gui/embedded/qdirectpainter_qws.h deleted file mode 100644 index b4c1d5ef9f9..00000000000 --- a/src/gui/embedded/qdirectpainter_qws.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDIRECTPAINTER_QWS_H -#define QDIRECTPAINTER_QWS_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_DIRECTPAINTER -class QDirectPainterPrivate; -class QWSEmbedEvent; - -class Q_GUI_EXPORT QDirectPainter : public QObject { - Q_OBJECT - Q_DECLARE_PRIVATE(QDirectPainter) -public: - - enum SurfaceFlag { NonReserved = 0, - Reserved = 1, - ReservedSynchronous = 3 }; - - explicit QDirectPainter(QObject *parentObject = 0, SurfaceFlag flag = NonReserved); - ~QDirectPainter(); - - void setRegion(const QRegion&); - QRegion requestedRegion() const; - QRegion allocatedRegion() const; - - void setGeometry(const QRect&); - QRect geometry() const; - - WId winId() const; - virtual void regionChanged(const QRegion &exposedRegion); - - void startPainting(bool lockDisplay = true); - void endPainting(); - void endPainting(const QRegion ®ion); - void flush(const QRegion ®ion); - - void raise(); - void lower(); - - - static QRegion reserveRegion(const QRegion&); - static QRegion reservedRegion(); - static QRegion region() { return reservedRegion(); } - - static uchar* frameBuffer(); - static int screenDepth(); - static int screenWidth(); - static int screenHeight(); - static int linestep(); - - static void lock(); - static void unlock(); -private: - friend void qt_directpainter_region(QDirectPainter *dp, const QRegion &alloc, int type); - friend void qt_directpainter_embedevent(QDirectPainter*, const QWSEmbedEvent*); -}; - -#endif - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDIRECTPAINTER_QWS_H diff --git a/src/gui/embedded/qkbd_defaultmap_qws_p.h b/src/gui/embedded/qkbd_defaultmap_qws_p.h deleted file mode 100644 index 5aa8f839d5f..00000000000 --- a/src/gui/embedded/qkbd_defaultmap_qws_p.h +++ /dev/null @@ -1,806 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSKEYBOARDHANDLER_DEFAULTMAP_H -#define QWSKEYBOARDHANDLER_DEFAULTMAP_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. -// - -// no QT_BEGIN_NAMESPACE, since we include it internally... - -const QWSKeyboard::Mapping QWSKbPrivate::s_keymap_default[] = { - { 1, 0xffff, 0x01000000, 0x00, 0x00, 0x0000 }, - { 2, 0x0031, 0x00000031, 0x00, 0x00, 0x0000 }, - { 2, 0x0021, 0x00000021, 0x01, 0x00, 0x0000 }, - { 3, 0x0032, 0x00000032, 0x00, 0x00, 0x0000 }, - { 3, 0x0040, 0x00000040, 0x01, 0x00, 0x0000 }, - { 3, 0x0040, 0x00000040, 0x02, 0x00, 0x0000 }, - { 4, 0x0033, 0x00000033, 0x00, 0x00, 0x0000 }, - { 4, 0x0023, 0x00000023, 0x01, 0x00, 0x0000 }, - { 4, 0xffff, 0x01000000, 0x04, 0x00, 0x0000 }, - { 5, 0x0034, 0x00000034, 0x00, 0x00, 0x0000 }, - { 5, 0x0024, 0x00000024, 0x01, 0x00, 0x0000 }, - { 5, 0x0024, 0x00000024, 0x02, 0x00, 0x0000 }, - { 5, 0x005c, 0x0400005c, 0x04, 0x00, 0x0000 }, - { 6, 0x0035, 0x00000035, 0x00, 0x00, 0x0000 }, - { 6, 0x0025, 0x00000025, 0x01, 0x00, 0x0000 }, - { 6, 0x005d, 0x0400005d, 0x04, 0x00, 0x0000 }, - { 7, 0x0036, 0x00000036, 0x00, 0x00, 0x0000 }, - { 7, 0x005e, 0x0000005e, 0x01, 0x00, 0x0000 }, - { 7, 0x005e, 0x01001252, 0x02, 0x01, 0x0000 }, - { 7, 0x005e, 0x0400005e, 0x04, 0x00, 0x0000 }, - { 8, 0x0037, 0x00000037, 0x00, 0x00, 0x0000 }, - { 8, 0x0026, 0x00000026, 0x01, 0x00, 0x0000 }, - { 8, 0x007b, 0x0000007b, 0x02, 0x00, 0x0000 }, - { 8, 0x005f, 0x0400005f, 0x04, 0x00, 0x0000 }, - { 9, 0x0038, 0x00000038, 0x00, 0x00, 0x0000 }, - { 9, 0x002a, 0x0000002a, 0x01, 0x00, 0x0000 }, - { 9, 0x005b, 0x0000005b, 0x02, 0x00, 0x0000 }, - { 9, 0xffff, 0x01000003, 0x04, 0x00, 0x0000 }, - { 10, 0x0039, 0x00000039, 0x00, 0x00, 0x0000 }, - { 10, 0x0028, 0x00000028, 0x01, 0x00, 0x0000 }, - { 10, 0x005d, 0x0000005d, 0x02, 0x00, 0x0000 }, - { 11, 0x0030, 0x00000030, 0x00, 0x00, 0x0000 }, - { 11, 0x0029, 0x00000029, 0x01, 0x00, 0x0000 }, - { 11, 0x007d, 0x0000007d, 0x02, 0x00, 0x0000 }, - { 12, 0x002d, 0x0000002d, 0x00, 0x00, 0x0000 }, - { 12, 0x005f, 0x0000005f, 0x01, 0x00, 0x0000 }, - { 12, 0x005c, 0x0000005c, 0x02, 0x00, 0x0000 }, - { 12, 0x005f, 0x0400005f, 0x04, 0x00, 0x0000 }, - { 12, 0x005f, 0x0400005f, 0x05, 0x00, 0x0000 }, - { 13, 0x003d, 0x0000003d, 0x00, 0x00, 0x0000 }, - { 13, 0x002b, 0x0000002b, 0x01, 0x00, 0x0000 }, - { 14, 0xffff, 0x01000003, 0x00, 0x00, 0x0000 }, - { 14, 0xffff, 0x01000000, 0x0c, 0x08, 0x0300 }, - { 15, 0xffff, 0x01000001, 0x00, 0x00, 0x0000 }, - { 16, 0x0071, 0x00000051, 0x00, 0x00, 0x0000 }, - { 16, 0x0051, 0x00000051, 0x01, 0x00, 0x0000 }, - { 16, 0x0071, 0x00000051, 0x02, 0x00, 0x0000 }, - { 16, 0x0051, 0x00000051, 0x03, 0x00, 0x0000 }, - { 16, 0x0071, 0x04000051, 0x04, 0x00, 0x0000 }, - { 16, 0x0071, 0x04000051, 0x05, 0x00, 0x0000 }, - { 16, 0x0071, 0x04000051, 0x06, 0x00, 0x0000 }, - { 16, 0x0071, 0x04000051, 0x07, 0x00, 0x0000 }, - { 16, 0x0071, 0x08000051, 0x08, 0x00, 0x0000 }, - { 16, 0x0071, 0x08000051, 0x09, 0x00, 0x0000 }, - { 16, 0x0071, 0x08000051, 0x0a, 0x00, 0x0000 }, - { 16, 0x0071, 0x08000051, 0x0b, 0x00, 0x0000 }, - { 16, 0x0071, 0x0c000051, 0x0c, 0x00, 0x0000 }, - { 16, 0x0071, 0x0c000051, 0x0d, 0x00, 0x0000 }, - { 16, 0x0071, 0x0c000051, 0x0e, 0x00, 0x0000 }, - { 16, 0x0071, 0x0c000051, 0x0f, 0x00, 0x0000 }, - { 17, 0x0077, 0x00000057, 0x00, 0x00, 0x0000 }, - { 17, 0x0057, 0x00000057, 0x01, 0x00, 0x0000 }, - { 17, 0x0077, 0x00000057, 0x02, 0x00, 0x0000 }, - { 17, 0x0057, 0x00000057, 0x03, 0x00, 0x0000 }, - { 17, 0x0077, 0x04000057, 0x04, 0x00, 0x0000 }, - { 17, 0x0077, 0x04000057, 0x05, 0x00, 0x0000 }, - { 17, 0x0077, 0x04000057, 0x06, 0x00, 0x0000 }, - { 17, 0x0077, 0x04000057, 0x07, 0x00, 0x0000 }, - { 17, 0x0077, 0x08000057, 0x08, 0x00, 0x0000 }, - { 17, 0x0077, 0x08000057, 0x09, 0x00, 0x0000 }, - { 17, 0x0077, 0x08000057, 0x0a, 0x00, 0x0000 }, - { 17, 0x0077, 0x08000057, 0x0b, 0x00, 0x0000 }, - { 17, 0x0077, 0x0c000057, 0x0c, 0x00, 0x0000 }, - { 17, 0x0077, 0x0c000057, 0x0d, 0x00, 0x0000 }, - { 17, 0x0077, 0x0c000057, 0x0e, 0x00, 0x0000 }, - { 17, 0x0077, 0x0c000057, 0x0f, 0x00, 0x0000 }, - { 18, 0x0065, 0x00000045, 0x00, 0x00, 0x0000 }, - { 18, 0x0045, 0x00000045, 0x01, 0x00, 0x0000 }, - { 18, 0x0065, 0x00000045, 0x02, 0x00, 0x0000 }, - { 18, 0x0045, 0x00000045, 0x03, 0x00, 0x0000 }, - { 18, 0x0065, 0x04000045, 0x04, 0x00, 0x0000 }, - { 18, 0x0065, 0x04000045, 0x05, 0x00, 0x0000 }, - { 18, 0x0065, 0x04000045, 0x06, 0x00, 0x0000 }, - { 18, 0x0065, 0x04000045, 0x07, 0x00, 0x0000 }, - { 18, 0x0065, 0x08000045, 0x08, 0x00, 0x0000 }, - { 18, 0x0065, 0x08000045, 0x09, 0x00, 0x0000 }, - { 18, 0x0065, 0x08000045, 0x0a, 0x00, 0x0000 }, - { 18, 0x0065, 0x08000045, 0x0b, 0x00, 0x0000 }, - { 18, 0x0065, 0x0c000045, 0x0c, 0x00, 0x0000 }, - { 18, 0x0065, 0x0c000045, 0x0d, 0x00, 0x0000 }, - { 18, 0x0065, 0x0c000045, 0x0e, 0x00, 0x0000 }, - { 18, 0x0065, 0x0c000045, 0x0f, 0x00, 0x0000 }, - { 19, 0x0072, 0x00000052, 0x00, 0x00, 0x0000 }, - { 19, 0x0052, 0x00000052, 0x01, 0x00, 0x0000 }, - { 19, 0x0072, 0x00000052, 0x02, 0x00, 0x0000 }, - { 19, 0x0052, 0x00000052, 0x03, 0x00, 0x0000 }, - { 19, 0x0072, 0x04000052, 0x04, 0x00, 0x0000 }, - { 19, 0x0072, 0x04000052, 0x05, 0x00, 0x0000 }, - { 19, 0x0072, 0x04000052, 0x06, 0x00, 0x0000 }, - { 19, 0x0072, 0x04000052, 0x07, 0x00, 0x0000 }, - { 19, 0x0072, 0x08000052, 0x08, 0x00, 0x0000 }, - { 19, 0x0072, 0x08000052, 0x09, 0x00, 0x0000 }, - { 19, 0x0072, 0x08000052, 0x0a, 0x00, 0x0000 }, - { 19, 0x0072, 0x08000052, 0x0b, 0x00, 0x0000 }, - { 19, 0x0072, 0x0c000052, 0x0c, 0x00, 0x0000 }, - { 19, 0x0072, 0x0c000052, 0x0d, 0x00, 0x0000 }, - { 19, 0x0072, 0x0c000052, 0x0e, 0x00, 0x0000 }, - { 19, 0x0072, 0x0c000052, 0x0f, 0x00, 0x0000 }, - { 20, 0x0074, 0x00000054, 0x00, 0x00, 0x0000 }, - { 20, 0x0054, 0x00000054, 0x01, 0x00, 0x0000 }, - { 20, 0x0074, 0x00000054, 0x02, 0x00, 0x0000 }, - { 20, 0x0054, 0x00000054, 0x03, 0x00, 0x0000 }, - { 20, 0x0074, 0x04000054, 0x04, 0x00, 0x0000 }, - { 20, 0x0074, 0x04000054, 0x05, 0x00, 0x0000 }, - { 20, 0x0074, 0x04000054, 0x06, 0x00, 0x0000 }, - { 20, 0x0074, 0x04000054, 0x07, 0x00, 0x0000 }, - { 20, 0x0074, 0x08000054, 0x08, 0x00, 0x0000 }, - { 20, 0x0074, 0x08000054, 0x09, 0x00, 0x0000 }, - { 20, 0x0074, 0x08000054, 0x0a, 0x00, 0x0000 }, - { 20, 0x0074, 0x08000054, 0x0b, 0x00, 0x0000 }, - { 20, 0x0074, 0x0c000054, 0x0c, 0x00, 0x0000 }, - { 20, 0x0074, 0x0c000054, 0x0d, 0x00, 0x0000 }, - { 20, 0x0074, 0x0c000054, 0x0e, 0x00, 0x0000 }, - { 20, 0x0074, 0x0c000054, 0x0f, 0x00, 0x0000 }, - { 21, 0x0079, 0x00000059, 0x00, 0x00, 0x0000 }, - { 21, 0x0059, 0x00000059, 0x01, 0x00, 0x0000 }, - { 21, 0x0079, 0x00000059, 0x02, 0x00, 0x0000 }, - { 21, 0x0059, 0x00000059, 0x03, 0x00, 0x0000 }, - { 21, 0x0079, 0x04000059, 0x04, 0x00, 0x0000 }, - { 21, 0x0079, 0x04000059, 0x05, 0x00, 0x0000 }, - { 21, 0x0079, 0x04000059, 0x06, 0x00, 0x0000 }, - { 21, 0x0079, 0x04000059, 0x07, 0x00, 0x0000 }, - { 21, 0x0079, 0x08000059, 0x08, 0x00, 0x0000 }, - { 21, 0x0079, 0x08000059, 0x09, 0x00, 0x0000 }, - { 21, 0x0079, 0x08000059, 0x0a, 0x00, 0x0000 }, - { 21, 0x0079, 0x08000059, 0x0b, 0x00, 0x0000 }, - { 21, 0x0079, 0x0c000059, 0x0c, 0x00, 0x0000 }, - { 21, 0x0079, 0x0c000059, 0x0d, 0x00, 0x0000 }, - { 21, 0x0079, 0x0c000059, 0x0e, 0x00, 0x0000 }, - { 21, 0x0079, 0x0c000059, 0x0f, 0x00, 0x0000 }, - { 22, 0x0075, 0x00000055, 0x00, 0x00, 0x0000 }, - { 22, 0x0055, 0x00000055, 0x01, 0x00, 0x0000 }, - { 22, 0x0075, 0x00000055, 0x02, 0x00, 0x0000 }, - { 22, 0x0055, 0x00000055, 0x03, 0x00, 0x0000 }, - { 22, 0x0075, 0x04000055, 0x04, 0x00, 0x0000 }, - { 22, 0x0075, 0x04000055, 0x05, 0x00, 0x0000 }, - { 22, 0x0075, 0x04000055, 0x06, 0x00, 0x0000 }, - { 22, 0x0075, 0x04000055, 0x07, 0x00, 0x0000 }, - { 22, 0x0075, 0x08000055, 0x08, 0x00, 0x0000 }, - { 22, 0x0075, 0x08000055, 0x09, 0x00, 0x0000 }, - { 22, 0x0075, 0x08000055, 0x0a, 0x00, 0x0000 }, - { 22, 0x0075, 0x08000055, 0x0b, 0x00, 0x0000 }, - { 22, 0x0075, 0x0c000055, 0x0c, 0x00, 0x0000 }, - { 22, 0x0075, 0x0c000055, 0x0d, 0x00, 0x0000 }, - { 22, 0x0075, 0x0c000055, 0x0e, 0x00, 0x0000 }, - { 22, 0x0075, 0x0c000055, 0x0f, 0x00, 0x0000 }, - { 23, 0x0069, 0x00000049, 0x00, 0x00, 0x0000 }, - { 23, 0x0049, 0x00000049, 0x01, 0x00, 0x0000 }, - { 23, 0x0069, 0x00000049, 0x02, 0x00, 0x0000 }, - { 23, 0x0049, 0x00000049, 0x03, 0x00, 0x0000 }, - { 23, 0x0069, 0x04000049, 0x04, 0x00, 0x0000 }, - { 23, 0x0069, 0x04000049, 0x05, 0x00, 0x0000 }, - { 23, 0x0069, 0x04000049, 0x06, 0x00, 0x0000 }, - { 23, 0x0069, 0x04000049, 0x07, 0x00, 0x0000 }, - { 23, 0x0069, 0x08000049, 0x08, 0x00, 0x0000 }, - { 23, 0x0069, 0x08000049, 0x09, 0x00, 0x0000 }, - { 23, 0x0069, 0x08000049, 0x0a, 0x00, 0x0000 }, - { 23, 0x0069, 0x08000049, 0x0b, 0x00, 0x0000 }, - { 23, 0x0069, 0x0c000049, 0x0c, 0x00, 0x0000 }, - { 23, 0x0069, 0x0c000049, 0x0d, 0x00, 0x0000 }, - { 23, 0x0069, 0x0c000049, 0x0e, 0x00, 0x0000 }, - { 23, 0x0069, 0x0c000049, 0x0f, 0x00, 0x0000 }, - { 24, 0x006f, 0x0000004f, 0x00, 0x00, 0x0000 }, - { 24, 0x004f, 0x0000004f, 0x01, 0x00, 0x0000 }, - { 24, 0x006f, 0x0000004f, 0x02, 0x00, 0x0000 }, - { 24, 0x004f, 0x0000004f, 0x03, 0x00, 0x0000 }, - { 24, 0x006f, 0x0400004f, 0x04, 0x00, 0x0000 }, - { 24, 0x006f, 0x0400004f, 0x05, 0x00, 0x0000 }, - { 24, 0x006f, 0x0400004f, 0x06, 0x00, 0x0000 }, - { 24, 0x006f, 0x0400004f, 0x07, 0x00, 0x0000 }, - { 24, 0x006f, 0x0800004f, 0x08, 0x00, 0x0000 }, - { 24, 0x006f, 0x0800004f, 0x09, 0x00, 0x0000 }, - { 24, 0x006f, 0x0800004f, 0x0a, 0x00, 0x0000 }, - { 24, 0x006f, 0x0800004f, 0x0b, 0x00, 0x0000 }, - { 24, 0x006f, 0x0c00004f, 0x0c, 0x00, 0x0000 }, - { 24, 0x006f, 0x0c00004f, 0x0d, 0x00, 0x0000 }, - { 24, 0x006f, 0x0c00004f, 0x0e, 0x00, 0x0000 }, - { 24, 0x006f, 0x0c00004f, 0x0f, 0x00, 0x0000 }, - { 25, 0x0070, 0x00000050, 0x00, 0x00, 0x0000 }, - { 25, 0x0050, 0x00000050, 0x01, 0x00, 0x0000 }, - { 25, 0x0070, 0x00000050, 0x02, 0x00, 0x0000 }, - { 25, 0x0050, 0x00000050, 0x03, 0x00, 0x0000 }, - { 25, 0x0070, 0x04000050, 0x04, 0x00, 0x0000 }, - { 25, 0x0070, 0x04000050, 0x05, 0x00, 0x0000 }, - { 25, 0x0070, 0x04000050, 0x06, 0x00, 0x0000 }, - { 25, 0x0070, 0x04000050, 0x07, 0x00, 0x0000 }, - { 25, 0x0070, 0x08000050, 0x08, 0x00, 0x0000 }, - { 25, 0x0070, 0x08000050, 0x09, 0x00, 0x0000 }, - { 25, 0x0070, 0x08000050, 0x0a, 0x00, 0x0000 }, - { 25, 0x0070, 0x08000050, 0x0b, 0x00, 0x0000 }, - { 25, 0x0070, 0x0c000050, 0x0c, 0x00, 0x0000 }, - { 25, 0x0070, 0x0c000050, 0x0d, 0x00, 0x0000 }, - { 25, 0x0070, 0x0c000050, 0x0e, 0x00, 0x0000 }, - { 25, 0x0070, 0x0c000050, 0x0f, 0x00, 0x0000 }, - { 26, 0x005b, 0x0000005b, 0x00, 0x00, 0x0000 }, - { 26, 0x007b, 0x0000007b, 0x01, 0x00, 0x0000 }, - { 26, 0xffff, 0x01000000, 0x04, 0x00, 0x0000 }, - { 27, 0x005d, 0x0000005d, 0x00, 0x00, 0x0000 }, - { 27, 0x007d, 0x0000007d, 0x01, 0x00, 0x0000 }, - { 27, 0x007e, 0x0000007e, 0x02, 0x00, 0x0000 }, - { 27, 0x005d, 0x0400005d, 0x04, 0x00, 0x0000 }, - { 28, 0xffff, 0x01000004, 0x00, 0x00, 0x0000 }, - { 28, 0x006d, 0x0c00004d, 0x08, 0x00, 0x0000 }, - { 29, 0xffff, 0x01000021, 0x00, 0x04, 0x0004 }, - { 30, 0x0061, 0x00000041, 0x00, 0x00, 0x0000 }, - { 30, 0x0041, 0x00000041, 0x01, 0x00, 0x0000 }, - { 30, 0x0061, 0x00000041, 0x02, 0x00, 0x0000 }, - { 30, 0x0041, 0x00000041, 0x03, 0x00, 0x0000 }, - { 30, 0x0061, 0x04000041, 0x04, 0x00, 0x0000 }, - { 30, 0x0061, 0x04000041, 0x05, 0x00, 0x0000 }, - { 30, 0x0061, 0x04000041, 0x06, 0x00, 0x0000 }, - { 30, 0x0061, 0x04000041, 0x07, 0x00, 0x0000 }, - { 30, 0x0061, 0x08000041, 0x08, 0x00, 0x0000 }, - { 30, 0x0061, 0x08000041, 0x09, 0x00, 0x0000 }, - { 30, 0x0061, 0x08000041, 0x0a, 0x00, 0x0000 }, - { 30, 0x0061, 0x08000041, 0x0b, 0x00, 0x0000 }, - { 30, 0x0061, 0x0c000041, 0x0c, 0x00, 0x0000 }, - { 30, 0x0061, 0x0c000041, 0x0d, 0x00, 0x0000 }, - { 30, 0x0061, 0x0c000041, 0x0e, 0x00, 0x0000 }, - { 30, 0x0061, 0x0c000041, 0x0f, 0x00, 0x0000 }, - { 31, 0x0073, 0x00000053, 0x00, 0x00, 0x0000 }, - { 31, 0x0053, 0x00000053, 0x01, 0x00, 0x0000 }, - { 31, 0x0073, 0x00000053, 0x02, 0x00, 0x0000 }, - { 31, 0x0053, 0x00000053, 0x03, 0x00, 0x0000 }, - { 31, 0x0073, 0x04000053, 0x04, 0x00, 0x0000 }, - { 31, 0x0073, 0x04000053, 0x05, 0x00, 0x0000 }, - { 31, 0x0073, 0x04000053, 0x06, 0x00, 0x0000 }, - { 31, 0x0073, 0x04000053, 0x07, 0x00, 0x0000 }, - { 31, 0x0073, 0x08000053, 0x08, 0x00, 0x0000 }, - { 31, 0x0073, 0x08000053, 0x09, 0x00, 0x0000 }, - { 31, 0x0073, 0x08000053, 0x0a, 0x00, 0x0000 }, - { 31, 0x0073, 0x08000053, 0x0b, 0x00, 0x0000 }, - { 31, 0x0073, 0x0c000053, 0x0c, 0x00, 0x0000 }, - { 31, 0x0073, 0x0c000053, 0x0d, 0x00, 0x0000 }, - { 31, 0x0073, 0x0c000053, 0x0e, 0x00, 0x0000 }, - { 31, 0x0073, 0x0c000053, 0x0f, 0x00, 0x0000 }, - { 32, 0x0064, 0x00000044, 0x00, 0x00, 0x0000 }, - { 32, 0x0044, 0x00000044, 0x01, 0x00, 0x0000 }, - { 32, 0x0064, 0x00000044, 0x02, 0x00, 0x0000 }, - { 32, 0x0044, 0x00000044, 0x03, 0x00, 0x0000 }, - { 32, 0x0064, 0x04000044, 0x04, 0x00, 0x0000 }, - { 32, 0x0064, 0x04000044, 0x05, 0x00, 0x0000 }, - { 32, 0x0064, 0x04000044, 0x06, 0x00, 0x0000 }, - { 32, 0x0064, 0x04000044, 0x07, 0x00, 0x0000 }, - { 32, 0x0064, 0x08000044, 0x08, 0x00, 0x0000 }, - { 32, 0x0064, 0x08000044, 0x09, 0x00, 0x0000 }, - { 32, 0x0064, 0x08000044, 0x0a, 0x00, 0x0000 }, - { 32, 0x0064, 0x08000044, 0x0b, 0x00, 0x0000 }, - { 32, 0x0064, 0x0c000044, 0x0c, 0x00, 0x0000 }, - { 32, 0x0064, 0x0c000044, 0x0d, 0x00, 0x0000 }, - { 32, 0x0064, 0x0c000044, 0x0e, 0x00, 0x0000 }, - { 32, 0x0064, 0x0c000044, 0x0f, 0x00, 0x0000 }, - { 33, 0x0066, 0x00000046, 0x00, 0x00, 0x0000 }, - { 33, 0x0046, 0x00000046, 0x01, 0x00, 0x0000 }, - { 33, 0x0066, 0x00000046, 0x02, 0x00, 0x0000 }, - { 33, 0x0046, 0x00000046, 0x03, 0x00, 0x0000 }, - { 33, 0x0066, 0x04000046, 0x04, 0x00, 0x0000 }, - { 33, 0x0066, 0x04000046, 0x05, 0x00, 0x0000 }, - { 33, 0x0066, 0x04000046, 0x06, 0x00, 0x0000 }, - { 33, 0x0066, 0x04000046, 0x07, 0x00, 0x0000 }, - { 33, 0x0066, 0x08000046, 0x08, 0x00, 0x0000 }, - { 33, 0x0066, 0x08000046, 0x09, 0x00, 0x0000 }, - { 33, 0x0066, 0x08000046, 0x0a, 0x00, 0x0000 }, - { 33, 0x0066, 0x08000046, 0x0b, 0x00, 0x0000 }, - { 33, 0x0066, 0x0c000046, 0x0c, 0x00, 0x0000 }, - { 33, 0x0066, 0x0c000046, 0x0d, 0x00, 0x0000 }, - { 33, 0x0066, 0x0c000046, 0x0e, 0x00, 0x0000 }, - { 33, 0x0066, 0x0c000046, 0x0f, 0x00, 0x0000 }, - { 34, 0x0067, 0x00000047, 0x00, 0x00, 0x0000 }, - { 34, 0x0047, 0x00000047, 0x01, 0x00, 0x0000 }, - { 34, 0x0067, 0x00000047, 0x02, 0x00, 0x0000 }, - { 34, 0x0047, 0x00000047, 0x03, 0x00, 0x0000 }, - { 34, 0x0067, 0x04000047, 0x04, 0x00, 0x0000 }, - { 34, 0x0067, 0x04000047, 0x05, 0x00, 0x0000 }, - { 34, 0x0067, 0x04000047, 0x06, 0x00, 0x0000 }, - { 34, 0x0067, 0x04000047, 0x07, 0x00, 0x0000 }, - { 34, 0x0067, 0x08000047, 0x08, 0x00, 0x0000 }, - { 34, 0x0067, 0x08000047, 0x09, 0x00, 0x0000 }, - { 34, 0x0067, 0x08000047, 0x0a, 0x00, 0x0000 }, - { 34, 0x0067, 0x08000047, 0x0b, 0x00, 0x0000 }, - { 34, 0x0067, 0x0c000047, 0x0c, 0x00, 0x0000 }, - { 34, 0x0067, 0x0c000047, 0x0d, 0x00, 0x0000 }, - { 34, 0x0067, 0x0c000047, 0x0e, 0x00, 0x0000 }, - { 34, 0x0067, 0x0c000047, 0x0f, 0x00, 0x0000 }, - { 35, 0x0068, 0x00000048, 0x00, 0x00, 0x0000 }, - { 35, 0x0048, 0x00000048, 0x01, 0x00, 0x0000 }, - { 35, 0x0068, 0x00000048, 0x02, 0x00, 0x0000 }, - { 35, 0x0048, 0x00000048, 0x03, 0x00, 0x0000 }, - { 35, 0x0068, 0x04000048, 0x04, 0x00, 0x0000 }, - { 35, 0x0068, 0x04000048, 0x05, 0x00, 0x0000 }, - { 35, 0x0068, 0x04000048, 0x06, 0x00, 0x0000 }, - { 35, 0x0068, 0x04000048, 0x07, 0x00, 0x0000 }, - { 35, 0x0068, 0x08000048, 0x08, 0x00, 0x0000 }, - { 35, 0x0068, 0x08000048, 0x09, 0x00, 0x0000 }, - { 35, 0x0068, 0x08000048, 0x0a, 0x00, 0x0000 }, - { 35, 0x0068, 0x08000048, 0x0b, 0x00, 0x0000 }, - { 35, 0x0068, 0x0c000048, 0x0c, 0x00, 0x0000 }, - { 35, 0x0068, 0x0c000048, 0x0d, 0x00, 0x0000 }, - { 35, 0x0068, 0x0c000048, 0x0e, 0x00, 0x0000 }, - { 35, 0x0068, 0x0c000048, 0x0f, 0x00, 0x0000 }, - { 36, 0x006a, 0x0000004a, 0x00, 0x00, 0x0000 }, - { 36, 0x004a, 0x0000004a, 0x01, 0x00, 0x0000 }, - { 36, 0x006a, 0x0000004a, 0x02, 0x00, 0x0000 }, - { 36, 0x004a, 0x0000004a, 0x03, 0x00, 0x0000 }, - { 36, 0x006a, 0x0400004a, 0x04, 0x00, 0x0000 }, - { 36, 0x006a, 0x0400004a, 0x05, 0x00, 0x0000 }, - { 36, 0x006a, 0x0400004a, 0x06, 0x00, 0x0000 }, - { 36, 0x006a, 0x0400004a, 0x07, 0x00, 0x0000 }, - { 36, 0x006a, 0x0800004a, 0x08, 0x00, 0x0000 }, - { 36, 0x006a, 0x0800004a, 0x09, 0x00, 0x0000 }, - { 36, 0x006a, 0x0800004a, 0x0a, 0x00, 0x0000 }, - { 36, 0x006a, 0x0800004a, 0x0b, 0x00, 0x0000 }, - { 36, 0x006a, 0x0c00004a, 0x0c, 0x00, 0x0000 }, - { 36, 0x006a, 0x0c00004a, 0x0d, 0x00, 0x0000 }, - { 36, 0x006a, 0x0c00004a, 0x0e, 0x00, 0x0000 }, - { 36, 0x006a, 0x0c00004a, 0x0f, 0x00, 0x0000 }, - { 37, 0x006b, 0x0000004b, 0x00, 0x00, 0x0000 }, - { 37, 0x004b, 0x0000004b, 0x01, 0x00, 0x0000 }, - { 37, 0x006b, 0x0000004b, 0x02, 0x00, 0x0000 }, - { 37, 0x004b, 0x0000004b, 0x03, 0x00, 0x0000 }, - { 37, 0x006b, 0x0400004b, 0x04, 0x00, 0x0000 }, - { 37, 0x006b, 0x0400004b, 0x05, 0x00, 0x0000 }, - { 37, 0x006b, 0x0400004b, 0x06, 0x00, 0x0000 }, - { 37, 0x006b, 0x0400004b, 0x07, 0x00, 0x0000 }, - { 37, 0x006b, 0x0800004b, 0x08, 0x00, 0x0000 }, - { 37, 0x006b, 0x0800004b, 0x09, 0x00, 0x0000 }, - { 37, 0x006b, 0x0800004b, 0x0a, 0x00, 0x0000 }, - { 37, 0x006b, 0x0800004b, 0x0b, 0x00, 0x0000 }, - { 37, 0x006b, 0x0c00004b, 0x0c, 0x00, 0x0000 }, - { 37, 0x006b, 0x0c00004b, 0x0d, 0x00, 0x0000 }, - { 37, 0x006b, 0x0c00004b, 0x0e, 0x00, 0x0000 }, - { 37, 0x006b, 0x0c00004b, 0x0f, 0x00, 0x0000 }, - { 38, 0x006c, 0x0000004c, 0x00, 0x00, 0x0000 }, - { 38, 0x004c, 0x0000004c, 0x01, 0x00, 0x0000 }, - { 38, 0x006c, 0x0000004c, 0x02, 0x00, 0x0000 }, - { 38, 0x004c, 0x0000004c, 0x03, 0x00, 0x0000 }, - { 38, 0x006c, 0x0400004c, 0x04, 0x00, 0x0000 }, - { 38, 0x006c, 0x0400004c, 0x05, 0x00, 0x0000 }, - { 38, 0x006c, 0x0400004c, 0x06, 0x00, 0x0000 }, - { 38, 0x006c, 0x0400004c, 0x07, 0x00, 0x0000 }, - { 38, 0x006c, 0x0800004c, 0x08, 0x00, 0x0000 }, - { 38, 0x006c, 0x0800004c, 0x09, 0x00, 0x0000 }, - { 38, 0x006c, 0x0800004c, 0x0a, 0x00, 0x0000 }, - { 38, 0x006c, 0x0800004c, 0x0b, 0x00, 0x0000 }, - { 38, 0x006c, 0x0c00004c, 0x0c, 0x00, 0x0000 }, - { 38, 0x006c, 0x0c00004c, 0x0d, 0x00, 0x0000 }, - { 38, 0x006c, 0x0c00004c, 0x0e, 0x00, 0x0000 }, - { 38, 0x006c, 0x0c00004c, 0x0f, 0x00, 0x0000 }, - { 39, 0x003b, 0x0000003b, 0x00, 0x00, 0x0000 }, - { 39, 0x003a, 0x0000003a, 0x01, 0x00, 0x0000 }, - { 40, 0x0027, 0x00000027, 0x00, 0x00, 0x0000 }, - { 40, 0x0022, 0x00000022, 0x01, 0x00, 0x0000 }, - { 40, 0x0027, 0x01001251, 0x02, 0x01, 0x0000 }, - { 40, 0x0022, 0x01001257, 0x03, 0x01, 0x0000 }, - { 40, 0x0067, 0x04000047, 0x04, 0x00, 0x0000 }, - { 41, 0x0060, 0x00000060, 0x00, 0x00, 0x0000 }, - { 41, 0x007e, 0x0000007e, 0x01, 0x00, 0x0000 }, - { 41, 0x0060, 0x01001250, 0x02, 0x01, 0x0000 }, - { 41, 0x007e, 0x01001253, 0x03, 0x01, 0x0000 }, - { 42, 0xffff, 0x01000020, 0x00, 0x04, 0x0001 }, - { 43, 0x005c, 0x0000005c, 0x00, 0x00, 0x0000 }, - { 43, 0x007c, 0x0000007c, 0x01, 0x00, 0x0000 }, - { 43, 0x005c, 0x0400005c, 0x04, 0x00, 0x0000 }, - { 44, 0x007a, 0x0000005a, 0x00, 0x00, 0x0000 }, - { 44, 0x005a, 0x0000005a, 0x01, 0x00, 0x0000 }, - { 44, 0x007a, 0x0000005a, 0x02, 0x00, 0x0000 }, - { 44, 0x005a, 0x0000005a, 0x03, 0x00, 0x0000 }, - { 44, 0x007a, 0x0400005a, 0x04, 0x00, 0x0000 }, - { 44, 0x007a, 0x0400005a, 0x05, 0x00, 0x0000 }, - { 44, 0x007a, 0x0400005a, 0x06, 0x00, 0x0000 }, - { 44, 0x007a, 0x0400005a, 0x07, 0x00, 0x0000 }, - { 44, 0x007a, 0x0800005a, 0x08, 0x00, 0x0000 }, - { 44, 0x007a, 0x0800005a, 0x09, 0x00, 0x0000 }, - { 44, 0x007a, 0x0800005a, 0x0a, 0x00, 0x0000 }, - { 44, 0x007a, 0x0800005a, 0x0b, 0x00, 0x0000 }, - { 44, 0x007a, 0x0c00005a, 0x0c, 0x00, 0x0000 }, - { 44, 0x007a, 0x0c00005a, 0x0d, 0x00, 0x0000 }, - { 44, 0x007a, 0x0c00005a, 0x0e, 0x00, 0x0000 }, - { 44, 0x007a, 0x0c00005a, 0x0f, 0x00, 0x0000 }, - { 45, 0x0078, 0x00000058, 0x00, 0x00, 0x0000 }, - { 45, 0x0058, 0x00000058, 0x01, 0x00, 0x0000 }, - { 45, 0x0078, 0x00000058, 0x02, 0x00, 0x0000 }, - { 45, 0x0058, 0x00000058, 0x03, 0x00, 0x0000 }, - { 45, 0x0078, 0x04000058, 0x04, 0x00, 0x0000 }, - { 45, 0x0078, 0x04000058, 0x05, 0x00, 0x0000 }, - { 45, 0x0078, 0x04000058, 0x06, 0x00, 0x0000 }, - { 45, 0x0078, 0x04000058, 0x07, 0x00, 0x0000 }, - { 45, 0x0078, 0x08000058, 0x08, 0x00, 0x0000 }, - { 45, 0x0078, 0x08000058, 0x09, 0x00, 0x0000 }, - { 45, 0x0078, 0x08000058, 0x0a, 0x00, 0x0000 }, - { 45, 0x0078, 0x08000058, 0x0b, 0x00, 0x0000 }, - { 45, 0x0078, 0x0c000058, 0x0c, 0x00, 0x0000 }, - { 45, 0x0078, 0x0c000058, 0x0d, 0x00, 0x0000 }, - { 45, 0x0078, 0x0c000058, 0x0e, 0x00, 0x0000 }, - { 45, 0x0078, 0x0c000058, 0x0f, 0x00, 0x0000 }, - { 46, 0x0063, 0x00000043, 0x00, 0x00, 0x0000 }, - { 46, 0x0043, 0x00000043, 0x01, 0x00, 0x0000 }, - { 46, 0x0063, 0x00000043, 0x02, 0x00, 0x0000 }, - { 46, 0x0043, 0x00000043, 0x03, 0x00, 0x0000 }, - { 46, 0x0063, 0x04000043, 0x04, 0x00, 0x0000 }, - { 46, 0x0063, 0x04000043, 0x05, 0x00, 0x0000 }, - { 46, 0x0063, 0x04000043, 0x06, 0x00, 0x0000 }, - { 46, 0x0063, 0x04000043, 0x07, 0x00, 0x0000 }, - { 46, 0x0063, 0x08000043, 0x08, 0x00, 0x0000 }, - { 46, 0x0063, 0x08000043, 0x09, 0x00, 0x0000 }, - { 46, 0x0063, 0x08000043, 0x0a, 0x00, 0x0000 }, - { 46, 0x0063, 0x08000043, 0x0b, 0x00, 0x0000 }, - { 46, 0x0063, 0x0c000043, 0x0c, 0x00, 0x0000 }, - { 46, 0x0063, 0x0c000043, 0x0d, 0x00, 0x0000 }, - { 46, 0x0063, 0x0c000043, 0x0e, 0x00, 0x0000 }, - { 46, 0x0063, 0x0c000043, 0x0f, 0x00, 0x0000 }, - { 47, 0x0076, 0x00000056, 0x00, 0x00, 0x0000 }, - { 47, 0x0056, 0x00000056, 0x01, 0x00, 0x0000 }, - { 47, 0x0076, 0x00000056, 0x02, 0x00, 0x0000 }, - { 47, 0x0056, 0x00000056, 0x03, 0x00, 0x0000 }, - { 47, 0x0076, 0x04000056, 0x04, 0x00, 0x0000 }, - { 47, 0x0076, 0x04000056, 0x05, 0x00, 0x0000 }, - { 47, 0x0076, 0x04000056, 0x06, 0x00, 0x0000 }, - { 47, 0x0076, 0x04000056, 0x07, 0x00, 0x0000 }, - { 47, 0x0076, 0x08000056, 0x08, 0x00, 0x0000 }, - { 47, 0x0076, 0x08000056, 0x09, 0x00, 0x0000 }, - { 47, 0x0076, 0x08000056, 0x0a, 0x00, 0x0000 }, - { 47, 0x0076, 0x08000056, 0x0b, 0x00, 0x0000 }, - { 47, 0x0076, 0x0c000056, 0x0c, 0x00, 0x0000 }, - { 47, 0x0076, 0x0c000056, 0x0d, 0x00, 0x0000 }, - { 47, 0x0076, 0x0c000056, 0x0e, 0x00, 0x0000 }, - { 47, 0x0076, 0x0c000056, 0x0f, 0x00, 0x0000 }, - { 48, 0x0062, 0x00000042, 0x00, 0x00, 0x0000 }, - { 48, 0x0042, 0x00000042, 0x01, 0x00, 0x0000 }, - { 48, 0x0062, 0x00000042, 0x02, 0x00, 0x0000 }, - { 48, 0x0042, 0x00000042, 0x03, 0x00, 0x0000 }, - { 48, 0x0062, 0x04000042, 0x04, 0x00, 0x0000 }, - { 48, 0x0062, 0x04000042, 0x05, 0x00, 0x0000 }, - { 48, 0x0062, 0x04000042, 0x06, 0x00, 0x0000 }, - { 48, 0x0062, 0x04000042, 0x07, 0x00, 0x0000 }, - { 48, 0x0062, 0x08000042, 0x08, 0x00, 0x0000 }, - { 48, 0x0062, 0x08000042, 0x09, 0x00, 0x0000 }, - { 48, 0x0062, 0x08000042, 0x0a, 0x00, 0x0000 }, - { 48, 0x0062, 0x08000042, 0x0b, 0x00, 0x0000 }, - { 48, 0x0062, 0x0c000042, 0x0c, 0x00, 0x0000 }, - { 48, 0x0062, 0x0c000042, 0x0d, 0x00, 0x0000 }, - { 48, 0x0062, 0x0c000042, 0x0e, 0x00, 0x0000 }, - { 48, 0x0062, 0x0c000042, 0x0f, 0x00, 0x0000 }, - { 49, 0x006e, 0x0000004e, 0x00, 0x00, 0x0000 }, - { 49, 0x004e, 0x0000004e, 0x01, 0x00, 0x0000 }, - { 49, 0x006e, 0x0000004e, 0x02, 0x00, 0x0000 }, - { 49, 0x004e, 0x0000004e, 0x03, 0x00, 0x0000 }, - { 49, 0x006e, 0x0400004e, 0x04, 0x00, 0x0000 }, - { 49, 0x006e, 0x0400004e, 0x05, 0x00, 0x0000 }, - { 49, 0x006e, 0x0400004e, 0x06, 0x00, 0x0000 }, - { 49, 0x006e, 0x0400004e, 0x07, 0x00, 0x0000 }, - { 49, 0x006e, 0x0800004e, 0x08, 0x00, 0x0000 }, - { 49, 0x006e, 0x0800004e, 0x09, 0x00, 0x0000 }, - { 49, 0x006e, 0x0800004e, 0x0a, 0x00, 0x0000 }, - { 49, 0x006e, 0x0800004e, 0x0b, 0x00, 0x0000 }, - { 49, 0x006e, 0x0c00004e, 0x0c, 0x00, 0x0000 }, - { 49, 0x006e, 0x0c00004e, 0x0d, 0x00, 0x0000 }, - { 49, 0x006e, 0x0c00004e, 0x0e, 0x00, 0x0000 }, - { 49, 0x006e, 0x0c00004e, 0x0f, 0x00, 0x0000 }, - { 50, 0x006d, 0x0000004d, 0x00, 0x00, 0x0000 }, - { 50, 0x004d, 0x0000004d, 0x01, 0x00, 0x0000 }, - { 50, 0x006d, 0x0000004d, 0x02, 0x00, 0x0000 }, - { 50, 0x004d, 0x0000004d, 0x03, 0x00, 0x0000 }, - { 50, 0x006d, 0x0400004d, 0x04, 0x00, 0x0000 }, - { 50, 0x006d, 0x0400004d, 0x05, 0x00, 0x0000 }, - { 50, 0x006d, 0x0400004d, 0x06, 0x00, 0x0000 }, - { 50, 0x006d, 0x0400004d, 0x07, 0x00, 0x0000 }, - { 50, 0x006d, 0x0800004d, 0x08, 0x00, 0x0000 }, - { 50, 0x006d, 0x0800004d, 0x09, 0x00, 0x0000 }, - { 50, 0x006d, 0x0800004d, 0x0a, 0x00, 0x0000 }, - { 50, 0x006d, 0x0800004d, 0x0b, 0x00, 0x0000 }, - { 50, 0x006d, 0x0c00004d, 0x0c, 0x00, 0x0000 }, - { 50, 0x006d, 0x0c00004d, 0x0d, 0x00, 0x0000 }, - { 50, 0x006d, 0x0c00004d, 0x0e, 0x00, 0x0000 }, - { 50, 0x006d, 0x0c00004d, 0x0f, 0x00, 0x0000 }, - { 51, 0x002c, 0x0000002c, 0x00, 0x00, 0x0000 }, - { 51, 0x003c, 0x0000003c, 0x01, 0x00, 0x0000 }, - { 51, 0x002c, 0x0100125b, 0x02, 0x01, 0x0000 }, - { 52, 0x002e, 0x0000002e, 0x00, 0x00, 0x0000 }, - { 52, 0x003e, 0x0000003e, 0x01, 0x00, 0x0000 }, - { 52, 0xffff, 0x01001120, 0x02, 0x00, 0x0000 }, - { 53, 0x002f, 0x0000002f, 0x00, 0x00, 0x0000 }, - { 53, 0x003f, 0x0000003f, 0x01, 0x00, 0x0000 }, - { 53, 0xffff, 0x01000003, 0x04, 0x00, 0x0000 }, - { 54, 0xffff, 0x01000020, 0x00, 0x04, 0x0001 }, - { 55, 0x002a, 0x2000002a, 0x00, 0x00, 0x0000 }, - { 56, 0xffff, 0x01000023, 0x00, 0x04, 0x0008 }, - { 57, 0x0020, 0x00000020, 0x00, 0x00, 0x0000 }, - { 58, 0xffff, 0x01000024, 0x00, 0x00, 0x0000 }, - { 59, 0xffff, 0x01000030, 0x00, 0x00, 0x0000 }, - { 59, 0xffff, 0x0100003c, 0x01, 0x00, 0x0000 }, - { 59, 0xffff, 0x01000048, 0x04, 0x00, 0x0000 }, - { 59, 0xffff, 0x01000000, 0x0c, 0x08, 0x0100 }, - { 60, 0xffff, 0x01000031, 0x00, 0x00, 0x0000 }, - { 60, 0xffff, 0x0100003d, 0x01, 0x00, 0x0000 }, - { 60, 0xffff, 0x01000049, 0x04, 0x00, 0x0000 }, - { 60, 0xffff, 0x01000000, 0x0c, 0x08, 0x0101 }, - { 61, 0xffff, 0x01000032, 0x00, 0x00, 0x0000 }, - { 61, 0xffff, 0x0100003e, 0x01, 0x00, 0x0000 }, - { 61, 0xffff, 0x0100004a, 0x04, 0x00, 0x0000 }, - { 61, 0xffff, 0x01000000, 0x0c, 0x08, 0x0102 }, - { 62, 0xffff, 0x01000033, 0x00, 0x00, 0x0000 }, - { 62, 0xffff, 0x0100003f, 0x01, 0x00, 0x0000 }, - { 62, 0xffff, 0x0100004b, 0x04, 0x00, 0x0000 }, - { 62, 0xffff, 0x01000000, 0x0c, 0x08, 0x0103 }, - { 63, 0xffff, 0x01000034, 0x00, 0x00, 0x0000 }, - { 63, 0xffff, 0x01000040, 0x01, 0x00, 0x0000 }, - { 63, 0xffff, 0x0100004c, 0x04, 0x00, 0x0000 }, - { 63, 0xffff, 0x01000000, 0x0c, 0x08, 0x0104 }, - { 64, 0xffff, 0x01000035, 0x00, 0x00, 0x0000 }, - { 64, 0xffff, 0x01000041, 0x01, 0x00, 0x0000 }, - { 64, 0xffff, 0x0100004d, 0x04, 0x00, 0x0000 }, - { 64, 0xffff, 0x01000000, 0x0c, 0x08, 0x0105 }, - { 65, 0xffff, 0x01000036, 0x00, 0x00, 0x0000 }, - { 65, 0xffff, 0x01000042, 0x01, 0x00, 0x0000 }, - { 65, 0xffff, 0x0100004e, 0x04, 0x00, 0x0000 }, - { 65, 0xffff, 0x01000000, 0x0c, 0x08, 0x0106 }, - { 66, 0xffff, 0x01000037, 0x00, 0x00, 0x0000 }, - { 66, 0xffff, 0x01000043, 0x01, 0x00, 0x0000 }, - { 66, 0xffff, 0x0100004f, 0x04, 0x00, 0x0000 }, - { 66, 0xffff, 0x01000000, 0x0c, 0x08, 0x0107 }, - { 67, 0xffff, 0x01000038, 0x00, 0x00, 0x0000 }, - { 67, 0xffff, 0x01000044, 0x01, 0x00, 0x0000 }, - { 67, 0xffff, 0x01000050, 0x04, 0x00, 0x0000 }, - { 67, 0xffff, 0x01000000, 0x0c, 0x08, 0x0108 }, - { 68, 0xffff, 0x01000039, 0x00, 0x00, 0x0000 }, - { 68, 0xffff, 0x01000045, 0x01, 0x00, 0x0000 }, - { 68, 0xffff, 0x01000051, 0x04, 0x00, 0x0000 }, - { 68, 0xffff, 0x01000000, 0x0c, 0x08, 0x0109 }, - { 69, 0xffff, 0x01000025, 0x00, 0x00, 0x0000 }, - { 70, 0xffff, 0x01000026, 0x00, 0x00, 0x0000 }, - { 70, 0xffff, 0x01000026, 0x08, 0x00, 0x0000 }, - { 71, 0x0037, 0x20000037, 0x00, 0x00, 0x0000 }, - { 72, 0x0038, 0x20000038, 0x00, 0x00, 0x0000 }, - { 73, 0x0039, 0x20000039, 0x00, 0x00, 0x0000 }, - { 74, 0x002d, 0x2000002d, 0x00, 0x00, 0x0000 }, - { 75, 0x0034, 0x20000034, 0x00, 0x00, 0x0000 }, - { 76, 0x0035, 0x20000035, 0x00, 0x00, 0x0000 }, - { 77, 0x0036, 0x20000036, 0x00, 0x00, 0x0000 }, - { 78, 0x002b, 0x2000002b, 0x00, 0x00, 0x0000 }, - { 79, 0x0031, 0x20000031, 0x00, 0x00, 0x0000 }, - { 80, 0x0032, 0x20000032, 0x00, 0x00, 0x0000 }, - { 81, 0x0033, 0x20000033, 0x00, 0x00, 0x0000 }, - { 82, 0x0030, 0x20000030, 0x00, 0x00, 0x0000 }, - { 83, 0x002e, 0x2000002e, 0x00, 0x00, 0x0000 }, - { 83, 0xffff, 0x01000000, 0x06, 0x08, 0x0200 }, - { 83, 0xffff, 0x01000000, 0x0c, 0x08, 0x0200 }, - { 86, 0x003c, 0x0000003c, 0x00, 0x00, 0x0000 }, - { 86, 0x003e, 0x0000003e, 0x01, 0x00, 0x0000 }, - { 86, 0x007c, 0x0000007c, 0x02, 0x00, 0x0000 }, - { 87, 0xffff, 0x0100003a, 0x00, 0x00, 0x0000 }, - { 87, 0xffff, 0x01000046, 0x01, 0x00, 0x0000 }, - { 87, 0xffff, 0x01000052, 0x04, 0x00, 0x0000 }, - { 87, 0xffff, 0x01000000, 0x0c, 0x08, 0x010a }, - { 88, 0xffff, 0x0100003b, 0x00, 0x00, 0x0000 }, - { 88, 0xffff, 0x01000047, 0x01, 0x00, 0x0000 }, - { 88, 0xffff, 0x01000000, 0x0c, 0x08, 0x010b }, - { 96, 0xffff, 0x21000005, 0x00, 0x00, 0x0000 }, - { 97, 0xffff, 0x01000021, 0x00, 0x04, 0x0004 }, - { 98, 0x002f, 0x2000002f, 0x00, 0x00, 0x0000 }, - { 99, 0x005c, 0x0400005c, 0x00, 0x00, 0x0000 }, - { 100, 0xffff, 0x01001103, 0x00, 0x04, 0x0002 }, - { 102, 0xffff, 0x01000010, 0x00, 0x00, 0x0000 }, - { 103, 0xffff, 0x01000013, 0x00, 0x00, 0x0000 }, - { 104, 0xffff, 0x01000016, 0x00, 0x00, 0x0000 }, - { 105, 0xffff, 0x01000012, 0x00, 0x00, 0x0000 }, - { 105, 0xffff, 0x01000000, 0x0c, 0x08, 0x0180 }, - { 106, 0xffff, 0x01000014, 0x00, 0x00, 0x0000 }, - { 106, 0xffff, 0x01000000, 0x0c, 0x08, 0x0181 }, - { 107, 0xffff, 0x01000011, 0x00, 0x00, 0x0000 }, - { 108, 0xffff, 0x01000015, 0x00, 0x00, 0x0000 }, - { 109, 0xffff, 0x01000017, 0x00, 0x00, 0x0000 }, - { 110, 0xffff, 0x01000006, 0x00, 0x00, 0x0000 }, - { 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 }, - { 152, 0xffff, 0x010000ba, 0x00, 0x00, 0x0000 }, - -}; - -const QWSKeyboard::Composing QWSKbPrivate::s_keycompose_default[] = { - { 0x0060, 0x0041, 0x00c0 }, - { 0x0060, 0x0061, 0x00e0 }, - { 0x0027, 0x0041, 0x00c1 }, - { 0x0027, 0x0061, 0x00e1 }, - { 0x005e, 0x0041, 0x00c2 }, - { 0x005e, 0x0061, 0x00e2 }, - { 0x007e, 0x0041, 0x00c3 }, - { 0x007e, 0x0061, 0x00e3 }, - { 0x0022, 0x0041, 0x00c4 }, - { 0x0022, 0x0061, 0x00e4 }, - { 0x002d, 0x0061, 0x00aa }, - { 0x002d, 0x0041, 0x00aa }, - { 0x004f, 0x0041, 0x00c5 }, - { 0x006f, 0x0061, 0x00e5 }, - { 0x0030, 0x0041, 0x00c5 }, - { 0x0030, 0x0061, 0x00e5 }, - { 0x0041, 0x0041, 0x00c5 }, - { 0x0061, 0x0061, 0x00e5 }, - { 0x00b0, 0x0041, 0x00c5 }, - { 0x00b0, 0x0061, 0x00e5 }, - { 0x0041, 0x0045, 0x00c6 }, - { 0x0061, 0x0065, 0x00e6 }, - { 0x002c, 0x0043, 0x00c7 }, - { 0x002c, 0x0063, 0x00e7 }, - { 0x005e, 0x0043, 0x00c7 }, - { 0x005e, 0x0063, 0x00e7 }, - { 0x0060, 0x0045, 0x00c8 }, - { 0x0060, 0x0065, 0x00e8 }, - { 0x0027, 0x0045, 0x00c9 }, - { 0x0027, 0x0065, 0x00e9 }, - { 0x005e, 0x0045, 0x00ca }, - { 0x005e, 0x0065, 0x00ea }, - { 0x0022, 0x0045, 0x00cb }, - { 0x0022, 0x0065, 0x00eb }, - { 0x0060, 0x0049, 0x00cc }, - { 0x0060, 0x0069, 0x00ec }, - { 0x0027, 0x0049, 0x00cd }, - { 0x0027, 0x0069, 0x00ed }, - { 0x005e, 0x0049, 0x00ce }, - { 0x005e, 0x0069, 0x00ee }, - { 0x0022, 0x0049, 0x00cf }, - { 0x0022, 0x0069, 0x00ef }, - { 0x002d, 0x0044, 0x00d0 }, - { 0x002d, 0x0064, 0x00f0 }, - { 0x005e, 0x0044, 0x00d0 }, - { 0x005e, 0x0064, 0x00f0 }, - { 0x007e, 0x004e, 0x00d1 }, - { 0x007e, 0x006e, 0x00f1 }, - { 0x005e, 0x004e, 0x00d1 }, - { 0x005e, 0x006e, 0x00f1 }, - { 0x0060, 0x004f, 0x00d2 }, - { 0x0060, 0x006f, 0x00f2 }, - { 0x0027, 0x004f, 0x00d3 }, - { 0x0027, 0x006f, 0x00f3 }, - { 0x005e, 0x004f, 0x00d4 }, - { 0x005e, 0x006f, 0x00f4 }, - { 0x007e, 0x004f, 0x00d5 }, - { 0x007e, 0x006f, 0x00f5 }, - { 0x0022, 0x004f, 0x00d6 }, - { 0x0022, 0x006f, 0x00f6 }, - { 0x002f, 0x004f, 0x00d8 }, - { 0x002f, 0x006f, 0x00f8 }, - { 0x002d, 0x006f, 0x00ba }, - { 0x002d, 0x004f, 0x00ba }, - { 0x0060, 0x0055, 0x00d9 }, - { 0x0060, 0x0075, 0x00f9 }, - { 0x0027, 0x0055, 0x00da }, - { 0x0027, 0x0075, 0x00fa }, - { 0x005e, 0x0055, 0x00db }, - { 0x005e, 0x0075, 0x00fb }, - { 0x0022, 0x0055, 0x00dc }, - { 0x0022, 0x0075, 0x00fc }, - { 0x0027, 0x0059, 0x00dd }, - { 0x0027, 0x0079, 0x00fd }, - { 0x0054, 0x0048, 0x00de }, - { 0x0074, 0x0068, 0x00fe }, - { 0x0073, 0x0073, 0x00df }, - { 0x0022, 0x0079, 0x00ff }, - { 0x0073, 0x007a, 0x00df }, - { 0x006e, 0x006e, 0x00f1 }, - { 0x006e, 0x0068, 0x00f1 }, - { 0x004e, 0x0059, 0x00d1 }, - { 0x004e, 0x004e, 0x00d1 }, - { 0x004e, 0x0048, 0x00d1 }, - { 0x004e, 0x0079, 0x00d1 }, - { 0x004e, 0x006e, 0x00d1 }, - { 0x004e, 0x0068, 0x00d1 }, - { 0x002d, 0x004c, 0x00a3 }, - { 0x003c, 0x003c, 0x00ab }, - { 0x003e, 0x003e, 0x00bb }, - { 0x003f, 0x003f, 0x00bf }, - { 0x005e, 0x003f, 0x00bf }, - { 0x0021, 0x0021, 0x00a1 }, - { 0x005e, 0x0021, 0x00a1 }, - { 0x005e, 0x0031, 0x00b9 }, - { 0x005e, 0x0032, 0x00b2 }, - { 0x005e, 0x0033, 0x00b3 }, - { 0x002b, 0x002d, 0x00b1 }, - { 0x0063, 0x003d, 0x00a2 }, - { 0x0063, 0x002f, 0x00a2 }, - { 0x002f, 0x0063, 0x00a2 }, - { 0x002d, 0x0063, 0x00a2 }, - { 0x002d, 0x0043, 0x00a2 }, - { 0x004c, 0x003d, 0x00a3 }, - { 0x002d, 0x004c, 0x00a3 }, - { 0x002d, 0x006c, 0x00a3 }, - { 0x005e, 0x002a, 0x00d7 }, - { 0x005e, 0x0078, 0x00d7 }, - { 0x0078, 0x0078, 0x00d7 }, - { 0x005e, 0x002e, 0x00b7 }, - { 0x002e, 0x002e, 0x00b7 }, - { 0x005e, 0x002f, 0x00f7 }, - { 0x005e, 0x003a, 0x00f7 }, - { 0x002d, 0x003a, 0x00f7 }, - { 0x003a, 0x002d, 0x00f7 }, - { 0x0059, 0x003d, 0x00a5 }, - { 0x002d, 0x0059, 0x00a5 }, - { 0x002d, 0x006c, 0x00a5 }, - { 0x0028, 0x0063, 0x00a9 }, - { 0x0022, 0x0063, 0x00a9 }, - { 0x002d, 0x0061, 0x00aa }, - { 0x002d, 0x0041, 0x00aa }, - { 0x002d, 0x006f, 0x00ba }, - { 0x002d, 0x004f, 0x00ba }, - { 0x0028, 0x0072, 0x00ae }, - { 0x0022, 0x0072, 0x00ae }, - { 0x006d, 0x0075, 0x00b5 }, - { 0x0031, 0x0034, 0x0152 }, - { 0x0031, 0x0032, 0x0153 }, - { 0x0033, 0x0034, 0x0178 }, - { 0x0065, 0x003d, 0x20ac }, - { 0x002d, 0x0065, 0x20ac }, - { 0x002d, 0x0045, 0x20ac }, - { 0x0076, 0x0053, 0x0160 }, - { 0x005e, 0x0053, 0x0160 }, - { 0x0076, 0x0073, 0x0161 }, - { 0x005e, 0x0073, 0x0161 }, - { 0x0076, 0x005a, 0x017d }, - { 0x005e, 0x005a, 0x017d }, - { 0x0076, 0x007a, 0x017e }, - { 0x005e, 0x007a, 0x017e }, - { 0x004f, 0x0045, 0x0152 }, - { 0x004f, 0x0065, 0x0152 }, - { 0x006f, 0x0065, 0x0153 }, - { 0x0022, 0x0059, 0x0178 }, - { 0x0069, 0x006a, 0x00ff }, - { 0x0049, 0x004a, 0x0178 }, -}; - -#endif diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp deleted file mode 100644 index 77ae47bc73a..00000000000 --- a/src/gui/embedded/qkbd_qws.cpp +++ /dev/null @@ -1,693 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qkbd_qws.h" -#include "qkbd_qws_p.h" - -#ifndef QT_NO_QWS_KEYBOARD - -#include -#include -#include - -#ifdef Q_WS_QWS -#include "qwindowsystem_qws.h" -#include "qscreen_qws.h" -#endif - -#ifdef Q_WS_QPA -#include -#include -#endif - -#include "qtimer.h" -#include - -//#define QT_DEBUG_KEYMAP - - -QT_BEGIN_NAMESPACE - -class QWSKbPrivate : public QObject -{ - Q_OBJECT -public: - QWSKbPrivate(QWSKeyboardHandler *h, const QString &device) - : m_handler(h), m_modifiers(0), m_composing(0), m_dead_unicode(0xffff), - m_no_zap(false), m_do_compose(false), - m_keymap(0), m_keymap_size(0), m_keycompose(0), m_keycompose_size(0) - { - m_ar_timer = new QTimer(this); - m_ar_timer->setSingleShot(true); - connect(m_ar_timer, SIGNAL(timeout()), SLOT(autoRepeat())); - m_ar_delay = 400; - m_ar_period = 80; - - memset(m_locks, 0, sizeof(m_locks)); - - QString keymap; - QStringList args = device.split(QLatin1Char(':')); - foreach (const QString &arg, args) { - if (arg.startsWith(QLatin1String("keymap="))) - keymap = arg.mid(7); - else if (arg == QLatin1String("disable-zap")) - m_no_zap = true; - else if (arg == QLatin1String("enable-compose")) - m_do_compose = true; - else if (arg.startsWith(QLatin1String("repeat-delay="))) - m_ar_delay = arg.mid(13).toInt(); - else if (arg.startsWith(QLatin1String("repeat-rate="))) - m_ar_period = arg.mid(12).toInt(); - } - - if (keymap.isEmpty() || !loadKeymap(keymap)) - unloadKeymap(); - } - - ~QWSKbPrivate() - { - unloadKeymap(); - } - - void beginAutoRepeat(int uni, int code, Qt::KeyboardModifiers mod) - { - m_ar_unicode = uni; - m_ar_keycode = code; - m_ar_modifier = mod; - m_ar_timer->start(m_ar_delay); - } - - void endAutoRepeat() - { - m_ar_timer->stop(); - } - - static Qt::KeyboardModifiers toQtModifiers(quint8 mod) - { - Qt::KeyboardModifiers qtmod = Qt::NoModifier; - - if (mod & (QWSKeyboard::ModShift | QWSKeyboard::ModShiftL | QWSKeyboard::ModShiftR)) - qtmod |= Qt::ShiftModifier; - if (mod & (QWSKeyboard::ModControl | QWSKeyboard::ModCtrlL | QWSKeyboard::ModCtrlR)) - qtmod |= Qt::ControlModifier; - if (mod & QWSKeyboard::ModAlt) - qtmod |= Qt::AltModifier; - - return qtmod; - } - - void unloadKeymap(); - bool loadKeymap(const QString &file); - -private slots: - void autoRepeat() - { - m_handler->processKeyEvent(m_ar_unicode, m_ar_keycode, m_ar_modifier, false, true); - m_handler->processKeyEvent(m_ar_unicode, m_ar_keycode, m_ar_modifier, true, true); - m_ar_timer->start(m_ar_period); - } - -private: - QWSKeyboardHandler *m_handler; - - // auto repeat simulation - int m_ar_unicode; - int m_ar_keycode; - Qt::KeyboardModifiers m_ar_modifier; - int m_ar_delay; - int m_ar_period; - QTimer *m_ar_timer; - - // keymap handling - quint8 m_modifiers; - quint8 m_locks[3]; - int m_composing; - quint16 m_dead_unicode; - - bool m_no_zap; - bool m_do_compose; - - const QWSKeyboard::Mapping *m_keymap; - int m_keymap_size; - const QWSKeyboard::Composing *m_keycompose; - int m_keycompose_size; - - static const QWSKeyboard::Mapping s_keymap_default[]; - static const QWSKeyboard::Composing s_keycompose_default[]; - - friend class QWSKeyboardHandler; -}; - -// simple builtin US keymap -#include "qkbd_defaultmap_qws_p.h" - -// the unloadKeymap() function needs to be AFTER the defaultmap include, -// since the sizeof(s_keymap_default) wouldn't work otherwise. - -void QWSKbPrivate::unloadKeymap() -{ - if (m_keymap && m_keymap != s_keymap_default) - delete [] m_keymap; - if (m_keycompose && m_keycompose != s_keycompose_default) - delete [] m_keycompose; - - m_keymap = s_keymap_default; - m_keymap_size = sizeof(s_keymap_default) / sizeof(s_keymap_default[0]); - m_keycompose = s_keycompose_default; - m_keycompose_size = sizeof(s_keycompose_default) / sizeof(s_keycompose_default[0]); - - // reset state, so we could switch keymaps at runtime - m_modifiers = 0; - memset(m_locks, 0, sizeof(m_locks)); - m_composing = 0; - m_dead_unicode = 0xffff; -} - -bool QWSKbPrivate::loadKeymap(const QString &file) -{ - QFile f(file); - - if (!f.open(QIODevice::ReadOnly)) { - qWarning("Could not open keymap file '%s'", qPrintable(file)); - return false; - } - - // .qmap files have a very simple structure: - // quint32 magic (QWSKeyboard::FileMagic) - // quint32 version (1) - // quint32 keymap_size (# of struct QWSKeyboard::Mappings) - // quint32 keycompose_size (# of struct QWSKeyboard::Composings) - // all QWSKeyboard::Mappings via QDataStream::operator(<<|>>) - // all QWSKeyboard::Composings via QDataStream::operator(<<|>>) - - quint32 qmap_magic, qmap_version, qmap_keymap_size, qmap_keycompose_size; - - QDataStream ds(&f); - - ds >> qmap_magic >> qmap_version >> qmap_keymap_size >> qmap_keycompose_size; - - if (ds.status() != QDataStream::Ok || qmap_magic != QWSKeyboard::FileMagic || qmap_version != 1 || qmap_keymap_size == 0) { - qWarning("'%s' is ot a valid.qmap keymap file.", qPrintable(file)); - return false; - } - - QWSKeyboard::Mapping *qmap_keymap = new QWSKeyboard::Mapping[qmap_keymap_size]; - QWSKeyboard::Composing *qmap_keycompose = qmap_keycompose_size ? new QWSKeyboard::Composing[qmap_keycompose_size] : 0; - - for (quint32 i = 0; i < qmap_keymap_size; ++i) - ds >> qmap_keymap[i]; - for (quint32 i = 0; i < qmap_keycompose_size; ++i) - ds >> qmap_keycompose[i]; - - if (ds.status() != QDataStream::Ok) { - delete [] qmap_keymap; - delete [] qmap_keycompose; - - qWarning("Keymap file '%s' can not be loaded.", qPrintable(file)); - return false; - } - - // unload currently active and clear state - unloadKeymap(); - - m_keymap = qmap_keymap; - m_keymap_size = qmap_keymap_size; - m_keycompose = qmap_keycompose; - m_keycompose_size = qmap_keycompose_size; - - m_do_compose = true; - - return true; -} - - -/*! - \class QWSKeyboardHandler - \ingroup qws - - \brief The QWSKeyboardHandler class is a base class for keyboard - drivers in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - \l{Qt for Embedded Linux} provides ready-made drivers for several keyboard - protocols, see the \l{Qt for Embedded Linux Character Input}{character - input} documentation for details. Custom keyboard drivers can be - implemented by subclassing the QWSKeyboardHandler class and - creating a keyboard driver plugin (derived from - QKbdDriverPlugin). The default implementation of the - QKbdDriverFactory class will automatically detect the plugin, and - load the driver into the server application at run-time using Qt's - \l{How to Create Qt Plugins}{plugin system}. - - The keyboard driver receives keyboard events from the system - device and encapsulates each event with an instance of the - QWSEvent class which it then passes to the server application (the - server is responsible for propagating the event to the appropriate - client). To receive keyboard events, a QWSKeyboardHandler object - will usually create a QSocketNotifier object for the given - device. The QSocketNotifier class provides support for monitoring - activity on a file descriptor. When the socket notifier receives - data, it will call the keyboard driver's processKeyEvent() - function to send the event to the \l{Qt for Embedded Linux} server - application for relaying to clients. - - - QWSKeyboardHandler also provides functions to control - auto-repetion of key sequences, beginAutoRepeat() and - endAutoRepeat(), and the transformDirKey() function enabling - transformation of arrow keys according to the display orientation. - - \sa QKbdDriverPlugin, QKbdDriverFactory, {Qt for Embedded Linux Character Input} -*/ - - -/*! - Constructs a keyboard driver. The \a device argument is passed by the - QWS_KEYBOARD environment variable. - - Call the QWSServer::setKeyboardHandler() function to make the - newly created keyboard driver, the primary driver. Note that the - primary driver is controlled by the system, i.e., the system will - delete it upon exit. -*/ -QWSKeyboardHandler::QWSKeyboardHandler(const QString &device) -{ - d = new QWSKbPrivate(this, device); -} - -/*! - \overload -*/ -QWSKeyboardHandler::QWSKeyboardHandler() -{ - d = new QWSKbPrivate(this, QString()); -} - - - -/*! - Destroys this keyboard driver. - - Do not call this function if this driver is the primary keyboard - handler, i.e., if QWSServer::setKeyboardHandler() function has - been called passing this driver as argument. The primary keyboard - driver is deleted by the system. -*/ -QWSKeyboardHandler::~QWSKeyboardHandler() -{ - delete d; -} - - -/*! - Sends a key event to the \l{Qt for Embedded Linux} server application. - - The key event is identified by its \a unicode value and the \a - keycode, \a modifiers, \a isPress and \a autoRepeat parameters. - - The \a keycode parameter is the Qt keycode value as defined by the - Qt::Key enum. The \a modifiers is an OR combination of - Qt::KeyboardModifier values, indicating whether \gui - Shift/Alt/Ctrl keys are pressed. The \a isPress parameter is true - if the event is a key press event and \a autoRepeat is true if the - event is caused by an auto-repeat mechanism and not an actual key - press. - - Note that this function does not handle key mapping. Please use - processKeycode() if you need that functionality. - - \sa processKeycode(), beginAutoRepeat(), endAutoRepeat(), transformDirKey() -*/ -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_QPA) - QEvent::Type type = isPress ? QEvent::KeyPress : QEvent::KeyRelease; - QString str; - if (unicode != 0xffff) - str = QString(unicode); - QWindowSystemInterface::handleKeyEvent(0, type, keycode, modifiers, str); -#endif -} - -/*! - \fn int QWSKeyboardHandler::transformDirKey(int keycode) - - Transforms the arrow key specified by the given \a keycode, to the - orientation of the display and returns the transformed keycode. - - The \a keycode is a Qt::Key value. The values identifying arrow - keys are: - - \list - \o Qt::Key_Left - \o Qt::Key_Up - \o Qt::Key_Right - \o Qt::Key_Down - \endlist - - \sa processKeyEvent() - */ -int QWSKeyboardHandler::transformDirKey(int key) -{ -#ifdef Q_WS_QWS - static int dir_keyrot = -1; - if (dir_keyrot < 0) { - // get the rotation - switch (qgetenv("QWS_CURSOR_ROTATION").toInt()) { - case 90: dir_keyrot = 1; break; - case 180: dir_keyrot = 2; break; - case 270: dir_keyrot = 3; break; - default: dir_keyrot = 0; break; - } - } - int xf = qt_screen->transformOrientation() + dir_keyrot; - return (key-Qt::Key_Left+xf)%4+Qt::Key_Left; -#else - return 0; -#endif -} - -/*! - \fn void QWSKeyboardHandler::beginAutoRepeat(int unicode, int keycode, Qt::KeyboardModifiers modifier) - - Begins auto-repeating the specified key press; after a short delay - the key press is sent periodically until the endAutoRepeat() - function is called. - - The key press is specified by its \a unicode, \a keycode and \a - modifier state. - - \sa endAutoRepeat(), processKeyEvent() -*/ -void QWSKeyboardHandler::beginAutoRepeat(int uni, int code, Qt::KeyboardModifiers mod) -{ - d->beginAutoRepeat(uni, code, mod); -} - -/*! - Stops auto-repeating a key press. - - \sa beginAutoRepeat(), processKeyEvent() -*/ -void QWSKeyboardHandler::endAutoRepeat() -{ - d->endAutoRepeat(); -} - -/*! - \enum QWSKeyboardHandler::KeycodeAction - - This enum describes the various special actions that actual - QWSKeyboardHandler implementations have to take care of. - - \value None No further action required. - - \value CapsLockOn Set the state of the Caps lock LED to on. - \value CapsLockOff Set the state of the Caps lock LED to off. - \value NumLockOn Set the state of the Num lock LED to on. - \value NumLockOff Set the state of the Num lock LED to off. - \value ScrollLockOn Set the state of the Scroll lock LED to on. - \value ScrollLockOff Set the state of the Scroll lock LED to off. - - \value PreviousConsole Switch to the previous virtual console (by - default Ctrl+Alt+Left on Linux). - \value NextConsole Switch to the next virtual console (by default - Ctrl+Alt+Right on Linux). - \value SwitchConsoleFirst Switch to the first virtual console (0). - \value SwitchConsoleLast Switch to the last virtual console (255). - \value SwitchConsoleMask If the KeyAction value is between SwitchConsoleFirst - and SwitchConsoleLast, you can use this mask to get - the specific virtual console number to switch to. - - \value Reboot Reboot the machine - this is ignored in both the TTY and - LinuxInput handlers though (by default Ctrl+Alt+Del on Linux). - - \sa processKeycode() -*/ - -/*! - \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. - - 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. - - The key event is identified by its \a keycode value and the \a isPress - and \a autoRepeat parameters. - - The \a keycode parameter is \bold NOT the Qt keycode value as defined by - the Qt::Key enum. This functions expects a standard Linux 16 bit kernel - keycode as it is used in the Linux Input Event sub-system. This - \a keycode is transformed to a Qt::Key code by using either a - compiled-in US keyboard layout or by dynamically loading a keymap at - startup which can be specified via the QWS_KEYBOARD environment - variable. - - The \a isPress parameter is true if the event is a key press event and - \a autoRepeat is true if the event is caused by an auto-repeat mechanism - and not an actual key press. - - The return value indicates if the actual QWSKeyboardHandler - implementation needs to take care of a special action, like console - switching or LED handling. - - If standard Linux console keymaps are used, \a keycode must be one of the - standardized values defined in \c /usr/include/linux/input.h - - \sa processKeyEvent(), KeycodeAction -*/ - -QWSKeyboardHandler::KeycodeAction QWSKeyboardHandler::processKeycode(quint16 keycode, bool pressed, bool autorepeat) -{ - KeycodeAction result = None; - bool first_press = pressed && !autorepeat; - - const QWSKeyboard::Mapping *map_plain = 0; - const QWSKeyboard::Mapping *map_withmod = 0; - - // get a specific and plain mapping for the keycode and the current modifiers - for (int i = 0; i < d->m_keymap_size && !(map_plain && map_withmod); ++i) { - const QWSKeyboard::Mapping *m = d->m_keymap + i; - if (m->keycode == keycode) { - if (m->modifiers == 0) - map_plain = m; - - quint8 testmods = d->m_modifiers; - if (d->m_locks[0] /*CapsLock*/ && (m->flags & QWSKeyboard::IsLetter)) - testmods ^= QWSKeyboard::ModShift; - if (m->modifiers == testmods) - map_withmod = m; - } - } - -#ifdef QT_DEBUG_KEYMAP - qWarning("Processing key event: keycode=%3d, modifiers=%02x pressed=%d, autorepeat=%d | plain=%d, withmod=%d, size=%d", \ - keycode, d->m_modifiers, pressed ? 1 : 0, autorepeat ? 1 : 0, \ - map_plain ? map_plain - d->m_keymap : -1, \ - map_withmod ? map_withmod - d->m_keymap : -1, \ - d->m_keymap_size); -#endif - - const QWSKeyboard::Mapping *it = map_withmod ? map_withmod : map_plain; - - if (!it) { -#ifdef QT_DEBUG_KEYMAP - // we couldn't even find a plain mapping - qWarning("Could not find a suitable mapping for keycode: %3d, modifiers: %02x", keycode, d->m_modifiers); -#endif - return result; - } - - bool skip = false; - quint16 unicode = it->unicode; - quint32 qtcode = it->qtcode; - - if ((it->flags & QWSKeyboard::IsModifier) && it->special) { - // this is a modifier, i.e. Shift, Alt, ... - if (pressed) - d->m_modifiers |= quint8(it->special); - else - d->m_modifiers &= ~quint8(it->special); - } else if (qtcode >= Qt::Key_CapsLock && qtcode <= Qt::Key_ScrollLock) { - // (Caps|Num|Scroll)Lock - if (first_press) { - quint8 &lock = d->m_locks[qtcode - Qt::Key_CapsLock]; - lock ^= 1; - - switch (qtcode) { - case Qt::Key_CapsLock : result = lock ? CapsLockOn : CapsLockOff; break; - case Qt::Key_NumLock : result = lock ? NumLockOn : NumLockOff; break; - case Qt::Key_ScrollLock: result = lock ? ScrollLockOn : ScrollLockOff; break; - default : break; - } - } - } else if ((it->flags & QWSKeyboard::IsSystem) && it->special && first_press) { - switch (it->special) { - case QWSKeyboard::SystemReboot: - result = Reboot; - break; - - case QWSKeyboard::SystemZap: - if (!d->m_no_zap) - qApp->quit(); - break; - - case QWSKeyboard::SystemConsolePrevious: - result = PreviousConsole; - break; - - case QWSKeyboard::SystemConsoleNext: - result = NextConsole; - break; - - default: - if (it->special >= QWSKeyboard::SystemConsoleFirst && - it->special <= QWSKeyboard::SystemConsoleLast) { - result = KeycodeAction(SwitchConsoleFirst + ((it->special & QWSKeyboard::SystemConsoleMask) & SwitchConsoleMask)); - } - break; - } - - skip = true; // no need to tell QWS about it - } else if ((qtcode == Qt::Key_Multi_key) && d->m_do_compose) { - // the Compose key was pressed - if (first_press) - d->m_composing = 2; - skip = true; - } else if ((it->flags & QWSKeyboard::IsDead) && d->m_do_compose) { - // a Dead key was pressed - if (first_press && d->m_composing == 1 && d->m_dead_unicode == unicode) { // twice - d->m_composing = 0; - qtcode = Qt::Key_unknown; // otherwise it would be Qt::Key_Dead... - } else if (first_press && unicode != 0xffff) { - d->m_dead_unicode = unicode; - d->m_composing = 1; - skip = true; - } else { - skip = true; - } - } - - if (!skip) { - // a normal key was pressed - const int modmask = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier; - - // we couldn't find a specific mapping for the current modifiers, - // or that mapping didn't have special modifiers: - // so just report the plain mapping with additional modifiers. - if ((it == map_plain && it != map_withmod) || - (map_withmod && !(map_withmod->qtcode & modmask))) { - qtcode |= QWSKbPrivate::toQtModifiers(d->m_modifiers); - } - - if (d->m_composing == 2 && first_press && !(it->flags & QWSKeyboard::IsModifier)) { - // the last key press was the Compose key - if (unicode != 0xffff) { - int idx = 0; - // check if this code is in the compose table at all - for ( ; idx < d->m_keycompose_size; ++idx) { - if (d->m_keycompose[idx].first == unicode) - break; - } - if (idx < d->m_keycompose_size) { - // found it -> simulate a Dead key press - d->m_dead_unicode = unicode; - unicode = 0xffff; - d->m_composing = 1; - skip = true; - } else { - d->m_composing = 0; - } - } else { - d->m_composing = 0; - } - } else if (d->m_composing == 1 && first_press && !(it->flags & QWSKeyboard::IsModifier)) { - // the last key press was a Dead key - bool valid = false; - if (unicode != 0xffff) { - int idx = 0; - // check if this code is in the compose table at all - for ( ; idx < d->m_keycompose_size; ++idx) { - if (d->m_keycompose[idx].first == d->m_dead_unicode && d->m_keycompose[idx].second == unicode) - break; - } - if (idx < d->m_keycompose_size) { - quint16 composed = d->m_keycompose[idx].result; - if (composed != 0xffff) { - unicode = composed; - qtcode = Qt::Key_unknown; - valid = true; - } - } - } - if (!valid) { - unicode = d->m_dead_unicode; - qtcode = Qt::Key_unknown; - } - d->m_composing = 0; - } - - if (!skip) { -#ifdef QT_DEBUG_KEYMAP - qWarning("Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode & ~modmask, (qtcode & modmask)); -#endif - - // send the result to the QWS server - processKeyEvent(unicode, qtcode & ~modmask, Qt::KeyboardModifiers(qtcode & modmask), pressed, autorepeat); - } - } - return result; -} - -QT_END_NAMESPACE - -#include "qkbd_qws.moc" - -#endif // QT_NO_QWS_KEYBOARD diff --git a/src/gui/embedded/qkbd_qws_p.h b/src/gui/embedded/qkbd_qws_p.h deleted file mode 100644 index bf365cb085c..00000000000 --- a/src/gui/embedded/qkbd_qws_p.h +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSKEYBOARD_P_H -#define QWSKEYBOARD_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 - -namespace QWSKeyboard { - const quint32 FileMagic = 0x514d4150; // 'QMAP' - - struct Mapping { - quint16 keycode; - quint16 unicode; - quint32 qtcode; - quint8 modifiers; - quint8 flags; - quint16 special; - - }; - - enum Flags { - IsDead = 0x01, - IsLetter = 0x02, - IsModifier = 0x04, - IsSystem = 0x08, - }; - - enum System { - SystemConsoleFirst = 0x0100, - SystemConsoleMask = 0x007f, - SystemConsoleLast = 0x017f, - SystemConsolePrevious = 0x0180, - SystemConsoleNext = 0x0181, - SystemReboot = 0x0200, - SystemZap = 0x0300, - }; - - struct Composing { - quint16 first; - quint16 second; - quint16 result; - }; - - enum Modifiers { - ModPlain = 0x00, - ModShift = 0x01, - ModAltGr = 0x02, - ModControl = 0x04, - ModAlt = 0x08, - ModShiftL = 0x10, - ModShiftR = 0x20, - ModCtrlL = 0x40, - ModCtrlR = 0x80, - // ModCapsShift = 0x100, // not supported! - }; -}; - -#ifndef QT_NO_DATASTREAM -inline QDataStream &operator>>(QDataStream &ds, QWSKeyboard::Mapping &m) -{ - return ds >> m.keycode >> m.unicode >> m.qtcode >> m.modifiers >> m.flags >> m.special; -} - -inline QDataStream &operator<<(QDataStream &ds, const QWSKeyboard::Mapping &m) -{ - return ds << m.keycode << m.unicode << m.qtcode << m.modifiers << m.flags << m.special; -} - -inline QDataStream &operator>>(QDataStream &ds, QWSKeyboard::Composing &c) -{ - return ds >> c.first >> c.second >> c.result; -} - -inline QDataStream &operator<<(QDataStream &ds, const QWSKeyboard::Composing &c) -{ - return ds << c.first << c.second << c.result; -} -#endif // QT_NO_DATASTREAM - -QT_END_NAMESPACE - -#endif // QWSKEYBOARD_H diff --git a/src/gui/embedded/qkbddriverfactory_qws.cpp b/src/gui/embedded/qkbddriverfactory_qws.cpp deleted file mode 100644 index d474b5e153d..00000000000 --- a/src/gui/embedded/qkbddriverfactory_qws.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qkbddriverfactory_qws.h" - -#ifndef QT_NO_QWS_KEYBOARD - -#include "qapplication.h" -#include "qkbdtty_qws.h" -#include "qkbdlinuxinput_qws.h" -#include "qkbdum_qws.h" -#include "qkbdvfb_qws.h" -#include "qkbdqnx_qws.h" -#include "qkbdintegrity_qws.h" -#include -#include "private/qfactoryloader_p.h" -#include "qkbddriverplugin_qws.h" - -QT_BEGIN_NAMESPACE - -#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) -#ifndef QT_NO_LIBRARY -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QWSKeyboardHandlerFactoryInterface_iid, - QLatin1String("/kbddrivers"), Qt::CaseInsensitive)) - -#endif //QT_NO_LIBRARY -#endif //QT_MAKEDLL - -/*! - \class QKbdDriverFactory - \ingroup qws - - \brief The QKbdDriverFactory class creates keyboard drivers in - Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - QKbdDriverFactory is used to detect and instantiate the available - keyboard drivers, allowing \l{Qt for Embedded Linux} to load the preferred - driver into the server application at runtime. The create() - function returns a QWSKeyboardHandler object representing the - keyboard driver identified by a given key. The valid keys - (i.e. the supported drivers) can be retrieved using the keys() - function. - - \l{Qt for Embedded Linux} provides several built-in keyboard drivers. In - addition, custom keyboard drivers can be added using Qt's plugin - mechanism, i.e. by subclassing the QWSKeyboardHandler class and - creating a keyboard driver plugin (QKbdDriverPlugin). See the - \l{Qt for Embedded Linux Character Input}{character input} documentation - for details. - - \sa QWSKeyboardHandler, QKbdDriverPlugin -*/ - -/*! - Creates the keyboard driver specified by the given \a key, using - the display specified by the given \a device. - - Note that the keys are case-insensitive. - - \sa keys() -*/ -QWSKeyboardHandler *QKbdDriverFactory::create(const QString& key, const QString& device) -{ - QString driver = key.toLower(); -#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_KBD_QNX) - if (driver == QLatin1String("qnx") || driver.isEmpty()) - return new QWSQnxKeyboardHandler(device); -#endif -#if defined(Q_OS_INTEGRITY) - if (driver == QLatin1String("integrity") || driver.isEmpty()) - return new QWSIntKeyboardHandler(device); -#endif -#ifndef QT_NO_QWS_KEYBOARD -# ifndef QT_NO_QWS_KBD_TTY - if (driver == QLatin1String("tty") || driver.isEmpty()) - return new QWSTtyKeyboardHandler(device); -# endif -# ifndef QT_NO_QWS_KBD_LINUXINPUT - if (driver == QLatin1String("linuxinput") || \ - driver == QLatin1String("usb") || \ - driver == QLatin1String("linuxis")) - return new QWSLinuxInputKeyboardHandler(device); -# endif -# ifndef QT_NO_QWS_KBD_UM - if (driver == QLatin1String("um") || driver == QLatin1String("qvfbkeyboard")) - return new QWSUmKeyboardHandler(device); -# endif -# ifndef QT_NO_QWS_KBD_QVFB - if (driver == QLatin1String("qvfbkbd") - || driver == QLatin1String("qvfbkeyboard") - || driver == QLatin1String("qvfb")) - return new QVFbKeyboardHandler(device); -# endif -#endif - -#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) -#ifndef QT_NO_LIBRARY - if (QWSKeyboardHandlerFactoryInterface *factory = qobject_cast(loader()->instance(driver))) - return factory->create(driver, device); -#endif -#endif - return 0; -} - -/*! - Returns the list of valid keys, i.e. the available keyboard - drivers. - - \sa create() -*/ -QStringList QKbdDriverFactory::keys() -{ - QStringList list; - -#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_KBD_QNX) - list << QLatin1String("QNX"); -#endif -#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_KBD_INTEGRITY) - list << QLatin1String("INTEGRITY"); -#endif -#ifndef QT_NO_QWS_KBD_TTY - list << QLatin1String("TTY"); -#endif -#ifndef QT_NO_QWS_KBD_LINUXINPUT - list << QLatin1String("LinuxInput"); -#endif -#ifndef QT_NO_QWS_KBD_UM - list << QLatin1String("UM"); -#endif - -#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 - -#endif // QT_NO_QWS_KEYBOARD diff --git a/src/gui/embedded/qkbddriverfactory_qws.h b/src/gui/embedded/qkbddriverfactory_qws.h deleted file mode 100644 index 103ceb496ad..00000000000 --- a/src/gui/embedded/qkbddriverfactory_qws.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QKBDDRIVERFACTORY_QWS_H -#define QKBDDRIVERFACTORY_QWS_H - -#include - -#ifndef QT_NO_QWS_KEYBOARD - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QString; -class QWSKeyboardHandler; - -class Q_GUI_EXPORT QKbdDriverFactory -{ -public: - static QStringList keys(); - static QWSKeyboardHandler *create(const QString&, const QString&); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_QWS_KEYBOARD -#endif // QKBDDRIVERFACTORY_QWS_H diff --git a/src/gui/embedded/qkbddriverplugin_qws.cpp b/src/gui/embedded/qkbddriverplugin_qws.cpp deleted file mode 100644 index 86cdb628d7e..00000000000 --- a/src/gui/embedded/qkbddriverplugin_qws.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qkbddriverplugin_qws.h" - -#ifndef QT_NO_LIBRARY - -#include "qkbd_qws.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QKbdDriverPlugin - \ingroup plugins - \ingroup qws - - \brief The QKbdDriverPlugin class is an abstract base class for - keyboard driver plugins in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - \l{Qt for Embedded Linux} provides ready-made drivers for several keyboard - protocols, see the \l{Qt for Embedded Linux Character Input}{character - input} documentation for details. Custom keyboard drivers can be - implemented by subclassing the QWSKeyboardHandler class and - creating a keyboard driver plugin. - - A keyboard driver plugin can be created by subclassing - QKbdDriverPlugin 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 - QKbdDriverFactory 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 QKbdDriverFactory, QWSKeyboardHandler -*/ - -/*! - \fn QStringList QKbdDriverPlugin::keys() const - - Implement this function to return the list of valid keys, i.e. the - keyboard drivers supported by this plugin. - - \l{Qt for Embedded Linux} provides ready-made drivers for several keyboard - protocols, see the \l{Qt for Embedded Linux Character Input}{character - input} documentation for details. - - \sa create() -*/ - -/*! - Constructs a keyboard driver 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. -*/ -QKbdDriverPlugin::QKbdDriverPlugin(QObject *parent) - : QObject(parent) -{ -} - -/*! - Destroys the keyboard driver plugin. - - Note that Qt destroys a plugin automatically when it is no longer - used, so there is no need for calling the destructor explicitly. -*/ -QKbdDriverPlugin::~QKbdDriverPlugin() -{ -} - -/*! - \fn QScreen *QKbdDriverPlugin::create(const QString &key, const QString &device) - - Implement this function to create a driver matching the type - specified by the given \a key and \a device parameters. Note that - keys are case-insensitive. - - \sa keys() -*/ - -QT_END_NAMESPACE - -#endif // QT_NO_LIBRARY diff --git a/src/gui/embedded/qkbddriverplugin_qws.h b/src/gui/embedded/qkbddriverplugin_qws.h deleted file mode 100644 index c9b2ad3737d..00000000000 --- a/src/gui/embedded/qkbddriverplugin_qws.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QKBDDRIVERPLUGIN_QWS_H -#define QKBDDRIVERPLUGIN_QWS_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_LIBRARY - -class QWSKeyboardHandler; - -struct Q_GUI_EXPORT QWSKeyboardHandlerFactoryInterface : public QFactoryInterface -{ - virtual QWSKeyboardHandler* create(const QString &name, const QString &device) = 0; -}; - -#define QWSKeyboardHandlerFactoryInterface_iid "com.trolltech.Qt.QWSKeyboardHandlerFactoryInterface" -Q_DECLARE_INTERFACE(QWSKeyboardHandlerFactoryInterface, QWSKeyboardHandlerFactoryInterface_iid) - -class Q_GUI_EXPORT QKbdDriverPlugin : public QObject, public QWSKeyboardHandlerFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(QWSKeyboardHandlerFactoryInterface:QFactoryInterface) -public: - explicit QKbdDriverPlugin(QObject *parent = 0); - ~QKbdDriverPlugin(); - - virtual QStringList keys() const = 0; - virtual QWSKeyboardHandler* create(const QString& driver, const QString &device) = 0; -}; - -#endif // QT_NO_LIBRARY - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QKBDDRIVERPLUGIN_QWS_H diff --git a/src/gui/embedded/qkbdintegrity_qws.cpp b/src/gui/embedded/qkbdintegrity_qws.cpp deleted file mode 100644 index 2dcbb6b19b4..00000000000 --- a/src/gui/embedded/qkbdintegrity_qws.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_INTEGRITY) - -#include "qkbdintegrity_qws.h" -#include -#include -#include -#include - -#include - - -//=========================================================================== - -QT_BEGIN_NAMESPACE - -// -// INTEGRITY keyboard -// - -class QIntKeyboardListenThread; - -class QWSIntKbPrivate : public QObject -{ - Q_OBJECT - friend class QIntKeyboardListenThread; -public: - QWSIntKbPrivate(QWSKeyboardHandler *, const QString &device); - ~QWSIntKbPrivate(); - void dataReady(int amount) { emit kbdDataAvailable(amount); } - uint8_t scancodebuf[32 /* USB_SCANCODE_BUF_LEN */ ]; - uint8_t rxpost; - uint8_t rxack; - -Q_SIGNALS: - void kbdDataAvailable(int amount); - -private Q_SLOTS: - void readKeyboardData(int amount); - -private: - QWSKeyboardHandler *handler; - QIntKeyboardListenThread *kbdthread; -}; -class QIntKeyboardListenThread : public QThread -{ -protected: - QWSIntKbPrivate *imp; - bool loop; -public: - QIntKeyboardListenThread(QWSIntKbPrivate *im) : QThread(), imp(im) {}; - ~QIntKeyboardListenThread() {}; - void run(); - void stoploop() { loop = false; }; -}; - - -QWSIntKeyboardHandler::QWSIntKeyboardHandler(const QString &device) - : QWSKeyboardHandler(device) -{ - d = new QWSIntKbPrivate(this, device); -} - -QWSIntKeyboardHandler::~QWSIntKeyboardHandler() -{ - delete d; -} - -//void QWSIntKeyboardHandler::processKeyEvent(int keycode, bool isPress, -// bool autoRepeat) -//{ -// QWSKeyboardHandler::processKeyEvent(keycode, isPress, autoRepeat); -//} - -void QIntKeyboardListenThread::run(void) -{ - Error E; - Buffer b; - Connection kbdc; - bool waitforresource = true; - do { - E = RequestResource((Object*)&kbdc, - "USBKeyboardClient", "!systempassword"); - if (E == Success) { - loop = false; - } else { - E = RequestResource((Object*)&kbdc, - "KeyboardClient", "!systempassword"); - if (E == Success) { - waitforresource = false; - } - } - if (waitforresource) - ::sleep(1); - } while (loop && waitforresource); - if (!loop) - return; - b.BufferType = DataBuffer | LastBuffer; - b.Length = sizeof(imp->scancodebuf); - b.TheAddress = (Address)imp->scancodebuf; - do { - b.Transferred = 0; - b.TheAddress = (Address)imp->scancodebuf + imp->rxpost; - CheckSuccess(SynchronousReceive(kbdc, &b)); - imp->rxpost += b.Transferred; - if (imp->rxpost >= 32 /* USB_SCANCODE_BUF_LEN */) - imp->rxpost = 0; - if (imp->rxpost == (imp->rxack + b.Transferred) % 32 /* USB_SCANCODE_BUF_LEN */) { - imp->kbdDataAvailable(b.Transferred); - } - } while (loop); -} - -void QWSIntKbPrivate::readKeyboardData(int amount) -{ - uint16_t keycode; - do { - if (scancodebuf[rxack] == 0xe0) { - keycode = scancodebuf[rxack] << 8; - rxack++; - if (rxack >= 32 /* USB_SCANCODE_BUF_LEN */) - rxack = 0; - } else { - keycode = 0; - } - - handler->processKeycode(keycode + (scancodebuf[rxack] & 0x7f), - (scancodebuf[rxack] & 0x80) == 0, - scancodebuf[rxack] == 2); - rxack++; - if (rxack >= 32 /* USB_SCANCODE_BUF_LEN */) - rxack = 0; - } while (rxack != rxpost); -} - -QWSIntKbPrivate::QWSIntKbPrivate(QWSKeyboardHandler *h, const QString &device) : handler(h) -{ - connect(this, SIGNAL(kbdDataAvailable(int)), this, SLOT(readKeyboardData(int))); - this->handler = handler; - rxack = rxpost = 0; - kbdthread = new QIntKeyboardListenThread(this); - kbdthread->start(); -} - -QWSIntKbPrivate::~QWSIntKbPrivate() -{ - kbdthread->stoploop(); - kbdthread->wait(); - delete kbdthread; -} - - -QT_END_NAMESPACE - -#include "qkbdintegrity_qws.moc" - -#endif // QT_NO_QWS_KEYBOARD || QT_NO_QWS_KBD_TTY diff --git a/src/gui/embedded/qkbdlinuxinput_qws.cpp b/src/gui/embedded/qkbdlinuxinput_qws.cpp deleted file mode 100644 index 376b0d0f75d..00000000000 --- a/src/gui/embedded/qkbdlinuxinput_qws.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qkbdlinuxinput_qws.h" - -#ifndef QT_NO_QWS_KEYBOARD - -#include -#include - -#include -#include // overrides QT_OPEN - -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - - -class QWSLinuxInputKbPrivate : public QObject -{ - Q_OBJECT -public: - QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *, const QString &); - ~QWSLinuxInputKbPrivate(); - -private: - void switchLed(int, bool); - -private Q_SLOTS: - void readKeycode(); - -private: - QWSLinuxInputKeyboardHandler *m_handler; - int m_fd; - int m_tty_fd; - struct termios m_tty_attr; - int m_orig_kbmode; -}; - -QWSLinuxInputKeyboardHandler::QWSLinuxInputKeyboardHandler(const QString &device) - : QWSKeyboardHandler(device) -{ - d = new QWSLinuxInputKbPrivate(this, device); -} - -QWSLinuxInputKeyboardHandler::~QWSLinuxInputKeyboardHandler() -{ - delete d; -} - -bool QWSLinuxInputKeyboardHandler::filterInputEvent(quint16 &, qint32 &) -{ - return false; -} - -QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h, const QString &device) - : m_handler(h), 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 = device.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_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 translation 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; - } -} - -QWSLinuxInputKbPrivate::~QWSLinuxInputKbPrivate() -{ - 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); -} - -void QWSLinuxInputKbPrivate::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 QWSLinuxInputKbPrivate::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 - -#include "qkbdlinuxinput_qws.moc" - -#endif // QT_NO_QWS_KEYBOARD diff --git a/src/gui/embedded/qkbdqnx_qws.cpp b/src/gui/embedded/qkbdqnx_qws.cpp deleted file mode 100644 index 5a8118d9d91..00000000000 --- a/src/gui/embedded/qkbdqnx_qws.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qkbdqnx_qws.h" -#include "QtCore/qsocketnotifier.h" -#include "QtCore/qdebug.h" - -#include -#include - -#include "qplatformdefs.h" -#include - - -QT_BEGIN_NAMESPACE - -/*! - \class QWSQnxKeyboardHandler - \preliminary - \ingroup qws - \since 4.6 - \internal - - \brief The QWSQnxKeyboardHandler class implements a keyboard driver - for the QNX \c{devi-hid} input manager. - - To be able to compile this mouse handler, \l{Qt for Embedded Linux} - must be configured with the \c -qt-kbd-qnx option, see the - \l{Qt for Embedded Linux Character Input} documentation for details. - - In order to use this keyboard handler, the \c{devi-hid} input manager - must be set up and run with the resource manager interface (option \c{-r}). - Also, Photon must not be running. - - Example invocation from command line: \c{/usr/photon/bin/devi-hid -Pr kbd mouse} - Note that after running \c{devi-hid}, you will not be able to use the local - shell anymore. It is suggested to run the command in a shell scrip, that launches - a Qt application after invocation of \c{devi-hid}. - - To make \l{Qt for Embedded Linux} explicitly choose the qnx keyboard - handler, set the QWS_KEYBOARD environment variable to \c{qnx}. By default, - the first keyboard device (\c{/dev/devi/keyboard0}) is used. To override, pass a device - name as the first and only parameter, for example - \c{QWS_KEYBOARD=qnx:/dev/devi/keyboard1; export QWS_KEYBOARD}. - - \sa {Qt for Embedded Linux Character Input}, {Qt for Embedded Linux} -*/ - -/*! - Constructs a keyboard handler for the specified \a device, defaulting to - \c{/dev/devi/keyboard0}. - - Note that you should never instanciate this class, instead let QKbdDriverFactory - handle the keyboard handlers. - - \sa QKbdDriverFactory - */ -QWSQnxKeyboardHandler::QWSQnxKeyboardHandler(const QString &device) -{ - // open the keyboard device - keyboardFD = QT_OPEN(device.isEmpty() ? "/dev/devi/keyboard0" : device.toLatin1().constData(), - QT_OPEN_RDONLY); - if (keyboardFD == -1) { - qErrnoWarning(errno, "QWSQnxKeyboardHandler: Unable to open device"); - return; - } - - // create a socket notifier so we'll wake up whenever keyboard input is detected. - QSocketNotifier *notifier = new QSocketNotifier(keyboardFD, QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)), SLOT(socketActivated())); - - qDebug() << "QWSQnxKeyboardHandler: connected."; - -} - -/*! - Destroys this keyboard handler and closes the connection to the keyboard device. - */ -QWSQnxKeyboardHandler::~QWSQnxKeyboardHandler() -{ - QT_CLOSE(keyboardFD); -} - -/*! \internal - Translates the QNX keyboard events to Qt keyboard events - */ -void QWSQnxKeyboardHandler::socketActivated() -{ - _keyboard_packet packet; - - // read one keyboard event - int bytesRead = QT_READ(keyboardFD, &packet, sizeof(_keyboard_packet)); - if (bytesRead == -1) { - qErrnoWarning(errno, "QWSQnxKeyboardHandler::socketActivated(): Unable to read data."); - return; - } - - // the bytes read must be the size of a keyboard packet - Q_ASSERT(bytesRead == sizeof(_keyboard_packet)); - -#if 0 - qDebug() << "keyboard got scancode" - << hex << packet.data.modifiers - << packet.data.flags - << packet.data.key_cap - << packet.data.key_sym - << packet.data.key_scan; -#endif - - // QNX is nice enough to translate the raw keyboard data into a QNX data structure - // Now we just have to translate it into a format Qt understands. - - // figure out whether it's a press - bool isPress = packet.data.key_cap & KEY_DOWN; - // figure out whether the key is still pressed and the key event is repeated - bool isRepeat = packet.data.key_cap & KEY_REPEAT; - - Qt::Key key = Qt::Key_unknown; - int unicode = 0xffff; - - // TODO - this switch is not complete! - switch (packet.data.key_scan) { - case KEYCODE_SPACE: key = Qt::Key_Space; unicode = 0x20; break; - case KEYCODE_F1: key = Qt::Key_F1; break; - case KEYCODE_F2: key = Qt::Key_F2; break; - case KEYCODE_F3: key = Qt::Key_F3; break; - case KEYCODE_F4: key = Qt::Key_F4; break; - case KEYCODE_F5: key = Qt::Key_F5; break; - case KEYCODE_F6: key = Qt::Key_F6; break; - case KEYCODE_F7: key = Qt::Key_F7; break; - case KEYCODE_F8: key = Qt::Key_F8; break; - case KEYCODE_F9: key = Qt::Key_F9; break; - case KEYCODE_F10: key = Qt::Key_F10; break; - case KEYCODE_F11: key = Qt::Key_F11; break; - case KEYCODE_F12: key = Qt::Key_F12; break; - case KEYCODE_BACKSPACE: key = Qt::Key_Backspace; break; - case KEYCODE_TAB: key = Qt::Key_Tab; break; - case KEYCODE_RETURN: key = Qt::Key_Return; break; - case KEYCODE_KP_ENTER: key = Qt::Key_Enter; break; - case KEYCODE_UP: - case KEYCODE_KP_UP: - key = Qt::Key_Up; break; - case KEYCODE_DOWN: - case KEYCODE_KP_DOWN: - key = Qt::Key_Down; break; - case KEYCODE_LEFT: - case KEYCODE_KP_LEFT: - key = Qt::Key_Left; break; - case KEYCODE_RIGHT: - case KEYCODE_KP_RIGHT: - key = Qt::Key_Right; break; - case KEYCODE_HOME: - case KEYCODE_KP_HOME: - key = Qt::Key_Home; break; - case KEYCODE_END: - case KEYCODE_KP_END: - key = Qt::Key_End; break; - case KEYCODE_PG_UP: - case KEYCODE_KP_PG_UP: - key = Qt::Key_PageUp; break; - case KEYCODE_PG_DOWN: - case KEYCODE_KP_PG_DOWN: - key = Qt::Key_PageDown; break; - case KEYCODE_INSERT: - case KEYCODE_KP_INSERT: - key = Qt::Key_Insert; break; - case KEYCODE_DELETE: - case KEYCODE_KP_DELETE: - key = Qt::Key_Delete; break; - case KEYCODE_ESCAPE: - key = Qt::Key_Escape; break; - default: // none of the above, try the key_scan directly - unicode = packet.data.key_scan; - break; - } - - // figure out the modifiers that are currently pressed - Qt::KeyboardModifiers modifiers = Qt::NoModifier; - if (packet.data.flags & KEYMOD_SHIFT) - modifiers |= Qt::ShiftModifier; - if (packet.data.flags & KEYMOD_CTRL) - modifiers |= Qt::ControlModifier; - if (packet.data.flags & KEYMOD_ALT) - modifiers |= Qt::AltModifier; - - // if the unicode value is not ascii, we ignore it. - // TODO - do a complete mapping between all QNX scan codes and Qt codes - if (unicode != 0xffff && !isascii(unicode)) - return; // unprintable character - - // call processKeyEvent. This is where all the magic happens to insert a - // key event into Qt's event loop. - // Note that for repeated key events, isPress must be true - // (on QNX, isPress is not set when the key event is repeated). - processKeyEvent(unicode, key, modifiers, isPress || isRepeat, isRepeat); -} - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qkbdqnx_qws.h b/src/gui/embedded/qkbdqnx_qws.h deleted file mode 100644 index a9a8eb16553..00000000000 --- a/src/gui/embedded/qkbdqnx_qws.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QKBDQNX_QWS_H -#define QKBDQNX_QWS_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_QNX) - -class Q_GUI_EXPORT QWSQnxKeyboardHandler : public QObject, public QWSKeyboardHandler -{ - Q_OBJECT -public: - QWSQnxKeyboardHandler(const QString &device); - ~QWSQnxKeyboardHandler(); - -private Q_SLOTS: - void socketActivated(); - -private: - int keyboardFD; -}; - -#endif // QT_NO_QWS_KEYBOARD - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QKBDQNX_QWS_H diff --git a/src/gui/embedded/qkbdtty_qws.cpp b/src/gui/embedded/qkbdtty_qws.cpp deleted file mode 100644 index 236769d8753..00000000000 --- a/src/gui/embedded/qkbdtty_qws.cpp +++ /dev/null @@ -1,353 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qkbdtty_qws.h" - -#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_TTY) - -#include -#include - -#include -#include // overrides QT_OPEN - -#include -#include - -#if defined Q_OS_LINUX -# include -# include //TODO: move vt handling somewhere else (QLinuxFbScreen?) - -# include "qscreen_qws.h" -# include "qwindowsystem_qws.h" -# include "qapplication.h" -# include "private/qwindowsurface_qws_p.h" -# include "private/qwssignalhandler_p.h" - -# define VTACQSIG SIGUSR1 -# define VTRELSIG SIGUSR2 -#endif - - -QT_BEGIN_NAMESPACE - -class QWSTtyKbPrivate : public QObject -{ - Q_OBJECT -public: - QWSTtyKbPrivate(QWSTtyKeyboardHandler *handler, const QString &device); - ~QWSTtyKbPrivate(); - -private: - void switchLed(char, bool); - void switchConsole(int vt); - -private Q_SLOTS: - void readKeycode(); - void handleConsoleSwitch(int sig); - -private: - QWSTtyKeyboardHandler *m_handler; - int m_tty_fd; - struct termios m_tty_attr; - char m_last_keycode; - int m_vt_qws; - int m_orig_kbmode; -}; - - -QWSTtyKeyboardHandler::QWSTtyKeyboardHandler(const QString &device) - : QWSKeyboardHandler(device) -{ - d = new QWSTtyKbPrivate(this, device); -} - -QWSTtyKeyboardHandler::~QWSTtyKeyboardHandler() -{ - delete d; -} - -bool QWSTtyKeyboardHandler::filterKeycode(char &) -{ - return false; -} - -QWSTtyKbPrivate::QWSTtyKbPrivate(QWSTtyKeyboardHandler *h, const QString &device) - : m_handler(h), m_tty_fd(-1), m_last_keycode(0), m_vt_qws(0), m_orig_kbmode(K_XLATE) -{ - setObjectName(QLatin1String("TTY Keyboard Handler")); -#ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->addObject(this); -#endif - - QString dev = QLatin1String("/dev/tty0"); - int repeat_delay = -1; - int repeat_rate = -1; - - QStringList args = device.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_tty_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDWR, 0); - if (m_tty_fd >= 0) { - if (repeat_delay > 0 && repeat_rate > 0) { -#if defined(Q_OS_LINUX) - struct ::kbd_repeat kbdrep = { repeat_delay, repeat_rate }; - ::ioctl(m_tty_fd, KDKBDREP, &kbdrep); -#endif - } - - QSocketNotifier *notifier; - notifier = new QSocketNotifier(m_tty_fd, QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)), this, SLOT(readKeycode())); - - // save tty config for restore. - tcgetattr(m_tty_fd, &m_tty_attr); - - struct ::termios termdata; - tcgetattr(m_tty_fd, &termdata); - -#if defined(Q_OS_LINUX) - // record the original mode so we can restore it again in the destructor. - ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode); - - // PLEASE NOTE: - // the tty keycode interface can only report keycodes 0x01 .. 0x7f - // KEY_MAX is however defined to 0x1ff. In practice this is sufficient - // for a PC style keyboard though. - // we don't support K_RAW anymore - if you need that, you have to add - // a scan- to keycode converter yourself. - ::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW); -#endif - - // 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 defined(Q_OS_LINUX) - // VT switching is handled via unix signals - connect(QApplication::instance(), SIGNAL(unixSignal(int)), this, SLOT(handleConsoleSwitch(int))); - QApplication::instance()->watchUnixSignal(VTACQSIG, true); - QApplication::instance()->watchUnixSignal(VTRELSIG, true); - - struct ::vt_mode vtMode; - if (::ioctl(m_tty_fd, VT_GETMODE, &vtMode) == 0) { - vtMode.mode = VT_PROCESS; - vtMode.relsig = VTRELSIG; - vtMode.acqsig = VTACQSIG; - - if (::ioctl(m_tty_fd, VT_SETMODE, &vtMode) == 0) { - struct ::vt_stat vtStat; - ::memset(&vtStat, 0, sizeof(vtStat)); - - if (::ioctl(m_tty_fd, VT_GETSTATE, &vtStat) == 0 ) { - m_vt_qws = vtStat.v_active; - } - } - } - - if (!m_vt_qws) - qWarning("Could not initialize virtual console switching"); -#endif - } else { - qWarning("Cannot open input device '%s': %s", qPrintable(dev), strerror(errno)); - return; - } - -} - -QWSTtyKbPrivate::~QWSTtyKbPrivate() -{ - if (m_tty_fd >= 0) { -#if defined(Q_OS_LINUX) - ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode); -#endif - tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr); - QT_CLOSE(m_tty_fd); - } -} - - - -void QWSTtyKbPrivate::switchLed(char led, bool state) -{ -#if defined(Q_OS_LINUX) - char ledstate; - - ::ioctl(m_tty_fd, KDGETLED, &ledstate); - if (state) - ledstate |= led; - else - ledstate &= ~led; - ::ioctl(m_tty_fd, KDSETLED, ledstate); -#endif -} - -void QWSTtyKbPrivate::readKeycode() -{ - char buffer[32]; - int n = 0; - - forever { - n = QT_READ(m_tty_fd, buffer + n, 32 - 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 { - break; - } - } - - for (int i = 0; i < n; ++i) { - if (m_handler->filterKeycode(buffer[i])) - continue; - - QWSKeyboardHandler::KeycodeAction ka; - ka = m_handler->processKeycode(buffer[i] & 0x7f, (buffer[i] & 0x80) == 0x00, buffer[i] == m_last_keycode); - m_last_keycode = buffer[i]; - - switch (ka) { - case QWSKeyboardHandler::CapsLockOn: - case QWSKeyboardHandler::CapsLockOff: - switchLed(LED_CAP, ka == QWSKeyboardHandler::CapsLockOn); - break; - - case QWSKeyboardHandler::NumLockOn: - case QWSKeyboardHandler::NumLockOff: - switchLed(LED_NUM, ka == QWSKeyboardHandler::NumLockOn); - break; - - case QWSKeyboardHandler::ScrollLockOn: - case QWSKeyboardHandler::ScrollLockOff: - switchLed(LED_SCR, ka == QWSKeyboardHandler::ScrollLockOn); - break; - - case QWSKeyboardHandler::PreviousConsole: - switchConsole(qBound(1, m_vt_qws - 1, 10)); - break; - - case QWSKeyboardHandler::NextConsole: - switchConsole(qBound(1, m_vt_qws + 1, 10)); - break; - - default: - if (ka >= QWSKeyboardHandler::SwitchConsoleFirst && - ka <= QWSKeyboardHandler::SwitchConsoleLast) { - switchConsole(1 + (ka & QWSKeyboardHandler::SwitchConsoleMask)); - } - //ignore reboot - break; - } - } -} - - -void QWSTtyKbPrivate::switchConsole(int vt) -{ -#if defined(Q_OS_LINUX) - if (m_vt_qws && vt && (m_tty_fd >= 0 )) - ::ioctl(m_tty_fd, VT_ACTIVATE, vt); -#endif -} - -void QWSTtyKbPrivate::handleConsoleSwitch(int sig) -{ -#if defined(Q_OS_LINUX) - // received a notification from the kernel that the current VT is - // changing: either enable or disable QWS painting accordingly. - - if (sig == VTACQSIG) { - if (::ioctl(m_tty_fd, VT_RELDISP, VT_ACKACQ) == 0) { - qwsServer->enablePainting(true); - qt_screen->restore(); - qwsServer->resumeMouse(); - qwsServer->refresh(); - } - } else if (sig == VTRELSIG) { - qwsServer->enablePainting(false); - - // Check for reserved surfaces which might still do painting - bool allWindowsHidden = true; - const QList windows = QWSServer::instance()->clientWindows(); - for (int i = 0; i < windows.size(); ++i) { - const QWSWindow *w = windows.at(i); - QWSWindowSurface *s = w->windowSurface(); - if (s && s->isRegionReserved() && !w->allocatedRegion().isEmpty()) { - allWindowsHidden = false; - break; - } - } - - if (!allWindowsHidden) { - ::ioctl(m_tty_fd, VT_RELDISP, 0); // abort console switch - qwsServer->enablePainting(true); - } else if (::ioctl(m_tty_fd, VT_RELDISP, 1) == 0) { - qt_screen->save(); - qwsServer->suspendMouse(); - } else { - qwsServer->enablePainting(true); - } - } -#endif -} - -QT_END_NAMESPACE - -#include "qkbdtty_qws.moc" - -#endif // QT_NO_QWS_KEYBOARD || QT_NO_QWS_KBD_TTY diff --git a/src/gui/embedded/qkbdum_qws.cpp b/src/gui/embedded/qkbdum_qws.cpp deleted file mode 100644 index 4fbe03e319e..00000000000 --- a/src/gui/embedded/qkbdum_qws.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qkbdum_qws.h" -#include "qvfbhdr.h" - -#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_UM) - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "qplatformdefs.h" - -QT_BEGIN_NAMESPACE - -class QWSUmKeyboardHandlerPrivate : public QObject -{ - Q_OBJECT - -public: - QWSUmKeyboardHandlerPrivate(const QString&); - ~QWSUmKeyboardHandlerPrivate(); - -private slots: - void readKeyboardData(); - -private: - int kbdFD; - int kbdIdx; - const int kbdBufferLen; - unsigned char *kbdBuffer; - QSocketNotifier *notifier; -}; - -QWSUmKeyboardHandlerPrivate::QWSUmKeyboardHandlerPrivate(const QString &device) - : kbdFD(-1), kbdIdx(0), kbdBufferLen(sizeof(QVFbKeyData)*5) -{ - kbdBuffer = new unsigned char [kbdBufferLen]; - - if ((kbdFD = QT_OPEN((const char *)device.toLocal8Bit(), O_RDONLY | O_NDELAY, 0)) < 0) { - qDebug("Cannot open %s (%s)", (const char *)device.toLocal8Bit(), - strerror(errno)); - } else { - // Clear pending input - char buf[2]; - while (QT_READ(kbdFD, buf, 1) > 0) { } - - notifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData())); - } -} - -QWSUmKeyboardHandlerPrivate::~QWSUmKeyboardHandlerPrivate() -{ - if (kbdFD >= 0) - QT_CLOSE(kbdFD); - delete [] kbdBuffer; -} - - -void QWSUmKeyboardHandlerPrivate::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); - // Qtopia Key filters must still work. - QWSServer::processKeyEvent(kd->unicode, kd->keycode, kd->modifiers, kd->press, kd->repeat); - idx += sizeof(QVFbKeyData); - } - - int surplus = kbdIdx - idx; - for (int i = 0; i < surplus; i++) - kbdBuffer[i] = kbdBuffer[idx+i]; - kbdIdx = surplus; -} - -QWSUmKeyboardHandler::QWSUmKeyboardHandler(const QString &device) - : QWSKeyboardHandler() -{ - d = new QWSUmKeyboardHandlerPrivate(device); -} - -QWSUmKeyboardHandler::~QWSUmKeyboardHandler() -{ - delete d; -} - -QT_END_NAMESPACE - -#include "qkbdum_qws.moc" - -#endif // QT_NO_QWS_KEYBOARD && QT_NO_QWS_KBD_UM diff --git a/src/gui/embedded/qkbdvfb_qws.cpp b/src/gui/embedded/qkbdvfb_qws.cpp deleted file mode 100644 index 42ebc7cc88a..00000000000 --- a/src/gui/embedded/qkbdvfb_qws.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifndef QT_NO_QWS_KEYBOARD -#ifndef QT_NO_QWS_KBD_QVFB - -#include -#include -#include -#include // overrides QT_OPEN - -QT_BEGIN_NAMESPACE - -QVFbKeyboardHandler::QVFbKeyboardHandler(const QString &device) - : QObject() -{ - terminalName = device; - if (terminalName.isEmpty()) - terminalName = QLatin1String("/dev/vkdb"); - kbdFD = -1; - kbdIdx = 0; - kbdBufferLen = sizeof(QVFbKeyData) * 5; - kbdBuffer = new unsigned char [kbdBufferLen]; - - if ((kbdFD = QT_OPEN(terminalName.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) { - qWarning("Cannot open %s (%s)", terminalName.toLatin1().constData(), - strerror(errno)); - } else { - // Clear pending input - char buf[2]; - while (QT_READ(kbdFD, buf, 1) > 0) { } - - notifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData())); - } -} - -QVFbKeyboardHandler::~QVFbKeyboardHandler() -{ - if (kbdFD >= 0) - QT_CLOSE(kbdFD); - delete [] kbdBuffer; -} - - -void QVFbKeyboardHandler::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); - idx += sizeof(QVFbKeyData); - } - - int surplus = kbdIdx - idx; - for (int i = 0; i < surplus; i++) - kbdBuffer[i] = kbdBuffer[idx+i]; - kbdIdx = surplus; -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_KBD_QVFB -#endif // QT_NO_QWS_KEYBOARD diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp deleted file mode 100644 index bb442e4aafc..00000000000 --- a/src/gui/embedded/qlock.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qlock_p.h" - - -#ifdef QT_NO_QWS_MULTIPROCESS - -QT_BEGIN_NAMESPACE - -/* no multiprocess - use a dummy */ - -QLock::QLock(const QString & /*filename*/, char /*id*/, bool /*create*/) - : type(Read), data(0) -{ -} - -QLock::~QLock() -{ -} - -bool QLock::isValid() const -{ - return true; -} - -void QLock::lock(Type t) -{ - data = (QLockData *)-1; - type = t; -} - -void QLock::unlock() -{ - data = 0; -} - -bool QLock::locked() const -{ - return data; -} - -QT_END_NAMESPACE - -#else // QT_NO_QWS_MULTIPROCESS - -#if defined(Q_OS_DARWIN) -# define Q_NO_SEMAPHORE -#endif - -#include "qwssignalhandler_p.h" - -#include -#include -#include -#if defined(Q_NO_SEMAPHORE) -# include -# include -#else -# include -#endif -#include -#include -#include - -#include // overrides QT_OPEN - -QT_BEGIN_NAMESPACE - -#define MAX_LOCKS 200 // maximum simultaneous read locks - -class QLockData -{ -public: -#ifdef Q_NO_SEMAPHORE - QByteArray file; -#endif // Q_NO_SEMAPHORE - int id; - int count; - bool owned; -}; - -/*! - \class QLock - \brief The QLock class is a wrapper for a System V shared semaphore. - - \ingroup qws - - \internal - - It is used by \l{Qt for Embedded Linux} for synchronizing access to the graphics - card and shared memory region between processes. -*/ - -/*! - \enum QLock::Type - - \value Read - \value Write -*/ - -/*! - \fn QLock::QLock(const QString &filename, char id, bool create) - - Creates a lock. \a filename is the file path of the Unix-domain - socket the \l{Qt for Embedded Linux} client is using. \a id is the name of the - particular lock to be created on that socket. If \a create is true - the lock is to be created (as the Qt for Embedded Linux server does); if \a - create is false the lock should exist already (as the Qt for Embedded Linux - client expects). -*/ - -QLock::QLock(const QString &filename, char id, bool create) -{ - data = new QLockData; - data->count = 0; -#ifdef Q_NO_SEMAPHORE - data->file = QString(filename+id).toLocal8Bit().constData(); - for(int x = 0; x < 2; x++) { - data->id = QT_OPEN(data->file, O_RDWR | (x ? O_CREAT : 0), S_IRWXU); - if(data->id != -1 || !create) { - data->owned = x; - break; - } - } -#else - key_t semkey = ftok(filename.toLocal8Bit().constData(), id); - data->id = semget(semkey,0,0); - data->owned = create; - if (create) { - qt_semun arg; arg.val = 0; - if (data->id != -1) - semctl(data->id,0,IPC_RMID,arg); - data->id = semget(semkey,1,IPC_CREAT|0600); - arg.val = MAX_LOCKS; - semctl(data->id,0,SETVAL,arg); - - QWSSignalHandler::instance()->addSemaphore(data->id); - } -#endif - if (data->id == -1) { - int eno = errno; - qWarning("Cannot %s semaphore %s '%c'", (create ? "create" : "get"), - qPrintable(filename), id); - qDebug() << "Error" << eno << strerror(eno); - } -} - -/*! - \fn QLock::~QLock() - - Destroys a lock -*/ - -QLock::~QLock() -{ - if (locked()) - unlock(); -#ifdef Q_NO_SEMAPHORE - if(isValid()) { - QT_CLOSE(data->id); - if(data->owned) - unlink(data->file); - } -#else - if(data->owned) - QWSSignalHandler::instance()->removeSemaphore(data->id); -#endif - delete data; -} - -/*! - \fn bool QLock::isValid() const - - Returns true if the lock constructor was successful; returns false if - the lock could not be created or was not available to connect to. -*/ - -bool QLock::isValid() const -{ - return (data->id != -1); -} - -/*! - Locks the semaphore with a lock of type \a t. Locks can either be - \c Read or \c Write. If a lock is \c Read, attempts by other - processes to obtain \c Read locks will succeed, and \c Write - attempts will block until the lock is unlocked. If locked as \c - Write, all attempts to lock by other processes will block until - the lock is unlocked. Locks are stacked: i.e. a given QLock can be - locked multiple times by the same process without blocking, and - will only be unlocked after a corresponding number of unlock() - calls. -*/ - -void QLock::lock(Type t) -{ - if (!data->count) { -#ifdef Q_NO_SEMAPHORE - int op = LOCK_SH; - if(t == Write) - op = LOCK_EX; - for(int rv=1; rv;) { - rv = flock(data->id, op); - if (rv == -1 && errno != EINTR) - qDebug("Semop lock failure %s",strerror(errno)); - } -#else - sembuf sops; - sops.sem_num = 0; - sops.sem_flg = SEM_UNDO; - - if (t == Write) { - sops.sem_op = -MAX_LOCKS; - type = Write; - } else { - sops.sem_op = -1; - type = Read; - } - - int rv; - do { - rv = semop(data->id,&sops,1); - if (rv == -1 && errno != EINTR) - qDebug("Semop lock failure %s",strerror(errno)); - } while (rv == -1 && errno == EINTR); -#endif - } - data->count++; -} - -/*! - \fn void QLock::unlock() - - Unlocks the semaphore. If other processes were blocking waiting to - lock() the semaphore, one of them will wake up and succeed in - lock()ing. -*/ - -void QLock::unlock() -{ - if(data->count) { - data->count--; - if(!data->count) { -#ifdef Q_NO_SEMAPHORE - for(int rv=1; rv;) { - rv = flock(data->id, LOCK_UN); - if (rv == -1 && errno != EINTR) - qDebug("Semop lock failure %s",strerror(errno)); - } -#else - sembuf sops; - sops.sem_num = 0; - sops.sem_op = 1; - sops.sem_flg = SEM_UNDO; - if (type == Write) - sops.sem_op = MAX_LOCKS; - - int rv; - do { - rv = semop(data->id,&sops,1); - if (rv == -1 && errno != EINTR) - qDebug("Semop unlock failure %s",strerror(errno)); - } while (rv == -1 && errno == EINTR); -#endif - } - } else { - qDebug("Unlock without corresponding lock"); - } -} - -/*! - \fn bool QLock::locked() const - - Returns true if the lock is currently held by the current process; - otherwise returns false. -*/ - -bool QLock::locked() const -{ - return (data->count > 0); -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_MULTIPROCESS - diff --git a/src/gui/embedded/qlock_p.h b/src/gui/embedded/qlock_p.h deleted file mode 100644 index fc10c2fc366..00000000000 --- a/src/gui/embedded/qlock_p.h +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QLOCK_P_H -#define QLOCK_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. This header file may -// change from version to version without notice, or even be -// removed. -// -// We mean it. -// - -#include "QtCore/qstring.h" - -QT_BEGIN_NAMESPACE - -class QLockData; - -class Q_GUI_EXPORT QLock -{ -public: - QLock(const QString &filename, char id, bool create = false); - ~QLock(); - - enum Type { Read, Write }; - - bool isValid() const; - void lock(Type type); - void unlock(); - bool locked() const; - -private: - Type type; - QLockData *data; -}; - - -// Nice class for ensuring the lock is released. -// Just create one on the stack and the lock is automatically released -// when QLockHandle is destructed. -class Q_GUI_EXPORT QLockHandle -{ -public: - QLockHandle(QLock *l, QLock::Type type) : qlock(l) { qlock->lock(type); } - ~QLockHandle() { if (locked()) qlock->unlock(); } - - void lock(QLock::Type type) { qlock->lock(type); } - void unlock() { qlock->unlock(); } - bool locked() const { return qlock->locked(); } - -private: - QLock *qlock; -}; - -QT_END_NAMESPACE - -#endif // QLOCK_P_H diff --git a/src/gui/embedded/qmouse_qws.cpp b/src/gui/embedded/qmouse_qws.cpp deleted file mode 100644 index f982988d58a..00000000000 --- a/src/gui/embedded/qmouse_qws.cpp +++ /dev/null @@ -1,653 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmouse_qws.h" -#include "qwindowsystem_qws.h" -#include "qscreen_qws.h" -#include "qapplication.h" -#include "qtextstream.h" -#include "qfile.h" -#include "qdebug.h" -#include "qscreen_qws.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QWSPointerCalibrationData - \ingroup qws - - \brief The QWSPointerCalibrationData class is a container for - mouse calibration data in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - QWSPointerCalibrationData stores device and screen coordinates in - the devPoints and screenPoints variables, respectively. - - A calibration program should create a QWSPointerCalibrationData - object, fill the devPoints and screenPoints variables with its - device and screen coordinates, and pass the object to the mouse - driver using the QWSMouseHandler::calibrate() function. - - \sa QWSCalibratedMouseHandler, {Mouse Calibration Example} -*/ - -/*! - \variable QWSPointerCalibrationData::devPoints - \brief the raw device coordinates for each value of the Location enum. -*/ - -/*! - \variable QWSPointerCalibrationData::screenPoints - \brief the logical screen coordinates for each value of the Location enum. -*/ - -/*! - \enum QWSPointerCalibrationData::Location - - This enum describes the various logical positions that can be - specified by the devPoints and screenPoints variables. - - \value TopLeft Index of the top left corner of the screen. - \value BottomLeft Index of the bottom left corner of the screen. - \value BottomRight Index of the bottom right corner of the screen. - \value TopRight Index of the top right corner of the screen. - \value Center Index of the center of the screen. - \value LastLocation Last index in the pointer arrays. -*/ - -class QWSMouseHandlerPrivate -{ -public: - QWSMouseHandlerPrivate() : screen(qt_screen) {} - - const QScreen *screen; -}; - -/*! - \class QWSMouseHandler - \ingroup qws - - \brief The QWSMouseHandler class is a base class for mouse drivers in - Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - \l{Qt for Embedded Linux} provides ready-made drivers for several mouse - protocols, see the \l{Qt for Embedded Linux Pointer Handling}{pointer - handling} documentation for details. Custom mouse drivers can be - implemented by subclassing the QWSMouseHandler class and creating - a mouse driver plugin (derived from QMouseDriverPlugin). - The default implementation of the QMouseDriverFactory class - will automatically detect the plugin, and load the driver into the - server application at run-time using Qt's \l {How to Create Qt - Plugins}{plugin system}. - - The mouse driver receives mouse events from the system device and - encapsulates each event with an instance of the QWSEvent class - which it then passes to the server application (the server is - responsible for propagating the event to the appropriate - client). To receive mouse events, a QWSMouseHandler object will - usually create a QSocketNotifier object for the given device. The - QSocketNotifier class provides support for monitoring activity on - a file descriptor. When the socket notifier receives data, it will - call the mouse driver's mouseChanged() function to send the event - to the \l{Qt for Embedded Linux} server application for relaying to - clients. - - If you are creating a driver for a device that needs calibration - or noise reduction, such as a touchscreen, use the - QWSCalibratedMouseHandler subclass instead to take advantage of - the calibrate() and clearCalibration() functions. The \l - {qws/mousecalibration}{Mouse Calibration} - demonstrates how to write a simple program using the mechanisms - provided by the QWSMouseHandler class to calibrate a mouse driver. - - Note that when deriving from the QWSMouseHandler class, the - resume() and suspend() functions must be reimplemented to control - the flow of mouse input, i.e., the default implementation does - nothing. Reimplementations of these functions typically call the - QSocketNotifier::setEnabled() function to enable or disable the - socket notifier, respectively. - - In addition, QWSMouseHandler provides the setScreen() function - that allows you to specify a screen for your mouse driver and the - limitToScreen() function that ensures that a given position is - within this screen's boundaries (changing the position if - necessary). Finally, QWSMouseHandler provides the pos() function - returning the current mouse position. - - \sa QMouseDriverPlugin, QMouseDriverFactory, {Qt for Embedded Linux Pointer - Handling} -*/ - - -/*! - \fn void QWSMouseHandler::suspend() - - Implement this function to suspend reading and handling of mouse - events, e.g., call the QSocketNotifier::setEnabled() function to - disable the socket notifier. - - \sa resume() -*/ - -/*! - \fn void QWSMouseHandler::resume() - - Implement this function to resume reading and handling mouse - events, e.g., call the QSocketNotifier::setEnabled() function to - enable the socket notifier. - - \sa suspend() -*/ - -/*! - \fn const QPoint &QWSMouseHandler::pos() const - - Returns the current mouse position. - - \sa mouseChanged(), limitToScreen() -*/ - -/*! - Constructs a mouse driver. The \a driver and \a device arguments - are passed by the QWS_MOUSE_PROTO environment variable. - - Call the QWSServer::setMouseHandler() function to make the newly - created mouse driver, the primary driver. Note that the primary - driver is controlled by the system, i.e., the system will delete - it upon exit. -*/ -QWSMouseHandler::QWSMouseHandler(const QString &, const QString &) - : mousePos(QWSServer::mousePosition), d_ptr(new QWSMouseHandlerPrivate) -{ -} - -/*! - Destroys this mouse driver. - - Do not call this function if this driver is the primary mouse - driver, i.e., if QWSServer::setMouseHandler() function has been - called passing this driver as argument. The primary mouse - driver is deleted by the system. -*/ -QWSMouseHandler::~QWSMouseHandler() -{ - delete d_ptr; -} - -/*! - Ensures that the given \a position is within the screen's - boundaries, changing the \a position if necessary. - - \sa pos(), setScreen() -*/ - -void QWSMouseHandler::limitToScreen(QPoint &position) -{ - position.setX(qMin(d_ptr->screen->deviceWidth() - 1, qMax(0, position.x()))); - position.setY(qMin(d_ptr->screen->deviceHeight() - 1, qMax(0, position.y()))); -} - -/*! - \since 4.2 - - Sets the screen for this mouse driver to be the given \a screen. - - \sa limitToScreen() -*/ -void QWSMouseHandler::setScreen(const QScreen *screen) -{ - d_ptr->screen = (screen ? screen : qt_screen); -} - -/*! - Notifies the system of a new mouse event. - - This function updates the current mouse position and sends the - event to the \l{Qt for Embedded Linux} server application for - delivery to the correct widget. Note that a custom mouse driver must call - this function whenever it wants to deliver a new mouse event. - - The given \a position is the global position of the mouse cursor. - The \a state parameter is a bitmask of the Qt::MouseButton enum's - values, indicating which mouse buttons are pressed. The \a wheel - parameter is the delta value of the mouse wheel as returned by - QWheelEvent::delta(). - - \sa pos() -*/ -void QWSMouseHandler::mouseChanged(const QPoint &position, int state, int wheel) -{ - mousePos = position + d_ptr->screen->offset(); - QWSServer::sendMouseEvent(mousePos, state, wheel); -} - -/*! - \fn QWSMouseHandler::clearCalibration() - - This virtual function allows subclasses of QWSMouseHandler to - clear the calibration information. Note that the default - implementation does nothing. - - \sa QWSCalibratedMouseHandler::clearCalibration(), calibrate() -*/ - -/*! - \fn QWSMouseHandler::calibrate(const QWSPointerCalibrationData *data) - - This virtual function allows subclasses of QWSMouseHandler to set - the calibration information passed in the given \a data. Note that - the default implementation does nothing. - - \sa QWSCalibratedMouseHandler::calibrate(), clearCalibration() -*/ - -/*! \fn QWSMouseHandler::getCalibration(QWSPointerCalibrationData *data) const - This virtual function allows subclasses of QWSMouseHandler - to fill in the device coordinates in \a data with values - that correspond to screen coordinates that are already in - \a data. Note that the default implementation does nothing. - */ - -/*! - \class QWSCalibratedMouseHandler - \ingroup qws - - \brief The QWSCalibratedMouseHandler class provides mouse - calibration and noise reduction in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - \l{Qt for Embedded Linux} provides ready-made drivers for several mouse - protocols, see the \l{Qt for Embedded Linux Pointer Handling}{pointer - handling} documentation for details. In general, custom mouse - drivers can be implemented by subclassing the QWSMouseHandler - class. But when the system device does not have a fixed mapping - between device and screen coordinates and/or produces noisy events - (e.g., a touchscreen), you should derive from the - QWSCalibratedMouseHandler class instead to take advantage of its - calibration functionality. As always, you must also create a mouse - driver plugin (derived from QMouseDriverPlugin); - the implementation of the QMouseDriverFactory class will then - automatically detect the plugin, and load the driver into the - server application at run-time using Qt's - \l{How to Create Qt Plugins}{plugin system}. - - QWSCalibratedMouseHandler provides an implementation of the - calibrate() function to update the calibration parameters based on - coordinate mapping of the given calibration data. The calibration - data is represented by an QWSPointerCalibrationData object. The - linear transformation between device coordinates and screen - coordinates is performed by calling the transform() function - explicitly on the points passed to the - QWSMouseHandler::mouseChanged() function. Use the - clearCalibration() function to make the mouse driver return mouse - events in raw device coordinates and not in screen coordinates. - - The calibration parameters are recalculated whenever calibrate() - is called, and they can be stored using the writeCalibration() - function. Previously written parameters can be retrieved at any - time using the readCalibration() function (calibration parameters - are always read when the class is instantiated). Note that the - calibration parameters is written to and read from the file - currently specified by the POINTERCAL_FILE environment variable; - the default file is \c /etc/pointercal. - - To achieve noise reduction, QWSCalibratedMouseHandler provides the - sendFiltered() function. Use this function instead of - mouseChanged() whenever a mouse event occurs. The filter's size - can be manipulated using the setFilterSize() function. - - \sa QWSMouseHandler, QWSPointerCalibrationData, - {Mouse Calibration Example} -*/ - - -/*! - \internal - */ - -QWSCalibratedMouseHandler::QWSCalibratedMouseHandler(const QString &, const QString &) - : samples(5), currSample(0), numSamples(0) -{ - clearCalibration(); - readCalibration(); -} - -/*! - Fills \a cd with the device coordinates corresponding to the given - screen coordinates. - - \internal -*/ -void QWSCalibratedMouseHandler::getCalibration(QWSPointerCalibrationData *cd) const -{ - const qint64 scale = qint64(a) * qint64(e) - qint64(b) * qint64(d); - const qint64 xOff = qint64(b) * qint64(f) - qint64(c) * qint64(e); - const qint64 yOff = qint64(c) * qint64(d) - qint64(a) * qint64(f); - for (int i = 0; i <= QWSPointerCalibrationData::LastLocation; ++i) { - const qint64 sX = cd->screenPoints[i].x(); - const qint64 sY = cd->screenPoints[i].y(); - const qint64 dX = (s*(e*sX - b*sY) + xOff) / scale; - const qint64 dY = (s*(a*sY - d*sX) + yOff) / scale; - cd->devPoints[i] = QPoint(dX, dY); - } -} - -/*! - Clears the current calibration, i.e., makes the mouse - driver return mouse events in raw device coordinates instead of - screen coordinates. - - \sa calibrate() -*/ -void QWSCalibratedMouseHandler::clearCalibration() -{ - a = 1; - b = 0; - c = 0; - d = 0; - e = 1; - f = 0; - s = 1; -} - - -/*! - Saves the current calibration parameters in \c /etc/pointercal - (separated by whitespace and in alphabetical order). - - You can override the default \c /etc/pointercal by specifying - another file using the POINTERCAL_FILE environment variable. - - \sa readCalibration() -*/ -void QWSCalibratedMouseHandler::writeCalibration() -{ - QString calFile; - calFile = QString::fromLocal8Bit(qgetenv("POINTERCAL_FILE")); - if (calFile.isEmpty()) - calFile = QLatin1String("/etc/pointercal"); - -#ifndef QT_NO_TEXTSTREAM - QFile file(calFile); - if (file.open(QIODevice::WriteOnly)) { - QTextStream t(&file); - t << a << ' ' << b << ' ' << c << ' '; - t << d << ' ' << e << ' ' << f << ' ' << s << endl; - } else -#endif - { - qCritical("QWSCalibratedMouseHandler::writeCalibration: " - "Could not save calibration into %s", qPrintable(calFile)); - } -} - -/*! - Reads previously written calibration parameters which are stored - in \c /etc/pointercal (separated by whitespace and in alphabetical - order). - - You can override the default \c /etc/pointercal by specifying - another file using the POINTERCAL_FILE environment variable. - - - \sa writeCalibration() -*/ -void QWSCalibratedMouseHandler::readCalibration() -{ - QString calFile = QString::fromLocal8Bit(qgetenv("POINTERCAL_FILE")); - if (calFile.isEmpty()) - calFile = QLatin1String("/etc/pointercal"); - -#ifndef QT_NO_TEXTSTREAM - QFile file(calFile); - if (file.open(QIODevice::ReadOnly)) { - QTextStream t(&file); - t >> a >> b >> c >> d >> e >> f >> s; - if (s == 0 || t.status() != QTextStream::Ok) { - qCritical("Corrupt calibration data"); - clearCalibration(); - } - } else -#endif - { - qDebug() << "Could not read calibration:" <>= 16; - result += 16; - } - if (n & 0xff00) { - n >>= 8; - result += 8;} - if (n & 0xf0) { - n >>= 4; - result += 4; - } - if (n & 0xc) { - n >>= 2; - result += 2; - } - if (n & 0x2) - result += 1; - - return result; -} - -/*! - Updates the calibration parameters based on coordinate mapping of - the given \a data. - - Create an instance of the QWSPointerCalibrationData class, fill in - the device and screen coordinates and pass that object to the mouse - driver using this function. - - \sa clearCalibration(), transform() -*/ -void QWSCalibratedMouseHandler::calibrate(const QWSPointerCalibrationData *data) -{ - // Algorithm derived from - // "How To Calibrate Touch Screens" by Carlos E. Vidales, - // printed in Embedded Systems Programming, Vol. 15 no 6, June 2002 - // URL: http://www.embedded.com/showArticle.jhtml?articleID=9900629 - - const QPoint pd0 = data->devPoints[QWSPointerCalibrationData::TopLeft]; - const QPoint pd1 = data->devPoints[QWSPointerCalibrationData::TopRight]; - const QPoint pd2 = data->devPoints[QWSPointerCalibrationData::BottomRight]; - const QPoint p0 = data->screenPoints[QWSPointerCalibrationData::TopLeft]; - const QPoint p1 = data->screenPoints[QWSPointerCalibrationData::TopRight]; - const QPoint p2 = data->screenPoints[QWSPointerCalibrationData::BottomRight]; - - const qint64 xd0 = pd0.x(); - const qint64 xd1 = pd1.x(); - const qint64 xd2 = pd2.x(); - const qint64 yd0 = pd0.y(); - const qint64 yd1 = pd1.y(); - const qint64 yd2 = pd2.y(); - const qint64 x0 = p0.x(); - const qint64 x1 = p1.x(); - const qint64 x2 = p2.x(); - const qint64 y0 = p0.y(); - const qint64 y1 = p1.y(); - const qint64 y2 = p2.y(); - - qint64 scale = ((xd0 - xd2)*(yd1 - yd2) - (xd1 - xd2)*(yd0 - yd2)); - int shift = 0; - qint64 absScale = qAbs(scale); - // use maximum 16 bit precision to reduce risk of integer overflow - if (absScale > (1 << 16)) { - shift = ilog2(absScale >> 16) + 1; - scale >>= shift; - } - - s = scale; - a = ((x0 - x2)*(yd1 - yd2) - (x1 - x2)*(yd0 - yd2)) >> shift; - b = ((xd0 - xd2)*(x1 - x2) - (x0 - x2)*(xd1 - xd2)) >> shift; - c = (yd0*(xd2*x1 - xd1*x2) + yd1*(xd0*x2 - xd2*x0) + yd2*(xd1*x0 - xd0*x1)) >> shift; - d = ((y0 - y2)*(yd1 - yd2) - (y1 - y2)*(yd0 - yd2)) >> shift; - e = ((xd0 - xd2)*(y1 - y2) - (y0 - y2)*(xd1 - xd2)) >> shift; - f = (yd0*(xd2*y1 - xd1*y2) + yd1*(xd0*y2 - xd2*y0) + yd2*(xd1*y0 - xd0*y1)) >> shift; - - writeCalibration(); -} - -/*! - Transforms the given \a position from device coordinates to screen - coordinates, and returns the transformed position. - - This function is typically called explicitly on the points passed - to the QWSMouseHandler::mouseChanged() function. - - This implementation is a linear transformation using 7 parameters - (\c a, \c b, \c c, \c d, \c e, \c f and \c s) to transform the - device coordinates (\c Xd, \c Yd) into screen coordinates (\c Xs, - \c Ys) using the following equations: - - \snippet doc/src/snippets/code/src_gui_embedded_qmouse_qws.cpp 0 - - \sa mouseChanged() -*/ -QPoint QWSCalibratedMouseHandler::transform(const QPoint &position) -{ - QPoint tp; - - tp.setX((a * position.x() + b * position.y() + c) / s); - tp.setY((d * position.x() + e * position.y() + f) / s); - - return tp; -} - -/*! - Sets the size of the filter used in noise reduction to the given - \a size. - - The sendFiltered() function reduces noice by calculating an - average position from a collection of mouse event positions. The - filter size determines the number of positions that forms the - basis for these calculations. - - \sa sendFiltered() -*/ -void QWSCalibratedMouseHandler::setFilterSize(int size) -{ - samples.resize(qMax(1, size)); - numSamples = 0; - currSample = 0; -} - -/*! - \fn bool QWSCalibratedMouseHandler::sendFiltered(const QPoint &position, int state) - - Notifies the system of a new mouse event \e after applying a noise - reduction filter. Returns true if the filtering process is - successful; otherwise returns false. Note that if the filtering - process failes, the system is not notified about the event. - - The given \a position is the global position of the mouse. The \a - state parameter is a bitmask of the Qt::MouseButton enum's values - indicating which mouse buttons are pressed. - - The noice is reduced by calculating an average position from a - collection of mouse event positions and then calling the - mouseChanged() function with the new position. The number of - positions that is used is determined by the filter size. - - \sa mouseChanged(), setFilterSize() -*/ -bool QWSCalibratedMouseHandler::sendFiltered(const QPoint &position, int button) -{ - if (!button) { - if (numSamples >= samples.count()) - mouseChanged(transform(position), 0); - currSample = 0; - numSamples = 0; - return true; - } - - bool sent = false; - samples[currSample] = position; - numSamples++; - if (numSamples >= samples.count()) { - - int ignore = -1; - if (samples.count() > 2) { // throw away the "worst" sample - int maxd = 0; - for (int i = 0; i < samples.count(); i++) { - int d = (mousePos - samples[i]).manhattanLength(); - if (d > maxd) { - maxd = d; - ignore = i; - } - } - } - - // average the rest - QPoint pos(0, 0); - int numAveraged = 0; - for (int i = 0; i < samples.count(); i++) { - if (ignore == i) - continue; - pos += samples[i]; - ++numAveraged; - } - if (numAveraged) - pos /= numAveraged; - - mouseChanged(transform(pos), button); - sent = true; - } - currSample++; - if (currSample >= samples.count()) - currSample = 0; - - return sent; -} - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qmouse_qws.h b/src/gui/embedded/qmouse_qws.h deleted file mode 100644 index 42a8292c543..00000000000 --- a/src/gui/embedded/qmouse_qws.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMOUSE_QWS_H -#define QMOUSE_QWS_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QWSMouseHandlerPrivate; -class QScreen; - -class Q_GUI_EXPORT QWSPointerCalibrationData -{ -public: - enum Location { TopLeft = 0, BottomLeft = 1, BottomRight = 2, TopRight = 3, - Center = 4, LastLocation = Center }; - QPoint devPoints[5]; - QPoint screenPoints[5]; -}; - -class Q_GUI_EXPORT QWSMouseHandler -{ -public: - explicit QWSMouseHandler(const QString &driver = QString(), - const QString &device = QString()); - virtual ~QWSMouseHandler(); - - virtual void clearCalibration() {} - virtual void calibrate(const QWSPointerCalibrationData *) {} - virtual void getCalibration(QWSPointerCalibrationData *) const {} - - virtual void resume() = 0; - virtual void suspend() = 0; - - void limitToScreen(QPoint &pt); - void mouseChanged(const QPoint& pos, int bstate, int wheel = 0); - const QPoint &pos() const { return mousePos; } - - void setScreen(const QScreen *screen); - -protected: - QPoint &mousePos; - QWSMouseHandlerPrivate *d_ptr; -}; - - -class Q_GUI_EXPORT QWSCalibratedMouseHandler : public QWSMouseHandler -{ -public: - explicit QWSCalibratedMouseHandler(const QString &driver = QString(), - const QString &device = QString()); - - virtual void clearCalibration(); - virtual void calibrate(const QWSPointerCalibrationData *); - virtual void getCalibration(QWSPointerCalibrationData *) const; - -protected: - bool sendFiltered(const QPoint &, int button); - QPoint transform(const QPoint &); - - void readCalibration(); - void writeCalibration(); - void setFilterSize(int); - -private: - int a, b, c; - int d, e, f; - int s; - QPolygon samples; - int currSample; - int numSamples; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMOUSE_QWS_H diff --git a/src/gui/embedded/qmousedriverfactory_qws.cpp b/src/gui/embedded/qmousedriverfactory_qws.cpp deleted file mode 100644 index d995bdfe536..00000000000 --- a/src/gui/embedded/qmousedriverfactory_qws.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmousedriverfactory_qws.h" - -#include "qapplication.h" -#include "qmousepc_qws.h" -#include "qmouselinuxtp_qws.h" -#include "qmouselinuxinput_qws.h" -#include "qmousevfb_qws.h" -#include "qmousetslib_qws.h" -#include "qmouseqnx_qws.h" -#include "qmouseintegrity_qws.h" -#include -#include "private/qfactoryloader_p.h" -#include "qmousedriverplugin_qws.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, - (QWSMouseHandlerFactoryInterface_iid, - QLatin1String("/mousedrivers"), Qt::CaseInsensitive)) - -#endif //QT_NO_LIBRARY -#endif //QT_MAKEDLL - -/*! - \class QMouseDriverFactory - \ingroup qws - - \brief The QMouseDriverFactory class creates mouse drivers in - Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - QMouseDriverFactory is used to detect and instantiate the - available mouse drivers, allowing \l{Qt for Embedded Linux} to load the - preferred driver into the server application at runtime. The - create() function returns a QWSMouseHandler object representing - the mouse driver identified by a given key. The valid keys - (i.e. the supported drivers) can be retrieved using the keys() - function. - - \l{Qt for Embedded Linux} provides several built-in mouse drivers. In - addition, custom mouse drivers can be added using Qt's plugin - mechanism, i.e. by subclassing the QWSMouseHandler class and - creating a mouse driver plugin (QMouseDriverPlugin). See the - \l{Qt for Embedded Linux Pointer Handling}{pointer handling} - documentation for details. - - \sa QWSMouseHandler, QMouseDriverPlugin -*/ - -/*! - Creates the mouse driver specified by the given \a key, using the - display specified by the given \a device. - - Note that the keys are case-insensitive. - - \sa keys() -*/ -QWSMouseHandler *QMouseDriverFactory::create(const QString& key, const QString &device) -{ - QString driver = key.toLower(); -#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_MOUSE_QNX) - if (driver == QLatin1String("qnx") || driver.isEmpty()) - return new QQnxMouseHandler(key, device); -#endif -#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_MOUSE_INTEGRITY) - if (driver == QLatin1String("integrity") || driver.isEmpty()) - return new QIntMouseHandler(key, device); -#endif -#ifndef QT_NO_QWS_MOUSE_LINUXTP - if (driver == QLatin1String("linuxtp") || driver.isEmpty()) - return new QWSLinuxTPMouseHandler(key, device); -#endif -#ifndef QT_NO_QWS_MOUSE_PC - if (driver == QLatin1String("auto") - || driver == QLatin1String("intellimouse") - || driver == QLatin1String("microsoft") - || driver == QLatin1String("mousesystems") - || driver == QLatin1String("mouseman") - || driver.isEmpty()) { - return new QWSPcMouseHandler(key, device); - } -#endif -#ifndef QT_NO_QWS_MOUSE_TSLIB - if (driver == QLatin1String("tslib") || driver.isEmpty()) - return new QWSTslibMouseHandler(key, device); -#endif -# ifndef QT_NO_QWS_MOUSE_LINUXINPUT - if (driver == QLatin1String("linuxinput") || \ - driver == QLatin1String("usb") || \ - driver == QLatin1String("linuxis")) - return new QWSLinuxInputMouseHandler(device); -# endif -#ifndef QT_NO_QWS_MOUSE_QVFB - if (driver == QLatin1String("qvfbmouse") || driver == QLatin1String("qvfb")) - return new QVFbMouseHandler(key, device); -#endif - -#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) -#ifndef QT_NO_LIBRARY - if (QWSMouseHandlerFactoryInterface *factory = qobject_cast(loader()->instance(driver))) - return factory->create(driver, device); -#endif -#endif - return 0; -} - -/*! - Returns the list of valid keys, i.e. the available mouse drivers. - - \sa create() -*/ -QStringList QMouseDriverFactory::keys() -{ - QStringList list; - -#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_MOUSE_QNX) - list << QLatin1String("QNX"); -#endif -#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_MOUSE_INTEGRITY) - list << QLatin1String("INTEGRITY"); -#endif -#ifndef QT_NO_QWS_MOUSE_LINUXTP - list << QLatin1String("LinuxTP"); -#endif -#ifndef QT_NO_QWS_MOUSE_PC - list << QLatin1String("Auto") - << QLatin1String("IntelliMouse") - << QLatin1String("Microsoft") - << QLatin1String("MouseSystems") - << QLatin1String("MouseMan"); -#endif -#ifndef QT_NO_QWS_MOUSE_TSLIB - list << QLatin1String("Tslib"); -#endif -#ifndef QT_NO_QWS_MOUSE_LINUXINPUT - list << QLatin1String("LinuxInput"); -#endif - -#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/embedded/qmousedriverplugin_qws.cpp b/src/gui/embedded/qmousedriverplugin_qws.cpp deleted file mode 100644 index e828f476c11..00000000000 --- a/src/gui/embedded/qmousedriverplugin_qws.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmousedriverplugin_qws.h" - -#ifndef QT_NO_LIBRARY - -#include "qmouse_qws.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QMouseDriverPlugin - \ingroup plugins - \ingroup qws - - \brief The QMouseDriverPlugin class is an abstract base class for - mouse driver plugins in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - \l{Qt for Embedded Linux} provides ready-made drivers for several mouse - protocols, see the \l{Qt for Embedded Linux Pointer Handling}{pointer - handling} documentation for details. Custom mouse drivers can be - implemented by subclassing the QWSMouseHandler class and creating - a mouse driver plugin. - - A mouse driver plugin can be created by subclassing - QMouseDriverPlugin 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 - QMouseDriverFactory 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 QWSMouseHandler, QMouseDriverFactory -*/ - -/*! - \fn QStringList QMouseDriverPlugin::keys() const - - Implement this function to return the list of valid keys, i.e. the - mouse drivers supported by this plugin. - - \l{Qt for Embedded Linux} provides ready-made drivers for several mouse - protocols, see the \l {Qt for Embedded Linux Pointer Handling}{pointer - handling} documentation for details. - - \sa create() -*/ - -/*! - Constructs a mouse driver 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. -*/ -QMouseDriverPlugin::QMouseDriverPlugin(QObject *parent) - : QObject(parent) -{ -} - -/*! - Destroys the mouse driver plugin. - - Note that Qt destroys a plugin automatically when it is no longer - used, so there is no need for calling the destructor explicitly. -*/ -QMouseDriverPlugin::~QMouseDriverPlugin() -{ -} - -/*! - \fn QScreen* QMouseDriverPlugin::create(const QString &key, const QString& device) - - Implement this function to create a driver matching the type - specified by the given \a key and \a device parameters. Note that - keys are case-insensitive. - - \sa keys() -*/ - -QT_END_NAMESPACE - -#endif // QT_NO_LIBRARY diff --git a/src/gui/embedded/qmouseintegrity_qws.cpp b/src/gui/embedded/qmouseintegrity_qws.cpp deleted file mode 100644 index c4ce603f55d..00000000000 --- a/src/gui/embedded/qmouseintegrity_qws.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT_NO_QWS_MOUSE_INTEGRITY - -#include "qmouseintegrity_qws.h" -#include -#include -#include -#include - -#include - - -typedef Address MOUSEHandler; -typedef struct MOUSEMessageStruct -{ - Value x; - Value y; - Value z; - Value buttons; -} MOUSEMessage; - -static Error MOUSE_Init(MOUSEHandler *handler, Boolean *isabsolute); -static Error MOUSE_SynchronousGetPosition(MOUSEHandler handler, MOUSEMessage *msg, - Boolean absolute); -static Error MOUSE_ShouldFilter(MOUSEHandler handler, Boolean *filter); - -QT_BEGIN_NAMESPACE - -class QIntMouseListenThread; - -class QIntMousePrivate : public QObject -{ - Q_OBJECT - friend class QIntMouseListenTaskThread; -Q_SIGNALS: - void mouseDataAvailable(int x, int y, int buttons); -public: - QIntMousePrivate(QIntMouseHandler *handler); - ~QIntMousePrivate(); - void dataReady(int x, int y, int buttons) { emit mouseDataAvailable(x, y, buttons); } - bool calibrated; - bool waitforread; - bool suspended; - QIntMouseListenThread *mousethread; - -private: - QIntMouseHandler *handler; -}; - -class QIntMouseListenThread : public QThread -{ -protected: - QIntMousePrivate *imp; - bool loop; -public: - QIntMouseListenThread(QIntMousePrivate *im) : QThread(), imp(im) {}; - ~QIntMouseListenThread() {}; - void run(); - void stoploop() { loop = false; }; -}; - - -QIntMouseHandler::QIntMouseHandler(const QString &driver, const QString &device) - : QObject(), QWSCalibratedMouseHandler(driver, device) -{ - QPoint test(1,1); - d = new QIntMousePrivate(this); - connect(d, SIGNAL(mouseDataAvailable(int, int, int)), this, SLOT(readMouseData(int, int, int))); - - d->calibrated = (test != transform(test)); - - d->mousethread->start(); -} - -QIntMouseHandler::~QIntMouseHandler() -{ - disconnect(d, SIGNAL(mouseDataAvailable(int, int, int)), this, SLOT(readMouseData(int, int, int))); - delete d; -} - -void QIntMouseHandler::resume() -{ - d->suspended = true; -} - -void QIntMouseHandler::suspend() -{ - d->suspended = false; -} - -void QIntMouseHandler::readMouseData(int x, int y, int buttons) -{ - d->waitforread = false; - if (d->suspended) - return; - if (d->calibrated) { - sendFiltered(QPoint(x, y), buttons); - } else { - QPoint pos; - pos = transform(QPoint(x, y)); - limitToScreen(pos); - mouseChanged(pos, buttons, 0); - } -} - -void QIntMouseHandler::clearCalibration() -{ - QWSCalibratedMouseHandler::clearCalibration(); -} - -void QIntMouseHandler::calibrate(const QWSPointerCalibrationData *data) -{ - QWSCalibratedMouseHandler::calibrate(data); -} - -void QIntMouseListenThread::run(void) -{ - MOUSEHandler handler; - MOUSEMessage msg; - Boolean filter; - Boolean isabsolute; - loop = true; - CheckSuccess(MOUSE_Init(&handler, &isabsolute)); - CheckSuccess(MOUSE_ShouldFilter(handler, &filter)); - if (!filter) - imp->calibrated = false; - imp->waitforread = false; - do { - MOUSE_SynchronousGetPosition(handler, &msg, isabsolute); - imp->dataReady(msg.x, msg.y, msg.buttons); - } while (loop); - QThread::exit(0); -} - -QIntMousePrivate::QIntMousePrivate(QIntMouseHandler *handler) - : QObject() -{ - this->handler = handler; - suspended = false; - mousethread = new QIntMouseListenThread(this); -} - -QIntMousePrivate::~QIntMousePrivate() -{ - mousethread->stoploop(); - mousethread->wait(); - delete mousethread; -} - -QT_END_NAMESPACE - -#include "qmouseintegrity_qws.moc" - -typedef struct USBMouseStruct -{ - Connection mouseconn; - Buffer mousemsg[2]; - Value x; - Value y; -} USBMouse; - -USBMouse mousedev; - -Error MOUSE_Init(MOUSEHandler *handler, Boolean *isabsolute) -{ - Error E; - bool loop = true; - memset((void*)&mousedev, 0, sizeof(USBMouse)); - mousedev.mousemsg[0].BufferType = DataImmediate; - mousedev.mousemsg[1].BufferType = DataImmediate | LastBuffer; - do { - E = RequestResource((Object*)&mousedev.mouseconn, - "MouseClient", "!systempassword"); - if (E == Success) { - *isabsolute = true; - loop = false; - } else { - E = RequestResource((Object*)&mousedev.mouseconn, - "USBMouseClient", "!systempassword"); - if (E == Success) { - *isabsolute = false; - loop = false; - } - } - if (loop) - sleep(1); - } while (loop); - *handler = (MOUSEHandler)&mousedev; - return Success; -} - -Error MOUSE_SynchronousGetPosition(MOUSEHandler handler, MOUSEMessage *msg, - Boolean isabsolute) -{ - signed long x; - signed long y; - USBMouse *mdev = (USBMouse *)handler; - mdev->mousemsg[0].Transferred = 0; - mdev->mousemsg[1].Transferred = 0; - SynchronousReceive(mdev->mouseconn, mdev->mousemsg); - if (isabsolute) { - x = (signed long)mdev->mousemsg[0].Length; - y = (signed long)mdev->mousemsg[1].TheAddress; - } else { - x = mdev->x + (signed long)mdev->mousemsg[0].Length; - y = mdev->y + (signed long)mdev->mousemsg[1].TheAddress; - } - if (x < 0) - mdev->x = 0; - else - mdev->x = x; - if (y < 0) - mdev->y = 0; - else - mdev->y = y; - msg->x = mdev->x; - msg->y = mdev->y; - msg->buttons = mdev->mousemsg[0].TheAddress; - return Success; -} - -Error MOUSE_ShouldFilter(MOUSEHandler handler, Boolean *filter) -{ - if (filter == NULL) - return Failure; - *filter = false; - return Success; -} - -#endif // QT_NO_QWS_MOUSE_INTEGRITY - diff --git a/src/gui/embedded/qmouseintegrity_qws.h b/src/gui/embedded/qmouseintegrity_qws.h deleted file mode 100644 index 5f0c2aabcdc..00000000000 --- a/src/gui/embedded/qmouseintegrity_qws.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMOUSEINTEGRITY_QWS_H -#define QMOUSEINTEGRITY_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_QWS_MOUSE_INTEGRITY - -class QSocketNotifier; -class QIntMousePrivate; - -class QIntMouseHandler : public QObject, public QWSCalibratedMouseHandler { - Q_OBJECT -public: - QIntMouseHandler(const QString &driver = QString(), - const QString &device = QString()); - ~QIntMouseHandler(); - - void resume(); - void suspend(); - - void calibrate(const QWSPointerCalibrationData *data); - void clearCalibration(); - -private: - QIntMousePrivate *d; -private Q_SLOTS: - void readMouseData(int x, int y, int buttons); -}; -#endif // QT_NO_QWS_MOUSE_INTEGRITY - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMOUSEINTEGRITY_QWS_H diff --git a/src/gui/embedded/qmouselinuxinput_qws.cpp b/src/gui/embedded/qmouselinuxinput_qws.cpp deleted file mode 100644 index efcf6d4267e..00000000000 --- a/src/gui/embedded/qmouselinuxinput_qws.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmouselinuxinput_qws.h" - -#include -#include - -#include -#include // overrides QT_OPEN - -#include - -#include - -QT_BEGIN_NAMESPACE - - -class QWSLinuxInputMousePrivate : public QObject -{ - Q_OBJECT -public: - QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *, const QString &); - ~QWSLinuxInputMousePrivate(); - - void enable(bool on); - -private Q_SLOTS: - void readMouseData(); - -private: - QWSLinuxInputMouseHandler *m_handler; - QSocketNotifier * m_notify; - int m_fd; - int m_x, m_y; - int m_buttons; -}; - -QWSLinuxInputMouseHandler::QWSLinuxInputMouseHandler(const QString &device) - : QWSCalibratedMouseHandler(device) -{ - d = new QWSLinuxInputMousePrivate(this, device); -} - -QWSLinuxInputMouseHandler::~QWSLinuxInputMouseHandler() -{ - delete d; -} - -void QWSLinuxInputMouseHandler::suspend() -{ - d->enable(false); -} - -void QWSLinuxInputMouseHandler::resume() -{ - d->enable(true); -} - -QWSLinuxInputMousePrivate::QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *h, const QString &device) - : m_handler(h), m_notify(0), m_x(0), m_y(0), m_buttons(0) -{ - setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler")); - - QString dev = QLatin1String("/dev/input/event0"); - if (device.startsWith(QLatin1String("/dev/"))) - dev = device; - - 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; - } -} - -QWSLinuxInputMousePrivate::~QWSLinuxInputMousePrivate() -{ - if (m_fd >= 0) - QT_CLOSE(m_fd); -} - -void QWSLinuxInputMousePrivate::enable(bool on) -{ - if (m_notify) - m_notify->setEnabled(on); -} - -void QWSLinuxInputMousePrivate::readMouseData() -{ - if (!qt_screen) - return; - - 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 : 0; - } else if (data->type == EV_KEY) { - int button = 0; - 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; - } else if (data->type == EV_SYN && data->code == SYN_REPORT) { - QPoint pos(m_x, m_y); - 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); - } - } -} - -QT_END_NAMESPACE - -#include "qmouselinuxinput_qws.moc" diff --git a/src/gui/embedded/qmouselinuxtp_qws.cpp b/src/gui/embedded/qmouselinuxtp_qws.cpp deleted file mode 100644 index afa6fe80da8..00000000000 --- a/src/gui/embedded/qmouselinuxtp_qws.cpp +++ /dev/null @@ -1,335 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmouselinuxtp_qws.h" - -#ifndef QT_NO_QWS_MOUSE_LINUXTP -#include "qwindowsystem_qws.h" -#include "qsocketnotifier.h" -#include "qtimer.h" -#include "qapplication.h" -#include "qscreen_qws.h" -#include // overrides QT_OPEN - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#if defined(QT_QWS_IPAQ) - #define QT_QWS_IPAQ_RAW - #define QT_QWS_SCREEN_COORDINATES - typedef struct { - unsigned short pressure; - unsigned short x; - unsigned short y; - unsigned short pad; - } TS_EVENT; -#elif defined(QT_QWS_EBX) - #define QT_QWS_EBX_RAW - #define QT_QWS_SCREEN_COORDINATES -#ifndef QT_QWS_SHARP - typedef struct { - unsigned short pressure; - unsigned short x; - unsigned short y; - unsigned short pad; - } TS_EVENT; - #else - typedef struct { - long y; - long x; - long pressure; - long long millisecs; - } TS_EVENT; - #define QT_QWS_TP_SAMPLE_SIZE 10 - #define QT_QWS_TP_MINIMUM_SAMPLES 4 - #define QT_QWS_TP_PRESSURE_THRESHOLD 500 - #define QT_QWS_TP_MOVE_LIMIT 50 - #define QT_QWS_TP_JITTER_LIMIT 2 - #endif -#else // not IPAQ, not SHARP - typedef struct { - unsigned short pressure; - unsigned short x; - unsigned short y; - unsigned short pad; - } TS_EVENT; -#endif - -#ifndef QT_QWS_TP_SAMPLE_SIZE -#define QT_QWS_TP_SAMPLE_SIZE 5 -#endif - -#ifndef QT_QWS_TP_MINIMUM_SAMPLES -#define QT_QWS_TP_MINIMUM_SAMPLES 5 -#endif - -#ifndef QT_QWS_TP_PRESSURE_THRESHOLD -#define QT_QWS_TP_PRESSURE_THRESHOLD 1 -#endif - -#ifndef QT_QWS_TP_MOVE_LIMIT -#define QT_QWS_TP_MOVE_LIMIT 100 -#endif - -#ifndef QT_QWS_TP_JITTER_LIMIT -#define QT_QWS_TP_JITTER_LIMIT 2 -#endif - -class QWSLinuxTPMouseHandlerPrivate : public QObject -{ - Q_OBJECT -public: - QWSLinuxTPMouseHandlerPrivate(QWSLinuxTPMouseHandler *h, const QString &); - ~QWSLinuxTPMouseHandlerPrivate(); - - void suspend(); - void resume(); -private: - static const int mouseBufSize = 2048; - int mouseFD; - QPoint oldmouse; - QPoint oldTotalMousePos; - bool waspressed; - QPolygon samples; - int currSample; - int lastSample; - int numSamples; - int skipCount; - int mouseIdx; - uchar mouseBuf[mouseBufSize]; - QWSLinuxTPMouseHandler *handler; - QSocketNotifier *mouseNotifier; - -private slots: - void readMouseData(); -}; - -QWSLinuxTPMouseHandler::QWSLinuxTPMouseHandler(const QString &driver, const QString &device) - : QWSCalibratedMouseHandler(driver, device) -{ - d = new QWSLinuxTPMouseHandlerPrivate(this, device); -} - -QWSLinuxTPMouseHandler::~QWSLinuxTPMouseHandler() -{ - delete d; -} - -void QWSLinuxTPMouseHandler::suspend() -{ - d->suspend(); -} - -void QWSLinuxTPMouseHandler::resume() -{ - d->resume(); -} - -QWSLinuxTPMouseHandlerPrivate::QWSLinuxTPMouseHandlerPrivate(QWSLinuxTPMouseHandler *h, - const QString &device) - : samples(QT_QWS_TP_SAMPLE_SIZE), currSample(0), lastSample(0), - numSamples(0), skipCount(0), handler(h) -{ - QString mousedev; - if (device.isEmpty()) { -#if defined(QT_QWS_IPAQ) -# ifdef QT_QWS_IPAQ_RAW - mousedev = QLatin1String("/dev/h3600_tsraw"); -# else - mousedev = QLatin1String("/dev/h3600_ts"); -# endif -#else - mousedev = QLatin1String("/dev/ts"); -#endif - } else { - mousedev = device; - } - if ((mouseFD = QT_OPEN(mousedev.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) { - qWarning("Cannot open %s (%s)", qPrintable(mousedev), strerror(errno)); - return; - } - - mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, - this); - connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); - waspressed=false; - mouseIdx = 0; -} - -QWSLinuxTPMouseHandlerPrivate::~QWSLinuxTPMouseHandlerPrivate() -{ - if (mouseFD >= 0) - QT_CLOSE(mouseFD); -} - -void QWSLinuxTPMouseHandlerPrivate::suspend() -{ - if (mouseNotifier) - mouseNotifier->setEnabled(false); -} - -void QWSLinuxTPMouseHandlerPrivate::resume() -{ - mouseIdx=0; - currSample=0; - lastSample=0; - numSamples=0; - skipCount=0; - if (mouseNotifier) - mouseNotifier->setEnabled(true); -} - - -void QWSLinuxTPMouseHandlerPrivate::readMouseData() -{ - if(!qt_screen) - return; - - int n; - do { - n = QT_READ(mouseFD, mouseBuf+mouseIdx, mouseBufSize-mouseIdx); - if (n > 0) - mouseIdx += n; - } while (n > 0 && mouseIdx < mouseBufSize); - - //qDebug("readMouseData()"); - - TS_EVENT *data; - int idx = 0; - - // perhaps we shouldn't be reading EVERY SAMPLE. - while (mouseIdx-idx >= (int)sizeof(TS_EVENT)) { - uchar *mb = mouseBuf+idx; - data = (TS_EVENT *) mb; - - if(data->pressure >= QT_QWS_TP_PRESSURE_THRESHOLD) { -#ifdef QT_QWS_SHARP - samples[currSample] = QPoint(1000 - data->x, data->y); -#else - samples[currSample] = QPoint(data->x, data->y); -#endif - numSamples++; - if (numSamples >= QT_QWS_TP_MINIMUM_SAMPLES) { - int sampleCount = qMin(numSamples + 1,samples.count()); - - // average the rest - QPoint mousePos = QPoint(0, 0); - QPoint totalMousePos = oldTotalMousePos; - totalMousePos += samples[currSample]; - if(numSamples >= samples.count()) - totalMousePos -= samples[lastSample]; - - mousePos = totalMousePos / (sampleCount - 1); -#if defined(QT_QWS_SCREEN_COORDINATES) - mousePos = handler->transform(mousePos); -#endif - if(!waspressed) - oldmouse = mousePos; - QPoint dp = mousePos - oldmouse; - int dxSqr = dp.x() * dp.x(); - int dySqr = dp.y() * dp.y(); - if (dxSqr + dySqr < (QT_QWS_TP_MOVE_LIMIT * QT_QWS_TP_MOVE_LIMIT)) { - if (waspressed) { - if ((dxSqr + dySqr > (QT_QWS_TP_JITTER_LIMIT * QT_QWS_TP_JITTER_LIMIT)) || skipCount > 2) { - handler->mouseChanged(mousePos,Qt::LeftButton); - oldmouse = mousePos; - skipCount = 0; - } else { - skipCount++; - } - } else { - handler->mouseChanged(mousePos,Qt::LeftButton); - oldmouse=mousePos; - waspressed=true; - } - - // save recuring information - currSample++; - if (numSamples >= samples.count()) - lastSample++; - oldTotalMousePos = totalMousePos; - } else { - numSamples--; // don't use this sample, it was bad. - } - } else { - // build up the average - oldTotalMousePos += samples[currSample]; - currSample++; - } - if (currSample >= samples.count()) - currSample = 0; - if (lastSample >= samples.count()) - lastSample = 0; - } else { - currSample = 0; - lastSample = 0; - numSamples = 0; - skipCount = 0; - oldTotalMousePos = QPoint(0,0); - if (waspressed) { - handler->mouseChanged(oldmouse,0); - oldmouse = QPoint(-100, -100); - waspressed=false; - } - } - idx += sizeof(TS_EVENT); - } - - int surplus = mouseIdx - idx; - for (int i = 0; i < surplus; i++) - mouseBuf[i] = mouseBuf[idx+i]; - mouseIdx = surplus; -} - -QT_END_NAMESPACE - -#include "qmouselinuxtp_qws.moc" - -#endif //QT_NO_QWS_MOUSE_LINUXTP diff --git a/src/gui/embedded/qmousepc_qws.cpp b/src/gui/embedded/qmousepc_qws.cpp deleted file mode 100644 index c22cab91f26..00000000000 --- a/src/gui/embedded/qmousepc_qws.cpp +++ /dev/null @@ -1,794 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmousepc_qws.h" - -#ifndef QT_NO_QWS_MOUSE_PC - -#include "qwindowsystem_qws.h" -#include "qsocketnotifier.h" -#include "qwsevent_qws.h" -#include "qwscommand_qws_p.h" -#include "qwsutils_qws.h" - -#include "qapplication.h" -#include "qpolygon.h" -#include "qtimer.h" -#include "qfile.h" -#include "qtextstream.h" -#include "qstringlist.h" -#include // overrides QT_OPEN - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -//#define QWS_MOUSE_DEBUG - -/* - * Automatic-detection mouse driver - */ - -class QWSPcMouseSubHandler { -protected: - enum { max_buf=32 }; - - int fd; - - uchar buffer[max_buf]; - int nbuf; - - QPoint motion; - int bstate; - int wheel; - - int goodness; - int badness; - - virtual int tryData()=0; - -public: - QWSPcMouseSubHandler(int f) : fd(f) - { - initState(); - } - virtual ~QWSPcMouseSubHandler() {} - - int file() const { return fd; } - - void closeIfNot(int& f) - { - if (fd != f) { - f = fd; - QT_CLOSE(fd); - } - } - - void initState() { nbuf = bstate = goodness = badness = 0; } - - void worse(int by=1) { badness+=by; } - bool reliable() const { return goodness >= 5 && badness < 50; } - int buttonState() const { return bstate; } - bool motionPending() const { return motion!=QPoint(0,0); } - QPoint takeMotion() { QPoint r=motion; motion=QPoint(0,0); return r; } - int takeWheel() { int result = wheel; wheel = 0; return result; } - - void appendData(uchar* data, int length) - { - memcpy(buffer+nbuf, data, length); - nbuf += length; - } - - enum UsageResult { Insufficient, Motion, Button }; - - UsageResult useData() - { - int pbstate = bstate; - int n = tryData(); -#ifdef QWS_MOUSE_DEBUG - if (n) { - fprintf(stderr, "QWSPcMouseSubHandler tryData read %d bytes:", n); - for (int i=0; i 0) { - if (n 0) { - goodness = 10; - switch (reply[n-1]) { - case 3: - case 4: - packetsize = 4; - break; - default: - packetsize = 3; - } - } else { - badness = 100; - } - } - - int tryData() - { - if (nbuf >= packetsize) { - //int overflow = (buffer[0]>>6)& 0x03; - - if (/*overflow ||*/ !(buffer[0] & 8)) { -#ifdef QWS_MOUSE_DEBUG - qDebug("Intellimouse: skipping (overflow)"); -#endif - badness++; - return 1; - } else { - QPoint delta((buffer[0] & 0x10) ? buffer[1]-256 : buffer[1], - (buffer[0] & 0x20) ? 256-buffer[2] : -buffer[2]); - motion += delta; - int nbstate = buffer[0] & 0x7; -#ifdef QWS_MOUSE_DEBUG - int debugwheel = -#endif - wheel = packetsize > 3 ? -(signed char)buffer[3] : 0; - if (wheel < -2 || wheel > 2) - wheel = 0; - wheel *= 120; // WHEEL_DELTA? -#ifdef QWS_MOUSE_DEBUG - qDebug("Intellimouse: motion %d,%d, state %d, raw wheel %d, wheel %d", motion.x(), motion.y(), nbstate, debugwheel, wheel); -#endif - if (motion.x() || motion.y() || bstate != nbstate || wheel) { - bstate = nbstate; - goodness++; - } else { - badness++; - return 1; - } - } - return packetsize; - } - return 0; - } -}; - -class QWSPcMouseSubHandler_mouseman : public QWSPcMouseSubHandler { - int packetsize; -public: - QWSPcMouseSubHandler_mouseman(int f) : QWSPcMouseSubHandler(f) - { - init(); - } - - void init() - { - if (tcflush(fd,TCIOFLUSH) == -1) { -#ifdef QWS_MOUSE_DEBUG - perror("QWSPcMouseSubHandler_mouseman: initial tcflush"); -#endif - } - QT_WRITE(fd,"",1); - usleep(50000); - QT_WRITE(fd,"@EeI!",5); - usleep(10000); - static const unsigned char ibuf[] = { 246, 244 }; - QT_WRITE(fd,ibuf,1); - QT_WRITE(fd,ibuf+1,1); - if (tcflush(fd,TCIOFLUSH) == -1) { -#ifdef QWS_MOUSE_DEBUG - perror("QWSPcMouseSubHandler_mouseman: tcflush"); -#endif - } - usleep(10000); - - char buf[100]; - while (QT_READ(fd, buf, 100) > 0) { } // eat unwanted replies - } - - int tryData() - { - if (nbuf >= 3) { - int nbstate = 0; - if (buffer[0] & 0x01) - nbstate |= Qt::LeftButton; - if (buffer[0] & 0x02) - nbstate |= Qt::RightButton; - if (buffer[0] & 0x04) - nbstate |= Qt::MidButton; - - int overflow = (buffer[0]>>6)& 0x03; - if (overflow) { - //### wheel events signalled with overflow bit, ignore for now - badness++; - return 1; - } else { - bool xs = buffer[0] & 0x10; - bool ys = buffer[0] & 0x20; - int dx = xs ? buffer[1]-256 : buffer[1]; - int dy = ys ? buffer[2]-256 : buffer[2]; - - motion += QPoint(dx, -dy); - if (motion.x() || motion.y() || bstate != nbstate) { - bstate = nbstate; - goodness++; - } else { - badness++; - return 1; - } - } - return 3; - } - return 0; - } -}; - -class QWSPcMouseSubHandler_serial : public QWSPcMouseSubHandler { -public: - QWSPcMouseSubHandler_serial(int f) : QWSPcMouseSubHandler(f) - { - initSerial(); - } - -protected: - void setflags(int f) - { - termios tty; - if (tcgetattr(fd, &tty) == -1) { -#ifdef QWS_MOUSE_DEBUG - perror("QWSPcMouseSubHandler_serial: tcgetattr"); -#endif - } - tty.c_iflag = IGNBRK | IGNPAR; - tty.c_oflag = 0; - tty.c_lflag = 0; - tty.c_cflag = f | CREAD | CLOCAL | HUPCL; -#ifdef Q_OS_LINUX - tty.c_line = 0; -#endif - tty.c_cc[VTIME] = 0; - tty.c_cc[VMIN] = 1; - if (tcsetattr(fd, TCSANOW, &tty) == -1) { -#ifdef QWS_MOUSE_DEBUG - perror("QWSPcMouseSubHandler_serial: tcgetattr"); -#endif - } - } - -private: - void initSerial() - { - int speed[4] = { B9600, B4800, B2400, B1200 }; - - for (int n = 0; n < 4; n++) { - setflags(CSTOPB | speed[n]); - QT_WRITE(fd, "*q", 2); - usleep(10000); - } - } -}; - -class QWSPcMouseSubHandler_mousesystems : public QWSPcMouseSubHandler_serial { -public: - // ##### This driver has not been tested - - QWSPcMouseSubHandler_mousesystems(int f) : QWSPcMouseSubHandler_serial(f) - { - init(); - } - - void init() - { - setflags(B1200|CS8|CSTOPB); - // 60Hz - if (QT_WRITE(fd, "R", 1)!=1) { - badness = 100; - return; - } - if (tcflush(fd,TCIOFLUSH) == -1) { -#ifdef QT_QWS_VNC_DEBUG - perror("QWSPcMouseSubHandler_mousesystems: tcflush"); -#endif - } - } - - int tryData() - { - if (nbuf >= 5) { - if ((buffer[0] & 0xf8) != 0x80) { - badness++; - return 1; - } - motion += - QPoint((signed char)buffer[1] + (signed char)buffer[3], - -(signed char)buffer[2] + (signed char)buffer[4]); - int t = ~buffer[0]; - int nbstate = ((t&3) << 1) | ((t&4) >> 2); - if (motion.x() || motion.y() || bstate != nbstate) { - bstate = nbstate; - goodness++; - } else { - badness++; - return 1; - } - return 5; - } - return 0; - } -}; - -class QWSPcMouseSubHandler_ms : public QWSPcMouseSubHandler_serial { - int mman; -public: - QWSPcMouseSubHandler_ms(int f) : QWSPcMouseSubHandler_serial(f) - { - mman=0; - init(); - } - - void init() - { - setflags(B1200|CS7); - // 60Hz - if (QT_WRITE(fd, "R", 1)!=1) { - badness = 100; - return; - } - if (tcflush(fd,TCIOFLUSH) == -1) { -#ifdef QWS_MOUSE_DEBUG - perror("QWSPcMouseSubHandler_ms: tcflush"); -#endif - } - } - - int tryData() - { - if (!(buffer[0] & 0x40)) { - if (buffer[0] == 0x20 && (bstate & Qt::MidButton)) { - mman=1; // mouseman extension - } - return 1; - } - int extra = mman&&(bstate & Qt::MidButton); - if (nbuf >= 3+extra) { - int nbstate = 0; - if (buffer[0] == 0x40 && !bstate && !buffer[1] && !buffer[2]) { - nbstate = Qt::MidButton; - } else { - nbstate = ((buffer[0] & 0x20) >> 5) - | ((buffer[0] & 0x10) >> 3); - if (extra && buffer[3] == 0x20) - nbstate = Qt::MidButton; - } - - if (buffer[1] & 0x40) { - badness++; - return 1; - } else { - motion += - QPoint((signed char)((buffer[0]&0x3)<<6) - |(signed char)(buffer[1]&0x3f), - (signed char)((buffer[0]&0xc)<<4) - |(signed char)(buffer[2]&0x3f)); - if (motion.x() || motion.y() || bstate != nbstate) { - bstate = nbstate; - goodness++; - } else { - badness++; - return 1; - } - return 3+extra; - } - } - return 0; - } -}; - -//=========================================================================== - -class QWSPcMouseHandlerPrivate : public QObject -{ - Q_OBJECT -public: - QWSPcMouseHandlerPrivate(QWSPcMouseHandler *h, const QString &, const QString &); - ~QWSPcMouseHandlerPrivate(); - - void suspend(); - void resume(); - -private: - enum { max_dev=32 }; - QWSPcMouseSubHandler *sub[max_dev]; - QList notifiers; - int nsub; - int retries; - -private slots: - void readMouseData(int); - -private: - void openDevices(); - void closeDevices(); - void notify(int fd); - bool sendEvent(QWSPcMouseSubHandler& h); - -private: - QWSPcMouseHandler *handler; - QString driver; - QString device; - qreal accel; - int accel_limit; -}; - -QWSPcMouseHandler::QWSPcMouseHandler(const QString &driver, const QString &device) - : QWSMouseHandler(driver, device) -{ - d = new QWSPcMouseHandlerPrivate(this, driver, device); -} - -QWSPcMouseHandler::~QWSPcMouseHandler() -{ - delete d; -} - -void QWSPcMouseHandler::suspend() -{ - d->suspend(); -} - -void QWSPcMouseHandler::resume() -{ - d->resume(); -} - - -QWSPcMouseHandlerPrivate::QWSPcMouseHandlerPrivate(QWSPcMouseHandler *h, - const QString &drv, const QString &arg) - : handler(h), driver(drv) -{ - QStringList args = arg.split(QLatin1Char(':'), QString::SkipEmptyParts); - - int index; - - accel = qreal(2.0); - QRegExp accelRegex(QLatin1String("^accel=(\\d+\\.?\\d*)$")); - index = args.indexOf(accelRegex); - if (index >= 0) { - accel = qreal(accelRegex.cap(1).toDouble()); - args.removeAt(index); - } - - accel_limit = 5; - QRegExp accelLimitRegex(QLatin1String("^accel_limit=(\\d+)$")); - index = args.indexOf(accelLimitRegex); - if (index >= 0) { - accel_limit = accelLimitRegex.cap(1).toInt(); - args.removeAt(index); - } - - device = args.join(QString()); - - retries = 0; - openDevices(); -} - -QWSPcMouseHandlerPrivate::~QWSPcMouseHandlerPrivate() -{ - closeDevices(); -} - -/* -QWSPcMouseHandler::UsageResult QWSPcMouseHandler::useDev(Dev& d) -{ - if (d.nbuf >= mouseData[d.protocol].bytesPerPacket) { - uchar *mb = d.buf; - int bstate = 0; - int dx = 0; - int dy = 0; - - switch (mouseProtocol) { - case MouseMan: - case IntelliMouse: - { - bstate = mb[0] & 0x7; // assuming Qt::*Button order - - int overflow = (mb[0]>>6)& 0x03; - if (mouseProtocol == MouseMan && overflow) { - //### wheel events signalled with overflow bit, ignore for now - } - else { - bool xs = mb[0] & 0x10; - bool ys = mb[0] & 0x20; - dx = xs ? mb[1]-256 : mb[1]; - dy = ys ? mb[2]-256 : mb[2]; - } - break; - } - case Microsoft: - if (((mb[0] & 0x20) >> 3)) { - bstate |= Qt::LeftButton; - } - if (((mb[0] & 0x10) >> 4)) { - bstate |= Qt::RightButton; - } - - dx=(signed char)(((mb[0] & 0x03) << 6) | (mb[1] & 0x3f)); - dy=-(signed char)(((mb[0] & 0x0c) << 4) | (mb[2] & 0x3f)); - - break; - } - } - } -*/ - - -bool QWSPcMouseHandlerPrivate::sendEvent(QWSPcMouseSubHandler& h) -{ - if (h.reliable()) { - QPoint motion = h.takeMotion(); - if (qAbs(motion.x()) > accel_limit || qAbs(motion.y()) > accel_limit) - motion *= accel; - QPoint newPos = handler->pos() + motion; - if (qt_screen->isTransformed()) { - QSize s = QSize(qt_screen->width(), qt_screen->height()); - newPos = qt_screen->mapToDevice(newPos, s); - } - handler->limitToScreen(newPos); - - handler->mouseChanged(newPos, h.buttonState(), h.takeWheel()); - return true; - } else { - h.takeMotion(); - if (h.buttonState() & (Qt::RightButton|Qt::MidButton)) { - // Strange for the user to press right or middle without - // a moving mouse! - h.worse(); - } - return false; - } -} - -void QWSPcMouseHandlerPrivate::openDevices() -{ - nsub=0; - int fd = -1; - - QString drv = driver.toLower(); - if (!drv.isEmpty() && drv != QLatin1String("auto")) { - // Manually specified mouse - QByteArray dev = device.toLatin1(); - if (drv == QLatin1String("intellimouse")) { - if (dev.isEmpty()) - dev = "/dev/psaux"; - fd = QT_OPEN(dev, O_RDWR | O_NDELAY); - if (fd >= 0) - sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd); - } else if (drv == QLatin1String("microsoft")) { - if (dev.isEmpty()) - dev = "/dev/ttyS0"; - fd = QT_OPEN(dev, O_RDWR | O_NDELAY); - if (fd >= 0) - sub[nsub++] = new QWSPcMouseSubHandler_ms(fd); - } else if (drv == QLatin1String("mousesystems")) { - if (dev.isEmpty()) - dev = "/dev/ttyS0"; - fd = QT_OPEN(dev, O_RDWR | O_NDELAY); - if (fd >= 0) - sub[nsub++] = new QWSPcMouseSubHandler_mousesystems(fd); - } else if (drv == QLatin1String("mouseman")) { - if (dev.isEmpty()) - dev = "/dev/psaux"; - fd = QT_OPEN(dev, O_RDWR | O_NDELAY); - if (fd >= 0) - sub[nsub++] = new QWSPcMouseSubHandler_mouseman(fd); - } - if (fd >= 0) - notify(fd); - else - qCritical("Error opening mouse device '%s': %s", - dev.constData(), strerror(errno)); - } else { - // Try automatically - fd = QT_OPEN("/dev/psaux", O_RDWR | O_NDELAY); - if (fd >= 0) { - sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd); - notify(fd); - } - fd = QT_OPEN("/dev/input/mice", O_RDWR | O_NDELAY); - if (fd >= 0) { - sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd); - notify(fd); - //qDebug("/dev/input/mice fd %d #%d", fd, nsub-1); - } - -// include the code below to auto-detect serial mice, and to mess up -// any sort of serial communication -#if 0 - const char fn[4][11] = { "/dev/ttyS0", "/dev/ttyS1", "/dev/ttyS2", "/dev/ttyS3" }; - for (int ch = 0; ch < 4; ++ch) { - fd = QT_OPEN(fn[ch], O_RDWR | O_NDELAY); - if (fd >= 0) { - //sub[nsub++] = new QWSPcMouseSubHandler_intellimouse(fd); - sub[nsub++] = new QWSPcMouseSubHandler_mousesystems(fd); - sub[nsub++] = new QWSPcMouseSubHandler_ms(fd); - notify(fd); - } - } -#endif - } -} - -void QWSPcMouseHandlerPrivate::closeDevices() -{ - int pfd=-1; - for (int i=0; icloseIfNot(pfd); - delete sub[i]; - } - qDeleteAll(notifiers); - notifiers.clear(); -} - -void QWSPcMouseHandlerPrivate::suspend() -{ - for (int i=0; isetEnabled(false); -} - -void QWSPcMouseHandlerPrivate::resume() -{ - for (int i=0; iinitState(); - - for (int i=0; isetEnabled(true); -} - - - -void QWSPcMouseHandlerPrivate::notify(int fd) -{ - QSocketNotifier *mouseNotifier - = new QSocketNotifier(fd, QSocketNotifier::Read, this); - connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData(int))); - notifiers.append(mouseNotifier); -} - -void QWSPcMouseHandlerPrivate::readMouseData(int fd) -{ - for (;;) { - uchar buf[8]; - int n = read(fd, buf, 8); - if (n<=0) - break; - for (int i=0; i - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_QWS_MOUSE_PC - -class QWSPcMouseHandlerPrivate; - -class QWSPcMouseHandler : public QWSMouseHandler -{ -public: - explicit QWSPcMouseHandler(const QString & = QString(), - const QString & = QString()); - ~QWSPcMouseHandler(); - - void suspend(); - void resume(); -protected: - QWSPcMouseHandlerPrivate *d; -}; - -#endif // QT_NO_QWS_MOUSE_PC - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMOUSEPC_QWS_H diff --git a/src/gui/embedded/qmouseqnx_qws.cpp b/src/gui/embedded/qmouseqnx_qws.cpp deleted file mode 100644 index a9647c0fff4..00000000000 --- a/src/gui/embedded/qmouseqnx_qws.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformdefs.h" -#include "qmouseqnx_qws.h" - -#include "qsocketnotifier.h" -#include "qdebug.h" - -#include - -#include - -QT_BEGIN_NAMESPACE - -/*! - \class QQnxMouseHandler - \preliminary - \ingroup qws - \internal - \since 4.6 - - \brief The QQnxMouseHandler class implements a mouse driver - for the QNX \c{devi-hid} input manager. - - To be able to compile this mouse handler, \l{Qt for Embedded Linux} - must be configured with the \c -qt-mouse-qnx option, see the - \l{Qt for Embedded Linux Pointer Handling}{Pointer Handling} documentation for details. - - In order to use this mouse handler, the \c{devi-hid} input manager - must be set up and run with the resource manager interface (option \c{-r}). - Also, Photon must not be running. - - Example invocation from command line: \c{/usr/photon/bin/devi-hid -Pr kbd mouse} - Note that after running \c{devi-hid}, you will not be able to use the local - shell anymore. It is suggested to run the command in a shell scrip, that launches - a Qt application after invocation of \c{devi-hid}. - - To make \l{Qt for Embedded Linux} explicitly choose the qnx mouse - handler, set the QWS_MOUSE_PROTO environment variable to \c{qnx}. By default, - the first mouse device (\c{/dev/devi/mouse0}) is used. To override, pass a device - name as the first and only parameter, for example - \c{QWS_MOUSE_PROTO=qnx:/dev/devi/mouse1; export QWS_MOUSE_PROTO}. - - \sa {Qt for Embedded Linux Pointer Handling}{Pointer Handling}, {Qt for Embedded Linux} -*/ - -/*! - Constructs a mouse handler for the specified \a device, defaulting to \c{/dev/devi/mouse0}. - The \a driver parameter must be \c{"qnx"}. - - Note that you should never instanciate this class, instead let QMouseDriverFactory - handle the mouse handlers. - - \sa QMouseDriverFactory - */ -QQnxMouseHandler::QQnxMouseHandler(const QString & /*driver*/, const QString &device) -{ - // open the mouse device with O_NONBLOCK so reading won't block when there's no data - mouseFD = QT_OPEN(device.isEmpty() ? "/dev/devi/mouse0" : device.toLatin1().constData(), - QT_OPEN_RDONLY | O_NONBLOCK); - if (mouseFD == -1) { - qErrnoWarning(errno, "QQnxMouseHandler: Unable to open mouse device"); - return; - } - - // register a socket notifier on the file descriptor so we'll wake up whenever - // there's a mouse move waiting for us. - mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this); - connect(mouseNotifier, SIGNAL(activated(int)), SLOT(socketActivated())); - - qDebug() << "QQnxMouseHandler: connected."; -} - -/*! - Destroys this mouse handler and closes the connection to the mouse device. - */ -QQnxMouseHandler::~QQnxMouseHandler() -{ - QT_CLOSE(mouseFD); -} - -/*! \reimp */ -void QQnxMouseHandler::resume() -{ - if (mouseNotifier) - mouseNotifier->setEnabled(true); -} - -/*! \reimp */ -void QQnxMouseHandler::suspend() -{ - if (mouseNotifier) - mouseNotifier->setEnabled(false); -} - -/*! \internal - - This function is called whenever there is activity on the mouse device. - By default, it reads up to 10 mouse move packets and calls mouseChanged() - for each of them. -*/ -void QQnxMouseHandler::socketActivated() -{ - // _mouse_packet is a QNX structure. devi-hid is nice enough to translate - // the raw byte data from mouse devices into generic format for us. - _mouse_packet packet; - - int iteration = 0; - - // read mouse events in batches of 10. Since we're getting quite a lot - // of mouse events, it's better to do them in batches than to return to the - // event loop every time. - do { - int bytesRead = QT_READ(mouseFD, &packet, sizeof(packet)); - if (bytesRead == -1) { - // EAGAIN means that there are no more mouse events to read - if (errno != EAGAIN) - qErrnoWarning(errno, "QQnxMouseHandler: Unable to read from socket"); - return; - } - - // bytes read should always be equal to the size of a packet. - Q_ASSERT(bytesRead == sizeof(packet)); - - // translate the coordinates from the QNX data structure to Qt coordinates - // note the swapped y axis - QPoint pos = mousePos; - pos += QPoint(packet.dx, -packet.dy); - - // QNX only tells us relative mouse movements, not absolute ones, so limit the - // cursor position manually to the screen - limitToScreen(pos); - - // translate the QNX mouse button bitmask to Qt buttons - int buttons = Qt::NoButton; - - if (packet.hdr.buttons & _POINTER_BUTTON_LEFT) - buttons |= Qt::LeftButton; - if (packet.hdr.buttons & _POINTER_BUTTON_MIDDLE) - buttons |= Qt::MidButton; - if (packet.hdr.buttons & _POINTER_BUTTON_RIGHT) - buttons |= Qt::RightButton; - - // call mouseChanged() - this does all the magic to actually move the on-screen - // mouse cursor. - mouseChanged(pos, buttons, 0); - } while (++iteration < 11); -} - -QT_END_NAMESPACE - diff --git a/src/gui/embedded/qmousetslib_qws.cpp b/src/gui/embedded/qmousetslib_qws.cpp deleted file mode 100644 index 5e2cce1d5ca..00000000000 --- a/src/gui/embedded/qmousetslib_qws.cpp +++ /dev/null @@ -1,371 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmousetslib_qws.h" - -#if !defined(QT_NO_QWS_MOUSE_TSLIB) || defined(QT_PLUGIN) - -#include -#include -#include "qsocketnotifier.h" -#include "qscreen_qws.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -#ifdef TSLIBMOUSEHANDLER_DEBUG -# include -#endif - -/*! - \internal - - \class QWSTslibMouseHandler - \ingroup qws - - \brief The QWSTslibMouseHandler class implements a mouse driver - for the Universal Touch Screen Library, tslib. - - QWSTslibMouseHandler inherits the QWSCalibratedMouseHandler class, - providing calibration and noise reduction functionality in - addition to generating mouse events, for devices using the - Universal Touch Screen Library. - - To be able to compile this mouse handler, \l{Qt for Embedded Linux} - must be configured with the \c -qt-mouse-tslib option, see the - \l{Pointer Handling} documentation for details. In addition, the tslib - headers and library must be present in the build environment. The - tslib sources can be downloaded from \l - {http://tslib.berlios.de/}. Use the \c -L and \c -I options - with \c configure to explicitly specify the location of the - library and its headers: - - \snippet doc/src/snippets/code/src_gui_embedded_qmousetslib_qws.cpp 0 - - In order to use this mouse handler, tslib must also be correctly - installed on the target machine. This includes providing a \c - ts.conf configuration file and setting the necessary environment - variables, see the README file provided with tslib for details. - - The ts.conf file will usually contain the following two lines - - \snippet doc/src/snippets/code/src_gui_embedded_qmousetslib_qws.cpp 1 - - To make \l{Qt for Embedded Linux} explicitly choose the tslib mouse - handler, set the QWS_MOUSE_PROTO environment variable. - - \sa {Pointer Handling}, {Qt for Embedded Linux} -*/ - -class QWSTslibMouseHandlerPrivate : public QObject -{ - Q_OBJECT -public: - QWSTslibMouseHandlerPrivate(QWSTslibMouseHandler *h, - const QString &device); - ~QWSTslibMouseHandlerPrivate(); - - void suspend(); - void resume(); - - void calibrate(const QWSPointerCalibrationData *data); - void clearCalibration(); - -private: - QWSTslibMouseHandler *handler; - struct tsdev *dev; - QSocketNotifier *mouseNotifier; - int jitter_limit; - - struct ts_sample lastSample; - bool wasPressed; - int lastdx; - int lastdy; - - bool calibrated; - QString devName; - - bool open(); - void close(); - inline bool get_sample(struct ts_sample *sample); - -private slots: - void readMouseData(); -}; - -QWSTslibMouseHandlerPrivate::QWSTslibMouseHandlerPrivate(QWSTslibMouseHandler *h, - const QString &device) - : handler(h), dev(0), mouseNotifier(0), jitter_limit(3) -{ - QStringList args = device.split(QLatin1Char(':'), QString::SkipEmptyParts); - QRegExp jitterRegex(QLatin1String("^jitter_limit=(\\d+)$")); - int index = args.indexOf(jitterRegex); - if (index >= 0) { - jitter_limit = jitterRegex.cap(1).toInt(); - args.removeAt(index); - } - - devName = args.join(QString()); - - if (devName.isNull()) { - const char *str = getenv("TSLIB_TSDEVICE"); - if (str) - devName = QString::fromLocal8Bit(str); - } - - if (devName.isNull()) - devName = QLatin1String("/dev/ts"); - - if (!open()) - return; - - calibrated = true; - - int fd = ts_fd(dev); - mouseNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); - connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); - resume(); -} - -QWSTslibMouseHandlerPrivate::~QWSTslibMouseHandlerPrivate() -{ - close(); -} - -bool QWSTslibMouseHandlerPrivate::open() -{ - dev = ts_open(devName.toLocal8Bit().constData(), 1); - if (!dev) { - qCritical("QWSTslibMouseHandlerPrivate: ts_open() failed" - " with error: '%s'", strerror(errno)); - qCritical("Please check your tslib installation!"); - return false; - } - - if (ts_config(dev)) { - qCritical("QWSTslibMouseHandlerPrivate: ts_config() failed" - " with error: '%s'", strerror(errno)); - qCritical("Please check your tslib installation!"); - close(); - return false; - } - - return true; -} - -void QWSTslibMouseHandlerPrivate::close() -{ - if (dev) - ts_close(dev); -} - -void QWSTslibMouseHandlerPrivate::suspend() -{ - if (mouseNotifier) - mouseNotifier->setEnabled(false); -} - -void QWSTslibMouseHandlerPrivate::resume() -{ - memset(&lastSample, 0, sizeof(lastSample)); - wasPressed = false; - lastdx = 0; - lastdy = 0; - if (mouseNotifier) - mouseNotifier->setEnabled(true); -} - -bool QWSTslibMouseHandlerPrivate::get_sample(struct ts_sample *sample) -{ - if (!calibrated) - return (ts_read_raw(dev, sample, 1) == 1); - - return (ts_read(dev, sample, 1) == 1); -} - -void QWSTslibMouseHandlerPrivate::readMouseData() -{ - if (!qt_screen) - return; - - for(;;) { - struct ts_sample sample = lastSample; - bool pressed = wasPressed; - - // Fast return if there's no events. - if (!get_sample(&sample)) - return; - pressed = (sample.pressure > 0); - - // Only return last sample unless there's a press/release event. - while (pressed == wasPressed) { - if (!get_sample(&sample)) - break; - pressed = (sample.pressure > 0); - } - - // work around missing coordinates on mouse release in raw mode - if (!calibrated && !pressed && sample.x == 0 && sample.y == 0) { - sample.x = lastSample.x; - sample.y = lastSample.y; - } - - int dx = sample.x - lastSample.x; - int dy = sample.y - lastSample.y; - - // Remove small movements in oppsite direction - if (dx * lastdx < 0 && qAbs(dx) < jitter_limit) { - sample.x = lastSample.x; - dx = 0; - } - if (dy * lastdy < 0 && qAbs(dy) < jitter_limit) { - sample.y = lastSample.y; - dy = 0; - } - - if (wasPressed == pressed && dx == 0 && dy == 0) - return; - -#ifdef TSLIBMOUSEHANDLER_DEBUG - qDebug() << "last" << QPoint(lastSample.x, lastSample.y) - << "curr" << QPoint(sample.x, sample.y) - << "dx,dy" << QPoint(dx, dy) - << "ddx,ddy" << QPoint(dx*lastdx, dy*lastdy) - << "pressed" << wasPressed << pressed; -#endif - - lastSample = sample; - wasPressed = pressed; - if (dx != 0) - lastdx = dx; - if (dy != 0) - lastdy = dy; - - const QPoint p(sample.x, sample.y); - if (calibrated) { - // tslib should do all the translation and filtering, so we send a - // "raw" mouse event - handler->QWSMouseHandler::mouseChanged(p, pressed); - } else { - handler->sendFiltered(p, pressed); - } - } -} - -void QWSTslibMouseHandlerPrivate::clearCalibration() -{ - suspend(); - close(); - handler->QWSCalibratedMouseHandler::clearCalibration(); - calibrated = false; - open(); - resume(); -} - -void QWSTslibMouseHandlerPrivate::calibrate(const QWSPointerCalibrationData *data) -{ - suspend(); - close(); - // default implementation writes to /etc/pointercal - // using the same format as the tslib linear module. - handler->QWSCalibratedMouseHandler::calibrate(data); - calibrated = true; - open(); - resume(); -} - -/*! - \internal -*/ -QWSTslibMouseHandler::QWSTslibMouseHandler(const QString &driver, - const QString &device) - : QWSCalibratedMouseHandler(driver, device) -{ - d = new QWSTslibMouseHandlerPrivate(this, device); -} - -/*! - \internal -*/ -QWSTslibMouseHandler::~QWSTslibMouseHandler() -{ - delete d; -} - -/*! - \reimp -*/ -void QWSTslibMouseHandler::suspend() -{ - d->suspend(); -} - -/*! - \reimp -*/ -void QWSTslibMouseHandler::resume() -{ - d->resume(); -} - -/*! - \reimp -*/ -void QWSTslibMouseHandler::clearCalibration() -{ - d->clearCalibration(); -} - -/*! - \reimp -*/ -void QWSTslibMouseHandler::calibrate(const QWSPointerCalibrationData *data) -{ - d->calibrate(data); -} - -QT_END_NAMESPACE - -#include "qmousetslib_qws.moc" - -#endif //QT_NO_QWS_MOUSE_TSLIB diff --git a/src/gui/embedded/qmousetslib_qws.h b/src/gui/embedded/qmousetslib_qws.h deleted file mode 100644 index dc0d07220ff..00000000000 --- a/src/gui/embedded/qmousetslib_qws.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMOUSETSLIB_QWS_H -#define QMOUSETSLIB_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if !defined(QT_NO_QWS_MOUSE_TSLIB) || defined(QT_PLUGIN) - -class QWSTslibMouseHandlerPrivate; - -class QWSTslibMouseHandler : public QWSCalibratedMouseHandler -{ -public: - explicit QWSTslibMouseHandler(const QString &driver = QString(), - const QString &device = QString()); - ~QWSTslibMouseHandler(); - - void suspend(); - void resume(); - - void calibrate(const QWSPointerCalibrationData *data); - void clearCalibration(); - -protected: - friend class QWSTslibMouseHandlerPrivate; - QWSTslibMouseHandlerPrivate *d; -}; - - -#endif // QT_NO_QWS_MOUSE_TSLIB -QT_END_NAMESPACE -QT_END_HEADER - -#endif // QMOUSETSLIB_QWS_H diff --git a/src/gui/embedded/qmousevfb_qws.cpp b/src/gui/embedded/qmousevfb_qws.cpp deleted file mode 100644 index 64f2a0e6306..00000000000 --- a/src/gui/embedded/qmousevfb_qws.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT_NO_QWS_MOUSE_QVFB - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include // overrides QT_OPEN - -QT_BEGIN_NAMESPACE - -QVFbMouseHandler::QVFbMouseHandler(const QString &driver, const QString &device) - : QObject(), QWSMouseHandler(driver, device) -{ - QString mouseDev = device; - if (device.isEmpty()) - mouseDev = QLatin1String("/dev/vmouse"); - - 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; - - mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this); - connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); -} - -QVFbMouseHandler::~QVFbMouseHandler() -{ - if (mouseFD >= 0) - QT_CLOSE(mouseFD); -} - -void QVFbMouseHandler::resume() -{ - mouseNotifier->setEnabled(true); -} - -void QVFbMouseHandler::suspend() -{ - mouseNotifier->setEnabled(false); -} - -void QVFbMouseHandler::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); -// limitToScreen(mousePos); - mouseChanged(mousePos, bstate, wheel); - idx += packetsize; - } - - int surplus = mouseIdx - idx; - for (int i = 0; i < surplus; i++) - mouseBuf[i] = mouseBuf[idx+i]; - mouseIdx = surplus; -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_MOUSE_QVFB diff --git a/src/gui/embedded/qmousevfb_qws.h b/src/gui/embedded/qmousevfb_qws.h deleted file mode 100644 index deea6bc437e..00000000000 --- a/src/gui/embedded/qmousevfb_qws.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMOUSEVFB_QWS_H -#define QMOUSEVFB_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_QWS_MOUSE_QVFB - -class QSocketNotifier; - -class QVFbMouseHandler : public QObject, public QWSMouseHandler { - Q_OBJECT -public: - QVFbMouseHandler(const QString &driver = QString(), - const QString &device = QString()); - ~QVFbMouseHandler(); - - void resume(); - void suspend(); - -private: - int mouseFD; - int mouseIdx; - enum {mouseBufSize = 128}; - uchar mouseBuf[mouseBufSize]; - QSocketNotifier *mouseNotifier; - -private Q_SLOTS: - void readMouseData(); -}; -#endif // QT_NO_QWS_MOUSE_QVFB - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMOUSEVFB_QWS_H diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp deleted file mode 100644 index 2c103574d40..00000000000 --- a/src/gui/embedded/qscreen_qws.cpp +++ /dev/null @@ -1,3347 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformdefs.h" -#include "qscreen_qws.h" - -#include "qcolormap.h" -#include "qscreendriverfactory_qws.h" -#include "qwindowsystem_qws.h" -#include "qwidget.h" -#include "qcolor.h" -#include "qpixmap.h" -#include "qvarlengtharray.h" -#include "qwsdisplay_qws.h" -#include "qpainter.h" -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -// #define QT_USE_MEMCPY_DUFF - -#ifndef QT_NO_QWS_CURSOR -Q_GUI_EXPORT QScreenCursor * qt_screencursor = 0; -#endif -Q_GUI_EXPORT QScreen * qt_screen = 0; - -ClearCacheFunc QScreen::clearCacheFunc = 0; - -#ifndef QT_NO_QWS_CURSOR -/*! - \class QScreenCursor - \ingroup qws - - \brief The QScreenCursor class is a base class for screen cursors - in Qt for Embedded Linux. - - Note that this class is non-portable, and that it is only - available in \l{Qt for Embedded Linux}. - - QScreenCursor implements a software cursor, but can be subclassed - to support hardware cursors as well. When deriving from the - QScreenCursor class it is important to maintain the cursor's - image, position, hot spot (the point within the cursor's image - that will be the position of the associated mouse events) and - visibility as well as informing whether it is hardware accelerated - or not. - - Note that there may only be one screen cursor at a time. Use the - static instance() function to retrieve a pointer to the current - screen cursor. Typically, the cursor is constructed by the QScreen - class or one of its descendants when it is initializing the - device; the QScreenCursor class should never be instantiated - explicitly. - - Use the move() function to change the position of the cursor, and - the set() function to alter its image or its hot spot. In - addition, you can find out whether the cursor is accelerated or - not, using the isAccelerated() function, and the boundingRect() - function returns the cursor's bounding rectangle. - - The cursor's appearance can be controlled using the isVisible(), - hide() and show() functions; alternatively the QWSServer class - provides some means of controlling the cursor's appearance using - the QWSServer::isCursorVisible() and QWSServer::setCursorVisible() - functions. - - \sa QScreen, QWSServer -*/ - -/*! - \fn static QScreenCursor* QScreenCursor::instance() - \since 4.2 - - Returns a pointer to the application's unique screen cursor. -*/ - -/*! - Constructs a screen cursor -*/ -QScreenCursor::QScreenCursor() -{ - pos = QPoint(qt_screen->deviceWidth()/2, qt_screen->deviceHeight()/2); - size = QSize(0,0); - enable = true; - hwaccel = false; - supportsAlpha = true; -} - -/*! - Destroys the screen cursor. -*/ -QScreenCursor::~QScreenCursor() -{ -} - -/*! - Hides the cursor from the screen. - - \sa show() -*/ -void QScreenCursor::hide() -{ - if (enable) { - enable = false; - if (!hwaccel) - qt_screen->exposeRegion(boundingRect(), 0); - } -} - -/*! - Shows the mouse cursor. - - \sa hide() -*/ -void QScreenCursor::show() -{ - if (!enable) { - enable = true; - if (!hwaccel) - qt_screen->exposeRegion(boundingRect(), 0); - } -} - -/*! - Sets the cursor's image to be the given \a image. - - The \a hotx and \a hoty parameters define the cursor's hot spot, - i.e., the point within the cursor's image that will be the - position of the associated mouse events. - - \sa move() -*/ -void QScreenCursor::set(const QImage &image, int hotx, int hoty) -{ - const QRect r = boundingRect(); - - hotspot = QPoint(hotx, hoty); - // These are in almost all cases the fastest formats to blend - QImage::Format f; - switch (qt_screen->depth()) { - case 12: - f = QImage::Format_ARGB4444_Premultiplied; - break; - case 15: - f = QImage::Format_ARGB8555_Premultiplied; - break; - case 16: - f = QImage::Format_ARGB8565_Premultiplied; - break; - case 18: - f = QImage::Format_ARGB6666_Premultiplied; - break; - default: - f = QImage::Format_ARGB32_Premultiplied; - } - - cursor = image.convertToFormat(f); - - size = image.size(); - - if (enable && !hwaccel) - qt_screen->exposeRegion(r | boundingRect(), 0); -} - -/*! - Moves the mouse cursor to the given position, i.e., (\a x, \a y). - - Note that the given position defines the top-left corner of the - cursor's image, i.e., not the cursor's hot spot (the position of - the associated mouse events). - - \sa set() -*/ -void QScreenCursor::move(int x, int y) -{ - QRegion r = boundingRect(); - pos = QPoint(x,y); - if (enable && !hwaccel) { - r |= boundingRect(); - qt_screen->exposeRegion(r, 0); - } -} - - -/*! - \fn void QScreenCursor::initSoftwareCursor () - - Initializes the screen cursor. - - This function is typically called from the screen driver when - initializing the device. Alternatively, the cursor can be set - directly using the pointer returned by the static instance() - function. - - \sa QScreen::initDevice() -*/ -void QScreenCursor::initSoftwareCursor() -{ - qt_screencursor = new QScreenCursor; -} - - -#endif // QT_NO_QWS_CURSOR - - -/*! - \fn QRect QScreenCursor::boundingRect () const - - Returns the cursor's bounding rectangle. -*/ - -/*! - \internal - \fn bool QScreenCursor::enabled () -*/ - -/*! - \fn QImage QScreenCursor::image () const - - Returns the cursor's image. -*/ - - -/*! - \fn bool QScreenCursor::isAccelerated () const - - Returns true if the cursor is accelerated; otherwise false. -*/ - -/*! - \fn bool QScreenCursor::isVisible () const - - Returns true if the cursor is visible; otherwise false. -*/ - -/*! - \internal - \fn bool QScreenCursor::supportsAlphaCursor () const -*/ - -/* - \variable QScreenCursor::cursor - - \brief the cursor's image. - - \sa image() -*/ - -/* - \variable QScreenCursor::size - - \brief the cursor's size -*/ - -/* - \variable QScreenCursor::pos - - \brief the cursor's position, i.e., the position of the top-left - corner of the crsor's image - - \sa set(), move() -*/ - -/* - \variable QScreenCursor::hotspot - - \brief the cursor's hotspot, i.e., the point within the cursor's - image that will be the position of the associated mouse events. - - \sa set(), move() -*/ - -/* - \variable QScreenCursor::enable - - \brief whether the cursor is visible or not - - \sa isVisible() -*/ - -/* - \variable QScreenCursor::hwaccel - - \brief holds whether the cursor is accelerated or not - - If the cursor is not accelerated, its image will be included by - the screen when it composites the window surfaces. - - \sa isAccelerated() - -*/ - -/* - \variable QScreenCursor::supportsAlpha -*/ - -/*! - \internal - \macro qt_screencursor - \relates QScreenCursor - - A global pointer referring to the unique screen cursor. It is - equivalent to the pointer returned by the - QScreenCursor::instance() function. -*/ - - - -class QScreenPrivate -{ -public: - QScreenPrivate(QScreen *parent, QScreen::ClassId id = QScreen::CustomClass); - ~QScreenPrivate(); - - inline QImage::Format preferredImageFormat() const; - - typedef void (*SolidFillFunc)(QScreen*, const QColor&, const QRegion&); - typedef void (*BlitFunc)(QScreen*, const QImage&, const QPoint&, const QRegion&); - - SolidFillFunc solidFill; - BlitFunc blit; - - QPoint offset; - QList subScreens; - QPixmapDataFactory* pixmapFactory; - QGraphicsSystem* graphicsSystem; - QWSGraphicsSystem defaultGraphicsSystem; //### - QImage::Format pixelFormat; -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - bool fb_is_littleEndian; -#endif -#ifdef QT_QWS_CLIENTBLIT - bool supportsBlitInClients; -#endif - int classId; - QScreen *q_ptr; -}; - -template -static void solidFill_template(QScreen *screen, const QColor &color, - const QRegion ®ion) -{ - T *dest = reinterpret_cast(screen->base()); - const T c = qt_colorConvert(color.rgba(), 0); - const int stride = screen->linestep(); - const QVector rects = region.rects(); - - for (int i = 0; i < rects.size(); ++i) { - const QRect r = rects.at(i); - qt_rectfill(dest, c, r.x(), r.y(), r.width(), r.height(), stride); - } -} - -#ifdef QT_QWS_DEPTH_GENERIC -static void solidFill_rgb_32bpp(QScreen *screen, const QColor &color, - const QRegion ®ion) -{ - quint32 *dest = reinterpret_cast(screen->base()); - const quint32 c = qt_convertToRgb(color.rgba()); - - const int stride = screen->linestep(); - const QVector rects = region.rects(); - - for (int i = 0; i < rects.size(); ++i) { - const QRect r = rects.at(i); - qt_rectfill(dest, c, r.x(), r.y(), r.width(), r.height(), stride); - } -} - -static void solidFill_rgb_16bpp(QScreen *screen, const QColor &color, - const QRegion ®ion) -{ - quint16 *dest = reinterpret_cast(screen->base()); - const quint16 c = qt_convertToRgb(color.rgba()); - - const int stride = screen->linestep(); - const QVector rects = region.rects(); - - for (int i = 0; i < rects.size(); ++i) { - const QRect r = rects.at(i); - qt_rectfill(dest, c, r.x(), r.y(), r.width(), r.height(), stride); - } -} -#endif // QT_QWS_DEPTH_GENERIC - -#ifdef QT_QWS_DEPTH_4 -static inline void qt_rectfill_gray4(quint8 *dest, quint8 value, - int x, int y, int width, int height, - int stride) -{ - const int pixelsPerByte = 2; - dest += y * stride + x / pixelsPerByte; - const int doAlign = x & 1; - const int doTail = (width - doAlign) & 1; - const int width8 = (width - doAlign) / pixelsPerByte; - - for (int j = 0; j < height; ++j) { - if (doAlign) - *dest = (*dest & 0xf0) | (value & 0x0f); - if (width8) - qt_memfill(dest + doAlign, value, width8); - if (doTail) { - quint8 *d = dest + doAlign + width8; - *d = (*d & 0x0f) | (value & 0xf0); - } - dest += stride; - } -} - -static void solidFill_gray4(QScreen *screen, const QColor &color, - const QRegion ®ion) -{ - quint8 *dest = reinterpret_cast(screen->base()); - const quint8 c = qGray(color.rgba()) >> 4; - const quint8 c8 = (c << 4) | c; - - const int stride = screen->linestep(); - const QVector rects = region.rects(); - - for (int i = 0; i < rects.size(); ++i) { - const QRect r = rects.at(i); - qt_rectfill_gray4(dest, c8, r.x(), r.y(), r.width(), r.height(), - stride); - } -} -#endif // QT_QWS_DEPTH_4 - -#ifdef QT_QWS_DEPTH_1 -static inline void qt_rectfill_mono(quint8 *dest, quint8 value, - int x, int y, int width, int height, - int stride) -{ - const int pixelsPerByte = 8; - const int alignWidth = qMin(width, (8 - (x & 7)) & 7); - const int doAlign = (alignWidth > 0 ? 1 : 0); - const int alignStart = pixelsPerByte - 1 - (x & 7); - const int alignStop = alignStart - (alignWidth - 1); - const quint8 alignMask = ((1 << alignWidth) - 1) << alignStop; - const int tailWidth = (width - alignWidth) & 7; - const int doTail = (tailWidth > 0 ? 1 : 0); - const quint8 tailMask = (1 << (pixelsPerByte - tailWidth)) - 1; - const int width8 = (width - alignWidth) / pixelsPerByte; - - dest += y * stride + x / pixelsPerByte; - stride -= (doAlign + width8); - - for (int j = 0; j < height; ++j) { - if (doAlign) { - *dest = (*dest & ~alignMask) | (value & alignMask); - ++dest; - } - if (width8) { - qt_memfill(dest, value, width8); - dest += width8; - } - if (doTail) - *dest = (*dest & tailMask) | (value & ~tailMask); - dest += stride; - } -} - -static void solidFill_mono(QScreen *screen, const QColor &color, - const QRegion ®ion) -{ - quint8 *dest = reinterpret_cast(screen->base()); - const quint8 c8 = (qGray(color.rgba()) >> 7) * 0xff; - - const int stride = screen->linestep(); - const QVector rects = region.rects(); - - for (int i = 0; i < rects.size(); ++i) { - const QRect r = rects.at(i); - qt_rectfill_mono(dest, c8, r.x(), r.y(), r.width(), r.height(), - stride); - } -} -#endif // QT_QWS_DEPTH_1 - -void qt_solidFill_setup(QScreen *screen, const QColor &color, - const QRegion ®ion) -{ - switch (screen->depth()) { -#ifdef QT_QWS_DEPTH_32 - case 32: - if (screen->pixelType() == QScreen::NormalPixel) - screen->d_ptr->solidFill = solidFill_template; - else - screen->d_ptr->solidFill = solidFill_template; - break; -#endif -#ifdef QT_QWS_DEPTH_24 - case 24: - if (screen->pixelType() == QScreen::NormalPixel) - screen->d_ptr->solidFill = solidFill_template; - else - screen->d_ptr->solidFill = solidFill_template; - break; -#endif -#ifdef QT_QWS_DEPTH_18 - case 18: - screen->d_ptr->solidFill = solidFill_template; - break; -#endif -#ifdef QT_QWS_DEPTH_16 - case 16: - if (screen->pixelType() == QScreen::NormalPixel) - screen->d_ptr->solidFill = solidFill_template; - else - screen->d_ptr->solidFill = solidFill_template; - break; -#endif -#ifdef QT_QWS_DEPTH_15 - case 15: - if (screen->pixelType() == QScreen::NormalPixel) - screen->d_ptr->solidFill = solidFill_template; - else - screen->d_ptr->solidFill = solidFill_template; - break; -#endif -#ifdef QT_QWS_DEPTH_12 - case 12: - screen->d_ptr->solidFill = solidFill_template; - break; -#endif -#ifdef QT_QWS_DEPTH_8 - case 8: - screen->d_ptr->solidFill = solidFill_template; - break; -#endif -#ifdef QT_QWS_DEPTH_4 - case 4: - screen->d_ptr->solidFill = solidFill_gray4; - break; -#endif -#ifdef QT_QWS_DEPTH_1 - case 1: - screen->d_ptr->solidFill = solidFill_mono; - break; -#endif - default: - qFatal("solidFill_setup(): Screen depth %d not supported!", - screen->depth()); - screen->d_ptr->solidFill = 0; - break; - } - screen->d_ptr->solidFill(screen, color, region); -} - -template -static void blit_template(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - DST *dest = reinterpret_cast(screen->base()); - const int screenStride = screen->linestep(); - const int imageStride = image.bytesPerLine(); - - if (region.rectCount() == 1) { - const QRect r = region.boundingRect(); - const SRC *src = reinterpret_cast(image.scanLine(r.y())) - + r.x(); - qt_rectconvert(dest, src, - r.x() + topLeft.x(), r.y() + topLeft.y(), - r.width(), r.height(), - screenStride, imageStride); - } else { - const QVector rects = region.rects(); - - for (int i = 0; i < rects.size(); ++i) { - const QRect r = rects.at(i); - const SRC *src = reinterpret_cast(image.scanLine(r.y())) - + r.x(); - qt_rectconvert(dest, src, - r.x() + topLeft.x(), r.y() + topLeft.y(), - r.width(), r.height(), - screenStride, imageStride); - } - } -} - -#ifdef QT_QWS_DEPTH_32 -static void blit_32(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - blit_template(screen, image, topLeft, region); - return; -#ifdef QT_QWS_DEPTH_16 - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; -#endif - default: - qCritical("blit_32(): Image format %d not supported!", image.format()); - } -} -#endif // QT_QWS_DEPTH_32 - -#ifdef QT_QWS_DEPTH_24 -static void blit_24(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB888: - blit_template(screen, image, topLeft, region); - return; -#ifdef QT_QWS_DEPTH_16 - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; -#endif - default: - qCritical("blit_24(): Image format %d not supported!", image.format()); - } -} - -static void blit_qrgb888(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB888: - blit_template(screen, image, topLeft, region); - return; -#ifdef QT_QWS_DEPTH_16 - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; -#endif - default: - qCritical("blit_24(): Image format %d not supported!", image.format()); - break; - } -} -#endif // QT_QWS_DEPTH_24 - -#ifdef QT_QWS_DEPTH_18 -static void blit_18(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB666: - blit_template(screen, image, topLeft, region); - return; -#ifdef QT_QWS_DEPTH_16 - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; -#endif - default: - qCritical("blit_18(): Image format %d not supported!", image.format()); - } -} -#endif // QT_QWS_DEPTH_18 - -#if (Q_BYTE_ORDER == Q_BIG_ENDIAN) && (defined(QT_QWS_DEPTH_16) || defined(QT_QWS_DEPTH_15)) -class quint16LE -{ -public: - inline quint16LE(quint32 v) { - data = ((v & 0xff00) >> 8) | ((v & 0x00ff) << 8); - } - - inline quint16LE(int v) { - data = ((v & 0xff00) >> 8) | ((v & 0x00ff) << 8); - } - - inline quint16LE(quint16 v) { - data = ((v & 0xff00) >> 8) | ((v & 0x00ff) << 8); - } - - inline quint16LE(qrgb555 v) { - data = (( (quint16)v & 0xff00) >> 8) | - (( (quint16)v & 0x00ff) << 8); - } - - inline bool operator==(const quint16LE &v) const - { - return data == v.data; - } - -private: - quint16 data; -}; -#endif - -#ifdef QT_QWS_DEPTH_16 -static void blit_16(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - // ### This probably doesn't work but it's a case which should never happen - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; - default: - qCritical("blit_16(): Image format %d not supported!", image.format()); - } -} - -#if Q_BYTE_ORDER == Q_BIG_ENDIAN -static void blit_16_bigToLittleEndian(QScreen *screen, const QImage &image, - const QPoint &topLeft, - const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; - default: - qCritical("blit_16_bigToLittleEndian(): Image format %d not supported!", image.format()); - } -} - -#endif // Q_BIG_ENDIAN -#endif // QT_QWS_DEPTH_16 - -#ifdef QT_QWS_DEPTH_15 -static void blit_15(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB555: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; - default: - qCritical("blit_15(): Image format %d not supported!", image.format()); - } -} - -#if Q_BYTE_ORDER == Q_BIG_ENDIAN -static void blit_15_bigToLittleEndian(QScreen *screen, const QImage &image, - const QPoint &topLeft, - const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_RGB555: - blit_template(screen, image, topLeft, region); - return; - default: - qCritical("blit_15_bigToLittleEndian(): Image format %d not supported!", image.format()); - } -} -#endif // Q_BIG_ENDIAN -#endif // QT_QWS_DEPTH_15 - - -#ifdef QT_QWS_DEPTH_12 -static void blit_12(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_ARGB4444_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB444: - blit_template(screen, image, topLeft, region); - return; - default: - qCritical("blit_12(): Image format %d not supported!", image.format()); - } -} -#endif // QT_QWS_DEPTH_12 - -#ifdef QT_QWS_DEPTH_8 -static void blit_8(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_ARGB4444_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB444: - blit_template(screen, image, topLeft, region); - return; - default: - qCritical("blit_8(): Image format %d not supported!", image.format()); - } -} -#endif // QT_QWS_DEPTH_8 - -#ifdef QT_QWS_DEPTH_4 - -struct qgray4 { quint8 dummy; } Q_PACKED; - -template -Q_STATIC_TEMPLATE_FUNCTION inline quint8 qt_convertToGray4(SRC color); - -template <> -inline quint8 qt_convertToGray4(quint32 color) -{ - return qGray(color) >> 4; -} - -template <> -inline quint8 qt_convertToGray4(quint16 color) -{ - const int r = (color & 0xf800) >> 11; - const int g = (color & 0x07e0) >> 6; // only keep 5 bit - const int b = (color & 0x001f); - return (r * 11 + g * 16 + b * 5) >> 6; -} - -template <> -inline quint8 qt_convertToGray4(qrgb444 color) -{ - return qt_convertToGray4(quint32(color)); -} - -template <> -inline quint8 qt_convertToGray4(qargb4444 color) -{ - return qt_convertToGray4(quint32(color)); -} - -template -Q_STATIC_TEMPLATE_FUNCTION inline void qt_rectconvert_gray4(qgray4 *dest4, const SRC *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - const int pixelsPerByte = 2; - quint8 *dest8 = reinterpret_cast(dest4) - + y * dstStride + x / pixelsPerByte; - const int doAlign = x & 1; - const int doTail = (width - doAlign) & 1; - const int width8 = (width - doAlign) / pixelsPerByte; - const int count8 = (width8 + 3) / 4; - - srcStride = srcStride / sizeof(SRC) - width; - dstStride -= (width8 + doAlign); - - for (int i = 0; i < height; ++i) { - if (doAlign) { - *dest8 = (*dest8 & 0xf0) | qt_convertToGray4(*src++); - ++dest8; - } - if (count8) { - int n = count8; - switch (width8 & 0x03) // duff's device - { - case 0: do { *dest8++ = qt_convertToGray4(src[0]) << 4 - | qt_convertToGray4(src[1]); - src += 2; - case 3: *dest8++ = qt_convertToGray4(src[0]) << 4 - | qt_convertToGray4(src[1]); - src += 2; - case 2: *dest8++ = qt_convertToGray4(src[0]) << 4 - | qt_convertToGray4(src[1]); - src += 2; - case 1: *dest8++ = qt_convertToGray4(src[0]) << 4 - | qt_convertToGray4(src[1]); - src += 2; - } while (--n > 0); - } - } - - if (doTail) - *dest8 = qt_convertToGray4(*src++) << 4 | (*dest8 & 0x0f); - - dest8 += dstStride; - src += srcStride; - } -} - -template <> -void qt_rectconvert(qgray4 *dest, const quint32 *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - qt_rectconvert_gray4(dest, src, x, y, width, height, - dstStride, srcStride); -} - -template <> -void qt_rectconvert(qgray4 *dest, const quint16 *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - qt_rectconvert_gray4(dest, src, x, y, width, height, - dstStride, srcStride); -} - -template <> -void qt_rectconvert(qgray4 *dest, const qrgb444 *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - qt_rectconvert_gray4(dest, src, x, y, width, height, - dstStride, srcStride); -} - -template <> -void qt_rectconvert(qgray4 *dest, const qargb4444 *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - qt_rectconvert_gray4(dest, src, x, y, width, height, - dstStride, srcStride); -} - -static void blit_4(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_ARGB32_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB444: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_ARGB4444_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - default: - qCritical("blit_4(): Image format %d not supported!", image.format()); - } -} -#endif // QT_QWS_DEPTH_4 - -#ifdef QT_QWS_DEPTH_1 - -struct qmono { quint8 dummy; } Q_PACKED; - -template -Q_STATIC_TEMPLATE_FUNCTION inline quint8 qt_convertToMono(SRC color); - -template <> -inline quint8 qt_convertToMono(quint32 color) -{ - return qGray(color) >> 7; -} - -template <> -inline quint8 qt_convertToMono(quint16 color) -{ - return (qGray(qt_colorConvert(color, 0)) >> 7); -} - -template <> -inline quint8 qt_convertToMono(qargb4444 color) -{ - return (qGray(quint32(color)) >> 7); -} - -template <> -inline quint8 qt_convertToMono(qrgb444 color) -{ - return (qGray(quint32(color)) >> 7); -} - -template -inline void qt_rectconvert_mono(qmono *dest, const SRC *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - const int pixelsPerByte = 8; - quint8 *dest8 = reinterpret_cast(dest) - + y * dstStride + x / pixelsPerByte; - const int alignWidth = qMin(width, (8 - (x & 7)) & 7); - const int doAlign = (alignWidth > 0 ? 1 : 0); - const int alignStart = pixelsPerByte - 1 - (x & 7); - const int alignStop = alignStart - (alignWidth - 1); - const quint8 alignMask = ((1 << alignWidth) - 1) << alignStop; - const int tailWidth = (width - alignWidth) & 7; - const int doTail = (tailWidth > 0 ? 1 : 0); - const quint8 tailMask = (1 << (pixelsPerByte - tailWidth)) - 1; - const int width8 = (width - alignWidth) / pixelsPerByte; - - srcStride = srcStride / sizeof(SRC) - (width8 * 8 + alignWidth); - dstStride -= (width8 + doAlign); - - for (int j = 0; j < height; ++j) { - if (doAlign) { - quint8 d = *dest8 & ~alignMask; - for (int i = alignStart; i >= alignStop; --i) - d |= qt_convertToMono(*src++) << i; - *dest8++ = d; - } - for (int i = 0; i < width8; ++i) { - *dest8 = (qt_convertToMono(src[0]) << 7) - | (qt_convertToMono(src[1]) << 6) - | (qt_convertToMono(src[2]) << 5) - | (qt_convertToMono(src[3]) << 4) - | (qt_convertToMono(src[4]) << 3) - | (qt_convertToMono(src[5]) << 2) - | (qt_convertToMono(src[6]) << 1) - | (qt_convertToMono(src[7])); - src += 8; - ++dest8; - } - if (doTail) { - quint8 d = *dest8 & tailMask; - switch (tailWidth) { - case 7: d |= qt_convertToMono(src[6]) << 1; - case 6: d |= qt_convertToMono(src[5]) << 2; - case 5: d |= qt_convertToMono(src[4]) << 3; - case 4: d |= qt_convertToMono(src[3]) << 4; - case 3: d |= qt_convertToMono(src[2]) << 5; - case 2: d |= qt_convertToMono(src[1]) << 6; - case 1: d |= qt_convertToMono(src[0]) << 7; - } - *dest8 = d; - } - - dest8 += dstStride; - src += srcStride; - } -} - -template <> -void qt_rectconvert(qmono *dest, const quint32 *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - qt_rectconvert_mono(dest, src, x, y, width, height, - dstStride, srcStride); -} - -template <> -void qt_rectconvert(qmono *dest, const quint16 *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - qt_rectconvert_mono(dest, src, x, y, width, height, - dstStride, srcStride); -} - -template <> -void qt_rectconvert(qmono *dest, const qrgb444 *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - qt_rectconvert_mono(dest, src, x, y, width, height, - dstStride, srcStride); -} - -template <> -void qt_rectconvert(qmono *dest, const qargb4444 *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - qt_rectconvert_mono(dest, src, x, y, width, height, - dstStride, srcStride); -} - -static void blit_1(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_ARGB32_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB444: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_ARGB4444_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - default: - qCritical("blit_1(): Image format %d not supported!", image.format()); - } -} -#endif // QT_QWS_DEPTH_1 - -#ifdef QT_QWS_DEPTH_GENERIC - -static void blit_rgb(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (image.format()) { - case QImage::Format_ARGB32_Premultiplied: - blit_template(screen, image, topLeft, region); - return; - case QImage::Format_RGB16: - blit_template(screen, image, topLeft, region); - return; - default: - qCritical("blit_rgb(): Image format %d not supported!", image.format()); - } -} - -void qt_set_generic_blit(QScreen *screen, int bpp, - int len_red, int len_green, int len_blue, int len_alpha, - int off_red, int off_green, int off_blue, int off_alpha) -{ - qrgb::bpp = bpp / 8; - qrgb::len_red = len_red; - qrgb::len_green = len_green; - qrgb::len_blue = len_blue; - qrgb::len_alpha = len_alpha; - qrgb::off_red = off_red; - qrgb::off_green = off_green; - qrgb::off_blue = off_blue; - qrgb::off_alpha = off_alpha; - screen->d_ptr->blit = blit_rgb; - if (bpp == 16) - screen->d_ptr->solidFill = solidFill_rgb_16bpp; - else if (bpp == 32) - screen->d_ptr->solidFill = solidFill_rgb_32bpp; -} - -#endif // QT_QWS_DEPTH_GENERIC - -void qt_blit_setup(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion) -{ - switch (screen->depth()) { -#ifdef QT_QWS_DEPTH_32 - case 32: - if (screen->pixelType() == QScreen::NormalPixel) - screen->d_ptr->blit = blit_32; - else - screen->d_ptr->blit = blit_template; - break; -#endif -#ifdef QT_QWS_DEPTH_24 - case 24: - if (screen->pixelType() == QScreen::NormalPixel) - screen->d_ptr->blit = blit_qrgb888; - else - screen->d_ptr->blit = blit_24; - break; -#endif -#ifdef QT_QWS_DEPTH_18 - case 18: - screen->d_ptr->blit = blit_18; - break; -#endif -#ifdef QT_QWS_DEPTH_16 - case 16: -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - if (screen->d_ptr->fb_is_littleEndian) - screen->d_ptr->blit = blit_16_bigToLittleEndian; - else -#endif - if (screen->pixelType() == QScreen::NormalPixel) - screen->d_ptr->blit = blit_16; - else - screen->d_ptr->blit = blit_template; - break; -#endif -#ifdef QT_QWS_DEPTH_15 - case 15: -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - if (screen->d_ptr->fb_is_littleEndian) - screen->d_ptr->blit = blit_15_bigToLittleEndian; - else -#endif // Q_BIG_ENDIAN - if (screen->pixelType() == QScreen::NormalPixel) - screen->d_ptr->blit = blit_15; - else - screen->d_ptr->blit = blit_template; - break; -#endif -#ifdef QT_QWS_DEPTH_12 - case 12: - screen->d_ptr->blit = blit_12; - break; -#endif -#ifdef QT_QWS_DEPTH_8 - case 8: - screen->d_ptr->blit = blit_8; - break; -#endif -#ifdef QT_QWS_DEPTH_4 - case 4: - screen->d_ptr->blit = blit_4; - break; -#endif -#ifdef QT_QWS_DEPTH_1 - case 1: - screen->d_ptr->blit = blit_1; - break; -#endif - default: - qFatal("blit_setup(): Screen depth %d not supported!", - screen->depth()); - screen->d_ptr->blit = 0; - break; - } - screen->d_ptr->blit(screen, image, topLeft, region); -} - -QScreenPrivate::QScreenPrivate(QScreen *parent, QScreen::ClassId id) - : defaultGraphicsSystem(QWSGraphicsSystem(parent)), - pixelFormat(QImage::Format_Invalid), -#ifdef QT_QWS_CLIENTBLIT - supportsBlitInClients(false), -#endif - classId(id), q_ptr(parent) -{ - solidFill = qt_solidFill_setup; - blit = qt_blit_setup; -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - fb_is_littleEndian = false; -#endif - pixmapFactory = 0; - graphicsSystem = &defaultGraphicsSystem; -} - -QScreenPrivate::~QScreenPrivate() -{ -} - -QImage::Format QScreenPrivate::preferredImageFormat() const -{ - if (pixelFormat > QImage::Format_Indexed8) - return pixelFormat; - - if (q_ptr->depth() <= 16) - return QImage::Format_RGB16; - else - return QImage::Format_ARGB32_Premultiplied; -} - -/*! - \class QScreen - \ingroup qws - - \brief The QScreen class is a base class for screen drivers in - Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - \l{Qt for Embedded Linux} provides ready-made drivers for several screen - protocols, see the \l{Qt for Embedded Linux Display Management}{display - management} documentation for details. Custom screen drivers can - be implemented by subclassing the QScreen class and creating a - screen driver plugin (derived from QScreenDriverPlugin). The - default implementation of the QScreenDriverFactory class - will automatically detect the plugin, and load the driver into the - server application at run-time using Qt's \l {How to Create Qt - Plugins}{plugin system}. - - When rendering, the default behavior is for each - client to render its widgets as well as its decorations into - memory, while the server copies the memory content to the device's - framebuffer using the screen driver. See the \l{Qt for Embedded Linux - Architecture} overview for details (note that it is possible for - the clients to manipulate and control the underlying hardware - directly as well). - - Starting with Qt 4.2, it is also possible to add an - accelerated graphics driver to take advantage of available - hardware resources. See the \l{Adding an Accelerated Graphics - Driver to Qt for Embedded Linux} documentation for details. - - \tableofcontents - - \section1 Framebuffer Management - - When a \l{Qt for Embedded Linux} application starts running, it - calls the screen driver's connect() function to map the - framebuffer and the accelerated drivers that the graphics card - control registers. The connect() function should then read out the - parameters of the framebuffer and use them as required to set this - class's protected variables. - - The initDevice() function can be reimplemented to initialize the - graphics card. Note, however, that connect() is called \e before - the initDevice() function, so, for some hardware configurations, - some of the initialization that would normally be done in the - initDevice() function might have to be done in the connect() - function. - - Likewise, just before a \l{Qt for Embedded Linux} application - exits, it calls the screen driver's disconnect() function. The - server application will in addition call the shutdownDevice() - function before it calls disconnect(). Note that the default - implementation of the shutdownDevice() function only hides the - mouse cursor. - - QScreen also provides the save() and restore() functions, making - it possible to save and restore the state of the graphics - card. Note that the default implementations do nothing. Hardware - screen drivers should reimplement these functions to save (and - restore) its registers, enabling switching between virtual - consoles. - - In addition, you can use the base() function to retrieve a pointer - to the beginning of the framebuffer, and the region() function to - retrieve the framebuffer's region. Use the onCard() function to - determine whether the framebuffer is within the graphics card's - memory, and the totalSize() function to determine the size of the - available graphics card memory (including the screen). Finally, - you can use the offset() function to retrieve the offset between - the framebuffer's coordinates and the application's coordinate - system. - - \section1 Palette Management - - QScreen provides several functions to retrieve information about - the color palette: The clut() function returns a pointer to the - color lookup table (i.e. its color palette). Use the colorCount() - function to determine the number of entries in this table, and the - alloc() function to retrieve the palette index of the color that - is the closest match to a given RGB value. - - To determine if the screen driver supports a given color depth, - use the supportsDepth() function that returns true of the - specified depth is supported. - - \section1 Drawing on Screen - - When a screen update is required, the \l{Qt for Embedded Linux} server runs - through all the top-level windows that intersect with the region - that is about to be updated, and ensures that the associated - clients have updated their memory buffer. Then the server calls - the exposeRegion() function that composes the window surfaces and - copies the content of memory to screen by calling the blit() and - solidFill() functions. - - The blit() function copies a given region in a given image to a - specified point using device coordinates, while the solidFill() - function fills the given region of the screen with the specified - color. Note that normally there is no need to call either of these - functions explicitly. - - In addition, QScreen provides the blank() function that can be - reimplemented to prevent any contents from being displayed on the - screen, and the setDirty() function that can be reimplemented to - indicate that a given rectangle of the screen has been - altered. Note that the default implementations of these functions - do nothing. - - Reimplement the mapFromDevice() and mapToDevice() functions to - map objects from the framebuffer coordinate system to the - coordinate space used by the application, and vice versa. Be aware - that the default implementations simply return the given objects - as they are. - - \section1 Properties - - \table - \header \o Property \o Functions - \row - \o Size - \o - - The size of the screen can be retrieved using the screenSize() - function. The size is returned in bytes. - - The framebuffer's logical width and height can be retrieved using - width() and height(), respectively. These functions return values - are given in pixels. Alternatively, the physicalWidth() and - physicalHeight() function returns the same metrics in - millimeters. QScreen also provides the deviceWidth() and - deviceHeight() functions returning the physical width and height - of the device in pixels. Note that the latter metrics can differ - from the ones used if the display is centered within the - framebuffer. - - \row - \o Resolution - \o - - Reimplement the setMode() function to be able to set the - framebuffer to a new resolution (width and height) and bit depth. - - The current depth of the framebuffer can be always be retrieved - using the depth() function. Use the pixmapDepth() function to - obtain the preferred depth for pixmaps. - - \row - \o Pixmap Alignment - \o - - Use the pixmapOffsetAlignment() function to retrieve the value to - which the start address of pixmaps held in the graphics card's - memory, should be aligned. - - Use the pixmapLinestepAlignment() to retrieve the value to which - the \e {individual scanlines} of pixmaps should be aligned. - - \row - \o Image Display - \o - - The isInterlaced() function tells whether the screen is displaying - images progressively, and the isTransformed() function whether it - is rotated. The transformOrientation() function can be - reimplemented to return the current rotation. - - \row - \o Scanlines - \o - - Use the linestep() function to retrieve the length of each - scanline of the framebuffer. - - \row - \o Pixel Type - \o - - The pixelType() function returns the screen's pixel storage format as - described by the PixelType enum. - - \endtable - - \section1 Subclassing and Initial Values - - You need to set the following members when implementing a subclass of QScreen: - - \table - \header \o Member \o Initial Value - \row \o \l{QScreen::}{data} \o A pointer to the framebuffer if possible; - 0 otherwise. - \row \o \l{QScreen::}{lstep} \o The number of bytes between each scanline - in the framebuffer. - \row \o \l{QScreen::}{w} \o The logical screen width in pixels. - \row \o \l{QScreen::}{h} \o The logical screen height in pixels. - \row \o \l{QScreen::}{dw} \o The real screen width in pixels. - \row \o \l{QScreen::}{dh} \o The real screen height in pixels. - \row \o \l{QScreen::}{d} \o The number of bits per pixel. - \row \o \l{QScreen::}{physWidth} \o The screen width in millimeters. - \row \o \l{QScreen::}{physHeight} \o The screen height in millimeters. - \endtable - - The logical screen values are the same as the real screen values unless the - screen is transformed in some way; e.g., rotated. - - See also the \l{Accelerated Graphics Driver Example} for an example that - shows how to initialize these values. - - \sa QScreenDriverPlugin, QScreenDriverFactory, {Qt for Embedded Linux Display - Management} -*/ - -/*! - \enum QScreen::PixelType - - This enum describes the pixel storage format of the screen, - i.e. the order of the red (R), green (G) and blue (B) components - of a pixel. - - \value NormalPixel Red-green-blue (RGB) - \value BGRPixel Blue-green-red (BGR) - - \sa pixelType() -*/ - -/*! - \enum QScreen::ClassId - - This enum defines the class identifiers for the known screen subclasses. - - \value LinuxFBClass QLinuxFBScreen - \value TransformedClass QTransformedScreen - \value VNCClass QVNCScreen - \value MultiClass QMultiScreen - \value VFbClass QVFbScreen - \value DirectFBClass QDirectFBScreen - \value SvgalibClass QSvgalibScreen - \value ProxyClass QProxyScreen - \value GLClass QGLScreen - \value CustomClass Unknown QScreen subclass - - \sa classId() -*/ - -/*! - \variable QScreen::screenclut - \brief the color table - - Initialize this variable in a subclass using a paletted screen mode, - and initialize its partner, QScreen::screencols. - - \sa screencols -*/ - -/*! - \variable QScreen::screencols - \brief the number of entries in the color table - - Initialize this variable in a subclass using a paletted screen mode, - and initialize its partner, QScreen::screenclut. - - \sa screenclut -*/ - -/*! - \variable QScreen::data - \brief points to the first visible pixel in the frame buffer. - - You must initialize this variable if you are using the default - implementation of non-buffered painting Qt::WA_PaintOnScreen, - QPixmap::grabWindow() or QDirectPainter::frameBuffer(). If you - initialize this variable, you must also initialize QScreen::size and - QScreen::mapsize. - - \sa QScreen::size, QScreen::mapsize -*/ - -/*! - \variable QScreen::w - \brief the logical width of the screen. - - This variable \e{must} be initialized by a subclass. -*/ - -/*! - \variable QScreen::lstep - \brief the number of bytes representing a line in the frame buffer. - - i.e., \e{line step}. \c {data[lstep * 2]} is the address of the - first visible pixel in the third line of the frame buffer. - - \sa data -*/ - -/*! - \variable QScreen::h - \brief the logical height of the screen. - - This variable \e{must} be initialized by a subclass. -*/ - -/*! - \variable QScreen::d - \brief the pixel depth - - This is the number of significant bits used to set a pixel - color. This variable \e{must} be initialized by a subclass. -*/ - -/*! - \variable QScreen::pixeltype - \brief set to BGRPixel - - Set this variable to BGRPixel in a subclass, if the screen pixel - format is a BGR type and you have used setPixelFormat() to set the - pixel format to the corresponding RGB format. e.g., you have set the - pixel format to QImage::Format_RGB555, but your screen really uses - BGR, not RGB. -*/ - -/*! - \variable QScreen::grayscale - \brief the gray scale screen mode flag - - Set this variable to true in a subclass, if you are using a - grayscale screen mode. e.g., in an 8-bit mode where you don't want - to use the palette, but you want to use the grayscales. -*/ - -/*! - \variable QScreen::dw - \brief the device width - - This is the number of pixels in a row of the physical screen. It - \e{must} be initialized by a subclass. Normally, it should be set to - the logical width QScreen::w, but it might be different, e.g., if - you are doing rotations in software. - - \sa QScreen::w -*/ - -/*! - \variable QScreen::dh - \brief the device height - - This is the number of pixels in a column of the physical screen. It - \e{must} be initialized by a subclass. Normally, it should be set to - the logical height QScreen::h, but it might be different, e.g., if - you are doing rotations in software. - - \sa QScreen::h -*/ - -/*! - \variable QScreen::size - \brief the number of bytes in the visible region of the frame buffer - - This is the number of bytes in the visible part of the block pointed - to by the QScreen::data pointer. You must initialize this variable - if you initialize the QScreen::data pointer. - - \sa QScreen::data, QScreen::mapsize -*/ - -/*! - \variable QScreen::mapsize - \brief the total number of bytes in the frame buffer - - This is the total number of bytes in the block pointed to by the - QScreen::data pointer. You must initialize this variable if you - initialize the QScreen::data pointer. - - \sa QScreen::data, QScreen::size -*/ - -/*! - \variable QScreen::physWidth - \brief the physical width of the screen in millimeters. - - Currently, this variable is used when calculating the screen DPI, - which in turn is used when deciding the actual font size Qt is - using. -*/ - -/*! - \variable QScreen::physHeight - \brief the physical height of the screen in millimeters. - - Currently, this variable is used when calculating the screen DPI, - which in turn is used when deciding the actual font size Qt is - using. -*/ - -/*! - \fn static QScreen* QScreen::instance() - - Returns a pointer to the application's QScreen instance. - - If this screen consists of several subscreens, operations to the - returned instance will affect all its subscreens. Use the - subscreens() function to retrieve access to a particular - subscreen. - - \sa subScreens(), subScreenIndexAt() -*/ - -/*! - \fn QList QScreen::subScreens() const - \since 4.2 - - Returns a list of this screen's subscreens. Use the - subScreenIndexAt() function to retrieve the index of a screen at a - given position. - - Note that if \e this screen consists of several subscreens, - operations to \e this instance will affect all subscreens by - default. - - \sa instance(), subScreenIndexAt() -*/ - -/*! - \fn int QScreen::physicalWidth() const - \since 4.2 - - Returns the physical width of the screen in millimeters. - - \sa width(), deviceWidth(), physicalHeight() -*/ - -/*! - \fn int QScreen::physicalHeight() const - \since 4.2 - - Returns the physical height of the screen in millimeters. - - \sa height(), deviceHeight(), physicalWidth() -*/ - -/*! - \fn virtual bool QScreen::initDevice() = 0 - - This function is called by the \l{Qt for Embedded Linux} server to - initialize the framebuffer. Note that a server application will call the - connect() function prior to this function. - - Implement this function to make accelerated drivers set up the - graphics card. Return true to indicate success and false to indicate - failure. - - \sa shutdownDevice(), connect() -*/ - -/*! - \fn virtual bool QScreen::connect(const QString &displaySpec) = 0 - - This function is called by every \l{Qt for Embedded Linux} - application on startup, and must be implemented to map in the - framebuffer and the accelerated drivers that the graphics card - control registers. Note that connect must be called \e before - the initDevice() function. - - Ensure that true is returned if a connection to the screen device - is made. Otherwise, return false. Upon making the connection, the - function should read out the parameters of the framebuffer and use - them as required to set this class's protected variables. - - The \a displaySpec argument is passed by the QWS_DISPLAY - environment variable or the -display command line parameter, and - has the following syntax: - - \snippet doc/src/snippets/code/src_gui_embedded_qscreen_qws.cpp 0 - - For example, to use the mach64 driver on fb1 as display 2: - - \snippet doc/src/snippets/code/src_gui_embedded_qscreen_qws.cpp 1 - - See \l{Qt for Embedded Linux Display Management} for more details. - - \sa disconnect(), initDevice(), {Running Qt for Embedded Linux Applications} -*/ - -/*! - \fn QScreen::disconnect() - - This function is called by every \l{Qt for Embedded Linux} application - before exiting, and must be implemented to unmap the - framebuffer. Note that a server application will call the - shutdownDevice() function prior to this function. - - \sa connect(), shutdownDevice(), {Running Qt for Embedded Linux - Applications} -*/ - -/*! - \fn QScreen::setMode(int width, int height, int depth) - - Implement this function to reset the framebuffer's resolution (\a - width and \a height) and bit \a depth. - - After the resolution has been set, existing paint engines will be - invalid and the framebuffer should be completely redrawn. In a - multiple-process situation, all other applications must be - notified to reset their mode and update themselves accordingly. -*/ - -/*! - \fn QScreen::blank(bool on) - - Prevents the screen driver form displaying any content on the - screen. - - Note that the default implementation does nothing. - - Reimplement this function to prevent the screen driver from - displaying any contents on the screen if \a on is true; otherwise - the contents is expected to be shown. - - \sa blit() -*/ - -/*! - \fn int QScreen::pixmapOffsetAlignment() - - Returns the value (in bits) to which the start address of pixmaps - held in the graphics card's memory, should be aligned. - - Note that the default implementation returns 64; reimplement this - function to override the return value, e.g., when implementing an - accelerated driver (see the \l {Adding an Accelerated Graphics - Driver to Qt for Embedded Linux}{Adding an Accelerated Graphics Driver} - documentation for details). - - \sa pixmapLinestepAlignment() -*/ - -/*! - \fn int QScreen::pixmapLinestepAlignment() - - Returns the value (in bits) to which individual scanlines of - pixmaps held in the graphics card's memory, should be - aligned. - - Note that the default implementation returns 64; reimplement this - function to override the return value, e.g., when implementing an - accelerated driver (see the \l {Adding an Accelerated Graphics - Driver to Qt for Embedded Linux}{Adding an Accelerated Graphics Driver} - documentation for details). - - \sa pixmapOffsetAlignment() -*/ - -/*! - \fn QScreen::width() const - - Returns the logical width of the framebuffer in pixels. - - \sa deviceWidth(), physicalWidth(), height() -*/ - -/*! - \fn int QScreen::height() const - - Returns the logical height of the framebuffer in pixels. - - \sa deviceHeight(), physicalHeight(), width() -*/ - -/*! - \fn QScreen::depth() const - - Returns the depth of the framebuffer, in bits per pixel. - - Note that the returned depth is the number of bits each pixel - fills rather than the number of significant bits, so 24bpp and - 32bpp express the same range of colors (8 bits of red, green and - blue). - - \sa clut(), pixmapDepth() -*/ - -/*! - \fn int QScreen::pixmapDepth() const - - Returns the preferred depth for pixmaps, in bits per pixel. - - \sa depth() -*/ - -/*! - \fn QScreen::linestep() const - - Returns the length of each scanline of the framebuffer in bytes. - - \sa isInterlaced() -*/ - -/*! - \fn QScreen::deviceWidth() const - - Returns the physical width of the framebuffer device in pixels. - - Note that the returned width can differ from the width which - \l{Qt for Embedded Linux} will actually use, that is if the display is - centered within the framebuffer. - - \sa width(), physicalWidth(), deviceHeight() -*/ - -/*! - \fn QScreen::deviceHeight() const - - Returns the full height of the framebuffer device in pixels. - - Note that the returned height can differ from the height which - \l{Qt for Embedded Linux} will actually use, that is if the display is - centered within the framebuffer. - - \sa height(), physicalHeight(), deviceWidth() -*/ - -/*! - \fn uchar *QScreen::base() const - - Returns a pointer to the beginning of the framebuffer. - - \sa onCard(), region(), totalSize() -*/ - -/*! - \fn uchar *QScreen::cache(int) - - \internal - - This function is used to store pixmaps in graphics memory for the - use of the accelerated drivers. See QLinuxFbScreen (where the - caching is implemented) for more information. -*/ - -/*! - \fn QScreen::uncache(uchar *) - - \internal - - This function is called on pixmap destruction to remove them from - graphics card memory. -*/ - -/*! - \fn QScreen::screenSize() const - - Returns the size of the screen in bytes. - - The screen size is always located at the beginning of framebuffer - memory, i.e. it can also be retrieved using the base() function. - - \sa base(), region() -*/ - -/*! - \fn QScreen::totalSize() const - - Returns the size of the available graphics card memory (including - the screen) in bytes. - - \sa onCard() -*/ - -// Unaccelerated screen/driver setup. Can be overridden by accelerated -// drivers - -/*! - \fn QScreen::QScreen(int displayId) - - Constructs a new screen driver. - - The \a displayId identifies the \l{Qt for Embedded Linux} server to connect - to. -*/ - -/*! - \fn QScreen::clut() - - Returns a pointer to the screen's color lookup table (i.e. its - color palette). - - Note that this function only apply in paletted modes like 8-bit, - i.e. in modes where only the palette indexes (and not the actual - color values) are stored in memory. - - \sa alloc(), depth(), colorCount() -*/ - -/*! - \obsolete - \fn int QScreen::numCols() - - \sa colorCount() -*/ - -/*! - \since 4.6 - \fn int QScreen::colorCount() - - Returns the number of entries in the screen's color lookup table - (i.e. its color palette). A pointer to the color table can be - retrieved using the clut() function. - - \sa clut(), alloc() -*/ - -/*! - \since 4.4 - - Constructs a new screen driver. - - The \a display_id identifies the \l{Qt for Embedded Linux} - server to connect to. The \a classId specifies the class - identifier. -*/ -QScreen::QScreen(int display_id, ClassId classId) - : screencols(0), data(0), entries(0), entryp(0), lowest(0), - w(0), lstep(0), h(0), d(1), pixeltype(NormalPixel), grayscale(false), - dw(0), dh(0), size(0), mapsize(0), displayId(display_id), - physWidth(0), physHeight(0), d_ptr(new QScreenPrivate(this, classId)) -{ - clearCacheFunc = 0; -} - -QScreen::QScreen(int display_id) - : screencols(0), data(0), entries(0), entryp(0), lowest(0), - w(0), lstep(0), h(0), d(1), pixeltype(NormalPixel), grayscale(false), - dw(0), dh(0), size(0), mapsize(0), displayId(display_id), - physWidth(0), physHeight(0), d_ptr(new QScreenPrivate(this)) -{ - clearCacheFunc = 0; -} - -/*! - Destroys this screen driver. -*/ - -QScreen::~QScreen() -{ - delete d_ptr; -} - -/*! - This function is called by the \l{Qt for Embedded Linux} server before it - calls the disconnect() function when exiting. - - Note that the default implementation only hides the mouse cursor; - reimplement this function to do the necessary graphics card - specific cleanup. - - \sa initDevice(), disconnect() -*/ - -void QScreen::shutdownDevice() -{ -#ifndef QT_NO_QWS_CURSOR - if (qt_screencursor) - qt_screencursor->hide(); -#endif -} - -extern bool qws_accel; //in qapplication_qws.cpp - -/*! - \fn PixelType QScreen::pixelType() const - - Returns the pixel storage format of the screen. -*/ - -/*! - Returns the pixel format of the screen, or \c QImage::Format_Invalid - if the pixel format is not a supported image format. - -*/ -QImage::Format QScreen::pixelFormat() const -{ - return d_ptr->pixelFormat; -} - -/*! - Sets the screen's pixel format to \a format. - */ -void QScreen::setPixelFormat(QImage::Format format) -{ - d_ptr->pixelFormat = format; -} - - -/*! - \fn int QScreen::alloc(unsigned int red, unsigned int green, unsigned int blue) - - Returns the index in the screen's palette which is the closest - match to the given RGB value (\a red, \a green, \a blue). - - Note that this function only apply in paletted modes like 8-bit, - i.e. in modes where only the palette indexes (and not the actual - color values) are stored in memory. - - \sa clut(), colorCount() -*/ - -int QScreen::alloc(unsigned int r,unsigned int g,unsigned int b) -{ - int ret = 0; - if (d == 8) { - if (grayscale) - return qGray(r, g, b); - - // First we look to see if we match a default color - const int pos = (r + 25) / 51 * 36 + (g + 25) / 51 * 6 + (b + 25) / 51; - if (pos < screencols && screenclut[pos] == qRgb(r, g, b)) { - return pos; - } - - // search for nearest color - unsigned int mindiff = 0xffffffff; - unsigned int diff; - int dr,dg,db; - - for (int loopc = 0; loopc < screencols; ++loopc) { - dr = qRed(screenclut[loopc]) - r; - dg = qGreen(screenclut[loopc]) - g; - db = qBlue(screenclut[loopc]) - b; - diff = dr*dr + dg*dg + db*db; - - if (diff < mindiff) { - ret = loopc; - if (!diff) - break; - mindiff = diff; - } - } - } else if (d == 4) { - ret = qGray(r, g, b) >> 4; - } else if (d == 1) { - ret = qGray(r, g, b) >= 128; - } else { - qFatal("cannot alloc %dbpp color", d); - } - - return ret; -} - -/*! - Saves the current state of the graphics card. - - For example, hardware screen drivers should reimplement the save() - and restore() functions to save and restore its registers, - enabling swintching between virtual consoles. - - Note that the default implementation does nothing. - - \sa restore() -*/ - -void QScreen::save() -{ -} - -/*! - Restores the previously saved state of the graphics card. - - For example, hardware screen drivers should reimplement the save() - and restore() functions to save and restore its registers, - enabling swintching between virtual consoles. - - Note that the default implementation does nothing. - - \sa save() -*/ - -void QScreen::restore() -{ -} - -void QScreen::blank(bool) -{ -} - -/*! - \internal -*/ - -void QScreen::set(unsigned int, unsigned int, unsigned int, unsigned int) -{ -} - -/*! - \fn bool QScreen::supportsDepth(int depth) const - - Returns true if the screen supports the specified color \a depth; - otherwise returns false. - - \sa clut() -*/ - -bool QScreen::supportsDepth(int d) const -{ - if (false) { - //Just to simplify the ifdeffery -#ifdef QT_QWS_DEPTH_1 - } else if(d==1) { - return true; -#endif -#ifdef QT_QWS_DEPTH_4 - } else if(d==4) { - return true; -#endif -#ifdef QT_QWS_DEPTH_8 - } else if(d==8) { - return true; -#endif -#ifdef QT_QWS_DEPTH_16 - } else if(d==16) { - return true; -#endif -#ifdef QT_QWS_DEPTH_15 - } else if (d == 15) { - return true; -#endif -#ifdef QT_QWS_DEPTH_18 - } else if(d==18 || d==19) { - return true; -#endif -#ifdef QT_QWS_DEPTH_24 - } else if(d==24) { - return true; -#endif -#ifdef QT_QWS_DEPTH_32 - } else if(d==32) { - return true; -#endif - } - return false; -} - -/*! - \fn bool QScreen::onCard(const unsigned char *buffer) const - - Returns true if the specified \a buffer is within the graphics - card's memory; otherwise returns false (i.e. if it's in main RAM). - - \sa base(), totalSize() -*/ - -bool QScreen::onCard(const unsigned char * p) const -{ - long t=(unsigned long)p; - long bmin=(unsigned long)data; - if (t < bmin) - return false; - if(t >= bmin+mapsize) - return false; - return true; -} - -/*! - \fn bool QScreen::onCard(const unsigned char * buffer, ulong& offset) const - \overload - - If the specified \a buffer is within the graphics card's memory, - this function stores the offset from the start of graphics card - memory (in bytes), in the location specified by the \a offset - parameter. -*/ - -bool QScreen::onCard(const unsigned char * p, ulong& offset) const -{ - long t=(unsigned long)p; - long bmin=(unsigned long)data; - if (t < bmin) - return false; - long o = t - bmin; - if (o >= mapsize) - return false; - offset = o; - return true; -} - -/* -#if !defined(QT_NO_QWS_REPEATER) - { "Repeater", qt_get_screen_repeater, 0 }, -#endif -#if defined(QT_QWS_EE) - { "EE", qt_get_screen_ee, 0 }, -#endif - -*/ - -/* -Given a display_id (number of the \l{Qt for Embedded Linux} server to connect to) -and a spec (e.g. Mach64:/dev/fb0) return a QScreen-descendant. -The QScreenDriverFactory is queried for a suitable driver and, if found, -asked to create a driver. -People writing new graphics drivers should either hook their own -QScreen-descendant into QScreenDriverFactory or use the QScreenDriverPlugin -to make a dynamically loadable driver. -*/ - -Q_GUI_EXPORT QScreen* qt_get_screen(int display_id, const char *spec) -{ - QString displaySpec = QString::fromAscii(spec); - QString driver = displaySpec; - int colon = displaySpec.indexOf(QLatin1Char(':')); - if (colon >= 0) - driver.truncate(colon); - driver = driver.trimmed(); - - bool foundDriver = false; - QString driverName = driver; - - QStringList driverList; - if (!driver.isEmpty()) - driverList << driver; - else - driverList = QScreenDriverFactory::keys(); - - for (int i = 0; i < driverList.size(); ++i) { - const QString driverName = driverList.at(i); - qt_screen = QScreenDriverFactory::create(driverName, display_id); - if (qt_screen) { - foundDriver = true; - if (qt_screen->connect(displaySpec)) { - return qt_screen; - } else { - delete qt_screen; - qt_screen = 0; - } - } - } - - if (driver.isNull()) - qFatal("No suitable driver found"); - else if (foundDriver) - qFatal("%s: driver cannot connect", driver.toLatin1().constData()); - else - qFatal("%s: driver not found", driver.toLatin1().constData()); - - return 0; -} - -#ifndef QT_NO_QWS_CURSOR -static void blendCursor(QImage *dest, const QImage &cursor, const QPoint &offset) -{ - QRasterBuffer rb; - rb.prepare(dest); - - QSpanData spanData; - spanData.init(&rb, 0); - spanData.type = QSpanData::Texture; - spanData.initTexture(&cursor, 256); - spanData.dx = -offset.x(); - spanData.dy = -offset.y(); - if (!spanData.blend) - return; - - const QRect rect = QRect(offset, cursor.size()) - & QRect(QPoint(0, 0), dest->size()); - const int w = rect.width(); - const int h = rect.height(); - - QVarLengthArray spans(h); - for (int i = 0; i < h; ++i) { - spans[i].x = rect.x(); - spans[i].len = w; - spans[i].y = rect.y() + i; - spans[i].coverage = 255; - } - spanData.blend(h, spans.constData(), &spanData); -} -#endif // QT_NO_QWS_CURSOR - -/*! - \fn void QScreen::exposeRegion(QRegion region, int windowIndex) - - This function is called by the \l{Qt for Embedded Linux} server whenever a - screen update is required. \a region is the area on the screen - that must be updated, and \a windowIndex is the index into - QWSServer::clientWindows() of the window that required the - update. QWSWindow::state() gives more information about the cause. - - The default implementation composes the - affected windows and paints the given \a region on screen by - calling the blit() and solidFill() functions - - This function can be reimplemented to perform composition in - hardware, or to perform transition effects. - For simpler hardware acceleration, or to interface with - this is typically done by reimplementing the blit() and - solidFill() functions instead. - - Note that there is no need to call this function explicitly. - - \sa blit(), solidFill(), blank() -*/ -void QScreen::exposeRegion(QRegion r, int windowIndex) -{ - r &= region(); - if (r.isEmpty()) - return; - - int changing = windowIndex; - // when we have just lowered a window, we have to expose all the windows below where the - // window used to be. - if (changing && qwsServer->clientWindows().at(changing)->state() == QWSWindow::Lowering) - changing = 0; -#ifdef QTOPIA_PERFTEST - static enum { PerfTestUnknown, PerfTestOn, PerfTestOff } perfTestState = PerfTestUnknown; - if(PerfTestUnknown == perfTestState) { - if(::getenv("QTOPIA_PERFTEST")) - perfTestState = PerfTestOn; - else - perfTestState = PerfTestOff; - } - if(PerfTestOn == perfTestState) { - QWSWindow *changed = qwsServer->clientWindows().at(changing); - if(!changed->client()->identity().isEmpty()) - qDebug() << "Performance : expose_region :" - << changed->client()->identity() - << r.boundingRect() << ": " - << qPrintable( QTime::currentTime().toString( "h:mm:ss.zzz" ) ); - } -#endif - - const QRect bounds = r.boundingRect(); - QRegion blendRegion; - QImage *blendBuffer = 0; - -#ifndef QT_NO_QWS_CURSOR - if (qt_screencursor && !qt_screencursor->isAccelerated()) { - blendRegion = r & qt_screencursor->boundingRect(); - } -#endif - compose(0, r, blendRegion, &blendBuffer, changing); - - if (blendBuffer && !blendBuffer->isNull()) { - const QPoint offset = blendRegion.boundingRect().topLeft(); -#ifndef QT_NO_QWS_CURSOR - if (qt_screencursor && !qt_screencursor->isAccelerated()) { - const QRect cursorRect = qt_screencursor->boundingRect(); - if (blendRegion.intersects(cursorRect)) { - blendCursor(blendBuffer, qt_screencursor->image(), - cursorRect.topLeft() - offset); - } - } -#endif // QT_NO_QWS_CURSOR - blit(*blendBuffer, offset, blendRegion); - delete blendBuffer; - } - - if (r.rectCount() == 1) { - setDirty(r.boundingRect()); - } else { - const QVector rects = r.rects(); - for (int i = 0; i < rects.size(); ++i) - setDirty(rects.at(i)); - } -} - -/*! - \fn void QScreen::blit(const QImage &image, const QPoint &topLeft, const QRegion ®ion) - - Copies the given \a region in the given \a image to the point - specified by \a topLeft using device coordinates. - - This function is called from the exposeRegion() function; it is - not intended to be called explicitly. - - Reimplement this function to make use of \l{Adding an Accelerated - Graphics Driver to Qt for Embedded Linux}{accelerated hardware}. Note that - this function must be reimplemented if the framebuffer format is - not supported by \l{Qt for Embedded Linux} (See the - \l{Qt for Embedded Linux Display Management}{Display Management} - documentation for more details). - - \sa exposeRegion(), solidFill(), blank() -*/ -void QScreen::blit(const QImage &img, const QPoint &topLeft, const QRegion ®) -{ - const QRect bound = (region() & QRect(topLeft, img.size())).boundingRect(); - QWSDisplay::grab(); - d_ptr->blit(this, img, topLeft - offset(), - (reg & bound).translated(-topLeft)); - QWSDisplay::ungrab(); -} - -#ifdef QT_QWS_CLIENTBLIT -/*! - Returns true if this screen driver supports calling QScreen::blit() and - QScreen::setDirty() directly from non-server applications, otherwise returns - false. - - If available, this is used to optimize the performance of non-occluded, opaque - client windows by removing the server round trip when they are updated. - - \sa setSupportsBlitInClients() - */ -bool QScreen::supportsBlitInClients() const -{ - return d_ptr->supportsBlitInClients; -} - -/*! - If \a supported, the screen driver is marked as supporting blitting directly - from non-server applications. - - \sa supportsBlitInClients() - */ -void QScreen::setSupportsBlitInClients(bool supported) -{ - d_ptr->supportsBlitInClients = supported; -} -#endif - -/*! - \internal -*/ - -void QScreen::blit(QWSWindow *win, const QRegion &clip) -{ - QWSWindowSurface *surface = win->windowSurface(); - if (!surface) - return; - - const QImage &img = surface->image(); - if (img.isNull()) - return; - - const QRegion rgn = clip & win->paintedRegion(); - if (rgn.isEmpty()) - return; - - surface->lock(); - blit(img, win->requestedRegion().boundingRect().topLeft(), rgn); - surface->unlock(); -} - -struct fill_data { - quint32 color; - uchar *data; - int lineStep; - int x; - int y; - int w; - int h; -}; - -/*! - Fills the given \a region of the screen with the specified \a - color. - - This function is called from the exposeRegion() function; it is - not intended to be called explicitly. - - Reimplement this function to make use of \l{Adding an Accelerated - Graphics Driver to Qt for Embedded Linux}{accelerated hardware}. Note that - this function must be reimplemented if the framebuffer format is - not supported by \l{Qt for Embedded Linux} (See the - \l{Qt for Embedded Linux Display Management}{Display Management} - documentation for more details). - - \sa exposeRegion(), blit(), blank() -*/ -// the base class implementation works in device coordinates, so that transformed drivers can use it -void QScreen::solidFill(const QColor &color, const QRegion ®ion) -{ - QWSDisplay::grab(); - d_ptr->solidFill(this, color, - region.translated(-offset()) & QRect(0, 0, dw, dh)); - QWSDisplay::ungrab(); -} - -/*! - \since 4.2 - - Creates and returns a new window surface matching the given \a - key. - - The server application will call this function whenever it needs - to create a server side representation of a window, e.g. when - copying the content of memory to the screen using the screen - driver. - - Note that this function must be reimplemented when adding an - accelerated graphics driver. See the - \l{Adding an Accelerated Graphics Driver to Qt for Embedded Linux} - {Adding an Accelerated Graphics Driver} documentation for details. - - \sa {Qt for Embedded Linux Architecture} -*/ -QWSWindowSurface* QScreen::createSurface(const QString &key) const -{ -#ifndef QT_NO_PAINTONSCREEN - if (key == QLatin1String("OnScreen")) - return new QWSOnScreenSurface; - else -#endif - if (key == QLatin1String("mem")) - return new QWSLocalMemSurface; -#ifndef QT_NO_QWS_MULTIPROCESS - else if (key == QLatin1String("shm")) - return new QWSSharedMemSurface; -#endif -#ifndef QT_NO_PAINT_DEBUG - else if (key == QLatin1String("Yellow")) - return new QWSYellowSurface; -#endif -#ifndef QT_NO_DIRECTPAINTER - else if (key == QLatin1String("DirectPainter")) - return new QWSDirectPainterSurface; -#endif - - return 0; -} - -#ifndef QT_NO_PAINTONSCREEN -bool QScreen::isWidgetPaintOnScreen(const QWidget *w) -{ - static int doOnScreen = -1; - if (doOnScreen == -1) { - const QByteArray env = qgetenv("QT_ONSCREEN_PAINT"); - if (env == "force") - doOnScreen = 2; - else - doOnScreen = (env.toInt() > 0 ? 1 : 0); - } - - if (doOnScreen == 2) // force - return true; - - if (doOnScreen == 0 && !w->testAttribute(Qt::WA_PaintOnScreen)) - return false; - - return w->d_func()->isOpaque; -} -#endif - -/*! - \overload - - Creates and returns a new window surface for the given \a widget. -*/ -QWSWindowSurface* QScreen::createSurface(QWidget *widget) const -{ -#ifndef QT_NO_PAINTONSCREEN - if (isWidgetPaintOnScreen(widget) && base()) - return new QWSOnScreenSurface(widget); - else -#endif - if (QApplication::type() == QApplication::GuiServer) - return new QWSLocalMemSurface(widget); -#ifndef QT_NO_QWS_MULTIPROCESS - else - return new QWSSharedMemSurface(widget); -#endif - - return 0; -} - -void QScreen::compose(int level, const QRegion &exposed, QRegion &blend, - QImage **blendbuffer, int changing_level) -{ - QRect exposed_bounds = exposed.boundingRect(); - QWSWindow *win = 0; - do { - win = qwsServer->clientWindows().value(level); // null is background - ++level; - } while (win && !win->paintedRegion().boundingRect().intersects(exposed_bounds)); - - QWSWindowSurface *surface = (win ? win->windowSurface() : 0); - bool above_changing = level <= changing_level; // 0 is topmost - - QRegion exposedBelow = exposed; - bool opaque = true; - - if (win) { - opaque = win->isOpaque() || !surface->isBuffered(); - if (opaque) { - exposedBelow -= win->paintedRegion(); - if (above_changing || !surface->isBuffered()) - blend -= exposed & win->paintedRegion(); - } else { - blend += exposed & win->paintedRegion(); - } - } - if (win && !exposedBelow.isEmpty()) { - compose(level, exposedBelow, blend, blendbuffer, changing_level); - } else { - QSize blendSize = blend.boundingRect().size(); - if (!blendSize.isNull()) { - *blendbuffer = new QImage(blendSize, d_ptr->preferredImageFormat()); - } - } - - const QRegion blitRegion = exposed - blend; - if (!win) - paintBackground(blitRegion); - else if (!above_changing && surface->isBuffered()) - blit(win, blitRegion); - - QRegion blendRegion = exposed & blend; - - if (win) - blendRegion &= win->paintedRegion(); - if (!blendRegion.isEmpty()) { - - QPoint off = blend.boundingRect().topLeft(); - - QRasterBuffer rb; - rb.prepare(*blendbuffer); - QSpanData spanData; - spanData.init(&rb, 0); - if (!win) { - const QImage::Format format = (*blendbuffer)->format(); - switch (format) { - case QImage::Format_ARGB32_Premultiplied: - case QImage::Format_ARGB32: - case QImage::Format_ARGB8565_Premultiplied: - case QImage::Format_ARGB8555_Premultiplied: - case QImage::Format_ARGB6666_Premultiplied: - case QImage::Format_ARGB4444_Premultiplied: - spanData.rasterBuffer->compositionMode = QPainter::CompositionMode_Source; - break; - default: - break; - } - spanData.setup(qwsServer->backgroundBrush(), 256, QPainter::CompositionMode_Source); - spanData.dx = off.x(); - spanData.dy = off.y(); - } else if (!surface->isBuffered()) { - return; - } else { - const QImage &img = surface->image(); - QPoint winoff = off - win->requestedRegion().boundingRect().topLeft(); - // convert win->opacity() from scale [0..255] to [0..256] - int const_alpha = win->opacity(); - const_alpha += (const_alpha >> 7); - spanData.type = QSpanData::Texture; - spanData.initTexture(&img, const_alpha); - spanData.dx = winoff.x(); - spanData.dy = winoff.y(); - } - if (!spanData.blend) - return; - - if (surface) - surface->lock(); - const QVector rects = blendRegion.rects(); - const int nspans = 256; - QT_FT_Span spans[nspans]; - for (int i = 0; i < rects.size(); ++i) { - int y = rects.at(i).y() - off.y(); - int ye = y + rects.at(i).height(); - int x = rects.at(i).x() - off.x(); - int len = rects.at(i).width(); - while (y < ye) { - int n = qMin(nspans, ye - y); - int i = 0; - while (i < n) { - spans[i].x = x; - spans[i].len = len; - spans[i].y = y + i; - spans[i].coverage = 255; - ++i; - } - spanData.blend(n, spans, &spanData); - y += n; - } - } - if (surface) - surface->unlock(); - } -} - -void QScreen::paintBackground(const QRegion &r) -{ - const QBrush &bg = qwsServer->backgroundBrush(); - Qt::BrushStyle bs = bg.style(); - if (bs == Qt::NoBrush || r.isEmpty()) - return; - - if (bs == Qt::SolidPattern) { - solidFill(bg.color(), r); - } else { - const QRect br = r.boundingRect(); - QImage img(br.size(), d_ptr->preferredImageFormat()); - QPoint off = br.topLeft(); - QRasterBuffer rb; - rb.prepare(&img); - QSpanData spanData; - spanData.init(&rb, 0); - spanData.setup(bg, 256, QPainter::CompositionMode_Source); - spanData.dx = off.x(); - spanData.dy = off.y(); - Q_ASSERT(spanData.blend); - - const QVector rects = r.rects(); - const int nspans = 256; - QT_FT_Span spans[nspans]; - for (int i = 0; i < rects.size(); ++i) { - int y = rects.at(i).y() - off.y(); - int ye = y + rects.at(i).height(); - int x = rects.at(i).x() - off.x(); - int len = rects.at(i).width(); - while (y < ye) { - int n = qMin(nspans, ye - y); - int i = 0; - while (i < n) { - spans[i].x = x; - spans[i].len = len; - spans[i].y = y + i; - spans[i].coverage = 255; - ++i; - } - spanData.blend(n, spans, &spanData); - y += n; - } - } - blit(img, br.topLeft(), r); - } -} - -/*! - \fn virtual int QScreen::sharedRamSize(void *) - - \internal -*/ - -/*! - \fn QScreen::setDirty(const QRect& rectangle) - - Marks the given \a rectangle as dirty. - - Note that the default implementation does nothing; reimplement - this function to indicate that the given \a rectangle has been - altered. -*/ - -void QScreen::setDirty(const QRect&) -{ -} - -/*! - \fn QScreen::isTransformed() const - - Returns true if the screen is transformed (for instance, rotated - 90 degrees); otherwise returns false. - - \sa transformOrientation(), isInterlaced() -*/ - -bool QScreen::isTransformed() const -{ - return false; -} - -/*! - \fn QScreen::isInterlaced() const - - Returns true if the display is interlaced (i.e. is displaying - images progressively like a television screen); otherwise returns - false. - - If the display is interlaced, the drawing is altered to look - better. - - \sa isTransformed(), linestep() -*/ - -bool QScreen::isInterlaced() const -{ - return false;//qws_screen_is_interlaced;; -} - -/*! - \fn QScreen::mapToDevice(const QSize &size) const - - Maps the given \a size from the coordinate space used by the - application to the framebuffer coordinate system. Note that the - default implementation simply returns the given \a size as it is. - - Reimplement this function to use the given device's coordinate - system when mapping. - - \sa mapFromDevice() -*/ - -QSize QScreen::mapToDevice(const QSize &s) const -{ - return s; -} - -/*! - \fn QScreen::mapFromDevice(const QSize &size) const - - Maps the given \a size from the framebuffer coordinate system to - the coordinate space used by the application. Note that the - default implementation simply returns the given \a size as it is. - - Reimplement this function to use the given device's coordinate - system when mapping. - - \sa mapToDevice() -*/ - -QSize QScreen::mapFromDevice(const QSize &s) const -{ - return s; -} - -/*! - \fn QScreen::mapToDevice(const QPoint &point, const QSize &screenSize) const - \overload - - Maps the given \a point from the coordinate space used by the - application to the framebuffer coordinate system, passing the - device's \a screenSize as argument. Note that the default - implementation returns the given \a point as it is. -*/ - -QPoint QScreen::mapToDevice(const QPoint &p, const QSize &) const -{ - return p; -} - -/*! - \fn QScreen::mapFromDevice(const QPoint &point, const QSize &screenSize) const - \overload - - Maps the given \a point from the framebuffer coordinate system to - the coordinate space used by the application, passing the device's - \a screenSize as argument. Note that the default implementation - simply returns the given \a point as it is. -*/ - -QPoint QScreen::mapFromDevice(const QPoint &p, const QSize &) const -{ - return p; -} - -/*! - \fn QScreen::mapToDevice(const QRect &rectangle, const QSize &screenSize) const - \overload - - Maps the given \a rectangle from the coordinate space used by the - application to the framebuffer coordinate system, passing the - device's \a screenSize as argument. Note that the default - implementation returns the given \a rectangle as it is. -*/ - -QRect QScreen::mapToDevice(const QRect &r, const QSize &) const -{ - return r; -} - -/*! - \fn QScreen::mapFromDevice(const QRect &rectangle, const QSize &screenSize) const - \overload - - Maps the given \a rectangle from the framebuffer coordinate system to - the coordinate space used by the application, passing the device's - \a screenSize as argument. Note that the default implementation - simply returns the given \a rectangle as it is. -*/ - -QRect QScreen::mapFromDevice(const QRect &r, const QSize &) const -{ - return r; -} - -/*! - \fn QScreen::mapToDevice(const QImage &image) const - \overload - - Maps the given \a image from the coordinate space used by the - application to the framebuffer coordinate system. Note that the - default implementation returns the given \a image as it is. -*/ - -QImage QScreen::mapToDevice(const QImage &i) const -{ - return i; -} - -/*! - \fn QScreen::mapFromDevice(const QImage &image) const - \overload - - Maps the given \a image from the framebuffer coordinate system to - the coordinate space used by the application. Note that the - default implementation simply returns the given \a image as it is. -*/ - -QImage QScreen::mapFromDevice(const QImage &i) const -{ - return i; -} - -/*! - \fn QScreen::mapToDevice(const QRegion ®ion, const QSize &screenSize) const - \overload - - Maps the given \a region from the coordinate space used by the - application to the framebuffer coordinate system, passing the - device's \a screenSize as argument. Note that the default - implementation returns the given \a region as it is. -*/ - -QRegion QScreen::mapToDevice(const QRegion &r, const QSize &) const -{ - return r; -} - -/*! - \fn QScreen::mapFromDevice(const QRegion ®ion, const QSize &screenSize) const - \overload - - Maps the given \a region from the framebuffer coordinate system to - the coordinate space used by the application, passing the device's - \a screenSize as argument. Note that the default implementation - simply returns the given \a region as it is. -*/ - -QRegion QScreen::mapFromDevice(const QRegion &r, const QSize &) const -{ - return r; -} - -/*! - \fn QScreen::transformOrientation() const - - Returns the current rotation as an integer value. - - Note that the default implementation returns 0; reimplement this - function to override this value. - - \sa isTransformed() -*/ - -int QScreen::transformOrientation() const -{ - return 0; -} - -int QScreen::pixmapDepth() const -{ - return depth(); -} - -/*! - \internal -*/ -int QScreen::memoryNeeded(const QString&) -{ - return 0; -} - -/*! - \internal -*/ -void QScreen::haltUpdates() -{ -} - -/*! - \internal -*/ -void QScreen::resumeUpdates() -{ -} - -/*! - \fn QRegion QScreen::region() const - \since 4.2 - - Returns the region covered by this screen driver. - - \sa base(), screenSize() -*/ - -/*! - \internal -*/ -void QScreen::setOffset(const QPoint &p) -{ - d_ptr->offset = p; -} - -/*! - \since 4.2 - - Returns the logical offset of the screen, i.e., the offset between - (0,0) in screen coordinates and the application coordinate system. -*/ -QPoint QScreen::offset() const -{ - return d_ptr->offset; -} - -#if Q_BYTE_ORDER == Q_BIG_ENDIAN -void QScreen::setFrameBufferLittleEndian(bool littleEndian) -{ - d_ptr->fb_is_littleEndian = littleEndian; -} - -bool QScreen::frameBufferLittleEndian() const -{ - return d_ptr->fb_is_littleEndian; -} -#endif - -/*! - \fn int QScreen::subScreenIndexAt(const QPoint &position) const - \since 4.2 - - Returns the index of the subscreen at the given \a position; - returns -1 if no screen is found. - - The index identifies the subscreen in the list of pointers - returned by the subScreens() function. - - \sa instance(), subScreens() -*/ -int QScreen::subScreenIndexAt(const QPoint &p) const -{ - const QList screens = subScreens(); - const int n = screens.count(); - for (int i = 0; i < n; ++i) { - if (screens.at(i)->region().contains(p)) - return i; - } - - return -1; -} - -#if 0 -#ifdef QT_LOADABLE_MODULES -#include - -// ### needs update after driver init changes - -static QScreen * qt_dodriver(char * driver,char * a,unsigned char * b) - -{ - char buf[200]; - strcpy(buf,"/etc/qws/drivers/"); - qstrcpy(buf+17,driver); - qDebug("Attempting driver %s",driver); - - void * handle; - handle=dlopen(buf,RTLD_LAZY); - if(handle==0) { - qFatal("Module load error"); - } - QScreen *(*qt_get_screen_func)(char *,unsigned char *); - qt_get_screen_func=dlsym(handle,"qt_get_screen"); - if(qt_get_screen_func==0) { - qFatal("Couldn't get symbol"); - } - QScreen * ret=qt_get_screen_func(a,b); - return ret; -} - -static QScreen * qt_do_entry(char * entry) -{ - unsigned char config[256]; - - FILE * f=fopen(entry,"r"); - if(!f) { - return 0; - } - - int r=fread(config,256,1,f); - if(r<1) - return 0; - - fclose(f); - - unsigned short vendorid=*((unsigned short int *)config); - unsigned short deviceid=*(((unsigned short int *)config)+1); - if(config[0xb]!=3) - return 0; - - if(vendorid==0x1002) { - if(deviceid==0x4c4d) { - qDebug("Compaq Armada/IBM Thinkpad's Mach64 card"); - return qt_dodriver("mach64.so",entry,config); - } else if(deviceid==0x4742) { - qDebug("Desktop Rage Pro Mach64 card"); - return qt_dodriver("mach64.so",entry,config); - } else { - qDebug("Unrecognised ATI card id %x",deviceid); - return 0; - } - } else { - qDebug("Unrecognised vendor"); - } - return 0; -} - -extern bool qws_accel; - -/// ** NOT SUPPPORTED ** - -QScreen * qt_probe_bus() -{ - if(!qws_accel) { - return qt_dodriver("unaccel.so",0,0); - } - - QT_DIR *dirptr = QT_OPENDIR("/proc/bus/pci"); - if(!dirptr) - return qt_dodriver("unaccel.so",0,0); - QT_DIR * dirptr2; - QT_DIRENT *cards; - - QT_DIRENT *busses = QT_READDIR(dirptr); - - while(busses) { - if(busses->d_name[0]!='.') { - char buf[100]; - strcpy(buf,"/proc/bus/pci/"); - qstrcpy(buf+14,busses->d_name); - int p=strlen(buf); - dirptr2 = QT_OPENDIR(buf); - if(dirptr2) { - cards = QT_READDIR(dirptr2); - while(cards) { - if(cards->d_name[0]!='.') { - buf[p]='/'; - qstrcpy(buf+p+1,cards->d_name); - QScreen * ret=qt_do_entry(buf); - if(ret) - return ret; - } - cards = QT_READDIR(dirptr2); - } - QT_CLOSEDIR(dirptr2); - } - } - busses = QT_READDIR(dirptr); - } - QT_CLOSEDIR(dirptr); - - return qt_dodriver("unaccel.so",0,0); -} - -#else - -char *qt_qws_hardcoded_slot = "/proc/bus/pci/01/00.0"; - -const unsigned char* qt_probe_bus() -{ - const char * slot; - slot=::getenv("QWS_CARD_SLOT"); - if(!slot) - slot=qt_qws_hardcoded_slot; - if (slot) { - static unsigned char config[256]; - FILE * f=fopen(slot,"r"); - if(!f) { - qDebug("Open failure for %s",slot); - slot=0; - } else { - int r=fread((char*)config,256,1,f); - fclose(f); - if(r<1) { - qDebug("Read failure"); - return 0; - } else { - return config; - } - } - } - return 0; -} - -#endif - -#endif // 0 - -/*! - \internal - \since 4.4 -*/ -void QScreen::setPixmapDataFactory(QPixmapDataFactory *factory) -{ - static bool shownWarning = false; - if (!shownWarning) { - qWarning("QScreen::setPixmapDataFactory() is deprecated - use setGraphicsSystem() instead"); - shownWarning = true; - } - - d_ptr->pixmapFactory = factory; -} - -/*! - \internal - \since 4.4 -*/ -QPixmapDataFactory* QScreen::pixmapDataFactory() const -{ - return d_ptr->pixmapFactory; -} - -/*! - \internal - \since 4.5 -*/ -void QScreen::setGraphicsSystem(QGraphicsSystem* system) -{ - d_ptr->graphicsSystem = system; -} - -/*! - \internal - \since 4.5 -*/ -QGraphicsSystem* QScreen::graphicsSystem() const -{ - return d_ptr->graphicsSystem; -} - -/*! - \since 4.4 - - Returns the class identifier for the screen object. -*/ -QScreen::ClassId QScreen::classId() const -{ - return static_cast(d_ptr->classId); -} - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h deleted file mode 100644 index 2ecc6e71559..00000000000 --- a/src/gui/embedded/qscreen_qws.h +++ /dev/null @@ -1,391 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSCREEN_QWS_H -#define QSCREEN_QWS_H - -#include -#include -#include -#include -#include -#include -#include - -struct fb_cmap; - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QScreenCursor; -class QBrush; -class QWSWindow; -class QWSWindowSurface; -class QGraphicsSystem; -class QPixmapData; - -#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 ushort qt_convRgbTo16(QRgb c) -{ - const int tr = qRed(c) << qt_red_shift; - const int tg = qGreen(c) << qt_green_shift; - const int tb = qBlue(c) >> 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); -} - -inline void qt_conv16ToRgb(ushort c, int& r, int& g, int& b) -{ - const int tr=(c & qt_red_mask); - const int tg=(c & qt_green_mask); - const int tb=(c & qt_blue_mask); - r = tr >> qt_red_shift | tr >> qt_red_rounding_shift; - g = tg >> qt_green_shift | tg >> qt_green_rounding_shift; - b = tb << qt_neg_blue_shift | tb >> qt_blue_rounding_shift; -} - -const int SourceSolid=0; -const int SourcePixmap=1; - -#ifndef QT_NO_QWS_CURSOR - -class QScreenCursor; -extern QScreenCursor *qt_screencursor; -extern bool qws_sw_cursor; - -class Q_GUI_EXPORT QScreenCursor -{ -public: - QScreenCursor(); - virtual ~QScreenCursor(); - - virtual void set(const QImage &image, int hotx, int hoty); - virtual void move(int x, int y); - virtual void show(); - virtual void hide(); - - bool supportsAlphaCursor() const { return supportsAlpha; } - - static bool enabled() { return qws_sw_cursor; } - - QRect boundingRect() const { return QRect(pos - hotspot, size); } - QImage image() const { return cursor; } - bool isVisible() const { return enable; } - bool isAccelerated() const { return hwaccel; } - - static void initSoftwareCursor(); - static QScreenCursor* instance() { return qt_screencursor; } - -protected: - QImage cursor; - - QSize size; - QPoint pos; - QPoint hotspot; - uint enable : 1; - uint hwaccel : 1; - uint supportsAlpha : 1; - -private: - friend class QProxyScreenCursor; -}; - -#endif // QT_NO_QWS_CURSOR - -// A (used) chunk of offscreen memory - -class QPoolEntry -{ -public: - unsigned int start; - unsigned int end; - int clientId; -}; - -class QScreen; -class QScreenPrivate; -class QPixmapDataFactory; - -extern Q_GUI_EXPORT QScreen *qt_screen; -typedef void(*ClearCacheFunc)(QScreen *obj, int); - -class Q_GUI_EXPORT QScreen { - -public: - enum ClassId { LinuxFBClass, TransformedClass, VNCClass, MultiClass, - VFbClass, DirectFBClass, SvgalibClass, ProxyClass, - GLClass, IntfbClass, CustomClass = 1024 }; - - QScreen(int display_id, ClassId classId); - explicit QScreen(int display_id); - virtual ~QScreen(); - static QScreen* instance() { return qt_screen; } - virtual bool initDevice() = 0; - virtual bool connect(const QString &displaySpec) = 0; - virtual void disconnect() = 0; - virtual void shutdownDevice(); - virtual void setMode(int,int,int) = 0; - virtual bool supportsDepth(int) const; - - virtual void save(); - virtual void restore(); - virtual void blank(bool on); - - virtual int pixmapOffsetAlignment() { return 64; } - virtual int pixmapLinestepAlignment() { return 64; } - virtual int sharedRamSize(void *) { return 0; } - - virtual bool onCard(const unsigned char *) const; - virtual bool onCard(const unsigned char *, ulong& out_offset) const; - - enum PixelType { NormalPixel, BGRPixel }; - - // sets a single color in the colormap - virtual void set(unsigned int,unsigned int,unsigned int,unsigned int); - // allocates a color - virtual int alloc(unsigned int,unsigned int,unsigned int); - - int width() const { return w; } - int height() const { return h; } - int depth() const { return d; } - virtual int pixmapDepth() const; - PixelType pixelType() const { return pixeltype; } - int linestep() const { return lstep; } - int deviceWidth() const { return dw; } - int deviceHeight() const { return dh; } - uchar * base() const { return data; } - // Ask for memory from card cache with alignment - virtual uchar * cache(int) { return 0; } - virtual void uncache(uchar *) {} - - QImage::Format pixelFormat() const; - - int screenSize() const { return size; } - int totalSize() const { return mapsize; } - - QRgb * clut() { return screenclut; } -#ifdef QT_DEPRECATED - QT_DEPRECATED int numCols() { return screencols; } -#endif - int colorCount() { return screencols; } - - virtual QSize mapToDevice(const QSize &) const; - virtual QSize mapFromDevice(const QSize &) const; - virtual QPoint mapToDevice(const QPoint &, const QSize &) const; - virtual QPoint mapFromDevice(const QPoint &, const QSize &) const; - virtual QRect mapToDevice(const QRect &, const QSize &) const; - virtual QRect mapFromDevice(const QRect &, const QSize &) const; - virtual QImage mapToDevice(const QImage &) const; - virtual QImage mapFromDevice(const QImage &) const; - virtual QRegion mapToDevice(const QRegion &, const QSize &) const; - virtual QRegion mapFromDevice(const QRegion &, const QSize &) const; - virtual int transformOrientation() const; - virtual bool isTransformed() const; - virtual bool isInterlaced() const; - - virtual void setDirty(const QRect&); - - virtual int memoryNeeded(const QString&); - - virtual void haltUpdates(); - virtual void resumeUpdates(); - - // composition manager methods - virtual void exposeRegion(QRegion r, int changing); - - // these work directly on the screen - virtual void blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion); - virtual void solidFill(const QColor &color, const QRegion ®ion); - void blit(QWSWindow *bs, const QRegion &clip); - - virtual QWSWindowSurface* createSurface(QWidget *widget) const; - virtual QWSWindowSurface* createSurface(const QString &key) const; - - virtual QList subScreens() const { return QList(); } - virtual QRegion region() const { return QRect(offset(), QSize(w, h)); } - int subScreenIndexAt(const QPoint &p) const; - - void setOffset(const QPoint &p); - QPoint offset() const; - - int physicalWidth() const { return physWidth; } // physical display size in mm - int physicalHeight() const { return physHeight; } // physical display size in mm - - QPixmapDataFactory* pixmapDataFactory() const; // Deprecated, will be removed in 4.6 - QGraphicsSystem* graphicsSystem() const; - -#ifdef QT_QWS_CLIENTBLIT - bool supportsBlitInClients() const; - void setSupportsBlitInClients(bool); -#endif - - ClassId classId() const; - -protected: - void setPixelFormat(QImage::Format format); - void setPixmapDataFactory(QPixmapDataFactory *factory); // Deprecated, will be removed in 4.6 - void setGraphicsSystem(QGraphicsSystem* system); - - QRgb screenclut[256]; - int screencols; - - uchar * data; - - // Table of allocated lumps, kept in sorted highest-to-lowest order - // The table itself is allocated at the bottom of offscreen memory - // i.e. it's similar to having a stack (the table) and a heap - // (the allocated blocks). Freed space is implicitly described - // by the gaps between the allocated lumps (this saves entries and - // means we don't need to worry about coalescing freed lumps) - - QPoolEntry * entries; - int * entryp; - unsigned int * lowest; - - 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; - - friend class QWSServer; - friend class QWSServerPrivate; - static ClearCacheFunc clearCacheFunc; - -private: - void compose(int level, const QRegion &exposed, QRegion &blend, - QImage **blendbuffer, int changing_level); - void paintBackground(const QRegion &); - - friend class QWSOnScreenSurface; - static bool isWidgetPaintOnScreen(const QWidget *w); - -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - void setFrameBufferLittleEndian(bool littleEndian); - bool frameBufferLittleEndian() const; - friend class QVNCScreen; - friend class QLinuxFbScreen; - friend class QVFbScreen; - friend class QProxyScreen; - friend class QIntfbScreen; -#endif - friend void qt_solidFill_setup(QScreen*, const QColor&, const QRegion&); - friend void qt_blit_setup(QScreen *screen, const QImage &image, - const QPoint &topLeft, const QRegion ®ion); -#ifdef QT_QWS_DEPTH_GENERIC - friend void qt_set_generic_blit(QScreen *screen, int bpp, - int len_red, int len_green, int len_blue, - int len_alpha, int off_red, int off_green, - int off_blue, int off_alpha); -#endif - - QScreenPrivate *d_ptr; -}; - -// This lives in loadable modules - -#ifndef QT_LOADABLE_MODULES -extern "C" QScreen * qt_get_screen(int display_id, const char* spec); -#endif - -// This is in main lib, loads the right module, calls qt_get_screen -// In non-loadable cases just aliases to qt_get_screen - -const unsigned char * qt_probe_bus(); - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSCREEN_QWS_H diff --git a/src/gui/embedded/qscreendriverfactory_qws.cpp b/src/gui/embedded/qscreendriverfactory_qws.cpp deleted file mode 100644 index 710505a1757..00000000000 --- a/src/gui/embedded/qscreendriverfactory_qws.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qscreendriverfactory_qws.h" - -#include "qscreen_qws.h" -#include "qapplication.h" -#include "qscreenlinuxfb_qws.h" -#include "qscreentransformed_qws.h" -#include "qscreenvfb_qws.h" -#include "qscreenmulti_qws_p.h" -#include "qscreenqnx_qws.h" -#include "qscreenintegrityfb_qws.h" -#include -#include "private/qfactoryloader_p.h" -#include "qscreendriverplugin_qws.h" -#ifndef QT_NO_QWS_DIRECTFB -#include "qdirectfbscreen.h" -#endif -#ifndef QT_NO_QWS_VNC -#include "qscreenvnc_qws.h" -#endif - -QT_BEGIN_NAMESPACE - -#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) -#ifndef QT_NO_LIBRARY - -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QScreenDriverFactoryInterface_iid, - QLatin1String("/gfxdrivers"), Qt::CaseInsensitive)) - -#endif //QT_NO_LIBRARY -#endif //QT_MAKEDLL - -/*! - \class QScreenDriverFactory - \ingroup qws - - \brief The QScreenDriverFactory class creates screen drivers in - Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - QScreenDriverFactory is used to detect and instantiate the - available screen drivers, allowing \l{Qt for Embedded Linux} to load the - preferred driver into the server application at runtime. The - create() function returns a QScreen object representing the screen - driver identified by a given key. The valid keys (i.e. the - supported drivers) can be retrieved using the keys() function. - - - \l{Qt for Embedded Linux} provides several built-in screen drivers. In - addition, custom screen drivers can be added using Qt's plugin - mechanism, i.e. by subclassing the QScreen class and creating a - screen driver plugin (QScreenDriverPlugin). See the - \l{Qt for Embedded Linux Display Management}{display management} - documentation for details. - - \sa QScreen, QScreenDriverPlugin -*/ - -/*! - Creates the screen driver specified by the given \a key, using the - display specified by the given \a displayId. - - Note that the keys are case-insensitive. - - \sa keys() -*/ -QScreen *QScreenDriverFactory::create(const QString& key, int displayId) -{ - QString driver = key.toLower(); -#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_QNX) - if (driver == QLatin1String("qnx") || driver.isEmpty()) - return new QQnxScreen(displayId); -#endif -#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_INTEGRITY) - if (driver == QLatin1String("integrityfb") || driver.isEmpty()) - return new QIntfbScreen(displayId); -#endif -#ifndef QT_NO_QWS_QVFB - if (driver == QLatin1String("qvfb") || driver.isEmpty()) - return new QVFbScreen(displayId); -#endif -#ifndef QT_NO_QWS_LINUXFB - if (driver == QLatin1String("linuxfb") || driver.isEmpty()) - return new QLinuxFbScreen(displayId); -#endif -#ifndef QT_NO_QWS_DIRECTFB - if (driver == QLatin1String("directfb") || driver.isEmpty()) - return new QDirectFBScreen(displayId); -#endif -#ifndef QT_NO_QWS_TRANSFORMED - if (driver == QLatin1String("transformed")) - return new QTransformedScreen(displayId); -#endif -#ifndef QT_NO_QWS_VNC - if (driver == QLatin1String("vnc")) - return new QVNCScreen(displayId); -#endif -#ifndef QT_NO_QWS_MULTISCREEN - if (driver == QLatin1String("multi")) - return new QMultiScreen(displayId); -#endif -#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) -#ifndef QT_NO_LIBRARY - - if (QScreenDriverFactoryInterface *factory = qobject_cast(loader()->instance(key))) - return factory->create(driver, displayId); - -#endif -#endif - return 0; -} - -/*! - Returns the list of valid keys, i.e. the available screen drivers. - - \sa create() -*/ -QStringList QScreenDriverFactory::keys() -{ - QStringList list; - -#if defined(Q_OS_QNX) && !defined(QT_NO_QWS_QNX) - list << QLatin1String("QNX"); -#endif -#if defined(Q_OS_INTEGRITY) && !defined(QT_NO_QWS_INTEGRITY) - list << QLatin1String("INTEGRITYFB"); -#endif -#ifndef QT_NO_QWS_QVFB - list << QLatin1String("QVFb"); -#endif -#ifndef QT_NO_QWS_LINUXFB - list << QLatin1String("LinuxFb"); -#endif -#ifndef QT_NO_QWS_TRANSFORMED - list << QLatin1String("Transformed"); -#endif -#ifndef QT_NO_QWS_VNC - list << QLatin1String("VNC"); -#endif -#ifndef QT_NO_QWS_MULTISCREEN - list << QLatin1String("Multi"); -#endif - -#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL) -#ifndef QT_NO_LIBRARY - QStringList plugins = loader()->keys(); - for (int i = 0; i < plugins.size(); ++i) { -# ifdef QT_NO_QWS_QVFB - // give QVFb top priority for autodetection - if (plugins.at(i) == QLatin1String("QVFb")) - list.prepend(plugins.at(i)); - else -# endif - 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/embedded/qscreendriverfactory_qws.h b/src/gui/embedded/qscreendriverfactory_qws.h deleted file mode 100644 index f51cecf2f6f..00000000000 --- a/src/gui/embedded/qscreendriverfactory_qws.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSCREENDRIVERFACTORY_QWS_H -#define QSCREENDRIVERFACTORY_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QString; -class QScreen; - -class Q_GUI_EXPORT QScreenDriverFactory -{ -public: - static QStringList keys(); - static QScreen *create(const QString&, int); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSCREENDRIVERFACTORY_QWS_H diff --git a/src/gui/embedded/qscreendriverplugin_qws.cpp b/src/gui/embedded/qscreendriverplugin_qws.cpp deleted file mode 100644 index ace8d1ee08b..00000000000 --- a/src/gui/embedded/qscreendriverplugin_qws.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qscreendriverplugin_qws.h" - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_LIBRARY - -/*! - \class QScreenDriverPlugin - \ingroup plugins - \ingroup qws - - \brief The QScreenDriverPlugin class is an abstract base class for - screen driver plugins in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - \l{Qt for Embedded Linux} provides ready-made drivers for several screen - protocols, see the \l{Qt for Embedded Linux Display Management}{display - management} documentation for details. Custom screen drivers can be - implemented by subclassing the QScreen class and creating a screen - driver plugin. - - A screen driver plugin can be created by subclassing - QScreenDriverPlugin 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 - QScreenDriverFactory 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 QScreen, QScreenDriverFactory -*/ - -/*! - \fn QStringList QScreenDriverPlugin::keys() const - - Implement this function to return the list of valid keys, i.e. the - screen drivers supported by this plugin. - - \l{Qt for Embedded Linux} provides ready-made drivers for several screen - protocols, see the \l{Qt for Embedded Linux Display Management}{display - management} documentation for details. - - \sa create() -*/ - -/*! - Constructs a screen driver 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. -*/ -QScreenDriverPlugin::QScreenDriverPlugin(QObject *parent) - : QObject(parent) -{ -} - -/*! - Destroys this screen driver plugin. - - Note that Qt destroys a plugin automatically when it is no longer - used, so there is no need for calling the destructor explicitly. -*/ -QScreenDriverPlugin::~QScreenDriverPlugin() -{ -} - - -/*! - \fn QScreen* QScreenDriverPlugin::create(const QString &key, int displayId) - - Implement this function to create a driver matching the type - specified by the given \a key and \a displayId parameters. Note - that keys are case-insensitive. - - \sa keys() -*/ - -#endif // QT_NO_LIBRARY - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qscreenintegrityfb_qws.cpp b/src/gui/embedded/qscreenintegrityfb_qws.cpp deleted file mode 100644 index 6f3081291b4..00000000000 --- a/src/gui/embedded/qscreenintegrityfb_qws.cpp +++ /dev/null @@ -1,405 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT_NO_QWS_INTEGRITYFB - -#include -#include -#include -#include -#include -#include "qmouseintegrity_qws.h" -#include "qkbdintegrity_qws.h" -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -class QIntfbScreenPrivate -{ -public: - QIntfbScreenPrivate(); - ~QIntfbScreenPrivate(); - - FBHandle handle; - struct FBInfoStruct fbinfo; - - QWSMouseHandler *mouse; -#ifndef QT_NO_QWS_KEYBOARD - QWSKeyboardHandler *keyboard; -#endif -}; - -QIntfbScreenPrivate::QIntfbScreenPrivate() - : mouse(0) - -{ -#ifndef QT_NO_QWS_KEYBOARD - keyboard = 0; -#endif -} - -QIntfbScreenPrivate::~QIntfbScreenPrivate() -{ - delete mouse; -#ifndef QT_NO_QWS_KEYBOARD - delete keyboard; -#endif -} - -/*! - \internal - - \class QIntfbScreen - \ingroup qws - - \brief The QIntfbScreen class implements a screen driver for the - INTEGRITY framebuffer drivers. - - Note that this class is only available in \l{Qt for INTEGRITY}. - Custom screen drivers can be added by subclassing the - QScreenDriverPlugin class, using the QScreenDriverFactory class to - dynamically load the driver into the application, but there should - only be one screen object per application. - - \sa QScreen, QScreenDriverPlugin, {Running Applications} -*/ - -/*! - \fn bool QIntfbScreen::connect(const QString & displaySpec) - \reimp -*/ - -/*! - \fn void QIntfbScreen::disconnect() - \reimp -*/ - -/*! - \fn bool QIntfbScreen::initDevice() - \reimp -*/ - -/*! - \fn void QIntfbScreen::restore() - \reimp -*/ - -/*! - \fn void QIntfbScreen::save() - \reimp -*/ - -/*! - \fn void QIntfbScreen::setDirty(const QRect & r) - \reimp -*/ - -/*! - \fn void QIntfbScreen::setMode(int nw, int nh, int nd) - \reimp -*/ - -/*! - \fn void QIntfbScreen::shutdownDevice() - \reimp -*/ - -/*! - \fn QIntfbScreen::QIntfbScreen(int displayId) - - Constructs a QVNCScreen object. The \a displayId argument - identifies the Qt for Embedded Linux server to connect to. -*/ -QIntfbScreen::QIntfbScreen(int display_id) - : QScreen(display_id, IntfbClass), d_ptr(new QIntfbScreenPrivate) -{ - d_ptr->handle = 0; - data = 0; -} - -/*! - Destroys this QIntfbScreen object. -*/ -QIntfbScreen::~QIntfbScreen() -{ - delete d_ptr; -} - -static QIntfbScreen *connected = 0; - -bool QIntfbScreen::connect(const QString &displaySpec) -{ - FBDriver *fbdev; - - CheckSuccess(gh_FB_get_driver(0, &fbdev)); - CheckSuccess(gh_FB_init_device(fbdev, 0, &d_ptr->handle)); - CheckSuccess(gh_FB_get_info(d_ptr->handle, &d_ptr->fbinfo)); - - data = (uchar *)d_ptr->fbinfo.start; - - d = d_ptr->fbinfo.bitsperpixel; - switch (d) { - case 1: - setPixelFormat(QImage::Format_Mono); - break; - case 8: - setPixelFormat(QImage::Format_Indexed8); - break; - case 12: - setPixelFormat(QImage::Format_RGB444); - break; - case 15: - setPixelFormat(QImage::Format_RGB555); - break; - case 16: - setPixelFormat(QImage::Format_RGB16); - break; - case 18: - setPixelFormat(QImage::Format_RGB666); - break; - case 24: - setPixelFormat(QImage::Format_RGB888); -#ifdef QT_QWS_DEPTH_GENERIC -#if Q_BYTE_ORDER != Q_BIG_ENDIAN - qt_set_generic_blit(this, 24, - d_ptr->fbinfo.redbits, - d_ptr->fbinfo.greenbits, - d_ptr->fbinfo.bluebits, - d_ptr->fbinfo.alphabits, - d_ptr->fbinfo.redoffset, - d_ptr->fbinfo.greenoffset, - d_ptr->fbinfo.blueoffset, - d_ptr->fbinfo.alphaoffset); -#else - qt_set_generic_blit(this, 24, - d_ptr->fbinfo.redbits, - d_ptr->fbinfo.greenbits, - d_ptr->fbinfo.bluebits, - d_ptr->fbinfo.alphabits, - 16 - d_ptr->fbinfo.redoffset, - 16 - d_ptr->fbinfo.greenoffset, - 16 - d_ptr->fbinfo.blueoffset, - d_ptr->fbinfo.alphaoffset); -#endif -#endif - break; - case 32: - setPixelFormat(QImage::Format_ARGB32_Premultiplied); -#ifdef QT_QWS_DEPTH_GENERIC -#if Q_BYTE_ORDER != Q_BIG_ENDIAN - qt_set_generic_blit(this, 32, - d_ptr->fbinfo.redbits, - d_ptr->fbinfo.greenbits, - d_ptr->fbinfo.bluebits, - d_ptr->fbinfo.alphabits, - d_ptr->fbinfo.redoffset, - d_ptr->fbinfo.greenoffset, - d_ptr->fbinfo.blueoffset, - d_ptr->fbinfo.alphaoffset); -#else - qt_set_generic_blit(this, 32, - d_ptr->fbinfo.redbits, - d_ptr->fbinfo.greenbits, - d_ptr->fbinfo.bluebits, - d_ptr->fbinfo.alphabits, - 24 - d_ptr->fbinfo.redoffset, - 24 - d_ptr->fbinfo.greenoffset, - 24 - d_ptr->fbinfo.blueoffset, - d_ptr->fbinfo.alphaoffset ? 24 - d_ptr->fbinfo.alphaoffset : 0); -#endif -#endif - break; - } - - dw = w = d_ptr->fbinfo.width; - dh = h = d_ptr->fbinfo.height; - - /* assumes no padding */ - lstep = w * ((d + 7) >> 3); - - mapsize = size = h * lstep; - - /* default values */ - int dpi = 72; - physWidth = qRound(dw * 25.4 / dpi); - physHeight = qRound(dh * 25.4 / dpi); - - qDebug("Connected to INTEGRITYfb server: %d x %d x %d %dx%dmm (%dx%ddpi)", - w, h, d, physWidth, physHeight, qRound(dw*25.4/physWidth), qRound(dh*25.4/physHeight) ); - - - QWSServer::setDefaultMouse("integrity"); - QWSServer::setDefaultKeyboard("integrity"); - - connected = this; - - return true; -} - -void QIntfbScreen::disconnect() -{ - connected = 0; -} - -bool QIntfbScreen::initDevice() -{ - - CheckSuccess(gh_FB_set_info(d_ptr->handle, &d_ptr->fbinfo, false)); - CheckSuccess(gh_FB_get_info(d_ptr->handle, &d_ptr->fbinfo)); - data = (uchar *)d_ptr->fbinfo.start; - d = d_ptr->fbinfo.bitsperpixel; - dw = w = d_ptr->fbinfo.width; - dh = h = d_ptr->fbinfo.height; - mapsize = d_ptr->fbinfo.length; - /* assumes no padding */ - lstep = w * ((d + 7) >> 3); - - mapsize = size = h * lstep; - - data = (uchar *)d_ptr->fbinfo.start; - - d = d_ptr->fbinfo.bitsperpixel; - switch (d) { - case 1: - setPixelFormat(QImage::Format_Mono); - break; - case 8: - setPixelFormat(QImage::Format_Indexed8); - break; - case 12: - setPixelFormat(QImage::Format_RGB444); - break; - case 15: - setPixelFormat(QImage::Format_RGB555); - break; - case 16: - setPixelFormat(QImage::Format_RGB16); - break; - case 18: - setPixelFormat(QImage::Format_RGB666); - break; - case 24: - setPixelFormat(QImage::Format_RGB888); - break; - case 32: - setPixelFormat(QImage::Format_ARGB32_Premultiplied); - break; - } -#ifdef QT_QWS_DEPTH_GENERIC -#if defined(__BIG_ENDIAN__) - qt_set_generic_blit(this, d, - d_ptr->fbinfo.redbits, - d_ptr->fbinfo.greenbits, - d_ptr->fbinfo.bluebits, - d_ptr->fbinfo.alphabits, - 24 - d_ptr->fbinfo.redoffset, - 24 - d_ptr->fbinfo.greenoffset, - 24 - d_ptr->fbinfo.blueoffset, - d_ptr->fbinfo.alphaoffset ? 24 - d_ptr->fbinfo.alphaoffset : 0); -#else - qt_set_generic_blit(this, d, - d_ptr->fbinfo.redbits, - d_ptr->fbinfo.greenbits, - d_ptr->fbinfo.bluebits, - d_ptr->fbinfo.alphabits, - d_ptr->fbinfo.redoffset, - d_ptr->fbinfo.greenoffset, - d_ptr->fbinfo.blueoffset, - d_ptr->fbinfo.alphaoffset); -#endif -#endif - -#ifndef QT_NO_QWS_CURSOR - QScreenCursor::initSoftwareCursor(); -#endif - return true; -} - -void QIntfbScreen::shutdownDevice() -{ - gh_FB_close(d_ptr->handle); -} - -void QIntfbScreen::setMode(int ,int ,int) -{ -} - -// save the state of the graphics card -// This is needed so that e.g. we can restore the palette when switching -// between linux virtual consoles. -void QIntfbScreen::save() -{ - // nothing to do. -} - -// restore the state of the graphics card. -void QIntfbScreen::restore() -{ -} -void QIntfbScreen::setDirty(const QRect& rect) -{ - FBRect fbrect; - fbrect.dx = rect.x(); - fbrect.dy = rect.y(); - fbrect.width = rect.width(); - fbrect.height = rect.height(); - gh_FB_expose(d_ptr->handle, &fbrect); -} - -void QIntfbScreen::setBrightness(int b) -{ - if (connected) { - } -} - -void QIntfbScreen::blank(bool on) -{ -} - -#endif // QT_NO_QWS_INTEGRITYFB - -QT_END_NAMESPACE - diff --git a/src/gui/embedded/qscreenintegrityfb_qws.h b/src/gui/embedded/qscreenintegrityfb_qws.h deleted file mode 100644 index bc09e8ef1dc..00000000000 --- a/src/gui/embedded/qscreenintegrityfb_qws.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSCREENINTEGRITYFB_QWS_H -#define QSCREENINTEGRITYFB_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_QWS_INTEGRITYFB - -class QIntfbScreenPrivate; - -class Q_GUI_EXPORT QIntfbScreen : public QScreen -{ -public: - explicit QIntfbScreen(int display_id); - virtual ~QIntfbScreen(); - virtual bool initDevice(); - virtual bool connect(const QString &displaySpec); - virtual void disconnect(); - virtual void shutdownDevice(); - virtual void save(); - virtual void restore(); - virtual void setMode(int nw,int nh,int nd); - virtual void setDirty(const QRect& r); - virtual void blank(bool); - static void setBrightness(int b); - -private: - QIntfbScreenPrivate *d_ptr; -}; - -#endif // QT_NO_QWS_INTEGRITYFB - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSCREENINTEGRITYFB_QWS_H diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp deleted file mode 100644 index 67c8a31cd94..00000000000 --- a/src/gui/embedded/qscreenlinuxfb_qws.cpp +++ /dev/null @@ -1,1386 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qscreenlinuxfb_qws.h" - -#ifndef QT_NO_QWS_LINUXFB -//#include "qmemorymanager_qws.h" -#include "qwsdisplay_qws.h" -#include "qpixmap.h" -#include -#include // overrides QT_OPEN - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "qwindowsystem_qws.h" - -#if !defined(Q_OS_DARWIN) && !defined(Q_OS_FREEBSD) -#include - -#ifdef __i386__ -#include -#endif -#endif - -QT_BEGIN_NAMESPACE - -extern int qws_client_id; - -//#define DEBUG_CACHE - -class QLinuxFbScreenPrivate : public QObject -{ -public: - QLinuxFbScreenPrivate(); - ~QLinuxFbScreenPrivate(); - - void openTty(); - void closeTty(); - - int fd; - int startupw; - int startuph; - int startupd; - bool blank; - QLinuxFbScreen::DriverTypes driverType; - - bool doGraphicsMode; -#ifdef QT_QWS_DEPTH_GENERIC - bool doGenericColors; -#endif - int ttyfd; - long oldKdMode; - QString ttyDevice; - QString displaySpec; -}; - -QLinuxFbScreenPrivate::QLinuxFbScreenPrivate() - : fd(-1), blank(true), doGraphicsMode(true), -#ifdef QT_QWS_DEPTH_GENERIC - doGenericColors(false), -#endif - ttyfd(-1), oldKdMode(KD_TEXT) -{ - QWSSignalHandler::instance()->addObject(this); -} - -QLinuxFbScreenPrivate::~QLinuxFbScreenPrivate() -{ - closeTty(); -} - -void QLinuxFbScreenPrivate::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 QLinuxFbScreenPrivate::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; -} - -/*! - \enum QLinuxFbScreen::DriverTypes - - This enum describes the driver type. - - \value GenericDriver Generic Linux framebuffer driver - \value EInk8Track e-Ink framebuffer driver using the 8Track chipset - */ - -/*! - \fn QLinuxFbScreen::fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo) - - Adjust the values returned by the framebuffer driver, to work - around driver bugs or nonstandard behavior in certain drivers. - \a finfo and \a vinfo specify the fixed and variable screen info - returned by the driver. - */ -void QLinuxFbScreen::fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo) -{ - // 8Track e-ink devices (as found in Sony PRS-505) lie - // about their bit depth -- they claim they're 1 bit per - // pixel while the only supported mode is 8 bit per pixel - // grayscale. - // Caused by this, they also miscalculate their line length. - if(!strcmp(finfo.id, "8TRACKFB") && vinfo.bits_per_pixel == 1) { - vinfo.bits_per_pixel = 8; - finfo.line_length = vinfo.xres; - } -} - -/*! - \internal - - \class QLinuxFbScreen - \ingroup qws - - \brief The QLinuxFbScreen class implements a screen driver for the - Linux framebuffer. - - Note that this class is only available in \l{Qt for Embedded Linux}. - Custom screen drivers can be added by subclassing the - QScreenDriverPlugin class, using the QScreenDriverFactory class to - dynamically load the driver into the application, but there should - only be one screen object per application. - - The QLinuxFbScreen class provides the cache() function allocating - off-screen graphics memory, and the complementary uncache() - function releasing the allocated memory. The latter function will - first sync the graphics card to ensure the memory isn't still - being used by a command in the graphics card FIFO queue. The - deleteEntry() function deletes the given memory block without such - synchronization. Given the screen instance and client id, the - memory can also be released using the clearCache() function, but - this should only be necessary if a client exits abnormally. - - In addition, when in paletted graphics modes, the set() function - provides the possibility of setting a specified color index to a - given RGB value. - - The QLinuxFbScreen class also acts as a factory for the - unaccelerated screen cursor and the unaccelerated raster-based - implementation of QPaintEngine (\c QRasterPaintEngine); - accelerated drivers for Linux should derive from this class. - - \sa QScreen, QScreenDriverPlugin, {Running Applications} -*/ - -/*! - \fn bool QLinuxFbScreen::useOffscreen() - \internal -*/ - -// Unaccelerated screen/driver setup. Can be overridden by accelerated -// drivers - -/*! - \fn QLinuxFbScreen::QLinuxFbScreen(int displayId) - - Constructs a QLinuxFbScreen object. The \a displayId argument - identifies the Qt for Embedded Linux server to connect to. -*/ - -QLinuxFbScreen::QLinuxFbScreen(int display_id) - : QScreen(display_id, LinuxFBClass), d_ptr(new QLinuxFbScreenPrivate) -{ - canaccel=false; - clearCacheFunc = &clearCache; -#ifdef QT_QWS_CLIENTBLIT - setSupportsBlitInClients(true); -#endif -} - -/*! - Destroys this QLinuxFbScreen object. -*/ - -QLinuxFbScreen::~QLinuxFbScreen() -{ -} - -/*! - \reimp - - This is called by \l{Qt for Embedded Linux} clients to map in the framebuffer. - It should be reimplemented by accelerated drivers to map in - graphics card registers; those drivers should then call this - function in order to set up offscreen memory management. The - device is specified in \a displaySpec; e.g. "/dev/fb". - - \sa disconnect() -*/ - -bool QLinuxFbScreen::connect(const QString &displaySpec) -{ - d_ptr->displaySpec = 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 Q_BYTE_ORDER == Q_BIG_ENDIAN -#ifndef QT_QWS_FRAMEBUFFER_LITTLE_ENDIAN - if (args.contains(QLatin1String("littleendian"))) -#endif - QScreen::setFrameBufferLittleEndian(true); -#endif - - QString dev = QLatin1String("/dev/fb0"); - foreach(QString d, args) { - if (d.startsWith(QLatin1Char('/'))) { - dev = d; - break; - } - } - - 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 (QApplication::type() == QApplication::GuiServer) { - perror("QScreenLinuxFb::connect"); - qCritical("Error opening framebuffer device %s", qPrintable(dev)); - return false; - } - if (access(dev.toLatin1().constData(), R_OK) == 0) - d_ptr->fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY); - } - - ::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("QLinuxFbScreen::connect"); - qWarning("Error reading fixed information"); - return false; - } - - d_ptr->driverType = strcmp(finfo.id, "8TRACKFB") ? GenericDriver : EInk8Track; - - 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("QLinuxFbScreen::connect"); - qWarning("Error reading variable information"); - return false; - } - - fixupScreenInfo(finfo, vinfo); - - 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 > vinfo.xres) - xxoff = vinfo.xres - w; - if (yyoff < 0 || yyoff + h > 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("QScreenLinuxFb::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) { - if (QApplication::type() == QApplication::GuiServer) { - perror("QLinuxFbScreen::connect"); - qWarning("Error: failed to map framebuffer device to memory."); - return false; - } - data = 0; - } else { - data += dataoffset; - } - - canaccel = useOffscreen(); - if(canaccel) - setupOffScreen(); - - // 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("QLinuxFbScreen::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;loopcfd); -} - -// #define DEBUG_VINFO - -void QLinuxFbScreen::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;iopenTty(); - - // 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 - - 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; - } - - fixupScreenInfo(finfo, vinfo); - - d_ptr->startupw=vinfo.xres; - d_ptr->startuph=vinfo.yres; - d_ptr->startupd=vinfo.bits_per_pixel; - grayscale = vinfo.grayscale; - -#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 (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; - -#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 - -#ifndef QT_NO_QWS_CURSOR - QScreenCursor::initSoftwareCursor(); -#endif - blank(false); - - return true; -} - -/* - The offscreen memory manager's list of entries is stored at the bottom - of the offscreen memory area and consistes of a series of QPoolEntry's, - each of which keep track of a block of allocated memory. Unallocated memory - is implicitly indicated by the gap between blocks indicated by QPoolEntry's. - The memory manager looks through any unallocated memory before the end - of currently-allocated memory to see if a new block will fit in the gap; - if it doesn't it allocated it from the end of currently-allocated memory. - Memory is allocated from the top of the framebuffer downwards; if it hits - the list of entries then offscreen memory is full and further allocations - are made from main RAM (and hence unaccelerated). Allocated memory can - be seen as a sort of upside-down stack; lowest keeps track of the - bottom of the stack. -*/ - -void QLinuxFbScreen::delete_entry(int pos) -{ - if (pos > *entryp || pos < 0) { - qWarning("Attempt to delete odd pos! %d %d", pos, *entryp); - return; - } - -#ifdef DEBUG_CACHE - qDebug("Remove entry: %d", pos); -#endif - - QPoolEntry *qpe = &entries[pos]; - if (qpe->start <= *lowest) { - // Lowest goes up again - *lowest = entries[pos-1].start; -#ifdef DEBUG_CACHE - qDebug(" moved lowest to %d", *lowest); -#endif - } - - (*entryp)--; - if (pos == *entryp) - return; - - int size = (*entryp)-pos; - memmove(&entries[pos], &entries[pos+1], size*sizeof(QPoolEntry)); -} - -void QLinuxFbScreen::insert_entry(int pos, int start, int end) -{ - if (pos > *entryp) { - qWarning("Attempt to insert odd pos! %d %d",pos,*entryp); - return; - } - -#ifdef DEBUG_CACHE - qDebug("Insert entry: %d, %d -> %d", pos, start, end); -#endif - - if (start < (int)*lowest) { - *lowest = start; -#ifdef DEBUG_CACHE - qDebug(" moved lowest to %d", *lowest); -#endif - } - - if (pos == *entryp) { - entries[pos].start = start; - entries[pos].end = end; - entries[pos].clientId = qws_client_id; - (*entryp)++; - return; - } - - int size=(*entryp)-pos; - memmove(&entries[pos+1],&entries[pos],size*sizeof(QPoolEntry)); - entries[pos].start=start; - entries[pos].end=end; - entries[pos].clientId=qws_client_id; - (*entryp)++; -} - -/*! - \fn uchar * QLinuxFbScreen::cache(int amount) - - Requests the specified \a amount of offscreen graphics card memory - from the memory manager, and returns a pointer to the data within - the framebuffer (or 0 if there is no free memory). - - Note that the display is locked while memory is allocated in order to - preserve the memory pool's integrity. - - Use the QScreen::onCard() function to retrieve an offset (in - bytes) from the start of graphics card memory for the returned - pointer. - - \sa uncache(), clearCache(), deleteEntry() -*/ - -uchar * QLinuxFbScreen::cache(int amount) -{ - if (!canaccel || entryp == 0) - return 0; - - qt_fbdpy->grab(); - - int startp = cacheStart + (*entryp+1) * sizeof(QPoolEntry); - if (startp >= (int)*lowest) { - // We don't have room for another cache QPoolEntry. -#ifdef DEBUG_CACHE - qDebug("No room for pool entry in VRAM"); -#endif - qt_fbdpy->ungrab(); - return 0; - } - - int align = pixmapOffsetAlignment(); - - if (*entryp > 1) { - // Try to find a gap in the allocated blocks. - for (int loopc = 0; loopc < *entryp-1; loopc++) { - int freestart = entries[loopc+1].end; - int freeend = entries[loopc].start; - if (freestart != freeend) { - while (freestart % align) { - freestart++; - } - int len=freeend-freestart; - if (len >= amount) { - insert_entry(loopc+1, freestart, freestart+amount); - qt_fbdpy->ungrab(); - return data+freestart; - } - } - } - } - - // No free blocks in already-taken memory; get some more - // if we can - int newlowest = (*lowest)-amount; - if (newlowest % align) { - newlowest -= align; - while (newlowest % align) { - newlowest++; - } - } - if (startp >= newlowest) { - qt_fbdpy->ungrab(); -#ifdef DEBUG_CACHE - qDebug("No VRAM available for %d bytes", amount); -#endif - return 0; - } - insert_entry(*entryp, newlowest, *lowest); - qt_fbdpy->ungrab(); - - return data + newlowest; -} - -/*! - \fn void QLinuxFbScreen::uncache(uchar * memoryBlock) - - Deletes the specified \a memoryBlock allocated from the graphics - card memory. - - Note that the display is locked while memory is unallocated in - order to preserve the memory pool's integrity. - - This function will first sync the graphics card to ensure the - memory isn't still being used by a command in the graphics card - FIFO queue. It is possible to speed up a driver by overriding this - function to avoid syncing. For example, the driver might delay - deleting the memory until it detects that all commands dealing - with the memory are no longer in the queue. Note that it will then - be up to the driver to ensure that the specified \a memoryBlock no - longer is being used. - - \sa cache(), deleteEntry(), clearCache() - */ -void QLinuxFbScreen::uncache(uchar * c) -{ - // need to sync graphics card - - deleteEntry(c); -} - -/*! - \fn void QLinuxFbScreen::deleteEntry(uchar * memoryBlock) - - Deletes the specified \a memoryBlock allocated from the graphics - card memory. - - \sa uncache(), cache(), clearCache() -*/ -void QLinuxFbScreen::deleteEntry(uchar * c) -{ - qt_fbdpy->grab(); - unsigned long pos=(unsigned long)c; - pos-=((unsigned long)data); - unsigned int hold=(*entryp); - for(unsigned int loopc=1;loopcungrab(); - return; - } - } - qt_fbdpy->ungrab(); - qWarning("Attempt to delete unknown offset %ld",pos); -} - -/*! - Removes all entries from the cache for the specified screen \a - instance and client identified by the given \a clientId. - - Calling this function should only be necessary if a client exits - abnormally. - - \sa cache(), uncache(), deleteEntry() -*/ -void QLinuxFbScreen::clearCache(QScreen *instance, int clientId) -{ - QLinuxFbScreen *screen = (QLinuxFbScreen *)instance; - if (!screen->canaccel || !screen->entryp) - return; - qt_fbdpy->grab(); - for (int loopc = 0; loopc < *(screen->entryp); loopc++) { - if (screen->entries[loopc].clientId == clientId) { - screen->delete_entry(loopc); - loopc--; - } - } - qt_fbdpy->ungrab(); -} - - -void QLinuxFbScreen::setupOffScreen() -{ - // Figure out position of offscreen memory - // Set up pool entries pointer table and 64-bit align it - int psize = size; - - // hw: this causes the limitation of cursors to 64x64 - // the cursor should rather use the normal pixmap mechanism - psize += 4096; // cursor data - psize += 8; // for alignment - psize &= ~0x7; // align - - unsigned long pos = (unsigned long)data; - pos += psize; - entryp = ((int *)pos); - lowest = ((unsigned int *)pos)+1; - pos += (sizeof(int))*4; - entries = (QPoolEntry *)pos; - - // beginning of offscreen memory available for pixmaps. - cacheStart = psize + 4*sizeof(int) + sizeof(QPoolEntry); -} - -/*! - \reimp - - This is called by the \l{Qt for Embedded Linux} server when it shuts - down, and should be inherited if you need to do any card-specific cleanup. - The default version hides the screen cursor and reenables the blinking - cursor and screen blanking. -*/ - -void QLinuxFbScreen::shutdownDevice() -{ - // Causing crashes. Not needed. - //setMode(startupw,startuph,startupd); -/* - if (startupd == 8) { - ioctl(fd,FBIOPUTCMAP,startcmap); - free(startcmap->red); - free(startcmap->green); - free(startcmap->blue); - free(startcmap->transp); - delete startcmap; - startcmap = 0; - } -*/ - d_ptr->closeTty(); -} - -/*! - \fn void QLinuxFbScreen::set(unsigned int index,unsigned int red,unsigned int green,unsigned int blue) - - Sets the specified color \a index to the specified RGB value, (\a - red, \a green, \a blue), when in paletted graphics modes. -*/ - -void QLinuxFbScreen::set(unsigned int i,unsigned int r,unsigned int g,unsigned int b) -{ - if (d_ptr->fd != -1) { - fb_cmap cmap; - cmap.start=i; - cmap.len=1; - cmap.red=(unsigned short int *) - malloc(sizeof(unsigned short int)*256); - cmap.green=(unsigned short int *) - malloc(sizeof(unsigned short int)*256); - cmap.blue=(unsigned short int *) - malloc(sizeof(unsigned short int)*256); - cmap.transp=(unsigned short int *) - malloc(sizeof(unsigned short int)*256); - cmap.red[0]=r << 8; - cmap.green[0]=g << 8; - cmap.blue[0]=b << 8; - cmap.transp[0]=0; - ioctl(d_ptr->fd, FBIOPUTCMAP, &cmap); - free(cmap.red); - free(cmap.green); - free(cmap.blue); - free(cmap.transp); - } - screenclut[i] = qRgb(r, g, b); -} - -/*! - \reimp - - Sets the framebuffer to a new resolution and bit depth. The width is - in \a nw, the height is in \a nh, and the depth is in \a nd. After - doing this any currently-existing paint engines will be invalid and the - screen should be completely redrawn. In a multiple-process - Embedded Qt situation you must signal all other applications to - call setMode() to the same mode and redraw. -*/ - -void QLinuxFbScreen::setMode(int nw,int nh,int nd) -{ - if (d_ptr->fd == -1) - return; - - fb_fix_screeninfo finfo; - fb_var_screeninfo vinfo; - //####################### - // Shut up Valgrind - memset(&vinfo, 0, sizeof(vinfo)); - memset(&finfo, 0, sizeof(finfo)); - //####################### - - if (ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { - perror("QLinuxFbScreen::setMode"); - qFatal("Error reading variable information in mode change"); - } - - vinfo.xres=nw; - vinfo.yres=nh; - vinfo.bits_per_pixel=nd; - - if (ioctl(d_ptr->fd, FBIOPUT_VSCREENINFO, &vinfo)) { - perror("QLinuxFbScreen::setMode"); - qCritical("Error writing variable information in mode change"); - } - - if (ioctl(d_ptr->fd, FBIOGET_VSCREENINFO, &vinfo)) { - perror("QLinuxFbScreen::setMode"); - qFatal("Error reading changed variable information in mode change"); - } - - if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { - perror("QLinuxFbScreen::setMode"); - qFatal("Error reading fixed information"); - } - - fixupScreenInfo(finfo, vinfo); - disconnect(); - connect(d_ptr->displaySpec); - exposeRegion(region(), 0); -} - -// save the state of the graphics card -// This is needed so that e.g. we can restore the palette when switching -// between linux virtual consoles. - -/*! - \reimp - - This doesn't do anything; accelerated drivers may wish to reimplement - it to save graphics cards registers. It's called by the - \l{Qt for Embedded Linux} server when the virtual console is switched. -*/ - -void QLinuxFbScreen::save() -{ - // nothing to do. -} - - -// restore the state of the graphics card. -/*! - \reimp - - This is called when the virtual console is switched back to - \l{Qt for Embedded Linux} and restores the palette. -*/ -void QLinuxFbScreen::restore() -{ - if (d_ptr->fd == -1) - return; - - if ((d == 8) || (d == 4)) { - fb_cmap cmap; - cmap.start=0; - cmap.len=screencols; - cmap.red=(unsigned short int *) - malloc(sizeof(unsigned short int)*256); - cmap.green=(unsigned short int *) - malloc(sizeof(unsigned short int)*256); - cmap.blue=(unsigned short int *) - malloc(sizeof(unsigned short int)*256); - cmap.transp=(unsigned short int *) - malloc(sizeof(unsigned short int)*256); - for (int loopc = 0; loopc < screencols; loopc++) { - cmap.red[loopc] = qRed(screenclut[loopc]) << 8; - cmap.green[loopc] = qGreen(screenclut[loopc]) << 8; - cmap.blue[loopc] = qBlue(screenclut[loopc]) << 8; - cmap.transp[loopc] = 0; - } - ioctl(d_ptr->fd, FBIOPUTCMAP, &cmap); - free(cmap.red); - free(cmap.green); - free(cmap.blue); - free(cmap.transp); - } -} - -/*! - \fn int QLinuxFbScreen::sharedRamSize(void * end) - \internal -*/ - -// This works like the QScreenCursor code. end points to the end -// of our shared structure, we return the amount of memory we reserved -int QLinuxFbScreen::sharedRamSize(void * end) -{ - shared=(QLinuxFb_Shared *)end; - shared--; - return sizeof(QLinuxFb_Shared); -} - -/*! - \reimp -*/ -void QLinuxFbScreen::setDirty(const QRect &r) -{ - if(d_ptr->driverType == EInk8Track) { - // e-Ink displays need a trigger to actually show what is - // in their framebuffer memory. The 8-Track driver does this - // by adding custom IOCTLs - FBIO_EINK_DISP_PIC (0x46a2) takes - // an argument specifying whether or not to flash the screen - // while updating. - // There doesn't seem to be a way to tell it to just update - // a subset of the screen. - if(r.left() == 0 && r.top() == 0 && r.width() == dw && r.height() == dh) - ioctl(d_ptr->fd, 0x46a2, 1); - else - ioctl(d_ptr->fd, 0x46a2, 0); - } -} - -/*! - \reimp -*/ -void QLinuxFbScreen::blank(bool on) -{ - if (d_ptr->blank == 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; -} - -void QLinuxFbScreen::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 = QScreen::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 = QScreen::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 = QScreen::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 = QScreen::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; - } - - QScreen::setPixelFormat(format); -} - -bool QLinuxFbScreen::useOffscreen() -{ - // Not done for 8Track because on e-Ink displays, - // everything is offscreen anyway - if (d_ptr->driverType == EInk8Track || ((mapsize - size) < 16*1024)) - return false; - - return true; -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_LINUXFB diff --git a/src/gui/embedded/qscreenlinuxfb_qws.h b/src/gui/embedded/qscreenlinuxfb_qws.h deleted file mode 100644 index 9f45beff271..00000000000 --- a/src/gui/embedded/qscreenlinuxfb_qws.h +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSCREENLINUXFB_QWS_H -#define QSCREENLINUXFB_QWS_H - -#include - -struct fb_cmap; -struct fb_var_screeninfo; -struct fb_fix_screeninfo; - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_QWS_LINUXFB - -class QLinuxFb_Shared -{ -public: - volatile int lastop; - volatile int optype; - volatile int fifocount; // Accel drivers only - volatile int fifomax; - volatile int forecol; // Foreground colour caching - volatile unsigned int buffer_offset; // Destination - volatile int linestep; - volatile int cliptop; // Clip rectangle - volatile int clipleft; - volatile int clipright; - volatile int clipbottom; - volatile unsigned int rop; - -}; - -class QLinuxFbScreenPrivate; - -class Q_GUI_EXPORT QLinuxFbScreen : public QScreen -{ -public: - explicit QLinuxFbScreen(int display_id); - virtual ~QLinuxFbScreen(); - - virtual bool initDevice(); - virtual bool connect(const QString &displaySpec); - - virtual bool useOffscreen(); - - enum DriverTypes { GenericDriver, EInk8Track }; - - virtual void disconnect(); - virtual void shutdownDevice(); - virtual void setMode(int,int,int); - virtual void save(); - virtual void restore(); - virtual void blank(bool on); - virtual void set(unsigned int,unsigned int,unsigned int,unsigned int); - virtual uchar * cache(int); - virtual void uncache(uchar *); - virtual int sharedRamSize(void *); - virtual void setDirty(const QRect&); - - QLinuxFb_Shared * shared; - -protected: - - void deleteEntry(uchar *); - - bool canaccel; - int dataoffset; - int cacheStart; - - virtual void fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo); - static void clearCache(QScreen *instance, int); - -private: - - void delete_entry(int); - void insert_entry(int,int,int); - void setupOffScreen(); - void createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo); - void setPixelFormat(struct fb_var_screeninfo); - - QLinuxFbScreenPrivate *d_ptr; -}; - -#endif // QT_NO_QWS_LINUXFB - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSCREENLINUXFB_QWS_H diff --git a/src/gui/embedded/qscreenmulti_qws.cpp b/src/gui/embedded/qscreenmulti_qws.cpp deleted file mode 100644 index 303b7b807a1..00000000000 --- a/src/gui/embedded/qscreenmulti_qws.cpp +++ /dev/null @@ -1,486 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qscreenmulti_qws_p.h" - -#ifndef QT_NO_QWS_MULTISCREEN - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_QWS_CURSOR - -class QMultiScreenCursor : public QScreenCursor -{ -public: - QMultiScreenCursor() : currentCursor(qt_screencursor) { enable = false; } - ~QMultiScreenCursor() { qt_screencursor = 0; } - - void set(const QImage &image, int hotx, int hoty); - void move(int x, int y); - void show(); - void hide(); - - void addCursor(QScreenCursor *cursor); - -private: - void setCurrentCursor(QScreenCursor *newCursor); - - QScreenCursor *currentCursor; - QList cursors; -}; - -void QMultiScreenCursor::set(const QImage &image, int hotx, int hoty) -{ - QScreenCursor::set(image, hotx, hoty); - if (currentCursor) - currentCursor->set(image, hotx, hoty); -} - -void QMultiScreenCursor::setCurrentCursor(QScreenCursor *newCursor) -{ - *((QScreenCursor*)this) = *newCursor; - currentCursor = newCursor; -} - -// XXX: this is a mess! -void QMultiScreenCursor::move(int x, int y) -{ - const int oldIndex = qt_screen->subScreenIndexAt(pos); - QScreenCursor::move(x, y); // updates pos - const int newIndex = qt_screen->subScreenIndexAt(pos); - - if (!currentCursor && oldIndex != -1) - setCurrentCursor(cursors.at(oldIndex)); - QScreenCursor *oldCursor = currentCursor; - - if (oldIndex != -1) { - const QScreen *oldScreen = qt_screen->subScreens().at(oldIndex); - if (newIndex == -1 || oldScreen->region().contains(pos)) { - oldCursor->move(x, y); - return; - } - } - - if (newIndex != -1) { - QScreenCursor *newCursor = cursors.at(newIndex); - newCursor->set(cursor, hotspot.x(), hotspot.y()); - - if (oldCursor) { - if (oldCursor->isVisible()) - newCursor->show(); - oldCursor->hide(); - } - - newCursor->move(x, y); - - setCurrentCursor(newCursor); - } -} - -void QMultiScreenCursor::show() -{ - if (currentCursor) - currentCursor->show(); -} - -void QMultiScreenCursor::hide() -{ - if (currentCursor) - currentCursor->hide(); -} - -void QMultiScreenCursor::addCursor(QScreenCursor *cursor) -{ - cursors.append(cursor); -} - -#endif - -class QMultiScreenPrivate -{ -public: - QMultiScreenPrivate() -#ifndef QT_NO_QWS_CURSOR - : cursor(0) -#endif - {} - ~QMultiScreenPrivate() - { -#ifndef QT_NO_QWS_CURSOR - delete cursor; -#endif - } - - QList screens; - QRegion region; -#ifndef QT_NO_QWS_CURSOR - QMultiScreenCursor *cursor; -#endif -}; - -QMultiScreen::QMultiScreen(int displayId) - : QScreen(displayId, MultiClass), d_ptr(new QMultiScreenPrivate) -{ -} - -QMultiScreen::~QMultiScreen() -{ - delete d_ptr; -} - -bool QMultiScreen::initDevice() -{ - bool ok = true; - -#ifndef QT_NO_QWS_CURSOR - d_ptr->cursor = new QMultiScreenCursor; -#endif - - const int n = d_ptr->screens.count(); - for (int i = 0; i < n; ++i) { - QScreen *s = d_ptr->screens.at(i); - ok = s->initDevice() && ok; -#ifndef QT_NO_QWS_CURSOR - d_ptr->cursor->addCursor(qt_screencursor); // XXX -#endif - } - -#ifndef QT_NO_QWS_CURSOR - // XXX - qt_screencursor = d_ptr->cursor; -#endif - - return ok; -} - -static int getDisplayId(const QString &spec) -{ - QRegExp regexp(QLatin1String(":(\\d+)\\b")); - if (regexp.lastIndexIn(spec) != -1) { - const QString capture = regexp.cap(1); - return capture.toInt(); - } - return 0; -} - -static QPoint filterDisplayOffset(QString &spec) -{ - QRegExp regexp(QLatin1String(":offset=(\\d+),(\\d+)\\b")); - if (regexp.indexIn(spec) == -1) - return QPoint(); - - const int x = regexp.cap(1).toInt(); - const int y = regexp.cap(2).toInt(); - spec.remove(regexp.pos(0), regexp.matchedLength()); - return QPoint(x, y); -} - -bool QMultiScreen::connect(const QString &displaySpec) -{ - QString dSpec = displaySpec; - if (dSpec.startsWith(QLatin1String("Multi:"), Qt::CaseInsensitive)) - dSpec = dSpec.mid(QString::fromLatin1("Multi:").size()); - - const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId); - if (dSpec.endsWith(displayIdSpec)) - dSpec = dSpec.left(dSpec.size() - displayIdSpec.size()); - - QStringList specs = dSpec.split(QLatin1Char(' '), QString::SkipEmptyParts); - foreach (QString spec, specs) { - const int id = getDisplayId(spec); - if (spec.startsWith("vnc:", Qt::CaseInsensitive)) { - spec.append(":noDisablePainting"); - } - const QPoint offset = filterDisplayOffset(spec); - QScreen *s = qt_get_screen(id, spec.toLatin1().constData()); - s->setOffset(offset); - addSubScreen(s); - } - - QScreen *firstScreen = d_ptr->screens.at(0); - Q_ASSERT(firstScreen); - - // XXX - QScreen::d = firstScreen->depth(); - - QScreen::lstep = 0; - QScreen::data = 0; - QScreen::size = 0; - - QScreen::w = d_ptr->region.boundingRect().width(); - QScreen::h = d_ptr->region.boundingRect().height(); - - QScreen::dw = QScreen::w; - QScreen::dh = QScreen::h; - - // XXX - Extend the physical size based on the first screen - // to encompass all screens, so that code that uses the multi - // screen to calculate dpi values will get the right numbers. - QScreen::physWidth = firstScreen->physicalWidth() * w / firstScreen->width(); - QScreen::physHeight = firstScreen->physicalHeight() * h / firstScreen->height(); - - // XXXXX - qt_screen = this; - - return true; -} - -void QMultiScreen::disconnect() -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - d_ptr->screens.at(i)->disconnect(); -} - -void QMultiScreen::shutdownDevice() -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - d_ptr->screens.at(i)->shutdownDevice(); -} - -void QMultiScreen::setMode(int, int, int) -{ - return; -} - -bool QMultiScreen::supportsDepth(int) const -{ - return false; -} - -void QMultiScreen::save() -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - d_ptr->screens.at(i)->save(); -} - -void QMultiScreen::restore() -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - d_ptr->screens.at(i)->restore(); -} - -void QMultiScreen::blank(bool on) -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - d_ptr->screens.at(i)->blank(on); -} - -bool QMultiScreen::onCard(const unsigned char *ptr) const -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - if (d_ptr->screens.at(i)->onCard(ptr)) - return true; - return false; -} - -bool QMultiScreen::onCard(const unsigned char *ptr, ulong &offset) const -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - if (d_ptr->screens.at(i)->onCard(ptr, offset)) - return true; - return false; -} - -bool QMultiScreen::isInterlaced() const -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - if (d_ptr->screens.at(i)->isInterlaced()) - return true; - - return false; -} - -int QMultiScreen::memoryNeeded(const QString &string) -{ - int total = 0; - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - total += d_ptr->screens.at(i)->memoryNeeded(string); - return total; -} - -int QMultiScreen::sharedRamSize(void *arg) -{ - int total = 0; - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - total += d_ptr->screens.at(i)->sharedRamSize(arg); - return total; -} - -void QMultiScreen::haltUpdates() -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - d_ptr->screens.at(i)->haltUpdates(); -} - -void QMultiScreen::resumeUpdates() -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) - d_ptr->screens.at(i)->resumeUpdates(); -} - -void QMultiScreen::exposeRegion(QRegion region, int changing) -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) { - QScreen *screen = d_ptr->screens.at(i); - const QRegion r = region & screen->region(); - if (r.isEmpty()) - continue; - screen->exposeRegion(r, changing); - } -} - -void QMultiScreen::solidFill(const QColor &color, const QRegion ®ion) -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) { - QScreen *screen = d_ptr->screens.at(i); - const QRegion r = region & screen->region(); - if (r.isEmpty()) - continue; - screen->solidFill(color, r); - } -} - -void QMultiScreen::blit(const QImage &img, const QPoint &topLeft, - const QRegion ®ion) -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) { - QScreen *screen = d_ptr->screens.at(i); - const QRegion r = region & screen->region(); - if (r.isEmpty()) - continue; - screen->blit(img, topLeft, r); - } -} - -void QMultiScreen::blit(QWSWindow *bs, const QRegion &clip) -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) { - QScreen *screen = d_ptr->screens.at(i); - const QRegion r = clip & screen->region(); - if (r.isEmpty()) - continue; - screen->blit(bs, r); - } -} - -void QMultiScreen::setDirty(const QRect &rect) -{ - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) { - QScreen *screen = d_ptr->screens.at(i); - const QRegion r = screen->region() & rect; - if (r.isEmpty()) - continue; - screen->setDirty(r.boundingRect()); - } -} - - -QWSWindowSurface* QMultiScreen::createSurface(const QString &key) const -{ - QWSWindowSurface* surf = 0; - const int n = d_ptr->screens.size(); - for (int i = 0; i < n; ++i) { - QScreen *screen = d_ptr->screens.at(i); - surf = screen->createSurface(key); - if (surf) - break; - } - return surf; -} - - -QWSWindowSurface* QMultiScreen::createSurface(QWidget *widget) const -{ - const QPoint midpoint = (widget->frameGeometry().topLeft() - + widget->frameGeometry().bottomRight()) / 2; - int index = subScreenIndexAt(midpoint); - if (index == -1) - index = 0; // XXX - return d_ptr->screens.at(index)->createSurface(widget); -} - -QList QMultiScreen::subScreens() const -{ - return d_ptr->screens; -} - -QRegion QMultiScreen::region() const -{ - return d_ptr->region; -} - -void QMultiScreen::addSubScreen(QScreen *screen) -{ - d_ptr->screens.append(screen); - d_ptr->region += screen->region(); -} - -void QMultiScreen::removeSubScreen(QScreen *screen) -{ - d_ptr->screens.removeAll(screen); - d_ptr->region -= screen->region(); -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_MULTISCREEN diff --git a/src/gui/embedded/qscreenmulti_qws_p.h b/src/gui/embedded/qscreenmulti_qws_p.h deleted file mode 100644 index 0cc0493202b..00000000000 --- a/src/gui/embedded/qscreenmulti_qws_p.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMULTISCREEN_QWS_P_H -#define QMULTISCREEN_QWS_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 - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_QWS_MULTISCREEN - -class QMultiScreenPrivate; - -class QMultiScreen : public QScreen -{ -public: - QMultiScreen(int displayId); - ~QMultiScreen(); - bool initDevice(); - bool connect(const QString &displaySpec); - void disconnect(); - void shutdownDevice(); - void setMode(int,int,int); - bool supportsDepth(int) const; - - void save(); - void restore(); - void blank(bool on); - - bool onCard(const unsigned char *) const; - bool onCard(const unsigned char *, ulong& out_offset) const; - - bool isInterlaced() const; - - int memoryNeeded(const QString&); - int sharedRamSize(void *); - - void haltUpdates(); - void resumeUpdates(); - - void exposeRegion(QRegion r, int changing); - - void blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion); - void solidFill(const QColor &color, const QRegion ®ion); - void blit(QWSWindow *bs, const QRegion &clip); - void setDirty(const QRect&); - - QWSWindowSurface* createSurface(QWidget *widget) const; - QWSWindowSurface* createSurface(const QString &key) const; - - QList subScreens() const; - QRegion region() const; - -private: - void addSubScreen(QScreen *screen); - void removeSubScreen(QScreen *screen); - - QMultiScreenPrivate *d_ptr; -}; - - -QT_END_NAMESPACE -#endif // QT_NO_QWS_MULTISCREEN -#endif // QMULTISCREEN_QWS_P_H diff --git a/src/gui/embedded/qscreenproxy_qws.cpp b/src/gui/embedded/qscreenproxy_qws.cpp deleted file mode 100644 index 30f304b01cc..00000000000 --- a/src/gui/embedded/qscreenproxy_qws.cpp +++ /dev/null @@ -1,635 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#ifndef QT_NO_QWS_PROXYSCREEN - -#include - -QT_BEGIN_NAMESPACE -#ifndef QT_NO_QWS_CURSOR - -/*! - \class QProxyScreenCursor - \since 4.5 - \ingroup qws - \brief The QProxyScreenCursor class provides a generic interface to - QScreenCursor implementations. -*/ - -/*! - Constructs a proxy screen cursor. -*/ -QProxyScreenCursor::QProxyScreenCursor() - : QScreenCursor(), realCursor(0), d_ptr(0) -{ -} - -/*! - Destroys the proxy screen cursor. -*/ -QProxyScreenCursor::~QProxyScreenCursor() -{ -} - -/*! - Sets the real screen cursor to be used for the proxy screen cursor to - the \a cursor specified. - - \sa screenCursor() -*/ -void QProxyScreenCursor::setScreenCursor(QScreenCursor *cursor) -{ - realCursor = cursor; - configure(); -} - -/*! - Returns the real screen cursor used by the proxy screen cursor. - - \sa setScreenCursor() -*/ -QScreenCursor* QProxyScreenCursor::screenCursor() const -{ - return realCursor; -} - -/*! - \reimp -*/ -void QProxyScreenCursor::set(const QImage &image, int hotx, int hoty) -{ - if (realCursor) { - hotspot = QPoint(hotx, hoty); - cursor = image; - size = image.size(); - realCursor->set(image, hotx, hoty); - } else { - QScreenCursor::set(image, hotx, hoty); - } -} - -/*! - \reimp -*/ -void QProxyScreenCursor::move(int x, int y) -{ - if (realCursor) { - pos = QPoint(x, y); - realCursor->move(x, y); - } else { - QScreenCursor::move(x, y); - } -} - -/*! - \reimp -*/ -void QProxyScreenCursor::show() -{ - if (realCursor) { - realCursor->show(); - enable = true; - } else { - QScreenCursor::show(); - } -} - -/*! - \reimp -*/ -void QProxyScreenCursor::hide() -{ - if (realCursor) { - realCursor->hide(); - enable = false; - } else { - QScreenCursor::hide(); - } -} - -/*! - \internal -*/ -void QProxyScreenCursor::configure() -{ - if (!realCursor) - return; - - cursor = realCursor->cursor; - size = realCursor->size; - pos = realCursor->pos; - hotspot = realCursor->hotspot; - enable = realCursor->enable; - hwaccel = realCursor->hwaccel; - supportsAlpha = realCursor->supportsAlpha; -} - -#endif // QT_NO_QWS_CURSOR - -/*! - \class QProxyScreen - \ingroup qws - \brief The QProxyScreen class provides a generic interface to QScreen implementations. -*/ - -/*! - \fn QProxyScreen::QProxyScreen(int displayId, ClassId classId) - - Constructs a proxy screen with the given \a displayId and \a classId. -*/ -QProxyScreen::QProxyScreen(int displayId, QScreen::ClassId classId) - : QScreen(displayId, classId), realScreen(0), d_ptr(0) -{ -} - -/*! - Destroys the proxy screen. -*/ -QProxyScreen::~QProxyScreen() -{ -} - -/*! - Sets the real \a screen to be used by the proxy screen. - - \sa screen() -*/ -void QProxyScreen::setScreen(QScreen *screen) -{ - realScreen = screen; - configure(); -} - -/*! - Returns the real screen used by the proxy screen. - - \sa setScreen() -*/ -QScreen* QProxyScreen::screen() const -{ - return realScreen; -} - - -/*! - \internal -*/ -void QProxyScreen::configure() -{ - if (!realScreen) - return; - - d = realScreen->depth(); - w = realScreen->width(); - h = realScreen->height(); - dw = realScreen->deviceWidth(); - dh = realScreen->deviceHeight(); - lstep = realScreen->linestep(); - data = realScreen->base(); - lstep = realScreen->linestep(); - size = realScreen->screenSize(); - physWidth = realScreen->physicalWidth(); - physHeight = realScreen->physicalHeight(); - pixeltype = realScreen->pixelType(); -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - setFrameBufferLittleEndian(realScreen->frameBufferLittleEndian()); -#endif - - setOffset(realScreen->offset()); - setPixelFormat(realScreen->pixelFormat()); - -#ifdef QT_QWS_CLIENTBLIT - setSupportsBlitInClients(realScreen->supportsBlitInClients()); -#endif -} - -/*! - \internal - Returns the display ID that corresponds to the given \a spec. -*/ -static int getDisplayId(const QString &spec) -{ - QRegExp regexp(QLatin1String(":(\\d+)\\b")); - if (regexp.lastIndexIn(spec) != -1) { - const QString capture = regexp.cap(1); - return capture.toInt(); - } - return 0; -} - -/*! - \reimp -*/ -bool QProxyScreen::connect(const QString &displaySpec) -{ - const int id = getDisplayId(displaySpec); - realScreen = qt_get_screen(id, displaySpec.toLatin1().constData()); - configure(); - - return true; -} - -/*! - \reimp -*/ -void QProxyScreen::exposeRegion(QRegion r, int changing) -{ - if (!realScreen) { - QScreen::exposeRegion(r, changing); - return; - } - - realScreen->exposeRegion(r, changing); - r &= realScreen->region(); - - const QVector rects = r.rects(); - for (int i = 0; i < rects.size(); ++i) - setDirty(rects.at(i)); -} - -/*! - \reimp -*/ -void QProxyScreen::blit(const QImage &image, const QPoint &topLeft, - const QRegion ®ion) -{ - if (!realScreen) { - QScreen::blit(image, topLeft, region); - return; - } - - realScreen->blit(image, topLeft, region); -} - -/*! - \reimp -*/ -void QProxyScreen::solidFill(const QColor &color, const QRegion ®ion) -{ - if (!realScreen) { - QScreen::solidFill(color, region); - return; - } - realScreen->solidFill(color, region); -} - -/*! - \reimp -*/ -QSize QProxyScreen::mapToDevice(const QSize &s) const -{ - if (!realScreen) - return QScreen::mapToDevice(s); - - return realScreen->mapToDevice(s); -} - -/*! - \reimp -*/ -QSize QProxyScreen::mapFromDevice(const QSize &s) const -{ - if (!realScreen) - return QScreen::mapFromDevice(s); - - return realScreen->mapFromDevice(s); -} - -/*! - \reimp -*/ -QPoint QProxyScreen::mapToDevice(const QPoint &p, const QSize &s) const -{ - if (!realScreen) - return QScreen::mapToDevice(p, s); - - return realScreen->mapToDevice(p, s); -} - -/*! - \reimp -*/ -QPoint QProxyScreen::mapFromDevice(const QPoint &p, const QSize &s) const -{ - if (!realScreen) - return QScreen::mapFromDevice(p, s); - - return realScreen->mapFromDevice(p, s); -} - -/*! - \reimp -*/ -QRect QProxyScreen::mapToDevice(const QRect &r, const QSize &s) const -{ - if (!realScreen) - return QScreen::mapToDevice(r, s); - - return realScreen->mapToDevice(r, s); -} - -/*! - \reimp -*/ -QRect QProxyScreen::mapFromDevice(const QRect &r, const QSize &s) const -{ - if (!realScreen) - return QScreen::mapFromDevice(r, s); - - return realScreen->mapFromDevice(r, s); -} - -/*! - \reimp -*/ -QRegion QProxyScreen::mapToDevice(const QRegion &r, const QSize &s) const -{ - if (!realScreen) - return QScreen::mapToDevice(r, s); - - return realScreen->mapToDevice(r, s); -} - -/*! - \reimp -*/ -QRegion QProxyScreen::mapFromDevice(const QRegion &r, const QSize &s) const -{ - if (!realScreen) - return QScreen::mapFromDevice(r, s); - - return realScreen->mapFromDevice(r, s); -} - -/*! - \reimp -*/ -void QProxyScreen::disconnect() -{ - if (realScreen) { - realScreen->disconnect(); - delete realScreen; - realScreen = 0; - } -} - -/*! -*/ -bool QProxyScreen::initDevice() -{ - if (realScreen) - return realScreen->initDevice(); - - return false; -} - -/*! - \reimp -*/ -void QProxyScreen::shutdownDevice() -{ - if (realScreen) - realScreen->shutdownDevice(); -} - -/*! - \reimp -*/ -void QProxyScreen::setMode(int w,int h, int d) -{ - if (realScreen) { - realScreen->setMode(w, h, d); - } else { - QScreen::dw = QScreen::w = w; - QScreen::dh = QScreen::h = h; - QScreen::d = d; - } - configure(); - exposeRegion(region(), 0); -} - -/*! - \reimp -*/ -bool QProxyScreen::supportsDepth(int depth) const -{ - if (realScreen) - return realScreen->supportsDepth(depth); - return false; -} - -/*! - \reimp -*/ -void QProxyScreen::save() -{ - if (realScreen) - realScreen->save(); - QScreen::save(); -} - -/*! - \reimp -*/ -void QProxyScreen::restore() -{ - if (realScreen) - realScreen->restore(); - QScreen::restore(); -} - -/*! - \reimp -*/ -void QProxyScreen::blank(bool on) -{ - if (realScreen) - realScreen->blank(on); -} - -/*! - \reimp -*/ -bool QProxyScreen::onCard(const unsigned char *ptr) const -{ - if (realScreen) - return realScreen->onCard(ptr); - return false; -} - -/*! - \reimp -*/ -bool QProxyScreen::onCard(const unsigned char *ptr, ulong &offset) const -{ - if (realScreen) - return realScreen->onCard(ptr, offset); - return false; -} - -/*! - \reimp -*/ -bool QProxyScreen::isInterlaced() const -{ - if (realScreen) - return realScreen->isInterlaced(); - return false; -} - -/*! - \reimp -*/ -bool QProxyScreen::isTransformed() const -{ - if (realScreen) - return realScreen->isTransformed(); - return QScreen::isTransformed(); -} - -/*! - \reimp -*/ -int QProxyScreen::transformOrientation() const -{ - if (realScreen) - return realScreen->transformOrientation(); - return QScreen::transformOrientation(); -} - -/*! -\internal -*/ -int QProxyScreen::memoryNeeded(const QString &str) -{ - if (realScreen) - return realScreen->memoryNeeded(str); - else - return QScreen::memoryNeeded(str); -} - -/*! -\internal -*/ -int QProxyScreen::sharedRamSize(void *ptr) -{ - if (realScreen) - return realScreen->sharedRamSize(ptr); - else - return QScreen::sharedRamSize(ptr); -} - -/*! -\internal -*/ -void QProxyScreen::haltUpdates() -{ - if (realScreen) - realScreen->haltUpdates(); -} - -/*! -\internal -*/ -void QProxyScreen::resumeUpdates() -{ - if (realScreen) - realScreen->resumeUpdates(); -} - -/*! - \reimp -*/ -void QProxyScreen::setDirty(const QRect &rect) -{ - if (realScreen) - realScreen->setDirty(rect); -} - -/*! - \reimp -*/ -QWSWindowSurface* QProxyScreen::createSurface(QWidget *widget) const -{ - if (realScreen) - return realScreen->createSurface(widget); - - return QScreen::createSurface(widget); -} - -/*! - \reimp -*/ -QWSWindowSurface* QProxyScreen::createSurface(const QString &key) const -{ - if (realScreen) - return realScreen->createSurface(key); - - return QScreen::createSurface(key); -} - -/*! - \reimp -*/ -QList QProxyScreen::subScreens() const -{ - if (realScreen) - return realScreen->subScreens(); - - return QScreen::subScreens(); -} - -/*! - \reimp -*/ -QRegion QProxyScreen::region() const -{ - if (realScreen) - return realScreen->region(); - else - return QScreen::region(); -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_PROXYSCREEN diff --git a/src/gui/embedded/qscreenproxy_qws.h b/src/gui/embedded/qscreenproxy_qws.h deleted file mode 100644 index 6f94911680f..00000000000 --- a/src/gui/embedded/qscreenproxy_qws.h +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPROXYSCREEN_QWS_H -#define QPROXYSCREEN_QWS_H - -#include - -#ifndef QT_NO_QWS_PROXYSCREEN - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QProxyScreenPrivate; - -#ifndef QT_NO_QWS_CURSOR - -class QProxyScreenCursorPrivate; - -class Q_GUI_EXPORT QProxyScreenCursor : public QScreenCursor -{ -public: - QProxyScreenCursor(); - ~QProxyScreenCursor(); - - void setScreenCursor(QScreenCursor *cursor); - QScreenCursor* screenCursor() const; - - void set(const QImage &image, int hotx, int hoty); - void move(int x, int y); - void show(); - void hide(); - -private: - void configure(); - - QScreenCursor *realCursor; - QProxyScreenCursorPrivate *d_ptr; -}; - -#endif // QT_NO_QWS_CURSOR - -class Q_GUI_EXPORT QProxyScreen : public QScreen -{ -public: - QProxyScreen(int display_id, ClassId = ProxyClass); - ~QProxyScreen(); - - void setScreen(QScreen *screen); - QScreen *screen() const; - - QSize mapToDevice(const QSize &s) const; - QSize mapFromDevice(const QSize &s) const; - - QPoint mapToDevice(const QPoint &, const QSize &) const; - QPoint mapFromDevice(const QPoint &, const QSize &) const; - - QRect mapToDevice(const QRect &, const QSize &) const; - QRect mapFromDevice(const QRect &, const QSize &) const; - - QRegion mapToDevice(const QRegion &, const QSize &) const; - QRegion mapFromDevice(const QRegion &, const QSize &) const; - - bool connect(const QString &displaySpec); - bool initDevice(); - void shutdownDevice(); - void disconnect(); - - void setMode(int width, int height, int depth); - bool supportsDepth(int) const; - - void save(); - void restore(); - void blank(bool on); - - bool onCard(const unsigned char *) const; - bool onCard(const unsigned char *, ulong& out_offset) const; - - bool isInterlaced() const; - bool isTransformed() const; - int transformOrientation() const; - - int memoryNeeded(const QString&); - int sharedRamSize(void *); - - void haltUpdates(); - void resumeUpdates(); - - void exposeRegion(QRegion r, int changing); - void blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion); - void solidFill(const QColor &color, const QRegion ®ion); - void setDirty(const QRect&); - - QWSWindowSurface* createSurface(QWidget *widget) const; - QWSWindowSurface* createSurface(const QString &key) const; - - QList subScreens() const; - QRegion region() const; - -private: - void configure(); - - QScreen *realScreen; - QProxyScreenPrivate *d_ptr; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_QWS_PROXYSCREEN -#endif // QPROXYSCREEN_QWS_H diff --git a/src/gui/embedded/qscreenqnx_qws.cpp b/src/gui/embedded/qscreenqnx_qws.cpp deleted file mode 100644 index 4afe087cdbd..00000000000 --- a/src/gui/embedded/qscreenqnx_qws.cpp +++ /dev/null @@ -1,450 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qscreenqnx_qws.h" -#include "qdebug.h" - -#include - -QT_BEGIN_NAMESPACE - -// This struct holds all the pointers to QNX's internals -struct QQnxScreenContext -{ - inline QQnxScreenContext() - : device(0), display(0), layer(0), hwSurface(0), memSurface(0), context(0) - {} - - gf_dev_t device; - gf_dev_info_t deviceInfo; - gf_display_t display; - gf_display_info_t displayInfo; - gf_layer_t layer; - gf_surface_t hwSurface; - gf_surface_t memSurface; - gf_surface_info_t memSurfaceInfo; - gf_context_t context; -}; - -/*! - \class QQnxScreen - \preliminary - \ingroup qws - \since 4.6 - \internal - - \brief The QQnxScreen class implements a screen driver - for QNX io-display based devices. - - Note - you never have to instanciate this class, the QScreenDriverFactory - does that for us based on the \c{QWS_DISPLAY} environment variable. - - To activate this driver, set \c{QWS_DISPLAY} to \c{qnx}. - - Example: - \c{QWS_DISPLAY=qnx; export QWS_DISPLAY} - - By default, the main layer of the first display of the first device is used. - If you have multiple graphic cards, multiple displays or multiple layers and - don't want to connect to the default, you can override that with setting - the corresponding options \c{device}, \c{display} or \c{layer} in the \c{QWS_DISPLAY} variable: - - \c{QWS_DISPLAY=qnx:device=3:display=4:layer=5} - - In addition, it is suggested to set the physical width and height of the display. - QQnxScreen will use that information to compute the dots per inch (DPI) in order to render - fonts correctly. If this informaiton is omitted, QQnxScreen defaults to 72 dpi. - - \c{QWS_DISPLAY=qnx:mmWidth=120:mmHeight=80} - - \c{mmWidth} and \c{mmHeight} are the physical width/height of the screen in millimeters. - - \sa QScreen, QScreenDriverPlugin, {Running Qt for Embedded Linux Applications}{Running Applications} -*/ - -/*! - Constructs a QQnxScreen object. The \a display_id argument - identifies the Qt for Embedded Linux server to connect to. -*/ -QQnxScreen::QQnxScreen(int display_id) - : QScreen(display_id), d(new QQnxScreenContext) -{ -} - -/*! - Destroys this QQnxScreen object. -*/ -QQnxScreen::~QQnxScreen() -{ - delete d; -} - -/*! \reimp -*/ -bool QQnxScreen::initDevice() -{ - // implement this if you have multiple processes that want to access the display - // (not required if QT_NO_QWS_MULTIPROCESS is set) - return true; -} - -/*! \internal - Attaches to the named device \a name. -*/ -static bool attachDevice(QQnxScreenContext * const d, const char *name) -{ - int ret = gf_dev_attach(&d->device, name, &d->deviceInfo); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_dev_attach(%s) failed with error code %d", name, ret); - return false; - } - return true; -} - -/*! \internal - Attaches to the display at index \a displayIndex. - */ -static bool attachDisplay(QQnxScreenContext * const d, int displayIndex) -{ - int ret = gf_display_attach(&d->display, d->device, displayIndex, &d->displayInfo); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_display_attach(%d) failed with error code %d", - displayIndex, ret); - return false; - } - return true; -} - -/*! \internal - Attaches to the layer \a layerIndex. - */ -static bool attachLayer(QQnxScreenContext * const d, int layerIndex) -{ - int ret = gf_layer_attach(&d->layer, d->display, layerIndex, 0); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_layer_attach(%d) failed with error code %d", layerIndex, - ret); - return false; - } - gf_layer_enable(d->layer); - - return true; -} - -/*! \internal - Creates a new hardware surface (usually on the Gfx card memory) with the dimensions \a w * \a h. - */ -static bool createHwSurface(QQnxScreenContext * const d, int w, int h) -{ - int ret = gf_surface_create_layer(&d->hwSurface, &d->layer, 1, 0, - w, h, GF_FORMAT_ARGB8888, 0, 0); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_surface_create_layer(%dx%d) failed with error code %d", - w, h, ret); - return false; - } - - gf_layer_set_surfaces(d->layer, &d->hwSurface, 1); - - ret = gf_layer_update(d->layer, 0); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_layer_update() failed with error code %d\n", ret); - return false; - } - - return true; -} - -/*! \internal - Creates an in-memory, linear accessible surface of dimensions \a w * \a h. - This is the main surface that QWS blits to. - */ -static bool createMemSurface(QQnxScreenContext * const d, int w, int h) -{ - // Note: gf_surface_attach() could also be used, so we'll create the buffer - // and let the surface point to it. Here, we use surface_create instead. - - int ret = gf_surface_create(&d->memSurface, d->device, w, h, - GF_FORMAT_ARGB8888, 0, - GF_SURFACE_CREATE_CPU_FAST_ACCESS | GF_SURFACE_CREATE_CPU_LINEAR_ACCESSIBLE - | GF_SURFACE_PHYS_CONTIG | GF_SURFACE_CREATE_SHAREABLE); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_surface_create(%dx%d) failed with error code %d", - w, h, ret); - return false; - } - - gf_surface_get_info(d->memSurface, &d->memSurfaceInfo); - - if (d->memSurfaceInfo.sid == unsigned(GF_SID_INVALID)) { - qWarning("QQnxScreen: gf_surface_get_info() failed."); - return false; - } - - return true; -} - -/* \internal - Creates a QNX gf context and sets our memory surface on it. - */ -static bool createContext(QQnxScreenContext * const d) -{ - int ret = gf_context_create(&d->context); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_context_create() failed with error code %d", ret); - return false; - } - - ret = gf_context_set_surface(d->context, d->memSurface); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_context_set_surface() failed with error code %d", ret); - return false; - } - - return true; -} - -/*! \reimp - Connects to QNX's io-display based device based on the \a displaySpec parameters - from the \c{QWS_DISPLAY} environment variable. See the QQnxScreen class documentation - for possible parameters. - - \sa QQnxScreen - */ -bool QQnxScreen::connect(const QString &displaySpec) -{ - const QStringList params = displaySpec.split(QLatin1Char(':'), QString::SkipEmptyParts); - - bool isOk = false; - QRegExp deviceRegExp(QLatin1String("^device=(.+)$")); - if (params.indexOf(deviceRegExp) != -1) { - isOk = attachDevice(d, deviceRegExp.cap(1).toLocal8Bit().constData()); - } else { - // no device specified - attach to device 0 (the default) - isOk = attachDevice(d, GF_DEVICE_INDEX(0)); - } - - if (!isOk) - return false; - - qDebug("QQnxScreen: Attached to Device, number of displays: %d", d->deviceInfo.ndisplays); - - // default to display 0 - int displayIndex = 0; - QRegExp displayRegexp(QLatin1String("^display=(\\d+)$")); - if (params.indexOf(displayRegexp) != -1) { - displayIndex = displayRegexp.cap(1).toInt(); - } - - if (!attachDisplay(d, displayIndex)) - return false; - - qDebug("QQnxScreen: Attached to Display %d, resolution %dx%d, refresh %d Hz", - displayIndex, d->displayInfo.xres, d->displayInfo.yres, - d->displayInfo.refresh); - - - // default to main_layer_index from the displayInfo struct - int layerIndex = 0; - QRegExp layerRegexp(QLatin1String("^layer=(\\d+)$")); - if (params.indexOf(layerRegexp) != -1) { - layerIndex = layerRegexp.cap(1).toInt(); - } else { - layerIndex = d->displayInfo.main_layer_index; - } - - if (!attachLayer(d, layerIndex)) - return false; - - // tell QWSDisplay the width and height of the display - w = dw = d->displayInfo.xres; - h = dh = d->displayInfo.yres; - - // we only support 32 bit displays for now. - QScreen::d = 32; - - // assume 72 dpi as default, to calculate the physical dimensions if not specified - const int defaultDpi = 72; - - // Handle display physical size spec. - QRegExp mmWidthRegexp(QLatin1String("^mmWidth=(\\d+)$")); - if (params.indexOf(mmWidthRegexp) == -1) { - physWidth = qRound(dw * 25.4 / defaultDpi); - } else { - physWidth = mmWidthRegexp.cap(1).toInt(); - } - - QRegExp mmHeightRegexp(QLatin1String("^mmHeight=(\\d+)$")); - if (params.indexOf(mmHeightRegexp) == -1) { - physHeight = qRound(dh * 25.4 / defaultDpi); - } else { - physHeight = mmHeightRegexp.cap(1).toInt(); - } - - // create a hardware surface with our dimensions. In the old days, it was possible - // to get a pointer directly to the hw surface, so we could blit directly. Now, we - // have to use one indirection more, because it's not guaranteed that the hw surface - // is mappable into our process. - if (!createHwSurface(d, w, h)) - return false; - - // create an in-memory linear surface that is used by QWS. QWS will blit directly in here. - if (!createMemSurface(d, w, h)) - return false; - - // set the address of the in-memory buffer that QWS is blitting to - data = d->memSurfaceInfo.vaddr; - // set the line stepping - lstep = d->memSurfaceInfo.stride; - - // the overall size of the in-memory buffer is linestep * height - size = mapsize = lstep * h; - - // create a QNX drawing context - if (!createContext(d)) - return false; - - // we're always using a software cursor for now. Initialize it here. - QScreenCursor::initSoftwareCursor(); - - // done, the driver should be connected to the display now. - return true; -} - -/*! \reimp - */ -void QQnxScreen::disconnect() -{ - if (d->context) - gf_context_free(d->context); - - if (d->memSurface) - gf_surface_free(d->memSurface); - - if (d->hwSurface) - gf_surface_free(d->hwSurface); - - if (d->layer) - gf_layer_detach(d->layer); - - if (d->display) - gf_display_detach(d->display); - - if (d->device) - gf_dev_detach(d->device); - - d->memSurface = 0; - d->hwSurface = 0; - d->context = 0; - d->layer = 0; - d->display = 0; - d->device = 0; -} - -/*! \reimp - */ -void QQnxScreen::shutdownDevice() -{ -} - - -/*! \reimp - QQnxScreen doesn't support setting the mode, use io-display instead. - */ -void QQnxScreen::setMode(int,int,int) -{ - qWarning("QQnxScreen: Unable to change mode, use io-display instead."); -} - -/*! \reimp - */ -bool QQnxScreen::supportsDepth(int depth) const -{ - // only 32-bit for the moment - return depth == 32; -} - -/*! \reimp - */ -void QQnxScreen::exposeRegion(QRegion r, int changing) -{ - // here is where the actual magic happens. QWS will call exposeRegion whenever - // a region on the screen is dirty and needs to be updated on the actual screen. - - // first, call the parent implementation. The parent implementation will update - // the region on our in-memory surface - QScreen::exposeRegion(r, changing); - - // now our in-memory surface should be up to date with the latest changes. - // the code below copies the region from the in-memory surface to the hardware. - - // just get the bounding rectangle of the region. Most screen updates are rectangular - // anyways. Code could be optimized to blit each and every member of the region - // individually, but in real life, the speed-up is neglectable - const QRect br = r.boundingRect(); - if (br.isEmpty()) - return; // ignore empty regions because gf_draw_blit2 doesn't like 0x0 dimensions - - // start drawing. - int ret = gf_draw_begin(d->context); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_draw_begin() failed with error code %d", ret); - return; - } - - // blit the changed region from the memory surface to the hardware surface - ret = gf_draw_blit2(d->context, d->memSurface, d->hwSurface, - br.x(), br.y(), br.right(), br.bottom(), br.x(), br.y()); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_draw_blit2() failed with error code %d", ret); - } - - // flush all drawing commands (in our case, a single blit) - ret = gf_draw_flush(d->context); - if (ret != GF_ERR_OK) { - qWarning("QQnxScreen: gf_draw_flush() failed with error code %d", ret); - } - - // tell QNX that we're done drawing. - gf_draw_end(d->context); -} - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qscreenqnx_qws.h b/src/gui/embedded/qscreenqnx_qws.h deleted file mode 100644 index 38c0ac9475c..00000000000 --- a/src/gui/embedded/qscreenqnx_qws.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSCREENQNX_QWS_H -#define QSCREENQNX_QWS_H - -#include - -#ifndef QT_NO_QWS_QNX - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -struct QQnxScreenContext; - -class QQnxScreen : public QScreen -{ -public: - explicit QQnxScreen(int display_id); - ~QQnxScreen(); - - bool initDevice(); - bool connect(const QString &displaySpec); - void disconnect(); - void shutdownDevice(); - void setMode(int,int,int); - bool supportsDepth(int) const; - - void exposeRegion(QRegion r, int changing); - -private: - QQnxScreenContext * const d; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_QWS_QNX - -#endif diff --git a/src/gui/embedded/qscreentransformed_qws.cpp b/src/gui/embedded/qscreentransformed_qws.cpp deleted file mode 100644 index c2b2a0761d3..00000000000 --- a/src/gui/embedded/qscreentransformed_qws.cpp +++ /dev/null @@ -1,748 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qscreentransformed_qws.h" - -#ifndef QT_NO_QWS_TRANSFORMED -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -//#define QT_REGION_DEBUG - -#ifdef QT_REGION_DEBUG -#include -#endif - -class QTransformedScreenPrivate -{ -public: - QTransformedScreenPrivate(QTransformedScreen *parent); - - void configure(); - - QTransformedScreen::Transformation transformation; -#ifdef QT_QWS_DEPTH_GENERIC - bool doGenericColors; -#endif - QTransformedScreen *q; -}; - -QTransformedScreenPrivate::QTransformedScreenPrivate(QTransformedScreen *parent) - : transformation(QTransformedScreen::None), -#ifdef QT_QWS_DEPTH_GENERIC - doGenericColors(false), -#endif - q(parent) -{ -} - -extern "C" -#ifndef QT_BUILD_GUI_LIB -Q_DECL_EXPORT -#endif -void qws_setScreenTransformation(QScreen *that, int t) -{ - QTransformedScreen *tscreen = static_cast(that); - tscreen->setTransformation((QTransformedScreen::Transformation)t); -} - -// --------------------------------------------------------------------------- -// Transformed Screen -// --------------------------------------------------------------------------- - -/*! - \internal - - \class QTransformedScreen - \ingroup qws - - \brief The QTransformedScreen class implements a screen driver for - a transformed screen. - - Note that this class is only available in \l{Qt for Embedded Linux}. - Custom screen drivers can be added by subclassing the - QScreenDriverPlugin class, using the QScreenDriverFactory class to - dynamically load the driver into the application, but there should - only be one screen object per application. - - Use the QScreen::isTransformed() function to determine if a screen - is transformed. The QTransformedScreen class itself provides means - of rotating the screen with its setTransformation() function; the - transformation() function returns the currently set rotation in - terms of the \l Transformation enum (which describes the various - available rotation settings). Alternatively, QTransformedScreen - provides an implementation of the QScreen::transformOrientation() - function, returning the current rotation as an integer value. - - \sa QScreen, QScreenDriverPlugin, {Running Applications} -*/ - -/*! - \enum QTransformedScreen::Transformation - - This enum describes the various rotations a transformed screen can - have. - - \value None No rotation - \value Rot90 90 degrees rotation - \value Rot180 180 degrees rotation - \value Rot270 270 degrees rotation -*/ - -/*! - \fn bool QTransformedScreen::isTransformed() const - \reimp -*/ - -/*! - Constructs a QTransformedScreen object. The \a displayId argument - identifies the Qt for Embedded Linux server to connect to. -*/ -QTransformedScreen::QTransformedScreen(int displayId) - : QProxyScreen(displayId, QScreen::TransformedClass) -{ - d_ptr = new QTransformedScreenPrivate(this); - d_ptr->transformation = None; - -#ifdef QT_REGION_DEBUG - qDebug() << "QTransformedScreen::QTransformedScreen"; -#endif -} - -void QTransformedScreenPrivate::configure() -{ - // ###: works because setTransformation recalculates unconditionally - q->setTransformation(transformation); -} - -/*! - Destroys the QTransformedScreen object. -*/ -QTransformedScreen::~QTransformedScreen() -{ - delete d_ptr; -} - -static int getDisplayId(const QString &spec) -{ - QRegExp regexp(QLatin1String(":(\\d+)\\b")); - if (regexp.lastIndexIn(spec) != -1) { - const QString capture = regexp.cap(1); - return capture.toInt(); - } - return 0; -} - -static QTransformedScreen::Transformation filterTransformation(QString &spec) -{ - QRegExp regexp(QLatin1String("\\bRot(\\d+):?\\b"), Qt::CaseInsensitive); - if (regexp.indexIn(spec) == -1) - return QTransformedScreen::None; - - const int degrees = regexp.cap(1).toInt(); - spec.remove(regexp.pos(0), regexp.matchedLength()); - - return static_cast(degrees / 90); -} - -/*! - \reimp -*/ -bool QTransformedScreen::connect(const QString &displaySpec) -{ - QString dspec = displaySpec.trimmed(); - if (dspec.startsWith(QLatin1String("Transformed:"), Qt::CaseInsensitive)) - dspec = dspec.mid(QString::fromLatin1("Transformed:").size()); - else if (!dspec.compare(QLatin1String("Transformed"), Qt::CaseInsensitive)) - dspec = QString(); - - const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId); - if (dspec.endsWith(displayIdSpec)) - dspec = dspec.left(dspec.size() - displayIdSpec.size()); - - d_ptr->transformation = filterTransformation(dspec); - - QString driver = dspec; - int colon = driver.indexOf(QLatin1Char(':')); - if (colon >= 0) - driver.truncate(colon); - - if (!QScreenDriverFactory::keys().contains(driver, Qt::CaseInsensitive)) - if (!dspec.isEmpty()) - dspec.prepend(QLatin1Char(':')); - - const int id = getDisplayId(dspec); - QScreen *s = qt_get_screen(id, dspec.toLatin1().constData()); - setScreen(s); - -#ifdef QT_QWS_DEPTH_GENERIC - d_ptr->doGenericColors = dspec.contains(QLatin1String("genericcolors")); -#endif - - d_ptr->configure(); - - // XXX - qt_screen = this; - - return true; -} - -/*! - Returns the currently set rotation. - - \sa setTransformation(), QScreen::transformOrientation() -*/ -QTransformedScreen::Transformation QTransformedScreen::transformation() const -{ - return d_ptr->transformation; -} - -/*! - \reimp -*/ -int QTransformedScreen::transformOrientation() const -{ - return (int)d_ptr->transformation; -} - -/*! - \reimp -*/ -void QTransformedScreen::exposeRegion(QRegion region, int changing) -{ - if (!data || d_ptr->transformation == None) { - QProxyScreen::exposeRegion(region, changing); - return; - } - QScreen::exposeRegion(region, changing); -} - -/*! - Rotates this screen object according to the specified \a transformation. - - \sa transformation() -*/ -void QTransformedScreen::setTransformation(Transformation transformation) -{ - d_ptr->transformation = transformation; - QSize size = mapFromDevice(QSize(dw, dh)); - w = size.width(); - h = size.height(); - - const QScreen *s = screen(); - size = mapFromDevice(QSize(s->physicalWidth(), s->physicalHeight())); - physWidth = size.width(); - physHeight = size.height(); - -#ifdef QT_REGION_DEBUG - qDebug() << "QTransformedScreen::setTransformation" << transformation - << "size" << w << h << "dev size" << dw << dh; -#endif - -} - -static inline QRect correctNormalized(const QRect &r) { - const int x1 = qMin(r.left(), r.right()); - const int x2 = qMax(r.left(), r.right()); - const int y1 = qMin(r.top(), r.bottom()); - const int y2 = qMax(r.top(), r.bottom()); - - return QRect( QPoint(x1,y1), QPoint(x2,y2) ); -} - -template -static inline void blit90(QScreen *screen, const QImage &image, - const QRect &rect, const QPoint &topLeft) -{ - const SRC *src = (const SRC*)(image.scanLine(rect.top())) + rect.left(); - DST *dest = (DST*)(screen->base() + topLeft.y() * screen->linestep()) - + topLeft.x(); - qt_memrotate90(src, rect.width(), rect.height(), image.bytesPerLine(), - dest, screen->linestep()); -} - -template -static inline void blit180(QScreen *screen, const QImage &image, - const QRect &rect, const QPoint &topLeft) -{ - const SRC *src = (const SRC*)(image.scanLine(rect.top())) + rect.left(); - DST *dest = (DST*)(screen->base() + topLeft.y() * screen->linestep()) - + topLeft.x(); - qt_memrotate180(src, rect.width(), rect.height(), image.bytesPerLine(), - dest, screen->linestep()); -} - -template -static inline void blit270(QScreen *screen, const QImage &image, - const QRect &rect, const QPoint &topLeft) -{ - const SRC *src = (const SRC *)(image.scanLine(rect.top())) + rect.left(); - DST *dest = (DST*)(screen->base() + topLeft.y() * screen->linestep()) - + topLeft.x(); - qt_memrotate270(src, rect.width(), rect.height(), image.bytesPerLine(), - dest, screen->linestep()); -} - -typedef void (*BlitFunc)(QScreen *, const QImage &, const QRect &, const QPoint &); - -#define SET_BLIT_FUNC(dst, src, rotation, func) \ -do { \ - switch (rotation) { \ - case Rot90: \ - func = blit90; \ - break; \ - case Rot180: \ - func = blit180; \ - break; \ - case Rot270: \ - func = blit270; \ - break; \ - default: \ - break; \ - } \ -} while (0) - -/*! - \reimp -*/ -void QTransformedScreen::blit(const QImage &image, const QPoint &topLeft, - const QRegion ®ion) -{ - const Transformation trans = d_ptr->transformation; - if (trans == None) { - QProxyScreen::blit(image, topLeft, region); - return; - } - - const QVector rects = region.rects(); - const QRect bound = QRect(0, 0, QScreen::w, QScreen::h) - & QRect(topLeft, image.size()); - - BlitFunc func = 0; -#ifdef QT_QWS_DEPTH_GENERIC - if (d_ptr->doGenericColors && depth() == 16) { - if (image.depth() == 16) - SET_BLIT_FUNC(qrgb_generic16, quint16, trans, func); - else - SET_BLIT_FUNC(qrgb_generic16, quint32, trans, func); - } else -#endif - switch (depth()) { -#ifdef QT_QWS_DEPTH_32 - case 32: -#ifdef QT_QWS_DEPTH_16 - if (image.depth() == 16) - SET_BLIT_FUNC(quint32, quint16, trans, func); - else -#endif - SET_BLIT_FUNC(quint32, quint32, trans, func); - break; -#endif -#if defined(QT_QWS_DEPTH_24) || defined(QT_QWS_DEPTH18) - case 24: - case 18: - SET_BLIT_FUNC(quint24, quint24, trans, func); - break; -#endif -#if defined(QT_QWS_DEPTH_16) || defined(QT_QWS_DEPTH_15) || defined(QT_QWS_DEPTH_12) - case 16: -#if defined QT_QWS_ROTATE_BGR - if (pixelType() == BGRPixel && image.depth() == 16) { - SET_BLIT_FUNC(qbgr565, quint16, trans, func); - break; - } //fall-through here!!! -#endif - case 15: -#if defined QT_QWS_ROTATE_BGR - if (pixelType() == BGRPixel && image.format() == QImage::Format_RGB555) { - SET_BLIT_FUNC(qbgr555, qrgb555, trans, func); - break; - } //fall-through here!!! -#endif - case 12: - if (image.depth() == 16) - SET_BLIT_FUNC(quint16, quint16, trans, func); - else - SET_BLIT_FUNC(quint16, quint32, trans, func); - break; -#endif -#ifdef QT_QWS_DEPTH_8 - case 8: - if (image.format() == QImage::Format_RGB444) - SET_BLIT_FUNC(quint8, qrgb444, trans, func); - else if (image.depth() == 16) - SET_BLIT_FUNC(quint8, quint16, trans, func); - else - SET_BLIT_FUNC(quint8, quint32, trans, func); - break; -#endif - default: - return; - } - if (!func) - return; - - QWSDisplay::grab(); - for (int i = 0; i < rects.size(); ++i) { - const QRect r = rects.at(i) & bound; - - QPoint dst; - switch (trans) { - case Rot90: - dst = mapToDevice(r.topRight(), QSize(w, h)); - break; - case Rot180: - dst = mapToDevice(r.bottomRight(), QSize(w, h)); - break; - case Rot270: - dst = mapToDevice(r.bottomLeft(), QSize(w, h)); - break; - default: - break; - } - func(this, image, r.translated(-topLeft), dst); - } - QWSDisplay::ungrab(); - -} - -/*! - \reimp -*/ -void QTransformedScreen::solidFill(const QColor &color, const QRegion ®ion) -{ - const QRegion tr = mapToDevice(region, QSize(w,h)); - - Q_ASSERT(tr.boundingRect() == mapToDevice(region.boundingRect(), QSize(w,h))); - -#ifdef QT_REGION_DEBUG - qDebug() << "QTransformedScreen::solidFill region" << region << "transformed" << tr; -#endif - QProxyScreen::solidFill(color, tr); -} - -/*! - \reimp -*/ -QSize QTransformedScreen::mapToDevice(const QSize &s) const -{ - switch (d_ptr->transformation) { - case None: - case Rot180: - break; - case Rot90: - case Rot270: - return QSize(s.height(), s.width()); - break; - } - return s; -} - -/*! - \reimp -*/ -QSize QTransformedScreen::mapFromDevice(const QSize &s) const -{ - switch (d_ptr->transformation) { - case None: - case Rot180: - break; - case Rot90: - case Rot270: - return QSize(s.height(), s.width()); - break; - } - return s; -} - -/*! - \reimp -*/ -QPoint QTransformedScreen::mapToDevice(const QPoint &p, const QSize &s) const -{ - QPoint rp(p); - - switch (d_ptr->transformation) { - case None: - break; - case Rot90: - rp.setX(p.y()); - rp.setY(s.width() - p.x() - 1); - break; - case Rot180: - rp.setX(s.width() - p.x() - 1); - rp.setY(s.height() - p.y() - 1); - break; - case Rot270: - rp.setX(s.height() - p.y() - 1); - rp.setY(p.x()); - break; - } - - return rp; -} - -/*! - \reimp -*/ -QPoint QTransformedScreen::mapFromDevice(const QPoint &p, const QSize &s) const -{ - QPoint rp(p); - - switch (d_ptr->transformation) { - case None: - break; - case Rot90: - rp.setX(s.height() - p.y() - 1); - rp.setY(p.x()); - break; - case Rot180: - rp.setX(s.width() - p.x() - 1); - rp.setY(s.height() - p.y() - 1); - break; - case Rot270: - rp.setX(p.y()); - rp.setY(s.width() - p.x() - 1); - break; - } - - return rp; -} - -/*! - \reimp -*/ -QRect QTransformedScreen::mapToDevice(const QRect &r, const QSize &s) const -{ - if (r.isNull()) - return QRect(); - - QRect tr; - switch (d_ptr->transformation) { - case None: - tr = r; - break; - case Rot90: - tr.setCoords(r.y(), s.width() - r.x() - 1, - r.bottom(), s.width() - r.right() - 1); - break; - case Rot180: - tr.setCoords(s.width() - r.x() - 1, s.height() - r.y() - 1, - s.width() - r.right() - 1, s.height() - r.bottom() - 1); - break; - case Rot270: - tr.setCoords(s.height() - r.y() - 1, r.x(), - s.height() - r.bottom() - 1, r.right()); - break; - } - - return correctNormalized(tr); -} - -/*! - \reimp -*/ -QRect QTransformedScreen::mapFromDevice(const QRect &r, const QSize &s) const -{ - if (r.isNull()) - return QRect(); - - QRect tr; - switch (d_ptr->transformation) { - case None: - tr = r; - break; - case Rot90: - tr.setCoords(s.height() - r.y() - 1, r.x(), - s.height() - r.bottom() - 1, r.right()); - break; - case Rot180: - tr.setCoords(s.width() - r.x() - 1, s.height() - r.y() - 1, - s.width() - r.right() - 1, s.height() - r.bottom() - 1); - break; - case Rot270: - tr.setCoords(r.y(), s.width() - r.x() - 1, - r.bottom(), s.width() - r.right() - 1); - break; - } - - return correctNormalized(tr); -} - -/*! - \reimp -*/ -QRegion QTransformedScreen::mapToDevice(const QRegion &rgn, const QSize &s) const -{ - if (d_ptr->transformation == None) - return QProxyScreen::mapToDevice(rgn, s); - -#ifdef QT_REGION_DEBUG - qDebug() << "mapToDevice size" << s << "rgn: " << rgn; -#endif - QRect tr; - QRegion trgn; - QVector a = rgn.rects(); - const QRect *r = a.data(); - - int w = s.width(); - int h = s.height(); - int size = a.size(); - - switch (d_ptr->transformation) { - case None: - break; - case Rot90: - for (int i = 0; i < size; i++, r++) { - tr.setCoords(r->y(), w - r->x() - 1, - r->bottom(), w - r->right() - 1); - trgn |= correctNormalized(tr); - } - break; - case Rot180: - for (int i = 0; i < size; i++, r++) { - tr.setCoords(w - r->x() - 1, h - r->y() - 1, - w - r->right() - 1, h - r->bottom() - 1); - trgn |= correctNormalized(tr); - } - break; - case Rot270: - for (int i = 0; i < size; i++, r++) { - tr.setCoords(h - r->y() - 1, r->x(), - h - r->bottom() - 1, r->right()); - trgn |= correctNormalized(tr); - } - break; - } -#ifdef QT_REGION_DEBUG - qDebug() << "mapToDevice trgn: " << trgn; -#endif - return trgn; -} - -/*! - \reimp -*/ -QRegion QTransformedScreen::mapFromDevice(const QRegion &rgn, const QSize &s) const -{ - if (d_ptr->transformation == None) - return QProxyScreen::mapFromDevice(rgn, s); - -#ifdef QT_REGION_DEBUG - qDebug() << "fromDevice: realRegion count: " << rgn.rects().size() << " isEmpty? " << rgn.isEmpty() << " bounds:" << rgn.boundingRect(); -#endif - QRect tr; - QRegion trgn; - QVector a = rgn.rects(); - const QRect *r = a.data(); - - int w = s.width(); - int h = s.height(); - int size = a.size(); - - switch (d_ptr->transformation) { - case None: - break; - case Rot90: - for (int i = 0; i < size; i++, r++) { - tr.setCoords(h - r->y() - 1, r->x(), - h - r->bottom() - 1, r->right()); - trgn |= correctNormalized(tr); - } - break; - case Rot180: - for (int i = 0; i < size; i++, r++) { - tr.setCoords(w - r->x() - 1, h - r->y() - 1, - w - r->right() - 1, h - r->bottom() - 1); - trgn |= correctNormalized(tr); - } - break; - case Rot270: - for (int i = 0; i < size; i++, r++) { - tr.setCoords(r->y(), w - r->x() - 1, - r->bottom(), w - r->right() - 1); - trgn |= correctNormalized(tr); - } - break; - } -#ifdef QT_REGION_DEBUG - qDebug() << "fromDevice: transRegion count: " << trgn.rects().size() << " isEmpty? " << trgn.isEmpty() << " bounds:" << trgn.boundingRect(); -#endif - return trgn; -} - -/*! - \reimp -*/ -void QTransformedScreen::setDirty(const QRect& rect) -{ - const QRect r = mapToDevice(rect, QSize(width(), height())); - QProxyScreen::setDirty(r); -} - -/*! - \reimp -*/ -QRegion QTransformedScreen::region() const -{ - QRegion deviceRegion = QProxyScreen::region(); - return mapFromDevice(deviceRegion, QSize(deviceWidth(), deviceHeight())); -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_TRANSFORMED diff --git a/src/gui/embedded/qscreentransformed_qws.h b/src/gui/embedded/qscreentransformed_qws.h deleted file mode 100644 index 180fc2d0760..00000000000 --- a/src/gui/embedded/qscreentransformed_qws.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSCREENTRANSFORMED_QWS_H -#define QSCREENTRANSFORMED_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_QWS_TRANSFORMED - -class QTransformedScreenPrivate; - -class Q_AUTOTEST_EXPORT QTransformedScreen : public QProxyScreen -{ -public: - explicit QTransformedScreen(int display_id); - ~QTransformedScreen(); - - enum Transformation { None, Rot90, Rot180, Rot270 }; - - void setTransformation(Transformation t); - Transformation transformation() const; - int transformOrientation() const; - - QSize mapToDevice(const QSize &s) const; - QSize mapFromDevice(const QSize &s) const; - - QPoint mapToDevice(const QPoint &, const QSize &) const; - QPoint mapFromDevice(const QPoint &, const QSize &) const; - - QRect mapToDevice(const QRect &, const QSize &) const; - QRect mapFromDevice(const QRect &, const QSize &) const; - - QRegion mapToDevice(const QRegion &, const QSize &) const; - QRegion mapFromDevice(const QRegion &, const QSize &) const; - - bool connect(const QString &displaySpec); - - bool isTransformed() const { return transformation() != None; } - - void exposeRegion(QRegion region, int changing); - void blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion); - void solidFill(const QColor &color, const QRegion ®ion); - void setDirty(const QRect&); - - QRegion region() const; - -private: - friend class QTransformedScreenPrivate; - QTransformedScreenPrivate *d_ptr; -}; - -#endif // QT_NO_QWS_TRANSFORMED - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSCREENTRANSFORMED_QWS_H diff --git a/src/gui/embedded/qscreenvfb_qws.cpp b/src/gui/embedded/qscreenvfb_qws.cpp deleted file mode 100644 index 2dc4f83a448..00000000000 --- a/src/gui/embedded/qscreenvfb_qws.cpp +++ /dev/null @@ -1,445 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT_NO_QWS_QVFB - -#define QTOPIA_QVFB_BRIGHTNESS - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QVFbScreenPrivate -{ -public: - QVFbScreenPrivate(); - ~QVFbScreenPrivate(); - - bool success; - unsigned char *shmrgn; - int brightness; - bool blank; - QVFbHeader *hdr; - QWSMouseHandler *mouse; -#ifndef QT_NO_QWS_KEYBOARD - QWSKeyboardHandler *keyboard; -#endif -}; - -QVFbScreenPrivate::QVFbScreenPrivate() - : mouse(0) - -{ -#ifndef QT_NO_QWS_KEYBOARD - keyboard = 0; -#endif - brightness = 255; - blank = false; -} - -QVFbScreenPrivate::~QVFbScreenPrivate() -{ - delete mouse; -#ifndef QT_NO_QWS_KEYBOARD - delete keyboard; -#endif -} - -/*! - \internal - - \class QVFbScreen - \ingroup qws - - \brief The QVFbScreen class implements a screen driver for the - virtual framebuffer. - - Note that this class is only available in \l{Qt for Embedded Linux}. - Custom screen drivers can be added by subclassing the - QScreenDriverPlugin class, using the QScreenDriverFactory class to - dynamically load the driver into the application, but there should - only be one screen object per application. - - The Qt for Embedded Linux platform provides a \l{The Virtual - Framebuffer}{virtual framebuffer} for development and debugging; - the virtual framebuffer allows Qt for Embedded Linux applications to be - developed on a desktop machine, without switching between consoles - and X11. - - \sa QScreen, QScreenDriverPlugin, {Running Applications} -*/ - -/*! - \fn bool QVFbScreen::connect(const QString & displaySpec) - \reimp -*/ - -/*! - \fn void QVFbScreen::disconnect() - \reimp -*/ - -/*! - \fn bool QVFbScreen::initDevice() - \reimp -*/ - -/*! - \fn void QVFbScreen::restore() - \reimp -*/ - -/*! - \fn void QVFbScreen::save() - \reimp -*/ - -/*! - \fn void QVFbScreen::setDirty(const QRect & r) - \reimp -*/ - -/*! - \fn void QVFbScreen::setMode(int nw, int nh, int nd) - \reimp -*/ - -/*! - \fn void QVFbScreen::shutdownDevice() - \reimp -*/ - -/*! - \fn QVFbScreen::QVFbScreen(int displayId) - - Constructs a QVNCScreen object. The \a displayId argument - identifies the Qt for Embedded Linux server to connect to. -*/ -QVFbScreen::QVFbScreen(int display_id) - : QScreen(display_id, VFbClass), d_ptr(new QVFbScreenPrivate) -{ - d_ptr->shmrgn = 0; - d_ptr->hdr = 0; - data = 0; -} - -/*! - Destroys this QVFbScreen object. -*/ -QVFbScreen::~QVFbScreen() -{ - delete d_ptr; -} - -static QVFbScreen *connected = 0; - -bool QVFbScreen::connect(const QString &displaySpec) -{ - QStringList displayArgs = displaySpec.split(QLatin1Char(':')); - if (displayArgs.contains(QLatin1String("Gray"))) - grayscale = true; - - key_t key = ftok(QT_VFB_MOUSE_PIPE(displayId).toLocal8Bit(), 'b'); - - if (key == -1) - return false; - -#if Q_BYTE_ORDER == Q_BIG_ENDIAN -#ifndef QT_QWS_FRAMEBUFFER_LITTLE_ENDIAN - if (displayArgs.contains(QLatin1String("littleendian"))) -#endif - QScreen::setFrameBufferLittleEndian(true); -#endif - - int shmId = shmget(key, 0, 0); - if (shmId != -1) - d_ptr->shmrgn = (unsigned char *)shmat(shmId, 0, 0); - else - return false; - - if ((long)d_ptr->shmrgn == -1 || d_ptr->shmrgn == 0) { - qDebug("No shmrgn %ld", (long)d_ptr->shmrgn); - return false; - } - - d_ptr->hdr = (QVFbHeader *)d_ptr->shmrgn; - data = d_ptr->shmrgn + d_ptr->hdr->dataoffset; - - dw = w = d_ptr->hdr->width; - dh = h = d_ptr->hdr->height; - d = d_ptr->hdr->depth; - - switch (d) { - case 1: - setPixelFormat(QImage::Format_Mono); - break; - case 8: - setPixelFormat(QImage::Format_Indexed8); - break; - case 12: - setPixelFormat(QImage::Format_RGB444); - break; - case 15: - setPixelFormat(QImage::Format_RGB555); - break; - case 16: - setPixelFormat(QImage::Format_RGB16); - break; - case 18: - setPixelFormat(QImage::Format_RGB666); - break; - case 24: - setPixelFormat(QImage::Format_RGB888); - break; - case 32: - setPixelFormat(QImage::Format_ARGB32_Premultiplied); - break; - } - - lstep = d_ptr->hdr->linestep; - - // Handle display physical size spec. - int dimIdxW = -1; - int dimIdxH = -1; - for (int i = 0; i < displayArgs.size(); ++i) { - if (displayArgs.at(i).startsWith(QLatin1String("mmWidth"))) { - dimIdxW = i; - break; - } - } - for (int i = 0; i < displayArgs.size(); ++i) { - if (displayArgs.at(i).startsWith(QLatin1String("mmHeight"))) { - dimIdxH = i; - break; - } - } - if (dimIdxW >= 0) { - bool ok; - int pos = 7; - if (displayArgs.at(dimIdxW).at(pos) == QLatin1Char('=')) - ++pos; - int pw = displayArgs.at(dimIdxW).mid(pos).toInt(&ok); - if (ok) { - physWidth = pw; - if (dimIdxH < 0) - physHeight = dh*physWidth/dw; - } - } - if (dimIdxH >= 0) { - bool ok; - int pos = 8; - if (displayArgs.at(dimIdxH).at(pos) == QLatin1Char('=')) - ++pos; - int ph = displayArgs.at(dimIdxH).mid(pos).toInt(&ok); - if (ok) { - physHeight = ph; - 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); - } - - qDebug("Connected to VFB server %s: %d x %d x %d %dx%dmm (%dx%ddpi)", displaySpec.toLatin1().data(), - w, h, d, physWidth, physHeight, qRound(dw*25.4/physWidth), qRound(dh*25.4/physHeight) ); - - size = lstep * h; - mapsize = size; - screencols = d_ptr->hdr->numcols; - memcpy(screenclut, d_ptr->hdr->clut, sizeof(QRgb) * screencols); - - connected = this; - - if (qgetenv("QT_QVFB_BGR").toInt()) - pixeltype = BGRPixel; - - return true; -} - -void QVFbScreen::disconnect() -{ - connected = 0; - if ((long)d_ptr->shmrgn != -1 && d_ptr->shmrgn) { - if (qApp->type() == QApplication::GuiServer && d_ptr->hdr->dataoffset >= (int)sizeof(QVFbHeader)) { - d_ptr->hdr->serverVersion = 0; - } - shmdt((char*)d_ptr->shmrgn); - } -} - -bool QVFbScreen::initDevice() -{ -#ifndef QT_NO_QWS_MOUSE_QVFB - const QString mouseDev = QT_VFB_MOUSE_PIPE(displayId); - d_ptr->mouse = new QVFbMouseHandler(QLatin1String("QVFbMouse"), mouseDev); - qwsServer->setDefaultMouse("None"); - if (d_ptr->mouse) - d_ptr->mouse->setScreen(this); -#endif - -#if !defined(QT_NO_QWS_KBD_QVFB) && !defined(QT_NO_QWS_KEYBOARD) - const QString keyboardDev = QT_VFB_KEYBOARD_PIPE(displayId); - d_ptr->keyboard = new QVFbKeyboardHandler(keyboardDev); - qwsServer->setDefaultKeyboard("None"); -#endif - - if (d_ptr->hdr->dataoffset >= (int)sizeof(QVFbHeader)) - d_ptr->hdr->serverVersion = QT_VERSION; - - if(d==8) { - screencols=256; - if (grayscale) { - // Build grayscale palette - for(int loopc=0;loopc<256;loopc++) { - screenclut[loopc]=qRgb(loopc,loopc,loopc); - } - } else { - // 6x6x6 216 color cube - int idx = 0; - for(int ir = 0x0; ir <= 0xff; ir+=0x33) { - for(int ig = 0x0; ig <= 0xff; ig+=0x33) { - for(int ib = 0x0; ib <= 0xff; ib+=0x33) { - screenclut[idx]=qRgb(ir, ig, ib); - idx++; - } - } - } - screencols=idx; - } - memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols); - d_ptr->hdr->numcols = screencols; - } else if (d == 4) { - int val = 0; - for (int idx = 0; idx < 16; idx++, val += 17) { - screenclut[idx] = qRgb(val, val, val); - } - screencols = 16; - memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols); - d_ptr->hdr->numcols = screencols; - } else if (d == 1) { - screencols = 2; - screenclut[1] = qRgb(0xff, 0xff, 0xff); - screenclut[0] = qRgb(0, 0, 0); - memcpy(d_ptr->hdr->clut, screenclut, sizeof(QRgb) * screencols); - d_ptr->hdr->numcols = screencols; - } - -#ifndef QT_NO_QWS_CURSOR - QScreenCursor::initSoftwareCursor(); -#endif - return true; -} - -void QVFbScreen::shutdownDevice() -{ -} - -void QVFbScreen::setMode(int ,int ,int) -{ -} - -// save the state of the graphics card -// This is needed so that e.g. we can restore the palette when switching -// between linux virtual consoles. -void QVFbScreen::save() -{ - // nothing to do. -} - -// restore the state of the graphics card. -void QVFbScreen::restore() -{ -} -void QVFbScreen::setDirty(const QRect& rect) -{ - const QRect r = rect.translated(-offset()); - d_ptr->hdr->dirty = true; - d_ptr->hdr->update = d_ptr->hdr->update.united(r); -} - -void QVFbScreen::setBrightness(int b) -{ - if (connected) { - connected->d_ptr->brightness = b; - - QVFbHeader *hdr = connected->d_ptr->hdr; - if (hdr->viewerVersion < 0x040400) // brightness not supported - return; - - const int br = connected->d_ptr->blank ? 0 : b; - if (hdr->brightness != br) { - hdr->brightness = br; - connected->setDirty(connected->region().boundingRect()); - } - } -} - -void QVFbScreen::blank(bool on) -{ - d_ptr->blank = on; - setBrightness(connected->d_ptr->brightness); -} - -#endif // QT_NO_QWS_QVFB - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qscreenvfb_qws.h b/src/gui/embedded/qscreenvfb_qws.h deleted file mode 100644 index 5701a96dc18..00000000000 --- a/src/gui/embedded/qscreenvfb_qws.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSCREENVFB_QWS_H -#define QSCREENVFB_QWS_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_QWS_QVFB - -class QVFbScreenPrivate; - -class Q_GUI_EXPORT QVFbScreen : public QScreen -{ -public: - explicit QVFbScreen(int display_id); - virtual ~QVFbScreen(); - virtual bool initDevice(); - virtual bool connect(const QString &displaySpec); - virtual void disconnect(); - virtual void shutdownDevice(); - virtual void save(); - virtual void restore(); - virtual void setMode(int nw,int nh,int nd); - virtual void setDirty(const QRect& r); - virtual void blank(bool); -#ifdef QTOPIA_QVFB_BRIGHTNESS - static void setBrightness(int b); -#endif - -private: - QVFbScreenPrivate *d_ptr; -}; - -#endif // QT_NO_QWS_QVFB - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSCREENVFB_QWS_H diff --git a/src/gui/embedded/qsoundqss_qws.cpp b/src/gui/embedded/qsoundqss_qws.cpp deleted file mode 100644 index e18a5a7b53b..00000000000 --- a/src/gui/embedded/qsoundqss_qws.cpp +++ /dev/null @@ -1,1530 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsoundqss_qws.h" - -#ifndef QT_NO_SOUND -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // overrides QT_OPEN - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -extern int errno; - -QT_BEGIN_NAMESPACE - -#define QT_QWS_SOUND_16BIT 1 // or 0, or undefined for always 0 -#define QT_QWS_SOUND_STEREO 1 // or 0, or undefined for always 0 - -// Zaurus SL5000D doesn't seem to return any error if setting to 44000 and it fails, -// however 44100 works, 44100 is more common that 44000. -static int sound_speed = 44100; -#ifndef QT_NO_QWS_SOUNDSERVER -extern int qws_display_id; -#endif - -static char *zeroMem = 0; - -struct QRiffChunk { - char id[4]; - quint32 size; - char data[4/*size*/]; -}; - -#if defined(QT_QWS_IPAQ) -static const int sound_fragment_size = 12; -#else -static const int sound_fragment_size = 12; -#endif -static const int sound_buffer_size = 1 << sound_fragment_size; -// nb. there will be an sound startup delay of -// 2^sound_fragment_size / sound_speed seconds. -// (eg. sound_fragment_size==12, sound_speed==44000 means 0.093s delay) - -#ifdef QT_QWS_SOUND_STEREO -static int sound_stereo=QT_QWS_SOUND_STEREO; -#else -static const int sound_stereo=0; -#endif -#ifdef QT_QWS_SOUND_16BIT -static bool sound_16bit=QT_QWS_SOUND_16BIT; -#else -static const bool sound_16bit=false; -#endif - -#ifndef QT_NO_QWS_SOUNDSERVER -class QWSSoundServerClient : public QObject { - Q_OBJECT - -public: - QWSSoundServerClient(QWS_SOCK_BASE *s, QObject* parent); - ~QWSSoundServerClient(); - -public slots: - void sendSoundCompleted(int, int); - void sendDeviceReady(int, int); - void sendDeviceError(int, int, int); - -signals: - void play(int, int, const QString&); - void play(int, int, const QString&, int, int); - void playRaw(int, int, const QString&, int, int, int, int); - - void pause(int, int); - void stop(int, int); - void resume(int, int); - void setVolume(int, int, int, int); - void setMute(int, int, bool); - - void stopAll(int); - - void playPriorityOnly(bool); - - void setSilent( bool ); - -private slots: - void tryReadCommand(); - -private: - void sendClientMessage(QString msg); - int mCurrentID; - int left, right; - bool priExist; - static int lastId; - static int nextId() { return ++lastId; } - QPointer socket; -}; - -int QWSSoundServerClient::lastId = 0; - -QWSSoundServerClient::QWSSoundServerClient(QWS_SOCK_BASE *s, QObject* parent) : - QObject( parent ) -{ - socket = s; - priExist = false; - mCurrentID = nextId(); - connect(socket,SIGNAL(readyRead()), - this,SLOT(tryReadCommand())); - connect(socket, SIGNAL(disconnected()), this, SLOT(deleteLater())); -} - -QWSSoundServerClient::~QWSSoundServerClient() -{ - if (priExist) - playPriorityOnly(false); - emit stopAll(mCurrentID); - if (socket) - socket->deleteLater(); -} - -static QString getStringTok(QString &in) -{ - int pos = in.indexOf(QLatin1Char(' ')); - QString ret; - if (pos > 0) { - ret = in.left(pos); - in = in.mid(pos+1); - } else { - ret = in; - in = QString::null; - } - return ret; -} - -static int getNumTok(QString &in) -{ - return getStringTok(in).toInt(); -} - -void QWSSoundServerClient::tryReadCommand() -{ - while ( socket->canReadLine() ) { - QString l = QString::fromAscii(socket->readLine()); - l.truncate(l.length()-1); // chomp - QString functionName = getStringTok(l); - int soundid = getNumTok(l); - if (functionName == QLatin1String("PLAY")) { - emit play(mCurrentID, soundid, l); - } else if (functionName == QLatin1String("PLAYEXTEND")) { - int volume = getNumTok(l); - int flags = getNumTok(l); - emit play(mCurrentID, soundid, l, volume, flags); - } else if (functionName == QLatin1String("PLAYRAW")) { - int chs = getNumTok(l); - int freq = getNumTok(l); - int bitspersample = getNumTok(l); - int flags = getNumTok(l); - emit playRaw(mCurrentID, soundid, l, freq, chs, bitspersample, flags); - } else if (functionName == QLatin1String("PAUSE")) { - emit pause(mCurrentID, soundid); - } else if (functionName == QLatin1String("STOP")) { - emit stop(mCurrentID, soundid); - } else if (functionName == QLatin1String("RESUME")) { - emit resume(mCurrentID, soundid); - } else if (functionName == QLatin1String("SETVOLUME")) { - int left = getNumTok(l); - int right = getNumTok(l); - emit setVolume(mCurrentID, soundid, left, right); - } else if (functionName == QLatin1String("MUTE")) { - emit setMute(mCurrentID, soundid, true); - } else if (functionName == QLatin1String("UNMUTE")) { - emit setMute(mCurrentID, soundid, false); - } else if (functionName == QLatin1String("PRIORITYONLY")) { - bool sPri = soundid != 0; - if (sPri != priExist) { - priExist = sPri; - emit playPriorityOnly(sPri); - } - } else if(functionName == QLatin1String("SILENT")) { - emit setSilent( soundid != 0 ); - } - } -} - -void QWSSoundServerClient::sendClientMessage(QString msg) -{ -#ifndef QT_NO_TEXTCODEC - QByteArray u = msg.toUtf8(); -#else - QByteArray u = msg.toLatin1(); -#endif - socket->write(u.data(), u.length()); - socket->flush(); -} - -void QWSSoundServerClient::sendSoundCompleted(int gid, int sid) -{ - if (gid == mCurrentID) - sendClientMessage(QLatin1String("SOUNDCOMPLETED ") - + QString::number(sid) + QLatin1Char('\n')); -} - -void QWSSoundServerClient::sendDeviceReady(int gid, int sid) -{ - if (gid == mCurrentID) - sendClientMessage(QLatin1String("DEVICEREADY ") - + QString::number(sid) + QLatin1Char('\n')); -} - -void QWSSoundServerClient::sendDeviceError(int gid, int sid, int err) -{ - if (gid == mCurrentID) - sendClientMessage(QLatin1String("DEVICEERROR ") - + QString::number(sid) + QLatin1Char(' ') - + QString::number(err) + QLatin1Char('\n')); -} -#endif - -static const int maxVolume = 100; -static const int runinLength = 2*sound_buffer_size; -class QWSSoundServerProvider { -public: - QWSSoundServerProvider(int w, int s) - : mWid(w), mSid(s), mMuted(false) - { - leftVolume = maxVolume>>1; - rightVolume = maxVolume>>1; - isPriority = false; - samples_due = 0; - max1 = max2 = out = 0;// = sound_buffer_size; - data = data1; - max = &max1; - sampleRunin = 0; - dev = -1; - } - - virtual ~QWSSoundServerProvider() { - } - - int groupId() const { return mWid; } - int soundId() const { return mSid; } - - void startSampleRunin() { - // inteded to provide even audio return from mute/pause/dead samples. - //sampleRunin = runinLength; // or more? - } - - - void setVolume(int lv, int rv) { - leftVolume = qMin(maxVolume, qMax(0, lv)); - rightVolume = qMin(maxVolume, qMax(0, rv)); - } - - void setMute(bool m) { mMuted = m; } - bool muted() { return mMuted; } - - void setPriority(bool p) { - if (p != isPriority) { - isPriority = p; // currently meaningless. - } - } - - - static void setPlayPriorityOnly(bool p) - { - if (p) - priorityExists++; - else - priorityExists--; - - if (priorityExists < 0) - qDebug("QSS: got more priority offs than ons"); - } - - // return -1 for file broken, give up. - // else return sampels ready for playing. - // argument is max samples server is looking for, - // in terms of current device status. - virtual int readySamples(int) = 0; - - int getSample(int off, int bps) { - - // - // 16-bit audio data is converted to native endian so that it can be scaled - // Yes, this is ugly on a BigEndian machine - // Perhaps it shouldn't be scaled at all - // - return (bps == 1) ? (data[out+off] - 128) * 128 : qToLittleEndian(((short*)data)[(out/2)+off]); - } - - int add(int* mixl, int* mixr, int count) - { - int bytesPerSample = chunkdata.wBitsPerSample >> 3; - - if ( mMuted ) { - sampleRunin -= qMin(sampleRunin,count); - while (count && (dev != -1)) { - if (out >= *max) { - // switch buffers - out = 0; - if (data == data1 && max2 != 0) { - data = data2; - max = &max2; - max1 = 0; - } else if (data == data2 && max1 != 0) { - data = data1; - max = &max1; - max2 = 0; - } else { - qDebug("QSS Read Error: both buffers empty"); - return 0; - } - } - samples_due += sound_speed; - while (count && samples_due >= chunkdata.samplesPerSec) { - samples_due -= chunkdata.samplesPerSec; - count--; - } - out += bytesPerSample * chunkdata.channels; - } - return count; - } - - // This shouldn't be the case - if ( !mixl || !mixr ) - return 0; - - int lVolNum = leftVolume, lVolDen = maxVolume; - int rVolNum = rightVolume, rVolDen = maxVolume; - if (priorityExists > 0 && !isPriority) { - lVolNum = 0; // later, make this gradually fade in and out. - lVolDen = 5; - rVolNum = 0; - rVolDen = 5; - } - - while (count && (dev != -1)) { - if (out >= *max) { - // switch buffers - out = 0; - if (data == data1 && max2 != 0) { - data = data2; - max = &max2; - max1 = 0; - } else if (data == data2 && max1 != 0) { - data = data1; - max = &max1; - max2 = 0; - } else { - qDebug("QSS Read Error: both buffers empty"); - return 0; - } - } - samples_due += sound_speed; - if (count && samples_due >= chunkdata.samplesPerSec) { - int l = getSample(0,bytesPerSample)*lVolNum/lVolDen; - int r = (chunkdata.channels == 2) ? getSample(1,bytesPerSample)*rVolNum/rVolDen : l; - if (!sound_stereo && chunkdata.channels == 2) - l += r; - if (sampleRunin) { - while (sampleRunin && count && samples_due >= chunkdata.samplesPerSec) { - mixl++; - if (sound_stereo) - mixr++; - samples_due -= chunkdata.samplesPerSec; - sampleRunin--; - count--; - } - } - while (count && samples_due >= chunkdata.samplesPerSec) { - *mixl++ += l; - if (sound_stereo) - *mixr++ += r; - samples_due -= chunkdata.samplesPerSec; - count--; - } - } - - // optimize out manipulation of sample if downsampling and we skip it - out += bytesPerSample * chunkdata.channels; - } - - return count; - } - - virtual bool finished() const = 0; - - bool equal(int wid, int sid) - { - return (wid == mWid && sid == mSid); - } - -protected: - - char * prepareBuffer( int &size) - { - // keep reading as long as there is 50 % or more room in off buffer. - if (data == data1 && (max2<<1 < sound_buffer_size)) { - size=sound_buffer_size - max2; - return (char *)data2; - } else if (data == data2 && (max1<<1 < sound_buffer_size)) { - size=sound_buffer_size - max1; - return (char *)data1; - } else { - size = 0; - return 0; - } - } - - void updateBuffer(int read) - { - // always reads to off buffer. - if (read >= 0) { - if (data == data2) { - max1 = read; - } else { - max2 = read; - } - } - } - - int devSamples() - { - int possible = (((max1+max2-out) / ((chunkdata.wBitsPerSample>>3)*chunkdata.channels)) - *sound_speed)/chunkdata.samplesPerSec; - - return possible; - } - - - struct { - qint16 formatTag; - qint16 channels; - qint32 samplesPerSec; - qint32 avgBytesPerSec; - qint16 blockAlign; - qint16 wBitsPerSample; - } chunkdata; - int dev; - int samples_due; -private: - int mWid; - int mSid; - int leftVolume; - int rightVolume; - bool isPriority; - static int priorityExists; - int *max; - uchar *data; - uchar data1[sound_buffer_size+4]; // +4 to handle badly aligned input data - uchar data2[sound_buffer_size+4]; // +4 to handle badly aligned input data - int out, max1, max2; - int sampleRunin; - bool mMuted; -}; - -int QWSSoundServerProvider::priorityExists = 0; - -class QWSSoundServerBucket : public QWSSoundServerProvider { -public: - QWSSoundServerBucket(int d, int wid, int sid) - : QWSSoundServerProvider(wid, sid) - { - dev = d; - wavedata_remaining = -1; - mFinishedRead = false; - mInsufficientSamples = false; - } - ~QWSSoundServerBucket() - { - //dev->close(); - ::close(dev); - } - bool finished() const - { - //return !max; - return mInsufficientSamples && mFinishedRead ; - } - int readySamples(int) - { - int size; - char *dest = prepareBuffer(size); - // may want to change this to something like - // if (data == data1 && max2<<1 < sound_buffer_size - // || - // data == data2 && max1<<1 < sound_buffer_size) - // so will keep filling off buffer while there is +50% space left - if (size > 0 && dest != 0) { - while ( wavedata_remaining < 0 ) { - //max = 0; - wavedata_remaining = -1; - // Keep reading chunks... - const int n = sizeof(chunk)-sizeof(chunk.data); - int nr = ::read(dev, (void*)&chunk,n); - if ( nr != n ) { - // XXX check error? or don't we care? - wavedata_remaining = 0; - mFinishedRead = true; - } else if ( qstrncmp(chunk.id,"data",4) == 0 ) { - wavedata_remaining = qToLittleEndian( chunk.size ); - - //out = max = sound_buffer_size; - - } else if ( qstrncmp(chunk.id,"RIFF",4) == 0 ) { - char d[4]; - if ( read(dev, d, 4) != 4 ) { - // XXX check error? or don't we care? - //qDebug("couldn't read riff"); - mInsufficientSamples = true; - mFinishedRead = true; - return 0; - } else if ( qstrncmp(d,"WAVE",4) != 0 ) { - // skip - if ( chunk.size > 1000000000 || lseek(dev,chunk.size-4, SEEK_CUR) == -1 ) { - //qDebug("oversized wav chunk"); - mFinishedRead = true; - } - } - } else if ( qstrncmp(chunk.id,"fmt ",4) == 0 ) { - if ( ::read(dev,(char*)&chunkdata,sizeof(chunkdata)) != sizeof(chunkdata) ) { - // XXX check error? or don't we care? - //qDebug("couldn't ready chunkdata"); - mFinishedRead = true; - } - -#define WAVE_FORMAT_PCM 1 - else - { - /* - ** Endian Fix the chuck data - */ - chunkdata.formatTag = qToLittleEndian( chunkdata.formatTag ); - chunkdata.channels = qToLittleEndian( chunkdata.channels ); - chunkdata.samplesPerSec = qToLittleEndian( chunkdata.samplesPerSec ); - chunkdata.avgBytesPerSec = qToLittleEndian( chunkdata.avgBytesPerSec ); - chunkdata.blockAlign = qToLittleEndian( chunkdata.blockAlign ); - chunkdata.wBitsPerSample = qToLittleEndian( chunkdata.wBitsPerSample ); - if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) { - qWarning("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag); - mFinishedRead = true; - } - } - } else { - // ignored chunk - if ( chunk.size > 1000000000 || lseek(dev, chunk.size, SEEK_CUR) == -1) { - //qDebug("chunk size too big"); - mFinishedRead = true; - } - } - } - // this looks wrong. - if (wavedata_remaining <= 0) { - mFinishedRead = true; - } - - } - // may want to change this to something like - // if (data == data1 && max2<<1 < sound_buffer_size - // || - // data == data2 && max1<<1 < sound_buffer_size) - // so will keep filling off buffer while there is +50% space left - - if (wavedata_remaining) { - if (size > 0 && dest != 0) { - int read = ::read(dev, dest, qMin(size, wavedata_remaining)); - // XXX check error? or don't we care? - wavedata_remaining -= read; - updateBuffer(read); - if (read <= 0) // data unexpectidly ended - mFinishedRead = true; - } - } - int possible = devSamples(); - if (possible == 0) - mInsufficientSamples = true; - return possible; - } - -protected: - QRiffChunk chunk; - int wavedata_remaining; - bool mFinishedRead; - bool mInsufficientSamples; -}; - -class QWSSoundServerStream : public QWSSoundServerProvider { -public: - QWSSoundServerStream(int d,int c, int f, int b, - int wid, int sid) - : QWSSoundServerProvider(wid, sid) - { - chunkdata.channels = c; - chunkdata.samplesPerSec = f; - chunkdata.wBitsPerSample = b; - dev = d; - //fcntl( dev, F_SETFL, O_NONBLOCK ); - lasttime = 0; - } - - ~QWSSoundServerStream() - { - if (dev != -1) { - ::close(dev); - dev = -1; - } - } - - bool finished() const - { - return (dev == -1); - } - - - int readySamples(int) - { - int size; - char *dest = prepareBuffer(size); - if (size > 0 && dest != 0 && dev != -1) { - - int read = ::read(dev, dest, size); - if (read < 0) { - switch(errno) { - case EAGAIN: - case EINTR: - // means read may yet succeed on the next attempt - break; - default: - // unexpected error, fail. - ::close(dev); - dev = -1; - } - } else if (read == 0) { - // 0 means writer has closed dev and/or - // file is at end. - ::close(dev); - dev = -1; - } else { - updateBuffer(read); - } - } - int possible = devSamples(); - if (possible == 0) - startSampleRunin(); - return possible; - } - -protected: - time_t lasttime; -}; - -#ifndef QT_NO_QWS_SOUNDSERVER -QWSSoundServerSocket::QWSSoundServerSocket(QObject *parent) : - QWSServerSocket(QT_VFB_SOUND_PIPE(qws_display_id), parent) -{ - connect(this, SIGNAL(newConnection()), this, SLOT(newConnection())); -} - - -#ifdef QT3_SUPPORT -QWSSoundServerSocket::QWSSoundServerSocket(QObject *parent, const char *name) : - QWSServerSocket(QT_VFB_SOUND_PIPE(qws_display_id), parent) -{ - if (name) - setObjectName(QString::fromAscii(name)); - connect(this, SIGNAL(newConnection()), this, SLOT(newConnection())); -} -#endif - -void QWSSoundServerSocket::newConnection() -{ - while (QWS_SOCK_BASE *sock = nextPendingConnection()) { - QWSSoundServerClient* client = new QWSSoundServerClient(sock,this); - - connect(client, SIGNAL(play(int,int,QString)), - this, SIGNAL(playFile(int,int,QString))); - connect(client, SIGNAL(play(int,int,QString,int,int)), - this, SIGNAL(playFile(int,int,QString,int,int))); - connect(client, SIGNAL(playRaw(int,int,QString,int,int,int,int)), - this, SIGNAL(playRawFile(int,int,QString,int,int,int,int))); - - connect(client, SIGNAL(pause(int,int)), - this, SIGNAL(pauseFile(int,int))); - connect(client, SIGNAL(stop(int,int)), - this, SIGNAL(stopFile(int,int))); - connect(client, SIGNAL(playPriorityOnly(bool)), - this, SIGNAL(playPriorityOnly(bool))); - connect(client, SIGNAL(stopAll(int)), - this, SIGNAL(stopAll(int))); - connect(client, SIGNAL(resume(int,int)), - this, SIGNAL(resumeFile(int,int))); - - connect(client, SIGNAL(setSilent(bool)), - this, SIGNAL(setSilent(bool))); - - connect(client, SIGNAL(setMute(int,int,bool)), - this, SIGNAL(setMute(int,int,bool))); - connect(client, SIGNAL(setVolume(int,int,int,int)), - this, SIGNAL(setVolume(int,int,int,int))); - - connect(this, SIGNAL(soundFileCompleted(int,int)), - client, SLOT(sendSoundCompleted(int,int))); - connect(this, SIGNAL(deviceReady(int,int)), - client, SLOT(sendDeviceReady(int,int))); - connect(this, SIGNAL(deviceError(int,int,int)), - client, SLOT(sendDeviceError(int,int,int))); - } -} - -#endif - -class QWSSoundServerPrivate : public QObject { - Q_OBJECT - -public: - QWSSoundServerPrivate(QObject* parent=0, const char* name=0) : - QObject(parent) - { - timerId = 0; - if (name) - setObjectName(QString::fromAscii(name)); -#ifndef QT_NO_QWS_SOUNDSERVER - server = new QWSSoundServerSocket(this); - - connect(server, SIGNAL(playFile(int,int,QString)), - this, SLOT(playFile(int,int,QString))); - connect(server, SIGNAL(playFile(int,int,QString,int,int)), - this, SLOT(playFile(int,int,QString,int,int))); - connect(server, SIGNAL(playRawFile(int,int,QString,int,int,int,int)), - this, SLOT(playRawFile(int,int,QString,int,int,int,int))); - - connect(server, SIGNAL(pauseFile(int,int)), - this, SLOT(pauseFile(int,int))); - connect(server, SIGNAL(stopFile(int,int)), - this, SLOT(stopFile(int,int))); - connect(server, SIGNAL(stopAll(int)), - this, SLOT(stopAll(int))); - connect(server, SIGNAL(playPriorityOnly(bool)), - this, SLOT(playPriorityOnly(bool))); - connect(server, SIGNAL(resumeFile(int,int)), - this, SLOT(resumeFile(int,int))); - - connect( server, SIGNAL(setSilent(bool)), - this, SLOT(setSilent(bool))); - - connect(server, SIGNAL(setMute(int,int,bool)), - this, SLOT(setMute(int,int,bool))); - connect(server, SIGNAL(setVolume(int,int,int,int)), - this, SLOT(setVolume(int,int,int,int))); - - connect(this, SIGNAL(soundFileCompleted(int,int)), - server, SIGNAL(soundFileCompleted(int,int))); - connect(this, SIGNAL(deviceReady(int,int)), - server, SIGNAL(deviceReady(int,int))); - connect(this, SIGNAL(deviceError(int,int,int)), - server, SIGNAL(deviceError(int,int,int))); - -#endif - silent = false; - fd = -1; - unwritten = 0; - can_GETOSPACE = true; - } - - ~QWSSoundServerPrivate() - { - qDeleteAll(active); - qDeleteAll(inactive); - } - -signals: - void soundFileCompleted(int, int); - void deviceReady(int, int); - void deviceError(int, int, int); - -public slots: - void playRawFile(int wid, int sid, const QString &filename, int freq, int channels, int bitspersample, int flags); - void playFile(int wid, int sid, const QString& filename); - void playFile(int wid, int sid, const QString& filename, int v, int flags); - void checkPresetVolumes(int wid, int sid, QWSSoundServerProvider *p); - void pauseFile(int wid, int sid); - void resumeFile(int wid, int sid); - void stopFile(int wid, int sid); - void stopAll(int wid); - void setVolume(int wid, int sid, int lv, int rv); - void setMute(int wid, int sid, bool m); - void playPriorityOnly(bool p); - void sendCompletedSignals(); - void feedDevice(int fd); - void setSilent( bool enabled ); - -protected: - void timerEvent(QTimerEvent* event); - -private: - int openFile(int wid, int sid, const QString& filename); - bool openDevice(); - void closeDevice() - { - if (fd >= 0) { - ::close(fd); - fd = -1; - } - } - - QList active; - QList inactive; - struct PresetVolume { - int wid; - int sid; - int left; - int right; - bool mute; - }; - QList volumes; - struct CompletedInfo { - CompletedInfo( ) : groupId( 0 ), soundId( 0 ) { } - CompletedInfo( int _groupId, int _soundId ) : groupId( _groupId ), soundId( _soundId ) { } - int groupId; - int soundId; - }; - QList completed; - - bool silent; - - int fd; - int unwritten; - int timerId; - char* cursor; - short data[sound_buffer_size*2]; - bool can_GETOSPACE; -#ifndef QT_NO_QWS_SOUNDSERVER - QWSSoundServerSocket *server; -#endif -}; - -void QWSSoundServerPrivate::setSilent( bool enabled ) -{ - // Close output device - closeDevice(); - if( !unwritten && !active.count() ) { - sendCompletedSignals(); - } - // Stop processing audio - killTimer( timerId ); - silent = enabled; - // If audio remaining, open output device and continue processing - if( unwritten || active.count() ) { - openDevice(); - } -} - -void QWSSoundServerPrivate::timerEvent(QTimerEvent* event) -{ - // qDebug("QSS timer event"); - if( event->timerId() == timerId ) { - if (fd >= 0) - feedDevice(fd); - if (fd < 0) { - killTimer(timerId); - timerId = 0; - } - } -} - -void QWSSoundServerPrivate::playRawFile(int wid, int sid, const QString &filename, - int freq, int channels, int bitspersample, int flags) -{ -#ifdef QT_NO_QWS_SOUNDSERVER - Q_UNUSED(flags); -#endif - int f = openFile(wid, sid, filename); - if ( f ) { - QWSSoundServerStream *b = new QWSSoundServerStream(f, channels, freq, bitspersample, wid, sid); - // check preset volumes. - checkPresetVolumes(wid, sid, b); -#ifndef QT_NO_QWS_SOUNDSERVER - b->setPriority((flags & QWSSoundClient::Priority) == QWSSoundClient::Priority); -#endif - active.append(b); - emit deviceReady(wid, sid); - } -} - -void QWSSoundServerPrivate::playFile(int wid, int sid, const QString& filename) -{ - int f = openFile(wid, sid, filename); - if ( f ) { - QWSSoundServerProvider *b = new QWSSoundServerBucket(f, wid, sid); - checkPresetVolumes(wid, sid, b); - active.append( b ); - emit deviceReady(wid, sid); - } -} - -void QWSSoundServerPrivate::playFile(int wid, int sid, const QString& filename, - int v, int flags) -{ -#ifdef QT_NO_QWS_SOUNDSERVER - Q_UNUSED(flags); -#endif - int f = openFile(wid, sid, filename); - if ( f ) { - QWSSoundServerProvider *b = new QWSSoundServerBucket(f, wid, sid); - checkPresetVolumes(wid, sid, b); - b->setVolume(v, v); -#ifndef QT_NO_QWS_SOUNDSERVER - b->setPriority((flags & QWSSoundClient::Priority) == QWSSoundClient::Priority); -#endif - active.append(b); - emit deviceReady(wid, sid); - } -} - -void QWSSoundServerPrivate::checkPresetVolumes(int wid, int sid, QWSSoundServerProvider *p) -{ - QList::Iterator it = volumes.begin(); - while (it != volumes.end()) { - PresetVolume v = *it; - if (v.wid == wid && v.sid == sid) { - p->setVolume(v.left, v.right); - p->setMute(v.mute); - it = volumes.erase(it); - return; - } else { - ++it; - } - } -} - -void QWSSoundServerPrivate::pauseFile(int wid, int sid) -{ - QWSSoundServerProvider *bucket; - for (int i = 0; i < active.size(); ++i ) { - bucket = active.at(i); - if (bucket->equal(wid, sid)) { - // found bucket.... - active.removeAt(i); - inactive.append(bucket); - return; - } - } -} - -void QWSSoundServerPrivate::resumeFile(int wid, int sid) -{ - QWSSoundServerProvider *bucket; - for (int i = 0; i < inactive.size(); ++i ) { - bucket = inactive.at(i); - if (bucket->equal(wid, sid)) { - // found bucket.... - inactive.removeAt(i); - active.append(bucket); - return; - } - } -} - -void QWSSoundServerPrivate::stopFile(int wid, int sid) -{ - QWSSoundServerProvider *bucket; - for (int i = 0; i < active.size(); ++i ) { - bucket = active.at(i); - if (bucket->equal(wid, sid)) { - active.removeAt(i); - delete bucket; - return; - } - } - for (int i = 0; i < inactive.size(); ++i ) { - bucket = inactive.at(i); - if (bucket->equal(wid, sid)) { - inactive.removeAt(i); - delete bucket; - return; - } - } -} - -void QWSSoundServerPrivate::stopAll(int wid) -{ - QWSSoundServerProvider *bucket; - if (!active.isEmpty()) { - QList::Iterator it = active.begin(); - while (it != active.end()) { - bucket = *it; - if (bucket->groupId() == wid) { - it = active.erase(it); - delete bucket; - } else { - ++it; - } - } - } - if (!inactive.isEmpty()) { - QList::Iterator it = inactive.begin(); - while (it != inactive.end()) { - bucket = *it; - if (bucket->groupId() == wid) { - it = inactive.erase(it); - delete bucket; - } else { - ++it; - } - } - } -} - -void QWSSoundServerPrivate::setVolume(int wid, int sid, int lv, int rv) -{ - QWSSoundServerProvider *bucket; - for( int i = 0; i < active.size(); ++i ) { - bucket = active.at(i); - if (bucket->equal(wid, sid)) { - bucket->setVolume(lv,rv); - return; - } - } - // If gotten here, then it means wid/sid wasn't set up yet. - // first find and remove current preset volumes, then add this one. - QList::Iterator it = volumes.begin(); - while (it != volumes.end()) { - PresetVolume v = *it; - if (v.wid == wid && v.sid == sid) - it = volumes.erase(it); - else - ++it; - } - // and then add this volume - PresetVolume nv; - nv.wid = wid; - nv.sid = sid; - nv.left = lv; - nv.right = rv; - nv.mute = false; - volumes.append(nv); -} - -void QWSSoundServerPrivate::setMute(int wid, int sid, bool m) -{ - QWSSoundServerProvider *bucket; - for( int i = 0; i < active.size(); ++i ) { - bucket = active.at(i); - if (bucket->equal(wid, sid)) { - bucket->setMute(m); - return; - } - } - // if gotten here then setting is being applied before item - // is created. - QList::Iterator it = volumes.begin(); - while (it != volumes.end()) { - PresetVolume v = *it; - if (v.wid == wid && v.sid == sid) { - (*it).mute = m; - return; - } - } - if (m) { - PresetVolume nv; - nv.wid = wid; - nv.sid = sid; - nv.left = maxVolume>>1; - nv.right = maxVolume>>1; - nv.mute = true; - volumes.append(nv); - } -} - -void QWSSoundServerPrivate::playPriorityOnly(bool p) -{ - QWSSoundServerProvider::setPlayPriorityOnly(p); -} - -void QWSSoundServerPrivate::sendCompletedSignals() -{ - while( !completed.isEmpty() ) { - emit soundFileCompleted( (*completed.begin()).groupId, - (*completed.begin()).soundId ); - completed.erase( completed.begin() ); - } -} - - -int QWSSoundServerPrivate::openFile(int wid, int sid, const QString& filename) -{ - stopFile(wid, sid); // close and re-open. - int f = QT_OPEN(QFile::encodeName(filename), O_RDONLY|O_NONBLOCK); - if (f == -1) { - // XXX check ferror, check reason. - qDebug("Failed opening \"%s\"",filename.toLatin1().data()); -#ifndef QT_NO_QWS_SOUNDSERVER - emit deviceError(wid, sid, (int)QWSSoundClient::ErrOpeningFile ); -#endif - } else if ( openDevice() ) { - return f; - } -#ifndef QT_NO_QWS_SOUNDSERVER - emit deviceError(wid, sid, (int)QWSSoundClient::ErrOpeningAudioDevice ); -#endif - return 0; -} - -bool QWSSoundServerPrivate::openDevice() -{ - if (fd < 0) { - if( silent ) { - fd = QT_OPEN( "/dev/null", O_WRONLY ); - // Emulate write to audio device - int delay = 1000*(sound_buffer_size>>(sound_stereo+sound_16bit))/sound_speed/2; - timerId = startTimer(delay); - - return true; - } - // - // Don't block open right away. - // - bool openOkay = false; - if ((fd = QT_OPEN("/dev/dsp", O_WRONLY|O_NONBLOCK)) != -1) { - int flags = fcntl(fd, F_GETFL); - flags &= ~O_NONBLOCK; - openOkay = (fcntl(fd, F_SETFL, flags) == 0); - } - if (!openOkay) { - qDebug("Failed opening audio device"); - return false; - } - - // Setup soundcard at 16 bit mono - int v; - //v=0x00010000+sound_fragment_size; - // um the media player did this instead. - v=0x10000 * 4 + sound_fragment_size; - if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &v)) - qWarning("Could not set fragments to %08x",v); -#ifdef QT_QWS_SOUND_16BIT - // - // Use native endian - // Since we have manipulated the data volume the data - // is now in native format, even though its stored - // as little endian in the WAV file - // - v=AFMT_S16_NE; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v)) - qWarning("Could not set format %d",v); - if (AFMT_S16_NE != v) - qDebug("Want format %d got %d", AFMT_S16_LE, v); -#else - v=AFMT_U8; if (ioctl(fd, SNDCTL_DSP_SETFMT, &v)) - qWarning("Could not set format %d",v); - if (AFMT_U8 != v) - qDebug("Want format %d got %d", AFMT_U8, v); -#endif - v=sound_stereo; if (ioctl(fd, SNDCTL_DSP_STEREO, &v)) - qWarning("Could not set stereo %d",v); - if (sound_stereo != v) - qDebug("Want stereo %d got %d", sound_stereo, v); -#ifdef QT_QWS_SOUND_STEREO - sound_stereo=v; -#endif - v=sound_speed; if (ioctl(fd, SNDCTL_DSP_SPEED, &sound_speed)) - qWarning("Could not set speed %d",v); - if (v != sound_speed) - qDebug("Want speed %d got %d", v, sound_speed); - - int delay = 1000*(sound_buffer_size>>(sound_stereo+sound_16bit)) - /sound_speed/2; - // qDebug("QSS delay: %d", delay); - timerId = startTimer(delay); - - // - // Check system volume - // - int mixerHandle = QT_OPEN( "/dev/mixer", O_RDWR|O_NONBLOCK ); - if ( mixerHandle >= 0 ) { - int volume; - ioctl( mixerHandle, MIXER_READ(0), &volume ); - close( mixerHandle ); - if ( volume < 1<<(sound_stereo+sound_16bit) ) - qDebug("Want sound at %d got %d", - 1<<(sound_stereo+sound_16bit), volume); - } else - qDebug( "get volume of audio device failed" ); - - } - return true; -} - -void QWSSoundServerPrivate::feedDevice(int fd) -{ - if ( !unwritten && active.size() == 0 ) { - closeDevice(); - sendCompletedSignals(); - return; - } else { - sendCompletedSignals(); - } - - QWSSoundServerProvider* bucket; - - // find out how much audio is possible - int available = sound_buffer_size; - QList running; - for (int i = 0; i < active.size(); ++i) { - bucket = active.at(i); - int ready = bucket->readySamples(available); - if (ready > 0) { - available = qMin(available, ready); - running.append(bucket); - } - } - - audio_buf_info info; - if (can_GETOSPACE && ioctl(fd,SNDCTL_DSP_GETOSPACE,&info)) { - can_GETOSPACE = false; - fcntl(fd, F_SETFL, O_NONBLOCK); - } - if (!can_GETOSPACE) - info.fragments = 4; // #### configurable? - if (info.fragments > 0) { - if (!unwritten) { - int left[sound_buffer_size]; - memset(left,0,available*sizeof(int)); - int right[sound_buffer_size]; - if ( sound_stereo ) - memset(right,0,available*sizeof(int)); - - if (running.size() > 0) { - // should do volume mod here in regards to each bucket to avoid flattened/bad peaks. - for (int i = 0; i < running.size(); ++i ) { - bucket = running.at(i); - int unused = bucket->add(left,right,available); - if (unused > 0) { - // this error is quite serious, as - // it will really screw up mixing. - qDebug("provider lied about samples ready"); - } - } - if ( sound_16bit ) { - short *d = (short*)data; - for (int i=0; i::Iterator it = active.begin(); - while (it != active.end()) { - bucket = *it; - if (bucket->finished()) { - completed.append(CompletedInfo(bucket->groupId(), bucket->soundId())); - it = active.erase(it); - delete bucket; - } else { - ++it; - } - } -} - - -QWSSoundServer::QWSSoundServer(QObject* parent) : - QObject(parent) -{ - d = new QWSSoundServerPrivate(this); - - connect( d, SIGNAL(soundFileCompleted(int,int)), - this, SLOT(translateSoundCompleted(int,int)) ); -} - -void QWSSoundServer::playFile( int sid, const QString& filename ) -{ - //wid == 0, as it is the server initiating rather than a client - // if wid was passable, would accidently collide with server - // sockect's wids. - d->playFile(0, sid, filename); -} - -void QWSSoundServer::pauseFile( int sid ) -{ - d->pauseFile(0, sid); -} - -void QWSSoundServer::stopFile( int sid ) -{ - d->stopFile(0, sid); -} - -void QWSSoundServer::resumeFile( int sid ) -{ - d->resumeFile(0, sid); -} - -QWSSoundServer::~QWSSoundServer() -{ - d->stopAll(0); -} - -void QWSSoundServer::translateSoundCompleted( int, int sid ) -{ - emit soundCompleted( sid ); -} - -#ifndef QT_NO_QWS_SOUNDSERVER -QWSSoundClient::QWSSoundClient(QObject* parent) : - QWSSocket(parent) -{ - connectToLocalFile(QT_VFB_SOUND_PIPE(qws_display_id)); - QObject::connect(this,SIGNAL(readyRead()), - this,SLOT(tryReadCommand())); - if( state() == QWS_SOCK_BASE::ConnectedState ) QTimer::singleShot(1, this, SIGNAL(connected())); - else QTimer::singleShot(1, this, SLOT(emitConnectionRefused())); -} - -QWSSoundClient::~QWSSoundClient( ) -{ - flush(); -} - -void QWSSoundClient::reconnect() -{ - connectToLocalFile(QT_VFB_SOUND_PIPE(qws_display_id)); - if( state() == QWS_SOCK_BASE::ConnectedState ) emit connected(); - else emit error( QTcpSocket::ConnectionRefusedError ); -} - -void QWSSoundClient::sendServerMessage(QString msg) -{ -#ifndef QT_NO_TEXTCODEC - QByteArray u = msg.toUtf8(); -#else - QByteArray u = msg.toLatin1(); -#endif - write(u.data(), u.length()); - flush(); -} - -void QWSSoundClient::play( int id, const QString& filename ) -{ - QFileInfo fi(filename); - sendServerMessage(QLatin1String("PLAY ") - + QString::number(id) + QLatin1Char(' ') - + fi.absoluteFilePath() + QLatin1Char('\n')); -} - -void QWSSoundClient::play( int id, const QString& filename, int volume, int flags) -{ - QFileInfo fi(filename); - sendServerMessage(QLatin1String("PLAYEXTEND ") - + QString::number(id) + QLatin1Char(' ') - + QString::number(volume) + QLatin1Char(' ') - + QString::number(flags) + QLatin1Char(' ') - + fi.absoluteFilePath() + QLatin1Char('\n')); -} - -void QWSSoundClient::pause( int id ) -{ - sendServerMessage(QLatin1String("PAUSE ") - + QString::number(id) + QLatin1Char('\n')); -} - -void QWSSoundClient::stop( int id ) -{ - sendServerMessage(QLatin1String("STOP ") - + QString::number(id) + QLatin1Char('\n')); -} - -void QWSSoundClient::resume( int id ) -{ - sendServerMessage(QLatin1String("RESUME ") - + QString::number(id) + QLatin1Char('\n')); -} - -void QWSSoundClient::playRaw( int id, const QString& filename, - int freq, int chs, int bitspersample, int flags) -{ - QFileInfo fi(filename); - sendServerMessage(QLatin1String("PLAYRAW ") - + QString::number(id) + QLatin1Char(' ') - + QString::number(chs) + QLatin1Char(' ') - + QString::number(freq) + QLatin1Char(' ') - + QString::number(bitspersample) + QLatin1Char(' ') - + QString::number(flags) + QLatin1Char(' ') - + fi.absoluteFilePath() + QLatin1Char('\n')); -} - -void QWSSoundClient::setMute( int id, bool m ) -{ - sendServerMessage(QLatin1String(m ? "MUTE " : "UNMUTE ") - + QString::number(id) + QLatin1Char('\n')); -} - -void QWSSoundClient::setVolume( int id, int leftVol, int rightVol ) -{ - sendServerMessage(QLatin1String("SETVOLUME ") - + QString::number(id) + QLatin1Char(' ') - + QString::number(leftVol) + QLatin1Char(' ') - + QString::number(rightVol) + QLatin1Char('\n')); -} - -void QWSSoundClient::playPriorityOnly( bool pri ) -{ - sendServerMessage(QLatin1String("PRIORITYONLY ") - + QString::number(pri ? 1 : 0) + QLatin1Char('\n')); -} - -void QWSSoundClient::setSilent( bool enable ) -{ - sendServerMessage(QLatin1String("SILENT ") - + QString::number( enable ? 1 : 0 ) + QLatin1Char('\n')); -} - -void QWSSoundClient::tryReadCommand() -{ - while ( canReadLine() ) { - QString l = QString::fromAscii(readLine()); - l.truncate(l.length()-1); // chomp - QStringList token = l.split(QLatin1Char(' ')); - if (token[0] == QLatin1String("SOUNDCOMPLETED")) { - emit soundCompleted(token[1].toInt()); - } else if (token[0] == QLatin1String("DEVICEREADY")) { - emit deviceReady(token[1].toInt()); - } else if (token[0] == QLatin1String("DEVICEERROR")) { - emit deviceError(token[1].toInt(),(DeviceErrors)token[2].toInt()); - } - } -} - -void QWSSoundClient::emitConnectionRefused() -{ - emit error( QTcpSocket::ConnectionRefusedError ); -} -#endif - -QT_END_NAMESPACE - -#include "qsoundqss_qws.moc" - -#endif // QT_NO_SOUND diff --git a/src/gui/embedded/qsoundqss_qws.h b/src/gui/embedded/qsoundqss_qws.h deleted file mode 100644 index e31633a8769..00000000000 --- a/src/gui/embedded/qsoundqss_qws.h +++ /dev/null @@ -1,177 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSOUNDQSS_QWS_H -#define QSOUNDQSS_QWS_H - -#include - -#ifndef QT_NO_SOUND - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if defined(QT_NO_NETWORK) || defined(QT_NO_DNS) -#define QT_NO_QWS_SOUNDSERVER -#endif - -#ifndef Q_OS_MAC - -class QWSSoundServerPrivate; - -class Q_GUI_EXPORT QWSSoundServer : public QObject { - Q_OBJECT -public: - explicit QWSSoundServer(QObject *parent=0); - ~QWSSoundServer(); - void playFile( int id, const QString& filename ); - void stopFile( int id ); - void pauseFile( int id ); - void resumeFile( int id ); - -Q_SIGNALS: - void soundCompleted( int ); - -private Q_SLOTS: - void translateSoundCompleted( int, int ); - -private: - QWSSoundServerPrivate* d; -}; - -#ifndef QT_NO_QWS_SOUNDSERVER -class Q_GUI_EXPORT QWSSoundClient : public QWSSocket { - Q_OBJECT -public: - - enum SoundFlags { - Priority = 0x01, - Streaming = 0x02 // currently ignored, but but could set up so both Raw and non raw can be done streaming or not. - }; - enum DeviceErrors { - ErrOpeningAudioDevice = 0x01, - ErrOpeningFile = 0x02, - ErrReadingFile = 0x04 - }; - explicit QWSSoundClient(QObject* parent=0); - ~QWSSoundClient( ); - void reconnect(); - void play( int id, const QString& filename ); - void play( int id, const QString& filename, int volume, int flags = 0 ); - void playRaw( int id, const QString&, int, int, int, int flags = 0 ); - - void pause( int id ); - void stop( int id ); - void resume( int id ); - void setVolume( int id, int left, int right ); - void setMute( int id, bool m ); - - // to be used by server only, to protect phone conversation/rings. - void playPriorityOnly(bool); - - // If silent, tell sound server to release audio device - // Otherwise, allow sound server to regain audio device - void setSilent(bool); - -Q_SIGNALS: - void soundCompleted(int); - void deviceReady(int id); - void deviceError(int id, QWSSoundClient::DeviceErrors); - -private Q_SLOTS: - void tryReadCommand(); - void emitConnectionRefused(); - -private: - void sendServerMessage(QString msg); -}; - -class QWSSoundServerSocket : public QWSServerSocket { - Q_OBJECT - -public: - explicit QWSSoundServerSocket(QObject *parent=0); -public Q_SLOTS: - void newConnection(); - -#ifdef QT3_SUPPORT -public: - QT3_SUPPORT_CONSTRUCTOR QWSSoundServerSocket(QObject *parent, const char *name); -#endif - -Q_SIGNALS: - void playFile(int, int, const QString&); - void playFile(int, int, const QString&, int, int); - void playRawFile(int, int, const QString&, int, int, int, int); - void pauseFile(int, int); - void stopFile(int, int); - void resumeFile(int, int); - void setVolume(int, int, int, int); - void setMute(int, int, bool); - - void stopAll(int); - - void playPriorityOnly(bool); - - void setSilent(bool); - - void soundFileCompleted(int, int); - void deviceReady(int, int); - void deviceError(int, int, int); -}; -#endif - -#endif // Q_OS_MAC - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_SOUND - -#endif // QSOUNDQSS_QWS_H diff --git a/src/gui/embedded/qtransportauth_qws.cpp b/src/gui/embedded/qtransportauth_qws.cpp deleted file mode 100644 index f05699f3408..00000000000 --- a/src/gui/embedded/qtransportauth_qws.cpp +++ /dev/null @@ -1,1563 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtransportauth_qws.h" -#include "qtransportauth_qws_p.h" - -#ifndef QT_NO_SXE - -#include "../../3rdparty/md5/md5.h" -#include "../../3rdparty/md5/md5.cpp" -#include "qwsutils_qws.h" -#include "qwssocket_qws.h" -#include "qwscommand_qws_p.h" -#include "qwindowsystem_qws.h" -#include "qbuffer.h" -#include "qthread.h" -#include "qabstractsocket.h" -#include "qlibraryinfo.h" -#include "qfile.h" -#include "qdebug.h" -#include // overrides QT_OPEN - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define BUF_SIZE 512 - -QT_BEGIN_NAMESPACE - -/*! - \internal - memset for security purposes, guaranteed not to be optimized away - http://www.faqs.org/docs/Linux-HOWTO/Secure-Programs-HOWTO.html -*/ -Q_GUI_EXPORT void *guaranteed_memset(void *v,int c,size_t n) -{ - volatile char *p = (char *)v; while (n--) *p++=c; return v; -} - -/*! - \class QTransportAuth - \internal - - \brief Authenticate a message transport. - - For performance reasons, message authentication is tied to an individual - message transport instance. For example in connection oriented transports - the authentication cookie can be cached against the connection avoiding - the overhead of authentication on every message. - - For each process there is one instance of the QTransportAuth object. - For server processes it can determine the \link secure-exe-environ.html SXE - Program Identity \endlink and provide access to policy data to determine if - the message should be forwarded for action. If not actioned, the message - may be treated as being from a flawed or malicious process. - - Retrieve the instance with the getInstance() method. The constructor is - disabled and instances of QTransportAuth should never be constructed by - calling classes. - - To make the Authentication easier to use a proxied QIODevice is provided - which uses an internal QBuffer. - - In the server code first get a pointer to a QTransportAuth::Data object - using the connectTransport() method: - - \snippet doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp 0 - - Here it is asserted that the transport is trusted. See the assumptions - listed in the \link secure-exe-environ.html SXE documentation \endlink - - Then proxy in the authentication device: - - \snippet doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp 1 - - In the client code it is similar. Use the connectTransport() method - just the same then proxy in the authentication device instead of the - socket in write calls: - - \snippet doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp 2 -*/ - -static int hmac_md5( - unsigned char* text, /* pointer to data stream */ - int text_length, /* length of data stream */ - const unsigned char* key, /* pointer to authentication key */ - int key_length, /* length of authentication key */ - unsigned char * digest /* caller digest to be filled in */ - ); - - - -#define KEY_CACHE_SIZE 30 - -const char * const errorStrings[] = { - "pending identity verification", - "message too small to carry auth data", - "cache miss on connection oriented transport", - "no magic bytes on message", - "key not found for prog id", - "authorization key match failed", - "key out of date" -}; - -const char *QTransportAuth::errorString( const Data &d ) -{ - if (( d.status & ErrMask ) == Success ) - return "success"; - int e = d.status & ErrMask; - if ( e > OutOfDate ) - return "unknown"; - return errorStrings[e]; -} - -SxeRegistryLocker::SxeRegistryLocker( QObject *reg ) - : m_success( false ) - , m_reg( 0 ) -{ - if ( reg ) - if ( !QMetaObject::invokeMethod( reg, "lockManifest", Q_RETURN_ARG(bool, m_success) )) - m_success = false; - m_reg = reg; -} - -SxeRegistryLocker::~SxeRegistryLocker() -{ - if ( m_success ) - QMetaObject::invokeMethod( m_reg, "unlockManifest" ); -} - - -QTransportAuthPrivate::QTransportAuthPrivate() - : keyInitialised(false) - , m_packageRegistry( 0 ) -{ -} - -QTransportAuthPrivate::~QTransportAuthPrivate() -{ -} - -/*! - \internal - Construct a new QTransportAuth -*/ -QTransportAuth::QTransportAuth() : QObject(*new QTransportAuthPrivate) -{ - // qDebug( "creating transport auth" ); -} - -/*! - \internal - Destructor -*/ -QTransportAuth::~QTransportAuth() -{ - // qDebug( "deleting transport auth" ); -} - -/*! - Set the process key for this currently running Qt Extended process to - the \a authdata. \a authdata should be sizeof(struct AuthCookie) - in length and contain the key and program id. Use this method - when setting or changing the SXE identity of the current program. -*/ -void QTransportAuth::setProcessKey( const char *authdata ) -{ - Q_D(QTransportAuth); - ::memcpy(&d->authKey, authdata, sizeof(struct AuthCookie)); - QFile proc_key( QLatin1String("/proc/self/lids_key") ); - // where proc key exists use that instead - if ( proc_key.open( QIODevice::ReadOnly )) - { - qint64 kb = proc_key.read( (char*)&d->authKey.key, QSXE_KEY_LEN ); -#ifdef QTRANSPORTAUTH_DEBUG - qDebug( "Using %li bytes of /proc/%i/lids_key\n", (long int)kb, getpid() ); -#else - Q_UNUSED( kb ); -#endif - } - d->keyInitialised = true; -} - - -/*! - Apply \a key as the process key for the currently running application. - - \a prog is current ignored - - Deprecated function -*/ -void QTransportAuth::setProcessKey( const char *key, const char *prog ) -{ - Q_UNUSED(prog); - setProcessKey( key ); -#ifdef QTRANSPORTAUTH_DEBUG - char displaybuf[QSXE_KEY_LEN*2+1]; - hexstring( displaybuf, (const unsigned char *)key, QSXE_KEY_LEN ); - qDebug() << "key" << displaybuf << "set"; -#endif -} - -/*! - Register \a pr as a policy handler object. The object pointed to - by \a pr should have a slot as follows - \snippet doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp 3 - All requests received by this server will then generate a call to - this slot, and may be processed for policy compliance. -*/ -void QTransportAuth::registerPolicyReceiver( QObject *pr ) -{ - // not every policy receiver needs setup - no error if this fails - QMetaObject::invokeMethod( pr, "setupPolicyCheck" ); - - connect( this, SIGNAL(policyCheck(QTransportAuth::Data&,QString)), - pr, SLOT(policyCheck(QTransportAuth::Data&,QString)), Qt::DirectConnection ); -} - -/*! - Unregister the \a pr from being a policy handler. No more policyCheck signals - are received by this object. -*/ -void QTransportAuth::unregisterPolicyReceiver( QObject *pr ) -{ - disconnect( pr ); - // not every policy receiver needs tear down - no error if this fails - QMetaObject::invokeMethod( pr, "teardownPolicyCheck" ); -} - -/*! - Record a new transport connection with \a properties and \a descriptor. - - The calling code is responsible for destroying the returned data when the - tranport connection is closed. -*/ -QTransportAuth::Data *QTransportAuth::connectTransport( unsigned char properties, int descriptor ) -{ - Data *data = new Data(properties, descriptor); - data->status = Pending; - return data; -} - -/*! - Is the transport trusted. This is true iff data written into the - transport medium cannot be intercepted or modified by another process. - This is for example true for Unix Domain Sockets, but not for shared - memory or UDP sockets. - - There is of course an underlying assumption that the kernel implementing - the transport is sound, ie it cannot be compromised by writing to - /dev/kmem or loading untrusted modules -*/ -inline bool QTransportAuth::Data::trusted() const -{ - return (bool)(properties & Trusted); -} - -/*! - Assert that the transport is trusted. - - For example with respect to shared memory, if it is ensured that no untrusted - root processes are running, and that unix permissions have been set such that - any untrusted non-root processes do not have access rights, then a shared - memory transport could be asserted to be trusted. - - \sa trusted() -*/ -inline void QTransportAuth::Data::setTrusted( bool t ) -{ - properties = t ? properties | Trusted : properties & ~Trusted; -} - -/*! - Is the transport connection oriented. This is true iff once a connection - has been accepted, and state established, then further messages over the - transport are guaranteed to have come from the original connecting entity. - This is for example true for Unix Domain Sockets, but not - for shared memory or UDP sockets. - - By extension if the transport is not trusted() then it should not be - assumed to be connection oriented, since spoofed connection information - could be created. For example if we assume the TCP/IP transport is - trusted, it can be treated as connection oriented; but this is only the - case if intervening routers are trusted. - - Connection oriented transports have authorization cached against the - connection, and thus authorization is only done at connect time. -*/ -inline bool QTransportAuth::Data::connection() const -{ - return (bool)(properties & Connection); -} - -/*! - Assert that the transport is connection oriented. - - \sa connection() -*/ -inline void QTransportAuth::Data::setConnection( bool t ) -{ - properties = t ? properties | Connection : properties & ~Connection; -} - -/*! - Return a pointer to the instance of this process's QTransportAuth object -*/ -QTransportAuth *QTransportAuth::getInstance() -{ - static QTransportAuth theInstance; - - return &theInstance; -} - -/*! - Set the full path to the key file - - Since this is normally relative to Qtopia::qpeDir() this needs to be - set within the Qt Extended framework. - - The keyfile should be protected by file permissions or by MAC rules - such that it can only be read/written by the "qpe" server process -*/ -void QTransportAuth::setKeyFilePath( const QString &path ) -{ - Q_D(QTransportAuth); - d->m_keyFilePath = path; -} - -QString QTransportAuth::keyFilePath() const -{ - Q_D(const QTransportAuth); - return d->m_keyFilePath; -} - -void QTransportAuth::setLogFilePath( const QString &path ) -{ - Q_D(QTransportAuth); - d->m_logFilePath = path; -} - -QString QTransportAuth::logFilePath() const -{ - Q_D(const QTransportAuth); - return d->m_logFilePath; -} - -void QTransportAuth::setPackageRegistry( QObject *registry ) -{ - Q_D(QTransportAuth); - d->m_packageRegistry = registry; -} - -bool QTransportAuth::isDiscoveryMode() const -{ -#if defined(SXE_DISCOVERY) - static bool checked = false; - static bool yesItIs = false; - - if ( checked ) return yesItIs; - - yesItIs = ( getenv( "SXE_DISCOVERY_MODE" ) != 0 ); - if ( yesItIs ) - { - qWarning("SXE Discovery mode on, ALLOWING ALL requests and logging to %s", - qPrintable(logFilePath())); - QFile::remove( logFilePath() ); - } - checked = true; - return yesItIs; -#else - return false; -#endif -} - -/*! - \internal - Return the authorizer device mapped to this client. Note that this - could probably all be void* instead of QWSClient* for generality. - Until the need for that rears its head its QWSClient* to save the casts. - - #### OK the need has arrived, but the public API is frozen. -*/ -QIODevice *QTransportAuth::passThroughByClient( QWSClient *client ) const -{ - Q_D(const QTransportAuth); - - if ( client == 0 ) return 0; - if ( d->buffersByClient.contains( client )) - { - return d->buffersByClient[client]; - } - // qWarning( "buffer not found for client %p", client ); - return 0; -} - -/*! - \internal - Return a QIODevice pointer (to an internal QBuffer) which can be used - to receive data after authorization on transport \a d. - - The return QIODevice will act as a pass-through. - - The data will be consumed from \a iod and forwarded on to the returned - QIODevice which can be connected to readyRead() signal handlers in - place of the original QIODevice \a iod. - - This will be called in the server process to handle incoming - authenticated requests. - - The returned QIODevice will take ownership of \a data which will be deleted - when the QIODevice is delected. - - \sa setTargetDevice() -*/ -QAuthDevice *QTransportAuth::recvBuf( QTransportAuth::Data *data, QIODevice *iod ) -{ - return new QAuthDevice( iod, data, QAuthDevice::Receive ); -} - -/*! - Return a QIODevice pointer (to an internal QBuffer) which can be used - to write data onto, for authorization on transport \a d. - - The return QIODevice will act as a pass-through. - - The data written to the return QIODevice will be forwarded on to the - returned QIODevice. In the case of a QTcpSocket, this will cause it - to send out the data with the authentication information on it. - - This will be called in the client process to generate outgoing - authenticated requests. - - The returned QIODevice will take ownership of \a data which will be deleted - when the QIODevice is delected. - - \sa setTargetDevice() -*/ -QAuthDevice *QTransportAuth::authBuf( QTransportAuth::Data *data, QIODevice *iod ) -{ - return new QAuthDevice( iod, data, QAuthDevice::Send ); -} - -const unsigned char *QTransportAuth::getClientKey( unsigned char progId ) -{ - Q_D(QTransportAuth); - return d->getClientKey( progId ); -} - -void QTransportAuth::invalidateClientKeyCache() -{ - Q_D(QTransportAuth); - d->invalidateClientKeyCache(); -} - -QMutex *QTransportAuth::getKeyFileMutex() -{ - Q_D(QTransportAuth); - return &d->keyfileMutex; -} - -/* - \internal - Respond to the destroyed(QObject*) signal of the QAuthDevice's - client object and remove it from the buffersByClient lookup hash. -*/ -void QTransportAuth::bufferDestroyed( QObject *cli ) -{ - Q_D(QTransportAuth); - if ( cli == NULL ) return; - - if ( d->buffersByClient.contains( cli )) - { - d->buffersByClient.remove( cli ); - // qDebug( "@@@@@@@ client %p removed @@@@@@@@@", cli ); - } - // qDebug( " client count %d", d->buffersByClient.count() ); -} - -bool QTransportAuth::authorizeRequest( QTransportAuth::Data &d, const QString &request ) -{ - bool isAuthorized = true; - - if ( !request.isEmpty() && request != QLatin1String("Unknown") ) - { - d.status &= QTransportAuth::ErrMask; // clear the status - emit policyCheck( d, request ); - isAuthorized = (( d.status & QTransportAuth::StatusMask ) == QTransportAuth::Allow ); - } -#if defined(SXE_DISCOVERY) - if (isDiscoveryMode()) { -#ifndef QT_NO_TEXTSTREAM - if (!logFilePath().isEmpty()) { - QFile log( logFilePath() ); - if (!log.open(QIODevice::WriteOnly | QIODevice::Append)) { - qWarning("Could not write to log in discovery mode: %s", - qPrintable(logFilePath())); - } else { - QTextStream ts( &log ); - ts << d.progId << '\t' << ( isAuthorized ? "Allow" : "Deny" ) << '\t' << request << endl; - } - } -#endif - isAuthorized = true; - } -#endif - if ( !isAuthorized ) - { - qWarning( "%s - denied: for Program Id %u [PID %d]" - , qPrintable(request), d.progId, d.processId ); - - char linkTarget[BUF_SIZE]=""; - char exeLink[BUF_SIZE]=""; - char cmdlinePath[BUF_SIZE]=""; - char cmdline[BUF_SIZE]=""; - - //get executable from /proc/pid/exe - snprintf( exeLink, BUF_SIZE, "/proc/%d/exe", d.processId ); - if ( -1 == ::readlink( exeLink, linkTarget, BUF_SIZE - 1 ) ) - { - qWarning( "SXE:- Error encountered in retrieving executable link target from /proc/%u/exe : %s", - d.processId, strerror(errno) ); - snprintf( linkTarget, BUF_SIZE, "%s", linkTarget ); - } - - //get cmdline from proc/pid/cmdline - snprintf( cmdlinePath, BUF_SIZE, "/proc/%d/cmdline", d.processId ); - int cmdlineFd = QT_OPEN( cmdlinePath, O_RDONLY ); - if ( cmdlineFd == -1 ) - { - qWarning( "SXE:- Error encountered in opening /proc/%u/cmdline: %s", - d.processId, strerror(errno) ); - snprintf( cmdline, BUF_SIZE, "%s", "Unknown" ); - } - else - { - if ( -1 == QT_READ(cmdlineFd, cmdline, BUF_SIZE - 1 ) ) - { - qWarning( "SXE:- Error encountered in reading /proc/%u/cmdline : %s", - d.processId, strerror(errno) ); - snprintf( cmdline, BUF_SIZE, "%s", "Unknown" ); - } - QT_CLOSE( cmdlineFd ); - } - - syslog( LOG_ERR | LOG_LOCAL6, "%s // PID:%u // ProgId:%u // Exe:%s // Request:%s // Cmdline:%s", - "", d.processId, d.progId, linkTarget, qPrintable(request), cmdline); - } - - return isAuthorized; -} - -inline bool __fileOpen( QFile *f ) -{ -#ifdef QTRANSPORTAUTH_DEBUG - if ( f->open( QIODevice::ReadOnly )) - { - qDebug( "Opened file: %s\n", qPrintable( f->fileName() )); - return true; - } - else - { - qWarning( "Could not open file: %s\n", qPrintable( f->fileName() )); - return false; - } -#else - return ( f->open( QIODevice::ReadOnly )); -#endif -} - -/*! - \internal - Find client keys for the \a progId. If it is cached should be very - fast, otherwise requires a read of the secret key file - - In the success case a pointer to the keys is returned. The pointer is - to storage allocated for the internal cache and must be used asap. - - The list returned is a sequence of one or more keys which match the - progId. There is no separator, each 16 byte sequence represents a key. - The sequence is followed by two iterations of the SXE magic - bytes,eg 0xBA, 0xD4, 0xD4, 0xBA, 0xBA, 0xD4, 0xD4, 0xBA - - NULL is returned in the following cases: - \list - \o the keyfiles could not be accessed - error condition - \o there was no key for the supplied program id - key auth failed - \endlist - - Note that for the keyfiles, there is multi-thread and multi-process - concurrency issues: they can be read by the qpe process when - QTransportAuth calls getClientKey to verify a request, and they can be - read or written by the packagemanager when updating package data. - - To protect against this, the keyfileMutex & SxeRegistryLocker is used. - - The sxe_installer tool can also update inode and device numbers in - the manifest file, but this only occurs outside of normal operation, - so qpe and packagemanager are never running when this occurs. -*/ -const unsigned char *QTransportAuthPrivate::getClientKey(unsigned char progId) -{ - int manifestMatchCount = 0; - struct IdBlock mr; - int total_size = 0; - char *result = 0; - char *result_ptr; - int keysFound = 0; - bool foundKey; - int keysRead = 0; - struct usr_key_entry keys_list[128]; - - if ( keyCache.contains( progId )) - return (const unsigned char *)keyCache[progId]; - - SxeRegistryLocker rlock( m_packageRegistry ); - - // ### Qt 4.3: this is hacky - see documentation for setKeyFilePath - QString manifestPath = m_keyFilePath + QLatin1String("/manifest"); - QString actualKeyPath = QLatin1String("/proc/lids/keys"); - bool noFailOnKeyMissing = true; - if ( !QFile::exists( actualKeyPath )) { - actualKeyPath = m_keyFilePath + QLatin1String( "/" QSXE_KEYFILE ); - } - QFile kf( actualKeyPath ); - QFile mn( manifestPath ); - if ( !__fileOpen( &mn )) - goto key_not_found; - // first find how much storage is needed - while ( mn.read( (char*)&mr, sizeof(struct IdBlock)) > 0 ) - if ( mr.progId == progId ) - manifestMatchCount++; - if ( manifestMatchCount == 0 ) - goto key_not_found; - if ( !__fileOpen( &kf )) - { - noFailOnKeyMissing = false; - goto key_not_found; - } - total_size = 2 * QSXE_MAGIC_BYTES + manifestMatchCount * QSXE_KEY_LEN; - result = (char*)malloc( total_size ); - Q_CHECK_PTR( result ); - mn.seek( 0 ); - result_ptr = result; - /* reading whole key array in is much more efficient, 99% case is this loop only - executes once, should not have more than 128 keyed items */ - while (( keysRead = kf.read( (char*)keys_list, sizeof(struct usr_key_entry)*128 )) > 0 ) - { - /* qDebug("PID %d: getClientKey() - read %d bytes = %d keys from %s", getpid(), keysRead, - keysRead/sizeof(struct usr_key_entry), qPrintable(actualKeyPath)); */ - keysRead /= sizeof(struct usr_key_entry); - while ( mn.read( (char*)&mr, sizeof(struct IdBlock)) > 0 ) - { - if ( mr.progId == progId ) - { - foundKey = false; - for ( int i = 0; i < keysRead; ++i ) - { - /* if ( i == 0 ) - qDebug() << " pid" << getpid() << "looking for device" << (dev_t)mr.device << "inode" << (ino_t)mr.inode; - qDebug() << " pid" << getpid() << "trying device" << keys_list[i].dev << "inode" << keys_list[i].ino; */ - if ( keys_list[i].ino == (ino_t)mr.inode && keys_list[i].dev == (dev_t)mr.device ) - { - memcpy( result_ptr, keys_list[i].key, QSXE_KEY_LEN ); - result_ptr += QSXE_KEY_LEN; - foundKey = true; - break; - } - } - if ( foundKey ) - { - keysFound++; - if ( keysFound == manifestMatchCount ) - break; - } - } - } - } - if ( result_ptr == result ) // nothing found! - goto key_not_found; - // 2 x magic bytes sentinel at end of sequence - for ( int i = 0; i < 2; ++i ) - for ( int j = 0; j < QSXE_MAGIC_BYTES; ++j ) - *result_ptr++ = magic[j]; - keyCache.insert( progId, result, total_size / 10 ); - /* qDebug( "PID %d : Found %d client keys for prog %u", getpid(), keysFound, progId ); */ - goto success_out; - -key_not_found: - if ( noFailOnKeyMissing ) // return an "empty" set of keys in this case - { - if ( result == 0 ) - { - result = (char*)malloc( 2 * QSXE_MAGIC_BYTES ); - Q_CHECK_PTR( result ); - } - result_ptr = result; - for ( int i = 0; i < 2; ++i ) - for ( int j = 0; j < QSXE_MAGIC_BYTES; ++j ) - *result_ptr++ = magic[j]; - return (unsigned char *)result; - } - qWarning( "PID %d : Not found client key for prog %u", getpid(), progId ); - if ( result ) - { - free( result ); - result = 0; - } -success_out: - if ( mn.isOpen() ) - mn.close(); - if ( kf.isOpen() ) - kf.close(); - return (unsigned char *)result; -} - -void QTransportAuthPrivate::invalidateClientKeyCache() -{ - keyfileMutex.lock(); - keyCache.clear(); - keyfileMutex.unlock(); -} - -//////////////////////////////////////////////////////////////////////// -//// -//// RequestAnalyzer definition -//// - - -RequestAnalyzer::RequestAnalyzer() - : moreData( false ) - , dataSize( 0 ) -{ -} - -RequestAnalyzer::~RequestAnalyzer() -{ -} - -/*! - Analzye the data in the\a msgQueue according to some protocol - and produce a request string for policy analysis. - - If enough data is in the queue for analysis of a complete message, - return a non-null string, and set a flag so requireMoreData() will - return false; otherwise return a null string and requireMoreData() - return true. - - The amount of bytes analyzed is then available via bytesAnalyzed(). - - A null string is also returned in the case where the message was - corrupt and could not be analyzed. In this case requireMoreData() - returns false. - -Note: this method will modify the msgQueue and pull off the data - deemed to be corrupt, in the case of corrupt data. - - In all other cases the msgQueue is left alone. The calling code - should then pull off the analyzed data. Use bytesAnalzyed() to - find how much data to pull off the queue. -*/ -QString RequestAnalyzer::analyze( QByteArray *msgQueue ) -{ -#ifdef Q_WS_QWS - dataSize = 0; - moreData = false; - QBuffer cmdBuf( msgQueue ); - cmdBuf.open( QIODevice::ReadOnly | QIODevice::Unbuffered ); - QWSCommand::Type command_type = (QWSCommand::Type)(qws_read_uint( &cmdBuf )); - QWSCommand *command = QWSCommand::factory(command_type); - // if NULL, factory will have already printed warning for bogus - // command_type just purge the bad stuff and attempt to recover - if ( command == NULL ) - { - *msgQueue = msgQueue->mid( sizeof(int) ); - return QString(); - } - QString request = QLatin1String(qws_getCommandTypeString(command_type)); -#ifndef QT_NO_COP - if ( !command->read( &cmdBuf )) - { - // not all command arrived yet - come back later - delete command; - moreData = true; - return QString(); - } - if ( command_type == QWSCommand::QCopSend ) - { - QWSQCopSendCommand *sendCommand = static_cast(command); - request += QString::fromLatin1("/QCop/%1/%2").arg( sendCommand->channel ).arg( sendCommand->message ); - } - if ( command_type == QWSCommand::QCopRegisterChannel ) - { - QWSQCopRegisterChannelCommand *registerCommand = static_cast(command); - request += QString::fromLatin1("/QCop/RegisterChannel/%1").arg( registerCommand->channel ); - } -#endif - dataSize = QWS_PROTOCOL_ITEM_SIZE( *command ); - delete command; - return request; -#else - Q_UNUSED(msgQueue); - return QString(); -#endif -} - -//////////////////////////////////////////////////////////////////////// -//// -//// AuthDevice definition -//// - -/*! - Constructs a new auth device for the transport \a data and I/O device \a parent. - - Incoming or outgoing data will be authenticated according to the auth direction \a dir. - - The auth device will take ownership of the transport \a data and delete it when the device - is destroyed. -*/ -QAuthDevice::QAuthDevice( QIODevice *parent, QTransportAuth::Data *data, AuthDirection dir ) - : QIODevice( parent ) - , d( data ) - , way( dir ) - , m_target( parent ) - , m_client( 0 ) - , m_bytesAvailable( 0 ) - , m_skipWritten( 0 ) - , analyzer( 0 ) -{ - if ( dir == Receive ) // server side - { - connect( m_target, SIGNAL(readyRead()), - this, SLOT(recvReadyRead())); - } else { - connect( m_target, SIGNAL(readyRead()), - this, SIGNAL(readyRead())); - } - connect( m_target, SIGNAL(bytesWritten(qint64)), - this, SLOT(targetBytesWritten(qint64)) ); - open( QIODevice::ReadWrite | QIODevice::Unbuffered ); -} - -QAuthDevice::~QAuthDevice() -{ - if ( analyzer ) - delete analyzer; - delete d; -} - -/*! - \internal - Store a pointer to the related device or instance which this - authorizer is proxying for -*/ -void QAuthDevice::setClient( QObject *cli ) -{ - m_client = cli; - QTransportAuth::getInstance()->d_func()->buffersByClient[cli] = this; - QObject::connect( cli, SIGNAL(destroyed(QObject*)), - QTransportAuth::getInstance(), SLOT(bufferDestroyed(QObject*)) ); - // qDebug( "@@@@@@@@@@@@ client set %p @@@@@@@@@", cli ); - // qDebug( " client count %d", QTransportAuth::getInstance()->d_func()->buffersByClient.count() ); -} - -QObject *QAuthDevice::client() const -{ - return m_client; -} - -/* - \fn void QAuthDevice::authViolation(QTransportAuth::Data &) - - This signal is emitted if an authorization failure is generated, as - described in checkAuth(); - - \sa checkAuth() -*/ - - -/* - \fn void QAuthDevice::policyCheck(QTransportAuth::Data &transport, const QString &request ) - - This signal is emitted when a transport successfully delivers a request - and gives the opportunity to either deny or accept the request. - - This signal must be connected in the same thread, ie it cannot be queued. - - As soon as all handlers connected to this signal are processed the Allow or - Deny state on the \a transport is checked, and the request is allowed or denied - accordingly. - - \sa checkAuth() -*/ - -/*! - \internal - Reimplement QIODevice writeData method. - - For client end, when the device is written to the incoming data is - processed and an authentication header calculated. This is pushed - into the target device, followed by the actual incoming data (the - payload). - - For server end, it is a fatal error to write to the device. -*/ -qint64 QAuthDevice::writeData(const char *data, qint64 len) -{ - if ( way == Receive ) // server - return m_target->write( data, len ); - // client -#ifdef QTRANSPORTAUTH_DEBUG - char displaybuf[1024]; -#endif - char header[QSXE_HEADER_LEN]; - ::memset( header, 0, QSXE_HEADER_LEN ); - qint64 bytes = 0; - if ( QTransportAuth::getInstance()->authToMessage( *d, header, data, len )) - { - m_target->write( header, QSXE_HEADER_LEN ); -#ifdef QTRANSPORTAUTH_DEBUG - hexstring( displaybuf, (const unsigned char *)header, QSXE_HEADER_LEN ); - qDebug( "%d QAuthDevice::writeData - CLIENT: Header written: %s", getpid(), displaybuf ); -#endif - m_skipWritten += QSXE_HEADER_LEN; - } - m_target->write( data, len ); - bytes += len; -#ifdef QTRANSPORTAUTH_DEBUG - int bytesToDisplay = bytes; - const unsigned char *dataptr = (const unsigned char *)data; - while ( bytesToDisplay > 0 ) - { - int amt = bytes < 500 ? bytes : 500; - hexstring( displaybuf, dataptr, amt ); - qDebug( "%d QAuthDevice::writeData - CLIENT: %s", getpid(), bytes > 0 ? displaybuf : "(null)" ); - dataptr += 500; - bytesToDisplay -= 500; - } -#endif - if ( m_target->inherits( "QAbstractSocket" )) - static_cast(m_target)->flush(); - return bytes; -} - -/*! - Reimplement from QIODevice - - Read data out of the internal message queue, reduce the queue by the amount - read. Note that the amount available is only ever the size of a command - (although a command can be very big) since we need to check at command - boundaries for new authentication headers. -*/ -qint64 QAuthDevice::readData( char *data, qint64 maxSize ) -{ - if ( way == Send ) // client - return m_target->read( data, maxSize ); - if ( msgQueue.size() == 0 ) - return 0; -#ifdef QTRANSPORTAUTH_DEBUG - char displaybuf[1024]; - hexstring( displaybuf, reinterpret_cast(msgQueue.constData()), - msgQueue.size() > 500 ? 500 : msgQueue.size() ); - qDebug() << getpid() << "QAuthDevice::readData() buffered/requested/avail" - << msgQueue.size() << maxSize << m_bytesAvailable << displaybuf; -#endif - Q_ASSERT( m_bytesAvailable <= msgQueue.size() ); - qint64 bytes = ( maxSize > m_bytesAvailable ) ? m_bytesAvailable : maxSize; - ::memcpy( data, msgQueue.constData(), bytes ); - msgQueue = msgQueue.mid( bytes ); - m_bytesAvailable -= bytes; - return bytes; -} - -/*! - \internal - Receive readyRead signal from the target recv device. In response - authorize the data, and write results out to the recvBuf() device - for processing by the application. Trigger the readyRead signal. - - Authorizing involves first checking the transport is valid, ie the - handshake has either already been done and is cached on a trusted - transport, or was valid with this message; then second passing the - string representation of the service request up to any policyReceivers - - If either of these fail, the message is denied. In discovery mode - denied messages are allowed, but the message is logged. -*/ -void QAuthDevice::recvReadyRead() -{ - qint64 bytes = m_target->bytesAvailable(); - if ( bytes <= 0 ) return; - open( QIODevice::ReadWrite | QIODevice::Unbuffered ); - QUnixSocket *usock = static_cast(m_target); - QUnixSocketMessage msg = usock->read(); - msgQueue.append( msg.bytes() ); - d->processId = msg.processId(); - // if "fragmented" packet 1/2 way through start of a command, ie - // in the QWS msg type, cant do anything, come back later when - // there's more of the packet - if ( msgQueue.size() < (int)sizeof(int) ) - { - // qDebug() << "returning: msg size too small" << msgQueue.size(); - return; - } -#ifdef QTRANSPORTAUTH_DEBUG - char displaybuf[1024]; - hexstring( displaybuf, reinterpret_cast(msgQueue.constData()), - msgQueue.size() > 500 ? 500 : msgQueue.size() ); - qDebug( "%d ***** SERVER read %lli bytes - msg %s", getpid(), bytes, displaybuf ); -#endif - - bool bufHasMessages = msgQueue.size() >= (int)sizeof(int); - while ( bufHasMessages ) - { - unsigned char saveStatus = d->status; - if (( d->status & QTransportAuth::ErrMask ) == QTransportAuth::NoSuchKey ) - { - QTransportAuth::getInstance()->authorizeRequest( *d, QLatin1String("NoSuchKey") ); - break; - } - if ( !QTransportAuth::getInstance()->authFromMessage( *d, msgQueue, msgQueue.size() )) - { - // not all arrived yet? come back later - if (( d->status & QTransportAuth::ErrMask ) == QTransportAuth::TooSmall ) - { - d->status = saveStatus; - return; - } - } - if (( d->status & QTransportAuth::ErrMask ) == QTransportAuth::NoMagic ) - { - // no msg auth header, don't change the success status for connections - if ( d->connection() ) - d->status = saveStatus; - } - else - { - // msg auth header detected and auth determined, remove hdr - msgQueue = msgQueue.mid( QSXE_HEADER_LEN ); - } - if ( !authorizeMessage() ) - break; - bufHasMessages = msgQueue.size() >= (int)sizeof(int); - } -} - -/** - \internal - Handle bytesWritten signals from the underlying target device. - We adjust the target's value for bytes that are part of auth packets. -*/ -void QAuthDevice::targetBytesWritten( qint64 bytes ) -{ - if ( m_skipWritten >= bytes ) { - m_skipWritten -= bytes; - bytes = 0; - } else if ( m_skipWritten > 0 ) { - bytes -= m_skipWritten; - m_skipWritten = 0; - } - if ( bytes > 0 ) { - emit bytesWritten( bytes ); - } -} - -/** - \internal - Pre-process the message to determine what QWS command it is. This - information is used as the "request" for the purposes of authorization. - - The request and other data on the connection (id, PID, etc.) are forwarded - to all policy listeners by emitting a signal. - - The signal must be processed synchronously because on return the allow/deny - status is used immediately to either drop or continue processing the message. -*/ -bool QAuthDevice::authorizeMessage() -{ - if ( analyzer == NULL ) - analyzer = new RequestAnalyzer(); - QString request = (*analyzer)( &msgQueue ); - if ( analyzer->requireMoreData() ) - return false; - bool isAuthorized = true; - - if ( !request.isEmpty() && request != QLatin1String("Unknown") ) - { - isAuthorized = QTransportAuth::getInstance()->authorizeRequest( *d, request ); - } - - bool moreToProcess = ( msgQueue.size() - analyzer->bytesAnalyzed() ) > (int)sizeof(int); - if ( isAuthorized ) - { -#ifdef QTRANSPORTAUTH_DEBUG - qDebug() << getpid() << "SERVER authorized: releasing" << analyzer->bytesAnalyzed() << "byte command" << request; -#endif - m_bytesAvailable = analyzer->bytesAnalyzed(); - emit QIODevice::readyRead(); - return moreToProcess; - } - else - { - msgQueue = msgQueue.mid( analyzer->bytesAnalyzed() ); - } - - return true; -} - -void QAuthDevice::setRequestAnalyzer( RequestAnalyzer *ra ) -{ - Q_ASSERT( ra ); - if ( analyzer ) - delete analyzer; - analyzer = ra; -} - -/*! - \internal - Add authentication header to the beginning of a message - - Note that the per-process auth cookie is used. This key should be rewritten in - the binary image of the executable at install time to make it unique. - - For this to be secure some mechanism (eg MAC kernel or other - permissions) must prevent other processes from reading the key. - - The buffer must have AUTH_SPACE(0) bytes spare at the beginning for the - authentication header to be added. - - Returns true if header successfully added. Will fail if the - per-process key has not yet been set with setProcessKey() -*/ -bool QTransportAuth::authToMessage( QTransportAuth::Data &d, char *hdr, const char *msg, int msgLen ) -{ - // qDebug( "authToMessage(): prog id %u", d.progId ); - // only authorize connection oriented transports once, unless key has changed - if ( d.connection() && ((d.status & QTransportAuth::ErrMask) != QTransportAuth::Pending) && - d_func()->authKey.progId == d.progId ) - return false; - d.progId = d_func()->authKey.progId; - // If Unix socket credentials are being used the key wont be set - if ( !d_func()->keyInitialised ) - return false; - unsigned char digest[QSXE_KEY_LEN]; - char *msgPtr = hdr; - // magic always goes on the beginning - for ( int m = 0; m < QSXE_MAGIC_BYTES; ++m ) - *msgPtr++ = magic[m]; - hdr[ QSXE_LEN_IDX ] = (unsigned char)msgLen; - if ( !d.trusted()) - { - // Use HMAC - int rc = hmac_md5( (unsigned char *)msg, msgLen, d_func()->authKey.key, QSXE_KEY_LEN, digest ); - if ( rc == -1 ) - return false; - memcpy( hdr + QSXE_KEY_IDX, digest, QSXE_KEY_LEN ); - } - else - { - memcpy( hdr + QSXE_KEY_IDX, d_func()->authKey.key, QSXE_KEY_LEN ); - } - - hdr[ QSXE_PROG_IDX ] = d_func()->authKey.progId; - -#ifdef QTRANSPORTAUTH_DEBUG - char keydisplay[QSXE_KEY_LEN*2+1]; - hexstring( keydisplay, d_func()->authKey.key, QSXE_KEY_LEN ); - - qDebug( "%d CLIENT Auth to message %s against prog id %u and key %s\n", - getpid(), msg, d_func()->authKey.progId, keydisplay ); -#endif - - // TODO implement sequence to prevent replay attack, not required - // for trusted transports - hdr[ QSXE_SEQ_IDX ] = 1; // dummy sequence - - d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::Success; - return true; -} - - -/*! - Check authorization on the \a msg, which must be of size \a msgLen, - for the transport \a d. - - If able to determine authorization, return the program identity of - the message source in the reference \a progId, and return true. - - Otherwise return false. - - If data is being received on a socket, it may be that more data is yet - needed before authentication can proceed. - - Also the message may not be an authenticated at all. - - In these cases the method returns false to indicate authorization could - not be determined: - \list - \i The message is too small to carry the authentication data - (status TooSmall is set on the \a d transport ) - \i The 4 magic bytes are missing from the message start - (status NoMagic is set on the \a d transport ) - \i The message is too small to carry the auth + claimed payload - (status TooSmall is set on the \a d transport ) - \endlist - - If however the authentication header (preceded by the magic bytes) and - any authenticated payload is received the method will determine the - authentication status, and return true. - - In the following cases as well as returning true it will also emit - an authViolation(): - \list - \i If the program id claimed by the message is not found in the key file - (status NoSuchKey is set on the \a d transport ) - \i The authentication token failed against the claimed program id: - \list - \i in the case of trusted transports, the secret did not match - \i in the case of untrusted transports the HMAC code did not match - \endlist - (status FailMatch is set on the \a d transport ) - \endlist - - In these cases the authViolation( QTransportAuth::Data d ) signal is emitted - and the error string can be obtained from the status like this: - \snippet doc/src/snippets/code/src_gui_embedded_qtransportauth_qws.cpp 4 -*/ -bool QTransportAuth::authFromMessage( QTransportAuth::Data &d, const char *msg, int msgLen ) -{ - if ( msgLen < QSXE_MAGIC_BYTES ) - { - d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::TooSmall; - return false; - } - // if no magic bytes, exit straight away - int m; - const unsigned char *mptr = reinterpret_cast(msg); - for ( m = 0; m < QSXE_MAGIC_BYTES; ++m ) - { - if ( *mptr++ != magic[m] ) - { - d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::NoMagic; - return false; - } - } - - if ( msgLen < AUTH_SPACE(1) ) - { - d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::TooSmall; - return false; - } - - // At this point we know the header is at least long enough to contain valid auth - // data, however the data may be spoofed. If it is not verified then the status will - // be set to uncertified so the spoofed data will not be relied on. However we want to - // know the program id which is being reported (even if it might be spoofed) for - // policy debugging purposes. So set it here, rather than after verification. - d.progId = msg[QSXE_PROG_IDX]; - -#ifdef QTRANSPORTAUTH_DEBUG - char authhdr[QSXE_HEADER_LEN*2+1]; - hexstring( authhdr, reinterpret_cast(msg), QSXE_HEADER_LEN ); - qDebug( "%d SERVER authFromMessage(): message header is %s", - getpid(), authhdr ); -#endif - - unsigned char authLen = (unsigned char)(msg[ QSXE_LEN_IDX ]); - - if ( msgLen < AUTH_SPACE(authLen) ) - { - d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::TooSmall; - return false; - } - - bool isCached = d_func()->keyCache.contains( d.progId ); - const unsigned char *clientKey = d_func()->getClientKey( d.progId ); - if ( clientKey == NULL ) - { - d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::NoSuchKey; - return false; - } - -#ifdef QTRANSPORTAUTH_DEBUG - char keydisplay[QSXE_KEY_LEN*2+1]; - hexstring( keydisplay, clientKey, QSXE_KEY_LEN ); - qDebug( "\t\tauthFromMessage(): message %s against prog id %u and key %s\n", - AUTH_DATA(msg), ((unsigned int)d.progId), keydisplay ); -#endif - - const unsigned char *auth_tok; - unsigned char digest[QSXE_KEY_LEN]; - bool multi_tok = false; - - bool need_to_recheck=false; - do - { - if ( !d.trusted()) - { - hmac_md5( AUTH_DATA(msg), authLen, clientKey, QSXE_KEY_LEN, digest ); - auth_tok = digest; - } - else - { - auth_tok = clientKey; - multi_tok = true; // 1 or more keys are in the clientKey - } - while( true ) - { - if ( memcmp( auth_tok, magic, QSXE_MAGIC_BYTES ) == 0 - && memcmp( auth_tok + QSXE_MAGIC_BYTES, magic, QSXE_MAGIC_BYTES ) == 0 ) - break; - if ( memcmp( msg + QSXE_KEY_IDX, auth_tok, QSXE_KEY_LEN ) == 0 ) - { - d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::Success; - return true; - } - if ( !multi_tok ) - break; - auth_tok += QSXE_KEY_LEN; - } - //the keys cached on d.progId may not contain the binary key because the cache entry was made - //before the binary had first started, must search for client key again. - if ( isCached ) - { - d_func()->keyCache.remove(d.progId); - isCached = false; - -#ifdef QTRANSPORTAUTH_DEBUG - qDebug() << "QTransportAuth::authFromMessage(): key not found in set of keys cached" - << "against prog Id =" << d.progId << ". Re-obtaining client key. "; -#endif - clientKey = d_func()->getClientKey( d.progId ); - if ( clientKey == NULL ) - { - d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::NoSuchKey; - return false; - } - need_to_recheck = true; - } - else - { - need_to_recheck = false; - } - } while( need_to_recheck ); - - d.status = ( d.status & QTransportAuth::StatusMask ) | QTransportAuth::FailMatch; - qWarning() << "QTransportAuth::authFromMessage():failed authentication"; - FAREnforcer::getInstance()->logAuthAttempt( QDateTime::currentDateTime() ); - emit authViolation( d ); - return false; -} - - -#ifdef QTRANSPORTAUTH_DEBUG -/*! - sprintf into hex - dest \a buf, src \a key, \a key_len is length of key. - - The target buf should be [ key_len * 2 + 1 ] in size -*/ -void hexstring( char *buf, const unsigned char* key, size_t key_len ) -{ - unsigned int i, p; - for ( i = 0, p = 0; i < key_len; i++, p+=2 ) - { - unsigned char lo_nibble = key[i] & 0x0f; - unsigned char hi_nibble = key[i] >> 4; - buf[p] = (int)hi_nibble > 9 ? hi_nibble-10 + 'A' : hi_nibble + '0'; - buf[p+1] = (int)lo_nibble > 9 ? lo_nibble-10 + 'A' : lo_nibble + '0'; - } - buf[p] = '\0'; -} -#endif - -/* - HMAC MD5 as listed in RFC 2104 - - This code is taken from: - - http://www.faqs.org/rfcs/rfc2104.html - - with the allowance for keys other than length 16 removed, but otherwise - a straight cut-and-paste. - - The HMAC_MD5 transform looks like: - - \snippet doc/src/snippets/code/src.gui.embedded.qtransportauth_qws.cpp 5 - - \list - \i where K is an n byte key - \i ipad is the byte 0x36 repeated 64 times - \i opad is the byte 0x5c repeated 64 times - \i and text is the data being protected - \endlist - - Hardware is available with accelerated implementations of HMAC-MD5 and - HMAC-SHA1. Where this hardware is available, this routine should be - replaced with a call into the accelerated version. -*/ - -static int hmac_md5( - unsigned char* text, /* pointer to data stream */ - int text_length, /* length of data stream */ - const unsigned char* key, /* pointer to authentication key */ - int key_length, /* length of authentication key */ - unsigned char * digest /* caller digest to be filled in */ - ) -{ - MD5Context context; - unsigned char k_ipad[65]; /* inner padding - * key XORd with ipad */ - unsigned char k_opad[65]; /* outer padding - * key XORd with opad */ - int i; - - /* in this implementation key_length == 16 */ - if ( key_length != 16 ) - { - fprintf( stderr, "Key length was %d - must be 16 bytes", key_length ); - return 0; - } - - /* start out by storing key in pads */ - memset( k_ipad, 0, sizeof k_ipad ); - memset( k_opad, 0, sizeof k_opad ); - memcpy( k_ipad, key, key_length ); - memcpy( k_opad, key, key_length ); - - /* XOR key with ipad and opad values */ - for (i=0; i<64; i++) { - k_ipad[i] ^= 0x36; - k_opad[i] ^= 0x5c; - } - - /* perform inner MD5 */ - MD5Init(&context); /* init context for 1st pass */ - MD5Update(&context, k_ipad, 64); /* start with inner pad */ - MD5Update(&context, text, text_length); /* then text of datagram */ - MD5Final(&context, digest); /* finish up 1st pass */ - - /* perform outer MD5 */ - MD5Init(&context); /* init context for 2nd pass */ - MD5Update(&context, k_opad, 64); /* start with outer pad */ - MD5Update(&context, digest, 16); /* then results of 1st * hash */ - MD5Final(&context, digest); /* finish up 2nd pass */ - return 1; -} - - -const int FAREnforcer::minutelyRate = 4; //allowed number of false authentication attempts per minute -const QString FAREnforcer::FARMessage = QLatin1String("FAR_Exceeded"); -const QString FAREnforcer::SxeTag = QLatin1String(""); -const int FAREnforcer::minute = 60; - -FAREnforcer::FAREnforcer():authAttempts() -{ - QDateTime nullDateTime = QDateTime(); - for (int i = 0; i < minutelyRate; i++ ) - authAttempts << nullDateTime; -} - - -FAREnforcer *FAREnforcer::getInstance() -{ - static FAREnforcer theInstance; - return &theInstance; -} - -void FAREnforcer::logAuthAttempt( QDateTime time ) -{ - QDateTime dt = authAttempts.takeFirst(); - - authAttempts.append( time ); - if ( dt.secsTo( authAttempts.last() ) <= minute ) - { -#if defined(SXE_DISCOVERY) - if ( QTransportAuth::getInstance()->isDiscoveryMode() ) { - static QBasicAtomicInt reported = Q_BASIC_ATOMIC_INITIALIZER(0); - if ( reported.testAndSetRelaxed(0,1) ) { -#ifndef QT_NO_TEXTSTREAM - QString logFilePath = QTransportAuth::getInstance()->logFilePath(); - if ( !logFilePath.isEmpty() ) { - QFile log( logFilePath ); - if ( !log.open(QIODevice::WriteOnly | QIODevice::Append) ) { - qWarning("Could not write to log in discovery mode: %s", - qPrintable(logFilePath) ); - } else { - QTextStream ts( &log ); - ts << "\t\tWarning: False Authentication Rate of " << minutelyRate << "\n" - << "\t\tserver connections/authentications per minute has been exceeded,\n" - << "\t\tno further warnings will be issued\n"; - } - } - } -#endif - reset(); - return; - } -#endif - syslog( LOG_ERR | LOG_LOCAL6, "%s %s", - qPrintable( FAREnforcer::SxeTag ), - qPrintable( FAREnforcer::FARMessage ) ); - reset(); - } -} - -void FAREnforcer::reset() -{ - QDateTime nullDateTime = QDateTime(); - for (int i = 0; i < minutelyRate; i++ ) - authAttempts[i] = nullDateTime; -} - -QT_END_NAMESPACE - -#include "moc_qtransportauth_qws_p.cpp" - -#endif // QT_NO_SXE diff --git a/src/gui/embedded/qtransportauth_qws.h b/src/gui/embedded/qtransportauth_qws.h deleted file mode 100644 index e13835d846c..00000000000 --- a/src/gui/embedded/qtransportauth_qws.h +++ /dev/null @@ -1,281 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTRANSPORTAUTH_QWS_H -#define QTRANSPORTAUTH_QWS_H - -#include - -#if !defined(QT_NO_SXE) || defined(SXE_INSTALLER) - -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QAuthDevice; -class QWSClient; -class QIODevice; -class QTransportAuthPrivate; -class QMutex; - -class Q_GUI_EXPORT QTransportAuth : public QObject -{ - Q_OBJECT -public: - static QTransportAuth *getInstance(); - - enum Result { - // Error codes - Pending = 0x00, - TooSmall = 0x01, - CacheMiss = 0x02, - NoMagic = 0x03, - NoSuchKey = 0x04, - FailMatch = 0x05, - OutOfDate = 0x06, - // reserved for expansion - Success = 0x1e, - ErrMask = 0x1f, - - // Verification codes - Allow = 0x20, - Deny = 0x40, - Ask = 0x60, - // reserved - StatusMask = 0xe0 - }; - - enum Properties { - Trusted = 0x01, - Connection = 0x02, - UnixStreamSock = 0x04, - SharedMemory = 0x08, - MessageQueue = 0x10, - UDP = 0x20, - TCP = 0x40, - UserDefined = 0x80, - TransportType = 0xfc - }; - - struct Data - { - Data() { processId = -1; } - Data( unsigned char p, int d ) - : properties( p ) - , descriptor( d ) - , processId( -1 ) - { - if (( properties & TransportType ) == TCP || - ( properties & TransportType ) == UnixStreamSock ) - properties |= Connection; - } - - unsigned char properties; - unsigned char progId; - unsigned char status; - unsigned int descriptor; // socket fd or shmget key - pid_t processId; - - bool trusted() const; - void setTrusted( bool ); - bool connection() const; - void setConnection( bool ); - }; - - static const char *errorString( const QTransportAuth::Data & ); - - QTransportAuth::Data *connectTransport( unsigned char, int ); - - QAuthDevice *authBuf( QTransportAuth::Data *, QIODevice * ); - QAuthDevice *recvBuf( QTransportAuth::Data *, QIODevice * ); - QIODevice *passThroughByClient( QWSClient * ) const; - - void setKeyFilePath( const QString & ); - QString keyFilePath() const; - const unsigned char *getClientKey( unsigned char progId ); - void invalidateClientKeyCache(); - QMutex *getKeyFileMutex(); - void setLogFilePath( const QString & ); - QString logFilePath() const; - void setPackageRegistry( QObject *registry ); - bool isDiscoveryMode() const; - void setProcessKey( const char * ); - void setProcessKey( const char *, const char * ); - void registerPolicyReceiver( QObject * ); - void unregisterPolicyReceiver( QObject * ); - - bool authToMessage( QTransportAuth::Data &d, char *hdr, const char *msg, int msgLen ); - bool authFromMessage( QTransportAuth::Data &d, const char *msg, int msgLen ); - - bool authorizeRequest( QTransportAuth::Data &d, const QString &request ); - -Q_SIGNALS: - void policyCheck( QTransportAuth::Data &, const QString & ); - void authViolation( QTransportAuth::Data & ); -private Q_SLOTS: - void bufferDestroyed( QObject * ); - -private: - // users should never construct their own - QTransportAuth(); - ~QTransportAuth(); - - friend class QAuthDevice; - Q_DECLARE_PRIVATE(QTransportAuth) -}; - -class Q_GUI_EXPORT RequestAnalyzer -{ -public: - RequestAnalyzer(); - virtual ~RequestAnalyzer(); - QString operator()( QByteArray *data ) { return analyze( data ); } - bool requireMoreData() const { return moreData; } - qint64 bytesAnalyzed() const { return dataSize; } -protected: - virtual QString analyze( QByteArray * ); - bool moreData; - qint64 dataSize; -}; - -/*! - \internal - \class QAuthDevice - - \brief Pass-through QIODevice sub-class for authentication. - - Use this class to forward on or receive forwarded data over a real - device for authentication. -*/ -class Q_GUI_EXPORT QAuthDevice : public QIODevice -{ - Q_OBJECT -public: - enum AuthDirection { - Receive, - Send - }; - QAuthDevice( QIODevice *, QTransportAuth::Data *, AuthDirection ); - ~QAuthDevice(); - void setTarget( QIODevice *t ) { m_target = t; } - QIODevice *target() const { return m_target; } - void setClient( QObject* ); - QObject *client() const; - void setRequestAnalyzer( RequestAnalyzer * ); - bool isSequential() const; - bool atEnd() const; - qint64 bytesAvailable() const; - qint64 bytesToWrite() const; - bool seek( qint64 ); - QByteArray & buffer(); - -protected: - qint64 readData( char *, qint64 ); - qint64 writeData(const char *, qint64 ); -private Q_SLOTS: - void recvReadyRead(); - void targetBytesWritten( qint64 ); -private: - bool authorizeMessage(); - - QTransportAuth::Data *d; - AuthDirection way; - QIODevice *m_target; - QObject *m_client; - QByteArray msgQueue; - qint64 m_bytesAvailable; - qint64 m_skipWritten; - - RequestAnalyzer *analyzer; -}; - -inline bool QAuthDevice::isSequential() const -{ - return true; -} - -inline bool QAuthDevice::seek( qint64 ) -{ - return false; -} - -inline bool QAuthDevice::atEnd() const -{ - return msgQueue.isEmpty(); -} - -inline qint64 QAuthDevice::bytesAvailable() const -{ - if ( way == Receive ) - return m_bytesAvailable; - else - return ( m_target ? m_target->bytesAvailable() : 0 ); -} - -inline qint64 QAuthDevice::bytesToWrite() const -{ - return msgQueue.size(); -} - -inline QByteArray &QAuthDevice::buffer() -{ - return msgQueue; -} - - - - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_SXE -#endif // QTRANSPORTAUTH_QWS_H diff --git a/src/gui/embedded/qtransportauth_qws_p.h b/src/gui/embedded/qtransportauth_qws_p.h deleted file mode 100644 index 3a9df09cede..00000000000 --- a/src/gui/embedded/qtransportauth_qws_p.h +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTRANSPORTAUTH_QWS_P_H -#define QTRANSPORTAUTH_QWS_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 - -#ifndef QT_NO_SXE - -#include "qtransportauth_qws.h" -#include "qtransportauthdefs_qws.h" -#include "qbuffer.h" - -#include -#include -#include "private/qobject_p.h" - -#include - -QT_BEGIN_NAMESPACE - -// Uncomment to generate debug output -// #define QTRANSPORTAUTH_DEBUG 1 - -#ifdef QTRANSPORTAUTH_DEBUG -void hexstring( char *buf, const unsigned char* key, size_t sz ); -#endif - -// proj id for ftok usage in sxe -#define SXE_PROJ 10022 - -/*! - \internal - memset for security purposes, guaranteed not to be optimized away - http://www.faqs.org/docs/Linux-HOWTO/Secure-Programs-HOWTO.html -*/ -void *guaranteed_memset(void *v,int c,size_t n); - -class QUnixSocketMessage; - -/*! - \internal - \class AuthCookie - Struct to carry process authentication key and id -*/ -#define QSXE_HEADER_LEN 24 - -/*! - \macro AUTH_ID - Macro to manage authentication header. Format of header is: - \table - \header \i BYTES \i CONTENT - \row \i 0-3 \i magic numbers - \row \i 4 \i length of authenticated data (max 255 bytes) - \row i\ 5 \i reserved - \row \i 6-21 \i MAC digest, or shared secret in case of simple auth - \row \i 22 \i program id - \row \i 23 \i sequence number - \endtable - Total length of the header is 24 bytes - - However this may change. Instead of coding these numbers use the AUTH_ID, - AUTH_KEY, AUTH_DATA and AUTH_SPACE macros. -*/ - -#define AUTH_ID(k) ((unsigned char)(k[QSXE_KEY_LEN])) -#define AUTH_KEY(k) ((unsigned char *)(k)) - -#define AUTH_DATA(x) (unsigned char *)((x) + QSXE_HEADER_LEN) -#define AUTH_SPACE(x) ((x) + QSXE_HEADER_LEN) -#define QSXE_LEN_IDX 4 -#define QSXE_KEY_IDX 6 -#define QSXE_PROG_IDX 22 -#define QSXE_SEQ_IDX 23 - -class SxeRegistryLocker : public QObject -{ - Q_OBJECT -public: - SxeRegistryLocker( QObject * ); - ~SxeRegistryLocker(); - bool success() const { return m_success; } -private: - bool m_success; - QObject *m_reg; -}; - -class QTransportAuthPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QTransportAuth) -public: - QTransportAuthPrivate(); - ~QTransportAuthPrivate(); - - const unsigned char *getClientKey( unsigned char progId ); - void invalidateClientKeyCache(); - - bool keyInitialised; - QString m_logFilePath; - QString m_keyFilePath; - QObject *m_packageRegistry; - AuthCookie authKey; - QCache keyCache; - QHash< QObject*, QIODevice*> buffersByClient; - QMutex keyfileMutex; -}; - -/*! - \internal - Enforces the False Authentication Rate. If more than 4 authentications - are received per minute the sxemonitor is notified that the FAR has been exceeded -*/ -class FAREnforcer -{ - public: - static FAREnforcer *getInstance(); - void logAuthAttempt( QDateTime time = QDateTime::currentDateTime() ); - void reset(); - -#ifndef TEST_FAR_ENFORCER - private: -#endif - FAREnforcer(); - FAREnforcer( const FAREnforcer & ); - FAREnforcer &operator=(FAREnforcer const & ); - - static const QString FARMessage; - static const int minutelyRate; - static const QString SxeTag; - static const int minute; - - QList authAttempts; -}; - -QT_END_NAMESPACE - -#endif // QT_NO_SXE -#endif // QTRANSPORTAUTH_QWS_P_H - diff --git a/src/gui/embedded/qtransportauthdefs_qws.h b/src/gui/embedded/qtransportauthdefs_qws.h deleted file mode 100644 index fc9595e235e..00000000000 --- a/src/gui/embedded/qtransportauthdefs_qws.h +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTRANSPORTAUTHDEFS_QWS_H -#define QTRANSPORTAUTHDEFS_QWS_H - -#include -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#define QSXE_KEY_LEN 16 -#define QSXE_MAGIC_BYTES 4 - -// Number of bytes of each message to authenticate. Just need to ensure -// that the command at the beginning hasn't been tampered with. This value -// does not matter for trusted transports. -#define AMOUNT_TO_AUTHENTICATE 200 - -#define AUTH_ID(k) ((unsigned char)(k[QSXE_KEY_LEN])) -#define AUTH_KEY(k) ((unsigned char *)(k)) - -// must be a largish -ve number under any endianess when cast as an int -const unsigned char magic[QSXE_MAGIC_BYTES] = { 0xBA, 0xD4, 0xD4, 0xBA }; -const int magicInt = 0xBAD4D4BA; - -#define QSXE_KEYFILE "keyfile" - -/* - Header in above format, less the magic bytes. - Useful for reading off the socket -*/ -struct AuthHeader -{ - unsigned char len; - unsigned char pad; - unsigned char digest[QSXE_KEY_LEN]; - unsigned char id; - unsigned char seq; -}; - -/* - Header in a form suitable for authentication routines -*/ -struct AuthMessage -{ - AuthMessage() - { - ::memset( authData, 0, sizeof(authData) ); - ::memcpy( pad_magic, magic, QSXE_MAGIC_BYTES ); - } - unsigned char pad_magic[QSXE_MAGIC_BYTES]; - union { - AuthHeader hdr; - char authData[sizeof(AuthHeader)]; - }; - char payLoad[AMOUNT_TO_AUTHENTICATE]; -}; - -/** - Auth data as stored in _key -*/ -struct AuthCookie -{ - unsigned char key[QSXE_KEY_LEN]; - unsigned char pad; - unsigned char progId; -}; - -/* - Auth data as written to the key file - SUPERSEDED by usr_key_entry - - This is still used internally for some functions, ie the socket - related calls. -*/ -struct AuthRecord -{ - union { - AuthCookie auth; - char data[sizeof(struct AuthCookie)]; - }; - time_t change_time; -}; - -/*! - \class usr_key_entry - This comes from the SXE kernel patch file include/linux/lidsif.h - - This is the (new) data record for the key file (version 2). - - The key file is (now) either /proc/lids/keys (and the per-process - keys in /proc//lids_key) OR for desktop/development ONLY (not - for production) it is $QPEDIR/etc/keyfile - - The key file maps keys to files. - - File are identified by inode and device numbers, not paths. - - (See the "installs" file for path to inode/device mapping) -*/ -struct usr_key_entry -{ - char key[QSXE_KEY_LEN]; - ino_t ino; - dev_t dev; -}; - - -/*! - \class IdBlock - \brief Data record for the manifest file. - The manifest file maps program id's to files -*/ -struct IdBlock -{ - quint64 inode; - quint64 device; - unsigned char pad; - unsigned char progId; - unsigned short installId; - unsigned int keyOffset; - qint64 install_time; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QTRANSPORTAUTHDEFS_QWS_H - diff --git a/src/gui/embedded/qunixsocket.cpp b/src/gui/embedded/qunixsocket.cpp deleted file mode 100644 index 85de32da4aa..00000000000 --- a/src/gui/embedded/qunixsocket.cpp +++ /dev/null @@ -1,1800 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qunixsocket_p.h" - -// #define QUNIXSOCKET_DEBUG 1 - -#include -#include -#include -#include "private/qcore_unix_p.h" // overrides QT_OPEN - -#ifdef QUNIXSOCKET_DEBUG -#include -#endif - -extern "C" { -#include -#include -#include -#include -#include -}; - -#define UNIX_PATH_MAX 108 // From unix(7) - -#ifdef QT_LINUXBASE -// LSB doesn't declare ucred -struct ucred -{ - pid_t pid; /* PID of sending process. */ - uid_t uid; /* UID of sending process. */ - gid_t gid; /* GID of sending process. */ -}; - -// LSB doesn't define the ones below -#ifndef SO_PASSCRED -# define SO_PASSCRED 16 -#endif -#ifndef SCM_CREDENTIALS -# define SCM_CREDENTIALS 0x02 -#endif -#ifndef MSG_DONTWAIT -# define MSG_DONTWAIT 0x40 -#endif -#ifndef MSG_NOSIGNAL -# define MSG_NOSIGNAL 0x4000 -#endif - -#endif // QT_LINUXBASE - -QT_BEGIN_NAMESPACE - -/////////////////////////////////////////////////////////////////////////////// -// class QUnixSocketRights -/////////////////////////////////////////////////////////////////////////////// -/*! - \class QUnixSocketRights - \internal - - \brief The QUnixSocketRights class encapsulates QUnixSocket rights data. - \omit - \ingroup Platform::DeviceSpecific - \ingroup Platform::OS - \ingroup Platform::Communications - \endomit - \ingroup qws - - \l QUnixSocket allows you to transfer Unix file descriptors between processes. - A file descriptor is referred to as "rights data" as it allows one process to - transfer its right to access a resource to another. - - The Unix system verifies resource permissions only when the resource is first - opened. For example, consider a file on disk readable only by the user "qt". - A process running as user "qt" will be able to open this file for reading. - If, while the process was still reading from the file, the ownership was - changed from user "qt" to user "root", the process would be allowed to - continue reading from the file, even though attempting to reopen the file - would be denied. Permissions are associated with special descriptors called - file descriptors which are returned to a process after it initially opens a - resource. - - File descriptors can be duplicated within a process through the dup(2) system - call. File descriptors can be passed between processes using the - \l QUnixSocket class in the same way. Even though the receiving process never - opened the resource directly, it has the same permissions to access it as the - process that did. - - \sa QUnixSocket - */ -struct QUnixSocketRightsPrivate : public QSharedData -{ - virtual ~QUnixSocketRightsPrivate() { -#ifdef QUNIXSOCKET_DEBUG - int closerv = -#endif - QT_CLOSE(fd); -#ifdef QUNIXSOCKET_DEBUG - if(0 != closerv) { - qDebug() << "QUnixSocketRightsPrivate: Unable to close managed" - " file descriptor (" << ::strerror(errno) << ')'; - } -#endif - } - - int fd; -}; - -/*! - Create a new QUnixSocketRights instance containing the file descriptor \a fd. - \a fd will be dup(2)'d internally, so the application is free to close \a fd - following this call. - - If the dup(2) fails, or you pass an invalid \a fd, an - \l {QUnixSocketRights::isValid()}{invalid } object will be - constructed. - - QUnixSocketRights instances are immutable and the internal file descriptor - will be shared between any copies made of this object. The system will - close(2) the file descriptor once it is no longer needed. - */ -QUnixSocketRights::QUnixSocketRights(int fd) -{ - d = new QUnixSocketRightsPrivate(); - if(-1 == fd) { - d->fd = -1; - } else { - d->fd = qt_safe_dup(fd); -#ifdef QUNIXSOCKET_DEBUG - if(-1 == d->fd) { - qDebug() << "QUnixSocketRights: Unable to duplicate fd " - << fd << " (" << ::strerror(errno) << ')'; - } -#endif - } -} - -/*! - \internal - - Construct a QUnixSocketRights instance on \a fd without dup(2)'ing the file - descriptor. - */ -QUnixSocketRights::QUnixSocketRights(int fd,int) -{ - Q_ASSERT(-1 != fd); - d = new QUnixSocketRightsPrivate(); - d->fd = fd; -} - -/*! - Destroys the QUnixSocketRights instance. - */ -QUnixSocketRights::~QUnixSocketRights() -{ -} - -/*! - Create a copy of \a other. - */ -QUnixSocketRights & -QUnixSocketRights::operator=(const QUnixSocketRights & other) -{ - d = other.d; - return *this; -} - -/*! - Create a copy of \a other. - */ -QUnixSocketRights::QUnixSocketRights(const QUnixSocketRights & other) -: d(other.d) -{ -} - -/*! - Returns true if this QUnixSocketRights instance is managing a valid file - descriptor. This method is equivalent to (-1 != peekFd()). - - \sa QUnixSocketRights::peekFd() - */ -bool QUnixSocketRights::isValid() const -{ - return d->fd != -1; -} - -/*! - Return a duplicate of the file descriptor contained in this object. If this - is an \l {QUnixSocketRights::isValid()}{invalid } object, or the - dup(2) call fails, an invalid file descriptor (-1) will be returned. - - \sa QUnixSocketRights::peekFd() - */ -int QUnixSocketRights::dupFd() const -{ - if(-1 == d->fd) return -1; - - int rv = qt_safe_dup(d->fd); - -#ifdef QUNIXSOCKET_DEBUG - if(-1 == rv) - qDebug() << "QUnixSocketRights: Unable to duplicate managed file " - "descriptor (" << ::strerror(errno) << ')'; -#endif - - return rv; -} - -/*! - Returns the file descriptor contained in this object. If this - is an \l {QUnixSocketRights::isValid()}{invalid } object an invalid - file descriptor (-1) will be returned. - - The lifetime of this file descriptor is tied to the lifetime of the - QUnixSocketRights instance. The file descriptor returned by this method - \e may be close(2)'d when the QUnixSocketRights instance is destroyed. If - you want to continue to use the file descriptor use - \l QUnixSocketRights::dupFd() instead. - - \sa QUnixSocketRights::dupFd() - */ -int QUnixSocketRights::peekFd() const -{ - return d->fd; -} - -/////////////////////////////////////////////////////////////////////////////// -// class QUnixSocketMessage -/////////////////////////////////////////////////////////////////////////////// -struct QUnixSocketMessagePrivate : public QSharedData -{ - QUnixSocketMessagePrivate() - : state(Default), vec(0), iovecLen(0), dataSize(0) {} - QUnixSocketMessagePrivate(const QByteArray & b) - : bytes(b), state(Default), vec(0), iovecLen(0), dataSize(0) {} - QUnixSocketMessagePrivate(const QByteArray & b, - const QList & r) - : bytes(b), rights(r), state(Default), vec(0), iovecLen(0), dataSize(0) {} - - int size() const { return vec ? dataSize : bytes.size(); } - void removeBytes( unsigned int ); - - QByteArray bytes; - QList rights; - - enum AncillaryDataState { - Default = 0x00, - Truncated = 0x01, - Credential = 0x02 - }; - AncillaryDataState state; - - pid_t pid; - gid_t gid; - uid_t uid; - - ::iovec *vec; - int iovecLen; // number of vectors in array - int dataSize; // total size of vectors = payload -}; - -/*! - \internal - Remove \a bytesToDequeue bytes from the front of this message -*/ -void QUnixSocketMessagePrivate::removeBytes( unsigned int bytesToDequeue ) -{ - if ( vec ) - { - ::iovec *vecPtr = vec; - if ( bytesToDequeue > (unsigned int)dataSize ) bytesToDequeue = dataSize; - while ( bytesToDequeue > 0 && iovecLen > 0 ) - { - if ( vecPtr->iov_len > bytesToDequeue ) - { - // dequeue the bytes by taking them off the front of the - // current vector. since we don't own the iovec, its okay - // to "leak" this away by pointing past it - char **base = reinterpret_cast(&(vecPtr->iov_base)); - *base += bytesToDequeue; - vecPtr->iov_len -= bytesToDequeue; - bytesToDequeue = 0; - } - else - { - // dequeue bytes by skipping a whole vector. again, its ok - // to lose the pointers to this data - bytesToDequeue -= vecPtr->iov_len; - iovecLen--; - vecPtr++; - } - } - dataSize -= bytesToDequeue; - if ( iovecLen == 0 ) vec = 0; - } - else - { - bytes.remove(0, bytesToDequeue ); - } -} - - -/*! - \class QUnixSocketMessage - \internal - - \brief The QUnixSocketMessage class encapsulates a message sent or received - through the QUnixSocket class. - \omit - \ingroup Platform::DeviceSpecific - \ingroup Platform::OS - \ingroup Platform::Communications - \endomit - \ingroup qws - - In addition to transmitting regular byte stream data, messages sent over Unix - domain sockets may have special ancillary properties. QUnixSocketMessage - instances allow programmers to retrieve and control these properties. - - Every QUnixSocketMessage sent has an associated set of credentials. A - message's credentials consist of the process id, the user id and the group id - of the sending process. Normally these credentials are set automatically for - you by the QUnixSocketMessage class and can be queried by the receiving - process using the \l QUnixSocketMessage::processId(), - \l QUnixSocketMessage::userId() and \l QUnixSocketMessage::groupId() methods - respectively. - - Advanced applications may wish to change the credentials that their message - is sent with, and may do so though the \l QUnixSocketMessage::setProcessId(), - \l QUnixSocketMessage::setUserId() and \l QUnixSocketMessage::setGroupId() - methods. The validity of these credentials is verified by the system kernel. - Only the root user can send messages with credentials that are not his own. - Sending of the message will fail for any non-root user who attempts to - fabricate credentials. Note that this failure is enforced by the system - kernel - receivers can trust the accuracy of credential data! - - Unix domain socket messages may also be used to transmit Unix file descriptors - between processes. In this context, file descriptors are known as rights data - and are encapsulated by the \l QUnixSocketRights class. Senders can set the - file descriptors to transmit using the \l QUnixSocketMessage::setRights() and - receivers can retrieve this data through a call to - \l QUnixSocketMessage::rights(). \l QUnixSocket and \l QUnixSocketRights - discuss the specific copy and ordering semantic associated with rights data. - - QUnixSocketMessage messages are sent by the \l QUnixSocket::write() method. - Like any normal network message, attempting to transmit an empty - QUnixSocketMessage will succeed, but result in a no-op. Limitations in the - Unix domain protocol semantic will cause a transmission of a - QUnixSocketMessage with rights data, but no byte data portion, to fail. - - \sa QUnixSocket QUnixSocketRights - */ - -/*! - Construct an empty QUnixSocketMessage. This instance will have not data and - no rights information. The message's credentials will be set to the - application's default credentials. - */ -QUnixSocketMessage::QUnixSocketMessage() -: d(new QUnixSocketMessagePrivate()) -{ -} - -/*! - Construct a QUnixSocketMessage with an initial data payload of \a bytes. The - message's credentials will be set to the application's default credentials. - */ -QUnixSocketMessage::QUnixSocketMessage(const QByteArray & bytes) -: d(new QUnixSocketMessagePrivate(bytes)) -{ -} - -/*! - Construct a QUnixSocketMessage with an initial data payload of \a bytes and - an initial rights payload of \a rights. The message's credentials will be set - to the application's default credentials. - - A message with rights data but an empty data payload cannot be transmitted - by the system. - */ -QUnixSocketMessage::QUnixSocketMessage(const QByteArray & bytes, - const QList & rights) -: d(new QUnixSocketMessagePrivate(bytes, rights)) -{ -} - -/*! - Create a copy of \a other. - */ -QUnixSocketMessage::QUnixSocketMessage(const QUnixSocketMessage & other) -: d(other.d) -{ -} - -/*! - \fn QUnixSocketMessage::QUnixSocketMessage(const iovec* data, int vecLen) - - Construct a QUnixSocketMessage with an initial data payload of \a - data which points to an array of \a vecLen iovec structures. The - message's credentials will be set to the application's default - credentials. - - This method can be used to avoid the overhead of copying buffers of data - and will directly send the data pointed to by \a data on the socket. It also - avoids the syscall overhead of making a number of small socket write calls, - if a number of data items can be delivered with one write. - - Caller must ensure the iovec * \a data remains valid until the message - is flushed. Caller retains ownership of the iovec structs. - */ -QUnixSocketMessage::QUnixSocketMessage(const ::iovec* data, int vecLen ) -: d(new QUnixSocketMessagePrivate()) -{ - for ( int v = 0; v < vecLen; v++ ) - d->dataSize += data[v].iov_len; - d->vec = const_cast(data); - d->iovecLen = vecLen; -} - -/*! - Assign the contents of \a other to this object. - */ -QUnixSocketMessage & QUnixSocketMessage::operator=(const QUnixSocketMessage & other) -{ - d = other.d; - return *this; -} - -/*! - Destroy this instance. - */ -QUnixSocketMessage::~QUnixSocketMessage() -{ -} - -/*! - Set the data portion of the message to \a bytes. - - \sa QUnixSocketMessage::bytes() - */ -void QUnixSocketMessage::setBytes(const QByteArray & bytes) -{ - d.detach(); - d->bytes = bytes; -} - -/*! - Set the rights portion of the message to \a rights. - - A message with rights data but an empty byte data payload cannot be - transmitted by the system. - - \sa QUnixSocketMessage::rights() - */ -void QUnixSocketMessage::setRights(const QList & rights) -{ - d.detach(); - d->rights = rights; -} - -/*! - Return the rights portion of the message. - - \sa QUnixSocketMessage::setRights() - */ -const QList & QUnixSocketMessage::rights() const -{ - return d->rights; -} - -/*! - Returns true if the rights portion of the message was truncated on reception - due to insufficient buffer size. The rights buffer size can be adjusted - through calls to the \l QUnixSocket::setRightsBufferSize() method. - \l QUnixSocket contains a discussion of the buffering and truncation - characteristics of the Unix domain protocol. - - \sa QUnixSocket QUnixSocket::setRightsBufferSize() - */ -bool QUnixSocketMessage::rightsWereTruncated() const -{ - return d->state & QUnixSocketMessagePrivate::Truncated; -} - -/*! - Return the data portion of the message. - - \sa QUnixSocketMessage::setBytes() - */ -const QByteArray & QUnixSocketMessage::bytes() const -{ - return d->bytes; -} - -/*! - Returns the process id credential associated with this message. - - \sa QUnixSocketMessage::setProcessId() - */ -pid_t QUnixSocketMessage::processId() const -{ - if(QUnixSocketMessagePrivate::Credential & d->state) - return d->pid; - else - return ::getpid(); -} - -/*! - Returns the user id credential associated with this message. - - \sa QUnixSocketMessage::setUserId() - */ -uid_t QUnixSocketMessage::userId() const -{ - if(QUnixSocketMessagePrivate::Credential & d->state) - return d->uid; - else - return ::geteuid(); -} - -/*! - Returns the group id credential associated with this message. - - \sa QUnixSocketMessage::setGroupId() - */ -gid_t QUnixSocketMessage::groupId() const -{ - if(QUnixSocketMessagePrivate::Credential & d->state) - return d->gid; - else - return ::getegid(); -} - -/*! - Set the process id credential associated with this message to \a pid. Unless - you are the root user, setting a fraudulant credential will cause this message - to fail. - - \sa QUnixSocketMessage::processId() - */ -void QUnixSocketMessage::setProcessId(pid_t pid) -{ - if(!(d->state & QUnixSocketMessagePrivate::Credential)) { - d->state = (QUnixSocketMessagePrivate::AncillaryDataState)( d->state | QUnixSocketMessagePrivate::Credential ); - d->uid = ::geteuid(); - d->gid = ::getegid(); - } - d->pid = pid; -} - -/*! - Set the user id credential associated with this message to \a uid. Unless - you are the root user, setting a fraudulant credential will cause this message - to fail. - - \sa QUnixSocketMessage::userId() - */ -void QUnixSocketMessage::setUserId(uid_t uid) -{ - if(!(d->state & QUnixSocketMessagePrivate::Credential)) { - d->state = (QUnixSocketMessagePrivate::AncillaryDataState)( d->state | QUnixSocketMessagePrivate::Credential ); - d->pid = ::getpid(); - d->gid = ::getegid(); - } - d->uid = uid; -} - -/*! - Set the group id credential associated with this message to \a gid. Unless - you are the root user, setting a fraudulant credential will cause this message - to fail. - - \sa QUnixSocketMessage::groupId() - */ -void QUnixSocketMessage::setGroupId(gid_t gid) -{ - if(!(d->state & QUnixSocketMessagePrivate::Credential)) { - d->state = (QUnixSocketMessagePrivate::AncillaryDataState)( d->state | QUnixSocketMessagePrivate::Credential ); - d->pid = ::getpid(); - d->uid = ::geteuid(); - } - d->gid = gid; -} - -/*! - Return true if this message is valid. A message with rights data but an empty - byte data payload cannot be transmitted by the system and is marked as - invalid. - */ -bool QUnixSocketMessage::isValid() const -{ - return d->rights.isEmpty() || !d->bytes.isEmpty(); -} - -/////////////////////////////////////////////////////////////////////////////// -// class QUnixSocket -/////////////////////////////////////////////////////////////////////////////// -#define QUNIXSOCKET_DEFAULT_READBUFFER 1024 -#define QUNIXSOCKET_DEFAULT_ANCILLARYBUFFER 0 - -/*! - \class QUnixSocket - \internal - - \brief The QUnixSocket class provides a Unix domain socket. - - \omit - \ingroup Platform::DeviceSpecific - \ingroup Platform::OS - \ingroup Platform::Communications - \endomit - \ingroup qws - - Unix domain sockets provide an efficient mechanism for communications between - Unix processes on the same machine. Unix domain sockets support a reliable, - stream-oriented, connection-oriented transport protocol, much like TCP - sockets. Unlike IP based sockets, the connection endpoint of a Unix domain - socket is a file on disk of type socket. - - In addition to transporting raw data bytes, Unix domain sockets are able to - transmit special ancillary data. The two types of ancillary data supported - by the QUnixSocket class are: - - \list - \o Credential Data - Allows a receiver - to reliably identify the process sending each message. - \o \l {QUnixSocketRights}{Rights Data } - Allows Unix file descriptors - to be transmitted between processes. - \endlist - - Because of the need to support ancillary data, QUnixSocket is not a QIODevice, - like QTcpSocket and QUdpSocket. Instead, QUnixSocket contains a number of - read and write methods that clients must invoke directly. Rather than - returning raw data bytes, \l QUnixSocket::read() returns \l QUnixSocketMessage - instances that encapsulate the message's byte data and any other ancillary - data. - - Ancillary data is transmitted "out of band". Every \l QUnixSocketMessage - received will have credential data associated with it that the client can - access through calls to \l QUnixSocketMessage::processId(), - \l QUnixSocketMessage::groupId() and \l QUnixSocketMessage::userId(). - Likewise, message creators can set the credential data to send through calls - to \l QUnixSocketMessage::setProcessId(), \l QUnixSocketMessage::setGroupId() - and \l QUnixSocketMessage::setUserId() respectively. The authenticity of the - credential values is verified by the system kernel and cannot be fabricated - by unprivileged processes. Only processes running as the root user can - specify credential data that does not match the sending process. - - Unix file descriptors, known as "rights data", transmitted between processes - appear as though they had been dup(2)'d between the two. As Unix - domain sockets present a continuous stream of bytes to the receiver, the - rights data - which is transmitted out of band - must be "slotted" in at some - point. The rights data is logically associated with the first byte - called - the anchor byte - of the \l QUnixSocketMessage to which they are attached. - Received rights data will be available from the - \l QUnixSocketMessage::rights() method for the \l QUnixSocketMessage - instance that contains the anchor byte. - - In addition to a \l QUnixSocket::write() that takes a \l QUnixSocketMessage - instance - allowing a client to transmit both byte and rights data - a - number of convenience overloads are provided for use when only transmitting - simple byte data. Unix requires that at least one byte of raw data be - transmitted in order to send rights data. A \l QUnixSocketMessage instance - with rights data, but no byte data, cannot be transmitted. - - Unix sockets present a stream interface, such that, for example, a single - six byte transmission might be received as two three byte messages. Rights - data, on the other hand, is conceptually transmitted as unfragmentable - datagrams. If the receiving buffer is not large enough to contain all the - transmitted rights information, the data is truncated and irretreivably lost. - Users should use the \l QUnixSocket::setRightsBufferSize() method to control - the buffer size used for this data, and develop protocols that avoid the - problem. If the buffer size is too small and rights data is truncated, - the \l QUnixSocketMessage::rightsWereTruncated() flag will be set. - - \sa QUnixSocketMessage QUnixSocketRights -*/ - -/*! - \enum QUnixSocket::SocketError - - The SocketError enumeration represents the various errors that can occur on - a Unix domain socket. The most recent error for the socket is available - through the \l QUnixSocket::error() method. - - \value NoError No error has occurred. - \value InvalidPath An invalid path endpoint was passed to - \l QUnixSocket::connect(). As defined by unix(7), invalid paths - include an empty path, or what more than 107 characters long. - \value ResourceError An error acquiring or manipulating the system's socket - resources occurred. For example, if the process runs out of available - socket descriptors, a ResourceError will occur. - \value NonexistentPath The endpoing passed to \l QUnixSocket::connect() does - not refer to a Unix domain socket entity on disk. - \value ConnectionRefused The connection to the specified endpoint was refused. - Generally this means that there is no server listening on that - endpoint. - \value UnknownError An unknown error has occurred. - \value ReadFailure An error occurred while reading bytes from the connection. - \value WriteFailure An error occurred while writing bytes into the connection. - */ - -/*! - \enum QUnixSocket::SocketState - - The SocketState enumeration represents the connection state of a QUnixSocket - instance. - - \value UnconnectedState The connection is not established. - \value ConnectedState The connection is established. - \value ClosingState The connection is being closed, following a call to - \l QUnixSocket::close(). While closing, any pending data will be - transmitted, but further writes by the application will be refused. - */ - -/* - \fn QUnixSocket::bytesWritten(qint64 bytes) - - This signal is emitted every time a payload of data has been written to the - connection. The \a bytes argument is set to the number of bytes that were - written in this payload. - - \sa QUnixSocket::readyRead() -*/ - -/* - \fn QUnixSocket::readyRead() - - This signal is emitted once every time new data is available for reading from - the connection. It will only be emitted again once new data is available. - - \sa QUnixSocket::bytesWritten() -*/ - -/*! - \fn QUnixSocket::stateChanged(SocketState socketState) - - This signal is emitted each time the socket changes connection state. - \a socketState will be set to the socket's new state. -*/ - -class QUnixSocketPrivate : public QObject { -Q_OBJECT -public: - QUnixSocketPrivate(QUnixSocket * _me) - : me(_me), fd(-1), readNotifier(0), writeNotifier(0), - state(QUnixSocket::UnconnectedState), error(QUnixSocket::NoError), - writeQueueBytes(0), messageValid(false), dataBuffer(0), - dataBufferLength(0), dataBufferCapacity(0), ancillaryBuffer(0), - ancillaryBufferCount(0), closingTimer(0) { - QObject::connect(this, SIGNAL(readyRead()), me, SIGNAL(readyRead())); - QObject::connect(this, SIGNAL(bytesWritten(qint64)), - me, SIGNAL(bytesWritten(qint64))); - } - ~QUnixSocketPrivate() - { - if(dataBuffer) - delete [] dataBuffer; - if(ancillaryBuffer) - delete [] ancillaryBuffer; - } - - enum { CausedAbort = 0x70000000 }; - - QUnixSocket * me; - - int fd; - - QSocketNotifier * readNotifier; - QSocketNotifier * writeNotifier; - - QUnixSocket::SocketState state; - QUnixSocket::SocketError error; - - QQueue writeQueue; - unsigned int writeQueueBytes; - - bool messageValid; - ::msghdr message; - inline void flushAncillary() - { - if(!messageValid) return; - ::cmsghdr * h = (::cmsghdr *)CMSG_FIRSTHDR(&(message)); - while(h) { - - if(SCM_RIGHTS == h->cmsg_type) { - int * fds = (int *)CMSG_DATA(h); - int numFds = (h->cmsg_len - CMSG_LEN(0)) / sizeof(int); - - for(int ii = 0; ii < numFds; ++ii) - QT_CLOSE(fds[ii]); - } - - h = (::cmsghdr *)CMSG_NXTHDR(&(message), h); - } - - messageValid = false; - } - - - char * dataBuffer; - unsigned int dataBufferLength; - unsigned int dataBufferCapacity; - - char * ancillaryBuffer; - inline unsigned int ancillaryBufferCapacity() - { - return CMSG_SPACE(sizeof(::ucred)) + CMSG_SPACE(sizeof(int) * ancillaryBufferCount); - } - unsigned int ancillaryBufferCount; - - QByteArray address; - - int closingTimer; - - virtual void timerEvent(QTimerEvent *) - { - me->abort(); - killTimer(closingTimer); - closingTimer = 0; - } -signals: - void readyRead(); - void bytesWritten(qint64); - -public slots: - void readActivated(); - qint64 writeActivated(); -}; - -/*! - Construct a QUnixSocket instance, with \a parent. - - The read buffer is initially set to 1024 bytes, and the rights buffer to 0 - entries. - - \sa QUnixSocket::readBufferSize() QUnixSocket::rightsBufferSize() - */ -QUnixSocket::QUnixSocket(QObject * parent) -: QIODevice(parent), d(new QUnixSocketPrivate(this)) -{ - setOpenMode(QIODevice::NotOpen); - setReadBufferSize(QUNIXSOCKET_DEFAULT_READBUFFER); - setRightsBufferSize(QUNIXSOCKET_DEFAULT_ANCILLARYBUFFER); -} - -/*! - Construct a QUnixSocket instance, with \a parent. - - The read buffer is initially set to \a readBufferSize bytes, and the rights - buffer to \a rightsBufferSize entries. - - \sa QUnixSocket::readBufferSize() QUnixSocket::rightsBufferSize() - */ -QUnixSocket::QUnixSocket(qint64 readBufferSize, qint64 rightsBufferSize, - QObject * parent) -: QIODevice(parent), d(new QUnixSocketPrivate(this)) -{ - Q_ASSERT(readBufferSize > 0 && rightsBufferSize >= 0); - - setOpenMode(QIODevice::NotOpen); - setReadBufferSize(readBufferSize); - setRightsBufferSize(rightsBufferSize); -} - -/*! - Destroys the QUnixSocket instance. Any unsent data is discarded. - */ -QUnixSocket::~QUnixSocket() -{ - abort(); - delete d; -} - -/*! - Attempt to connect to \a path. - - This method is synchronous and will return true if the connection succeeds and - false otherwise. In the case of failure, \l QUnixSocket::error() will be set - accordingly. - - Any existing connection will be aborted, and all pending data will be - discarded. - - \sa QUnixSocket::close() QUnixSocket::abort() QUnixSocket::error() - */ -bool QUnixSocket::connect(const QByteArray & path) -{ - int _true; - int crv; -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Connect requested to '" - << path << '\''; -#endif - - abort(); // Reset any existing connection - - if(UnconnectedState != d->state) // abort() caused a signal and someone messed - // with us. We'll assume they know what - // they're doing and bail. Alternative is to - // have a special "Connecting" state - return false; - - - if(path.isEmpty() || path.size() > UNIX_PATH_MAX) { - d->error = InvalidPath; - return false; - } - - // Create the socket - d->fd = ::socket(PF_UNIX, SOCK_STREAM, 0); - if(-1 == d->fd) { -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Unable to create socket (" - << strerror(errno) << ')'; -#endif - d->error = ResourceError; - goto connect_error; - } - - // Set socket options - _true = 1; - crv = ::setsockopt(d->fd, SOL_SOCKET, SO_PASSCRED, (void *)&_true, - sizeof(int)); - if(-1 == crv) { -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Unable to configure socket (" - << ::strerror(errno) << ')'; -#endif - d->error = ResourceError; - - goto connect_error; - } - - // Construct our unix address - struct ::sockaddr_un addr; - addr.sun_family = AF_UNIX; - ::memcpy(addr.sun_path, path.data(), path.size()); - if(path.size() < UNIX_PATH_MAX) - addr.sun_path[path.size()] = '\0'; - - // Attempt the connect - crv = ::connect(d->fd, (sockaddr *)&addr, sizeof(sockaddr_un)); - if(-1 == crv) { -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Unable to connect (" - << ::strerror(errno) << ')'; -#endif - if(ECONNREFUSED == errno) - d->error = ConnectionRefused; - else if(ENOENT == errno) - d->error = NonexistentPath; - else - d->error = UnknownError; - - goto connect_error; - } - - // We're connected! - d->address = path; - d->state = ConnectedState; - d->readNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Read, d); - d->writeNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Write, d); - QObject::connect(d->readNotifier, SIGNAL(activated(int)), - d, SLOT(readActivated())); - QObject::connect(d->writeNotifier, SIGNAL(activated(int)), - d, SLOT(writeActivated())); - d->readNotifier->setEnabled(true); - d->writeNotifier->setEnabled(false); - setOpenMode(QIODevice::ReadWrite); - emit stateChanged(ConnectedState); - -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Connected to " << path; -#endif - return true; - -connect_error: // Cleanup failed connection - if(-1 != d->fd) { -#ifdef QUNIXSOCKET_DEBUG - int closerv = -#endif - QT_CLOSE(d->fd); -#ifdef QUNIXSOCKET_DEBUG - if(0 != closerv) { - qDebug() << "QUnixSocket: Unable to close file descriptor after " - "failed connect (" << ::strerror(errno) << ')'; - } -#endif - } - d->fd = -1; - return false; -} - -/*! - Sets the socket descriptor to use to \a socketDescriptor, bypassing - QUnixSocket's connection infrastructure, and return true on success and false - on failure. \a socketDescriptor must be in the connected state, and must be - a Unix domain socket descriptor. Following a successful call to this method, - the QUnixSocket instance will be in the Connected state and will have assumed - ownership of \a socketDescriptor. - - Any existing connection will be aborted, and all pending data will be - discarded. - - \sa QUnixSocket::connect() -*/ -bool QUnixSocket::setSocketDescriptor(int socketDescriptor) -{ - abort(); - - if(UnconnectedState != state()) // See QUnixSocket::connect() - return false; - - // Attempt to set the socket options - if(-1 == socketDescriptor) { -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: User provided socket is invalid"; -#endif - d->error = ResourceError; - return false; - } - - // Set socket options - int _true = 1; - int crv = ::setsockopt(socketDescriptor, SOL_SOCKET, - SO_PASSCRED, (void *)&_true, sizeof(int)); - if(-1 == crv) { -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Unable to configure client provided socket (" - << ::strerror(errno) << ')'; -#endif - d->error = ResourceError; - - return false; - } - - d->fd = socketDescriptor; - d->state = ConnectedState; - d->address = QByteArray(); - setOpenMode(QIODevice::ReadWrite); - d->readNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Read, d); - d->writeNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Write, d); - QObject::connect(d->readNotifier, SIGNAL(activated(int)), - d, SLOT(readActivated())); - QObject::connect(d->writeNotifier, SIGNAL(activated(int)), - d, SLOT(writeActivated())); - d->readNotifier->setEnabled(true); - d->writeNotifier->setEnabled(false); - emit stateChanged(d->state); - - return true; -} - -/*! - Returns the socket descriptor currently in use. This method will return -1 - if the QUnixSocket instance is in the UnconnectedState \l {QUnixSocket::state()}{state. } - - \sa QUnixSocket::setSocketDescriptor() - */ -int QUnixSocket::socketDescriptor() const -{ - return d->fd; -} - -/*! - Abort the connection. This will immediately disconnect (if connected) and - discard any pending data. Following a call to QUnixSocket::abort() the - object will always be in the disconnected \link QUnixSocket::state() state. - \endlink - - \sa QUnixSocket::close() -*/ -void QUnixSocket::abort() -{ - setOpenMode(QIODevice::NotOpen); - - // We want to be able to use QUnixSocket::abort() to cleanup our state but - // also preserve the error message that caused the abort. It is not - // possible to reorder code to do this: - // abort(); - // d->error = SomeError - // as QUnixSocket::abort() might emit a signal and we need the error to be - // set within that signal. So, if we want an error message to be preserved - // across a *single* call to abort(), we set the - // QUnixSocketPrivate::CausedAbort flag in the error. - if(d->error & QUnixSocketPrivate::CausedAbort) - d->error = (QUnixSocket::SocketError)(d->error & - ~QUnixSocketPrivate::CausedAbort); - else - d->error = NoError; - - if( UnconnectedState == d->state) return; - -#ifdef QUNIXSOCKET_DEBUG - int closerv = -#endif - ::close(d->fd); -#ifdef QUNIXSOCKET_DEBUG - if(0 != closerv) { - qDebug() << "QUnixSocket: Unable to close socket during abort (" - << strerror(errno) << ')'; - } -#endif - - // Reset variables - d->fd = -1; - d->state = UnconnectedState; - d->dataBufferLength = 0; - d->flushAncillary(); - d->address = QByteArray(); - if(d->readNotifier) { - d->readNotifier->setEnabled(false); - d->readNotifier->deleteLater(); - } - if(d->writeNotifier) { - d->writeNotifier->setEnabled(false); - d->writeNotifier->deleteLater(); - } - d->readNotifier = 0; - d->writeNotifier = 0; - d->writeQueue.clear(); - d->writeQueueBytes = 0; - if(d->closingTimer) { - d->killTimer(d->closingTimer); - } - d->closingTimer = 0; - emit stateChanged(d->state); -} - -/*! - Close the connection. The instance will enter the Closing - \l {QUnixSocket::state()}{state } until all pending data has been - transmitted, at which point it will enter the Unconnected state. - - Even if there is no pending data for transmission, the object will never - jump directly to Disconnect without first passing through the - Closing state. - - \sa QUnixSocket::abort() - */ -void QUnixSocket::close() -{ - if(ConnectedState != state()) return; - - d->state = ClosingState; - if(d->writeQueue.isEmpty()) { - d->closingTimer = d->startTimer(0); // Start a timer to "fake" - // completing writes - } - emit stateChanged(d->state); -} - -/*! - This function writes as much as possible from the internal write buffer to - the underlying socket, without blocking. If any data was written, this - function returns true; otherwise false is returned. -*/ -// Note! docs partially copied from QAbstractSocket::flush() -bool QUnixSocket::flush() -{ - // This needs to have the same semantics as QAbstractSocket, if it is to - // be used interchangeably with that class. - if (d->writeQueue.isEmpty()) - return false; - - d->writeActivated(); - return true; -} - -/*! - Returns the last error to have occurred on this object. This method is not - destructive, so multiple calls to QUnixSocket::error() will return the same - value. The error is only reset by a call to \l QUnixSocket::connect() or - \l QUnixSocket::abort() - */ -QUnixSocket::SocketError QUnixSocket::error() const -{ - return (QUnixSocket::SocketError) - (d->error & ~QUnixSocketPrivate::CausedAbort); -} - -/*! - Returns the connection state of this instance. - */ -QUnixSocket::SocketState QUnixSocket::state() const -{ - return d->state; -} - -/*! - Returns the Unix path address passed to \l QUnixSocket::connect(). This - method will return an empty path if the object is in the Unconnected - \l {QUnixSocket::state()}{state } or was connected through a call - to \l QUnixSocket::setSocketDescriptor() - - \sa QUnixSocket::connect() QUnixSocket::setSocketDescriptor() - */ -QByteArray QUnixSocket::address() const -{ - return d->address; -} - -/*! - Returns the number of bytes available for immediate retrieval through a call - to \l QUnixSocket::read(). - */ -qint64 QUnixSocket::bytesAvailable() const -{ - return QIODevice::bytesAvailable() + d->dataBufferLength; -} - -/*! - Returns the number of enqueued bytes still to be written to the socket. - */ -qint64 QUnixSocket::bytesToWrite() const -{ - return d->writeQueueBytes; -} - -/*! - Returns the size of the read buffer in bytes. The read buffer size - determines the amount of byte data that can be read from the socket in one go. - The read buffer size caps the maximum value that can be returned by - \l QUnixSocket::bytesAvailable() and will always be greater than zero. By - default, the read buffer size is 1024 bytes. - - The size of the read buffer is independent of the rights buffer, which can be - queried by \l QUnixSocket::rightsBufferSize(). - - \sa QUnixSocket::setReadBufferSize() - */ -qint64 QUnixSocket::readBufferSize() const -{ - return d->dataBufferCapacity; -} - -/*! - Sets the \a size of the socket's read buffer in bytes. - - The size of the read buffer is independent of the rights buffer, which can be - set by \l QUnixSocket::setRightsBufferSize(). - - Attempting to reduce the buffer size while bytes are available for reading - (ie. while the buffer is in use) will fail. - - \sa QUnixSocket::readBufferSize() - */ -void QUnixSocket::setReadBufferSize(qint64 size) -{ - Q_ASSERT(size > 0); - if(size == d->dataBufferCapacity || d->dataBufferLength) return; - if(d->dataBuffer) delete [] d->dataBuffer; - d->dataBuffer = new char[size]; - d->dataBufferCapacity = size; -} - -/*! - Returns the size of the rights buffer in rights entries. The rights buffer - size determines the number of rights transferences that can be received in - any message. Unlike byte stream data which can be fragmented into many - smaller messages if the \link QUnixSocket::readBufferSize() read buffer - \endlink is not large enough to contain all the available data, rights data - is transmitted as unfragmentable datagrams. If the rights buffer is not - large enough to contain this unfragmentable datagram, the datagram will be - truncated and rights data irretrievably lost. If truncation occurs, the - \l QUnixSocketMessage::rightsWereTruncated() flag will be set. By default - the rights buffer size is 0 entries - rights data cannot be received. - - The size of the rights buffer is independent of the read buffer, which can be - queried by \l QUnixSocket::readBufferSize(). - - \sa QUnixSocket::setRightsBufferSize() - */ -qint64 QUnixSocket::rightsBufferSize() const -{ - return d->ancillaryBufferCount; -} - -/*! - Sets the \a size of the socket's rights buffer in rights entries. - - The size of the rights buffer is independent of the read buffer, which can be - set by \l QUnixSocket::setReadBufferSize(). - - Attempting to reduce the buffer size while bytes are available for reading - (ie. while the buffer is in use) will fail. - - \sa QUnixSocket::rightsBufferSize() - */ -void QUnixSocket::setRightsBufferSize(qint64 size) -{ - Q_ASSERT(size >= 0); - - if((size == d->ancillaryBufferCount || d->dataBufferLength) && - d->ancillaryBuffer) - return; - - qint64 byteSize = CMSG_SPACE(sizeof(::ucred)) + - CMSG_SPACE(size * sizeof(int)); - - if(d->ancillaryBuffer) delete [] d->ancillaryBuffer; - d->ancillaryBuffer = new char[byteSize]; - d->ancillaryBufferCount = size; -} - -/*! - \overload - - Writes \a socketdata to the socket. In addition to failing if the socket - is not in the Connected state, writing will fail if \a socketdata is - \l {QUnixSocketMessage::isValid()}{invalid. } - - Writes through the QUnixSocket class are asynchronous. Rather than being - written immediately, data is enqueued and written once the application - reenters the Qt event loop and the socket becomes available for writing. - Thus, this method will only fail if the socket is not in the Connected state - - it is illegal to attempt a write on a Unconnected or Closing socket. - - Applications can monitor the progress of data writes through the - \l QUnixSocket::bytesWritten() signal and \l QUnixSocket::bytesToWrite() - method. - - \sa QUnixSocketMessage - */ -qint64 QUnixSocket::write(const QUnixSocketMessage & socketdata) -{ - if(ConnectedState != state() || !socketdata.isValid()) return -1; - if(socketdata.d->size() == 0) return 0; - - d->writeQueue.enqueue(socketdata); - d->writeQueueBytes += socketdata.d->size(); - d->writeNotifier->setEnabled(true); - - return socketdata.d->size(); -} - -/*! - Return the next available message, or an empty message if none is available. - - To avoid retrieving empty messages, applications should connect to the - \l QUnixSocket::readyRead() signal to be notified when new messages are - available or periodically poll the \l QUnixSocket::bytesAvailable() method. - - \sa QUnixSocket::readyRead() QUnixSocket::bytesAvailable() - */ -QUnixSocketMessage QUnixSocket::read() -{ - QUnixSocketMessage data; - if(!d->dataBufferLength) - return data; - - data.d->state = QUnixSocketMessagePrivate::Credential; - - // Bytes are easy - data.setBytes(QByteArray(d->dataBuffer, d->dataBufferLength)); - - // Extract ancillary data - QList a; - - ::cmsghdr * h = (::cmsghdr *)CMSG_FIRSTHDR(&(d->message)); - while(h) { - - if(SCM_CREDENTIALS == h->cmsg_type) { - ::ucred * cred = (::ucred *)CMSG_DATA(h); -#ifdef QUNIXSOCKET_DEBUG - qDebug( "Credentials recd: pid %lu - gid %lu - uid %lu", - cred->pid, cred->gid, cred->uid ); -#endif - data.d->pid = cred->pid; - data.d->gid = cred->gid; - data.d->uid = cred->uid; - - } else if(SCM_RIGHTS == h->cmsg_type) { - - int * fds = (int *)CMSG_DATA(h); - int numFds = (h->cmsg_len - CMSG_LEN(0)) / sizeof(int); - - for(int ii = 0; ii < numFds; ++ii) { - QUnixSocketRights qusr(fds[ii], 0); - a.append(qusr); - } - - } else { - -#ifdef QUNIXSOCKET_DEBUG - qFatal("QUnixSocket: Unknown ancillary data type (%d) received.", - h->cmsg_type); -#endif - - } - - h = (::cmsghdr *)CMSG_NXTHDR(&(d->message), h); - } - - if(d->message.msg_flags & MSG_CTRUNC) { - data.d->state = (QUnixSocketMessagePrivate::AncillaryDataState)(QUnixSocketMessagePrivate::Truncated | - QUnixSocketMessagePrivate::Credential ); - } - - if(!a.isEmpty()) - data.d->rights = a; - - d->dataBufferLength = 0; - d->messageValid = false; - d->readNotifier->setEnabled(true); - - return data; -} - -/*! \internal */ -bool QUnixSocket::isSequential() const -{ - return true; -} - -/*! \internal */ -bool QUnixSocket::waitForReadyRead(int msecs) -{ - if(UnconnectedState == d->state) - return false; - - if(d->messageValid) { - return true; - } - - Q_ASSERT(-1 != d->fd); - - int timeout = msecs; - struct timeval tv; - struct timeval *ptrTv = 0; - QTime stopWatch; - - stopWatch.start(); - - do - { - fd_set readset; - - FD_ZERO(&readset); - FD_SET(d->fd, &readset); - - if(-1 != msecs) { - tv.tv_sec = timeout / 1000; - tv.tv_usec = (timeout % 1000) * 1000; - ptrTv = &tv; - } - - int rv = ::select(d->fd + 1, &readset, 0, 0, ptrTv); - switch(rv) { - case 0: - // timeout - return false; - case 1: - // ok - d->readActivated(); - return true; - default: - if (errno != EINTR) - abort(); // error - break; - } - - timeout = msecs - stopWatch.elapsed(); - } - while (timeout > 0); - - return false; -} - -bool QUnixSocket::waitForBytesWritten(int msecs) -{ - if(UnconnectedState == d->state) - return false; - - Q_ASSERT(-1 != d->fd); - - if ( d->writeQueue.isEmpty() ) - return true; - - QTime stopWatch; - stopWatch.start(); - - while ( true ) - { - fd_set fdwrite; - FD_ZERO(&fdwrite); - FD_SET(d->fd, &fdwrite); - int timeout = msecs < 0 ? 0 : msecs - stopWatch.elapsed(); - struct timeval tv; - struct timeval *ptrTv = 0; - if ( -1 != msecs ) - { - tv.tv_sec = timeout / 1000; - tv.tv_usec = (timeout % 1000) * 1000; - ptrTv = &tv; - } - - int rv = ::select(d->fd + 1, 0, &fdwrite, 0, ptrTv); - switch ( rv ) - { - case 0: - // timeout - return false; - case 1: - { - // ok to write - qint64 bytesWritten = d->writeActivated(); - if (bytesWritten == 0) { - // We need to retry - int delay = 1; - do { - if (-1 != msecs) { - timeout = msecs - stopWatch.elapsed(); - if (timeout <= 0) { - // We have exceeded our allotted time - return false; - } else { - if (delay > timeout) - delay = timeout; - } - } - - // Pause before we make another attempt to send - ::usleep(delay * 1000); - if (delay < 1024) - delay *= 2; - - bytesWritten = d->writeActivated(); - } while (bytesWritten == 0); - } - return (bytesWritten != -1); - } - default: - // error - or an uncaught signal!!!!!!!!! - if ( rv == EINTR ) - continue; - abort(); - return false; - } - } - return false; // fix warnings -} - -/*! \internal */ -bool QUnixSocket::canReadLine() const -{ - for(unsigned int ii = 0; ii < d->dataBufferLength; ++ii) - if(d->dataBuffer[ii] == '\n') return true; - return false; -} - -/*! \internal */ -qint64 QUnixSocket::readData(char * data, qint64 maxSize) -{ - Q_ASSERT(data); - if(0 >= maxSize) return 0; - if(!d->dataBufferLength) return 0; - - // Read data - unsigned int size = d->dataBufferLength>maxSize?maxSize:d->dataBufferLength; - memcpy(data, d->dataBuffer, size); - if(size == d->dataBufferLength) { - d->dataBufferLength = 0; - } else { - memmove(d->dataBuffer, d->dataBuffer + size, d->dataBufferLength - size); - d->dataBufferLength -= size; - } - - - // Flush ancillary - d->flushAncillary(); - - if(0 == d->dataBufferLength) - d->readNotifier->setEnabled(true); - - return size; -} - -/*! \internal */ -qint64 QUnixSocket::writeData (const char * data, qint64 maxSize) -{ - return write(QUnixSocketMessage(QByteArray(data, maxSize))); -} - -qint64 QUnixSocketPrivate::writeActivated() -{ - writeNotifier->setEnabled(false); - - QUnixSocketMessage & m = writeQueue.head(); - const QList & a = m.rights(); - - // - // Construct the message - // - ::iovec vec; - if ( !m.d->vec ) // message does not already have an iovec - { - vec.iov_base = (void *)m.bytes().constData(); - vec.iov_len = m.bytes().size(); - } - - // Allocate the control buffer - ::msghdr sendmessage; - ::bzero(&sendmessage, sizeof(::msghdr)); - if ( m.d->vec ) - { - sendmessage.msg_iov = m.d->vec; - sendmessage.msg_iovlen = m.d->iovecLen; - } - else - { - sendmessage.msg_iov = &vec; - sendmessage.msg_iovlen = 1; - } - unsigned int required = CMSG_SPACE(sizeof(::ucred)) + - a.size() * CMSG_SPACE(sizeof(int)); - sendmessage.msg_control = new char[required]; - ::bzero(sendmessage.msg_control, required); - sendmessage.msg_controllen = required; - - // Create ancillary buffer - ::cmsghdr * h = CMSG_FIRSTHDR(&sendmessage); - - if(m.d->state & QUnixSocketMessagePrivate::Credential) { - h->cmsg_len = CMSG_LEN(sizeof(::ucred)); - h->cmsg_level = SOL_SOCKET; - h->cmsg_type = SCM_CREDENTIALS; - ((::ucred *)CMSG_DATA(h))->pid = m.d->pid; - ((::ucred *)CMSG_DATA(h))->gid = m.d->gid; - ((::ucred *)CMSG_DATA(h))->uid = m.d->uid; - h = CMSG_NXTHDR(&sendmessage, h); - } else { - sendmessage.msg_controllen -= CMSG_SPACE(sizeof(::ucred)); - } - - for(int ii = 0; ii < a.count(); ++ii) { - const QUnixSocketRights & r = a.at(ii); - - if(r.isValid()) { - h->cmsg_len = CMSG_LEN(sizeof(int)); - h->cmsg_level = SOL_SOCKET; - h->cmsg_type = SCM_RIGHTS; - *((int *)CMSG_DATA(h)) = r.peekFd(); - h = CMSG_NXTHDR(&sendmessage, h); - } else { - sendmessage.msg_controllen -= CMSG_SPACE(sizeof(int)); - } - } - -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Transmitting message (length" << m.d->size() << ')'; -#endif - ::ssize_t s = ::sendmsg(fd, &sendmessage, MSG_DONTWAIT | MSG_NOSIGNAL); -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Transmitted message (" << s << ')'; -#endif - - if(-1 == s) { - if(EAGAIN == errno || EWOULDBLOCK == errno || EINTR == errno) { - writeNotifier->setEnabled(true); - } else if(EPIPE == errno) { -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Remote side disconnected during transmit " - "(" << ::strerror(errno) << ')'; -#endif - me->abort(); - } else { -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Unable to transmit data (" - << ::strerror(errno) << ')'; -#endif - error = (QUnixSocket::SocketError)(QUnixSocket::WriteFailure | - CausedAbort); - me->abort(); - } - } else if(s != m.d->size()) { - - // A partial transmission - writeNotifier->setEnabled(true); - delete [] (char *)sendmessage.msg_control; - m.d->rights = QList(); - m.d->removeBytes( s ); - writeQueueBytes -= s; - emit bytesWritten(s); - return s; - - } else { - - // Success! - writeQueue.dequeue(); - Q_ASSERT(writeQueueBytes >= (unsigned)s); - writeQueueBytes -= s; - emit bytesWritten(s); - - } - - delete [] (char *)sendmessage.msg_control; - if(-1 != s && !writeQueue.isEmpty()) - return writeActivated(); - else if(QUnixSocket::ClosingState == me->state() && writeQueue.isEmpty()) - me->abort(); - - if((-1 == s) && (EAGAIN == errno || EWOULDBLOCK == errno || EINTR == errno)) - // Return zero bytes written to indicate retry may be required - return 0; - else - return s; -} - -void QUnixSocketPrivate::readActivated() -{ -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: readActivated"; -#endif - readNotifier->setEnabled(false); - - ::iovec vec; - vec.iov_base = dataBuffer; - vec.iov_len = dataBufferCapacity; - - bzero(&message, sizeof(::msghdr)); - message.msg_iov = &vec; - message.msg_iovlen = 1; - message.msg_controllen = ancillaryBufferCapacity(); - message.msg_control = ancillaryBuffer; - - int flags = 0; -#ifdef MSG_CMSG_CLOEXEC - flags = MSG_CMSG_CLOEXEC; -#endif - - int recvrv = ::recvmsg(fd, &message, flags); -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Received message (" << recvrv << ')'; -#endif - if(-1 == recvrv) { -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: Unable to receive data (" - << ::strerror(errno) << ')'; -#endif - error = (QUnixSocket::SocketError)(QUnixSocket::ReadFailure | - CausedAbort); - me->abort(); - } else if(0 == recvrv) { - me->abort(); - } else { - Q_ASSERT(recvrv); - Q_ASSERT((unsigned)recvrv <= dataBufferCapacity); - dataBufferLength = recvrv; - messageValid = true; - -#ifdef QUNIXSOCKET_DEBUG - qDebug() << "QUnixSocket: readyRead() " << dataBufferLength; -#endif - emit readyRead(); - } -} - -QT_END_NAMESPACE - -#include "qunixsocket.moc" diff --git a/src/gui/embedded/qunixsocket_p.h b/src/gui/embedded/qunixsocket_p.h deleted file mode 100644 index 12b2187b30b..00000000000 --- a/src/gui/embedded/qunixsocket_p.h +++ /dev/null @@ -1,202 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QUNIXSOCKET_P_H -#define QUNIXSOCKET_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 - -extern "C" { -#include -}; - -QT_BEGIN_NAMESPACE - -class QUnixSocketRights; -class QUnixSocketRightsPrivate; -class QUnixSocketPrivate; -class QUnixSocketMessagePrivate; -struct iovec; - -class Q_GUI_EXPORT QUnixSocketRights { -public: - QUnixSocketRights(int); - ~QUnixSocketRights(); - - QUnixSocketRights(const QUnixSocketRights &); - QUnixSocketRights & operator=(const QUnixSocketRights &); - - bool isValid() const; - - int dupFd() const; - int peekFd() const; - -private: - friend class QUnixSocket; - QUnixSocketRights(int,int); - QSharedDataPointer d; -}; - -class Q_GUI_EXPORT QUnixSocketMessage { -public: - QUnixSocketMessage(); - QUnixSocketMessage(const QByteArray &); - QUnixSocketMessage(const QByteArray &, const QList &); - QUnixSocketMessage(const QUnixSocketMessage &); - QUnixSocketMessage(const iovec*, int); - QUnixSocketMessage & operator=(const QUnixSocketMessage &); - ~QUnixSocketMessage(); - - void setBytes(const QByteArray &); - void setRights(const QList &); - - const QList & rights() const; - bool rightsWereTruncated() const; - - const QByteArray & bytes() const; - - pid_t processId() const; - uid_t userId() const; - gid_t groupId() const; - - void setProcessId(pid_t); - void setUserId(uid_t); - void setGroupId(gid_t); - - bool isValid() const; -private: - friend class QUnixSocket; - friend class QUnixSocketPrivate; - QSharedDataPointer d; -}; - -class Q_GUI_EXPORT QUnixSocket : public QIODevice -{ - Q_OBJECT -public: - QUnixSocket(QObject * = 0); - QUnixSocket(qint64, qint64, QObject * = 0); - virtual ~QUnixSocket(); - - enum SocketState { - UnconnectedState = QAbstractSocket::UnconnectedState, - HostLookupState = QAbstractSocket::HostLookupState, - ConnectingState = QAbstractSocket::ConnectingState, - ConnectedState = QAbstractSocket::ConnectedState, - BoundState = QAbstractSocket::BoundState, - ClosingState = QAbstractSocket::ClosingState, - ListeningState = QAbstractSocket::ListeningState, - }; - - enum SocketError { NoError, InvalidPath, ResourceError, - NonexistentPath, ConnectionRefused, UnknownError, - ReadFailure, WriteFailure }; - - bool connect(const QByteArray & path); - bool setSocketDescriptor(int socketDescriptor); - int socketDescriptor() const; - void abort(); - void close(); - - bool flush(); - - SocketError error() const; - - SocketState state() const; - QByteArray address() const; - - qint64 bytesAvailable() const; - qint64 bytesToWrite() const; - - qint64 readBufferSize() const; - void setReadBufferSize(qint64 size); - qint64 rightsBufferSize() const; - void setRightsBufferSize(qint64 size); - - bool canReadLine() const; - - qint64 write(const char * data, qint64 maxSize) - { return QIODevice::write(data, maxSize); } - qint64 write(const QByteArray & byteArray) - { return QIODevice::write(byteArray); } - qint64 read(char * data, qint64 maxSize) - { return QIODevice::read(data, maxSize); } - QByteArray read(qint64 maxSize) - { return QIODevice::read(maxSize); } - - qint64 write(const QUnixSocketMessage &); - QUnixSocketMessage read(); - - virtual bool isSequential() const; - virtual bool waitForReadyRead(int msec = 300); - virtual bool waitForBytesWritten(int msec = 300); - -Q_SIGNALS: - void stateChanged(SocketState socketState); - -protected: - virtual qint64 readData(char * data, qint64 maxSize); - virtual qint64 writeData (const char * data, qint64 maxSize); - -private: - QUnixSocket(const QUnixSocket &); - QUnixSocket & operator=(const QUnixSocket &); - - QUnixSocketPrivate * d; -}; - -QT_END_NAMESPACE - -#endif // QUNIXSOCKET_P_H diff --git a/src/gui/embedded/qunixsocketserver.cpp b/src/gui/embedded/qunixsocketserver.cpp deleted file mode 100644 index 32eeeab65bd..00000000000 --- a/src/gui/embedded/qunixsocketserver.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qunixsocketserver_p.h" - -// #define QUNIXSOCKETSERVER_DEBUG - -#ifdef QUNIXSOCKETSERVER_DEBUG -#include -#endif - -#include - -extern "C" { -#include -#include -#include -#include -#include -}; - -#define UNIX_PATH_MAX 108 // From unix(7) - -QT_BEGIN_NAMESPACE - -class QUnixSocketServerPrivate : public QObject -{ -Q_OBJECT -public: - QUnixSocketServerPrivate(QUnixSocketServer * parent) - : QObject(), me(parent), fd(-1), maxConns(30), - error(QUnixSocketServer::NoError), acceptNotifier(0) - {} - - QUnixSocketServer * me; - int fd; - int maxConns; - QByteArray address; - QUnixSocketServer::ServerError error; - QSocketNotifier * acceptNotifier; -public slots: - void acceptActivated(); -}; - -/*! - \class QUnixSocketServer - \internal - - \brief The QUnixSocketServer class provides a Unix domain socket based server. - \omit - \ingroup Platform::DeviceSpecific - \ingroup Platform::OS - \ingroup Platform::Communications - \endomit - \ingroup qws - - This class makes it possible to accept incoming Unix domain socket - connections. Call \l QUnixSocketServer::listen() to have the server listen - for incoming connections on a specified path. The pure virtual - \l QUnixSocketServer::incomingConnection() is called each time a new - connection is established. Users must inherit from QUnixSocketServer and - implement this method. - - If an error occurs, \l QUnixSocketServer::serverError() returns the type of - error. Errors can only occur during server establishment - that is, during a - call to \l QUnixSocketServer::listen(). Calling \l QUnixSocketServer::close() - causes QUnixSocketServer to stop listening for connections and reset its - state. - - QUnixSocketServer is often used in conjunction with the \l QUnixSocket class. - - \sa QUnixSocket -*/ - -/*! - \enum QUnixSocketServer::ServerError - - The ServerError enumeration represents the errors that can occur during server - establishment. The most recent error can be retrieved through a call to - \l QUnixSocketServer::serverError(). - - \value NoError No error has occurred. - \value InvalidPath An invalid path endpoint was passed to - \l QUnixSocketServer::listen(). As defined by unix(7), invalid paths - include an empty path, or what more than 107 characters long. - \value ResourceError An error acquiring or manipulating the system's socket - resources occurred. For example, if the process runs out of available - socket descriptors, a ResourceError will occur. - \value BindError The server was unable to bind to the specified path. - \value ListenError The server was unable to listen on the specified path for - incoming connections. - */ - -/*! - Create a new Unix socket server with the given \a parent. - */ -QUnixSocketServer::QUnixSocketServer(QObject *parent) -: QObject(parent), d(0) -{ -} - -/*! - Stops listening for incoming connection and destroys the Unix socket server. - */ -QUnixSocketServer::~QUnixSocketServer() -{ - close(); - if(d) - delete d; -} - -/*! - Stop listening for incoming connections and resets the Unix socket server's - state. Calling this method while \l {QUnixSocketServer::isListening()}{not listening } for incoming connections is a no-op. - - \sa QUnixSocketServer::listen() - */ -void QUnixSocketServer::close() -{ - if(!d) - return; - - if(d->acceptNotifier) { - d->acceptNotifier->setEnabled(false); - delete d->acceptNotifier; - } - d->acceptNotifier = 0; - - if(-1 != d->fd) { -#ifdef QUNIXSOCKET_DEBUG - int closerv = -#endif - ::close(d->fd); -#ifdef QUNIXSOCKET_DEBUG - if(0 != closerv) { - qDebug() << "QUnixSocketServer: Unable to close socket (" - << strerror(errno) << ')'; - } -#endif - } - d->fd = -1; - d->address = QByteArray(); - d->error = NoError; -} - -/*! - Returns the last server error. Errors may only occur within a call to - \l QUnixSocketServer::listen(), and only when such a call fails. - - This method is not destructive, so multiple calls to - QUnixSocketServer::serverError() will return the same value. The error is - only reset by an explicit call to \l QUnixSocketServer::close() or - by further calls to \l QUnixSocketServer::listen(). - */ -QUnixSocketServer::ServerError QUnixSocketServer::serverError() const -{ - if(!d) - return NoError; - - return d->error; -} - -/*! - Returns true if this server is listening for incoming connections, false - otherwise. - - \sa QUnixSocketServer::listen() - */ -bool QUnixSocketServer::isListening() const -{ - if(!d) - return false; - - return (-1 != d->fd); -} - -/*! - Tells the server to listen for incoming connections on \a path. Returns true - if it successfully initializes, false otherwise. In the case of failure, the - \l QUnixSocketServer::serverError() error status is set accordingly. - - Calling this method while the server is already running will result in the - server begin reset, and then attempting to listen on \a path. This will not - affect connections established prior to the server being reset, but further - incoming connections on the previous path will be refused. - - The server can be explicitly reset by a call to \l QUnixSocketServer::close(). - - \sa QUnixSocketServer::close() - */ -bool QUnixSocketServer::listen(const QByteArray & path) -{ - if(d) { - close(); // Any existing server is destroyed - } else { - d = new QUnixSocketServerPrivate(this); - } - - if(path.isEmpty() || path.size() > UNIX_PATH_MAX) { - d->error = InvalidPath; - return false; - } - unlink( path ); // ok if this fails - - // Create the socket - d->fd = ::socket(PF_UNIX, SOCK_STREAM, 0); - if(-1 == d->fd) { -#ifdef QUNIXSOCKETSERVER_DEBUG - qDebug() << "QUnixSocketServer: Unable to create socket (" - << strerror(errno) << ')'; -#endif - close(); - d->error = ResourceError; - return false; - } - - // Construct our unix address - struct ::sockaddr_un addr; - addr.sun_family = AF_UNIX; - ::memcpy(addr.sun_path, path.data(), path.size()); - if(path.size() < UNIX_PATH_MAX) - addr.sun_path[path.size()] = '\0'; - - // Attempt to bind - if(-1 == ::bind(d->fd, (sockaddr *)&addr, sizeof(sockaddr_un))) { -#ifdef QUNIXSOCKETSERVER_DEBUG - qDebug() << "QUnixSocketServer: Unable to bind socket (" - << strerror(errno) << ')'; -#endif - close(); - d->error = BindError; - return false; - } - - // Listen to socket - if(-1 == ::listen(d->fd, d->maxConns)) { -#ifdef QUNIXSOCKETSERVER_DEBUG - qDebug() << "QUnixSocketServer: Unable to listen socket (" - << strerror(errno) << ')'; -#endif - close(); - d->error = ListenError; - return false; - } - - // Success! - d->address = path; - d->acceptNotifier = new QSocketNotifier(d->fd, QSocketNotifier::Read, d); - d->acceptNotifier->setEnabled(true); - QObject::connect(d->acceptNotifier, SIGNAL(activated(int)), - d, SLOT(acceptActivated())); - - return true; -} - -/*! - Returns the Unix path on which this server is listening. If this server is - not listening, and empty address will be returned. - */ -QByteArray QUnixSocketServer::serverAddress() const -{ - if(!d) - return QByteArray(); - return d->address; -} - -int QUnixSocketServer::socketDescriptor() const -{ - if (!d) - return -1; - return d->fd; -} - - -/*! - Returns the maximum length the queue of pending connections may grow to. That - is, the maximum number of clients attempting to connect for which the Unix - socket server has not yet accepted and passed to - \l QUnixSocketServer::incomingConnection(). If a connection request arrives - with the queue full, the client may receive a connection refused notification. - - By default a queue length of 30 is used. - - \sa QUnixSocketServer::setMaxPendingConnections() - */ -int QUnixSocketServer::maxPendingConnections() const -{ - if(!d) - return 30; - - return d->maxConns; -} - -/*! - Sets the maximum length the queue of pending connections may grow to - \a numConnections. This value will only apply to - \l QUnixSocketServer::listen() calls made following the value change - it will - not be retroactively applied. - - \sa QUnixSocketServer::maxPendingConnections() - */ -void QUnixSocketServer::setMaxPendingConnections(int numConnections) -{ - Q_ASSERT(numConnections >= 1); - if(!d) - d = new QUnixSocketServerPrivate(this); - - d->maxConns = numConnections; -} - -/*! - \fn void QUnixSocketServer::incomingConnection(int socketDescriptor) - - This method is invoked each time a new incoming connection is established with - the server. Clients must reimplement this function in their QUnixSocketServer - derived class to handle the connection. - - A common approach to handling the connection is to pass \a socketDescriptor to - a QUnixSocket instance. - - \sa QUnixSocket - */ - -void QUnixSocketServerPrivate::acceptActivated() -{ - ::sockaddr_un r; - socklen_t len = sizeof(sockaddr_un); - int connsock = ::accept(fd, (sockaddr *)&r, &len); -#ifdef QUNIXSOCKETSERVER_DEBUG - qDebug() << "QUnixSocketServer: Accept connection " << connsock; -#endif - if(-1 != connsock) - me->incomingConnection(connsock); -} - -QT_END_NAMESPACE - -#include "qunixsocketserver.moc" diff --git a/src/gui/embedded/qvfbhdr.h b/src/gui/embedded/qvfbhdr.h deleted file mode 100644 index eb954927a49..00000000000 --- a/src/gui/embedded/qvfbhdr.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QVFBHDR_H -#define QVFBHDR_H - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_QWS_TEMP_DIR -# define QT_QWS_TEMP_DIR QLatin1String("/tmp") -#endif - -#ifdef QT_PRIVATE_QWS -#define QT_VFB_DATADIR(DISPLAY) QString::fromLatin1("%1/qtembedded-%2-%3") \ - .arg(QT_QWS_TEMP_DIR).arg(getuid()).arg(DISPLAY) -#define QT_VFB_MOUSE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ - .append(QLatin1String("/qtvfb_mouse")) -#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ - .append(QLatin1String("/qtvfb_keyboard")) -#define QT_VFB_MAP(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ - .append(QLatin1String("/qtvfb_map")) -#define QT_VFB_SOUND_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ - .append(QLatin1String("/qt_soundserver")) -#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ - .append(QLatin1String("/QtEmbedded")) -#define QTE_PIPE_QVFB(DISPLAY) QTE_PIPE(DISPLAY) -#else -#define QT_VFB_DATADIR(DISPLAY) QString::fromLatin1("%1/qtembedded-%2") \ - .arg(QT_QWS_TEMP_DIR).arg(DISPLAY) -#define QT_VFB_MOUSE_PIPE(DISPLAY) QString::fromLatin1("%1/.qtvfb_mouse-%2") \ - .arg(QT_QWS_TEMP_DIR).arg(DISPLAY) -#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QString::fromLatin1("%1/.qtvfb_keyboard-%2") \ - .arg(QT_QWS_TEMP_DIR).arg(DISPLAY) -#define QT_VFB_MAP(DISPLAY) QString::fromLatin1("%1/.qtvfb_map-%2") \ - .arg(QT_QWS_TEMP_DIR).arg(DISPLAY) -#define QT_VFB_SOUND_PIPE(DISPLAY) QString::fromLatin1("%1/.qt_soundserver-%2") \ - .arg(QT_QWS_TEMP_DIR).arg(DISPLAY) -#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \ - .append(QLatin1String("/QtEmbedded-%1")).arg(DISPLAY) -#define QTE_PIPE_QVFB(DISPLAY) QTE_PIPE(DISPLAY) -#endif - -struct QVFbHeader -{ - int width; - int height; - int depth; - int linestep; - int dataoffset; - QRect update; - bool dirty; - int numcols; - QRgb clut[256]; - int viewerVersion; - int serverVersion; - int brightness; // since 4.4.0 - WId windowId; // since 4.5.0 -}; - -struct QVFbKeyData -{ - unsigned int keycode; - Qt::KeyboardModifiers modifiers; - unsigned short int unicode; - bool press; - bool repeat; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QVFBHDR_H diff --git a/src/gui/embedded/qwindowsystem_p.h b/src/gui/embedded/qwindowsystem_p.h deleted file mode 100644 index 3a315bebcbd..00000000000 --- a/src/gui/embedded/qwindowsystem_p.h +++ /dev/null @@ -1,315 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSYSTEM_QWS_P_H -#define QWINDOWSYSTEM_QWS_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 QWSServer class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include "private/qobject_p.h" -#include "qwindowsystem_qws.h" -#include "qbrush.h" -#include "qwsproperty_qws.h" -#include "qwscommand_qws_p.h" -#include "QtCore/qbasictimer.h" - -QT_BEGIN_NAMESPACE - -class QWSServerPrivate : public QObjectPrivate { - friend class QCopChannel; - friend class QWSMouseHandler; - friend class QWSWindow; - friend class QWSDisplay; - friend class QWSInputMethod; - Q_DECLARE_PUBLIC(QWSServer) - -public: - QWSServerPrivate() - : screensaverintervals(0) - , screensavereventblocklevel(-1), screensaverblockevents(false) - , saver(0), cursorClient(0), mouseState(0), nReserved(0) - , doClientIsActive(false) - { - } - ~QWSServerPrivate() - { - closeDisplay(); - - qDeleteAll(deletedWindows); - delete [] screensaverintervals; - delete saver; - - qDeleteAll(windows); - windows.clear(); - - delete bgBrush; - bgBrush = 0; - } - QTime screensavertime; - QTimer* screensavertimer; - int* screensaverintervals; - int screensavereventblocklevel; - bool screensaverblockevents; - bool screensaverblockevent( int index, int *screensaverinterval, bool isDown ); - QWSScreenSaver* saver; - QWSClient *cursorClient; - int mouseState; -// bool prevWin; - QList deletedWindows; - QList crashedClientIds; - - void update_regions(); -//private functions moved from class - -private: - void initServer(int flags); -#ifndef QT_NO_COP - static void sendQCopEvent(QWSClient *c, const QString &ch, - const QString &msg, const QByteArray &data, - bool response = false); -#endif - void move_region(const QWSRegionMoveCommand *); - void set_altitude(const QWSChangeAltitudeCommand *); - void set_opacity(const QWSSetOpacityCommand *); - void request_focus(const QWSRequestFocusCommand *); - QRegion reserve_region(QWSWindow *window, const QRegion ®ion); - void request_region(int winId, const QString &surfaceKey, - const QByteArray &surfaceData, - const QRegion ®ion); - void repaint_region(int winId, int windowFlags, bool opaque, const QRegion &); - void destroy_region(const QWSRegionDestroyCommand *); - void name_region(const QWSRegionNameCommand *); - void set_identity(const QWSIdentifyCommand *); -#ifndef QT_NO_QWS_PROPERTIES - bool get_property(int winId, int property, const char *&data, int &len); -#endif -#ifndef QT_NO_QWS_INPUTMETHODS - void im_response(const QWSIMResponseCommand *); - - void im_update(const QWSIMUpdateCommand *); - - void send_im_mouse(const QWSIMMouseCommand *); -#endif - // not in ifndef as this results in more readable functions. - static void sendKeyEventUnfiltered(int unicode, int keycode, Qt::KeyboardModifiers modifiers, - bool isPress, bool autoRepeat); - static void sendMouseEventUnfiltered(const QPoint &pos, int state, int wheel = 0); - static void emergency_cleanup(); - - static QBrush *bgBrush; - - void sendMaxWindowRectEvents(const QRect &rect); - - void invokeIdentify(const QWSIdentifyCommand *cmd, QWSClient *client); - void invokeCreate(QWSCreateCommand *cmd, QWSClient *client); - void invokeRegionName(const QWSRegionNameCommand *cmd, QWSClient *client); - void invokeRegion(QWSRegionCommand *cmd, QWSClient *client); - void invokeRegionMove(const QWSRegionMoveCommand *cmd, QWSClient *client); - void invokeRegionDestroy(const QWSRegionDestroyCommand *cmd, QWSClient *client); - void invokeSetAltitude(const QWSChangeAltitudeCommand *cmd, QWSClient *client); - void invokeSetOpacity(const QWSSetOpacityCommand *cmd, QWSClient *client); -#ifndef QT_NO_QWS_PROPERTIES - void invokeAddProperty(QWSAddPropertyCommand *cmd); - void invokeSetProperty(QWSSetPropertyCommand *cmd); - void invokeRemoveProperty(QWSRemovePropertyCommand *cmd); - void invokeGetProperty(QWSGetPropertyCommand *cmd, QWSClient *client); -#endif //QT_NO_QWS_PROPERTIES - void invokeSetSelectionOwner(QWSSetSelectionOwnerCommand *cmd); - void invokeConvertSelection(QWSConvertSelectionCommand *cmd); - void invokeSetFocus(const QWSRequestFocusCommand *cmd, QWSClient *client); - - void initIO(); - void setFocus(QWSWindow*, bool gain); -#ifndef QT_NO_QWS_CURSOR - void invokeDefineCursor(QWSDefineCursorCommand *cmd, QWSClient *client); - void invokeSelectCursor(QWSSelectCursorCommand *cmd, QWSClient *client); - void invokePositionCursor(QWSPositionCursorCommand *cmd, QWSClient *client); -#endif - void invokeGrabMouse(QWSGrabMouseCommand *cmd, QWSClient *client); - void invokeGrabKeyboard(QWSGrabKeyboardCommand *cmd, QWSClient *client); -#ifndef QT_NO_SOUND - void invokePlaySound(QWSPlaySoundCommand *cmd, QWSClient *client); -#endif -#ifndef QT_NO_COP - void invokeRegisterChannel(QWSQCopRegisterChannelCommand *cmd, - QWSClient *client); - void invokeQCopSend(QWSQCopSendCommand *cmd, QWSClient *client); -#endif - void invokeRepaintRegion(QWSRepaintRegionCommand *cmd, - QWSClient *client); -#ifndef QT_NO_QWSEMBEDWIDGET - void invokeEmbed(QWSEmbedCommand *cmd, QWSClient *client); -#endif -#ifndef QT_NO_QWS_INPUTMETHODS - void invokeIMResponse(const QWSIMResponseCommand *cmd, - QWSClient *client); - void invokeIMUpdate(const QWSIMUpdateCommand *cmd, - QWSClient *client); -#endif - void invokeFont(const QWSFontCommand *cmd, QWSClient *client); - void invokeScreenTransform(const QWSScreenTransformCommand *cmd, - QWSClient *client); - - QWSMouseHandler* newMouseHandler(const QString& spec); - void openDisplay(); - void closeDisplay(); - - void showCursor(); - void hideCursor(); - void initializeCursor(); - - void resetEngine(); - -//private Q_SLOTS: - -#ifndef QT_NO_QWS_MULTIPROCESS - void _q_clientClosed(); - void _q_doClient(); - void _q_deleteWindowsLater(); -#endif - - void _q_screenSaverWake(); - void _q_screenSaverSleep(); - void _q_screenSaverTimeout(); -#ifndef QT_NO_QWS_MULTIPROCESS - void _q_newConnection(); -#endif - -//other private moved from class - - void disconnectClient(QWSClient *); - void screenSave(int level); - void doClient(QWSClient *); - typedef QMap::Iterator ClientIterator; - typedef QMap ClientMap; - void handleWindowClose(QWSWindow *w); - void releaseMouse(QWSWindow* w); - void releaseKeyboard(QWSWindow* w); - void updateClientCursorPos(); - - uchar* sharedram; - int ramlen; - - ClientMap clientMap; -#ifndef QT_NO_QWS_PROPERTIES - QWSPropertyManager propertyManager; -#endif - struct SelectionOwner { - int windowid; - struct Time { - void set(int h, int m, int s, int s2) { - hour = h; minute = m; sec = s; ms = s2; - } - int hour, minute, sec, ms; - } time; - } selectionOwner; - QTime timer; - int* screensaverinterval; - - QWSWindow *focusw; - QWSWindow *mouseGrabber; - bool mouseGrabbing; - bool inputMethodMouseGrabbed; - int swidth, sheight, sdepth; -#ifndef QT_NO_QWS_CURSOR - bool haveviscurs; - QWSCursor *cursor; // cursor currently shown - QWSCursor *nextCursor; // cursor to show once grabbing is off -#endif - - bool disablePainting; - QList mousehandlers; -#ifndef QT_NO_QWS_KEYBOARD - QList keyboardhandlers; -#endif - - QList commandQueue; - - // Window management - QList windows; // first=topmost - int nReserved; - QWSWindow* newWindow(int id, QWSClient* client); - QWSWindow* findWindow(int windowid, QWSClient* client = 0); - void moveWindowRegion(QWSWindow*, int dx, int dy); - void setWindowRegion(QWSWindow*, const QRegion &r); - void raiseWindow(QWSWindow *, int = 0); - void lowerWindow(QWSWindow *, int = -1); - void exposeRegion(const QRegion &, int index = 0); - - void setCursor(QWSCursor *curs); - - // multimedia -#ifndef QT_NO_SOUND - QWSSoundServer *soundserver; -#endif -#ifndef QT_NO_COP - QMap > channels; -#endif - -#ifndef QT_NO_QWS_MULTIPROCESS - QWSServerSocket *ssocket; -#endif - - // filename -> refcount - QMap fontReferenceCount; - QBasicTimer fontCleanupTimer; - void referenceFont(QWSClientPrivate *client, const QByteArray &font); - void dereferenceFont(QWSClientPrivate *client, const QByteArray &font); - void cleanupFonts(bool force = false); - void sendFontRemovedEvent(const QByteArray &font); - - bool doClientIsActive; - QList pendingDoClients; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/gui/embedded/qwindowsystem_qws.cpp b/src/gui/embedded/qwindowsystem_qws.cpp deleted file mode 100644 index 0e4e27c8523..00000000000 --- a/src/gui/embedded/qwindowsystem_qws.cpp +++ /dev/null @@ -1,4960 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformdefs.h" - -#include "qwindowsystem_qws.h" -#include "qwsevent_qws.h" -#include "qwscommand_qws_p.h" -#include "qtransportauth_qws_p.h" -#include "qwsutils_qws.h" -#include "qwscursor_qws.h" -#include "qwsdisplay_qws.h" -#include "qmouse_qws.h" -#include "qcopchannel_qws.h" -#include "qwssocket_qws.h" - -#include "qapplication.h" -#include "private/qapplication_p.h" -#include "qsocketnotifier.h" -#include "qpolygon.h" -#include "qimage.h" -#include "qcursor.h" -#include -#include "qscreen_qws.h" -#include "qwindowdefs.h" -#include "private/qlock_p.h" -#include "qwslock_p.h" -#include "qfile.h" -#include "qtimer.h" -#include "qpen.h" -#include "qdesktopwidget.h" -#include "qevent.h" -#include "qinputcontext.h" -#include "qpainter.h" - -#include - -#include "qkbddriverfactory_qws.h" -#include "qmousedriverfactory_qws.h" - -#include -#include - -#include -#include - -#include "qwindowsystem_p.h" - - -#include -#include -#include - -#ifndef QT_NO_QWS_MULTIPROCESS -#include -#include -#endif - -#if !defined(QT_NO_SOUND) && !defined(Q_OS_DARWIN) -#ifdef QT_USE_OLD_QWS_SOUND -#include -#include -#include -#include -#else -#include "qsoundqss_qws.h" -#endif -#endif - -//#define QWS_DEBUG_FONTCLEANUP - -QT_BEGIN_NAMESPACE - -QWSServer Q_GUI_EXPORT *qwsServer=0; -static QWSServerPrivate *qwsServerPrivate=0; - -#define MOUSE 0 -#define KEY 1 -//#define EVENT_BLOCK_DEBUG - -QWSScreenSaver::~QWSScreenSaver() -{ -} - -extern QByteArray qws_display_spec; -extern void qt_init_display(); //qapplication_qws.cpp -extern QString qws_qtePipeFilename(); - -extern void qt_client_enqueue(const QWSEvent *); //qapplication_qws.cpp -extern QList *qt_get_server_queue(); - -Q_GLOBAL_STATIC_WITH_ARGS(QString, defaultMouse, (QLatin1String("Auto"))) -Q_GLOBAL_STATIC_WITH_ARGS(QString, defaultKeyboard, (QLatin1String("TTY"))) -static const int FontCleanupInterval = 60 * 1000; - -static int qws_keyModifiers = 0; - -static QWSWindow *keyboardGrabber; -static bool keyboardGrabbing; - -static int get_object_id(int count = 1) -{ - static int next=1000; - int n = next; - next += count; - return n; -} -#ifndef QT_NO_QWS_INPUTMETHODS -static QWSInputMethod *current_IM = 0; - -static QWSWindow *current_IM_composing_win = 0; -static int current_IM_winId = -1; -static bool force_reject_strokeIM = false; -#endif - -static void cleanupFontsDir(); - -//#define QWS_REGION_DEBUG - -/*! - \class QWSScreenSaver - \ingroup qws - - \brief The QWSScreenSaver class is a base class for screensavers - in Qt for Embedded Linux. - - When running \l{Qt for Embedded Linux} applications, it is the server - application that installs and controls the screensaver. - \l{Qt for Embedded Linux} supports multilevel screen saving; i.e., it is possible to - specify several different levels of screen responsiveness. For - example, you can choose to first turn off the light before you - fully activate the screensaver. - - Note that there exists no default screensaver implementation. - - To create a custom screensaver, derive from this class and - reimplement the restore() and save() functions. These functions - are called whenever the screensaver is activated or deactivated, - respectively. Once an instance of your custom screensaver is - created, you can use the QWSServer::setScreenSaver() function to - install it. - - \sa QWSServer, QScreen, {Qt for Embedded Linux} -*/ - -/*! - \fn QWSScreenSaver::~QWSScreenSaver() - - Reimplement this function to destroy the screensaver. -*/ - -/*! - \fn QWSScreenSaver::restore() - - Implement this function to deactivate the screensaver, restoring - the previously saved screen. - - \sa save(), QWSServer::screenSaverActivate() -*/ - -/*! - \fn QWSScreenSaver::save(int level) - - Implement this function to activate the screensaver, saving the - current screen. - - \l{Qt for Embedded Linux} supports multilevel screen saving; i.e., it is - possible to specify several different levels of screen - responsiveness. For example, you can choose to first turn off the - light before you fully activate the screensaver. Use the - QWSServer::setScreenSaverIntervals() to specify the time intervals - between the different levels. - - This function should return true if the screensaver successfully - enters the given \a level; otherwise it should return false. - - \sa restore(), QWSServer::screenSaverActivate() -*/ - -class QWSWindowPrivate -{ -public: - QWSWindowPrivate(); - -#ifdef QT_QWS_CLIENTBLIT - QRegion directPaintRegion; -#endif - QRegion allocatedRegion; -#ifndef QT_NO_QWSEMBEDWIDGET - QList embedded; - QWSWindow *embedder; -#endif - QWSWindow::State state; - Qt::WindowFlags windowFlags; - QRegion dirtyOnScreen; - bool painted; -}; - -QWSWindowPrivate::QWSWindowPrivate() - : -#ifndef QT_NO_QWSEMBEDWIDGET - embedder(0), state(QWSWindow::NoState), -#endif - painted(false) -{ -} - -/*! - \class QWSWindow - \ingroup qws - - \brief The QWSWindow class encapsulates a top-level window in - Qt for Embedded Linux. - - When you run a \l{Qt for Embedded Linux} application, it either runs as a - server or connects to an existing server. As applications add and - remove windows, the server process maintains information about - each window. In \l{Qt for Embedded Linux}, top-level windows are - encapsulated as QWSWindow objects. Note that you should never - construct the QWSWindow class yourself; the current top-level - windows can be retrieved using the QWSServer::clientWindows() - function. - - With a window at hand, you can retrieve its caption, name, opacity - and ID using the caption(), name(), opacity() and winId() - functions, respectively. Use the client() function to retrieve a - pointer to the client that owns the window. - - Use the isVisible() function to find out if the window is - visible. You can find out if the window is completely obscured by - another window or by the bounds of the screen, using the - isFullyObscured() function. The isOpaque() function returns true - if the window has an alpha channel equal to 255. Finally, the - requestedRegion() function returns the region of the display the - window wants to draw on. - - \sa QWSServer, QWSClient, {Qt for Embedded Linux Architecture} -*/ - -/*! - \fn int QWSWindow::winId() const - - Returns the window's ID. - - \sa name(), caption() -*/ - -/*! - \fn const QString &QWSWindow::name() const - - Returns the window's name, which is taken from the \l {QWidget::}{objectName()} - at the time of \l {QWidget::}{show()}. - - \sa caption(), winId() -*/ - -/*! - \fn const QString &QWSWindow::caption() const - - Returns the window's caption. - - \sa name(), winId() -*/ - -/*! - \fn QWSClient* QWSWindow::client() const - - Returns a reference to the QWSClient object that owns this window. - - \sa requestedRegion() -*/ - -/*! - \fn QRegion QWSWindow::requestedRegion() const - - Returns the region that the window has requested to draw onto, - including any window decorations. - - \sa client() -*/ - -/*! - \fn bool QWSWindow::isVisible() const - - Returns true if the window is visible; otherwise returns false. - - \sa isFullyObscured() -*/ - -/*! - \fn bool QWSWindow::isOpaque() const - - Returns true if the window is opaque, i.e., if its alpha channel - equals 255; otherwise returns false. - - \sa opacity() -*/ - -/*! - \fn uint QWSWindow::opacity () const - - Returns the window's alpha channel value. - - \sa isOpaque() -*/ - -/*! - \fn bool QWSWindow::isPartiallyObscured() const - \internal - - Returns true if the window is partially obsured by another window - or by the bounds of the screen; otherwise returns false. -*/ - -/*! - \fn bool QWSWindow::isFullyObscured() const - - Returns true if the window is completely obsured by another window - or by the bounds of the screen; otherwise returns false. - - \sa isVisible() -*/ - -/*! - \fn QWSWindowSurface* QWSWindow::windowSurface() const - \internal -*/ - -QWSWindow::QWSWindow(int i, QWSClient* client) - : id(i), modified(false), - onTop(false), c(client), last_focus_time(0), _opacity(255), - opaque(true), d(new QWSWindowPrivate) -{ - surface = 0; -} - - -/*! - \enum QWSWindow::State - - This enum describes the state of a window. Most of the - transitional states are set just before a call to - QScreen::exposeRegion() and reset immediately afterwards. - - \value NoState Initial state before the window is properly initialized. - \value Hidden The window is not visible. - \value Showing The window is being shown. - \value Visible The window is visible, and not in a transition. - \value Hiding The window is being hidden. - \value Raising The windoe is being raised. - \value Lowering The window is being raised. - \value Moving The window is being moved. - \value ChangingGeometry The window's geometry is being changed. - \value Destroyed The window is destroyed. - - \sa state(), QScreen::exposeRegion() -*/ - -/*! - Returns the current state of the window. - - \since 4.3 -*/ -QWSWindow::State QWSWindow::state() const -{ - return d->state; -} - -/*! - Returns the window flags of the window. This value is only available - after the first paint event. - - \since 4.3 -*/ -Qt::WindowFlags QWSWindow::windowFlags() const -{ - return d->windowFlags; -} - -/*! - Returns the region that has been repainted since the previous - QScreen::exposeRegion(), and needs to be copied to the screen. - \since 4.3 -*/ -QRegion QWSWindow::dirtyOnScreen() const -{ - return d->dirtyOnScreen; -} - -void QWSWindow::createSurface(const QString &key, const QByteArray &data) -{ -#ifndef QT_NO_QWS_MULTIPROCESS - if (surface && !surface->isBuffered()) - c->removeUnbufferedSurface(); -#endif - - delete surface; - surface = qt_screen->createSurface(key); - surface->setPermanentState(data); - -#ifndef QT_NO_QWS_MULTIPROCESS - if (!surface->isBuffered()) - c->addUnbufferedSurface(); -#endif -} - -/*! - \internal - Raises the window above all other windows except "Stay on top" windows. -*/ -void QWSWindow::raise() -{ - qwsServerPrivate->raiseWindow(this); -#ifndef QT_NO_QWSEMBEDWIDGET - const int n = d->embedded.size(); - for (int i = 0; i < n; ++i) - d->embedded.at(i)->raise(); -#endif -} - -/*! - \internal - Lowers the window below other windows. -*/ -void QWSWindow::lower() -{ - qwsServerPrivate->lowerWindow(this); -#ifndef QT_NO_QWSEMBEDWIDGET - const int n = d->embedded.size(); - for (int i = 0; i < n; ++i) - d->embedded.at(i)->lower(); -#endif -} - -/*! - \internal - Shows the window. -*/ -void QWSWindow::show() -{ - operation(QWSWindowOperationEvent::Show); -#ifndef QT_NO_QWSEMBEDWIDGET - const int n = d->embedded.size(); - for (int i = 0; i < n; ++i) - d->embedded.at(i)->show(); -#endif -} - -/*! - \internal - Hides the window. -*/ -void QWSWindow::hide() -{ - operation(QWSWindowOperationEvent::Hide); -#ifndef QT_NO_QWSEMBEDWIDGET - const int n = d->embedded.size(); - for (int i = 0; i < n; ++i) - d->embedded.at(i)->hide(); -#endif -} - -/*! - \internal - Make this the active window (i.e., sets the keyboard focus to this - window). -*/ -void QWSWindow::setActiveWindow() -{ - qwsServerPrivate->setFocus(this, true); -#ifndef QT_NO_QWSEMBEDWIDGET - const int n = d->embedded.size(); - for (int i = 0; i < n; ++i) - d->embedded.at(i)->setActiveWindow(); -#endif -} - -void QWSWindow::setName(const QString &n) -{ - rgnName = n; -} - -/*! - \internal - Sets the window's caption to \a c. -*/ -void QWSWindow::setCaption(const QString &c) -{ - rgnCaption = c; -} - - -static int global_focus_time_counter=100; - -void QWSWindow::focus(bool get) -{ - if (get) - last_focus_time = global_focus_time_counter++; - if (c) { - QWSFocusEvent event; - event.simpleData.window = id; - event.simpleData.get_focus = get; - c->sendEvent(&event); - } -} - -void QWSWindow::operation(QWSWindowOperationEvent::Operation o) -{ - if (!c) - return; - QWSWindowOperationEvent event; - event.simpleData.window = id; - event.simpleData.op = o; - c->sendEvent(&event); -} - -/*! - \internal - Destructor. -*/ -QWSWindow::~QWSWindow() -{ -#ifndef QT_NO_QWS_INPUTMETHODS - if (current_IM_composing_win == this) - current_IM_composing_win = 0; -#endif -#ifndef QT_NO_QWSEMBEDWIDGET - QWSWindow *embedder = d->embedder; - if (embedder) { - embedder->d->embedded.removeAll(this); - d->embedder = 0; - } - while (!d->embedded.isEmpty()) - stopEmbed(d->embedded.first()); -#endif - -#ifndef QT_NO_QWS_MULTIPROCESS - if (surface && !surface->isBuffered()) { - if (c && c->d_func()) // d_func() will be 0 if client is deleted - c->removeUnbufferedSurface(); - } -#endif - - delete surface; - delete d; -} - -/*! - \internal - - Returns the region that the window is allowed to draw onto, - including any window decorations but excluding regions covered by - other windows. - - \sa paintedRegion(), requestedRegion() -*/ -QRegion QWSWindow::allocatedRegion() const -{ - return d->allocatedRegion; -} - -#ifdef QT_QWS_CLIENTBLIT -QRegion QWSWindow::directPaintRegion() const -{ - return d->directPaintRegion; -} - -inline void QWSWindow::setDirectPaintRegion(const QRegion &r) -{ - d->directPaintRegion = r; -} -#endif - -/*! - \internal - - Returns the region that the window is known to have drawn into. - - \sa allocatedRegion(), requestedRegion() -*/ -QRegion QWSWindow::paintedRegion() const -{ - return (d->painted ? d->allocatedRegion : QRegion()); -} - -inline void QWSWindow::setAllocatedRegion(const QRegion ®ion) -{ - d->allocatedRegion = region; -} - -#ifndef QT_NO_QWSEMBEDWIDGET -inline void QWSWindow::startEmbed(QWSWindow *w) -{ - d->embedded.append(w); - w->d->embedder = this; -} - -inline void QWSWindow::stopEmbed(QWSWindow *w) -{ - w->d->embedder = 0; - w->client()->sendEmbedEvent(w->winId(), QWSEmbedEvent::Region, QRegion()); - d->embedded.removeAll(w); -} -#endif // QT_NO_QWSEMBEDWIDGET - -/********************************************************************* - * - * Class: QWSClient - * - *********************************************************************/ - -class QWSClientPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QWSClient) - -public: - QWSClientPrivate(); - ~QWSClientPrivate(); - - void setLockId(int id); - void unlockCommunication(); - -private: -#ifndef QT_NO_QWS_MULTIPROCESS - QWSLock *clientLock; - bool shutdown; - int numUnbufferedSurfaces; -#endif - QSet usedFonts; - friend class QWSServerPrivate; -}; - -QWSClientPrivate::QWSClientPrivate() -{ -#ifndef QT_NO_QWS_MULTIPROCESS - clientLock = 0; - shutdown = false; - numUnbufferedSurfaces = 0; -#endif -} - -QWSClientPrivate::~QWSClientPrivate() -{ -#ifndef QT_NO_QWS_MULTIPROCESS - delete clientLock; -#endif -} - -void QWSClientPrivate::setLockId(int id) -{ -#ifdef QT_NO_QWS_MULTIPROCESS - Q_UNUSED(id); -#else - clientLock = new QWSLock(id); -#endif -} - -void QWSClientPrivate::unlockCommunication() -{ -#ifndef QT_NO_QWS_MULTIPROCESS - if (clientLock) - clientLock->unlock(QWSLock::Communication); -#endif -} - -/*! - \class QWSClient - \ingroup qws - - \brief The QWSClient class encapsulates a client process in Qt for Embedded Linux. - - When you run a \l{Qt for Embedded Linux} application, it either runs as a - server or connects to an existing server. The server and client - processes have different responsibilities: The client process - performs all application specific operations. The server process - is responsible for managing the clients as well as taking care of - the pointer handling, character input, and screen output. In - addition, the server provides functionality to handle input - methods. - - As applications add and remove windows, the server process - maintains information about each window. In \l{Qt for Embedded Linux}, - top-level windows are encapsulated as QWSWindow objects. A list of - the current windows can be retrieved using the - QWSServer::clientWindows() function, and each window can tell - which client that owns it through its QWSWindow::client() - function. - - A QWSClient object has an unique ID that can be retrieved using - its clientId() function. QWSClient also provides the identity() - function which typically returns the name of this client's running - application. - - \sa QWSServer, QWSWindow, {Qt for Embedded Linux Architecture} -*/ - -/*! - \internal -*/ -//always use frame buffer -QWSClient::QWSClient(QObject* parent, QWS_SOCK_BASE* sock, int id) - : QObject(*new QWSClientPrivate, parent), command(0), cid(id) -{ -#ifdef QT_NO_QWS_MULTIPROCESS - Q_UNUSED(sock); - isClosed = false; -#else - csocket = 0; - if (!sock) { - socketDescriptor = -1; - isClosed = false; - } else { - csocket = static_cast(sock); //### - isClosed = false; - - csocket->flush(); - socketDescriptor = csocket->socketDescriptor(); - connect(csocket, SIGNAL(readyRead()), this, SIGNAL(readyRead())); - connect(csocket, SIGNAL(disconnected()), this, SLOT(closeHandler())); - connect(csocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(errorHandler())); - } -#endif //QT_NO_QWS_MULTIPROCESS -} - -/*! - \internal -*/ -QWSClient::~QWSClient() -{ - qDeleteAll(cursors); - delete command; -#ifndef QT_NO_QWS_MULTIPROCESS - delete csocket; -#endif -} - -#ifndef QT_NO_QWS_MULTIPROCESS -void QWSClient::removeUnbufferedSurface() -{ - Q_D(QWSClient); - --d->numUnbufferedSurfaces; -} - -void QWSClient::addUnbufferedSurface() -{ - Q_D(QWSClient); - ++d->numUnbufferedSurfaces; -} -#endif // QT_NO_QWS_MULTIPROCESS - -/*! - \internal -*/ -void QWSClient::setIdentity(const QString& i) -{ - id = i; -} - -void QWSClient::closeHandler() -{ - isClosed = true; - emit connectionClosed(); -} - -void QWSClient::errorHandler() -{ -#if defined(QWS_SOCKET_DEBUG) - qDebug("Client %p error %s", this, csocket ? csocket->errorString().toLatin1().constData() : "(no socket)"); -#endif - isClosed = true; -//####Do we need to clean out the pipes? - - emit connectionClosed(); -} - -/*! - \internal -*/ -int QWSClient::socket() const -{ - return socketDescriptor; -} - -/*! - \internal -*/ -void QWSClient::sendEvent(QWSEvent* event) -{ -#ifndef QT_NO_QWS_MULTIPROCESS - if (csocket) { - // qDebug() << "QWSClient::sendEvent type " << event->type << " socket state " << csocket->state(); - if ((QAbstractSocket::SocketState)(csocket->state()) == QAbstractSocket::ConnectedState) { - event->write(csocket); - } - } - else -#endif - { - qt_client_enqueue(event); - } -} - -/*! - \internal -*/ -void QWSClient::sendRegionEvent(int winid, QRegion rgn, int type -#ifdef QT_QWS_CLIENTBLIT - , int id -#endif - ) -{ -#ifndef QT_NO_QWS_MULTIPROCESS - Q_D(QWSClient); - if (d->clientLock) - d->clientLock->lock(QWSLock::RegionEvent); -#endif - - QWSRegionEvent event; - event.setData(winid, rgn, type); -#ifdef QT_QWS_CLIENTBLIT - event.simpleData.id = id; -#endif - -// qDebug() << "Sending Region event to" << winid << "rgn" << rgn << "type" << type; - - sendEvent(&event); -} - -extern int qt_servershmid; - -/*! - \internal -*/ -void QWSClient::sendConnectedEvent(const char *display_spec) -{ - QWSConnectedEvent event; - event.simpleData.window = 0; - event.simpleData.len = strlen(display_spec) + 1; - event.simpleData.clientId = cid; - event.simpleData.servershmid = qt_servershmid; - char * tmp=(char *)display_spec; - event.setData(tmp, event.simpleData.len); - sendEvent(&event); -} - -/*! - \internal -*/ -void QWSClient::sendMaxWindowRectEvent(const QRect &rect) -{ - QWSMaxWindowRectEvent event; - event.simpleData.window = 0; - event.simpleData.rect = rect; - sendEvent(&event); -} - -/*! - \internal -*/ -#ifndef QT_NO_QWS_PROPERTIES -void QWSClient::sendPropertyNotifyEvent(int property, int state) -{ - QWSPropertyNotifyEvent event; - event.simpleData.window = 0; // not used yet - event.simpleData.property = property; - event.simpleData.state = state; - sendEvent(&event); -} - -/*! - \internal -*/ -void QWSClient::sendPropertyReplyEvent(int property, int len, const char *data) -{ - QWSPropertyReplyEvent event; - event.simpleData.window = 0; // not used yet - event.simpleData.property = property; - event.simpleData.len = len; - event.setData(data, len); - sendEvent(&event); -} -#endif //QT_NO_QWS_PROPERTIES - -/*! - \internal -*/ -void QWSClient::sendSelectionClearEvent(int windowid) -{ - QWSSelectionClearEvent event; - event.simpleData.window = windowid; - sendEvent(&event); -} - -/*! - \internal -*/ -void QWSClient::sendSelectionRequestEvent(QWSConvertSelectionCommand *cmd, int windowid) -{ - QWSSelectionRequestEvent event; - event.simpleData.window = windowid; - event.simpleData.requestor = cmd->simpleData.requestor; - event.simpleData.property = cmd->simpleData.selection; - event.simpleData.mimeTypes = cmd->simpleData.mimeTypes; - sendEvent(&event); -} - -#ifndef QT_NO_QWSEMBEDWIDGET -/*! - \internal -*/ -void QWSClient::sendEmbedEvent(int windowid, QWSEmbedEvent::Type type, - const QRegion ®ion) -{ - QWSEmbedEvent event; - event.setData(windowid, type, region); - sendEvent(&event); -} -#endif // QT_NO_QWSEMBEDWIDGET - -/*! - \fn void QWSClient::connectionClosed() - \internal -*/ - -/*! - \fn void QWSClient::readyRead(); - \internal -*/ - -/*! - \fn int QWSClient::clientId () const - - Returns an integer uniquely identfying this client. -*/ - -/*! - \fn QString QWSClient::identity () const - - Returns the name of this client's running application. -*/ -/********************************************************************* - * - * Class: QWSServer - * - *********************************************************************/ - -/*! - \class QWSServer - \brief The QWSServer class encapsulates a server process in Qt for Embedded Linux. - - \ingroup qws - - When you run a \l{Qt for Embedded Linux} application, it either runs as a - server or connects to an existing server. The server and client - processes have different responsibilities: The client process - performs all application specific operations. The server process - is responsible for managing the clients as well as taking care of - the pointer handling, character input, and screen output. In - addition, the server provides functionality to handle input - methods. - - In \l{Qt for Embedded Linux}, all system generated events are passed to the - server application which then propagates the event to the - appropriate client. See the \l{Qt for Embedded Linux Architecture} - documentation for details. - - Note that this class is instantiated by QApplication for - \l{Qt for Embedded Linux} server processes; you should never construct this - class yourself. Use the instance() function to retrieve a pointer - to the server object. - - Note that the static functions of the QWSServer class can only be - used in the server process. - - \tableofcontents - - \section1 Client Administration - - As applications add and remove windows, the server process - maintains information about each window. In \l{Qt for Embedded Linux}, - top-level windows are encapsulated as QWSWindow objects. Each - window can tell which client that owns it through its - QWSWindow::client() function. Use the clientWindows() function to - retrieve a list of the current top-level windows. Given a - particular position on the display, the window containing it can - be retrieved using the windowAt() function. - - QWSServer also provides the windowEvent() signal which is emitted - whenever something happens to a top level window; the WindowEvent - enum describes the various types of events that the signal - recognizes. In addition, the server class provides the - markedText() signal which is emitted whenever some text has been - selected in any of the windows, passing the selection as - parameter. - - The QCopChannel class and the QCOP communication protocol enable - transfer of messages between clients. QWSServer provides the - newChannel() and removedChannel() signals that is emitted whenever - a new QCopChannel object is created or destroyed, respectively. - - See also: QWSWindow, QWSClient and QCopChannel. - - - \section1 Mouse Handling - - The mouse driver (represented by an instance of the - QWSMouseHandler class) is loaded by the server application when it - starts running, using Qt's \l {How to Create Qt Plugins}{plugin - system}. A mouse driver receives mouse events from the device and - encapsulates each event with an instance of the QWSEvent class - which it then passes to the server. - - The openMouse() function opens the mouse devices specified by the - QWS_MOUSE_PROTO environment variable, and the setMouseHandler() - functions sets the primary mouse driver. Alternatively, the static - setDefaultMouse() function provides means of specifying the mouse - driver to use if the QWS_MOUSE_PROTO variable is not defined (note - that the default is otherwise platform dependent). The primary - mouse driver can be retrieved using the static mouseHandler() - function. Use the closeMouse() function to delete the mouse - drivers. - - In addition, the QWSServer class can control the flow of mouse - input using the suspendMouse() and resumeMouse() functions. - - See also: QWSMouseHandler and \l{Qt for Embedded Linux Pointer Handling}. - - \section1 Keyboard Handling - - The keyboard driver (represented by an instance of the - QWSKeyboardHandler class) is loaded by the server application when - it starts running, using Qt's \l {How to Create Qt Plugins}{plugin - system}. A keyboard driver receives keyboard events from the - device and encapsulates each event with an instance of the - QWSEvent class which it then passes to the server. - - The openKeyboard() function opens the keyboard devices specified - by the QWS_KEYBOARD environment variable, and the - setKeyboardHandler() functions sets the primary keyboard - driver. Alternatively, the static setDefaultKeyboard() function - provides means of specifying the keyboard driver to use if the - QWS_KEYBOARD variable is not defined (note again that the default - is otherwise platform dependent). The primary keyboard driver can - be retrieved using the static keyboardHandler() function. Use the - closeKeyboard() function to delete the keyboard drivers. - - In addition, the QWSServer class can handle key events from both - physical and virtual keyboards using the processKeyEvent() and - sendKeyEvent() functions, respectively. Use the - addKeyboardFilter() function to filter the key events from - physical keyboard drivers, the most recently added filter can be - removed and deleted using the removeKeyboardFilter() function. - - See also: QWSKeyboardHandler and \l{Qt for Embedded Linux Character Input}. - - \section1 Display Handling - - When a screen update is required, the server runs through all the - top-level windows that intersect with the region that is about to - be updated, and ensures that the associated clients have updated - their memory buffer. Then the server uses the screen driver - (represented by an instance of the QScreen class) to copy the - content of the memory to the screen. - - In addition, the QWSServer class provides some means of managing - the screen output: Use the refresh() function to refresh the - entire display, or alternatively a specified region of it. The - enablePainting() function can be used to disable (and enable) - painting onto the screen. QWSServer also provide the - setMaxWindowRect() function restricting the area of the screen - which \l{Qt for Embedded Linux} applications will consider to be the - maximum area to use for windows. To set the brush used as the - background in the absence of obscuring windows, QWSServer provides - the static setBackground() function. The corresponding - backgroundBrush() function returns the currently set brush. - - QWSServer also controls the screen saver: Use the setScreenSaver() - to install a custom screen saver derived from the QWSScreenSaver - class. Once installed, the screensaver can be activated using the - screenSaverActivate() function, and the screenSaverActive() - function returns its current status. Use the - setScreenSaverInterval() function to specify the timeout interval. - \l{Qt for Embedded Linux} also supports multilevel screen saving, use the - setScreenSaverIntervals() function to specify the various levels - and their timeout intervals. - - Finally, the QWSServer class controls the cursor's appearance, - i.e., use the setCursorVisible() function to hide or show the - cursor, and the isCursorVisible() function to determine whether - the cursor is visible on the display or not. - - See also: QScreen and \l{Qt for Embedded Linux Display Management}. - - \section1 Input Method Handling - - Whenever the server receives an event, it queries its stack of - top-level windows to find the window containing the event's - position (each window can identify the client application that - created it). Then the server forwards the event to the appropriate - client. If an input method is installed, it is used as a filter - between the server and the client application. - - Derive from the QWSInputMethod class to create custom input - methods, and use the server's setCurrentInputMethod() function to - install it. Use the sendIMEvent() and sendIMQuery() functions to - send input method events and queries. - - QWSServer provides the IMMouse enum describing the various mouse - events recognized by the QWSInputMethod::mouseHandler() - function. The latter function allows subclasses of QWSInputMethod - to handle mouse events within the preedit text. - - \sa QWSInputMethod -*/ - -/*! - \enum QWSServer::IMState - \obsolete - - This enum describes the various states of an input method. - - \value IMCompose Composing. - \value IMStart Equivalent to IMCompose. - \value IMEnd Finished composing. - - \sa QWSInputMethod::sendIMEvent() -*/ - -/*! - \enum QWSServer::IMMouse - - This enum describes the various types of mouse events recognized - by the QWSInputMethod::mouseHandler() function. - - \value MousePress An event generated by pressing a mouse button. - \value MouseRelease An event generated by relasing a mouse button. - \value MouseMove An event generated by moving the mouse cursor. - \value MouseOutside This value is only reserved, i.e., it is not used in - current implementations. - - \sa QWSInputMethod, setCurrentInputMethod() -*/ - -/*! - \enum QWSServer::ServerFlags - \internal - - This enum is used to pass various options to the window system - server. - - \value DisableKeyboard Ignore all keyboard input. - \value DisableMouse Ignore all mouse input. -*/ - -/*! - \enum QWSServer::WindowEvent - - This enum specifies the various events that can occur in a - top-level window. - - \value Create A new window has been created (by the QWidget constructor). - \value Destroy The window has been closed and deleted (by the QWidget destructor). - \value Hide The window has been hidden using the QWidget::hide() function. - \value Show The window has been shown using the QWidget::show() function or similar. - \value Raise The window has been raised to the top of the desktop. - \value Lower The window has been lowered. - \value Geometry The window has changed size or position. - \value Active The window has become the active window (i.e., it has keyboard focus). - \value Name The window has been named. - - \sa windowEvent() -*/ - -/*! - \fn void QWSServer::markedText(const QString &selection) - - This signal is emitted whenever some text is selected in any of - the running applications, passing the selected text in the \a - selection parameter. - - \sa windowEvent() -*/ - -/*! - \fn const QList &QWSServer::clientWindows() - - Returns the list of current top-level windows. - - Note that the collection of top-level windows changes as - applications add and remove widgets so it should not be stored for - future use. The windows are sorted in stacking order from top-most - to bottom-most. - - Use the QWSWindow::client() function to retrieve the client - application that owns a given window. - - \sa windowAt(), instance() -*/ - -/*! - \fn void QWSServer::newChannel(const QString& channel) - - This signal is emitted whenever a new QCopChannel object is - created, passing the channel's name in the \a channel parameter. - - \sa removedChannel() -*/ - -/*! - \fn void QWSServer::removedChannel(const QString& channel) - - This signal is emitted immediately after the given the QCopChannel - object specified by \a channel, is destroyed. - - Note that a channel is not destroyed until all its listeners have - been unregistered. - - \sa newChannel() -*/ - -/*! - \fn QWSServer::QWSServer(int flags, QObject *parent) - \internal - - Construct a QWSServer object with the given \a parent. The \a - flags are used for keyboard and mouse settings. - - \warning This class is instantiated by QApplication for - \l{Qt for Embedded Linux} server processes. You should never construct - this class yourself. - - \sa {Running Applications} -*/ - -/*! - \fn static QWSServer* QWSServer::instance() - \since 4.2 - - Returns a pointer to the server instance. - - Note that the pointer will be 0 if the application is not the - server, i.e., if the QApplication::type() function doesn't return - QApplication::GuiServer. - - \sa clientWindows(), windowAt() -*/ - -struct QWSCommandStruct -{ - QWSCommandStruct(QWSCommand *c, QWSClient *cl) :command(c),client(cl){} - ~QWSCommandStruct() { delete command; } - - QWSCommand *command; - QWSClient *client; - -}; - -QWSServer::QWSServer(int flags, QObject *parent) : - QObject(*new QWSServerPrivate, parent) -{ - Q_D(QWSServer); - QT_TRY { - d->initServer(flags); - } QT_CATCH(...) { - qwsServer = 0; - qwsServerPrivate = 0; - QT_RETHROW; - } -} - -#ifdef QT3_SUPPORT -/*! - Use the two-argument overload and call the - QObject::setObjectName() function instead. -*/ -QWSServer::QWSServer(int flags, QObject *parent, const char *name) : - QObject(*new QWSServerPrivate, parent) -{ - Q_D(QWSServer); - setObjectName(QString::fromAscii(name)); - d->initServer(flags); -} -#endif - - -#ifndef QT_NO_QWS_MULTIPROCESS -static void ignoreSignal(int) {} // Used to eat SIGPIPE signals below -#endif - -bool QWSServerPrivate::screensaverblockevent( int index, int *screensaverinterval, bool isDown ) -{ - static bool ignoreEvents[2] = { false, false }; - if ( isDown ) { - if ( !ignoreEvents[index] ) { - bool wake = false; - if ( screensaverintervals ) { - if ( screensaverinterval != screensaverintervals ) { - wake = true; - } - } - if ( screensaverblockevents && wake ) { -#ifdef EVENT_BLOCK_DEBUG - qDebug( "waking the screen" ); -#endif - ignoreEvents[index] = true; - } else if ( !screensaverblockevents ) { -#ifdef EVENT_BLOCK_DEBUG - qDebug( "the screen was already awake" ); -#endif - ignoreEvents[index] = false; - } - } - } else { - if ( ignoreEvents[index] ) { -#ifdef EVENT_BLOCK_DEBUG - qDebug( "mouseup?" ); -#endif - ignoreEvents[index] = false; - return true; - } - } - return ignoreEvents[index]; -} - -void QWSServerPrivate::initServer(int flags) -{ - Q_Q(QWSServer); - Q_ASSERT(!qwsServer); - qwsServer = q; - qwsServerPrivate = this; - disablePainting = false; -#ifndef QT_NO_QWS_MULTIPROCESS - ssocket = new QWSServerSocket(qws_qtePipeFilename(), q); - QObject::connect(ssocket, SIGNAL(newConnection()), q, SLOT(_q_newConnection())); - - if ( !ssocket->isListening()) { - perror("QWSServerPrivate::initServer: server socket not listening"); - qFatal("Failed to bind to %s", qws_qtePipeFilename().toLatin1().constData()); - } - - struct linger tmp; - tmp.l_onoff=1; - tmp.l_linger=0; - setsockopt(ssocket->socketDescriptor(),SOL_SOCKET,SO_LINGER,(char *)&tmp,sizeof(tmp)); - - - signal(SIGPIPE, ignoreSignal); //we get it when we read -#endif - focusw = 0; - mouseGrabber = 0; - mouseGrabbing = false; - inputMethodMouseGrabbed = false; - keyboardGrabber = 0; - keyboardGrabbing = false; -#ifndef QT_NO_QWS_CURSOR - haveviscurs = false; - cursor = 0; - nextCursor = 0; -#endif - -#ifndef QT_NO_QWS_MULTIPROCESS - - if (!geteuid()) { -#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE) - if(mount(0,"/var/shm", "shm", 0, 0)) { - /* This just confuses people with 2.2 kernels - if (errno != EBUSY) - qDebug("Failed mounting shm fs on /var/shm: %s",strerror(errno)); - */ - } -#endif - } -#endif - - // no selection yet - selectionOwner.windowid = -1; - selectionOwner.time.set(-1, -1, -1, -1); - - cleanupFontsDir(); - - // initialize the font database - // from qfontdatabase_qws.cpp - extern void qt_qws_init_fontdb(); - qt_qws_init_fontdb(); - - openDisplay(); - - screensavertimer = new QTimer(q); - screensavertimer->setSingleShot(true); - QObject::connect(screensavertimer, SIGNAL(timeout()), q, SLOT(_q_screenSaverTimeout())); - _q_screenSaverWake(); - - clientMap[-1] = new QWSClient(q, 0, 0); - - if (!bgBrush) - bgBrush = new QBrush(QColor(0x20, 0xb0, 0x50)); - - initializeCursor(); - - // input devices - if (!(flags&QWSServer::DisableMouse)) { - q->openMouse(); - } -#ifndef QT_NO_QWS_KEYBOARD - if (!(flags&QWSServer::DisableKeyboard)) { - q->openKeyboard(); - } -#endif - -#if !defined(QT_NO_SOUND) && !defined(QT_EXTERNAL_SOUND_SERVER) && !defined(Q_OS_DARWIN) - soundserver = new QWSSoundServer(q); -#endif -} - -/*! - \internal - Destructs this server. -*/ -QWSServer::~QWSServer() -{ - closeMouse(); -#ifndef QT_NO_QWS_KEYBOARD - closeKeyboard(); -#endif - d_func()->cleanupFonts(/*force =*/true); -} - -/*! - \internal - */ -void QWSServer::timerEvent(QTimerEvent *e) -{ - Q_D(QWSServer); - if (e->timerId() == d->fontCleanupTimer.timerId()) { - d->cleanupFonts(); - d->fontCleanupTimer.stop(); - } else { - QObject::timerEvent(e); - } -} - -const QList &QWSServer::clientWindows() -{ - Q_D(QWSServer); - return d->windows; -} - -/*! - \internal -*/ -void QWSServerPrivate::releaseMouse(QWSWindow* w) -{ - if (w && mouseGrabber == w) { - mouseGrabber = 0; - mouseGrabbing = false; -#ifndef QT_NO_QWS_CURSOR - if (nextCursor) { - // Not grabbing -> set the correct cursor - setCursor(nextCursor); - nextCursor = 0; - } -#endif - } -} - -/*! - \internal -*/ -void QWSServerPrivate::releaseKeyboard(QWSWindow* w) -{ - if (keyboardGrabber == w) { - keyboardGrabber = 0; - keyboardGrabbing = false; - } -} - -void QWSServerPrivate::handleWindowClose(QWSWindow *w) -{ - w->shuttingDown(); - if (focusw == w) - setFocus(w,false); - if (mouseGrabber == w) - releaseMouse(w); - if (keyboardGrabber == w) - releaseKeyboard(w); -} - - -#ifndef QT_NO_QWS_MULTIPROCESS -/*! - \internal -*/ -void QWSServerPrivate::_q_newConnection() -{ - Q_Q(QWSServer); - while (QWS_SOCK_BASE *sock = ssocket->nextPendingConnection()) { - int socket = sock->socketDescriptor(); - sock->setParent(0); - - QWSClient *client = new QWSClient(q,sock, get_object_id()); - clientMap[socket] = client; - -#ifndef QT_NO_SXE -#ifdef QTRANSPORTAUTH_DEBUG - qDebug( "Transport auth connected: unix stream socket %d", socket ); -#endif - // get a handle to the per-process authentication service - QTransportAuth *a = QTransportAuth::getInstance(); - - // assert that this transport is trusted - QTransportAuth::Data *d = a->connectTransport( - QTransportAuth::UnixStreamSock | - QTransportAuth::Trusted, socket ); - - QAuthDevice *ad = a->recvBuf( d, sock ); - ad->setClient(client); - - QObject::connect(ad, SIGNAL(readyRead()), - q, SLOT(_q_doClient())); - - QObject::connect(client, SIGNAL(connectionClosed()), - q, SLOT(_q_clientClosed())); -#else - QObject::connect(client, SIGNAL(readyRead()), - q, SLOT(_q_doClient())); - QObject::connect(client, SIGNAL(connectionClosed()), - q, SLOT(_q_clientClosed())); -#endif // QT_NO_SXE - - client->sendConnectedEvent(qws_display_spec.constData()); - - if (clientMap.contains(socket)) { - QList screens = qt_screen->subScreens(); - if (screens.isEmpty()) - screens.append(qt_screen); - for (int i = 0; i < screens.size(); ++i) { - const QApplicationPrivate *ap = QApplicationPrivate::instance(); - QScreen *screen = screens.at(i); - const QRect rect = ap->maxWindowRect(screen); - if (!rect.isEmpty()) - client->sendMaxWindowRectEvent(rect); - if (screen->isTransformed()) { - QWSScreenTransformationEvent event; - event.simpleData.screen = i; - event.simpleData.transformation = screen->transformOrientation(); - client->sendEvent(&event); - } - } - } - - // pre-provide some object id's - QWSCreateCommand cmd(30); - invokeCreate(&cmd, client); - } -} -/*! - \internal -*/ -void QWSServerPrivate::_q_clientClosed() -{ - Q_Q(QWSServer); - QWSClient* cl = (QWSClient*)q->sender(); - - // Remove any queued commands for this client - int i = 0; - while (i < commandQueue.size()) { - QWSCommandStruct *cs = commandQueue.at(i); - if (cs->client == cl) { - commandQueue.removeAt(i); - delete cs; - } else { - ++i; - } - } - -#ifndef QT_NO_COP - // Enfore unsubscription from all channels. - QCopChannel::detach(cl); -#endif - - // Shut down all windows for this client - for (int i = 0; i < windows.size(); ++i) { - QWSWindow* w = windows.at(i); - if (w->forClient(cl)) - w->shuttingDown(); - } - - // Delete all windows for this client - QRegion exposed; - i = 0; - while (i < windows.size()) { - QWSWindow* w = windows.at(i); - if (w->forClient(cl)) { - windows.takeAt(i); - w->c = 0; //so we don't send events to it anymore - releaseMouse(w); - releaseKeyboard(w); - exposed += w->allocatedRegion(); -// rgnMan->remove(w->allocationIndex()); - if (focusw == w) - setFocus(focusw,0); - if (mouseGrabber == w) - releaseMouse(w); - if (i < nReserved) - --nReserved; -#ifndef QT_NO_QWS_PROPERTIES - propertyManager.removeProperties(w->winId()); -#endif - emit q->windowEvent(w, QWSServer::Destroy); - w->d->state = QWSWindow::Destroyed; //??? - deletedWindows.append(w); - } else { - ++i; - } - } - if (deletedWindows.count()) - QTimer::singleShot(0, q, SLOT(_q_deleteWindowsLater())); - - QWSClientPrivate *clientPrivate = cl->d_func(); - if (!clientPrivate->shutdown) { -#if defined(QWS_DEBUG_FONTCLEANUP) - qDebug() << "client" << cl->clientId() << "crashed"; -#endif - // this would be the place to emit a signal to notify about the - // crash of a client - crashedClientIds.append(cl->clientId()); - fontCleanupTimer.start(10, q_func()); - } - clientPrivate->shutdown = true; - - while (!clientPrivate->usedFonts.isEmpty()) { - const QByteArray font = *clientPrivate->usedFonts.begin(); -#if defined(QWS_DEBUG_FONTCLEANUP) - qDebug() << "dereferencing font" << font << "from disconnected client"; -#endif - dereferenceFont(clientPrivate, font); - } - clientPrivate->usedFonts.clear(); - - //qDebug("removing client %d with socket %d", cl->clientId(), cl->socket()); - clientMap.remove(cl->socket()); - if (cl == cursorClient) - cursorClient = 0; - if (qt_screen->clearCacheFunc) - (qt_screen->clearCacheFunc)(qt_screen, cl->clientId()); // remove any remaining cache entries. - cl->deleteLater(); - - update_regions(); - exposeRegion(exposed); -} - -void QWSServerPrivate::_q_deleteWindowsLater() -{ - qDeleteAll(deletedWindows); - deletedWindows.clear(); -} - -#endif //QT_NO_QWS_MULTIPROCESS - -void QWSServerPrivate::referenceFont(QWSClientPrivate *client, const QByteArray &font) -{ - if (!client->usedFonts.contains(font)) { - client->usedFonts.insert(font); - - ++fontReferenceCount[font]; -#if defined(QWS_DEBUG_FONTCLEANUP) - qDebug() << "Client" << client->q_func()->clientId() << "added font" << font; - qDebug() << "Refcount is" << fontReferenceCount[font]; -#endif - } -} - -void QWSServerPrivate::dereferenceFont(QWSClientPrivate *client, const QByteArray &font) -{ - if (client->usedFonts.contains(font)) { - client->usedFonts.remove(font); - - Q_ASSERT(fontReferenceCount[font]); - if (!--fontReferenceCount[font] && !fontCleanupTimer.isActive()) - fontCleanupTimer.start(FontCleanupInterval, q_func()); - -#if defined(QWS_DEBUG_FONTCLEANUP) - qDebug() << "Client" << client->q_func()->clientId() << "removed font" << font; - qDebug() << "Refcount is" << fontReferenceCount[font]; -#endif - } -} - -static void cleanupFontsDir() -{ - static bool dontDelete = !qgetenv("QWS_KEEP_FONTS").isEmpty(); - if (dontDelete) - return; - - extern QString qws_fontCacheDir(); - QDir dir(qws_fontCacheDir(), QLatin1String("*.qsf")); - for (uint i = 0; i < dir.count(); ++i) { -#if defined(QWS_DEBUG_FONTCLEANUP) - qDebug() << "removing stale font file" << dir[i]; -#endif - dir.remove(dir[i]); - } -} - -void QWSServerPrivate::cleanupFonts(bool force) -{ - static bool dontDelete = !qgetenv("QWS_KEEP_FONTS").isEmpty(); - if (dontDelete) - return; - -#if defined(QWS_DEBUG_FONTCLEANUP) - qDebug() << "cleanupFonts()"; -#endif - if (!fontReferenceCount.isEmpty()) { - QMap::Iterator it = fontReferenceCount.begin(); - while (it != fontReferenceCount.end()) { - if (it.value() && !force) { - ++it; - continue; - } - - const QByteArray &fontName = it.key(); -#if defined(QWS_DEBUG_FONTCLEANUP) - qDebug() << "removing unused font file" << fontName; -#endif - QT_TRY { - QFile::remove(QFile::decodeName(fontName)); - sendFontRemovedEvent(fontName); - - it = fontReferenceCount.erase(it); - } QT_CATCH(...) { - // so we were not able to remove the font. - // don't be angry and just continue with the next ones. - ++it; - } - } - } - - if (crashedClientIds.isEmpty()) - return; - - QList removedFonts; -#if !defined(QT_NO_QWS_QPF2) && !defined(QT_FONTS_ARE_RESOURCES) - removedFonts = QFontEngineQPF::cleanUpAfterClientCrash(crashedClientIds); -#endif - crashedClientIds.clear(); - - for (int i = 0; i < removedFonts.count(); ++i) - sendFontRemovedEvent(removedFonts.at(i)); -} - -void QWSServerPrivate::sendFontRemovedEvent(const QByteArray &font) -{ - QWSFontEvent event; - event.simpleData.type = QWSFontEvent::FontRemoved; - event.setData(font.constData(), font.length(), false); - - QMap::const_iterator it = clientMap.constBegin(); - for (; it != clientMap.constEnd(); ++it) - (*it)->sendEvent(&event); -} - -/*! - \internal -*/ -QWSCommand* QWSClient::readMoreCommand() -{ -#ifndef QT_NO_QWS_MULTIPROCESS - QIODevice *socket = 0; -#endif -#ifndef QT_NO_SXE - if (socketDescriptor != -1) // not server socket - socket = QTransportAuth::getInstance()->passThroughByClient( this ); -#if QTRANSPORTAUTH_DEBUG - if (socket) { - char displaybuf[1024]; - qint64 bytes = socket->bytesAvailable(); - if ( bytes > 511 ) bytes = 511; - hexstring( displaybuf, ((unsigned char *)(reinterpret_cast(socket)->buffer().constData())), bytes ); - qDebug( "readMoreCommand: %lli bytes - %s", socket->bytesAvailable(), displaybuf ); - } -#endif -#endif // QT_NO_SXE - -#ifndef QT_NO_QWS_MULTIPROCESS - if (!socket) - socket = csocket; // server socket - if (socket) { - // read next command - if (!command) { - int command_type = qws_read_uint(socket); - - if (command_type >= 0) - command = QWSCommand::factory(command_type); - } - if (command) { - if (command->read(socket)) { - // Finished reading a whole command. - QWSCommand* result = command; - command = 0; - return result; - } - } - - // Not finished reading a whole command. - return 0; - } else -#endif // QT_NO_QWS_MULTIPROCESS - { - QList *serverQueue = qt_get_server_queue(); - return serverQueue->isEmpty() ? 0 : serverQueue->takeFirst(); - } -} - - -/*! - \internal -*/ -void QWSServer::processEventQueue() -{ - if (qwsServerPrivate) - qwsServerPrivate->doClient(qwsServerPrivate->clientMap.value(-1)); -} - - -#ifndef QT_NO_QWS_MULTIPROCESS -void QWSServerPrivate::_q_doClient() -{ - Q_Q(QWSServer); - - QWSClient* client; -#ifndef QT_NO_SXE - QAuthDevice *ad = qobject_cast(q->sender()); - if (ad) - client = (QWSClient*)ad->client(); - else -#endif - client = (QWSClient*)q->sender(); - - if (doClientIsActive) { - pendingDoClients.append(client); - return; - } - doClientIsActive = true; - - doClient(client); - - while (!pendingDoClients.isEmpty()) { - doClient(pendingDoClients.takeFirst()); - } - - doClientIsActive = false; -} -#endif // QT_NO_QWS_MULTIPROCESS - -void QWSServerPrivate::doClient(QWSClient *client) -{ - QWSCommand* command=client->readMoreCommand(); - - while (command) { - QWSCommandStruct *cs = new QWSCommandStruct(command, client); - commandQueue.append(cs); - // Try for some more... - command=client->readMoreCommand(); - } - - while (!commandQueue.isEmpty()) { - QWSCommandStruct *cs = commandQueue.takeAt(0); - switch (cs->command->type) { - case QWSCommand::Identify: - invokeIdentify((QWSIdentifyCommand*)cs->command, cs->client); - break; - case QWSCommand::Create: - invokeCreate((QWSCreateCommand*)cs->command, cs->client); - break; -#ifndef QT_NO_QWS_MULTIPROCESS - case QWSCommand::Shutdown: - cs->client->d_func()->shutdown = true; - break; -#endif - case QWSCommand::RegionName: - invokeRegionName((QWSRegionNameCommand*)cs->command, cs->client); - break; - case QWSCommand::Region: - invokeRegion((QWSRegionCommand*)cs->command, cs->client); - cs->client->d_func()->unlockCommunication(); - break; - case QWSCommand::RegionMove: - invokeRegionMove((QWSRegionMoveCommand*)cs->command, cs->client); - cs->client->d_func()->unlockCommunication(); - break; - case QWSCommand::RegionDestroy: - invokeRegionDestroy((QWSRegionDestroyCommand*)cs->command, cs->client); - break; -#ifndef QT_NO_QWS_PROPERTIES - case QWSCommand::AddProperty: - invokeAddProperty((QWSAddPropertyCommand*)cs->command); - break; - case QWSCommand::SetProperty: - invokeSetProperty((QWSSetPropertyCommand*)cs->command); - break; - case QWSCommand::RemoveProperty: - invokeRemoveProperty((QWSRemovePropertyCommand*)cs->command); - break; - case QWSCommand::GetProperty: - invokeGetProperty((QWSGetPropertyCommand*)cs->command, cs->client); - break; -#endif - case QWSCommand::SetSelectionOwner: - invokeSetSelectionOwner((QWSSetSelectionOwnerCommand*)cs->command); - break; - case QWSCommand::RequestFocus: - invokeSetFocus((QWSRequestFocusCommand*)cs->command, cs->client); - break; - case QWSCommand::ChangeAltitude: - invokeSetAltitude((QWSChangeAltitudeCommand*)cs->command, - cs->client); - cs->client->d_func()->unlockCommunication(); - break; - case QWSCommand::SetOpacity: - invokeSetOpacity((QWSSetOpacityCommand*)cs->command, - cs->client); - break; - -#ifndef QT_NO_QWS_CURSOR - case QWSCommand::DefineCursor: - invokeDefineCursor((QWSDefineCursorCommand*)cs->command, cs->client); - break; - case QWSCommand::SelectCursor: - invokeSelectCursor((QWSSelectCursorCommand*)cs->command, cs->client); - break; - case QWSCommand::PositionCursor: - invokePositionCursor((QWSPositionCursorCommand*)cs->command, cs->client); - break; -#endif - case QWSCommand::GrabMouse: - invokeGrabMouse((QWSGrabMouseCommand*)cs->command, cs->client); - break; - case QWSCommand::GrabKeyboard: - invokeGrabKeyboard((QWSGrabKeyboardCommand*)cs->command, cs->client); - break; -#if !defined(QT_NO_SOUND) && !defined(Q_OS_DARWIN) - case QWSCommand::PlaySound: - invokePlaySound((QWSPlaySoundCommand*)cs->command, cs->client); - break; -#endif -#ifndef QT_NO_COP - case QWSCommand::QCopRegisterChannel: - invokeRegisterChannel((QWSQCopRegisterChannelCommand*)cs->command, - cs->client); - break; - case QWSCommand::QCopSend: - invokeQCopSend((QWSQCopSendCommand*)cs->command, cs->client); - break; -#endif -#ifndef QT_NO_QWS_INPUTMETHODS - case QWSCommand::IMUpdate: - invokeIMUpdate((QWSIMUpdateCommand*)cs->command, cs->client); - break; - case QWSCommand::IMResponse: - invokeIMResponse((QWSIMResponseCommand*)cs->command, cs->client); - break; - case QWSCommand::IMMouse: - { - if (current_IM) { - QWSIMMouseCommand *cmd = (QWSIMMouseCommand *) cs->command; - current_IM->mouseHandler(cmd->simpleData.index, - cmd->simpleData.state); - } - } - break; -#endif - case QWSCommand::Font: - invokeFont((QWSFontCommand *)cs->command, cs->client); - break; - case QWSCommand::RepaintRegion: - invokeRepaintRegion((QWSRepaintRegionCommand*)cs->command, - cs->client); - cs->client->d_func()->unlockCommunication(); - break; -#ifndef QT_NO_QWSEMBEDWIDGET - case QWSCommand::Embed: - invokeEmbed(static_cast(cs->command), - cs->client); - break; -#endif - case QWSCommand::ScreenTransform: - invokeScreenTransform(static_cast(cs->command), - cs->client); - break; - } - delete cs; - } -} - - -void QWSServerPrivate::showCursor() -{ -#ifndef QT_NO_QWS_CURSOR - if (qt_screencursor) - qt_screencursor->show(); -#endif -} - -void QWSServerPrivate::hideCursor() -{ -#ifndef QT_NO_QWS_CURSOR - if (qt_screencursor) - qt_screencursor->hide(); -#endif -} - -/*! - \fn void QWSServer::enablePainting(bool enable) - - Enables painting onto the screen if \a enable is true; otherwise - painting is disabled. - - \sa {Qt for Embedded Linux Architecture#Drawing on Screen}{Qt for Embedded Linux - Architecture} -*/ -void QWSServer::enablePainting(bool enable) -{ - Q_D(QWSServer); - - if (d->disablePainting == !enable) - return; - - d->disablePainting = !enable; - - if (enable) { - // Reset the server side allocated regions to ensure update_regions() - // will send out region events. - for (int i = 0; i < d->windows.size(); ++i) { - QWSWindow *w = d->windows.at(i); - w->setAllocatedRegion(QRegion()); -#ifdef QT_QWS_CLIENTBLIT - w->setDirectPaintRegion(QRegion()); -#endif - } - d->update_regions(); - d->showCursor(); - } else { - // Disable painting by clients by taking away their allocated region. - // To ensure mouse events are still delivered to the correct windows, - // the allocated regions are not modified on the server. - for (int i = 0; i < d->windows.size(); ++i) { - QWSWindow *w = d->windows.at(i); - w->client()->sendRegionEvent(w->winId(), QRegion(), - QWSRegionEvent::Allocation); -#ifdef QT_QWS_CLIENTBLIT - w->client()->sendRegionEvent(w->winId(), QRegion(), - QWSRegionEvent::DirectPaint); -#endif - } - d->hideCursor(); - } -} - -/*! - Refreshes the display by making the screen driver update the - entire display. - - \sa QScreen::exposeRegion() -*/ -void QWSServer::refresh() -{ - Q_D(QWSServer); - d->exposeRegion(QScreen::instance()->region()); -//### send repaint to non-buffered windows -} - -/*! - \fn void QWSServer::refresh(QRegion & region) - \overload - - Refreshes the given \a region of the display. -*/ -void QWSServer::refresh(QRegion & r) -{ - Q_D(QWSServer); - d->exposeRegion(r); -//### send repaint to non-buffered windows -} - -/*! - \fn void QWSServer::setMaxWindowRect(const QRect& rectangle) - - Sets the maximum area of the screen that \l{Qt for Embedded Linux} - applications can use, to be the given \a rectangle. - - Note that this function can only be used in the server process. - - \sa QWidget::showMaximized() -*/ -void QWSServer::setMaxWindowRect(const QRect &rect) -{ - QList subScreens = qt_screen->subScreens(); - if (subScreens.isEmpty() && qt_screen != 0) - subScreens.append(qt_screen); - - for (int i = 0; i < subScreens.size(); ++i) { - const QScreen *screen = subScreens.at(i); - const QRect r = (screen->region() & rect).boundingRect(); - if (r.isEmpty()) - continue; - - QApplicationPrivate *ap = QApplicationPrivate::instance(); - if (ap->maxWindowRect(screen) != r) { - ap->setMaxWindowRect(screen, i, r); - qwsServerPrivate->sendMaxWindowRectEvents(r); - } - } -} - -/*! - \internal -*/ -void QWSServerPrivate::sendMaxWindowRectEvents(const QRect &rect) -{ - QMap::const_iterator it = clientMap.constBegin(); - for (; it != clientMap.constEnd(); ++it) - (*it)->sendMaxWindowRectEvent(rect); -} - -/*! - \fn void QWSServer::setDefaultMouse(const char *mouseDriver) - - Sets the mouse driver that will be used if the QWS_MOUSE_PROTO - environment variable is not defined, to be the given \a - mouseDriver. - - Note that the default is platform-dependent. This function can - only be used in the server process. - - - \sa setMouseHandler(), {Qt for Embedded Linux Pointer Handling} -*/ -void QWSServer::setDefaultMouse(const char *m) -{ - *defaultMouse() = QString::fromAscii(m); -} - -/*! - \fn void QWSServer::setDefaultKeyboard(const char *keyboardDriver) - - Sets the keyboard driver that will be used if the QWS_KEYBOARD - environment variable is not defined, to be the given \a - keyboardDriver. - - Note that the default is platform-dependent. This function can - only be used in the server process. - - \sa setKeyboardHandler(), {Qt for Embedded Linux Character Input} -*/ -void QWSServer::setDefaultKeyboard(const char *k) -{ - *defaultKeyboard() = QString::fromAscii(k); -} - -#ifndef QT_NO_QWS_CURSOR -static bool prevWin; -#endif - - -extern int *qt_last_x,*qt_last_y; - - -/*! - \internal - - Send a mouse event. \a pos is the screen position where the mouse - event occurred and \a state is a mask indicating which buttons are - pressed. - - \a pos is in device coordinates -*/ -void QWSServer::sendMouseEvent(const QPoint& pos, int state, int wheel) -{ - bool block = qwsServerPrivate->screensaverblockevent(MOUSE, qwsServerPrivate->screensaverinterval, state); -#ifdef EVENT_BLOCK_DEBUG - qDebug() << "sendMouseEvent" << pos.x() << pos.y() << state << (block ? "block" : "pass"); -#endif - - if (state || wheel) - qwsServerPrivate->_q_screenSaverWake(); - - if ( block ) - return; - - QPoint tpos; - // transformations - if (qt_screen->isTransformed()) { - QSize s = QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight()); - tpos = qt_screen->mapFromDevice(pos, s); - } else { - tpos = pos; - } - - if (qt_last_x) { - *qt_last_x = tpos.x(); - *qt_last_y = tpos.y(); - } - QWSServer::mousePosition = tpos; - qwsServerPrivate->mouseState = state; - -#ifndef QT_NO_QWS_INPUTMETHODS - const int btnMask = Qt::LeftButton | Qt::RightButton | Qt::MidButton; - int stroke_count; // number of strokes to keep shown. - if (force_reject_strokeIM || !current_IM) - { - stroke_count = 0; - } else { - stroke_count = current_IM->filter(tpos, state, wheel); - } - - if (stroke_count == 0) { - if (state&btnMask) - force_reject_strokeIM = true; - QWSServerPrivate::sendMouseEventUnfiltered(tpos, state, wheel); - } - // stop force reject after stroke ends. - if (state&btnMask && force_reject_strokeIM) - force_reject_strokeIM = false; - // on end of stroke, force_rejct - // and once a stroke is rejected, do not try again till pen is lifted -#else - QWSServerPrivate::sendMouseEventUnfiltered(tpos, state, wheel); -#endif // end QT_NO_QWS_FSIM -} - -void QWSServerPrivate::sendMouseEventUnfiltered(const QPoint &pos, int state, int wheel) -{ - const int btnMask = Qt::LeftButton | Qt::RightButton | Qt::MidButton; - QWSMouseEvent event; - - QWSWindow *win = qwsServer->windowAt(pos); - - QWSClient *serverClient = qwsServerPrivate->clientMap.value(-1); - QWSClient *winClient = win ? win->client() : 0; - - - bool imMouse = false; -#ifndef QT_NO_QWS_INPUTMETHODS - // check for input method window - if (current_IM && current_IM_winId != -1) { - QWSWindow *kbw = keyboardGrabber ? keyboardGrabber : - qwsServerPrivate->focusw; - - imMouse = kbw == win; - if ( !imMouse ) { - QWidget *target = winClient == serverClient ? - QApplication::widgetAt(pos) : 0; - imMouse = target && (target->testAttribute(Qt::WA_InputMethodTransparent)); - } - } -#endif - - //If grabbing window disappears, grab is still active until - //after mouse release. - if ( qwsServerPrivate->mouseGrabber && (!imMouse || qwsServerPrivate->inputMethodMouseGrabbed)) { - win = qwsServerPrivate->mouseGrabber; - winClient = win ? win->client() : 0; - } - event.simpleData.window = win ? win->id : 0; - -#ifndef QT_NO_QWS_CURSOR - if (qt_screencursor) - qt_screencursor->move(pos.x(),pos.y()); - - // Arrow cursor over desktop - // prevWin remembers if the last event was over a window - if (!win && prevWin) { - if (!qwsServerPrivate->mouseGrabber) - qwsServerPrivate->setCursor(QWSCursor::systemCursor(Qt::ArrowCursor)); - else - qwsServerPrivate->nextCursor = QWSCursor::systemCursor(Qt::ArrowCursor); - prevWin = false; - } - // reset prevWin - if (win && !prevWin) - prevWin = true; -#endif - - if ((state&btnMask) && !qwsServerPrivate->mouseGrabbing) { - qwsServerPrivate->mouseGrabber = win; - if (imMouse) - qwsServerPrivate->inputMethodMouseGrabbed = true; - } - if (!(state&btnMask)) - qwsServerPrivate->inputMethodMouseGrabbed = false; - - event.simpleData.x_root=pos.x(); - event.simpleData.y_root=pos.y(); - event.simpleData.state=state | qws_keyModifiers; - event.simpleData.delta = wheel; - event.simpleData.time=qwsServerPrivate->timer.elapsed(); - - static int oldstate = 0; - -#ifndef QT_NO_QWS_INPUTMETHODS - //tell the input method if we click on a different window that is not IM transparent - bool isPress = state > oldstate; - if (isPress && !imMouse && current_IM && current_IM_winId != -1) - current_IM->mouseHandler(-1, QWSServer::MouseOutside); -#endif - - if (serverClient) - serverClient->sendEvent(&event); - if (winClient && winClient != serverClient) - winClient->sendEvent(&event); - - if ( !imMouse ) { - // Make sure that if we leave a window, that window gets one last mouse - // event so that it knows the mouse has left. - QWSClient *oldClient = qwsServer->d_func()->cursorClient; - if (oldClient && oldClient != winClient && oldClient != serverClient) { - event.simpleData.state = oldstate | qws_keyModifiers; - oldClient->sendEvent(&event); - } - } - - oldstate = state; - if ( !imMouse ) - qwsServer->d_func()->cursorClient = winClient; - - if (!(state&btnMask) && !qwsServerPrivate->mouseGrabbing) - qwsServerPrivate->releaseMouse(qwsServerPrivate->mouseGrabber); -} - -/*! - Returns the primary mouse driver. - - Note that this function can only be used in the server process. - - \sa setMouseHandler(), openMouse(), closeMouse() -*/ -QWSMouseHandler *QWSServer::mouseHandler() -{ - if (qwsServerPrivate->mousehandlers.empty()) - return 0; - return qwsServerPrivate->mousehandlers.first(); -} - -/*! - \since 4.5 - - Returns list of all mouse handlers - - Note that this function can only be used in the server process. - - \sa mouseHandler(), setMouseHandler(), openMouse(), closeMouse() -*/ -const QList& QWSServer::mouseHandlers() -{ - return qwsServerPrivate->mousehandlers; -} - - -// called by QWSMouseHandler constructor, not user code. -/*! - \fn void QWSServer::setMouseHandler(QWSMouseHandler* driver) - - Sets the primary mouse driver to be the given \a driver. - - \l{Qt for Embedded Linux} provides several ready-made mouse drivers, and - custom drivers are typically added using Qt's plugin - mechanism. See the \l{Qt for Embedded Linux Pointer Handling} documentation - for details. - - Note that this function can only be used in the server process. - - \sa mouseHandler(), setDefaultMouse() -*/ -void QWSServer::setMouseHandler(QWSMouseHandler* mh) -{ - if (!mh) - return; - qwsServerPrivate->mousehandlers.removeAll(mh); - qwsServerPrivate->mousehandlers.prepend(mh); -} - -/*! - \internal - \obsolete - Caller owns data in list, and must delete contents -*/ -QList * QWSServer::windowList() -{ - QList * ret=new QList; - for (int i=0; i < qwsServerPrivate->windows.size(); ++i) { - QWSWindow *window = qwsServerPrivate->windows.at(i); - QWSInternalWindowInfo * qwi=new QWSInternalWindowInfo(); - qwi->winid=window->winId(); - qwi->clientid=window->client()->clientId(); - ret->append(qwi); - } - return ret; -} - -#ifndef QT_NO_COP -/*! - \internal -*/ -void QWSServerPrivate::sendQCopEvent(QWSClient *c, const QString &ch, - const QString &msg, const QByteArray &data, - bool response) -{ - Q_ASSERT(c); - - QWSQCopMessageEvent event; - event.channel = ch.toLatin1(); - event.message = msg.toLatin1(); - event.data = data; - event.simpleData.is_response = response; - event.simpleData.lchannel = ch.length(); - event.simpleData.lmessage = msg.length(); - event.simpleData.ldata = data.size(); - int l = event.simpleData.lchannel + event.simpleData.lmessage + - event.simpleData.ldata; - - // combine channel, message and data into one block of raw bytes - char *tmp = new char [l]; - char *d = tmp; - memcpy(d, event.channel.constData(), event.simpleData.lchannel); - d += event.simpleData.lchannel; - memcpy(d, event.message.constData(), event.simpleData.lmessage); - d += event.simpleData.lmessage; - memcpy(d, data.constData(), event.simpleData.ldata); - - event.setDataDirect(tmp, l); - - c->sendEvent(&event); -} -#endif - -/*! - \fn QWSWindow *QWSServer::windowAt(const QPoint& position) - - Returns the window containing the given \a position. - - Note that if there is no window under the specified point this - function returns 0. - - \sa clientWindows(), instance() -*/ -QWSWindow *QWSServer::windowAt(const QPoint& pos) -{ - Q_D(QWSServer); - for (int i=0; iwindows.size(); ++i) { - QWSWindow* w = d->windows.at(i); - if (w->allocatedRegion().contains(pos)) - return w; - } - return 0; -} - -#ifndef QT_NO_QWS_KEYBOARD -static int keyUnicode(int keycode) -{ - int code = 0xffff; - - if (keycode >= Qt::Key_A && keycode <= Qt::Key_Z) - code = keycode - Qt::Key_A + 'a'; - else if (keycode >= Qt::Key_0 && keycode <= Qt::Key_9) - code = keycode - Qt::Key_0 + '0'; - - return code; -} -#endif - -/*! - Sends the given key event. The key is identified by its \a unicode - value and the given \a keycode, \a modifiers, \a isPress and \a - autoRepeat parameters. - - Use this function to send key events generated by "virtual - keyboards" (note that the processKeyEvent() function is - impelemented using this function). - - The \a keycode parameter is the Qt keycode value as defined by the - Qt::Key enum. The \a modifiers is an OR combination of - Qt::KeyboardModifier values, indicating whether \gui - Shift/Alt/Ctrl keys are pressed. The \a isPress parameter is true - if the event is a key press event and \a autoRepeat is true if the - event is caused by an auto-repeat mechanism and not an actual key - press. - - Note that this function can only be used in the server process. - - \sa processKeyEvent(), {Qt for Embedded Linux Character Input} -*/ -void QWSServer::sendKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, - bool isPress, bool autoRepeat) -{ - qws_keyModifiers = modifiers; - - if (isPress) { - if (keycode != Qt::Key_F34 && keycode != Qt::Key_F35) - qwsServerPrivate->_q_screenSaverWake(); - } - -#ifndef QT_NO_QWS_INPUTMETHODS - - if (!current_IM || !current_IM->filter(unicode, keycode, modifiers, isPress, autoRepeat)) - QWSServerPrivate::sendKeyEventUnfiltered(unicode, keycode, modifiers, isPress, autoRepeat); -#else - QWSServerPrivate::sendKeyEventUnfiltered(unicode, keycode, modifiers, isPress, autoRepeat); -#endif -} - -void QWSServerPrivate::sendKeyEventUnfiltered(int unicode, int keycode, Qt::KeyboardModifiers modifiers, - bool isPress, bool autoRepeat) -{ - - QWSKeyEvent event; - QWSWindow *win = keyboardGrabber ? keyboardGrabber : - qwsServerPrivate->focusw; - - event.simpleData.window = win ? win->winId() : 0; - - event.simpleData.unicode = -#ifndef QT_NO_QWS_KEYBOARD - unicode < 0 ? keyUnicode(keycode) : -#endif - unicode; - event.simpleData.keycode = keycode; - event.simpleData.modifiers = modifiers; - event.simpleData.is_press = isPress; - event.simpleData.is_auto_repeat = autoRepeat; - - QWSClient *serverClient = qwsServerPrivate->clientMap.value(-1); - QWSClient *winClient = win ? win->client() : 0; - if (serverClient) - serverClient->sendEvent(&event); - if (winClient && winClient != serverClient) - winClient->sendEvent(&event); -} - -/*! - \internal -*/ -void QWSServer::beginDisplayReconfigure() -{ - qwsServer->enablePainting(false); -#ifndef QT_NO_QWS_CURSOR - if (qt_screencursor) - qt_screencursor->hide(); -#endif - QWSDisplay::grab(true); - qt_screen->disconnect(); -} - -/*! - \internal -*/ -void QWSServer::endDisplayReconfigure() -{ - qt_screen->connect(QString()); - qwsServerPrivate->swidth = qt_screen->deviceWidth(); - qwsServerPrivate->sheight = qt_screen->deviceHeight(); - - QWSDisplay::ungrab(); -#ifndef QT_NO_QWS_CURSOR - if (qt_screencursor) - qt_screencursor->show(); -#endif - QApplicationPrivate *ap = QApplicationPrivate::instance(); - ap->setMaxWindowRect(qt_screen, 0, - QRect(0, 0, qt_screen->width(), qt_screen->height())); - QSize olds = qApp->desktop()->size(); - qApp->desktop()->resize(qt_screen->width(), qt_screen->height()); - qApp->postEvent(qApp->desktop(), new QResizeEvent(qApp->desktop()->size(), olds)); - qwsServer->enablePainting(true); - qwsServer->refresh(); - qDebug("Desktop size: %dx%d", qApp->desktop()->width(), qApp->desktop()->height()); -} - -void QWSServerPrivate::resetEngine() -{ -#ifndef QT_NO_QWS_CURSOR - if (!qt_screencursor) - return; - qt_screencursor->hide(); - qt_screencursor->show(); -#endif -} - - -#ifndef QT_NO_QWS_CURSOR -/*! - \fn void QWSServer::setCursorVisible(bool visible) - - Shows the cursor if \a visible is true: otherwise the cursor is - hidden. - - Note that this function can only be used in the server process. - - \sa isCursorVisible() -*/ -void QWSServer::setCursorVisible(bool vis) -{ - if (qwsServerPrivate && qwsServerPrivate->haveviscurs != vis) { - QWSCursor* c = qwsServerPrivate->cursor; - qwsServerPrivate->setCursor(QWSCursor::systemCursor(Qt::BlankCursor)); - qwsServerPrivate->haveviscurs = vis; - qwsServerPrivate->setCursor(c); - } -} - -/*! - Returns true if the cursor is visible; otherwise returns false. - - Note that this function can only be used in the server process. - - \sa setCursorVisible() -*/ -bool QWSServer::isCursorVisible() -{ - return qwsServerPrivate ? qwsServerPrivate->haveviscurs : true; -} -#endif - -#ifndef QT_NO_QWS_INPUTMETHODS - - -/*! - \fn void QWSServer::sendIMEvent(const QInputMethodEvent *event) - - Sends the given input method \a event. - - The \c QInputMethodEvent class is derived from QWSEvent, i.e., it - is a QWSEvent object of the QWSEvent::IMEvent type. - - If there is a window actively composing the preedit string, the - event is sent to that window. Otherwise, the event is sent to the - window currently in focus. - - \sa sendIMQuery(), QWSInputMethod::sendEvent() -*/ -void QWSServer::sendIMEvent(const QInputMethodEvent *ime) -{ - QWSIMEvent event; - - QWSWindow *win = keyboardGrabber ? keyboardGrabber : - qwsServerPrivate->focusw; - - //if currently composing then event must go to the composing window - - if (current_IM_composing_win) - win = current_IM_composing_win; - - event.simpleData.window = win ? win->winId() : 0; - event.simpleData.replaceFrom = ime->replacementStart();; - event.simpleData.replaceLength = ime->replacementLength(); - - QBuffer buffer; - buffer.open(QIODevice::WriteOnly); - QDataStream out(&buffer); - - out << ime->preeditString(); - out << ime->commitString(); - - const QList &attributes = ime->attributes(); - for (int i = 0; i < attributes.count(); ++i) { - const QInputMethodEvent::Attribute &a = attributes.at(i); - out << a.type << a.start << a.length << a.value; - } - event.setData(buffer.data(), buffer.size()); - QWSClient *serverClient = qwsServerPrivate->clientMap.value(-1); - if (serverClient) - serverClient->sendEvent(&event); - if (win && win->client() && win->client() != serverClient) - win->client()->sendEvent(&event); - - current_IM_composing_win = ime->preeditString().isEmpty() ? 0 : win; - current_IM_winId = win ? win->winId() : 0; -} - - -/*! - Sends an input method query for the given \a property. - - To receive responses to input method queries, the virtual - QWSInputMethod::queryResponse() function must be reimplemented in - a QWSInputMethod subclass that is activated using the - setCurrentInputMethod() function. - - \sa sendIMEvent(), setCurrentInputMethod() -*/ -void QWSServer::sendIMQuery(int property) -{ - QWSIMQueryEvent event; - - QWSWindow *win = keyboardGrabber ? keyboardGrabber : - qwsServerPrivate->focusw; - if (current_IM_composing_win) - win = current_IM_composing_win; - - event.simpleData.window = win ? win->winId() : 0; - event.simpleData.property = property; - if (win && win->client()) - win->client()->sendEvent(&event); -} - - - -/*! - \fn void QWSServer::setCurrentInputMethod(QWSInputMethod *method) - - Sets the current input method to be the given \a method. - - Note that this function can only be used in the server process. - - \sa sendIMQuery(), sendIMEvent() -*/ -void QWSServer::setCurrentInputMethod(QWSInputMethod *im) -{ - if (current_IM) - current_IM->reset(); //??? send an update event instead ? - current_IM = im; -} - -/*! - \fn static void QWSServer::resetInputMethod() - - \internal -*/ - -#endif //QT_NO_QWS_INPUTMETHODS - -#ifndef QT_NO_QWS_PROPERTIES -/*! - \internal -*/ -void QWSServer::sendPropertyNotifyEvent(int property, int state) -{ - Q_D(QWSServer); - QWSServerPrivate::ClientIterator it = d->clientMap.begin(); - while (it != d->clientMap.end()) { - QWSClient *cl = *it; - ++it; - cl->sendPropertyNotifyEvent(property, state); - } -} -#endif - -void QWSServerPrivate::invokeIdentify(const QWSIdentifyCommand *cmd, QWSClient *client) -{ - client->setIdentity(cmd->id); -#ifndef QT_NO_QWS_MULTIPROCESS - if (client->clientId() > 0) - client->d_func()->setLockId(cmd->simpleData.idLock); -#endif -} - -void QWSServerPrivate::invokeCreate(QWSCreateCommand *cmd, QWSClient *client) -{ - QWSCreationEvent event; - event.simpleData.objectid = get_object_id(cmd->count); - event.simpleData.count = cmd->count; - client->sendEvent(&event); -} - -void QWSServerPrivate::invokeRegionName(const QWSRegionNameCommand *cmd, QWSClient *client) -{ - Q_Q(QWSServer); - QWSWindow* changingw = findWindow(cmd->simpleData.windowid, client); - if (changingw && (changingw->name() != cmd->name || changingw->caption() !=cmd->caption)) { - changingw->setName(cmd->name); - changingw->setCaption(cmd->caption); - emit q->windowEvent(changingw, QWSServer::Name); - } -} - -void QWSServerPrivate::invokeRegion(QWSRegionCommand *cmd, QWSClient *client) -{ -#ifdef QWS_REGION_DEBUG - qDebug("QWSServer::invokeRegion %d rects (%d)", - cmd->simpleData.nrectangles, cmd->simpleData.windowid); -#endif - - QWSWindow* changingw = findWindow(cmd->simpleData.windowid, 0); - if (!changingw) { - qWarning("Invalid window handle %08x",cmd->simpleData.windowid); - return; - } - if (!changingw->forClient(client)) { - qWarning("Disabled: clients changing other client's window region"); - return; - } - - request_region(cmd->simpleData.windowid, cmd->surfaceKey, cmd->surfaceData, - cmd->region); -} - -void QWSServerPrivate::invokeRegionMove(const QWSRegionMoveCommand *cmd, QWSClient *client) -{ - Q_Q(QWSServer); - QWSWindow* changingw = findWindow(cmd->simpleData.windowid, 0); - if (!changingw) { - qWarning("invokeRegionMove: Invalid window handle %d",cmd->simpleData.windowid); - return; - } - if (!changingw->forClient(client)) { - qWarning("Disabled: clients changing other client's window region"); - return; - } - -// changingw->setNeedAck(true); - moveWindowRegion(changingw, cmd->simpleData.dx, cmd->simpleData.dy); - emit q->windowEvent(changingw, QWSServer::Geometry); -} - -void QWSServerPrivate::invokeRegionDestroy(const QWSRegionDestroyCommand *cmd, QWSClient *client) -{ - Q_Q(QWSServer); - QWSWindow* changingw = findWindow(cmd->simpleData.windowid, 0); - if (!changingw) { - qWarning("invokeRegionDestroy: Invalid window handle %d",cmd->simpleData.windowid); - return; - } - if (!changingw->forClient(client)) { - qWarning("Disabled: clients changing other client's window region"); - return; - } - - setWindowRegion(changingw, QRegion()); -// rgnMan->remove(changingw->allocationIndex()); - for (int i = 0; i < windows.size(); ++i) { - if (windows.at(i) == changingw) { - windows.takeAt(i); - if (i < nReserved) - --nReserved; - break; - } - } - - handleWindowClose(changingw); -#ifndef QT_NO_QWS_PROPERTIES - propertyManager.removeProperties(changingw->winId()); -#endif - emit q->windowEvent(changingw, QWSServer::Destroy); - delete changingw; -} - -void QWSServerPrivate::invokeSetFocus(const QWSRequestFocusCommand *cmd, QWSClient *client) -{ - int winId = cmd->simpleData.windowid; - int gain = cmd->simpleData.flag; - - if (gain != 0 && gain != 1) { - qWarning("Only 0(lose) and 1(gain) supported"); - return; - } - - QWSWindow* changingw = findWindow(winId, 0); - if (!changingw) - return; - - if (!changingw->forClient(client)) { - qWarning("Disabled: clients changing other client's focus"); - return; - } - - setFocus(changingw, gain); -} - -void QWSServerPrivate::setFocus(QWSWindow* changingw, bool gain) -{ - Q_Q(QWSServer); -#ifndef QT_NO_QWS_INPUTMETHODS - /* - This is the logic: - QWSWindow *loser = 0; - if (gain && focusw != changingw) - loser = focusw; - else if (!gain && focusw == changingw) - loser = focusw; - But these five lines can be reduced to one: - */ - if (current_IM) { - QWSWindow *loser = (!gain == (focusw==changingw)) ? focusw : 0; - if (loser && loser->winId() == current_IM_winId) - current_IM->updateHandler(QWSInputMethod::FocusOut); - } -#endif - if (gain) { - if (focusw != changingw) { - if (focusw) focusw->focus(0); - focusw = changingw; - focusw->focus(1); - emit q->windowEvent(focusw, QWSServer::Active); - } - } else if (focusw == changingw) { - if (changingw->client()) - changingw->focus(0); - focusw = 0; - // pass focus to window which most recently got it... - QWSWindow* bestw=0; - for (int i=0; ihidden() && - (!bestw || bestw->focusPriority() < w->focusPriority())) - bestw = w; - } - if (!bestw && changingw->focusPriority()) { // accept focus back? - bestw = changingw; // must be the only one - } - focusw = bestw; - if (focusw) { - focusw->focus(1); - emit q->windowEvent(focusw, QWSServer::Active); - } - } -} - - - -void QWSServerPrivate::invokeSetOpacity(const QWSSetOpacityCommand *cmd, QWSClient *client) -{ - Q_UNUSED( client ); - int winId = cmd->simpleData.windowid; - int opacity = cmd->simpleData.opacity; - - QWSWindow* changingw = findWindow(winId, 0); - - if (!changingw) { - qWarning("invokeSetOpacity: Invalid window handle %d", winId); - return; - } - - int altitude = windows.indexOf(changingw); - const bool wasOpaque = changingw->isOpaque(); - changingw->_opacity = opacity; - if (wasOpaque != changingw->isOpaque()) - update_regions(); - exposeRegion(changingw->allocatedRegion(), altitude); -} - -void QWSServerPrivate::invokeSetAltitude(const QWSChangeAltitudeCommand *cmd, - QWSClient *client) -{ - Q_UNUSED(client); - - int winId = cmd->simpleData.windowid; - int alt = cmd->simpleData.altitude; - bool fixed = cmd->simpleData.fixed; -#if 0 - qDebug("QWSServer::invokeSetAltitude winId %d alt %d)", winId, alt); -#endif - - if (alt < -1 || alt > 1) { - qWarning("QWSServer::invokeSetAltitude Only lower, raise and stays-on-top supported"); - return; - } - - QWSWindow* changingw = findWindow(winId, 0); - if (!changingw) { - qWarning("invokeSetAltitude: Invalid window handle %d", winId); - return; - } - - if (fixed && alt >= 1) { - changingw->onTop = true; - } - if (alt == QWSChangeAltitudeCommand::Lower) - changingw->lower(); - else - changingw->raise(); - -// if (!changingw->forClient(client)) { -// refresh(); -// } -} - -#ifndef QT_NO_QWS_PROPERTIES -void QWSServerPrivate::invokeAddProperty(QWSAddPropertyCommand *cmd) -{ - propertyManager.addProperty(cmd->simpleData.windowid, cmd->simpleData.property); -} - -void QWSServerPrivate::invokeSetProperty(QWSSetPropertyCommand *cmd) -{ - Q_Q(QWSServer); - if (propertyManager.setProperty(cmd->simpleData.windowid, - cmd->simpleData.property, - cmd->simpleData.mode, - cmd->data, - cmd->rawLen)) { - q->sendPropertyNotifyEvent(cmd->simpleData.property, - QWSPropertyNotifyEvent::PropertyNewValue); -#ifndef QT_NO_QWS_INPUTMETHODS - if (cmd->simpleData.property == QT_QWS_PROPERTY_MARKEDTEXT) { - QString s((const QChar*)cmd->data, cmd->rawLen/2); - emit q->markedText(s); - } -#endif - } -} - -void QWSServerPrivate::invokeRemoveProperty(QWSRemovePropertyCommand *cmd) -{ - Q_Q(QWSServer); - if (propertyManager.removeProperty(cmd->simpleData.windowid, - cmd->simpleData.property)) { - q->sendPropertyNotifyEvent(cmd->simpleData.property, - QWSPropertyNotifyEvent::PropertyDeleted); - } -} - - -bool QWSServerPrivate:: get_property(int winId, int property, const char *&data, int &len) -{ - return propertyManager.getProperty(winId, property, data, len); -} - - -void QWSServerPrivate::invokeGetProperty(QWSGetPropertyCommand *cmd, QWSClient *client) -{ - const char *data; - int len; - - if (propertyManager.getProperty(cmd->simpleData.windowid, - cmd->simpleData.property, - data, len)) { - client->sendPropertyReplyEvent(cmd->simpleData.property, len, data); - } else { - client->sendPropertyReplyEvent(cmd->simpleData.property, -1, 0); - } -} -#endif //QT_NO_QWS_PROPERTIES - -void QWSServerPrivate::invokeSetSelectionOwner(QWSSetSelectionOwnerCommand *cmd) -{ - qDebug("QWSServer::invokeSetSelectionOwner"); - - SelectionOwner so; - so.windowid = cmd->simpleData.windowid; - so.time.set(cmd->simpleData.hour, cmd->simpleData.minute, - cmd->simpleData.sec, cmd->simpleData.ms); - - if (selectionOwner.windowid != -1) { - QWSWindow *win = findWindow(selectionOwner.windowid, 0); - if (win) - win->client()->sendSelectionClearEvent(selectionOwner.windowid); - else - qDebug("couldn't find window %d", selectionOwner.windowid); - } - - selectionOwner = so; -} - -void QWSServerPrivate::invokeConvertSelection(QWSConvertSelectionCommand *cmd) -{ - qDebug("QWSServer::invokeConvertSelection"); - - if (selectionOwner.windowid != -1) { - QWSWindow *win = findWindow(selectionOwner.windowid, 0); - if (win) - win->client()->sendSelectionRequestEvent(cmd, selectionOwner.windowid); - else - qDebug("couldn't find window %d", selectionOwner.windowid); - } -} - -#ifndef QT_NO_QWS_CURSOR -void QWSServerPrivate::invokeDefineCursor(QWSDefineCursorCommand *cmd, QWSClient *client) -{ - if (cmd->simpleData.height > 64 || cmd->simpleData.width > 64) { - qDebug("Cannot define cursor size > 64x64"); - return; - } - - delete client->cursors.take(cmd->simpleData.id); - - int dataLen = cmd->simpleData.height * ((cmd->simpleData.width+7) / 8); - - if (dataLen > 0 && cmd->data) { - QWSCursor *curs = new QWSCursor(cmd->data, cmd->data + dataLen, - cmd->simpleData.width, cmd->simpleData.height, - cmd->simpleData.hotX, cmd->simpleData.hotY); - client->cursors.insert(cmd->simpleData.id, curs); - } -} - -void QWSServerPrivate::invokeSelectCursor(QWSSelectCursorCommand *cmd, QWSClient *client) -{ - int id = cmd->simpleData.id; - QWSCursor *curs = 0; - if (id <= Qt::LastCursor) { - curs = QWSCursor::systemCursor(id); - } - else { - QWSCursorMap cursMap = client->cursors; - QWSCursorMap::Iterator it = cursMap.find(id); - if (it != cursMap.end()) { - curs = it.value(); - } - } - if (curs == 0) { - curs = QWSCursor::systemCursor(Qt::ArrowCursor); - } - - QWSWindow* win = findWindow(cmd->simpleData.windowid, 0); - if (mouseGrabber) { - // If the mouse is being grabbed, we don't want just anyone to - // be able to change the cursor. We do want the cursor to be set - // correctly once mouse grabbing is stopped though. - if (win != mouseGrabber) - nextCursor = curs; - else - setCursor(curs); - } else if (win && win->allocatedRegion().contains(QWSServer::mousePosition)) { //##################### cursor - // A non-grabbing window can only set the cursor shape if the - // cursor is within its allocated region. - setCursor(curs); - } -} - -void QWSServerPrivate::invokePositionCursor(QWSPositionCursorCommand *cmd, QWSClient *) -{ - Q_Q(QWSServer); - QPoint newPos(cmd->simpleData.newX, cmd->simpleData.newY); - if (newPos != QWSServer::mousePosition) - q->sendMouseEvent(newPos, qwsServer->d_func()->mouseState); -} -#endif - -void QWSServerPrivate::invokeGrabMouse(QWSGrabMouseCommand *cmd, QWSClient *client) -{ - QWSWindow* win = findWindow(cmd->simpleData.windowid, 0); - if (!win) - return; - - if (cmd->simpleData.grab) { - if (!mouseGrabber || mouseGrabber->client() == client) { - mouseGrabbing = true; - mouseGrabber = win; - } - } else { - releaseMouse(mouseGrabber); - } -} - -void QWSServerPrivate::invokeGrabKeyboard(QWSGrabKeyboardCommand *cmd, QWSClient *client) -{ - QWSWindow* win = findWindow(cmd->simpleData.windowid, 0); - if (!win) - return; - - if (cmd->simpleData.grab) { - if (!keyboardGrabber || (keyboardGrabber->client() == client)) { - keyboardGrabbing = true; - keyboardGrabber = win; - } - } else { - releaseKeyboard(keyboardGrabber); - } -} - -#if !defined(QT_NO_SOUND) -void QWSServerPrivate::invokePlaySound(QWSPlaySoundCommand *cmd, QWSClient *) -{ -#if !defined(QT_EXTERNAL_SOUND_SERVER) && !defined(Q_OS_DARWIN) - soundserver->playFile( 1, cmd->filename ); -#else - Q_UNUSED(cmd); -#endif -} -#endif - -#ifndef QT_NO_COP -void QWSServerPrivate::invokeRegisterChannel(QWSQCopRegisterChannelCommand *cmd, - QWSClient *client) -{ - // QCopChannel will force us to emit the newChannel signal if this channel - // didn't already exist. - QCopChannel::registerChannel(cmd->channel, client); -} - -void QWSServerPrivate::invokeQCopSend(QWSQCopSendCommand *cmd, QWSClient *client) -{ - QCopChannel::answer(client, cmd->channel, cmd->message, cmd->data); -} - -#endif - -#ifndef QT_NO_QWS_INPUTMETHODS -void QWSServer::resetInputMethod() -{ - if (current_IM && qwsServer) { - current_IM->reset(); - } -} - -void QWSServerPrivate::invokeIMResponse(const QWSIMResponseCommand *cmd, - QWSClient *) -{ - if (current_IM) - current_IM->queryResponse(cmd->simpleData.property, cmd->result); -} - -void QWSServerPrivate::invokeIMUpdate(const QWSIMUpdateCommand *cmd, - QWSClient *) -{ - if (cmd->simpleData.type == QWSInputMethod::FocusIn) - current_IM_winId = cmd->simpleData.windowid; - - if (current_IM && (current_IM_winId == cmd->simpleData.windowid || cmd->simpleData.windowid == -1)) - current_IM->updateHandler(cmd->simpleData.type); -} - -#endif - -void QWSServerPrivate::invokeFont(const QWSFontCommand *cmd, QWSClient *client) -{ - QWSClientPrivate *priv = client->d_func(); - if (cmd->simpleData.type == QWSFontCommand::StartedUsingFont) { - referenceFont(priv, cmd->fontName); - } else if (cmd->simpleData.type == QWSFontCommand::StoppedUsingFont) { - dereferenceFont(priv, cmd->fontName); - } -} - -void QWSServerPrivate::invokeRepaintRegion(QWSRepaintRegionCommand * cmd, - QWSClient *) -{ - QRegion r; - r.setRects(cmd->rectangles,cmd->simpleData.nrectangles); - repaint_region(cmd->simpleData.windowid, cmd->simpleData.windowFlags, cmd->simpleData.opaque, r); -} - -#ifndef QT_NO_QWSEMBEDWIDGET -void QWSServerPrivate::invokeEmbed(QWSEmbedCommand *cmd, QWSClient *client) -{ - // Should find these two windows in a single loop - QWSWindow *embedder = findWindow(cmd->simpleData.embedder, client); - QWSWindow *embedded = findWindow(cmd->simpleData.embedded); - - if (!embedder) { - qWarning("QWSServer: Embed command from window %i failed: No such id.", - static_cast(cmd->simpleData.embedder)); - return; - } - - if (!embedded) { - qWarning("QWSServer: Embed command on window %i failed: No such id.", - static_cast(cmd->simpleData.embedded)); - return; - } - - switch (cmd->simpleData.type) { - case QWSEmbedEvent::StartEmbed: - embedder->startEmbed(embedded); - windows.removeAll(embedded); - windows.insert(windows.indexOf(embedder), embedded); - break; - case QWSEmbedEvent::StopEmbed: - embedder->stopEmbed(embedded); - break; - case QWSEmbedEvent::Region: - break; - } - - embedded->client()->sendEmbedEvent(embedded->winId(), - cmd->simpleData.type, cmd->region); - const QRegion oldAllocated = embedded->allocatedRegion(); - update_regions(); - exposeRegion(oldAllocated - embedded->allocatedRegion(), - windows.indexOf(embedded)); -} -#endif // QT_NO_QWSEMBEDWIDGET - -void QWSServerPrivate::invokeScreenTransform(const QWSScreenTransformCommand *cmd, - QWSClient *client) -{ - Q_UNUSED(client); - - QWSScreenTransformationEvent event; - event.simpleData.screen = cmd->simpleData.screen; - event.simpleData.transformation = cmd->simpleData.transformation; - - QMap::const_iterator it = clientMap.constBegin(); - for (; it != clientMap.constEnd(); ++it) - (*it)->sendEvent(&event); -} - -QWSWindow* QWSServerPrivate::newWindow(int id, QWSClient* client) -{ - Q_Q(QWSServer); - // Make a new window, put it on top. - QWSWindow* w = new QWSWindow(id,client); - - // insert after "stays on top" windows - bool added = false; - for (int i = nReserved; i < windows.size(); ++i) { - QWSWindow *win = windows.at(i); - if (!win->onTop) { - windows.insert(i, w); - added = true; - break; - } - } - if (!added) - windows.append(w); - emit q->windowEvent(w, QWSServer::Create); - return w; -} - -QWSWindow* QWSServerPrivate::findWindow(int windowid, QWSClient* client) -{ - for (int i=0; iwinId() == windowid) - return w; - } - if (client) - return newWindow(windowid,client); - else - return 0; -} - -void QWSServerPrivate::raiseWindow(QWSWindow *changingw, int /*alt*/) -{ - Q_Q(QWSServer); - if (changingw == windows.first()) - return; - QWSWindow::State oldstate = changingw->d->state; - changingw->d->state = QWSWindow::Raising; - // Expose regions previously overlapped by transparent windows - const QRegion bound = changingw->allocatedRegion(); - QRegion expose; - int windowPos = 0; - - //change position in list: - for (int i = 0; i < windows.size(); ++i) { - QWSWindow *w = windows.at(i); - if (w == changingw) { - windowPos = i; - windows.takeAt(i); - break; - } - if (!w->isOpaque()) - expose += (w->allocatedRegion() & bound); - } - - bool onTop = changingw->onTop; - -#ifndef QT_NO_QWSEMBEDWIDGET - // an embedded window is on top if the embedder is on top - QWSWindow *embedder = changingw->d->embedder; - while (!onTop && embedder) { - onTop = embedder->onTop; - embedder = embedder->d->embedder; - } -#endif - - int newPos = -1; - if (onTop) { - windows.insert(nReserved, changingw); - newPos = nReserved; - } else { - // insert after "stays on top" windows - bool in = false; - for (int i = nReserved; i < windows.size(); ++i) { - QWSWindow *w = windows.at(i); - if (!w->onTop) { - windows.insert(i, changingw); - in = true; - newPos = i; - break; - } - } - if (!in) { - windows.append(changingw); - newPos = windows.size()-1; - } - } - - if (windowPos != newPos) { - update_regions(); - if (!expose.isEmpty()) - exposeRegion(expose, newPos); - } - changingw->d->state = oldstate; - emit q->windowEvent(changingw, QWSServer::Raise); -} - -void QWSServerPrivate::lowerWindow(QWSWindow *changingw, int /*alt*/) -{ - Q_Q(QWSServer); - if (changingw == windows.last()) - return; - QWSWindow::State oldstate = changingw->d->state; - changingw->d->state = QWSWindow::Lowering; - - int i = windows.indexOf(changingw); - int newIdx = windows.size()-1; - windows.move(i, newIdx); - - const QRegion bound = changingw->allocatedRegion(); - - update_regions(); - - // Expose regions previously overlapped by transparent window - if (!changingw->isOpaque()) { - QRegion expose; - for (int j = i; j < windows.size() - 1; ++j) - expose += (windows.at(j)->allocatedRegion() & bound); - if (!expose.isEmpty()) - exposeRegion(expose, newIdx); - } - - changingw->d->state = oldstate; - emit q->windowEvent(changingw, QWSServer::Lower); -} - -void QWSServerPrivate::update_regions() -{ - if (disablePainting) - return; - - QRegion available = QRect(0, 0, qt_screen->width(), qt_screen->height()); - QRegion transparentRegion; - - // only really needed if there are unbuffered surfaces... - const bool doLock = (clientMap.size() > 1); - if (doLock) - QWSDisplay::grab(true); - - for (int i = 0; i < windows.count(); ++i) { - QWSWindow *w = windows.at(i); - QRegion r = (w->requested_region & available); - -#ifndef QT_NO_QWSEMBEDWIDGET - // Subtract regions needed for embedded windows - const int n = w->d->embedded.size(); - for (int i = 0; i < n; ++i) - r -= w->d->embedded.at(i)->allocatedRegion(); - - // Limited to the embedder region - if (w->d->embedder) - r &= w->d->embedder->requested_region; -#endif // QT_NO_QWSEMBEDWIDGET - - QWSWindowSurface *surface = w->windowSurface(); - const bool opaque = w->isOpaque() - && (w->d->painted || !surface || !surface->isBuffered()); - - if (!opaque) { - transparentRegion += r; - } else { - if (surface && (surface->isRegionReserved() || !surface->isBuffered())) - r -= transparentRegion; - available -= r; - } - - if (r != w->allocatedRegion()) { - w->setAllocatedRegion(r); - w->client()->sendRegionEvent(w->winId(), r, - QWSRegionEvent::Allocation); - } - -#ifdef QT_QWS_CLIENTBLIT -#ifdef QT_NO_QWS_CURSOR - // This optimization only really works when there isn't a crazy cursor - // wizzing around. - QRegion directPaint = (r - transparentRegion); // in gloal coords - if(directPaint != w->directPaintRegion()) { - w->setDirectPaintRegion(directPaint); - static int id = 0; - surface->setDirectRegion(directPaint, ++id); - w->client()->sendRegionEvent(w->winId(), directPaint, - QWSRegionEvent::DirectPaint, id); - } -#endif -#endif - } - - if (doLock) - QWSDisplay::ungrab(); -} - -void QWSServerPrivate::moveWindowRegion(QWSWindow *changingw, int dx, int dy) -{ - if (!changingw) - return; - - QWSWindow::State oldState = changingw->d->state; - changingw->d->state = QWSWindow::Moving; - const QRegion oldRegion(changingw->allocatedRegion()); - changingw->requested_region.translate(dx, dy); - - // hw: Even if the allocated region doesn't change, the requested region - // region has changed and we need to send region events. - // Resetting the allocated region to force update_regions to send events. - changingw->setAllocatedRegion(QRegion()); - update_regions(); - const QRegion newRegion(changingw->allocatedRegion()); - - QWSWindowSurface *surface = changingw->windowSurface(); - QRegion expose; - if (surface) - expose = surface->move(QPoint(dx, dy), changingw->allocatedRegion()); - else - expose = oldRegion + newRegion; - - if (!changingw->d->painted && !expose.isEmpty()) - expose = oldRegion - newRegion; - - int idx = windows.indexOf(changingw); - exposeRegion(expose, idx); - changingw->d->state = oldState; -} - -/*! - Changes the requested region of window \a changingw to \a r - If \a changingw is 0, the server's reserved region is changed. -*/ -void QWSServerPrivate::setWindowRegion(QWSWindow* changingw, const QRegion &r) -{ - if (!changingw) { - qWarning("Not implemented in this release"); - return; - } - - if (changingw->requested_region == r) - return; - - const QRegion oldRegion(changingw->allocatedRegion()); - changingw->requested_region = r; - update_regions(); - const QRegion newRegion(changingw->allocatedRegion()); - - int idx = windows.indexOf(changingw); - exposeRegion(oldRegion - newRegion, idx); -} - - -void QWSServerPrivate::exposeRegion(const QRegion &r, int changing) -{ - if (disablePainting) - return; - - if (r.isEmpty()) - return; - - static bool initial = true; - if (initial) { - changing = 0; - initial = false; - qt_screen->exposeRegion(qt_screen->region(), changing); - } else { - qt_screen->exposeRegion(r, changing); - } -} - -/*! - Closes all pointer devices (specified by the QWS_MOUSE_PROTO - environment variable) by deleting the associated mouse drivers. - - \sa openMouse(), mouseHandler() -*/ -void QWSServer::closeMouse() -{ - Q_D(QWSServer); - qDeleteAll(d->mousehandlers); - d->mousehandlers.clear(); -} - -/*! - Opens the mouse devices specified by the QWS_MOUSE_PROTO - environment variable. Be advised that closeMouse() is called first - to delete all the existing mouse handlers. This behaviour could be - the cause of problems if you were not expecting it. - - \sa closeMouse(), mouseHandler() -*/ -void QWSServer::openMouse() -{ - Q_D(QWSServer); - QString mice = QString::fromLatin1(qgetenv("QWS_MOUSE_PROTO")); -#if defined(QT_QWS_CASSIOPEIA) - if (mice.isEmpty()) - mice = QLatin1String("TPanel:/dev/tpanel"); -#endif - if (mice.isEmpty()) - mice = *defaultMouse(); - closeMouse(); - bool needviscurs = true; - if (mice != QLatin1String("None")) { - const QStringList mouse = mice.split(QLatin1Char(' ')); - for (int i = mouse.size() - 1; i >= 0; --i) { - QWSMouseHandler *handler = d->newMouseHandler(mouse.at(i)); - setMouseHandler(handler); - /* XXX handle mouse cursor visibility sensibly - if (!h->inherits("QCalibratedMouseHandler")) - needviscurs = true; - */ - } - } -#ifndef QT_NO_QWS_CURSOR - setCursorVisible(needviscurs); -#else - Q_UNUSED(needviscurs) -#endif -} - -/*! - Suspends pointer handling by deactivating all the mouse drivers - registered by the QWS_MOUSE_PROTO environment variable. - - - \sa resumeMouse(), QWSMouseHandler::suspend() -*/ -void QWSServer::suspendMouse() -{ - Q_D(QWSServer); - for (int i=0; i < d->mousehandlers.size(); ++i) - d->mousehandlers.at(i)->suspend(); -} - -/*! - Resumes pointer handling by reactivating all the mouse drivers - registered by the QWS_MOUSE_PROTO environment variable. - - \sa suspendMouse(), QWSMouseHandler::resume() -*/ -void QWSServer::resumeMouse() -{ - Q_D(QWSServer); - for (int i=0; i < d->mousehandlers.size(); ++i) - d->mousehandlers.at(i)->resume(); -} - - - -QWSMouseHandler* QWSServerPrivate::newMouseHandler(const QString& spec) -{ - int c = spec.indexOf(QLatin1Char(':')); - QString mouseProto; - QString mouseDev; - if (c >= 0) { - mouseProto = spec.left(c); - mouseDev = spec.mid(c+1); - } else { - mouseProto = spec; - } - - int screen = -1; - const QList regexps = QList() - << QRegExp(QLatin1String(":screen=(\\d+)\\b")) - << QRegExp(QLatin1String("\\bscreen=(\\d+):")); - for (int i = 0; i < regexps.size(); ++i) { - QRegExp regexp = regexps.at(i); - if (regexp.indexIn(mouseDev) == -1) - continue; - screen = regexp.cap(1).toInt(); - mouseDev.remove(regexp.pos(0), regexp.matchedLength()); - break; - } - - QWSMouseHandler *handler = 0; - handler = QMouseDriverFactory::create(mouseProto, mouseDev); - if (screen != -1) - handler->setScreen(qt_screen->subScreens().at(screen)); - - return handler; -} - -#ifndef QT_NO_QWS_KEYBOARD - -/*! - Closes all the keyboard devices (specified by the QWS_KEYBOARD - environment variable) by deleting the associated keyboard - drivers. - - \sa openKeyboard(), keyboardHandler() -*/ -void QWSServer::closeKeyboard() -{ - Q_D(QWSServer); - qDeleteAll(d->keyboardhandlers); - d->keyboardhandlers.clear(); -} - -/*! - Returns the primary keyboard driver. - - Note that this function can only be used in the server process. - - \sa setKeyboardHandler(), openKeyboard(), closeKeyboard() -*/ -QWSKeyboardHandler* QWSServer::keyboardHandler() -{ - return qwsServerPrivate->keyboardhandlers.first(); -} - -/*! - \fn void QWSServer::setKeyboardHandler(QWSKeyboardHandler* driver) - - Sets the primary keyboard driver to be the given \a driver. - - \l{Qt for Embedded Linux} provides several ready-made keyboard drivers, and - custom drivers are typically added using Qt's plugin - mechanism. See the \l{Qt for Embedded Linux Character Input} documentation - for details. - - Note that this function can only be used in the server process. - - \sa keyboardHandler(), setDefaultKeyboard() -*/ -void QWSServer::setKeyboardHandler(QWSKeyboardHandler* kh) -{ - if (!kh) - return; - qwsServerPrivate->keyboardhandlers.removeAll(kh); - qwsServerPrivate->keyboardhandlers.prepend(kh); -} - -/*! - Opens the keyboard devices specified by the QWS_KEYBOARD - environment variable. - - \sa closeKeyboard(), keyboardHandler() -*/ -void QWSServer::openKeyboard() -{ - QString keyboards = QString::fromLatin1(qgetenv("QWS_KEYBOARD")); -#if defined(QT_QWS_CASSIOPEIA) - if (keyboards.isEmpty()) - keyboards = QLatin1String("Buttons"); -#endif - if (keyboards.isEmpty()) - keyboards = *defaultKeyboard(); - - closeKeyboard(); - if (keyboards == QLatin1String("None")) - return; - - QString device; - QString type; - QStringList keyboard = keyboards.split(QLatin1Char(' ')); - for (int i = keyboard.size() - 1; i >= 0; --i) { - const QString spec = keyboard.at(i); - int colon=spec.indexOf(QLatin1Char(':')); - if (colon>=0) { - type = spec.left(colon); - device = spec.mid(colon+1); - } else { - type = spec; - device = QString(); - } - QWSKeyboardHandler *handler = QKbdDriverFactory::create(type, device); - setKeyboardHandler(handler); - } -} - -#endif //QT_NO_QWS_KEYBOARD - -QPoint QWSServer::mousePosition; -QBrush *QWSServerPrivate::bgBrush = 0; - -void QWSServerPrivate::move_region(const QWSRegionMoveCommand *cmd) -{ - QWSClient *serverClient = clientMap.value(-1); - invokeRegionMove(cmd, serverClient); -} - -void QWSServerPrivate::set_altitude(const QWSChangeAltitudeCommand *cmd) -{ - QWSClient *serverClient = clientMap.value(-1); - invokeSetAltitude(cmd, serverClient); -} - -void QWSServerPrivate::set_opacity(const QWSSetOpacityCommand *cmd) -{ - QWSClient *serverClient = clientMap.value(-1); - invokeSetOpacity(cmd, serverClient); -} - - -void QWSServerPrivate::request_focus(const QWSRequestFocusCommand *cmd) -{ - invokeSetFocus(cmd, clientMap.value(-1)); -} - -void QWSServerPrivate::set_identity(const QWSIdentifyCommand *cmd) -{ - invokeIdentify(cmd, clientMap.value(-1)); -} - -void QWSServerPrivate::repaint_region(int wid, int windowFlags, bool opaque, - const QRegion ®ion) -{ - QWSWindow* changingw = findWindow(wid, 0); - if (!changingw) { - return; - } - - const bool isOpaque = changingw->opaque; - const bool wasPainted = changingw->d->painted; - changingw->opaque = opaque; - changingw->d->windowFlags = QFlag(windowFlags); - changingw->d->dirtyOnScreen |= region; - changingw->d->painted = true; - if (isOpaque != opaque || !wasPainted) - update_regions(); - - int level = windows.indexOf(changingw); - exposeRegion(region, level); - changingw->d->dirtyOnScreen = QRegion(); -} - -QRegion QWSServerPrivate::reserve_region(QWSWindow *win, const QRegion ®ion) -{ - QRegion r = region; - - int oldPos = windows.indexOf(win); - int newPos = oldPos < nReserved ? nReserved - 1 : nReserved; - for (int i = 0; i < nReserved; ++i) { - if (i != oldPos) { - QWSWindow *w = windows.at(i); - r -= w->requested_region; - } - } - windows.move(oldPos, newPos); - nReserved = newPos + 1; - - return r; -} - -void QWSServerPrivate::request_region(int wid, const QString &surfaceKey, - const QByteArray &surfaceData, - const QRegion ®ion) -{ - QWSWindow *changingw = findWindow(wid, 0); - if (!changingw) - return; - - Q_Q(QWSServer); - QWSWindow::State windowState = QWSWindow::NoState; - - if (region.isEmpty()) { - windowState = QWSWindow::Hiding; - emit q->windowEvent(changingw, QWSServer::Hide); - } - - const bool wasOpaque = changingw->opaque; - - changingw->createSurface(surfaceKey, surfaceData); - QWSWindowSurface *surface = changingw->windowSurface(); - - changingw->opaque = surface->isOpaque(); - - QRegion r; - if (surface->isRegionReserved()) - r = reserve_region(changingw, region); - else - r = region; - - if (!region.isEmpty()) { - if (changingw->isVisible()) - windowState = QWSWindow::ChangingGeometry; - else - windowState = QWSWindow::Showing; - } - changingw->d->state = windowState; - - if (!r.isEmpty() && wasOpaque != changingw->opaque && surface->isBuffered()) - changingw->requested_region = QRegion(); // XXX: force update_regions - - const QRegion oldAllocated = changingw->allocatedRegion(); - setWindowRegion(changingw, r); - if (oldAllocated == changingw->allocatedRegion()) { - // Always send region event to the requesting window even if the - // region didn't change. This is necessary as the client will reset - // the clip region until an event is received. - changingw->client()->sendRegionEvent(wid, changingw->allocatedRegion(), - QWSRegionEvent::Allocation); - } - - surface->QWindowSurface::setGeometry(r.boundingRect()); - - if (windowState == QWSWindow::Showing) - emit q->windowEvent(changingw, QWSServer::Show); - else if (windowState == QWSWindow::ChangingGeometry) - emit q->windowEvent(changingw, QWSServer::Geometry); - if (windowState == QWSWindow::Hiding) { - handleWindowClose(changingw); - changingw->d->state = QWSWindow::Hidden; - changingw->d->painted = false; - } else { - changingw->d->state = QWSWindow::Visible; - } -} - -void QWSServerPrivate::destroy_region(const QWSRegionDestroyCommand *cmd) -{ - invokeRegionDestroy(cmd, clientMap.value(-1)); -} - -void QWSServerPrivate::name_region(const QWSRegionNameCommand *cmd) -{ - invokeRegionName(cmd, clientMap.value(-1)); -} - -#ifndef QT_NO_QWS_INPUTMETHODS -void QWSServerPrivate::im_response(const QWSIMResponseCommand *cmd) - { - invokeIMResponse(cmd, clientMap.value(-1)); -} - -void QWSServerPrivate::im_update(const QWSIMUpdateCommand *cmd) -{ - invokeIMUpdate(cmd, clientMap.value(-1)); -} - -void QWSServerPrivate::send_im_mouse(const QWSIMMouseCommand *cmd) -{ - if (current_IM) - current_IM->mouseHandler(cmd->simpleData.index, cmd->simpleData.state); -} -#endif - -void QWSServerPrivate::openDisplay() -{ - qt_init_display(); - -// rgnMan = qt_fbdpy->regionManager(); - swidth = qt_screen->deviceWidth(); - sheight = qt_screen->deviceHeight(); -} - -void QWSServerPrivate::closeDisplay() -{ - if (qt_screen) - qt_screen->shutdownDevice(); -} - -/*! - Returns the brush used as background in the absence of obscuring - windows. - - \sa setBackground() -*/ -const QBrush &QWSServer::backgroundBrush() const -{ - return *QWSServerPrivate::bgBrush; -} - -/*! - Sets the brush used as background in the absence of obscuring - windows, to be the given \a brush. - - Note that this function can only be used in the server process. - - \sa backgroundBrush() -*/ -void QWSServer::setBackground(const QBrush &brush) -{ - if (!QWSServerPrivate::bgBrush) - QWSServerPrivate::bgBrush = new QBrush(brush); - else - *QWSServerPrivate::bgBrush = brush; - if (!qwsServer) - return; - qt_screen->exposeRegion(QRect(0,0,qt_screen->width(), qt_screen->height()), 0); -} - - -#ifdef QT3_SUPPORT -/*! - \fn void QWSServer::setDesktopBackground(const QImage &image) - - Sets the image used as background in the absence of obscuring - windows, to be the given \a image. - - Use the setBackground() function instead. - - \oldcode - QImage image; - setDesktopBackground(image); - \newcode - QImage image; - setBackground(QBrush(image)); - \endcode -*/ -void QWSServer::setDesktopBackground(const QImage &img) -{ - if (img.isNull()) - setBackground(Qt::NoBrush); - else - setBackground(QBrush(QPixmap::fromImage(img))); -} - -/*! - \fn void QWSServer::setDesktopBackground(const QColor &color) - \overload - - Sets the color used as background in the absence of obscuring - windows, to be the given \a color. - - Use the setBackground() function instead. - - \oldcode - QColor color; - setDesktopBackground(color); - \newcode - QColor color; - setBackground(QBrush(color)); - \endcode -*/ -void QWSServer::setDesktopBackground(const QColor &c) -{ - setBackground(QBrush(c)); -} -#endif //QT3_SUPPORT - -/*! - \internal - */ -void QWSServer::startup(int flags) -{ - if (qwsServer) - return; - unlink(qws_qtePipeFilename().toLatin1().constData()); - (void)new QWSServer(flags); -} - -/*! - \internal -*/ - -void QWSServer::closedown() -{ - QScopedPointer server(qwsServer); - qwsServer = 0; - QT_TRY { - unlink(qws_qtePipeFilename().toLatin1().constData()); - } QT_CATCH(const std::bad_alloc &) { - // ### TODO - what to do when we run out of memory - // when calling toLatin1? - } -} - -void QWSServerPrivate::emergency_cleanup() -{ -#ifndef QT_NO_QWS_KEYBOARD - if (qwsServer) - qwsServer->closeKeyboard(); -#endif -} - -#ifndef QT_NO_QWS_KEYBOARD -static QList *keyFilters = 0; - -/*! - Processes the given key event. The key is identified by its \a - unicode value and the given \a keycode, \a modifiers, \a isPress - and \a autoRepeat parameters. - - The \a keycode parameter is the Qt keycode value as defined by the - Qt::Key enum. The \a modifiers is an OR combination of - Qt::KeyboardModifier values, indicating whether \gui - Shift/Alt/Ctrl keys are pressed. The \a isPress parameter is true - if the event is a key press event and \a autoRepeat is true if the - event is caused by an auto-repeat mechanism and not an actual key - press. - - This function is typically called internally by keyboard drivers. - Note that this function can only be used in the server process. - - \sa sendKeyEvent(), {Qt for Embedded Linux Character Input} -*/ -void QWSServer::processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, - bool isPress, bool autoRepeat) -{ - bool block; - // Don't block the POWER or LIGHT keys - if ( keycode == Qt::Key_F34 || keycode == Qt::Key_F35 ) - block = false; - else - block = qwsServerPrivate->screensaverblockevent(KEY, qwsServerPrivate->screensaverinterval, isPress); - -#ifdef EVENT_BLOCK_DEBUG - qDebug() << "processKeyEvent" << unicode << keycode << modifiers << isPress << autoRepeat << (block ? "block" : "pass"); -#endif - - // If we press a key and it's going to be blocked, wake up the screen - if ( block && isPress ) - qwsServerPrivate->_q_screenSaverWake(); - - if ( block ) - return; - - if (keyFilters) { - for (int i = 0; i < keyFilters->size(); ++i) { - QWSServer::KeyboardFilter *keyFilter = keyFilters->at(i); - if (keyFilter->filter(unicode, keycode, modifiers, isPress, autoRepeat)) - return; - } - } - sendKeyEvent(unicode, keycode, modifiers, isPress, autoRepeat); -} - -/*! - \fn void QWSServer::addKeyboardFilter(KeyboardFilter *filter) - - Activates the given keyboard \a filter all key events generated by - physical keyboard drivers (i.e., events sent using the - processKeyEvent() function). - - Note that the filter is not invoked for keys generated by \e - virtual keyboard drivers (i.e., events sent using the - sendKeyEvent() function). - - Note that this function can only be used in the server process. - - \sa removeKeyboardFilter() -*/ -void QWSServer::addKeyboardFilter(KeyboardFilter *f) -{ - if (!keyFilters) - keyFilters = new QList; - if (f) { - keyFilters->prepend(f); - } -} - -/* -//####### - We should probably obsolete the whole keyboard filter thing since - it's not useful for input methods anyway - - We could do removeKeyboardFilter(KeyboardFilter *f), but - the "remove and delete the filter" concept does not match "user - remembers the pointer". -*/ - -/*! - Removes and deletes the most recently added filter. - - Note that the programmer is responsible for removing each added - keyboard filter. - - Note that this function can only be used in the server process. - - \sa addKeyboardFilter() -*/ -void QWSServer::removeKeyboardFilter() -{ - if (!keyFilters || keyFilters->isEmpty()) - return; - delete keyFilters->takeAt(0); -} -#endif // QT_NO_QWS_KEYBOARD - -/*! - \fn void QWSServer::setScreenSaverIntervals(int* intervals) - - Specifies the time \a intervals (in milliseconds) between the - different levels of screen responsiveness. - - \l{Qt for Embedded Linux} supports multilevel screen saving, i.e., it is - possible to specify several different levels of screen - responsiveness by implementing the QWSScreenSaver::save() - function. For example, you can choose to first turn off the light - before you fully activate the screensaver. See the QWSScreenSaver - documentation for details. - - Note that an interval of 0 milliseconds will turn off the - screensaver, and that the \a intervals array must be 0-terminated. - This function can only be used in the server process. - - \sa setScreenSaverInterval(), setScreenSaverBlockLevel() -*/ -void QWSServer::setScreenSaverIntervals(int* ms) -{ - if (!qwsServerPrivate) - return; - - delete [] qwsServerPrivate->screensaverintervals; - if (ms) { - int* t=ms; - int n=0; - while (*t++) n++; - if (n) { - n++; // the 0 - qwsServerPrivate->screensaverintervals = new int[n]; - memcpy(qwsServerPrivate->screensaverintervals, ms, n*sizeof(int)); - } else { - qwsServerPrivate->screensaverintervals = 0; - } - } else { - qwsServerPrivate->screensaverintervals = 0; - } - qwsServerPrivate->screensaverinterval = 0; - - qwsServerPrivate->screensavertimer->stop(); - qt_screen->blank(false); - qwsServerPrivate->_q_screenSaverWake(); -} - -/*! - \fn void QWSServer::setScreenSaverInterval(int milliseconds) - - Sets the timeout interval for the screensaver to the specified \a - milliseconds. To turn off the screensaver, set the timout interval - to 0. - - Note that this function can only be used in the server process. - - \sa setScreenSaverIntervals(), setScreenSaverBlockLevel() -*/ -void QWSServer::setScreenSaverInterval(int ms) -{ - int v[2]; - v[0] = ms; - v[1] = 0; - setScreenSaverIntervals(v); -} - -/*! - Block the key or mouse event that wakes the system from level \a eventBlockLevel or higher. - To completely disable event blocking (the default behavior), set \a eventBlockLevel to -1. - - The algorithm blocks the "down", "up" as well as any "repeat" events for the same key - but will not block other key events after the initial "down" event. For mouse events, the - algorithm blocks all mouse events until an event with no buttons pressed is received. - - There are 2 keys that are never blocked, Qt::Key_F34 (POWER) and Qt::Key_F35 (LIGHT). - - Example usage: - - \snippet doc/src/snippets/code/src_gui_embedded_qwindowsystem_qws.cpp 0 - - Note that this function can only be used in the server process. - - \sa setScreenSaverIntervals(), setScreenSaverInterval() -*/ -void QWSServer::setScreenSaverBlockLevel(int eventBlockLevel) -{ - if (!qwsServerPrivate) - return; - qwsServerPrivate->screensavereventblocklevel = eventBlockLevel; -#ifdef EVENT_BLOCK_DEBUG - qDebug() << "QWSServer::setScreenSaverBlockLevel() " << eventBlockLevel; -#endif -} - -extern bool qt_disable_lowpriority_timers; //in qeventloop_unix.cpp - -void QWSServerPrivate::_q_screenSaverWake() -{ - if (screensaverintervals) { - if (screensaverinterval != screensaverintervals) { - if (saver) saver->restore(); - screensaverinterval = screensaverintervals; - screensaverblockevents = false; - } else { - if (!screensavertimer->isActive()) { - qt_screen->blank(false); - if (saver) saver->restore(); - } - } - screensavertimer->start(*screensaverinterval); - screensavertime.start(); - } - qt_disable_lowpriority_timers=false; -} - -void QWSServerPrivate::_q_screenSaverSleep() -{ - qt_screen->blank(true); -#if !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) - screensavertimer->stop(); -#else - if (screensaverinterval) { - screensavertimer->start(*screensaverinterval); - screensavertime.start(); - } else { - screensavertimer->stop(); - } -#endif - qt_disable_lowpriority_timers=true; -} - -/*! - \fn void QWSServer::setScreenSaver(QWSScreenSaver* screenSaver) - - Installs the given \a screenSaver, deleting the current screen - saver. - - Note that this function can only be used in the server process. - - \sa screenSaverActivate(), setScreenSaverInterval(), setScreenSaverIntervals(), setScreenSaverBlockLevel() -*/ -void QWSServer::setScreenSaver(QWSScreenSaver* ss) -{ - QWSServerPrivate *qd = qwsServer->d_func(); - delete qd->saver; - qd->saver = ss; -} - -void QWSServerPrivate::screenSave(int level) -{ - if (saver) { - // saver->save() may call QCoreApplication::processEvents, - // block event before calling saver->save(). - bool oldScreensaverblockevents = screensaverblockevents; - if (*screensaverinterval >= 1000) { - screensaverblockevents = (screensavereventblocklevel >= 0 && screensavereventblocklevel <= level); -#ifdef EVENT_BLOCK_DEBUG - if (screensaverblockevents) - qDebug("ready to block events"); -#endif - } - int *oldScreensaverinterval = screensaverinterval; - if (saver->save(level)) { - // only update screensaverinterval if it hasn't already changed - if (oldScreensaverinterval == screensaverinterval) { - if (screensaverinterval && screensaverinterval[1]) { - screensavertimer->start(*++screensaverinterval); - screensavertime.start(); - } else { - screensaverinterval = 0; - } - } - } else { - // restore previous state - screensaverblockevents = oldScreensaverblockevents; - - // for some reason, the saver don't want us to change to the - // next level, so we'll stay at this level for another interval - if (screensaverinterval && *screensaverinterval) { - screensavertimer->start(*screensaverinterval); - screensavertime.start(); - } - } - } else { - screensaverinterval = 0;//screensaverintervals; - screensaverblockevents = false; - _q_screenSaverSleep(); - } -} - -void QWSServerPrivate::_q_screenSaverTimeout() -{ - if (screensaverinterval) { - if (screensavertime.elapsed() > *screensaverinterval*2) { - // bogus (eg. unsuspend, system time changed) - _q_screenSaverWake(); // try again - return; - } - screenSave(screensaverinterval - screensaverintervals); - } -} - -/*! - Returns true if the screen saver is active; otherwise returns - false. - - Note that this function can only be used in the server process. - - \sa screenSaverActivate() -*/ -bool QWSServer::screenSaverActive() -{ - return qwsServerPrivate->screensaverinterval - && !qwsServerPrivate->screensavertimer->isActive(); -} - -/*! - \internal -*/ -void QWSServer::updateWindowRegions() const -{ - qwsServerPrivate->update_regions(); -} - -/*! - Activates the screen saver if \a activate is true; otherwise it is - deactivated. - - Note that this function can only be used in the server process. - - \sa screenSaverActive(), setScreenSaver() -*/ -void QWSServer::screenSaverActivate(bool activate) -{ - if (activate) - qwsServerPrivate->_q_screenSaverSleep(); - else - qwsServerPrivate->_q_screenSaverWake(); -} - -void QWSServerPrivate::disconnectClient(QWSClient *c) -{ - QTimer::singleShot(0, c, SLOT(closeHandler())); -} - -void QWSServerPrivate::updateClientCursorPos() -{ - Q_Q(QWSServer); - QWSWindow *win = qwsServerPrivate->mouseGrabber ? qwsServerPrivate->mouseGrabber : qwsServer->windowAt(QWSServer::mousePosition); - QWSClient *winClient = win ? win->client() : 0; - if (winClient && winClient != cursorClient) - q->sendMouseEvent(QWSServer::mousePosition, mouseState); -} - -#ifndef QT_NO_QWS_INPUTMETHODS - -/*! - \class QWSInputMethod - \preliminary - \ingroup qws - - \brief The QWSInputMethod class provides international input methods - in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - A \l{Qt for Embedded Linux} application requires a server application to be - running, or to be the server application itself. All system - generated events, including keyboard and mouse events, are passed - to the server application which then propagates the event to the - appropriate client. - - An input method consists of a filter and optionally a graphical - interface, and is used to filter input events between the server - and the client application. - - \tableofcontents - - \section1 Creating Custom Input Methods - - To implement a custom input method, derive from the QWSInputMethod - class, and use the server's \l - {QWSServer::}{setCurrentInputMethod()} function to install it. - - When subclassing QWSInputMethod, you can reimplement the filter() - functions to handle input from both physical and virtual keyboards - as well as mouse devices. Note that the default implementations do - nothing. Use the setInputResolution() function to control the - number of bits shifted when filtering mouse input, i.e., when - going from pointer resolution to screen resolution (the current - resolution can be retrieved using the inputResolutionShift() - function). - - Reimplement the reset() function to restore the state of the input - method. Note that the default implementation calls the sendEvent() - function with empty preedit and commit strings if the input method - is in compose mode (i.e., if the input method is actively - composing a preedit string). - - To receive replies to an input method query (sent using the - sendQuery() function), you must reimplement the queryResponse() - function, while the mouseHandler() function must be reimplemented - if you want to handle mouse events within the preedit - text. Reimplement the updateHandler() function to handle update - events including resets and focus changes. The UpdateType enum - describes the various types of update events recognized by the - input method. - - \section1 Using Input Methods - - In addition to the filter(), reset(), queryResponse(), - mouseHandler() and updateHandler() function mentioned in the - previous section, the QWSInputMethod provides several other - functions helping the window system to manage the installed input - methods. - - The sendEvent() function sends the given event to the focus - widget, while the sendPreeditString() function sends the given - preedit text (encapsulated by an event). QWSInputMethod also - provides the sendCommitString() convenience function which sends - an event encapsulating the given commit string to the current - focus widget, and the sendMouseEvent() function which sends the - given mouse event. - - Finally, the QWSInputMethod class provides the sendQuery() - function for sending input method queries. This function - encapsulates the event with a QWSEvent instance of the \l - {QWSEvent::}{IMQuery} type. - - \sa QWSServer, {Qt for Embedded Linux Architecture} -*/ - -/*! - Constructs a new input method. - - Use the QWSServer::setCurrentInputMethod() function to install it. -*/ - -QWSInputMethod::QWSInputMethod() -{ - -} - -/*! - Destroys this input method, uninstalling it if it is installed. -*/ -QWSInputMethod::~QWSInputMethod() -{ - if (current_IM == this) - current_IM = 0; -} - -/*! - Filters the key input identified by the given \a unicode, \a - keycode, \a modifiers, \a isPress and \a autoRepeat parameters. - - Note that the default implementation does nothing; reimplement - this function to handle input from both physical and virtual - devices. - - The \a keycode is a Qt::Key value, and the \a modifiers is an OR - combination of Qt::KeyboardModifiers. The \a isPress parameter is - telling whether the input is a key press or key release, and the - \a autoRepeat parameter determines whether the input is - autorepeated ( i.e., in which case the - QWSKeyboardHandler::beginAutoRepeat() function has been called). - - To block the event from further processing, return true when - reimplementing this function; the default implementation returns - false. - - \sa setInputResolution(), inputResolutionShift() -*/ -bool QWSInputMethod::filter(int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat) -{ - Q_UNUSED(unicode); - Q_UNUSED(keycode); - Q_UNUSED(modifiers); - Q_UNUSED(isPress); - Q_UNUSED(autoRepeat); - return false; -} - -/*! - \overload - - Filters the mouse input identified by the given \a position, \a - state, and \a wheel parameters. -*/ -bool QWSInputMethod::filter(const QPoint &position, int state, int wheel) -{ - Q_UNUSED(position); - Q_UNUSED(state); - Q_UNUSED(wheel); - return false; -} - -/*! - Resets the state of the input method. - - If the input method is in compose mode, i.e., the input method is - actively composing a preedit string, the default implementation - calls sendEvent() with empty preedit and commit strings; otherwise - it does nothing. Reimplement this function to alter this behavior. - - \sa sendEvent() -*/ -void QWSInputMethod::reset() -{ - if (current_IM_composing_win) { - QInputMethodEvent ime; - sendEvent(&ime); - } -} - -/*! - \enum QWSInputMethod::UpdateType - - This enum describes the various types of update events recognized - by the input method. - - \value Update The input widget is updated in some way; use sendQuery() with - Qt::ImMicroFocus as an argument for more information. - \value FocusIn A new input widget receives focus. - \value FocusOut The input widget loses focus. - \value Reset The input method should be reset. - \value Destroyed The input widget is destroyed. - - \sa updateHandler() -*/ - -/*! - Handles update events including resets and focus changes. The - update events are specified by the given \a type which is one of - the UpdateType enum values. - - Note that reimplementations of this function must call the base - implementation for all cases that it does not handle itself. - - \sa UpdateType -*/ -void QWSInputMethod::updateHandler(int type) -{ - switch (type) { - case FocusOut: - case Reset: - reset(); - break; - - default: - break; - } -} - - -/*! - Receive replies to an input method query. - - Note that the default implementation does nothing; reimplement - this function to receive such replies. - - Internally, an input method query is passed encapsulated by an \l - {QWSEvent::IMQuery}{IMQuery} event generated by the sendQuery() - function. The queried property and the result is passed in the \a - property and \a result parameters. - - \sa sendQuery(), QWSServer::sendIMQuery() -*/ -void QWSInputMethod::queryResponse(int property, const QVariant &result) -{ - Q_UNUSED(property); - Q_UNUSED(result); -} - - - -/*! - \fn void QWSInputMethod::mouseHandler(int offset, int state) - - Handles mouse events within the preedit text. - - Note that the default implementation resets the input method on - all mouse presses; reimplement this function to alter this - behavior. - - The \a offset parameter specifies the position of the mouse event - within the string, and \a state specifies the type of the mouse - event as described by the QWSServer::IMMouse enum. If \a state is - less than 0, the mouse event is inside the associated widget, but - outside the preedit text. When clicking in a different widget, the - \a state is QWSServer::MouseOutside. - - \sa sendPreeditString(), reset() -*/ -void QWSInputMethod::mouseHandler(int, int state) -{ - if (state == QWSServer::MousePress || state == QWSServer::MouseOutside) - reset(); -} - - -/*! - Sends an event encapsulating the given \a preeditString, to the - focus widget. - - The specified \a selectionLength is the number of characters to be - marked as selected (starting at the given \a cursorPosition). If - \a selectionLength is negative, the text \e before \a - cursorPosition is marked. - - The preedit string is marked with QInputContext::PreeditFormat, - and the selected part is marked with - QInputContext::SelectionFormat. - - Sending an input method event with a non-empty preedit string will - cause the input method to enter compose mode. Sending an input - method event with an empty preedit string will cause the input - method to leave compose mode, i.e., the input method will no longer - be actively composing the preedit string. - - Internally, the event is represented by a QWSEvent object of the - \l {QWSEvent::IMEvent}{IMEvent} type. - - \sa sendEvent(), sendCommitString() -*/ - -void QWSInputMethod::sendPreeditString(const QString &preeditString, int cursorPosition, int selectionLength) -{ - QList attributes; - - int selPos = cursorPosition; - if (selectionLength == 0) { - selPos = 0; - } else if (selectionLength < 0) { - selPos += selectionLength; - selectionLength = -selectionLength; - } - if (selPos > 0) - attributes += QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, selPos, - QVariant(int(QInputContext::PreeditFormat))); - - if (selectionLength) - attributes += QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, selPos, selectionLength, - QVariant(int(QInputContext::SelectionFormat))); - - if (selPos + selectionLength < preeditString.length()) - attributes += QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, - selPos + selectionLength, - preeditString.length() - selPos - selectionLength, - QVariant(int(QInputContext::PreeditFormat))); - - attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPosition, 0, QVariant()); - - QInputMethodEvent ime(preeditString, attributes); - qwsServer->sendIMEvent(&ime); -} - -/*! - \fn void QWSInputMethod::sendCommitString(const QString &commitString, int replaceFromPosition, int replaceLength) - - Sends an event encapsulating the given \a commitString, to the - focus widget. - - Note that this will cause the input method to leave compose mode, - i.e., the input method will no longer be actively composing the - preedit string. - - If the specified \a replaceLength is greater than 0, the commit - string will replace the given number of characters of the - receiving widget's previous text, starting at the given \a - replaceFromPosition relative to the start of the current preedit - string. - - Internally, the event is represented by a QWSEvent object of the - \l {QWSEvent::IMEvent}{IMEvent} type. - - \sa sendEvent(), sendPreeditString() -*/ -void QWSInputMethod::sendCommitString(const QString &commitString, int replaceFrom, int replaceLength) -{ - QInputMethodEvent ime; - ime.setCommitString(commitString, replaceFrom, replaceLength); - qwsServer->sendIMEvent(&ime); -} - -/*! - \fn QWSInputMethod::sendIMEvent(QWSServer::IMState state, const QString &text, int cursorPosition, int selectionLength) - \obsolete - - Sends a QInputMethodEvent object to the focus widget. - - If the specified \a state is QWSServer::IMCompose, \a text is a - preedit string, \a cursorPosition is the cursor's position within - the preedit string, and \a selectionLength is the number of - characters (starting at \a cursorPosition) that should be marked - as selected by the input widget receiving the event. If the - specified \a state is QWSServer::IMEnd, \a text is a commit - string. - - Use sendEvent(), sendPreeditString() or sendCommitString() instead. -*/ - -/*! - \fn QWSInputMethod::sendEvent(const QInputMethodEvent *event) - - Sends the given \a event to the focus widget. - - The \c QInputMethodEvent class is derived from QWSEvent, i.e., the - given \a event is a QWSEvent object of the \l - {QWSEvent::IMEvent}{IMEvent} type. - - \sa sendPreeditString(), sendCommitString(), reset() -*/ - - -/*! - \fn void QWSInputMethod::sendQuery(int property) - - Sends an input method query (internally encapsulated by a QWSEvent - of the \l {QWSEvent::IMQuery}{IMQuery} type) for the specified \a - property. - - To receive responses to input method queries, the virtual - queryResponse() function must be reimplemented. - - \sa queryResponse(), QWSServer::sendIMQuery() -*/ - -/*! - Sets and returns the number of bits shifted to go from pointer - resolution to screen resolution when filtering mouse input. - - If \a isHigh is true and the device has a pointer device - resolution twice or more of the screen resolution, the positions - passed to the filter() function will be presented at the higher - resolution; otherwise the resolution will be equal to that of the - screen resolution. - - \sa inputResolutionShift(), filter() -*/ -uint QWSInputMethod::setInputResolution(bool isHigh) -{ - mIResolution = isHigh; - return inputResolutionShift(); -} - -/*! - Returns the number of bits shifted to go from pointer resolution - to screen resolution when filtering mouse input. - - \sa setInputResolution(), filter() -*/ -uint QWSInputMethod::inputResolutionShift() const -{ - return 0; // default for devices with single resolution. -} - -/*! - \fn void QWSInputMethod::sendMouseEvent( const QPoint &position, int state, int wheel ) - - Sends a mouse event specified by the given \a position, \a state - and \a wheel parameters. - - The given \a position will be transformed if the screen - coordinates do not match the pointer device coordinates. - - Note that the event will be not be tested by the active input - method, but calling the QWSServer::sendMouseEvent() function will - make the current input method filter the event. - - \sa mouseHandler(), sendEvent() -*/ -void QWSInputMethod::sendMouseEvent( const QPoint &pos, int state, int wheel ) -{ - if (qt_last_x) { - *qt_last_x = pos.x(); - *qt_last_y = pos.y(); - } - QWSServer::mousePosition = pos; - qwsServerPrivate->mouseState = state; - QWSServerPrivate::sendMouseEventUnfiltered(pos, state, wheel); -} -#endif // QT_NO_QWS_INPUTMETHODS - -/*! - \fn QWSWindow::QWSWindow(int i, QWSClient * client) - \internal - - Constructs a new top-level window, associated with the client \a - client and giving it the id \a i. -*/ - -/*! - \fn QWSServer::windowEvent(QWSWindow * window, QWSServer::WindowEvent eventType) - - This signal is emitted whenever something happens to a top-level - window (e.g., it's created or destroyed), passing a pointer to the - window and the event's type in the \a window and \a eventType - parameters, respectively. - - \sa markedText() -*/ - -/*! - \class QWSServer::KeyboardFilter - \ingroup qws - - \brief The KeyboardFilter class is a base class for global - keyboard event filters in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - In \l{Qt for Embedded Linux}, all system generated events, including - keyboard events, are passed to the server application which then - propagates the event to the appropriate client. The KeyboardFilter - class is used to implement a global, low-level filter on the - server side. The server applies the filter to all keyboard events - before passing them on to the clients: - - \image qwsserver_keyboardfilter.png - - This feature can, for example, be used to filter things like APM - (advanced power management) suspended from a button without having - to filter for it in all applications. - - To add a new keyboard filter you must first create the filter by - deriving from this class, reimplementing the pure virtual filter() - function. Then you can install the filter on the server using - QWSServer's \l {QWSServer::}{addKeyboardFilter()} - function. QWSServer also provides a \l - {QWSServer::}{removeKeyboardFilter()} function. - - \sa {Qt for Embedded Linux Architecture}, QWSServer, QWSInputMethod -*/ - -/*! - \fn QWSServer::KeyboardFilter::~KeyboardFilter() - - Destroys the keyboard filter. -*/ - -/*! - \fn bool QWSServer::KeyboardFilter::filter(int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat) - - Implement this function to return true if a given key event should - be stopped from being processed any further; otherwise it should - return false. - - A key event can be identified by the given \a unicode value and - the \a keycode, \a modifiers, \a isPress and \a autoRepeat - parameters. - - The \a keycode parameter is the Qt keycode value as defined by the - Qt::Key enum. The \a modifiers is an OR combination of - Qt::KeyboardModifier values, indicating whether \gui - Shift/Alt/Ctrl keys are pressed. The \a isPress parameter is true - if the event is a key press event and \a autoRepeat is true if the - event is caused by an auto-repeat mechanism and not an actual key - press. -*/ - -QT_END_NAMESPACE - -#include "moc_qwindowsystem_qws.cpp" diff --git a/src/gui/embedded/qwindowsystem_qws.h b/src/gui/embedded/qwindowsystem_qws.h deleted file mode 100644 index 0b73a76bf90..00000000000 --- a/src/gui/embedded/qwindowsystem_qws.h +++ /dev/null @@ -1,508 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSYSTEM_QWS_H -#define QWINDOWSYSTEM_QWS_H - -#include -#include -#include -#include - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -struct QWSWindowPrivate; -class QWSCursor; -class QWSClient; -class QWSRegionManager; -class QBrush; -class QVariant; -class QInputMethodEvent; -class QWSInputMethod; -class QWSBackingStore; -class QWSWindowSurface; - -#ifdef QT3_SUPPORT -class QImage; -class QColor; -#endif - -class QWSInternalWindowInfo -{ -public: - int winid; - unsigned int clientid; - QString name; // Corresponds to QObject name of top-level widget -}; - - -class Q_GUI_EXPORT QWSScreenSaver -{ -public: - virtual ~QWSScreenSaver(); - virtual void restore()=0; - virtual bool save(int level)=0; -}; - - -class Q_GUI_EXPORT QWSWindow -{ - friend class QWSServer; - friend class QWSServerPrivate; - -public: - QWSWindow(int i, QWSClient* client); - ~QWSWindow(); - - int winId() const { return id; } - const QString &name() const { return rgnName; } - const QString &caption() const { return rgnCaption; } - QWSClient* client() const { return c; } - const QRegion &requestedRegion() const { return requested_region; } - QRegion allocatedRegion() const; - QRegion paintedRegion() const; - bool isVisible() const { return !requested_region.isEmpty(); } - bool isPartiallyObscured() const { return requested_region != allocatedRegion(); } - bool isFullyObscured() const { return allocatedRegion().isEmpty(); } - - enum State { NoState, Hidden, Showing, Visible, Hiding, Raising, Lowering, Moving, ChangingGeometry, Destroyed }; - State state() const; - Qt::WindowFlags windowFlags() const; - QRegion dirtyOnScreen() const; - - void raise(); - void lower(); - void show(); - void hide(); - void setActiveWindow(); - - bool isOpaque() const {return opaque && _opacity == 255;} - uint opacity() const { return _opacity; } - - QWSWindowSurface* windowSurface() const { return surface; } - -private: - bool hidden() const { return requested_region.isEmpty(); } - bool forClient(const QWSClient* cl) const { return cl==c; } - - void setName(const QString &n); - void setCaption(const QString &c); - - void focus(bool get); - int focusPriority() const { return last_focus_time; } - void operation(QWSWindowOperationEvent::Operation o); - void shuttingDown() { last_focus_time=0; } - -#ifdef QT_QWS_CLIENTBLIT - QRegion directPaintRegion() const; - inline void setDirectPaintRegion(const QRegion &topmost); -#endif - inline void setAllocatedRegion(const QRegion ®ion); - - void createSurface(const QString &key, const QByteArray &data); - -#ifndef QT_NO_QWSEMBEDWIDGET - void startEmbed(QWSWindow *window); - void stopEmbed(QWSWindow *window); -#endif - -private: - int id; - QString rgnName; - QString rgnCaption; - bool modified; - bool onTop; - QWSClient* c; - QRegion requested_region; - QRegion exposed; - int last_focus_time; - QWSWindowSurface *surface; - uint _opacity; - bool opaque; - QWSWindowPrivate *d; -#ifdef QT3_SUPPORT - inline QT3_SUPPORT QRegion requested() const { return requested_region; } -// inline QT3_SUPPORT QRegion allocation() const { return allocated_region; } -#endif -}; - - -#ifndef QT_NO_SOUND -class QWSSoundServer; -#ifdef QT_USE_OLD_QWS_SOUND -class QWSSoundServerData; - -class Q_GUI_EXPORT QWSSoundServer : public QObject { - Q_OBJECT -public: - QWSSoundServer(QObject* parent); - ~QWSSoundServer(); - void playFile(const QString& filename); -private Q_SLOTS: - void feedDevice(int fd); -private: - QWSSoundServerData* d; -}; -#endif -#endif - - -/********************************************************************* - * - * Class: QWSServer - * - *********************************************************************/ - -class QWSMouseHandler; -struct QWSCommandStruct; -class QWSServerPrivate; -class QWSServer; - -extern Q_GUI_EXPORT QWSServer *qwsServer; - -class Q_GUI_EXPORT QWSServer : public QObject -{ - friend class QCopChannel; - friend class QWSMouseHandler; - friend class QWSWindow; - friend class QWSDisplay; - friend class QWSInputMethod; - Q_OBJECT - Q_DECLARE_PRIVATE(QWSServer) -public: - explicit QWSServer(int flags = 0, QObject *parent=0); -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QWSServer(int flags, QObject *parent, const char *name); -#endif - ~QWSServer(); - enum ServerFlags { DisableKeyboard = 0x01, - DisableMouse = 0x02 }; - - static void sendKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, - bool isPress, bool autoRepeat); -#ifndef QT_NO_QWS_KEYBOARD - static void processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, - bool isPress, bool autoRepeat); -#endif - - static QWSServer* instance() { return qwsServer; } - -#ifndef QT_NO_QWS_INPUTMETHODS -#ifdef QT3_SUPPORT - enum IMState { IMCompose, IMEnd, IMStart = IMCompose }; -#endif - enum IMMouse { MousePress, MouseRelease, MouseMove, MouseOutside }; //MouseMove reserved but not used - void sendIMEvent(const QInputMethodEvent*); - void sendIMQuery(int property); -#endif - -#ifndef QT_NO_QWS_KEYBOARD - class KeyboardFilter - { - public: - virtual ~KeyboardFilter() {} - virtual bool filter(int unicode, int keycode, int modifiers, - bool isPress, bool autoRepeat)=0; - }; - static void addKeyboardFilter(KeyboardFilter *f); - static void removeKeyboardFilter(); -#endif - -#ifndef QT_NO_QWS_INPUTMETHODS - static void setCurrentInputMethod(QWSInputMethod *im); - static void resetInputMethod(); -#endif - - static void setDefaultMouse(const char *); - static void setDefaultKeyboard(const char *); - static void setMaxWindowRect(const QRect&); - static void sendMouseEvent(const QPoint& pos, int state, int wheel = 0); - - static void setBackground(const QBrush &); -#ifdef QT3_SUPPORT - static QT3_SUPPORT void setDesktopBackground(const QImage &img); - static QT3_SUPPORT void setDesktopBackground(const QColor &); -#endif - static QWSMouseHandler *mouseHandler(); - static const QList& mouseHandlers(); - static void setMouseHandler(QWSMouseHandler*); -#ifndef QT_NO_QWS_KEYBOARD - static QWSKeyboardHandler* keyboardHandler(); - static void setKeyboardHandler(QWSKeyboardHandler* kh); -#endif - QWSWindow *windowAt(const QPoint& pos); - - const QList &clientWindows(); - - void openMouse(); - void closeMouse(); - void suspendMouse(); - void resumeMouse(); -#ifndef QT_NO_QWS_KEYBOARD - void openKeyboard(); - void closeKeyboard(); -#endif - - static void setScreenSaver(QWSScreenSaver*); - static void setScreenSaverIntervals(int* ms); - static void setScreenSaverInterval(int); - static void setScreenSaverBlockLevel(int); - static bool screenSaverActive(); - static void screenSaverActivate(bool); - - // the following are internal. - void refresh(); - void refresh(QRegion &); - - void enablePainting(bool); - static void processEventQueue(); - static QList * windowList(); - - void sendPropertyNotifyEvent(int property, int state); - - static QPoint mousePosition; - - static void startup(int flags); - static void closedown(); - - static void beginDisplayReconfigure(); - static void endDisplayReconfigure(); - -#ifndef QT_NO_QWS_CURSOR - static void setCursorVisible(bool); - static bool isCursorVisible(); -#endif - - const QBrush &backgroundBrush() const; - - enum WindowEvent { Create=0x0001, Destroy=0x0002, Hide=0x0004, Show=0x0008, - Raise=0x0010, Lower=0x0020, Geometry=0x0040, Active = 0x0080, - Name=0x0100 }; - -Q_SIGNALS: - void windowEvent(QWSWindow *w, QWSServer::WindowEvent e); - -#ifndef QT_NO_COP - void newChannel(const QString& channel); - void removedChannel(const QString& channel); - -#endif -#ifndef QT_NO_QWS_INPUTMETHODS - void markedText(const QString &); -#endif - -protected: - void timerEvent(QTimerEvent *e); - -private: - friend class QApplicationPrivate; - void updateWindowRegions() const; - -#ifdef QT3_SUPPORT -#ifndef QT_NO_QWS_KEYBOARD - static inline QT3_SUPPORT void setKeyboardFilter(QWSServer::KeyboardFilter *f) - { if (f) addKeyboardFilter(f); else removeKeyboardFilter(); } -#endif -#endif - -private: -#ifndef QT_NO_QWS_MULTIPROCESS - Q_PRIVATE_SLOT(d_func(), void _q_clientClosed()) - Q_PRIVATE_SLOT(d_func(), void _q_doClient()) - Q_PRIVATE_SLOT(d_func(), void _q_deleteWindowsLater()) -#endif - - Q_PRIVATE_SLOT(d_func(), void _q_screenSaverWake()) - Q_PRIVATE_SLOT(d_func(), void _q_screenSaverSleep()) - Q_PRIVATE_SLOT(d_func(), void _q_screenSaverTimeout()) - -#ifndef QT_NO_QWS_MULTIPROCESS - Q_PRIVATE_SLOT(d_func(), void _q_newConnection()) -#endif -}; - -#ifndef QT_NO_QWS_INPUTMETHODS -class Q_GUI_EXPORT QWSInputMethod : public QObject -{ - Q_OBJECT -public: - QWSInputMethod(); - virtual ~QWSInputMethod(); - - enum UpdateType {Update, FocusIn, FocusOut, Reset, Destroyed}; - - virtual bool filter(int unicode, int keycode, int modifiers, - bool isPress, bool autoRepeat); - - virtual bool filter(const QPoint &, int state, int wheel); - - virtual void reset(); - virtual void updateHandler(int type); - virtual void mouseHandler(int pos, int state); - virtual void queryResponse(int property, const QVariant&); - -protected: - uint setInputResolution(bool isHigh); - uint inputResolutionShift() const; - // needed for required transform - void sendMouseEvent(const QPoint &pos, int state, int wheel); - - void sendEvent(const QInputMethodEvent*); - void sendPreeditString(const QString &preeditString, int cursorPosition, int selectionLength = 0); - void sendCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0); - void sendQuery(int property); - -#ifdef QT3_SUPPORT - inline void sendIMEvent(QWSServer::IMState, const QString& txt, int cpos, int selLen = 0); -#endif -private: - bool mIResolution; -}; - -inline void QWSInputMethod::sendEvent(const QInputMethodEvent *ime) -{ - qwsServer->sendIMEvent(ime); -} -#ifdef QT3_SUPPORT -inline void QWSInputMethod::sendIMEvent(QWSServer::IMState state, const QString& txt, int cpos, int selLen) -{ - if (state == QWSServer::IMCompose) sendPreeditString(txt, cpos, selLen); else sendCommitString(txt); -} -#endif - -inline void QWSInputMethod::sendQuery(int property) -{ - qwsServer->sendIMQuery(property); -} - -// mouse events not inline as involve transformations. -#endif // QT_NO_QWS_INPUTMETHODS - - - -/********************************************************************* - * - * Class: QWSClient - * - *********************************************************************/ - -struct QWSMouseEvent; - -typedef QMap QWSCursorMap; - -class QWSClientPrivate; -class QWSCommand; -class QWSConvertSelectionCommand; - -class Q_GUI_EXPORT QWSClient : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWSClient) -public: - QWSClient(QObject* parent, QWS_SOCK_BASE *, int id); - ~QWSClient(); - - int socket() const; - - void setIdentity(const QString&); - QString identity() const { return id; } - - void sendEvent(QWSEvent* event); - void sendConnectedEvent(const char *display_spec); - void sendMaxWindowRectEvent(const QRect &rect); - void sendPropertyNotifyEvent(int property, int state); - void sendPropertyReplyEvent(int property, int len, const char *data); - void sendSelectionClearEvent(int windowid); - void sendSelectionRequestEvent(QWSConvertSelectionCommand *cmd, int windowid); -#ifndef QT_QWS_CLIENTBLIT - void sendRegionEvent(int winid, QRegion rgn, int type); -#else - void sendRegionEvent(int winid, QRegion rgn, int type, int id = 0); -#endif -#ifndef QT_NO_QWSEMBEDWIDGET - void sendEmbedEvent(int winid, QWSEmbedEvent::Type type, - const QRegion ®ion = QRegion()); -#endif - QWSCommand* readMoreCommand(); - - int clientId() const { return cid; } - - QWSCursorMap cursors; // cursors defined by this client -Q_SIGNALS: - void connectionClosed(); - void readyRead(); -private Q_SLOTS: - void closeHandler(); - void errorHandler(); - -private: -#ifndef QT_NO_QWS_MULTIPROCESS - friend class QWSWindow; - void removeUnbufferedSurface(); - void addUnbufferedSurface(); -#endif - -private: - int socketDescriptor; -#ifndef QT_NO_QWS_MULTIPROCESS - QWSSocket *csocket; -#endif - QWSCommand* command; - uint isClosed : 1; - QString id; - int cid; - - friend class QWSServerPrivate; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QWINDOWSYSTEM_QWS_H diff --git a/src/gui/embedded/qwscommand_qws.cpp b/src/gui/embedded/qwscommand_qws.cpp deleted file mode 100644 index 9e4831aec6c..00000000000 --- a/src/gui/embedded/qwscommand_qws.cpp +++ /dev/null @@ -1,609 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwscommand_qws_p.h" -#include "qtransportauth_qws.h" -#include "qtransportauth_qws_p.h" - -#include - -// #define QWSCOMMAND_DEBUG 1 // Uncomment to debug client/server communication - -#ifdef QWSCOMMAND_DEBUG -# include -# include "qfile.h" -# include -#endif - -QT_BEGIN_NAMESPACE - -#ifdef QWSCOMMAND_DEBUG -// QWSHexDump -[ start ]--------------------------------------------- -# define QWSHEXDUMP_MAX 32 -class QWSHexDump -{ -public: - - QWSHexDump(const void *address, int len, int wrapAt = 16) - : wrap(wrapAt), dataSize(len) - { - init(); - data = reinterpret_cast(address); - if (len < 0) - dataSize = 0; - } - - QWSHexDump(const char *str, int len = -1, int wrapAt = 16) - : wrap(wrapAt), dataSize(len) - { - init(); - data = str; - if (len == -1) - dataSize = str ? strlen(str) : 0; - } - - QWSHexDump(const QByteArray &array, int wrapAt = 16) - : wrap(wrapAt) - { - init(); - data = array.data(); - dataSize = array.size(); - } - - // Sets a customized prefix for the hexdump - void setPrefix(const char *str) { prefix = str; } - - // Sets number of bytes to cluster together - void setClusterSize(uint num) { clustering = num; } - - // Output hexdump to a text stream - void intoTextStream(QTextStream &strm) { - outstrm = &strm; - hexDump(); - } - - // Output hexdump to a QString - QString toString(); - -protected: - void init(); - void hexDump(); - void sideviewDump(int at); - -private: - uint wrap; - uint clustering; - uint dataSize; - int dataWidth; - const char *data; - const char *prefix; - bool dirty; - - char sideviewLayout[QWSHEXDUMP_MAX + 1]; - char sideview[15]; - - QTextStream *outstrm; -}; - -void QWSHexDump::init() -{ - prefix = "> "; // Standard line prefix - clustering = 2; // Word-size clustering by default - if (wrap > QWSHEXDUMP_MAX) // No wider than QWSHexDump_MAX bytes - wrap = QWSHEXDUMP_MAX; -} - -void QWSHexDump::hexDump() -{ - *outstrm << '(' << dataSize << " bytes):\n" << prefix; - sprintf(sideviewLayout, " [%%-%us]", wrap); - dataWidth = (2 * wrap) + (wrap / clustering); - - dirty = false; - uint wrapIndex = 0; - for (uint i = 0; i < dataSize; i++) { - uint c = static_cast(data[i]); - sideview[wrapIndex = i%wrap] = isprint(c) ? c : '.'; - - if (wrapIndex && (wrapIndex % clustering == 0)) - *outstrm << ' '; - - outstrm->setFieldWidth(2); - outstrm->setPadChar('0'); - outstrm->setNumberFlags( QTextStream::ShowBase ); - *outstrm << hex << c; - dirty = true; - - if (wrapIndex == wrap-1) { - sideviewDump(wrapIndex); - wrapIndex = 0; - if (i+1 < dataSize) - *outstrm << endl << prefix; - } - - } - sideviewDump(wrapIndex); -} - -void QWSHexDump::sideviewDump(int at) -{ - if (dirty) { - dirty = false; - ++at; - sideview[at] = '\0'; - int currentWidth = (2 * at) + (at / clustering) - (at%clustering?0:1); - int missing = qMax(dataWidth - currentWidth, 0); - while (missing--) - *outstrm << ' '; - - *outstrm << " ["; - outstrm->setPadChar(' '); - outstrm->setFieldWidth(wrap); - outstrm->setFieldAlignment( QTextStream::AlignLeft ); - *outstrm << sideview; - *outstrm << ']'; - } -} - -// Output hexdump to a QString -QString QWSHexDump::toString() { - QString result; - QTextStream strm(&result, QFile::WriteOnly); - outstrm = &strm; - hexDump(); - return result; -} - -#ifndef QT_NO_DEBUG -QDebug &operator<<(QDebug &dbg, QWSHexDump *hd) { - if (!hd) - return dbg << "QWSHexDump(0x0)"; - QString result = hd->toString(); - dbg.nospace() << result; - return dbg.space(); -} - -// GCC & Intel wont handle references here -QDebug operator<<(QDebug dbg, QWSHexDump hd) { - return dbg << &hd; -} -#endif -// QWSHexDump -[ end ]----------------------------------------------- - - -QDebug &operator<<(QDebug &dbg, QWSCommand::Type tp) -{ - dbg << qws_getCommandTypeString( tp ); - return dbg; -} - -#define N_EVENTS 19 -const char * eventNames[N_EVENTS] = { - "NoEvent", - "Connected", - "Mouse", "Focus", "Key", - "Region", - "Creation", - "PropertyNotify", - "PropertyReply", - "SelectionClear", - "SelectionRequest", - "SelectionNotify", - "MaxWindowRect", - "QCopMessage", - "WindowOperation", - "IMEvent", - "IMQuery", - "IMInit", - "Font" - }; - -class QWSServer; -extern QWSServer *qwsServer; -#endif - -const char *qws_getCommandTypeString( QWSCommand::Type tp ) -{ - const char *typeStr; - switch(tp) { - case QWSCommand::Create: - typeStr = "Create"; - break; - case QWSCommand::Shutdown: - typeStr = "Shutdown"; - break; - case QWSCommand::Region: - typeStr = "Region"; - break; - case QWSCommand::RegionMove: - typeStr = "RegionMove"; - break; - case QWSCommand::RegionDestroy: - typeStr = "RegionDestroy"; - break; - case QWSCommand::SetProperty: - typeStr = "SetProperty"; - break; - case QWSCommand::AddProperty: - typeStr = "AddProperty"; - break; - case QWSCommand::RemoveProperty: - typeStr = "RemoveProperty"; - break; - case QWSCommand::GetProperty: - typeStr = "GetProperty"; - break; - case QWSCommand::SetSelectionOwner: - typeStr = "SetSelectionOwner"; - break; - case QWSCommand::ConvertSelection: - typeStr = "ConvertSelection"; - break; - case QWSCommand::RequestFocus: - typeStr = "RequestFocus"; - break; - case QWSCommand::ChangeAltitude: - typeStr = "ChangeAltitude"; - break; - case QWSCommand::SetOpacity: - typeStr = "SetOpacity"; - break; - case QWSCommand::DefineCursor: - typeStr = "DefineCursor"; - break; - case QWSCommand::SelectCursor: - typeStr = "SelectCursor"; - break; - case QWSCommand::PositionCursor: - typeStr = "PositionCursor"; - break; - case QWSCommand::GrabMouse: - typeStr = "GrabMouse"; - break; - case QWSCommand::PlaySound: - typeStr = "PlaySound"; - break; - case QWSCommand::QCopRegisterChannel: - typeStr = "QCopRegisterChannel"; - break; - case QWSCommand::QCopSend: - typeStr = "QCopSend"; - break; - case QWSCommand::RegionName: - typeStr = "RegionName"; - break; - case QWSCommand::Identify: - typeStr = "Identify"; - break; - case QWSCommand::GrabKeyboard: - typeStr = "GrabKeyboard"; - break; - case QWSCommand::RepaintRegion: - typeStr = "RepaintRegion"; - break; - case QWSCommand::IMMouse: - typeStr = "IMMouse"; - break; - case QWSCommand::IMUpdate: - typeStr = "IMUpdate"; - break; - case QWSCommand::IMResponse: - typeStr = "IMResponse"; - break; - case QWSCommand::Font: - typeStr = "Font"; - break; - case QWSCommand::Unknown: - default: - typeStr = "Unknown"; - break; - } - return typeStr; -} - - -/********************************************************************* - * - * Functions to read/write commands on/from a socket - * - *********************************************************************/ - -#ifndef QT_NO_QWS_MULTIPROCESS -void qws_write_command(QIODevice *socket, int type, char *simpleData, int simpleLen, - char *rawData, int rawLen) -{ -#ifdef QWSCOMMAND_DEBUG - if (simpleLen) qDebug() << "WRITE simpleData " << QWSHexDump(simpleData, simpleLen); - if (rawLen > 0) qDebug() << "WRITE rawData " << QWSHexDump(rawData, rawLen); -#endif - -#ifndef QT_NO_SXE - QTransportAuth *a = QTransportAuth::getInstance(); - // ###### as soon as public API can be modified get rid of horrible casts - QIODevice *ad = a->passThroughByClient(reinterpret_cast(socket)); - if (ad) - socket = ad; -#endif - - qws_write_uint(socket, type); - - if (rawLen > MAX_COMMAND_SIZE) { - qWarning("qws_write_command: Message of size %d too big. " - "Truncated to %d", rawLen, MAX_COMMAND_SIZE); - rawLen = MAX_COMMAND_SIZE; - } - - qws_write_uint(socket, rawLen == -1 ? 0 : rawLen); - - if (simpleData && simpleLen) - socket->write(simpleData, simpleLen); - - if (rawLen && rawData) - socket->write(rawData, rawLen); -} - -/* - command format: [type][rawLen][simpleData][rawData] - type is already read when entering this function -*/ - -bool qws_read_command(QIODevice *socket, char *&simpleData, int &simpleLen, - char *&rawData, int &rawLen, int &bytesRead) -{ - - // read rawLen - if (rawLen == -1) { - rawLen = qws_read_uint(socket); - if (rawLen == -1) - return false; - } - - // read simpleData, assumes socket is capable of buffering all the data - if (simpleLen && !rawData) { - if (socket->bytesAvailable() < uint(simpleLen)) - return false; - int tmp = socket->read(simpleData, simpleLen); - Q_ASSERT(tmp == simpleLen); - Q_UNUSED(tmp); - } - - if (rawLen > MAX_COMMAND_SIZE) { - socket->close(); - qWarning("qws_read_command: Won't read command of length %d, " - "connection closed.", rawLen); - return false; - } - - // read rawData - if (rawLen && !rawData) { - rawData = new char[rawLen]; - bytesRead = 0; - } - if (bytesRead < rawLen && socket->bytesAvailable()) - bytesRead += socket->read(rawData + bytesRead, rawLen - bytesRead); - - return (bytesRead == rawLen); -} -#endif - -/********************************************************************* - * - * QWSCommand base class - only use derived classes from that - * - *********************************************************************/ -QWSProtocolItem::~QWSProtocolItem() { - if (deleteRaw) - delete []rawDataPtr; -} - -#ifndef QT_NO_QWS_MULTIPROCESS -void QWSProtocolItem::write(QIODevice *s) { -#ifdef QWSCOMMAND_DEBUG - if (!qwsServer) - qDebug() << "QWSProtocolItem::write sending type " << static_cast(type); - else - qDebug() << "QWSProtocolItem::write sending event " << (type < N_EVENTS ? eventNames[type] : "unknown"); -#endif - qws_write_command(s, type, simpleDataPtr, simpleLen, rawDataPtr, rawLen); -} - -bool QWSProtocolItem::read(QIODevice *s) { -#ifdef QWSCOMMAND_DEBUG - QLatin1String reread( (rawLen == -1) ? "" : "REREAD"); - if (qwsServer) - qDebug() << "QWSProtocolItem::read reading type " << static_cast(type) << reread; - else - qDebug() << "QWSProtocolItem::read reading event " << (type < N_EVENTS ? eventNames[type] : "unknown") << reread; - //qDebug("QWSProtocolItem::read reading event %s", type < N_EVENTS ? eventNames[type] : "unknown"); -#endif - bool b = qws_read_command(s, simpleDataPtr, simpleLen, rawDataPtr, rawLen, bytesRead); - if (b) { - setData(rawDataPtr, rawLen, false); - deleteRaw = true; - } -#ifdef QWSCOMMAND_DEBUG - else - { - qDebug() << "error in reading command " << static_cast(type); - } -#endif - return b; -} -#endif // QT_NO_QWS_MULTIPROCESS - -void QWSProtocolItem::copyFrom(const QWSProtocolItem *item) { - if (this == item) - return; - simpleLen = item->simpleLen; - memcpy(simpleDataPtr, item->simpleDataPtr, simpleLen); - setData(item->rawDataPtr, item->rawLen); -} - -void QWSProtocolItem::setData(const char *data, int len, bool allocateMem) { - if (deleteRaw) - delete [] rawDataPtr; - if (!data || len <= 0) { - rawDataPtr = 0; - rawLen = 0; - return; - } - if (allocateMem) { - rawDataPtr = new char[len]; - memcpy(rawDataPtr, data, len); - deleteRaw = true; - } else { - rawDataPtr = const_cast(data); - deleteRaw = false; - } - rawLen = len; -} - -QWSCommand *QWSCommand::factory(int type) -{ - QWSCommand *command = 0; - switch (type) { - case QWSCommand::Create: - command = new QWSCreateCommand; - break; - case QWSCommand::Shutdown: - command = new QWSCommand(type, 0, 0); - break; - case QWSCommand::Region: - command = new QWSRegionCommand; - break; - case QWSCommand::RegionMove: - command = new QWSRegionMoveCommand; - break; - case QWSCommand::RegionDestroy: - command = new QWSRegionDestroyCommand; - break; - case QWSCommand::AddProperty: - command = new QWSAddPropertyCommand; - break; - case QWSCommand::SetProperty: - command = new QWSSetPropertyCommand; - break; - case QWSCommand::RemoveProperty: - command = new QWSRemovePropertyCommand; - break; - case QWSCommand::GetProperty: - command = new QWSGetPropertyCommand; - break; - case QWSCommand::SetSelectionOwner: - command = new QWSSetSelectionOwnerCommand; - break; - case QWSCommand::RequestFocus: - command = new QWSRequestFocusCommand; - break; - case QWSCommand::ChangeAltitude: - command = new QWSChangeAltitudeCommand; - break; - case QWSCommand::SetOpacity: - command = new QWSSetOpacityCommand; - break; - case QWSCommand::DefineCursor: - command = new QWSDefineCursorCommand; - break; - case QWSCommand::SelectCursor: - command = new QWSSelectCursorCommand; - break; - case QWSCommand::GrabMouse: - command = new QWSGrabMouseCommand; - break; - case QWSCommand::GrabKeyboard: - command = new QWSGrabKeyboardCommand; - break; -#ifndef QT_NO_SOUND - case QWSCommand::PlaySound: - command = new QWSPlaySoundCommand; - break; -#endif -#ifndef QT_NO_COP - case QWSCommand::QCopRegisterChannel: - command = new QWSQCopRegisterChannelCommand; - break; - case QWSCommand::QCopSend: - command = new QWSQCopSendCommand; - break; -#endif - case QWSCommand::RegionName: - command = new QWSRegionNameCommand; - break; - case QWSCommand::Identify: - command = new QWSIdentifyCommand; - break; - case QWSCommand::RepaintRegion: - command = new QWSRepaintRegionCommand; - break; -#ifndef QT_NO_QWS_INPUTMETHODS - case QWSCommand::IMUpdate: - command = new QWSIMUpdateCommand; - break; - - case QWSCommand::IMMouse: - command = new QWSIMMouseCommand; - break; - - case QWSCommand::IMResponse: - command = new QWSIMResponseCommand; - break; -#endif - case QWSCommand::PositionCursor: - command = new QWSPositionCursorCommand; - break; -#ifndef QT_NO_QWSEMBEDWIDGET - case QWSCommand::Embed: - command = new QWSEmbedCommand; - break; -#endif - case QWSCommand::Font: - command = new QWSFontCommand; - break; - case QWSCommand::ScreenTransform: - command = new QWSScreenTransformCommand; - break; - default: - qWarning("QWSCommand::factory : Type error - got %08x!", type); - } - return command; -} - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qwscommand_qws_p.h b/src/gui/embedded/qwscommand_qws_p.h deleted file mode 100644 index 4e0c8bebef0..00000000000 --- a/src/gui/embedded/qwscommand_qws_p.h +++ /dev/null @@ -1,851 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSCOMMAND_QWS_P_H -#define QWSCOMMAND_QWS_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. -// - -// When reading commands "off the wire" in the server, the rawLen is read -// and then that many bytes are allocated. If the rawLen is corrupted (or -// the protocol is being attacked) too many bytes can be allocated. Set -// a hard limit here for security. -#define MAX_COMMAND_SIZE (16 * 1024) - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "qwsprotocolitem_qws.h" - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QRect; - -/********************************************************************* - * - * Functions to read/write commands on/from a socket - * - *********************************************************************/ -#ifndef QT_NO_QWS_MULTIPROCESS -void qws_write_command(QIODevice *socket, int type, char *simpleData, int simpleLen, char *rawData, int rawLen); -bool qws_read_command(QIODevice *socket, char *&simpleData, int &simpleLen, char *&rawData, int &rawLen, int &bytesRead); -#endif - -struct QWSCommand : QWSProtocolItem -{ - QWSCommand(int t, int len, char *ptr) : QWSProtocolItem(t,len,ptr) {} - - enum Type { - Unknown = 0, - Create, - Shutdown, - Region, - RegionMove, - RegionDestroy, - SetProperty, - AddProperty, - RemoveProperty, - GetProperty, - SetSelectionOwner, - ConvertSelection, - RequestFocus, - ChangeAltitude, - SetOpacity, - DefineCursor, - SelectCursor, - PositionCursor, - GrabMouse, - PlaySound, - QCopRegisterChannel, - QCopSend, - RegionName, - Identify, - GrabKeyboard, - RepaintRegion, - IMMouse, - IMUpdate, - IMResponse, - Embed, - Font, - ScreenTransform - }; - static QWSCommand *factory(int type); -}; - -const char *qws_getCommandTypeString( QWSCommand::Type tp ); - -#ifndef QT_NO_DEBUG -class QDebug; -QDebug &operator<<(QDebug &dbg, QWSCommand::Type tp); -#endif // QT_NO_DEBUG - -/********************************************************************* - * - * Commands - * - *********************************************************************/ - -struct QWSIdentifyCommand : public QWSCommand -{ - QWSIdentifyCommand() : - QWSCommand(QWSCommand::Identify, - sizeof(simpleData), reinterpret_cast(&simpleData)) - { - simpleData.idLen = 0; - simpleData.idLock = -1; - } - - void setData(const char *d, int len, bool allocateMem) { - QWSCommand::setData(d, len, allocateMem); - if ( simpleData.idLen > MAX_COMMAND_SIZE ) - { - qWarning( "Identify command - name length %d - too big!", simpleData.idLen ); - simpleData.idLen = MAX_COMMAND_SIZE; - } - if ( simpleData.idLen * int(sizeof(QChar)) > len ) - { - qWarning( "Identify command - name length %d - buffer size %d - buffer overrun!", simpleData.idLen, len ); - } - else - { - id = QString(reinterpret_cast(d), simpleData.idLen); - } - } - - void setId(const QString& i, int lock) - { - id = i; - simpleData.idLen = id.length(); - simpleData.idLock = lock; - setData(reinterpret_cast(id.unicode()), simpleData.idLen*2, true); - } - - struct SimpleData { - int idLen; - int idLock; - } simpleData; - QString id; -}; - -struct QWSCreateCommand : public QWSCommand -{ - QWSCreateCommand(int n = 1) : - QWSCommand(QWSCommand::Create, sizeof(count), - reinterpret_cast(&count)), count(n) {} - int count; -}; - -struct QWSRegionNameCommand : public QWSCommand -{ - QWSRegionNameCommand() : - QWSCommand(QWSCommand::RegionName, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem) { - QWSCommand::setData(d, len, allocateMem); - if ( simpleData.nameLen > MAX_COMMAND_SIZE ) - { - qWarning( "region name command - name length too big!" ); - simpleData.nameLen = MAX_COMMAND_SIZE; - } - if ( simpleData.captionLen > MAX_COMMAND_SIZE ) - { - qWarning( "region name command - caption length too big!" ); - simpleData.captionLen = MAX_COMMAND_SIZE; - } - if ( simpleData.nameLen + simpleData.captionLen > len ) - { - qWarning( "region name command - name length %d - caption length %d - buffer size %d - buffer overrun!", - simpleData.nameLen, simpleData.captionLen, len ); - - } - else - { - name = QString(reinterpret_cast(d), simpleData.nameLen/2); - d += simpleData.nameLen; - caption = QString(reinterpret_cast(d), simpleData.captionLen/2); - } - } - - void setName(const QString& n, const QString &c) - { - name = n; - caption = c; - int l = simpleData.nameLen = name.length()*2; - l += simpleData.captionLen = caption.length()*2; - char *d = new char[l]; - memcpy(d, name.unicode(), simpleData.nameLen); - memcpy(d+simpleData.nameLen, caption.unicode(), simpleData.captionLen); - setData(d, l, true); - delete[] d; - } - - struct SimpleData { - int windowid; - int nameLen; - int captionLen; - } simpleData; - QString name; - QString caption; -}; - -struct QWSRegionCommand : public QWSCommand -{ - QWSRegionCommand() : - QWSCommand(QWSCommand::Region, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem = true) { - QWSCommand::setData(d, len, allocateMem); - - if( simpleData.nrectangles * int(sizeof(QRect)) + simpleData.surfacekeylength * int(sizeof(QChar)) + simpleData.surfacedatalength * int(sizeof(char)) > len ) - { - qWarning( "region command - rectangle count %d - surface key length %d - region data size %d - buffer size %d - buffer overrun!", - simpleData.nrectangles, simpleData.surfacekeylength, simpleData.surfacedatalength, len ); - } - else - { - char *ptr = rawDataPtr; - - region.setRects(reinterpret_cast(ptr), simpleData.nrectangles); - ptr += simpleData.nrectangles * sizeof(QRect); - - surfaceKey = QString(reinterpret_cast(ptr), - simpleData.surfacekeylength); - ptr += simpleData.surfacekeylength * sizeof(QChar); - - surfaceData = QByteArray(ptr, simpleData.surfacedatalength); - } - } - - void setData(int id, const QString &key, const QByteArray &data, - const QRegion ®) - { - surfaceKey = key; - surfaceData = data; - region = reg; - - const QVector rects = reg.rects(); - - simpleData.windowid = id; - simpleData.surfacekeylength = key.size(); - simpleData.surfacedatalength = data.size(); - simpleData.nrectangles = rects.count(); - - QVarLengthArray buffer; - buffer.append(reinterpret_cast(rects.constData()), - rects.count() * sizeof(QRect)); - buffer.append(reinterpret_cast(key.constData()), - key.size() * sizeof(QChar)); - buffer.append(data, data.size()); - - QWSCommand::setData(buffer.constData(), buffer.size(), true); - } - - /* XXX this will pad out in a compiler dependent way, - should move nrectangles to before windowtype, and - add reserved bytes. - Symptom will be valgrind reported uninitialized memory usage - */ - struct SimpleData { - int windowid; - int surfacekeylength; - int surfacedatalength; - int nrectangles; - } simpleData; - - QString surfaceKey; - QByteArray surfaceData; - QRegion region; -}; - -struct QWSSetOpacityCommand : public QWSCommand -{ - QWSSetOpacityCommand() : - QWSCommand(QWSCommand::SetOpacity, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid; - uchar opacity; - } simpleData; -}; - -struct QWSRegionMoveCommand : public QWSCommand -{ - QWSRegionMoveCommand() : - QWSCommand(QWSCommand::RegionMove, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid; - int dx; - int dy; - } simpleData; - -}; - -struct QWSRegionDestroyCommand : public QWSCommand -{ - QWSRegionDestroyCommand() : - QWSCommand(QWSCommand::RegionDestroy, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid; - } simpleData; - -}; - -struct QWSRequestFocusCommand : public QWSCommand -{ - QWSRequestFocusCommand() : - QWSCommand(QWSCommand::RequestFocus, sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid; - int flag; - } simpleData; -}; - -struct QWSChangeAltitudeCommand : public QWSCommand -{ - QWSChangeAltitudeCommand() : - QWSCommand(QWSCommand::ChangeAltitude, sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - enum Altitude { - Lower = -1, - Raise = 0, - StaysOnTop = 1 - }; - - struct SimpleData { - int windowid; - Altitude altitude; - bool fixed; - } simpleData; - -}; - - -struct QWSAddPropertyCommand : public QWSCommand -{ - QWSAddPropertyCommand() : - QWSCommand(QWSCommand::AddProperty, sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid, property; - } simpleData; - -}; - -struct QWSSetPropertyCommand : public QWSCommand -{ - QWSSetPropertyCommand() : - QWSCommand(QWSCommand::SetProperty, sizeof(simpleData), - reinterpret_cast(&simpleData)) { data = 0; } - - void setData(const char *d, int len, bool allocateMem = true) { - QWSCommand::setData(d, len, allocateMem); - data = rawDataPtr; - } - - struct SimpleData { - int windowid, property, mode; - } simpleData; - - char *data; -}; - -struct QWSRepaintRegionCommand : public QWSCommand -{ - QWSRepaintRegionCommand() : - QWSCommand(QWSCommand::RepaintRegion, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem = true) { - QWSCommand::setData(d, len, allocateMem); - - if( simpleData.nrectangles * int(sizeof(QRect)) > len ) - { - qWarning( "repaint region command - region rectangle count %d - buffer size %d - buffer overrun", - simpleData.nrectangles, len ); - - simpleData.nrectangles = len / sizeof(QRect); - } - rectangles = reinterpret_cast(rawDataPtr); - } - - struct SimpleData { - int windowid; - int windowFlags; - bool opaque; - int nrectangles; - } simpleData; - - QRect * rectangles; - -}; - -struct QWSRemovePropertyCommand : public QWSCommand -{ - QWSRemovePropertyCommand() : - QWSCommand(QWSCommand::RemoveProperty, sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid, property; - } simpleData; - -}; - -struct QWSGetPropertyCommand : public QWSCommand -{ - QWSGetPropertyCommand() : - QWSCommand(QWSCommand::GetProperty, sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid, property; - } simpleData; - -}; - -struct QWSSetSelectionOwnerCommand : public QWSCommand -{ - QWSSetSelectionOwnerCommand() : - QWSCommand(QWSCommand::SetSelectionOwner, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid; - int hour, minute, sec, ms; // time - } simpleData; - -}; - -struct QWSConvertSelectionCommand : public QWSCommand -{ - QWSConvertSelectionCommand() : - QWSCommand(QWSCommand::ConvertSelection, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int requestor; // requestor window of the selection - int selection; // property on requestor into which the selection should be stored - int mimeTypes; // property ion requestor in which the mimetypes, in which the selection may be, are stored - } simpleData; - -}; - -struct QWSDefineCursorCommand : public QWSCommand -{ - QWSDefineCursorCommand() : - QWSCommand(QWSCommand::DefineCursor, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem = true) { - QWSCommand::setData(d, len, allocateMem); - data = reinterpret_cast(rawDataPtr); - if (simpleData.height * ((simpleData.width+7) / 8) > len) { - qWarning("define cursor command - width %d height %d- buffer size %d - buffer overrun", - simpleData.width, simpleData.height, len ); - simpleData.width = simpleData.height = 0; - } - } - - struct SimpleData { - int width; - int height; - int hotX; - int hotY; - int id; - } simpleData; - - unsigned char *data; -}; - -struct QWSSelectCursorCommand : public QWSCommand -{ - QWSSelectCursorCommand() : - QWSCommand(QWSCommand::SelectCursor, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid; - int id; - } simpleData; -}; - -struct QWSPositionCursorCommand : public QWSCommand -{ - QWSPositionCursorCommand() : - QWSCommand(QWSCommand::PositionCursor, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int newX; - int newY; - } simpleData; -}; - -struct QWSGrabMouseCommand : public QWSCommand -{ - QWSGrabMouseCommand() : - QWSCommand(QWSCommand::GrabMouse, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid; - bool grab; // grab or ungrab? - } simpleData; -}; - -struct QWSGrabKeyboardCommand : public QWSCommand -{ - QWSGrabKeyboardCommand() : - QWSCommand(QWSCommand::GrabKeyboard, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid; - bool grab; // grab or ungrab? - } simpleData; -}; - -#ifndef QT_NO_SOUND -struct QWSPlaySoundCommand : public QWSCommand -{ - QWSPlaySoundCommand() : - QWSCommand(QWSCommand::PlaySound, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem) { - QWSCommand::setData(d, len, allocateMem); - filename = QString(reinterpret_cast(rawDataPtr),len/2); - } - void setFileName(const QString& n) - { - setData(reinterpret_cast(n.unicode()), n.length()*2, true); - } - - struct SimpleData { - int windowid; - } simpleData; - QString filename; -}; -#endif - - -#ifndef QT_NO_COP -struct QWSQCopRegisterChannelCommand : public QWSCommand -{ - QWSQCopRegisterChannelCommand() : - QWSCommand(QWSCommand::QCopRegisterChannel, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem) { - QWSCommand::setData(d, len, allocateMem); - if ( simpleData.chLen > MAX_COMMAND_SIZE ) - { - qWarning( "Command channel name too large!" ); - simpleData.chLen = MAX_COMMAND_SIZE; - } - if( simpleData.chLen * int(sizeof(QChar)) > len ) - { - qWarning( "register qcop channel command - channel name length %d - buffer size %d - buffer overrun!", simpleData.chLen, len ); - } - else - { - channel = QString(reinterpret_cast(d), simpleData.chLen); - } - } - - void setChannel(const QString& n) - { - channel = n; - simpleData.chLen = channel.length(); - setData(reinterpret_cast(channel.unicode()), simpleData.chLen*2, true); - } - - struct SimpleData { - int chLen; - } simpleData; - QString channel; -}; - -struct QWSQCopSendCommand : public QWSCommand -{ - QWSQCopSendCommand() : - QWSCommand(QWSCommand::QCopSend, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem) { - QWSCommand::setData(d, len, allocateMem); - - if( simpleData.clen * int(sizeof(QChar)) + simpleData.mlen * int(sizeof(QChar)) + simpleData.dlen * int(sizeof(char)) > len ) - { - qWarning( "qcop send command - channel name length %d - message name length %d - data size %d - buffer size %d - buffer overrun!", - simpleData.clen, simpleData.mlen, simpleData.dlen, len ); - } - else - { - const QChar *cd = reinterpret_cast(d); - channel = QString(cd,simpleData.clen); cd += simpleData.clen; - message = QString(cd,simpleData.mlen); - d += simpleData.clen*sizeof(QChar) + simpleData.mlen*sizeof(QChar); - data = QByteArray(d, simpleData.dlen); - } - } - - void setMessage(const QString &c, const QString &m, - const QByteArray &data) - { - this->channel = c; - this->message = m; - this->data = data; - simpleData.clen = c.length(); - simpleData.mlen = m.length(); - simpleData.dlen = data.size(); - int l = simpleData.clen*sizeof(QChar); - l += simpleData.mlen*sizeof(QChar); - l += simpleData.dlen; - char *tmp = new char[l]; - char *d = tmp; - memcpy(d, c.unicode(), simpleData.clen*sizeof(QChar)); - d += simpleData.clen*sizeof(QChar); - memcpy(d, m.unicode(), simpleData.mlen*sizeof(QChar)); - d += simpleData.mlen*sizeof(QChar); - memcpy(d, data.data(), simpleData.dlen); - QWSCommand::setData(tmp, l, false); - deleteRaw = true; - } - - struct SimpleData { - int clen; - int mlen; - int dlen; - } simpleData; - QString channel; - QString message; - QByteArray data; -}; - -#endif - - -#ifndef QT_NO_QWS_INPUTMETHODS - -struct QWSIMMouseCommand : public QWSCommand -{ - QWSIMMouseCommand() : - QWSCommand(QWSCommand::IMMouse, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid; - int state; - int index; - } simpleData; -}; - - -struct QWSIMResponseCommand : public QWSCommand -{ - QWSIMResponseCommand() : - QWSCommand(QWSCommand::IMResponse, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem) { - QWSCommand::setData(d, len, allocateMem); - - QByteArray tmp = QByteArray::fromRawData(d, len); - QDataStream s(tmp); - s >> result; - } - - void setResult(const QVariant & v) - { - QByteArray tmp; - QDataStream s(&tmp, QIODevice::WriteOnly); - s << v; - setData(tmp.data(), tmp.size(), true); - } - - struct SimpleData { - int windowid; - int property; - } simpleData; - - QVariant result; -}; - -struct QWSIMUpdateCommand: public QWSCommand -{ - QWSIMUpdateCommand() : - QWSCommand(QWSCommand::IMUpdate, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int windowid; - int type; - int widgetid; - } simpleData; -}; - -#endif - -#ifndef QT_NO_QWSEMBEDWIDGET -struct QWSEmbedCommand : public QWSCommand -{ - QWSEmbedCommand() : QWSCommand(QWSCommand::Embed, - sizeof(simpleData), - reinterpret_cast(&simpleData)) - {} - - void setData(const char *d, int len, bool allocateMem = true) - { - QWSCommand::setData(d, len, allocateMem); - - if( simpleData.rects * int(sizeof(QRect)) > len ) - { - qWarning( "embed command - region rectangle count %d - buffer size %d - buffer overrun!", - simpleData.rects, len ); - } - else - { - region.setRects(reinterpret_cast(rawDataPtr), - simpleData.rects); - } - } - - void setData(WId embedder, WId embedded, QWSEmbedEvent::Type type, - const QRegion reg = QRegion()) - { - simpleData.embedder = embedder; - simpleData.embedded = embedded; - simpleData.type = type; - - region = reg; - const QVector rects = reg.rects(); - simpleData.rects = rects.count(); - - QWSCommand::setData(reinterpret_cast(rects.constData()), - rects.count() * sizeof(QRect)); - } - - struct { - WId embedder; - WId embedded; - QWSEmbedEvent::Type type; - int rects; - } simpleData; - - QRegion region; -}; -#endif // QT_NO_QWSEMBEDWIDGET - -struct QWSFontCommand : public QWSCommand -{ - enum CommandType { - StartedUsingFont, - StoppedUsingFont - }; - - QWSFontCommand() : - QWSCommand(QWSCommand::Font, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem) { - QWSCommand::setData(d, len, allocateMem); - - fontName = QByteArray(d, len); - } - - void setFontName(const QByteArray &name) - { - setData(name.constData(), name.size(), true); - } - - struct SimpleData { - int type; - } simpleData; - - QByteArray fontName; -}; - -struct QWSScreenTransformCommand : public QWSCommand -{ - QWSScreenTransformCommand() : - QWSCommand(QWSCommand::ScreenTransform, - sizeof(simpleData), reinterpret_cast(&simpleData)) {} - - void setTransformation(int screen, int transformation) - { - simpleData.screen = screen; - simpleData.transformation = transformation; - } - - struct SimpleData { - int screen; - int transformation; - } simpleData; -}; - -QT_END_NAMESPACE - -#endif // QWSCOMMAND_QWS_P_H diff --git a/src/gui/embedded/qwscursor_qws.cpp b/src/gui/embedded/qwscursor_qws.cpp deleted file mode 100644 index 9e8c235a03e..00000000000 --- a/src/gui/embedded/qwscursor_qws.cpp +++ /dev/null @@ -1,654 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcursor.h" -#include "qbitmap.h" -#include "qscreen_qws.h" -#include "qapplication.h" -#include "qwindowsystem_qws.h" -#include "qwindowsystem_p.h" -#include "qwscursor_qws.h" - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_QWS_CURSOR -static QWSCursor *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}; - -#endif - -void QWSServerPrivate::initializeCursor() -{ - Q_Q(QWSServer); - // setup system cursors -#ifndef QT_NO_QWS_CURSOR -// qt_screen->initCursor(sharedram + ramlen,true); - - // default cursor - cursor = 0; - setCursor(QWSCursor::systemCursor(Qt::ArrowCursor)); -#endif - q->sendMouseEvent(QPoint(swidth/2, sheight/2), 0); -} - -void QWSServerPrivate::setCursor(QWSCursor *curs) -{ -#ifdef QT_NO_QWS_CURSOR - Q_UNUSED(curs); -#else - if (cursor == curs) - return; - - cursor = curs; - - if (!haveviscurs || !curs) - curs = QWSCursor::systemCursor(Qt::BlankCursor); - - if (qt_screencursor) { - qt_screencursor->set(curs->image(), - curs->hotSpot().x(), - curs->hotSpot().y()); - } -#endif -} - -#ifndef QT_NO_QWS_CURSOR -static void cleanupSystemCursorTable() -{ - for (int i = 0; i <= Qt::LastCursor; i++) - if (systemCursorTable[i]) { - delete systemCursorTable[i]; - systemCursorTable[i] = 0; - } -} -#endif - -void QWSCursor::createSystemCursor(int id) -{ -#ifdef QT_NO_QWS_CURSOR - Q_UNUSED(id); -#else - if (!systemCursorTableInit) { - for (int i = 0; i <= Qt::LastCursor; i++) - systemCursorTable[i] = 0; - qAddPostRoutine(cleanupSystemCursorTable); - systemCursorTableInit = true; - } - switch (id) { - // 16x16 cursors - case Qt::ArrowCursor: - systemCursorTable[Qt::ArrowCursor] = - new QWSCursor(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0); - break; - - case Qt::UpArrowCursor: - systemCursorTable[Qt::UpArrowCursor] = - new QWSCursor(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0); - break; - - case Qt::CrossCursor: - systemCursorTable[Qt::CrossCursor] = - new QWSCursor(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7); - break; - - case Qt::IBeamCursor: - systemCursorTable[Qt::IBeamCursor] = - new QWSCursor(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7); - break; - - case Qt::SizeVerCursor: - systemCursorTable[Qt::SizeVerCursor] = - new QWSCursor(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7); - break; - - case Qt::SizeHorCursor: - systemCursorTable[Qt::SizeHorCursor] = - new QWSCursor(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7); - break; - - case Qt::SizeBDiagCursor: - systemCursorTable[Qt::SizeBDiagCursor] = - new QWSCursor(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7); - break; - - case Qt::SizeFDiagCursor: - systemCursorTable[Qt::SizeFDiagCursor] = - new QWSCursor(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7); - break; - - case Qt::BlankCursor: - systemCursorTable[Qt::BlankCursor] = - new QWSCursor(0, 0, 0, 0, 0, 0); - break; - - // 20x20 cursors - case Qt::ForbiddenCursor: - systemCursorTable[Qt::ForbiddenCursor] = - new QWSCursor(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10); - break; - - // 32x32 cursors - case Qt::WaitCursor: - systemCursorTable[Qt::WaitCursor] = - new QWSCursor(wait_data_bits, wait_mask_bits, 32, 32, 15, 15); - break; - - case Qt::SplitVCursor: - systemCursorTable[Qt::SplitVCursor] = - new QWSCursor(vsplit_bits, vsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SplitHCursor: - systemCursorTable[Qt::SplitHCursor] = - new QWSCursor(hsplit_bits, hsplitm_bits, 32, 32, 15, 15); - break; - - case Qt::SizeAllCursor: - systemCursorTable[Qt::SizeAllCursor] = - new QWSCursor(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15); - break; - - case Qt::PointingHandCursor: - systemCursorTable[Qt::PointingHandCursor] = - new QWSCursor(phand_bits, phandm_bits, 32, 32, 0, 0); - break; - - case Qt::WhatsThisCursor: - systemCursorTable[Qt::WhatsThisCursor] = - new QWSCursor(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0); - break; - case Qt::BusyCursor: - systemCursorTable[Qt::BusyCursor] = - new QWSCursor(busy_bits, busym_bits, 32, 32, 0, 0); - break; - - case Qt::OpenHandCursor: - systemCursorTable[Qt::OpenHandCursor] = - new QWSCursor(openhand_bits, openhandm_bits, 16, 16, 8, 8); - break; - case Qt::ClosedHandCursor: - systemCursorTable[Qt::ClosedHandCursor] = - new QWSCursor(closedhand_bits, closedhandm_bits, 16, 16, 8, 8); - break; - default: - qWarning("Unknown system cursor %d", id); - } -#endif -} - -QWSCursor *QWSCursor::systemCursor(int id) -{ - QWSCursor *cursor = 0; -#ifdef QT_NO_QWS_CURSOR - Q_UNUSED(id); -#else - 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]; - } -#endif - return cursor; -} - -void QWSCursor::set(const uchar *data, const uchar *mask, - int width, int height, int hx, int hy) -{ -#ifdef QT_NO_QWS_CURSOR - Q_UNUSED(data); - Q_UNUSED(mask); - Q_UNUSED(width); - Q_UNUSED(height); - Q_UNUSED(hx); - Q_UNUSED(hy); -#else - hot.setX(hx); - hot.setY(hy); - - cursor = QImage(width,height, QImage::Format_Indexed8); - - if (!width || !height || !data || !mask || cursor.isNull()) - return; - - cursor.setColorCount(3); - cursor.setColor(0, 0xff000000); - cursor.setColor(1, 0xffffffff); - cursor.setColor(2, 0x00000000); - - int bytesPerLine = (width + 7) / 8; - int p = 0; - int d, m; - - int x = -1, w = 0; - - uchar *cursor_data = cursor.bits(); - int bpl = cursor.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; - } - - if (qt_screencursor && qt_screencursor->supportsAlphaCursor()) - createDropShadow(5, 2); -#endif -} - -// now we're really silly -void QWSCursor::createDropShadow(int dropx, int dropy) -{ - //#### -#if 1 || defined(QT_NO_QWS_CURSOR) || defined(QT_NO_QWS_ALHPA_CURSOR) - Q_UNUSED(dropx); - Q_UNUSED(dropy); -#else - if (cursor.width() + dropx > 64 || cursor.height() + dropy > 64) - return; - - if (!cursor.hasAlphaBuffer()) { - cursor.setAlphaBuffer(true); - - const int nblur=4; - const int darkness=140; - - QImage drop(cursor.width()+dropx+nblur, cursor.height()+dropy+nblur, 8, 18); - drop.setColor(0, 0xff000000); // bg (black) - drop.setColor(1, 0xffffffff); // fg (white) - for (int i=0; i<16; i++) { - drop.setColor(2+i, (darkness*i/16)<<24); - } - drop.fill(2); // all trans - QImage drop2 = drop.copy(); - - int cp; - - // made solid shadow - for (int row = 0; row < cursor.height(); row++) { - for (int col = 0; col < cursor.width(); col++) { - cp = cursor.pixelIndex(col, row); - if (cp != 2) - drop.setPixel(col+dropx, row+dropy, 17); - } - } - - // blur shadow - for (int blur=0; blur -#include -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QWSEvent; -class QWSMouseEvent; -class QWSQCopMessageEvent; -class QVariant; -class QLock; - -class QWSWindowInfo -{ - -public: - - int winid; - unsigned int clientid; - QString name; - -}; - -#define QT_QWS_PROPERTY_CONVERTSELECTION 999 -#define QT_QWS_PROPERTY_WINDOWNAME 998 -#define QT_QWS_PROPERTY_MARKEDTEXT 997 - -class QWSDisplay; -extern Q_GUI_EXPORT QWSDisplay *qt_fbdpy; - -class Q_GUI_EXPORT QWSDisplay -{ -public: - QWSDisplay(); - ~QWSDisplay(); - - static QWSDisplay* instance() { return qt_fbdpy; } - - bool eventPending() const; - QWSEvent *getEvent(); -// QWSRegionManager *regionManager() const; - - uchar* frameBuffer() const; - int width() const; - int height() const; - int depth() const; - int pixmapDepth() const; - bool supportsDepth(int) const; - - uchar *sharedRam() const; - int sharedRamSize() const; - -#ifndef QT_NO_QWS_PROPERTIES - void addProperty(int winId, int property); - void setProperty(int winId, int property, int mode, const QByteArray &data); - void setProperty(int winId, int property, int mode, const char * data); - void removeProperty(int winId, int property); - bool getProperty(int winId, int property, char *&data, int &len); -#endif // QT_NO_QWS_PROPERTIES - - QList windowList(); - int windowAt(const QPoint &); - - void setIdentity(const QString &appName); - void nameRegion(int winId, const QString& n, const QString &c); - void requestRegion(int winId, const QString &surfacekey, - const QByteArray &surfaceData, - const QRegion ®ion); - void repaintRegion(int winId, int windowFlags, bool opaque, QRegion); - void moveRegion(int winId, int dx, int dy); - void destroyRegion(int winId); - void requestFocus(int winId, bool get); - void setAltitude(int winId, int altitude, bool fixed = false); - void setOpacity(int winId, int opacity); - int takeId(); - void setSelectionOwner(int winId, const QTime &time); - void convertSelection(int winId, int selectionProperty, const QString &mimeTypes); - void defineCursor(int id, const QBitmap &curs, const QBitmap &mask, - int hotX, int hotY); - void destroyCursor(int id); - void selectCursor(QWidget *w, unsigned int id); - void setCursorPosition(int x, int y); - void grabMouse(QWidget *w, bool grab); - void grabKeyboard(QWidget *w, bool grab); - void playSoundFile(const QString&); - void registerChannel(const QString &channel); - void sendMessage(const QString &channel, const QString &msg, - const QByteArray &data); - void flushCommands(); -#ifndef QT_NO_QWS_INPUTMETHODS - void sendIMUpdate(int type, int winId, int widgetid); - void resetIM(); - void sendIMResponse(int winId, int property, const QVariant &result); - void sendIMMouseEvent(int index, bool isPress); -#endif - QWSQCopMessageEvent* waitForQCopResponse(); - void sendFontCommand(int type, const QByteArray &fontName); - - void setWindowCaption(QWidget *w, const QString &); - - // Lock display for access only by this process - static bool initLock(const QString &filename, bool create = false); - static bool grabbed(); - static void grab(); - static void grab(bool write); - static void ungrab(); - - static void setTransformation(int transformation, int screenNo = -1); - static void setRawMouseEventFilter(void (*filter)(QWSMouseEvent *)); - -private: - friend int qt_fork_qapplication(); - friend void qt_app_reinit( const QString& newAppName ); - friend class QApplication; - friend class QCopChannel; - friend class QWSEmbedWidget; - friend class QWSEmbedWidgetPrivate; - class Data; - friend class Data; - Data *d; - - friend class QWSMemorySurface; - friend class QWSOnScreenSurface; - friend class QWSDirectPainterSurface; - int getPropertyLen; - char *getPropertyData; - static QLock *lock; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QWSDISPLAY_QWS_H diff --git a/src/gui/embedded/qwsdisplay_qws_p.h b/src/gui/embedded/qwsdisplay_qws_p.h deleted file mode 100644 index aa174c864d7..00000000000 --- a/src/gui/embedded/qwsdisplay_qws_p.h +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSDISPLAY_QWS_P_H -#define QWSDISPLAY_QWS_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 "qwsdisplay_qws.h" -#include "qwssocket_qws.h" -#include "qwsevent_qws.h" -#include -#include "qwscommand_qws_p.h" -#include "qwslock_p.h" - -QT_BEGIN_NAMESPACE - -class QWSDisplay::Data -{ -public: - Data(QObject* parent, bool singleProcess = false); - ~Data(); - - void flush(); - - bool queueNotEmpty(); - QWSEvent *dequeue(); - QWSEvent *peek(); - - bool directServerConnection(); - void fillQueue(); -#ifndef QT_NO_QWS_MULTIPROCESS - void connectToPipe(); - void waitForConnection(); - void waitForPropertyReply(); - void waitForRegionAck(int winId); - void waitForRegionEvents(int winId, bool ungrabDisplay); - bool hasPendingRegionEvents() const; -#endif - void waitForCreation(); -#ifndef QT_NO_COP - void waitForQCopResponse(); -#endif - void init(); - void reinit( const QString& newAppName ); - void create(int n = 1); - - void flushCommands(); - void sendCommand(QWSCommand & cmd); - void sendSynchronousCommand(QWSCommand & cmd); - - QWSEvent *readMore(); - - int takeId(); - - void setMouseFilter(void (*filter)(QWSMouseEvent*)); - - //####public data members - -// QWSRegionManager *rgnMan; - uchar *sharedRam; -#ifndef QT_NO_QWS_MULTIPROCESS - QWSSharedMemory shm; -#endif - int sharedRamSize; - -#ifndef QT_NO_QWS_MULTIPROCESS - static QWSLock *clientLock; - - static bool lockClient(QWSLock::LockType, int timeout = -1); - static void unlockClient(QWSLock::LockType); - static bool waitClient(QWSLock::LockType, int timeout = -1); - static QWSLock* getClientLock(); -#endif // QT_NO_QWS_MULTIPROCESS - -private: -#ifndef QT_NO_QWS_MULTIPROCESS - QWSSocket *csocket; -#endif - QList queue; - -#if 0 - void debugQueue() { - for (int i = 0; i < queue.size(); ++i) { - QWSEvent *e = queue.at(i); - qDebug( " ev %d type %d sl %d rl %d", i, e->type, e->simpleLen, e->rawLen); - } - } -#endif - - QWSConnectedEvent* connected_event; - QWSMouseEvent* mouse_event; - int region_events_count; - int mouse_state; - int mouse_winid; - QPoint region_offset; - int region_offset_window; -#ifndef QT_NO_COP - QWSQCopMessageEvent *qcop_response; -#endif - QWSEvent* current_event; - QList unused_identifiers; -#ifdef QAPPLICATION_EXTRA_DEBUG - int mouse_event_count; -#endif - void (*mouseFilter)(QWSMouseEvent *); - - enum { VariableEvent=-1 }; - -}; - -QT_END_NAMESPACE - -#endif // QWSDISPLAY_QWS_P_H diff --git a/src/gui/embedded/qwsembedwidget.cpp b/src/gui/embedded/qwsembedwidget.cpp deleted file mode 100644 index bbd145caa9f..00000000000 --- a/src/gui/embedded/qwsembedwidget.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwsembedwidget.h" - -#ifndef QT_NO_QWSEMBEDWIDGET - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -// TODO: -// Must remove window decorations from the embedded window -// Focus In/Out, Keyboard/Mouse... -// -// BUG: what if my parent change parent? - -class QWSEmbedWidgetPrivate : public QWidgetPrivate -{ - Q_DECLARE_PUBLIC(QWSEmbedWidget); - -public: - QWSEmbedWidgetPrivate(int winId); - void updateWindow(); - void resize(const QSize &size); - - QWidget *window; - WId windowId; - WId embeddedId; -}; - -QWSEmbedWidgetPrivate::QWSEmbedWidgetPrivate(int winId) - : window(0), windowId(0), embeddedId(winId) -{ -} - -void QWSEmbedWidgetPrivate::updateWindow() -{ - Q_Q(QWSEmbedWidget); - - QWidget *win = q->window(); - if (win == window) - return; - - if (window) { - window->removeEventFilter(q); - QWSEmbedCommand command; - command.setData(windowId, embeddedId, QWSEmbedEvent::StopEmbed); - QWSDisplay::instance()->d->sendCommand(command); - } - - window = win; - if (!window) - return; - windowId = window->winId(); - - QWSEmbedCommand command; - command.setData(windowId, embeddedId, QWSEmbedEvent::StartEmbed); - QWSDisplay::instance()->d->sendCommand(command); - window->installEventFilter(q); - q->installEventFilter(q); -} - -void QWSEmbedWidgetPrivate::resize(const QSize &size) -{ - if (!window) - return; - - Q_Q(QWSEmbedWidget); - - QWSEmbedCommand command; - command.setData(windowId, embeddedId, QWSEmbedEvent::Region, - QRect(q->mapToGlobal(QPoint(0, 0)), size)); - QWSDisplay::instance()->d->sendCommand(command); -} - -/*! - \class QWSEmbedWidget - \since 4.2 - \ingroup qws - \ingroup advanced - - \brief The QWSEmbedWidget class enables embedded top-level widgets - in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - QWSEmbedWidget inherits QWidget and acts as any other widget, but - in addition it is capable of embedding another top-level widget. - - An example of use is when painting directly onto the screen using - the QDirectPainter class. Then the reserved region can be embedded - into an instance of the QWSEmbedWidget class, providing for - example event handling and size policies for the reserved region. - - All that is required to embed a top-level widget is its window ID. - - \sa {Qt for Embedded Linux Architecture} -*/ - -/*! - Constructs a widget with the given \a parent, embedding the widget - identified by the given window \a id. -*/ -QWSEmbedWidget::QWSEmbedWidget(WId id, QWidget *parent) - : QWidget(*new QWSEmbedWidgetPrivate(id), parent, 0) -{ - Q_D(QWSEmbedWidget); - d->updateWindow(); -} - -/*! - Destroys this widget. -*/ -QWSEmbedWidget::~QWSEmbedWidget() -{ - Q_D(QWSEmbedWidget); - if (!d->window) - return; - - QWSEmbedCommand command; - command.setData(d->windowId, d->embeddedId, QWSEmbedEvent::StopEmbed); - QWSDisplay::instance()->d->sendCommand(command); -} - -/*! - \reimp -*/ -bool QWSEmbedWidget::eventFilter(QObject *object, QEvent *event) -{ - Q_D(QWSEmbedWidget); - if (object == d->window && event->type() == QEvent::Move) - resizeEvent(0); - else if (object == this && event->type() == QEvent::Hide) - d->resize(QSize()); - return QWidget::eventFilter(object, event); -} - -/*! - \reimp -*/ -void QWSEmbedWidget::changeEvent(QEvent *event) -{ - Q_D(QWSEmbedWidget); - if (event->type() == QEvent::ParentChange) - d->updateWindow(); -} - -/*! - \reimp -*/ -void QWSEmbedWidget::resizeEvent(QResizeEvent*) -{ - Q_D(QWSEmbedWidget); - d->resize(rect().size()); -} - -/*! - \reimp -*/ -void QWSEmbedWidget::moveEvent(QMoveEvent*) -{ - resizeEvent(0); -} - -/*! - \reimp -*/ -void QWSEmbedWidget::hideEvent(QHideEvent*) -{ - Q_D(QWSEmbedWidget); - d->resize(QSize()); -} - -/*! - \reimp -*/ -void QWSEmbedWidget::showEvent(QShowEvent*) -{ - Q_D(QWSEmbedWidget); - d->resize(rect().size()); -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWSEMBEDWIDGET diff --git a/src/gui/embedded/qwsevent_qws.cpp b/src/gui/embedded/qwsevent_qws.cpp deleted file mode 100644 index 32aa9848447..00000000000 --- a/src/gui/embedded/qwsevent_qws.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwsevent_qws.h" - -QT_BEGIN_NAMESPACE - -QWSEvent *QWSEvent::factory(int type) -{ - QWSEvent *event = 0; - switch (type) { - case QWSEvent::Connected: - event = new QWSConnectedEvent; - break; - case QWSEvent::MaxWindowRect: - event = new QWSMaxWindowRectEvent; - break; - case QWSEvent::Mouse: - event = new QWSMouseEvent; - break; - case QWSEvent::Focus: - event = new QWSFocusEvent; - break; - case QWSEvent::Key: - event = new QWSKeyEvent; - break; - case QWSEvent::Region: - event = new QWSRegionEvent; - break; - case QWSEvent::Creation: - event = new QWSCreationEvent; - break; -#ifndef QT_NO_QWS_PROPERTIES - case QWSEvent::PropertyNotify: - event = new QWSPropertyNotifyEvent; - break; - case QWSEvent::PropertyReply: - event = new QWSPropertyReplyEvent; - break; -#endif // QT_NO_QWS_PROPERTIES - case QWSEvent::SelectionClear: - event = new QWSSelectionClearEvent; - break; - case QWSEvent::SelectionRequest: - event = new QWSSelectionRequestEvent; - break; - case QWSEvent::SelectionNotify: - event = new QWSSelectionNotifyEvent; - break; -#ifndef QT_NO_COP - case QWSEvent::QCopMessage: - event = new QWSQCopMessageEvent; - break; -#endif - case QWSEvent::WindowOperation: - event = new QWSWindowOperationEvent; - break; - -#ifndef QT_NO_QWS_INPUTMETHODS - case QWSEvent::IMEvent: - event = new QWSIMEvent; - break; - case QWSEvent::IMQuery: - event = new QWSIMQueryEvent; - break; - case QWSEvent::IMInit: - event = new QWSIMInitEvent; - break; -#endif -#ifndef QT_NO_QWSEMBEDWIDGET - case QWSEvent::Embed: - event = new QWSEmbedEvent; - break; -#endif - case QWSEvent::Font: - event = new QWSFontEvent; - break; - case QWSEvent::ScreenTransformation: - event = new QWSScreenTransformationEvent; - break; - default: - qCritical("QWSEvent::factory() : Unknown event type %08x!", type); - } - return event; -} - -/*! - \class QWSEvent - \ingroup qws - - \brief The QWSEvent class encapsulates an event in Qt for Embedded Linux. - - When running a \l{Qt for Embedded Linux} application, it either runs as a - server or connects to an existing server. All system generated - events are passed to the server application which then propagates - the event to the appropriate client. - - Whenever the server receives an event, it queries its stack of - top-level windows to find the window containing the event's - position. Each window can identify the client application that - created it, and returns its ID to the server upon - request. Finally, the server forwards the event, encapsulated by - an instance of the QWSEvent class, to the appropriate client. - - \image qt-embedded-client.png - - The server communicates with the client applications over the UNIX - domain socket. You can retrieve direct access to all the events a - client receives from the server, by reimplementing QApplication's - \l {QApplication::}{qwsEventFilter()} function. - - QWSEvent provides the \l Type enum specifying the origin of the - event. Internally, each type is represented by a QWSEvent - subclass, e.g., \c QWSKeyEvent. - - \sa QWSServer, QWSClient, {Qt for Embedded Linux Architecture} -*/ - -/*! - \enum QWSEvent::Type - - This enum describes the origin of the event. - - \value NoEvent No event has occurred. - \value Connected An application has connected to the server. - \value Mouse A mouse button is pressed or released, or the mouse cursor is moved. - See also \l{Qt for Embedded Linux Pointer Handling}. - \value Focus A window has lost or received focus. - \value Key A key is pressed or released. See also \l{Qt for Embedded Linux Character Input}. - \value Region A region has changed. - \value Creation The server has created an ID, typically for a window. - \value PropertyNotify A property has changed. - \value PropertyReply The server is responding to a request for a property's value. - \value SelectionClear A selection is deleted. - \value SelectionRequest The server has queried for a selection. - \value SelectionNotify A new selection has been created. - \value MaxWindowRect The server has changed the maximum window for an application. - \value QCopMessage A new Qt Cop message has appeared. See also QCopChannel - \value WindowOperation A window operation, e.g. resizing, has occurred. - \value IMEvent An input method has been used to enter text for languages with - non-Latin alphabets. See also QWSInputMethod. - \value IMQuery An input method query for a specified property has occurred. - See also QWSInputMethod. - \value NEvent The number of events has changed. - \value Embed An event used internally to implement embedded windows. See also - QWSEmbedWidget. - \value ScreenTransformation An event used internally to notify the client processes - that the screen has changed for example, rotation, etc. - \omitvalue Font - \omitvalue IMInit -*/ - -/*! - \fn QWSMouseEvent *QWSEvent::asMouse() - \internal -*/ - -/*! - \fn int QWSEvent::window() - \internal -*/ - -/*! - \fn int QWSEvent::window() const - \internal -*/ - -/*! - \fn QWSEvent *QWSEvent::factory(int type) - \internal -*/ - -/*! - \fn QWSEvent::QWSEvent( int t, int len, char * ptr) - \internal -*/ - -QT_END_NAMESPACE diff --git a/src/gui/embedded/qwsevent_qws.h b/src/gui/embedded/qwsevent_qws.h deleted file mode 100644 index 9bc269e1936..00000000000 --- a/src/gui/embedded/qwsevent_qws.h +++ /dev/null @@ -1,459 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSEVENT_QWS_H -#define QWSEVENT_QWS_H - -#include -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -struct QWSMouseEvent; - -struct QWSEvent : QWSProtocolItem { - - QWSEvent(int t, int len, char *ptr) : QWSProtocolItem(t,len,ptr) {} - - - - enum Type { - NoEvent, - Connected, - Mouse, - Focus, - Key, - Region, - Creation, - PropertyNotify, - PropertyReply, - SelectionClear, - SelectionRequest, - SelectionNotify, - MaxWindowRect, - QCopMessage, - WindowOperation, - IMEvent, - IMQuery, - IMInit, - Embed, - Font, - ScreenTransformation, - NEvent - }; - - QWSMouseEvent *asMouse() - { return type == Mouse ? reinterpret_cast(this) : 0; } - int window() { return *(reinterpret_cast(simpleDataPtr)); } - int window() const { return *(reinterpret_cast(simpleDataPtr)); } - static QWSEvent *factory(int type); -}; - - -//All events must start with windowID - -struct QWSConnectedEvent : QWSEvent { - QWSConnectedEvent() - : QWSEvent(QWSEvent::Connected, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem = true) { - QWSEvent::setData(d, len, allocateMem); - display = reinterpret_cast(rawDataPtr); - } - - struct SimpleData { - int window; - int len; - int clientId; - int servershmid; - } simpleData; - - char *display; -}; - -struct QWSMaxWindowRectEvent : QWSEvent { - QWSMaxWindowRectEvent() - : QWSEvent(MaxWindowRect, sizeof(simpleData), reinterpret_cast(&simpleData)) { } - struct SimpleData { - int window; - QRect rect; - } simpleData; -}; - -struct QWSMouseEvent : QWSEvent { - QWSMouseEvent() - : QWSEvent(QWSEvent::Mouse, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - struct SimpleData { - int window; - int x_root, y_root, state, delta; - int time; // milliseconds - } simpleData; -}; - -struct QWSFocusEvent : QWSEvent { - QWSFocusEvent() - : QWSEvent(QWSEvent::Focus, sizeof(simpleData), reinterpret_cast(&simpleData)) - { memset(reinterpret_cast(&simpleData),0,sizeof(simpleData)); } - struct SimpleData { - int window; - uint get_focus:1; - } simpleData; -}; - -struct QWSKeyEvent: QWSEvent { - QWSKeyEvent() - : QWSEvent(QWSEvent::Key, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - struct SimpleData { - int window; - uint keycode; - Qt::KeyboardModifiers modifiers; - ushort unicode; - uint is_press:1; - uint is_auto_repeat:1; - } simpleData; -}; - - -struct QWSCreationEvent : QWSEvent { - QWSCreationEvent() - : QWSEvent(QWSEvent::Creation, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - struct SimpleData { - int objectid; - int count; - } simpleData; -}; - -#ifndef QT_NO_QWS_PROPERTIES -struct QWSPropertyNotifyEvent : QWSEvent { - QWSPropertyNotifyEvent() - : QWSEvent(QWSEvent::PropertyNotify, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - enum State { - PropertyNewValue, - PropertyDeleted - }; - struct SimpleData { - int window; - int property; - int state; - } simpleData; -}; -#endif - -struct QWSSelectionClearEvent : QWSEvent { - QWSSelectionClearEvent() - : QWSEvent(QWSEvent::SelectionClear, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - struct SimpleData { - int window; - } simpleData; -}; - -struct QWSSelectionRequestEvent : QWSEvent { - QWSSelectionRequestEvent() - : QWSEvent(QWSEvent::SelectionRequest, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - struct SimpleData { - int window; - int requestor; // window which wants the selection - int property; // property on requestor into which the selection should be stored, normally QWSProperty::PropSelection - int mimeTypes; // Value is stored in the property mimeType on the requestor window. This value may contain - // multiple mimeTypes separated by ;; where the order reflects the priority - } simpleData; -}; - -struct QWSSelectionNotifyEvent : QWSEvent { - QWSSelectionNotifyEvent() - : QWSEvent(QWSEvent::SelectionNotify, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - struct SimpleData { - int window; - int requestor; // the window which wanted the selection and to which this event is sent - int property; // property of requestor in which the data of the selection is stored - int mimeType; // a property on the requestor in which the mime type in which the selection is, is stored - } simpleData; -}; - -//complex events: - -struct QWSRegionEvent : QWSEvent { - QWSRegionEvent() - : QWSEvent(QWSEvent::Region, sizeof(simpleData), - reinterpret_cast(&simpleData)) - { memset(reinterpret_cast(&simpleData),0,sizeof(simpleData)); } - - void setData(const char *d, int len, bool allocateMem = true) { - QWSEvent::setData(d, len, allocateMem); - rectangles = reinterpret_cast(rawDataPtr); - } - - void setData(int winId, const QRegion ®ion, uint type) { - const QVector rects = region.rects(); - setData(reinterpret_cast(rects.constData()), - rects.size() * sizeof(QRect)); - simpleData.window = winId; - simpleData.nrectangles = rects.size(); - simpleData.type = type; -#ifdef QT_QWS_CLIENTBLIT - simpleData.id = 0; -#endif - } - - enum Type {Allocation -#ifdef QT_QWS_CLIENTBLIT - , DirectPaint -#endif - }; - struct SimpleData { - int window; - int nrectangles; -#ifdef QT_QWS_CLIENTBLIT - int id; -#endif - uint type:8; - } simpleData; - - QRect *rectangles; -}; - -#ifndef QT_NO_QWSEMBEDWIDGET -struct QWSEmbedEvent : QWSEvent -{ - QWSEmbedEvent() : QWSEvent(QWSEvent::Embed, sizeof(simpleData), - reinterpret_cast(&simpleData)) - {} - - enum Type { StartEmbed = 1, StopEmbed = 2, Region = 4 }; - - void setData(const char *d, int len, bool allocateMem = true) { - QWSEvent::setData(d, len, allocateMem); - region.setRects(reinterpret_cast(rawDataPtr), - simpleData.nrectangles); - } - - void setData(int winId, Type type, const QRegion ® = QRegion()) { - simpleData.window = winId; - simpleData.nrectangles = reg.rects().size(); - simpleData.type = type; - region = reg; - const QVector rects = reg.rects(); - QWSEvent::setData(reinterpret_cast(rects.data()), - rects.size() * sizeof(QRect)); - } - - struct SimpleData { - int window; - int nrectangles; - Type type; - } simpleData; - - QRegion region; -}; -#endif // QT_NO_QWSEMBEDWIDGET - -#ifndef QT_NO_QWS_PROPERTIES -struct QWSPropertyReplyEvent : QWSEvent { - QWSPropertyReplyEvent() - : QWSEvent(QWSEvent::PropertyReply, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - - void setData(const char *d, int len, bool allocateMem = true) { - QWSEvent::setData(d, len, allocateMem); - data = reinterpret_cast(rawDataPtr); - } - - struct SimpleData { - int window; - int property; - int len; - } simpleData; - char *data; -}; -#endif //QT_NO_QWS_PROPERTIES - -#ifndef QT_NO_COP -struct QWSQCopMessageEvent : QWSEvent { - QWSQCopMessageEvent() - : QWSEvent(QWSEvent::QCopMessage, sizeof(simpleData), - reinterpret_cast(&simpleData)) - { memset(reinterpret_cast(&simpleData),0,sizeof(simpleData)); } - - void setData(const char *d, int len, bool allocateMem = true) { - QWSEvent::setData(d, len, allocateMem); - char* p = rawDataPtr; - channel = QByteArray(p, simpleData.lchannel); - p += simpleData.lchannel; - message = QByteArray(p, simpleData.lmessage); - p += simpleData.lmessage; - data = QByteArray(p, simpleData.ldata); - } - - void setDataDirect(const char *d, int len) { - QWSEvent::setData(d, len, false); - deleteRaw = true; - } - - struct SimpleData { - bool is_response; - int lchannel; - int lmessage; - int ldata; - } simpleData; - - QByteArray channel; - QByteArray message; - QByteArray data; -}; - -#endif - -struct QWSWindowOperationEvent : QWSEvent { - QWSWindowOperationEvent() - : QWSEvent(WindowOperation, sizeof(simpleData), reinterpret_cast(&simpleData)) { } - - enum Operation { Show, Hide, ShowMaximized, ShowNormal, ShowMinimized, Close }; - struct SimpleData { - int window; - Operation op; - } simpleData; -}; - -#ifndef QT_NO_QWS_INPUTMETHODS - - -struct QWSIMEvent : QWSEvent { - QWSIMEvent() - : QWSEvent(IMEvent, sizeof(simpleData), reinterpret_cast(&simpleData)) - { memset(reinterpret_cast(&simpleData),0,sizeof(simpleData)); } - - struct SimpleData { - int window; - int replaceFrom; - int replaceLength; - } simpleData; - - void setData(const char *d, int len, bool allocateMem = true) { - QWSEvent::setData(d, len, allocateMem); - streamingData = QByteArray::fromRawData(rawDataPtr, len); - } - QByteArray streamingData; -}; - - -struct QWSIMInitEvent : QWSEvent { - QWSIMInitEvent() - : QWSEvent(IMInit, sizeof(simpleData), reinterpret_cast(&simpleData)) - { memset(reinterpret_cast(&simpleData),0,sizeof(simpleData)); } - - struct SimpleData { - int window; - int existence; - } simpleData; - - void setData(const char *d, int len, bool allocateMem = true) { - QWSEvent::setData(d, len, allocateMem); - streamingData = QByteArray::fromRawData(rawDataPtr, len); - } - QByteArray streamingData; -}; - - -struct QWSIMQueryEvent : QWSEvent { - QWSIMQueryEvent() - : QWSEvent(QWSEvent::IMQuery, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int window; - int property; - } simpleData; - -}; - -#endif - -struct QWSFontEvent : QWSEvent { - QWSFontEvent() - : QWSEvent(QWSEvent::Font, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - - enum EventType { - FontRemoved - }; - - void setData(const char *d, int len, bool allocateMem = true) { - QWSEvent::setData(d, len, allocateMem); - fontName = QByteArray::fromRawData(rawDataPtr, len); - } - - struct SimpleData { - uchar type; - } simpleData; - QByteArray fontName; -}; - -struct QWSScreenTransformationEvent : QWSEvent { - QWSScreenTransformationEvent() - : QWSEvent(QWSEvent::ScreenTransformation, sizeof(simpleData), - reinterpret_cast(&simpleData)) {} - - struct SimpleData { - int screen; - int transformation; - } simpleData; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QWSEVENT_QWS_H diff --git a/src/gui/embedded/qwslock.cpp b/src/gui/embedded/qwslock.cpp deleted file mode 100644 index a64dc3d9c42..00000000000 --- a/src/gui/embedded/qwslock.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwslock_p.h" - -#ifndef QT_NO_QWS_MULTIPROCESS - -#include "qwssignalhandler_p.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef Q_OS_LINUX -#include -#endif -#include - -#include - -QT_BEGIN_NAMESPACE - -#ifdef QT_NO_SEMAPHORE -#error QWSLock currently requires semaphores -#endif - -QWSLock::QWSLock() -{ - semId = semget(IPC_PRIVATE, 3, IPC_CREAT | 0666); - - if (semId == -1) { - perror("QWSLock::QWSLock"); - qFatal("Unable to create semaphore"); - } - QWSSignalHandler::instance()->addSemaphore(semId); - - qt_semun semval; - semval.val = 1; - - if (semctl(semId, BackingStore, SETVAL, semval) == -1) { - perror("QWSLock::QWSLock"); - qFatal("Unable to initialize backingstore semaphore"); - } - lockCount[BackingStore] = 0; - - if (semctl(semId, Communication, SETVAL, semval) == -1) { - perror("QWSLock::QWSLock"); - qFatal("Unable to initialize communication semaphore"); - } - lockCount[Communication] = 0; - - semval.val = 0; - if (semctl(semId, RegionEvent, SETVAL, semval) == -1) { - perror("QWSLock::QWSLock"); - qFatal("Unable to initialize region event semaphore"); - } -} - -QWSLock::QWSLock(int id) -{ - semId = id; - QWSSignalHandler::instance()->addSemaphore(semId); - lockCount[0] = lockCount[1] = 0; -} - -QWSLock::~QWSLock() -{ - if (semId == -1) - return; - QWSSignalHandler::instance()->removeSemaphore(semId); -} - -static bool forceLock(int semId, unsigned short semNum, int) -{ - int ret; - do { - sembuf sops = { semNum, -1, 0 }; - - // As the BackingStore lock is a mutex, and only one process may own - // the lock, it's safe to use SEM_UNDO. On the other hand, the - // Communication lock is locked by the client but unlocked by the - // server and therefore can't use SEM_UNDO. - if (semNum == QWSLock::BackingStore) - sops.sem_flg |= SEM_UNDO; - - ret = semop(semId, &sops, 1); - if (ret == -1 && errno != EINTR) - qDebug("QWSLock::lock: %s", strerror(errno)); - } while (ret == -1 && errno == EINTR); - - return (ret != -1); -} - -static bool up(int semId, unsigned short semNum) -{ - int ret; - do { - sembuf sops = { semNum, 1, 0 }; - ret = semop(semId, &sops, 1); - if (ret == -1 && errno != EINTR) - qDebug("QWSLock::up: %s", strerror(errno)); - } while (ret == -1 && errno == EINTR); - - return (ret != -1); -} - -static bool down(int semId, unsigned short semNum) -{ - int ret; - do { - sembuf sops = { semNum, -1, 0 }; - ret = semop(semId, &sops, 1); - if (ret == -1 && errno != EINTR) - qDebug("QWSLock::down: %s", strerror(errno)); - } while (ret == -1 && errno == EINTR); - - return (ret != -1); -} - -static int getValue(int semId, unsigned short semNum) -{ - int ret; - do { - ret = semctl(semId, semNum, GETVAL, 0); - if (ret == -1 && errno != EINTR) - qDebug("QWSLock::getValue: %s", strerror(errno)); - } while (ret == -1 && errno == EINTR); - - return ret; -} - -bool QWSLock::lock(LockType type, int timeout) -{ - if (type == RegionEvent) - return up(semId, RegionEvent); - - if (hasLock(type)) { - ++lockCount[type]; - return true; - } - - if (!forceLock(semId, type, timeout)) - return false; - ++lockCount[type]; - return true; -} - -bool QWSLock::hasLock(LockType type) -{ - if (type == RegionEvent) - return (getValue(semId, RegionEvent) == 0); - - return (lockCount[type] > 0); -} - -void QWSLock::unlock(LockType type) -{ - if (type == RegionEvent) { - down(semId, RegionEvent); - return; - } - - if (hasLock(type)) { - --lockCount[type]; - if (hasLock(type)) - return; - } - - const unsigned short semNum = type; - int ret; - do { - sembuf sops = {semNum, 1, 0}; - if (semNum == QWSLock::BackingStore) - sops.sem_flg |= SEM_UNDO; - - ret = semop(semId, &sops, 1); - if (ret == -1 && errno != EINTR) - qDebug("QWSLock::unlock: %s", strerror(errno)); - } while (ret == -1 && errno == EINTR); -} - -bool QWSLock::wait(LockType type, int timeout) -{ - bool ok = forceLock(semId, type, timeout); - if (ok) - unlock(type); - return ok; -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_MULTIPROCESS diff --git a/src/gui/embedded/qwslock_p.h b/src/gui/embedded/qwslock_p.h deleted file mode 100644 index 9a7f27979b0..00000000000 --- a/src/gui/embedded/qwslock_p.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSLOCK_P_H -#define QWSLOCK_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. This header file may -// change from version to version without notice, or even be -// removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_QWS_MULTIPROCESS - -class QWSLock -{ -public: - enum LockType { BackingStore, Communication, RegionEvent }; - - QWSLock(); - QWSLock(int lockId); - ~QWSLock(); - - bool lock(LockType type, int timeout = -1); - void unlock(LockType type); - bool wait(LockType type, int timeout = -1); - bool hasLock(LockType type); - int id() const { return semId; } - -private: - int semId; - int lockCount[2]; -}; - - -QT_END_NAMESPACE -#endif // QT_NO_QWS_MULTIPROCESS -#endif // QWSLOCK_P_H diff --git a/src/gui/embedded/qwsmanager_p.h b/src/gui/embedded/qwsmanager_p.h deleted file mode 100644 index 425c4e0098d..00000000000 --- a/src/gui/embedded/qwsmanager_p.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSMANAGER_P_H -#define QWSMANAGER_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 "QtGui/qregion.h" -#include "QtGui/qdecoration_qws.h" - -#ifndef QT_NO_QWS_MANAGER - -#include "QtCore/qhash.h" - -QT_BEGIN_NAMESPACE - -class QWidget; -class QMenu; - -class QWSManagerPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QWSManager) -public: - QWSManagerPrivate(); - - int activeRegion; - QWidget *managed; - QMenu *popup; - - enum MenuAction { - NormalizeAction, - TitleAction, - BottomRightAction, - MinimizeAction, - MaximizeAction, - CloseAction, - LastMenuAction - }; - QAction *menuActions[LastMenuAction]; - - static QWidget *active; - static QPoint mousePos; - - // Region caching to avoid getting a regiontype's - // QRegion for each mouse move event - int previousRegionType; - bool previousRegionRepainted; // Hover/Press handled - bool entireDecorationNeedsRepaint; - struct RegionCaching { - int regionType; - QRegion region; - Qt::WindowFlags windowFlags; - QRect windowGeometry; - } cached_region; - - bool newCachedRegion(const QPoint &pos); - int cachedRegionAt() - { return cached_region.regionType; } - - void dirtyRegion(int decorationRegion, - QDecoration::DecorationState state, - const QRegion &clip = QRegion()); - void clearDirtyRegions(); - - QList dirtyRegions; - QList dirtyStates; - QRegion dirtyClip; -}; - -#endif // QT_NO_QWS_MANAGER - -QT_END_NAMESPACE - -#endif // QWSMANAGER_P_H diff --git a/src/gui/embedded/qwsmanager_qws.cpp b/src/gui/embedded/qwsmanager_qws.cpp deleted file mode 100644 index 7612203c802..00000000000 --- a/src/gui/embedded/qwsmanager_qws.cpp +++ /dev/null @@ -1,537 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwsmanager_qws.h" - -#ifndef QT_NO_QWS_MANAGER - -#include "qdrawutil.h" -#include "qapplication.h" -#include "qstyle.h" -#include "qwidget.h" -#include "qmenu.h" -#include "qpainter.h" -#include "private/qpainter_p.h" -#include "qregion.h" -#include "qevent.h" -#include "qcursor.h" -#include "qwsdisplay_qws.h" -#include "qdesktopwidget.h" - -#include -#include -#include -#include -#include "qdecorationfactory_qws.h" - -#include "qlayout.h" - -#include "qwsmanager_p.h" - -#include - -QT_BEGIN_NAMESPACE - -QWidget *QWSManagerPrivate::active = 0; -QPoint QWSManagerPrivate::mousePos; - - -QWSManagerPrivate::QWSManagerPrivate() - : QObjectPrivate(), activeRegion(QDecoration::None), managed(0), popup(0), - previousRegionType(0), previousRegionRepainted(false), entireDecorationNeedsRepaint(false) -{ - cached_region.regionType = 0; -} - -QRegion &QWSManager::cachedRegion() -{ - return d_func()->cached_region.region; -} - -/*! - \class QWSManager - \ingroup qws - \internal -*/ - -/*! - -*/ -QWSManager::QWSManager(QWidget *w) - : QObject(*new QWSManagerPrivate, (QObject*)0) -{ - d_func()->managed = w; - -} - -QWSManager::~QWSManager() -{ - Q_D(QWSManager); -#ifndef QT_NO_MENU - if (d->popup) - delete d->popup; -#endif - if (d->managed == QWSManagerPrivate::active) - QWSManagerPrivate::active = 0; -} - -QWidget *QWSManager::widget() -{ - Q_D(QWSManager); - return d->managed; -} - -QWidget *QWSManager::grabbedMouse() -{ - return QWSManagerPrivate::active; -} - -QRegion QWSManager::region() -{ - Q_D(QWSManager); - return QApplication::qwsDecoration().region(d->managed, d->managed->geometry()); -} - -bool QWSManager::event(QEvent *e) -{ - if (QObject::event(e)) - return true; - - switch (e->type()) { - case QEvent::MouseMove: - mouseMoveEvent((QMouseEvent*)e); - break; - - case QEvent::MouseButtonPress: - mousePressEvent((QMouseEvent*)e); - break; - - case QEvent::MouseButtonRelease: - mouseReleaseEvent((QMouseEvent*)e); - break; - - case QEvent::MouseButtonDblClick: - mouseDoubleClickEvent((QMouseEvent*)e); - break; - - case QEvent::Paint: - paintEvent((QPaintEvent*)e); - break; - - default: - return false; - break; - } - - return true; -} - -void QWSManager::mousePressEvent(QMouseEvent *e) -{ - Q_D(QWSManager); - d->mousePos = e->globalPos(); - d->activeRegion = QApplication::qwsDecoration().regionAt(d->managed, d->mousePos); - if(d->cached_region.regionType) - d->previousRegionRepainted |= repaintRegion(d->cached_region.regionType, QDecoration::Pressed); - - if (d->activeRegion == QDecoration::Menu) { - QPoint pos = (QApplication::layoutDirection() == Qt::LeftToRight - ? d->managed->geometry().topLeft() - : d->managed->geometry().topRight()); - menu(pos); - } - if (d->activeRegion != QDecoration::None && - d->activeRegion != QDecoration::Menu) { - d->active = d->managed; - d->managed->grabMouse(); - } - if (d->activeRegion != QDecoration::None && - d->activeRegion != QDecoration::Close && - d->activeRegion != QDecoration::Minimize && - d->activeRegion != QDecoration::Menu) { - d->managed->raise(); - } - - if (e->button() == Qt::RightButton) { - menu(e->globalPos()); - } -} - -void QWSManager::mouseReleaseEvent(QMouseEvent *e) -{ - Q_D(QWSManager); - d->managed->releaseMouse(); - if (d->cached_region.regionType && d->previousRegionRepainted && QApplication::mouseButtons() == 0) { - bool doesHover = repaintRegion(d->cached_region.regionType, QDecoration::Hover); - if (!doesHover) { - repaintRegion(d->cached_region.regionType, QDecoration::Normal); - d->previousRegionRepainted = false; - } - } - - if (e->button() == Qt::LeftButton) { - //handleMove(); - int itm = QApplication::qwsDecoration().regionAt(d->managed, e->globalPos()); - int activatedItem = d->activeRegion; - d->activeRegion = QDecoration::None; - d->active = 0; - if (activatedItem == itm) - QApplication::qwsDecoration().regionClicked(d->managed, itm); - } else if (d->activeRegion == QDecoration::None) { - d->active = 0; - } -} - -void QWSManager::mouseDoubleClickEvent(QMouseEvent *e) -{ - Q_D(QWSManager); - if (e->button() == Qt::LeftButton) - QApplication::qwsDecoration().regionDoubleClicked(d->managed, - QApplication::qwsDecoration().regionAt(d->managed, e->globalPos())); -} - -static inline Qt::CursorShape regionToShape(int region) -{ - if (region == QDecoration::None) - return Qt::ArrowCursor; - - static const struct { - int region; - Qt::CursorShape shape; - } r2s[] = { - { QDecoration::TopLeft, Qt::SizeFDiagCursor }, - { QDecoration::Top, Qt::SizeVerCursor}, - { QDecoration::TopRight, Qt::SizeBDiagCursor}, - { QDecoration::Left, Qt::SizeHorCursor}, - { QDecoration::Right, Qt::SizeHorCursor}, - { QDecoration::BottomLeft, Qt::SizeBDiagCursor}, - { QDecoration::Bottom, Qt::SizeVerCursor}, - { QDecoration::BottomRight, Qt::SizeFDiagCursor}, - { QDecoration::None, Qt::ArrowCursor} - }; - - int i = 0; - while (region != r2s[i].region && r2s[i].region) - ++i; - return r2s[i].shape; -} - -void QWSManager::mouseMoveEvent(QMouseEvent *e) -{ - Q_D(QWSManager); - if (d->newCachedRegion(e->globalPos())) { - if(d->previousRegionType && d->previousRegionRepainted) - repaintRegion(d->previousRegionType, QDecoration::Normal); - if(d->cached_region.regionType) { - d->previousRegionRepainted = repaintRegion(d->cached_region.regionType, QDecoration::Hover); - } - } - - -#ifndef QT_NO_CURSOR - if (d->managed->minimumSize() != d->managed->maximumSize()) { - QWSDisplay *qwsd = QApplication::desktop()->qwsDisplay(); - qwsd->selectCursor(d->managed, regionToShape(d->cachedRegionAt())); - } -#endif //QT_NO_CURSOR - - if (d->activeRegion) - handleMove(e->globalPos()); -} - -void QWSManager::handleMove(QPoint g) -{ - Q_D(QWSManager); - - // don't allow dragging to where the user probably cannot click! - QApplicationPrivate *ap = QApplicationPrivate::instance(); - const QRect maxWindowRect = ap->maxWindowRect(qt_screen); - if (maxWindowRect.isValid()) { - if (g.x() < maxWindowRect.x()) - g.setX(maxWindowRect.x()); - if (g.y() < maxWindowRect.y()) - g.setY(maxWindowRect.y()); - if (g.x() > maxWindowRect.right()) - g.setX(maxWindowRect.right()); - if (g.y() > maxWindowRect.bottom()) - g.setY(maxWindowRect.bottom()); - } - - if (g == d->mousePos) - return; - - if ( d->managed->isMaximized() ) - return; - - int x = d->managed->geometry().x(); - int y = d->managed->geometry().y(); - int w = d->managed->width(); - int h = d->managed->height(); - - QRect geom(d->managed->geometry()); - - QPoint delta = g - d->mousePos; - d->mousePos = g; - - if (d->activeRegion == QDecoration::Title) { - geom = QRect(x + delta.x(), y + delta.y(), w, h); - } else { - bool keepTop = true; - bool keepLeft = true; - switch (d->activeRegion) { - case QDecoration::Top: - geom.setTop(geom.top() + delta.y()); - keepTop = false; - break; - case QDecoration::Bottom: - geom.setBottom(geom.bottom() + delta.y()); - keepTop = true; - break; - case QDecoration::Left: - geom.setLeft(geom.left() + delta.x()); - keepLeft = false; - break; - case QDecoration::Right: - geom.setRight(geom.right() + delta.x()); - keepLeft = true; - break; - case QDecoration::TopRight: - geom.setTopRight(geom.topRight() + delta); - keepLeft = true; - keepTop = false; - break; - case QDecoration::TopLeft: - geom.setTopLeft(geom.topLeft() + delta); - keepLeft = false; - keepTop = false; - break; - case QDecoration::BottomLeft: - geom.setBottomLeft(geom.bottomLeft() + delta); - keepLeft = false; - keepTop = true; - break; - case QDecoration::BottomRight: - geom.setBottomRight(geom.bottomRight() + delta); - keepLeft = true; - keepTop = true; - break; - default: - return; - } - - QSize newSize = QLayout::closestAcceptableSize(d->managed, geom.size()); - - int dx = newSize.width() - geom.width(); - int dy = newSize.height() - geom.height(); - - if (keepTop) { - geom.setBottom(geom.bottom() + dy); - d->mousePos.ry() += dy; - } else { - geom.setTop(geom.top() - dy); - d->mousePos.ry() -= dy; - } - if (keepLeft) { - geom.setRight(geom.right() + dx); - d->mousePos.rx() += dx; - } else { - geom.setLeft(geom.left() - dx); - d->mousePos.rx() -= dx; - } - } - if (geom != d->managed->geometry()) { - QApplication::sendPostedEvents(); - d->managed->setGeometry(geom); - } -} - -void QWSManager::paintEvent(QPaintEvent *) -{ - Q_D(QWSManager); - d->dirtyRegion(QDecoration::All, QDecoration::Normal); -} - -void QWSManagerPrivate::dirtyRegion(int decorationRegion, - QDecoration::DecorationState state, - const QRegion &clip) -{ - QTLWExtra *topextra = managed->d_func()->extra->topextra; - QWidgetBackingStore *bs = topextra->backingStore.data(); - const bool pendingUpdateRequest = bs->isDirty(); - - if (decorationRegion == QDecoration::All) { - if (clip.isEmpty()) - entireDecorationNeedsRepaint = true; - dirtyRegions.clear(); - dirtyStates.clear(); - } - int i = dirtyRegions.indexOf(decorationRegion); - if (i >= 0) { - dirtyRegions.removeAt(i); - dirtyStates.removeAt(i); - } - - dirtyRegions.append(decorationRegion); - dirtyStates.append(state); - if (!entireDecorationNeedsRepaint) - dirtyClip += clip; - - if (!pendingUpdateRequest) - QApplication::postEvent(managed, new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority); -} - -void QWSManagerPrivate::clearDirtyRegions() -{ - dirtyRegions.clear(); - dirtyStates.clear(); - dirtyClip = QRegion(); - entireDecorationNeedsRepaint = false; -} - -bool QWSManager::repaintRegion(int decorationRegion, QDecoration::DecorationState state) -{ - Q_D(QWSManager); - - d->dirtyRegion(decorationRegion, state); - return true; -} - -void QWSManager::menu(const QPoint &pos) -{ -#ifdef QT_NO_MENU - Q_UNUSED(pos); -#else - Q_D(QWSManager); - if (d->popup) - delete d->popup; - - // Basic window operation menu - d->popup = new QMenu(); - QApplication::qwsDecoration().buildSysMenu(d->managed, d->popup); - connect(d->popup, SIGNAL(triggered(QAction*)), SLOT(menuTriggered(QAction*))); - - d->popup->popup(pos); - d->activeRegion = QDecoration::None; -#endif // QT_NO_MENU -} - -void QWSManager::menuTriggered(QAction *action) -{ -#ifdef QT_NO_MENU - Q_UNUSED(action); -#else - Q_D(QWSManager); - QApplication::qwsDecoration().menuTriggered(d->managed, action); - d->popup->deleteLater(); - d->popup = 0; -#endif -} - -void QWSManager::startMove() -{ - Q_D(QWSManager); - d->mousePos = QCursor::pos(); - d->activeRegion = QDecoration::Title; - d->active = d->managed; - d->managed->grabMouse(); -} - -void QWSManager::startResize() -{ - Q_D(QWSManager); - d->activeRegion = QDecoration::BottomRight; - d->active = d->managed; - d->managed->grabMouse(); -} - -void QWSManager::maximize() -{ - Q_D(QWSManager); - // find out how much space the decoration needs - const int screen = QApplication::desktop()->screenNumber(d->managed); - const QRect desk = QApplication::desktop()->availableGeometry(screen); - QRect dummy(0, 0, 1, 1); - QRect nr; - QRegion r = QApplication::qwsDecoration().region(d->managed, dummy); - if (r.isEmpty()) { - nr = desk; - } else { - r += dummy; // make sure we get the full window region in case of 0 width borders - QRect rect = r.boundingRect(); - nr = QRect(desk.x()-rect.x(), desk.y()-rect.y(), - desk.width() - (rect.width()==1 ? 0 : rect.width()-1), // ==1 -> dummy - desk.height() - (rect.height()==1 ? 0 : rect.height()-1)); - } - d->managed->setGeometry(nr); -} - -bool QWSManagerPrivate::newCachedRegion(const QPoint &pos) -{ - // Check if anything has changed that would affect the region caching - if (managed->windowFlags() == cached_region.windowFlags - && managed->geometry() == cached_region.windowGeometry - && cached_region.region.contains(pos)) - return false; - - // Update the cached region - int reg = QApplication::qwsDecoration().regionAt(managed, pos); - if (QWidget::mouseGrabber()) - reg = QDecoration::None; - - previousRegionType = cached_region.regionType; - cached_region.regionType = reg; - cached_region.region = QApplication::qwsDecoration().region(managed, managed->geometry(), - reg); - // Make room for borders around the widget, even if the decoration doesn't have a frame. - if (reg && !(reg & int(QDecoration::Borders))) { - cached_region.region -= QApplication::qwsDecoration().region(managed, managed->geometry(), QDecoration::Borders); - } - cached_region.windowFlags = managed->windowFlags(); - cached_region.windowGeometry = managed->geometry(); -// QRect rec = cached_region.region.boundingRect(); -// qDebug("Updated cached region: 0x%04x (%d, %d) (%d, %d, %d, %d)", -// reg, pos.x(), pos.y(), rec.x(), rec.y(), rec.right(), rec.bottom()); - return true; -} - -QT_END_NAMESPACE - -#endif //QT_NO_QWS_MANAGER diff --git a/src/gui/embedded/qwsmanager_qws.h b/src/gui/embedded/qwsmanager_qws.h deleted file mode 100644 index be70bd8c9d8..00000000000 --- a/src/gui/embedded/qwsmanager_qws.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSMANAGER_QWS_H -#define QWSMANAGER_QWS_H - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_QWS_MANAGER - -class QAction; -class QPixmap; -class QWidget; -class QPopupMenu; -class QRegion; -class QMouseEvent; -class QWSManagerPrivate; - -class Q_GUI_EXPORT QWSManager : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWSManager) -public: - explicit QWSManager(QWidget *); - ~QWSManager(); - - static QDecoration *newDefaultDecoration(); - - QWidget *widget(); - static QWidget *grabbedMouse(); - void maximize(); - void startMove(); - void startResize(); - - QRegion region(); - QRegion &cachedRegion(); - -protected Q_SLOTS: - void menuTriggered(QAction *action); - -protected: - void handleMove(QPoint g); - - virtual bool event(QEvent *e); - virtual void mouseMoveEvent(QMouseEvent *); - virtual void mousePressEvent(QMouseEvent *); - virtual void mouseReleaseEvent(QMouseEvent *); - virtual void mouseDoubleClickEvent(QMouseEvent *); - virtual void paintEvent(QPaintEvent *); - bool repaintRegion(int region, QDecoration::DecorationState state); - - void menu(const QPoint &); - -private: - friend class QWidget; - friend class QETWidget; - friend class QWidgetPrivate; - friend class QApplication; - friend class QApplicationPrivate; - friend class QWidgetBackingStore; - friend class QWSWindowSurface; - friend class QGLDrawable; -}; - -QT_BEGIN_INCLUDE_NAMESPACE -#include -QT_END_INCLUDE_NAMESPACE - -#endif // QT_NO_QWS_MANAGER - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QWSMANAGER_QWS_H diff --git a/src/gui/embedded/qwsproperty_qws.cpp b/src/gui/embedded/qwsproperty_qws.cpp deleted file mode 100644 index 9cd869d3f9c..00000000000 --- a/src/gui/embedded/qwsproperty_qws.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwsproperty_qws.h" - -#ifndef QT_NO_QWS_PROPERTIES -#include "qwscommand_qws_p.h" -#include "qwindowsystem_qws.h" -#include "qhash.h" -#include "qalgorithms.h" -#include "qbytearray.h" - -#include - -QT_BEGIN_NAMESPACE - -class QWSPropertyManager::Data { -public: - QByteArray find(int winId, int property) - { - return properties.value(winId).value(property); - } - - typedef QHash > PropertyHash; - PropertyHash properties; -}; - -/********************************************************************* - * - * Class: QWSPropertyManager - * - *********************************************************************/ - -QWSPropertyManager::QWSPropertyManager() -{ - d = new Data; -} - -QWSPropertyManager::~QWSPropertyManager() -{ - delete d; -} - -bool QWSPropertyManager::setProperty(int winId, int property, int mode, const char *data, int len) -{ - QHash props = d->properties.value(winId); - QHash::iterator it = props.find(property); - if (it == props.end()) - return false; - - switch (mode) { - case PropReplace: - d->properties[winId][property] = QByteArray(data, len); - break; - case PropAppend: - d->properties[winId][property].append(data); - break; - case PropPrepend: - d->properties[winId][property].prepend(data); - break; - } - return true; -} - -bool QWSPropertyManager::hasProperty(int winId, int property) -{ - return d->properties.value(winId).contains(property); -} - -bool QWSPropertyManager::removeProperty(int winId, int property) -{ - QWSPropertyManager::Data::PropertyHash::iterator it = d->properties.find(winId); - if (it == d->properties.end()) - return false; - return d->properties[winId].remove( property ); -} - -bool QWSPropertyManager::addProperty(int winId, int property) -{ - if( !d->properties[winId].contains(property) ) - d->properties[winId][property] = QByteArray(); // only add if it doesn't exist - return true; -} - -bool QWSPropertyManager::getProperty(int winId, int property, const char *&data, int &len) -{ - QHash props = d->properties.value(winId); - QHash::iterator it = props.find(property); - if (it == props.end()) { - data = 0; - len = -1; - return false; - } - data = it.value().constData(); - len = it.value().length(); - - return true; -} - -bool QWSPropertyManager::removeProperties(int winId) -{ - return d->properties.remove(winId); -} - -QT_END_NAMESPACE - -#endif //QT_NO_QWS_PROPERTIES diff --git a/src/gui/embedded/qwsproperty_qws.h b/src/gui/embedded/qwsproperty_qws.h deleted file mode 100644 index 88406078ff8..00000000000 --- a/src/gui/embedded/qwsproperty_qws.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSPROPERTY_QWS_H -#define QWSPROPERTY_QWS_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -/********************************************************************* - * - * Class: QWSPropertyManager - * - *********************************************************************/ - -#ifndef QT_NO_QWS_PROPERTIES - -class QWSPropertyManager -{ -public: - enum Mode { - PropReplace = 0, - PropPrepend, - PropAppend - }; - - // pre-defined properties - enum Atom { - PropSelection = 0 - }; - - QWSPropertyManager(); - ~QWSPropertyManager(); - - bool setProperty(int winId, int property, int mode, const char *data, int len); - bool hasProperty(int winId, int property); - bool removeProperty(int winId, int property); - bool addProperty(int winId, int property); - bool getProperty(int winId, int property, const char *&data, int &len); - bool removeProperties(int winId); - -private: - class Data; - Data* d; -}; - -#endif // QT_NO_QWS_PROPERTIES - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QWSPROPERTY_QWS_H diff --git a/src/gui/embedded/qwsprotocolitem_qws.h b/src/gui/embedded/qwsprotocolitem_qws.h deleted file mode 100644 index b20c32e3d84..00000000000 --- a/src/gui/embedded/qwsprotocolitem_qws.h +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSPROTOCOLITEM_QWS_H -#define QWSPROTOCOLITEM_QWS_H - -/********************************************************************* - * - * QWSCommand base class - only use derived classes from that - * - *********************************************************************/ - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QIODevice; - -struct QWSProtocolItem -{ - // ctor - dtor - QWSProtocolItem(int t, int len, char *ptr) : type(t), - simpleLen(len), rawLen(-1), deleteRaw(false), simpleDataPtr(ptr), - rawDataPtr(0), bytesRead(0) { } - virtual ~QWSProtocolItem(); - - // data - int type; - int simpleLen; - int rawLen; - bool deleteRaw; - - // functions -#ifndef QT_NO_QWS_MULTIPROCESS - void write(QIODevice *s); - bool read(QIODevice *s); -#endif - void copyFrom(const QWSProtocolItem *item); - - virtual void setData(const char *data, int len, bool allocateMem = true); - - char *simpleDataPtr; - char *rawDataPtr; - // temp variables - int bytesRead; -}; - -// This should probably be a method on QWSProtocolItem, but this way avoids -// changing the API of this apparently public header -// size = (int)type + (int)rawLenSize + simpleLen + rawLen -#define QWS_PROTOCOL_ITEM_SIZE( item ) \ - (2 * sizeof(int)) + ((item).simpleDataPtr ? (item).simpleLen : 0) + ((item).rawDataPtr ? (item).rawLen : 0) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QWSPROTOCOLITEM_QWS_H diff --git a/src/gui/embedded/qwssharedmemory.cpp b/src/gui/embedded/qwssharedmemory.cpp deleted file mode 100644 index 66bedee111a..00000000000 --- a/src/gui/embedded/qwssharedmemory.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwssharedmemory_p.h" - -#if !defined(QT_NO_QWS_MULTIPROCESS) - -#include - -QT_BEGIN_NAMESPACE - -QWSSharedMemory::QWSSharedMemory() - : shmBase(0), shmSize(0), character(0), shmId(-1), key(-1) -{ -} - - -QWSSharedMemory::~QWSSharedMemory() -{ - detach(); -} - -/* - man page says: - On Linux, it is possible to attach a shared memory segment even if it - is already marked to be deleted. However, POSIX.1-2001 does not spec- - ify this behaviour and many other implementations do not support it. -*/ - -bool QWSSharedMemory::create(int size) -{ - if (shmId != -1) - detach(); - shmId = shmget(IPC_PRIVATE, size, IPC_CREAT|0600); - - if (shmId == -1) { -#ifdef QT_SHM_DEBUG - perror("QWSSharedMemory::create allocating shared memory"); - qWarning("Error allocating shared memory of size %d", size); -#endif - return false; - } - shmBase = shmat(shmId,0,0); - shmctl(shmId, IPC_RMID, 0); - if (shmBase == (void*)-1) { -#ifdef QT_SHM_DEBUG - perror("QWSSharedMemory::create attaching to shared memory"); - qWarning("Error attaching to shared memory id %d", shmId); -#endif - shmBase = 0; - return false; - } - return true; -} - -bool QWSSharedMemory::attach(int id) -{ - if (shmId == id) - return id != -1; - if (shmId != -1) - detach(); - - shmBase = shmat(id,0,0); - if (shmBase == (void*)-1) { -#ifdef QT_SHM_DEBUG - perror("QWSSharedMemory::attach attaching to shared memory"); - qWarning("Error attaching to shared memory 0x%x of size %d", - id, size()); -#endif - shmBase = 0; - return false; - } - shmId = id; - return true; -} - - -void QWSSharedMemory::detach () -{ - if (!shmBase) - return; - shmdt (shmBase); - shmBase = 0; - shmSize = 0; - shmId = -1; -} - -void QWSSharedMemory::setPermissions (mode_t mode) -{ - struct shmid_ds shm; - shmctl (shmId, IPC_STAT, &shm); - shm.shm_perm.mode = mode; - shmctl (shmId, IPC_SET, &shm); -} - -int QWSSharedMemory::size () const -{ - struct shmid_ds shm; - shmctl (shmId, IPC_STAT, &shm); - return shm.shm_segsz; -} - - -// old API - - - -QWSSharedMemory::QWSSharedMemory (int size, const QString &filename, char c) -{ - shmSize = size; - shmFile = filename; - shmBase = 0; - shmId = -1; - character = c; - key = ftok (shmFile.toLatin1().constData(), c); -} - - - -bool QWSSharedMemory::create () -{ - shmId = shmget (key, shmSize, IPC_CREAT | 0666); - return (shmId != -1); -} - -void QWSSharedMemory::destroy () -{ - if (shmId != -1) - shmctl(shmId, IPC_RMID, 0); -} - -bool QWSSharedMemory::attach () -{ - if (shmId == -1) - shmId = shmget (key, shmSize, 0); - - shmBase = shmat (shmId, 0, 0); - if ((long)shmBase == -1) - shmBase = 0; - - return (long)shmBase != 0; -} - - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_MULTIPROCESS diff --git a/src/gui/embedded/qwssignalhandler.cpp b/src/gui/embedded/qwssignalhandler.cpp deleted file mode 100644 index 730dbae138b..00000000000 --- a/src/gui/embedded/qwssignalhandler.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwssignalhandler_p.h" - -#ifndef QT_NO_QWS_SIGNALHANDLER - -#include -#ifndef QT_NO_QWS_MULTIPROCESS -# include -# include - -# include -#endif -#include - -QT_BEGIN_NAMESPACE - -class QWSSignalHandlerPrivate : public QWSSignalHandler -{ -public: - QWSSignalHandlerPrivate() : QWSSignalHandler() {} -}; - - -Q_GLOBAL_STATIC(QWSSignalHandlerPrivate, signalHandlerInstance); - - -QWSSignalHandler* QWSSignalHandler::instance() -{ - return signalHandlerInstance(); -} - -QWSSignalHandler::QWSSignalHandler() -{ - const int signums[] = { SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE, - SIGSEGV, SIGTERM, SIGBUS }; - const int n = sizeof(signums)/sizeof(int); - - for (int i = 0; i < n; ++i) { - const int signum = signums[i]; - qt_sighandler_t old = signal(signum, handleSignal); - if (old == SIG_IGN) // don't remove shm and semaphores when ignored - signal(signum, old); - else - oldHandlers[signum] = (old == SIG_ERR ? SIG_DFL : old); - } -} - -QWSSignalHandler::~QWSSignalHandler() -{ -#ifndef QT_NO_QWS_MULTIPROCESS - while (!semaphores.isEmpty()) - removeSemaphore(semaphores.last()); -#endif -} - -#ifndef QT_NO_QWS_MULTIPROCESS -void QWSSignalHandler::removeSemaphore(int semno) -{ - const int index = semaphores.lastIndexOf(semno); - if (index != -1) { - qt_semun semval; - semval.val = 0; - semctl(semaphores.at(index), 0, IPC_RMID, semval); - semaphores.remove(index); - } -} -#endif // QT_NO_QWS_MULTIPROCESS - -void QWSSignalHandler::handleSignal(int signum) -{ - QWSSignalHandler *h = instance(); - - signal(signum, h->oldHandlers[signum]); - -#ifndef QT_NO_QWS_MULTIPROCESS - qt_semun semval; - semval.val = 0; - for (int i = 0; i < h->semaphores.size(); ++i) - semctl(h->semaphores.at(i), 0, IPC_RMID, semval); -#endif - - h->objects.clear(); - raise(signum); -} - -QT_END_NAMESPACE - -#endif // QT_QWS_NO_SIGNALHANDLER diff --git a/src/gui/embedded/qwssocket_qws.cpp b/src/gui/embedded/qwssocket_qws.cpp deleted file mode 100644 index cec1588ebd7..00000000000 --- a/src/gui/embedded/qwssocket_qws.cpp +++ /dev/null @@ -1,280 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformdefs.h" -#include "qwssocket_qws.h" - -#ifndef QT_NO_QWS_MULTIPROCESS - -#include -#include -#include -#include -#include -#include -#include - -#ifdef __MIPSEL__ -# ifndef SOCK_DGRAM -# define SOCK_DGRAM 1 -# endif -# ifndef SOCK_STREAM -# define SOCK_STREAM 2 -# endif -#endif - -#if defined(Q_OS_SOLARIS) || defined (QT_LINUXBASE) -// uff-da apparently Solaris doesn't have the SUN_LEN macro, here is -// an implementation of it... -# ifndef SUN_LEN -# define SUN_LEN(su) \ - sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path) -# endif - -// nor the POSIX names of UNIX domain sockets *sigh* -# ifndef AF_LOCAL -# define AF_LOCAL AF_UNIX -# endif -# ifndef PF_LOCAL -# define PF_LOCAL PF_UNIX -# endif -#endif // Q_OS_SOLARIS || QT_LINUXBASE - -QT_BEGIN_NAMESPACE - -/*********************************************************************** - * - * QWSSocket - * - **********************************************************************/ -QWSSocket::QWSSocket(QObject *parent) - : QWS_SOCK_BASE(parent) -{ -#ifndef QT_NO_SXE - QObject::connect( this, SIGNAL(stateChanged(SocketState)), - this, SLOT(forwardStateChange(SocketState))); -#endif -} - -QWSSocket::~QWSSocket() -{ -} - -#ifndef QT_NO_SXE -QString QWSSocket::errorString() -{ - switch (QUnixSocket::error()) { - case NoError: - return QString(); - case InvalidPath: - case NonexistentPath: - return QLatin1String("Bad path"); // NO_TR - default: - return QLatin1String("Bad socket"); // NO TR - } -} - -void QWSSocket::forwardStateChange(QUnixSocket::SocketState st ) -{ - switch ( st ) - { - case ConnectedState: - emit connected(); - break; - case ClosingState: - break; - case UnconnectedState: - emit disconnected(); - break; - default: - // nothing - break; - } - if ( QUnixSocket::error() != NoError ) - emit error((QAbstractSocket::SocketError)0); -} -#endif - -bool QWSSocket::connectToLocalFile(const QString &file) -{ -#ifndef QT_NO_SXE - bool result = QUnixSocket::connect( file.toLocal8Bit() ); - if ( !result ) - { - perror( "QWSSocketAuth::connectToLocalFile could not connect:" ); - emit error(QAbstractSocket::ConnectionRefusedError); - return false; - } - return true; -#else - // create socket - int s = ::socket(PF_LOCAL, SOCK_STREAM, 0); - - // connect to socket - struct sockaddr_un a; - memset(&a, 0, sizeof(a)); - a.sun_family = PF_LOCAL; - strncpy(a.sun_path, file.toLocal8Bit().constData(), sizeof(a.sun_path) - 1); - int r = ::connect(s, (struct sockaddr*)&a, SUN_LEN(&a)); - if (r == 0) { - setSocketDescriptor(s); - } else { - perror("QWSSocket::connectToLocalFile could not connect:"); - ::close(s); - emit error(ConnectionRefusedError); - return false; - } -#endif - return true; -} - - -/*********************************************************************** - * - * QWSServerSocket - * - **********************************************************************/ -QWSServerSocket::QWSServerSocket(const QString& file, QObject *parent) -#ifndef QT_NO_SXE - : QUnixSocketServer(parent) -#else - : QTcpServer(parent) -#endif -{ - init(file); -} - -void QWSServerSocket::init(const QString &file) -{ -#ifndef QT_NO_SXE - QByteArray fn = file.toLocal8Bit(); - bool result = QUnixSocketServer::listen( fn ); - if ( !result ) - { - QUnixSocketServer::ServerError err = serverError(); - switch ( err ) - { - case InvalidPath: - qWarning("QWSServerSocket:: invalid path %s", qPrintable(file)); - break; - case ResourceError: - case BindError: - case ListenError: - qWarning("QWSServerSocket:: could not listen on path %s", qPrintable(file)); - break; - default: - break; - } - } -#else - int backlog = 16; //##### - -// create socket - int s = ::socket(PF_LOCAL, SOCK_STREAM, 0); - if (s == -1) { - perror("QWSServerSocket::init"); - qWarning("QWSServerSocket: unable to create socket."); - return; - } - - QByteArray fn = file.toLocal8Bit(); - unlink(fn.constData()); // doesn't have to succeed - - // bind socket - struct sockaddr_un a; - memset(&a, 0, sizeof(a)); - a.sun_family = PF_LOCAL; - strncpy(a.sun_path, fn.constData(), sizeof(a.sun_path) - 1); - int r = ::bind(s, (struct sockaddr*)&a, SUN_LEN(&a)); - if (r < 0) { - perror("QWSServerSocket::init"); - qWarning("QWSServerSocket: could not bind to file %s", fn.constData()); - ::close(s); - return; - } - - if (chmod(fn.constData(), 0600) < 0) { - perror("QWSServerSocket::init"); - qWarning("Could not set permissions of %s", fn.constData()); - ::close(s); - return; - } - - // listen - if (::listen(s, backlog) == 0) { - if (!setSocketDescriptor(s)) - qWarning( "QWSServerSocket could not set descriptor %d : %s", s, errorString().toLatin1().constData()); - } else { - perror("QWSServerSocket::init"); - qWarning("QWSServerSocket: could not listen to file %s", fn.constData()); - ::close(s); - } -#endif -} - -QWSServerSocket::~QWSServerSocket() -{ -} - -#ifndef QT_NO_SXE - -void QWSServerSocket::incomingConnection(int socketDescriptor) -{ - inboundConnections.append( socketDescriptor ); - emit newConnection(); -} - - -QWSSocket *QWSServerSocket::nextPendingConnection() -{ - QMutexLocker locker( &ssmx ); - if ( inboundConnections.count() == 0 ) - return 0; - QWSSocket *s = new QWSSocket(); - s->setSocketDescriptor( inboundConnections.takeFirst() ); - return s; -} - -#endif // QT_NO_SXE - -QT_END_NAMESPACE - -#endif //QT_NO_QWS_MULTIPROCESS diff --git a/src/gui/embedded/qwssocket_qws.h b/src/gui/embedded/qwssocket_qws.h deleted file mode 100644 index 77a59412a12..00000000000 --- a/src/gui/embedded/qwssocket_qws.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSSOCKET_QWS_H -#define QWSSOCKET_QWS_H - -#include -#include - -#ifndef QT_NO_QWS_MULTIPROCESS - -#ifndef QT_NO_SXE -#include -#include -#include -#else -#include -#include -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - - -class QWSSocket : public QWS_SOCK_BASE -{ - Q_OBJECT -public: - explicit QWSSocket(QObject *parent=0); - ~QWSSocket(); - - bool connectToLocalFile(const QString &file); - -#ifndef QT_NO_SXE - QString errorString(); -Q_SIGNALS: - void connected(); - void disconnected(); - void error(QAbstractSocket::SocketError); -private Q_SLOTS: - void forwardStateChange(SocketState); -#endif - -private: - Q_DISABLE_COPY(QWSSocket) -}; - - -class QWSServerSocket : public QWS_SOCK_SERVER_BASE -{ - Q_OBJECT -public: - QWSServerSocket(const QString& file, QObject *parent=0); - ~QWSServerSocket(); - -#ifndef QT_NO_SXE - QWSSocket *nextPendingConnection(); -Q_SIGNALS: - void newConnection(); -protected: - void incomingConnection(int socketDescriptor); -private: - QMutex ssmx; - QList inboundConnections; -#endif - -private: - Q_DISABLE_COPY(QWSServerSocket) - - void init(const QString &file); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_QWS_MULTIPROCESS - -#endif // QWSSOCKET_QWS_H diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 58e1d6c45fb..4ee9d764ecf 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -8,10 +8,6 @@ CONFIG += module MODULE_PRI = ../modules/qt_gui.pri 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:!qpa:!mac:!symbian:CONFIG += x11 unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore @@ -19,54 +15,19 @@ load(qt_module_config) HEADERS += $$QT_SOURCE_TREE/src/gui/qtguiversion.h -contains(QT_CONFIG, x11sm):CONFIG += x11sm - -#platforms -x11:include(kernel/x11.pri) -mac:include(kernel/mac.pri) -win32:include(kernel/win.pri) -embedded:include(embedded/embedded.pri) -symbian { - include(kernel/symbian.pri) - include(s60framework/s60framework.pri) -} - -#modules -include(animation/animation.pri) include(kernel/kernel.pri) include(image/image.pri) -include(painting/painting.pri) include(text/text.pri) -include(styles/styles.pri) -include(widgets/widgets.pri) -include(dialogs/dialogs.pri) -include(accessible/accessible.pri) -include(itemviews/itemviews.pri) -include(inputmethod/inputmethod.pri) -include(graphicsview/graphicsview.pri) +include(painting/painting.pri) include(util/util.pri) -include(statemachine/statemachine.pri) include(math3d/math3d.pri) -include(effects/effects.pri) +include(opengl/opengl.pri) include(egl/egl.pri) -win32:!wince*: DEFINES += QT_NO_EGL -embedded: QT += network QMAKE_LIBS += $$QMAKE_LIBS_GUI -contains(DEFINES,QT_EVAL):include($$QT_SOURCE_TREE/src/corelib/eval.pri) - -QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist - DEFINES += Q_INTERNAL_QAPP_SRC -symbian { - TARGET.UID3=0x2001B2DD - - # ro-section in gui can exceed default allocated space, so move rw-section a little further - QMAKE_LFLAGS.ARMCC += --rw-base 0x800000 - QMAKE_LFLAGS.GCCE += -Tdata 0x800000 -} neon:*-g++* { DEFINES += QT_HAVE_NEON diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 72738c9fa8c..3ccfb04fcc1 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -5,11 +5,6 @@ HEADERS += \ image/qbitmap.h \ - image/qicon.h \ - image/qicon_p.h \ - image/qiconloader_p.h \ - image/qiconengine.h \ - image/qiconengineplugin.h \ image/qimage.h \ image/qimage_p.h \ image/qimageiohandler.h \ @@ -26,18 +21,13 @@ HEADERS += \ image/qpixmap_blitter_p.h \ image/qpixmapcache.h \ image/qpixmapcache_p.h \ - image/qpixmapdata_p.h \ - image/qpixmapdatafactory_p.h \ - image/qpixmapfilter_p.h \ + image/qplatformpixmap_qpa.h \ image/qimagepixmapcleanuphooks_p.h \ image/qvolatileimage_p.h \ - image/qvolatileimagedata_p.h \ - image/qnativeimagehandleprovider_p.h + image/qvolatileimagedata_p.h SOURCES += \ image/qbitmap.cpp \ - image/qicon.cpp \ - image/qiconloader.cpp \ image/qimage.cpp \ image/qimageiohandler.cpp \ image/qimagereader.cpp \ @@ -47,11 +37,7 @@ SOURCES += \ image/qpictureformatplugin.cpp \ image/qpixmap.cpp \ image/qpixmapcache.cpp \ - image/qpixmapdata.cpp \ - image/qpixmapdatafactory.cpp \ - image/qpixmapfilter.cpp \ - image/qiconengine.cpp \ - image/qiconengineplugin.cpp \ + image/qplatformpixmap.cpp \ image/qmovie.cpp \ image/qpixmap_raster.cpp \ image/qpixmap_blitter.cpp \ @@ -59,15 +45,12 @@ SOURCES += \ image/qimagepixmapcleanuphooks.cpp \ image/qvolatileimage.cpp -win32 { - SOURCES += image/qpixmap_win.cpp -} -else:embedded { - SOURCES += image/qpixmap_qws.cpp -} -else:qpa { +qpa: { SOURCES += image/qpixmap_qpa.cpp } +else:win32 { + SOURCES += image/qpixmap_win.cpp +} else:x11 { HEADERS += image/qpixmap_x11_p.h SOURCES += image/qpixmap_x11.cpp diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index c0cab83926e..f32c517f172 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -40,12 +40,12 @@ ****************************************************************************/ #include "qbitmap.h" -#include "qpixmapdata_p.h" +#include "qplatformpixmap_qpa.h" #include "qimage.h" +#include "qscreen.h" #include "qvariant.h" #include -#include -#include +#include QT_BEGIN_NAMESPACE @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE \sa QPixmap::isNull() */ QBitmap::QBitmap() - : QPixmap(QSize(0, 0), QPixmapData::BitmapType) + : QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType) { } @@ -116,7 +116,7 @@ QBitmap::QBitmap() */ QBitmap::QBitmap(int w, int h) - : QPixmap(QSize(w, h), QPixmapData::BitmapType) + : QPixmap(QSize(w, h), QPlatformPixmap::BitmapType) { } @@ -128,7 +128,7 @@ QBitmap::QBitmap(int w, int h) */ QBitmap::QBitmap(const QSize &size) - : QPixmap(size, QPixmapData::BitmapType) + : QPixmap(size, QPlatformPixmap::BitmapType) { } @@ -173,7 +173,7 @@ QBitmap::QBitmap(const QPixmap &pixmap) */ QBitmap::QBitmap(const QString& fileName, const char *format) - : QPixmap(QSize(0, 0), QPixmapData::BitmapType) + : QPixmap(QSize(0, 0), QPlatformPixmap::BitmapType) { load(fileName, format, Qt::MonoOnly); } @@ -205,20 +205,6 @@ QBitmap &QBitmap::operator=(const QPixmap &pixmap) return *this; } - -#ifdef QT3_SUPPORT -QBitmap::QBitmap(int w, int h, const uchar *bits, bool isXbitmap) -{ - *this = fromData(QSize(w, h), bits, isXbitmap ? QImage::Format_MonoLSB : QImage::Format_Mono); -} - - -QBitmap::QBitmap(const QSize &size, const uchar *bits, bool isXbitmap) -{ - *this = fromData(size, bits, isXbitmap ? QImage::Format_MonoLSB : QImage::Format_Mono); -} -#endif - /*! Destroys the bitmap. */ @@ -275,9 +261,7 @@ QBitmap QBitmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) img.setColor(1, c0); } - QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); - QScopedPointer data(gs ? gs->createPixmapData(QPixmapData::BitmapType) - : QGraphicsSystem::createDefaultPixmapData(QPixmapData::BitmapType)); + QScopedPointer data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::BitmapType)); data->fromImage(img, flags | Qt::MonoOnly); return QPixmap(data.take()); @@ -335,77 +319,4 @@ QBitmap QBitmap::transformed(const QMatrix &matrix) const return transformed(QTransform(matrix)); } -#ifdef QT3_SUPPORT -/*! - \fn QBitmap QBitmap::xForm(const QMatrix &matrix) const - - Returns a copy of this bitmap, transformed according to the given - \a matrix. - - Use transformed() instead. -*/ - -/*! - \fn QBitmap::QBitmap(const QSize &size, bool clear) - - Constructs a bitmap with the given \a size. If \a clear is true, - the bits are initialized to Qt::color0. - - Use the corresponding QBitmap() constructor instead, and then call - the clear() function if the \a clear parameter is true. -*/ - -/*! - \fn QBitmap::QBitmap(int width, int height, bool clear) - - Constructs a bitmap with the given \a width and \a height. If \a - clear is true, the bits are initialized to Qt::color0. - - Use the corresponding QBitmap() constructor instead, and then call - the clear() function if the \a clear parameter is true. -*/ - -/*! - \fn QBitmap::QBitmap(int width, int height, const uchar *bits, bool isXbitmap) - - Constructs a bitmap with the given \a width and \a height, and - sets the contents to the \a bits supplied. The \a isXbitmap flag - should be true if \a bits was generated by the X11 bitmap - program. - - Use the static fromData() function instead. If \a isXbitmap is - true, use the default bit order(QImage_FormatMonoLSB) otherwise - use QImage::Format_Mono. - - \omit - The X bitmap bit order is little endian. The QImage - documentation discusses bit order of monochrome images. Opposed to - QImage, the data has to be byte aligned. - - Example (creates an arrow bitmap): - \snippet doc/src/snippets/code/src_gui_image_qbitmap.cpp 0 - \endomit -*/ - - -/*! - \fn QBitmap::QBitmap(const QSize &size, const uchar *bits, bool isXbitmap) - - \overload - - Constructs a bitmap with the given \a size, and sets the contents - to the \a bits supplied. The \a isXbitmap flag should be true if - \a bits was generated by the X11 bitmap program. - - \omit - The X bitmap bit order is little endian. The QImage documentation - discusses bit order of monochrome images. - \endomit - - Use the static fromData() function instead. If \a isXbitmap is - true, use the default bit order(QImage_FormatMonoLSB) otherwise - use QImage::Format_Mono. -*/ -#endif - QT_END_NAMESPACE diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h index b37eed212dd..a3104f5083d 100644 --- a/src/gui/image/qbitmap.h +++ b/src/gui/image/qbitmap.h @@ -74,34 +74,11 @@ public: QBitmap transformed(const QMatrix &) const; QBitmap transformed(const QTransform &matrix) const; -#ifdef QT3_SUPPORT - inline QT3_SUPPORT_CONSTRUCTOR QBitmap(int w, int h, bool clear); - inline QT3_SUPPORT_CONSTRUCTOR QBitmap(const QSize &, bool clear); - QT3_SUPPORT_CONSTRUCTOR QBitmap(int w, int h, const uchar *bits, bool isXbitmap=false); - QT3_SUPPORT_CONSTRUCTOR QBitmap(const QSize &, const uchar *bits, bool isXbitmap=false); - inline QT3_SUPPORT QBitmap xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } - QT3_SUPPORT_CONSTRUCTOR QBitmap(const QImage &image) { *this = fromImage(image); } - QT3_SUPPORT QBitmap &operator=(const QImage &image) { *this = fromImage(image); return *this; } -#endif - typedef QExplicitlySharedDataPointer DataPtr; + typedef QExplicitlySharedDataPointer DataPtr; }; Q_DECLARE_SHARED(QBitmap) -#ifdef QT3_SUPPORT -inline QBitmap::QBitmap(int w, int h, bool clear) - : QPixmap(QSize(w, h), 1) -{ - if (clear) this->clear(); -} - -inline QBitmap::QBitmap(const QSize &size, bool clear) - : QPixmap(size, 1) -{ - if (clear) this->clear(); -} -#endif - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 8840a83ff0f..d854b1765bb 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -692,11 +692,16 @@ bool qt_read_dib(QDataStream &s, QImage &image) return read_dib_body(s, bi, -1, -BMP_FILEHDR_SIZE, image); } -QBmpHandler::QBmpHandler() - : state(Ready) +QBmpHandler::QBmpHandler(InternalFormat fmt) : + m_format(fmt), state(Ready) { } +QByteArray QBmpHandler::formatName() const +{ + return m_format == BmpFormat ? "bmp" : "dib"; +} + bool QBmpHandler::readHeader() { state = Error; @@ -709,7 +714,7 @@ bool QBmpHandler::readHeader() s.setByteOrder(QDataStream::LittleEndian); // read BMP file header - if (!read_dib_fileheader(s, fileHeader)) + if (m_format == BmpFormat && !read_dib_fileheader(s, fileHeader)) return false; // read BMP info header @@ -722,11 +727,11 @@ bool QBmpHandler::readHeader() bool QBmpHandler::canRead() const { - if (state == Ready && !canRead(device())) + if (m_format == BmpFormat && state == Ready && !canRead(device())) return false; if (state != Error) { - setFormat("bmp"); + setFormat(formatName()); return true; } @@ -778,6 +783,12 @@ bool QBmpHandler::read(QImage *image) bool QBmpHandler::write(const QImage &img) { + if (m_format == DibFormat) { + QDataStream dibStream(device()); + dibStream.setByteOrder(QDataStream::LittleEndian); // Intel byte order + return qt_write_dib(dibStream, img); + } + QImage image; switch (img.format()) { case QImage::Format_ARGB8565_Premultiplied: @@ -875,7 +886,7 @@ void QBmpHandler::setOption(ImageOption option, const QVariant &value) QByteArray QBmpHandler::name() const { - return "bmp"; + return formatName(); } QT_END_NAMESPACE diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h index 070d904b771..373f8fbaaf1 100644 --- a/src/gui/image/qbmphandler_p.h +++ b/src/gui/image/qbmphandler_p.h @@ -81,10 +81,20 @@ struct BMP_INFOHDR { // BMP information header qint32 biClrImportant; // number of important colors }; +// BMP-Handler, which is also able to read and write the DIB +// (Device-Independent-Bitmap) format used internally in the Windows operating +// system for OLE/clipboard operations. DIB is a subset of BMP (without file +// header). The Windows-Lighthouse plugin accesses the DIB-functionality. + class QBmpHandler : public QImageIOHandler { public: - QBmpHandler(); + enum InternalFormat { + DibFormat, + BmpFormat + }; + + explicit QBmpHandler(InternalFormat fmt = BmpFormat); bool canRead() const; bool read(QImage *image); bool write(const QImage &image); @@ -99,11 +109,16 @@ public: private: bool readHeader(); + inline QByteArray formatName() const; + enum State { Ready, ReadHeader, Error }; + + const InternalFormat m_format; + State state; BMP_FILEHDR fileHeader; BMP_INFOHDR infoHeader; diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 14322dc9291..2dbb2f4b522 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -54,9 +54,9 @@ #include #include #include +#include #include #include -#include #include #include @@ -124,9 +124,6 @@ QBasicAtomicInt qimage_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); QImageData::QImageData() : ref(0), width(0), height(0), depth(0), nbytes(0), data(0), -#ifdef QT3_SUPPORT - jumptable(0), -#endif format(QImage::Format_ARGB32), bytes_per_line(0), ser_no(qimage_serial_number.fetchAndAddRelaxed(1)), detach_no(0), @@ -220,11 +217,6 @@ QImageData::~QImageData() delete paintEngine; if (data && own_data) free(data); -#ifdef QT3_SUPPORT - if (jumptable) - free(jumptable); - jumptable = 0; -#endif data = 0; } @@ -757,27 +749,6 @@ const uchar *qt_get_bitflip_array() // called from QPixma return bitflip; } -#if defined(QT3_SUPPORT) -static QImage::Format formatFor(int depth, QImage::Endian bitOrder) -{ - QImage::Format format; - if (depth == 1) { - format = bitOrder == QImage::BigEndian ? QImage::Format_Mono : QImage::Format_MonoLSB; - } else if (depth == 8) { - format = QImage::Format_Indexed8; - } else if (depth == 32) { - format = QImage::Format_RGB32; - } else if (depth == 24) { - format = QImage::Format_RGB888; - } else if (depth == 16) { - format = QImage::Format_RGB16; - } else { - qWarning("QImage: Depth %d not supported", depth); - format = QImage::Format_Invalid; - } - return format; -} -#endif /*! Constructs a null image. @@ -991,42 +962,6 @@ QImage::QImage(const QString &fileName, const char *format) load(fileName, format); } -/*! - Constructs an image and tries to load the image from the file with - the given \a fileName. - - The loader attempts to read the image using the specified \a - format. If the \a format is not specified (which is the default), - the loader probes the file for a header to guess the file format. - - If the loading of the image failed, this object is a null image. - - The file name can either refer to an actual file on disk or to one - of the application's embedded resources. See the - \l{resources.html}{Resource System} overview for details on how to - embed images and other resource files in the application's - executable. - - You can disable this constructor by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. This can - be useful, for example, if you want to ensure that all - user-visible strings go through QObject::tr(). - - \sa QString::fromAscii(), isNull(), {QImage#Reading and Writing - Image Files}{Reading and Writing Image Files} -*/ -#ifndef QT_NO_CAST_FROM_ASCII -QImage::QImage(const char *fileName, const char *format) - : QPaintDevice() -{ - // ### Qt 5: if you remove the QImage(const QByteArray &) QT3_SUPPORT - // constructor, remove this constructor as well. The constructor here - // exists so that QImage("foo.png") compiles without ambiguity. - d = 0; - load(QString::fromAscii(fileName), format); -} -#endif - #ifndef QT_NO_IMAGEFORMAT_XPM extern bool qt_read_xpm_image_or_array(QIODevice *device, const char * const *source, QImage &image); @@ -1097,178 +1032,6 @@ QImage::QImage(const QImage &image) } } -#ifdef QT3_SUPPORT -/*! - \fn QImage::QImage(int width, int height, int depth, int numColors, Endian bitOrder) - - Constructs an image with the given \a width, \a height, \a depth, - \a numColors colors and \a bitOrder. - - Use the constructor that accepts a width, a height and a format - (i.e. specifying the depth and bit order), in combination with the - setColorCount() function, instead. - - \oldcode - QImage image(width, height, depth, numColors); - \newcode - QImage image(width, height, format); - - // For 8 bit images the default number of colors is 256. If - // another number of colors is required it can be specified - // using the setColorCount() function. - image.setColorCount(numColors); - \endcode -*/ - -QImage::QImage(int w, int h, int depth, int colorCount, Endian bitOrder) - : QPaintDevice() -{ - d = QImageData::create(QSize(w, h), formatFor(depth, bitOrder), colorCount); -} - -/*! - Constructs an image with the given \a size, \a depth, \a numColors - and \a bitOrder. - - Use the constructor that accepts a size and a format - (i.e. specifying the depth and bit order), in combination with the - setColorCount() function, instead. - - \oldcode - QSize mySize(width, height); - QImage image(mySize, depth, numColors); - \newcode - QSize mySize(width, height); - QImage image(mySize, format); - - // For 8 bit images the default number of colors is 256. If - // another number of colors is required it can be specified - // using the setColorCount() function. - image.setColorCount(numColors); - \endcode -*/ -QImage::QImage(const QSize& size, int depth, int numColors, Endian bitOrder) - : QPaintDevice() -{ - d = QImageData::create(size, formatFor(depth, bitOrder), numColors); -} - -/*! - \fn QImage::QImage(uchar* data, int width, int height, int depth, const QRgb* colortable, int numColors, Endian bitOrder) - - Constructs an image with the given \a width, \a height, depth, \a - colortable, \a numColors and \a bitOrder, that uses an existing - memory buffer, \a data. - - Use the constructor that accepts a uchar pointer, a width, a - height and a format (i.e. specifying the depth and bit order), in - combination with the setColorTable() function, instead. - - \oldcode - uchar *myData; - QRgb *myColorTable; - - QImage image(myData, width, height, depth, - myColorTable, numColors, IgnoreEndian); - \newcode - uchar *myData; - QVector myColorTable; - - QImage image(myData, width, height, format); - image.setColorTable(myColorTable); - \endcode -*/ -QImage::QImage(uchar* data, int w, int h, int depth, const QRgb* colortable, int numColors, Endian bitOrder) - : QPaintDevice() -{ - d = 0; - Format f = formatFor(depth, bitOrder); - if (f == Format_Invalid) - return; - - const int bytes_per_line = ((w*depth+31)/32)*4; // bytes per scanline - if (w <= 0 || h <= 0 || numColors < 0 || !data - || INT_MAX/sizeof(uchar *) < uint(h) - || INT_MAX/uint(depth) < uint(w) - || bytes_per_line <= 0 - || INT_MAX/uint(bytes_per_line) < uint(h)) - return; // invalid parameter(s) - d = new QImageData; - d->ref.ref(); - - d->own_data = false; - d->data = data; - d->width = w; - d->height = h; - d->depth = depth; - d->format = f; - if (depth == 32) - numColors = 0; - - d->bytes_per_line = bytes_per_line; - d->nbytes = d->bytes_per_line * h; - if (colortable) { - d->colortable.resize(numColors); - for (int i = 0; i < numColors; ++i) - d->colortable[i] = colortable[i]; - } else if (numColors) { - setColorCount(numColors); - } -} - -#ifdef Q_WS_QWS - -/*! - \fn QImage::QImage(uchar* data, int width, int height, int depth, int bytesPerLine, const QRgb* colortable, int numColors, Endian bitOrder) - - Constructs an image with the given \a width, \a height, \a depth, - \a bytesPerLine, \a colortable, \a numColors and \a bitOrder, that - uses an existing memory buffer, \a data. The image does not delete - the buffer at destruction. - - \warning This constructor is only available in Qt for Embedded Linux. - - The data has to be 32-bit aligned, and each scanline of data in the image - must also be 32-bit aligned, so it's no longer possible to specify a custom - \a bytesPerLine value. -*/ -QImage::QImage(uchar* data, int w, int h, int depth, int bpl, const QRgb* colortable, int numColors, Endian bitOrder) - : QPaintDevice() -{ - d = 0; - Format f = formatFor(depth, bitOrder); - if (f == Format_Invalid) - return; - if (!data || w <= 0 || h <= 0 || depth <= 0 || numColors < 0 - || INT_MAX/sizeof(uchar *) < uint(h) - || INT_MAX/uint(depth) < uint(w) - || bpl <= 0 - || INT_MAX/uint(bpl) < uint(h)) - return; // invalid parameter(s) - - d = new QImageData; - d->ref.ref(); - d->own_data = false; - d->data = data; - d->width = w; - d->height = h; - d->depth = depth; - d->format = f; - if (depth == 32) - numColors = 0; - d->bytes_per_line = bpl; - d->nbytes = d->bytes_per_line * h; - if (colortable) { - d->colortable.resize(numColors); - for (int i = 0; i < numColors; ++i) - d->colortable[i] = colortable[i]; - } else if (numColors) { - setColorCount(numColors); - } -} -#endif // Q_WS_QWS -#endif // QT3_SUPPORT - /*! Destroys the image and cleans up. */ @@ -1591,10 +1354,6 @@ int QImage::depth() const \sa setColorCount() */ -int QImage::numColors() const -{ - return d ? d->colortable.size() : 0; -} /*! \since 4.6 @@ -1613,75 +1372,6 @@ int QImage::colorCount() const return d ? d->colortable.size() : 0; } - -#ifdef QT3_SUPPORT -/*! - \fn QImage::Endian QImage::bitOrder() const - - Returns the bit order for the image. If it is a 1-bpp image, this - function returns either QImage::BigEndian or - QImage::LittleEndian. Otherwise, this function returns - QImage::IgnoreEndian. - - Use the format() function instead for the monochrome formats. For - non-monochrome formats the bit order is irrelevant. -*/ - -/*! - Returns a pointer to the scanline pointer table. This is the - beginning of the data block for the image. - Returns 0 in case of an error. - - Use the bits() or scanLine() function instead. -*/ -uchar **QImage::jumpTable() -{ - if (!d) - return 0; - detach(); - - // in case detach() ran out of memory.. - if (!d) - return 0; - - if (!d->jumptable) { - d->jumptable = (uchar **)malloc(d->height*sizeof(uchar *)); - if (!d->jumptable) - return 0; - uchar *data = d->data; - int height = d->height; - uchar **p = d->jumptable; - while (height--) { - *p++ = data; - data += d->bytes_per_line; - } - } - return d->jumptable; -} - -/*! - \overload -*/ -const uchar * const *QImage::jumpTable() const -{ - if (!d) - return 0; - if (!d->jumptable) { - d->jumptable = (uchar **)malloc(d->height*sizeof(uchar *)); - if (!d->jumptable) - return 0; - uchar *data = d->data; - int height = d->height; - uchar **p = d->jumptable; - while (height--) { - *p++ = data; - data += d->bytes_per_line; - } - } - return d->jumptable; -} -#endif - /*! Sets the color table used to translate color indexes to QRgb values, to the specified \a colors. @@ -1731,10 +1421,6 @@ QVector QImage::colorTable() const \sa byteCount() */ -int QImage::numBytes() const -{ - return d ? d->nbytes : 0; -} /*! \since 4.6 @@ -2168,10 +1854,6 @@ void QImage::invertPixels(InvertMode mode) \sa setColorCount() */ -void QImage::setNumColors(int numColors) -{ - setColorCount(numColors); -} /*! \since 4.6 @@ -2224,116 +1906,6 @@ QImage::Format QImage::format() const } -#ifdef QT3_SUPPORT -/*! - Returns true if alpha buffer mode is enabled; otherwise returns - false. - - Use the hasAlphaChannel() function instead. - -*/ -bool QImage::hasAlphaBuffer() const -{ - if (!d) - return false; - - switch (d->format) { - case Format_ARGB32: - case Format_ARGB32_Premultiplied: - case Format_ARGB8565_Premultiplied: - case Format_ARGB8555_Premultiplied: - case Format_ARGB6666_Premultiplied: - case Format_ARGB4444_Premultiplied: - return true; - default: - return false; - } -} - -/*! - Enables alpha buffer mode if \a enable is true, otherwise disables - it. The alpha buffer is used to set a mask when a QImage is - translated to a QPixmap. - - If a monochrome or indexed 8-bit image has alpha channels in their - color tables they will automatically detect that they have an - alpha channel, so this function is not required. To force alpha - channels on 32-bit images, use the convertToFormat() function. -*/ - -void QImage::setAlphaBuffer(bool enable) -{ - if (!d - || d->format == Format_Mono - || d->format == Format_MonoLSB - || d->format == Format_Indexed8) - return; - if (enable && (d->format == Format_ARGB32 || - d->format == Format_ARGB32_Premultiplied || - d->format == Format_ARGB8565_Premultiplied || - d->format == Format_ARGB6666_Premultiplied || - d->format == Format_ARGB8555_Premultiplied || - d->format == Format_ARGB4444_Premultiplied)) - { - return; - } - if (!enable && (d->format == Format_RGB32 || - d->format == Format_RGB555 || - d->format == Format_RGB666 || - d->format == Format_RGB888 || - d->format == Format_RGB444)) - { - return; - } - detach(); - d->format = (enable ? Format_ARGB32 : Format_RGB32); -} - - -/*! - \fn bool QImage::create(int width, int height, int depth, int numColors, Endian bitOrder) - - Sets the image \a width, \a height, \a depth, its number of colors - (in \a numColors), and bit order. Returns true if successful, or - false if the parameters are incorrect or if memory cannot be - allocated. - - The \a width and \a height is limited to 32767. \a depth must be - 1, 8, or 32. If \a depth is 1, \a bitOrder must be set to - either QImage::LittleEndian or QImage::BigEndian. For other depths - \a bitOrder must be QImage::IgnoreEndian. - - This function allocates a color table and a buffer for the image - data. The image data is not initialized. The image buffer is - allocated as a single block that consists of a table of scanLine() - pointers (jumpTable()) and the image data (bits()). - - Use a QImage constructor instead. -*/ -bool QImage::create(int width, int height, int depth, int numColors, Endian bitOrder) -{ - if (d && !d->ref.deref()) - delete d; - d = QImageData::create(QSize(width, height), formatFor(depth, bitOrder), numColors); - return true; -} - -/*! - \fn bool QImage::create(const QSize& size, int depth, int numColors, Endian bitOrder) - \overload - - The width and height are specified in the \a size argument. - - Use a QImage constructor instead. -*/ -bool QImage::create(const QSize& size, int depth, int numColors, QImage::Endian bitOrder) -{ - if (d && !d->ref.deref()) - delete d; - d = QImageData::create(size, formatFor(depth, bitOrder), numColors); - return true; -} -#endif // QT3_SUPPORT /***************************************************************************** Internal routines for converting image depth. @@ -4023,30 +3595,6 @@ QImage QImage::convertToFormat(Format format, const QVector &colorTable, Q return image; } -#ifdef QT3_SUPPORT -/*! - Converts the depth (bpp) of the image to the given \a depth and - returns the converted image. The original image is not changed. - Returns this image if \a depth is equal to the image depth, or a - null image if this image cannot be converted. The \a depth - argument must be 1, 8 or 32. If the image needs to be modified to - fit in a lower-resolution result (e.g. converting from 32-bit to - 8-bit), use the \a flags to specify how you'd prefer this to - happen. - - Use the convertToFormat() function instead. -*/ - -QImage QImage::convertDepth(int depth, Qt::ImageConversionFlags flags) const -{ - if (!d || d->depth == depth) - return *this; - - Format format = formatFor (depth, QImage::LittleEndian); - return convertToFormat(format, flags); -} -#endif - /*! \fn bool QImage::valid(const QPoint &pos) const @@ -4265,41 +3813,6 @@ void QImage::setPixel(int x, int y, uint index_or_rgb) } } -#ifdef QT3_SUPPORT -/*! - Converts the bit order of the image to the given \a bitOrder and - returns the converted image. The original image is not changed. - Returns this image if the given \a bitOrder is equal to the image - current bit order, or a null image if this image cannot be - converted. - - Use convertToFormat() instead. -*/ - -QImage QImage::convertBitOrder(Endian bitOrder) const -{ - if (!d || isNull() || d->depth != 1 || !(bitOrder == BigEndian || bitOrder == LittleEndian)) - return QImage(); - - if ((d->format == Format_Mono && bitOrder == BigEndian) - || (d->format == Format_MonoLSB && bitOrder == LittleEndian)) - return *this; - - QImage image(d->width, d->height, d->format == Format_Mono ? Format_MonoLSB : Format_Mono); - - const uchar *data = d->data; - const uchar *end = data + d->nbytes; - uchar *ndata = image.d->data; - while (data < end) - *ndata++ = bitflip[*data++]; - - image.setDotsPerMeterX(dotsPerMeterX()); - image.setDotsPerMeterY(dotsPerMeterY()); - - image.d->colortable = d->colortable; - return image; -} -#endif /*! Returns true if all the colors in the image are shades of gray (i.e. their red, green and blue components are equal); otherwise @@ -5286,66 +4799,6 @@ QDataStream &operator>>(QDataStream &s, QImage &image) #endif // QT_NO_DATASTREAM -#ifdef QT3_SUPPORT -/*! - \fn QImage QImage::convertDepthWithPalette(int depth, QRgb* palette, int palette_count, Qt::ImageConversionFlags flags) const - - Returns an image with the given \a depth, using the \a - palette_count colors pointed to by \a palette. If \a depth is 1 or - 8, the returned image will have its color table ordered in the - same way as \a palette. - - If the image needs to be modified to fit in a lower-resolution - result (e.g. converting from 32-bit to 8-bit), use the \a flags to - specify how you'd prefer this to happen. - - Note: currently no closest-color search is made. If colors are - found that are not in the palette, the palette may not be used at - all. This result should not be considered valid because it may - change in future implementations. - - Currently inefficient for non-32-bit images. - - Use the convertToFormat() function in combination with the - setColorTable() function instead. -*/ -QImage QImage::convertDepthWithPalette(int d, QRgb* palette, int palette_count, Qt::ImageConversionFlags flags) const -{ - Format f = formatFor(d, QImage::LittleEndian); - QVector colortable; - for (int i = 0; i < palette_count; ++i) - colortable.append(palette[i]); - return convertToFormat(f, colortable, flags); -} - -/*! - \relates QImage - - Copies a block of pixels from \a src to \a dst. The pixels - copied from source (src) are converted according to - \a flags if it is incompatible with the destination - (\a dst). - - \a sx, \a sy is the top-left pixel in \a src, \a dx, \a dy is the - top-left position in \a dst and \a sw, \a sh is the size of the - copied block. The copying is clipped if areas outside \a src or \a - dst are specified. If \a sw is -1, it is adjusted to - src->width(). Similarly, if \a sh is -1, it is adjusted to - src->height(). - - Currently inefficient for non 32-bit images. - - Use copy() or QPainter::drawImage() instead. -*/ -void bitBlt(QImage *dst, int dx, int dy, const QImage *src, int sx, int sy, int sw, int sh, - Qt::ImageConversionFlags flags) -{ - if (dst->isNull() || src->isNull()) - return; - QPainter p(dst); - p.drawImage(QPoint(dx, dy), *src, QRect(sx, sy, sw, sh), flags); -} -#endif /*! \fn bool QImage::operator==(const QImage & image) const @@ -5619,15 +5072,6 @@ void QImage::setText(const QString &key, const QString &value) The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation. */ -QString QImage::text(const char* key, const char* lang) const -{ - if (!d) - return QString(); - QString k = QString::fromAscii(key); - if (lang && *lang) - k += QLatin1Char('/') + QString::fromAscii(lang); - return d->text.value(k); -} /*! \fn QString QImage::text(const QImageTextKeyLang& keywordAndLanguage) const @@ -5641,15 +5085,6 @@ QString QImage::text(const char* key, const char* lang) const The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation. */ -QString QImage::text(const QImageTextKeyLang& kl) const -{ - if (!d) - return QString(); - QString k = QString::fromAscii(kl.key); - if (!kl.lang.isEmpty()) - k += QLatin1Char('/') + QString::fromAscii(kl.lang); - return d->text.value(k); -} /*! \obsolete @@ -5661,20 +5096,6 @@ QString QImage::text(const QImageTextKeyLang& kl) const The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation. */ -QStringList QImage::textLanguages() const -{ - if (!d) - return QStringList(); - QStringList keys = textKeys(); - QStringList languages; - for (int i = 0; i < keys.size(); ++i) { - int index = keys.at(i).indexOf(QLatin1Char('/')); - if (index > 0) - languages += keys.at(i).mid(index+1); - } - - return languages; -} /*! \obsolete @@ -5687,24 +5108,6 @@ QStringList QImage::textLanguages() const The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation. */ -QList QImage::textList() const -{ - QList imageTextKeys; - if (!d) - return imageTextKeys; - QStringList keys = textKeys(); - for (int i = 0; i < keys.size(); ++i) { - int index = keys.at(i).indexOf(QLatin1Char('/')); - if (index > 0) { - QImageTextKeyLang tkl; - tkl.key = keys.at(i).left(index).toAscii(); - tkl.lang = keys.at(i).mid(index+1).toAscii(); - imageTextKeys += tkl; - } - } - - return imageTextKeys; -} /*! \fn void QImage::setText(const char* key, const char* language, const QString& text) @@ -5729,21 +5132,6 @@ QList QImage::textList() const \l{http://www.rfc-editor.org/rfc/rfc1766.txt}{RFC 1766}) or 0. \endomit */ -void QImage::setText(const char* key, const char* lang, const QString& s) -{ - if (!d) - return; - detach(); - - // In case detach() ran out of memory - if (!d) - return; - - QString k = QString::fromAscii(key); - if (lang && *lang) - k += QLatin1Char('/') + QString::fromAscii(lang); - d->text.insert(k, s); -} #endif // QT_NO_IMAGE_TEXT @@ -6325,24 +5713,6 @@ int QImage::bitPlaneCount() const return bpc; } - -#ifdef QT3_SUPPORT -#if defined(Q_WS_X11) -QT_BEGIN_INCLUDE_NAMESPACE -#include -QT_END_INCLUDE_NAMESPACE -#endif - -QImage::Endian QImage::systemBitOrder() -{ -#if defined(Q_WS_X11) - return BitmapBitOrder(X11->display) == MSBFirst ? BigEndian : LittleEndian; -#else - return BigEndian; -#endif -} -#endif - /*! \fn QImage QImage::copy(const QRect &rect, Qt::ImageConversionFlags flags) const \compat diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 57d71697898..7e8a0a28e80 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -66,8 +66,8 @@ template class QVector; struct QImageData; class QImageDataMisc; // internal #ifndef QT_NO_IMAGE_TEXT -#ifdef QT_DEPRECATED -class Q_GUI_EXPORT QT_DEPRECATED QImageTextKeyLang { +#if QT_DEPRECATED_SINCE(5, 0) +class Q_GUI_EXPORT QImageTextKeyLang { public: QImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { } QImageTextKeyLang() { } @@ -134,9 +134,6 @@ public: explicit QImage(const char * const xpm[]); #endif explicit QImage(const QString &fileName, const char *format = 0); -#ifndef QT_NO_CAST_FROM_ASCII - explicit QImage(const char *fileName, const char *format = 0); -#endif QImage(const QImage &); ~QImage(); @@ -173,17 +170,11 @@ public: QRect rect() const; int depth() const; -#ifdef QT_DEPRECATED - QT_DEPRECATED int numColors() const; -#endif int colorCount() const; int bitPlaneCount() const; QRgb color(int i) const; void setColor(int i, QRgb c); -#ifdef QT_DEPRECATED - QT_DEPRECATED void setNumColors(int); -#endif void setColorCount(int); bool allGray() const; @@ -192,9 +183,7 @@ public: uchar *bits(); const uchar *bits() const; const uchar *constBits() const; -#ifdef QT_DEPRECATED - QT_DEPRECATED int numBytes() const; -#endif + int byteCount() const; uchar *scanLine(int); @@ -277,57 +266,19 @@ public: QString text(const QString &key = QString()) const; void setText(const QString &key, const QString &value); -#ifdef QT_DEPRECATED - QT_DEPRECATED QString text(const char* key, const char* lang=0) const; - QT_DEPRECATED QList textList() const; - QT_DEPRECATED QStringList textLanguages() const; - QT_DEPRECATED QString text(const QImageTextKeyLang&) const; - QT_DEPRECATED void setText(const char* key, const char* lang, const QString&); +#if QT_DEPRECATED_SINCE(5, 0) + inline QString text(const char* key, const char* lang=0) const; + inline QList textList() const; + inline QStringList textLanguages() const; + inline QString text(const QImageTextKeyLang&) const; + inline void setText(const char* key, const char* lang, const QString&); #endif #endif -#ifdef QT3_SUPPORT - enum Endian { BigEndian, LittleEndian, IgnoreEndian }; - QT3_SUPPORT_CONSTRUCTOR QImage(int width, int height, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); - QT3_SUPPORT_CONSTRUCTOR QImage(const QSize&, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); - QT3_SUPPORT_CONSTRUCTOR QImage(uchar *data, int w, int h, int depth, const QRgb *colortable, int numColors, Endian bitOrder); -#ifdef Q_WS_QWS - QT3_SUPPORT_CONSTRUCTOR QImage(uchar *data, int w, int h, int depth, int pbl, const QRgb *colortable, int numColors, Endian bitOrder); -#endif - inline QT3_SUPPORT Endian bitOrder() const { - Format f = format(); - return f == Format_Mono ? BigEndian : (f == Format_MonoLSB ? LittleEndian : IgnoreEndian); - } - QT3_SUPPORT QImage convertDepth(int, Qt::ImageConversionFlags flags = Qt::AutoColor) const; - QT3_SUPPORT QImage convertDepthWithPalette(int, QRgb* p, int pc, Qt::ImageConversionFlags flags = Qt::AutoColor) const; - QT3_SUPPORT QImage convertBitOrder(Endian) const; - QT3_SUPPORT bool hasAlphaBuffer() const; - QT3_SUPPORT void setAlphaBuffer(bool); - QT3_SUPPORT uchar **jumpTable(); - QT3_SUPPORT const uchar * const *jumpTable() const; - inline QT3_SUPPORT void reset() { *this = QImage(); } - static inline QT3_SUPPORT Endian systemByteOrder() - { return QSysInfo::ByteOrder == QSysInfo::BigEndian ? BigEndian : LittleEndian; } - inline QT3_SUPPORT QImage swapRGB() const { return rgbSwapped(); } - inline QT3_SUPPORT QImage mirror(bool horizontally = false, bool vertically = true) const - { return mirrored(horizontally, vertically); } - QT3_SUPPORT bool create(const QSize&, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); - QT3_SUPPORT bool create(int width, int height, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); - inline QT3_SUPPORT QImage xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } - inline QT3_SUPPORT QImage smoothScale(int w, int h, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio) const - { return scaled(QSize(w, h), mode, Qt::SmoothTransformation); } - inline QImage QT3_SUPPORT smoothScale(const QSize &s, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio) const - { return scaled(s, mode, Qt::SmoothTransformation); } - inline QT3_SUPPORT QImage scaleWidth(int w) const { return scaledToWidth(w); } - inline QT3_SUPPORT QImage scaleHeight(int h) const { return scaledToHeight(h); } - inline QT3_SUPPORT void invertPixels(bool invertAlpha) { invertAlpha ? invertPixels(InvertRgba) : invertPixels(InvertRgb); } - inline QT3_SUPPORT QImage copy(int x, int y, int w, int h, Qt::ImageConversionFlags) const - { return copy(QRect(x, y, w, h)); } - inline QT3_SUPPORT QImage copy(const QRect &rect, Qt::ImageConversionFlags) const - { return copy(rect); } - static QT3_SUPPORT Endian systemBitOrder(); - inline QT3_SUPPORT_CONSTRUCTOR QImage(const QByteArray &data) - { d = 0; *this = QImage::fromData(data); } +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED inline int numColors() const; + QT_DEPRECATED inline void setNumColors(int); + QT_DEPRECATED inline int numBytes() const; #endif protected: @@ -337,8 +288,8 @@ private: friend class QWSOnScreenSurface; QImageData *d; - friend class QRasterPixmapData; - friend class QBlittablePixmapData; + friend class QRasterPlatformPixmap; + friend class QBlittablePlatformPixmap; friend class QPixmapCacheEntry; friend Q_GUI_EXPORT qint64 qt_image_id(const QImage &image); friend const QVector *qt_image_colortable(const QImage &image); @@ -358,6 +309,94 @@ Q_GUI_EXPORT_INLINE int QImage::pixelIndex(const QPoint &pt) const { return pixe Q_GUI_EXPORT_INLINE QRgb QImage::pixel(const QPoint &pt) const { return pixel(pt.x(), pt.y()); } Q_GUI_EXPORT_INLINE void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { setPixel(pt.x(), pt.y(), index_or_rgb); } +#if QT_DEPRECATED_SINCE(5, 0) +#ifndef QT_NO_IMAGE_TEXT +inline QString QImage::text(const char* key, const char* lang) const +{ + if (!d) + return QString(); + QString k = QString::fromAscii(key); + if (lang && *lang) + k += QLatin1Char('/') + QString::fromAscii(lang); + return d->text.value(k); +} + +inline QList QImage::textList() const +{ + QList imageTextKeys; + if (!d) + return imageTextKeys; + QStringList keys = textKeys(); + for (int i = 0; i < keys.size(); ++i) { + int index = keys.at(i).indexOf(QLatin1Char('/')); + if (index > 0) { + QImageTextKeyLang tkl; + tkl.key = keys.at(i).left(index).toAscii(); + tkl.lang = keys.at(i).mid(index+1).toAscii(); + imageTextKeys += tkl; + } + } + + return imageTextKeys; +} + +inline QStringList QImage::textLanguages() const +{ + if (!d) + return QStringList(); + QStringList keys = textKeys(); + QStringList languages; + for (int i = 0; i < keys.size(); ++i) { + int index = keys.at(i).indexOf(QLatin1Char('/')); + if (index > 0) + languages += keys.at(i).mid(index+1); + } + + return languages; +} + +inline QString QImage::text(const QImageTextKeyLang&) const +{ + if (!d) + return QString(); + QString k = QString::fromAscii(kl.key); + if (!kl.lang.isEmpty()) + k += QLatin1Char('/') + QString::fromAscii(kl.lang); + return d->text.value(k); +} + +inline void QImage::setText(const char* key, const char* lang, const QString&) +{ + if (!d) + return; + detach(); + + // In case detach() ran out of memory + if (!d) + return; + + QString k = QString::fromAscii(key); + if (lang && *lang) + k += QLatin1Char('/') + QString::fromAscii(lang); + d->text.insert(k, s); +} +#endif +inline int QImage::numColors() const +{ + return d ? d->colortable.size() : 0; +} + +inline void QImage::setNumColors(int) +{ + setColorCount(numColors); +} + +inline int QImage::numBytes() const +{ + return d ? d->nbytes : 0; +} +#endif + // QImage stream functions #if !defined(QT_NO_DATASTREAM) @@ -365,11 +404,6 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QImage &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QImage &); #endif -#ifdef QT3_SUPPORT -Q_GUI_EXPORT QT3_SUPPORT void bitBlt(QImage* dst, int dx, int dy, const QImage* src, - int sx=0, int sy=0, int sw=-1, int sh=-1, Qt::ImageConversionFlags flags = Qt::AutoColor); -#endif - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h index 7f243770fa6..bc247784153 100644 --- a/src/gui/image/qimage_p.h +++ b/src/gui/image/qimage_p.h @@ -79,9 +79,6 @@ struct Q_GUI_EXPORT QImageData { // internal image data int nbytes; // number of bytes data QVector colortable; uchar *data; -#ifdef QT3_SUPPORT - uchar **jumptable; -#endif QImage::Format format; int bytes_per_line; int ser_no; // serial number diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index aa1bf8059ee..79010455935 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qimagepixmapcleanuphooks_p.h" -#include "private/qpixmapdata_p.h" +#include "qplatformpixmap_qpa.h" #include "private/qimage_p.h" @@ -62,12 +62,12 @@ QImagePixmapCleanupHooks *QImagePixmapCleanupHooks::instance() return qt_image_and_pixmap_cleanup_hooks(); } -void QImagePixmapCleanupHooks::addPixmapDataModificationHook(_qt_pixmap_cleanup_hook_pmd hook) +void QImagePixmapCleanupHooks::addPlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd hook) { pixmapModificationHooks.append(hook); } -void QImagePixmapCleanupHooks::addPixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) +void QImagePixmapCleanupHooks::addPlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) { pixmapDestructionHooks.append(hook); } @@ -78,12 +78,12 @@ void QImagePixmapCleanupHooks::addImageHook(_qt_image_cleanup_hook_64 hook) imageHooks.append(hook); } -void QImagePixmapCleanupHooks::removePixmapDataModificationHook(_qt_pixmap_cleanup_hook_pmd hook) +void QImagePixmapCleanupHooks::removePlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd hook) { pixmapModificationHooks.removeAll(hook); } -void QImagePixmapCleanupHooks::removePixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) +void QImagePixmapCleanupHooks::removePlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd hook) { pixmapDestructionHooks.removeAll(hook); } @@ -93,7 +93,7 @@ void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook) imageHooks.removeAll(hook); } -void QImagePixmapCleanupHooks::executePixmapDataModificationHooks(QPixmapData* pmd) +void QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(QPlatformPixmap* pmd) { QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); // the global destructor for the pixmap and image hooks might have @@ -108,7 +108,7 @@ void QImagePixmapCleanupHooks::executePixmapDataModificationHooks(QPixmapData* p qt_pixmap_cleanup_hook_64(pmd->cacheKey()); } -void QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(QPixmapData* pmd) +void QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(QPlatformPixmap* pmd) { QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); // the global destructor for the pixmap and image hooks might have @@ -133,9 +133,9 @@ void QImagePixmapCleanupHooks::executeImageHooks(qint64 key) } -void QImagePixmapCleanupHooks::enableCleanupHooks(QPixmapData *pixmapData) +void QImagePixmapCleanupHooks::enableCleanupHooks(QPlatformPixmap *handle) { - pixmapData->is_cached = true; + handle->is_cached = true; } void QImagePixmapCleanupHooks::enableCleanupHooks(const QPixmap &pixmap) diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h index fe49ea0c5e6..c98da6110a4 100644 --- a/src/gui/image/qimagepixmapcleanuphooks_p.h +++ b/src/gui/image/qimagepixmapcleanuphooks_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE typedef void (*_qt_image_cleanup_hook_64)(qint64); -typedef void (*_qt_pixmap_cleanup_hook_pmd)(QPixmapData*); +typedef void (*_qt_pixmap_cleanup_hook_pmd)(QPlatformPixmap*); class QImagePixmapCleanupHooks; @@ -70,26 +70,26 @@ public: static void enableCleanupHooks(const QImage &image); static void enableCleanupHooks(const QPixmap &pixmap); - static void enableCleanupHooks(QPixmapData *pixmapData); + static void enableCleanupHooks(QPlatformPixmap *handle); static bool isImageCached(const QImage &image); static bool isPixmapCached(const QPixmap &pixmap); // Gets called when a pixmap data is about to be modified: - void addPixmapDataModificationHook(_qt_pixmap_cleanup_hook_pmd); + void addPlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd); // Gets called when a pixmap data is about to be destroyed: - void addPixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd); + void addPlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd); // Gets called when an image is about to be modified or destroyed: void addImageHook(_qt_image_cleanup_hook_64); - void removePixmapDataModificationHook(_qt_pixmap_cleanup_hook_pmd); - void removePixmapDataDestructionHook(_qt_pixmap_cleanup_hook_pmd); + void removePlatformPixmapModificationHook(_qt_pixmap_cleanup_hook_pmd); + void removePlatformPixmapDestructionHook(_qt_pixmap_cleanup_hook_pmd); void removeImageHook(_qt_image_cleanup_hook_64); - static void executePixmapDataModificationHooks(QPixmapData*); - static void executePixmapDataDestructionHooks(QPixmapData*); + static void executePlatformPixmapModificationHooks(QPlatformPixmap*); + static void executePlatformPixmapDestructionHooks(QPlatformPixmap*); static void executeImageHooks(qint64 key); private: diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 411e5e92609..4bf4b08349c 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -359,6 +359,8 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, #ifndef QT_NO_IMAGEFORMAT_BMP } else if (testFormat == "bmp") { handler = new QBmpHandler; + } else if (testFormat == "dib") { + handler = new QBmpHandler(QBmpHandler::DibFormat); #endif #ifndef QT_NO_IMAGEFORMAT_XPM } else if (testFormat == "xpm") { diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 0c465a0a02f..82ae64593a0 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -201,6 +201,8 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, #ifndef QT_NO_IMAGEFORMAT_BMP } else if (testFormat == "bmp") { handler = new QBmpHandler; + } else if (testFormat == "dib") { + handler = new QBmpHandler(QBmpHandler::DibFormat); #endif #ifndef QT_NO_IMAGEFORMAT_XPM } else if (testFormat == "xpm") { diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h index f971e11b130..02789570919 100644 --- a/src/gui/image/qmovie.h +++ b/src/gui/image/qmovie.h @@ -51,11 +51,6 @@ #include #include -#ifdef QT3_SUPPORT -#include -#include -#endif - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -151,21 +146,6 @@ public Q_SLOTS: private: Q_DISABLE_COPY(QMovie) Q_PRIVATE_SLOT(d_func(), void _q_loadNextFrame()) - -#ifdef QT3_SUPPORT -public: - inline QT3_SUPPORT bool isNull() const { return isValid(); } - inline QT3_SUPPORT int frameNumber() const { return currentFrameNumber(); } - inline QT3_SUPPORT bool running() const { return state() == Running; } - inline QT3_SUPPORT bool paused() const { return state() == Paused; } - inline QT3_SUPPORT bool finished() const { return state() == NotRunning; } - inline QT3_SUPPORT void restart() { stop(); start(); } - inline QT3_SUPPORT QImage frameImage() const { return currentImage(); } - inline QT3_SUPPORT QPixmap framePixmap() const { return currentPixmap(); } - inline QT3_SUPPORT void step() { jumpToNextFrame(); } - inline QT3_SUPPORT void pause() { setPaused(true); } - inline QT3_SUPPORT void unpause() { setPaused(false); } -#endif }; QT_END_NAMESPACE diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index aebcbafd29f..35bca4431d2 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -41,18 +41,17 @@ #include #include "qnativeimage_p.h" -#include "qcolormap.h" +#include "private/qguiapplication_p.h" +#include "qscreen.h" #include "private/qpaintengine_raster_p.h" -#include "private/qapplication_p.h" -#include "private/qgraphicssystem_p.h" +#include "private/qguiapplication_p.h" #if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) #include #include #include -#include #endif #ifdef Q_WS_MAC @@ -70,7 +69,7 @@ typedef struct { } BITMAPINFO_MASK; -QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer, QWidget *) +QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer, QWindow *) { #ifndef Q_WS_WINCE Q_UNUSED(isTextBuffer); @@ -142,107 +141,14 @@ QNativeImage::~QNativeImage() QImage::Format QNativeImage::systemFormat() { - if (QColormap::instance().depth() == 16) - return QImage::Format_RGB16; - return QImage::Format_RGB32; -} - - -#elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM) - -QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget) - : xshmimg(0), xshmpm(0) -{ - if (!X11->use_mitshm) { - image = QImage(width, height, format); - // follow good coding practice and set xshminfo attributes, though values not used in this case - xshminfo.readOnly = true; - xshminfo.shmaddr = 0; - xshminfo.shmid = 0; - xshminfo.shmseg = 0; - return; - } - - QX11Info info = widget->x11Info(); - - int dd = info.depth(); - Visual *vis = (Visual*) info.visual(); - - xshmimg = XShmCreateImage(X11->display, vis, dd, ZPixmap, 0, &xshminfo, width, height); - if (!xshmimg) { - qWarning("QNativeImage: Unable to create shared XImage."); - return; - } - - bool ok; - xshminfo.shmid = shmget(IPC_PRIVATE, xshmimg->bytes_per_line * xshmimg->height, - IPC_CREAT | 0777); - ok = xshminfo.shmid != -1; - if (ok) { - xshmimg->data = (char*)shmat(xshminfo.shmid, 0, 0); - xshminfo.shmaddr = xshmimg->data; - ok = (xshminfo.shmaddr != (char*)-1); - if (ok) - image = QImage((uchar *)xshmimg->data, width, height, format); - } - xshminfo.readOnly = false; - if (ok) { - ok = XShmAttach(X11->display, &xshminfo); - XSync(X11->display, False); - if (shmctl(xshminfo.shmid, IPC_RMID, 0) == -1) - qWarning() << "Error while marking the shared memory segment to be destroyed"; - } - if (!ok) { - qWarning() << "QNativeImage: Unable to attach to shared memory segment."; - if (xshmimg->data) { - free(xshmimg->data); - xshmimg->data = 0; - } - XDestroyImage(xshmimg); - xshmimg = 0; - if (xshminfo.shmaddr) - shmdt(xshminfo.shmaddr); - if (xshminfo.shmid != -1) - shmctl(xshminfo.shmid, IPC_RMID, 0); - return; - } - if (X11->use_mitshm_pixmaps) { - xshmpm = XShmCreatePixmap(X11->display, DefaultRootWindow(X11->display), xshmimg->data, - &xshminfo, width, height, dd); - if (!xshmpm) { - qWarning() << "QNativeImage: Unable to create shared Pixmap."; - } - } -} - - -QNativeImage::~QNativeImage() -{ - if (!xshmimg) - return; - - if (xshmpm) { - XFreePixmap(X11->display, xshmpm); - xshmpm = 0; - } - XShmDetach(X11->display, &xshminfo); - xshmimg->data = 0; - XDestroyImage(xshmimg); - xshmimg = 0; - shmdt(xshminfo.shmaddr); - shmctl(xshminfo.shmid, IPC_RMID, 0); -} - -QImage::Format QNativeImage::systemFormat() -{ - if (QX11Info::appDepth() == 16) + if (QGuiApplication::primaryScreen()->depth() == 16) return QImage::Format_RGB16; return QImage::Format_RGB32; } #elif defined(Q_WS_MAC) -QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWidget *widget) +QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWindow *) : image(width, height, format) { @@ -267,7 +173,7 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* #endif cg = CGBitmapContextCreate(image.bits(), width, height, 8, image.bytesPerLine(), - QCoreGraphicsPaintEngine::macDisplayColorSpace(widget), cgflags); + QCoreGraphicsPaintEngine::macDisplayColorSpace(0), cgflags); CGContextTranslateCTM(cg, 0, height); CGContextScaleCTM(cg, 1, -1); @@ -289,7 +195,7 @@ QImage::Format QNativeImage::systemFormat() #else // other platforms... -QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWidget *) +QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWindow *) : image(width, height, format) { @@ -302,11 +208,7 @@ QNativeImage::~QNativeImage() QImage::Format QNativeImage::systemFormat() { -#ifdef Q_WS_QPA - return QApplicationPrivate::platformIntegration()->screens().at(0)->format(); -#else - return QImage::Format_RGB32; -#endif + return QGuiApplication::primaryScreen()->handle()->format(); } #endif // platforms diff --git a/src/gui/image/qnativeimage_p.h b/src/gui/image/qnativeimage_p.h index e468917a672..f9132de69eb 100644 --- a/src/gui/image/qnativeimage_p.h +++ b/src/gui/image/qnativeimage_p.h @@ -58,9 +58,6 @@ #ifdef Q_WS_WIN #include "qt_windows.h" -#elif defined(Q_WS_X11) -#include - #elif defined(Q_WS_MAC) #include @@ -68,12 +65,12 @@ QT_BEGIN_NAMESPACE -class QWidget; +class QWindow; class QNativeImage { public: - QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer = false, QWidget *widget = 0); + QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer = false, QWindow *window = 0); ~QNativeImage(); inline int width() const; @@ -88,11 +85,6 @@ public: HBITMAP bitmap; HBITMAP null_bitmap; -#elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM) - XImage *xshmimg; - Pixmap xshmpm; - XShmSegmentInfo xshminfo; - #elif defined(Q_WS_MAC) CGContextRef cg; #endif diff --git a/src/gui/image/qnativeimagehandleprovider_p.h b/src/gui/image/qnativeimagehandleprovider_p.h deleted file mode 100644 index b3b3e487d13..00000000000 --- a/src/gui/image/qnativeimagehandleprovider_p.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNATIVEIMAGEHANDLEPROVIDER_P_H -#define QNATIVEIMAGEHANDLEPROVIDER_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 - -class QNativeImageHandleProvider -{ -public: - virtual void get(void **handle, QString *type) = 0; - virtual void release(void *handle, const QString &type) = 0; -}; - -QT_END_NAMESPACE - -#endif // QNATIVEIMAGEHANDLEPROVIDER_P_H diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 5df469ace7c..418393a1b8f 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include "qdatastream.h" #include "qfile.h" @@ -1217,7 +1218,6 @@ QDataStream &operator>>(QDataStream &s, QPicture &r) QT_BEGIN_INCLUDE_NAMESPACE #include "qregexp.h" -#include "qapplication.h" #include "qpictureformatplugin.h" QT_END_INCLUDE_NAMESPACE diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index 848a6f5083b..1c5d3a9c8fa 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -104,9 +104,6 @@ protected: QPicture(QPicturePrivate &data); int metric(PaintDeviceMetric m) const; -#ifdef QT3_SUPPORT - inline QT3_SUPPORT QPicture copy() const { QPicture p(*this); p.detach(); return p; } -#endif private: bool exec(QPainter *p, QDataStream &ds, int i); diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 70715793a71..c2b9c6a1b9d 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -42,20 +42,15 @@ #include #include "qpixmap.h" -#include "qpixmapdata_p.h" +#include "qplatformpixmap_qpa.h" #include "qimagepixmapcleanuphooks_p.h" #include "qbitmap.h" -#include "qcolormap.h" #include "qimage.h" -#include "qwidget.h" #include "qpainter.h" #include "qdatastream.h" #include "qbuffer.h" -#include "qapplication.h" -#include -#include -#include +#include #include "qevent.h" #include "qfile.h" #include "qfileinfo.h" @@ -65,58 +60,30 @@ #include "qimagewriter.h" #include "qpaintengine.h" #include "qthread.h" - -#ifdef Q_WS_MAC -# include "private/qt_mac_p.h" -# include "private/qpixmap_mac_p.h" -#endif +#include "qdebug.h" #ifdef Q_WS_QPA # include "qplatformintegration_qpa.h" #endif -#if defined(Q_WS_X11) -# include "qx11info_x11.h" -# include -# include -#endif - -#if defined(Q_OS_SYMBIAN) -# include -#endif - #include "qpixmap_raster_p.h" -#include "private/qstylehelper_p.h" +#include "private/qhexstring_p.h" QT_BEGIN_NAMESPACE -// ### Qt 5: remove -Q_GUI_EXPORT qint64 qt_pixmap_id(const QPixmap &pixmap) -{ - return pixmap.cacheKey(); -} - static bool qt_pixmap_thread_test() { - if (!qApp) { + if (!QCoreApplication::instance()) { qFatal("QPixmap: Must construct a QApplication before a QPaintDevice"); return false; } if (qApp->thread() != QThread::currentThread()) { bool fail = false; -#if defined (Q_WS_X11) - if (!QApplication::testAttribute(Qt::AA_X11InitThreads)) - fail = true; -#elif defined (Q_WS_QPA) - if (!QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) { + if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) { printf("Lighthouse plugin does not support threaded pixmaps!\n"); fail = true; } -#else - if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) - fail = true; -#endif if (fail) { qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread"); return false; @@ -125,23 +92,10 @@ static bool qt_pixmap_thread_test() return true; } -void QPixmap::init(int w, int h, Type type) +void QPixmap::doInit(int w, int h, int type) { - init(w, h, int(type)); -} - -extern QApplication::Type qt_appType; - -void QPixmap::init(int w, int h, int type) -{ - if (qt_appType == QApplication::Tty) { - qWarning("QPixmap: Cannot create a QPixmap when no GUI is being used"); - data = 0; - return; - } - - if ((w > 0 && h > 0) || type == QPixmapData::BitmapType) - data = QPixmapData::create(w, h, (QPixmapData::PixelType) type); + if ((w > 0 && h > 0) || type == QPlatformPixmap::BitmapType) + data = QPlatformPixmap::create(w, h, (QPlatformPixmap::PixelType) type); else data = 0; } @@ -172,7 +126,7 @@ QPixmap::QPixmap() : QPaintDevice() { (void) qt_pixmap_thread_test(); - init(0, 0, QPixmapData::PixmapType); + doInit(0, 0, QPlatformPixmap::PixmapType); } /*! @@ -193,9 +147,9 @@ QPixmap::QPixmap(int w, int h) : QPaintDevice() { if (!qt_pixmap_thread_test()) - init(0, 0, QPixmapData::PixmapType); + doInit(0, 0, QPlatformPixmap::PixmapType); else - init(w, h, QPixmapData::PixmapType); + doInit(w, h, QPlatformPixmap::PixmapType); } /*! @@ -212,20 +166,9 @@ QPixmap::QPixmap(const QSize &size) : QPaintDevice() { if (!qt_pixmap_thread_test()) - init(0, 0, QPixmapData::PixmapType); + doInit(0, 0, QPlatformPixmap::PixmapType); else - init(size.width(), size.height(), QPixmapData::PixmapType); -} - -/*! - \internal -*/ -QPixmap::QPixmap(const QSize &s, Type type) -{ - if (!qt_pixmap_thread_test()) - init(0, 0, type); - else - init(s.width(), s.height(), type); + doInit(size.width(), size.height(), QPlatformPixmap::PixmapType); } /*! @@ -234,15 +177,15 @@ QPixmap::QPixmap(const QSize &s, Type type) QPixmap::QPixmap(const QSize &s, int type) { if (!qt_pixmap_thread_test()) - init(0, 0, static_cast(type)); + doInit(0, 0, static_cast(type)); else - init(s.width(), s.height(), static_cast(type)); + doInit(s.width(), s.height(), static_cast(type)); } /*! \internal */ -QPixmap::QPixmap(QPixmapData *d) +QPixmap::QPixmap(QPlatformPixmap *d) : QPaintDevice(), data(d) { } @@ -279,7 +222,7 @@ QPixmap::QPixmap(QPixmapData *d) QPixmap::QPixmap(const QString& fileName, const char *format, Qt::ImageConversionFlags flags) : QPaintDevice() { - init(0, 0, QPixmapData::PixmapType); + doInit(0, 0, QPlatformPixmap::PixmapType); if (!qt_pixmap_thread_test()) return; @@ -296,7 +239,7 @@ QPixmap::QPixmap(const QPixmap &pixmap) : QPaintDevice() { if (!qt_pixmap_thread_test()) { - init(0, 0, QPixmapData::PixmapType); + doInit(0, 0, QPlatformPixmap::PixmapType); return; } if (pixmap.paintingActive()) { // make a deep copy @@ -325,13 +268,13 @@ QPixmap::QPixmap(const QPixmap &pixmap) QPixmap::QPixmap(const char * const xpm[]) : QPaintDevice() { - init(0, 0, QPixmapData::PixmapType); + doInit(0, 0, QPlatformPixmap::PixmapType); if (!xpm) return; QImage image(xpm); if (!image.isNull()) { - if (data && data->pixelType() == QPixmapData::BitmapType) + if (data && data->pixelType() == QPlatformPixmap::BitmapType) *this = QBitmap::fromImage(image); else *this = fromImage(image); @@ -386,7 +329,7 @@ QPixmap QPixmap::copy(const QRect &rect) const if (!rect.isEmpty()) r = r.intersected(rect); - QPixmapData *d = data->createCompatiblePixmapData(); + QPlatformPixmap *d = data->createCompatiblePlatformPixmap(); d->copy(data.data(), r); return QPixmap(d); } @@ -563,7 +506,7 @@ QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h) bool QPixmap::isQBitmap() const { - return data->type == QPixmapData::BitmapType; + return data->type == QPlatformPixmap::BitmapType; } /*! @@ -657,65 +600,6 @@ int QPixmap::depth() const pixmap = pixmap.copy(QRect(QPoint(0, 0), size)); \endcode */ -#ifdef QT3_SUPPORT -void QPixmap::resize_helper(const QSize &s) -{ - int w = s.width(); - int h = s.height(); - if (w < 1 || h < 1) { - *this = QPixmap(); - return; - } - - if (size() == s) - return; - - // QPixmap.data member may be QRuntimePixmapData so use pixmapData() function to get - // the actual underlaying runtime pixmap data. - QPixmapData *pd = pixmapData(); - - // Create new pixmap - QPixmap pm(QSize(w, h), pd ? pd->type : QPixmapData::PixmapType); - bool uninit = false; -#if defined(Q_WS_X11) - QX11PixmapData *x11Data = pd && pd->classId() == QPixmapData::X11Class ? static_cast(pd) : 0; - if (x11Data) { - pm.x11SetScreen(x11Data->xinfo.screen()); - uninit = x11Data->flags & QX11PixmapData::Uninitialized; - } -#elif defined(Q_WS_MAC) - QMacPixmapData *macData = pd && pd->classId() == QPixmapData::MacClass ? static_cast(pd) : 0; - if (macData) - uninit = macData->uninit; -#endif - if (!uninit && !isNull()) { - // Copy old pixmap - if (hasAlphaChannel()) - pm.fill(Qt::transparent); - QPainter p(&pm); - p.drawPixmap(0, 0, *this, 0, 0, qMin(width(), w), qMin(height(), h)); - } - -#if defined(Q_WS_X11) - if (x11Data && x11Data->x11_mask) { - QPixmapData *newPd = pm.pixmapData(); - QX11PixmapData *pmData = (newPd && newPd->classId() == QPixmapData::X11Class) - ? static_cast(newPd) : 0; - if (pmData) { - pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display, - RootWindow(x11Data->xinfo.display(), - x11Data->xinfo.screen()), - w, h, 1); - GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0); - XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0, - qMin(width(), w), qMin(height(), h), 0, 0); - XFreeGC(X11->display, gc); - } - } -#endif - *this = pm; -} -#endif /*! \fn void QPixmap::resize(int width, int height) @@ -776,7 +660,44 @@ void QPixmap::setMask(const QBitmap &mask) return; detach(); - data->setMask(mask); + + QImage image = data->toImage(); + if (mask.size().isEmpty()) { + if (image.depth() != 1) { // hw: ???? + image = image.convertToFormat(QImage::Format_RGB32); + } + } else { + const int w = image.width(); + const int h = image.height(); + + switch (image.depth()) { + case 1: { + const QImage imageMask = mask.toImage().convertToFormat(image.format()); + for (int y = 0; y < h; ++y) { + const uchar *mscan = imageMask.scanLine(y); + uchar *tscan = image.scanLine(y); + int bytesPerLine = image.bytesPerLine(); + for (int i = 0; i < bytesPerLine; ++i) + tscan[i] &= mscan[i]; + } + break; + } + default: { + const QImage imageMask = mask.toImage().convertToFormat(QImage::Format_MonoLSB); + image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); + for (int y = 0; y < h; ++y) { + const uchar *mscan = imageMask.scanLine(y); + QRgb *tscan = (QRgb *)image.scanLine(y); + for (int x = 0; x < w; ++x) { + if (!(mscan[x>>3] & (1 << (x&7)))) + tscan[x] = 0; + } + } + break; + } + } + } + data->fromImage(image, Qt::AutoColor); } #ifndef QT_NO_IMAGE_HEURISTIC_MASK @@ -823,19 +744,6 @@ QBitmap QPixmap::createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode) return QBitmap::fromImage(image.createMaskFromColor(maskColor.rgba(), mode)); } -/*! \overload - - Creates and returns a mask for this pixmap based on the given \a - maskColor. Same as calling createMaskFromColor(maskColor, - Qt::MaskInColor) - - \sa createHeuristicMask(), QImage::createMaskFromColor() -*/ -QBitmap QPixmap::createMaskFromColor(const QColor &maskColor) const -{ - return createMaskFromColor(maskColor, Qt::MaskInColor); -} - /*! Loads a pixmap from the file with the given \a fileName. Returns true if the pixmap was successfully loaded; otherwise returns @@ -873,7 +781,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers % info.absoluteFilePath() % HexString(info.lastModified().toTime_t()) % HexString(info.size()) - % HexString(data ? data->pixelType() : QPixmapData::PixmapType); + % HexString(data ? data->pixelType() : QPlatformPixmap::PixmapType); // Note: If no extension is provided, we try to match the // file against known plugin extensions @@ -883,7 +791,7 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers if (QPixmapCache::find(key, *this)) return true; - QScopedPointer tmp(QPixmapData::create(0, 0, data ? data->type : QPixmapData::PixmapType)); + QScopedPointer tmp(QPlatformPixmap::create(0, 0, data ? data->type : QPlatformPixmap::PixmapType)); if (tmp->fromFile(fileName, format, flags)) { data = tmp.take(); QPixmapCache::insert(key, *this); @@ -918,7 +826,7 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::I return false; if (!data) - data = QPixmapData::create(0, 0, QPixmapData::PixmapType); + data = QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType); return data->fromData(buf, len, format, flags); } @@ -986,21 +894,24 @@ bool QPixmap::doImageIO(QImageWriter *writer, int quality) const return writer->write(toImage()); } - -// The implementation (and documentation) of -// QPixmap::fill(const QWidget *, const QPoint &) -// is in qwidget.cpp - /*! - \fn void QPixmap::fill(const QWidget *widget, int x, int y) + \fn void QPixmap::fill(const QPaintDevice *device, int x, int y) \overload - Fills the pixmap with the \a widget's background color or pixmap. + \obsolete + + Fills the pixmap with the \a device's background color or pixmap. The given point, (\a x, \a y), defines an offset in widget coordinates to which the pixmap's top-left pixel will be mapped to. */ +void QPixmap::fill(const QPaintDevice *, const QPoint &) +{ + qWarning() << "QPixmap::fill(const QPaintDevice *device, const QPoint &offset) is deprecated, ignored"; +} + + /*! Fills the pixmap with the given \a color. @@ -1029,7 +940,7 @@ void QPixmap::fill(const QColor &color) } else { // Don't bother to make a copy of the data object, since // it will be filled with new pixel data anyway. - QPixmapData *d = data->createCompatiblePixmapData(); + QPlatformPixmap *d = data->createCompatiblePlatformPixmap(); d->resize(data->width(), data->height()); data = d; } @@ -1072,6 +983,7 @@ qint64 QPixmap::cacheKey() const return data->cacheKey(); } +#if 0 static void sendResizeEvents(QWidget *target) { QResizeEvent e(target->size(), QSize()); @@ -1084,9 +996,10 @@ static void sendResizeEvents(QWidget *target) sendResizeEvents(child); } } +#endif /*! - \fn QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rectangle) + \fn QPixmap QPixmap::grabWidget(QPaintDevice * widget, const QRect &rectangle) Creates a pixmap and paints the given \a widget, restricted by the given \a rectangle, in it. If the \a widget has any children, then @@ -1115,33 +1028,18 @@ static void sendResizeEvents(QWidget *target) \sa grabWindow() */ -QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect) +QPixmap QPixmap::grabWidget(QObject *widget, const QRect &rectangle) { + QPixmap pixmap; + // ### Qt5: should we keep or remove this method? + // SC solution would be to install a callback form QtWidgets, but ugly. + qWarning("QPixmap::grabWidget is deprecated, use QWidget::grab() instead"); if (!widget) - return QPixmap(); - - if (widget->testAttribute(Qt::WA_PendingResizeEvent) || !widget->testAttribute(Qt::WA_WState_Created)) - sendResizeEvents(widget); - - widget->d_func()->prepareToRender(QRegion(), - QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask); - - QRect r(rect); - if (r.width() < 0) - r.setWidth(widget->width() - rect.x()); - if (r.height() < 0) - r.setHeight(widget->height() - rect.y()); - - if (!r.intersects(widget->rect())) - return QPixmap(); - - QPixmap res(r.size()); - if (!qt_widget_private(widget)->isOpaque) - res.fill(Qt::transparent); - - widget->d_func()->render(&res, QPoint(), r, QWidget::DrawWindowBackground - | QWidget::DrawChildren | QWidget::IgnoreMask, true); - return res; + return pixmap; + QMetaObject::invokeMethod(widget, "grab", Qt::DirectConnection, + Q_RETURN_ARG(QPixmap, pixmap), + Q_ARG(QRect, rectangle)); + return pixmap; } /*! @@ -1200,137 +1098,6 @@ QPixmap QPixmap::grabWidget(QWidget * widget, const QRect &rect) */ -#if defined(Q_WS_X11) || defined(Q_WS_QWS) - -/*! - Returns the pixmap's handle to the device context. - - Note that, since QPixmap make use of \l {Implicit Data - Sharing}{implicit data sharing}, the detach() function must be - called explicitly to ensure that only \e this pixmap's data is - modified if the pixmap data is shared. - - \warning This function is X11 specific; using it is non-portable. - - \warning Since 4.8, pixmaps do not have an X11 handle unless - created with \l {QPixmap::}{fromX11Pixmap()}, or if the native - graphics system is explicitly enabled. - - \sa detach() - \sa QApplication::setGraphicsSystem() -*/ - -Qt::HANDLE QPixmap::handle() const -{ -#if defined(Q_WS_X11) - const QPixmapData *pd = pixmapData(); - if (pd && pd->classId() == QPixmapData::X11Class) - return static_cast(pd)->handle(); -#endif - return 0; -} -#endif - - -#ifdef QT3_SUPPORT -static Qt::ImageConversionFlags colorModeToFlags(QPixmap::ColorMode mode) -{ - Qt::ImageConversionFlags flags = Qt::AutoColor; - switch (mode) { - case QPixmap::Color: - flags |= Qt::ColorOnly; - break; - case QPixmap::Mono: - flags |= Qt::MonoOnly; - break; - default: - break;// Nothing. - } - return flags; -} - -/*! - Use the constructor that takes a Qt::ImageConversionFlag instead. -*/ - -QPixmap::QPixmap(const QString& fileName, const char *format, ColorMode mode) - : QPaintDevice() -{ - init(0, 0, QPixmapData::PixmapType); - if (!qt_pixmap_thread_test()) - return; - - load(fileName, format, colorModeToFlags(mode)); -} - -/*! - Constructs a pixmap from the QImage \a image. - - Use the static fromImage() function instead. -*/ -QPixmap::QPixmap(const QImage& image) - : QPaintDevice() -{ - init(0, 0, QPixmapData::PixmapType); - if (!qt_pixmap_thread_test()) - return; - - if (data && data->pixelType() == QPixmapData::BitmapType) - *this = QBitmap::fromImage(image); - else - *this = fromImage(image); -} - -/*! - \overload - - Converts the given \a image to a pixmap that is assigned to this - pixmap. - - Use the static fromImage() function instead. -*/ - -QPixmap &QPixmap::operator=(const QImage &image) -{ - if (data && data->pixelType() == QPixmapData::BitmapType) - *this = QBitmap::fromImage(image); - else - *this = fromImage(image); - return *this; -} - -/*! - Use the load() function that takes a Qt::ImageConversionFlag instead. -*/ - -bool QPixmap::load(const QString &fileName, const char *format, ColorMode mode) -{ - return load(fileName, format, colorModeToFlags(mode)); -} - -/*! - Use the loadFromData() function that takes a Qt::ImageConversionFlag instead. -*/ - -bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, ColorMode mode) -{ - return loadFromData(buf, len, format, colorModeToFlags(mode)); -} - -/*! - Use the static fromImage() function instead. -*/ -bool QPixmap::convertFromImage(const QImage &image, ColorMode mode) -{ - if (data && data->pixelType() == QPixmapData::BitmapType) - *this = QBitmap::fromImage(image, colorModeToFlags(mode)); - else - *this = fromImage(image, colorModeToFlags(mode)); - return !isNull(); -} - -#endif - /***************************************************************************** QPixmap stream functions *****************************************************************************/ @@ -1375,34 +1142,6 @@ QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap) #endif // QT_NO_DATASTREAM -#ifdef QT3_SUPPORT -Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, - const QPixmap *src, int sx, int sy, int sw, int sh) -{ - Q_ASSERT_X(dst, "::copyBlt", "Destination pixmap must be non-null"); - Q_ASSERT_X(src, "::copyBlt", "Source pixmap must be non-null"); - - if (src->hasAlphaChannel()) { - if (dst->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) { - QPainter p(dst); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.drawPixmap(dx, dy, *src, sx, sy, sw, sh); - } else { - QImage image = dst->toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); - QPainter p(&image); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.drawPixmap(dx, dy, *src, sx, sy, sw, sh); - p.end(); - *dst = QPixmap::fromImage(image); - } - } else { - QPainter p(dst); - p.drawPixmap(dx, dy, *src, sx, sy, sw, sh); - } - -} -#endif - /*! \internal */ @@ -1832,23 +1571,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) */ bool QPixmap::hasAlpha() const { -#if defined(Q_WS_X11) - if (data && data->hasAlphaChannel()) - return true; - QPixmapData *pd = pixmapData(); - if (pd && pd->classId() == QPixmapData::X11Class) { - QX11PixmapData *x11Data = static_cast(pd); -#ifndef QT_NO_XRENDER - if (x11Data->picture && x11Data->d == 32) - return true; -#endif - if (x11Data->d == 1 || x11Data->x11_mask) - return true; - } - return false; -#else return data && data->hasAlphaChannel(); -#endif } /*! @@ -1870,78 +1593,6 @@ int QPixmap::metric(PaintDeviceMetric metric) const return data ? data->metric(metric) : 0; } -/*! - \fn void QPixmap::setAlphaChannel(const QPixmap &alphaChannel) - \obsolete - - Sets the alpha channel of this pixmap to the given \a alphaChannel - by converting the \a alphaChannel into 32 bit and using the - intensity of the RGB pixel values. - - The effect of this function is undefined when the pixmap is being - painted on. - - \warning This is potentially an expensive operation. Most usecases - for this function are covered by QPainter and compositionModes - which will normally execute faster. - - \sa alphaChannel(), {QPixmap#Pixmap Transformations}{Pixmap - Transformations} - */ -void QPixmap::setAlphaChannel(const QPixmap &alphaChannel) -{ - if (alphaChannel.isNull()) - return; - - if (paintingActive()) { - qWarning("QPixmap::setAlphaChannel: " - "Cannot set alpha channel while pixmap is being painted on"); - return; - } - - if (width() != alphaChannel.width() && height() != alphaChannel.height()) { - qWarning("QPixmap::setAlphaChannel: " - "The pixmap and the alpha channel pixmap must have the same size"); - return; - } - - detach(); - data->setAlphaChannel(alphaChannel); -} - -/*! - \obsolete - - Returns the alpha channel of the pixmap as a new grayscale QPixmap in which - each pixel's red, green, and blue values are given the alpha value of the - original pixmap. The color depth of the returned pixmap is the system depth - on X11 and 8-bit on Windows and Mac OS X. - - You can use this function while debugging - to get a visible image of the alpha channel. If the pixmap doesn't have an - alpha channel, i.e., the alpha channel's value for all pixels equals - 0xff), a null pixmap is returned. You can check this with the \c isNull() - function. - - We show an example: - - \snippet doc/src/snippets/alphachannel.cpp 0 - - \image alphachannelimage.png The pixmap and channelImage QPixmaps - - \warning This is an expensive operation. The alpha channel of the - pixmap is extracted dynamically from the pixeldata. Most usecases of this - function are covered by QPainter and compositionModes which will normally - execute faster. - - \sa setAlphaChannel(), {QPixmap#Pixmap Information}{Pixmap - Information} -*/ -QPixmap QPixmap::alphaChannel() const -{ - return data ? data->alphaChannel() : QPixmap(); -} - /*! \internal */ @@ -1962,7 +1613,36 @@ QPaintEngine *QPixmap::paintEngine() const */ QBitmap QPixmap::mask() const { - return data ? data->mask() : QBitmap(); + if (!data || !hasAlphaChannel()) + return QBitmap(); + + const QImage img = toImage(); + const QImage image = (img.depth() < 32 ? img.convertToFormat(QImage::Format_ARGB32_Premultiplied) : img); + const int w = image.width(); + const int h = image.height(); + + QImage mask(w, h, QImage::Format_MonoLSB); + if (mask.isNull()) // allocation failed + return QBitmap(); + + mask.setColorCount(2); + mask.setColor(0, QColor(Qt::color0).rgba()); + mask.setColor(1, QColor(Qt::color1).rgba()); + + const int bpl = mask.bytesPerLine(); + + for (int y = 0; y < h; ++y) { + const QRgb *src = reinterpret_cast(image.scanLine(y)); + uchar *dest = mask.scanLine(y); + memset(dest, 0, bpl); + for (int x = 0; x < w; ++x) { + if (qAlpha(*src) > 0) + dest[x >> 3] |= (1 << (x & 7)); + ++src; + } + } + + return QBitmap::fromImage(mask); } /*! @@ -1977,21 +1657,7 @@ QBitmap QPixmap::mask() const */ int QPixmap::defaultDepth() { -#if defined(Q_WS_QWS) - return QScreen::instance()->depth(); -#elif defined(Q_WS_X11) - return QX11Info::appDepth(); -#elif defined(Q_WS_WINCE) - return QColormap::instance().depth(); -#elif defined(Q_WS_WIN) - return 32; // XXX -#elif defined(Q_WS_MAC) - return 32; -#elif defined(Q_OS_SYMBIAN) - return S60->screenDepth; -#elif defined(Q_WS_QPA) - return 32; //LITE: use graphicssystem (we should do that in general) -#endif + return 32; // LITE: ### use QPlatformScreen (we should do that in general) } /*! @@ -2016,50 +1682,22 @@ void QPixmap::detach() if (!data) return; - // QPixmap.data member may be QRuntimePixmapData so use pixmapData() function to get + // QPixmap.data member may be QRuntimePlatformPixmap so use handle() function to get // the actual underlaying runtime pixmap data. - QPixmapData *pd = pixmapData(); - QPixmapData::ClassId id = pd->classId(); - if (id == QPixmapData::RasterClass) { - QRasterPixmapData *rasterData = static_cast(pd); + QPlatformPixmap *pd = handle(); + QPlatformPixmap::ClassId id = pd->classId(); + if (id == QPlatformPixmap::RasterClass) { + QRasterPlatformPixmap *rasterData = static_cast(pd); rasterData->image.detach(); } if (data->is_cached && data->ref == 1) - QImagePixmapCleanupHooks::executePixmapDataModificationHooks(data.data()); - -#if defined(Q_WS_MAC) - QMacPixmapData *macData = id == QPixmapData::MacClass ? static_cast(pd) : 0; - if (macData) { - if (macData->cg_mask) { - CGImageRelease(macData->cg_mask); - macData->cg_mask = 0; - } - } -#endif + QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(data.data()); if (data->ref != 1) { *this = copy(); } ++data->detach_no; - -#if defined(Q_WS_X11) - if (pd->classId() == QPixmapData::X11Class) { - QX11PixmapData *d = static_cast(pd); - d->flags &= ~QX11PixmapData::Uninitialized; - - // reset the cache data - if (d->hd2) { - XFreePixmap(X11->display, d->hd2); - d->hd2 = 0; - } - } -#elif defined(Q_WS_MAC) - if (macData) { - macData->macReleaseCGImageRef(); - macData->uninit = false; - } -#endif } /*! @@ -2082,9 +1720,7 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) if (image.isNull()) return QPixmap(); - QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); - QScopedPointer data(gs ? gs->createPixmapData(QPixmapData::PixmapType) - : QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixmapType)); + QScopedPointer data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType)); data->fromImage(image, flags); return QPixmap(data.take()); } @@ -2103,9 +1739,7 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) */ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) { - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - QScopedPointer data(gs ? gs->createPixmapData(QPixmapData::PixmapType) - : QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixmapType)); + QScopedPointer data(QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(QPlatformPixmap::PixmapType)); data->fromImageReader(imageReader, flags); return QPixmap(data.take()); } @@ -2154,14 +1788,9 @@ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionF /*! \internal */ -QPixmapData* QPixmap::pixmapData() const +QPlatformPixmap* QPixmap::handle() const { - if (data) { - QPixmapData* pm = data.data(); - return pm->runtimeData() ? pm->runtimeData() : pm; - } - - return 0; + return data.data(); } diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 3012080abb9..5d300d1f76d 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -52,11 +52,6 @@ QT_BEGIN_HEADER -#if defined(Q_OS_SYMBIAN) -class CFbsBitmap; -class RSgImage; -#endif - QT_BEGIN_NAMESPACE QT_MODULE(Gui) @@ -66,13 +61,13 @@ class QImageReader; class QColor; class QVariant; class QX11Info; -class QPixmapData; +class QPlatformPixmap; class Q_GUI_EXPORT QPixmap : public QPaintDevice { public: QPixmap(); - explicit QPixmap(QPixmapData *data); + explicit QPixmap(QPlatformPixmap *data); QPixmap(int w, int h); QPixmap(const QSize &); QPixmap(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); @@ -103,32 +98,25 @@ public: static int defaultDepth(); void fill(const QColor &fillColor = Qt::white); - void fill(const QWidget *widget, const QPoint &ofs); - inline void fill(const QWidget *widget, int xofs, int yofs) { fill(widget, QPoint(xofs, yofs)); } + void fill(const QPaintDevice *device, const QPoint &ofs); + inline void fill(const QPaintDevice *device, int xofs, int yofs) { fill(device, QPoint(xofs, yofs)); } QBitmap mask() const; void setMask(const QBitmap &); -#ifdef QT_DEPRECATED - QT_DEPRECATED QPixmap alphaChannel() const; - QT_DEPRECATED void setAlphaChannel(const QPixmap &); -#endif - bool hasAlpha() const; bool hasAlphaChannel() const; #ifndef QT_NO_IMAGE_HEURISTIC_MASK QBitmap createHeuristicMask(bool clipTight = true) const; #endif - QBitmap createMaskFromColor(const QColor &maskColor) const; // ### Qt 5: remove - QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode) const; + QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode = Qt::MaskInColor) const; static QPixmap grabWindow(WId, int x=0, int y=0, int w=-1, int h=-1); - static QPixmap grabWidget(QWidget *widget, const QRect &rect); - static inline QPixmap grabWidget(QWidget *widget, int x=0, int y=0, int w=-1, int h=-1) + static QPixmap grabWidget(QObject *widget, const QRect &rect); + static inline QPixmap grabWidget(QObject *widget, int x=0, int y=0, int w=-1, int h=-1) { return grabWidget(widget, QRect(x, y, w, h)); } - inline QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode = Qt::IgnoreAspectRatio, Qt::TransformationMode mode = Qt::FastTransformation) const { return scaled(QSize(w, h), aspectMode, mode); } @@ -153,32 +141,6 @@ public: bool convertFromImage(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor); -#if defined(Q_WS_WIN) - enum HBitmapFormat { - NoAlpha, - PremultipliedAlpha, - Alpha - }; - - HBITMAP toWinHBITMAP(HBitmapFormat format = NoAlpha) const; - HICON toWinHICON() const; - - static QPixmap fromWinHBITMAP(HBITMAP hbitmap, HBitmapFormat format = NoAlpha); - static QPixmap fromWinHICON(HICON hicon); -#endif - -#if defined(Q_WS_MAC) - CGImageRef toMacCGImageRef() const; - static QPixmap fromMacCGImageRef(CGImageRef image); -#endif - -#if defined(Q_OS_SYMBIAN) - CFbsBitmap *toSymbianCFbsBitmap() const; - static QPixmap fromSymbianCFbsBitmap(CFbsBitmap *bitmap); - RSgImage* toSymbianRSgImage() const; - static QPixmap fromSymbianRSgImage(RSgImage *sgImage); -#endif - inline QPixmap copy(int x, int y, int width, int height) const; QPixmap copy(const QRect &rect = QRect()) const; @@ -195,105 +157,43 @@ public: bool isQBitmap() const; -#if defined(Q_WS_QWS) - const uchar *qwsBits() const; - int qwsBytesPerLine() const; - QRgb *clut() const; -#ifdef QT_DEPRECATED - QT_DEPRECATED int numCols() const; -#endif - int colorCount() const; -#elif defined(Q_WS_MAC) - Qt::HANDLE macQDHandle() const; - Qt::HANDLE macQDAlphaHandle() const; - Qt::HANDLE macCGHandle() const; -#elif defined(Q_WS_X11) - enum ShareMode { ImplicitlyShared, ExplicitlyShared }; - - static QPixmap fromX11Pixmap(Qt::HANDLE pixmap, ShareMode mode = ImplicitlyShared); - static int x11SetDefaultScreen(int screen); - void x11SetScreen(int screen); - const QX11Info &x11Info() const; - Qt::HANDLE x11PictureHandle() const; -#endif - -#if defined(Q_WS_X11) || defined(Q_WS_QWS) - Qt::HANDLE handle() const; -#endif - QPaintEngine *paintEngine() const; inline bool operator!() const { return isNull(); } +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED inline QPixmap alphaChannel() const; + QT_DEPRECATED inline void setAlphaChannel(const QPixmap &); +#endif + protected: int metric(PaintDeviceMetric) const; -#ifdef QT3_SUPPORT -public: - enum ColorMode { Auto, Color, Mono }; - QT3_SUPPORT_CONSTRUCTOR QPixmap(const QString& fileName, const char *format, ColorMode mode); - QT3_SUPPORT bool load(const QString& fileName, const char *format, ColorMode mode); - QT3_SUPPORT bool loadFromData(const uchar *buf, uint len, const char* format, ColorMode mode); - QT3_SUPPORT_CONSTRUCTOR QPixmap(const QImage& image); - QT3_SUPPORT QPixmap &operator=(const QImage &); - inline QT3_SUPPORT QImage convertToImage() const { return toImage(); } - QT3_SUPPORT bool convertFromImage(const QImage &, ColorMode mode); - inline QT3_SUPPORT operator QImage() const { return toImage(); } - inline QT3_SUPPORT QPixmap xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } - inline QT3_SUPPORT bool selfMask() const { return false; } private: - void resize_helper(const QSize &s); -public: - inline QT3_SUPPORT void resize(const QSize &s) { resize_helper(s); } - inline QT3_SUPPORT void resize(int width, int height) { resize_helper(QSize(width, height)); } -#endif - -private: - QExplicitlySharedDataPointer data; + QExplicitlySharedDataPointer data; bool doImageIO(QImageWriter *io, int quality) const; - // ### Qt5: remove the following three lines - enum Type { PixmapType, BitmapType }; // must match QPixmapData::PixelType - QPixmap(const QSize &s, Type); - void init(int, int, Type = PixmapType); - QPixmap(const QSize &s, int type); - void init(int, int, int); + void doInit(int, int, int); void deref(); -#if defined(Q_WS_WIN) - void initAlphaPixmap(uchar *bytes, int length, struct tagBITMAPINFO *bmi); -#endif Q_DUMMY_COMPARISON_OPERATOR(QPixmap) -#ifdef Q_WS_MAC - friend CGContextRef qt_mac_cg_context(const QPaintDevice*); - friend CGImageRef qt_mac_create_imagemask(const QPixmap&, const QRectF&); - friend IconRef qt_mac_create_iconref(const QPixmap&); - friend quint32 *qt_mac_pixmap_get_base(const QPixmap*); - friend int qt_mac_pixmap_get_bytes_per_line(const QPixmap*); -#endif - friend class QPixmapData; - friend class QX11PixmapData; - friend class QMacPixmapData; - friend class QS60PixmapData; + friend class QPlatformPixmap; friend class QBitmap; friend class QPaintDevice; friend class QPainter; - friend class QGLWidget; - friend class QX11PaintEngine; - friend class QCoreGraphicsPaintEngine; + friend class QOpenGLWidget; friend class QWidgetPrivate; friend class QRasterBuffer; #if !defined(QT_NO_DATASTREAM) friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &); #endif - friend Q_GUI_EXPORT qint64 qt_pixmap_id(const QPixmap &pixmap); public: - QPixmapData* pixmapData() const; + QPlatformPixmap* handle() const; public: - typedef QExplicitlySharedDataPointer DataPtr; + typedef QExplicitlySharedDataPointer DataPtr; inline DataPtr &data_ptr() { return data; } }; @@ -315,6 +215,22 @@ inline bool QPixmap::loadFromData(const QByteArray &buf, const char *format, return loadFromData(reinterpret_cast(buf.constData()), buf.size(), format, flags); } +#if QT_DEPRECATED_SINCE(5, 0) +inline QPixmap QPixmap::alphaChannel() const +{ + return toImage().alphaChannel(); +} + +inline void QPixmap::setAlphaChannel(const QPixmap &p) +{ + detach(); + QImage image = data->toImage(); + image.setAlphaChannel(p.toImage()); + data->fromImage(image); + +} +#endif + /***************************************************************************** QPixmap stream functions *****************************************************************************/ @@ -324,14 +240,6 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPixmap &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &); #endif -/***************************************************************************** - QPixmap (and QImage) helper functions -*****************************************************************************/ -#ifdef QT3_SUPPORT -QT3_SUPPORT Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, const QPixmap *src, - int sx=0, int sy=0, int sw=-1, int sh=-1); -#endif // QT3_SUPPORT - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index f3a43180327..dc0f03abdc4 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -43,9 +43,9 @@ #include #include +#include -#include -#include +#include #include #include @@ -56,8 +56,8 @@ QT_BEGIN_NAMESPACE static int global_ser_no = 0; -QBlittablePixmapData::QBlittablePixmapData() - : QPixmapData(QPixmapData::PixmapType,BlitterClass), m_engine(0), m_blittable(0) +QBlittablePlatformPixmap::QBlittablePlatformPixmap() + : QPlatformPixmap(QPlatformPixmap::PixmapType,BlitterClass), m_engine(0), m_blittable(0) #ifdef QT_BLITTER_RASTEROVERLAY ,m_rasterOverlay(0), m_unmergedCopy(0) #endif //QT_BLITTER_RASTEROVERLAY @@ -65,7 +65,7 @@ QBlittablePixmapData::QBlittablePixmapData() setSerialNumber(++global_ser_no); } -QBlittablePixmapData::~QBlittablePixmapData() +QBlittablePlatformPixmap::~QBlittablePlatformPixmap() { delete m_blittable; delete m_engine; @@ -75,23 +75,23 @@ QBlittablePixmapData::~QBlittablePixmapData() #endif //QT_BLITTER_RASTEROVERLAY } -QBlittable *QBlittablePixmapData::blittable() const +QBlittable *QBlittablePlatformPixmap::blittable() const { if (!m_blittable) { - QBlittablePixmapData *that = const_cast(this); + QBlittablePlatformPixmap *that = const_cast(this); that->m_blittable = this->createBlittable(QSize(w,h)); } return m_blittable; } -void QBlittablePixmapData::setBlittable(QBlittable *blittable) +void QBlittablePlatformPixmap::setBlittable(QBlittable *blittable) { resize(blittable->size().width(),blittable->size().height()); m_blittable = blittable; } -void QBlittablePixmapData::resize(int width, int height) +void QBlittablePlatformPixmap::resize(int width, int height) { delete m_blittable; @@ -99,14 +99,14 @@ void QBlittablePixmapData::resize(int width, int height) delete m_engine; m_engine = 0; #ifdef Q_WS_QPA - d = QApplicationPrivate::platformIntegration()->screens().at(0)->depth(); + d = QGuiApplication::primaryScreen()->depth(); #endif w = width; h = height; is_null = (w <= 0 || h <= 0); } -int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const { switch (metric) { case QPaintDevice::PdmWidth: @@ -126,14 +126,14 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmPhysicalDpiY: return qt_defaultDpiY(); default: - qWarning("QRasterPixmapData::metric(): Unhandled metric type %d", metric); + qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric); break; } return 0; } -void QBlittablePixmapData::fill(const QColor &color) +void QBlittablePlatformPixmap::fill(const QColor &color) { //jlind: todo: change when blittables can support non opaque fillRects if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) { @@ -167,22 +167,22 @@ void QBlittablePixmapData::fill(const QColor &color) } -QImage *QBlittablePixmapData::buffer() +QImage *QBlittablePlatformPixmap::buffer() { return blittable()->lock(); } -QImage QBlittablePixmapData::toImage() const +QImage QBlittablePlatformPixmap::toImage() const { return blittable()->lock()->copy(); } -bool QBlittablePixmapData::hasAlphaChannel() const +bool QBlittablePlatformPixmap::hasAlphaChannel() const { return blittable()->lock()->hasAlphaChannel(); } -void QBlittablePixmapData::fromImage(const QImage &image, +void QBlittablePlatformPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) { resize(image.width(),image.height()); @@ -204,10 +204,10 @@ void QBlittablePixmapData::fromImage(const QImage &image, } } -QPaintEngine *QBlittablePixmapData::paintEngine() const +QPaintEngine *QBlittablePlatformPixmap::paintEngine() const { if (!m_engine) { - QBlittablePixmapData *that = const_cast(this); + QBlittablePlatformPixmap *that = const_cast(this); that->m_engine = new QBlitterPaintEngine(that); } return m_engine; @@ -217,7 +217,7 @@ QPaintEngine *QBlittablePixmapData::paintEngine() const static bool showRasterOverlay = !qgetenv("QT_BLITTER_RASTEROVERLAY").isEmpty(); -void QBlittablePixmapData::mergeOverlay() +void QBlittablePlatformPixmap::mergeOverlay() { if (m_unmergedCopy || !showRasterOverlay) return; @@ -228,7 +228,7 @@ void QBlittablePixmapData::mergeOverlay() p.end(); } -void QBlittablePixmapData::unmergeOverlay() +void QBlittablePlatformPixmap::unmergeOverlay() { if (!m_unmergedCopy || !showRasterOverlay) return; @@ -241,7 +241,7 @@ void QBlittablePixmapData::unmergeOverlay() m_unmergedCopy = 0; } -QImage *QBlittablePixmapData::overlay() +QImage *QBlittablePlatformPixmap::overlay() { if (!m_rasterOverlay|| m_rasterOverlay->size() != QSize(w,h)){ @@ -255,7 +255,7 @@ QImage *QBlittablePixmapData::overlay() return m_rasterOverlay; } -void QBlittablePixmapData::markRasterOverlayImpl(const QRectF &rect) +void QBlittablePlatformPixmap::markRasterOverlayImpl(const QRectF &rect) { if (!showRasterOverlay) return; @@ -268,7 +268,7 @@ void QBlittablePixmapData::markRasterOverlayImpl(const QRectF &rect) } } -void QBlittablePixmapData::unmarkRasterOverlayImpl(const QRectF &rect) +void QBlittablePlatformPixmap::unmarkRasterOverlayImpl(const QRectF &rect) { if (!showRasterOverlay) return; @@ -282,7 +282,7 @@ void QBlittablePixmapData::unmarkRasterOverlayImpl(const QRectF &rect) } } -QRectF QBlittablePixmapData::clipAndTransformRect(const QRectF &rect) const +QRectF QBlittablePlatformPixmap::clipAndTransformRect(const QRectF &rect) const { QRectF transformationRect = rect; paintEngine(); diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 07791e548b9..3ab5cb3da3c 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -42,18 +42,18 @@ #ifndef QPIXMAP_BLITTER_P_H #define QPIXMAP_BLITTER_P_H -#include +#include #include #ifndef QT_NO_BLITTABLE QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QBlittablePixmapData : public QPixmapData +class Q_GUI_EXPORT QBlittablePlatformPixmap : public QPlatformPixmap { -// Q_DECLARE_PRIVATE(QBlittablePixmapData); +// Q_DECLARE_PRIVATE(QBlittablePlatformPixmap); public: - QBlittablePixmapData(); - ~QBlittablePixmapData(); + QBlittablePlatformPixmap(); + ~QBlittablePlatformPixmap(); virtual QBlittable *createBlittable(const QSize &size) const = 0; QBlittable *blittable() const; @@ -98,7 +98,7 @@ protected: }; -inline void QBlittablePixmapData::markRasterOverlay(const QRectF &rect) +inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF &rect) { #ifdef QT_BLITTER_RASTEROVERLAY markRasterOverlayImpl(rect); @@ -107,7 +107,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QRectF &rect) #endif } -inline void QBlittablePixmapData::markRasterOverlay(const QVectorPath &path) +inline void QBlittablePlatformPixmap::markRasterOverlay(const QVectorPath &path) { #ifdef QT_BLITTER_RASTEROVERLAY markRasterOverlayImpl(path.convertToPainterPath().boundingRect()); @@ -116,7 +116,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QVectorPath &path) #endif } -inline void QBlittablePixmapData::markRasterOverlay(const QPointF &pos, const QTextItem &ti) +inline void QBlittablePlatformPixmap::markRasterOverlay(const QPointF &pos, const QTextItem &ti) { #ifdef QT_BLITTER_RASTEROVERLAY QFontMetricsF fm(ti.font()); @@ -129,7 +129,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QPointF &pos, const QT #endif } -inline void QBlittablePixmapData::markRasterOverlay(const QRect *rects, int rectCount) +inline void QBlittablePlatformPixmap::markRasterOverlay(const QRect *rects, int rectCount) { #ifdef QT_BLITTER_RASTEROVERLAY for (int i = 0; i < rectCount; i++) { @@ -140,7 +140,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QRect *rects, int rect Q_UNUSED(rectCount) #endif } -inline void QBlittablePixmapData::markRasterOverlay(const QRectF *rects, int rectCount) +inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF *rects, int rectCount) { #ifdef QT_BLITTER_RASTEROVERLAY for (int i = 0; i < rectCount; i++) { @@ -152,7 +152,7 @@ inline void QBlittablePixmapData::markRasterOverlay(const QRectF *rects, int rec #endif } -inline void QBlittablePixmapData::unmarkRasterOverlay(const QRectF &rect) +inline void QBlittablePlatformPixmap::unmarkRasterOverlay(const QRectF &rect) { #ifdef QT_BLITTER_RASTEROVERLAY unmarkRasterOverlayImpl(rect); diff --git a/src/gui/image/qpixmap_qpa.cpp b/src/gui/image/qpixmap_qpa.cpp index 095dd3ae767..9c69ddef7eb 100644 --- a/src/gui/image/qpixmap_qpa.cpp +++ b/src/gui/image/qpixmap_qpa.cpp @@ -40,10 +40,10 @@ ****************************************************************************/ #include -#include -#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); + return QGuiApplication::primaryScreen()->handle()->grabWindow(window, x, y, w, h); } diff --git a/src/gui/image/qpixmap_qws.cpp b/src/gui/image/qpixmap_qws.cpp deleted file mode 100644 index 804483898cb..00000000000 --- a/src/gui/image/qpixmap_qws.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - - -QT_BEGIN_NAMESPACE - -QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) -{ - QWidget *widget = QWidget::find(window); - if (!widget) - return QPixmap(); - - QRect grabRect = widget->frameGeometry(); - if (!widget->isWindow()) - grabRect.translate(widget->parentWidget()->mapToGlobal(QPoint())); - if (w < 0) - w = widget->width() - x; - if (h < 0) - h = widget->height() - y; - grabRect &= QRect(x, y, w, h).translated(widget->mapToGlobal(QPoint())); - - QScreen *screen = qt_screen; - QDesktopWidget *desktop = QApplication::desktop(); - if (!desktop) - return QPixmap(); - if (desktop->numScreens() > 1) { - const int screenNo = desktop->screenNumber(widget); - if (screenNo != -1) - screen = qt_screen->subScreens().at(screenNo); - grabRect = grabRect.translated(-screen->region().boundingRect().topLeft()); - } - - if (screen->pixelFormat() == QImage::Format_Invalid) { - qWarning("QPixmap::grabWindow(): Unable to copy pixels from framebuffer"); - return QPixmap(); - } - - if (screen->isTransformed()) { - const QSize screenSize(screen->width(), screen->height()); - grabRect = screen->mapToDevice(grabRect, screenSize); - } - - QWSDisplay::grab(false); - QPixmap pixmap; - QImage img(screen->base(), - screen->deviceWidth(), screen->deviceHeight(), - screen->linestep(), screen->pixelFormat()); - img = img.copy(grabRect); - QWSDisplay::ungrab(); - - if (screen->isTransformed()) { - QMatrix matrix; - switch (screen->transformOrientation()) { - case 1: matrix.rotate(90); break; - case 2: matrix.rotate(180); break; - case 3: matrix.rotate(270); break; - default: break; - } - img = img.transformed(matrix); - } - - if (screen->pixelType() == QScreen::BGRPixel) - img = img.rgbSwapped(); - - return QPixmap::fromImage(img); -} - -QRgb* QPixmap::clut() const -{ - if (data && data->classId() == QPixmapData::RasterClass) { - const QRasterPixmapData *d = static_cast(data.data()); - return d->image.colorTable().data(); - } - - return 0; -} - -int QPixmap::numCols() const -{ - return colorCount(); -} - -int QPixmap::colorCount() const -{ - if (data && data->classId() == QPixmapData::RasterClass) { - const QRasterPixmapData *d = static_cast(data.data()); - return d->image.colorCount(); - } - - return 0; -} - -const uchar* QPixmap::qwsBits() const -{ - if (data && data->classId() == QPixmapData::RasterClass) { - const QRasterPixmapData *d = static_cast(data.data()); - return d->image.bits(); - } - - return 0; -} - -int QPixmap::qwsBytesPerLine() const -{ - if (data && data->classId() == QPixmapData::RasterClass) { - const QRasterPixmapData *d = static_cast(data.data()); - return d->image.bytesPerLine(); - } - - return 0; -} - -QT_END_NAMESPACE diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 6355222da16..ce7d66043cc 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -54,20 +54,16 @@ #include #include #include -#include #include QT_BEGIN_NAMESPACE -const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, - 0x10, 0x20, 0x40, 0x80 }; - QPixmap qt_toRasterPixmap(const QImage &image) { - QPixmapData *data = - new QRasterPixmapData(image.depth() == 1 - ? QPixmapData::BitmapType - : QPixmapData::PixmapType); + QPlatformPixmap *data = + new QRasterPlatformPixmap(image.depth() == 1 + ? QPlatformPixmap::BitmapType + : QPlatformPixmap::PixmapType); data->fromImage(image, Qt::AutoColor); @@ -79,27 +75,27 @@ QPixmap qt_toRasterPixmap(const QPixmap &pixmap) if (pixmap.isNull()) return QPixmap(); - if (QPixmap(pixmap).data_ptr()->classId() == QPixmapData::RasterClass) + if (QPixmap(pixmap).data_ptr()->classId() == QPlatformPixmap::RasterClass) return pixmap; return qt_toRasterPixmap(pixmap.toImage()); } -QRasterPixmapData::QRasterPixmapData(PixelType type) - : QPixmapData(type, RasterClass) +QRasterPlatformPixmap::QRasterPlatformPixmap(PixelType type) + : QPlatformPixmap(type, RasterClass) { } -QRasterPixmapData::~QRasterPixmapData() +QRasterPlatformPixmap::~QRasterPlatformPixmap() { } -QPixmapData *QRasterPixmapData::createCompatiblePixmapData() const +QPlatformPixmap *QRasterPlatformPixmap::createCompatiblePlatformPixmap() const { - return new QRasterPixmapData(pixelType()); + return new QRasterPlatformPixmap(pixelType()); } -void QRasterPixmapData::resize(int width, int height) +void QRasterPlatformPixmap::resize(int width, int height) { QImage::Format format; #ifdef Q_WS_QWS @@ -134,7 +130,7 @@ void QRasterPixmapData::resize(int width, int height) setSerialNumber(image.serialNumber()); } -bool QRasterPixmapData::fromData(const uchar *buffer, uint len, const char *format, +bool QRasterPlatformPixmap::fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags) { QByteArray a = QByteArray::fromRawData(reinterpret_cast(buffer), len); @@ -148,7 +144,7 @@ bool QRasterPixmapData::fromData(const uchar *buffer, uint len, const char *form return !isNull(); } -void QRasterPixmapData::fromImage(const QImage &sourceImage, +void QRasterPlatformPixmap::fromImage(const QImage &sourceImage, Qt::ImageConversionFlags flags) { Q_UNUSED(flags); @@ -156,7 +152,7 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, createPixmapForImage(image, flags, /* inplace = */false); } -void QRasterPixmapData::fromImageReader(QImageReader *imageReader, +void QRasterPlatformPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) { Q_UNUSED(flags); @@ -170,19 +166,19 @@ void QRasterPixmapData::fromImageReader(QImageReader *imageReader, // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); -void QRasterPixmapData::copy(const QPixmapData *data, const QRect &rect) +void QRasterPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) { fromImage(data->toImage(rect).copy(), Qt::NoOpaqueDetection); } -bool QRasterPixmapData::scroll(int dx, int dy, const QRect &rect) +bool QRasterPlatformPixmap::scroll(int dx, int dy, const QRect &rect) { if (!image.isNull()) qt_scrollRectInImage(image, rect, QPoint(dx, dy)); return true; } -void QRasterPixmapData::fill(const QColor &color) +void QRasterPlatformPixmap::fill(const QColor &color) { uint pixel; @@ -266,51 +262,12 @@ void QRasterPixmapData::fill(const QColor &color) image.fill(pixel); } -void QRasterPixmapData::setMask(const QBitmap &mask) -{ - if (mask.size().isEmpty()) { - if (image.depth() != 1) { // hw: ???? - image = image.convertToFormat(QImage::Format_RGB32); - } - } else { - const int w = image.width(); - const int h = image.height(); - - switch (image.depth()) { - case 1: { - const QImage imageMask = mask.toImage().convertToFormat(image.format()); - for (int y = 0; y < h; ++y) { - const uchar *mscan = imageMask.scanLine(y); - uchar *tscan = image.scanLine(y); - int bytesPerLine = image.bytesPerLine(); - for (int i = 0; i < bytesPerLine; ++i) - tscan[i] &= mscan[i]; - } - break; - } - default: { - const QImage imageMask = mask.toImage().convertToFormat(QImage::Format_MonoLSB); - image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); - for (int y = 0; y < h; ++y) { - const uchar *mscan = imageMask.scanLine(y); - QRgb *tscan = (QRgb *)image.scanLine(y); - for (int x = 0; x < w; ++x) { - if (!(mscan[x>>3] & qt_pixmap_bit_mask[x&7])) - tscan[x] = 0; - } - } - break; - } - } - } -} - -bool QRasterPixmapData::hasAlphaChannel() const +bool QRasterPlatformPixmap::hasAlphaChannel() const { return image.hasAlphaChannel(); } -QImage QRasterPixmapData::toImage() const +QImage QRasterPlatformPixmap::toImage() const { if (!image.isNull()) { QImageData *data = const_cast(image).data_ptr(); @@ -324,7 +281,7 @@ QImage QRasterPixmapData::toImage() const return image; } -QImage QRasterPixmapData::toImage(const QRect &rect) const +QImage QRasterPlatformPixmap::toImage(const QRect &rect) const { if (rect.isNull()) return image; @@ -338,17 +295,12 @@ QImage QRasterPixmapData::toImage(const QRect &rect) const return image.copy(clipped); } -void QRasterPixmapData::setAlphaChannel(const QPixmap &alphaChannel) -{ - image.setAlphaChannel(alphaChannel.toImage()); -} - -QPaintEngine* QRasterPixmapData::paintEngine() const +QPaintEngine* QRasterPlatformPixmap::paintEngine() const { return image.paintEngine(); } -int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +int QRasterPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const { QImageData *d = image.d; if (!d) @@ -375,14 +327,14 @@ int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmPhysicalDpiY: return qt_defaultDpiY(); default: - qWarning("QRasterPixmapData::metric(): Unhandled metric type %d", metric); + qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric); break; } return 0; } -void QRasterPixmapData::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace) +void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace) { QImage::Format format; if (flags & Qt::NoFormatConversion) @@ -484,7 +436,7 @@ void QRasterPixmapData::createPixmapForImage(QImage &sourceImage, Qt::ImageConve setSerialNumber(image.serialNumber()); } -QImage* QRasterPixmapData::buffer() +QImage* QRasterPlatformPixmap::buffer() { return ℑ } diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index decbd10b5fa..c451a94858b 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -53,8 +53,7 @@ // We mean it. // -#include -#include +#include #ifdef Q_WS_WIN # include "qt_windows.h" @@ -62,13 +61,13 @@ QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QRasterPixmapData : public QPixmapData +class Q_GUI_EXPORT QRasterPlatformPixmap : public QPlatformPixmap { public: - QRasterPixmapData(PixelType type); - ~QRasterPixmapData(); + QRasterPlatformPixmap(PixelType type); + ~QRasterPlatformPixmap(); - QPixmapData *createCompatiblePixmapData() const; + QPlatformPixmap *createCompatiblePlatformPixmap() const; void resize(int width, int height); void fromFile(const QString &filename, Qt::ImageConversionFlags flags); @@ -76,12 +75,10 @@ public: void fromImage(const QImage &image, Qt::ImageConversionFlags flags); void fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags); - void copy(const QPixmapData *data, const QRect &rect); + void copy(const QPlatformPixmap *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); void fill(const QColor &color); - void setMask(const QBitmap &mask); bool hasAlphaChannel() const; - void setAlphaChannel(const QPixmap &alphaChannel); QImage toImage() const; QImage toImage(const QRect &rect) const; QPaintEngine* paintEngine() const; diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h index 336c0f01d4d..7b96f5a2cf4 100644 --- a/src/gui/image/qpixmapcache_p.h +++ b/src/gui/image/qpixmapcache_p.h @@ -81,9 +81,9 @@ class QPixmapCacheEntry : public QPixmap public: QPixmapCacheEntry(const QPixmapCache::Key &key, const QPixmap &pix) : QPixmap(pix), key(key) { - QPixmapData *pd = pixmapData(); - if (pd && pd->classId() == QPixmapData::RasterClass) { - QRasterPixmapData *d = static_cast(pd); + QPlatformPixmap *pd = handle(); + if (pd && pd->classId() == QPlatformPixmap::RasterClass) { + QRasterPlatformPixmap *d = static_cast(pd); if (!d->image.isNull() && d->image.d->paintEngine && !d->image.d->paintEngine->isActive()) { diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp deleted file mode 100644 index c46429cf403..00000000000 --- a/src/gui/image/qpixmapdata.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpixmapdata_p.h" -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, - 0x10, 0x20, 0x40, 0x80 }; - -QPixmapData *QPixmapData::create(int w, int h, PixelType type) -{ - QPixmapData *data; - QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); - if (gs) - data = gs->createPixmapData(static_cast(type)); - else - data = QGraphicsSystem::createDefaultPixmapData(static_cast(type)); - data->resize(w, h); - return data; -} - - -QPixmapData::QPixmapData(PixelType pixelType, int objectId) - : w(0), - h(0), - d(0), - is_null(true), - ref(0), - detach_no(0), - type(pixelType), - id(objectId), - ser_no(0), - is_cached(false) -{ -} - -QPixmapData::~QPixmapData() -{ - // Sometimes the pixmap cleanup hooks will be called from derrived classes, which will - // then set is_cached to false. For example, on X11 QtOpenGL needs to delete the GLXPixmap - // or EGL Pixmap Surface for a given pixmap _before_ the native X11 pixmap is deleted, - // otherwise some drivers will leak the GL surface. In this case, QX11PixmapData will - // call the cleanup hooks itself before deleting the native pixmap and set is_cached to - // false. - if (is_cached) { - QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(this); - is_cached = false; - } -} - -QPixmapData *QPixmapData::createCompatiblePixmapData() const -{ - QPixmapData *d; - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (gs) - d = gs->createPixmapData(pixelType()); - else - d = QGraphicsSystem::createDefaultPixmapData(pixelType()); - return d; -} - -static QImage makeBitmapCompliantIfNeeded(QPixmapData *d, const QImage &image, Qt::ImageConversionFlags flags) -{ - if (d->pixelType() == QPixmapData::BitmapType) { - QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags); - - // make sure image.color(0) == Qt::color0 (white) - // and image.color(1) == Qt::color1 (black) - const QRgb c0 = QColor(Qt::black).rgb(); - const QRgb c1 = QColor(Qt::white).rgb(); - if (img.color(0) == c0 && img.color(1) == c1) { - img.invertPixels(); - img.setColor(0, c1); - img.setColor(1, c0); - } - return img; - } - - return image; -} - -void QPixmapData::fromImageReader(QImageReader *imageReader, - Qt::ImageConversionFlags flags) -{ - const QImage image = imageReader->read(); - fromImage(image, flags); -} - -bool QPixmapData::fromFile(const QString &fileName, const char *format, - Qt::ImageConversionFlags flags) -{ - QImage image = QImageReader(fileName, format).read(); - if (image.isNull()) - return false; - fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); - return !isNull(); -} - -bool QPixmapData::fromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags) -{ - QByteArray a = QByteArray::fromRawData(reinterpret_cast(buf), len); - QBuffer b(&a); - b.open(QIODevice::ReadOnly); - QImage image = QImageReader(&b, format).read(); - fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); - return !isNull(); -} - -void QPixmapData::copy(const QPixmapData *data, const QRect &rect) -{ - fromImage(data->toImage(rect), Qt::NoOpaqueDetection); -} - -bool QPixmapData::scroll(int dx, int dy, const QRect &rect) -{ - Q_UNUSED(dx); - Q_UNUSED(dy); - Q_UNUSED(rect); - return false; -} - -void QPixmapData::setMask(const QBitmap &mask) -{ - if (mask.size().isEmpty()) { - if (depth() != 1) - fromImage(toImage().convertToFormat(QImage::Format_RGB32), - Qt::AutoColor); - } else { - QImage image = toImage(); - const int w = image.width(); - const int h = image.height(); - - switch (image.depth()) { - case 1: { - const QImage imageMask = mask.toImage().convertToFormat(image.format()); - for (int y = 0; y < h; ++y) { - const uchar *mscan = imageMask.scanLine(y); - uchar *tscan = image.scanLine(y); - int bytesPerLine = image.bytesPerLine(); - for (int i = 0; i < bytesPerLine; ++i) - tscan[i] &= mscan[i]; - } - break; - } - default: { - const QImage imageMask = mask.toImage().convertToFormat(QImage::Format_MonoLSB); - image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); - for (int y = 0; y < h; ++y) { - const uchar *mscan = imageMask.scanLine(y); - QRgb *tscan = (QRgb *)image.scanLine(y); - for (int x = 0; x < w; ++x) { - if (!(mscan[x>>3] & qt_pixmap_bit_mask[x&7])) - tscan[x] = 0; - } - } - break; - } - } - fromImage(image, Qt::AutoColor); - } -} - -QBitmap QPixmapData::mask() const -{ - if (!hasAlphaChannel()) - return QBitmap(); - - const QImage img = toImage(); - const QImage image = (img.depth() < 32 ? img.convertToFormat(QImage::Format_ARGB32_Premultiplied) : img); - const int w = image.width(); - const int h = image.height(); - - QImage mask(w, h, QImage::Format_MonoLSB); - if (mask.isNull()) // allocation failed - return QBitmap(); - - mask.setColorCount(2); - mask.setColor(0, QColor(Qt::color0).rgba()); - mask.setColor(1, QColor(Qt::color1).rgba()); - - const int bpl = mask.bytesPerLine(); - - for (int y = 0; y < h; ++y) { - const QRgb *src = reinterpret_cast(image.scanLine(y)); - uchar *dest = mask.scanLine(y); - memset(dest, 0, bpl); - for (int x = 0; x < w; ++x) { - if (qAlpha(*src) > 0) - dest[x >> 3] |= qt_pixmap_bit_mask[x & 7]; - ++src; - } - } - - return QBitmap::fromImage(mask); -} - -QPixmap QPixmapData::transformed(const QTransform &matrix, - Qt::TransformationMode mode) const -{ - return QPixmap::fromImage(toImage().transformed(matrix, mode)); -} - -void QPixmapData::setAlphaChannel(const QPixmap &alphaChannel) -{ - QImage image = toImage(); - image.setAlphaChannel(alphaChannel.toImage()); - fromImage(image, Qt::AutoColor); -} - -QPixmap QPixmapData::alphaChannel() const -{ - return QPixmap::fromImage(toImage().alphaChannel()); -} - -void QPixmapData::setSerialNumber(int serNo) -{ - ser_no = serNo; -} - -QImage QPixmapData::toImage(const QRect &rect) const -{ - if (rect.contains(QRect(0, 0, w, h))) - return toImage(); - else - return toImage().copy(rect); -} - -QImage* QPixmapData::buffer() -{ - return 0; -} - -#if defined(Q_OS_SYMBIAN) -void* QPixmapData::toNativeType(NativeType /* type */) -{ - return 0; -} - -void QPixmapData::fromNativeType(void* /* pixmap */, NativeType /* typre */) -{ - return; -} -#endif - -QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp deleted file mode 100644 index f7c79880caa..00000000000 --- a/src/gui/image/qpixmapdatafactory.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpixmapdatafactory_p.h" - -#ifdef Q_WS_QWS -# include -#endif -#ifdef Q_WS_X11 -# include -#endif -#if defined(Q_WS_WIN) -# include -#endif -#ifdef Q_WS_MAC -# include -#endif -#ifdef Q_WS_QPA -# include -#endif -#ifdef Q_OS_SYMBIAN -# include -#endif - -#include "private/qapplication_p.h" -#include "private/qgraphicssystem_p.h" - -QT_BEGIN_NAMESPACE - -#if !defined(Q_WS_QWS) - -class QSimplePixmapDataFactory : public QPixmapDataFactory -{ -public: - ~QSimplePixmapDataFactory() {} - QPixmapData* create(QPixmapData::PixelType type); -}; - -QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type) -{ - if (QApplicationPrivate::graphicsSystem()) - return QApplicationPrivate::graphicsSystem()->createPixmapData(type); - -#if defined(Q_WS_X11) - return new QX11PixmapData(type); -#elif defined(Q_WS_WIN) - return new QRasterPixmapData(type); -#elif defined(Q_WS_MAC) - return new QMacPixmapData(type); -#elif defined(Q_WS_QPA) - return new QRasterPixmapData(type); -#elif defined(Q_OS_SYMBIAN) - return new QS60PixmapData(type); -#else -#error QSimplePixmapDataFactory::create() not implemented -#endif -} - -Q_GLOBAL_STATIC(QSimplePixmapDataFactory, factory) - -#endif // !defined(Q_WS_QWS) - -QPixmapDataFactory::~QPixmapDataFactory() -{ -} - -QPixmapDataFactory* QPixmapDataFactory::instance(int screen) -{ - Q_UNUSED(screen); -#ifdef Q_WS_QWS - return QScreen::instance()->pixmapDataFactory(); -#else - return factory(); -#endif -} - -QT_END_NAMESPACE diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp new file mode 100644 index 00000000000..a214f397ed7 --- /dev/null +++ b/src/gui/image/qplatformpixmap.cpp @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformpixmap_qpa.h" +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QPlatformPixmap *QPlatformPixmap::create(int w, int h, PixelType type) +{ + QPlatformPixmap *data = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(static_cast(type)); + data->resize(w, h); + return data; +} + + +QPlatformPixmap::QPlatformPixmap(PixelType pixelType, int objectId) + : w(0), + h(0), + d(0), + is_null(true), + ref(0), + detach_no(0), + type(pixelType), + id(objectId), + ser_no(0), + is_cached(false) +{ +} + +QPlatformPixmap::~QPlatformPixmap() +{ + // Sometimes the pixmap cleanup hooks will be called from derrived classes, which will + // then set is_cached to false. For example, on X11 QtGui needs to delete the GLXPixmap + // or EGL Pixmap Surface for a given pixmap _before_ the native X11 pixmap is deleted, + // otherwise some drivers will leak the GL surface. In this case, QX11PlatformPixmap will + // call the cleanup hooks itself before deleting the native pixmap and set is_cached to + // false. + if (is_cached) { + QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(this); + is_cached = false; + } +} + +QPlatformPixmap *QPlatformPixmap::createCompatiblePlatformPixmap() const +{ + QPlatformPixmap *d = QGuiApplicationPrivate::platformIntegration()->createPlatformPixmap(pixelType()); + return d; +} + +static QImage makeBitmapCompliantIfNeeded(QPlatformPixmap *d, const QImage &image, Qt::ImageConversionFlags flags) +{ + if (d->pixelType() == QPlatformPixmap::BitmapType) { + QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags); + + // make sure image.color(0) == Qt::color0 (white) + // and image.color(1) == Qt::color1 (black) + const QRgb c0 = QColor(Qt::black).rgb(); + const QRgb c1 = QColor(Qt::white).rgb(); + if (img.color(0) == c0 && img.color(1) == c1) { + img.invertPixels(); + img.setColor(0, c1); + img.setColor(1, c0); + } + return img; + } + + return image; +} + +void QPlatformPixmap::fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags) +{ + const QImage image = imageReader->read(); + fromImage(image, flags); +} + +bool QPlatformPixmap::fromFile(const QString &fileName, const char *format, + Qt::ImageConversionFlags flags) +{ + QImage image = QImageReader(fileName, format).read(); + if (image.isNull()) + return false; + fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); + return !isNull(); +} + +bool QPlatformPixmap::fromData(const uchar *buf, uint len, const char *format, Qt::ImageConversionFlags flags) +{ + QByteArray a = QByteArray::fromRawData(reinterpret_cast(buf), len); + QBuffer b(&a); + b.open(QIODevice::ReadOnly); + QImage image = QImageReader(&b, format).read(); + fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); + return !isNull(); +} + +void QPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) +{ + fromImage(data->toImage(rect), Qt::NoOpaqueDetection); +} + +bool QPlatformPixmap::scroll(int dx, int dy, const QRect &rect) +{ + Q_UNUSED(dx); + Q_UNUSED(dy); + Q_UNUSED(rect); + return false; +} + +QPixmap QPlatformPixmap::transformed(const QTransform &matrix, + Qt::TransformationMode mode) const +{ + return QPixmap::fromImage(toImage().transformed(matrix, mode)); +} + +void QPlatformPixmap::setSerialNumber(int serNo) +{ + ser_no = serNo; +} + +QImage QPlatformPixmap::toImage(const QRect &rect) const +{ + if (rect.contains(QRect(0, 0, w, h))) + return toImage(); + else + return toImage().copy(rect); +} + +QImage* QPlatformPixmap::buffer() +{ + return 0; +} + +#if defined(Q_OS_SYMBIAN) +void* QPlatformPixmap::toNativeType(NativeType /* type */) +{ + return 0; +} + +void QPlatformPixmap::fromNativeType(void* /* pixmap */, NativeType /* typre */) +{ + return; +} +#endif + +QT_END_NAMESPACE diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qplatformpixmap_qpa.h similarity index 78% rename from src/gui/image/qpixmapdata_p.h rename to src/gui/image/qplatformpixmap_qpa.h index 5b75aa102b3..d528f4138f0 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qplatformpixmap_qpa.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE class QImageReader; -class Q_GUI_EXPORT QPixmapData +class Q_GUI_EXPORT QPlatformPixmap { public: enum PixelType { @@ -68,22 +68,14 @@ public: // Must match QPixmap::Type PixmapType, BitmapType }; -#if defined(Q_OS_SYMBIAN) - enum NativeType { - FbsBitmap, - SgImage, - VolatileImage, - NativeImageHandleProvider - }; -#endif - enum ClassId { RasterClass, X11Class, MacClass, DirectFBClass, - OpenGLClass, OpenVGClass, RuntimeClass, BlitterClass, - CustomClass = 1024 }; - QPixmapData(PixelType pixelType, int classId); - virtual ~QPixmapData(); + enum ClassId { RasterClass, DirectFBClass, + BlitterClass, CustomClass = 1024 }; - virtual QPixmapData *createCompatiblePixmapData() const; + QPlatformPixmap(PixelType pixelType, int classId); + virtual ~QPlatformPixmap(); + + virtual QPlatformPixmap *createCompatiblePlatformPixmap() const; virtual void resize(int width, int height) = 0; virtual void fromImage(const QImage &image, @@ -96,18 +88,16 @@ public: virtual bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags); - virtual void copy(const QPixmapData *data, const QRect &rect); + virtual void copy(const QPlatformPixmap *data, const QRect &rect); virtual bool scroll(int dx, int dy, const QRect &rect); virtual int metric(QPaintDevice::PaintDeviceMetric metric) const = 0; virtual void fill(const QColor &color) = 0; - virtual QBitmap mask() const; - virtual void setMask(const QBitmap &mask); + virtual bool hasAlphaChannel() const = 0; virtual QPixmap transformed(const QTransform &matrix, Qt::TransformationMode mode) const; - virtual void setAlphaChannel(const QPixmap &alphaChannel); - virtual QPixmap alphaChannel() const; + virtual QImage toImage() const = 0; virtual QImage toImage(const QRect &rect) const; virtual QPaintEngine* paintEngine() const = 0; @@ -121,7 +111,6 @@ public: inline int width() const { return w; } inline int height() const { return h; } - QT_DEPRECATED inline int numColors() const { return metric(QPaintDevice::PdmNumColors); } inline int colorCount() const { return metric(QPaintDevice::PdmNumColors); } inline int depth() const { return d; } inline bool isNull() const { return is_null; } @@ -134,14 +123,7 @@ public: | ((qint64) detach_no)); } -#if defined(Q_OS_SYMBIAN) - virtual void* toNativeType(NativeType type); - virtual void fromNativeType(void* pixmap, NativeType type); -#endif - - static QPixmapData *create(int w, int h, PixelType type); - - virtual QPixmapData *runtimeData() const { return 0; } + static QPlatformPixmap *create(int w, int h, PixelType type); protected: @@ -153,11 +135,9 @@ protected: private: friend class QPixmap; - friend class QX11PixmapData; - friend class QS60PixmapData; friend class QImagePixmapCleanupHooks; // Needs to set is_cached - friend class QGLTextureCache; //Needs to check the reference count - friend class QExplicitlySharedDataPointer; + friend class QOpenGLTextureCache; //Needs to check the reference count + friend class QExplicitlySharedDataPointer; QAtomicInt ref; int detach_no; diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp index aa3759a9ec6..f7fe70c496d 100644 --- a/src/gui/image/qvolatileimage.cpp +++ b/src/gui/image/qvolatileimage.cpp @@ -42,7 +42,7 @@ #include "qvolatileimage_p.h" #include "qvolatileimagedata_p.h" #include -#include +#include QT_BEGIN_NAMESPACE @@ -200,15 +200,6 @@ void *QVolatileImage::duplicateNativeImage() const return d->duplicateNativeImage(); } -void QVolatileImage::setAlphaChannel(const QPixmap &alphaChannel) -{ - ensureFormat(QImage::Format_ARGB32_Premultiplied); - beginDataAccess(); - imageRef().setAlphaChannel(alphaChannel.toImage()); - endDataAccess(); - d->ensureImage(); -} - void QVolatileImage::fill(uint pixelValue) { beginDataAccess(); @@ -245,7 +236,7 @@ void QVolatileImage::copyFrom(QVolatileImage *source, const QRect &rect) } /*! - To be called from the PixmapData's paintEngine(). + To be called from the PlatformPixmap's paintEngine(). */ QPaintEngine *QVolatileImage::paintEngine() { @@ -284,7 +275,7 @@ bool QVolatileImagePaintEngine::end() void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) { #ifdef Q_OS_SYMBIAN - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); + void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage); if (nativeData) { QVolatileImage *img = static_cast(nativeData); img->beginDataAccess(); @@ -301,7 +292,7 @@ void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) void QVolatileImagePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { #ifdef Q_OS_SYMBIAN - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); + void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage); if (nativeData) { QVolatileImage *img = static_cast(nativeData); img->beginDataAccess(); diff --git a/src/gui/image/qvolatileimage_p.h b/src/gui/image/qvolatileimage_p.h index 911b61224d9..91f8ce35989 100644 --- a/src/gui/image/qvolatileimage_p.h +++ b/src/gui/image/qvolatileimage_p.h @@ -87,7 +87,6 @@ public: QImage toImage() const; QImage &imageRef(); QPaintEngine *paintEngine(); - void setAlphaChannel(const QPixmap &alphaChannel); void fill(uint pixelValue); void *duplicateNativeImage() const; void copyFrom(QVolatileImage *source, const QRect &rect); diff --git a/src/gui/inputmethod/inputmethod.pri b/src/gui/inputmethod/inputmethod.pri deleted file mode 100644 index d4394380dca..00000000000 --- a/src/gui/inputmethod/inputmethod.pri +++ /dev/null @@ -1,31 +0,0 @@ -# Qt inputmethod module - -HEADERS +=inputmethod/qinputcontextfactory.h \ - inputmethod/qinputcontextplugin.h \ - inputmethod/qinputcontext_p.h \ - inputmethod/qinputcontext.h -SOURCES +=inputmethod/qinputcontextfactory.cpp \ - inputmethod/qinputcontextplugin.cpp \ - inputmethod/qinputcontext.cpp -x11 { - HEADERS += inputmethod/qximinputcontext_p.h - SOURCES += inputmethod/qximinputcontext_x11.cpp -} -win32 { - HEADERS += inputmethod/qwininputcontext_p.h - SOURCES += inputmethod/qwininputcontext_win.cpp -} -embedded { - HEADERS += inputmethod/qwsinputcontext_p.h - SOURCES += inputmethod/qwsinputcontext_qws.cpp -} -mac:!embedded:!qpa { - HEADERS += inputmethod/qmacinputcontext_p.h - SOURCES += inputmethod/qmacinputcontext_mac.cpp -} -symbian:contains(QT_CONFIG, s60) { - HEADERS += inputmethod/qcoefepinputcontext_p.h - SOURCES += inputmethod/qcoefepinputcontext_s60.cpp - LIBS += -lfepbase -lakninputlanguage -} - diff --git a/src/gui/inputmethod/qinputcontext_p.h b/src/gui/inputmethod/qinputcontext_p.h deleted file mode 100644 index 9251700565f..00000000000 --- a/src/gui/inputmethod/qinputcontext_p.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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. -// - -/**************************************************************************** -** -** Implementation of QInputContext class -** -** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. -** -** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** license. You may use this file under your Qt license. Following -** description is copied from their original file headers. Contact -** immodule-qt@freedesktop.org if any conditions of this licensing are -** not clear to you. -** -****************************************************************************/ - -#ifndef QINPUTCONTEXT_P_H -#define QINPUTCONTEXT_P_H - -#include "private/qobject_p.h" -#include "qwidget.h" -#include "qinputcontext.h" - -#ifndef QT_NO_IM - -QT_BEGIN_NAMESPACE - -class QInputContextPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QInputContext) -public: - QInputContextPrivate() - : focusWidget(0) - {} - - QWidget *focusWidget; -}; - -QT_END_NAMESPACE - -#endif - -#endif - diff --git a/src/gui/inputmethod/qinputcontextfactory.cpp b/src/gui/inputmethod/qinputcontextfactory.cpp deleted file mode 100644 index d85b6556504..00000000000 --- a/src/gui/inputmethod/qinputcontextfactory.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/**************************************************************************** -** -** Implementation of QInputContextFactory class -** -** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. -** -** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** license. You may use this file under your Qt license. Following -** description is copied from their original file headers. Contact -** immodule-qt@freedesktop.org if any conditions of this licensing are -** not clear to you. -** -****************************************************************************/ - -#include "qinputcontextfactory.h" - -#ifndef QT_NO_IM - -#include "qcoreapplication.h" -#include "qinputcontext.h" -#include "qinputcontextplugin.h" - -#ifdef Q_WS_X11 -#include "private/qt_x11_p.h" -#include "qximinputcontext_p.h" -#endif -#ifdef Q_WS_WIN -#include "qwininputcontext_p.h" -#endif -#ifdef Q_WS_MAC -#include "qmacinputcontext_p.h" -#endif -#ifdef Q_WS_S60 -#include "qcoefepinputcontext_p.h" -#include "AknInputLanguageInfo.h" -#endif - -#include "private/qfactoryloader_p.h" -#include "qmutex.h" - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_LIBRARY -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QInputContextFactoryInterface_iid, QLatin1String("/inputmethods"))) -#endif - -/*! - \class QInputContextFactory - \brief The QInputContextFactory class creates QInputContext objects. - - - The input context factory creates a QInputContext object for a - given key with QInputContextFactory::create(). - - The input contexts are either built-in or dynamically loaded from - an input context plugin (see QInputContextPlugin). - - keys() returns a list of valid keys. The - keys are the names used, for example, to identify and specify - input methods for the input method switching mechanism. The names - have to be consistent with QInputContext::identifierName(), and - may only contain ASCII characters. - - A key can be used to retrieve the associated input context's - supported languages using languages(). You - can retrieve the input context's description using - description() and finally you can get a user - friendly internationalized name of the QInputContext object - specified by the key using displayName(). - - \legalese - Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. - - This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own - license. You may use this file under your Qt license. Following - description is copied from their original file headers. Contact - immodule-qt@freedesktop.org if any conditions of this licensing are - not clear to you. - \endlegalese - - \sa QInputContext, QInputContextPlugin -*/ - -/*! - Creates and returns a QInputContext object for the input context - specified by \a key with the given \a parent. Keys are case - sensitive. - - \sa keys() -*/ -QInputContext *QInputContextFactory::create( const QString& key, QObject *parent ) -{ - QInputContext *result = 0; -#if defined(Q_WS_X11) && !defined(QT_NO_XIM) - if (key == QLatin1String("xim")) { - result = new QXIMInputContext; - } -#endif -#if defined(Q_WS_WIN) - if (key == QLatin1String("win")) { - result = new QWinInputContext; - } -#endif -#if defined(Q_WS_MAC) - if (key == QLatin1String("mac")) { - result = new QMacInputContext; - } -#endif -#if defined(Q_WS_S60) - if (key == QLatin1String("coefep")) { - result = new QCoeFepInputContext; - } -#endif -#ifdef QT_NO_LIBRARY - Q_UNUSED(key); -#else - if (QInputContextFactoryInterface *factory = - qobject_cast(loader()->instance(key))) { - result = factory->create(key); - } -#endif - if (result) - result->setParent(parent); - return result; -} - - -/*! - Returns the list of keys this factory can create input contexts - for. - - The keys are the names used, for example, to identify and specify - input methods for the input method switching mechanism. The names - have to be consistent with QInputContext::identifierName(), and - may only contain ASCII characters. - - \sa create(), displayName(), QInputContext::identifierName() -*/ -QStringList QInputContextFactory::keys() -{ - QStringList result; -#if defined(Q_WS_X11) && !defined(QT_NO_XIM) - result << QLatin1String("xim"); -#endif -#if defined(Q_WS_WIN) && !defined(QT_NO_XIM) - result << QLatin1String("win"); -#endif -#if defined(Q_WS_MAC) - result << QLatin1String("mac"); -#endif -#if defined(Q_WS_S60) - result << QLatin1String("coefep"); -#endif -#ifndef QT_NO_LIBRARY - result += loader()->keys(); -#endif // QT_NO_LIBRARY - return result; -} - -#if defined(Q_WS_S60) -/*! - \internal - - This function contains pure Symbian exception handling code for - getting S60 language list. - Returned object ownership is transferred to caller. -*/ -static CAknInputLanguageList* s60LangListL() -{ - CAknInputLanguageInfo *langInfo = AknInputLanguageInfoFactory::CreateInputLanguageInfoL(); - CleanupStack::PushL(langInfo); - // In rare phone there is more than 7 languages installed -> use 7 as an array granularity - CAknInputLanguageList *langList = new (ELeave) CAknInputLanguageList(7); - CleanupStack::PushL(langList); - langInfo->AppendAvailableLanguagesL(langList); - CleanupStack::Pop(langList); - CleanupStack::PopAndDestroy(langInfo); - return langList; -} - -/*! - \internal - - This function utility function return S60 language list. - Returned object ownership is transferred to caller. -*/ -static CAknInputLanguageList* s60LangList() -{ - CAknInputLanguageList *langList = NULL; - TRAP_IGNORE(langList = s60LangListL()); - q_check_ptr(langList); - return langList; -} -#endif - -/*! - Returns the languages supported by the QInputContext object - specified by \a key. - - The languages are expressed as language code (e.g. "zh_CN", - "zh_TW", "zh_HK", "ja", "ko", ...). An input context that supports - multiple languages can return all supported languages as a - QStringList. The name has to be consistent with - QInputContext::language(). - - This information may be used to optimize a user interface. - - \sa keys(), QInputContext::language(), QLocale -*/ -QStringList QInputContextFactory::languages( const QString &key ) -{ - QStringList result; -#if defined(Q_WS_X11) && !defined(QT_NO_XIM) - if (key == QLatin1String("xim")) - return QStringList(QString()); -#endif -#if defined(Q_WS_WIN) - if (key == QLatin1String("win")) - return QStringList(QString()); -#endif -#if defined(Q_WS_MAC) - if (key == QLatin1String("mac")) - return QStringList(QString()); -#endif -#if defined(Q_WS_S60) - if (key == QLatin1String("coefep")) - { - CAknInputLanguageList *langList = s60LangList(); - int count = langList->Count(); - for (int i = 0; i < count; ++i) - { - result.append(QString(qt_symbianLocaleName(langList->At(i)->LanguageCode()))); - } - delete langList; - } -#endif -#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS) - Q_UNUSED(key); -#else - if (QInputContextFactoryInterface *factory = - qobject_cast(loader()->instance(key))) - result = factory->languages(key); -#endif // QT_NO_LIBRARY - return result; -} - -/*! - Returns a user friendly internationalized name of the - QInputContext object specified by \a key. You can, for example, - use this name in a menu. - - \sa keys(), QInputContext::identifierName() -*/ -QString QInputContextFactory::displayName( const QString &key ) -{ - QString result; -#if defined(Q_WS_X11) && !defined(QT_NO_XIM) - if (key == QLatin1String("xim")) - return QInputContext::tr( "XIM" ); -#endif -#ifdef Q_WS_S60 - if (key == QLatin1String("coefep")) - return QInputContext::tr( "FEP" ); -#endif -#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS) - Q_UNUSED(key); -#else - if (QInputContextFactoryInterface *factory = - qobject_cast(loader()->instance(key))) - return factory->displayName(key); -#endif // QT_NO_LIBRARY - return QString(); -} - -/*! - Returns an internationalized brief description of the QInputContext - object specified by \a key. You can, for example, use this - description in a user interface. - - \sa keys(), displayName() -*/ -QString QInputContextFactory::description( const QString &key ) -{ -#if defined(Q_WS_X11) && !defined(QT_NO_XIM) - if (key == QLatin1String("xim")) - return QInputContext::tr( "XIM input method" ); -#endif -#if defined(Q_WS_WIN) && !defined(QT_NO_XIM) - if (key == QLatin1String("win")) - return QInputContext::tr( "Windows input method" ); -#endif -#if defined(Q_WS_MAC) - if (key == QLatin1String("mac")) - return QInputContext::tr( "Mac OS X input method" ); -#endif -#if defined(Q_WS_S60) - if (key == QLatin1String("coefep")) - return QInputContext::tr( "S60 FEP input method" ); -#endif -#if defined(QT_NO_LIBRARY) || defined(QT_NO_SETTINGS) - Q_UNUSED(key); -#else - if (QInputContextFactoryInterface *factory = - qobject_cast(loader()->instance(key))) - return factory->description(key); -#endif // QT_NO_LIBRARY - return QString(); -} - -QT_END_NAMESPACE - -#endif // QT_NO_IM diff --git a/src/gui/inputmethod/qinputcontextfactory.h b/src/gui/inputmethod/qinputcontextfactory.h deleted file mode 100644 index e7513a13bc0..00000000000 --- a/src/gui/inputmethod/qinputcontextfactory.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/**************************************************************************** -** -** Definition of QInputContextFactory class -** -** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. -** -** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** license. You may use this file under your Qt license. Following -** description is copied from their original file headers. Contact -** immodule-qt@freedesktop.org if any conditions of this licensing are -** not clear to you. -** -****************************************************************************/ - -#ifndef QINPUTCONTEXTFACTORY_H -#define QINPUTCONTEXTFACTORY_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_IM - -class QInputContext; -class QWidget; - -class Q_GUI_EXPORT QInputContextFactory -{ -public: - static QStringList keys(); - static QInputContext *create( const QString &key, QObject *parent ); // should be a toplevel widget - static QStringList languages( const QString &key ); - static QString displayName( const QString &key ); - static QString description( const QString &key ); -}; - -#endif // QT_NO_IM - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QINPUTCONTEXTFACTORY_H diff --git a/src/gui/inputmethod/qinputcontextplugin.cpp b/src/gui/inputmethod/qinputcontextplugin.cpp deleted file mode 100644 index 5921b936abe..00000000000 --- a/src/gui/inputmethod/qinputcontextplugin.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/**************************************************************************** -** -** Implementation of QInputContext class -** -** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. -** -** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** license. You may use this file under your Qt license. Following -** description is copied from their original file headers. Contact -** immodule-qt@freedesktop.org if any conditions of this licensing are -** not clear to you. -** -****************************************************************************/ - -#include "qinputcontextplugin.h" - -#ifndef QT_NO_IM -#ifndef QT_NO_LIBRARY - -QT_BEGIN_NAMESPACE - -/*! - \class QInputContextPlugin - \brief The QInputContextPlugin class provides an abstract base for custom QInputContext plugins. - - \reentrant - \ingroup plugins - - The input context plugin is a simple plugin interface that makes it - easy to create custom input contexts that can be loaded dynamically - into applications. - - To create an input context plugin you subclass this base class, - reimplement the pure virtual functions keys(), create(), - languages(), displayName(), and description(), and export the - class with the Q_EXPORT_PLUGIN2() macro. - - \legalese - Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. - - This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own - license. You may use this file under your Qt license. Following - description is copied from their original file headers. Contact - immodule-qt@freedesktop.org if any conditions of this licensing are - not clear to you. - \endlegalese - - \sa QInputContext, {How to Create Qt Plugins} -*/ - -/*! - \fn QStringList QInputContextPlugin::keys() const - - Returns the list of QInputContext keys this plugin provides. - - These keys are usually the class names of the custom input context - that are implemented in the plugin. The names are used, for - example, to identify and specify input methods for the input - method switching mechanism. They have to be consistent with - QInputContext::identifierName(), and may only contain ASCII - characters. - - \sa create(), displayName(), QInputContext::identifierName() -*/ - -/*! - \fn QInputContext* QInputContextPlugin::create( const QString& key ) - - Creates and returns a QInputContext object for the input context - key \a key. The input context key is usually the class name of - the required input method. - - \sa keys() -*/ - -/*! - \fn QStringList QInputContextPlugin::languages(const QString &key) - - Returns the languages supported by the QInputContext object - specified by \a key. - - The languages are expressed as language code (e.g. "zh_CN", - "zh_TW", "zh_HK", "ja", "ko", ...). An input context that supports - multiple languages can return all supported languages as - QStringList. The name has to be consistent with - QInputContext::language(). - - This information may be used to optimize user interface. - - \sa keys(), QInputContext::language(), QLocale -*/ - -/*! - \fn QString QInputContextPlugin::displayName(const QString &key) - - Returns a user friendly internationalized name of the - QInputContext object specified by \a key. You can, for example, - use this name in a menu. - - \sa keys(), QInputContext::identifierName() -*/ - -/*! - \fn QString QInputContextPlugin::description(const QString &key) - - Returns an internationalized brief description of the QInputContext - object specified by \a key. You can, for example, use this - description in a user interface. - - \sa keys(), displayName() -*/ - - -/*! - Constructs a input context plugin with the given \a parent. This - is invoked automatically by the Q_EXPORT_PLUGIN2() macro. -*/ -QInputContextPlugin::QInputContextPlugin(QObject *parent) - :QObject(parent) -{ -} - -/*! - Destroys the input context plugin. - - You never have to call this explicitly. Qt destroys a plugin - automatically when it's no longer used. -*/ -QInputContextPlugin::~QInputContextPlugin() -{ -} - -QT_END_NAMESPACE - -#endif // QT_NO_LIBRARY - -#endif // QT_NO_IM diff --git a/src/gui/inputmethod/qinputcontextplugin.h b/src/gui/inputmethod/qinputcontextplugin.h deleted file mode 100644 index 0bcb7453de7..00000000000 --- a/src/gui/inputmethod/qinputcontextplugin.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/**************************************************************************** -** -** Definition of QInputContextPlugin class -** -** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved. -** -** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** license. You may use this file under your Qt license. Following -** description is copied from their original file headers. Contact -** immodule-qt@freedesktop.org if any conditions of this licensing are -** not clear to you. -** -****************************************************************************/ - -#ifndef QINPUTCONTEXTPLUGIN_H -#define QINPUTCONTEXTPLUGIN_H - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if !defined(QT_NO_IM) - -class QInputContext; -class QInputContextPluginPrivate; - -struct Q_GUI_EXPORT QInputContextFactoryInterface : public QFactoryInterface -{ - virtual QInputContext *create( const QString &key ) = 0; - virtual QStringList languages( const QString &key ) = 0; - virtual QString displayName( const QString &key ) = 0; - virtual QString description( const QString &key ) = 0; -}; - -#define QInputContextFactoryInterface_iid "com.trolltech.Qt.QInputContextFactoryInterface" -Q_DECLARE_INTERFACE(QInputContextFactoryInterface, QInputContextFactoryInterface_iid) - -class Q_GUI_EXPORT QInputContextPlugin : public QObject, public QInputContextFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(QInputContextFactoryInterface:QFactoryInterface) -public: - explicit QInputContextPlugin(QObject *parent = 0); - ~QInputContextPlugin(); - - virtual QStringList keys() const = 0; - virtual QInputContext *create( const QString &key ) = 0; - virtual QStringList languages( const QString &key ) = 0; - virtual QString displayName( const QString &key ) = 0; - virtual QString description( const QString &key ) = 0; -}; - -#endif // QT_NO_IM - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QINPUTCONTEXTPLUGIN_H diff --git a/src/gui/inputmethod/qwsinputcontext_p.h b/src/gui/inputmethod/qwsinputcontext_p.h deleted file mode 100644 index bf69fe178b1..00000000000 --- a/src/gui/inputmethod/qwsinputcontext_p.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSINPUTCONTEXT_P_H -#define QWSINPUTCONTEXT_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 "QtGui/qinputcontext.h" - -#ifndef QT_NO_QWS_INPUTMETHODS - -QT_BEGIN_NAMESPACE - -class QWSIMEvent; -class QWSIMQueryEvent; -class QWSIMInitEvent; - -class QWSInputContext : public QInputContext -{ - Q_OBJECT -public: - explicit QWSInputContext(QObject* parent = 0); - ~QWSInputContext() {} - - - QString identifierName() { return QString(); } - QString language() { return QString(); } - - void reset(); - void update(); - void mouseHandler( int x, QMouseEvent *event); - - void setFocusWidget( QWidget *w ); - void widgetDestroyed(QWidget *w); - - bool isComposing() const; - - static QWidget *activeWidget(); - static bool translateIMEvent(QWidget *w, const QWSIMEvent *e); - static bool translateIMQueryEvent(QWidget *w, const QWSIMQueryEvent *e); - static bool translateIMInitEvent(const QWSIMInitEvent *e); - static void updateImeStatus(QWidget *w, bool hasFocus); -}; - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_INPUTMETHODS - -#endif // QWSINPUTCONTEXT_P_H diff --git a/src/gui/inputmethod/qwsinputcontext_qws.cpp b/src/gui/inputmethod/qwsinputcontext_qws.cpp deleted file mode 100644 index 30fefc365e3..00000000000 --- a/src/gui/inputmethod/qwsinputcontext_qws.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwsinputcontext_p.h" -#include "qinputcontext_p.h" -#include "qwsdisplay_qws.h" -#include "qwsevent_qws.h" -#include "private/qwscommand_qws_p.h" -#include "qwindowsystem_qws.h" -#include "qevent.h" -#include "qtextformat.h" - -#include - -#include - -#ifndef QT_NO_QWS_INPUTMETHODS - -QT_BEGIN_NAMESPACE - -static QWidget* activeWidget = 0; - -//#define EXTRA_DEBUG - -QWSInputContext::QWSInputContext(QObject *parent) - :QInputContext(parent) -{ -} - -void QWSInputContext::reset() -{ - QPaintDevice::qwsDisplay()->resetIM(); -} - - -void QWSInputContext::setFocusWidget( QWidget *w ) -{ - QWidget *oldFocus = focusWidget(); - if (oldFocus == w) - return; - - if (w) { - QWSInputContext::updateImeStatus(w, true); - } else { - if (oldFocus) - QWSInputContext::updateImeStatus(oldFocus, false); - } - - if (oldFocus) { - QWidget *tlw = oldFocus->window(); - int winid = tlw->internalWinId(); - - int widgetid = oldFocus->internalWinId(); - QPaintDevice::qwsDisplay()->sendIMUpdate(QWSInputMethod::FocusOut, winid, widgetid); - } - - QInputContext::setFocusWidget(w); - - if (!w) - return; - - QWidget *tlw = w->window(); - int winid = tlw->winId(); - - int widgetid = w->winId(); - QPaintDevice::qwsDisplay()->sendIMUpdate(QWSInputMethod::FocusIn, winid, widgetid); - - //setfocus ??? - - update(); -} - - -void QWSInputContext::widgetDestroyed(QWidget *w) -{ - if (w == QT_PREPEND_NAMESPACE(activeWidget)) - QT_PREPEND_NAMESPACE(activeWidget) = 0; - QInputContext::widgetDestroyed(w); -} - -void QWSInputContext::update() -{ - QWidget *w = focusWidget(); - if (!w) - return; - - QWidget *tlw = w->window(); - int winid = tlw->winId(); - - int widgetid = w->winId(); - QPaintDevice::qwsDisplay()->sendIMUpdate(QWSInputMethod::Update, winid, widgetid); - -} - -void QWSInputContext::mouseHandler( int x, QMouseEvent *event) -{ - if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease) - QPaintDevice::qwsDisplay()->sendIMMouseEvent( x, event->type() == QEvent::MouseButtonPress ); -} - -QWidget *QWSInputContext::activeWidget() -{ - return QT_PREPEND_NAMESPACE(activeWidget); -} - - -bool QWSInputContext::isComposing() const -{ - return QT_PREPEND_NAMESPACE(activeWidget) != 0; -} - -bool QWSInputContext::translateIMQueryEvent(QWidget *w, const QWSIMQueryEvent *e) -{ - Qt::InputMethodQuery type = static_cast(e->simpleData.property); - QVariant result = w->inputMethodQuery(type); - QWidget *tlw = w->window(); - int winId = tlw->winId(); - - if ( type == Qt::ImMicroFocus ) { - // translate to relative to tlw - QRect mf = result.toRect(); - mf.moveTopLeft(w->mapTo(tlw,mf.topLeft())); - result = mf; - } - - QPaintDevice::qwsDisplay()->sendIMResponse(winId, e->simpleData.property, result); - - return false; -} - -bool QWSInputContext::translateIMInitEvent(const QWSIMInitEvent *e) -{ - Q_UNUSED(e); - qDebug("### QWSInputContext::translateIMInitEvent not implemented ###"); - return false; -} - -bool QWSInputContext::translateIMEvent(QWidget *w, const QWSIMEvent *e) -{ - QDataStream stream(e->streamingData); - QString preedit; - QString commit; - - stream >> preedit; - stream >> commit; - - if (preedit.isEmpty() && QT_PREPEND_NAMESPACE(activeWidget)) - w = QT_PREPEND_NAMESPACE(activeWidget); - - QInputContext *qic = w->inputContext(); - if (!qic) - return false; - - QList attrs; - - - while (!stream.atEnd()) { - int type = -1; - int start = -1; - int length = -1; - QVariant data; - stream >> type >> start >> length >> data; - if (stream.status() != QDataStream::Ok) { - qWarning("corrupted QWSIMEvent"); - //qic->reset(); //??? - return false; - } - if (type == QInputMethodEvent::TextFormat) - data = qic->standardFormat(static_cast(data.toInt())); - attrs << QInputMethodEvent::Attribute(static_cast(type), start, length, data); - } -#ifdef EXTRA_DEBUG - qDebug() << "preedit" << preedit << "len" << preedit.length() <<"commit" << commit << "len" << commit.length() - << "n attr" << attrs.count(); -#endif - - if (preedit.isEmpty()) - QT_PREPEND_NAMESPACE(activeWidget) = 0; - else - QT_PREPEND_NAMESPACE(activeWidget) = w; - - - QInputMethodEvent ime(preedit, attrs); - if (!commit.isEmpty() || e->simpleData.replaceLength > 0) - ime.setCommitString(commit, e->simpleData.replaceFrom, e->simpleData.replaceLength); - - - extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); //qapplication_qws.cpp - qt_sendSpontaneousEvent(w, &ime); - - return true; -} - -Q_GUI_EXPORT void (*qt_qws_inputMethodStatusChanged)(QWidget*) = 0; - -void QWSInputContext::updateImeStatus(QWidget *w, bool hasFocus) -{ - Q_UNUSED(hasFocus); - - if (!w || !qt_qws_inputMethodStatusChanged) - return; - qt_qws_inputMethodStatusChanged(w); -} - - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_INPUTMETHODS diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 3c57368babc..5195b2e3f53 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -6,324 +6,91 @@ PRECOMPILED_HEADER = kernel/qt_gui_pch.h KERNEL_P= kernel HEADERS += \ - kernel/qaction.h \ - kernel/qaction_p.h \ - kernel/qactiongroup.h \ - kernel/qapplication.h \ - kernel/qapplication_p.h \ - kernel/qboxlayout.h \ - kernel/qclipboard.h \ - kernel/qcursor.h \ - kernel/qdesktopwidget.h \ - kernel/qdrag.h \ - kernel/qdnd_p.h \ - kernel/qevent.h \ - kernel/qevent_p.h \ - kernel/qformlayout.h \ - kernel/qgridlayout.h \ - kernel/qkeysequence.h \ - kernel/qlayout.h \ - kernel/qlayout_p.h \ - kernel/qlayoutengine_p.h \ - kernel/qlayoutitem.h \ - kernel/qmime.h \ - kernel/qsessionmanager.h \ - kernel/qshortcut.h \ - kernel/qshortcutmap_p.h \ - kernel/qsizepolicy.h \ - kernel/qpalette.h \ - kernel/qstackedlayout.h \ - kernel/qtooltip.h \ - kernel/qwhatsthis.h \ - kernel/qwidget.h \ - kernel/qwidget_p.h \ - kernel/qwidgetaction.h \ - kernel/qwidgetaction_p.h \ - kernel/qwindowdefs.h \ - kernel/qkeymapper_p.h \ - kernel/qgesture.h \ - kernel/qgesture_p.h \ - kernel/qstandardgestures_p.h \ - kernel/qgesturerecognizer.h \ - kernel/qgesturemanager_p.h \ - kernel/qsoftkeymanager_p.h \ - kernel/qsoftkeymanager_common_p.h \ - kernel/qguiplatformplugin_p.h \ + kernel/qclipboard.h \ + kernel/qcursor.h \ + kernel/qcursor_p.h \ + kernel/qdrag.h \ + kernel/qdnd_p.h \ + kernel/qevent.h \ + kernel/qevent_p.h \ + kernel/qinputpanel.h \ + kernel/qinputpanel_p.h \ + kernel/qkeysequence.h \ + kernel/qkeysequence_p.h \ + kernel/qkeymapper_p.h \ + kernel/qmime.h \ + kernel/qpalette.h \ + kernel/qsessionmanager.h \ + kernel/qwindowdefs.h \ + kernel/qscreen.h \ + kernel/qstylehints.h SOURCES += \ - kernel/qaction.cpp \ - kernel/qactiongroup.cpp \ - kernel/qapplication.cpp \ - kernel/qboxlayout.cpp \ - kernel/qclipboard.cpp \ - kernel/qcursor.cpp \ - kernel/qdrag.cpp \ - kernel/qdnd.cpp \ - kernel/qevent.cpp \ - kernel/qformlayout.cpp \ - kernel/qgridlayout.cpp \ - kernel/qkeysequence.cpp \ - kernel/qlayout.cpp \ - kernel/qlayoutengine.cpp \ - kernel/qlayoutitem.cpp \ - kernel/qmime.cpp \ - kernel/qpalette.cpp \ - kernel/qshortcut.cpp \ - kernel/qshortcutmap.cpp \ - kernel/qstackedlayout.cpp \ - kernel/qtooltip.cpp \ - kernel/qguivariant.cpp \ - kernel/qwhatsthis.cpp \ - kernel/qwidget.cpp \ - kernel/qwidgetaction.cpp \ - kernel/qkeymapper.cpp \ - kernel/qgesture.cpp \ - kernel/qstandardgestures.cpp \ - kernel/qgesturerecognizer.cpp \ - kernel/qgesturemanager.cpp \ - kernel/qsoftkeymanager.cpp \ - kernel/qdesktopwidget.cpp \ - kernel/qguiplatformplugin.cpp - -win32 { - DEFINES += QT_NO_DIRECTDRAW - - HEADERS += \ - kernel/qwinnativepangesturerecognizer_win_p.h - - SOURCES += \ - kernel/qapplication_win.cpp \ - kernel/qclipboard_win.cpp \ - kernel/qcursor_win.cpp \ - kernel/qdesktopwidget_win.cpp \ - kernel/qdnd_win.cpp \ - kernel/qmime_win.cpp \ - kernel/qsound_win.cpp \ - kernel/qwidget_win.cpp \ - kernel/qole_win.cpp \ - kernel/qkeymapper_win.cpp \ - kernel/qwinnativepangesturerecognizer_win.cpp - - !contains(DEFINES, QT_NO_DIRECTDRAW):LIBS += ddraw.lib -} - -symbian { - exists($${EPOCROOT}epoc32/include/platform/mw/akntranseffect.h): DEFINES += QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H - - SOURCES += \ - kernel/qapplication_s60.cpp \ - kernel/qeventdispatcher_s60.cpp \ - kernel/qwidget_s60.cpp \ - kernel/qcursor_s60.cpp \ - kernel/qdesktopwidget_s60.cpp \ - kernel/qkeymapper_s60.cpp\ - kernel/qclipboard_s60.cpp\ - kernel/qdnd_s60.cpp \ - kernel/qsound_s60.cpp - - HEADERS += \ - kernel/qt_s60_p.h \ - kernel/qeventdispatcher_s60_p.h - - LIBS += -lbafl -lestor - - INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - INCLUDEPATH += ../3rdparty/s60 - - contains(QT_CONFIG, s60) { - SOURCES += kernel/qsoftkeymanager_s60.cpp - HEADERS += kernel/qsoftkeymanager_s60_p.h - } -} - - -unix:x11 { - INCLUDEPATH += ../3rdparty/xorg - HEADERS += \ - kernel/qx11embed_x11.h \ - kernel/qx11info_x11.h \ - kernel/qkde_p.h - - SOURCES += \ - kernel/qapplication_x11.cpp \ - kernel/qclipboard_x11.cpp \ - kernel/qcursor_x11.cpp \ - kernel/qdnd_x11.cpp \ - kernel/qdesktopwidget_x11.cpp \ - kernel/qmotifdnd_x11.cpp \ - kernel/qsound_x11.cpp \ - kernel/qwidget_x11.cpp \ - kernel/qwidgetcreate_x11.cpp \ - kernel/qx11embed_x11.cpp \ - kernel/qx11info_x11.cpp \ - kernel/qkeymapper_x11.cpp \ - kernel/qkde.cpp - - contains(QT_CONFIG, glib) { - SOURCES += \ - kernel/qguieventdispatcher_glib.cpp - HEADERS += \ - kernel/qguieventdispatcher_glib_p.h - QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB - LIBS_PRIVATE +=$$QT_LIBS_GLIB - } - SOURCES += \ - kernel/qeventdispatcher_x11.cpp - HEADERS += \ - kernel/qeventdispatcher_x11_p.h -} - -embedded { - HEADERS += \ - kernel/qeventdispatcher_qws_p.h - - SOURCES += \ - kernel/qapplication_qws.cpp \ - kernel/qclipboard_qws.cpp \ - kernel/qcursor_qws.cpp \ - kernel/qdesktopwidget_qws.cpp \ - kernel/qdnd_qws.cpp \ - kernel/qeventdispatcher_qws.cpp \ - kernel/qsound_qws.cpp \ - kernel/qwidget_qws.cpp \ - kernel/qkeymapper_qws.cpp \ - kernel/qsessionmanager_qws.cpp - - contains(QT_CONFIG, glib) { - SOURCES += \ - kernel/qeventdispatcher_glib_qws.cpp - HEADERS += \ - kernel/qeventdispatcher_glib_qws_p.h - QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB - LIBS_PRIVATE +=$$QT_LIBS_GLIB - } -} - -!qpa { - HEADERS += \ - kernel/qsound.h \ - kernel/qsound_p.h - - SOURCES += \ - kernel/qsound.cpp -} + kernel/qclipboard.cpp \ + kernel/qcursor.cpp \ + kernel/qdrag.cpp \ + kernel/qdnd.cpp \ + kernel/qevent.cpp \ + kernel/qinputpanel.cpp \ + kernel/qkeysequence.cpp \ + kernel/qkeymapper.cpp \ + kernel/qkeymapper_qpa.cpp \ + kernel/qmime.cpp \ + kernel/qpalette.cpp \ + kernel/qguivariant.cpp \ + kernel/qscreen.cpp \ + kernel/qstylehints.cpp qpa { HEADERS += \ - kernel/qgenericpluginfactory_qpa.h \ + kernel/qgenericpluginfactory_qpa.h \ kernel/qgenericplugin_qpa.h \ - kernel/qeventdispatcher_qpa_p.h \ kernel/qwindowsysteminterface_qpa.h \ kernel/qwindowsysteminterface_qpa_p.h \ kernel/qplatformintegration_qpa.h \ + kernel/qplatformdrag_qpa.h \ kernel/qplatformscreen_qpa.h \ + kernel/qplatforminputcontext_qpa.h \ 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 \ - kernel/qplatformeventloopintegration_qpa.h \ + kernel/qplatformopenglcontext_qpa.h \ + kernel/qopenglcontext.h \ + kernel/qopenglcontext_p.h \ kernel/qplatformcursor_qpa.h \ kernel/qplatformclipboard_qpa.h \ - kernel/qplatformnativeinterface_qpa.h + kernel/qplatformnativeinterface_qpa.h \ + kernel/qsurfaceformat.h \ + kernel/qguiapplication.h \ + kernel/qguiapplication_p.h \ + kernel/qwindow_p.h \ + kernel/qwindow.h \ + kernel/qplatformsurface_qpa.h \ + kernel/qsurface.h SOURCES += \ - kernel/qapplication_qpa.cpp \ - kernel/qclipboard_qpa.cpp \ - kernel/qcursor_qpa.cpp \ - kernel/qdnd_qws.cpp \ - kernel/qdesktopwidget_qpa.cpp \ - kernel/qgenericpluginfactory_qpa.cpp \ - kernel/qgenericplugin_qpa.cpp \ - kernel/qkeymapper_qws.cpp \ - kernel/qwidget_qpa.cpp \ - kernel/qeventdispatcher_qpa.cpp \ + kernel/qclipboard_qpa.cpp \ + kernel/qcursor_qpa.cpp \ + kernel/qgenericpluginfactory_qpa.cpp \ + kernel/qgenericplugin_qpa.cpp \ kernel/qwindowsysteminterface_qpa.cpp \ + kernel/qplatforminputcontext_qpa.cpp \ kernel/qplatformintegration_qpa.cpp \ kernel/qplatformscreen_qpa.cpp \ kernel/qplatformintegrationfactory_qpa.cpp \ kernel/qplatformintegrationplugin_qpa.cpp \ kernel/qplatformwindow_qpa.cpp \ - kernel/qplatformwindowformat_qpa.cpp \ - kernel/qplatformeventloopintegration_qpa.cpp \ - kernel/qplatformglcontext_qpa.cpp \ + kernel/qplatformopenglcontext_qpa.cpp \ + kernel/qopenglcontext.cpp \ kernel/qplatformcursor_qpa.cpp \ kernel/qplatformclipboard_qpa.cpp \ kernel/qplatformnativeinterface_qpa.cpp \ - kernel/qsessionmanager_qpa.cpp - - contains(QT_CONFIG, glib) { - SOURCES += \ - kernel/qeventdispatcher_glib_qpa.cpp - HEADERS += \ - kernel/qeventdispatcher_glib_qpa_p.h - QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB - LIBS_PRIVATE +=$$QT_LIBS_GLIB - } + kernel/qsessionmanager_qpa.cpp \ + kernel/qsurfaceformat.cpp \ + kernel/qguiapplication.cpp \ + kernel/qwindow.cpp \ + kernel/qplatformsurface_qpa.cpp \ + kernel/qsurface.cpp } -!embedded:!qpa:!x11:mac { - SOURCES += \ - kernel/qclipboard_mac.cpp \ - kernel/qmime_mac.cpp \ - kernel/qt_mac.cpp \ - kernel/qkeymapper_mac.cpp - - OBJECTIVE_HEADERS += \ - qcocoawindow_mac_p.h \ - qcocoapanel_mac_p.h \ - qcocoawindowdelegate_mac_p.h \ - qcocoaview_mac_p.h \ - qcocoaapplication_mac_p.h \ - qcocoaapplicationdelegate_mac_p.h \ - qmacgesturerecognizer_mac_p.h \ - qmultitouch_mac_p.h \ - qcocoasharedwindowmethods_mac_p.h \ - qcocoaintrospection_p.h - - OBJECTIVE_SOURCES += \ - kernel/qcursor_mac.mm \ - kernel/qdnd_mac.mm \ - kernel/qsound_mac.mm \ - kernel/qapplication_mac.mm \ - kernel/qwidget_mac.mm \ - kernel/qcocoapanel_mac.mm \ - kernel/qcocoaview_mac.mm \ - kernel/qcocoawindow_mac.mm \ - kernel/qcocoawindowdelegate_mac.mm \ - kernel/qcocoamenuloader_mac.mm \ - kernel/qcocoaapplication_mac.mm \ - kernel/qcocoaapplicationdelegate_mac.mm \ - kernel/qt_cocoa_helpers_mac.mm \ - kernel/qdesktopwidget_mac.mm \ - kernel/qeventdispatcher_mac.mm \ - kernel/qcocoawindowcustomthemeframe_mac.mm \ - kernel/qmacgesturerecognizer_mac.mm \ - kernel/qmultitouch_mac.mm \ - kernel/qcocoaintrospection_mac.mm - - HEADERS += \ - kernel/qt_cocoa_helpers_mac_p.h \ - kernel/qcocoaapplication_mac_p.h \ - kernel/qcocoaapplicationdelegate_mac_p.h \ - kernel/qeventdispatcher_mac_p.h - - MENU_NIB.files = mac/qt_menu.nib - MENU_NIB.path = Resources - MENU_NIB.version = Versions - QMAKE_BUNDLE_DATA += MENU_NIB - RESOURCES += mac/macresources.qrc - - LIBS_PRIVATE += -framework AppKit -} - -wince*: { - HEADERS += \ - ../corelib/kernel/qfunctions_wince.h \ - kernel/qguifunctions_wince.h - - SOURCES += \ - ../corelib/kernel/qfunctions_wince.cpp \ - kernel/qguifunctions_wince.cpp -} +win32:HEADERS+=kernel/qwindowdefs_win.h diff --git a/src/gui/kernel/mac.pri b/src/gui/kernel/mac.pri deleted file mode 100644 index 21acd06e652..00000000000 --- a/src/gui/kernel/mac.pri +++ /dev/null @@ -1,4 +0,0 @@ -!x11:!embedded:!qpa:mac { - LIBS_PRIVATE += -framework Carbon -lz - *-mwerks:INCLUDEPATH += compat -} diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp deleted file mode 100644 index dfac850716a..00000000000 --- a/src/gui/kernel/qapplication_qpa.cpp +++ /dev/null @@ -1,968 +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$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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 "private/qevent_p.h" - -#include "qgenericpluginfactory_qpa.h" -#include "qplatformintegrationfactory_qpa_p.h" -#include - -#include -#include -#include -#include -#include "qwindowsysteminterface_qpa_p.h" -#include - -#include "qdesktopwidget_qpa_p.h" - -QT_BEGIN_NAMESPACE - -static QString appName; -static QString appFont; - -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 - -qreal qt_last_x = 0; -qreal qt_last_y = 0; -QPointer qt_last_mouse_receiver = 0; - -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::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e) -{ - switch(e->type) { - case QWindowSystemInterfacePrivate::Mouse: - QApplicationPrivate::processMouseEvent(static_cast(e)); - break; - case QWindowSystemInterfacePrivate::Wheel: - QApplicationPrivate::processWheelEvent(static_cast(e)); - break; - case QWindowSystemInterfacePrivate::Key: - QApplicationPrivate::processKeyEvent(static_cast(e)); - break; - case QWindowSystemInterfacePrivate::Touch: - QApplicationPrivate::processTouchEvent(static_cast(e)); - break; - case QWindowSystemInterfacePrivate::GeometryChange: - QApplicationPrivate::processGeometryChangeEvent(static_cast(e)); - break; - case QWindowSystemInterfacePrivate::Enter: - QApplicationPrivate::processEnterEvent(static_cast(e)); - break; - case QWindowSystemInterfacePrivate::Leave: - QApplicationPrivate::processLeaveEvent(static_cast(e)); - break; - case QWindowSystemInterfacePrivate::ActivatedWindow: - QApplicationPrivate::processActivatedEvent(static_cast(e)); - break; - case QWindowSystemInterfacePrivate::Close: - QApplicationPrivate::processCloseEvent( - static_cast(e)); - break; - case QWindowSystemInterfacePrivate::ScreenCountChange: - QApplicationPrivate::reportScreenCount( - static_cast(e)); - break; - 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; - 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 QPAEventDispatcherGlib(q); - else -#endif - eventDispatcher = new QEventDispatcherQPA(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_qpa_set_cursor(0, false); -} - -void QApplication::restoreOverrideCursor() -{ - if (qApp->d_func()->cursor_list.isEmpty()) - return; - qApp->d_func()->cursor_list.removeFirst(); - qt_qpa_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) -{ -} - -/*! - \internal -*/ -QPlatformNativeInterface *QApplication::platformNativeInterface() -{ - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - return pi->nativeInterface(); -} - -static void init_platform(const QString &name, const QString &platformPluginPath) -{ - QApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath); - if (!QApplicationPrivate::platform_integration) { - QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); - 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 platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH")); - QByteArray platformName; -#ifdef QT_QPA_DEFAULT_PLATFORM_NAME - platformName = QT_QPA_DEFAULT_PLATFORM_NAME; -#endif - QByteArray platformNameEnv = qgetenv("QT_QPA_PLATFORM"); - if (!platformNameEnv.isEmpty()) { - platformName = platformNameEnv; - } - - // 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_QPA_PLUGINS"); - if (!pluginEnv.isEmpty()) { - pluginList.append(pluginEnv.split(';')); - } -#endif - - init_platform(QLatin1String(platformName), platformPluginPath); - 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(QWindowSystemInterfacePrivate::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 != QPointF(qt_last_x, qt_last_y) && (stateChange != Qt::NoButton)) { - 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; - } - - QWidget * tlw = e->widget.data(); - - QPointF localPoint = e->localPos; - QPointF 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, 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)) { - //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.toPoint()); - } - - 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.toPoint()); - } - - // which child should have it? - QWidget *mouseWidget = mouseWindow; - if (mouseWindow) { - QWidget *w = mouseWindow->childAt(localPoint.toPoint()); - 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.toPoint()); - } - - Q_ASSERT(mouseWidget); - - //localPoint is local to mouseWindow, but it needs to be local to mouseWidget - localPoint = mouseWidget->mapFrom(mouseWindow, localPoint.toPoint()); - - 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, QApplication::keyboardModifiers()); - - QList > cursors = QPlatformCursorPrivate::getInstances(); - foreach (QWeakPointer cursor, cursors) { - if (cursor) - cursor.data()->pointerEvent(ev); - } - - int oldOpenPopupCount = openPopupCount; - QApplication::sendSpontaneousEvent(mouseWidget, &ev); - -#ifndef QT_NO_CONTEXTMENU - if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) { - QContextMenuEvent e(QContextMenuEvent::Mouse, localPoint.toPoint(), globalPoint.toPoint(), QApplication::keyboardModifiers()); - QApplication::sendSpontaneousEvent(mouseWidget, &e); - } -#endif // QT_NO_CONTEXTMENU -} - - -//### there's a lot of duplicated logic here -- refactoring required! - -void QApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e) -{ -// QPoint localPoint = ev.pos(); - QPointF 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.toPoint()); - } - - if (!mouseWindow) - return; - - mouseWidget = mouseWindow; - - if (app_do_modal && !qt_try_modal(mouseWindow, QEvent::Wheel) ) { - qDebug() << "modal blocked wheel event" << mouseWindow; - return; - } - QPointF p = mouseWindow->mapFromGlobal(globalPoint.toPoint()); - QWidget *w = mouseWindow->childAt(p.toPoint()); - if (w) { - mouseWidget = w; - p = mouseWidget->mapFromGlobal(globalPoint.toPoint()); - } - - QWheelEvent ev(p, globalPoint, e->delta, buttons, QApplication::keyboardModifiers(), - e->orient); - QApplication::sendSpontaneousEvent(mouseWidget, &ev); -} - - - -// Remember, Qt convention is: keyboard state is state *before* - -void QApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::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->keyType)) - return; - - if (e->nativeScanCode || e->nativeVirtualKey || e->nativeModifiers) { - QKeyEventEx ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount, - e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers); - QApplication::sendSpontaneousEvent(focusW, &ev); - } else { - QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); - QApplication::sendSpontaneousEvent(focusW, &ev); - } -} - -void QApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e) -{ - QApplicationPrivate::dispatchEnterLeave(e->enter.data(),0); - qt_last_mouse_receiver = e->enter.data(); -} - -void QApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e) -{ - QApplicationPrivate::dispatchEnterLeave(0,qt_last_mouse_receiver); - - 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; - -} - -void QApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e) -{ - QApplication::setActiveWindow(e->activated.data()); -} - -void QApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e) -{ - 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(); - } - - if (isMove) { - //### frame geometry - QMoveEvent e(tlw->data->crect.topLeft(), cr.topLeft()); - QApplication::sendSpontaneousEvent(tlw, &e); - } -} - -void QApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e) -{ - if (e->topLevel.isNull()) { - //qDebug() << "QApplicationPrivate::processCloseEvent NULL"; - return; - } - e->topLevel.data()->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); -} - -void QApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e) -{ - translateRawTouchEvent(e->widget.data(), e->devType, e->points); -} - -void QApplicationPrivate::reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e) -{ - // 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(e->count); -} - -void QApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e) -{ - // 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(e->index); - - // 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( - QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e) -{ - // 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(e->index); - - // 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_qws.cpp b/src/gui/kernel/qapplication_qws.cpp deleted file mode 100644 index 428f5580239..00000000000 --- a/src/gui/kernel/qapplication_qws.cpp +++ /dev/null @@ -1,3802 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qglobal.h" -#include "qlibrary.h" -#include "qcursor.h" -#include "qapplication.h" -#include "private/qapplication_p.h" -#include "qwidget.h" -#include "qbitarray.h" -#include "qpainter.h" -#include "qpixmapcache.h" -#include "qdatetime.h" -#include "qtextcodec.h" -#include "qdatastream.h" -#include "qbuffer.h" -#include "qsocketnotifier.h" -#include "qsessionmanager.h" -#include "qclipboard.h" -#include "qbitmap.h" -#include "qwssocket_qws.h" -#include "qtransportauth_qws.h" -#include "private/qtransportauth_qws_p.h" -#include "qwsevent_qws.h" -#include "private/qwscommand_qws_p.h" -#include "qwsproperty_qws.h" -#include "qscreen_qws.h" -#include "qscreenproxy_qws.h" -#include "qcopchannel_qws.h" -#include "private/qlock_p.h" -#include "private/qwslock_p.h" -//#include "qmemorymanager_qws.h" -#include "qwsmanager_qws.h" -//#include "qwsregionmanager_qws.h" -#include "qwindowsystem_qws.h" -#include "private/qwindowsystem_p.h" -#include "qdecorationfactory_qws.h" - -#include "qwsdisplay_qws.h" -#include "private/qwsdisplay_qws_p.h" -#include "private/qwsinputcontext_p.h" -#include "qfile.h" -#include "qhash.h" -#include "qdesktopwidget.h" -#include "qcolormap.h" -#include "private/qcursor_p.h" -#include "qsettings.h" -#include "qdebug.h" -#include "qeventdispatcher_qws_p.h" -#if !defined(QT_NO_GLIB) -# include "qeventdispatcher_glib_qws_p.h" -#endif - - -#include "private/qwidget_p.h" -#include "private/qbackingstore_p.h" -#include "private/qwindowsurface_qws_p.h" -#include "private/qfont_p.h" - -#include -#include -#include -#include -#include -#include -#include -#ifdef Q_OS_VXWORKS -# include -#else -# include -#endif -#include -#include - -#include - -#ifndef QT_NO_QWS_MULTIPROCESS -#ifdef QT_NO_QSHM -#include -#include -#ifndef Q_OS_DARWIN -# include -#endif -#include -#else -#include "private/qwssharedmemory_p.h" -#endif -#endif - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_DIRECTPAINTER -class QDirectPainter; -extern void qt_directpainter_region(QDirectPainter *dp, const QRegion &alloc, int type); -#ifndef QT_NO_QWSEMBEDWIDGET -extern void qt_directpainter_embedevent(QDirectPainter *dp, - const QWSEmbedEvent *e); -#endif -#endif // QT_NO_DIRECTPAINTER - -const int qwsSharedRamSize = 1 * 1024; // misc data, written by server, read by clients - -extern QApplication::Type qt_appType; -extern QDesktopWidget *qt_desktopWidget; - -//these used to be environment variables, they are initialized from -//environment variables in - -bool qws_savefonts = false; -bool qws_screen_is_interlaced=false; //### should be detected -bool qws_shared_memory = false; -bool qws_sw_cursor = true; -bool qws_accel = true; // ### never set -QByteArray qws_display_spec(":0"); -Q_GUI_EXPORT int qws_display_id = 0; -Q_GUI_EXPORT int qws_client_id = 0; -QWidget *qt_pressGrab = 0; -QWidget *qt_mouseGrb = 0; -int *qt_last_x = 0; -int *qt_last_y = 0; - -static int mouse_x_root = -1; -static int mouse_y_root = -1; -static int mouse_state = 0; -static int mouse_double_click_distance = 5; - -int qt_servershmid = -1; - -bool qws_overrideCursor = false; -#ifndef QT_NO_QWS_MANAGER - -extern Q_GUI_EXPORT QWSServer *qwsServer; - -static QDecoration *qws_decoration = 0; -#endif - -#if defined(QT_DEBUG) -/* -extern "C" void dumpmem(const char* m) -{ - static int init=0; - static int prev=0; - FILE* f = fopen("/proc/meminfo","r"); - // char line[100]; - int total=0,used=0,free=0,shared=0,buffers=0,cached=0; - fscanf(f,"%*[^M]Mem: %d %d %d %d %d %d",&total,&used,&free,&shared,&buffers,&cached); - used -= buffers + cached; - if (!init) { - init=used; - } else { - printf("%40s: %+8d = %8d\n",m,used-init-prev,used-init); - prev = used-init; - } - fclose(f); -} -*/ -#endif - -// Get the name of the directory where Qt for Embedded Linux temporary data should -// live. -QString qws_dataDir() -{ - static QString result; - if (!result.isEmpty()) - return result; - result = QT_VFB_DATADIR(qws_display_id); - QByteArray dataDir = result.toLocal8Bit(); - -#if defined(Q_OS_INTEGRITY) - /* ensure filesystem is ready before starting requests */ - WaitForFileSystemInitialization(); -#endif - - if (QT_MKDIR(dataDir, 0700)) { - if (errno != EEXIST) { - qFatal("Cannot create Qt for Embedded Linux data directory: %s", dataDir.constData()); - } - } - - QT_STATBUF buf; - if (QT_LSTAT(dataDir, &buf)) - qFatal("stat failed for Qt for Embedded Linux data directory: %s", dataDir.constData()); - - if (!S_ISDIR(buf.st_mode)) - qFatal("%s is not a directory", dataDir.constData()); - -#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) - if (buf.st_uid != getuid()) - qFatal("Qt for Embedded Linux data directory is not owned by user %d", getuid()); - - if ((buf.st_mode & 0677) != 0600) - qFatal("Qt for Embedded Linux data directory has incorrect permissions: %s", dataDir.constData()); -#endif - - result.append("/"); - return result; -} - -// Get the filename of the pipe Qt for Embedded Linux uses for server/client comms -Q_GUI_EXPORT QString qws_qtePipeFilename() -{ - qws_dataDir(); - return QTE_PIPE(qws_display_id); -} - -static void setMaxWindowRect(const QRect &rect) -{ - const QList subScreens = qt_screen->subScreens(); - QScreen *screen = qt_screen; - int screenNo = 0; - for (int i = 0; i < subScreens.size(); ++i) { - if (subScreens.at(i)->region().contains(rect)) { - screen = subScreens.at(i); - screenNo = i; - break; - } - } - - QApplicationPrivate *ap = QApplicationPrivate::instance(); - ap->setMaxWindowRect(screen, screenNo, rect); -} - -void QApplicationPrivate::setMaxWindowRect(const QScreen *screen, int screenNo, - const QRect &rect) -{ - if (maxWindowRects.value(screen) == rect) - return; - - maxWindowRects[screen] = rect; - - // Re-resize any maximized windows - QWidgetList l = QApplication::topLevelWidgets(); - for (int i = 0; i < l.size(); ++i) { - QWidget *w = l.at(i); - QScreen *s = w->d_func()->getScreen(); - if (w->isMaximized() && s == screen) - w->d_func()->setMaxWindowState_helper(); - } - - if ( qt_desktopWidget ) // XXX workaround crash - emit QApplication::desktop()->workAreaResized(screenNo); -} - -#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION - -typedef void (*TransformFunc)(QScreen *, int); -#ifndef QT_NO_QWS_TRANSFORMED -extern "C" void qws_setScreenTransformation(QScreen *, int); -#endif -static TransformFunc getTransformationFunction() -{ - static TransformFunc func = 0; - - if (!func) { -#ifdef QT_NO_QWS_TRANSFORMED -# ifndef QT_NO_LIBRARY - // symbol is not built into the library, search for the plugin - const QStringList paths = QApplication::libraryPaths(); - foreach (const QString &path, paths) { - const QString file = path + QLatin1String("/gfxdrivers/libqgfxtransformed"); - func = (TransformFunc)QLibrary::resolve(file, - "qws_setScreenTransformation"); - if (func) - break; - } -# endif -#else - func = qws_setScreenTransformation; -#endif - if (!func) - func = (TransformFunc)-1; - } - - if (func == (TransformFunc)-1) - return 0; - - return func; -} - -static void setScreenTransformation(int screenNo, int transformation) -{ - QScreen *screen = QScreen::instance(); - const QList subScreens = screen->subScreens(); - - if (screenNo == -1) - screenNo = 0; - - if (screenNo == -1 && !subScreens.isEmpty()) - screenNo = 0; - - if (subScreens.isEmpty() && screenNo == 0) { - // nothing - } else if (screenNo < 0 || screenNo >= subScreens.size()) { - qWarning("setScreenTransformation: invalid screen %i", screenNo); - return; - } - - if (screenNo < subScreens.size()) - screen = subScreens.at(screenNo); - - QApplicationPrivate *ap = QApplicationPrivate::instance(); - ap->setScreenTransformation(screen, screenNo, transformation); -} - -void QApplicationPrivate::setScreenTransformation(QScreen *screen, - int screenNo, - int transformation) -{ - QScreen *transformed = screen; - - while (transformed->classId() == QScreen::ProxyClass) - transformed = static_cast(transformed)->screen(); - - if (transformed->classId() != QScreen::TransformedClass) - return; - - TransformFunc setScreenTransformation = getTransformationFunction(); - if (!setScreenTransformation) - return; - - setScreenTransformation(transformed, transformation); - - // need to re-configure() proxies bottom-up - if (screen->classId() == QScreen::ProxyClass) { - QList proxies; - QScreen *s = screen; - - do { - QProxyScreen *proxy = static_cast(s); - proxies.append(proxy); - s = proxy->screen(); - } while (s->classId() == QScreen::ProxyClass); - - do { - QProxyScreen *proxy = proxies.takeLast(); - proxy->setScreen(proxy->screen()); // triggers configure() - } while (!proxies.isEmpty()); - } - - if (qt_desktopWidget) { // XXX workaround crash for early screen transform events - QDesktopWidget *desktop = QApplication::desktop(); - - emit desktop->resized(screenNo); - if (maxWindowRect(screen).isEmpty()) // not explicitly set - emit desktop->workAreaResized(screenNo); - } - - QWSServer *server = QWSServer::instance(); - if (server) { - server->updateWindowRegions(); - QRegion r = screen->region(); - server->refresh(r); - } - - // 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(); - } -} - -#endif // QT_NO_QWS_DYNAMICSCREENTRANSFORMATION - -/***************************************************************************** - Internal variables and functions - *****************************************************************************/ - - -static QString appName; // application name -static const char *appFont = 0; // application font -static const char *appBGCol = 0; // application bg color -static const char *appFGCol = 0; // application fg color -static const char *appBTNCol = 0; // application btn color -static const char *mwGeometry = 0; // main widget geometry -static const char *mwTitle = 0; // main widget title -//static bool mwIconic = false; // main widget iconified - -static bool app_do_modal = false; // modal mode -Q_GUI_EXPORT QWSDisplay *qt_fbdpy = 0; // QWS `display' -QLock *QWSDisplay::lock = 0; - -static int mouseButtonPressed = 0; // last mouse button pressed -static int mouseButtonPressTime = 0; // when was a button pressed -static short mouseXPos, mouseYPos; // mouse position in act window - -extern QWidgetList *qt_modal_stack; // stack of modal widgets - -static QWidget *popupButtonFocus = 0; -static QWidget *popupOfPopupButtonFocus = 0; -static bool popupCloseDownMode = false; -static bool popupGrabOk; -static QPointer *mouseInWidget = 0; -QPointer qt_last_mouse_receiver = 0; - -static bool sm_blockUserInput = false; // session management - -QWidget *qt_button_down = 0; // widget got last button-down -WId qt_last_cursor = 0xffffffff; // Was -1, but WIds are unsigned - -class QWSMouseEvent; -class QWSKeyEvent; - -class QETWidget : public QWidget // event translator widget -{ -public: - bool translateMouseEvent(const QWSMouseEvent *, int oldstate); - bool translateKeyEvent(const QWSKeyEvent *, bool grab); - bool translateRegionEvent(const QWSRegionEvent *); -#ifndef QT_NO_QWSEMBEDWIDGET - void translateEmbedEvent(const QWSEmbedEvent *event); -#endif - bool translateWheelEvent(const QWSMouseEvent *me); - void repaintDecoration(QRegion r, bool post); - void updateRegion(); - - bool raiseOnClick() - { - // With limited windowmanagement/taskbar/etc., raising big windows - // (eg. spreadsheet) over the top of everything else (eg. calculator) - // is just annoying. - return !isMaximized() && !isFullScreen(); - } -}; - -void QApplicationPrivate::createEventDispatcher() -{ - Q_Q(QApplication); -#if !defined(QT_NO_GLIB) - if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported()) - eventDispatcher = (q->type() != QApplication::Tty - ? new QWSEventDispatcherGlib(q) - : new QEventDispatcherGlib(q)); - else -#endif - eventDispatcher = (q->type() != QApplication::Tty - ? new QEventDispatcherQWS(q) - : new QEventDispatcherUNIX(q)); -} - -// Single-process stuff. This should maybe move into qwindowsystem_qws.cpp - -static bool qws_single_process; -static QList incoming; -static QList outgoing; - -void qt_client_enqueue(const QWSEvent *event) -{ - QWSEvent *copy = QWSEvent::factory(event->type); - copy->copyFrom(event); - incoming.append(copy); -} - -QList *qt_get_server_queue() -{ - return &outgoing; -} - -void qt_server_enqueue(const QWSCommand *command) -{ - QWSCommand *copy = QWSCommand::factory(command->type); - QT_TRY { - copy->copyFrom(command); - outgoing.append(copy); - } QT_CATCH(...) { - delete copy; - QT_RETHROW; - } -} - -QWSDisplay::Data::Data(QObject* parent, bool singleProcess) -{ -#ifdef QT_NO_QWS_MULTIPROCESS - Q_UNUSED(parent); - Q_UNUSED(singleProcess); -#else - if (singleProcess) - csocket = 0; - else { - csocket = new QWSSocket(parent); - QObject::connect(csocket, SIGNAL(disconnected()), - qApp, SLOT(quit())); - } - clientLock = 0; -#endif - init(); -} - -QWSDisplay::Data::~Data() -{ -// delete rgnMan; rgnMan = 0; -// delete memorymanager; memorymanager = 0; - qt_screen->disconnect(); - delete qt_screen; qt_screen = 0; -#ifndef QT_NO_QWS_CURSOR - delete qt_screencursor; qt_screencursor = 0; -#endif -#ifndef QT_NO_QWS_MULTIPROCESS - shm.detach(); - if (csocket) { - QWSCommand shutdownCmd(QWSCommand::Shutdown, 0, 0); - shutdownCmd.write(csocket); - csocket->flush(); // may be pending QCop message, eg. - delete csocket; - } - delete clientLock; - clientLock = 0; -#endif - delete connected_event; - delete mouse_event; - delete current_event; - qDeleteAll(queue); -#ifndef QT_NO_COP - delete qcop_response; -#endif -} - -#ifndef QT_NO_QWS_MULTIPROCESS -bool QWSDisplay::Data::lockClient(QWSLock::LockType type, int timeout) -{ - return !clientLock || clientLock->lock(type, timeout); -} - -void QWSDisplay::Data::unlockClient(QWSLock::LockType type) -{ - if (clientLock) clientLock->unlock(type); -} - -bool QWSDisplay::Data::waitClient(QWSLock::LockType type, int timeout) -{ - return !clientLock || clientLock->wait(type, timeout); -} - -QWSLock* QWSDisplay::Data::getClientLock() -{ - return clientLock; -} -#endif // QT_NO_QWS_MULTIPROCESS - -void QWSDisplay::Data::flush() -{ -#ifndef QT_NO_QWS_MULTIPROCESS - if (csocket) { - csocket->waitForReadyRead(0); - csocket->flush(); - } -#endif -} - -#if 0 -void QWSDisplay::Data::debugQueue() { - for (int i = 0; i < queue.size(); ++i) { - QWSEvent *e = queue.at(i); - qDebug( " ev %d type %d sl %d rl %d", i, e->type, e->simpleLen, e->rawLen); - } -} -#endif - -bool QWSDisplay::Data::queueNotEmpty() -{ - return mouse_event/*||region_event*/||queue.count() > 0; -} -QWSEvent* QWSDisplay::Data::dequeue() -{ - QWSEvent *r=0; - if (queue.count()) { - r = queue.first(); - queue.removeFirst(); - if (r->type == QWSEvent::Region) - region_events_count--; - } else if (mouse_event) { - r = mouse_event; - mouse_event = 0; -#ifdef QAPPLICATION_EXTRA_DEBUG - mouse_event_count = 0; -#endif - } - return r; -} - -QWSEvent* QWSDisplay::Data::peek() -{ - return queue.first(); -} - -bool QWSDisplay::Data::directServerConnection() -{ -#ifndef QT_NO_QWS_MULTIPROCESS - return csocket == 0; -#else - return true; -#endif -} - -void QWSDisplay::Data::create(int n) -{ - QWSCreateCommand cmd(n); - sendCommand(cmd); -} - -void QWSDisplay::Data::flushCommands() -{ -#ifndef QT_NO_QWS_MULTIPROCESS - if (csocket) - csocket->flush(); -#endif -} - -void QWSDisplay::Data::sendCommand(QWSCommand & cmd) -{ -#ifndef QT_NO_QWS_MULTIPROCESS - if (csocket) - cmd.write(csocket); - else -#endif - qt_server_enqueue(&cmd); -} - -void QWSDisplay::Data::sendSynchronousCommand(QWSCommand & cmd) -{ -#ifndef QT_NO_QWS_MULTIPROCESS - if (csocket) { - lockClient(QWSLock::Communication); - cmd.write(csocket); - bool ok = true; - while (csocket->bytesToWrite() > 0) { - if (!csocket->waitForBytesWritten(-1)) { - qCritical("QWSDisplay::Data::sendSynchronousCommand: %s", - qPrintable(csocket->errorString())); - ok = false; - break; - } - } - if (ok) - waitClient(QWSLock::Communication); - } else -#endif - qt_server_enqueue(&cmd); -} - -int QWSDisplay::Data::takeId() -{ - int unusedIdCount = unused_identifiers.count(); - if (unusedIdCount <= 10) - create(15); - if (unusedIdCount == 0) { - create(1); // Make sure we have an incoming id to wait for, just in case we're recursive - waitForCreation(); - } - - return unused_identifiers.takeFirst(); -} - -void QWSDisplay::Data::setMouseFilter(void (*filter)(QWSMouseEvent*)) -{ - mouseFilter = filter; -} - -#ifndef QT_NO_QWS_MULTIPROCESS - -QWSLock* QWSDisplay::Data::clientLock = 0; - -void Q_GUI_EXPORT qt_app_reinit( const QString& newAppName ) -{ - qt_fbdpy->d->reinit( newAppName ); -} - -#endif // QT_NO_QWS_MULTIPROCESS - -class QDesktopWidget; - -#ifndef QT_NO_QWS_MULTIPROCESS -void QWSDisplay::Data::reinit( const QString& newAppName ) -{ - Q_ASSERT(csocket); - - delete connected_event; - connected_event = 0; - region_events_count = 0; -// region_ack = 0; - delete mouse_event; - mouse_event = 0; -// region_event = 0; - region_offset_window = 0; -#ifndef QT_NO_COP - delete qcop_response; - qcop_response = 0; -#endif - delete current_event; - current_event = 0; -#ifdef QAPPLICATION_EXTRA_DEBUG - mouse_event_count = 0; -#endif - mouseFilter = 0; - - qt_desktopWidget = 0; - delete QWSDisplay::Data::clientLock; - QWSDisplay::Data::clientLock = 0; - - QString pipe = qws_qtePipeFilename(); - - // QWS client - // Cleanup all cached ids - unused_identifiers.clear(); - delete csocket; - - appName = newAppName; - qApp->setObjectName( appName ); - - csocket = new QWSSocket(); - QObject::connect(csocket, SIGNAL(disconnected()), - qApp, SLOT(quit())); - csocket->connectToLocalFile(pipe); - - QWSDisplay::Data::clientLock = new QWSLock(); - - QWSIdentifyCommand cmd; - cmd.setId(appName, QWSDisplay::Data::clientLock->id()); - -#ifndef QT_NO_SXE - QTransportAuth *a = QTransportAuth::getInstance(); - QTransportAuth::Data *d = a->connectTransport( - QTransportAuth::UnixStreamSock | - QTransportAuth::Trusted, - csocket->socketDescriptor()); - QAuthDevice *ad = a->authBuf( d, csocket ); - ad->setClient( csocket ); - - cmd.write(ad); -#else - cmd.write(csocket); -#endif - - // wait for connect confirmation - waitForConnection(); - - qws_client_id = connected_event->simpleData.clientId; - - if (!QWSDisplay::initLock(pipe, false)) - qFatal("Cannot get display lock"); - - if (shm.attach(connected_event->simpleData.servershmid)) { - sharedRam = static_cast(shm.address()); - QScreen *s = qt_get_screen(qws_display_id, qws_display_spec.constData()); - if (s) - sharedRamSize += s->memoryNeeded(QLatin1String(qws_display_spec.constData())); - } else { - perror("QWSDisplay::Data::init"); - qFatal("Client can't attach to main ram memory."); - } - - qApp->desktop(); - - // We wait for creation mainly so that we can process important - // initialization events such as MaxWindowRect that are sent - // before object id creation. Waiting here avoids later window - // resizing since we have the MWR before windows are displayed. - waitForCreation(); - - sharedRamSize -= sizeof(int); - qt_last_x = reinterpret_cast(sharedRam + sharedRamSize); - sharedRamSize -= sizeof(int); - qt_last_y = reinterpret_cast(sharedRam + sharedRamSize); - -#ifndef QT_NO_COP - QCopChannel::reregisterAll(); -#endif - csocket->flush(); -} -#endif - -void QWSDisplay::Data::init() -{ - connected_event = 0; - region_events_count = 0; -// region_ack = 0; - mouse_event = 0; - mouse_state = -1; - mouse_winid = 0; -// region_event = 0; - region_offset_window = 0; -#ifndef QT_NO_COP - qcop_response = 0; -#endif - current_event = 0; -#ifdef QAPPLICATION_EXTRA_DEBUG - mouse_event_count = 0; -#endif - mouseFilter = 0; - - QString pipe = qws_qtePipeFilename(); - - sharedRamSize = qwsSharedRamSize; - -#ifndef QT_NO_QWS_MULTIPROCESS - if (csocket) { - // QWS client - - connectToPipe(); - - QWSDisplay::Data::clientLock = new QWSLock(); - - QWSIdentifyCommand cmd; - cmd.setId(appName, QWSDisplay::Data::clientLock->id()); -#ifndef QT_NO_SXE - QTransportAuth *a = QTransportAuth::getInstance(); - QTransportAuth::Data *d = a->connectTransport( - QTransportAuth::UnixStreamSock | - QTransportAuth::Trusted, - csocket->socketDescriptor()); - QAuthDevice *ad = a->authBuf( d, csocket ); - ad->setClient( csocket ); - cmd.write(ad); -#else - cmd.write(csocket); -#endif - - // create(30); // not necessary, server will send ids anyway - waitForConnection(); - - qws_client_id = connected_event->simpleData.clientId; - - // now we want to get the exact display spec to use if we haven't - // specified anything. - if (qws_display_spec.at(0) == ':') - qws_display_spec = connected_event->display; - - if (!QWSDisplay::initLock(pipe, false)) - qFatal("Cannot get display lock"); - - if (shm.attach(connected_event->simpleData.servershmid)) { - sharedRam = static_cast(shm.address()); - QScreen *s = qt_get_screen(qws_display_id, qws_display_spec.constData()); - if (s) - sharedRamSize += s->memoryNeeded(QLatin1String(qws_display_spec.constData())); - } else { - perror("QWSDisplay::Data::init"); - qFatal("Client can't attach to main ram memory."); - } - - // We wait for creation mainly so that we can process important - // initialization events such as MaxWindowRect that are sent - // before object id creation. Waiting here avoids later window - // resizing since we have the MWR before windows are displayed. - waitForCreation(); - } else -#endif - { - create(30); - - // QWS server - if (!QWSDisplay::initLock(pipe, true)) - qFatal("Cannot get display lock"); - - QScreen *s = qt_get_screen(qws_display_id, qws_display_spec.constData()); - if (s) - sharedRamSize += s->memoryNeeded(QLatin1String(qws_display_spec.constData())); - -#ifndef QT_NO_QWS_MULTIPROCESS - - if (!shm.create(sharedRamSize)) { - perror("Cannot create main ram shared memory\n"); - qFatal("Unable to allocate %d bytes of shared memory", sharedRamSize); - } - qt_servershmid = shm.id(); - sharedRam = static_cast(shm.address()); -#else - sharedRam=static_cast(malloc(sharedRamSize)); -#endif - // Need to zero index count at end of block, might as well zero - // the rest too - memset(sharedRam,0,sharedRamSize); - - QWSIdentifyCommand cmd; - cmd.setId(appName, -1); - qt_server_enqueue(&cmd); - } - - // Allow some memory for the graphics driver too - //### Note that sharedRamSize() has side effects; it must be called - //### once, and only once, and before initDevice() - sharedRamSize -= qt_screen->sharedRamSize(sharedRam+sharedRamSize); - -#ifndef QT_NO_QWS_MULTIPROCESS - if(!csocket) -#endif - { - //QWS server process - if (!qt_screen->initDevice()) - qFatal("Unable to initialize screen driver!"); - } - - sharedRamSize -= sizeof(int); - qt_last_x = reinterpret_cast(sharedRam + sharedRamSize); - sharedRamSize -= sizeof(int); - qt_last_y = reinterpret_cast(sharedRam + sharedRamSize); - - /* Initialise framebuffer memory manager */ - /* Add 4k for luck and to avoid clobbering hardware cursor */ -// int screensize=qt_screen->screenSize(); -// memorymanager=new QMemoryManager(qt_screen->base()+screensize+4096, -// qt_screen->totalSize()-(screensize+4096),0); - -// #ifndef QT_NO_QWS_MULTIPROCESS -// rgnMan = new QWSRegionManager(pipe, csocket); -// #else -// rgnMan = new QWSRegionManager(pipe, 0); //####### not necessary -// #endif -#ifndef QT_NO_QWS_MULTIPROCESS - if (csocket) - csocket->flush(); -#endif -} - - -QWSEvent* QWSDisplay::Data::readMore() -{ -#ifdef QT_NO_QWS_MULTIPROCESS - return incoming.isEmpty() ? 0 : incoming.takeFirst(); -#else - if (!csocket) - return incoming.isEmpty() ? 0 : incoming.takeFirst(); - // read next event - if (!current_event) { - int event_type = qws_read_uint(csocket); - - if (event_type >= 0) { - current_event = QWSEvent::factory(event_type); - } - } - - if (current_event) { - if (current_event->read(csocket)) { - // Finished reading a whole event. - QWSEvent* result = current_event; - current_event = 0; - return result; - } - } - - // Not finished reading a whole event. - return 0; -#endif -} - -void QWSDisplay::Data::fillQueue() -{ - QWSServer::processEventQueue(); - QWSEvent *e = readMore(); -#ifndef QT_NO_QWS_MULTIPROCESS - int bytesAvailable = csocket ? csocket->bytesAvailable() : 0; - int bytesRead = 0; -#endif - while (e) { -#ifndef QT_NO_QWS_MULTIPROCESS - bytesRead += QWS_PROTOCOL_ITEM_SIZE((*e)); -#endif - if (e->type == QWSEvent::Connected) { - connected_event = static_cast(e); - return; - } else if (e->type == QWSEvent::Creation) { - QWSCreationEvent *ce = static_cast(e); - int id = ce->simpleData.objectid; - int count = ce->simpleData.count; - for (int i = 0; i < count; ++i) - unused_identifiers.append(id++); - delete e; - } else if (e->type == QWSEvent::Mouse) { - if (!qt_screen) { - delete e; - } else { - QWSMouseEvent *me = static_cast(e); - if (mouseFilter) - mouseFilter(me); -#ifdef QAPPLICATION_EXTRA_DEBUG - static const char *defaultAction= "INITIAL"; - const char * action = defaultAction; -#endif - delete mouse_event; - if (mouse_winid != me->window () - || mouse_state != me->simpleData.state) { - queue.append(me); - mouse_winid = me->window(); - mouse_state = me->simpleData.state; - mouse_event = 0; -#ifdef QAPPLICATION_EXTRA_DEBUG - mouse_event_count = 0; - action = "ENQUEUE"; -#endif - } else { -#ifdef QAPPLICATION_EXTRA_DEBUG - if (mouse_event) - action = "COMPRESS"; - mouse_event_count++; -#endif - mouse_event = me; - } -#ifdef QAPPLICATION_EXTRA_DEBUG - if (me->simpleData.state !=0 || action != defaultAction || mouse_event_count != 0) - qDebug("fillQueue %s (%d,%d), state %x win %d count %d", action, - me->simpleData.x_root, me->simpleData.y_root, me->simpleData.state, - me->window(), mouse_event_count); -#endif - } -#ifndef QT_NO_QWS_MULTIPROCESS - } else if (e->type == QWSEvent::Region && clientLock) { - // not really an unlock, decrements the semaphore - region_events_count++; - clientLock->unlock(QWSLock::RegionEvent); - queue.append(e); -#endif -#ifndef QT_NO_QWS_PROPERTIES - } else if (e->type == QWSEvent::PropertyReply) { - QWSPropertyReplyEvent *pe = static_cast(e); - int len = pe->simpleData.len; - char *data; - if (len <= 0) { - data = 0; - } else { - data = new char[len]; - memcpy(data, pe->data, len) ; - } - QPaintDevice::qwsDisplay()->getPropertyLen = len; - QPaintDevice::qwsDisplay()->getPropertyData = data; - delete e; -#endif // QT_NO_QWS_PROPERTIES - } else if (e->type==QWSEvent::MaxWindowRect && qt_screen) { - // Process this ASAP, in case new widgets are created (startup) - setMaxWindowRect((static_cast(e))->simpleData.rect); - delete e; -#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION - } else if (e->type == QWSEvent::ScreenTransformation) { - QWSScreenTransformationEvent *pe = static_cast(e); - setScreenTransformation(pe->simpleData.screen, - pe->simpleData.transformation); - delete e; -#endif -#ifndef QT_NO_COP - } else if (e->type == QWSEvent::QCopMessage) { - QWSQCopMessageEvent *pe = static_cast(e); - if (pe->simpleData.is_response) { - qcop_response = pe; - } else { - queue.append(e); - } -#endif - } else { - queue.append(e); - } - //debugQueue(); -#ifndef QT_NO_QWS_MULTIPROCESS - if (csocket && bytesRead >= bytesAvailable) - break; -#endif - e = readMore(); - } -} - -#ifndef QT_NO_QWS_MULTIPROCESS - -static int qws_connection_timeout = 5; - -void QWSDisplay::Data::connectToPipe() -{ - Q_ASSERT(csocket); - - int timeout = qgetenv("QWS_CONNECTION_TIMEOUT").toInt(); - if (timeout) - qws_connection_timeout = timeout; - - const QString pipe = qws_qtePipeFilename(); - int i = 0; - while (!csocket->connectToLocalFile(pipe)) { - if (++i > qws_connection_timeout) { - qWarning("No Qt for Embedded Linux server appears to be running."); - qWarning("If you want to run this program as a server,"); - qWarning("add the \"-qws\" command-line option."); - exit(1); - } - sleep(1); - } -} - -void QWSDisplay::Data::waitForConnection() -{ - connected_event = 0; - - for (int i = 0; i < qws_connection_timeout; i++) { - fillQueue(); - if (connected_event) - return; - csocket->flush(); - csocket->waitForReadyRead(1000); - } - - csocket->flush(); - if (!connected_event) - qFatal("Did not receive a connection event from the qws server"); -} - -void QWSDisplay::Data::waitForRegionAck(int winId) -{ - QWSEvent *ack = 0; - - if (csocket) { // GuiClient - int i = 0; - while (!ack) { - fillQueue(); - - while (i < queue.size()) { - QWSEvent *e = queue.at(i); - if (e->type == QWSEvent::Region && e->window() == winId) { - ack = e; - queue.removeAt(i); - break; - } - ++i; - } - - if (!ack) { - csocket->flush(); - csocket->waitForReadyRead(1000); - } - } - } else { // GuiServer - fillQueue(); - for (int i = 0; i < queue.size(); /* nothing */) { - QWSEvent *e = queue.at(i); - if (e->type == QWSEvent::Region && e->window() == winId) { - ack = e; - queue.removeAt(i); - break; - } - ++i; - } - if (!ack) // already processed - return; - } - - Q_ASSERT(ack); - - qApp->qwsProcessEvent(ack); - delete ack; - region_events_count--; -} - -void QWSDisplay::Data::waitForRegionEvents(int winId, bool ungrabDisplay) -{ - if (!clientLock) - return; - - int removedEventsCount = 0; - - // fill queue with unreceived region events - if (!clientLock->hasLock(QWSLock::RegionEvent)) { - bool ungrabbed = false; - if (ungrabDisplay && QWSDisplay::grabbed()) { - QWSDisplay::ungrab(); - ungrabbed = true; - } - - for (;;) { - fillQueue(); - if (clientLock->hasLock(QWSLock::RegionEvent)) - break; - csocket->flush(); - csocket->waitForReadyRead(1000); - } - - if (ungrabbed) - QWSDisplay::grab(true); - } - - // check the queue for pending region events - QWSEvent *regionEvent = 0; - for (int i = 0; i < queue.size(); /* nothing */) { - QWSEvent *e = queue.at(i); - if (e->type == QWSEvent::Region && e->window() == winId) { - QWSRegionEvent *re = static_cast(e); - if (re->simpleData.type == QWSRegionEvent::Allocation) { - delete regionEvent; - regionEvent = re; - } - queue.removeAt(i); - removedEventsCount++; - } else { - ++i; - } - } - - if (regionEvent) { - qApp->qwsProcessEvent(regionEvent); - delete regionEvent; - } - region_events_count -= removedEventsCount; -} - -bool QWSDisplay::Data::hasPendingRegionEvents() const -{ - if (clientLock && !clientLock->hasLock(QWSLock::RegionEvent)) - return true; - - return region_events_count > 0; -} - -#endif // QT_NO_QWS_MULTIPROCESS - -void QWSDisplay::Data::waitForCreation() -{ - fillQueue(); -#ifndef QT_NO_QWS_MULTIPROCESS - while (unused_identifiers.count() == 0) { - if (csocket) { - csocket->flush(); - csocket->waitForReadyRead(1000); - } - fillQueue(); - } -#endif -} - - -#ifndef QT_NO_QWS_MULTIPROCESS -void QWSDisplay::Data::waitForPropertyReply() -{ - if (!csocket) - return; - fillQueue(); - while (qt_fbdpy->getPropertyLen == -2) { - csocket->flush(); - csocket->waitForReadyRead(1000); - fillQueue(); - } -} -#endif - -#ifndef QT_NO_COP -void QWSDisplay::Data::waitForQCopResponse() -{ - for (;;) { - fillQueue(); - if (qcop_response) - break; -#ifndef QT_NO_QWS_MULTIPROCESS - if (csocket) { - csocket->flush(); - csocket->waitForReadyRead(1000); - } -#endif - } - queue.prepend(qcop_response); - qcop_response = 0; -} -#endif - -/*! - \class QWSDisplay - \brief The QWSDisplay class provides a display for QWS; it is an internal class. - - \internal - - \ingroup qws -*/ - -QWSDisplay::QWSDisplay() -{ - d = new Data(0, qws_single_process); -} - -QWSDisplay::~QWSDisplay() -{ - delete d; - delete lock; - lock = 0; -} - -bool QWSDisplay::grabbed() -{ - return lock->locked(); -} - -void QWSDisplay::grab() -{ - lock->lock(QLock::Read); -} - -void QWSDisplay::grab(bool write) -{ - lock->lock(write ? QLock::Write : QLock::Read); - -} -void QWSDisplay::ungrab() -{ - lock->unlock(); -} - -#if 0 -QWSRegionManager *QWSDisplay::regionManager() const -{ - return d->rgnMan; -} -#endif - -bool QWSDisplay::eventPending() const -{ -#ifndef QT_NO_QWS_MULTIPROCESS - d->flush(); -#endif - d->fillQueue(); - return d->queueNotEmpty(); -} - - -/* - Caller must delete return value! - */ -QWSEvent *QWSDisplay::getEvent() -{ - d->fillQueue(); - Q_ASSERT(d->queueNotEmpty()); - QWSEvent* e = d->dequeue(); - - return e; -} - -uchar* QWSDisplay::frameBuffer() const { return qt_screen->base(); } -int QWSDisplay::width() const { return qt_screen->width(); } -int QWSDisplay::height() const { return qt_screen->height(); } -int QWSDisplay::depth() const { return qt_screen->depth(); } -int QWSDisplay::pixmapDepth() const { return qt_screen->pixmapDepth(); } -bool QWSDisplay::supportsDepth(int depth) const { return qt_screen->supportsDepth(depth); } -uchar *QWSDisplay::sharedRam() const { return d->sharedRam; } -int QWSDisplay::sharedRamSize() const { return d->sharedRamSize; } - -#ifndef QT_NO_QWS_PROPERTIES - -void QWSDisplay::addProperty(int winId, int property) -{ - QWSAddPropertyCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.property = property; - d->sendCommand(cmd); -} - -void QWSDisplay::setProperty(int winId, int property, int mode, const QByteArray &data) -{ - QWSSetPropertyCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.property = property; - cmd.simpleData.mode = mode; - cmd.setData(data.constData(), data.size()); - d->sendCommand(cmd); -} - -void QWSDisplay::setProperty(int winId, int property, int mode, - const char * data) -{ - QWSSetPropertyCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.property = property; - cmd.simpleData.mode = mode; - cmd.setData(data, strlen(data)); - d->sendCommand(cmd); -} - -void QWSDisplay::removeProperty(int winId, int property) -{ - QWSRemovePropertyCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.property = property; - d->sendCommand(cmd); -} - -/* - It is the caller's responsibility to delete[] \a data. - */ -bool QWSDisplay::getProperty(int winId, int property, char *&data, int &len) -{ - if (d->directServerConnection()) { - const char *propertyData; - bool retval = qwsServer->d_func()->get_property(winId, property, propertyData, len); - if (len <= 0) { - data = 0; - } else { - data = new char[len]; - memcpy(data, propertyData, len) ; - } - return retval; - } - QWSGetPropertyCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.property = property; - d->sendCommand(cmd); - - getPropertyLen = -2; - getPropertyData = 0; - -#ifndef QT_NO_QWS_MULTIPROCESS - d->waitForPropertyReply(); -#endif - - len = getPropertyLen; - data = getPropertyData; - - getPropertyLen = -2; - getPropertyData = 0; - - return len != -1; -} - -#endif // QT_NO_QWS_PROPERTIES - -void QWSDisplay::setAltitude(int winId, int alt, bool fixed) -{ - QWSChangeAltitudeCommand cmd; -#ifdef QT_DEBUG - memset(cmd.simpleDataPtr, 0, sizeof(cmd.simpleData)); //shut up Valgrind -#endif - cmd.simpleData.windowid = winId; - cmd.simpleData.altitude = QWSChangeAltitudeCommand::Altitude(alt); - cmd.simpleData.fixed = fixed; - if (d->directServerConnection()) { - qwsServer->d_func()->set_altitude(&cmd); - } else { - d->sendSynchronousCommand(cmd); - } -} - -void QWSDisplay::setOpacity(int winId, int opacity) -{ - QWSSetOpacityCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.opacity = opacity; - if (d->directServerConnection()) { - qwsServer->d_func()->set_opacity(&cmd); - } else { - d->sendCommand(cmd); - } -} - - - -void QWSDisplay::requestFocus(int winId, bool get) -{ - QWSRequestFocusCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.flag = get; - if (d->directServerConnection()) - qwsServer->d_func()->request_focus(&cmd); - else - d->sendCommand(cmd); -} - -void QWSDisplay::setIdentity(const QString &appName) -{ - QWSIdentifyCommand cmd; -#ifdef QT_NO_QWS_MULTIPROCESS - const int id = -1; -#else - const int id = QWSDisplay::Data::clientLock ? QWSDisplay::Data::clientLock->id() : -1; -#endif - cmd.setId(appName, id); - if (d->directServerConnection()) - qwsServer->d_func()->set_identity(&cmd); - else - d->sendCommand(cmd); -} - -void QWSDisplay::nameRegion(int winId, const QString& n, const QString &c) -{ - QWSRegionNameCommand cmd; - cmd.simpleData.windowid = winId; - cmd.setName(n, c); - if (d->directServerConnection()) - qwsServer->d_func()->name_region(&cmd); - else - d->sendCommand(cmd); -} - -void QWSDisplay::requestRegion(int winId, const QString &surfaceKey, - const QByteArray &surfaceData, - const QRegion ®ion) -{ - if (d->directServerConnection()) { - qwsServer->d_func()->request_region(winId, surfaceKey, - surfaceData, region); - } else { - QWSRegionCommand cmd; - cmd.setData(winId, surfaceKey, surfaceData, region); - d->sendSynchronousCommand(cmd); - } -} - -void QWSDisplay::repaintRegion(int winId, int windowFlags, bool opaque, QRegion r) -{ - if (d->directServerConnection()) { - qwsServer->d_func()->repaint_region(winId, windowFlags, opaque, r); - } else { - QVector ra = r.rects(); - - /* - for (int i = 0; i < ra.size(); i++) { - QRect r(ra[i]); - qDebug("rect: %d %d %d %d", r.x(), r.y(), r.right(), r.bottom()); - } - */ - - QWSRepaintRegionCommand cmd; - /* XXX QWSRegionCommand is padded out in a compiler dependent way. - Zeroed out to avoid valgrind reporting uninitialized memory usage. - */ -#ifdef QT_DEBUG - memset(cmd.simpleDataPtr, 0, sizeof(cmd.simpleData)); //shut up Valgrind -#endif - cmd.simpleData.windowid = winId; - cmd.simpleData.windowFlags = windowFlags; - cmd.simpleData.opaque = opaque; - cmd.simpleData.nrectangles = ra.count(); - cmd.setData(reinterpret_cast(ra.constData()), - ra.count() * sizeof(QRect), false); - - d->sendSynchronousCommand(cmd); - } -} - - -void QWSDisplay::moveRegion(int winId, int dx, int dy) -{ - QWSRegionMoveCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.dx = dx; - cmd.simpleData.dy = dy; - - if (d->directServerConnection()) { - qwsServer->d_func()->move_region(&cmd); - } else { - d->sendSynchronousCommand(cmd); - } -// d->offsetPendingExpose(winId, QPoint(cmd.simpleData.dx, cmd.simpleData.dy)); -} - -void QWSDisplay::destroyRegion(int winId) -{ - QWSRegionDestroyCommand cmd; - cmd.simpleData.windowid = winId; - if (d->directServerConnection()) { - qwsServer->d_func()->destroy_region(&cmd); - } else { - d->sendCommand(cmd); - } -} - -#ifndef QT_NO_QWS_INPUTMETHODS - -void QWSDisplay::sendIMUpdate(int type, int winId, int widgetid) -{ - QWSIMUpdateCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.widgetid = widgetid; - - cmd.simpleData.type = type; - - if (d->directServerConnection()) { - qwsServer->d_func()->im_update(&cmd); - } else { - d->sendCommand(cmd); - } -} - -void QWSDisplay::sendIMResponse(int winId, int property, const QVariant &result) -{ - QWSIMResponseCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.property = property; - - cmd.setResult(result); - - if (d->directServerConnection()) { - qwsServer->d_func()->im_response(&cmd); - } else { - d->sendCommand(cmd); - } -} - -void QWSDisplay::resetIM() -{ - sendIMUpdate(QWSInputMethod::Reset, -1, -1); -} - -void QWSDisplay::sendIMMouseEvent(int index, bool isPress) -{ - QWSIMMouseCommand cmd; - cmd.simpleData.index = index; - cmd.simpleData.state = isPress ? QWSServer::MousePress : QWSServer::MouseRelease; - if (d->directServerConnection()) { - qwsServer->d_func()->send_im_mouse(&cmd); - } else { - d->sendCommand(cmd); - } -} - -#endif - -int QWSDisplay::takeId() -{ - return d->takeId(); -} - -bool QWSDisplay::initLock(const QString &filename, bool create) -{ - if (!lock) { - lock = new QLock(filename, 'd', create); - - if (!lock->isValid()) { - delete lock; - lock = 0; - return false; - } - } - - return true; -} - -void QWSDisplay::setSelectionOwner(int winId, const QTime &time) -{ - QWSSetSelectionOwnerCommand cmd; - cmd.simpleData.windowid = winId; - cmd.simpleData.hour = time.hour(); - cmd.simpleData.minute = time.minute(); - cmd.simpleData.sec = time.second(); - cmd.simpleData.ms = time.msec(); - d->sendCommand(cmd); -} - -void QWSDisplay::convertSelection(int winId, int selectionProperty, const QString &mimeTypes) -{ -#ifdef QT_NO_QWS_PROPERTIES - Q_UNUSED(mimeTypes); -#else - // ### we need the atom/property thingy like in X here - addProperty(winId, QT_QWS_PROPERTY_CONVERTSELECTION); - setProperty(winId, QT_QWS_PROPERTY_CONVERTSELECTION, - int(QWSPropertyManager::PropReplace), mimeTypes.toLatin1()); -#endif - QWSConvertSelectionCommand cmd; - cmd.simpleData.requestor = winId; - cmd.simpleData.selection = selectionProperty; - cmd.simpleData.mimeTypes = QT_QWS_PROPERTY_CONVERTSELECTION; - d->sendCommand(cmd); -} - -void QWSDisplay::defineCursor(int id, const QBitmap &curs, const QBitmap &mask, - int hotX, int hotY) -{ - const QImage cursImg = curs.toImage().convertToFormat(QImage::Format_MonoLSB); - const QImage maskImg = mask.toImage().convertToFormat(QImage::Format_MonoLSB); - - QWSDefineCursorCommand cmd; - cmd.simpleData.width = curs.width(); - cmd.simpleData.height = curs.height(); - cmd.simpleData.hotX = hotX; - cmd.simpleData.hotY = hotY; - cmd.simpleData.id = id; - - - // must copy each scanline since there might be gaps between them - const int height = curs.height(); - const int width = curs.width(); - const int dst_bpl = (width + 7) / 8; - - int dataLen = dst_bpl * height; - uchar *data = new uchar[dataLen*2]; - uchar *dst = data; - - int src_bpl = cursImg.bytesPerLine(); - const uchar *cursSrc = cursImg.bits(); - for (int i = 0; i < height; ++i) { - memcpy(dst, cursSrc + i*src_bpl, dst_bpl); - dst += dst_bpl; - } - - src_bpl = maskImg.bytesPerLine(); - const uchar *maskSrc = maskImg.bits(); - for (int i = 0; i < height; ++i) { - memcpy(dst, maskSrc + i*src_bpl, dst_bpl); - dst += dst_bpl; - } - - cmd.setData(reinterpret_cast(data), dataLen*2); - delete [] data; - d->sendCommand(cmd); -} - -void QWSDisplay::destroyCursor(int id) -{ - QWSDefineCursorCommand cmd; - cmd.simpleData.width = 0; - cmd.simpleData.height = 0; - cmd.simpleData.hotX = 0; - cmd.simpleData.hotY = 0; - cmd.simpleData.id = id; - cmd.setData(0, 0); - - d->sendCommand(cmd); -} - -#ifndef QT_NO_SOUND -void QWSDisplay::playSoundFile(const QString& f) -{ - QWSPlaySoundCommand cmd; - cmd.setFileName(f); - d->sendCommand(cmd); -} -#endif - -#ifndef QT_NO_COP -void QWSDisplay::registerChannel(const QString& channel) -{ - QWSQCopRegisterChannelCommand reg; - reg.setChannel(channel); - qt_fbdpy->d->sendCommand(reg); -} - -void QWSDisplay::sendMessage(const QString &channel, const QString &msg, - const QByteArray &data) -{ - QWSQCopSendCommand com; - com.setMessage(channel, msg, data); - qt_fbdpy->d->sendCommand(com); -} - -void QWSDisplay::flushCommands() -{ - qt_fbdpy->d->flushCommands(); -} - -/* - caller deletes result -*/ -QWSQCopMessageEvent* QWSDisplay::waitForQCopResponse() -{ - qt_fbdpy->d->waitForQCopResponse(); - QWSQCopMessageEvent *e = static_cast(qt_fbdpy->d->dequeue()); - Q_ASSERT(e->type == QWSEvent::QCopMessage); - return e; -} -#endif - -void QWSDisplay::sendFontCommand(int type, const QByteArray &fontName) -{ - QWSFontCommand cmd; - cmd.simpleData.type = type; - cmd.setFontName(fontName); - d->sendCommand(cmd); -} - -void QWSDisplay::setWindowCaption(QWidget *w, const QString &c) -{ - if (w->isWindow()) { - nameRegion(w->internalWinId(), w->objectName(), c); - static_cast(w)->repaintDecoration(qApp->desktop()->rect(), true); - } -} - -void QWSDisplay::selectCursor(QWidget *w, unsigned int cursId) -{ - if (cursId != qt_last_cursor) - { - QWidget *top = w->window(); - qt_last_cursor = cursId; - QWSSelectCursorCommand cmd; - cmd.simpleData.windowid = top->internalWinId(); - cmd.simpleData.id = cursId; - d->sendCommand(cmd); - d->flush(); - } -} - -void QWSDisplay::setCursorPosition(int x, int y) -{ - QWSPositionCursorCommand cmd; - cmd.simpleData.newX = x; - cmd.simpleData.newY = y; - d->sendCommand(cmd); - d->flush(); -} - -void QWSDisplay::grabMouse(QWidget *w, bool grab) -{ - QWidget *top = w->window(); - QWSGrabMouseCommand cmd; -#ifdef QT_DEBUG - memset(cmd.simpleDataPtr, 0, sizeof(cmd.simpleData)); //shut up Valgrind -#endif - cmd.simpleData.windowid = top->winId(); - cmd.simpleData.grab = grab; - d->sendCommand(cmd); - d->flush(); -} - -void QWSDisplay::grabKeyboard(QWidget *w, bool grab) -{ - QWidget *top = w->window(); - QWSGrabKeyboardCommand cmd; -#ifdef QT_DEBUG - memset(cmd.simpleDataPtr, 0, sizeof(cmd.simpleData)); //shut up Valgrind -#endif - cmd.simpleData.windowid = top->winId(); - cmd.simpleData.grab = grab; - d->sendCommand(cmd); - d->flush(); -} - -QList QWSDisplay::windowList() -{ - QList ret; - if(d->directServerConnection()) { - QList * qin=QWSServer::windowList(); - for (int i = 0; i < qin->count(); ++i) { - QWSInternalWindowInfo * qwi = qin->at(i); - QWSWindowInfo tmp; - tmp.winid = qwi->winid; - tmp.clientid = qwi->clientid; - tmp.name = QString(qwi->name); - ret.append(tmp); - } - qDeleteAll(*qin); - delete qin; - } - return ret; -} - -int QWSDisplay::windowAt(const QPoint &p) -{ - //### currently only implemented for the server process - int ret = 0; - if(d->directServerConnection()) { - QWSWindow *win = qwsServer->windowAt(p); - if (win) - return win->winId(); - } - return ret; -} - -void QWSDisplay::setRawMouseEventFilter(void (*filter)(QWSMouseEvent *)) -{ - if (qt_fbdpy) - qt_fbdpy->d->setMouseFilter(filter); -} - -/*! - \relates QScreen - - Here it is. \a transformation and \a screenNo - */ -void QWSDisplay::setTransformation(int transformation, int screenNo) -{ - QWSScreenTransformCommand cmd; - cmd.setTransformation(screenNo, transformation); - QWSDisplay::instance()->d->sendCommand(cmd); -} - -static bool qt_try_modal(QWidget *, QWSEvent *); - -/***************************************************************************** - qt_init() - initializes Qt/FB - *****************************************************************************/ - -static void qt_set_qws_resources() - -{ - if (QApplication::desktopSettingsAware()) - QApplicationPrivate::qws_apply_settings(); - - if (appFont) - QApplication::setFont(QFont(QString::fromLocal8Bit(appFont))); - - if (appBGCol || appBTNCol || appFGCol) { - (void) QApplication::style(); // trigger creation of application style and system palettes - QColor btn; - QColor bg; - QColor fg; - if (appBGCol) - bg = QColor(appBGCol); - else - bg = QApplicationPrivate::sys_pal->color(QPalette::Window); - if (appFGCol) - fg = QColor(appFGCol); - else - fg = QApplicationPrivate::sys_pal->color(QPalette::WindowText); - if (appBTNCol) - btn = QColor(appBTNCol); - else - btn = QApplicationPrivate::sys_pal->color(QPalette::Button); - - int h,s,v; - fg.getHsv(&h,&s,&v); - QColor base = Qt::white; - bool bright_mode = false; - if (v >= 255 - 50) { - base = btn.darker(150); - bright_mode = true; - } - - QPalette pal(fg, btn, btn.lighter(), btn.darker(), btn.darker(150), fg, Qt::white, base, bg); - if (bright_mode) { - pal.setColor(QPalette::HighlightedText, base); - pal.setColor(QPalette::Highlight, Qt::white); - } else { - pal.setColor(QPalette::HighlightedText, Qt::white); - pal.setColor(QPalette::Highlight, Qt::darkBlue); - } - QColor disabled((fg.red() + btn.red()) / 2, - (fg.green() + btn.green())/ 2, - (fg.blue() + btn.blue()) / 2); - pal.setColorGroup(QPalette::Disabled, disabled, btn, btn.lighter(125), - btn.darker(), btn.darker(150), disabled, Qt::white, Qt::white, bg); - if (bright_mode) { - pal.setColor(QPalette::Disabled, QPalette::HighlightedText, base); - pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::white); - } else { - pal.setColor(QPalette::Disabled, QPalette::HighlightedText, Qt::white); - pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::darkBlue); - } - QApplicationPrivate::setSystemPalette(pal); - - } -} - -void QApplicationPrivate::initializeWidgetPaletteHash() -{ -} - -/*! \internal - apply the settings to the application -*/ -bool QApplicationPrivate::qws_apply_settings() -{ -#ifndef QT_NO_SETTINGS - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("Qt")); - - QStringList strlist; - int i; - QPalette pal(Qt::black); - int groupCount = 0; - strlist = settings.value(QLatin1String("Palette/active")).toStringList(); - if (strlist.count() == QPalette::NColorRoles) { - ++groupCount; - for (i = 0; i < QPalette::NColorRoles; i++) - pal.setColor(QPalette::Active, (QPalette::ColorRole) i, - QColor(strlist[i])); - } - strlist = settings.value(QLatin1String("Palette/inactive")).toStringList(); - if (strlist.count() == QPalette::NColorRoles) { - ++groupCount; - for (i = 0; i < QPalette::NColorRoles; i++) - pal.setColor(QPalette::Inactive, (QPalette::ColorRole) i, - QColor(strlist[i])); - } - strlist = settings.value(QLatin1String("Palette/disabled")).toStringList(); - if (strlist.count() == QPalette::NColorRoles) { - ++groupCount; - for (i = 0; i < QPalette::NColorRoles; i++) - pal.setColor(QPalette::Disabled, (QPalette::ColorRole) i, - QColor(strlist[i])); - } - - - if (groupCount == QPalette::NColorGroups) - QApplicationPrivate::setSystemPalette(pal); - - QString str = settings.value(QLatin1String("font")).toString(); - if (!str.isEmpty()) { - QFont font(QApplication::font()); - font.fromString(str); - QApplicationPrivate::setSystemFont(font); - } - - // read library (ie. plugin) path list - QString libpathkey = - QString::fromLatin1("%1.%2/libraryPath") - .arg(QT_VERSION >> 16) - .arg((QT_VERSION & 0xff00) >> 8); - QStringList pathlist = settings.value(libpathkey).toString().split(QLatin1Char(':')); -#ifndef QT_NO_LIBRARY - if (! pathlist.isEmpty()) { - QStringList::ConstIterator it = pathlist.constBegin(); - while (it != pathlist.constEnd()) - QApplication::addLibraryPath(*it++); - } -#endif - - // read new QStyle - QString stylename = settings.value(QLatin1String("style")).toString(); - if (QCoreApplication::startingUp()) { - if (!stylename.isEmpty() && QApplicationPrivate::styleOverride.isNull()) - QApplicationPrivate::styleOverride = stylename; - } else { - QApplication::setStyle(stylename); - } - - int num = - settings.value(QLatin1String("doubleClickInterval"), - QApplication::doubleClickInterval()).toInt(); - QApplication::setDoubleClickInterval(num); - - num = - settings.value(QLatin1String("cursorFlashTime"), - QApplication::cursorFlashTime()).toInt(); - QApplication::setCursorFlashTime(num); - -#ifndef QT_NO_WHEELEVENT - num = - settings.value(QLatin1String("wheelScrollLines"), - QApplication::wheelScrollLines()).toInt(); - QApplication::setWheelScrollLines(num); -#endif - - QString colorspec = settings.value(QLatin1String("colorSpec"), - QVariant(QLatin1String("default"))).toString(); - if (colorspec == QLatin1String("normal")) - QApplication::setColorSpec(QApplication::NormalColor); - else if (colorspec == QLatin1String("custom")) - QApplication::setColorSpec(QApplication::CustomColor); - else if (colorspec == QLatin1String("many")) - QApplication::setColorSpec(QApplication::ManyColor); - else if (colorspec != QLatin1String("default")) - colorspec = QLatin1String("default"); - -#ifndef QT_NO_TEXTCODEC - QString defaultcodec = settings.value(QLatin1String("defaultCodec"), - QVariant(QLatin1String("none"))).toString(); - if (defaultcodec != QLatin1String("none")) { - QTextCodec *codec = QTextCodec::codecForName(defaultcodec.toLatin1()); - if (codec) - QTextCodec::setCodecForTr(codec); - } -#endif - - int w = settings.value(QLatin1String("globalStrut/width")).toInt(); - int h = settings.value(QLatin1String("globalStrut/height")).toInt(); - QSize strut(w, h); - if (strut.isValid()) - QApplication::setGlobalStrut(strut); - - QStringList effects = settings.value(QLatin1String("GUIEffects")).toStringList(); - QApplication::setEffectEnabled(Qt::UI_General, - effects.contains(QLatin1String("general"))); - QApplication::setEffectEnabled(Qt::UI_AnimateMenu, - effects.contains(QLatin1String("animatemenu"))); - QApplication::setEffectEnabled(Qt::UI_FadeMenu, - effects.contains(QLatin1String("fademenu"))); - QApplication::setEffectEnabled(Qt::UI_AnimateCombo, - effects.contains(QLatin1String("animatecombo"))); - QApplication::setEffectEnabled(Qt::UI_AnimateTooltip, - effects.contains(QLatin1String("animatetooltip"))); - QApplication::setEffectEnabled(Qt::UI_FadeTooltip, - effects.contains(QLatin1String("fadetooltip"))); - QApplication::setEffectEnabled(Qt::UI_AnimateToolBox, - effects.contains(QLatin1String("animatetoolbox"))); - - settings.beginGroup(QLatin1String("Font Substitutions")); - QStringList fontsubs = settings.childKeys(); - if (!fontsubs.isEmpty()) { - QStringList::Iterator it = fontsubs.begin(); - for (; it != fontsubs.end(); ++it) { - QString fam = *it; - QStringList subs = settings.value(fam).toStringList(); - QFont::insertSubstitutions(fam, subs); - } - } - settings.endGroup(); - - settings.endGroup(); // Qt - - settings.beginGroup(QLatin1String("QWS Font Fallbacks")); - if (!settings.childKeys().isEmpty()) { - // from qfontdatabase_qws.cpp - extern void qt_applyFontDatabaseSettings(const QSettings &); - qt_applyFontDatabaseSettings(settings); - } - settings.endGroup(); - - return true; -#else - return false; -#endif // QT_NO_SETTINGS -} - - - -static void init_display() -{ - if (qt_fbdpy) return; // workaround server==client case - - // Connect to FB server - qt_fbdpy = new QWSDisplay(); - - // Get display parameters - // Set paintdevice parameters - // XXX initial info sent from server - // Misc. initialization - - QColormap::initialize(); - QFont::initialize(); -#ifndef QT_NO_CURSOR - QCursorData::initialize(); -#endif - - qApp->setObjectName(appName); - - if (!QApplicationPrivate::sys_font) { -#ifdef QT_NO_FREETYPE - QFont f = QFont(QLatin1String("helvetica"), 10); -#else - QFont f = QFont(QLatin1String("DejaVu Sans"), 12); -#endif - QApplicationPrivate::setSystemFont(f); - } - qt_set_qws_resources(); -} - -void qt_init_display() -{ - qt_is_gui_used = true; - qws_single_process = true; - init_display(); -} - -static bool read_bool_env_var(const char *var, bool defaultvalue) -{ - // returns true if env variable is set to non-zero - // returns false if env var is set to zero - // returns defaultvalue if env var not set - char *x = ::getenv(var); - return (x && *x) ? (strcmp(x,"0") != 0) : defaultvalue; -} - -static int read_int_env_var(const char *var, int defaultvalue) -{ - bool ok; - int r = qgetenv(var).toInt(&ok); - return ok ? r : defaultvalue; -} - -void qt_init(QApplicationPrivate *priv, int type) -{ -#ifdef QT_NO_QWS_MULTIPROCESS - if (type == QApplication::GuiClient) - type = QApplication::GuiServer; -#endif - if (type == QApplication::GuiServer) - qt_is_gui_used = false; //we'll turn it on in a second - qws_sw_cursor = read_bool_env_var("QWS_SW_CURSOR",qws_sw_cursor); - qws_screen_is_interlaced = read_bool_env_var("QWS_INTERLACE",false); - - const char *display = ::getenv("QWS_DISPLAY"); - if (display) - qws_display_spec = display; // since we setenv later! - - //qws_savefonts = qgetenv("QWS_SAVEFONTS") != 0; - //qws_shared_memory = qgetenv("QWS_NOSHARED") == 0; - - mouse_double_click_distance = read_int_env_var("QWS_DBLCLICK_DISTANCE", 5); - - priv->inputContext = 0; - - int flags = 0; - char *p; - int argc = priv->argc; - char **argv = priv->argv; - int j; - - // Set application name - - 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]); - } - - // Get command line params - - j = argc ? 1 : 0; - QString decoration; - for (int i=1; iargc) { - priv->argv[j] = 0; - priv->argc = j; - } - - mouseInWidget = new QPointer; - - const QString disp = QString::fromLatin1(qws_display_spec); - QRegExp regexp(QLatin1String(":(\\d+)$")); - if (regexp.lastIndexIn(disp) != -1) { - const QString capture = regexp.cap(1); - bool ok = false; - int id = capture.toInt(&ok); - if (ok) - qws_display_id = id; - } - - if (type == QApplication::GuiServer) { - qt_appType = QApplication::Type(type); - qws_single_process = true; - QWSServer::startup(flags); - if (!display) // if not already set - qputenv("QWS_DISPLAY", qws_display_spec); - } - - if(qt_is_gui_used) { - init_display(); -#ifndef QT_NO_QWS_MANAGER - if (decoration.isEmpty() && !qws_decoration) { - const QStringList keys = QDecorationFactory::keys(); - if (!keys.isEmpty()) - decoration = keys.first(); - } - if (!decoration.isEmpty()) - qws_decoration = QApplication::qwsSetDecoration(decoration); -#endif // QT_NO_QWS_MANAGER -#ifndef QT_NO_QWS_INPUTMETHODS - qApp->setInputContext(new QWSInputContext(qApp)); -#endif - } - -/*### convert interlace style - if (qws_screen_is_interlaced) - QApplication::setStyle(new QInterlaceStyle); -*/ -} - -/***************************************************************************** - qt_cleanup() - cleans up when the application is finished - *****************************************************************************/ - -void qt_cleanup() -{ - QPixmapCache::clear(); -#ifndef QT_NO_CURSOR - QCursorData::cleanup(); -#endif - QFont::cleanup(); - QColormap::cleanup(); - - if (qws_single_process) { - QWSServer::closedown(); - } - - qDeleteAll(outgoing); - outgoing.clear(); - qDeleteAll(incoming); - incoming.clear(); - - if (qt_is_gui_used) { - delete qt_fbdpy; - } - qt_fbdpy = 0; - -#ifndef QT_NO_QWS_MANAGER - delete qws_decoration; - qws_decoration = 0; -#endif - - delete mouseInWidget; - mouseInWidget = 0; - -#if !defined(QT_NO_IM) - delete QApplicationPrivate::inputContext; - QApplicationPrivate::inputContext = 0; -#endif -} - - -/***************************************************************************** - Platform specific global and internal functions - *****************************************************************************/ - -QString QApplicationPrivate::appName() const // get application name -{ - return QT_PREPEND_NAMESPACE(appName); -} - -/***************************************************************************** - Platform specific QApplication members - *****************************************************************************/ - -#define NoValue 0x0000 -#define XValue 0x0001 -#define YValue 0x0002 -#define WidthValue 0x0004 -#define HeightValue 0x0008 -#define AllValues 0x000F -#define XNegative 0x0010 -#define YNegative 0x0020 - -/* Copyright notice for ReadInteger and parseGeometry - -Copyright (c) 1985, 1986, 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from the X Consortium. - -*/ -/* - * XParseGeometry parses strings of the form - * "=x{+-}{+-}", where - * width, height, xoffset, and yoffset are unsigned integers. - * Example: "=80x24+300-49" - * The equal sign is optional. - * It returns a bitmask that indicates which of the four values - * were actually found in the string. For each value found, - * the corresponding argument is updated; for each value - * not found, the corresponding argument is left unchanged. - */ - -static int -ReadInteger(char *string, char **NextString) -{ - register int Result = 0; - int Sign = 1; - - if (*string == '+') - string++; - else if (*string == '-') - { - string++; - Sign = -1; - } - for (; (*string >= '0') && (*string <= '9'); string++) - { - Result = (Result * 10) + (*string - '0'); - } - *NextString = string; - if (Sign >= 0) - return Result; - else - return -Result; -} - -static int parseGeometry(const char* string, - int* x, int* y, int* width, int* height) -{ - int mask = NoValue; - register char *strind; - unsigned int tempWidth=0, tempHeight=0; - int tempX=0, tempY=0; - char *nextCharacter; - - if (!string || (*string == '\0')) return mask; - if (*string == '=') - string++; /* ignore possible '=' at beg of geometry spec */ - - strind = const_cast(string); - if (*strind != '+' && *strind != '-' && *strind != 'x') { - tempWidth = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return 0; - strind = nextCharacter; - mask |= WidthValue; - } - - if (*strind == 'x' || *strind == 'X') { - strind++; - tempHeight = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return 0; - strind = nextCharacter; - mask |= HeightValue; - } - - if ((*strind == '+') || (*strind == '-')) { - if (*strind == '-') { - strind++; - tempX = -ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return 0; - strind = nextCharacter; - mask |= XNegative; - - } - else - { strind++; - tempX = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return 0; - strind = nextCharacter; - } - mask |= XValue; - if ((*strind == '+') || (*strind == '-')) { - if (*strind == '-') { - strind++; - tempY = -ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return 0; - strind = nextCharacter; - mask |= YNegative; - - } - else - { - strind++; - tempY = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return 0; - strind = nextCharacter; - } - mask |= YValue; - } - } - - /* If strind isn't at the end of the string then it's an invalid - geometry specification. */ - - if (*strind != '\0') return 0; - - if (mask & XValue) - *x = tempX; - if (mask & YValue) - *y = tempY; - if (mask & WidthValue) - *width = tempWidth; - if (mask & HeightValue) - *height = tempHeight; - return mask; -} - -#ifdef QT3_SUPPORT -void QApplication::setMainWidget(QWidget *mainWidget) -{ - QApplicationPrivate::main_widget = mainWidget; - if (QApplicationPrivate::main_widget) // give WM command line - QApplicationPrivate::applyQWSSpecificCommandLineArguments(QApplicationPrivate::main_widget); -} -#endif - -void QApplicationPrivate::applyQWSSpecificCommandLineArguments(QWidget *main_widget) -{ - static bool beenHereDoneThat = false; - if (beenHereDoneThat) - return; - beenHereDoneThat = true; - if (qApp->windowIcon().isNull() && main_widget->testAttribute(Qt::WA_SetWindowIcon)) - qApp->setWindowIcon(main_widget->windowIcon()); - if (mwTitle) // && main_widget->windowTitle().isEmpty()) - main_widget->setWindowTitle(QString::fromLocal8Bit(mwTitle)); - if (mwGeometry) { // parse geometry - int x = 0; - int y = 0; - int w = 0; - int h = 0; - int m = parseGeometry(mwGeometry, &x, &y, &w, &h); - QSize minSize = main_widget->minimumSize(); - QSize maxSize = main_widget->maximumSize(); - if ((m & XValue) == 0) - x = main_widget->geometry().x(); - if ((m & YValue) == 0) - y = main_widget->geometry().y(); - if ((m & WidthValue) == 0) - w = main_widget->width(); - if ((m & HeightValue) == 0) - h = main_widget->height(); - w = qMin(w,maxSize.width()); - h = qMin(h,maxSize.height()); - w = qMax(w,minSize.width()); - h = qMax(h,minSize.height()); - if ((m & XNegative)) { - x = qApp->desktop()->width() + x - w; - x -= (main_widget->frameGeometry().width() - main_widget->width()) / 2; - } else { - x += (main_widget->geometry().x() - main_widget->x()); - } - if ((m & YNegative)) { - y = qApp->desktop()->height() + y - h; - } else { - y += (main_widget->geometry().y() - main_widget->y()); - } - - main_widget->setGeometry(x, y, w, h); - } -} - -/***************************************************************************** - QApplication cursor stack - *****************************************************************************/ -#ifndef QT_NO_CURSOR -void QApplication::setOverrideCursor(const QCursor &cursor) -{ - qApp->d_func()->cursor_list.prepend(cursor); - - QWidget *w = QWidget::mouseGrabber(); - if (!w && qt_last_x) - w = topLevelAt(*qt_last_x, *qt_last_y); - if (!w) - w = desktop(); - QPaintDevice::qwsDisplay()->selectCursor(w, qApp->d_func()->cursor_list.first().handle()); -} - -void QApplication::restoreOverrideCursor() -{ - if (qApp->d_func()->cursor_list.isEmpty()) - return; - qApp->d_func()->cursor_list.removeFirst(); - - QWidget *w = QWidget::mouseGrabber(); - if (!w && qt_last_x) - w = topLevelAt(*qt_last_x, *qt_last_y); - if (!w) - w = desktop(); - - int cursor_handle = Qt::ArrowCursor; - if (qApp->d_func()->cursor_list.isEmpty()) { - qws_overrideCursor = false; - QWidget *upw = QApplication::widgetAt(*qt_last_x, *qt_last_y); - if (upw) - cursor_handle = upw->cursor().handle(); - } else { - cursor_handle = qApp->d_func()->cursor_list.first().handle(); - } - QPaintDevice::qwsDisplay()->selectCursor(w, cursor_handle); -} -#endif// QT_NO_CURSOR - - - -/***************************************************************************** - Routines to find a Qt widget from a screen position - *****************************************************************************/ - -/*! - \internal -*/ -QWidget *QApplicationPrivate::findWidget(const QObjectList& list, - const QPoint &pos, bool rec) -{ - QWidget *w; - - for (int i = list.size()-1; i >= 0; --i) { - if (list.at(i)->isWidgetType()) { - w = static_cast(list.at(i)); - if (w->isVisible() && !w->testAttribute(Qt::WA_TransparentForMouseEvents) && w->geometry().contains(pos) - && (!w->d_func()->extra || w->d_func()->extra->mask.isEmpty() || w->d_func()->extra->mask.contains(pos - w->geometry().topLeft()) )) { - if (!rec) - return w; - QWidget *c = w->childAt(w->mapFromParent(pos)); - return c ? c : w; - } - } - } - return 0; -} - - -QWidget *QApplication::topLevelAt(const QPoint &pos) -{ - //### QWSDisplay::windowAt() is currently only implemented in the server process - int winId = QPaintDevice::qwsDisplay()->windowAt(pos); - if (winId !=0) - return QWidget::find(winId); - -#if 1 - // fallback implementation for client processes -//### This is slightly wrong: we have no guarantee that the list is in -//### stacking order, so if the topmost window is transparent, we may -//### return the wrong widget - - QWidgetList list = topLevelWidgets(); - for (int i = list.size()-1; i >= 0; --i) { - QWidget *w = list[i]; - if (w != QApplication::desktop() && - w->isVisible() && w->d_func()->localAllocatedRegion().contains(w->mapFromParent(pos)) - ) - return w; - } -#endif - return 0; -} - -void QApplication::beep() -{ -} - -void QApplication::alert(QWidget *, int) -{ -} - -Qt::KeyboardModifiers QApplication::queryKeyboardModifiers() -{ - return keyboardModifiers(); // TODO proper implementation -} - -int QApplication::qwsProcessEvent(QWSEvent* event) -{ - Q_D(QApplication); - QScopedLoopLevelCounter loopLevelCounter(d->threadData); - int oldstate = -1; - bool isMove = false; - if (event->type == QWSEvent::Mouse) { - QWSMouseEvent::SimpleData &mouse = event->asMouse()->simpleData; - isMove = mouse_x_root != mouse.x_root || mouse_y_root != mouse.y_root; - oldstate = mouse_state; - mouse_x_root = mouse.x_root; - mouse_y_root = mouse.y_root; - mouse_state = mouse.state; - } - - long unused; - if (filterEvent(event, &unused)) // send through app filter - return 1; - - if (qwsEventFilter(event)) // send through app filter - return 1; - - -#ifndef QT_NO_QWS_PROPERTIES - if (event->type == QWSEvent::PropertyNotify) { - QWSPropertyNotifyEvent *e = static_cast(event); - if (e->simpleData.property == 424242) { // Clipboard -#ifndef QT_NO_CLIPBOARD - if (qt_clipboard) { - QClipboardEvent e(reinterpret_cast(event)); - QApplication::sendEvent(qt_clipboard, &e); - } -#endif - } - } -#endif //QT_NO_QWS_PROPERTIES -#ifndef QT_NO_COP - else if (event->type == QWSEvent::QCopMessage) { - QWSQCopMessageEvent *e = static_cast(event); - QCopChannel::sendLocally(QLatin1String(e->channel), QLatin1String(e->message), e->data); - return 0; - } -#endif -#if !defined(QT_NO_QWS_QPF2) - else if (event->type == QWSEvent::Font) { - QWSFontEvent *e = static_cast(event); - if (e->simpleData.type == QWSFontEvent::FontRemoved) { - QFontCache::instance()->removeEngineForFont(e->fontName); - } - } -#endif - - QPointer widget = static_cast(QWidget::find(WId(event->window()))); -#ifdef Q_BACKINGSTORE_SUBSURFACES - if (!widget) { // XXX: hw: hack for accessing subsurfaces - extern QWSWindowSurface* qt_findWindowSurface(int); - QWSWindowSurface *s = qt_findWindowSurface(event->window()); - if (s) - widget = static_cast(s->window()); - } -#endif - -#ifndef QT_NO_DIRECTPAINTER - if (!widget && d->directPainters) { - QDirectPainter *dp = d->directPainters->value(WId(event->window())); - if (dp == 0) { - } else if (event->type == QWSEvent::Region) { - QWSRegionEvent *e = static_cast(event); - QRegion reg; - reg.setRects(e->rectangles, e->simpleData.nrectangles); - qt_directpainter_region(dp, reg, e->simpleData.type); - return 1; -#ifndef QT_NO_QWSEMBEDWIDGET - } else if (event->type == QWSEvent::Embed) { - QWSEmbedEvent *e = static_cast(event); - qt_directpainter_embedevent(dp, e); - return 1; - #endif // QT_NO_QWSEMBEDWIDGET - } - } -#endif // QT_NO_DIRECTPAINTER - -#ifndef QT_NO_QWS_MANAGER - if (d->last_manager && event->type == QWSEvent::Mouse) { - QPoint pos(event->asMouse()->simpleData.x_root, event->asMouse()->simpleData.y_root); - if (!d->last_manager->cachedRegion().contains(pos)) { - // MouseEvent not yet delivered, so QCursor::pos() is not yet updated, sending 2 x pos - QMouseEvent outside(QEvent::MouseMove, pos, pos, Qt::NoButton, 0, 0); - QApplication::sendSpontaneousEvent(d->last_manager, &outside); - d->last_manager = 0; - qt_last_cursor = 0xffffffff; //decoration is like another window; must redo cursor - } - } -#endif // QT_NO_QWS_MANAGER - - QETWidget *keywidget=0; - bool grabbed=false; - if (event->type==QWSEvent::Key || event->type == QWSEvent::IMEvent || event->type == QWSEvent::IMQuery) { - keywidget = static_cast(QWidget::keyboardGrabber()); - if (keywidget) { - grabbed = true; - } else { - if (QWidget *popup = QApplication::activePopupWidget()) { - if (popup->focusWidget()) - keywidget = static_cast(popup->focusWidget()); - else - keywidget = static_cast(popup); - } else if (QApplicationPrivate::focus_widget && QApplicationPrivate::focus_widget->isVisible()) - keywidget = static_cast(QApplicationPrivate::focus_widget); - else if (widget) - keywidget = static_cast(widget->window()); - } - } else if (event->type==QWSEvent::MaxWindowRect) { - QRect r = static_cast(event)->simpleData.rect; - setMaxWindowRect(r); - return 0; -#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION - } else if (event->type == QWSEvent::ScreenTransformation) { - QWSScreenTransformationEvent *pe = static_cast(event); - setScreenTransformation(pe->simpleData.screen, - pe->simpleData.transformation); - return 0; -#endif - } else if (widget && event->type==QWSEvent::Mouse) { - // The mouse event is to one of my top-level widgets - // which one? - const int btnMask = Qt::LeftButton | Qt::RightButton | Qt::MidButton; - QPoint p(event->asMouse()->simpleData.x_root, - event->asMouse()->simpleData.y_root); - int mouseButtonState = event->asMouse()->simpleData.state & btnMask; - static int btnstate = 0; - - QETWidget *w = static_cast(QWidget::mouseGrabber()); - if (w && !mouseButtonState && qt_pressGrab == w) - qt_pressGrab = 0; -#ifndef QT_NO_QWS_MANAGER - if (!w) - w = static_cast(QWSManager::grabbedMouse()); -#endif - if (w) { - // Our mouse is grabbed - send it. - widget = w; - btnstate = mouseButtonState; - } else { - static QWidget *gw = 0; - // Three jobs to do here: - // 1. find the child widget this event belongs to. - // 2. make sure the cursor is correct. - // 3. handle implicit mouse grab due to button press. - w = widget; // w is the widget the cursor is in. - - //### ??? alloc_region - //#### why should we get events outside alloc_region ???? - if (1 /*widget->data->alloc_region.contains(dp) */) { - // Find the child widget that the cursor is in. - w = static_cast(widget->childAt(widget->mapFromParent(p))); - if (!w) - w = widget; -#ifndef QT_NO_CURSOR - // Update Cursor. - if (!gw || gw != w || qt_last_cursor == 0xffffffff) { - QCursor *curs = 0; - if (!qApp->d_func()->cursor_list.isEmpty()) - curs = &qApp->d_func()->cursor_list.first(); - else if (w->d_func()->extraData()) - curs = w->d_func()->extraData()->curs; - QWidget *pw = w; - // If this widget has no cursor set, try parent. - while (!curs) { - pw = pw->parentWidget(); - if (!pw) - break; - if (pw->d_func()->extraData()) - curs = pw->d_func()->extraData()->curs; - } - if (!qws_overrideCursor) { - if (curs) - QPaintDevice::qwsDisplay()->selectCursor(widget, curs->handle()); - else - QPaintDevice::qwsDisplay()->selectCursor(widget, Qt::ArrowCursor); - } - } -#endif - gw = w; - } else { - // This event is not for any of our widgets - gw = 0; - } - if (mouseButtonState && !btnstate) { - // The server has grabbed the mouse for us. - // Remember which of my widgets has it. - qt_pressGrab = w; - if (!widget->isActiveWindow() && - (!app_do_modal || QApplication::activeModalWidget() == widget) && - !((widget->windowFlags() & Qt::FramelessWindowHint) || (widget->windowType() == Qt::Tool))) { - widget->activateWindow(); - if (widget->raiseOnClick()) - widget->raise(); - } - } - btnstate = mouseButtonState; - widget = w; - } - } - - if (!widget) { // don't know this window - if (!QWidget::mouseGrabber() -#ifndef QT_NO_QWS_MANAGER - && !QWSManager::grabbedMouse() -#endif - ) { - qt_last_cursor = 0xffffffff; // cursor can be changed by another application - } - - QWidget* popup = QApplication::activePopupWidget(); - if (popup) { - - /* - That is more than suboptimal. The real solution should - do some keyevent and buttonevent translation, so that - the popup still continues to work as the user expects. - Unfortunately this translation is currently only - possible with a known widget. I'll change that soon - (Matthias). - */ - - // Danger - make sure we don't lock the server - switch (event->type) { - case QWSEvent::Mouse: - case QWSEvent::Key: - do { - popup->close(); - } while ((popup = qApp->activePopupWidget())); - return 1; - } - } - if (event->type == QWSEvent::Mouse && *mouseInWidget) { - QApplicationPrivate::dispatchEnterLeave(0, *mouseInWidget); - (*mouseInWidget) = 0; - } - return -1; - } - - if (app_do_modal) // modal event handling - if (!qt_try_modal(widget, event)) { - return 1; - } - - if (widget->qwsEvent(event)) // send through widget filter - return 1; - switch (event->type) { - - case QWSEvent::Mouse: { // mouse event - QWSMouseEvent *me = event->asMouse(); - QWSMouseEvent::SimpleData &mouse = me->simpleData; - - // Translate a QWS event into separate move - // and press/release events - // Beware of reentrancy: we can enter a modal state - // inside translateMouseEvent - - if (isMove) { - QWSMouseEvent move = *me; - move.simpleData.state = oldstate; - widget->translateMouseEvent(&move, oldstate); - } - if ((mouse.state&Qt::MouseButtonMask) != (oldstate&Qt::MouseButtonMask)) { - widget->translateMouseEvent(me, oldstate); - } - - if (mouse.delta != 0) - widget->translateWheelEvent(me); - - if (qt_button_down && (mouse_state & Qt::MouseButtonMask) == 0) - qt_button_down = 0; - - break; - } - case QWSEvent::Key: // keyboard event - if (keywidget) // should always exist - keywidget->translateKeyEvent(static_cast(event), grabbed); - break; - -#ifndef QT_NO_QWS_INPUTMETHODS - case QWSEvent::IMEvent: - if (keywidget) // should always exist - QWSInputContext::translateIMEvent(keywidget, static_cast(event)); - break; - - case QWSEvent::IMQuery: - if (keywidget) // should always exist - QWSInputContext::translateIMQueryEvent(keywidget, static_cast(event)); - break; - - case QWSEvent::IMInit: - QWSInputContext::translateIMInitEvent(static_cast(event)); - break; -#endif - case QWSEvent::Region: - widget->translateRegionEvent(static_cast(event)); - break; - case QWSEvent::Focus: - if ((static_cast(event))->simpleData.get_focus) { - if (widget == static_cast(desktop())) - return true; // not interesting - if (activeWindow() != widget) { - setActiveWindow(widget); - if (QApplicationPrivate::active_window) - static_cast(QApplicationPrivate::active_window)->repaintDecoration(desktop()->rect(), false); - if (widget && !d->inPopupMode()) { - QWidget *w = widget->focusWidget(); - while (w && w->focusProxy()) - w = w->focusProxy(); - if (w && (w->focusPolicy() != Qt::NoFocus)) - w->setFocus(); - else - widget->QWidget::focusNextPrevChild(true); - if (!QApplicationPrivate::focus_widget) { - if (widget->focusWidget()) - widget->focusWidget()->setFocus(); - else - widget->window()->setFocus(); - } - } - } - } else { // lost focus - if (widget == static_cast(desktop())) - return true; // not interesting - if (QApplicationPrivate::focus_widget) { - QETWidget *old = static_cast(QApplicationPrivate::active_window); - setActiveWindow(0); - qt_last_cursor = 0xffffffff; - //QApplicationPrivate::active_window = 0; - if (old) - old->repaintDecoration(desktop()->rect(), false); - /* activateWindow() sends focus events - QApplication::setFocusWidget(0); - */ - } - } - break; - - case QWSEvent::WindowOperation: - if (static_cast(widget) == desktop()) - return true; - switch ((static_cast(event))->simpleData.op) { - case QWSWindowOperationEvent::Show: - widget->show(); - break; - case QWSWindowOperationEvent::Hide: - widget->hide(); - break; - case QWSWindowOperationEvent::ShowMaximized: - widget->showMaximized(); - break; - case QWSWindowOperationEvent::ShowMinimized: - widget->showMinimized(); - break; - case QWSWindowOperationEvent::ShowNormal: - widget->showNormal(); - break; - case QWSWindowOperationEvent::Close: - widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); - break; - } - break; -#ifndef QT_NO_QWSEMBEDWIDGET - case QWSEvent::Embed: - widget->translateEmbedEvent(static_cast(event)); - break; -#endif - default: - break; - } - - return 0; -} - -bool QApplication::qwsEventFilter(QWSEvent *) -{ - return false; -} - -void QApplication::qwsSetCustomColors(QRgb *colorTable, int start, int numColors) -{ - if (start < 0 || start > 39) { - qWarning("QApplication::qwsSetCustomColors: start < 0 || start > 39"); - return; - } - if (start + numColors > 40) { - numColors = 40 - start; - qWarning("QApplication::qwsSetCustomColors: Too many colors"); - } - start += 216; - for (int i = 0; i < numColors; i++) { - qt_screen->set(start + i, qRed(colorTable[i]), qGreen(colorTable[i]), - qBlue(colorTable[i])); - } -} - -#ifndef QT_NO_QWS_MANAGER -QDecoration &QApplication::qwsDecoration() -{ - return *qws_decoration; -} - -void QApplication::qwsSetDecoration(QDecoration *dec) -{ - if (dec) { - delete qws_decoration; - qws_decoration = dec; - QWidgetList widgets = topLevelWidgets(); - for (int i = 0; i < widgets.size(); ++i) { - QWidget *w = widgets[i]; - if (w->isVisible() && w != desktop()) { - static_cast(w)->updateRegion(); - static_cast(w)->repaintDecoration(desktop()->rect(), false); - if (w->isMaximized()) - w->showMaximized(); - } - } - } -} - -QDecoration* QApplication::qwsSetDecoration(const QString &decoration) -{ - QDecoration *decore = QDecorationFactory::create(decoration); - if (!decore) - return 0; - - qwsSetDecoration(decore); - return decore; -} - -#endif - -bool QApplicationPrivate::modalState() -{ - return app_do_modal; -} - -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; -} - -static bool qt_try_modal(QWidget *widget, QWSEvent *event) -{ - QWidget * top = 0; - - if (QApplicationPrivate::tryModalHelper(widget, &top)) - return true; - - bool block_event = false; - bool paint_event = false; - - switch (event->type) { - case QWSEvent::Focus: - if (!static_cast(event)->simpleData.get_focus) - break; - // drop through - case QWSEvent::Mouse: // disallow mouse/key events - case QWSEvent::Key: - block_event = true; - break; - } - - if (top->parentWidget() == 0 && (block_event || paint_event)) - top->raise(); - - return !block_event; -} - -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 */ - QPaintDevice::qwsDisplay()->grabMouse(popup,true); - QPaintDevice::qwsDisplay()->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::closePopup(QWidget *popup) -{ - if (!popupWidgets) - return; - - popupWidgets->removeAll(popup); - if (popup == popupOfPopupButtonFocus) { - popupButtonFocus = 0; - popupOfPopupButtonFocus = 0; - } - if (popupWidgets->count() == 0) { // this was the last popup - popupCloseDownMode = true; // control mouse events - delete popupWidgets; - popupWidgets = 0; - if (popupGrabOk) { // grabbing not disabled - QPaintDevice::qwsDisplay()->grabMouse(popup,false); - QPaintDevice::qwsDisplay()->grabKeyboard(popup,false); - popupGrabOk = false; - // XXX ungrab keyboard - } - if (active_window) { - if (QWidget *fw = active_window->focusWidget()) { - if (fw != QApplication::focusWidget()) { - fw->setFocus(Qt::PopupFocusReason); - } else { - QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason); - QApplication::sendEvent(fw, &e); - } - } - } - } else { - // popups are not focus-handled by the window system (the - // first popup grabbed the keyboard), so we have to do that - // manually: A popup was closed, so the previous popup gets - // the focus. - QWidget* aw = popupWidgets->last(); - if (QWidget *fw = aw->focusWidget()) - fw->setFocus(Qt::PopupFocusReason); - } -} - -/***************************************************************************** - Event translation; translates FB events to Qt events - *****************************************************************************/ - -// -// Mouse event translation -// -// FB doesn't give mouse double click events, so we generate them by -// comparing window, time and position between two mouse press events. -// - - -// Needed for QCursor::pos - -static const int AnyButton = (Qt::LeftButton | Qt::MidButton | Qt::RightButton); - - - -// -// Wheel event translation -// -bool QETWidget::translateWheelEvent(const QWSMouseEvent *me) -{ -#ifdef QT_NO_WHEELEVENT - Q_UNUSED(me); - return false; -#else - const QWSMouseEvent::SimpleData &mouse = me->simpleData; - - // Figure out wheeling direction: - // Horizontal wheel w/o Alt - // OR Vertical wheel w/ Alt ==> Horizontal wheeling - // ..all other permutations ==> Vertical wheeling - int axis = mouse.delta / 120; // WHEEL_DELTA? - Qt::Orientation orient = ((axis == 2 || axis == -2) && ((mouse.state & Qt::AltModifier) == 0)) - ||((axis == 1 || axis == -1) && mouse.state & Qt::AltModifier) - ? Qt::Horizontal : Qt::Vertical; - - QPoint mousePoint = QPoint(mouse.x_root, mouse.y_root); - - // send the event to the widget or its ancestors - QWidget* popup = qApp->activePopupWidget(); - if (popup && window() != popup) - popup->close(); - QWheelEvent we(mapFromGlobal(mousePoint), mousePoint, mouse.delta, - Qt::MouseButtons(mouse.state & Qt::MouseButtonMask), - Qt::KeyboardModifiers(mouse.state & Qt::KeyboardModifierMask), orient); - if (QApplication::sendSpontaneousEvent(this, &we)) - return true; - - // send the event to the widget that has the focus or its ancestors, if different - QWidget *w = this; - if (w != qApp->focusWidget() && (w = qApp->focusWidget())) { - QWidget* popup = qApp->activePopupWidget(); - if (popup && w != popup) - popup->hide(); - if (QApplication::sendSpontaneousEvent(w, &we)) - return true; - } - return false; -#endif -} - -bool QETWidget::translateMouseEvent(const QWSMouseEvent *event, int prevstate) -{ - static bool manualGrab = false; - QPoint pos; - QPoint globalPos; - int button = 0; - - if (sm_blockUserInput) // block user interaction during session management - return true; - const QWSMouseEvent::SimpleData &mouse = event->simpleData; - pos = mapFromGlobal(QPoint(mouse.x_root, mouse.y_root)); -// if (qt_last_x) { -// *qt_last_x=mouse.x_root; -// *qt_last_y=mouse.y_root; -// } - globalPos.rx() = mouse.x_root; - globalPos.ry() = mouse.y_root; - - QEvent::Type type = QEvent::None; - - Qt::MouseButtons buttonstate = Qt::MouseButtons(mouse.state & Qt::MouseButtonMask); - Qt::KeyboardModifiers keystate = Qt::KeyboardModifiers(mouse.state & Qt::KeyboardModifierMask); - - if (mouse.state == prevstate) { - // mouse move - type = QEvent::MouseMove; - } else if ((mouse.state&AnyButton) != (prevstate&AnyButton)) { - Qt::MouseButtons current_buttons = Qt::MouseButtons(prevstate&Qt::MouseButtonMask); - for (button = Qt::LeftButton; !type && button <= Qt::MidButton; button<<=1) { - if ((mouse.state&button) != (current_buttons&button)) { - // button press or release - current_buttons = Qt::MouseButtons(current_buttons ^ button); - -#ifndef QT_NO_QWS_INPUTMETHODS - //############ We used to do a QInputContext::reset(oldFocus); - // when we changed the focus widget. See change 93389 for where the - // focus code went. The IM code was (after testing for ClickToFocus): - //if (mouse.state&button && w != QInputContext::microFocusWidget()) //button press - // QInputContext::reset(oldFocus); - -#endif - if (mouse.state&button) { //button press - qt_button_down = childAt(pos); - if (!qt_button_down) - qt_button_down = this; - if (/*XXX mouseActWindow == this &&*/ - mouseButtonPressed == button && - long(mouse.time) -long(mouseButtonPressTime) - < QApplication::doubleClickInterval() && - qAbs(mouse.x_root - mouseXPos) < mouse_double_click_distance && - qAbs(mouse.y_root - mouseYPos) < mouse_double_click_distance ) { - type = QEvent::MouseButtonDblClick; - mouseButtonPressTime -= 2000; // no double-click next time - } else { - type = QEvent::MouseButtonPress; - mouseButtonPressTime = mouse.time; - } - mouseButtonPressed = button; // save event params for - mouseXPos = globalPos.x(); // future double click tests - mouseYPos = globalPos.y(); - } else { // mouse button released - if (manualGrab) { // release manual grab - manualGrab = false; - // XXX XUngrabPointer(x11Display(), CurrentTime); - } - - type = QEvent::MouseButtonRelease; - } - } - } - button >>= 1; - } - //XXX mouseActWindow = winId(); // save some event params - - if (type == 0) { // event consumed - return false; //EXIT in the normal case - } - - if (qApp->d_func()->inPopupMode()) { // in popup mode - QWidget *popup = qApp->activePopupWidget(); - // in X11, this would be the window we are over. - // in QWS this is the top level popup. to allow mouse - // events to other widgets, need to go through qApp->QApplicationPrivate::popupWidgets. - QSize s(qt_screen->width(), qt_screen->height()); - for (int i = 0; i < QApplicationPrivate::popupWidgets->size(); ++i) { - QWidget *w = QApplicationPrivate::popupWidgets->at(i); - - if ((w->windowType() == Qt::Popup) && w->d_func()->localAllocatedRegion().contains(globalPos - w->geometry().topLeft())) - { - popup = w; - break; - } - } - pos = popup->mapFromGlobal(globalPos); - bool releaseAfter = false; - QWidget *popupChild = popup->childAt(pos); - QWidget *popupTarget = popupChild ? popupChild : popup; - - if (popup != popupOfPopupButtonFocus){ - popupButtonFocus = 0; - popupOfPopupButtonFocus = 0; - } - - if (!popupTarget->isEnabled()) { - return false; //EXIT special case - } - - switch (type) { - case QEvent::MouseButtonPress: - case QEvent::MouseButtonDblClick: - popupButtonFocus = popupChild; - popupOfPopupButtonFocus = popup; - break; - case QEvent::MouseButtonRelease: - releaseAfter = true; - break; - default: - break; // nothing for mouse move - } - - int oldOpenPopupCount = openPopupCount; - - if (popupButtonFocus) { - QMouseEvent e(type, popupButtonFocus->mapFromGlobal(globalPos), - globalPos, Qt::MouseButton(button), buttonstate, keystate); - QApplication::sendSpontaneousEvent(popupButtonFocus, & e); - if (releaseAfter) { - popupButtonFocus = 0; - popupOfPopupButtonFocus = 0; - } - } else if (popupChild) { - QMouseEvent e(type, popupChild->mapFromGlobal(globalPos), - globalPos, Qt::MouseButton(button), buttonstate, keystate); - QApplication::sendSpontaneousEvent(popupChild, & e); - } else { - QMouseEvent e(type, pos, globalPos, Qt::MouseButton(button), buttonstate, keystate); - QApplication::sendSpontaneousEvent(popupChild ? popupChild : popup, & e); - } -#ifndef QT_NO_CONTEXTMENU - if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) { - QWidget *popupEvent = popup; - if(popupButtonFocus) - popupEvent = popupButtonFocus; - else if(popupChild) - popupEvent = popupChild; - QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos, keystate); - QApplication::sendSpontaneousEvent(popupEvent, &e); - } -#endif // QT_NO_CONTEXTMENU - - if (releaseAfter) - qt_button_down = 0; - - } else { //qApp not in popup mode - QWidget *widget = this; - QWidget *w = QWidget::mouseGrabber(); - if (!w && qt_button_down) - w = qt_button_down; - if (w && w != this) { - widget = w; - pos = mapToGlobal(pos); - pos = w->mapFromGlobal(pos); - } - - if (popupCloseDownMode) { - popupCloseDownMode = false; - if ((windowType() == Qt::Popup)) // ignore replayed event - return true; //EXIT - } - - QPointer leaveAfterRelease = 0; - if (type == QEvent::MouseButtonRelease && - (mouse.state & (~button) & (Qt::LeftButton | - Qt::MidButton | - Qt::RightButton)) == 0) { - // Button released outside the widget -> leave the widget after the - // release event has been delivered. - if (widget == qt_button_down && (pos.x() < 0 || pos.y() < 0)) - leaveAfterRelease = qt_button_down; - qt_button_down = 0; - } - - int oldOpenPopupCount = openPopupCount; - - QMouseEvent e(type, pos, globalPos, Qt::MouseButton(button), buttonstate, keystate); -#ifndef QT_NO_QWS_MANAGER - if (widget->isWindow() && widget->d_func()->topData()->qwsManager - && (widget->d_func()->topData()->qwsManager->region().contains(globalPos) - || QWSManager::grabbedMouse() )) { - if ((*mouseInWidget)) { - QApplicationPrivate::dispatchEnterLeave(0, *mouseInWidget); - (*mouseInWidget) = 0; - } - QApplication::sendSpontaneousEvent(widget->d_func()->topData()->qwsManager, &e); - qApp->d_func()->last_manager = widget->d_func()->topData()->qwsManager; - } else -#endif - { - if (widget != (*mouseInWidget)) { - QApplicationPrivate::dispatchEnterLeave(widget, *mouseInWidget); - (*mouseInWidget) = widget; - qt_last_mouse_receiver = widget; - } - QApplication::sendSpontaneousEvent(widget, &e); - if (leaveAfterRelease && !QWidget::mouseGrabber()) { - *mouseInWidget = QApplication::widgetAt(globalPos); - qt_last_mouse_receiver = *mouseInWidget; - QApplicationPrivate::dispatchEnterLeave(*mouseInWidget, leaveAfterRelease); - leaveAfterRelease = 0; - } - } -#ifndef QT_NO_CONTEXTMENU - if (type == QEvent::MouseButtonPress && button == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) { - QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos, keystate); - QApplication::sendSpontaneousEvent(widget, &e); - } -#endif // QT_NO_CONTEXTMENU - } - return true; -} - - -bool QETWidget::translateKeyEvent(const QWSKeyEvent *event, bool grab) /* grab is used in the #ifdef */ -{ - int code = -1; - //### Qt assumes keyboard state is state *before*, while QWS uses state after the event - static Qt::KeyboardModifiers oldstate; - Qt::KeyboardModifiers state = oldstate; - oldstate = event->simpleData.modifiers; - - if (sm_blockUserInput) // block user interaction during session management - return true; - - if (!isEnabled()) - return true; - - QEvent::Type type = event->simpleData.is_press ? - QEvent::KeyPress : QEvent::KeyRelease; - bool autor = event->simpleData.is_auto_repeat; - QString text; - char ascii = 0; - if (event->simpleData.unicode) { - QChar ch(event->simpleData.unicode); - if (ch.unicode() != 0xffff) - text += ch; - ascii = ch.toLatin1(); - } - code = event->simpleData.keycode; - -#if defined QT3_SUPPORT && !defined(QT_NO_SHORTCUT) - if (type == QEvent::KeyPress && !grab - && static_cast(qApp->d_ptr.data())->use_compat()) { - // send accel events if the keyboard is not grabbed - QKeyEvent a(type, code, state, text, autor, int(text.length())); - if (static_cast(qApp->d_ptr.data())->qt_tryAccelEvent(this, &a)) - return true; - } -#else - Q_UNUSED(grab); -#endif - if (!text.isEmpty() && testAttribute(Qt::WA_KeyCompression)) { - // the widget wants key compression so it gets it - - // XXX not implemented - } - - QKeyEvent e(type, code, state, text, autor, int(text.length())); - return QApplication::sendSpontaneousEvent(this, &e); -} - -bool QETWidget::translateRegionEvent(const QWSRegionEvent *event) -{ - QWSWindowSurface *surface = static_cast(windowSurface()); - Q_ASSERT(surface); - - QRegion region; - region.setRects(event->rectangles, event->simpleData.nrectangles); - - switch (event->simpleData.type) { - case QWSRegionEvent::Allocation: - region.translate(-mapToGlobal(QPoint())); - surface->setClipRegion(region); - break; -#ifdef QT_QWS_CLIENTBLIT - case QWSRegionEvent::DirectPaint: - surface->setDirectRegion(region, event->simpleData.id); - break; -#endif - default: - break; - } - - return true; -} - -#ifndef QT_NO_QWSEMBEDWIDGET -void QETWidget::translateEmbedEvent(const QWSEmbedEvent *event) -{ - if (event->simpleData.type | QWSEmbedEvent::Region) { - const QRegion region = event->region; - setGeometry(region.boundingRect()); - setVisible(!region.isEmpty()); - } -} -#endif // QT_NO_QWSEMBEDWIDGET - -void QETWidget::repaintDecoration(QRegion r, bool post) -{ - Q_UNUSED(post); -#ifdef QT_NO_QWS_MANAGER - Q_UNUSED(r); -#else - //please note that qwsManager is a QObject, not a QWidget. - //therefore, normal ways of painting do not work. - // However, it does listen to paint events. - - Q_D(QWidget); - if (isWindow() && d->topData()->qwsManager && isVisible()) { - QWSManager *manager = d->topData()->qwsManager; - r &= manager->region(); - if (!r.isEmpty()) - manager->repaintRegion(QDecoration::All, QDecoration::Normal); - } -#endif -} - -void QETWidget::updateRegion() -{ - Q_D(QWidget); - - QTLWExtra *topextra = d->maybeTopData(); - if (!topextra) - return; - - QRegion myregion = d->localRequestedRegion(); - myregion.translate(geometry().topLeft()); - -#ifndef QT_NO_QWS_MANAGER - QWSManager *manager = topextra->qwsManager; - if (manager) - myregion += manager->region(); -#endif - - QRect br(myregion.boundingRect()); - topextra->frameStrut.setCoords(d->data.crect.x() - br.x(), - d->data.crect.y() - br.y(), - br.right() - d->data.crect.right(), - br.bottom() - d->data.crect.bottom()); -} - -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; - } -} - -void QApplication::setArgs(int c, char **v) -{ - Q_D(QApplication); - d->argc = c; - d->argv = v; -} - -void QApplicationPrivate::initializeMultitouch_sys() -{ } -void QApplicationPrivate::cleanupMultitouch_sys() -{ } - -/* \internal - This is used to clean up the qws server - in case the QApplication constructor threw an exception -*/ -QWSServerCleaner::~QWSServerCleaner() -{ - if (qwsServer && qws_single_process) - QWSServer::closedown(); -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index ef995eb9aad..ec9ac315f59 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -43,8 +43,6 @@ #ifndef QT_NO_CLIPBOARD -#include "qapplication.h" -#include "qapplication_p.h" #include "qpixmap.h" #include "qclipboard_p.h" #include "qvariant.h" diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h index d42f0c7cb9d..fd68a998b0f 100644 --- a/src/gui/kernel/qclipboard.h +++ b/src/gui/kernel/qclipboard.h @@ -109,6 +109,7 @@ protected: friend class QApplication; friend class QApplicationPrivate; + friend class QGuiApplication; friend class QBaseApplication; friend class QDragManager; friend class QMimeSource; diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp index 6a881291688..737b2131c0b 100644 --- a/src/gui/kernel/qclipboard_qpa.cpp +++ b/src/gui/kernel/qclipboard_qpa.cpp @@ -44,7 +44,7 @@ #ifndef QT_NO_CLIPBOARD #include "qmimedata.h" -#include "private/qapplication_p.h" +#include "private/qguiapplication_p.h" #include "qplatformclipboard_qpa.h" QT_BEGIN_NAMESPACE @@ -53,7 +53,7 @@ QT_USE_NAMESPACE void QClipboard::clear(Mode mode) { - setMimeData(0,mode); + setMimeData(0, mode); } @@ -64,14 +64,14 @@ bool QClipboard::event(QEvent *e) const QMimeData* QClipboard::mimeData(Mode mode) const { - QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard(); + QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); if (!clipboard->supportsMode(mode)) return 0; return clipboard->mimeData(mode); } void QClipboard::setMimeData(QMimeData* src, Mode mode) { - QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard(); + QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); if (!clipboard->supportsMode(mode)) return; clipboard->setMimeData(src,mode); @@ -81,15 +81,14 @@ void QClipboard::setMimeData(QMimeData* src, Mode mode) bool QClipboard::supportsMode(Mode mode) const { - QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard(); + QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); return clipboard->supportsMode(mode); } bool QClipboard::ownsMode(Mode mode) const { - if (mode == Clipboard) - qWarning("QClipboard::ownsClipboard: UNIMPLEMENTED!"); - return false; + QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard(); + return clipboard->ownsMode(mode); } void QClipboard::connectNotify( const char * ) diff --git a/src/gui/kernel/qclipboard_qws.cpp b/src/gui/kernel/qclipboard_qws.cpp deleted file mode 100644 index a85a7f48d3f..00000000000 --- a/src/gui/kernel/qclipboard_qws.cpp +++ /dev/null @@ -1,304 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qclipboard.h" - -#ifndef QT_NO_CLIPBOARD - -#include "qapplication.h" -#include "qbitmap.h" -#include "qdatetime.h" -#include "qbuffer.h" -#include "qwidget.h" -#include "qevent.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE - - -/***************************************************************************** - Internal QClipboard functions for Qt for Embedded Linux - *****************************************************************************/ - -static const int TextClipboard=424242; -static bool init = false; - -static inline void qwsInitClipboard() -{ - //### this should go into QWSServer; it only needs to happen once. - if( !init ) { - QPaintDevice::qwsDisplay()->addProperty(0, TextClipboard); - init = true; - } -} - -static QString qwsClipboardText() -{ - char * data; - int len; - qwsInitClipboard(); - if( !QPaintDevice::qwsDisplay()->getProperty(0, TextClipboard, data, len) ) { -// qDebug("Property received: %d bytes", len); - } - - QString s((const QChar*)data, len/sizeof(QChar)); - // qDebug("Property received: '%s'", s.toAscii().constData()); - delete[] data; - return s; -} - - -static void qwsSetClipboardText(const QString& s) -{ - qwsInitClipboard(); - // qDebug("qwsSetClipboardText( %s )", s.toAscii().data()); - int len = s.length()*sizeof(QChar); - QByteArray ba((const char*)s.unicode(), len); - QPaintDevice::qwsDisplay()-> - setProperty(0, TextClipboard, QWSPropertyManager::PropReplace, ba); - -} - -class QClipboardData -{ -public: - QClipboardData(); - ~QClipboardData(); - - void setSource(QMimeData* s) - { - if (s == src) - return; - delete src; - src = s; - } - QMimeData* source() - { return src; } -#if 0 - void addTransferredPixmap(QPixmap pm) - { /* TODO: queue them */ - transferred[tindex] = pm; - tindex=(tindex+1)%2; - } - void clearTransfers() - { - transferred[0] = QPixmap(); - transferred[1] = QPixmap(); - } -#endif - - void clear(); - -private: - QMimeData* src; - -#if 0 - QPixmap transferred[2]; - int tindex; -#endif -}; - -QClipboardData::QClipboardData() -{ - src = 0; -#if 0 - tindex=0; -#endif -} - -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; -} - - -/***************************************************************************** - QClipboard member functions for FB. - *****************************************************************************/ - -#if 0 - -QString QClipboard::text() const -{ - return qwsClipboardText(); -} - -void QClipboard::setText(const QString &text) -{ - qwsSetClipboardText(text); -} - -QString QClipboard::text(QString& subtype) const -{ - QString r; - if (subtype == "plain") - r = text(); - return r; -} - -#endif - -void QClipboard::clear(Mode mode) -{ - setText(QString(), mode); -} - - -bool QClipboard::event(QEvent *e) -{ - static bool recursionWatch = false; - if (e->type() != QEvent::Clipboard || recursionWatch) - return QObject::event(e); - - recursionWatch = true; - QWSPropertyNotifyEvent *event = (QWSPropertyNotifyEvent *)(((QClipboardEvent *)e)->data()); - if (event && event->simpleData.state == QWSPropertyNotifyEvent::PropertyNewValue) { - QClipboardData *d = clipboardData(); - QString t = qwsClipboardText(); - if( (d->source() == 0 && !t.isEmpty()) || (d->source() != 0 && d->source()->text() != t) ) { - if( !d->source() ) - d->setSource(new QMimeData); - d->source()->setText( t ); - emitChanged(QClipboard::Clipboard); - } - } - - recursionWatch = false; - return true; -} - -const QMimeData* QClipboard::mimeData(Mode mode) const -{ - if (mode != Clipboard) return 0; - - QClipboardData *d = clipboardData(); - // Try and get data from QWSProperty if no mime data has been set on us. - if( !d->source() ) { - QString t = qwsClipboardText(); - if( !t.isEmpty() ) { - QMimeData* nd = new QMimeData; - nd->setText( t ); - d->setSource( nd ); - } - } - return d->source(); -} - -void QClipboard::setMimeData(QMimeData* src, Mode mode) -{ - if (mode != Clipboard) return; - - QClipboardData *d = clipboardData(); - - /* Propagate text data to other QWSClients */ - - QString newText; - if( src != 0 ) - newText = src->text(); - QString oldText; - if( d->source() != 0 ) - oldText = d->source()->text(); - - d->setSource(src); - - if( oldText != newText ) { - if( d->source() == 0 ) { - qwsSetClipboardText( QString() ); - } else { - qwsSetClipboardText( d->source()->text() ); - } - } - - 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.cpp b/src/gui/kernel/qcursor.cpp index a7868ba1a1b..9ca06aaa98d 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -43,7 +43,7 @@ #ifndef QT_NO_CURSOR -#include +#include #include #include #include @@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE To associate a cursor with a widget, use QWidget::setCursor(). To associate a cursor with all widgets (normally for a short period - of time), use QApplication::setOverrideCursor(). + of time), use QGuiApplication::setOverrideCursor(). To set a cursor shape use QCursor::setShape() or use the QCursor constructor which takes the shape as argument, or you can use one @@ -85,9 +85,9 @@ QT_BEGIN_NAMESPACE methods QCursor::pos() and QCursor::setPos(). \bold{Note:} It is possible to create a QCursor before - QApplication, but it is not useful except as a place-holder for a - real QCursor created after QApplication. Attempting to use a - QCursor that was created before QApplication will result in a + QGuiApplication, but it is not useful except as a place-holder for a + real QCursor created after QGuiApplication. Attempting to use a + QCursor that was created before QGuiApplication will result in a crash. \section1 A Note for X11 Users @@ -410,7 +410,7 @@ void QCursorData::initialize() QCursor::QCursor() { if (!QCursorData::initialized) { - if (QApplication::startingUp()) { + if (QCoreApplication::startingUp()) { d = 0; return; } diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index d857eda1e5c..dac74c2c01d 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -152,18 +152,6 @@ private: #endif }; -#ifdef QT3_SUPPORT -// CursorShape is defined in X11/X.h -#ifdef CursorShape -#define X_CursorShape CursorShape -#undef CursorShape -#endif -typedef Qt::CursorShape QCursorShape; -#ifdef X_CursorShape -#define CursorShape X_CursorShape -#endif -#endif - /***************************************************************************** QCursor stream functions *****************************************************************************/ diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp index d4cf6f49958..40a15317ee5 100644 --- a/src/gui/kernel/qcursor_qpa.cpp +++ b/src/gui/kernel/qcursor_qpa.cpp @@ -41,6 +41,8 @@ #include #include +#include +#include #include QT_BEGIN_NAMESPACE @@ -107,21 +109,29 @@ void QCursorData::update() #endif //QT_NO_CURSOR -extern qreal qt_last_x,qt_last_y; - QPoint QCursor::pos() { - return QPointF(qt_last_x, qt_last_y).toPoint(); + return QGuiApplicationPrivate::lastCursorPosition.toPoint(); } void QCursor::setPos(int x, int y) { + QPoint target(x, 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)) + if (pos() == target) return; + + QList > cursors = QPlatformCursorPrivate::getInstances(); + int cursorCount = cursors.count(); + for (int i = 0; i < cursorCount; ++i) { + const QWeakPointer &cursor(cursors.at(i)); + if (cursor) + cursor.data()->setPos(target); + } } QT_END_NAMESPACE diff --git a/src/gui/kernel/qcursor_qws.cpp b/src/gui/kernel/qcursor_qws.cpp deleted file mode 100644 index e47119dc1a8..00000000000 --- a/src/gui/kernel/qcursor_qws.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#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; - QT_TRY { - QPaintDevice::qwsDisplay()->destroyCursor(id); - } QT_CATCH(const std::bad_alloc &) { - // do nothing. - } -} - - -/***************************************************************************** - Global cursors - *****************************************************************************/ - -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; - - QPaintDevice::qwsDisplay()->defineCursor(d->id, *d->bm, *d->bmm, d->hx, d->hy); - return d; -} - -void QCursorData::update() -{ -} - -#endif //QT_NO_CURSOR - -extern int *qt_last_x,*qt_last_y; - -QPoint QCursor::pos() -{ - // This doesn't know about hotspots yet so we disable it - //qt_accel_update_cursor(); - if (qt_last_x) - return QPoint(*qt_last_x, *qt_last_y); - else - return QPoint(); -} - -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; - QPaintDevice::qwsDisplay()->setCursorPosition(x, y); -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qdesktopwidget_qws.cpp b/src/gui/kernel/qdesktopwidget_qws.cpp deleted file mode 100644 index 50ccb9f1403..00000000000 --- a/src/gui/kernel/qdesktopwidget_qws.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdesktopwidget.h" -#include "qscreen_qws.h" -#include "private/qapplication_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 -{ - QScreen *screen = QScreen::instance(); - if (!screen) - return 0; - - const QList subScreens = screen->subScreens(); - return qMax(subScreens.size(), 1); -} - -QWidget *QDesktopWidget::screen(int) -{ - return this; -} - -const QRect QDesktopWidget::availableGeometry(int screenNo) const -{ - const QScreen *screen = QScreen::instance(); - if (screenNo == -1) - screenNo = 0; - if (!screen || screenNo < 0) - return QRect(); - - const QList subScreens = screen->subScreens(); - if (!subScreens.isEmpty()) { - if (screenNo >= subScreens.size()) - return QRect(); - screen = subScreens.at(screenNo); - } - - QApplicationPrivate *ap = QApplicationPrivate::instance(); - const QRect r = ap->maxWindowRect(screen); - if (!r.isEmpty()) - return r; - - return screen->region().boundingRect(); -} - -const QRect QDesktopWidget::screenGeometry(int screenNo) const -{ - const QScreen *screen = QScreen::instance(); - if (screenNo == -1) - screenNo = 0; - if (!screen || screenNo < 0) - return QRect(); - - const QList subScreens = screen->subScreens(); - if (subScreens.size() == 0 && screenNo == 0) - return screen->region().boundingRect(); - - if (screenNo >= subScreens.size()) - return QRect(); - - return subScreens.at(screenNo)->region().boundingRect(); -} - -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 -{ - const QScreen *screen = QScreen::instance(); - if (!screen || !screen->region().contains(p)) - return -1; - - const QList subScreens = screen->subScreens(); - if (subScreens.size() == 0) - return 0; - - for (int i = 0; i < subScreens.size(); ++i) - if (subScreens.at(i)->region().contains(p)) - return i; - - return -1; -} - -void QDesktopWidget::resizeEvent(QResizeEvent *) -{ -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp index e880f2ebb19..4ed2515115b 100644 --- a/src/gui/kernel/qdnd.cpp +++ b/src/gui/kernel/qdnd.cpp @@ -47,9 +47,8 @@ #include "qevent.h" #include "qfile.h" #include "qtextcodec.h" -#include "qapplication.h" +#include "qguiapplication.h" #include "qpoint.h" -#include "qwidget.h" #include "qbuffer.h" #include "qimage.h" #include "qregexp.h" @@ -59,15 +58,14 @@ #include "qimagewriter.h" #include "qdebug.h" #include +#include -#include +#include #ifndef QT_NO_DRAGANDDROP QT_BEGIN_NAMESPACE -#ifndef QT_NO_DRAGANDDROP - //#define QDND_DEBUG #ifdef QDND_DEBUG @@ -124,7 +122,6 @@ QString KeyboardModifiersToString(Qt::KeyboardModifiers moderfies) } #endif - // the universe's only drag manager QDragManager *QDragManager::instance = 0; @@ -142,11 +139,20 @@ QDragManager::QDragManager() restoreCursor = false; willDrop = false; eventLoop = 0; - dropData = new QDropData(); currentDropTarget = 0; #ifdef Q_WS_X11 xdndMimeTransferedPixmapIndex = 0; #endif + shapedPixmapWindow = 0; + + possible_actions = Qt::IgnoreAction; + + QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration(); + platformDrag = pi->drag(); + + platformDropData = 0; + if (platformDrag) + platformDropData = platformDrag->platformDropData(); } @@ -154,15 +160,14 @@ QDragManager::~QDragManager() { #ifndef QT_NO_CURSOR if (restoreCursor) - QApplication::restoreOverrideCursor(); + QGuiApplication::restoreOverrideCursor(); #endif instance = 0; - delete dropData; } QDragManager *QDragManager::self() { - if (!instance && !QApplication::closingDown()) + if (!instance && !QGuiApplication::closingDown()) instance = new QDragManager; return instance; } @@ -172,23 +177,23 @@ QPixmap QDragManager::dragCursor(Qt::DropAction action) const QDragPrivate * d = dragPrivate(); if (d && d->customCursors.contains(action)) return d->customCursors[action]; - else if (action == Qt::MoveAction) - return QApplicationPrivate::instance()->getPixmapCursor(Qt::DragMoveCursor); - else if (action == Qt::CopyAction) - return QApplicationPrivate::instance()->getPixmapCursor(Qt::DragCopyCursor); - else if (action == Qt::LinkAction) - return QApplicationPrivate::instance()->getPixmapCursor(Qt::DragLinkCursor); -#ifdef Q_WS_WIN - else if (action == Qt::IgnoreAction) - return QApplicationPrivate::instance()->getPixmapCursor(Qt::ForbiddenCursor); -#endif - return QPixmap(); -} -bool QDragManager::hasCustomDragCursors() const -{ - QDragPrivate * d = dragPrivate(); - return d && !d->customCursors.isEmpty(); + Qt::CursorShape shape = Qt::ForbiddenCursor; + switch (action) { + case Qt::MoveAction: + shape = Qt::DragMoveCursor; + break; + case Qt::CopyAction: + shape = Qt::DragCopyCursor; + break; + case Qt::LinkAction: + shape = Qt::DragLinkCursor; + break; + default: + shape = Qt::ForbiddenCursor; + } + + return QGuiApplicationPrivate::instance()->getPixmapCursor(Qt::DragMoveCursor); } Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions, @@ -230,10 +235,6 @@ Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions, defaultAction = Qt::LinkAction; #endif - // if the object is set take the list of possibles from it - if (object) - possibleActions = object->d_func()->possible_actions; - #ifdef QDND_DEBUG qDebug("possible actions : %s", dragActionsToString(possibleActions).latin1()); #endif @@ -257,7 +258,7 @@ Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions, return defaultAction; } -void QDragManager::setCurrentTarget(QWidget *target, bool dropped) +void QDragManager::setCurrentTarget(QObject *target, bool dropped) { if (currentDropTarget == target) return; @@ -270,21 +271,264 @@ void QDragManager::setCurrentTarget(QWidget *target, bool dropped) } -QWidget *QDragManager::currentTarget() +QObject *QDragManager::currentTarget() { return currentDropTarget; } + +static QPixmap *defaultPm = 0; +static const int default_pm_hotx = -2; +static const int default_pm_hoty = -16; +static const char *const default_pm[] = { +"13 9 3 1", +". c None", +" c #000000", +"X c #FFFFFF", +"X X X X X X X", +" X X X X X X ", +"X ......... X", +" X.........X ", +"X ......... X", +" X.........X ", +"X ......... X", +" X X X X X X ", +"X X X X X X X", +}; + + +static Qt::KeyboardModifiers oldstate; + +void QDragManager::updatePixmap() +{ + if (shapedPixmapWindow) { + QPixmap pm; + QPoint pm_hot(default_pm_hotx,default_pm_hoty); + if (object) { + pm = object->pixmap(); + if (!pm.isNull()) + pm_hot = object->hotSpot(); + } + if (pm.isNull()) { + if (!defaultPm) + defaultPm = new QPixmap(default_pm); + pm = *defaultPm; + } + shapedPixmapWindow->setPixmap(pm); + shapedPixmapWindow->move(QCursor::pos()-pm_hot); + if (willDrop) { + shapedPixmapWindow->show(); + } else { + shapedPixmapWindow->hide(); + } + } +} + +void QDragManager::updateCursor() +{ +#ifndef QT_NO_CURSOR + if (willDrop) { + if (shapedPixmapWindow) + shapedPixmapWindow->show(); + if (currentActionForOverrideCursor != global_accepted_action) { + QGuiApplication::changeOverrideCursor(QCursor(dragCursor(global_accepted_action), 0, 0)); + currentActionForOverrideCursor = global_accepted_action; + } + } else { + QCursor *overrideCursor = QGuiApplication::overrideCursor(); + if (!overrideCursor || overrideCursor->shape() != Qt::ForbiddenCursor) { + QGuiApplication::changeOverrideCursor(QCursor(Qt::ForbiddenCursor)); + currentActionForOverrideCursor = Qt::IgnoreAction; + } + if (shapedPixmapWindow) + shapedPixmapWindow->hide(); + } +#endif +} + + +bool QDragManager::eventFilter(QObject *o, QEvent *e) +{ + if (beingCancelled) { + if (e->type() == QEvent::KeyRelease && static_cast(e)->key() == Qt::Key_Escape) { + qApp->removeEventFilter(this); + Q_ASSERT(object == 0); + beingCancelled = false; + eventLoop->exit(); + return true; // block the key release + } + return false; + } + + Q_ASSERT(object != 0); + + if (!qobject_cast(o)) + return false; + + switch(e->type()) { + case QEvent::ShortcutOverride: + // prevent accelerators from firing while dragging + e->accept(); + return true; + + case QEvent::KeyPress: + case QEvent::KeyRelease: + { + QKeyEvent *ke = static_cast(e); + if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) { + cancel(); + qApp->removeEventFilter(this); + beingCancelled = false; + eventLoop->exit(); + } else { + // ### x11 forces move! + updateCursor(); + } + return true; // Eat all key events + } + + case QEvent::MouseMove: + move(static_cast(e)); + return true; // Eat all mouse events + + case QEvent::MouseButtonRelease: + qApp->removeEventFilter(this); + if (willDrop) + drop(static_cast(e)); + else + cancel(); + beingCancelled = false; + eventLoop->exit(); + return true; // Eat all mouse events + + case QEvent::MouseButtonPress: + case QEvent::MouseButtonDblClick: + case QEvent::Wheel: + return true; + default: + break; + } + return false; +} + +Qt::DropAction QDragManager::drag(QDrag *o) +{ + if (!o || object == o) + return Qt::IgnoreAction; + + if (!platformDrag || !o->source()) { + o->deleteLater(); + return Qt::IgnoreAction; + } + + if (object) { + cancel(); + qApp->removeEventFilter(this); + beingCancelled = false; + } + + object = o; + if (!shapedPixmapWindow) + shapedPixmapWindow = new QShapedPixmapWindow(); + oldstate = Qt::NoModifier; // #### Should use state that caused the drag +// drag_mode = mode; + + possible_actions = dragPrivate()->possible_actions; + + willDrop = false; + object->d_func()->target = 0; + qApp->installEventFilter(this); + + global_accepted_action = Qt::CopyAction; +#ifndef QT_NO_CURSOR + qApp->setOverrideCursor(Qt::ArrowCursor); + restoreCursor = true; + updateCursor(); +#endif + updatePixmap(); + + platformDrag->startDrag(); + + eventLoop = new QEventLoop; + (void) eventLoop->exec(); + delete eventLoop; + eventLoop = 0; + + delete shapedPixmapWindow; + shapedPixmapWindow = 0; + + return global_accepted_action; +} + +void QDragManager::move(const QMouseEvent *me) +{ + if (!platformDrag) + return; + + platformDrag->move(me); +} + +void QDragManager::drop(const QMouseEvent *me) +{ + if (!platformDrag) + return; + +#ifndef QT_NO_CURSOR + if (restoreCursor) { + QGuiApplication::restoreOverrideCursor(); + restoreCursor = false; + } +#endif + willDrop = false; + + platformDrag->drop(me); + + if (object) + object->deleteLater(); + object = 0; +} + +void QDragManager::cancel(bool deleteSource) +{ + if (!platformDrag) + return; + +#ifndef QT_NO_CURSOR + if (restoreCursor) { + QGuiApplication::restoreOverrideCursor(); + restoreCursor = false; + } #endif -QDropData::QDropData() - : QInternalMimeData() -{ + beingCancelled = true; + + platformDrag->cancel(); + + if (object && deleteSource) + object->deleteLater(); + object = 0; + + global_accepted_action = Qt::IgnoreAction; } -QDropData::~QDropData() +/*! + Called from startDrag() in QPlatformDrag implementations that do not need + the desktop-oriented stuff provided by the event filter (e.g. because their + drag is not based on mouse events). Instead, they will manage everything on + their own, will not rely on move/drop/cancel, and will call stopDrag() to stop + the event loop when the drag is over. + */ +void QDragManager::unmanageEvents() { + qApp->removeEventFilter(this); } + +void QDragManager::stopDrag() +{ + if (eventLoop) + eventLoop->exit(); +} + #endif // QT_NO_DRAGANDDROP #if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD)) diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h index 74fa9aeb6a4..2a81de5c7fa 100644 --- a/src/gui/kernel/qdnd_p.h +++ b/src/gui/kernel/qdnd_p.h @@ -59,22 +59,17 @@ #include "QtGui/qdrag.h" #include "QtGui/qpixmap.h" #include "QtGui/qcursor.h" +#include "QtGui/qwindow.h" #include "QtCore/qpoint.h" #include "private/qobject_p.h" -#ifdef Q_WS_MAC -# include "private/qt_mac_p.h" -#endif - -#if defined(Q_WS_WIN) -# include -# include -#endif QT_BEGIN_NAMESPACE class QEventLoop; +class QMouseEvent; +class QPlatformDrag; -#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD)) +#ifndef QT_NO_DRAGANDDROP class Q_GUI_EXPORT QInternalMimeData : public QMimeData { @@ -100,82 +95,11 @@ protected: virtual QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const = 0; }; -#ifdef Q_WS_WIN -class QOleDataObject : public IDataObject -{ -public: - explicit QOleDataObject(QMimeData *mimeData); - virtual ~QOleDataObject(); - - void releaseQt(); - const QMimeData *mimeData() const; - DWORD reportedPerformedEffect() const; - - // IUnknown methods - STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); - STDMETHOD_(ULONG,AddRef)(void); - STDMETHOD_(ULONG,Release)(void); - - // IDataObject methods - STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium); - STDMETHOD(GetDataHere)(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium); - STDMETHOD(QueryGetData)(LPFORMATETC pformatetc); - STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC pformatetc, LPFORMATETC pformatetcOut); - STDMETHOD(SetData)(LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium, - BOOL fRelease); - STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc); - STDMETHOD(DAdvise)(FORMATETC FAR* pFormatetc, DWORD advf, - LPADVISESINK pAdvSink, DWORD FAR* pdwConnection); - STDMETHOD(DUnadvise)(DWORD dwConnection); - STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR* ppenumAdvise); - -private: - ULONG m_refs; - QPointer data; - int CF_PERFORMEDDROPEFFECT; - DWORD performedEffect; -}; - -class QOleEnumFmtEtc : public IEnumFORMATETC -{ -public: - explicit QOleEnumFmtEtc(const QVector &fmtetcs); - explicit QOleEnumFmtEtc(const QVector &lpfmtetcs); - virtual ~QOleEnumFmtEtc(); - - bool isNull() const; - - // IUnknown methods - STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); - STDMETHOD_(ULONG,AddRef)(void); - STDMETHOD_(ULONG,Release)(void); - - // IEnumFORMATETC methods - STDMETHOD(Next)(ULONG celt, LPFORMATETC rgelt, ULONG FAR* pceltFetched); - STDMETHOD(Skip)(ULONG celt); - STDMETHOD(Reset)(void); - STDMETHOD(Clone)(LPENUMFORMATETC FAR* newEnum); - -private: - bool copyFormatEtc(LPFORMATETC dest, LPFORMATETC src) const; - - ULONG m_dwRefs; - ULONG m_nIndex; - QVector m_lpfmtetcs; - bool m_isNull; -}; - -#endif - -#endif //QT_NO_DRAGANDDROP && QT_NO_CLIPBOARD - -#ifndef QT_NO_DRAGANDDROP - class QDragPrivate : public QObjectPrivate { public: - QWidget *source; - QWidget *target; + QObject *source; + QObject *target; QMimeData *data; QPixmap pixmap; QPoint hotspot; @@ -185,149 +109,113 @@ public: Qt::DropAction defaultDropAction; }; -class QDropData : public QInternalMimeData -{ - Q_OBJECT +class QShapedPixmapWindow : public QWindow { + QPixmap pixmap; public: - QDropData(); - ~QDropData(); + QShapedPixmapWindow() : + QWindow() + { + setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); + // ### Should we set the surface type to raster? + // ### FIXME +// setAttribute(Qt::WA_TransparentForMouseEvents); + } -protected: - bool hasFormat_sys(const QString &mimeType) const; - QStringList formats_sys() const; - QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const; + void move(const QPoint &p) { + QRect g = geometry(); + g.setTopLeft(p); + setGeometry(g); + } + void setPixmap(QPixmap pm) + { + pixmap = pm; + // ### +// if (!pixmap.mask().isNull()) { +// setMask(pixmap.mask()); +// } else { +// clearMask(); +// } + setGeometry(QRect(geometry().topLeft(), pm.size())); + } -#if defined(Q_WS_WIN) -public: - LPDATAOBJECT currentDataObject; -#endif + // ### Get it painted again! +// void paintEvent(QPaintEvent*) +// { +// QPainter p(this); +// p.drawPixmap(0,0,pixmap); +// } }; -class QDragManager: public QObject { + +class Q_GUI_EXPORT QDragManager : public QObject { Q_OBJECT - QDragManager(); - ~QDragManager(); // only friend classes can use QDragManager. friend class QDrag; friend class QDragMoveEvent; friend class QDropEvent; friend class QApplication; -#ifdef Q_WS_MAC - friend class QWidgetPrivate; //dnd is implemented here -#endif bool eventFilter(QObject *, QEvent *); - void timerEvent(QTimerEvent*); public: - Qt::DropAction drag(QDrag *); - - void cancel(bool deleteSource = true); - void move(const QPoint &); - void drop(); - void updatePixmap(); - QWidget *source() const { return object ? object->d_func()->source : 0; } - QDragPrivate *dragPrivate() const { return object ? object->d_func() : 0; } - static QDragPrivate *dragPrivate(QDrag *drag) { return drag ? drag->d_func() : 0; } - + QDragManager(); + ~QDragManager(); static QDragManager *self(); + + virtual Qt::DropAction drag(QDrag *); + + virtual void cancel(bool deleteSource = true); + virtual void move(const QMouseEvent *me); + virtual void drop(const QMouseEvent *me); + + void updatePixmap(); + void updateCursor(); + Qt::DropAction defaultAction(Qt::DropActions possibleActions, Qt::KeyboardModifiers modifiers) const; - QDrag *object; + QPixmap dragCursor(Qt::DropAction action) const; - void updateCursor(); + QDragPrivate *dragPrivate() const { return object ? object->d_func() : 0; } + + inline QMimeData *dropData() + { return object ? dragPrivate()->data : platformDropData; } + + void emitActionChanged(Qt::DropAction newAction) { if (object) emit object->actionChanged(newAction); } + + void setCurrentTarget(QObject *target, bool dropped = false); + QObject *currentTarget(); + + QDrag *object; bool beingCancelled; bool restoreCursor; bool willDrop; QEventLoop *eventLoop; - QPixmap dragCursor(Qt::DropAction action) const; + Qt::DropActions possible_actions; + // Shift/Ctrl handling, and final drop status + Qt::DropAction global_accepted_action; - bool hasCustomDragCursors() const; + QShapedPixmapWindow *shapedPixmapWindow; - QDropData *dropData; - - void emitActionChanged(Qt::DropAction newAction) { if (object) emit object->actionChanged(newAction); } - - void setCurrentTarget(QWidget *target, bool dropped = false); - QWidget *currentTarget(); - -#ifdef Q_WS_X11 - QPixmap xdndMimeTransferedPixmap[2]; - int xdndMimeTransferedPixmapIndex; -#endif + void unmanageEvents(); + void stopDrag(); private: -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) + QMimeData *platformDropData; + Qt::DropAction currentActionForOverrideCursor; -#endif -#ifdef Q_OS_SYMBIAN -#ifndef QT_NO_CURSOR - QCursor overrideCursor; -#endif -#endif - QWidget *currentDropTarget; + QObject *currentDropTarget; + + QPlatformDrag *platformDrag; static QDragManager *instance; Q_DISABLE_COPY(QDragManager) }; -#if defined(Q_WS_WIN) - -class QOleDropTarget : public IDropTarget -{ -public: - QOleDropTarget(QWidget* w); - virtual ~QOleDropTarget() {} - - void releaseQt(); - - // IUnknown methods - STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); - STDMETHOD_(ULONG, AddRef)(void); - STDMETHOD_(ULONG, Release)(void); - - // IDropTarget methods - STDMETHOD(DragEnter)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); - STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); - STDMETHOD(DragLeave)(); - STDMETHOD(Drop)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); - -private: - ULONG m_refs; - QWidget* widget; - QPointer currentWidget; - QRect answerRect; - QPoint lastPoint; - DWORD chosenEffect; - DWORD lastKeyState; - - void sendDragEnterEvent(QWidget *to, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); -}; - -#endif - -#if defined (Q_WS_MAC) -class QCocoaDropData : public QInternalMimeData -{ - Q_OBJECT -public: - QCocoaDropData(CFStringRef pasteboard); - ~QCocoaDropData(); - -protected: - bool hasFormat_sys(const QString &mimeType) const; - QStringList formats_sys() const; - QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const; -public: - CFStringRef dropPasteboard; -}; -#endif - #endif // !QT_NO_DRAGANDDROP diff --git a/src/gui/kernel/qdnd_qws.cpp b/src/gui/kernel/qdnd_qws.cpp deleted file mode 100644 index 96bdaed67b3..00000000000 --- a/src/gui/kernel/qdnd_qws.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qapplication.h" - -#ifndef QT_NO_DRAGANDDROP - -#include "qwidget.h" -#include "qdatetime.h" -#include "qbitmap.h" -#include "qcursor.h" -#include "qevent.h" -#include "qpainter.h" -#include "qdnd_p.h" - -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE - -static QPixmap *defaultPm = 0; -static const int default_pm_hotx = -2; -static const int default_pm_hoty = -16; -static const char *const default_pm[] = { -"13 9 3 1", -". c None", -" c #000000", -"X c #FFFFFF", -"X X X X X X X", -" X X X X X X ", -"X ......... X", -" X.........X ", -"X ......... X", -" X.........X ", -"X ......... X", -" X X X X X X ", -"X X X X X X X", -}; - -// Shift/Ctrl handling, and final drop status -static Qt::DropAction global_accepted_action = Qt::CopyAction; -static Qt::DropActions possible_actions = Qt::IgnoreAction; - - -// static variables in place of a proper cross-process solution -static QDrag *drag_object; -static bool qt_qws_dnd_dragging = false; - - -static Qt::KeyboardModifiers oldstate; - -class QShapedPixmapWidget : public QWidget { - QPixmap pixmap; -public: - QShapedPixmapWidget() : - QWidget(0, Qt::Tool | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint) - { - // ### Temporary workaround for 4.2-rc1!!! To prevent flickering when - // using drag'n drop in a client application. (task 126956) - // setAttribute() should be done unconditionally! - if (QApplication::type() == QApplication::GuiServer) - setAttribute(Qt::WA_TransparentForMouseEvents); - } - - void setPixmap(QPixmap pm) - { - pixmap = pm; - if (!pixmap.mask().isNull()) { - setMask(pixmap.mask()); - } else { - clearMask(); - } - resize(pm.width(),pm.height()); - } - - void paintEvent(QPaintEvent*) - { - QPainter p(this); - p.drawPixmap(0,0,pixmap); - } -}; - - -static QShapedPixmapWidget *qt_qws_dnd_deco = 0; - - -void QDragManager::updatePixmap() -{ - if (qt_qws_dnd_deco) { - QPixmap pm; - QPoint pm_hot(default_pm_hotx,default_pm_hoty); - if (drag_object) { - pm = drag_object->pixmap(); - if (!pm.isNull()) - pm_hot = drag_object->hotSpot(); - } - if (pm.isNull()) { - if (!defaultPm) - defaultPm = new QPixmap(default_pm); - pm = *defaultPm; - } - qt_qws_dnd_deco->setPixmap(pm); - qt_qws_dnd_deco->move(QCursor::pos()-pm_hot); - if (willDrop) { - qt_qws_dnd_deco->show(); - } else { - qt_qws_dnd_deco->hide(); - } - } -} - -void QDragManager::timerEvent(QTimerEvent *) { } - -void QDragManager::move(const QPoint &) { } - -void QDragManager::updateCursor() -{ -#ifndef QT_NO_CURSOR - if (willDrop) { - if (qt_qws_dnd_deco) - qt_qws_dnd_deco->show(); - if (currentActionForOverrideCursor != global_accepted_action) { - QApplication::changeOverrideCursor(QCursor(dragCursor(global_accepted_action), 0, 0)); - currentActionForOverrideCursor = global_accepted_action; - } - } else { - QCursor *overrideCursor = QApplication::overrideCursor(); - if (!overrideCursor || overrideCursor->shape() != Qt::ForbiddenCursor) { - QApplication::changeOverrideCursor(QCursor(Qt::ForbiddenCursor)); - currentActionForOverrideCursor = Qt::IgnoreAction; - } - if (qt_qws_dnd_deco) - qt_qws_dnd_deco->hide(); - } -#endif -} - - -bool QDragManager::eventFilter(QObject *o, QEvent *e) -{ - if (beingCancelled) { - if (e->type() == QEvent::KeyRelease && static_cast(e)->key() == Qt::Key_Escape) { - qApp->removeEventFilter(this); - Q_ASSERT(object == 0); - beingCancelled = false; - eventLoop->exit(); - return true; // block the key release - } - return false; - } - - - - if (!o->isWidgetType()) - return false; - - switch(e->type()) { - case QEvent::ShortcutOverride: - // prevent accelerators from firing while dragging - e->accept(); - return true; - - case QEvent::KeyPress: - case QEvent::KeyRelease: - { - QKeyEvent *ke = ((QKeyEvent*)e); - if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) { - cancel(); - qApp->removeEventFilter(this); - beingCancelled = false; - eventLoop->exit(); - } else { - updateCursor(); - } - return true; // Eat all key events - } - - case QEvent::MouseButtonPress: - case QEvent::MouseMove: - { - if (!object) { //#### this should not happen - qWarning("QDragManager::eventFilter: No object"); - return true; - } - - QDragManager *manager = QDragManager::self(); - QMimeData *dropData = manager->object ? manager->dragPrivate()->data : manager->dropData; - if (manager->object) - possible_actions = manager->dragPrivate()->possible_actions; - else - possible_actions = Qt::IgnoreAction; - - QMouseEvent *me = (QMouseEvent *)e; - if (me->buttons()) { - Qt::DropAction prevAction = global_accepted_action; - QWidget *cw = QApplication::widgetAt(me->globalPos()); - - // Fix for when we move mouse on to the deco widget - if (qt_qws_dnd_deco && cw == qt_qws_dnd_deco) - cw = object->target(); - - while (cw && !cw->acceptDrops() && !cw->isWindow()) - cw = cw->parentWidget(); - - if (object->target() != cw) { - if (object->target()) { - QDragLeaveEvent dle; - QApplication::sendEvent(object->target(), &dle); - willDrop = false; - global_accepted_action = Qt::IgnoreAction; - updateCursor(); - restoreCursor = true; - object->d_func()->target = 0; - } - if (cw && cw->acceptDrops()) { - object->d_func()->target = cw; - QDragEnterEvent dee(cw->mapFromGlobal(me->globalPos()), possible_actions, dropData, - me->buttons(), me->modifiers()); - QApplication::sendEvent(object->target(), &dee); - willDrop = dee.isAccepted() && dee.dropAction() != Qt::IgnoreAction; - global_accepted_action = willDrop ? dee.dropAction() : Qt::IgnoreAction; - updateCursor(); - restoreCursor = true; - } - } else if (cw) { - QDragMoveEvent dme(cw->mapFromGlobal(me->globalPos()), possible_actions, dropData, - me->buttons(), me->modifiers()); - if (global_accepted_action != Qt::IgnoreAction) { - dme.setDropAction(global_accepted_action); - dme.accept(); - } - QApplication::sendEvent(cw, &dme); - willDrop = dme.isAccepted(); - global_accepted_action = willDrop ? dme.dropAction() : Qt::IgnoreAction; - updatePixmap(); - updateCursor(); - } - if (global_accepted_action != prevAction) - emitActionChanged(global_accepted_action); - } - return true; // Eat all mouse events - } - - case QEvent::MouseButtonRelease: - { - qApp->removeEventFilter(this); - if (restoreCursor) { - willDrop = false; -#ifndef QT_NO_CURSOR - QApplication::restoreOverrideCursor(); -#endif - restoreCursor = false; - } - if (object && object->target()) { - QMouseEvent *me = (QMouseEvent *)e; - - QDragManager *manager = QDragManager::self(); - QMimeData *dropData = manager->object ? manager->dragPrivate()->data : manager->dropData; - - QDropEvent de(object->target()->mapFromGlobal(me->globalPos()), possible_actions, dropData, - me->buttons(), me->modifiers()); - QApplication::sendEvent(object->target(), &de); - if (de.isAccepted()) - global_accepted_action = de.dropAction(); - else - global_accepted_action = Qt::IgnoreAction; - - if (object) - object->deleteLater(); - drag_object = object = 0; - } - eventLoop->exit(); - return true; // Eat all mouse events - } - - default: - break; - } - - return false; -} - -Qt::DropAction QDragManager::drag(QDrag *o) -{ - if (object == o || !o || !o->source()) - return Qt::IgnoreAction; - - if (object) { - cancel(); - qApp->removeEventFilter(this); - beingCancelled = false; - } - - object = drag_object = o; - qt_qws_dnd_deco = new QShapedPixmapWidget(); - oldstate = Qt::NoModifier; // #### Should use state that caused the drag -// drag_mode = mode; - - willDrop = false; - updatePixmap(); - updateCursor(); - restoreCursor = true; - object->d_func()->target = 0; - qApp->installEventFilter(this); - - global_accepted_action = Qt::CopyAction; -#ifndef QT_NO_CURSOR - qApp->setOverrideCursor(Qt::ArrowCursor); - restoreCursor = true; - updateCursor(); -#endif - - qt_qws_dnd_dragging = true; - - eventLoop = new QEventLoop; - (void) eventLoop->exec(); - delete eventLoop; - eventLoop = 0; - - delete qt_qws_dnd_deco; - qt_qws_dnd_deco = 0; - qt_qws_dnd_dragging = false; - - - return global_accepted_action; -} - - -void QDragManager::cancel(bool deleteSource) -{ -// qDebug("QDragManager::cancel"); - beingCancelled = true; - - if (object->target()) { - QDragLeaveEvent dle; - QApplication::sendEvent(object->target(), &dle); - } - -#ifndef QT_NO_CURSOR - if (restoreCursor) { - QApplication::restoreOverrideCursor(); - restoreCursor = false; - } -#endif - - if (drag_object) { - if (deleteSource) - object->deleteLater(); - drag_object = object = 0; - } - - delete qt_qws_dnd_deco; - qt_qws_dnd_deco = 0; - - global_accepted_action = Qt::IgnoreAction; -} - - -void QDragManager::drop() -{ -} - -QVariant QDropData::retrieveData_sys(const QString &mimetype, QVariant::Type type) const -{ - if (!drag_object) - return QVariant(); - QByteArray data = drag_object->mimeData()->data(mimetype); - if (type == QVariant::String) - return QString::fromUtf8(data); - return data; -} - -bool QDropData::hasFormat_sys(const QString &format) const -{ - return formats().contains(format); -} - -QStringList QDropData::formats_sys() const -{ - if (drag_object) - return drag_object->mimeData()->formats(); - return QStringList(); -} - - -#endif // QT_NO_DRAGANDDROP - - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp index fb07ea73156..399c4676430 100644 --- a/src/gui/kernel/qdrag.cpp +++ b/src/gui/kernel/qdrag.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include #include #include #include @@ -66,7 +65,7 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/dragging/mainwindow.cpp 1 Note that setMimeData() assigns ownership of the QMimeData object to the - QDrag object. The QDrag must be constructed on the heap with a parent QWidget + QDrag object. The QDrag must be constructed on the heap with a parent QObject to ensure that Qt can clean up after the drag and drop operation has been completed. @@ -107,7 +106,7 @@ QT_BEGIN_NAMESPACE /*! Constructs a new drag object for the widget specified by \a dragSource. */ -QDrag::QDrag(QWidget *dragSource) +QDrag::QDrag(QObject *dragSource) : QObject(*new QDragPrivate, dragSource) { Q_D(QDrag); @@ -203,7 +202,7 @@ QPoint QDrag::hotSpot() const Returns the source of the drag object. This is the widget where the drag and drop operation originated. */ -QWidget *QDrag::source() const +QObject *QDrag::source() const { Q_D(const QDrag); return d->source; @@ -213,7 +212,7 @@ QWidget *QDrag::source() const Returns the target of the drag and drop operation. This is the widget where the drag object was dropped. */ -QWidget *QDrag::target() const +QObject *QDrag::target() const { Q_D(const QDrag); return d->target; @@ -346,7 +345,7 @@ void QDrag::setDragCursor(const QPixmap &cursor, Qt::DropAction action) */ /*! - \fn void QDrag::targetChanged(QWidget *newTarget) + \fn void QDrag::targetChanged(QObject *newTarget) This signal is emitted when the target of the drag and drop operation changes, with \a newTarget the new target. diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h index d74f5cddf5d..b590c4f015a 100644 --- a/src/gui/kernel/qdrag.h +++ b/src/gui/kernel/qdrag.h @@ -53,7 +53,6 @@ QT_MODULE(Gui) #ifndef QT_NO_DRAGANDDROP class QMimeData; class QDragPrivate; -class QWidget; class QPixmap; class QPoint; class QDragManager; @@ -63,7 +62,7 @@ class Q_GUI_EXPORT QDrag : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QDrag) public: - explicit QDrag(QWidget *dragSource); + explicit QDrag(QObject *dragSource); ~QDrag(); void setMimeData(QMimeData *data); @@ -75,8 +74,8 @@ public: void setHotSpot(const QPoint &hotspot); QPoint hotSpot() const; - QWidget *source() const; - QWidget *target() const; + QObject *source() const; + QObject *target() const; Qt::DropAction start(Qt::DropActions supportedActions = Qt::CopyAction); Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction); @@ -86,12 +85,9 @@ public: Q_SIGNALS: void actionChanged(Qt::DropAction action); - void targetChanged(QWidget *newTarget); + void targetChanged(QObject *newTarget); private: -#ifdef Q_WS_MAC - friend class QWidgetPrivate; -#endif friend class QDragManager; Q_DISABLE_COPY(QDrag) }; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 5d356292fe2..ea19a0548d4 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -41,18 +41,13 @@ #include "qevent.h" #include "qcursor.h" -#include "qapplication.h" -#include "private/qapplication_p.h" +#include "private/qguiapplication_p.h" #include "private/qevent_p.h" #include "private/qkeysequence_p.h" -#include "qwidget.h" -#include "qgraphicsview.h" #include "qdebug.h" #include "qmime.h" -#include "qdnd_p.h" +#include "private/qdnd_p.h" #include "qevent_p.h" -#include "qgesture.h" -#include "qgesture_p.h" #include "qmath.h" #ifdef Q_OS_SYMBIAN @@ -73,7 +68,7 @@ QT_BEGIN_NAMESPACE \internal */ QInputEvent::QInputEvent(Type type, Qt::KeyboardModifiers modifiers) - : QEvent(type), modState(modifiers) + : QEvent(type), modState(modifiers), ts(0) {} /*! @@ -154,63 +149,50 @@ QInputEvent::~QInputEvent() QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick, or QEvent::MouseMove. - The \a position is the mouse cursor's position relative to the - receiving widget. + The \a localPos is the mouse cursor's position relative to the + receiving widget or item. The window position is set to the same value + as \a localPos. The \a button that caused the event is given as a value from the Qt::MouseButton enum. If the event \a type is \l MouseMove, the appropriate button for this event is Qt::NoButton. The mouse and keyboard states at the time of the event are specified by \a buttons and \a modifiers. - The globalPos() is initialized to QCursor::pos(), which may not + The screenPos() is initialized to QCursor::pos(), which may not be appropriate. Use the other constructor to specify the global position explicitly. */ - -QMouseEvent::QMouseEvent(Type type, const QPointF &position, Qt::MouseButton button, +QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) - : QInputEvent(type, modifiers), p(position), b(button), mouseState(buttons) + : QInputEvent(type, modifiers), l(localPos), w(localPos), b(button), mouseState(buttons) { - g = QCursor::pos(); + s = QCursor::pos(); } + /*! - \internal -*/ -QMouseEvent::~QMouseEvent() -{ -} + Constructs a mouse event object. -#ifdef QT3_SUPPORT -/*! - Use QMouseEvent(\a type, \a pos, \a button, \c buttons, \c - modifiers) instead, where \c buttons is \a state & - Qt::MouseButtonMask and \c modifiers is \a state & - Qt::KeyButtonMask. -*/ -QMouseEvent::QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state) - : QInputEvent(type), p(pos), b((Qt::MouseButton)button) -{ - g = QCursor::pos(); - mouseState = Qt::MouseButtons((state ^ b) & Qt::MouseButtonMask); - modState = Qt::KeyboardModifiers(state & (int)Qt::KeyButtonMask); -} + The \a type parameter must be QEvent::MouseButtonPress, + QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick, + or QEvent::MouseMove. -/*! - Use QMouseEvent(\a type, \a pos, \a globalPos, \a button, - \c buttons, \c modifiers) instead, where - \c buttons is \a state & Qt::MouseButtonMask and - \c modifiers is \a state & Qt::KeyButtonMask. -*/ -QMouseEvent::QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos, - Qt::ButtonState button, int state) - : QInputEvent(type), p(pos), g(globalPos), b((Qt::MouseButton)button) -{ - mouseState = Qt::MouseButtons((state ^ b) & Qt::MouseButtonMask); - modState = Qt::KeyboardModifiers(state & (int)Qt::KeyButtonMask); -} -#endif + The \a localPos is the mouse cursor's position relative to the + receiving widget or item. The cursor's position in screen coordinates is + specified by \a screenPos. The window position is set to the same value + as \a localPos. The \a button that caused the event is + given as a value from the \l Qt::MouseButton enum. If the event \a + type is \l MouseMove, the appropriate button for this event is + Qt::NoButton. \a buttons is the state of all buttons at the + time of the event, \a modifiers the state of all keyboard + modifiers. +*/ +QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &screenPos, + Qt::MouseButton button, Qt::MouseButtons buttons, + Qt::KeyboardModifiers modifiers) + : QInputEvent(type, modifiers), l(localPos), w(localPos), s(screenPos), b(button), mouseState(buttons) +{} /*! Constructs a mouse event object. @@ -229,30 +211,59 @@ QMouseEvent::QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos, modifiers. */ -QMouseEvent::QMouseEvent(Type type, const QPointF &pos, const QPointF &globalPos, +QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers) - : QInputEvent(type, modifiers), p(pos), g(globalPos), b(button), mouseState(buttons) + : QInputEvent(type, modifiers), l(localPos), w(windowPos), s(screenPos), b(button), mouseState(buttons) {} /*! - \fn bool QMouseEvent::hasExtendedInfo() const \internal */ +QMouseEvent::~QMouseEvent() +{ +} + + +/*! + \fn QPointF QMouseEvent::localPos() const + + \since 5.0 + + Returns the position of the mouse cursor as a QPointF, relative to the + widget or item that received the event. + + If you move the widget as a result of the mouse event, use the + screen position returned by screenPos() to avoid a shaking + motion. + + \sa x() y() windowPos() screenPos() +*/ /*! - \fn QPointF QMouseEvent::posF() const + \fn QPointF QMouseEvent::windowPos() const - \since 4.4 + \since 5.0 Returns the position of the mouse cursor as a QPointF, relative to the - widget that received the event. + window that received the event. If you move the widget as a result of the mouse event, use the global position returned by globalPos() to avoid a shaking motion. - \sa x() y() pos() globalPos() + \sa x() y() pos() localPos() screenPos() +*/ + +/*! + \fn QPointF QMouseEvent::screenPos() const + + \since 5.0 + + Returns the position of the mouse cursor as a QPointF, relative to the + screen that received the event. + + \sa x() y() pos() localPos() screenPos() */ /*! @@ -528,19 +539,6 @@ QWheelEvent::~QWheelEvent() { } -#ifdef QT3_SUPPORT -/*! - Use one of the other constructors instead. -*/ -QWheelEvent::QWheelEvent(const QPoint &pos, int delta, int state, Qt::Orientation orient) - : QInputEvent(Wheel), p(pos), d(delta), o(orient) -{ - g = QCursor::pos(); - mouseState = Qt::MouseButtons(state & Qt::MouseButtonMask); - modState = Qt::KeyboardModifiers(state & (int)Qt::KeyButtonMask); -} -#endif - /*! Constructs a wheel event object. @@ -558,18 +556,6 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), d(delta), mouseState(buttons), o(orient) {} -#ifdef QT3_SUPPORT -/*! - Use one of the other constructors instead. -*/ -QWheelEvent::QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state, - Qt::Orientation orient) - : QInputEvent(Wheel), p(pos), g(globalPos), d(delta), o(orient) -{ - mouseState = Qt::MouseButtons(state & Qt::MouseButtonMask); - modState = Qt::KeyboardModifiers(state & (int) Qt::KeyButtonMask); -} -#endif #endif // QT_NO_WHEELEVENT /*! @@ -884,7 +870,7 @@ Qt::KeyboardModifiers QKeyEvent::modifiers() const bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const { uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference - uint platform = QApplicationPrivate::currentPlatform(); + uint platform = QGuiApplicationPrivate::currentKeyPlatform(); #ifdef Q_WS_MAC if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { @@ -963,34 +949,6 @@ bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const \sa Qt::WA_KeyCompression */ -#ifdef QT3_SUPPORT -/*! - \fn QKeyEvent::QKeyEvent(Type type, int key, int ascii, - int modifiers, const QString &text, - bool autorep, ushort count) - - Use one of the other constructors instead. -*/ - -/*! - \fn int QKeyEvent::ascii() const - - Use text() instead. -*/ - -/*! - \fn Qt::ButtonState QKeyEvent::state() const - - Use QInputEvent::modifiers() instead. -*/ - -/*! - \fn Qt::ButtonState QKeyEvent::stateAfter() const - - Use modifiers() instead. -*/ -#endif - /*! \class QFocusEvent \brief The QFocusEvent class contains event parameters for widget focus @@ -1061,23 +1019,6 @@ Qt::FocusReason QFocusEvent::reason() const false. */ -#ifdef QT3_SUPPORT -/*! - \enum QFocusEvent::Reason - \compat - - Use Qt::FocusReason instead. - - \value Mouse Same as Qt::MouseFocusReason. - \value Tab Same as Qt::TabFocusReason. - \value Backtab Same as Qt::BacktabFocusReason. - \value MenuBar Same as Qt::MenuBarFocusReason. - \value ActiveWindow Same as Qt::ActiveWindowFocusReason - \value Other Same as Qt::OtherFocusReason - \value Popup Same as Qt::PopupFocusReason - \value Shortcut Same as Qt::ShortcutFocusReason -*/ -#endif /*! \class QPaintEvent @@ -1146,18 +1087,6 @@ QPaintEvent::QPaintEvent(const QRect &paintRect) {} -#ifdef QT3_SUPPORT - /*! - Constructs a paint event object with both a \a paintRegion and a - \a paintRect, both of which represent the area of the widget that - needs to be updated. - -*/ -QPaintEvent::QPaintEvent(const QRegion &paintRegion, const QRect &paintRect) - : QEvent(Paint), m_rect(paintRect), m_region(paintRegion), m_erased(false) -{} -#endif - /*! \internal */ @@ -1233,6 +1162,29 @@ QMoveEvent::~QMoveEvent() Returns the old position of the widget. */ +/*! + \class QExposeEvent + \brief The QExposeEvent class contains event parameters for expose events. + + \ingroup events + + Expose events are sent to widgets when an area of the widget is invalidated + and needs to be flushed from the backing store. + + The event handler QWindow::exposeEvent() receives expose events. +*/ +QExposeEvent::QExposeEvent(const QRegion &exposeRegion) + : QEvent(Expose) + , rgn(exposeRegion) +{ +} + +/*! + \internal +*/ +QExposeEvent::~QExposeEvent() +{ +} /*! \class QResizeEvent @@ -1424,17 +1376,6 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPo : QInputEvent(ContextMenu, modifiers), p(pos), gp(globalPos), reas(reason) {} -#ifdef QT3_SUPPORT -/*! - Constructs a context menu event with the given \a reason for the - position specified by \a pos in widget coordinates and \a globalPos - in global screen coordinates. \a dummy is ignored. -*/ -QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, - int /* dummy */) - : QInputEvent(ContextMenu), p(pos), gp(globalPos), reas(reason) -{} -#endif /*! \internal */ QContextMenuEvent::~QContextMenuEvent() @@ -1460,24 +1401,6 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos) gp = QCursor::pos(); } -#ifdef QT3_SUPPORT -/*! - Constructs a context menu event with the given \a reason for the - position specified by \a pos in widget coordinates. \a dummy is - ignored. -*/ -QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos, int /* dummy */) - : QInputEvent(ContextMenu), p(pos), reas(reason) -{ - gp = QCursor::pos(); -} - -Qt::ButtonState QContextMenuEvent::state() const -{ - return Qt::ButtonState(int(QApplication::keyboardModifiers())|QApplication::mouseButtons()); -} -#endif - /*! \fn const QPoint &QContextMenuEvent::pos() const @@ -1849,6 +1772,74 @@ void QInputMethodEvent::setCommitString(const QString &commitString, int replace \sa replacementStart(), setCommitString() */ + +/*! \class QInputMethodQueryEvent + + This event is sent by the input context to input objects. + + It is used by the + input method to query a set of properties of the object to be + able to support complex input method operations as support for + surrounding text and reconversions. + + query() specifies which property is queried. + + The object should call setValue() on the event to fill in the requested + data before calling accept(). +*/ +QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQueries queries) + : QEvent(InputMethodQuery), + m_queries(queries) +{ +} + +QInputMethodQueryEvent::~QInputMethodQueryEvent() +{ +} + + +void QInputMethodQueryEvent::setValue(Qt::InputMethodQuery q, const QVariant &v) +{ + for (int i = 0; i < m_values.size(); ++i) { + if (m_values.at(i).query == q) { + m_values[i].value = v; + return; + } + } + QueryPair pair = { q, v }; + m_values.append(pair); +} + +QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery q) const +{ + for (int i = 0; i < m_values.size(); ++i) + if (m_values.at(i).query == q) + return m_values.at(i).value; + return QVariant(); +} + +/*! + \fn Qt::InputMethodQuery QInputMethodQueryEvent::query() const + + returns the type of data queried. +*/ + +/*! + \fn QVariant QInputMethodQueryEvent::value() const + + returns the value set by the receiving object. Mainly used by the input method. + + \sa setValue() +*/ + +/*! + \fn QVariant QInputMethodQueryEvent::setValue() + + Used by the receiving object to set the value requested by query(). + + \sa setValue() +*/ + #ifndef QT_NO_TABLETEVENT /*! @@ -2303,7 +2294,7 @@ QDropEvent::QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeDa modState(modifiers), act(actions), mdata(data) { - default_action = QDragManager::self()->defaultAction(act, modifiers); + default_action = Qt::CopyAction; // ### Qt5: QDragManager::self()->defaultAction(act, modifiers); drop_action = default_action; ignore(); } @@ -2382,10 +2373,10 @@ bool QDropEvent::provides(const char *mimeType) const \sa QDrag::QDrag() */ -QWidget* QDropEvent::source() const +QObject* QDropEvent::source() const { QDragManager *manager = QDragManager::self(); - return manager ? manager->source() : 0; + return (manager && manager->object) ? manager->object->source() : 0; } @@ -2509,37 +2500,6 @@ void QDropEvent::setDropAction(Qt::DropAction action) \sa setDropAction(), proposedAction(), {QEvent::accept()}{accept()} */ -#ifdef QT3_SUPPORT -/*! - Use dropAction() instead. - - The table below shows the correspondance between the return type - of action() and the return type of dropAction(). - - \table - \header \i Old enum value \i New enum value - \row \i QDropEvent::Copy \i Qt::CopyAction - \row \i QDropEvent::Move \i Qt::MoveAction - \row \i QDropEvent::Link \i Qt::LinkAction - \row \i other \i Qt::CopyAction - \endtable -*/ - -QT3_SUPPORT QDropEvent::Action QDropEvent::action() const -{ - switch(drop_action) { - case Qt::CopyAction: - return Copy; - case Qt::MoveAction: - return Move; - case Qt::LinkAction: - return Link; - default: - return Copy; - } -} -#endif - /*! \fn void QDropEvent::setPoint(const QPoint &point) \compat @@ -2593,21 +2553,6 @@ QDragEnterEvent::~QDragEnterEvent() { } -/*! - Constructs a drag response event containing the \a accepted value, - indicating whether the drag and drop operation was accepted by the - recipient. -*/ -QDragResponseEvent::QDragResponseEvent(bool accepted) - : QEvent(DragResponse), a(accepted) -{} - -/*! \internal -*/ -QDragResponseEvent::~QDragResponseEvent() -{ -} - /*! \class QDragMoveEvent \brief The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress. @@ -3442,12 +3387,6 @@ QDebug operator<<(QDebug dbg, const QEvent *e) { case QEvent::UngrabKeyboard: n = "UngrabKeyboard"; break; -#ifdef QT3_SUPPORT - case QEvent::ChildInsertedRequest: - n = "ChildInsertedRequest"; - break; - case QEvent::ChildInserted: n = "ChildInserted"; -#endif case QEvent::ChildAdded: n = n ? n : "ChildAdded"; case QEvent::ChildPolished: n = n ? n : "ChildPolished"; case QEvent::ChildRemoved: n = n ? n : "ChildRemoved"; @@ -3599,60 +3538,6 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent() { } -#ifdef QT3_SUPPORT - -/*! - \class QMenubarUpdatedEvent - \internal - Event sent by QMenuBar to tell Q3Workspace to update itself. -*/ - -/*! \internal - -*/ -QMenubarUpdatedEvent::QMenubarUpdatedEvent(QMenuBar * const menuBar) -:QEvent(QEvent::MenubarUpdated), m_menuBar(menuBar) {} - -/*! - \fn QMenuBar *QMenubarUpdatedEvent::menuBar() - \internal -*/ - -/*! - \fn bool operator==(QKeyEvent *e, QKeySequence::StandardKey key) - - \relates QKeyEvent - - Returns true if \a key is currently bound to the key combination - specified by \a e. - - Equivalent to \c {e->matches(key)}. -*/ - -/*! - \fn bool operator==(QKeySequence::StandardKey key, QKeyEvent *e) - - \relates QKeyEvent - - Returns true if \a key is currently bound to the key combination - specified by \a e. - - Equivalent to \c {e->matches(key)}. -*/ - -/*! - \internal - - \class QKeyEventEx - \ingroup events - - \brief The QKeyEventEx class provides more extended information about a keyevent. - - This class is for internal use only, and exists to aid the shortcut system on - various platforms to get all the information it needs. -*/ - -#endif /*! \class QTouchEvent @@ -4288,317 +4173,6 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T return *this; } -#ifndef QT_NO_GESTURES -/*! - \class QGestureEvent - \since 4.6 - \ingroup events - \ingroup gestures - - \brief The QGestureEvent class provides the description of triggered gestures. - - The QGestureEvent class contains a list of gestures, which can be obtained using the - gestures() function. - - The gestures are either active or canceled. A list of those that are currently being - executed can be obtained using the activeGestures() function. A list of those which - were previously active and have been canceled can be accessed using the - canceledGestures() function. A gesture might be canceled if the current window loses - focus, for example, or because of a timeout, or for other reasons. - - If the event handler does not accept the event by calling the generic - QEvent::accept() function, all individual QGesture object that were not - accepted and in the Qt::GestureStarted state will be propagated up the - parent widget chain until a widget accepts them individually, by calling - QGestureEvent::accept() for each of them, or an event filter consumes the - event. - - \section1 Further Reading - - For an overview of gesture handling in Qt and information on using gestures - in your applications, see the \l{Gestures Programming} document. - - \sa QGesture, QGestureRecognizer, - QWidget::grabGesture(), QGraphicsObject::grabGesture() -*/ - -/*! - Creates new QGestureEvent containing a list of \a gestures. -*/ -QGestureEvent::QGestureEvent(const QList &gestures) - : QEvent(QEvent::Gesture) -{ - d = reinterpret_cast(new QGestureEventPrivate(gestures)); -} - -/*! - Destroys QGestureEvent. -*/ -QGestureEvent::~QGestureEvent() -{ - delete reinterpret_cast(d); -} - -/*! - Returns all gestures that are delivered in the event. -*/ -QList QGestureEvent::gestures() const -{ - return d_func()->gestures; -} - -/*! - Returns a gesture object by \a type. -*/ -QGesture *QGestureEvent::gesture(Qt::GestureType type) const -{ - const QGestureEventPrivate *d = d_func(); - for(int i = 0; i < d->gestures.size(); ++i) - if (d->gestures.at(i)->gestureType() == type) - return d->gestures.at(i); - return 0; -} - -/*! - Returns a list of active (not canceled) gestures. -*/ -QList QGestureEvent::activeGestures() const -{ - QList gestures; - foreach (QGesture *gesture, d_func()->gestures) { - if (gesture->state() != Qt::GestureCanceled) - gestures.append(gesture); - } - return gestures; -} - -/*! - Returns a list of canceled gestures. -*/ -QList QGestureEvent::canceledGestures() const -{ - QList gestures; - foreach (QGesture *gesture, d_func()->gestures) { - if (gesture->state() == Qt::GestureCanceled) - gestures.append(gesture); - } - return gestures; -} - -/*! - Sets the accept flag of the given \a gesture object to the specified \a value. - - Setting the accept flag indicates that the event receiver wants the \a gesture. - Unwanted gestures may be propagated to the parent widget. - - By default, gestures in events of type QEvent::Gesture are accepted, and - gestures in QEvent::GestureOverride events are ignored. - - For convenience, the accept flag can also be set with - \l{QGestureEvent::accept()}{accept(gesture)}, and cleared with - \l{QGestureEvent::ignore()}{ignore(gesture)}. -*/ -void QGestureEvent::setAccepted(QGesture *gesture, bool value) -{ - if (gesture) - setAccepted(gesture->gestureType(), value); -} - -/*! - Sets the accept flag of the given \a gesture object, the equivalent of calling - \l{QGestureEvent::setAccepted()}{setAccepted(gesture, true)}. - - Setting the accept flag indicates that the event receiver wants the - gesture. Unwanted gestures may be propagated to the parent widget. - - \sa QGestureEvent::ignore() -*/ -void QGestureEvent::accept(QGesture *gesture) -{ - if (gesture) - setAccepted(gesture->gestureType(), true); -} - -/*! - Clears the accept flag parameter of the given \a gesture object, the equivalent - of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}. - - Clearing the accept flag indicates that the event receiver does not - want the gesture. Unwanted gestures may be propagated to the parent widget. - - \sa QGestureEvent::accept() -*/ -void QGestureEvent::ignore(QGesture *gesture) -{ - if (gesture) - setAccepted(gesture->gestureType(), false); -} - -/*! - Returns true if the \a gesture is accepted; otherwise returns false. -*/ -bool QGestureEvent::isAccepted(QGesture *gesture) const -{ - return gesture ? isAccepted(gesture->gestureType()) : false; -} - -/*! - Sets the accept flag of the given \a gestureType object to the specified - \a value. - - Setting the accept flag indicates that the event receiver wants to receive - gestures of the specified type, \a gestureType. Unwanted gestures may be - propagated to the parent widget. - - By default, gestures in events of type QEvent::Gesture are accepted, and - gestures in QEvent::GestureOverride events are ignored. - - For convenience, the accept flag can also be set with - \l{QGestureEvent::accept()}{accept(gestureType)}, and cleared with - \l{QGestureEvent::ignore()}{ignore(gestureType)}. -*/ -void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value) -{ - setAccepted(false); - d_func()->accepted[gestureType] = value; -} - -/*! - Sets the accept flag of the given \a gestureType, the equivalent of calling - \l{QGestureEvent::setAccepted()}{setAccepted(gestureType, true)}. - - Setting the accept flag indicates that the event receiver wants the - gesture. Unwanted gestures may be propagated to the parent widget. - - \sa QGestureEvent::ignore() -*/ -void QGestureEvent::accept(Qt::GestureType gestureType) -{ - setAccepted(gestureType, true); -} - -/*! - Clears the accept flag parameter of the given \a gestureType, the equivalent - of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}. - - Clearing the accept flag indicates that the event receiver does not - want the gesture. Unwanted gestures may be propgated to the parent widget. - - \sa QGestureEvent::accept() -*/ -void QGestureEvent::ignore(Qt::GestureType gestureType) -{ - setAccepted(gestureType, false); -} - -/*! - Returns true if the gesture of type \a gestureType is accepted; otherwise - returns false. -*/ -bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const -{ - return d_func()->accepted.value(gestureType, true); -} - -/*! - \internal - - Sets the widget for this event to the \a widget specified. -*/ -void QGestureEvent::setWidget(QWidget *widget) -{ - d_func()->widget = widget; -} - -/*! - Returns the widget on which the event occurred. -*/ -QWidget *QGestureEvent::widget() const -{ - return d_func()->widget; -} - -#ifndef QT_NO_GRAPHICSVIEW -/*! - Returns the scene-local coordinates if the \a gesturePoint is inside a - graphics view. - - This functional might be useful when the gesture event is delivered to a - QGraphicsObject to translate a point in screen coordinates to scene-local - coordinates. - - \sa QPointF::isNull(). -*/ -QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const -{ - QWidget *w = widget(); - if (w) // we get the viewport as widget, not the graphics view - w = w->parentWidget(); - QGraphicsView *view = qobject_cast(w); - if (view) { - return view->mapToScene(view->mapFromGlobal(gesturePoint.toPoint())); - } - return QPointF(); -} -#endif //QT_NO_GRAPHICSVIEW - -/*! - \internal -*/ -QGestureEventPrivate *QGestureEvent::d_func() -{ - return reinterpret_cast(d); -} - -/*! - \internal -*/ -const QGestureEventPrivate *QGestureEvent::d_func() const -{ - return reinterpret_cast(d); -} - -#ifdef Q_NO_USING_KEYWORD -/*! - \fn void QGestureEvent::setAccepted(bool accepted) - - Sets or clears the event's internal flag that determines whether it should - be delivered to other objects. - - Calling this function with a value of true for \a accepted indicates that the - caller has accepted the event and that it should not be propagated further. - Calling this function with a value of false indicates that the caller has - ignored the event and that it should be delivered to other objects. - - For convenience, the accept flag can also be set with accept(), and cleared - with ignore(). - - \sa QEvent::accepted -*/ -/*! - \fn bool QGestureEvent::isAccepted() const - - Returns true is the event has been accepted; otherwise returns false. - - \sa QEvent::accepted -*/ -/*! - \fn void QGestureEvent::accept() - - Accepts the event, the equivalent of calling setAccepted(true). - - \sa QEvent::accept() -*/ -/*! - \fn void QGestureEvent::ignore() - - Ignores the event, the equivalent of calling setAccepted(false). - - \sa QEvent::ignore() -*/ -#endif - -#endif // QT_NO_GESTURES /*! \class QScrollPrepareEvent diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index a6196346a72..faa80d5c7d6 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -50,9 +50,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -78,8 +78,11 @@ public: ~QInputEvent(); inline Qt::KeyboardModifiers modifiers() const { return modState; } inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; } + inline ulong timestamp() const { return ts; } + inline void setTimestamp(ulong atimestamp) { ts = atimestamp; } protected: Qt::KeyboardModifiers modState; + ulong ts; }; class Q_GUI_EXPORT QMouseEvent : public QInputEvent @@ -90,31 +93,32 @@ public: QMouseEvent(Type type, const QPointF &pos, const QPointF &globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); + QMouseEvent(Type type, const QPointF &pos, const QPointF &windowPos, const QPointF &globalPos, + Qt::MouseButton button, Qt::MouseButtons buttons, + Qt::KeyboardModifiers modifiers); ~QMouseEvent(); - inline QPoint pos() const { return p.toPoint(); } - inline QPoint globalPos() const { return g.toPoint(); } - inline int x() const { return qRound(p.x()); } - inline int y() const { return qRound(p.y()); } - inline int globalX() const { return qRound(g.x()); } - inline int globalY() const { return qRound(g.y()); } +#ifndef QT_NO_INTEGER_EVENT_COORDINATES + inline QPoint pos() const { return l.toPoint(); } + inline QPoint globalPos() const { return s.toPoint(); } + inline int x() const { return qRound(l.x()); } + inline int y() const { return qRound(l.y()); } + inline int globalX() const { return qRound(s.x()); } + inline int globalY() const { return qRound(s.y()); } +#endif + const QPointF &localPos() const { return l; } + const QPointF &windowPos() const { return w; } + const QPointF &screenPos() const { return s; } + inline Qt::MouseButton button() const { return b; } inline Qt::MouseButtons buttons() const { return mouseState; } - const QPointF &posF() const { return p; } - const QPointF &globalPosF() const { return g; } - -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state); - QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos, - Qt::ButtonState button, int state); - inline QT3_SUPPORT Qt::ButtonState state() const - { return Qt::ButtonState((mouseState^b)|int(modifiers())); } - inline QT3_SUPPORT Qt::ButtonState stateAfter() const - { return Qt::ButtonState(int(mouseState)|int(modifiers())); } +#if QT_DEPRECATED_SINCE(5, 0) + Q_DEPRECATED inline QPointF posF() const { return l; } #endif + protected: - QPointF p, g; + QPointF l, w, s; Qt::MouseButton b; Qt::MouseButtons mouseState; }; @@ -125,8 +129,10 @@ public: QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier); ~QHoverEvent(); +#ifndef QT_NO_INTEGER_EVENT_COORDINATES inline QPoint pos() const { return p.toPoint(); } inline QPoint oldPos() const { return op.toPoint(); } +#endif inline const QPointF &posF() const { return p; } inline const QPointF &oldPosF() const { return op; } @@ -148,27 +154,21 @@ public: ~QWheelEvent(); inline int delta() const { return d; } +#ifndef QT_NO_INTEGER_EVENT_COORDINATES inline QPoint pos() const { return p.toPoint(); } inline QPoint globalPos() const { return g.toPoint(); } inline int x() const { return p.x(); } inline int y() const { return p.y(); } inline int globalX() const { return g.x(); } inline int globalY() const { return g.y(); } +#endif + inline const QPointF &posF() const { return p; } + inline const QPointF &globalPosF() const { return g; } inline Qt::MouseButtons buttons() const { return mouseState; } Qt::Orientation orientation() const { return o; } - inline const QPointF &posF() const { return p; } - inline const QPointF &globalPosF() const { return g; } -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, int delta, int state, - Qt::Orientation orient = Qt::Vertical); - QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state, - Qt::Orientation orient = Qt::Vertical); - inline QT3_SUPPORT Qt::ButtonState state() const - { return static_cast(int(buttons())|int(modifiers())); } -#endif protected: QPointF p; QPointF g; @@ -251,22 +251,6 @@ public: quint32 nativeVirtualKey() const; quint32 nativeModifiers() const; -#ifdef QT3_SUPPORT - inline QT3_SUPPORT_CONSTRUCTOR QKeyEvent(Type type, int key, int /*ascii*/, - int modifiers, const QString& text = QString(), - bool autorep = false, ushort count = 1) - : QInputEvent(type, Qt::KeyboardModifiers(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key), - c(count), autor(autorep) - { - if (key >= Qt::Key_Back && key <= Qt::Key_MediaLast) - ignore(); - } - inline QT3_SUPPORT int ascii() const - { return (txt.length() ? txt.unicode()->toLatin1() : 0); } - inline QT3_SUPPORT Qt::ButtonState state() const { return Qt::ButtonState(QInputEvent::modifiers()); } - inline QT3_SUPPORT Qt::ButtonState stateAfter() const { return Qt::ButtonState(modifiers()); } -#endif - protected: QString txt; int k; @@ -284,12 +268,6 @@ public: inline bool gotFocus() const { return type() == FocusIn; } inline bool lostFocus() const { return type() == FocusOut; } -#ifdef QT3_SUPPORT - enum Reason { Mouse=Qt::MouseFocusReason, Tab=Qt::TabFocusReason, - Backtab=Qt::BacktabFocusReason, MenuBar=Qt::MenuBarFocusReason, - ActiveWindow=Qt::ActiveWindowFocusReason, Other=Qt::OtherFocusReason, - Popup=Qt::PopupFocusReason, Shortcut=Qt::ShortcutFocusReason }; -#endif Qt::FocusReason reason(); Qt::FocusReason reason() const; @@ -308,12 +286,6 @@ public: inline const QRect &rect() const { return m_rect; } inline const QRegion ®ion() const { return m_region; } -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QPaintEvent(const QRegion &paintRegion, const QRect &paintRect); - inline QT3_SUPPORT bool erased() const { return m_erased; } - inline QT3_SUPPORT void setErased(bool b) { m_erased = b; } -#endif - protected: friend class QApplication; friend class QCoreApplication; @@ -322,7 +294,8 @@ protected: bool m_erased; }; -class QUpdateLaterEvent : public QEvent +// ### Qt5: make internal +class Q_GUI_EXPORT QUpdateLaterEvent : public QEvent { public: QUpdateLaterEvent(const QRegion& paintRegion); @@ -348,6 +321,17 @@ protected: friend class QCoreApplication; }; +class Q_GUI_EXPORT QExposeEvent : public QEvent +{ +public: + QExposeEvent(const QRegion &rgn); + ~QExposeEvent(); + + inline const QRegion ®ion() const { return rgn; } + +protected: + QRegion rgn; +}; class Q_GUI_EXPORT QResizeEvent : public QEvent { @@ -417,12 +401,6 @@ public: inline Reason reason() const { return Reason(reas); } -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, int); - QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, int); - - QT3_SUPPORT Qt::ButtonState state() const; -#endif protected: QPoint p; QPoint gp; @@ -470,6 +448,26 @@ private: int replace_from; int replace_length; }; + +class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent +{ +public: + QInputMethodQueryEvent(Qt::InputMethodQueries queries); + ~QInputMethodQueryEvent(); + + Qt::InputMethodQueries queries() const { return m_queries; } + + void setValue(Qt::InputMethodQuery q, const QVariant &v); + QVariant value(Qt::InputMethodQuery q) const; +private: + Qt::InputMethodQueries m_queries; + struct QueryPair { + Qt::InputMethodQuery query; + QVariant value; + }; + QVector m_values; +}; + #endif // QT_NO_INPUTMETHOD #ifndef QT_NO_DRAGANDDROP @@ -497,7 +495,7 @@ public: inline Qt::DropAction dropAction() const { return drop_action; } void setDropAction(Qt::DropAction action); - QWidget* source() const; + QObject* source() const; inline const QMimeData *mimeData() const { return mdata; } // QT3_SUPPORT @@ -505,16 +503,6 @@ public: QByteArray encodedData(const char*) const; bool provides(const char*) const; // END QT3_SUPPORT -#ifdef QT3_SUPPORT - inline void accept() { QEvent::accept(); } - inline QT3_SUPPORT void accept(bool y) { setAccepted(y); } - inline QT3_SUPPORT QByteArray data(const char* f) const { return encodedData(f); } - - enum Action { Copy, Link, Move, Private, UserAction = Private }; - QT3_SUPPORT Action action() const; - inline QT3_SUPPORT void acceptAction(bool y = true) { if (y) { drop_action = default_action; accept(); } } - inline QT3_SUPPORT void setPoint(const QPoint& np) { p = np; } -#endif protected: @@ -545,10 +533,6 @@ public: inline void accept(const QRect & r) { accept(); rect = r; } inline void ignore(const QRect & r) { ignore(); rect = r; } -#ifdef QT3_SUPPORT - inline QT3_SUPPORT void accept(bool y) { setAccepted(y); } -#endif - protected: friend class QApplication; QRect rect; @@ -564,19 +548,6 @@ public: }; -/* An internal class */ -class Q_GUI_EXPORT QDragResponseEvent : public QEvent -{ -public: - QDragResponseEvent(bool accepted); - ~QDragResponseEvent(); - - inline bool dragAccepted() const { return a; } -protected: - bool a; -}; - - class Q_GUI_EXPORT QDragLeaveEvent : public QEvent { public: @@ -719,18 +690,6 @@ private: Qt::WindowStates ostate; }; -#ifdef QT3_SUPPORT -class QMenuBar; -class Q_GUI_EXPORT QMenubarUpdatedEvent: public QEvent -{ -public: - QMenubarUpdatedEvent(QMenuBar * const menBar); - inline QMenuBar *menuBar() { return m_menuBar; } -private: - QMenuBar *m_menuBar; -}; -#endif - #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *); #endif @@ -801,6 +760,8 @@ public: private: QTouchEventTouchPointPrivate *d; + friend class QGuiApplication; + friend class QGuiApplicationPrivate; friend class QApplication; friend class QApplicationPrivate; }; @@ -834,63 +795,12 @@ protected: Qt::TouchPointStates _touchPointStates; QList _touchPoints; + friend class QGuiApplication; + friend class QGuiApplicationPrivate; friend class QApplication; friend class QApplicationPrivate; }; -#ifndef QT_NO_GESTURES -class QGesture; -class QGestureEventPrivate; -class Q_GUI_EXPORT QGestureEvent : public QEvent -{ -public: - QGestureEvent(const QList &gestures); - ~QGestureEvent(); - - QList gestures() const; - QGesture *gesture(Qt::GestureType type) const; - - QList activeGestures() const; - QList canceledGestures() const; - -#ifdef Q_NO_USING_KEYWORD - inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); } - inline bool isAccepted() const { return QEvent::isAccepted(); } - - inline void accept() { QEvent::accept(); } - inline void ignore() { QEvent::ignore(); } -#else - using QEvent::setAccepted; - using QEvent::isAccepted; - using QEvent::accept; - using QEvent::ignore; -#endif - - void setAccepted(QGesture *, bool); - void accept(QGesture *); - void ignore(QGesture *); - bool isAccepted(QGesture *) const; - - void setAccepted(Qt::GestureType, bool); - void accept(Qt::GestureType); - void ignore(Qt::GestureType); - bool isAccepted(Qt::GestureType) const; - - void setWidget(QWidget *widget); - QWidget *widget() const; - -#ifndef QT_NO_GRAPHICSVIEW - QPointF mapToGraphicsScene(const QPointF &gesturePoint) const; -#endif - -private: - QGestureEventPrivate *d_func(); - const QGestureEventPrivate *d_func() const; - - friend class QApplication; - friend class QGestureManager; -}; -#endif // QT_NO_GESTURES class QScrollPrepareEventPrivate; class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index ffe1dfdefcf..59eb2702302 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -110,53 +110,6 @@ public: qreal pressure; }; -#ifndef QT_NO_GESTURES -class QNativeGestureEvent : public QEvent -{ -public: - enum Type { - None, - GestureBegin, - GestureEnd, - Pan, - Zoom, - Rotate, - Swipe - }; - - QNativeGestureEvent() - : QEvent(QEvent::NativeGesture), gestureType(None), percentage(0) -#ifdef Q_WS_WIN - , sequenceId(0), argument(0) -#endif - { - } - - Type gestureType; - float percentage; - QPoint position; - float angle; -#ifdef Q_WS_WIN - ulong sequenceId; - quint64 argument; -#endif -}; - -class QGestureEventPrivate -{ -public: - inline QGestureEventPrivate(const QList &list) - : gestures(list), widget(0) - { - } - - QList gestures; - QWidget *widget; - QMap accepted; - QMap targetWidgets; -}; -#endif // QT_NO_GESTURES - class QFileOpenEventPrivate { public: diff --git a/src/gui/kernel/qeventdispatcher_glib_qws.cpp b/src/gui/kernel/qeventdispatcher_glib_qws.cpp deleted file mode 100644 index 0c2dd994f78..00000000000 --- a/src/gui/kernel/qeventdispatcher_glib_qws.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qeventdispatcher_glib_qws_p.h" - -#include "qapplication.h" - -#include "qplatformdefs.h" -#include "qapplication.h" -#include "private/qwscommand_qws_p.h" -#include "qwsdisplay_qws.h" -#include "qwsevent_qws.h" -#include "qwindowsystem_qws.h" - -#include - -QT_BEGIN_NAMESPACE - -// from qapplication_qws.cpp -extern QWSDisplay* qt_fbdpy; // QWS `display' - -//from qwindowsystem_qws.cpp -extern QList *qt_get_server_queue(); - -struct GQWSEventSource -{ - GSource source; - QEventLoop::ProcessEventsFlags flags; - QWSEventDispatcherGlib *q; - QWSEventDispatcherGlibPrivate *d; -}; - -class QWSEventDispatcherGlibPrivate : public QEventDispatcherGlibPrivate -{ - Q_DECLARE_PUBLIC(QWSEventDispatcherGlib) - -public: - QWSEventDispatcherGlibPrivate(); - GQWSEventSource *qwsEventSource; - QList queuedUserInputEvents; -}; - -static gboolean qwsEventSourcePrepare(GSource *s, gint *timeout) -{ - if (timeout) - *timeout = -1; - GQWSEventSource *source = reinterpret_cast(s); - return qt_fbdpy->eventPending() || !source->d->queuedUserInputEvents.isEmpty() - || !qt_get_server_queue()->isEmpty() ; -} - -static gboolean qwsEventSourceCheck(GSource *s) -{ - GQWSEventSource *source = reinterpret_cast(s); - return qt_fbdpy->eventPending() || !source->d->queuedUserInputEvents.isEmpty() - || !qt_get_server_queue()->isEmpty() ; -} - -static gboolean qwsEventSourceDispatch(GSource *s, GSourceFunc callback, gpointer user_data) -{ - GQWSEventSource *source = reinterpret_cast(s); - - //??? ulong marker = XNextRequest(X11->display); - do { - QWSEvent *event; - if (!(source->flags & QEventLoop::ExcludeUserInputEvents) - && !source->d->queuedUserInputEvents.isEmpty()) { - // process a pending user input event - event = source->d->queuedUserInputEvents.takeFirst(); - } else if (qt_fbdpy->eventPending()) { - event = qt_fbdpy->getEvent(); - - if (source->flags & QEventLoop::ExcludeUserInputEvents) { - // queue user input events - - if (event->type == QWSEvent::Mouse || event->type == QWSEvent::Key) { - source->d->queuedUserInputEvents.append(event); - continue; - } - } - } else { - // no event to process - break; - } - - // send through event filter - if (source->q->filterEvent(event)) { - delete event; - continue; - } - - bool ret = qApp->qwsProcessEvent(event) == 1; - delete event; - if (ret) { - return true; - } - - } while (qt_fbdpy->eventPending()); - - if (callback) - callback(user_data); - return true; -} - -static GSourceFuncs qwsEventSourceFuncs = { - qwsEventSourcePrepare, - qwsEventSourceCheck, - qwsEventSourceDispatch, - NULL, - NULL, - NULL -}; - -QWSEventDispatcherGlibPrivate::QWSEventDispatcherGlibPrivate() -{ - qwsEventSource = reinterpret_cast(g_source_new(&qwsEventSourceFuncs, - sizeof(GQWSEventSource))); - g_source_set_can_recurse(&qwsEventSource->source, true); - - qwsEventSource->flags = QEventLoop::AllEvents; - qwsEventSource->q = 0; - qwsEventSource->d = 0; - - g_source_attach(&qwsEventSource->source, mainContext); -} - -QWSEventDispatcherGlib::QWSEventDispatcherGlib(QObject *parent) - : QEventDispatcherGlib(*new QWSEventDispatcherGlibPrivate, parent) -{ -} - -QWSEventDispatcherGlib::~QWSEventDispatcherGlib() -{ - Q_D(QWSEventDispatcherGlib); - - g_source_destroy(&d->qwsEventSource->source); - d->qwsEventSource = 0; -} - -bool QWSEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags) -{ - Q_D(QWSEventDispatcherGlib); - QEventLoop::ProcessEventsFlags saved_flags = d->qwsEventSource->flags; - d->qwsEventSource->flags = flags; - bool returnValue = QEventDispatcherGlib::processEvents(flags); - d->qwsEventSource->flags = saved_flags; - return returnValue; -} - -void QWSEventDispatcherGlib::startingUp() -{ - Q_D(QWSEventDispatcherGlib); - d->qwsEventSource->q = this; - d->qwsEventSource->d = d; -} - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_glib_qws_p.h b/src/gui/kernel/qeventdispatcher_glib_qws_p.h deleted file mode 100644 index ba6e836a4b1..00000000000 --- a/src/gui/kernel/qeventdispatcher_glib_qws_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWSEVENTDISPATCHER_GLIB_P_H -#define QWSEVENTDISPATCHER_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 - -QT_BEGIN_NAMESPACE - -class QWSEventDispatcherGlibPrivate; - -class QWSEventDispatcherGlib : public QEventDispatcherGlib -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWSEventDispatcherGlib) - -public: - explicit QWSEventDispatcherGlib(QObject *parent = 0); - ~QWSEventDispatcherGlib(); - - bool processEvents(QEventLoop::ProcessEventsFlags flags); - - void startingUp(); -}; - -QT_END_NAMESPACE - -#endif // QWSEVENTDISPATCHER_GLIB_P_H diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp deleted file mode 100644 index 200696d104e..00000000000 --- a/src/gui/kernel/qeventdispatcher_qpa.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformdefs.h" -#include "qapplication.h" -#include "qeventdispatcher_qpa_p.h" -#include "private/qeventdispatcher_unix_p.h" -#include "qapplication_p.h" -#include "qplatformeventloopintegration_qpa.h" - -#include -#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: - QEventDispatcherQPAPrivate() - : eventLoopIntegration(0), - barrierBeforeBlocking(0), - barrierReturnValue(0), - selectReturnMutex(0), - selectWorkerNeedsSync(true), - selectWorkerHasResult(false), - m_integrationInitialised(false), - m_hasIntegration(false), - m_isEventLoopIntegrationRunning(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; - } - - bool isEventLoopIntegrationRunning() const - { - return m_isEventLoopIntegrationRunning; - } - - void runEventLoopIntegration() - { - if (qApp && (qApp->thread() == QThread::currentThread())) { - m_isEventLoopIntegrationRunning = true; - eventLoopIntegration->startEventLoop(); - } - } - - QPlatformEventLoopIntegration *eventLoopIntegration; - Rendezvous *barrierBeforeBlocking; - Rendezvous *barrierReturnValue; - - QMutex *selectReturnMutex; - bool selectWorkerNeedsSync; - bool selectWorkerHasResult; - - SelectWorker *selectWorker; -private: - bool m_integrationInitialised; - bool m_hasIntegration; - bool m_isEventLoopIntegrationRunning; -}; - -QEventDispatcherQPA::QEventDispatcherQPA(QObject *parent) - : QEventDispatcherUNIX(*new QEventDispatcherQPAPrivate, parent) -{ } - -QEventDispatcherQPA::~QEventDispatcherQPA() -{ } - -bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags) -{ - Q_D(QEventDispatcherQPA); - - if (d->hasIntegration()) { - if (!d->isEventLoopIntegrationRunning()) { - d->runEventLoopIntegration(); - } - if (d->threadData->quitNow) { - d->eventLoopIntegration->quitEventLoop(); - return false; - } - } - - int nevents = 0; - - // handle gui and posted events - d->interrupt = false; - QApplication::sendPostedEvents(); - - while (!d->interrupt) { // also flushes output buffer ###can be optimized - QWindowSystemInterfacePrivate::WindowSystemEvent *event; - if (!(flags & QEventLoop::ExcludeUserInputEvents) - && QWindowSystemInterfacePrivate::windowSystemEventsQueued() > 0) { - // process a pending user input event - event = QWindowSystemInterfacePrivate::getWindowSystemEvent(); - if (!event) - break; - } else { - break; - } - - if (filterEvent(event)) { - delete event; - continue; - } - nevents++; - - QApplicationPrivate::processWindowSystemEvent(event); - delete event; - } - - if (!d->interrupt) { - if (QEventDispatcherUNIX::processEvents(flags)) { - QEventDispatcherUNIX::processEvents(flags); - return true; - } - } - return (nevents > 0); -} - -bool QEventDispatcherQPA::hasPendingEvents() -{ - extern uint qGlobalPostedEventsCount(); // from qapplication.cpp - return qGlobalPostedEventsCount() || QWindowSystemInterfacePrivate::windowSystemEventsQueued(); -} - -void QEventDispatcherQPA::registerSocketNotifier(QSocketNotifier *notifier) -{ - Q_D(QEventDispatcherQPA); - QEventDispatcherUNIX::registerSocketNotifier(notifier); - if (d->hasIntegration()) - wakeUp(); - -} - -void QEventDispatcherQPA::unregisterSocketNotifier(QSocketNotifier *notifier) -{ - Q_D(QEventDispatcherQPA); - QEventDispatcherUNIX::unregisterSocketNotifier(notifier); - if (d->hasIntegration()) - wakeUp(); -} - -void QEventDispatcherQPA::flush() -{ - if(qApp) - qApp->sendPostedEvents(); -} - -int QEventDispatcherQPA::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - timeval *timeout) -{ - Q_D(QEventDispatcherQPA); - int retVal = 0; - if (d->hasIntegration()) { - qint64 timeoutmsec = 0; - if (timeout) - 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(); - d->eventLoopIntegration->setNextTimerEvent(0); - return retVal; - } else { - d->selectWorkerNeedsSync = false; - d->selectWorker->setSelectValues(nfds,readfds, writefds, exceptfds); - d->barrierBeforeBlocking->checkpoint(); - } - } - d->selectReturnMutex->unlock(); - d->eventLoopIntegration->setNextTimerEvent(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->qtNeedsToProcessEvents(); - - 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_qws.cpp b/src/gui/kernel/qeventdispatcher_qws.cpp deleted file mode 100644 index cc39c037736..00000000000 --- a/src/gui/kernel/qeventdispatcher_qws.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformdefs.h" -#include "qapplication.h" -#include "private/qwscommand_qws_p.h" -#include "qwsdisplay_qws.h" -#include "qwsevent_qws.h" -#include "qwindowsystem_qws.h" -#include "qeventdispatcher_qws_p.h" -#include "private/qeventdispatcher_unix_p.h" -#ifndef QT_NO_THREAD -# include "qmutex.h" -#endif - -#include - -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE - -class QEventDispatcherQWSPrivate : public QEventDispatcherUNIXPrivate -{ - Q_DECLARE_PUBLIC(QEventDispatcherQWS) -public: - inline QEventDispatcherQWSPrivate() - { } - QList queuedUserInputEvents; -}; - - -QEventDispatcherQWS::QEventDispatcherQWS(QObject *parent) - : QEventDispatcherUNIX(*new QEventDispatcherQWSPrivate, parent) -{ } - -QEventDispatcherQWS::~QEventDispatcherQWS() -{ } - - - -// from qapplication_qws.cpp -extern QWSDisplay* qt_fbdpy; // QWS `display' - -//#define ZERO_FOR_THE_MOMENT - -bool QEventDispatcherQWS::processEvents(QEventLoop::ProcessEventsFlags flags) -{ - Q_D(QEventDispatcherQWS); - // process events from the QWS server - int nevents = 0; - - // handle gui and posted events - d->interrupt = false; - QApplication::sendPostedEvents(); - - while (!d->interrupt) { // also flushes output buffer ###can be optimized - QWSEvent *event; - if (!(flags & QEventLoop::ExcludeUserInputEvents) - && !d->queuedUserInputEvents.isEmpty()) { - // process a pending user input event - event = d->queuedUserInputEvents.takeFirst(); - } else if (qt_fbdpy->eventPending()) { - event = qt_fbdpy->getEvent(); // get next event - if (flags & QEventLoop::ExcludeUserInputEvents) { - // queue user input events - if (event->type == QWSEvent::Mouse || event->type == QWSEvent::Key) { - d->queuedUserInputEvents.append(event); - continue; - } - } - } else { - break; - } - - if (filterEvent(event)) { - delete event; - continue; - } - nevents++; - - bool ret = qApp->qwsProcessEvent(event) == 1; - delete event; - if (ret) { - return true; - } - } - - if (!d->interrupt) { - extern QList *qt_get_server_queue(); - if (!qt_get_server_queue()->isEmpty()) { - QWSServer::processEventQueue(); - } - - if (QEventDispatcherUNIX::processEvents(flags)) - return true; - } - return (nevents > 0); -} - -bool QEventDispatcherQWS::hasPendingEvents() -{ - extern uint qGlobalPostedEventsCount(); // from qapplication.cpp - return qGlobalPostedEventsCount() || qt_fbdpy->eventPending(); -} - -void QEventDispatcherQWS::startingUp() -{ - -} - -void QEventDispatcherQWS::closingDown() -{ - -} - -void QEventDispatcherQWS::flush() -{ - if(qApp) - qApp->sendPostedEvents(); - (void)qt_fbdpy->eventPending(); // flush -} - - -int QEventDispatcherQWS::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/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp index fb6a0d85fdb..7c0975ac1d4 100644 --- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp +++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp @@ -41,7 +41,7 @@ #include "qgenericpluginfactory_qpa.h" -#include "qapplication.h" +#include "qguiapplication.h" #include "private/qfactoryloader_p.h" #include "qgenericplugin_qpa.h" #include "qdebug.h" diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp new file mode 100644 index 00000000000..212afdf8dce --- /dev/null +++ b/src/gui/kernel/qguiapplication.cpp @@ -0,0 +1,1495 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qguiapplication.h" + +#include "private/qguiapplication_p.h" +#include "private/qplatformintegrationfactory_qpa_p.h" +#include "private/qevent_p.h" +#include "qfont.h" +#include "qplatformfontdatabase_qpa.h" +#include "qplatformwindow_qpa.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include "private/qwindowsysteminterface_qpa_p.h" +#include "private/qwindow_p.h" +#include "private/qkeymapper_p.h" +#include "private/qcursor_p.h" +#include "private/qdnd_p.h" +#ifndef QT_NO_CURSOR +#include "qplatformcursor_qpa.h" +#endif + +#include + +#ifndef QT_NO_CLIPBOARD +#include +#endif + +QT_BEGIN_NAMESPACE + +Q_GUI_EXPORT bool qt_is_gui_used = true; + +Qt::MouseButtons QGuiApplicationPrivate::mouse_buttons = Qt::NoButton; +Qt::KeyboardModifiers QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier; + +QPointF QGuiApplicationPrivate::lastCursorPosition(0.0, 0.0); + +QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0; + +bool QGuiApplicationPrivate::app_do_modal = false; + +QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette + +Qt::MouseButtons QGuiApplicationPrivate::buttons = Qt::NoButton; +ulong QGuiApplicationPrivate::mousePressTime = 0; +Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton; +int QGuiApplicationPrivate::mousePressX = 0; +int QGuiApplicationPrivate::mousePressY = 0; +int QGuiApplicationPrivate::mouse_double_click_distance = 5; + +bool QGuiApplicationPrivate::quitOnLastWindowClosed = true; + +static Qt::LayoutDirection layout_direction = Qt::LeftToRight; +static bool force_reverse = false; + +QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0; + +#ifndef QT_NO_CLIPBOARD +QClipboard *QGuiApplicationPrivate::qt_clipboard = 0; +#endif + +QList QGuiApplicationPrivate::screen_list; + +QWindowList QGuiApplicationPrivate::window_list; +QWindow *QGuiApplicationPrivate::active_window = 0; + +Q_GLOBAL_STATIC(QMutex, applicationFontMutex) +QFont *QGuiApplicationPrivate::app_font = 0; + +extern int qRegisterGuiVariant(); +extern int qUnregisterGuiVariant(); +extern void qInitDrawhelperAsm(); +extern void qInitImageConversions(); + +static bool qt_detectRTLLanguage() +{ + return force_reverse ^ + (QCoreApplication::tr("QT_LAYOUT_DIRECTION", + "Translate this string to the string 'LTR' in left-to-right" + " languages or to 'RTL' in right-to-left languages (such as Hebrew" + " and Arabic) to get proper widget layout.") == QLatin1String("RTL")); +} + + +QGuiApplication::QGuiApplication(int &argc, char **argv, int flags) + : QCoreApplication(*new QGuiApplicationPrivate(argc, argv, flags)) +{ + d_func()->init(); + + QCoreApplicationPrivate::eventDispatcher->startingUp(); +} + +QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p) + : QCoreApplication(p) +{ + d_func()->init(); +} + +QGuiApplication::~QGuiApplication() +{ + Q_D(QGuiApplication); + // flush clipboard contents + if (QGuiApplicationPrivate::qt_clipboard) { + QEvent event(QEvent::Clipboard); + QGuiApplication::sendEvent(QGuiApplicationPrivate::qt_clipboard, &event); + } + + d->eventDispatcher->closingDown(); + d->eventDispatcher = 0; + + delete QGuiApplicationPrivate::qt_clipboard; + QGuiApplicationPrivate::qt_clipboard = 0; + + delete QGuiApplicationPrivate::app_pal; + QGuiApplicationPrivate::app_pal = 0; + + qUnregisterGuiVariant(); + +#ifndef QT_NO_CURSOR + d->cursor_list.clear(); +#endif +} + +QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags) + : QCoreApplicationPrivate(argc, argv, flags), + styleHints(0), + inputPanel(0) +{ + self = this; +} + +QWindow *QGuiApplication::activeWindow() +{ + return QGuiApplicationPrivate::active_window; +} + +QWindowList QGuiApplication::topLevelWindows() +{ + return QGuiApplicationPrivate::window_list; +} + +QScreen *QGuiApplication::primaryScreen() +{ + if (QGuiApplicationPrivate::screen_list.isEmpty()) + return 0; + return QGuiApplicationPrivate::screen_list.at(0); +} + +QList QGuiApplication::screens() +{ + return QGuiApplicationPrivate::screen_list; +} + +QWindow *QGuiApplication::topLevelAt(const QPoint &pos) +{ + QList screens = QGuiApplication::screens(); + QList::const_iterator screen = screens.constBegin(); + QList::const_iterator end = screens.constEnd(); + + while (screen != end) { + if ((*screen)->geometry().contains(pos)) + return (*screen)->handle()->topLevelAt(pos); + ++screen; + } + return 0; +} + + +static void init_platform(QString name, const QString &platformPluginPath) +{ + if (name.isEmpty()) { + const QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); +#if defined(Q_OS_MAC) + const QString defaultPlatform = QLatin1String("cocoa"); +#elif defined (Q_OS_WIN) + const QString defaultPlatform = QLatin1String("windows"); +#else + const QString defaultPlatform = QLatin1String("xcb"); +#endif + if (keys.contains(defaultPlatform)) { + qWarning("No platform plugin argument was specified, defaulting to \"%s\".", + qPrintable(defaultPlatform)); + name = defaultPlatform; + } else { + qFatal("No platform plugin argument was specified and the default plugin \"%s\" is not available", + qPrintable(defaultPlatform)); + } + } + + QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, platformPluginPath); + if (!QGuiApplicationPrivate::platform_integration) { + QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath); + QString fatalMessage = + QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name); + foreach(const QString &key, keys) { + fatalMessage.append(key + QLatin1Char('\n')); + } + qFatal("%s", fatalMessage.toLocal8Bit().constData()); + } +} + +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; + } +} + +void QGuiApplicationPrivate::createPlatformIntegration() +{ + Q_Q(QGuiApplication); + + // Use the Qt menus by default. Platform plugins that + // want to enable a native menu implementation can clear + // this flag. + q->setAttribute(Qt::AA_DontUseNativeMenuBar, true); + + // Load the platform integration + QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH")); + QByteArray platformName; +#ifdef QT_QPA_DEFAULT_PLATFORM_NAME + platformName = QT_QPA_DEFAULT_PLATFORM_NAME; +#endif + QByteArray platformNameEnv = qgetenv("QT_QPA_PLATFORM"); + if (!platformNameEnv.isEmpty()) { + platformName = platformNameEnv; + } + + // Get command line params + + int j = argc ? 1 : 0; + for (int i=1; iguiThreadEventDispatcher(); + setEventDispatcher(eventDispatcher); + } +} + +void QGuiApplicationPrivate::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher) +{ + Q_Q(QGuiApplication); + + if (!QCoreApplicationPrivate::eventDispatcher) { + QCoreApplicationPrivate::eventDispatcher = eventDispatcher; + QCoreApplicationPrivate::eventDispatcher->setParent(q); + threadData->eventDispatcher = eventDispatcher; + } + +} + +void QGuiApplicationPrivate::init() +{ + QList pluginList; + // Get command line params + + int j = argc ? 1 : 0; + for (int i=1; inativeInterface(); +} + +int QGuiApplication::exec() +{ + return QCoreApplication::exec(); +} + +bool QGuiApplication::notify(QObject *object, QEvent *event) +{ + return QCoreApplication::notify(object, event); +} + +bool QGuiApplication::event(QEvent *e) +{ + if(e->type() == QEvent::LanguageChange) { + setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight); + } + return QCoreApplication::event(e); +} + +bool QGuiApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents) +{ + return QCoreApplication::compressEvent(event, receiver, postedEvents); +} + +void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e) +{ + switch(e->type) { + case QWindowSystemInterfacePrivate::Mouse: + QGuiApplicationPrivate::processMouseEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Wheel: + QGuiApplicationPrivate::processWheelEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Key: + QGuiApplicationPrivate::processKeyEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Touch: + QGuiApplicationPrivate::processTouchEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::GeometryChange: + QGuiApplicationPrivate::processGeometryChangeEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Enter: + QGuiApplicationPrivate::processEnterEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Leave: + QGuiApplicationPrivate::processLeaveEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::ActivatedWindow: + QGuiApplicationPrivate::processActivatedEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::WindowStateChanged: + QGuiApplicationPrivate::processWindowStateChangedEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Close: + QGuiApplicationPrivate::processCloseEvent( + static_cast(e)); + break; + case QWindowSystemInterfacePrivate::ScreenCountChange: + QGuiApplicationPrivate::reportScreenCount( + static_cast(e)); + break; + case QWindowSystemInterfacePrivate::ScreenGeometry: + QGuiApplicationPrivate::reportGeometryChange( + static_cast(e)); + break; + case QWindowSystemInterfacePrivate::ScreenAvailableGeometry: + QGuiApplicationPrivate::reportAvailableGeometryChange( + static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Map: + QGuiApplicationPrivate::processMapEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Unmap: + QGuiApplicationPrivate::processUnmapEvent(static_cast(e)); + break; + case QWindowSystemInterfacePrivate::Expose: + QGuiApplicationPrivate::processExposeEvent(static_cast(e)); + break; + default: + qWarning() << "Unknown user input event type:" << e->type; + break; + } +} + +void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e) +{ + QEvent::Type type; + // move first + Qt::MouseButtons stateChange = e->buttons ^ buttons; + if (e->globalPos != QGuiApplicationPrivate::lastCursorPosition && (stateChange != Qt::NoButton)) { + QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent = + new QWindowSystemInterfacePrivate::MouseEvent(e->window.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; + } + + QWindow *window = e->window.data(); + + if (!window) + window = QGuiApplication::topLevelAt(e->globalPos.toPoint()); + + QPointF localPoint = e->localPos; + QPointF globalPoint = e->globalPos; + + Qt::MouseButton button = Qt::NoButton; + + if (QGuiApplicationPrivate::lastCursorPosition != globalPoint) { + type = QEvent::MouseMove; + QGuiApplicationPrivate::lastCursorPosition = globalPoint; + 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(qApp->styleHints()->mouseDoubleClickInterval()) && + button == mousePressButton) { + type = QEvent::MouseButtonDblClick; + mousePressButton = Qt::NoButton; + } + else { + type = QEvent::MouseButtonPress; + mousePressTime = e->timestamp; + mousePressButton = button; + const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint(); + mousePressX = point.x(); + mousePressY = point.y(); + } + } + else + type = QEvent::MouseButtonRelease; + } + + + if (window) { + QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, QGuiApplication::keyboardModifiers()); + ev.setTimestamp(e->timestamp); +#ifndef QT_NO_CURSOR + QList > cursors = QPlatformCursorPrivate::getInstances(); + for (int i = 0; i < cursors.count(); ++i) + if (cursors.at(i)) + cursors.at(i).data()->pointerEvent(ev); +#endif + QGuiApplication::sendSpontaneousEvent(window, &ev); + return; + } +} + + +//### there's a lot of duplicated logic here -- refactoring required! + +void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e) +{ + if (!e->window) + return; + + QPointF globalPoint = e->globalPos; + QGuiApplicationPrivate::lastCursorPosition = globalPoint; + + QWindow *window = e->window.data(); + + if (window) { + QWheelEvent ev(e->localPos, e->globalPos, e->delta, buttons, QGuiApplication::keyboardModifiers(), + e->orient); + ev.setTimestamp(e->timestamp); + QGuiApplication::sendSpontaneousEvent(window, &ev); + return; + } +} + + + +// Remember, Qt convention is: keyboard state is state *before* + +void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e) +{ + QWindow *window = e->window.data(); + if (!window) + return; + + QObject *target = window; + + if (e->nativeScanCode || e->nativeVirtualKey || e->nativeModifiers) { + QKeyEventEx ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount, + e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers); + ev.setTimestamp(e->timestamp); + QGuiApplication::sendSpontaneousEvent(target, &ev); + } else { + QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); + ev.setTimestamp(e->timestamp); + QGuiApplication::sendSpontaneousEvent(target, &ev); + } +} + +void QGuiApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e) +{ + if (!e->enter) + return; + + QEvent event(QEvent::Enter); + QCoreApplication::sendSpontaneousEvent(e->enter.data(), &event); +} + +void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e) +{ + if (!e->leave) + return; + + QEvent event(QEvent::Leave); + QCoreApplication::sendSpontaneousEvent(e->leave.data(), &event); +} + +void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e) +{ + if (!e->activated) + return; + + QWindow *previous = QGuiApplicationPrivate::active_window; + QGuiApplicationPrivate::active_window = e->activated.data(); + if (self) + self->notifyActiveWindowChange(previous); +} + +void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse) +{ + if (QWindow *window = wse->window.data()) { + QWindowStateChangeEvent e(window->windowState()); + window->d_func()->windowState = wse->newState; + QGuiApplication::sendSpontaneousEvent(window, &e); + } +} + +void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e) +{ + if (e->tlw.isNull()) + return; + + QWindow *window = e->tlw.data(); + if (!window) + return; + + QRect newRect = e->newGeometry; + QRect cr = window->geometry(); + + bool isResize = cr.size() != newRect.size(); + bool isMove = cr.topLeft() != newRect.topLeft(); + + window->d_func()->geometry = newRect; + + if (isResize) { + QResizeEvent e(newRect.size(), cr.size()); + QGuiApplication::sendSpontaneousEvent(window, &e); + } + + if (isMove) { + //### frame geometry + QMoveEvent e(newRect.topLeft(), cr.topLeft()); + QGuiApplication::sendSpontaneousEvent(window, &e); + } +} + +void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e) +{ + if (e->window.isNull()) + return; + + QCloseEvent event; + QGuiApplication::sendSpontaneousEvent(e->window.data(), &event); +} + +void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e) +{ + QWindow *window = e->window.data(); + QGuiApplicationPrivate *d = self; + typedef QPair > StatesAndTouchPoints; + QHash windowsNeedingEvents; + + for (int i = 0; i < e->points.count(); ++i) { + QTouchEvent::TouchPoint touchPoint = e->points.at(i); + // explicitly detach from the original touch point that we got, so even + // if the touchpoint structs are reused, we will make a copy that we'll + // deliver to the user (which might want to store the struct for later use). + touchPoint.d = touchPoint.d->detach(); + + // update state + QWeakPointer w; + QTouchEvent::TouchPoint previousTouchPoint; + switch (touchPoint.state()) { + case Qt::TouchPointPressed: + if (e->devType == QTouchEvent::TouchPad) { + // on touch-pads, send all touch points to the same widget + w = d->windowForTouchPointId.isEmpty() + ? QWeakPointer() + : d->windowForTouchPointId.constBegin().value(); + } + + if (!w) { + // determine which window this event will go to + if (!window) + window = QGuiApplication::topLevelAt(touchPoint.screenPos().toPoint()); + if (!window) + continue; + w = window; + } + + d->windowForTouchPointId[touchPoint.id()] = w; + touchPoint.d->startScreenPos = touchPoint.screenPos(); + touchPoint.d->lastScreenPos = touchPoint.screenPos(); + touchPoint.d->startNormalizedPos = touchPoint.normalizedPos(); + touchPoint.d->lastNormalizedPos = touchPoint.normalizedPos(); + if (touchPoint.pressure() < qreal(0.)) + touchPoint.d->pressure = qreal(1.); + + d->appCurrentTouchPoints.insert(touchPoint.id(), touchPoint); + break; + + case Qt::TouchPointReleased: + w = d->windowForTouchPointId.take(touchPoint.id()); + if (!w) + continue; + previousTouchPoint = d->appCurrentTouchPoints.take(touchPoint.id()); + touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos(); + touchPoint.d->lastScreenPos = previousTouchPoint.screenPos(); + touchPoint.d->startPos = previousTouchPoint.startPos(); + touchPoint.d->lastPos = previousTouchPoint.pos(); + touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos(); + touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos(); + if (touchPoint.pressure() < qreal(0.)) + touchPoint.d->pressure = qreal(0.); + break; + + default: + w = d->windowForTouchPointId.value(touchPoint.id()); + if (!w) + continue; + Q_ASSERT(d->appCurrentTouchPoints.contains(touchPoint.id())); + previousTouchPoint = d->appCurrentTouchPoints.value(touchPoint.id()); + touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos(); + touchPoint.d->lastScreenPos = previousTouchPoint.screenPos(); + touchPoint.d->startPos = previousTouchPoint.startPos(); + touchPoint.d->lastPos = previousTouchPoint.pos(); + touchPoint.d->startNormalizedPos = previousTouchPoint.startNormalizedPos(); + touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos(); + if (touchPoint.pressure() < qreal(0.)) + touchPoint.d->pressure = qreal(1.); + d->appCurrentTouchPoints[touchPoint.id()] = touchPoint; + break; + } + + Q_ASSERT(w.data() != 0); + + // make the *scene* functions return the same as the *screen* functions + touchPoint.d->sceneRect = touchPoint.screenRect(); + touchPoint.d->startScenePos = touchPoint.startScreenPos(); + touchPoint.d->lastScenePos = touchPoint.lastScreenPos(); + + StatesAndTouchPoints &maskAndPoints = windowsNeedingEvents[w.data()]; + maskAndPoints.first |= touchPoint.state(); + if (touchPoint.isPrimary()) + maskAndPoints.first |= Qt::TouchPointPrimary; + maskAndPoints.second.append(touchPoint); + } + + if (windowsNeedingEvents.isEmpty()) + return; + + QHash::ConstIterator it = windowsNeedingEvents.constBegin(); + const QHash::ConstIterator end = windowsNeedingEvents.constEnd(); + for (; it != end; ++it) { + QWindow *w = it.key(); + + QEvent::Type eventType; + switch (it.value().first & Qt::TouchPointStateMask) { + case Qt::TouchPointPressed: + eventType = QEvent::TouchBegin; + break; + case Qt::TouchPointReleased: + eventType = QEvent::TouchEnd; + break; + case Qt::TouchPointStationary: + // don't send the event if nothing changed + continue; + default: + eventType = QEvent::TouchUpdate; + break; + } + + QTouchEvent touchEvent(eventType, + e->devType, + QGuiApplication::keyboardModifiers(), + it.value().first, + it.value().second); + touchEvent.setTimestamp(e->timestamp); + + for (int i = 0; i < touchEvent.touchPoints().count(); ++i) { + QTouchEvent::TouchPoint &touchPoint = touchEvent._touchPoints[i]; + + // preserve the sub-pixel resolution + QRectF rect = touchPoint.screenRect(); + const QPointF screenPos = rect.center(); + const QPointF delta = screenPos - screenPos.toPoint(); + + rect.moveCenter(w->mapFromGlobal(screenPos.toPoint()) + delta); + touchPoint.d->rect = rect; + if (touchPoint.state() == Qt::TouchPointPressed) { + touchPoint.d->startPos = w->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta; + touchPoint.d->lastPos = w->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta; + } + } + + QGuiApplication::sendSpontaneousEvent(w, &touchEvent); + } +} + +void QGuiApplicationPrivate::reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *) +{ + // This operation only makes sense after the QGuiApplication constructor runs + if (QCoreApplication::startingUp()) + return; + + //QGuiApplication::desktop()->d_func()->updateScreenList(); + // signal anything listening for creation or deletion of screens + //QDesktopWidget *desktop = QGuiApplication::desktop(); + //emit desktop->screenCountChanged(e->count); +} + +void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *) +{ + // This operation only makes sense after the QGuiApplication constructor runs + if (QCoreApplication::startingUp()) + return; +} + +void QGuiApplicationPrivate::reportAvailableGeometryChange( + QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *) +{ + // This operation only makes sense after the QGuiApplication constructor runs + if (QCoreApplication::startingUp()) + return; +} + +void QGuiApplicationPrivate::processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e) +{ + if (!e->mapped) + return; + + QEvent event(QEvent::Map); + QCoreApplication::sendSpontaneousEvent(e->mapped.data(), &event); +} + +void QGuiApplicationPrivate::processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e) +{ + if (!e->unmapped) + return; + + QEvent event(QEvent::Unmap); + QCoreApplication::sendSpontaneousEvent(e->unmapped.data(), &event); +} + +void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e) +{ + if (!e->exposed) + return; + + QWindow *window = e->exposed.data(); + + QResizeEvent resizeEvent(window->handle()->geometry().size(), window->size()); + QGuiApplication::sendSpontaneousEvent(window, &resizeEvent); + + QExposeEvent exposeEvent(e->region); + QCoreApplication::sendSpontaneousEvent(window, &exposeEvent); +} + +Qt::DropAction QGuiApplicationPrivate::processDrag(QWindow *w, QMimeData *dropData, const QPoint &p) +{ + static QPointer currentDragWindow; + QDragManager *manager = QDragManager::self(); + if (!dropData) { + if (currentDragWindow.data() == w) + currentDragWindow = 0; + QDragLeaveEvent e; + QGuiApplication::sendEvent(w, &e); + manager->global_accepted_action = Qt::IgnoreAction; + return Qt::IgnoreAction; + } + QDragMoveEvent me(p, manager->possible_actions, dropData, + QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); + if (w != currentDragWindow) { + if (currentDragWindow) { + QDragLeaveEvent e; + QGuiApplication::sendEvent(currentDragWindow, &e); + manager->global_accepted_action = Qt::IgnoreAction; + } + currentDragWindow = w; + QDragEnterEvent e(p, manager->possible_actions, dropData, + QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); + QGuiApplication::sendEvent(w, &e); + manager->global_accepted_action = e.isAccepted() ? e.dropAction() : Qt::IgnoreAction; + if (manager->global_accepted_action != Qt::IgnoreAction) { + me.setDropAction(manager->global_accepted_action); + me.accept(); + } + } + QGuiApplication::sendEvent(w, &me); + manager->global_accepted_action = me.isAccepted() ? me.dropAction() : Qt::IgnoreAction; + return manager->global_accepted_action; +} + +Qt::DropAction QGuiApplicationPrivate::processDrop(QWindow *w, QMimeData *dropData, const QPoint &p) +{ + QDragManager *manager = QDragManager::self(); + QDropEvent de(p, manager->possible_actions, dropData, + QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); + QGuiApplication::sendEvent(w, &de); + manager->global_accepted_action = de.isAccepted() ? de.dropAction() : Qt::IgnoreAction; + return manager->global_accepted_action; +} + +#ifndef QT_NO_CLIPBOARD +QClipboard * QGuiApplication::clipboard() +{ + if (QGuiApplicationPrivate::qt_clipboard == 0) { + if (!qApp) { + qWarning("QGuiApplication: Must construct a QGuiApplication before accessing a QClipboard"); + return 0; + } + QGuiApplicationPrivate::qt_clipboard = new QClipboard(0); + } + return QGuiApplicationPrivate::qt_clipboard; +} +#endif + +/*! + Returns the application palette. + + \sa setPalette(), QWidget::palette() +*/ +QPalette QGuiApplication::palette() +{ + if (!QGuiApplicationPrivate::app_pal) + QGuiApplicationPrivate::app_pal = new QPalette(Qt::black); + return *QGuiApplicationPrivate::app_pal; +} + +QFont QGuiApplication::font() +{ + QMutexLocker locker(applicationFontMutex()); + if (!QGuiApplicationPrivate::app_font) + QGuiApplicationPrivate::app_font = + new QFont(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFont()); + return *QGuiApplicationPrivate::app_font; +} + +void QGuiApplication::setFont(const QFont &font) +{ + QMutexLocker locker(applicationFontMutex()); + if (!QGuiApplicationPrivate::app_font) + QGuiApplicationPrivate::app_font = new QFont(font); + else + *QGuiApplicationPrivate::app_font = font; +} + +/*! + \fn bool QGuiApplication::isRightToLeft() + + Returns true if the application's layout direction is + Qt::RightToLeft; otherwise returns false. + + \sa layoutDirection(), isLeftToRight() +*/ + +/*! + \fn bool QGuiApplication::isLeftToRight() + + Returns true if the application's layout direction is + Qt::LeftToRight; otherwise returns false. + + \sa layoutDirection(), isRightToLeft() +*/ + +void QGuiApplicationPrivate::notifyLayoutDirectionChange() +{ +} + +void QGuiApplicationPrivate::notifyActiveWindowChange(QWindow *) +{ +} + + +/*! + \property QGuiApplication::quitOnLastWindowClosed + + \brief whether the application implicitly quits when the last window is + closed. + + The default is true. + + If this property is true, the applications quits when the last visible + primary window (i.e. window with no parent) is closed. + + \sa quit(), QWindow::close() + */ + +void QGuiApplication::setQuitOnLastWindowClosed(bool quit) +{ + QGuiApplicationPrivate::quitOnLastWindowClosed = quit; +} + + + +bool QGuiApplication::quitOnLastWindowClosed() +{ + return QGuiApplicationPrivate::quitOnLastWindowClosed; +} + + + +void QGuiApplicationPrivate::emitLastWindowClosed() +{ + if (qGuiApp && qGuiApp->d_func()->in_exec) { + if (QGuiApplicationPrivate::quitOnLastWindowClosed) { + // get ready to quit, this event might be removed if the + // event loop is re-entered, however + QGuiApplication::postEvent(qApp, new QEvent(QEvent::Quit)); + } + emit qGuiApp->lastWindowClosed(); + } +} + + +/*! + \property QGuiApplication::layoutDirection + \brief the default layout direction for this application + + On system start-up, the default layout direction depends on the + application's language. + + \sa QWidget::layoutDirection, isLeftToRight(), isRightToLeft() + */ + +void QGuiApplication::setLayoutDirection(Qt::LayoutDirection direction) +{ + if (layout_direction == direction || direction == Qt::LayoutDirectionAuto) + return; + + layout_direction = direction; + + QGuiApplicationPrivate::self->notifyLayoutDirectionChange(); +} + +Qt::LayoutDirection QGuiApplication::layoutDirection() +{ + return layout_direction; +} + +/*! + \fn QCursor *QGuiApplication::overrideCursor() + + Returns the active application override cursor. + + This function returns 0 if no application cursor has been defined (i.e. the + internal cursor stack is empty). + + \sa setOverrideCursor(), restoreOverrideCursor() +*/ +#ifndef QT_NO_CURSOR +QCursor *QGuiApplication::overrideCursor() +{ + return qGuiApp->d_func()->cursor_list.isEmpty() ? 0 : &qGuiApp->d_func()->cursor_list.first(); +} + +/*! + Changes the currently active application override cursor to \a cursor. + + This function has no effect if setOverrideCursor() was not called. + + \sa setOverrideCursor(), overrideCursor(), restoreOverrideCursor(), + QWidget::setCursor() + */ +void QGuiApplication::changeOverrideCursor(const QCursor &cursor) +{ + if (qGuiApp->d_func()->cursor_list.isEmpty()) + return; + qGuiApp->d_func()->cursor_list.removeFirst(); + setOverrideCursor(cursor); +} +#endif + +/*! + \fn void QGuiApplication::setOverrideCursor(const QCursor &cursor, bool replace) + + Use changeOverrideCursor(\a cursor) (if \a replace is true) or + setOverrideCursor(\a cursor) (if \a replace is false). +*/ + +#ifndef QT_NO_CURSOR +void QGuiApplication::setOverrideCursor(const QCursor &cursor) +{ + qGuiApp->d_func()->cursor_list.prepend(cursor); +} + +void QGuiApplication::restoreOverrideCursor() +{ + if (qGuiApp->d_func()->cursor_list.isEmpty()) + return; + qGuiApp->d_func()->cursor_list.removeFirst(); +} +#endif// QT_NO_CURSOR + +/*! + \since 5.0 + + returns the style hints. + + The style hints encapsulate a set of platform dependent properties + such as double click intervals, full width selection and others. + + The hints can be used to integrate tighter with the underlying platform. + + \sa QStyleHints + */ +QStyleHints *QGuiApplication::styleHints() const +{ + Q_D(const QGuiApplication); + if (!d->styleHints) + const_cast(d)->styleHints = new QStyleHints(); + return d->styleHints; +} + + +/*! + \since 5.0 + + returns the input panel. + + The input panel returns properties about the state and position of + the virtual keyboard. It also provides information about the position of the + current focused input element. + + \sa QInputPanel + */ +QInputPanel *QGuiApplication::inputPanel() const +{ + Q_D(const QGuiApplication); + if (!d->inputPanel) + const_cast(d)->inputPanel = new QInputPanel(); + return d->inputPanel; +} + + +// Returns the current platform used by keyBindings +uint QGuiApplicationPrivate::currentKeyPlatform() +{ + uint platform = KB_Win; +#ifdef Q_OS_MAC + platform = KB_Mac; +#elif defined Q_WS_X11 + platform = KB_X11; + // ## TODO: detect these +#if 0 + if (X11->desktopEnvironment == DE_KDE) + platform |= KB_KDE; + if (X11->desktopEnvironment == DE_GNOME) + platform |= KB_Gnome; + if (X11->desktopEnvironment == DE_CDE) + platform |= KB_CDE; +#endif +#endif + return platform; +} + +/*! + \since 4.2 + + Returns the current keyboard input locale. +*/ +QLocale QGuiApplication::keyboardInputLocale() +{ + if (!QGuiApplicationPrivate::checkInstance("keyboardInputLocale")) + return QLocale::c(); + return qt_keymapper_private()->keyboardInputLocale; +} + +/*! + \since 4.2 + + Returns the current keyboard input direction. +*/ +Qt::LayoutDirection QGuiApplication::keyboardInputDirection() +{ + if (!QGuiApplicationPrivate::checkInstance("keyboardInputDirection")) + return Qt::LeftToRight; + return qt_keymapper_private()->keyboardInputDirection; +} + +/*! + \since 4.5 + \fn void QGuiApplication::fontDatabaseChanged() + + This signal is emitted when application fonts are loaded or removed. + + \sa QFontDatabase::addApplicationFont(), + QFontDatabase::addApplicationFontFromData(), + QFontDatabase::removeAllApplicationFonts(), + QFontDatabase::removeApplicationFont() +*/ + +// These pixmaps approximate the images in the Windows User Interface Guidelines. + +// XPM + +static const char * const move_xpm[] = { +"11 20 3 1", +". c None", +#if defined(Q_WS_WIN) +"a c #000000", +"X c #FFFFFF", // Windows cursor is traditionally white +#else +"a c #FFFFFF", +"X c #000000", // X11 cursor is traditionally black +#endif +"aa.........", +"aXa........", +"aXXa.......", +"aXXXa......", +"aXXXXa.....", +"aXXXXXa....", +"aXXXXXXa...", +"aXXXXXXXa..", +"aXXXXXXXXa.", +"aXXXXXXXXXa", +"aXXXXXXaaaa", +"aXXXaXXa...", +"aXXaaXXa...", +"aXa..aXXa..", +"aa...aXXa..", +"a.....aXXa.", +"......aXXa.", +".......aXXa", +".......aXXa", +"........aa."}; + +#ifdef Q_WS_WIN +/* XPM */ +static const char * const ignore_xpm[] = { +"24 30 3 1", +". c None", +"a c #000000", +"X c #FFFFFF", +"aa......................", +"aXa.....................", +"aXXa....................", +"aXXXa...................", +"aXXXXa..................", +"aXXXXXa.................", +"aXXXXXXa................", +"aXXXXXXXa...............", +"aXXXXXXXXa..............", +"aXXXXXXXXXa.............", +"aXXXXXXaaaa.............", +"aXXXaXXa................", +"aXXaaXXa................", +"aXa..aXXa...............", +"aa...aXXa...............", +"a.....aXXa..............", +"......aXXa.....XXXX.....", +".......aXXa..XXaaaaXX...", +".......aXXa.XaaaaaaaaX..", +"........aa.XaaaXXXXaaaX.", +"...........XaaaaX..XaaX.", +"..........XaaXaaaX..XaaX", +"..........XaaXXaaaX.XaaX", +"..........XaaX.XaaaXXaaX", +"..........XaaX..XaaaXaaX", +"...........XaaX..XaaaaX.", +"...........XaaaXXXXaaaX.", +"............XaaaaaaaaX..", +".............XXaaaaXX...", +"...............XXXX....."}; +#endif + +/* XPM */ +static const char * const copy_xpm[] = { +"24 30 3 1", +". c None", +"a c #000000", +"X c #FFFFFF", +#if defined(Q_WS_WIN) // Windows cursor is traditionally white +"aa......................", +"aXa.....................", +"aXXa....................", +"aXXXa...................", +"aXXXXa..................", +"aXXXXXa.................", +"aXXXXXXa................", +"aXXXXXXXa...............", +"aXXXXXXXXa..............", +"aXXXXXXXXXa.............", +"aXXXXXXaaaa.............", +"aXXXaXXa................", +"aXXaaXXa................", +"aXa..aXXa...............", +"aa...aXXa...............", +"a.....aXXa..............", +"......aXXa..............", +".......aXXa.............", +".......aXXa.............", +"........aa...aaaaaaaaaaa", +#else +"XX......................", +"XaX.....................", +"XaaX....................", +"XaaaX...................", +"XaaaaX..................", +"XaaaaaX.................", +"XaaaaaaX................", +"XaaaaaaaX...............", +"XaaaaaaaaX..............", +"XaaaaaaaaaX.............", +"XaaaaaaXXXX.............", +"XaaaXaaX................", +"XaaXXaaX................", +"XaX..XaaX...............", +"XX...XaaX...............", +"X.....XaaX..............", +"......XaaX..............", +".......XaaX.............", +".......XaaX.............", +"........XX...aaaaaaaaaaa", +#endif +".............aXXXXXXXXXa", +".............aXXXXXXXXXa", +".............aXXXXaXXXXa", +".............aXXXXaXXXXa", +".............aXXaaaaaXXa", +".............aXXXXaXXXXa", +".............aXXXXaXXXXa", +".............aXXXXXXXXXa", +".............aXXXXXXXXXa", +".............aaaaaaaaaaa"}; + +/* XPM */ +static const char * const link_xpm[] = { +"24 30 3 1", +". c None", +"a c #000000", +"X c #FFFFFF", +#if defined(Q_WS_WIN) // Windows cursor is traditionally white +"aa......................", +"aXa.....................", +"aXXa....................", +"aXXXa...................", +"aXXXXa..................", +"aXXXXXa.................", +"aXXXXXXa................", +"aXXXXXXXa...............", +"aXXXXXXXXa..............", +"aXXXXXXXXXa.............", +"aXXXXXXaaaa.............", +"aXXXaXXa................", +"aXXaaXXa................", +"aXa..aXXa...............", +"aa...aXXa...............", +"a.....aXXa..............", +"......aXXa..............", +".......aXXa.............", +".......aXXa.............", +"........aa...aaaaaaaaaaa", +#else +"XX......................", +"XaX.....................", +"XaaX....................", +"XaaaX...................", +"XaaaaX..................", +"XaaaaaX.................", +"XaaaaaaX................", +"XaaaaaaaX...............", +"XaaaaaaaaX..............", +"XaaaaaaaaaX.............", +"XaaaaaaXXXX.............", +"XaaaXaaX................", +"XaaXXaaX................", +"XaX..XaaX...............", +"XX...XaaX...............", +"X.....XaaX..............", +"......XaaX..............", +".......XaaX.............", +".......XaaX.............", +"........XX...aaaaaaaaaaa", +#endif +".............aXXXXXXXXXa", +".............aXXXaaaaXXa", +".............aXXXXaaaXXa", +".............aXXXaaaaXXa", +".............aXXaaaXaXXa", +".............aXXaaXXXXXa", +".............aXXaXXXXXXa", +".............aXXXaXXXXXa", +".............aXXXXXXXXXa", +".............aaaaaaaaaaa"}; + +QPixmap QGuiApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) +{ +#if defined(Q_WS_X11) || defined(Q_WS_WIN) + if (!move_cursor) { + move_cursor = new QPixmap((const char **)move_xpm); + copy_cursor = new QPixmap((const char **)copy_xpm); + link_cursor = new QPixmap((const char **)link_xpm); +#ifdef Q_WS_WIN + ignore_cursor = new QPixmap((const char **)ignore_xpm); +#endif + } + + switch (cshape) { + case Qt::DragMoveCursor: + return *move_cursor; + case Qt::DragCopyCursor: + return *copy_cursor; + case Qt::DragLinkCursor: + return *link_cursor; +#ifdef Q_WS_WIN + case Qt::ForbiddenCursor: + return *ignore_cursor; +#endif + default: + break; + } +#else + Q_UNUSED(cshape); +#endif + return QPixmap(); +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h new file mode 100644 index 00000000000..0649b5de317 --- /dev/null +++ b/src/gui/kernel/qguiapplication.h @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGUIAPPLICATION_QPA_H +#define QGUIAPPLICATION_QPA_H + +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QGuiApplicationPrivate; +class QPlatformNativeInterface; +class QPalette; +class QScreen; +class QStyleHints; +class QInputPanel; + +#if defined(qApp) +#undef qApp +#endif +#define qApp (static_cast(QCoreApplication::instance())) + +#if defined(qGuiApp) +#undef qGuiApp +#endif +#define qGuiApp (static_cast(QCoreApplication::instance())) + +class Q_GUI_EXPORT QGuiApplication : public QCoreApplication +{ + Q_OBJECT + Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection) + + Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed) + +public: + QGuiApplication(int &argc, char **argv, int = ApplicationFlags); + virtual ~QGuiApplication(); + + static QWindowList topLevelWindows(); + static QWindow *topLevelAt(const QPoint &pos); + + static QWindow *activeWindow(); + static QScreen *primaryScreen(); + static QList screens(); + +#ifndef QT_NO_CURSOR + static QCursor *overrideCursor(); + static void setOverrideCursor(const QCursor &); + static void changeOverrideCursor(const QCursor &); + static void restoreOverrideCursor(); +#endif + + static QFont font(); + static void setFont(const QFont &); + +#ifndef QT_NO_CLIPBOARD + static QClipboard *clipboard(); +#endif + + static QPalette palette(); + + static Qt::KeyboardModifiers keyboardModifiers(); + static Qt::MouseButtons mouseButtons(); + + static void setLayoutDirection(Qt::LayoutDirection direction); + static Qt::LayoutDirection layoutDirection(); + + static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; } + static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; } + + // ### move to QInputPanel + static QLocale keyboardInputLocale(); + static Qt::LayoutDirection keyboardInputDirection(); + + QStyleHints *styleHints() const; + QInputPanel *inputPanel() const; + + static QPlatformNativeInterface *platformNativeInterface(); + + static void setQuitOnLastWindowClosed(bool quit); + static bool quitOnLastWindowClosed(); + + static int exec(); + bool notify(QObject *, QEvent *); + +Q_SIGNALS: + void fontDatabaseChanged(); + void screenAdded(QScreen *screen); + void lastWindowClosed(); + +protected: + bool event(QEvent *); + bool compressEvent(QEvent *, QObject *receiver, QPostEventList *); + + QGuiApplication(QGuiApplicationPrivate &p); + +private: + Q_DISABLE_COPY(QGuiApplication) + Q_DECLARE_PRIVATE(QGuiApplication) + +#ifndef QT_NO_GESTURES + friend class QGestureManager; +#endif + friend class QFontDatabasePrivate; + friend class QPlatformIntegration; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGUIAPPLICATION_QPA_H diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h new file mode 100644 index 00000000000..97cf7d371ec --- /dev/null +++ b/src/gui/kernel/qguiapplication_p.h @@ -0,0 +1,194 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGUIAPPLICATION_QPA_P_H +#define QGUIAPPLICATION_QPA_P_H + +#include + +#include +#include + +#include + +#include +#include "private/qwindowsysteminterface_qpa_p.h" +#include "QtGui/qplatformintegration_qpa.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate +{ + Q_DECLARE_PUBLIC(QGuiApplication) +public: + QGuiApplicationPrivate(int &argc, char **argv, int flags); + ~QGuiApplicationPrivate(); + + void createPlatformIntegration(); + void createEventDispatcher(); + void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher); + + virtual void notifyLayoutDirectionChange(); + virtual void notifyActiveWindowChange(QWindow *previous); + + static Qt::KeyboardModifiers modifier_buttons; + static Qt::MouseButtons mouse_buttons; + + static QPlatformIntegration *platform_integration; + + static QPlatformIntegration *platformIntegration() + { return platform_integration; } + + enum KeyPlatform { + KB_Win = 1, + KB_Mac = 2, + KB_X11 = 4, + KB_KDE = 8, + KB_Gnome = 16, + KB_CDE = 32, + KB_S60 = 64, + KB_All = 0xffff + }; + + static uint currentKeyPlatform(); + + static QAbstractEventDispatcher *qt_qpa_core_dispatcher() + { return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; } + + 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(QWindowSystemInterfacePrivate::CloseEvent *e); + + static void processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e); + + static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e); + static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e); + + static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e); + static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e); + + static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e); + + static void reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e); + static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e); + static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e); + + static void processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e); + static void processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e); + + static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e); + + static Qt::DropAction processDrag(QWindow *w, QMimeData *dropData, const QPoint &p); + static Qt::DropAction processDrop(QWindow *w, QMimeData *dropData, const QPoint &p); + + static inline Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment) + { + if (!(alignment & Qt::AlignHorizontal_Mask)) + alignment |= Qt::AlignLeft; + if ((alignment & Qt::AlignAbsolute) == 0 && (alignment & (Qt::AlignLeft | Qt::AlignRight))) { + if (direction == Qt::RightToLeft) + alignment ^= (Qt::AlignLeft | Qt::AlignRight); + alignment |= Qt::AlignAbsolute; + } + return alignment; + } + + static void emitLastWindowClosed(); + + QPixmap getPixmapCursor(Qt::CursorShape cshape); + + static QGuiApplicationPrivate *instance() { return self; } + + static bool app_do_modal; + + static Qt::MouseButtons buttons; + static ulong mousePressTime; + static Qt::MouseButton mousePressButton; + static int mousePressX; + static int mousePressY; + static int mouse_double_click_distance; + static QPointF lastCursorPosition; + +#ifndef QT_NO_CLIPBOARD + static QClipboard *qt_clipboard; +#endif + + static QPalette *app_pal; + + static QWindowList window_list; + static QWindow *active_window; + +#ifndef QT_NO_CURSOR + QList cursor_list; +#endif + static QList screen_list; + + static QFont *app_font; + + QStyleHints *styleHints; + QInputPanel *inputPanel; + + static bool quitOnLastWindowClosed; + + QString qmljs_debug_arguments; // a string containing arguments for js/qml debugging. + inline QString qmljsDebugArgumentsString() { return qmljs_debug_arguments; } + +private: + void init(); + + static QGuiApplicationPrivate *self; + + QMap > windowForTouchPointId; + QMap appCurrentTouchPoints; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGUIAPPLICATION_QPA_P_H diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index bd5036650ae..f09b9609e6d 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -48,7 +48,6 @@ #include "qdatastream.h" #include "qdebug.h" #include "qfont.h" -#include "qicon.h" #include "qimage.h" #include "qkeysequence.h" #include "qtransform.h" @@ -58,7 +57,6 @@ #include "qpixmap.h" #include "qpolygon.h" #include "qregion.h" -#include "qsizepolicy.h" #include "qtextformat.h" #include "qmatrix4x4.h" #include "qvector2d.h" @@ -70,10 +68,7 @@ QT_BEGIN_NAMESPACE -#ifdef QT3_SUPPORT -extern QDataStream &qt_stream_out_qcolorgroup(QDataStream &s, const QColorGroup &g); -extern QDataStream &qt_stream_in_qcolorgroup(QDataStream &s, QColorGroup &g); -#endif +Q_GUI_EXPORT const QVariant::Handler *qt_widgets_variant_handler = 0; Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler(); @@ -107,16 +102,6 @@ static void construct(QVariant::Private *x, const void *copy) case QVariant::Palette: v_construct(x, copy); break; -#ifdef QT3_SUPPORT - case QVariant::ColorGroup: - v_construct(x, copy); - break; -#endif -#ifndef QT_NO_ICON - case QVariant::Icon: - v_construct(x, copy); - break; -#endif case QVariant::Matrix: v_construct(x, copy); break; @@ -137,9 +122,6 @@ static void construct(QVariant::Private *x, const void *copy) case QVariant::Pen: v_construct(x, copy); break; - case QVariant::SizePolicy: - v_construct(x, copy); - break; #ifndef QT_NO_CURSOR case QVariant::Cursor: v_construct(x, copy); @@ -178,6 +160,13 @@ static void construct(QVariant::Private *x, const void *copy) v_construct(x, copy); break; #endif + case QVariant::SizePolicy: + case QVariant::Icon: + if (qt_widgets_variant_handler) { + qt_widgets_variant_handler->construct(x, copy); + return; + } + break; default: qcoreVariantHandler()->construct(x, copy); return; @@ -218,16 +207,6 @@ static void clear(QVariant::Private *d) case QVariant::Palette: v_clear(d); break; -#ifdef QT3_SUPPORT - case QVariant::ColorGroup: - v_clear(d); - break; -#endif -#ifndef QT_NO_ICON - case QVariant::Icon: - v_clear(d); - break; -#endif case QVariant::Matrix: v_clear(d); break; @@ -240,9 +219,6 @@ static void clear(QVariant::Private *d) case QVariant::TextLength: v_clear(d); break; - case QVariant::SizePolicy: - v_clear(d); - break; #ifndef QT_NO_SHORTCUT case QVariant::KeySequence: v_clear(d); @@ -276,6 +252,13 @@ static void clear(QVariant::Private *d) v_clear(d); break; #endif + case QVariant::SizePolicy: + case QVariant::Icon: + if (qt_widgets_variant_handler) { + qt_widgets_variant_handler->clear(d); + return; + } + break; default: qcoreVariantHandler()->clear(d); return; @@ -300,10 +283,6 @@ static bool isNull(const QVariant::Private *d) return v_cast(d)->isNull(); case QVariant::Image: return v_cast(d)->isNull(); -#ifndef QT_NO_ICON - case QVariant::Icon: - return v_cast(d)->isNull(); -#endif case QVariant::Matrix: case QVariant::TextFormat: case QVariant::TextLength: @@ -313,9 +292,6 @@ static bool isNull(const QVariant::Private *d) case QVariant::Brush: case QVariant::Color: case QVariant::Palette: -#ifdef QT3_SUPPORT - case QVariant::ColorGroup: -#endif case QVariant::SizePolicy: #ifndef QT_NO_SHORTCUT case QVariant::KeySequence: @@ -341,6 +317,10 @@ static bool isNull(const QVariant::Private *d) case QVariant::Quaternion: return v_cast(d)->isNull(); #endif + case QVariant::Icon: + if (qt_widgets_variant_handler) + return qt_widgets_variant_handler->isNull(d); + break; default: return qcoreVariantHandler()->isNull(d); } @@ -374,10 +354,6 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) return *v_cast(a) == *v_cast(b); case QVariant::Palette: return *v_cast(a) == *v_cast(b); -#ifdef QT3_SUPPORT - case QVariant::ColorGroup: - return *v_cast(a) == *v_cast(b); -#endif #ifndef QT_NO_ICON case QVariant::Icon: /* QIcon::operator==() cannot be reasonably implemented for QIcon, @@ -392,8 +368,6 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) return *v_cast(a) == *v_cast(b); case QVariant::TextLength: return *v_cast(a) == *v_cast(b); - case QVariant::SizePolicy: - return *v_cast(a) == *v_cast(b); #ifndef QT_NO_SHORTCUT case QVariant::KeySequence: return *v_cast(a) == *v_cast(b); @@ -420,6 +394,10 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) case QVariant::Quaternion: return *v_cast(a) == *v_cast(b); #endif + case QVariant::SizePolicy: + if (qt_widgets_variant_handler) + return qt_widgets_variant_handler->compare(a, b); + break; default: break; } @@ -688,17 +666,11 @@ extern Q_CORE_EXPORT const QMetaTypeGuiHelper *qMetaTypeGuiHelper; static const QLoad##TYPE qLoad##TYPE = qMetaTypeLoadHelper; #endif -#ifdef QT3_SUPPORT -Q_DECL_METATYPE_HELPER(QColorGroup) -#endif Q_DECL_METATYPE_HELPER(QFont) Q_DECL_METATYPE_HELPER(QPixmap) Q_DECL_METATYPE_HELPER(QBrush) Q_DECL_METATYPE_HELPER(QColor) Q_DECL_METATYPE_HELPER(QPalette) -#ifndef QT_NO_ICON -Q_DECL_METATYPE_HELPER(QIcon) -#endif Q_DECL_METATYPE_HELPER(QImage) Q_DECL_METATYPE_HELPER(QPolygon) Q_DECL_METATYPE_HELPER(QRegion) @@ -706,7 +678,6 @@ Q_DECL_METATYPE_HELPER(QBitmap) #ifndef QT_NO_CURSOR Q_DECL_METATYPE_HELPER(QCursor) #endif -Q_DECL_METATYPE_HELPER(QSizePolicy) #ifndef QT_NO_SHORTCUT Q_DECL_METATYPE_HELPER(QKeySequence) #endif @@ -745,21 +716,11 @@ Q_DECL_METATYPE_HELPER(QQuaternion) #endif static const QMetaTypeGuiHelper qVariantGuiHelper[] = { -#ifdef QT3_SUPPORT - Q_IMPL_METATYPE_HELPER(QColorGroup), -#else - {0, 0, 0, 0}, -#endif Q_IMPL_METATYPE_HELPER(QFont), Q_IMPL_METATYPE_HELPER(QPixmap), Q_IMPL_METATYPE_HELPER(QBrush), Q_IMPL_METATYPE_HELPER(QColor), Q_IMPL_METATYPE_HELPER(QPalette), -#ifdef QT_NO_ICON - {0, 0, 0, 0}, -#else - Q_IMPL_METATYPE_HELPER(QIcon), -#endif Q_IMPL_METATYPE_HELPER(QImage), Q_IMPL_METATYPE_HELPER(QPolygon), Q_IMPL_METATYPE_HELPER(QRegion), @@ -769,7 +730,6 @@ static const QMetaTypeGuiHelper qVariantGuiHelper[] = { #else Q_IMPL_METATYPE_HELPER(QCursor), #endif - Q_IMPL_METATYPE_HELPER(QSizePolicy), #ifdef QT_NO_SHORTCUT {0, 0, 0, 0}, #else @@ -825,4 +785,5 @@ int qUnregisterGuiVariant() } Q_DESTRUCTOR_FUNCTION(qUnregisterGuiVariant) + QT_END_NAMESPACE diff --git a/src/gui/kernel/qinputpanel.cpp b/src/gui/kernel/qinputpanel.cpp new file mode 100644 index 00000000000..b6160dc71a1 --- /dev/null +++ b/src/gui/kernel/qinputpanel.cpp @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +QInputPanel::QInputPanel() + : QObject(*new QInputPanelPrivate) +{ +} + +QInputPanel::~QInputPanel() +{ +} + +QObject *QInputPanel::inputItem() const +{ + Q_D(const QInputPanel); + return d->inputItem.data(); +} + +void QInputPanel::setInputItem(QObject *inputItem) +{ + Q_D(QInputPanel); + + if (d->inputItem.data() == inputItem) + return; + + d->inputItem = inputItem; + emit inputItemChanged(); +} + +QWindow *QInputPanel::inputWindow() const +{ + return qApp->activeWindow(); +} + +QTransform QInputPanel::inputItemTransform() const +{ + Q_D(const QInputPanel); + return d->inputItemTransform; +} + +void QInputPanel::setInputItemTransform(const QTransform &transform) +{ + Q_D(QInputPanel); + if (d->inputItemTransform == transform) + return; + + d->inputItemTransform = transform; + emit cursorRectangleChanged(); +} + +QRectF QInputPanel::cursorRectangle() const +{ + Q_D(const QInputPanel); + + if (!d->inputItem) + return QRectF(); + + QInputMethodQueryEvent query(Qt::ImCursorRectangle); + QGuiApplication::sendEvent(d->inputItem.data(), &query); + QRect r = query.value(Qt::ImCursorRectangle).toRect(); + if (!r.isValid()) + return QRect(); + + return d->inputItemTransform.mapRect(r); +} + +QRectF QInputPanel::keyboardRectangle() +{ + QPlatformInputContext *ic = QGuiApplicationPrivate::platformIntegration()->inputContext(); + if (ic) + return ic->keyboardRect(); + return QRectF(); +} + +void QInputPanel::show() +{ + setVisible(true); +} + +void QInputPanel::hide() +{ + setVisible(false); +} + +bool QInputPanel::visible() const +{ + Q_D(const QInputPanel); + + return d->visible; +} + +void QInputPanel::setVisible(bool visible) +{ + Q_D(QInputPanel); + if (d->visible == visible) + return; + + d->visible = visible; + emit visibleChanged(); +} + +bool QInputPanel::isAnimating() const +{ + QPlatformInputContext *ic = QGuiApplicationPrivate::platformIntegration()->inputContext(); + if (ic) + return ic->isAnimating(); + return false; +} + + +void QInputPanel::update(Qt::InputMethodQueries queries) +{ + Q_D(QInputPanel); + + if (!d->inputItem) + return; + + QPlatformInputContext *ic = QGuiApplicationPrivate::platformIntegration()->inputContext(); + if (ic) + ic->update(queries); + + if (queries & Qt::ImCursorRectangle) + emit cursorRectangleChanged(); +} + +void QInputPanel::reset() +{ + QPlatformInputContext *ic = QGuiApplicationPrivate::platformIntegration()->inputContext(); + if (ic) + ic->reset(); +} + +void QInputPanel::commit() +{ + QPlatformInputContext *ic = QGuiApplicationPrivate::platformIntegration()->inputContext(); + if (ic) + ic->commit(); +} + +void QInputPanel::invokeAction(Action a, int cursorPosition) +{ + QPlatformInputContext *ic = QGuiApplicationPrivate::platformIntegration()->inputContext(); + if (ic) + ic->invokeAction(a, cursorPosition); +} + +#include "moc_qinputpanel.cpp" diff --git a/src/gui/kernel/qinputpanel.h b/src/gui/kernel/qinputpanel.h new file mode 100644 index 00000000000..9db54b66640 --- /dev/null +++ b/src/gui/kernel/qinputpanel.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QINPUTPANEL_H +#define QINPUTPANEL_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QInputPanelPrivate; +class QWindow; +class QRectF; +class QTransform; + +class Q_GUI_EXPORT QInputPanel : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QInputPanel) + Q_PROPERTY(QObject *inputItem READ inputItem WRITE setInputItem NOTIFY inputItemChanged) + Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged) + Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged) + Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged) + +public: + QObject *inputItem() const; + void setInputItem(QObject *inputItemChanged); + + // the window containing the editor + QWindow *inputWindow() const; + + QTransform inputItemTransform() const; + void setInputItemTransform(const QTransform &transform); + + // in window coordinates + QRectF cursorRectangle() const; // ### what if we have rotations for the item? + + // keyboard geometry in window coords + QRectF keyboardRectangle(); + + enum Action { + Click, + ContextMenu + }; + + bool visible() const; + void setVisible(bool visible); + + bool isAnimating() const; + +public Q_SLOTS: + void show(); + void hide(); + + void update(Qt::InputMethodQueries queries); + void reset(); + void commit(); + + void invokeAction(Action a, int cursorPosition); + +Q_SIGNALS: + void inputItemChanged(); + void cursorRectangleChanged(); + void keyboardRectangleChanged(); + void visibleChanged(); + void animatingChanged(); + +private: + friend class QGuiApplication; + friend class QGuiApplicationPrivate; + friend class QPlatformInputContext; + QInputPanel(); + ~QInputPanel(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/gui/kernel/qinputpanel_p.h b/src/gui/kernel/qinputpanel_p.h new file mode 100644 index 00000000000..84cfb06c946 --- /dev/null +++ b/src/gui/kernel/qinputpanel_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QINPUTPANEL_P_H +#define QINPUTPANEL_P_H + +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QInputPanelPrivate : public QObjectPrivate +{ +public: + inline QInputPanelPrivate() + : visible(false) + {} + QTransform inputItemTransform; + QWeakPointer inputItem; + bool visible; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp index 46e6c0cde99..4ee7d66dd8d 100644 --- a/src/gui/kernel/qkeymapper.cpp +++ b/src/gui/kernel/qkeymapper.cpp @@ -40,11 +40,10 @@ ****************************************************************************/ -#include "qapplication.h" +#include "qguiapplication.h" #include #include "qkeymapper_p.h" -#include QT_BEGIN_NAMESPACE @@ -91,6 +90,8 @@ void QKeyMapper::changeKeyboard() { instance()->d_func()->clearMappings(); + // ## TODO: Support KeyboardLayoutChange on QPA +#if 0 // inform all toplevel widgets of the change QEvent e(QEvent::KeyboardLayoutChange); QWidgetList list = QApplication::topLevelWidgets(); @@ -98,6 +99,7 @@ void QKeyMapper::changeKeyboard() QWidget *w = list.at(i); qt_sendSpontaneousEvent(w, &e); } +#endif } Q_GLOBAL_STATIC(QKeyMapper, keymapper) diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index 2607c2a1a9f..35f2a633459 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE class QKeyMapperPrivate; -class QKeyMapper : public QObject +class Q_GUI_EXPORT QKeyMapper : public QObject { Q_OBJECT public: @@ -76,11 +76,13 @@ public: static QKeyMapper *instance(); static void changeKeyboard(); +#ifndef Q_WS_QPA static bool sendKeyEvent(QWidget *widget, bool grab, QEvent::Type type, int code, Qt::KeyboardModifiers modifiers, const QString &text, bool autorepeat, int count, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, bool *unusedExceptForCocoa = 0); +#endif static QList possibleKeys(QKeyEvent *e); private: diff --git a/src/gui/kernel/qkeymapper_qws.cpp b/src/gui/kernel/qkeymapper_qpa.cpp similarity index 100% rename from src/gui/kernel/qkeymapper_qws.cpp rename to src/gui/kernel/qkeymapper_qpa.cpp diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 2350f166b57..0c7af19d349 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -41,11 +41,10 @@ #include "qkeysequence.h" #include "qkeysequence_p.h" -#include "private/qapplication_p.h" +#include "private/qguiapplication_p.h" #ifndef QT_NO_SHORTCUT -#include "qshortcut.h" #include "qdebug.h" #ifndef QT_NO_REGEXP # include "qregexp.h" @@ -55,14 +54,14 @@ #endif #include "qvariant.h" -#ifdef Q_WS_MAC -# include - +#ifdef Q_OS_MAC +#include +#include #endif QT_BEGIN_NAMESPACE -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC static bool qt_sequence_no_mnemonics = true; struct MacSpecialKey { int key; @@ -643,153 +642,153 @@ static const struct { const QKeyBinding QKeySequencePrivate::keyBindings[] = { // StandardKey Priority Key Sequence Platforms - {QKeySequence::Back, 0, Qt::Key_Backspace, QApplicationPrivate::KB_Win}, - {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, QApplicationPrivate::KB_All}, - {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, QApplicationPrivate::KB_All}, - {QKeySequence::Delete, 1, Qt::Key_Delete, QApplicationPrivate::KB_All}, - {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, QApplicationPrivate::KB_All}, - {QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, QApplicationPrivate::KB_All}, - {QKeySequence::MoveToNextChar, 0, Qt::Key_Right, QApplicationPrivate::KB_All}, - {QKeySequence::MoveToNextLine, 0, Qt::Key_Down, QApplicationPrivate::KB_All}, - {QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, QApplicationPrivate::KB_All}, - {QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, QApplicationPrivate::KB_All}, - {QKeySequence::HelpContents, 0, Qt::Key_F1, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::HelpContents, 0, Qt::Key_F2, QApplicationPrivate::KB_S60}, - {QKeySequence::FindNext, 0, Qt::Key_F3, QApplicationPrivate::KB_X11}, - {QKeySequence::FindNext, 1, Qt::Key_F3, QApplicationPrivate::KB_Win}, - {QKeySequence::Refresh, 0, Qt::Key_F5, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::Undo, 0, Qt::Key_F14, QApplicationPrivate::KB_X11}, //Undo on sun keyboards - {QKeySequence::Copy, 0, Qt::Key_F16, QApplicationPrivate::KB_X11}, //Copy on sun keyboards - {QKeySequence::Paste, 0, Qt::Key_F18, QApplicationPrivate::KB_X11}, //Paste on sun keyboards - {QKeySequence::Cut, 0, Qt::Key_F20, QApplicationPrivate::KB_X11}, //Cut on sun keyboards - {QKeySequence::PreviousChild, 0, Qt::Key_Back, QApplicationPrivate::KB_All}, - {QKeySequence::NextChild, 0, Qt::Key_Forward, QApplicationPrivate::KB_All}, - {QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, QApplicationPrivate::KB_Win}, - {QKeySequence::Delete, 0, Qt::SHIFT | Qt::Key_Backspace, QApplicationPrivate::KB_S60}, - {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, QApplicationPrivate::KB_All}, - {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, QApplicationPrivate::KB_All}, - {QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, //## Check if this should work on mac - {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_All}, - {QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, QApplicationPrivate::KB_All}, - {QKeySequence::SelectNextChar, 0, Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_All}, - {QKeySequence::SelectNextLine, 0, Qt::SHIFT | Qt::Key_Down, QApplicationPrivate::KB_All}, - {QKeySequence::SelectPreviousPage, 0, Qt::SHIFT | Qt::Key_PageUp, QApplicationPrivate::KB_All}, - {QKeySequence::SelectNextPage, 0, Qt::SHIFT | Qt::Key_PageDown, QApplicationPrivate::KB_All}, - {QKeySequence::WhatsThis, 1, Qt::SHIFT | Qt::Key_F1, QApplicationPrivate::KB_All}, - {QKeySequence::FindPrevious, 0, Qt::SHIFT | Qt::Key_F3, QApplicationPrivate::KB_X11}, - {QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, QApplicationPrivate::KB_Win}, - {QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, QApplicationPrivate::KB_All}, - {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, QApplicationPrivate::KB_KDE}, - {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, QApplicationPrivate::KB_Mac}, - {QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, QApplicationPrivate::KB_All}, - {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, QApplicationPrivate::KB_KDE}, - {QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectAll, 1, Qt::CTRL | Qt::Key_A, QApplicationPrivate::KB_All}, - {QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, QApplicationPrivate::KB_All}, - {QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, QApplicationPrivate::KB_All}, - {QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, QApplicationPrivate::KB_X11}, //emacs (line edit only) - {QKeySequence::Find, 0, Qt::CTRL | Qt::Key_F, QApplicationPrivate::KB_All}, - {QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac}, - {QKeySequence::FindNext, 0, Qt::CTRL | Qt::Key_G, QApplicationPrivate::KB_Win}, - {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, QApplicationPrivate::KB_Win}, - {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, QApplicationPrivate::KB_Gnome}, - {QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, QApplicationPrivate::KB_All}, - {QKeySequence::DeleteEndOfLine, 0, Qt::CTRL | Qt::Key_K, QApplicationPrivate::KB_X11}, //emacs (line edit only) - {QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, QApplicationPrivate::KB_All}, - {QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, QApplicationPrivate::KB_All}, - {QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, QApplicationPrivate::KB_All}, - {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_KDE | QApplicationPrivate::KB_Mac}, - {QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac}, - {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, QApplicationPrivate::KB_KDE}, - {QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, QApplicationPrivate::KB_All}, - {QKeySequence::AddTab, 0, Qt::CTRL | Qt::Key_T, QApplicationPrivate::KB_All}, - {QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, QApplicationPrivate::KB_All}, - {QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, QApplicationPrivate::KB_All}, - {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, QApplicationPrivate::KB_Mac}, - {QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, QApplicationPrivate::KB_All}, - {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_S60}, - {QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, QApplicationPrivate::KB_All}, - {QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, QApplicationPrivate::KB_Mac}, - {QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, QApplicationPrivate::KB_Mac}, - {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::Key_BraceLeft, QApplicationPrivate::KB_Mac}, - {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_BraceRight, QApplicationPrivate::KB_Mac}, - {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Tab, QApplicationPrivate::KB_Mac}, //different priority from above - {QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_Win}, - {QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_Win}, - {QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_Win}, - {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, QApplicationPrivate::KB_Mac }, - {QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, QApplicationPrivate::KB_Mac}, - {QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_Mac }, - {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, QApplicationPrivate::KB_Mac}, - {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, QApplicationPrivate::KB_Win}, - {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, QApplicationPrivate::KB_Mac}, - {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, QApplicationPrivate::KB_Win}, - {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac}, - {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QApplicationPrivate::KB_Win}, - {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, QApplicationPrivate::KB_KDE}, - {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac}, - {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QApplicationPrivate::KB_Mac}, - {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QApplicationPrivate::KB_Mac },//different priority from above - {QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, QApplicationPrivate::KB_X11}, - {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac }, - {QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11 | QApplicationPrivate::KB_S60}, - {QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac }, - {QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, QApplicationPrivate::KB_Mac}, - {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, QApplicationPrivate::KB_Win}, - {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, QApplicationPrivate::KB_Win}, - {QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, QApplicationPrivate::KB_Mac}, - {QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, QApplicationPrivate::KB_Mac}, - {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToStartOfBlock, 0, Qt::ALT | Qt::Key_Up, QApplicationPrivate::KB_Mac}, //mac only - {QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, QApplicationPrivate::KB_Mac}, - {QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, QApplicationPrivate::KB_Win | QApplicationPrivate::KB_X11}, - {QKeySequence::MoveToEndOfBlock, 0, Qt::ALT | Qt::Key_Down, QApplicationPrivate::KB_Mac}, //mac only - {QKeySequence::MoveToPreviousPage, 0, Qt::ALT | Qt::Key_PageUp, QApplicationPrivate::KB_Mac }, - {QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, QApplicationPrivate::KB_Mac }, - {QKeySequence::Redo, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Backspace,QApplicationPrivate::KB_Win}, - {QKeySequence::SelectPreviousWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectStartOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Up, QApplicationPrivate::KB_Mac}, //mac only - {QKeySequence::SelectNextWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectEndOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Down, QApplicationPrivate::KB_Mac}, //mac only - {QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, QApplicationPrivate::KB_Mac}, - {QKeySequence::Delete, 0, Qt::META | Qt::Key_D, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, QApplicationPrivate::KB_Mac}, - {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, QApplicationPrivate::KB_Mac}, - {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Enter, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToStartOfLine, 0, Qt::META | Qt::Key_Left, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_Up, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QApplicationPrivate::KB_Mac}, - {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QApplicationPrivate::KB_Mac}, - {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QApplicationPrivate::KB_Mac} + {QKeySequence::Back, 0, Qt::Key_Backspace, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, QGuiApplicationPrivate::KB_All}, + {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Delete, 1, Qt::Key_Delete, QGuiApplicationPrivate::KB_All}, + {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, QGuiApplicationPrivate::KB_All}, + {QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, QGuiApplicationPrivate::KB_All}, + {QKeySequence::MoveToNextChar, 0, Qt::Key_Right, QGuiApplicationPrivate::KB_All}, + {QKeySequence::MoveToNextLine, 0, Qt::Key_Down, QGuiApplicationPrivate::KB_All}, + {QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, QGuiApplicationPrivate::KB_All}, + {QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, QGuiApplicationPrivate::KB_All}, + {QKeySequence::HelpContents, 0, Qt::Key_F1, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, + {QKeySequence::HelpContents, 0, Qt::Key_F2, QGuiApplicationPrivate::KB_S60}, + {QKeySequence::FindNext, 0, Qt::Key_F3, QGuiApplicationPrivate::KB_X11}, + {QKeySequence::FindNext, 1, Qt::Key_F3, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::Refresh, 0, Qt::Key_F5, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, + {QKeySequence::Undo, 0, Qt::Key_F14, QGuiApplicationPrivate::KB_X11}, //Undo on sun keyboards + {QKeySequence::Copy, 0, Qt::Key_F16, QGuiApplicationPrivate::KB_X11}, //Copy on sun keyboards + {QKeySequence::Paste, 0, Qt::Key_F18, QGuiApplicationPrivate::KB_X11}, //Paste on sun keyboards + {QKeySequence::Cut, 0, Qt::Key_F20, QGuiApplicationPrivate::KB_X11}, //Cut on sun keyboards + {QKeySequence::PreviousChild, 0, Qt::Key_Back, QGuiApplicationPrivate::KB_All}, + {QKeySequence::NextChild, 0, Qt::Key_Forward, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::Delete, 0, Qt::SHIFT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_S60}, + {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, QGuiApplicationPrivate::KB_All}, + {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, + {QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, //## Check if this should work on mac + {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_All}, + {QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_All}, + {QKeySequence::SelectNextChar, 0, Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_All}, + {QKeySequence::SelectNextLine, 0, Qt::SHIFT | Qt::Key_Down, QGuiApplicationPrivate::KB_All}, + {QKeySequence::SelectPreviousPage, 0, Qt::SHIFT | Qt::Key_PageUp, QGuiApplicationPrivate::KB_All}, + {QKeySequence::SelectNextPage, 0, Qt::SHIFT | Qt::Key_PageDown, QGuiApplicationPrivate::KB_All}, + {QKeySequence::WhatsThis, 1, Qt::SHIFT | Qt::Key_F1, QGuiApplicationPrivate::KB_All}, + {QKeySequence::FindPrevious, 0, Qt::SHIFT | Qt::Key_F3, QGuiApplicationPrivate::KB_X11}, + {QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, QGuiApplicationPrivate::KB_All}, + {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, QGuiApplicationPrivate::KB_KDE}, + {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, QGuiApplicationPrivate::KB_All}, + {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, QGuiApplicationPrivate::KB_KDE}, + {QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::SelectAll, 1, Qt::CTRL | Qt::Key_A, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, QGuiApplicationPrivate::KB_X11}, //emacs (line edit only) + {QKeySequence::Find, 0, Qt::CTRL | Qt::Key_F, QGuiApplicationPrivate::KB_All}, + {QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::FindNext, 0, Qt::CTRL | Qt::Key_G, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, QGuiApplicationPrivate::KB_Gnome}, + {QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, QGuiApplicationPrivate::KB_All}, + {QKeySequence::DeleteEndOfLine, 0, Qt::CTRL | Qt::Key_K, QGuiApplicationPrivate::KB_X11}, //emacs (line edit only) + {QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_KDE | QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, QGuiApplicationPrivate::KB_KDE}, + {QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, QGuiApplicationPrivate::KB_All}, + {QKeySequence::AddTab, 0, Qt::CTRL | Qt::Key_T, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, + {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, QGuiApplicationPrivate::KB_All}, + {QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::Key_BraceLeft, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_BraceRight, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, + {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Tab, QGuiApplicationPrivate::KB_Mac}, //different priority from above + {QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win}, + {QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win}, + {QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_Win}, + {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac }, + {QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac }, + {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, QGuiApplicationPrivate::KB_KDE}, + {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, QGuiApplicationPrivate::KB_Gnome | QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, + {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, QGuiApplicationPrivate::KB_Mac },//different priority from above + {QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, QGuiApplicationPrivate::KB_X11}, + {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac }, + {QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11 | QGuiApplicationPrivate::KB_S60}, + {QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac }, + {QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_Win}, + {QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, + {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToStartOfBlock, 0, Qt::ALT | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac}, //mac only + {QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, QGuiApplicationPrivate::KB_Win | QGuiApplicationPrivate::KB_X11}, + {QKeySequence::MoveToEndOfBlock, 0, Qt::ALT | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac}, //mac only + {QKeySequence::MoveToPreviousPage, 0, Qt::ALT | Qt::Key_PageUp, QGuiApplicationPrivate::KB_Mac }, + {QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, QGuiApplicationPrivate::KB_Mac }, + {QKeySequence::Redo, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Backspace,QGuiApplicationPrivate::KB_Win}, + {QKeySequence::SelectPreviousWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::SelectStartOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac}, //mac only + {QKeySequence::SelectNextWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::SelectEndOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac}, //mac only + {QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::Delete, 0, Qt::META | Qt::Key_D, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Enter, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToStartOfLine, 0, Qt::META | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_Up, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, QGuiApplicationPrivate::KB_Mac}, + {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, QGuiApplicationPrivate::KB_Mac} }; const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate::keyBindings)/(sizeof(QKeyBinding)); @@ -968,7 +967,7 @@ QKeySequence::QKeySequence(const QKeySequence& keysequence) d->ref.ref(); } -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC static inline int maybeSwapShortcut(int shortcut) { if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { @@ -994,13 +993,13 @@ static inline int maybeSwapShortcut(int shortcut) */ QList QKeySequence::keyBindings(StandardKey key) { - uint platform = QApplicationPrivate::currentPlatform(); + uint platform = QGuiApplicationPrivate::currentKeyPlatform(); QList list; for (uint i = 0; i < QKeySequencePrivate::numberOfKeyBindings ; ++i) { QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i]; if (keyBinding.standardKey == key && (keyBinding.platform & platform)) { uint shortcut = -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC maybeSwapShortcut(QKeySequencePrivate::keyBindings[i].shortcut); #else QKeySequencePrivate::keyBindings[i].shortcut; @@ -1202,7 +1201,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence if (nativeText) { gmodifs = globalModifs(); if (gmodifs->isEmpty()) { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta); if (dontSwap) *gmodifs << QModifKeyName(Qt::META, QChar(kCommandUnicode)); @@ -1234,15 +1233,15 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence QList modifs; if (nativeText) { - modifs << QModifKeyName(Qt::CTRL, QShortcut::tr("Ctrl").toLower().append(QLatin1Char('+'))) - << QModifKeyName(Qt::SHIFT, QShortcut::tr("Shift").toLower().append(QLatin1Char('+'))) - << QModifKeyName(Qt::ALT, QShortcut::tr("Alt").toLower().append(QLatin1Char('+'))) - << QModifKeyName(Qt::META, QShortcut::tr("Meta").toLower().append(QLatin1Char('+'))); + modifs << QModifKeyName(Qt::CTRL, QCoreApplication::translate("QShortcut", "Ctrl").toLower().append(QLatin1Char('+'))) + << QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(QLatin1Char('+'))) + << QModifKeyName(Qt::ALT, QCoreApplication::translate("QShortcut", "Alt").toLower().append(QLatin1Char('+'))) + << QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(QLatin1Char('+'))); } modifs += *gmodifs; // Test non-translated ones last QString sl = accel; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC for (int i = 0; i < modifs.size(); ++i) { const QModifKeyName &mkf = modifs.at(i); if (sl.contains(mkf.name)) { @@ -1278,7 +1277,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence int fnum = 0; if (accel.length() == 1) { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC int qtKey = qtkeyForMacSymbol(accel[0]); if (qtKey != -1) { ret |= qtKey; @@ -1299,7 +1298,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence ++tran; for (int i = 0; keyname[i].name; ++i) { QString keyName(tran == 0 - ? QShortcut::tr(keyname[i].name) + ? QCoreApplication::translate("QShortcut", keyname[i].name) : QString::fromLatin1(keyname[i].name)); if (accel == keyName.toLower()) { ret |= keyname[i].key; @@ -1327,7 +1326,7 @@ QString QKeySequence::encodeString(int key) static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format) { if (!str.isEmpty()) - str += (format == QKeySequence::NativeText) ? QShortcut::tr("+") + str += (format == QKeySequence::NativeText) ? QCoreApplication::translate("QShortcut", "+") : QString::fromLatin1("+"); str += theKey; } @@ -1336,7 +1335,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat { bool nativeText = (format == QKeySequence::NativeText); QString s; -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) if (nativeText) { // On Mac OS X the order (by default) is Meta, Alt, Shift, Control. // If the AA_MacDontSwapCtrlAndMeta is enabled, then the order @@ -1367,13 +1366,13 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat { // On other systems the order is Meta, Control, Alt, Shift if ((key & Qt::META) == Qt::META) - s = nativeText ? QShortcut::tr("Meta") : QString::fromLatin1("Meta"); + s = nativeText ? QCoreApplication::translate("QShortcut", "Meta") : QString::fromLatin1("Meta"); if ((key & Qt::CTRL) == Qt::CTRL) - addKey(s, nativeText ? QShortcut::tr("Ctrl") : QString::fromLatin1("Ctrl"), format); + addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Ctrl") : QString::fromLatin1("Ctrl"), format); if ((key & Qt::ALT) == Qt::ALT) - addKey(s, nativeText ? QShortcut::tr("Alt") : QString::fromLatin1("Alt"), format); + addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Alt") : QString::fromLatin1("Alt"), format); if ((key & Qt::SHIFT) == Qt::SHIFT) - addKey(s, nativeText ? QShortcut::tr("Shift") : QString::fromLatin1("Shift"), format); + addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Shift") : QString::fromLatin1("Shift"), format); } @@ -1388,11 +1387,11 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat p += QChar(QChar::lowSurrogate(key)); } } else if (key >= Qt::Key_F1 && key <= Qt::Key_F35) { - p = nativeText ? QShortcut::tr("F%1").arg(key - Qt::Key_F1 + 1) + p = nativeText ? QCoreApplication::translate("QShortcut", "F%1").arg(key - Qt::Key_F1 + 1) : QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1); } else if (key) { int i=0; -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) if (nativeText) { QChar ch = qt_macSymbolForQtKey(key); if (!ch.isNull()) @@ -1402,12 +1401,12 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat } else #endif { -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC NonSymbol: #endif while (keyname[i].name) { if (key == keyname[i].key) { - p = nativeText ? QShortcut::tr(keyname[i].name) + p = nativeText ? QCoreApplication::translate("QShortcut", keyname[i].name) : QString::fromLatin1(keyname[i].name); break; } @@ -1428,7 +1427,7 @@ NonSymbol: } } -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC if (nativeText) s += p; else diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h index 22bdfc404dd..31cec17fb18 100644 --- a/src/gui/kernel/qkeysequence.h +++ b/src/gui/kernel/qkeysequence.h @@ -161,9 +161,6 @@ public: NoMatch, PartialMatch, ExactMatch -#ifdef QT3_SUPPORT - , Identical = ExactMatch -#endif }; QString toString(SequenceFormat format = PortableText) const; diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp new file mode 100644 index 00000000000..22d003d4e94 --- /dev/null +++ b/src/gui/kernel/qopenglcontext.cpp @@ -0,0 +1,605 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformopenglcontext_qpa.h" +#include "qopenglcontext.h" +#include "qopenglcontext_p.h" +#include "qwindow.h" + +#include +#include + +#include +#include + +#include + +#include + +class QGuiGLThreadContext +{ +public: + ~QGuiGLThreadContext() { + if (context) + context->doneCurrent(); + } + QOpenGLContext *context; +}; + +static QThreadStorage qwindow_context_storage; + +void QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context) +{ + QGuiGLThreadContext *threadContext = qwindow_context_storage.localData(); + if (!threadContext) { + if (!QThread::currentThread()) { + qWarning("No QTLS available. currentContext wont work"); + return; + } + threadContext = new QGuiGLThreadContext; + qwindow_context_storage.setLocalData(threadContext); + } + threadContext->context = context; +} + +/*! + Returns the last context which called makeCurrent. This function is thread aware. +*/ +QOpenGLContext* QOpenGLContext::currentContext() +{ + QGuiGLThreadContext *threadContext = qwindow_context_storage.localData(); + if(threadContext) { + return threadContext->context; + } + return 0; +} + +bool QOpenGLContext::areSharing(QOpenGLContext *first, QOpenGLContext *second) +{ + return first->shareGroup() == second->shareGroup(); +} + +QPlatformOpenGLContext *QOpenGLContext::handle() const +{ + Q_D(const QOpenGLContext); + return d->platformGLContext; +} + +QPlatformOpenGLContext *QOpenGLContext::shareHandle() const +{ + Q_D(const QOpenGLContext); + if (d->shareContext) + return d->shareContext->handle(); + return 0; +} + +/*! + Creates a new GL context instance, you need to call create() before it can be used. +*/ +QOpenGLContext::QOpenGLContext(QObject *parent) + : QObject(*new QOpenGLContextPrivate(), parent) +{ + Q_D(QOpenGLContext); + d->screen = QGuiApplication::primaryScreen(); +} + +/*! + Sets the format the GL context should be compatible with. You need to call create() before it takes effect. +*/ +void QOpenGLContext::setFormat(const QSurfaceFormat &format) +{ + Q_D(QOpenGLContext); + d->requestedFormat = format; +} + +/*! + Sets the context to share textures, shaders, and other GL resources with. You need to call create() before it takes effect. +*/ +void QOpenGLContext::setShareContext(QOpenGLContext *shareContext) +{ + Q_D(QOpenGLContext); + d->shareContext = shareContext; +} + +/*! + Sets the screen the GL context should be valid for. You need to call create() before it takes effect. +*/ +void QOpenGLContext::setScreen(QScreen *screen) +{ + Q_D(QOpenGLContext); + d->screen = screen; + if (!d->screen) + d->screen = QGuiApplication::primaryScreen(); +} + +/*! + Attempts to create the GL context with the desired parameters. + + Returns true if the native context was successfully created and is ready to be used. +*/ +bool QOpenGLContext::create() +{ + destroy(); + + Q_D(QOpenGLContext); + d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this); + d->platformGLContext->setContext(this); + d->shareGroup = d->shareContext ? d->shareContext->shareGroup() : new QOpenGLContextGroup; + d->shareGroup->d_func()->addContext(this); + return d->platformGLContext; +} + +void QOpenGLContext::destroy() +{ + Q_D(QOpenGLContext); + if (QOpenGLContext::currentContext() == this) + doneCurrent(); + if (d->shareGroup) + d->shareGroup->d_func()->removeContext(this); + d->shareGroup = 0; + delete d->platformGLContext; + d->platformGLContext = 0; + delete d->functions; + d->functions = 0; +} + +/*! + If this is the current context for the thread, doneCurrent is called +*/ +QOpenGLContext::~QOpenGLContext() +{ + destroy(); +} + +/*! + Returns if this context is valid, i.e. has been successfully created. +*/ +bool QOpenGLContext::isValid() const +{ + Q_D(const QOpenGLContext); + return d->platformGLContext != 0; +} + +/*! + Get the QOpenGLFunctions instance for this context. + + The context or a sharing context must be current. +*/ + +QOpenGLFunctions *QOpenGLContext::functions() const +{ + Q_D(const QOpenGLContext); + if (!d->functions) + const_cast(d->functions) = new QOpenGLExtensions(QOpenGLContext::currentContext()); + return d->functions; +} + +/*! + If surface is 0 this is equivalent to calling doneCurrent(). + + Do not call this function from a different thread than the one the QOpenGLContext instance lives in. If + you wish to use QOpenGLContext from a different thread you should first call make sure it's not current + in the current thread, by calling doneCurrent() if necessary. Then call moveToThread(otherThread) + before using it in the other thread. +*/ +bool QOpenGLContext::makeCurrent(QSurface *surface) +{ + Q_D(QOpenGLContext); + if (!d->platformGLContext) + return false; + + if (thread() != QThread::currentThread()) + qFatal("Cannot make QOpenGLContext current in a different thread"); + + if (!surface) { + doneCurrent(); + return true; + } + + if (!surface->surfaceHandle()) + return false; + + if (d->platformGLContext->makeCurrent(surface->surfaceHandle())) { + QOpenGLContextPrivate::setCurrentContext(this); + d->surface = surface; + + d->shareGroup->d_func()->deletePendingResources(this); + + return true; + } + + return false; +} + +/*! + Convenience function for calling makeCurrent with a 0 surface. +*/ +void QOpenGLContext::doneCurrent() +{ + Q_D(QOpenGLContext); + if (!d->platformGLContext) + return; + + if (QOpenGLContext::currentContext() == this) + d->shareGroup->d_func()->deletePendingResources(this); + + d->platformGLContext->doneCurrent(); + QOpenGLContextPrivate::setCurrentContext(0); + + d->surface = 0; +} + +/*! + Returns the surface the context is current for. +*/ +QSurface *QOpenGLContext::surface() const +{ + Q_D(const QOpenGLContext); + return d->surface; +} + + +void QOpenGLContext::swapBuffers(QSurface *surface) +{ + Q_D(QOpenGLContext); + if (!d->platformGLContext) + return; + + if (!surface) { + qWarning() << "QOpenGLContext::swapBuffers() called with null argument"; + return; + } + + d->platformGLContext->swapBuffers(surface->surfaceHandle()); +} + +void (*QOpenGLContext::getProcAddress(const QByteArray &procName)) () +{ + Q_D(QOpenGLContext); + if (!d->platformGLContext) + return 0; + return d->platformGLContext->getProcAddress(procName); +} + +QSurfaceFormat QOpenGLContext::format() const +{ + Q_D(const QOpenGLContext); + if (!d->platformGLContext) + return d->requestedFormat; + return d->platformGLContext->format(); +} + +QOpenGLContextGroup *QOpenGLContext::shareGroup() const +{ + Q_D(const QOpenGLContext); + return d->shareGroup; +} + +QOpenGLContext *QOpenGLContext::shareContext() const +{ + Q_D(const QOpenGLContext); + return d->shareContext; +} + +QScreen *QOpenGLContext::screen() const +{ + Q_D(const QOpenGLContext); + return d->screen; +} + +/* + internal: Needs to have a pointer to qGLContext. But since this is in QtGui we cant + have any type information. +*/ +void *QOpenGLContext::qGLContextHandle() const +{ + Q_D(const QOpenGLContext); + return d->qGLContextHandle; +} + +void QOpenGLContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *)) +{ + Q_D(QOpenGLContext); + d->qGLContextHandle = handle; + d->qGLContextDeleteFunction = qGLContextDeleteFunction; +} + +void QOpenGLContext::deleteQGLContext() +{ + Q_D(QOpenGLContext); + if (d->qGLContextDeleteFunction && d->qGLContextHandle) { + d->qGLContextDeleteFunction(d->qGLContextHandle); + d->qGLContextDeleteFunction = 0; + d->qGLContextHandle = 0; + } +} + +QOpenGLContextGroup::QOpenGLContextGroup() + : QObject(*new QOpenGLContextGroupPrivate()) +{ +} + +QOpenGLContextGroup::~QOpenGLContextGroup() +{ + Q_D(QOpenGLContextGroup); + d->cleanup(); +} + +QList QOpenGLContextGroup::shares() const +{ + Q_D(const QOpenGLContextGroup); + return d->m_shares; +} + +QOpenGLContextGroup *QOpenGLContextGroup::currentContextGroup() +{ + QOpenGLContext *current = QOpenGLContext::currentContext(); + return current ? current->shareGroup() : 0; +} + +void QOpenGLContextGroupPrivate::addContext(QOpenGLContext *ctx) +{ + QMutexLocker locker(&m_mutex); + m_refs.ref(); + m_shares << ctx; +} + +void QOpenGLContextGroupPrivate::removeContext(QOpenGLContext *ctx) +{ + Q_Q(QOpenGLContextGroup); + + QMutexLocker locker(&m_mutex); + m_shares.removeOne(ctx); + + if (ctx == m_context && !m_shares.isEmpty()) + m_context = m_shares.first(); + + if (!m_refs.deref()) { + cleanup(); + q->deleteLater(); + } +} + +void QOpenGLContextGroupPrivate::cleanup() +{ + QList::iterator it = m_sharedResources.begin(); + QList::iterator end = m_sharedResources.end(); + + while (it != end) { + (*it)->invalidateResource(); + (*it)->m_group = 0; + ++it; + } + + m_sharedResources.clear(); + + qDeleteAll(m_pendingDeletion.begin(), m_pendingDeletion.end()); + m_pendingDeletion.clear(); +} + +void QOpenGLContextGroupPrivate::deletePendingResources(QOpenGLContext *ctx) +{ + QMutexLocker locker(&m_mutex); + + QList pending = m_pendingDeletion; + m_pendingDeletion.clear(); + + QList::iterator it = pending.begin(); + QList::iterator end = pending.end(); + while (it != end) { + (*it)->freeResource(ctx); + delete *it; + ++it; + } +} + +/*! + \class QOpenGLSharedResource + \internal + \since 5.0 + \brief The QOpenGLSharedResource class is used to keep track of resources that + are shared between OpenGL contexts (like textures, framebuffer objects, shader + programs, etc), and clean them up in a safe way when they're no longer needed. + + The QOpenGLSharedResource instance should never be deleted, instead free() + should be called when it's no longer needed. Thus it will be put on a queue + and freed at an appropriate time (when a context in the share group becomes + current). + + The sub-class needs to implement two pure virtual functions. The first, + freeResource() must be implemented to actually do the freeing, for example + call glDeleteTextures() on a texture id. Qt makes sure a valid context in + the resource's share group is current at the time. The other, invalidateResource(), + is called by Qt in the circumstance when the last context in the share group is + destroyed before free() has been called. The implementation of invalidateResource() + should set any identifiers to 0 or set a flag to prevent them from being used + later on. +*/ +QOpenGLSharedResource::QOpenGLSharedResource(QOpenGLContextGroup *group) + : m_group(group) +{ + QMutexLocker locker(&m_group->d_func()->m_mutex); + m_group->d_func()->m_sharedResources << this; +} + +QOpenGLSharedResource::~QOpenGLSharedResource() +{ +} + +// schedule the resource for deletion at an appropriate time +void QOpenGLSharedResource::free() +{ + if (!m_group) { + delete this; + return; + } + + QMutexLocker locker(&m_group->d_func()->m_mutex); + m_group->d_func()->m_sharedResources.removeOne(this); + m_group->d_func()->m_pendingDeletion << this; + + // can we delete right away? + QOpenGLContext *current = QOpenGLContext::currentContext(); + if (current && current->shareGroup() == m_group) { + m_group->d_func()->deletePendingResources(current); + } +} + +/*! + \class QOpenGLSharedResourceGuard + \internal + \since 5.0 + \brief The QOpenGLSharedResourceGuard class is a convenience sub-class of + QOpenGLSharedResource to be used to track a single OpenGL object with a + GLuint identifier. The constructor takes a function pointer to a function + that will be used to free the resource if and when necessary. +*/ +void QOpenGLSharedResourceGuard::freeResource(QOpenGLContext *context) +{ + if (m_id) { + QOpenGLFunctions functions(context); + m_func(&functions, m_id); + m_id = 0; + } +} + +/*! + \class QOpenGLMultiGroupSharedResource + \internal + \since 5.0 + \brief The QOpenGLMultiGroupSharedResource keeps track of a shared resource + that might be needed from multiple contexts, like a glyph cache or gradient + cache. One instance of the object is created for each group when + necessary. The shared resource instance should have a constructor that + takes a QOpenGLContext *. To get an instance for a given context one calls + T *QOpenGLMultiGroupSharedResource::value(context), where T is a sub-class + of QOpenGLSharedResource. + + You should not call free() on QOpenGLSharedResources owned by a + QOpenGLMultiGroupSharedResource instance. +*/ +QOpenGLMultiGroupSharedResource::QOpenGLMultiGroupSharedResource() + : active(0) +{ +#ifdef QT_GL_CONTEXT_RESOURCE_DEBUG + qDebug("Creating context group resource object %p.", this); +#endif +} + +QOpenGLMultiGroupSharedResource::~QOpenGLMultiGroupSharedResource() +{ +#ifdef QT_GL_CONTEXT_RESOURCE_DEBUG + qDebug("Deleting context group resource %p. Group size: %d.", this, m_groups.size()); +#endif + for (int i = 0; i < m_groups.size(); ++i) { + if (!m_groups.at(i)->shares().isEmpty()) { + QOpenGLContext *context = m_groups.at(i)->shares().first(); + QOpenGLSharedResource *resource = value(context); + if (resource) + resource->free(); + } + m_groups.at(i)->d_func()->m_resources.remove(this); + active.deref(); + } +#ifndef QT_NO_DEBUG + if (active != 0) { + qWarning("QtGui: Resources are still available at program shutdown.\n" + " This is possibly caused by a leaked QOpenGLWidget, \n" + " QOpenGLFramebufferObject or QOpenGLPixelBuffer."); + } +#endif +} + +void QOpenGLMultiGroupSharedResource::insert(QOpenGLContext *context, QOpenGLSharedResource *value) +{ +#ifdef QT_GL_CONTEXT_RESOURCE_DEBUG + qDebug("Inserting context group resource %p for context %p, managed by %p.", value, context, this); +#endif + QOpenGLContextGroup *group = context->shareGroup(); + Q_ASSERT(!group->d_func()->m_resources.contains(this)); + group->d_func()->m_resources.insert(this, value); + m_groups.append(group); + active.ref(); +} + +QOpenGLSharedResource *QOpenGLMultiGroupSharedResource::value(QOpenGLContext *context) +{ + QOpenGLContextGroup *group = context->shareGroup(); + return group->d_func()->m_resources.value(this, 0); +} + +QList QOpenGLMultiGroupSharedResource::resources() const +{ + QList result; + for (QList::const_iterator it = m_groups.constBegin(); it != m_groups.constEnd(); ++it) { + QOpenGLSharedResource *resource = (*it)->d_func()->m_resources.value(const_cast(this), 0); + if (resource) + result << resource; + } + return result; +} + +void QOpenGLMultiGroupSharedResource::cleanup(QOpenGLContext *ctx) +{ + QOpenGLSharedResource *resource = value(ctx); + + if (resource != 0) { + resource->free(); + + QOpenGLContextGroup *group = ctx->shareGroup(); + group->d_func()->m_resources.remove(this); + m_groups.removeOne(group); + active.deref(); + } +} + +void QOpenGLMultiGroupSharedResource::cleanup(QOpenGLContext *ctx, QOpenGLSharedResource *value) +{ +#ifdef QT_GL_CONTEXT_RESOURCE_DEBUG + qDebug("Cleaning up context group resource %p, for context %p in thread %p.", this, ctx, QThread::currentThread()); +#endif + value->free(); + active.deref(); + + QOpenGLContextGroup *group = ctx->shareGroup(); + m_groups.removeOne(group); +} + diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h new file mode 100644 index 00000000000..b5a19a0ebcd --- /dev/null +++ b/src/gui/kernel/qopenglcontext.h @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENGLCONTEXT_H +#define QOPENGLCONTEXT_H + +#include +#include +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QOpenGLContextPrivate; +class QOpenGLContextGroupPrivate; +class QOpenGLFunctions; +class QPlatformOpenGLContext; + +class QScreen; +class QSurface; + +class Q_GUI_EXPORT QOpenGLContextGroup : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QOpenGLContextGroup) +public: + ~QOpenGLContextGroup(); + + QList shares() const; + + static QOpenGLContextGroup *currentContextGroup(); + +private: + QOpenGLContextGroup(); + + friend class QOpenGLContext; + friend class QOpenGLContextGroupResourceBase; + friend class QOpenGLSharedResource; + friend class QOpenGLMultiGroupSharedResource; +}; + +class Q_GUI_EXPORT QOpenGLContext : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QOpenGLContext) +public: + QOpenGLContext(QObject *parent = 0); + ~QOpenGLContext(); + + void setFormat(const QSurfaceFormat &format); + void setShareContext(QOpenGLContext *shareContext); + void setScreen(QScreen *screen); + + bool create(); + bool isValid() const; + + QSurfaceFormat format() const; + QOpenGLContext *shareContext() const; + QOpenGLContextGroup *shareGroup() const; + QScreen *screen() const; + + bool makeCurrent(QSurface *surface); + void doneCurrent(); + + void swapBuffers(QSurface *surface); + void (*getProcAddress(const QByteArray &procName)) (); + + QSurface *surface() const; + + static QOpenGLContext *currentContext(); + static bool areSharing(QOpenGLContext *first, QOpenGLContext *second); + + QPlatformOpenGLContext *handle() const; + QPlatformOpenGLContext *shareHandle() const; + + QOpenGLFunctions *functions() const; + +private: + friend class QGLContext; + friend class QOpenGLContextResourceBase; + friend class QOpenGLPaintDevice; + friend class QOpenGLGlyphTexture; + friend class QOpenGLTextureGlyphCache; + friend class QOpenGLEngineShaderManager; + friend class QOpenGLFramebufferObject; + friend class QOpenGLFramebufferObjectPrivate; + friend class QOpenGL2PaintEngineEx; + friend class QOpenGL2PaintEngineExPrivate; + friend class QSGDistanceFieldGlyphCache; + friend class QWidgetPrivate; + + void *qGLContextHandle() const; + void setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *)); + void deleteQGLContext(); + + void destroy(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGUIGLCONTEXT_H diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h new file mode 100644 index 00000000000..059872c09fb --- /dev/null +++ b/src/gui/kernel/qopenglcontext_p.h @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGUIGLCONTEXT_P_H +#define QGUIGLCONTEXT_P_H + +#include "qopengl.h" +#include "qopenglcontext.h" +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QOpenGLFunctions; +class QOpenGLContext; +class QOpenGLMultiGroupSharedResource; + +class Q_GUI_EXPORT QOpenGLSharedResource +{ +public: + QOpenGLSharedResource(QOpenGLContextGroup *group); + virtual ~QOpenGLSharedResource() = 0; + + QOpenGLContextGroup *group() const { return m_group; } + + // schedule the resource for deletion at an appropriate time + void free(); + +protected: + // the resource's share group no longer exists, invalidate the resource + virtual void invalidateResource() = 0; + + // a valid context in the group is current, free the resource + virtual void freeResource(QOpenGLContext *context) = 0; + +private: + QOpenGLContextGroup *m_group; + + friend class QOpenGLContextGroup; + friend class QOpenGLContextGroupPrivate; + + Q_DISABLE_COPY(QOpenGLSharedResource); +}; + +class Q_GUI_EXPORT QOpenGLSharedResourceGuard : public QOpenGLSharedResource +{ +public: + typedef void (*FreeResourceFunc)(QOpenGLFunctions *functions, GLuint id); + QOpenGLSharedResourceGuard(QOpenGLContext *context, GLuint id, FreeResourceFunc func) + : QOpenGLSharedResource(context->shareGroup()) + , m_id(id) + , m_func(func) + { + } + + GLuint id() const { return m_id; } + +protected: + void invalidateResource() + { + m_id = 0; + } + + void freeResource(QOpenGLContext *context); + +private: + GLuint m_id; + FreeResourceFunc m_func; +}; + +class Q_GUI_EXPORT QOpenGLContextGroupPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QOpenGLContextGroup); +public: + QOpenGLContextGroupPrivate() + : m_context(0) + , m_mutex(QMutex::Recursive) + , m_refs(0) + { + } + + void addContext(QOpenGLContext *ctx); + void removeContext(QOpenGLContext *ctx); + + void cleanup(); + + void deletePendingResources(QOpenGLContext *ctx); + + QOpenGLContext *m_context; + + QList m_shares; + QMutex m_mutex; + + QHash m_resources; + QAtomicInt m_refs; + + QList m_sharedResources; + QList m_pendingDeletion; + + void cleanupResources(QOpenGLContext *ctx); +}; + +class Q_GUI_EXPORT QOpenGLMultiGroupSharedResource +{ +public: + QOpenGLMultiGroupSharedResource(); + ~QOpenGLMultiGroupSharedResource(); + + void insert(QOpenGLContext *context, QOpenGLSharedResource *value); + void cleanup(QOpenGLContext *context); + void cleanup(QOpenGLContext *context, QOpenGLSharedResource *value); + + QOpenGLSharedResource *value(QOpenGLContext *context); + + QList resources() const; + + template + T *value(QOpenGLContext *context) { + QOpenGLContextGroup *group = context->shareGroup(); + T *resource = static_cast(group->d_func()->m_resources.value(this, 0)); + if (!resource) { + resource = new T(context); + insert(context, resource); + } + return resource; + } + +private: + QAtomicInt active; + QList m_groups; +}; + +class QPaintEngineEx; +class QOpenGLFunctions; + +class Q_GUI_EXPORT QOpenGLContextPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QOpenGLContext) +public: + QOpenGLContextPrivate() + : qGLContextHandle(0) + , platformGLContext(0) + , shareContext(0) + , shareGroup(0) + , screen(0) + , surface(0) + , functions(0) + , current_fbo(0) + , default_fbo(0) + , workaround_brokenFBOReadBack(false) + , workaround_brokenTexSubImage(false) + , active_engine(0) + { + } + + virtual ~QOpenGLContextPrivate() + { + //do not delete the QOpenGLContext handle here as it is deleted in + //QWidgetPrivate::deleteTLSysExtra() + } + + void *qGLContextHandle; + void (*qGLContextDeleteFunction)(void *handle); + + QSurfaceFormat requestedFormat; + QPlatformOpenGLContext *platformGLContext; + QOpenGLContext *shareContext; + QOpenGLContextGroup *shareGroup; + QScreen *screen; + QSurface *surface; + QOpenGLFunctions *functions; + + GLuint current_fbo; + GLuint default_fbo; + + bool workaround_brokenFBOReadBack; + bool workaround_brokenTexSubImage; + + QPaintEngineEx *active_engine; + + QHash m_resources; + + static void setCurrentContext(QOpenGLContext *context); + + int maxTextureSize() const { return 1024; } +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QGUIGLCONTEXT_P_H diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index ed483d95ffb..404faea25f0 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qpalette.h" -#include "qapplication.h" +#include "qguiapplication.h" #include "qdatastream.h" #include "qvariant.h" @@ -63,103 +63,6 @@ static QColor qt_mix_colors(QColor a, QColor b) (a.blue() + b.blue()) / 2, (a.alpha() + b.alpha()) / 2); } -#ifdef QT3_SUPPORT - -#ifndef QT_NO_DATASTREAM -QDataStream &qt_stream_out_qcolorgroup(QDataStream &s, const QColorGroup &g) -{ - if(s.version() == 1) { - // Qt 1.x - s << g.color(QPalette::Foreground) << g.color(QPalette::Background) - << g.color(QPalette::Light) << g.color(QPalette::Dark) - << g.color(QPalette::Mid) << g.color(QPalette::Text) << g.color(QPalette::Base); - } else { - int max = QPalette::NColorRoles; - if (s.version() <= QDataStream::Qt_2_1) - max = QPalette::HighlightedText + 1; - else if (s.version() <= QDataStream::Qt_4_3) - max = QPalette::AlternateBase + 1; - for(int r = 0 ; r < max ; r++) - s << g.brush((QPalette::ColorRole)r); - } - return s; -} - -QDataStream &qt_stream_in_qcolorgroup(QDataStream &s, QColorGroup &g) -{ - if(s.version() == 1) { // Qt 1.x - QColor fg, bg, light, dark, mid, text, base; - s >> fg >> bg >> light >> dark >> mid >> text >> base; - QPalette p(bg); - p.setColor(QPalette::Active, QPalette::Foreground, fg); - p.setColor(QPalette::Active, QPalette::Light, light); - p.setColor(QPalette::Active, QPalette::Dark, dark); - p.setColor(QPalette::Active, QPalette::Mid, mid); - p.setColor(QPalette::Active, QPalette::Text, text); - p.setColor(QPalette::Active, QPalette::Base, base); - g = p; - g.setCurrentColorGroup(QPalette::Active); - } else { - int max = QPalette::NColorRoles; - if (s.version() <= QDataStream::Qt_2_1) - max = QPalette::HighlightedText + 1; - else if (s.version() <= QDataStream::Qt_3_0) - max = QPalette::LinkVisited + 1; - else if (s.version() <= QDataStream::Qt_4_3) - max = QPalette::AlternateBase + 1; - QBrush tmp; - for(int r = 0 ; r < max; r++) { - s >> tmp; - g.setBrush((QPalette::ColorRole)r, tmp); - } - } - return s; -} - -QDataStream &operator<<(QDataStream &s, const QColorGroup &g) -{ - return qt_stream_out_qcolorgroup(s, g); -} - -QDataStream &operator>>(QDataStream &s, QColorGroup &g) -{ - return qt_stream_in_qcolorgroup(s, g); -} -#endif // QT_NO_DATASTREAM - -/*! - Constructs a palette with the specified \a active, \a disabled and - \a inactive color groups. -*/ -QPalette::QPalette(const QColorGroup &active, const QColorGroup &disabled, - const QColorGroup &inactive) -{ - Q_ASSERT(QPalette::NColorRoles == QPalette::ToolTipText + 1); - init(); - setColorGroup(Active, active); - setColorGroup(Disabled, disabled); - setColorGroup(Inactive, inactive); -} - -QColorGroup QPalette::createColorGroup(ColorGroup cr) const -{ - QColorGroup ret(*this); - ret.setCurrentColorGroup(cr); - return ret; -} - -void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g) -{ - setColorGroup(cg, g.brush(WindowText), g.brush(Button), g.brush(Light), - g.brush(Dark), g.brush(Mid), g.brush(Text), g.brush(BrightText), - g.brush(Base), g.brush(AlternateBase), g.brush(Window), - g.brush(Midlight), g.brush(ButtonText), g.brush(Shadow), - g.brush(Highlight), g.brush(HighlightedText), g.brush(Link), - g.brush(LinkVisited), g.brush(ToolTipBase), g.brush(ToolTipText)); -} - -#endif // QT3_SUPPORT - /*! \fn const QColor &QPalette::color(ColorRole role) const @@ -433,7 +336,7 @@ void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g) roles are enumerated and defined in the \l ColorRole documentation. We strongly recommend that you use the default palette of the - current style (returned by QApplication::palette()) and + current style (returned by QGuiApplication::palette()) and modify that as necessary. This is done by Qt's widgets when they are drawn. @@ -584,7 +487,7 @@ void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g) \sa QApplication::setPalette(), QApplication::palette() */ QPalette::QPalette() - : d(QApplication::palette().d), + : d(QGuiApplication::palette().d), current_group(Active), resolve_mask(0) { @@ -897,27 +800,6 @@ bool QPalette::operator==(const QPalette &p) const return true; } -#ifdef QT3_SUPPORT -bool QColorGroup::operator==(const QColorGroup &other) const -{ - if (isCopyOf(other)) - return true; - for (int role = 0; role < int(NColorRoles); role++) { - if(d->br[current_group][role] != other.d->br[other.current_group][role]) - return false; - } - return true; -} - -/*! - Returns the color group as a QVariant -*/ -QColorGroup::operator QVariant() const -{ - return QVariant(QVariant::ColorGroup, this); -} -#endif - /*! \fn bool QPalette::isEqual(ColorGroup cg1, ColorGroup cg2) const @@ -1205,75 +1087,5 @@ void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBru Use simple assignment instead. */ -/*! - \fn QColorGroup QPalette::normal() const - \obsolete - - Returns the active color group. Use active() instead. - - Use createColorGroup(Active) instead. -*/ - -/*! - \fn void QPalette::setNormal(const QColorGroup &colorGroup) - - Sets the normal color group to \a colorGroup. - - \sa QColorGroup -*/ - -/*! - \fn QColorGroup QPalette::active() const - - Returns the active color group. - \sa QColorGroup -*/ - -/*! - \fn QColorGroup QPalette::disabled() const - - Returns the disabled color group. - \sa QColorGroup -*/ - -/*! - \fn QColorGroup QPalette::inactive() const - - Returns the inactive color group. - \sa QColorGroup -*/ - -/*! - \fn void QPalette::setActive(const QColorGroup &colorGroup) - - Sets the active color group to \a colorGroup. - \sa QColorGroup -*/ - -/*! - \fn void QPalette::setDisabled(const QColorGroup &colorGroup) - - Sets the disabled color group to \a colorGroup. - \sa QColorGroup -*/ - -/*! - \fn void QPalette::setInactive(const QColorGroup &colorGroup) - - Sets the inactive color group. - \sa QColorGroup -*/ - -/*! \fn bool QColorGroup::operator==(const QColorGroup &other) const - - Returns true if this color group is equal to \a other; otherwise - returns false. -*/ - -/*! \fn bool QColorGroup::operator!=(const QColorGroup &other) const - - Returns true if this color group is not equal to \a other; - otherwise returns false. -*/ QT_END_NAMESPACE diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index 671a56cd781..dd59d121a0c 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -52,9 +52,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifdef QT3_SUPPORT -class QColorGroup; -#endif class QPalettePrivate; class QVariant; @@ -72,9 +69,6 @@ public: const QBrush &bright_text, const QBrush &base, const QBrush &window); QPalette(const QColor &windowText, const QColor &window, const QColor &light, const QColor &dark, const QColor &mid, const QColor &text, const QColor &base); -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QPalette(const QColorGroup &active, const QColorGroup &disabled, const QColorGroup &inactive); -#endif QPalette(const QPalette &palette); ~QPalette(); QPalette &operator=(const QPalette &palette); @@ -142,19 +136,6 @@ public: inline const QBrush &link() const { return brush(Link); } inline const QBrush &linkVisited() const { return brush(LinkVisited); } -#ifdef QT3_SUPPORT - inline QT3_SUPPORT QPalette copy() const { QPalette p = *this; p.detach(); return p; } - QT3_SUPPORT QColorGroup normal() const; - inline QT3_SUPPORT void setNormal(const QColorGroup &cg) { setColorGroup(Active, cg); } - - QT3_SUPPORT QColorGroup active() const; - QT3_SUPPORT QColorGroup disabled() const; - QT3_SUPPORT QColorGroup inactive() const; - inline QT3_SUPPORT void setActive(const QColorGroup &cg) { setColorGroup(Active, cg); } - inline QT3_SUPPORT void setDisabled(const QColorGroup &cg) { setColorGroup(Disabled, cg); } - inline QT3_SUPPORT void setInactive(const QColorGroup &cg) { setColorGroup(Inactive, cg); } -#endif - bool operator==(const QPalette &p) const; inline bool operator!=(const QPalette &p) const { return !(operator==(p)); } bool isCopyOf(const QPalette &p) const; @@ -184,11 +165,6 @@ private: const QBrush &highlight, const QBrush &highlighted_text, const QBrush &link, const QBrush &link_visited, const QBrush &toolTipBase, const QBrush &toolTipText); -#ifdef QT3_SUPPORT - friend class QColorGroup; - void setColorGroup(ColorGroup, const QColorGroup &); - QColorGroup createColorGroup(ColorGroup) const; -#endif void init(); void detach(); @@ -206,55 +182,6 @@ inline void QPalette::setColor(ColorRole acr, const QColor &acolor) inline void QPalette::setBrush(ColorRole acr, const QBrush &abrush) { setBrush(All, acr, abrush); } -#ifdef QT3_SUPPORT -class Q_GUI_EXPORT QColorGroup : public QPalette -{ -public: - inline QColorGroup() : QPalette() {} - inline QColorGroup(const QBrush &foreground, const QBrush &button, const QBrush &light, - const QBrush &dark, const QBrush &mid, const QBrush &text, - const QBrush &bright_text, const QBrush &base, const QBrush &background) - : QPalette(foreground, button, light, dark, mid, text, bright_text, base, background) - {} - inline QColorGroup(const QColor &foreground, const QColor &background, const QColor &light, - const QColor &dark, const QColor &mid, const QColor &text, const QColor &base) - : QPalette(foreground, background, light, dark, mid, text, base) {} - inline QColorGroup(const QColorGroup &cg) : QPalette(cg) {} - inline QColorGroup(const QPalette &pal) : QPalette(pal) {} - bool operator==(const QColorGroup &other) const; - inline bool operator!=(const QColorGroup &other) const { return !(operator==(other)); } - operator QVariant() const; - - inline QT3_SUPPORT const QColor &foreground() const { return color(WindowText); } - inline QT3_SUPPORT const QColor &button() const { return color(Button); } - inline QT3_SUPPORT const QColor &light() const { return color(Light); } - inline QT3_SUPPORT const QColor &dark() const { return color(Dark); } - inline QT3_SUPPORT const QColor &mid() const { return color(Mid); } - inline QT3_SUPPORT const QColor &text() const { return color(Text); } - inline QT3_SUPPORT const QColor &base() const { return color(Base); } - inline QT3_SUPPORT const QColor &background() const { return color(Window); } - inline QT3_SUPPORT const QColor &midlight() const { return color(Midlight); } - inline QT3_SUPPORT const QColor &brightText() const { return color(BrightText); } - inline QT3_SUPPORT const QColor &buttonText() const { return color(ButtonText); } - inline QT3_SUPPORT const QColor &shadow() const { return color(Shadow); } - inline QT3_SUPPORT const QColor &highlight() const { return color(Highlight); } - inline QT3_SUPPORT const QColor &highlightedText() const { return color(HighlightedText); } - inline QT3_SUPPORT const QColor &link() const { return color(Link); } - inline QT3_SUPPORT const QColor &linkVisited() const { return color(LinkVisited); } -}; - -#ifndef QT_NO_DATASTREAM -Q_GUI_EXPORT QT3_SUPPORT QDataStream &operator<<(QDataStream &ds, const QColorGroup &cg); -Q_GUI_EXPORT QT3_SUPPORT QDataStream &operator>>(QDataStream &ds, QColorGroup &cg); -#endif - -inline QColorGroup QPalette::inactive() const { return createColorGroup(Inactive); } -inline QColorGroup QPalette::disabled() const { return createColorGroup(Disabled); } -inline QColorGroup QPalette::active() const { return createColorGroup(Active); } -inline QColorGroup QPalette::normal() const { return createColorGroup(Active); } - -#endif - /***************************************************************************** QPalette stream functions *****************************************************************************/ diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp index f8e4b629b6a..66693409d1a 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.cpp +++ b/src/gui/kernel/qplatformclipboard_qpa.cpp @@ -42,7 +42,7 @@ #ifndef QT_NO_CLIPBOARD -#include +#include QT_BEGIN_NAMESPACE @@ -102,9 +102,15 @@ bool QPlatformClipboard::supportsMode(QClipboard::Mode mode) const return mode == QClipboard::Clipboard; } +bool QPlatformClipboard::ownsMode(QClipboard::Mode mode) const +{ + Q_UNUSED(mode); + return false; +} + void QPlatformClipboard::emitChanged(QClipboard::Mode mode) { - QApplication::clipboard()->emitChanged(mode); + QGuiApplication::clipboard()->emitChanged(mode); } QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h index 6a40fbc86c7..fc0505b87ee 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.h +++ b/src/gui/kernel/qplatformclipboard_qpa.h @@ -62,6 +62,7 @@ public: virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); virtual bool supportsMode(QClipboard::Mode mode) const; + virtual bool ownsMode(QClipboard::Mode mode) const; void emitChanged(QClipboard::Mode mode); }; diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp index 06954864f2f..56d2847cfb1 100644 --- a/src/gui/kernel/qplatformcursor_qpa.cpp +++ b/src/gui/kernel/qplatformcursor_qpa.cpp @@ -40,10 +40,10 @@ ****************************************************************************/ #include "qplatformcursor_qpa.h" -#include #include #include -#include +#include +#include #include @@ -99,6 +99,18 @@ QPlatformCursor::QPlatformCursor(QPlatformScreen *scr ) QPlatformCursorPrivate::instances.append(this); } +QPoint QPlatformCursor::pos() const +{ + // As a fallback return the last mouse position seen by QGuiApplication. + return QGuiApplicationPrivate::lastCursorPosition.toPoint(); +} + +void QPlatformCursor::setPos(const QPoint &pos) +{ + Q_UNUSED(pos); + qWarning("This plugin does not support QCursor::setPos()"); +} + // End of display and pointer event handling code // Beginning of built-in cursor graphics // from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp @@ -566,7 +578,7 @@ void QPlatformCursorImage::set(const uchar *data, const uchar *mask, if (!width || !height || !data || !mask || cursorImage.isNull()) return; - cursorImage.setNumColors(3); + cursorImage.setColorCount(3); cursorImage.setColor(0, 0xff000000); cursorImage.setColor(1, 0xffffffff); cursorImage.setColor(2, 0x00000000); diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h index 852a369b36f..af40c7d1c0e 100644 --- a/src/gui/kernel/qplatformcursor_qpa.h +++ b/src/gui/kernel/qplatformcursor_qpa.h @@ -73,7 +73,7 @@ private: class QPlatformCursor; -class QPlatformCursorPrivate { +class Q_GUI_EXPORT QPlatformCursorPrivate { public: static QList > getInstances() { return instances; } static QList > instances; @@ -85,7 +85,9 @@ public: // input methods virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); } - virtual void changeCursor(QCursor * widgetCursor, QWidget * widget) = 0; + virtual void changeCursor(QCursor * widgetCursor, QWindow * widget) = 0; + virtual QPoint pos() const; + virtual void setPos(const QPoint &pos); protected: QPlatformScreen* screen; // Where to request an update diff --git a/src/gui/embedded/qmousedriverfactory_qws.h b/src/gui/kernel/qplatformdrag_qpa.h similarity index 82% rename from src/gui/embedded/qmousedriverfactory_qws.h rename to src/gui/kernel/qplatformdrag_qpa.h index 1bc1ffefba3..eac17ed2a6b 100644 --- a/src/gui/embedded/qmousedriverfactory_qws.h +++ b/src/gui/kernel/qplatformdrag_qpa.h @@ -39,29 +39,29 @@ ** ****************************************************************************/ -#ifndef QMOUSEDRIVERFACTORY_QWS_H -#define QMOUSEDRIVERFACTORY_QWS_H +#ifndef QPLATFORMDRAG_H +#define QPLATFORMDRAG_H -#include - -QT_BEGIN_HEADER +#include QT_BEGIN_NAMESPACE -QT_MODULE(Gui) +class QMimeData; +class QMouseEvent; -class QString; -class QWSMouseHandler; - -class Q_GUI_EXPORT QMouseDriverFactory +class QPlatformDrag { public: - static QStringList keys(); - static QWSMouseHandler *create(const QString&, const QString &); + virtual ~QPlatformDrag() {} + + virtual QMimeData *platformDropData() = 0; + + virtual void startDrag() {}; + virtual void move(const QMouseEvent *me) = 0; + virtual void drop(const QMouseEvent *me) = 0; + virtual void cancel() = 0; }; QT_END_NAMESPACE -QT_END_HEADER - -#endif // QMOUSEDRIVERFACTORY_QWS_H +#endif diff --git a/src/gui/kernel/qplatformeventloopintegration_qpa.cpp b/src/gui/kernel/qplatformeventloopintegration_qpa.cpp deleted file mode 100644 index a79b03eee4e..00000000000 --- a/src/gui/kernel/qplatformeventloopintegration_qpa.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformeventloopintegration_qpa.h" - -#include - -#include - -class QPlatformEventLoopIntegrationPrivate -{ -public: - QPlatformEventLoopIntegrationPrivate(); - qint64 nextTimerEvent; -}; - -QPlatformEventLoopIntegrationPrivate::QPlatformEventLoopIntegrationPrivate() - : nextTimerEvent(0) -{ -} - -QPlatformEventLoopIntegration::QPlatformEventLoopIntegration() - : d_ptr(new QPlatformEventLoopIntegrationPrivate) - -{ -} - -QPlatformEventLoopIntegration::~QPlatformEventLoopIntegration() -{ -} - -qint64 QPlatformEventLoopIntegration::nextTimerEvent() const -{ - Q_D(const QPlatformEventLoopIntegration); - return d->nextTimerEvent; -} - - -void QPlatformEventLoopIntegration::setNextTimerEvent(qint64 nextTimerEvent) -{ - Q_D(QPlatformEventLoopIntegration); - d->nextTimerEvent = nextTimerEvent; -} - -void QPlatformEventLoopIntegration::processEvents() -{ - QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); -} diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp deleted file mode 100644 index b0c6aeb27a1..00000000000 --- a/src/gui/kernel/qplatformglcontext_qpa.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformglcontext_qpa.h" - -#include -#include - -#include - -class QPlatformGLThreadContext -{ -public: - ~QPlatformGLThreadContext() { - if (context) - context->doneCurrent(); - } - QPlatformGLContext *context; -}; - -static QThreadStorage qplatformgl_context_storage; - -class QPlatformGLContextPrivate -{ -public: - QPlatformGLContextPrivate() - : qGLContextHandle(0) - , qGLContextDeleteFunction(0) - { - } - - virtual ~QPlatformGLContextPrivate() - { - //do not delete the QGLContext handle here as it is deleted in - //QWidgetPrivate::deleteTLSysExtra() - } - void *qGLContextHandle; - void (*qGLContextDeleteFunction)(void *handle); - static QPlatformGLContext *staticSharedContext; - - static void setCurrentContext(QPlatformGLContext *context); -}; - -QPlatformGLContext *QPlatformGLContextPrivate::staticSharedContext = 0; - -void QPlatformGLContextPrivate::setCurrentContext(QPlatformGLContext *context) -{ - QPlatformGLThreadContext *threadContext = qplatformgl_context_storage.localData(); - if (!threadContext) { - if (!QThread::currentThread()) { - qWarning("No QTLS available. currentContext wont work"); - return; - } - threadContext = new QPlatformGLThreadContext; - qplatformgl_context_storage.setLocalData(threadContext); - } - threadContext->context = context; -} - -/*! - Returns the last context which called makeCurrent. This function is thread aware. -*/ -const QPlatformGLContext* QPlatformGLContext::currentContext() -{ - QPlatformGLThreadContext *threadContext = qplatformgl_context_storage.localData(); - if(threadContext) { - return threadContext->context; - } - return 0; -} - -/*! - All subclasses needs to specify the platformWindow. It can be a null window. -*/ -QPlatformGLContext::QPlatformGLContext() - :d_ptr(new QPlatformGLContextPrivate()) -{ -} - -/*! - If this is the current context for the thread, doneCurrent is called -*/ -QPlatformGLContext::~QPlatformGLContext() -{ - if (QPlatformGLContext::currentContext() == this) { - doneCurrent(); - } - -} - -/*! - Reimplement in subclass to do makeCurrent on native GL context -*/ -void QPlatformGLContext::makeCurrent() -{ - QPlatformGLContextPrivate::setCurrentContext(this); -} - -/*! - Reimplement in subclass to release current context. - Typically this is calling makeCurrent with 0 "surface" -*/ -void QPlatformGLContext::doneCurrent() -{ - QPlatformGLContextPrivate::setCurrentContext(0); -} - -/* - internal: Needs to have a pointer to qGLContext. But since this is in QtGui we cant - have any type information. -*/ -void *QPlatformGLContext::qGLContextHandle() const -{ - Q_D(const QPlatformGLContext); - return d->qGLContextHandle; -} - -void QPlatformGLContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *)) -{ - Q_D(QPlatformGLContext); - d->qGLContextHandle = handle; - d->qGLContextDeleteFunction = qGLContextDeleteFunction; -} - -void QPlatformGLContext::deleteQGLContext() -{ - Q_D(QPlatformGLContext); - if (d->qGLContextDeleteFunction && d->qGLContextHandle) { - d->qGLContextDeleteFunction(d->qGLContextHandle); - d->qGLContextDeleteFunction = 0; - d->qGLContextHandle = 0; - } -} - -/*! - \class QPlatformGLContext - \since 4.8 - \internal - \preliminary - \ingroup qpa - - \brief The QPlatformGLContext class provides an abstraction for native GL contexts. - - In QPA the way to support OpenGL or OpenVG or other technologies that requires a native GL - context is through the QPlatformGLContext wrapper. - - There is no factory function for QPlatformGLContexts, but rather only one accessor function. - The only place to retrieve a QPlatformGLContext from is through a QPlatformWindow. - - The context which is current for a specific thread can be collected by the currentContext() - function. This is how QPlatformGLContext also makes it possible to use the QtOpenGL module - withhout using QGLWidget. When using QGLContext::currentContext(), it will ask - QPlatformGLContext for the currentContext. Then a corresponding QGLContext will be returned, - which maps to the QPlatformGLContext. -*/ - -/*! \fn void QPlatformGLContext::swapBuffers() - Reimplement in subclass to native swap buffers calls -*/ - -/*! \fn void *QPlatformGLContext::getProcAddress(const QString &procName) - Reimplement in subclass to native getProcAddr calls. - - Note: its convenient to use qPrintable(const QString &str) to get the const char * pointer -*/ - -/*! \fn QPlatformWindowFormat QPlatformGLContext::platformWindowFormat() const - QWidget has the function qplatformWindowFormat(). That function is for the application - programmer to request the format of the window and the context that he wants. - - Reimplement this function in a subclass to indicate what format the glContext actually has. -*/ diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h deleted file mode 100644 index 1e64f4a781e..00000000000 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORM_GL_CONTEXT_H -#define QPLATFORM_GL_CONTEXT_H - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QPlatformGLContextPrivate; - -class Q_OPENGL_EXPORT QPlatformGLContext -{ -Q_DECLARE_PRIVATE(QPlatformGLContext); - -public: - explicit QPlatformGLContext(); - virtual ~QPlatformGLContext(); - - virtual void makeCurrent(); - virtual void doneCurrent(); - virtual void swapBuffers() = 0; - virtual void* getProcAddress(const QString& procName) = 0; - - virtual QPlatformWindowFormat platformWindowFormat() const = 0; - - const static QPlatformGLContext *currentContext(); - -protected: - QScopedPointer d_ptr; - -private: - //hack to make it work with QGLContext::CurrentContext - friend class QGLContext; - friend class QWidgetPrivate; - void *qGLContextHandle() const; - void setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *)); - void deleteQGLContext(); - Q_DISABLE_COPY(QPlatformGLContext); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - - -#endif // QPLATFORM_GL_INTEGRATION_P_H diff --git a/src/gui/embedded/qscreendriverplugin_qws.h b/src/gui/kernel/qplatforminputcontext_qpa.cpp similarity index 63% rename from src/gui/embedded/qscreendriverplugin_qws.h rename to src/gui/kernel/qplatforminputcontext_qpa.cpp index c880adfa720..0fdcd9e9acd 100644 --- a/src/gui/embedded/qscreendriverplugin_qws.h +++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp @@ -39,46 +39,64 @@ ** ****************************************************************************/ -#ifndef QSCREENDRIVERPLUGIN_QWS_H -#define QSCREENDRIVERPLUGIN_QWS_H - -#include -#include - -QT_BEGIN_HEADER +#include +#include +#include QT_BEGIN_NAMESPACE -QT_MODULE(Gui) - -#ifndef QT_NO_LIBRARY - -class QScreen; - -struct Q_GUI_EXPORT QScreenDriverFactoryInterface : public QFactoryInterface +QPlatformInputContext::QPlatformInputContext() { - virtual QScreen* create(const QString& driver, int displayId) = 0; -}; +} -#define QScreenDriverFactoryInterface_iid "com.trolltech.Qt.QScreenDriverFactoryInterface" -Q_DECLARE_INTERFACE(QScreenDriverFactoryInterface, QScreenDriverFactoryInterface_iid) - -class Q_GUI_EXPORT QScreenDriverPlugin : public QObject, public QScreenDriverFactoryInterface +QPlatformInputContext::~QPlatformInputContext() { - Q_OBJECT - Q_INTERFACES(QScreenDriverFactoryInterface:QFactoryInterface) -public: - explicit QScreenDriverPlugin(QObject *parent = 0); - ~QScreenDriverPlugin(); +} - virtual QStringList keys() const = 0; - virtual QScreen *create(const QString& driver, int displayId) = 0; -}; +bool QPlatformInputContext::isValid() const +{ + return false; +} + +void QPlatformInputContext::reset() +{ +} + +void QPlatformInputContext::commit() +{ +} + +void QPlatformInputContext::update(Qt::InputMethodQueries) +{ +} + +void QPlatformInputContext::invokeAction(QInputPanel::Action action, int cursorPosition) +{ + // Default behavior for simple ephemeral input contexts. Some + // complex input contexts should not be reset here. + if (action == QInputPanel::Click) + reset(); +} + +QRectF QPlatformInputContext::keyboardRect() const +{ + return QRectF(); +} + +void QPlatformInputContext::emitKeyboardRectChanged() const +{ + emit qApp->inputPanel()->keyboardRectangleChanged(); +} + +bool QPlatformInputContext::isAnimating() +{ + return false; +} + +void QPlatformInputContext::emitAnimatingChanged() +{ + emit qApp->inputPanel()->animatingChanged(); +} -#endif // QT_NO_LIBRARY QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSCREENDRIVERPLUGIN_QWS_H diff --git a/src/gui/embedded/qkbdvfb_qws.h b/src/gui/kernel/qplatforminputcontext_qpa.h similarity index 74% rename from src/gui/embedded/qkbdvfb_qws.h rename to src/gui/kernel/qplatforminputcontext_qpa.h index 620905818e5..35763edf131 100644 --- a/src/gui/embedded/qkbdvfb_qws.h +++ b/src/gui/kernel/qplatforminputcontext_qpa.h @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#ifndef QKBDVFB_QWS_H -#define QKBDVFB_QWS_H +#ifndef QPLATFORMINPUTCONTEXT_H +#define QPLATFORMINPUTCONTEXT_H -#include +#include QT_BEGIN_HEADER @@ -50,37 +50,32 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifndef QT_NO_QWS_KEYBOARD +class QWindow; +class QMouseEvent; -#ifndef QT_NO_QWS_KBD_QVFB - -class QSocketNotifier; - -class QVFbKeyboardHandler : public QObject, public QWSKeyboardHandler +class Q_GUI_EXPORT QPlatformInputContext : public QObject { Q_OBJECT public: - QVFbKeyboardHandler(const QString &device); - virtual ~QVFbKeyboardHandler(); + QPlatformInputContext(); + virtual ~QPlatformInputContext(); -private Q_SLOTS: - void readKeyboardData(); + virtual bool isValid() const; -private: - QString terminalName; - int kbdFD; - int kbdIdx; - int kbdBufferLen; - unsigned char *kbdBuffer; - QSocketNotifier *notifier; + virtual void reset(); + virtual void commit(); + virtual void update(Qt::InputMethodQueries); + virtual void invokeAction(QInputPanel::Action, int cursorPosition); + + virtual QRectF keyboardRect() const; + void emitKeyboardRectChanged() const; + + virtual bool isAnimating(); + void emitAnimatingChanged(); }; -#endif // QT_NO_QWS_KBD_QVFB - -#endif // QT_NO_QWS_KEYBOARD - QT_END_NAMESPACE QT_END_HEADER -#endif // QKBDVFB_QWS_H +#endif // QPLATFORMINPUTCONTEXT_H diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 29287fe71cf..856ceab87ce 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -43,33 +43,14 @@ #include #include +#include +#include +#include QT_BEGIN_NAMESPACE -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(); -} - /*! - Factory function for the eventloop integration interface. - - Default implementation returns 0, which causes the eventloop to run in a single thread mode. - - \sa QPlatformEventLoopIntegration -*/ -QPlatformEventLoopIntegration *QPlatformIntegration::createEventLoopIntegration() const -{ - return 0; -} - -/*! - Accessor for the platform integrations fontdatabase. + Accessor for the platform integration's fontdatabase. Default implementation returns a default QPlatformFontDatabase. @@ -85,7 +66,7 @@ QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const } /*! - Accessor for the platform integrations clipboard. + Accessor for the platform integration's clipboard. Default implementation returns a default QPlatformClipboard. @@ -106,6 +87,19 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const #endif +#ifndef QT_NO_DRAGANDDROP +/*! + Accessor for the platform integration's drag object. + + Default implementation returns 0, implying no drag and drop support. + +*/ +QPlatformDrag *QPlatformIntegration::drag() const +{ + return 0; +} +#endif + QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const { return 0; @@ -123,12 +117,12 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const using the QPA platform. It has factory functions for creating platform specific pixmaps and windows. The class also controls the font subsystem. - QPlatformIntegration is a singelton class which gets instansiated in the QApplication + QPlatformIntegration is a singleton class which gets instantiated in the QGuiApplication constructor. The QPlatformIntegration instance do not have ownership of objects it creates in functions where the name starts with create. However, functions which don't have a name - starting with create acts as assessors to member variables. + starting with create acts as accessors to member variables. - It is not trivial to create or build a platform plugin outside of the Qt source tree. Therefor + It is not trivial to create or build a platform plugin outside of the Qt source tree. Therefore the recommended approach for making new platform plugin is to copy an existing plugin inside the QTSRCTREE/src/plugins/platform and develop the plugin inside the source tree. @@ -138,88 +132,131 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const */ /*! - \fn QPixmapData *QPlatformIntegration::createPixmapData(QPixmapData::PixelType type) const + \fn QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const - Factory function for QPixmapData. PixelType can be either PixmapType or BitmapType. - \sa QPixmapData + Factory function for QPlatformPixmap. PixelType can be either PixmapType or BitmapType. + \sa QPlatformPixmap */ /*! - \fn QPlatformWindow *QPlatformIntegration::createPlatformWindow(QWidget *widget, WId winId = 0) const + \fn QPlatformWindow *QPlatformIntegration::createPlatformWindow(QWindow *window) const - Factory function for QPlatformWindow. The widget parameter is a pointer to the top level - widget(tlw) which the QPlatformWindow is suppose to be created for. The WId handle is actually - never used, but there for future reference. Its purpose is if it is going to be possible to - create QPlatformWindows on existing WId. + Factory function for QPlatformWindow. The \a window parameter is a pointer to the top level + window which the QPlatformWindow is supposed to be created for. - All tlw has to have a QPlatformWindow, and it will be created when the QPlatformWindow is set - to be visible for the first time. If the tlw's window flags are changed, or if the tlw's - QPlatformWindowFormat is changed, then the tlw's QPlatformWindow is deleted and a new one is - created. + All top level windows have to have a QPlatformWindow, and it will be created when the + QPlatformWindow is set to be visible for the first time. If the top level window's flags are + changed, or if the top level window's QPlatformWindowFormat is changed, then the top level + window's QPlatformWindow is deleted and a new one is created. + + In the constructor, of the QPlatformWindow, the window flags, state, title and geometry + of the \a window should be applied to the underlying window. If the resulting flags or state + differs, the resulting values should be set on the \a window using QWindow::setWindowFlags() + or QWindow::setWindowState(), respectively. \sa QPlatformWindow, QPlatformWindowFormat - \sa createWindowSurface(QWidget *widget, WId winId) const + \sa createPlatformBackingStore(QWindow *window) const */ /*! - \fn QWindowSurface *QPlatformIntegration::createWindowSurface(QWidget *widget, WId winId) const + \fn QPlatformBackingStore *QPlatformIntegration::createPlatformBackingStore(QWindow *window) const - Factory function for QWindowSurface. The QWidget parameter is a pointer to the + Factory function for QPlatformBackingStore. The QWindow parameter is a pointer to the top level widget(tlw) the window surface is created for. A QPlatformWindow is always created - before the QWindowSurface for tlw where the widget also requires a WindowSurface. It is - possible to create top level QWidgets without a QWindowSurface by specifying - QPlatformWindowFormat::setWindowSurface(false) for the tlw QPlatformWindowFormat. + before the QPlatformBackingStore for tlw where the widget also requires a backing store. - \sa QWindowSurface - \sa createPlatformWindow(QWidget *widget, WId winId = 0) const + \sa QBackingStore + \sa createPlatformWindow(QWindow *window, WId winId = 0) const */ /*! - \fn void QPlatformIntegration::moveToScreen(QWidget *window, int screen) - This function is called when a QWidget is displayed on screen, or the QWidget is to be - displayed on a new screen. The QWidget parameter is a pointer to the top level widget and - the int parameter is the index to the screen in QList screens() const. + \fn QAbstractEventDispatcher *guiThreadEventDispatcher() const = 0 - Default implementation does nothing. - - \sa screens() const + Accessor function for the event dispatcher. The platform plugin should create + an instance of the QAbstractEventDispatcher in its constructor and set it + on the application using QGuiApplicationPrivate::instance()->setEventDispatcher(). + The event dispatcher is owned by QGuiApplication, the accessor should return + a flat pointer. + \sa QGuiApplicationPrivate */ -/*! - \fn QList QPlatformIntegration::screens() const - - Accessor function to a list of all the screens on the current system. The screen with the - index == 0 is the default/main screen. -*/ - -/*! - \fn bool QPlatformIntegration::isVirtualDesktop() - - Returns if the current windowing system configuration defines all the screens to be one - desktop(virtual desktop), or if each screen is a desktop of its own. - - Default implementation returns false. -*/ - -/*! - \fn QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const - - This function is called when Qt needs to be able to grab the content of a window. - - Returnes the content of the window specified with the WId handle within the boundaries of - QRect(x,y,width,height). -*/ - - bool QPlatformIntegration::hasCapability(Capability cap) const { Q_UNUSED(cap); return false; } +QPlatformPixmap *QPlatformIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const +{ + return new QRasterPlatformPixmap(type); +} +QPlatformOpenGLContext *QPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const +{ + Q_UNUSED(context); + qWarning("This plugin does not support createPlatformOpenGLContext!"); + return 0; +} +/*! + Returns the platforms input context. + The default implementation returns 0, implying no input method support. +*/ +QPlatformInputContext *QPlatformIntegration::inputContext() const +{ + return 0; +} + +QVariant QPlatformIntegration::styleHint(StyleHint hint) const +{ + switch (hint) { + case CursorFlashTime: + return 1000; + case KeyboardInputInterval: + return 400; + case MouseDoubleClickInterval: + return 400; + case StartDragDistance: + return 10; + case StartDragTime: + return 500; + } + + return 0; +} + +QPlatformMenu *QPlatformIntegration::createPlatformMenu(QMenu *menu) const +{ + Q_UNUSED(menu); + return 0; +} + +QPlatformMenuBar *QPlatformIntegration::createPlatformMenuBar(QMenuBar *menuBar) const +{ + Q_UNUSED(menuBar); + return 0; +} + +/*! + Should be called by the implementation whenever a new screen is added. + + The first screen added will be the primary screen, used for default-created + windows, GL contexts, and other resources unless otherwise specified. + + This adds the screen to QGuiApplication::screens(), and emits the + QGuiApplication::screenAdded() signal. + + The screen is automatically removed when the QPlatformScreen is destroyed. +*/ +void QPlatformIntegration::screenAdded(QPlatformScreen *ps) +{ + QScreen *screen = ps ? ps->screen() : 0; + if (screen && !QGuiApplicationPrivate::screen_list.contains(screen)) { + QGuiApplicationPrivate::screen_list << screen; + emit qGuiApp->screenAdded(screen); + } +} QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 74d2342314f..b9e1d025527 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -43,9 +43,8 @@ #define QPLATFORMINTEGRATION_H #include -#include -#include #include +#include QT_BEGIN_HEADER @@ -54,50 +53,70 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QPlatformWindow; -class QWindowSurface; -class QBlittable; -class QWidget; -class QPlatformEventLoopIntegration; +class QWindow; +class QPlatformBackingStore; class QPlatformFontDatabase; class QPlatformClipboard; class QPlatformNativeInterface; +class QPlatformDrag; +class QPlatformOpenGLContext; +class QGuiGLFormat; +class QAbstractEventDispatcher; +class QPlatformInputContext; +class QMenu; +class QMenuBar; +class QPlatformMenu; +class QPlatformMenuBar; class Q_GUI_EXPORT QPlatformIntegration { public: enum Capability { ThreadedPixmaps = 1, - OpenGL = 2 + OpenGL = 2, + ThreadedOpenGL = 3 }; virtual ~QPlatformIntegration() { } virtual bool hasCapability(Capability cap) const; -// 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 QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; + virtual QPlatformWindow *createPlatformWindow(QWindow *window) const = 0; + virtual QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const = 0; + virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; -// Window System functions - virtual QList screens() const = 0; - virtual void moveToScreen(QWidget *window, int screen) {Q_UNUSED(window); Q_UNUSED(screen);} - virtual bool isVirtualDesktop() { return false; } - virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; +// Event dispatcher: + virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const = 0; //Deeper window system integrations virtual QPlatformFontDatabase *fontDatabase() const; #ifndef QT_NO_CLIPBOARD virtual QPlatformClipboard *clipboard() const; #endif +#ifndef QT_NO_DRAGANDDROP + virtual QPlatformDrag *drag() const; +#endif + virtual QPlatformInputContext *inputContext() 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. - virtual QPlatformEventLoopIntegration *createEventLoopIntegration() const; + virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const; + virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const; // Access native handles. The window handle is already available from Wid; virtual QPlatformNativeInterface *nativeInterface() const; + + enum StyleHint { + CursorFlashTime, + KeyboardInputInterval, + MouseDoubleClickInterval, + StartDragDistance, + StartDragTime + }; + + virtual QVariant styleHint(StyleHint hint) const; + +protected: + void screenAdded(QPlatformScreen *screen); }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp index a2d1c36882b..c40494c4087 100644 --- a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp +++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp @@ -44,7 +44,7 @@ #include "private/qfactoryloader_p.h" #include "qmutex.h" -#include "qapplication.h" +#include "qguiapplication.h" #include "qdebug.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp index e3f6689acc4..7b9ff4a7a58 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -43,10 +43,24 @@ QT_BEGIN_NAMESPACE -void *QPlatformNativeInterface::nativeResourceForWidget(const QByteArray &resource, QWidget *widget) +void *QPlatformNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window) { Q_UNUSED(resource); - Q_UNUSED(widget); + Q_UNUSED(window); + return 0; +} + +void *QPlatformNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) +{ + Q_UNUSED(resource); + Q_UNUSED(context); + return 0; +} + +void * QPlatformNativeInterface::nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) +{ + Q_UNUSED(resource); + Q_UNUSED(backingStore); return 0; } diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h index dd57f94a889..bfcf78813b9 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.h +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -52,14 +52,18 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class QWidget; +class QOpenGLContext; +class QWindow; class QPlatformWindow; +class QBackingStore; class Q_GUI_EXPORT QPlatformNativeInterface : public QObject { Q_OBJECT public: - virtual void *nativeResourceForWidget(const QByteArray &resource, QWidget *widget); + virtual void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context); + virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); + virtual void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore); virtual QVariantMap windowProperties(QPlatformWindow *window) const; virtual QVariant windowProperty(QPlatformWindow *window, const QString &name) const; @@ -68,7 +72,6 @@ public: Q_SIGNALS: void windowPropertyChanged(QPlatformWindow *window, const QString &propertyName); - }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.cpp b/src/gui/kernel/qplatformopenglcontext_qpa.cpp new file mode 100644 index 00000000000..2957b4db4b5 --- /dev/null +++ b/src/gui/kernel/qplatformopenglcontext_qpa.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformopenglcontext_qpa.h" + +/*! + \class QPlatformOpenGLContext + \since 4.8 + \internal + \preliminary + \ingroup qpa + + \brief The QPlatformOpenGLContext class provides an abstraction for native GL contexts. + + In QPA the way to support OpenGL or OpenVG or other technologies that requires a native GL + context is through the QPlatformOpenGLContext wrapper. + + There is no factory function for QPlatformOpenGLContexts, but rather only one accessor function. + The only place to retrieve a QPlatformOpenGLContext from is through a QPlatformWindow. + + The context which is current for a specific thread can be collected by the currentContext() + function. This is how QPlatformOpenGLContext also makes it possible to use the QtGui module + withhout using QOpenGLWidget. When using QOpenGLContext::currentContext(), it will ask + QPlatformOpenGLContext for the currentContext. Then a corresponding QOpenGLContext will be returned, + which maps to the QPlatformOpenGLContext. +*/ + +/*! \fn void QPlatformOpenGLContext::swapBuffers() + Reimplement in subclass to native swap buffers calls + + The implementation must support being called in a thread different than the gui-thread. +*/ + +/*! \fn void *QPlatformOpenGLContext::getProcAddress(const QString &procName) + Reimplement in subclass to native getProcAddr calls. + + Note: its convenient to use qPrintable(const QString &str) to get the const char * pointer +*/ + +/*! \fn QPlatformWindowFormat QPlatformOpenGLContext::platformWindowFormat() const + QWidget has the function qplatformWindowFormat(). That function is for the application + programmer to request the format of the window and the context that he wants. + + Reimplement this function in a subclass to indicate what format the glContext actually has. +*/ + +struct QPlatformOpenGLContextPrivate +{ + QOpenGLContext *context; +}; + +QPlatformOpenGLContext::QPlatformOpenGLContext() + : d_ptr(new QPlatformOpenGLContextPrivate) +{ + Q_D(QPlatformOpenGLContext); + d->context = 0; +} + +QPlatformOpenGLContext::~QPlatformOpenGLContext() +{ +} + +QOpenGLContext *QPlatformOpenGLContext::context() const +{ + Q_D(const QPlatformOpenGLContext); + return d->context; +} + +void QPlatformOpenGLContext::setContext(QOpenGLContext *context) +{ + Q_D(QPlatformOpenGLContext); + d->context = context; +} diff --git a/src/gui/embedded/qkbdlinuxinput_qws.h b/src/gui/kernel/qplatformopenglcontext_qpa.h similarity index 67% rename from src/gui/embedded/qkbdlinuxinput_qws.h rename to src/gui/kernel/qplatformopenglcontext_qpa.h index cfc4bd6253c..6fb8da25c1a 100644 --- a/src/gui/embedded/qkbdlinuxinput_qws.h +++ b/src/gui/kernel/qplatformopenglcontext_qpa.h @@ -39,10 +39,12 @@ ** ****************************************************************************/ -#ifndef QKBDLINUXINPUT_QWS_H -#define QKBDLINUXINPUT_QWS_H +#ifndef QPLATFORMGLCONTEXT_H +#define QPLATFORMGLCONTEXT_H -#include +#include +#include +#include QT_BEGIN_HEADER @@ -50,30 +52,39 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifndef QT_NO_QWS_KEYBOARD +class QPlatformOpenGLContextPrivate; -#ifndef QT_NO_QWS_KBD_LINUXINPUT - -class QWSLinuxInputKbPrivate; - -class QWSLinuxInputKeyboardHandler : public QWSKeyboardHandler +class Q_GUI_EXPORT QPlatformOpenGLContext { + Q_DECLARE_PRIVATE(QPlatformOpenGLContext) public: - QWSLinuxInputKeyboardHandler(const QString&); - virtual ~QWSLinuxInputKeyboardHandler(); + QPlatformOpenGLContext(); + virtual ~QPlatformOpenGLContext(); - virtual bool filterInputEvent(quint16 &input_code, qint32 &input_value); + virtual QSurfaceFormat format() const = 0; + + virtual void swapBuffers(QPlatformSurface *surface) = 0; + + virtual bool makeCurrent(QPlatformSurface *surface) = 0; + virtual void doneCurrent() = 0; + + virtual void (*getProcAddress(const QByteArray &procName)) () = 0; + + QOpenGLContext *context() const; private: - QWSLinuxInputKbPrivate *d; + friend class QOpenGLContext; + + QScopedPointer d_ptr; + + void setContext(QOpenGLContext *context); + + Q_DISABLE_COPY(QPlatformOpenGLContext) }; -#endif // QT_NO_QWS_KBD_LINUXINPUT - -#endif // QT_NO_QWS_KEYBOARD - QT_END_NAMESPACE QT_END_HEADER -#endif // QKBDLINUXINPUT_QWS_H + +#endif // QPLATFORMGLCONTEXT_H diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp index 2a1e7e4b9ac..8fb42595b81 100644 --- a/src/gui/kernel/qplatformscreen_qpa.cpp +++ b/src/gui/kernel/qplatformscreen_qpa.cpp @@ -40,32 +40,89 @@ ****************************************************************************/ #include "qplatformscreen_qpa.h" -#include -#include -#include +#include +#include #include -#include -#include +#include +#include + +class QPlatformScreenPrivate +{ +public: + QScreen *screen; +}; + +QPlatformScreen::QPlatformScreen() + : d_ptr(new QPlatformScreenPrivate) +{ + Q_D(QPlatformScreen); + d->screen = new QScreen(this); +} + +QPlatformScreen::~QPlatformScreen() +{ + Q_D(QPlatformScreen); + + QGuiApplicationPrivate::screen_list.removeOne(d->screen); + delete d->screen; +} /*! - Return the given top level widget for a given position. + \fn QPixmap QPlatformScreen::grabWindow(WId window, int x, int y, int width, int height) const - Default implementation retrieves a list of all top level widgets and finds the first widget + This function is called when Qt needs to be able to grab the content of a window. + + Returnes the content of the window specified with the WId handle within the boundaries of + QRect(x,y,width,height). +*/ +QPixmap QPlatformScreen::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(); +} + +/*! + Return the given top level window for a given position. + + Default implementation retrieves a list of all top level windows and finds the first window which contains point \a pos */ -QWidget *QPlatformScreen::topLevelAt(const QPoint & pos) const +QWindow *QPlatformScreen::topLevelAt(const QPoint & pos) const { - QWidgetList list = QApplication::topLevelWidgets(); + QWindowList list = QGuiApplication::topLevelWindows(); 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)) + QWindow *w = list[i]; + if (w->visible() && w->geometry().contains(pos)) return w; } return 0; } +/*! + Returns a list of all the platform screens that are part of the same + virtual desktop. + + Screens part of the same virtual desktop share a common coordinate system, + and windows can be freely moved between them. +*/ +QList QPlatformScreen::virtualSiblings() const +{ + QList list; + list << const_cast(this); + return list; +} + +QScreen *QPlatformScreen::screen() const +{ + Q_D(const QPlatformScreen); + return d->screen; +} + /*! Reimplement this function in subclass to return the physical size of the screen. This function is used by QFont to convert point sizes to pixel @@ -84,15 +141,9 @@ QSize QPlatformScreen::physicalSize() const return QSize(width,height); } -Q_GUI_EXPORT extern QWidgetPrivate *qt_widget_private(QWidget *widget); -QPlatformScreen * QPlatformScreen::platformScreenForWidget(const QWidget *widget) +QPlatformScreen * QPlatformScreen::platformScreenForWindow(const QWindow *window) { - QWidget *window = widget->window(); - QWidgetPrivate *windowPrivate = qt_widget_private(window); - QTLWExtra * topData = windowPrivate->topData(); - QPlatformIntegration *integration = - QApplicationPrivate::platformIntegration(); - return integration->screens()[topData->screenIndex]; + return window->screen()->handle(); } /*! diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h index a9ce7c29e38..3851b1821a2 100644 --- a/src/gui/kernel/qplatformscreen_qpa.h +++ b/src/gui/kernel/qplatformscreen_qpa.h @@ -51,7 +51,8 @@ #include #include -#include +#include +#include QT_BEGIN_HEADER @@ -59,24 +60,46 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QPlatformScreen : public QObject +class QPlatformBackingStore; +class QPlatformOpenGLContext; +class QPlatformScreenPrivate; +class QPlatformWindow; +class QScreen; +class QSurfaceFormat; + +class Q_GUI_EXPORT QPlatformScreen { - Q_OBJECT + Q_DECLARE_PRIVATE(QPlatformScreen) + public: - virtual ~QPlatformScreen() { } + QPlatformScreen(); + virtual ~QPlatformScreen(); + + virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; 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; - //jl: should setDirty be removed. - virtual void setDirty(const QRect &) {} - virtual QWidget *topLevelAt(const QPoint &point) const; + + virtual QWindow *topLevelAt(const QPoint &point) const; + virtual QList virtualSiblings() const; + + QScreen *screen() const; //jl: should this function be in QPlatformIntegration - //jl: maybe screenForWidget is a better name? - static QPlatformScreen *platformScreenForWidget(const QWidget *widget); + //jl: maybe screenForWindow is a better name? + static QPlatformScreen *platformScreenForWindow(const QWindow *window); + + virtual QString name() const { return QString(); } + +protected: + QScopedPointer d_ptr; + +private: + Q_DISABLE_COPY(QPlatformScreen) }; QT_END_NAMESPACE diff --git a/src/gui/painting/qwmatrix.h b/src/gui/kernel/qplatformsurface_qpa.cpp similarity index 89% rename from src/gui/painting/qwmatrix.h rename to src/gui/kernel/qplatformsurface_qpa.cpp index 914d574f905..dcfd201ea34 100644 --- a/src/gui/painting/qwmatrix.h +++ b/src/gui/kernel/qplatformsurface_qpa.cpp @@ -39,23 +39,18 @@ ** ****************************************************************************/ -#ifndef QWMATRIX_H -#define QWMATRIX_H - -#include - -QT_BEGIN_HEADER +#include "qplatformsurface_qpa.h" QT_BEGIN_NAMESPACE -QT_MODULE(Gui) +QSurface::SurfaceType QPlatformSurface::surfaceType() const +{ + return m_type; +} -#if defined(QT3_SUPPORT) -typedef QMatrix QWMatrix; -#endif +QPlatformSurface::QPlatformSurface(QSurface::SurfaceType type) : m_type(type) +{ +} QT_END_NAMESPACE -QT_END_HEADER - -#endif // QWMATRIX_H diff --git a/src/gui/embedded/qkbdum_qws.h b/src/gui/kernel/qplatformsurface_qpa.h similarity index 81% rename from src/gui/embedded/qkbdum_qws.h rename to src/gui/kernel/qplatformsurface_qpa.h index dea26db833e..76b564de25f 100644 --- a/src/gui/embedded/qkbdum_qws.h +++ b/src/gui/kernel/qplatformsurface_qpa.h @@ -39,10 +39,12 @@ ** ****************************************************************************/ -#ifndef QKBDUM_QWS_H -#define QKBDUM_QWS_H +#ifndef QPLATFORMSURFACE_H +#define QPLATFORMSURFACE_H -#include +#include +#include +#include QT_BEGIN_HEADER @@ -50,28 +52,23 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifndef QT_NO_QWS_KEYBOARD - -#ifndef QT_NO_QWS_KBD_UM - -class QWSUmKeyboardHandlerPrivate; - -class QWSUmKeyboardHandler : public QWSKeyboardHandler +class Q_GUI_EXPORT QPlatformSurface { public: - QWSUmKeyboardHandler(const QString &); - virtual ~QWSUmKeyboardHandler(); + virtual QSurfaceFormat format() const = 0; + + QSurface::SurfaceType surfaceType() const; private: + QPlatformSurface(QSurface::SurfaceType type); - QWSUmKeyboardHandlerPrivate *d; + QSurface::SurfaceType m_type; + + friend class QPlatformWindow; }; -#endif // QT_NO_QWS_KBD_UM - -#endif // QT_NO_QWS_KEYBOARD QT_END_NAMESPACE QT_END_HEADER -#endif // QKBDUM_QWS_H +#endif //QPLATFORMSURFACE_H diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp index b1c66ea32b9..0734fb7a265 100644 --- a/src/gui/kernel/qplatformwindow_qpa.cpp +++ b/src/gui/kernel/qplatformwindow_qpa.cpp @@ -42,49 +42,76 @@ #include "qplatformwindow_qpa.h" #include -#include +#include +#include class QPlatformWindowPrivate { - QWidget *tlw; + QWindow *window; QRect rect; - Qt::WindowFlags flags; friend class QPlatformWindow; }; /*! - Constructs a platform window with the given top level widget. + Constructs a platform window with the given top level window. */ -QPlatformWindow::QPlatformWindow(QWidget *tlw) - : d_ptr(new QPlatformWindowPrivate) +QPlatformWindow::QPlatformWindow(QWindow *window) + : QPlatformSurface(QSurface::Window) + , d_ptr(new QPlatformWindowPrivate) { Q_D(QPlatformWindow); - d->tlw = tlw; - tlw->setPlatformWindow(this); + d->window = window; + d->rect = window->geometry(); } /*! - Virtual destructor does not delete its top level widget. + Virtual destructor does not delete its top level window. */ QPlatformWindow::~QPlatformWindow() { } /*! - Returnes the widget which belongs to the QPlatformWindow + Returns the window which belongs to the QPlatformWindow */ -QWidget *QPlatformWindow::widget() const +QWindow *QPlatformWindow::window() const { Q_D(const QPlatformWindow); - return d->tlw; + return d->window; +} + +/*! + Returns the parent platform window (or 0 if orphan). +*/ +QPlatformWindow *QPlatformWindow::parent() const +{ + Q_D(const QPlatformWindow); + return d->window->parent() ? d->window->parent()->handle() : 0; +} + +/*! + Returns the platform screen handle corresponding to this platform window. +*/ +QPlatformScreen *QPlatformWindow::screen() const +{ + Q_D(const QPlatformWindow); + return d->window->screen()->handle(); +} + +/*! + Returns the actual surface format of the window. +*/ +QSurfaceFormat QPlatformWindow::format() const +{ + return QSurfaceFormat(); } /*! This function is called by Qt whenever a window is moved or the window is resized. The resize can happen programatically(from ie. user application) or by the window manager. This means that there is no need to call this function specifically from the window manager callback, instead - call QWindowSystemInterface::handleGeometryChange(QWidget *w, const QRect &newRect); + call QWindowSystemInterface::handleGeometryChange(QWindow *w, const QRect &newRect); */ void QPlatformWindow::setGeometry(const QRect &rect) { @@ -101,6 +128,11 @@ QRect QPlatformWindow::geometry() const return d->rect; } +QMargins QPlatformWindow::frameMargins() const +{ + return QMargins(); +} + /*! Reimplemented in subclasses to show the surface if \a visible is \c true, and hide it if \a visible is \c false. @@ -115,18 +147,18 @@ void QPlatformWindow::setVisible(bool visible) */ Qt::WindowFlags QPlatformWindow::setWindowFlags(Qt::WindowFlags flags) { - Q_D(QPlatformWindow); - d->flags = flags; return flags; } /*! - Returns the effective window flags for this surface. + Requests setting the window state of this surface + to \a type. Returns the actual state set. + + Qt::WindowActive can be ignored. */ -Qt::WindowFlags QPlatformWindow::windowFlags() const +Qt::WindowState QPlatformWindow::setWindowState(Qt::WindowState) { - Q_D(const QPlatformWindow); - return d->flags; + return Qt::WindowNoState; } /*! @@ -135,7 +167,7 @@ Qt::WindowFlags QPlatformWindow::windowFlags() const WId QPlatformWindow::winId() const { return WId(0); } /*! - This function is called to enable native child widgets in QPA. It is common not to support this + This function is called to enable native child window in QPA. It is common not to support this feature in Window systems, but can be faked. When this function is called all geometry of this platform window will be relative to the parent. */ @@ -150,7 +182,7 @@ void QPlatformWindow::setParent(const QPlatformWindow *parent) /*! Reimplement to set the window title to \a title */ -void QPlatformWindow::setWindowTitle(const QString &) {} +void QPlatformWindow::setWindowTitle(const QString &title) { Q_UNUSED(title); } /*! Reimplement to be able to let Qt rais windows to the top of the desktop @@ -162,6 +194,14 @@ void QPlatformWindow::raise() { qWarning("This plugin does not support raise()") */ void QPlatformWindow::lower() { qWarning("This plugin does not support lower()"); } +/*! + Reimplement to propagate the size hints of the QWindow. + + The size hints include QWindow::minimumSize(), QWindow::maximumSize(), + QWindow::sizeIncrement(), and QWindow::baseSize(). +*/ +void QPlatformWindow::propagateSizeHints() {qWarning("This plugin does not support propagateSizeHints()"); } + /*! Reimplement to be able to let Qt set the opacity level of a window */ @@ -175,26 +215,32 @@ void QPlatformWindow::setOpacity(qreal level) Reimplement to let Qt be able to request activation/focus for a window Some window systems will probably not have callbacks for this functionality, - and then calling QWindowSystemInterface::handleWindowActivated(QWidget *w) + and then calling QWindowSystemInterface::handleWindowActivated(QWindow *w) would be sufficient. If the window system has some event handling/callbacks then call - QWindowSystemInterface::handleWindowActivated(QWidget *w) when the window system + QWindowSystemInterface::handleWindowActivated(QWindow *w) when the window system gives the notification. - Default implementation calls QWindowSystem::handleWindowActivated(QWidget *w) + Default implementation calls QWindowSystem::handleWindowActivated(QWindow *w) */ void QPlatformWindow::requestActivateWindow() { - QWindowSystemInterface::handleWindowActivated(widget()); + QWindowSystemInterface::handleWindowActivated(window()); } -/*! - Reimplement to return the glContext associated with the window. -*/ -QPlatformGLContext *QPlatformWindow::glContext() const +bool QPlatformWindow::setKeyboardGrabEnabled(bool grab) { - return 0; + Q_UNUSED(grab); + qWarning("This plugin does not support grabbing the keyboard"); + return false; +} + +bool QPlatformWindow::setMouseGrabEnabled(bool grab) +{ + Q_UNUSED(grab); + qWarning("This plugin does not support grabbing the mouse"); + return false; } /*! @@ -206,24 +252,24 @@ QPlatformGLContext *QPlatformWindow::glContext() const \brief The QPlatformWindow class provides an abstraction for top-level windows. - The QPlatformWindow abstraction is used by QWidget for all its top level widgets. It is being + The QPlatformWindow abstraction is used by QWindow for all its top level windows. It is being created by calling the createPlatformWindow function in the loaded QPlatformIntegration instance. QPlatformWindow is used to signal to the windowing system, how Qt persieves its frame. However, it is not concerned with how Qt renders into the window it represents. - Top level QWidgets(tlw) will always have a QPlatformWindow. However, it is not necessary for - all tlw to have a QWindowSurface. This is the case for QGLWidget. And could be the case for - widgets where some 3.party renders into it. + Visible QWindows will always have a QPlatformWindow. However, it is not necessary for + all windows to have a QWindowSurface. This is the case for QOpenGLWidget. And could be the case for + windows where some 3.party renders into it. The platform specific window handle can be retrieved by the winId function. QPlatformWindow is also the way QPA defines how native child windows should be supported through the setParent function. - The only way to retrieve a QPlatformGLContext in QPA is by calling the glContext() function + The only way to retrieve a QPlatformOpenGLContext in QPA is by calling the glContext() function on QPlatformWindow. - \sa QWindowSurface, QWidget + \sa QWindowSurface, QWindow */ diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h index 78090def0a0..ffc3b75c1b5 100644 --- a/src/gui/kernel/qplatformwindow_qpa.h +++ b/src/gui/kernel/qplatformwindow_qpa.h @@ -41,12 +41,14 @@ #ifndef QPLATFORMWINDOW_H #define QPLATFORMWINDOW_H - #include #include +#include #include #include - +#include +#include +#include QT_BEGIN_HEADER @@ -54,24 +56,33 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) +class QPlatformScreen; class QPlatformWindowPrivate; -class QWidget; -class QPlatformGLContext; +class QWindow; -class Q_GUI_EXPORT QPlatformWindow +class Q_GUI_EXPORT QPlatformWindow : public QPlatformSurface { Q_DECLARE_PRIVATE(QPlatformWindow) public: - QPlatformWindow(QWidget *tlw); + QPlatformWindow(QWindow *window); virtual ~QPlatformWindow(); - QWidget *widget() const; + QWindow *window() const; + QPlatformWindow *parent() const; + + QPlatformScreen *screen() const; + + virtual QSurfaceFormat format() const; + virtual void setGeometry(const QRect &rect); virtual QRect geometry() const; + virtual QMargins frameMargins() const; + virtual void setVisible(bool visible); virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); - virtual Qt::WindowFlags windowFlags() const; + virtual Qt::WindowState setWindowState(Qt::WindowState state); + virtual WId winId() const; virtual void setParent(const QPlatformWindow *window); @@ -79,10 +90,14 @@ public: virtual void raise(); virtual void lower(); + virtual void propagateSizeHints(); + virtual void setOpacity(qreal level); virtual void requestActivateWindow(); - virtual QPlatformGLContext *glContext() const; + virtual bool setKeyboardGrabEnabled(bool grab); + virtual bool setMouseGrabEnabled(bool grab); + protected: QScopedPointer d_ptr; private: diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp deleted file mode 100644 index 482ae68a2b8..00000000000 --- a/src/gui/kernel/qplatformwindowformat_qpa.cpp +++ /dev/null @@ -1,994 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformwindowformat_qpa.h" - -#include - -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 - | QPlatformWindowFormat::HasWindowSurface) - , depthSize(-1) - , accumSize(-1) - , stencilSize(-1) - , redSize(-1) - , greenSize(-1) - , blueSize(-1) - , alphaSize(-1) - , numSamples(-1) - , swapInterval(-1) - , windowApi(QPlatformWindowFormat::Raster) - , sharedContext(0) - { - } - - 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), - windowApi(other->windowApi), - sharedContext(other->sharedContext) - { - } - QAtomicInt ref; - QPlatformWindowFormat::FormatOptions opts; - int depthSize; - int accumSize; - int stencilSize; - int redSize; - int greenSize; - int blueSize; - int alphaSize; - int numSamples; - int swapInterval; - QPlatformWindowFormat::WindowApi windowApi; - QPlatformGLContext *sharedContext; -}; - -/*! - \class QPlatformWindowFormat - \brief The QPlatformWindowFormat class specifies the display format of an OpenGL - rendering context and if possible attributes of the corresponding QPlatformWindow. - - \ingroup painting - - QWidget has a setter and getter function for QPlatformWindowFormat. These functions can be used - by the application programmer to signal what kind of format he wants to the window and glcontext - should have. However, it is not always possible to fulfill these requirements. The application - programmer should therefore check the resulting QPlatformWindowFormat from QPlatformGLContext - to see the format that was actually created. - - 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 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 QPlatformWindowFormat 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 QPlatformWindowFormat 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 QPlatformGLContext, QWidget -*/ - -/*! - Constructs a QPlatformWindowFormat 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 setSampleBuffers() Multisample buffers:\endlink Disabled. - \endlist -*/ - -QPlatformWindowFormat::QPlatformWindowFormat() -{ - d = new QPlatformWindowFormatPrivate; -} - - -/*! - 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 - 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. - - \sa defaultFormat(), setOption() -*/ - -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 QPlatformWindowFormat. -*/ -QPlatformWindowFormat::~QPlatformWindowFormat() -{ - if (!d->ref.deref()) - delete d; -} - -/*! - \fn bool QPlatformWindowFormat::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 QPlatformWindowFormat::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 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. - - \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 QPlatformWindowFormat::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 QPlatformWindowFormat::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 QPlatformWindowFormat::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 QPlatformWindowFormat::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 QPlatformWindowFormat::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 QPlatformWindowFormat::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("QPlatformWindowFormat::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; -} - -void QPlatformWindowFormat::setWindowApi(QPlatformWindowFormat::WindowApi api) -{ - detach(); - d->windowApi = api; -} - -QPlatformWindowFormat::WindowApi QPlatformWindowFormat::windowApi() const -{ - return d->windowApi; -} - -void QPlatformWindowFormat::setSharedContext(QPlatformGLContext *context) -{ - d->sharedContext = context; -} - -QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const -{ - return d->sharedContext; -} - -/*! - \fn bool QPlatformWindowFormat::hasWindowSurface() const - - Returns true if the corresponding widget has an instance of QWindowSurface. - - Otherwise returns false. - - WindowSurface is enabled by default. -*/ - -/*! - If \a enable is true a top level QWidget will create a QWindowSurface at creation; - - otherwise the QWidget will only have a QPlatformWindow. - - This is useful for QGLWidget where the QPlatformGLContext controls the surface. -*/ - -void QPlatformWindowFormat::setWindowSurface(bool enable) -{ - setOption(enable ? QPlatformWindowFormat::HasWindowSurface : QPlatformWindowFormat::NoWindowSurface); -} - -/*! - 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("QPlatformWindowFormat::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("QPlatformWindowFormat::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("QPlatformWindowFormat::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("QPlatformWindowFormat::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("QPlatformWindowFormat::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("QPlatformWindowFormat::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("QPlatformWindowFormat::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; -} - -/*! - 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 QPlatformWindowFormat(). - - \sa setDefaultFormat() -*/ - -QPlatformWindowFormat QPlatformWindowFormat::defaultFormat() -{ - return *q_platformwindow_default_format(); -} - -/*! - 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 - - \sa defaultFormat() -*/ - -void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f) -{ - *q_platformwindow_default_format() = f; -} - - -/* - Returns the default QPlatformWindowFormat 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 setSampleBuffers() Multisample buffers:\endlink Disabled. - \endlist - - \sa setDefaultFormat() -*/ - -//QPlatformWindowFormat QPlatformWindowFormat::defaultOverlayFormat() -//{ -// return *defaultOverlayFormatInstance(); -//} - -///*! -// 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. - -// 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 QPlatformWindowFormat objects - \a a and \a b are equal; otherwise returns false. - - \relates QPlatformWindowFormat -*/ - -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->windowApi == b.d->windowApi); -} - - -/*! - Returns false if all the options of the two QPlatformWindowFormat objects - \a a and \a b are equal; otherwise returns true. - - \relates QPlatformWindowFormat -*/ - -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 deleted file mode 100644 index e7dde792610..00000000000 --- a/src/gui/kernel/qplatformwindowformat_qpa.h +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QPLATFORMWINDOWFORMAT_QPA_H -#define QPLATFORMWINDOWFORMAT_QPA_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -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, - HasWindowSurface = 0x0800, - 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, - NoWindowSurface = HasWindowSurface << 16 - - }; - Q_DECLARE_FLAGS(FormatOptions, FormatOption) - - enum WindowApi { - Raster, - OpenGL, - OpenVG - }; - - 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; - - 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; - 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 hasWindowSurface() const; - void setWindowSurface(bool enable); - - void setOption(QPlatformWindowFormat::FormatOptions opt); - bool testOption(QPlatformWindowFormat::FormatOptions opt) const; - - static QPlatformWindowFormat defaultFormat(); - static void setDefaultFormat(const QPlatformWindowFormat& f); - -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&); -#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 -{ - 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::hasWindowSurface() const -{ - return testOption(QPlatformWindowFormat::HasWindowSurface); -} - -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/qscreen.cpp b/src/gui/kernel/qscreen.cpp new file mode 100644 index 00000000000..47db5a02649 --- /dev/null +++ b/src/gui/kernel/qscreen.cpp @@ -0,0 +1,212 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qscreen.h" +#include "qplatformscreen_qpa.h" + +#include + +QT_BEGIN_NAMESPACE + +class QScreenPrivate : public QObjectPrivate +{ +public: + QScreenPrivate(QPlatformScreen *screen) + : platformScreen(screen) + { + } + + QPlatformScreen *platformScreen; +}; + +QScreen::QScreen(QPlatformScreen *screen) + : QObject(*new QScreenPrivate(screen), 0) +{ +} + +/*! + Get the platform screen handle. +*/ +QPlatformScreen *QScreen::handle() const +{ + Q_D(const QScreen); + return d->platformScreen; +} + +/*! + Get the platform dependent screen name. + + For example, on an X11 platform this should typically be + the DISPLAY environment variable corresponding to the screen. +*/ +QString QScreen::name() const +{ + Q_D(const QScreen); + return d->platformScreen->name(); +} + +/*! + Get the screen's color depth. +*/ +int QScreen::depth() const +{ + Q_D(const QScreen); + return d->platformScreen->depth(); +} + +/*! + Get the screen's size. +*/ +QSize QScreen::size() const +{ + Q_D(const QScreen); + return d->platformScreen->geometry().size(); +} + +/*! + Get the screen's available size. + + The available size is the size excluding window manager reserved areas + such as task bars and system menus. +*/ +QSize QScreen::availableSize() const +{ + Q_D(const QScreen); + return d->platformScreen->availableGeometry().size(); +} + +/*! + Get the screen's geometry. +*/ +QRect QScreen::geometry() const +{ + Q_D(const QScreen); + return d->platformScreen->geometry(); +} + +/*! + Get the screen's available geometry. + + The available geometry is the geometry excluding window manager reserved areas + such as task bars and system menus. +*/ +QRect QScreen::availableGeometry() const +{ + Q_D(const QScreen); + return d->platformScreen->availableGeometry(); +} + +/*! + Get the screen's virtual siblings. + + The virtual siblings are the screen instances sharing the same virtual desktop. + They share a common coordinate system, and windows can freely be moved or + positioned across them without having to be re-created. +*/ +QList QScreen::virtualSiblings() const +{ + Q_D(const QScreen); + QList platformScreens = d->platformScreen->virtualSiblings(); + QList screens; + foreach (QPlatformScreen *platformScreen, platformScreens) + screens << platformScreen->screen(); + return screens; +} + +/*! + Get the size of the virtual desktop corresponding to this screen. + + This is the combined size of the virtual siblings' individual geometries. + + \sa virtualSiblings() +*/ +QSize QScreen::virtualSize() const +{ + return virtualGeometry().size(); +} + +/*! + Get the geometry of the virtual desktop corresponding to this screen. + + This is the union of the virtual siblings' individual geometries. + + \sa virtualSiblings() +*/ +QRect QScreen::virtualGeometry() const +{ + Q_D(const QScreen); + QRect result; + foreach (QPlatformScreen *platformScreen, d->platformScreen->virtualSiblings()) + result |= platformScreen->geometry(); + return result; +} + +/*! + Get the available size of the virtual desktop corresponding to this screen. + + This is the combined size of the virtual siblings' individual available geometries. + + \sa availableSize() + \sa virtualSiblings() +*/ +QSize QScreen::availableVirtualSize() const +{ + return availableVirtualGeometry().size(); +} + +/*! + Get the available size of the virtual desktop corresponding to this screen. + + This is the union of the virtual siblings' individual available geometries. + + \sa availableGeometry() + \sa virtualSiblings() +*/ +QRect QScreen::availableVirtualGeometry() const +{ + Q_D(const QScreen); + QRect result; + foreach (QPlatformScreen *platformScreen, d->platformScreen->virtualSiblings()) + result |= platformScreen->availableGeometry(); + return result; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h new file mode 100644 index 00000000000..7063578f742 --- /dev/null +++ b/src/gui/kernel/qscreen.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSCREEN_H +#define QSCREEN_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformScreen; +class QScreenPrivate; +class QWindow; +class QSize; +class QRect; + +class Q_GUI_EXPORT QScreen : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QScreen) + +public: + QPlatformScreen *handle() const; + + QString name() const; + + int depth() const; + + QSize size() const; + QRect geometry() const; + + QSize availableSize() const; + QRect availableGeometry() const; + + QList virtualSiblings() const; + + QSize virtualSize() const; + QRect virtualGeometry() const; + + QSize availableVirtualSize() const; + QRect availableVirtualGeometry() const; + +private: + QScreen(QPlatformScreen *screen); + + Q_DISABLE_COPY(QScreen) + friend class QPlatformScreen; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSCREEN_H + diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h index 6432a888af8..3328fa90113 100644 --- a/src/gui/kernel/qsessionmanager.h +++ b/src/gui/kernel/qsessionmanager.h @@ -55,13 +55,15 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) +class QGuiApplication; + class QSessionManagerPrivate; class Q_GUI_EXPORT QSessionManager : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QSessionManager) - QSessionManager(QApplication *app, QString &id, QString &key); + QSessionManager(QGuiApplication *app, QString &id, QString &key); ~QSessionManager(); public: QString sessionId() const; diff --git a/src/gui/kernel/qsessionmanager_qpa.cpp b/src/gui/kernel/qsessionmanager_qpa.cpp index bea0e12d9e2..7ade0df3a8a 100644 --- a/src/gui/kernel/qsessionmanager_qpa.cpp +++ b/src/gui/kernel/qsessionmanager_qpa.cpp @@ -40,9 +40,9 @@ ****************************************************************************/ #include +#include #include -#include #ifndef QT_NO_SESSIONMANAGER @@ -68,7 +68,7 @@ QSessionManagerPrivate::QSessionManagerPrivate(QSessionManager*, { } -QSessionManager::QSessionManager(QApplication *app, QString &id, QString &key) +QSessionManager::QSessionManager(QGuiApplication *app, QString &id, QString &key) : QObject(*(new QSessionManagerPrivate(this, id, key)), app) { Q_D(QSessionManager); diff --git a/src/gui/kernel/qsessionmanager_qws.cpp b/src/gui/kernel/qsessionmanager_qws.cpp deleted file mode 100644 index efe688e0e53..00000000000 --- a/src/gui/kernel/qsessionmanager_qws.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#ifndef QT_NO_SESSIONMANAGER - -QT_BEGIN_NAMESPACE - -class QSessionManagerPrivate : public QObjectPrivate -{ -public: - QSessionManagerPrivate(QSessionManager *m, const QString &id, - const QString &key); - - QStringList restartCommand; - QStringList discardCommand; - const QString sessionId; - const QString sessionKey; - QSessionManager::RestartHint restartHint; -}; - -QSessionManagerPrivate::QSessionManagerPrivate(QSessionManager*, - const QString &id, - const QString &key) - : QObjectPrivate(), sessionId(id), sessionKey(key) -{ -} - -QSessionManager::QSessionManager(QApplication *app, QString &id, QString &key) - : QObject(*new QSessionManagerPrivate(this, id, key), app) -{ - Q_D(QSessionManager); - d->restartHint = RestartIfRunning; -} - -QSessionManager::~QSessionManager() -{ -} - -QString QSessionManager::sessionId() const -{ - Q_D(const QSessionManager); - return d->sessionId; -} - -QString QSessionManager::sessionKey() const -{ - Q_D(const QSessionManager); - return d->sessionKey; -} - - -bool QSessionManager::allowsInteraction() -{ - return false; -} - -bool QSessionManager::allowsErrorInteraction() -{ - return false; -} - -void QSessionManager::release() -{ -} - -void QSessionManager::cancel() -{ -} - -void QSessionManager::setRestartHint(QSessionManager::RestartHint hint) -{ - Q_D(QSessionManager); - d->restartHint = hint; -} - -QSessionManager::RestartHint QSessionManager::restartHint() const -{ - Q_D(const QSessionManager); - return d->restartHint; -} - -void QSessionManager::setRestartCommand(const QStringList &command) -{ - Q_D(QSessionManager); - d->restartCommand = command; -} - -QStringList QSessionManager::restartCommand() const -{ - Q_D(const QSessionManager); - return d->restartCommand; -} - -void QSessionManager::setDiscardCommand(const QStringList &command) -{ - Q_D(QSessionManager); - d->discardCommand = command; -} - -QStringList QSessionManager::discardCommand() const -{ - Q_D(const QSessionManager); - return d->discardCommand; -} - -void QSessionManager::setManagerProperty(const QString &name, - const QString &value) -{ - Q_UNUSED(name); - Q_UNUSED(value); -} - -void QSessionManager::setManagerProperty(const QString &name, - const QStringList &value) -{ - Q_UNUSED(name); - Q_UNUSED(value); -} - -bool QSessionManager::isPhase2() const -{ - return false; -} - -void QSessionManager::requestPhase2() -{ -} - -QT_END_NAMESPACE - -#endif // QT_NO_SESSIONMANAGER diff --git a/src/gui/kernel/qsound_qws.cpp b/src/gui/kernel/qsound_qws.cpp deleted file mode 100644 index 08382389f52..00000000000 --- a/src/gui/kernel/qsound_qws.cpp +++ /dev/null @@ -1,350 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qapplication.h" - -#ifndef QT_NO_SOUND - -#include "qsound.h" -#include "qpaintdevice.h" -#include "qwsdisplay_qws.h" -#include "qsound_p.h" - -#include "qsoundqss_qws.h" - -#include "qhash.h" -#include "qfileinfo.h" - -#include "qbytearray.h" -#include "quuid.h" -#include "qdatastream.h" -#include "qcopchannel_qws.h" -#include "qbuffer.h" - - -QT_BEGIN_NAMESPACE - -#ifdef MEDIA_SERVER - -#define SERVER_CHANNEL "QPE/MediaServer" - -class QCopMessage : public QDataStream -{ -public: - QCopMessage( const QString& channel, const QString& message ) - : QDataStream( new QBuffer ), m_channel( channel ), m_message( message ) - { - device()->open( QIODevice::WriteOnly ); - } - - ~QCopMessage() - { - QCopChannel::send( m_channel, m_message, ((QBuffer*)device())->buffer() ); - delete device(); - } - -private: - QString m_channel; - QString m_message; -}; - -#endif // MEDIA_SERVER - -class QAuServerQWS; - -class QAuBucketQWS : public QObject, public QAuBucket -{ - Q_OBJECT -public: - QAuBucketQWS( QAuServerQWS*, QSound*, QObject* parent = 0 ); - - ~QAuBucketQWS(); - -#ifndef MEDIA_SERVER - int id() const { return id_; } -#endif - - QSound* sound() const { return sound_; } - -#ifdef MEDIA_SERVER - void play(); - - void stop(); -#endif - -signals: - // Only for Media Server - void done( QAuBucketQWS* ); - -private slots: - // Only for Media Server - void processMessage( const QString& msg, const QByteArray& data ); - -private: -#ifdef MEDIA_SERVER - QCopChannel *m_channel; - QUuid m_id; -#endif - -#ifndef MEDIA_SERVER - int id_; -#endif - QSound *sound_; - QAuServerQWS *server_; - - static int next; -}; - -int QAuBucketQWS::next = 0; - -class QAuServerQWS : public QAuServer -{ - Q_OBJECT -public: - QAuServerQWS( QObject* parent ); - - void init( QSound* s ) - { - QAuBucketQWS *bucket = new QAuBucketQWS( this, s ); -#ifdef MEDIA_SERVER - connect( bucket, SIGNAL(done(QAuBucketQWS*)), - this, SLOT(complete(QAuBucketQWS*)) ); -#endif - setBucket( s, bucket ); - } - -#ifndef MEDIA_SERVER - // Register bucket - void insert( QAuBucketQWS *bucket ) - { - buckets.insert( bucket->id(), bucket ); - } - - // Remove bucket from register - void remove( QAuBucketQWS *bucket ) - { - buckets.remove( bucket->id() ); - } -#endif - - void play( QSound* s ) - { - QString filepath = QFileInfo( s->fileName() ).absoluteFilePath(); -#if defined(QT_NO_QWS_SOUNDSERVER) - server->playFile( bucket( s )->id(), filepath ); -#elif defined(MEDIA_SERVER) - bucket( s )->play(); -#else - client->play( bucket( s )->id(), filepath ); -#endif - } - - void stop( QSound* s ) - { -#if defined(QT_NO_QWS_SOUNDSERVER) - server->stopFile( bucket( s )->id() ); -#elif defined(MEDIA_SERVER) - bucket( s )->stop(); -#else - client->stop( bucket( s )->id() ); -#endif - } - - bool okay() { return true; } - -private slots: - // Continue playing sound if loops remain - void complete( int id ) - { -#ifndef MEDIA_SERVER - QAuBucketQWS *bucket = find( id ); - if( bucket ) { - QSound *sound = bucket->sound(); - if( decLoop( sound ) ) { - play( sound ); - } - } -#else - Q_UNUSED(id); -#endif - } - - // Only for Media Server - void complete( QAuBucketQWS* bucket ) - { -#ifndef MEDIA_SERVER - Q_UNUSED(bucket); -#else - QSound *sound = bucket->sound(); - if( decLoop( sound ) ) { - play( sound ); - } -#endif - } - -protected: - QAuBucketQWS* bucket( QSound *s ) - { - return (QAuBucketQWS*)QAuServer::bucket( s ); - } - -private: -#ifndef MEDIA_SERVER - // Find registered bucket with given id, return null if none found - QAuBucketQWS* find( int id ) - { - QHash::Iterator it = buckets.find( id ); - if( it != buckets.end() ) { - return it.value(); - } - - return 0; - } - - QHash buckets; // ### possible problem with overlapping keys - -#ifdef QT_NO_QWS_SOUNDSERVER - QWSSoundServer *server; -#else - QWSSoundClient *client; -#endif - -#endif // MEDIA_SERVER -}; - -QAuServerQWS::QAuServerQWS(QObject* parent) : - QAuServer(parent) -{ -#ifndef MEDIA_SERVER - setObjectName(QLatin1String("qauserverqws")); - -#ifdef QT_NO_QWS_SOUNDSERVER - server = new QWSSoundServer( this ); // ### only suitable for single application - - connect( server, SIGNAL(soundCompleted(int)), - this, SLOT(complete(int)) ); -#else - client = new QWSSoundClient( this ); // ### requires successful connection - - connect( client, SIGNAL(soundCompleted(int)), - this, SLOT(complete(int)) ); -#endif - -#endif // MEDIA_SERVER -} - -QAuBucketQWS::QAuBucketQWS( QAuServerQWS *server, QSound *sound, QObject* parent ) - : QObject( parent ), sound_( sound ), server_( server ) -{ -#ifdef MEDIA_SERVER - m_id = QUuid::createUuid(); - - sound->setObjectName( m_id.toString() ); - - m_channel = new QCopChannel(QLatin1String("QPE/QSound/") + m_id, this ); - connect( m_channel, SIGNAL(received(QString,QByteArray)), - this, SLOT(processMessage(QString,QByteArray)) ); - - { - QCopMessage message( QLatin1String(SERVER_CHANNEL), QLatin1String("subscribe(QUuid)") ); - message << m_id; - } - - { - QString filepath = QFileInfo( sound_->fileName() ).absoluteFilePath(); - QCopMessage message( QLatin1String(SERVER_CHANNEL), QLatin1String("open(QUuid,QString)") ); - message << m_id << filepath; - } -#else - id_ = next++; - server_->insert( this ); -#endif -} - -#ifdef MEDIA_SERVER -void QAuBucketQWS::play() -{ - QString filepath = QFileInfo( sound_->fileName() ).absoluteFilePath(); - - QCopMessage message( QLatin1String(SERVER_CHANNEL), QLatin1String("play(QUuid)") ); - message << m_id; -} - -void QAuBucketQWS::stop() -{ - QCopMessage message( QLatin1String(SERVER_CHANNEL), QLatin1String("stop(QUuid)") ); - message << m_id; -} -#endif // MEDIA_SERVER - -void QAuBucketQWS::processMessage( const QString& msg, const QByteArray& data ) -{ - Q_UNUSED(data); -#ifndef MEDIA_SERVER - Q_UNUSED(msg); -#else - if( msg == QLatin1String("done()") ) { - emit done( this ); - } -#endif -} - -QAuBucketQWS::~QAuBucketQWS() -{ -#ifdef MEDIA_SERVER - QCopMessage message( QLatin1String(SERVER_CHANNEL), QLatin1String("revoke(QUuid)") ); - message << m_id; -#else - server_->remove( this ); -#endif -} - - -QAuServer* qt_new_audio_server() -{ - return new QAuServerQWS(qApp); -} - -#include "qsound_qws.moc" - -#endif // QT_NO_SOUND - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp new file mode 100644 index 00000000000..8c87c390a38 --- /dev/null +++ b/src/gui/kernel/qstylehints.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +static inline QVariant hint(QPlatformIntegration::StyleHint h) +{ + return QGuiApplicationPrivate::platformIntegration()->styleHint(h); +} + +QStyleHints::QStyleHints() + : QObject() +{ +} + + +int QStyleHints::mouseDoubleClickInterval() const +{ + return hint(QPlatformIntegration::MouseDoubleClickInterval).toInt(); +} + +int QStyleHints::startDragDistance() const +{ + return hint(QPlatformIntegration::StartDragDistance).toInt(); +} + +int QStyleHints::startDragTime() const +{ + return hint(QPlatformIntegration::StartDragTime).toInt(); +} + +int QStyleHints::keyboardInputInterval() const +{ + return hint(QPlatformIntegration::KeyboardInputInterval).toInt(); +} + +int QStyleHints::cursorFlashTime() const +{ + return hint(QPlatformIntegration::CursorFlashTime).toInt(); +} diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h new file mode 100644 index 00000000000..3cb549daad9 --- /dev/null +++ b/src/gui/kernel/qstylehints.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTYLEHINTS_H +#define QSTYLEHINTS_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformIntegration; + +class Q_GUI_EXPORT QStyleHints : public QObject +{ + Q_OBJECT +public: + int mouseDoubleClickInterval() const; + int startDragDistance() const; + int startDragTime() const; + int keyboardInputInterval() const; + int cursorFlashTime() const; +private: + friend class QGuiApplication; + QStyleHints(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp new file mode 100644 index 00000000000..e192674f02b --- /dev/null +++ b/src/gui/kernel/qsurface.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qsurface.h" + +QT_BEGIN_NAMESPACE + +QSurface::QSurface(SurfaceType type) + : m_type(type) +{ +} + +QSurface::SurfaceType QSurface::surfaceType() const +{ + return m_type; +} + +QT_BEGIN_NAMESPACE + diff --git a/src/gui/embedded/qkbdtty_qws.h b/src/gui/kernel/qsurface.h similarity index 79% rename from src/gui/embedded/qkbdtty_qws.h rename to src/gui/kernel/qsurface.h index f989f831e46..a6c8745a7a7 100644 --- a/src/gui/embedded/qkbdtty_qws.h +++ b/src/gui/kernel/qsurface.h @@ -39,10 +39,11 @@ ** ****************************************************************************/ -#ifndef QKBDTTY_QWS_H -#define QKBDTTY_QWS_H +#ifndef QSURFACE_H +#define QSURFACE_H -#include +#include +#include QT_BEGIN_HEADER @@ -50,30 +51,32 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifndef QT_NO_QWS_KEYBOARD +class QPlatformSurface; -#ifndef QT_NO_QWS_KBD_TTY - -class QWSTtyKbPrivate; - -class QWSTtyKeyboardHandler : public QWSKeyboardHandler +class Q_GUI_EXPORT QSurface { public: - explicit QWSTtyKeyboardHandler(const QString&); - virtual ~QWSTtyKeyboardHandler(); + enum SurfaceType { + Window + }; - virtual bool filterKeycode(char &code); + virtual ~QSurface(); + + SurfaceType surfaceType() const; + + virtual QSurfaceFormat format() const = 0; + virtual QPlatformSurface *surfaceHandle() const = 0; private: - QWSTtyKbPrivate *d; + QSurface(SurfaceType type); + + SurfaceType m_type; + + friend class QWindow; }; -#endif // QT_NO_QWS_KBD_TTY - -#endif // QT_NO_QWS_KEYBOARD - QT_END_NAMESPACE QT_END_HEADER -#endif // QKBDTTY_QWS_H +#endif //QSURFACE_H diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp new file mode 100644 index 00000000000..c53c510d8cd --- /dev/null +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -0,0 +1,466 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qsurfaceformat.h" + +#include +#include + +#ifdef major +#undef major +#endif + +#ifdef minor +#undef minor +#endif + +class QSurfaceFormatPrivate +{ +public: + explicit QSurfaceFormatPrivate(QSurfaceFormat::FormatOptions _opts = 0) + : ref(1) + , opts(_opts) + , redBufferSize(-1) + , greenBufferSize(-1) + , blueBufferSize(-1) + , alphaBufferSize(-1) + , depthSize(-1) + , stencilSize(-1) + , swapBehavior(QSurfaceFormat::DefaultSwapBehavior) + , numSamples(-1) + , profile(QSurfaceFormat::NoProfile) + , major(1) + , minor(1) + { + } + + QSurfaceFormatPrivate(const QSurfaceFormatPrivate *other) + : ref(1), + opts(other->opts), + redBufferSize(other->redBufferSize), + greenBufferSize(other->greenBufferSize), + blueBufferSize(other->blueBufferSize), + alphaBufferSize(other->alphaBufferSize), + depthSize(other->depthSize), + stencilSize(other->stencilSize), + swapBehavior(other->swapBehavior), + numSamples(other->numSamples), + profile(other->profile), + major(other->major), + minor(other->minor) + { + } + + QAtomicInt ref; + QSurfaceFormat::FormatOptions opts; + int redBufferSize; + int greenBufferSize; + int blueBufferSize; + int alphaBufferSize; + int depthSize; + int stencilSize; + QSurfaceFormat::SwapBehavior swapBehavior; + int numSamples; + QSurfaceFormat::OpenGLContextProfile profile; + int major; + int minor; +}; + +QSurfaceFormat::QSurfaceFormat() : d(new QSurfaceFormatPrivate) +{ +} + +QSurfaceFormat::QSurfaceFormat(QSurfaceFormat::FormatOptions options) : + d(new QSurfaceFormatPrivate(options)) +{ +} + +/*! + \internal +*/ +void QSurfaceFormat::detach() +{ + if (d->ref != 1) { + QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d); + if (!d->ref.deref()) + delete d; + d = newd; + } +} + +/*! + Constructs a copy of \a other. +*/ + +QSurfaceFormat::QSurfaceFormat(const QSurfaceFormat &other) +{ + d = other.d; + d->ref.ref(); +} + +/*! + Assigns \a other to this object. +*/ + +QSurfaceFormat &QSurfaceFormat::operator=(const QSurfaceFormat &other) +{ + if (d != other.d) { + other.d->ref.ref(); + if (!d->ref.deref()) + delete d; + d = other.d; + } + return *this; +} + +/*! + Destroys the QSurfaceFormat. +*/ +QSurfaceFormat::~QSurfaceFormat() +{ + if (!d->ref.deref()) + delete d; +} + +/*! + \fn bool QSurfaceFormat::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 QSurfaceFormat::setStereo(bool enable) +{ + QSurfaceFormat::FormatOptions newOptions = d->opts; + if (enable) { + newOptions |= QSurfaceFormat::StereoBuffers; + } else { + newOptions &= ~QSurfaceFormat::StereoBuffers; + } + if (int(newOptions) != int(d->opts)) { + detach(); + d->opts = newOptions; + } +} + +/*! + 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 QSurfaceFormat::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 QSurfaceFormat::setSamples(int numSamples) +{ + if (d->numSamples != numSamples) { + detach(); + d->numSamples = numSamples; + } +} + +/*! + Sets the format option to \a opt. + + \sa testOption() +*/ + +void QSurfaceFormat::setOption(QSurfaceFormat::FormatOptions opt) +{ + const QSurfaceFormat::FormatOptions newOptions = d->opts | opt; + if (int(newOptions) != int(d->opts)) { + detach(); + d->opts = newOptions; + } +} + +/*! + Returns true if format option \a opt is set; otherwise returns false. + + \sa setOption() +*/ + +bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOptions opt) const +{ + return d->opts & opt; +} + +/*! + Set the minimum depth buffer size to \a size. + + \sa depthBufferSize(), setDepth(), depth() +*/ +void QSurfaceFormat::setDepthBufferSize(int size) +{ + if (d->depthSize != size) { + detach(); + d->depthSize = size; + } +} + +/*! + Returns the depth buffer size. + + \sa depth(), setDepth(), setDepthBufferSize() +*/ +int QSurfaceFormat::depthBufferSize() const +{ + return d->depthSize; +} + +void QSurfaceFormat::setSwapBehavior(SwapBehavior behavior) +{ + if (d->swapBehavior != behavior) { + detach(); + d->swapBehavior = behavior; + } +} + + +QSurfaceFormat::SwapBehavior QSurfaceFormat::swapBehavior() const +{ + return d->swapBehavior; +} + +bool QSurfaceFormat::hasAlpha() const +{ + return d->alphaBufferSize > 0; +} + +/*! + Set the preferred stencil buffer size to \a size. + + \sa stencilBufferSize(), setStencil(), stencil() +*/ +void QSurfaceFormat::setStencilBufferSize(int size) +{ + if (d->stencilSize != size) { + detach(); + d->stencilSize = size; + } +} + +/*! + Returns the stencil buffer size. + + \sa stencil(), setStencil(), setStencilBufferSize() +*/ +int QSurfaceFormat::stencilBufferSize() const +{ + return d->stencilSize; +} + +int QSurfaceFormat::redBufferSize() const +{ + return d->redBufferSize; +} + +int QSurfaceFormat::greenBufferSize() const +{ + return d->greenBufferSize; +} + +int QSurfaceFormat::blueBufferSize() const +{ + return d->blueBufferSize; +} + +int QSurfaceFormat::alphaBufferSize() const +{ + return d->alphaBufferSize; +} + +void QSurfaceFormat::setRedBufferSize(int size) +{ + if (d->redBufferSize != size) { + detach(); + d->redBufferSize = size; + } +} + +void QSurfaceFormat::setGreenBufferSize(int size) +{ + if (d->greenBufferSize != size) { + detach(); + d->greenBufferSize = size; + } +} + +void QSurfaceFormat::setBlueBufferSize(int size) +{ + if (d->blueBufferSize != size) { + detach(); + d->blueBufferSize = size; + } +} + +void QSurfaceFormat::setAlphaBufferSize(int size) +{ + if (d->alphaBufferSize != size) { + detach(); + d->alphaBufferSize = size; + } +} + +/*! + Sets the desired OpenGL context profile. + + This setting is ignored if the requested OpenGL version is + less than 3.2. +*/ +void QSurfaceFormat::setProfile(OpenGLContextProfile profile) +{ + if (d->profile != profile) { + detach(); + d->profile = profile; + } +} + +QSurfaceFormat::OpenGLContextProfile QSurfaceFormat::profile() const +{ + return d->profile; +} + +/*! + Sets the desired major OpenGL version. +*/ +void QSurfaceFormat::setMajorVersion(int major) +{ + d->major = major; +} + +/*! + Returns the major OpenGL version. +*/ +int QSurfaceFormat::majorVersion() const +{ + return d->major; +} + +/*! + Sets the desired minor OpenGL version. +*/ +void QSurfaceFormat::setMinorVersion(int minor) +{ + d->minor = minor; +} + +/*! + Returns the minor OpenGL version. +*/ +int QSurfaceFormat::minorVersion() const +{ + return d->minor; +} + +bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b) +{ + return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts + && a.d->stencilSize == b.d->stencilSize + && a.d->redBufferSize == b.d->redBufferSize + && a.d->greenBufferSize == b.d->greenBufferSize + && a.d->blueBufferSize == b.d->blueBufferSize + && a.d->alphaBufferSize == b.d->alphaBufferSize + && a.d->depthSize == b.d->depthSize + && a.d->numSamples == b.d->numSamples + && a.d->swapBehavior == b.d->swapBehavior + && a.d->profile == b.d->profile); +} + + +/*! + Returns false if all the options of the two QSurfaceFormat objects + \a a and \a b are equal; otherwise returns true. + + \relates QSurfaceFormat +*/ + +bool operator!=(const QSurfaceFormat& a, const QSurfaceFormat& b) +{ + return !(a == b); +} + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QSurfaceFormat &f) +{ + const QSurfaceFormatPrivate * const d = f.d; + + dbg.nospace() << "QSurfaceFormat(" + << "options " << d->opts + << ", depthBufferSize " << d->depthSize + << ", redBufferSize " << d->redBufferSize + << ", greenBufferSize " << d->greenBufferSize + << ", blueBufferSize " << d->blueBufferSize + << ", alphaBufferSize " << d->alphaBufferSize + << ", stencilBufferSize " << d->stencilSize + << ", samples " << d->numSamples + << ", swapBehavior " << d->swapBehavior + << ", profile " << d->profile + << ')'; + + return dbg.space(); +} +#endif diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h new file mode 100644 index 00000000000..f305edbcc94 --- /dev/null +++ b/src/gui/kernel/qsurfaceformat.h @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QSURFACEFORMAT_H +#define QSURFACEFORMAT_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QOpenGLContext; +class QSurfaceFormatPrivate; + +class Q_GUI_EXPORT QSurfaceFormat +{ +public: + enum FormatOption { + StereoBuffers = 0x0001, + DebugContext = 0x0002, + DeprecatedFunctions = 0x0004 + }; + Q_DECLARE_FLAGS(FormatOptions, FormatOption) + + enum SwapBehavior { + DefaultSwapBehavior, + SingleBuffer, + DoubleBuffer, + TripleBuffer + }; + + enum OpenGLContextProfile { + NoProfile, + CoreProfile, + CompatibilityProfile + }; + + QSurfaceFormat(); + QSurfaceFormat(FormatOptions options); + QSurfaceFormat(const QSurfaceFormat &other); + QSurfaceFormat &operator=(const QSurfaceFormat &other); + ~QSurfaceFormat(); + + void setDepthBufferSize(int size); + int depthBufferSize() const; + + void setStencilBufferSize(int size); + int stencilBufferSize() 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 setSamples(int numSamples); + int samples() const; + + void setSwapBehavior(SwapBehavior behavior); + SwapBehavior swapBehavior() const; + + bool hasAlpha() const; + + void setProfile(OpenGLContextProfile profile); + OpenGLContextProfile profile() const; + + void setMajorVersion(int majorVersion); + int majorVersion() const; + + void setMinorVersion(int minorVersion); + int minorVersion() const; + + bool stereo() const; + void setStereo(bool enable); + + void setOption(QSurfaceFormat::FormatOptions opt); + bool testOption(QSurfaceFormat::FormatOptions opt) const; + +private: + QSurfaceFormatPrivate *d; + + void detach(); + + friend Q_GUI_EXPORT bool operator==(const QSurfaceFormat&, const QSurfaceFormat&); + friend Q_GUI_EXPORT bool operator!=(const QSurfaceFormat&, const QSurfaceFormat&); +#ifndef QT_NO_DEBUG_STREAM + friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QSurfaceFormat &); +#endif +}; + +Q_GUI_EXPORT bool operator==(const QSurfaceFormat&, const QSurfaceFormat&); +Q_GUI_EXPORT bool operator!=(const QSurfaceFormat&, const QSurfaceFormat&); + +#ifndef QT_NO_DEBUG_STREAM +Q_GUI_EXPORT QDebug operator<<(QDebug, const QSurfaceFormat &); +#endif + +Q_DECLARE_OPERATORS_FOR_FLAGS(QSurfaceFormat::FormatOptions) + +inline bool QSurfaceFormat::stereo() const +{ + return testOption(QSurfaceFormat::StereoBuffers); +} + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QSURFACEFORMAT_H diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h index 012d92ce8c3..3cb527d0b1a 100644 --- a/src/gui/kernel/qt_gui_pch.h +++ b/src/gui/kernel/qt_gui_pch.h @@ -52,7 +52,7 @@ #include -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN # define _POSIX_ # include # undef _POSIX_ @@ -67,18 +67,14 @@ #include #include -#include +#include #include #include -#include #include #include -#include #include #include -#include #include -#include #include diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp deleted file mode 100644 index aa90410f3e1..00000000000 --- a/src/gui/kernel/qwidget_qws.cpp +++ /dev/null @@ -1,1221 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcursor.h" -#include "qapplication.h" -#include "qapplication_p.h" -#include "qpainter.h" -#include "qbitmap.h" -#include "qimage.h" -#include "qhash.h" -#include "qstack.h" -#include "qlayout.h" -#include "qtextcodec.h" -#include "qinputcontext.h" -#include "qdesktopwidget.h" - -#include "qwsdisplay_qws.h" -#include "private/qwsdisplay_qws_p.h" -#include "qscreen_qws.h" -#include "qwsmanager_qws.h" -#include -#include -#include -#include -#include "qpaintengine.h" - -#include "qdebug.h" - -#include "qwidget_p.h" - -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE - -extern int *qt_last_x; -extern int *qt_last_y; -extern WId qt_last_cursor; -extern bool qws_overrideCursor; -extern QWidget *qt_pressGrab; -extern QWidget *qt_mouseGrb; - -static QWidget *keyboardGrb = 0; - -static int takeLocalId() -{ - static int n=-1000; - return --n; -} - -class QWSServer; -extern QWSServer *qwsServer; - -static inline bool isServerProcess() -{ - return (qwsServer != 0); -} - -/***************************************************************************** - QWidget member functions - *****************************************************************************/ - -void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destroyOldWindow*/) -{ - Q_Q(QWidget); - Qt::WindowType type = q->windowType(); - - // Make sure the WindowTitleHint is on if any of the title bar hints are set - // Note: This might be moved to cross-platform QWidgetPrivate::adjustFlags() - if ( !(data.window_flags & Qt::CustomizeWindowHint) && ( - (data.window_flags & Qt::WindowSystemMenuHint) || - (data.window_flags & Qt::WindowContextHelpButtonHint) || - (data.window_flags & Qt::WindowMinimizeButtonHint) || - (data.window_flags & Qt::WindowMaximizeButtonHint) || - (data.window_flags & Qt::WindowCloseButtonHint) ) ) { - data.window_flags |= Qt::WindowTitleHint; - } - - // Decoration plugins on QWS don't support switching on the close button on its own - if (data.window_flags & Qt::WindowCloseButtonHint) - data.window_flags |= Qt::WindowSystemMenuHint; - - Qt::WindowFlags flags = data.window_flags; - - data.alloc_region_index = -1; - - // we don't have a "Drawer" window type - if (type == Qt::Drawer) { - type = Qt::Widget; - flags &= ~Qt::WindowType_Mask; - } - - - bool topLevel = (flags & Qt::Window); - bool popup = (type == Qt::Popup); - bool dialog = (type == Qt::Dialog - || type == Qt::Sheet - || (flags & Qt::MSWindowsFixedSizeDialogHint)); - bool desktop = (type == Qt::Desktop); - bool tool = (type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip); - - -#ifndef QT_NO_WARNING_OUTPUT - static bool toolWarningShown = false; - if (!toolWarningShown && type == Qt::Tool && !(flags & Qt::FramelessWindowHint)) { - qWarning("Qt for Embedded Linux " QT_VERSION_STR " does not support tool windows with frames.\n" - "This behavior will change in a later release. To ensure compatibility with\n" - "future versions, use (Qt::Tool | Qt::FramelessWindowHint)."); - toolWarningShown = true; - } -#endif - - WId id; - QWSDisplay* dpy = QWidget::qwsDisplay(); - - if (!window) // always initialize - initializeWindow = true; - - // use the size of the primary screen to determine the default window size - QList screens = qt_screen->subScreens(); - if (screens.isEmpty()) - screens.append(qt_screen); - int sw = screens[0]->width(); - int sh = screens[0]->height(); - - if (desktop) { // desktop widget - dialog = popup = false; // force these flags off - data.crect.setRect(0, 0, sw, sh); - } else if (topLevel && !q->testAttribute(Qt::WA_Resized)) { - int width = sw / 2; - int height = 4 * sh / 10; - if (extra) { - width = qMax(qMin(width, extra->maxw), extra->minw); - height = qMax(qMin(height, extra->maxh), extra->minh); - } - data.crect.setSize(QSize(width, height)); - } - - if (window) { // override the old window - id = window; - setWinId(window); - } else if (desktop) { // desktop widget - id = (WId)-2; // id = root window -#if 0 - QWidget *otherDesktop = q->find(id); // is there another desktop? - if (otherDesktop && otherDesktop->testWFlags(Qt::WPaintDesktop)) { - otherDesktop->d_func()->setWinId(0); // remove id from widget mapper - setWinId(id); // make sure otherDesktop is - otherDesktop->d_func()->setWinId(id); // found first - } else -#endif - { - setWinId(id); - } - } else { - id = topLevel ? dpy->takeId() : takeLocalId(); - setWinId(id); // set widget id/handle + hd - } - - - bool hasFrame = true; - if (topLevel) { - if (desktop || popup || tool || q->testAttribute(Qt::WA_DontShowOnScreen)) - hasFrame = false; - else - hasFrame = !(flags & Qt::FramelessWindowHint); - } - if (desktop) { - q->setAttribute(Qt::WA_WState_Visible); - } else if (topLevel) { // set X cursor - //QCursor *oc = QApplication::overrideCursor(); - if (initializeWindow) { - //XXX XDefineCursor(dpy, winid, oc ? oc->handle() : cursor().handle()); - } - QWidget::qwsDisplay()->nameRegion(q->internalWinId(), q->objectName(), q->windowTitle()); - } - - if (topLevel) { - createTLExtra(); - QTLWExtra *topextra = extra->topextra; -#ifndef QT_NO_QWS_MANAGER - if (hasFrame) { - // get size of wm decoration and make the old crect the new frect - QRect cr = data.crect; - QRegion r = QApplication::qwsDecoration().region(q, cr) | cr; - QRect br(r.boundingRect()); - topextra->frameStrut.setCoords(cr.x() - br.x(), - cr.y() - br.y(), - br.right() - cr.right(), - br.bottom() - cr.bottom()); - if (!q->testAttribute(Qt::WA_Moved) || topextra->posFromMove) - data.crect.translate(topextra->frameStrut.left(), topextra->frameStrut.top()); - if (!topData()->qwsManager) { - topData()->qwsManager = new QWSManager(q); - if((q->data->window_state & ~Qt::WindowActive) == Qt::WindowMaximized) - topData()->qwsManager->maximize(); - } - - } else if (topData()->qwsManager) { - delete topData()->qwsManager; - topData()->qwsManager = 0; - data.crect.translate(-topextra->frameStrut.left(), -topextra->frameStrut.top()); - topextra->frameStrut.setCoords(0, 0, 0, 0); - } -#endif - if (!topextra->caption.isEmpty()) - setWindowTitle_helper(topextra->caption); - - //XXX If we are session managed, inform the window manager about it - } else { - if (extra && extra->topextra) { // already allocated due to reparent? - extra->topextra->frameStrut.setCoords(0, 0, 0, 0); - } - //updateRequestedRegion(mapToGlobal(QPoint(0,0))); - } -} - - -void QWidget::destroy(bool destroyWindow, bool destroySubWindows) -{ - Q_D(QWidget); - d->aboutToDestroy(); - if (!isWindow() && parentWidget()) - parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry())); - - d->deactivateWidgetCleanup(); - if (testAttribute(Qt::WA_WState_Created)) { - setAttribute(Qt::WA_WState_Created, false); - QObjectList childObjects = children(); - for (int i = 0; i < childObjects.size(); ++i) { - QObject *obj = childObjects.at(i); - if (obj->isWidgetType()) - static_cast(obj)->destroy(destroySubWindows, - destroySubWindows); - } - releaseMouse(); - if (qt_pressGrab == this) - qt_pressGrab = 0; - - if (keyboardGrb == this) - releaseKeyboard(); - if (testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal - QApplicationPrivate::leaveModal(this); - else if ((windowType() == Qt::Popup)) - qApp->d_func()->closePopup(this); -#ifndef QT_NO_IM - if (d->ic) { - delete d->ic; - d->ic =0; - } else { - // release previous focus information participating with - // preedit preservation of qic -- while we still have a winId - QInputContext *qic = QApplicationPrivate::inputContext; - if (qic) - qic->widgetDestroyed(this); - } -#endif //QT_NO_IM - - if ((windowType() == Qt::Desktop)) { - } else { - if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) { - d->hide_sys(); - } - if (destroyWindow && isWindow()) { - if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) - d->extra->topextra->backingStore->windowSurface->setGeometry(QRect()); - qwsDisplay()->destroyRegion(internalWinId()); - } - } - QT_TRY { - d->setWinId(0); - } QT_CATCH (const std::bad_alloc &) { - // swallow - destructors must not throw - } - } -} - - -void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) -{ - Q_Q(QWidget); - bool wasCreated = q->testAttribute(Qt::WA_WState_Created); - if (q->isVisible() && q->parentWidget() && parent != q->parentWidget()) - q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); -#ifndef QT_NO_CURSOR - QCursor oldcurs; - bool setcurs=q->testAttribute(Qt::WA_SetCursor); - if (setcurs) { - oldcurs = q->cursor(); - q->unsetCursor(); - } -#endif - - WId old_winid = data.winid; - if ((q->windowType() == Qt::Desktop)) - old_winid = 0; - - if (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_WState_Created)) - hide_sys(); - - setWinId(0); - - if (parent != newparent) { - QWidget *oldparent = q->parentWidget(); - QObjectPrivate::setParent_helper(newparent); - if (oldparent) { -// oldparent->d_func()->setChildrenAllocatedDirty(); -// oldparent->data->paintable_region_dirty = true; - } - if (newparent) { -// newparent->d_func()->setChildrenAllocatedDirty(); -// newparent->data->paintable_region_dirty = true; - //@@@@@@@ - } - } - Qt::FocusPolicy fp = q->focusPolicy(); - QSize s = q->size(); - //QBrush bgc = background(); // save colors - 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); - adjustFlags(data.window_flags, q); - // keep compatibility with previous versions, we need to preserve the created state - // (but we recreate the winId for the widget being reparented, again for compatibility) - if (wasCreated || (!q->isWindow() && newparent->testAttribute(Qt::WA_WState_Created))) - createWinId(); - if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden) - q->setAttribute(Qt::WA_WState_Hidden); - q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); - - if (q->isWindow()) { - QRect fs = frameStrut(); - data.crect = QRect(fs.left(), fs.top(), s.width(), s.height()); - if ((data.window_flags & Qt::FramelessWindowHint) && extra && extra->topextra) - extra->topextra->frameStrut.setCoords(0, 0, 0, 0); - } else { - data.crect = QRect(0, 0, s.width(), s.height()); - } - - q->setFocusPolicy(fp); - if (extra && !extra->mask.isEmpty()) { - QRegion r = extra->mask; - extra->mask = QRegion(); - q->setMask(r); - } - if ((int)old_winid > 0) { - QWidget::qwsDisplay()->destroyRegion(old_winid); - extra->topextra->backingStore->windowSurface->setGeometry(QRect()); - } -#ifndef QT_NO_CURSOR - if (setcurs) { - q->setCursor(oldcurs); - } -#endif -} - - -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); -} - -#if 0 // ##### -void QWidget::setMicroFocusHint(int x, int y, int width, int height, - bool text, QFont *) -{ - if (QRect(x, y, width, height) != microFocusHint()) { - d->createExtra(); - d->extra->micro_focus_hint.setRect(x, y, width, height); - } -#ifndef QT_NO_QWS_INPUTMETHODS - if (text) { - QWidget *tlw = window(); - int winid = tlw->internalWinId(); - QPoint p(x, y + height); - QPoint gp = mapToGlobal(p); - - QRect r = QRect(mapToGlobal(QPoint(0,0)), - size()); - - r.setBottom(tlw->geometry().bottom()); - - //qDebug("QWidget::setMicroFocusHint %d %d %d %d", r.x(), - // r.y(), r.width(), r.height()); - QInputContext::setMicroFocusWidget(this); - - qwsDisplay()->setIMInfo(winid, gp.x(), gp.y(), r); - - //send font info, ###if necessary - qwsDisplay()->setInputFont(winid, font()); - } -#endif -} -#endif - -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(); -} -#endif //QT_NO_CURSOR - -void QWidgetPrivate::setWindowTitle_sys(const QString &caption) -{ - Q_Q(QWidget); - QWidget::qwsDisplay()->setWindowCaption(q, caption); -} - -void QWidgetPrivate::setWindowIcon_sys(bool /*forceReset*/) -{ -#if 0 - QTLWExtra* x = d->topData(); - delete x->icon; - x->icon = 0; - QBitmap mask; - if (unscaledPixmap.isNull()) { - } else { - QImage unscaledIcon = unscaledPixmap.toImage(); - QPixmap pixmap = - QPixmap::fromImage(unscaledIcon.scale(16, 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); - x->icon = new QPixmap(pixmap); - mask = pixmap.mask() ? *pixmap.mask() : pixmap.createHeuristicMask(); - } -#endif -} - -void QWidgetPrivate::setWindowIconText_sys(const QString &iconText) -{ - Q_UNUSED(iconText); -} - -void QWidget::grabMouse() -{ - if (qt_mouseGrb) - qt_mouseGrb->releaseMouse(); - - qwsDisplay()->grabMouse(this,true); - - qt_mouseGrb = this; - qt_pressGrab = 0; -} - -#ifndef QT_NO_CURSOR -void QWidget::grabMouse(const QCursor &cursor) -{ - if (qt_mouseGrb) - qt_mouseGrb->releaseMouse(); - - qwsDisplay()->grabMouse(this,true); - qwsDisplay()->selectCursor(this, cursor.handle()); - qt_mouseGrb = this; - qt_pressGrab = 0; -} -#endif - -void QWidget::releaseMouse() -{ - if (qt_mouseGrb == this) { - qwsDisplay()->grabMouse(this,false); - qt_mouseGrb = 0; - } -} - -void QWidget::grabKeyboard() -{ - if (keyboardGrb) - keyboardGrb->releaseKeyboard(); - qwsDisplay()->grabKeyboard(this, true); - keyboardGrb = this; -} - -void QWidget::releaseKeyboard() -{ - if (keyboardGrb == this) { - 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() -{ - QWidget *tlw = window(); - if (tlw->isVisible()) { - Q_ASSERT(tlw->testAttribute(Qt::WA_WState_Created)); - qwsDisplay()->requestFocus(tlw->internalWinId(), true); - } -} - -void QWidgetPrivate::show_sys() -{ - Q_Q(QWidget); - q->setAttribute(Qt::WA_Mapped); - if (q->testAttribute(Qt::WA_DontShowOnScreen)) { - invalidateBuffer(q->rect()); - return; - } - - if (q->isWindow()) { - - - if (!q->testAttribute(Qt::WA_ShowWithoutActivating) - && q->windowType() != Qt::Popup - && q->windowType() != Qt::Tool - && q->windowType() != Qt::ToolTip) { - QWidget::qwsDisplay()->requestFocus(data.winid,true); - } - - - if (QWindowSurface *surface = q->windowSurface()) { - const QRect frameRect = q->frameGeometry(); - if (surface->geometry() != frameRect) - surface->setGeometry(frameRect); - } - - QRegion r = localRequestedRegion(); -#ifndef QT_NO_QWS_MANAGER - if (extra && extra->topextra && extra->topextra->qwsManager) { - r.translate(data.crect.topLeft()); - r += extra->topextra->qwsManager->region(); - r.translate(-data.crect.topLeft()); - } -#endif - data.fstrut_dirty = true; - invalidateBuffer(r); - bool staysontop = - (q->windowFlags() & Qt::WindowStaysOnTopHint) - || q->windowType() == Qt::Popup; - if (!staysontop && q->parentWidget()) { // if our parent stays on top, so must we - QWidget *ptl = q->parentWidget()->window(); - if (ptl && (ptl->windowFlags() & Qt::WindowStaysOnTopHint)) - staysontop = true; - } - - QWSChangeAltitudeCommand::Altitude altitude; - altitude = staysontop ? QWSChangeAltitudeCommand::StaysOnTop : QWSChangeAltitudeCommand::Raise; - QWidget::qwsDisplay()->setAltitude(data.winid, altitude, true); - if (!q->objectName().isEmpty()) { - QWidget::qwsDisplay()->setWindowCaption(q, q->windowTitle()); - } - } -#ifdef Q_BACKINGSTORE_SUBSURFACES - else if ( extra && extra->topextra && extra->topextra->windowSurface) { - QWSWindowSurface *surface; - surface = static_cast(q->windowSurface()); - const QPoint p = q->mapToGlobal(QPoint()); - surface->setGeometry(QRect(p, q->size())); - } -#endif - - if (!q->window()->data->in_show) { - invalidateBuffer(q->rect()); - } -} - - -void QWidgetPrivate::hide_sys() -{ - Q_Q(QWidget); - deactivateWidgetCleanup(); - - if (q->isWindow()) { - q->releaseMouse(); -// requestWindowRegion(QRegion()); - - if (extra->topextra->backingStore) - extra->topextra->backingStore->releaseBuffer(); - - - QWidget::qwsDisplay()->requestFocus(data.winid,false); - } else { - QWidget *p = q->parentWidget(); - if (p &&p->isVisible()) { - invalidateBuffer(q->rect()); - } - } -} - - - -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 QWidgetPrivate::setMaxWindowState_helper() -{ - // in_set_window_state is usually set in setWindowState(), but this - // function is used in other functions as well - // (e.g QApplicationPrivate::setMaxWindowRect()) - const uint old_state = data.in_set_window_state; - data.in_set_window_state = 1; - -#ifndef QT_NO_QWS_MANAGER - if (extra && extra->topextra && extra->topextra->qwsManager) - extra->topextra->qwsManager->maximize(); - else -#endif - { - Q_Q(QWidget); - const QDesktopWidget *desktop = QApplication::desktop(); - const int screen = desktop->screenNumber(q); - const QRect maxWindowRect = desktop->availableGeometry(screen); - q->setGeometry(maxWindowRect); - } - data.in_set_window_state = old_state; -} - -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; -} - -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); - //@@@ transaction - if (q->isWindow()) { - Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - QWidget::qwsDisplay()->setAltitude(q->internalWinId(), - QWSChangeAltitudeCommand::Raise); - // XXX: subsurfaces? -#ifdef QT_NO_WINDOWGROUPHINT -#else - QObjectList childObjects = q->children(); - if (!childObjects.isEmpty()) { - QWidgetList toraise; - for (int i = 0; i < childObjects.size(); ++i) { - QObject *obj = childObjects.at(i); - if (obj->isWidgetType()) { - QWidget* w = static_cast(obj); - if (w->isWindow()) - toraise.append(w); - } - } - - for (int i = 0; i < toraise.size(); ++i) { - QWidget *w = toraise.at(i); - if (w->isVisible()) - w->raise(); - } - } -#endif // QT_NO_WINDOWGROUPHINT - } -} - -void QWidgetPrivate::lower_sys() -{ - Q_Q(QWidget); - if (q->isWindow()) { - Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - QWidget::qwsDisplay()->setAltitude(data.winid, - QWSChangeAltitudeCommand::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::moveSurface(QWindowSurface *surface, const QPoint &offset) -{ - QWSWindowSurface *s = static_cast(surface); - if (!s->move(offset)) - s->invalidateBuffer(); - - QWSDisplay::instance()->moveRegion(s->winId(), offset.x(), offset.y()); -} - -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->windowType() == Qt::Desktop)) - return; - - if (q->isVisible()) { - - bool toplevelMove = false; - QWSWindowSurface *surface = 0; - - if (q->isWindow()) { - //### ConfigPending not implemented, do we need it? - //setAttribute(Qt::WA_WState_ConfigPending); - const QWidgetBackingStore *bs = maybeBackingStore(); - if (bs) - surface = static_cast(bs->windowSurface); - if (isMove && !isResize && surface) { - const QPoint offset(x - oldp.x(), y - oldp.y()); - moveSurface(surface, offset); - toplevelMove = true; //server moves window, but we must send moveEvent, which might trigger painting - -#ifdef Q_BACKINGSTORE_SUBSURFACES - QList surfaces = bs->subSurfaces; - for (int i = 0; i < surfaces.size(); ++i) - moveSurface(surfaces.at(i), offset); -#endif - } else { - updateFrameStrut(); - } - } - - if (!toplevelMove) { - if (q->isWindow()) { - if (surface) - surface->setGeometry(q->frameGeometry()); - else - invalidateBuffer(q->rect()); //### - -#ifdef Q_BACKINGSTORE_SUBSURFACES - // XXX: should not resize subsurfaces. Children within a layout - // will be resized automatically while children with a static - // geometry should get a new clip region instead. - const QRect clipRect = q->geometry(); - QWidgetBackingStore *bs = maybeBackingStore(); - QList surfaces = bs->subSurfaces; - for (int i = 0; i < surfaces.size(); ++i) { - QWSWindowSurface *s = static_cast(surfaces.at(i)); - QRect srect = s->geometry(); - s->setGeometry(clipRect & srect); - } -#endif - } -#ifdef Q_BACKINGSTORE_SUBSURFACES - // XXX: merge this case with the isWindow() case - else if (maybeTopData() && maybeTopData()->windowSurface) { - QWSWindowSurface *surface; - surface = static_cast(q->windowSurface()); - if (isMove && !isResize) { - moveSurface(surface, QPoint(x - oldp.x(), y - oldp.y())); - } else { - const QPoint p = q->mapToGlobal(QPoint()); - surface->setGeometry(QRect(p, QSize(w, h))); - } - } -#endif - else { - if (isMove && !isResize) - moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y()); - else - invalidateBuffer_resizeHelper(oldPos, olds); - } - } - - //### must have frame geometry correct before sending move/resize events - 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() -{ -} - -QScreen* QWidgetPrivate::getScreen() const -{ - Q_Q(const QWidget); - - const QList subScreens = qt_screen->subScreens(); - if (subScreens.isEmpty() || q->windowType() == Qt::Desktop) - return qt_screen; - - const int screen = QApplication::desktop()->screenNumber(q); - - return qt_screen->subScreens().at(screen < 0 ? 0 : screen); -} - -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); -} - -int QWidget::metric(PaintDeviceMetric m) const -{ - Q_D(const QWidget); - - int val; - if (m == PdmWidth) { - val = data->crect.width(); - } else if (m == PdmWidthMM) { - const QScreen *screen = d->getScreen(); - val = data->crect.width() * screen->physicalWidth() / screen->width(); - } else if (m == PdmHeight) { - val = data->crect.height(); - } else if (m == PdmHeightMM) { - const QScreen *screen = d->getScreen(); - val = data->crect.height() * screen->physicalHeight() / screen->height(); - } else if (m == PdmDepth) { - return qwsDisplay()->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); - const QScreen *screen = d->getScreen(); - return qRound(screen->width() / double(screen->physicalWidth() / 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); - const QScreen *screen = d->getScreen(); - return qRound(screen->height() / double(screen->physicalHeight() / 25.4)); - } else if (m == PdmNumColors) { - QScreen *screen = d->getScreen(); - int ret = screen->colorCount(); - if (!ret) { - const int depth = qwsDisplay()->depth(); - switch (depth) { - case 1: - ret = 2; - break; - case 8: - ret = 256; - break; - case 16: - ret = 65536; - break; - case 24: - ret = 16777216; - break; - case 32: - ret = 2147483647; - break; - } - } - return ret; - } else { - val = QPaintDevice::metric(m);// XXX - } - return val; -} - -void QWidgetPrivate::createSysExtra() -{ -} - -void QWidgetPrivate::deleteSysExtra() -{ -} - -void QWidgetPrivate::createTLSysExtra() -{ -#ifndef QT_NO_QWS_MANAGER - extra->topextra->qwsManager = 0; -#endif -} - -void QWidgetPrivate::deleteTLSysExtra() -{ -} - -void QWidgetPrivate::registerDropSite(bool on) -{ - Q_UNUSED(on); -} - -QRegion QWidgetPrivate::localRequestedRegion() const -{ - Q_Q(const QWidget); - QRegion r(q->rect()); - if (extra && !extra->mask.isEmpty()) - r &= extra->mask; - - return r; -} - -QRegion QWidgetPrivate::localAllocatedRegion() const -{ - Q_Q(const QWidget); - - QWidgetBackingStore *wbs = q->window()->d_func()->maybeBackingStore(); - - QWindowSurface *ws = wbs ? wbs->windowSurface : 0; - if (!ws) - return QRegion(); - QRegion r = static_cast(ws)->clipRegion(); - if (!q->isWindow()) { - QPoint off = q->mapTo(q->window(), QPoint()); - r &= localRequestedRegion().translated(off); - r.translate(-off); - } - return r; -} - -inline bool QRect::intersects(const QRect &r) const -{ - return (qMax(x1, r.x1) <= qMin(x2, r.x2) && - qMax(y1, r.y1) <= qMin(y2, r.y2)); -} - -void QWidgetPrivate::setMask_sys(const QRegion ®ion) -{ - Q_UNUSED(region); - Q_Q(QWidget); - - if (!q->isVisible() || !q->isWindow()) - return; - - data.fstrut_dirty = true; - invalidateBuffer(q->rect()); - QWindowSurface *surface = extra->topextra->backingStore->windowSurface; - if (surface) { - // QWSWindowSurface::setGeometry() returns without doing anything - // if old geom == new geom. Therefore, we need to reset the old value. - surface->QWindowSurface::setGeometry(QRect()); - surface->setGeometry(q->frameGeometry()); - } -} - -void QWidgetPrivate::updateFrameStrut() -{ - Q_Q(QWidget); - - if(!q->isVisible() || (q->windowType() == Qt::Desktop)) { - data.fstrut_dirty = q->isVisible(); - return; - } - -#ifndef QT_NO_QWS_MANAGER - if (extra && extra->topextra && extra->topextra->qwsManager) { - QTLWExtra *topextra = extra->topextra; - const QRect oldFrameStrut = topextra->frameStrut; - const QRect contents = data.crect; - QRegion r = localRequestedRegion().translated(contents.topLeft()); - r += extra->topextra->qwsManager->region(); - const QRect frame = r.boundingRect(); - - topextra->frameStrut.setCoords(contents.left() - frame.left(), - contents.top() - frame.top(), - frame.right() - contents.right(), - frame.bottom() - contents.bottom()); - topextra->qwsManager->repaintRegion(QDecoration::All, QDecoration::Normal); - } -#endif - data.fstrut_dirty = false; -} - -#ifndef QT_NO_CURSOR -void QWidgetPrivate::updateCursor() const -{ - Q_Q(const QWidget); - - if (QApplication::overrideCursor()) - return; - - if (qt_last_x - && (!QWidget::mouseGrabber() || QWidget::mouseGrabber() == q) - && qt_last_cursor != (WId)q->cursor().handle()) - { - const QPoint pos(*qt_last_x, *qt_last_y); - const QPoint offset = q->mapToGlobal(QPoint()); - if (!localAllocatedRegion().contains(pos - offset)) - return; - - const QWidget *w = q->childAt(q->mapFromGlobal(pos)); - if (!w || w->cursor().handle() == q->cursor().handle()) - QWidget::qwsDisplay()->selectCursor(const_cast(q), - q->cursor().handle()); - } -} -#endif - -void QWidgetPrivate::setWindowOpacity_sys(qreal level) -{ - Q_Q(QWidget); - Q_UNUSED(level); - createWinId(); - QWidget::qwsDisplay()->setOpacity(q->data->winid, topData()->opacity); -} - -//static QSingleCleanupHandler qt_paintengine_cleanup_handler; -//static QWSPaintEngine *qt_widget_paintengine = 0; -QPaintEngine *QWidget::paintEngine() const -{ - qWarning("QWidget::paintEngine: Should no longer be called"); - return 0; //##### @@@ -// if (!qt_widget_paintengine) { -// qt_widget_paintengine = new QRasterPaintEngine(); -// qt_paintengine_cleanup_handler.set(&qt_widget_paintengine); -// } -// if (qt_widget_paintengine->isActive()) { -// if (d->extraPaintEngine) -// return d->extraPaintEngine; -// const_cast(this)->d_func()->extraPaintEngine = new QRasterPaintEngine(); -// return d->extraPaintEngine; -// } -// return qt_widget_paintengine; -} - -QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() -{ - Q_Q(QWidget); - if (q->windowType() == Qt::Desktop) - return 0; - q->ensurePolished(); - return qt_screen->createSurface(q); -} - -void QWidgetPrivate::setModal_sys() -{ -} - - -QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp new file mode 100644 index 00000000000..9bf58e16566 --- /dev/null +++ b/src/gui/kernel/qwindow.cpp @@ -0,0 +1,701 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindow.h" + +#include "qplatformwindow_qpa.h" +#include "qsurfaceformat.h" +#include "qplatformopenglcontext_qpa.h" +#include "qopenglcontext.h" +#include "qscreen.h" + +#include "qwindow_p.h" +#include "qguiapplication_p.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +QWindow::QWindow(QScreen *targetScreen) + : QObject(*new QWindowPrivate(), 0) + , QSurface(QSurface::Window) +{ + Q_D(QWindow); + d->screen = targetScreen; + if (!d->screen) + d->screen = QGuiApplication::primaryScreen(); + QGuiApplicationPrivate::window_list.prepend(this); +} + +QWindow::QWindow(QWindow *parent) + : QObject(*new QWindowPrivate(), parent) + , QSurface(QSurface::Window) +{ + Q_D(QWindow); + d->parentWindow = parent; + if (parent) + d->screen = parent->screen(); + if (!d->screen) + d->screen = QGuiApplication::primaryScreen(); + QGuiApplicationPrivate::window_list.prepend(this); +} + +QWindow::QWindow(QWindowPrivate &dd, QWindow *parent) + : QObject(dd, parent) + , QSurface(QSurface::Window) +{ + Q_D(QWindow); + d->parentWindow = parent; + if (parent) + d->screen = parent->screen(); + if (!d->screen) + d->screen = QGuiApplication::primaryScreen(); + QGuiApplicationPrivate::window_list.prepend(this); +} + +QWindow::~QWindow() +{ + if (QGuiApplicationPrivate::active_window == this) + QGuiApplicationPrivate::active_window = 0; + QGuiApplicationPrivate::window_list.removeAll(this); + destroy(); +} + +QSurface::~QSurface() +{ +} + +void QWindow::setSurfaceType(SurfaceType surfaceType) +{ + Q_D(QWindow); + d->surfaceType = surfaceType; +} + +QWindow::SurfaceType QWindow::surfaceType() const +{ + Q_D(const QWindow); + return d->surfaceType; +} + +void QWindow::setVisible(bool visible) +{ + Q_D(QWindow); + + if (d->visible == visible) + return; + d->visible = visible; + + if (!d->platformWindow) + create(); + + if (visible) { + QShowEvent showEvent; + QGuiApplication::sendEvent(this, &showEvent); + } + + d->platformWindow->setVisible(visible); + + if (!visible) { + QHideEvent hideEvent; + QGuiApplication::sendEvent(this, &hideEvent); + } +} + +bool QWindow::visible() const +{ + Q_D(const QWindow); + + return d->visible; +} + +void QWindow::create() +{ + Q_D(QWindow); + if (!d->platformWindow) { + d->platformWindow = QGuiApplicationPrivate::platformIntegration()->createPlatformWindow(this); + QObjectList childObjects = children(); + for (int i = 0; i < childObjects.size(); i ++) { + QObject *object = childObjects.at(i); + if(object->isWindowType()) { + QWindow *window = static_cast(object); + if (window->d_func()->platformWindow) + window->d_func()->platformWindow->setParent(d->platformWindow); + } + } + } +} + +WId QWindow::winId() const +{ + Q_D(const QWindow); + if(!d->platformWindow) + const_cast(this)->create(); + return d->platformWindow->winId(); +} + +QWindow *QWindow::parent() const +{ + Q_D(const QWindow); + return d->parentWindow; +} + +/** + Sets the parent Window. This will lead to the windowing system managing the clip of the window, so it will be clipped to the parent window. + Setting parent to be 0(NULL) means map it as a top level window. If the parent window has grabbed its window system resources, then the current window will also grab its window system resources. + **/ + +void QWindow::setParent(QWindow *parent) +{ + Q_D(QWindow); + + QObject::setParent(parent); + + if (d->platformWindow) { + if (parent && parent->d_func()->platformWindow) { + d->platformWindow->setParent(parent->d_func()->platformWindow); + } else { + d->platformWindow->setParent(0); + } + } + + d->parentWindow = parent; +} + +/*! + Returns whether the window is top level, i.e. has no parent window. + */ +bool QWindow::isTopLevel() const +{ + Q_D(const QWindow); + return d->parentWindow == 0; +} + +bool QWindow::isModal() const +{ + Q_D(const QWindow); + return d->modality != Qt::NonModal; +} + +Qt::WindowModality QWindow::windowModality() const +{ + Q_D(const QWindow); + return d->modality; +} + +void QWindow::setWindowModality(Qt::WindowModality windowModality) +{ + Q_D(QWindow); + d->modality = windowModality; +} + +void QWindow::setFormat(const QSurfaceFormat &format) +{ + Q_D(QWindow); + d->requestedFormat = format; +} + +QSurfaceFormat QWindow::format() const +{ + Q_D(const QWindow); + if (d->platformWindow) + return d->platformWindow->format(); + return d->requestedFormat; +} + +void QWindow::setWindowFlags(Qt::WindowFlags flags) +{ + Q_D(QWindow); + if (d->platformWindow) + d->windowFlags = d->platformWindow->setWindowFlags(flags); + else + d->windowFlags = flags; +} + +Qt::WindowFlags QWindow::windowFlags() const +{ + Q_D(const QWindow); + return d->windowFlags; +} + +Qt::WindowType QWindow::windowType() const +{ + Q_D(const QWindow); + return static_cast(int(d->windowFlags & Qt::WindowType_Mask)); +} + +void QWindow::setWindowTitle(const QString &title) +{ + Q_D(QWindow); + d->windowTitle = title; + if (d->platformWindow) { + d->platformWindow->setWindowTitle(title); + } +} + +QString QWindow::windowTitle() const +{ + Q_D(const QWindow); + return d->windowTitle; +} + +void QWindow::raise() +{ + Q_D(QWindow); + if (d->platformWindow) { + d->platformWindow->raise(); + } +} + +void QWindow::lower() +{ + Q_D(QWindow); + if (d->platformWindow) { + d->platformWindow->lower(); + } +} + +void QWindow::setOpacity(qreal level) +{ + Q_D(QWindow); + if (d->platformWindow) { + d->platformWindow->setOpacity(level); + } +} + +void QWindow::requestActivateWindow() +{ + Q_D(QWindow); + QGuiApplicationPrivate::active_window = this; + if (d->platformWindow) { + d->platformWindow->requestActivateWindow(); + } +} + +Qt::WindowState QWindow::windowState() const +{ + Q_D(const QWindow); + return d->windowState; +} + +void QWindow::setWindowState(Qt::WindowState state) +{ + if (state == Qt::WindowActive) { + requestActivateWindow(); + return; + } + + Q_D(QWindow); + if (d->platformWindow) + d->windowState = d->platformWindow->setWindowState(state); + else + d->windowState = state; +} + +/*! + Sets the transient parent, which is a hint to the window manager that this window is a dialog or pop-up on behalf of the given window. +*/ +void QWindow::setTransientParent(QWindow *parent) +{ + Q_D(QWindow); + d->transientParent = parent; +} + +QWindow *QWindow::transientParent() const +{ + Q_D(const QWindow); + return d->transientParent.data(); +} + +QSize QWindow::minimumSize() const +{ + Q_D(const QWindow); + return d->minimumSize; +} + +QSize QWindow::maximumSize() const +{ + Q_D(const QWindow); + return d->maximumSize; +} + +QSize QWindow::baseSize() const +{ + Q_D(const QWindow); + return d->baseSize; +} + +QSize QWindow::sizeIncrement() const +{ + Q_D(const QWindow); + return d->sizeIncrement; +} + +void QWindow::setMinimumSize(const QSize &size) +{ + Q_D(QWindow); + QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); + if (d->minimumSize == adjustedSize) + return; + d->minimumSize = adjustedSize; + if (d->platformWindow && isTopLevel()) + d->platformWindow->propagateSizeHints(); +} + +void QWindow::setMaximumSize(const QSize &size) +{ + Q_D(QWindow); + QSize adjustedSize = QSize(qBound(0, size.width(), QWINDOWSIZE_MAX), qBound(0, size.height(), QWINDOWSIZE_MAX)); + if (d->maximumSize == adjustedSize) + return; + d->maximumSize = adjustedSize; + if (d->platformWindow && isTopLevel()) + d->platformWindow->propagateSizeHints(); +} + +void QWindow::setBaseSize(const QSize &size) +{ + Q_D(QWindow); + if (d->baseSize == size) + return; + d->baseSize = size; + if (d->platformWindow && isTopLevel()) + d->platformWindow->propagateSizeHints(); +} + +void QWindow::setSizeIncrement(const QSize &size) +{ + Q_D(QWindow); + if (d->sizeIncrement == size) + return; + d->sizeIncrement = size; + if (d->platformWindow && isTopLevel()) + d->platformWindow->propagateSizeHints(); +} + +void QWindow::setGeometry(const QRect &rect) +{ + Q_D(QWindow); + if (d->platformWindow) { + d->platformWindow->setGeometry(rect); + } else { + d->geometry = rect; + } +} + +QRect QWindow::geometry() const +{ + Q_D(const QWindow); + return d->geometry; +} + +QMargins QWindow::frameMargins() const +{ + Q_D(const QWindow); + if (d->platformWindow) + return d->platformWindow->frameMargins(); + return QMargins(); +} + +void QWindow::setWindowIcon(const QImage &icon) const +{ + Q_UNUSED(icon); + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::destroy() +{ + Q_D(QWindow); + setVisible(false); + delete d->platformWindow; + d->platformWindow = 0; +} + +QPlatformWindow *QWindow::handle() const +{ + Q_D(const QWindow); + return d->platformWindow; +} + +QPlatformSurface *QWindow::surfaceHandle() const +{ + Q_D(const QWindow); + return d->platformWindow; +} + +bool QWindow::setKeyboardGrabEnabled(bool grab) +{ + Q_D(QWindow); + if (d->platformWindow) + return d->platformWindow->setKeyboardGrabEnabled(grab); + return false; +} + +bool QWindow::setMouseGrabEnabled(bool grab) +{ + Q_D(QWindow); + if (d->platformWindow) + return d->platformWindow->setMouseGrabEnabled(grab); + return false; +} + +QScreen *QWindow::screen() const +{ + Q_D(const QWindow); + return d->screen; +} + +void QWindow::setScreen(QScreen *newScreen) +{ + Q_D(QWindow); + bool wasCreated = d->platformWindow != 0; + if (wasCreated) + destroy(); + d->screen = newScreen ? newScreen : QGuiApplication::primaryScreen(); + if (wasCreated) + create(); +} + +void QWindow::showMinimized() +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::showMaximized() +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::showFullScreen() +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::showNormal() +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +bool QWindow::close() +{ + //should we have close? + qDebug() << "unimplemented:" << __FILE__ << __LINE__; + return true; +} + +void QWindow::exposeEvent(QExposeEvent *) +{ +} + +void QWindow::resizeEvent(QResizeEvent *) +{ +} + +void QWindow::showEvent(QShowEvent *) +{ +} + +void QWindow::hideEvent(QHideEvent *) +{ +} + +bool QWindow::event(QEvent *event) +{ + switch (event->type()) { + case QEvent::MouseMove: + mouseMoveEvent(static_cast(event)); + break; + + case QEvent::MouseButtonPress: + mousePressEvent(static_cast(event)); + break; + + case QEvent::MouseButtonRelease: + mouseReleaseEvent(static_cast(event)); + break; + + case QEvent::MouseButtonDblClick: + mouseDoubleClickEvent(static_cast(event)); + break; + + case QEvent::Resize: + resizeEvent(static_cast(event)); + break; + + case QEvent::KeyPress: + keyPressEvent(static_cast(event)); + break; + + case QEvent::KeyRelease: + keyReleaseEvent(static_cast(event)); + break; + +#ifndef QT_NO_WHEELEVENT + case QEvent::Wheel: + wheelEvent(static_cast(event)); + break; +#endif + + case QEvent::Close: { + Q_D(QWindow); + bool wasVisible = visible(); + destroy(); + if (wasVisible) + d->maybeQuitOnLastWindowClosed(); + break; } + + case QEvent::Expose: + exposeEvent(static_cast(event)); + break; + + case QEvent::Show: + showEvent(static_cast(event)); + break; + + case QEvent::Hide: + hideEvent(static_cast(event)); + break; + + default: + return QObject::event(event); + } + return true; +} + +void QWindow::keyPressEvent(QKeyEvent *) +{ +} + +void QWindow::keyReleaseEvent(QKeyEvent *) +{ +} + +void QWindow::inputMethodEvent(QInputMethodEvent *) +{ +} + +void QWindow::mousePressEvent(QMouseEvent *) +{ +} + +void QWindow::mouseReleaseEvent(QMouseEvent *) +{ +} + +void QWindow::mouseDoubleClickEvent(QMouseEvent *) +{ +} + +void QWindow::mouseMoveEvent(QMouseEvent *) +{ +} + +#ifndef QT_NO_WHEELEVENT +void QWindow::wheelEvent(QWheelEvent *) +{ +} +#endif //QT_NO_WHEELEVENT + + + +/*! + \fn QPoint QWindow::mapToGlobal(const QPoint &pos) const + + Translates the window coordinate \a pos to global screen + coordinates. For example, \c{mapToGlobal(QPoint(0,0))} would give + the global coordinates of the top-left pixel of the window. + + \sa mapFromGlobal() +*/ + +QPoint QWindow::mapToGlobal(const QPoint &pos) const +{ + return pos + d_func()->globalPosition(); +} + + + +/*! + \fn QPoint QWindow::mapFromGlobal(const QPoint &pos) const + + Translates the global screen coordinate \a pos to window + coordinates. + + \sa mapToGlobal() +*/ + +QPoint QWindow::mapFromGlobal(const QPoint &pos) const +{ + return pos - d_func()->globalPosition(); +} + + + +Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window) +{ + return window->d_func(); +} + +void QWindowPrivate::maybeQuitOnLastWindowClosed() +{ + Q_Q(QWindow); + + // Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent + bool quitOnClose = QGuiApplication::quitOnLastWindowClosed() && !q->parent(); + + if (quitOnClose) { + QWindowList list = QGuiApplication::topLevelWindows(); + bool lastWindowClosed = true; + for (int i = 0; i < list.size(); ++i) { + QWindow *w = list.at(i); + if (!w->visible() || w->parent()) + continue; + lastWindowClosed = false; + break; + } + if (lastWindowClosed) + QGuiApplicationPrivate::emitLastWindowClosed(); + } + +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h new file mode 100644 index 00000000000..a6604aa9515 --- /dev/null +++ b/src/gui/kernel/qwindow.h @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOW_QPA_H +#define QWINDOW_QPA_H + +#include +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWindowPrivate; + +class QExposeEvent; +class QResizeEvent; +class QShowEvent; +class QHideEvent; +class QKeyEvent; +class QInputMethodEvent; +class QMouseEvent; +#ifndef QT_NO_WHEELEVENT +class QWheelEvent; +#endif + +class QPlatformSurface; +class QPlatformWindow; +class QBackingStore; +class QScreen; + +class Q_GUI_EXPORT QWindow : public QObject, public QSurface +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWindow) + + Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) + +public: + enum SurfaceType { RasterSurface, OpenGLSurface }; + + QWindow(QScreen *screen = 0); + QWindow(QWindow *parent); + virtual ~QWindow(); + + void setSurfaceType(SurfaceType surfaceType); + SurfaceType surfaceType() const; + + void setVisible(bool visible); + bool visible() const; + + void create(); + + WId winId() const; + + QWindow *parent() const; + void setParent(QWindow *parent); + + bool isTopLevel() const; + + bool isModal() const; + Qt::WindowModality windowModality() const; + void setWindowModality(Qt::WindowModality windowModality); + + void setFormat(const QSurfaceFormat &format); + QSurfaceFormat format() const; + + void setWindowFlags(Qt::WindowFlags flags); + Qt::WindowFlags windowFlags() const; + Qt::WindowType windowType() const; + + QString windowTitle() const; + + void setOpacity(qreal level); + void requestActivateWindow(); + + Qt::WindowState windowState() const; + void setWindowState(Qt::WindowState state); + + void setTransientParent(QWindow *parent); + QWindow *transientParent() const; + + QSize minimumSize() const; + QSize maximumSize() const; + QSize baseSize() const; + QSize sizeIncrement() const; + + void setMinimumSize(const QSize &size); + void setMaximumSize(const QSize &size); + void setBaseSize(const QSize &size); + void setSizeIncrement(const QSize &size); + + void setGeometry(int x, int y, int w, int h) { setGeometry(QRect(x, y, w, h)); } + void setGeometry(const QRect &rect); + QRect geometry() const; + + inline int width() const { return geometry().width(); } + inline int height() const { return geometry().height(); } + inline int x() const { return geometry().x(); } + inline int y() const { return geometry().y(); } + + inline QSize size() const { return geometry().size(); } + inline QPoint pos() const { return geometry().topLeft(); } + + inline void move(const QPoint &pt) { setGeometry(QRect(pt, size())); } + inline void move(int x, int y) { move(QPoint(x, y)); } + + inline void resize(const QSize &size) { setGeometry(QRect(pos(), size)); } + inline void resize(int w, int h) { setGeometry(QRect(x(), y(), w, h)); } + + QMargins frameMargins() const; + + void setWindowIcon(const QImage &icon) const; + + void destroy(); + + QPlatformWindow *handle() const; + + bool setKeyboardGrabEnabled(bool grab); + bool setMouseGrabEnabled(bool grab); + + QScreen *screen() const; + void setScreen(QScreen *screen); + + QPoint mapToGlobal(const QPoint &pos) const; + QPoint mapFromGlobal(const QPoint &pos) const; + +public Q_SLOTS: + inline void show() { setVisible(true); } + inline void hide() { setVisible(false); } + + void showMinimized(); + void showMaximized(); + void showFullScreen(); + void showNormal(); + + bool close(); + void raise(); + void lower(); + + void setWindowTitle(const QString &); + +Q_SIGNALS: + void backBufferReady(); + +protected: + virtual void exposeEvent(QExposeEvent *); + virtual void resizeEvent(QResizeEvent *); + + virtual void showEvent(QShowEvent *); + virtual void hideEvent(QHideEvent *); + + virtual bool event(QEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + virtual void inputMethodEvent(QInputMethodEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); +#ifndef QT_NO_WHEELEVENT + virtual void wheelEvent(QWheelEvent *); +#endif + + QWindow(QWindowPrivate &dd, QWindow *parent); + +private: + QPlatformSurface *surfaceHandle() const; + + Q_DISABLE_COPY(QWindow) + + friend class QGuiApplication; + friend class QGuiApplicationPrivate; + friend Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWINDOW_QPA_H diff --git a/src/gui/kernel/qplatformeventloopintegration_qpa.h b/src/gui/kernel/qwindow_p.h similarity index 56% rename from src/gui/kernel/qplatformeventloopintegration_qpa.h rename to src/gui/kernel/qwindow_p.h index 16a7cfdc6c5..38b90fdd736 100644 --- a/src/gui/kernel/qplatformeventloopintegration_qpa.h +++ b/src/gui/kernel/qwindow_p.h @@ -39,11 +39,12 @@ ** ****************************************************************************/ -#ifndef QPLATFORMEVENTLOOPINTEGRATION_QPA_H -#define QPLATFORMEVENTLOOPINTEGRATION_QPA_H +#ifndef QWINDOW_QPA_P_H +#define QWINDOW_QPA_P_H -#include -#include +#include + +#include QT_BEGIN_HEADER @@ -51,32 +52,67 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class QPlatformEventLoopIntegrationPrivate; +#define QWINDOWSIZE_MAX ((1<<24)-1) -class Q_GUI_EXPORT QPlatformEventLoopIntegration +class Q_GUI_EXPORT QWindowPrivate : public QObjectPrivate { - Q_DECLARE_PRIVATE(QPlatformEventLoopIntegration); + Q_DECLARE_PUBLIC(QWindow) + public: - QPlatformEventLoopIntegration(); - virtual ~QPlatformEventLoopIntegration(); + QWindowPrivate() + : QObjectPrivate() + , surfaceType(QWindow::RasterSurface) + , windowFlags(Qt::Window) + , parentWindow(0) + , platformWindow(0) + , visible(false) + , windowState(Qt::WindowNoState) + , maximumSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX) + , modality(Qt::NonModal) + , transientParent(0) + , screen(0) + { + isWindow = true; + } - virtual void startEventLoop() = 0; - virtual void quitEventLoop() = 0; - virtual void qtNeedsToProcessEvents() = 0; + ~QWindowPrivate() + { + } - qint64 nextTimerEvent() const; - void setNextTimerEvent(qint64 nextTimerEvent); + void maybeQuitOnLastWindowClosed(); - static void processEvents(); -protected: - QScopedPointer d_ptr; -private: - Q_DISABLE_COPY(QPlatformEventLoopIntegration); - friend class QEventDispatcherQPA; + QPoint globalPosition() const { + Q_Q(const QWindow); + QPoint offset = q->pos(); + for (const QWindow *p = q->parent(); p; p = p->parent()) + offset += p->pos(); + return offset; + } + + + QWindow::SurfaceType surfaceType; + Qt::WindowFlags windowFlags; + QWindow *parentWindow; + QPlatformWindow *platformWindow; + bool visible; + QSurfaceFormat requestedFormat; + QString windowTitle; + QRect geometry; + Qt::WindowState windowState; + + QSize minimumSize; + QSize maximumSize; + QSize baseSize; + QSize sizeIncrement; + + Qt::WindowModality modality; + QPointer transientParent; + QScreen *screen; }; + QT_END_NAMESPACE QT_END_HEADER -#endif // QPLATFORMEVENTLOOPINTEGRATION_QPA_H +#endif // QWINDOW_QPA_P_H diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h index 6b24ddeb1a3..165b62da8fd 100644 --- a/src/gui/kernel/qwindowdefs.h +++ b/src/gui/kernel/qwindowdefs.h @@ -54,12 +54,10 @@ QT_MODULE(Gui) class QPaintDevice; class QWidget; +class QWindow; class QDialog; class QColor; class QPalette; -#ifdef QT3_SUPPORT -class QColorGroup; -#endif class QCursor; class QPoint; class QSize; @@ -78,7 +76,6 @@ class QBitmap; class QMovie; class QImage; class QPicture; -class QPrinter; class QTimer; class QTime; class QClipboard; @@ -88,6 +85,7 @@ class QApplication; template class QList; typedef QList QWidgetList; +typedef QList QWindowList; QT_END_NAMESPACE QT_END_HEADER @@ -106,9 +104,9 @@ typedef long WId; #endif // Q_WS_MAC -#if defined(Q_WS_WIN) -#include -#endif // Q_WS_WIN +#if defined(Q_OS_WIN) +# include +#endif // Q_OS_WIN #if defined(Q_WS_X11) diff --git a/src/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h index 396853e609b..2bf9c8e6729 100644 --- a/src/gui/kernel/qwindowdefs_win.h +++ b/src/gui/kernel/qwindowdefs_win.h @@ -115,15 +115,13 @@ typedef long HRESULT; #endif typedef struct tagMSG MSG; -typedef HWND WId; - QT_BEGIN_NAMESPACE Q_CORE_EXPORT HINSTANCE qWinAppInst(); Q_CORE_EXPORT HINSTANCE qWinAppPrevInst(); Q_CORE_EXPORT int qWinAppCmdShow(); -Q_GUI_EXPORT HDC qt_win_display_dc(); +Q_WIDGETS_EXPORT HDC qt_win_display_dc(); QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index 5ae30148d3c..d862d05baa5 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -40,8 +40,9 @@ ****************************************************************************/ #include "qwindowsysteminterface_qpa.h" #include "qwindowsysteminterface_qpa_p.h" -#include "qapplication_p.h" +#include "private/qguiapplication_p.h" #include +#include QT_BEGIN_NAMESPACE @@ -56,51 +57,49 @@ QTime QWindowSystemInterfacePrivate::eventTime; QList QWindowSystemInterfacePrivate::windowSystemEventQueue; QMutex QWindowSystemInterfacePrivate::queueMutex; -extern QPointer qt_last_mouse_receiver; +extern QPointer qt_last_mouse_receiver; -void QWindowSystemInterface::handleEnterEvent(QWidget *tlw) +void QWindowSystemInterface::handleEnterEvent(QWindow *tlw) { if (tlw) { - QWidgetData *data = qt_qwidget_data(tlw); - if (data->in_destructor) - return; - QWindowSystemInterfacePrivate::EnterEvent *e = new QWindowSystemInterfacePrivate::EnterEvent(tlw); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } } -void QWindowSystemInterface::handleLeaveEvent(QWidget *tlw) +void QWindowSystemInterface::handleLeaveEvent(QWindow *tlw) { - 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::handleWindowActivated(QWidget *tlw) +void QWindowSystemInterface::handleWindowActivated(QWindow *tlw) { QWindowSystemInterfacePrivate::ActivatedWindowEvent *e = new QWindowSystemInterfacePrivate::ActivatedWindowEvent(tlw); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } -void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect) +void QWindowSystemInterface::handleWindowStateChanged(QWindow *tlw, Qt::WindowState newState) +{ + QWindowSystemInterfacePrivate::WindowStateChangedEvent *e = + new QWindowSystemInterfacePrivate::WindowStateChangedEvent(tlw, newState); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect) { - if (tlw) { - QWidgetData *data = qt_qwidget_data(tlw); - if (data->in_destructor) - return; - } QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } +void QWindowSystemInterface::handleSynchronousGeometryChange(QWindow *tlw, const QRect &newRect) +{ + QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect); + QGuiApplicationPrivate::processWindowSystemEvent(e); // send event immediately. +} -void QWindowSystemInterface::handleCloseEvent(QWidget *tlw) +void QWindowSystemInterface::handleCloseEvent(QWindow *tlw) { if (tlw) { QWindowSystemInterfacePrivate::CloseEvent *e = @@ -115,42 +114,31 @@ void QWindowSystemInterface::handleCloseEvent(QWidget *tlw) */ -void QWindowSystemInterface::handleMouseEvent(QWidget *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b) { +void QWindowSystemInterface::handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); handleMouseEvent(w, time, local, global, b); } -void QWindowSystemInterface::handleMouseEvent(QWidget *tlw, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b) +void QWindowSystemInterface::handleMouseEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b) { - 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); } -void QWindowSystemInterface::handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) { +void QWindowSystemInterface::handleKeyEvent(QWindow *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) +void QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) { - 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); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } -void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, +void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text, bool autorep, @@ -161,38 +149,26 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *w, QEvent::Type typ text, autorep, count); } -void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, int key, +void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text, bool autorep, ushort count) { - if (tlw) { - QWidgetData *data = qt_qwidget_data(tlw); - if (data->in_destructor) - tlw = 0; - } - QWindowSystemInterfacePrivate::KeyEvent * e = new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } -void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) { +void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & 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 QPointF & local, const QPointF & global, int d, Qt::Orientation o) +void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) { - 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); QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); @@ -224,17 +200,17 @@ void QWindowSystemInterfacePrivate::queueWindowSystemEvent(QWindowSystemInterfac windowSystemEventQueue.append(ev); queueMutex.unlock(); - QAbstractEventDispatcher *dispatcher = QApplicationPrivate::qt_qpa_core_dispatcher(); + QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher(); if (dispatcher) dispatcher->wakeUp(); } -void QWindowSystemInterface::handleTouchEvent(QWidget *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points) { +void QWindowSystemInterface::handleTouchEvent(QWindow *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) +void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points) { if (!points.size()) // Touch events must have at least one point return; @@ -288,4 +264,70 @@ void QWindowSystemInterface::handleScreenCountChange(int count) QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } +void QWindowSystemInterface::handleMapEvent(QWindow *tlw) +{ + QWindowSystemInterfacePrivate::MapEvent *e = new QWindowSystemInterfacePrivate::MapEvent(tlw); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +void QWindowSystemInterface::handleUnmapEvent(QWindow *tlw) +{ + QWindowSystemInterfacePrivate::UnmapEvent *e = new QWindowSystemInterfacePrivate::UnmapEvent(tlw); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + +void QWindowSystemInterface::handleSynchronousExposeEvent(QWindow *tlw, const QRegion ®ion) +{ + QWindowSystemInterfacePrivate::ExposeEvent *e = new QWindowSystemInterfacePrivate::ExposeEvent(tlw, region); + QGuiApplicationPrivate::processWindowSystemEvent(e); // send event immediately. +} + +bool QWindowSystemInterface::sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags) +{ + int nevents = 0; + + // handle gui and posted events + QCoreApplication::sendPostedEvents(); + + while (true) { + QWindowSystemInterfacePrivate::WindowSystemEvent *event; + if (!(flags & QEventLoop::ExcludeUserInputEvents) + && QWindowSystemInterfacePrivate::windowSystemEventsQueued() > 0) { + // process a pending user input event + event = QWindowSystemInterfacePrivate::getWindowSystemEvent(); + if (!event) + break; + } else { + break; + } + + if (eventDispatcher->filterEvent(event)) { + delete event; + continue; + } + + nevents++; + + QGuiApplicationPrivate::processWindowSystemEvent(event); + delete event; + } + + return (nevents > 0); +} + +int QWindowSystemInterface::windowSystemEventsQueued() +{ + return QWindowSystemInterfacePrivate::windowSystemEventsQueued(); +} + +Qt::DropAction QWindowSystemInterface::handleDrag(QWindow *w, QMimeData *dropData, const QPoint &p) +{ + return QGuiApplicationPrivate::processDrag(w, dropData, p); +} + +Qt::DropAction QWindowSystemInterface::handleDrop(QWindow *w, QMimeData *dropData, const QPoint &p) +{ + return QGuiApplicationPrivate::processDrop(w, dropData, p); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 5a811b90c15..99db5f2b17c 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -44,39 +44,43 @@ #include #include #include -#include +#include +#include #include #include #include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE +class QMimeData; + QT_MODULE(Gui) class Q_GUI_EXPORT QWindowSystemInterface { public: - static void handleMouseEvent(QWidget *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b); - static void handleMouseEvent(QWidget *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b); + static void handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b); + static void handleMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & 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 handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); + static void handleKeyEvent(QWindow *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); - static void handleExtendedKeyEvent(QWidget *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + static void handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text = QString(), bool autorep = false, ushort count = 1); - static void handleExtendedKeyEvent(QWidget *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + static void handleExtendedKeyEvent(QWindow *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text = QString(), bool autorep = false, ushort count = 1); - static void handleWheelEvent(QWidget *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o); - static void handleWheelEvent(QWidget *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o); + static void handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o); + static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o); struct TouchPoint { int id; // for application use @@ -87,19 +91,34 @@ public: Qt::TouchPointState 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); + static void handleTouchEvent(QWindow *w, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points); + static void handleTouchEvent(QWindow *w, ulong timestamp, QEvent::Type type, QTouchEvent::DeviceType devType, const QList &points); - static void handleGeometryChange(QWidget *w, const QRect &newRect); - static void handleCloseEvent(QWidget *w); - static void handleEnterEvent(QWidget *w); - static void handleLeaveEvent(QWidget *w); - static void handleWindowActivated(QWidget *w); + static void handleGeometryChange(QWindow *w, const QRect &newRect); + static void handleSynchronousGeometryChange(QWindow *w, const QRect &newRect); + static void handleCloseEvent(QWindow *w); + static void handleEnterEvent(QWindow *w); + static void handleLeaveEvent(QWindow *w); + static void handleWindowActivated(QWindow *w); + static void handleWindowStateChanged(QWindow *w, Qt::WindowState newState); + + static void handleMapEvent(QWindow *w); + static void handleUnmapEvent(QWindow *w); + + static void handleSynchronousExposeEvent(QWindow *tlw, const QRegion ®ion); + + // Drag and drop. These events are sent immediately. + static Qt::DropAction handleDrag(QWindow *w, QMimeData *dropData, const QPoint &p); + static Qt::DropAction handleDrop(QWindow *w, QMimeData *dropData, const QPoint &p); // Changes to the screen static void handleScreenGeometryChange(int screenIndex); static void handleScreenAvailableGeometryChange(int screenIndex); static void handleScreenCountChange(int count); + + // For event dispatcher implementations + static bool sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags); + static int windowSystemEventsQueued(); }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 385175cc602..352092d066e 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -55,73 +55,87 @@ public: Enter, Leave, ActivatedWindow, + WindowStateChanged, Mouse, Wheel, Key, Touch, ScreenGeometry, ScreenAvailableGeometry, - ScreenCountChange + ScreenCountChange, + Map, + Unmap, + Expose }; class WindowSystemEvent { public: - WindowSystemEvent(EventType t) + explicit WindowSystemEvent(EventType t) : type(t) { } EventType type; }; class CloseEvent : public WindowSystemEvent { public: - CloseEvent(QWidget *tlw) - : WindowSystemEvent(Close), topLevel(tlw) { } - QWeakPointer topLevel; + explicit CloseEvent(QWindow *w) + : WindowSystemEvent(Close), window(w) { } + QWeakPointer window; }; class GeometryChangeEvent : public WindowSystemEvent { public: - GeometryChangeEvent(QWidget *tlw, const QRect &newGeometry) + GeometryChangeEvent(QWindow *tlw, const QRect &newGeometry) : WindowSystemEvent(GeometryChange), tlw(tlw), newGeometry(newGeometry) { } - QWeakPointer tlw; + QWeakPointer tlw; QRect newGeometry; }; class EnterEvent : public WindowSystemEvent { public: - EnterEvent(QWidget *enter) + explicit EnterEvent(QWindow *enter) : WindowSystemEvent(Enter), enter(enter) { } - QWeakPointer enter; + QWeakPointer enter; }; class LeaveEvent : public WindowSystemEvent { public: - LeaveEvent(QWidget *leave) + explicit LeaveEvent(QWindow *leave) : WindowSystemEvent(Leave), leave(leave) { } - QWeakPointer leave; + QWeakPointer leave; }; class ActivatedWindowEvent : public WindowSystemEvent { public: - ActivatedWindowEvent(QWidget *activatedWindow) + explicit ActivatedWindowEvent(QWindow *activatedWindow) : WindowSystemEvent(ActivatedWindow), activated(activatedWindow) { } - QWeakPointer activated; + QWeakPointer activated; + }; + + class WindowStateChangedEvent : public WindowSystemEvent { + public: + WindowStateChangedEvent(QWindow *_window, Qt::WindowState _newState) + : WindowSystemEvent(WindowStateChanged), window(_window), newState(_newState) + { } + + QWeakPointer window; + Qt::WindowState newState; }; class UserEvent : public WindowSystemEvent { public: - UserEvent(QWidget * w, ulong time, EventType t) - : WindowSystemEvent(t), widget(w), timestamp(time) { } - QWeakPointer widget; + UserEvent(QWindow * w, ulong time, EventType t) + : WindowSystemEvent(t), window(w), timestamp(time) { } + QWeakPointer window; unsigned long timestamp; }; class MouseEvent : public UserEvent { public: - MouseEvent(QWidget * w, ulong time, const QPointF & local, const QPointF & global, Qt::MouseButtons b) + MouseEvent(QWindow * w, ulong time, const QPointF & local, const QPointF & global, Qt::MouseButtons b) : UserEvent(w, time, Mouse), localPos(local), globalPos(global), buttons(b) { } QPointF localPos; QPointF globalPos; @@ -130,7 +144,7 @@ public: class WheelEvent : public UserEvent { public: - WheelEvent(QWidget *w, ulong time, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) + WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, int d, Qt::Orientation o) : UserEvent(w, time, Wheel), delta(d), localPos(local), globalPos(global), orient(o) { } int delta; QPointF localPos; @@ -140,11 +154,11 @@ public: 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) + KeyEvent(QWindow *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), nativeScanCode(0), nativeVirtualKey(0), nativeModifiers(0) { } - KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, + KeyEvent(QWindow *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, quint32 nativeSC, quint32 nativeVK, quint32 nativeMods, const QString & text = QString(), bool autorep = false, ushort count = 1) :UserEvent(w, time, Key), key(k), unicode(text), repeat(autorep), @@ -163,7 +177,7 @@ public: class TouchEvent : public UserEvent { public: - TouchEvent(QWidget *w, ulong time, QEvent::Type t, QTouchEvent::DeviceType d, const QList &p) + TouchEvent(QWindow *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; @@ -192,6 +206,31 @@ public: int index; }; + class MapEvent : public WindowSystemEvent { + public: + MapEvent(QWindow *mapped) + : WindowSystemEvent(Map), mapped(mapped) + { } + QWeakPointer mapped; + }; + + class UnmapEvent : public WindowSystemEvent { + public: + UnmapEvent(QWindow *unmapped) + : WindowSystemEvent(Unmap), unmapped(unmapped) + { } + QWeakPointer unmapped; + }; + + class ExposeEvent : public WindowSystemEvent { + public: + ExposeEvent(QWindow *exposed, const QRegion ®ion) + : WindowSystemEvent(Expose), exposed(exposed), region(region) + { } + QWeakPointer exposed; + QRegion region; + }; + static QList windowSystemEventQueue; static QMutex queueMutex; diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri new file mode 100644 index 00000000000..4ee7af45694 --- /dev/null +++ b/src/gui/opengl/opengl.pri @@ -0,0 +1,48 @@ +# Qt gui library, opengl module + +contains(QT_CONFIG, opengl):CONFIG += opengl +contains(QT_CONFIG, opengles2):CONFIG += opengles2 +contains(QT_CONFIG, egl):CONFIG += egl + +HEADERS += opengl/qopengl.h \ + opengl/qopengl_p.h \ + opengl/qopenglfunctions.h \ + opengl/qopenglframebufferobject.h \ + opengl/qopenglframebufferobject_p.h \ + opengl/qopenglpaintdevice.h \ + opengl/qopenglbuffer.h \ + opengl/qopenglshaderprogram.h \ + opengl/qopenglextensions_p.h \ + opengl/qopenglgradientcache_p.h \ + opengl/qopengltexturecache_p.h \ + opengl/qopenglengineshadermanager_p.h \ + opengl/qopengl2pexvertexarray_p.h \ + opengl/qopenglpaintengine_p.h \ + opengl/qopenglengineshadersource_p.h \ + opengl/qopenglcustomshaderstage_p.h \ + opengl/qopengltriangulatingstroker_p.h \ + opengl/qopengltextureglyphcache_p.h \ + opengl/qopenglshadercache_p.h \ + opengl/qopenglshadercache_meego_p.h \ + opengl/qopenglcolormap.h \ + opengl/qtriangulator_p.h \ + opengl/qrbtree_p.h + +SOURCES += opengl/qopengl.cpp \ + opengl/qopenglfunctions.cpp \ + opengl/qopenglframebufferobject.cpp \ + opengl/qopenglpaintdevice.cpp \ + opengl/qopenglbuffer.cpp \ + opengl/qopenglshaderprogram.cpp \ + opengl/qopenglgradientcache.cpp \ + opengl/qopengltexturecache.cpp \ + opengl/qopenglengineshadermanager.cpp \ + opengl/qopengl2pexvertexarray.cpp \ + opengl/qopenglpaintengine.cpp \ + opengl/qopenglcustomshaderstage.cpp \ + opengl/qopengltriangulatingstroker.cpp \ + opengl/qopengltextureglyphcache.cpp \ + opengl/qopenglcolormap.cpp \ + opengl/qtriangulator.cpp + +#INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/gui/embedded/qmousedriverplugin_qws.h b/src/gui/opengl/qopengl.cpp similarity index 53% rename from src/gui/embedded/qmousedriverplugin_qws.h rename to src/gui/opengl/qopengl.cpp index 47d6af4944d..3233fcfa5b7 100644 --- a/src/gui/embedded/qmousedriverplugin_qws.h +++ b/src/gui/opengl/qopengl.cpp @@ -39,46 +39,71 @@ ** ****************************************************************************/ -#ifndef QMOUSEDRIVERPLUGIN_QWS_H -#define QMOUSEDRIVERPLUGIN_QWS_H +#include "qopengl_p.h" -#include -#include - -QT_BEGIN_HEADER +#include "qopenglcontext.h" QT_BEGIN_NAMESPACE -QT_MODULE(Gui) - -#ifndef QT_NO_LIBRARY - -class QWSMouseHandler; - -struct Q_GUI_EXPORT QWSMouseHandlerFactoryInterface : public QFactoryInterface +QOpenGLExtensionMatcher::QOpenGLExtensionMatcher(const char *str) { - virtual QWSMouseHandler* create(const QString &name, const QString &device) = 0; -}; + init(str); +} -#define QWSMouseHandlerFactoryInterface_iid "com.trolltech.Qt.QWSMouseHandlerFactoryInterface" -Q_DECLARE_INTERFACE(QWSMouseHandlerFactoryInterface, QWSMouseHandlerFactoryInterface_iid) +typedef GLubyte * (*qt_glGetStringi)(GLenum, GLuint); -class Q_GUI_EXPORT QMouseDriverPlugin : public QObject, public QWSMouseHandlerFactoryInterface +#ifndef GL_NUM_EXTENSIONS +#define GL_NUM_EXTENSIONS 0x821D +#endif + +QOpenGLExtensionMatcher::QOpenGLExtensionMatcher() { - Q_OBJECT - Q_INTERFACES(QWSMouseHandlerFactoryInterface:QFactoryInterface) -public: - explicit QMouseDriverPlugin(QObject *parent = 0); - ~QMouseDriverPlugin(); + const char *extensionStr = reinterpret_cast(glGetString(GL_EXTENSIONS)); - virtual QStringList keys() const = 0; - virtual QWSMouseHandler* create(const QString& driver, const QString &device) = 0; -}; + if (extensionStr) { + init(extensionStr); + } else { + // clear error state + while (glGetError()) {} + + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx) { + qt_glGetStringi glGetStringi = (qt_glGetStringi)ctx->getProcAddress("glGetStringi"); + + if (!glGetStringi) + return; + + GLint numExtensions; + glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); + + for (int i = 0; i < numExtensions; ++i) { + const char *str = reinterpret_cast(glGetStringi(GL_EXTENSIONS, i)); + + m_offsets << m_extensions.size(); + + while (*str != 0) + m_extensions.append(*str++); + m_extensions.append(' '); + } + } + } +} + +void QOpenGLExtensionMatcher::init(const char *str) +{ + m_extensions = str; + + // make sure extension string ends with a space + if (!m_extensions.endsWith(' ')) + m_extensions.append(' '); + + int index = 0; + int next = 0; + while ((next = m_extensions.indexOf(' ', index)) >= 0) { + m_offsets << index; + index = next + 1; + } +} -#endif // QT_NO_LIBRARY QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMOUSEDRIVERPLUGIN_QWS_H diff --git a/src/gui/embedded/qdecorationfactory_qws.h b/src/gui/opengl/qopengl.h similarity index 78% rename from src/gui/embedded/qdecorationfactory_qws.h rename to src/gui/opengl/qopengl.h index bc0605c5788..cef4277d6bf 100644 --- a/src/gui/embedded/qdecorationfactory_qws.h +++ b/src/gui/opengl/qopengl.h @@ -39,28 +39,38 @@ ** ****************************************************************************/ -#ifndef QDECORATIONFACTORY_QWS_H -#define QDECORATIONFACTORY_QWS_H +#ifndef QOPENGL_H +#define QOPENGL_H -#include +#include QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QDecoration; - -class Q_GUI_EXPORT QDecorationFactory -{ -public: - static QStringList keys(); - static QDecoration *create(const QString&); -}; - -QT_END_NAMESPACE +#if 1 +#if defined(QT_OPENGL_ES_2) +# if defined(Q_OS_MAC) +# include +# else +# include +# endif +# ifndef GL_DOUBLE +# define GL_DOUBLE GL_FLOAT +# endif +# ifndef GLdouble +typedef GLfloat GLdouble; +# endif +#else +# if defined(Q_OS_MAC) +# include +# else +# if defined(Q_OS_WIN) +# include +# endif +# include +# endif +#endif +#endif QT_END_HEADER -#endif // QDECORATIONFACTORY_QWS_H +#endif // QOPENGL_H diff --git a/src/gui/opengl/qopengl2pexvertexarray.cpp b/src/gui/opengl/qopengl2pexvertexarray.cpp new file mode 100644 index 00000000000..ec26fdbf5bc --- /dev/null +++ b/src/gui/opengl/qopengl2pexvertexarray.cpp @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopengl2pexvertexarray_p.h" + +#include + +QT_BEGIN_NAMESPACE + +void QOpenGL2PEXVertexArray::clear() +{ + vertexArray.reset(); + vertexArrayStops.reset(); + boundingRectDirty = true; +} + + +QOpenGLRect QOpenGL2PEXVertexArray::boundingRect() const +{ + if (boundingRectDirty) + return QOpenGLRect(0.0, 0.0, 0.0, 0.0); + else + return QOpenGLRect(minX, minY, maxX, maxY); +} + +void QOpenGL2PEXVertexArray::addClosingLine(int index) +{ + QPointF point(vertexArray.at(index)); + if (point != QPointF(vertexArray.last())) + vertexArray.add(point); +} + +void QOpenGL2PEXVertexArray::addCentroid(const QVectorPath &path, int subPathIndex) +{ + const QPointF *const points = reinterpret_cast(path.points()); + const QPainterPath::ElementType *const elements = path.elements(); + + QPointF sum = points[subPathIndex]; + int count = 1; + + for (int i = subPathIndex + 1; i < path.elementCount() && (!elements || elements[i] != QPainterPath::MoveToElement); ++i) { + sum += points[i]; + ++count; + } + + const QPointF centroid = sum / qreal(count); + vertexArray.add(centroid); +} + +void QOpenGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline) +{ + const QPointF* const points = reinterpret_cast(path.points()); + const QPainterPath::ElementType* const elements = path.elements(); + + if (boundingRectDirty) { + minX = maxX = points[0].x(); + minY = maxY = points[0].y(); + boundingRectDirty = false; + } + + if (!outline && !path.isConvex()) + addCentroid(path, 0); + + int lastMoveTo = vertexArray.size(); + vertexArray.add(points[0]); // The first element is always a moveTo + + do { + if (!elements) { +// qDebug("QVectorPath has no elements"); + // If the path has a null elements pointer, the elements implicitly + // start with a moveTo (already added) and continue with lineTos: + for (int i=1; i(64, qMax(bounds.width(), bounds.height()) * 3.14f / (curveInverseScale * 6)); + if (threshold < 3) threshold = 3; + qreal one_over_threshold_minus_1 = qreal(1) / (threshold - 1); + for (int t=0; t maxX) + maxX = x; + else if (x < minX) + minX = x; + if (y > maxY) + maxY = y; + else if (y < minY) + minY = y; +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/qopengl2pexvertexarray_p.h b/src/gui/opengl/qopengl2pexvertexarray_p.h new file mode 100644 index 00000000000..5ad4f7a237f --- /dev/null +++ b/src/gui/opengl/qopengl2pexvertexarray_p.h @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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. +// + +#ifndef QOPENGL2PEXVERTEXARRAY_P_H +#define QOPENGL2PEXVERTEXARRAY_P_H + +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QOpenGLPoint +{ +public: + QOpenGLPoint(GLfloat new_x, GLfloat new_y) : + x(new_x), y(new_y) {}; + + QOpenGLPoint(const QPointF &p) : + x(p.x()), y(p.y()) {}; + + QOpenGLPoint(const QPointF* p) : + x(p->x()), y(p->y()) {}; + + GLfloat x; + GLfloat y; + + operator QPointF() {return QPointF(x,y);} + operator QPointF() const {return QPointF(x,y);} +}; + +struct QOpenGLRect +{ + QOpenGLRect(const QRectF &r) + : left(r.left()), top(r.top()), right(r.right()), bottom(r.bottom()) {} + + QOpenGLRect(GLfloat l, GLfloat t, GLfloat r, GLfloat b) + : left(l), top(t), right(r), bottom(b) {} + + GLfloat left; + GLfloat top; + GLfloat right; + GLfloat bottom; + + operator QRectF() const {return QRectF(left, top, right-left, bottom-top);} +}; + +class QOpenGL2PEXVertexArray +{ +public: + QOpenGL2PEXVertexArray() : + vertexArray(0), vertexArrayStops(0), + maxX(-2e10), maxY(-2e10), minX(2e10), minY(2e10), + boundingRectDirty(true) + { } + + inline void addRect(const QRectF &rect) + { + qreal top = rect.top(); + qreal left = rect.left(); + qreal bottom = rect.bottom(); + qreal right = rect.right(); + + vertexArray << QOpenGLPoint(left, top) + << QOpenGLPoint(right, top) + << QOpenGLPoint(right, bottom) + << QOpenGLPoint(right, bottom) + << QOpenGLPoint(left, bottom) + << QOpenGLPoint(left, top); + } + + inline void addQuad(const QRectF &rect) + { + qreal top = rect.top(); + qreal left = rect.left(); + qreal bottom = rect.bottom(); + qreal right = rect.right(); + + vertexArray << QOpenGLPoint(left, top) + << QOpenGLPoint(right, top) + << QOpenGLPoint(left, bottom) + << QOpenGLPoint(right, bottom); + + } + + inline void addVertex(const GLfloat x, const GLfloat y) + { + vertexArray.add(QOpenGLPoint(x, y)); + } + + void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline = true); + void clear(); + + QOpenGLPoint* data() {return vertexArray.data();} + int *stops() const { return vertexArrayStops.data(); } + int stopCount() const { return vertexArrayStops.size(); } + QOpenGLRect boundingRect() const; + + int vertexCount() const { return vertexArray.size(); } + + void lineToArray(const GLfloat x, const GLfloat y); + +private: + QDataBuffer vertexArray; + QDataBuffer vertexArrayStops; + + GLfloat maxX; + GLfloat maxY; + GLfloat minX; + GLfloat minY; + bool boundingRectDirty; + void addClosingLine(int index); + void addCentroid(const QVectorPath &path, int subPathIndex); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/gui/embedded/qkbdintegrity_qws.h b/src/gui/opengl/qopengl_p.h similarity index 68% rename from src/gui/embedded/qkbdintegrity_qws.h rename to src/gui/opengl/qopengl_p.h index 811b1525416..b09f9447dbc 100644 --- a/src/gui/embedded/qkbdintegrity_qws.h +++ b/src/gui/opengl/qopengl_p.h @@ -39,43 +39,49 @@ ** ****************************************************************************/ -#ifndef QKBDINTEGRITY_QWS_H -#define QKBDINTEGRITY_QWS_H +#ifndef QOPENGL_P_H +#define QOPENGL_P_H -#include +#include +#include + +#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Gui) - -#ifndef QT_NO_QWS_KEYBOARD - -#ifndef QT_NO_QWS_KBD_INTEGRITY - -class QSocketNotifier; -class QWSIntKbPrivate; - -class QWSIntKeyboardHandler : public QWSKeyboardHandler +class QOpenGLExtensionMatcher { public: - explicit QWSIntKeyboardHandler(const QString&); - virtual ~QWSIntKeyboardHandler(); + QOpenGLExtensionMatcher(const char *str); + QOpenGLExtensionMatcher(); -//protected: -// virtual void processKeyEvent(int keycode, bool isPress, bool autoRepeat); + bool match(const char *str) const { + int str_length = qstrlen(str); + + Q_ASSERT(str); + Q_ASSERT(str_length > 0); + Q_ASSERT(str[str_length-1] != ' '); + + for (int i = 0; i < m_offsets.size(); ++i) { + const char *extension = m_extensions.constData() + m_offsets.at(i); + if (qstrncmp(extension, str, str_length) == 0 && extension[str_length] == ' ') + return true; + } + return false; + } private: - QWSIntKbPrivate *d; + void init(const char *str); + + QByteArray m_extensions; + QVector m_offsets; }; -#endif // QT_NO_QWS_KBD_INTEGRITY - -#endif // QT_NO_QWS_KEYBOARD - QT_END_NAMESPACE QT_END_HEADER -#endif // QKBDINTEGRITY_QWS_H +#endif // QOPENGL_H diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp new file mode 100644 index 00000000000..bdd38018fad --- /dev/null +++ b/src/gui/opengl/qopenglbuffer.cpp @@ -0,0 +1,567 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include "qopenglbuffer.h" +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QOpenGLBuffer + \brief The QOpenGLBuffer class provides functions for creating and managing GL buffer objects. + \since 5.0 + \ingroup painting-3D + + Buffer objects are created in the GL server so that the + client application can avoid uploading vertices, indices, + texture image data, etc every time they are needed. + + QOpenGLBuffer objects can be copied around as a reference to the + underlying GL buffer object: + + \code + QOpenGLBuffer buffer1(QOpenGLBuffer::IndexBuffer); + buffer1.create(); + + QOpenGLBuffer buffer2 = buffer1; + \endcode + + QOpenGLBuffer performs a shallow copy when objects are copied in this + manner, but does not implement copy-on-write semantics. The original + object will be affected whenever the copy is modified. +*/ + +/*! + \enum QOpenGLBuffer::Type + This enum defines the type of GL buffer object to create with QOpenGLBuffer. + + \value VertexBuffer Vertex buffer object for use when specifying + vertex arrays. + \value IndexBuffer Index buffer object for use with \c{glDrawElements()}. + \value PixelPackBuffer Pixel pack buffer object for reading pixel + data from the GL server (for example, with \c{glReadPixels()}). + Not supported under OpenGL/ES. + \value PixelUnpackBuffer Pixel unpack buffer object for writing pixel + data to the GL server (for example, with \c{glTexImage2D()}). + Not supported under OpenGL/ES. +*/ + +/*! + \enum QOpenGLBuffer::UsagePattern + This enum defines the usage pattern of a QOpenGLBuffer object. + + \value StreamDraw The data will be set once and used a few times + for drawing operations. Under OpenGL/ES 1.1 this is identical + to StaticDraw. + \value StreamRead The data will be set once and used a few times + for reading data back from the GL server. Not supported + under OpenGL/ES. + \value StreamCopy The data will be set once and used a few times + for reading data back from the GL server for use in further + drawing operations. Not supported under OpenGL/ES. + \value StaticDraw The data will be set once and used many times + for drawing operations. + \value StaticRead The data will be set once and used many times + for reading data back from the GL server. Not supported + under OpenGL/ES. + \value StaticCopy The data will be set once and used many times + for reading data back from the GL server for use in further + drawing operations. Not supported under OpenGL/ES. + \value DynamicDraw The data will be modified repeatedly and used + many times for drawing operations. + \value DynamicRead The data will be modified repeatedly and used + many times for reading data back from the GL server. + Not supported under OpenGL/ES. + \value DynamicCopy The data will be modified repeatedly and used + many times for reading data back from the GL server for + use in further drawing operations. Not supported under OpenGL/ES. +*/ + +/*! + \enum QOpenGLBuffer::Access + This enum defines the access mode for QOpenGLBuffer::map(). + + \value ReadOnly The buffer will be mapped for reading only. + \value WriteOnly The buffer will be mapped for writing only. + \value ReadWrite The buffer will be mapped for reading and writing. +*/ + +class QOpenGLBufferPrivate +{ +public: + QOpenGLBufferPrivate(QOpenGLBuffer::Type t) + : ref(1), + type(t), + guard(0), + usagePattern(QOpenGLBuffer::StaticDraw), + actualUsagePattern(QOpenGLBuffer::StaticDraw), + funcs(0) + { + } + + QAtomicInt ref; + QOpenGLBuffer::Type type; + QOpenGLSharedResourceGuard *guard; + QOpenGLBuffer::UsagePattern usagePattern; + QOpenGLBuffer::UsagePattern actualUsagePattern; + QOpenGLExtensions *funcs; +}; + +/*! + Constructs a new buffer object of type QOpenGLBuffer::VertexBuffer. + + Note: this constructor just creates the QOpenGLBuffer instance. The actual + buffer object in the GL server is not created until create() is called. + + \sa create() +*/ +QOpenGLBuffer::QOpenGLBuffer() + : d_ptr(new QOpenGLBufferPrivate(QOpenGLBuffer::VertexBuffer)) +{ +} + +/*! + Constructs a new buffer object of \a type. + + Note: this constructor just creates the QOpenGLBuffer instance. The actual + buffer object in the GL server is not created until create() is called. + + \sa create() +*/ +QOpenGLBuffer::QOpenGLBuffer(QOpenGLBuffer::Type type) + : d_ptr(new QOpenGLBufferPrivate(type)) +{ +} + +/*! + Constructs a shallow copy of \a other. + + Note: QOpenGLBuffer does not implement copy-on-write semantics, + so \a other will be affected whenever the copy is modified. +*/ +QOpenGLBuffer::QOpenGLBuffer(const QOpenGLBuffer &other) + : d_ptr(other.d_ptr) +{ + d_ptr->ref.ref(); +} + +/*! + Destroys this buffer object, including the storage being + used in the GL server. +*/ +QOpenGLBuffer::~QOpenGLBuffer() +{ + if (!d_ptr->ref.deref()) { + destroy(); + delete d_ptr; + } +} + +/*! + Assigns a shallow copy of \a other to this object. + + Note: QOpenGLBuffer does not implement copy-on-write semantics, + so \a other will be affected whenever the copy is modified. +*/ +QOpenGLBuffer &QOpenGLBuffer::operator=(const QOpenGLBuffer &other) +{ + if (d_ptr != other.d_ptr) { + other.d_ptr->ref.ref(); + if (!d_ptr->ref.deref()) + destroy(); + d_ptr = other.d_ptr; + } + return *this; +} + +/*! + Returns the type of buffer represented by this object. +*/ +QOpenGLBuffer::Type QOpenGLBuffer::type() const +{ + Q_D(const QOpenGLBuffer); + return d->type; +} + +/*! + Returns the usage pattern for this buffer object. + The default value is StaticDraw. + + \sa setUsagePattern() +*/ +QOpenGLBuffer::UsagePattern QOpenGLBuffer::usagePattern() const +{ + Q_D(const QOpenGLBuffer); + return d->usagePattern; +} + +/*! + Sets the usage pattern for this buffer object to \a value. + This function must be called before allocate() or write(). + + \sa usagePattern(), allocate(), write() +*/ +void QOpenGLBuffer::setUsagePattern(QOpenGLBuffer::UsagePattern value) +{ + Q_D(QOpenGLBuffer); + d->usagePattern = d->actualUsagePattern = value; +} + +namespace { + void freeBufferFunc(QOpenGLFunctions *funcs, GLuint id) + { + funcs->glDeleteBuffers(1, &id); + } +} + +/*! + Creates the buffer object in the GL server. Returns true if + the object was created; false otherwise. + + This function must be called with a current QOpenGLContext. + The buffer will be bound to and can only be used in + that context (or any other context that is shared with it). + + This function will return false if the GL implementation + does not support buffers, or there is no current QOpenGLContext. + + \sa isCreated(), allocate(), write(), destroy() +*/ +bool QOpenGLBuffer::create() +{ + Q_D(QOpenGLBuffer); + if (d->guard && d->guard->id()) + return true; + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx) { + delete d->funcs; + d->funcs = new QOpenGLExtensions(ctx); + GLuint bufferId = 0; + d->funcs->glGenBuffers(1, &bufferId); + if (bufferId) { + if (d->guard) + d->guard->free(); + + d->guard = new QOpenGLSharedResourceGuard(ctx, bufferId, freeBufferFunc); + return true; + } + } + return false; +} + +/*! + Returns true if this buffer has been created; false otherwise. + + \sa create(), destroy() +*/ +bool QOpenGLBuffer::isCreated() const +{ + Q_D(const QOpenGLBuffer); + return d->guard && d->guard->id(); +} + +/*! + Destroys this buffer object, including the storage being + used in the GL server. All references to the buffer will + become invalid. +*/ +void QOpenGLBuffer::destroy() +{ + Q_D(QOpenGLBuffer); + if (d->guard) { + d->guard->free(); + d->guard = 0; + } +} + +/*! + Reads the \a count bytes in this buffer starting at \a offset + into \a data. Returns true on success; false if reading from + the buffer is not supported. Buffer reading is not supported + under OpenGL/ES. + + It is assumed that this buffer has been bound to the current context. + + \sa write(), bind() +*/ +bool QOpenGLBuffer::read(int offset, void *data, int count) +{ +#if !defined(QT_OPENGL_ES) + Q_D(QOpenGLBuffer); + if (!d->funcs->hasOpenGLFeature(QOpenGLFunctions::Buffers) || !d->guard->id()) + return false; + while (glGetError() != GL_NO_ERROR) ; // Clear error state. + d->funcs->glGetBufferSubData(d->type, offset, count, data); + return glGetError() == GL_NO_ERROR; +#else + Q_UNUSED(offset); + Q_UNUSED(data); + Q_UNUSED(count); + return false; +#endif +} + +/*! + Replaces the \a count bytes of this buffer starting at \a offset + with the contents of \a data. Any other bytes in the buffer + will be left unmodified. + + It is assumed that create() has been called on this buffer and that + it has been bound to the current context. + + \sa create(), read(), allocate() +*/ +void QOpenGLBuffer::write(int offset, const void *data, int count) +{ +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QOpenGLBuffer::allocate(): buffer not created"); +#endif + Q_D(QOpenGLBuffer); + if (d->guard && d->guard->id()) + d->funcs->glBufferSubData(d->type, offset, count, data); +} + +/*! + Allocates \a count bytes of space to the buffer, initialized to + the contents of \a data. Any previous contents will be removed. + + It is assumed that create() has been called on this buffer and that + it has been bound to the current context. + + \sa create(), read(), write() +*/ +void QOpenGLBuffer::allocate(const void *data, int count) +{ +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QOpenGLBuffer::allocate(): buffer not created"); +#endif + Q_D(QOpenGLBuffer); + if (d->guard && d->guard->id()) + d->funcs->glBufferData(d->type, count, data, d->actualUsagePattern); +} + +/*! + \fn void QOpenGLBuffer::allocate(int count) + \overload + + Allocates \a count bytes of space to the buffer. Any previous + contents will be removed. + + It is assumed that create() has been called on this buffer and that + it has been bound to the current context. + + \sa create(), write() +*/ + +/*! + Binds the buffer associated with this object to the current + GL context. Returns false if binding was not possible, usually because + type() is not supported on this GL implementation. + + The buffer must be bound to the same QOpenGLContext current when create() + was called, or to another QOpenGLContext that is sharing with it. + Otherwise, false will be returned from this function. + + \sa release(), create() +*/ +bool QOpenGLBuffer::bind() +{ +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QOpenGLBuffer::bind(): buffer not created"); +#endif + Q_D(const QOpenGLBuffer); + GLuint bufferId = d->guard ? d->guard->id() : 0; + if (bufferId) { + if (d->guard->group() != QOpenGLContextGroup::currentContextGroup()) { +#ifndef QT_NO_DEBUG + qWarning("QOpenGLBuffer::bind: buffer is not valid in the current context"); +#endif + return false; + } + d->funcs->glBindBuffer(d->type, bufferId); + return true; + } else { + return false; + } +} + +/*! + Releases the buffer associated with this object from the + current GL context. + + This function must be called with the same QOpenGLContext current + as when bind() was called on the buffer. + + \sa bind() +*/ +void QOpenGLBuffer::release() +{ +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QOpenGLBuffer::release(): buffer not created"); +#endif + Q_D(const QOpenGLBuffer); + if (d->guard && d->guard->id()) + d->funcs->glBindBuffer(d->type, 0); +} + +/*! + Releases the buffer associated with \a type in the current + QOpenGLContext. + + This function is a direct call to \c{glBindBuffer(type, 0)} + for use when the caller does not know which QOpenGLBuffer has + been bound to the context but wants to make sure that it + is released. + + \code + QOpenGLBuffer::release(QOpenGLBuffer::VertexBuffer); + \endcode +*/ +void QOpenGLBuffer::release(QOpenGLBuffer::Type type) +{ + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx) + ctx->functions()->glBindBuffer(GLenum(type), 0); +} + +/*! + Returns the GL identifier associated with this buffer; zero if + the buffer has not been created. + + \sa isCreated() +*/ +GLuint QOpenGLBuffer::bufferId() const +{ + Q_D(const QOpenGLBuffer); + return d->guard ? d->guard->id() : 0; +} + +/*! + Returns the size of the data in this buffer, for reading operations. + Returns -1 if fetching the buffer size is not supported, or the + buffer has not been created. + + It is assumed that this buffer has been bound to the current context. + + \sa isCreated(), bind() +*/ +int QOpenGLBuffer::size() const +{ + Q_D(const QOpenGLBuffer); + if (!d->guard || !d->guard->id()) + return -1; + GLint value = -1; + d->funcs->glGetBufferParameteriv(d->type, GL_BUFFER_SIZE, &value); + return value; +} + +/*! + Maps the contents of this buffer into the application's memory + space and returns a pointer to it. Returns null if memory + mapping is not possible. The \a access parameter indicates the + type of access to be performed. + + It is assumed that create() has been called on this buffer and that + it has been bound to the current context. + + This function is only supported under OpenGL/ES if the + \c{GL_OES_mapbuffer} extension is present. + + \sa unmap(), create(), bind() +*/ +void *QOpenGLBuffer::map(QOpenGLBuffer::Access access) +{ + Q_D(QOpenGLBuffer); +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QOpenGLBuffer::map(): buffer not created"); +#endif + if (!d->guard || !d->guard->id()) + return 0; +#if 0 + if (!glMapBufferARB) + return 0; + return glMapBufferARB(d->type, access); +#endif + Q_UNUSED(access); + qWarning("QOpenGLBuffer::map(): pending implementation"); + return 0; +} + +/*! + Unmaps the buffer after it was mapped into the application's + memory space with a previous call to map(). Returns true if + the unmap succeeded; false otherwise. + + It is assumed that this buffer has been bound to the current context, + and that it was previously mapped with map(). + + This function is only supported under OpenGL/ES if the + \c{GL_OES_mapbuffer} extension is present. + + \sa map() +*/ +bool QOpenGLBuffer::unmap() +{ + Q_D(QOpenGLBuffer); +#ifndef QT_NO_DEBUG + if (!isCreated()) + qWarning("QOpenGLBuffer::unmap(): buffer not created"); +#endif + if (!d->guard || !d->guard->id()) + return false; +#if 0 + if (!glUnmapBufferARB) + return false; + return glUnmapBufferARB(d->type) == GL_TRUE; +#endif + qWarning("QOpenGLBuffer::map(): pending implementation"); + return 0; +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglbuffer.h b/src/gui/opengl/qopenglbuffer.h new file mode 100644 index 00000000000..52a2c4d6401 --- /dev/null +++ b/src/gui/opengl/qopenglbuffer.h @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENGLBUFFER_H +#define QOPENGLBUFFER_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QOpenGLBufferPrivate; + +class Q_GUI_EXPORT QOpenGLBuffer +{ +public: + enum Type + { + VertexBuffer = 0x8892, // GL_ARRAY_BUFFER + IndexBuffer = 0x8893, // GL_ELEMENT_ARRAY_BUFFER + PixelPackBuffer = 0x88EB, // GL_PIXEL_PACK_BUFFER + PixelUnpackBuffer = 0x88EC // GL_PIXEL_UNPACK_BUFFER + }; + + QOpenGLBuffer(); + explicit QOpenGLBuffer(QOpenGLBuffer::Type type); + QOpenGLBuffer(const QOpenGLBuffer &other); + ~QOpenGLBuffer(); + + QOpenGLBuffer &operator=(const QOpenGLBuffer &other); + + enum UsagePattern + { + StreamDraw = 0x88E0, // GL_STREAM_DRAW + StreamRead = 0x88E1, // GL_STREAM_READ + StreamCopy = 0x88E2, // GL_STREAM_COPY + StaticDraw = 0x88E4, // GL_STATIC_DRAW + StaticRead = 0x88E5, // GL_STATIC_READ + StaticCopy = 0x88E6, // GL_STATIC_COPY + DynamicDraw = 0x88E8, // GL_DYNAMIC_DRAW + DynamicRead = 0x88E9, // GL_DYNAMIC_READ + DynamicCopy = 0x88EA // GL_DYNAMIC_COPY + }; + + enum Access + { + ReadOnly = 0x88B8, // GL_READ_ONLY + WriteOnly = 0x88B9, // GL_WRITE_ONLY + ReadWrite = 0x88BA // GL_READ_WRITE + }; + + QOpenGLBuffer::Type type() const; + + QOpenGLBuffer::UsagePattern usagePattern() const; + void setUsagePattern(QOpenGLBuffer::UsagePattern value); + + bool create(); + bool isCreated() const; + + void destroy(); + + bool bind(); + void release(); + + static void release(QOpenGLBuffer::Type type); + + GLuint bufferId() const; + + int size() const; + + bool read(int offset, void *data, int count); + void write(int offset, const void *data, int count); + + void allocate(const void *data, int count); + inline void allocate(int count) { allocate(0, count); } + + void *map(QOpenGLBuffer::Access access); + bool unmap(); + +private: + QOpenGLBufferPrivate *d_ptr; + + Q_DECLARE_PRIVATE(QOpenGLBuffer) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/gui/opengl/qopenglcolormap.cpp b/src/gui/opengl/qopenglcolormap.cpp new file mode 100644 index 00000000000..386358ac234 --- /dev/null +++ b/src/gui/opengl/qopenglcolormap.cpp @@ -0,0 +1,297 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \class QOpenGLColormap + \brief The QOpenGLColormap class is used for installing custom colormaps into + a QOpenGLWidget. + + \module OpenGL + \ingroup painting-3D + \ingroup shared + + QOpenGLColormap provides a platform independent way of specifying and + installing indexed colormaps for a QOpenGLWidget. QOpenGLColormap is + especially useful when using the OpenGL color-index mode. + + Under X11 you must use an X server that supports either a \c + PseudoColor or \c DirectColor visual class. If your X server + currently only provides a \c GrayScale, \c TrueColor, \c + StaticColor or \c StaticGray visual, you will not be able to + allocate colorcells for writing. If this is the case, try setting + your X server to 8 bit mode. It should then provide you with at + least a \c PseudoColor visual. Note that you may experience + colormap flashing if your X server is running in 8 bit mode. + + The size() of the colormap is always set to 256 + colors. Note that under Windows you can also install colormaps + in child widgets. + + This class uses \l{implicit sharing} as a memory and speed + optimization. + + Example of use: + \snippet doc/src/snippets/code/src_opengl_qopenglcolormap.cpp 0 + + \sa QOpenGLWidget::setColormap(), QOpenGLWidget::colormap() +*/ + +/*! + \fn Qt::HANDLE QOpenGLColormap::handle() + + \internal + + Returns the handle for this color map. +*/ + +/*! + \fn void QOpenGLColormap::setHandle(Qt::HANDLE handle) + + \internal + + Sets the handle for this color map to \a handle. +*/ + +#include "qopenglcolormap.h" + +QT_BEGIN_NAMESPACE + +QOpenGLColormap::QOpenGLColormapData QOpenGLColormap::shared_null = { Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0 }; + +/*! + Construct a QOpenGLColormap. +*/ +QOpenGLColormap::QOpenGLColormap() + : d(&shared_null) +{ + d->ref.ref(); +} + + +/*! + Construct a shallow copy of \a map. +*/ +QOpenGLColormap::QOpenGLColormap(const QOpenGLColormap &map) + : d(map.d) +{ + d->ref.ref(); +} + +/*! + Dereferences the QOpenGLColormap and deletes it if this was the last + reference to it. +*/ +QOpenGLColormap::~QOpenGLColormap() +{ + if (!d->ref.deref()) + cleanup(d); +} + +void QOpenGLColormap::cleanup(QOpenGLColormap::QOpenGLColormapData *x) +{ + delete x->cells; + x->cells = 0; + delete x; +} + +/*! + Assign a shallow copy of \a map to this QOpenGLColormap. +*/ +QOpenGLColormap & QOpenGLColormap::operator=(const QOpenGLColormap &map) +{ + map.d->ref.ref(); + if (!d->ref.deref()) + cleanup(d); + d = map.d; + return *this; +} + +/*! + \fn void QOpenGLColormap::detach() + \internal + + Detaches this QOpenGLColormap from the shared block. +*/ + +void QOpenGLColormap::detach_helper() +{ + QOpenGLColormapData *x = new QOpenGLColormapData; + x->ref = 1; + x->cmapHandle = 0; + x->cells = 0; + if (d->cells) { + x->cells = new QVector(256); + *x->cells = *d->cells; + } + if (!d->ref.deref()) + cleanup(d); + d = x; +} + +/*! + Set cell at index \a idx in the colormap to color \a color. +*/ +void QOpenGLColormap::setEntry(int idx, QRgb color) +{ + detach(); + if (!d->cells) + d->cells = new QVector(256); + d->cells->replace(idx, color); +} + +/*! + Set an array of cells in this colormap. \a count is the number of + colors that should be set, \a colors is the array of colors, and + \a base is the starting index. The first element in \a colors + is set at \a base in the colormap. +*/ +void QOpenGLColormap::setEntries(int count, const QRgb *colors, int base) +{ + detach(); + if (!d->cells) + d->cells = new QVector(256); + + Q_ASSERT_X(colors && base >= 0 && (base + count) <= d->cells->size(), "QOpenGLColormap::setEntries", + "preconditions not met"); + for (int i = 0; i < count; ++i) + setEntry(base + i, colors[i]); +} + +/*! + Returns the QRgb value in the colorcell with index \a idx. +*/ +QRgb QOpenGLColormap::entryRgb(int idx) const +{ + if (d == &shared_null || !d->cells) + return 0; + else + return d->cells->at(idx); +} + +/*! + \overload + + Set the cell with index \a idx in the colormap to color \a color. +*/ +void QOpenGLColormap::setEntry(int idx, const QColor &color) +{ + setEntry(idx, color.rgb()); +} + +/*! + Returns the QRgb value in the colorcell with index \a idx. +*/ +QColor QOpenGLColormap::entryColor(int idx) const +{ + if (d == &shared_null || !d->cells) + return QColor(); + else + return QColor(d->cells->at(idx)); +} + +/*! + Returns true if the colormap is empty or it is not in use + by a QOpenGLWidget; otherwise returns false. + + A colormap with no color values set is considered to be empty. + For historical reasons, a colormap that has color values set + but which is not in use by a QOpenGLWidget is also considered empty. + + Compare size() with zero to determine if the colormap is empty + regardless of whether it is in use by a QOpenGLWidget or not. + + \sa size() +*/ +bool QOpenGLColormap::isEmpty() const +{ + return d == &shared_null || d->cells == 0 || d->cells->size() == 0 || d->cmapHandle == 0; +} + + +/*! + Returns the number of colorcells in the colormap. +*/ +int QOpenGLColormap::size() const +{ + return d->cells ? d->cells->size() : 0; +} + +/*! + Returns the index of the color \a color. If \a color is not in the + map, -1 is returned. +*/ +int QOpenGLColormap::find(QRgb color) const +{ + if (d->cells) + return d->cells->indexOf(color); + return -1; +} + +/*! + Returns the index of the color that is the closest match to color + \a color. +*/ +int QOpenGLColormap::findNearest(QRgb color) const +{ + int idx = find(color); + if (idx >= 0) + return idx; + int mapSize = size(); + int mindist = 200000; + int r = qRed(color); + int g = qGreen(color); + int b = qBlue(color); + int rx, gx, bx, dist; + for (int i = 0; i < mapSize; ++i) { + QRgb ci = d->cells->at(i); + rx = r - qRed(ci); + gx = g - qGreen(ci); + bx = b - qBlue(ci); + dist = rx * rx + gx * gx + bx * bx; // calculate distance + if (dist < mindist) { // minimal? + mindist = dist; + idx = i; + } + } + return idx; +} + +QT_END_NAMESPACE diff --git a/src/gui/embedded/qkbd_qws.h b/src/gui/opengl/qopenglcolormap.h similarity index 59% rename from src/gui/embedded/qkbd_qws.h rename to src/gui/opengl/qopenglcolormap.h index d3be9d9997d..b05e3f331d8 100644 --- a/src/gui/embedded/qkbd_qws.h +++ b/src/gui/opengl/qopenglcolormap.h @@ -39,10 +39,11 @@ ** ****************************************************************************/ -#ifndef QKBD_QWS_H -#define QKBD_QWS_H +#ifndef QOPENGLCOLORMAP_H +#define QOPENGLCOLORMAP_H -#include +#include +#include QT_BEGIN_HEADER @@ -50,54 +51,55 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifndef QT_NO_QWS_KEYBOARD - -class QWSKbPrivate; - -class Q_GUI_EXPORT QWSKeyboardHandler +class Q_GUI_EXPORT QOpenGLColormap { public: - QWSKeyboardHandler(); - QWSKeyboardHandler(const QString &device); - virtual ~QWSKeyboardHandler(); + QOpenGLColormap(); + QOpenGLColormap(const QOpenGLColormap &); + ~QOpenGLColormap(); - virtual void processKeyEvent(int unicode, int keycode, Qt::KeyboardModifiers modifiers, - bool isPress, bool autoRepeat); + QOpenGLColormap &operator=(const QOpenGLColormap &); - enum KeycodeAction { - None = 0, + bool isEmpty() const; + int size() const; + void detach(); - CapsLockOff = 0x01000000, - CapsLockOn = 0x01000001, - NumLockOff = 0x02000000, - NumLockOn = 0x02000001, - ScrollLockOff = 0x03000000, - ScrollLockOn = 0x03000001, - - Reboot = 0x04000000, - - PreviousConsole = 0x05000000, - NextConsole = 0x05000001, - SwitchConsoleFirst = 0x06000000, - SwitchConsoleLast = 0x0600007f, - SwitchConsoleMask = 0x0000007f, - }; - - KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat); + void setEntries(int count, const QRgb * colors, int base = 0); + void setEntry(int idx, QRgb color); + void setEntry(int idx, const QColor & color); + QRgb entryRgb(int idx) const; + QColor entryColor(int idx) const; + int find(QRgb color) const; + int findNearest(QRgb color) const; protected: - int transformDirKey(int key); - void beginAutoRepeat(int uni, int code, Qt::KeyboardModifiers mod); - void endAutoRepeat(); + Qt::HANDLE handle() { return d ? d->cmapHandle : 0; } + void setHandle(Qt::HANDLE ahandle) { d->cmapHandle = ahandle; } private: - QWSKbPrivate *d; + struct QOpenGLColormapData { + QBasicAtomicInt ref; + QVector *cells; + Qt::HANDLE cmapHandle; + }; + + QOpenGLColormapData *d; + static struct QOpenGLColormapData shared_null; + static void cleanup(QOpenGLColormapData *x); + void detach_helper(); + + friend class QOpenGLWidget; + friend class QOpenGLWidgetPrivate; }; -#endif // QT_NO_QWS_KEYBOARD +inline void QOpenGLColormap::detach() +{ + if (d->ref != 1) + detach_helper(); +} QT_END_NAMESPACE QT_END_HEADER -#endif // QKBD_QWS_H +#endif // QOPENGLCOLORMAP_H diff --git a/src/gui/opengl/qopenglcustomshaderstage.cpp b/src/gui/opengl/qopenglcustomshaderstage.cpp new file mode 100644 index 00000000000..6cedf66df1f --- /dev/null +++ b/src/gui/opengl/qopenglcustomshaderstage.cpp @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenglcustomshaderstage_p.h" +#include "qopenglengineshadermanager_p.h" +#include "qopenglpaintengine_p.h" +#include + +QT_BEGIN_NAMESPACE + +class QOpenGLCustomShaderStagePrivate +{ +public: + QOpenGLCustomShaderStagePrivate() : + m_manager(0) {} + + QPointer m_manager; + QByteArray m_source; +}; + + + + +QOpenGLCustomShaderStage::QOpenGLCustomShaderStage() + : d_ptr(new QOpenGLCustomShaderStagePrivate) +{ +} + +QOpenGLCustomShaderStage::~QOpenGLCustomShaderStage() +{ + Q_D(QOpenGLCustomShaderStage); + if (d->m_manager) { + d->m_manager->removeCustomStage(); + d->m_manager->sharedShaders->cleanupCustomStage(this); + } +} + +void QOpenGLCustomShaderStage::setUniformsDirty() +{ + Q_D(QOpenGLCustomShaderStage); + if (d->m_manager) + d->m_manager->setDirty(); // ### Probably a bit overkill! +} + +bool QOpenGLCustomShaderStage::setOnPainter(QPainter* p) +{ + Q_D(QOpenGLCustomShaderStage); + if (p->paintEngine()->type() != QPaintEngine::OpenGL2) { + qWarning("QOpenGLCustomShaderStage::setOnPainter() - paint engine not OpenGL2"); + return false; + } + if (d->m_manager) + qWarning("Custom shader is already set on a painter"); + + QOpenGL2PaintEngineEx *engine = static_cast(p->paintEngine()); + d->m_manager = QOpenGL2PaintEngineExPrivate::shaderManagerForEngine(engine); + Q_ASSERT(d->m_manager); + + d->m_manager->setCustomStage(this); + return true; +} + +void QOpenGLCustomShaderStage::removeFromPainter(QPainter* p) +{ + Q_D(QOpenGLCustomShaderStage); + if (p->paintEngine()->type() != QPaintEngine::OpenGL2) + return; + + QOpenGL2PaintEngineEx *engine = static_cast(p->paintEngine()); + d->m_manager = QOpenGL2PaintEngineExPrivate::shaderManagerForEngine(engine); + Q_ASSERT(d->m_manager); + + // Just set the stage to null, don't call removeCustomStage(). + // This should leave the program in a compiled/linked state + // if the next custom shader stage is this one again. + d->m_manager->setCustomStage(0); + d->m_manager = 0; +} + +QByteArray QOpenGLCustomShaderStage::source() const +{ + Q_D(const QOpenGLCustomShaderStage); + return d->m_source; +} + +// Called by the shader manager if another custom shader is attached or +// the manager is deleted +void QOpenGLCustomShaderStage::setInactive() +{ + Q_D(QOpenGLCustomShaderStage); + d->m_manager = 0; +} + +void QOpenGLCustomShaderStage::setSource(const QByteArray& s) +{ + Q_D(QOpenGLCustomShaderStage); + d->m_source = s; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_qws_p.h b/src/gui/opengl/qopenglcustomshaderstage_p.h similarity index 74% rename from src/gui/kernel/qeventdispatcher_qws_p.h rename to src/gui/opengl/qopenglcustomshaderstage_p.h index f27d765e51c..de459c00502 100644 --- a/src/gui/kernel/qeventdispatcher_qws_p.h +++ b/src/gui/opengl/qopenglcustomshaderstage_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QEVENTDISPATCHER_QWS_P_H -#define QEVENTDISPATCHER_QWS_P_H +#ifndef QOPENGL_CUSTOM_SHADER_STAGE_H +#define QOPENGL_CUSTOM_SHADER_STAGE_H // // W A R N I N G @@ -53,34 +53,42 @@ // We mean it. // -#include "private/qeventdispatcher_unix_p.h" +#include + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QEventDispatcherQWSPrivate; +QT_MODULE(Gui) -class QEventDispatcherQWS : public QEventDispatcherUNIX +class QPainter; +class QOpenGLCustomShaderStagePrivate; +class Q_GUI_EXPORT QOpenGLCustomShaderStage { - Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherQWS) - + Q_DECLARE_PRIVATE(QOpenGLCustomShaderStage) public: - explicit QEventDispatcherQWS(QObject *parent = 0); - ~QEventDispatcherQWS(); + QOpenGLCustomShaderStage(); + virtual ~QOpenGLCustomShaderStage(); + virtual void setUniforms(QOpenGLShaderProgram*) {} - bool processEvents(QEventLoop::ProcessEventsFlags flags); - bool hasPendingEvents(); + void setUniformsDirty(); - void flush(); - - void startingUp(); - void closingDown(); + bool setOnPainter(QPainter*); + void removeFromPainter(QPainter*); + QByteArray source() const; + void setInactive(); protected: - int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - timeval *timeout); + void setSource(const QByteArray&); + +private: + QOpenGLCustomShaderStagePrivate* d_ptr; }; + QT_END_NAMESPACE -#endif // QEVENTDISPATCHER_QWS_P_H +QT_END_HEADER + + +#endif diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp new file mode 100644 index 00000000000..aaca6ad89cd --- /dev/null +++ b/src/gui/opengl/qopenglengineshadermanager.cpp @@ -0,0 +1,881 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenglengineshadermanager_p.h" +#include "qopenglengineshadersource_p.h" +#include "qopenglpaintengine_p.h" +#include "qopenglshadercache_p.h" + +#include +#include + +#if defined(QT_DEBUG) +#include +#endif + +// #define QT_GL_SHARED_SHADER_DEBUG + +QT_BEGIN_NAMESPACE + +class QOpenGLEngineSharedShadersResource : public QOpenGLSharedResource +{ +public: + QOpenGLEngineSharedShadersResource(QOpenGLContext *ctx) + : QOpenGLSharedResource(ctx->shareGroup()) + , m_shaders(new QOpenGLEngineSharedShaders(ctx)) + { + } + + ~QOpenGLEngineSharedShadersResource() + { + delete m_shaders; + } + + void invalidateResource() + { + delete m_shaders; + m_shaders = 0; + } + + void freeResource(QOpenGLContext *) + { + } + + QOpenGLEngineSharedShaders *shaders() const { return m_shaders; } + +private: + QOpenGLEngineSharedShaders *m_shaders; +}; + +class QOpenGLShaderStorage +{ +public: + QOpenGLEngineSharedShaders *shadersForThread(QOpenGLContext *context) { + QOpenGLMultiGroupSharedResource *&shaders = m_storage.localData(); + if (!shaders) + shaders = new QOpenGLMultiGroupSharedResource; + QOpenGLEngineSharedShadersResource *resource = + shaders->value(context); + return resource ? resource->shaders() : 0; + } + +private: + QThreadStorage m_storage; +}; + +Q_GLOBAL_STATIC(QOpenGLShaderStorage, qt_shader_storage); + +QOpenGLEngineSharedShaders *QOpenGLEngineSharedShaders::shadersForContext(QOpenGLContext *context) +{ + return qt_shader_storage()->shadersForThread(context); +} + +const char* QOpenGLEngineSharedShaders::qShaderSnippets[] = { + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0 +}; + +QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context) + : blitShaderProg(0) + , simpleShaderProg(0) +{ + +/* + Rather than having the shader source array statically initialised, it is initialised + here instead. This is to allow new shader names to be inserted or existing names moved + around without having to change the order of the glsl strings. It is hoped this will + make future hard-to-find runtime bugs more obvious and generally give more solid code. +*/ + static bool snippetsPopulated = false; + if (!snippetsPopulated) { + + const char** code = qShaderSnippets; // shortcut + + code[MainVertexShader] = qopenglslMainVertexShader; + code[MainWithTexCoordsVertexShader] = qopenglslMainWithTexCoordsVertexShader; + code[MainWithTexCoordsAndOpacityVertexShader] = qopenglslMainWithTexCoordsAndOpacityVertexShader; + + code[UntransformedPositionVertexShader] = qopenglslUntransformedPositionVertexShader; + code[PositionOnlyVertexShader] = qopenglslPositionOnlyVertexShader; + code[ComplexGeometryPositionOnlyVertexShader] = qopenglslComplexGeometryPositionOnlyVertexShader; + code[PositionWithPatternBrushVertexShader] = qopenglslPositionWithPatternBrushVertexShader; + code[PositionWithLinearGradientBrushVertexShader] = qopenglslPositionWithLinearGradientBrushVertexShader; + code[PositionWithConicalGradientBrushVertexShader] = qopenglslPositionWithConicalGradientBrushVertexShader; + code[PositionWithRadialGradientBrushVertexShader] = qopenglslPositionWithRadialGradientBrushVertexShader; + code[PositionWithTextureBrushVertexShader] = qopenglslPositionWithTextureBrushVertexShader; + code[AffinePositionWithPatternBrushVertexShader] = qopenglslAffinePositionWithPatternBrushVertexShader; + code[AffinePositionWithLinearGradientBrushVertexShader] = qopenglslAffinePositionWithLinearGradientBrushVertexShader; + code[AffinePositionWithConicalGradientBrushVertexShader] = qopenglslAffinePositionWithConicalGradientBrushVertexShader; + code[AffinePositionWithRadialGradientBrushVertexShader] = qopenglslAffinePositionWithRadialGradientBrushVertexShader; + code[AffinePositionWithTextureBrushVertexShader] = qopenglslAffinePositionWithTextureBrushVertexShader; + + code[MainFragmentShader_CMO] = qopenglslMainFragmentShader_CMO; + code[MainFragmentShader_CM] = qopenglslMainFragmentShader_CM; + code[MainFragmentShader_MO] = qopenglslMainFragmentShader_MO; + code[MainFragmentShader_M] = qopenglslMainFragmentShader_M; + code[MainFragmentShader_CO] = qopenglslMainFragmentShader_CO; + code[MainFragmentShader_C] = qopenglslMainFragmentShader_C; + code[MainFragmentShader_O] = qopenglslMainFragmentShader_O; + code[MainFragmentShader] = qopenglslMainFragmentShader; + code[MainFragmentShader_ImageArrays] = qopenglslMainFragmentShader_ImageArrays; + + code[ImageSrcFragmentShader] = qopenglslImageSrcFragmentShader; + code[ImageSrcWithPatternFragmentShader] = qopenglslImageSrcWithPatternFragmentShader; + code[NonPremultipliedImageSrcFragmentShader] = qopenglslNonPremultipliedImageSrcFragmentShader; + code[CustomImageSrcFragmentShader] = qopenglslCustomSrcFragmentShader; // Calls "customShader", which must be appended + code[SolidBrushSrcFragmentShader] = qopenglslSolidBrushSrcFragmentShader; + code[TextureBrushSrcFragmentShader] = qopenglslTextureBrushSrcFragmentShader; + code[TextureBrushSrcWithPatternFragmentShader] = qopenglslTextureBrushSrcWithPatternFragmentShader; + code[PatternBrushSrcFragmentShader] = qopenglslPatternBrushSrcFragmentShader; + code[LinearGradientBrushSrcFragmentShader] = qopenglslLinearGradientBrushSrcFragmentShader; + code[RadialGradientBrushSrcFragmentShader] = qopenglslRadialGradientBrushSrcFragmentShader; + code[ConicalGradientBrushSrcFragmentShader] = qopenglslConicalGradientBrushSrcFragmentShader; + code[ShockingPinkSrcFragmentShader] = qopenglslShockingPinkSrcFragmentShader; + + code[NoMaskFragmentShader] = ""; + code[MaskFragmentShader] = qopenglslMaskFragmentShader; + code[RgbMaskFragmentShaderPass1] = qopenglslRgbMaskFragmentShaderPass1; + code[RgbMaskFragmentShaderPass2] = qopenglslRgbMaskFragmentShaderPass2; + code[RgbMaskWithGammaFragmentShader] = ""; //### + + code[NoCompositionModeFragmentShader] = ""; + code[MultiplyCompositionModeFragmentShader] = ""; //### + code[ScreenCompositionModeFragmentShader] = ""; //### + code[OverlayCompositionModeFragmentShader] = ""; //### + code[DarkenCompositionModeFragmentShader] = ""; //### + code[LightenCompositionModeFragmentShader] = ""; //### + code[ColorDodgeCompositionModeFragmentShader] = ""; //### + code[ColorBurnCompositionModeFragmentShader] = ""; //### + code[HardLightCompositionModeFragmentShader] = ""; //### + code[SoftLightCompositionModeFragmentShader] = ""; //### + code[DifferenceCompositionModeFragmentShader] = ""; //### + code[ExclusionCompositionModeFragmentShader] = ""; //### + +#if defined(QT_DEBUG) + // Check that all the elements have been filled: + for (int i = 0; i < TotalSnippetCount; ++i) { + if (qShaderSnippets[i] == 0) { + qFatal("Shader snippet for %s (#%d) is missing!", + snippetNameStr(SnippetName(i)).constData(), i); + } + } +#endif + snippetsPopulated = true; + } + + QOpenGLShader* fragShader; + QOpenGLShader* vertexShader; + QByteArray vertexSource; + QByteArray fragSource; + + // Compile up the simple shader: + vertexSource.append(qShaderSnippets[MainVertexShader]); + vertexSource.append(qShaderSnippets[PositionOnlyVertexShader]); + + fragSource.append(qShaderSnippets[MainFragmentShader]); + fragSource.append(qShaderSnippets[ShockingPinkSrcFragmentShader]); + + simpleShaderProg = new QOpenGLShaderProgram; + + CachedShader simpleShaderCache(fragSource, vertexSource); + + bool inCache = simpleShaderCache.load(simpleShaderProg, context); + + if (!inCache) { + vertexShader = new QOpenGLShader(QOpenGLShader::Vertex); + shaders.append(vertexShader); + if (!vertexShader->compileSourceCode(vertexSource)) + qWarning("Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile"); + + fragShader = new QOpenGLShader(QOpenGLShader::Fragment); + shaders.append(fragShader); + if (!fragShader->compileSourceCode(fragSource)) + qWarning("Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile"); + + simpleShaderProg->addShader(vertexShader); + simpleShaderProg->addShader(fragShader); + + simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); + simpleShaderProg->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); + simpleShaderProg->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); + simpleShaderProg->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); + } + + simpleShaderProg->link(); + + if (simpleShaderProg->isLinked()) { + if (!inCache) + simpleShaderCache.store(simpleShaderProg, context); + } else { + qCritical() << "Errors linking simple shader:" + << simpleShaderProg->log(); + } + + // Compile the blit shader: + vertexSource.clear(); + vertexSource.append(qShaderSnippets[MainWithTexCoordsVertexShader]); + vertexSource.append(qShaderSnippets[UntransformedPositionVertexShader]); + + fragSource.clear(); + fragSource.append(qShaderSnippets[MainFragmentShader]); + fragSource.append(qShaderSnippets[ImageSrcFragmentShader]); + + blitShaderProg = new QOpenGLShaderProgram; + + CachedShader blitShaderCache(fragSource, vertexSource); + + inCache = blitShaderCache.load(blitShaderProg, context); + + if (!inCache) { + vertexShader = new QOpenGLShader(QOpenGLShader::Vertex); + shaders.append(vertexShader); + if (!vertexShader->compileSourceCode(vertexSource)) + qWarning("Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile"); + + fragShader = new QOpenGLShader(QOpenGLShader::Fragment); + shaders.append(fragShader); + if (!fragShader->compileSourceCode(fragSource)) + qWarning("Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile"); + + blitShaderProg->addShader(vertexShader); + blitShaderProg->addShader(fragShader); + + blitShaderProg->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); + blitShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); + } + + blitShaderProg->link(); + if (blitShaderProg->isLinked()) { + if (!inCache) + blitShaderCache.store(blitShaderProg, context); + } else { + qCritical() << "Errors linking blit shader:" + << blitShaderProg->log(); + } + +#ifdef QT_GL_SHARED_SHADER_DEBUG + qDebug(" -> QOpenGLEngineSharedShaders() %p for thread %p.", this, QThread::currentThread()); +#endif +} + +QOpenGLEngineSharedShaders::~QOpenGLEngineSharedShaders() +{ +#ifdef QT_GL_SHARED_SHADER_DEBUG + qDebug(" -> ~QOpenGLEngineSharedShaders() %p for thread %p.", this, QThread::currentThread()); +#endif + qDeleteAll(shaders); + shaders.clear(); + + qDeleteAll(cachedPrograms); + cachedPrograms.clear(); + + if (blitShaderProg) { + delete blitShaderProg; + blitShaderProg = 0; + } + + if (simpleShaderProg) { + delete simpleShaderProg; + simpleShaderProg = 0; + } +} + +#if defined (QT_DEBUG) +QByteArray QOpenGLEngineSharedShaders::snippetNameStr(SnippetName name) +{ + QMetaEnum m = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("SnippetName")); + return QByteArray(m.valueToKey(name)); +} +#endif + +// The address returned here will only be valid until next time this function is called. +// The program is return bound. +QOpenGLEngineShaderProg *QOpenGLEngineSharedShaders::findProgramInCache(const QOpenGLEngineShaderProg &prog) +{ + for (int i = 0; i < cachedPrograms.size(); ++i) { + QOpenGLEngineShaderProg *cachedProg = cachedPrograms[i]; + if (*cachedProg == prog) { + // Move the program to the top of the list as a poor-man's cache algo + cachedPrograms.move(i, 0); + cachedProg->program->bind(); + return cachedProg; + } + } + + QScopedPointer newProg; + + do { + QByteArray fragSource; + // Insert the custom stage before the srcPixel shader to work around an ATI driver bug + // where you cannot forward declare a function that takes a sampler as argument. + if (prog.srcPixelFragShader == CustomImageSrcFragmentShader) + fragSource.append(prog.customStageSource); + fragSource.append(qShaderSnippets[prog.mainFragShader]); + fragSource.append(qShaderSnippets[prog.srcPixelFragShader]); + if (prog.compositionFragShader) + fragSource.append(qShaderSnippets[prog.compositionFragShader]); + if (prog.maskFragShader) + fragSource.append(qShaderSnippets[prog.maskFragShader]); + + QByteArray vertexSource; + vertexSource.append(qShaderSnippets[prog.mainVertexShader]); + vertexSource.append(qShaderSnippets[prog.positionVertexShader]); + + QScopedPointer shaderProgram(new QOpenGLShaderProgram); + + CachedShader shaderCache(fragSource, vertexSource); + bool inCache = shaderCache.load(shaderProgram.data(), QOpenGLContext::currentContext()); + + if (!inCache) { + + QScopedPointer fragShader(new QOpenGLShader(QOpenGLShader::Fragment)); + QByteArray description; +#if defined(QT_DEBUG) + // Name the shader for easier debugging + description.append("Fragment shader: main="); + description.append(snippetNameStr(prog.mainFragShader)); + description.append(", srcPixel="); + description.append(snippetNameStr(prog.srcPixelFragShader)); + if (prog.compositionFragShader) { + description.append(", composition="); + description.append(snippetNameStr(prog.compositionFragShader)); + } + if (prog.maskFragShader) { + description.append(", mask="); + description.append(snippetNameStr(prog.maskFragShader)); + } + fragShader->setObjectName(QString::fromLatin1(description)); +#endif + if (!fragShader->compileSourceCode(fragSource)) { + qWarning() << "Warning:" << description << "failed to compile!"; + break; + } + + QScopedPointer vertexShader(new QOpenGLShader(QOpenGLShader::Vertex)); +#if defined(QT_DEBUG) + // Name the shader for easier debugging + description.clear(); + description.append("Vertex shader: main="); + description.append(snippetNameStr(prog.mainVertexShader)); + description.append(", position="); + description.append(snippetNameStr(prog.positionVertexShader)); + vertexShader->setObjectName(QString::fromLatin1(description)); +#endif + if (!vertexShader->compileSourceCode(vertexSource)) { + qWarning() << "Warning:" << description << "failed to compile!"; + break; + } + + shaders.append(vertexShader.data()); + shaders.append(fragShader.data()); + shaderProgram->addShader(vertexShader.take()); + shaderProgram->addShader(fragShader.take()); + + // We have to bind the vertex attribute names before the program is linked: + shaderProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); + if (prog.useTextureCoords) + shaderProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); + if (prog.useOpacityAttribute) + shaderProgram->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); + if (prog.usePmvMatrixAttribute) { + shaderProgram->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); + shaderProgram->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); + shaderProgram->bindAttributeLocation("pmvMatrix3", QT_PMV_MATRIX_3_ATTR); + } + } + + newProg.reset(new QOpenGLEngineShaderProg(prog)); + newProg->program = shaderProgram.take(); + + newProg->program->link(); + if (newProg->program->isLinked()) { + if (!inCache) + shaderCache.store(newProg->program, QOpenGLContext::currentContext()); + } else { + QLatin1String none("none"); + QLatin1String br("\n"); + QString error; + error = QLatin1String("Shader program failed to link,"); +#if defined(QT_DEBUG) + error += QLatin1String("\n Shaders Used:\n"); + for (int i = 0; i < newProg->program->shaders().count(); ++i) { + QOpenGLShader *shader = newProg->program->shaders().at(i); + error += QLatin1String(" ") + shader->objectName() + QLatin1String(": \n") + + QLatin1String(shader->sourceCode()) + br; + } +#endif + error += QLatin1String(" Error Log:\n") + + QLatin1String(" ") + newProg->program->log(); + qWarning() << error; + break; + } + + newProg->program->bind(); + + if (newProg->maskFragShader != QOpenGLEngineSharedShaders::NoMaskFragmentShader) { + GLuint location = newProg->program->uniformLocation("maskTexture"); + newProg->program->setUniformValue(location, QT_MASK_TEXTURE_UNIT); + } + + if (cachedPrograms.count() > 30) { + // The cache is full, so delete the last 5 programs in the list. + // These programs will be least used, as a program us bumped to + // the top of the list when it's used. + for (int i = 0; i < 5; ++i) { + delete cachedPrograms.last(); + cachedPrograms.removeLast(); + } + } + + cachedPrograms.insert(0, newProg.data()); + } while (false); + + return newProg.take(); +} + +void QOpenGLEngineSharedShaders::cleanupCustomStage(QOpenGLCustomShaderStage* stage) +{ + // Remove any shader programs which has this as the custom shader src: + for (int i = 0; i < cachedPrograms.size(); ++i) { + QOpenGLEngineShaderProg *cachedProg = cachedPrograms[i]; + if (cachedProg->customStageSource == stage->source()) { + delete cachedProg; + cachedPrograms.removeAt(i); + i--; + } + } +} + + +QOpenGLEngineShaderManager::QOpenGLEngineShaderManager(QOpenGLContext* context) + : ctx(context), + shaderProgNeedsChanging(true), + complexGeometry(false), + srcPixelType(Qt::NoBrush), + opacityMode(NoOpacity), + maskType(NoMask), + compositionMode(QPainter::CompositionMode_SourceOver), + customSrcStage(0), + currentShaderProg(0) +{ + sharedShaders = QOpenGLEngineSharedShaders::shadersForContext(context); +} + +QOpenGLEngineShaderManager::~QOpenGLEngineShaderManager() +{ + //### + removeCustomStage(); +} + +GLuint QOpenGLEngineShaderManager::getUniformLocation(Uniform id) +{ + if (!currentShaderProg) + return 0; + + QVector &uniformLocations = currentShaderProg->uniformLocations; + if (uniformLocations.isEmpty()) + uniformLocations.fill(GLuint(-1), NumUniforms); + + static const char *uniformNames[] = { + "imageTexture", + "patternColor", + "globalOpacity", + "depth", + "maskTexture", + "fragmentColor", + "linearData", + "angle", + "halfViewportSize", + "fmp", + "fmp2_m_radius2", + "inverse_2_fmp2_m_radius2", + "sqrfr", + "bradius", + "invertedTextureSize", + "brushTransform", + "brushTexture", + "matrix" + }; + + if (uniformLocations.at(id) == GLuint(-1)) + uniformLocations[id] = currentShaderProg->program->uniformLocation(uniformNames[id]); + + return uniformLocations.at(id); +} + + +void QOpenGLEngineShaderManager::optimiseForBrushTransform(QTransform::TransformationType transformType) +{ + Q_UNUSED(transformType); // Currently ignored +} + +void QOpenGLEngineShaderManager::setDirty() +{ + shaderProgNeedsChanging = true; +} + +void QOpenGLEngineShaderManager::setSrcPixelType(Qt::BrushStyle style) +{ + Q_ASSERT(style != Qt::NoBrush); + if (srcPixelType == PixelSrcType(style)) + return; + + srcPixelType = style; + shaderProgNeedsChanging = true; //### +} + +void QOpenGLEngineShaderManager::setSrcPixelType(PixelSrcType type) +{ + if (srcPixelType == type) + return; + + srcPixelType = type; + shaderProgNeedsChanging = true; //### +} + +void QOpenGLEngineShaderManager::setOpacityMode(OpacityMode mode) +{ + if (opacityMode == mode) + return; + + opacityMode = mode; + shaderProgNeedsChanging = true; //### +} + +void QOpenGLEngineShaderManager::setMaskType(MaskType type) +{ + if (maskType == type) + return; + + maskType = type; + shaderProgNeedsChanging = true; //### +} + +void QOpenGLEngineShaderManager::setCompositionMode(QPainter::CompositionMode mode) +{ + if (compositionMode == mode) + return; + + compositionMode = mode; + shaderProgNeedsChanging = true; //### +} + +void QOpenGLEngineShaderManager::setCustomStage(QOpenGLCustomShaderStage* stage) +{ + if (customSrcStage) + removeCustomStage(); + customSrcStage = stage; + shaderProgNeedsChanging = true; +} + +void QOpenGLEngineShaderManager::removeCustomStage() +{ + if (customSrcStage) + customSrcStage->setInactive(); + customSrcStage = 0; + shaderProgNeedsChanging = true; +} + +QOpenGLShaderProgram* QOpenGLEngineShaderManager::currentProgram() +{ + if (currentShaderProg) + return currentShaderProg->program; + else + return sharedShaders->simpleProgram(); +} + +void QOpenGLEngineShaderManager::useSimpleProgram() +{ + sharedShaders->simpleProgram()->bind(); + QOpenGLContextPrivate* ctx_d = ctx->d_func(); + Q_UNUSED(ctx_d); + + QOpenGL2PaintEngineEx *active_engine = static_cast(ctx_d->active_engine); + + active_engine->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true); + active_engine->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false); + active_engine->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false); + + shaderProgNeedsChanging = true; +} + +void QOpenGLEngineShaderManager::useBlitProgram() +{ + sharedShaders->blitProgram()->bind(); + QOpenGLContextPrivate* ctx_d = ctx->d_func(); + QOpenGL2PaintEngineEx *active_engine = static_cast(ctx_d->active_engine); + active_engine->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true); + active_engine->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, true); + active_engine->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false); + shaderProgNeedsChanging = true; +} + +QOpenGLShaderProgram* QOpenGLEngineShaderManager::simpleProgram() +{ + return sharedShaders->simpleProgram(); +} + +QOpenGLShaderProgram* QOpenGLEngineShaderManager::blitProgram() +{ + return sharedShaders->blitProgram(); +} + + + +// Select & use the correct shader program using the current state. +// Returns true if program needed changing. +bool QOpenGLEngineShaderManager::useCorrectShaderProg() +{ + if (!shaderProgNeedsChanging) + return false; + + bool useCustomSrc = customSrcStage != 0; + if (useCustomSrc && srcPixelType != QOpenGLEngineShaderManager::ImageSrc && srcPixelType != Qt::TexturePattern) { + useCustomSrc = false; + qWarning("QOpenGLEngineShaderManager - Ignoring custom shader stage for non image src"); + } + + QOpenGLEngineShaderProg requiredProgram; + + bool texCoords = false; + + // Choose vertex shader shader position function (which typically also sets + // varyings) and the source pixel (srcPixel) fragment shader function: + requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::InvalidSnippetName; + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::InvalidSnippetName; + bool isAffine = brushTransform.isAffine(); + if ( (srcPixelType >= Qt::Dense1Pattern) && (srcPixelType <= Qt::DiagCrossPattern) ) { + if (isAffine) + requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::AffinePositionWithPatternBrushVertexShader; + else + requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionWithPatternBrushVertexShader; + + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::PatternBrushSrcFragmentShader; + } + else switch (srcPixelType) { + default: + case Qt::NoBrush: + qFatal("QOpenGLEngineShaderManager::useCorrectShaderProg() - Qt::NoBrush style is set"); + break; + case QOpenGLEngineShaderManager::ImageSrc: + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::ImageSrcFragmentShader; + requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader; + texCoords = true; + break; + case QOpenGLEngineShaderManager::NonPremultipliedImageSrc: + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::NonPremultipliedImageSrcFragmentShader; + requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader; + texCoords = true; + break; + case QOpenGLEngineShaderManager::PatternSrc: + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::ImageSrcWithPatternFragmentShader; + requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader; + texCoords = true; + break; + case QOpenGLEngineShaderManager::TextureSrcWithPattern: + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::TextureBrushSrcWithPatternFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QOpenGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader + : QOpenGLEngineSharedShaders::PositionWithTextureBrushVertexShader; + break; + case Qt::SolidPattern: + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::SolidBrushSrcFragmentShader; + requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::PositionOnlyVertexShader; + break; + case Qt::LinearGradientPattern: + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::LinearGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QOpenGLEngineSharedShaders::AffinePositionWithLinearGradientBrushVertexShader + : QOpenGLEngineSharedShaders::PositionWithLinearGradientBrushVertexShader; + break; + case Qt::ConicalGradientPattern: + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::ConicalGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QOpenGLEngineSharedShaders::AffinePositionWithConicalGradientBrushVertexShader + : QOpenGLEngineSharedShaders::PositionWithConicalGradientBrushVertexShader; + break; + case Qt::RadialGradientPattern: + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::RadialGradientBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QOpenGLEngineSharedShaders::AffinePositionWithRadialGradientBrushVertexShader + : QOpenGLEngineSharedShaders::PositionWithRadialGradientBrushVertexShader; + break; + case Qt::TexturePattern: + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::TextureBrushSrcFragmentShader; + requiredProgram.positionVertexShader = isAffine ? QOpenGLEngineSharedShaders::AffinePositionWithTextureBrushVertexShader + : QOpenGLEngineSharedShaders::PositionWithTextureBrushVertexShader; + break; + }; + + if (useCustomSrc) { + requiredProgram.srcPixelFragShader = QOpenGLEngineSharedShaders::CustomImageSrcFragmentShader; + requiredProgram.customStageSource = customSrcStage->source(); + } + + const bool hasCompose = compositionMode > QPainter::CompositionMode_Plus; + const bool hasMask = maskType != QOpenGLEngineShaderManager::NoMask; + + // Choose fragment shader main function: + if (opacityMode == AttributeOpacity) { + Q_ASSERT(!hasCompose && !hasMask); + requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_ImageArrays; + } else { + bool useGlobalOpacity = (opacityMode == UniformOpacity); + if (hasCompose && hasMask && useGlobalOpacity) + requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_CMO; + if (hasCompose && hasMask && !useGlobalOpacity) + requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_CM; + if (!hasCompose && hasMask && useGlobalOpacity) + requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_MO; + if (!hasCompose && hasMask && !useGlobalOpacity) + requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_M; + if (hasCompose && !hasMask && useGlobalOpacity) + requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_CO; + if (hasCompose && !hasMask && !useGlobalOpacity) + requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_C; + if (!hasCompose && !hasMask && useGlobalOpacity) + requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader_O; + if (!hasCompose && !hasMask && !useGlobalOpacity) + requiredProgram.mainFragShader = QOpenGLEngineSharedShaders::MainFragmentShader; + } + + if (hasMask) { + if (maskType == PixelMask) { + requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::MaskFragmentShader; + texCoords = true; + } else if (maskType == SubPixelMaskPass1) { + requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::RgbMaskFragmentShaderPass1; + texCoords = true; + } else if (maskType == SubPixelMaskPass2) { + requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::RgbMaskFragmentShaderPass2; + texCoords = true; + } else if (maskType == SubPixelWithGammaMask) { + requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::RgbMaskWithGammaFragmentShader; + texCoords = true; + } else { + qCritical("QOpenGLEngineShaderManager::useCorrectShaderProg() - Unknown mask type"); + } + } else { + requiredProgram.maskFragShader = QOpenGLEngineSharedShaders::NoMaskFragmentShader; + } + + if (hasCompose) { + switch (compositionMode) { + case QPainter::CompositionMode_Multiply: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::MultiplyCompositionModeFragmentShader; + break; + case QPainter::CompositionMode_Screen: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ScreenCompositionModeFragmentShader; + break; + case QPainter::CompositionMode_Overlay: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::OverlayCompositionModeFragmentShader; + break; + case QPainter::CompositionMode_Darken: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::DarkenCompositionModeFragmentShader; + break; + case QPainter::CompositionMode_Lighten: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::LightenCompositionModeFragmentShader; + break; + case QPainter::CompositionMode_ColorDodge: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ColorDodgeCompositionModeFragmentShader; + break; + case QPainter::CompositionMode_ColorBurn: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ColorBurnCompositionModeFragmentShader; + break; + case QPainter::CompositionMode_HardLight: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::HardLightCompositionModeFragmentShader; + break; + case QPainter::CompositionMode_SoftLight: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::SoftLightCompositionModeFragmentShader; + break; + case QPainter::CompositionMode_Difference: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::DifferenceCompositionModeFragmentShader; + break; + case QPainter::CompositionMode_Exclusion: + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::ExclusionCompositionModeFragmentShader; + break; + default: + qWarning("QOpenGLEngineShaderManager::useCorrectShaderProg() - Unsupported composition mode"); + } + } else { + requiredProgram.compositionFragShader = QOpenGLEngineSharedShaders::NoCompositionModeFragmentShader; + } + + // Choose vertex shader main function + if (opacityMode == AttributeOpacity) { + Q_ASSERT(texCoords); + requiredProgram.mainVertexShader = QOpenGLEngineSharedShaders::MainWithTexCoordsAndOpacityVertexShader; + } else if (texCoords) { + requiredProgram.mainVertexShader = QOpenGLEngineSharedShaders::MainWithTexCoordsVertexShader; + } else { + requiredProgram.mainVertexShader = QOpenGLEngineSharedShaders::MainVertexShader; + } + requiredProgram.useTextureCoords = texCoords; + requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity); + if (complexGeometry && srcPixelType == Qt::SolidPattern) { + requiredProgram.positionVertexShader = QOpenGLEngineSharedShaders::ComplexGeometryPositionOnlyVertexShader; + requiredProgram.usePmvMatrixAttribute = false; + } else { + requiredProgram.usePmvMatrixAttribute = true; + + // Force complexGeometry off, since we currently don't support that mode for + // non-solid brushes + complexGeometry = false; + } + + // At this point, requiredProgram is fully populated so try to find the program in the cache + currentShaderProg = sharedShaders->findProgramInCache(requiredProgram); + + if (currentShaderProg && useCustomSrc) { + customSrcStage->setUniforms(currentShaderProg->program); + } + + // Make sure all the vertex attribute arrays the program uses are enabled (and the ones it + // doesn't use are disabled) + QOpenGLContextPrivate* ctx_d = ctx->d_func(); + QOpenGL2PaintEngineEx *active_engine = static_cast(ctx_d->active_engine); + active_engine->d_func()->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true); + active_engine->d_func()->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, currentShaderProg && currentShaderProg->useTextureCoords); + active_engine->d_func()->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, currentShaderProg && currentShaderProg->useOpacityAttribute); + + shaderProgNeedsChanging = false; + return true; +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglengineshadermanager_p.h b/src/gui/opengl/qopenglengineshadermanager_p.h new file mode 100644 index 00000000000..1dcc4fe7a76 --- /dev/null +++ b/src/gui/opengl/qopenglengineshadermanager_p.h @@ -0,0 +1,514 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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. +// + +/* + VERTEX SHADERS + ============== + + Vertex shaders are specified as multiple (partial) shaders. On desktop, + this works fine. On ES, QOpenGLShader & QOpenGLShaderProgram will make partial + shaders work by concatenating the source in each QOpenGLShader and compiling + it as a single shader. This is abstracted nicely by QOpenGLShaderProgram and + the GL2 engine doesn't need to worry about it. + + Generally, there's two vertex shader objects. The position shaders are + the ones which set gl_Position. There's also two "main" vertex shaders, + one which just calls the position shader and another which also passes + through some texture coordinates from a vertex attribute array to a + varying. These texture coordinates are used for mask position in text + rendering and for the source coordinates in drawImage/drawPixmap. There's + also a "Simple" vertex shader for rendering a solid colour (used to render + into the stencil buffer where the actual colour value is discarded). + + The position shaders for brushes look scary. This is because many of the + calculations which logically belong in the fragment shader have been moved + into the vertex shader to improve performance. This is why the position + calculation is in a separate shader. Not only does it calculate the + position, but it also calculates some data to be passed to the fragment + shader as a varying. It is optimal to move as much of the calculation as + possible into the vertex shader as this is executed less often. + + The varyings passed to the fragment shaders are interpolated (which is + cheap). Unfortunately, GL will apply perspective correction to the + interpolation calusing errors. To get around this, the vertex shader must + apply perspective correction itself and set the w-value of gl_Position to + zero. That way, GL will be tricked into thinking it doesn't need to apply a + perspective correction and use linear interpolation instead (which is what + we want). Of course, if the brush transform is affeine, no perspective + correction is needed and a simpler vertex shader can be used instead. + + So there are the following "main" vertex shaders: + qopenglslMainVertexShader + qopenglslMainWithTexCoordsVertexShader + + And the the following position vertex shaders: + qopenglslPositionOnlyVertexShader + qopenglslPositionWithTextureBrushVertexShader + qopenglslPositionWithPatternBrushVertexShader + qopenglslPositionWithLinearGradientBrushVertexShader + qopenglslPositionWithRadialGradientBrushVertexShader + qopenglslPositionWithConicalGradientBrushVertexShader + qopenglslAffinePositionWithTextureBrushVertexShader + qopenglslAffinePositionWithPatternBrushVertexShader + qopenglslAffinePositionWithLinearGradientBrushVertexShader + qopenglslAffinePositionWithRadialGradientBrushVertexShader + qopenglslAffinePositionWithConicalGradientBrushVertexShader + + Leading to 23 possible vertex shaders + + + FRAGMENT SHADERS + ================ + + Fragment shaders are also specified as multiple (partial) shaders. The + different fragment shaders represent the different stages in Qt's fragment + pipeline. There are 1-3 stages in this pipeline: First stage is to get the + fragment's colour value. The next stage is to get the fragment's mask value + (coverage value for anti-aliasing) and the final stage is to blend the + incoming fragment with the background (for composition modes not supported + by GL). + + Of these, the first stage will always be present. If Qt doesn't need to + apply anti-aliasing (because it's off or handled by multisampling) then + the coverage value doesn't need to be applied. (Note: There are two types + of mask, one for regular anti-aliasing and one for sub-pixel anti- + aliasing.) If the composition mode is one which GL supports natively then + the blending stage doesn't need to be applied. + + As eash stage can have multiple implementations, they are abstracted as + GLSL function calls with the following signatures: + + Brushes & image drawing are implementations of "qcolorp vec4 srcPixel()": + qopenglslImageSrcFragShader + qopenglslImageSrcWithPatternFragShader + qopenglslNonPremultipliedImageSrcFragShader + qopenglslSolidBrushSrcFragShader + qopenglslTextureBrushSrcFragShader + qopenglslTextureBrushWithPatternFragShader + qopenglslPatternBrushSrcFragShader + qopenglslLinearGradientBrushSrcFragShader + qopenglslRadialGradientBrushSrcFragShader + qopenglslConicalGradientBrushSrcFragShader + NOTE: It is assumed the colour returned by srcPixel() is pre-multiplied + + Masks are implementations of "qcolorp vec4 applyMask(qcolorp vec4 src)": + qopenglslMaskFragmentShader + qopenglslRgbMaskFragmentShaderPass1 + qopenglslRgbMaskFragmentShaderPass2 + qopenglslRgbMaskWithGammaFragmentShader + + Composition modes are "qcolorp vec4 compose(qcolorp vec4 src)": + qopenglslColorBurnCompositionModeFragmentShader + qopenglslColorDodgeCompositionModeFragmentShader + qopenglslDarkenCompositionModeFragmentShader + qopenglslDifferenceCompositionModeFragmentShader + qopenglslExclusionCompositionModeFragmentShader + qopenglslHardLightCompositionModeFragmentShader + qopenglslLightenCompositionModeFragmentShader + qopenglslMultiplyCompositionModeFragmentShader + qopenglslOverlayCompositionModeFragmentShader + qopenglslScreenCompositionModeFragmentShader + qopenglslSoftLightCompositionModeFragmentShader + + + Note: In the future, some GLSL compilers will support an extension allowing + a new 'color' precision specifier. To support this, qcolorp is used for + all color components so it can be defined to colorp or lowp depending upon + the implementation. + + So there are differnt frament shader main functions, depending on the + number & type of pipelines the fragment needs to go through. + + The choice of which main() fragment shader string to use depends on: + - Use of global opacity + - Brush style (some brushes apply opacity themselves) + - Use & type of mask (TODO: Need to support high quality anti-aliasing & text) + - Use of non-GL Composition mode + + Leading to the following fragment shader main functions: + gl_FragColor = compose(applyMask(srcPixel()*globalOpacity)); + gl_FragColor = compose(applyMask(srcPixel())); + gl_FragColor = applyMask(srcPixel()*globalOpacity); + gl_FragColor = applyMask(srcPixel()); + gl_FragColor = compose(srcPixel()*globalOpacity); + gl_FragColor = compose(srcPixel()); + gl_FragColor = srcPixel()*globalOpacity; + gl_FragColor = srcPixel(); + + Called: + qopenglslMainFragmentShader_CMO + qopenglslMainFragmentShader_CM + qopenglslMainFragmentShader_MO + qopenglslMainFragmentShader_M + qopenglslMainFragmentShader_CO + qopenglslMainFragmentShader_C + qopenglslMainFragmentShader_O + qopenglslMainFragmentShader + + Where: + M = Mask + C = Composition + O = Global Opacity + + + CUSTOM SHADER CODE + ================== + + The use of custom shader code is supported by the engine for drawImage and + drawPixmap calls. This is implemented via hooks in the fragment pipeline. + + The custom shader is passed to the engine as a partial fragment shader + (QOpenGLCustomShaderStage). The shader will implement a pre-defined method name + which Qt's fragment pipeline will call: + + lowp vec4 customShader(lowp sampler2d imageTexture, highp vec2 textureCoords) + + The provided src and srcCoords parameters can be used to sample from the + source image. + + Transformations, clipping, opacity, and composition modes set using QPainter + will be respected when using the custom shader hook. +*/ + +#ifndef QOPENGLENGINE_SHADER_MANAGER_H +#define QOPENGLENGINE_SHADER_MANAGER_H + +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + + +/* +struct QOpenGLEngineCachedShaderProg +{ + QOpenGLEngineCachedShaderProg(QOpenGLEngineShaderManager::ShaderName vertexMain, + QOpenGLEngineShaderManager::ShaderName vertexPosition, + QOpenGLEngineShaderManager::ShaderName fragMain, + QOpenGLEngineShaderManager::ShaderName pixelSrc, + QOpenGLEngineShaderManager::ShaderName mask, + QOpenGLEngineShaderManager::ShaderName composition); + + int cacheKey; + QOpenGLShaderProgram* program; +} +*/ + +static const GLuint QT_VERTEX_COORDS_ATTR = 0; +static const GLuint QT_TEXTURE_COORDS_ATTR = 1; +static const GLuint QT_OPACITY_ATTR = 2; +static const GLuint QT_PMV_MATRIX_1_ATTR = 3; +static const GLuint QT_PMV_MATRIX_2_ATTR = 4; +static const GLuint QT_PMV_MATRIX_3_ATTR = 5; + +class QOpenGLEngineShaderProg; + +class Q_GUI_EXPORT QOpenGLEngineSharedShaders +{ + Q_GADGET +public: + + enum SnippetName { + MainVertexShader, + MainWithTexCoordsVertexShader, + MainWithTexCoordsAndOpacityVertexShader, + + // UntransformedPositionVertexShader must be first in the list: + UntransformedPositionVertexShader, + PositionOnlyVertexShader, + ComplexGeometryPositionOnlyVertexShader, + PositionWithPatternBrushVertexShader, + PositionWithLinearGradientBrushVertexShader, + PositionWithConicalGradientBrushVertexShader, + PositionWithRadialGradientBrushVertexShader, + PositionWithTextureBrushVertexShader, + AffinePositionWithPatternBrushVertexShader, + AffinePositionWithLinearGradientBrushVertexShader, + AffinePositionWithConicalGradientBrushVertexShader, + AffinePositionWithRadialGradientBrushVertexShader, + AffinePositionWithTextureBrushVertexShader, + + // MainFragmentShader_CMO must be first in the list: + MainFragmentShader_CMO, + MainFragmentShader_CM, + MainFragmentShader_MO, + MainFragmentShader_M, + MainFragmentShader_CO, + MainFragmentShader_C, + MainFragmentShader_O, + MainFragmentShader, + MainFragmentShader_ImageArrays, + + // ImageSrcFragmentShader must be first in the list:: + ImageSrcFragmentShader, + ImageSrcWithPatternFragmentShader, + NonPremultipliedImageSrcFragmentShader, + CustomImageSrcFragmentShader, + SolidBrushSrcFragmentShader, + TextureBrushSrcFragmentShader, + TextureBrushSrcWithPatternFragmentShader, + PatternBrushSrcFragmentShader, + LinearGradientBrushSrcFragmentShader, + RadialGradientBrushSrcFragmentShader, + ConicalGradientBrushSrcFragmentShader, + ShockingPinkSrcFragmentShader, + + // NoMaskFragmentShader must be first in the list: + NoMaskFragmentShader, + MaskFragmentShader, + RgbMaskFragmentShaderPass1, + RgbMaskFragmentShaderPass2, + RgbMaskWithGammaFragmentShader, + + // NoCompositionModeFragmentShader must be first in the list: + NoCompositionModeFragmentShader, + MultiplyCompositionModeFragmentShader, + ScreenCompositionModeFragmentShader, + OverlayCompositionModeFragmentShader, + DarkenCompositionModeFragmentShader, + LightenCompositionModeFragmentShader, + ColorDodgeCompositionModeFragmentShader, + ColorBurnCompositionModeFragmentShader, + HardLightCompositionModeFragmentShader, + SoftLightCompositionModeFragmentShader, + DifferenceCompositionModeFragmentShader, + ExclusionCompositionModeFragmentShader, + + TotalSnippetCount, InvalidSnippetName + }; +#if defined (QT_DEBUG) + Q_ENUMS(SnippetName) + static QByteArray snippetNameStr(SnippetName snippetName); +#endif + +/* + // These allow the ShaderName enum to be used as a cache key + const int mainVertexOffset = 0; + const int positionVertexOffset = (1<<2) - PositionOnlyVertexShader; + const int mainFragOffset = (1<<6) - MainFragmentShader_CMO; + const int srcPixelOffset = (1<<10) - ImageSrcFragmentShader; + const int maskOffset = (1<<14) - NoMaskShader; + const int compositionOffset = (1 << 16) - MultiplyCompositionModeFragmentShader; +*/ + + QOpenGLEngineSharedShaders(QOpenGLContext *context); + ~QOpenGLEngineSharedShaders(); + + QOpenGLShaderProgram *simpleProgram() { return simpleShaderProg; } + QOpenGLShaderProgram *blitProgram() { return blitShaderProg; } + // Compile the program if it's not already in the cache, return the item in the cache. + QOpenGLEngineShaderProg *findProgramInCache(const QOpenGLEngineShaderProg &prog); + // Compile the custom shader if it's not already in the cache, return the item in the cache. + + static QOpenGLEngineSharedShaders *shadersForContext(QOpenGLContext *context); + + // Ideally, this would be static and cleanup all programs in all contexts which + // contain the custom code. Currently it is just a hint and we rely on deleted + // custom shaders being cleaned up by being kicked out of the cache when it's + // full. + void cleanupCustomStage(QOpenGLCustomShaderStage* stage); + +private: + QOpenGLShaderProgram *blitShaderProg; + QOpenGLShaderProgram *simpleShaderProg; + QList cachedPrograms; + QList shaders; + + static const char* qShaderSnippets[TotalSnippetCount]; +}; + + +class QOpenGLEngineShaderProg +{ +public: + QOpenGLEngineShaderProg() : program(0) {} + + ~QOpenGLEngineShaderProg() { + if (program) + delete program; + } + + QOpenGLEngineSharedShaders::SnippetName mainVertexShader; + QOpenGLEngineSharedShaders::SnippetName positionVertexShader; + QOpenGLEngineSharedShaders::SnippetName mainFragShader; + QOpenGLEngineSharedShaders::SnippetName srcPixelFragShader; + QOpenGLEngineSharedShaders::SnippetName maskFragShader; + QOpenGLEngineSharedShaders::SnippetName compositionFragShader; + + QByteArray customStageSource; //TODO: Decent cache key for custom stages + QOpenGLShaderProgram* program; + + QVector uniformLocations; + + bool useTextureCoords; + bool useOpacityAttribute; + bool usePmvMatrixAttribute; + + bool operator==(const QOpenGLEngineShaderProg& other) { + // We don't care about the program + return ( mainVertexShader == other.mainVertexShader && + positionVertexShader == other.positionVertexShader && + mainFragShader == other.mainFragShader && + srcPixelFragShader == other.srcPixelFragShader && + maskFragShader == other.maskFragShader && + compositionFragShader == other.compositionFragShader && + customStageSource == other.customStageSource + ); + } +}; + +class Q_GUI_EXPORT QOpenGLEngineShaderManager : public QObject +{ + Q_OBJECT +public: + QOpenGLEngineShaderManager(QOpenGLContext* context); + ~QOpenGLEngineShaderManager(); + + enum MaskType {NoMask, PixelMask, SubPixelMaskPass1, SubPixelMaskPass2, SubPixelWithGammaMask}; + enum PixelSrcType { + ImageSrc = Qt::TexturePattern+1, + NonPremultipliedImageSrc = Qt::TexturePattern+2, + PatternSrc = Qt::TexturePattern+3, + TextureSrcWithPattern = Qt::TexturePattern+4 + }; + + enum Uniform { + ImageTexture, + PatternColor, + GlobalOpacity, + Depth, + MaskTexture, + FragmentColor, + LinearData, + Angle, + HalfViewportSize, + Fmp, + Fmp2MRadius2, + Inverse2Fmp2MRadius2, + SqrFr, + BRadius, + InvertedTextureSize, + BrushTransform, + BrushTexture, + Matrix, + NumUniforms + }; + + enum OpacityMode { + NoOpacity, + UniformOpacity, + AttributeOpacity + }; + + // There are optimizations we can do, depending on the brush transform: + // 1) May not have to apply perspective-correction + // 2) Can use lower precision for matrix + void optimiseForBrushTransform(QTransform::TransformationType transformType); + void setSrcPixelType(Qt::BrushStyle); + void setSrcPixelType(PixelSrcType); // For non-brush sources, like pixmaps & images + void setOpacityMode(OpacityMode); + void setMaskType(MaskType); + void setCompositionMode(QPainter::CompositionMode); + void setCustomStage(QOpenGLCustomShaderStage* stage); + void removeCustomStage(); + + GLuint getUniformLocation(Uniform id); + + void setDirty(); // someone has manually changed the current shader program + bool useCorrectShaderProg(); // returns true if the shader program needed to be changed + + void useSimpleProgram(); + void useBlitProgram(); + void setHasComplexGeometry(bool hasComplexGeometry) + { + complexGeometry = hasComplexGeometry; + shaderProgNeedsChanging = true; + } + bool hasComplexGeometry() const + { + return complexGeometry; + } + + QOpenGLShaderProgram* currentProgram(); // Returns pointer to the shader the manager has chosen + QOpenGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers + QOpenGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer + + QOpenGLEngineSharedShaders* sharedShaders; + +private: + QOpenGLContext* ctx; + bool shaderProgNeedsChanging; + bool complexGeometry; + + // Current state variables which influence the choice of shader: + QTransform brushTransform; + int srcPixelType; + OpacityMode opacityMode; + MaskType maskType; + QPainter::CompositionMode compositionMode; + QOpenGLCustomShaderStage* customSrcStage; + + QOpenGLEngineShaderProg* currentShaderProg; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //QOPENGLENGINE_SHADER_MANAGER_H diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h new file mode 100644 index 00000000000..cb852123080 --- /dev/null +++ b/src/gui/opengl/qopenglengineshadersource_p.h @@ -0,0 +1,529 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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. +// + + +#ifndef QOPENGL_ENGINE_SHADER_SOURCE_H +#define QOPENGL_ENGINE_SHADER_SOURCE_H + +#include "qopenglengineshadermanager_p.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + + +static const char* const qopenglslMainVertexShader = "\n\ + void setPosition(); \n\ + void main(void) \n\ + { \n\ + setPosition(); \n\ + }\n"; + +static const char* const qopenglslMainWithTexCoordsVertexShader = "\n\ + attribute highp vec2 textureCoordArray; \n\ + varying highp vec2 textureCoords; \n\ + void setPosition(); \n\ + void main(void) \n\ + { \n\ + setPosition(); \n\ + textureCoords = textureCoordArray; \n\ + }\n"; + +static const char* const qopenglslMainWithTexCoordsAndOpacityVertexShader = "\n\ + attribute highp vec2 textureCoordArray; \n\ + attribute lowp float opacityArray; \n\ + varying highp vec2 textureCoords; \n\ + varying lowp float opacity; \n\ + void setPosition(); \n\ + void main(void) \n\ + { \n\ + setPosition(); \n\ + textureCoords = textureCoordArray; \n\ + opacity = opacityArray; \n\ + }\n"; + +// NOTE: We let GL do the perspective correction so texture lookups in the fragment +// shader are also perspective corrected. +static const char* const qopenglslPositionOnlyVertexShader = "\n\ + attribute highp vec2 vertexCoordsArray; \n\ + attribute highp vec3 pmvMatrix1; \n\ + attribute highp vec3 pmvMatrix2; \n\ + attribute highp vec3 pmvMatrix3; \n\ + void setPosition(void) \n\ + { \n\ + highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\ + vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\ + gl_Position = vec4(transformedPos.xy, 0.0, transformedPos.z); \n\ + }\n"; + +static const char* const qopenglslComplexGeometryPositionOnlyVertexShader = "\n\ + uniform highp mat3 matrix; \n\ + attribute highp vec2 vertexCoordsArray; \n\ + void setPosition(void) \n\ + { \n\ + gl_Position = vec4(matrix * vec3(vertexCoordsArray, 1), 1);\n\ + } \n"; + +static const char* const qopenglslUntransformedPositionVertexShader = "\n\ + attribute highp vec4 vertexCoordsArray; \n\ + void setPosition(void) \n\ + { \n\ + gl_Position = vertexCoordsArray; \n\ + }\n"; + +// Pattern Brush - This assumes the texture size is 8x8 and thus, the inverted size is 0.125 +static const char* const qopenglslPositionWithPatternBrushVertexShader = "\n\ + attribute highp vec2 vertexCoordsArray; \n\ + attribute highp vec3 pmvMatrix1; \n\ + attribute highp vec3 pmvMatrix2; \n\ + attribute highp vec3 pmvMatrix3; \n\ + uniform mediump vec2 halfViewportSize; \n\ + uniform highp vec2 invertedTextureSize; \n\ + uniform highp mat3 brushTransform; \n\ + varying highp vec2 patternTexCoords; \n\ + void setPosition(void) \n\ + { \n\ + highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\ + vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\ + gl_Position.xy = transformedPos.xy / transformedPos.z; \n\ + mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\ + mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1.0); \n\ + mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\ + gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\ + patternTexCoords.xy = (hTexCoords.xy * 0.125) * invertedHTexCoordsZ; \n\ + }\n"; + +static const char* const qopenglslAffinePositionWithPatternBrushVertexShader + = qopenglslPositionWithPatternBrushVertexShader; + +static const char* const qopenglslPatternBrushSrcFragmentShader = "\n\ + uniform sampler2D brushTexture; \n\ + uniform lowp vec4 patternColor; \n\ + varying highp vec2 patternTexCoords;\n\ + lowp vec4 srcPixel() \n\ + { \n\ + return patternColor * (1.0 - texture2D(brushTexture, patternTexCoords).r); \n\ + }\n"; + + +// Linear Gradient Brush +static const char* const qopenglslPositionWithLinearGradientBrushVertexShader = "\n\ + attribute highp vec2 vertexCoordsArray; \n\ + attribute highp vec3 pmvMatrix1; \n\ + attribute highp vec3 pmvMatrix2; \n\ + attribute highp vec3 pmvMatrix3; \n\ + uniform mediump vec2 halfViewportSize; \n\ + uniform highp vec3 linearData; \n\ + uniform highp mat3 brushTransform; \n\ + varying mediump float index; \n\ + void setPosition() \n\ + { \n\ + highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\ + vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\ + gl_Position.xy = transformedPos.xy / transformedPos.z; \n\ + mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\ + mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\ + mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\ + gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\ + index = (dot(linearData.xy, hTexCoords.xy) * linearData.z) * invertedHTexCoordsZ; \n\ + }\n"; + +static const char* const qopenglslAffinePositionWithLinearGradientBrushVertexShader + = qopenglslPositionWithLinearGradientBrushVertexShader; + +static const char* const qopenglslLinearGradientBrushSrcFragmentShader = "\n\ + uniform sampler2D brushTexture; \n\ + varying mediump float index; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + mediump vec2 val = vec2(index, 0.5); \n\ + return texture2D(brushTexture, val); \n\ + }\n"; + + +// Conical Gradient Brush +static const char* const qopenglslPositionWithConicalGradientBrushVertexShader = "\n\ + attribute highp vec2 vertexCoordsArray; \n\ + attribute highp vec3 pmvMatrix1; \n\ + attribute highp vec3 pmvMatrix2; \n\ + attribute highp vec3 pmvMatrix3; \n\ + uniform mediump vec2 halfViewportSize; \n\ + uniform highp mat3 brushTransform; \n\ + varying highp vec2 A; \n\ + void setPosition(void) \n\ + { \n\ + highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\ + vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\ + gl_Position.xy = transformedPos.xy / transformedPos.z; \n\ + mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\ + mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\ + mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\ + gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\ + A = hTexCoords.xy * invertedHTexCoordsZ; \n\ + }\n"; + +static const char* const qopenglslAffinePositionWithConicalGradientBrushVertexShader + = qopenglslPositionWithConicalGradientBrushVertexShader; + +static const char* const qopenglslConicalGradientBrushSrcFragmentShader = "\n\ + #define INVERSE_2PI 0.1591549430918953358 \n\ + uniform sampler2D brushTexture; \n\ + uniform mediump float angle; \n\ + varying highp vec2 A; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + highp float t; \n\ + if (abs(A.y) == abs(A.x)) \n\ + t = (atan(-A.y + 0.002, A.x) + angle) * INVERSE_2PI; \n\ + else \n\ + t = (atan(-A.y, A.x) + angle) * INVERSE_2PI; \n\ + return texture2D(brushTexture, vec2(t - floor(t), 0.5)); \n\ + }\n"; + + +// Radial Gradient Brush +static const char* const qopenglslPositionWithRadialGradientBrushVertexShader = "\n\ + attribute highp vec2 vertexCoordsArray;\n\ + attribute highp vec3 pmvMatrix1; \n\ + attribute highp vec3 pmvMatrix2; \n\ + attribute highp vec3 pmvMatrix3; \n\ + uniform mediump vec2 halfViewportSize; \n\ + uniform highp mat3 brushTransform; \n\ + uniform highp vec2 fmp; \n\ + uniform highp vec3 bradius; \n\ + varying highp float b; \n\ + varying highp vec2 A; \n\ + void setPosition(void) \n\ + {\n\ + highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\ + vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\ + gl_Position.xy = transformedPos.xy / transformedPos.z; \n\ + mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\ + mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\ + mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\ + gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\ + A = hTexCoords.xy * invertedHTexCoordsZ; \n\ + b = bradius.x + 2.0 * dot(A, fmp); \n\ + }\n"; + +static const char* const qopenglslAffinePositionWithRadialGradientBrushVertexShader + = qopenglslPositionWithRadialGradientBrushVertexShader; + +static const char* const qopenglslRadialGradientBrushSrcFragmentShader = "\n\ + uniform sampler2D brushTexture; \n\ + uniform highp float fmp2_m_radius2; \n\ + uniform highp float inverse_2_fmp2_m_radius2; \n\ + uniform highp float sqrfr; \n\ + varying highp float b; \n\ + varying highp vec2 A; \n\ + uniform highp vec3 bradius; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + highp float c = sqrfr-dot(A, A); \n\ + highp float det = b*b - 4.0*fmp2_m_radius2*c; \n\ + lowp vec4 result = vec4(0.0); \n\ + if (det >= 0.0) { \n\ + highp float detSqrt = sqrt(det); \n\ + highp float w = max((-b - detSqrt) * inverse_2_fmp2_m_radius2, (-b + detSqrt) * inverse_2_fmp2_m_radius2); \n\ + if (bradius.y + w * bradius.z >= 0.0) \n\ + result = texture2D(brushTexture, vec2(w, 0.5)); \n\ + } \n\ + return result; \n\ + }\n"; + + +// Texture Brush +static const char* const qopenglslPositionWithTextureBrushVertexShader = "\n\ + attribute highp vec2 vertexCoordsArray; \n\ + attribute highp vec3 pmvMatrix1; \n\ + attribute highp vec3 pmvMatrix2; \n\ + attribute highp vec3 pmvMatrix3; \n\ + uniform mediump vec2 halfViewportSize; \n\ + uniform highp vec2 invertedTextureSize; \n\ + uniform highp mat3 brushTransform; \n\ + varying highp vec2 brushTextureCoords; \n\ + void setPosition(void) \n\ + { \n\ + highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\ + vec3 transformedPos = pmvMatrix * vec3(vertexCoordsArray.xy, 1.0); \n\ + gl_Position.xy = transformedPos.xy / transformedPos.z; \n\ + mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \n\ + mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\ + mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\ + gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\ + brushTextureCoords.xy = (hTexCoords.xy * invertedTextureSize) * gl_Position.w; \n\ + }\n"; + +static const char* const qopenglslAffinePositionWithTextureBrushVertexShader + = qopenglslPositionWithTextureBrushVertexShader; + +#if defined(QT_OPENGL_ES_2) +// OpenGL ES does not support GL_REPEAT wrap modes for NPOT textures. So instead, +// we emulate GL_REPEAT by only taking the fractional part of the texture coords. +// TODO: Special case POT textures which don't need this emulation +static const char* const qopenglslTextureBrushSrcFragmentShader = "\n\ + varying highp vec2 brushTextureCoords; \n\ + uniform sampler2D brushTexture; \n\ + lowp vec4 srcPixel() { \n\ + return texture2D(brushTexture, fract(brushTextureCoords)); \n\ + }\n"; +#else +static const char* const qopenglslTextureBrushSrcFragmentShader = "\n\ + varying highp vec2 brushTextureCoords; \n\ + uniform sampler2D brushTexture; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + return texture2D(brushTexture, brushTextureCoords); \n\ + }\n"; +#endif + +static const char* const qopenglslTextureBrushSrcWithPatternFragmentShader = "\n\ + varying highp vec2 brushTextureCoords; \n\ + uniform lowp vec4 patternColor; \n\ + uniform sampler2D brushTexture; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + return patternColor * (1.0 - texture2D(brushTexture, brushTextureCoords).r); \n\ + }\n"; + +// Solid Fill Brush +static const char* const qopenglslSolidBrushSrcFragmentShader = "\n\ + uniform lowp vec4 fragmentColor; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + return fragmentColor; \n\ + }\n"; + +static const char* const qopenglslImageSrcFragmentShader = "\n\ + varying highp vec2 textureCoords; \n\ + uniform sampler2D imageTexture; \n\ + lowp vec4 srcPixel() \n\ + { \n" + "return texture2D(imageTexture, textureCoords); \n" + "}\n"; + +static const char* const qopenglslCustomSrcFragmentShader = "\n\ + varying highp vec2 textureCoords; \n\ + uniform sampler2D imageTexture; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + return customShader(imageTexture, textureCoords); \n\ + }\n"; + +static const char* const qopenglslImageSrcWithPatternFragmentShader = "\n\ + varying highp vec2 textureCoords; \n\ + uniform lowp vec4 patternColor; \n\ + uniform sampler2D imageTexture; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + return patternColor * (1.0 - texture2D(imageTexture, textureCoords).r); \n\ + }\n"; + +static const char* const qopenglslNonPremultipliedImageSrcFragmentShader = "\n\ + varying highp vec2 textureCoords; \n\ + uniform sampler2D imageTexture; \n\ + lowp vec4 srcPixel() \n\ + { \n\ + lowp vec4 sample = texture2D(imageTexture, textureCoords); \n\ + sample.rgb = sample.rgb * sample.a; \n\ + return sample; \n\ + }\n"; + +static const char* const qopenglslShockingPinkSrcFragmentShader = "\n\ + lowp vec4 srcPixel() \n\ + { \n\ + return vec4(0.98, 0.06, 0.75, 1.0); \n\ + }\n"; + +static const char* const qopenglslMainFragmentShader_ImageArrays = "\n\ + varying lowp float opacity; \n\ + lowp vec4 srcPixel(); \n\ + void main() \n\ + { \n\ + gl_FragColor = srcPixel() * opacity; \n\ + }\n"; + +static const char* const qopenglslMainFragmentShader_CMO = "\n\ + uniform lowp float globalOpacity; \n\ + lowp vec4 srcPixel(); \n\ + lowp vec4 applyMask(lowp vec4); \n\ + lowp vec4 compose(lowp vec4); \n\ + void main() \n\ + { \n\ + gl_FragColor = applyMask(compose(srcPixel()*globalOpacity))); \n\ + }\n"; + +static const char* const qopenglslMainFragmentShader_CM = "\n\ + lowp vec4 srcPixel(); \n\ + lowp vec4 applyMask(lowp vec4); \n\ + lowp vec4 compose(lowp vec4); \n\ + void main() \n\ + { \n\ + gl_FragColor = applyMask(compose(srcPixel())); \n\ + }\n"; + +static const char* const qopenglslMainFragmentShader_MO = "\n\ + uniform lowp float globalOpacity; \n\ + lowp vec4 srcPixel(); \n\ + lowp vec4 applyMask(lowp vec4); \n\ + void main() \n\ + { \n\ + gl_FragColor = applyMask(srcPixel()*globalOpacity); \n\ + }\n"; + +static const char* const qopenglslMainFragmentShader_M = "\n\ + lowp vec4 srcPixel(); \n\ + lowp vec4 applyMask(lowp vec4); \n\ + void main() \n\ + { \n\ + gl_FragColor = applyMask(srcPixel()); \n\ + }\n"; + +static const char* const qopenglslMainFragmentShader_CO = "\n\ + uniform lowp float globalOpacity; \n\ + lowp vec4 srcPixel(); \n\ + lowp vec4 compose(lowp vec4); \n\ + void main() \n\ + { \n\ + gl_FragColor = compose(srcPixel()*globalOpacity); \n\ + }\n"; + +static const char* const qopenglslMainFragmentShader_C = "\n\ + lowp vec4 srcPixel(); \n\ + lowp vec4 compose(lowp vec4); \n\ + void main() \n\ + { \n\ + gl_FragColor = compose(srcPixel()); \n\ + }\n"; + +static const char* const qopenglslMainFragmentShader_O = "\n\ + uniform lowp float globalOpacity; \n\ + lowp vec4 srcPixel(); \n\ + void main() \n\ + { \n\ + gl_FragColor = srcPixel()*globalOpacity; \n\ + }\n"; + +static const char* const qopenglslMainFragmentShader = "\n\ + lowp vec4 srcPixel(); \n\ + void main() \n\ + { \n\ + gl_FragColor = srcPixel(); \n\ + }\n"; + +static const char* const qopenglslMaskFragmentShader = "\n\ + varying highp vec2 textureCoords;\n\ + uniform sampler2D maskTexture;\n\ + lowp vec4 applyMask(lowp vec4 src) \n\ + {\n\ + lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ + return src * mask.a; \n\ + }\n"; + +// For source over with subpixel antialiasing, the final color is calculated per component as follows +// (.a is alpha component, .c is red, green or blue component): +// alpha = src.a * mask.c * opacity +// dest.c = dest.c * (1 - alpha) + src.c * alpha +// +// In the first pass, calculate: dest.c = dest.c * (1 - alpha) with blend funcs: zero, 1 - source color +// In the second pass, calculate: dest.c = dest.c + src.c * alpha with blend funcs: one, one +// +// If source is a solid color (src is constant), only the first pass is needed, with blend funcs: constant, 1 - source color + +// For source composition with subpixel antialiasing, the final color is calculated per component as follows: +// alpha = src.a * mask.c * opacity +// dest.c = dest.c * (1 - mask.c) + src.c * alpha +// + +static const char* const qopenglslRgbMaskFragmentShaderPass1 = "\n\ + varying highp vec2 textureCoords;\n\ + uniform sampler2D maskTexture;\n\ + lowp vec4 applyMask(lowp vec4 src) \n\ + { \n\ + lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ + return src.a * mask; \n\ + }\n"; + +static const char* const qopenglslRgbMaskFragmentShaderPass2 = "\n\ + varying highp vec2 textureCoords;\n\ + uniform sampler2D maskTexture;\n\ + lowp vec4 applyMask(lowp vec4 src) \n\ + { \n\ + lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ + return src * mask; \n\ + }\n"; + +/* + Left to implement: + RgbMaskFragmentShader, + RgbMaskWithGammaFragmentShader, + + MultiplyCompositionModeFragmentShader, + ScreenCompositionModeFragmentShader, + OverlayCompositionModeFragmentShader, + DarkenCompositionModeFragmentShader, + LightenCompositionModeFragmentShader, + ColorDodgeCompositionModeFragmentShader, + ColorBurnCompositionModeFragmentShader, + HardLightCompositionModeFragmentShader, + SoftLightCompositionModeFragmentShader, + DifferenceCompositionModeFragmentShader, + ExclusionCompositionModeFragmentShader, +*/ + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // GLGC_SHADER_SOURCE_H diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h new file mode 100644 index 00000000000..65d92e3a65b --- /dev/null +++ b/src/gui/opengl/qopenglextensions_p.h @@ -0,0 +1,677 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENGL_EXTENSIONS_P_H +#define QOPENGL_EXTENSIONS_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 Qt OpenGL classes. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include "qopenglfunctions.h" + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#if 0 +#ifndef GL_ARB_vertex_buffer_object +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +#endif +#endif + +#ifndef GL_VERSION_2_0 +typedef char GLchar; +#endif + +class QOpenGLExtensionsPrivate; + +class Q_GUI_EXPORT QOpenGLExtensions : public QOpenGLFunctions +{ + Q_DECLARE_PRIVATE(QOpenGLExtensions) +public: + QOpenGLExtensions(); + QOpenGLExtensions(QOpenGLContext *context); + ~QOpenGLExtensions() {} + + enum OpenGLExtension { + TextureRectangle = 0x00000001, + GenerateMipmap = 0x00000002, + TextureCompression = 0x00000004, + MirroredRepeat = 0x00000008, + FramebufferMultisample = 0x00000010, + StencilTwoSide = 0x00000020, + StencilWrap = 0x00000040, + PackedDepthStencil = 0x00000080, + NVFloatBuffer = 0x00000100, + PixelBufferObject = 0x00000200, + FramebufferBlit = 0x00000400, + BGRATextureFormat = 0x00000800, + DDSTextureCompression = 0x00001000, + ETC1TextureCompression = 0x00002000, + PVRTCTextureCompression = 0x00004000, + ElementIndexUint = 0x00008000, + Depth24 = 0x00010000, + SRGBFrameBuffer = 0x00020000, + MapBuffer = 0x00040000, + GeometryShaders = 0x00080000 + }; + Q_DECLARE_FLAGS(OpenGLExtensions, OpenGLExtension) + + OpenGLExtensions openGLExtensions(); + bool hasOpenGLExtension(QOpenGLExtensions::OpenGLExtension extension) const; + + void initializeGLExtensions(); + + GLvoid *glMapBuffer(GLenum target, GLenum access); + GLboolean glUnmapBuffer(GLenum target); + + void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); + + void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, + GLenum internalFormat, + GLsizei width, GLsizei height); + + void glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data); + +private: + static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; } +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLExtensions::OpenGLExtensions) + +class QOpenGLExtensionsPrivate : public QOpenGLFunctionsPrivate +{ +public: + explicit QOpenGLExtensionsPrivate(QOpenGLContext *ctx); + + GLvoid* (QOPENGLF_APIENTRYP MapBuffer)(GLenum target, GLenum access); + GLboolean (QOPENGLF_APIENTRYP UnmapBuffer)(GLenum target); + void (QOPENGLF_APIENTRYP BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); + void (QOPENGLF_APIENTRYP RenderbufferStorageMultisample)(GLenum target, GLsizei samples, + GLenum internalFormat, + GLsizei width, GLsizei height); + void (QOPENGLF_APIENTRYP GetBufferSubData)(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data); +}; + +inline GLvoid *QOpenGLExtensions::glMapBuffer(GLenum target, GLenum access) +{ + Q_D(QOpenGLExtensions); + Q_ASSERT(QOpenGLExtensions::isInitialized(d)); + GLvoid *result = d->MapBuffer(target, access); + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline GLboolean QOpenGLExtensions::glUnmapBuffer(GLenum target) +{ + Q_D(QOpenGLExtensions); + Q_ASSERT(QOpenGLExtensions::isInitialized(d)); + GLboolean result = d->UnmapBuffer(target); + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline void QOpenGLExtensions::glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) +{ + Q_D(QOpenGLExtensions); + Q_ASSERT(QOpenGLExtensions::isInitialized(d)); + d->BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLExtensions::glRenderbufferStorageMultisample(GLenum target, GLsizei samples, + GLenum internalFormat, + GLsizei width, GLsizei height) +{ + Q_D(QOpenGLExtensions); + Q_ASSERT(QOpenGLExtensions::isInitialized(d)); + d->RenderbufferStorageMultisample(target, samples, internalFormat, width, height); + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLExtensions::glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data) +{ + Q_D(QOpenGLExtensions); + Q_ASSERT(QOpenGLExtensions::isInitialized(d)); + d->GetBufferSubData(target, offset, size, data); + Q_OPENGL_FUNCTIONS_DEBUG +} + +#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE +#define GL_FRAMEBUFFER_SRGB_CAPABLE 0x8DBA +#endif +#ifndef GL_FRAMEBUFFER_SRGB +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#endif +#ifndef GL_ARRAY_BUFFER +#define GL_ARRAY_BUFFER 0x8892 +#endif +#ifndef GL_STATIC_DRAW +#define GL_STATIC_DRAW 0x88E4 +#endif +#ifndef GL_TEXTURE_RECTANGLE +#define GL_TEXTURE_RECTANGLE 0x84F5 +#endif +#ifndef GL_TEXTURE_BINDING_RECTANGLE +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#endif +#ifndef GL_PROXY_TEXTURE_RECTANGLE +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#endif +#ifndef GL_MAX_RECTANGLE_TEXTURE_SIZE +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#endif +#ifndef GL_BGRA +#define GL_BGRA 0x80E1 +#endif +#ifndef GL_RGB16 +#define GL_RGB16 0x8054 +#endif +#ifndef GL_UNSIGNED_SHORT_5_6_5 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#endif +#ifndef GL_UNSIGNED_INT_8_8_8_8_REV +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#endif +#ifndef GL_MULTISAMPLE +#define GL_MULTISAMPLE 0x809D +#endif +#ifndef GL_CLAMP_TO_EDGE +#define GL_CLAMP_TO_EDGE 0x812F +#endif +#ifndef GL_MIRRORED_REPEAT +#define GL_MIRRORED_REPEAT 0x8370 +#endif +#ifndef GL_GENERATE_MIPMAP +#define GL_GENERATE_MIPMAP 0x8191 +#endif +#ifndef GL_GENERATE_MIPMAP_HINT +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#endif +#ifndef GL_FRAGMENT_PROGRAM +#define GL_FRAGMENT_PROGRAM 0x8804 +#endif +#ifndef GL_PROGRAM_FORMAT_ASCII +#define GL_PROGRAM_FORMAT_ASCII 0x8875 +#endif +#ifndef GL_PIXEL_UNPACK_BUFFER +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#endif +#ifndef GL_WRITE_ONLY +#define GL_WRITE_ONLY 0x88B9 +#endif +#ifndef GL_STREAM_DRAW +#define GL_STREAM_DRAW 0x88E0 +#endif +#ifndef GL_STENCIL_TEST_TWO_SIDE +#define GL_STENCIL_TEST_TWO_SIDE 0x8910 +#endif +#ifndef GL_INCR_WRAP +#define GL_INCR_WRAP 0x8507 +#endif +#ifndef GL_DECR_WRAP +#define GL_DECR_WRAP 0x8508 +#endif +#ifndef GL_TEXTURE0 +#define GL_TEXTURE0 0x84C0 +#endif +#ifndef GL_TEXTURE1 +#define GL_TEXTURE1 0x84C1 +#endif +#ifndef GL_DEPTH_COMPONENT16 +#define GL_DEPTH_COMPONENT16 0x81A5 +#endif +#ifndef GL_DEPTH_COMPONENT24 +#define GL_DEPTH_COMPONENT24 0x81A6 +#endif +#ifndef GL_INVALID_FRAMEBUFFER_OPERATION +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#endif +#ifndef GL_MAX_RENDERBUFFER_SIZE +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#endif +#ifndef GL_FRAMEBUFFER_BINDING +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#endif +#ifndef GL_RENDERBUFFER_BINDING +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET 0x8CD4 +#endif +#ifndef GL_FRAMEBUFFER_COMPLETE +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT +#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT 0x8CD8 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_FORMATS +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS 0x8CDA +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#endif +#ifndef GL_FRAMEBUFFER_UNSUPPORTED +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#endif +#ifndef GL_MAX_COLOR_ATTACHMENTS +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#endif +#ifndef GL_COLOR_ATTACHMENT0 +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#endif +#ifndef GL_COLOR_ATTACHMENT1 +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#endif +#ifndef GL_COLOR_ATTACHMENT2 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#endif +#ifndef GL_COLOR_ATTACHMENT3 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#endif +#ifndef GL_COLOR_ATTACHMENT4 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#endif +#ifndef GL_COLOR_ATTACHMENT5 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#endif +#ifndef GL_COLOR_ATTACHMENT6 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#endif +#ifndef GL_COLOR_ATTACHMENT7 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#endif +#ifndef GL_COLOR_ATTACHMENT8 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#endif +#ifndef GL_COLOR_ATTACHMENT9 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#endif +#ifndef GL_COLOR_ATTACHMENT10 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#endif +#ifndef GL_COLOR_ATTACHMENT11 +#define GL_COLOR_ATTACHMENT11 0x8CEB +#endif +#ifndef GL_COLOR_ATTACHMENT12 +#define GL_COLOR_ATTACHMENT12 0x8CEC +#endif +#ifndef GL_COLOR_ATTACHMENT13 +#define GL_COLOR_ATTACHMENT13 0x8CED +#endif +#ifndef GL_COLOR_ATTACHMENT14 +#define GL_COLOR_ATTACHMENT14 0x8CEE +#endif +#ifndef GL_COLOR_ATTACHMENT15 +#define GL_COLOR_ATTACHMENT15 0x8CEF +#endif +#ifndef GL_DEPTH_ATTACHMENT +#define GL_DEPTH_ATTACHMENT 0x8D00 +#endif +#ifndef GL_STENCIL_ATTACHMENT +#define GL_STENCIL_ATTACHMENT 0x8D20 +#endif +#ifndef GL_FRAMEBUFFER +#define GL_FRAMEBUFFER 0x8D40 +#endif +#ifndef GL_RENDERBUFFER +#define GL_RENDERBUFFER 0x8D41 +#endif +#ifndef GL_RENDERBUFFER_WIDTH +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#endif +#ifndef GL_RENDERBUFFER_HEIGHT +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#endif +#ifndef GL_RENDERBUFFER_INTERNAL_FORMAT +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#endif +#ifndef GL_STENCIL_INDEX +#define GL_STENCIL_INDEX 0x8D45 +#endif +#ifndef GL_STENCIL_INDEX1 +#define GL_STENCIL_INDEX1 0x8D46 +#endif +#ifndef GL_STENCIL_INDEX4 +#define GL_STENCIL_INDEX4 0x8D47 +#endif +#ifndef GL_STENCIL_INDEX8 +#define GL_STENCIL_INDEX8 0x8D48 +#endif +#ifndef GL_STENCIL_INDEX16 +#define GL_STENCIL_INDEX16 0x8D49 +#endif +#ifndef GL_RENDERBUFFER_RED_SIZE +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#endif +#ifndef GL_RENDERBUFFER_GREEN_SIZE +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#endif +#ifndef GL_RENDERBUFFER_BLUE_SIZE +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#endif +#ifndef GL_RENDERBUFFER_ALPHA_SIZE +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#endif +#ifndef GL_RENDERBUFFER_DEPTH_SIZE +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#endif +#ifndef GL_RENDERBUFFER_STENCIL_SIZE +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#endif +#ifndef GL_READ_FRAMEBUFFER +#define GL_READ_FRAMEBUFFER 0x8CA8 +#endif +#ifndef GL_RENDERBUFFER_SAMPLES +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#endif +#ifndef GL_MAX_SAMPLES +#define GL_MAX_SAMPLES 0x8D57 +#endif +#ifndef GL_DRAW_FRAMEBUFFER +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#endif +#ifndef GL_DEPTH_STENCIL +#define GL_DEPTH_STENCIL 0x84F9 +#endif +#ifndef GL_UNSIGNED_INT_24_8 +#define GL_UNSIGNED_INT_24_8 0x84FA +#endif +#ifndef GL_DEPTH24_STENCIL8 +#define GL_DEPTH24_STENCIL8 0x88F0 +#endif +#ifndef GL_TEXTURE_STENCIL_SIZE +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#endif +#ifndef GL_CLAMP_TO_EDGE +#define GL_CLAMP_TO_EDGE 0x812F +#endif +#ifndef GL_PACK_SKIP_IMAGES +#define GL_PACK_SKIP_IMAGES 0x806B +#endif +#ifndef GL_PACK_IMAGE_HEIGHT +#define GL_PACK_IMAGE_HEIGHT 0x806C +#endif +#ifndef GL_UNPACK_SKIP_IMAGES +#define GL_UNPACK_SKIP_IMAGES 0x806D +#endif +#ifndef GL_UNPACK_IMAGE_HEIGHT +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#endif +#ifndef GL_CONSTANT_COLOR +#define GL_CONSTANT_COLOR 0x8001 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_COLOR +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#endif +#ifndef GL_CONSTANT_ALPHA +#define GL_CONSTANT_ALPHA 0x8003 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_ALPHA +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#endif +#ifndef GL_INCR_WRAP +#define GL_INCR_WRAP 0x8507 +#endif +#ifndef GL_DECR_WRAP +#define GL_DECR_WRAP 0x8508 +#endif +#ifndef GL_ARRAY_BUFFER +#define GL_ARRAY_BUFFER 0x8892 +#endif +#ifndef GL_ELEMENT_ARRAY_BUFFER +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#endif +#ifndef GL_STREAM_DRAW +#define GL_STREAM_DRAW 0x88E0 +#endif +#ifndef GL_STREAM_READ +#define GL_STREAM_READ 0x88E1 +#endif +#ifndef GL_STREAM_COPY +#define GL_STREAM_COPY 0x88E2 +#endif +#ifndef GL_STATIC_DRAW +#define GL_STATIC_DRAW 0x88E4 +#endif +#ifndef GL_STATIC_READ +#define GL_STATIC_READ 0x88E5 +#endif +#ifndef GL_STATIC_COPY +#define GL_STATIC_COPY 0x88E6 +#endif +#ifndef GL_DYNAMIC_DRAW +#define GL_DYNAMIC_DRAW 0x88E8 +#endif +#ifndef GL_DYNAMIC_READ +#define GL_DYNAMIC_READ 0x88E9 +#endif +#ifndef GL_DYNAMIC_COPY +#define GL_DYNAMIC_COPY 0x88EA +#endif +#ifndef GL_FRAGMENT_SHADER +#define GL_FRAGMENT_SHADER 0x8B30 +#endif +#ifndef GL_VERTEX_SHADER +#define GL_VERTEX_SHADER 0x8B31 +#endif +#ifndef GL_FLOAT_VEC2 +#define GL_FLOAT_VEC2 0x8B50 +#endif +#ifndef GL_FLOAT_VEC3 +#define GL_FLOAT_VEC3 0x8B51 +#endif +#ifndef GL_FLOAT_VEC4 +#define GL_FLOAT_VEC4 0x8B52 +#endif +#ifndef GL_INT_VEC2 +#define GL_INT_VEC2 0x8B53 +#endif +#ifndef GL_INT_VEC3 +#define GL_INT_VEC3 0x8B54 +#endif +#ifndef GL_INT_VEC4 +#define GL_INT_VEC4 0x8B55 +#endif +#ifndef GL_BOOL +#define GL_BOOL 0x8B56 +#endif +#ifndef GL_BOOL_VEC2 +#define GL_BOOL_VEC2 0x8B57 +#endif +#ifndef GL_BOOL_VEC3 +#define GL_BOOL_VEC3 0x8B58 +#endif +#ifndef GL_BOOL_VEC4 +#define GL_BOOL_VEC4 0x8B59 +#endif +#ifndef GL_FLOAT_MAT2 +#define GL_FLOAT_MAT2 0x8B5A +#endif +#ifndef GL_FLOAT_MAT3 +#define GL_FLOAT_MAT3 0x8B5B +#endif +#ifndef GL_FLOAT_MAT4 +#define GL_FLOAT_MAT4 0x8B5C +#endif +#ifndef GL_SAMPLER_1D +#define GL_SAMPLER_1D 0x8B5D +#endif +#ifndef GL_SAMPLER_2D +#define GL_SAMPLER_2D 0x8B5E +#endif +#ifndef GL_SAMPLER_3D +#define GL_SAMPLER_3D 0x8B5F +#endif +#ifndef GL_SAMPLER_CUBE +#define GL_SAMPLER_CUBE 0x8B60 +#endif +#ifndef GL_COMPILE_STATUS +#define GL_COMPILE_STATUS 0x8B81 +#endif +#ifndef GL_LINK_STATUS +#define GL_LINK_STATUS 0x8B82 +#endif +#ifndef GL_INFO_LOG_LENGTH +#define GL_INFO_LOG_LENGTH 0x8B84 +#endif +#ifndef GL_ACTIVE_UNIFORMS +#define GL_ACTIVE_UNIFORMS 0x8B86 +#endif +#ifndef GL_ACTIVE_UNIFORM_MAX_LENGTH +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#endif +#ifndef GL_ACTIVE_ATTRIBUTES +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#endif +#ifndef GL_ACTIVE_ATTRIBUTE_MAX_LENGTH +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#endif +#ifndef GL_GEOMETRY_SHADER +#define GL_GEOMETRY_SHADER 0x8DD9 +#endif +#ifndef GL_GEOMETRY_VERTICES_OUT +#define GL_GEOMETRY_VERTICES_OUT 0x8DDA +#endif +#ifndef GL_GEOMETRY_INPUT_TYPE +#define GL_GEOMETRY_INPUT_TYPE 0x8DDB +#endif +#ifndef GL_GEOMETRY_OUTPUT_TYPE +#define GL_GEOMETRY_OUTPUT_TYPE 0x8DDC +#endif +#ifndef GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#endif +#ifndef GL_MAX_GEOMETRY_VARYING_COMPONENTS +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS 0x8DDD +#endif +#ifndef GL_MAX_VERTEX_VARYING_COMPONENTS +#define GL_MAX_VERTEX_VARYING_COMPONENTS 0x8DDE +#endif +#ifndef GL_MAX_VARYING_COMPONENTS +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#endif +#ifndef GL_MAX_GEOMETRY_UNIFORM_COMPONENTS +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#endif +#ifndef GL_MAX_GEOMETRY_OUTPUT_VERTICES +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#endif +#ifndef GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#endif +#ifndef GL_LINES_ADJACENCY +#define GL_LINES_ADJACENCY 0xA +#endif +#ifndef GL_LINE_STRIP_ADJACENCY +#define GL_LINE_STRIP_ADJACENCY 0xB +#endif +#ifndef GL_TRIANGLES_ADJACENCY +#define GL_TRIANGLES_ADJACENCY 0xC +#endif +#ifndef GL_TRIANGLE_STRIP_ADJACENCY +#define GL_TRIANGLE_STRIP_ADJACENCY 0xD +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT 0x8DA9 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_LAYERED +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#endif +#ifndef GL_PROGRAM_POINT_SIZE +#define GL_PROGRAM_POINT_SIZE 0x8642 +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QOPENGL_EXTENSIONS_P_H diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp new file mode 100644 index 00000000000..8c5eb0d8770 --- /dev/null +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -0,0 +1,1229 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenglframebufferobject.h" +#include "qopenglframebufferobject_p.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_DEBUG +#define QT_RESET_GLERROR() \ +{ \ + while (glGetError() != GL_NO_ERROR) {} \ +} +#define QT_CHECK_GLERROR() \ +{ \ + GLenum err = glGetError(); \ + if (err != GL_NO_ERROR) { \ + qDebug("[%s line %d] GL Error: %d", \ + __FILE__, __LINE__, (int)err); \ + } \ +} +#else +#define QT_RESET_GLERROR() {} +#define QT_CHECK_GLERROR() {} +#endif + +/*! + \class QOpenGLFramebufferObjectFormat + \brief The QOpenGLFramebufferObjectFormat class specifies the format of an OpenGL + framebuffer object. + + \since 5.0 + + \ingroup painting-3D + + A framebuffer object has several characteristics: + \list + \i \link setSamples() Number of samples per pixels.\endlink + \i \link setAttachment() Depth and/or stencil attachments.\endlink + \i \link setTextureTarget() Texture target.\endlink + \i \link setInternalTextureFormat() Internal texture format.\endlink + \endlist + + Note that the desired attachments or number of samples per pixels might not + be supported by the hardware driver. Call QOpenGLFramebufferObject::format() + after creating a QOpenGLFramebufferObject to find the exact format that was + used to create the frame buffer object. + + \sa QOpenGLFramebufferObject +*/ + +/*! + \internal +*/ +void QOpenGLFramebufferObjectFormat::detach() +{ + if (d->ref != 1) { + QOpenGLFramebufferObjectFormatPrivate *newd + = new QOpenGLFramebufferObjectFormatPrivate(d); + if (!d->ref.deref()) + delete d; + d = newd; + } +} + +/*! + Creates a QOpenGLFramebufferObjectFormat object for specifying + the format of an OpenGL framebuffer object. + + By default the format specifies a non-multisample framebuffer object with no + attachments, texture target \c GL_TEXTURE_2D, and internal format \c GL_RGBA8. + On OpenGL/ES systems, the default internal format is \c GL_RGBA. + + \sa samples(), attachment(), internalTextureFormat() +*/ + +QOpenGLFramebufferObjectFormat::QOpenGLFramebufferObjectFormat() +{ + d = new QOpenGLFramebufferObjectFormatPrivate; +} + +/*! + Constructs a copy of \a other. +*/ + +QOpenGLFramebufferObjectFormat::QOpenGLFramebufferObjectFormat(const QOpenGLFramebufferObjectFormat &other) +{ + d = other.d; + d->ref.ref(); +} + +/*! + Assigns \a other to this object. +*/ + +QOpenGLFramebufferObjectFormat &QOpenGLFramebufferObjectFormat::operator=(const QOpenGLFramebufferObjectFormat &other) +{ + if (d != other.d) { + other.d->ref.ref(); + if (!d->ref.deref()) + delete d; + d = other.d; + } + return *this; +} + +/*! + Destroys the QOpenGLFramebufferObjectFormat. +*/ +QOpenGLFramebufferObjectFormat::~QOpenGLFramebufferObjectFormat() +{ + if (!d->ref.deref()) + delete d; +} + +/*! + Sets the number of samples per pixel for a multisample framebuffer object + to \a samples. The default sample count of 0 represents a regular + non-multisample framebuffer object. + + If the desired amount of samples per pixel is not supported by the hardware + then the maximum number of samples per pixel will be used. Note that + multisample framebuffer objects can not be bound as textures. Also, the + \c{GL_EXT_framebuffer_multisample} extension is required to create a + framebuffer with more than one sample per pixel. + + \sa samples() +*/ +void QOpenGLFramebufferObjectFormat::setSamples(int samples) +{ + detach(); + d->samples = samples; +} + +/*! + Returns the number of samples per pixel if a framebuffer object + is a multisample framebuffer object. Otherwise, returns 0. + The default value is 0. + + \sa setSamples() +*/ +int QOpenGLFramebufferObjectFormat::samples() const +{ + return d->samples; +} + +/*! + Enables mipmapping if \a enabled is true; otherwise disables it. + + Mipmapping is disabled by default. + + If mipmapping is enabled, additional memory will be allocated for + the mipmap levels. The mipmap levels can be updated by binding the + texture and calling glGenerateMipmap(). Mipmapping cannot be enabled + for multisampled framebuffer objects. + + \sa mipmap(), QOpenGLFramebufferObject::texture() +*/ +void QOpenGLFramebufferObjectFormat::setMipmap(bool enabled) +{ + detach(); + d->mipmap = enabled; +} + +/*! + Returns true if mipmapping is enabled. + + \sa setMipmap() +*/ +bool QOpenGLFramebufferObjectFormat::mipmap() const +{ + return d->mipmap; +} + +/*! + Sets the attachment configuration of a framebuffer object to \a attachment. + + \sa attachment() +*/ +void QOpenGLFramebufferObjectFormat::setAttachment(QOpenGLFramebufferObject::Attachment attachment) +{ + detach(); + d->attachment = attachment; +} + +/*! + Returns the configuration of the depth and stencil buffers attached to + a framebuffer object. The default is QOpenGLFramebufferObject::NoAttachment. + + \sa setAttachment() +*/ +QOpenGLFramebufferObject::Attachment QOpenGLFramebufferObjectFormat::attachment() const +{ + return d->attachment; +} + +/*! + Sets the texture target of the texture attached to a framebuffer object to + \a target. Ignored for multisample framebuffer objects. + + \sa textureTarget(), samples() +*/ +void QOpenGLFramebufferObjectFormat::setTextureTarget(GLenum target) +{ + detach(); + d->target = target; +} + +/*! + Returns the texture target of the texture attached to a framebuffer object. + Ignored for multisample framebuffer objects. The default is + \c GL_TEXTURE_2D. + + \sa setTextureTarget(), samples() +*/ +GLenum QOpenGLFramebufferObjectFormat::textureTarget() const +{ + return d->target; +} + +/*! + Sets the internal format of a framebuffer object's texture or + multisample framebuffer object's color buffer to + \a internalTextureFormat. + + \sa internalTextureFormat() +*/ +void QOpenGLFramebufferObjectFormat::setInternalTextureFormat(GLenum internalTextureFormat) +{ + detach(); + d->internal_format = internalTextureFormat; +} + +/*! + Returns the internal format of a framebuffer object's texture or + multisample framebuffer object's color buffer. The default is + \c GL_RGBA8 on desktop OpenGL systems, and \c GL_RGBA on + OpenGL/ES systems. + + \sa setInternalTextureFormat() +*/ +GLenum QOpenGLFramebufferObjectFormat::internalTextureFormat() const +{ + return d->internal_format; +} + +/*! + Returns true if all the options of this framebuffer object format + are the same as \a other; otherwise returns false. +*/ +bool QOpenGLFramebufferObjectFormat::operator==(const QOpenGLFramebufferObjectFormat& other) const +{ + if (d == other.d) + return true; + else + return d->equals(other.d); +} + +/*! + Returns false if all the options of this framebuffer object format + are the same as \a other; otherwise returns true. +*/ +bool QOpenGLFramebufferObjectFormat::operator!=(const QOpenGLFramebufferObjectFormat& other) const +{ + return !(*this == other); +} + +bool QOpenGLFramebufferObjectPrivate::checkFramebufferStatus() const +{ + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (!ctx) + return false; // Context no longer exists. + GLenum status = ctx->functions()->glCheckFramebufferStatus(GL_FRAMEBUFFER); + switch(status) { + case GL_NO_ERROR: + case GL_FRAMEBUFFER_COMPLETE: + return true; + break; + case GL_FRAMEBUFFER_UNSUPPORTED: + qDebug("QOpenGLFramebufferObject: Unsupported framebuffer format."); + break; + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: + qDebug("QOpenGLFramebufferObject: Framebuffer incomplete attachment."); + break; + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: + qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment."); + break; +#ifdef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT + case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT: + qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, duplicate attachment."); + break; +#endif + case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: + qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attached images must have same dimensions."); + break; + case GL_FRAMEBUFFER_INCOMPLETE_FORMATS: + qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attached images must have same format."); + break; + case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: + qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, missing draw buffer."); + break; + case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: + qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, missing read buffer."); + break; + case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: + qDebug("QOpenGLFramebufferObject: Framebuffer incomplete, attachments must have same number of samples per pixel."); + break; + default: + qDebug() <<"QOpenGLFramebufferObject: An undefined error has occurred: "<< status; + break; + } + return false; +} + +namespace +{ + void freeFramebufferFunc(QOpenGLFunctions *funcs, GLuint id) + { + funcs->glDeleteFramebuffers(1, &id); + } + + void freeRenderbufferFunc(QOpenGLFunctions *funcs, GLuint id) + { + funcs->glDeleteRenderbuffers(1, &id); + } + + void freeTextureFunc(QOpenGLFunctions *, GLuint id) + { + glDeleteTextures(1, &id); + } +} + +void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSize &sz, + QOpenGLFramebufferObject::Attachment attachment, + GLenum texture_target, GLenum internal_format, + GLint samples, bool mipmap) +{ + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + + funcs.initializeGLFunctions(); + + if (!funcs.hasOpenGLFeature(QOpenGLFunctions::Framebuffers)) + return; + + size = sz; + target = texture_target; + // texture dimensions + + QT_RESET_GLERROR(); // reset error state + GLuint fbo = 0; + + funcs.glGenFramebuffers(1, &fbo); + funcs.glBindFramebuffer(GL_FRAMEBUFFER, fbo); + + GLuint texture = 0; + GLuint color_buffer = 0; + GLuint depth_buffer = 0; + GLuint stencil_buffer = 0; + + QT_CHECK_GLERROR(); + // init texture + if (samples == 0) { + glGenTextures(1, &texture); + glBindTexture(target, texture); + glTexImage2D(target, 0, internal_format, size.width(), size.height(), 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + if (mipmap) + funcs.glGenerateMipmap(GL_TEXTURE_2D); +#ifndef QT_OPENGL_ES + glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); +#else + glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); +#endif + funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + target, texture, 0); + + QT_CHECK_GLERROR(); + valid = checkFramebufferStatus(); + glBindTexture(target, 0); + + color_buffer = 0; + } else { + mipmap = false; + GLint maxSamples; + glGetIntegerv(GL_MAX_SAMPLES, &maxSamples); + + samples = qBound(0, int(samples), int(maxSamples)); + + funcs.glGenRenderbuffers(1, &color_buffer); + funcs.glBindRenderbuffer(GL_RENDERBUFFER, color_buffer); + if (funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample) && samples > 0) { + funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, + internal_format, size.width(), size.height()); + } else { + samples = 0; + funcs.glRenderbufferStorage(GL_RENDERBUFFER, internal_format, + size.width(), size.height()); + } + + funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, color_buffer); + + QT_CHECK_GLERROR(); + valid = checkFramebufferStatus(); + + if (valid) + funcs.glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES, &samples); + } + + // In practice, a combined depth-stencil buffer is supported by all desktop platforms, while a + // separate stencil buffer is not. On embedded devices however, a combined depth-stencil buffer + // might not be supported while separate buffers are, according to QTBUG-12861. + + if (attachment == QOpenGLFramebufferObject::CombinedDepthStencil + && funcs.hasOpenGLExtension(QOpenGLExtensions::PackedDepthStencil)) + { + // depth and stencil buffer needs another extension + funcs.glGenRenderbuffers(1, &depth_buffer); + Q_ASSERT(!funcs.glIsRenderbuffer(depth_buffer)); + funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer); + Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer)); + if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) + funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, + GL_DEPTH24_STENCIL8, size.width(), size.height()); + else + funcs.glRenderbufferStorage(GL_RENDERBUFFER, + GL_DEPTH24_STENCIL8, size.width(), size.height()); + + stencil_buffer = depth_buffer; + funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, depth_buffer); + funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, stencil_buffer); + + valid = checkFramebufferStatus(); + if (!valid) { + funcs.glDeleteRenderbuffers(1, &depth_buffer); + stencil_buffer = depth_buffer = 0; + } + } + + if (depth_buffer == 0 && (attachment == QOpenGLFramebufferObject::CombinedDepthStencil + || (attachment == QOpenGLFramebufferObject::Depth))) + { + funcs.glGenRenderbuffers(1, &depth_buffer); + Q_ASSERT(!funcs.glIsRenderbuffer(depth_buffer)); + funcs.glBindRenderbuffer(GL_RENDERBUFFER, depth_buffer); + Q_ASSERT(funcs.glIsRenderbuffer(depth_buffer)); + if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) { +#ifdef QT_OPENGL_ES + if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) { + funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, + GL_DEPTH_COMPONENT24, size.width(), size.height()); + } else { + funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, + GL_DEPTH_COMPONENT16, size.width(), size.height()); + } +#else + funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, + GL_DEPTH_COMPONENT, size.width(), size.height()); +#endif + } else { +#ifdef QT_OPENGL_ES + if (funcs.hasOpenGLExtension(QOpenGLExtensions::Depth24)) { + funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, + size.width(), size.height()); + } else { + funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, + size.width(), size.height()); + } +#else + funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, size.width(), size.height()); +#endif + } + funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, depth_buffer); + valid = checkFramebufferStatus(); + if (!valid) { + funcs.glDeleteRenderbuffers(1, &depth_buffer); + depth_buffer = 0; + } + } + + if (stencil_buffer == 0 && (attachment == QOpenGLFramebufferObject::CombinedDepthStencil)) { + funcs.glGenRenderbuffers(1, &stencil_buffer); + Q_ASSERT(!funcs.glIsRenderbuffer(stencil_buffer)); + funcs.glBindRenderbuffer(GL_RENDERBUFFER, stencil_buffer); + Q_ASSERT(funcs.glIsRenderbuffer(stencil_buffer)); + if (samples != 0 && funcs.hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) { +#ifdef QT_OPENGL_ES + funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, + GL_STENCIL_INDEX8, size.width(), size.height()); +#else + funcs.glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, + GL_STENCIL_INDEX, size.width(), size.height()); +#endif + } else { +#ifdef QT_OPENGL_ES + funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, + size.width(), size.height()); +#else + funcs.glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX, + size.width(), size.height()); +#endif + } + funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, stencil_buffer); + valid = checkFramebufferStatus(); + if (!valid) { + funcs.glDeleteRenderbuffers(1, &stencil_buffer); + stencil_buffer = 0; + } + } + + // The FBO might have become valid after removing the depth or stencil buffer. + valid = checkFramebufferStatus(); + + if (depth_buffer && stencil_buffer) { + fbo_attachment = QOpenGLFramebufferObject::CombinedDepthStencil; + } else if (depth_buffer) { + fbo_attachment = QOpenGLFramebufferObject::Depth; + } else { + fbo_attachment = QOpenGLFramebufferObject::NoAttachment; + } + + funcs.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); + if (valid) { + fbo_guard = new QOpenGLSharedResourceGuard(ctx, fbo, freeFramebufferFunc); + if (color_buffer) + color_buffer_guard = new QOpenGLSharedResourceGuard(ctx, color_buffer, freeRenderbufferFunc); + else + texture_guard = new QOpenGLSharedResourceGuard(ctx, texture, freeTextureFunc); + if (depth_buffer) + depth_buffer_guard = new QOpenGLSharedResourceGuard(ctx, depth_buffer, freeRenderbufferFunc); + if (stencil_buffer) { + if (stencil_buffer == depth_buffer) + stencil_buffer_guard = depth_buffer_guard; + else + stencil_buffer_guard = new QOpenGLSharedResourceGuard(ctx, stencil_buffer, freeRenderbufferFunc); + } + } else { + if (color_buffer) + funcs.glDeleteRenderbuffers(1, &color_buffer); + else + glDeleteTextures(1, &texture); + if (depth_buffer) + funcs.glDeleteRenderbuffers(1, &depth_buffer); + if (stencil_buffer && depth_buffer != stencil_buffer) + funcs.glDeleteRenderbuffers(1, &stencil_buffer); + funcs.glDeleteFramebuffers(1, &fbo); + } + QT_CHECK_GLERROR(); + + format.setTextureTarget(target); + format.setSamples(int(samples)); + format.setAttachment(fbo_attachment); + format.setInternalTextureFormat(internal_format); + format.setMipmap(mipmap); +} + +/*! + \class QOpenGLFramebufferObject + \brief The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer object. + \since 5.0 + + \ingroup painting-3D + + The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer + object, defined by the \c{GL_EXT_framebuffer_object} extension. In + addition it provides a rendering surface that can be painted on + with a QPainter, rendered to using native GL calls, or both. This + surface can be bound and used as a regular texture in your own GL + drawing code. By default, the QOpenGLFramebufferObject class + generates a 2D GL texture (using the \c{GL_TEXTURE_2D} target), + which is used as the internal rendering target. + + \bold{It is important to have a current GL context when creating a + QOpenGLFramebufferObject, otherwise initialization will fail.} + + OpenGL framebuffer objects and pbuffers (see + \l{QOpenGLPixelBuffer}{QOpenGLPixelBuffer}) can both be used to render to + offscreen surfaces, but there are a number of advantages with + using framebuffer objects instead of pbuffers: + + \list 1 + \o A framebuffer object does not require a separate rendering + context, so no context switching will occur when switching + rendering targets. There is an overhead involved in switching + targets, but in general it is cheaper than a context switch to a + pbuffer. + + \o Rendering to dynamic textures (i.e. render-to-texture + functionality) works on all platforms. No need to do explicit copy + calls from a render buffer into a texture, as was necessary on + systems that did not support the \c{render_texture} extension. + + \o It is possible to attach several rendering buffers (or texture + objects) to the same framebuffer object, and render to all of them + without doing a context switch. + + \o The OpenGL framebuffer extension is a pure GL extension with no + system dependant WGL, CGL, or GLX parts. This makes using + framebuffer objects more portable. + \endlist + + When using a QPainter to paint to a QOpenGLFramebufferObject you should take + care that the QOpenGLFramebufferObject is created with the CombinedDepthStencil + attachment for QPainter to be able to render correctly. + Note that you need to create a QOpenGLFramebufferObject with more than one + sample per pixel for primitives to be antialiased when drawing using a + QPainter. To create a multisample framebuffer object you should use one of + the constructors that take a QOpenGLFramebufferObject parameter, and set the + QOpenGLFramebufferObject::samples() property to a non-zero value. + + For multisample framebuffer objects a color render buffer is created, + otherwise a texture with the specified texture target is created. + The color render buffer or texture will have the specified internal + format, and will be bound to the \c GL_COLOR_ATTACHMENT0 + attachment in the framebuffer object. + + If you want to use a framebuffer object with multisampling enabled + as a texture, you first need to copy from it to a regular framebuffer + object using QOpenGLContext::blitFramebuffer(). + + \section1 Threading + + As of Qt 4.8, it's possible to draw into a QOpenGLFramebufferObject + using a QPainter in a separate thread. Note that OpenGL 2.0 or + OpenGL ES 2.0 is required for this to work. + + \sa {Framebuffer Object Example} +*/ + + +/*! + \enum QOpenGLFramebufferObject::Attachment + + This enum type is used to configure the depth and stencil buffers + attached to the framebuffer object when it is created. + + \value NoAttachment No attachment is added to the framebuffer object. Note that the + OpenGL depth and stencil tests won't work when rendering to a + framebuffer object without any depth or stencil buffers. + This is the default value. + + \value CombinedDepthStencil If the \c GL_EXT_packed_depth_stencil extension is present, + a combined depth and stencil buffer is attached. + If the extension is not present, only a depth buffer is attached. + + \value Depth A depth buffer is attached to the framebuffer object. + + \sa attachment() +*/ + + +/*! \fn QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum target) + + Constructs an OpenGL framebuffer object and binds a 2D GL texture + to the buffer of the size \a size. The texture is bound to the + \c GL_COLOR_ATTACHMENT0 target in the framebuffer object. + + The \a target parameter is used to specify the GL texture + target. The default target is \c GL_TEXTURE_2D. Keep in mind that + \c GL_TEXTURE_2D textures must have a power of 2 width and height + (e.g. 256x512), unless you are using OpenGL 2.0 or higher. + + By default, no depth and stencil buffers are attached. This behavior + can be toggled using one of the overloaded constructors. + + The default internal texture format is \c GL_RGBA8 for desktop + OpenGL, and \c GL_RGBA for OpenGL/ES. + + It is important that you have a current GL context set when + creating the QOpenGLFramebufferObject, otherwise the initialization + will fail. + + \sa size(), texture(), attachment() +*/ + +QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum target) + : d_ptr(new QOpenGLFramebufferObjectPrivate) +{ + Q_D(QOpenGLFramebufferObject); + d->init(this, size, NoAttachment, target, DEFAULT_FORMAT); +} + +/*! \overload + + Constructs an OpenGL framebuffer object and binds a 2D GL texture + to the buffer of the given \a width and \a height. + + \sa size(), texture() +*/ +QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum target) + : d_ptr(new QOpenGLFramebufferObjectPrivate) +{ + Q_D(QOpenGLFramebufferObject); + d->init(this, QSize(width, height), NoAttachment, target, DEFAULT_FORMAT); +} + +/*! \overload + + Constructs an OpenGL framebuffer object of the given \a size based on the + supplied \a format. +*/ + +QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, const QOpenGLFramebufferObjectFormat &format) + : d_ptr(new QOpenGLFramebufferObjectPrivate) +{ + Q_D(QOpenGLFramebufferObject); + d->init(this, size, format.attachment(), format.textureTarget(), format.internalTextureFormat(), + format.samples(), format.mipmap()); +} + +/*! \overload + + Constructs an OpenGL framebuffer object of the given \a width and \a height + based on the supplied \a format. +*/ + +QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format) + : d_ptr(new QOpenGLFramebufferObjectPrivate) +{ + Q_D(QOpenGLFramebufferObject); + d->init(this, QSize(width, height), format.attachment(), format.textureTarget(), + format.internalTextureFormat(), format.samples(), format.mipmap()); +} + +/*! \overload + + Constructs an OpenGL framebuffer object and binds a texture to the + buffer of the given \a width and \a height. + + The \a attachment parameter describes the depth/stencil buffer + configuration, \a target the texture target and \a internal_format + the internal texture format. The default texture target is \c + GL_TEXTURE_2D, while the default internal format is \c GL_RGBA8 + for desktop OpenGL and \c GL_RGBA for OpenGL/ES. + + \sa size(), texture(), attachment() +*/ +QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, Attachment attachment, + GLenum target, GLenum internal_format) + : d_ptr(new QOpenGLFramebufferObjectPrivate) +{ + Q_D(QOpenGLFramebufferObject); + d->init(this, QSize(width, height), attachment, target, internal_format); +} + +/*! \overload + + Constructs an OpenGL framebuffer object and binds a texture to the + buffer of the given \a size. + + The \a attachment parameter describes the depth/stencil buffer + configuration, \a target the texture target and \a internal_format + the internal texture format. The default texture target is \c + GL_TEXTURE_2D, while the default internal format is \c GL_RGBA8 + for desktop OpenGL and \c GL_RGBA for OpenGL/ES. + + \sa size(), texture(), attachment() +*/ +QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, Attachment attachment, + GLenum target, GLenum internal_format) + : d_ptr(new QOpenGLFramebufferObjectPrivate) +{ + Q_D(QOpenGLFramebufferObject); + d->init(this, size, attachment, target, internal_format); +} + +/*! + \fn QOpenGLFramebufferObject::~QOpenGLFramebufferObject() + + Destroys the framebuffer object and frees any allocated resources. +*/ +QOpenGLFramebufferObject::~QOpenGLFramebufferObject() +{ + Q_D(QOpenGLFramebufferObject); + + if (d->texture_guard) + d->texture_guard->free(); + if (d->color_buffer_guard) + d->color_buffer_guard->free(); + if (d->depth_buffer_guard) + d->depth_buffer_guard->free(); + if (d->stencil_buffer_guard && d->stencil_buffer_guard != d->depth_buffer_guard) + d->stencil_buffer_guard->free(); + if (d->fbo_guard) + d->fbo_guard->free(); +} + +/*! + \fn bool QOpenGLFramebufferObject::isValid() const + + Returns true if the framebuffer object is valid. + + The framebuffer can become invalid if the initialization process + fails, the user attaches an invalid buffer to the framebuffer + object, or a non-power of two width/height is specified as the + texture size if the texture target is \c{GL_TEXTURE_2D}. + The non-power of two limitation does not apply if the OpenGL version + is 2.0 or higher, or if the GL_ARB_texture_non_power_of_two extension + is present. + + The framebuffer can also become invalid if the QOpenGLContext that + the framebuffer was created within is destroyed and there are + no other shared contexts that can take over ownership of the + framebuffer. +*/ +bool QOpenGLFramebufferObject::isValid() const +{ + Q_D(const QOpenGLFramebufferObject); + return d->valid && d->fbo_guard && d->fbo_guard->id(); +} + +/*! + \fn bool QOpenGLFramebufferObject::bind() + + Switches rendering from the default, windowing system provided + framebuffer to this framebuffer object. + Returns true upon success, false otherwise. + + \sa release() +*/ +bool QOpenGLFramebufferObject::bind() +{ + if (!isValid()) + return false; + Q_D(QOpenGLFramebufferObject); + QOpenGLContext *current = QOpenGLContext::currentContext(); + if (!current) + return false; +#ifdef QT_DEBUG + if (current->shareGroup() != d->fbo_guard->group()) + qWarning("QOpenGLFramebufferObject::bind() called from incompatible context"); +#endif + d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, d->fbo()); + d->valid = d->checkFramebufferStatus(); + if (d->valid && current) + current->d_func()->current_fbo = d->fbo(); + return d->valid; +} + +/*! + \fn bool QOpenGLFramebufferObject::release() + + Switches rendering back to the default, windowing system provided + framebuffer. + Returns true upon success, false otherwise. + + \sa bind() +*/ +bool QOpenGLFramebufferObject::release() +{ + if (!isValid()) + return false; + + QOpenGLContext *current = QOpenGLContext::currentContext(); + if (!current) + return false; + + Q_D(QOpenGLFramebufferObject); +#ifdef QT_DEBUG + if (current->shareGroup() != d->fbo_guard->group()) + qWarning("QOpenGLFramebufferObject::release() called from incompatible context"); +#endif + + if (current) { + current->d_func()->current_fbo = current->d_func()->default_fbo; + d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, current->d_func()->default_fbo); + } + + return true; +} + +/*! + \fn GLuint QOpenGLFramebufferObject::texture() const + + Returns the texture id for the texture attached as the default + rendering target in this framebuffer object. This texture id can + be bound as a normal texture in your own GL code. + + If a multisample framebuffer object is used then the value returned + from this function will be invalid. +*/ +GLuint QOpenGLFramebufferObject::texture() const +{ + Q_D(const QOpenGLFramebufferObject); + return d->texture_guard ? d->texture_guard->id() : 0; +} + +/*! + \fn QSize QOpenGLFramebufferObject::size() const + + Returns the size of the texture attached to this framebuffer + object. +*/ +QSize QOpenGLFramebufferObject::size() const +{ + Q_D(const QOpenGLFramebufferObject); + return d->size; +} + +/*! + Returns the format of this framebuffer object. +*/ +QOpenGLFramebufferObjectFormat QOpenGLFramebufferObject::format() const +{ + Q_D(const QOpenGLFramebufferObject); + return d->format; +} + +namespace { +/* + Read back the contents of the currently bound framebuffer, used in + QGLWidget::grabFrameBuffer(), QGLPixelbuffer::toImage() and + QGLFramebufferObject::toImage() +*/ + +void convertFromGLImage(QImage &img, int w, int h, bool alpha_format, bool include_alpha) +{ + if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { + // OpenGL gives RGBA; Qt wants ARGB + uint *p = (uint*)img.bits(); + uint *end = p + w*h; + if (alpha_format && include_alpha) { + while (p < end) { + uint a = *p << 24; + *p = (*p >> 8) | a; + p++; + } + } else { + // This is an old legacy fix for PowerPC based Macs, which + // we shouldn't remove + while (p < end) { + *p = 0xff000000 | (*p>>8); + ++p; + } + } + } else { + // OpenGL gives ABGR (i.e. RGBA backwards); Qt wants ARGB + for (int y = 0; y < h; y++) { + uint *q = (uint*)img.scanLine(y); + for (int x=0; x < w; ++x) { + const uint pixel = *q; + if (alpha_format && include_alpha) { + *q = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff) + | (pixel & 0xff00ff00); + } else { + *q = 0xff000000 | ((pixel << 16) & 0xff0000) + | ((pixel >> 16) & 0xff) | (pixel & 0x00ff00); + } + + q++; + } + } + + } + img = img.mirrored(); +} + +} + +Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha) +{ + QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied + : QImage::Format_RGB32); + int w = size.width(); + int h = size.height(); + glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, img.bits()); + convertFromGLImage(img, w, h, alpha_format, include_alpha); + return img; +} + +/*! + \fn QImage QOpenGLFramebufferObject::toImage() const + + Returns the contents of this framebuffer object as a QImage. +*/ +QImage QOpenGLFramebufferObject::toImage() const +{ + Q_D(const QOpenGLFramebufferObject); + if (!d->valid) + return QImage(); + + // qt_gl_read_framebuffer doesn't work on a multisample FBO + if (format().samples() != 0) { + QOpenGLFramebufferObject temp(size(), QOpenGLFramebufferObjectFormat()); + + QRect rect(QPoint(0, 0), size()); + blitFramebuffer(&temp, rect, const_cast(this), rect); + + return temp.toImage(); + } + + bool wasBound = isBound(); + if (!wasBound) + const_cast(this)->bind(); + QImage image = qt_gl_read_framebuffer(d->size, format().internalTextureFormat() != GL_RGB, true); + if (!wasBound) + const_cast(this)->release(); + + return image; +} + +/*! + \fn bool QOpenGLFramebufferObject::bindDefault() + \internal + + Switches rendering back to the default, windowing system provided + framebuffer. + Returns true upon success, false otherwise. + + \sa bind(), release() +*/ +bool QOpenGLFramebufferObject::bindDefault() +{ + QOpenGLContext *ctx = const_cast(QOpenGLContext::currentContext()); + QOpenGLFunctions functions(ctx); + + if (ctx) { + ctx->d_func()->current_fbo = ctx->d_func()->default_fbo; + functions.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->default_fbo); +#ifdef QT_DEBUG + } else { + qWarning("QOpenGLFramebufferObject::bindDefault() called without current context."); +#endif + } + + return ctx != 0; +} + +/*! + \fn bool QOpenGLFramebufferObject::hasOpenGLFramebufferObjects() + + Returns true if the OpenGL \c{GL_EXT_framebuffer_object} extension + is present on this system; otherwise returns false. +*/ +bool QOpenGLFramebufferObject::hasOpenGLFramebufferObjects() +{ + return QOpenGLFunctions(QOpenGLContext::currentContext()).hasOpenGLFeature(QOpenGLFunctions::Framebuffers); +} + +/*! + \fn GLuint QOpenGLFramebufferObject::handle() const + + Returns the GL framebuffer object handle for this framebuffer + object (returned by the \c{glGenFrameBuffersEXT()} function). This + handle can be used to attach new images or buffers to the + framebuffer. The user is responsible for cleaning up and + destroying these objects. +*/ +GLuint QOpenGLFramebufferObject::handle() const +{ + Q_D(const QOpenGLFramebufferObject); + return d->fbo(); +} + +/*! + Returns the status of the depth and stencil buffers attached to + this framebuffer object. +*/ + +QOpenGLFramebufferObject::Attachment QOpenGLFramebufferObject::attachment() const +{ + Q_D(const QOpenGLFramebufferObject); + if (d->valid) + return d->fbo_attachment; + return NoAttachment; +} + +/*! + Returns true if the framebuffer object is currently bound to a context, + otherwise false is returned. +*/ + +bool QOpenGLFramebufferObject::isBound() const +{ + Q_D(const QOpenGLFramebufferObject); + QOpenGLContext *current = QOpenGLContext::currentContext(); + return current ? current->d_func()->current_fbo == d->fbo() : false; +} + +/*! + \fn bool QOpenGLFramebufferObject::hasOpenGLFramebufferBlit() + + Returns true if the OpenGL \c{GL_EXT_framebuffer_blit} extension + is present on this system; otherwise returns false. + + \sa blitFramebuffer() +*/ +bool QOpenGLFramebufferObject::hasOpenGLFramebufferBlit() +{ + return QOpenGLExtensions(QOpenGLContext::currentContext()).hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit); +} + + +/*! + \overload + \sa blitFramebuffer +*/ + +void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, + QOpenGLFramebufferObject *source, + GLbitfield buffers, GLenum filter) +{ + blitFramebuffer(target, QRect(QPoint(0, 0), target->size()), + source, QRect(QPoint(0, 0), source->size()), + buffers, filter); +} + +/*! + Blits from the \a sourceRect rectangle in the \a source framebuffer + object to the \a targetRect rectangle in the \a target framebuffer object. + + If \a source or \a target is 0, the default framebuffer will be used + instead of a framebuffer object as source or target respectively. + + The \a buffers parameter should be a mask consisting of any combination of + \c GL_COLOR_BUFFER_BIT, \c GL_DEPTH_BUFFER_BIT, and + \c GL_STENCIL_BUFFER_BIT. Any buffer type that is not present both + in the source and target buffers is ignored. + + The \a sourceRect and \a targetRect rectangles may have different sizes; + in this case \a buffers should not contain \c GL_DEPTH_BUFFER_BIT or + \c GL_STENCIL_BUFFER_BIT. The \a filter parameter should be set to + \c GL_LINEAR or \c GL_NEAREST, and specifies whether linear or nearest + interpolation should be used when scaling is performed. + + If \a source equals \a target a copy is performed within the same buffer. + Results are undefined if the source and target rectangles overlap and + have different sizes. The sizes must also be the same if any of the + framebuffer objects are multisample framebuffers. + + Note that the scissor test will restrict the blit area if enabled. + + This function will have no effect unless hasOpenGLFramebufferBlit() returns + true. + + \sa hasOpenGLFramebufferBlit() +*/ +void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, + QOpenGLFramebufferObject *source, const QRect &sourceRect, + GLbitfield buffers, + GLenum filter) +{ + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (!ctx) + return; + + QOpenGLExtensions extensions(ctx); + if (!extensions.hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit)) + return; + + const int sx0 = sourceRect.left(); + const int sx1 = sourceRect.left() + sourceRect.width(); + const int sy0 = sourceRect.top(); + const int sy1 = sourceRect.top() + sourceRect.height(); + + const int tx0 = targetRect.left(); + const int tx1 = targetRect.left() + targetRect.width(); + const int ty0 = targetRect.top(); + const int ty1 = targetRect.top() + targetRect.height(); + + extensions.glBindFramebuffer(GL_READ_FRAMEBUFFER, source ? source->handle() : 0); + extensions.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, target ? target->handle() : 0); + + extensions.glBlitFramebuffer(sx0, sy0, sx1, sy1, + tx0, ty0, tx1, ty1, + buffers, filter); + + extensions.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h new file mode 100644 index 00000000000..17ee74aa94b --- /dev/null +++ b/src/gui/opengl/qopenglframebufferobject.h @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENGLFRAMEBUFFEROBJECT_H +#define QOPENGLFRAMEBUFFEROBJECT_H + +#include +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QOpenGLFramebufferObjectPrivate; +class QOpenGLFramebufferObjectFormat; + +class Q_GUI_EXPORT QOpenGLFramebufferObject +{ + Q_DECLARE_PRIVATE(QOpenGLFramebufferObject) +public: + enum Attachment { + NoAttachment, + CombinedDepthStencil, + Depth + }; + + QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D); + QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D); +#if !defined(QT_OPENGL_ES) || defined(Q_QDOC) + QOpenGLFramebufferObject(const QSize &size, Attachment attachment, + GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA8); + QOpenGLFramebufferObject(int width, int height, Attachment attachment, + GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA8); +#else + QOpenGLFramebufferObject(const QSize &size, Attachment attachment, + GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA); + QOpenGLFramebufferObject(int width, int height, Attachment attachment, + GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA); +#endif + + QOpenGLFramebufferObject(const QSize &size, const QOpenGLFramebufferObjectFormat &format); + QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format); + + virtual ~QOpenGLFramebufferObject(); + + QOpenGLFramebufferObjectFormat format() const; + + bool isValid() const; + bool isBound() const; + bool bind(); + bool release(); + + int width() const { return size().width(); } + int height() const { return size().height(); } + + GLuint texture() const; + QSize size() const; + QImage toImage() const; + Attachment attachment() const; + + QPaintEngine *paintEngine() const; + GLuint handle() const; + + static bool bindDefault(); + + static bool hasOpenGLFramebufferObjects(); + + static bool hasOpenGLFramebufferBlit(); + static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, + QOpenGLFramebufferObject *source, const QRect &sourceRect, + GLbitfield buffers = GL_COLOR_BUFFER_BIT, + GLenum filter = GL_NEAREST); + static void blitFramebuffer(QOpenGLFramebufferObject *target, + QOpenGLFramebufferObject *source, + GLbitfield buffers = GL_COLOR_BUFFER_BIT, + GLenum filter = GL_NEAREST); + +private: + Q_DISABLE_COPY(QOpenGLFramebufferObject) + QScopedPointer d_ptr; + friend class QOpenGLPaintDevice; + friend class QOpenGLFBOGLPaintDevice; +}; + +class QOpenGLFramebufferObjectFormatPrivate; +class Q_GUI_EXPORT QOpenGLFramebufferObjectFormat +{ +public: + QOpenGLFramebufferObjectFormat(); + QOpenGLFramebufferObjectFormat(const QOpenGLFramebufferObjectFormat &other); + QOpenGLFramebufferObjectFormat &operator=(const QOpenGLFramebufferObjectFormat &other); + ~QOpenGLFramebufferObjectFormat(); + + void setSamples(int samples); + int samples() const; + + void setMipmap(bool enabled); + bool mipmap() const; + + void setAttachment(QOpenGLFramebufferObject::Attachment attachment); + QOpenGLFramebufferObject::Attachment attachment() const; + + void setTextureTarget(GLenum target); + GLenum textureTarget() const; + + void setInternalTextureFormat(GLenum internalTextureFormat); + GLenum internalTextureFormat() const; + + bool operator==(const QOpenGLFramebufferObjectFormat& other) const; + bool operator!=(const QOpenGLFramebufferObjectFormat& other) const; + +private: + QOpenGLFramebufferObjectFormatPrivate *d; + + void detach(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER +#endif // QOPENGLFRAMEBUFFEROBJECT_H diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h new file mode 100644 index 00000000000..93a8bbf32f0 --- /dev/null +++ b/src/gui/opengl/qopenglframebufferobject_p.h @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENGLFRAMEBUFFEROBJECT_P_H +#define QOPENGLFRAMEBUFFEROBJECT_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. +// + +QT_BEGIN_NAMESPACE + +QT_BEGIN_INCLUDE_NAMESPACE + +#include +#include +#include + +QT_END_INCLUDE_NAMESPACE + +#ifndef QT_OPENGL_ES +#define DEFAULT_FORMAT GL_RGBA8 +#else +#define DEFAULT_FORMAT GL_RGBA +#endif + +class QOpenGLFramebufferObjectFormatPrivate +{ +public: + QOpenGLFramebufferObjectFormatPrivate() + : ref(1), + samples(0), + attachment(QOpenGLFramebufferObject::NoAttachment), + target(GL_TEXTURE_2D), + internal_format(DEFAULT_FORMAT), + mipmap(false) + { + } + QOpenGLFramebufferObjectFormatPrivate + (const QOpenGLFramebufferObjectFormatPrivate *other) + : ref(1), + samples(other->samples), + attachment(other->attachment), + target(other->target), + internal_format(other->internal_format), + mipmap(other->mipmap) + { + } + bool equals(const QOpenGLFramebufferObjectFormatPrivate *other) + { + return samples == other->samples && + attachment == other->attachment && + target == other->target && + internal_format == other->internal_format && + mipmap == other->mipmap; + } + + QAtomicInt ref; + int samples; + QOpenGLFramebufferObject::Attachment attachment; + GLenum target; + GLenum internal_format; + uint mipmap : 1; +}; + +class QOpenGLFramebufferObjectPrivate +{ +public: + QOpenGLFramebufferObjectPrivate() : fbo_guard(0), texture_guard(0), depth_buffer_guard(0) + , stencil_buffer_guard(0), color_buffer_guard(0) + , valid(false) {} + ~QOpenGLFramebufferObjectPrivate() {} + + void init(QOpenGLFramebufferObject *q, const QSize& sz, + QOpenGLFramebufferObject::Attachment attachment, + GLenum internal_format, GLenum texture_target, + GLint samples = 0, bool mipmap = false); + bool checkFramebufferStatus() const; + QOpenGLSharedResourceGuard *fbo_guard; + QOpenGLSharedResourceGuard *texture_guard; + QOpenGLSharedResourceGuard *depth_buffer_guard; + QOpenGLSharedResourceGuard *stencil_buffer_guard; + QOpenGLSharedResourceGuard *color_buffer_guard; + GLenum target; + QSize size; + QOpenGLFramebufferObjectFormat format; + uint valid : 1; + QOpenGLFramebufferObject::Attachment fbo_attachment; + QOpenGLExtensions funcs; + + inline GLuint fbo() const { return fbo_guard ? fbo_guard->id() : 0; } +}; + + +QT_END_NAMESPACE + +#endif // QOPENGLFRAMEBUFFEROBJECT_P_H diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp new file mode 100644 index 00000000000..4024a3896d4 --- /dev/null +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -0,0 +1,2452 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenglfunctions.h" +#include "qopenglextensions_p.h" +#include "qdebug.h" +#include "QtGui/private/qopenglcontext_p.h" +#include "QtGui/private/qopengl_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QOpenGLFunctions + \brief The QOpenGLFunctions class provides cross-platform access to the OpenGL/ES 2.0 API. + \since 5.0 + \ingroup painting-3D + + OpenGL/ES 2.0 defines a subset of the OpenGL specification that is + common across many desktop and embedded OpenGL implementations. + However, it can be difficult to use the functions from that subset + because they need to be resolved manually on desktop systems. + + QOpenGLFunctions provides a guaranteed API that is available on all + OpenGL systems and takes care of function resolution on systems + that need it. The recommended way to use QOpenGLFunctions is by + direct inheritance: + + \code + class MyGLWidget : public QOpenGLWidget, protected QOpenGLFunctions + { + Q_OBJECT + public: + MyGLWidget(QWidget *parent = 0) : QOpenGLWidget(parent) {} + + protected: + void initializeGL(); + void paintGL(); + }; + + void MyGLWidget::initializeGL() + { + initializeGLFunctions(); + } + \endcode + + The \c{paintGL()} function can then use any of the OpenGL/ES 2.0 + functions without explicit resolution, such as glActiveTexture() + in the following example: + + \code + void MyGLWidget::paintGL() + { + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, textureId); + ... + } + \endcode + + QOpenGLFunctions can also be used directly for ad-hoc invocation + of OpenGL/ES 2.0 functions on all platforms: + + \code + QOpenGLFunctions glFuncs(QOpenGLContext::currentContext()); + glFuncs.glActiveTexture(GL_TEXTURE1); + \endcode + + QOpenGLFunctions provides wrappers for all OpenGL/ES 2.0 functions, + except those like \c{glDrawArrays()}, \c{glViewport()}, and + \c{glBindTexture()} that don't have portability issues. + + Including the header for QOpenGLFunctions will also define all of + the OpenGL/ES 2.0 macro constants that are not already defined by + the system's OpenGL headers, such as \c{GL_TEXTURE1} above. + + The hasOpenGLFeature() and openGLFeatures() functions can be used + to determine if the OpenGL implementation has a major OpenGL/ES 2.0 + feature. For example, the following checks if non power of two + textures are available: + + \code + QOpenGLFunctions funcs(QOpenGLContext::currentContext()); + bool npot = funcs.hasOpenGLFeature(QOpenGLFunctions::NPOTTextures); + \endcode +*/ + +/*! + \enum QOpenGLFunctions::OpenGLFeature + This enum defines OpenGL/ES 2.0 features that may be optional + on other platforms. + + \value Multitexture glActiveTexture() function is available. + \value Shaders Shader functions are available. + \value Buffers Vertex and index buffer functions are available. + \value Framebuffers Framebuffer object functions are available. + \value BlendColor glBlendColor() is available. + \value BlendEquation glBlendEquation() is available. + \value BlendEquationSeparate glBlendEquationSeparate() is available. + \value BlendFuncSeparate glBlendFuncSeparate() is available. + \value BlendSubtract Blend subtract mode is available. + \value CompressedTextures Compressed texture functions are available. + \value Multisample glSampleCoverage() function is available. + \value StencilSeparate Separate stencil functions are available. + \value NPOTTextures Non power of two textures are available. +*/ + +// Hidden private fields for additional extension data. +struct QOpenGLFunctionsPrivateEx : public QOpenGLExtensionsPrivate, public QOpenGLSharedResource +{ + QOpenGLFunctionsPrivateEx(QOpenGLContext *context) + : QOpenGLExtensionsPrivate(context) + , QOpenGLSharedResource(context->shareGroup()) + , m_features(-1) + , m_extensions(-1) + {} + + void invalidateResource() + { + m_features = -1; + m_extensions = -1; + } + + void freeResource(QOpenGLContext *) + { + // no gl resources to free + } + + int m_features; + int m_extensions; +}; + +Q_GLOBAL_STATIC(QOpenGLMultiGroupSharedResource, qt_gl_functions_resource) + +static QOpenGLFunctionsPrivateEx *qt_gl_functions(QOpenGLContext *context = 0) +{ + if (!context) + context = QOpenGLContext::currentContext(); + Q_ASSERT(context); + QOpenGLFunctionsPrivateEx *funcs = + qt_gl_functions_resource()->value(context); + return funcs; +} + +/*! + Constructs a default function resolver. The resolver cannot + be used until initializeGLFunctions() is called to specify + the context. + + \sa initializeGLFunctions() +*/ +QOpenGLFunctions::QOpenGLFunctions() + : d_ptr(0) +{ +} + +/*! + Constructs a function resolver for \a context. If \a context + is null, then the resolver will be created for the current QOpenGLContext. + + The context or another context in the group must be current. + + An object constructed in this way can only be used with \a context + and other contexts that share with it. Use initializeGLFunctions() + to change the object's context association. + + \sa initializeGLFunctions() +*/ +QOpenGLFunctions::QOpenGLFunctions(QOpenGLContext *context) + : d_ptr(0) +{ + if (context && QOpenGLContextGroup::currentContextGroup() == context->shareGroup()) + d_ptr = qt_gl_functions(context); + else + qWarning() << "QOpenGLFunctions created with non-current context"; +} + +QOpenGLExtensions::QOpenGLExtensions() + : QOpenGLFunctions() +{ +} + +QOpenGLExtensions::QOpenGLExtensions(QOpenGLContext *context) + : QOpenGLFunctions(context) +{ +} + +/*! + \fn QOpenGLFunctions::~QOpenGLFunctions() + + Destroys this function resolver. +*/ + +static int qt_gl_resolve_features() +{ +#if defined(QT_OPENGL_ES_2) + int features = QOpenGLFunctions::Multitexture | + QOpenGLFunctions::Shaders | + QOpenGLFunctions::Buffers | + QOpenGLFunctions::Framebuffers | + QOpenGLFunctions::BlendColor | + QOpenGLFunctions::BlendEquation | + QOpenGLFunctions::BlendEquationSeparate | + QOpenGLFunctions::BlendFuncSeparate | + QOpenGLFunctions::BlendSubtract | + QOpenGLFunctions::CompressedTextures | + QOpenGLFunctions::Multisample | + QOpenGLFunctions::StencilSeparate; + QOpenGLExtensionMatcher extensions; + if (extensions.match("GL_OES_texture_npot")) + features |= QOpenGLFunctions::NPOTTextures; + if (extensions.match("GL_IMG_texture_npot")) + features |= QOpenGLFunctions::NPOTTextures; + return features; +#elif defined(QT_OPENGL_ES) + int features = QOpenGLFunctions::Multitexture | + QOpenGLFunctions::Buffers | + QOpenGLFunctions::CompressedTextures | + QOpenGLFunctions::Multisample; + QOpenGLExtensionMatcher extensions; + if (extensions.match("GL_OES_framebuffer_object")) + features |= QOpenGLFunctions::Framebuffers; + if (extensions.match("GL_OES_blend_equation_separate")) + features |= QOpenGLFunctions::BlendEquationSeparate; + if (extensions.match("GL_OES_blend_func_separate")) + features |= QOpenGLFunctions::BlendFuncSeparate; + if (extensions.match("GL_OES_blend_subtract")) + features |= QOpenGLFunctions::BlendSubtract; + if (extensions.match("GL_OES_texture_npot")) + features |= QOpenGLFunctions::NPOTTextures; + if (extensions.match("GL_IMG_texture_npot")) + features |= QOpenGLFunctions::NPOTTextures; + return features; +#else + int features = 0; + //QOpenGLFormat::OpenGLVersionFlags versions = QOpenGLFormat::openGLVersionFlags(); + QOpenGLExtensionMatcher extensions; + + // Recognize features by extension name. + if (extensions.match("GL_ARB_multitexture")) + features |= QOpenGLFunctions::Multitexture; + if (extensions.match("GL_ARB_shader_objects")) + features |= QOpenGLFunctions::Shaders; + if (extensions.match("GL_EXT_framebuffer_object") || + extensions.match("GL_ARB_framebuffer_object")) + features |= QOpenGLFunctions::Framebuffers; + if (extensions.match("GL_EXT_blend_color")) + features |= QOpenGLFunctions::BlendColor; + if (extensions.match("GL_EXT_blend_equation_separate")) + features |= QOpenGLFunctions::BlendEquationSeparate; + if (extensions.match("GL_EXT_blend_func_separate")) + features |= QOpenGLFunctions::BlendFuncSeparate; + if (extensions.match("GL_EXT_blend_subtract")) + features |= QOpenGLFunctions::BlendSubtract; + if (extensions.match("GL_ARB_texture_compression")) + features |= QOpenGLFunctions::CompressedTextures; + if (extensions.match("GL_ARB_multisample")) + features |= QOpenGLFunctions::Multisample; + if (extensions.match("GL_ARB_texture_non_power_of_two")) + features |= QOpenGLFunctions::NPOTTextures; + + // assume version 2.0 or higher + features |= QOpenGLFunctions::BlendColor | + QOpenGLFunctions::BlendEquation | + QOpenGLFunctions::Multitexture | + QOpenGLFunctions::CompressedTextures | + QOpenGLFunctions::Multisample | + QOpenGLFunctions::BlendFuncSeparate | + QOpenGLFunctions::Buffers | + QOpenGLFunctions::Shaders | + QOpenGLFunctions::StencilSeparate | + QOpenGLFunctions::BlendEquationSeparate | + QOpenGLFunctions::NPOTTextures; + return features; +#endif +} + +static int qt_gl_resolve_extensions() +{ + int extensions = 0; + QOpenGLExtensionMatcher extensionMatcher; +#if defined(QT_OPENGL_ES) + if (extensionMatcher.match("GL_OES_mapbuffer")) + extensions |= QOpenGLExtensions::MapBuffer; + if (extensionMatcher.match("GL_OES_packed_depth_stencil")) + extensions |= QOpenGLExtensions::PackedDepthStencil; + if (extensionMatcher.match("GL_OES_element_index_uint")) + extensions |= QOpenGLExtensions::ElementIndexUint; + if (extensionMatcher.match("GL_OES_depth24")) + extensions |= QOpenGLExtensions::Depth24; +#else + extensions |= QOpenGLExtensions::ElementIndexUint | QOpenGLExtensions::MapBuffer; + + // Recognize features by extension name. + if (extensionMatcher.match("GL_ARB_framebuffer_object")) { + extensions |= QOpenGLExtensions::FramebufferMultisample | + QOpenGLExtensions::FramebufferBlit | + QOpenGLExtensions::PackedDepthStencil; + } else { + if (extensionMatcher.match("GL_EXT_framebuffer_multisample")) + extensions |= QOpenGLExtensions::FramebufferMultisample; + if (extensionMatcher.match("GL_EXT_framebuffer_blit")) + extensions |= QOpenGLExtensions::FramebufferBlit; + if (extensionMatcher.match("GL_EXT_pakced_depth_stencil")) + extensions |= QOpenGLExtensions::PackedDepthStencil; + } +#endif + return extensions; +} + +/*! + Returns the set of features that are present on this system's + OpenGL implementation. + + It is assumed that the QOpenGLContext associated with this function + resolver is current. + + \sa hasOpenGLFeature() +*/ +QOpenGLFunctions::OpenGLFeatures QOpenGLFunctions::openGLFeatures() const +{ + QOpenGLFunctionsPrivateEx *d = static_cast(d_ptr); + if (!d) + return 0; + if (d->m_features == -1) + d->m_features = qt_gl_resolve_features(); + return QOpenGLFunctions::OpenGLFeatures(d->m_features); +} + +/*! + Returns true if \a feature is present on this system's OpenGL + implementation; false otherwise. + + It is assumed that the QOpenGLContext associated with this function + resolver is current. + + \sa openGLFeatures() +*/ +bool QOpenGLFunctions::hasOpenGLFeature(QOpenGLFunctions::OpenGLFeature feature) const +{ + QOpenGLFunctionsPrivateEx *d = static_cast(d_ptr); + if (!d) + return false; + if (d->m_features == -1) + d->m_features = qt_gl_resolve_features(); + return (d->m_features & int(feature)) != 0; +} + +/*! + Returns the set of extensions that are present on this system's + OpenGL implementation. + + It is assumed that the QOpenGLContext associated with this extension + resolver is current. + + \sa hasOpenGLExtensions() +*/ +QOpenGLExtensions::OpenGLExtensions QOpenGLExtensions::openGLExtensions() +{ + QOpenGLFunctionsPrivateEx *d = static_cast(d_ptr); + if (!d) + return 0; + if (d->m_extensions == -1) + d->m_extensions = qt_gl_resolve_extensions(); + return QOpenGLExtensions::OpenGLExtensions(d->m_extensions); +} + +/*! + Returns true if \a extension is present on this system's OpenGL + implementation; false otherwise. + + It is assumed that the QOpenGLContext associated with this extension + resolver is current. + + \sa openGLFeatures() +*/ +bool QOpenGLExtensions::hasOpenGLExtension(QOpenGLExtensions::OpenGLExtension extension) const +{ + QOpenGLFunctionsPrivateEx *d = static_cast(d_ptr); + if (!d) + return false; + if (d->m_extensions == -1) + d->m_extensions = qt_gl_resolve_extensions(); + return (d->m_extensions & int(extension)) != 0; +} + +/*! + Initializes GL function resolution for the current context. + + After calling this function, the QOpenGLFunctions object can only be + used with the current context and other contexts that share with it. + Call initializeGLFunctions() again to change the object's context + association. +*/ +void QOpenGLFunctions::initializeGLFunctions() +{ + d_ptr = qt_gl_functions(); +} + +/*! + \fn void QOpenGLFunctions::glActiveTexture(GLenum texture) + + Convenience function that calls glActiveTexture(\a texture). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glActiveTexture.xml}{glActiveTexture()}. +*/ + +/*! + \fn void QOpenGLFunctions::glAttachShader(GLuint program, GLuint shader) + + Convenience function that calls glAttachShader(\a program, \a shader). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glAttachShader.xml}{glAttachShader()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name) + + Convenience function that calls glBindAttribLocation(\a program, \a index, \a name). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBindAttribLocation.xml}{glBindAttribLocation()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glBindBuffer(GLenum target, GLuint buffer) + + Convenience function that calls glBindBuffer(\a target, \a buffer). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBindBuffer.xml}{glBindBuffer()}. +*/ + +/*! + \fn void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffer) + + Convenience function that calls glBindFramebuffer(\a target, \a framebuffer). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBindFramebuffer.xml}{glBindFramebuffer()}. +*/ + +/*! + \fn void QOpenGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer) + + Convenience function that calls glBindRenderbuffer(\a target, \a renderbuffer). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBindRenderbuffer.xml}{glBindRenderbuffer()}. +*/ + +/*! + \fn void QOpenGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) + + Convenience function that calls glBlendColor(\a red, \a green, \a blue, \a alpha). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendColor.xml}{glBlendColor()}. +*/ + +/*! + \fn void QOpenGLFunctions::glBlendEquation(GLenum mode) + + Convenience function that calls glBlendEquation(\a mode). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendEquation.xml}{glBlendEquation()}. +*/ + +/*! + \fn void QOpenGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) + + Convenience function that calls glBlendEquationSeparate(\a modeRGB, \a modeAlpha). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendEquationSeparate.xml}{glBlendEquationSeparate()}. +*/ + +/*! + \fn void QOpenGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) + + Convenience function that calls glBlendFuncSeparate(\a srcRGB, \a dstRGB, \a srcAlpha, \a dstAlpha). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBlendFuncSeparate.xml}{glBlendFuncSeparate()}. +*/ + +/*! + \fn void QOpenGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage) + + Convenience function that calls glBufferData(\a target, \a size, \a data, \a usage). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBufferData.xml}{glBufferData()}. +*/ + +/*! + \fn void QOpenGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data) + + Convenience function that calls glBufferSubData(\a target, \a offset, \a size, \a data). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glBufferSubData.xml}{glBufferSubData()}. +*/ + +/*! + \fn GLenum QOpenGLFunctions::glCheckFramebufferStatus(GLenum target) + + Convenience function that calls glCheckFramebufferStatus(\a target). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glCheckFramebufferStatus.xml}{glCheckFramebufferStatus()}. +*/ + +/*! + \fn void QOpenGLFunctions::glClearDepthf(GLclampf depth) + + Convenience function that calls glClearDepth(\a depth) on + desktop OpenGL systems and glClearDepthf(\a depth) on + embedded OpenGL/ES systems. + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glClearDepthf.xml}{glClearDepthf()}. +*/ + +/*! + \fn void QOpenGLFunctions::glCompileShader(GLuint shader) + + Convenience function that calls glCompileShader(\a shader). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glCompileShader.xml}{glCompileShader()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) + + Convenience function that calls glCompressedTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a imageSize, \a data). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glCompressedTexImage2D.xml}{glCompressedTexImage2D()}. +*/ + +/*! + \fn void QOpenGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) + + Convenience function that calls glCompressedTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a imageSize, \a data). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glCompressedTexSubImage2D.xml}{glCompressedTexSubImage2D()}. +*/ + +/*! + \fn GLuint QOpenGLFunctions::glCreateProgram() + + Convenience function that calls glCreateProgram(). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glCreateProgram.xml}{glCreateProgram()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn GLuint QOpenGLFunctions::glCreateShader(GLenum type) + + Convenience function that calls glCreateShader(\a type). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glCreateShader.xml}{glCreateShader()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers) + + Convenience function that calls glDeleteBuffers(\a n, \a buffers). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteBuffers.xml}{glDeleteBuffers()}. +*/ + +/*! + \fn void QOpenGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) + + Convenience function that calls glDeleteFramebuffers(\a n, \a framebuffers). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteFramebuffers.xml}{glDeleteFramebuffers()}. +*/ + +/*! + \fn void QOpenGLFunctions::glDeleteProgram(GLuint program) + + Convenience function that calls glDeleteProgram(\a program). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteProgram.xml}{glDeleteProgram()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) + + Convenience function that calls glDeleteRenderbuffers(\a n, \a renderbuffers). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteRenderbuffers.xml}{glDeleteRenderbuffers()}. +*/ + +/*! + \fn void QOpenGLFunctions::glDeleteShader(GLuint shader) + + Convenience function that calls glDeleteShader(\a shader). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteShader.xml}{glDeleteShader()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar) + + Convenience function that calls glDepthRange(\a zNear, \a zFar) on + desktop OpenGL systems and glDepthRangef(\a zNear, \a zFar) on + embedded OpenGL/ES systems. + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDepthRangef.xml}{glDepthRangef()}. +*/ + +/*! + \fn void QOpenGLFunctions::glDetachShader(GLuint program, GLuint shader) + + Convenience function that calls glDetachShader(\a program, \a shader). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDetachShader.xml}{glDetachShader()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glDisableVertexAttribArray(GLuint index) + + Convenience function that calls glDisableVertexAttribArray(\a index). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glDisableVertexAttribArray.xml}{glDisableVertexAttribArray()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glEnableVertexAttribArray(GLuint index) + + Convenience function that calls glEnableVertexAttribArray(\a index). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glEnableVertexAttribArray.xml}{glEnableVertexAttribArray()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) + + Convenience function that calls glFramebufferRenderbuffer(\a target, \a attachment, \a renderbuffertarget, \a renderbuffer). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glFramebufferRenderbuffer.xml}{glFramebufferRenderbuffer()}. +*/ + +/*! + \fn void QOpenGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) + + Convenience function that calls glFramebufferTexture2D(\a target, \a attachment, \a textarget, \a texture, \a level). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glFramebufferTexture2D.xml}{glFramebufferTexture2D()}. +*/ + +/*! + \fn void QOpenGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers) + + Convenience function that calls glGenBuffers(\a n, \a buffers). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGenBuffers.xml}{glGenBuffers()}. +*/ + +/*! + \fn void QOpenGLFunctions::glGenerateMipmap(GLenum target) + + Convenience function that calls glGenerateMipmap(\a target). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGenerateMipmap.xml}{glGenerateMipmap()}. +*/ + +/*! + \fn void QOpenGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers) + + Convenience function that calls glGenFramebuffers(\a n, \a framebuffers). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGenFramebuffers.xml}{glGenFramebuffers()}. +*/ + +/*! + \fn void QOpenGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) + + Convenience function that calls glGenRenderbuffers(\a n, \a renderbuffers). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGenRenderbuffers.xml}{glGenRenderbuffers()}. +*/ + +/*! + \fn void QOpenGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) + + Convenience function that calls glGetActiveAttrib(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetActiveAttrib.xml}{glGetActiveAttrib()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) + + Convenience function that calls glGetActiveUniform(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetActiveUniform.xml}{glGetActiveUniform()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) + + Convenience function that calls glGetAttachedShaders(\a program, \a maxcount, \a count, \a shaders). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetAttachedShaders.xml}{glGetAttachedShaders()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn GLint QOpenGLFunctions::glGetAttribLocation(GLuint program, const char* name) + + Convenience function that calls glGetAttribLocation(\a program, \a name). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetAttribLocation.xml}{glGetAttribLocation()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) + + Convenience function that calls glGetBufferParameteriv(\a target, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetBufferParameteriv.xml}{glGetBufferParameteriv()}. +*/ + +/*! + \fn void QOpenGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) + + Convenience function that calls glGetFramebufferAttachmentParameteriv(\a target, \a attachment, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetFramebufferAttachmentParameteriv.xml}{glGetFramebufferAttachmentParameteriv()}. +*/ + +/*! + \fn void QOpenGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params) + + Convenience function that calls glGetProgramiv(\a program, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetProgramiv.xml}{glGetProgramiv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) + + Convenience function that calls glGetProgramInfoLog(\a program, \a bufsize, \a length, \a infolog). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetProgramInfoLog.xml}{glGetProgramInfoLog()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) + + Convenience function that calls glGetRenderbufferParameteriv(\a target, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetRenderbufferParameteriv.xml}{glGetRenderbufferParameteriv()}. +*/ + +/*! + \fn void QOpenGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params) + + Convenience function that calls glGetShaderiv(\a shader, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderiv.xml}{glGetShaderiv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) + + Convenience function that calls glGetShaderInfoLog(\a shader, \a bufsize, \a length, \a infolog). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderInfoLog.xml}{glGetShaderInfoLog()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) + + Convenience function that calls glGetShaderPrecisionFormat(\a shadertype, \a precisiontype, \a range, \a precision). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderPrecisionFormat.xml}{glGetShaderPrecisionFormat()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) + + Convenience function that calls glGetShaderSource(\a shader, \a bufsize, \a length, \a source). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderSource.xml}{glGetShaderSource()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params) + + Convenience function that calls glGetUniformfv(\a program, \a location, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformfv.xml}{glGetUniformfv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params) + + Convenience function that calls glGetUniformiv(\a program, \a location, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformiv.xml}{glGetUniformiv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn GLint QOpenGLFunctions::glGetUniformLocation(GLuint program, const char* name) + + Convenience function that calls glGetUniformLocation(\a program, \a name). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformLocation.xml}{glGetUniformLocation()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) + + Convenience function that calls glGetVertexAttribfv(\a index, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribfv.xml}{glGetVertexAttribfv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) + + Convenience function that calls glGetVertexAttribiv(\a index, \a pname, \a params). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribiv.xml}{glGetVertexAttribiv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) + + Convenience function that calls glGetVertexAttribPointerv(\a index, \a pname, \a pointer). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribPointerv.xml}{glGetVertexAttribPointerv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn GLboolean QOpenGLFunctions::glIsBuffer(GLuint buffer) + + Convenience function that calls glIsBuffer(\a buffer). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glIsBuffer.xml}{glIsBuffer()}. +*/ + +/*! + \fn GLboolean QOpenGLFunctions::glIsFramebuffer(GLuint framebuffer) + + Convenience function that calls glIsFramebuffer(\a framebuffer). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glIsFramebuffer.xml}{glIsFramebuffer()}. +*/ + +/*! + \fn GLboolean QOpenGLFunctions::glIsProgram(GLuint program) + + Convenience function that calls glIsProgram(\a program). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glIsProgram.xml}{glIsProgram()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn GLboolean QOpenGLFunctions::glIsRenderbuffer(GLuint renderbuffer) + + Convenience function that calls glIsRenderbuffer(\a renderbuffer). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glIsRenderbuffer.xml}{glIsRenderbuffer()}. +*/ + +/*! + \fn GLboolean QOpenGLFunctions::glIsShader(GLuint shader) + + Convenience function that calls glIsShader(\a shader). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glIsShader.xml}{glIsShader()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glLinkProgram(GLuint program) + + Convenience function that calls glLinkProgram(\a program). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glLinkProgram.xml}{glLinkProgram()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glReleaseShaderCompiler() + + Convenience function that calls glReleaseShaderCompiler(). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glReleaseShaderCompiler.xml}{glReleaseShaderCompiler()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) + + Convenience function that calls glRenderbufferStorage(\a target, \a internalformat, \a width, \a height). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glRenderbufferStorage.xml}{glRenderbufferStorage()}. +*/ + +/*! + \fn void QOpenGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert) + + Convenience function that calls glSampleCoverage(\a value, \a invert). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glSampleCoverage.xml}{glSampleCoverage()}. +*/ + +/*! + \fn void QOpenGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length) + + Convenience function that calls glShaderBinary(\a n, \a shaders, \a binaryformat, \a binary, \a length). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glShaderBinary.xml}{glShaderBinary()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) + + Convenience function that calls glShaderSource(\a shader, \a count, \a string, \a length). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glShaderSource.xml}{glShaderSource()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) + + Convenience function that calls glStencilFuncSeparate(\a face, \a func, \a ref, \a mask). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilFuncSeparate.xml}{glStencilFuncSeparate()}. +*/ + +/*! + \fn void QOpenGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask) + + Convenience function that calls glStencilMaskSeparate(\a face, \a mask). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilMaskSeparate.xml}{glStencilMaskSeparate()}. +*/ + +/*! + \fn void QOpenGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) + + Convenience function that calls glStencilOpSeparate(\a face, \a fail, \a zfail, \a zpass). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glStencilOpSeparate.xml}{glStencilOpSeparate()}. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform1f(GLint location, GLfloat x) + + Convenience function that calls glUniform1f(\a location, \a x). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1f.xml}{glUniform1f()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v) + + Convenience function that calls glUniform1fv(\a location, \a count, \a v). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1fv.xml}{glUniform1fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform1i(GLint location, GLint x) + + Convenience function that calls glUniform1i(\a location, \a x). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1i.xml}{glUniform1i()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v) + + Convenience function that calls glUniform1iv(\a location, \a count, \a v). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1iv.xml}{glUniform1iv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y) + + Convenience function that calls glUniform2f(\a location, \a x, \a y). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2f.xml}{glUniform2f()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v) + + Convenience function that calls glUniform2fv(\a location, \a count, \a v). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2fv.xml}{glUniform2fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform2i(GLint location, GLint x, GLint y) + + Convenience function that calls glUniform2i(\a location, \a x, \a y). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2i.xml}{glUniform2i()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v) + + Convenience function that calls glUniform2iv(\a location, \a count, \a v). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2iv.xml}{glUniform2iv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) + + Convenience function that calls glUniform3f(\a location, \a x, \a y, \a z). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3f.xml}{glUniform3f()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v) + + Convenience function that calls glUniform3fv(\a location, \a count, \a v). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3fv.xml}{glUniform3fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z) + + Convenience function that calls glUniform3i(\a location, \a x, \a y, \a z). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3i.xml}{glUniform3i()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v) + + Convenience function that calls glUniform3iv(\a location, \a count, \a v). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3iv.xml}{glUniform3iv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) + + Convenience function that calls glUniform4f(\a location, \a x, \a y, \a z, \a w). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4f.xml}{glUniform4f()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v) + + Convenience function that calls glUniform4fv(\a location, \a count, \a v). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4fv.xml}{glUniform4fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) + + Convenience function that calls glUniform4i(\a location, \a x, \a y, \a z, \a w). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4i.xml}{glUniform4i()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v) + + Convenience function that calls glUniform4iv(\a location, \a count, \a v). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4iv.xml}{glUniform4iv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + + Convenience function that calls glUniformMatrix2fv(\a location, \a count, \a transpose, \a value). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix2fv.xml}{glUniformMatrix2fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + + Convenience function that calls glUniformMatrix3fv(\a location, \a count, \a transpose, \a value). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix3fv.xml}{glUniformMatrix3fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) + + Convenience function that calls glUniformMatrix4fv(\a location, \a count, \a transpose, \a value). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix4fv.xml}{glUniformMatrix4fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glUseProgram(GLuint program) + + Convenience function that calls glUseProgram(\a program). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glUseProgram.xml}{glUseProgram()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glValidateProgram(GLuint program) + + Convenience function that calls glValidateProgram(\a program). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glValidateProgram.xml}{glValidateProgram()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x) + + Convenience function that calls glVertexAttrib1f(\a indx, \a x). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib1f.xml}{glVertexAttrib1f()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values) + + Convenience function that calls glVertexAttrib1fv(\a indx, \a values). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib1fv.xml}{glVertexAttrib1fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) + + Convenience function that calls glVertexAttrib2f(\a indx, \a x, \a y). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib2f.xml}{glVertexAttrib2f()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values) + + Convenience function that calls glVertexAttrib2fv(\a indx, \a values). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib2fv.xml}{glVertexAttrib2fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) + + Convenience function that calls glVertexAttrib3f(\a indx, \a x, \a y, \a z). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib3f.xml}{glVertexAttrib3f()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values) + + Convenience function that calls glVertexAttrib3fv(\a indx, \a values). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib3fv.xml}{glVertexAttrib3fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) + + Convenience function that calls glVertexAttrib4f(\a indx, \a x, \a y, \a z, \a w). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib4f.xml}{glVertexAttrib4f()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values) + + Convenience function that calls glVertexAttrib4fv(\a indx, \a values). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib4fv.xml}{glVertexAttrib4fv()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +/*! + \fn void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) + + Convenience function that calls glVertexAttribPointer(\a indx, \a size, \a type, \a normalized, \a stride, \a ptr). + + For more information, see the OpenGL/ES 2.0 documentation for + \l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttribPointer.xml}{glVertexAttribPointer()}. + + This convenience function will do nothing on OpenGL/ES 1.x systems. +*/ + +namespace { + +enum ResolvePolicy +{ + ResolveOES = 0x1, + ResolveEXT = 0x2 +}; + +template +class Resolver +{ +public: + Resolver(FuncType Base::*func, FuncType fallback, const char *name, const char *alternateName = 0) + : funcPointerName(func) + , fallbackFuncPointer(fallback) + , funcName(name) + , alternateFuncName(alternateName) + { + } + + ReturnType operator()(); + + template + ReturnType operator()(P1 p1); + + template + ReturnType operator()(P1 p1, P2 p2); + + template + ReturnType operator()(P1 p1, P2 p2, P3 p3); + + template + ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4); + + template + ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5); + + template + ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6); + + template + ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7); + + template + ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8); + + template + ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9); + + template + ReturnType operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10); + +private: + FuncType Base::*funcPointerName; + FuncType fallbackFuncPointer; + QByteArray funcName; + QByteArray alternateFuncName; +}; + +template +class Resolver +{ +public: + Resolver(FuncType Base::*func, FuncType fallback, const char *name, const char *alternateName = 0) + : funcPointerName(func) + , fallbackFuncPointer(fallback) + , funcName(name) + , alternateFuncName(alternateName) + { + } + + void operator()(); + + template + void operator()(P1 p1); + + template + void operator()(P1 p1, P2 p2); + + template + void operator()(P1 p1, P2 p2, P3 p3); + + template + void operator()(P1 p1, P2 p2, P3 p3, P4 p4); + + template + void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5); + + template + void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6); + + template + void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7); + + template + void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8); + + template + void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9); + + template + void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10); + +private: + FuncType Base::*funcPointerName; + FuncType fallbackFuncPointer; + QByteArray funcName; + QByteArray alternateFuncName; +}; + +#define RESOLVER_COMMON \ + QOpenGLContext *context = QOpenGLContext::currentContext(); \ + Base *funcs = qt_gl_functions(context); \ + \ + FuncType old = funcs->*funcPointerName; \ + \ + funcs->*funcPointerName = (FuncType)context->getProcAddress(funcName); \ + \ + if ((Policy & ResolveOES) && !(funcs->*funcPointerName)) \ + funcs->*funcPointerName = (FuncType)context->getProcAddress(funcName + "OES"); \ + \ + if (!(funcs->*funcPointerName)) \ + funcs->*funcPointerName = (FuncType)context->getProcAddress(funcName + "ARB"); \ + \ + if ((Policy & ResolveEXT) && !(funcs->*funcPointerName)) \ + funcs->*funcPointerName = (FuncType)context->getProcAddress(funcName + "EXT"); \ + \ + if (!alternateFuncName.isEmpty() && !(funcs->*funcPointerName)) { \ + funcs->*funcPointerName = (FuncType)context->getProcAddress(alternateFuncName); \ + \ + if ((Policy & ResolveOES) && !(funcs->*funcPointerName)) \ + funcs->*funcPointerName = (FuncType)context->getProcAddress(alternateFuncName + "OES"); \ + \ + if (!(funcs->*funcPointerName)) \ + funcs->*funcPointerName = (FuncType)context->getProcAddress(alternateFuncName + "ARB"); \ + \ + if ((Policy & ResolveEXT) && !(funcs->*funcPointerName)) \ + funcs->*funcPointerName = (FuncType)context->getProcAddress(alternateFuncName + "EXT"); \ + } + +#define RESOLVER_COMMON_NON_VOID \ + RESOLVER_COMMON \ + \ + if (!(funcs->*funcPointerName)) { \ + if (fallbackFuncPointer) { \ + funcs->*funcPointerName = fallbackFuncPointer; \ + } else { \ + funcs->*funcPointerName = old; \ + return ReturnType(); \ + } \ + } + +#define RESOLVER_COMMON_VOID \ + RESOLVER_COMMON \ + \ + if (!(funcs->*funcPointerName)) { \ + if (fallbackFuncPointer) { \ + funcs->*funcPointerName = fallbackFuncPointer; \ + } else { \ + funcs->*funcPointerName = old; \ + return; \ + } \ + } + +template +ReturnType Resolver::operator()() +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(); +} + +template template +ReturnType Resolver::operator()(P1 p1) +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(p1); +} + +template template +ReturnType Resolver::operator()(P1 p1, P2 p2) +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(p1, p2); +} + +template template +ReturnType Resolver::operator()(P1 p1, P2 p2, P3 p3) +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(p1, p2, p3); +} + +template template +ReturnType Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4) +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(p1, p2, p3, p4); +} + +template template +ReturnType Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(p1, p2, p3, p4, p5); +} + +template template +ReturnType Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6); +} + +template template +ReturnType Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7); +} + +template template +ReturnType Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8); +} + +template template +ReturnType Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8, p9); +} + +template template +ReturnType Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10) +{ + RESOLVER_COMMON_NON_VOID + + return (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); +} + +template +void Resolver::operator()() +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(); +} + +template template +void Resolver::operator()(P1 p1) +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(p1); +} + +template template +void Resolver::operator()(P1 p1, P2 p2) +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(p1, p2); +} + +template template +void Resolver::operator()(P1 p1, P2 p2, P3 p3) +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(p1, p2, p3); +} + +template template +void Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4) +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(p1, p2, p3, p4); +} + +template template +void Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(p1, p2, p3, p4, p5); +} + +template template +void Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6); +} + +template template +void Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7); +} + +template template +void Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8); +} + +template template +void Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8, p9); +} + +template template +void Resolver::operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10) +{ + RESOLVER_COMMON_VOID + + (funcs->*funcPointerName)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); +} + +template +Resolver functionResolverWithFallback(FuncType Base::*func, FuncType fallback, const char *name, const char *alternate = 0) +{ + return Resolver(func, fallback, name, alternate); +} + +template +Resolver functionResolver(FuncType Base::*func, const char *name, const char *alternate = 0) +{ + return Resolver(func, 0, name, alternate); +} + +} + +#define RESOLVE_FUNC(RETURN_TYPE, POLICY, NAME) \ + return functionResolver(&QOpenGLExtensionsPrivate::NAME, "gl" #NAME) + +#define RESOLVE_FUNC_VOID(POLICY, NAME) \ + functionResolver(&QOpenGLExtensionsPrivate::NAME, "gl" #NAME) + +#define RESOLVE_FUNC_SPECIAL(RETURN_TYPE, POLICY, NAME) \ + return functionResolverWithFallback(&QOpenGLExtensionsPrivate::NAME, qopenglfSpecial##NAME, "gl" #NAME) + +#define RESOLVE_FUNC_SPECIAL_VOID(POLICY, NAME) \ + functionResolverWithFallback(&QOpenGLExtensionsPrivate::NAME, qopenglfSpecial##NAME, "gl" #NAME) + +#define RESOLVE_FUNC_WITH_ALTERNATE(RETURN_TYPE, POLICY, NAME, ALTERNATE) \ + return functionResolver(&QOpenGLExtensionsPrivate::NAME, "gl" #NAME, "gl" #ALTERNATE) + +#define RESOLVE_FUNC_VOID_WITH_ALTERNATE(POLICY, NAME, ALTERNATE) \ + functionResolver(&QOpenGLExtensionsPrivate::NAME, "gl" #NAME, "gl" #ALTERNATE) + +#ifndef QT_OPENGL_ES_2 + +static void QOPENGLF_APIENTRY qopenglfResolveActiveTexture(GLenum texture) +{ + RESOLVE_FUNC_VOID(0, ActiveTexture)(texture); +} + +static void QOPENGLF_APIENTRY qopenglfResolveAttachShader(GLuint program, GLuint shader) +{ + RESOLVE_FUNC_VOID_WITH_ALTERNATE(0, AttachShader, AttachObject)(program, shader); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBindAttribLocation(GLuint program, GLuint index, const char* name) +{ + RESOLVE_FUNC_VOID(0, BindAttribLocation)(program, index, name); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBindBuffer(GLenum target, GLuint buffer) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, BindBuffer)(target, buffer); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBindFramebuffer(GLenum target, GLuint framebuffer) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, BindFramebuffer)(target, framebuffer); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBindRenderbuffer(GLenum target, GLuint renderbuffer) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, BindRenderbuffer)(target, renderbuffer); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, BlendColor)(red, green, blue, alpha); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBlendEquation(GLenum mode) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, BlendEquation)(mode); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, BlendEquationSeparate)(modeRGB, modeAlpha); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, BlendFuncSeparate)(srcRGB, dstRGB, srcAlpha, dstAlpha); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, BufferData)(target, size, data, usage); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, BufferSubData)(target, offset, size, data); +} + +static GLenum QOPENGLF_APIENTRY qopenglfResolveCheckFramebufferStatus(GLenum target) +{ + RESOLVE_FUNC(GLenum, ResolveOES | ResolveEXT, CheckFramebufferStatus)(target); +} + +static void QOPENGLF_APIENTRY qopenglfResolveCompileShader(GLuint shader) +{ + RESOLVE_FUNC_VOID(0, CompileShader)(shader); +} + +static void QOPENGLF_APIENTRY qopenglfResolveCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, CompressedTexImage2D)(target, level, internalformat, width, height, border, imageSize, data); +} + +static void QOPENGLF_APIENTRY qopenglfResolveCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, CompressedTexSubImage2D)(target, level, xoffset, yoffset, width, height, format, imageSize, data); +} + +static GLuint QOPENGLF_APIENTRY qopenglfResolveCreateProgram() +{ + RESOLVE_FUNC_WITH_ALTERNATE(GLuint, 0, CreateProgram, CreateProgramObject)(); +} + +static GLuint QOPENGLF_APIENTRY qopenglfResolveCreateShader(GLenum type) +{ + RESOLVE_FUNC_WITH_ALTERNATE(GLuint, 0, CreateShader, CreateShaderObject)(type); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDeleteBuffers(GLsizei n, const GLuint* buffers) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, DeleteBuffers)(n, buffers); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, DeleteFramebuffers)(n, framebuffers); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDeleteProgram(GLuint program) +{ + RESOLVE_FUNC_VOID(0, DeleteProgram)(program); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, DeleteRenderbuffers)(n, renderbuffers); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDeleteShader(GLuint shader) +{ + RESOLVE_FUNC_VOID_WITH_ALTERNATE(0, DeleteShader, DeleteObject)(shader); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDetachShader(GLuint program, GLuint shader) +{ + RESOLVE_FUNC_VOID_WITH_ALTERNATE(0, DetachShader, DetachObject)(program, shader); +} + +static void QOPENGLF_APIENTRY qopenglfResolveDisableVertexAttribArray(GLuint index) +{ + RESOLVE_FUNC_VOID(0, DisableVertexAttribArray)(index); +} + +static void QOPENGLF_APIENTRY qopenglfResolveEnableVertexAttribArray(GLuint index) +{ + RESOLVE_FUNC_VOID(0, EnableVertexAttribArray)(index); +} + +static void QOPENGLF_APIENTRY qopenglfResolveFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, FramebufferRenderbuffer)(target, attachment, renderbuffertarget, renderbuffer); +} + +static void QOPENGLF_APIENTRY qopenglfResolveFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, FramebufferTexture2D)(target, attachment, textarget, texture, level); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGenBuffers(GLsizei n, GLuint* buffers) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, GenBuffers)(n, buffers); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGenerateMipmap(GLenum target) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, GenerateMipmap)(target); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGenFramebuffers(GLsizei n, GLuint* framebuffers) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, GenFramebuffers)(n, framebuffers); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGenRenderbuffers(GLsizei n, GLuint* renderbuffers) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, GenRenderbuffers)(n, renderbuffers); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) +{ + RESOLVE_FUNC_VOID(0, GetActiveAttrib)(program, index, bufsize, length, size, type, name); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) +{ + RESOLVE_FUNC_VOID(0, GetActiveUniform)(program, index, bufsize, length, size, type, name); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) +{ + RESOLVE_FUNC_VOID_WITH_ALTERNATE(0, GetAttachedShaders, GetAttachedObjects)(program, maxcount, count, shaders); +} + +static GLint QOPENGLF_APIENTRY qopenglfResolveGetAttribLocation(GLuint program, const char* name) +{ + RESOLVE_FUNC(GLint, 0, GetAttribLocation)(program, name); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, GetBufferParameteriv)(target, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, GetFramebufferAttachmentParameteriv)(target, attachment, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetProgramiv(GLuint program, GLenum pname, GLint* params) +{ + RESOLVE_FUNC_VOID_WITH_ALTERNATE(0, GetProgramiv, GetObjectParameteriv)(program, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) +{ + RESOLVE_FUNC_VOID_WITH_ALTERNATE(0, GetProgramInfoLog, GetInfoLog)(program, bufsize, length, infolog); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, GetRenderbufferParameteriv)(target, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetShaderiv(GLuint shader, GLenum pname, GLint* params) +{ + RESOLVE_FUNC_VOID_WITH_ALTERNATE(0, GetShaderiv, GetObjectParameteriv)(shader, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) +{ + RESOLVE_FUNC_VOID_WITH_ALTERNATE(0, GetShaderInfoLog, GetInfoLog)(shader, bufsize, length, infolog); +} + +static void QOPENGLF_APIENTRY qopenglfSpecialGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) +{ + Q_UNUSED(shadertype); + Q_UNUSED(precisiontype); + range[0] = range[1] = precision[0] = 0; +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) +{ + RESOLVE_FUNC_SPECIAL_VOID(ResolveOES | ResolveEXT, GetShaderPrecisionFormat)(shadertype, precisiontype, range, precision); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) +{ + RESOLVE_FUNC_VOID(0, GetShaderSource)(shader, bufsize, length, source); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetUniformfv(GLuint program, GLint location, GLfloat* params) +{ + RESOLVE_FUNC_VOID(0, GetUniformfv)(program, location, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetUniformiv(GLuint program, GLint location, GLint* params) +{ + RESOLVE_FUNC_VOID(0, GetUniformiv)(program, location, params); +} + +static GLint QOPENGLF_APIENTRY qopenglfResolveGetUniformLocation(GLuint program, const char* name) +{ + RESOLVE_FUNC(GLint, 0, GetUniformLocation)(program, name); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) +{ + RESOLVE_FUNC_VOID(0, GetVertexAttribfv)(index, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) +{ + RESOLVE_FUNC_VOID(0, GetVertexAttribiv)(index, pname, params); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) +{ + RESOLVE_FUNC_VOID(0, GetVertexAttribPointerv)(index, pname, pointer); +} + +static GLboolean QOPENGLF_APIENTRY qopenglfResolveIsBuffer(GLuint buffer) +{ + RESOLVE_FUNC(GLboolean, ResolveOES | ResolveEXT, IsBuffer)(buffer); +} + +static GLboolean QOPENGLF_APIENTRY qopenglfResolveIsFramebuffer(GLuint framebuffer) +{ + RESOLVE_FUNC(GLboolean, ResolveOES | ResolveEXT, IsFramebuffer)(framebuffer); +} + +static GLboolean QOPENGLF_APIENTRY qopenglfSpecialIsProgram(GLuint program) +{ + return program != 0; +} + +static GLboolean QOPENGLF_APIENTRY qopenglfResolveIsProgram(GLuint program) +{ + RESOLVE_FUNC_SPECIAL(GLboolean, 0, IsProgram)(program); +} + +static GLboolean QOPENGLF_APIENTRY qopenglfResolveIsRenderbuffer(GLuint renderbuffer) +{ + RESOLVE_FUNC(GLboolean, ResolveOES | ResolveEXT, IsRenderbuffer)(renderbuffer); +} + +static GLboolean QOPENGLF_APIENTRY qopenglfSpecialIsShader(GLuint shader) +{ + return shader != 0; +} + +static GLboolean QOPENGLF_APIENTRY qopenglfResolveIsShader(GLuint shader) +{ + RESOLVE_FUNC_SPECIAL(GLboolean, 0, IsShader)(shader); +} + +static void QOPENGLF_APIENTRY qopenglfResolveLinkProgram(GLuint program) +{ + RESOLVE_FUNC_VOID(0, LinkProgram)(program); +} + +static void QOPENGLF_APIENTRY qopenglfSpecialReleaseShaderCompiler() +{ +} + +static void QOPENGLF_APIENTRY qopenglfResolveReleaseShaderCompiler() +{ + RESOLVE_FUNC_SPECIAL_VOID(0, ReleaseShaderCompiler)(); +} + +static void QOPENGLF_APIENTRY qopenglfResolveRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, RenderbufferStorage)(target, internalformat, width, height); +} + +static void QOPENGLF_APIENTRY qopenglfResolveSampleCoverage(GLclampf value, GLboolean invert) +{ + RESOLVE_FUNC_VOID(ResolveOES | ResolveEXT, SampleCoverage)(value, invert); +} + +static void QOPENGLF_APIENTRY qopenglfResolveShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length) +{ + RESOLVE_FUNC_VOID(0, ShaderBinary)(n, shaders, binaryformat, binary, length); +} + +static void QOPENGLF_APIENTRY qopenglfResolveShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) +{ + RESOLVE_FUNC_VOID(0, ShaderSource)(shader, count, string, length); +} + +static void QOPENGLF_APIENTRY qopenglfResolveStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) +{ + RESOLVE_FUNC_VOID(ResolveEXT, StencilFuncSeparate)(face, func, ref, mask); +} + +static void QOPENGLF_APIENTRY qopenglfResolveStencilMaskSeparate(GLenum face, GLuint mask) +{ + RESOLVE_FUNC_VOID(ResolveEXT, StencilMaskSeparate)(face, mask); +} + +static void QOPENGLF_APIENTRY qopenglfResolveStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +{ + RESOLVE_FUNC_VOID(ResolveEXT, StencilOpSeparate)(face, fail, zfail, zpass); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform1f(GLint location, GLfloat x) +{ + RESOLVE_FUNC_VOID(0, Uniform1f)(location, x); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform1fv(GLint location, GLsizei count, const GLfloat* v) +{ + RESOLVE_FUNC_VOID(0, Uniform1fv)(location, count, v); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform1i(GLint location, GLint x) +{ + RESOLVE_FUNC_VOID(0, Uniform1i)(location, x); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform1iv(GLint location, GLsizei count, const GLint* v) +{ + RESOLVE_FUNC_VOID(0, Uniform1iv)(location, count, v); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform2f(GLint location, GLfloat x, GLfloat y) +{ + RESOLVE_FUNC_VOID(0, Uniform2f)(location, x, y); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform2fv(GLint location, GLsizei count, const GLfloat* v) +{ + RESOLVE_FUNC_VOID(0, Uniform2fv)(location, count, v); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform2i(GLint location, GLint x, GLint y) +{ + RESOLVE_FUNC_VOID(0, Uniform2i)(location, x, y); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform2iv(GLint location, GLsizei count, const GLint* v) +{ + RESOLVE_FUNC_VOID(0, Uniform2iv)(location, count, v); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) +{ + RESOLVE_FUNC_VOID(0, Uniform3f)(location, x, y, z); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform3fv(GLint location, GLsizei count, const GLfloat* v) +{ + RESOLVE_FUNC_VOID(0, Uniform3fv)(location, count, v); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform3i(GLint location, GLint x, GLint y, GLint z) +{ + RESOLVE_FUNC_VOID(0, Uniform3i)(location, x, y, z); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform3iv(GLint location, GLsizei count, const GLint* v) +{ + RESOLVE_FUNC_VOID(0, Uniform3iv)(location, count, v); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + RESOLVE_FUNC_VOID(0, Uniform4f)(location, x, y, z, w); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform4fv(GLint location, GLsizei count, const GLfloat* v) +{ + RESOLVE_FUNC_VOID(0, Uniform4fv)(location, count, v); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) +{ + RESOLVE_FUNC_VOID(0, Uniform4i)(location, x, y, z, w); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniform4iv(GLint location, GLsizei count, const GLint* v) +{ + RESOLVE_FUNC_VOID(0, Uniform4iv)(location, count, v); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + RESOLVE_FUNC_VOID(0, UniformMatrix2fv)(location, count, transpose, value); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + RESOLVE_FUNC_VOID(0, UniformMatrix3fv)(location, count, transpose, value); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + RESOLVE_FUNC_VOID(0, UniformMatrix4fv)(location, count, transpose, value); +} + +static void QOPENGLF_APIENTRY qopenglfResolveUseProgram(GLuint program) +{ + RESOLVE_FUNC_VOID(0, UseProgram)(program); +} + +static void QOPENGLF_APIENTRY qopenglfResolveValidateProgram(GLuint program) +{ + RESOLVE_FUNC_VOID(0, ValidateProgram)(program); +} + +static void QOPENGLF_APIENTRY qopenglfResolveVertexAttrib1f(GLuint indx, GLfloat x) +{ + RESOLVE_FUNC_VOID(0, VertexAttrib1f)(indx, x); +} + +static void QOPENGLF_APIENTRY qopenglfResolveVertexAttrib1fv(GLuint indx, const GLfloat* values) +{ + RESOLVE_FUNC_VOID(0, VertexAttrib1fv)(indx, values); +} + +static void QOPENGLF_APIENTRY qopenglfResolveVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) +{ + RESOLVE_FUNC_VOID(0, VertexAttrib2f)(indx, x, y); +} + +static void QOPENGLF_APIENTRY qopenglfResolveVertexAttrib2fv(GLuint indx, const GLfloat* values) +{ + RESOLVE_FUNC_VOID(0, VertexAttrib2fv)(indx, values); +} + +static void QOPENGLF_APIENTRY qopenglfResolveVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) +{ + RESOLVE_FUNC_VOID(0, VertexAttrib3f)(indx, x, y, z); +} + +static void QOPENGLF_APIENTRY qopenglfResolveVertexAttrib3fv(GLuint indx, const GLfloat* values) +{ + RESOLVE_FUNC_VOID(0, VertexAttrib3fv)(indx, values); +} + +static void QOPENGLF_APIENTRY qopenglfResolveVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + RESOLVE_FUNC_VOID(0, VertexAttrib4f)(indx, x, y, z, w); +} + +static void QOPENGLF_APIENTRY qopenglfResolveVertexAttrib4fv(GLuint indx, const GLfloat* values) +{ + RESOLVE_FUNC_VOID(0, VertexAttrib4fv)(indx, values); +} + +static void QOPENGLF_APIENTRY qopenglfResolveVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) +{ + RESOLVE_FUNC_VOID(0, VertexAttribPointer)(indx, size, type, normalized, stride, ptr); +} + +#endif // !QT_OPENGL_ES_2 + +static GLvoid *QOPENGLF_APIENTRY qopenglfResolveMapBuffer(GLenum target, GLenum access) +{ + RESOLVE_FUNC(GLvoid *, ResolveOES, MapBuffer)(target, access); +} + +static GLboolean QOPENGLF_APIENTRY qopenglfResolveUnmapBuffer(GLenum target) +{ + RESOLVE_FUNC(GLboolean, ResolveOES, UnmapBuffer)(target); +} + +static void QOPENGLF_APIENTRY qopenglfResolveBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) +{ + RESOLVE_FUNC_VOID(ResolveEXT, BlitFramebuffer) + (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); +} + +static void QOPENGLF_APIENTRY qopenglfResolveRenderbufferStorageMultisample(GLenum target, GLsizei samples, + GLenum internalFormat, + GLsizei width, GLsizei height) +{ + RESOLVE_FUNC_VOID(ResolveEXT, RenderbufferStorageMultisample) + (target, samples, internalFormat, width, height); +} + +static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data) +{ + RESOLVE_FUNC_VOID(ResolveEXT, GetBufferSubData) + (target, offset, size, data); +} + +QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *) +{ +#ifndef QT_OPENGL_ES_2 + ActiveTexture = qopenglfResolveActiveTexture; + AttachShader = qopenglfResolveAttachShader; + BindAttribLocation = qopenglfResolveBindAttribLocation; + BindBuffer = qopenglfResolveBindBuffer; + BindFramebuffer = qopenglfResolveBindFramebuffer; + BindRenderbuffer = qopenglfResolveBindRenderbuffer; + BlendColor = qopenglfResolveBlendColor; + BlendEquation = qopenglfResolveBlendEquation; + BlendEquationSeparate = qopenglfResolveBlendEquationSeparate; + BlendFuncSeparate = qopenglfResolveBlendFuncSeparate; + BufferData = qopenglfResolveBufferData; + BufferSubData = qopenglfResolveBufferSubData; + CheckFramebufferStatus = qopenglfResolveCheckFramebufferStatus; + CompileShader = qopenglfResolveCompileShader; + CompressedTexImage2D = qopenglfResolveCompressedTexImage2D; + CompressedTexSubImage2D = qopenglfResolveCompressedTexSubImage2D; + CreateProgram = qopenglfResolveCreateProgram; + CreateShader = qopenglfResolveCreateShader; + DeleteBuffers = qopenglfResolveDeleteBuffers; + DeleteFramebuffers = qopenglfResolveDeleteFramebuffers; + DeleteProgram = qopenglfResolveDeleteProgram; + DeleteRenderbuffers = qopenglfResolveDeleteRenderbuffers; + DeleteShader = qopenglfResolveDeleteShader; + DetachShader = qopenglfResolveDetachShader; + DisableVertexAttribArray = qopenglfResolveDisableVertexAttribArray; + EnableVertexAttribArray = qopenglfResolveEnableVertexAttribArray; + FramebufferRenderbuffer = qopenglfResolveFramebufferRenderbuffer; + FramebufferTexture2D = qopenglfResolveFramebufferTexture2D; + GenBuffers = qopenglfResolveGenBuffers; + GenerateMipmap = qopenglfResolveGenerateMipmap; + GenFramebuffers = qopenglfResolveGenFramebuffers; + GenRenderbuffers = qopenglfResolveGenRenderbuffers; + GetActiveAttrib = qopenglfResolveGetActiveAttrib; + GetActiveUniform = qopenglfResolveGetActiveUniform; + GetAttachedShaders = qopenglfResolveGetAttachedShaders; + GetAttribLocation = qopenglfResolveGetAttribLocation; + GetBufferParameteriv = qopenglfResolveGetBufferParameteriv; + GetFramebufferAttachmentParameteriv = qopenglfResolveGetFramebufferAttachmentParameteriv; + GetProgramiv = qopenglfResolveGetProgramiv; + GetProgramInfoLog = qopenglfResolveGetProgramInfoLog; + GetRenderbufferParameteriv = qopenglfResolveGetRenderbufferParameteriv; + GetShaderiv = qopenglfResolveGetShaderiv; + GetShaderInfoLog = qopenglfResolveGetShaderInfoLog; + GetShaderPrecisionFormat = qopenglfResolveGetShaderPrecisionFormat; + GetShaderSource = qopenglfResolveGetShaderSource; + GetUniformfv = qopenglfResolveGetUniformfv; + GetUniformiv = qopenglfResolveGetUniformiv; + GetUniformLocation = qopenglfResolveGetUniformLocation; + GetVertexAttribfv = qopenglfResolveGetVertexAttribfv; + GetVertexAttribiv = qopenglfResolveGetVertexAttribiv; + GetVertexAttribPointerv = qopenglfResolveGetVertexAttribPointerv; + IsBuffer = qopenglfResolveIsBuffer; + IsFramebuffer = qopenglfResolveIsFramebuffer; + IsProgram = qopenglfResolveIsProgram; + IsRenderbuffer = qopenglfResolveIsRenderbuffer; + IsShader = qopenglfResolveIsShader; + LinkProgram = qopenglfResolveLinkProgram; + ReleaseShaderCompiler = qopenglfResolveReleaseShaderCompiler; + RenderbufferStorage = qopenglfResolveRenderbufferStorage; + SampleCoverage = qopenglfResolveSampleCoverage; + ShaderBinary = qopenglfResolveShaderBinary; + ShaderSource = qopenglfResolveShaderSource; + StencilFuncSeparate = qopenglfResolveStencilFuncSeparate; + StencilMaskSeparate = qopenglfResolveStencilMaskSeparate; + StencilOpSeparate = qopenglfResolveStencilOpSeparate; + Uniform1f = qopenglfResolveUniform1f; + Uniform1fv = qopenglfResolveUniform1fv; + Uniform1i = qopenglfResolveUniform1i; + Uniform1iv = qopenglfResolveUniform1iv; + Uniform2f = qopenglfResolveUniform2f; + Uniform2fv = qopenglfResolveUniform2fv; + Uniform2i = qopenglfResolveUniform2i; + Uniform2iv = qopenglfResolveUniform2iv; + Uniform3f = qopenglfResolveUniform3f; + Uniform3fv = qopenglfResolveUniform3fv; + Uniform3i = qopenglfResolveUniform3i; + Uniform3iv = qopenglfResolveUniform3iv; + Uniform4f = qopenglfResolveUniform4f; + Uniform4fv = qopenglfResolveUniform4fv; + Uniform4i = qopenglfResolveUniform4i; + Uniform4iv = qopenglfResolveUniform4iv; + UniformMatrix2fv = qopenglfResolveUniformMatrix2fv; + UniformMatrix3fv = qopenglfResolveUniformMatrix3fv; + UniformMatrix4fv = qopenglfResolveUniformMatrix4fv; + UseProgram = qopenglfResolveUseProgram; + ValidateProgram = qopenglfResolveValidateProgram; + VertexAttrib1f = qopenglfResolveVertexAttrib1f; + VertexAttrib1fv = qopenglfResolveVertexAttrib1fv; + VertexAttrib2f = qopenglfResolveVertexAttrib2f; + VertexAttrib2fv = qopenglfResolveVertexAttrib2fv; + VertexAttrib3f = qopenglfResolveVertexAttrib3f; + VertexAttrib3fv = qopenglfResolveVertexAttrib3fv; + VertexAttrib4f = qopenglfResolveVertexAttrib4f; + VertexAttrib4fv = qopenglfResolveVertexAttrib4fv; + VertexAttribPointer = qopenglfResolveVertexAttribPointer; +#endif // !QT_OPENGL_ES_2 +} + +QOpenGLExtensionsPrivate::QOpenGLExtensionsPrivate(QOpenGLContext *ctx) + : QOpenGLFunctionsPrivate(ctx) +{ + MapBuffer = qopenglfResolveMapBuffer; + UnmapBuffer = qopenglfResolveUnmapBuffer; + BlitFramebuffer = qopenglfResolveBlitFramebuffer; + RenderbufferStorageMultisample = qopenglfResolveRenderbufferStorageMultisample; + GetBufferSubData = qopenglfResolveGetBufferSubData; +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h new file mode 100644 index 00000000000..d3bd580fc7a --- /dev/null +++ b/src/gui/opengl/qopenglfunctions.h @@ -0,0 +1,2427 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENGLFUNCTIONS_H +#define QOPENGLFUNCTIONS_H + +#ifdef __GLEW_H__ +#warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined +#warning To use GLEW with Qt, do not include or after glew.h +#endif + +#include +#include + +//#define Q_ENABLE_OPENGL_FUNCTIONS_DEBUG + +#ifdef Q_ENABLE_OPENGL_FUNCTIONS_DEBUG +#include +#define Q_OPENGL_FUNCTIONS_DEBUG \ + GLenum error = glGetError(); \ + if (error != GL_NO_ERROR) { \ + unsigned clamped = qMin(unsigned(error - GL_INVALID_ENUM), 4U); \ + const char *errors[] = { "GL_INVALID_ENUM", "GL_INVALID_VALUE", "GL_INVALID_OPERATION", "Unknown" }; \ + printf("GL error at %s:%d: %s\n", __FILE__, __LINE__, errors[clamped]); \ + int *value = 0; \ + *value = 0; \ + } +#else +#define Q_OPENGL_FUNCTIONS_DEBUG +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +// Types that aren't defined in all system's gl.h files. +typedef ptrdiff_t qopengl_GLintptr; +typedef ptrdiff_t qopengl_GLsizeiptr; + +#ifdef Q_WS_WIN +# define QOPENGLF_APIENTRY APIENTRY +#endif + +#ifndef Q_WS_MAC +# ifndef QOPENGLF_APIENTRYP +# ifdef QOPENGLF_APIENTRY +# define QOPENGLF_APIENTRYP QOPENGLF_APIENTRY * +# else +# define QOPENGLF_APIENTRY +# define QOPENGLF_APIENTRYP * +# endif +# endif +#else +# define QOPENGLF_APIENTRY +# define QOPENGLF_APIENTRYP * +#endif + +struct QOpenGLFunctionsPrivate; + +// Undefine any macros from GLEW, qopenglextensions_p.h, etc that +// may interfere with the definition of QOpenGLFunctions. +#undef glActiveTexture +#undef glAttachShader +#undef glBindAttribLocation +#undef glBindBuffer +#undef glBindFramebuffer +#undef glBindRenderbuffer +#undef glBlendColor +#undef glBlendEquation +#undef glBlendEquationSeparate +#undef glBlendFuncSeparate +#undef glBufferData +#undef glBufferSubData +#undef glCheckFramebufferStatus +#undef glClearDepthf +#undef glCompileShader +#undef glCompressedTexImage2D +#undef glCompressedTexSubImage2D +#undef glCreateProgram +#undef glCreateShader +#undef glDeleteBuffers +#undef glDeleteFramebuffers +#undef glDeleteProgram +#undef glDeleteRenderbuffers +#undef glDeleteShader +#undef glDepthRangef +#undef glDetachShader +#undef glDisableVertexAttribArray +#undef glEnableVertexAttribArray +#undef glFramebufferRenderbuffer +#undef glFramebufferTexture2D +#undef glGenBuffers +#undef glGenerateMipmap +#undef glGenFramebuffers +#undef glGenRenderbuffers +#undef glGetActiveAttrib +#undef glGetActiveUniform +#undef glGetAttachedShaders +#undef glGetAttribLocation +#undef glGetBufferParameteriv +#undef glGetFramebufferAttachmentParameteriv +#undef glGetProgramiv +#undef glGetProgramInfoLog +#undef glGetRenderbufferParameteriv +#undef glGetShaderiv +#undef glGetShaderInfoLog +#undef glGetShaderPrecisionFormat +#undef glGetShaderSource +#undef glGetUniformfv +#undef glGetUniformiv +#undef glGetUniformLocation +#undef glGetVertexAttribfv +#undef glGetVertexAttribiv +#undef glGetVertexAttribPointerv +#undef glIsBuffer +#undef glIsFramebuffer +#undef glIsProgram +#undef glIsRenderbuffer +#undef glIsShader +#undef glLinkProgram +#undef glReleaseShaderCompiler +#undef glRenderbufferStorage +#undef glSampleCoverage +#undef glShaderBinary +#undef glShaderSource +#undef glStencilFuncSeparate +#undef glStencilMaskSeparate +#undef glStencilOpSeparate +#undef glUniform1f +#undef glUniform1fv +#undef glUniform1i +#undef glUniform1iv +#undef glUniform2f +#undef glUniform2fv +#undef glUniform2i +#undef glUniform2iv +#undef glUniform3f +#undef glUniform3fv +#undef glUniform3i +#undef glUniform3iv +#undef glUniform4f +#undef glUniform4fv +#undef glUniform4i +#undef glUniform4iv +#undef glUniformMatrix2fv +#undef glUniformMatrix3fv +#undef glUniformMatrix4fv +#undef glUseProgram +#undef glValidateProgram +#undef glVertexAttrib1f +#undef glVertexAttrib1fv +#undef glVertexAttrib2f +#undef glVertexAttrib2fv +#undef glVertexAttrib3f +#undef glVertexAttrib3fv +#undef glVertexAttrib4f +#undef glVertexAttrib4fv +#undef glVertexAttribPointer + +class Q_GUI_EXPORT QOpenGLFunctions +{ +public: + QOpenGLFunctions(); + QOpenGLFunctions(QOpenGLContext *context); + ~QOpenGLFunctions() {} + + enum OpenGLFeature + { + Multitexture = 0x0001, + Shaders = 0x0002, + Buffers = 0x0004, + Framebuffers = 0x0008, + BlendColor = 0x0010, + BlendEquation = 0x0020, + BlendEquationSeparate = 0x0040, + BlendFuncSeparate = 0x0080, + BlendSubtract = 0x0100, + CompressedTextures = 0x0200, + Multisample = 0x0400, + StencilSeparate = 0x0800, + NPOTTextures = 0x1000 + }; + Q_DECLARE_FLAGS(OpenGLFeatures, OpenGLFeature) + + QOpenGLFunctions::OpenGLFeatures openGLFeatures() const; + bool hasOpenGLFeature(QOpenGLFunctions::OpenGLFeature feature) const; + + void initializeGLFunctions(); + + void glActiveTexture(GLenum texture); + void glAttachShader(GLuint program, GLuint shader); + void glBindAttribLocation(GLuint program, GLuint index, const char* name); + void glBindBuffer(GLenum target, GLuint buffer); + void glBindFramebuffer(GLenum target, GLuint framebuffer); + void glBindRenderbuffer(GLenum target, GLuint renderbuffer); + void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void glBlendEquation(GLenum mode); + void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); + void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); + void glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage); + void glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data); + GLenum glCheckFramebufferStatus(GLenum target); + void glClearDepthf(GLclampf depth); + void glCompileShader(GLuint shader); + void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); + void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data); + GLuint glCreateProgram(); + GLuint glCreateShader(GLenum type); + void glDeleteBuffers(GLsizei n, const GLuint* buffers); + void glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers); + void glDeleteProgram(GLuint program); + void glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers); + void glDeleteShader(GLuint shader); + void glDepthRangef(GLclampf zNear, GLclampf zFar); + void glDetachShader(GLuint program, GLuint shader); + void glDisableVertexAttribArray(GLuint index); + void glEnableVertexAttribArray(GLuint index); + void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); + void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); + void glGenBuffers(GLsizei n, GLuint* buffers); + void glGenerateMipmap(GLenum target); + void glGenFramebuffers(GLsizei n, GLuint* framebuffers); + void glGenRenderbuffers(GLsizei n, GLuint* renderbuffers); + void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); + void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); + void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); + GLint glGetAttribLocation(GLuint program, const char* name); + void glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params); + void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params); + void glGetProgramiv(GLuint program, GLenum pname, GLint* params); + void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog); + void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params); + void glGetShaderiv(GLuint shader, GLenum pname, GLint* params); + void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog); + void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); + void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source); + void glGetUniformfv(GLuint program, GLint location, GLfloat* params); + void glGetUniformiv(GLuint program, GLint location, GLint* params); + GLint glGetUniformLocation(GLuint program, const char* name); + void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params); + void glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params); + void glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer); + GLboolean glIsBuffer(GLuint buffer); + GLboolean glIsFramebuffer(GLuint framebuffer); + GLboolean glIsProgram(GLuint program); + GLboolean glIsRenderbuffer(GLuint renderbuffer); + GLboolean glIsShader(GLuint shader); + void glLinkProgram(GLuint program); + void glReleaseShaderCompiler(); + void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + void glSampleCoverage(GLclampf value, GLboolean invert); + void glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length); + void glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length); + void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + void glStencilMaskSeparate(GLenum face, GLuint mask); + void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + void glUniform1f(GLint location, GLfloat x); + void glUniform1fv(GLint location, GLsizei count, const GLfloat* v); + void glUniform1i(GLint location, GLint x); + void glUniform1iv(GLint location, GLsizei count, const GLint* v); + void glUniform2f(GLint location, GLfloat x, GLfloat y); + void glUniform2fv(GLint location, GLsizei count, const GLfloat* v); + void glUniform2i(GLint location, GLint x, GLint y); + void glUniform2iv(GLint location, GLsizei count, const GLint* v); + void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z); + void glUniform3fv(GLint location, GLsizei count, const GLfloat* v); + void glUniform3i(GLint location, GLint x, GLint y, GLint z); + void glUniform3iv(GLint location, GLsizei count, const GLint* v); + void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glUniform4fv(GLint location, GLsizei count, const GLfloat* v); + void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w); + void glUniform4iv(GLint location, GLsizei count, const GLint* v); + void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); + void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); + void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); + void glUseProgram(GLuint program); + void glValidateProgram(GLuint program); + void glVertexAttrib1f(GLuint indx, GLfloat x); + void glVertexAttrib1fv(GLuint indx, const GLfloat* values); + void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); + void glVertexAttrib2fv(GLuint indx, const GLfloat* values); + void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); + void glVertexAttrib3fv(GLuint indx, const GLfloat* values); + void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glVertexAttrib4fv(GLuint indx, const GLfloat* values); + void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); + +protected: + QOpenGLFunctionsPrivate *d_ptr; + static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; } +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLFunctions::OpenGLFeatures) + +struct QOpenGLFunctionsPrivate +{ + QOpenGLFunctionsPrivate(QOpenGLContext *ctx); + +#ifndef QT_OPENGL_ES_2 + void (QOPENGLF_APIENTRYP ActiveTexture)(GLenum texture); + void (QOPENGLF_APIENTRYP AttachShader)(GLuint program, GLuint shader); + void (QOPENGLF_APIENTRYP BindAttribLocation)(GLuint program, GLuint index, const char* name); + void (QOPENGLF_APIENTRYP BindBuffer)(GLenum target, GLuint buffer); + void (QOPENGLF_APIENTRYP BindFramebuffer)(GLenum target, GLuint framebuffer); + void (QOPENGLF_APIENTRYP BindRenderbuffer)(GLenum target, GLuint renderbuffer); + void (QOPENGLF_APIENTRYP BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void (QOPENGLF_APIENTRYP BlendEquation)(GLenum mode); + void (QOPENGLF_APIENTRYP BlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha); + void (QOPENGLF_APIENTRYP BlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); + void (QOPENGLF_APIENTRYP BufferData)(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage); + void (QOPENGLF_APIENTRYP BufferSubData)(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data); + GLenum (QOPENGLF_APIENTRYP CheckFramebufferStatus)(GLenum target); + void (QOPENGLF_APIENTRYP CompileShader)(GLuint shader); + void (QOPENGLF_APIENTRYP CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); + void (QOPENGLF_APIENTRYP CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data); + GLuint (QOPENGLF_APIENTRYP CreateProgram)(); + GLuint (QOPENGLF_APIENTRYP CreateShader)(GLenum type); + void (QOPENGLF_APIENTRYP DeleteBuffers)(GLsizei n, const GLuint* buffers); + void (QOPENGLF_APIENTRYP DeleteFramebuffers)(GLsizei n, const GLuint* framebuffers); + void (QOPENGLF_APIENTRYP DeleteProgram)(GLuint program); + void (QOPENGLF_APIENTRYP DeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers); + void (QOPENGLF_APIENTRYP DeleteShader)(GLuint shader); + void (QOPENGLF_APIENTRYP DetachShader)(GLuint program, GLuint shader); + void (QOPENGLF_APIENTRYP DisableVertexAttribArray)(GLuint index); + void (QOPENGLF_APIENTRYP EnableVertexAttribArray)(GLuint index); + void (QOPENGLF_APIENTRYP FramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); + void (QOPENGLF_APIENTRYP FramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); + void (QOPENGLF_APIENTRYP GenBuffers)(GLsizei n, GLuint* buffers); + void (QOPENGLF_APIENTRYP GenerateMipmap)(GLenum target); + void (QOPENGLF_APIENTRYP GenFramebuffers)(GLsizei n, GLuint* framebuffers); + void (QOPENGLF_APIENTRYP GenRenderbuffers)(GLsizei n, GLuint* renderbuffers); + void (QOPENGLF_APIENTRYP GetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); + void (QOPENGLF_APIENTRYP GetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); + void (QOPENGLF_APIENTRYP GetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); + GLint (QOPENGLF_APIENTRYP GetAttribLocation)(GLuint program, const char* name); + void (QOPENGLF_APIENTRYP GetBufferParameteriv)(GLenum target, GLenum pname, GLint* params); + void (QOPENGLF_APIENTRYP GetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params); + void (QOPENGLF_APIENTRYP GetProgramiv)(GLuint program, GLenum pname, GLint* params); + void (QOPENGLF_APIENTRYP GetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog); + void (QOPENGLF_APIENTRYP GetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params); + void (QOPENGLF_APIENTRYP GetShaderiv)(GLuint shader, GLenum pname, GLint* params); + void (QOPENGLF_APIENTRYP GetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog); + void (QOPENGLF_APIENTRYP GetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); + void (QOPENGLF_APIENTRYP GetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, char* source); + void (QOPENGLF_APIENTRYP GetUniformfv)(GLuint program, GLint location, GLfloat* params); + void (QOPENGLF_APIENTRYP GetUniformiv)(GLuint program, GLint location, GLint* params); + GLint (QOPENGLF_APIENTRYP GetUniformLocation)(GLuint program, const char* name); + void (QOPENGLF_APIENTRYP GetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params); + void (QOPENGLF_APIENTRYP GetVertexAttribiv)(GLuint index, GLenum pname, GLint* params); + void (QOPENGLF_APIENTRYP GetVertexAttribPointerv)(GLuint index, GLenum pname, void** pointer); + GLboolean (QOPENGLF_APIENTRYP IsBuffer)(GLuint buffer); + GLboolean (QOPENGLF_APIENTRYP IsFramebuffer)(GLuint framebuffer); + GLboolean (QOPENGLF_APIENTRYP IsProgram)(GLuint program); + GLboolean (QOPENGLF_APIENTRYP IsRenderbuffer)(GLuint renderbuffer); + GLboolean (QOPENGLF_APIENTRYP IsShader)(GLuint shader); + void (QOPENGLF_APIENTRYP LinkProgram)(GLuint program); + void (QOPENGLF_APIENTRYP ReleaseShaderCompiler)(); + void (QOPENGLF_APIENTRYP RenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + void (QOPENGLF_APIENTRYP SampleCoverage)(GLclampf value, GLboolean invert); + void (QOPENGLF_APIENTRYP ShaderBinary)(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length); + void (QOPENGLF_APIENTRYP ShaderSource)(GLuint shader, GLsizei count, const char** string, const GLint* length); + void (QOPENGLF_APIENTRYP StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); + void (QOPENGLF_APIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); + void (QOPENGLF_APIENTRYP StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + void (QOPENGLF_APIENTRYP Uniform1f)(GLint location, GLfloat x); + void (QOPENGLF_APIENTRYP Uniform1fv)(GLint location, GLsizei count, const GLfloat* v); + void (QOPENGLF_APIENTRYP Uniform1i)(GLint location, GLint x); + void (QOPENGLF_APIENTRYP Uniform1iv)(GLint location, GLsizei count, const GLint* v); + void (QOPENGLF_APIENTRYP Uniform2f)(GLint location, GLfloat x, GLfloat y); + void (QOPENGLF_APIENTRYP Uniform2fv)(GLint location, GLsizei count, const GLfloat* v); + void (QOPENGLF_APIENTRYP Uniform2i)(GLint location, GLint x, GLint y); + void (QOPENGLF_APIENTRYP Uniform2iv)(GLint location, GLsizei count, const GLint* v); + void (QOPENGLF_APIENTRYP Uniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z); + void (QOPENGLF_APIENTRYP Uniform3fv)(GLint location, GLsizei count, const GLfloat* v); + void (QOPENGLF_APIENTRYP Uniform3i)(GLint location, GLint x, GLint y, GLint z); + void (QOPENGLF_APIENTRYP Uniform3iv)(GLint location, GLsizei count, const GLint* v); + void (QOPENGLF_APIENTRYP Uniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (QOPENGLF_APIENTRYP Uniform4fv)(GLint location, GLsizei count, const GLfloat* v); + void (QOPENGLF_APIENTRYP Uniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w); + void (QOPENGLF_APIENTRYP Uniform4iv)(GLint location, GLsizei count, const GLint* v); + void (QOPENGLF_APIENTRYP UniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); + void (QOPENGLF_APIENTRYP UniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); + void (QOPENGLF_APIENTRYP UniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); + void (QOPENGLF_APIENTRYP UseProgram)(GLuint program); + void (QOPENGLF_APIENTRYP ValidateProgram)(GLuint program); + void (QOPENGLF_APIENTRYP VertexAttrib1f)(GLuint indx, GLfloat x); + void (QOPENGLF_APIENTRYP VertexAttrib1fv)(GLuint indx, const GLfloat* values); + void (QOPENGLF_APIENTRYP VertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y); + void (QOPENGLF_APIENTRYP VertexAttrib2fv)(GLuint indx, const GLfloat* values); + void (QOPENGLF_APIENTRYP VertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z); + void (QOPENGLF_APIENTRYP VertexAttrib3fv)(GLuint indx, const GLfloat* values); + void (QOPENGLF_APIENTRYP VertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (QOPENGLF_APIENTRYP VertexAttrib4fv)(GLuint indx, const GLfloat* values); + void (QOPENGLF_APIENTRYP VertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); +#endif +}; + +inline void QOpenGLFunctions::glActiveTexture(GLenum texture) +{ +#if defined(QT_OPENGL_ES_2) + ::glActiveTexture(texture); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->ActiveTexture(texture); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glAttachShader(GLuint program, GLuint shader) +{ +#if defined(QT_OPENGL_ES_2) + ::glAttachShader(program, shader); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->AttachShader(program, shader); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBindAttribLocation(GLuint program, GLuint index, const char* name) +{ +#if defined(QT_OPENGL_ES_2) + ::glBindAttribLocation(program, index, name); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BindAttribLocation(program, index, name); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBindBuffer(GLenum target, GLuint buffer) +{ +#if defined(QT_OPENGL_ES_2) + ::glBindBuffer(target, buffer); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BindBuffer(target, buffer); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffer) +{ +#if defined(QT_OPENGL_ES_2) + ::glBindFramebuffer(target, framebuffer); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BindFramebuffer(target, framebuffer); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBindRenderbuffer(GLenum target, GLuint renderbuffer) +{ +#if defined(QT_OPENGL_ES_2) + ::glBindRenderbuffer(target, renderbuffer); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BindRenderbuffer(target, renderbuffer); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ +#if defined(QT_OPENGL_ES_2) + ::glBlendColor(red, green, blue, alpha); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BlendColor(red, green, blue, alpha); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBlendEquation(GLenum mode) +{ +#if defined(QT_OPENGL_ES_2) + ::glBlendEquation(mode); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BlendEquation(mode); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) +{ +#if defined(QT_OPENGL_ES_2) + ::glBlendEquationSeparate(modeRGB, modeAlpha); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BlendEquationSeparate(modeRGB, modeAlpha); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) +{ +#if defined(QT_OPENGL_ES_2) + ::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBufferData(GLenum target, qopengl_GLsizeiptr size, const void* data, GLenum usage) +{ +#if defined(QT_OPENGL_ES_2) + ::glBufferData(target, size, data, usage); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BufferData(target, size, data, usage); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, const void* data) +{ +#if defined(QT_OPENGL_ES_2) + ::glBufferSubData(target, offset, size, data); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->BufferSubData(target, offset, size, data); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline GLenum QOpenGLFunctions::glCheckFramebufferStatus(GLenum target) +{ +#if defined(QT_OPENGL_ES_2) + GLenum result = ::glCheckFramebufferStatus(target); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLenum result = d_ptr->CheckFramebufferStatus(target); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline void QOpenGLFunctions::glClearDepthf(GLclampf depth) +{ +#ifndef QT_OPENGL_ES + ::glClearDepth(depth); +#else + ::glClearDepthf(depth); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glCompileShader(GLuint shader) +{ +#if defined(QT_OPENGL_ES_2) + ::glCompileShader(shader); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->CompileShader(shader); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) +{ +#if defined(QT_OPENGL_ES_2) + ::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) +{ +#if defined(QT_OPENGL_ES_2) + ::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline GLuint QOpenGLFunctions::glCreateProgram() +{ +#if defined(QT_OPENGL_ES_2) + GLuint result = ::glCreateProgram(); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLuint result = d_ptr->CreateProgram(); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline GLuint QOpenGLFunctions::glCreateShader(GLenum type) +{ +#if defined(QT_OPENGL_ES_2) + GLuint result = ::glCreateShader(type); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLuint result = d_ptr->CreateShader(type); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline void QOpenGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers) +{ +#if defined(QT_OPENGL_ES_2) + ::glDeleteBuffers(n, buffers); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DeleteBuffers(n, buffers); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) +{ +#if defined(QT_OPENGL_ES_2) + ::glDeleteFramebuffers(n, framebuffers); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DeleteFramebuffers(n, framebuffers); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDeleteProgram(GLuint program) +{ +#if defined(QT_OPENGL_ES_2) + ::glDeleteProgram(program); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DeleteProgram(program); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) +{ +#if defined(QT_OPENGL_ES_2) + ::glDeleteRenderbuffers(n, renderbuffers); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DeleteRenderbuffers(n, renderbuffers); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDeleteShader(GLuint shader) +{ +#if defined(QT_OPENGL_ES_2) + ::glDeleteShader(shader); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DeleteShader(shader); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDepthRangef(GLclampf zNear, GLclampf zFar) +{ +#ifndef QT_OPENGL_ES + ::glDepthRange(zNear, zFar); +#else + ::glDepthRangef(zNear, zFar); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDetachShader(GLuint program, GLuint shader) +{ +#if defined(QT_OPENGL_ES_2) + ::glDetachShader(program, shader); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DetachShader(program, shader); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glDisableVertexAttribArray(GLuint index) +{ +#if defined(QT_OPENGL_ES_2) + ::glDisableVertexAttribArray(index); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->DisableVertexAttribArray(index); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glEnableVertexAttribArray(GLuint index) +{ +#if defined(QT_OPENGL_ES_2) + ::glEnableVertexAttribArray(index); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->EnableVertexAttribArray(index); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) +{ +#if defined(QT_OPENGL_ES_2) + ::glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ +#if defined(QT_OPENGL_ES_2) + ::glFramebufferTexture2D(target, attachment, textarget, texture, level); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->FramebufferTexture2D(target, attachment, textarget, texture, level); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers) +{ +#if defined(QT_OPENGL_ES_2) + ::glGenBuffers(n, buffers); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GenBuffers(n, buffers); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGenerateMipmap(GLenum target) +{ +#if defined(QT_OPENGL_ES_2) + ::glGenerateMipmap(target); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GenerateMipmap(target); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGenFramebuffers(GLsizei n, GLuint* framebuffers) +{ +#if defined(QT_OPENGL_ES_2) + ::glGenFramebuffers(n, framebuffers); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GenFramebuffers(n, framebuffers); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) +{ +#if defined(QT_OPENGL_ES_2) + ::glGenRenderbuffers(n, renderbuffers); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GenRenderbuffers(n, renderbuffers); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetActiveAttrib(program, index, bufsize, length, size, type, name); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetActiveAttrib(program, index, bufsize, length, size, type, name); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetActiveUniform(program, index, bufsize, length, size, type, name); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetActiveUniform(program, index, bufsize, length, size, type, name); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetAttachedShaders(program, maxcount, count, shaders); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetAttachedShaders(program, maxcount, count, shaders); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline GLint QOpenGLFunctions::glGetAttribLocation(GLuint program, const char* name) +{ +#if defined(QT_OPENGL_ES_2) + GLint result = ::glGetAttribLocation(program, name); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLint result = d_ptr->GetAttribLocation(program, name); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline void QOpenGLFunctions::glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetBufferParameteriv(target, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetBufferParameteriv(target, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetFramebufferAttachmentParameteriv(target, attachment, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetProgramiv(GLuint program, GLenum pname, GLint* params) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetProgramiv(program, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetProgramiv(program, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetProgramInfoLog(program, bufsize, length, infolog); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetProgramInfoLog(program, bufsize, length, infolog); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetRenderbufferParameteriv(target, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetRenderbufferParameteriv(target, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetShaderiv(GLuint shader, GLenum pname, GLint* params) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetShaderiv(shader, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetShaderiv(shader, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetShaderInfoLog(shader, bufsize, length, infolog); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetShaderInfoLog(shader, bufsize, length, infolog); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetShaderPrecisionFormat(shadertype, precisiontype, range, precision); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetShaderSource(shader, bufsize, length, source); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetShaderSource(shader, bufsize, length, source); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetUniformfv(GLuint program, GLint location, GLfloat* params) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetUniformfv(program, location, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetUniformfv(program, location, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetUniformiv(GLuint program, GLint location, GLint* params) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetUniformiv(program, location, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetUniformiv(program, location, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline GLint QOpenGLFunctions::glGetUniformLocation(GLuint program, const char* name) +{ +#if defined(QT_OPENGL_ES_2) + GLint result = ::glGetUniformLocation(program, name); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLint result = d_ptr->GetUniformLocation(program, name); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline void QOpenGLFunctions::glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetVertexAttribfv(index, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetVertexAttribfv(index, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetVertexAttribiv(index, pname, params); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetVertexAttribiv(index, pname, params); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) +{ +#if defined(QT_OPENGL_ES_2) + ::glGetVertexAttribPointerv(index, pname, pointer); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->GetVertexAttribPointerv(index, pname, pointer); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline GLboolean QOpenGLFunctions::glIsBuffer(GLuint buffer) +{ +#if defined(QT_OPENGL_ES_2) + GLboolean result = ::glIsBuffer(buffer); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLboolean result = d_ptr->IsBuffer(buffer); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline GLboolean QOpenGLFunctions::glIsFramebuffer(GLuint framebuffer) +{ +#if defined(QT_OPENGL_ES_2) + GLboolean result = ::glIsFramebuffer(framebuffer); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLboolean result = d_ptr->IsFramebuffer(framebuffer); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline GLboolean QOpenGLFunctions::glIsProgram(GLuint program) +{ +#if defined(QT_OPENGL_ES_2) + GLboolean result = ::glIsProgram(program); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLboolean result = d_ptr->IsProgram(program); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline GLboolean QOpenGLFunctions::glIsRenderbuffer(GLuint renderbuffer) +{ +#if defined(QT_OPENGL_ES_2) + GLboolean result = ::glIsRenderbuffer(renderbuffer); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLboolean result = d_ptr->IsRenderbuffer(renderbuffer); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline GLboolean QOpenGLFunctions::glIsShader(GLuint shader) +{ +#if defined(QT_OPENGL_ES_2) + GLboolean result = ::glIsShader(shader); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + GLboolean result = d_ptr->IsShader(shader); +#endif + Q_OPENGL_FUNCTIONS_DEBUG + return result; +} + +inline void QOpenGLFunctions::glLinkProgram(GLuint program) +{ +#if defined(QT_OPENGL_ES_2) + ::glLinkProgram(program); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->LinkProgram(program); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glReleaseShaderCompiler() +{ +#if defined(QT_OPENGL_ES_2) + ::glReleaseShaderCompiler(); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->ReleaseShaderCompiler(); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) +{ +#if defined(QT_OPENGL_ES_2) + ::glRenderbufferStorage(target, internalformat, width, height); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->RenderbufferStorage(target, internalformat, width, height); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert) +{ +#if defined(QT_OPENGL_ES_2) + ::glSampleCoverage(value, invert); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->SampleCoverage(value, invert); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length) +{ +#if defined(QT_OPENGL_ES_2) + ::glShaderBinary(n, shaders, binaryformat, binary, length); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->ShaderBinary(n, shaders, binaryformat, binary, length); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) +{ +#if defined(QT_OPENGL_ES_2) + ::glShaderSource(shader, count, string, length); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->ShaderSource(shader, count, string, length); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) +{ +#if defined(QT_OPENGL_ES_2) + ::glStencilFuncSeparate(face, func, ref, mask); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->StencilFuncSeparate(face, func, ref, mask); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glStencilMaskSeparate(GLenum face, GLuint mask) +{ +#if defined(QT_OPENGL_ES_2) + ::glStencilMaskSeparate(face, mask); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->StencilMaskSeparate(face, mask); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +{ +#if defined(QT_OPENGL_ES_2) + ::glStencilOpSeparate(face, fail, zfail, zpass); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->StencilOpSeparate(face, fail, zfail, zpass); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform1f(GLint location, GLfloat x) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform1f(location, x); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform1f(location, x); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform1fv(GLint location, GLsizei count, const GLfloat* v) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform1fv(location, count, v); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform1fv(location, count, v); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform1i(GLint location, GLint x) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform1i(location, x); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform1i(location, x); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform1iv(GLint location, GLsizei count, const GLint* v) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform1iv(location, count, v); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform1iv(location, count, v); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform2f(GLint location, GLfloat x, GLfloat y) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform2f(location, x, y); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform2f(location, x, y); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform2fv(GLint location, GLsizei count, const GLfloat* v) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform2fv(location, count, v); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform2fv(location, count, v); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform2i(GLint location, GLint x, GLint y) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform2i(location, x, y); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform2i(location, x, y); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform2iv(GLint location, GLsizei count, const GLint* v) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform2iv(location, count, v); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform2iv(location, count, v); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform3f(location, x, y, z); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform3f(location, x, y, z); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform3fv(GLint location, GLsizei count, const GLfloat* v) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform3fv(location, count, v); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform3fv(location, count, v); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform3i(GLint location, GLint x, GLint y, GLint z) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform3i(location, x, y, z); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform3i(location, x, y, z); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform3iv(GLint location, GLsizei count, const GLint* v) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform3iv(location, count, v); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform3iv(location, count, v); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform4f(location, x, y, z, w); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform4f(location, x, y, z, w); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform4fv(GLint location, GLsizei count, const GLfloat* v) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform4fv(location, count, v); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform4fv(location, count, v); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform4i(location, x, y, z, w); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform4i(location, x, y, z, w); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniform4iv(GLint location, GLsizei count, const GLint* v) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniform4iv(location, count, v); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->Uniform4iv(location, count, v); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniformMatrix2fv(location, count, transpose, value); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->UniformMatrix2fv(location, count, transpose, value); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniformMatrix3fv(location, count, transpose, value); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->UniformMatrix3fv(location, count, transpose, value); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ +#if defined(QT_OPENGL_ES_2) + ::glUniformMatrix4fv(location, count, transpose, value); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->UniformMatrix4fv(location, count, transpose, value); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glUseProgram(GLuint program) +{ +#if defined(QT_OPENGL_ES_2) + ::glUseProgram(program); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->UseProgram(program); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glValidateProgram(GLuint program) +{ +#if defined(QT_OPENGL_ES_2) + ::glValidateProgram(program); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->ValidateProgram(program); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glVertexAttrib1f(GLuint indx, GLfloat x) +{ +#if defined(QT_OPENGL_ES_2) + ::glVertexAttrib1f(indx, x); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->VertexAttrib1f(indx, x); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glVertexAttrib1fv(GLuint indx, const GLfloat* values) +{ +#if defined(QT_OPENGL_ES_2) + ::glVertexAttrib1fv(indx, values); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->VertexAttrib1fv(indx, values); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) +{ +#if defined(QT_OPENGL_ES_2) + ::glVertexAttrib2f(indx, x, y); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->VertexAttrib2f(indx, x, y); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glVertexAttrib2fv(GLuint indx, const GLfloat* values) +{ +#if defined(QT_OPENGL_ES_2) + ::glVertexAttrib2fv(indx, values); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->VertexAttrib2fv(indx, values); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) +{ +#if defined(QT_OPENGL_ES_2) + ::glVertexAttrib3f(indx, x, y, z); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->VertexAttrib3f(indx, x, y, z); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glVertexAttrib3fv(GLuint indx, const GLfloat* values) +{ +#if defined(QT_OPENGL_ES_2) + ::glVertexAttrib3fv(indx, values); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->VertexAttrib3fv(indx, values); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ +#if defined(QT_OPENGL_ES_2) + ::glVertexAttrib4f(indx, x, y, z, w); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->VertexAttrib4f(indx, x, y, z, w); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glVertexAttrib4fv(GLuint indx, const GLfloat* values) +{ +#if defined(QT_OPENGL_ES_2) + ::glVertexAttrib4fv(indx, values); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->VertexAttrib4fv(indx, values); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +inline void QOpenGLFunctions::glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) +{ +#if defined(QT_OPENGL_ES_2) + ::glVertexAttribPointer(indx, size, type, normalized, stride, ptr); +#else + Q_ASSERT(QOpenGLFunctions::isInitialized(d_ptr)); + d_ptr->VertexAttribPointer(indx, size, type, normalized, stride, ptr); +#endif + Q_OPENGL_FUNCTIONS_DEBUG +} + +#ifndef GL_ACTIVE_ATTRIBUTE_MAX_LENGTH +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#endif +#ifndef GL_ACTIVE_ATTRIBUTES +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#endif +#ifndef GL_ACTIVE_TEXTURE +#define GL_ACTIVE_TEXTURE 0x84E0 +#endif +#ifndef GL_ACTIVE_UNIFORM_MAX_LENGTH +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#endif +#ifndef GL_ACTIVE_UNIFORMS +#define GL_ACTIVE_UNIFORMS 0x8B86 +#endif +#ifndef GL_ALIASED_LINE_WIDTH_RANGE +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#endif +#ifndef GL_ALIASED_POINT_SIZE_RANGE +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#endif +#ifndef GL_ALPHA +#define GL_ALPHA 0x1906 +#endif +#ifndef GL_ALPHA_BITS +#define GL_ALPHA_BITS 0x0D55 +#endif +#ifndef GL_ALWAYS +#define GL_ALWAYS 0x0207 +#endif +#ifndef GL_ARRAY_BUFFER +#define GL_ARRAY_BUFFER 0x8892 +#endif +#ifndef GL_ARRAY_BUFFER_BINDING +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#endif +#ifndef GL_ATTACHED_SHADERS +#define GL_ATTACHED_SHADERS 0x8B85 +#endif +#ifndef GL_BACK +#define GL_BACK 0x0405 +#endif +#ifndef GL_BLEND +#define GL_BLEND 0x0BE2 +#endif +#ifndef GL_BLEND_COLOR +#define GL_BLEND_COLOR 0x8005 +#endif +#ifndef GL_BLEND_DST_ALPHA +#define GL_BLEND_DST_ALPHA 0x80CA +#endif +#ifndef GL_BLEND_DST_RGB +#define GL_BLEND_DST_RGB 0x80C8 +#endif +#ifndef GL_BLEND_EQUATION +#define GL_BLEND_EQUATION 0x8009 +#endif +#ifndef GL_BLEND_EQUATION_ALPHA +#define GL_BLEND_EQUATION_ALPHA 0x883D +#endif +#ifndef GL_BLEND_EQUATION_RGB +#define GL_BLEND_EQUATION_RGB 0x8009 +#endif +#ifndef GL_BLEND_SRC_ALPHA +#define GL_BLEND_SRC_ALPHA 0x80CB +#endif +#ifndef GL_BLEND_SRC_RGB +#define GL_BLEND_SRC_RGB 0x80C9 +#endif +#ifndef GL_BLUE_BITS +#define GL_BLUE_BITS 0x0D54 +#endif +#ifndef GL_BOOL +#define GL_BOOL 0x8B56 +#endif +#ifndef GL_BOOL_VEC2 +#define GL_BOOL_VEC2 0x8B57 +#endif +#ifndef GL_BOOL_VEC3 +#define GL_BOOL_VEC3 0x8B58 +#endif +#ifndef GL_BOOL_VEC4 +#define GL_BOOL_VEC4 0x8B59 +#endif +#ifndef GL_BUFFER_SIZE +#define GL_BUFFER_SIZE 0x8764 +#endif +#ifndef GL_BUFFER_USAGE +#define GL_BUFFER_USAGE 0x8765 +#endif +#ifndef GL_BYTE +#define GL_BYTE 0x1400 +#endif +#ifndef GL_CCW +#define GL_CCW 0x0901 +#endif +#ifndef GL_CLAMP_TO_EDGE +#define GL_CLAMP_TO_EDGE 0x812F +#endif +#ifndef GL_COLOR_ATTACHMENT0 +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#endif +#ifndef GL_COLOR_BUFFER_BIT +#define GL_COLOR_BUFFER_BIT 0x00004000 +#endif +#ifndef GL_COLOR_CLEAR_VALUE +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#endif +#ifndef GL_COLOR_WRITEMASK +#define GL_COLOR_WRITEMASK 0x0C23 +#endif +#ifndef GL_COMPILE_STATUS +#define GL_COMPILE_STATUS 0x8B81 +#endif +#ifndef GL_COMPRESSED_TEXTURE_FORMATS +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#endif +#ifndef GL_CONSTANT_ALPHA +#define GL_CONSTANT_ALPHA 0x8003 +#endif +#ifndef GL_CONSTANT_COLOR +#define GL_CONSTANT_COLOR 0x8001 +#endif +#ifndef GL_CULL_FACE +#define GL_CULL_FACE 0x0B44 +#endif +#ifndef GL_CULL_FACE_MODE +#define GL_CULL_FACE_MODE 0x0B45 +#endif +#ifndef GL_CURRENT_PROGRAM +#define GL_CURRENT_PROGRAM 0x8B8D +#endif +#ifndef GL_CURRENT_VERTEX_ATTRIB +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#endif +#ifndef GL_CW +#define GL_CW 0x0900 +#endif +#ifndef GL_DECR +#define GL_DECR 0x1E03 +#endif +#ifndef GL_DECR_WRAP +#define GL_DECR_WRAP 0x8508 +#endif +#ifndef GL_DELETE_STATUS +#define GL_DELETE_STATUS 0x8B80 +#endif +#ifndef GL_DEPTH_ATTACHMENT +#define GL_DEPTH_ATTACHMENT 0x8D00 +#endif +#ifndef GL_DEPTH_BITS +#define GL_DEPTH_BITS 0x0D56 +#endif +#ifndef GL_DEPTH_BUFFER_BIT +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#endif +#ifndef GL_DEPTH_CLEAR_VALUE +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#endif +#ifndef GL_DEPTH_COMPONENT +#define GL_DEPTH_COMPONENT 0x1902 +#endif +#ifndef GL_DEPTH_COMPONENT16 +#define GL_DEPTH_COMPONENT16 0x81A5 +#endif +#ifndef GL_DEPTH_FUNC +#define GL_DEPTH_FUNC 0x0B74 +#endif +#ifndef GL_DEPTH_RANGE +#define GL_DEPTH_RANGE 0x0B70 +#endif +#ifndef GL_DEPTH_TEST +#define GL_DEPTH_TEST 0x0B71 +#endif +#ifndef GL_DEPTH_WRITEMASK +#define GL_DEPTH_WRITEMASK 0x0B72 +#endif +#ifndef GL_DITHER +#define GL_DITHER 0x0BD0 +#endif +#ifndef GL_DONT_CARE +#define GL_DONT_CARE 0x1100 +#endif +#ifndef GL_DST_ALPHA +#define GL_DST_ALPHA 0x0304 +#endif +#ifndef GL_DST_COLOR +#define GL_DST_COLOR 0x0306 +#endif +#ifndef GL_DYNAMIC_DRAW +#define GL_DYNAMIC_DRAW 0x88E8 +#endif +#ifndef GL_ELEMENT_ARRAY_BUFFER +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#endif +#ifndef GL_ELEMENT_ARRAY_BUFFER_BINDING +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#endif +#ifndef GL_EQUAL +#define GL_EQUAL 0x0202 +#endif +#ifndef GL_EXTENSIONS +#define GL_EXTENSIONS 0x1F03 +#endif +#ifndef GL_FALSE +#define GL_FALSE 0 +#endif +#ifndef GL_FASTEST +#define GL_FASTEST 0x1101 +#endif +#ifndef GL_FIXED +#define GL_FIXED 0x140C +#endif +#ifndef GL_FLOAT +#define GL_FLOAT 0x1406 +#endif +#ifndef GL_FLOAT_MAT2 +#define GL_FLOAT_MAT2 0x8B5A +#endif +#ifndef GL_FLOAT_MAT3 +#define GL_FLOAT_MAT3 0x8B5B +#endif +#ifndef GL_FLOAT_MAT4 +#define GL_FLOAT_MAT4 0x8B5C +#endif +#ifndef GL_FLOAT_VEC2 +#define GL_FLOAT_VEC2 0x8B50 +#endif +#ifndef GL_FLOAT_VEC3 +#define GL_FLOAT_VEC3 0x8B51 +#endif +#ifndef GL_FLOAT_VEC4 +#define GL_FLOAT_VEC4 0x8B52 +#endif +#ifndef GL_FRAGMENT_SHADER +#define GL_FRAGMENT_SHADER 0x8B30 +#endif +#ifndef GL_FRAMEBUFFER +#define GL_FRAMEBUFFER 0x8D40 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#endif +#ifndef GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#endif +#ifndef GL_FRAMEBUFFER_BINDING +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#endif +#ifndef GL_FRAMEBUFFER_COMPLETE +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#endif +#ifndef GL_FRAMEBUFFER_UNSUPPORTED +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#endif +#ifndef GL_FRONT +#define GL_FRONT 0x0404 +#endif +#ifndef GL_FRONT_AND_BACK +#define GL_FRONT_AND_BACK 0x0408 +#endif +#ifndef GL_FRONT_FACE +#define GL_FRONT_FACE 0x0B46 +#endif +#ifndef GL_FUNC_ADD +#define GL_FUNC_ADD 0x8006 +#endif +#ifndef GL_FUNC_REVERSE_SUBTRACT +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#endif +#ifndef GL_FUNC_SUBTRACT +#define GL_FUNC_SUBTRACT 0x800A +#endif +#ifndef GL_GENERATE_MIPMAP_HINT +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#endif +#ifndef GL_GEQUAL +#define GL_GEQUAL 0x0206 +#endif +#ifndef GL_GREATER +#define GL_GREATER 0x0204 +#endif +#ifndef GL_GREEN_BITS +#define GL_GREEN_BITS 0x0D53 +#endif +#ifndef GL_HIGH_FLOAT +#define GL_HIGH_FLOAT 0x8DF2 +#endif +#ifndef GL_HIGH_INT +#define GL_HIGH_INT 0x8DF5 +#endif +#ifndef GL_IMPLEMENTATION_COLOR_READ_FORMAT +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#endif +#ifndef GL_IMPLEMENTATION_COLOR_READ_TYPE +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#endif +#ifndef GL_INCR +#define GL_INCR 0x1E02 +#endif +#ifndef GL_INCR_WRAP +#define GL_INCR_WRAP 0x8507 +#endif +#ifndef GL_INFO_LOG_LENGTH +#define GL_INFO_LOG_LENGTH 0x8B84 +#endif +#ifndef GL_INT +#define GL_INT 0x1404 +#endif +#ifndef GL_INT_VEC2 +#define GL_INT_VEC2 0x8B53 +#endif +#ifndef GL_INT_VEC3 +#define GL_INT_VEC3 0x8B54 +#endif +#ifndef GL_INT_VEC4 +#define GL_INT_VEC4 0x8B55 +#endif +#ifndef GL_INVALID_ENUM +#define GL_INVALID_ENUM 0x0500 +#endif +#ifndef GL_INVALID_FRAMEBUFFER_OPERATION +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#endif +#ifndef GL_INVALID_OPERATION +#define GL_INVALID_OPERATION 0x0502 +#endif +#ifndef GL_INVALID_VALUE +#define GL_INVALID_VALUE 0x0501 +#endif +#ifndef GL_INVERT +#define GL_INVERT 0x150A +#endif +#ifndef GL_KEEP +#define GL_KEEP 0x1E00 +#endif +#ifndef GL_LEQUAL +#define GL_LEQUAL 0x0203 +#endif +#ifndef GL_LESS +#define GL_LESS 0x0201 +#endif +#ifndef GL_LINEAR +#define GL_LINEAR 0x2601 +#endif +#ifndef GL_LINEAR_MIPMAP_LINEAR +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#endif +#ifndef GL_LINEAR_MIPMAP_NEAREST +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#endif +#ifndef GL_LINE_LOOP +#define GL_LINE_LOOP 0x0002 +#endif +#ifndef GL_LINES +#define GL_LINES 0x0001 +#endif +#ifndef GL_LINE_STRIP +#define GL_LINE_STRIP 0x0003 +#endif +#ifndef GL_LINE_WIDTH +#define GL_LINE_WIDTH 0x0B21 +#endif +#ifndef GL_LINK_STATUS +#define GL_LINK_STATUS 0x8B82 +#endif +#ifndef GL_LOW_FLOAT +#define GL_LOW_FLOAT 0x8DF0 +#endif +#ifndef GL_LOW_INT +#define GL_LOW_INT 0x8DF3 +#endif +#ifndef GL_LUMINANCE +#define GL_LUMINANCE 0x1909 +#endif +#ifndef GL_LUMINANCE_ALPHA +#define GL_LUMINANCE_ALPHA 0x190A +#endif +#ifndef GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#endif +#ifndef GL_MAX_CUBE_MAP_TEXTURE_SIZE +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#endif +#ifndef GL_MAX_FRAGMENT_UNIFORM_VECTORS +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#endif +#ifndef GL_MAX_RENDERBUFFER_SIZE +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#endif +#ifndef GL_MAX_TEXTURE_IMAGE_UNITS +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#endif +#ifndef GL_MAX_TEXTURE_SIZE +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#endif +#ifndef GL_MAX_VARYING_VECTORS +#define GL_MAX_VARYING_VECTORS 0x8DFC +#endif +#ifndef GL_MAX_VERTEX_ATTRIBS +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#endif +#ifndef GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#endif +#ifndef GL_MAX_VERTEX_UNIFORM_VECTORS +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#endif +#ifndef GL_MAX_VIEWPORT_DIMS +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#endif +#ifndef GL_MEDIUM_FLOAT +#define GL_MEDIUM_FLOAT 0x8DF1 +#endif +#ifndef GL_MEDIUM_INT +#define GL_MEDIUM_INT 0x8DF4 +#endif +#ifndef GL_MIRRORED_REPEAT +#define GL_MIRRORED_REPEAT 0x8370 +#endif +#ifndef GL_NEAREST +#define GL_NEAREST 0x2600 +#endif +#ifndef GL_NEAREST_MIPMAP_LINEAR +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#endif +#ifndef GL_NEAREST_MIPMAP_NEAREST +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#endif +#ifndef GL_NEVER +#define GL_NEVER 0x0200 +#endif +#ifndef GL_NICEST +#define GL_NICEST 0x1102 +#endif +#ifndef GL_NO_ERROR +#define GL_NO_ERROR 0 +#endif +#ifndef GL_NONE +#define GL_NONE 0 +#endif +#ifndef GL_NOTEQUAL +#define GL_NOTEQUAL 0x0205 +#endif +#ifndef GL_NUM_COMPRESSED_TEXTURE_FORMATS +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#endif +#ifndef GL_NUM_SHADER_BINARY_FORMATS +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#endif +#ifndef GL_ONE +#define GL_ONE 1 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_ALPHA +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#endif +#ifndef GL_ONE_MINUS_CONSTANT_COLOR +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#endif +#ifndef GL_ONE_MINUS_DST_ALPHA +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#endif +#ifndef GL_ONE_MINUS_DST_COLOR +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#endif +#ifndef GL_ONE_MINUS_SRC_ALPHA +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#endif +#ifndef GL_ONE_MINUS_SRC_COLOR +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#endif +#ifndef GL_OUT_OF_MEMORY +#define GL_OUT_OF_MEMORY 0x0505 +#endif +#ifndef GL_PACK_ALIGNMENT +#define GL_PACK_ALIGNMENT 0x0D05 +#endif +#ifndef GL_POINTS +#define GL_POINTS 0x0000 +#endif +#ifndef GL_POLYGON_OFFSET_FACTOR +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#endif +#ifndef GL_POLYGON_OFFSET_FILL +#define GL_POLYGON_OFFSET_FILL 0x8037 +#endif +#ifndef GL_POLYGON_OFFSET_UNITS +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#endif +#ifndef GL_RED_BITS +#define GL_RED_BITS 0x0D52 +#endif +#ifndef GL_RENDERBUFFER +#define GL_RENDERBUFFER 0x8D41 +#endif +#ifndef GL_RENDERBUFFER_ALPHA_SIZE +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#endif +#ifndef GL_RENDERBUFFER_BINDING +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#endif +#ifndef GL_RENDERBUFFER_BLUE_SIZE +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#endif +#ifndef GL_RENDERBUFFER_DEPTH_SIZE +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#endif +#ifndef GL_RENDERBUFFER_GREEN_SIZE +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#endif +#ifndef GL_RENDERBUFFER_HEIGHT +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#endif +#ifndef GL_RENDERBUFFER_INTERNAL_FORMAT +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#endif +#ifndef GL_RENDERBUFFER_RED_SIZE +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#endif +#ifndef GL_RENDERBUFFER_STENCIL_SIZE +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#endif +#ifndef GL_RENDERBUFFER_WIDTH +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#endif +#ifndef GL_RENDERER +#define GL_RENDERER 0x1F01 +#endif +#ifndef GL_REPEAT +#define GL_REPEAT 0x2901 +#endif +#ifndef GL_REPLACE +#define GL_REPLACE 0x1E01 +#endif +#ifndef GL_RGB +#define GL_RGB 0x1907 +#endif +#ifndef GL_RGB565 +#define GL_RGB565 0x8D62 +#endif +#ifndef GL_RGB5_A1 +#define GL_RGB5_A1 0x8057 +#endif +#ifndef GL_RGBA +#define GL_RGBA 0x1908 +#endif +#ifndef GL_RGBA4 +#define GL_RGBA4 0x8056 +#endif +#ifndef GL_BGRA +#define GL_BGRA 0x80E1 +#endif +#ifndef GL_SAMPLE_ALPHA_TO_COVERAGE +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#endif +#ifndef GL_SAMPLE_BUFFERS +#define GL_SAMPLE_BUFFERS 0x80A8 +#endif +#ifndef GL_SAMPLE_COVERAGE +#define GL_SAMPLE_COVERAGE 0x80A0 +#endif +#ifndef GL_SAMPLE_COVERAGE_INVERT +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#endif +#ifndef GL_SAMPLE_COVERAGE_VALUE +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#endif +#ifndef GL_SAMPLER_2D +#define GL_SAMPLER_2D 0x8B5E +#endif +#ifndef GL_SAMPLER_CUBE +#define GL_SAMPLER_CUBE 0x8B60 +#endif +#ifndef GL_SAMPLES +#define GL_SAMPLES 0x80A9 +#endif +#ifndef GL_SCISSOR_BOX +#define GL_SCISSOR_BOX 0x0C10 +#endif +#ifndef GL_SCISSOR_TEST +#define GL_SCISSOR_TEST 0x0C11 +#endif +#ifndef GL_SHADER_BINARY_FORMATS +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#endif +#ifndef GL_SHADER_COMPILER +#define GL_SHADER_COMPILER 0x8DFA +#endif +#ifndef GL_SHADER_SOURCE_LENGTH +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#endif +#ifndef GL_SHADER_TYPE +#define GL_SHADER_TYPE 0x8B4F +#endif +#ifndef GL_SHADING_LANGUAGE_VERSION +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#endif +#ifndef GL_SHORT +#define GL_SHORT 0x1402 +#endif +#ifndef GL_SRC_ALPHA +#define GL_SRC_ALPHA 0x0302 +#endif +#ifndef GL_SRC_ALPHA_SATURATE +#define GL_SRC_ALPHA_SATURATE 0x0308 +#endif +#ifndef GL_SRC_COLOR +#define GL_SRC_COLOR 0x0300 +#endif +#ifndef GL_STATIC_DRAW +#define GL_STATIC_DRAW 0x88E4 +#endif +#ifndef GL_STENCIL_ATTACHMENT +#define GL_STENCIL_ATTACHMENT 0x8D20 +#endif +#ifndef GL_STENCIL_BACK_FAIL +#define GL_STENCIL_BACK_FAIL 0x8801 +#endif +#ifndef GL_STENCIL_BACK_FUNC +#define GL_STENCIL_BACK_FUNC 0x8800 +#endif +#ifndef GL_STENCIL_BACK_PASS_DEPTH_FAIL +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#endif +#ifndef GL_STENCIL_BACK_PASS_DEPTH_PASS +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#endif +#ifndef GL_STENCIL_BACK_REF +#define GL_STENCIL_BACK_REF 0x8CA3 +#endif +#ifndef GL_STENCIL_BACK_VALUE_MASK +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#endif +#ifndef GL_STENCIL_BACK_WRITEMASK +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#endif +#ifndef GL_STENCIL_BITS +#define GL_STENCIL_BITS 0x0D57 +#endif +#ifndef GL_STENCIL_BUFFER_BIT +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#endif +#ifndef GL_STENCIL_CLEAR_VALUE +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#endif +#ifndef GL_STENCIL_FAIL +#define GL_STENCIL_FAIL 0x0B94 +#endif +#ifndef GL_STENCIL_FUNC +#define GL_STENCIL_FUNC 0x0B92 +#endif +#ifndef GL_STENCIL_INDEX +#define GL_STENCIL_INDEX 0x1901 +#endif +#ifndef GL_STENCIL_INDEX8 +#define GL_STENCIL_INDEX8 0x8D48 +#endif +#ifndef GL_STENCIL_PASS_DEPTH_FAIL +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#endif +#ifndef GL_STENCIL_PASS_DEPTH_PASS +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#endif +#ifndef GL_STENCIL_REF +#define GL_STENCIL_REF 0x0B97 +#endif +#ifndef GL_STENCIL_TEST +#define GL_STENCIL_TEST 0x0B90 +#endif +#ifndef GL_STENCIL_VALUE_MASK +#define GL_STENCIL_VALUE_MASK 0x0B93 +#endif +#ifndef GL_STENCIL_WRITEMASK +#define GL_STENCIL_WRITEMASK 0x0B98 +#endif +#ifndef GL_STREAM_DRAW +#define GL_STREAM_DRAW 0x88E0 +#endif +#ifndef GL_SUBPIXEL_BITS +#define GL_SUBPIXEL_BITS 0x0D50 +#endif +#ifndef GL_TEXTURE0 +#define GL_TEXTURE0 0x84C0 +#endif +#ifndef GL_TEXTURE +#define GL_TEXTURE 0x1702 +#endif +#ifndef GL_TEXTURE10 +#define GL_TEXTURE10 0x84CA +#endif +#ifndef GL_TEXTURE1 +#define GL_TEXTURE1 0x84C1 +#endif +#ifndef GL_TEXTURE11 +#define GL_TEXTURE11 0x84CB +#endif +#ifndef GL_TEXTURE12 +#define GL_TEXTURE12 0x84CC +#endif +#ifndef GL_TEXTURE13 +#define GL_TEXTURE13 0x84CD +#endif +#ifndef GL_TEXTURE14 +#define GL_TEXTURE14 0x84CE +#endif +#ifndef GL_TEXTURE15 +#define GL_TEXTURE15 0x84CF +#endif +#ifndef GL_TEXTURE16 +#define GL_TEXTURE16 0x84D0 +#endif +#ifndef GL_TEXTURE17 +#define GL_TEXTURE17 0x84D1 +#endif +#ifndef GL_TEXTURE18 +#define GL_TEXTURE18 0x84D2 +#endif +#ifndef GL_TEXTURE19 +#define GL_TEXTURE19 0x84D3 +#endif +#ifndef GL_TEXTURE20 +#define GL_TEXTURE20 0x84D4 +#endif +#ifndef GL_TEXTURE2 +#define GL_TEXTURE2 0x84C2 +#endif +#ifndef GL_TEXTURE21 +#define GL_TEXTURE21 0x84D5 +#endif +#ifndef GL_TEXTURE22 +#define GL_TEXTURE22 0x84D6 +#endif +#ifndef GL_TEXTURE23 +#define GL_TEXTURE23 0x84D7 +#endif +#ifndef GL_TEXTURE24 +#define GL_TEXTURE24 0x84D8 +#endif +#ifndef GL_TEXTURE25 +#define GL_TEXTURE25 0x84D9 +#endif +#ifndef GL_TEXTURE26 +#define GL_TEXTURE26 0x84DA +#endif +#ifndef GL_TEXTURE27 +#define GL_TEXTURE27 0x84DB +#endif +#ifndef GL_TEXTURE28 +#define GL_TEXTURE28 0x84DC +#endif +#ifndef GL_TEXTURE29 +#define GL_TEXTURE29 0x84DD +#endif +#ifndef GL_TEXTURE_2D +#define GL_TEXTURE_2D 0x0DE1 +#endif +#ifndef GL_TEXTURE30 +#define GL_TEXTURE30 0x84DE +#endif +#ifndef GL_TEXTURE3 +#define GL_TEXTURE3 0x84C3 +#endif +#ifndef GL_TEXTURE31 +#define GL_TEXTURE31 0x84DF +#endif +#ifndef GL_TEXTURE4 +#define GL_TEXTURE4 0x84C4 +#endif +#ifndef GL_TEXTURE5 +#define GL_TEXTURE5 0x84C5 +#endif +#ifndef GL_TEXTURE6 +#define GL_TEXTURE6 0x84C6 +#endif +#ifndef GL_TEXTURE7 +#define GL_TEXTURE7 0x84C7 +#endif +#ifndef GL_TEXTURE8 +#define GL_TEXTURE8 0x84C8 +#endif +#ifndef GL_TEXTURE9 +#define GL_TEXTURE9 0x84C9 +#endif +#ifndef GL_TEXTURE_BINDING_2D +#define GL_TEXTURE_BINDING_2D 0x8069 +#endif +#ifndef GL_TEXTURE_BINDING_CUBE_MAP +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#endif +#ifndef GL_TEXTURE_CUBE_MAP +#define GL_TEXTURE_CUBE_MAP 0x8513 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_X +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_Y +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_NEGATIVE_Z +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_X +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_Y +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#endif +#ifndef GL_TEXTURE_CUBE_MAP_POSITIVE_Z +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#endif +#ifndef GL_TEXTURE_MAG_FILTER +#define GL_TEXTURE_MAG_FILTER 0x2800 +#endif +#ifndef GL_TEXTURE_MIN_FILTER +#define GL_TEXTURE_MIN_FILTER 0x2801 +#endif +#ifndef GL_TEXTURE_WRAP_S +#define GL_TEXTURE_WRAP_S 0x2802 +#endif +#ifndef GL_TEXTURE_WRAP_T +#define GL_TEXTURE_WRAP_T 0x2803 +#endif +#ifndef GL_TRIANGLE_FAN +#define GL_TRIANGLE_FAN 0x0006 +#endif +#ifndef GL_TRIANGLES +#define GL_TRIANGLES 0x0004 +#endif +#ifndef GL_TRIANGLE_STRIP +#define GL_TRIANGLE_STRIP 0x0005 +#endif +#ifndef GL_TRUE +#define GL_TRUE 1 +#endif +#ifndef GL_UNPACK_ALIGNMENT +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#endif +#ifndef GL_UNSIGNED_BYTE +#define GL_UNSIGNED_BYTE 0x1401 +#endif +#ifndef GL_UNSIGNED_INT +#define GL_UNSIGNED_INT 0x1405 +#endif +#ifndef GL_UNSIGNED_SHORT +#define GL_UNSIGNED_SHORT 0x1403 +#endif +#ifndef GL_UNSIGNED_SHORT_4_4_4_4 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#endif +#ifndef GL_UNSIGNED_SHORT_5_5_5_1 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#endif +#ifndef GL_UNSIGNED_SHORT_5_6_5 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#endif +#ifndef GL_VALIDATE_STATUS +#define GL_VALIDATE_STATUS 0x8B83 +#endif +#ifndef GL_VENDOR +#define GL_VENDOR 0x1F00 +#endif +#ifndef GL_VERSION +#define GL_VERSION 0x1F02 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_ENABLED +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_NORMALIZED +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_POINTER +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_SIZE +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_STRIDE +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#endif +#ifndef GL_VERTEX_ATTRIB_ARRAY_TYPE +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#endif +#ifndef GL_VERTEX_SHADER +#define GL_VERTEX_SHADER 0x8B31 +#endif +#ifndef GL_VIEWPORT +#define GL_VIEWPORT 0x0BA2 +#endif +#ifndef GL_ZERO +#define GL_ZERO 0 +#endif + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/gui/opengl/qopenglgradientcache.cpp b/src/gui/opengl/qopenglgradientcache.cpp new file mode 100644 index 00000000000..f8d61cd6206 --- /dev/null +++ b/src/gui/opengl/qopenglgradientcache.cpp @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenglgradientcache_p.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QOpenGL2GradientCacheWrapper +{ +public: + QOpenGL2GradientCache *cacheForContext(QOpenGLContext *context) { + QMutexLocker lock(&m_mutex); + return m_resource.value(context); + } + +private: + QOpenGLMultiGroupSharedResource m_resource; + QMutex m_mutex; +}; + +Q_GLOBAL_STATIC(QOpenGL2GradientCacheWrapper, qt_gradient_caches) + +QOpenGL2GradientCache::QOpenGL2GradientCache(QOpenGLContext *ctx) + : QOpenGLSharedResource(ctx->shareGroup()) +{ +} + +QOpenGL2GradientCache::~QOpenGL2GradientCache() +{ + cache.clear(); +} + +QOpenGL2GradientCache *QOpenGL2GradientCache::cacheForContext(QOpenGLContext *context) +{ + return qt_gradient_caches()->cacheForContext(context); +} + +void QOpenGL2GradientCache::invalidateResource() +{ + QMutexLocker lock(&m_mutex); + cache.clear(); +} + +void QOpenGL2GradientCache::freeResource(QOpenGLContext *) +{ + cleanCache(); +} + +void QOpenGL2GradientCache::cleanCache() +{ + QMutexLocker lock(&m_mutex); + QOpenGLGradientColorTableHash::const_iterator it = cache.constBegin(); + for (; it != cache.constEnd(); ++it) { + const CacheInfo &cache_info = it.value(); + glDeleteTextures(1, &cache_info.texId); + } + cache.clear(); +} + +GLuint QOpenGL2GradientCache::getBuffer(const QGradient &gradient, qreal opacity) +{ + QMutexLocker lock(&m_mutex); + quint64 hash_val = 0; + + QGradientStops stops = gradient.stops(); + for (int i = 0; i < stops.size() && i <= 2; i++) + hash_val += stops[i].second.rgba(); + + QOpenGLGradientColorTableHash::const_iterator it = cache.constFind(hash_val); + + if (it == cache.constEnd()) + return addCacheElement(hash_val, gradient, opacity); + else { + do { + const CacheInfo &cache_info = it.value(); + if (cache_info.stops == stops && cache_info.opacity == opacity + && cache_info.interpolationMode == gradient.interpolationMode()) + { + return cache_info.texId; + } + ++it; + } while (it != cache.constEnd() && it.key() == hash_val); + // an exact match for these stops and opacity was not found, create new cache + return addCacheElement(hash_val, gradient, opacity); + } +} + + +GLuint QOpenGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient &gradient, qreal opacity) +{ + if (cache.size() == maxCacheSize()) { + int elem_to_remove = qrand() % maxCacheSize(); + quint64 key = cache.keys()[elem_to_remove]; + + // need to call glDeleteTextures on each removed cache entry: + QOpenGLGradientColorTableHash::const_iterator it = cache.constFind(key); + do { + glDeleteTextures(1, &it.value().texId); + } while (++it != cache.constEnd() && it.key() == key); + cache.remove(key); // may remove more than 1, but OK + } + + CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode()); + uint buffer[1024]; + generateGradientColorTable(gradient, buffer, paletteSize(), opacity); + glGenTextures(1, &cache_entry.texId); + glBindTexture(GL_TEXTURE_2D, cache_entry.texId); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, paletteSize(), 1, + 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + return cache.insert(hash_val, cache_entry).value().texId; +} + + +// GL's expects pixels in RGBA (when using GL_RGBA), bin-endian (ABGR on x86). +// Qt always stores in ARGB reguardless of the byte-order the mancine uses. +static inline uint qtToGlColor(uint c) +{ + uint o; +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + o = (c & 0xff00ff00) // alpha & green already in the right place + | ((c >> 16) & 0x000000ff) // red + | ((c << 16) & 0x00ff0000); // blue +#else //Q_BIG_ENDIAN + o = (c << 8) + | ((c >> 24) & 0x000000ff); +#endif // Q_BYTE_ORDER + return o; +} + +//TODO: Let GL generate the texture using an FBO +void QOpenGL2GradientCache::generateGradientColorTable(const QGradient& gradient, uint *colorTable, int size, qreal opacity) const +{ + int pos = 0; + QGradientStops s = gradient.stops(); + QVector colors(s.size()); + + for (int i = 0; i < s.size(); ++i) + colors[i] = s[i].second.rgba(); // Qt LIES! It returns ARGB (on little-endian AND on big-endian) + + bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation); + + uint alpha = qRound(opacity * 256); + uint current_color = ARGB_COMBINE_ALPHA(colors[0], alpha); + qreal incr = 1.0 / qreal(size); + qreal fpos = 1.5 * incr; + colorTable[pos++] = qtToGlColor(PREMUL(current_color)); + + while (fpos <= s.first().first) { + colorTable[pos] = colorTable[pos - 1]; + pos++; + fpos += incr; + } + + if (colorInterpolation) + current_color = PREMUL(current_color); + + for (int i = 0; i < s.size() - 1; ++i) { + qreal delta = 1/(s[i+1].first - s[i].first); + uint next_color = ARGB_COMBINE_ALPHA(colors[i+1], alpha); + if (colorInterpolation) + next_color = PREMUL(next_color); + + while (fpos < s[i+1].first && pos < size) { + int dist = int(256 * ((fpos - s[i].first) * delta)); + int idist = 256 - dist; + if (colorInterpolation) + colorTable[pos] = qtToGlColor(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)); + else + colorTable[pos] = qtToGlColor(PREMUL(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist))); + ++pos; + fpos += incr; + } + current_color = next_color; + } + + Q_ASSERT(s.size() > 0); + + uint last_color = qtToGlColor(PREMUL(ARGB_COMBINE_ALPHA(colors[s.size() - 1], alpha))); + for (;pos < size; ++pos) + colorTable[pos] = last_color; + + // Make sure the last color stop is represented at the end of the table + colorTable[size-1] = last_color; +} + +QT_END_NAMESPACE diff --git a/src/gui/embedded/qwssharedmemory_p.h b/src/gui/opengl/qopenglgradientcache_p.h similarity index 60% rename from src/gui/embedded/qwssharedmemory_p.h rename to src/gui/opengl/qopenglgradientcache_p.h index 31e69c4a832..53abf221d25 100644 --- a/src/gui/embedded/qwssharedmemory_p.h +++ b/src/gui/opengl/qopenglgradientcache_p.h @@ -39,9 +39,6 @@ ** ****************************************************************************/ -#ifndef QWSSHAREDMEMORY_P_H -#define QWSSHAREDMEMORY_P_H - // // W A R N I N G // ------------- @@ -53,53 +50,52 @@ // We mean it. // -#include "qplatformdefs.h" -#include "QtCore/qstring.h" +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE -#if !defined(QT_NO_QWS_MULTIPROCESS) +class QOpenGL2GradientCache : public QOpenGLSharedResource +{ + struct CacheInfo + { + inline CacheInfo(QGradientStops s, qreal op, QGradient::InterpolationMode mode) : + stops(s), opacity(op), interpolationMode(mode) {} + + GLuint texId; + QGradientStops stops; + qreal opacity; + QGradient::InterpolationMode interpolationMode; + }; + + typedef QMultiHash QOpenGLGradientColorTableHash; -class QWSSharedMemory { public: + static QOpenGL2GradientCache *cacheForContext(QOpenGLContext *context); - QWSSharedMemory(); - ~QWSSharedMemory(); + QOpenGL2GradientCache(QOpenGLContext *); + ~QOpenGL2GradientCache(); - void setPermissions(mode_t mode); - int size() const; - void *address() { return shmBase; } + GLuint getBuffer(const QGradient &gradient, qreal opacity); + inline int paletteSize() const { return 1024; } - int id() const { return shmId; } - - void detach(); - - bool create(int size); - bool attach(int id); - - //bool create(int size, const QString &filename, char c = 'Q'); - //bool attach(const QString &filename, char c = 'Q'); -// old API - - QWSSharedMemory(int, const QString &, char c = 'Q'); - void * base() { return address(); } - - bool create(); - void destroy(); - - bool attach(); + void invalidateResource(); + void freeResource(QOpenGLContext *ctx); private: - void *shmBase; - int shmSize; - QString shmFile; - char character; - int shmId; - key_t key; -}; + inline int maxCacheSize() const { return 60; } + inline void generateGradientColorTable(const QGradient& gradient, + uint *colorTable, + int size, qreal opacity) const; + GLuint addCacheElement(quint64 hash_val, const QGradient &gradient, qreal opacity); + void cleanCache(); -#endif // QT_NO_QWS_MULTIPROCESS + QOpenGLGradientColorTableHash cache; + QMutex m_mutex; +}; QT_END_NAMESPACE -#endif // QWSSHAREDMEMORY_P_H diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp new file mode 100644 index 00000000000..4e5c2703dca --- /dev/null +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include + +// for qt_defaultDpiX/Y +#include + +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QOpenGLPaintDevice + \brief The QOpenGLPaintDevice class enables painting to an OpenGL context using QPainter. + \since 5.0 + + \ingroup painting-3D + + When painting to a QOpenGLPaintDevice using QPainter, the state of + the current GL context will be altered by the paint engine to reflect + its needs. Applications should not rely upon the GL state being reset + to its original conditions, particularly the current shader program, + GL viewport, texture units, and drawing modes. +*/ + +class QOpenGLPaintDevicePrivate +{ +public: + QOpenGLPaintDevicePrivate(const QSize &size); + + QSize size; + QOpenGLContext *ctx; + + qreal dpmx; + qreal dpmy; + + bool flipped; + + QPaintEngine *engine; + + void init(const QSize &size, QOpenGLContext *ctx); +}; + +/*! + Constructs a QOpenGLPaintDevice with the given \a size. + + The QOpenGLPaintDevice is only valid for the current context. + + \sa QOpenGLContext::currentContext() +*/ +QOpenGLPaintDevice::QOpenGLPaintDevice(const QSize &size) + : d_ptr(new QOpenGLPaintDevicePrivate(size)) +{ +} + +/*! + Constructs a QOpenGLPaintDevice with the given \a size and \a ctx. + + The QOpenGLPaintDevice is only valid for the current context. + + \sa QOpenGLContext::currentContext() +*/ +QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height) + : d_ptr(new QOpenGLPaintDevicePrivate(QSize(width, height))) +{ +} + +QOpenGLPaintDevice::~QOpenGLPaintDevice() +{ + delete d_ptr->engine; +} + +QOpenGLPaintDevicePrivate::QOpenGLPaintDevicePrivate(const QSize &sz) + : size(sz) + , ctx(QOpenGLContext::currentContext()) + , dpmx(qt_defaultDpiX() * 100. / 2.54) + , dpmy(qt_defaultDpiY() * 100. / 2.54) + , flipped(false) + , engine(0) +{ +} + +class QOpenGLEngineThreadStorage +{ +public: + QPaintEngine *engine() { + QPaintEngine *&localEngine = storage.localData(); + if (!localEngine) + localEngine = new QOpenGL2PaintEngineEx; + return localEngine; + } + +private: + QThreadStorage storage; +}; + +Q_GLOBAL_STATIC(QOpenGLEngineThreadStorage, qt_opengl_engine) + +QPaintEngine *QOpenGLPaintDevice::paintEngine() const +{ + if (d_ptr->engine) + return d_ptr->engine; + + QPaintEngine *engine = qt_opengl_engine()->engine(); + if (engine->isActive() && engine->paintDevice() != this) { + d_ptr->engine = new QOpenGL2PaintEngineEx; + return d_ptr->engine; + } + + return engine; +} + +QOpenGLContext *QOpenGLPaintDevice::context() const +{ + return d_ptr->ctx; +} + +QSize QOpenGLPaintDevice::size() const +{ + return d_ptr->size; +} + +int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const +{ + switch (metric) { + case PdmWidth: + return d_ptr->size.width(); + case PdmHeight: + return d_ptr->size.height(); + case PdmDepth: + return 32; + case PdmWidthMM: + return qRound(d_ptr->size.width() * 1000 / d_ptr->dpmx); + case PdmHeightMM: + return qRound(d_ptr->size.height() * 1000 / d_ptr->dpmy); + case PdmNumColors: + return 0; + case PdmDpiX: + return qRound(d_ptr->dpmx * 0.0254); + case PdmDpiY: + return qRound(d_ptr->dpmy * 0.0254); + case PdmPhysicalDpiX: + return qRound(d_ptr->dpmx * 0.0254); + case PdmPhysicalDpiY: + return qRound(d_ptr->dpmy * 0.0254); + default: + qWarning("QOpenGLPaintDevice::metric() - metric %d not known", metric); + return 0; + } +} + +qreal QOpenGLPaintDevice::dotsPerMeterX() const +{ + return d_ptr->dpmx; +} + +qreal QOpenGLPaintDevice::dotsPerMeterY() const +{ + return d_ptr->dpmy; +} + +void QOpenGLPaintDevice::setDotsPerMeterX(qreal dpmx) +{ + d_ptr->dpmx = dpmx; +} + +void QOpenGLPaintDevice::setDotsPerMeterY(qreal dpmy) +{ + d_ptr->dpmx = dpmy; +} + +/*! + Specifies whether painting should be flipped around the Y-axis or not. +*/ +void QOpenGLPaintDevice::setPaintFlipped(bool flipped) +{ + d_ptr->flipped = flipped; +} + +bool QOpenGLPaintDevice::paintFlipped() const +{ + return d_ptr->flipped; +} + +QT_END_NAMESPACE diff --git a/src/gui/embedded/qwssignalhandler_p.h b/src/gui/opengl/qopenglpaintdevice.h similarity index 64% rename from src/gui/embedded/qwssignalhandler_p.h rename to src/gui/opengl/qopenglpaintdevice.h index dda9c762875..9edc347b321 100644 --- a/src/gui/embedded/qwssignalhandler_p.h +++ b/src/gui/opengl/qopenglpaintdevice.h @@ -39,61 +39,65 @@ ** ****************************************************************************/ -#ifndef QWSSIGNALHANDLER_P_H -#define QWSSIGNALHANDLER_P_H +#ifndef QOPENGLPAINTDEVICE_H +#define QOPENGLPAINTDEVICE_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 +// of the QtGui module. This header file may change from // version to version without notice, or even be removed. // // We mean it. // -#include -#ifndef QT_NO_QWS_SIGNALHANDLER +#include +#include +#include -#include -#include -#include +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -typedef void (*qt_sighandler_t)(int); +QT_MODULE(Gui) -class QWSSignalHandlerPrivate; +class QOpenGLPaintDevicePrivate; -class Q_GUI_EXPORT QWSSignalHandler +class Q_GUI_EXPORT QOpenGLPaintDevice : public QPaintDevice { + Q_DECLARE_PRIVATE(QOpenGLPaintDevice) public: - static QWSSignalHandler* instance(); + QOpenGLPaintDevice(const QSize &size); + QOpenGLPaintDevice(int width, int height); + virtual ~QOpenGLPaintDevice(); - ~QWSSignalHandler(); + int devType() const { return QInternal::OpenGL; } + QPaintEngine *paintEngine() const; -#ifndef QT_NO_QWS_MULTIPROCESS - inline void addSemaphore(int semno) { semaphores.append(semno); } - void removeSemaphore(int semno); -#endif - inline void addObject(QObject *object) { (void)objects.add(object); } + QOpenGLContext *context() const; + QSize size() const; -private: - QWSSignalHandler(); - static void handleSignal(int signal); - QMap oldHandlers; -#ifndef QT_NO_QWS_MULTIPROCESS - QVector semaphores; -#endif - QObjectCleanupHandler objects; + qreal dotsPerMeterX() const; + qreal dotsPerMeterY() const; - friend class QWSSignalHandlerPrivate; + void setDotsPerMeterX(qreal); + void setDotsPerMeterY(qreal); + + void setPaintFlipped(bool flipped); + bool paintFlipped() const; + +protected: + int metric(QPaintDevice::PaintDeviceMetric metric) const; + + Q_DISABLE_COPY(QOpenGLPaintDevice) + QScopedPointer d_ptr; }; QT_END_NAMESPACE -#endif // QT_NO_QWS_SIGNALHANDLER +QT_END_HEADER -#endif // QWSSIGNALHANDLER_P_H +#endif // QOPENGLPAINTDEVICE_H diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp new file mode 100644 index 00000000000..b29cedcdf93 --- /dev/null +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -0,0 +1,2432 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + When the active program changes, we need to update it's uniforms. + We could track state for each program and only update stale uniforms + - Could lead to lots of overhead if there's a lot of programs + We could update all the uniforms when the program changes + - Could end up updating lots of uniforms which don't need updating + + Updating uniforms should be cheap, so the overhead of updating up-to-date + uniforms should be minimal. It's also less complex. + + Things which _may_ cause a different program to be used: + - Change in brush/pen style + - Change in painter opacity + - Change in composition mode + + Whenever we set a mode on the shader manager - it needs to tell us if it had + to switch to a different program. + + The shader manager should only switch when we tell it to. E.g. if we set a new + brush style and then switch to transparent painter, we only want it to compile + and use the correct program when we really need it. +*/ + +// #define QT_OPENGL_CACHE_AS_VBOS + +#include "qopenglgradientcache_p.h" +#include "qopengltexturecache_p.h" +#include "qopenglpaintengine_p.h" + +#include //for memcpy +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "qopenglengineshadermanager_p.h" +#include "qopengl2pexvertexarray_p.h" +#include "qopengltriangulatingstroker_p.h" +#include "qopengltextureglyphcache_p.h" + +#include + +QT_BEGIN_NAMESPACE + +#if defined(Q_WS_WIN) +extern Q_GUI_EXPORT bool qt_cleartype_enabled; +#endif + +#ifdef Q_WS_MAC +extern bool qt_applefontsmoothing_enabled; +#endif + +Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert); + +////////////////////////////////// Private Methods ////////////////////////////////////////// + +QOpenGL2PaintEngineExPrivate::~QOpenGL2PaintEngineExPrivate() +{ + delete shaderManager; + + while (pathCaches.size()) { + QVectorPath::CacheEntry *e = *(pathCaches.constBegin()); + e->cleanup(e->engine, e->data); + e->data = 0; + e->engine = 0; + } + + if (elementIndicesVBOId != 0) { + funcs.glDeleteBuffers(1, &elementIndicesVBOId); + elementIndicesVBOId = 0; + } +} + +void QOpenGL2PaintEngineExPrivate::updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id) +{ +// funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); //### Is it always this texture unit? + if (id != GLuint(-1) && id == lastTextureUsed) + return; + + lastTextureUsed = id; + + if (smoothPixmapTransform) { + glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + } else { + glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } + glTexParameterf(target, GL_TEXTURE_WRAP_S, wrapMode); + glTexParameterf(target, GL_TEXTURE_WRAP_T, wrapMode); +} + + +inline QColor qt_premultiplyColor(QColor c, GLfloat opacity) +{ + qreal alpha = c.alphaF() * opacity; + c.setAlphaF(alpha); + c.setRedF(c.redF() * alpha); + c.setGreenF(c.greenF() * alpha); + c.setBlueF(c.blueF() * alpha); + return c; +} + + +void QOpenGL2PaintEngineExPrivate::setBrush(const QBrush& brush) +{ + if (qbrush_fast_equals(currentBrush, brush)) + return; + + const Qt::BrushStyle newStyle = qbrush_style(brush); + Q_ASSERT(newStyle != Qt::NoBrush); + + currentBrush = brush; + if (!currentBrushPixmap.isNull()) + currentBrushPixmap = QPixmap(); + brushUniformsDirty = true; // All brushes have at least one uniform + + if (newStyle > Qt::SolidPattern) + brushTextureDirty = true; + + if (currentBrush.style() == Qt::TexturePattern + && qHasPixmapTexture(brush) && brush.texture().isQBitmap()) + { + shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::TextureSrcWithPattern); + } else { + shaderManager->setSrcPixelType(newStyle); + } + shaderManager->optimiseForBrushTransform(currentBrush.transform().type()); +} + + +void QOpenGL2PaintEngineExPrivate::useSimpleShader() +{ + shaderManager->useSimpleProgram(); + + if (matrixDirty) + updateMatrix(); +} + +void QOpenGL2PaintEngineExPrivate::updateBrushTexture() +{ + Q_Q(QOpenGL2PaintEngineEx); +// qDebug("QOpenGL2PaintEngineExPrivate::updateBrushTexture()"); + Qt::BrushStyle style = currentBrush.style(); + + if ( (style >= Qt::Dense1Pattern) && (style <= Qt::DiagCrossPattern) ) { + // Get the image data for the pattern + QImage texImage = qt_imageForBrush(style, false); + + funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); + QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, texImage); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); + } + else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { + // Gradiant brush: All the gradiants use the same texture + + const QGradient* g = currentBrush.gradient(); + + // We apply global opacity in the fragment shaders, so we always pass 1.0 + // for opacity to the cache. + GLuint texId = QOpenGL2GradientCache::cacheForContext(ctx)->getBuffer(*g, 1.0); + + funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); + glBindTexture(GL_TEXTURE_2D, texId); + + if (g->spread() == QGradient::RepeatSpread || g->type() == QGradient::ConicalGradient) + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); + else if (g->spread() == QGradient::ReflectSpread) + updateTextureFilter(GL_TEXTURE_2D, GL_MIRRORED_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); + else + updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform); + } + else if (style == Qt::TexturePattern) { + currentBrushPixmap = currentBrush.texture(); + + int max_texture_size = ctx->d_func()->maxTextureSize(); + if (currentBrushPixmap.width() > max_texture_size || currentBrushPixmap.height() > max_texture_size) + currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); + + funcs.glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); + QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, currentBrushPixmap); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); + textureInvertedY = false; + } + brushTextureDirty = false; +} + + +void QOpenGL2PaintEngineExPrivate::updateBrushUniforms() +{ +// qDebug("QOpenGL2PaintEngineExPrivate::updateBrushUniforms()"); + Qt::BrushStyle style = currentBrush.style(); + + if (style == Qt::NoBrush) + return; + + QTransform brushQTransform = currentBrush.transform(); + + if (style == Qt::SolidPattern) { + QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::FragmentColor), col); + } + else { + // All other brushes have a transform and thus need the translation point: + QPointF translationPoint; + + if (style <= Qt::DiagCrossPattern) { + QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); + + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::PatternColor), col); + + QVector2D halfViewportSize(width*0.5, height*0.5); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::HalfViewportSize), halfViewportSize); + } + else if (style == Qt::LinearGradientPattern) { + const QLinearGradient *g = static_cast(currentBrush.gradient()); + + QPointF realStart = g->start(); + QPointF realFinal = g->finalStop(); + translationPoint = realStart; + + QPointF l = realFinal - realStart; + + QVector3D linearData( + l.x(), + l.y(), + 1.0f / (l.x() * l.x() + l.y() * l.y()) + ); + + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::LinearData), linearData); + + QVector2D halfViewportSize(width*0.5, height*0.5); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::HalfViewportSize), halfViewportSize); + } + else if (style == Qt::ConicalGradientPattern) { + const QConicalGradient *g = static_cast(currentBrush.gradient()); + translationPoint = g->center(); + + GLfloat angle = -(g->angle() * 2 * Q_PI) / 360.0; + + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Angle), angle); + + QVector2D halfViewportSize(width*0.5, height*0.5); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::HalfViewportSize), halfViewportSize); + } + else if (style == Qt::RadialGradientPattern) { + const QRadialGradient *g = static_cast(currentBrush.gradient()); + QPointF realCenter = g->center(); + QPointF realFocal = g->focalPoint(); + qreal realRadius = g->centerRadius() - g->focalRadius(); + translationPoint = realFocal; + + QPointF fmp = realCenter - realFocal; + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Fmp), fmp); + + GLfloat fmp2_m_radius2 = -fmp.x() * fmp.x() - fmp.y() * fmp.y() + realRadius*realRadius; + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Fmp2MRadius2), fmp2_m_radius2); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Inverse2Fmp2MRadius2), + GLfloat(1.0 / (2.0*fmp2_m_radius2))); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::SqrFr), + GLfloat(g->focalRadius() * g->focalRadius())); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::BRadius), + GLfloat(2 * (g->centerRadius() - g->focalRadius()) * g->focalRadius()), + g->focalRadius(), + g->centerRadius() - g->focalRadius()); + + QVector2D halfViewportSize(width*0.5, height*0.5); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::HalfViewportSize), halfViewportSize); + } + else if (style == Qt::TexturePattern) { + const QPixmap& texPixmap = currentBrush.texture(); + + if (qHasPixmapTexture(currentBrush) && currentBrush.texture().isQBitmap()) { + QColor col = qt_premultiplyColor(currentBrush.color(), (GLfloat)q->state()->opacity); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::PatternColor), col); + } + + QSizeF invertedTextureSize(1.0 / texPixmap.width(), 1.0 / texPixmap.height()); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::InvertedTextureSize), invertedTextureSize); + + QVector2D halfViewportSize(width*0.5, height*0.5); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::HalfViewportSize), halfViewportSize); + } + else + qWarning("QOpenGL2PaintEngineEx: Unimplemented fill style"); + + const QPointF &brushOrigin = q->state()->brushOrigin; + QTransform matrix = q->state()->matrix; + matrix.translate(brushOrigin.x(), brushOrigin.y()); + + QTransform translate(1, 0, 0, 1, -translationPoint.x(), -translationPoint.y()); + qreal m22 = -1; + qreal dy = height; + if (device->paintFlipped()) { + m22 = 1; + dy = 0; + } + QTransform gl_to_qt(1, 0, 0, m22, 0, dy); + QTransform inv_matrix; + if (style == Qt::TexturePattern && textureInvertedY == -1) + inv_matrix = gl_to_qt * (QTransform(1, 0, 0, -1, 0, currentBrush.texture().height()) * brushQTransform * matrix).inverted() * translate; + else + inv_matrix = gl_to_qt * (brushQTransform * matrix).inverted() * translate; + + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::BrushTransform), inv_matrix); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::BrushTexture), QT_BRUSH_TEXTURE_UNIT); + } + brushUniformsDirty = false; +} + + +// This assumes the shader manager has already setup the correct shader program +void QOpenGL2PaintEngineExPrivate::updateMatrix() +{ +// qDebug("QOpenGL2PaintEngineExPrivate::updateMatrix()"); + + const QTransform& transform = q->state()->matrix; + + // The projection matrix converts from Qt's coordinate system to GL's coordinate system + // * GL's viewport is 2x2, Qt's is width x height + // * GL has +y -> -y going from bottom -> top, Qt is the other way round + // * GL has [0,0] in the center, Qt has it in the top-left + // + // This results in the Projection matrix below, which is multiplied by the painter's + // transformation matrix, as shown below: + // + // Projection Matrix Painter Transform + // ------------------------------------------------ ------------------------ + // | 2.0 / width | 0.0 | -1.0 | | m11 | m21 | dx | + // | 0.0 | -2.0 / height | 1.0 | * | m12 | m22 | dy | + // | 0.0 | 0.0 | 1.0 | | m13 | m23 | m33 | + // ------------------------------------------------ ------------------------ + // + // NOTE: The resultant matrix is also transposed, as GL expects column-major matracies + + const GLfloat wfactor = 2.0f / width; + GLfloat hfactor = -2.0f / height; + + GLfloat dx = transform.dx(); + GLfloat dy = transform.dy(); + + if (device->paintFlipped()) { + hfactor *= -1; + dy -= height; + } + + // Non-integer translates can have strange effects for some rendering operations such as + // anti-aliased text rendering. In such cases, we snap the translate to the pixel grid. + if (snapToPixelGrid && transform.type() == QTransform::TxTranslate) { + // 0.50 needs to rounded down to 0.0 for consistency with raster engine: + dx = ceilf(dx - 0.5f); + dy = ceilf(dy - 0.5f); + } + pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13(); + pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23(); + pmvMatrix[2][0] = (wfactor * dx) - transform.m33(); + pmvMatrix[0][1] = (hfactor * transform.m12()) + transform.m13(); + pmvMatrix[1][1] = (hfactor * transform.m22()) + transform.m23(); + pmvMatrix[2][1] = (hfactor * dy) + transform.m33(); + pmvMatrix[0][2] = transform.m13(); + pmvMatrix[1][2] = transform.m23(); + pmvMatrix[2][2] = transform.m33(); + + // 1/10000 == 0.0001, so we have good enough res to cover curves + // that span the entire widget... + inverseScale = qMax(1 / qMax( qMax(qAbs(transform.m11()), qAbs(transform.m22())), + qMax(qAbs(transform.m12()), qAbs(transform.m21())) ), + qreal(0.0001)); + + matrixDirty = false; + matrixUniformDirty = true; + + // Set the PMV matrix attribute. As we use an attributes rather than uniforms, we only + // need to do this once for every matrix change and persists across all shader programs. + funcs.glVertexAttrib3fv(QT_PMV_MATRIX_1_ATTR, pmvMatrix[0]); + funcs.glVertexAttrib3fv(QT_PMV_MATRIX_2_ATTR, pmvMatrix[1]); + funcs.glVertexAttrib3fv(QT_PMV_MATRIX_3_ATTR, pmvMatrix[2]); + + dasher.setInvScale(inverseScale); + stroker.setInvScale(inverseScale); +} + + +void QOpenGL2PaintEngineExPrivate::updateCompositionMode() +{ + // NOTE: The entire paint engine works on pre-multiplied data - which is why some of these + // composition modes look odd. +// qDebug() << "QOpenGL2PaintEngineExPrivate::updateCompositionMode() - Setting GL composition mode for " << q->state()->composition_mode; + switch(q->state()->composition_mode) { + case QPainter::CompositionMode_SourceOver: + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + break; + case QPainter::CompositionMode_DestinationOver: + glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); + break; + case QPainter::CompositionMode_Clear: + glBlendFunc(GL_ZERO, GL_ZERO); + break; + case QPainter::CompositionMode_Source: + glBlendFunc(GL_ONE, GL_ZERO); + break; + case QPainter::CompositionMode_Destination: + glBlendFunc(GL_ZERO, GL_ONE); + break; + case QPainter::CompositionMode_SourceIn: + glBlendFunc(GL_DST_ALPHA, GL_ZERO); + break; + case QPainter::CompositionMode_DestinationIn: + glBlendFunc(GL_ZERO, GL_SRC_ALPHA); + break; + case QPainter::CompositionMode_SourceOut: + glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO); + break; + case QPainter::CompositionMode_DestinationOut: + glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); + break; + case QPainter::CompositionMode_SourceAtop: + glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + break; + case QPainter::CompositionMode_DestinationAtop: + glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA); + break; + case QPainter::CompositionMode_Xor: + glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + break; + case QPainter::CompositionMode_Plus: + glBlendFunc(GL_ONE, GL_ONE); + break; + default: + qWarning("Unsupported composition mode"); + break; + } + + compositionModeDirty = false; +} + +static inline void setCoords(GLfloat *coords, const QOpenGLRect &rect) +{ + coords[0] = rect.left; + coords[1] = rect.top; + coords[2] = rect.right; + coords[3] = rect.top; + coords[4] = rect.right; + coords[5] = rect.bottom; + coords[6] = rect.left; + coords[7] = rect.bottom; +} + +void QOpenGL2PaintEngineExPrivate::drawTexture(const QOpenGLRect& dest, const QOpenGLRect& src, const QSize &textureSize, bool opaque, bool pattern) +{ + // Setup for texture drawing + currentBrush = noBrush; + shaderManager->setSrcPixelType(pattern ? QOpenGLEngineShaderManager::PatternSrc : QOpenGLEngineShaderManager::ImageSrc); + + if (snapToPixelGrid) { + snapToPixelGrid = false; + matrixDirty = true; + } + + if (prepareForDraw(opaque)) + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT); + + if (pattern) { + QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::PatternColor), col); + } + + GLfloat dx = 1.0 / textureSize.width(); + GLfloat dy = 1.0 / textureSize.height(); + + QOpenGLRect srcTextureRect(src.left*dx, src.top*dy, src.right*dx, src.bottom*dy); + + setCoords(staticVertexCoordinateArray, dest); + setCoords(staticTextureCoordinateArray, srcTextureRect); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); +} + +void QOpenGL2PaintEngineEx::beginNativePainting() +{ + Q_D(QOpenGL2PaintEngineEx); + ensureActive(); + d->transferMode(BrushDrawingMode); + + d->nativePaintingActive = true; + + d->funcs.glUseProgram(0); + + // Disable all the vertex attribute arrays: + for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) + d->funcs.glDisableVertexAttribArray(i); + +#ifndef QT_OPENGL_ES_2 + Q_ASSERT(QOpenGLContext::currentContext()); + const QSurfaceFormat &fmt = d->device->context()->format(); + if (fmt.majorVersion() < 3 || (fmt.majorVersion() == 3 && fmt.minorVersion() < 1) + || fmt.profile() == QSurfaceFormat::CompatibilityProfile) + { + // be nice to people who mix OpenGL 1.x code with QPainter commands + // by setting modelview and projection matrices to mirror the GL 1 + // paint engine + const QTransform& mtx = state()->matrix; + + float mv_matrix[4][4] = + { + { float(mtx.m11()), float(mtx.m12()), 0, float(mtx.m13()) }, + { float(mtx.m21()), float(mtx.m22()), 0, float(mtx.m23()) }, + { 0, 0, 1, 0 }, + { float(mtx.dx()), float(mtx.dy()), 0, float(mtx.m33()) } + }; + + const QSize sz = d->device->size(); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999); + + glMatrixMode(GL_MODELVIEW); + glLoadMatrixf(&mv_matrix[0][0]); + } +#endif + + d->lastTextureUsed = GLuint(-1); + d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); + d->resetGLState(); + + d->shaderManager->setDirty(); + + d->needsSync = true; +} + +void QOpenGL2PaintEngineExPrivate::resetGLState() +{ + glDisable(GL_BLEND); + funcs.glActiveTexture(GL_TEXTURE0); + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDepthMask(true); + glDepthFunc(GL_LESS); + funcs.glClearDepthf(1); + glStencilMask(0xff); + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + glStencilFunc(GL_ALWAYS, 0, 0xff); + setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false); + setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, false); + setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false); +#ifndef QT_OPENGL_ES_2 + // gl_Color, corresponding to vertex attribute 3, may have been changed + float color[] = { 1.0f, 1.0f, 1.0f, 1.0f }; + funcs.glVertexAttrib4fv(3, color); +#endif +} + +void QOpenGL2PaintEngineEx::endNativePainting() +{ + Q_D(QOpenGL2PaintEngineEx); + d->needsSync = true; + d->nativePaintingActive = false; +} + +void QOpenGL2PaintEngineEx::invalidateState() +{ + Q_D(QOpenGL2PaintEngineEx); + d->needsSync = true; +} + +bool QOpenGL2PaintEngineEx::isNativePaintingActive() const { + Q_D(const QOpenGL2PaintEngineEx); + return d->nativePaintingActive; +} + +void QOpenGL2PaintEngineExPrivate::transferMode(EngineMode newMode) +{ + if (newMode == mode) + return; + + if (mode == TextDrawingMode || mode == ImageDrawingMode || mode == ImageArrayDrawingMode) { + lastTextureUsed = GLuint(-1); + } + + if (newMode == TextDrawingMode) { + shaderManager->setHasComplexGeometry(true); + } else { + shaderManager->setHasComplexGeometry(false); + } + + if (newMode == ImageDrawingMode) { + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray); + } + + if (newMode == ImageArrayDrawingMode) { + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); + setVertexAttributePointer(QT_OPACITY_ATTR, (GLfloat*)opacityArray.data()); + } + + // This needs to change when we implement high-quality anti-aliasing... + if (newMode != TextDrawingMode) + shaderManager->setMaskType(QOpenGLEngineShaderManager::NoMask); + + mode = newMode; +} + +struct QOpenGL2PEVectorPathCache +{ +#ifdef QT_OPENGL_CACHE_AS_VBOS + GLuint vbo; + GLuint ibo; +#else + float *vertices; + void *indices; +#endif + int vertexCount; + int indexCount; + GLenum primitiveType; + qreal iscale; + QVertexIndexVector::Type indexType; +}; + +void QOpenGL2PaintEngineExPrivate::cleanupVectorPath(QPaintEngineEx *engine, void *data) +{ + QOpenGL2PEVectorPathCache *c = (QOpenGL2PEVectorPathCache *) data; +#ifdef QT_OPENGL_CACHE_AS_VBOS + Q_ASSERT(engine->type() == QPaintEngine::OpenGL2); + static_cast(engine)->d_func()->unusedVBOSToClean << c->vbo; + if (c->ibo) + d->unusedIBOSToClean << c->ibo; +#else + Q_UNUSED(engine); + qFree(c->vertices); + qFree(c->indices); +#endif + delete c; +} + +// Assumes everything is configured for the brush you want to use +void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path) +{ + transferMode(BrushDrawingMode); + + if (snapToPixelGrid) { + snapToPixelGrid = false; + matrixDirty = true; + } + + // Might need to call updateMatrix to re-calculate inverseScale + if (matrixDirty) + updateMatrix(); + + const QPointF* const points = reinterpret_cast(path.points()); + + // Check to see if there's any hints + if (path.shape() == QVectorPath::RectangleHint) { + QOpenGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y()); + prepareForDraw(currentBrush.isOpaque()); + composite(rect); + } else if (path.isConvex()) { + + if (path.isCacheable()) { + QVectorPath::CacheEntry *data = path.lookupCacheData(q); + QOpenGL2PEVectorPathCache *cache; + + bool updateCache = false; + + if (data) { + cache = (QOpenGL2PEVectorPathCache *) data->data; + // Check if scale factor is exceeded for curved paths and generate curves if so... + if (path.isCurved()) { + qreal scaleFactor = cache->iscale / inverseScale; + if (scaleFactor < 0.5 || scaleFactor > 2.0) { +#ifdef QT_OPENGL_CACHE_AS_VBOS + glDeleteBuffers(1, &cache->vbo); + cache->vbo = 0; + Q_ASSERT(cache->ibo == 0); +#else + qFree(cache->vertices); + Q_ASSERT(cache->indices == 0); +#endif + updateCache = true; + } + } + } else { + cache = new QOpenGL2PEVectorPathCache; + data = const_cast(path).addCacheData(q, cache, cleanupVectorPath); + updateCache = true; + } + + // Flatten the path at the current scale factor and fill it into the cache struct. + if (updateCache) { + vertexCoordinateArray.clear(); + vertexCoordinateArray.addPath(path, inverseScale, false); + int vertexCount = vertexCoordinateArray.vertexCount(); + int floatSizeInBytes = vertexCount * 2 * sizeof(float); + cache->vertexCount = vertexCount; + cache->indexCount = 0; + cache->primitiveType = GL_TRIANGLE_FAN; + cache->iscale = inverseScale; +#ifdef QT_OPENGL_CACHE_AS_VBOS + glGenBuffers(1, &cache->vbo); + glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); + glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW); + cache->ibo = 0; +#else + cache->vertices = (float *) qMalloc(floatSizeInBytes); + memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes); + cache->indices = 0; +#endif + } + + prepareForDraw(currentBrush.isOpaque()); +#ifdef QT_OPENGL_CACHE_AS_VBOS + glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); +#else + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); +#endif + glDrawArrays(cache->primitiveType, 0, cache->vertexCount); + + } else { + // printf(" - Marking path as cachable...\n"); + // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable + path.makeCacheable(); + vertexCoordinateArray.clear(); + vertexCoordinateArray.addPath(path, inverseScale, false); + prepareForDraw(currentBrush.isOpaque()); + drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); + } + + } else { + bool useCache = path.isCacheable(); + if (useCache) { + QRectF bbox = path.controlPointRect(); + // If the path doesn't fit within these limits, it is possible that the triangulation will fail. + useCache &= (bbox.left() > -0x8000 * inverseScale) + && (bbox.right() < 0x8000 * inverseScale) + && (bbox.top() > -0x8000 * inverseScale) + && (bbox.bottom() < 0x8000 * inverseScale); + } + + if (useCache) { + QVectorPath::CacheEntry *data = path.lookupCacheData(q); + QOpenGL2PEVectorPathCache *cache; + + bool updateCache = false; + + if (data) { + cache = (QOpenGL2PEVectorPathCache *) data->data; + // Check if scale factor is exceeded for curved paths and generate curves if so... + if (path.isCurved()) { + qreal scaleFactor = cache->iscale / inverseScale; + if (scaleFactor < 0.5 || scaleFactor > 2.0) { +#ifdef QT_OPENGL_CACHE_AS_VBOS + glDeleteBuffers(1, &cache->vbo); + glDeleteBuffers(1, &cache->ibo); +#else + qFree(cache->vertices); + qFree(cache->indices); +#endif + updateCache = true; + } + } + } else { + cache = new QOpenGL2PEVectorPathCache; + data = const_cast(path).addCacheData(q, cache, cleanupVectorPath); + updateCache = true; + } + + // Flatten the path at the current scale factor and fill it into the cache struct. + if (updateCache) { + QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale)); + cache->vertexCount = polys.vertices.size() / 2; + cache->indexCount = polys.indices.size(); + cache->primitiveType = GL_TRIANGLES; + cache->iscale = inverseScale; + cache->indexType = polys.indices.type(); +#ifdef QT_OPENGL_CACHE_AS_VBOS + glGenBuffers(1, &cache->vbo); + glGenBuffers(1, &cache->ibo); + glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); + + if (polys.indices.type() == QVertexIndexVector::UnsignedInt) + funcs.glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint32) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW); + else + funcs.glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint16) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW); + + QVarLengthArray vertices(polys.vertices.size()); + for (int i = 0; i < polys.vertices.size(); ++i) + vertices[i] = float(inverseScale * polys.vertices.at(i)); + funcs.glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW); +#else + cache->vertices = (float *) qMalloc(sizeof(float) * polys.vertices.size()); + if (polys.indices.type() == QVertexIndexVector::UnsignedInt) { + cache->indices = (quint32 *) qMalloc(sizeof(quint32) * polys.indices.size()); + memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size()); + } else { + cache->indices = (quint16 *) qMalloc(sizeof(quint16) * polys.indices.size()); + memcpy(cache->indices, polys.indices.data(), sizeof(quint16) * polys.indices.size()); + } + for (int i = 0; i < polys.vertices.size(); ++i) + cache->vertices[i] = float(inverseScale * polys.vertices.at(i)); +#endif + } + + prepareForDraw(currentBrush.isOpaque()); +#ifdef QT_OPENGL_CACHE_AS_VBOS + glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); + if (cache->indexType == QVertexIndexVector::UnsignedInt) + glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0); + else + glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); +#else + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); + if (cache->indexType == QVertexIndexVector::UnsignedInt) + glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices); + else + glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices); +#endif + + } else { + // printf(" - Marking path as cachable...\n"); + // Tag it for later so that if the same path is drawn twice, it is assumed to be static and thus cachable + path.makeCacheable(); + + if (device->context()->format().stencilBufferSize() == 0) { + // If there is no stencil buffer, triangulate the path instead. + + QRectF bbox = path.controlPointRect(); + // If the path doesn't fit within these limits, it is possible that the triangulation will fail. + bool withinLimits = (bbox.left() > -0x8000 * inverseScale) + && (bbox.right() < 0x8000 * inverseScale) + && (bbox.top() > -0x8000 * inverseScale) + && (bbox.bottom() < 0x8000 * inverseScale); + if (withinLimits) { + QTriangleSet polys = qTriangulate(path, QTransform().scale(1 / inverseScale, 1 / inverseScale)); + + QVarLengthArray vertices(polys.vertices.size()); + for (int i = 0; i < polys.vertices.size(); ++i) + vertices[i] = float(inverseScale * polys.vertices.at(i)); + + prepareForDraw(currentBrush.isOpaque()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData()); + if (funcs.hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint)) + glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.data()); + else + glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_SHORT, polys.indices.data()); + } else { + // We can't handle big, concave painter paths with OpenGL without stencil buffer. + qWarning("Painter path exceeds +/-32767 pixels."); + } + return; + } + + // The path is too complicated & needs the stencil technique + vertexCoordinateArray.clear(); + vertexCoordinateArray.addPath(path, inverseScale, false); + + fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); + + glStencilMask(0xff); + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + + if (q->state()->clipTestEnabled) { + // Pass when high bit is set, replace stencil value with current clip + glStencilFunc(GL_NOTEQUAL, q->state()->currentClip, GL_STENCIL_HIGH_BIT); + } else if (path.hasWindingFill()) { + // Pass when any bit is set, replace stencil value with 0 + glStencilFunc(GL_NOTEQUAL, 0, 0xff); + } else { + // Pass when high bit is set, replace stencil value with 0 + glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT); + } + prepareForDraw(currentBrush.isOpaque()); + + // Stencil the brush onto the dest buffer + composite(vertexCoordinateArray.boundingRect()); + glStencilMask(0); + updateClipScissorTest(); + } + } +} + + +void QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, + int count, + int *stops, + int stopCount, + const QOpenGLRect &bounds, + StencilFillMode mode) +{ + Q_ASSERT(count || stops); + +// qDebug("QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray()"); + glStencilMask(0xff); // Enable stencil writes + + if (dirtyStencilRegion.intersects(currentScissorBounds)) { + QVector clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); + glClearStencil(0); // Clear to zero + for (int i = 0; i < clearRegion.size(); ++i) { +#ifndef QT_GL_NO_SCISSOR_TEST + setScissor(clearRegion.at(i)); +#endif + glClear(GL_STENCIL_BUFFER_BIT); + } + + dirtyStencilRegion -= currentScissorBounds; + +#ifndef QT_GL_NO_SCISSOR_TEST + updateClipScissorTest(); +#endif + } + + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes + useSimpleShader(); + glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d + + if (mode == WindingFillMode) { + Q_ASSERT(stops && !count); + if (q->state()->clipTestEnabled) { + // Flatten clip values higher than current clip, and set high bit to match current clip + glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + composite(bounds); + + glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT); + } else if (!stencilClean) { + // Clear stencil buffer within bounding rect + glStencilFunc(GL_ALWAYS, 0, 0xff); + glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); + composite(bounds); + } + + // Inc. for front-facing triangle + funcs.glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_INCR_WRAP, GL_INCR_WRAP); + // Dec. for back-facing "holes" + funcs.glStencilOpSeparate(GL_BACK, GL_KEEP, GL_DECR_WRAP, GL_DECR_WRAP); + glStencilMask(~GL_STENCIL_HIGH_BIT); + drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN); + + if (q->state()->clipTestEnabled) { + // Clear high bit of stencil outside of path + glStencilFunc(GL_EQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + glStencilMask(GL_STENCIL_HIGH_BIT); + composite(bounds); + } + } else if (mode == OddEvenFillMode) { + glStencilMask(GL_STENCIL_HIGH_BIT); + glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit + drawVertexArrays(data, stops, stopCount, GL_TRIANGLE_FAN); + + } else { // TriStripStrokeFillMode + Q_ASSERT(count && !stops); // tristrips generated directly, so no vertexArray or stops + glStencilMask(GL_STENCIL_HIGH_BIT); +#if 0 + glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); + glDrawArrays(GL_TRIANGLE_STRIP, 0, count); +#else + + glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); + if (q->state()->clipTestEnabled) { + glStencilFunc(GL_LEQUAL, q->state()->currentClip | GL_STENCIL_HIGH_BIT, + ~GL_STENCIL_HIGH_BIT); + } else { + glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff); + } + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); + glDrawArrays(GL_TRIANGLE_STRIP, 0, count); +#endif + } + + // Enable color writes & disable stencil writes + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); +} + +/* + If the maximum value in the stencil buffer is GL_STENCIL_HIGH_BIT - 1, + restore the stencil buffer to a pristine state. The current clip region + is set to 1, and the rest to 0. +*/ +void QOpenGL2PaintEngineExPrivate::resetClipIfNeeded() +{ + if (maxClip != (GL_STENCIL_HIGH_BIT - 1)) + return; + + Q_Q(QOpenGL2PaintEngineEx); + + useSimpleShader(); + glEnable(GL_STENCIL_TEST); + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + + QRectF bounds = q->state()->matrix.inverted().mapRect(QRectF(0, 0, width, height)); + QOpenGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom()); + + // Set high bit on clip region + glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xff); + glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); + glStencilMask(GL_STENCIL_HIGH_BIT); + composite(rect); + + // Reset clipping to 1 and everything else to zero + glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT); + glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE); + glStencilMask(0xff); + composite(rect); + + q->state()->currentClip = 1; + q->state()->canRestoreClip = false; + + maxClip = 1; + + glStencilMask(0x0); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); +} + +bool QOpenGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) +{ + if (brushTextureDirty && mode != ImageDrawingMode && mode != ImageArrayDrawingMode) + updateBrushTexture(); + + if (compositionModeDirty) + updateCompositionMode(); + + if (matrixDirty) + updateMatrix(); + + const bool stateHasOpacity = q->state()->opacity < 0.99f; + if (q->state()->composition_mode == QPainter::CompositionMode_Source + || (q->state()->composition_mode == QPainter::CompositionMode_SourceOver + && srcPixelsAreOpaque && !stateHasOpacity)) + { + glDisable(GL_BLEND); + } else { + glEnable(GL_BLEND); + } + + QOpenGLEngineShaderManager::OpacityMode opacityMode; + if (mode == ImageArrayDrawingMode) { + opacityMode = QOpenGLEngineShaderManager::AttributeOpacity; + } else { + opacityMode = stateHasOpacity ? QOpenGLEngineShaderManager::UniformOpacity + : QOpenGLEngineShaderManager::NoOpacity; + if (stateHasOpacity && (mode != ImageDrawingMode)) { + // Using a brush + bool brushIsPattern = (currentBrush.style() >= Qt::Dense1Pattern) && + (currentBrush.style() <= Qt::DiagCrossPattern); + + if ((currentBrush.style() == Qt::SolidPattern) || brushIsPattern) + opacityMode = QOpenGLEngineShaderManager::NoOpacity; // Global opacity handled by srcPixel shader + } + } + shaderManager->setOpacityMode(opacityMode); + + bool changed = shaderManager->useCorrectShaderProg(); + // If the shader program needs changing, we change it and mark all uniforms as dirty + if (changed) { + // The shader program has changed so mark all uniforms as dirty: + brushUniformsDirty = true; + opacityUniformDirty = true; + matrixUniformDirty = true; + } + + if (brushUniformsDirty && mode != ImageDrawingMode && mode != ImageArrayDrawingMode) + updateBrushUniforms(); + + if (opacityMode == QOpenGLEngineShaderManager::UniformOpacity && opacityUniformDirty) { + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::GlobalOpacity), (GLfloat)q->state()->opacity); + opacityUniformDirty = false; + } + + if (matrixUniformDirty && shaderManager->hasComplexGeometry()) { + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::Matrix), + pmvMatrix); + matrixUniformDirty = false; + } + + return changed; +} + +void QOpenGL2PaintEngineExPrivate::composite(const QOpenGLRect& boundingRect) +{ + setCoords(staticVertexCoordinateArray, boundingRect); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); +} + +// Draws the vertex array as a set of triangle fans. +void QOpenGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, int stopCount, + GLenum primitive) +{ + // Now setup the pointer to the vertex array: + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)data); + + int previousStop = 0; + for (int i=0; i %d:", previousStop, stop-1); + for (int i=previousStop; isetBrush(brush); + d->fill(path); +} + +Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp + + +void QOpenGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) +{ + Q_D(QOpenGL2PaintEngineEx); + + const QBrush &penBrush = qpen_brush(pen); + if (qpen_style(pen) == Qt::NoPen || qbrush_style(penBrush) == Qt::NoBrush) + return; + + QOpenGL2PaintEngineState *s = state(); + if (pen.isCosmetic() && !qt_scaleForTransform(s->transform(), 0)) { + // QTriangulatingStroker class is not meant to support cosmetically sheared strokes. + QPaintEngineEx::stroke(path, pen); + return; + } + + ensureActive(); + d->setBrush(penBrush); + d->stroke(path, pen); +} + +void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &pen) +{ + const QOpenGL2PaintEngineState *s = q->state(); + if (snapToPixelGrid) { + snapToPixelGrid = false; + matrixDirty = true; + } + + const Qt::PenStyle penStyle = qpen_style(pen); + const QBrush &penBrush = qpen_brush(pen); + const bool opaque = penBrush.isOpaque() && s->opacity > 0.99; + + transferMode(BrushDrawingMode); + + // updateMatrix() is responsible for setting the inverse scale on + // the strokers, so we need to call it here and not wait for + // prepareForDraw() down below. + updateMatrix(); + + QRectF clip = q->state()->matrix.inverted().mapRect(q->state()->clipEnabled + ? q->state()->rectangleClip + : QRectF(0, 0, width, height)); + + if (penStyle == Qt::SolidLine) { + stroker.process(path, pen, clip); + + } else { // Some sort of dash + dasher.process(path, pen, clip); + + QVectorPath dashStroke(dasher.points(), + dasher.elementCount(), + dasher.elementTypes()); + stroker.process(dashStroke, pen, clip); + } + + if (!stroker.vertexCount()) + return; + + if (opaque) { + prepareForDraw(opaque); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, stroker.vertices()); + glDrawArrays(GL_TRIANGLE_STRIP, 0, stroker.vertexCount() / 2); + +// QBrush b(Qt::green); +// d->setBrush(&b); +// d->prepareForDraw(true); +// glDrawArrays(GL_LINE_STRIP, 0, d->stroker.vertexCount() / 2); + + } else { + qreal width = qpen_widthf(pen) / 2; + if (width == 0) + width = 0.5; + qreal extra = pen.joinStyle() == Qt::MiterJoin + ? qMax(pen.miterLimit() * width, width) + : width; + + if (pen.isCosmetic()) + extra = extra * inverseScale; + + QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra); + + fillStencilWithVertexArray(stroker.vertices(), stroker.vertexCount() / 2, + 0, 0, bounds, QOpenGL2PaintEngineExPrivate::TriStripStrokeFillMode); + + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + + // Pass when any bit is set, replace stencil value with 0 + glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT); + prepareForDraw(false); + + // Stencil the brush onto the dest buffer + composite(bounds); + + glStencilMask(0); + + updateClipScissorTest(); + } +} + +void QOpenGL2PaintEngineEx::penChanged() { } +void QOpenGL2PaintEngineEx::brushChanged() { } +void QOpenGL2PaintEngineEx::brushOriginChanged() { } + +void QOpenGL2PaintEngineEx::opacityChanged() +{ +// qDebug("QOpenGL2PaintEngineEx::opacityChanged()"); + Q_D(QOpenGL2PaintEngineEx); + state()->opacityChanged = true; + + Q_ASSERT(d->shaderManager); + d->brushUniformsDirty = true; + d->opacityUniformDirty = true; +} + +void QOpenGL2PaintEngineEx::compositionModeChanged() +{ +// qDebug("QOpenGL2PaintEngineEx::compositionModeChanged()"); + Q_D(QOpenGL2PaintEngineEx); + state()->compositionModeChanged = true; + d->compositionModeDirty = true; +} + +void QOpenGL2PaintEngineEx::renderHintsChanged() +{ + state()->renderHintsChanged = true; + +#if !defined(QT_OPENGL_ES_2) + if ((state()->renderHints & QPainter::Antialiasing) + || (state()->renderHints & QPainter::HighQualityAntialiasing)) + glEnable(GL_MULTISAMPLE); + else + glDisable(GL_MULTISAMPLE); +#endif + + Q_D(QOpenGL2PaintEngineEx); + d->lastTextureUsed = GLuint(-1); + d->brushTextureDirty = true; +// qDebug("QOpenGL2PaintEngineEx::renderHintsChanged() not implemented!"); +} + +void QOpenGL2PaintEngineEx::transformChanged() +{ + Q_D(QOpenGL2PaintEngineEx); + d->matrixDirty = true; + state()->matrixChanged = true; +} + + +static const QRectF scaleRect(const QRectF &r, qreal sx, qreal sy) +{ + return QRectF(r.x() * sx, r.y() * sy, r.width() * sx, r.height() * sy); +} + +void QOpenGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, const QRectF & src) +{ + Q_D(QOpenGL2PaintEngineEx); + QOpenGLContext *ctx = d->ctx; + + int max_texture_size = ctx->d_func()->maxTextureSize(); + if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) { + QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); + + const qreal sx = scaled.width() / qreal(pixmap.width()); + const qreal sy = scaled.height() / qreal(pixmap.height()); + + drawPixmap(dest, scaled, scaleRect(src, sx, sy)); + return; + } + + ensureActive(); + d->transferMode(ImageDrawingMode); + + d->funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); + GLuint id = QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, pixmap); + + QOpenGLRect srcRect(src.left(), src.top(), src.right(), src.bottom()); + + bool isBitmap = pixmap.isQBitmap(); + bool isOpaque = !isBitmap && !pixmap.hasAlpha(); + + d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, + state()->renderHints & QPainter::SmoothPixmapTransform, id); + d->drawTexture(dest, srcRect, pixmap.size(), isOpaque, isBitmap); +} + +void QOpenGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const QRectF& src, + Qt::ImageConversionFlags) +{ + Q_D(QOpenGL2PaintEngineEx); + QOpenGLContext *ctx = d->ctx; + + int max_texture_size = ctx->d_func()->maxTextureSize(); + if (image.width() > max_texture_size || image.height() > max_texture_size) { + QImage scaled = image.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); + + const qreal sx = scaled.width() / qreal(image.width()); + const qreal sy = scaled.height() / qreal(image.height()); + + drawImage(dest, scaled, scaleRect(src, sx, sy)); + return; + } + + ensureActive(); + d->transferMode(ImageDrawingMode); + + d->funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); + + GLuint id = QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, image); + + d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, + state()->renderHints & QPainter::SmoothPixmapTransform, id); + d->drawTexture(dest, src, image.size(), !image.hasAlphaChannel()); +} + +void QOpenGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem) +{ + Q_D(QOpenGL2PaintEngineEx); + + ensureActive(); + + QPainterState *s = state(); + float det = s->matrix.determinant(); + + // don't try to cache huge fonts or vastly transformed fonts + QFontEngine *fontEngine = textItem->fontEngine(); + const qreal pixelSize = fontEngine->fontDef.pixelSize; + if (shouldDrawCachedGlyphs(pixelSize, s->matrix) || det < 0.25f || det > 4.f) { + QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 + ? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat) + : d->glyphCacheType; + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { + if (d->device->context()->format().alphaBufferSize() > 0 || s->matrix.type() > QTransform::TxTranslate + || (s->composition_mode != QPainter::CompositionMode_Source + && s->composition_mode != QPainter::CompositionMode_SourceOver)) + { + glyphType = QFontEngineGlyphCache::Raster_A8; + } + } + + d->drawCachedGlyphs(glyphType, textItem); + } else { + QPaintEngineEx::drawStaticTextItem(textItem); + } +} + +bool QOpenGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src) +{ + Q_D(QOpenGL2PaintEngineEx); + if (!d->shaderManager) + return false; + + ensureActive(); + d->transferMode(ImageDrawingMode); + + d->funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); + glBindTexture(GL_TEXTURE_2D, textureId); + + QOpenGLRect srcRect(src.left(), src.bottom(), src.right(), src.top()); + + d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, + state()->renderHints & QPainter::SmoothPixmapTransform, textureId); + d->drawTexture(dest, srcRect, size, false); + return true; +} + +void QOpenGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem) +{ + Q_D(QOpenGL2PaintEngineEx); + + ensureActive(); + QOpenGL2PaintEngineState *s = state(); + + const QTextItemInt &ti = static_cast(textItem); + + QTransform::TransformationType txtype = s->matrix.type(); + + float det = s->matrix.determinant(); + bool drawCached = txtype < QTransform::TxProject; + + // don't try to cache huge fonts or vastly transformed fonts + const qreal pixelSize = ti.fontEngine->fontDef.pixelSize; + if (shouldDrawCachedGlyphs(pixelSize, s->matrix) || det < 0.25f || det > 4.f) + drawCached = false; + + QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0 + ? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat) + : d->glyphCacheType; + + + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { + if (d->device->context()->format().alphaBufferSize() > 0 || txtype > QTransform::TxTranslate + || (state()->composition_mode != QPainter::CompositionMode_Source + && state()->composition_mode != QPainter::CompositionMode_SourceOver)) + { + glyphType = QFontEngineGlyphCache::Raster_A8; + } + } + + if (drawCached) { + QVarLengthArray positions; + QVarLengthArray glyphs; + QTransform matrix = QTransform::fromTranslate(p.x(), p.y()); + ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); + + { + QStaticTextItem staticTextItem; + staticTextItem.chars = const_cast(ti.chars); + staticTextItem.setFontEngine(ti.fontEngine); + staticTextItem.glyphs = glyphs.data(); + staticTextItem.numChars = ti.num_chars; + staticTextItem.numGlyphs = glyphs.size(); + staticTextItem.glyphPositions = positions.data(); + + d->drawCachedGlyphs(glyphType, &staticTextItem); + } + return; + } + + QPaintEngineEx::drawTextItem(p, ti); +} + +namespace { + + class QOpenGLStaticTextUserData: public QStaticTextUserData + { + public: + QOpenGLStaticTextUserData() + : QStaticTextUserData(OpenGLUserData), cacheSize(0, 0), cacheSerialNumber(0) + { + } + + ~QOpenGLStaticTextUserData() + { + } + + QSize cacheSize; + QOpenGL2PEXVertexArray vertexCoordinateArray; + QOpenGL2PEXVertexArray textureCoordinateArray; + QFontEngineGlyphCache::Type glyphType; + int cacheSerialNumber; + }; + +} + +#if defined(Q_WS_WIN) +static bool fontSmoothingApproximately(qreal target) +{ + extern Q_GUI_EXPORT qreal qt_fontsmoothing_gamma; // qapplication_win.cpp + return (qAbs(qt_fontsmoothing_gamma - target) < 0.2); +} +#endif + +// #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO + +void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, + QStaticTextItem *staticTextItem) +{ + Q_Q(QOpenGL2PaintEngineEx); + + QOpenGL2PaintEngineState *s = q->state(); + + void *cacheKey = ctx->shareGroup(); + bool recreateVertexArrays = false; + + QOpenGLTextureGlyphCache *cache = + (QOpenGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(cacheKey, glyphType, QTransform()); + if (!cache || cache->cacheType() != glyphType || cache->contextGroup() == 0) { + cache = new QOpenGLTextureGlyphCache(glyphType, QTransform()); + staticTextItem->fontEngine()->setGlyphCache(cacheKey, cache); + recreateVertexArrays = true; + } + + if (staticTextItem->userDataNeedsUpdate) { + recreateVertexArrays = true; + } else if (staticTextItem->userData() == 0) { + recreateVertexArrays = true; + } else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) { + recreateVertexArrays = true; + } else { + QOpenGLStaticTextUserData *userData = static_cast(staticTextItem->userData()); + if (userData->glyphType != glyphType) { + recreateVertexArrays = true; + } else if (userData->cacheSerialNumber != cache->serialNumber()) { + recreateVertexArrays = true; + } + } + + // We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays. + // If the cache size has changed, we do need to regenerate the vertices, but we don't need to repopulate the + // cache so this text is performed before we test if the cache size has changed. + if (recreateVertexArrays) { + cache->setPaintEnginePrivate(this); + if (!cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs, + staticTextItem->glyphs, staticTextItem->glyphPositions)) { + // No space for glyphs in cache. We need to reset it and try again. + cache->clear(); + cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs, + staticTextItem->glyphs, staticTextItem->glyphPositions); + } + cache->fillInPendingGlyphs(); + } + + if (cache->width() == 0 || cache->height() == 0) + return; + + transferMode(TextDrawingMode); + + int margin = cache->glyphMargin(); + + GLfloat dx = 1.0 / cache->width(); + GLfloat dy = 1.0 / cache->height(); + + // Use global arrays by default + QOpenGL2PEXVertexArray *vertexCoordinates = &vertexCoordinateArray; + QOpenGL2PEXVertexArray *textureCoordinates = &textureCoordinateArray; + + if (staticTextItem->useBackendOptimizations) { + QOpenGLStaticTextUserData *userData = 0; + + if (staticTextItem->userData() == 0 + || staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) { + + userData = new QOpenGLStaticTextUserData(); + staticTextItem->setUserData(userData); + + } else { + userData = static_cast(staticTextItem->userData()); + } + + userData->glyphType = glyphType; + userData->cacheSerialNumber = cache->serialNumber(); + + // Use cache if backend optimizations is turned on + vertexCoordinates = &userData->vertexCoordinateArray; + textureCoordinates = &userData->textureCoordinateArray; + + QSize size(cache->width(), cache->height()); + if (userData->cacheSize != size) { + recreateVertexArrays = true; + userData->cacheSize = size; + } + } + + if (recreateVertexArrays) { + vertexCoordinates->clear(); + textureCoordinates->clear(); + + bool supportsSubPixelPositions = staticTextItem->fontEngine()->supportsSubPixelPositions(); + for (int i=0; inumGlyphs; ++i) { + QFixed subPixelPosition; + if (supportsSubPixelPositions) + subPixelPosition = cache->subPixelPositionForX(staticTextItem->glyphPositions[i].x); + + QTextureGlyphCache::GlyphAndSubPixelPosition glyph(staticTextItem->glyphs[i], subPixelPosition); + + const QTextureGlyphCache::Coord &c = cache->coords[glyph]; + if (c.isNull()) + continue; + + int x = qFloor(staticTextItem->glyphPositions[i].x) + c.baseLineX - margin; + int y = qFloor(staticTextItem->glyphPositions[i].y) - c.baseLineY - margin; + + vertexCoordinates->addQuad(QRectF(x, y, c.w, c.h)); + textureCoordinates->addQuad(QRectF(c.x*dx, c.y*dy, c.w * dx, c.h * dy)); + } + + staticTextItem->userDataNeedsUpdate = false; + } + + int numGlyphs = vertexCoordinates->vertexCount() / 4; + if (numGlyphs == 0) + return; + + if (elementIndices.size() < numGlyphs*6) { + Q_ASSERT(elementIndices.size() % 6 == 0); + int j = elementIndices.size() / 6 * 4; + while (j < numGlyphs*4) { + elementIndices.append(j + 0); + elementIndices.append(j + 0); + elementIndices.append(j + 1); + elementIndices.append(j + 2); + elementIndices.append(j + 3); + elementIndices.append(j + 3); + + j += 4; + } + +#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) + if (elementIndicesVBOId == 0) + glGenBuffers(1, &elementIndicesVBOId); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementIndices.size() * sizeof(GLushort), + elementIndices.constData(), GL_STATIC_DRAW); +#endif + } else { +#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementIndicesVBOId); +#endif + } + + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinates->data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinates->data()); + + if (!snapToPixelGrid) { + snapToPixelGrid = true; + matrixDirty = true; + } + + QBrush pensBrush = q->state()->pen.brush(); + setBrush(pensBrush); + + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { + + // Subpixel antialiasing without gamma correction + + QPainter::CompositionMode compMode = q->state()->composition_mode; + Q_ASSERT(compMode == QPainter::CompositionMode_Source + || compMode == QPainter::CompositionMode_SourceOver); + + shaderManager->setMaskType(QOpenGLEngineShaderManager::SubPixelMaskPass1); + + if (pensBrush.style() == Qt::SolidPattern) { + // Solid patterns can get away with only one pass. + QColor c = pensBrush.color(); + qreal oldOpacity = q->state()->opacity; + if (compMode == QPainter::CompositionMode_Source) { + c = qt_premultiplyColor(c, q->state()->opacity); + q->state()->opacity = 1; + opacityUniformDirty = true; + } + + compositionModeDirty = false; // I can handle this myself, thank you very much + prepareForDraw(false); // Text always causes src pixels to be transparent + + // prepareForDraw() have set the opacity on the current shader, so the opacity state can now be reset. + if (compMode == QPainter::CompositionMode_Source) { + q->state()->opacity = oldOpacity; + opacityUniformDirty = true; + } + + glEnable(GL_BLEND); + glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR); + funcs.glBlendColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()); + } else { + // Other brush styles need two passes. + + qreal oldOpacity = q->state()->opacity; + if (compMode == QPainter::CompositionMode_Source) { + q->state()->opacity = 1; + opacityUniformDirty = true; + pensBrush = Qt::white; + setBrush(pensBrush); + } + + compositionModeDirty = false; // I can handle this myself, thank you very much + prepareForDraw(false); // Text always causes src pixels to be transparent + glEnable(GL_BLEND); + glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); + + funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT); + glBindTexture(GL_TEXTURE_2D, cache->texture()); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false); + +#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) + glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); +#else + glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); +#endif + + shaderManager->setMaskType(QOpenGLEngineShaderManager::SubPixelMaskPass2); + + if (compMode == QPainter::CompositionMode_Source) { + q->state()->opacity = oldOpacity; + opacityUniformDirty = true; + pensBrush = q->state()->pen.brush(); + setBrush(pensBrush); + } + + compositionModeDirty = false; + prepareForDraw(false); // Text always causes src pixels to be transparent + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); + } + compositionModeDirty = true; + } else { + // Greyscale/mono glyphs + + shaderManager->setMaskType(QOpenGLEngineShaderManager::PixelMask); + prepareForDraw(false); // Text always causes src pixels to be transparent + } + + QOpenGLTextureGlyphCache::FilterMode filterMode = (s->matrix.type() > QTransform::TxTranslate)?QOpenGLTextureGlyphCache::Linear:QOpenGLTextureGlyphCache::Nearest; + if (lastMaskTextureUsed != cache->texture() || cache->filterMode() != filterMode) { + + funcs.glActiveTexture(GL_TEXTURE0 + QT_MASK_TEXTURE_UNIT); + if (lastMaskTextureUsed != cache->texture()) { + glBindTexture(GL_TEXTURE_2D, cache->texture()); + lastMaskTextureUsed = cache->texture(); + } + + if (cache->filterMode() != filterMode) { + if (filterMode == QOpenGLTextureGlyphCache::Linear) { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + } else { + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } + cache->setFilterMode(filterMode); + } + } + + bool srgbFrameBufferEnabled = false; + if (funcs.hasOpenGLExtension(QOpenGLExtensions::SRGBFrameBuffer)) { +#if defined(Q_WS_MAC) + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) +#elif defined(Q_WS_WIN) + if (glyphType != QFontEngineGlyphCache::Raster_RGBMask || fontSmoothingApproximately(2.1)) +#else + if (false) +#endif + { + glEnable(GL_FRAMEBUFFER_SRGB); + srgbFrameBufferEnabled = true; + } + } + +#if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) + glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); +#else + glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); +#endif + + if (srgbFrameBufferEnabled) + glDisable(GL_FRAMEBUFFER_SRGB); + +} + +void QOpenGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints) +{ + Q_D(QOpenGL2PaintEngineEx); + // Use fallback for extended composition modes. + if (state()->composition_mode > QPainter::CompositionMode_Plus) { + QPaintEngineEx::drawPixmapFragments(fragments, fragmentCount, pixmap, hints); + return; + } + + ensureActive(); + int max_texture_size = d->ctx->d_func()->maxTextureSize(); + if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) { + QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); + d->drawPixmapFragments(fragments, fragmentCount, scaled, hints); + } else { + d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); + } +} + + +void QOpenGL2PaintEngineExPrivate::drawPixmapFragments(const QPainter::PixmapFragment *fragments, + int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints) +{ + GLfloat dx = 1.0f / pixmap.size().width(); + GLfloat dy = 1.0f / pixmap.size().height(); + + vertexCoordinateArray.clear(); + textureCoordinateArray.clear(); + opacityArray.reset(); + + if (snapToPixelGrid) { + snapToPixelGrid = false; + matrixDirty = true; + } + + bool allOpaque = true; + + for (int i = 0; i < fragmentCount; ++i) { + qreal s = 0; + qreal c = 1; + if (fragments[i].rotation != 0) { + s = qFastSin(fragments[i].rotation * Q_PI / 180); + c = qFastCos(fragments[i].rotation * Q_PI / 180); + } + + qreal right = 0.5 * fragments[i].scaleX * fragments[i].width; + qreal bottom = 0.5 * fragments[i].scaleY * fragments[i].height; + QOpenGLPoint bottomRight(right * c - bottom * s, right * s + bottom * c); + QOpenGLPoint bottomLeft(-right * c - bottom * s, -right * s + bottom * c); + + vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); + vertexCoordinateArray.addVertex(-bottomLeft.x + fragments[i].x, -bottomLeft.y + fragments[i].y); + vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); + vertexCoordinateArray.addVertex(-bottomRight.x + fragments[i].x, -bottomRight.y + fragments[i].y); + vertexCoordinateArray.addVertex(bottomLeft.x + fragments[i].x, bottomLeft.y + fragments[i].y); + vertexCoordinateArray.addVertex(bottomRight.x + fragments[i].x, bottomRight.y + fragments[i].y); + + QOpenGLRect src(fragments[i].sourceLeft * dx, fragments[i].sourceTop * dy, + (fragments[i].sourceLeft + fragments[i].width) * dx, + (fragments[i].sourceTop + fragments[i].height) * dy); + + textureCoordinateArray.addVertex(src.right, src.bottom); + textureCoordinateArray.addVertex(src.right, src.top); + textureCoordinateArray.addVertex(src.left, src.top); + textureCoordinateArray.addVertex(src.left, src.top); + textureCoordinateArray.addVertex(src.left, src.bottom); + textureCoordinateArray.addVertex(src.right, src.bottom); + + qreal opacity = fragments[i].opacity * q->state()->opacity; + opacityArray << opacity << opacity << opacity << opacity << opacity << opacity; + allOpaque &= (opacity >= 0.99f); + } + + funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); + GLuint id = QOpenGLTextureCache::cacheForContext(ctx)->bindTexture(ctx, pixmap); + transferMode(ImageArrayDrawingMode); + + bool isBitmap = pixmap.isQBitmap(); + bool isOpaque = !isBitmap && (!pixmap.hasAlpha() || (hints & QPainter::OpaqueHint)) && allOpaque; + + updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, + q->state()->renderHints & QPainter::SmoothPixmapTransform, id); + + // Setup for texture drawing + currentBrush = noBrush; + shaderManager->setSrcPixelType(isBitmap ? QOpenGLEngineShaderManager::PatternSrc + : QOpenGLEngineShaderManager::ImageSrc); + if (prepareForDraw(isOpaque)) + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::ImageTexture), QT_IMAGE_TEXTURE_UNIT); + + if (isBitmap) { + QColor col = qt_premultiplyColor(q->state()->pen.color(), (GLfloat)q->state()->opacity); + shaderManager->currentProgram()->setUniformValue(location(QOpenGLEngineShaderManager::PatternColor), col); + } + + glDrawArrays(GL_TRIANGLES, 0, 6 * fragmentCount); +} + +bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev) +{ + Q_D(QOpenGL2PaintEngineEx); + + Q_ASSERT(pdev->devType() == QInternal::OpenGL); + d->device = static_cast(pdev); + + if (!d->device) + return false; + + if (d->device->context() != QOpenGLContext::currentContext()) { + qWarning("QPainter::begin(): QOpenGLPaintDevice's context needs to be current"); + return false; + } + + d->ctx = QOpenGLContext::currentContext(); + d->ctx->d_func()->active_engine = this; + + d->funcs.initializeGLFunctions(); + + for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) + d->vertexAttributeArraysEnabledState[i] = false; + + const QSize sz = d->device->size(); + d->width = sz.width(); + d->height = sz.height(); + d->mode = BrushDrawingMode; + d->brushTextureDirty = true; + d->brushUniformsDirty = true; + d->matrixUniformDirty = true; + d->matrixDirty = true; + d->compositionModeDirty = true; + d->opacityUniformDirty = true; + d->needsSync = true; + d->useSystemClip = !systemClip().isEmpty(); + d->currentBrush = QBrush(); + + d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); + d->stencilClean = true; + + d->shaderManager = new QOpenGLEngineShaderManager(d->ctx); + + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + +#if !defined(QT_OPENGL_ES_2) + glDisable(GL_MULTISAMPLE); +#endif + + d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; + +#if !defined(QT_OPENGL_ES_2) +#if defined(Q_WS_WIN) + if (qt_cleartype_enabled + && (fontSmoothingApproximately(1.0) || fontSmoothingApproximately(2.1))) +#endif +#if defined(Q_WS_MAC) + if (qt_applefontsmoothing_enabled) +#endif + d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask; +#endif + +#if defined(QT_OPENGL_ES_2) + // OpenGL ES can't switch MSAA off, so if the gl paint device is + // multisampled, it's always multisampled. + d->multisamplingAlwaysEnabled = d->device->context()->format().samples() > 1; +#else + d->multisamplingAlwaysEnabled = false; +#endif + + return true; +} + +bool QOpenGL2PaintEngineEx::end() +{ + Q_D(QOpenGL2PaintEngineEx); + + QOpenGLContext *ctx = d->ctx; + d->funcs.glUseProgram(0); + d->transferMode(BrushDrawingMode); + + ctx->d_func()->active_engine = 0; + + d->resetGLState(); + + delete d->shaderManager; + d->shaderManager = 0; + d->currentBrush = QBrush(); + +#ifdef QT_OPENGL_CACHE_AS_VBOS + if (!d->unusedVBOSToClean.isEmpty()) { + glDeleteBuffers(d->unusedVBOSToClean.size(), d->unusedVBOSToClean.constData()); + d->unusedVBOSToClean.clear(); + } + if (!d->unusedIBOSToClean.isEmpty()) { + glDeleteBuffers(d->unusedIBOSToClean.size(), d->unusedIBOSToClean.constData()); + d->unusedIBOSToClean.clear(); + } +#endif + + return false; +} + +void QOpenGL2PaintEngineEx::ensureActive() +{ + Q_D(QOpenGL2PaintEngineEx); + QOpenGLContext *ctx = d->ctx; + + if (isActive() && ctx->d_func()->active_engine != this) { + ctx->d_func()->active_engine = this; + d->needsSync = true; + } + + if (d->needsSync) { + d->transferMode(BrushDrawingMode); + glViewport(0, 0, d->width, d->height); + d->needsSync = false; + d->lastMaskTextureUsed = 0; + d->shaderManager->setDirty(); + d->syncGlState(); + for (int i = 0; i < 3; ++i) + d->vertexAttribPointers[i] = (GLfloat*)-1; // Assume the pointers are clobbered + setState(state()); + } +} + +void QOpenGL2PaintEngineExPrivate::updateClipScissorTest() +{ + Q_Q(QOpenGL2PaintEngineEx); + if (q->state()->clipTestEnabled) { + glEnable(GL_STENCIL_TEST); + glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + } else { + glDisable(GL_STENCIL_TEST); + glStencilFunc(GL_ALWAYS, 0, 0xff); + } + +#ifdef QT_GL_NO_SCISSOR_TEST + currentScissorBounds = QRect(0, 0, width, height); +#else + QRect bounds = q->state()->rectangleClip; + if (!q->state()->clipEnabled) { + if (useSystemClip) + bounds = systemClip.boundingRect(); + else + bounds = QRect(0, 0, width, height); + } else { + if (useSystemClip) + bounds = bounds.intersected(systemClip.boundingRect()); + else + bounds = bounds.intersected(QRect(0, 0, width, height)); + } + + currentScissorBounds = bounds; + + if (bounds == QRect(0, 0, width, height)) { + glDisable(GL_SCISSOR_TEST); + } else { + glEnable(GL_SCISSOR_TEST); + setScissor(bounds); + } +#endif +} + +void QOpenGL2PaintEngineExPrivate::setScissor(const QRect &rect) +{ + const int left = rect.left(); + const int width = rect.width(); + int bottom = height - (rect.top() + rect.height()); + if (device->paintFlipped()) { + bottom = rect.top(); + } + const int height = rect.height(); + + glScissor(left, bottom, width, height); +} + +void QOpenGL2PaintEngineEx::clipEnabledChanged() +{ + Q_D(QOpenGL2PaintEngineEx); + + state()->clipChanged = true; + + if (painter()->hasClipping()) + d->regenerateClip(); + else + d->systemStateChanged(); +} + +void QOpenGL2PaintEngineExPrivate::clearClip(uint value) +{ + dirtyStencilRegion -= currentScissorBounds; + + glStencilMask(0xff); + glClearStencil(value); + glClear(GL_STENCIL_BUFFER_BIT); + glStencilMask(0x0); + + q->state()->needsClipBufferClear = false; +} + +void QOpenGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) +{ + transferMode(BrushDrawingMode); + + if (snapToPixelGrid) { + snapToPixelGrid = false; + matrixDirty = true; + } + + if (matrixDirty) + updateMatrix(); + + stencilClean = false; + + const bool singlePass = !path.hasWindingFill() + && (((q->state()->currentClip == maxClip - 1) && q->state()->clipTestEnabled) + || q->state()->needsClipBufferClear); + const uint referenceClipValue = q->state()->needsClipBufferClear ? 1 : q->state()->currentClip; + + if (q->state()->needsClipBufferClear) + clearClip(1); + + if (path.isEmpty()) { + glEnable(GL_STENCIL_TEST); + glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT); + return; + } + + if (q->state()->clipTestEnabled) + glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); + else + glStencilFunc(GL_ALWAYS, 0, 0xff); + + vertexCoordinateArray.clear(); + vertexCoordinateArray.addPath(path, inverseScale, false); + + if (!singlePass) + fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); + + glColorMask(false, false, false, false); + glEnable(GL_STENCIL_TEST); + useSimpleShader(); + + if (singlePass) { + // Under these conditions we can set the new stencil value in a single + // pass, by using the current value and the "new value" as the toggles + + glStencilFunc(GL_LEQUAL, referenceClipValue, ~GL_STENCIL_HIGH_BIT); + glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); + glStencilMask(value ^ referenceClipValue); + + drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); + } else { + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + glStencilMask(0xff); + + if (!q->state()->clipTestEnabled && path.hasWindingFill()) { + // Pass when any clip bit is set, set high bit + glStencilFunc(GL_NOTEQUAL, GL_STENCIL_HIGH_BIT, ~GL_STENCIL_HIGH_BIT); + composite(vertexCoordinateArray.boundingRect()); + } + + // Pass when high bit is set, replace stencil value with new clip value + glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT); + + composite(vertexCoordinateArray.boundingRect()); + } + + glStencilFunc(GL_LEQUAL, value, ~GL_STENCIL_HIGH_BIT); + glStencilMask(0); + + glColorMask(true, true, true, true); +} + +void QOpenGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op) +{ +// qDebug("QOpenGL2PaintEngineEx::clip()"); + Q_D(QOpenGL2PaintEngineEx); + + state()->clipChanged = true; + + ensureActive(); + + if (op == Qt::ReplaceClip) { + op = Qt::IntersectClip; + if (d->hasClipOperations()) { + d->systemStateChanged(); + state()->canRestoreClip = false; + } + } + +#ifndef QT_GL_NO_SCISSOR_TEST + if (!path.isEmpty() && op == Qt::IntersectClip && (path.shape() == QVectorPath::RectangleHint)) { + const QPointF* const points = reinterpret_cast(path.points()); + QRectF rect(points[0], points[2]); + + if (state()->matrix.type() <= QTransform::TxScale + || (state()->matrix.type() == QTransform::TxRotate + && qFuzzyIsNull(state()->matrix.m11()) + && qFuzzyIsNull(state()->matrix.m22()))) + { + state()->rectangleClip = state()->rectangleClip.intersected(state()->matrix.mapRect(rect).toRect()); + d->updateClipScissorTest(); + return; + } + } +#endif + + const QRect pathRect = state()->matrix.mapRect(path.controlPointRect()).toAlignedRect(); + + switch (op) { + case Qt::NoClip: + if (d->useSystemClip) { + state()->clipTestEnabled = true; + state()->currentClip = 1; + } else { + state()->clipTestEnabled = false; + } + state()->rectangleClip = QRect(0, 0, d->width, d->height); + state()->canRestoreClip = false; + d->updateClipScissorTest(); + break; + case Qt::IntersectClip: + state()->rectangleClip = state()->rectangleClip.intersected(pathRect); + d->updateClipScissorTest(); + d->resetClipIfNeeded(); + ++d->maxClip; + d->writeClip(path, d->maxClip); + state()->currentClip = d->maxClip; + state()->clipTestEnabled = true; + break; + default: + break; + } +} + +void QOpenGL2PaintEngineExPrivate::regenerateClip() +{ + systemStateChanged(); + replayClipOperations(); +} + +void QOpenGL2PaintEngineExPrivate::systemStateChanged() +{ + Q_Q(QOpenGL2PaintEngineEx); + + q->state()->clipChanged = true; + + if (systemClip.isEmpty()) { + useSystemClip = false; + } else { + if (q->paintDevice()->devType() == QInternal::Widget && currentClipDevice) { + //QWidgetPrivate *widgetPrivate = qt_widget_private(static_cast(currentClipDevice)->window()); + //useSystemClip = widgetPrivate->extra && widgetPrivate->extra->inRenderWithPainter; + useSystemClip = true; + } else { + useSystemClip = true; + } + } + + q->state()->clipTestEnabled = false; + q->state()->needsClipBufferClear = true; + + q->state()->currentClip = 1; + maxClip = 1; + + q->state()->rectangleClip = useSystemClip ? systemClip.boundingRect() : QRect(0, 0, width, height); + updateClipScissorTest(); + + if (systemClip.rectCount() == 1) { + if (systemClip.boundingRect() == QRect(0, 0, width, height)) + useSystemClip = false; +#ifndef QT_GL_NO_SCISSOR_TEST + // scissoring takes care of the system clip + return; +#endif + } + + if (useSystemClip) { + clearClip(0); + + QPainterPath path; + path.addRegion(systemClip); + + q->state()->currentClip = 0; + writeClip(qtVectorPathForPath(q->state()->matrix.inverted().map(path)), 1); + q->state()->currentClip = 1; + q->state()->clipTestEnabled = true; + } +} + +void QOpenGL2PaintEngineEx::setState(QPainterState *new_state) +{ + // qDebug("QOpenGL2PaintEngineEx::setState()"); + + Q_D(QOpenGL2PaintEngineEx); + + QOpenGL2PaintEngineState *s = static_cast(new_state); + QOpenGL2PaintEngineState *old_state = state(); + + QPaintEngineEx::setState(s); + + if (s->isNew) { + // Newly created state object. The call to setState() + // will either be followed by a call to begin(), or we are + // setting the state as part of a save(). + s->isNew = false; + return; + } + + // Setting the state as part of a restore(). + + if (old_state == s || old_state->renderHintsChanged) + renderHintsChanged(); + + if (old_state == s || old_state->matrixChanged) + d->matrixDirty = true; + + if (old_state == s || old_state->compositionModeChanged) + d->compositionModeDirty = true; + + if (old_state == s || old_state->opacityChanged) + d->opacityUniformDirty = true; + + if (old_state == s || old_state->clipChanged) { + if (old_state && old_state != s && old_state->canRestoreClip) { + d->updateClipScissorTest(); + glDepthFunc(GL_LEQUAL); + } else { + d->regenerateClip(); + } + } +} + +QPainterState *QOpenGL2PaintEngineEx::createState(QPainterState *orig) const +{ + if (orig) + const_cast(this)->ensureActive(); + + QOpenGL2PaintEngineState *s; + if (!orig) + s = new QOpenGL2PaintEngineState(); + else + s = new QOpenGL2PaintEngineState(*static_cast(orig)); + + s->matrixChanged = false; + s->compositionModeChanged = false; + s->opacityChanged = false; + s->renderHintsChanged = false; + s->clipChanged = false; + + return s; +} + +QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other) + : QPainterState(other) +{ + isNew = true; + needsClipBufferClear = other.needsClipBufferClear; + clipTestEnabled = other.clipTestEnabled; + currentClip = other.currentClip; + canRestoreClip = other.canRestoreClip; + rectangleClip = other.rectangleClip; +} + +QOpenGL2PaintEngineState::QOpenGL2PaintEngineState() +{ + isNew = true; + needsClipBufferClear = true; + clipTestEnabled = false; + canRestoreClip = true; +} + +QOpenGL2PaintEngineState::~QOpenGL2PaintEngineState() +{ +} + +void QOpenGL2PaintEngineExPrivate::setVertexAttribArrayEnabled(int arrayIndex, bool enabled) +{ + Q_ASSERT(arrayIndex < QT_GL_VERTEX_ARRAY_TRACKED_COUNT); + + if (vertexAttributeArraysEnabledState[arrayIndex] && !enabled) + funcs.glDisableVertexAttribArray(arrayIndex); + + if (!vertexAttributeArraysEnabledState[arrayIndex] && enabled) + funcs.glEnableVertexAttribArray(arrayIndex); + + vertexAttributeArraysEnabledState[arrayIndex] = enabled; +} + +void QOpenGL2PaintEngineExPrivate::syncGlState() +{ + for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) { + if (vertexAttributeArraysEnabledState[i]) + funcs.glEnableVertexAttribArray(i); + else + funcs.glDisableVertexAttribArray(i); + } +} + + +QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h new file mode 100644 index 00000000000..1ce04eb5a74 --- /dev/null +++ b/src/gui/opengl/qopenglpaintengine_p.h @@ -0,0 +1,339 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENGLPAINTENGINE_P_H +#define QOPENGLPAINTENGINE_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 +#include +#include +#include + +#include + +enum EngineMode { + ImageDrawingMode, + TextDrawingMode, + BrushDrawingMode, + ImageArrayDrawingMode +}; + +QT_BEGIN_NAMESPACE + +#define GL_STENCIL_HIGH_BIT GLuint(0x80) +#define QT_BRUSH_TEXTURE_UNIT GLuint(0) +#define QT_IMAGE_TEXTURE_UNIT GLuint(0) //Can be the same as brush texture unit +#define QT_MASK_TEXTURE_UNIT GLuint(1) +#define QT_BACKGROUND_TEXTURE_UNIT GLuint(2) + +class QOpenGL2PaintEngineExPrivate; + +class QOpenGL2PaintEngineState : public QPainterState +{ +public: + QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other); + QOpenGL2PaintEngineState(); + ~QOpenGL2PaintEngineState(); + + uint isNew : 1; + uint needsClipBufferClear : 1; + uint clipTestEnabled : 1; + uint canRestoreClip : 1; + uint matrixChanged : 1; + uint compositionModeChanged : 1; + uint opacityChanged : 1; + uint renderHintsChanged : 1; + uint clipChanged : 1; + uint currentClip : 8; + + QRect rectangleClip; +}; + +class Q_GUI_EXPORT QOpenGL2PaintEngineEx : public QPaintEngineEx +{ + Q_DECLARE_PRIVATE(QOpenGL2PaintEngineEx) +public: + QOpenGL2PaintEngineEx(); + ~QOpenGL2PaintEngineEx(); + + bool begin(QPaintDevice *device); + void ensureActive(); + bool end(); + + 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 drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); + virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints); + virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, + Qt::ImageConversionFlags flags = Qt::AutoColor); + virtual void drawTextItem(const QPointF &p, const QTextItem &textItem); + 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 drawStaticTextItem(QStaticTextItem *textItem); + + bool drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr); + + Type type() const { return OpenGL2; } + + virtual void setState(QPainterState *s); + virtual QPainterState *createState(QPainterState *orig) const; + inline QOpenGL2PaintEngineState *state() { + return static_cast(QPaintEngineEx::state()); + } + inline const QOpenGL2PaintEngineState *state() const { + return static_cast(QPaintEngineEx::state()); + } + + void beginNativePainting(); + void endNativePainting(); + + void invalidateState(); + + void setRenderTextActive(bool); + + bool isNativePaintingActive() const; + bool supportsTransformations(qreal, const QTransform &) const { return true; } + +private: + Q_DISABLE_COPY(QOpenGL2PaintEngineEx) + + friend class QOpenGLEngineShaderManager; +}; + +// This probably needs to grow to GL_MAX_VERTEX_ATTRIBS, but 3 is ok for now as that's +// all the GL2 engine uses: +#define QT_GL_VERTEX_ARRAY_TRACKED_COUNT 3 + +class QOpenGL2PaintEngineExPrivate : public QPaintEngineExPrivate +{ + Q_DECLARE_PUBLIC(QOpenGL2PaintEngineEx) +public: + enum StencilFillMode { + OddEvenFillMode, + WindingFillMode, + TriStripStrokeFillMode + }; + + QOpenGL2PaintEngineExPrivate(QOpenGL2PaintEngineEx *q_ptr) : + q(q_ptr), + shaderManager(0), + width(0), height(0), + ctx(0), + useSystemClip(true), + elementIndicesVBOId(0), + opacityArray(0), + snapToPixelGrid(false), + nativePaintingActive(false), + inverseScale(1), + lastMaskTextureUsed(0) + { } + + ~QOpenGL2PaintEngineExPrivate(); + + void updateBrushTexture(); + void updateBrushUniforms(); + void updateMatrix(); + void updateCompositionMode(); + void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform, GLuint id = -1); + + void resetGLState(); + + // fill, stroke, drawTexture, drawPixmaps & drawCachedGlyphs are the main rendering entry-points, + // however writeClip can also be thought of as en entry point as it does similar things. + void fill(const QVectorPath &path); + void stroke(const QVectorPath &path, const QPen &pen); + void drawTexture(const QOpenGLRect& dest, const QOpenGLRect& src, const QSize &textureSize, bool opaque, bool pattern = false); + void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, + QPainter::PixmapFragmentHints hints); + void drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, QStaticTextItem *staticTextItem); + + // Calls glVertexAttributePointer if the pointer has changed + inline void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer); + + // draws whatever is in the vertex array: + void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive); + void drawVertexArrays(QOpenGL2PEXVertexArray &vertexArray, GLenum primitive) { + drawVertexArrays((const float *) vertexArray.data(), vertexArray.stops(), vertexArray.stopCount(), primitive); + } + + // Composites the bounding rect onto dest buffer: + void composite(const QOpenGLRect& boundingRect); + + // Calls drawVertexArrays to render into stencil buffer: + void fillStencilWithVertexArray(const float *data, int count, int *stops, int stopCount, const QOpenGLRect &bounds, StencilFillMode mode); + void fillStencilWithVertexArray(QOpenGL2PEXVertexArray& vertexArray, bool useWindingFill) { + fillStencilWithVertexArray((const float *) vertexArray.data(), 0, vertexArray.stops(), vertexArray.stopCount(), + vertexArray.boundingRect(), + useWindingFill ? WindingFillMode : OddEvenFillMode); + } + + void setBrush(const QBrush& brush); + void transferMode(EngineMode newMode); + bool prepareForDraw(bool srcPixelsAreOpaque); // returns true if the program has changed + inline void useSimpleShader(); + inline GLuint location(const QOpenGLEngineShaderManager::Uniform uniform) { + return shaderManager->getUniformLocation(uniform); + } + + void clearClip(uint value); + void writeClip(const QVectorPath &path, uint value); + void resetClipIfNeeded(); + + void updateClipScissorTest(); + void setScissor(const QRect &rect); + void regenerateClip(); + void systemStateChanged(); + + void setVertexAttribArrayEnabled(int arrayIndex, bool enabled = true); + void syncGlState(); + + static QOpenGLEngineShaderManager* shaderManagerForEngine(QOpenGL2PaintEngineEx *engine) { return engine->d_func()->shaderManager; } + static QOpenGL2PaintEngineExPrivate *getData(QOpenGL2PaintEngineEx *engine) { return engine->d_func(); } + static void cleanupVectorPath(QPaintEngineEx *engine, void *data); + + QOpenGLExtensions funcs; + + QOpenGL2PaintEngineEx* q; + QOpenGLEngineShaderManager* shaderManager; + QOpenGLPaintDevice* device; + int width, height; + QOpenGLContext *ctx; + EngineMode mode; + QFontEngineGlyphCache::Type glyphCacheType; + + bool vertexAttributeArraysEnabledState[QT_GL_VERTEX_ARRAY_TRACKED_COUNT]; + + // Dirty flags + bool matrixDirty; // Implies matrix uniforms are also dirty + bool compositionModeDirty; + bool brushTextureDirty; + bool brushUniformsDirty; + bool opacityUniformDirty; + bool matrixUniformDirty; + + bool stencilClean; // Has the stencil not been used for clipping so far? + bool useSystemClip; + QRegion dirtyStencilRegion; + QRect currentScissorBounds; + uint maxClip; + + QBrush currentBrush; // May not be the state's brush! + const QBrush noBrush; + + QPixmap currentBrushPixmap; + + QOpenGL2PEXVertexArray vertexCoordinateArray; + QOpenGL2PEXVertexArray textureCoordinateArray; + QVector elementIndices; + GLuint elementIndicesVBOId; + QDataBuffer opacityArray; + GLfloat staticVertexCoordinateArray[8]; + GLfloat staticTextureCoordinateArray[8]; + + bool snapToPixelGrid; + bool nativePaintingActive; + GLfloat pmvMatrix[3][3]; + GLfloat inverseScale; + + GLuint lastTextureUsed; + GLuint lastMaskTextureUsed; + + bool needsSync; + bool multisamplingAlwaysEnabled; + + GLfloat depthRange[2]; + + float textureInvertedY; + + QTriangulatingStroker stroker; + QDashedStrokeProcessor dasher; + + QSet pathCaches; + QVector unusedVBOSToClean; + QVector unusedIBOSToClean; + + const GLfloat *vertexAttribPointers[3]; +}; + + +void QOpenGL2PaintEngineExPrivate::setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer) +{ + Q_ASSERT(arrayIndex < 3); + if (pointer == vertexAttribPointers[arrayIndex]) + return; + + vertexAttribPointers[arrayIndex] = pointer; + if (arrayIndex == QT_OPACITY_ATTR) + funcs.glVertexAttribPointer(arrayIndex, 1, GL_FLOAT, GL_FALSE, 0, pointer); + else + funcs.glVertexAttribPointer(arrayIndex, 2, GL_FLOAT, GL_FALSE, 0, pointer); +} + +QT_END_NAMESPACE + +#endif diff --git a/src/gui/opengl/qopenglshadercache_meego_p.h b/src/gui/opengl/qopenglshadercache_meego_p.h new file mode 100644 index 00000000000..86a8a861dad --- /dev/null +++ b/src/gui/opengl/qopenglshadercache_meego_p.h @@ -0,0 +1,457 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $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. +// + +#ifndef QOPENGLSHADERCACHE_MEEGO_P_H +#define QOPENGLSHADERCACHE_MEEGO_P_H + +#include + +#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2) + +#include +#include +#include + +#ifndef QT_BOOTSTRAPPED +# include +#endif +#if defined(QT_DEBUG) || defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE) +# include +#endif + +QT_BEGIN_HEADER + +/* + This cache stores internal Qt shader programs in shared memory. + + This header file is ugly on purpose and can only be included once. It is only to be used + for the internal shader cache, not as a generic cache for anyone's shaders. + + The cache stores either ShaderCacheMaxEntries shader programs or ShaderCacheDataSize kilobytes + of shader programs, whatever limit is reached first. + + The layout of the cache is as outlined in the CachedShaders struct. After some + integers, an array of headers is reserved, then comes the space for the actual binaries. + + Shader Programs are identified by the md5sum of their frag and vertex shader source code. + + Shader Programs are never removed. The cache never shrinks or re-shuffles. This is done + on purpose to ensure minimum amount of locking, no alignment problems and very few write + operations. + + Note: Locking the shader cache could be expensive, because the entire system might hang. + That's why the cache is immutable to minimize the time we need to keep it locked. + + Why is it Meego specific? + + First, the size is chosen so that it fits to generic meego usage. Second, on Meego, there's + always at least one Qt application active (the launcher), so the cache will never be destroyed. + Only when the last Qt app exits, the cache dies, which should only be when someone kills the + X11 server. And last but not least it was only tested with Meego's SGX driver. + + There's a small tool in src/opengl/util/meego that dumps the contents of the cache. + */ + +// anonymous namespace, prevent exporting of the private symbols +namespace +{ + +struct CachedShaderHeader +{ + /* the index in the data[] member of CachedShaders */ + int index; + /* the size of the binary shader */ + GLsizei size; + /* the format of the binary shader */ + GLenum format; + /* the md5sum of the frag+vertex shaders */ + char md5Sum[16]; +}; + +enum +{ + /* The maximum amount of shader programs the cache can hold */ + ShaderCacheMaxEntries = 20 +}; + +typedef CachedShaderHeader CachedShaderHeaders[ShaderCacheMaxEntries]; + +enum +{ + // ShaderCacheDataSize is 20k minus the other data members of CachedShaders + ShaderCacheDataSize = 1024 * ShaderCacheMaxEntries - sizeof(CachedShaderHeaders) - 2 * sizeof(int) +}; + +struct CachedShaders +{ + /* How much space is still available in the cache */ + inline int availableSize() const { return ShaderCacheDataSize - dataSize; } + + /* The current amount of cached shaders */ + int shaderCount; + + /* The current amount (in bytes) of cached data */ + int dataSize; + + /* The headers describing the shaders */ + CachedShaderHeaders headers; + + /* The actual binary data of the shader programs */ + char data[ShaderCacheDataSize]; +}; + +//#define QT_DEBUG_SHADER_CACHE +#ifdef QT_DEBUG_SHADER_CACHE +static QDebug shaderCacheDebug() +{ + return QDebug(QtDebugMsg); +} +#else +static inline QNoDebug shaderCacheDebug() { return QNoDebug(); } +#endif + +class ShaderCacheSharedMemory +{ +public: + ShaderCacheSharedMemory() + : shm(QLatin1String("qt_gles2_shadercache_" QT_VERSION_STR)) + { + // we need a system semaphore here, since cache creation and initialization must be atomic + QSystemSemaphore attachSemaphore(QLatin1String("qt_gles2_shadercache_mutex_" QT_VERSION_STR), 1); + + if (!attachSemaphore.acquire()) { + shaderCacheDebug() << "Unable to require shader cache semaphore:" << attachSemaphore.errorString(); + return; + } + + if (shm.attach()) { + // success! + shaderCacheDebug() << "Attached to shader cache"; + } else { + + // no cache exists - create and initialize it + if (shm.create(sizeof(CachedShaders))) { + shaderCacheDebug() << "Created new shader cache"; + initializeCache(); + } else { + shaderCacheDebug() << "Unable to create shader cache:" << shm.errorString(); + } + } + + attachSemaphore.release(); + } + + inline bool isAttached() const { return shm.isAttached(); } + + inline bool lock() { return shm.lock(); } + inline bool unlock() { return shm.unlock(); } + inline void *data() { return shm.data(); } + inline QString errorString() { return shm.errorString(); } + + ~ShaderCacheSharedMemory() + { + if (!shm.detach()) + shaderCacheDebug() << "Unable to detach shader cache" << shm.errorString(); + } + +private: + void initializeCache() + { + // no need to lock the shared memory since we're already protected by the + // attach system semaphore. + + void *data = shm.data(); + Q_ASSERT(data); + + memset(data, 0, sizeof(CachedShaders)); + } + + QSharedMemory shm; +}; + +class ShaderCacheLocker +{ +public: + inline ShaderCacheLocker(ShaderCacheSharedMemory *cache) + : shm(cache->lock() ? cache : (ShaderCacheSharedMemory *)0) + { + if (!shm) + shaderCacheDebug() << "Unable to lock shader cache" << cache->errorString(); + } + + inline bool isLocked() const { return shm; } + + inline ~ShaderCacheLocker() + { + if (!shm) + return; + if (!shm->unlock()) + shaderCacheDebug() << "Unable to unlock shader cache" << shm->errorString(); + } + +private: + ShaderCacheSharedMemory *shm; +}; + +#ifdef QT_BOOTSTRAPPED +} // end namespace +#else + +static void traceCacheOverflow(const char *message) +{ +#if defined(QT_DEBUG) || defined (QT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE) + openlog(qPrintable(QCoreApplication::applicationName()), LOG_PID | LOG_ODELAY, LOG_USER); + syslog(LOG_DEBUG, message); + closelog(); +#endif + shaderCacheDebug() << message; +} + +Q_GLOBAL_STATIC(ShaderCacheSharedMemory, shaderCacheSharedMemory) + +/* + Finds the index of the shader program identified by md5Sum in the cache. + Note: Does NOT lock the cache for reading, the cache must already be locked! + + Returns -1 when no shader was found. + */ +static int qt_cache_index_unlocked(const QByteArray &md5Sum, CachedShaders *cache) +{ + for (int i = 0; i < cache->shaderCount; ++i) { + if (qstrncmp(md5Sum.constData(), cache->headers[i].md5Sum, 16) == 0) { + return i; + } + } + return -1; +} + +/* Returns the index of the shader identified by md5Sum */ +static int qt_cache_index(const QByteArray &md5Sum) +{ + ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); + if (!shm || !shm->isAttached()) + return false; + + Q_ASSERT(md5Sum.length() == 16); + + ShaderCacheLocker locker(shm); + if (!locker.isLocked()) + return false; + + void *data = shm->data(); + Q_ASSERT(data); + + CachedShaders *cache = reinterpret_cast(data); + + return qt_cache_index_unlocked(md5Sum, cache); +} + +/* Loads the cached shader at index \a shaderIndex into \a program + * Note: Since the cache is immutable, this operation doesn't lock the shared memory. + */ +static bool qt_cached_shader(QOpenGLShaderProgram *program, QOpenGLContext *ctx, int shaderIndex) +{ + Q_ASSERT(shaderIndex >= 0 && shaderIndex <= ShaderCacheMaxEntries); + Q_ASSERT(program); + + ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); + if (!shm || !shm->isAttached()) + return false; + + void *data = shm->data(); + Q_ASSERT(data); + + CachedShaders *cache = reinterpret_cast(data); + + shaderCacheDebug() << "fetching cached shader at index" << shaderIndex + << "dataIndex" << cache->headers[shaderIndex].index + << "size" << cache->headers[shaderIndex].size + << "format" << cache->headers[shaderIndex].format; + + // call program->programId first, since that resolves the glProgramBinaryOES symbol + GLuint programId = program->programId(); + glProgramBinaryOES(programId, cache->headers[shaderIndex].format, + cache->data + cache->headers[shaderIndex].index, + cache->headers[shaderIndex].size); + + return true; +} + +/* Stores the shader program in the cache. Returns false if there's an error with the cache, or + if the cache is too small to hold the shader. */ +static bool qt_cache_shader(const QOpenGLShaderProgram *shader, QOpenGLContext *ctx, const QByteArray &md5Sum) +{ + ShaderCacheSharedMemory *shm = shaderCacheSharedMemory(); + if (!shm || !shm->isAttached()) + return false; + + void *data = shm->data(); + Q_ASSERT(data); + + CachedShaders *cache = reinterpret_cast(data); + + ShaderCacheLocker locker(shm); + if (!locker.isLocked()) + return false; + + int cacheIdx = cache->shaderCount; + if (cacheIdx >= ShaderCacheMaxEntries) { + traceCacheOverflow("Qt OpenGL shader cache index overflow!"); + return false; + } + + // now that we have the lock on the shared memory, make sure no one + // inserted the shader already while we were unlocked + if (qt_cache_index_unlocked(md5Sum, cache) != -1) + return true; // already cached + + shaderCacheDebug() << "Caching shader at index" << cacheIdx; + + GLint binaryLength = 0; + glGetProgramiv(shader->programId(), GL_PROGRAM_BINARY_LENGTH_OES, &binaryLength); + + if (!binaryLength) { + shaderCacheDebug() << "Unable to determine binary shader size!"; + return false; + } + + if (binaryLength > cache->availableSize()) { + traceCacheOverflow("Qt OpenGL shader cache data overflow!"); + return false; + } + + GLsizei size = 0; + GLenum format = 0; + glGetProgramBinaryOES(shader->programId(), binaryLength, &size, &format, + cache->data + cache->dataSize); + + if (!size) { + shaderCacheDebug() << "Unable to get binary shader!"; + return false; + } + + cache->headers[cacheIdx].index = cache->dataSize; + cache->dataSize += binaryLength; + ++cache->shaderCount; + cache->headers[cacheIdx].size = binaryLength; + cache->headers[cacheIdx].format = format; + + memcpy(cache->headers[cacheIdx].md5Sum, md5Sum.constData(), 16); + + shaderCacheDebug() << "cached shader size" << size + << "format" << format + << "binarySize" << binaryLength + << "cache index" << cacheIdx + << "data index" << cache->headers[cacheIdx].index; + + return true; +} + +} // namespace + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class CachedShader +{ +public: + CachedShader(const QByteArray &fragSource, const QByteArray &vertexSource) + : cacheIdx(-1) + { + QCryptographicHash md5Hash(QCryptographicHash::Md5); + + md5Hash.addData(fragSource); + md5Hash.addData(vertexSource); + + md5Sum = md5Hash.result(); + } + + bool isCached() + { + return cacheIndex() != -1; + } + + int cacheIndex() + { + if (cacheIdx != -1) + return cacheIdx; + cacheIdx = qt_cache_index(md5Sum); + return cacheIdx; + } + + bool load(QOpenGLShaderProgram *program, QOpenGLContext *ctx) + { + if (cacheIndex() == -1) + return false; + return qt_cached_shader(program, ctx, cacheIdx); + } + + bool store(QOpenGLShaderProgram *program, QOpenGLContext *ctx) + { + return qt_cache_shader(program, ctx, md5Sum); + } + +private: + QByteArray md5Sum; + int cacheIdx; +}; + + +QT_END_NAMESPACE + +#endif + +QT_END_HEADER + +#endif +#endif diff --git a/src/gui/image/qpixmapdatafactory_p.h b/src/gui/opengl/qopenglshadercache_p.h similarity index 76% rename from src/gui/image/qpixmapdatafactory_p.h rename to src/gui/opengl/qopenglshadercache_p.h index a539d672c32..05a058050c2 100644 --- a/src/gui/image/qpixmapdatafactory_p.h +++ b/src/gui/opengl/qopenglshadercache_p.h @@ -39,9 +39,6 @@ ** ****************************************************************************/ -#ifndef QPIXMAPDATAFACTORY_P_H -#define QPIXMAPDATAFACTORY_P_H - // // W A R N I N G // ------------- @@ -53,9 +50,14 @@ // We mean it. // -#include -#include -#include +#ifndef QOPENGLSHADERCACHE_P_H +#define QOPENGLSHADERCACHE_P_H + +#include + +#if defined(QT_MEEGO_EXPERIMENTAL_SHADERCACHE) && defined(QT_OPENGL_ES_2) +# include "qopenglshadercache_meego_p.h" +#else QT_BEGIN_HEADER @@ -63,19 +65,34 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class QPixmapData; +class QOpenGLShaderProgram; +class QOpenGLContext; -class QPixmapDataFactory +class CachedShader { public: - static QPixmapDataFactory* instance(int screen = 0); - virtual ~QPixmapDataFactory(); + inline CachedShader(const QByteArray &, const QByteArray &) + {} - virtual QPixmapData* create(QPixmapData::PixelType type) = 0; + inline bool isCached() + { + return false; + } + + inline bool load(QOpenGLShaderProgram *, QOpenGLContext *) + { + return false; + } + + inline bool store(QOpenGLShaderProgram *, QOpenGLContext *) + { + return false; + } }; QT_END_NAMESPACE QT_END_HEADER -#endif // QPIXMAPDATAFACTORY_P_H +#endif +#endif diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp new file mode 100644 index 00000000000..aa7767a7eb8 --- /dev/null +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -0,0 +1,3105 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenglshaderprogram.h" +#include "qopenglfunctions.h" +#include "private/qopenglcontext_p.h" +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QOpenGLShaderProgram + \brief The QOpenGLShaderProgram class allows OpenGL shader programs to be linked and used. + \since 5.0 + \ingroup painting-3D + + \section1 Introduction + + This class supports shader programs written in the OpenGL Shading + Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES). + + QOpenGLShader and QOpenGLShaderProgram shelter the programmer from the details of + compiling and linking vertex and fragment shaders. + + The following example creates a vertex shader program using the + supplied source \c{code}. Once compiled and linked, the shader + program is activated in the current QOpenGLContext by calling + QOpenGLShaderProgram::bind(): + + \snippet doc/src/snippets/code/src_opengl_qopenglshaderprogram.cpp 0 + + \section1 Writing portable shaders + + Shader programs can be difficult to reuse across OpenGL implementations + because of varying levels of support for standard vertex attributes and + uniform variables. In particular, GLSL/ES lacks all of the + standard variables that are present on desktop OpenGL systems: + \c{gl_Vertex}, \c{gl_Normal}, \c{gl_Color}, and so on. Desktop OpenGL + lacks the variable qualifiers \c{highp}, \c{mediump}, and \c{lowp}. + + The QOpenGLShaderProgram class makes the process of writing portable shaders + easier by prefixing all shader programs with the following lines on + desktop OpenGL: + + \code + #define highp + #define mediump + #define lowp + \endcode + + This makes it possible to run most GLSL/ES shader programs + on desktop systems. The programmer should restrict themselves + to just features that are present in GLSL/ES, and avoid + standard variable names that only work on the desktop. + + \section1 Simple shader example + + \snippet doc/src/snippets/code/src_opengl_qopenglshaderprogram.cpp 1 + + With the above shader program active, we can draw a green triangle + as follows: + + \snippet doc/src/snippets/code/src_opengl_qopenglshaderprogram.cpp 2 + + \section1 Binary shaders and programs + + Binary shaders may be specified using \c{glShaderBinary()} on + the return value from QOpenGLShader::shaderId(). The QOpenGLShader instance + containing the binary can then be added to the shader program with + addShader() and linked in the usual fashion with link(). + + Binary programs may be specified using \c{glProgramBinaryOES()} + on the return value from programId(). Then the application should + call link(), which will notice that the program has already been + specified and linked, allowing other operations to be performed + on the shader program. + + \sa QOpenGLShader +*/ + +/*! + \class QOpenGLShader + \brief The QOpenGLShader class allows OpenGL shaders to be compiled. + \since 5.0 + \ingroup painting-3D + + This class supports shaders written in the OpenGL Shading Language (GLSL) + and in the OpenGL/ES Shading Language (GLSL/ES). + + QOpenGLShader and QOpenGLShaderProgram shelter the programmer from the details of + compiling and linking vertex and fragment shaders. + + \sa QOpenGLShaderProgram +*/ + +/*! + \enum QOpenGLShader::ShaderTypeBit + This enum specifies the type of QOpenGLShader that is being created. + + \value Vertex Vertex shader written in the OpenGL Shading Language (GLSL). + \value Fragment Fragment shader written in the OpenGL Shading Language (GLSL). + \value Geometry Geometry shaders written in the OpenGL Shading + Language (GLSL), based on the GL_EXT_geometry_shader4 extension. +*/ + +class QOpenGLShaderPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QOpenGLShader) +public: + QOpenGLShaderPrivate(QOpenGLContext *ctx, QOpenGLShader::ShaderType type) + : shaderGuard(0) + , shaderType(type) + , compiled(false) + , glfuncs(new QOpenGLFunctions(ctx)) + { + } + ~QOpenGLShaderPrivate(); + + QOpenGLSharedResourceGuard *shaderGuard; + QOpenGLShader::ShaderType shaderType; + bool compiled; + QString log; + + QOpenGLFunctions *glfuncs; + + bool create(); + bool compile(QOpenGLShader *q); + void deleteShader(); +}; + +namespace { + void freeShaderFunc(QOpenGLFunctions *funcs, GLuint id) + { + funcs->glDeleteShader(id); + } +} + +QOpenGLShaderPrivate::~QOpenGLShaderPrivate() +{ + delete glfuncs; + if (shaderGuard) + shaderGuard->free(); +} + +bool QOpenGLShaderPrivate::create() +{ + QOpenGLContext *context = const_cast(QOpenGLContext::currentContext()); + if (!context) + return false; + GLuint shader; + if (shaderType == QOpenGLShader::Vertex) + shader = glfuncs->glCreateShader(GL_VERTEX_SHADER); +#if 0 + else if (shaderType == QOpenGLShader::Geometry) + shader = glfuncs->glCreateShader(GL_GEOMETRY_SHADER_EXT); +#endif + else + shader = glfuncs->glCreateShader(GL_FRAGMENT_SHADER); + if (!shader) { + qWarning() << "QOpenGLShader: could not create shader"; + return false; + } + shaderGuard = new QOpenGLSharedResourceGuard(context, shader, freeShaderFunc); + return true; +} + +bool QOpenGLShaderPrivate::compile(QOpenGLShader *q) +{ + GLuint shader = shaderGuard ? shaderGuard->id() : 0; + if (!shader) + return false; + glfuncs->glCompileShader(shader); + GLint value = 0; + glfuncs->glGetShaderiv(shader, GL_COMPILE_STATUS, &value); + compiled = (value != 0); + value = 0; + glfuncs->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &value); + if (!compiled && value > 1) { + char *logbuf = new char [value]; + GLint len; + glfuncs->glGetShaderInfoLog(shader, value, &len, logbuf); + log = QString::fromLatin1(logbuf); + QString name = q->objectName(); + + const char *types[] = { + "Fragment", + "Vertex", + "Geometry", + "" + }; + + const char *type = types[3]; + if (shaderType == QOpenGLShader::Fragment) + type = types[0]; + else if (shaderType == QOpenGLShader::Vertex) + type = types[1]; + else if (shaderType == QOpenGLShader::Geometry) + type = types[2]; + + if (name.isEmpty()) + qWarning("QOpenGLShader::compile(%s): %s", type, qPrintable(log)); + else + qWarning("QOpenGLShader::compile(%s)[%s]: %s", type, qPrintable(name), qPrintable(log)); + + delete [] logbuf; + } + return compiled; +} + +void QOpenGLShaderPrivate::deleteShader() +{ + if (shaderGuard) { + shaderGuard->free(); + shaderGuard = 0; + } +} + +/*! + Constructs a new QOpenGLShader object of the specified \a type + and attaches it to \a parent. If shader programs are not supported, + QOpenGLShaderProgram::hasOpenGLShaderPrograms() will return false. + + This constructor is normally followed by a call to compileSourceCode() + or compileSourceFile(). + + The shader will be associated with the current QOpenGLContext. + + \sa compileSourceCode(), compileSourceFile() +*/ +QOpenGLShader::QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent) + : QObject(*new QOpenGLShaderPrivate(QOpenGLContext::currentContext(), type), parent) +{ + Q_D(QOpenGLShader); + d->create(); +} + +/*! + Deletes this shader. If the shader has been attached to a + QOpenGLShaderProgram object, then the actual shader will stay around + until the QOpenGLShaderProgram is destroyed. +*/ +QOpenGLShader::~QOpenGLShader() +{ +} + +/*! + Returns the type of this shader. +*/ +QOpenGLShader::ShaderType QOpenGLShader::shaderType() const +{ + Q_D(const QOpenGLShader); + return d->shaderType; +} + +// The precision qualifiers are useful on OpenGL/ES systems, +// but usually not present on desktop systems. Define the +// keywords to empty strings on desktop systems. +#if !defined(QT_OPENGL_ES) || defined(QT_OPENGL_FORCE_SHADER_DEFINES) +#define QOpenGL_DEFINE_QUALIFIERS 1 +static const char qualifierDefines[] = + "#define lowp\n" + "#define mediump\n" + "#define highp\n"; + +#else + +// The "highp" qualifier doesn't exist in fragment shaders +// on all ES platforms. When it doesn't exist, use "mediump". +#define QOpenGL_REDEFINE_HIGHP 1 +static const char redefineHighp[] = + "#ifndef GL_FRAGMENT_PRECISION_HIGH\n" + "#define highp mediump\n" + "#endif\n"; +#endif + +/*! + Sets the \a source code for this shader and compiles it. + Returns true if the source was successfully compiled, false otherwise. + + \sa compileSourceFile() +*/ +bool QOpenGLShader::compileSourceCode(const char *source) +{ + Q_D(QOpenGLShader); + if (d->shaderGuard && d->shaderGuard->id()) { + QVarLengthArray src; + QVarLengthArray srclen; + int headerLen = 0; + while (source && source[headerLen] == '#') { + // Skip #version and #extension directives at the start of + // the shader code. We need to insert the qualifierDefines + // and redefineHighp just after them. + if (qstrncmp(source + headerLen, "#version", 8) != 0 && + qstrncmp(source + headerLen, "#extension", 10) != 0) { + break; + } + while (source[headerLen] != '\0' && source[headerLen] != '\n') + ++headerLen; + if (source[headerLen] == '\n') + ++headerLen; + } + if (headerLen > 0) { + src.append(source); + srclen.append(GLint(headerLen)); + } +#ifdef QOpenGL_DEFINE_QUALIFIERS + src.append(qualifierDefines); + srclen.append(GLint(sizeof(qualifierDefines) - 1)); +#endif +#ifdef QOpenGL_REDEFINE_HIGHP + if (d->shaderType == Fragment) { + src.append(redefineHighp); + srclen.append(GLint(sizeof(redefineHighp) - 1)); + } +#endif + src.append(source + headerLen); + srclen.append(GLint(qstrlen(source + headerLen))); + d->glfuncs->glShaderSource(d->shaderGuard->id(), src.size(), src.data(), srclen.data()); + return d->compile(this); + } else { + return false; + } +} + +/*! + \overload + + Sets the \a source code for this shader and compiles it. + Returns true if the source was successfully compiled, false otherwise. + + \sa compileSourceFile() +*/ +bool QOpenGLShader::compileSourceCode(const QByteArray& source) +{ + return compileSourceCode(source.constData()); +} + +/*! + \overload + + Sets the \a source code for this shader and compiles it. + Returns true if the source was successfully compiled, false otherwise. + + \sa compileSourceFile() +*/ +bool QOpenGLShader::compileSourceCode(const QString& source) +{ + return compileSourceCode(source.toLatin1().constData()); +} + +/*! + Sets the source code for this shader to the contents of \a fileName + and compiles it. Returns true if the file could be opened and the + source compiled, false otherwise. + + \sa compileSourceCode() +*/ +bool QOpenGLShader::compileSourceFile(const QString& fileName) +{ + QFile file(fileName); + if (!file.open(QFile::ReadOnly)) { + qWarning() << "QOpenGLShader: Unable to open file" << fileName; + return false; + } + + QByteArray contents = file.readAll(); + return compileSourceCode(contents.constData()); +} + +/*! + Returns the source code for this shader. + + \sa compileSourceCode() +*/ +QByteArray QOpenGLShader::sourceCode() const +{ + Q_D(const QOpenGLShader); + GLuint shader = d->shaderGuard ? d->shaderGuard->id() : 0; + if (!shader) + return QByteArray(); + GLint size = 0; + d->glfuncs->glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &size); + if (size <= 0) + return QByteArray(); + GLint len = 0; + char *source = new char [size]; + d->glfuncs->glGetShaderSource(shader, size, &len, source); + QByteArray src(source); + delete [] source; + return src; +} + +/*! + Returns true if this shader has been compiled; false otherwise. + + \sa compileSourceCode(), compileSourceFile() +*/ +bool QOpenGLShader::isCompiled() const +{ + Q_D(const QOpenGLShader); + return d->compiled; +} + +/*! + Returns the errors and warnings that occurred during the last compile. + + \sa compileSourceCode(), compileSourceFile() +*/ +QString QOpenGLShader::log() const +{ + Q_D(const QOpenGLShader); + return d->log; +} + +/*! + Returns the OpenGL identifier associated with this shader. + + \sa QOpenGLShaderProgram::programId() +*/ +GLuint QOpenGLShader::shaderId() const +{ + Q_D(const QOpenGLShader); + return d->shaderGuard ? d->shaderGuard->id() : 0; +} + +class QOpenGLShaderProgramPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QOpenGLShaderProgram) +public: + QOpenGLShaderProgramPrivate(QOpenGLContext *ctx) + : programGuard(0) + , linked(false) + , inited(false) + , removingShaders(false) + , geometryVertexCount(64) + , geometryInputType(0) + , geometryOutputType(0) + , glfuncs(new QOpenGLFunctions(ctx)) + { + } + ~QOpenGLShaderProgramPrivate(); + + QOpenGLSharedResourceGuard *programGuard; + bool linked; + bool inited; + bool removingShaders; + + int geometryVertexCount; + GLenum geometryInputType; + GLenum geometryOutputType; + + QString log; + QList shaders; + QList anonShaders; + + QOpenGLFunctions *glfuncs; + + bool hasShader(QOpenGLShader::ShaderType type) const; +}; + +namespace { + void freeProgramFunc(QOpenGLFunctions *funcs, GLuint id) + { + funcs->glDeleteProgram(id); + } +} + + +QOpenGLShaderProgramPrivate::~QOpenGLShaderProgramPrivate() +{ + delete glfuncs; + if (programGuard) + programGuard->free(); +} + +bool QOpenGLShaderProgramPrivate::hasShader(QOpenGLShader::ShaderType type) const +{ + foreach (QOpenGLShader *shader, shaders) { + if (shader->shaderType() == type) + return true; + } + return false; +} + +/*! + Constructs a new shader program and attaches it to \a parent. + The program will be invalid until addShader() is called. + + The shader program will be associated with the current QOpenGLContext. + + \sa addShader() +*/ +QOpenGLShaderProgram::QOpenGLShaderProgram(QObject *parent) + : QObject(*new QOpenGLShaderProgramPrivate(QOpenGLContext::currentContext()), parent) +{ +} + +/*! + Deletes this shader program. +*/ +QOpenGLShaderProgram::~QOpenGLShaderProgram() +{ +} + +bool QOpenGLShaderProgram::init() +{ + Q_D(QOpenGLShaderProgram); + if ((d->programGuard && d->programGuard->id()) || d->inited) + return true; + d->inited = true; + QOpenGLContext *context = const_cast(QOpenGLContext::currentContext()); + if (!context) + return false; + GLuint program = d->glfuncs->glCreateProgram(); + if (!program) { + qWarning() << "QOpenGLShaderProgram: could not create shader program"; + return false; + } + if (d->programGuard) + delete d->programGuard; + d->programGuard = new QOpenGLSharedResourceGuard(context, program, freeProgramFunc); + return true; +} + +/*! + Adds a compiled \a shader to this shader program. Returns true + if the shader could be added, or false otherwise. + + Ownership of the \a shader object remains with the caller. + It will not be deleted when this QOpenGLShaderProgram instance + is deleted. This allows the caller to add the same shader + to multiple shader programs. + + \sa addShaderFromSourceCode(), addShaderFromSourceFile() + \sa removeShader(), link(), removeAllShaders() +*/ +bool QOpenGLShaderProgram::addShader(QOpenGLShader *shader) +{ + Q_D(QOpenGLShaderProgram); + if (!init()) + return false; + if (d->shaders.contains(shader)) + return true; // Already added to this shader program. + if (d->programGuard && d->programGuard->id() && shader) { + if (!shader->d_func()->shaderGuard || !shader->d_func()->shaderGuard->id()) + return false; + if (d->programGuard->group() != shader->d_func()->shaderGuard->group()) { + qWarning("QOpenGLShaderProgram::addShader: Program and shader are not associated with same context."); + return false; + } + d->glfuncs->glAttachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id()); + d->linked = false; // Program needs to be relinked. + d->shaders.append(shader); + connect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed())); + return true; + } else { + return false; + } +} + +/*! + Compiles \a source as a shader of the specified \a type and + adds it to this shader program. Returns true if compilation + was successful, false otherwise. The compilation errors + and warnings will be made available via log(). + + This function is intended to be a short-cut for quickly + adding vertex and fragment shaders to a shader program without + creating an instance of QOpenGLShader first. + + \sa addShader(), addShaderFromSourceFile() + \sa removeShader(), link(), log(), removeAllShaders() +*/ +bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const char *source) +{ + Q_D(QOpenGLShaderProgram); + if (!init()) + return false; + QOpenGLShader *shader = new QOpenGLShader(type, this); + if (!shader->compileSourceCode(source)) { + d->log = shader->log(); + delete shader; + return false; + } + d->anonShaders.append(shader); + return addShader(shader); +} + +/*! + \overload + + Compiles \a source as a shader of the specified \a type and + adds it to this shader program. Returns true if compilation + was successful, false otherwise. The compilation errors + and warnings will be made available via log(). + + This function is intended to be a short-cut for quickly + adding vertex and fragment shaders to a shader program without + creating an instance of QOpenGLShader first. + + \sa addShader(), addShaderFromSourceFile() + \sa removeShader(), link(), log(), removeAllShaders() +*/ +bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray& source) +{ + return addShaderFromSourceCode(type, source.constData()); +} + +/*! + \overload + + Compiles \a source as a shader of the specified \a type and + adds it to this shader program. Returns true if compilation + was successful, false otherwise. The compilation errors + and warnings will be made available via log(). + + This function is intended to be a short-cut for quickly + adding vertex and fragment shaders to a shader program without + creating an instance of QOpenGLShader first. + + \sa addShader(), addShaderFromSourceFile() + \sa removeShader(), link(), log(), removeAllShaders() +*/ +bool QOpenGLShaderProgram::addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString& source) +{ + return addShaderFromSourceCode(type, source.toLatin1().constData()); +} + +/*! + Compiles the contents of \a fileName as a shader of the specified + \a type and adds it to this shader program. Returns true if + compilation was successful, false otherwise. The compilation errors + and warnings will be made available via log(). + + This function is intended to be a short-cut for quickly + adding vertex and fragment shaders to a shader program without + creating an instance of QOpenGLShader first. + + \sa addShader(), addShaderFromSourceCode() +*/ +bool QOpenGLShaderProgram::addShaderFromSourceFile + (QOpenGLShader::ShaderType type, const QString& fileName) +{ + Q_D(QOpenGLShaderProgram); + if (!init()) + return false; + QOpenGLShader *shader = new QOpenGLShader(type, this); + if (!shader->compileSourceFile(fileName)) { + d->log = shader->log(); + delete shader; + return false; + } + d->anonShaders.append(shader); + return addShader(shader); +} + +/*! + Removes \a shader from this shader program. The object is not deleted. + + The shader program must be valid in the current QOpenGLContext. + + \sa addShader(), link(), removeAllShaders() +*/ +void QOpenGLShaderProgram::removeShader(QOpenGLShader *shader) +{ + Q_D(QOpenGLShaderProgram); + if (d->programGuard && d->programGuard->id() + && shader && shader->d_func()->shaderGuard) + { + d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id()); + } + d->linked = false; // Program needs to be relinked. + if (shader) { + d->shaders.removeAll(shader); + d->anonShaders.removeAll(shader); + disconnect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed())); + } +} + +/*! + Returns a list of all shaders that have been added to this shader + program using addShader(). + + \sa addShader(), removeShader() +*/ +QList QOpenGLShaderProgram::shaders() const +{ + Q_D(const QOpenGLShaderProgram); + return d->shaders; +} + +/*! + Removes all of the shaders that were added to this program previously. + The QOpenGLShader objects for the shaders will not be deleted if they + were constructed externally. QOpenGLShader objects that are constructed + internally by QOpenGLShaderProgram will be deleted. + + \sa addShader(), removeShader() +*/ +void QOpenGLShaderProgram::removeAllShaders() +{ + Q_D(QOpenGLShaderProgram); + d->removingShaders = true; + foreach (QOpenGLShader *shader, d->shaders) { + if (d->programGuard && d->programGuard->id() + && shader && shader->d_func()->shaderGuard) + { + d->glfuncs->glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id()); + } + } + foreach (QOpenGLShader *shader, d->anonShaders) { + // Delete shader objects that were created anonymously. + delete shader; + } + d->shaders.clear(); + d->anonShaders.clear(); + d->linked = false; // Program needs to be relinked. + d->removingShaders = false; +} + +/*! + Links together the shaders that were added to this program with + addShader(). Returns true if the link was successful or + false otherwise. If the link failed, the error messages can + be retrieved with log(). + + Subclasses can override this function to initialize attributes + and uniform variables for use in specific shader programs. + + If the shader program was already linked, calling this + function again will force it to be re-linked. + + \sa addShader(), log() +*/ +bool QOpenGLShaderProgram::link() +{ + Q_D(QOpenGLShaderProgram); + GLuint program = d->programGuard ? d->programGuard->id() : 0; + if (!program) + return false; + + GLint value; + if (d->shaders.isEmpty()) { + // If there are no explicit shaders, then it is possible that the + // application added a program binary with glProgramBinaryOES(), + // or otherwise populated the shaders itself. Check to see if the + // program is already linked and bail out if so. + value = 0; + d->glfuncs->glGetProgramiv(program, GL_LINK_STATUS, &value); + d->linked = (value != 0); + if (d->linked) + return true; + } + + // Set up the geometry shader parameters +#if 0 + if (glProgramParameteriEXT) { + foreach (QOpenGLShader *shader, d->shaders) { + if (shader->shaderType() & QOpenGLShader::Geometry) { + glProgramParameteriEXT(program, GL_GEOMETRY_INPUT_TYPE_EXT, + d->geometryInputType); + glProgramParameteriEXT(program, GL_GEOMETRY_OUTPUT_TYPE_EXT, + d->geometryOutputType); + glProgramParameteriEXT(program, GL_GEOMETRY_VERTICES_OUT_EXT, + d->geometryVertexCount); + break; + } + } + } +#endif + + d->glfuncs->glLinkProgram(program); + value = 0; + d->glfuncs->glGetProgramiv(program, GL_LINK_STATUS, &value); + d->linked = (value != 0); + value = 0; + d->glfuncs->glGetProgramiv(program, GL_INFO_LOG_LENGTH, &value); + d->log = QString(); + if (value > 1) { + char *logbuf = new char [value]; + GLint len; + d->glfuncs->glGetProgramInfoLog(program, value, &len, logbuf); + d->log = QString::fromLatin1(logbuf); + QString name = objectName(); + if (name.isEmpty()) + qWarning() << "QOpenGLShader::link:" << d->log; + else + qWarning() << "QOpenGLShader::link[" << name << "]:" << d->log; + delete [] logbuf; + } + return d->linked; +} + +/*! + Returns true if this shader program has been linked; false otherwise. + + \sa link() +*/ +bool QOpenGLShaderProgram::isLinked() const +{ + Q_D(const QOpenGLShaderProgram); + return d->linked; +} + +/*! + Returns the errors and warnings that occurred during the last link() + or addShader() with explicitly specified source code. + + \sa link() +*/ +QString QOpenGLShaderProgram::log() const +{ + Q_D(const QOpenGLShaderProgram); + return d->log; +} + +/*! + Binds this shader program to the active QOpenGLContext and makes + it the current shader program. Any previously bound shader program + is released. This is equivalent to calling \c{glUseProgram()} on + programId(). Returns true if the program was successfully bound; + false otherwise. If the shader program has not yet been linked, + or it needs to be re-linked, this function will call link(). + + \sa link(), release() +*/ +bool QOpenGLShaderProgram::bind() +{ + Q_D(QOpenGLShaderProgram); + GLuint program = d->programGuard ? d->programGuard->id() : 0; + if (!program) + return false; + if (!d->linked && !link()) + return false; +#ifndef QT_NO_DEBUG + if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) { + qWarning("QOpenGLShaderProgram::bind: program is not valid in the current context."); + return false; + } +#endif + d->glfuncs->glUseProgram(program); + return true; +} + +/*! + Releases the active shader program from the current QOpenGLContext. + This is equivalent to calling \c{glUseProgram(0)}. + + \sa bind() +*/ +void QOpenGLShaderProgram::release() +{ + Q_D(QOpenGLShaderProgram); +#ifndef QT_NO_DEBUG + if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) + qWarning("QOpenGLShaderProgram::release: program is not valid in the current context."); +#endif + d->glfuncs->glUseProgram(0); +} + +/*! + Returns the OpenGL identifier associated with this shader program. + + \sa QOpenGLShader::shaderId() +*/ +GLuint QOpenGLShaderProgram::programId() const +{ + Q_D(const QOpenGLShaderProgram); + GLuint id = d->programGuard ? d->programGuard->id() : 0; + if (id) + return id; + + // Create the identifier if we don't have one yet. This is for + // applications that want to create the attached shader configuration + // themselves, particularly those using program binaries. + if (!const_cast(this)->init()) + return 0; + return d->programGuard ? d->programGuard->id() : 0; +} + +/*! + Binds the attribute \a name to the specified \a location. This + function can be called before or after the program has been linked. + Any attributes that have not been explicitly bound when the program + is linked will be assigned locations automatically. + + When this function is called after the program has been linked, + the program will need to be relinked for the change to take effect. + + \sa attributeLocation() +*/ +void QOpenGLShaderProgram::bindAttributeLocation(const char *name, int location) +{ + Q_D(QOpenGLShaderProgram); + if (!init() || !d->programGuard || !d->programGuard->id()) + return; + d->glfuncs->glBindAttribLocation(d->programGuard->id(), location, name); + d->linked = false; // Program needs to be relinked. +} + +/*! + \overload + + Binds the attribute \a name to the specified \a location. This + function can be called before or after the program has been linked. + Any attributes that have not been explicitly bound when the program + is linked will be assigned locations automatically. + + When this function is called after the program has been linked, + the program will need to be relinked for the change to take effect. + + \sa attributeLocation() +*/ +void QOpenGLShaderProgram::bindAttributeLocation(const QByteArray& name, int location) +{ + bindAttributeLocation(name.constData(), location); +} + +/*! + \overload + + Binds the attribute \a name to the specified \a location. This + function can be called before or after the program has been linked. + Any attributes that have not been explicitly bound when the program + is linked will be assigned locations automatically. + + When this function is called after the program has been linked, + the program will need to be relinked for the change to take effect. + + \sa attributeLocation() +*/ +void QOpenGLShaderProgram::bindAttributeLocation(const QString& name, int location) +{ + bindAttributeLocation(name.toLatin1().constData(), location); +} + +/*! + Returns the location of the attribute \a name within this shader + program's parameter list. Returns -1 if \a name is not a valid + attribute for this shader program. + + \sa uniformLocation(), bindAttributeLocation() +*/ +int QOpenGLShaderProgram::attributeLocation(const char *name) const +{ + Q_D(const QOpenGLShaderProgram); + if (d->linked && d->programGuard && d->programGuard->id()) { + return d->glfuncs->glGetAttribLocation(d->programGuard->id(), name); + } else { + qWarning() << "QOpenGLShaderProgram::attributeLocation(" << name + << "): shader program is not linked"; + return -1; + } +} + +/*! + \overload + + Returns the location of the attribute \a name within this shader + program's parameter list. Returns -1 if \a name is not a valid + attribute for this shader program. + + \sa uniformLocation(), bindAttributeLocation() +*/ +int QOpenGLShaderProgram::attributeLocation(const QByteArray& name) const +{ + return attributeLocation(name.constData()); +} + +/*! + \overload + + Returns the location of the attribute \a name within this shader + program's parameter list. Returns -1 if \a name is not a valid + attribute for this shader program. + + \sa uniformLocation(), bindAttributeLocation() +*/ +int QOpenGLShaderProgram::attributeLocation(const QString& name) const +{ + return attributeLocation(name.toLatin1().constData()); +} + +/*! + Sets the attribute at \a location in the current context to \a value. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(int location, GLfloat value) +{ + Q_D(QOpenGLShaderProgram); + if (location != -1) + d->glfuncs->glVertexAttrib1fv(location, &value); +} + +/*! + \overload + + Sets the attribute called \a name in the current context to \a value. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(const char *name, GLfloat value) +{ + setAttributeValue(attributeLocation(name), value); +} + +/*! + Sets the attribute at \a location in the current context to + the 2D vector (\a x, \a y). + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(int location, GLfloat x, GLfloat y) +{ + Q_D(QOpenGLShaderProgram); + if (location != -1) { + GLfloat values[2] = {x, y}; + d->glfuncs->glVertexAttrib2fv(location, values); + } +} + +/*! + \overload + + Sets the attribute called \a name in the current context to + the 2D vector (\a x, \a y). + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(const char *name, GLfloat x, GLfloat y) +{ + setAttributeValue(attributeLocation(name), x, y); +} + +/*! + Sets the attribute at \a location in the current context to + the 3D vector (\a x, \a y, \a z). + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue + (int location, GLfloat x, GLfloat y, GLfloat z) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat values[3] = {x, y, z}; + d->glfuncs->glVertexAttrib3fv(location, values); + } +} + +/*! + \overload + + Sets the attribute called \a name in the current context to + the 3D vector (\a x, \a y, \a z). + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue + (const char *name, GLfloat x, GLfloat y, GLfloat z) +{ + setAttributeValue(attributeLocation(name), x, y, z); +} + +/*! + Sets the attribute at \a location in the current context to + the 4D vector (\a x, \a y, \a z, \a w). + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue + (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + Q_D(QOpenGLShaderProgram); + if (location != -1) { + GLfloat values[4] = {x, y, z, w}; + d->glfuncs->glVertexAttrib4fv(location, values); + } +} + +/*! + \overload + + Sets the attribute called \a name in the current context to + the 4D vector (\a x, \a y, \a z, \a w). + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue + (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + setAttributeValue(attributeLocation(name), x, y, z, w); +} + +/*! + Sets the attribute at \a location in the current context to \a value. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(int location, const QVector2D& value) +{ + Q_D(QOpenGLShaderProgram); + if (location != -1) + d->glfuncs->glVertexAttrib2fv(location, reinterpret_cast(&value)); +} + +/*! + \overload + + Sets the attribute called \a name in the current context to \a value. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector2D& value) +{ + setAttributeValue(attributeLocation(name), value); +} + +/*! + Sets the attribute at \a location in the current context to \a value. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(int location, const QVector3D& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glVertexAttrib3fv(location, reinterpret_cast(&value)); +} + +/*! + \overload + + Sets the attribute called \a name in the current context to \a value. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector3D& value) +{ + setAttributeValue(attributeLocation(name), value); +} + +/*! + Sets the attribute at \a location in the current context to \a value. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(int location, const QVector4D& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glVertexAttrib4fv(location, reinterpret_cast(&value)); +} + +/*! + \overload + + Sets the attribute called \a name in the current context to \a value. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(const char *name, const QVector4D& value) +{ + setAttributeValue(attributeLocation(name), value); +} + +/*! + Sets the attribute at \a location in the current context to \a value. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(int location, const QColor& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat values[4] = {GLfloat(value.redF()), GLfloat(value.greenF()), + GLfloat(value.blueF()), GLfloat(value.alphaF())}; + d->glfuncs->glVertexAttrib4fv(location, values); + } +} + +/*! + \overload + + Sets the attribute called \a name in the current context to \a value. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue(const char *name, const QColor& value) +{ + setAttributeValue(attributeLocation(name), value); +} + +/*! + Sets the attribute at \a location in the current context to the + contents of \a values, which contains \a columns elements, each + consisting of \a rows elements. The \a rows value should be + 1, 2, 3, or 4. This function is typically used to set matrix + values and column vectors. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue + (int location, const GLfloat *values, int columns, int rows) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (rows < 1 || rows > 4) { + qWarning() << "QOpenGLShaderProgram::setAttributeValue: rows" << rows << "not supported"; + return; + } + if (location != -1) { + while (columns-- > 0) { + if (rows == 1) + d->glfuncs->glVertexAttrib1fv(location, values); + else if (rows == 2) + d->glfuncs->glVertexAttrib2fv(location, values); + else if (rows == 3) + d->glfuncs->glVertexAttrib3fv(location, values); + else + d->glfuncs->glVertexAttrib4fv(location, values); + values += rows; + ++location; + } + } +} + +/*! + \overload + + Sets the attribute called \a name in the current context to the + contents of \a values, which contains \a columns elements, each + consisting of \a rows elements. The \a rows value should be + 1, 2, 3, or 4. This function is typically used to set matrix + values and column vectors. + + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::setAttributeValue + (const char *name, const GLfloat *values, int columns, int rows) +{ + setAttributeValue(attributeLocation(name), values, columns, rows); +} + +/*! + Sets an array of vertex \a values on the attribute at \a location + in this shader program. The \a tupleSize indicates the number of + components per vertex (1, 2, 3, or 4), and the \a stride indicates + the number of bytes between vertices. A default \a stride value + of zero indicates that the vertices are densely packed in \a values. + + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() +*/ +void QOpenGLShaderProgram::setAttributeArray + (int location, const GLfloat *values, int tupleSize, int stride) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + d->glfuncs->glVertexAttribPointer(location, tupleSize, GL_FLOAT, GL_FALSE, + stride, values); + } +} + +/*! + Sets an array of 2D vertex \a values on the attribute at \a location + in this shader program. The \a stride indicates the number of bytes + between vertices. A default \a stride value of zero indicates that + the vertices are densely packed in \a values. + + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() +*/ +void QOpenGLShaderProgram::setAttributeArray + (int location, const QVector2D *values, int stride) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + d->glfuncs->glVertexAttribPointer(location, 2, GL_FLOAT, GL_FALSE, + stride, values); + } +} + +/*! + Sets an array of 3D vertex \a values on the attribute at \a location + in this shader program. The \a stride indicates the number of bytes + between vertices. A default \a stride value of zero indicates that + the vertices are densely packed in \a values. + + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() +*/ +void QOpenGLShaderProgram::setAttributeArray + (int location, const QVector3D *values, int stride) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + d->glfuncs->glVertexAttribPointer(location, 3, GL_FLOAT, GL_FALSE, + stride, values); + } +} + +/*! + Sets an array of 4D vertex \a values on the attribute at \a location + in this shader program. The \a stride indicates the number of bytes + between vertices. A default \a stride value of zero indicates that + the vertices are densely packed in \a values. + + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() +*/ +void QOpenGLShaderProgram::setAttributeArray + (int location, const QVector4D *values, int stride) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + d->glfuncs->glVertexAttribPointer(location, 4, GL_FLOAT, GL_FALSE, + stride, values); + } +} + +/*! + Sets an array of vertex \a values on the attribute at \a location + in this shader program. The \a stride indicates the number of bytes + between vertices. A default \a stride value of zero indicates that + the vertices are densely packed in \a values. + + The \a type indicates the type of elements in the \a values array, + usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a tupleSize + indicates the number of components per vertex: 1, 2, 3, or 4. + + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + The setAttributeBuffer() function can be used to set the attribute + array to an offset within a vertex buffer. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray(), setAttributeBuffer() +*/ +void QOpenGLShaderProgram::setAttributeArray + (int location, GLenum type, const void *values, int tupleSize, int stride) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + d->glfuncs->glVertexAttribPointer(location, tupleSize, type, GL_TRUE, + stride, values); + } +} + +/*! + \overload + + Sets an array of vertex \a values on the attribute called \a name + in this shader program. The \a tupleSize indicates the number of + components per vertex (1, 2, 3, or 4), and the \a stride indicates + the number of bytes between vertices. A default \a stride value + of zero indicates that the vertices are densely packed in \a values. + + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() +*/ +void QOpenGLShaderProgram::setAttributeArray + (const char *name, const GLfloat *values, int tupleSize, int stride) +{ + setAttributeArray(attributeLocation(name), values, tupleSize, stride); +} + +/*! + \overload + + Sets an array of 2D vertex \a values on the attribute called \a name + in this shader program. The \a stride indicates the number of bytes + between vertices. A default \a stride value of zero indicates that + the vertices are densely packed in \a values. + + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() +*/ +void QOpenGLShaderProgram::setAttributeArray + (const char *name, const QVector2D *values, int stride) +{ + setAttributeArray(attributeLocation(name), values, stride); +} + +/*! + \overload + + Sets an array of 3D vertex \a values on the attribute called \a name + in this shader program. The \a stride indicates the number of bytes + between vertices. A default \a stride value of zero indicates that + the vertices are densely packed in \a values. + + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() +*/ +void QOpenGLShaderProgram::setAttributeArray + (const char *name, const QVector3D *values, int stride) +{ + setAttributeArray(attributeLocation(name), values, stride); +} + +/*! + \overload + + Sets an array of 4D vertex \a values on the attribute called \a name + in this shader program. The \a stride indicates the number of bytes + between vertices. A default \a stride value of zero indicates that + the vertices are densely packed in \a values. + + The array will become active when enableAttributeArray() is called + on \a name. Otherwise the value specified with setAttributeValue() + for \a name will be used. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray() +*/ +void QOpenGLShaderProgram::setAttributeArray + (const char *name, const QVector4D *values, int stride) +{ + setAttributeArray(attributeLocation(name), values, stride); +} + +/*! + \overload + + Sets an array of vertex \a values on the attribute called \a name + in this shader program. The \a stride indicates the number of bytes + between vertices. A default \a stride value of zero indicates that + the vertices are densely packed in \a values. + + The \a type indicates the type of elements in the \a values array, + usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a tupleSize + indicates the number of components per vertex: 1, 2, 3, or 4. + + The array will become active when enableAttributeArray() is called + on the \a name. Otherwise the value specified with + setAttributeValue() for \a name will be used. + + The setAttributeBuffer() function can be used to set the attribute + array to an offset within a vertex buffer. + + \sa setAttributeValue(), setUniformValue(), enableAttributeArray() + \sa disableAttributeArray(), setAttributeBuffer() +*/ +void QOpenGLShaderProgram::setAttributeArray + (const char *name, GLenum type, const void *values, int tupleSize, int stride) +{ + setAttributeArray(attributeLocation(name), type, values, tupleSize, stride); +} + +/*! + Sets an array of vertex values on the attribute at \a location in + this shader program, starting at a specific \a offset in the + currently bound vertex buffer. The \a stride indicates the number + of bytes between vertices. A default \a stride value of zero + indicates that the vertices are densely packed in the value array. + + The \a type indicates the type of elements in the vertex value + array, usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a + tupleSize indicates the number of components per vertex: 1, 2, 3, + or 4. + + The array will become active when enableAttributeArray() is called + on the \a location. Otherwise the value specified with + setAttributeValue() for \a location will be used. + + \sa setAttributeArray() +*/ +void QOpenGLShaderProgram::setAttributeBuffer + (int location, GLenum type, int offset, int tupleSize, int stride) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + d->glfuncs->glVertexAttribPointer(location, tupleSize, type, GL_TRUE, stride, + reinterpret_cast(offset)); + } +} + +/*! + \overload + + Sets an array of vertex values on the attribute called \a name + in this shader program, starting at a specific \a offset in the + currently bound vertex buffer. The \a stride indicates the number + of bytes between vertices. A default \a stride value of zero + indicates that the vertices are densely packed in the value array. + + The \a type indicates the type of elements in the vertex value + array, usually \c{GL_FLOAT}, \c{GL_UNSIGNED_BYTE}, etc. The \a + tupleSize indicates the number of components per vertex: 1, 2, 3, + or 4. + + The array will become active when enableAttributeArray() is called + on the \a name. Otherwise the value specified with + setAttributeValue() for \a name will be used. + + \sa setAttributeArray() +*/ +void QOpenGLShaderProgram::setAttributeBuffer + (const char *name, GLenum type, int offset, int tupleSize, int stride) +{ + setAttributeBuffer(attributeLocation(name), type, offset, tupleSize, stride); +} + +/*! + Enables the vertex array at \a location in this shader program + so that the value set by setAttributeArray() on \a location + will be used by the shader program. + + \sa disableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::enableAttributeArray(int location) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glEnableVertexAttribArray(location); +} + +/*! + \overload + + Enables the vertex array called \a name in this shader program + so that the value set by setAttributeArray() on \a name + will be used by the shader program. + + \sa disableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::enableAttributeArray(const char *name) +{ + enableAttributeArray(attributeLocation(name)); +} + +/*! + Disables the vertex array at \a location in this shader program + that was enabled by a previous call to enableAttributeArray(). + + \sa enableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::disableAttributeArray(int location) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glDisableVertexAttribArray(location); +} + +/*! + \overload + + Disables the vertex array called \a name in this shader program + that was enabled by a previous call to enableAttributeArray(). + + \sa enableAttributeArray(), setAttributeArray(), setAttributeValue() + \sa setUniformValue() +*/ +void QOpenGLShaderProgram::disableAttributeArray(const char *name) +{ + disableAttributeArray(attributeLocation(name)); +} + +/*! + Returns the location of the uniform variable \a name within this shader + program's parameter list. Returns -1 if \a name is not a valid + uniform variable for this shader program. + + \sa attributeLocation() +*/ +int QOpenGLShaderProgram::uniformLocation(const char *name) const +{ + Q_D(const QOpenGLShaderProgram); + Q_UNUSED(d); + if (d->linked && d->programGuard && d->programGuard->id()) { + return d->glfuncs->glGetUniformLocation(d->programGuard->id(), name); + } else { + qWarning() << "QOpenGLShaderProgram::uniformLocation(" << name + << "): shader program is not linked"; + return -1; + } +} + +/*! + \overload + + Returns the location of the uniform variable \a name within this shader + program's parameter list. Returns -1 if \a name is not a valid + uniform variable for this shader program. + + \sa attributeLocation() +*/ +int QOpenGLShaderProgram::uniformLocation(const QByteArray& name) const +{ + return uniformLocation(name.constData()); +} + +/*! + \overload + + Returns the location of the uniform variable \a name within this shader + program's parameter list. Returns -1 if \a name is not a valid + uniform variable for this shader program. + + \sa attributeLocation() +*/ +int QOpenGLShaderProgram::uniformLocation(const QString& name) const +{ + return uniformLocation(name.toLatin1().constData()); +} + +/*! + Sets the uniform variable at \a location in the current context to \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, GLfloat value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform1fv(location, 1, &value); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, GLfloat value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context to \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, GLint value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform1i(location, value); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, GLint value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context to \a value. + This function should be used when setting sampler values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, GLuint value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform1i(location, value); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to \a value. This function should be used when setting sampler values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, GLuint value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context to + the 2D vector (\a x, \a y). + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, GLfloat x, GLfloat y) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat values[2] = {x, y}; + d->glfuncs->glUniform2fv(location, 1, values); + } +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context to + the 2D vector (\a x, \a y). + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, GLfloat x, GLfloat y) +{ + setUniformValue(uniformLocation(name), x, y); +} + +/*! + Sets the uniform variable at \a location in the current context to + the 3D vector (\a x, \a y, \a z). + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue + (int location, GLfloat x, GLfloat y, GLfloat z) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat values[3] = {x, y, z}; + d->glfuncs->glUniform3fv(location, 1, values); + } +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context to + the 3D vector (\a x, \a y, \a z). + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue + (const char *name, GLfloat x, GLfloat y, GLfloat z) +{ + setUniformValue(uniformLocation(name), x, y, z); +} + +/*! + Sets the uniform variable at \a location in the current context to + the 4D vector (\a x, \a y, \a z, \a w). + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue + (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat values[4] = {x, y, z, w}; + d->glfuncs->glUniform4fv(location, 1, values); + } +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context to + the 4D vector (\a x, \a y, \a z, \a w). + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue + (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + setUniformValue(uniformLocation(name), x, y, z, w); +} + +/*! + Sets the uniform variable at \a location in the current context to \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QVector2D& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform2fv(location, 1, reinterpret_cast(&value)); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector2D& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context to \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QVector3D& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform3fv(location, 1, reinterpret_cast(&value)); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector3D& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context to \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QVector4D& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform4fv(location, 1, reinterpret_cast(&value)); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QVector4D& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context to + the red, green, blue, and alpha components of \a color. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QColor& color) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat values[4] = {GLfloat(color.redF()), GLfloat(color.greenF()), + GLfloat(color.blueF()), GLfloat(color.alphaF())}; + d->glfuncs->glUniform4fv(location, 1, values); + } +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context to + the red, green, blue, and alpha components of \a color. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QColor& color) +{ + setUniformValue(uniformLocation(name), color); +} + +/*! + Sets the uniform variable at \a location in the current context to + the x and y coordinates of \a point. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QPoint& point) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())}; + d->glfuncs->glUniform2fv(location, 1, values); + } +} + +/*! + \overload + + Sets the uniform variable associated with \a name in the current + context to the x and y coordinates of \a point. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QPoint& point) +{ + setUniformValue(uniformLocation(name), point); +} + +/*! + Sets the uniform variable at \a location in the current context to + the x and y coordinates of \a point. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QPointF& point) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())}; + d->glfuncs->glUniform2fv(location, 1, values); + } +} + +/*! + \overload + + Sets the uniform variable associated with \a name in the current + context to the x and y coordinates of \a point. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QPointF& point) +{ + setUniformValue(uniformLocation(name), point); +} + +/*! + Sets the uniform variable at \a location in the current context to + the width and height of the given \a size. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QSize& size) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())}; + d->glfuncs->glUniform2fv(location, 1, values); + } +} + +/*! + \overload + + Sets the uniform variable associated with \a name in the current + context to the width and height of the given \a size. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QSize& size) +{ + setUniformValue(uniformLocation(name), size); +} + +/*! + Sets the uniform variable at \a location in the current context to + the width and height of the given \a size. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QSizeF& size) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())}; + d->glfuncs->glUniform2fv(location, 1, values); + } +} + +/*! + \overload + + Sets the uniform variable associated with \a name in the current + context to the width and height of the given \a size. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QSizeF& size) +{ + setUniformValue(uniformLocation(name), size); +} + +// We have to repack matrices from qreal to GLfloat. +#define setUniformMatrix(func,location,value,cols,rows) \ + if (location == -1) \ + return; \ + if (sizeof(qreal) == sizeof(GLfloat)) { \ + func(location, 1, GL_FALSE, \ + reinterpret_cast(value.constData())); \ + } else { \ + GLfloat mat[cols * rows]; \ + const qreal *data = value.constData(); \ + for (int i = 0; i < cols * rows; ++i) \ + mat[i] = data[i]; \ + func(location, 1, GL_FALSE, mat); \ + } +#define setUniformGenericMatrix(colfunc,location,value,cols,rows) \ + if (location == -1) \ + return; \ + if (sizeof(qreal) == sizeof(GLfloat)) { \ + const GLfloat *data = reinterpret_cast \ + (value.constData()); \ + colfunc(location, cols, data); \ + } else { \ + GLfloat mat[cols * rows]; \ + const qreal *data = value.constData(); \ + for (int i = 0; i < cols * rows; ++i) \ + mat[i] = data[i]; \ + colfunc(location, cols, mat); \ + } + +/*! + Sets the uniform variable at \a location in the current context + to a 2x2 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x2& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformMatrix(d->glfuncs->glUniformMatrix2fv, location, value, 2, 2); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 2x2 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x2& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context + to a 2x3 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x3& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrix + (d->glfuncs->glUniform3fv, location, value, 2, 3); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 2x3 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x3& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context + to a 2x4 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix2x4& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrix + (d->glfuncs->glUniform4fv, location, value, 2, 4); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 2x4 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix2x4& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context + to a 3x2 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x2& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrix + (d->glfuncs->glUniform2fv, location, value, 3, 2); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 3x2 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x2& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context + to a 3x3 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x3& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformMatrix(d->glfuncs->glUniformMatrix3fv, location, value, 3, 3); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 3x3 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x3& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context + to a 3x4 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix3x4& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrix + (d->glfuncs->glUniform4fv, location, value, 3, 4); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 3x4 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix3x4& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context + to a 4x2 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x2& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrix + (d->glfuncs->glUniform2fv, location, value, 4, 2); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 4x2 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x2& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context + to a 4x3 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x3& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrix + (d->glfuncs->glUniform3fv, location, value, 4, 3); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 4x3 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x3& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context + to a 4x4 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QMatrix4x4& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformMatrix(d->glfuncs->glUniformMatrix4fv, location, value, 4, 4); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 4x4 matrix \a value. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const QMatrix4x4& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + \overload + + Sets the uniform variable at \a location in the current context + to a 2x2 matrix \a value. The matrix elements must be specified + in column-major order. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[2][2]) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniformMatrix2fv(location, 1, GL_FALSE, value[0]); +} + +/*! + \overload + + Sets the uniform variable at \a location in the current context + to a 3x3 matrix \a value. The matrix elements must be specified + in column-major order. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[3][3]) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, value[0]); +} + +/*! + \overload + + Sets the uniform variable at \a location in the current context + to a 4x4 matrix \a value. The matrix elements must be specified + in column-major order. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const GLfloat value[4][4]) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniformMatrix4fv(location, 1, GL_FALSE, value[0]); +} + + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 2x2 matrix \a value. The matrix elements must be specified + in column-major order. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[2][2]) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 3x3 matrix \a value. The matrix elements must be specified + in column-major order. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[3][3]) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context + to a 4x4 matrix \a value. The matrix elements must be specified + in column-major order. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValue(const char *name, const GLfloat value[4][4]) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable at \a location in the current context to a + 3x3 transformation matrix \a value that is specified as a QTransform value. + + To set a QTransform value as a 4x4 matrix in a shader, use + \c{setUniformValue(location, QMatrix4x4(value))}. +*/ +void QOpenGLShaderProgram::setUniformValue(int location, const QTransform& value) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + GLfloat mat[3][3] = { + {GLfloat(value.m11()), GLfloat(value.m12()), GLfloat(value.m13())}, + {GLfloat(value.m21()), GLfloat(value.m22()), GLfloat(value.m23())}, + {GLfloat(value.m31()), GLfloat(value.m32()), GLfloat(value.m33())} + }; + d->glfuncs->glUniformMatrix3fv(location, 1, GL_FALSE, mat[0]); + } +} + +/*! + \overload + + Sets the uniform variable called \a name in the current context to a + 3x3 transformation matrix \a value that is specified as a QTransform value. + + To set a QTransform value as a 4x4 matrix in a shader, use + \c{setUniformValue(name, QMatrix4x4(value))}. +*/ +void QOpenGLShaderProgram::setUniformValue + (const char *name, const QTransform& value) +{ + setUniformValue(uniformLocation(name), value); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const GLint *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform1iv(location, count, values); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray + (const char *name, const GLint *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count elements of \a values. This overload + should be used when setting an array of sampler values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const GLuint *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform1iv(location, count, reinterpret_cast(values)); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count elements of \a values. This overload + should be used when setting an array of sampler values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray + (const char *name, const GLuint *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count elements of \a values. Each element + has \a tupleSize components. The \a tupleSize must be 1, 2, 3, or 4. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) { + if (tupleSize == 1) + d->glfuncs->glUniform1fv(location, count, values); + else if (tupleSize == 2) + d->glfuncs->glUniform2fv(location, count, values); + else if (tupleSize == 3) + d->glfuncs->glUniform3fv(location, count, values); + else if (tupleSize == 4) + d->glfuncs->glUniform4fv(location, count, values); + else + qWarning() << "QOpenGLShaderProgram::setUniformValue: size" << tupleSize << "not supported"; + } +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count elements of \a values. Each element + has \a tupleSize components. The \a tupleSize must be 1, 2, 3, or 4. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray + (const char *name, const GLfloat *values, int count, int tupleSize) +{ + setUniformValueArray(uniformLocation(name), values, count, tupleSize); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 2D vector elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector2D *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform2fv(location, count, reinterpret_cast(values)); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 2D vector elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector2D *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 3D vector elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector3D *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform3fv(location, count, reinterpret_cast(values)); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 3D vector elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector3D *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 4D vector elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QVector4D *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + if (location != -1) + d->glfuncs->glUniform4fv(location, count, reinterpret_cast(values)); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 4D vector elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QVector4D *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +// We have to repack matrix arrays from qreal to GLfloat. +#define setUniformMatrixArray(func,location,values,count,type,cols,rows) \ + if (location == -1 || count <= 0) \ + return; \ + if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ + func(location, count, GL_FALSE, \ + reinterpret_cast(values[0].constData())); \ + } else { \ + QVarLengthArray temp(cols * rows * count); \ + for (int index = 0; index < count; ++index) { \ + for (int index2 = 0; index2 < (cols * rows); ++index2) { \ + temp.data()[cols * rows * index + index2] = \ + values[index].constData()[index2]; \ + } \ + } \ + func(location, count, GL_FALSE, temp.constData()); \ + } +#define setUniformGenericMatrixArray(colfunc,location,values,count,type,cols,rows) \ + if (location == -1 || count <= 0) \ + return; \ + if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ + const GLfloat *data = reinterpret_cast \ + (values[0].constData()); \ + colfunc(location, count * cols, data); \ + } else { \ + QVarLengthArray temp(cols * rows * count); \ + for (int index = 0; index < count; ++index) { \ + for (int index2 = 0; index2 < (cols * rows); ++index2) { \ + temp.data()[cols * rows * index + index2] = \ + values[index].constData()[index2]; \ + } \ + } \ + colfunc(location, count * cols, temp.constData()); \ + } + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 2x2 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x2 *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformMatrixArray + (d->glfuncs->glUniformMatrix2fv, location, values, count, QMatrix2x2, 2, 2); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 2x2 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x2 *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 2x3 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x3 *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrixArray + (d->glfuncs->glUniform3fv, location, values, count, + QMatrix2x3, 2, 3); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 2x3 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x3 *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 2x4 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix2x4 *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrixArray + (d->glfuncs->glUniform4fv, location, values, count, + QMatrix2x4, 2, 4); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 2x4 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix2x4 *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 3x2 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x2 *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrixArray + (d->glfuncs->glUniform2fv, location, values, count, + QMatrix3x2, 3, 2); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 3x2 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x2 *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 3x3 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x3 *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformMatrixArray + (d->glfuncs->glUniformMatrix3fv, location, values, count, QMatrix3x3, 3, 3); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 3x3 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x3 *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 3x4 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix3x4 *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrixArray + (d->glfuncs->glUniform4fv, location, values, count, + QMatrix3x4, 3, 4); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 3x4 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix3x4 *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 4x2 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x2 *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrixArray + (d->glfuncs->glUniform2fv, location, values, count, + QMatrix4x2, 4, 2); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 4x2 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x2 *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 4x3 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x3 *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformGenericMatrixArray + (d->glfuncs->glUniform3fv, location, values, count, + QMatrix4x3, 4, 3); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 4x3 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x3 *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Sets the uniform variable array at \a location in the current + context to the \a count 4x4 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(int location, const QMatrix4x4 *values, int count) +{ + Q_D(QOpenGLShaderProgram); + Q_UNUSED(d); + setUniformMatrixArray + (d->glfuncs->glUniformMatrix4fv, location, values, count, QMatrix4x4, 4, 4); +} + +/*! + \overload + + Sets the uniform variable array called \a name in the current + context to the \a count 4x4 matrix elements of \a values. + + \sa setAttributeValue() +*/ +void QOpenGLShaderProgram::setUniformValueArray(const char *name, const QMatrix4x4 *values, int count) +{ + setUniformValueArray(uniformLocation(name), values, count); +} + +/*! + Returns the hardware limit for how many vertices a geometry shader + can output. + + \sa setGeometryOutputVertexCount() +*/ +int QOpenGLShaderProgram::maxGeometryOutputVertices() const +{ + GLint n = 0; +// glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT, &n); + return n; +} + +/*! + Sets the maximum number of vertices the current geometry shader + program will produce, if active, to \a count. + + This parameter takes effect the next time the program is linked. +*/ +void QOpenGLShaderProgram::setGeometryOutputVertexCount(int count) +{ +#ifndef QT_NO_DEBUG + int max = maxGeometryOutputVertices(); + if (count > max) { + qWarning("QOpenGLShaderProgram::setGeometryOutputVertexCount: count: %d higher than maximum: %d", + count, max); + } +#endif + d_func()->geometryVertexCount = count; +} + + +/*! + Returns the maximum number of vertices the current geometry shader + program will produce, if active. + + This parameter takes effect the ntext time the program is linked. +*/ +int QOpenGLShaderProgram::geometryOutputVertexCount() const +{ + return d_func()->geometryVertexCount; +} + + +/*! + Sets the input type from \a inputType. + + This parameter takes effect the next time the program is linked. +*/ +void QOpenGLShaderProgram::setGeometryInputType(GLenum inputType) +{ + d_func()->geometryInputType = inputType; +} + + +/*! + Returns the geometry shader input type, if active. + + This parameter takes effect the next time the program is linked. + */ + +GLenum QOpenGLShaderProgram::geometryInputType() const +{ + return d_func()->geometryInputType; +} + + +/*! + Sets the output type from the geometry shader, if active, to + \a outputType. + + This parameter takes effect the next time the program is linked. +*/ +void QOpenGLShaderProgram::setGeometryOutputType(GLenum outputType) +{ + d_func()->geometryOutputType = outputType; +} + + +/*! + Returns the geometry shader output type, if active. + + This parameter takes effect the next time the program is linked. + */ +GLenum QOpenGLShaderProgram::geometryOutputType() const +{ + return d_func()->geometryOutputType; +} + + +/*! + Returns true if shader programs written in the OpenGL Shading + Language (GLSL) are supported on this system; false otherwise. + + The \a context is used to resolve the GLSL extensions. + If \a context is null, then QOpenGLContext::currentContext() is used. +*/ +bool QOpenGLShaderProgram::hasOpenGLShaderPrograms(QOpenGLContext *context) +{ +#if !defined(QT_OPENGL_ES_2) + if (!context) + context = QOpenGLContext::currentContext(); + if (!context) + return false; + return QOpenGLFunctions(context).hasOpenGLFeature(QOpenGLFunctions::Shaders); +#else + Q_UNUSED(context); + return true; +#endif +} + +/*! + \internal +*/ +void QOpenGLShaderProgram::shaderDestroyed() +{ + Q_D(QOpenGLShaderProgram); + QOpenGLShader *shader = qobject_cast(sender()); + if (shader && !d->removingShaders) + removeShader(shader); +} + +/*! + Returns true if shader programs of type \a type are supported on + this system; false otherwise. + + The \a context is used to resolve the GLSL extensions. + If \a context is null, then QOpenGLContext::currentContext() is used. +*/ +bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context) +{ + if (!context) + context = QOpenGLContext::currentContext(); + if (!context) + return false; + + if ((type & ~(Geometry | Vertex | Fragment)) || type == 0) + return false; + +#if 0 + bool resolved = qt_resolve_glsl_extensions(const_cast(context)); + if (!resolved) + return false; + + if ((type & Geometry) && !QByteArray((const char *) glGetString(GL_EXTENSIONS)).contains("GL_EXT_geometry_shader4")) + return false; +#endif + + return true; +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/qopenglshaderprogram.h b/src/gui/opengl/qopenglshaderprogram.h new file mode 100644 index 00000000000..4c123749a2d --- /dev/null +++ b/src/gui/opengl/qopenglshaderprogram.h @@ -0,0 +1,317 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENGLSHADERPROGRAM_H +#define QOPENGLSHADERPROGRAM_H + +#include +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QOpenGLContext; +class QOpenGLShaderProgram; +class QOpenGLShaderPrivate; + +class Q_GUI_EXPORT QOpenGLShader : public QObject +{ + Q_OBJECT +public: + enum ShaderTypeBit + { + Vertex = 0x0001, + Fragment = 0x0002, + Geometry = 0x0004 + }; + Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit) + + explicit QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent = 0); + virtual ~QOpenGLShader(); + + QOpenGLShader::ShaderType shaderType() const; + + bool compileSourceCode(const char *source); + bool compileSourceCode(const QByteArray& source); + bool compileSourceCode(const QString& source); + bool compileSourceFile(const QString& fileName); + + QByteArray sourceCode() const; + + bool isCompiled() const; + QString log() const; + + GLuint shaderId() const; + + static bool hasOpenGLShaders(ShaderType type, QOpenGLContext *context = 0); + +private: + friend class QOpenGLShaderProgram; + + Q_DISABLE_COPY(QOpenGLShader) + Q_DECLARE_PRIVATE(QOpenGLShader) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLShader::ShaderType) + + +class QOpenGLShaderProgramPrivate; + +#ifndef GL_EXT_geometry_shader4 +# define GL_LINES_ADJACENCY_EXT 0xA +# define GL_LINE_STRIP_ADJACENCY_EXT 0xB +# define GL_TRIANGLES_ADJACENCY_EXT 0xC +# define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0xD +#endif + + +class Q_GUI_EXPORT QOpenGLShaderProgram : public QObject +{ + Q_OBJECT +public: + explicit QOpenGLShaderProgram(QObject *parent = 0); + virtual ~QOpenGLShaderProgram(); + + bool addShader(QOpenGLShader *shader); + void removeShader(QOpenGLShader *shader); + QList shaders() const; + + bool addShaderFromSourceCode(QOpenGLShader::ShaderType type, const char *source); + bool addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray& source); + bool addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString& source); + bool addShaderFromSourceFile(QOpenGLShader::ShaderType type, const QString& fileName); + + void removeAllShaders(); + + virtual bool link(); + bool isLinked() const; + QString log() const; + + bool bind(); + void release(); + + GLuint programId() const; + + int maxGeometryOutputVertices() const; + + void setGeometryOutputVertexCount(int count); + int geometryOutputVertexCount() const; + + void setGeometryInputType(GLenum inputType); + GLenum geometryInputType() const; + + void setGeometryOutputType(GLenum outputType); + GLenum geometryOutputType() const; + + void bindAttributeLocation(const char *name, int location); + void bindAttributeLocation(const QByteArray& name, int location); + void bindAttributeLocation(const QString& name, int location); + + int attributeLocation(const char *name) const; + int attributeLocation(const QByteArray& name) const; + int attributeLocation(const QString& name) const; + + void setAttributeValue(int location, GLfloat value); + void setAttributeValue(int location, GLfloat x, GLfloat y); + void setAttributeValue(int location, GLfloat x, GLfloat y, GLfloat z); + void setAttributeValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setAttributeValue(int location, const QVector2D& value); + void setAttributeValue(int location, const QVector3D& value); + void setAttributeValue(int location, const QVector4D& value); + void setAttributeValue(int location, const QColor& value); + void setAttributeValue(int location, const GLfloat *values, int columns, int rows); + + void setAttributeValue(const char *name, GLfloat value); + void setAttributeValue(const char *name, GLfloat x, GLfloat y); + void setAttributeValue(const char *name, GLfloat x, GLfloat y, GLfloat z); + void setAttributeValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setAttributeValue(const char *name, const QVector2D& value); + void setAttributeValue(const char *name, const QVector3D& value); + void setAttributeValue(const char *name, const QVector4D& value); + void setAttributeValue(const char *name, const QColor& value); + void setAttributeValue(const char *name, const GLfloat *values, int columns, int rows); + + void setAttributeArray + (int location, const GLfloat *values, int tupleSize, int stride = 0); + void setAttributeArray + (int location, const QVector2D *values, int stride = 0); + void setAttributeArray + (int location, const QVector3D *values, int stride = 0); + void setAttributeArray + (int location, const QVector4D *values, int stride = 0); + void setAttributeArray + (int location, GLenum type, const void *values, int tupleSize, int stride = 0); + void setAttributeArray + (const char *name, const GLfloat *values, int tupleSize, int stride = 0); + void setAttributeArray + (const char *name, const QVector2D *values, int stride = 0); + void setAttributeArray + (const char *name, const QVector3D *values, int stride = 0); + void setAttributeArray + (const char *name, const QVector4D *values, int stride = 0); + void setAttributeArray + (const char *name, GLenum type, const void *values, int tupleSize, int stride = 0); + + void setAttributeBuffer + (int location, GLenum type, int offset, int tupleSize, int stride = 0); + void setAttributeBuffer + (const char *name, GLenum type, int offset, int tupleSize, int stride = 0); + + void enableAttributeArray(int location); + void enableAttributeArray(const char *name); + void disableAttributeArray(int location); + void disableAttributeArray(const char *name); + + int uniformLocation(const char *name) const; + int uniformLocation(const QByteArray& name) const; + int uniformLocation(const QString& name) const; + + void setUniformValue(int location, GLfloat value); + void setUniformValue(int location, GLint value); + void setUniformValue(int location, GLuint value); + void setUniformValue(int location, GLfloat x, GLfloat y); + void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z); + void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setUniformValue(int location, const QVector2D& value); + void setUniformValue(int location, const QVector3D& value); + void setUniformValue(int location, const QVector4D& value); + void setUniformValue(int location, const QColor& color); + void setUniformValue(int location, const QPoint& point); + void setUniformValue(int location, const QPointF& point); + void setUniformValue(int location, const QSize& size); + void setUniformValue(int location, const QSizeF& size); + void setUniformValue(int location, const QMatrix2x2& value); + void setUniformValue(int location, const QMatrix2x3& value); + void setUniformValue(int location, const QMatrix2x4& value); + void setUniformValue(int location, const QMatrix3x2& value); + void setUniformValue(int location, const QMatrix3x3& value); + void setUniformValue(int location, const QMatrix3x4& value); + void setUniformValue(int location, const QMatrix4x2& value); + void setUniformValue(int location, const QMatrix4x3& value); + void setUniformValue(int location, const QMatrix4x4& value); + void setUniformValue(int location, const GLfloat value[2][2]); + void setUniformValue(int location, const GLfloat value[3][3]); + void setUniformValue(int location, const GLfloat value[4][4]); + void setUniformValue(int location, const QTransform& value); + + void setUniformValue(const char *name, GLfloat value); + void setUniformValue(const char *name, GLint value); + void setUniformValue(const char *name, GLuint value); + void setUniformValue(const char *name, GLfloat x, GLfloat y); + void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z); + void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setUniformValue(const char *name, const QVector2D& value); + void setUniformValue(const char *name, const QVector3D& value); + void setUniformValue(const char *name, const QVector4D& value); + void setUniformValue(const char *name, const QColor& color); + void setUniformValue(const char *name, const QPoint& point); + void setUniformValue(const char *name, const QPointF& point); + void setUniformValue(const char *name, const QSize& size); + void setUniformValue(const char *name, const QSizeF& size); + void setUniformValue(const char *name, const QMatrix2x2& value); + void setUniformValue(const char *name, const QMatrix2x3& value); + void setUniformValue(const char *name, const QMatrix2x4& value); + void setUniformValue(const char *name, const QMatrix3x2& value); + void setUniformValue(const char *name, const QMatrix3x3& value); + void setUniformValue(const char *name, const QMatrix3x4& value); + void setUniformValue(const char *name, const QMatrix4x2& value); + void setUniformValue(const char *name, const QMatrix4x3& value); + void setUniformValue(const char *name, const QMatrix4x4& value); + void setUniformValue(const char *name, const GLfloat value[2][2]); + void setUniformValue(const char *name, const GLfloat value[3][3]); + void setUniformValue(const char *name, const GLfloat value[4][4]); + void setUniformValue(const char *name, const QTransform& value); + + void setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize); + void setUniformValueArray(int location, const GLint *values, int count); + void setUniformValueArray(int location, const GLuint *values, int count); + void setUniformValueArray(int location, const QVector2D *values, int count); + void setUniformValueArray(int location, const QVector3D *values, int count); + void setUniformValueArray(int location, const QVector4D *values, int count); + void setUniformValueArray(int location, const QMatrix2x2 *values, int count); + void setUniformValueArray(int location, const QMatrix2x3 *values, int count); + void setUniformValueArray(int location, const QMatrix2x4 *values, int count); + void setUniformValueArray(int location, const QMatrix3x2 *values, int count); + void setUniformValueArray(int location, const QMatrix3x3 *values, int count); + void setUniformValueArray(int location, const QMatrix3x4 *values, int count); + void setUniformValueArray(int location, const QMatrix4x2 *values, int count); + void setUniformValueArray(int location, const QMatrix4x3 *values, int count); + void setUniformValueArray(int location, const QMatrix4x4 *values, int count); + + void setUniformValueArray(const char *name, const GLfloat *values, int count, int tupleSize); + void setUniformValueArray(const char *name, const GLint *values, int count); + void setUniformValueArray(const char *name, const GLuint *values, int count); + void setUniformValueArray(const char *name, const QVector2D *values, int count); + void setUniformValueArray(const char *name, const QVector3D *values, int count); + void setUniformValueArray(const char *name, const QVector4D *values, int count); + void setUniformValueArray(const char *name, const QMatrix2x2 *values, int count); + void setUniformValueArray(const char *name, const QMatrix2x3 *values, int count); + void setUniformValueArray(const char *name, const QMatrix2x4 *values, int count); + void setUniformValueArray(const char *name, const QMatrix3x2 *values, int count); + void setUniformValueArray(const char *name, const QMatrix3x3 *values, int count); + void setUniformValueArray(const char *name, const QMatrix3x4 *values, int count); + void setUniformValueArray(const char *name, const QMatrix4x2 *values, int count); + void setUniformValueArray(const char *name, const QMatrix4x3 *values, int count); + void setUniformValueArray(const char *name, const QMatrix4x4 *values, int count); + + static bool hasOpenGLShaderPrograms(QOpenGLContext *context = 0); + +private Q_SLOTS: + void shaderDestroyed(); + +private: + Q_DISABLE_COPY(QOpenGLShaderProgram) + Q_DECLARE_PRIVATE(QOpenGLShaderProgram) + + bool init(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp new file mode 100644 index 00000000000..067b7a9e20f --- /dev/null +++ b/src/gui/opengl/qopengltexturecache.cpp @@ -0,0 +1,215 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopengltexturecache_p.h" +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QOpenGLTextureCacheWrapper +{ +public: + QOpenGLTextureCacheWrapper() + { + QImagePixmapCleanupHooks::instance()->addPlatformPixmapModificationHook(cleanupTexturesForPixmapData); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapDestructionHook(cleanupTexturesForPixmapData); + QImagePixmapCleanupHooks::instance()->addImageHook(cleanupTexturesForCacheKey); + } + + ~QOpenGLTextureCacheWrapper() + { + QImagePixmapCleanupHooks::instance()->removePlatformPixmapModificationHook(cleanupTexturesForPixmapData); + QImagePixmapCleanupHooks::instance()->removePlatformPixmapDestructionHook(cleanupTexturesForPixmapData); + QImagePixmapCleanupHooks::instance()->removeImageHook(cleanupTexturesForCacheKey); + } + + QOpenGLTextureCache *cacheForContext(QOpenGLContext *context) { + QMutexLocker lock(&m_mutex); + return m_resource.value(context); + } + + static void cleanupTexturesForCacheKey(qint64 key); + static void cleanupTexturesForPixmapData(QPlatformPixmap *pmd); + +private: + QOpenGLMultiGroupSharedResource m_resource; + QMutex m_mutex; +}; + +Q_GLOBAL_STATIC(QOpenGLTextureCacheWrapper, qt_texture_caches) + +QOpenGLTextureCache *QOpenGLTextureCache::cacheForContext(QOpenGLContext *context) +{ + return qt_texture_caches()->cacheForContext(context); +} + +void QOpenGLTextureCacheWrapper::cleanupTexturesForCacheKey(qint64 key) +{ + QList resources = qt_texture_caches()->m_resource.resources(); + for (QList::iterator it = resources.begin(); it != resources.end(); ++it) + static_cast(*it)->invalidate(key); +} + +void QOpenGLTextureCacheWrapper::cleanupTexturesForPixmapData(QPlatformPixmap *pmd) +{ + cleanupTexturesForCacheKey(pmd->cacheKey()); +} + +QOpenGLTextureCache::QOpenGLTextureCache(QOpenGLContext *ctx) + : QOpenGLSharedResource(ctx->shareGroup()) + , m_cache(64 * 1024) // 64 MB cache +{ +} + +QOpenGLTextureCache::~QOpenGLTextureCache() +{ +} + +GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &pixmap) +{ + QMutexLocker locker(&m_mutex); + qint64 key = pixmap.cacheKey(); + + // A QPainter is active on the image - take the safe route and replace the texture. + if (!pixmap.paintingActive()) { + QOpenGLCachedTexture *entry = m_cache.object(key); + if (entry) { + glBindTexture(GL_TEXTURE_2D, entry->id()); + return entry->id(); + } + } + + GLuint id = bindTexture(context, key, pixmap.toImage()); + if (id > 0) + QImagePixmapCleanupHooks::enableCleanupHooks(pixmap); + + return id; +} + +GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &image) +{ + QMutexLocker locker(&m_mutex); + qint64 key = image.cacheKey(); + + // A QPainter is active on the image - take the safe route and replace the texture. + if (!image.paintingActive()) { + QOpenGLCachedTexture *entry = m_cache.object(key); + if (entry) { + glBindTexture(GL_TEXTURE_2D, entry->id()); + return entry->id(); + } + } + + GLuint id = bindTexture(context, key, image); + if (id > 0) + QImagePixmapCleanupHooks::enableCleanupHooks(image); + + return id; +} + +static inline void qgl_byteSwapImage(QImage &img) +{ + const int width = img.width(); + const int height = img.height(); + + if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) + { + for (int i = 0; i < height; ++i) { + uint *p = (uint *) img.scanLine(i); + for (int x = 0; x < width; ++x) + p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00); + } + } else { + for (int i = 0; i < height; ++i) { + uint *p = (uint *) img.scanLine(i); + for (int x = 0; x < width; ++x) + p[x] = (p[x] << 8) | (p[x] >> 24); + } + } +} + +GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, const QImage &image) +{ + GLuint id; + glGenTextures(1, &id); + glBindTexture(GL_TEXTURE_2D, id); + + QImage tx = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); + + qgl_byteSwapImage(tx); + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tx.width(), tx.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, const_cast(tx).bits()); + + int cost = tx.width() * tx.height() * 4 / 1024; + m_cache.insert(key, new QOpenGLCachedTexture(id, context), cost); + + return id; +} + +void QOpenGLTextureCache::invalidate(qint64 key) +{ + QMutexLocker locker(&m_mutex); + m_cache.remove(key); +} + +void QOpenGLTextureCache::invalidateResource() +{ + m_cache.clear(); +} + +void QOpenGLTextureCache::freeResource(QOpenGLContext *) +{ + Q_ASSERT(false); // the texture cache lives until the context group disappears +} + +static void freeTexture(QOpenGLFunctions *, GLuint id) +{ + glDeleteTextures(1, &id); +} + +QOpenGLCachedTexture::QOpenGLCachedTexture(GLuint id, QOpenGLContext *context) +{ + m_resource = new QOpenGLSharedResourceGuard(context, id, freeTexture); +} + +QT_END_NAMESPACE diff --git a/src/gui/embedded/qunixsocketserver_p.h b/src/gui/opengl/qopengltexturecache_p.h similarity index 65% rename from src/gui/embedded/qunixsocketserver_p.h rename to src/gui/opengl/qopengltexturecache_p.h index f83297be253..bdee9f4e838 100644 --- a/src/gui/embedded/qunixsocketserver_p.h +++ b/src/gui/opengl/qopengltexturecache_p.h @@ -39,9 +39,6 @@ ** ****************************************************************************/ -#ifndef QUNIXSOCKETSERVER_P_H -#define QUNIXSOCKETSERVER_P_H - // // W A R N I N G // ------------- @@ -53,46 +50,53 @@ // We mean it. // -#include +#ifndef QOPENGLTEXTURECACHE_P_H +#define QOPENGLTEXTURECACHE_P_H + +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE -class QUnixSocketServerPrivate; -class Q_GUI_EXPORT QUnixSocketServer : public QObject +class QOpenGLCachedTexture { - Q_OBJECT public: - enum ServerError { NoError, InvalidPath, ResourceError, BindError, - ListenError }; + QOpenGLCachedTexture(GLuint id, QOpenGLContext *context); + ~QOpenGLCachedTexture() { m_resource->free(); } - QUnixSocketServer(QObject *parent=0); - virtual ~QUnixSocketServer(); - - void close(); - - ServerError serverError() const; - - bool isListening() const; - bool listen(const QByteArray & path); - - int socketDescriptor() const; - QByteArray serverAddress() const; - - int maxPendingConnections() const; - void setMaxPendingConnections(int numConnections); - -protected: - virtual void incomingConnection(int socketDescriptor) = 0; + GLuint id() const { return m_resource->id(); } private: - QUnixSocketServer(const QUnixSocketServer &); - QUnixSocketServer & operator=(const QUnixSocketServer &); - - friend class QUnixSocketServerPrivate; - QUnixSocketServerPrivate * d; + QOpenGLSharedResourceGuard *m_resource; }; +class QOpenGLTextureCache : public QOpenGLSharedResource +{ +public: + static QOpenGLTextureCache *cacheForContext(QOpenGLContext *context); + + QOpenGLTextureCache(QOpenGLContext *); + ~QOpenGLTextureCache(); + + GLuint bindTexture(QOpenGLContext *context, const QPixmap &pixmap); + GLuint bindTexture(QOpenGLContext *context, const QImage &image); + + void invalidate(qint64 key); + + void invalidateResource(); + void freeResource(QOpenGLContext *ctx); + +private: + GLuint bindTexture(QOpenGLContext *context, qint64 key, const QImage &image); + + QMutex m_mutex; + QCache m_cache; +}; QT_END_NAMESPACE -#endif // QUNIXSOCKETSERVER_P_H + +#endif diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp new file mode 100644 index 00000000000..ffce6f55bb7 --- /dev/null +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -0,0 +1,396 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopengltextureglyphcache_p.h" +#include "qopenglpaintengine_p.h" +#include "private/qopenglengineshadersource_p.h" + +QT_BEGIN_NAMESPACE + +#ifdef Q_WS_WIN +extern Q_GUI_EXPORT bool qt_cleartype_enabled; +#endif + +QBasicAtomicInt qopengltextureglyphcache_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); + +QOpenGLTextureGlyphCache::QOpenGLTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix) + : QImageTextureGlyphCache(type, matrix) + , pex(0) + , m_blitProgram(0) + , m_filterMode(Nearest) + , m_serialNumber(qopengltextureglyphcache_serial_number.fetchAndAddRelaxed(1)) +{ +#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG + qDebug(" -> QOpenGLTextureGlyphCache() %p for context %p.", this, QOpenGLContext::currentContext()); +#endif + m_vertexCoordinateArray[0] = -1.0f; + m_vertexCoordinateArray[1] = -1.0f; + m_vertexCoordinateArray[2] = 1.0f; + m_vertexCoordinateArray[3] = -1.0f; + m_vertexCoordinateArray[4] = 1.0f; + m_vertexCoordinateArray[5] = 1.0f; + m_vertexCoordinateArray[6] = -1.0f; + m_vertexCoordinateArray[7] = 1.0f; + + m_textureCoordinateArray[0] = 0.0f; + m_textureCoordinateArray[1] = 0.0f; + m_textureCoordinateArray[2] = 1.0f; + m_textureCoordinateArray[3] = 0.0f; + m_textureCoordinateArray[4] = 1.0f; + m_textureCoordinateArray[5] = 1.0f; + m_textureCoordinateArray[6] = 0.0f; + m_textureCoordinateArray[7] = 1.0f; +} + +QOpenGLTextureGlyphCache::~QOpenGLTextureGlyphCache() +{ +#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG + qDebug(" -> ~QOpenGLTextureGlyphCache() %p.", this); +#endif + delete m_blitProgram; +} + +void QOpenGLTextureGlyphCache::createTextureData(int width, int height) +{ + QOpenGLContext *ctx = const_cast(QOpenGLContext::currentContext()); + if (ctx == 0) { + qWarning("QOpenGLTextureGlyphCache::createTextureData: Called with no context"); + return; + } + + // create in QImageTextureGlyphCache baseclass is meant to be called + // only to create the initial image and does not preserve the content, + // so we don't call when this function is called from resize. + if (ctx->d_func()->workaround_brokenFBOReadBack && image().isNull()) + QImageTextureGlyphCache::createTextureData(width, height); + + // Make the lower glyph texture size 16 x 16. + if (width < 16) + width = 16; + if (height < 16) + height = 16; + + if (m_textureResource && !m_textureResource->m_texture) + delete m_textureResource; + + if (!m_textureResource) + m_textureResource = new QOpenGLGlyphTexture(ctx); + + glGenTextures(1, &m_textureResource->m_texture); + glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); + + m_textureResource->m_width = width; + m_textureResource->m_height = height; + + if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { + QVarLengthArray data(width * height * 4); + for (int i = 0; i < data.size(); ++i) + data[i] = 0; + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); + } else { + QVarLengthArray data(width * height); + for (int i = 0; i < data.size(); ++i) + data[i] = 0; + glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); + } + + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + m_filterMode = Nearest; +} + +void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) +{ + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx == 0) { + qWarning("QOpenGLTextureGlyphCache::resizeTextureData: Called with no context"); + return; + } + + int oldWidth = m_textureResource->m_width; + int oldHeight = m_textureResource->m_height; + + // Make the lower glyph texture size 16 x 16. + if (width < 16) + width = 16; + if (height < 16) + height = 16; + + GLuint oldTexture = m_textureResource->m_texture; + createTextureData(width, height); + + if (ctx->d_func()->workaround_brokenFBOReadBack) { + QImageTextureGlyphCache::resizeTextureData(width, height); + Q_ASSERT(image().depth() == 8); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, image().constBits()); + glDeleteTextures(1, &oldTexture); + return; + } + + // ### the QTextureGlyphCache API needs to be reworked to allow + // ### resizeTextureData to fail + + QOpenGLFunctions funcs(ctx); + + funcs.glBindFramebuffer(GL_FRAMEBUFFER, m_textureResource->m_fbo); + + GLuint tmp_texture; + glGenTextures(1, &tmp_texture); + glBindTexture(GL_TEXTURE_2D, tmp_texture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + m_filterMode = Nearest; + glBindTexture(GL_TEXTURE_2D, 0); + funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, tmp_texture, 0); + + funcs.glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); + glBindTexture(GL_TEXTURE_2D, oldTexture); + + if (pex != 0) + pex->transferMode(BrushDrawingMode); + + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_BLEND); + + glViewport(0, 0, oldWidth, oldHeight); + + QOpenGLShaderProgram *blitProgram = 0; + if (pex == 0) { + if (m_blitProgram == 0) { + m_blitProgram = new QOpenGLShaderProgram(ctx); + + { + QString source; + source.append(QLatin1String(qopenglslMainWithTexCoordsVertexShader)); + source.append(QLatin1String(qopenglslUntransformedPositionVertexShader)); + + QOpenGLShader *vertexShader = new QOpenGLShader(QOpenGLShader::Vertex, m_blitProgram); + vertexShader->compileSourceCode(source); + + m_blitProgram->addShader(vertexShader); + } + + { + QString source; + source.append(QLatin1String(qopenglslMainFragmentShader)); + source.append(QLatin1String(qopenglslImageSrcFragmentShader)); + + QOpenGLShader *fragmentShader = new QOpenGLShader(QOpenGLShader::Fragment, m_blitProgram); + fragmentShader->compileSourceCode(source); + + m_blitProgram->addShader(fragmentShader); + } + + m_blitProgram->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR); + m_blitProgram->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR); + + m_blitProgram->link(); + } + + funcs.glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, m_vertexCoordinateArray); + funcs.glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, m_textureCoordinateArray); + + m_blitProgram->bind(); + m_blitProgram->enableAttributeArray(int(QT_VERTEX_COORDS_ATTR)); + m_blitProgram->enableAttributeArray(int(QT_TEXTURE_COORDS_ATTR)); + m_blitProgram->disableAttributeArray(int(QT_OPACITY_ATTR)); + + blitProgram = m_blitProgram; + + } else { + pex->setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, m_vertexCoordinateArray); + pex->setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, m_textureCoordinateArray); + + pex->shaderManager->useBlitProgram(); + blitProgram = pex->shaderManager->blitProgram(); + } + + blitProgram->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); + + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight); + + funcs.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, 0); + glDeleteTextures(1, &tmp_texture); + glDeleteTextures(1, &oldTexture); + + funcs.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); + + if (pex != 0) { + glViewport(0, 0, pex->width, pex->height); + pex->updateClipScissorTest(); + } +} + +void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) +{ + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx == 0) { + qWarning("QOpenGLTextureGlyphCache::fillTexture: Called with no context"); + return; + } + + if (ctx->d_func()->workaround_brokenFBOReadBack) { + QImageTextureGlyphCache::fillTexture(c, glyph, subPixelPosition); + + glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); + const QImage &texture = image(); + const uchar *bits = texture.constBits(); + bits += c.y * texture.bytesPerLine() + c.x; + for (int i=0; i> 16; + uchar g = src[x] >> 8; + uchar b = src[x]; + quint32 avg = (quint32(r) + quint32(g) + quint32(b) + 1) / 3; // "+1" for rounding. + src[x] = (src[x] & 0x00ffffff) | (avg << 24); + } + } + } + + glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); + if (mask.format() == QImage::Format_RGB32) { + glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits()); + } else { + // glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is + // not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista + // and nVidia GeForce 8500GT. GL_UNPACK_ALIGNMENT is set to four bytes, 'mask' has a + // multiple of four bytes per line, and most of the glyph shows up correctly in the + // texture, which makes me think that this is a driver bug. + // One workaround is to make sure the mask width is a multiple of four bytes, for instance + // by converting it to a format with four bytes per pixel. Another is to copy one line at a + // time. + +#if 0 + if (!ctx->d_func()->workaround_brokenAlphaTexSubImage_init) { + // don't know which driver versions exhibit this bug, so be conservative for now + const QByteArray versionString(reinterpret_cast(glGetString(GL_VERSION))); + glctx->d_func()->workaround_brokenAlphaTexSubImage = versionString.indexOf("NVIDIA") >= 0; + glctx->d_func()->workaround_brokenAlphaTexSubImage_init = true; + } +#endif + +#if 0 + if (ctx->d_func()->workaround_brokenAlphaTexSubImage) { + for (int i = 0; i < maskHeight; ++i) + glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i)); + } else { +#endif + glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits()); +// } + } +} + +int QOpenGLTextureGlyphCache::glyphPadding() const +{ + return 1; +} + +int QOpenGLTextureGlyphCache::maxTextureWidth() const +{ + QOpenGLContext *ctx = const_cast(QOpenGLContext::currentContext()); + if (ctx == 0) + return QImageTextureGlyphCache::maxTextureWidth(); + else + return ctx->d_func()->maxTextureSize(); +} + +int QOpenGLTextureGlyphCache::maxTextureHeight() const +{ + QOpenGLContext *ctx = const_cast(QOpenGLContext::currentContext()); + if (ctx == 0) + return QImageTextureGlyphCache::maxTextureHeight(); + + if (ctx->d_func()->workaround_brokenTexSubImage) + return qMin(1024, ctx->d_func()->maxTextureSize()); + else + return ctx->d_func()->maxTextureSize(); +} + +void QOpenGLTextureGlyphCache::clear() +{ + m_textureResource->free(); + m_textureResource = 0; + + m_w = 0; + m_h = 0; + m_cx = 0; + m_cy = 0; + m_currentRowHeight = 0; + coords.clear(); +} + +QT_END_NAMESPACE diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h new file mode 100644 index 00000000000..97f9ac3c649 --- /dev/null +++ b/src/gui/opengl/qopengltextureglyphcache_p.h @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENTEXTUREGLYPHCACHE_P_H +#define QOPENTEXTUREGLYPHCACHE_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 +#include +#include +#include + +// #define QT_GL_TEXTURE_GLYPH_CACHE_DEBUG + +QT_BEGIN_NAMESPACE + +class QOpenGL2PaintEngineExPrivate; + +class QOpenGLGlyphTexture : public QOpenGLSharedResource +{ +public: + explicit QOpenGLGlyphTexture(QOpenGLContext *ctx) + : QOpenGLSharedResource(ctx->shareGroup()) + , m_width(0) + , m_height(0) + { + if (ctx && !ctx->d_func()->workaround_brokenFBOReadBack) + QOpenGLFunctions(ctx).glGenFramebuffers(1, &m_fbo); + +#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG + qDebug(" -> QOpenGLGlyphTexture() %p for context %p.", this, ctx); +#endif + } + + void freeResource(QOpenGLContext *context) + { + QOpenGLContext *ctx = context; +#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG + qDebug("~QOpenGLGlyphTexture() %p for context %p.", this, ctx); +#endif + if (!ctx->d_func()->workaround_brokenFBOReadBack) + QOpenGLFunctions(ctx).glDeleteFramebuffers(1, &m_fbo); + if (m_width || m_height) + glDeleteTextures(1, &m_texture); + } + + void invalidateResource() + { + m_texture = 0; + m_fbo = 0; + m_width = 0; + m_height = 0; + } + + GLuint m_texture; + GLuint m_fbo; + int m_width; + int m_height; +}; + +class Q_GUI_EXPORT QOpenGLTextureGlyphCache : public QImageTextureGlyphCache +{ +public: + QOpenGLTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix); + ~QOpenGLTextureGlyphCache(); + + virtual void createTextureData(int width, int height); + virtual void resizeTextureData(int width, int height); + virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition); + virtual int glyphPadding() const; + virtual int maxTextureWidth() const; + virtual int maxTextureHeight() const; + + inline GLuint texture() const { + QOpenGLTextureGlyphCache *that = const_cast(this); + QOpenGLGlyphTexture *glyphTexture = that->m_textureResource; + return glyphTexture ? glyphTexture->m_texture : 0; + } + + inline int width() const { + QOpenGLTextureGlyphCache *that = const_cast(this); + QOpenGLGlyphTexture *glyphTexture = that->m_textureResource; + return glyphTexture ? glyphTexture->m_width : 0; + } + inline int height() const { + QOpenGLTextureGlyphCache *that = const_cast(this); + QOpenGLGlyphTexture *glyphTexture = that->m_textureResource; + return glyphTexture ? glyphTexture->m_height : 0; + } + + inline void setPaintEnginePrivate(QOpenGL2PaintEngineExPrivate *p) { pex = p; } + + inline const QOpenGLContextGroup *contextGroup() const { return m_textureResource ? m_textureResource->group() : 0; } + + inline int serialNumber() const { return m_serialNumber; } + + enum FilterMode { + Nearest, + Linear + }; + FilterMode filterMode() const { return m_filterMode; } + void setFilterMode(FilterMode m) { m_filterMode = m; } + + void clear(); + +private: + QOpenGLGlyphTexture *m_textureResource; + + QOpenGL2PaintEngineExPrivate *pex; + QOpenGLShaderProgram *m_blitProgram; + FilterMode m_filterMode; + + GLfloat m_vertexCoordinateArray[8]; + GLfloat m_textureCoordinateArray[8]; + + int m_serialNumber; +}; + +QT_END_NAMESPACE + +#endif + diff --git a/src/gui/opengl/qopengltriangulatingstroker.cpp b/src/gui/opengl/qopengltriangulatingstroker.cpp new file mode 100644 index 00000000000..3dc3452b608 --- /dev/null +++ b/src/gui/opengl/qopengltriangulatingstroker.cpp @@ -0,0 +1,588 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopengltriangulatingstroker_p.h" +#include + +QT_BEGIN_NAMESPACE + +#define CURVE_FLATNESS Q_PI / 8 + + + + +void QTriangulatingStroker::endCapOrJoinClosed(const qreal *start, const qreal *cur, + bool implicitClose, bool endsAtStart) +{ + if (endsAtStart) { + join(start + 2); + } else if (implicitClose) { + join(start); + lineTo(start); + join(start+2); + } else { + endCap(cur); + } + int count = m_vertices.size(); + + // Copy the (x, y) values because QDataBuffer::add(const float& t) + // may resize the buffer, which will leave t pointing at the + // previous buffer's memory region if we don't copy first. + float x = m_vertices.at(count-2); + float y = m_vertices.at(count-1); + m_vertices.add(x); + m_vertices.add(y); +} + + +void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, const QRectF &) +{ + const qreal *pts = path.points(); + const QPainterPath::ElementType *types = path.elements(); + int count = path.elementCount(); + if (count < 2) + return; + + float realWidth = qpen_widthf(pen); + if (realWidth == 0) + realWidth = 1; + + m_width = realWidth / 2; + + bool cosmetic = pen.isCosmetic(); + if (cosmetic) { + m_width = m_width * m_inv_scale; + } + + m_join_style = qpen_joinStyle(pen); + m_cap_style = qpen_capStyle(pen); + m_vertices.reset(); + m_miter_limit = pen.miterLimit() * qpen_widthf(pen); + + // The curvyness is based on the notion that I originally wanted + // roughly one line segment pr 4 pixels. This may seem little, but + // because we sample at constantly incrementing B(t) E [0(4, realWidth * CURVE_FLATNESS); + } else { + m_curvyness_add = m_width; + m_curvyness_mul = CURVE_FLATNESS / m_inv_scale; + m_roundness = qMax(4, realWidth * m_curvyness_mul); + } + + // Over this level of segmentation, there doesn't seem to be any + // benefit, even for huge penWidth + if (m_roundness > 24) + m_roundness = 24; + + m_sin_theta = qFastSin(Q_PI / m_roundness); + m_cos_theta = qFastCos(Q_PI / m_roundness); + + const qreal *endPts = pts + (count<<1); + const qreal *startPts = 0; + + Qt::PenCapStyle cap = m_cap_style; + + if (!types) { + // skip duplicate points + while((pts + 2) < endPts && pts[0] == pts[2] && pts[1] == pts[3]) + pts += 2; + if ((pts + 2) == endPts) + return; + + startPts = pts; + + bool endsAtStart = startPts[0] == *(endPts-2) && startPts[1] == *(endPts-1); + + if (endsAtStart || path.hasImplicitClose()) + m_cap_style = Qt::FlatCap; + moveTo(pts); + m_cap_style = cap; + pts += 2; + lineTo(pts); + pts += 2; + while (pts < endPts) { + if (m_cx != pts[0] || m_cy != pts[1]) { + join(pts); + lineTo(pts); + } + pts += 2; + } + + endCapOrJoinClosed(startPts, pts-2, path.hasImplicitClose(), endsAtStart); + + } else { + bool endsAtStart = false; + while (pts < endPts) { + switch (*types) { + case QPainterPath::MoveToElement: { + if (pts != path.points()) + endCapOrJoinClosed(startPts, pts-2, path.hasImplicitClose(), endsAtStart); + + startPts = pts; + int end = (endPts - pts) / 2; + int i = 2; // Start looking to ahead since we never have two moveto's in a row + while (i points; + arcPoints(m_cx, m_cy, m_cx + m_nvx, m_cy + m_nvy, m_cx - m_nvx, m_cy - m_nvy, points); + m_vertices.resize(m_vertices.size() + points.size() + 2 * int(invisibleJump)); + int count = m_vertices.size(); + int front = 0; + int end = points.size() / 2; + while (front != end) { + m_vertices.at(--count) = points[2 * end - 1]; + m_vertices.at(--count) = points[2 * end - 2]; + --end; + if (front == end) + break; + m_vertices.at(--count) = points[2 * front + 1]; + m_vertices.at(--count) = points[2 * front + 0]; + ++front; + } + + if (invisibleJump) { + m_vertices.at(count - 1) = m_vertices.at(count + 1); + m_vertices.at(count - 2) = m_vertices.at(count + 0); + } + break; } + default: break; // ssssh gcc... + } + emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); +} + +void QTriangulatingStroker::cubicTo(const qreal *pts) +{ + const QPointF *p = (const QPointF *) pts; + QBezier bezier = QBezier::fromPoints(*(p - 1), p[0], p[1], p[2]); + + QRectF bounds = bezier.bounds(); + float rad = qMax(bounds.width(), bounds.height()); + int threshold = qMin(64, (rad + m_curvyness_add) * m_curvyness_mul); + if (threshold < 4) + threshold = 4; + qreal threshold_minus_1 = threshold - 1; + float vx, vy; + + float cx = m_cx, cy = m_cy; + float x, y; + + for (int i=1; i (pts[0], pts[1]) + normalVector(m_cx, m_cy, pts[0], pts[1], &m_nvx, &m_nvy); + + switch (m_join_style) { + case Qt::BevelJoin: + break; + case Qt::SvgMiterJoin: + case Qt::MiterJoin: { + // Find out on which side the join should be. + int count = m_vertices.size(); + float prevNvx = m_vertices.at(count - 2) - m_cx; + float prevNvy = m_vertices.at(count - 1) - m_cy; + float xprod = prevNvx * m_nvy - prevNvy * m_nvx; + float px, py, qx, qy; + + // If the segments are parallel, use bevel join. + if (qFuzzyIsNull(xprod)) + break; + + // Find the corners of the previous and next segment to join. + if (xprod < 0) { + px = m_vertices.at(count - 2); + py = m_vertices.at(count - 1); + qx = m_cx - m_nvx; + qy = m_cy - m_nvy; + } else { + px = m_vertices.at(count - 4); + py = m_vertices.at(count - 3); + qx = m_cx + m_nvx; + qy = m_cy + m_nvy; + } + + // Find intersection point. + float pu = px * prevNvx + py * prevNvy; + float qv = qx * m_nvx + qy * m_nvy; + float ix = (m_nvy * pu - prevNvy * qv) / xprod; + float iy = (prevNvx * qv - m_nvx * pu) / xprod; + + // Check that the distance to the intersection point is less than the miter limit. + if ((ix - px) * (ix - px) + (iy - py) * (iy - py) <= m_miter_limit * m_miter_limit) { + m_vertices.add(ix); + m_vertices.add(iy); + m_vertices.add(ix); + m_vertices.add(iy); + } + // else + // Do a plain bevel join if the miter limit is exceeded or if + // the lines are parallel. This is not what the raster + // engine's stroker does, but it is both faster and similar to + // what some other graphics API's do. + + break; } + case Qt::RoundJoin: { + QVarLengthArray points; + int count = m_vertices.size(); + float prevNvx = m_vertices.at(count - 2) - m_cx; + float prevNvy = m_vertices.at(count - 1) - m_cy; + if (m_nvx * prevNvy - m_nvy * prevNvx < 0) { + arcPoints(0, 0, m_nvx, m_nvy, -prevNvx, -prevNvy, points); + for (int i = points.size() / 2; i > 0; --i) + emitLineSegment(m_cx, m_cy, points[2 * i - 2], points[2 * i - 1]); + } else { + arcPoints(0, 0, -prevNvx, -prevNvy, m_nvx, m_nvy, points); + for (int i = 0; i < points.size() / 2; ++i) + emitLineSegment(m_cx, m_cy, points[2 * i + 0], points[2 * i + 1]); + } + break; } + default: break; // gcc warn-- + } + + emitLineSegment(m_cx, m_cy, m_nvx, m_nvy); +} + +void QTriangulatingStroker::endCap(const qreal *) +{ + switch (m_cap_style) { + case Qt::FlatCap: + break; + case Qt::SquareCap: + emitLineSegment(m_cx + m_nvy, m_cy - m_nvx, m_nvx, m_nvy); + break; + case Qt::RoundCap: { + QVarLengthArray points; + int count = m_vertices.size(); + arcPoints(m_cx, m_cy, m_vertices.at(count - 2), m_vertices.at(count - 1), m_vertices.at(count - 4), m_vertices.at(count - 3), points); + int front = 0; + int end = points.size() / 2; + while (front != end) { + m_vertices.add(points[2 * end - 2]); + m_vertices.add(points[2 * end - 1]); + --end; + if (front == end) + break; + m_vertices.add(points[2 * front + 0]); + m_vertices.add(points[2 * front + 1]); + ++front; + } + break; } + default: break; // to shut gcc up... + } +} + +void QTriangulatingStroker::arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray &points) +{ + float dx1 = fromX - cx; + float dy1 = fromY - cy; + float dx2 = toX - cx; + float dy2 = toY - cy; + + // while more than 180 degrees left: + while (dx1 * dy2 - dx2 * dy1 < 0) { + float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; + float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; + dx1 = tmpx; + dy1 = tmpy; + points.append(cx + dx1); + points.append(cy + dy1); + } + + // while more than 90 degrees left: + while (dx1 * dx2 + dy1 * dy2 < 0) { + float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; + float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; + dx1 = tmpx; + dy1 = tmpy; + points.append(cx + dx1); + points.append(cy + dy1); + } + + // while more than 0 degrees left: + while (dx1 * dy2 - dx2 * dy1 > 0) { + float tmpx = dx1 * m_cos_theta - dy1 * m_sin_theta; + float tmpy = dx1 * m_sin_theta + dy1 * m_cos_theta; + dx1 = tmpx; + dy1 = tmpy; + points.append(cx + dx1); + points.append(cy + dy1); + } + + // remove last point which was rotated beyond [toX, toY]. + if (!points.isEmpty()) + points.resize(points.size() - 2); +} + +static void qdashprocessor_moveTo(qreal x, qreal y, void *data) +{ + ((QDashedStrokeProcessor *) data)->addElement(QPainterPath::MoveToElement, x, y); +} + +static void qdashprocessor_lineTo(qreal x, qreal y, void *data) +{ + ((QDashedStrokeProcessor *) data)->addElement(QPainterPath::LineToElement, x, y); +} + +static void qdashprocessor_cubicTo(qreal, qreal, qreal, qreal, qreal, qreal, void *) +{ + Q_ASSERT(0); // The dasher should not produce curves... +} + +QDashedStrokeProcessor::QDashedStrokeProcessor() + : m_points(0), m_types(0), + m_dash_stroker(0), m_inv_scale(1) +{ + m_dash_stroker.setMoveToHook(qdashprocessor_moveTo); + m_dash_stroker.setLineToHook(qdashprocessor_lineTo); + m_dash_stroker.setCubicToHook(qdashprocessor_cubicTo); +} + +void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, const QRectF &clip) +{ + + const qreal *pts = path.points(); + const QPainterPath::ElementType *types = path.elements(); + int count = path.elementCount(); + + bool cosmetic = pen.isCosmetic(); + + m_points.reset(); + m_types.reset(); + m_points.reserve(path.elementCount()); + m_types.reserve(path.elementCount()); + + qreal width = qpen_widthf(pen); + if (width == 0) + width = 1; + + m_dash_stroker.setDashPattern(pen.dashPattern()); + m_dash_stroker.setStrokeWidth(cosmetic ? width * m_inv_scale : width); + m_dash_stroker.setDashOffset(pen.dashOffset()); + m_dash_stroker.setMiterLimit(pen.miterLimit()); + m_dash_stroker.setClipRect(clip); + + float curvynessAdd, curvynessMul, roundness = 0; + + // simplfy pens that are thin in device size (2px wide or less) + if (width < 2.5 && (cosmetic || m_inv_scale == 1)) { + curvynessAdd = 0.5; + curvynessMul = CURVE_FLATNESS / m_inv_scale; + roundness = 1; + } else if (cosmetic) { + curvynessAdd= width / 2; + curvynessMul= CURVE_FLATNESS; + roundness = qMax(4, width * CURVE_FLATNESS); + } else { + curvynessAdd = width * m_inv_scale; + curvynessMul = CURVE_FLATNESS / m_inv_scale; + roundness = qMax(4, width * curvynessMul); + } + + if (count < 2) + return; + + const qreal *endPts = pts + (count<<1); + + m_dash_stroker.begin(this); + + if (!types) { + m_dash_stroker.moveTo(pts[0], pts[1]); + pts += 2; + while (pts < endPts) { + m_dash_stroker.lineTo(pts[0], pts[1]); + pts += 2; + } + } else { + while (pts < endPts) { + switch (*types) { + case QPainterPath::MoveToElement: + m_dash_stroker.moveTo(pts[0], pts[1]); + pts += 2; + ++types; + break; + case QPainterPath::LineToElement: + m_dash_stroker.lineTo(pts[0], pts[1]); + pts += 2; + ++types; + break; + case QPainterPath::CurveToElement: { + QBezier b = QBezier::fromPoints(*(((const QPointF *) pts) - 1), + *(((const QPointF *) pts)), + *(((const QPointF *) pts) + 1), + *(((const QPointF *) pts) + 2)); + QRectF bounds = b.bounds(); + float rad = qMax(bounds.width(), bounds.height()); + int threshold = qMin(64, (rad + curvynessAdd) * curvynessMul); + if (threshold < 4) + threshold = 4; + + qreal threshold_minus_1 = threshold - 1; + for (int i=0; i +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QTriangulatingStroker +{ +public: + QTriangulatingStroker() : m_vertices(0) {} + void process(const QVectorPath &path, const QPen &pen, const QRectF &clip); + + inline int vertexCount() const { return m_vertices.size(); } + inline const float *vertices() const { return m_vertices.data(); } + + inline void setInvScale(qreal invScale) { m_inv_scale = invScale; } + +private: + inline void emitLineSegment(float x, float y, float nx, float ny); + void moveTo(const qreal *pts); + inline void lineTo(const qreal *pts); + void cubicTo(const qreal *pts); + void join(const qreal *pts); + inline void normalVector(float x1, float y1, float x2, float y2, float *nx, float *ny); + void endCap(const qreal *pts); + void arcPoints(float cx, float cy, float fromX, float fromY, float toX, float toY, QVarLengthArray &points); + void endCapOrJoinClosed(const qreal *start, const qreal *cur, bool implicitClose, bool endsAtStart); + + + QDataBuffer m_vertices; + + float m_cx, m_cy; // current points + float m_nvx, m_nvy; // normal vector... + float m_width; + qreal m_miter_limit; + + int m_roundness; // Number of line segments in a round join + qreal m_sin_theta; // sin(m_roundness / 360); + qreal m_cos_theta; // cos(m_roundness / 360); + qreal m_inv_scale; + float m_curvyness_mul; + float m_curvyness_add; + + Qt::PenJoinStyle m_join_style; + Qt::PenCapStyle m_cap_style; +}; + +class QDashedStrokeProcessor +{ +public: + QDashedStrokeProcessor(); + + void process(const QVectorPath &path, const QPen &pen, const QRectF &clip); + + inline void addElement(QPainterPath::ElementType type, qreal x, qreal y) { + m_points.add(x); + m_points.add(y); + m_types.add(type); + } + + inline int elementCount() const { return m_types.size(); } + inline qreal *points() const { return m_points.data(); } + inline QPainterPath::ElementType *elementTypes() const { return m_types.data(); } + + inline void setInvScale(qreal invScale) { m_inv_scale = invScale; } + +private: + QDataBuffer m_points; + QDataBuffer m_types; + QDashStroker m_dash_stroker; + qreal m_inv_scale; +}; + +inline void QTriangulatingStroker::normalVector(float x1, float y1, float x2, float y2, + float *nx, float *ny) +{ + float dx = x2 - x1; + float dy = y2 - y1; + + float pw; + + if (dx == 0) + pw = m_width / qAbs(dy); + else if (dy == 0) + pw = m_width / qAbs(dx); + else + pw = m_width / sqrt(dx*dx + dy*dy); + + *nx = -dy * pw; + *ny = dx * pw; +} + +inline void QTriangulatingStroker::emitLineSegment(float x, float y, float vx, float vy) +{ + m_vertices.add(x + vx); + m_vertices.add(y + vy); + m_vertices.add(x - vx); + m_vertices.add(y - vy); +} + +void QTriangulatingStroker::lineTo(const qreal *pts) +{ + emitLineSegment(pts[0], pts[1], m_nvx, m_nvy); + m_cx = pts[0]; + m_cy = pts[1]; +} + +QT_END_NAMESPACE + +#endif diff --git a/src/opengl/gl2paintengineex/qrbtree_p.h b/src/gui/opengl/qrbtree_p.h similarity index 99% rename from src/opengl/gl2paintengineex/qrbtree_p.h rename to src/gui/opengl/qrbtree_p.h index 09ef81cdbb1..ac464a3fbe4 100644 --- a/src/opengl/gl2paintengineex/qrbtree_p.h +++ b/src/gui/opengl/qrbtree_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenGL module of the Qt Toolkit. +** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/gui/opengl/qtriangulator.cpp similarity index 99% rename from src/opengl/gl2paintengineex/qtriangulator.cpp rename to src/gui/opengl/qtriangulator.cpp index d4b71317945..67c2a6494eb 100644 --- a/src/opengl/gl2paintengineex/qtriangulator.cpp +++ b/src/gui/opengl/qtriangulator.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenGL module of the Qt Toolkit. +** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -41,7 +41,7 @@ #include "qtriangulator_p.h" -#include +#include #include #include #include @@ -54,7 +54,8 @@ #include #include -#include +#include +#include #include #include @@ -2508,11 +2509,19 @@ void QTriangulator::MonotoneToTriangles::decompose() // qTriangulate // //============================================================================// -QTriangleSet qTriangulate(const qreal *polygon, +static bool hasElementIndexUint() +{ + QOpenGLContext *context = QOpenGLContext::currentContext(); + if (!context) + return false; + return static_cast(context->functions())->hasOpenGLExtension(QOpenGLExtensions::ElementIndexUint); +} + +Q_GUI_EXPORT QTriangleSet qTriangulate(const qreal *polygon, int count, uint hint, const QTransform &matrix) { QTriangleSet triangleSet; - if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) { + if (hasElementIndexUint()) { QTriangulator triangulator; triangulator.initialize(polygon, count, hint, matrix); QVertexSet vertexSet = triangulator.triangulate(); @@ -2529,11 +2538,11 @@ QTriangleSet qTriangulate(const qreal *polygon, return triangleSet; } -QTriangleSet qTriangulate(const QVectorPath &path, +Q_GUI_EXPORT QTriangleSet qTriangulate(const QVectorPath &path, const QTransform &matrix, qreal lod) { QTriangleSet triangleSet; - if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) { + if (hasElementIndexUint()) { QTriangulator triangulator; triangulator.initialize(path, matrix, lod); QVertexSet vertexSet = triangulator.triangulate(); @@ -2553,7 +2562,7 @@ QTriangleSet qTriangulate(const QPainterPath &path, const QTransform &matrix, qreal lod) { QTriangleSet triangleSet; - if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) { + if (hasElementIndexUint()) { QTriangulator triangulator; triangulator.initialize(path, matrix, lod); QVertexSet vertexSet = triangulator.triangulate(); @@ -2573,7 +2582,7 @@ QPolylineSet qPolyline(const QVectorPath &path, const QTransform &matrix, qreal lod) { QPolylineSet polyLineSet; - if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) { + if (hasElementIndexUint()) { QTriangulator triangulator; triangulator.initialize(path, matrix, lod); QVertexSet vertexSet = triangulator.polyline(); @@ -2593,7 +2602,7 @@ QPolylineSet qPolyline(const QPainterPath &path, const QTransform &matrix, qreal lod) { QPolylineSet polyLineSet; - if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) { + if (hasElementIndexUint()) { QTriangulator triangulator; triangulator.initialize(path, matrix, lod); QVertexSet vertexSet = triangulator.polyline(); diff --git a/src/opengl/gl2paintengineex/qtriangulator_p.h b/src/gui/opengl/qtriangulator_p.h similarity index 87% rename from src/opengl/gl2paintengineex/qtriangulator_p.h rename to src/gui/opengl/qtriangulator_p.h index 04a219c2556..8f95d58e23f 100644 --- a/src/opengl/gl2paintengineex/qtriangulator_p.h +++ b/src/gui/opengl/qtriangulator_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenGL module of the Qt Toolkit. +** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -class Q_OPENGL_EXPORT QVertexIndexVector +class Q_GUI_EXPORT QVertexIndexVector { public: enum Type { @@ -111,7 +111,7 @@ private: QVector indices16; }; -struct Q_OPENGL_EXPORT QTriangleSet +struct Q_GUI_EXPORT QTriangleSet { inline QTriangleSet() { } inline QTriangleSet(const QTriangleSet &other) : vertices(other.vertices), indices(other.indices) { } @@ -122,7 +122,7 @@ struct Q_OPENGL_EXPORT QTriangleSet QVertexIndexVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...] }; -struct Q_OPENGL_EXPORT QPolylineSet +struct Q_GUI_EXPORT QPolylineSet { inline QPolylineSet() { } inline QPolylineSet(const QPolylineSet &other) : vertices(other.vertices), indices(other.indices) { } @@ -137,11 +137,11 @@ struct Q_OPENGL_EXPORT QPolylineSet // integers, the polygon is triangulated, and then scaled back by 1/32. // 'hint' should be a combination of QVectorPath::Hints. // 'lod' is the level of detail. Default is 1. Curves are split into more lines when 'lod' is higher. -QTriangleSet qTriangulate(const qreal *polygon, int count, uint hint = QVectorPath::PolygonHint | QVectorPath::OddEvenFill, const QTransform &matrix = QTransform()); -QTriangleSet qTriangulate(const QVectorPath &path, const QTransform &matrix = QTransform(), qreal lod = 1); -QTriangleSet Q_OPENGL_EXPORT qTriangulate(const QPainterPath &path, const QTransform &matrix = QTransform(), qreal lod = 1); +QTriangleSet Q_GUI_EXPORT qTriangulate(const qreal *polygon, int count, uint hint = QVectorPath::PolygonHint | QVectorPath::OddEvenFill, const QTransform &matrix = QTransform()); +QTriangleSet Q_GUI_EXPORT qTriangulate(const QVectorPath &path, const QTransform &matrix = QTransform(), qreal lod = 1); +QTriangleSet Q_GUI_EXPORT qTriangulate(const QPainterPath &path, const QTransform &matrix = QTransform(), qreal lod = 1); QPolylineSet qPolyline(const QVectorPath &path, const QTransform &matrix = QTransform(), qreal lod = 1); -QPolylineSet Q_OPENGL_EXPORT qPolyline(const QPainterPath &path, const QTransform &matrix = QTransform(), qreal lod = 1); +QPolylineSet Q_GUI_EXPORT qPolyline(const QPainterPath &path, const QTransform &matrix = QTransform(), qreal lod = 1); QT_END_NAMESPACE diff --git a/src/gui/painting/makepsheader.pl b/src/gui/painting/makepsheader.pl deleted file mode 100755 index 267c1836069..00000000000 --- a/src/gui/painting/makepsheader.pl +++ /dev/null @@ -1,195 +0,0 @@ -#!/usr/bin/perl -############################################################################# -## -## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -## All rights reserved. -## Contact: Nokia Corporation (qt-info@nokia.com) -## -## This file is part of the QtGui module of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL$ -## GNU Lesser General Public License Usage -## This file may be used under the terms of the GNU Lesser General Public -## License version 2.1 as published by the Free Software Foundation and -## appearing in the file LICENSE.LGPL included in the packaging of this -## file. Please review the following information to ensure the GNU Lesser -## General Public License version 2.1 requirements will be met: -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## In addition, as a special exception, Nokia gives you certain additional -## rights. These rights are described in the Nokia Qt LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU General -## Public License version 3.0 as published by the Free Software Foundation -## and appearing in the file LICENSE.GPL included in the packaging of this -## file. Please review the following information to ensure the GNU General -## Public License version 3.0 requirements will be met: -## http://www.gnu.org/copyleft/gpl.html. -## -## Other Usage -## Alternatively, this file may be used in accordance with the terms and -## conditions contained in a signed written agreement between you and Nokia. -## -## -## -## -## -## $QT_END_LICENSE$ -## -############################################################################# - -open(INPUT, 'qpsprinter.ps') - or die "Can't open qpsprinter.ps"; - -$dontcompress = 1; -while() { - $line = $_; - chomp $line; - if ( /ENDUNCOMPRESS/ ) { - $dontcompress = 0; - } - $line =~ s/%.*$//; - $line = $line; - if ( $dontcompress eq 1 ) { - push(@uncompressed, $line); - } else { - push(@lines, $line); - } -# print "$line\n"; -} - -$uc = join(" ", @uncompressed); -$uc =~ s,\t+, ,g; -$uc=~ s, +, ,g; - -$h = join(" ", @lines); -$h =~ s,\t+, ,g; -$h =~ s, +, ,g; -$h = $h.' '; - -# now compress as much as possible -$h =~ s/ bind def / BD /g; -$h =~ s/ dup dup / d2 /g; -$h =~ s/ exch def / ED /g; -$h =~ s/ setfont / F /g; -$h =~ s/ rlineto / RL /g; -$h =~ s/ newpath / n /g; -$h =~ s/ currentmatrix / CM /g; -$h =~ s/ setmatrix / SM /g; -$h =~ s/ translate / TR /g; -$h =~ s/ setdash / SD /g; -$h =~ s/ aload pop setrgbcolor / SC /g; -$h =~ s/ currentfile read pop / CR /g; -$h =~ s/ index / i /g; -$h =~ s/ bitshift / bs /g; -$h =~ s/ setcolorspace / scs /g; -$h =~ s/ dict dup begin / DB /g; -$h =~ s/ end def / DE /g; -$h =~ s/ ifelse / ie /g; - -# PDF compatible naming -$h =~ s/ setlinewidth / w /g; -$h =~ s/ setdash / d /g; - -$h =~ s/ lineto / l /g; -$h =~ s/ moveto / m /g; -$h =~ s/ curveto / c /g; -$h =~ s/ closepath / h /g; -$h =~ s/ clip / W /g; -$h =~ s/ eoclip / W* /g; - -$h =~ s/ gsave / gs /g; -$h =~ s/ grestore / gr /g; - -# add the uncompressed part of the header before -$h = $uc.' '.$h; - - - -#print $h; - -# wordwrap at col 76 -@head = split(' ', $h); -$line = shift @head; -while( @head ) { - $token = shift @head; - chomp $token; -# print "\nl=$l, len=$len, token=$token."; - $newline = $line.' '.$token; - $newline =~ s, /,/,g; - $newline =~ s, \{,\{,g; - $newline =~ s, \},\},g; - $newline =~ s, \[,\[,g; - $newline =~ s, \],\],g; - $newline =~ s,\{ ,\{,g; - $newline =~ s,\} ,\},g; - $newline =~ s,\[ ,\[,g; - $newline =~ s,\] ,\],g; - if ( length( $newline ) > 76 ) { -# print "\nline=$line\n"; - $header = $header."\n\"".$line."\\n\""; - $newline = $token; - } - $line = $newline; -} -$header = $header."\n\"".$line."\\n\""; - - -print "static const char *const ps_header ="; -print $header.";\n\n"; - -close(INPUT); -exit; - -open(INPUT, 'qpsprinter.agl') - or die "Can't open qpsprinter.ps"; - -print "static const char * const agl =\n"; - -$str = "\""; -$string =""; -$i = 0; -while() { - $line = $_; - chomp $line; - $line =~ s/#.*//; - if(length($line) ne 0) { - $num = $line; - $name = $line; - $num =~ s/,.*//; - $name =~ s/.*, \"//; - $name =~ s/\".*//; - push(@qchar, $num); - push(@index, $i); - if(length($str.$name) > 76) { - $str = $str."\"\n"; - $string = $string.$str; - $str = "\""; - } - $str = $str.$name."\\0"; - $i += length($name)+1; - } -} - -print $string.";\n\n"; - -print "static const struct { quint16 u; quint16 index; } unicodetoglyph[] = {\n "; - -$loop = 0; -while( @qchar ) { - $loop = $loop + 1; - $ch = shift @qchar; - $i = shift @index; - print "{".$ch.", ".$i."}"; - if($ch ne "0xFFFF") { - print ", "; - } - if(!($loop % 4)) { - print "\n "; - } -}; - -print "\n};\n\n"; - diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 13a9ba1c734..1481cb8520e 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -1,23 +1,21 @@ # Qt gui library, paint module HEADERS += \ + painting/qbackingstore.h \ painting/qbezier_p.h \ painting/qbrush.h \ painting/qcolor.h \ painting/qcolor_p.h \ - painting/qcolormap.h \ painting/qcosmeticstroker_p.h \ - painting/qdrawutil.h \ painting/qemulationpaintengine_p.h \ - painting/qgraphicssystem_p.h \ painting/qmatrix.h \ painting/qmemrotate_p.h \ painting/qoutlinemapper_p.h \ + painting/qpagedpaintdevice.h \ + painting/qpagedpaintdevice_p.h \ painting/qpaintdevice.h \ painting/qpaintengine.h \ painting/qpaintengine_p.h \ - painting/qpaintengine_alpha_p.h \ - painting/qpaintengine_preview_p.h \ painting/qpaintengineex_p.h \ painting/qpainter.h \ painting/qpainter_p.h \ @@ -26,29 +24,21 @@ HEADERS += \ painting/qvectorpath_p.h \ painting/qpathclipper_p.h \ painting/qpdf_p.h \ + painting/qpdfwriter.h \ painting/qpen.h \ painting/qpolygon.h \ painting/qpolygonclipper_p.h \ - painting/qprintengine.h \ - painting/qprintengine_pdf_p.h \ - painting/qprintengine_ps_p.h \ - painting/qprinter.h \ - painting/qprinter_p.h \ - painting/qprinterinfo.h \ - painting/qprinterinfo_p.h \ painting/qrasterizer_p.h \ painting/qregion.h \ painting/qstroker_p.h \ - painting/qstylepainter.h \ - painting/qtessellator_p.h \ painting/qtextureglyphcache_p.h \ painting/qtransform.h \ - painting/qwindowsurface_p.h \ - painting/qwmatrix.h \ + painting/qplatformbackingstore_qpa.h \ painting/qpaintbuffer_p.h SOURCES += \ + painting/qbackingstore.cpp \ painting/qbezier.cpp \ painting/qblendfunctions.cpp \ painting/qbrush.cpp \ @@ -56,35 +46,28 @@ SOURCES += \ painting/qcolor_p.cpp \ painting/qcosmeticstroker.cpp \ painting/qcssutil.cpp \ - painting/qdrawutil.cpp \ painting/qemulationpaintengine.cpp \ - painting/qgraphicssystem.cpp \ painting/qmatrix.cpp \ painting/qmemrotate.cpp \ painting/qoutlinemapper.cpp \ + painting/qpagedpaintdevice.cpp \ painting/qpaintdevice.cpp \ + painting/qpaintdevice_qpa.cpp \ painting/qpaintengine.cpp \ - painting/qpaintengine_alpha.cpp \ - painting/qpaintengine_preview.cpp \ painting/qpaintengineex.cpp \ painting/qpainter.cpp \ painting/qpainterpath.cpp \ painting/qpathclipper.cpp \ painting/qpdf.cpp \ + painting/qpdfwriter.cpp \ painting/qpen.cpp \ painting/qpolygon.cpp \ - painting/qprintengine_pdf.cpp \ - painting/qprintengine_ps.cpp \ - painting/qprinter.cpp \ - painting/qprinterinfo.cpp \ painting/qrasterizer.cpp \ painting/qregion.cpp \ painting/qstroker.cpp \ - painting/qstylepainter.cpp \ - painting/qtessellator.cpp \ painting/qtextureglyphcache.cpp \ painting/qtransform.cpp \ - painting/qwindowsurface.cpp \ + painting/qplatformbackingstore_qpa.cpp \ painting/qpaintbuffer.cpp SOURCES += \ @@ -104,117 +87,7 @@ SOURCES += \ painting/qpaintengine_blitter_p.h \ painting/qblittable_p.h \ -win32 { - HEADERS += painting/qprintengine_win_p.h - SOURCES += \ - painting/qcolormap_win.cpp \ - painting/qpaintdevice_win.cpp \ - painting/qprintengine_win.cpp \ - painting/qprinterinfo_win.cpp - - !win32-borland:!wince*:LIBS += -lmsimg32 -} - -embedded { - HEADERS += \ - painting/qgraphicssystem_qws_p.h \ - - SOURCES += \ - painting/qgraphicssystem_qws.cpp \ - -} else: if(!qpa) { - HEADERS += \ - painting/qgraphicssystem_raster_p.h \ - painting/qgraphicssystem_runtime_p.h \ - painting/qgraphicssystemfactory_p.h \ - painting/qgraphicssystemplugin_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 -} - -unix:x11 { - HEADERS += \ - painting/qpaintengine_x11_p.h - - SOURCES += \ - painting/qcolormap_x11.cpp \ - painting/qpaintdevice_x11.cpp \ - painting/qpaintengine_x11.cpp -} - -!embedded:!qpa:!x11:mac { - HEADERS += \ - painting/qpaintengine_mac_p.h \ - painting/qgraphicssystem_mac_p.h \ - painting/qprintengine_mac_p.h - - SOURCES += \ - painting/qcolormap_mac.cpp \ - painting/qpaintdevice_mac.cpp \ - painting/qpaintengine_mac.cpp \ - painting/qgraphicssystem_mac.cpp \ - painting/qprinterinfo_mac.cpp - OBJECTIVE_SOURCES += \ - painting/qprintengine_mac.mm \ -} - -unix:!mac:!symbian|qpa { - HEADERS += \ - painting/qprinterinfo_unix_p.h - SOURCES += \ - painting/qprinterinfo_unix.cpp -} - -win32|x11|mac|embedded|qpa|symbian { - SOURCES += painting/qbackingstore.cpp - HEADERS += painting/qbackingstore_p.h -} - -embedded { - contains(QT_CONFIG,qtopia) { - DEFINES += QTOPIA_PRINTENGINE - HEADERS += painting/qprintengine_qws_p.h - SOURCES += painting/qprintengine_qws.cpp - } - - SOURCES += \ - painting/qcolormap_qws.cpp \ - painting/qpaintdevice_qws.cpp -} - -qpa { - SOURCES += \ - painting/qcolormap_qpa.cpp \ - painting/qpaintdevice_qpa.cpp -} - -symbian { - SOURCES += \ - painting/qpaintengine_s60.cpp \ - painting/qregion_s60.cpp \ - painting/qcolormap_s60.cpp - - HEADERS += \ - painting/qpaintengine_s60_p.h -} - -x11|embedded|qpa { - contains(QT_CONFIG,qtopia) { - DEFINES += QT_NO_CUPS QT_NO_LPR - } else { - SOURCES += painting/qcups.cpp - HEADERS += painting/qcups_p.h - } -} else { - DEFINES += QT_NO_CUPS QT_NO_LPR -} if(mmx|3dnow|sse|sse2|iwmmxt) { HEADERS += painting/qdrawhelper_x86_p.h \ @@ -230,29 +103,8 @@ if(mmx|3dnow|sse|sse2|iwmmxt) { IWMMXT_SOURCES += painting/qdrawhelper_iwmmxt.cpp } -x11 { - HEADERS += painting/qwindowsurface_x11_p.h - SOURCES += painting/qwindowsurface_x11.cpp -} - -!embedded:!qpa:mac { - HEADERS += painting/qwindowsurface_mac_p.h \ - painting/qunifiedtoolbarsurface_mac_p.h - SOURCES += painting/qwindowsurface_mac.cpp \ - painting/qunifiedtoolbarsurface_mac.cpp -} - -embedded { - HEADERS += painting/qwindowsurface_qws_p.h - SOURCES += painting/qwindowsurface_qws.cpp -} - - - symbian { - HEADERS += painting/qwindowsurface_s60_p.h \ - painting/qdrawhelper_arm_simd_p.h - SOURCES += painting/qwindowsurface_s60.cpp + HEADERS += painting/qdrawhelper_arm_simd_p.h armccIfdefBlock = \ "$${LITERAL_HASH}if defined(ARMV6)" \ "MACRO QT_HAVE_ARM_SIMD" \ diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 6fbb59fc89b..f69a2e4ff60 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -39,1630 +39,218 @@ ** ****************************************************************************/ +#include +#include +#include +#include +#include -#include "qplatformdefs.h" - -#include "qbackingstore_p.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "qgraphicssystem_p.h" - -#ifdef Q_WS_QWS -#include -#include -#endif +#include +#include QT_BEGIN_NAMESPACE -extern QRegion qt_dirtyRegion(QWidget *); +class QBackingStorePrivate +{ +public: + QBackingStorePrivate(QWindow *w) + : window(w) + { + } -/* - A version of QRect::intersects() that does not normalize the rects. + QWindow *window; + QPlatformBackingStore *platformBackingStore; + QRegion staticContents; + QSize size; +}; + +/*! + \class QBackingStore + \since 5.0 + + \brief The QBackingStore class provides the drawing area for top-level windows. */ -static inline bool qRectIntersects(const QRect &r1, const QRect &r2) + + +/*! + \fn void QBackingStore::beginPaint(const QRegion ®ion) + + This function is called before painting onto the surface begins, + with the \a region in which the painting will occur. + + \sa endPaint(), paintDevice() +*/ + +/*! + \fn void QBackingStore::endPaint(const QRegion ®ion) + + This function is called after painting onto the surface has ended, + with the \a region in which the painting was performed. + + \sa beginPaint(), paintDevice() +*/ + +/*! + \fn void QBackingStore::flush(QWindow *window, const QRegion ®ion, + const QPoint &offset) + + Flushes the given \a region from the specified \a window onto the + screen. + + Note that the \a offset parameter is currently unused. +*/ +void QBackingStore::flush(const QRegion ®ion, QWindow *win, const QPoint &offset) { - return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) - && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom())); + if (!win) + win = window(); + d_ptr->platformBackingStore->flush(win, region, offset); } -/** - * Flushes the contents of the \a windowSurface into the screen area of \a widget. - * \a tlwOffset is the position of the top level widget relative to the window surface. - * \a region is the region to be updated in \a widget coordinates. - */ -static inline void qt_flush(QWidget *widget, const QRegion ®ion, QWindowSurface *windowSurface, - QWidget *tlw, const QPoint &tlwOffset) +/*! + \fn QPaintDevice* QBackingStore::paintDevice() + + Implement this function to return the appropriate paint device. +*/ +QPaintDevice *QBackingStore::paintDevice() { - Q_ASSERT(widget); - Q_ASSERT(!region.isEmpty()); - Q_ASSERT(windowSurface); - Q_ASSERT(tlw); - -#if !defined(QT_NO_PAINT_DEBUG) && !defined(Q_WS_QWS) - // QWS does flush update in QWindowSurface::flush (because it needs to lock the surface etc). - static int flushUpdate = qgetenv("QT_FLUSH_UPDATE").toInt(); - if (flushUpdate > 0) - 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 - windowSurface->flush(widget, region, tlwOffset); + return d_ptr->platformBackingStore->paintDevice(); } -#ifndef QT_NO_PAINT_DEBUG -#ifdef Q_WS_WIN -static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec) +/*! + Constructs an empty surface for the given top-level \a window. +*/ +QBackingStore::QBackingStore(QWindow *window) + : d_ptr(new QBackingStorePrivate(window)) { - HBRUSH brush; - static int i = 0; - switch (i) { - case 0: - brush = CreateSolidBrush(RGB(255, 255, 0)); - break; - case 1: - brush = CreateSolidBrush(RGB(255, 200, 55)); - break; - case 2: - brush = CreateSolidBrush(RGB(200, 255, 55)); - break; - case 3: - brush = CreateSolidBrush(RGB(200, 200, 0)); - break; - } - i = (i + 1) & 3; - - HDC hdc = widget->getDC(); - - const QVector &rects = region.rects(); - foreach (QRect rect, rects) { - RECT winRect; - SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom()); - FillRect(hdc, &winRect, brush); - } - - widget->releaseDC(hdc); - ::Sleep(msec); -} -#endif - -void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped) -{ -#ifdef Q_WS_QWS - Q_UNUSED(widget); - Q_UNUSED(unclipped); - static QWSYellowSurface surface(true); - surface.setDelay(msec); - surface.flush(widget, toBePainted, QPoint()); -#else - QRegion paintRegion = toBePainted; - QRect widgetRect = widget->rect(); - - if (!widget->internalWinId()) { - QWidget *nativeParent = widget->nativeParentWidget(); - const QPoint offset = widget->mapTo(nativeParent, QPoint(0, 0)); - paintRegion.translate(offset); - widgetRect.translate(offset); - widget = nativeParent; - } - -#ifdef Q_WS_WIN - Q_UNUSED(unclipped); - showYellowThing_win(widget, paintRegion, msec); -#else - //flags to fool painter - bool paintUnclipped = widget->testAttribute(Qt::WA_PaintUnclipped); - if (unclipped && !widget->d_func()->paintOnScreen()) - widget->setAttribute(Qt::WA_PaintUnclipped); - - const bool setFlag = !widget->testAttribute(Qt::WA_WState_InPaintEvent); - if (setFlag) - widget->setAttribute(Qt::WA_WState_InPaintEvent); - - //setup the engine - QPaintEngine *pe = widget->paintEngine(); - if (pe) { - pe->setSystemClip(paintRegion); - { - QPainter p(widget); - p.setClipRegion(paintRegion); - static int i = 0; - switch (i) { - case 0: - p.fillRect(widgetRect, QColor(255,255,0)); - break; - case 1: - p.fillRect(widgetRect, QColor(255,200,55)); - break; - case 2: - p.fillRect(widgetRect, QColor(200,255,55)); - break; - case 3: - p.fillRect(widgetRect, QColor(200,200,0)); - break; - } - i = (i+1) & 3; - p.end(); - } - } - - if (setFlag) - widget->setAttribute(Qt::WA_WState_InPaintEvent, false); - - //restore - widget->setAttribute(Qt::WA_PaintUnclipped, paintUnclipped); - - if (pe) - pe->setSystemClip(QRegion()); - - QApplication::syncX(); - -#if defined(Q_OS_UNIX) - ::usleep(1000 * msec); -#endif -#endif // Q_WS_WIN -#endif // Q_WS_QWS + d_ptr->platformBackingStore = QGuiApplicationPrivate::platformIntegration()->createPlatformBackingStore(window); } -bool QWidgetBackingStore::flushPaint(QWidget *widget, const QRegion &rgn) +/*! + Destroys this surface. +*/ +QBackingStore::~QBackingStore() { - if (!widget) - return false; + delete d_ptr->platformBackingStore; +} - int delay = 0; - if (widget->testAttribute(Qt::WA_WState_InPaintEvent)) { - static int flushPaintEvent = qgetenv("QT_FLUSH_PAINT_EVENT").toInt(); - if (!flushPaintEvent) - return false; - delay = flushPaintEvent; +/*! + Returns a pointer to the top-level window associated with this + surface. +*/ +QWindow* QBackingStore::window() const +{ + return d_ptr->window; +} + +void QBackingStore::beginPaint(const QRegion ®ion) +{ + d_ptr->platformBackingStore->beginPaint(region); +} + +void QBackingStore::endPaint() +{ + d_ptr->platformBackingStore->endPaint(); +} + +/*! + Sets the size of the windowsurface to be \a size. + + \sa size() +*/ +void QBackingStore::resize(const QSize &size) +{ + d_ptr->size = size; + d_ptr->platformBackingStore->resize(size, d_ptr->staticContents); +} + +/*! + Returns the current size of the windowsurface. +*/ +QSize QBackingStore::size() const +{ + return d_ptr->size; +} + +/*! + Scrolls the given \a area \a dx pixels to the right and \a dy + downward; both \a dx and \a dy may be negative. + + Returns true if the area was scrolled successfully; false otherwise. +*/ +bool QBackingStore::scroll(const QRegion &area, int dx, int dy) +{ + Q_UNUSED(area); + Q_UNUSED(dx); + Q_UNUSED(dy); + + return d_ptr->platformBackingStore->scroll(area, dx, dy); +} + +void QBackingStore::setStaticContents(const QRegion ®ion) +{ + d_ptr->staticContents = region; +} + +QRegion QBackingStore::staticContents() const +{ + return d_ptr->staticContents; +} + +bool QBackingStore::hasStaticContents() const +{ + return !d_ptr->staticContents.isEmpty(); +} + +void Q_GUI_EXPORT 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 { - static int flushPaint = qgetenv("QT_FLUSH_PAINT").toInt(); - if (!flushPaint) - return false; - delay = flushPaint; + src = mem + r.top() * lineskip + r.left() * depth; + dest = mem + p.y() * lineskip + p.x() * depth; } - QWidgetBackingStore::showYellowThing(widget, rgn, delay * 10, true); - return true; -} + const int w = r.width(); + int h = r.height(); + const int bytes = w * depth; -void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn) -{ - if (widget->d_func()->paintOnScreen() || rgn.isEmpty()) - return; - - QWidget *tlw = widget->window(); - QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); - if (!tlwExtra) - return; - - const QPoint offset = widget->mapTo(tlw, QPoint()); - qt_flush(widget, rgn, tlwExtra->backingStore->windowSurface, tlw, offset); -} -#endif // QT_NO_PAINT_DEBUG - -/* - Moves the whole rect by (dx, dy) in widget's coordinate system. - Doesn't generate any updates. -*/ -bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *widget) -{ - const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft())); - const QRect tlwRect(QRect(pos, rect.size())); - if (fullUpdatePending || dirty.intersects(tlwRect)) - return false; // We don't want to scroll junk. - return windowSurface->scroll(tlwRect, dx, dy); -} - -void QWidgetBackingStore::releaseBuffer() -{ - if (windowSurface) -#if defined(Q_WS_QPA) - 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()); -#endif -} - -/*! - Prepares the window surface to paint a\ toClean region of the \a widget and - updates the BeginPaintInfo struct accordingly. - - The \a toClean region might be clipped by the window surface. -*/ -void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QWindowSurface *windowSurface, - BeginPaintInfo *returnInfo, bool toCleanIsInTopLevelCoordinates) -{ -#ifdef Q_WS_QWS - QWSWindowSurface *surface = static_cast(windowSurface); - QWidget *surfaceWidget = surface->window(); - - if (!surface->isValid()) { - // this looks strange but it really just releases the surface - surface->releaseSurface(); - // the old window surface is deleted in setWindowSurface, which is - // called from QWindowSurface constructor. - windowSurface = tlw->d_func()->createDefaultWindowSurface(); - surface = static_cast(windowSurface); - // createDefaultWindowSurface() will set topdata->windowSurface on the - // widget to zero. However, if this is a sub-surface, it should point - // to the widget's sub windowSurface, so we set that here: - if (!surfaceWidget->isWindow()) - surfaceWidget->d_func()->topData()->windowSurface = windowSurface; - surface->setGeometry(topLevelRect()); - returnInfo->windowSurfaceRecreated = true; - } - - const QRegion toCleanUnclipped(toClean); - - if (surfaceWidget->isWindow()) - tlwOffset = surface->painterOffset(); -#ifdef Q_BACKINGSTORE_SUBSURFACES - else if (toCleanIsInTopLevelCoordinates) - toClean &= surface->clipRegion().translated(surfaceWidget->mapTo(tlw, QPoint())); - if (!toCleanIsInTopLevelCoordinates && windowSurface == this->windowSurface) - toClean &= surface->clipRegion().translated(-widget->mapTo(surfaceWidget, QPoint())); -#else - toClean &= surface->clipRegion(); -#endif - - if (toClean.isEmpty()) { - if (surfaceWidget->isWindow()) { - dirtyFromPreviousSync += toCleanUnclipped; - hasDirtyFromPreviousSync = true; - } - - returnInfo->nothingToPaint = true; - // Nothing to repaint. However, we might have newly exposed areas on the - // screen, so we have to make sure those are flushed. - flush(); - return; - } - - if (surfaceWidget->isWindow()) { - if (toCleanUnclipped != toClean) { - dirtyFromPreviousSync += (toCleanUnclipped - surface->clipRegion()); - hasDirtyFromPreviousSync = true; - } - if (hasDirtyFromPreviousSync) { - dirtyFromPreviousSync -= toClean; - hasDirtyFromPreviousSync = !dirtyFromPreviousSync.isEmpty(); - } - } - -#endif // Q_WS_QWS - - Q_UNUSED(widget); - Q_UNUSED(toCleanIsInTopLevelCoordinates); - - // Always flush repainted areas. - dirtyOnScreen += toClean; - -#if defined(Q_WS_QWS) && !defined(Q_BACKINGSTORE_SUBSURFACES) - toClean.translate(tlwOffset); -#endif - -#ifdef QT_NO_PAINT_DEBUG - windowSurface->beginPaint(toClean); -#else - returnInfo->wasFlushed = QWidgetBackingStore::flushPaint(tlw, toClean); - // Avoid deadlock with QT_FLUSH_PAINT: the server will wait for - // the BackingStore lock, so if we hold that, the server will - // never release the Communication lock that we are waiting for in - // sendSynchronousCommand - if (!returnInfo->wasFlushed) - windowSurface->beginPaint(toClean); -#endif - - Q_UNUSED(returnInfo); -} - -void QWidgetBackingStore::endPaint(const QRegion &cleaned, QWindowSurface *windowSurface, - BeginPaintInfo *beginPaintInfo) -{ -#ifndef QT_NO_PAINT_DEBUG - if (!beginPaintInfo->wasFlushed) - windowSurface->endPaint(cleaned); - else - QWidgetBackingStore::unflushPaint(tlw, cleaned); -#else - Q_UNUSED(beginPaintInfo); - windowSurface->endPaint(cleaned); -#endif - -#ifdef Q_BACKINGSTORE_SUBSURFACES - flush(static_cast(windowSurface)->window(), windowSurface); -#else - flush(); -#endif -} - -/*! - Returns the region (in top-level coordinates) that needs repaint and/or flush. - - If the widget is non-zero, only the dirty region for the widget is returned - and the region will be in widget coordinates. -*/ -QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const -{ - const bool widgetDirty = widget && widget != tlw; - const QRect tlwRect(topLevelRect()); -#if defined(Q_WS_QPA) - const QRect surfaceGeometry(tlwRect.topLeft(), windowSurface->size()); -#else - const QRect surfaceGeometry(windowSurface->geometry()); -#endif - if (fullUpdatePending || (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size())) { - if (widgetDirty) { - const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size()); - const QPoint offset(widget->mapTo(tlw, QPoint())); - const QRect dirtyWidgetRect(dirtyTlwRect & widget->rect().translated(offset)); - return dirtyWidgetRect.translated(-offset); - } - return QRect(QPoint(), tlwRect.size()); - } - - // Calculate the region that needs repaint. - QRegion r(dirty); - for (int i = 0; i < dirtyWidgets.size(); ++i) { - QWidget *w = dirtyWidgets.at(i); - if (widgetDirty && w != widget && !widget->isAncestorOf(w)) - continue; - r += w->d_func()->dirty.translated(w->mapTo(tlw, QPoint())); - } - - // Append the region that needs flush. - r += dirtyOnScreen; - - if (dirtyOnScreenWidgets) { // Only in use with native child widgets. - for (int i = 0; i < dirtyOnScreenWidgets->size(); ++i) { - QWidget *w = dirtyOnScreenWidgets->at(i); - if (widgetDirty && w != widget && !widget->isAncestorOf(w)) - continue; - QWidgetPrivate *wd = w->d_func(); - Q_ASSERT(wd->needsFlush); - r += wd->needsFlush->translated(w->mapTo(tlw, QPoint())); - } - } - - if (widgetDirty) { - // Intersect with the widget geometry and translate to its coordinates. - const QPoint offset(widget->mapTo(tlw, QPoint())); - r &= widget->rect().translated(offset); - r.translate(-offset); - } - return r; -} - -/*! - Returns the static content inside the \a parent if non-zero; otherwise the static content - for the entire backing store is returned. The content will be clipped to \a withinClipRect - if non-empty. -*/ -QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &withinClipRect) const -{ - if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) { -#if defined(Q_WS_QPA) - 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; - return QRegion(surfaceRect); - } - - QRegion region; - if (parent && parent->d_func()->children.isEmpty()) - return region; - - const bool clipToRect = !withinClipRect.isEmpty(); - const int count = staticWidgets.count(); - for (int i = 0; i < count; ++i) { - QWidget *w = staticWidgets.at(i); - QWidgetPrivate *wd = w->d_func(); - if (!wd->isOpaque || !wd->extra || wd->extra->staticContentsSize.isEmpty() - || !w->isVisible() || (parent && !parent->isAncestorOf(w))) { - continue; - } - - QRect rect(0, 0, wd->extra->staticContentsSize.width(), wd->extra->staticContentsSize.height()); - const QPoint offset = w->mapTo(parent ? parent : tlw, QPoint()); - if (clipToRect) - rect &= withinClipRect.translated(-offset); - if (rect.isEmpty()) - continue; - - rect &= wd->clipRect(); - if (rect.isEmpty()) - continue; - - QRegion visible(rect); - wd->clipToEffectiveMask(visible); - if (visible.isEmpty()) - continue; - wd->subtractOpaqueSiblings(visible, 0, /*alsoNonOpaque=*/true); - - visible.translate(offset); - region += visible; - } - - return region; -} - -static inline void sendUpdateRequest(QWidget *widget, bool updateImmediately) -{ - if (!widget) - return; - - if (updateImmediately) { - QEvent event(QEvent::UpdateRequest); - QApplication::sendEvent(widget, &event); + // overlapping segments? + if (offset.y() == 0 && qAbs(offset.x()) < w) { + do { + ::memmove(dest, src, bytes); + dest += lineskip; + src += lineskip; + } while (--h); } else { - QApplication::postEvent(widget, new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority); + do { + ::memcpy(dest, src, bytes); + dest += lineskip; + src += lineskip; + } while (--h); } } -/*! - Marks the region of the widget as dirty (if not already marked as dirty) and - posts an UpdateRequest event to the top-level widget (if not already posted). - - If updateImmediately is true, the event is sent immediately instead of posted. - - If invalidateBuffer is true, all widgets intersecting with the region will be dirty. - - If the widget paints directly on screen, the event is sent to the widget - instead of the top-level widget, and invalidateBuffer is completely ignored. - - ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). -*/ -void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately, - bool invalidateBuffer) +QPlatformBackingStore *QBackingStore::handle() const { - Q_ASSERT(tlw->d_func()->extra); - Q_ASSERT(tlw->d_func()->extra->topextra); - Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize); - Q_ASSERT(widget->isVisible() && widget->updatesEnabled()); - Q_ASSERT(widget->window() == tlw); - Q_ASSERT(!rgn.isEmpty()); - -#ifndef QT_NO_GRAPHICSEFFECT - widget->d_func()->invalidateGraphicsEffectsRecursively(); -#endif //QT_NO_GRAPHICSEFFECT - - if (widget->d_func()->paintOnScreen()) { - if (widget->d_func()->dirty.isEmpty()) { - widget->d_func()->dirty = rgn; - sendUpdateRequest(widget, updateImmediately); - return; - } else if (qt_region_strictContains(widget->d_func()->dirty, widget->rect())) { - if (updateImmediately) - sendUpdateRequest(widget, updateImmediately); - return; // Already dirty. - } - - const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty(); - widget->d_func()->dirty += rgn; - if (!eventAlreadyPosted || updateImmediately) - sendUpdateRequest(widget, updateImmediately); - return; - } - - if (fullUpdatePending) { - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); - return; - } - - if (!windowSurface->hasFeature(QWindowSurface::PartialUpdates)) { - fullUpdatePending = true; - sendUpdateRequest(tlw, updateImmediately); - return; - } - - const QPoint offset = widget->mapTo(tlw, QPoint()); - const QRect widgetRect = widget->d_func()->effectiveRectFor(widget->rect()); - if (qt_region_strictContains(dirty, widgetRect.translated(offset))) { - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); - return; // Already dirty. - } - - if (invalidateBuffer) { - const bool eventAlreadyPosted = !dirty.isEmpty(); -#ifndef QT_NO_GRAPHICSEFFECT - if (widget->d_func()->graphicsEffect) - dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset); - else -#endif //QT_NO_GRAPHICSEFFECT - dirty += rgn.translated(offset); - if (!eventAlreadyPosted || updateImmediately) - sendUpdateRequest(tlw, updateImmediately); - return; - } - - if (dirtyWidgets.isEmpty()) { - addDirtyWidget(widget, rgn); - sendUpdateRequest(tlw, updateImmediately); - return; - } - - if (widget->d_func()->inDirtyList) { - if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) { -#ifndef QT_NO_GRAPHICSEFFECT - if (widget->d_func()->graphicsEffect) - widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()); - else -#endif //QT_NO_GRAPHICSEFFECT - widget->d_func()->dirty += rgn; - } - } else { - addDirtyWidget(widget, rgn); - } - - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); + return d_ptr->platformBackingStore; } -/*! - This function is equivalent to calling markDirty(QRegion(rect), ...), but - is more efficient as it eliminates QRegion operations/allocations and can - use the rect more precisely for additional cut-offs. - - ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). -*/ -void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool updateImmediately, - bool invalidateBuffer) -{ - Q_ASSERT(tlw->d_func()->extra); - Q_ASSERT(tlw->d_func()->extra->topextra); - Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize); - Q_ASSERT(widget->isVisible() && widget->updatesEnabled()); - Q_ASSERT(widget->window() == tlw); - Q_ASSERT(!rect.isEmpty()); - -#ifndef QT_NO_GRAPHICSEFFECT - widget->d_func()->invalidateGraphicsEffectsRecursively(); -#endif //QT_NO_GRAPHICSEFFECT - - if (widget->d_func()->paintOnScreen()) { - if (widget->d_func()->dirty.isEmpty()) { - widget->d_func()->dirty = QRegion(rect); - sendUpdateRequest(widget, updateImmediately); - return; - } else if (qt_region_strictContains(widget->d_func()->dirty, rect)) { - if (updateImmediately) - sendUpdateRequest(widget, updateImmediately); - return; // Already dirty. - } - - const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty(); - widget->d_func()->dirty += rect; - if (!eventAlreadyPosted || updateImmediately) - sendUpdateRequest(widget, updateImmediately); - return; - } - - if (fullUpdatePending) { - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); - return; - } - - if (!windowSurface->hasFeature(QWindowSurface::PartialUpdates)) { - fullUpdatePending = true; - sendUpdateRequest(tlw, updateImmediately); - return; - } - - const QRect widgetRect = widget->d_func()->effectiveRectFor(rect); - const QRect translatedRect(widgetRect.translated(widget->mapTo(tlw, QPoint()))); - if (qt_region_strictContains(dirty, translatedRect)) { - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); - return; // Already dirty - } - - if (invalidateBuffer) { - const bool eventAlreadyPosted = !dirty.isEmpty(); - dirty += translatedRect; - if (!eventAlreadyPosted || updateImmediately) - sendUpdateRequest(tlw, updateImmediately); - return; - } - - if (dirtyWidgets.isEmpty()) { - addDirtyWidget(widget, rect); - sendUpdateRequest(tlw, updateImmediately); - return; - } - - if (widget->d_func()->inDirtyList) { - if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) - widget->d_func()->dirty += widgetRect; - } else { - addDirtyWidget(widget, rect); - } - - if (updateImmediately) - sendUpdateRequest(tlw, updateImmediately); -} - -/*! - Marks the \a region of the \a widget as dirty on screen. The \a region will be copied from - the backing store to the \a widget's native parent next time flush() is called. - - Paint on screen widgets are ignored. -*/ -void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widget, const QPoint &topLevelOffset) -{ - if (!widget || widget->d_func()->paintOnScreen() || region.isEmpty()) - return; - -#if defined(Q_WS_QWS) || defined(Q_WS_MAC) - if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) - dirtyOnScreen += region.translated(topLevelOffset); - return; -#endif - - // Top-level. - if (widget == tlw) { - if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) - dirtyOnScreen += region; - return; - } - - // Alien widgets. - if (!widget->internalWinId() && !widget->isWindow()) { - QWidget *nativeParent = widget->nativeParentWidget(); // Alien widgets with the top-level as the native parent (common case). - if (nativeParent == tlw) { - if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) - dirtyOnScreen += region.translated(topLevelOffset); - return; - } - - // Alien widgets with native parent != tlw. - QWidgetPrivate *nativeParentPrivate = nativeParent->d_func(); - if (!nativeParentPrivate->needsFlush) - nativeParentPrivate->needsFlush = new QRegion; - const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint()); - *nativeParentPrivate->needsFlush += region.translated(nativeParentOffset); - appendDirtyOnScreenWidget(nativeParent); - return; - } - - // Native child widgets. - QWidgetPrivate *widgetPrivate = widget->d_func(); - if (!widgetPrivate->needsFlush) - widgetPrivate->needsFlush = new QRegion; - *widgetPrivate->needsFlush += region; - appendDirtyOnScreenWidget(widget); -} - -void QWidgetBackingStore::removeDirtyWidget(QWidget *w) -{ - if (!w) - return; - - dirtyWidgetsRemoveAll(w); - dirtyOnScreenWidgetsRemoveAll(w); - resetWidget(w); - - QWidgetPrivate *wd = w->d_func(); - const int n = wd->children.count(); - for (int i = 0; i < n; ++i) { - if (QWidget *child = qobject_cast(wd->children.at(i))) - removeDirtyWidget(child); - } -} - -#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER) -bool QWidgetBackingStore::hasDirtyWindowDecoration() const -{ - QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); - if (tlwExtra && tlwExtra->qwsManager) - return !tlwExtra->qwsManager->d_func()->dirtyRegions.isEmpty(); - return false; -} - -void QWidgetBackingStore::paintWindowDecoration() -{ - if (!hasDirtyWindowDecoration()) - return; - - QDecoration &decoration = QApplication::qwsDecoration(); - const QRect decorationRect = tlw->rect(); - QRegion decorationRegion = decoration.region(tlw, decorationRect); - - QWSManagerPrivate *managerPrivate = tlw->d_func()->topData()->qwsManager->d_func(); - const bool doClipping = !managerPrivate->entireDecorationNeedsRepaint - && !managerPrivate->dirtyClip.isEmpty(); - - if (doClipping) { - decorationRegion &= static_cast(windowSurface)->clipRegion(); - decorationRegion &= managerPrivate->dirtyClip; - } - - if (decorationRegion.isEmpty()) - return; - - //### The QWS decorations do not always paint the pixels they promise to paint. - // This causes painting problems with QWSMemorySurface. Since none of the other - // window surfaces actually use the region, passing an empty region is a safe - // workaround. - - windowSurface->beginPaint(QRegion()); - - QPaintEngine *engine = windowSurface->paintDevice()->paintEngine(); - Q_ASSERT(engine); - const QRegion oldSystemClip(engine->systemClip()); - engine->setSystemClip(decorationRegion.translated(tlwOffset)); - - QPainter painter(windowSurface->paintDevice()); - painter.setFont(QApplication::font()); - painter.translate(tlwOffset); - - const int numDirty = managerPrivate->dirtyRegions.size(); - for (int i = 0; i < numDirty; ++i) { - const int area = managerPrivate->dirtyRegions.at(i); - - QRegion clipRegion = decoration.region(tlw, decorationRect, area); - if (!clipRegion.isEmpty()) { - // Decoration styles changes the clip and assumes the old clip is non-empty, - // so we have to set it, but in theory it shouldn't be required. - painter.setClipRegion(clipRegion); - decoration.paint(&painter, tlw, area, managerPrivate->dirtyStates.at(i)); - } - } - markDirtyOnScreen(decorationRegion, tlw, QPoint()); - - painter.end(); - windowSurface->endPaint(decorationRegion); - managerPrivate->clearDirtyRegions(); - engine->setSystemClip(oldSystemClip); -} -#endif - -void QWidgetBackingStore::updateLists(QWidget *cur) -{ - if (!cur) - return; - - QList children = cur->children(); - for (int i = 0; i < children.size(); ++i) { - QWidget *child = qobject_cast(children.at(i)); - if (!child) - continue; - - updateLists(child); - } - - if (cur->testAttribute(Qt::WA_StaticContents)) - addStaticWidget(cur); - -#ifdef Q_BACKINGSTORE_SUBSURFACES - QTLWExtra *extra = cur->d_func()->maybeTopData(); - if (extra && extra->windowSurface && cur != tlw) - subSurfaces.append(extra->windowSurface); -#endif -} - -QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel) - : tlw(topLevel), dirtyOnScreenWidgets(0), hasDirtyFromPreviousSync(false) - , fullUpdatePending(0) -{ - windowSurface = tlw->windowSurface(); - if (!windowSurface) - windowSurface = topLevel->d_func()->createDefaultWindowSurface(); - - // The QWindowSurface constructor will call QWidget::setWindowSurface(), - // but automatically created surfaces should not be added to the topdata. -#ifdef Q_BACKINGSTORE_SUBSURFACES - Q_ASSERT(topLevel->d_func()->topData()->windowSurface == windowSurface); -#endif - topLevel->d_func()->topData()->windowSurface = 0; - - // Ensure all existing subsurfaces and static widgets are added to their respective lists. - updateLists(topLevel); -} - -QWidgetBackingStore::~QWidgetBackingStore() -{ - for (int c = 0; c < dirtyWidgets.size(); ++c) { - resetWidget(dirtyWidgets.at(c)); - } - - delete windowSurface; - windowSurface = 0; - delete dirtyOnScreenWidgets; - dirtyOnScreenWidgets = 0; -} - -//parent's coordinates; move whole rect; update parent and widget -//assume the screen blt has already been done, so we don't need to refresh that part -void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) -{ - Q_Q(QWidget); - if (!q->isVisible() || (dx == 0 && dy == 0)) - return; - - QWidget *tlw = q->window(); - QTLWExtra* x = tlw->d_func()->topData(); - if (x->inTopLevelResize) - return; - - static int accelEnv = -1; - if (accelEnv == -1) { - accelEnv = qgetenv("QT_NO_FAST_MOVE").toInt() == 0; - } - - QWidget *pw = q->parentWidget(); - QPoint toplevelOffset = pw->mapTo(tlw, QPoint()); - QWidgetPrivate *pd = pw->d_func(); - QRect clipR(pd->clipRect()); -#ifdef Q_WS_QWS - QWidgetBackingStore *wbs = x->backingStore.data(); - QWSWindowSurface *surface = static_cast(wbs->windowSurface); - clipR = clipR.intersected(surface->clipRegion().translated(-toplevelOffset).boundingRect()); -#endif - const QRect newRect(rect.translated(dx, dy)); - QRect destRect = rect.intersected(clipR); - if (destRect.isValid()) - destRect = destRect.translated(dx, dy).intersected(clipR); - const QRect sourceRect(destRect.translated(-dx, -dy)); - const QRect parentRect(rect & clipR); - - bool accelerateMove = accelEnv && isOpaque -#ifndef QT_NO_GRAPHICSVIEW - // No accelerate move for proxy widgets. - && !tlw->d_func()->extra->proxyWidget -#endif - && !isOverlapped(sourceRect) && !isOverlapped(destRect); - - if (!accelerateMove) { - QRegion parentR(effectiveRectFor(parentRect)); - if (!extra || !extra->hasMask) { - parentR -= newRect; - } else { - // invalidateBuffer() excludes anything outside the mask - parentR += newRect & clipR; - } - pd->invalidateBuffer(parentR); - invalidateBuffer((newRect & clipR).translated(-data.crect.topLeft())); - } else { - - QWidgetBackingStore *wbs = x->backingStore.data(); - QRegion childExpose(newRect & clipR); - - if (sourceRect.isValid() && wbs->bltRect(sourceRect, dx, dy, pw)) - childExpose -= destRect; - - if (!pw->updatesEnabled()) - return; - - const bool childUpdatesEnabled = q->updatesEnabled(); - if (childUpdatesEnabled && !childExpose.isEmpty()) { - childExpose.translate(-data.crect.topLeft()); - wbs->markDirty(childExpose, q); - isMoved = true; - } - - QRegion parentExpose(parentRect); - parentExpose -= newRect; - if (extra && extra->hasMask) - parentExpose += QRegion(newRect) - extra->mask.translated(data.crect.topLeft()); - - if (!parentExpose.isEmpty()) { - wbs->markDirty(parentExpose, pw); - pd->isMoved = true; - } - - if (childUpdatesEnabled) { - QRegion needsFlush(sourceRect); - needsFlush += destRect; - wbs->markDirtyOnScreen(needsFlush, pw, toplevelOffset); - } - } -} - -//widget's coordinates; scroll within rect; only update widget -void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) -{ - Q_Q(QWidget); - QWidget *tlw = q->window(); - QTLWExtra* x = tlw->d_func()->topData(); - if (x->inTopLevelResize) - return; - - QWidgetBackingStore *wbs = x->backingStore.data(); - if (!wbs) - return; - - static int accelEnv = -1; - if (accelEnv == -1) { - accelEnv = qgetenv("QT_NO_FAST_SCROLL").toInt() == 0; - } - - QRect scrollRect = rect & clipRect(); - bool overlapped = false; - bool accelerateScroll = accelEnv && isOpaque - && !(overlapped = isOverlapped(scrollRect.translated(data.crect.topLeft()))); - -#if defined(Q_WS_QWS) - QWSWindowSurface *surface; - surface = static_cast(wbs->windowSurface); - - if (accelerateScroll && !surface->isBuffered()) { - const QRegion surfaceClip = surface->clipRegion(); - const QRegion outsideClip = QRegion(rect) - surfaceClip; - if (!outsideClip.isEmpty()) { - const QVector clipped = (surfaceClip & rect).rects(); - if (clipped.size() < 8) { - for (int i = 0; i < clipped.size(); ++i) - this->scrollRect(clipped.at(i), dx, dy); - return; - } else { - accelerateScroll = false; - } - } - } -#endif // Q_WS_QWS - - if (!accelerateScroll) { - if (overlapped) { - QRegion region(scrollRect); - subtractOpaqueSiblings(region); - invalidateBuffer(region); - }else { - invalidateBuffer(scrollRect); - } - } else { - const QPoint toplevelOffset = q->mapTo(tlw, QPoint()); -#ifdef Q_WS_QWS - QWSWindowSurface *surface = static_cast(wbs->windowSurface); - const QRegion clip = surface->clipRegion().translated(-toplevelOffset) & scrollRect; - const QRect clipBoundingRect = clip.boundingRect(); - scrollRect &= clipBoundingRect; -#endif - const QRect destRect = scrollRect.translated(dx, dy) & scrollRect; - const QRect sourceRect = destRect.translated(-dx, -dy); - - QRegion childExpose(scrollRect); - if (sourceRect.isValid()) { - if (wbs->bltRect(sourceRect, dx, dy, q)) - childExpose -= destRect; - } - - if (inDirtyList) { - if (rect == q->rect()) { - dirty.translate(dx, dy); - } else { - QRegion dirtyScrollRegion = dirty.intersected(scrollRect); - if (!dirtyScrollRegion.isEmpty()) { - dirty -= dirtyScrollRegion; - dirtyScrollRegion.translate(dx, dy); - dirty += dirtyScrollRegion; - } - } - } - - if (!q->updatesEnabled()) - return; - - if (!childExpose.isEmpty()) { - wbs->markDirty(childExpose, q); - isScrolled = true; - } - - // Instead of using native scroll-on-screen, we copy from - // backingstore, giving only one screen update for each - // scroll, and a solid appearance - wbs->markDirtyOnScreen(destRect, q, toplevelOffset); - } -} - -static inline bool discardSyncRequest(QWidget *tlw, QTLWExtra *tlwExtra) -{ - if (!tlw || !tlwExtra) - return true; - -#ifdef Q_WS_X11 - // Delay the sync until we get an Expose event from X11 (initial show). - // Qt::WA_Mapped is set to true, but the actual mapping has not yet occurred. - // However, we must repaint immediately regardless of the state if someone calls repaint(). - if (tlwExtra->waitingForMapNotify && !tlwExtra->inRepaint) - return true; -#endif - - if (!tlw->testAttribute(Qt::WA_Mapped)) - return true; - - if (!tlw->isVisible() -#ifndef Q_WS_X11 - // If we're minimized on X11, WA_Mapped will be false and we - // will return in the case above. Some window managers on X11 - // sends us the PropertyNotify to change the minimized state - // *AFTER* we've received the expose event, which is baaad. - || tlw->isMinimized() -#endif - ) - return true; - - return false; -} - -/*! - Synchronizes the \a exposedRegion of the \a exposedWidget with the backing store. - - If there's nothing to repaint, the area is flushed and painting does not occur; - otherwise the area is marked as dirty on screen and will be flushed right after - we are done with all painting. -*/ -void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedRegion) -{ - QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); - if (discardSyncRequest(tlw, tlwExtra) || tlwExtra->inTopLevelResize) - return; - - if (!exposedWidget || !exposedWidget->internalWinId() || !exposedWidget->isVisible() - || !exposedWidget->updatesEnabled() || exposedRegion.isEmpty()) { - return; - } - - // If there's no preserved contents support we always need - // to do a full repaint before flushing - if (!windowSurface->hasFeature(QWindowSurface::PreservedContents)) - fullUpdatePending = true; - - // Nothing to repaint. - if (!isDirty()) { - qt_flush(exposedWidget, exposedRegion, windowSurface, tlw, tlwOffset); - return; - } - - if (exposedWidget != tlw) - markDirtyOnScreen(exposedRegion, exposedWidget, exposedWidget->mapTo(tlw, QPoint())); - else - markDirtyOnScreen(exposedRegion, exposedWidget, QPoint()); - sync(); -} - -/*! - Synchronizes the backing store, i.e. dirty areas are repainted and flushed. -*/ -void QWidgetBackingStore::sync() -{ - QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); - if (discardSyncRequest(tlw, tlwExtra)) { - // If the top-level is minimized, it's not visible on the screen so we can delay the - // update until it's shown again. In order to do that we must keep the dirty states. - // These will be cleared when we receive the first expose after showNormal(). - // However, if the widget is not visible (isVisible() returns false), everything will - // be invalidated once the widget is shown again, so clear all dirty states. - if (!tlw->isVisible()) { - dirty = QRegion(); - for (int i = 0; i < dirtyWidgets.size(); ++i) - resetWidget(dirtyWidgets.at(i)); - dirtyWidgets.clear(); - fullUpdatePending = false; - } - return; - } - - const bool updatesDisabled = !tlw->updatesEnabled(); - bool repaintAllWidgets = false; - - const bool inTopLevelResize = tlwExtra->inTopLevelResize; - const QRect tlwRect(topLevelRect()); -#ifdef Q_WS_QPA - const QRect surfaceGeometry(tlwRect.topLeft(), windowSurface->size()); -#else - const QRect surfaceGeometry(windowSurface->geometry()); -#endif - if ((fullUpdatePending || inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) { - if (hasStaticContents()) { - // Repaint existing dirty area and newly visible area. - const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); - const QRegion staticRegion(staticContents(0, clipRect)); - QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height()); - newVisible -= staticRegion; - dirty += newVisible; - windowSurface->setStaticContents(staticRegion); - } else { - // Repaint everything. - dirty = QRegion(0, 0, tlwRect.width(), tlwRect.height()); - for (int i = 0; i < dirtyWidgets.size(); ++i) - resetWidget(dirtyWidgets.at(i)); - dirtyWidgets.clear(); - repaintAllWidgets = true; - } - } - -#ifdef Q_WS_QPA - if (inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) - windowSurface->resize(tlwRect.size()); -#else - if (inTopLevelResize || surfaceGeometry != tlwRect) - windowSurface->setGeometry(tlwRect); -#endif - - if (updatesDisabled) - return; - - if (hasDirtyFromPreviousSync) - dirty += dirtyFromPreviousSync; - - // Contains everything that needs repaint. - QRegion toClean(dirty); - - // Loop through all update() widgets and remove them from the list before they are - // painted (in case someone calls update() in paintEvent). If the widget is opaque - // and does not have transparent overlapping siblings, append it to the - // opaqueNonOverlappedWidgets list and paint it directly without composition. - QVarLengthArray opaqueNonOverlappedWidgets; - for (int i = 0; i < dirtyWidgets.size(); ++i) { - QWidget *w = dirtyWidgets.at(i); - QWidgetPrivate *wd = w->d_func(); - if (wd->data.in_destructor) - continue; - - // Clip with mask() and clipRect(). - wd->dirty &= wd->clipRect(); - wd->clipToEffectiveMask(wd->dirty); - - // Subtract opaque siblings and children. - bool hasDirtySiblingsAbove = false; - // We know for sure that the widget isn't overlapped if 'isMoved' is true. - if (!wd->isMoved) - wd->subtractOpaqueSiblings(wd->dirty, &hasDirtySiblingsAbove); - // Scrolled and moved widgets must draw all children. - if (!wd->isScrolled && !wd->isMoved) - wd->subtractOpaqueChildren(wd->dirty, w->rect()); - - if (wd->dirty.isEmpty()) { - resetWidget(w); - continue; - } - - const QRegion widgetDirty(w != tlw ? wd->dirty.translated(w->mapTo(tlw, QPoint())) - : wd->dirty); - toClean += widgetDirty; - -#ifndef QT_NO_GRAPHICSVIEW - if (tlw->d_func()->extra->proxyWidget) { - resetWidget(w); - continue; - } -#endif - - if (!hasDirtySiblingsAbove && wd->isOpaque && !dirty.intersects(widgetDirty.boundingRect())) { - opaqueNonOverlappedWidgets.append(w); - } else { - resetWidget(w); - dirty += widgetDirty; - } - } - dirtyWidgets.clear(); - - fullUpdatePending = false; - - if (toClean.isEmpty()) { - // Nothing to repaint. However, we might have newly exposed areas on the - // screen if this function was called from sync(QWidget *, QRegion)), so - // we have to make sure those are flushed. - flush(); - return; - } - -#ifndef QT_NO_GRAPHICSVIEW - if (tlw->d_func()->extra->proxyWidget) { - updateStaticContentsSize(); - dirty = QRegion(); - const QVector rects(toClean.rects()); - for (int i = 0; i < rects.size(); ++i) - tlw->d_func()->extra->proxyWidget->update(rects.at(i)); - return; - } -#endif - -#ifndef Q_BACKINGSTORE_SUBSURFACES - BeginPaintInfo beginPaintInfo; - beginPaint(toClean, tlw, windowSurface, &beginPaintInfo); - if (beginPaintInfo.nothingToPaint) { - for (int i = 0; i < opaqueNonOverlappedWidgets.size(); ++i) - resetWidget(opaqueNonOverlappedWidgets[i]); - dirty = QRegion(); - return; - } -#endif - - // Must do this before sending any paint events because - // the size may change in the paint event. - updateStaticContentsSize(); - const QRegion dirtyCopy(dirty); - dirty = QRegion(); - - // Paint opaque non overlapped widgets. - for (int i = 0; i < opaqueNonOverlappedWidgets.size(); ++i) { - QWidget *w = opaqueNonOverlappedWidgets[i]; - QWidgetPrivate *wd = w->d_func(); - - int flags = QWidgetPrivate::DrawRecursive; - // Scrolled and moved widgets must draw all children. - if (!wd->isScrolled && !wd->isMoved) - flags |= QWidgetPrivate::DontDrawOpaqueChildren; - if (w == tlw) - flags |= QWidgetPrivate::DrawAsRoot; - - QRegion toBePainted(wd->dirty); - resetWidget(w); - -#ifdef Q_BACKINGSTORE_SUBSURFACES - QWindowSurface *subSurface = w->windowSurface(); - BeginPaintInfo beginPaintInfo; - - QPoint off = w->mapTo(tlw, QPoint()); - toBePainted.translate(off); - beginPaint(toBePainted, w, subSurface, &beginPaintInfo, true); - toBePainted.translate(-off); - - if (beginPaintInfo.nothingToPaint) - continue; - - if (beginPaintInfo.windowSurfaceRecreated) { - // Eep the window surface has changed. The old one may have been - // deleted, in which case we will segfault on the call to - // painterOffset() below. Use the new window surface instead. - subSurface = w->windowSurface(); - } - - QPoint offset(tlwOffset); - if (subSurface == windowSurface) - offset += w->mapTo(tlw, QPoint()); - else - offset = static_cast(subSurface)->painterOffset(); - wd->drawWidget(subSurface->paintDevice(), toBePainted, offset, flags, 0, this); - - endPaint(toBePainted, subSurface, &beginPaintInfo); -#else - QPoint offset(tlwOffset); - if (w != tlw) - offset += w->mapTo(tlw, QPoint()); - wd->drawWidget(windowSurface->paintDevice(), toBePainted, offset, flags, 0, this); -#endif - } - - // Paint the rest with composition. -#ifndef Q_BACKINGSTORE_SUBSURFACES - if (repaintAllWidgets || !dirtyCopy.isEmpty()) { - const int flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive; - tlw->d_func()->drawWidget(windowSurface->paintDevice(), dirtyCopy, tlwOffset, flags, 0, this); - } - - endPaint(toClean, windowSurface, &beginPaintInfo); -#else - if (!repaintAllWidgets && dirtyCopy.isEmpty()) - return; // Nothing more to paint. - - QList surfaceList(subSurfaces); - surfaceList.prepend(windowSurface); - const QRect dirtyBoundingRect(dirtyCopy.boundingRect()); - - // Loop through all window surfaces (incl. the top-level surface) and - // repaint those intersecting with the bounding rect of the dirty region. - for (int i = 0; i < surfaceList.size(); ++i) { - QWindowSurface *subSurface = surfaceList.at(i); - QWidget *w = subSurface->window(); - QWidgetPrivate *wd = w->d_func(); - - const QRect clipRect = wd->clipRect().translated(w->mapTo(tlw, QPoint())); - if (!qRectIntersects(dirtyBoundingRect, clipRect)) - continue; - - toClean = dirtyCopy; - BeginPaintInfo beginPaintInfo; - beginPaint(toClean, w, subSurface, &beginPaintInfo); - if (beginPaintInfo.nothingToPaint) - continue; - - if (beginPaintInfo.windowSurfaceRecreated) { - // Eep the window surface has changed. The old one may have been - // deleted, in which case we will segfault on the call to - // painterOffset() below. Use the new window surface instead. - subSurface = w->windowSurface(); - } - - int flags = QWidgetPrivate::DrawRecursive; - if (w == tlw) - flags |= QWidgetPrivate::DrawAsRoot; - const QPoint painterOffset = static_cast(subSurface)->painterOffset(); - wd->drawWidget(subSurface->paintDevice(), toClean, painterOffset, flags, 0, this); - - endPaint(toClean, subSurface, &beginPaintInfo); - } -#endif -} - -/*! - Flushes the contents of the backing store into the top-level widget. - If the \a widget is non-zero, the content is flushed to the \a widget. - If the \a surface is non-zero, the content of the \a surface is flushed. -*/ -void QWidgetBackingStore::flush(QWidget *widget, QWindowSurface *surface) -{ -#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER) - paintWindowDecoration(); -#endif - - if (!dirtyOnScreen.isEmpty()) { - QWidget *target = widget ? widget : tlw; - QWindowSurface *source = surface ? surface : windowSurface; - qt_flush(target, dirtyOnScreen, source, tlw, tlwOffset); - dirtyOnScreen = QRegion(); - } - - if (!dirtyOnScreenWidgets || dirtyOnScreenWidgets->isEmpty()) - return; - - for (int i = 0; i < dirtyOnScreenWidgets->size(); ++i) { - QWidget *w = dirtyOnScreenWidgets->at(i); - QWidgetPrivate *wd = w->d_func(); - Q_ASSERT(wd->needsFlush); - qt_flush(w, *wd->needsFlush, windowSurface, tlw, tlwOffset); - *wd->needsFlush = QRegion(); - } - dirtyOnScreenWidgets->clear(); -} - -static inline bool discardInvalidateBufferRequest(QWidget *widget, QTLWExtra *tlwExtra) -{ - Q_ASSERT(widget); - if (QApplication::closingDown()) - return true; - - if (!tlwExtra || tlwExtra->inTopLevelResize || !tlwExtra->backingStore) - return true; - - if (!widget->isVisible() || !widget->updatesEnabled()) - return true; - - return false; -} - -/*! - Invalidates the buffer when the widget is resized. - Static areas are never invalidated unless absolutely needed. -*/ -void QWidgetPrivate::invalidateBuffer_resizeHelper(const QPoint &oldPos, const QSize &oldSize) -{ - Q_Q(QWidget); - Q_ASSERT(!q->isWindow()); - Q_ASSERT(q->parentWidget()); - - const bool staticContents = q->testAttribute(Qt::WA_StaticContents); - const bool sizeDecreased = (data.crect.width() < oldSize.width()) - || (data.crect.height() < oldSize.height()); - - const QPoint offset(data.crect.x() - oldPos.x(), data.crect.y() - oldPos.y()); - const bool parentAreaExposed = !offset.isNull() || sizeDecreased; - const QRect newWidgetRect(q->rect()); - const QRect oldWidgetRect(0, 0, oldSize.width(), oldSize.height()); - - if (!staticContents || graphicsEffect) { - QRegion staticChildren; - QWidgetBackingStore *bs = 0; - if (offset.isNull() && (bs = maybeBackingStore())) - staticChildren = bs->staticContents(q, oldWidgetRect); - const bool hasStaticChildren = !staticChildren.isEmpty(); - - if (hasStaticChildren) { - QRegion dirty(newWidgetRect); - dirty -= staticChildren; - invalidateBuffer(dirty); - } else { - // Entire widget needs repaint. - invalidateBuffer(newWidgetRect); - } - - if (!parentAreaExposed) - return; - - // Invalidate newly exposed area of the parent. - if (!graphicsEffect && extra && extra->hasMask) { - QRegion parentExpose(extra->mask.translated(oldPos)); - parentExpose &= QRect(oldPos, oldSize); - if (hasStaticChildren) - parentExpose -= data.crect; // Offset is unchanged, safe to do this. - q->parentWidget()->d_func()->invalidateBuffer(parentExpose); - } else { - if (hasStaticChildren && !graphicsEffect) { - QRegion parentExpose(QRect(oldPos, oldSize)); - parentExpose -= data.crect; // Offset is unchanged, safe to do this. - q->parentWidget()->d_func()->invalidateBuffer(parentExpose); - } else { - q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(QRect(oldPos, oldSize))); - } - } - return; - } - - // Move static content to its new position. - if (!offset.isNull()) { - if (sizeDecreased) { - const QSize minSize(qMin(oldSize.width(), data.crect.width()), - qMin(oldSize.height(), data.crect.height())); - moveRect(QRect(oldPos, minSize), offset.x(), offset.y()); - } else { - moveRect(QRect(oldPos, oldSize), offset.x(), offset.y()); - } - } - - // Invalidate newly visible area of the widget. - if (!sizeDecreased || !oldWidgetRect.contains(newWidgetRect)) { - QRegion newVisible(newWidgetRect); - newVisible -= oldWidgetRect; - invalidateBuffer(newVisible); - } - - if (!parentAreaExposed) - return; - - // Invalidate newly exposed area of the parent. - const QRect oldRect(oldPos, oldSize); - if (extra && extra->hasMask) { - QRegion parentExpose(oldRect); - parentExpose &= extra->mask.translated(oldPos); - parentExpose -= (extra->mask.translated(data.crect.topLeft()) & data.crect); - q->parentWidget()->d_func()->invalidateBuffer(parentExpose); - } else { - QRegion parentExpose(oldRect); - parentExpose -= data.crect; - q->parentWidget()->d_func()->invalidateBuffer(parentExpose); - } -} - -/*! - Invalidates the \a rgn (in widget's coordinates) of the backing store, i.e. - all widgets intersecting with the region will be repainted when the backing store - is synced. - - ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). -*/ -void QWidgetPrivate::invalidateBuffer(const QRegion &rgn) -{ - Q_Q(QWidget); - - QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); - if (discardInvalidateBufferRequest(q, tlwExtra) || rgn.isEmpty()) - return; - - QRegion wrgn(rgn); - wrgn &= clipRect(); - if (!graphicsEffect && extra && extra->hasMask) - wrgn &= extra->mask; - if (wrgn.isEmpty()) - return; - - tlwExtra->backingStore->markDirty(wrgn, q, false, true); -} - -/*! - This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but - is more efficient as it eliminates QRegion operations/allocations and can - use the rect more precisely for additional cut-offs. - - ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). -*/ -void QWidgetPrivate::invalidateBuffer(const QRect &rect) -{ - Q_Q(QWidget); - - QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); - if (discardInvalidateBufferRequest(q, tlwExtra) || rect.isEmpty()) - return; - - QRect wRect(rect); - wRect &= clipRect(); - if (wRect.isEmpty()) - return; - - if (graphicsEffect || !extra || !extra->hasMask) { - tlwExtra->backingStore->markDirty(wRect, q, false, true); - return; - } - - QRegion wRgn(extra->mask); - wRgn &= wRect; - if (wRgn.isEmpty()) - return; - - tlwExtra->backingStore->markDirty(wRgn, q, false, true); -} - -void QWidgetPrivate::repaint_sys(const QRegion &rgn) -{ - if (data.in_destructor) - return; - - Q_Q(QWidget); - if (q->testAttribute(Qt::WA_StaticContents)) { - if (!extra) - createExtra(); - extra->staticContentsSize = data.crect.size(); - } - -#ifdef Q_WS_QPA //Dont even call q->p - QPaintEngine *engine = 0; -#else - QPaintEngine *engine = q->paintEngine(); -#endif - // QGLWidget does not support partial updates if: - // 1) The context is double buffered - // 2) The context is single buffered and auto-fill background is enabled. - const bool noPartialUpdateSupport = (engine && (engine->type() == QPaintEngine::OpenGL - || engine->type() == QPaintEngine::OpenGL2)) - && (usesDoubleBufferedGLContext || q->autoFillBackground()); - QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn); - -#ifdef Q_WS_MAC - // No difference between update() and repaint() on the Mac. - update_sys(toBePainted); - return; -#endif - - toBePainted &= clipRect(); - clipToEffectiveMask(toBePainted); - if (toBePainted.isEmpty()) - return; // Nothing to repaint. - -#ifndef QT_NO_PAINT_DEBUG - bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted); -#endif - - drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, 0); - -#ifndef QT_NO_PAINT_DEBUG - if (flushed) - QWidgetBackingStore::unflushPaint(q, toBePainted); -#endif - - if (!q->testAttribute(Qt::WA_PaintOutsidePaintEvent) && q->paintingActive()) - qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent"); -} - - QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_s60_p.h b/src/gui/painting/qbackingstore.h similarity index 66% rename from src/gui/painting/qwindowsurface_s60_p.h rename to src/gui/painting/qbackingstore.h index a086ca424d6..9f646f89ac1 100644 --- a/src/gui/painting/qwindowsurface_s60_p.h +++ b/src/gui/painting/qbackingstore.h @@ -39,55 +39,55 @@ ** ****************************************************************************/ -#ifndef QWINDOWSURFACE_S60_P_H -#define QWINDOWSURFACE_S60_P_H +#ifndef QBACKINGSTORE_H +#define QBACKINGSTORE_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 -#include -#include "private/qwindowsurface_p.h" - -class CFbsBitmap; +#include +#include QT_BEGIN_NAMESPACE -struct QS60WindowSurfacePrivate; +class QRegion; +class QRect; +class QPoint; +class QImage; +class QBackingStorePrivate; +class QPlatformBackingStore; -class QS60WindowSurface : public QWindowSurface +class Q_GUI_EXPORT QBackingStore { public: - QS60WindowSurface(QWidget *widget); - ~QS60WindowSurface(); + QBackingStore(QWindow *window); + ~QBackingStore(); + + QWindow *window() const; QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + + // 'window' can be a child window, in which case 'region' is in child window coordinates and + // offset is the (child) window's offset in relation to the window surface. + void flush(const QRegion ®ion, QWindow *window = 0, const QPoint &offset = QPoint()); + + void resize(const QSize &size); + QSize size() const; + bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion &); - void endPaint(const QRegion &); + void endPaint(); - QImage* buffer(const QWidget *widget); + void setStaticContents(const QRegion ®ion); + QRegion staticContents() const; + bool hasStaticContents() const; - void setGeometry(const QRect &rect); - - WindowSurfaceFeatures features() const; - - CFbsBitmap *symbianBitmap() const; + QPlatformBackingStore *handle() const; private: - QS60WindowSurfacePrivate* d_ptr; - + QScopedPointer d_ptr; }; QT_END_NAMESPACE -#endif // QWINDOWSURFACE_S60_P_H +#endif // QBACKINGSTORE_H diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 742a4ea0719..05f191dac6f 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -48,7 +48,7 @@ #include "qline.h" #include "qdebug.h" #include -#include "private/qstylehelper_p.h" +#include "private/qhexstring_p.h" #include QT_BEGIN_NAMESPACE @@ -706,36 +706,6 @@ void QBrush::setColor(const QColor &c) Sets the brush color to the given \a color. */ - -#ifdef QT3_SUPPORT - -/*! - \fn void QBrush::setPixmap(const QPixmap &pixmap) - - \compat - - Sets a custom pattern for this brush. - - Use setTexture() instead. -*/ - -/*! - \fn QPixmap *QBrush::pixmap() const - - Returns a pointer to the custom brush pattern. - - Use texture() instead. -*/ -QPixmap *QBrush::pixmap() const -{ - if (d->style != Qt::TexturePattern) - return 0; - QTexturedBrushData *data = static_cast(d.data()); - QPixmap &pixmap = data->pixmap(); - return pixmap.isNull() ? 0 : &pixmap; -} -#endif - /*! \fn QPixmap QBrush::texture() const diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index edf99924a3a..edb092c0357 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -126,12 +126,6 @@ public: bool operator==(const QBrush &b) const; inline bool operator!=(const QBrush &b) const { return !(operator==(b)); } -#ifdef QT3_SUPPORT - inline QT3_SUPPORT operator const QColor&() const; - QT3_SUPPORT QPixmap *pixmap() const; - inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap) { setTexture(pixmap); } -#endif - private: #if defined(Q_WS_X11) friend class QX11PaintEngine; @@ -185,10 +179,6 @@ inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); } inline QTransform QBrush::transform() const { return d->transform; } inline bool QBrush::isDetached() const { return d->ref == 1; } -#ifdef QT3_SUPPORT -inline QBrush::operator const QColor&() const { return d->color; } -#endif - /******************************************************************************* * QGradients diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 3d895b7753a..8234fa19f67 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -42,20 +42,10 @@ #include "qcolor.h" #include "qcolor_p.h" #include "qnamespace.h" -#include "qcolormap.h" #include "qdatastream.h" #include "qvariant.h" #include "qdebug.h" -#ifdef Q_WS_X11 -# include "qapplication.h" -# include "qx11info_x11.h" -# include "private/qt_x11_p.h" - -static bool allowX11ColorNames = false; - -#endif - #include #include #include @@ -164,9 +154,6 @@ QT_BEGIN_NAMESPACE \img alphafill.png - Alpha-blended drawing is supported on Windows, Mac OS X, and on - X11 systems that have the X Render extension installed. - The alpha channel of a color can be retrieved and set using the alpha() and setAlpha() functions if its value is an integer, and alphaF() and setAlphaF() if its value is qreal (double). By @@ -521,13 +508,11 @@ QString QColor::name() const same as defined by the Qt::GlobalColor enums, e.g. "green" and Qt::green does not refer to the same color. \i \c transparent - representing the absence of a color. - \i \e{X11 only}: If allowX11ColorNames() returns true, any valid X11 color name. See - the documentation for \c XParseColor() for information about valid X11 color names. \endlist The color is invalid if \a name cannot be parsed. - \sa QColor(), name(), isValid(), allowX11ColorNames() + \sa QColor(), name(), isValid() */ void QColor::setNamedColor(const QString &name) @@ -577,20 +562,8 @@ bool QColor::setColorFromString(const QString &name) } else #endif { -#ifdef Q_WS_X11 - XColor result; - if (allowX11ColorNames() - && QApplication::instance() - && QX11Info::display() - && XParseColor(QX11Info::display(), QX11Info::appColormap(), name.toLatin1().constData(), &result)) { - setRgb(result.red >> 8, result.green >> 8, result.blue >> 8); - return true; - } else -#endif - { - invalidate(); - return false; - } + invalidate(); + return false; } } @@ -2418,35 +2391,6 @@ QColor::operator QVariant() const return QVariant(QVariant::Color, this); } -#ifdef Q_WS_X11 -/*! - Returns true if setNamedColor() is allowed to look up colors in the X11 - color database. By default, this function returns false. - - \note This function is only available on the X11 platform. - - \sa setAllowX11ColorNames() -*/ -bool QColor::allowX11ColorNames() -{ - return ::allowX11ColorNames; -} - -/*! - Allow setNamedColor() to look up colors in the X11 color database if - \a enabled. By default, setNamedColor() does \e not look up colors in the - X11 color database. - - \note This function is only available on the X11 platform. - - \sa setNamedColor(), allowX11ColorNames() -*/ -void QColor::setAllowX11ColorNames(bool enabled) -{ - ::allowX11ColorNames = enabled; -} -#endif - /*! \internal Marks the color as invalid and sets all components to zero (alpha is set @@ -2462,30 +2406,6 @@ void QColor::invalidate() ct.argb.pad = 0; } -#ifdef QT3_SUPPORT - -/*! - Returns the pixel value used by the underlying window system to refer to a - color. - - Use QColormap::pixel() instead. - - \oldcode - QColor myColor; - uint pixel = myColor.pixel(screen); - \newcode - QColormap cmap = QColormap::instance(screen); - uint pixel = cmap.pixel(*this); - \endcode -*/ -uint QColor::pixel(int screen) const -{ - QColormap cmap = QColormap::instance(screen); - return cmap.pixel(*this); -} - -#endif // QT3_SUPPORT - /***************************************************************************** QColor stream functions *****************************************************************************/ diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h index 533f6fe315c..460a43183f3 100644 --- a/src/gui/painting/qcolor.h +++ b/src/gui/painting/qcolor.h @@ -203,35 +203,9 @@ public: operator QVariant() const; -#ifdef Q_WS_X11 - static bool allowX11ColorNames(); - static void setAllowX11ColorNames(bool enabled); -#endif - -#ifdef QT3_SUPPORT - inline QT3_SUPPORT_CONSTRUCTOR QColor(int x, int y, int z, Spec colorSpec) - { if (colorSpec == Hsv) setHsv(x, y, z); else setRgb(x, y, z); } - - inline QT3_SUPPORT void rgb(int *r, int *g, int *b) const - { getRgb(r, g, b); } - inline QT3_SUPPORT void hsv(int *h, int *s, int *v) const - { getHsv(h, s, v); } - - inline QT3_SUPPORT void setRgba(int r, int g, int b, int a) - { setRgb(r, g, b, a); } - inline QT3_SUPPORT void getRgba(int *r, int *g, int *b, int *a) const - { getRgb(r, g, b, a); } - - QT3_SUPPORT uint pixel(int screen = -1) const; -#endif - static bool isValidColor(const QString &name); private: -#ifndef QT3_SUPPORT - // do not allow a spec to be used as an alpha value - QColor(int, int, int, Spec); -#endif void invalidate(); bool setColorFromString(const QString &name); diff --git a/src/gui/painting/qcolormap_qws.cpp b/src/gui/painting/qcolormap_qws.cpp deleted file mode 100644 index 00d3a43e4fa..00000000000 --- a/src/gui/painting/qcolormap_qws.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcolormap.h" -#include "qcolor.h" -#include "qpaintdevice.h" -#include "qscreen_qws.h" -#include "qwsdisplay_qws.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; - - screenMap->depth = QPaintDevice::qwsDisplay()->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; -} - -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); - } - } - } - return qt_screen->alloc(qRed(rgb), qGreen(rgb), qBlue(rgb)); -} - -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)); - } - Q_ASSERT_X(int(pixel) < qt_screen->colorCount(), "QColormap::colorAt", "pixel out of bounds of palette"); - return QColor(qt_screen->clut()[pixel]); -} - -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/qcssutil_p.h b/src/gui/painting/qcssutil_p.h index be206f35b8a..fe5b7057b95 100644 --- a/src/gui/painting/qcssutil_p.h +++ b/src/gui/painting/qcssutil_p.h @@ -71,10 +71,10 @@ extern void qDrawRoundedCorners(QPainter *p, qreal x1, qreal y1, qreal x2, qreal const QSizeF& r1, const QSizeF& r2, QCss::Edge edge, QCss::BorderStyle s, QBrush c); -extern void qDrawBorder(QPainter *p, const QRect &rect, const QCss::BorderStyle *styles, +extern void Q_GUI_EXPORT qDrawBorder(QPainter *p, const QRect &rect, const QCss::BorderStyle *styles, const int *borders, const QBrush *colors, const QSize *radii); -extern void qNormalizeRadii(const QRect &br, const QSize *radii, +extern void Q_GUI_EXPORT qNormalizeRadii(const QRect &br, const QSize *radii, QSize *tlr, QSize *trr, QSize *blr, QSize *brr); QT_END_NAMESPACE diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index c97ef246222..cfd9934e9b5 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -3285,9 +3285,6 @@ static void drawBufferSpan(QSpanData *data, const uint *buffer, int bufsize, int x, int y, int length, uint const_alpha) { -#if defined (Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS) - data->rasterEngine->drawBufferSpan(buffer, bufsize, x, y, length, const_alpha); -#else Q_UNUSED(data); Q_UNUSED(buffer); Q_UNUSED(bufsize); @@ -3295,7 +3292,6 @@ void drawBufferSpan(QSpanData *data, const uint *buffer, int bufsize, Q_UNUSED(y); Q_UNUSED(length); Q_UNUSED(const_alpha); -#endif } #if !defined(Q_CC_SUN) @@ -3323,18 +3319,6 @@ void blend_color_generic(int count, const QSpan *spans, void *userData) } } -#if defined (Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS) -static void blend_color_generic_callback(int count, const QSpan *spans, void *userData) -{ - // ### Falcon - Q_UNUSED(count); - Q_UNUSED(spans); - Q_UNUSED(userData); -// QSpanData *data = reinterpret_cast(userData); -// data->rasterEngine->drawColorSpans(spans, count, data->solid.color); -} -#endif // QT_NO_RASTERCALLBACKS - static void blend_color_argb(int count, const QSpan *spans, void *userData) { QSpanData *data = reinterpret_cast(userData); @@ -4957,65 +4941,30 @@ 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) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_RGB888) - blendUntransformed(count, spans, userData); - else -#endif - blend_untransformed_generic(count, spans, userData); + blend_untransformed_generic(count, spans, userData); } static void blend_untransformed_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) - blendUntransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB666) - blendUntransformed(count, spans, userData); - else -#endif - blend_untransformed_generic(count, spans, userData); + blend_untransformed_generic(count, spans, userData); } static void blend_untransformed_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) - blendUntransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB666) - blendUntransformed(count, spans, userData); - else -#endif - blend_untransformed_generic(count, spans, userData); + blend_untransformed_generic(count, spans, userData); } static void blend_untransformed_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) - blendUntransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB16) - blendUntransformed(count, spans, userData); - else -#endif - blend_untransformed_generic(count, spans, userData); + blend_untransformed_generic(count, spans, userData); } static void blend_untransformed_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5023,68 +4972,31 @@ static void blend_untransformed_rgb565(int count, const QSpan *spans, else if (data->texture.format == QImage::Format_RGB16) blendUntransformed(count, spans, userData); else -#endif blend_untransformed_generic(count, spans, userData); } static void blend_untransformed_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) - blendUntransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB555) - blendUntransformed(count, spans, userData); - else -#endif - blend_untransformed_generic(count, spans, userData); + blend_untransformed_generic(count, spans, userData); } static void blend_untransformed_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) - blendUntransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB555) - blendUntransformed(count, spans, userData); - else -#endif - blend_untransformed_generic(count, spans, userData); + blend_untransformed_generic(count, spans, userData); } static void blend_untransformed_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) - blendUntransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB444) - blendUntransformed(count, spans, userData); - else -#endif - blend_untransformed_generic(count, spans, userData); + blend_untransformed_generic(count, spans, userData); } static void blend_untransformed_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) - blendUntransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB444) - blendUntransformed(count, spans, userData); - else -#endif - blend_untransformed_generic(count, spans, userData); + blend_untransformed_generic(count, spans, userData); } template @@ -5300,61 +5212,26 @@ 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) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_RGB888) - blendTiled(count, spans, userData); - else -#endif - blend_tiled_generic(count, spans, userData); + blend_tiled_generic(count, spans, userData); } static void blend_tiled_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) - blendTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB666) - blendTiled(count, spans, userData); - else -#endif - blend_tiled_generic(count, spans, userData); + blend_tiled_generic(count, spans, userData); } static void blend_tiled_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) - blendTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB666) - blendTiled(count, spans, userData); - else -#endif - blend_tiled_generic(count, spans, userData); + blend_tiled_generic(count, spans, userData); } static void blend_tiled_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) - blendTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB16) - blendTiled(count, spans, userData); - else -#endif - blend_tiled_generic(count, spans, userData); + blend_tiled_generic(count, spans, userData); } static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -5362,64 +5239,27 @@ static void blend_tiled_rgb565(int count, const QSpan *spans, void *userData) else if (data->texture.format == QImage::Format_RGB16) blendTiled(count, spans, userData); else -#endif blend_tiled_generic(count, spans, userData); } static void blend_tiled_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) - blendTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB555) - blendTiled(count, spans, userData); - else -#endif - blend_tiled_generic(count, spans, userData); + blend_tiled_generic(count, spans, userData); } static void blend_tiled_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) - blendTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB555) - blendTiled(count, spans, userData); - else -#endif - blend_tiled_generic(count, spans, userData); + blend_tiled_generic(count, spans, userData); } static void blend_tiled_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) - blendTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB444) - blendTiled(count, spans, userData); - else -#endif - blend_tiled_generic(count, spans, userData); + blend_tiled_generic(count, spans, userData); } static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) - blendTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB444) - blendTiled(count, spans, userData); - else -#endif - blend_tiled_generic(count, spans, userData); + blend_tiled_generic(count, spans, userData); } template @@ -5647,62 +5487,27 @@ 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) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_RGB888) - blendTransformedBilinear(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_bilinear_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) - blendTransformedBilinear(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB666) - blendTransformedBilinear(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_bilinear_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) - blendTransformedBilinear(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB666) - blendTransformedBilinear(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_bilinear_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) - blendTransformedBilinear(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB16) - blendTransformedBilinear(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_RGB16) @@ -5710,64 +5515,27 @@ static void blend_transformed_bilinear_rgb565(int count, const QSpan *spans, else if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) blendTransformedBilinear(count, spans, userData); else -#endif blend_src_generic(count, spans, userData); } static void blend_transformed_bilinear_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) - blendTransformedBilinear(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB555) - blendTransformedBilinear(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_bilinear_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) - blendTransformedBilinear(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB555) - blendTransformedBilinear(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_bilinear_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) - blendTransformedBilinear(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB444) - blendTransformedBilinear(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_bilinear_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) - blendTransformedBilinear(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB444) - blendTransformedBilinear(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } template @@ -6040,65 +5808,30 @@ 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) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_RGB888) - blendTransformed(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) - blendTransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB666) - blendTransformed(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) - blendTransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB666) - blendTransformed(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) - blendTransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB16) - blendTransformed(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6106,68 +5839,31 @@ static void blend_transformed_rgb565(int count, const QSpan *spans, else if (data->texture.format == QImage::Format_RGB16) blendTransformed(count, spans, userData); else -#endif blend_src_generic(count, spans, userData); } static void blend_transformed_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) - blendTransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB555) - blendTransformed(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) - blendTransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB555) - blendTransformed(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) - blendTransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB444) - blendTransformed(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) - blendTransformed(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB444) - blendTransformed(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } template @@ -6455,65 +6151,30 @@ 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) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_RGB888) - blendTransformedTiled(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_tiled_argb6666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) - blendTransformedTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB666) - blendTransformedTiled(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_tiled_rgb666(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_18) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB6666_Premultiplied) - blendTransformedTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB666) - blendTransformedTiled(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_tiled_argb8565(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_16) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) - blendTransformedTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB16) - blendTransformedTiled(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, void *userData) { -#if !defined(Q_WS_QWS) || defined(QT_QWS_DEPTH_16) QSpanData *data = reinterpret_cast(userData); if (data->texture.format == QImage::Format_ARGB8565_Premultiplied) @@ -6521,68 +6182,31 @@ static void blend_transformed_tiled_rgb565(int count, const QSpan *spans, else if (data->texture.format == QImage::Format_RGB16) blendTransformedTiled(count, spans, userData); else -#endif blend_src_generic(count, spans, userData); } static void blend_transformed_tiled_argb8555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) - blendTransformedTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB555) - blendTransformedTiled(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_tiled_rgb555(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_15) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB8555_Premultiplied) - blendTransformedTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB555) - blendTransformedTiled(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_tiled_argb4444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) - blendTransformedTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB444) - blendTransformedTiled(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } static void blend_transformed_tiled_rgb444(int count, const QSpan *spans, void *userData) { -#if defined(QT_QWS_DEPTH_12) - QSpanData *data = reinterpret_cast(userData); - - if (data->texture.format == QImage::Format_ARGB4444_Premultiplied) - blendTransformedTiled(count, spans, userData); - else if (data->texture.format == QImage::Format_RGB444) - blendTransformedTiled(count, spans, userData); - else -#endif - blend_src_generic(count, spans, userData); + blend_src_generic(count, spans, userData); } # define SPANFUNC_POINTER(Name, Arg) Name @@ -6706,125 +6330,6 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats } }; -#if defined (Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS) -static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImageFormats] = { - // Untransformed - { - 0, // Invalid - blend_untransformed_generic, // Mono - blend_untransformed_generic, // MonoLsb - blend_untransformed_generic, // Indexed8 - blend_untransformed_generic, // RGB32 - blend_untransformed_generic, // ARGB32 - blend_untransformed_argb, // ARGB32_Premultiplied - blend_untransformed_generic, // RGB16 - blend_untransformed_generic, // ARGB8565_Premultiplied - blend_untransformed_generic, // RGB666 - blend_untransformed_generic, // ARGB6666_Premultiplied - blend_untransformed_generic, // RGB555 - blend_untransformed_generic, // ARGB8555_Premultiplied - blend_untransformed_generic, // RGB888 - blend_untransformed_generic, // RGB444 - blend_untransformed_generic // ARGB4444_Premultiplied - }, - // Tiled - { - 0, // Invalid - blend_tiled_generic, // Mono - blend_tiled_generic, // MonoLsb - blend_tiled_generic, // Indexed8 - blend_tiled_generic, // RGB32 - blend_tiled_generic, // ARGB32 - blend_tiled_argb, // ARGB32_Premultiplied - blend_tiled_generic, // RGB16 - blend_tiled_generic, // ARGB8565_Premultiplied - blend_tiled_generic, // RGB666 - blend_tiled_generic, // ARGB6666_Premultiplied - blend_tiled_generic, // RGB555 - blend_tiled_generic, // ARGB8555_Premultiplied - blend_tiled_generic, // RGB888 - blend_tiled_generic, // RGB444 - blend_tiled_generic // ARGB4444_Premultiplied - }, - // Transformed - { - 0, // Invalid - blend_src_generic, // Mono - blend_src_generic, // MonoLsb - blend_src_generic, // Indexed8 - blend_src_generic, // RGB32 - blend_src_generic, // ARGB32 - blend_transformed_argb, // ARGB32_Premultiplied - blend_src_generic, // RGB16 - blend_src_generic, // ARGB8565_Premultiplied - blend_src_generic, // RGB666 - blend_src_generic, // ARGB6666_Premultiplied - blend_src_generic, // RGB555 - blend_src_generic, // ARGB8555_Premultiplied - blend_src_generic, // RGB888 - blend_src_generic, // RGB444 - blend_src_generic, // ARGB4444_Premultiplied - }, - // TransformedTiled - { - 0, - blend_src_generic, // Mono - blend_src_generic, // MonoLsb - blend_src_generic, // Indexed8 - blend_src_generic, // RGB32 - blend_src_generic, // ARGB32 - blend_transformed_tiled_argb, // ARGB32_Premultiplied - blend_src_generic, // RGB16 - blend_src_generic, // ARGB8565_Premultiplied - blend_src_generic, // RGB666 - blend_src_generic, // ARGB6666_Premultiplied - blend_src_generic, // RGB555 - blend_src_generic, // ARGB8555_Premultiplied - blend_src_generic, // RGB888 - blend_src_generic, // RGB444 - blend_src_generic // ARGB4444_Premultiplied - }, - // Bilinear - { - 0, - blend_src_generic, // Mono - blend_src_generic, // MonoLsb - blend_src_generic, // Indexed8 - blend_src_generic, // RGB32 - blend_src_generic, // ARGB32 - blend_src_generic, // ARGB32_Premultiplied - blend_src_generic, // RGB16 - blend_src_generic, // ARGB8565_Premultiplied - blend_src_generic, // RGB666 - blend_src_generic, // ARGB6666_Premultiplied - blend_src_generic, // RGB555 - blend_src_generic, // ARGB8555_Premultiplied - blend_src_generic, // RGB888 - blend_src_generic, // RGB444 - blend_src_generic // ARGB4444_Premultiplied - }, - // BilinearTiled - { - 0, - blend_src_generic, // Mono - blend_src_generic, // MonoLsb - blend_src_generic, // Indexed8 - blend_src_generic, // RGB32 - blend_src_generic, // ARGB32 - blend_src_generic, // ARGB32_Premultiplied - blend_src_generic, // RGB16 - blend_src_generic, // ARGB8565_Premultiplied - blend_src_generic, // RGB666 - blend_src_generic, // ARGB6666_Premultiplied - blend_src_generic, // RGB555 - blend_src_generic, // ARGB8555_Premultiplied - blend_src_generic, // RGB888 - blend_src_generic, // RGB444 - blend_src_generic // ARGB4444_Premultiplied - } -}; -#endif // QT_NO_RASTERCALLBACKS - void qBlendTexture(int count, const QSpan *spans, void *userData) { QSpanData *data = reinterpret_cast(userData); @@ -6832,15 +6337,6 @@ void qBlendTexture(int count, const QSpan *spans, void *userData) proc(count, spans, userData); } -#if defined (Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS) -void qBlendTextureCallback(int count, const QSpan *spans, void *userData) -{ - QSpanData *data = reinterpret_cast(userData); - ProcessSpans proc = processTextureSpansCallback[getBlendType(data)][data->rasterBuffer->format]; - proc(count, spans, userData); -} -#endif // QT_NO_RASTERCALLBACKS - template inline void qt_bitmapblit_template(QRasterBuffer *rasterBuffer, int x, int y, quint32 color, @@ -7490,106 +6986,6 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = } }; -#if defined (Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS) -DrawHelper qDrawHelperCallback[QImage::NImageFormats] = -{ - // Format_Invalid, - { 0, 0, 0, 0, 0, 0 }, - // Format_Mono, - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_MonoLSB, - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_Indexed8, - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_RGB32, - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_ARGB32, - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_ARGB32_Premultiplied - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_RGB16 - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_ARGB8565_Premultiplied - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_RGB666 - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_ARGB6666_Premultiplied - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_RGB555 - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_ARGB8555_Premultiplied - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_RGB888 - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_RGB444 - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - }, - // Format_ARGB4444_Premultiplied - { - blend_color_generic_callback, - blend_src_generic, - 0, 0, 0, 0 - } -}; -#endif - - - #if defined(Q_CC_MSVC) && !defined(_MIPS_) template inline void qt_memfill_template(DST *dest, SRC color, int count) @@ -7889,64 +7285,4 @@ static void qt_memfill16_setup(quint16 *dest, quint16 value, int count) qt_memfill16(dest, value, count); } -#ifdef QT_QWS_DEPTH_GENERIC - -int qrgb::bpp = 0; -int qrgb::len_red = 0; -int qrgb::len_green = 0; -int qrgb::len_blue = 0; -int qrgb::len_alpha = 0; -int qrgb::off_red = 0; -int qrgb::off_green = 0; -int qrgb::off_blue = 0; -int qrgb::off_alpha = 0; - -template -Q_STATIC_TEMPLATE_FUNCTION inline void qt_rectconvert_rgb(qrgb *dest, const SRC *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - quint8 *dest8 = reinterpret_cast(dest) - + y * dstStride + x * qrgb::bpp; - - srcStride = srcStride / sizeof(SRC) - width; - dstStride -= (width * qrgb::bpp); - - for (int j = 0; j < height; ++j) { - for (int i = 0; i < width; ++i) { - const quint32 v = qt_convertToRgb(*src++); -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - for (int j = qrgb::bpp - 1; j >= 0; --j) - *dest8++ = (v >> (8 * j)) & 0xff; -#else - for (int j = 0; j < qrgb::bpp; ++j) - *dest8++ = (v >> (8 * j)) & 0xff; -#endif - } - - dest8 += dstStride; - src += srcStride; - } -} - -template <> -void qt_rectconvert(qrgb *dest, const quint32 *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - qt_rectconvert_rgb(dest, src, x, y, width, height, - dstStride, srcStride); -} - -template <> -void qt_rectconvert(qrgb *dest, const quint16 *src, - int x, int y, int width, int height, - int dstStride, int srcStride) -{ - qt_rectconvert_rgb(dest, src, x, y, width, height, - dstStride, srcStride); -} - -#endif // QT_QWS_DEPTH_GENERIC - QT_END_NAMESPACE diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 0766f2e96b9..3d83ba8587a 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -65,10 +65,6 @@ #include #include -#ifdef Q_WS_QWS -#include "QtGui/qscreen_qws.h" -#endif - QT_BEGIN_NAMESPACE #if defined(Q_CC_MSVC) && _MSCVER <= 1300 && !defined(Q_CC_INTEL) @@ -171,10 +167,6 @@ extern MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3]; extern DrawHelper qDrawHelper[QImage::NImageFormats]; void qBlendTexture(int count, const QSpan *spans, void *userData); -#if defined(Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS) -extern DrawHelper qDrawHelperCallback[QImage::NImageFormats]; -void qBlendTextureCallback(int count, const QSpan *spans, void *userData); -#endif typedef void (QT_FASTCALL *CompositionFunction)(uint *dest, const uint *src, int length, uint const_alpha); typedef void (QT_FASTCALL *CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha); @@ -271,13 +263,8 @@ struct QGradientData QConicalGradientData conical; }; -#ifdef Q_WS_QWS -#define GRADIENT_STOPTABLE_SIZE 256 -#define GRADIENT_STOPTABLE_SIZE_SHIFT 8 -#else #define GRADIENT_STOPTABLE_SIZE 1024 #define GRADIENT_STOPTABLE_SIZE_SHIFT 10 -#endif uint* colorTable; //[GRADIENT_STOPTABLE_SIZE]; @@ -314,9 +301,6 @@ struct QSpanData ~QSpanData() { delete tempImage; } QRasterBuffer *rasterBuffer; -#ifdef Q_WS_QWS - QRasterPaintEngine *rasterEngine; -#endif ProcessSpans blend; ProcessSpans unclipped_blend; BitmapBlitFunc bitmapBlit; @@ -1492,37 +1476,6 @@ inline quint32 qt_colorConvert(qrgb888 color, quint32 dummy) return quint32(color); } -#ifdef QT_QWS_DEPTH_8 -template <> -inline quint8 qt_colorConvert(quint32 color, quint8 dummy) -{ - Q_UNUSED(dummy); - - uchar r = ((qRed(color) & 0xf8) + 0x19) / 0x33; - uchar g = ((qGreen(color) &0xf8) + 0x19) / 0x33; - uchar b = ((qBlue(color) &0xf8) + 0x19) / 0x33; - - return r*6*6 + g*6 + b; -} - -template <> -inline quint8 qt_colorConvert(quint16 color, quint8 dummy) -{ - Q_UNUSED(dummy); - - uchar r = (color & 0xf800) >> (11-3); - uchar g = (color & 0x07c0) >> (6-3); - uchar b = (color & 0x001f) << 3; - - uchar tr = (r + 0x19) / 0x33; - uchar tg = (g + 0x19) / 0x33; - uchar tb = (b + 0x19) / 0x33; - - return tr*6*6 + tg*6 + tb; -} - -#endif // QT_QWS_DEPTH_8 - // hw: endianess?? class quint24 { @@ -1759,84 +1712,6 @@ qrgb444 qrgb444::byte_mul(quint8 a) const return result; } -#ifdef QT_QWS_DEPTH_GENERIC - -struct qrgb -{ -public: - static int bpp; - static int len_red; - static int len_green; - static int len_blue; - static int len_alpha; - static int off_red; - static int off_green; - static int off_blue; - static int off_alpha; -} Q_PACKED; - -template -Q_STATIC_TEMPLATE_FUNCTION inline quint32 qt_convertToRgb(SRC color); - -template <> -inline quint32 qt_convertToRgb(quint32 color) -{ - const int r = qRed(color) >> (8 - qrgb::len_red); - const int g = qGreen(color) >> (8 - qrgb::len_green); - const int b = qBlue(color) >> (8 - qrgb::len_blue); - const int a = qAlpha(color) >> (8 - qrgb::len_alpha); - const quint32 v = (r << qrgb::off_red) - | (g << qrgb::off_green) - | (b << qrgb::off_blue) - | (a << qrgb::off_alpha); - - return v; -} - -template <> -inline quint32 qt_convertToRgb(quint16 color) -{ - return qt_convertToRgb(qt_colorConvert(color, 0)); -} - -class qrgb_generic16 -{ -public: - inline qrgb_generic16(quint32 color) - { - const int r = qRed(color) >> (8 - qrgb::len_red); - const int g = qGreen(color) >> (8 - qrgb::len_green); - const int b = qBlue(color) >> (8 - qrgb::len_blue); - const int a = qAlpha(color) >> (8 - qrgb::len_alpha); - data = (r << qrgb::off_red) - | (g << qrgb::off_green) - | (b << qrgb::off_blue) - | (a << qrgb::off_alpha); - } - - inline operator quint16 () { return data; } - inline quint32 operator<<(int shift) const { return data << shift; } - -private: - quint16 data; -} Q_PACKED; - -template <> -inline qrgb_generic16 qt_colorConvert(quint32 color, qrgb_generic16 dummy) -{ - Q_UNUSED(dummy); - return qrgb_generic16(color); -} - -template <> -inline qrgb_generic16 qt_colorConvert(quint16 color, qrgb_generic16 dummy) -{ - Q_UNUSED(dummy); - return qrgb_generic16(qt_colorConvert(color, 0)); -} - -#endif // QT_QWS_DEPTH_GENERIC - template void qt_memfill(T *dest, T value, int count); @@ -2044,16 +1919,6 @@ QT_RECTCONVERT_TRIVIAL_IMPL(qargb4444) QT_RECTCONVERT_TRIVIAL_IMPL(qrgb444) #undef QT_RECTCONVERT_TRIVIAL_IMPL -#ifdef QT_QWS_DEPTH_GENERIC -template <> void qt_rectconvert(qrgb *dest, const quint32 *src, - int x, int y, int width, int height, - int dstStride, int srcStride); - -template <> void qt_rectconvert(qrgb *dest, const quint16 *src, - int x, int y, int width, int height, - int dstStride, int srcStride); -#endif // QT_QWS_DEPTH_GENERIC - #define QT_MEMFILL_UINT(dest, length, color) \ qt_memfill(dest, color, length); @@ -2116,16 +1981,6 @@ inline ushort qConvertRgb32To16(uint c) | (((c) >> 8) & 0xf800); } -#if defined(Q_WS_QWS) || (QT_VERSION >= 0x040400) -inline quint32 qConvertRgb32To16x2(quint64 c) -{ - c = (((c) >> 3) & Q_UINT64_C(0x001f0000001f)) - | (((c) >> 5) & Q_UINT64_C(0x07e0000007e0)) - | (((c) >> 8) & Q_UINT64_C(0xf8000000f800)); - return c | (c >> 16); -} -#endif - inline QRgb qConvertRgb16To32(uint c) { return 0xff000000 diff --git a/src/gui/painting/qgraphicssystem_mac.cpp b/src/gui/painting/qgraphicssystem_mac.cpp deleted file mode 100644 index bbff88b6b59..00000000000 --- a/src/gui/painting/qgraphicssystem_mac.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_mac_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -QPixmapData *QCoreGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QMacPixmapData(type); -} - -QWindowSurface *QCoreGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - return new QMacWindowSurface(widget); -} - -QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_mac_p.h b/src/gui/painting/qgraphicssystem_mac_p.h deleted file mode 100644 index 8e15d8b2364..00000000000 --- a/src/gui/painting/qgraphicssystem_mac_p.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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 QCoreGraphicsSystem : public QGraphicsSystem -{ -public: - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/gui/painting/qgraphicssystem_qws.cpp b/src/gui/painting/qgraphicssystem_qws.cpp deleted file mode 100644 index 2c2b776f5dd..00000000000 --- a/src/gui/painting/qgraphicssystem_qws.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_qws_p.h" -#include -#include - -QT_BEGIN_NAMESPACE - -QPixmapData *QWSGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - if (screen->pixmapDataFactory()) - return screen->pixmapDataFactory()->create(type); //### For 4.4 compatibility - else - return new QRasterPixmapData(type); -} - -QWindowSurface *QWSGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - return screen->createSurface(widget); -} - -QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_qws_p.h b/src/gui/painting/qgraphicssystem_qws_p.h deleted file mode 100644 index b54aad90f96..00000000000 --- a/src/gui/painting/qgraphicssystem_qws_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_QWS_P_H -#define QGRAPHICSSYSTEM_QWS_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 "qgraphicssystem_p.h" - -QT_BEGIN_NAMESPACE - -class Q_GUI_EXPORT QWSGraphicsSystem : public QGraphicsSystem -{ -public: - - QWSGraphicsSystem() - : screen(QScreen::instance()) {} - - QWSGraphicsSystem(QScreen* s) - : screen(s) {} - - virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - -private: - QScreen* screen; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/gui/painting/qgraphicssystem_raster.cpp b/src/gui/painting/qgraphicssystem_raster.cpp deleted file mode 100644 index 0edbe9f5a3a..00000000000 --- a/src/gui/painting/qgraphicssystem_raster.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_raster_p.h" - -#ifdef Q_OS_SYMBIAN -#include "private/qpixmap_s60_p.h" -#include "private/qwindowsurface_s60_p.h" -#else -#include "private/qpixmap_raster_p.h" -#include "private/qwindowsurface_raster_p.h" -#endif - -QT_BEGIN_NAMESPACE - -QPixmapData *QRasterGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ -#ifdef Q_OS_SYMBIAN - return new QS60PixmapData(type); -#else - return new QRasterPixmapData(type); -#endif -} - -QWindowSurface *QRasterGraphicsSystem::createWindowSurface(QWidget *widget) const -{ -#ifdef Q_OS_SYMBIAN - return new QS60WindowSurface(widget); -#else - return new QRasterWindowSurface(widget); -#endif -} - -QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_raster_p.h b/src/gui/painting/qgraphicssystem_raster_p.h deleted file mode 100644 index e9737ce78fa..00000000000 --- a/src/gui/painting/qgraphicssystem_raster_p.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_RASTER_P_H -#define QGRAPHICSSYSTEM_RASTER_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 "qgraphicssystem_p.h" - -QT_BEGIN_NAMESPACE - -class QRasterGraphicsSystem : public QGraphicsSystem -{ -public: - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp deleted file mode 100644 index 19b29a13b31..00000000000 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -static int qt_pixmap_serial = 0; - -#define READBACK(f) \ - f \ - readBackInfo(); - - -class QDeferredGraphicsSystemChange : public QObject -{ - Q_OBJECT - -public: - QDeferredGraphicsSystemChange(QRuntimeGraphicsSystem *gs, const QString& graphicsSystemName) - : m_graphicsSystem(gs), m_graphicsSystemName(graphicsSystemName) - { - } - - void launch() - { - QTimer::singleShot(0, this, SLOT(doChange())); - } - -private slots: - - void doChange() - { - m_graphicsSystem->setGraphicsSystem(m_graphicsSystemName); - deleteLater(); - } - -private: - - QRuntimeGraphicsSystem *m_graphicsSystem; - QString m_graphicsSystemName; -}; - -QRuntimePixmapData::QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelType type) - : QPixmapData(type, RuntimeClass), m_graphicsSystem(gs) -{ - setSerialNumber(++qt_pixmap_serial); -} - -QRuntimePixmapData::~QRuntimePixmapData() -{ - if (QApplicationPrivate::graphics_system) - m_graphicsSystem->removePixmapData(this); - delete m_data; -} - -void QRuntimePixmapData::readBackInfo() -{ - w = m_data->width(); - h = m_data->height(); - d = m_data->depth(); - is_null = m_data->isNull(); -} - - -QPixmapData *QRuntimePixmapData::createCompatiblePixmapData() const -{ - QRuntimePixmapData *rtData = new QRuntimePixmapData(m_graphicsSystem, pixelType()); - rtData->m_data = m_data->createCompatiblePixmapData(); - return rtData; -} - - -void QRuntimePixmapData::resize(int width, int height) -{ - READBACK( - m_data->resize(width, height); - ) -} - - -void QRuntimePixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags flags) -{ - READBACK( - m_data->fromImage(image, flags); - ) -} - - -bool QRuntimePixmapData::fromFile(const QString &filename, const char *format, - Qt::ImageConversionFlags flags) -{ - bool success(false); - READBACK( - success = m_data->fromFile(filename, format, flags); - ) - return success; -} - -bool QRuntimePixmapData::fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags) -{ - bool success(false); - READBACK( - success = m_data->fromData(buffer, len, format, flags); - ) - return success; -} - - -void QRuntimePixmapData::copy(const QPixmapData *data, const QRect &rect) -{ - if (data->runtimeData()) { - READBACK( - m_data->copy(data->runtimeData(), rect); - ) - } else { - READBACK( - m_data->copy(data, rect); - ) - } -} - -bool QRuntimePixmapData::scroll(int dx, int dy, const QRect &rect) -{ - return m_data->scroll(dx, dy, rect); -} - - -int QRuntimePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const -{ - return m_data->metric(metric); -} - -void QRuntimePixmapData::fill(const QColor &color) -{ - return m_data->fill(color); -} - -QBitmap QRuntimePixmapData::mask() const -{ - return m_data->mask(); -} - -void QRuntimePixmapData::setMask(const QBitmap &mask) -{ - READBACK( - m_data->setMask(mask); - ) -} - -bool QRuntimePixmapData::hasAlphaChannel() const -{ - return m_data->hasAlphaChannel(); -} - -QPixmap QRuntimePixmapData::transformed(const QTransform &matrix, - Qt::TransformationMode mode) const -{ - return m_data->transformed(matrix, mode); -} - -void QRuntimePixmapData::setAlphaChannel(const QPixmap &alphaChannel) -{ - READBACK( - m_data->setAlphaChannel(alphaChannel); - ) -} - -QPixmap QRuntimePixmapData::alphaChannel() const -{ - return m_data->alphaChannel(); -} - -QImage QRuntimePixmapData::toImage() const -{ - return m_data->toImage(); -} - -QPaintEngine* QRuntimePixmapData::paintEngine() const -{ - return m_data->paintEngine(); -} - -QImage* QRuntimePixmapData::buffer() -{ - return m_data->buffer(); -} - -#if defined(Q_OS_SYMBIAN) -void* QRuntimePixmapData::toNativeType(NativeType type) -{ - return m_data->toNativeType(type); -} - -void QRuntimePixmapData::fromNativeType(void *pixmap, NativeType type) -{ - m_data->fromNativeType(pixmap, type); - readBackInfo(); -} -#endif - -QPixmapData* QRuntimePixmapData::runtimeData() const -{ - return m_data; -} - -QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window) - : QWindowSurface(window), m_graphicsSystem(gs) -{ - -} - -QRuntimeWindowSurface::~QRuntimeWindowSurface() -{ - if (QApplicationPrivate::graphics_system) - m_graphicsSystem->removeWindowSurface(this); -} - -QPaintDevice *QRuntimeWindowSurface::paintDevice() -{ - return m_windowSurface->paintDevice(); -} - -void QRuntimeWindowSurface::flush(QWidget *widget, const QRegion ®ion, - const QPoint &offset) -{ - m_windowSurface->flush(widget, region, offset); - - int destroyPolicy = m_graphicsSystem->windowSurfaceDestroyPolicy(); - if(m_pendingWindowSurface && - destroyPolicy == QRuntimeGraphicsSystem::DestroyAfterFirstFlush) { -#ifdef QT_DEBUG - qDebug() << "QRuntimeWindowSurface::flush() - destroy pending window surface"; -#endif - m_pendingWindowSurface.reset(); - } -} - -void QRuntimeWindowSurface::setGeometry(const QRect &rect) -{ - QWindowSurface::setGeometry(rect); - m_windowSurface->setGeometry(rect); -} - -bool QRuntimeWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return m_windowSurface->scroll(area, dx, dy); -} - -void QRuntimeWindowSurface::beginPaint(const QRegion &rgn) -{ - m_windowSurface->beginPaint(rgn); -} - -void QRuntimeWindowSurface::endPaint(const QRegion &rgn) -{ - m_windowSurface->endPaint(rgn); -} - -QImage* QRuntimeWindowSurface::buffer(const QWidget *widget) -{ - return m_windowSurface->buffer(widget); -} - -QPixmap QRuntimeWindowSurface::grabWidget(const QWidget *widget, const QRect& rectangle) const -{ - return m_windowSurface->grabWidget(widget, rectangle); -} - -QPoint QRuntimeWindowSurface::offset(const QWidget *widget) const -{ - return m_windowSurface->offset(widget); -} - -QWindowSurface::WindowSurfaceFeatures QRuntimeWindowSurface::features() const -{ - return m_windowSurface->features(); -} - -QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() - : m_windowSurfaceDestroyPolicy(DestroyImmediately), - m_graphicsSystem(0) -{ - QApplicationPrivate::runtime_graphics_system = true; - -#ifdef QT_DEFAULT_RUNTIME_SYSTEM - m_graphicsSystemName = QLatin1String(QT_DEFAULT_RUNTIME_SYSTEM); - if (m_graphicsSystemName.isNull()) -#endif - m_graphicsSystemName = QLatin1String("raster"); - -#ifdef Q_OS_SYMBIAN - m_windowSurfaceDestroyPolicy = DestroyAfterFirstFlush; -#endif - - m_graphicsSystem = QGraphicsSystemFactory::create(m_graphicsSystemName); - - QApplicationPrivate::graphics_system_name = QLatin1String("runtime"); -} - - -QPixmapData *QRuntimeGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - Q_ASSERT(m_graphicsSystem); - QPixmapData *data = m_graphicsSystem->createPixmapData(type); - - QRuntimePixmapData *rtData = new QRuntimePixmapData(this, type); - rtData->m_data = data; - m_pixmapDatas << rtData; - - return rtData; -} - -QWindowSurface *QRuntimeGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - Q_ASSERT(m_graphicsSystem); - QRuntimeWindowSurface *rtSurface = new QRuntimeWindowSurface(this, widget); - rtSurface->m_windowSurface.reset(m_graphicsSystem->createWindowSurface(widget)); - widget->setWindowSurface(rtSurface); - m_windowSurfaces << rtSurface; - return rtSurface; -} - -void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) -{ - if (m_graphicsSystemName == name) - return; -#ifdef QT_DEBUG - qDebug() << "QRuntimeGraphicsSystem::setGraphicsSystem( " << name << " )"; -#endif - QGraphicsSystem *oldSystem = m_graphicsSystem; - m_graphicsSystem = QGraphicsSystemFactory::create(name); - m_graphicsSystemName = name; - - Q_ASSERT(m_graphicsSystem); - - m_pendingGraphicsSystemName = QString(); - - for (int i = 0; i < m_pixmapDatas.size(); ++i) { - QRuntimePixmapData *proxy = m_pixmapDatas.at(i); - QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data); - newData->fromImage(proxy->m_data->toImage(), Qt::NoOpaqueDetection); - delete proxy->m_data; - proxy->m_data = newData; - proxy->readBackInfo(); - } - - for (int i = 0; i < m_windowSurfaces.size(); ++i) { - QRuntimeWindowSurface *proxy = m_windowSurfaces.at(i); - QWidget *widget = proxy->m_windowSurface->window(); - - if(m_windowSurfaceDestroyPolicy == DestroyAfterFirstFlush) - proxy->m_pendingWindowSurface.reset(proxy->m_windowSurface.take()); - - QWindowSurface *newWindowSurface = m_graphicsSystem->createWindowSurface(widget); - newWindowSurface->setGeometry(proxy->geometry()); - - proxy->m_windowSurface.reset(newWindowSurface); - qt_widget_private(widget)->invalidateBuffer(widget->rect()); - } - - delete oldSystem; -} - -void QRuntimeGraphicsSystem::removePixmapData(QRuntimePixmapData *pixmapData) const -{ - int index = m_pixmapDatas.lastIndexOf(pixmapData); - m_pixmapDatas.removeAt(index); -} - -void QRuntimeGraphicsSystem::removeWindowSurface(QRuntimeWindowSurface *windowSurface) const -{ - int index = m_windowSurfaces.lastIndexOf(windowSurface); - m_windowSurfaces.removeAt(index); -} - -#include "qgraphicssystem_runtime.moc" - -QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h deleted file mode 100644 index a3828d44c03..00000000000 --- a/src/gui/painting/qgraphicssystem_runtime_p.h +++ /dev/null @@ -1,187 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_RUNTIME_P_H -#define QGRAPHICSSYSTEM_RUNTIME_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 "qgraphicssystem_p.h" - -#include - -QT_BEGIN_NAMESPACE - -class QRuntimeGraphicsSystem; - -class Q_GUI_EXPORT QRuntimePixmapData : public QPixmapData { -public: - QRuntimePixmapData(const QRuntimeGraphicsSystem *gs, PixelType type); - ~QRuntimePixmapData(); - - virtual QPixmapData *createCompatiblePixmapData() const; - virtual void resize(int width, int height); - virtual void fromImage(const QImage &image, - Qt::ImageConversionFlags flags); - - virtual bool fromFile(const QString &filename, const char *format, - Qt::ImageConversionFlags flags); - virtual bool fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags); - - virtual void copy(const QPixmapData *data, const QRect &rect); - virtual bool scroll(int dx, int dy, const QRect &rect); - - virtual int metric(QPaintDevice::PaintDeviceMetric metric) const; - virtual void fill(const QColor &color); - virtual QBitmap mask() const; - virtual void setMask(const QBitmap &mask); - virtual bool hasAlphaChannel() const; - virtual QPixmap transformed(const QTransform &matrix, - Qt::TransformationMode mode) const; - virtual void setAlphaChannel(const QPixmap &alphaChannel); - virtual QPixmap alphaChannel() const; - virtual QImage toImage() const; - virtual QPaintEngine *paintEngine() const; - - virtual QImage *buffer(); - - void readBackInfo(); - - QPixmapData *m_data; - -#if defined(Q_OS_SYMBIAN) - void* toNativeType(NativeType type); - void fromNativeType(void* pixmap, NativeType type); -#endif - - virtual QPixmapData *runtimeData() const; - -private: - const QRuntimeGraphicsSystem *m_graphicsSystem; - -}; - -class QRuntimeWindowSurface : public QWindowSurface { -public: - QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window); - ~QRuntimeWindowSurface(); - - virtual QPaintDevice *paintDevice(); - virtual void flush(QWidget *widget, const QRegion ®ion, - const QPoint &offset); - virtual void setGeometry(const QRect &rect); - - virtual bool scroll(const QRegion &area, int dx, int dy); - - virtual void beginPaint(const QRegion &); - virtual void endPaint(const QRegion &); - - virtual QImage* buffer(const QWidget *widget); - virtual QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const; - - virtual QPoint offset(const QWidget *widget) const; - - virtual WindowSurfaceFeatures features() const; - - QScopedPointer m_windowSurface; - QScopedPointer m_pendingWindowSurface; - -private: - const QRuntimeGraphicsSystem *m_graphicsSystem; -}; - -class QRuntimeGraphicsSystem : public QGraphicsSystem -{ -public: - - enum WindowSurfaceDestroyPolicy - { - DestroyImmediately, - DestroyAfterFirstFlush - }; - -public: - QRuntimeGraphicsSystem(); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - - void removePixmapData(QRuntimePixmapData *pixmapData) const; - void removeWindowSurface(QRuntimeWindowSurface *windowSurface) const; - - void setGraphicsSystem(const QString &name); - QString graphicsSystemName() const { return m_graphicsSystemName; } - - void setWindowSurfaceDestroyPolicy(WindowSurfaceDestroyPolicy policy) - { - m_windowSurfaceDestroyPolicy = policy; - } - - int windowSurfaceDestroyPolicy() const { return m_windowSurfaceDestroyPolicy; } - - -private: - int m_windowSurfaceDestroyPolicy; - QGraphicsSystem *m_graphicsSystem; - mutable QList m_pixmapDatas; - mutable QList m_windowSurfaces; - QString m_graphicsSystemName; - - QString m_pendingGraphicsSystemName; - - friend class QRuntimePixmapData; - friend class QRuntimeWindowSurface; - friend class QMeeGoGraphicsSystem; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/gui/painting/qgraphicssystemfactory.cpp b/src/gui/painting/qgraphicssystemfactory.cpp deleted file mode 100644 index 4309140cc46..00000000000 --- a/src/gui/painting/qgraphicssystemfactory.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystemfactory_p.h" -#include "qgraphicssystemplugin_p.h" -#include "private/qfactoryloader_p.h" -#include "qmutex.h" - -#include "qapplication.h" -#include -#include "qgraphicssystem_raster_p.h" -#include "qgraphicssystem_runtime_p.h" -#include "qdebug.h" - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_LIBRARY -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QGraphicsSystemFactoryInterface_iid, QLatin1String("/graphicssystems"), Qt::CaseInsensitive)) -#endif - -QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key) -{ - QGraphicsSystem *ret = 0; - QString system = key.toLower(); - -#if defined (QT_GRAPHICSSYSTEM_OPENGL) - if (system.isEmpty()) { - system = QLatin1String("opengl"); - } -#elif defined (QT_GRAPHICSSYSTEM_OPENVG) - if (system.isEmpty()) { - system = QLatin1String("openvg"); - } -#elif defined (QT_GRAPHICSSYSTEM_RUNTIME) - if (system.isEmpty()) { - system = QLatin1String("runtime"); - } -#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) || defined(Q_WS_X11) || (defined (Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) - if (system.isEmpty()) { - system = QLatin1String("raster"); - } -#endif - - QApplicationPrivate::graphics_system_name = system; - if (system == QLatin1String("raster")) - return new QRasterGraphicsSystem; - else if (system == QLatin1String("runtime")) - return new QRuntimeGraphicsSystem; - else if (system.isEmpty() || system == QLatin1String("native")) - return 0; - -#ifndef QT_NO_LIBRARY - if (!ret) { - if (QGraphicsSystemFactoryInterface *factory = qobject_cast(loader()->instance(system))) - ret = factory->create(system); - } -#endif - - if (!ret) - qWarning() << "Unable to load graphicssystem" << system; - - return ret; -} - -/*! - Returns the list of valid keys, i.e. the keys this factory can - create styles for. - - \sa create() -*/ -QStringList QGraphicsSystemFactory::keys() -{ -#ifndef QT_NO_LIBRARY - QStringList list = loader()->keys(); -#else - QStringList list; -#endif - if (!list.contains(QLatin1String("Raster"))) - list << QLatin1String("raster"); - return list; -} - -QT_END_NAMESPACE - diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp index 7bb2324a2f3..767706a5bc5 100644 --- a/src/gui/painting/qmatrix.cpp +++ b/src/gui/painting/qmatrix.cpp @@ -730,42 +730,6 @@ QPainterPath QMatrix::map(const QPainterPath &path) const return copy; } -/*! - \fn QRegion QMatrix::mapToRegion(const QRect &rectangle) const - - Returns the transformed rectangle \a rectangle as a QRegion - object. A rectangle which has been rotated or sheared may result - in a non-rectangular region being returned. - - Use the mapToPolygon() or map() function instead. -*/ -#ifdef QT3_SUPPORT -QRegion QMatrix::mapToRegion(const QRect &rect) const -{ - QRegion result; - if (isIdentity()) { - result = rect; - } else if (m12() == 0.0F && m21() == 0.0F) { - int x = qRound(m11()*rect.x() + dx()); - int y = qRound(m22()*rect.y() + dy()); - int w = qRound(m11()*rect.width()); - int h = qRound(m22()*rect.height()); - if (w < 0) { - w = -w; - x -= w - 1; - } - if (h < 0) { - h = -h; - y -= h - 1; - } - result = QRect(x, y, w, h); - } else { - result = QRegion(mapToPolygon(rect)); - } - return result; - -} -#endif /*! \fn QPolygon QMatrix::mapToPolygon(const QRect &rectangle) const diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h index ff807043878..830a0a734f3 100644 --- a/src/gui/painting/qmatrix.h +++ b/src/gui/painting/qmatrix.h @@ -118,12 +118,6 @@ public: operator QVariant() const; -#ifdef QT3_SUPPORT - inline QT3_SUPPORT QMatrix invert(bool *invertible=0) const { return inverted(invertible); } - inline QT3_SUPPORT QRect map(const QRect &r) const { return mapRect(r); } - QT3_SUPPORT QRegion mapToRegion(const QRect &r) const; -#endif - private: inline QMatrix(bool) : _m11(1.) @@ -193,12 +187,6 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix &); Q_GUI_EXPORT QDebug operator<<(QDebug, const QMatrix &); #endif -#ifdef QT3_SUPPORT -QT_BEGIN_INCLUDE_NAMESPACE -#include -QT_END_INCLUDE_NAMESPACE -#endif - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp index 0ab6674913e..857621df6e7 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -512,34 +512,34 @@ inline void qt_memrotate90_template(const quint32 *src, } #define QT_IMPL_MEMROTATE(srctype, desttype) \ -void qt_memrotate90(const srctype *src, int w, int h, int sstride, \ +Q_GUI_EXPORT void qt_memrotate90(const srctype *src, int w, int h, int sstride, \ desttype *dest, int dstride) \ { \ qt_memrotate90_template(src, w, h, sstride, dest, dstride); \ } \ -void qt_memrotate180(const srctype *src, int w, int h, int sstride, \ +Q_GUI_EXPORT void qt_memrotate180(const srctype *src, int w, int h, int sstride, \ desttype *dest, int dstride) \ { \ qt_memrotate180_template(src, w, h, sstride, dest, dstride); \ } \ -void qt_memrotate270(const srctype *src, int w, int h, int sstride, \ +Q_GUI_EXPORT void qt_memrotate270(const srctype *src, int w, int h, int sstride, \ desttype *dest, int dstride) \ { \ qt_memrotate270_template(src, w, h, sstride, dest, dstride); \ } #define QT_IMPL_SIMPLE_MEMROTATE(srctype, desttype) \ -void qt_memrotate90(const srctype *src, int w, int h, int sstride, \ +Q_GUI_EXPORT void qt_memrotate90(const srctype *src, int w, int h, int sstride, \ desttype *dest, int dstride) \ { \ qt_memrotate90_tiled_unpacked(src, w, h, sstride, dest, dstride); \ } \ -void qt_memrotate180(const srctype *src, int w, int h, int sstride, \ +Q_GUI_EXPORT void qt_memrotate180(const srctype *src, int w, int h, int sstride, \ desttype *dest, int dstride) \ { \ qt_memrotate180_template(src, w, h, sstride, dest, dstride); \ } \ -void qt_memrotate270(const srctype *src, int w, int h, int sstride, \ +Q_GUI_EXPORT void qt_memrotate270(const srctype *src, int w, int h, int sstride, \ desttype *dest, int dstride) \ { \ qt_memrotate270_tiled_unpacked(src, w, h, sstride, dest, dstride); \ diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h index 019576a4465..84b0b018466 100644 --- a/src/gui/painting/qmemrotate_p.h +++ b/src/gui/painting/qmemrotate_p.h @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE #endif #endif -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) && defined(Q_OS_WIN) #define Q_GUI_QWS_EXPORT Q_GUI_EXPORT #else #define Q_GUI_QWS_EXPORT diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp new file mode 100644 index 00000000000..e5b2c0716e9 --- /dev/null +++ b/src/gui/painting/qpagedpaintdevice.cpp @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +class QPagedPaintDevicePrivate +{ +public: + QPagedPaintDevice::PageSize pageSize; + QSizeF pageSizeMM; + QPagedPaintDevice::Margins margins; +}; + +static const struct { + float width; + float height; +} pageSizes[] = { + {210, 297}, // A4 + {176, 250}, // B5 + {215.9f, 279.4f}, // Letter + {215.9f, 355.6f}, // Legal + {190.5f, 254}, // Executive + {841, 1189}, // A0 + {594, 841}, // A1 + {420, 594}, // A2 + {297, 420}, // A3 + {148, 210}, // A5 + {105, 148}, // A6 + {74, 105}, // A7 + {52, 74}, // A8 + {37, 52}, // A8 + {1000, 1414}, // B0 + {707, 1000}, // B1 + {31, 44}, // B10 + {500, 707}, // B2 + {353, 500}, // B3 + {250, 353}, // B4 + {125, 176}, // B6 + {88, 125}, // B7 + {62, 88}, // B8 + {33, 62}, // B9 + {163, 229}, // C5E + {105, 241}, // US Common + {110, 220}, // DLE + {210, 330}, // Folio + {431.8f, 279.4f}, // Ledger + {279.4f, 431.8f} // Tabloid +}; + +/*! + \class QPagedPaintDevice + + \brief The QPagedPaintDevice class is a represents a paintdevice that supports + multiple pages. + + \ingroup painting + + Paged paint devices are used to generate output for printing or for formats like PDF. + QPdfWriter and QPrinter inherit from it. + */ + +/*! + Constructs a new paged paint device. + */ +QPagedPaintDevice::QPagedPaintDevice() + : d(new QPagedPaintDevicePrivate) +{ +} + +/*! + Destroys the object. + */ +QPagedPaintDevice::~QPagedPaintDevice() +{ + delete d; +} + +/*! + \enum QPagedPaintDevice::PageSize + + This enum type specifies the page size of the paint device. + + \value A0 841 x 1189 mm + \value A1 594 x 841 mm + \value A2 420 x 594 mm + \value A3 297 x 420 mm + \value A4 210 x 297 mm, 8.26 x 11.69 inches + \value A5 148 x 210 mm + \value A6 105 x 148 mm + \value A7 74 x 105 mm + \value A8 52 x 74 mm + \value A9 37 x 52 mm + \value B0 1000 x 1414 mm + \value B1 707 x 1000 mm + \value B2 500 x 707 mm + \value B3 353 x 500 mm + \value B4 250 x 353 mm + \value B5 176 x 250 mm, 6.93 x 9.84 inches + \value B6 125 x 176 mm + \value B7 88 x 125 mm + \value B8 62 x 88 mm + \value B9 33 x 62 mm + \value B10 31 x 44 mm + \value C5E 163 x 229 mm + \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope + \value DLE 110 x 220 mm + \value Executive 7.5 x 10 inches, 190.5 x 254 mm + \value Folio 210 x 330 mm + \value Ledger 431.8 x 279.4 mm + \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm + \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm + \value Tabloid 279.4 x 431.8 mm + \value Custom Unknown, or a user defined size. + + \omitvalue NPageSize + + The page size can also be specified in millimeters using setPageSizeMM(). In this case the + page size enum is set to Custom. +*/ + +/*! + \fn bool QPagedPaintDevice::newPage() + + Starts a new page. +*/ + + +/*! + Sets the size of the a page to \a size. + + \sa setPageSizeMM + */ +void QPagedPaintDevice::setPageSize(PageSize size) +{ + if (size >= Custom) + return; + d->pageSize = size; + d->pageSizeMM = QSizeF(pageSizes[A4].width, pageSizes[A4].height); +} + +/*! + Returns the currently used page size. + */ +QPagedPaintDevice::PageSize QPagedPaintDevice::pageSize() const +{ + return d->pageSize; +} + +/*! + Sets the page size to \a size. \a size is specified in millimeters. + */ +void QPagedPaintDevice::setPageSizeMM(const QSizeF &size) +{ + d->pageSize = Custom; + d->pageSizeMM = size; +} + +/*! + Returns the page size in millimeters. + */ +QSizeF QPagedPaintDevice::pageSizeMM() const +{ + return d->pageSizeMM; +} + +/*! + Sets the margins to be used to \a margins. + + Margins are specified in millimeters. + + The margins are purely a hint to the drawing method. They don't affect the + coordinate system or clipping. + + \sa margins + */ +void QPagedPaintDevice::setMargins(const Margins &margins) +{ + d->margins = margins; +} + +/*! + returns the current margins of the paint device. The default is 0. + + /sa setMargins + */ +QPagedPaintDevice::Margins QPagedPaintDevice::margins() const +{ + return d->margins; +} diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h new file mode 100644 index 00000000000..f3a133a8d9d --- /dev/null +++ b/src/gui/painting/qpagedpaintdevice.h @@ -0,0 +1,53 @@ + +#ifndef QPAGEDPAINTDEVICE_H +#define QPAGEDPAINTDEVICE_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPagedPaintDevicePrivate; + +class Q_GUI_EXPORT QPagedPaintDevice : public QPaintDevice +{ +public: + QPagedPaintDevice(); + ~QPagedPaintDevice(); + + virtual bool newPage() = 0; + + enum PageSize { A4, B5, Letter, Legal, Executive, + A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, + B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, + DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom }; + + virtual void setPageSize(PageSize size); + PageSize pageSize() const; + + virtual void setPageSizeMM(const QSizeF &size); + QSizeF pageSizeMM() const; + + struct Margins { + qreal left; + qreal right; + qreal top; + qreal bottom; + }; + + virtual void setMargins(const Margins &margins); + Margins margins() const; + +protected: + friend class QPagedPaintDevicePrivate; + QPagedPaintDevicePrivate *d; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qpagedpaintdevice_p.h similarity index 70% rename from src/gui/painting/qgraphicssystem_p.h rename to src/gui/painting/qpagedpaintdevice_p.h index 53c05515fa1..55f78d54c57 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qpagedpaintdevice_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGRAPHICSSYSTEM_P_H -#define QGRAPHICSSYSTEM_P_H +#ifndef QPAGEDPAINTDEVICE_P_H +#define QPAGEDPAINTDEVICE_P_H // // W A R N I N G @@ -53,31 +53,35 @@ // We mean it. // -#include "private/qpixmapdata_p.h" -#include "private/qwindowsurface_p.h" -#include "private/qpaintengine_blitter_p.h" - -#include +#include QT_BEGIN_NAMESPACE -class QPixmapFilter; -class QBlittable; - -class Q_GUI_EXPORT QGraphicsSystem +class Q_GUI_EXPORT QPagedPaintDevicePrivate { public: - virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; - virtual QPixmapData *createPixmapData(QPixmapData *origin); - virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; + QPagedPaintDevicePrivate() + : pageSize(QPagedPaintDevice::A4), + pageSizeMM(210, 297), + fromPage(0), + toPage(0), + pageOrderAscending(true), + printSelectionOnly(false) + { + margins.left = margins.right = margins.top = margins.bottom = 0; + } - virtual ~QGraphicsSystem(); + static inline QPagedPaintDevicePrivate *get(QPagedPaintDevice *pd) { return pd->d; } - //### Remove this & change qpixmap.cpp & qbitmap.cpp once every platform is gaurenteed - // to have a graphics system. - static QPixmapData *createDefaultPixmapData(QPixmapData::PixelType type); + QPagedPaintDevice::PageSize pageSize; + QSizeF pageSizeMM; + QPagedPaintDevice::Margins margins; - virtual void releaseCachedResources(); + // These are currently required to keep QPrinter functionality working in QTextDocument::print() + int fromPage; + int toPage; + bool pageOrderAscending; + bool printSelectionOnly; }; QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp index 7b3d4add491..fc5cdcdaa50 100644 --- a/src/gui/painting/qpaintdevice.cpp +++ b/src/gui/painting/qpaintdevice.cpp @@ -43,8 +43,6 @@ QT_BEGIN_NAMESPACE -extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp - QPaintDevice::QPaintDevice() { painters = 0; @@ -55,7 +53,6 @@ QPaintDevice::~QPaintDevice() if (paintingActive()) qWarning("QPaintDevice: Cannot destroy paint device that is being " "painted"); - qt_painter_removePaintDevice(this); } @@ -67,6 +64,20 @@ int QPaintDevice::metric(PaintDeviceMetric) const } #endif +void QPaintDevice::init(QPainter *) const +{ +} + +QPaintDevice *QPaintDevice::redirected(QPoint *) const +{ + return 0; +} + +QPainter *QPaintDevice::sharedPainter() const +{ + return 0; +} + Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice::PaintDeviceMetric metric) { return device->metric(metric); diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h index 3ebc24ee145..95509a9daa5 100644 --- a/src/gui/painting/qpaintdevice.h +++ b/src/gui/painting/qpaintdevice.h @@ -79,15 +79,6 @@ public: bool paintingActive() const; virtual QPaintEngine *paintEngine() const = 0; -#if defined(Q_WS_QWS) - static QWSDisplay *qwsDisplay(); -#endif - -#ifdef Q_WS_WIN - virtual HDC getDC() const; - virtual void releaseDC(HDC hdc) const; -#endif - int width() const { return metric(PdmWidth); } int height() const { return metric(PdmHeight); } int widthMM() const { return metric(PdmWidthMM); } @@ -96,70 +87,28 @@ public: int logicalDpiY() const { return metric(PdmDpiY); } int physicalDpiX() const { return metric(PdmPhysicalDpiX); } int physicalDpiY() const { return metric(PdmPhysicalDpiY); } -#ifdef QT_DEPRECATED - QT_DEPRECATED int numColors() const { return metric(PdmNumColors); } -#endif int colorCount() const { return metric(PdmNumColors); } int depth() const { return metric(PdmDepth); } protected: QPaintDevice(); virtual int metric(PaintDeviceMetric metric) const; + virtual void init(QPainter *painter) const; + virtual QPaintDevice *redirected(QPoint *offset) const; + virtual QPainter *sharedPainter() const; ushort painters; // refcount private: Q_DISABLE_COPY(QPaintDevice) -#if defined(Q_WS_X11) && defined(QT3_SUPPORT) -public: - QT3_SUPPORT Display *x11Display() const; - QT3_SUPPORT int x11Screen() const; - QT3_SUPPORT int x11Depth() const; - QT3_SUPPORT int x11Cells() const; - QT3_SUPPORT Qt::HANDLE x11Colormap() const; - QT3_SUPPORT bool x11DefaultColormap() const; - QT3_SUPPORT void *x11Visual() const; - QT3_SUPPORT bool x11DefaultVisual() const; - - static QT3_SUPPORT Display *x11AppDisplay(); - static QT3_SUPPORT int x11AppScreen(); - static QT3_SUPPORT int x11AppDepth(int screen = -1); - static QT3_SUPPORT int x11AppCells(int screen = -1); - static QT3_SUPPORT Qt::HANDLE x11AppRootWindow(int screen = -1); - static QT3_SUPPORT Qt::HANDLE x11AppColormap(int screen = -1); - static QT3_SUPPORT void *x11AppVisual(int screen = -1); - static QT3_SUPPORT bool x11AppDefaultColormap(int screen =-1); - static QT3_SUPPORT bool x11AppDefaultVisual(int screen =-1); - static QT3_SUPPORT int x11AppDpiX(int screen = -1); - static QT3_SUPPORT int x11AppDpiY(int screen = -1); - static QT3_SUPPORT void x11SetAppDpiX(int, int); - static QT3_SUPPORT void x11SetAppDpiY(int, int); -#endif - friend class QPainter; + friend class QPainterPrivate; friend class QFontEngineMac; friend class QX11PaintEngine; friend Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, PaintDeviceMetric metric); }; -#ifdef QT3_SUPPORT -QT3_SUPPORT Q_GUI_EXPORT -void bitBlt(QPaintDevice *dst, int dx, int dy, - const QPaintDevice *src, int sx=0, int sy=0, int sw=-1, int sh=-1, - bool ignoreMask=false); - -QT3_SUPPORT Q_GUI_EXPORT -void bitBlt(QPaintDevice *dst, int dx, int dy, - const QImage *src, int sx=0, int sy=0, int sw=-1, int sh=-1, - int conversion_flags=0); - -QT3_SUPPORT Q_GUI_EXPORT -void bitBlt(QPaintDevice *dst, const QPoint &dp, - const QPaintDevice *src, const QRect &sr=QRect(0,0,-1,-1), - bool ignoreMask=false); -#endif - /***************************************************************************** Inline functions *****************************************************************************/ diff --git a/src/gui/painting/qpaintdevice_qpa.cpp b/src/gui/painting/qpaintdevice_qpa.cpp index 813965feb15..65eeaaa7e8b 100644 --- a/src/gui/painting/qpaintdevice_qpa.cpp +++ b/src/gui/painting/qpaintdevice_qpa.cpp @@ -41,14 +41,11 @@ #include "qpaintdevice.h" #include "qpainter.h" -#include "qwidget.h" #include "qbitmap.h" -#include "qapplication.h" +#include "qguiapplication.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"); diff --git a/src/gui/painting/qpaintdevice_x11.cpp b/src/gui/painting/qpaintdevice_x11.cpp deleted file mode 100644 index 42e61e855b2..00000000000 --- a/src/gui/painting/qpaintdevice_x11.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpaintdevice.h" -#include "qpainter.h" -#include "qwidget.h" -#include "qbitmap.h" -#include "qapplication.h" -#include -#include "qx11info_x11.h" - -QT_BEGIN_NAMESPACE - -/*! \internal - - Returns the X11 Drawable of the paint device. 0 is returned if it - can't be obtained. -*/ - -Drawable Q_GUI_EXPORT qt_x11Handle(const QPaintDevice *pd) -{ - if (!pd) return 0; - if (pd->devType() == QInternal::Widget) - return static_cast(pd)->handle(); - else if (pd->devType() == QInternal::Pixmap) - return static_cast(pd)->handle(); - return 0; -} - -/*! - \relates QPaintDevice - - Returns the QX11Info structure for the \a pd paint device. 0 is - returned if it can't be obtained. -*/ -const Q_GUI_EXPORT QX11Info *qt_x11Info(const QPaintDevice *pd) -{ - if (!pd) return 0; - if (pd->devType() == QInternal::Widget) - return &static_cast(pd)->x11Info(); - else if (pd->devType() == QInternal::Pixmap) - return &static_cast(pd)->x11Info(); - return 0; -} - - - -#ifdef QT3_SUPPORT - -Display *QPaintDevice::x11Display() const -{ - return X11->display; -} - -int QPaintDevice::x11Screen() const -{ - const QX11Info *info = qt_x11Info(this); - if (info) - return info->screen(); - return QX11Info::appScreen(); -} - -void *QPaintDevice::x11Visual() const -{ - const QX11Info *info = qt_x11Info(this); - if (info) - return info->visual(); - return QX11Info::appVisual(); -} - -int QPaintDevice::x11Depth() const -{ - const QX11Info *info = qt_x11Info(this); - if (info) - return info->depth(); - return QX11Info::appDepth(); -} - -int QPaintDevice::x11Cells() const -{ - const QX11Info *info = qt_x11Info(this); - if (info) - return info->cells(); - return QX11Info::appCells(); -} - -Qt::HANDLE QPaintDevice::x11Colormap() const -{ - const QX11Info *info = qt_x11Info(this); - if (info) - return info->colormap(); - return QX11Info::appColormap(); -} - -bool QPaintDevice::x11DefaultColormap() const -{ - const QX11Info *info = qt_x11Info(this); - if (info) - return info->defaultColormap(); - return QX11Info::appDefaultColormap(); -} - -bool QPaintDevice::x11DefaultVisual() const -{ - const QX11Info *info = qt_x11Info(this); - if (info) - return info->defaultVisual(); - return QX11Info::appDefaultVisual(); -} - -void *QPaintDevice::x11AppVisual(int screen) -{ return QX11Info::appVisual(screen); } - -Qt::HANDLE QPaintDevice::x11AppColormap(int screen) -{ return QX11Info::appColormap(screen); } - -Display *QPaintDevice::x11AppDisplay() -{ return QX11Info::display(); } - -int QPaintDevice::x11AppScreen() -{ return QX11Info::appScreen(); } - -int QPaintDevice::x11AppDepth(int screen) -{ return QX11Info::appDepth(screen); } - -int QPaintDevice::x11AppCells(int screen) -{ return QX11Info::appCells(screen); } - -Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen) -{ return QX11Info::appRootWindow(screen); } - -bool QPaintDevice::x11AppDefaultColormap(int screen) -{ return QX11Info::appDefaultColormap(screen); } - -bool QPaintDevice::x11AppDefaultVisual(int screen) -{ return QX11Info::appDefaultVisual(screen); } - -void QPaintDevice::x11SetAppDpiX(int dpi, int screen) -{ - QX11Info::setAppDpiX(dpi, screen); -} - -void QPaintDevice::x11SetAppDpiY(int dpi, int screen) -{ - QX11Info::setAppDpiY(dpi, screen); -} - -int QPaintDevice::x11AppDpiX(int screen) -{ - return QX11Info::appDpiX(screen); -} - -int QPaintDevice::x11AppDpiY(int screen) -{ - return QX11Info::appDpiY(screen); -} -#endif - - -QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index c46513a07c4..f64bd52ec27 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -43,9 +43,9 @@ #include "qpainter_p.h" #include "qpolygon.h" #include "qbitmap.h" -#include "qapplication.h" #include #include +#include #include #include #include @@ -139,7 +139,7 @@ QString QTextItem::text() const QFont QTextItem::font() const { const QTextItemInt *ti = static_cast(this); - return ti->f ? *ti->f : QApplication::font(); + return ti->f ? *ti->f : QGuiApplication::font(); } @@ -154,7 +154,7 @@ QFont QTextItem::font() const different painter backends we support. We provide one paint engine for each window system and painting framework we support. This includes X11 on Unix/Linux and CoreGraphics on Mac OS X. In addition we provide QPaintEngine - implementations for OpenGL (accessible through QGLWidget) and PostScript + implementations for OpenGL (accessible through QOpenGLWidget) and PostScript (accessible through QPSPrinter on X11). Additionally there is a raster-based paint engine that is a fallback for when an engine does not support a certain capability. diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index 6befdd8ac7a..49ceb2a8b30 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -282,7 +282,7 @@ private: friend class QWin32PaintEnginePrivate; friend class QMacCGContext; friend class QPreviewPaintEngine; - friend class QX11GLPixmapData; + friend class QX11GLPlatformPixmap; }; diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 75efa208045..0e9a17a1835 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -44,7 +44,6 @@ #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 @@ -112,7 +111,7 @@ public: bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const { - if (pm.pixmapData()->classId() != QPixmapData::BlitterClass) + if (pm.handle()->classId() != QPlatformPixmap::BlitterClass) return false; if (checkStateAgainstMask(capabillitiesState,drawPixmapMask)) { if (m_capabilities & (QBlittable::SourceOverPixmapCapability @@ -191,7 +190,7 @@ class QBlitterPaintEnginePrivate : public QPaintEngineExPrivate { Q_DECLARE_PUBLIC(QBlitterPaintEngine); public: - QBlitterPaintEnginePrivate(QBlittablePixmapData *p) + QBlitterPaintEnginePrivate(QBlittablePlatformPixmap *p) : QPaintEngineExPrivate(), pmData(p), isBlitterLocked(false), @@ -281,7 +280,7 @@ public: QRasterPaintEngine *raster; - QBlittablePixmapData *pmData; + QBlittablePlatformPixmap *pmData; bool isBlitterLocked; CapabilitiesToStateMask *capabillities; @@ -289,7 +288,7 @@ public: uint hasXForm; }; -QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePixmapData *p) +QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePlatformPixmap *p) : QPaintEngineEx(*(new QBlitterPaintEnginePrivate(p))) { } diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h index afd7486dc2f..1acc647fbed 100644 --- a/src/gui/painting/qpaintengine_blitter_p.h +++ b/src/gui/painting/qpaintengine_blitter_p.h @@ -49,14 +49,14 @@ QT_BEGIN_NAMESPACE class QBlitterPaintEnginePrivate; -class QBlittablePixmapData; +class QBlittablePlatformPixmap; class QBlittable; class Q_GUI_EXPORT QBlitterPaintEngine : public QPaintEngineEx { Q_DECLARE_PRIVATE(QBlitterPaintEngine); public: - QBlitterPaintEngine(QBlittablePixmapData *p); + QBlitterPaintEngine(QBlittablePlatformPixmap *p); ~QBlitterPaintEngine(); virtual QPainterState *createState(QPainterState *orig) const; diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h index 2b54e82c399..5d540bd11bb 100644 --- a/src/gui/painting/qpaintengine_p.h +++ b/src/gui/painting/qpaintengine_p.h @@ -66,7 +66,7 @@ class QPaintEnginePrivate { Q_DECLARE_PUBLIC(QPaintEngine) public: - QPaintEnginePrivate() : pdev(0), q_ptr(0), currentClipWidget(0), hasSystemTransform(0), + QPaintEnginePrivate() : pdev(0), q_ptr(0), currentClipDevice(0), hasSystemTransform(0), hasSystemViewport(0) {} virtual ~QPaintEnginePrivate() { } QPaintDevice *pdev; @@ -75,7 +75,7 @@ public: QRect systemRect; QRegion systemViewport; QTransform systemTransform; - QWidget *currentClipWidget; + QPaintDevice *currentClipDevice; uint hasSystemTransform : 1; uint hasSystemViewport : 1; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 45099f92d3d..4d4b88b2299 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -51,7 +51,6 @@ #include #include #include -#include #include #include @@ -76,7 +75,7 @@ // #include "qbezier_p.h" #include "qoutlinemapper_p.h" -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) # include # include # include @@ -87,21 +86,13 @@ # include # include # include -#elif defined(Q_WS_QWS) -# if !defined(QT_NO_FREETYPE) -# include -# endif -# if !defined(QT_NO_QWS_QPF2) -# include -# endif -# include #elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) # include #elif defined(Q_WS_QPA) # include #endif -#if defined(Q_WS_WIN64) +#if defined(Q_OS_WIN64) # include #endif #include @@ -127,12 +118,28 @@ void dumpClip(int width, int height, const QClipData *clip); // 4 pixels. #define int_dim(pos, dim) (int(pos+dim) - int(pos)) -// use the same rounding as in qrasterizer.cpp (6 bit fixed point) static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; -#ifdef Q_WS_WIN -extern bool qt_cleartype_enabled; +#ifdef Q_OS_WIN + +static inline bool winClearTypeFontsEnabled() +{ + UINT result = 0; +#if !defined(SPI_GETFONTSMOOTHINGTYPE) // MinGW +# define SPI_GETFONTSMOOTHINGTYPE 0x200A +# define FE_FONTSMOOTHINGCLEARTYPE 0x002 #endif + SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0); + return result == FE_FONTSMOOTHINGCLEARTYPE; +} + +bool QRasterPaintEngine::clearTypeFontsEnabled() +{ + static const bool result = winClearTypeFontsEnabled(); + return result; +} + +#endif // Q_OS_WIN #ifdef Q_WS_MAC extern bool qt_applefontsmoothing_enabled; @@ -145,7 +152,6 @@ extern bool qt_applefontsmoothing_enabled; static void qt_span_fill_clipRect(int count, const QSpan *spans, void *userData); static void qt_span_fill_clipped(int count, const QSpan *spans, void *userData); static void qt_span_clip(int count, const QSpan *spans, void *userData); -static void qt_merge_clip(const QClipData *c1, const QClipData *c2, QClipData *result); struct ClipData { @@ -332,7 +338,7 @@ void QRasterPaintEngine::init() Q_D(QRasterPaintEngine); -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN d->hdc = 0; #endif @@ -378,11 +384,6 @@ void QRasterPaintEngine::init() case QInternal::Image: format = d->rasterBuffer->prepare(static_cast(d->device)); break; -#ifdef Q_WS_QWS - case QInternal::CustomRaster: - d->rasterBuffer->prepare(static_cast(d->device)); - break; -#endif default: qWarning("QRasterPaintEngine: unsupported target device %d\n", d->device->devType()); d->device = 0; @@ -436,8 +437,8 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) if (device->devType() == QInternal::Pixmap) { QPixmap *pixmap = static_cast(device); - QPixmapData *pd = pixmap->pixmapData(); - if (pd->classId() == QPixmapData::RasterClass || pd->classId() == QPixmapData::BlitterClass) + QPlatformPixmap *pd = pixmap->handle(); + if (pd->classId() == QPlatformPixmap::RasterClass || pd->classId() == QPlatformPixmap::BlitterClass) d->device = pd->buffer(); } else { d->device = device; @@ -485,8 +486,8 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) if (d->mono_surface) d->glyphCacheType = QFontEngineGlyphCache::Raster_Mono; -#if defined(Q_WS_WIN) - else if (qt_cleartype_enabled) +#if defined(Q_OS_WIN) + else if (clearTypeFontsEnabled()) #elif defined (Q_WS_MAC) else if (qt_applefontsmoothing_enabled) #else @@ -947,13 +948,6 @@ void QRasterPaintEngine::clipEnabledChanged() } } -#ifdef Q_WS_QWS -void QRasterPaintEnginePrivate::prepare(QCustomRasterPaintDevice *device) -{ - rasterBuffer->prepare(device); -} -#endif - void QRasterPaintEnginePrivate::drawImage(const QPointF &pt, const QImage &img, SrcOverBlendFunc func, @@ -1994,9 +1988,9 @@ void QRasterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pixmap) qDebug() << " - QRasterPaintEngine::drawPixmap(), pos=" << pos << " pixmap=" << pixmap.size() << "depth=" << pixmap.depth(); #endif - QPixmapData *pd = pixmap.pixmapData(); - if (pd->classId() == QPixmapData::RasterClass) { - const QImage &image = static_cast(pd)->image; + QPlatformPixmap *pd = pixmap.handle(); + if (pd->classId() == QPlatformPixmap::RasterClass) { + const QImage &image = static_cast(pd)->image; if (image.depth() == 1) { Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); @@ -2035,9 +2029,9 @@ void QRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, cons qDebug() << " - QRasterPaintEngine::drawPixmap(), r=" << r << " sr=" << sr << " pixmap=" << pixmap.size() << "depth=" << pixmap.depth(); #endif - QPixmapData* pd = pixmap.pixmapData(); - if (pd->classId() == QPixmapData::RasterClass) { - const QImage &image = static_cast(pd)->image; + QPlatformPixmap* pd = pixmap.handle(); + if (pd->classId() == QPlatformPixmap::RasterClass) { + const QImage &image = static_cast(pd)->image; if (image.depth() == 1) { Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); @@ -2430,9 +2424,9 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, QImage image; - QPixmapData *pd = pixmap.pixmapData(); - if (pd->classId() == QPixmapData::RasterClass) { - image = static_cast(pd)->image; + QPlatformPixmap *pd = pixmap.handle(); + if (pd->classId() == QPlatformPixmap::RasterClass) { + image = static_cast(pd)->image; } else { image = pixmap.toImage(); } @@ -3052,33 +3046,17 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte return; } -#elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_WS_WIN || Q_WS_MAC +#elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_OS_WIN || Q_WS_MAC if (s->matrix.type() <= QTransform::TxTranslate || (s->matrix.type() == QTransform::TxScale && (qFuzzyCompare(s->matrix.m11(), s->matrix.m22())))) { drawGlyphsS60(p, ti); return; } -#else // Q_WS_WIN || Q_WS_MAC +#else // Q_OS_WIN || Q_WS_MAC QFontEngine *fontEngine = ti.fontEngine; -#if defined(Q_WS_QWS) - if (fontEngine->type() == QFontEngine::Box) { - fontEngine->draw(this, qFloor(p.x()), qFloor(p.y()), ti); - return; - } - - if (s->matrix.type() < QTransform::TxScale - && (fontEngine->type() == QFontEngine::QPF1 || fontEngine->type() == QFontEngine::QPF2 - || (fontEngine->type() == QFontEngine::Proxy - && !(static_cast(fontEngine)->drawAsOutline())) - )) { - fontEngine->draw(this, qFloor(p.x() + aliasedCoordinateDelta), qFloor(p.y() + aliasedCoordinateDelta), ti); - return; - } -#endif // Q_WS_QWS - #ifdef Q_WS_QPA if (s->matrix.type() < QTransform::TxScale) { @@ -3109,14 +3087,6 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte #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) - fontEngine = renderingEngine; - } -#endif - if (fontEngine->type() != QFontEngine::Freetype) { QPaintEngineEx::drawTextItem(p, ti); return; @@ -3333,7 +3303,7 @@ CGContextRef QRasterPaintEngine::getCGContext() const } #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN /*! \internal */ @@ -3396,59 +3366,6 @@ QPoint QRasterPaintEngine::coordinateOffset() const return QPoint(0, 0); } -/*! - Draws the given color \a spans with the specified \a color. The \a - count parameter specifies the number of spans. - - The default implementation does nothing; reimplement this function - to draw the given color \a spans with the specified \a color. Note - that this function \e must be reimplemented if the framebuffer is - not memory-mapped. - - \sa drawBufferSpan() -*/ -#if defined(Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS) -void QRasterPaintEngine::drawColorSpans(const QSpan *spans, int count, uint color) -{ - Q_UNUSED(spans); - Q_UNUSED(count); - Q_UNUSED(color); - qFatal("QRasterPaintEngine::drawColorSpans must be reimplemented on " - "a non memory-mapped device"); -} - -/*! - \fn void QRasterPaintEngine::drawBufferSpan(const uint *buffer, int size, int x, int y, int length, uint alpha) - - Draws the given \a buffer. - - The default implementation does nothing; reimplement this function - to draw a buffer that contains more than one color. Note that this - function \e must be reimplemented if the framebuffer is not - memory-mapped. - - The \a size parameter specifies the total size of the given \a - buffer, while the \a length parameter specifies the number of - pixels to draw. The buffer's position is given by (\a x, \a - y). The provided \a alpha value is added to each pixel in the - buffer when drawing. - - \sa drawColorSpans() -*/ -void QRasterPaintEngine::drawBufferSpan(const uint *buffer, int bufsize, - int x, int y, int length, uint const_alpha) -{ - Q_UNUSED(buffer); - Q_UNUSED(bufsize); - Q_UNUSED(x); - Q_UNUSED(y); - Q_UNUSED(length); - Q_UNUSED(const_alpha); - qFatal("QRasterPaintEngine::drawBufferSpan must be reimplemented on " - "a non memory-mapped device"); -} -#endif // Q_WS_QWS - void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSpanData *fg) { Q_ASSERT(fg); @@ -3577,76 +3494,6 @@ QRect QRasterPaintEngine::clipBoundingRect() const return QRect(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin); } -static void qt_merge_clip(const QClipData *c1, const QClipData *c2, QClipData *result) -{ - Q_ASSERT(c1->clipSpanHeight == c2->clipSpanHeight && c1->clipSpanHeight == result->clipSpanHeight); - - QVarLengthArray buffer; - - QClipData::ClipLine *c1ClipLines = const_cast(c1)->clipLines(); - QClipData::ClipLine *c2ClipLines = const_cast(c2)->clipLines(); - result->initialize(); - - for (int y = 0; y < c1->clipSpanHeight; ++y) { - const QSpan *c1_spans = c1ClipLines[y].spans; - int c1_count = c1ClipLines[y].count; - const QSpan *c2_spans = c2ClipLines[y].spans; - int c2_count = c2ClipLines[y].count; - - if (c1_count == 0 && c2_count == 0) - continue; - if (c1_count == 0) { - result->appendSpans(c2_spans, c2_count); - continue; - } else if (c2_count == 0) { - result->appendSpans(c1_spans, c1_count); - continue; - } - - // we need to merge the two - - // find required length - int max = qMax(c1_spans[c1_count - 1].x + c1_spans[c1_count - 1].len, - c2_spans[c2_count - 1].x + c2_spans[c2_count - 1].len); - buffer.resize(max); - memset(buffer.data(), 0, buffer.size() * sizeof(short)); - - // Fill with old spans. - for (int i = 0; i < c1_count; ++i) { - const QSpan *cs = c1_spans + i; - for (int j=cs->x; jx + cs->len; ++j) - buffer[j] = cs->coverage; - } - - // Fill with new spans - for (int i = 0; i < c2_count; ++i) { - const QSpan *cs = c2_spans + i; - for (int j = cs->x; j < cs->x + cs->len; ++j) { - buffer[j] += cs->coverage; - if (buffer[j] > 255) - buffer[j] = 255; - } - } - - int x = 0; - while (x= max) break; - - int sx = x; - int coverage = buffer[x]; - - // Find length of span - while (x < max && buffer[x] == coverage) - ++x; - - result->appendSpan(sx, x - sx, y, coverage); - } - } -} - void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data) { Q_Q(QRasterPaintEngine); @@ -3730,7 +3577,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, const int rasterPoolInitialSize = MINIMUM_POOL_SIZE; int rasterPoolSize = rasterPoolInitialSize; unsigned char *rasterPoolBase; -#if defined(Q_WS_WIN64) +#if defined(Q_OS_WIN64) rasterPoolBase = // We make use of setjmp and longjmp in qgrayraster.c which requires // 16-byte alignment, hence we hardcode this requirement here.. @@ -3783,7 +3630,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, rendered_spans += q_gray_rendered_spans(*grayRaster.data()); -#if defined(Q_WS_WIN64) +#if defined(Q_OS_WIN64) _aligned_free(rasterPoolBase); #else if (rasterPoolBase != rasterPoolOnStack) // initially on the stack @@ -3792,7 +3639,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, rasterPoolSize = new_size; rasterPoolBase = -#if defined(Q_WS_WIN64) +#if defined(Q_OS_WIN64) // We make use of setjmp and longjmp in qgrayraster.c which requires // 16-byte alignment, hence we hardcode this requirement here.. (unsigned char *) _aligned_malloc(rasterPoolSize, sizeof(void*) * 2); @@ -3809,7 +3656,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, } } -#if defined(Q_WS_WIN64) +#if defined(Q_OS_WIN64) _aligned_free(rasterPoolBase); #else if (rasterPoolBase != rasterPoolOnStack) // initially on the stack @@ -3896,127 +3743,6 @@ void QRasterBuffer::resetBuffer(int val) memset(m_buffer, val, m_height*bytes_per_line); } - -#if defined(Q_WS_QWS) -void QRasterBuffer::prepare(QCustomRasterPaintDevice *device) -{ - m_buffer = reinterpret_cast(device->memory()); - m_width = qMin(QT_RASTER_COORD_LIMIT, device->width()); - m_height = qMin(QT_RASTER_COORD_LIMIT, device->height()); - bytes_per_pixel = device->depth() / 8; - bytes_per_line = device->bytesPerLine(); - format = device->format(); -#ifndef QT_NO_RASTERCALLBACKS - if (!m_buffer) - drawHelper = qDrawHelperCallback + format; - else -#endif - drawHelper = qDrawHelper + format; -} - -int QCustomRasterPaintDevice::metric(PaintDeviceMetric m) const -{ - switch (m) { - case PdmWidth: - return widget->frameGeometry().width(); - case PdmHeight: - return widget->frameGeometry().height(); - default: - break; - } - - return qt_paint_device_metric(widget, m); -} - -int QCustomRasterPaintDevice::bytesPerLine() const -{ - return (width() * depth() + 7) / 8; -} - -#elif defined(Q_OS_SYMBIAN) - -void QRasterBuffer::prepareBuffer(int /* width */, int /* height */) -{ -} - -#endif // Q_OS_SYMBIAN - -/*! - \class QCustomRasterPaintDevice - \preliminary - \ingroup qws - \since 4.2 - - \brief The QCustomRasterPaintDevice class is provided to activate - hardware accelerated paint engines in Qt for Embedded Linux. - - Note that this class is only available in \l{Qt for Embedded Linux}. - - In \l{Qt for Embedded Linux}, painting is a pure software - implementation. But starting with Qt 4.2, it is - possible to add an accelerated graphics driver to take advantage - of available hardware resources. - - Hardware acceleration is accomplished by creating a custom screen - driver, accelerating the copying from memory to the screen, and - implementing a custom paint engine accelerating the various - painting operations. Then a custom paint device (derived from the - QCustomRasterPaintDevice class) and a custom window surface - (derived from QWSWindowSurface) must be implemented to make - \l{Qt for Embedded Linux} aware of the accelerated driver. - - See the \l {Adding an Accelerated Graphics Driver to Qt for Embedded Linux} - documentation for details. - - \sa QRasterPaintEngine, QPaintDevice -*/ - -/*! - \fn QCustomRasterPaintDevice::QCustomRasterPaintDevice(QWidget *widget) - - Constructs a custom raster based paint device for the given - top-level \a widget. -*/ - -/*! - \fn int QCustomRasterPaintDevice::bytesPerLine() const - - Returns the number of bytes per line in the framebuffer. Note that - this number might be larger than the framebuffer width. -*/ - -/*! - \fn int QCustomRasterPaintDevice::devType() const - \internal -*/ - -/*! - \fn QImage::Format QCustomRasterPaintDevice::format() const - - Returns the format of the device's memory buffet. - - The default format is QImage::Format_ARGB32_Premultiplied. The - only other valid format is QImage::Format_RGB16. -*/ - -/*! - \fn void * QCustomRasterPaintDevice::memory () const - - Returns a pointer to the paint device's memory buffer, or 0 if no - such buffer exists. -*/ - -/*! - \fn int QCustomRasterPaintDevice::metric ( PaintDeviceMetric m ) const - \reimp -*/ - -/*! - \fn QSize QCustomRasterPaintDevice::size () const - \internal -*/ - - QClipData::QClipData(int height) { clipSpanHeight = height; @@ -4740,9 +4466,6 @@ Q_GLOBAL_STATIC(QGradientCache, qt_gradient_cache) void QSpanData::init(QRasterBuffer *rb, const QRasterPaintEngine *pe) { rasterBuffer = rb; -#ifdef Q_WS_QWS - rasterEngine = const_cast(pe); -#endif type = None; txop = 0; bilinear = false; @@ -4888,16 +4611,7 @@ void QSpanData::adjustSpanMethods() unclipped_blend = rasterBuffer->drawHelper->blendGradient; break; case Texture: -#ifdef Q_WS_QWS -#ifndef QT_NO_RASTERCALLBACKS - if (!rasterBuffer->buffer()) - unclipped_blend = qBlendTextureCallback; - else -#endif - unclipped_blend = qBlendTexture; -#else unclipped_blend = qBlendTexture; -#endif if (!texture.imageData) unclipped_blend = 0; diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index f9d388d14e6..d387e1312af 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -72,7 +72,6 @@ class QOutlineMapper; class QRasterPaintEnginePrivate; class QRasterBuffer; class QClipData; -class QCustomRasterPaintDevice; class QRasterPaintEngineState : public QPainterState { @@ -129,11 +128,7 @@ public: /******************************************************************************* * QRasterPaintEngine */ -class -#ifdef Q_WS_QWS -Q_GUI_EXPORT -#endif -QRasterPaintEngine : public QPaintEngineEx +class Q_GUI_EXPORT QRasterPaintEngine : public QPaintEngineEx { Q_DECLARE_PRIVATE(QRasterPaintEngine) public: @@ -229,10 +224,11 @@ public: CGContextRef getCGContext() const; #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN void setDC(HDC hdc); HDC getDC() const; void releaseDC(HDC hdc) const; + static bool clearTypeFontsEnabled(); #endif void alphaPenBlt(const void* src, int bpl, int depth, int rx,int ry,int w,int h); @@ -241,11 +237,6 @@ public: QPoint coordinateOffset() const; -#if defined(Q_WS_QWS) && !defined(QT_NO_RASTERCALLBACKS) - virtual void drawColorSpans(const QSpan *spans, int count, uint color); - virtual void drawBufferSpan(const uint *buffer, int bufsize, - int x, int y, int length, uint const_alpha); -#endif bool supportsTransformations(const QFontEngine *fontEngine) const; bool supportsTransformations(qreal pixelSize, const QTransform &m) const; @@ -295,11 +286,7 @@ private: /******************************************************************************* * QRasterPaintEnginePrivate */ -class -#ifdef Q_WS_QWS -Q_GUI_EXPORT -#endif -QRasterPaintEnginePrivate : public QPaintEngineExPrivate +class QRasterPaintEnginePrivate : public QPaintEngineExPrivate { Q_DECLARE_PUBLIC(QRasterPaintEngine) public: @@ -331,10 +318,6 @@ public: ProcessSpans getBrushFunc(const QRect &rect, const QSpanData *data) const; ProcessSpans getBrushFunc(const QRectF &rect, const QSpanData *data) const; -#ifdef Q_WS_QWS - void prepare(QCustomRasterPaintDevice *); -#endif - inline const QClipData *clip() const; void initializeRasterizer(QSpanData *data); @@ -346,7 +329,7 @@ public: QScopedPointer outlineMapper; QScopedPointer rasterBuffer; -#if defined (Q_WS_WIN) +#if defined (Q_OS_WIN) HDC hdc; #elif defined(Q_WS_MAC) CGContextRef cgContext; @@ -378,11 +361,7 @@ public: }; -class -#ifdef Q_WS_QWS -Q_GUI_EXPORT -#endif -QClipData { +class QClipData { public: QClipData(int height); ~QClipData(); @@ -459,41 +438,10 @@ inline void QClipData::appendSpans(const QSpan *s, int num) count += num; } -#ifdef Q_WS_QWS -class Q_GUI_EXPORT QCustomRasterPaintDevice : public QPaintDevice -{ -public: - QCustomRasterPaintDevice(QWidget *w) : widget(w) {} - - int devType() const { return QInternal::CustomRaster; } - - virtual int metric(PaintDeviceMetric m) const; - - virtual void* memory() const { return 0; } - - virtual QImage::Format format() const { - return QImage::Format_ARGB32_Premultiplied; - } - - virtual int bytesPerLine() const; - - virtual QSize size() const { - return static_cast(paintEngine())->size(); - } - -private: - QWidget *widget; -}; -#endif // Q_WS_QWS - /******************************************************************************* * QRasterBuffer */ -class -#ifdef Q_WS_QWS -Q_GUI_EXPORT -#endif -QRasterBuffer +class QRasterBuffer { public: QRasterBuffer() : m_width(0), m_height(0), m_buffer(0) { init(); } @@ -504,9 +452,6 @@ public: QImage::Format prepare(QImage *image); QImage::Format prepare(QPixmap *pix); -#ifdef Q_WS_QWS - void prepare(QCustomRasterPaintDevice *device); -#endif void prepare(int w, int h); void prepareBuffer(int w, int h); diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index e90d40be4db..9674f04ba11 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -54,7 +54,6 @@ // #include -#include #include #include @@ -213,6 +212,7 @@ public: virtual void beginNativePainting() {} virtual void endNativePainting() {} + // ### Qt5: remove, once QtGui is merged into QtGui and QtWidgets // Return a pixmap filter of "type" that can render the parameters // in "prototype". The returned filter is owned by the engine and // will be destroyed when the engine is destroyed. The "prototype" diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index f7b6ab6feef..fe9914bd8f7 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -56,9 +56,6 @@ #include "qpixmapcache.h" #include "qpolygon.h" #include "qtextlayout.h" -#include "qwidget.h" -#include "qapplication.h" -#include "qstyle.h" #include "qthread.h" #include "qvarlengtharray.h" #include "qstatictext.h" @@ -69,12 +66,12 @@ #include #include #include -#include #include #include #include #include -#include +#include +#include #include QT_BEGIN_NAMESPACE @@ -242,34 +239,10 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev) Q_ASSERT(q); Q_ASSERT(pdev); - if (pdev->devType() != QInternal::Widget) + QPainter *sp = pdev->sharedPainter(); + if (!sp) return false; - QWidget *widget = static_cast(pdev); - Q_ASSERT(widget); - - // Someone either called QPainter::setRedirected in the widget's paint event - // right before this painter was created (or begin was called) or - // sent a paint event directly to the widget. - if (!widget->d_func()->redirectDev) - return false; - - QPainter *sp = widget->d_func()->sharedPainter(); - if (!sp || !sp->isActive()) - return false; - - if (sp->paintEngine()->paintDevice() != widget->d_func()->redirectDev) - return false; - - // Check if we're attempting to paint outside a paint event. - if (!sp->d_ptr->engine->hasFeature(QPaintEngine::PaintOutsidePaintEvent) - && !widget->testAttribute(Qt::WA_PaintOutsidePaintEvent) - && !widget->testAttribute(Qt::WA_WState_InPaintEvent)) { - - qWarning("QPainter::begin: Widget painting can only begin as a result of a paintEvent"); - return false; - } - // Save the current state of the shared painter and assign // the current d_ptr to the shared painter's d_ptr. sp->save(); @@ -293,14 +266,14 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev) Q_ASSERT(q->d_ptr->state); // Now initialize the painter with correct widget properties. - q->initFrom(widget); + q->initFrom(pdev); QPoint offset; - widget->d_func()->redirected(&offset); + pdev->redirected(&offset); offset += q->d_ptr->engine->coordinateOffset(); // Update system rect. - q->d_ptr->state->ww = q->d_ptr->state->vw = widget->width(); - q->d_ptr->state->wh = q->d_ptr->state->vh = widget->height(); + q->d_ptr->state->ww = q->d_ptr->state->vw = pdev->width(); + q->d_ptr->state->wh = q->d_ptr->state->vh = pdev->height(); // Update matrix. if (q->d_ptr->state->WxF) { @@ -314,13 +287,13 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev) q->d_ptr->updateMatrix(); QPaintEnginePrivate *enginePrivate = q->d_ptr->engine->d_func(); - if (enginePrivate->currentClipWidget == widget) { + if (enginePrivate->currentClipDevice == pdev) { enginePrivate->systemStateChanged(); return true; } // Update system transform and clip. - enginePrivate->currentClipWidget = widget; + enginePrivate->currentClipDevice = pdev; enginePrivate->setSystemTransform(q->d_ptr->state->matrix); return true; } @@ -1371,17 +1344,14 @@ void QPainterPrivate::updateState(QPainterState *newState) only use the format types QImage::Format_ARGB32_Premultiplied, QImage::Format_RGB32 or QImage::Format_RGB16. Any other format, including QImage::Format_ARGB32, has significantly worse - performance. This engine is also used by default on Windows and on - QWS. It can be used as default graphics system on any - OS/hardware/software combination by passing \c {-graphicssystem - raster} on the command line + performance. This engine is used by default for QWidget and QPixmap. \o OpenGL 2.0 (ES) - This backend is the primary backend for hardware accelerated graphics. It can be run on desktop machines and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0 specification. This includes most graphics chips produced in the last couple of years. The engine can be enabled by using QPainter - onto a QGLWidget or by passing \c {-graphicssystem opengl} on the + onto a QOpenGLWidget or by passing \c {-graphicssystem opengl} on the command line when the underlying system supports it. \o OpenVG - This backend implements the Khronos standard for 2D @@ -1542,8 +1512,8 @@ QPainter::~QPainter() QPaintDevice *QPainter::device() const { Q_D(const QPainter); - if (isActive() && d->engine->d_func()->currentClipWidget) - return d->engine->d_func()->currentClipWidget; + if (isActive() && d->engine->d_func()->currentClipDevice) + return d->engine->d_func()->currentClipDevice; return d->original_device; } @@ -1562,25 +1532,23 @@ bool QPainter::isActive() const /*! Initializes the painters pen, background and font to the same as - the given \a widget. This function is called automatically when the - painter is opened on a QWidget. + the given \a paint device. + + \obsolete \sa begin(), {QPainter#Settings}{Settings} */ -void QPainter::initFrom(const QWidget *widget) +void QPainter::initFrom(const QPaintDevice *device) { - Q_ASSERT_X(widget, "QPainter::initFrom(const QWidget *widget)", "Widget cannot be 0"); + Q_ASSERT_X(device, "QPainter::initFrom(const QPaintDevice *device)", "QPaintDevice cannot be 0"); Q_D(QPainter); if (!d->engine) { qWarning("QPainter::initFrom: Painter not active, aborted"); return; } - const QPalette &pal = widget->palette(); - d->state->pen = QPen(pal.brush(widget->foregroundRole()), 0); - d->state->bgBrush = pal.brush(widget->backgroundRole()); - d->state->deviceFont = QFont(widget->font(), const_cast (widget)); - d->state->font = d->state->deviceFont; + device->init(this); + if (d->extended) { d->extended->penChanged(); } else if (d->engine) { @@ -1753,22 +1721,9 @@ bool QPainter::begin(QPaintDevice *pd) d->helper_device = pd; d->original_device = pd; - QPaintDevice *rpd = 0; QPoint redirectionOffset; - // We know for sure that redirection is broken when the widget is inside - // its paint event, so it's safe to use our hard-coded redirection. However, - // there IS one particular case we still need to support, and that's - // when people call QPainter::setRedirected in the widget's paint event right - // before any painter is created (or QPainter::begin is called). In that - // particular case our hard-coded redirection is restored and the redirection - // is retrieved from QPainter::redirected (as before). - if (pd->devType() == QInternal::Widget) - rpd = static_cast(pd)->d_func()->redirected(&redirectionOffset); - - if (!rpd) - rpd = redirected(pd, &redirectionOffset); - + QPaintDevice *rpd = pd->redirected(&redirectionOffset); if (rpd) pd = rpd; @@ -1811,6 +1766,8 @@ bool QPainter::begin(QPaintDevice *pd) d->engine->state = d->state; switch (pd->devType()) { +#if 0 + // is this needed any more?? case QInternal::Widget: { const QWidget *widget = static_cast(pd); @@ -1818,13 +1775,6 @@ bool QPainter::begin(QPaintDevice *pd) const bool paintOutsidePaintEvent = widget->testAttribute(Qt::WA_PaintOutsidePaintEvent); const bool inPaintEvent = widget->testAttribute(Qt::WA_WState_InPaintEvent); - if(!d->engine->hasFeature(QPaintEngine::PaintOutsidePaintEvent) - && !paintOutsidePaintEvent && !inPaintEvent) { - qWarning("QPainter::begin: Widget painting can only begin as a " - "result of a paintEvent"); - qt_cleanup_painter_state(d); - return false; - } // Adjust offset for alien widgets painting outside the paint event. if (!inPaintEvent && paintOutsidePaintEvent && !widget->internalWinId() @@ -1834,6 +1784,7 @@ bool QPainter::begin(QPaintDevice *pd) } break; } +#endif case QInternal::Pixmap: { QPixmap *pm = static_cast(pd); @@ -1894,8 +1845,7 @@ bool QPainter::begin(QPaintDevice *pd) // Copy painter properties from original paint device, // required for QPixmap::grabWidget() if (d->original_device->devType() == QInternal::Widget) { - QWidget *widget = static_cast(d->original_device); - initFrom(widget); + initFrom(d->original_device); } else { d->state->layoutDirection = Qt::LayoutDirectionAuto; // make sure we have a font compatible with the paintdevice @@ -4606,82 +4556,6 @@ void QPainter::drawChord(const QRectF &r, int a, int alen) startAngle and \a spanAngle. */ -#ifdef QT3_SUPPORT -/*! - \fn void QPainter::drawLineSegments(const QPolygon &polygon, int - index, int count) - - Draws \a count separate lines from points defined by the \a - polygon, starting at \a{polygon}\e{[index]} (\a index defaults to - 0). If \a count is -1 (the default) all points until the end of - the array are used. - - Use drawLines() combined with QPolygon::constData() instead. - - \oldcode - QPainter painter(this); - painter.drawLineSegments(polygon, index, count); - \newcode - int lineCount = (count == -1) ? (polygon.size() - index) / 2 : count; - - QPainter painter(this); - painter.drawLines(polygon.constData() + index * 2, lineCount); - \endcode -*/ - -void QPainter::drawLineSegments(const QPolygon &a, int index, int nlines) -{ -#ifdef QT_DEBUG_DRAW - if (qt_show_painter_debug_output) - printf("QPainter::drawLineSegments(), count=%d\n", a.size()/2); -#endif - Q_D(QPainter); - - if (!d->engine) - return; - - if (nlines < 0) - nlines = a.size()/2 - index/2; - if (index + nlines*2 > (int)a.size()) - nlines = (a.size() - index)/2; - if (nlines < 1 || index < 0) - return; - - if (d->extended) { - // FALCON: Use QVectorPath - QVector lines; - for (int i=index; iextended->drawLines(lines.data(), lines.size()); - return; - } - - d->updateState(d->state); - - QVector lines; - if (d->state->emulationSpecifier) { - if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform - && d->state->matrix.type() == QTransform::TxTranslate) { - QPointF offset(d->state->matrix.dx(), d->state->matrix.dy()); - for (int i=index; idraw_helper(linesPath, QPainterPrivate::StrokeDraw); - return; - } - } else { - for (int i=index; iengine->drawLines(lines.data(), lines.size()); -} -#endif // QT3_SUPPORT /*! Draws the first \a lineCount lines in the array \a lines @@ -6467,7 +6341,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const const qreal underlinePos = pos.y() + qCeil(underlineOffset) - aliasedCoordinateDelta; if (underlineStyle == QTextCharFormat::SpellCheckUnderline) { - underlineStyle = QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle)); + underlineStyle = QTextCharFormat::SpellCheckUnderline; // ### Qt5 QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle)); } if (underlineStyle == QTextCharFormat::WaveUnderline) { @@ -7518,328 +7392,6 @@ void QPainter::setViewTransformEnabled(bool enable) d->updateMatrix(); } -#ifdef QT3_SUPPORT - -/*! - \obsolete - - Use the worldTransform() combined with QTransform::dx() instead. - - \oldcode - QPainter painter(this); - qreal x = painter.translationX(); - \newcode - QPainter painter(this); - qreal x = painter.worldTransform().dx(); - \endcode -*/ -qreal QPainter::translationX() const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::translationX: Painter not active"); - return 0.0; - } - return d->state->worldMatrix.dx(); -} - -/*! - \obsolete - - Use the worldTransform() combined with QTransform::dy() instead. - - \oldcode - QPainter painter(this); - qreal y = painter.translationY(); - \newcode - QPainter painter(this); - qreal y = painter.worldTransform().dy(); - \endcode -*/ -qreal QPainter::translationY() const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::translationY: Painter not active"); - return 0.0; - } - return d->state->worldMatrix.dy(); -} - -/*! - \fn void QPainter::map(int x, int y, int *rx, int *ry) const - - \internal - - Sets (\a{rx}, \a{ry}) to the point that results from applying the - painter's current transformation on the point (\a{x}, \a{y}). -*/ -void QPainter::map(int x, int y, int *rx, int *ry) const -{ - QPoint p(x, y); - p = p * combinedMatrix(); - *rx = p.x(); - *ry = p.y(); -} - -/*! - \fn QPoint QPainter::xForm(const QPoint &point) const - - Use combinedTransform() instead. -*/ - -QPoint QPainter::xForm(const QPoint &p) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xForm: Painter not active"); - return QPoint(); - } - if (d->state->matrix.type() == QTransform::TxNone) - return p; - return p * combinedMatrix(); -} - - -/*! - \fn QRect QPainter::xForm(const QRect &rectangle) const - \overload - - Use combinedTransform() instead of this function and call - mapRect() on the result to obtain a QRect. -*/ - -QRect QPainter::xForm(const QRect &r) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xForm: Painter not active"); - return QRect(); - } - if (d->state->matrix.type() == QTransform::TxNone) - return r; - return combinedMatrix().mapRect(r); -} - -/*! - \fn QPolygon QPainter::xForm(const QPolygon &polygon) const - \overload - - Use combinedTransform() instead. -*/ - -QPolygon QPainter::xForm(const QPolygon &a) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xForm: Painter not active"); - return QPolygon(); - } - if (d->state->matrix.type() == QTransform::TxNone) - return a; - return a * combinedMatrix(); -} - -/*! - \fn QPolygon QPainter::xForm(const QPolygon &polygon, int index, int count) const - \overload - - Use combinedTransform() combined with QPolygon::mid() instead. - - \oldcode - QPainter painter(this); - QPolygon transformed = painter.xForm(polygon, index, count) - \newcode - QPainter painter(this); - QPolygon transformed = polygon.mid(index, count) * painter.combinedTransform(); - \endcode -*/ - -QPolygon QPainter::xForm(const QPolygon &av, int index, int npoints) const -{ - int lastPoint = npoints < 0 ? av.size() : index+npoints; - QPolygon a(lastPoint-index); - memcpy(a.data(), av.data()+index, (lastPoint-index)*sizeof(QPoint)); - return a * combinedMatrix(); -} - -/*! - \fn QPoint QPainter::xFormDev(const QPoint &point) const - \overload - \obsolete - - Use combinedTransform() combined with QTransform::inverted() instead. - - \oldcode - QPainter painter(this); - QPoint transformed = painter.xFormDev(point); - \newcode - QPainter painter(this); - QPoint transformed = point * painter.combinedTransform().inverted(); - \endcode -*/ - -QPoint QPainter::xFormDev(const QPoint &p) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xFormDev: Painter not active"); - return QPoint(); - } - if(d->state->matrix.type() == QTransform::TxNone) - return p; - return p * combinedMatrix().inverted(); -} - -/*! - \fn QRect QPainter::xFormDev(const QRect &rectangle) const - \overload - \obsolete - - Use combinedTransform() combined with QTransform::inverted() instead. - - \oldcode - QPainter painter(this); - QRect transformed = painter.xFormDev(rectangle); - \newcode - QPainter painter(this); - QRegion region = QRegion(rectangle) * painter.combinedTransform().inverted(); - QRect transformed = region.boundingRect(); - \endcode -*/ - -QRect QPainter::xFormDev(const QRect &r) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xFormDev: Painter not active"); - return QRect(); - } - if (d->state->matrix.type() == QTransform::TxNone) - return r; - return combinedMatrix().inverted().mapRect(r); -} - -/*! - \overload - - \fn QPoint QPainter::xFormDev(const QPolygon &polygon) const - \obsolete - - Use combinedTransform() combined with QTransform::inverted() instead. - - \oldcode - QPainter painter(this); - QPolygon transformed = painter.xFormDev(rectangle); - \newcode - QPainter painter(this); - QPolygon transformed = polygon * painter.combinedTransform().inverted(); - \endcode -*/ - -QPolygon QPainter::xFormDev(const QPolygon &a) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xFormDev: Painter not active"); - return QPolygon(); - } - if (d->state->matrix.type() == QTransform::TxNone) - return a; - return a * combinedMatrix().inverted(); -} - -/*! - \fn QPolygon QPainter::xFormDev(const QPolygon &polygon, int index, int count) const - \overload - \obsolete - - Use combinedTransform() combined with QPolygon::mid() and QTransform::inverted() instead. - - \oldcode - QPainter painter(this); - QPolygon transformed = painter.xFormDev(polygon, index, count); - \newcode - QPainter painter(this); - QPolygon transformed = polygon.mid(index, count) * painter.combinedTransform().inverted(); - \endcode -*/ - -QPolygon QPainter::xFormDev(const QPolygon &ad, int index, int npoints) const -{ - Q_D(const QPainter); - int lastPoint = npoints < 0 ? ad.size() : index+npoints; - QPolygon a(lastPoint-index); - memcpy(a.data(), ad.data()+index, (lastPoint-index)*sizeof(QPoint)); - if (d->state->matrix.type() == QTransform::TxNone) - return a; - return a * combinedMatrix().inverted(); -} - -/*! - \fn void QPainter::drawCubicBezier(const QPolygon &controlPoints, int index) - - Draws a cubic Bezier curve defined by the \a controlPoints, - starting at \a{controlPoints}\e{[index]} (\a index defaults to 0). - Points after \a{controlPoints}\e{[index + 3]} are ignored. Nothing - happens if there aren't enough control points. - - Use strokePath() instead. - - \oldcode - QPainter painter(this); - painter.drawCubicBezier(controlPoints, index) - \newcode - QPainterPath path; - path.moveTo(controlPoints.at(index)); - path.cubicTo(controlPoints.at(index+1), - controlPoints.at(index+2), - controlPoints.at(index+3)); - - QPainter painter(this); - painter.strokePath(path, painter.pen()); - \endcode -*/ -void QPainter::drawCubicBezier(const QPolygon &a, int index) -{ - Q_D(QPainter); - - if (!d->engine) - return; - - if ((int)a.size() - index < 4) { - qWarning("QPainter::drawCubicBezier: Cubic Bezier needs 4 control " - "points"); - return; - } - - QPainterPath path; - path.moveTo(a.at(index)); - path.cubicTo(a.at(index+1), a.at(index+2), a.at(index+3)); - strokePath(path, d->state->pen); -} -#endif - -struct QPaintDeviceRedirection -{ - QPaintDeviceRedirection() : device(0), replacement(0), internalWidgetRedirectionIndex(-1) {} - QPaintDeviceRedirection(const QPaintDevice *device, QPaintDevice *replacement, - const QPoint& offset, int internalWidgetRedirectionIndex) - : device(device), replacement(replacement), offset(offset), - internalWidgetRedirectionIndex(internalWidgetRedirectionIndex) { } - const QPaintDevice *device; - QPaintDevice *replacement; - QPoint offset; - int internalWidgetRedirectionIndex; - bool operator==(const QPaintDevice *pdev) const { return device == pdev; } - Q_DUMMY_COMPARISON_OPERATOR(QPaintDeviceRedirection) -}; - -typedef QList QPaintDeviceRedirectionList; -Q_GLOBAL_STATIC(QPaintDeviceRedirectionList, globalRedirections) -Q_GLOBAL_STATIC(QMutex, globalRedirectionsMutex) -Q_GLOBAL_STATIC(QAtomicInt, globalRedirectionAtomic) - /*! \threadsafe @@ -7868,30 +7420,9 @@ void QPainter::setRedirected(const QPaintDevice *device, const QPoint &offset) { Q_ASSERT(device != 0); - - bool hadInternalWidgetRedirection = false; - if (device->devType() == QInternal::Widget) { - const QWidgetPrivate *widgetPrivate = static_cast(device)->d_func(); - // This is the case when the widget is in a paint event. - if (widgetPrivate->redirectDev) { - // Remove internal redirection and put it back into the global redirection list. - QPoint oldOffset; - QPaintDevice *oldReplacement = widgetPrivate->redirected(&oldOffset); - const_cast(widgetPrivate)->restoreRedirected(); - setRedirected(device, oldReplacement, oldOffset); - hadInternalWidgetRedirection = true; - } - } - - QPoint roffset; - QPaintDevice *rdev = redirected(replacement, &roffset); - - QMutexLocker locker(globalRedirectionsMutex()); - QPaintDeviceRedirectionList *redirections = globalRedirections(); - Q_ASSERT(redirections != 0); - *redirections += QPaintDeviceRedirection(device, rdev ? rdev : replacement, offset + roffset, - hadInternalWidgetRedirection ? redirections->size() - 1 : -1); - globalRedirectionAtomic()->ref(); + Q_UNUSED(replacement) + Q_UNUSED(offset) + qWarning("QPainter::setRedirected(): ignoring call to deprecated function, use QWidget::render() instead"); } /*! @@ -7913,29 +7444,8 @@ void QPainter::setRedirected(const QPaintDevice *device, */ void QPainter::restoreRedirected(const QPaintDevice *device) { - Q_ASSERT(device != 0); - QMutexLocker locker(globalRedirectionsMutex()); - QPaintDeviceRedirectionList *redirections = globalRedirections(); - Q_ASSERT(redirections != 0); - for (int i = redirections->size()-1; i >= 0; --i) { - if (redirections->at(i) == device) { - globalRedirectionAtomic()->deref(); - const int internalWidgetRedirectionIndex = redirections->at(i).internalWidgetRedirectionIndex; - redirections->removeAt(i); - // Restore the internal widget redirection, i.e. remove it from the global - // redirection list and put it back into QWidgetPrivate. The index is only set when - // someone call QPainter::setRedirected in a widget's paint event and we internally - // have a redirection set (typically set in QWidgetPrivate::drawWidget). - if (internalWidgetRedirectionIndex >= 0) { - Q_ASSERT(internalWidgetRedirectionIndex < redirections->size()); - const QPaintDeviceRedirection &redirectionDevice = redirections->at(internalWidgetRedirectionIndex); - QWidget *widget = static_cast(const_cast(device)); - widget->d_func()->setRedirected(redirectionDevice.replacement, redirectionDevice.offset); - redirections->removeAt(internalWidgetRedirectionIndex); - } - return; - } - } + Q_UNUSED(device) + qWarning("QPainter::restoreRedirected(): ignoring call to deprecated function, use QWidget::render() instead"); } /*! @@ -7957,61 +7467,11 @@ void QPainter::restoreRedirected(const QPaintDevice *device) */ QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset) { - Q_ASSERT(device != 0); - - if (device->devType() == QInternal::Widget) { - const QWidgetPrivate *widgetPrivate = static_cast(device)->d_func(); - if (widgetPrivate->redirectDev) - return widgetPrivate->redirected(offset); - } - - if (!globalRedirectionAtomic() || *globalRedirectionAtomic() == 0) - return 0; - - QMutexLocker locker(globalRedirectionsMutex()); - QPaintDeviceRedirectionList *redirections = globalRedirections(); - Q_ASSERT(redirections != 0); - for (int i = redirections->size()-1; i >= 0; --i) - if (redirections->at(i) == device) { - if (offset) - *offset = redirections->at(i).offset; - return redirections->at(i).replacement; - } - if (offset) - *offset = QPoint(0, 0); + Q_UNUSED(device) + Q_UNUSED(offset) return 0; } - -void qt_painter_removePaintDevice(QPaintDevice *dev) -{ - if (!globalRedirectionAtomic() || *globalRedirectionAtomic() == 0) - return; - - QMutex *mutex = 0; - QT_TRY { - mutex = globalRedirectionsMutex(); - } QT_CATCH(...) { - // ignore the missing mutex, since we could be called from - // a destructor, and destructors shall not throw - } - QMutexLocker locker(mutex); - QPaintDeviceRedirectionList *redirections = 0; - QT_TRY { - redirections = globalRedirections(); - } QT_CATCH(...) { - // do nothing - code below is safe with redirections being 0. - } - if (redirections) { - for (int i = 0; i < redirections->size(); ) { - if(redirections->at(i) == dev || redirections->at(i).replacement == dev) - redirections->removeAt(i); - else - ++i; - } - } -} - void qt_format_text(const QFont &fnt, const QRectF &_r, int tf, const QString& str, QRectF *brect, int tabstops, int *ta, int tabarraylen, @@ -8063,7 +7523,7 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, else layout_direction = Qt::LeftToRight; - tf = QStyle::visualAlignment(layout_direction, QFlag(tf)); + tf = QGuiApplicationPrivate::visualAlignment(layout_direction, QFlag(tf)); bool isRightToLeft = layout_direction == Qt::RightToLeft; bool expandtabs = ((tf & Qt::TextExpandTabs) && @@ -8323,7 +7783,7 @@ QPainterState::QPainterState() wx(0), wy(0), ww(0), wh(0), vx(0), vy(0), vw(0), vh(0), opacity(1), WxF(false), VxF(false), clipEnabled(true), bgMode(Qt::TransparentMode), painter(0), - layoutDirection(QApplication::layoutDirection()), + layoutDirection(QGuiApplication::layoutDirection()), composition_mode(QPainter::CompositionMode_SourceOver), emulationSpecifier(0), changeFlags(0) { @@ -8353,7 +7813,7 @@ void QPainterState::init(QPainter *p) { clipInfo.clear(); worldMatrix.reset(); matrix.reset(); - layoutDirection = QApplication::layoutDirection(); + layoutDirection = QGuiApplication::layoutDirection(); composition_mode = QPainter::CompositionMode_SourceOver; emulationSpecifier = 0; dirtyFlags = 0; @@ -8362,45 +7822,6 @@ void QPainterState::init(QPainter *p) { opacity = 1; } -#ifdef QT3_SUPPORT -static void bitBlt_helper(QPaintDevice *dst, const QPoint &dp, - const QPaintDevice *src, const QRect &sr, bool) -{ - Q_ASSERT(dst); - Q_ASSERT(src); - - if (src->devType() == QInternal::Pixmap) { - const QPixmap *pixmap = static_cast(src); - QPainter pt(dst); - pt.drawPixmap(dp, *pixmap, sr); - - } else { - qWarning("QPainter: bitBlt only works when source is of type pixmap"); - } -} - -void bitBlt(QPaintDevice *dst, int dx, int dy, - const QPaintDevice *src, int sx, int sy, int sw, int sh, - bool ignoreMask ) -{ - bitBlt_helper(dst, QPoint(dx, dy), src, QRect(sx, sy, sw, sh), ignoreMask); -} - -void bitBlt(QPaintDevice *dst, const QPoint &dp, const QPaintDevice *src, const QRect &sr, bool ignoreMask) -{ - bitBlt_helper(dst, dp, src, sr, ignoreMask); -} - -void bitBlt(QPaintDevice *dst, int dx, int dy, - const QImage *src, int sx, int sy, int sw, int sh, int fl) -{ - Qt::ImageConversionFlags flags(fl); - QPixmap srcPixmap = QPixmap::fromImage(*src, flags); - bitBlt_helper(dst, QPoint(dx, dy), &srcPixmap, QRect(sx, sy, sw, sh), false); -} - -#endif // QT3_SUPPORT - /*! \fn void QPainter::setBackgroundColor(const QColor &color) diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index 30f8da0928e..fd40111368e 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -49,7 +49,6 @@ #include #include #include -#include #ifndef QT_INCLUDE_COMPAT #include @@ -133,7 +132,7 @@ public: bool end(); bool isActive() const; - void initFrom(const QWidget *widget); + void initFrom(const QPaintDevice *device); enum CompositionMode { CompositionMode_SourceOver, @@ -464,85 +463,13 @@ public: void beginNativePainting(); void endNativePainting(); -#ifdef QT3_SUPPORT - - inline QT3_SUPPORT void setBackgroundColor(const QColor &color) { setBackground(color); } - inline QT3_SUPPORT const QColor &backgroundColor() const { return background().color(); } - - inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int pos, int len) - { drawText(x, y, s.mid(pos, len)); } - inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int pos, int len) - { drawText(p, s.mid(pos, len)); } - inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int len) - { drawText(x, y, s.left(len)); } - inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int len) - { drawText(p, s.left(len)); } - inline QT3_SUPPORT void drawText(const QRect &r, int flags, const QString &str, int len, QRect *br=0) - { drawText(r, flags, str.left(len), br); } - inline QT3_SUPPORT void drawText(int x, int y, int w, int h, int flags, const QString &text, int len, QRect *br=0) - { drawText(QRect(x, y, w, h), flags, text.left(len), br); } - inline QT3_SUPPORT QRect boundingRect(const QRect &rect, int flags, const QString &text, int len) - { return boundingRect(rect, flags, text.left(len)); } - inline QT3_SUPPORT QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text, int len) - { return boundingRect(QRect(x, y, w, h), flags, text.left(len)); } - - inline QT3_SUPPORT bool begin(QPaintDevice *pdev, const QWidget *init) - { bool ret = begin(pdev); initFrom(init); return ret; } - QT3_SUPPORT void drawPoints(const QPolygon &pa, int index, int npoints = -1) - { drawPoints(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); } - - QT3_SUPPORT void drawCubicBezier(const QPolygon &pa, int index = 0); - - QT3_SUPPORT void drawLineSegments(const QPolygon &points, int index = 0, int nlines = -1); - - inline QT3_SUPPORT void drawPolyline(const QPolygon &pa, int index, int npoints = -1) - { drawPolyline(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); } - - inline QT3_SUPPORT void drawPolygon(const QPolygon &pa, bool winding, int index = 0, int npoints = -1) - { drawPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints, - winding ? Qt::WindingFill : Qt::OddEvenFill); } - - inline QT3_SUPPORT void drawPolygon(const QPolygonF &polygon, bool winding, int index = 0, - int npoints = -1) - { drawPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints, - winding ? Qt::WindingFill : Qt::OddEvenFill); } - - inline QT3_SUPPORT void drawConvexPolygon(const QPolygonF &polygon, int index, int npoints = -1) - { drawConvexPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints); } - inline QT3_SUPPORT void drawConvexPolygon(const QPolygon &pa, int index, int npoints = -1) - { drawConvexPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); } - - static inline QT3_SUPPORT void redirect(QPaintDevice *pdev, QPaintDevice *replacement) - { setRedirected(pdev, replacement); } - static inline QT3_SUPPORT QPaintDevice *redirect(QPaintDevice *pdev) - { return const_cast(redirected(pdev)); } - - inline QT3_SUPPORT void setWorldXForm(bool enabled) { setMatrixEnabled(enabled); } - inline QT3_SUPPORT bool hasWorldXForm() const { return matrixEnabled(); } - inline QT3_SUPPORT void resetXForm() { resetTransform(); } - - inline QT3_SUPPORT void setViewXForm(bool enabled) { setViewTransformEnabled(enabled); } - inline QT3_SUPPORT bool hasViewXForm() const { return viewTransformEnabled(); } - - QT3_SUPPORT void map(int x, int y, int *rx, int *ry) const; - QT3_SUPPORT QPoint xForm(const QPoint &) const; // map virtual -> deviceb - QT3_SUPPORT QRect xForm(const QRect &) const; - QT3_SUPPORT QPolygon xForm(const QPolygon &) const; - QT3_SUPPORT QPolygon xForm(const QPolygon &, int index, int npoints) const; - QT3_SUPPORT QPoint xFormDev(const QPoint &) const; // map device -> virtual - QT3_SUPPORT QRect xFormDev(const QRect &) const; - QT3_SUPPORT QPolygon xFormDev(const QPolygon &) const; - QT3_SUPPORT QPolygon xFormDev(const QPolygon &, int index, int npoints) const; - QT3_SUPPORT qreal translationX() const; - QT3_SUPPORT qreal translationY() const; -#endif - private: Q_DISABLE_COPY(QPainter) friend class Q3Painter; QScopedPointer d_ptr; + friend class QWidget; friend class QFontEngine; friend class QFontEngineBox; friend class QFontEngineFT; diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h index 742cabda818..fe4a97ad4c8 100644 --- a/src/gui/painting/qpathclipper_p.h +++ b/src/gui/painting/qpathclipper_p.h @@ -68,7 +68,7 @@ QT_MODULE(Gui) class QWingedEdge; -class Q_AUTOTEST_EXPORT QPathClipper +class Q_GUI_EXPORT QPathClipper { public: enum Operation { diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 958e49907b0..47687e4a53f 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -44,20 +44,42 @@ #include #include #include -#include "private/qcups_p.h" -#include "qprinterinfo.h" #include #include "private/qfont_p.h" +#include +#include "qbuffer.h" +#include "QtCore/qdatetime.h" -#ifdef Q_OS_UNIX -#include "private/qcore_unix_p.h" // overrides QT_OPEN +#ifndef QT_NO_COMPRESS +#include #endif +#ifdef QT_NO_COMPRESS +static const bool do_compress = false; +#else +static const bool do_compress = true; +#endif + +// might be helpful for smooth transforms of images +// Can't use it though, as gs generates completely wrong images if this is true. +static const bool interpolateImages = false; + QT_BEGIN_NAMESPACE -#ifndef QT_NO_PRINTER +inline QPaintEngine::PaintEngineFeatures qt_pdf_decide_features() +{ + QPaintEngine::PaintEngineFeatures f = QPaintEngine::AllFeatures; + f &= ~(QPaintEngine::PorterDuff | QPaintEngine::PerspectiveTransform + | QPaintEngine::ObjectBoundingModeGradients +#ifndef USE_NATIVE_GRADIENTS + | QPaintEngine::LinearGradientFill +#endif + | QPaintEngine::RadialGradientFill + | QPaintEngine::ConicalGradientFill); + return f; +} + -extern QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size); /* also adds a space at the end of the number */ const char *qt_real_to_string(qreal val, char *buf) { @@ -891,67 +913,43 @@ const char *QPdf::toHex(uchar u, char *buffer) return buffer; } -#define Q_MM(n) int((n * 720 + 127) / 254) -#define Q_IN(n) int(n * 72) -static const char * const psToStr[QPrinter::NPaperSize+1] = +QPdfPage::QPdfPage() + : QPdf::ByteStream(true) // Enable file backing { - "A4", "B5", "Letter", "Legal", "Executive", - "A0", "A1", "A2", "A3", "A5", "A6", "A7", "A8", "A9", "B0", "B1", - "B10", "B2", "B3", "B4", "B6", "B7", "B8", "B9", "C5E", "Comm10E", - "DLE", "Folio", "Ledger", "Tabloid", 0 -}; - -QPdf::PaperSize QPdf::paperSize(QPrinter::PaperSize paperSize) -{ - QSizeF s = qt_paperSizeToQSizeF(paperSize); - PaperSize p = { Q_MM(s.width()), Q_MM(s.height()) }; - return p; } -const char *QPdf::paperSizeToString(QPrinter::PaperSize paperSize) +void QPdfPage::streamImage(int w, int h, int object) { - return psToStr[paperSize]; + *this << w << "0 0 " << -h << "0 " << h << "cm /Im" << object << " Do\n"; + if (!images.contains(object)) + images.append(object); } -// -------------------------- base engine, shared code between PS and PDF ----------------------- -QPdfBaseEngine::QPdfBaseEngine(QPdfBaseEnginePrivate &dd, PaintEngineFeatures f) - : QAlphaPaintEngine(dd, f) +QPdfEngine::QPdfEngine(QPdfEnginePrivate &dd) + : QPaintEngine(dd, qt_pdf_decide_features()) { - Q_D(QPdfBaseEngine); -#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - if (QCUPSSupport::isAvailable()) { - QCUPSSupport cups; - const cups_dest_t* printers = cups.availablePrinters(); - int prnCount = cups.availablePrintersCount(); - - for (int i = 0; i < prnCount; ++i) { - if (printers[i].is_default) { - d->printerName = QString::fromLocal8Bit(printers[i].name); - break; - } - } - - } else -#endif - { - d->printerName = QString::fromLocal8Bit(qgetenv("PRINTER")); - if (d->printerName.isEmpty()) - d->printerName = QString::fromLocal8Bit(qgetenv("LPDEST")); - if (d->printerName.isEmpty()) - d->printerName = QString::fromLocal8Bit(qgetenv("NPRINTER")); - if (d->printerName.isEmpty()) - d->printerName = QString::fromLocal8Bit(qgetenv("NGPRINTER")); - } } -void QPdfBaseEngine::drawPoints (const QPointF *points, int pointCount) +QPdfEngine::QPdfEngine() + : QPaintEngine(*new QPdfEnginePrivate(), qt_pdf_decide_features()) +{ +} + +void QPdfEngine::setOutputFilename(const QString &filename) +{ + Q_D(QPdfEngine); + d->outputFileName = filename; +} + + +void QPdfEngine::drawPoints (const QPointF *points, int pointCount) { if (!points) return; - Q_D(QPdfBaseEngine); + Q_D(QPdfEngine); QPainterPath p; for (int i=0; i!=pointCount;++i) { p.moveTo(points[i]); @@ -964,12 +962,12 @@ void QPdfBaseEngine::drawPoints (const QPointF *points, int pointCount) d->hasBrush = hadBrush; } -void QPdfBaseEngine::drawLines (const QLineF *lines, int lineCount) +void QPdfEngine::drawLines (const QLineF *lines, int lineCount) { if (!lines) return; - Q_D(QPdfBaseEngine); + Q_D(QPdfEngine); QPainterPath p; for (int i=0; i!=lineCount;++i) { p.moveTo(lines[i].p1()); @@ -981,17 +979,12 @@ void QPdfBaseEngine::drawLines (const QLineF *lines, int lineCount) d->hasBrush = hadBrush; } -void QPdfBaseEngine::drawRects (const QRectF *rects, int rectCount) +void QPdfEngine::drawRects (const QRectF *rects, int rectCount) { if (!rects) return; - Q_D(QPdfBaseEngine); - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawRects(rects, rectCount); - if (!continueCall()) - return; - } + Q_D(QPdfEngine); if (d->clipEnabled && d->allClipped) return; @@ -1016,15 +1009,9 @@ void QPdfBaseEngine::drawRects (const QRectF *rects, int rectCount) } } -void QPdfBaseEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) +void QPdfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) { - Q_D(QPdfBaseEngine); - - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawPolygon(points, pointCount, mode); - if (!continueCall()) - return; - } + Q_D(QPdfEngine); if (!points || !pointCount) return; @@ -1058,15 +1045,9 @@ void QPdfBaseEngine::drawPolygon(const QPointF *points, int pointCount, PolygonD d->hasBrush = hb; } -void QPdfBaseEngine::drawPath (const QPainterPath &p) +void QPdfEngine::drawPath (const QPainterPath &p) { - Q_D(QPdfBaseEngine); - - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawPath(p); - if (!continueCall()) - return; - } + Q_D(QPdfEngine); if (d->clipEnabled && d->allClipped) return; @@ -1091,15 +1072,92 @@ void QPdfBaseEngine::drawPath (const QPainterPath &p) } } -void QPdfBaseEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) +void QPdfEngine::drawPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QRectF &sr) { - Q_D(QPdfBaseEngine); + if (sr.isEmpty() || rectangle.isEmpty() || pixmap.isNull()) + return; + Q_D(QPdfEngine); - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawTextItem(p, textItem); - if (!continueCall()) - return; + QBrush b = d->brush; + + QRect sourceRect = sr.toRect(); + QPixmap pm = sourceRect != pixmap.rect() ? pixmap.copy(sourceRect) : pixmap; + QImage image = pm.toImage(); + bool bitmap = true; + const int object = d->addImage(image, &bitmap, pm.cacheKey()); + if (object < 0) + return; + + *d->currentPage << "q\n/GSa gs\n"; + *d->currentPage + << QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(), + rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix)); + if (bitmap) { + // set current pen as d->brush + d->brush = d->pen.brush(); } + setBrush(); + d->currentPage->streamImage(image.width(), image.height(), object); + *d->currentPage << "Q\n"; + + d->brush = b; +} + +void QPdfEngine::drawImage(const QRectF &rectangle, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags) +{ + if (sr.isEmpty() || rectangle.isEmpty() || image.isNull()) + return; + Q_D(QPdfEngine); + + QRect sourceRect = sr.toRect(); + QImage im = sourceRect != image.rect() ? image.copy(sourceRect) : image; + bool bitmap = true; + const int object = d->addImage(im, &bitmap, im.cacheKey()); + if (object < 0) + return; + + *d->currentPage << "q\n/GSa gs\n"; + *d->currentPage + << QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(), + rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix)); + setBrush(); + d->currentPage->streamImage(im.width(), im.height(), object); + *d->currentPage << "Q\n"; +} + +void QPdfEngine::drawTiledPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QPointF &point) +{ + Q_D(QPdfEngine); + + bool bitmap = (pixmap.depth() == 1); + QBrush b = d->brush; + QPointF bo = d->brushOrigin; + bool hp = d->hasPen; + d->hasPen = false; + bool hb = d->hasBrush; + d->hasBrush = true; + + d->brush = QBrush(pixmap); + if (bitmap) + // #### fix bitmap case where we have a brush pen + d->brush.setColor(d->pen.color()); + + d->brushOrigin = -point; + *d->currentPage << "q\n"; + setBrush(); + + drawRects(&rectangle, 1); + *d->currentPage << "Q\n"; + + d->hasPen = hp; + d->hasBrush = hb; + d->brush = b; + d->brushOrigin = bo; +} + +void QPdfEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) +{ + Q_D(QPdfEngine); if (!d->hasPen || (d->clipEnabled && d->allClipped)) return; @@ -1128,15 +1186,9 @@ void QPdfBaseEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) } -void QPdfBaseEngine::updateState(const QPaintEngineState &state) +void QPdfEngine::updateState(const QPaintEngineState &state) { - Q_D(QPdfBaseEngine); - - if (d->useAlphaEngine) { - QAlphaPaintEngine::updateState(state); - if (!continueCall()) - return; - } + Q_D(QPdfEngine); QPaintEngine::DirtyFlags flags = state.state(); @@ -1190,9 +1242,9 @@ void QPdfBaseEngine::updateState(const QPaintEngineState &state) setupGraphicsState(flags); } -void QPdfBaseEngine::setupGraphicsState(QPaintEngine::DirtyFlags flags) +void QPdfEngine::setupGraphicsState(QPaintEngine::DirtyFlags flags) { - Q_D(QPdfBaseEngine); + Q_D(QPdfEngine); if (flags & DirtyClipPath) flags |= DirtyTransform|DirtyPen|DirtyBrush; @@ -1233,9 +1285,9 @@ void QPdfBaseEngine::setupGraphicsState(QPaintEngine::DirtyFlags flags) extern QPainterPath qt_regionToPath(const QRegion ®ion); -void QPdfBaseEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op) +void QPdfEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op) { - Q_D(QPdfBaseEngine); + Q_D(QPdfEngine); QPainterPath path = d->stroker.matrix.map(p); //qDebug() << "updateClipPath: " << d->stroker.matrix << p.boundingRect() << path.boundingRect() << op; @@ -1254,43 +1306,18 @@ void QPdfBaseEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op) d->clips.clear(); d->clips.append(path); } - - if (d->useAlphaEngine) { - // if we have an alpha region, we have to subtract that from the - // any existing clip region since that region will be filled in - // later with images - QPainterPath alphaClip = qt_regionToPath(alphaClipping()); - if (!alphaClip.isEmpty()) { - if (!d->clipEnabled) { - QRect r = d->fullPage ? d->paperRect() : d->pageRect(); - QPainterPath dev; - dev.addRect(QRect(0, 0, r.width(), r.height())); - if (path.isEmpty()) - path = dev; - else - path = path.intersected(dev); - d->clipEnabled = true; - } else { - path = painter()->clipPath(); - path = d->stroker.matrix.map(path); - } - path = path.subtracted(alphaClip); - d->clips.clear(); - d->clips.append(path); - } - } } -void QPdfBaseEngine::setPen() +void QPdfEngine::setPen() { - Q_D(QPdfBaseEngine); + Q_D(QPdfEngine); if (d->pen.style() == Qt::NoPen) return; QBrush b = d->pen.brush(); Q_ASSERT(b.style() == Qt::SolidPattern && b.isOpaque()); QColor rgba = b.color(); - if (d->colorMode == QPrinter::GrayScale) { + if (d->grayscale) { qreal gray = qGray(rgba.rgba())/255.; *d->currentPage << gray << gray << gray; } else { @@ -1337,9 +1364,48 @@ void QPdfBaseEngine::setPen() *d->currentPage << QPdf::generateDashes(d->pen) << " 0 d\n"; } -bool QPdfBaseEngine::newPage() + +void QPdfEngine::setBrush() { - Q_D(QPdfBaseEngine); + Q_D(QPdfEngine); + Qt::BrushStyle style = d->brush.style(); + if (style == Qt::NoBrush) + return; + + bool specifyColor; + int gStateObject = 0; + int patternObject = d->addBrushPattern(d->stroker.matrix, &specifyColor, &gStateObject); + + *d->currentPage << (patternObject ? "/PCSp cs " : "/CSp cs "); + if (specifyColor) { + QColor rgba = d->brush.color(); + if (d->grayscale) { + qreal gray = qGray(rgba.rgba())/255.; + *d->currentPage << gray << gray << gray; + } else { + *d->currentPage << rgba.redF() + << rgba.greenF() + << rgba.blueF(); + } + } + if (patternObject) + *d->currentPage << "/Pat" << patternObject; + *d->currentPage << "scn\n"; + + if (gStateObject) + *d->currentPage << "/GState" << gStateObject << "gs\n"; + else + *d->currentPage << "/GSa gs\n"; +} + + +bool QPdfEngine::newPage() +{ + Q_D(QPdfEngine); + if (!isActive()) + return false; + d->newPage(); + setupGraphicsState(DirtyBrush|DirtyPen|DirtyClipPath); QFile *outfile = qobject_cast (d->outDevice); if (outfile && outfile->error() != QFile::NoError) @@ -1347,12 +1413,18 @@ bool QPdfBaseEngine::newPage() return true; } - -int QPdfBaseEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const +QPaintEngine::Type QPdfEngine::type() const { - Q_D(const QPdfBaseEngine); + return QPaintEngine::Pdf; +} + + + +int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const +{ + Q_D(const QPdfEngine); int val; - QRect r = d->fullPage ? d->paperRect() : d->pageRect(); + QRect r = d->pageRect(); switch (metricType) { case QPaintDevice::PdmWidth: val = r.width(); @@ -1381,244 +1453,53 @@ int QPdfBaseEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const val = 32; break; default: - qWarning("QPrinter::metric: Invalid metric command"); + qWarning("QPdfWriter::metric: Invalid metric command"); return 0; } return val; } -void QPdfBaseEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value) -{ - Q_D(QPdfBaseEngine); - switch (int(key)) { - case PPK_CollateCopies: - d->collate = value.toBool(); - break; - case PPK_ColorMode: - d->colorMode = QPrinter::ColorMode(value.toInt()); - break; - case PPK_Creator: - d->creator = value.toString(); - break; - case PPK_DocumentName: - d->title = value.toString(); - break; - case PPK_FullPage: - d->fullPage = value.toBool(); - break; - case PPK_CopyCount: // fallthrough - case PPK_NumberOfCopies: - d->copies = value.toInt(); - break; - case PPK_Orientation: - d->orientation = QPrinter::Orientation(value.toInt()); - break; - case PPK_OutputFileName: - d->outputFileName = value.toString(); - break; - case PPK_PageOrder: - d->pageOrder = QPrinter::PageOrder(value.toInt()); - break; - case PPK_PaperSize: - d->paperSize = QPrinter::PaperSize(value.toInt()); - break; - case PPK_PaperSource: - d->paperSource = QPrinter::PaperSource(value.toInt()); - break; - case PPK_PrinterName: - d->printerName = value.toString(); - break; - case PPK_PrinterProgram: - d->printProgram = value.toString(); - break; - case PPK_Resolution: - d->resolution = value.toInt(); - break; - case PPK_SelectionOption: - d->selectionOption = value.toString(); - break; - case PPK_FontEmbedding: - d->embedFonts = value.toBool(); - break; - case PPK_Duplex: - d->duplex = static_cast (value.toInt()); - break; - case PPK_CupsPageRect: - d->cupsPageRect = value.toRect(); - break; - case PPK_CupsPaperRect: - d->cupsPaperRect = value.toRect(); - break; - case PPK_CupsOptions: - d->cupsOptions = value.toStringList(); - break; - case PPK_CupsStringPageSize: - d->cupsStringPageSize = value.toString(); - break; - case PPK_CustomPaperSize: - d->paperSize = QPrinter::Custom; - d->customPaperSize = value.toSizeF(); - break; - case PPK_PageMargins: - { - QList margins(value.toList()); - Q_ASSERT(margins.size() == 4); - d->leftMargin = margins.at(0).toReal(); - d->topMargin = margins.at(1).toReal(); - d->rightMargin = margins.at(2).toReal(); - d->bottomMargin = margins.at(3).toReal(); - d->hasCustomPageMargins = true; - break; - } - default: - break; - } -} +#define Q_MM(n) int((n * 720 + 127) / 254) -QVariant QPdfBaseEngine::property(PrintEnginePropertyKey key) const -{ - Q_D(const QPdfBaseEngine); - - QVariant ret; - switch (int(key)) { - case PPK_CollateCopies: - ret = d->collate; - break; - case PPK_ColorMode: - ret = d->colorMode; - break; - case PPK_Creator: - ret = d->creator; - break; - case PPK_DocumentName: - ret = d->title; - break; - case PPK_FullPage: - ret = d->fullPage; - break; - case PPK_CopyCount: - ret = d->copies; - break; - case PPK_SupportsMultipleCopies: -#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - if (QCUPSSupport::isAvailable()) - ret = true; - else -#endif - ret = false; - break; - case PPK_NumberOfCopies: -#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - if (QCUPSSupport::isAvailable()) - ret = 1; - else -#endif - ret = d->copies; - break; - case PPK_Orientation: - ret = d->orientation; - break; - case PPK_OutputFileName: - ret = d->outputFileName; - break; - case PPK_PageOrder: - ret = d->pageOrder; - break; - case PPK_PaperSize: - ret = d->paperSize; - break; - case PPK_PaperSource: - ret = d->paperSource; - break; - case PPK_PrinterName: - ret = d->printerName; - break; - case PPK_PrinterProgram: - ret = d->printProgram; - break; - case PPK_Resolution: - ret = d->resolution; - break; - case PPK_SupportedResolutions: - ret = QList() << 72; - break; - case PPK_PaperRect: - ret = d->paperRect(); - break; - case PPK_PageRect: - ret = d->pageRect(); - break; - case PPK_SelectionOption: - ret = d->selectionOption; - break; - case PPK_FontEmbedding: - ret = d->embedFonts; - break; - case PPK_Duplex: - ret = d->duplex; - break; - case PPK_CupsPageRect: - ret = d->cupsPageRect; - break; - case PPK_CupsPaperRect: - ret = d->cupsPaperRect; - break; - case PPK_CupsOptions: - ret = d->cupsOptions; - break; - case PPK_CupsStringPageSize: - ret = d->cupsStringPageSize; - break; - case PPK_CustomPaperSize: - ret = d->customPaperSize; - break; - case PPK_PageMargins: - { - QList margins; - if (d->hasCustomPageMargins) { - margins << d->leftMargin << d->topMargin - << d->rightMargin << d->bottomMargin; - } else { - const qreal defaultMargin = 10; // ~3.5 mm - margins << defaultMargin << defaultMargin - << defaultMargin << defaultMargin; - } - ret = margins; - break; - } - default: - break; - } - return ret; -} - -QPdfBaseEnginePrivate::QPdfBaseEnginePrivate(QPrinter::PrinterMode m) +QPdfEnginePrivate::QPdfEnginePrivate() : clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false), - useAlphaEngine(false), - outDevice(0), fd(-1), - duplex(QPrinter::DuplexNone), collate(false), fullPage(false), embedFonts(true), copies(1), - pageOrder(QPrinter::FirstPageFirst), orientation(QPrinter::Portrait), - paperSize(QPrinter::A4), colorMode(QPrinter::Color), paperSource(QPrinter::Auto), - hasCustomPageMargins(false), - leftMargin(0), topMargin(0), rightMargin(0), bottomMargin(0) + outDevice(0), ownsDevice(false), + fullPage(false), embedFonts(true), + landscape(false), + grayscale(false), + paperSize(Q_MM(210), Q_MM(297)), // A4 + leftMargin(10), topMargin(10), rightMargin(10), bottomMargin(10) // ~3.5 mm { - resolution = 72; - if (m == QPrinter::HighResolution) - resolution = 1200; - else if (m == QPrinter::ScreenResolution) - resolution = qt_defaultDpi(); - + resolution = 1200; postscript = false; currentObject = 1; currentPage = 0; stroker.stream = 0; + + streampos = 0; + + stream = new QDataStream; } -bool QPdfBaseEngine::begin(QPaintDevice *pdev) +bool QPdfEngine::begin(QPaintDevice *pdev) { - Q_D(QPdfBaseEngine); + Q_D(QPdfEngine); d->pdev = pdev; + if (!d->outDevice) { + if (!d->outputFileName.isEmpty()) { + QFile *file = new QFile(d->outputFileName); + if (!file->open(QFile::WriteOnly|QFile::Truncate)) { + delete file; + return false; + } + d->outDevice = file; + } else { + return false; + } + d->ownsDevice = true; + } + d->postscript = false; d->currentObject = 1; @@ -1626,288 +1507,979 @@ bool QPdfBaseEngine::begin(QPaintDevice *pdev) d->stroker.stream = d->currentPage; d->opacity = 1.0; - return d->openPrintDevice(); + d->stream->setDevice(d->outDevice); + + d->streampos = 0; + d->hasPen = true; + d->hasBrush = false; + d->clipEnabled = false; + d->allClipped = false; + + d->xrefPositions.clear(); + d->pageRoot = 0; + d->catalog = 0; + d->info = 0; + d->graphicsState = 0; + d->patternColorSpace = 0; + + d->pages.clear(); + d->imageCache.clear(); + + setActive(true); + d->writeHeader(); + newPage(); + + return true; } -bool QPdfBaseEngine::end() +bool QPdfEngine::end() { - Q_D(QPdfBaseEngine); + Q_D(QPdfEngine); + d->writeTail(); + + d->stream->unsetDevice(); + qDeleteAll(d->fonts); d->fonts.clear(); delete d->currentPage; d->currentPage = 0; - d->closePrintDevice(); + if (d->outDevice && d->ownsDevice) { + d->outDevice->close(); + delete d->outDevice; + d->outDevice = 0; + } + + setActive(false); return true; } -#ifndef QT_NO_LPR -static void closeAllOpenFds() -{ - // hack time... getting the maximum number of open - // files, if possible. if not we assume it's the - // larger of 256 and the fd we got - int i; -#if defined(_SC_OPEN_MAX) - i = (int)sysconf(_SC_OPEN_MAX); -#elif defined(_POSIX_OPEN_MAX) - i = (int)_POSIX_OPEN_MAX; -#elif defined(OPEN_MAX) - i = (int)OPEN_MAX; -#else - i = 256; -#endif - // leave stdin/out/err untouched - while(--i > 2) - QT_CLOSE(i); -} -#endif - -bool QPdfBaseEnginePrivate::openPrintDevice() -{ - if(outDevice) - return false; - - if (!outputFileName.isEmpty()) { - QFile *file = new QFile(outputFileName); - if (! file->open(QFile::WriteOnly|QFile::Truncate)) { - delete file; - return false; - } - outDevice = file; -#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - } else if (QCUPSSupport::isAvailable()) { - QCUPSSupport cups; - QPair ret = cups.tempFd(); - if (ret.first < 0) { - qWarning("QPdfPrinter: Could not open temporary file to print"); - return false; - } - cupsTempFile = ret.second; - outDevice = new QFile(); - static_cast(outDevice)->open(ret.first, QIODevice::WriteOnly); -#endif -#ifndef QT_NO_LPR - } else { - QString pr; - if (!printerName.isEmpty()) - pr = printerName; - int fds[2]; - if (qt_safe_pipe(fds) != 0) { - qWarning("QPdfPrinter: Could not open pipe to print"); - return false; - } - - pid_t pid = fork(); - if (pid == 0) { // child process - // if possible, exit quickly, so the actual lp/lpr - // becomes a child of init, and ::waitpid() is - // guaranteed not to wait. - if (fork() > 0) { - closeAllOpenFds(); - - // try to replace this process with "true" - this prevents - // global destructors from being called (that could possibly - // do wrong things to the parent process) - (void)execlp("true", "true", (char *)0); - (void)execl("/bin/true", "true", (char *)0); - (void)execl("/usr/bin/true", "true", (char *)0); - ::_exit(0); - } - qt_safe_dup2(fds[0], 0, 0); - - closeAllOpenFds(); - - if (!printProgram.isEmpty()) { - if (!selectionOption.isEmpty()) - pr.prepend(selectionOption); - else - pr.prepend(QLatin1String("-P")); - (void)execlp(printProgram.toLocal8Bit().data(), printProgram.toLocal8Bit().data(), - pr.toLocal8Bit().data(), (char *)0); - } else { - // if no print program has been specified, be smart - // about the option string too. - QList lprhack; - QList lphack; - QByteArray media; - if (!pr.isEmpty() || !selectionOption.isEmpty()) { - if (!selectionOption.isEmpty()) { - QStringList list = selectionOption.split(QLatin1Char(' ')); - for (int i = 0; i < list.size(); ++i) - lprhack.append(list.at(i).toLocal8Bit()); - lphack = lprhack; - } else { - lprhack.append("-P"); - lphack.append("-d"); - } - lprhack.append(pr.toLocal8Bit()); - lphack.append(pr.toLocal8Bit()); - } - lphack.append("-s"); - - char ** lpargs = new char *[lphack.size()+6]; - char lp[] = "lp"; - lpargs[0] = lp; - int i; - for (i = 0; i < lphack.size(); ++i) - lpargs[i+1] = (char *)lphack.at(i).constData(); -#ifndef Q_OS_OSF - if (QPdf::paperSizeToString(paperSize)) { - char dash_o[] = "-o"; - lpargs[++i] = dash_o; - lpargs[++i] = const_cast(QPdf::paperSizeToString(paperSize)); - lpargs[++i] = dash_o; - media = "media="; - media += QPdf::paperSizeToString(paperSize); - lpargs[++i] = media.data(); - } -#endif - lpargs[++i] = 0; - char **lprargs = new char *[lprhack.size()+2]; - char lpr[] = "lpr"; - lprargs[0] = lpr; - for (int i = 0; i < lprhack.size(); ++i) - lprargs[i+1] = (char *)lprhack[i].constData(); - lprargs[lprhack.size() + 1] = 0; - (void)execvp("lp", lpargs); - (void)execvp("lpr", lprargs); - (void)execv("/bin/lp", lpargs); - (void)execv("/bin/lpr", lprargs); - (void)execv("/usr/bin/lp", lpargs); - (void)execv("/usr/bin/lpr", lprargs); - - delete []lpargs; - delete []lprargs; - } - // if we couldn't exec anything, close the fd, - // wait for a second so the parent process (the - // child of the GUI process) has exited. then - // exit. - QT_CLOSE(0); - (void)::sleep(1); - ::_exit(0); - } - // parent process - QT_CLOSE(fds[0]); - fd = fds[1]; - (void)qt_safe_waitpid(pid, 0, 0); - - if (fd < 0) - return false; - - outDevice = new QFile(); - static_cast(outDevice)->open(fd, QIODevice::WriteOnly); -#endif - } - - return true; -} - -void QPdfBaseEnginePrivate::closePrintDevice() -{ - if (!outDevice) - return; - outDevice->close(); - if (fd >= 0) -#if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400 - ::_close(fd); -#else - ::close(fd); -#endif - fd = -1; - delete outDevice; - outDevice = 0; - -#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - if (!cupsTempFile.isEmpty()) { - QString tempFile = cupsTempFile; - cupsTempFile.clear(); - QCUPSSupport cups; - - // Set up print options. - QByteArray prnName; - QList > options; - QVector cupsOptStruct; - - if (!printerName.isEmpty()) { - prnName = printerName.toLocal8Bit(); - } else { - QPrinterInfo def = QPrinterInfo::defaultPrinter(); - if (def.isNull()) { - qWarning("Could not determine printer to print to"); - QFile::remove(tempFile); - return; - } - prnName = def.printerName().toLocal8Bit(); - } - - if (!cupsStringPageSize.isEmpty()) { - options.append(QPair("media", cupsStringPageSize.toLocal8Bit())); - } - - if (copies > 1) { - options.append(QPair("copies", QString::number(copies).toLocal8Bit())); - } - - if (collate) { - options.append(QPair("Collate", "True")); - } - - if (duplex != QPrinter::DuplexNone) { - switch(duplex) { - case QPrinter::DuplexNone: break; - case QPrinter::DuplexAuto: - if (orientation == QPrinter::Portrait) - options.append(QPair("sides", "two-sided-long-edge")); - else - options.append(QPair("sides", "two-sided-short-edge")); - break; - case QPrinter::DuplexLongSide: - options.append(QPair("sides", "two-sided-long-edge")); - break; - case QPrinter::DuplexShortSide: - options.append(QPair("sides", "two-sided-short-edge")); - break; - } - } - - if (QCUPSSupport::cupsVersion() >= 10300 && orientation == QPrinter::Landscape) { - options.append(QPair("landscape", "")); - } - - QStringList::const_iterator it = cupsOptions.constBegin(); - while (it != cupsOptions.constEnd()) { - options.append(QPair((*it).toLocal8Bit(), (*(it+1)).toLocal8Bit())); - it += 2; - } - - for (int c = 0; c < options.size(); ++c) { - cups_option_t opt; - opt.name = options[c].first.data(); - opt.value = options[c].second.data(); - cupsOptStruct.append(opt); - } - - // Print the file. - cups_option_t* optPtr = cupsOptStruct.size() ? &cupsOptStruct.first() : 0; - cups.printFile(prnName.constData(), tempFile.toLocal8Bit().constData(), - title.toLocal8Bit().constData(), cupsOptStruct.size(), optPtr); - - QFile::remove(tempFile); - } -#endif -} - -QPdfBaseEnginePrivate::~QPdfBaseEnginePrivate() +QPdfEnginePrivate::~QPdfEnginePrivate() { qDeleteAll(fonts); delete currentPage; + delete stream; } -void QPdfBaseEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) +QRect QPdfEnginePrivate::paperRect() const { - Q_Q(QPdfBaseEngine); + int w = qRound(paperSize.width()*resolution/72.); + int h = qRound(paperSize.height()*resolution/72.); + + if (!landscape) + return QRect(0, 0, w, h); + else + return QRect(0, 0, h, w); +} + +QRect QPdfEnginePrivate::pageRect() const +{ + QRect r = paperRect(); + + if(!fullPage) + r.adjust(qRound(leftMargin*(resolution/72.)), + qRound(topMargin*(resolution/72.)), + -qRound(rightMargin*(resolution/72.)), + -qRound(bottomMargin*(resolution/72.))); + + return r; +} + + +void QPdfEnginePrivate::writeHeader() +{ + addXrefEntry(0,false); + + xprintf("%%PDF-1.4\n"); + + writeInfo(); + + catalog = addXrefEntry(-1); + pageRoot = requestObject(); + xprintf("<<\n" + "/Type /Catalog\n" + "/Pages %d 0 R\n" + ">>\n" + "endobj\n", pageRoot); + + // graphics state + graphicsState = addXrefEntry(-1); + xprintf("<<\n" + "/Type /ExtGState\n" + "/SA true\n" + "/SM 0.02\n" + "/ca 1.0\n" + "/CA 1.0\n" + "/AIS false\n" + "/SMask /None" + ">>\n" + "endobj\n"); + + // color space for pattern + patternColorSpace = addXrefEntry(-1); + xprintf("[/Pattern /DeviceRGB]\n" + "endobj\n"); +} + +void QPdfEnginePrivate::writeInfo() +{ + info = addXrefEntry(-1); + xprintf("<<\n/Title "); + printString(title); + xprintf("\n/Creator "); + printString(creator); + xprintf("\n/Producer "); + printString(QString::fromLatin1("Qt " QT_VERSION_STR " (C) 2011 Nokia Corporation and/or its subsidiary(-ies)")); + QDateTime now = QDateTime::currentDateTime().toUTC(); + QTime t = now.time(); + QDate d = now.date(); + xprintf("\n/CreationDate (D:%d%02d%02d%02d%02d%02d)\n", + d.year(), + d.month(), + d.day(), + t.hour(), + t.minute(), + t.second()); + xprintf(">>\n" + "endobj\n"); +} + +void QPdfEnginePrivate::writePageRoot() +{ + addXrefEntry(pageRoot); + + xprintf("<<\n" + "/Type /Pages\n" + "/Kids \n" + "[\n"); + int size = pages.size(); + for (int i = 0; i < size; ++i) + xprintf("%d 0 R\n", pages[i]); + xprintf("]\n"); + + //xprintf("/Group <>\n"); + xprintf("/Count %d\n", pages.size()); + + xprintf("/ProcSet [/PDF /Text /ImageB /ImageC]\n" + ">>\n" + "endobj\n"); +} + + +void QPdfEnginePrivate::embedFont(QFontSubset *font) +{ + //qDebug() << "embedFont" << font->object_id; + int fontObject = font->object_id; + QByteArray fontData = font->toTruetype(); +#ifdef FONT_DUMP + static int i = 0; + QString fileName("font%1.ttf"); + fileName = fileName.arg(i++); + QFile ff(fileName); + ff.open(QFile::WriteOnly); + ff.write(fontData); + ff.close(); +#endif + + int fontDescriptor = requestObject(); + int fontstream = requestObject(); + int cidfont = requestObject(); + int toUnicode = requestObject(); + + QFontEngine::Properties properties = font->fontEngine->properties(); + + { + qreal scale = 1000/properties.emSquare.toReal(); + addXrefEntry(fontDescriptor); + QByteArray descriptor; + QPdf::ByteStream s(&descriptor); + s << "<< /Type /FontDescriptor\n" + "/FontName /Q"; + int tag = fontDescriptor; + for (int i = 0; i < 5; ++i) { + s << (char)('A' + (tag % 26)); + tag /= 26; + } + s << '+' << properties.postscriptName << "\n" + "/Flags " << 4 << "\n" + "/FontBBox [" + << properties.boundingBox.x()*scale + << -(properties.boundingBox.y() + properties.boundingBox.height())*scale + << (properties.boundingBox.x() + properties.boundingBox.width())*scale + << -properties.boundingBox.y()*scale << "]\n" + "/ItalicAngle " << properties.italicAngle.toReal() << "\n" + "/Ascent " << properties.ascent.toReal()*scale << "\n" + "/Descent " << -properties.descent.toReal()*scale << "\n" + "/CapHeight " << properties.capHeight.toReal()*scale << "\n" + "/StemV " << properties.lineWidth.toReal()*scale << "\n" + "/FontFile2 " << fontstream << "0 R\n" + ">> endobj\n"; + write(descriptor); + } + { + addXrefEntry(fontstream); + QByteArray header; + QPdf::ByteStream s(&header); + + int length_object = requestObject(); + s << "<<\n" + "/Length1 " << fontData.size() << "\n" + "/Length " << length_object << "0 R\n"; + if (do_compress) + s << "/Filter /FlateDecode\n"; + s << ">>\n" + "stream\n"; + write(header); + int len = writeCompressed(fontData); + write("endstream\n" + "endobj\n"); + addXrefEntry(length_object); + xprintf("%d\n" + "endobj\n", len); + } + { + addXrefEntry(cidfont); + QByteArray cid; + QPdf::ByteStream s(&cid); + s << "<< /Type /Font\n" + "/Subtype /CIDFontType2\n" + "/BaseFont /" << properties.postscriptName << "\n" + "/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>\n" + "/FontDescriptor " << fontDescriptor << "0 R\n" + "/CIDToGIDMap /Identity\n" + << font->widthArray() << + ">>\n" + "endobj\n"; + write(cid); + } + { + addXrefEntry(toUnicode); + QByteArray touc = font->createToUnicodeMap(); + xprintf("<< /Length %d >>\n" + "stream\n", touc.length()); + write(touc); + write("endstream\n" + "endobj\n"); + } + { + addXrefEntry(fontObject); + QByteArray font; + QPdf::ByteStream s(&font); + s << "<< /Type /Font\n" + "/Subtype /Type0\n" + "/BaseFont /" << properties.postscriptName << "\n" + "/Encoding /Identity-H\n" + "/DescendantFonts [" << cidfont << "0 R]\n" + "/ToUnicode " << toUnicode << "0 R" + ">>\n" + "endobj\n"; + write(font); + } +} + + +void QPdfEnginePrivate::writeFonts() +{ + for (QHash::iterator it = fonts.begin(); it != fonts.end(); ++it) { + embedFont(*it); + delete *it; + } + fonts.clear(); +} + +void QPdfEnginePrivate::writePage() +{ + if (pages.empty()) + return; + + *currentPage << "Q Q\n"; + + uint pageStream = requestObject(); + uint pageStreamLength = requestObject(); + uint resources = requestObject(); + uint annots = requestObject(); + + addXrefEntry(pages.last()); + xprintf("<<\n" + "/Type /Page\n" + "/Parent %d 0 R\n" + "/Contents %d 0 R\n" + "/Resources %d 0 R\n" + "/Annots %d 0 R\n" + "/MediaBox [0 0 %d %d]\n" + ">>\n" + "endobj\n", + pageRoot, pageStream, resources, annots, + // make sure we use the pagesize from when we started the page, since the user may have changed it + currentPage->pageSize.width(), currentPage->pageSize.height()); + + addXrefEntry(resources); + xprintf("<<\n" + "/ColorSpace <<\n" + "/PCSp %d 0 R\n" + "/CSp /DeviceRGB\n" + "/CSpg /DeviceGray\n" + ">>\n" + "/ExtGState <<\n" + "/GSa %d 0 R\n", + patternColorSpace, graphicsState); + + for (int i = 0; i < currentPage->graphicStates.size(); ++i) + xprintf("/GState%d %d 0 R\n", currentPage->graphicStates.at(i), currentPage->graphicStates.at(i)); + xprintf(">>\n"); + + xprintf("/Pattern <<\n"); + for (int i = 0; i < currentPage->patterns.size(); ++i) + xprintf("/Pat%d %d 0 R\n", currentPage->patterns.at(i), currentPage->patterns.at(i)); + xprintf(">>\n"); + + xprintf("/Font <<\n"); + for (int i = 0; i < currentPage->fonts.size();++i) + xprintf("/F%d %d 0 R\n", currentPage->fonts[i], currentPage->fonts[i]); + xprintf(">>\n"); + + xprintf("/XObject <<\n"); + for (int i = 0; iimages.size(); ++i) { + xprintf("/Im%d %d 0 R\n", currentPage->images.at(i), currentPage->images.at(i)); + } + xprintf(">>\n"); + + xprintf(">>\n" + "endobj\n"); + + addXrefEntry(annots); + xprintf("[ "); + for (int i = 0; iannotations.size(); ++i) { + xprintf("%d 0 R ", currentPage->annotations.at(i)); + } + xprintf("]\nendobj\n"); + + addXrefEntry(pageStream); + xprintf("<<\n" + "/Length %d 0 R\n", pageStreamLength); // object number for stream length object + if (do_compress) + xprintf("/Filter /FlateDecode\n"); + + xprintf(">>\n"); + xprintf("stream\n"); + QIODevice *content = currentPage->stream(); + int len = writeCompressed(content); + xprintf("endstream\n" + "endobj\n"); + + addXrefEntry(pageStreamLength); + xprintf("%d\nendobj\n",len); +} + +void QPdfEnginePrivate::writeTail() +{ + writePage(); + writeFonts(); + writePageRoot(); + addXrefEntry(xrefPositions.size(),false); + xprintf("xref\n" + "0 %d\n" + "%010d 65535 f \n", xrefPositions.size()-1, xrefPositions[0]); + + for (int i = 1; i < xrefPositions.size()-1; ++i) + xprintf("%010d 00000 n \n", xrefPositions[i]); + + xprintf("trailer\n" + "<<\n" + "/Size %d\n" + "/Info %d 0 R\n" + "/Root %d 0 R\n" + ">>\n" + "startxref\n%d\n" + "%%%%EOF\n", + xrefPositions.size()-1, info, catalog, xrefPositions.last()); +} + +int QPdfEnginePrivate::addXrefEntry(int object, bool printostr) +{ + if (object < 0) + object = requestObject(); + + if (object>=xrefPositions.size()) + xrefPositions.resize(object+1); + + xrefPositions[object] = streampos; + if (printostr) + xprintf("%d 0 obj\n",object); + + return object; +} + +void QPdfEnginePrivate::printString(const QString &string) { + // The 'text string' type in PDF is encoded either as PDFDocEncoding, or + // Unicode UTF-16 with a Unicode byte order mark as the first character + // (0xfeff), with the high-order byte first. + QByteArray array("(\xfe\xff"); + const ushort *utf16 = string.utf16(); + + for (int i=0; i < string.size(); ++i) { + char part[2] = {char((*(utf16 + i)) >> 8), char((*(utf16 + i)) & 0xff)}; + for(int j=0; j < 2; ++j) { + if (part[j] == '(' || part[j] == ')' || part[j] == '\\') + array.append('\\'); + array.append(part[j]); + } + } + array.append(")"); + write(array); +} + + +// For strings up to 10000 bytes only ! +void QPdfEnginePrivate::xprintf(const char* fmt, ...) +{ + if (!stream) + return; + + const int msize = 10000; + char buf[msize]; + + va_list args; + va_start(args, fmt); + int bufsize = qvsnprintf(buf, msize, fmt, args); + + Q_ASSERT(bufsizewriteRawData(buf, bufsize); + streampos += bufsize; +} + +int QPdfEnginePrivate::writeCompressed(QIODevice *dev) +{ +#ifndef QT_NO_COMPRESS + if (do_compress) { + int size = QPdfPage::chunkSize(); + int sum = 0; + ::z_stream zStruct; + zStruct.zalloc = Z_NULL; + zStruct.zfree = Z_NULL; + zStruct.opaque = Z_NULL; + if (::deflateInit(&zStruct, Z_DEFAULT_COMPRESSION) != Z_OK) { + qWarning("QPdfStream::writeCompressed: Error in deflateInit()"); + return sum; + } + zStruct.avail_in = 0; + QByteArray in, out; + out.resize(size); + while (!dev->atEnd() || zStruct.avail_in != 0) { + if (zStruct.avail_in == 0) { + in = dev->read(size); + zStruct.avail_in = in.size(); + zStruct.next_in = reinterpret_cast(in.data()); + if (in.size() <= 0) { + qWarning("QPdfStream::writeCompressed: Error in read()"); + ::deflateEnd(&zStruct); + return sum; + } + } + zStruct.next_out = reinterpret_cast(out.data()); + zStruct.avail_out = out.size(); + if (::deflate(&zStruct, 0) != Z_OK) { + qWarning("QPdfStream::writeCompressed: Error in deflate()"); + ::deflateEnd(&zStruct); + return sum; + } + int written = out.size() - zStruct.avail_out; + stream->writeRawData(out.constData(), written); + streampos += written; + sum += written; + } + int ret; + do { + zStruct.next_out = reinterpret_cast(out.data()); + zStruct.avail_out = out.size(); + ret = ::deflate(&zStruct, Z_FINISH); + if (ret != Z_OK && ret != Z_STREAM_END) { + qWarning("QPdfStream::writeCompressed: Error in deflate()"); + ::deflateEnd(&zStruct); + return sum; + } + int written = out.size() - zStruct.avail_out; + stream->writeRawData(out.constData(), written); + streampos += written; + sum += written; + } while (ret == Z_OK); + + ::deflateEnd(&zStruct); + + return sum; + } else +#endif + { + QByteArray arr; + int sum = 0; + while (!dev->atEnd()) { + arr = dev->read(QPdfPage::chunkSize()); + stream->writeRawData(arr.constData(), arr.size()); + streampos += arr.size(); + sum += arr.size(); + } + return sum; + } +} + +int QPdfEnginePrivate::writeCompressed(const char *src, int len) +{ +#ifndef QT_NO_COMPRESS + if(do_compress) { + uLongf destLen = len + len/100 + 13; // zlib requirement + Bytef* dest = new Bytef[destLen]; + if (Z_OK == ::compress(dest, &destLen, (const Bytef*) src, (uLongf)len)) { + stream->writeRawData((const char*)dest, destLen); + } else { + qWarning("QPdfStream::writeCompressed: Error in compress()"); + destLen = 0; + } + delete [] dest; + len = destLen; + } else +#endif + { + stream->writeRawData(src,len); + } + streampos += len; + return len; +} + +int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth, + int maskObject, int softMaskObject, bool dct) +{ + int image = addXrefEntry(-1); + xprintf("<<\n" + "/Type /XObject\n" + "/Subtype /Image\n" + "/Width %d\n" + "/Height %d\n", width, height); + + if (depth == 1) { + xprintf("/ImageMask true\n" + "/Decode [1 0]\n"); + } else { + xprintf("/BitsPerComponent 8\n" + "/ColorSpace %s\n", (depth == 32) ? "/DeviceRGB" : "/DeviceGray"); + } + if (maskObject > 0) + xprintf("/Mask %d 0 R\n", maskObject); + if (softMaskObject > 0) + xprintf("/SMask %d 0 R\n", softMaskObject); + + int lenobj = requestObject(); + xprintf("/Length %d 0 R\n", lenobj); + if (interpolateImages) + xprintf("/Interpolate true\n"); + int len = 0; + if (dct) { + //qDebug() << "DCT"; + xprintf("/Filter /DCTDecode\n>>\nstream\n"); + write(data); + len = data.length(); + } else { + if (do_compress) + xprintf("/Filter /FlateDecode\n>>\nstream\n"); + else + xprintf(">>\nstream\n"); + len = writeCompressed(data); + } + xprintf("endstream\n" + "endobj\n"); + addXrefEntry(lenobj); + xprintf("%d\n" + "endobj\n", len); + return image; +} + +#ifdef USE_NATIVE_GRADIENTS +int QPdfEnginePrivate::gradientBrush(const QBrush &b, const QMatrix &matrix, int *gStateObject) +{ + const QGradient *gradient = b.gradient(); + if (!gradient) + return 0; + + QTransform inv = matrix.inverted(); + QPointF page_rect[4] = { inv.map(QPointF(0, 0)), + inv.map(QPointF(width_, 0)), + inv.map(QPointF(0, height_)), + inv.map(QPointF(width_, height_)) }; + + bool opaque = b.isOpaque(); + + QByteArray shader; + QByteArray alphaShader; + if (gradient->type() == QGradient::LinearGradient) { + const QLinearGradient *lg = static_cast(gradient); + shader = QPdf::generateLinearGradientShader(lg, page_rect); + if (!opaque) + alphaShader = QPdf::generateLinearGradientShader(lg, page_rect, true); + } else { + // ############# + return 0; + } + int shaderObject = addXrefEntry(-1); + write(shader); + + QByteArray str; + QPdf::ByteStream s(&str); + s << "<<\n" + "/Type /Pattern\n" + "/PatternType 2\n" + "/Shading " << shaderObject << "0 R\n" + "/Matrix [" + << matrix.m11() + << matrix.m12() + << matrix.m21() + << matrix.m22() + << matrix.dx() + << matrix.dy() << "]\n"; + s << ">>\n" + "endobj\n"; + + int patternObj = addXrefEntry(-1); + write(str); + currentPage->patterns.append(patternObj); + + if (!opaque) { + bool ca = true; + QGradientStops stops = gradient->stops(); + int a = stops.at(0).second.alpha(); + for (int i = 1; i < stops.size(); ++i) { + if (stops.at(i).second.alpha() != a) { + ca = false; + break; + } + } + if (ca) { + *gStateObject = addConstantAlphaObject(stops.at(0).second.alpha()); + } else { + int alphaShaderObject = addXrefEntry(-1); + write(alphaShader); + + QByteArray content; + QPdf::ByteStream c(&content); + c << "/Shader" << alphaShaderObject << "sh\n"; + + QByteArray form; + QPdf::ByteStream f(&form); + f << "<<\n" + "/Type /XObject\n" + "/Subtype /Form\n" + "/BBox [0 0 " << width_ << height_ << "]\n" + "/Group <>\n" + "/Resources <<\n" + "/Shading << /Shader" << alphaShaderObject << alphaShaderObject << "0 R >>\n" + ">>\n"; + + f << "/Length " << content.length() << "\n" + ">>\n" + "stream\n" + << content + << "endstream\n" + "endobj\n"; + + int softMaskFormObject = addXrefEntry(-1); + write(form); + *gStateObject = addXrefEntry(-1); + xprintf("<< /SMask << /S /Alpha /G %d 0 R >> >>\n" + "endobj\n", softMaskFormObject); + currentPage->graphicStates.append(*gStateObject); + } + } + + return patternObj; +} +#endif + +int QPdfEnginePrivate::addConstantAlphaObject(int brushAlpha, int penAlpha) +{ + if (brushAlpha == 255 && penAlpha == 255) + return 0; + int object = alphaCache.value(QPair(brushAlpha, penAlpha), 0); + if (!object) { + object = addXrefEntry(-1); + QByteArray alphaDef; + QPdf::ByteStream s(&alphaDef); + s << "<<\n/ca " << (brushAlpha/qreal(255.)) << '\n'; + s << "/CA " << (penAlpha/qreal(255.)) << "\n>>"; + xprintf("%s\nendobj\n", alphaDef.constData()); + alphaCache.insert(QPair(brushAlpha, penAlpha), object); + } + if (currentPage->graphicStates.indexOf(object) < 0) + currentPage->graphicStates.append(object); + + return object; +} + +int QPdfEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor, int *gStateObject) +{ + int paintType = 2; // Uncolored tiling + int w = 8; + int h = 8; + + *specifyColor = true; + *gStateObject = 0; + + QTransform matrix = m; + matrix.translate(brushOrigin.x(), brushOrigin.y()); + matrix = matrix * pageMatrix(); + //qDebug() << brushOrigin << matrix; + + Qt::BrushStyle style = brush.style(); + if (style == Qt::LinearGradientPattern) {// && style <= Qt::ConicalGradientPattern) { +#ifdef USE_NATIVE_GRADIENTS + *specifyColor = false; + return gradientBrush(b, matrix, gStateObject); +#else + return 0; +#endif + } + + if ((!brush.isOpaque() && brush.style() < Qt::LinearGradientPattern) || opacity != 1.0) + *gStateObject = addConstantAlphaObject(qRound(brush.color().alpha() * opacity), + qRound(pen.color().alpha() * opacity)); + + int imageObject = -1; + QByteArray pattern = QPdf::patternForBrush(brush); + if (pattern.isEmpty()) { + if (brush.style() != Qt::TexturePattern) + return 0; + QImage image = brush.texture().toImage(); + bool bitmap = true; + imageObject = addImage(image, &bitmap, brush.texture().cacheKey()); + if (imageObject != -1) { + QImage::Format f = image.format(); + if (f != QImage::Format_MonoLSB && f != QImage::Format_Mono) { + paintType = 1; // Colored tiling + *specifyColor = false; + } + w = image.width(); + h = image.height(); + QTransform m(w, 0, 0, -h, 0, h); + QPdf::ByteStream s(&pattern); + s << QPdf::generateMatrix(m); + s << "/Im" << imageObject << " Do\n"; + } + } + + QByteArray str; + QPdf::ByteStream s(&str); + s << "<<\n" + "/Type /Pattern\n" + "/PatternType 1\n" + "/PaintType " << paintType << "\n" + "/TilingType 1\n" + "/BBox [0 0 " << w << h << "]\n" + "/XStep " << w << "\n" + "/YStep " << h << "\n" + "/Matrix [" + << matrix.m11() + << matrix.m12() + << matrix.m21() + << matrix.m22() + << matrix.dx() + << matrix.dy() << "]\n" + "/Resources \n<< "; // open resource tree + if (imageObject > 0) { + s << "/XObject << /Im" << imageObject << ' ' << imageObject << "0 R >> "; + } + s << ">>\n" + "/Length " << pattern.length() << "\n" + ">>\n" + "stream\n" + << pattern + << "endstream\n" + "endobj\n"; + + int patternObj = addXrefEntry(-1); + write(str); + currentPage->patterns.append(patternObj); + return patternObj; +} + +/*! + * Adds an image to the pdf and return the pdf-object id. Returns -1 if adding the image failed. + */ +int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_no) +{ + if (img.isNull()) + return -1; + + int object = imageCache.value(serial_no); + if(object) + return object; + + QImage image = img; + QImage::Format format = image.format(); + if (image.depth() == 1 && *bitmap && img.colorTable().size() == 2 + && img.colorTable().at(0) == QColor(Qt::black).rgba() + && img.colorTable().at(1) == QColor(Qt::white).rgba()) + { + if (format == QImage::Format_MonoLSB) + image = image.convertToFormat(QImage::Format_Mono); + format = QImage::Format_Mono; + } else { + *bitmap = false; + if (format != QImage::Format_RGB32 && format != QImage::Format_ARGB32) { + image = image.convertToFormat(QImage::Format_ARGB32); + format = QImage::Format_ARGB32; + } + } + + int w = image.width(); + int h = image.height(); + int d = image.depth(); + + if (format == QImage::Format_Mono) { + int bytesPerLine = (w + 7) >> 3; + QByteArray data; + data.resize(bytesPerLine * h); + char *rawdata = data.data(); + for (int y = 0; y < h; ++y) { + memcpy(rawdata, image.scanLine(y), bytesPerLine); + rawdata += bytesPerLine; + } + object = writeImage(data, w, h, d, 0, 0); + } else { + QByteArray softMaskData; + bool dct = false; + QByteArray imageData; + bool hasAlpha = false; + bool hasMask = false; + + if (QImageWriter::supportedImageFormats().contains("jpeg") && !grayscale) { + QBuffer buffer(&imageData); + QImageWriter writer(&buffer, "jpeg"); + writer.setQuality(94); + writer.write(image); + dct = true; + + if (format != QImage::Format_RGB32) { + softMaskData.resize(w * h); + uchar *sdata = (uchar *)softMaskData.data(); + for (int y = 0; y < h; ++y) { + const QRgb *rgb = (const QRgb *)image.scanLine(y); + for (int x = 0; x < w; ++x) { + uchar alpha = qAlpha(*rgb); + *sdata++ = alpha; + hasMask |= (alpha < 255); + hasAlpha |= (alpha != 0 && alpha != 255); + ++rgb; + } + } + } + } else { + imageData.resize(grayscale ? w * h : 3 * w * h); + uchar *data = (uchar *)imageData.data(); + softMaskData.resize(w * h); + uchar *sdata = (uchar *)softMaskData.data(); + for (int y = 0; y < h; ++y) { + const QRgb *rgb = (const QRgb *)image.scanLine(y); + if (grayscale) { + for (int x = 0; x < w; ++x) { + *(data++) = qGray(*rgb); + uchar alpha = qAlpha(*rgb); + *sdata++ = alpha; + hasMask |= (alpha < 255); + hasAlpha |= (alpha != 0 && alpha != 255); + ++rgb; + } + } else { + for (int x = 0; x < w; ++x) { + *(data++) = qRed(*rgb); + *(data++) = qGreen(*rgb); + *(data++) = qBlue(*rgb); + uchar alpha = qAlpha(*rgb); + *sdata++ = alpha; + hasMask |= (alpha < 255); + hasAlpha |= (alpha != 0 && alpha != 255); + ++rgb; + } + } + } + if (format == QImage::Format_RGB32) + hasAlpha = hasMask = false; + } + int maskObject = 0; + int softMaskObject = 0; + if (hasAlpha) { + softMaskObject = writeImage(softMaskData, w, h, 8, 0, 0); + } else if (hasMask) { + // dither the soft mask to 1bit and add it. This also helps PDF viewers + // without transparency support + int bytesPerLine = (w + 7) >> 3; + QByteArray mask(bytesPerLine * h, 0); + uchar *mdata = (uchar *)mask.data(); + const uchar *sdata = (const uchar *)softMaskData.constData(); + for (int y = 0; y < h; ++y) { + for (int x = 0; x < w; ++x) { + if (*sdata) + mdata[x>>3] |= (0x80 >> (x&7)); + ++sdata; + } + mdata += bytesPerLine; + } + maskObject = writeImage(mask, w, h, 1, 0, 0); + } + object = writeImage(imageData, w, h, grayscale ? 8 : 32, + maskObject, softMaskObject, dct); + } + imageCache.insert(serial_no, object); + return object; +} + +void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) +{ + Q_Q(QPdfEngine); + + if (ti.charFormat.isAnchor()) { + qreal size = ti.fontEngine->fontDef.pixelSize; +#ifdef Q_WS_WIN + if (ti.fontEngine->type() == QFontEngine::Win) { + QFontEngineWin *fe = static_cast(ti.fontEngine); + size = fe->tm.tmHeight; + } +#endif + int synthesized = ti.fontEngine->synthesized(); + qreal stretch = synthesized & QFontEngine::SynthesizedStretch ? ti.fontEngine->fontDef.stretch/100. : 1.; + + QTransform trans; + // Build text rendering matrix (Trm). We need it to map the text area to user + // space units on the PDF page. + trans = QTransform(size*stretch, 0, 0, size, 0, 0); + // Apply text matrix (Tm). + trans *= QTransform(1,0,0,-1,p.x(),p.y()); + // Apply page displacement (Identity for first page). + trans *= stroker.matrix; + // Apply Current Transformation Matrix (CTM) + trans *= pageMatrix(); + qreal x1, y1, x2, y2; + trans.map(0, 0, &x1, &y1); + trans.map(ti.width.toReal()/size, (ti.ascent.toReal()-ti.descent.toReal())/size, &x2, &y2); + + uint annot = addXrefEntry(-1); +#ifdef Q_DEBUG_PDF_LINKS + xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect [%f %f %f %f]\n/Border [16 16 1]\n/A <<\n", +#else + xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect [%f %f %f %f]\n/Border [0 0 0]\n/A <<\n", +#endif + static_cast(x1), + static_cast(y1), + static_cast(x2), + static_cast(y2)); + xprintf("/Type /Action\n/S /URI\n/URI (%s)\n", + ti.charFormat.anchorHref().toLatin1().constData()); + xprintf(">>\n>>\n"); + xprintf("endobj\n"); + + if (!currentPage->annotations.contains(annot)) { + currentPage->annotations.append(annot); + } + } QFontEngine *fe = ti.fontEngine; @@ -2024,83 +2596,33 @@ void QPdfBaseEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &t *currentPage << "ET\n"; } -QRect QPdfBaseEnginePrivate::paperRect() const +QTransform QPdfEnginePrivate::pageMatrix() const { - int w; - int h; - if (paperSize == QPrinter::Custom) { - w = qRound(customPaperSize.width()*resolution/72.); - h = qRound(customPaperSize.height()*resolution/72.); - } else { -#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - if (QCUPSSupport::isAvailable() && !cupsPaperRect.isNull()) { - QRect r = cupsPaperRect; - w = r.width(); - h = r.height(); - } else -#endif - { - QPdf::PaperSize s = QPdf::paperSize(paperSize); - w = s.width; - h = s.height; - } - w = qRound(w*resolution/72.); - h = qRound(h*resolution/72.); + qreal scale = 72./resolution; + QTransform tmp(scale, 0.0, 0.0, -scale, 0.0, height()); + if (!fullPage) { + QRect r = pageRect(); + tmp.translate(r.left(), r.top()); } - if (orientation == QPrinter::Portrait) - return QRect(0, 0, w, h); - else - return QRect(0, 0, h, w); + return tmp; } -QRect QPdfBaseEnginePrivate::pageRect() const +void QPdfEnginePrivate::newPage() { - if(fullPage) - return paperRect(); + if (currentPage && currentPage->pageSize.isEmpty()) + currentPage->pageSize = QSize(width(), height()); + writePage(); - QRect r; + delete currentPage; + currentPage = new QPdfPage; + currentPage->pageSize = QSize(width(), height()); + stroker.stream = currentPage; + pages.append(requestObject()); -#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - if (!hasCustomPageMargins && QCUPSSupport::isAvailable() && !cupsPageRect.isNull()) { - r = cupsPageRect; - if (r == cupsPaperRect) { - // if cups doesn't define any margins, give it at least approx 3.5 mm - r = QRect(10, 10, r.width() - 20, r.height() - 20); - } - } else -#endif - { - QPdf::PaperSize s; - if (paperSize == QPrinter::Custom) { - s.width = qRound(customPaperSize.width()); - s.height = qRound(customPaperSize.height()); - } else { - s = QPdf::paperSize(paperSize); - } - if (hasCustomPageMargins) - r = QRect(0, 0, s.width, s.height); - else - r = QRect(72/3, 72/3, s.width - 2*72/3, s.height - 2*72/3); - } - - int x = qRound(r.left()*resolution/72.); - int y = qRound(r.top()*resolution/72.); - int w = qRound(r.width()*resolution/72.); - int h = qRound(r.height()*resolution/72.); - if (orientation == QPrinter::Portrait) - r = QRect(x, y, w, h); - else - r = QRect(y, x, h, w); - - if (hasCustomPageMargins) { - r.adjust(qRound(leftMargin*(resolution/72.)), - qRound(topMargin*(resolution/72.)), - -qRound(rightMargin*(resolution/72.)), - -qRound(bottomMargin*(resolution/72.))); - } - return r; + *currentPage << "/GSa gs /CSp cs /CSp CS\n" + << QPdf::generateMatrix(pageMatrix()) + << "q q\n"; } -#endif QT_END_NAMESPACE diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 8cc56befe18..6df5052c060 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -56,22 +56,14 @@ #include "QtCore/qstring.h" #include "QtCore/qvector.h" #include "private/qstroker_p.h" +#include "private/qpaintengine_p.h" #include "private/qfontengine_p.h" -#include "QtGui/qprinter.h" #include "private/qfontsubset_p.h" -#include "private/qpaintengine_alpha_p.h" -#include "qprintengine.h" -#include "qbuffer.h" -#ifndef QT_NO_PRINTER +// #define USE_NATIVE_GRADIENTS QT_BEGIN_NAMESPACE -#define PPK_CupsOptions QPrintEngine::PrintEnginePropertyKey(0xfe00) -#define PPK_CupsPageRect QPrintEngine::PrintEnginePropertyKey(0xfe01) -#define PPK_CupsPaperRect QPrintEngine::PrintEnginePropertyKey(0xfe02) -#define PPK_CupsStringPageSize QPrintEngine::PrintEnginePropertyKey(0xfe03) - const char *qt_real_to_string(qreal val, char *buf); const char *qt_int_to_string(int val, char *buf); @@ -149,13 +141,6 @@ namespace QPdf { const char *toHex(ushort u, char *buffer); const char *toHex(uchar u, char *buffer); - - struct PaperSize { - int width, height; // in postscript points - }; - PaperSize paperSize(QPrinter::PaperSize paperSize); - const char *paperSizeToString(QPrinter::PaperSize paperSize); - } @@ -176,15 +161,20 @@ public: private: }; +class QPdfWriter; +class QPdfEnginePrivate; -class QPdfBaseEnginePrivate; - -class QPdfBaseEngine : public QAlphaPaintEngine, public QPrintEngine +class Q_GUI_EXPORT QPdfEngine : public QPaintEngine { - Q_DECLARE_PRIVATE(QPdfBaseEngine) + Q_DECLARE_PRIVATE(QPdfEngine) + friend class QPdfWriter; public: - QPdfBaseEngine(QPdfBaseEnginePrivate &d, PaintEngineFeatures f); - ~QPdfBaseEngine() {} + QPdfEngine(); + QPdfEngine(QPdfEnginePrivate &d); + ~QPdfEngine() {} + + void setOutputFilename(const QString &filename); + inline void setResolution(int resolution); // reimplementations QPaintEngine bool begin(QPaintDevice *pdev); @@ -198,41 +188,62 @@ public: void drawTextItem(const QPointF &p, const QTextItem &textItem); + void drawPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QRectF & sr); + void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, + Qt::ImageConversionFlags flags = Qt::AutoColor); + void drawTiledPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QPointF & point); + void updateState(const QPaintEngineState &state); int metric(QPaintDevice::PaintDeviceMetric metricType) const; + Type type() const; // end reimplementations QPaintEngine // Printer stuff... bool newPage(); - void setProperty(PrintEnginePropertyKey key, const QVariant &value); - QVariant property(PrintEnginePropertyKey key) const; void setPen(); - virtual void setBrush() = 0; + void setBrush(); void setupGraphicsState(QPaintEngine::DirtyFlags flags); private: void updateClipPath(const QPainterPath & path, Qt::ClipOperation op); }; -class QPdfBaseEnginePrivate : public QAlphaPaintEnginePrivate +class Q_GUI_EXPORT QPdfEnginePrivate : public QPaintEnginePrivate { - Q_DECLARE_PUBLIC(QPdfBaseEngine) + Q_DECLARE_PUBLIC(QPdfEngine) public: - QPdfBaseEnginePrivate(QPrinter::PrinterMode m); - ~QPdfBaseEnginePrivate(); + QPdfEnginePrivate(); + ~QPdfEnginePrivate(); - bool openPrintDevice(); - void closePrintDevice(); - - - virtual void drawTextItem(const QPointF &p, const QTextItemInt &ti); inline uint requestObject() { return currentObject++; } QRect paperRect() const; QRect pageRect() const; + int width() const { + QRect r = paperRect(); + return qRound(r.width()*72./resolution); + } + int height() const { + QRect r = paperRect(); + return qRound(r.height()*72./resolution); + } + + void writeHeader(); + void writeTail(); + + int addImage(const QImage &image, bool *bitmap, qint64 serial_no); + int addConstantAlphaObject(int brushAlpha, int penAlpha = 255); + int addBrushPattern(const QTransform &matrix, bool *specifyColor, int *gStateObject); + + void drawTextItem(const QPointF &p, const QTextItemInt &ti); + + QTransform pageMatrix() const; + + void newPage(); + bool postscript; int currentObject; @@ -249,7 +260,6 @@ public: bool hasBrush; bool simplePen; qreal opacity; - bool useAlphaEngine; QHash fonts; @@ -257,43 +267,70 @@ public: // the device the output is in the end streamed to. QIODevice *outDevice; - int fd; + bool ownsDevice; // printer options QString outputFileName; - QString printerName; - QString printProgram; - QString selectionOption; QString title; QString creator; - QPrinter::DuplexMode duplex; - bool collate; bool fullPage; bool embedFonts; - int copies; int resolution; - QPrinter::PageOrder pageOrder; - QPrinter::Orientation orientation; - QPrinter::PaperSize paperSize; - QPrinter::ColorMode colorMode; - QPrinter::PaperSource paperSource; + bool landscape; + bool grayscale; - QStringList cupsOptions; - QRect cupsPaperRect; - QRect cupsPageRect; - QString cupsStringPageSize; - QSizeF customPaperSize; // in postscript points - bool hasCustomPageMargins; + // in postscript points + QSizeF paperSize; qreal leftMargin, topMargin, rightMargin, bottomMargin; #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) QString cupsTempFile; #endif + +private: +#ifdef USE_NATIVE_GRADIENTS + int gradientBrush(const QBrush &b, const QMatrix &matrix, int *gStateObject); +#endif + + void writeInfo(); + void writePageRoot(); + void writeFonts(); + void embedFont(QFontSubset *font); + + QVector xrefPositions; + QDataStream* stream; + int streampos; + + int writeImage(const QByteArray &data, int width, int height, int depth, + int maskObject, int softMaskObject, bool dct = false); + void writePage(); + + int addXrefEntry(int object, bool printostr = true); + void printString(const QString &string); + void xprintf(const char* fmt, ...); + inline void write(const QByteArray &data) { + stream->writeRawData(data.constData(), data.size()); + streampos += data.size(); + } + + int writeCompressed(const char *src, int len); + inline int writeCompressed(const QByteArray &data) { return writeCompressed(data.constData(), data.length()); } + int writeCompressed(QIODevice *dev); + + // various PDF objects + int pageRoot, catalog, info, graphicsState, patternColorSpace; + QVector pages; + QHash imageCache; + QHash, uint > alphaCache; }; +void QPdfEngine::setResolution(int resolution) +{ + Q_D(QPdfEngine); + d->resolution = resolution; +} + QT_END_NAMESPACE -#endif // QT_NO_PRINTER - #endif // QPDF_P_H diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp new file mode 100644 index 00000000000..9da5491d196 --- /dev/null +++ b/src/gui/painting/qpdfwriter.cpp @@ -0,0 +1,212 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include "private/qpdf_p.h" +#include + + +class QPdfWriterPrivate : public QObjectPrivate +{ +public: + QPdfWriterPrivate() + : QObjectPrivate() + { + engine = new QPdfEngine(); + output = 0; + } + ~QPdfWriterPrivate() + { + delete engine; + delete output; + } + + QPdfEngine *engine; + QFile *output; +}; + + +/*! \class QPdfWriter + + \brief The QPdfWriter class is a class to generate PDFs + that can be used as a paint device. + + \ingroup painting + + QPdfWriter generates PDF out of a series of drawing commands using QPainter. + The newPage() method can be used to create several pages. + */ + +/*! + Constructs a PDF writer that will write the pdf to \a filename. + */ +QPdfWriter::QPdfWriter(const QString &filename) + : QObject(*new QPdfWriterPrivate) +{ + Q_D(QPdfWriter); + + d->engine->setOutputFilename(filename); +} + +/*! + Constructs a PDF writer that will write the pdf to \a device. + */ +QPdfWriter::QPdfWriter(QIODevice *device) + : QObject(*new QPdfWriterPrivate) +{ + Q_D(QPdfWriter); + + d->engine->d_func()->outDevice = device; +} + +/*! + Destroys the pdf writer. + */ +QPdfWriter::~QPdfWriter() +{ + +} + +/*! + Returns the title of the document. + */ +QString QPdfWriter::title() const +{ + Q_D(const QPdfWriter); + return d->engine->d_func()->title; +} + +/*! + Sets the title of the document being created. + */ +void QPdfWriter::setTitle(const QString &title) +{ + Q_D(QPdfWriter); + d->engine->d_func()->title = title; +} + +/*! + Returns the creator of the document. + */ +QString QPdfWriter::creator() const +{ + Q_D(const QPdfWriter); + return d->engine->d_func()->creator; +} + +/*! + Sets the creator of the document. + */ +void QPdfWriter::setCreator(const QString &creator) +{ + Q_D(QPdfWriter); + d->engine->d_func()->creator = creator; +} + + +/*! + \reimp + */ +QPaintEngine *QPdfWriter::paintEngine() const +{ + Q_D(const QPdfWriter); + + return d->engine; +} + +/*! + \reimp + */ +void QPdfWriter::setPageSize(PageSize size) +{ + Q_D(const QPdfWriter); + + QPagedPaintDevice::setPageSize(size); + d->engine->d_func()->paperSize = pageSizeMM() * 25.4/72.; +} + +/*! + \reimp + */ +void QPdfWriter::setPageSizeMM(const QSizeF &size) +{ + Q_D(const QPdfWriter); + + QPagedPaintDevice::setPageSizeMM(size); + d->engine->d_func()->paperSize = pageSizeMM() * 25.4/72.; +} + +/*! + \internal + + Returns the metric for the given \a id. +*/ +int QPdfWriter::metric(PaintDeviceMetric id) const +{ + Q_D(const QPdfWriter); + return d->engine->metric(id); +} + +/*! + \reimp +*/ +bool QPdfWriter::newPage() +{ + Q_D(QPdfWriter); + + return d->engine->newPage(); +} + + +/*! + \reimp + */ +void QPdfWriter::setMargins(const Margins &m) +{ + Q_D(QPdfWriter); + + const qreal multiplier = 72./25.4; + d->engine->d_func()->leftMargin = m.left*multiplier; + d->engine->d_func()->rightMargin = m.right*multiplier; + d->engine->d_func()->topMargin = m.top*multiplier; + d->engine->d_func()->bottomMargin = m.bottom*multiplier; +} diff --git a/src/gui/embedded/qmouseqnx_qws.h b/src/gui/painting/qpdfwriter.h similarity index 71% rename from src/gui/embedded/qmouseqnx_qws.h rename to src/gui/painting/qpdfwriter.h index 2a5eef2daaf..005d8e640b5 100644 --- a/src/gui/embedded/qmouseqnx_qws.h +++ b/src/gui/painting/qpdfwriter.h @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#ifndef QMOUSE_QNX_H -#define QMOUSE_QNX_H +#ifndef QPDFWRITER_H +#define QPDFWRITER_H #include -#include +#include QT_BEGIN_HEADER @@ -51,29 +51,41 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class QSocketNotifier; +class QIODevice; +class QPdfWriterPrivate; -class Q_GUI_EXPORT QQnxMouseHandler : public QObject, public QWSMouseHandler +class Q_GUI_EXPORT QPdfWriter : public QObject, public QPagedPaintDevice { Q_OBJECT public: - explicit QQnxMouseHandler(const QString &driver = QString(), - const QString &device = QString()); - ~QQnxMouseHandler(); + QPdfWriter(const QString &filename); + QPdfWriter(QIODevice *device); + ~QPdfWriter(); - void resume(); - void suspend(); + QString title() const; + void setTitle(const QString &title); -private Q_SLOTS: - void socketActivated(); + QString creator() const; + void setCreator(const QString &creator); + + bool newPage(); + + void setPageSize(PageSize size); + void setPageSizeMM(const QSizeF &size); + + void setMargins(const Margins &m); + +protected: + QPaintEngine *paintEngine() const; + int metric(PaintDeviceMetric id) const; private: - QSocketNotifier *mouseNotifier; - int mouseFD; + Q_DISABLE_COPY(QPdfWriter) + Q_DECLARE_PRIVATE(QPdfWriter) }; QT_END_NAMESPACE QT_END_HEADER -#endif // QMOUSE_QWS_H +#endif diff --git a/src/gui/painting/qplatformbackingstore_qpa.cpp b/src/gui/painting/qplatformbackingstore_qpa.cpp new file mode 100644 index 00000000000..fa85661f31c --- /dev/null +++ b/src/gui/painting/qplatformbackingstore_qpa.cpp @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QPlatformBackingStorePrivate +{ +public: + QPlatformBackingStorePrivate(QWindow *w) + : window(w) + { + } + + QWindow *window; + QSize size; +}; + +/*! + \class QPlatformBackingStore + \since 5.0 + \internal + \preliminary + \ingroup qpa + + \brief The QPlatformBackingStore class provides the drawing area for top-level + windows. +*/ + + +/*! + \fn void QPlatformBackingStore::beginPaint(const QRegion ®ion) + + This function is called before painting onto the surface begins, + with the \a region in which the painting will occur. + + \sa endPaint(), paintDevice() +*/ + +/*! + \fn void QPlatformBackingStore::endPaint(const QRegion ®ion) + + This function is called after painting onto the surface has ended, + with the \a region in which the painting was performed. + + \sa beginPaint(), paintDevice() +*/ + +/*! + \fn void QPlatformBackingStore::flush(QWindow *window, const QRegion ®ion, + const QPoint &offset) + + Flushes the given \a region from the specified \a window onto the + screen. + + Note that the \a offset parameter is currently unused. +*/ + +/*! + \fn QPaintDevice* QPlatformBackingStore::paintDevice() + + Implement this function to return the appropriate paint device. +*/ + +/*! + Constructs an empty surface for the given top-level \a window. +*/ +QPlatformBackingStore::QPlatformBackingStore(QWindow *window) + : d_ptr(new QPlatformBackingStorePrivate(window)) +{ +} + +/*! + Destroys this surface. +*/ +QPlatformBackingStore::~QPlatformBackingStore() +{ + delete d_ptr; +} + +/*! + Returns a pointer to the top-level window associated with this + surface. +*/ +QWindow* QPlatformBackingStore::window() const +{ + return d_ptr->window; +} + +void QPlatformBackingStore::beginPaint(const QRegion &) +{ +} + +void QPlatformBackingStore::endPaint() +{ +} + +/*! + Scrolls the given \a area \a dx pixels to the right and \a dy + downward; both \a dx and \a dy may be negative. + + Returns true if the area was scrolled successfully; false otherwise. +*/ +bool QPlatformBackingStore::scroll(const QRegion &area, int dx, int dy) +{ + Q_UNUSED(area); + Q_UNUSED(dx); + Q_UNUSED(dy); + + return false; +} + +QT_END_NAMESPACE diff --git a/src/gui/embedded/qwscursor_qws.h b/src/gui/painting/qplatformbackingstore_qpa.h similarity index 64% rename from src/gui/embedded/qwscursor_qws.h rename to src/gui/painting/qplatformbackingstore_qpa.h index 342d03d54b0..29730167b45 100644 --- a/src/gui/embedded/qwscursor_qws.h +++ b/src/gui/painting/qplatformbackingstore_qpa.h @@ -39,45 +39,48 @@ ** ****************************************************************************/ -#ifndef QWSCURSOR_QWS_H -#define QWSCURSOR_QWS_H +#ifndef QPLATFORMBACKINGSTORE_QPA_H +#define QPLATFORMBACKINGSTORE_QPA_H -#include +#include + +#include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE -QT_MODULE(Gui) +class QRegion; +class QRect; +class QPoint; +class QImage; +class QPlatformBackingStorePrivate; +class QPlatformWindow; -class QWSCursor +class Q_GUI_EXPORT QPlatformBackingStore { public: - QWSCursor() {} - QWSCursor(const uchar *data, const uchar *mask, int width, int height, - int hotX, int hotY) - { set(data, mask, width, height, hotX, hotY); } + QPlatformBackingStore(QWindow *window); + virtual ~QPlatformBackingStore(); - void set(const uchar *data, const uchar *mask, - int width, int height, int hotX, int hotY); + QWindow *window() const; - QPoint hotSpot() const { return hot; } - QImage &image() { return cursor; } + virtual QPaintDevice *paintDevice() = 0; - static QWSCursor *systemCursor(int id); + // 'window' can be a child window, in which case 'region' is in child window coordinates and + // offset is the (child) window's offset in relation to the window surface. + virtual void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) = 0; + + virtual void resize(const QSize &size, const QRegion &staticContents) = 0; + + virtual bool scroll(const QRegion &area, int dx, int dy); + + virtual void beginPaint(const QRegion &); + virtual void endPaint(); private: - static void createSystemCursor(int id); - void createDropShadow(int dropx, int dropy); - -private: - QPoint hot; - QImage cursor; + QPlatformBackingStorePrivate *d_ptr; }; QT_END_NAMESPACE -QT_END_HEADER - -#endif // QWSCURSOR_QWS_H +#endif // QPLATFORMBACKINGSTORE_QPA_H diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp deleted file mode 100644 index 2b0bca80244..00000000000 --- a/src/gui/painting/qprintengine_pdf.cpp +++ /dev/null @@ -1,1244 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef QT_NO_PRINTER -#include -#include -#ifndef QT_NO_COMPRESS -#include -#endif - -#if defined(Q_OS_WINCE) -#include "qwinfunctions_wince.h" -#endif - -#include "qprintengine_pdf_p.h" -#include "private/qdrawhelper_p.h" - -QT_BEGIN_NAMESPACE - -extern qint64 qt_pixmap_id(const QPixmap &pixmap); -extern qint64 qt_image_id(const QImage &image); - -//#define FONT_DUMP - -// might be helpful for smooth transforms of images -// Can't use it though, as gs generates completely wrong images if this is true. -static const bool interpolateImages = false; - -#ifdef QT_NO_COMPRESS -static const bool do_compress = false; -#else -static const bool do_compress = true; -#endif - -QPdfPage::QPdfPage() - : QPdf::ByteStream(true) // Enable file backing -{ -} - -void QPdfPage::streamImage(int w, int h, int object) -{ - *this << w << "0 0 " << -h << "0 " << h << "cm /Im" << object << " Do\n"; - if (!images.contains(object)) - images.append(object); -} - - -inline QPaintEngine::PaintEngineFeatures qt_pdf_decide_features() -{ - QPaintEngine::PaintEngineFeatures f = QPaintEngine::AllFeatures; - f &= ~(QPaintEngine::PorterDuff | QPaintEngine::PerspectiveTransform - | QPaintEngine::ObjectBoundingModeGradients -#ifndef USE_NATIVE_GRADIENTS - | QPaintEngine::LinearGradientFill -#endif - | QPaintEngine::RadialGradientFill - | QPaintEngine::ConicalGradientFill); - return f; -} - -QPdfEngine::QPdfEngine(QPrinter::PrinterMode m) - : QPdfBaseEngine(*new QPdfEnginePrivate(m), qt_pdf_decide_features()) -{ - state = QPrinter::Idle; -} - -QPdfEngine::~QPdfEngine() -{ -} - -bool QPdfEngine::begin(QPaintDevice *pdev) -{ - Q_D(QPdfEngine); - - if(!QPdfBaseEngine::begin(pdev)) { - state = QPrinter::Error; - return false; - } - d->stream->setDevice(d->outDevice); - - d->streampos = 0; - d->hasPen = true; - d->hasBrush = false; - d->clipEnabled = false; - d->allClipped = false; - - d->xrefPositions.clear(); - d->pageRoot = 0; - d->catalog = 0; - d->info = 0; - d->graphicsState = 0; - d->patternColorSpace = 0; - - d->pages.clear(); - d->imageCache.clear(); - - setActive(true); - state = QPrinter::Active; - d->writeHeader(); - newPage(); - - return true; -} - -bool QPdfEngine::end() -{ - Q_D(QPdfEngine); - d->writeTail(); - - d->stream->unsetDevice(); - QPdfBaseEngine::end(); - setActive(false); - state = QPrinter::Idle; - return true; -} - - -void QPdfEngine::drawPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QRectF &sr) -{ - if (sr.isEmpty() || rectangle.isEmpty() || pixmap.isNull()) - return; - Q_D(QPdfEngine); - - QBrush b = d->brush; - - QRect sourceRect = sr.toRect(); - QPixmap pm = sourceRect != pixmap.rect() ? pixmap.copy(sourceRect) : pixmap; - QImage image = pm.toImage(); - bool bitmap = true; - const int object = d->addImage(image, &bitmap, pm.cacheKey()); - if (object < 0) - return; - - *d->currentPage << "q\n/GSa gs\n"; - *d->currentPage - << QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(), - rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix)); - if (bitmap) { - // set current pen as d->brush - d->brush = d->pen.brush(); - } - setBrush(); - d->currentPage->streamImage(image.width(), image.height(), object); - *d->currentPage << "Q\n"; - - d->brush = b; -} - -void QPdfEngine::drawImage(const QRectF &rectangle, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags) -{ - if (sr.isEmpty() || rectangle.isEmpty() || image.isNull()) - return; - Q_D(QPdfEngine); - - QRect sourceRect = sr.toRect(); - QImage im = sourceRect != image.rect() ? image.copy(sourceRect) : image; - bool bitmap = true; - const int object = d->addImage(im, &bitmap, im.cacheKey()); - if (object < 0) - return; - - *d->currentPage << "q\n/GSa gs\n"; - *d->currentPage - << QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(), - rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix)); - setBrush(); - d->currentPage->streamImage(im.width(), im.height(), object); - *d->currentPage << "Q\n"; -} - -void QPdfEngine::drawTiledPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QPointF &point) -{ - Q_D(QPdfEngine); - - bool bitmap = (pixmap.depth() == 1); - QBrush b = d->brush; - QPointF bo = d->brushOrigin; - bool hp = d->hasPen; - d->hasPen = false; - bool hb = d->hasBrush; - d->hasBrush = true; - - d->brush = QBrush(pixmap); - if (bitmap) - // #### fix bitmap case where we have a brush pen - d->brush.setColor(d->pen.color()); - - d->brushOrigin = -point; - *d->currentPage << "q\n"; - setBrush(); - - drawRects(&rectangle, 1); - *d->currentPage << "Q\n"; - - d->hasPen = hp; - d->hasBrush = hb; - d->brush = b; - d->brushOrigin = bo; -} - - -void QPdfEngine::setBrush() -{ - Q_D(QPdfEngine); - Qt::BrushStyle style = d->brush.style(); - if (style == Qt::NoBrush) - return; - - bool specifyColor; - int gStateObject = 0; - int patternObject = d->addBrushPattern(d->stroker.matrix, &specifyColor, &gStateObject); - - *d->currentPage << (patternObject ? "/PCSp cs " : "/CSp cs "); - if (specifyColor) { - QColor rgba = d->brush.color(); - if (d->colorMode == QPrinter::GrayScale) { - qreal gray = qGray(rgba.rgba())/255.; - *d->currentPage << gray << gray << gray; - } else { - *d->currentPage << rgba.redF() - << rgba.greenF() - << rgba.blueF(); - } - } - if (patternObject) - *d->currentPage << "/Pat" << patternObject; - *d->currentPage << "scn\n"; - - if (gStateObject) - *d->currentPage << "/GState" << gStateObject << "gs\n"; - else - *d->currentPage << "/GSa gs\n"; -} - -QPaintEngine::Type QPdfEngine::type() const -{ - return QPaintEngine::Pdf; -} - -bool QPdfEngine::newPage() -{ - Q_D(QPdfEngine); - if (!isActive()) - return false; - d->newPage(); - return QPdfBaseEngine::newPage(); -} - -QPdfEnginePrivate::QPdfEnginePrivate(QPrinter::PrinterMode m) - : QPdfBaseEnginePrivate(m) -{ - streampos = 0; - - stream = new QDataStream; - pageOrder = QPrinter::FirstPageFirst; - orientation = QPrinter::Portrait; - fullPage = false; -} - -QPdfEnginePrivate::~QPdfEnginePrivate() -{ - delete stream; -} - - -#ifdef USE_NATIVE_GRADIENTS -int QPdfEnginePrivate::gradientBrush(const QBrush &b, const QMatrix &matrix, int *gStateObject) -{ - const QGradient *gradient = b.gradient(); - if (!gradient) - return 0; - - QTransform inv = matrix.inverted(); - QPointF page_rect[4] = { inv.map(QPointF(0, 0)), - inv.map(QPointF(width_, 0)), - inv.map(QPointF(0, height_)), - inv.map(QPointF(width_, height_)) }; - - bool opaque = b.isOpaque(); - - QByteArray shader; - QByteArray alphaShader; - if (gradient->type() == QGradient::LinearGradient) { - const QLinearGradient *lg = static_cast(gradient); - shader = QPdf::generateLinearGradientShader(lg, page_rect); - if (!opaque) - alphaShader = QPdf::generateLinearGradientShader(lg, page_rect, true); - } else { - // ############# - return 0; - } - int shaderObject = addXrefEntry(-1); - write(shader); - - QByteArray str; - QPdf::ByteStream s(&str); - s << "<<\n" - "/Type /Pattern\n" - "/PatternType 2\n" - "/Shading " << shaderObject << "0 R\n" - "/Matrix [" - << matrix.m11() - << matrix.m12() - << matrix.m21() - << matrix.m22() - << matrix.dx() - << matrix.dy() << "]\n"; - s << ">>\n" - "endobj\n"; - - int patternObj = addXrefEntry(-1); - write(str); - currentPage->patterns.append(patternObj); - - if (!opaque) { - bool ca = true; - QGradientStops stops = gradient->stops(); - int a = stops.at(0).second.alpha(); - for (int i = 1; i < stops.size(); ++i) { - if (stops.at(i).second.alpha() != a) { - ca = false; - break; - } - } - if (ca) { - *gStateObject = addConstantAlphaObject(stops.at(0).second.alpha()); - } else { - int alphaShaderObject = addXrefEntry(-1); - write(alphaShader); - - QByteArray content; - QPdf::ByteStream c(&content); - c << "/Shader" << alphaShaderObject << "sh\n"; - - QByteArray form; - QPdf::ByteStream f(&form); - f << "<<\n" - "/Type /XObject\n" - "/Subtype /Form\n" - "/BBox [0 0 " << width_ << height_ << "]\n" - "/Group <>\n" - "/Resources <<\n" - "/Shading << /Shader" << alphaShaderObject << alphaShaderObject << "0 R >>\n" - ">>\n"; - - f << "/Length " << content.length() << "\n" - ">>\n" - "stream\n" - << content - << "endstream\n" - "endobj\n"; - - int softMaskFormObject = addXrefEntry(-1); - write(form); - *gStateObject = addXrefEntry(-1); - xprintf("<< /SMask << /S /Alpha /G %d 0 R >> >>\n" - "endobj\n", softMaskFormObject); - currentPage->graphicStates.append(*gStateObject); - } - } - - return patternObj; -} -#endif - -int QPdfEnginePrivate::addConstantAlphaObject(int brushAlpha, int penAlpha) -{ - if (brushAlpha == 255 && penAlpha == 255) - return 0; - int object = alphaCache.value(QPair(brushAlpha, penAlpha), 0); - if (!object) { - object = addXrefEntry(-1); - QByteArray alphaDef; - QPdf::ByteStream s(&alphaDef); - s << "<<\n/ca " << (brushAlpha/qreal(255.)) << '\n'; - s << "/CA " << (penAlpha/qreal(255.)) << "\n>>"; - xprintf("%s\nendobj\n", alphaDef.constData()); - alphaCache.insert(QPair(brushAlpha, penAlpha), object); - } - if (currentPage->graphicStates.indexOf(object) < 0) - currentPage->graphicStates.append(object); - - return object; -} - -int QPdfEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor, int *gStateObject) -{ - int paintType = 2; // Uncolored tiling - int w = 8; - int h = 8; - - *specifyColor = true; - *gStateObject = 0; - - QTransform matrix = m; - matrix.translate(brushOrigin.x(), brushOrigin.y()); - matrix = matrix * pageMatrix(); - //qDebug() << brushOrigin << matrix; - - Qt::BrushStyle style = brush.style(); - if (style == Qt::LinearGradientPattern) {// && style <= Qt::ConicalGradientPattern) { -#ifdef USE_NATIVE_GRADIENTS - *specifyColor = false; - return gradientBrush(b, matrix, gStateObject); -#else - return 0; -#endif - } - - if ((!brush.isOpaque() && brush.style() < Qt::LinearGradientPattern) || opacity != 1.0) - *gStateObject = addConstantAlphaObject(qRound(brush.color().alpha() * opacity), - qRound(pen.color().alpha() * opacity)); - - int imageObject = -1; - QByteArray pattern = QPdf::patternForBrush(brush); - if (pattern.isEmpty()) { - if (brush.style() != Qt::TexturePattern) - return 0; - QImage image = brush.texture().toImage(); - bool bitmap = true; - imageObject = addImage(image, &bitmap, qt_pixmap_id(brush.texture())); - if (imageObject != -1) { - QImage::Format f = image.format(); - if (f != QImage::Format_MonoLSB && f != QImage::Format_Mono) { - paintType = 1; // Colored tiling - *specifyColor = false; - } - w = image.width(); - h = image.height(); - QTransform m(w, 0, 0, -h, 0, h); - QPdf::ByteStream s(&pattern); - s << QPdf::generateMatrix(m); - s << "/Im" << imageObject << " Do\n"; - } - } - - QByteArray str; - QPdf::ByteStream s(&str); - s << "<<\n" - "/Type /Pattern\n" - "/PatternType 1\n" - "/PaintType " << paintType << "\n" - "/TilingType 1\n" - "/BBox [0 0 " << w << h << "]\n" - "/XStep " << w << "\n" - "/YStep " << h << "\n" - "/Matrix [" - << matrix.m11() - << matrix.m12() - << matrix.m21() - << matrix.m22() - << matrix.dx() - << matrix.dy() << "]\n" - "/Resources \n<< "; // open resource tree - if (imageObject > 0) { - s << "/XObject << /Im" << imageObject << ' ' << imageObject << "0 R >> "; - } - s << ">>\n" - "/Length " << pattern.length() << "\n" - ">>\n" - "stream\n" - << pattern - << "endstream\n" - "endobj\n"; - - int patternObj = addXrefEntry(-1); - write(str); - currentPage->patterns.append(patternObj); - return patternObj; -} - -/*! - * Adds an image to the pdf and return the pdf-object id. Returns -1 if adding the image failed. - */ -int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_no) -{ - if (img.isNull()) - return -1; - - int object = imageCache.value(serial_no); - if(object) - return object; - - QImage image = img; - QImage::Format format = image.format(); - if (image.depth() == 1 && *bitmap && img.colorTable().size() == 2 - && img.colorTable().at(0) == QColor(Qt::black).rgba() - && img.colorTable().at(1) == QColor(Qt::white).rgba()) - { - if (format == QImage::Format_MonoLSB) - image = image.convertToFormat(QImage::Format_Mono); - format = QImage::Format_Mono; - } else { - *bitmap = false; - if (format != QImage::Format_RGB32 && format != QImage::Format_ARGB32) { - image = image.convertToFormat(QImage::Format_ARGB32); - format = QImage::Format_ARGB32; - } - } - - int w = image.width(); - int h = image.height(); - int d = image.depth(); - - if (format == QImage::Format_Mono) { - int bytesPerLine = (w + 7) >> 3; - QByteArray data; - data.resize(bytesPerLine * h); - char *rawdata = data.data(); - for (int y = 0; y < h; ++y) { - memcpy(rawdata, image.scanLine(y), bytesPerLine); - rawdata += bytesPerLine; - } - object = writeImage(data, w, h, d, 0, 0); - } else { - QByteArray softMaskData; - bool dct = false; - QByteArray imageData; - bool hasAlpha = false; - bool hasMask = false; - - if (QImageWriter::supportedImageFormats().contains("jpeg") && colorMode != QPrinter::GrayScale) { - QBuffer buffer(&imageData); - QImageWriter writer(&buffer, "jpeg"); - writer.setQuality(94); - writer.write(image); - dct = true; - - if (format != QImage::Format_RGB32) { - softMaskData.resize(w * h); - uchar *sdata = (uchar *)softMaskData.data(); - for (int y = 0; y < h; ++y) { - const QRgb *rgb = (const QRgb *)image.scanLine(y); - for (int x = 0; x < w; ++x) { - uchar alpha = qAlpha(*rgb); - *sdata++ = alpha; - hasMask |= (alpha < 255); - hasAlpha |= (alpha != 0 && alpha != 255); - ++rgb; - } - } - } - } else { - imageData.resize(colorMode == QPrinter::GrayScale ? w * h : 3 * w * h); - uchar *data = (uchar *)imageData.data(); - softMaskData.resize(w * h); - uchar *sdata = (uchar *)softMaskData.data(); - for (int y = 0; y < h; ++y) { - const QRgb *rgb = (const QRgb *)image.scanLine(y); - if (colorMode == QPrinter::GrayScale) { - for (int x = 0; x < w; ++x) { - *(data++) = qGray(*rgb); - uchar alpha = qAlpha(*rgb); - *sdata++ = alpha; - hasMask |= (alpha < 255); - hasAlpha |= (alpha != 0 && alpha != 255); - ++rgb; - } - } else { - for (int x = 0; x < w; ++x) { - *(data++) = qRed(*rgb); - *(data++) = qGreen(*rgb); - *(data++) = qBlue(*rgb); - uchar alpha = qAlpha(*rgb); - *sdata++ = alpha; - hasMask |= (alpha < 255); - hasAlpha |= (alpha != 0 && alpha != 255); - ++rgb; - } - } - } - if (format == QImage::Format_RGB32) - hasAlpha = hasMask = false; - } - int maskObject = 0; - int softMaskObject = 0; - if (hasAlpha) { - softMaskObject = writeImage(softMaskData, w, h, 8, 0, 0); - } else if (hasMask) { - // dither the soft mask to 1bit and add it. This also helps PDF viewers - // without transparency support - int bytesPerLine = (w + 7) >> 3; - QByteArray mask(bytesPerLine * h, 0); - uchar *mdata = (uchar *)mask.data(); - const uchar *sdata = (const uchar *)softMaskData.constData(); - for (int y = 0; y < h; ++y) { - for (int x = 0; x < w; ++x) { - if (*sdata) - mdata[x>>3] |= (0x80 >> (x&7)); - ++sdata; - } - mdata += bytesPerLine; - } - maskObject = writeImage(mask, w, h, 1, 0, 0); - } - object = writeImage(imageData, w, h, colorMode == QPrinter::GrayScale ? 8 : 32, - maskObject, softMaskObject, dct); - } - imageCache.insert(serial_no, object); - return object; -} - -void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) -{ - if (ti.charFormat.isAnchor()) { - qreal size = ti.fontEngine->fontDef.pixelSize; -#ifdef Q_WS_WIN - if (ti.fontEngine->type() == QFontEngine::Win) { - QFontEngineWin *fe = static_cast(ti.fontEngine); - size = fe->tm.tmHeight; - } -#endif - int synthesized = ti.fontEngine->synthesized(); - qreal stretch = synthesized & QFontEngine::SynthesizedStretch ? ti.fontEngine->fontDef.stretch/100. : 1.; - - QTransform trans; - // Build text rendering matrix (Trm). We need it to map the text area to user - // space units on the PDF page. - trans = QTransform(size*stretch, 0, 0, size, 0, 0); - // Apply text matrix (Tm). - trans *= QTransform(1,0,0,-1,p.x(),p.y()); - // Apply page displacement (Identity for first page). - trans *= stroker.matrix; - // Apply Current Transformation Matrix (CTM) - trans *= pageMatrix(); - qreal x1, y1, x2, y2; - trans.map(0, 0, &x1, &y1); - trans.map(ti.width.toReal()/size, (ti.ascent.toReal()-ti.descent.toReal())/size, &x2, &y2); - - uint annot = addXrefEntry(-1); -#ifdef Q_DEBUG_PDF_LINKS - xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect [%f %f %f %f]\n/Border [16 16 1]\n/A <<\n", -#else - xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect [%f %f %f %f]\n/Border [0 0 0]\n/A <<\n", -#endif - static_cast(x1), - static_cast(y1), - static_cast(x2), - static_cast(y2)); - xprintf("/Type /Action\n/S /URI\n/URI (%s)\n", - ti.charFormat.anchorHref().toLatin1().constData()); - xprintf(">>\n>>\n"); - xprintf("endobj\n"); - - if (!currentPage->annotations.contains(annot)) { - currentPage->annotations.append(annot); - } - } - - QPdfBaseEnginePrivate::drawTextItem(p, ti); -} - -QTransform QPdfEnginePrivate::pageMatrix() const -{ - qreal scale = 72./resolution; - QTransform tmp(scale, 0.0, 0.0, -scale, 0.0, height()); - if (!fullPage) { - QRect r = pageRect(); - tmp.translate(r.left(), r.top()); - } - return tmp; -} - -void QPdfEnginePrivate::newPage() -{ - if (currentPage && currentPage->pageSize.isEmpty()) - currentPage->pageSize = QSize(width(), height()); - writePage(); - - delete currentPage; - currentPage = new QPdfPage; - currentPage->pageSize = QSize(width(), height()); - stroker.stream = currentPage; - pages.append(requestObject()); - - *currentPage << "/GSa gs /CSp cs /CSp CS\n" - << QPdf::generateMatrix(pageMatrix()) - << "q q\n"; -} - - -// For strings up to 10000 bytes only ! -void QPdfEnginePrivate::xprintf(const char* fmt, ...) -{ - if (!stream) - return; - - const int msize = 10000; - char buf[msize]; - - va_list args; - va_start(args, fmt); - int bufsize = qvsnprintf(buf, msize, fmt, args); - - Q_ASSERT(bufsizewriteRawData(buf, bufsize); - streampos += bufsize; -} - -int QPdfEnginePrivate::writeCompressed(QIODevice *dev) -{ -#ifndef QT_NO_COMPRESS - if (do_compress) { - int size = QPdfPage::chunkSize(); - int sum = 0; - ::z_stream zStruct; - zStruct.zalloc = Z_NULL; - zStruct.zfree = Z_NULL; - zStruct.opaque = Z_NULL; - if (::deflateInit(&zStruct, Z_DEFAULT_COMPRESSION) != Z_OK) { - qWarning("QPdfStream::writeCompressed: Error in deflateInit()"); - return sum; - } - zStruct.avail_in = 0; - QByteArray in, out; - out.resize(size); - while (!dev->atEnd() || zStruct.avail_in != 0) { - if (zStruct.avail_in == 0) { - in = dev->read(size); - zStruct.avail_in = in.size(); - zStruct.next_in = reinterpret_cast(in.data()); - if (in.size() <= 0) { - qWarning("QPdfStream::writeCompressed: Error in read()"); - ::deflateEnd(&zStruct); - return sum; - } - } - zStruct.next_out = reinterpret_cast(out.data()); - zStruct.avail_out = out.size(); - if (::deflate(&zStruct, 0) != Z_OK) { - qWarning("QPdfStream::writeCompressed: Error in deflate()"); - ::deflateEnd(&zStruct); - return sum; - } - int written = out.size() - zStruct.avail_out; - stream->writeRawData(out.constData(), written); - streampos += written; - sum += written; - } - int ret; - do { - zStruct.next_out = reinterpret_cast(out.data()); - zStruct.avail_out = out.size(); - ret = ::deflate(&zStruct, Z_FINISH); - if (ret != Z_OK && ret != Z_STREAM_END) { - qWarning("QPdfStream::writeCompressed: Error in deflate()"); - ::deflateEnd(&zStruct); - return sum; - } - int written = out.size() - zStruct.avail_out; - stream->writeRawData(out.constData(), written); - streampos += written; - sum += written; - } while (ret == Z_OK); - - ::deflateEnd(&zStruct); - - return sum; - } else -#endif - { - QByteArray arr; - int sum = 0; - while (!dev->atEnd()) { - arr = dev->read(QPdfPage::chunkSize()); - stream->writeRawData(arr.constData(), arr.size()); - streampos += arr.size(); - sum += arr.size(); - } - return sum; - } -} - -int QPdfEnginePrivate::writeCompressed(const char *src, int len) -{ -#ifndef QT_NO_COMPRESS - if(do_compress) { - uLongf destLen = len + len/100 + 13; // zlib requirement - Bytef* dest = new Bytef[destLen]; - if (Z_OK == ::compress(dest, &destLen, (const Bytef*) src, (uLongf)len)) { - stream->writeRawData((const char*)dest, destLen); - } else { - qWarning("QPdfStream::writeCompressed: Error in compress()"); - destLen = 0; - } - delete [] dest; - len = destLen; - } else -#endif - { - stream->writeRawData(src,len); - } - streampos += len; - return len; -} - -int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth, - int maskObject, int softMaskObject, bool dct) -{ - int image = addXrefEntry(-1); - xprintf("<<\n" - "/Type /XObject\n" - "/Subtype /Image\n" - "/Width %d\n" - "/Height %d\n", width, height); - - if (depth == 1) { - xprintf("/ImageMask true\n" - "/Decode [1 0]\n"); - } else { - xprintf("/BitsPerComponent 8\n" - "/ColorSpace %s\n", (depth == 32) ? "/DeviceRGB" : "/DeviceGray"); - } - if (maskObject > 0) - xprintf("/Mask %d 0 R\n", maskObject); - if (softMaskObject > 0) - xprintf("/SMask %d 0 R\n", softMaskObject); - - int lenobj = requestObject(); - xprintf("/Length %d 0 R\n", lenobj); - if (interpolateImages) - xprintf("/Interpolate true\n"); - int len = 0; - if (dct) { - //qDebug() << "DCT"; - xprintf("/Filter /DCTDecode\n>>\nstream\n"); - write(data); - len = data.length(); - } else { - if (do_compress) - xprintf("/Filter /FlateDecode\n>>\nstream\n"); - else - xprintf(">>\nstream\n"); - len = writeCompressed(data); - } - xprintf("endstream\n" - "endobj\n"); - addXrefEntry(lenobj); - xprintf("%d\n" - "endobj\n", len); - return image; -} - - -void QPdfEnginePrivate::writeHeader() -{ - addXrefEntry(0,false); - - xprintf("%%PDF-1.4\n"); - - writeInfo(); - - catalog = addXrefEntry(-1); - pageRoot = requestObject(); - xprintf("<<\n" - "/Type /Catalog\n" - "/Pages %d 0 R\n" - ">>\n" - "endobj\n", pageRoot); - - // graphics state - graphicsState = addXrefEntry(-1); - xprintf("<<\n" - "/Type /ExtGState\n" - "/SA true\n" - "/SM 0.02\n" - "/ca 1.0\n" - "/CA 1.0\n" - "/AIS false\n" - "/SMask /None" - ">>\n" - "endobj\n"); - - // color space for pattern - patternColorSpace = addXrefEntry(-1); - xprintf("[/Pattern /DeviceRGB]\n" - "endobj\n"); -} - -void QPdfEnginePrivate::writeInfo() -{ - info = addXrefEntry(-1); - xprintf("<<\n/Title "); - printString(title); - xprintf("\n/Creator "); - printString(creator); - xprintf("\n/Producer "); - printString(QString::fromLatin1("Qt " QT_VERSION_STR " (C) 2011 Nokia Corporation and/or its subsidiary(-ies)")); - QDateTime now = QDateTime::currentDateTime().toUTC(); - QTime t = now.time(); - QDate d = now.date(); - xprintf("\n/CreationDate (D:%d%02d%02d%02d%02d%02d)\n", - d.year(), - d.month(), - d.day(), - t.hour(), - t.minute(), - t.second()); - xprintf(">>\n" - "endobj\n"); -} - -void QPdfEnginePrivate::writePageRoot() -{ - addXrefEntry(pageRoot); - - xprintf("<<\n" - "/Type /Pages\n" - "/Kids \n" - "[\n"); - int size = pages.size(); - for (int i = 0; i < size; ++i) - xprintf("%d 0 R\n", pages[i]); - xprintf("]\n"); - - //xprintf("/Group <>\n"); - xprintf("/Count %d\n", pages.size()); - - xprintf("/ProcSet [/PDF /Text /ImageB /ImageC]\n" - ">>\n" - "endobj\n"); -} - - -void QPdfEnginePrivate::embedFont(QFontSubset *font) -{ - //qDebug() << "embedFont" << font->object_id; - int fontObject = font->object_id; - QByteArray fontData = font->toTruetype(); -#ifdef FONT_DUMP - static int i = 0; - QString fileName("font%1.ttf"); - fileName = fileName.arg(i++); - QFile ff(fileName); - ff.open(QFile::WriteOnly); - ff.write(fontData); - ff.close(); -#endif - - int fontDescriptor = requestObject(); - int fontstream = requestObject(); - int cidfont = requestObject(); - int toUnicode = requestObject(); - - QFontEngine::Properties properties = font->fontEngine->properties(); - - { - qreal scale = 1000/properties.emSquare.toReal(); - addXrefEntry(fontDescriptor); - QByteArray descriptor; - QPdf::ByteStream s(&descriptor); - s << "<< /Type /FontDescriptor\n" - "/FontName /Q"; - int tag = fontDescriptor; - for (int i = 0; i < 5; ++i) { - s << (char)('A' + (tag % 26)); - tag /= 26; - } - s << '+' << properties.postscriptName << "\n" - "/Flags " << 4 << "\n" - "/FontBBox [" - << properties.boundingBox.x()*scale - << -(properties.boundingBox.y() + properties.boundingBox.height())*scale - << (properties.boundingBox.x() + properties.boundingBox.width())*scale - << -properties.boundingBox.y()*scale << "]\n" - "/ItalicAngle " << properties.italicAngle.toReal() << "\n" - "/Ascent " << properties.ascent.toReal()*scale << "\n" - "/Descent " << -properties.descent.toReal()*scale << "\n" - "/CapHeight " << properties.capHeight.toReal()*scale << "\n" - "/StemV " << properties.lineWidth.toReal()*scale << "\n" - "/FontFile2 " << fontstream << "0 R\n" - ">> endobj\n"; - write(descriptor); - } - { - addXrefEntry(fontstream); - QByteArray header; - QPdf::ByteStream s(&header); - - int length_object = requestObject(); - s << "<<\n" - "/Length1 " << fontData.size() << "\n" - "/Length " << length_object << "0 R\n"; - if (do_compress) - s << "/Filter /FlateDecode\n"; - s << ">>\n" - "stream\n"; - write(header); - int len = writeCompressed(fontData); - write("endstream\n" - "endobj\n"); - addXrefEntry(length_object); - xprintf("%d\n" - "endobj\n", len); - } - { - addXrefEntry(cidfont); - QByteArray cid; - QPdf::ByteStream s(&cid); - s << "<< /Type /Font\n" - "/Subtype /CIDFontType2\n" - "/BaseFont /" << properties.postscriptName << "\n" - "/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>\n" - "/FontDescriptor " << fontDescriptor << "0 R\n" - "/CIDToGIDMap /Identity\n" - << font->widthArray() << - ">>\n" - "endobj\n"; - write(cid); - } - { - addXrefEntry(toUnicode); - QByteArray touc = font->createToUnicodeMap(); - xprintf("<< /Length %d >>\n" - "stream\n", touc.length()); - write(touc); - write("endstream\n" - "endobj\n"); - } - { - addXrefEntry(fontObject); - QByteArray font; - QPdf::ByteStream s(&font); - s << "<< /Type /Font\n" - "/Subtype /Type0\n" - "/BaseFont /" << properties.postscriptName << "\n" - "/Encoding /Identity-H\n" - "/DescendantFonts [" << cidfont << "0 R]\n" - "/ToUnicode " << toUnicode << "0 R" - ">>\n" - "endobj\n"; - write(font); - } -} - - -void QPdfEnginePrivate::writeFonts() -{ - for (QHash::iterator it = fonts.begin(); it != fonts.end(); ++it) { - embedFont(*it); - delete *it; - } - fonts.clear(); -} - -void QPdfEnginePrivate::writePage() -{ - if (pages.empty()) - return; - - *currentPage << "Q Q\n"; - - uint pageStream = requestObject(); - uint pageStreamLength = requestObject(); - uint resources = requestObject(); - uint annots = requestObject(); - - addXrefEntry(pages.last()); - xprintf("<<\n" - "/Type /Page\n" - "/Parent %d 0 R\n" - "/Contents %d 0 R\n" - "/Resources %d 0 R\n" - "/Annots %d 0 R\n" - "/MediaBox [0 0 %d %d]\n" - ">>\n" - "endobj\n", - pageRoot, pageStream, resources, annots, - // make sure we use the pagesize from when we started the page, since the user may have changed it - currentPage->pageSize.width(), currentPage->pageSize.height()); - - addXrefEntry(resources); - xprintf("<<\n" - "/ColorSpace <<\n" - "/PCSp %d 0 R\n" - "/CSp /DeviceRGB\n" - "/CSpg /DeviceGray\n" - ">>\n" - "/ExtGState <<\n" - "/GSa %d 0 R\n", - patternColorSpace, graphicsState); - - for (int i = 0; i < currentPage->graphicStates.size(); ++i) - xprintf("/GState%d %d 0 R\n", currentPage->graphicStates.at(i), currentPage->graphicStates.at(i)); - xprintf(">>\n"); - - xprintf("/Pattern <<\n"); - for (int i = 0; i < currentPage->patterns.size(); ++i) - xprintf("/Pat%d %d 0 R\n", currentPage->patterns.at(i), currentPage->patterns.at(i)); - xprintf(">>\n"); - - xprintf("/Font <<\n"); - for (int i = 0; i < currentPage->fonts.size();++i) - xprintf("/F%d %d 0 R\n", currentPage->fonts[i], currentPage->fonts[i]); - xprintf(">>\n"); - - xprintf("/XObject <<\n"); - for (int i = 0; iimages.size(); ++i) { - xprintf("/Im%d %d 0 R\n", currentPage->images.at(i), currentPage->images.at(i)); - } - xprintf(">>\n"); - - xprintf(">>\n" - "endobj\n"); - - addXrefEntry(annots); - xprintf("[ "); - for (int i = 0; iannotations.size(); ++i) { - xprintf("%d 0 R ", currentPage->annotations.at(i)); - } - xprintf("]\nendobj\n"); - - addXrefEntry(pageStream); - xprintf("<<\n" - "/Length %d 0 R\n", pageStreamLength); // object number for stream length object - if (do_compress) - xprintf("/Filter /FlateDecode\n"); - - xprintf(">>\n"); - xprintf("stream\n"); - QIODevice *content = currentPage->stream(); - int len = writeCompressed(content); - xprintf("endstream\n" - "endobj\n"); - - addXrefEntry(pageStreamLength); - xprintf("%d\nendobj\n",len); -} - -void QPdfEnginePrivate::writeTail() -{ - writePage(); - writeFonts(); - writePageRoot(); - addXrefEntry(xrefPositions.size(),false); - xprintf("xref\n" - "0 %d\n" - "%010d 65535 f \n", xrefPositions.size()-1, xrefPositions[0]); - - for (int i = 1; i < xrefPositions.size()-1; ++i) - xprintf("%010d 00000 n \n", xrefPositions[i]); - - xprintf("trailer\n" - "<<\n" - "/Size %d\n" - "/Info %d 0 R\n" - "/Root %d 0 R\n" - ">>\n" - "startxref\n%d\n" - "%%%%EOF\n", - xrefPositions.size()-1, info, catalog, xrefPositions.last()); -} - -int QPdfEnginePrivate::addXrefEntry(int object, bool printostr) -{ - if (object < 0) - object = requestObject(); - - if (object>=xrefPositions.size()) - xrefPositions.resize(object+1); - - xrefPositions[object] = streampos; - if (printostr) - xprintf("%d 0 obj\n",object); - - return object; -} - -void QPdfEnginePrivate::printString(const QString &string) { - // The 'text string' type in PDF is encoded either as PDFDocEncoding, or - // Unicode UTF-16 with a Unicode byte order mark as the first character - // (0xfeff), with the high-order byte first. - QByteArray array("(\xfe\xff"); - const ushort *utf16 = string.utf16(); - - for (int i=0; i < string.size(); ++i) { - char part[2] = {char((*(utf16 + i)) >> 8), char((*(utf16 + i)) & 0xff)}; - for(int j=0; j < 2; ++j) { - if (part[j] == '(' || part[j] == ')' || part[j] == '\\') - array.append('\\'); - array.append(part[j]); - } - } - array.append(")"); - write(array); -} - -QT_END_NAMESPACE - -#endif // QT_NO_PRINTER diff --git a/src/gui/painting/qprintengine_ps.cpp b/src/gui/painting/qprintengine_ps.cpp deleted file mode 100644 index 89bec21f380..00000000000 --- a/src/gui/painting/qprintengine_ps.cpp +++ /dev/null @@ -1,972 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplatformdefs.h" - -#include -#include -#include -#include -#include - -#ifndef QT_NO_PRINTER - -#include "qprinter.h" -#include "qpainter.h" -#include "qapplication.h" -#include "qpixmap.h" -#include "qimage.h" -#include "qdatetime.h" -#include "qstring.h" -#include "qbytearray.h" -#include "qhash.h" -#include "qbuffer.h" -#include "qsettings.h" -#include "qmap.h" -#include "qbitmap.h" -#include "qregion.h" -#include "qimagewriter.h" -#include -#include -#include -#include - -#ifndef Q_OS_WIN -#include -#endif -#include -#include - -QT_BEGIN_NAMESPACE - -static bool qt_gen_epsf = false; - -void qt_generate_epsf(bool b) -{ - qt_gen_epsf = b; -} - -static const char *const ps_header = -"/BD{bind def}bind def/d2{dup dup}BD/ED{exch def}BD/D0{0 ED}BD/F{setfont}BD\n" -"/RL{rlineto}BD/CM{currentmatrix}BD/SM{setmatrix}BD/TR{translate}BD/SD\n" -"{setdash}BD/SC{aload pop setrgbcolor}BD/CR{currentfile read pop}BD/i{index}\n" -"BD/scs{setcolorspace}BD/DB{dict dup begin}BD/DE{end def}BD/ie{ifelse}BD/gs\n" -"{gsave}BD/gr{grestore}BD/w{setlinewidth}BD/d{setdash}BD/J{setlinecap}BD/j\n" -"{setlinejoin}BD/scn{3 array astore/BCol exch def}BD/SCN{3 array astore/PCol\n" -"exch def}BD/cm{6 array astore concat}BD/m{moveto}BD/l{lineto}BD/c{curveto}BD\n" -"/h{closepath}BD/W{clip}BD/W*{eoclip}BD/n{newpath}BD/q{gsave 10 dict begin}BD\n" -"/Q{end grestore}BD/re{4 2 roll m dup 0 exch RL exch 0 RL 0 exch neg RL h}BD\n" -"/S{gs PCol SC stroke gr n}BD/BT{gsave 10 dict begin/_m matrix CM def BCol\n" -"SC}BD/ET{end grestore}BD/Tf{/_fs ED findfont[_fs 0 0 _fs 0 0]makefont F}BD\n" -"/Tm{6 array astore concat}BD/Td{translate}BD/Tj{0 0 m show}BD/BDC{pop pop}BD\n" -"/EMC{}BD/BSt 0 def/WFi false def/BCol[1 1 1]def/PCol[0 0 0]def/BDArr[0.94\n" -"0.88 0.63 0.50 0.37 0.12 0.06]def/level3{/languagelevel where{pop\n" -"languagelevel 3 ge}{false}ie}BD/QCIgray D0/QCIcolor D0/QCIindex D0/QCI{\n" -"/colorimage where{pop false 3 colorimage}{exec/QCIcolor ED/QCIgray QCIcolor\n" -"length 3 idiv string def 0 1 QCIcolor length 3 idiv 1 sub{/QCIindex ED/_x\n" -"QCIindex 3 mul def QCIgray QCIindex QCIcolor _x get 0.30 mul QCIcolor _x 1\n" -"add get 0.59 mul QCIcolor _x 2 add get 0.11 mul add add cvi put}for QCIgray\n" -"image}ie}BD/di{gs TR 1 i 1 eq{pop pop false 3 1 roll BCol SC imagemask}{dup\n" -"false ne{level3}{false}ie{/_ma ED 8 eq{/_dc[0 1]def/DeviceGray}{/_dc[0 1 0 1\n" -"0 1]def/DeviceRGB}ie scs/_im ED/_mt ED/_h ED/_w ED <>/MaskDict <>\n" -"/InterleaveType 3 >> image}{pop 8 4 1 roll 8 eq{image}{QCI}ie}ie}ie gr}BD/BF\n" -"{gs BSt 1 eq{BCol SC WFi{fill}{eofill}ie}if BSt 2 ge BSt 8 le and{BDArr BSt\n" -"2 sub get/_sc ED BCol{1. exch sub _sc mul 1. exch sub}forall 3 array astore\n" -"SC WFi{fill}{eofill}ie}if BSt 9 ge BSt 14 le and{WFi{W}{W*}ie pathbbox 3 i 3\n" -"i TR 4 2 roll 3 2 roll exch sub/_h ED sub/_w ED BCol SC 0.3 w n BSt 9 eq BSt\n" -"11 eq or{0 4 _h{dup 0 exch m _w exch l}for}if BSt 10 eq BSt 11 eq or{0 4 _w{\n" -"dup 0 m _h l}for}if BSt 12 eq BSt 14 eq or{_w _h gt{0 6 _w _h add{dup 0 m _h\n" -"sub _h l}for}{0 6 _w _h add{dup 0 exch m _w sub _w exch l}for}ie}if BSt 13\n" -"eq BSt 14 eq or{_w _h gt{0 6 _w _h add{dup _h m _h sub 0 l}for}{0 6 _w _h\n" -"add{dup _w exch m _w sub 0 exch l}for}ie}if stroke}if BSt 15 eq{}if BSt 24\n" -"eq{}if gr}BD/f{/WFi true def BF n}BD/f*{/WFi false def BF n}BD/B{/WFi true\n" -"def BF S n}BD/B*{/WFi false def BF S n}BD/QI{/C save def pageinit q n}BD/QP{\n" -"Q C restore showpage}BD/SPD{/setpagedevice where{<< 3 1 roll >>\n" -"setpagedevice}{pop pop}ie}BD/T1AddMapping{10 dict begin/glyphs ED/fnt ED\n" -"/current fnt/NumGlyphs get def/CMap fnt/CMap get def 0 1 glyphs length 1 sub\n" -"{glyphs exch get/gn ED current dup 256 mod/min ED 256 idiv/maj ED CMap dup\n" -"maj get dup null eq{pop 256 array 0 1 255{1 i exch/.notdef put}for}if dup\n" -"min gn put maj exch put/current current 1 add def}for fnt/CMap CMap put fnt\n" -"/NumGlyphs current put end}def/T1AddGlyphs{10 dict begin/glyphs ED/fnt ED\n" -"/current fnt/NumGlyphs get def/CMap fnt/CMap get def/CharStrings fnt\n" -"/CharStrings get def 0 1 glyphs length 2 idiv 1 sub{2 mul dup glyphs exch\n" -"get/gn ED 1 add glyphs exch get/cs ED current dup 256 mod/min ED 256 idiv\n" -"/maj ED CMap dup maj get dup null eq{pop 256 array 0 1 255{1 i exch/.notdef\n" -"put}for}if dup min gn put maj exch put CharStrings gn cs put/current current\n" -"1 add def}for fnt/CharStrings CharStrings put fnt/CMap CMap put fnt\n" -"/NumGlyphs current put end}def/StringAdd{1 i length 1 i length add string 3\n" -"1 roll 2 i 0 3 i putinterval 2 i 2 i length 2 i putinterval pop pop}def\n" -"/T1Setup{10 dict begin dup/FontName ED (-Base) StringAdd cvx cvn/Font ED\n" -"/MaxPage Font/NumGlyphs get 1 sub 256 idiv def/FDepVector MaxPage 1 add\n" -"array def/Encoding MaxPage 1 add array def 0 1 MaxPage{dup Encoding exch dup\n" -"put dup/Page ED FontName (-) StringAdd exch 20 string cvs StringAdd cvn Font\n" -"0 dict copy d2/CMap get Page get/Encoding exch put definefont FDepVector\n" -"exch Page exch put}for FontName cvn <> definefont pop end}def\n"; - - - -// ------------------------------End of static data ---------------------------------- - -// make sure DSC comments are not longer than 255 chars per line. -static QByteArray wrapDSC(const QByteArray &str) -{ - QByteArray dsc = str.simplified(); - const int wrapAt = 254; - QByteArray wrapped; - if (dsc.length() < wrapAt) - wrapped = dsc; - else { - wrapped = dsc.left(wrapAt); - QByteArray tmp = dsc.mid(wrapAt); - while (tmp.length() > wrapAt-3) { - wrapped += "\n%%+" + tmp.left(wrapAt-3); - tmp = tmp.mid(wrapAt-3); - } - wrapped += "\n%%+" + tmp; - } - return wrapped + '\n'; -} - -// ----------------------------- Internal class declarations ----------------------------- - -QPSPrintEnginePrivate::QPSPrintEnginePrivate(QPrinter::PrinterMode m) - : QPdfBaseEnginePrivate(m), - printerState(QPrinter::Idle), hugeDocument(false), headerDone(false) -{ - useAlphaEngine = true; - postscript = true; - - firstPage = true; - -#ifndef QT_NO_SETTINGS - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("Qt")); - embedFonts = settings.value(QLatin1String("embedFonts"), true).toBool(); -#else - embedFonts = true; -#endif -} - -QPSPrintEnginePrivate::~QPSPrintEnginePrivate() -{ -} - -QT_BEGIN_INCLUDE_NAMESPACE -#include -QT_END_INCLUDE_NAMESPACE - -static void ps_r7(QPdf::ByteStream& stream, const char * s, int l) -{ - int i = 0; - uchar line[84]; - int col = 0; - - while(i < l) { - line[col++] = s[i++]; - if (i < l - 1 && col >= 76) { - line[col++] = '\n'; - line[col++] = '\0'; - stream << (const char *)line; - col = 0; - } - } - if (col > 0) { - while((col&3) != 0) - line[col++] = '%'; // use a comment as padding - line[col++] = '\n'; - line[col++] = '\0'; - stream << (const char *)line; - } -} - -static QByteArray runlengthEncode(const QByteArray &input) -{ - if (!input.length()) - return input; - - const char *data = input.constData(); - - QByteArray out; - int start = 0; - char last = *data; - - enum State { - Undef, - Equal, - Diff - }; - State state = Undef; - - int i = 1; - int written = 0; - while (1) { - bool flush = (i == input.size()); - if (!flush) { - switch(state) { - case Undef: - state = (last == data[i]) ? Equal : Diff; - break; - case Equal: - if (data[i] != last) - flush = true; - break; - case Diff: - if (data[i] == last) { - --i; - flush = true; - } - } - } - if (flush || i - start == 128) { - int size = i - start; - if (state == Equal) { - out.append((char)(uchar)(257-size)); - out.append(last); - written += size; - } else { - out.append((char)(uchar)size-1); - while (start < i) - out.append(data[start++]); - written += size; - } - state = Undef; - start = i; - if (i == input.size()) - break; - } - last = data[i]; - ++i; - }; - out.append((char)(uchar)128); - return out; -} - -enum format { - Raw, - Runlength, - DCT -}; -static const char *const filters[3] = { - " ", - "/RunLengthDecode filter ", - "/DCTDecode filter " -}; - -static QByteArray compressHelper(const QImage &image, bool gray, int *format) -{ - // we can't use premultiplied here - QByteArray pixelData; - int depth = image.depth(); - - Q_ASSERT(image.format() != QImage::Format_ARGB32_Premultiplied); - - if (depth != 1 && !gray && QImageWriter::supportedImageFormats().contains("jpeg")) { - QBuffer buffer(&pixelData); - QImageWriter writer(&buffer, "jpeg"); - writer.setQuality(94); - writer.write(image); - *format = DCT; - } else { - int width = image.width(); - int height = image.height(); - int size = width*height; - - if (depth == 1) - size = (width+7)/8*height; - else if (!gray) - size = size*3; - - pixelData.resize(size); - uchar *pixel = (uchar *)pixelData.data(); - int i = 0; - if (depth == 1) { - QImage::Format format = image.format(); - memset(pixel, 0xff, size); - for(int y=0; y < height; y++) { - const uchar * s = image.scanLine(y); - for(int x=0; x < width; x++) { - // need to copy bit for bit... - bool b = (format == QImage::Format_MonoLSB) ? - (*(s + (x >> 3)) >> (x & 7)) & 1 : - (*(s + (x >> 3)) << (x & 7)) & 0x80 ; - if (b) - pixel[i >> 3] ^= (0x80 >> (i & 7)); - i++; - } - // we need to align to 8 bit here - i = (i+7) & 0xffffff8; - } - } else if (depth == 8) { - for(int y=0; y < height; y++) { - const uchar * s = image.scanLine(y); - for(int x=0; x < width; x++) { - QRgb rgb = image.color(s[x]); - if (gray) { - pixel[i] = (unsigned char) qGray(rgb); - i++; - } else { - pixel[i] = (unsigned char) qRed(rgb); - pixel[i+1] = (unsigned char) qGreen(rgb); - pixel[i+2] = (unsigned char) qBlue(rgb); - i += 3; - } - } - } - } else { - for(int y=0; y < height; y++) { - QRgb * s = (QRgb*)(image.scanLine(y)); - for(int x=0; x < width; x++) { - QRgb rgb = (*s++); - if (gray) { - pixel[i] = (unsigned char) qGray(rgb); - i++; - } else { - pixel[i] = (unsigned char) qRed(rgb); - pixel[i+1] = (unsigned char) qGreen(rgb); - pixel[i+2] = (unsigned char) qBlue(rgb); - i += 3; - } - } - } - } - *format = Raw; - if (depth == 1) { - pixelData = runlengthEncode(pixelData); - *format = Runlength; - } - } - QByteArray outarr = QPdf::ascii85Encode(pixelData); - return outarr; -} - -void QPSPrintEnginePrivate::drawImageHelper(qreal x, qreal y, qreal w, qreal h, const QImage &img, - const QImage &mask, bool gray, qreal scaleX, qreal scaleY) -{ - Q_UNUSED(h); - Q_UNUSED(w); - int width = img.width(); - int height = img.height(); - - QByteArray out; - int size = 0; - const char *bits; - - if (!mask.isNull()) { - int format; - out = compressHelper(mask, true, &format); - size = (width+7)/8*height; - *currentPage << "/mask currentfile/ASCII85Decode filter" - << filters[format] - << size << " string readstring\n"; - ps_r7(*currentPage, out, out.size()); - *currentPage << " pop def\n"; - } - if (img.depth() == 1) { - size = (width+7)/8*height; - bits = "1 "; - } else if (gray) { - size = width*height; - bits = "8 "; - } else { - size = width*height*3; - bits = "24 "; - } - - int format; - out = compressHelper(img, gray, &format); - *currentPage << "/sl currentfile/ASCII85Decode filter" - << filters[format] - << size << " string readstring\n"; - ps_r7(*currentPage, out, out.size()); - *currentPage << " pop def\n"; - *currentPage << width << ' ' << height << '[' << scaleX << " 0 0 " << scaleY << " 0 0]sl " - << bits << (!mask.isNull() ? "mask " : "false ") - << x << ' ' << y << " di\n"; -} - - -void QPSPrintEnginePrivate::drawImage(qreal x, qreal y, qreal w, qreal h, - const QImage &image, const QImage &msk) -{ - if (!w || !h || image.isNull()) return; - - QImage img(image); - QImage mask(msk); - - if (image.format() == QImage::Format_ARGB32_Premultiplied) - img = image.convertToFormat(QImage::Format_ARGB32); - - if (!msk.isNull() && msk.format() == QImage::Format_ARGB32_Premultiplied) - mask = msk.convertToFormat(QImage::Format_ARGB32); - - int width = img.width(); - int height = img.height(); - qreal scaleX = width/w; - qreal scaleY = height/h; - - bool gray = (colorMode == QPrinter::GrayScale) || img.allGray(); - int splitSize = 21830 * (gray ? 3 : 1); - if (width * height > splitSize) { // 65535/3, tolerance for broken printers - int images, subheight; - images = (width * height + splitSize - 1) / splitSize; - subheight = (height + images-1) / images; - while (subheight * width > splitSize) { - images++; - subheight = (height + images-1) / images; - } - int suby = 0; - const QImage constImg(img); - const QImage constMask(mask); - while(suby < height) { - qreal subImageHeight = qMin(subheight, height-suby); - const QImage subImage(constImg.scanLine(suby), width, subImageHeight, - constImg.bytesPerLine(), constImg.format()); - const QImage subMask = mask.isNull() ? mask : QImage(constMask.scanLine(suby), width, subImageHeight, - constMask.bytesPerLine(), constMask.format()); - drawImageHelper(x, y + suby/scaleY, w, subImageHeight/scaleY, - subImage, subMask, gray, scaleX, scaleY); - suby += subheight; - } - } else { - drawImageHelper(x, y, width, height, img, mask, gray, scaleX, scaleY); - } -} - -void QPSPrintEnginePrivate::emitHeader(bool finished) -{ - QPSPrintEngine *q = static_cast(q_ptr); - QPrinter *printer = static_cast(pdev); - - if (creator.isEmpty()) - creator = QLatin1String("Qt " QT_VERSION_STR); - - QByteArray header; - QPdf::ByteStream s(&header); - - qreal scale = 72. / ((qreal) q->metric(QPaintDevice::PdmDpiY)); - QRect pageRect = this->pageRect(); - QRect paperRect = this->paperRect(); - int mtop = pageRect.top() - paperRect.top(); - int mleft = pageRect.left() - paperRect.left(); - int mbottom = paperRect.bottom() - pageRect.bottom(); - int mright = paperRect.right() - pageRect.right(); - int width = pageRect.width(); - int height = pageRect.height(); - if (finished && pageCount == 1 && copies == 1 && - ((fullPage && qt_gen_epsf) || (outputFileName.endsWith(QLatin1String(".eps"))))) - { - // According to the EPSF 3.0 spec it is required that the PS - // version is PS-Adobe-3.0 - s << "%!PS-Adobe-3.0"; - if (!boundingBox.isValid()) - boundingBox.setRect(0, 0, width, height); - if (orientation == QPrinter::Landscape) { - if (!fullPage) - boundingBox.translate(-mleft, -mtop); - s << " EPSF-3.0\n%%BoundingBox: " - << int((printer->height() - boundingBox.bottom())*scale) // llx - << int((printer->width() - boundingBox.right())*scale - 1) // lly - << int((printer->height() - boundingBox.top())*scale + 1) // urx - << int((printer->width() - boundingBox.left())*scale); // ury - } else { - if (!fullPage) - boundingBox.translate(mleft, -mtop); - s << " EPSF-3.0\n%%BoundingBox: " - << int((boundingBox.left())*scale) - << int((printer->height() - boundingBox.bottom())*scale - 1) - << int((boundingBox.right())*scale + 1) - << int((printer->height() - boundingBox.top())*scale); - } - } else { - s << "%!PS-Adobe-1.0"; - int w = width + (fullPage ? 0 : mleft + mright); - int h = height + (fullPage ? 0 : mtop + mbottom); - w = (int)(w*scale); - h = (int)(h*scale); - // set a bounding box according to the DSC - if (orientation == QPrinter::Landscape) - s << "\n%%BoundingBox: 0 0 " << h << w; - else - s << "\n%%BoundingBox: 0 0 " << w << h; - } - s << '\n' << wrapDSC("%%Creator: " + creator.toUtf8()); - if (!title.isEmpty()) - s << wrapDSC("%%Title: " + title.toUtf8()); -#ifndef QT_NO_DATESTRING - s << "%%CreationDate: " << QDateTime::currentDateTime().toString().toUtf8(); -#endif - s << "\n%%Orientation: "; - if (orientation == QPrinter::Landscape) - s << "Landscape"; - else - s << "Portrait"; - - s << "\n%%Pages: (atend)" - "\n%%DocumentFonts: (atend)" - "\n%%EndComments\n" - - "%%BeginProlog\n" - "% Prolog copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).\n" - "% You may copy this prolog in any way that is directly related to this document.\n" - "% For other use of this prolog, see your licensing agreement for Qt.\n" - << ps_header << '\n'; - - - s << "/pageinit {\n"; - if (!fullPage) { - if (orientation == QPrinter::Portrait) - s << mleft*scale << mbottom*scale << "translate\n"; - else - s << mtop*scale << mleft*scale << "translate\n"; - } - if (orientation == QPrinter::Portrait) { - s << "% " << printer->widthMM() << '*' << printer->heightMM() - << "mm (portrait)\n0 " << height*scale - << "translate " << scale << '-' << scale << "scale } def\n"; - } else { - s << "% " << printer->heightMM() << '*' << printer->widthMM() - << " mm (landscape)\n 90 rotate " << scale << '-' << scale << "scale } def\n"; - } - s << "%%EndProlog\n"; - - outDevice->write(header); - headerDone = true; -} - - -void QPSPrintEnginePrivate::emitPages() -{ - if (!hugeDocument) { - for (QHash::const_iterator it = fonts.constBegin(); - it != fonts.constEnd(); ++it) - outDevice->write((*it)->toType1()); - } - - QIODevice *content = buffer.stream(); - // Write the page contents in chunks. - while (!content->atEnd()) { - QByteArray buf = content->read(currentPage->chunkSize()); - if (!buf.isEmpty()) - outDevice->write(buf); - } - content = currentPage->stream(); - // Write the page contents in chunks. - while (!content->atEnd()) { - QByteArray buf = content->read(currentPage->chunkSize()); - if (!buf.isEmpty()) - outDevice->write(buf); - } - outDevice->write(trailer); - - buffer.clear(); - currentPage->clear(); - trailer = QByteArray(); - hugeDocument = true; -} - - -#ifdef Q_WS_QWS -static const int max_in_memory_size = 2000000; -#else -static const int max_in_memory_size = 32000000; -#endif - -void QPSPrintEnginePrivate::flushPage(bool last) -{ - if (!last && currentPage->stream()->size() == 0) - return; - - QPdf::ByteStream e(&trailer); - buffer << "%%Page: " - << pageCount << pageCount << "\n" - "%%BeginPageSetup\n" - "QI\n"; - if (hugeDocument) { - for (QHash::const_iterator it = fonts.constBegin(); - it != fonts.constEnd(); ++it) { - if (currentPage->fonts.contains((*it)->object_id)) { - if ((*it)->downloaded_glyphs == 0) { - buffer << (*it)->toType1(); - (*it)->downloaded_glyphs = 0; - } else { - buffer << (*it)->type1AddedGlyphs(); - } - } - } - } - for (int i = 0; i < currentPage->fonts.size(); ++i) - buffer << "(F" << QByteArray::number(currentPage->fonts.at(i)) << ") T1Setup\n"; - - buffer << "%%EndPageSetup\nq\n"; - e << "\nQ QP\n"; - if (last || hugeDocument - || buffer.stream()->size() + currentPage->stream()->size() > max_in_memory_size) { -// qDebug("emiting header at page %d", pageCount); - if (!headerDone) - emitHeader(last); - emitPages(); - } else { - buffer << *currentPage << e; - currentPage->clear(); - trailer.clear(); - } - pageCount++; -} - -// ================ PSPrinter class ======================== - -QPSPrintEngine::QPSPrintEngine(QPrinter::PrinterMode m) - : QPdfBaseEngine(*(new QPSPrintEnginePrivate(m)), - PrimitiveTransform - | PatternTransform - | PixmapTransform - | PainterPaths - | PatternBrush - ) -{ -} - -static void ignoreSigPipe(bool b) -{ -#ifndef QT_NO_LPR - static struct sigaction *users_sigpipe_handler = 0; - static int lockCount = 0; - -#ifndef QT_NO_THREAD - QMutexLocker locker(QMutexPool::globalInstanceGet(&users_sigpipe_handler)); -#endif - - if (b) { - if (lockCount++ > 0) - return; - - if (users_sigpipe_handler != 0) - return; // already ignoring sigpipe - - users_sigpipe_handler = new struct sigaction; - struct sigaction tmp_sigpipe_handler; - tmp_sigpipe_handler.sa_handler = SIG_IGN; - sigemptyset(&tmp_sigpipe_handler.sa_mask); - tmp_sigpipe_handler.sa_flags = 0; - - if (sigaction(SIGPIPE, &tmp_sigpipe_handler, users_sigpipe_handler) == -1) { - delete users_sigpipe_handler; - users_sigpipe_handler = 0; - } - } - else { - if (--lockCount > 0) - return; - - if (users_sigpipe_handler == 0) - return; // not ignoring sigpipe - - if (sigaction(SIGPIPE, users_sigpipe_handler, 0) == -1) - qWarning("QPSPrintEngine: Could not restore SIGPIPE handler"); - - delete users_sigpipe_handler; - users_sigpipe_handler = 0; - } -#else - Q_UNUSED(b); -#endif -} -QPSPrintEngine::~QPSPrintEngine() -{ - Q_D(QPSPrintEngine); - if (d->fd >= 0) -#if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400 - ::_close(d->fd); -#else - ::close(d->fd); -#endif -} - -bool QPSPrintEngine::begin(QPaintDevice *pdev) -{ - Q_D(QPSPrintEngine); - - if (d->fd >= 0) - return true; - - if (d->useAlphaEngine) { - QAlphaPaintEngine::begin(pdev); - if (!continueCall()) - return true; - } - - if(!QPdfBaseEngine::begin(pdev)) { - d->printerState = QPrinter::Error; - return false; - } - - d->pageCount = 1; // initialize state - - d->pen = QPen(Qt::black); - d->brush = Qt::NoBrush; - d->hasPen = true; - d->hasBrush = false; - d->clipEnabled = false; - d->allClipped = false; - d->boundingBox = QRect(); - d->fontsUsed = ""; - d->hugeDocument = false; - d->simplePen = false; - - setActive(true); - d->printerState = QPrinter::Active; - - newPage(); - - return true; -} - -bool QPSPrintEngine::end() -{ - Q_D(QPSPrintEngine); - - if (d->useAlphaEngine) { - QAlphaPaintEngine::end(); - if (!continueCall()) - return true; - } - - // we're writing to lp/lpr through a pipe, we don't want to crash with SIGPIPE - // if lp/lpr dies - ignoreSigPipe(true); - d->flushPage(true); - QByteArray trailer; - QPdf::ByteStream s(&trailer); - s << "%%Trailer\n" - "%%Pages: " << d->pageCount - 1 << '\n' << - wrapDSC("%%DocumentFonts: " + d->fontsUsed); - s << "%%EOF\n"; - d->outDevice->write(trailer); - - QPdfBaseEngine::end(); - ignoreSigPipe(false); - - d->firstPage = true; - d->headerDone = false; - - setActive(false); - d->printerState = QPrinter::Idle; - d->pdev = 0; - - return true; -} - -void QPSPrintEngine::setBrush() -{ - Q_D(QPSPrintEngine); -#if 0 - bool specifyColor; - int gStateObject = 0; - int patternObject = d->addBrushPattern(brush, d->stroker.matrix, brushOrigin, &specifyColor, &gStateObject); - - *d->currentPage << (patternObject ? "/PCSp cs " : "/CSp cs "); - if (specifyColor) { - QColor rgba = brush.color(); - *d->currentPage << rgba.redF() - << rgba.greenF() - << rgba.blueF(); - } - if (patternObject) - *d->currentPage << "/Pat" << patternObject; - *d->currentPage << "scn\n"; -#endif - QColor rgba = d->brush.color(); - if (d->colorMode == QPrinter::GrayScale) { - qreal gray = qGray(rgba.rgba())/255.; - *d->currentPage << gray << gray << gray; - } else { - *d->currentPage << rgba.redF() - << rgba.greenF() - << rgba.blueF(); - } - *d->currentPage << "scn\n" - << "/BSt " << d->brush.style() << "def\n"; -} - -void QPSPrintEngine::drawImageInternal(const QRectF &r, QImage image, bool bitmap) -{ - Q_D(QPSPrintEngine); - if (d->clipEnabled && d->allClipped) - return; - if (bitmap && image.depth() != 1) - bitmap = false; - QImage mask; - // the below is not necessary since it's handled by the alpha - // engine - if (!d->useAlphaEngine && !bitmap) { - if (image.format() == QImage::Format_Mono || image.format() == QImage::Format_MonoLSB) - image = image.convertToFormat(QImage::Format_Indexed8); - if (image.hasAlphaChannel()) { - // get better alpha dithering - int xscale = image.width(); - xscale *= xscale <= 800 ? 4 : (xscale <= 1600 ? 2 : 1); - int yscale = image.height(); - yscale *= yscale <= 800 ? 4 : (yscale <= 1600 ? 2 : 1); - image = image.scaled(xscale, yscale); - mask = image.createAlphaMask(Qt::OrderedAlphaDither); - } - } - *d->currentPage << "q\n"; - if(!d->simplePen) - *d->currentPage << QPdf::generateMatrix(d->stroker.matrix); - QBrush b = d->brush; - if (image.depth() == 1) { - // set current pen as brush - d->brush = d->pen.brush(); - setBrush(); - } - d->drawImage(r.x(), r.y(), r.width(), r.height(), image, mask); - *d->currentPage << "Q\n"; - d->brush = b; -} - - -void QPSPrintEngine::drawImage(const QRectF &r, const QImage &img, const QRectF &sr, - Qt::ImageConversionFlags) -{ - Q_D(QPSPrintEngine); - - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawImage(r, img, sr); - if (!continueCall()) - return; - } - QImage image = img.copy(sr.toRect()); - drawImageInternal(r, image, false); -} - -void QPSPrintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) -{ - Q_D(QPSPrintEngine); - - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawPixmap(r, pm, sr); - if (!continueCall()) - return; - } - - QImage img = pm.copy(sr.toRect()).toImage(); - drawImageInternal(r, img, true); -} - -void QPSPrintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &p) -{ - Q_D(QPSPrintEngine); - - if (d->useAlphaEngine) { - QAlphaPaintEngine::drawTiledPixmap(r, pixmap, p); - if (!continueCall()) - return; - } - - if (d->clipEnabled && d->allClipped) - return; - // ### Optimize implementation! - qreal yPos = r.y(); - qreal yOff = p.y(); - while(yPos < r.y() + r.height()) { - qreal drawH = pixmap.height() - yOff; // Cropping first row - if (yPos + drawH > r.y() + r.height()) // Cropping last row - drawH = r.y() + r.height() - yPos; - qreal xPos = r.x(); - qreal xOff = p.x(); - while(xPos < r.x() + r.width()) { - qreal drawW = pixmap.width() - xOff; // Cropping first column - if (xPos + drawW > r.x() + r.width()) // Cropping last column - drawW = r.x() + r.width() - xPos; - // ######## - painter()->drawPixmap(QPointF(xPos, yPos).toPoint(), pixmap, - QRectF(xOff, yOff, drawW, drawH).toRect()); - xPos += drawW; - xOff = 0; - } - yPos += drawH; - yOff = 0; - } - -} - -bool QPSPrintEngine::newPage() -{ - Q_D(QPSPrintEngine); - - if (!d->firstPage && d->useAlphaEngine) - flushAndInit(); - - // we're writing to lp/lpr through a pipe, we don't want to crash with SIGPIPE - // if lp/lpr dies - ignoreSigPipe(true); - if (!d->firstPage) - d->flushPage(); - d->firstPage = false; - ignoreSigPipe(false); - - delete d->currentPage; - d->currentPage = new QPdfPage; - d->stroker.stream = d->currentPage; - - return QPdfBaseEngine::newPage(); -} - -bool QPSPrintEngine::abort() -{ - // ### abort!?! - return false; -} - -QPrinter::PrinterState QPSPrintEngine::printerState() const -{ - Q_D(const QPSPrintEngine); - return d->printerState; -} - -QT_END_NAMESPACE - -#endif // QT_NO_PRINTER diff --git a/src/gui/painting/qprintengine_ps_p.h b/src/gui/painting/qprintengine_ps_p.h deleted file mode 100644 index e5203c10419..00000000000 --- a/src/gui/painting/qprintengine_ps_p.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPRINTENGINE_PS_P_H -#define QPRINTENGINE_PS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qpsprinter.cpp and qprinter_x11.cpp. -// This header file may change from version to version without notice, -// or even be removed. -// -// We mean it. -// - -#ifndef QT_NO_PRINTER - -#include "private/qpdf_p.h" -#include "qplatformdefs.h" -#include "QtCore/qlibrary.h" -#include "QtCore/qstringlist.h" -#include "QtCore/qhash.h" -#include "QtCore/qabstractitemmodel.h" - -QT_BEGIN_NAMESPACE - -class QPrinter; -class QPSPrintEnginePrivate; - -class QPSPrintEngine : public QPdfBaseEngine -{ - Q_DECLARE_PRIVATE(QPSPrintEngine) -public: - // QPrinter uses these - explicit QPSPrintEngine(QPrinter::PrinterMode m); - ~QPSPrintEngine(); - - - virtual bool begin(QPaintDevice *pdev); - virtual bool end(); - - void setBrush(); - - virtual void drawImage(const QRectF &r, const QImage &img, const QRectF &sr, Qt::ImageConversionFlags); - virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); - - virtual void drawImageInternal(const QRectF &r, QImage img, bool bitmap); - - virtual QPaintEngine::Type type() const { return QPaintEngine::PostScript; } - - virtual bool newPage(); - virtual bool abort(); - - virtual QPrinter::PrinterState printerState() const; - - virtual Qt::HANDLE handle() const { return 0; } - -private: - Q_DISABLE_COPY(QPSPrintEngine) -}; - -class QPSPrintEnginePrivate : public QPdfBaseEnginePrivate { -public: - QPSPrintEnginePrivate(QPrinter::PrinterMode m); - ~QPSPrintEnginePrivate(); - - void emitHeader(bool finished); - void emitPages(); - void drawImage(qreal x, qreal y, qreal w, qreal h, const QImage &img, const QImage &mask); - void flushPage(bool last = false); - void drawImageHelper(qreal x, qreal y, qreal w, qreal h, const QImage &img, const QImage &mask, - bool gray, qreal scaleX, qreal scaleY); - - int pageCount; - bool epsf; - QByteArray fontsUsed; - - // stores the descriptions of the n first pages. - QPdf::ByteStream buffer; - QByteArray trailer; - - bool firstPage; - - QRect boundingBox; - - QPrinter::PrinterState printerState; - bool hugeDocument; - bool headerDone; -}; - -QT_END_NAMESPACE - -#endif // QT_NO_PRINTER - -#endif // QPRINTENGINE_PS_P_H diff --git a/src/gui/painting/qprintengine_qws.cpp b/src/gui/painting/qprintengine_qws.cpp deleted file mode 100644 index 7b759c83c25..00000000000 --- a/src/gui/painting/qprintengine_qws.cpp +++ /dev/null @@ -1,886 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#ifndef QT_NO_PRINTER - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#define MM(n) int((n * 720 + 127) / 254) -#define IN(n) int(n * 72) - -extern QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size); - -QtopiaPrintEngine::QtopiaPrintEngine(QPrinter::PrinterMode mode) - : QPaintEngine(*(new QtopiaPrintEnginePrivate( mode ))) -{ - d_func()->initialize(); -} - -bool QtopiaPrintEngine::begin(QPaintDevice *) -{ - Q_D(QtopiaPrintEngine); - Q_ASSERT_X(d->printerState == QPrinter::Idle, "QtopiaPrintEngine", "printer already active"); - - // Create a new off-screen monochrome image to handle the drawing process. - QSize size = paperRect().size(); - if ( d->pageImage ) - delete d->pageImage; - d->pageImage = new QImage( size, QImage::Format_RGB32 ); - if ( !(d->pageImage) ) - return false; - - // Recreate the paint engine on the new image. - delete d->_paintEngine; - d->_paintEngine = 0; - d->paintEngine()->state = state; - - // Begin the paint process on the image. - if (!d->paintEngine()->begin(d->pageImage)) - return false; - - // Clear the first page to all-white. - clearPage(); - - // Clear the print buffer and output the image header. - d->buffer.clear(); - d->writeG3FaxHeader(); - - // The print engine is currently active. - d->printerState = QPrinter::Active; - return true; -} - -bool QtopiaPrintEngine::end() -{ - Q_D(QtopiaPrintEngine); - - d->paintEngine()->end(); - - // Flush the last page. - flushPage(); - - // Output the fax data to a file (TODO: send to the print queuing daemon). - QString filename; - if ( !d->outputFileName.isEmpty() ) - filename = QString::fromLocal8Bit(qgetenv("HOME").constData()) + QLatin1String("/Documents/") + d->outputFileName; - else - filename = QString::fromLocal8Bit(qgetenv("HOME").constData()) + QLatin1String("/tmp/qwsfax.tiff"); - - setProperty(QPrintEngine::PPK_OutputFileName, filename); - QFile file( filename ); - if ( !file.open( QIODevice::WriteOnly | QIODevice::Truncate ) ) { - qDebug( "Failed to open %s for printer output", - filename.toLatin1().constData() ); - } else { - file.write( d->buffer.data() ); - file.close(); - } - - // Free up the memory for the image buffer. - d->buffer.clear(); - - // Finalize the print job. - d->printerState = QPrinter::Idle; - - // call qcop service - QMap map; - for ( int x = 0; x <= QPrintEngine::PPK_Duplex; x++ ) - map.insert( QString::number(x), property((QPrintEngine::PrintEnginePropertyKey)(x))); - QVariant variant(map); - - QByteArray data; - QDataStream out(&data, QIODevice::WriteOnly); - out << variant; - QCopChannel::send(QLatin1String("QPE/Service/Print"), QLatin1String("print(QVariant)"), data); - - return true; -} - -QPaintEngine *QtopiaPrintEngine::paintEngine() const -{ - return const_cast(d_func())->paintEngine(); -} - -void QtopiaPrintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) -{ - Q_D(QtopiaPrintEngine); - Q_ASSERT(d->printerState == QPrinter::Active); - d->paintEngine()->drawPixmap(r, pm, sr); -} - -void QtopiaPrintEngine::drawTextItem(const QPointF &p, const QTextItem &ti) -{ - Q_D(QtopiaPrintEngine); - Q_ASSERT(d->printerState == QPrinter::Active); - d->paintEngine()->drawTextItem(p, ti); -} - -void QtopiaPrintEngine::updateState(const QPaintEngineState &state) -{ - Q_D(QtopiaPrintEngine); - d->paintEngine()->updateState(state); -} - -QRect QtopiaPrintEngine::paperRect() const -{ - QSizeF s = qt_paperSizeToQSizeF(d_func()->paperSize); - s.rwidth() = MM(s.width()); - s.rheight() = MM(s.height()); - int w = qRound(s.width()*d_func()->resolution/72.); - int h = qRound(s.height()*d_func()->resolution/72.); - if (d_func()->orientation == QPrinter::Portrait) - return QRect(0, 0, w, h); - else - return QRect(0, 0, h, w); -} - -QRect QtopiaPrintEngine::pageRect() const -{ - QRect r = paperRect(); - if (d_func()->fullPage) - return r; - // would be nice to get better margins than this. - return QRect(d_func()->resolution/3, d_func()->resolution/3, r.width()-2*d_func()->resolution/3, r.height()-2*d_func()->resolution/3); -} - -bool QtopiaPrintEngine::newPage() -{ - flushPage(); - clearPage(); - ++(d_func()->pageNumber); - return true; -} - -bool QtopiaPrintEngine::abort() -{ - return false; -} - -QPrinter::PrinterState QtopiaPrintEngine::printerState() const -{ - return d_func()->printerState; -} - -int QtopiaPrintEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const -{ - int val; - QRect r = d_func()->fullPage ? paperRect() : pageRect(); - switch (metricType) { - case QPaintDevice::PdmWidth: - val = r.width(); - break; - case QPaintDevice::PdmHeight: - val = r.height(); - break; - case QPaintDevice::PdmDpiX: - val = d_func()->resolution; - break; - case QPaintDevice::PdmDpiY: - val = d_func()->resolution; - break; - case QPaintDevice::PdmPhysicalDpiX: - case QPaintDevice::PdmPhysicalDpiY: - val = QT_QWS_PRINTER_DEFAULT_DPI; - break; - case QPaintDevice::PdmWidthMM: - val = qRound(r.width()*25.4/d_func()->resolution); - break; - case QPaintDevice::PdmHeightMM: - val = qRound(r.height()*25.4/d_func()->resolution); - break; - case QPaintDevice::PdmNumColors: - val = 2; - break; - case QPaintDevice::PdmDepth: - val = 1; - break; - default: - qWarning("QtopiaPrintEngine::metric: Invalid metric command"); - return 0; - } - return val; -} - -QVariant QtopiaPrintEngine::property(PrintEnginePropertyKey key) const -{ - Q_D(const QtopiaPrintEngine); - QVariant ret; - - switch (key) { - case PPK_CollateCopies: - ret = d->collateCopies; - break; - case PPK_ColorMode: - ret = d->colorMode; - break; - case PPK_Creator: - ret = d->creator; - break; - case PPK_DocumentName: - ret = d->docName; - break; - case PPK_FullPage: - ret = d->fullPage; - break; - case PPK_CopyCount: // fallthrough - case PPK_NumberOfCopies: - ret = d->numCopies; - break; - case PPK_SupportsMultipleCopies: - ret = false; - break; - case PPK_Orientation: - ret = d->orientation; - break; - case PPK_OutputFileName: - ret = d->outputFileName; - break; - case PPK_PageOrder: - ret = d->pageOrder; - break; - case PPK_PageRect: - ret = pageRect(); - break; - case PPK_PaperSize: - ret = d->paperSize; - break; - case PPK_PaperRect: - ret = paperRect(); - break; - case PPK_PaperSource: - ret = d->paperSource; - break; - case PPK_PrinterName: - ret = d->printerName; - break; - case PPK_PrinterProgram: - ret = d->printProgram; - break; - case PPK_Resolution: - ret = d->resolution; - break; - case PPK_SupportedResolutions: - ret = QList() << QT_QWS_PRINTER_DEFAULT_DPI; - break; - default: - break; - } - return ret; -} - -void QtopiaPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value) -{ - Q_D(QtopiaPrintEngine); - switch (key) { - case PPK_CollateCopies: - d->collateCopies = value.toBool(); - break; - case PPK_ColorMode: - d->colorMode = QPrinter::ColorMode(value.toInt()); - break; - case PPK_Creator: - d->creator = value.toString(); - break; - case PPK_DocumentName: - d->docName = value.toString(); - break; - case PPK_FullPage: - d->fullPage = value.toBool(); - break; - case PPK_CopyCount: // fallthrough - case PPK_NumberOfCopies: - d->numCopies = value.toInt(); - break; - case PPK_Orientation: - d->orientation = QPrinter::Orientation(value.toInt()); - break; - case PPK_OutputFileName: - d->outputFileName = value.toString(); - break; - case PPK_PageOrder: - d->pageOrder = QPrinter::PageOrder(value.toInt()); - break; - case PPK_PaperSize: - d->paperSize = QPrinter::PaperSize(value.toInt()); - break; - case PPK_PaperSource: - d->paperSource = QPrinter::PaperSource(value.toInt()); - case PPK_PrinterName: - d->printerName = value.toString(); - break; - case PPK_PrinterProgram: - d->printProgram = value.toString(); - break; - case PPK_Resolution: - d->resolution = value.toInt(); - break; - default: - break; - } -} - -void QtopiaPrintEngine::clearPage() -{ - d_func()->pageImage->fill(QColor(255, 255, 255).rgb()); -} - -void QtopiaPrintEngine::flushPage() -{ - d_func()->writeG3FaxPage(); -} - -QtopiaPrintEnginePrivate::~QtopiaPrintEnginePrivate() -{ - if ( pageImage ) - delete pageImage; -} - -void QtopiaPrintEnginePrivate::initialize() -{ - _paintEngine = 0; -} - -QPaintEngine *QtopiaPrintEnginePrivate::paintEngine() -{ - if (!_paintEngine) - _paintEngine = new QRasterPaintEngine(pageImage); - return _paintEngine; -} - -void QtopiaPrintEnginePrivate::writeG3FaxHeader() -{ - // Write the TIFF file magic number (little-endian TIFF). - buffer.append( (char)'I' ); - buffer.append( (char)'I' ); - buffer.append( (char)42 ); - buffer.append( (char)0 ); - - // Leave a place-holder for the IFD offset of the first page. - ifdPatch = buffer.size(); - buffer.append( (int)0 ); -} - -// Tag values, from RFC 2301. -#define TIFF_IFD_NEW_SUB_FILE_TYPE 254 -#define TIFF_IFD_IMAGE_WIDTH 256 -#define TIFF_IFD_IMAGE_LENGTH 257 -#define TIFF_IFD_BITS_PER_SAMPLE 258 -#define TIFF_IFD_COMPRESSION 259 -#define TIFF_IFD_PHOTOMETRIC_INTERP 262 -#define TIFF_IFD_FILL_ORDER 266 -#define TIFF_IFD_STRIP_OFFSETS 273 -#define TIFF_IFD_ORIENTATION 274 -#define TIFF_IFD_SAMPLES_PER_PIXEL 277 -#define TIFF_IFD_ROWS_PER_STRIP 278 -#define TIFF_IFD_STRIP_BYTE_COUNTS 279 -#define TIFF_IFD_X_RESOLUTION 282 -#define TIFF_IFD_Y_RESOLUTION 283 -#define TIFF_IFD_PLANAR_CONFIG 284 -#define TIFF_IFD_T4_OPTIONS 292 -#define TIFF_IFD_RESOLUTION_UNIT 296 -#define TIFF_IFD_PAGE_NUMBER 297 -#define TIFF_IFD_CLEAN_FAX_DATA 327 - -// IFD type values. -#define TIFF_TYPE_SHORT 3 -#define TIFF_TYPE_LONG 4 -#define TIFF_TYPE_RATIONAL 5 - -// Construct a SHORT pair from two values. -#define TIFF_SHORT_PAIR(a,b) (((a) & 0xFFFF) | ((b) << 16)) - -// Width of a FAX page in pixels, in the baseline specification from RFC 2301. -// This must be hard-wired, as per the RFC. We truncate any pixels that -// are beyond this limit, or pad lines to reach this limit. -#define TIFF_FAX_WIDTH 1728 - -void QtopiaPrintEnginePrivate::writeG3FaxPage() -{ - // Pad the image file to a word boundary, just in case. - buffer.pad(); - - // Back-patch the IFD link for the previous page. - buffer.patch( ifdPatch, buffer.size() ); - - // Output the contents of the IFD for this page (these must be - // in ascending order of tag value). - buffer.append( (short)19 ); // Number of IFD entries. - writeG3IFDEntry( TIFF_IFD_NEW_SUB_FILE_TYPE, TIFF_TYPE_LONG, 1, 2 ); - writeG3IFDEntry( TIFF_IFD_IMAGE_WIDTH, TIFF_TYPE_LONG, 1, TIFF_FAX_WIDTH ); - writeG3IFDEntry - ( TIFF_IFD_IMAGE_LENGTH, TIFF_TYPE_LONG, 1, pageImage->height() ); - writeG3IFDEntry( TIFF_IFD_BITS_PER_SAMPLE, TIFF_TYPE_SHORT, 1, 1 ); - writeG3IFDEntry( TIFF_IFD_COMPRESSION, TIFF_TYPE_SHORT, 1, 3 ); - writeG3IFDEntry( TIFF_IFD_PHOTOMETRIC_INTERP, TIFF_TYPE_SHORT, 1, 0 ); - writeG3IFDEntry( TIFF_IFD_FILL_ORDER, TIFF_TYPE_SHORT, 1, 1 ); - int stripOffsets = - writeG3IFDEntry( TIFF_IFD_STRIP_OFFSETS, TIFF_TYPE_LONG, 1, 0 ); - writeG3IFDEntry( TIFF_IFD_ORIENTATION, TIFF_TYPE_SHORT, 1, 1 ); - writeG3IFDEntry( TIFF_IFD_SAMPLES_PER_PIXEL, TIFF_TYPE_SHORT, 1, 1 ); - writeG3IFDEntry - ( TIFF_IFD_ROWS_PER_STRIP, TIFF_TYPE_LONG, 1, pageImage->height() ); - int stripBytes = writeG3IFDEntry - ( TIFF_IFD_STRIP_BYTE_COUNTS, TIFF_TYPE_LONG, 1, 0 ); - int xres = - writeG3IFDEntry( TIFF_IFD_X_RESOLUTION, TIFF_TYPE_RATIONAL, 1, 0 ); - int yres = - writeG3IFDEntry( TIFF_IFD_Y_RESOLUTION, TIFF_TYPE_RATIONAL, 1, 0 ); - writeG3IFDEntry( TIFF_IFD_PLANAR_CONFIG, TIFF_TYPE_SHORT, 1, 1 ); - writeG3IFDEntry( TIFF_IFD_T4_OPTIONS, TIFF_TYPE_LONG, 1, 2 ); - writeG3IFDEntry( TIFF_IFD_RESOLUTION_UNIT, TIFF_TYPE_SHORT, 1, 2 ); - writeG3IFDEntry( TIFF_IFD_PAGE_NUMBER, TIFF_TYPE_SHORT, 2, - TIFF_SHORT_PAIR( pageNumber, 0 ) ); - writeG3IFDEntry( TIFF_IFD_CLEAN_FAX_DATA, TIFF_TYPE_SHORT, 1, 0 ); - - // Leave a place-holder for the IFD offset of the next page. - ifdPatch = buffer.size(); - buffer.append( (int)0 ); - - // Output the X and Y resolutions, as rational values (usually 200/1). - buffer.patch( xres, buffer.size() ); - buffer.append( (int)resolution ); - buffer.append( (int)1 ); - buffer.patch( yres, buffer.size() ); - buffer.append( (int)resolution ); - buffer.append( (int)1 ); - - // We are now at the start of the image data - set the strip offset. - int start = buffer.size(); - buffer.patch( stripOffsets, start ); - - // Output the image data. - int width = pageImage->width(); - QImage::Format imageFormat = pageImage->format(); - for ( int y = 0; y < pageImage->height(); ++y ) { - unsigned char *scan = pageImage->scanLine(y); - int prev, pixel, len; - writeG3EOL(); - prev = 0; - len = 0; - - uint currentColor = qRgb(255, 255, 255); // start with white - - for ( int x = 0; x < width && x < TIFF_FAX_WIDTH; ++x ) { - if ( imageFormat == QImage::Format_RGB32 ) { - // read color of the current pixel - uint *p = (uint *)scan + x; - - if ( *p == currentColor ) { // if it is the same color - len++; // imcrement length - } else { // otherwise write color into the buffer - if ( len > 0 ) { - if ( currentColor == qRgb(0, 0, 0) ) - writeG3BlackRun( len ); - else - writeG3WhiteRun( len ); - } - // initialise length and color; - len = 1; - currentColor = *p; - } - } else if ( imageFormat == QImage::Format_Mono ) { - pixel = ((scan[x >> 3] & (1 << (x & 7))) != 0); - if ( pixel != prev ) { - if ( prev ) { - writeG3BlackRun( len ); - } else { - writeG3WhiteRun( len ); - } - prev = pixel; - len = 1; - } else { - ++len; - } - } - } - - if ( imageFormat == QImage::Format_RGB32 ) { - // Output the last run on the line, and pad to TIFF_FAX_WIDTH. - if ( len != 0 ) { - if ( currentColor == qRgb(0, 0, 0) ) - writeG3BlackRun( len ); - else - writeG3WhiteRun( len ); - } - if ( width < TIFF_FAX_WIDTH ) - writeG3WhiteRun( TIFF_FAX_WIDTH - width ); - } else if ( imageFormat == QImage::Format_Mono ) { - if ( len != 0 ) { - if ( prev ) { - writeG3BlackRun( len ); - if ( width < TIFF_FAX_WIDTH ) { - writeG3WhiteRun( TIFF_FAX_WIDTH - width ); - } - } else { - if ( width < TIFF_FAX_WIDTH ) { - writeG3WhiteRun( len + ( TIFF_FAX_WIDTH - width ) ); - } else { - writeG3WhiteRun( len ); - } - } - } - } - } - - // Flush the last partial byte, which is padded with zero fill bits. - if ( partialBits > 0 ) { - buffer.append( (char)( partialByte << ( 8 - partialBits ) ) ); - partialByte = 0; - partialBits = 0; - } - - // end of page add six EOLs - for ( int i = 0; i < 6; i++ ) - writeG3EOL(); - - // Update the byte count for the image data strip. - buffer.patch( stripBytes, buffer.size() - start ); -} - -int QtopiaPrintEnginePrivate::writeG3IFDEntry - ( int tag, int type, int count, int value ) -{ - buffer.append( (short)tag ); - buffer.append( (short)type ); - buffer.append( count ); - buffer.append( value ); - return buffer.size() - 4; // Offset of the value for back-patching. -} - -void QtopiaPrintEnginePrivate::writeG3Code( int code, int bits ) -{ - partialByte = ( ( partialByte << bits ) | code ); - partialBits += bits; - while ( partialBits >= 8 ) { - partialBits -= 8; - buffer.append( (char)( partialByte >> partialBits ) ); - } -} - -void QtopiaPrintEnginePrivate::writeG3WhiteRun( int len ) -{ - static struct { - unsigned short code; - unsigned short bits; - } whiteCodes[64 + 27] = { - {0x0035, 8}, // 0 - {0x0007, 6}, - {0x0007, 4}, - {0x0008, 4}, - {0x000B, 4}, - {0x000C, 4}, - {0x000E, 4}, - {0x000F, 4}, - {0x0013, 5}, // 8 - {0x0014, 5}, - {0x0007, 5}, - {0x0008, 5}, - {0x0008, 6}, - {0x0003, 6}, - {0x0034, 6}, - {0x0035, 6}, - {0x002A, 6}, // 16 - {0x002B, 6}, - {0x0027, 7}, - {0x000C, 7}, - {0x0008, 7}, - {0x0017, 7}, - {0x0003, 7}, - {0x0004, 7}, - {0x0028, 7}, // 24 - {0x002B, 7}, - {0x0013, 7}, - {0x0024, 7}, - {0x0018, 7}, - {0x0002, 8}, - {0x0003, 8}, - {0x001A, 8}, - {0x001B, 8}, // 32 - {0x0012, 8}, - {0x0013, 8}, - {0x0014, 8}, - {0x0015, 8}, - {0x0016, 8}, - {0x0017, 8}, - {0x0028, 8}, - {0x0029, 8}, // 40 - {0x002A, 8}, - {0x002B, 8}, - {0x002C, 8}, - {0x002D, 8}, - {0x0004, 8}, - {0x0005, 8}, - {0x000A, 8}, - {0x000B, 8}, // 48 - {0x0052, 8}, - {0x0053, 8}, - {0x0054, 8}, - {0x0055, 8}, - {0x0024, 8}, - {0x0025, 8}, - {0x0058, 8}, - {0x0059, 8}, // 56 - {0x005A, 8}, - {0x005B, 8}, - {0x004A, 8}, - {0x004B, 8}, - {0x0032, 8}, - {0x0033, 8}, - {0x0034, 8}, - {0x001B, 5}, // Make up codes: 64 - {0x0012, 5}, // 128 - {0x0017, 6}, // 192 - {0x0037, 7}, // 256 - {0x0036, 8}, // 320 - {0x0037, 8}, // 384 - {0x0064, 8}, // 448 - {0x0065, 8}, // 512 - {0x0068, 8}, // 576 - {0x0067, 8}, // 640 - {0x00CC, 9}, // 704 - {0x00CD, 9}, // 768 - {0x00D2, 9}, // 832 - {0x00D3, 9}, // 896 - {0x00D4, 9}, // 960 - {0x00D5, 9}, // 1024 - {0x00D6, 9}, // 1088 - {0x00D7, 9}, // 1152 - {0x00D8, 9}, // 1216 - {0x00D9, 9}, // 1280 - {0x00DA, 9}, // 1344 - {0x00DB, 9}, // 1408 - {0x0098, 9}, // 1472 - {0x0099, 9}, // 1536 - {0x009A, 9}, // 1600 - {0x0018, 6}, // 1664 - {0x009B, 9}, // 1728 - }; - if ( len >= 64 ) { - int index = 63 + (len >> 6); - writeG3Code( whiteCodes[index].code, whiteCodes[index].bits ); - len &= 63; - } - writeG3Code( whiteCodes[len].code, whiteCodes[len].bits ); -} - -void QtopiaPrintEnginePrivate::writeG3BlackRun( int len ) -{ - static struct { - unsigned short code; - unsigned short bits; - } blackCodes[64 + 27] = { - {0x0037, 10}, // 0 - {0x0002, 3}, - {0x0003, 2}, - {0x0002, 2}, - {0x0003, 3}, - {0x0003, 4}, - {0x0002, 4}, - {0x0003, 5}, - {0x0005, 6}, // 8 - {0x0004, 6}, - {0x0004, 7}, - {0x0005, 7}, - {0x0007, 7}, - {0x0004, 8}, - {0x0007, 8}, - {0x0018, 9}, - {0x0017, 10}, // 16 - {0x0018, 10}, - {0x0008, 10}, - {0x0067, 11}, - {0x0068, 11}, - {0x006C, 11}, - {0x0037, 11}, - {0x0028, 11}, - {0x0017, 11}, // 24 - {0x0018, 11}, - {0x00CA, 12}, - {0x00CB, 12}, - {0x00CC, 12}, - {0x00CD, 12}, - {0x0068, 12}, - {0x0069, 12}, - {0x006A, 12}, // 32 - {0x006B, 12}, - {0x00D2, 12}, - {0x00D3, 12}, - {0x00D4, 12}, - {0x00D5, 12}, - {0x00D6, 12}, - {0x00D7, 12}, - {0x006C, 12}, // 40 - {0x006D, 12}, - {0x00DA, 12}, - {0x00DB, 12}, - {0x0054, 12}, - {0x0055, 12}, - {0x0056, 12}, - {0x0057, 12}, - {0x0064, 12}, // 48 - {0x0065, 12}, - {0x0052, 12}, - {0x0053, 12}, - {0x0024, 12}, - {0x0037, 12}, - {0x0038, 12}, - {0x0027, 12}, - {0x0028, 12}, // 56 - {0x0058, 12}, - {0x0059, 12}, - {0x002B, 12}, - {0x002C, 12}, - {0x005A, 12}, - {0x0066, 12}, - {0x0067, 12}, - {0x000F, 10}, // Make up codes: 64 - {0x00C8, 12}, // 128 - {0x00C9, 12}, // 192 - {0x005B, 12}, // 256 - {0x0033, 12}, // 320 - {0x0034, 12}, // 384 - {0x0035, 12}, // 448 - {0x006C, 13}, // 512 - {0x006D, 13}, // 576 - {0x004A, 13}, // 640 - {0x004B, 13}, // 704 - {0x004C, 13}, // 768 - {0x004D, 13}, // 832 - {0x0072, 13}, // 896 - {0x0073, 13}, // 960 - {0x0074, 13}, // 1024 - {0x0075, 13}, // 1088 - {0x0076, 13}, // 1152 - {0x0077, 13}, // 1216 - {0x0052, 13}, // 1280 - {0x0053, 13}, // 1344 - {0x0054, 13}, // 1408 - {0x0055, 13}, // 1472 - {0x005A, 13}, // 1536 - {0x005B, 13}, // 1600 - {0x0064, 13}, // 1664 - {0x0065, 13}, // 1728 - }; - if ( len >= 64 ) { - int index = 63 + (len >> 6); - writeG3Code( blackCodes[index].code, blackCodes[index].bits ); - len &= 63; - } - writeG3Code( blackCodes[len].code, blackCodes[len].bits ); -} - -void QtopiaPrintEnginePrivate::writeG3EOL() -{ - int bitToPad; - if ( partialBits <= 4 ) { - bitToPad = 4 - partialBits; - } else { - bitToPad = 8 - partialBits + 4; - } - - partialByte = ((partialByte << (bitToPad + 12)) | 0x0001); - partialBits += bitToPad + 12; - - while ( partialBits >= 8 ) { - partialBits -= 8; - buffer.append( (char)(partialByte >> partialBits ) ); - } -// writeG3Code( 0x0001, 12 ); -} - -void QtopiaPrintBuffer::append( short value ) -{ - if ( _bigEndian ) { - _data.append( (char)(value >> 8) ); - _data.append( (char)value ); - } else { - _data.append( (char)value ); - _data.append( (char)(value >> 8) ); - } -} - -void QtopiaPrintBuffer::append( int value ) -{ - if ( _bigEndian ) { - _data.append( (char)(value >> 24) ); - _data.append( (char)(value >> 16) ); - _data.append( (char)(value >> 8) ); - _data.append( (char)value ); - } else { - _data.append( (char)value ); - _data.append( (char)(value >> 8) ); - _data.append( (char)(value >> 16) ); - _data.append( (char)(value >> 24) ); - } -} - -void QtopiaPrintBuffer::patch( int posn, int value ) -{ - if ( _bigEndian ) { - _data[posn] = (char)(value >> 24); - _data[posn + 1] = (char)(value >> 16); - _data[posn + 2] = (char)(value >> 8); - _data[posn + 3] = (char)value; - } else { - _data[posn] = (char)value; - _data[posn + 1] = (char)(value >> 8); - _data[posn + 2] = (char)(value >> 16); - _data[posn + 3] = (char)(value >> 24); - } -} - -void QtopiaPrintBuffer::pad() -{ - while ( ( _data.size() % 4 ) != 0 ) - _data.append( (char)0 ); -} - -QT_END_NAMESPACE - -#endif // QT_NO_PRINTER diff --git a/src/gui/painting/qprintengine_qws_p.h b/src/gui/painting/qprintengine_qws_p.h deleted file mode 100644 index e797914180f..00000000000 --- a/src/gui/painting/qprintengine_qws_p.h +++ /dev/null @@ -1,213 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPRINTENGINE_QWS_P_H -#define QPRINTENGINE_QWS_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 "QtGui/qprinter.h" - -#ifndef QT_NO_PRINTER - -#include "QtGui/qprintengine.h" -#include "QtCore/qbytearray.h" -#include "private/qpaintengine_p.h" - -QT_BEGIN_NAMESPACE - -class QtopiaPrintEnginePrivate; -class QRasterPaintEngine; -class QPrinterPrivate; -class QImage; - -class QtopiaPrintEngine : public QPaintEngine, public QPrintEngine -{ - Q_DECLARE_PRIVATE(QtopiaPrintEngine) -public: - QtopiaPrintEngine(QPrinter::PrinterMode mode); - - // override QWSPaintEngine - bool begin(QPaintDevice *dev); - bool end(); - void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - void drawTextItem(const QPointF &p, const QTextItem &ti); - QPaintEngine::Type type() const { return QPaintEngine::X11; } - - QPaintEngine *paintEngine() const; - - void updateState(const QPaintEngineState &state); - - QRect paperRect() const; - QRect pageRect() const; - - bool newPage(); - bool abort(); - - QPrinter::PrinterState printerState() const; - - int metric(QPaintDevice::PaintDeviceMetric metricType) const; - - QVariant property(PrintEnginePropertyKey key) const; - void setProperty(PrintEnginePropertyKey key, const QVariant &value); - -private: - friend class QPrintDialog; - friend class QPageSetupDialog; - - void clearPage(); - void flushPage(); -}; - -class QtopiaPrintBuffer -{ -public: - QtopiaPrintBuffer( bool bigEndian=FALSE ) { _bigEndian = bigEndian; } - ~QtopiaPrintBuffer() {} - - const QByteArray& data() const { return _data; } - - int size() const { return _data.size(); } - - void clear() { _data.clear(); } - - void append( char value ) { _data.append( value ); } - void append( short value ); - void append( int value ); - void append( const QByteArray& array ) { _data.append( array ); } - - void patch( int posn, int value ); - - void pad(); - -private: - QByteArray _data; - bool _bigEndian; -}; - -#define QT_QWS_PRINTER_DEFAULT_DPI 200 - -class QtopiaPrintEnginePrivate : public QPaintEnginePrivate -{ - Q_DECLARE_PUBLIC(QtopiaPrintEngine) -public: - QtopiaPrintEnginePrivate(QPrinter::PrinterMode m) : - mode(m), - printerState(QPrinter::Idle), - orientation(QPrinter::Portrait), - paperSize(QPrinter::A4), - pageOrder(QPrinter::FirstPageFirst), - colorMode(QPrinter::GrayScale), - paperSource(QPrinter::OnlyOne), - resolution(QT_QWS_PRINTER_DEFAULT_DPI), - _paintEngine(0), - numCopies(1), - outputToFile(false), - fullPage(false), - collateCopies(false), - pageNumber(0), - pageImage(0), - partialByte(0), - partialBits(0) - { - } - ~QtopiaPrintEnginePrivate(); - - void initialize(); - QPaintEngine *paintEngine(); - - QPrinter::PrinterMode mode; - - QString printerName; - QString outputFileName; - QString printProgram; - QString docName; - QString creator; - - QPrinter::PrinterState printerState; - - QPrinter::Orientation orientation; - QPrinter::PaperSize paperSize; - QPrinter::PageOrder pageOrder; - QPrinter::ColorMode colorMode; - QPrinter::PaperSource paperSource; - - int resolution; - QPaintEngine *_paintEngine; - int numCopies; - - bool outputToFile; - bool fullPage; - bool collateCopies; - - int pageNumber; - - QImage *pageImage; - - QtopiaPrintBuffer buffer; - - // Definitions that are only relevant to G3FAX output. - int ifdPatch; - int partialByte; - int partialBits; - void writeG3FaxHeader(); - void writeG3FaxPage(); - int writeG3IFDEntry( int tag, int type, int count, int value ); - void writeG3Code( int code, int bits ); - void writeG3WhiteRun( int len ); - void writeG3BlackRun( int len ); - void writeG3EOL(); -}; - -QT_END_NAMESPACE - -#endif // QT_NO_PRINTER - -#endif // QPRINTENGINE_QWS_P_H diff --git a/src/gui/painting/qpsprinter.agl b/src/gui/painting/qpsprinter.agl deleted file mode 100644 index 137b64c53be..00000000000 --- a/src/gui/painting/qpsprinter.agl +++ /dev/null @@ -1,452 +0,0 @@ -# the next table is derived from a list provided by Adobe on its web -# server: http://partners.adobe.com/asn/developer/typeforum/glyphlist.txt - -# the start of the header comment: -# -# Name: Adobe Glyph List -# Table version: 1.2 -# Date: 22 Oct 1998 -# -# Description: -# -# The Adobe Glyph List (AGL) list relates Unicode values (UVs) to glyph -# names, and should be used only as described in the document "Unicode and -# Glyph Names," at -# http://partners.adobe.com:80/asn/developer/type/unicodegn.html -# -# IMPORTANT NOTE: -# the list contains glyphs in the private use area of unicode. -# These should get removed when regenerating the glyphlist. -# -# also 0 should be mapped to .notdef -# -# grep '^[0-9A-F][0-9A-F][0-9A-F][0-9A-F];' < /tmp/glyphlist.txt | sed -e 's/;/, "/' -e 's-;-" }, // -' -e 's/^/ { 0x/' | sort -# -0x0000, ".notdef" -0x0020, "space" # SPACE -0x0021, "exclam" # EXCLAMATION MARK -0x0022, "quotedbl" # QUOTATION MARK -0x0023, "numbersign" # NUMBER SIGN -0x0024, "dollar" # DOLLAR SIGN -0x0025, "percent" # PERCENT SIGN -0x0026, "ampersand" # AMPERSAND -0x0027, "quotesingle" # APOSTROPHE -0x0028, "parenleft" # LEFT PARENTHESIS -0x0029, "parenright" # RIGHT PARENTHESIS -0x002A, "asterisk" # ASTERISK -0x002B, "plus" # PLUS SIGN -0x002C, "comma" # COMMA -0x002D, "hyphen" # HYPHEN-MINUS -0x002E, "period" # FULL STOP -0x002F, "slash" # SOLIDUS -0x0030, "zero" # DIGIT ZERO -0x0031, "one" # DIGIT ONE -0x0032, "two" # DIGIT TWO -0x0033, "three" # DIGIT THREE -0x0034, "four" # DIGIT FOUR -0x0035, "five" # DIGIT FIVE -0x0036, "six" # DIGIT SIX -0x0037, "seven" # DIGIT SEVEN -0x0038, "eight" # DIGIT EIGHT -0x0039, "nine" # DIGIT NINE -0x003A, "colon" # COLON -0x003B, "semicolon" # SEMICOLON -0x003C, "less" # LESS-THAN SIGN -0x003D, "equal" # EQUALS SIGN -0x003E, "greater" # GREATER-THAN SIGN -0x003F, "question" # QUESTION MARK -0x0040, "at" # COMMERCIAL AT -0x0041, "A" # LATIN CAPITAL LETTER A -0x0042, "B" # LATIN CAPITAL LETTER B -0x0043, "C" # LATIN CAPITAL LETTER C -0x0044, "D" # LATIN CAPITAL LETTER D -0x0045, "E" # LATIN CAPITAL LETTER E -0x0046, "F" # LATIN CAPITAL LETTER F -0x0047, "G" # LATIN CAPITAL LETTER G -0x0048, "H" # LATIN CAPITAL LETTER H -0x0049, "I" # LATIN CAPITAL LETTER I -0x004A, "J" # LATIN CAPITAL LETTER J -0x004B, "K" # LATIN CAPITAL LETTER K -0x004C, "L" # LATIN CAPITAL LETTER L -0x004D, "M" # LATIN CAPITAL LETTER M -0x004E, "N" # LATIN CAPITAL LETTER N -0x004F, "O" # LATIN CAPITAL LETTER O -0x0050, "P" # LATIN CAPITAL LETTER P -0x0051, "Q" # LATIN CAPITAL LETTER Q -0x0052, "R" # LATIN CAPITAL LETTER R -0x0053, "S" # LATIN CAPITAL LETTER S -0x0054, "T" # LATIN CAPITAL LETTER T -0x0055, "U" # LATIN CAPITAL LETTER U -0x0056, "V" # LATIN CAPITAL LETTER V -0x0057, "W" # LATIN CAPITAL LETTER W -0x0058, "X" # LATIN CAPITAL LETTER X -0x0059, "Y" # LATIN CAPITAL LETTER Y -0x005A, "Z" # LATIN CAPITAL LETTER Z -0x005B, "bracketleft" # LEFT SQUARE BRACKET -0x005C, "backslash" # REVERSE SOLIDUS -0x005D, "bracketright" # RIGHT SQUARE BRACKET -0x005E, "asciicircum" # CIRCUMFLEX ACCENT -0x005F, "underscore" # LOW LINE -0x0060, "grave" # GRAVE ACCENT -0x0061, "a" # LATIN SMALL LETTER A -0x0062, "b" # LATIN SMALL LETTER B -0x0063, "c" # LATIN SMALL LETTER C -0x0064, "d" # LATIN SMALL LETTER D -0x0065, "e" # LATIN SMALL LETTER E -0x0066, "f" # LATIN SMALL LETTER F -0x0067, "g" # LATIN SMALL LETTER G -0x0068, "h" # LATIN SMALL LETTER H -0x0069, "i" # LATIN SMALL LETTER I -0x006A, "j" # LATIN SMALL LETTER J -0x006B, "k" # LATIN SMALL LETTER K -0x006C, "l" # LATIN SMALL LETTER L -0x006D, "m" # LATIN SMALL LETTER M -0x006E, "n" # LATIN SMALL LETTER N -0x006F, "o" # LATIN SMALL LETTER O -0x0070, "p" # LATIN SMALL LETTER P -0x0071, "q" # LATIN SMALL LETTER Q -0x0072, "r" # LATIN SMALL LETTER R -0x0073, "s" # LATIN SMALL LETTER S -0x0074, "t" # LATIN SMALL LETTER T -0x0075, "u" # LATIN SMALL LETTER U -0x0076, "v" # LATIN SMALL LETTER V -0x0077, "w" # LATIN SMALL LETTER W -0x0078, "x" # LATIN SMALL LETTER X -0x0079, "y" # LATIN SMALL LETTER Y -0x007A, "z" # LATIN SMALL LETTER Z -0x007B, "braceleft" # LEFT CURLY BRACKET -0x007C, "bar" # VERTICAL LINE -0x007D, "braceright" # RIGHT CURLY BRACKET -0x007E, "asciitilde" # TILDE -0x00A0, "space" # NO-BREAK SPACE;Duplicate -0x00A1, "exclamdown" # INVERTED EXCLAMATION MARK -0x00A2, "cent" # CENT SIGN -0x00A3, "sterling" # POUND SIGN -0x00A4, "currency" # CURRENCY SIGN -0x00A5, "yen" # YEN SIGN -0x00A6, "brokenbar" # BROKEN BAR -0x00A7, "section" # SECTION SIGN -0x00A8, "dieresis" # DIAERESIS -0x00A9, "copyright" # COPYRIGHT SIGN -0x00AA, "ordfeminine" # FEMININE ORDINAL INDICATOR -0x00AB, "guillemotleft" # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK -0x00AC, "logicalnot" # NOT SIGN -0x00AD, "hyphen" # SOFT HYPHEN;Duplicate -0x00AE, "registered" # REGISTERED SIGN -0x00AF, "macron" # MACRON -0x00B0, "degree" # DEGREE SIGN -0x00B1, "plusminus" # PLUS-MINUS SIGN -0x00B2, "twosuperior" # SUPERSCRIPT TWO -0x00B3, "threesuperior" # SUPERSCRIPT THREE -0x00B4, "acute" # ACUTE ACCENT -0x00B5, "mu" # MICRO SIGN -0x00B6, "paragraph" # PILCROW SIGN -0x00B7, "periodcentered" # MIDDLE DOT -0x00B8, "cedilla" # CEDILLA -0x00B9, "onesuperior" # SUPERSCRIPT ONE -0x00BA, "ordmasculine" # MASCULINE ORDINAL INDICATOR -0x00BB, "guillemotright" # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK -0x00BC, "onequarter" # VULGAR FRACTION ONE QUARTER -0x00BD, "onehalf" # VULGAR FRACTION ONE HALF -0x00BE, "threequarters" # VULGAR FRACTION THREE QUARTERS -0x00BF, "questiondown" # INVERTED QUESTION MARK -0x00C0, "Agrave" # LATIN CAPITAL LETTER A WITH GRAVE -0x00C1, "Aacute" # LATIN CAPITAL LETTER A WITH ACUTE -0x00C2, "Acircumflex" # LATIN CAPITAL LETTER A WITH CIRCUMFLEX -0x00C3, "Atilde" # LATIN CAPITAL LETTER A WITH TILDE -0x00C4, "Adieresis" # LATIN CAPITAL LETTER A WITH DIAERESIS -0x00C5, "Aring" # LATIN CAPITAL LETTER A WITH RING ABOVE -0x00C6, "AE" # LATIN CAPITAL LETTER AE -0x00C7, "Ccedilla" # LATIN CAPITAL LETTER C WITH CEDILLA -0x00C8, "Egrave" # LATIN CAPITAL LETTER E WITH GRAVE -0x00C9, "Eacute" # LATIN CAPITAL LETTER E WITH ACUTE -0x00CA, "Ecircumflex" # LATIN CAPITAL LETTER E WITH CIRCUMFLEX -0x00CB, "Edieresis" # LATIN CAPITAL LETTER E WITH DIAERESIS -0x00CC, "Igrave" # LATIN CAPITAL LETTER I WITH GRAVE -0x00CD, "Iacute" # LATIN CAPITAL LETTER I WITH ACUTE -0x00CE, "Icircumflex" # LATIN CAPITAL LETTER I WITH CIRCUMFLEX -0x00CF, "Idieresis" # LATIN CAPITAL LETTER I WITH DIAERESIS -0x00D0, "Eth" # LATIN CAPITAL LETTER ETH -0x00D1, "Ntilde" # LATIN CAPITAL LETTER N WITH TILDE -0x00D2, "Ograve" # LATIN CAPITAL LETTER O WITH GRAVE -0x00D3, "Oacute" # LATIN CAPITAL LETTER O WITH ACUTE -0x00D4, "Ocircumflex" # LATIN CAPITAL LETTER O WITH CIRCUMFLEX -0x00D5, "Otilde" # LATIN CAPITAL LETTER O WITH TILDE -0x00D6, "Odieresis" # LATIN CAPITAL LETTER O WITH DIAERESIS -0x00D7, "multiply" # MULTIPLICATION SIGN -0x00D8, "Oslash" # LATIN CAPITAL LETTER O WITH STROKE -0x00D9, "Ugrave" # LATIN CAPITAL LETTER U WITH GRAVE -0x00DA, "Uacute" # LATIN CAPITAL LETTER U WITH ACUTE -0x00DB, "Ucircumflex" # LATIN CAPITAL LETTER U WITH CIRCUMFLEX -0x00DC, "Udieresis" # LATIN CAPITAL LETTER U WITH DIAERESIS -0x00DD, "Yacute" # LATIN CAPITAL LETTER Y WITH ACUTE -0x00DE, "Thorn" # LATIN CAPITAL LETTER THORN -0x00DF, "germandbls" # LATIN SMALL LETTER SHARP S -0x00E0, "agrave" # LATIN SMALL LETTER A WITH GRAVE -0x00E1, "aacute" # LATIN SMALL LETTER A WITH ACUTE -0x00E2, "acircumflex" # LATIN SMALL LETTER A WITH CIRCUMFLEX -0x00E3, "atilde" # LATIN SMALL LETTER A WITH TILDE -0x00E4, "adieresis" # LATIN SMALL LETTER A WITH DIAERESIS -0x00E5, "aring" # LATIN SMALL LETTER A WITH RING ABOVE -0x00E6, "ae" # LATIN SMALL LETTER AE -0x00E7, "ccedilla" # LATIN SMALL LETTER C WITH CEDILLA -0x00E8, "egrave" # LATIN SMALL LETTER E WITH GRAVE -0x00E9, "eacute" # LATIN SMALL LETTER E WITH ACUTE -0x00EA, "ecircumflex" # LATIN SMALL LETTER E WITH CIRCUMFLEX -0x00EB, "edieresis" # LATIN SMALL LETTER E WITH DIAERESIS -0x00EC, "igrave" # LATIN SMALL LETTER I WITH GRAVE -0x00ED, "iacute" # LATIN SMALL LETTER I WITH ACUTE -0x00EE, "icircumflex" # LATIN SMALL LETTER I WITH CIRCUMFLEX -0x00EF, "idieresis" # LATIN SMALL LETTER I WITH DIAERESIS -0x00F0, "eth" # LATIN SMALL LETTER ETH -0x00F1, "ntilde" # LATIN SMALL LETTER N WITH TILDE -0x00F2, "ograve" # LATIN SMALL LETTER O WITH GRAVE -0x00F3, "oacute" # LATIN SMALL LETTER O WITH ACUTE -0x00F4, "ocircumflex" # LATIN SMALL LETTER O WITH CIRCUMFLEX -0x00F5, "otilde" # LATIN SMALL LETTER O WITH TILDE -0x00F6, "odieresis" # LATIN SMALL LETTER O WITH DIAERESIS -0x00F7, "divide" # DIVISION SIGN -0x00F8, "oslash" # LATIN SMALL LETTER O WITH STROKE -0x00F9, "ugrave" # LATIN SMALL LETTER U WITH GRAVE -0x00FA, "uacute" # LATIN SMALL LETTER U WITH ACUTE -0x00FB, "ucircumflex" # LATIN SMALL LETTER U WITH CIRCUMFLEX -0x00FC, "udieresis" # LATIN SMALL LETTER U WITH DIAERESIS -0x00FD, "yacute" # LATIN SMALL LETTER Y WITH ACUTE -0x00FE, "thorn" # LATIN SMALL LETTER THORN -0x00FF, "ydieresis" # LATIN SMALL LETTER Y WITH DIAERESIS -0x0100, "Amacron" # LATIN CAPITAL LETTER A WITH MACRON -0x0101, "amacron" # LATIN SMALL LETTER A WITH MACRON -0x0102, "Abreve" # LATIN CAPITAL LETTER A WITH BREVE -0x0103, "abreve" # LATIN SMALL LETTER A WITH BREVE -0x0104, "Aogonek" # LATIN CAPITAL LETTER A WITH OGONEK -0x0105, "aogonek" # LATIN SMALL LETTER A WITH OGONEK -0x0106, "Cacute" # LATIN CAPITAL LETTER C WITH ACUTE -0x0107, "cacute" # LATIN SMALL LETTER C WITH ACUTE -0x0108, "Ccircumflex" # LATIN CAPITAL LETTER C WITH CIRCUMFLEX -0x0109, "ccircumflex" # LATIN SMALL LETTER C WITH CIRCUMFLEX -0x010A, "Cdotaccent" # LATIN CAPITAL LETTER C WITH DOT ABOVE -0x010B, "cdotaccent" # LATIN SMALL LETTER C WITH DOT ABOVE -0x010C, "Ccaron" # LATIN CAPITAL LETTER C WITH CARON -0x010D, "ccaron" # LATIN SMALL LETTER C WITH CARON -0x010E, "Dcaron" # LATIN CAPITAL LETTER D WITH CARON -0x010F, "dcaron" # LATIN SMALL LETTER D WITH CARON -0x0110, "Dcroat" # LATIN CAPITAL LETTER D WITH STROKE -0x0111, "dcroat" # LATIN SMALL LETTER D WITH STROKE -0x0112, "Emacron" # LATIN CAPITAL LETTER E WITH MACRON -0x0113, "emacron" # LATIN SMALL LETTER E WITH MACRON -0x0114, "Ebreve" # LATIN CAPITAL LETTER E WITH BREVE -0x0115, "ebreve" # LATIN SMALL LETTER E WITH BREVE -0x0116, "Edotaccent" # LATIN CAPITAL LETTER E WITH DOT ABOVE -0x0117, "edotaccent" # LATIN SMALL LETTER E WITH DOT ABOVE -0x0118, "Eogonek" # LATIN CAPITAL LETTER E WITH OGONEK -0x0119, "eogonek" # LATIN SMALL LETTER E WITH OGONEK -0x011A, "Ecaron" # LATIN CAPITAL LETTER E WITH CARON -0x011B, "ecaron" # LATIN SMALL LETTER E WITH CARON -0x011C, "Gcircumflex" # LATIN CAPITAL LETTER G WITH CIRCUMFLEX -0x011D, "gcircumflex" # LATIN SMALL LETTER G WITH CIRCUMFLEX -0x011E, "Gbreve" # LATIN CAPITAL LETTER G WITH BREVE -0x011F, "gbreve" # LATIN SMALL LETTER G WITH BREVE -0x0120, "Gdotaccent" # LATIN CAPITAL LETTER G WITH DOT ABOVE -0x0121, "gdotaccent" # LATIN SMALL LETTER G WITH DOT ABOVE -0x0122, "Gcommaaccent" # LATIN CAPITAL LETTER G WITH CEDILLA -0x0123, "gcommaaccent" # LATIN SMALL LETTER G WITH CEDILLA -0x0124, "Hcircumflex" # LATIN CAPITAL LETTER H WITH CIRCUMFLEX -0x0125, "hcircumflex" # LATIN SMALL LETTER H WITH CIRCUMFLEX -0x0126, "Hbar" # LATIN CAPITAL LETTER H WITH STROKE -0x0127, "hbar" # LATIN SMALL LETTER H WITH STROKE -0x0128, "Itilde" # LATIN CAPITAL LETTER I WITH TILDE -0x0129, "itilde" # LATIN SMALL LETTER I WITH TILDE -0x012A, "Imacron" # LATIN CAPITAL LETTER I WITH MACRON -0x012B, "imacron" # LATIN SMALL LETTER I WITH MACRON -0x012C, "Ibreve" # LATIN CAPITAL LETTER I WITH BREVE -0x012D, "ibreve" # LATIN SMALL LETTER I WITH BREVE -0x012E, "Iogonek" # LATIN CAPITAL LETTER I WITH OGONEK -0x012F, "iogonek" # LATIN SMALL LETTER I WITH OGONEK -0x0130, "Idotaccent" # LATIN CAPITAL LETTER I WITH DOT ABOVE -0x0131, "dotlessi" # LATIN SMALL LETTER DOTLESS I -0x0132, "IJ" # LATIN CAPITAL LIGATURE IJ -0x0133, "ij" # LATIN SMALL LIGATURE IJ -0x0134, "Jcircumflex" # LATIN CAPITAL LETTER J WITH CIRCUMFLEX -0x0135, "jcircumflex" # LATIN SMALL LETTER J WITH CIRCUMFLEX -0x0136, "Kcommaaccent" # LATIN CAPITAL LETTER K WITH CEDILLA -0x0137, "kcommaaccent" # LATIN SMALL LETTER K WITH CEDILLA -0x0138, "kgreenlandic" # LATIN SMALL LETTER KRA -0x0139, "Lacute" # LATIN CAPITAL LETTER L WITH ACUTE -0x013A, "lacute" # LATIN SMALL LETTER L WITH ACUTE -0x013B, "Lcommaaccent" # LATIN CAPITAL LETTER L WITH CEDILLA -0x013C, "lcommaaccent" # LATIN SMALL LETTER L WITH CEDILLA -0x013D, "Lcaron" # LATIN CAPITAL LETTER L WITH CARON -0x013E, "lcaron" # LATIN SMALL LETTER L WITH CARON -0x013F, "Ldot" # LATIN CAPITAL LETTER L WITH MIDDLE DOT -0x0140, "ldot" # LATIN SMALL LETTER L WITH MIDDLE DOT -0x0141, "Lslash" # LATIN CAPITAL LETTER L WITH STROKE -0x0142, "lslash" # LATIN SMALL LETTER L WITH STROKE -0x0143, "Nacute" # LATIN CAPITAL LETTER N WITH ACUTE -0x0144, "nacute" # LATIN SMALL LETTER N WITH ACUTE -0x0145, "Ncommaaccent" # LATIN CAPITAL LETTER N WITH CEDILLA -0x0146, "ncommaaccent" # LATIN SMALL LETTER N WITH CEDILLA -0x0147, "Ncaron" # LATIN CAPITAL LETTER N WITH CARON -0x0148, "ncaron" # LATIN SMALL LETTER N WITH CARON -0x0149, "napostrophe" # LATIN SMALL LETTER N PRECEDED BY APOSTROPHE -0x014A, "Eng" # LATIN CAPITAL LETTER ENG -0x014B, "eng" # LATIN SMALL LETTER ENG -0x014C, "Omacron" # LATIN CAPITAL LETTER O WITH MACRON -0x014D, "omacron" # LATIN SMALL LETTER O WITH MACRON -0x014E, "Obreve" # LATIN CAPITAL LETTER O WITH BREVE -0x014F, "obreve" # LATIN SMALL LETTER O WITH BREVE -0x0150, "Ohungarumlaut" # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE -0x0151, "ohungarumlaut" # LATIN SMALL LETTER O WITH DOUBLE ACUTE -0x0152, "OE" # LATIN CAPITAL LIGATURE OE -0x0153, "oe" # LATIN SMALL LIGATURE OE -0x0154, "Racute" # LATIN CAPITAL LETTER R WITH ACUTE -0x0155, "racute" # LATIN SMALL LETTER R WITH ACUTE -0x0156, "Rcommaaccent" # LATIN CAPITAL LETTER R WITH CEDILLA -0x0157, "rcommaaccent" # LATIN SMALL LETTER R WITH CEDILLA -0x0158, "Rcaron" # LATIN CAPITAL LETTER R WITH CARON -0x0159, "rcaron" # LATIN SMALL LETTER R WITH CARON -0x015A, "Sacute" # LATIN CAPITAL LETTER S WITH ACUTE -0x015B, "sacute" # LATIN SMALL LETTER S WITH ACUTE -0x015C, "Scircumflex" # LATIN CAPITAL LETTER S WITH CIRCUMFLEX -0x015D, "scircumflex" # LATIN SMALL LETTER S WITH CIRCUMFLEX -0x015E, "Scedilla" # LATIN CAPITAL LETTER S WITH CEDILLA -0x015F, "scedilla" # LATIN SMALL LETTER S WITH CEDILLA -0x0160, "Scaron" # LATIN CAPITAL LETTER S WITH CARON -0x0161, "scaron" # LATIN SMALL LETTER S WITH CARON -0x0164, "Tcaron" # LATIN CAPITAL LETTER T WITH CARON -0x0165, "tcaron" # LATIN SMALL LETTER T WITH CARON -0x0166, "Tbar" # LATIN CAPITAL LETTER T WITH STROKE -0x0167, "tbar" # LATIN SMALL LETTER T WITH STROKE -0x0168, "Utilde" # LATIN CAPITAL LETTER U WITH TILDE -0x0169, "utilde" # LATIN SMALL LETTER U WITH TILDE -0x016A, "Umacron" # LATIN CAPITAL LETTER U WITH MACRON -0x016B, "umacron" # LATIN SMALL LETTER U WITH MACRON -0x016C, "Ubreve" # LATIN CAPITAL LETTER U WITH BREVE -0x016D, "ubreve" # LATIN SMALL LETTER U WITH BREVE -0x016E, "Uring" # LATIN CAPITAL LETTER U WITH RING ABOVE -0x016F, "uring" # LATIN SMALL LETTER U WITH RING ABOVE -0x0170, "Uhungarumlaut" # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE -0x0171, "uhungarumlaut" # LATIN SMALL LETTER U WITH DOUBLE ACUTE -0x0172, "Uogonek" # LATIN CAPITAL LETTER U WITH OGONEK -0x0173, "uogonek" # LATIN SMALL LETTER U WITH OGONEK -0x0174, "Wcircumflex" # LATIN CAPITAL LETTER W WITH CIRCUMFLEX -0x0175, "wcircumflex" # LATIN SMALL LETTER W WITH CIRCUMFLEX -0x0176, "Ycircumflex" # LATIN CAPITAL LETTER Y WITH CIRCUMFLEX -0x0177, "ycircumflex" # LATIN SMALL LETTER Y WITH CIRCUMFLEX -0x0178, "Ydieresis" # LATIN CAPITAL LETTER Y WITH DIAERESIS -0x0179, "Zacute" # LATIN CAPITAL LETTER Z WITH ACUTE -0x017A, "zacute" # LATIN SMALL LETTER Z WITH ACUTE -0x017B, "Zdotaccent" # LATIN CAPITAL LETTER Z WITH DOT ABOVE -0x017C, "zdotaccent" # LATIN SMALL LETTER Z WITH DOT ABOVE -0x017D, "Zcaron" # LATIN CAPITAL LETTER Z WITH CARON -0x017E, "zcaron" # LATIN SMALL LETTER Z WITH CARON -0x017F, "longs" # LATIN SMALL LETTER LONG S -0x0192, "florin" # LATIN SMALL LETTER F WITH HOOK -0x01A0, "Ohorn" # LATIN CAPITAL LETTER O WITH HORN -0x01A1, "ohorn" # LATIN SMALL LETTER O WITH HORN -0x01AF, "Uhorn" # LATIN CAPITAL LETTER U WITH HORN -0x01B0, "uhorn" # LATIN SMALL LETTER U WITH HORN -0x01E6, "Gcaron" # LATIN CAPITAL LETTER G WITH CARON -0x01E7, "gcaron" # LATIN SMALL LETTER G WITH CARON -0x01FA, "Aringacute" # LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE -0x01FB, "aringacute" # LATIN SMALL LETTER A WITH RING ABOVE AND ACUTE -0x01FC, "AEacute" # LATIN CAPITAL LETTER AE WITH ACUTE -0x01FD, "aeacute" # LATIN SMALL LETTER AE WITH ACUTE -0x01FE, "Oslashacute" # LATIN CAPITAL LETTER O WITH STROKE AND ACUTE -0x01FF, "oslashacute" # LATIN SMALL LETTER O WITH STROKE AND ACUTE -0x0218, "Scommaaccent" # LATIN CAPITAL LETTER S WITH COMMA BELOW -0x0219, "scommaaccent" # LATIN SMALL LETTER S WITH COMMA BELOW -0x021A, "Tcommaaccent" # LATIN CAPITAL LETTER T WITH COMMA BELOW -0x021B, "tcommaaccent" # LATIN SMALL LETTER T WITH COMMA BELOW -0x02BC, "afii57929" # MODIFIER LETTER APOSTROPHE -0x02BD, "afii64937" # MODIFIER LETTER REVERSED COMMA -0x02C6, "circumflex" # MODIFIER LETTER CIRCUMFLEX ACCENT -0x02C7, "caron" # CARON -0x02D8, "breve" # BREVE -0x02D9, "dotaccent" # DOT ABOVE -0x02DA, "ring" # RING ABOVE -0x02DB, "ogonek" # OGONEK -0x02DC, "tilde" # SMALL TILDE -0x02DD, "hungarumlaut" # DOUBLE ACUTE ACCENT -0x0300, "gravecomb" # COMBINING GRAVE ACCENT -0x0301, "acutecomb" # COMBINING ACUTE ACCENT -0x0303, "tildecomb" # COMBINING TILDE -0x0309, "hookabovecomb" # COMBINING HOOK ABOVE -0x0323, "dotbelowcomb" # COMBINING DOT BELOW -0x0384, "tonos" # GREEK TONOS -0x0385, "dieresistonos" # GREEK DIALYTIKA TONOS -0x0386, "Alphatonos" # GREEK CAPITAL LETTER ALPHA WITH TONOS -0x0387, "anoteleia" # GREEK ANO TELEIA -0x0388, "Epsilontonos" # GREEK CAPITAL LETTER EPSILON WITH TONOS -0x0389, "Etatonos" # GREEK CAPITAL LETTER ETA WITH TONOS -0x038A, "Iotatonos" # GREEK CAPITAL LETTER IOTA WITH TONOS -0x038C, "Omicrontonos" # GREEK CAPITAL LETTER OMICRON WITH TONOS -0x038E, "Upsilontonos" # GREEK CAPITAL LETTER UPSILON WITH TONOS -0x038F, "Omegatonos" # GREEK CAPITAL LETTER OMEGA WITH TONOS -0x0390, "iotadieresistonos" # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS -0x0391, "Alpha" # GREEK CAPITAL LETTER ALPHA -0x0392, "Beta" # GREEK CAPITAL LETTER BETA -0x0393, "Gamma" # GREEK CAPITAL LETTER GAMMA -0x0394, "Delta" # GREEK CAPITAL LETTER DELTA -0x0395, "Epsilon" # GREEK CAPITAL LETTER EPSILON -0x0396, "Zeta" # GREEK CAPITAL LETTER ZETA -0x0397, "Eta" # GREEK CAPITAL LETTER ETA -0x0398, "Theta" # GREEK CAPITAL LETTER THETA -0x0399, "Iota" # GREEK CAPITAL LETTER IOTA -0x039A, "Kappa" # GREEK CAPITAL LETTER KAPPA -0x039B, "Lambda" # GREEK CAPITAL LETTER LAMDA -0x039C, "Mu" # GREEK CAPITAL LETTER MU -0x039D, "Nu" # GREEK CAPITAL LETTER NU -0x039E, "Xi" # GREEK CAPITAL LETTER XI -0x039F, "Omicron" # GREEK CAPITAL LETTER OMICRON -0x03A0, "Pi" # GREEK CAPITAL LETTER PI -0x03A1, "Rho" # GREEK CAPITAL LETTER RHO -0x03A3, "Sigma" # GREEK CAPITAL LETTER SIGMA -0x03A4, "Tau" # GREEK CAPITAL LETTER TAU -0x03A5, "Upsilon" # GREEK CAPITAL LETTER UPSILON -0x03A6, "Phi" # GREEK CAPITAL LETTER PHI -0x03A7, "Chi" # GREEK CAPITAL LETTER CHI -0x03A8, "Psi" # GREEK CAPITAL LETTER PSI -0x03A9, "Omega" # GREEK CAPITAL LETTER OMEGA -0x03AA, "Iotadieresis" # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA -0x03AB, "Upsilondieresis" # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA -0x03AC, "alphatonos" # GREEK SMALL LETTER ALPHA WITH TONOS -0x03AD, "epsilontonos" # GREEK SMALL LETTER EPSILON WITH TONOS -0x03AE, "etatonos" # GREEK SMALL LETTER ETA WITH TONOS -0x03AF, "iotatonos" # GREEK SMALL LETTER IOTA WITH TONOS -0x03B0, "upsilondieresistonos" # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS -0x03B1, "alpha" # GREEK SMALL LETTER ALPHA -0x03B2, "beta" # GREEK SMALL LETTER BETA -0x03B3, "gamma" # GREEK SMALL LETTER GAMMA -0x03B4, "delta" # GREEK SMALL LETTER DELTA -0x03B5, "epsilon" # GREEK SMALL LETTER EPSILON -0x03B6, "zeta" # GREEK SMALL LETTER ZETA -0x03B7, "eta" # GREEK SMALL LETTER ETA -0x03B8, "theta" # GREEK SMALL LETTER THETA -0x03B9, "iota" # GREEK SMALL LETTER IOTA -0x03BA, "kappa" # GREEK SMALL LETTER KAPPA -0x03BB, "lambda" # GREEK SMALL LETTER LAMDA -0x03BC, "mu" # GREEK SMALL LETTER MU;Duplicate -0x03BD, "nu" # GREEK SMALL LETTER NU -0x03BE, "xi" # GREEK SMALL LETTER XI -0x03BF, "omicron" # GREEK SMALL LETTER OMICRON -0x03C0, "pi" # GREEK SMALL LETTER PI -0x03C1, "rho" # GREEK SMALL LETTER RHO -0x03C2, "sigma1" # GREEK SMALL LETTER FINAL SIGMA -0x03C3, "sigma" # GREEK SMALL LETTER SIGMA -0x03C4, "tau" # GREEK SMALL LETTER TAU -0x03C5, "upsilon" # GREEK SMALL LETTER UPSILON -0x03C6, "phi" # GREEK SMALL LETTER PHI -0x03C7, "chi" # GREEK SMALL LETTER CHI -0x03C8, "psi" # GREEK SMALL LETTER PSI -0x03C9, "omega" # GREEK SMALL LETTER OMEGA -0x03CA, "iotadieresis" # GREEK SMALL LETTER IOTA WITH DIALYTIKA -0x03CB, "upsilondieresis" # GREEK SMALL LETTER UPSILON WITH DIALYTIKA -0x03CC, "omicrontonos" # GREEK SMALL LETTER OMICRON WITH TONOS -0x03CD, "upsilontonos" # GREEK SMALL LETTER UPSILON WITH TONOS -0x03CE, "omegatonos" # GREEK SMALL LETTER OMEGA WITH TONOS -0x03D1, "theta1" # GREEK THETA SYMBOL -0x03D2, "Upsilon1" # GREEK UPSILON WITH HOOK SYMBOL -0x03D5, "phi1" # GREEK PHI SYMBOL -0x03D6, "omega1" # GREEK PI SYMBOL -# end of stuff from glyphlist.txt -0xFFFF, "" diff --git a/src/gui/painting/qpsprinter.ps b/src/gui/painting/qpsprinter.ps deleted file mode 100644 index ef3f42970bd..00000000000 --- a/src/gui/painting/qpsprinter.ps +++ /dev/null @@ -1,449 +0,0 @@ -% the postscript header we use for our qpsprinter in uncompressed and commented form. -% use the makepsheader perl script to generate a compressed version of this header -% you can then paste into qpsprinter.cpp -% -% some compression of the code is done by the makepsheader script, so we don't need to -% write too criptically here. - -/BD {bind def} bind def -/d2 {dup dup} BD -/ED {exch def} BD -/D0 {0 ED} BD - -/F {setfont} BD -/RL {rlineto} BD -/CM {currentmatrix} BD -/SM {setmatrix} BD -/TR {translate} BD -/SD {setdash} BD -/SC {aload pop setrgbcolor} BD -/CR {currentfile read pop} BD -/i {index} BD -/scs {setcolorspace} BD -/DB {dict dup begin} BD -/DE {end def} BD -/ie {ifelse} BD -/gs {gsave} BD -/gr {grestore} BD - -% these use PDF syntax -/w {setlinewidth} BD -/d {setdash} BD -/J {setlinecap} BD -/j {setlinejoin} BD -/scn {3 array astore /BCol exch def} BD -/SCN {3 array astore /PCol exch def} BD -/cm {6 array astore concat} BD - -/m {moveto} BD -/l {lineto} BD -/c {curveto} BD -/h {closepath} BD - -/W {clip} BD -/W* {eoclip} BD -/n {newpath} BD -% ENDUNCOMPRESSED: Warning: leave this line in. -% Everything before this line will be left untouched by the compression - -/q {gsave 10 dict begin} BD -/Q {end grestore} BD - -% PDF operators -/re { % PDF re operator - 4 2 roll % w h x y - moveto % w h - dup % w h h - 0 exch rlineto % w h - exch 0 rlineto % h - 0 exch neg rlineto - closepath -} bind def - -/S { - gsave - PCol SC stroke - grestore - newpath -} BD - -% PDF text operators -/BT {gsave 10 dict begin /_m matrix currentmatrix def BCol SC} BD -/ET {end grestore} BD -/Tf { - /_fs exch def - findfont - [ _fs 0 0 _fs 0 0 ] - makefont - setfont -} BD -/Tm {6 array astore concat} BD -/Td {translate} BD -/Tj {0 0 moveto show} BD -/BDC {pop pop} BD -/EMC {} BD - -% old operators - -/BSt 0 def % brush style -/WFi false def % winding fill - -/BCol [ 1 1 1 ] def % brush color -/PCol [ 0 0 0 ] def % pen color -/BDArr [ % Brush dense patterns - 0.94 - 0.88 - 0.63 - 0.50 - 0.37 - 0.12 - 0.06 -] def - -% -- level3 true/false -/level3 { - /languagelevel where { - pop - languagelevel 3 ge - } { false } ifelse -} bind def - - -%% image drawing routines - -% defines for QCI -/QCIgray D0 /QCIcolor D0 /QCIindex D0 - -% this method prints color images if colorimage is available, otherwise -% converts the string to a grayscale image and uses the reular postscript image -% operator for printing. -% Arguments are the same as for the image operator: -% -% width height bits/sample matrix datasrc QCI - -/QCI { - /colorimage where { - pop - false 3 colorimage - }{ % the hard way, based on PD code by John Walker - exec /QCIcolor exch def - /QCIgray QCIcolor length 3 idiv string def - 0 1 QCIcolor length 3 idiv 1 sub - { /QCIindex exch def - /_x QCIindex 3 mul def - QCIgray QCIindex - QCIcolor _x get 0.30 mul - QCIcolor _x 1 add get 0.59 mul - QCIcolor _x 2 add get 0.11 mul - add add cvi - put - } for - QCIgray image - } ifelse -} bind def - -% general image drawing routine, used from the postscript driver -% -% Draws images with and without mask with 1, 8 and 24(rgb) bits depth. -% -% width height matrix image 1|8|24 mask|false x y di -% -% width and height specify the width/height of the image, -% matrix a transformation matrix, image a procedure holding the image data -% (same for mask) and x/y an additional translation. -% -% ### should move the translation into the matrix!!! -/di -{ - gsave - translate - 1 index 1 eq { % bitmap - pop pop % get rid of mask and depth - false 3 1 roll % width height false matrix image - BCol SC - imagemask - } { - dup false ne { - % have a mask, see if we can use it - level3 - } { - false - } ifelse - - { - % languagelevel3, we can use image mask and dicts - - % store the image mask - /_ma exch def - % select colorspace according to 8|24 bit depth and set the decode array /dc - 8 eq { - /_dc [0 1] def - /DeviceGray - } { - /_dc [0 1 0 1 0 1] def - /DeviceRGB - } ifelse - setcolorspace - % the image data - /_im exch def - % transformation matrix - /_mt exch def - % width and height - /_h exch def - /_w exch def - % and the combined image dict - << - /ImageType 3 - % the image dict - /DataDict << - /ImageType 1 - /Width _w - /Height _h - /ImageMatrix _mt - /DataSource _im - /BitsPerComponent 8 - /Decode _dc - >> - % the mask dictionary - /MaskDict << - /ImageType 1 - /Width _w - /Height _h - /ImageMatrix _mt - /DataSource _ma - /BitsPerComponent 1 - /Decode [0 1] - >> - /InterleaveType 3 - >> - image - } { - pop % no mask or can't use it, get rid of it - 8 % width height image 8|24 8 matrix - 4 1 roll - 8 eq { % grayscale - image - } { %color - QCI - } ifelse - } ifelse - } ifelse - grestore -} bind def - - -/BF { % brush fill - gsave - BSt 1 eq % solid brush? - { - BCol SC - WFi { fill } { eofill } ifelse - } if - BSt 2 ge BSt 8 le and % dense pattern? - { - BDArr BSt 2 sub get /_sc exch def - % the following line scales the brush color according to the pattern. the higher the pattern the lighter the color. - BCol - { - 1. exch sub _sc mul 1. exch sub - } forall - 3 array astore - SC - WFi { fill } { eofill } ifelse - } if - BSt 9 ge BSt 14 le and % brush pattern? - { - WFi { clip } { eoclip } ifelse - pathbbox % left upper right lower - 3 index 3 index translate - 4 2 roll % right lower left upper - 3 2 roll % right left upper lower - exch % left right lower upper - sub /_h exch def - sub /_w exch def - BCol SC - 0.3 setlinewidth - newpath - BSt 9 eq BSt 11 eq or % horiz or cross pattern - { 0 4 _h - { dup 0 exch moveto _w exch lineto } for - } if - BSt 10 eq BSt 11 eq or % vert or cross pattern - { 0 4 _w - { dup 0 moveto _h lineto } for - } if - BSt 12 eq BSt 14 eq or % F-diag or diag cross - { _w _h gt - { 0 6 _w _h add - { dup 0 moveto _h sub _h lineto } for - } { 0 6 _w _h add - { dup 0 exch moveto _w sub _w exch lineto } for - } ifelse - } if - BSt 13 eq BSt 14 eq or % B-diag or diag cross - { _w _h gt - { 0 6 _w _h add - { dup _h moveto _h sub 0 lineto } for - } { 0 6 _w _h add - { dup _w exch moveto _w sub 0 exch lineto } for - } ifelse - } if - stroke - } if - BSt 15 eq - { - } if - BSt 24 eq % TexturePattern - { - } if - grestore -} bind def - -% more PDF operators -/f { /WFi true def BF newpath } bind def -/f* { /WFi false def BF newpath } bind def -/B { /WFi true def BF S newpath } bind def -/B* { /WFi false def BF S newpath } bind def - -%% start of page -/QI { - /C save def - pageinit - q - newpath -} bind def - -%% end of page -/QP { - Q % show page - C restore - showpage -} bind def - -% merges one key value pair into the page device dict -% -% key value SPD - -/SPD { - /setpagedevice where { - << 3 1 roll >> - setpagedevice - } { pop pop } ifelse -} bind def - - -% font handling - -/T1AddMapping { % basefont [glyphname ...] T1AddMapping - - 10 dict begin - /glyphs exch def - /fnt exch def - /current fnt /NumGlyphs get def - /CMap fnt /CMap get def - - 0 1 glyphs length 1 sub % 0 1 (num glyphs - 1) - { - glyphs exch get /gn exch def - - current dup % glyph_index glyph_index - 256 mod /min exch def % glyph_index - 256 idiv /maj exch def % - - CMap dup maj get dup % cmap cmap_maj cmap_maj - null eq { - pop 256 array - 0 1 255 {1 index exch /.notdef put} for - } if - dup % cmap cmap_maj cmap_maj - min gn put % cmap cmap_maj - maj exch put % - - - /current current 1 add def - } for - - fnt /CMap CMap put - fnt /NumGlyphs current put - end -} def - -/T1AddGlyphs { % basefont [glyphname charstring ...] T1AddGlyphs - - 10 dict begin - /glyphs exch def - /fnt exch def - /current fnt /NumGlyphs get def - /CMap fnt /CMap get def - /CharStrings fnt /CharStrings get def - - 0 1 glyphs length 2 idiv 1 sub % 0 1 (num glyphs - 1) - { - 2 mul dup - glyphs exch get /gn exch def - 1 add - glyphs exch get /cs exch def - - current dup % glyph_index glyph_index - 256 mod /min exch def % glyph_index - 256 idiv /maj exch def % - - CMap dup maj get dup % cmap cmap_maj cmap_maj - null eq { - pop 256 array - 0 1 255 {1 index exch /.notdef put} for - } if - dup % cmap cmap_maj cmap_maj - min gn put % cmap cmap_maj - maj exch put % - - - CharStrings gn cs put - /current current 1 add def - } for - - fnt /CharStrings CharStrings put - fnt /CMap CMap put - fnt /NumGlyphs current put - end -} def - - - -/StringAdd { % string1 string2 stringadd result - 1 index length 1 index length add - string - 3 1 roll - 2 index 0 3 index putinterval - 2 index 2 index length 2 index putinterval - pop pop -} def - - -/T1Setup { % fontname T1Setup - -10 dict begin - dup /FontName exch def - (-Base) StringAdd cvx cvn /Font exch def - /MaxPage Font /NumGlyphs get 1 sub 256 idiv def - - /FDepVector MaxPage 1 add array def - /Encoding MaxPage 1 add array def - - 0 1 MaxPage { - dup Encoding exch dup put - - - dup /Page exch def - FontName (-) StringAdd - exch - 20 string cvs StringAdd % page fontname - cvn - - Font 0 dict copy dup dup /CMap get - Page get - /Encoding exch put definefont - FDepVector exch Page exch put - } for - - FontName cvn << - /FontType 0 - /FMapType 2 - /FontMatrix[1 0 0 1 0 0] - /Encoding Encoding - /FDepVector FDepVector - >> definefont pop - end -} def - diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index eb9fbf7ba1c..d3a43c4193d 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -252,17 +252,6 @@ QRegion::QRegion(int x, int y, int w, int h, RegionType t) d = tmp.d; } -#ifdef QT3_SUPPORT -/*! - Use the constructor tha takes a Qt::FillRule as the second - argument instead. -*/ -QRegion::QRegion(const QPolygon &pa, bool winding) -{ - new (this) QRegion(pa, winding ? Qt::WindingFill : Qt::OddEvenFill); -} -#endif - /*! \fn QRegion::~QRegion() \internal @@ -553,7 +542,7 @@ QRegion& QRegion::operator|=(const QRegion &r) \sa intersected() */ -#if !defined (Q_OS_UNIX) && !defined (Q_WS_WIN) +#if !defined (Q_OS_UNIX) && !defined (Q_OS_WIN) QRegion& QRegion::operator+=(const QRect &r) { return operator+=(QRegion(r)); @@ -576,7 +565,7 @@ QRegion& QRegion::operator&=(const QRegion &r) \overload \since 4.4 */ -#if defined (Q_OS_UNIX) || defined (Q_WS_WIN) +#if defined (Q_OS_UNIX) || defined (Q_OS_WIN) QRegion& QRegion::operator&=(const QRect &r) { return *this = *this & r; @@ -720,7 +709,7 @@ bool QRegion::intersects(const QRegion ®ion) const */ -#if !defined (Q_OS_UNIX) && !defined (Q_WS_WIN) +#if !defined (Q_OS_UNIX) && !defined (Q_OS_WIN) /*! \overload \since 4.4 @@ -1025,7 +1014,7 @@ void addSegmentsToPath(Segment *segment, QPainterPath &path) } -Q_AUTOTEST_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion) +Q_GUI_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion) { QPainterPath result; if (region.rectCount() == 1) { @@ -1083,7 +1072,7 @@ Q_AUTOTEST_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion) return result; } -#if defined(Q_OS_UNIX) || defined(Q_WS_WIN) +#if defined(Q_OS_UNIX) || defined(Q_OS_WIN) //#define QT_REGION_DEBUG /* diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index f4c68a91026..75d29e1ef54 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -74,9 +74,6 @@ public: QRegion(int x, int y, int w, int h, RegionType t = Rectangle); QRegion(const QRect &r, RegionType t = Rectangle); QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill); -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QRegion(const QPolygon &pa, bool winding); -#endif QRegion(const QRegion ®ion); QRegion(const QBitmap &bitmap); ~QRegion(); @@ -86,9 +83,6 @@ public: { qSwap(d, other.d); return *this; } #endif inline void swap(QRegion &other) { qSwap(d, other.d); } -#ifdef QT3_SUPPORT - inline QT3_SUPPORT bool isNull() const { return isEmpty(); } -#endif bool isEmpty() const; bool contains(const QPoint &p) const; @@ -189,6 +183,9 @@ private: #elif defined(Q_WS_MAC) static OSStatus shape2QRegionHelper(int inMessage, HIShapeRef inShape, const CGRect *inRect, void *inRefcon); +#endif +#if defined(Q_WS_QWS) || defined(Q_WS_QPA) +Q_GUI_EXPORT #endif friend bool qt_region_strictContains(const QRegion ®ion, const QRect &rect); diff --git a/src/gui/painting/qregion_qws.cpp b/src/gui/painting/qregion_qws.cpp deleted file mode 100644 index 3ec1112aa38..00000000000 --- a/src/gui/painting/qregion_qws.cpp +++ /dev/null @@ -1,3183 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// XXX - add appropriate friendship relationships -#define private public -#include "qregion.h" -#undef private -#include "qpainterpath.h" -#include "qpolygon.h" -#include "qbuffer.h" -#include "qimage.h" -#include -#include "qbitmap.h" -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QFastMutex -{ - QAtomicInt contenders; - QSemaphore semaphore; -public: - inline QFastMutex() - : contenders(0), semaphore(0) - { } - inline void lock() - { - if (contenders.fetchAndAddAcquire(1) != 0) { - semaphore.acquire(); - contenders.deref(); - } - } - inline bool tryLock() - { - return contenders.testAndSetAcquire(0, 1); - } - inline void unlock() - { - if (!contenders.testAndSetRelease(1, 0)) - semaphore.release(); - } -}; - - -/* - * 1 if r1 contains r2 - * 0 if r1 does not completely contain r2 - */ -#define CONTAINSCHECK(r1, r2) \ - ((r2).left() >= (r1).left() && (r2).right() <= (r1).right() && \ - (r2).top() >= (r1).top() && (r2).bottom() <= (r1).bottom()) - -/* - * clip region - */ -struct QRegionPrivate : public QRegion::QRegionData { - enum { Single, Vector } mode; - int numRects; - QVector rects; - QRect single; - QRect extents; - QRect innerRect; - union { - int innerArea; - QRegionPrivate *next; - }; - - inline void vector() - { - if(mode != Vector && numRects) { - if(rects.size() < 1) rects.resize(1); - rects[0] = single; - } - mode = Vector; - } - - inline QRegionPrivate() : mode(Single), numRects(0), innerArea(-1) {} - inline QRegionPrivate(const QRect &r) : mode(Single) { - numRects = 1; -// rects[0] = r; - single = r; - extents = r; - innerRect = r; - innerArea = r.width() * r.height(); - } - - inline QRegionPrivate(const QRegionPrivate &r) { - mode = r.mode; - rects = r.rects; - single = r.single; - numRects = r.numRects; - extents = r.extents; - innerRect = r.innerRect; - innerArea = r.innerArea; - } - - inline QRegionPrivate &operator=(const QRegionPrivate &r) { - mode = r.mode; - rects = r.rects; - single = r.single; - numRects = r.numRects; - extents = r.extents; - innerRect = r.innerRect; - innerArea = r.innerArea; - return *this; - } - - /* - * Returns true if r is guaranteed to be fully contained in this region. - * A false return value does not guarantee the opposite. - */ - inline bool contains(const QRegionPrivate &r) const { - const QRect &r1 = innerRect; - const QRect &r2 = r.extents; - return CONTAINSCHECK(r1, r2); - } - - inline void updateInnerRect(const QRect &rect) { - const int area = rect.width() * rect.height(); - if (area > innerArea) { - innerArea = area; - innerRect = rect; - } - } - - void append(const QRegionPrivate *r); - void prepend(const QRegionPrivate *r); - inline bool canAppend(const QRegionPrivate *r) const; - inline bool canPrepend(const QRegionPrivate *r) const; -}; - -static QRegionPrivate *qt_nextRegionPtr = 0; -static QFastMutex qt_nextRegionLock; - -static QRegionPrivate *qt_allocRegionMemory() -{ - QRegionPrivate *rv = 0; - qt_nextRegionLock.lock(); - - if(qt_nextRegionPtr) { - rv = qt_nextRegionPtr; - qt_nextRegionPtr = rv->next; - } else { - qt_nextRegionPtr = - (QRegionPrivate *)malloc(256 * sizeof(QRegionPrivate)); - for(int ii = 0; ii < 256; ++ii) { - if(ii == 255) { - qt_nextRegionPtr[ii].next = 0; - } else { - qt_nextRegionPtr[ii].next = &qt_nextRegionPtr[ii + 1]; - } - } - - rv = qt_nextRegionPtr; - qt_nextRegionPtr = rv->next; - } - - qt_nextRegionLock.unlock(); - return rv; -} - -static void qt_freeRegionMemory(QRegionPrivate *rp) -{ - qt_nextRegionLock.lock(); - rp->next = qt_nextRegionPtr; - qt_nextRegionPtr = rp; - qt_nextRegionLock.unlock(); -} - -static QRegionPrivate *qt_allocRegion() -{ - QRegionPrivate *mem = qt_allocRegionMemory(); - return new (mem) QRegionPrivate; -} - -static QRegionPrivate *qt_allocRegion(const QRect &r) -{ - QRegionPrivate *mem = qt_allocRegionMemory(); - return new (mem) QRegionPrivate(r); -} - -static QRegionPrivate *qt_allocRegion(const QRegionPrivate &r) -{ - QRegionPrivate *mem = qt_allocRegionMemory(); - return new (mem) QRegionPrivate(r); -} - -void qt_freeRegion(QRegionPrivate *rp) -{ - rp->~QRegionPrivate(); - qt_freeRegionMemory(rp); -// delete rp; -} - -static inline bool isEmptyHelper(const QRegionPrivate *preg) -{ - return !preg || preg->numRects == 0; -} - -void QRegionPrivate::append(const QRegionPrivate *r) -{ - Q_ASSERT(!isEmptyHelper(r)); - - vector(); - QRect *destRect = rects.data() + numRects; - const QRect *srcRect = (r->mode==Vector)?r->rects.constData():&r->single; - int numAppend = r->numRects; - - // test for merge in x direction - { - const QRect *rFirst = srcRect; - QRect *myLast = rects.data() + (numRects - 1); - if (rFirst->top() == myLast->top() - && rFirst->height() == myLast->height() - && rFirst->left() == (myLast->right() + 1)) - { - myLast->setWidth(myLast->width() + rFirst->width()); - updateInnerRect(*myLast); - ++srcRect; - --numAppend; - } - } - - // append rectangles - const int newNumRects = numRects + numAppend; - if (newNumRects > rects.size()) { - rects.resize(newNumRects); - destRect = rects.data() + numRects; - } - memcpy(destRect, srcRect, numAppend * sizeof(QRect)); - - // update inner rectangle - if (innerArea < r->innerArea) { - innerArea = r->innerArea; - innerRect = r->innerRect; - } - - // update extents - destRect = &extents; - srcRect = &r->extents; - extents.setCoords(qMin(destRect->left(), srcRect->left()), - qMin(destRect->top(), srcRect->top()), - qMax(destRect->right(), srcRect->right()), - qMax(destRect->bottom(), srcRect->bottom())); - - numRects = newNumRects; -} - -void QRegionPrivate::prepend(const QRegionPrivate *r) -{ -#if 1 - Q_UNUSED(r); -#else - // XXX ak: does not respect vectorization of region - - Q_ASSERT(!isEmpty(r)); - - // move existing rectangles - memmove(rects.data() + r->numRects, rects.constData(), - numRects * sizeof(QRect)); - - // prepend new rectangles - memcpy(rects.data(), r->rects.constData(), r->numRects * sizeof(QRect)); - - // update inner rectangle - if (innerArea < r->innerArea) { - innerArea = r->innerArea; - innerRect = r->innerRect; - } - - // update extents - destRect = &extents; - srcRect = &r->extents; - extents.setCoords(qMin(destRect->left(), srcRect->left()), - qMin(destRect->top(), srcRect->top()), - qMax(destRect->right(), srcRect->right()), - qMax(destRect->bottom(), srcRect->bottom())); - - numRects = newNumRects; -#endif -} - -bool QRegionPrivate::canAppend(const QRegionPrivate *r) const -{ - Q_ASSERT(!isEmptyHelper(r)); - - const QRect *rFirst = (r->mode==Vector)?r->rects.constData():&r->single; - const QRect *myLast = (mode==Vector)?(rects.constData() + (numRects - 1)):&single; - // XXX: possible improvements: - // - nFirst->top() == myLast->bottom() + 1, must possibly merge bands - if (rFirst->top() > (myLast->bottom() + 1) - || (rFirst->top() == myLast->top() - && rFirst->height() == myLast->height() - && rFirst->left() > myLast->right())) - { - return true; - } - - return false; -} - -bool QRegionPrivate::canPrepend(const QRegionPrivate *r) const -{ -#if 1 - Q_UNUSED(r); - return false; -#else - return r->canAppend(this); -#endif -} - -#if defined(Q_WS_X11) -QT_BEGIN_INCLUDE_NAMESPACE -# include "qregion_x11.cpp" -QT_END_INCLUDE_NAMESPACE -#elif defined(Q_WS_MAC) -QT_BEGIN_INCLUDE_NAMESPACE -# include "qregion_mac.cpp" -QT_END_INCLUDE_NAMESPACE -#elif defined(Q_WS_QWS) -static QRegionPrivate qrp; -QRegion::QRegionData QRegion::shared_empty = {Q_BASIC_ATOMIC_INITIALIZER(1), &qrp}; -#endif - -typedef void (*OverlapFunc)(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, register int y1, register int y2); -typedef void (*NonOverlapFunc)(register QRegionPrivate &dest, register const QRect *r, const QRect *rEnd, - register int y1, register int y2); - -static bool EqualRegion(const QRegionPrivate *r1, const QRegionPrivate *r2); -static void UnionRegion(const QRegionPrivate *reg1, const QRegionPrivate *reg2, QRegionPrivate &dest); -static void miRegionOp(register QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2, - OverlapFunc overlapFunc, NonOverlapFunc nonOverlap1Func, - NonOverlapFunc nonOverlap2Func); - -#define RectangleOut 0 -#define RectangleIn 1 -#define RectanglePart 2 -#define EvenOddRule 0 -#define WindingRule 1 - -// START OF region.h extract -/* $XConsortium: region.h,v 11.14 94/04/17 20:22:20 rws Exp $ */ -/************************************************************************ - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -************************************************************************/ - -#ifndef _XREGION_H -#define _XREGION_H - -QT_BEGIN_INCLUDE_NAMESPACE -#include -QT_END_INCLUDE_NAMESPACE - -/* 1 if two BOXs overlap. - * 0 if two BOXs do not overlap. - * Remember, x2 and y2 are not in the region - */ -#define EXTENTCHECK(r1, r2) \ - ((r1)->right() >= (r2)->left() && \ - (r1)->left() <= (r2)->right() && \ - (r1)->bottom() >= (r2)->top() && \ - (r1)->top() <= (r2)->bottom()) - -/* - * update region extents - */ -#define EXTENTS(r,idRect){\ - if((r)->left() < (idRect)->extents.left())\ - (idRect)->extents.setLeft((r)->left());\ - if((r)->top() < (idRect)->extents.top())\ - (idRect)->extents.setTop((r)->top());\ - if((r)->right() > (idRect)->extents.right())\ - (idRect)->extents.setRight((r)->right());\ - if((r)->bottom() > (idRect)->extents.bottom())\ - (idRect)->extents.setBottom((r)->bottom());\ - } - -/* - * Check to see if there is enough memory in the present region. - */ -#define MEMCHECK(dest, rect, firstrect){\ - if ((dest).numRects >= ((dest).rects.size()-1)){\ - firstrect.resize(firstrect.size() * 2); \ - (rect) = (firstrect).data() + (dest).numRects;\ - }\ - } - - -/* - * number of points to buffer before sending them off - * to scanlines(): Must be an even number - */ -#define NUMPTSTOBUFFER 200 - -/* - * used to allocate buffers for points and link - * the buffers together - */ -typedef struct _POINTBLOCK { - QPoint pts[NUMPTSTOBUFFER]; - struct _POINTBLOCK *next; -} POINTBLOCK; - -#endif -// END OF region.h extract - -// START OF Region.c extract -/* $XConsortium: Region.c /main/30 1996/10/22 14:21:24 kaleb $ */ -/************************************************************************ - -Copyright (c) 1987, 1988 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -************************************************************************/ -/* - * The functions in this file implement the Region abstraction, similar to one - * used in the X11 sample server. A Region is simply an area, as the name - * implies, and is implemented as a "y-x-banded" array of rectangles. To - * explain: Each Region is made up of a certain number of rectangles sorted - * by y coordinate first, and then by x coordinate. - * - * Furthermore, the rectangles are banded such that every rectangle with a - * given upper-left y coordinate (y1) will have the same lower-right y - * coordinate (y2) and vice versa. If a rectangle has scanlines in a band, it - * will span the entire vertical distance of the band. This means that some - * areas that could be merged into a taller rectangle will be represented as - * several shorter rectangles to account for shorter rectangles to its left - * or right but within its "vertical scope". - * - * An added constraint on the rectangles is that they must cover as much - * horizontal area as possible. E.g. no two rectangles in a band are allowed - * to touch. - * - * Whenever possible, bands will be merged together to cover a greater vertical - * distance (and thus reduce the number of rectangles). Two bands can be merged - * only if the bottom of one touches the top of the other and they have - * rectangles in the same places (of the same width, of course). This maintains - * the y-x-banding that's so nice to have... - */ -/* $XFree86: xc/lib/X11/Region.c,v 1.1.1.2.2.2 1998/10/04 15:22:50 hohndel Exp $ */ - -static void UnionRectWithRegion(register const QRect *rect, const QRegionPrivate *source, - QRegionPrivate &dest) -{ - if (!rect->width() || !rect->height()) - return; - - QRegionPrivate region(*rect); - - Q_ASSERT(EqualRegion(source, &dest)); - Q_ASSERT(!isEmptyHelper(®ion)); - - if (dest.numRects == 0) - dest = region; - else if (dest.canAppend(®ion)) - dest.append(®ion); - else - UnionRegion(®ion, source, dest); -} - -/*- - *----------------------------------------------------------------------- - * miSetExtents -- - * Reset the extents and innerRect of a region to what they should be. - * Called by miSubtract and miIntersect b/c they can't figure it out - * along the way or do so easily, as miUnion can. - * - * Results: - * None. - * - * Side Effects: - * The region's 'extents' and 'innerRect' structure is overwritten. - * - *----------------------------------------------------------------------- - */ -static void miSetExtents(QRegionPrivate &dest) -{ - register const QRect *pBox, - *pBoxEnd; - register QRect *pExtents; - - dest.innerRect.setCoords(0, 0, -1, -1); - dest.innerArea = -1; - if (dest.numRects == 0) { - dest.extents.setCoords(0, 0, 0, 0); - return; - } - - pExtents = &dest.extents; - pBox = (dest.mode==QRegionPrivate::Vector)?(dest.rects.constData()):(&dest.single); - pBoxEnd = (dest.mode==QRegionPrivate::Vector)?(&pBox[dest.numRects - 1]):(&dest.single); - - /* - * Since pBox is the first rectangle in the region, it must have the - * smallest y1 and since pBoxEnd is the last rectangle in the region, - * it must have the largest y2, because of banding. Initialize x1 and - * x2 from pBox and pBoxEnd, resp., as good things to initialize them - * to... - */ - pExtents->setLeft(pBox->left()); - pExtents->setTop(pBox->top()); - pExtents->setRight(pBoxEnd->right()); - pExtents->setBottom(pBoxEnd->bottom()); - - Q_ASSERT(pExtents->top() <= pExtents->bottom()); - while (pBox <= pBoxEnd) { - if (pBox->left() < pExtents->left()) - pExtents->setLeft(pBox->left()); - if (pBox->right() > pExtents->right()) - pExtents->setRight(pBox->right()); - dest.updateInnerRect(*pBox); - ++pBox; - } - Q_ASSERT(pExtents->left() <= pExtents->right()); -} - -/* TranslateRegion(pRegion, x, y) - translates in place - added by raymond -*/ - -static void OffsetRegion(register QRegionPrivate ®ion, register int x, register int y) -{ - register int nbox; - register QRect *pbox; - - if(region.mode == QRegionPrivate::Single) { - region.single.translate(x, y); - } else { - pbox = region.rects.data(); - nbox = region.numRects; - - while (nbox--) { - pbox->translate(x, y); - ++pbox; - } - } - region.extents.translate(x, y); - region.innerRect.translate(x, y); -} - -/*====================================================================== - * Region Intersection - *====================================================================*/ -/*- - *----------------------------------------------------------------------- - * miIntersectO -- - * Handle an overlapping band for miIntersect. - * - * Results: - * None. - * - * Side Effects: - * Rectangles may be added to the region. - * - *----------------------------------------------------------------------- - */ -static void miIntersectO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, int y1, int y2) -{ - register int x1; - register int x2; - register QRect *pNextRect; - - pNextRect = dest.rects.data() + dest.numRects; - - while (r1 != r1End && r2 != r2End) { - x1 = qMax(r1->left(), r2->left()); - x2 = qMin(r1->right(), r2->right()); - - /* - * If there's any overlap between the two rectangles, add that - * overlap to the new region. - * There's no need to check for subsumption because the only way - * such a need could arise is if some region has two rectangles - * right next to each other. Since that should never happen... - */ - if (x1 <= x2) { - Q_ASSERT(y1 <= y2); - MEMCHECK(dest, pNextRect, dest.rects) - pNextRect->setCoords(x1, y1, x2, y2); - ++dest.numRects; - ++pNextRect; - } - - /* - * Need to advance the pointers. Shift the one that extends - * to the right the least, since the other still has a chance to - * overlap with that region's next rectangle, if you see what I mean. - */ - if (r1->right() < r2->right()) { - ++r1; - } else if (r2->right() < r1->right()) { - ++r2; - } else { - ++r1; - ++r2; - } - } -} - -/*====================================================================== - * Generic Region Operator - *====================================================================*/ - -/*- - *----------------------------------------------------------------------- - * miCoalesce -- - * Attempt to merge the boxes in the current band with those in the - * previous one. Used only by miRegionOp. - * - * Results: - * The new index for the previous band. - * - * Side Effects: - * If coalescing takes place: - * - rectangles in the previous band will have their y2 fields - * altered. - * - dest.numRects will be decreased. - * - *----------------------------------------------------------------------- - */ -static int miCoalesce(register QRegionPrivate &dest, int prevStart, int curStart) -{ - register QRect *pPrevBox; /* Current box in previous band */ - register QRect *pCurBox; /* Current box in current band */ - register QRect *pRegEnd; /* End of region */ - int curNumRects; /* Number of rectangles in current band */ - int prevNumRects; /* Number of rectangles in previous band */ - int bandY1; /* Y1 coordinate for current band */ - QRect *rData = dest.rects.data(); - - pRegEnd = rData + dest.numRects; - - pPrevBox = rData + prevStart; - prevNumRects = curStart - prevStart; - - /* - * Figure out how many rectangles are in the current band. Have to do - * this because multiple bands could have been added in miRegionOp - * at the end when one region has been exhausted. - */ - pCurBox = rData + curStart; - bandY1 = pCurBox->top(); - for (curNumRects = 0; pCurBox != pRegEnd && pCurBox->top() == bandY1; ++curNumRects) { - ++pCurBox; - } - - if (pCurBox != pRegEnd) { - /* - * If more than one band was added, we have to find the start - * of the last band added so the next coalescing job can start - * at the right place... (given when multiple bands are added, - * this may be pointless -- see above). - */ - --pRegEnd; - while ((pRegEnd - 1)->top() == pRegEnd->top()) - --pRegEnd; - curStart = pRegEnd - rData; - pRegEnd = rData + dest.numRects; - } - - if (curNumRects == prevNumRects && curNumRects != 0) { - pCurBox -= curNumRects; - /* - * The bands may only be coalesced if the bottom of the previous - * matches the top scanline of the current. - */ - if (pPrevBox->bottom() == pCurBox->top() - 1) { - /* - * Make sure the bands have boxes in the same places. This - * assumes that boxes have been added in such a way that they - * cover the most area possible. I.e. two boxes in a band must - * have some horizontal space between them. - */ - do { - if (pPrevBox->left() != pCurBox->left() || pPrevBox->right() != pCurBox->right()) { - // The bands don't line up so they can't be coalesced. - return curStart; - } - ++pPrevBox; - ++pCurBox; - --prevNumRects; - } while (prevNumRects != 0); - - dest.numRects -= curNumRects; - pCurBox -= curNumRects; - pPrevBox -= curNumRects; - - /* - * The bands may be merged, so set the bottom y of each box - * in the previous band to that of the corresponding box in - * the current band. - */ - do { - pPrevBox->setBottom(pCurBox->bottom()); - dest.updateInnerRect(*pPrevBox); - ++pPrevBox; - ++pCurBox; - curNumRects -= 1; - } while (curNumRects != 0); - - /* - * If only one band was added to the region, we have to backup - * curStart to the start of the previous band. - * - * If more than one band was added to the region, copy the - * other bands down. The assumption here is that the other bands - * came from the same region as the current one and no further - * coalescing can be done on them since it's all been done - * already... curStart is already in the right place. - */ - if (pCurBox == pRegEnd) { - curStart = prevStart; - } else { - do { - *pPrevBox++ = *pCurBox++; - dest.updateInnerRect(*pPrevBox); - } while (pCurBox != pRegEnd); - } - } - } - return curStart; -} - -/*- - *----------------------------------------------------------------------- - * miRegionOp -- - * Apply an operation to two regions. Called by miUnion, miInverse, - * miSubtract, miIntersect... - * - * Results: - * None. - * - * Side Effects: - * The new region is overwritten. - * - * Notes: - * The idea behind this function is to view the two regions as sets. - * Together they cover a rectangle of area that this function divides - * into horizontal bands where points are covered only by one region - * or by both. For the first case, the nonOverlapFunc is called with - * each the band and the band's upper and lower extents. For the - * second, the overlapFunc is called to process the entire band. It - * is responsible for clipping the rectangles in the band, though - * this function provides the boundaries. - * At the end of each band, the new region is coalesced, if possible, - * to reduce the number of rectangles in the region. - * - *----------------------------------------------------------------------- - */ -static void miRegionOp(register QRegionPrivate &dest, const QRegionPrivate *reg1, const QRegionPrivate *reg2, - OverlapFunc overlapFunc, NonOverlapFunc nonOverlap1Func, - NonOverlapFunc nonOverlap2Func) -{ - register const QRect *r1; // Pointer into first region - register const QRect *r2; // Pointer into 2d region - const QRect *r1End; // End of 1st region - const QRect *r2End; // End of 2d region - register int ybot; // Bottom of intersection - register int ytop; // Top of intersection - int prevBand; // Index of start of previous band in dest - int curBand; // Index of start of current band in dest - register const QRect *r1BandEnd; // End of current band in r1 - register const QRect *r2BandEnd; // End of current band in r2 - int top; // Top of non-overlapping band - int bot; // Bottom of non-overlapping band - - /* - * Initialization: - * set r1, r2, r1End and r2End appropriately, preserve the important - * parts of the destination region until the end in case it's one of - * the two source regions, then mark the "new" region empty, allocating - * another array of rectangles for it to use. - */ - r1 = (reg1->mode==QRegionPrivate::Vector)?reg1->rects.data():®1->single; - r2 = (reg2->mode==QRegionPrivate::Vector)?reg2->rects.data():®2->single; - r1End = r1 + reg1->numRects; - r2End = r2 + reg2->numRects; - - dest.vector(); - QVector oldRects = dest.rects; - - dest.numRects = 0; - - /* - * Allocate a reasonable number of rectangles for the new region. The idea - * is to allocate enough so the individual functions don't need to - * reallocate and copy the array, which is time consuming, yet we don't - * have to worry about using too much memory. I hope to be able to - * nuke the realloc() at the end of this function eventually. - */ - dest.rects.resize(qMax(reg1->numRects,reg2->numRects) * 2); - - /* - * Initialize ybot and ytop. - * In the upcoming loop, ybot and ytop serve different functions depending - * on whether the band being handled is an overlapping or non-overlapping - * band. - * In the case of a non-overlapping band (only one of the regions - * has points in the band), ybot is the bottom of the most recent - * intersection and thus clips the top of the rectangles in that band. - * ytop is the top of the next intersection between the two regions and - * serves to clip the bottom of the rectangles in the current band. - * For an overlapping band (where the two regions intersect), ytop clips - * the top of the rectangles of both regions and ybot clips the bottoms. - */ - if (reg1->extents.top() < reg2->extents.top()) - ybot = reg1->extents.top() - 1; - else - ybot = reg2->extents.top() - 1; - - /* - * prevBand serves to mark the start of the previous band so rectangles - * can be coalesced into larger rectangles. qv. miCoalesce, above. - * In the beginning, there is no previous band, so prevBand == curBand - * (curBand is set later on, of course, but the first band will always - * start at index 0). prevBand and curBand must be indices because of - * the possible expansion, and resultant moving, of the new region's - * array of rectangles. - */ - prevBand = 0; - - do { - curBand = dest.numRects; - - /* - * This algorithm proceeds one source-band (as opposed to a - * destination band, which is determined by where the two regions - * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the - * rectangle after the last one in the current band for their - * respective regions. - */ - r1BandEnd = r1; - while (r1BandEnd != r1End && r1BandEnd->top() == r1->top()) - ++r1BandEnd; - - r2BandEnd = r2; - while (r2BandEnd != r2End && r2BandEnd->top() == r2->top()) - ++r2BandEnd; - - /* - * First handle the band that doesn't intersect, if any. - * - * Note that attention is restricted to one band in the - * non-intersecting region at once, so if a region has n - * bands between the current position and the next place it overlaps - * the other, this entire loop will be passed through n times. - */ - if (r1->top() < r2->top()) { - top = qMax(r1->top(), ybot + 1); - bot = qMin(r1->bottom(), r2->top() - 1); - - if (nonOverlap1Func != 0 && bot >= top) - (*nonOverlap1Func)(dest, r1, r1BandEnd, top, bot); - ytop = r2->top(); - } else if (r2->top() < r1->top()) { - top = qMax(r2->top(), ybot + 1); - bot = qMin(r2->bottom(), r1->top() - 1); - - if (nonOverlap2Func != 0 && bot >= top) - (*nonOverlap2Func)(dest, r2, r2BandEnd, top, bot); - ytop = r1->top(); - } else { - ytop = r1->top(); - } - - /* - * If any rectangles got added to the region, try and coalesce them - * with rectangles from the previous band. Note we could just do - * this test in miCoalesce, but some machines incur a not - * inconsiderable cost for function calls, so... - */ - if (dest.numRects != curBand) - prevBand = miCoalesce(dest, prevBand, curBand); - - /* - * Now see if we've hit an intersecting band. The two bands only - * intersect if ybot >= ytop - */ - ybot = qMin(r1->bottom(), r2->bottom()); - curBand = dest.numRects; - if (ybot >= ytop) - (*overlapFunc)(dest, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot); - - if (dest.numRects != curBand) - prevBand = miCoalesce(dest, prevBand, curBand); - - /* - * If we've finished with a band (y2 == ybot) we skip forward - * in the region to the next band. - */ - if (r1->bottom() == ybot) - r1 = r1BandEnd; - if (r2->bottom() == ybot) - r2 = r2BandEnd; - } while (r1 != r1End && r2 != r2End); - - /* - * Deal with whichever region still has rectangles left. - */ - curBand = dest.numRects; - if (r1 != r1End) { - if (nonOverlap1Func != 0) { - do { - r1BandEnd = r1; - while (r1BandEnd < r1End && r1BandEnd->top() == r1->top()) - ++r1BandEnd; - (*nonOverlap1Func)(dest, r1, r1BandEnd, qMax(r1->top(), ybot + 1), r1->bottom()); - r1 = r1BandEnd; - } while (r1 != r1End); - } - } else if ((r2 != r2End) && (nonOverlap2Func != 0)) { - do { - r2BandEnd = r2; - while (r2BandEnd < r2End && r2BandEnd->top() == r2->top()) - ++r2BandEnd; - (*nonOverlap2Func)(dest, r2, r2BandEnd, qMax(r2->top(), ybot + 1), r2->bottom()); - r2 = r2BandEnd; - } while (r2 != r2End); - } - - if (dest.numRects != curBand) - (void)miCoalesce(dest, prevBand, curBand); - - /* - * A bit of cleanup. To keep regions from growing without bound, - * we shrink the array of rectangles to match the new number of - * rectangles in the region. - * - * Only do this stuff if the number of rectangles allocated is more than - * twice the number of rectangles in the region (a simple optimization). - */ - if (qMax(4, dest.numRects) < (dest.rects.size() >> 1)) - dest.rects.resize(dest.numRects); -} - -/*====================================================================== - * Region Union - *====================================================================*/ - -/*- - *----------------------------------------------------------------------- - * miUnionNonO -- - * Handle a non-overlapping band for the union operation. Just - * Adds the rectangles into the region. Doesn't have to check for - * subsumption or anything. - * - * Results: - * None. - * - * Side Effects: - * dest.numRects is incremented and the final rectangles overwritten - * with the rectangles we're passed. - * - *----------------------------------------------------------------------- - */ - -static void miUnionNonO(register QRegionPrivate &dest, register const QRect *r, const QRect *rEnd, - register int y1, register int y2) -{ - register QRect *pNextRect; - - pNextRect = dest.rects.data() + dest.numRects; - - Q_ASSERT(y1 <= y2); - - while (r != rEnd) { - Q_ASSERT(r->left() <= r->right()); - MEMCHECK(dest, pNextRect, dest.rects) - pNextRect->setCoords(r->left(), y1, r->right(), y2); - dest.numRects++; - ++pNextRect; - ++r; - } -} - - -/*- - *----------------------------------------------------------------------- - * miUnionO -- - * Handle an overlapping band for the union operation. Picks the - * left-most rectangle each time and merges it into the region. - * - * Results: - * None. - * - * Side Effects: - * Rectangles are overwritten in dest.rects and dest.numRects will - * be changed. - * - *----------------------------------------------------------------------- - */ - -static void miUnionO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, register int y1, register int y2) -{ - register QRect *pNextRect; - - pNextRect = dest.rects.data() + dest.numRects; - -#define MERGERECT(r) \ - if ((dest.numRects != 0) && \ - (pNextRect[-1].top() == y1) && \ - (pNextRect[-1].bottom() == y2) && \ - (pNextRect[-1].right() >= r->left()-1)) { \ - if (pNextRect[-1].right() < r->right()) { \ - pNextRect[-1].setRight(r->right()); \ - dest.updateInnerRect(pNextRect[-1]); \ - Q_ASSERT(pNextRect[-1].left() <= pNextRect[-1].right()); \ - } \ - } else { \ - MEMCHECK(dest, pNextRect, dest.rects) \ - pNextRect->setCoords(r->left(), y1, r->right(), y2); \ - dest.updateInnerRect(*pNextRect); \ - dest.numRects++; \ - pNextRect++; \ - } \ - r++; - - Q_ASSERT(y1 <= y2); - while (r1 != r1End && r2 != r2End) { - if (r1->left() < r2->left()) { - MERGERECT(r1) - } else { - MERGERECT(r2) - } - } - - if (r1 != r1End) { - do { - MERGERECT(r1) - } while (r1 != r1End); - } else { - while (r2 != r2End) { - MERGERECT(r2) - } - } -} - -static void UnionRegion(const QRegionPrivate *reg1, const QRegionPrivate *reg2, QRegionPrivate &dest) -{ - Q_ASSERT(!isEmptyHelper(reg1) && !isEmptyHelper(reg2)); - Q_ASSERT(!reg1->contains(*reg2)); - Q_ASSERT(!reg2->contains(*reg1)); - Q_ASSERT(!EqualRegion(reg1, reg2)); - Q_ASSERT(!reg1->canAppend(reg2)); - Q_ASSERT(!reg2->canAppend(reg1)); - - if (reg1->innerArea > reg2->innerArea) { - dest.innerArea = reg1->innerArea; - dest.innerRect = reg1->innerRect; - } else { - dest.innerArea = reg2->innerArea; - dest.innerRect = reg2->innerRect; - } - miRegionOp(dest, reg1, reg2, miUnionO, miUnionNonO, miUnionNonO); - - dest.extents.setCoords(qMin(reg1->extents.left(), reg2->extents.left()), - qMin(reg1->extents.top(), reg2->extents.top()), - qMax(reg1->extents.right(), reg2->extents.right()), - qMax(reg1->extents.bottom(), reg2->extents.bottom())); -} - -/*====================================================================== - * Region Subtraction - *====================================================================*/ - -/*- - *----------------------------------------------------------------------- - * miSubtractNonO -- - * Deal with non-overlapping band for subtraction. Any parts from - * region 2 we discard. Anything from region 1 we add to the region. - * - * Results: - * None. - * - * Side Effects: - * dest may be affected. - * - *----------------------------------------------------------------------- - */ - -static void miSubtractNonO1(register QRegionPrivate &dest, register const QRect *r, - const QRect *rEnd, register int y1, register int y2) -{ - register QRect *pNextRect; - - pNextRect = dest.rects.data() + dest.numRects; - - Q_ASSERT(y1<=y2); - - while (r != rEnd) { - Q_ASSERT(r->left() <= r->right()); - MEMCHECK(dest, pNextRect, dest.rects) - pNextRect->setCoords(r->left(), y1, r->right(), y2); - ++dest.numRects; - ++pNextRect; - ++r; - } -} - -/*- - *----------------------------------------------------------------------- - * miSubtractO -- - * Overlapping band subtraction. x1 is the left-most point not yet - * checked. - * - * Results: - * None. - * - * Side Effects: - * dest may have rectangles added to it. - * - *----------------------------------------------------------------------- - */ - -static void miSubtractO(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, - register const QRect *r2, const QRect *r2End, register int y1, register int y2) -{ - register QRect *pNextRect; - register int x1; - - x1 = r1->left(); - - Q_ASSERT(y1 <= y2); - pNextRect = dest.rects.data() + dest.numRects; - - while (r1 != r1End && r2 != r2End) { - if (r2->right() < x1) { - /* - * Subtrahend missed the boat: go to next subtrahend. - */ - ++r2; - } else if (r2->left() <= x1) { - /* - * Subtrahend precedes minuend: nuke left edge of minuend. - */ - x1 = r2->right() + 1; - if (x1 > r1->right()) { - /* - * Minuend completely covered: advance to next minuend and - * reset left fence to edge of new minuend. - */ - ++r1; - if (r1 != r1End) - x1 = r1->left(); - } else { - // Subtrahend now used up since it doesn't extend beyond minuend - ++r2; - } - } else if (r2->left() <= r1->right()) { - /* - * Left part of subtrahend covers part of minuend: add uncovered - * part of minuend to region and skip to next subtrahend. - */ - Q_ASSERT(x1 < r2->left()); - MEMCHECK(dest, pNextRect, dest.rects) - pNextRect->setCoords(x1, y1, r2->left() - 1, y2); - ++dest.numRects; - ++pNextRect; - - x1 = r2->right() + 1; - if (x1 > r1->right()) { - /* - * Minuend used up: advance to new... - */ - ++r1; - if (r1 != r1End) - x1 = r1->left(); - } else { - // Subtrahend used up - ++r2; - } - } else { - /* - * Minuend used up: add any remaining piece before advancing. - */ - if (r1->right() >= x1) { - MEMCHECK(dest, pNextRect, dest.rects) - pNextRect->setCoords(x1, y1, r1->right(), y2); - ++dest.numRects; - ++pNextRect; - } - ++r1; - if (r1 != r1End) - x1 = r1->left(); - } - } - - /* - * Add remaining minuend rectangles to region. - */ - while (r1 != r1End) { - Q_ASSERT(x1 <= r1->right()); - MEMCHECK(dest, pNextRect, dest.rects) - pNextRect->setCoords(x1, y1, r1->right(), y2); - ++dest.numRects; - ++pNextRect; - - ++r1; - if (r1 != r1End) - x1 = r1->left(); - } -} - -/*- - *----------------------------------------------------------------------- - * miSubtract -- - * Subtract regS from regM and leave the result in regD. - * S stands for subtrahend, M for minuend and D for difference. - * - * Side Effects: - * regD is overwritten. - * - *----------------------------------------------------------------------- - */ - -static void SubtractRegion(QRegionPrivate *regM, QRegionPrivate *regS, - register QRegionPrivate &dest) -{ - Q_ASSERT(!isEmptyHelper(regM)); - Q_ASSERT(!isEmptyHelper(regS)); - Q_ASSERT(EXTENTCHECK(®M->extents, ®S->extents)); - Q_ASSERT(!regS->contains(*regM)); - Q_ASSERT(!EqualRegion(regM, regS)); - - miRegionOp(dest, regM, regS, miSubtractO, miSubtractNonO1, 0); - - /* - * Can't alter dest's extents before we call miRegionOp because - * it might be one of the source regions and miRegionOp depends - * on the extents of those regions being the unaltered. Besides, this - * way there's no checking against rectangles that will be nuked - * due to coalescing, so we have to examine fewer rectangles. - */ - miSetExtents(dest); -} - -static void XorRegion(QRegionPrivate *sra, QRegionPrivate *srb, QRegionPrivate &dest) -{ - Q_ASSERT(!isEmptyHelper(sra) && !isEmptyHelper(srb)); - Q_ASSERT(EXTENTCHECK(&sra->extents, &srb->extents)); - Q_ASSERT(!EqualRegion(sra, srb)); - - QRegionPrivate tra, trb; - - if (!srb->contains(*sra)) - SubtractRegion(sra, srb, tra); - if (!sra->contains(*srb)) - SubtractRegion(srb, sra, trb); - - Q_ASSERT(isEmptyHelper(&trb) || !tra.contains(trb)); - Q_ASSERT(isEmptyHelper(&tra) || !trb.contains(tra)); - - if (isEmptyHelper(&tra)) { - dest = trb; - } else if (isEmptyHelper(&trb)) { - dest = tra; - } else if (tra.canAppend(&trb)) { - dest = tra; - dest.append(&trb); - } else if (trb.canAppend(&tra)) { - dest = trb; - dest.append(&tra); - } else { - UnionRegion(&tra, &trb, dest); - } -} - -/* - * Check to see if two regions are equal - */ -static bool EqualRegion(const QRegionPrivate *r1, const QRegionPrivate *r2) -{ - if (r1->numRects != r2->numRects) { - return false; - } else if (r1->numRects == 0) { - return true; - } else if (r1->extents != r2->extents) { - return false; - } else if (r1->mode == QRegionPrivate::Single && r2->mode == QRegionPrivate::Single) { - return r1->single == r2->single; - } else { - const QRect *rr1 = (r1->mode==QRegionPrivate::Vector)?r1->rects.constData():&r1->single; - const QRect *rr2 = (r2->mode==QRegionPrivate::Vector)?r2->rects.constData():&r2->single; - for (int i = 0; i < r1->numRects; ++i, ++rr1, ++rr2) { - if (*rr1 != *rr2) - return false; - } - } - - return true; -} - -static bool PointInRegion(QRegionPrivate *pRegion, int x, int y) -{ - int i; - - if (pRegion->mode == QRegionPrivate::Single) - return pRegion->single.contains(x, y); - if (isEmptyHelper(pRegion)) - return false; - if (!pRegion->extents.contains(x, y)) - return false; - if (pRegion->innerRect.contains(x, y)) - return true; - for (i = 0; i < pRegion->numRects; ++i) { - if (pRegion->rects[i].contains(x, y)) - return true; - } - return false; -} - -static bool RectInRegion(register QRegionPrivate *region, int rx, int ry, uint rwidth, uint rheight) -{ - register const QRect *pbox; - register const QRect *pboxEnd; - QRect rect(rx, ry, rwidth, rheight); - register QRect *prect = ▭ - int partIn, partOut; - - if (!region || region->numRects == 0 || !EXTENTCHECK(®ion->extents, prect)) - return RectangleOut; - - partOut = false; - partIn = false; - - /* can stop when both partOut and partIn are true, or we reach prect->y2 */ - for (pbox = (region->mode==QRegionPrivate::Vector)?region->rects.constData():®ion->single, pboxEnd = pbox + region->numRects; - pbox < pboxEnd; ++pbox) { - if (pbox->bottom() < ry) - continue; - - if (pbox->top() > ry) { - partOut = true; - if (partIn || pbox->top() > prect->bottom()) - break; - ry = pbox->top(); - } - - if (pbox->right() < rx) - continue; /* not far enough over yet */ - - if (pbox->left() > rx) { - partOut = true; /* missed part of rectangle to left */ - if (partIn) - break; - } - - if (pbox->left() <= prect->right()) { - partIn = true; /* definitely overlap */ - if (partOut) - break; - } - - if (pbox->right() >= prect->right()) { - ry = pbox->bottom() + 1; /* finished with this band */ - if (ry > prect->bottom()) - break; - rx = prect->left(); /* reset x out to left again */ - } else { - /* - * Because boxes in a band are maximal width, if the first box - * to overlap the rectangle doesn't completely cover it in that - * band, the rectangle must be partially out, since some of it - * will be uncovered in that band. partIn will have been set true - * by now... - */ - break; - } - } - return partIn ? ((ry <= prect->bottom()) ? RectanglePart : RectangleIn) : RectangleOut; -} -// END OF Region.c extract -// START OF poly.h extract -/* $XConsortium: poly.h,v 1.4 94/04/17 20:22:19 rws Exp $ */ -/************************************************************************ - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -************************************************************************/ - -/* - * This file contains a few macros to help track - * the edge of a filled object. The object is assumed - * to be filled in scanline order, and thus the - * algorithm used is an extension of Bresenham's line - * drawing algorithm which assumes that y is always the - * major axis. - * Since these pieces of code are the same for any filled shape, - * it is more convenient to gather the library in one - * place, but since these pieces of code are also in - * the inner loops of output primitives, procedure call - * overhead is out of the question. - * See the author for a derivation if needed. - */ - - -/* - * In scan converting polygons, we want to choose those pixels - * which are inside the polygon. Thus, we add .5 to the starting - * x coordinate for both left and right edges. Now we choose the - * first pixel which is inside the pgon for the left edge and the - * first pixel which is outside the pgon for the right edge. - * Draw the left pixel, but not the right. - * - * How to add .5 to the starting x coordinate: - * If the edge is moving to the right, then subtract dy from the - * error term from the general form of the algorithm. - * If the edge is moving to the left, then add dy to the error term. - * - * The reason for the difference between edges moving to the left - * and edges moving to the right is simple: If an edge is moving - * to the right, then we want the algorithm to flip immediately. - * If it is moving to the left, then we don't want it to flip until - * we traverse an entire pixel. - */ -#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \ - int dx; /* local storage */ \ -\ - /* \ - * if the edge is horizontal, then it is ignored \ - * and assumed not to be processed. Otherwise, do this stuff. \ - */ \ - if ((dy) != 0) { \ - xStart = (x1); \ - dx = (x2) - xStart; \ - if (dx < 0) { \ - m = dx / (dy); \ - m1 = m - 1; \ - incr1 = -2 * dx + 2 * (dy) * m1; \ - incr2 = -2 * dx + 2 * (dy) * m; \ - d = 2 * m * (dy) - 2 * dx - 2 * (dy); \ - } else { \ - m = dx / (dy); \ - m1 = m + 1; \ - incr1 = 2 * dx - 2 * (dy) * m1; \ - incr2 = 2 * dx - 2 * (dy) * m; \ - d = -2 * m * (dy) + 2 * dx; \ - } \ - } \ -} - -#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \ - if (m1 > 0) { \ - if (d > 0) { \ - minval += m1; \ - d += incr1; \ - } \ - else { \ - minval += m; \ - d += incr2; \ - } \ - } else {\ - if (d >= 0) { \ - minval += m1; \ - d += incr1; \ - } \ - else { \ - minval += m; \ - d += incr2; \ - } \ - } \ -} - - -/* - * This structure contains all of the information needed - * to run the bresenham algorithm. - * The variables may be hardcoded into the declarations - * instead of using this structure to make use of - * register declarations. - */ -typedef struct { - int minor_axis; /* minor axis */ - int d; /* decision variable */ - int m, m1; /* slope and slope+1 */ - int incr1, incr2; /* error increments */ -} BRESINFO; - - -#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \ - BRESINITPGON(dmaj, min1, min2, bres.minor_axis, bres.d, \ - bres.m, bres.m1, bres.incr1, bres.incr2) - -#define BRESINCRPGONSTRUCT(bres) \ - BRESINCRPGON(bres.d, bres.minor_axis, bres.m, bres.m1, bres.incr1, bres.incr2) - - - -/* - * These are the data structures needed to scan - * convert regions. Two different scan conversion - * methods are available -- the even-odd method, and - * the winding number method. - * The even-odd rule states that a point is inside - * the polygon if a ray drawn from that point in any - * direction will pass through an odd number of - * path segments. - * By the winding number rule, a point is decided - * to be inside the polygon if a ray drawn from that - * point in any direction passes through a different - * number of clockwise and counter-clockwise path - * segments. - * - * These data structures are adapted somewhat from - * the algorithm in (Foley/Van Dam) for scan converting - * polygons. - * The basic algorithm is to start at the top (smallest y) - * of the polygon, stepping down to the bottom of - * the polygon by incrementing the y coordinate. We - * keep a list of edges which the current scanline crosses, - * sorted by x. This list is called the Active Edge Table (AET) - * As we change the y-coordinate, we update each entry in - * in the active edge table to reflect the edges new xcoord. - * This list must be sorted at each scanline in case - * two edges intersect. - * We also keep a data structure known as the Edge Table (ET), - * which keeps track of all the edges which the current - * scanline has not yet reached. The ET is basically a - * list of ScanLineList structures containing a list of - * edges which are entered at a given scanline. There is one - * ScanLineList per scanline at which an edge is entered. - * When we enter a new edge, we move it from the ET to the AET. - * - * From the AET, we can implement the even-odd rule as in - * (Foley/Van Dam). - * The winding number rule is a little trickier. We also - * keep the EdgeTableEntries in the AET linked by the - * nextWETE (winding EdgeTableEntry) link. This allows - * the edges to be linked just as before for updating - * purposes, but only uses the edges linked by the nextWETE - * link as edges representing spans of the polygon to - * drawn (as with the even-odd rule). - */ - -/* - * for the winding number rule - */ -#define CLOCKWISE 1 -#define COUNTERCLOCKWISE -1 - -typedef struct _EdgeTableEntry { - int ymax; /* ycoord at which we exit this edge. */ - BRESINFO bres; /* Bresenham info to run the edge */ - struct _EdgeTableEntry *next; /* next in the list */ - struct _EdgeTableEntry *back; /* for insertion sort */ - struct _EdgeTableEntry *nextWETE; /* for winding num rule */ - int ClockWise; /* flag for winding number rule */ -} EdgeTableEntry; - - -typedef struct _ScanLineList{ - int scanline; /* the scanline represented */ - EdgeTableEntry *edgelist; /* header node */ - struct _ScanLineList *next; /* next in the list */ -} ScanLineList; - - -typedef struct { - int ymax; /* ymax for the polygon */ - int ymin; /* ymin for the polygon */ - ScanLineList scanlines; /* header node */ -} EdgeTable; - - -/* - * Here is a struct to help with storage allocation - * so we can allocate a big chunk at a time, and then take - * pieces from this heap when we need to. - */ -#define SLLSPERBLOCK 25 - -typedef struct _ScanLineListBlock { - ScanLineList SLLs[SLLSPERBLOCK]; - struct _ScanLineListBlock *next; -} ScanLineListBlock; - - - -/* - * - * a few macros for the inner loops of the fill code where - * performance considerations don't allow a procedure call. - * - * Evaluate the given edge at the given scanline. - * If the edge has expired, then we leave it and fix up - * the active edge table; otherwise, we increment the - * x value to be ready for the next scanline. - * The winding number rule is in effect, so we must notify - * the caller when the edge has been removed so he - * can reorder the Winding Active Edge Table. - */ -#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \ - if (pAET->ymax == y) { /* leaving this edge */ \ - pPrevAET->next = pAET->next; \ - pAET = pPrevAET->next; \ - fixWAET = 1; \ - if (pAET) \ - pAET->back = pPrevAET; \ - } \ - else { \ - BRESINCRPGONSTRUCT(pAET->bres) \ - pPrevAET = pAET; \ - pAET = pAET->next; \ - } \ -} - - -/* - * Evaluate the given edge at the given scanline. - * If the edge has expired, then we leave it and fix up - * the active edge table; otherwise, we increment the - * x value to be ready for the next scanline. - * The even-odd rule is in effect. - */ -#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \ - if (pAET->ymax == y) { /* leaving this edge */ \ - pPrevAET->next = pAET->next; \ - pAET = pPrevAET->next; \ - if (pAET) \ - pAET->back = pPrevAET; \ - } \ - else { \ - BRESINCRPGONSTRUCT(pAET->bres) \ - pPrevAET = pAET; \ - pAET = pAET->next; \ - } \ -} -// END OF poly.h extract -// START OF PolyReg.c extract -/* $XConsortium: PolyReg.c,v 11.23 94/11/17 21:59:37 converse Exp $ */ -/************************************************************************ - -Copyright (c) 1987 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -************************************************************************/ -/* $XFree86: xc/lib/X11/PolyReg.c,v 1.1.1.2.8.2 1998/10/04 15:22:49 hohndel Exp $ */ - -#define LARGE_COORDINATE 1000000 -#define SMALL_COORDINATE -LARGE_COORDINATE - -/* - * InsertEdgeInET - * - * Insert the given edge into the edge table. - * First we must find the correct bucket in the - * Edge table, then find the right slot in the - * bucket. Finally, we can insert it. - * - */ -static void InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, - ScanLineListBlock **SLLBlock, int *iSLLBlock) -{ - register EdgeTableEntry *start, *prev; - register ScanLineList *pSLL, *pPrevSLL; - ScanLineListBlock *tmpSLLBlock; - - /* - * find the right bucket to put the edge into - */ - pPrevSLL = &ET->scanlines; - pSLL = pPrevSLL->next; - while (pSLL && (pSLL->scanline < scanline)) { - pPrevSLL = pSLL; - pSLL = pSLL->next; - } - - /* - * reassign pSLL (pointer to ScanLineList) if necessary - */ - if ((!pSLL) || (pSLL->scanline > scanline)) { - if (*iSLLBlock > SLLSPERBLOCK-1) - { - tmpSLLBlock = - (ScanLineListBlock *)malloc(sizeof(ScanLineListBlock)); - (*SLLBlock)->next = tmpSLLBlock; - tmpSLLBlock->next = (ScanLineListBlock *)NULL; - *SLLBlock = tmpSLLBlock; - *iSLLBlock = 0; - } - pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); - - pSLL->next = pPrevSLL->next; - pSLL->edgelist = (EdgeTableEntry *)NULL; - pPrevSLL->next = pSLL; - } - pSLL->scanline = scanline; - - /* - * now insert the edge in the right bucket - */ - prev = 0; - start = pSLL->edgelist; - while (start && (start->bres.minor_axis < ETE->bres.minor_axis)) { - prev = start; - start = start->next; - } - ETE->next = start; - - if (prev) - prev->next = ETE; - else - pSLL->edgelist = ETE; -} - -/* - * CreateEdgeTable - * - * This routine creates the edge table for - * scan converting polygons. - * The Edge Table (ET) looks like: - * - * EdgeTable - * -------- - * | ymax | ScanLineLists - * |scanline|-->------------>-------------->... - * -------- |scanline| |scanline| - * |edgelist| |edgelist| - * --------- --------- - * | | - * | | - * V V - * list of ETEs list of ETEs - * - * where ETE is an EdgeTableEntry data structure, - * and there is one ScanLineList per scanline at - * which an edge is initially entered. - * - */ - -static void CreateETandAET(register int count, register const QPoint *pts, - EdgeTable *ET, EdgeTableEntry *AET, register EdgeTableEntry *pETEs, - ScanLineListBlock *pSLLBlock) -{ - register const QPoint *top, - *bottom, - *PrevPt, - *CurrPt; - int iSLLBlock = 0; - int dy; - - if (count < 2) - return; - - /* - * initialize the Active Edge Table - */ - AET->next = 0; - AET->back = 0; - AET->nextWETE = 0; - AET->bres.minor_axis = SMALL_COORDINATE; - - /* - * initialize the Edge Table. - */ - ET->scanlines.next = 0; - ET->ymax = SMALL_COORDINATE; - ET->ymin = LARGE_COORDINATE; - pSLLBlock->next = 0; - - PrevPt = &pts[count - 1]; - - /* - * for each vertex in the array of points. - * In this loop we are dealing with two vertices at - * a time -- these make up one edge of the polygon. - */ - while (count--) { - CurrPt = pts++; - - /* - * find out which point is above and which is below. - */ - if (PrevPt->y() > CurrPt->y()) { - bottom = PrevPt; - top = CurrPt; - pETEs->ClockWise = 0; - } else { - bottom = CurrPt; - top = PrevPt; - pETEs->ClockWise = 1; - } - - /* - * don't add horizontal edges to the Edge table. - */ - if (bottom->y() != top->y()) { - pETEs->ymax = bottom->y() - 1; /* -1 so we don't get last scanline */ - - /* - * initialize integer edge algorithm - */ - dy = bottom->y() - top->y(); - BRESINITPGONSTRUCT(dy, top->x(), bottom->x(), pETEs->bres) - - InsertEdgeInET(ET, pETEs, top->y(), &pSLLBlock, &iSLLBlock); - - if (PrevPt->y() > ET->ymax) - ET->ymax = PrevPt->y(); - if (PrevPt->y() < ET->ymin) - ET->ymin = PrevPt->y(); - ++pETEs; - } - - PrevPt = CurrPt; - } -} - -/* - * loadAET - * - * This routine moves EdgeTableEntries from the - * EdgeTable into the Active Edge Table, - * leaving them sorted by smaller x coordinate. - * - */ - -static void loadAET(register EdgeTableEntry *AET, register EdgeTableEntry *ETEs) -{ - register EdgeTableEntry *pPrevAET; - register EdgeTableEntry *tmp; - - pPrevAET = AET; - AET = AET->next; - while (ETEs) { - while (AET && AET->bres.minor_axis < ETEs->bres.minor_axis) { - pPrevAET = AET; - AET = AET->next; - } - tmp = ETEs->next; - ETEs->next = AET; - if (AET) - AET->back = ETEs; - ETEs->back = pPrevAET; - pPrevAET->next = ETEs; - pPrevAET = ETEs; - - ETEs = tmp; - } -} - -/* - * computeWAET - * - * This routine links the AET by the - * nextWETE (winding EdgeTableEntry) link for - * use by the winding number rule. The final - * Active Edge Table (AET) might look something - * like: - * - * AET - * ---------- --------- --------- - * |ymax | |ymax | |ymax | - * | ... | |... | |... | - * |next |->|next |->|next |->... - * |nextWETE| |nextWETE| |nextWETE| - * --------- --------- ^-------- - * | | | - * V-------------------> V---> ... - * - */ -static void computeWAET(register EdgeTableEntry *AET) -{ - register EdgeTableEntry *pWETE; - register int inside = 1; - register int isInside = 0; - - AET->nextWETE = 0; - pWETE = AET; - AET = AET->next; - while (AET) { - if (AET->ClockWise) - ++isInside; - else - --isInside; - - if (!inside && !isInside || inside && isInside) { - pWETE->nextWETE = AET; - pWETE = AET; - inside = !inside; - } - AET = AET->next; - } - pWETE->nextWETE = 0; -} - -/* - * InsertionSort - * - * Just a simple insertion sort using - * pointers and back pointers to sort the Active - * Edge Table. - * - */ - -static int InsertionSort(register EdgeTableEntry *AET) -{ - register EdgeTableEntry *pETEchase; - register EdgeTableEntry *pETEinsert; - register EdgeTableEntry *pETEchaseBackTMP; - register int changed = 0; - - AET = AET->next; - while (AET) { - pETEinsert = AET; - pETEchase = AET; - while (pETEchase->back->bres.minor_axis > AET->bres.minor_axis) - pETEchase = pETEchase->back; - - AET = AET->next; - if (pETEchase != pETEinsert) { - pETEchaseBackTMP = pETEchase->back; - pETEinsert->back->next = AET; - if (AET) - AET->back = pETEinsert->back; - pETEinsert->next = pETEchase; - pETEchase->back->next = pETEinsert; - pETEchase->back = pETEinsert; - pETEinsert->back = pETEchaseBackTMP; - changed = 1; - } - } - return changed; -} - -/* - * Clean up our act. - */ -static void FreeStorage(register ScanLineListBlock *pSLLBlock) -{ - register ScanLineListBlock *tmpSLLBlock; - - while (pSLLBlock) { - tmpSLLBlock = pSLLBlock->next; - free(pSLLBlock); - pSLLBlock = tmpSLLBlock; - } -} - -/* - * Create an array of rectangles from a list of points. - * If indeed these things (POINTS, RECTS) are the same, - * then this proc is still needed, because it allocates - * storage for the array, which was allocated on the - * stack by the calling procedure. - * - */ -static void PtsToRegion(register int numFullPtBlocks, register int iCurPtBlock, - POINTBLOCK *FirstPtBlock, QRegionPrivate *reg) -{ - register QRect *rects; - register QPoint *pts; - register POINTBLOCK *CurPtBlock; - register int i; - register QRect *extents; - register int numRects; - - extents = ®->extents; - numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1; - - reg->rects.resize(numRects); - - CurPtBlock = FirstPtBlock; - rects = reg->rects.data() - 1; - numRects = 0; - extents->setLeft(INT_MAX); - extents->setRight(INT_MIN); - reg->innerArea = -1; - - for (; numFullPtBlocks >= 0; --numFullPtBlocks) { - /* the loop uses 2 points per iteration */ - i = NUMPTSTOBUFFER >> 1; - if (!numFullPtBlocks) - i = iCurPtBlock >> 1; - if(i) { - for (pts = CurPtBlock->pts; i--; pts += 2) { - if (pts->x() == pts[1].x()) - continue; - if (numRects && pts->x() == rects->left() && pts->y() == rects->bottom() + 1 - && pts[1].x() == rects->right()+1 && (numRects == 1 || rects[-1].top() != rects->top()) - && (i && pts[2].y() > pts[1].y())) { - rects->setBottom(pts[1].y()); - reg->updateInnerRect(*rects); - continue; - } - ++numRects; - ++rects; - rects->setCoords(pts->x(), pts->y(), pts[1].x() - 1, pts[1].y()); - if (rects->left() < extents->left()) - extents->setLeft(rects->left()); - if (rects->right() > extents->right()) - extents->setRight(rects->right()); - reg->updateInnerRect(*rects); - } - } - CurPtBlock = CurPtBlock->next; - } - - if (numRects) { - extents->setTop(reg->rects[0].top()); - extents->setBottom(rects->bottom()); - } else { - extents->setCoords(0, 0, 0, 0); - } - reg->numRects = numRects; -} - -/* - * polytoregion - * - * Scan converts a polygon by returning a run-length - * encoding of the resultant bitmap -- the run-length - * encoding is in the form of an array of rectangles. - */ -static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule, - QRegionPrivate *region) - //Point *Pts; /* the pts */ - //int Count; /* number of pts */ - //int rule; /* winding rule */ -{ - register EdgeTableEntry *pAET; /* Active Edge Table */ - register int y; /* current scanline */ - register int iPts = 0; /* number of pts in buffer */ - register EdgeTableEntry *pWETE; /* Winding Edge Table Entry*/ - register ScanLineList *pSLL; /* current scanLineList */ - register QPoint *pts; /* output buffer */ - EdgeTableEntry *pPrevAET; /* ptr to previous AET */ - EdgeTable ET; /* header node for ET */ - EdgeTableEntry AET; /* header node for AET */ - EdgeTableEntry *pETEs; /* EdgeTableEntries pool */ - ScanLineListBlock SLLBlock; /* header for scanlinelist */ - int fixWAET = false; - POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */ - POINTBLOCK *tmpPtBlock; - int numFullPtBlocks = 0; - - region->vector(); - - /* special case a rectangle */ - if (((Count == 4) || - ((Count == 5) && (Pts[4].x() == Pts[0].x()) && (Pts[4].y() == Pts[0].y()))) - && (((Pts[0].y() == Pts[1].y()) && (Pts[1].x() == Pts[2].x()) && (Pts[2].y() == Pts[3].y()) - && (Pts[3].x() == Pts[0].x())) || ((Pts[0].x() == Pts[1].x()) - && (Pts[1].y() == Pts[2].y()) && (Pts[2].x() == Pts[3].x()) - && (Pts[3].y() == Pts[0].y())))) { - int x = qMin(Pts[0].x(), Pts[2].x()); - region->extents.setLeft(x); - int y = qMin(Pts[0].y(), Pts[2].y()); - region->extents.setTop(y); - region->extents.setWidth(qMax(Pts[0].x(), Pts[2].x()) - x); - region->extents.setHeight(qMax(Pts[0].y(), Pts[2].y()) - y); - if ((region->extents.left() <= region->extents.right()) && - (region->extents.top() <= region->extents.bottom())) { - region->numRects = 1; - region->rects.resize(1); - region->rects[0] = region->extents; - region->innerRect = region->extents; - region->innerArea = region->innerRect.width() * region->innerRect.height(); - } - return region; - } - - if (!(pETEs = static_cast(malloc(sizeof(EdgeTableEntry) * Count)))) - return 0; - - pts = FirstPtBlock.pts; - CreateETandAET(Count, Pts, &ET, &AET, pETEs, &SLLBlock); - pSLL = ET.scanlines.next; - curPtBlock = &FirstPtBlock; - - if (rule == EvenOddRule) { - /* - * for each scanline - */ - for (y = ET.ymin; y < ET.ymax; ++y) { - /* - * Add a new edge to the active edge table when we - * get to the next edge. - */ - if (pSLL && y == pSLL->scanline) { - loadAET(&AET, pSLL->edgelist); - pSLL = pSLL->next; - } - pPrevAET = &AET; - pAET = AET.next; - - /* - * for each active edge - */ - while (pAET) { - pts->setX(pAET->bres.minor_axis); - pts->setY(y); - ++pts; - ++iPts; - - /* - * send out the buffer - */ - if (iPts == NUMPTSTOBUFFER) { - tmpPtBlock = (POINTBLOCK *)malloc(sizeof(POINTBLOCK)); - curPtBlock->next = tmpPtBlock; - curPtBlock = tmpPtBlock; - pts = curPtBlock->pts; - ++numFullPtBlocks; - iPts = 0; - } - EVALUATEEDGEEVENODD(pAET, pPrevAET, y) - } - InsertionSort(&AET); - } - } else { - /* - * for each scanline - */ - for (y = ET.ymin; y < ET.ymax; ++y) { - /* - * Add a new edge to the active edge table when we - * get to the next edge. - */ - if (pSLL && y == pSLL->scanline) { - loadAET(&AET, pSLL->edgelist); - computeWAET(&AET); - pSLL = pSLL->next; - } - pPrevAET = &AET; - pAET = AET.next; - pWETE = pAET; - - /* - * for each active edge - */ - while (pAET) { - /* - * add to the buffer only those edges that - * are in the Winding active edge table. - */ - if (pWETE == pAET) { - pts->setX(pAET->bres.minor_axis); - pts->setY(y); - ++pts; - ++iPts; - - /* - * send out the buffer - */ - if (iPts == NUMPTSTOBUFFER) { - tmpPtBlock = static_cast(malloc(sizeof(POINTBLOCK))); - curPtBlock->next = tmpPtBlock; - curPtBlock = tmpPtBlock; - pts = curPtBlock->pts; - ++numFullPtBlocks; - iPts = 0; - } - pWETE = pWETE->nextWETE; - } - EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) - } - - /* - * recompute the winding active edge table if - * we just resorted or have exited an edge. - */ - if (InsertionSort(&AET) || fixWAET) { - computeWAET(&AET); - fixWAET = false; - } - } - } - FreeStorage(SLLBlock.next); - PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, region); - for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) { - tmpPtBlock = curPtBlock->next; - free(curPtBlock); - curPtBlock = tmpPtBlock; - } - free(pETEs); - return region; -} -// END OF PolyReg.c extract - -QRegionPrivate *qt_bitmapToRegion(const QBitmap& bitmap, QRegionPrivate *region) -{ - region->vector(); - - QImage image = bitmap.toImage(); - - QRect xr; - -#define AddSpan \ - { \ - xr.setCoords(prev1, y, x-1, y); \ - UnionRectWithRegion(&xr, region, *region); \ - } - - const uchar zero = 0; - bool little = image.format() == QImage::Format_MonoLSB; - - int x, - y; - for (y = 0; y < image.height(); ++y) { - uchar *line = image.scanLine(y); - int w = image.width(); - uchar all = zero; - int prev1 = -1; - for (x = 0; x < w;) { - uchar byte = line[x / 8]; - if (x > w - 8 || byte!=all) { - if (little) { - for (int b = 8; b > 0 && x < w; --b) { - if (!(byte & 0x01) == !all) { - // More of the same - } else { - // A change. - if (all!=zero) { - AddSpan - all = zero; - } else { - prev1 = x; - all = ~zero; - } - } - byte >>= 1; - ++x; - } - } else { - for (int b = 8; b > 0 && x < w; --b) { - if (!(byte & 0x80) == !all) { - // More of the same - } else { - // A change. - if (all != zero) { - AddSpan - all = zero; - } else { - prev1 = x; - all = ~zero; - } - } - byte <<= 1; - ++x; - } - } - } else { - x += 8; - } - } - if (all != zero) { - AddSpan - } - } -#undef AddSpan - - return region; -} - -/* - Constructs an empty region. - - \sa isEmpty() -*/ - -QRegion::QRegion() - : d(&shared_empty) -{ - d->ref.ref(); -} - -/* - \overload - - Create a region based on the rectange \a r with region type \a t. - - If the rectangle is invalid a null region will be created. - - \sa QRegion::RegionType -*/ - -QRegion::QRegion(const QRect &r, RegionType t) -{ - if (r.isEmpty()) { - d = &shared_empty; - d->ref.ref(); - } else { -// d = new QRegionData; - QRegionPrivate *rp = 0; - if (t == Rectangle) { -// rp = new QRegionPrivate(r); - rp = qt_allocRegion(r); - } else if (t == Ellipse) { - QPainterPath path; - path.addEllipse(r.x(), r.y(), r.width(), r.height()); - QPolygon a = path.toSubpathPolygons().at(0).toPolygon(); - rp = qt_allocRegion(); -// rp = new QRegionPrivate; - PolygonRegion(a.constData(), a.size(), EvenOddRule, rp); - } - d = rp; - d->ref = 1; -#if defined(Q_WS_X11) - d->rgn = 0; - d->xrectangles = 0; -#elif defined(Q_WS_MAC) - d->rgn = 0; -#endif - d->qt_rgn = rp; - } -} - -/* - Constructs a polygon region from the point array \a a with the fill rule - specified by \a fillRule. - - If \a fillRule is \l{Qt::WindingFill}, the polygon region is defined - using the winding algorithm; if it is \l{Qt::OddEvenFill}, the odd-even fill - algorithm is used. - - \warning This constructor can be used to create complex regions that will - slow down painting when used. -*/ - -QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule) -{ - if (a.count() > 2) { - //d = new QRegionData; - // QRegionPrivate *rp = new QRegionPrivate; - QRegionPrivate *rp = qt_allocRegion(); - PolygonRegion(a.constData(), a.size(), - fillRule == Qt::WindingFill ? WindingRule : EvenOddRule, rp); - d = rp; - d->ref = 1; -#if defined(Q_WS_X11) - d->rgn = 0; - d->xrectangles = 0; -#elif defined(Q_WS_MAC) - d->rgn = 0; -#endif - d->qt_rgn = rp; - } else { - d = &shared_empty; - d->ref.ref(); - } -} - - -/* - Constructs a new region which is equal to region \a r. -*/ - -QRegion::QRegion(const QRegion &r) -{ - d = r.d; - d->ref.ref(); -} - - -/* - Constructs a region from the bitmap \a bm. - - The resulting region consists of the pixels in bitmap \a bm that - are Qt::color1, as if each pixel was a 1 by 1 rectangle. - - This constructor may create complex regions that will slow down - painting when used. Note that drawing masked pixmaps can be done - much faster using QPixmap::setMask(). -*/ -QRegion::QRegion(const QBitmap &bm) -{ - if (bm.isNull()) { - d = &shared_empty; - d->ref.ref(); - } else { - // d = new QRegionData; -// QRegionPrivate *rp = new QRegionPrivate; - QRegionPrivate *rp = qt_allocRegion(); - - qt_bitmapToRegion(bm, rp); - d = rp; - d->ref = 1; -#if defined(Q_WS_X11) - d->rgn = 0; - d->xrectangles = 0; -#elif defined(Q_WS_MAC) - d->rgn = 0; -#endif - d->qt_rgn = rp; - } -} - -void QRegion::cleanUp(QRegion::QRegionData *x) -{ - // delete x->qt_rgn; -#if defined(Q_WS_X11) - if (x->rgn) - XDestroyRegion(x->rgn); - if (x->xrectangles) - free(x->xrectangles); -#elif defined(Q_WS_MAC) - if (x->rgn) - qt_mac_dispose_rgn(x->rgn); -#endif - if(x->qt_rgn) { -// delete x->qt_rgn; - qt_freeRegion(x->qt_rgn); - } else { - delete x; - } -} - -/* - Destroys the region. -*/ - -QRegion::~QRegion() -{ - if (!d->ref.deref()) - cleanUp(d); -} - - -/* - Assigns \a r to this region and returns a reference to the region. -*/ - -QRegion &QRegion::operator=(const QRegion &r) -{ - r.d->ref.ref(); - if (!d->ref.deref()) - cleanUp(d); - d = r.d; - return *this; -} - - -/* - \internal -*/ - -QRegion QRegion::copy() const -{ - QRegion r; - QRegionData *x = 0; // new QRegionData; - QRegionPrivate *rp = 0; - if (d->qt_rgn) -// rp = new QRegionPrivate(*d->qt_rgn); - rp = qt_allocRegion(*d->qt_rgn); - else - rp = qt_allocRegion(); - x = rp; - x->qt_rgn = rp; - x->ref = 1; -#if defined(Q_WS_X11) - x->rgn = 0; - x->xrectangles = 0; -#elif defined(Q_WS_MAC) - x->rgn = 0; -#endif - - if (!r.d->ref.deref()) - cleanUp(r.d); - r.d = x; - return r; -} - -/* - Returns true if the region is empty; otherwise returns false. An - empty region is a region that contains no points. - - Example: - \snippet doc/src/snippets/code/src.gui.painting.qregion_qws.cpp 0 -*/ - -bool QRegion::isEmpty() const -{ - return d == &shared_empty || d->qt_rgn->numRects == 0; -} - - -/* - Returns true if the region contains the point \a p; otherwise - returns false. -*/ - -bool QRegion::contains(const QPoint &p) const -{ - return PointInRegion(d->qt_rgn, p.x(), p.y()); -} - -/* - \overload - - Returns true if the region overlaps the rectangle \a r; otherwise - returns false. -*/ - -bool QRegion::contains(const QRect &r) const -{ - if(!d->qt_rgn) - return false; - if(d->qt_rgn->mode == QRegionPrivate::Single) - return d->qt_rgn->single.contains(r); - - return RectInRegion(d->qt_rgn, r.left(), r.top(), r.width(), r.height()) != RectangleOut; -} - - - -/* - Translates (moves) the region \a dx along the X axis and \a dy - along the Y axis. -*/ - -void QRegion::translate(int dx, int dy) -{ - if ((dx == 0 && dy == 0) || isEmptyHelper(d->qt_rgn)) - return; - - detach(); - OffsetRegion(*d->qt_rgn, dx, dy); -#if defined(Q_WS_X11) - if (d->xrectangles) { - free(d->xrectangles); - d->xrectangles = 0; - } -#elif defined(Q_WS_MAC) - if(d->rgn) { - qt_mac_dispose_rgn(d->rgn); - d->rgn = 0; - } -#endif -} - -/* - \fn QRegion QRegion::unite(const QRegion &r) const - \obsolete - - Use united(\a r) instead. -*/ - -/* - \fn QRegion QRegion::united(const QRegion &r) const - \since 4.2 - - Returns a region which is the union of this region and \a r. - - \img runion.png Region Union - - The figure shows the union of two elliptical regions. - - \sa intersected(), subtracted(), xored() -*/ - -QRegion QRegion::unite(const QRegion &r) const -{ - if (isEmptyHelper(d->qt_rgn)) - return r; - if (isEmptyHelper(r.d->qt_rgn)) - return *this; - - if (d->qt_rgn->contains(*r.d->qt_rgn)) { - return *this; - } else if (r.d->qt_rgn->contains(*d->qt_rgn)) { - return r; - } else if (d->qt_rgn->canAppend(r.d->qt_rgn)) { - QRegion result(*this); - result.detach(); - result.d->qt_rgn->append(r.d->qt_rgn); - return result; - } else if (r.d->qt_rgn->canAppend(d->qt_rgn)) { - QRegion result(r); - result.detach(); - result.d->qt_rgn->append(d->qt_rgn); - return result; - } else if (EqualRegion(d->qt_rgn, r.d->qt_rgn)) { - return *this; - } else { - QRegion result; - result.detach(); - UnionRegion(d->qt_rgn, r.d->qt_rgn, *result.d->qt_rgn); - return result; - } -} - -QRegion& QRegion::operator+=(const QRegion &r) -{ - if (isEmptyHelper(d->qt_rgn)) - return *this = r; - if (isEmptyHelper(r.d->qt_rgn)) - return *this; - - if (d->qt_rgn->contains(*r.d->qt_rgn)) { - return *this; - } else if (r.d->qt_rgn->contains(*d->qt_rgn)) { - return *this = r; - } else if (d->qt_rgn->canAppend(r.d->qt_rgn)) { - detach(); - d->qt_rgn->append(r.d->qt_rgn); - return *this; - } else if (d->qt_rgn->canPrepend(r.d->qt_rgn)) { - detach(); - d->qt_rgn->prepend(r.d->qt_rgn); - return *this; - } else if (EqualRegion(d->qt_rgn, r.d->qt_rgn)) { - return *this; - } - - return *this = unite(r); -} - -/* - \fn QRegion QRegion::intersect(const QRegion &r) const - \obsolete - - Use intersected(\a r) instead. -*/ - -/* - \fn QRegion QRegion::intersected(const QRegion &r) const - \since 4.2 - - Returns a region which is the intersection of this region and \a r. - - \img rintersect.png Region Intersection - - The figure shows the intersection of two elliptical regions. -*/ - -QRegion QRegion::intersect(const QRegion &r) const -{ - if (isEmptyHelper(d->qt_rgn) || isEmptyHelper(r.d->qt_rgn) - || !EXTENTCHECK(&d->qt_rgn->extents, &r.d->qt_rgn->extents)) - return QRegion(); - - /* this is fully contained in r */ - if (r.d->qt_rgn->contains(*d->qt_rgn)) - return *this; - - /* r is fully contained in this */ - if (d->qt_rgn->contains(*r.d->qt_rgn)) - return r; - - if(r.d->qt_rgn->mode == QRegionPrivate::Single && - d->qt_rgn->mode == QRegionPrivate::Single) - return QRegion(r.d->qt_rgn->single.intersected(d->qt_rgn->single)); -#ifdef QT_GREENPHONE_OPT - else if(r.d->qt_rgn->mode == QRegionPrivate::Single) - return intersect(r.d->qt_rgn->single); - else if(d->qt_rgn->mode == QRegionPrivate::Single) - return r.intersect(d->qt_rgn->single); -#endif - - QRegion result; - result.detach(); - miRegionOp(*result.d->qt_rgn, d->qt_rgn, r.d->qt_rgn, miIntersectO, 0, 0); - - /* - * Can't alter dest's extents before we call miRegionOp because - * it might be one of the source regions and miRegionOp depends - * on the extents of those regions being the same. Besides, this - * way there's no checking against rectangles that will be nuked - * due to coalescing, so we have to examine fewer rectangles. - */ - miSetExtents(*result.d->qt_rgn); - return result; -} - -#ifdef QT_GREENPHONE_OPT -/* - \overload - */ -QRegion QRegion::intersect(const QRect &r) const -{ - // No intersection - if(r.isEmpty() || isEmpty() || !EXTENTCHECK(&r, &d->qt_rgn->extents)) - return QRegion(); - - // This is fully contained in r - if(CONTAINSCHECK(r, d->qt_rgn->extents)) - return *this; - - // r is fully contained in this - if(CONTAINSCHECK(d->qt_rgn->innerRect, r)) - return QRegion(r); - - if(d->qt_rgn->mode == QRegionPrivate::Single) { - return QRegion(d->qt_rgn->single & r); - } else { - QRegion rv(*this); - rv.detach(); - - rv.d->qt_rgn->extents &= r; - rv.d->qt_rgn->innerRect &= r; - rv.d->qt_rgn->innerArea = rv.d->qt_rgn->innerRect.height() * - rv.d->qt_rgn->innerRect.width(); - - int numRects = 0; - for(int ii = 0; ii < rv.d->qt_rgn->numRects; ++ii) { - QRect result = rv.d->qt_rgn->rects[ii] & r; - if(!result.isEmpty()) - rv.d->qt_rgn->rects[numRects++] = result; - } - rv.d->qt_rgn->numRects = numRects; - return rv; - } -} - -/* - \overload - */ -const QRegion QRegion::operator&(const QRect &r) const -{ - return intersect(r); -} - -/* - \overload - */ -QRegion& QRegion::operator&=(const QRect &r) -{ - if(isEmpty() || CONTAINSCHECK(r, d->qt_rgn->extents)) { - // Do nothing - } else if(r.isEmpty() || !EXTENTCHECK(&r, &d->qt_rgn->extents)) { - *this = QRegion(); - } else if(CONTAINSCHECK(d->qt_rgn->innerRect, r)) { - *this = QRegion(r); - } else { - detach(); - if(d->qt_rgn->mode == QRegionPrivate::Single) { - QRect result = d->qt_rgn->single & r; - d->qt_rgn->single = result; - d->qt_rgn->extents = result; - d->qt_rgn->innerRect = result; - d->qt_rgn->innerArea = result.height() * result.width(); - } else { - d->qt_rgn->extents &= r; - d->qt_rgn->innerRect &= r; - d->qt_rgn->innerArea = d->qt_rgn->innerRect.height() * - d->qt_rgn->innerRect.width(); - - int numRects = 0; - for(int ii = 0; ii < d->qt_rgn->numRects; ++ii) { - QRect result = d->qt_rgn->rects[ii] & r; - if(!result.isEmpty()) - d->qt_rgn->rects[numRects++] = result; - } - d->qt_rgn->numRects = numRects; - } - } - return *this; -} -#endif - -/* - \fn QRegion QRegion::subtract(const QRegion &r) const - \obsolete - - Use subtracted(\a r) instead. -*/ - -/* - \fn QRegion QRegion::subtracted(const QRegion &r) const - \since 4.2 - - Returns a region which is \a r subtracted from this region. - - \img rsubtract.png Region Subtraction - - The figure shows the result when the ellipse on the right is - subtracted from the ellipse on the left (\c {left - right}). - - \sa intersected(), united(), xored() -*/ - -QRegion QRegion::subtract(const QRegion &r) const -{ - if (isEmptyHelper(d->qt_rgn) || isEmptyHelper(r.d->qt_rgn)) - return *this; - if (r.d->qt_rgn->contains(*d->qt_rgn)) - return QRegion(); - if (!EXTENTCHECK(&d->qt_rgn->extents, &r.d->qt_rgn->extents)) - return *this; - if (EqualRegion(d->qt_rgn, r.d->qt_rgn)) - return QRegion(); - - QRegion result; - result.detach(); - SubtractRegion(d->qt_rgn, r.d->qt_rgn, *result.d->qt_rgn); - return result; -} - -/* - \fn QRegion QRegion::eor(const QRegion &r) const - \obsolete - - Use xored(\a r) instead. -*/ - -/* - \fn QRegion QRegion::xored(const QRegion &r) const - \since 4.2 - - Returns a region which is the exclusive or (XOR) of this region - and \a r. - - \img rxor.png Region XORed - - The figure shows the exclusive or of two elliptical regions. - - \sa intersected(), united(), subtracted() -*/ - -QRegion QRegion::eor(const QRegion &r) const -{ - if (isEmptyHelper(d->qt_rgn)) { - return r; - } else if (isEmptyHelper(r.d->qt_rgn)) { - return *this; - } else if (!EXTENTCHECK(&d->qt_rgn->extents, &r.d->qt_rgn->extents)) { - return (*this + r); - } else if (EqualRegion(d->qt_rgn, r.d->qt_rgn)) { - return QRegion(); - } else { - QRegion result; - result.detach(); - XorRegion(d->qt_rgn, r.d->qt_rgn, *result.d->qt_rgn); - return result; - } -} - -/* - Returns the bounding rectangle of this region. An empty region - gives a rectangle that is QRect::isNull(). -*/ - -QRect QRegion::boundingRect() const -{ - if (isEmpty()) - return QRect(); - return d->qt_rgn->extents; -} - -/* \internal - Returns true if \a rect is guaranteed to be fully contained in \a region. - A false return value does not guarantee the opposite. -*/ -bool qt_region_strictContains(const QRegion ®ion, const QRect &rect) -{ - if (isEmptyHelper(region.d->qt_rgn) || !rect.isValid()) - return false; - -#if 0 // TEST_INNERRECT - static bool guard = false; - if (guard) - return QRect(); - guard = true; - QRegion inner = region.d->qt_rgn->innerRect; - Q_ASSERT((inner - region).isEmpty()); - guard = false; - - int maxArea = 0; - for (int i = 0; i < region.d->qt_rgn->numRects; ++i) { - const QRect r = region.d->qt_rgn->rects.at(i); - if (r.width() * r.height() > maxArea) - maxArea = r.width() * r.height(); - } - - if (maxArea > region.d->qt_rgn->innerArea) { - qDebug() << "not largest rectangle" << region << region.d->qt_rgn->innerRect; - } - Q_ASSERT(maxArea <= region.d->qt_rgn->innerArea); -#endif - - const QRect r1 = region.d->qt_rgn->innerRect; - return (rect.left() >= r1.left() && rect.right() <= r1.right() - && rect.top() >= r1.top() && rect.bottom() <= r1.bottom()); -} - -/* - Returns an array of non-overlapping rectangles that make up the - region. - - The union of all the rectangles is equal to the original region. -*/ -QVector QRegion::rects() const -{ - if (d->qt_rgn) { - d->qt_rgn->vector(); - d->qt_rgn->rects.resize(d->qt_rgn->numRects); - return d->qt_rgn->rects; - } else { - return QVector(); - } -} - -/* - \fn void QRegion::setRects(const QRect *rects, int number) - - Sets the region using the array of rectangles specified by \a rects and - \a number. - The rectangles \e must be optimally Y-X sorted and follow these restrictions: - - \list - \o The rectangles must not intersect. - \o All rectangles with a given top coordinate must have the same height. - \o No two rectangles may abut horizontally (they should be combined - into a single wider rectangle in that case). - \o The rectangles must be sorted in ascending order, with Y as the major - sort key and X as the minor sort key. - \endlist - \omit - Only some platforms have these restrictions (Qt for Embedded Linux, X11 and Mac OS X). - \endomit -*/ -void QRegion::setRects(const QRect *rects, int num) -{ - *this = QRegion(); - if (!rects || num == 0 || (num == 1 && rects->isEmpty())) - return; - - detach(); - - if(num == 1) { - d->qt_rgn->single = *rects; - d->qt_rgn->mode = QRegionPrivate::Single; - d->qt_rgn->numRects = num; - d->qt_rgn->extents = *rects; - d->qt_rgn->innerRect = *rects; - } else { - d->qt_rgn->mode = QRegionPrivate::Vector; - d->qt_rgn->rects.resize(num); - d->qt_rgn->numRects = num; - int left = INT_MAX, - right = INT_MIN, - top = INT_MAX, - bottom = INT_MIN; - for (int i = 0; i < num; ++i) { - const QRect &rect = rects[i]; - d->qt_rgn->rects[i] = rect; - left = qMin(rect.left(), left); - right = qMax(rect.right(), right); - top = qMin(rect.top(), top); - bottom = qMax(rect.bottom(), bottom); - d->qt_rgn->updateInnerRect(rect); - } - d->qt_rgn->extents = QRect(QPoint(left, top), QPoint(right, bottom)); - } -} - -/* - Returns true if the region is equal to \a r; otherwise returns - false. -*/ - -bool QRegion::operator==(const QRegion &r) const -{ - if (!d->qt_rgn || !r.d->qt_rgn) - return r.d->qt_rgn == d->qt_rgn; - - if (d == r.d) - return true; - else - return EqualRegion(d->qt_rgn, r.d->qt_rgn); -} - -#ifdef QT_GREENPHONE_OPT -bool QRegion::isRect() const -{ - return d->qt_rgn && d->qt_rgn->mode == QRegionPrivate::Single; -} -#endif - -QT_END_NAMESPACE diff --git a/src/gui/painting/qtessellator.cpp b/src/gui/painting/qtessellator.cpp deleted file mode 100644 index 94a5128d90d..00000000000 --- a/src/gui/painting/qtessellator.cpp +++ /dev/null @@ -1,1498 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtessellator_p.h" - -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -//#define DEBUG -#ifdef DEBUG -#define QDEBUG qDebug -#else -#define QDEBUG if (1){} else qDebug -#endif - -static const bool emit_clever = true; -static const bool mark_clever = false; - -enum VertexFlags { - LineBeforeStarts = 0x1, - LineBeforeEnds = 0x2, - LineBeforeHorizontal = 0x4, - LineAfterStarts = 0x8, - LineAfterEnds = 0x10, - LineAfterHorizontal = 0x20 -}; - - - -class QTessellatorPrivate { -public: - struct Vertices; - - QTessellatorPrivate() {} - - QRectF collectAndSortVertices(const QPointF *points, int *maxActiveEdges); - void cancelCoincidingEdges(); - - void emitEdges(QTessellator *tessellator); - void processIntersections(); - void removeEdges(); - void addEdges(); - void addIntersections(); - - struct Vertex : public QTessellator::Vertex - { - int flags; - }; - - struct Intersection - { - Q27Dot5 y; - int edge; - bool operator <(const Intersection &other) const { - if (y != other.y) - return y < other.y; - return edge < other.edge; - } - }; - struct IntersectionLink - { - int next; - int prev; - }; - typedef QMap Intersections; - - struct Edge { - Edge(const Vertices &v, int _edge); - int edge; - const Vertex *v0; - const Vertex *v1; - Q27Dot5 y_left; - Q27Dot5 y_right; - signed int winding : 8; - bool mark; - bool free; - bool intersect_left; - bool intersect_right; - bool isLeftOf(const Edge &other, Q27Dot5 y) const; - Q27Dot5 positionAt(Q27Dot5 y) const; - bool intersect(const Edge &other, Q27Dot5 *y, bool *det_positive) const; - - }; - - class EdgeSorter - { - public: - EdgeSorter(int _y) : y(_y) {} - bool operator() (const Edge *e1, const Edge *e2); - int y; - }; - - class Scanline { - public: - Scanline(); - ~Scanline(); - - void init(int maxActiveEdges); - void done(); - - int findEdgePosition(Q27Dot5 x, Q27Dot5 y) const; - int findEdgePosition(const Edge &e) const; - int findEdge(int edge) const; - void clearMarks(); - - void swap(int p1, int p2) { - Edge *tmp = edges[p1]; - edges[p1] = edges[p2]; - edges[p2] = tmp; - } - void insert(int pos, const Edge &e); - void removeAt(int pos); - void markEdges(int pos1, int pos2); - - void prepareLine(); - void lineDone(); - - Edge **old; - int old_size; - - Edge **edges; - int size; - - private: - Edge *edge_table; - int first_unused; - int max_edges; - enum { default_alloc = 32 }; - }; - - struct Vertices { - enum { default_alloc = 128 }; - Vertices(); - ~Vertices(); - void init(int maxVertices); - void done(); - Vertex *storage; - Vertex **sorted; - - Vertex *operator[] (int i) { return storage + i; } - const Vertex *operator[] (int i) const { return storage + i; } - int position(const Vertex *v) const { - return v - storage; - } - Vertex *next(Vertex *v) { - ++v; - if (v == storage + nPoints) - v = storage; - return v; - } - const Vertex *next(const Vertex *v) const { - ++v; - if (v == storage + nPoints) - v = storage; - return v; - } - int nextPos(const Vertex *v) const { - ++v; - if (v == storage + nPoints) - return 0; - return v - storage; - } - Vertex *prev(Vertex *v) { - if (v == storage) - v = storage + nPoints; - --v; - return v; - } - const Vertex *prev(const Vertex *v) const { - if (v == storage) - v = storage + nPoints; - --v; - return v; - } - int prevPos(const Vertex *v) const { - if (v == storage) - v = storage + nPoints; - --v; - return v - storage; - } - int nPoints; - int allocated; - }; - Vertices vertices; - Intersections intersections; - Scanline scanline; - bool winding; - Q27Dot5 y; - int currentVertex; - -private: - void addIntersection(const Edge *e1, const Edge *e2); - bool edgeInChain(Intersection i, int edge); -}; - - -QTessellatorPrivate::Edge::Edge(const QTessellatorPrivate::Vertices &vertices, int edge) -{ - this->edge = edge; - intersect_left = intersect_right = true; - mark = false; - free = false; - - v0 = vertices[edge]; - v1 = vertices.next(v0); - - Q_ASSERT(v0->y != v1->y); - - if (v0->y > v1->y) { - qSwap(v0, v1); - winding = -1; - } else { - winding = 1; - } - y_left = y_right = v0->y; -} - -// This is basically the algorithm from graphics gems. The algorithm -// is cubic in the coordinates at one place. Since we use 64bit -// integers, this implies, that the allowed range for our coordinates -// is limited to 21 bits. With 5 bits behind the decimal, this -// implies that differences in coordaintes can range from 2*SHORT_MIN -// to 2*SHORT_MAX, giving us efficiently a coordinate system from -// SHORT_MIN to SHORT_MAX. -// - -// WARNING: It's absolutely critical that the intersect() and isLeftOf() methods use -// exactly the same algorithm to calulate yi. It's also important to be sure the algorithms -// are transitive (ie. the conditions below are true for all input data): -// -// a.intersect(b) == b.intersect(a) -// a.isLeftOf(b) != b.isLeftOf(a) -// -// This is tricky to get right, so be very careful when changing anything in here! - -static inline bool sameSign(qint64 a, qint64 b) { - return (((qint64) ((quint64) a ^ (quint64) b)) >= 0 ); -} - -bool QTessellatorPrivate::Edge::intersect(const Edge &other, Q27Dot5 *y, bool *det_positive) const -{ - qint64 a1 = v1->y - v0->y; - qint64 b1 = v0->x - v1->x; - - qint64 a2 = other.v1->y - other.v0->y; - qint64 b2 = other.v0->x - other.v1->x; - - qint64 det = a1 * b2 - a2 * b1; - if (det == 0) - return false; - - qint64 c1 = qint64(v1->x) * v0->y - qint64(v0->x) * v1->y; - - qint64 r3 = a1 * other.v0->x + b1 * other.v0->y + c1; - qint64 r4 = a1 * other.v1->x + b1 * other.v1->y + c1; - - // Check signs of r3 and r4. If both point 3 and point 4 lie on - // same side of line 1, the line segments do not intersect. - QDEBUG() << " " << r3 << r4; - if (r3 != 0 && r4 != 0 && sameSign( r3, r4 )) - return false; - - qint64 c2 = qint64(other.v1->x) * other.v0->y - qint64(other.v0->x) * other.v1->y; - - qint64 r1 = a2 * v0->x + b2 * v0->y + c2; - qint64 r2 = a2 * v1->x + b2 * v1->y + c2; - - // Check signs of r1 and r2. If both point 1 and point 2 lie - // on same side of second line segment, the line segments do not intersect. - QDEBUG() << " " << r1 << r2; - if (r1 != 0 && r2 != 0 && sameSign( r1, r2 )) - return false; - - // The det/2 is to get rounding instead of truncating. It - // is added or subtracted to the numerator, depending upon the - // sign of the numerator. - qint64 offset = det < 0 ? -det : det; - offset >>= 1; - - qint64 num = a2 * c1 - a1 * c2; - *y = ( num < 0 ? num - offset : num + offset ) / det; - - *det_positive = (det > 0); - - return true; -} - -#undef SAME_SIGNS - -bool QTessellatorPrivate::Edge::isLeftOf(const Edge &other, Q27Dot5 y) const -{ -// QDEBUG() << "isLeftOf" << edge << other.edge << y; - qint64 a1 = v1->y - v0->y; - qint64 b1 = v0->x - v1->x; - qint64 a2 = other.v1->y - other.v0->y; - qint64 b2 = other.v0->x - other.v1->x; - - qint64 c2 = qint64(other.v1->x) * other.v0->y - qint64(other.v0->x) * other.v1->y; - - qint64 det = a1 * b2 - a2 * b1; - if (det == 0) { - // lines are parallel. Only need to check side of one point - // fixed ordering for coincident edges - qint64 r1 = a2 * v0->x + b2 * v0->y + c2; -// QDEBUG() << "det = 0" << r1; - if (r1 == 0) - return edge < other.edge; - return (r1 < 0); - } - - // not parallel, need to find the y coordinate of the intersection point - qint64 c1 = qint64(v1->x) * v0->y - qint64(v0->x) * v1->y; - - qint64 offset = det < 0 ? -det : det; - offset >>= 1; - - qint64 num = a2 * c1 - a1 * c2; - qint64 yi = ( num < 0 ? num - offset : num + offset ) / det; -// QDEBUG() << " num=" << num << "offset=" << offset << "det=" << det; - - return ((yi > y) ^ (det < 0)); -} - -static inline bool compareVertex(const QTessellatorPrivate::Vertex *p1, - const QTessellatorPrivate::Vertex *p2) -{ - if (p1->y == p2->y) { - if (p1->x == p2->x) - return p1 < p2; - return p1->x < p2->x; - } - return p1->y < p2->y; -} - -Q27Dot5 QTessellatorPrivate::Edge::positionAt(Q27Dot5 y) const -{ - if (y == v0->y) - return v0->x; - else if (y == v1->y) - return v1->x; - - qint64 d = v1->x - v0->x; - return (v0->x + d*(y - v0->y)/(v1->y-v0->y)); -} - -bool QTessellatorPrivate::EdgeSorter::operator() (const Edge *e1, const Edge *e2) -{ - return e1->isLeftOf(*e2, y); -} - - -QTessellatorPrivate::Scanline::Scanline() -{ - edges = 0; - edge_table = 0; - old = 0; -} - -void QTessellatorPrivate::Scanline::init(int maxActiveEdges) -{ - maxActiveEdges *= 2; - if (!edges || maxActiveEdges > default_alloc) { - max_edges = maxActiveEdges; - int s = qMax(maxActiveEdges + 1, default_alloc + 1); - edges = q_check_ptr((Edge **)realloc(edges, s*sizeof(Edge *))); - edge_table = q_check_ptr((Edge *)realloc(edge_table, s*sizeof(Edge))); - old = q_check_ptr((Edge **)realloc(old, s*sizeof(Edge *))); - } - size = 0; - old_size = 0; - first_unused = 0; - for (int i = 0; i < maxActiveEdges; ++i) - edge_table[i].edge = i+1; - edge_table[maxActiveEdges].edge = -1; -} - -void QTessellatorPrivate::Scanline::done() -{ - if (max_edges > default_alloc) { - free(edges); - free(old); - free(edge_table); - edges = 0; - old = 0; - edge_table = 0; - } -} - -QTessellatorPrivate::Scanline::~Scanline() -{ - free(edges); - free(old); - free(edge_table); -} - -int QTessellatorPrivate::Scanline::findEdgePosition(Q27Dot5 x, Q27Dot5 y) const -{ - int min = 0; - int max = size - 1; - while (min < max) { - int pos = min + ((max - min + 1) >> 1); - Q27Dot5 ax = edges[pos]->positionAt(y); - if (ax > x) { - max = pos - 1; - } else { - min = pos; - } - } - return min; -} - -int QTessellatorPrivate::Scanline::findEdgePosition(const Edge &e) const -{ -// qDebug() << ">> findEdgePosition"; - int min = 0; - int max = size; - while (min < max) { - int pos = min + ((max - min) >> 1); -// qDebug() << " " << min << max << pos << edges[pos]->isLeftOf(e, e.y0); - if (edges[pos]->isLeftOf(e, e.v0->y)) { - min = pos + 1; - } else { - max = pos; - } - } -// qDebug() << "<< findEdgePosition got" << min; - return min; -} - -int QTessellatorPrivate::Scanline::findEdge(int edge) const -{ - for (int i = 0; i < size; ++i) { - int item_edge = edges[i]->edge; - if (item_edge == edge) - return i; - } - //Q_ASSERT(false); - return -1; -} - -void QTessellatorPrivate::Scanline::clearMarks() -{ - for (int i = 0; i < size; ++i) { - edges[i]->mark = false; - edges[i]->intersect_left = false; - edges[i]->intersect_right = false; - } -} - -void QTessellatorPrivate::Scanline::prepareLine() -{ - Edge **end = edges + size; - Edge **e = edges; - Edge **o = old; - while (e < end) { - *o = *e; - ++o; - ++e; - } - old_size = size; -} - -void QTessellatorPrivate::Scanline::lineDone() -{ - Edge **end = old + old_size; - Edge **e = old; - while (e < end) { - if ((*e)->free) { - (*e)->edge = first_unused; - first_unused = (*e - edge_table); - } - ++e; - } -} - -void QTessellatorPrivate::Scanline::insert(int pos, const Edge &e) -{ - Edge *edge = edge_table + first_unused; - first_unused = edge->edge; - Q_ASSERT(first_unused != -1); - *edge = e; - memmove(edges + pos + 1, edges + pos, (size - pos)*sizeof(Edge *)); - edges[pos] = edge; - ++size; -} - -void QTessellatorPrivate::Scanline::removeAt(int pos) -{ - Edge *e = edges[pos]; - e->free = true; - --size; - memmove(edges + pos, edges + pos + 1, (size - pos)*sizeof(Edge *)); -} - -void QTessellatorPrivate::Scanline::markEdges(int pos1, int pos2) -{ - if (pos2 < pos1) - return; - - for (int i = pos1; i <= pos2; ++i) - edges[i]->mark = true; -} - - -QTessellatorPrivate::Vertices::Vertices() -{ - storage = 0; - sorted = 0; - allocated = 0; - nPoints = 0; -} - -QTessellatorPrivate::Vertices::~Vertices() -{ - if (storage) { - free(storage); - free(sorted); - } -} - -void QTessellatorPrivate::Vertices::init(int maxVertices) -{ - if (!storage || maxVertices > allocated) { - int size = qMax((int)default_alloc, maxVertices); - storage = q_check_ptr((Vertex *)realloc(storage, size*sizeof(Vertex))); - sorted = q_check_ptr((Vertex **)realloc(sorted, size*sizeof(Vertex *))); - allocated = maxVertices; - } -} - -void QTessellatorPrivate::Vertices::done() -{ - if (allocated > default_alloc) { - free(storage); - free(sorted); - storage = 0; - sorted = 0; - allocated = 0; - } -} - - - -static inline void fillTrapezoid(Q27Dot5 y1, Q27Dot5 y2, int left, int right, - const QTessellatorPrivate::Vertices &vertices, - QTessellator::Trapezoid *trap) -{ - trap->top = y1; - trap->bottom = y2; - const QTessellatorPrivate::Vertex *v = vertices[left]; - trap->topLeft = v; - trap->bottomLeft = vertices.next(v); - if (trap->topLeft->y > trap->bottomLeft->y) - qSwap(trap->topLeft,trap->bottomLeft); - v = vertices[right]; - trap->topRight = v; - trap->bottomRight = vertices.next(v); - if (trap->topRight->y > trap->bottomRight->y) - qSwap(trap->topRight, trap->bottomRight); -} - -QRectF QTessellatorPrivate::collectAndSortVertices(const QPointF *points, int *maxActiveEdges) -{ - *maxActiveEdges = 0; - Vertex *v = vertices.storage; - Vertex **vv = vertices.sorted; - - qreal xmin(points[0].x()); - qreal xmax(points[0].x()); - qreal ymin(points[0].y()); - qreal ymax(points[0].y()); - - // collect vertex data - Q27Dot5 y_prev = FloatToQ27Dot5(points[vertices.nPoints-1].y()); - Q27Dot5 x_next = FloatToQ27Dot5(points[0].x()); - Q27Dot5 y_next = FloatToQ27Dot5(points[0].y()); - int j = 0; - int i = 0; - while (i < vertices.nPoints) { - Q27Dot5 y_curr = y_next; - - *vv = v; - - v->x = x_next; - v->y = y_next; - v->flags = 0; - - next_point: - - xmin = qMin(xmin, points[i+1].x()); - xmax = qMax(xmax, points[i+1].x()); - ymin = qMin(ymin, points[i+1].y()); - ymax = qMax(ymax, points[i+1].y()); - - y_next = FloatToQ27Dot5(points[i+1].y()); - x_next = FloatToQ27Dot5(points[i+1].x()); - - // skip vertices on top of each other - if (v->x == x_next && v->y == y_next) { - ++i; - if (i < vertices.nPoints) - goto next_point; - Vertex *v0 = vertices.storage; - v0->flags &= ~(LineBeforeStarts|LineBeforeEnds|LineBeforeHorizontal); - if (y_prev < y_curr) - v0->flags |= LineBeforeEnds; - else if (y_prev > y_curr) - v0->flags |= LineBeforeStarts; - else - v0->flags |= LineBeforeHorizontal; - if ((v0->flags & (LineBeforeStarts|LineAfterStarts)) - && !(v0->flags & (LineAfterEnds|LineBeforeEnds))) - *maxActiveEdges += 2; - break; - } - - if (y_prev < y_curr) - v->flags |= LineBeforeEnds; - else if (y_prev > y_curr) - v->flags |= LineBeforeStarts; - else - v->flags |= LineBeforeHorizontal; - - - if (y_curr < y_next) - v->flags |= LineAfterStarts; - else if (y_curr > y_next) - v->flags |= LineAfterEnds; - else - v->flags |= LineAfterHorizontal; - // ### could probably get better limit by looping over sorted list and counting down on ending edges - if ((v->flags & (LineBeforeStarts|LineAfterStarts)) - && !(v->flags & (LineAfterEnds|LineBeforeEnds))) - *maxActiveEdges += 2; - y_prev = y_curr; - ++v; - ++vv; - ++j; - ++i; - } - vertices.nPoints = j; - - QDEBUG() << "maxActiveEdges=" << *maxActiveEdges; - vv = vertices.sorted; - qSort(vv, vv + vertices.nPoints, compareVertex); - - return QRectF(xmin, ymin, xmax-xmin, ymax-ymin); -} - -struct QCoincidingEdge { - QTessellatorPrivate::Vertex *start; - QTessellatorPrivate::Vertex *end; - bool used; - bool before; - - inline bool operator<(const QCoincidingEdge &e2) const - { - return end->y == e2.end->y ? end->x < e2.end->x : end->y < e2.end->y; - } -}; - -static void cancelEdges(QCoincidingEdge &e1, QCoincidingEdge &e2) -{ - if (e1.before) { - e1.start->flags &= ~(LineBeforeStarts|LineBeforeHorizontal); - e1.end->flags &= ~(LineAfterEnds|LineAfterHorizontal); - } else { - e1.start->flags &= ~(LineAfterStarts|LineAfterHorizontal); - e1.end->flags &= ~(LineBeforeEnds|LineBeforeHorizontal); - } - if (e2.before) { - e2.start->flags &= ~(LineBeforeStarts|LineBeforeHorizontal); - e2.end->flags &= ~(LineAfterEnds|LineAfterHorizontal); - } else { - e2.start->flags &= ~(LineAfterStarts|LineAfterHorizontal); - e2.end->flags &= ~(LineBeforeEnds|LineBeforeHorizontal); - } - e1.used = e2.used = true; -} - -void QTessellatorPrivate::cancelCoincidingEdges() -{ - Vertex **vv = vertices.sorted; - - QCoincidingEdge *tl = 0; - int tlSize = 0; - - for (int i = 0; i < vertices.nPoints - 1; ++i) { - Vertex *v = vv[i]; - int testListSize = 0; - while (i < vertices.nPoints - 1) { - Vertex *n = vv[i]; - if (v->x != n->x || v->y != n->y) - break; - - if (testListSize > tlSize - 2) { - tlSize = qMax(tlSize*2, 16); - tl = q_check_ptr((QCoincidingEdge *)realloc(tl, tlSize*sizeof(QCoincidingEdge))); - } - if (n->flags & (LineBeforeStarts|LineBeforeHorizontal)) { - tl[testListSize].start = n; - tl[testListSize].end = vertices.prev(n); - tl[testListSize].used = false; - tl[testListSize].before = true; - ++testListSize; - } - if (n->flags & (LineAfterStarts|LineAfterHorizontal)) { - tl[testListSize].start = n; - tl[testListSize].end = vertices.next(n); - tl[testListSize].used = false; - tl[testListSize].before = false; - ++testListSize; - } - ++i; - } - if (!testListSize) - continue; - - qSort(tl, tl + testListSize); - - for (int j = 0; j < testListSize; ++j) { - if (tl[j].used) - continue; - - for (int k = j + 1; k < testListSize; ++k) { - if (tl[j].end->x != tl[k].end->x - || tl[j].end->y != tl[k].end->y - || tl[k].used) - break; - - if (!winding || tl[j].before != tl[k].before) { - cancelEdges(tl[j], tl[k]); - break; - } - ++k; - } - ++j; - } - } - free(tl); -} - - -void QTessellatorPrivate::emitEdges(QTessellator *tessellator) -{ - //QDEBUG() << "TRAPS:"; - if (!scanline.old_size) - return; - - // emit edges - if (winding) { - // winding fill rule - int w = 0; - - scanline.old[0]->y_left = y; - - for (int i = 0; i < scanline.old_size - 1; ++i) { - Edge *left = scanline.old[i]; - Edge *right = scanline.old[i+1]; - w += left->winding; -// qDebug() << "i=" << i << "edge->winding=" << left->winding << "winding=" << winding; - if (w == 0) { - left->y_right = y; - right->y_left = y; - } else if (!emit_clever || left->mark || right->mark) { - Q27Dot5 top = qMax(left->y_right, right->y_left); - if (top != y) { - QTessellator::Trapezoid trap; - fillTrapezoid(top, y, left->edge, right->edge, vertices, &trap); - tessellator->addTrap(trap); -// QDEBUG() << " top=" << Q27Dot5ToDouble(top) << "left=" << left->edge << "right=" << right->edge; - } - right->y_left = y; - left->y_right = y; - } - left->mark = false; - } - if (scanline.old[scanline.old_size - 1]->mark) { - scanline.old[scanline.old_size - 1]->y_right = y; - scanline.old[scanline.old_size - 1]->mark = false; - } - } else { - // odd-even fill rule - for (int i = 0; i < scanline.old_size; i += 2) { - Edge *left = scanline.old[i]; - Edge *right = scanline.old[i+1]; - if (!emit_clever || left->mark || right->mark) { - Q27Dot5 top = qMax(left->y_right, right->y_left); - if (top != y) { - QTessellator::Trapezoid trap; - fillTrapezoid(top, y, left->edge, right->edge, vertices, &trap); - tessellator->addTrap(trap); - } -// QDEBUG() << " top=" << Q27Dot5ToDouble(top) << "left=" << left->edge << "right=" << right->edge; - left->y_left = y; - left->y_right = y; - right->y_left = y; - right->y_right = y; - left->mark = right->mark = false; - } - } - } -} - - -void QTessellatorPrivate::processIntersections() -{ - QDEBUG() << "PROCESS INTERSECTIONS"; - // process intersections - while (!intersections.isEmpty()) { - Intersections::iterator it = intersections.begin(); - if (it.key().y != y) - break; - - // swap edges - QDEBUG() << " swapping intersecting edges "; - int min = scanline.size; - int max = 0; - Q27Dot5 xmin = INT_MAX; - Q27Dot5 xmax = INT_MIN; - int num = 0; - while (1) { - const Intersection &i = it.key(); - int next = it->next; - - int edgePos = scanline.findEdge(i.edge); - if (edgePos >= 0) { - ++num; - min = qMin(edgePos, min); - max = qMax(edgePos, max); - Edge *edge = scanline.edges[edgePos]; - xmin = qMin(xmin, edge->positionAt(y)); - xmax = qMax(xmax, edge->positionAt(y)); - } - Intersection key; - key.y = y; - key.edge = next; - it = intersections.find(key); - intersections.remove(i); - if (it == intersections.end()) - break; - } - if (num < 2) - continue; - - Q_ASSERT(min != max); - QDEBUG() << "sorting between" << min << "and" << max << "xpos=" << xmin << xmax; - while (min > 0 && scanline.edges[min - 1]->positionAt(y) >= xmin) { - QDEBUG() << " adding edge on left"; - --min; - } - while (max + 1 < scanline.size && scanline.edges[max + 1]->positionAt(y) <= xmax) { - QDEBUG() << " adding edge on right"; - ++max; - } - - qSort(scanline.edges + min, scanline.edges + max + 1, EdgeSorter(y)); -#ifdef DEBUG - for (int i = min; i <= max; ++i) - QDEBUG() << " " << scanline.edges[i]->edge << "at pos" << i; -#endif - for (int i = min; i <= max; ++i) { - Edge *edge = scanline.edges[i]; - edge->intersect_left = true; - edge->intersect_right = true; - edge->mark = true; - } - } -} - -void QTessellatorPrivate::removeEdges() -{ - int cv = currentVertex; - while (cv < vertices.nPoints) { - const Vertex *v = vertices.sorted[cv]; - if (v->y > y) - break; - if (v->flags & LineBeforeEnds) { - QDEBUG() << " removing edge" << vertices.prevPos(v); - int pos = scanline.findEdge(vertices.prevPos(v)); - if (pos == -1) - continue; - scanline.edges[pos]->mark = true; - if (pos > 0) - scanline.edges[pos - 1]->intersect_right = true; - if (pos < scanline.size - 1) - scanline.edges[pos + 1]->intersect_left = true; - scanline.removeAt(pos); - } - if (v->flags & LineAfterEnds) { - QDEBUG() << " removing edge" << vertices.position(v); - int pos = scanline.findEdge(vertices.position(v)); - if (pos == -1) - continue; - scanline.edges[pos]->mark = true; - if (pos > 0) - scanline.edges[pos - 1]->intersect_right = true; - if (pos < scanline.size - 1) - scanline.edges[pos + 1]->intersect_left = true; - scanline.removeAt(pos); - } - ++cv; - } -} - -void QTessellatorPrivate::addEdges() -{ - while (currentVertex < vertices.nPoints) { - const Vertex *v = vertices.sorted[currentVertex]; - if (v->y > y) - break; - if (v->flags & LineBeforeStarts) { - // add new edge - int start = vertices.prevPos(v); - Edge e(vertices, start); - int pos = scanline.findEdgePosition(e); - QDEBUG() << " adding edge" << start << "at position" << pos; - scanline.insert(pos, e); - if (!mark_clever || !(v->flags & LineAfterEnds)) { - if (pos > 0) - scanline.edges[pos - 1]->mark = true; - if (pos < scanline.size - 1) - scanline.edges[pos + 1]->mark = true; - } - } - if (v->flags & LineAfterStarts) { - Edge e(vertices, vertices.position(v)); - int pos = scanline.findEdgePosition(e); - QDEBUG() << " adding edge" << vertices.position(v) << "at position" << pos; - scanline.insert(pos, e); - if (!mark_clever || !(v->flags & LineBeforeEnds)) { - if (pos > 0) - scanline.edges[pos - 1]->mark = true; - if (pos < scanline.size - 1) - scanline.edges[pos + 1]->mark = true; - } - } - if (v->flags & LineAfterHorizontal) { - int pos1 = scanline.findEdgePosition(v->x, v->y); - const Vertex *next = vertices.next(v); - Q_ASSERT(v->y == next->y); - int pos2 = scanline.findEdgePosition(next->x, next->y); - if (pos2 < pos1) - qSwap(pos1, pos2); - if (pos1 > 0) - --pos1; - if (pos2 == scanline.size) - --pos2; - //QDEBUG() << "marking horizontal edge from " << pos1 << "to" << pos2; - scanline.markEdges(pos1, pos2); - } - ++currentVertex; - } -} - -#ifdef DEBUG -static void checkLinkChain(const QTessellatorPrivate::Intersections &intersections, - QTessellatorPrivate::Intersection i) -{ -// qDebug() << " Link chain: "; - int end = i.edge; - while (1) { - QTessellatorPrivate::IntersectionLink l = intersections.value(i); -// qDebug() << " " << i.edge << "next=" << l.next << "prev=" << l.prev; - if (l.next == end) - break; - Q_ASSERT(l.next != -1); - Q_ASSERT(l.prev != -1); - - QTessellatorPrivate::Intersection i2 = i; - i2.edge = l.next; - QTessellatorPrivate::IntersectionLink l2 = intersections.value(i2); - - Q_ASSERT(l2.next != -1); - Q_ASSERT(l2.prev != -1); - Q_ASSERT(l.next == i2.edge); - Q_ASSERT(l2.prev == i.edge); - i = i2; - } -} -#endif - -bool QTessellatorPrivate::edgeInChain(Intersection i, int edge) -{ - int end = i.edge; - while (1) { - if (i.edge == edge) - return true; - IntersectionLink l = intersections.value(i); - if (l.next == end) - break; - Q_ASSERT(l.next != -1); - Q_ASSERT(l.prev != -1); - - Intersection i2 = i; - i2.edge = l.next; - -#ifndef QT_NO_DEBUG - IntersectionLink l2 = intersections.value(i2); - Q_ASSERT(l2.next != -1); - Q_ASSERT(l2.prev != -1); - Q_ASSERT(l.next == i2.edge); - Q_ASSERT(l2.prev == i.edge); -#endif - i = i2; - } - return false; -} - - -void QTessellatorPrivate::addIntersection(const Edge *e1, const Edge *e2) -{ - const IntersectionLink emptyLink = {-1, -1}; - - int next = vertices.nextPos(vertices[e1->edge]); - if (e2->edge == next) - return; - int prev = vertices.prevPos(vertices[e1->edge]); - if (e2->edge == prev) - return; - - Q27Dot5 yi; - bool det_positive; - bool isect = e1->intersect(*e2, &yi, &det_positive); - QDEBUG("checking edges %d and %d", e1->edge, e2->edge); - if (!isect) { - QDEBUG() << " no intersection"; - return; - } - - // don't emit an intersection if it's at the start of a line segment or above us - if (yi <= y) { - if (!det_positive) - return; - QDEBUG() << " ----->>>>>> WRONG ORDER!"; - yi = y; - } - QDEBUG() << " between edges " << e1->edge << "and" << e2->edge << "at point (" - << Q27Dot5ToDouble(yi) << ')'; - - Intersection i1; - i1.y = yi; - i1.edge = e1->edge; - IntersectionLink link1 = intersections.value(i1, emptyLink); - Intersection i2; - i2.y = yi; - i2.edge = e2->edge; - IntersectionLink link2 = intersections.value(i2, emptyLink); - - // new pair of edges - if (link1.next == -1 && link2.next == -1) { - link1.next = link1.prev = i2.edge; - link2.next = link2.prev = i1.edge; - } else if (link1.next == i2.edge || link1.prev == i2.edge - || link2.next == i1.edge || link2.prev == i1.edge) { -#ifdef DEBUG - checkLinkChain(intersections, i1); - checkLinkChain(intersections, i2); - Q_ASSERT(edgeInChain(i1, i2.edge)); -#endif - return; - } else if (link1.next == -1 || link2.next == -1) { - if (link2.next == -1) { - qSwap(i1, i2); - qSwap(link1, link2); - } - Q_ASSERT(link1.next == -1); -#ifdef DEBUG - checkLinkChain(intersections, i2); -#endif - // only i2 in list - link1.next = i2.edge; - link1.prev = link2.prev; - link2.prev = i1.edge; - Intersection other; - other.y = yi; - other.edge = link1.prev; - IntersectionLink link = intersections.value(other, emptyLink); - Q_ASSERT(link.next == i2.edge); - Q_ASSERT(link.prev != -1); - link.next = i1.edge; - intersections.insert(other, link); - } else { - bool connected = edgeInChain(i1, i2.edge); - if (connected) - return; -#ifdef DEBUG - checkLinkChain(intersections, i1); - checkLinkChain(intersections, i2); -#endif - // both already in some list. Have to make sure they are connected - // this can be done by cutting open the ring(s) after the two eges and - // connecting them again - Intersection other1; - other1.y = yi; - other1.edge = link1.next; - IntersectionLink linko1 = intersections.value(other1, emptyLink); - Intersection other2; - other2.y = yi; - other2.edge = link2.next; - IntersectionLink linko2 = intersections.value(other2, emptyLink); - - linko1.prev = i2.edge; - link2.next = other1.edge; - - linko2.prev = i1.edge; - link1.next = other2.edge; - intersections.insert(other1, linko1); - intersections.insert(other2, linko2); - } - intersections.insert(i1, link1); - intersections.insert(i2, link2); -#ifdef DEBUG - checkLinkChain(intersections, i1); - checkLinkChain(intersections, i2); - Q_ASSERT(edgeInChain(i1, i2.edge)); -#endif - return; - -} - - -void QTessellatorPrivate::addIntersections() -{ - if (scanline.size) { - QDEBUG() << "INTERSECTIONS"; - // check marked edges for intersections -#ifdef DEBUG - for (int i = 0; i < scanline.size; ++i) { - Edge *e = scanline.edges[i]; - QDEBUG() << " " << i << e->edge << "isect=(" << e->intersect_left << e->intersect_right - << ')'; - } -#endif - - for (int i = 0; i < scanline.size - 1; ++i) { - Edge *e1 = scanline.edges[i]; - Edge *e2 = scanline.edges[i + 1]; - // check for intersection - if (e1->intersect_right || e2->intersect_left) - addIntersection(e1, e2); - } - } -#if 0 - if (intersections.constBegin().key().y == y) { - QDEBUG() << "----------------> intersection on same line"; - scanline.clearMarks(); - scanline.processIntersections(y, &intersections); - goto redo; - } -#endif -} - - -QTessellator::QTessellator() -{ - d = new QTessellatorPrivate; -} - -QTessellator::~QTessellator() -{ - delete d; -} - -void QTessellator::setWinding(bool w) -{ - d->winding = w; -} - - -QRectF QTessellator::tessellate(const QPointF *points, int nPoints) -{ - Q_ASSERT(points[0] == points[nPoints-1]); - --nPoints; - -#ifdef DEBUG - QDEBUG()<< "POINTS:"; - for (int i = 0; i < nPoints; ++i) { - QDEBUG() << points[i]; - } -#endif - - // collect edges and calculate bounds - d->vertices.nPoints = nPoints; - d->vertices.init(nPoints); - - int maxActiveEdges = 0; - QRectF br = d->collectAndSortVertices(points, &maxActiveEdges); - d->cancelCoincidingEdges(); - -#ifdef DEBUG - QDEBUG() << "nPoints = " << nPoints << "using " << d->vertices.nPoints; - QDEBUG()<< "VERTICES:"; - for (int i = 0; i < d->vertices.nPoints; ++i) { - QDEBUG() << " " << i << ": " - << "point=" << d->vertices.position(d->vertices.sorted[i]) - << "flags=" << d->vertices.sorted[i]->flags - << "pos=(" << Q27Dot5ToDouble(d->vertices.sorted[i]->x) << '/' - << Q27Dot5ToDouble(d->vertices.sorted[i]->y) << ')'; - } -#endif - - d->scanline.init(maxActiveEdges); - d->y = INT_MIN/256; - d->currentVertex = 0; - - while (d->currentVertex < d->vertices.nPoints) { - d->scanline.clearMarks(); - - d->y = d->vertices.sorted[d->currentVertex]->y; - if (!d->intersections.isEmpty()) - d->y = qMin(d->y, d->intersections.constBegin().key().y); - - QDEBUG()<< "===== SCANLINE: y =" << Q27Dot5ToDouble(d->y) << " ====="; - - d->scanline.prepareLine(); - d->processIntersections(); - d->removeEdges(); - d->addEdges(); - d->addIntersections(); - d->emitEdges(this); - d->scanline.lineDone(); - -#ifdef DEBUG - QDEBUG()<< "===== edges:"; - for (int i = 0; i < d->scanline.size; ++i) { - QDEBUG() << " " << d->scanline.edges[i]->edge - << "p0= (" << Q27Dot5ToDouble(d->scanline.edges[i]->v0->x) - << '/' << Q27Dot5ToDouble(d->scanline.edges[i]->v0->y) - << ") p1= (" << Q27Dot5ToDouble(d->scanline.edges[i]->v1->x) - << '/' << Q27Dot5ToDouble(d->scanline.edges[i]->v1->y) << ')' - << "x=" << Q27Dot5ToDouble(d->scanline.edges[i]->positionAt(d->y)) - << "isLeftOfNext=" - << ((i < d->scanline.size - 1) - ? d->scanline.edges[i]->isLeftOf(*d->scanline.edges[i+1], d->y) - : true); - } -#endif -} - - d->scanline.done(); - d->intersections.clear(); - return br; -} - -// tessellates the given convex polygon -void QTessellator::tessellateConvex(const QPointF *points, int nPoints) -{ - Q_ASSERT(points[0] == points[nPoints-1]); - --nPoints; - - d->vertices.nPoints = nPoints; - d->vertices.init(nPoints); - - for (int i = 0; i < nPoints; ++i) { - d->vertices[i]->x = FloatToQ27Dot5(points[i].x()); - d->vertices[i]->y = FloatToQ27Dot5(points[i].y()); - } - - int left = 0, right = 0; - - int top = 0; - for (int i = 1; i < nPoints; ++i) { - if (d->vertices[i]->y < d->vertices[top]->y) - top = i; - } - - left = (top + nPoints - 1) % nPoints; - right = (top + 1) % nPoints; - - while (d->vertices[left]->x == d->vertices[top]->x && d->vertices[left]->y == d->vertices[top]->y && left != right) - left = (left + nPoints - 1) % nPoints; - - while (d->vertices[right]->x == d->vertices[top]->x && d->vertices[right]->y == d->vertices[top]->y && left != right) - right = (right + 1) % nPoints; - - if (left == right) - return; - - int dir = 1; - - Vertex dLeft = { d->vertices[top]->x - d->vertices[left]->x, - d->vertices[top]->y - d->vertices[left]->y }; - - Vertex dRight = { d->vertices[right]->x - d->vertices[top]->x, - d->vertices[right]->y - d->vertices[top]->y }; - - Q27Dot5 cross = dLeft.x * dRight.y - dLeft.y * dRight.x; - - // flip direction if polygon is clockwise - if (cross < 0 || (cross == 0 && dLeft.x > 0)) { - qSwap(left, right); - dir = -1; - } - - Vertex *lastLeft = d->vertices[top]; - Vertex *lastRight = d->vertices[top]; - - QTessellator::Trapezoid trap; - - while (lastLeft->y == d->vertices[left]->y && left != right) { - lastLeft = d->vertices[left]; - left = (left + nPoints - dir) % nPoints; - } - - while (lastRight->y == d->vertices[right]->y && left != right) { - lastRight = d->vertices[right]; - right = (right + nPoints + dir) % nPoints; - } - - while (true) { - trap.top = qMax(lastRight->y, lastLeft->y); - trap.bottom = qMin(d->vertices[left]->y, d->vertices[right]->y); - trap.topLeft = lastLeft; - trap.topRight = lastRight; - trap.bottomLeft = d->vertices[left]; - trap.bottomRight = d->vertices[right]; - - if (trap.bottom > trap.top) - addTrap(trap); - - if (left == right) - break; - - if (d->vertices[right]->y < d->vertices[left]->y) { - do { - lastRight = d->vertices[right]; - right = (right + nPoints + dir) % nPoints; - } - while (lastRight->y == d->vertices[right]->y && left != right); - } else { - do { - lastLeft = d->vertices[left]; - left = (left + nPoints - dir) % nPoints; - } - while (lastLeft->y == d->vertices[left]->y && left != right); - } - } -} - -// tessellates the stroke of the line from a_ to b_ with the given width and a flat cap -void QTessellator::tessellateRect(const QPointF &a_, const QPointF &b_, qreal width) -{ - Vertex a = { FloatToQ27Dot5(a_.x()), FloatToQ27Dot5(a_.y()) }; - Vertex b = { FloatToQ27Dot5(b_.x()), FloatToQ27Dot5(b_.y()) }; - - QPointF pa = a_, pb = b_; - - if (a.y > b.y) { - qSwap(a, b); - qSwap(pa, pb); - } - - Vertex delta = { b.x - a.x, b.y - a.y }; - - if (delta.x == 0 && delta.y == 0) - return; - - qreal hw = 0.5 * width; - - if (delta.x == 0) { - Q27Dot5 halfWidth = FloatToQ27Dot5(hw); - - if (halfWidth == 0) - return; - - Vertex topLeft = { a.x - halfWidth, a.y }; - Vertex topRight = { a.x + halfWidth, a.y }; - Vertex bottomLeft = { a.x - halfWidth, b.y }; - Vertex bottomRight = { a.x + halfWidth, b.y }; - - QTessellator::Trapezoid trap = { topLeft.y, bottomLeft.y, &topLeft, &bottomLeft, &topRight, &bottomRight }; - addTrap(trap); - } else if (delta.y == 0) { - Q27Dot5 halfWidth = FloatToQ27Dot5(hw); - - if (halfWidth == 0) - return; - - if (a.x > b.x) - qSwap(a.x, b.x); - - Vertex topLeft = { a.x, a.y - halfWidth }; - Vertex topRight = { b.x, a.y - halfWidth }; - Vertex bottomLeft = { a.x, a.y + halfWidth }; - Vertex bottomRight = { b.x, a.y + halfWidth }; - - QTessellator::Trapezoid trap = { topLeft.y, bottomLeft.y, &topLeft, &bottomLeft, &topRight, &bottomRight }; - addTrap(trap); - } else { - QPointF perp(pb.y() - pa.y(), pa.x() - pb.x()); - qreal length = qSqrt(perp.x() * perp.x() + perp.y() * perp.y()); - - if (qFuzzyIsNull(length)) - return; - - // need the half of the width - perp *= hw / length; - - QPointF pta = pa + perp; - QPointF ptb = pa - perp; - QPointF ptc = pb - perp; - QPointF ptd = pb + perp; - - Vertex ta = { FloatToQ27Dot5(pta.x()), FloatToQ27Dot5(pta.y()) }; - Vertex tb = { FloatToQ27Dot5(ptb.x()), FloatToQ27Dot5(ptb.y()) }; - Vertex tc = { FloatToQ27Dot5(ptc.x()), FloatToQ27Dot5(ptc.y()) }; - Vertex td = { FloatToQ27Dot5(ptd.x()), FloatToQ27Dot5(ptd.y()) }; - - if (ta.y < tb.y) { - if (tb.y < td.y) { - QTessellator::Trapezoid top = { ta.y, tb.y, &ta, &tb, &ta, &td }; - QTessellator::Trapezoid bottom = { td.y, tc.y, &tb, &tc, &td, &tc }; - addTrap(top); - addTrap(bottom); - - QTessellator::Trapezoid middle = { tb.y, td.y, &tb, &tc, &ta, &td }; - addTrap(middle); - } else { - QTessellator::Trapezoid top = { ta.y, td.y, &ta, &tb, &ta, &td }; - QTessellator::Trapezoid bottom = { tb.y, tc.y, &tb, &tc, &td, &tc }; - addTrap(top); - addTrap(bottom); - - if (tb.y != td.y) { - QTessellator::Trapezoid middle = { td.y, tb.y, &ta, &tb, &td, &tc }; - addTrap(middle); - } - } - } else { - if (ta.y < tc.y) { - QTessellator::Trapezoid top = { tb.y, ta.y, &tb, &tc, &tb, &ta }; - QTessellator::Trapezoid bottom = { tc.y, td.y, &tc, &td, &ta, &td }; - addTrap(top); - addTrap(bottom); - - QTessellator::Trapezoid middle = { ta.y, tc.y, &tb, &tc, &ta, &td }; - addTrap(middle); - } else { - QTessellator::Trapezoid top = { tb.y, tc.y, &tb, &tc, &tb, &ta }; - QTessellator::Trapezoid bottom = { ta.y, td.y, &tc, &td, &ta, &td }; - addTrap(top); - addTrap(bottom); - - if (ta.y != tc.y) { - QTessellator::Trapezoid middle = { tc.y, ta.y, &tc, &td, &tb, &ta }; - addTrap(middle); - } - } - } - } -} - -QT_END_NAMESPACE diff --git a/src/gui/painting/qtessellator_p.h b/src/gui/painting/qtessellator_p.h deleted file mode 100644 index 9f598b6b2e3..00000000000 --- a/src/gui/painting/qtessellator_p.h +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESSELATOR_P_H -#define QTESSELATOR_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 -#include - -QT_BEGIN_NAMESPACE - -class QTessellatorPrivate; - -typedef int Q27Dot5; -#define Q27Dot5ToDouble(i) ((i)/32.) -#define FloatToQ27Dot5(i) (int)((i) * 32) -#define IntToQ27Dot5(i) ((i) << 5) -#define Q27Dot5ToXFixed(i) ((i) << 11) -#define Q27Dot5Factor 32 - -class Q_GUI_EXPORT QTessellator { -public: - QTessellator(); - virtual ~QTessellator(); - - QRectF tessellate(const QPointF *points, int nPoints); - void tessellateConvex(const QPointF *points, int nPoints); - void tessellateRect(const QPointF &a, const QPointF &b, qreal width); - - void setWinding(bool w); - - struct Vertex { - Q27Dot5 x; - Q27Dot5 y; - }; - struct Trapezoid { - Q27Dot5 top; - Q27Dot5 bottom; - const Vertex *topLeft; - const Vertex *bottomLeft; - const Vertex *topRight; - const Vertex *bottomRight; - }; - virtual void addTrap(const Trapezoid &trap) = 0; - -private: - friend class QTessellatorPrivate; - QTessellatorPrivate *d; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp deleted file mode 100644 index aecbf2b1775..00000000000 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qunifiedtoolbarsurface_mac_p.h" -#include -#include -#include - -#include - -#ifdef QT_MAC_USE_COCOA - -QT_BEGIN_NAMESPACE - -QUnifiedToolbarSurface::QUnifiedToolbarSurface(QWidget *widget) - : QRasterWindowSurface(widget, false), d_ptr(new QUnifiedToolbarSurfacePrivate) -{ - d_ptr->image = 0; - d_ptr->inSetGeometry = false; - - 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, QWidget *parent_toolbar, const QPoint &offset) -{ - if (object != 0) { - if (object->isWidgetType()) { - QWidget *widget = qobject_cast(object); - - // We redirect the painting only if the widget is in the same window - // and is not a window in itself. - if (!(widget->windowType() & Qt::Window)) { - widget->d_func()->unifiedSurface = this; - widget->d_func()->isInUnifiedToolbar = true; - widget->d_func()->toolbar_offset = offset; - widget->d_func()->toolbar_ancestor = parent_toolbar; - - for (int i = 0; i < object->children().size(); ++i) { - recursiveRedirect(object->children().at(i), parent_toolbar, offset); - } - } - } - } -} - -void QUnifiedToolbarSurface::insertToolbar(QWidget *toolbar, const QPoint &offset) -{ - setGeometry(QRect(QPoint(0, 0), QSize(offset.x() + toolbar->width(), 100))); // FIXME - recursiveRedirect(toolbar, toolbar, offset); -} - -// We basically undo what we set in recursiveRedirect(). -void QUnifiedToolbarSurface::recursiveRemoval(QObject *object) -{ - if (object != 0) { - if (object->isWidgetType()) { - QWidget *widget = qobject_cast(object); - - // If it's a pop-up or something similar, we don't redirect it. - if (widget->windowType() & Qt::Window) - return; - - widget->d_func()->unifiedSurface = 0; - widget->d_func()->isInUnifiedToolbar = false; - widget->d_func()->toolbar_offset = QPoint(); - widget->d_func()->toolbar_ancestor = 0; - } - - for (int i = 0; i < object->children().size(); ++i) { - recursiveRemoval(object->children().at(i)); - } - } -} - -void QUnifiedToolbarSurface::removeToolbar(QToolBar *toolbar) -{ - recursiveRemoval(toolbar); -} - -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; - - // FIXME: set unified toolbar height. -} - -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::updateToolbarOffset(QWidget *widget) -{ - QMainWindowLayout *mlayout = qobject_cast (widget->window()->layout()); - if (mlayout) - mlayout->updateUnifiedToolbarOffset(); -} - -void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(region); - Q_UNUSED(offset); - - this->flush(widget); -} - -void QUnifiedToolbarSurface::flush(QWidget *widget) -{ - Q_D(QUnifiedToolbarSurface); - - if (!d->image) - return; - - if (widget->d_func()->flushRequested) { - // We call display: directly to avoid flickering in the toolbar. - qt_mac_display(widget); - } -} - -void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widget) -{ - Q_D(QUnifiedToolbarSurface); - - int width = geometry().width(); - int height = 100; // FIXME - 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; -} - -CGContextRef QUnifiedToolbarSurface::imageContext() -{ - Q_D(QUnifiedToolbarSurface); - return d->image->cg; -} - -void QUnifiedToolbarSurface::renderToolbar(QWidget *widget, bool forceFlush) -{ - QWidget *toolbar = widget->d_func()->toolbar_ancestor; - - updateToolbarOffset(toolbar); - QRect beginPaintRect(toolbar->d_func()->toolbar_offset.x(), toolbar->d_func()->toolbar_offset.y(), toolbar->geometry().width(), toolbar->geometry().height()); - QRegion beginPaintRegion(beginPaintRect); - - beginPaint(beginPaintRegion); - toolbar->render(paintDevice(), toolbar->d_func()->toolbar_offset, QRegion(toolbar->geometry()), QWidget::DrawChildren); - toolbar->d_func()->flushRequested = true; - - if (forceFlush) - flush(toolbar); -} - -QT_END_NAMESPACE - -#endif // QT_MAC_USE_COCOA diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h deleted file mode 100644 index 2a9cedad726..00000000000 --- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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 -#include - -#ifdef QT_MAC_USE_COCOA - -QT_BEGIN_NAMESPACE - -class QNativeImage; - -// -// This is the implementation of the unified toolbar on Mac OS X -// with the graphics system raster. -// -// General idea: -// ------------- -// We redirect the painting of widgets inside the unified toolbar -// to a special window surface, the QUnifiedToolbarSurface. -// We need a separate window surface because the unified toolbar -// is out of the content view. -// The input system is the same as for the unified toolbar with the -// native (CoreGraphics) engine. -// -// Execution flow: -// --------------- -// The unified toolbar is triggered by QMainWindow::setUnifiedTitleAndToolBarOnMac(). -// It calls QMainWindowLayout::insertIntoMacToolbar() which will -// set all the appropriate variables (offsets, redirection, ...). -// When Qt tells a widget to repaint, QWidgetPrivate::drawWidget() -// checks if the widget is inside the unified toolbar and exits without -// painting is that is the case. -// We trigger the rendering of the unified toolbar in QWidget::repaint() -// and QWidget::update(). -// We keep track of flush requests via "flushRequested" variable. That -// allow flush() to be a no-op if no repaint occured for a widget. -// We rely on the needsDisplay: and drawRect: mecanism for drawing our -// content into the graphics context. -// -// Notes: -// ------ -// The painting of items inside the unified toolbar is expensive. -// Too many repaints will drastically slow down the whole application. -// - -class QUnifiedToolbarSurfacePrivate -{ -public: - QNativeImage *image; - uint inSetGeometry : 1; -}; - -class Q_GUI_EXPORT QUnifiedToolbarSurface : public QRasterWindowSurface -{ -public: - QUnifiedToolbarSurface(QWidget *widget); - ~QUnifiedToolbarSurface(); - - void flush(QWidget *widget); - 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); - void removeToolbar(QToolBar *toolbar); - void updateToolbarOffset(QWidget *widget); - void renderToolbar(QWidget *widget, bool forceFlush = false); - void recursiveRedirect(QObject *widget, QWidget *parent_toolbar, const QPoint &offset); - - QPaintDevice *paintDevice(); - CGContextRef imageContext(); - -private: - void prepareBuffer(QImage::Format format, QWidget *widget); - void recursiveRemoval(QObject *object); - - Q_DECLARE_PRIVATE(QUnifiedToolbarSurface) - QScopedPointer d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QT_MAC_USE_COCOA - -#endif // QUNIFIEDTOOLBARSURFACE_MAC_P_H diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp deleted file mode 100644 index fa3c6837b91..00000000000 --- a/src/gui/painting/qwindowsurface.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QWindowSurfacePrivate -{ -public: - QWindowSurfacePrivate(QWidget *w) - : window(w) - { - } - - QWidget *window; -#if !defined(Q_WS_QPA) - QRect geometry; -#else - QSize size; -#endif //Q_WS_QPA - QRegion staticContents; - QList bufferImages; -}; - -/*! - \class QWindowSurface - \since 4.3 - \internal - \preliminary - \ingroup qws qpa - - \brief The QWindowSurface class provides the drawing area for top-level - windows. -*/ - - -/*! - \fn void QWindowSurface::beginPaint(const QRegion ®ion) - - This function is called before painting onto the surface begins, - with the \a region in which the painting will occur. - - \sa endPaint(), paintDevice() -*/ - -/*! - \fn void QWindowSurface::endPaint(const QRegion ®ion) - - This function is called after painting onto the surface has ended, - with the \a region in which the painting was performed. - - \sa beginPaint(), paintDevice() -*/ - -/*! - \fn void QWindowSurface::flush(QWidget *widget, const QRegion ®ion, - const QPoint &offset) - - Flushes the given \a region from the specified \a widget onto the - screen. - - Note that the \a offset parameter is currently unused. -*/ - -/*! - \fn QPaintDevice* QWindowSurface::paintDevice() - - Implement this function to return the appropriate paint device. -*/ - -/*! - Constructs an empty surface for the given top-level \a window. -*/ -QWindowSurface::QWindowSurface(QWidget *window, bool setDefaultSurface) - : d_ptr(new QWindowSurfacePrivate(window)) -{ - if (!QApplicationPrivate::runtime_graphics_system) { - if(setDefaultSurface && window) - window->setWindowSurface(this); - } -} - -/*! - Destroys this surface. -*/ -QWindowSurface::~QWindowSurface() -{ - if (d_ptr->window) - d_ptr->window->d_func()->extra->topextra->windowSurface = 0; - delete d_ptr; -} - -/*! - Returns a pointer to the top-level window associated with this - surface. -*/ -QWidget* QWindowSurface::window() const -{ - return d_ptr->window; -} - -void QWindowSurface::beginPaint(const QRegion &) -{ -} - -void QWindowSurface::endPaint(const QRegion &) -{ -// QApplication::syncX(); - qDeleteAll(d_ptr->bufferImages); - d_ptr->bufferImages.clear(); -} - -#if !defined(Q_WS_QPA) -/*! - Sets the currently allocated area to be the given \a rect. - - This function is called whenever area covered by the top-level - window changes. - - \sa geometry() -*/ -void QWindowSurface::setGeometry(const QRect &rect) -{ - d_ptr->geometry = rect; -} - -/*! - Returns the currently allocated area on the screen. -*/ -QRect QWindowSurface::geometry() const -{ - return d_ptr->geometry; -} -#else - -/*! - Sets the size of the windowsurface to be \a size. - - \sa size() -*/ -void QWindowSurface::resize(const QSize &size) -{ - d_ptr->size = size; -} - -/*! - Returns the current size of the windowsurface. -*/ -QSize QWindowSurface::size() const -{ - return d_ptr->size; -} -#endif //Q_WS_QPA - -/*! - Scrolls the given \a area \a dx pixels to the right and \a dy - downward; both \a dx and \a dy may be negative. - - Returns true if the area was scrolled successfully; false otherwise. -*/ -bool QWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - Q_UNUSED(area); - Q_UNUSED(dx); - Q_UNUSED(dy); - - return false; -} - -/*! - Returns a QImage pointer which represents the actual buffer the \a widget - is drawn into or 0 if this is unavailable. - - You must call beginPaint() before you call this function and the returned - pointer is only valid until endPaint() is called. -*/ -QImage* QWindowSurface::buffer(const QWidget *widget) -{ - if (widget->window() != window()) - return 0; - - QPaintDevice *pdev = paintDevice(); - if (!pdev || pdev->devType() != QInternal::Image) - return 0; - - const QPoint off = offset(widget); - QImage *img = static_cast(pdev); - - QRect rect(off, widget->size()); - rect &= QRect(QPoint(), img->size()); - - if (rect.isEmpty()) - return 0; - - img = new QImage(img->scanLine(rect.y()) + rect.x() * img->depth() / 8, - rect.width(), rect.height(), - img->bytesPerLine(), img->format()); - d_ptr->bufferImages.append(img); - - return img; -} - -/*! - Returns a QPixmap generated from the part of the backing store - corresponding to \a widget. Returns a null QPixmap if an error - occurs. The contents of the pixmap are only defined for the regions - of \a widget that have received paint events since the last resize - of the backing store. - - If \a rectangle is a null rectangle (the default), the entire widget - is grabbed. Otherwise, the grabbed area is limited to \a rectangle. - - The default implementation uses QWindowSurface::buffer(). - - \sa QPixmap::grabWidget() -*/ -QPixmap QWindowSurface::grabWidget(const QWidget *widget, const QRect &rectangle) const -{ - QPixmap result; - - if (widget->window() != window()) - return result; - - const QImage *img = const_cast(this)->buffer(widget->window()); - - if (!img || img->isNull()) - return result; - - QRect rect = rectangle.isEmpty() ? widget->rect() : (widget->rect() & rectangle); - - rect.translate(offset(widget) - offset(widget->window())); - rect &= QRect(QPoint(), img->size()); - - if (rect.isEmpty()) - return result; - - QImage subimg(img->scanLine(rect.y()) + rect.x() * img->depth() / 8, - rect.width(), rect.height(), - img->bytesPerLine(), img->format()); - subimg.detach(); //### expensive -- maybe we should have a real SubImage that shares reference count - - result = QPixmap::fromImage(subimg); - return result; -} - -/*! - Returns the offset of \a widget in the coordinates of this - window surface. - */ -QPoint QWindowSurface::offset(const QWidget *widget) const -{ - QWidget *window = d_ptr->window; - QPoint offset = widget->mapTo(window, QPoint()); -#ifdef Q_WS_QWS - offset += window->geometry().topLeft() - window->frameGeometry().topLeft(); -#endif - return offset; -} - -/*! - \fn QRect QWindowSurface::rect(const QWidget *widget) const - - Returns the rectangle for \a widget in the coordinates of this - window surface. -*/ - -void QWindowSurface::setStaticContents(const QRegion ®ion) -{ - d_ptr->staticContents = region; -} - -QRegion QWindowSurface::staticContents() const -{ - return d_ptr->staticContents; -} - -bool QWindowSurface::hasStaticContents() const -{ - return hasFeature(QWindowSurface::StaticContents) && !d_ptr->staticContents.isEmpty(); -} - -QWindowSurface::WindowSurfaceFeatures QWindowSurface::features() const -{ - return PartialUpdates | PreservedContents; -} - -#ifdef Q_WS_QPA -#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()); - - 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); - } -} - -QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_mac.cpp b/src/gui/painting/qwindowsurface_mac.cpp deleted file mode 100644 index ed794ae4668..00000000000 --- a/src/gui/painting/qwindowsurface_mac.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_mac_p.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -struct QMacWindowSurfacePrivate -{ - QWidget *widget; - QPixmap device; -}; - -QMacWindowSurface::QMacWindowSurface(QWidget *widget) - : QWindowSurface(widget), d_ptr(new QMacWindowSurfacePrivate) -{ - d_ptr->widget = widget; -} - -QMacWindowSurface::~QMacWindowSurface() -{ - delete d_ptr; -} - -QPaintDevice *QMacWindowSurface::paintDevice() -{ - return &d_ptr->device; -} - -void QMacWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset) -{ - Q_UNUSED(offset); - - // Get a context for the widget. -#ifndef QT_MAC_USE_COCOA - CGContextRef context; - CGrafPtr port = GetWindowPort(qt_mac_window_for(widget)); - QDBeginCGContext(port, &context); -#else - extern CGContextRef qt_mac_graphicsContextFor(QWidget *); - CGContextRef context = qt_mac_graphicsContextFor(widget); -#endif - CGContextRetain(context); - CGContextSaveGState(context); - - // Flip context. - CGContextTranslateCTM(context, 0, widget->height()); - CGContextScaleCTM(context, 1, -1); - - // 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())); - } - CGContextClip(context); - - // Draw the image onto the window. - const CGRect dest = CGRectMake(0, 0, widget->width(), widget->height()); - const CGImageRef image = d_ptr->device.toMacCGImageRef(); - qt_mac_drawCGImage(context, &dest, image); - CFRelease(image); - - // Restore context. - CGContextRestoreGState(context); -#ifndef QT_MAC_USE_COCOA - QDEndCGContext(port, &context); -#else - CGContextFlush(context); -#endif - CGContextRelease(context); -} - -void QMacWindowSurface::setGeometry(const QRect &rect) -{ - QWindowSurface::setGeometry(rect); - const QSize size = rect.size(); - if (d_ptr->device.size() != size) - d_ptr->device = QPixmap(size); -} - -bool QMacWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - if (d_ptr->device.size().isNull()) - return false; - - QCFType image = d_ptr->device.toMacCGImageRef(); - const QRect rect(area.boundingRect()); - const CGRect dest = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); - QCFType subimage = CGImageCreateWithImageInRect(image, dest); - QCFType context = qt_mac_cg_context(&d_ptr->device); - CGContextTranslateCTM(context, dx, dy); - qt_mac_drawCGImage(context, &dest, subimage); - return true; -} - -QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h deleted file mode 100644 index 1e6529c788d..00000000000 --- a/src/gui/painting/qwindowsurface_p.h +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_P_H -#define QWINDOWSURFACE_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 - -QT_BEGIN_NAMESPACE - -class QPaintDevice; -class QRegion; -class QRect; -class QPoint; -class QImage; -class QWindowSurfacePrivate; -class QPlatformWindow; - -class Q_GUI_EXPORT QWindowSurface -{ -public: - enum WindowSurfaceFeature { - PartialUpdates = 0x00000001, // Supports doing partial updates. - PreservedContents = 0x00000002, // Supports doing flush without first doing a repaint. - StaticContents = 0x00000004, // Supports having static content regions when being resized. - AllFeatures = 0xffffffff // For convenience - }; - Q_DECLARE_FLAGS(WindowSurfaceFeatures, WindowSurfaceFeature) - - QWindowSurface(QWidget *window, bool setDefaultSurface = true); - virtual ~QWindowSurface(); - - QWidget *window() const; - - virtual QPaintDevice *paintDevice() = 0; - - // 'widget' can be a child widget, in which case 'region' is in child widget coordinates and - // offset is the (child) widget's offset in relation to the window surface. On QWS, 'offset' - // 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_QPA) - virtual void setGeometry(const QRect &rect); - QRect geometry() const; -#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); - - virtual void beginPaint(const QRegion &); - virtual void endPaint(const QRegion &); - - virtual QImage* buffer(const QWidget *widget); - virtual QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const; - - virtual QPoint offset(const QWidget *widget) const; - inline QRect rect(const QWidget *widget) const; - - bool hasFeature(WindowSurfaceFeature feature) const; - virtual WindowSurfaceFeatures features() const; - - void setStaticContents(const QRegion ®ion); - QRegion staticContents() const; - -protected: - bool hasStaticContents() const; - -private: - QWindowSurfacePrivate *d_ptr; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowSurface::WindowSurfaceFeatures) - -inline QRect QWindowSurface::rect(const QWidget *widget) const -{ - return widget->rect().translated(offset(widget)); -} - -inline bool QWindowSurface::hasFeature(WindowSurfaceFeature feature) const -{ - return (features() & feature) != 0; -} - -QT_END_NAMESPACE - -#endif // QWINDOWSURFACE_P_H diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp deleted file mode 100644 index c52f864b254..00000000000 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ /dev/null @@ -1,1433 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_qws_p.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#ifdef Q_BACKINGSTORE_SUBSURFACES - -typedef QMap SurfaceMap; -Q_GLOBAL_STATIC(SurfaceMap, winIdToSurfaceMap); - -QWSWindowSurface* qt_findWindowSurface(int winId) -{ - return winIdToSurfaceMap()->value(winId); -} - -static void qt_insertWindowSurface(int winId, QWSWindowSurface *surface) -{ - if (!surface) - winIdToSurfaceMap()->remove(winId); - else - winIdToSurfaceMap()->insert(winId, surface); -} - -#endif // Q_BACKINGSTORE_SUBSURFACES - -inline bool isWidgetOpaque(const QWidget *w) -{ - return w->d_func()->isOpaque && !w->testAttribute(Qt::WA_TranslucentBackground); -} - -static inline QScreen *getScreen(const QWidget *w) -{ - const QList subScreens = qt_screen->subScreens(); - if (subScreens.isEmpty()) - return qt_screen; - - const int screen = QApplication::desktop()->screenNumber(w); - - return qt_screen->subScreens().at(screen < 0 ? 0 : screen); -} - -static int bytesPerPixel(QImage::Format format) -{ - switch (format) { - case QImage::Format_Invalid: - return 0; -#ifndef QT_NO_DEBUG - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - qFatal("QWSWindowSurface: Invalid backingstore format: %i", - int(format)); -#endif - case QImage::Format_Indexed8: - return 1; - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - return 4; - case QImage::Format_RGB16: - case QImage::Format_RGB555: - case QImage::Format_RGB444: - case QImage::Format_ARGB4444_Premultiplied: - return 2; - case QImage::Format_ARGB8565_Premultiplied: - case QImage::Format_ARGB8555_Premultiplied: - case QImage::Format_ARGB6666_Premultiplied: - case QImage::Format_RGB666: - case QImage::Format_RGB888: - return 3; - default: -#ifndef QT_NO_DEBUG - qFatal("QWSWindowSurface: Invalid backingstore format: %i", - int(format)); -#endif - return 0; - } -} - -static inline int nextMulOf4(int n) -{ - return ((n + 3) & 0xfffffffc); -} - -static inline void setImageMetrics(QImage &img, QWidget *window) { - QScreen *myScreen = getScreen(window); - if (myScreen) { - int dpmx = myScreen->width()*1000 / myScreen->physicalWidth(); - int dpmy = myScreen->height()*1000 / myScreen->physicalHeight(); - img.setDotsPerMeterX(dpmx); - img.setDotsPerMeterY(dpmy); - } -} - -void QWSWindowSurface::invalidateBuffer() -{ - - QWidget *win = window(); - if (win) { - win->d_func()->invalidateBuffer(win->rect()); -#ifndef QT_NO_QWS_MANAGER - QTLWExtra *topextra = win->d_func()->extra->topextra; - QWSManager *manager = topextra->qwsManager; - if (manager) - manager->d_func()->dirtyRegion(QDecoration::All, - QDecoration::Normal); -#endif - } -} - -QWSWindowSurfacePrivate::QWSWindowSurfacePrivate() - : flags(0), -#ifdef QT_QWS_CLIENTBLIT - directId(-1), -#endif - winId(0) -{ -} - -void QWSWindowSurfacePrivate::setWinId(int id) -{ - winId = id; -} - -int QWSWindowSurface::winId() const -{ - // XXX: the widget winId may change during the lifetime of the widget!!! - - const QWidget *win = window(); - if (win && win->isWindow()) - return win->internalWinId(); - -#ifdef Q_BACKINGSTORE_SUBSURFACES - if (!d_ptr->winId) { - QWSWindowSurface *that = const_cast(this); - QWSDisplay *display = QWSDisplay::instance(); - const int id = display->takeId(); - qt_insertWindowSurface(id, that); - that->d_ptr->winId = id; - - if (win) - display->nameRegion(id, win->objectName(), win->windowTitle()); - else - display->nameRegion(id, QString(), QString()); - - display->setAltitude(id, 1, true); // XXX - } -#endif - - return d_ptr->winId; -} - -void QWSWindowSurface::setWinId(int id) -{ - d_ptr->winId = id; -} - -/*! - \class QWSWindowSurface - \since 4.2 - \ingroup qws - \preliminary - \internal - - \brief The QWSWindowSurface class provides the drawing area for top-level - windows in Qt for Embedded Linux. - - Note that this class is only available in Qt for Embedded Linux. - - In \l{Qt for Embedded Linux}, the default behavior is for each client to - render its widgets into memory while the server is responsible for - putting the contents of the memory onto the - screen. QWSWindowSurface is used by the window system to implement - the associated memory allocation. - - When a screen update is required, the server runs through all the - top-level windows that intersect with the region that is about to - be updated, and ensures that the associated clients have updated - their memory buffer. Then the server uses the screen driver to - copy the content of the memory to the screen. To locate the - relevant parts of memory, the driver is provided with the list of - top-level windows that intersect with the given region. Associated - with each of the top-level windows there is a window surface - representing the drawing area of the window. - - When deriving from the QWSWindowSurface class, e.g., when adding - an \l {Adding an Accelerated Graphics Driver to Qt for Embedded Linux} - {accelerated graphics driver}, there are several pure virtual - functions that must be implemented. In addition, QWSWindowSurface - provides several virtual functions that can be reimplemented to - customize the drawing process. - - \tableofcontents - - \section1 Pure Virtual Functions - - There are in fact two window surface instances for each top-level - window; one used by the application when drawing a window, and - another used by the server application to perform window - compositioning. Implement the attach() to create the server-side - representation of the surface. The data() function must be - implemented to provide the required data. - - Implement the key() function to uniquely identify the surface - class, and the isValid() function to determine is a surface - corresponds to a given widget. - - The geometry() function must be implemented to let the window - system determine the area required by the window surface - (QWSWindowSurface also provides a corresponding virtual - setGeometry() function that is called whenever the area necessary - for the top-level window to be drawn, changes). The image() - function is called by the window system during window - compositioning, and must be implemented to return an image of the - top-level window. - - Finally, the paintDevice() function must be implemented to return - the appropriate paint device, and the scroll() function must be - implemented to scroll the given region of the surface the given - number of pixels. - - \section1 Virtual Functions - - When painting onto the surface, the window system will always call - the beginPaint() function before any painting operations are - performed. Likewise the endPaint() function is automatically - called when the painting is done. Reimplement the painterOffset() - function to alter the offset that is applied when drawing. - - The window system uses the flush() function to put a given region - of the widget onto the screen, and the release() function to - deallocate the screen region corresponding to this window surface. - - \section1 Other Members - - QWSWindowSurface provides the window() function returning a - pointer to the top-level window the surface is representing. The - currently visible region of the associated widget can be retrieved - and set using the clipRegion() and setClipRegion() functions, - respectively. - - When the window system performs the window compositioning, it uses - the SurfaceFlag enum describing the surface content. The currently - set surface flags can be retrieved and altered using the - surfaceFlags() and setSurfaceFlags() functions. In addition, - QWSWindowSurface provides the isBuffered(), isOpaque() and - isRegionReserved() convenience functions. - - \sa {Qt for Embedded Linux Architecture#Drawing on Screen}{Qt for - Embedded Linux Architecture} -*/ - -/*! - \enum QWSWindowSurface::SurfaceFlag - - This enum is used to describe the window surface's contents. It - is used by the screen driver to handle region allocation and - composition. - - \value RegionReserved The surface contains a reserved area. Once - allocated, a reserved area can not not be changed by the window - system, i.e., no other widgets can be drawn on top of this. - - \value Buffered - The surface is in a memory area which is not part of a framebuffer. - (A top-level window with QWidget::windowOpacity() other than 1.0 must use - a buffered surface in order to making blending with the background work.) - - \value Opaque - The surface contains only opaque pixels. - - \sa surfaceFlags(), setSurfaceFlags() -*/ - -/*! - \fn bool QWSWindowSurface::isValid() const - \since 4.3 - - Implement this function to return true if the surface is a valid - surface for the given top-level \a window; otherwise return - false. - - \sa window(), key() -*/ - -/*! - \fn QString QWSWindowSurface::key() const - - Implement this function to return a string that uniquely - identifies the class of this surface. - - \sa window(), isValid() -*/ - -/*! - \fn QByteArray QWSWindowSurface::permanentState() const - \since 4.3 - - Implement this function to return the data required for creating a - server-side representation of the surface. - - \sa attach() -*/ - -/*! - \fn void QWSWindowSurface::setPermanentState(const QByteArray &data) - \since 4.3 - - Implement this function to attach a server-side surface instance - to the corresponding client side instance using the given \a - data. Return true if successful; otherwise return false. - - \sa data() -*/ - -/*! - \fn const QImage QWSWindowSurface::image() const - - Implement this function to return an image of the top-level window. - - \sa geometry() -*/ - -/*! - \fn bool QWSWindowSurface::isRegionReserved() const - - Returns true if the QWSWindowSurface::RegionReserved is set; otherwise - returns false. - - \sa surfaceFlags() -*/ - -/*! - \fn bool QWSWindowSurface::isBuffered() const - - Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false. - - \sa surfaceFlags() -*/ - -/*! - \fn bool QWSWindowSurface::isOpaque() const - - Returns true if the QWSWindowSurface::Opaque is set; otherwise - returns false. - - \sa surfaceFlags() -*/ - - -/*! - Constructs an empty surface. -*/ -QWSWindowSurface::QWSWindowSurface() - : QWindowSurface(0), d_ptr(new QWSWindowSurfacePrivate) -{ -} - -/*! - Constructs an empty surface for the given top-level \a widget. -*/ -QWSWindowSurface::QWSWindowSurface(QWidget *widget) - : QWindowSurface(widget), d_ptr(new QWSWindowSurfacePrivate) -{ -} - -QWSWindowSurface::~QWSWindowSurface() -{ -#ifdef Q_BACKINGSTORE_SUBSURFACES - if (d_ptr->winId) - winIdToSurfaceMap()->remove(d_ptr->winId); -#endif - - delete d_ptr; -} - -/*! - Returns the offset to be used when painting. - - \sa paintDevice() -*/ -QPoint QWSWindowSurface::painterOffset() const -{ - const QWidget *w = window(); - if (!w) - return QPoint(); - return w->geometry().topLeft() - w->frameGeometry().topLeft(); -} - -void QWSWindowSurface::beginPaint(const QRegion &) -{ - lock(); -} - -void QWSWindowSurface::endPaint(const QRegion &) -{ - unlock(); -} - -// XXX: documentation!!! -QByteArray QWSWindowSurface::transientState() const -{ - return QByteArray(); -} - -QByteArray QWSWindowSurface::permanentState() const -{ - return QByteArray(); -} - -void QWSWindowSurface::setTransientState(const QByteArray &state) -{ - Q_UNUSED(state); -} - -void QWSWindowSurface::setPermanentState(const QByteArray &state) -{ - Q_UNUSED(state); -} - -bool QWSWindowSurface::lock(int timeout) -{ - Q_UNUSED(timeout); - return true; -} - -void QWSWindowSurface::unlock() -{ -} - -#ifdef QT_QWS_CLIENTBLIT -/*! \internal */ -const QRegion QWSWindowSurface::directRegion() const -{ - return d_ptr->direct; -} - -/*! \internal */ -int QWSWindowSurface::directRegionId() const -{ - return d_ptr->directId; -} - -/*! \internal */ -void QWSWindowSurface::setDirectRegion(const QRegion &r, int id) -{ - d_ptr->direct = r; - d_ptr->directId = id; -} -#endif - -/*! - Returns the region currently visible on the screen. - - \sa setClipRegion() -*/ -const QRegion QWSWindowSurface::clipRegion() const -{ - return d_ptr->clip; -} - -/*! - Sets the region currently visible on the screen to be the given \a - clip region. - - \sa clipRegion() -*/ -void QWSWindowSurface::setClipRegion(const QRegion &clip) -{ - if (clip == d_ptr->clip) - return; - - QRegion expose = (clip - d_ptr->clip); - d_ptr->clip = clip; - - if (expose.isEmpty() || clip.isEmpty()) - return; // No repaint or flush required. - - QWidget *win = window(); - if (!win) - return; - - if (isBuffered()) { - // No repaint required. Flush exposed area via the backing store. - win->d_func()->syncBackingStore(expose); - return; - } - -#ifndef QT_NO_QWS_MANAGER - // Invalidate exposed decoration area. - if (win && win->isWindow()) { - QTLWExtra *topextra = win->d_func()->extra->topextra; - if (QWSManager *manager = topextra->qwsManager) { - QRegion decorationExpose(manager->region()); - decorationExpose.translate(-win->geometry().topLeft()); - decorationExpose &= expose; - if (!decorationExpose.isEmpty()) { - expose -= decorationExpose; - manager->d_func()->dirtyRegion(QDecoration::All, QDecoration::Normal, decorationExpose); - } - } - } -#endif - - // Invalidate exposed widget area. - win->d_func()->invalidateBuffer(expose); -} - -/*! - Returns the surface flags describing the contents of this surface. - - \sa isBuffered(), isOpaque(), isRegionReserved() -*/ -QWSWindowSurface::SurfaceFlags QWSWindowSurface::surfaceFlags() const -{ - return d_ptr->flags; -} - -/*! - Sets the surface flags describing the contents of this surface, to - be the given \a flags. - - \sa surfaceFlags() -*/ -void QWSWindowSurface::setSurfaceFlags(SurfaceFlags flags) -{ - d_ptr->flags = flags; -} - -void QWSWindowSurface::setGeometry(const QRect &rect) -{ - QRegion mask = rect; - - const QWidget *win = window(); - if (win) { -#ifndef QT_NO_QWS_MANAGER - if (win->isWindow()) { - QTLWExtra *topextra = win->d_func()->extra->topextra; - QWSManager *manager = topextra->qwsManager; - - if (manager) { - // The frame geometry is the bounding rect of manager->region, - // which could be too much, so we need to clip. - mask &= (manager->region() + win->geometry()); - } - } -#endif - - const QRegion winMask = win->mask(); - if (!winMask.isEmpty()) - mask &= winMask.translated(win->geometry().topLeft()); - } - - setGeometry(rect, mask); -} - -void QWSWindowSurface::setGeometry(const QRect &rect, const QRegion &mask) -{ - if (rect == geometry()) // XXX: && mask == prevMask - return; - - const bool isResize = rect.size() != geometry().size(); - const bool needsRepaint = isResize || !isBuffered(); - - QWindowSurface::setGeometry(rect); - - const QRegion region = mask & rect; - QWidget *win = window(); - // Only request regions for widgets visible on the screen. - // (Added the !win check for compatibility reasons, because - // there was no "if (win)" check before). - const bool requestQWSRegion = !win || !win->testAttribute(Qt::WA_DontShowOnScreen); - if (requestQWSRegion) - QWidget::qwsDisplay()->requestRegion(winId(), key(), permanentState(), region); - - if (needsRepaint) - invalidateBuffer(); - - if (!requestQWSRegion) { - // We didn't request a region, hence we won't get a QWSRegionEvent::Allocation - // event back from the server so we set the clip directly. We have to - // do this after the invalidateBuffer() call above, as it might trigger a - // backing store sync, resulting in too many update requests. - setClipRegion(region); - } -} - -static inline void flushUpdate(QWidget *widget, const QRegion ®ion, - const QPoint &offset) -{ -#ifdef QT_NO_PAINT_DEBUG - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); -#else - static int delay = -1; - - if (delay == -1) - delay = qgetenv("QT_FLUSH_UPDATE").toInt() * 10; - - if (delay == 0) - return; - - static QWSYellowSurface surface(true); - surface.setDelay(delay); - surface.flush(widget, region, offset); -#endif // QT_NO_PAINT_DEBUG -} - -void QWSWindowSurface::flush(QWidget *widget, const QRegion ®ion, - const QPoint &offset) -{ - const QWidget *win = window(); - if (!win) - return; - -#ifndef QT_NO_GRAPHICSVIEW - QWExtra *extra = win->d_func()->extra; - if (extra && extra->proxyWidget) - return; -#endif //QT_NO_GRAPHICSVIEW - - Q_UNUSED(offset); - - const bool opaque = isOpaque(); -#ifdef QT_QWS_DISABLE_FLUSHCLIPPING - QRegion toFlush = region; -#else - QRegion toFlush = region & d_ptr->clip; -#endif - - if (!toFlush.isEmpty()) { - flushUpdate(widget, toFlush, QPoint(0, 0)); - QPoint globalZero = win->mapToGlobal(QPoint(0, 0)); - toFlush.translate(globalZero); - -#ifdef QT_QWS_CLIENTBLIT - bool needRepaint = true; - if (opaque) { - QScreen* widgetScreen = getScreen(widget); - if (widgetScreen->supportsBlitInClients()) { - - QWSDisplay::grab(); - if(directRegion().intersected(toFlush) == toFlush) { - QPoint translate = -globalZero + painterOffset() + geometry().topLeft(); - QRegion flushRegion = toFlush.translated(translate); - widgetScreen->blit(image(), geometry().topLeft(), flushRegion); - widgetScreen->setDirty(toFlush.boundingRect()); - needRepaint = false; - } - QWSDisplay::ungrab(); - } - } - - if(needRepaint) -#endif - win->qwsDisplay()->repaintRegion(winId(), win->windowFlags(), opaque, toFlush); - } -} - -/*! - Move the surface with the given \a offset. - - A subclass may reimplement this function to enable accelerated window move. - It must return true if the move was successful and no repaint is necessary, - false otherwise. - - The default implementation updates the QWindowSurface geometry and - returns true if the surface is buffered; false otherwise. - - This function is called by the window system on the client instance. - - \sa isBuffered() -*/ -bool QWSWindowSurface::move(const QPoint &offset) -{ - QWindowSurface::setGeometry(geometry().translated(offset)); - return isBuffered(); -} - -/*! - Move the surface with the given \a offset. - - The new visible region after the window move is given by \a newClip - in screen coordinates. - - A subclass may reimplement this function to enable accelerated window move. - The returned region indicates the area that still needs to be composed - on the screen. - - The default implementation updates the QWindowSurface geometry and - returns the union of the old and new geometry. - - This function is called by the window system on the server instance. -*/ -QRegion QWSWindowSurface::move(const QPoint &offset, const QRegion &newClip) -{ - const QRegion oldGeometry = geometry(); - QWindowSurface::setGeometry(geometry().translated(offset)); - return oldGeometry + newClip; -} - -void QWSWindowSurface::releaseSurface() -{ -} - -bool QWSMemorySurface::lock(int timeout) -{ - Q_UNUSED(timeout); -#ifndef QT_NO_QWS_MULTIPROCESS - if (memlock && !memlock->lock(QWSLock::BackingStore)) - return false; -#endif -#ifndef QT_NO_THREAD - threadLock.lock(); -#endif - return true; -} - -void QWSMemorySurface::unlock() -{ -#ifndef QT_NO_THREAD - threadLock.unlock(); -#endif -#ifndef QT_NO_QWS_MULTIPROCESS - if (memlock) - memlock->unlock(QWSLock::BackingStore); -#endif -} - -QWSMemorySurface::QWSMemorySurface() - : QWSWindowSurface() -#ifndef QT_NO_QWS_MULTIPROCESS - , memlock(0) -#endif -{ - setSurfaceFlags(Buffered); -} - -QWSMemorySurface::QWSMemorySurface(QWidget *w) - : QWSWindowSurface(w) -{ - SurfaceFlags flags = Buffered; - if (isWidgetOpaque(w)) - flags |= Opaque; - setSurfaceFlags(flags); - -#ifndef QT_NO_QWS_MULTIPROCESS - memlock = QWSDisplay::Data::getClientLock(); -#endif -} - -QWSMemorySurface::~QWSMemorySurface() -{ -} - - -QImage::Format -QWSMemorySurface::preferredImageFormat(const QWidget *widget) const -{ - QScreen *screen = getScreen(widget); - const int depth = screen->depth(); - const bool opaque = isWidgetOpaque(widget); - - if (!opaque) { - if (depth <= 12) - return QImage::Format_ARGB4444_Premultiplied; - else if (depth <= 15) - return QImage::Format_ARGB8555_Premultiplied; - else if (depth <= 16) - return QImage::Format_ARGB8565_Premultiplied; - else if (depth <= 18) - return QImage::Format_ARGB6666_Premultiplied; - else - return QImage::Format_ARGB32_Premultiplied; - } - - QImage::Format format = screen->pixelFormat(); - if (format > QImage::Format_Indexed8) // ### assumes all new image formats supports a QPainter - return format; - - if (depth <= 12) - return QImage::Format_RGB444; - else if (depth <= 15) - return QImage::Format_RGB555; - else if (depth <= 16) - return QImage::Format_RGB16; - else if (depth <= 18) - return QImage::Format_RGB666; - else if (depth <= 24) - return QImage::Format_RGB888; - else - return QImage::Format_ARGB32_Premultiplied; -} - -#ifndef QT_NO_QWS_MULTIPROCESS -void QWSMemorySurface::setLock(int lockId) -{ - if (memlock && memlock->id() == lockId) - return; - delete memlock; - memlock = (lockId == -1 ? 0 : new QWSLock(lockId)); - return; -} -#endif // QT_NO_QWS_MULTIPROCESS - -bool QWSMemorySurface::isValid() const -{ - if (img.isNull()) - return true; - - const QWidget *win = window(); - if (preferredImageFormat(win) != img.format()) - return false; - - if (isOpaque() != isWidgetOpaque(win)) // XXX: use QWidgetPrivate::isOpaque() - return false; - - return true; -} - -// ### copied from qwindowsurface_raster.cpp -- should be cross-platform -void QWSMemorySurface::beginPaint(const QRegion &rgn) -{ - if (!isWidgetOpaque(window())) { - QPainter p(&img); - 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) { - QRect r = *it; -#ifdef Q_BACKINGSTORE_SUBSURFACES - r.translate(painterOffset()); -#endif - p.fillRect(r, blank); - } - } - QWSWindowSurface::beginPaint(rgn); -} - -// from qwindowsurface.cpp -extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); - -bool QWSMemorySurface::scroll(const QRegion &area, int dx, int dy) -{ - const QVector rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(img, rects.at(i), QPoint(dx, dy)); - - return true; -} - -QPoint QWSMemorySurface::painterOffset() const -{ - const QWidget *w = window(); - if (!w) - return QPoint(); - - if (w->mask().isEmpty()) - return QWSWindowSurface::painterOffset(); - - const QRegion region = w->mask() - & w->frameGeometry().translated(-w->geometry().topLeft()); - return -region.boundingRect().topLeft(); -} - -QWSLocalMemSurface::QWSLocalMemSurface() - : QWSMemorySurface(), mem(0), memsize(0) -{ -} - -QWSLocalMemSurface::QWSLocalMemSurface(QWidget *w) - : QWSMemorySurface(w), mem(0), memsize(0) -{ -} - -QWSLocalMemSurface::~QWSLocalMemSurface() -{ - if (memsize) - delete[] mem; -} - -void QWSLocalMemSurface::setGeometry(const QRect &rect) -{ - QSize size = rect.size(); - - QWidget *win = window(); - if (win && !win->mask().isEmpty()) { - const QRegion region = win->mask() - & rect.translated(-win->geometry().topLeft()); - size = region.boundingRect().size(); - } - - uchar *deleteLater = 0; - // In case of a Hide event we need to delete the memory after sending the - // event to the server in order to let the server animate the event. - if (size.isEmpty()) { - deleteLater = mem; - mem = 0; - } - - if (img.size() != size) { - delete[] mem; - if (size.isEmpty()) { - mem = 0; - img = QImage(); - } else { - const QImage::Format format = preferredImageFormat(win); - const int bpl = nextMulOf4(bytesPerPixel(format) * size.width()); - const int memsize = bpl * size.height(); - mem = new uchar[memsize]; - img = QImage(mem, size.width(), size.height(), bpl, format); - setImageMetrics(img, win); - } - } - - QWSWindowSurface::setGeometry(rect); - delete[] deleteLater; -} - -QByteArray QWSLocalMemSurface::permanentState() const -{ - QByteArray array; - array.resize(sizeof(uchar*) + 3 * sizeof(int) + - sizeof(SurfaceFlags)); - - char *ptr = array.data(); - - *reinterpret_cast(ptr) = mem; - ptr += sizeof(uchar*); - - reinterpret_cast(ptr)[0] = img.width(); - reinterpret_cast(ptr)[1] = img.height(); - ptr += 2 * sizeof(int); - - *reinterpret_cast(ptr) = img.format(); - ptr += sizeof(int); - - *reinterpret_cast(ptr) = surfaceFlags(); - - return array; -} - -void QWSLocalMemSurface::setPermanentState(const QByteArray &data) -{ - int width; - int height; - QImage::Format format; - SurfaceFlags flags; - - const char *ptr = data.constData(); - - mem = *reinterpret_cast(ptr); - ptr += sizeof(uchar*); - - width = reinterpret_cast(ptr)[0]; - height = reinterpret_cast(ptr)[1]; - ptr += 2 * sizeof(int); - - format = QImage::Format(*reinterpret_cast(ptr)); - ptr += sizeof(int); - - flags = *reinterpret_cast(ptr); - - const int bpl = nextMulOf4(bytesPerPixel(format) * width); - QWSMemorySurface::img = QImage(mem, width, height, bpl, format); - setSurfaceFlags(flags); -} - -void QWSLocalMemSurface::releaseSurface() -{ - mem = 0; - img = QImage(); -} - -#ifndef QT_NO_QWS_MULTIPROCESS - -QWSSharedMemSurface::QWSSharedMemSurface() - : QWSMemorySurface() -{ -} - -QWSSharedMemSurface::QWSSharedMemSurface(QWidget *widget) - : QWSMemorySurface(widget) -{ -} - -QWSSharedMemSurface::~QWSSharedMemSurface() -{ - // mem.detach() is done automatically by ~QSharedMemory -} - -bool QWSSharedMemSurface::setMemory(int memId) -{ - if (mem.id() == memId) - return true; - - mem.detach(); - if (!mem.attach(memId)) { - perror("QWSSharedMemSurface: attaching to shared memory"); - qCritical("QWSSharedMemSurface: Error attaching to" - " shared memory 0x%x", memId); - return false; - } - - return true; -} - -#ifdef QT_QWS_CLIENTBLIT -void QWSSharedMemSurface::setDirectRegion(const QRegion &r, int id) -{ - QWSMemorySurface::setDirectRegion(r, id); - if(mem.address()) - *(uint *)mem.address() = id; -} - -const QRegion QWSSharedMemSurface::directRegion() const -{ - QWSSharedMemory *cmem = const_cast(&mem); - if (cmem->address() && ((int*)cmem->address())[0] == directRegionId()) - return QWSMemorySurface::directRegion(); - else - return QRegion(); -} -#endif - -void QWSSharedMemSurface::setPermanentState(const QByteArray &data) -{ - int memId; - int width; - int height; - int lockId; - QImage::Format format; - SurfaceFlags flags; - - const int *ptr = reinterpret_cast(data.constData()); - - memId = ptr[0]; - width = ptr[1]; - height = ptr[2]; - lockId = ptr[3]; - format = QImage::Format(ptr[4]); - flags = SurfaceFlags(ptr[5]); - - setSurfaceFlags(flags); - setMemory(memId); - setLock(lockId); - -#ifdef QT_QWS_CLIENTBLIT - uchar *base = static_cast(mem.address()) + sizeof(uint); -#else - uchar *base = static_cast(mem.address()); -#endif - const int bpl = nextMulOf4(bytesPerPixel(format) * width); - QWSMemorySurface::img = QImage(base, width, height, bpl, format); -} - -void QWSSharedMemSurface::setGeometry(const QRect &rect) -{ - const QSize size = rect.size(); - if (img.size() != size) { - if (size.isEmpty()) { - mem.detach(); - img = QImage(); - } else { - mem.detach(); - - QWidget *win = window(); - const QImage::Format format = preferredImageFormat(win); - const int bpl = nextMulOf4(bytesPerPixel(format) * size.width()); -#ifdef QT_QWS_CLIENTBLIT - const int imagesize = bpl * size.height() + sizeof(uint); -#else - const int imagesize = bpl * size.height(); -#endif - if (!mem.create(imagesize)) { - perror("QWSSharedMemSurface::setGeometry allocating shared memory"); - qFatal("Error creating shared memory of size %d", imagesize); - } -#ifdef QT_QWS_CLIENTBLIT - *((uint *)mem.address()) = 0; - uchar *base = static_cast(mem.address()) + sizeof(uint); -#else - uchar *base = static_cast(mem.address()); -#endif - img = QImage(base, size.width(), size.height(), bpl, format); - setImageMetrics(img, win); - } - } - - QWSWindowSurface::setGeometry(rect); -} - -QByteArray QWSSharedMemSurface::permanentState() const -{ - QByteArray array; - array.resize(6 * sizeof(int)); - - int *ptr = reinterpret_cast(array.data()); - - ptr[0] = mem.id(); - ptr[1] = img.width(); - ptr[2] = img.height(); - ptr[3] = (memlock ? memlock->id() : -1); - ptr[4] = int(img.format()); - ptr[5] = int(surfaceFlags()); - - return array; -} - -void QWSSharedMemSurface::releaseSurface() -{ - mem.detach(); - img = QImage(); -} - -#endif // QT_NO_QWS_MULTIPROCESS - -#ifndef QT_NO_PAINTONSCREEN - -QWSOnScreenSurface::QWSOnScreenSurface(QWidget *w) - : QWSMemorySurface(w) -{ - attachToScreen(getScreen(w)); - setSurfaceFlags(Opaque); -} - -QWSOnScreenSurface::QWSOnScreenSurface() - : QWSMemorySurface() -{ - setSurfaceFlags(Opaque); -} - -void QWSOnScreenSurface::attachToScreen(const QScreen *s) -{ - screen = s; - uchar *base = screen->base(); - QImage::Format format = screen->pixelFormat(); - - if (format == QImage::Format_Invalid || format == QImage::Format_Indexed8) { - //### currently we have no paint engine for indexed image formats - qFatal("QWSOnScreenSurface::attachToScreen(): screen depth %d " - "not implemented", screen->depth()); - return; - } - QWSMemorySurface::img = QImage(base, screen->width(), screen->height(), - screen->linestep(), format ); -} - -QWSOnScreenSurface::~QWSOnScreenSurface() -{ -} - -QPoint QWSOnScreenSurface::painterOffset() const -{ - return geometry().topLeft() + QWSWindowSurface::painterOffset(); -} - -bool QWSOnScreenSurface::isValid() const -{ - const QWidget *win = window(); - if (screen != getScreen(win)) - return false; - if (img.isNull()) - return false; - return QScreen::isWidgetPaintOnScreen(win); -} - -QByteArray QWSOnScreenSurface::permanentState() const -{ - QByteArray array; - array.resize(sizeof(int)); - int *ptr = reinterpret_cast(array.data()); - ptr[0] = QApplication::desktop()->screenNumber(window()); - return array; -} - -void QWSOnScreenSurface::setPermanentState(const QByteArray &data) -{ - const int *ptr = reinterpret_cast(data.constData()); - const int screenNo = ptr[0]; - - QScreen *screen = qt_screen; - if (screenNo > 0) - screen = qt_screen->subScreens().at(screenNo); - attachToScreen(screen); -} - -#endif // QT_NO_PAINTONSCREEN - -#ifndef QT_NO_PAINT_DEBUG - -QWSYellowSurface::QWSYellowSurface(bool isClient) - : QWSWindowSurface(), delay(10) -{ - if (isClient) { - setWinId(QWidget::qwsDisplay()->takeId()); - QWidget::qwsDisplay()->nameRegion(winId(), - QLatin1String("Debug flush paint"), - QLatin1String("Silly yellow thing")); - QWidget::qwsDisplay()->setAltitude(winId(), 1, true); - } - setSurfaceFlags(Buffered); -} - -QWSYellowSurface::~QWSYellowSurface() -{ -} - -QByteArray QWSYellowSurface::permanentState() const -{ - QByteArray array; - array.resize(2 * sizeof(int)); - - int *ptr = reinterpret_cast(array.data()); - ptr[0] = surfaceSize.width(); - ptr[1] = surfaceSize.height(); - - return array; -} - -void QWSYellowSurface::setPermanentState(const QByteArray &data) -{ - const int *ptr = reinterpret_cast(data.constData()); - - const int width = ptr[0]; - const int height = ptr[1]; - - img = QImage(width, height, QImage::Format_ARGB32); - img.fill(qRgba(255,255,31,127)); -} - -void QWSYellowSurface::flush(QWidget *widget, const QRegion ®ion, - const QPoint &offset) -{ - Q_UNUSED(offset); - - QWSDisplay *display = QWidget::qwsDisplay(); - QRegion rgn = region; - - if (widget) - rgn.translate(widget->mapToGlobal(QPoint(0, 0))); - - surfaceSize = region.boundingRect().size(); - - const int id = winId(); - display->requestRegion(id, key(), permanentState(), rgn); - display->setAltitude(id, 1, true); - display->repaintRegion(id, 0, false, rgn); - - ::usleep(500 * delay); - display->requestRegion(id, key(), permanentState(), QRegion()); - ::usleep(500 * delay); -} - -#endif // QT_NO_PAINT_DEBUG - -#ifndef QT_NO_DIRECTPAINTER - -static inline QScreen *getPrimaryScreen() -{ - QScreen *screen = QScreen::instance(); - if (!screen->base()) { - QList subScreens = screen->subScreens(); - if (subScreens.size() < 1) - return 0; - screen = subScreens.at(0); - } - return screen; -} - -QWSDirectPainterSurface::QWSDirectPainterSurface(bool isClient, - QDirectPainter::SurfaceFlag flags) - : QWSWindowSurface(), flushingRegionEvents(false), doLocking(false) -{ - setSurfaceFlags(Opaque); - synchronous = (flags == QDirectPainter::ReservedSynchronous); - - if (isClient) { - setWinId(QWidget::qwsDisplay()->takeId()); - QWidget::qwsDisplay()->nameRegion(winId(), - QLatin1String("QDirectPainter reserved space"), - QLatin1String("reserved")); - } else { - setWinId(0); - } - _screen = QScreen::instance(); - if (!_screen->base()) { - QList subScreens = _screen->subScreens(); - if (subScreens.size() < 1) - _screen = 0; - else - _screen = subScreens.at(0); - } -} - -QWSDirectPainterSurface::~QWSDirectPainterSurface() -{ - if (winId() && QWSDisplay::instance()) // make sure not in QApplication destructor - QWidget::qwsDisplay()->destroyRegion(winId()); -} - -void QWSDirectPainterSurface::setRegion(const QRegion ®ion) -{ - const int id = winId(); - QWidget::qwsDisplay()->requestRegion(id, key(), permanentState(), region); -#ifndef QT_NO_QWS_MULTIPROCESS - if (synchronous) - QWSDisplay::instance()->d->waitForRegionAck(id); -#endif -} - -void QWSDirectPainterSurface::flush(QWidget *, const QRegion &r, const QPoint &) -{ - QWSDisplay::instance()->repaintRegion(winId(), 0, true, r); -} - -QByteArray QWSDirectPainterSurface::permanentState() const -{ - QByteArray res; - if (isRegionReserved()) - res.append( 'r'); - return res; -} - -void QWSDirectPainterSurface::setPermanentState(const QByteArray &ba) -{ - if (ba.size() > 0 && ba.at(0) == 'r') - setReserved(); - setSurfaceFlags(surfaceFlags() | Opaque); -} - -void QWSDirectPainterSurface::beginPaint(const QRegion ®ion) -{ - QWSWindowSurface::beginPaint(region); -#ifndef QT_NO_QWS_MULTIPROCESS - if (!synchronous) { - flushingRegionEvents = true; - QWSDisplay::instance()->d->waitForRegionEvents(winId(), doLocking); - flushingRegionEvents = false; - } -#endif -} - -bool QWSDirectPainterSurface::hasPendingRegionEvents() const -{ -#ifndef QT_NO_QWS_MULTIPROCESS - if (synchronous) - return false; - - return QWSDisplay::instance()->d->hasPendingRegionEvents(); -#else - return false; -#endif -} - -bool QWSDirectPainterSurface::lock(int timeout) -{ -#ifndef QT_NO_THREAD - threadLock.lock(); -#endif - Q_UNUSED(timeout); - if (doLocking) - QWSDisplay::grab(true); - return true; -} - -void QWSDirectPainterSurface::unlock() -{ - if (doLocking) - QWSDisplay::ungrab(); -#ifndef QT_NO_THREAD - threadLock.unlock(); -#endif -} - -#endif // QT_NO_DIRECTPAINTER - -QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_qws_p.h b/src/gui/painting/qwindowsurface_qws_p.h deleted file mode 100644 index eaabccf39a9..00000000000 --- a/src/gui/painting/qwindowsurface_qws_p.h +++ /dev/null @@ -1,355 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_QWS_P_H -#define QWINDOWSURFACE_QWS_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 "qwindowsurface_p.h" -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QScreen; -class QWSWindowSurfacePrivate; - -class Q_GUI_EXPORT QWSWindowSurface : public QWindowSurface -{ -public: - QWSWindowSurface(); - QWSWindowSurface(QWidget *widget); - ~QWSWindowSurface(); - - virtual bool isValid() const = 0; - - virtual void setGeometry(const QRect &rect); - virtual void setGeometry(const QRect &rect, const QRegion &mask); - virtual void flush(QWidget *widget, const QRegion ®ion, - const QPoint &offset); - - virtual bool move(const QPoint &offset); - virtual QRegion move(const QPoint &offset, const QRegion &newClip); - - virtual QPoint painterOffset() const; // remove!!! - - virtual void beginPaint(const QRegion &); - virtual void endPaint(const QRegion &); - - virtual bool lock(int timeout = -1); - virtual void unlock(); - - virtual QString key() const = 0; - - // XXX: not good enough - virtual QByteArray transientState() const; - virtual QByteArray permanentState() const; - virtual void setTransientState(const QByteArray &state); - virtual void setPermanentState(const QByteArray &state); - - virtual QImage image() const = 0; - virtual QPaintDevice *paintDevice() = 0; - - const QRegion clipRegion() const; - void setClipRegion(const QRegion &); - -#ifdef QT_QWS_CLIENTBLIT - virtual const QRegion directRegion() const; - virtual int directRegionId() const; - virtual void setDirectRegion(const QRegion &, int); -#endif - - enum SurfaceFlag { - RegionReserved = 0x1, - Buffered = 0x2, - Opaque = 0x4 - }; - Q_DECLARE_FLAGS(SurfaceFlags, SurfaceFlag) - - SurfaceFlags surfaceFlags() const; - - inline bool isRegionReserved() const { - return surfaceFlags() & RegionReserved; - } - inline bool isBuffered() const { return surfaceFlags() & Buffered; } - inline bool isOpaque() const { return surfaceFlags() & Opaque; } - - int winId() const; - virtual void releaseSurface(); - -protected: - void setSurfaceFlags(SurfaceFlags type); - void setWinId(int id); - -private: - friend class QWidgetPrivate; - - void invalidateBuffer(); - - QWSWindowSurfacePrivate *d_ptr; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QWSWindowSurface::SurfaceFlags) - -class QWSWindowSurfacePrivate -{ -public: - QWSWindowSurfacePrivate(); - - void setWinId(int id); - - QWSWindowSurface::SurfaceFlags flags; - QRegion clip; -#ifdef QT_QWS_CLIENTBLIT - QRegion direct; - int directId; -#endif - - int winId; -}; - -class QWSLock; - -class Q_GUI_EXPORT QWSMemorySurface : public QWSWindowSurface -{ -public: - QWSMemorySurface(); - QWSMemorySurface(QWidget *widget); - ~QWSMemorySurface(); - - bool isValid() const; - - QPaintDevice *paintDevice() { return &img; } - bool scroll(const QRegion &area, int dx, int dy); - - QImage image() const { return img; } - QPoint painterOffset() const; - - void beginPaint(const QRegion &rgn); - - bool lock(int timeout = -1); - void unlock(); - -protected: - QImage::Format preferredImageFormat(const QWidget *widget) const; - -#ifndef QT_NO_QWS_MULTIPROCESS - void setLock(int lockId); - QWSLock *memlock; -#endif -#ifndef QT_NO_THREAD - QMutex threadLock; -#endif - - QImage img; -}; - -class Q_GUI_EXPORT QWSLocalMemSurface : public QWSMemorySurface -{ -public: - QWSLocalMemSurface(); - QWSLocalMemSurface(QWidget *widget); - ~QWSLocalMemSurface(); - - void setGeometry(const QRect &rect); - - QString key() const { return QLatin1String("mem"); } - QByteArray permanentState() const; - - void setPermanentState(const QByteArray &data); - virtual void releaseSurface(); -protected: - uchar *mem; - int memsize; -}; - -#ifndef QT_NO_QWS_MULTIPROCESS -class Q_GUI_EXPORT QWSSharedMemSurface : public QWSMemorySurface -{ -public: - QWSSharedMemSurface(); - QWSSharedMemSurface(QWidget *widget); - ~QWSSharedMemSurface(); - - void setGeometry(const QRect &rect); - - QString key() const { return QLatin1String("shm"); } - QByteArray permanentState() const; - - void setPermanentState(const QByteArray &data); - -#ifdef QT_QWS_CLIENTBLIT - virtual void setDirectRegion(const QRegion &, int); - virtual const QRegion directRegion() const; -#endif - virtual void releaseSurface(); - -private: - bool setMemory(int memId); - - QWSSharedMemory mem; -}; -#endif // QT_NO_QWS_MULTIPROCESS - -#ifndef QT_NO_PAINTONSCREEN -class Q_GUI_EXPORT QWSOnScreenSurface : public QWSMemorySurface -{ -public: - QWSOnScreenSurface(); - QWSOnScreenSurface(QWidget *widget); - ~QWSOnScreenSurface(); - - bool isValid() const; - QPoint painterOffset() const; - - QString key() const { return QLatin1String("OnScreen"); } - QByteArray permanentState() const; - - void setPermanentState(const QByteArray &data); - -private: - void attachToScreen(const QScreen *screen); - - const QScreen *screen; -}; -#endif // QT_NO_PAINTONSCREEN - -#ifndef QT_NO_PAINT_DEBUG -class Q_GUI_EXPORT QWSYellowSurface : public QWSWindowSurface -{ -public: - QWSYellowSurface(bool isClient = false); - ~QWSYellowSurface(); - - void setDelay(int msec) { delay = msec; } - - bool isValid() const { return true; } - - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - - QString key() const { return QLatin1String("Yellow"); } - QByteArray permanentState() const; - - void setPermanentState(const QByteArray &data); - - QPaintDevice *paintDevice() { return &img; } - QImage image() const { return img; } - -private: - int delay; - QSize surfaceSize; // client side - QImage img; // server side -}; -#endif // QT_NO_PAINT_DEBUG - -#ifndef QT_NO_DIRECTPAINTER - -class QScreen; - -class Q_GUI_EXPORT QWSDirectPainterSurface : public QWSWindowSurface -{ -public: - QWSDirectPainterSurface(bool isClient = false, - QDirectPainter::SurfaceFlag flags = QDirectPainter::NonReserved); - ~QWSDirectPainterSurface(); - - void setReserved() { setSurfaceFlags(RegionReserved); } - - void setGeometry(const QRect &rect) { setRegion(rect); } - - void setRegion(const QRegion ®ion); - QRegion region() const { return clipRegion(); } - - void flush(QWidget*, const QRegion &, const QPoint &); - - bool isValid() const { return false; } - - QString key() const { return QLatin1String("DirectPainter"); } - QByteArray permanentState() const; - - void setPermanentState(const QByteArray &); - - QImage image() const { return QImage(); } - QPaintDevice *paintDevice() { return 0; } - - // hw: get rid of this - WId windowId() const { return static_cast(winId()); } - - QScreen *screen() const { return _screen; } - - void beginPaint(const QRegion &); - bool lock(int timeout = -1); - void unlock(); - - void setLocking(bool b) { doLocking = b; } - - bool hasPendingRegionEvents() const; - -private: - QScreen *_screen; -#ifndef QT_NO_THREAD - QMutex threadLock; -#endif - - friend void qt_directpainter_region(QDirectPainter*, const QRegion&, int); - bool flushingRegionEvents; - bool synchronous; - bool doLocking; -}; - -#endif // QT_NO_DIRECTPAINTER - -QT_END_NAMESPACE - -#endif // QWINDOWSURFACE_QWS_P_H diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp deleted file mode 100644 index d97238427b7..00000000000 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ /dev/null @@ -1,487 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include // for Q_WS_WIN define (non-PCH) -#ifdef Q_WS_WIN -#include -#include -#endif - -#include -#include - -#include "private/qwindowsurface_raster_p.h" -#include "private/qnativeimage_p.h" -#include "private/qwidget_p.h" - -#ifdef Q_WS_X11 -#include "private/qpixmap_x11_p.h" -#include "private/qt_x11_p.h" -#include "private/qwidget_p.h" -#include "qx11info_x11.h" -#endif -#include "private/qdrawhelper_p.h" - -#ifdef Q_WS_MAC -#include -#include -#include -#include -#endif - -QT_BEGIN_NAMESPACE - -class QRasterWindowSurfacePrivate -{ -public: - QNativeImage *image; - -#ifdef Q_WS_X11 - GC gc; -#ifndef QT_NO_MITSHM - uint needsSync : 1; -#endif -#ifndef QT_NO_XRENDER - uint translucentBackground : 1; -#endif -#endif - uint inSetGeometry : 1; -}; - -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); -#ifndef QT_NO_XRENDER - d_ptr->translucentBackground = X11->use_xrender - && window->x11Info().depth() == 32; -#endif -#ifndef QT_NO_MITHSM - d_ptr->needsSync = false; -#endif -#endif - d_ptr->image = 0; - d_ptr->inSetGeometry = false; - -#ifdef QT_MAC_USE_COCOA - needsFlush = false; - regionToFlush = QRegion(); -#endif // QT_MAC_USE_COCOA -} - - -QRasterWindowSurface::~QRasterWindowSurface() -{ -#ifdef Q_WS_X11 - XFreeGC(X11->display, d_ptr->gc); -#endif - if (d_ptr->image) - delete d_ptr->image; -} - - -QPaintDevice *QRasterWindowSurface::paintDevice() -{ - return &d_ptr->image->image; -} - -#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) -void QRasterWindowSurface::syncX() -{ - // delay writing to the backbuffer until we know for sure X is done reading from it - if (d_ptr->needsSync) { - XSync(X11->display, false); - d_ptr->needsSync = false; - } -} -#endif - -void QRasterWindowSurface::beginPaint(const QRegion &rgn) -{ -#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) - syncX(); -#endif - -#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE)) - if (!qt_widget_private(window())->isOpaque && window()->testAttribute(Qt::WA_TranslucentBackground)) { -#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) - if (d_ptr->image->image.format() != QImage::Format_ARGB32_Premultiplied) - prepareBuffer(QImage::Format_ARGB32_Premultiplied, window()); -#endif - 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); - } - } -#else - Q_UNUSED(rgn); -#endif -} - -void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset) -{ - Q_D(QRasterWindowSurface); - - // Not ready for painting yet, bail out. This can happen in - // QWidget::create_sys() - if (!d->image || rgn.rectCount() == 0) - return; - -#ifdef Q_WS_WIN - QRect br = rgn.boundingRect(); - -#ifndef Q_WS_WINCE - if (!qt_widget_private(window())->isOpaque - && window()->testAttribute(Qt::WA_TranslucentBackground) - && (qt_widget_private(window())->data.window_flags & Qt::FramelessWindowHint)) - { - QRect r = window()->frameGeometry(); - QPoint frameOffset = qt_widget_private(window())->frameStrut().topLeft(); - QRect dirtyRect = br.translated(offset + frameOffset); - - SIZE size = {r.width(), r.height()}; - POINT ptDst = {r.x(), r.y()}; - POINT ptSrc = {0, 0}; - BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA}; - RECT dirty = {dirtyRect.x(), dirtyRect.y(), - dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; - Q_UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, d->image->hdc, &ptSrc, 0, &blend, Q_ULW_ALPHA, &dirty}; - ptrUpdateLayeredWindowIndirect(window()->internalWinId(), &info); - } else -#endif - { - QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft(); - - HDC widget_dc = widget->getDC(); - - QRect wbr = br.translated(-wOffset); - BitBlt(widget_dc, wbr.x(), wbr.y(), wbr.width(), wbr.height(), - d->image->hdc, br.x() + offset.x(), br.y() + offset.y(), SRCCOPY); - widget->releaseDC(widget_dc); - } - -#ifndef QT_NO_DEBUG - static bool flush = !qgetenv("QT_FLUSH_WINDOWSURFACE").isEmpty(); - if (flush) { - SelectObject(qt_win_display_dc(), GetStockObject(BLACK_BRUSH)); - Rectangle(qt_win_display_dc(), 0, 0, d->image->width() + 2, d->image->height() + 2); - BitBlt(qt_win_display_dc(), 1, 1, d->image->width(), d->image->height(), - d->image->hdc, 0, 0, SRCCOPY); - } -#endif - -#endif - -#ifdef Q_WS_X11 - extern void *qt_getClipRects(const QRegion &r, int &num); // in qpaintengine_x11.cpp - extern QWidgetData* qt_widget_data(QWidget *); - QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft(); - - if (widget->window() != window()) { - XFreeGC(X11->display, d_ptr->gc); - d_ptr->gc = XCreateGC(X11->display, widget->handle(), 0, 0); - } - - QRegion wrgn(rgn); - if (!wOffset.isNull()) - wrgn.translate(-wOffset); - QRect wbr = wrgn.boundingRect(); - - if (wrgn.rectCount() != 1) { - int num; - XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num); - XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded); - } - - QRect br = rgn.boundingRect().translated(offset); -#ifndef QT_NO_MITSHM - if (d_ptr->image->xshmpm) { - XCopyArea(X11->display, d_ptr->image->xshmpm, widget->handle(), d_ptr->gc, - br.x(), br.y(), br.width(), br.height(), wbr.x(), wbr.y()); - d_ptr->needsSync = true; - } else if (d_ptr->image->xshmimg) { - const QImage &src = d->image->image; - br = br.intersected(src.rect()); - XShmPutImage(X11->display, widget->handle(), d_ptr->gc, d_ptr->image->xshmimg, - br.x(), br.y(), wbr.x(), wbr.y(), br.width(), br.height(), False); - d_ptr->needsSync = true; - } else -#endif - { - const QImage &src = d->image->image; - br = br.intersected(src.rect()); - if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) { - Q_ASSERT(src.depth() >= 16); - const QImage sub_src(src.scanLine(br.y()) + br.x() * (uint(src.depth()) / 8), - br.width(), br.height(), src.bytesPerLine(), src.format()); - QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); - data->xinfo = widget->x11Info(); - data->fromImage(sub_src, Qt::NoOpaqueDetection); - QPixmap pm = QPixmap(data); - XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, 0 , 0 , br.width(), br.height(), wbr.x(), wbr.y()); - } else { - // qpaintengine_x11.cpp - extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth); - qt_x11_drawImage(br, wbr.topLeft(), src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth()); - } - } - - if (wrgn.rectCount() != 1) - XSetClipMask(X11->display, d_ptr->gc, XNone); -#endif // FALCON - -#ifdef Q_WS_MAC - - Q_UNUSED(offset); - - // This is mainly done for native components like native "open file" dialog. - if (widget->testAttribute(Qt::WA_DontShowOnScreen)) { - return; - } - -#ifdef QT_MAC_USE_COCOA - - this->needsFlush = true; - this->regionToFlush += rgn; - - // The actual flushing will be processed in [view drawRect:rect] - qt_mac_setNeedsDisplay(widget); - -#else - // Get a context for the widget. - CGContextRef context; - CGrafPtr port = GetWindowPort(qt_mac_window_for(widget)); - QDBeginCGContext(port, &context); - CGContextRetain(context); - CGContextSaveGState(context); - - // Flip context. - CGContextTranslateCTM(context, 0, widget->height()); - CGContextScaleCTM(context, 1, -1); - - // 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())); - } - CGContextClip(context); - - QRect r = rgn.boundingRect(); - const CGRect area = CGRectMake(r.x(), r.y(), r.width(), r.height()); - CGImageRef image = CGBitmapContextCreateImage(d->image->cg); - CGImageRef subImage = CGImageCreateWithImageInRect(image, area); - - qt_mac_drawCGImage(context, &area, subImage); - - CGImageRelease(subImage); - CGImageRelease(image); - - QDEndCGContext(port, &context); - - // Restore context. - CGContextRestoreGState(context); - CGContextRelease(context); -#endif // QT_MAC_USE_COCOA - -#endif // Q_WS_MAC - -#ifdef Q_OS_SYMBIAN - Q_UNUSED(widget); - Q_UNUSED(rgn); - Q_UNUSED(offset); -#endif -} - -void QRasterWindowSurface::setGeometry(const QRect &rect) -{ - QWindowSurface::setGeometry(rect); - Q_D(QRasterWindowSurface); - d->inSetGeometry = true; - if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height()) { -#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE)) -#ifndef Q_WS_WIN - if (d_ptr->translucentBackground) -#else - if (!qt_widget_private(window())->isOpaque) -#endif - prepareBuffer(QImage::Format_ARGB32_Premultiplied, window()); - else -#endif - prepareBuffer(QNativeImage::systemFormat(), window()); - } - d->inSetGeometry = false; - -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) - 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 && QT_MAC_USE_COCOA - -} - -// from qwindowsurface.cpp -extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); - -bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ -#ifdef Q_WS_WIN - Q_D(QRasterWindowSurface); - - if (!d->image || !d->image->hdc) - return false; - - QRect rect = area.boundingRect(); - BitBlt(d->image->hdc, rect.x()+dx, rect.y()+dy, rect.width(), rect.height(), - d->image->hdc, rect.x(), rect.y(), SRCCOPY); - - return true; -#else - Q_D(QRasterWindowSurface); - - if (!d->image || d->image->image.isNull()) - return false; - -#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) - syncX(); -#endif - - const QVector rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(d->image->image, rects.at(i), QPoint(dx, dy)); - - return true; -#endif -} - -QWindowSurface::WindowSurfaceFeatures QRasterWindowSurface::features() const -{ - return QWindowSurface::AllFeatures; -} - -void QRasterWindowSurface::prepareBuffer(QImage::Format format, QWidget *widget) -{ - Q_D(QRasterWindowSurface); - - int width = window()->width(); - int height = window()->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; -} - -#ifdef QT_MAC_USE_COCOA -CGContextRef QRasterWindowSurface::imageContext() -{ - Q_D(QRasterWindowSurface); - return d->image->cg; -} -#endif // QT_MAC_USE_COCOA - -QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h deleted file mode 100644 index 7bac561fa74..00000000000 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_RASTER_P_H -#define QWINDOWSURFACE_RASTER_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 -#include "private/qwindowsurface_p.h" - -#ifdef QT_MAC_USE_COCOA -# include -#endif // QT_MAC_USE_COCOA - -QT_BEGIN_NAMESPACE - -#ifdef Q_WS_WIN -#define Q_WS_EX_LAYERED 0x00080000 // copied from WS_EX_LAYERED in winuser.h -#define Q_LWA_ALPHA 0x00000002 // copied from LWA_ALPHA in winuser.h -#define Q_ULW_ALPHA 0x00000002 // copied from ULW_ALPHA in winuser.h -#define Q_AC_SRC_ALPHA 0x00000001 // copied from AC_SRC_ALPHA in winuser.h - -struct Q_UPDATELAYEREDWINDOWINFO { - DWORD cbSize; - HDC hdcDst; - const POINT *pptDst; - const SIZE *psize; - HDC hdcSrc; - const POINT *pptSrc; - COLORREF crKey; - const BLENDFUNCTION *pblend; - DWORD dwFlags; - const RECT *prcDirty; -}; - -typedef BOOL (WINAPI *PtrUpdateLayeredWindow)(HWND hwnd, HDC hdcDst, const POINT *pptDst, - const SIZE *psize, HDC hdcSrc, const POINT *pptSrc, COLORREF crKey, - const BLENDFUNCTION *pblend, DWORD dwflags); -typedef BOOL (WINAPI *PtrUpdateLayeredWindowIndirect)(HWND hwnd, const Q_UPDATELAYEREDWINDOWINFO *pULWInfo); -extern PtrUpdateLayeredWindow ptrUpdateLayeredWindow; -extern PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect; -#endif - -class QPaintDevice; -class QPoint; -class QRegion; -class QRegion; -class QSize; -class QWidget; -class QRasterWindowSurfacePrivate; -class QNativeImage; - -class Q_GUI_EXPORT QRasterWindowSurface : public QWindowSurface -{ -public: - QRasterWindowSurface(QWidget *widget, bool setDefaultSurface = true); - ~QRasterWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void beginPaint(const QRegion &rgn); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - WindowSurfaceFeatures features() const; - -#ifdef QT_MAC_USE_COCOA - CGContextRef imageContext(); - - bool needsFlush; - QRegion regionToFlush; -#endif // QT_MAC_USE_COCOA - -private: -#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) - void syncX(); -#endif - void prepareBuffer(QImage::Format format, QWidget *widget); - Q_DECLARE_PRIVATE(QRasterWindowSurface) - QScopedPointer d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QWINDOWSURFACE_RASTER_P_H diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp deleted file mode 100644 index 8801d75f0fb..00000000000 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include // for Q_WS_WIN define (non-PCH) - -#include -#include -#include -#include -#include -#include -#include - -#ifdef QT_GRAPHICSSYSTEM_RUNTIME -#include -#endif - -QT_BEGIN_NAMESPACE - -struct QS60WindowSurfacePrivate -{ - QPixmap device; - QList bufferImages; -}; - -TDisplayMode displayMode(bool opaque) -{ - TDisplayMode mode = S60->screenDevice()->DisplayMode(); - if (opaque) { - mode = EColor16MU; - } else { - if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3) - mode = Q_SYMBIAN_ECOLOR16MAP; // Symbian^3 WServ has support for ARGB32_PRE - else - mode = EColor16MA; // Symbian prior to Symbian^3 sw accelerates EColor16MA - } - return mode; -} - -bool blitWriteAlpha(QWidgetPrivate *widgetPrivate) -{ - QWExtra *extra = widgetPrivate->extraData(); - return extra ? extra->nativePaintMode == QWExtra::BlitWriteAlpha : false; -} - -QS60WindowSurface::QS60WindowSurface(QWidget* widget) - : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate) -{ - QWidgetPrivate *widgetPrivate = qt_widget_private(widget); - const bool opaque = widgetPrivate->isOpaque && !blitWriteAlpha(widgetPrivate); - TDisplayMode mode = displayMode(opaque); - // We create empty CFbsBitmap here -> it will be resized in setGeometry - CFbsBitmap *bitmap = new CFbsBitmap; // CBase derived object needs check on new - Q_CHECK_PTR(bitmap); - qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); - - QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType); - if (data) { - data->fromSymbianBitmap(bitmap, true); - d_ptr->device = QPixmap(data); - } -} - -QS60WindowSurface::~QS60WindowSurface() -{ -#if defined(QT_GRAPHICSSYSTEM_RUNTIME) && defined(Q_SYMBIAN_SUPPORTS_SURFACES) - if(QApplicationPrivate::runtime_graphics_system) { - QRuntimeGraphicsSystem *runtimeGraphicsSystem = - static_cast(QApplicationPrivate::graphics_system); - if(runtimeGraphicsSystem->graphicsSystemName() == QLatin1String("openvg")) { - - // Graphics system has been switched from raster to openvg. - // Issue empty redraw to clear the UI surface - - QWidget *w = window(); - if (w->testAttribute(Qt::WA_WState_Created)) { - RWindow *const window = static_cast(w->winId()->DrawableWindow()); - window->BeginRedraw(); - window->EndRedraw(); - } - } - } -#endif - - delete d_ptr; -} - -void QS60WindowSurface::beginPaint(const QRegion &rgn) -{ -#ifdef Q_SYMBIAN_SUPPORTS_SURFACES - S60->wsSession().Finish(); -#endif - - QWidgetPrivate *windowPrivate = qt_widget_private(window()); - if (!windowPrivate->isOpaque || blitWriteAlpha(windowPrivate)) { - QS60PixmapData *pixmapData = static_cast(d_ptr->device.data_ptr().data()); - - TDisplayMode mode = displayMode(false); - if (pixmapData->cfbsBitmap->DisplayMode() != mode) - pixmapData->convertToDisplayMode(mode); - - pixmapData->beginDataAccess(); - - if (!windowPrivate->isOpaque) { - QPainter p(&pixmapData->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); - } - } - - pixmapData->endDataAccess(); - } -} - -void QS60WindowSurface::endPaint(const QRegion &) -{ - qDeleteAll(d_ptr->bufferImages); - d_ptr->bufferImages.clear(); -} - -QImage* QS60WindowSurface::buffer(const QWidget *widget) -{ - if (widget->window() != window()) - return 0; - - QPaintDevice *pdev = paintDevice(); - if (!pdev) - return 0; - - const QPoint off = offset(widget); - QImage *img = &(static_cast(d_ptr->device.data_ptr().data())->image); - - QRect rect(off, widget->size()); - rect &= QRect(QPoint(), img->size()); - - if (rect.isEmpty()) - return 0; - - img = new QImage(img->scanLine(rect.y()) + rect.x() * img->depth() / 8, - rect.width(), rect.height(), - img->bytesPerLine(), img->format()); - d_ptr->bufferImages.append(img); - - return img; -} - -void QS60WindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &) -{ - QWidget *window = widget->window(); - Q_ASSERT(window); - QTLWExtra *topExtra = window->d_func()->maybeTopData(); - Q_ASSERT(topExtra); - QRect qr = region.boundingRect(); - if (!topExtra->inExpose) { - topExtra->inExpose = true; // Prevent DrawNow() from calling syncBackingStore() again - TRect tr = qt_QRect2TRect(qr); - widget->winId()->DrawNow(tr); - topExtra->inExpose = false; - } else { - // This handles the case when syncBackingStore updates content outside of the - // original drawing rectangle. This might happen if there are pending update() - // events at the same time as we get a Draw() from Symbian. - QRect drawRect = qt_TRect2QRect(widget->winId()->DrawableWindow()->GetDrawRect()); - if (!drawRect.contains(qr)) - widget->winId()->DrawDeferred(); - } -} - -bool QS60WindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - QRect rect = area.boundingRect(); - - if (dx == 0 && dy == 0) - return false; - - if (d_ptr->device.isNull()) - return false; - - QS60PixmapData *data = static_cast(d_ptr->device.data_ptr().data()); - data->scroll(dx, dy, rect); - - return true; -} - -QPaintDevice* QS60WindowSurface::paintDevice() -{ - return &d_ptr->device; -} - -void QS60WindowSurface::setGeometry(const QRect& rect) -{ - if (rect == geometry()) - return; - - QS60PixmapData *data = static_cast(d_ptr->device.data_ptr().data()); - data->resize(rect.width(), rect.height()); - - QWindowSurface::setGeometry(rect); -} - -QWindowSurface::WindowSurfaceFeatures QS60WindowSurface::features() const -{ - return QWindowSurface::AllFeatures; -} - -CFbsBitmap* QS60WindowSurface::symbianBitmap() const -{ - QS60PixmapData *data = static_cast(d_ptr->device.data_ptr().data()); - return data->cfbsBitmap; -} - -QT_END_NAMESPACE - diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp deleted file mode 100644 index 1a62f477228..00000000000 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -#include "private/qt_x11_p.h" -#include "private/qpixmap_x11_p.h" -#include "private/qwidget_p.h" -#include "qx11info_x11.h" -#include "qwindowsurface_x11_p.h" - -QT_BEGIN_NAMESPACE - -extern void *qt_getClipRects(const QRegion &r, int &num); // in qpaintengine_x11.cpp - -struct QX11WindowSurfacePrivate -{ - QWidget *widget; - QPixmap device; -#ifndef QT_NO_XRENDER - bool translucentBackground; -#endif -}; - -QX11WindowSurface::QX11WindowSurface(QWidget *widget) - : QWindowSurface(widget), d_ptr(new QX11WindowSurfacePrivate), gc(0) -{ - d_ptr->widget = widget; -#ifndef QT_NO_XRENDER - d_ptr->translucentBackground = X11->use_xrender - && widget->x11Info().depth() == 32; -#endif -} - - -QX11WindowSurface::~QX11WindowSurface() -{ - delete d_ptr; - if (gc) { - XFreeGC(X11->display, gc); - gc = 0; - } -} - -QPaintDevice *QX11WindowSurface::paintDevice() -{ - return &d_ptr->device; -} - -void QX11WindowSurface::beginPaint(const QRegion &rgn) -{ -#ifndef QT_NO_XRENDER - Q_ASSERT(!d_ptr->device.isNull()); - - if (d_ptr->translucentBackground) { - if (d_ptr->device.depth() != 32) - static_cast(d_ptr->device.data_ptr().data())->convertToARGB32(); - ::Picture src = X11->getSolidFill(d_ptr->device.x11Info().screen(), Qt::transparent); - ::Picture dst = d_ptr->device.x11PictureHandle(); - const QVector rects = rgn.rects(); - const int w = d_ptr->device.width(); - const int h = d_ptr->device.height(); - for (QVector::const_iterator it = rects.begin(); it != rects.end(); ++it) - XRenderComposite(X11->display, PictOpSrc, src, 0, dst, - 0, 0, w, h, it->x(), it->y(), - it->width(), it->height()); - } -#endif -} - -void QX11WindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset) -{ - if (d_ptr->device.isNull()) - return; - - QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft(); - QRegion wrgn(rgn); - QRect br = rgn.boundingRect(); - if (!wOffset.isNull()) - wrgn.translate(-wOffset); - QRect wbr = wrgn.boundingRect(); - - int num; - XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num); - if (num <= 0) - return; -// qDebug() << "XSetClipRectangles"; -// for (int i = 0; i < num; ++i) -// qDebug() << ' ' << i << rects[i].x << rects[i].x << rects[i].y << rects[i].width << rects[i].height; - if (num != 1) - XSetClipRectangles(X11->display, gc, 0, 0, rects, num, YXBanded); - XCopyArea(X11->display, d_ptr->device.handle(), widget->handle(), gc, - br.x() + offset.x(), br.y() + offset.y(), br.width(), br.height(), wbr.x(), wbr.y()); - if (num != 1) - XSetClipMask(X11->display, gc, XNone); -} - -void QX11WindowSurface::setGeometry(const QRect &rect) -{ - QWindowSurface::setGeometry(rect); - - const QSize size = rect.size(); - - if (d_ptr->device.size() == size || size.width() <= 0 || size.height() <= 0) - return; -#ifndef QT_NO_XRENDER - if (d_ptr->translucentBackground) { - QPixmap::x11SetDefaultScreen(d_ptr->widget->x11Info().screen()); - - QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); - data->xinfo = d_ptr->widget->x11Info(); - data->resize(size.width(), size.height()); - d_ptr->device = QPixmap(data); - } else -#endif - { - QPixmap::x11SetDefaultScreen(d_ptr->widget->x11Info().screen()); - - QX11PixmapData *oldData = static_cast(d_ptr->device.pixmapData()); - - if (oldData && !(oldData->flags & QX11PixmapData::Uninitialized) && hasStaticContents()) { - // Copy the content of the old pixmap into the new one. - QX11PixmapData *newData = new QX11PixmapData(QPixmapData::PixmapType); - newData->resize(size.width(), size.height()); - Q_ASSERT(oldData->d == newData->d); - - QRegion staticRegion(staticContents()); - // Make sure we're inside the boundaries of the old pixmap. - staticRegion &= QRect(0, 0, oldData->w, oldData->h); - const QRect boundingRect(staticRegion.boundingRect()); - const int dx = boundingRect.x(); - const int dy = boundingRect.y(); - - int num; - XRectangle *rects = (XRectangle *)qt_getClipRects(staticRegion, num); - GC tmpGc = XCreateGC(X11->display, oldData->hd, 0, 0); - XSetClipRectangles(X11->display, tmpGc, 0, 0, rects, num, YXBanded); - XCopyArea(X11->display, oldData->hd, newData->hd, tmpGc, - dx, dy, qMin(boundingRect.width(), size.width()), - qMin(boundingRect.height(), size.height()), dx, dy); - XFreeGC(X11->display, tmpGc); - newData->flags &= ~QX11PixmapData::Uninitialized; - - d_ptr->device = QPixmap(newData); - } else { - d_ptr->device = QPixmap(size); - } - } - - if (gc) { - XFreeGC(X11->display, gc); - gc = 0; - } - if (!d_ptr->device.isNull()) { - gc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0); - XSetGraphicsExposures(X11->display, gc, False); - } -} - -bool QX11WindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - QRect rect = area.boundingRect(); - - if (d_ptr->device.isNull()) - return false; - - GC gc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0); - XCopyArea(X11->display, d_ptr->device.handle(), d_ptr->device.handle(), gc, - rect.x(), rect.y(), rect.width(), rect.height(), - rect.x()+dx, rect.y()+dy); - XFreeGC(X11->display, gc); - - return true; -} - -QPixmap QX11WindowSurface::grabWidget(const QWidget *widget, - const QRect& rect) const -{ - if (!widget || d_ptr->device.isNull()) - return QPixmap(); - - QRect srcRect; - - // make sure the rect is inside the widget & clip to widget's rect - if (!rect.isEmpty()) - srcRect = rect & widget->rect(); - else - srcRect = widget->rect(); - - if (srcRect.isEmpty()) - return QPixmap(); - - // If it's a child widget we have to translate the coordinates - if (widget != window()) - srcRect.translate(widget->mapTo(window(), QPoint(0, 0))); - - QPixmap::x11SetDefaultScreen(widget->x11Info().screen()); - QPixmap px(srcRect.width(), srcRect.height()); - - GC tmpGc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0); - - // Copy srcRect from the backing store to the new pixmap - XSetGraphicsExposures(X11->display, tmpGc, False); - XCopyArea(X11->display, d_ptr->device.handle(), px.handle(), tmpGc, - srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height(), 0, 0); - - XFreeGC(X11->display, tmpGc); - - return px; -} - -QWindowSurface::WindowSurfaceFeatures QX11WindowSurface::features() const -{ - WindowSurfaceFeatures features = QWindowSurface::PartialUpdates | QWindowSurface::PreservedContents; -#ifndef QT_NO_XRENDER - if (!d_ptr->translucentBackground) - features |= QWindowSurface::StaticContents; -#else - features |= QWindowSurface::StaticContents; -#endif - return features; -} - -QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_x11_p.h b/src/gui/painting/qwindowsurface_x11_p.h deleted file mode 100644 index 23c00a1f635..00000000000 --- a/src/gui/painting/qwindowsurface_x11_p.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_X11_P_H -#define QWINDOWSURFACE_X11_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 -#include "private/qwindowsurface_p.h" - -QT_BEGIN_NAMESPACE - -class QPaintDevice; -class QPoint; -class QRegion; -class QRegion; -class QSize; -class QWidget; -struct QX11WindowSurfacePrivate; - -class QX11WindowSurface : public QWindowSurface -{ -public: - QX11WindowSurface(QWidget *widget); - ~QX11WindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - - void beginPaint(const QRegion &rgn); - void setGeometry(const QRect &rect); - bool scroll(const QRegion &area, int dx, int dy); - QPixmap grabWidget(const QWidget *widget, - const QRect& rectangle = QRect()) const; - WindowSurfaceFeatures features() const; - -private: - QX11WindowSurfacePrivate *d_ptr; - GC gc; -}; - -QT_END_NAMESPACE - -#endif // QWINDOWSURFACE_X11_P_H diff --git a/src/gui/text/qabstractfontengine_qws.cpp b/src/gui/text/qabstractfontengine_qws.cpp deleted file mode 100644 index b2c9cc478aa..00000000000 --- a/src/gui/text/qabstractfontengine_qws.cpp +++ /dev/null @@ -1,776 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qabstractfontengine_qws.h" -#include "qabstractfontengine_p.h" - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -class QFontEngineInfoPrivate -{ -public: - inline QFontEngineInfoPrivate() - : pixelSize(0), weight(QFont::Normal), style(QFont::StyleNormal) - {} - - QString family; - qreal pixelSize; - int weight; - QFont::Style style; - QList writingSystems; -}; - -/*! - \class QFontEngineInfo - \preliminary - \brief The QFontEngineInfo class describes a specific font provided by a font engine plugin. - \since 4.3 - \ingroup qws - - \tableofcontents - - QFontEngineInfo is used to describe a request of a font to a font engine plugin as well as to - describe the actual fonts a plugin provides. - - \sa QAbstractFontEngine, QFontEnginePlugin -*/ - -/*! - Constructs a new empty QFontEngineInfo. -*/ -QFontEngineInfo::QFontEngineInfo() -{ - d = new QFontEngineInfoPrivate; -} - -/*! - Constructs a new QFontEngineInfo with the specified \a family. - The resulting object represents a freely scalable font with normal - weight and style. -*/ -QFontEngineInfo::QFontEngineInfo(const QString &family) -{ - d = new QFontEngineInfoPrivate; - d->family = family; -} - -/*! - Creates a new font engine info object with the same attributes as \a other. -*/ -QFontEngineInfo::QFontEngineInfo(const QFontEngineInfo &other) - : d(new QFontEngineInfoPrivate(*other.d)) -{ -} - -/*! - Assigns \a other to this font engine info object, and returns a reference - to this. -*/ -QFontEngineInfo &QFontEngineInfo::operator=(const QFontEngineInfo &other) -{ - *d = *other.d; - return *this; -} - -/*! - Destroys this QFontEngineInfo object. -*/ -QFontEngineInfo::~QFontEngineInfo() -{ - delete d; -} - -/*! - \property QFontEngineInfo::family - the family name of the font -*/ - -void QFontEngineInfo::setFamily(const QString &family) -{ - d->family = family; -} - -QString QFontEngineInfo::family() const -{ - return d->family; -} - -/*! - \property QFontEngineInfo::pixelSize - the pixel size of the font - - A pixel size of 0 represents a freely scalable font. -*/ - -void QFontEngineInfo::setPixelSize(qreal size) -{ - d->pixelSize = size; -} - -qreal QFontEngineInfo::pixelSize() const -{ - return d->pixelSize; -} - -/*! - \property QFontEngineInfo::weight - the weight of the font - - The value should be from the \l{QFont::Weight} enumeration. -*/ - -void QFontEngineInfo::setWeight(int weight) -{ - d->weight = weight; -} - -int QFontEngineInfo::weight() const -{ - return d->weight; -} - -/*! - \property QFontEngineInfo::style - the style of the font -*/ - -void QFontEngineInfo::setStyle(QFont::Style style) -{ - d->style = style; -} - -QFont::Style QFontEngineInfo::style() const -{ - return d->style; -} - -/*! - \property QFontEngineInfo::writingSystems - the writing systems supported by the font - - An empty list means that any writing system is supported. -*/ - -QList QFontEngineInfo::writingSystems() const -{ - return d->writingSystems; -} - -void QFontEngineInfo::setWritingSystems(const QList &writingSystems) -{ - d->writingSystems = writingSystems; -} - -class QFontEnginePluginPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QFontEnginePlugin) - - QString foundry; -}; - -/*! - \class QFontEnginePlugin - \preliminary - \brief The QFontEnginePlugin class is the base class for font engine factory plugins in Qt for Embedded Linux. - \since 4.3 - \ingroup qws - \ingroup plugins - - \tableofcontents - - QFontEnginePlugin is provided by font engine plugins to create - instances of subclasses of QAbstractFontEngine. - - The member functions create() and availableFontEngines() must be - implemented. - - \sa QAbstractFontEngine, QFontEngineInfo -*/ - -/*! - Creates a font engine plugin that creates font engines with the - specified \a foundry and \a parent. -*/ -QFontEnginePlugin::QFontEnginePlugin(const QString &foundry, QObject *parent) - : QObject(*new QFontEnginePluginPrivate, parent) -{ - Q_D(QFontEnginePlugin); - d->foundry = foundry; -} - -/*! - Destroys this font engine plugin. -*/ -QFontEnginePlugin::~QFontEnginePlugin() -{ -} - -/*! - Returns a list of foundries the font engine plugin provides. - The default implementation returns the foundry specified with the constructor. -*/ -QStringList QFontEnginePlugin::keys() const -{ - Q_D(const QFontEnginePlugin); - return QStringList(d->foundry); -} - -/*! - \fn QAbstractFontEngine *QFontEnginePlugin::create(const QFontEngineInfo &info) - - Implemented in subclasses to create a new font engine that provides a font that - matches \a info. -*/ - -/*! - \fn QList QFontEnginePlugin::availableFontEngines() const - - Implemented in subclasses to return a list of QFontEngineInfo objects that represents all font - engines the plugin can create. -*/ - -class QAbstractFontEnginePrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QAbstractFontEngine) -public: -}; - -//The class is|provides|contains|specifies... -/*! - \class QAbstractFontEngine - \preliminary - \brief The QAbstractFontEngine class is the base class for font engine plugins in Qt for Embedded Linux. - \since 4.3 - \ingroup qws - - \tableofcontents - - QAbstractFontEngine is implemented by font engine plugins through QFontEnginePlugin. - - \sa QFontEnginePlugin, QFontEngineInfo -*/ - -/*! - \enum QAbstractFontEngine::Capability - - This enum describes the capabilities of a font engine. - - \value CanRenderGlyphs_Gray The font engine can render individual glyphs into 8 bpp images. - \value CanRenderGlyphs_Mono The font engine can render individual glyphs into 1 bpp images. - \value CanRenderGlyphs The font engine can render individual glyphs into images. - \value CanOutlineGlyphs The font engine can convert glyphs to painter paths. -*/ - -/*! - \enum QAbstractFontEngine::FontProperty - - This enum describes the properties of a font provided by a font engine. - - \value Ascent The ascent of the font, specified as a 26.6 fixed point value. - \value Descent The descent of the font, specified as a 26.6 fixed point value. - \value Leading The leading of the font, specified as a 26.6 fixed point value. - \value XHeight The 'x' height of the font, specified as a 26.6 fixed point value. - \value AverageCharWidth The average character width of the font, specified as a 26.6 fixed point value. - \value LineThickness The thickness of the underline and strikeout lines for the font, specified as a 26.6 fixed point value. - \value UnderlinePosition The distance from the base line to the underline position for the font, specified as a 26.6 fixed point value. - \value MaxCharWidth The width of the widest character in the font, specified as a 26.6 fixed point value. - \value MinLeftBearing The minimum left bearing of the font, specified as a 26.6 fixed point value. - \value MinRightBearing The maximum right bearing of the font, specified as a 26.6 fixed point value. - \value GlyphCount The number of glyphs in the font, specified as an integer value. - \value CacheGlyphsHint A boolean value specifying whether rendered glyphs should be cached by Qt. - \value OutlineGlyphsHint A boolean value specifying whether the font engine prefers outline drawing over image rendering for uncached glyphs. -*/ - -/*! - \enum QAbstractFontEngine::TextShapingFlag - - This enum describes flags controlling conversion of characters to glyphs and their metrics. - - \value RightToLeft The text is used in a right-to-left context. - \value ReturnDesignMetrics Return font design metrics instead of pixel metrics. -*/ - -/*! - \typedef QAbstractFontEngine::Fixed - - This type is \c int, interpreted as a 26.6 fixed point value. -*/ - -/*! - \class QAbstractFontEngine::GlyphMetrics - \brief QAbstractFontEngine::GlyphMetrics defines the metrics of a single glyph. - \preliminary - \since 4.3 -*/ - -/*! - \variable QAbstractFontEngine::GlyphMetrics::x - - The horizontal offset from the origin. -*/ - -/*! - \fn QAbstractFontEngine::GlyphMetrics::GlyphMetrics() - - Constructs an empty glyph metrics object with all values - set to zero. -*/ - -/*! - \variable QAbstractFontEngine::GlyphMetrics::y - - The vertical offset from the origin (baseline). -*/ - -/*! - \variable QAbstractFontEngine::GlyphMetrics::width - - The width of the glyph. -*/ - -/*! - \variable QAbstractFontEngine::GlyphMetrics::height - - The height of the glyph. -*/ - -/*! - \variable QAbstractFontEngine::GlyphMetrics::advance - - The advance of the glyph. -*/ - -/*! - \class QAbstractFontEngine::FixedPoint - \brief QAbstractFontEngine::FixedPoint defines a point in the place using 26.6 fixed point precision. - \preliminary - \since 4.3 -*/ - -/*! - \variable QAbstractFontEngine::FixedPoint::x - - The x coordinate of this point. -*/ - -/*! - \variable QAbstractFontEngine::FixedPoint::y - - The y coordinate of this point. -*/ - -/*! - Constructs a new QAbstractFontEngine with the given \a parent. -*/ -QAbstractFontEngine::QAbstractFontEngine(QObject *parent) - : QObject(*new QAbstractFontEnginePrivate, parent) -{ -} - -/*! - Destroys this QAbstractFontEngine object. -*/ -QAbstractFontEngine::~QAbstractFontEngine() -{ -} - -/*! - \fn QAbstractFontEngine::Capabilities QAbstractFontEngine::capabilities() const - - Implemented in subclasses to specify the font engine's capabilities. The return value - may be cached by the caller and is expected not to change during the lifetime of the - font engine. -*/ - -/*! - \fn QVariant QAbstractFontEngine::fontProperty(FontProperty property) const - - Implemented in subclasses to return the value of the font attribute \a property. The return - value may be cached by the caller and is expected not to change during the lifetime of the font - engine. -*/ - -/*! - \fn bool QAbstractFontEngine::convertStringToGlyphIndices(const QChar *string, int length, uint *glyphs, int *numGlyphs, TextShapingFlags flags) const - - Implemented in subclasses to convert the characters specified by \a string and \a length to - glyph indicies, using \a flags. The glyph indicies should be returned in the \a glyphs array - provided by the caller. The maximum size of \a glyphs is specified by the value pointed to by \a - numGlyphs. If successful, the subclass implementation sets the value pointed to by \a numGlyphs - to the actual number of glyph indices generated, and returns true. Otherwise, e.g. if there is - not enough space in the provided \a glyphs array, it should set \a numGlyphs to the number of - glyphs needed for the conversion and return false. -*/ - -/*! - \fn void QAbstractFontEngine::getGlyphAdvances(const uint *glyphs, int numGlyphs, Fixed *advances, TextShapingFlags flags) const - - Implemented in subclasses to retrieve the advances of the array specified by \a glyphs and \a - numGlyphs, using \a flags. The result is returned in \a advances, which is allocated by the - caller and contains \a numGlyphs elements. -*/ - -/*! - \fn QAbstractFontEngine::GlyphMetrics QAbstractFontEngine::glyphMetrics(uint glyph) const - - Implemented in subclass to return the metrics for \a glyph. -*/ - -/*! - Implemented in subclasses to render the specified \a glyph into a \a buffer with the given \a depth , - \a bytesPerLine and \a height. - - Returns true if rendering succeeded, false otherwise. -*/ -bool QAbstractFontEngine::renderGlyph(uint glyph, int depth, int bytesPerLine, int height, uchar *buffer) -{ - Q_UNUSED(glyph) - Q_UNUSED(depth) - Q_UNUSED(bytesPerLine) - Q_UNUSED(height) - Q_UNUSED(buffer) - qWarning("QAbstractFontEngine: renderGlyph is not implemented in font plugin!"); - return false; -} - -/*! - Implemented in subclasses to add the outline of the glyphs specified by \a glyphs and \a - numGlyphs at the specified \a positions to the painter path \a path. -*/ -void QAbstractFontEngine::addGlyphOutlinesToPath(uint *glyphs, int numGlyphs, FixedPoint *positions, QPainterPath *path) -{ - Q_UNUSED(glyphs) - Q_UNUSED(numGlyphs) - Q_UNUSED(positions) - Q_UNUSED(path) - qWarning("QAbstractFontEngine: addGlyphOutlinesToPath is not implemented in font plugin!"); -} - -/* -bool QAbstractFontEngine::supportsExtension(Extension extension) const -{ - Q_UNUSED(extension) - return false; -} - -QVariant QAbstractFontEngine::extension(Extension extension, const QVariant &argument) -{ - Q_UNUSED(argument) - Q_UNUSED(extension) - return QVariant(); -} -*/ - -QProxyFontEngine::QProxyFontEngine(QAbstractFontEngine *customEngine, const QFontDef &def) - : engine(customEngine) -{ - fontDef = def; - engineCapabilities = engine->capabilities(); -} - -QProxyFontEngine::~QProxyFontEngine() -{ - delete engine; -} - -bool QProxyFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const -{ - if (*nglyphs < len) { - *nglyphs = len; - return false; - } - - QVarLengthArray glyphIndicies(*nglyphs); - if (!engine->convertStringToGlyphIndices(str, len, glyphIndicies.data(), nglyphs, QAbstractFontEngine::TextShapingFlags(int(flags)))) - return false; - - // ### use memcopy instead - for (int i = 0; i < *nglyphs; ++i) { - glyphs->glyphs[i] = glyphIndicies[i]; - } - glyphs->numGlyphs = *nglyphs; - - recalcAdvances(glyphs, flags); - return true; -} - -void QProxyFontEngine::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const -{ - const int nglyphs = glyphs->numGlyphs; - - QVarLengthArray advances(nglyphs); - engine->getGlyphAdvances(glyphs->glyphs, nglyphs, advances.data(), QAbstractFontEngine::TextShapingFlags(int(flags))); - - - // ### use memcopy instead - for (int i = 0; i < nglyphs; ++i) { - glyphs->advances_x[i] = QFixed::fromFixed(advances[i]); - glyphs->advances_y[i] = 0; - } -} - - -static QImage alphaMapFromPath(QFontEngine *fe, glyph_t glyph) -{ - glyph_metrics_t gm = fe->boundingBox(glyph); - int glyph_x = qFloor(gm.x.toReal()); - int glyph_y = qFloor(gm.y.toReal()); - int glyph_width = qCeil((gm.x + gm.width).toReal()) - glyph_x; - int glyph_height = qCeil((gm.y + gm.height).toReal()) - glyph_y; - - if (glyph_width <= 0 || glyph_height <= 0) - return QImage(); - QFixedPoint pt; - pt.x = 0; - pt.y = -glyph_y; // the baseline - QPainterPath path; - QImage im(glyph_width + qAbs(glyph_x) + 4, glyph_height, QImage::Format_ARGB32_Premultiplied); - im.fill(Qt::transparent); - QPainter p(&im); - p.setRenderHint(QPainter::Antialiasing); - fe->addGlyphsToPath(&glyph, &pt, 1, &path, 0); - p.setPen(Qt::NoPen); - p.setBrush(Qt::black); - p.drawPath(path); - p.end(); - - QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); - QVector colors(256); - for (int i=0; i<256; ++i) - colors[i] = qRgba(0, 0, 0, i); - indexed.setColorTable(colors); - - for (int y=0; yglyphMetrics(glyph); - if (metrics.width <= 0 || metrics.height <= 0) - return QImage(); - - QImage img(metrics.width >> 6, metrics.height >> 6, QImage::Format_Indexed8); - - // ### we should have QImage::Format_GrayScale8 - static QVector colorMap; - if (colorMap.isEmpty()) { - colorMap.resize(256); - for (int i=0; i<256; ++i) - colorMap[i] = qRgba(0, 0, 0, i); - } - - img.setColorTable(colorMap); - - engine->renderGlyph(glyph, /*depth*/8, img.bytesPerLine(), img.height(), img.bits()); - - return img; -} - -void QProxyFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags) -{ - if (engineCapabilities & QAbstractFontEngine::CanOutlineGlyphs) - engine->addGlyphOutlinesToPath(glyphs, nglyphs, reinterpret_cast(positions), path); - else - QFontEngine::addGlyphsToPath(glyphs, positions, nglyphs, path, flags); -} - -glyph_metrics_t QProxyFontEngine::boundingBox(const QGlyphLayout &glyphs) -{ - if (glyphs.numGlyphs == 0) - return glyph_metrics_t(); - - QFixed w = 0; - for (int i = 0; i < glyphs.numGlyphs; ++i) - w += glyphs.effectiveAdvance(i); - - return glyph_metrics_t(0, -ascent(), w, ascent() + descent(), w, 0); -} - -glyph_metrics_t QProxyFontEngine::boundingBox(glyph_t glyph) -{ - glyph_metrics_t m; - - QAbstractFontEngine::GlyphMetrics metrics = engine->glyphMetrics(glyph); - m.x = QFixed::fromFixed(metrics.x); - m.y = QFixed::fromFixed(metrics.y); - m.width = QFixed::fromFixed(metrics.width); - m.height = QFixed::fromFixed(metrics.height); - m.xoff = QFixed::fromFixed(metrics.advance); - - return m; -} - -QFixed QProxyFontEngine::ascent() const -{ - return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::Ascent).toInt()); -} - -QFixed QProxyFontEngine::descent() const -{ - return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::Descent).toInt()); -} - -QFixed QProxyFontEngine::leading() const -{ - return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::Leading).toInt()); -} - -QFixed QProxyFontEngine::xHeight() const -{ - return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::XHeight).toInt()); -} - -QFixed QProxyFontEngine::averageCharWidth() const -{ - return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::AverageCharWidth).toInt()); -} - -QFixed QProxyFontEngine::lineThickness() const -{ - return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::LineThickness).toInt()); -} - -QFixed QProxyFontEngine::underlinePosition() const -{ - return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::UnderlinePosition).toInt()); -} - -qreal QProxyFontEngine::maxCharWidth() const -{ - return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::MaxCharWidth).toInt()).toReal(); -} - -qreal QProxyFontEngine::minLeftBearing() const -{ - return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::MinLeftBearing).toInt()).toReal(); -} - -qreal QProxyFontEngine::minRightBearing() const -{ - return QFixed::fromFixed(engine->fontProperty(QAbstractFontEngine::MinRightBearing).toInt()).toReal(); -} - -int QProxyFontEngine::glyphCount() const -{ - return engine->fontProperty(QAbstractFontEngine::GlyphCount).toInt(); -} - -bool QProxyFontEngine::canRender(const QChar *string, int len) -{ - QVarLengthArray glyphs(len); - int numGlyphs = len; - - if (!engine->convertStringToGlyphIndices(string, len, glyphs.data(), &numGlyphs, /*flags*/0)) - return false; - - for (int i = 0; i < numGlyphs; ++i) - if (!glyphs[i]) - return false; - - return true; -} - -void QProxyFontEngine::draw(QPaintEngine *p, qreal _x, qreal _y, const QTextItemInt &si) -{ - QPaintEngineState *pState = p->state; - QRasterPaintEngine *paintEngine = static_cast(p); - - QTransform matrix = pState->transform(); - matrix.translate(_x, _y); - QFixed x = QFixed::fromReal(matrix.dx()); - QFixed y = QFixed::fromReal(matrix.dy()); - - QVarLengthArray positions; - QVarLengthArray glyphs; - getGlyphPositions(si.glyphs, matrix, si.flags, glyphs, positions); - if (glyphs.size() == 0) - return; - - for(int i = 0; i < glyphs.size(); i++) { - QImage glyph = alphaMapForGlyph(glyphs[i]); - if (glyph.isNull()) - continue; - - if (glyph.format() != QImage::Format_Indexed8 - && glyph.format() != QImage::Format_Mono) - continue; - - QAbstractFontEngine::GlyphMetrics metrics = engine->glyphMetrics(glyphs[i]); - - int depth = glyph.format() == QImage::Format_Mono ? 1 : 8; - paintEngine->alphaPenBlt(glyph.bits(), glyph.bytesPerLine(), depth, - qRound(positions[i].x + QFixed::fromFixed(metrics.x)), - qRound(positions[i].y + QFixed::fromFixed(metrics.y)), - glyph.width(), glyph.height()); - } -} - -/* - * This is only called when we use the proxy fontengine directly (without sharing the rendered - * glyphs). So we prefer outline rendering over rendering of unshared glyphs. That decision is - * done in qfontdatabase_qws.cpp by looking at the ShareGlyphsHint and the pixel size of the font. - */ -bool QProxyFontEngine::drawAsOutline() const -{ - if (!(engineCapabilities & QAbstractFontEngine::CanOutlineGlyphs)) - return false; - - QVariant outlineHint = engine->fontProperty(QAbstractFontEngine::OutlineGlyphsHint); - return !outlineHint.isValid() || outlineHint.toBool(); -} - -QT_END_NAMESPACE diff --git a/src/gui/text/qabstractfontengine_qws.h b/src/gui/text/qabstractfontengine_qws.h deleted file mode 100644 index 4c85a0a063a..00000000000 --- a/src/gui/text/qabstractfontengine_qws.h +++ /dev/null @@ -1,221 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QABSTRACTFONTENGINE_QWS_H -#define QABSTRACTFONTENGINE_QWS_H - -#include -#include -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QFontEngineInfoPrivate; - -class Q_GUI_EXPORT QFontEngineInfo -{ -public: - QDOC_PROPERTY(QString family READ family WRITE setFamily) - QDOC_PROPERTY(qreal pixelSize READ pixelSize WRITE setPixelSize) - QDOC_PROPERTY(int weight READ weight WRITE setWeight) - QDOC_PROPERTY(QFont::Style style READ style WRITE setStyle) - QDOC_PROPERTY(QList writingSystems READ writingSystems WRITE setWritingSystems) - - QFontEngineInfo(); - explicit QFontEngineInfo(const QString &family); - QFontEngineInfo(const QFontEngineInfo &other); - QFontEngineInfo &operator=(const QFontEngineInfo &other); - ~QFontEngineInfo(); - - void setFamily(const QString &name); - QString family() const; - - void setPixelSize(qreal size); - qreal pixelSize() const; - - void setWeight(int weight); - int weight() const; - - void setStyle(QFont::Style style); - QFont::Style style() const; - - QList writingSystems() const; - void setWritingSystems(const QList &writingSystems); - -private: - QFontEngineInfoPrivate *d; -}; - -class QAbstractFontEngine; - -struct Q_GUI_EXPORT QFontEngineFactoryInterface : public QFactoryInterface -{ - virtual QAbstractFontEngine *create(const QFontEngineInfo &info) = 0; - virtual QList availableFontEngines() const = 0; -}; - -#define QFontEngineFactoryInterface_iid "com.trolltech.Qt.QFontEngineFactoryInterface" -Q_DECLARE_INTERFACE(QFontEngineFactoryInterface, QFontEngineFactoryInterface_iid) - -class QFontEnginePluginPrivate; - -class Q_GUI_EXPORT QFontEnginePlugin : public QObject, public QFontEngineFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(QFontEngineFactoryInterface:QFactoryInterface) -public: - QFontEnginePlugin(const QString &foundry, QObject *parent = 0); - ~QFontEnginePlugin(); - - virtual QStringList keys() const; - - virtual QAbstractFontEngine *create(const QFontEngineInfo &info) = 0; - virtual QList availableFontEngines() const = 0; - -private: - Q_DECLARE_PRIVATE(QFontEnginePlugin) - Q_DISABLE_COPY(QFontEnginePlugin) -}; - -class QAbstractFontEnginePrivate; - -class Q_GUI_EXPORT QAbstractFontEngine : public QObject -{ - Q_OBJECT -public: - enum Capability { - CanOutlineGlyphs = 1, - CanRenderGlyphs_Mono = 2, - CanRenderGlyphs_Gray = 4, - CanRenderGlyphs = CanRenderGlyphs_Mono | CanRenderGlyphs_Gray - }; - Q_DECLARE_FLAGS(Capabilities, Capability) - - explicit QAbstractFontEngine(QObject *parent = 0); - ~QAbstractFontEngine(); - - typedef int Fixed; // 26.6 - - struct FixedPoint - { - Fixed x; - Fixed y; - }; - - struct GlyphMetrics - { - inline GlyphMetrics() - : x(0), y(0), width(0), height(0), - advance(0) {} - Fixed x; - Fixed y; - Fixed width; - Fixed height; - Fixed advance; - }; - - enum FontProperty { - Ascent, - Descent, - Leading, - XHeight, - AverageCharWidth, - LineThickness, - UnderlinePosition, - MaxCharWidth, - MinLeftBearing, - MinRightBearing, - GlyphCount, - - // hints - CacheGlyphsHint, - OutlineGlyphsHint - }; - - // keep in sync with QTextEngine::ShaperFlag!! - enum TextShapingFlag { - RightToLeft = 0x0001, - ReturnDesignMetrics = 0x0002 - }; - Q_DECLARE_FLAGS(TextShapingFlags, TextShapingFlag) - - virtual Capabilities capabilities() const = 0; - virtual QVariant fontProperty(FontProperty property) const = 0; - - virtual bool convertStringToGlyphIndices(const QChar *string, int length, uint *glyphs, int *numGlyphs, TextShapingFlags flags) const = 0; - - virtual void getGlyphAdvances(const uint *glyphs, int numGlyphs, Fixed *advances, TextShapingFlags flags) const = 0; - - virtual GlyphMetrics glyphMetrics(uint glyph) const = 0; - - virtual bool renderGlyph(uint glyph, int depth, int bytesPerLine, int height, uchar *buffer); - - virtual void addGlyphOutlinesToPath(uint *glyphs, int numGlyphs, FixedPoint *positions, QPainterPath *path); - - /* - enum Extension { - GetTrueTypeTable - }; - - virtual bool supportsExtension(Extension extension) const; - virtual QVariant extension(Extension extension, const QVariant &argument = QVariant()); - */ - -private: - Q_DECLARE_PRIVATE(QAbstractFontEngine) - Q_DISABLE_COPY(QAbstractFontEngine) -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFontEngine::Capabilities) -Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFontEngine::TextShapingFlags) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index 12f3ed1217a..8e792e9b80a 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -122,6 +122,7 @@ protected: QTextCharFormat format(int pos); private: + friend class QWidgetTextControl; friend class QTextControl; friend class QTextDocument; friend class QTextDocumentPrivate; diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 028011bfe8c..6a28ff2d74c 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -1275,6 +1275,8 @@ void ValueExtractor::extractFont() bool ValueExtractor::extractImage(QIcon *icon, Qt::Alignment *a, QSize *size) { bool hit = false; +#if 0 + // ### Qt5 for (int i = 0; i < declarations.count(); ++i) { const Declaration &decl = declarations.at(i); switch (decl.d->propertyId) { @@ -1295,6 +1297,7 @@ bool ValueExtractor::extractImage(QIcon *icon, Qt::Alignment *a, QSize *size) } hit = true; } +#endif return hit; } @@ -1643,6 +1646,8 @@ void Declaration::borderImageValue(QString *image, int *cuts, *h = *v; } +#if 0 +// ### Qt 5 QIcon Declaration::iconValue() const { if (d->parsed.isValid()) @@ -1689,6 +1694,7 @@ QIcon Declaration::iconValue() const d->parsed = QVariant::fromValue(icon); return icon; } +#endif /////////////////////////////////////////////////////////////////////////////// // Selector diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index 9c974f773a6..4fa8bb0540f 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -61,9 +61,9 @@ #include #include #include -#include #include +class QIcon; #ifndef QT_NO_CSSPARSER @@ -416,7 +416,7 @@ struct BorderData { // 4. QVector - { prop1: value1; prop2: value2; } // 5. Declaration - prop1: value1; -struct Q_AUTOTEST_EXPORT Declaration +struct Q_GUI_EXPORT Declaration { struct DeclarationData : public QSharedData { @@ -453,7 +453,7 @@ struct Q_AUTOTEST_EXPORT Declaration QSize sizeValue() const; QRect rectValue() const; QString uriValue() const; - QIcon iconValue() const; +// QIcon iconValue() const; void borderImageValue(QString *image, int *cuts, TileMode *h, TileMode *v) const; }; @@ -552,7 +552,7 @@ struct BasicSelector Relation relationToNext; }; -struct Q_AUTOTEST_EXPORT Selector +struct Q_GUI_EXPORT Selector { QVector basicSelectors; int specificity() const; @@ -565,7 +565,7 @@ struct MediaRule; struct PageRule; struct ImportRule; -struct Q_AUTOTEST_EXPORT ValueExtractor +struct Q_GUI_EXPORT ValueExtractor { ValueExtractor(const QVector &declarations, const QPalette & = QPalette()); @@ -633,7 +633,7 @@ enum StyleSheetOrigin { StyleSheetOrigin_Inline }; -struct StyleSheet +struct Q_GUI_EXPORT StyleSheet { StyleSheet() : origin(StyleSheetOrigin_Unspecified), depth(0) { } QVector styleRules; //only contains rules that are not indexed @@ -739,7 +739,7 @@ struct Q_GUI_EXPORT Symbol QString lexem() const; }; -class Q_AUTOTEST_EXPORT Scanner +class Q_GUI_EXPORT Scanner { public: static QString preprocess(const QString &input, bool *hasEscapeSequences = 0); diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index cf97310ea32..e8308dba069 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -48,8 +48,9 @@ #include "qpainter.h" #include "qhash.h" #include "qdatastream.h" -#include "qapplication.h" +#include "qguiapplication.h" #include "qstringlist.h" +#include "qscreen.h" #include "qthread.h" #include "qthreadstorage.h" @@ -65,19 +66,12 @@ #include "qx11info_x11.h" #include #endif -#ifdef Q_WS_QWS -#include "qscreen_qws.h" -#if !defined(QT_NO_QWS_QPF2) -#include -#include "qfontengine_qpf_p.h" -#endif -#endif #ifdef Q_OS_SYMBIAN #include #endif #ifdef Q_WS_QPA #include -#include +#include #endif #include @@ -173,20 +167,11 @@ Q_GUI_EXPORT int qt_defaultDpiX() #elif defined(Q_WS_MAC) extern float qt_mac_defaultDpi_x(); //qpaintdevice_mac.cpp dpi = qt_mac_defaultDpi_x(); -#elif defined(Q_WS_QWS) - if (!qt_screen) - return 72; - QScreen *screen = qt_screen; - const QList subScreens = qt_screen->subScreens(); - if (!subScreens.isEmpty()) - screen = subScreens.at(0); - dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4))); #elif defined(Q_WS_QPA) - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - if (pi) { - QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); + QScreen *screen = QGuiApplication::primaryScreen(); + if (screen) { const QSize screenSize = screen->geometry().size(); - const QSize physicalSize = screen->physicalSize(); + const QSize physicalSize = screen->handle()->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 @@ -212,20 +197,11 @@ Q_GUI_EXPORT int qt_defaultDpiY() #elif defined(Q_WS_MAC) extern float qt_mac_defaultDpi_y(); //qpaintdevice_mac.cpp dpi = qt_mac_defaultDpi_y(); -#elif defined(Q_WS_QWS) - if (!qt_screen) - return 72; - QScreen *screen = qt_screen; - const QList subScreens = qt_screen->subScreens(); - if (!subScreens.isEmpty()) - screen = subScreens.at(0); - dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4))); #elif defined(Q_WS_QPA) - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - if (pi) { - QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0); + QScreen *screen = QGuiApplication::primaryScreen(); + if (screen) { const QSize screenSize = screen->geometry().size(); - const QSize physicalSize = screen->physicalSize(); + const QSize physicalSize = screen->handle()->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 @@ -453,9 +429,9 @@ QFontEngineData::~QFontEngineData() Use QFontMetrics to get measurements, e.g. the pixel length of a string using QFontMetrics::width(). - Note that a QApplication instance must exist before a QFont can be + Note that a QGuiApplication instance must exist before a QFont can be used. You can set the application's default font with - QApplication::setFont(). + QGuiApplication::setFont(). If a chosen font does not include all the characters that need to be displayed, QFont will try to find the characters in the @@ -786,10 +762,10 @@ void QFont::detach() /*! Constructs a font object that uses the application's default font. - \sa QApplication::setFont(), QApplication::font() + \sa QGuiApplication::setFont(), QGuiApplication::font() */ QFont::QFont() - : d(QApplication::font().d.data()), resolve_mask(0) + : d(QGuiApplication::font().d.data()), resolve_mask(0) { } @@ -809,7 +785,7 @@ QFont::QFont() algorithm. \sa Weight, setFamily(), setPointSize(), setWeight(), setItalic(), - setStyleHint() QApplication::font() + setStyleHint() QGuiApplication::font() */ QFont::QFont(const QString &family, int pointSize, int weight, bool italic) : d(new QFontPrivate()), resolve_mask(QFont::FamilyResolved) @@ -1133,18 +1109,6 @@ int QFont::pixelSize() const return d->request.pixelSize; } -#ifdef QT3_SUPPORT -/*! \obsolete - - Sets the logical pixel height of font characters when shown on - the screen to \a pixelSize. -*/ -void QFont::setPixelSizeFloat(qreal pixelSize) -{ - setPixelSize((int)pixelSize); -} -#endif - /*! \fn bool QFont::italic() const @@ -1912,43 +1876,6 @@ QFont QFont::resolve(const QFont &other) const \internal */ -#ifdef QT3_SUPPORT - -/*! \obsolete - - Please use QApplication::font() instead. -*/ -QFont QFont::defaultFont() -{ - return QApplication::font(); -} - -/*! \obsolete - - Please use QApplication::setFont() instead. -*/ -void QFont::setDefaultFont(const QFont &f) -{ - QApplication::setFont(f); -} - -/*! - \fn qreal QFont::pointSizeFloat() const - \compat - - Use pointSizeF() instead. -*/ - -/*! - \fn void QFont::setPointSizeFloat(qreal size) - \compat - - Use setPointSizeF() instead. -*/ -#endif - - - /***************************************************************************** QFont substitution management diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 14f290ceb3d..421c1dd2de9 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -287,14 +287,6 @@ public: inline uint resolve() const { return resolve_mask; } inline void resolve(uint mask) { resolve_mask = mask; } -#ifdef QT3_SUPPORT - static QT3_SUPPORT QFont defaultFont(); - static QT3_SUPPORT void setDefaultFont(const QFont &); - QT3_SUPPORT void setPixelSizeFloat(qreal); - QT3_SUPPORT qreal pointSizeFloat() const { return pointSizeF(); } - QT3_SUPPORT void setPointSizeFloat(qreal size) { setPointSizeF(size); } -#endif - private: QFont(QFontPrivate *); @@ -324,7 +316,7 @@ private: friend class QStackTextEngine; friend class QTextLine; friend struct QScriptLine; - friend class QGLContext; + friend class QOpenGLContext; friend class QWin32PaintEngine; friend class QAlphaPaintEngine; friend class QPainterPath; diff --git a/src/gui/text/qfont_qpa.cpp b/src/gui/text/qfont_qpa.cpp index 54ef9119e0b..e151a389cd6 100644 --- a/src/gui/text/qfont_qpa.cpp +++ b/src/gui/text/qfont_qpa.cpp @@ -39,13 +39,14 @@ ** ****************************************************************************/ -#include +#include #include QT_BEGIN_NAMESPACE void QFont::initialize() { + QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase(); } void QFont::cleanup() @@ -89,7 +90,7 @@ QString QFont::defaultFamily() const familyName = QString::fromLatin1("helvetica"); } - QStringList list = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(familyName,QFont::StyleNormal,QFont::StyleHint(d->request.styleHint),QUnicodeTables::Common); + QStringList list = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(familyName,QFont::StyleNormal,QFont::StyleHint(d->request.styleHint),QUnicodeTables::Common); if (list.size()) { familyName = list.at(0); } diff --git a/src/gui/text/qfont_qws.cpp b/src/gui/text/qfont_qws.cpp deleted file mode 100644 index 3674e178eae..00000000000 --- a/src/gui/text/qfont_qws.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwidget.h" -#include "qpainter.h" -#include "qfont_p.h" -#include -#include "qfontdatabase.h" -#include "qtextcodec.h" -#include "qapplication.h" -#include "qfile.h" -#include "qtextstream.h" -#include "qmap.h" -//#include "qmemorymanager_qws.h" -#include "qtextengine_p.h" -#include "qfontengine_p.h" -#if !defined(QT_NO_FREETYPE) -#include "qfontengine_ft_p.h" -#endif - -QT_BEGIN_NAMESPACE - -void QFont::initialize() -{ } - -void QFont::cleanup() -{ - QFontCache::cleanup(); -} - - -/***************************************************************************** - QFont member functions - *****************************************************************************/ - -Qt::HANDLE QFont::handle() const -{ -#ifndef QT_NO_FREETYPE - return freetypeFace(); -#endif - return 0; -} - -FT_Face QFont::freetypeFace() const -{ -#ifndef QT_NO_FREETYPE - QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); - if (engine->type() == QFontEngine::Multi) - engine = static_cast(engine)->engine(0); - if (engine->type() == QFontEngine::Freetype) { - const QFontEngineFT *ft = static_cast(engine); - return ft->non_locked_face(); - } -#endif - return 0; -} - -QString QFont::rawName() const -{ - return QLatin1String("unknown"); -} - -void QFont::setRawName(const QString &) -{ -} - -QString QFont::defaultFamily() const -{ - switch(d->request.styleHint) { - case QFont::Times: - return QString::fromLatin1("times"); - case QFont::Courier: - case QFont::Monospace: - return QString::fromLatin1("courier"); - case QFont::Decorative: - return QString::fromLatin1("old english"); - case QFont::Helvetica: - case QFont::System: - default: - return QString::fromLatin1("helvetica"); - } -} - -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 6202fbac529..fa67dc1a8a6 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -43,7 +43,7 @@ #include "qfontdatabase.h" #include "qdebug.h" #include "qalgorithms.h" -#include "qapplication.h" +#include "qguiapplication.h" #include "qvarlengtharray.h" // here or earlier - workaround for VC++6 #include "qthread.h" #include "qmutex.h" @@ -51,7 +51,7 @@ #include "qfontengine_p.h" #ifdef Q_WS_QPA -#include +#include #include #include "qabstractfileengine.h" #endif @@ -103,34 +103,34 @@ static int getFontWeight(const QString &weightString) // Test in decreasing order of commonness if (s == QLatin1String("medium") || s == QLatin1String("normal") - || s.compare(QApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0) + || s.compare(QCoreApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0) return QFont::Normal; if (s == QLatin1String("bold") - || s.compare(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0) + || s.compare(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0) return QFont::Bold; if (s == QLatin1String("demibold") || s == QLatin1String("demi bold") - || s.compare(QApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0) + || s.compare(QCoreApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0) return QFont::DemiBold; if (s == QLatin1String("black") - || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0) + || s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0) return QFont::Black; if (s == QLatin1String("light")) return QFont::Light; if (s.contains(QLatin1String("bold")) - || s.contains(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) { + || s.contains(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) { if (s.contains(QLatin1String("demi")) - || s.compare(QApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0) + || s.compare(QCoreApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0) return (int) QFont::DemiBold; return (int) QFont::Bold; } if (s.contains(QLatin1String("light")) - || s.compare(QApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0) + || s.compare(QCoreApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0) return (int) QFont::Light; if (s.contains(QLatin1String("black")) - || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0) + || s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0) return (int) QFont::Black; return (int) QFont::Normal; @@ -262,7 +262,7 @@ struct QtFontStyle pixelSizes[count].fileName.~QByteArray(); #endif #if defined (Q_WS_QPA) - QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); + QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration(); if (integration) { //on shut down there will be some that we don't release. integration->fontDatabase()->releaseHandle(pixelSizes[count].handle); } @@ -296,10 +296,10 @@ QtFontStyle::Key::Key(const QString &styleString) weight = getFontWeight(styleString); if (styleString.contains(QLatin1String("Italic")) - || styleString.contains(QApplication::translate("QFontDatabase", "Italic"))) + || styleString.contains(QCoreApplication::translate("QFontDatabase", "Italic"))) style = QFont::StyleItalic; else if (styleString.contains(QLatin1String("Oblique")) - || styleString.contains(QApplication::translate("QFontDatabase", "Oblique"))) + || styleString.contains(QCoreApplication::translate("QFontDatabase", "Oblique"))) style = QFont::StyleOblique; } @@ -755,7 +755,7 @@ void QFontDatabasePrivate::invalidate() { QFontCache::instance()->clear(); free(); - emit static_cast(QApplication::instance())->fontDatabaseChanged(); + emit static_cast(QCoreApplication::instance())->fontDatabaseChanged(); } QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create) @@ -1520,21 +1520,21 @@ static QString styleStringHelper(int weight, QFont::Style style) { QString result; if (weight >= QFont::Black) - result = QApplication::translate("QFontDatabase", "Black"); + result = QCoreApplication::translate("QFontDatabase", "Black"); else if (weight >= QFont::Bold) - result = QApplication::translate("QFontDatabase", "Bold"); + result = QCoreApplication::translate("QFontDatabase", "Bold"); else if (weight >= QFont::DemiBold) - result = QApplication::translate("QFontDatabase", "Demi Bold"); + result = QCoreApplication::translate("QFontDatabase", "Demi Bold"); else if (weight < QFont::Normal) - result = QApplication::translate("QFontDatabase", "Light"); + result = QCoreApplication::translate("QFontDatabase", "Light"); if (style == QFont::StyleItalic) - result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Italic"); + result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic"); else if (style == QFont::StyleOblique) - result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Oblique"); + result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique"); if (result.isEmpty()) - result = QApplication::translate("QFontDatabase", "Normal"); + result = QCoreApplication::translate("QFontDatabase", "Normal"); return result.simplified(); } @@ -2026,7 +2026,7 @@ QFont QFontDatabase::font(const QString &family, const QString &style, QtFontFoundry allStyles(foundryName); QtFontFamily *f = d->family(familyName); - if (!f) return QApplication::font(); + if (!f) return QGuiApplication::font(); for (int j = 0; j < f->count; j++) { QtFontFoundry *foundry = f->foundries[j]; @@ -2040,7 +2040,7 @@ QFont QFontDatabase::font(const QString &family, const QString &style, QtFontStyle *s = bestStyle(&allStyles, styleKey, style); if (!s) // no styles found? - return QApplication::font(); + return QGuiApplication::font(); QFont fnt(family, pointSize, s->key.weight); fnt.setStyle((QFont::Style)s->key.style); @@ -2363,7 +2363,7 @@ QString QFontDatabase::writingSystemName(WritingSystem writingSystem) Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter"); break; } - return QApplication::translate("QFontDatabase", name); + return QCoreApplication::translate("QFontDatabase", name); } diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index b1f370e6d16..994a7a4a7d0 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -45,10 +45,6 @@ #include #include #include -#ifdef QT3_SUPPORT -#include -#include -#endif QT_BEGIN_HEADER diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index 032a42b9b17..c0edce1009b 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -45,7 +45,7 @@ #include "qfontengine_qpa_p.h" #include "qplatformdefs.h" -#include +#include #include #include @@ -82,7 +82,7 @@ Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &fou static QStringList fallbackFamilies(const QString &family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) { - QStringList retList = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script); + QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script); QFontDatabasePrivate *db = privateDb(); QStringList::iterator i; @@ -109,28 +109,11 @@ static void initializeDb() if (!initialized) { //init by asking for the platformfontdb for the first time :) - QApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase(); + QGuiApplicationPrivate::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(); @@ -155,7 +138,7 @@ QFontEngine *loadSingleEngine(int script, QFontCache::Key key(def,script); QFontEngine *engine = QFontCache::instance()->findEngine(key); if (!engine) { - QPlatformFontDatabase *pfdb = QApplicationPrivate::platformIntegration()->fontDatabase(); + QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); engine = pfdb->fontEngine(def,QUnicodeTables::Script(script),size->handle); if (engine) { QFontCache::Key key(def,script); @@ -173,7 +156,7 @@ QFontEngine *loadEngine(int script, const QFontDef &request, QFontEngine *engine = loadSingleEngine(script, request, foundry, style, size); //make sure that the db has all fallback families - if (engine + if (engine && engine->type() != QFontEngine::Multi && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol ) { if (family && !family->askedForFallback) { @@ -200,7 +183,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) { QFontDatabasePrivate *db = privateDb(); - fnt->families = QApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName); + fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName); db->reregisterAppFonts = true; } @@ -359,7 +342,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) family_list = familyList(req); // add the default family - QString defaultFamily = QApplication::font().family(); + QString defaultFamily = QGuiApplication::font().family(); if (! family_list.contains(defaultFamily)) family_list << defaultFamily; diff --git a/src/gui/text/qfontdatabase_qws.cpp b/src/gui/text/qfontdatabase_qws.cpp deleted file mode 100644 index c83e9297d98..00000000000 --- a/src/gui/text/qfontdatabase_qws.cpp +++ /dev/null @@ -1,972 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#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 -#if !defined(QT_NO_FREETYPE) -#include "qfontengine_ft_p.h" - -#include -#include FT_FREETYPE_H - -#endif -#include "qfontengine_qpf_p.h" -#include "private/qfactoryloader_p.h" -#include "private/qcore_unix_p.h" // overrides QT_OPEN -#include "qabstractfontengine_qws.h" -#include "qabstractfontengine_p.h" -#include -#include "qplatformdefs.h" - -// for mmap -#include -#include -#include -#include -#include -#include -#include - -#ifdef QT_FONTS_ARE_RESOURCES -#include -#endif - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_LIBRARY -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QFontEngineFactoryInterface_iid, QLatin1String("/fontengines"), Qt::CaseInsensitive)) -#endif - -const quint8 DatabaseVersion = 4; - -// QFontDatabasePrivate::addFont() went into qfontdatabase.cpp - -#ifndef QT_NO_QWS_QPF2 -void QFontDatabasePrivate::addQPF2File(const QByteArray &file) -{ -#ifndef QT_FONTS_ARE_RESOURCES - struct stat st; - if (stat(file.constData(), &st)) - return; - int f = QT_OPEN(file, O_RDONLY, 0); - if (f < 0) - return; - const uchar *data = (const uchar *)mmap(0, st.st_size, PROT_READ, MAP_SHARED, f, 0); - const int dataSize = st.st_size; -#else - QResource res(QLatin1String(file.constData())); - const uchar *data = res.data(); - const int dataSize = res.size(); - //qDebug() << "addQPF2File" << file << data; -#endif - if (data && data != (const uchar *)MAP_FAILED) { - if (QFontEngineQPF::verifyHeader(data, dataSize)) { - QString fontName = QFontEngineQPF::extractHeaderField(data, QFontEngineQPF::Tag_FontName).toString(); - int pixelSize = QFontEngineQPF::extractHeaderField(data, QFontEngineQPF::Tag_PixelSize).toInt(); - QVariant weight = QFontEngineQPF::extractHeaderField(data, QFontEngineQPF::Tag_Weight); - QVariant style = QFontEngineQPF::extractHeaderField(data, QFontEngineQPF::Tag_Style); - QByteArray writingSystemBits = QFontEngineQPF::extractHeaderField(data, QFontEngineQPF::Tag_WritingSystems).toByteArray(); - - if (!fontName.isEmpty() && pixelSize) { - int fontWeight = 50; - if (weight.type() == QVariant::Int || weight.type() == QVariant::UInt) - fontWeight = weight.toInt(); - - bool italic = static_cast(style.toInt()) & QFont::StyleItalic; - - QList 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 << QFontDatabase::WritingSystem(i * 8 + j); - currentByte >>= 1; - } - } - - addFont(fontName, /*foundry*/ "prerendered", fontWeight, italic, - pixelSize, file, /*fileIndex*/ 0, - /*antialiased*/ true, writingSystems); - } - } else { - qDebug() << "header verification of QPF2 font" << file << "failed. maybe it is corrupt?"; - } -#ifndef QT_FONTS_ARE_RESOURCES - munmap((void *)data, st.st_size); -#endif - } -#ifndef QT_FONTS_ARE_RESOURCES - QT_CLOSE(f); -#endif -} -#endif // QT_NO_QWS_QPF2 - -// QFontDatabasePrivate::addTTFile() went into qfontdatabase.cpp - -static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt); - -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"); - - QFile binaryDb(qws_fontCacheDir() + QLatin1String("/fontdb")); - - if (weAreTheServer) { - QDateTime dbTimeStamp = QFileInfo(binaryDb.fileName()).lastModified(); - - QDateTime fontPathTimeStamp = QFileInfo(fontPath).lastModified(); - if (dbTimeStamp < fontPathTimeStamp) - return false; // let the caller create the cache - - if (QFile::exists(fontDirFile)) { - QDateTime fontDirTimeStamp = QFileInfo(fontDirFile).lastModified(); - if (dbTimeStamp < fontDirTimeStamp) - return false; - } - } - - if (!binaryDb.open(QIODevice::ReadOnly)) { - if (weAreTheServer) - return false; // let the caller create the cache - qFatal("QFontDatabase::loadFromCache: Could not open font database cache!"); - } - - QDataStream stream(&binaryDb); - quint8 version = 0; - quint8 dataStreamVersion = 0; - stream >> version >> dataStreamVersion; - if (version != DatabaseVersion || dataStreamVersion != stream.version()) { - if (weAreTheServer) - return false; // let the caller create the cache - qFatal("QFontDatabase::loadFromCache: Wrong version of the font database cache detected. Found %d/%d expected %d/%d", - version, dataStreamVersion, DatabaseVersion, stream.version()); - } - - QString originalFontPath; - stream >> originalFontPath; - if (originalFontPath != fontPath) { - if (weAreTheServer) - return false; // let the caller create the cache - qFatal("QFontDatabase::loadFromCache: Font path doesn't match. Found %s in database, expected %s", qPrintable(originalFontPath), qPrintable(fontPath)); - } - - QString familyname; - stream >> familyname; - //qDebug() << "populating database from" << binaryDb.fileName(); - while (!familyname.isEmpty() && !stream.atEnd()) { - QString foundryname; - int weight; - quint8 italic; - int pixelSize; - QByteArray file; - int fileIndex; - quint8 antialiased; - quint8 writingSystemCount; - - QList writingSystems; - - stream >> foundryname >> weight >> italic >> pixelSize - >> file >> fileIndex >> antialiased >> writingSystemCount; - - for (quint8 i = 0; i < writingSystemCount; ++i) { - quint8 ws; - stream >> ws; - writingSystems.append(QFontDatabase::WritingSystem(ws)); - } - - addFont(familyname, foundryname.toLatin1().constData(), weight, italic, pixelSize, file, fileIndex, antialiased, - writingSystems); - - stream >> familyname; - } - - stream >> fallbackFamilies; - //qDebug() << "fallback families from cache:" << fallbackFamilies; - return true; -} -#endif // QT_FONTS_ARE_RESOURCES - -/*! - \internal -*/ - -static QString qwsFontPath() -{ - QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QWS_FONTDIR")); - if (fontpath.isEmpty()) { -#ifdef QT_FONTS_ARE_RESOURCES - fontpath = QLatin1String(":/qt/fonts"); -#else -#ifndef QT_NO_SETTINGS - fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath); - fontpath += QLatin1String("/fonts"); -#else - fontpath = QLatin1String("/lib/fonts"); -#endif -#endif //QT_FONTS_ARE_RESOURCES - } - - return fontpath; -} - -#if defined(QFONTDATABASE_DEBUG) && defined(QT_FONTS_ARE_RESOURCES) -class FriendlyResource : public QResource -{ -public: - bool isDir () const { return QResource::isDir(); } - bool isFile () const { return QResource::isFile(); } - QStringList children () const { return QResource::children(); } -}; -#endif -/*! - \internal -*/ -static void initializeDb() -{ - QFontDatabasePrivate *db = privateDb(); - if (!db || db->count) - return; - - QString fontpath = qwsFontPath(); -#ifndef QT_FONTS_ARE_RESOURCES - QString fontDirFile = fontpath + QLatin1String("/fontdir"); - - if(!QFile::exists(fontpath)) { - qFatal("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?", - fontpath.toLocal8Bit().constData()); - } - - const bool loaded = db->loadFromCache(fontpath); - - if (db->reregisterAppFonts) { - db->reregisterAppFonts = false; - for (int i = 0; i < db->applicationFonts.count(); ++i) - if (!db->applicationFonts.at(i).families.isEmpty()) { - registerFont(&db->applicationFonts[i]); - } - } - - if (loaded) - return; - - QString dbFileName = qws_fontCacheDir() + QLatin1String("/fontdb"); - - QFile binaryDb(dbFileName + QLatin1String(".tmp")); - binaryDb.open(QIODevice::WriteOnly | QIODevice::Truncate); - db->stream = new QDataStream(&binaryDb); - *db->stream << DatabaseVersion << quint8(db->stream->version()) << fontpath; -// qDebug() << "creating binary database at" << binaryDb.fileName(); - - // Load in font definition file - FILE* fontdef=fopen(fontDirFile.toLocal8Bit().constData(),"r"); - if (fontdef) { - char buf[200]=""; - char name[200]=""; - char render[200]=""; - char file[200]=""; - char isitalic[10]=""; - char flags[10]=""; - do { - fgets(buf,200,fontdef); - if (buf[0] != '#') { - int weight=50; - int size=0; - sscanf(buf,"%s %s %s %s %d %d %s",name,file,render,isitalic,&weight,&size,flags); - QString filename; - if (file[0] != '/') - filename.append(fontpath).append(QLatin1Char('/')); - filename += QLatin1String(file); - bool italic = isitalic[0] == 'y'; - bool smooth = QByteArray(flags).contains('s'); - if (file[0] && QFile::exists(filename)) - db->addFont(QString::fromUtf8(name), /*foundry*/"", weight, italic, size/10, QFile::encodeName(filename), /*fileIndex*/ 0, smooth); - } - } while (!feof(fontdef)); - fclose(fontdef); - } - - - QDir dir(fontpath, QLatin1String("*.qpf")); - for (int i=0; iaddFont(familyname, /*foundry*/ "qt", weight, italic, pixelSize, QFile::encodeName(dir.absoluteFilePath(dir[i])), - /*fileIndex*/ 0, /*antialiased*/ true); - } - -#ifndef QT_NO_FREETYPE - 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; - db->addTTFile(file); - } -#endif - -#ifndef QT_NO_QWS_QPF2 - dir.setNameFilters(QStringList() << QLatin1String("*.qpf2")); - dir.refresh(); - 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 - -#else //QT_FONTS_ARE_RESOURCES -#ifdef QFONTDATABASE_DEBUG - { - QResource fontdir(fontpath); - FriendlyResource *fr = static_cast(&fontdir); - qDebug() << "fontdir" << fr->isValid() << fr->isDir() << fr->children(); - - } -#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 - - -#ifdef QFONTDATABASE_DEBUG - // print the database - for (int f = 0; f < db->count; f++) { - QtFontFamily *family = db->families[f]; - FD_DEBUG("'%s' %s", qPrintable(family->name), (family->fixedPitch ? "fixed" : "")); -#if 0 - for (int i = 0; i < QFont::LastPrivateScript; ++i) { - FD_DEBUG("\t%s: %s", qPrintable(QFontDatabase::scriptName((QFont::Script) i)), - ((family->scripts[i] & QtFontFamily::Supported) ? "Supported" : - (family->scripts[i] & QtFontFamily::UnSupported) == QtFontFamily::UnSupported ? - "UnSupported" : "Unknown")); - } -#endif - - for (int fd = 0; fd < family->count; fd++) { - QtFontFoundry *foundry = family->foundries[fd]; - FD_DEBUG("\t\t'%s'", qPrintable(foundry->name)); - for (int s = 0; s < foundry->count; s++) { - QtFontStyle *style = foundry->styles[s]; - FD_DEBUG("\t\t\tstyle: style=%d weight=%d\n" - "\t\t\tstretch=%d", - style->key.style, style->key.weight, - style->key.stretch); - if (style->smoothScalable) - FD_DEBUG("\t\t\t\tsmooth scalable"); - else if (style->bitmapScalable) - FD_DEBUG("\t\t\t\tbitmap scalable"); - if (style->pixelSizes) { - FD_DEBUG("\t\t\t\t%d pixel sizes", style->count); - for (int z = 0; z < style->count; ++z) { - QtFontSize *size = style->pixelSizes + z; - FD_DEBUG("\t\t\t\t size %5d", - size->pixelSize); - } - } - } - } - } -#endif // QFONTDATABASE_DEBUG - -#ifndef QT_NO_LIBRARY - QStringList pluginFoundries = loader()->keys(); -// qDebug() << "plugin foundries:" << pluginFoundries; - for (int i = 0; i < pluginFoundries.count(); ++i) { - const QString foundry(pluginFoundries.at(i)); - - QFontEngineFactoryInterface *factory = qobject_cast(loader()->instance(foundry)); - if (!factory) { - qDebug() << "Could not load plugin for foundry" << foundry; - continue; - } - - QList fonts = factory->availableFontEngines(); - for (int i = 0; i < fonts.count(); ++i) { - QFontEngineInfo info = fonts.at(i); - - int weight = info.weight(); - if (weight <= 0) - weight = QFont::Normal; - - db->addFont(info.family(), foundry.toLatin1().constData(), - weight, info.style() != QFont::StyleNormal, - qRound(info.pixelSize()), /*file*/QByteArray(), - /*fileIndex*/0, /*antiAliased*/true, - info.writingSystems()); - } - } -#endif - -#ifndef QT_FONTS_ARE_RESOURCES - // the empty string/familyname signifies the end of the font list. - *db->stream << QString(); -#endif - { - bool coveredWritingSystems[QFontDatabase::WritingSystemsCount] = { 0 }; - - db->fallbackFamilies.clear(); - - for (int i = 0; i < db->count; ++i) { - QtFontFamily *family = db->families[i]; - bool add = false; - if (family->count == 0) - continue; - if (family->bogusWritingSystems) - continue; - for (int ws = 1; ws < QFontDatabase::WritingSystemsCount; ++ws) { - if (coveredWritingSystems[ws]) - continue; - if (family->writingSystems[ws] & QtFontFamily::Supported) { - coveredWritingSystems[ws] = true; - add = true; - } - } - if (add) - db->fallbackFamilies << family->name; - } - //qDebug() << "fallbacks on the server:" << db->fallbackFamilies; -#ifndef QT_FONTS_ARE_RESOURCES - *db->stream << db->fallbackFamilies; -#endif - } -#ifndef QT_FONTS_ARE_RESOURCES - delete db->stream; - db->stream = 0; - QFile::remove(dbFileName); - binaryDb.rename(dbFileName); -#endif -} - -// called from qwindowsystem_qws.cpp -void qt_qws_init_fontdb() -{ - initializeDb(); -} - -#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(); -} - -#ifndef QT_NO_FREETYPE - -#if (FREETYPE_MAJOR*10000+FREETYPE_MINOR*100+FREETYPE_PATCH) >= 20105 -#define X_SIZE(face,i) ((face)->available_sizes[i].x_ppem) -#define Y_SIZE(face,i) ((face)->available_sizes[i].y_ppem) -#else -#define X_SIZE(face,i) ((face)->available_sizes[i].width << 6) -#define Y_SIZE(face,i) ((face)->available_sizes[i].height << 6) -#endif - -#endif // QT_NO_FREETYPE - -static -QFontEngine *loadSingleEngine(int script, const QFontPrivate *fp, - const QFontDef &request, - QtFontFamily *family, QtFontFoundry *foundry, - QtFontStyle *style, QtFontSize *size) -{ - Q_UNUSED(script); - Q_UNUSED(fp); -#ifdef QT_NO_FREETYPE - Q_UNUSED(foundry); -#endif -#ifdef QT_NO_QWS_QPF - Q_UNUSED(family); -#endif - Q_ASSERT(size); - - int pixelSize = size->pixelSize; - if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE)) - pixelSize = request.pixelSize; - -#ifndef QT_NO_QWS_QPF2 - if (foundry->name == QLatin1String("prerendered")) { -#ifdef QT_FONTS_ARE_RESOURCES - QResource res(QLatin1String(size->fileName.constData())); - if (res.isValid()) { - QFontEngineQPF *fe = new QFontEngineQPF(request, res.data(), res.size()); - if (fe->isValid()) - return fe; - delete fe; - qDebug() << "fontengine is not valid! " << size->fileName; - } else { - qDebug() << "Resource not valid" << size->fileName; - } -#else - int f = ::open(size->fileName, O_RDONLY, 0); - if (f >= 0) { - QFontEngineQPF *fe = new QFontEngineQPF(request, f); - if (fe->isValid()) - return fe; - delete fe; // will close f - qDebug() << "fontengine is not valid!"; - } -#endif - } else -#endif - if ( foundry->name != QLatin1String("qt") ) { ///#### is this the best way???? - QString file = QFile::decodeName(size->fileName); - - QFontDef def = request; - def.pixelSize = pixelSize; - -#ifdef QT_NO_QWS_SHARE_FONTS - bool shareFonts = false; -#else - static bool dontShareFonts = !qgetenv("QWS_NO_SHARE_FONTS").isEmpty(); - bool shareFonts = !dontShareFonts; -#endif - - QScopedPointer engine; - -#ifndef QT_NO_LIBRARY - QFontEngineFactoryInterface *factory = qobject_cast(loader()->instance(foundry->name)); - if (factory) { - QFontEngineInfo info; - info.setFamily(request.family); - info.setPixelSize(request.pixelSize); - info.setStyle(QFont::Style(request.style)); - info.setWeight(request.weight); - // #### antialiased - - QAbstractFontEngine *customEngine = factory->create(info); - if (customEngine) { - engine.reset(new QProxyFontEngine(customEngine, def)); - - if (shareFonts) { - QVariant hint = customEngine->fontProperty(QAbstractFontEngine::CacheGlyphsHint); - if (hint.isValid()) - shareFonts = hint.toBool(); - else - shareFonts = (pixelSize < 64); - } - } - } -#endif // QT_NO_LIBRARY - if ((engine.isNull() && !file.isEmpty() && QFile::exists(file)) || privateDb()->isApplicationFont(file)) { - QFontEngine::FaceId faceId; - faceId.filename = file.toLocal8Bit(); - faceId.index = size->fileIndex; - -#ifndef QT_NO_FREETYPE - - QScopedPointer fte(new QFontEngineFT(def)); - bool antialias = style->antialiased && !(request.styleStrategy & QFont::NoAntialias); - if (fte->init(faceId, antialias, - antialias ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono)) { -#ifdef QT_NO_QWS_QPF2 - return fte.take(); -#else - // try to distinguish between bdf and ttf fonts we can pre-render - // and don't try to share outline fonts - shareFonts = shareFonts - && !fte->defaultGlyphs()->outline_drawing - && !fte->getSfntTable(MAKE_TAG('h', 'e', 'a', 'd')).isEmpty(); - engine.reset(fte.take()); -#endif - } -#endif // QT_NO_FREETYPE - } - if (!engine.isNull()) { -#if !defined(QT_NO_QWS_QPF2) && !defined(QT_FONTS_ARE_RESOURCES) - if (shareFonts) { - QScopedPointer fe(new QFontEngineQPF(def, -1, engine.data())); - engine.take(); - if (fe->isValid()) - return fe.take(); - qWarning("Initializing QFontEngineQPF failed for %s", qPrintable(file)); - engine.reset(fe->takeRenderingEngine()); - } -#endif - return engine.take(); - } - } else - { -#ifndef QT_NO_QWS_QPF - QString fn = qwsFontPath(); - fn += QLatin1Char('/'); - fn += family->name.toLower() - + QLatin1Char('_') + QString::number(pixelSize*10) - + QLatin1Char('_') + QString::number(style->key.weight) - + (style->key.style == QFont::StyleItalic ? - QLatin1String("i.qpf") : QLatin1String(".qpf")); - //###rotation ### - - QFontEngine *fe = new QFontEngineQPF1(request, fn); - return fe; -#endif // QT_NO_QWS_QPF - } - return new QFontEngineBox(pixelSize); -} - -static -QFontEngine *loadEngine(int script, const QFontPrivate *fp, - const QFontDef &request, - QtFontFamily *family, QtFontFoundry *foundry, - QtFontStyle *style, QtFontSize *size) -{ - 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) { - - QStringList fallbacks = privateDb()->fallbackFamilies; - - if (family && !family->fallbackFamilies.isEmpty()) - fallbacks = family->fallbackFamilies; - - QFontEngine *fe = new QFontEngineMultiQWS(engine.data(), script, fallbacks); - engine.take(); - engine.reset(fe); - } -#endif - return engine.take(); -} - -static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) -{ - QFontDatabasePrivate *db = privateDb(); -#ifdef QT_NO_FREETYPE - Q_UNUSED(fnt); -#else - fnt->families = db->addTTFile(QFile::encodeName(fnt->fileName), fnt->data); - db->fallbackFamilies += fnt->families; -#endif - 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; -} - -QFontEngine * -QFontDatabase::findFont(int script, const QFontPrivate *fp, - const QFontDef &request) -{ - QMutexLocker locker(fontDatabaseMutex()); - - const int force_encoding_id = -1; - - if (!privateDb()->count) - initializeDb(); - - QScopedPointer fe; - if (fp) { - if (fp->rawMode) { - fe.reset(loadEngine(script, fp, request, 0, 0, 0, 0)); - - // if we fail to load the rawmode font, use a 12pixel box engine instead - if (fe.isNull()) - fe.reset(new QFontEngineBox(12)); - return fe.take(); - } - - QFontCache::Key key(request, script); - fe.reset(QFontCache::instance()->findEngine(key)); - if (! fe.isNull()) - return fe.take(); - } - - QString family_name, foundry_name; - QtFontStyle::Key styleKey; - styleKey.style = request.style; - styleKey.weight = request.weight; - styleKey.stretch = request.stretch; - char pitch = request.ignorePitch ? '*' : request.fixedPitch ? 'm' : 'p'; - - parseFontName(request.family, foundry_name, family_name); - - FM_DEBUG("QFontDatabase::findFont\n" - " request:\n" - " family: %s [%s], script: %d\n" - " weight: %d, style: %d\n" - " stretch: %d\n" - " pixelSize: %g\n" - " pitch: %c", - family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), - foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), - script, request.weight, request.style, request.stretch, request.pixelSize, pitch); - - if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) { - fe.reset(new QTestFontEngine(request.pixelSize)); - fe->fontDef = request; - } - - if (fe.isNull()) - { - QtFontDesc desc; - match(script, request, family_name, foundry_name, force_encoding_id, &desc); - - if (desc.family != 0 && desc.foundry != 0 && desc.style != 0 - ) { - FM_DEBUG(" BEST:\n" - " family: %s [%s]\n" - " weight: %d, style: %d\n" - " stretch: %d\n" - " pixelSize: %d\n" - " pitch: %c\n" - " encoding: %d\n", - desc.family->name.toLatin1().constData(), - desc.foundry->name.isEmpty() ? "-- none --" : desc.foundry->name.toLatin1().constData(), - desc.style->key.weight, desc.style->key.style, - desc.style->key.stretch, desc.size ? desc.size->pixelSize : 0xffff, - 'p', 0 - ); - - fe.reset(loadEngine(script, fp, request, desc.family, desc.foundry, desc.style, desc.size - )); - } else { - FM_DEBUG(" NO MATCH FOUND\n"); - } - if (! fe.isNull()) - initFontDef(desc, request, &fe->fontDef); - } - -#ifndef QT_NO_FREETYPE - if (! fe.isNull()) { - if (scriptRequiresOpenType(script) && fe->type() == QFontEngine::Freetype) { - HB_Face hbFace = static_cast(fe.data())->harfbuzzFace(); - if (!hbFace || !hbFace->supported_scripts[script]) { - FM_DEBUG(" OpenType support missing for script\n"); - fe.reset(0); - } - } - } -#endif - - if (! fe.isNull()) { - if (fp) { - QFontDef def = request; - if (def.family.isEmpty()) { - def.family = fp->request.family; - def.family = def.family.left(def.family.indexOf(QLatin1Char(','))); - } - QFontCache::Key key(def, script); - QFontCache::instance()->insertEngine(key, fe.data()); - } - } - - if (fe.isNull()) { - if (!request.family.isEmpty()) - return 0; - - FM_DEBUG("returning box engine"); - - fe.reset(new QFontEngineBox(request.pixelSize)); - - if (fp) { - QFontCache::Key key(request, script); - QFontCache::instance()->insertEngine(key, fe.data()); - } - } - - if (fp && fp->dpi > 0) { - fe->fontDef.pointSize = qreal(double((fe->fontDef.pixelSize * 72) / fp->dpi)); - } else { - fe->fontDef.pointSize = request.pointSize; - } - - return fe.take(); -} - -void QFontDatabase::load(const QFontPrivate *d, int script) -{ - QFontDef req = d->request; - - if (req.pixelSize == -1) - req.pixelSize = qRound(req.pointSize*d->dpi/72); - if (req.pointSize < 0) - req.pointSize = req.pixelSize*72.0/d->dpi; - - if (!d->engineData) { - QFontCache::Key key(req, script); - - // look for the requested font in the engine data cache - d->engineData = QFontCache::instance()->findEngineData(key); - - if (!d->engineData) { - // create a new one - d->engineData = new QFontEngineData; - QT_TRY { - QFontCache::instance()->insertEngineData(key, d->engineData); - } QT_CATCH(...) { - delete d->engineData; - d->engineData = 0; - QT_RETHROW; - } - } else { - d->engineData->ref.ref(); - } - } - - // the cached engineData could have already loaded the engine we want - if (d->engineData->engines[script]) return; - - // double scale = 1.0; // ### TODO: fix the scale calculations - - // list of families to try - QStringList family_list; - - if (!req.family.isEmpty()) { - family_list = req.family.split(QLatin1Char(',')); - - // append the substitute list for each family in family_list - QStringList subs_list; - QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd(); - for (; it != end; ++it) - subs_list += QFont::substitutes(*it); - family_list += subs_list; - - // append the default fallback font for the specified script - // family_list << ... ; ########### - - // add the default family - QString defaultFamily = QApplication::font().family(); - if (! family_list.contains(defaultFamily)) - family_list << defaultFamily; - - // add QFont::defaultFamily() to the list, for compatibility with - // previous versions - family_list << QApplication::font().defaultFamily(); - } - - // null family means find the first font matching the specified script - family_list << QString(); - - // load the font - QFontEngine *engine = 0; - QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd(); - for (; !engine && it != end; ++it) { - req.family = *it; - - engine = QFontDatabase::findFont(script, d, req); - if (engine && (engine->type()==QFontEngine::Box) && !req.family.isEmpty()) - engine = 0; - } - - engine->ref.ref(); - d->engineData->engines[script] = engine; -} - - -QT_END_NAMESPACE diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 2cf0fdb040a..f7f3b0e9006 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -280,6 +280,8 @@ void QFontEngine::getGlyphPositions(const QGlyphLayout &glyphs, const QTransform int i = glyphs.numGlyphs; int totalKashidas = 0; while(i--) { + if (glyphs.attributes[i].dontPrint) + continue; xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6); ypos += glyphs.advances_y[i]; totalKashidas += glyphs.justifications[i].nKashidas; @@ -1680,11 +1682,42 @@ bool QFontEngineMulti::canRender(const QChar *string, int len) return allExist; } -QImage QFontEngineMulti::alphaMapForGlyph(glyph_t) +/* Implement alphaMapForGlyph() which is called by Lighthouse/Windows code. + * Ideally, that code should be fixed to correctly handle QFontEngineMulti. */ + +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph) { - Q_ASSERT(false); - return QImage(); + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph)); } +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition); +} + +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, const QTransform &t) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph), t); +} + +QImage QFontEngineMulti::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaMapForGlyph(stripped(glyph), subPixelPosition, t); +} + +QImage QFontEngineMulti::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPosition, int margin, const QTransform &t) +{ + const int which = highByte(glyph); + Q_ASSERT(which < engines.size()); + return engine(which)->alphaRGBMapForGlyph(stripped(glyph), subPixelPosition, margin, t); +} QT_END_NAMESPACE diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index bd8e24a3fe9..e320be44218 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qfontengine_p.h" +#include "private/qfontengine_p.h" #ifndef QT_NO_FREETYPE diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index e9a8d6f6077..a5858ffc7da 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -394,7 +394,7 @@ private: int _size; }; -class QFontEngineMulti : public QFontEngine +class Q_GUI_EXPORT QFontEngineMulti : public QFontEngine { public: explicit QFontEngineMulti(int engineCount); @@ -417,6 +417,10 @@ public: virtual QFixed xHeight() const; virtual QFixed averageCharWidth() const; virtual QImage alphaMapForGlyph(glyph_t); + virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition); + virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t); + virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t); + virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, int margin, const QTransform &t); virtual QFixed lineThickness() const; virtual QFixed underlinePosition() const; diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp index c829c2f8750..7c09ae7cf83 100644 --- a/src/gui/text/qfontengine_qpa.cpp +++ b/src/gui/text/qfontengine_qpa.cpp @@ -46,7 +46,6 @@ #include #include -#include #include #include @@ -664,9 +663,11 @@ QFontEngineMultiQPA::QFontEngineMultiQPA(QFontEngine *fe, int _script, const QSt : QFontEngineMulti(fallbacks.size() + 1), fallbackFamilies(fallbacks), script(_script) { + Q_ASSERT(fe && fe->type() != QFontEngine::Multi); engines[0] = fe; fe->ref.ref(); fontDef = engines[0]->fontDef; + setObjectName(QStringLiteral("QFontEngineMultiQPA")); } void QFontEngineMultiQPA::loadEngine(int at) diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp deleted file mode 100644 index fe2e002e5d3..00000000000 --- a/src/gui/text/qfontengine_qws.cpp +++ /dev/null @@ -1,662 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfontengine_p.h" -#include -#include -#include -#include -#include -#include -#include "qtextengine_p.h" -#include "private/qcore_unix_p.h" // overrides QT_OPEN - -#include - - -#ifndef QT_NO_QWS_QPF - -#include "qfile.h" -#include "qdir.h" - -#define QT_USE_MMAP -#include - -#ifdef QT_USE_MMAP -// for mmap -#include -#include -#include -#include -#include -#include - -# if defined(QT_LINUXBASE) && !defined(MAP_FILE) - // LSB 3.2 does not define MAP_FILE -# define MAP_FILE 0 -# endif - -#endif - -#endif // QT_NO_QWS_QPF - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_QWS_QPF -QT_BEGIN_INCLUDE_NAMESPACE -#include "qplatformdefs.h" -QT_END_INCLUDE_NAMESPACE - -static inline unsigned int getChar(const QChar *str, int &i, const int len) -{ - uint ucs4 = str[i].unicode(); - if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) { - ++i; - ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode()); - } - return ucs4; -} - -#define FM_SMOOTH 1 - - -class Q_PACKED QPFGlyphMetrics { - -public: - quint8 linestep; - quint8 width; - quint8 height; - quint8 flags; - - qint8 bearingx; // Difference from pen position to glyph's left bbox - quint8 advance; // Difference between pen positions - qint8 bearingy; // Used for putting characters on baseline - - qint8 reserved; // Do not use - - // Flags: - // RendererOwnsData - the renderer is responsible for glyph data - // memory deletion otherwise QPFGlyphTree must - // delete [] the data when the glyph is deleted. - enum Flags { RendererOwnsData=0x01 }; -}; - -class QPFGlyph { -public: - QPFGlyph() { metrics=0; data=0; } - QPFGlyph(QPFGlyphMetrics* m, uchar* d) : - metrics(m), data(d) { } - ~QPFGlyph() {} - - QPFGlyphMetrics* metrics; - uchar* data; -}; - -struct Q_PACKED QPFFontMetrics{ - qint8 ascent,descent; - qint8 leftbearing,rightbearing; - quint8 maxwidth; - qint8 leading; - quint8 flags; - quint8 underlinepos; - quint8 underlinewidth; - quint8 reserved3; -}; - - -class QPFGlyphTree { -public: - /* reads in a tree like this: - - A-Z - / \ - 0-9 a-z - - etc. - - */ - glyph_t min,max; - QPFGlyphTree* less; - QPFGlyphTree* more; - QPFGlyph* glyph; -public: -#ifdef QT_USE_MMAP - QPFGlyphTree(uchar*& data) - { - read(data); - } -#else - QPFGlyphTree(QIODevice& f) - { - read(f); - } -#endif - - ~QPFGlyphTree() - { - // NOTE: does not delete glyph[*].metrics or .data. - // the caller does this (only they know who owns - // the data). See clear(). - delete less; - delete more; - delete [] glyph; - } - - bool inFont(glyph_t g) const - { - if ( g < min ) { - if ( !less ) - return false; - return less->inFont(g); - } else if ( g > max ) { - if ( !more ) - return false; - return more->inFont(g); - } - return true; - } - - QPFGlyph* get(glyph_t g) - { - if ( g < min ) { - if ( !less ) - return 0; - return less->get(g); - } else if ( g > max ) { - if ( !more ) - return 0; - return more->get(g); - } - return &glyph[g - min]; - } - int totalChars() const - { - if ( !this ) return 0; - return max-min+1 + less->totalChars() + more->totalChars(); - } - int weight() const - { - if ( !this ) return 0; - return 1 + less->weight() + more->weight(); - } - - void dump(int indent=0) - { - for (int i=0; idump(indent+1); - if ( more ) more->dump(indent+1); - } - -private: - QPFGlyphTree() - { - } - -#ifdef QT_USE_MMAP - void read(uchar*& data) - { - // All node data first - readNode(data); - // Then all non-video data - readMetrics(data); - // Then all video data - readData(data); - } -#else - void read(QIODevice& f) - { - // All node data first - readNode(f); - // Then all non-video data - readMetrics(f); - // Then all video data - readData(f); - } -#endif - -#ifdef QT_USE_MMAP - void readNode(uchar*& data) - { - uchar rw = *data++; - uchar cl = *data++; - min = (rw << 8) | cl; - rw = *data++; - cl = *data++; - max = (rw << 8) | cl; - int flags = *data++; - if ( flags & 1 ) - less = new QPFGlyphTree; - else - less = 0; - if ( flags & 2 ) - more = new QPFGlyphTree; - else - more = 0; - int n = max-min+1; - glyph = new QPFGlyph[n]; - - if ( less ) - less->readNode(data); - if ( more ) - more->readNode(data); - } -#else - void readNode(QIODevice& f) - { - char rw; - char cl; - f.getChar(&rw); - f.getChar(&cl); - min = (rw << 8) | cl; - f.getChar(&rw); - f.getChar(&cl); - max = (rw << 8) | cl; - char flags; - f.getChar(&flags); - if ( flags & 1 ) - less = new QPFGlyphTree; - else - less = 0; - if ( flags & 2 ) - more = new QPFGlyphTree; - else - more = 0; - int n = max-min+1; - glyph = new QPFGlyph[n]; - - if ( less ) - less->readNode(f); - if ( more ) - more->readNode(f); - } -#endif - -#ifdef QT_USE_MMAP - void readMetrics(uchar*& data) - { - int n = max-min+1; - for (int i=0; ireadMetrics(data); - if ( more ) - more->readMetrics(data); - } -#else - void readMetrics(QIODevice& f) - { - int n = max-min+1; - for (int i=0; ireadMetrics(f); - if ( more ) - more->readMetrics(f); - } -#endif - -#ifdef QT_USE_MMAP - void readData(uchar*& data) - { - int n = max-min+1; - for (int i=0; iwidth, glyph[i].metrics->height ); - //######### s = qt_screen->mapToDevice( s ); - uint datasize = glyph[i].metrics->linestep * s.height(); - glyph[i].data = data; data += datasize; - } - if ( less ) - less->readData(data); - if ( more ) - more->readData(data); - } -#else - void readData(QIODevice& f) - { - int n = max-min+1; - for (int i=0; iwidth, glyph[i].metrics->height ); - //############### s = qt_screen->mapToDevice( s ); - uint datasize = glyph[i].metrics->linestep * s.height(); - glyph[i].data = new uchar[datasize]; // ### deleted? - f.read((char*)glyph[i].data, datasize); - } - if ( less ) - less->readData(f); - if ( more ) - more->readData(f); - } -#endif - -}; - -class QFontEngineQPF1Data -{ -public: - QPFFontMetrics fm; - QPFGlyphTree *tree; - void *mmapStart; - size_t mmapLength; -}; - -#if defined(Q_OS_INTEGRITY) -static void *qt_mmap(void *start, size_t length, int /*prot*/, int /*flags*/, int fd, off_t offset) -{ - // INTEGRITY cannot mmap local files - load it into a local buffer - if (::lseek(fd, offset, SEEK_SET) == -1) { -# if defined(DEBUG_FONTENGINE) - perror("lseek failed"); -# endif - } - void *buf = malloc(length); - if (::read(fd, buf, length) != (ssize_t)length) { -# if defined(DEBUG_FONTENGINE) - perror("read failed"); -# endif - } - - return buf; -} -#else -static inline void *qt_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) -{ - return mmap(start, length, prot, flags, fd, offset); -} -#endif - - - -QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) -{ - cache_cost = 1; - - int f = QT_OPEN( QFile::encodeName(fn), O_RDONLY, 0); - Q_ASSERT(f>=0); - QT_STATBUF st; - if ( QT_FSTAT( f, &st ) ) - qFatal("Failed to stat %s",QFile::encodeName(fn).data()); - uchar* data = (uchar*)qt_mmap( 0, // any address - st.st_size, // whole file - PROT_READ, // read-only memory -#if defined(Q_OS_INTEGRITY) - 0, -#elif !defined(Q_OS_SOLARIS) && !defined(Q_OS_QNX4) && !defined(Q_OS_VXWORKS) - MAP_FILE | MAP_PRIVATE, // swap-backed map from file -#else - MAP_PRIVATE, -#endif - f, 0 ); // from offset 0 of f -#if !defined(MAP_FAILED) && (defined(Q_OS_QNX4) || defined(Q_OS_INTEGRITY)) -#define MAP_FAILED ((void *)-1) -#endif - if ( !data || data == (uchar*)MAP_FAILED ) - qFatal("Failed to mmap %s",QFile::encodeName(fn).data()); - QT_CLOSE(f); - - d = new QFontEngineQPF1Data; - d->mmapStart = data; - d->mmapLength = st.st_size; - memcpy(reinterpret_cast(&d->fm),data,sizeof(d->fm)); - - data += sizeof(d->fm); - d->tree = new QPFGlyphTree(data); - glyphFormat = (d->fm.flags & FM_SMOOTH) ? QFontEngineGlyphCache::Raster_A8 - : QFontEngineGlyphCache::Raster_Mono; -#if 0 - qDebug() << "font file" << fn - << "ascent" << d->fm.ascent << "descent" << d->fm.descent - << "leftbearing" << d->fm.leftbearing - << "rightbearing" << d->fm.rightbearing - << "maxwidth" << d->fm.maxwidth - << "leading" << d->fm.leading - << "flags" << d->fm.flags - << "underlinepos" << d->fm.underlinepos - << "underlinewidth" << d->fm.underlinewidth; -#endif -} - -QFontEngineQPF1::~QFontEngineQPF1() -{ - if (d->mmapStart) - munmap(d->mmapStart, d->mmapLength); - delete d->tree; - delete d; -} - - -bool QFontEngineQPF1::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const -{ - if(*nglyphs < len) { - *nglyphs = len; - return false; - } - *nglyphs = 0; - - bool mirrored = flags & QTextEngine::RightToLeft; - for(int i = 0; i < len; i++) { - unsigned int uc = getChar(str, i, len); - if (mirrored) - uc = QChar::mirroredChar(uc); - glyphs->glyphs[*nglyphs] = uc < 0x10000 ? uc : 0; - ++*nglyphs; - } - - glyphs->numGlyphs = *nglyphs; - - if (flags & QTextEngine::GlyphIndicesOnly) - return true; - - recalcAdvances(glyphs, flags); - - return true; -} - -void QFontEngineQPF1::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const -{ - for(int i = 0; i < glyphs->numGlyphs; i++) { - QPFGlyph *glyph = d->tree->get(glyphs->glyphs[i]); - - glyphs->advances_x[i] = glyph ? glyph->metrics->advance : 0; - glyphs->advances_y[i] = 0; - - if (!glyph) - glyphs->glyphs[i] = 0; - } -} - -void QFontEngineQPF1::draw(QPaintEngine *p, qreal _x, qreal _y, const QTextItemInt &si) -{ - QPaintEngineState *pState = p->state; - QRasterPaintEngine *paintEngine = static_cast(p); - - QTransform matrix = pState->transform(); - matrix.translate(_x, _y); - QFixed x = QFixed::fromReal(matrix.dx()); - QFixed y = QFixed::fromReal(matrix.dy()); - - QVarLengthArray positions; - QVarLengthArray glyphs; - getGlyphPositions(si.glyphs, matrix, si.flags, glyphs, positions); - if (glyphs.size() == 0) - return; - - int depth = (d->fm.flags & FM_SMOOTH) ? 8 : 1; - for(int i = 0; i < glyphs.size(); i++) { - const QPFGlyph *glyph = d->tree->get(glyphs[i]); - if (!glyph) - continue; - - int bpl = glyph->metrics->linestep; - - if(glyph->data) - paintEngine->alphaPenBlt(glyph->data, bpl, depth, - qRound(positions[i].x) + glyph->metrics->bearingx, - qRound(positions[i].y) - glyph->metrics->bearingy, - glyph->metrics->width,glyph->metrics->height); - } -} - - -QImage QFontEngineQPF1::alphaMapForGlyph(glyph_t g) -{ - const QPFGlyph *glyph = d->tree->get(g); - if (!glyph) - return QImage(); - - int mono = !(d->fm.flags & FM_SMOOTH); - - const uchar *bits = glyph->data;//((const uchar *) glyph); - - QImage image; - if (mono) { - image = QImage((glyph->metrics->width+7)&~7, glyph->metrics->height, QImage::Format_Mono); - image.setColor(0, qRgba(0, 0, 0, 0)); - image.setColor(1, qRgba(0, 0, 0, 255)); - } else { - image = QImage(glyph->metrics->width, glyph->metrics->height, QImage::Format_Indexed8); - for (int j=0; j<256; ++j) - image.setColor(j, qRgba(0, 0, 0, j)); - } - for (int i=0; imetrics->height; ++i) { - memcpy(image.scanLine(i), bits, glyph->metrics->linestep); - bits += glyph->metrics->linestep; - } - return image; -} - - - -void QFontEngineQPF1::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) -{ - addBitmapFontToPath(x, y, glyphs, path, flags); -} - -glyph_metrics_t QFontEngineQPF1::boundingBox(const QGlyphLayout &glyphs) -{ - if (glyphs.numGlyphs == 0) - return glyph_metrics_t(); - - QFixed w = 0; - for (int i = 0; i < glyphs.numGlyphs; ++i) - w += glyphs.effectiveAdvance(i); - return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent()+descent()+1, w, 0); -} - -glyph_metrics_t QFontEngineQPF1::boundingBox(glyph_t glyph) -{ - const QPFGlyph *g = d->tree->get(glyph); - if (!g) - return glyph_metrics_t(); - Q_ASSERT(g); - return glyph_metrics_t(g->metrics->bearingx, -g->metrics->bearingy, - g->metrics->width, g->metrics->height, - g->metrics->advance, 0); -} - -QFixed QFontEngineQPF1::ascent() const -{ - return d->fm.ascent; -} - -QFixed QFontEngineQPF1::descent() const -{ - return d->fm.descent; -} - -QFixed QFontEngineQPF1::leading() const -{ - return d->fm.leading; -} - -qreal QFontEngineQPF1::maxCharWidth() const -{ - return d->fm.maxwidth; -} -/* -const char *QFontEngineQPF1::name() const -{ - return "qt"; -} -*/ -bool QFontEngineQPF1::canRender(const QChar *str, int len) -{ - for(int i = 0; i < len; i++) - if (!d->tree->inFont(str[i].unicode())) - return false; - return true; -} - -QFontEngine::Type QFontEngineQPF1::type() const -{ - return QPF1; -} - -qreal QFontEngineQPF1::minLeftBearing() const -{ - return d->fm.leftbearing; -} - -qreal QFontEngineQPF1::minRightBearing() const -{ - return d->fm.rightbearing; -} - -QFixed QFontEngineQPF1::underlinePosition() const -{ - return d->fm.underlinepos; -} - -QFixed QFontEngineQPF1::lineThickness() const -{ - return d->fm.underlinewidth; -} - -#endif //QT_NO_QWS_QPF - -QT_END_NAMESPACE diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h index a23bb34e0df..f21e8205563 100644 --- a/src/gui/text/qfontmetrics.h +++ b/src/gui/text/qfontmetrics.h @@ -120,15 +120,6 @@ public: bool operator==(const QFontMetrics &other) const; inline bool operator !=(const QFontMetrics &other) const { return !operator==(other); } -#ifdef QT3_SUPPORT - inline QRect boundingRect(const QString &text, int len) const - { return boundingRect(text.left(len)); } - inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString& str, int len, - int tabstops=0, int *tabarray=0) const - { return boundingRect(QRect(x, y, w, h), flags, str.left(len), tabstops, tabarray); } - inline QSize size(int flags, const QString& str, int len, int tabstops=0, int *tabarray=0) const - { return size(flags, str.left(len), tabstops, tabarray); } -#endif private: #if defined(Q_WS_MAC) friend class QFontPrivate; diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index ccb1f247dab..dc2a14a52a5 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -57,8 +57,6 @@ #include FT_FREETYPE_H #endif -#ifndef QT_NO_PRINTER - QT_BEGIN_NAMESPACE static const char * const agl = @@ -1493,251 +1491,4 @@ QByteArray QFontSubset::toTruetype() const return bindFont(tables); } -// ------------------ Type 1 generation --------------------------- - -// needs at least 6 bytes of space in tmp -static const char *encodeNumber(int num, char *tmp) -{ - const char *ret = tmp; - if(num >= -107 && num <= 107) { - QPdf::toHex((uchar)(num + 139), tmp); - tmp += 2; - } else if (num > 107 && num <= 1131) { - num -= 108; - QPdf::toHex((uchar)((num >> 8) + 247), tmp); - tmp += 2; - QPdf::toHex((uchar)(num & 0xff), tmp); - tmp += 2; - } else if(num < - 107 && num >= -1131) { - num += 108; - num = -num; - QPdf::toHex((uchar)((num >> 8) + 251), tmp); - tmp += 2; - QPdf::toHex((uchar)(num & 0xff), tmp); - tmp += 2; - } else { - *tmp++ = 'f'; - *tmp++ = 'f'; - QPdf::toHex((uchar)(num >> 24), tmp); - tmp += 2; - QPdf::toHex((uchar)(num >> 16), tmp); - tmp += 2; - QPdf::toHex((uchar)(num >> 8), tmp); - tmp += 2; - QPdf::toHex((uchar)(num >> 0), tmp); - tmp += 2; - } - *tmp = 0; -// qDebug("encodeNumber: %d -> '%s'", num, ret); - return ret; -} - -static QByteArray charString(const QPainterPath &path, qreal advance, qreal lsb, qreal ppem) -{ - // the charstring commands we need - const char *hsbw = "0D"; - const char *closepath = "09"; - const char *moveto[3] = { "16", "04", "15" }; - const char *lineto[3] = { "06", "07", "05" }; - const char *rcurveto = "08"; - const char *endchar = "0E"; - - enum { horizontal = 1, vertical = 2 }; - - char tmp[16]; - - qreal factor = 1000./ppem; - - int lsb_i = qRound(lsb*factor); - int advance_i = qRound(advance*factor); -// qDebug("--- charstring"); - - // first of all add lsb and width to the charstring using the hsbw command - QByteArray charstring; - charstring += encodeNumber(lsb_i, tmp); - charstring += encodeNumber(advance_i, tmp); - charstring += hsbw; - - // add the path - int xl = lsb_i; - int yl = 0; - bool openpath = false; - for (int i = 0; i < path.elementCount(); ++i) { - const QPainterPath::Element &elm = path.elementAt(i); - int x = qRound(elm.x*factor); - int y = -qRound(elm.y*factor); - int dx = x - xl; - int dy = y - yl; - if (elm.type == QPainterPath::MoveToElement && openpath) { -// qDebug("closepath %s", closepath); - charstring += closepath; - } - if (elm.type == QPainterPath::MoveToElement || - elm.type == QPainterPath::LineToElement) { - int type = -1; - if (dx || !dy) { - charstring += encodeNumber(dx, tmp); - type += horizontal; -// qDebug("horizontal"); - } - if (dy) { - charstring += encodeNumber(dy, tmp); - type += vertical; -// qDebug("vertical"); - } -// qDebug("moveto/lineto %s", (elm.type == QPainterPath::MoveToElement ? moveto[type] : lineto[type])); - charstring += (elm.type == QPainterPath::MoveToElement ? moveto[type] : lineto[type]); - openpath = true; - xl = x; - yl = y; - } else { - Q_ASSERT(elm.type == QPainterPath::CurveToElement); - const QPainterPath::Element &elm2 = path.elementAt(++i); - const QPainterPath::Element &elm3 = path.elementAt(++i); - int x2 = qRound(elm2.x*factor); - int y2 = -qRound(elm2.y*factor); - int x3 = qRound(elm3.x*factor); - int y3 = -qRound(elm3.y*factor); - charstring += encodeNumber(dx, tmp); - charstring += encodeNumber(dy, tmp); - charstring += encodeNumber(x2 - x, tmp); - charstring += encodeNumber(y2 - y, tmp); - charstring += encodeNumber(x3 - x2, tmp); - charstring += encodeNumber(y3 - y2, tmp); - charstring += rcurveto; - openpath = true; - xl = x3; - yl = y3; -// qDebug("rcurveto"); - } - } - if (openpath) - charstring += closepath; - charstring += endchar; - if (charstring.length() > 240) { - int pos = 240; - while (pos < charstring.length()) { - charstring.insert(pos, '\n'); - pos += 241; - } - } - return charstring; -} - -#ifndef QT_NO_FREETYPE -static const char *helvetica_styles[4] = { - "Helvetica", - "Helvetica-Bold", - "Helvetica-Oblique", - "Helvetica-BoldOblique" -}; -static const char *times_styles[4] = { - "Times-Regular", - "Times-Bold", - "Times-Italic", - "Times-BoldItalic" -}; -static const char *courier_styles[4] = { - "Courier", - "Courier-Bold", - "Courier-Oblique", - "Courier-BoldOblique" -}; -#endif - -QByteArray QFontSubset::toType1() const -{ - QFontEngine::Properties properties = fontEngine->properties(); - QVector reverseMap = getReverseMap(); - - QByteArray font; - QPdf::ByteStream s(&font); - - QByteArray id = QByteArray::number(object_id); - QByteArray psname = properties.postscriptName; - psname.replace(' ', ""); - - standard_font = false; - -#ifndef QT_NO_FREETYPE - FT_Face face = ft_face(fontEngine); - if (face && !FT_IS_SCALABLE(face)) { - int style = 0; - if (fontEngine->fontDef.style) - style += 2; - if (fontEngine->fontDef.weight >= QFont::Bold) - style++; - if (fontEngine->fontDef.family.contains(QLatin1String("Helvetica"))) { - psname = helvetica_styles[style]; - standard_font = true; - } else if (fontEngine->fontDef.family.contains(QLatin1String("Times"))) { - psname = times_styles[style]; - standard_font = true; - } else if (fontEngine->fontDef.family.contains(QLatin1String("Courier"))) { - psname = courier_styles[style]; - standard_font = true; - } - } -#endif - s << "/F" << id << "-Base\n"; - if (standard_font) { - s << '/' << psname << " findfont\n" - "0 dict copy dup /NumGlyphs 0 put dup /CMap 256 array put def\n"; - } else { - s << "<<\n"; - if(!psname.isEmpty()) - s << "/FontName /" << psname << '\n'; - s << "/FontInfo <fsType << ">>\n" - "/FontType 1\n" - "/PaintType 0\n" - "/FontMatrix [.001 0 0 .001 0 0]\n" - "/FontBBox { 0 0 0 0 }\n" - "/Private <<\n" - "/password 5839\n" - "/MinFeature {16 16}\n" - "/BlueValues []\n" - "/lenIV -1\n" - ">>\n" - "/CharStrings << >>\n" - "/NumGlyphs 0\n" - "/CMap 256 array\n" - ">> def\n"; - } - s << type1AddedGlyphs(); - downloaded_glyphs = glyph_indices.size(); - - return font; -} - -QByteArray QFontSubset::type1AddedGlyphs() const -{ - if (downloaded_glyphs == glyph_indices.size()) - return QByteArray(); - - QFontEngine::Properties properties = fontEngine->properties(); - QVector reverseMap = getReverseMap(); - QByteArray glyphs; - QPdf::ByteStream s(&glyphs); - - int nGlyphs = glyph_indices.size(); - QByteArray id = QByteArray::number(object_id); - - s << 'F' << id << "-Base [\n"; - for (int i = downloaded_glyphs; i < nGlyphs; ++i) { - glyph_t g = glyph_indices.at(i); - QPainterPath path; - glyph_metrics_t metric; - fontEngine->getUnscaledGlyph(g, &path, &metric); - QByteArray charstring = charString(path, metric.xoff.toReal(), metric.x.toReal(), - properties.emSquare.toReal()); - s << glyphName(i, reverseMap); - if (!standard_font) - s << "\n<" << charstring << ">\n"; - } - s << (standard_font ? "] T1AddMapping\n" : "] T1AddGlyphs\n"); - return glyphs; -} - QT_END_NAMESPACE - -#endif // QT_NO_PRINTER diff --git a/src/gui/text/qfontsubset_p.h b/src/gui/text/qfontsubset_p.h index 7b9b47486c7..a99236f4cc4 100644 --- a/src/gui/text/qfontsubset_p.h +++ b/src/gui/text/qfontsubset_p.h @@ -55,8 +55,6 @@ #include "private/qfontengine_p.h" -#ifndef QT_NO_PRINTER - QT_BEGIN_NAMESPACE class QFontSubset @@ -71,8 +69,6 @@ public: } QByteArray toTruetype() const; - QByteArray toType1() const; - QByteArray type1AddedGlyphs() const; QByteArray widthArray() const; QByteArray createToUnicodeMap() const; QVector getReverseMap() const; @@ -94,6 +90,4 @@ public: QT_END_NAMESPACE -#endif // QT_NO_PRINTER - #endif // QFONTSUBSET_P_H diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index be9c0586938..90efc4db21b 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -141,14 +141,18 @@ bool QGlyphRun::operator==(const QGlyphRun &other) const return false; } - for (int i=0; iglyphIndexDataSize, d->glyphPositionDataSize); ++i) { - if (i < d->glyphIndexDataSize && d->glyphIndexData[i] != other.d->glyphIndexData[i]) - return false; - - if (i < d->glyphPositionDataSize && d->glyphPositionData[i] != other.d->glyphPositionData[i]) - return false; + if (d->glyphIndexData != other.d->glyphIndexData) { + for (int i = 0; i < d->glyphIndexDataSize; ++i) { + if (d->glyphIndexData[i] != other.d->glyphIndexData[i]) + return false; + } + } + if (d->glyphPositionData != other.d->glyphPositionData) { + for (int i = 0; i < d->glyphPositionDataSize; ++i) { + if (d->glyphPositionData[i] != other.d->glyphPositionData[i]) + return false; + } } - return (d->overline == other.d->overline && d->underline == other.d->underline @@ -157,13 +161,11 @@ bool QGlyphRun::operator==(const QGlyphRun &other) const } /*! + \fn bool QGlyphRun::operator!=(const QGlyphRun &other) const + Compares \a other to this QGlyphRun object. Returns true if any of the list of glyph indexes, the list of positions or the font are different, otherwise returns false. */ -bool QGlyphRun::operator!=(const QGlyphRun &other) const -{ - return !(*this == other); -} /*! Returns the font selected for this QGlyphRun object. @@ -295,6 +297,9 @@ bool QGlyphRun::overline() const */ void QGlyphRun::setOverline(bool overline) { + if (d->overline == overline) + return; + detach(); d->overline = overline; } @@ -317,6 +322,9 @@ bool QGlyphRun::underline() const */ void QGlyphRun::setUnderline(bool underline) { + if (d->underline == underline) + return; + detach(); d->underline = underline; } @@ -339,6 +347,9 @@ bool QGlyphRun::strikeOut() const */ void QGlyphRun::setStrikeOut(bool strikeOut) { + if (d->strikeOut == strikeOut) + return; + detach(); d->strikeOut = strikeOut; } diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h index da88bc72f9f..81783a8653c 100644 --- a/src/gui/text/qglyphrun.h +++ b/src/gui/text/qglyphrun.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGLYPHRUN_H -#define QGLYPHRUN_H +#ifndef QOpenGLYPHRUN_H +#define QOpenGLYPHRUN_H #include #include @@ -79,8 +79,10 @@ public: void clear(); QGlyphRun &operator=(const QGlyphRun &other); + bool operator==(const QGlyphRun &other) const; - bool operator!=(const QGlyphRun &other) const; + inline bool operator!=(const QGlyphRun &other) const + { return !operator==(other); } void setOverline(bool overline); bool overline() const; @@ -113,4 +115,4 @@ QT_END_HEADER #endif // QT_NO_RAWFONT -#endif // QGLYPHS_H +#endif // QOpenGLYPHS_H diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h index b632678971d..96a80bebe9a 100644 --- a/src/gui/text/qglyphrun_p.h +++ b/src/gui/text/qglyphrun_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGLYPHRUN_P_H -#define QGLYPHRUN_P_H +#ifndef QOpenGLYPHRUN_P_H +#define QOpenGLYPHRUN_P_H // // W A R N I N G @@ -119,6 +119,6 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QGLYPHS_P_H +#endif // QOpenGLYPHS_P_H #endif // QT_NO_RAWFONT diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/text/qlinecontrol.cpp similarity index 83% rename from src/gui/widgets/qlinecontrol.cpp rename to src/gui/text/qlinecontrol.cpp index 79c2498fa1a..eb6f22b7267 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/text/qlinecontrol.cpp @@ -39,63 +39,26 @@ ** ****************************************************************************/ +// ### +#define QT_NO_ACCESSIBILITY +#define QT_NO_IM + #include "qlinecontrol_p.h" #ifndef QT_NO_LINEEDIT -#include "qabstractitemview.h" #include "qclipboard.h" #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" #endif -#ifndef QT_NO_IM -#include "qinputcontext.h" -#include "qlist.h" -#endif -#include "qapplication.h" -#ifndef QT_NO_GRAPHICSVIEW -#include "qgraphicssceneevent.h" -#endif +#include "qguiapplication.h" +#include "qstylehints.h" QT_BEGIN_NAMESPACE -#ifdef QT_GUI_PASSWORD_ECHO_DELAY -static const int qt_passwordEchoDelay = QT_GUI_PASSWORD_ECHO_DELAY; -#endif - -/*! - \macro QT_GUI_PASSWORD_ECHO_DELAY - - \internal - - Defines the amount of time in milliseconds the last entered character - should be displayed unmasked in the Password echo mode. - - If not defined in qplatformdefs.h there will be no delay in masking - password characters. -*/ - -/*! - \internal - - Updates the internal text layout. Returns the ascent of the - created QTextLine. -*/ -int QLineControl::redoTextLayout() const -{ - m_textLayout.clearLayout(); - - m_textLayout.beginLayout(); - QTextLine l = m_textLayout.createLine(); - m_textLayout.endLayout(); - -#if defined(Q_WS_MAC) - if (m_threadChecks) - m_textLayoutThread = QThread::currentThread(); -#endif - - return qRound(l.ascent()); -} +// ### these should come from QStyleHints +const int textCursorWidth = 1; +const bool fullWidthSelection = true; /*! \internal @@ -107,30 +70,14 @@ void QLineControl::updateDisplayText(bool forceUpdate) { QString orig = m_textLayout.text(); QString str; - if (m_echoMode == QLineEdit::NoEcho) + if (m_echoMode == NoEcho) str = QString::fromLatin1(""); else str = m_text; - if (m_echoMode == QLineEdit::Password) { + if (m_echoMode == Password || (m_echoMode == PasswordEchoOnEdit + && !m_passwordEchoEditing)) str.fill(m_passwordCharacter); -#ifdef QT_GUI_PASSWORD_ECHO_DELAY - if (m_passwordEchoTimer != 0 && m_cursor > 0 && m_cursor <= m_text.length()) { - int cursor = m_cursor - 1; - QChar uc = m_text.at(cursor); - str[cursor] = uc; - if (cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { - // second half of a surrogate, check if we have the first half as well, - // if yes restore both at once - uc = m_text.at(cursor - 1); - if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) - str[cursor - 1] = uc; - } - } -#endif - } else if (m_echoMode == QLineEdit::PasswordEchoOnEdit && !m_passwordEchoEditing) { - str.fill(m_passwordCharacter); - } // replace certain non-printable characters with spaces (to avoid // drawing boxes when using fonts that don't have glyphs for such @@ -146,12 +93,15 @@ void QLineControl::updateDisplayText(bool forceUpdate) m_textLayout.setText(str); - QTextOption option = m_textLayout.textOption(); + QTextOption option; option.setTextDirection(m_layoutDirection); option.setFlags(QTextOption::IncludeTrailingSpaces); m_textLayout.setTextOption(option); - m_ascent = redoTextLayout(); + m_textLayout.beginLayout(); + QTextLine l = m_textLayout.createLine(); + m_textLayout.endLayout(); + m_ascent = qRound(l.ascent()); if (str != orig || forceUpdate) emit displayTextChanged(str); @@ -171,10 +121,10 @@ void QLineControl::updateDisplayText(bool forceUpdate) void QLineControl::copy(QClipboard::Mode mode) const { QString t = selectedText(); - if (!t.isEmpty() && m_echoMode == QLineEdit::Normal) { - disconnect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, 0); - QApplication::clipboard()->setText(t, mode); - connect(QApplication::clipboard(), SIGNAL(selectionChanged()), + if (!t.isEmpty() && m_echoMode == Normal) { + disconnect(QGuiApplication::clipboard(), SIGNAL(selectionChanged()), this, 0); + QGuiApplication::clipboard()->setText(t, mode); + connect(QGuiApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(_q_clipboardChanged())); } } @@ -189,7 +139,7 @@ void QLineControl::copy(QClipboard::Mode mode) const */ void QLineControl::paste(QClipboard::Mode clipboardMode) { - QString clip = QApplication::clipboard()->text(clipboardMode); + QString clip = QGuiApplication::clipboard()->text(clipboardMode); if (!clip.isEmpty() || hasSelectedText()) { separate(); //make it a separate undo/redo command insert(clip); @@ -217,10 +167,12 @@ void QLineControl::backspace() --m_cursor; if (m_maskData) m_cursor = prevMaskBlank(m_cursor); - if (m_cursor > 0 && m_text.at(m_cursor).isLowSurrogate()) { + QChar uc = m_text.at(m_cursor); + if (m_cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { // second half of a surrogate, check if we have the first half as well, // if yes delete both at once - if (m_text.at(m_cursor - 1).isHighSurrogate()) { + uc = m_text.at(m_cursor - 1); + if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) { internalDelete(true); --m_cursor; } @@ -245,7 +197,7 @@ void QLineControl::del() if (hasSelectedText()) { removeSelectedText(); } else { - int n = textLayout()->nextCursorPosition(m_cursor) - m_cursor; + int n = m_textLayout.nextCursorPosition(m_cursor) - m_cursor; while (n--) internalDelete(); } @@ -298,27 +250,27 @@ void QLineControl::setSelection(int start, int length) } if (length > 0) { - m_selDirty |= (start != m_selstart || start + length != m_selend); + if (start == m_selstart && start + length == m_selend) + return; m_selstart = start; m_selend = qMin(start + length, (int)m_text.length()); m_cursor = m_selend; } else if (length < 0){ - m_selDirty |= (start != m_selend || start + length != m_selstart); + if (start == m_selend && start + length == m_selstart) + return; m_selstart = qMax(start + length, 0); m_selend = start; m_cursor = m_selstart; } else if (m_selstart != m_selend) { - m_selDirty = true; m_selstart = 0; m_selend = 0; m_cursor = start; } else { m_cursor = start; + emitCursorPositionChanged(); + return; } - if (m_selDirty) { - m_selDirty = false; - emit selectionChanged(); - } + emit selectionChanged(); emitCursorPositionChanged(); } @@ -360,7 +312,6 @@ void QLineControl::init(const QString &txt) */ void QLineControl::updatePasswordEchoEditing(bool editing) { - cancelPasswordEchoTimer(); m_passwordEchoEditing = editing; updateDisplayText(); } @@ -374,7 +325,7 @@ void QLineControl::updatePasswordEchoEditing(bool editing) */ int QLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const { - return textLayout()->lineAt(0).xToCursor(x, betweenOrOn); + return m_textLayout.lineAt(0).xToCursor(x, betweenOrOn); } /*! @@ -385,7 +336,7 @@ int QLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const */ QRect QLineControl::cursorRect() const { - QTextLine l = textLayout()->lineAt(0); + QTextLine l = m_textLayout.lineAt(0); int c = m_cursor; if (m_preeditCursor != -1) c += m_preeditCursor; @@ -472,7 +423,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) if (isGettingInput) { // If any text is being input, remove selected text. priorState = m_undoState; - if (echoMode() == QLineEdit::PasswordEchoOnEdit && !passwordEchoEditing()) { + if (echoMode() == PasswordEchoOnEdit && !passwordEchoEditing()) { updatePasswordEchoEditing(true); m_selstart = 0; m_selend = m_text.length(); @@ -511,14 +462,12 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) if (m_selend < m_selstart) { qSwap(m_selstart, m_selend); } - m_selDirty = true; } else { m_selstart = m_selend = 0; } cursorPositionChanged = true; } } - #ifndef QT_NO_IM setPreeditArea(m_cursor, event->preeditString()); #endif //QT_NO_IM @@ -544,18 +493,12 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) } m_textLayout.setAdditionalFormats(formats); updateDisplayText(/*force*/ true); - if (isGettingInput) { + if (cursorPositionChanged) + emitCursorPositionChanged(); + else if (m_preeditCursor != oldPreeditCursor) + emit updateMicroFocus(); + if (isGettingInput) finishChange(priorState); - } else { - if (cursorPositionChanged) - emitCursorPositionChanged(); - else if (m_preeditCursor != oldPreeditCursor) - emit updateMicroFocus(); - if (m_selDirty) { - m_selDirty = false; - emit selectionChanged(); - } - } } /*! @@ -596,14 +539,14 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl } if (flags & DrawText) - textLayout()->draw(painter, offset, selections, clip); + m_textLayout.draw(painter, offset, selections, clip); if (flags & DrawCursor){ int cursor = m_cursor; if (m_preeditCursor != -1) cursor += m_preeditCursor; if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus)) - textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth); + m_textLayout.drawCursor(painter, offset, cursor, m_cursorWidth); } } @@ -619,10 +562,10 @@ void QLineControl::selectWordAtPos(int cursor) int next = cursor + 1; if(next > end()) --next; - int c = textLayout()->previousCursorPosition(next, QTextLayout::SkipWords); + int c = m_textLayout.previousCursorPosition(next, QTextLayout::SkipWords); moveCursor(c, false); // ## text layout should support end of words. - int end = textLayout()->nextCursorPosition(c, QTextLayout::SkipWords); + int end = m_textLayout.nextCursorPosition(c, QTextLayout::SkipWords); while (end > cursor && m_text[end-1].isSpace()) --end; moveCursor(end, true); @@ -687,8 +630,6 @@ bool QLineControl::finishChange(int validateFromState, bool update, bool edited) m_selDirty = false; emit selectionChanged(); } - if (m_cursor == m_lastCursorPos) - updateMicroFocus(); emitCursorPositionChanged(); return true; } @@ -700,7 +641,6 @@ bool QLineControl::finishChange(int validateFromState, bool update, bool edited) */ void QLineControl::internalSetText(const QString &txt, int pos, bool edited) { - cancelPasswordEchoTimer(); internalDeselect(); emit resetInputContext(); QString oldText = m_text; @@ -714,9 +654,11 @@ void QLineControl::internalSetText(const QString &txt, int pos, bool edited) m_modifiedState = m_undoState = 0; m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos; m_textDirty = (oldText != m_text); - bool changed = finishChange(-1, true, edited); -#ifndef QT_NO_ACCESSIBILITY +#ifdef QT_NO_ACCESSIBILITY + Q_UNUSED(edited) +#else + bool changed = finishChange(-1, true, edited); if (changed) QAccessible::updateAccessibility(parent(), 0, QAccessible::TextUpdated); #endif @@ -753,13 +695,6 @@ void QLineControl::addCommand(const Command &cmd) */ void QLineControl::internalInsert(const QString &s) { -#ifdef QT_GUI_PASSWORD_ECHO_DELAY - if (m_echoMode == QLineEdit::Password) { - if (m_passwordEchoTimer != 0) - killTimer(m_passwordEchoTimer); - m_passwordEchoTimer = startTimer(qt_passwordEchoDelay); - } -#endif if (hasSelectedText()) addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); if (m_maskData) { @@ -797,7 +732,6 @@ void QLineControl::internalInsert(const QString &s) void QLineControl::internalDelete(bool wasBackspace) { if (m_cursor < (int) m_text.length()) { - cancelPasswordEchoTimer(); if (hasSelectedText()) addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)), @@ -824,7 +758,6 @@ void QLineControl::internalDelete(bool wasBackspace) void QLineControl::removeSelectedText() { if (m_selstart < m_selend && m_selend <= (int) m_text.length()) { - cancelPasswordEchoTimer(); separate(); int i ; addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); @@ -1223,7 +1156,6 @@ void QLineControl::internalUndo(int until) { if (!isUndoAvailable()) return; - cancelPasswordEchoTimer(); internalDeselect(); while (m_undoState && m_undoState > until) { Command& cmd = m_history[--m_undoState]; @@ -1322,72 +1254,6 @@ void QLineControl::emitCursorPositionChanged() } } -#ifndef QT_NO_COMPLETER -// iterating forward(dir=1)/backward(dir=-1) from the -// current row based. dir=0 indicates a new completion prefix was set. -bool QLineControl::advanceToEnabledItem(int dir) -{ - int start = m_completer->currentRow(); - if (start == -1) - return false; - int i = start + dir; - if (dir == 0) dir = 1; - do { - if (!m_completer->setCurrentRow(i)) { - if (!m_completer->wrapAround()) - break; - i = i > 0 ? 0 : m_completer->completionCount() - 1; - } else { - QModelIndex currentIndex = m_completer->currentIndex(); - if (m_completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled) - return true; - i += dir; - } - } while (i != start); - - m_completer->setCurrentRow(start); // restore - return false; -} - -void QLineControl::complete(int key) -{ - if (!m_completer || isReadOnly() || echoMode() != QLineEdit::Normal) - return; - - QString text = this->text(); - if (m_completer->completionMode() == QCompleter::InlineCompletion) { - if (key == Qt::Key_Backspace) - return; - int n = 0; - if (key == Qt::Key_Up || key == Qt::Key_Down) { - if (textAfterSelection().length()) - return; - QString prefix = hasSelectedText() ? textBeforeSelection() - : text; - if (text.compare(m_completer->currentCompletion(), m_completer->caseSensitivity()) != 0 - || prefix.compare(m_completer->completionPrefix(), m_completer->caseSensitivity()) != 0) { - m_completer->setCompletionPrefix(prefix); - } else { - n = (key == Qt::Key_Up) ? -1 : +1; - } - } else { - m_completer->setCompletionPrefix(text); - } - if (!advanceToEnabledItem(n)) - return; - } else { -#ifndef QT_KEYPAD_NAVIGATION - if (text.isEmpty()) { - m_completer->popup()->hide(); - return; - } -#endif - m_completer->setCompletionPrefix(text); - } - - m_completer->complete(); -} -#endif void QLineControl::setCursorBlinkPeriod(int msec) { @@ -1428,19 +1294,13 @@ void QLineControl::timerEvent(QTimerEvent *event) } else if (event->timerId() == m_tripleClickTimer) { killTimer(m_tripleClickTimer); m_tripleClickTimer = 0; -#ifdef QT_GUI_PASSWORD_ECHO_DELAY - } else if (event->timerId() == m_passwordEchoTimer) { - killTimer(m_passwordEchoTimer); - m_passwordEchoTimer = 0; - updateDisplayText(); -#endif } } bool QLineControl::processEvent(QEvent* ev) { #ifdef QT_KEYPAD_NAVIGATION - if (QApplication::keypadNavigationEnabled()) { + if (QGuiApplication::keypadNavigationEnabled()) { if ((ev->type() == QEvent::KeyPress) || (ev->type() == QEvent::KeyRelease)) { QKeyEvent *ke = (QKeyEvent *)ev; if (ke->key() == Qt::Key_Back) { @@ -1463,17 +1323,6 @@ bool QLineControl::processEvent(QEvent* ev) } #endif switch(ev->type()){ -#ifndef QT_NO_GRAPHICSVIEW - case QEvent::GraphicsSceneMouseDoubleClick: - case QEvent::GraphicsSceneMouseMove: - case QEvent::GraphicsSceneMouseRelease: - case QEvent::GraphicsSceneMousePress:{ - QGraphicsSceneMouseEvent *gvEv = static_cast(ev); - QMouseEvent mouse(ev->type(), - gvEv->pos().toPoint(), gvEv->button(), gvEv->buttons(), gvEv->modifiers()); - processMouseEvent(&mouse); break; - } -#endif case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: @@ -1538,11 +1387,9 @@ void QLineControl::processMouseEvent(QMouseEvent* ev) { switch (ev->type()) { - case QEvent::GraphicsSceneMousePress: case QEvent::MouseButtonPress:{ if (m_tripleClickTimer - && (ev->pos() - m_tripleClick).manhattanLength() - < QApplication::startDragDistance()) { + && (ev->pos() - m_tripleClick).manhattanLength() < qApp->styleHints()->startDragDistance()) { selectAll(); return; } @@ -1554,30 +1401,27 @@ void QLineControl::processMouseEvent(QMouseEvent* ev) moveCursor(cursor, mark); break; } - case QEvent::GraphicsSceneMouseDoubleClick: case QEvent::MouseButtonDblClick: if (ev->button() == Qt::LeftButton) { selectWordAtPos(xToPos(ev->pos().x())); if (m_tripleClickTimer) killTimer(m_tripleClickTimer); - m_tripleClickTimer = startTimer(QApplication::doubleClickInterval()); + m_tripleClickTimer = startTimer(qApp->styleHints()->mouseDoubleClickInterval()); m_tripleClick = ev->pos(); } break; - case QEvent::GraphicsSceneMouseRelease: case QEvent::MouseButtonRelease: #ifndef QT_NO_CLIPBOARD - if (QApplication::clipboard()->supportsSelection()) { + if (QGuiApplication::clipboard()->supportsSelection()) { if (ev->button() == Qt::LeftButton) { copy(QClipboard::Selection); } else if (!isReadOnly() && ev->button() == Qt::MidButton) { deselect(); - insert(QApplication::clipboard()->text(QClipboard::Selection)); + insert(QGuiApplication::clipboard()->text(QClipboard::Selection)); } } #endif break; - case QEvent::GraphicsSceneMouseMove: case QEvent::MouseMove: if (ev->buttons() & Qt::LeftButton) { moveCursor(xToPos(ev->pos().x()), true); @@ -1592,53 +1436,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event) { bool inlineCompletionAccepted = false; -#ifndef QT_NO_COMPLETER - if (m_completer) { - QCompleter::CompletionMode completionMode = m_completer->completionMode(); - if ((completionMode == QCompleter::PopupCompletion - || completionMode == QCompleter::UnfilteredPopupCompletion) - && m_completer->popup() - && m_completer->popup()->isVisible()) { - // The following keys are forwarded by the completer to the widget - // Ignoring the events lets the completer provide suitable default behavior - switch (event->key()) { - case Qt::Key_Escape: - event->ignore(); - return; - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_F4: -#ifdef QT_KEYPAD_NAVIGATION - case Qt::Key_Select: - if (!QApplication::keypadNavigationEnabled()) - break; -#endif - m_completer->popup()->hide(); // just hide. will end up propagating to parent - default: - break; // normal key processing - } - } else if (completionMode == QCompleter::InlineCompletion) { - switch (event->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_F4: -#ifdef QT_KEYPAD_NAVIGATION - case Qt::Key_Select: - if (!QApplication::keypadNavigationEnabled()) - break; -#endif - if (!m_completer->currentCompletion().isEmpty() && hasSelectedText() - && textAfterSelection().isEmpty()) { - setText(m_completer->currentCompletion()); - inlineCompletionAccepted = true; - } - default: - break; // normal key processing - } - } - } -#endif // QT_NO_COMPLETER - if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { if (hasAcceptableInput() || fixup()) { emit accepted(); @@ -1651,7 +1448,7 @@ void QLineControl::processKeyEvent(QKeyEvent* event) return; } - if (echoMode() == QLineEdit::PasswordEchoOnEdit + if (echoMode() == PasswordEchoOnEdit && !passwordEchoEditing() && !isReadOnly() && !event->text().isEmpty() @@ -1759,26 +1556,26 @@ void QLineControl::processKeyEvent(QKeyEvent* event) cursorForward(1, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1)); } else if (event == QKeySequence::MoveToNextWord) { - if (echoMode() == QLineEdit::Normal) + if (echoMode() == Normal) layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0); else layoutDirection() == Qt::LeftToRight ? end(0) : home(0); } else if (event == QKeySequence::MoveToPreviousWord) { - if (echoMode() == QLineEdit::Normal) + if (echoMode() == Normal) layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0); else if (!isReadOnly()) { layoutDirection() == Qt::LeftToRight ? home(0) : end(0); } } else if (event == QKeySequence::SelectNextWord) { - if (echoMode() == QLineEdit::Normal) + if (echoMode() == Normal) layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1); else layoutDirection() == Qt::LeftToRight ? end(1) : home(1); } else if (event == QKeySequence::SelectPreviousWord) { - if (echoMode() == QLineEdit::Normal) + if (echoMode() == Normal) layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1); else layoutDirection() == Qt::LeftToRight ? home(1) : end(1); @@ -1830,12 +1627,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event) del(); } break; -#ifndef QT_NO_COMPLETER - case Qt::Key_Up: - case Qt::Key_Down: - complete(event->key()); - break; -#endif #if defined(Q_WS_X11) case Qt::Key_E: end(0); @@ -1860,14 +1651,11 @@ void QLineControl::processKeyEvent(QKeyEvent* event) case Qt::Key_Backspace: if (!isReadOnly()) { backspace(); -#ifndef QT_NO_COMPLETER - complete(Qt::Key_Backspace); -#endif } break; #ifdef QT_KEYPAD_NAVIGATION case Qt::Key_Back: - if (QApplication::keypadNavigationEnabled() && !event->isAutoRepeat() + if (QGuiApplication::keypadNavigationEnabled() && !event->isAutoRepeat() && !isReadOnly()) { if (text().length() == 0) { setText(m_cancelText); @@ -1900,9 +1688,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event) QString t = event->text(); if (!t.isEmpty() && t.at(0).isPrint()) { insert(t); -#ifndef QT_NO_COMPLETER - complete(event->key()); -#endif event->accept(); return; } diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/text/qlinecontrol_p.h similarity index 86% rename from src/gui/widgets/qlinecontrol_p.h rename to src/gui/text/qlinecontrol_p.h index d4c4154b3d4..e5435c22f6b 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/text/qlinecontrol_p.h @@ -55,19 +55,13 @@ #include "QtCore/qglobal.h" -#ifndef QT_NO_LINEEDIT -#include "private/qwidget_p.h" -#include "QtGui/qlineedit.h" #include "QtGui/qtextlayout.h" -#include "QtGui/qstyleoption.h" #include "QtCore/qpointer.h" #include "QtGui/qclipboard.h" +#include "QtGui/qvalidator.h" +#include "QtGui/qpalette.h" +#include "QtGui/qguiapplication.h" #include "QtCore/qpoint.h" -#include "QtGui/qcompleter.h" -#include "QtGui/qaccessible.h" -#include "QtCore/qthread.h" - -#include "qplatformdefs.h" QT_BEGIN_HEADER @@ -83,22 +77,23 @@ public: QLineControl(const QString &txt = QString()) : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto), m_hideCursor(false), m_separator(0), m_readOnly(0), - m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0), + m_dragEnabled(0), m_echoMode(Normal), m_textDirty(0), m_selDirty(0), m_validInput(1), m_blinkStatus(0), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0), m_ascent(0), m_maxLength(32767), m_lastCursorPos(-1), m_tripleClickTimer(0), m_maskData(0), m_modifiedState(0), m_undoState(0), m_selstart(0), m_selend(0), m_passwordEchoEditing(false) -#ifdef QT_GUI_PASSWORD_ECHO_DELAY - , m_passwordEchoTimer(0) -#endif -#if defined(Q_WS_MAC) - , m_threadChecks(false) - , m_textLayoutThread(0) - #endif { init(txt); } + enum EchoMode { + Normal, + NoEcho, + Password, + PasswordEchoOnEdit + }; + + ~QLineControl() { delete [] m_maskData; @@ -229,10 +224,9 @@ public: void redo() { internalRedo(); finishChange(); } void selectWordAtPos(int); - uint echoMode() const { return m_echoMode; } - void setEchoMode(uint mode) + EchoMode echoMode() const { return EchoMode(m_echoMode); } + void setEchoMode(EchoMode mode) { - cancelPasswordEchoTimer(); m_echoMode = mode; m_passwordEchoEditing = false; updateDisplayText(); @@ -252,13 +246,6 @@ public: void setValidator(const QValidator *v) { m_validator = const_cast(v); } #endif -#ifndef QT_NO_COMPLETER - QCompleter *completer() const { return m_completer; } - /* Note that you must set the widget for the completer separately */ - void setCompleter(const QCompleter *c) { m_completer = const_cast(c); } - void complete(int key); -#endif - int cursorPosition() const { return m_cursor; } void setCursorPosition(int pos) { if (pos <= m_text.length()) moveCursor(qMax(0, pos)); } @@ -282,13 +269,7 @@ public: QString preeditAreaText() const { return m_textLayout.preeditAreaText(); } void updatePasswordEchoEditing(bool editing); - bool passwordEchoEditing() const { -#ifdef QT_GUI_PASSWORD_ECHO_DELAY - if (m_passwordEchoTimer != 0) - return true; -#endif - return m_passwordEchoEditing ; - } + bool passwordEchoEditing() const { return m_passwordEchoEditing; } QChar passwordCharacter() const { return m_passwordCharacter; } void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); } @@ -296,7 +277,7 @@ public: Qt::LayoutDirection layoutDirection() const { if (m_layoutDirection == Qt::LayoutDirectionAuto) { if (m_text.isEmpty()) - return QApplication::keyboardInputDirection(); + return QGuiApplication::keyboardInputDirection(); return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; } return m_layoutDirection; @@ -337,27 +318,11 @@ public: bool processEvent(QEvent *ev); - QTextLayout *textLayout() const + QTextLayout *textLayout() { -#if defined(Q_WS_MAC) - if (m_threadChecks && QThread::currentThread() != m_textLayoutThread) - redoTextLayout(); -#endif return &m_textLayout; } -#if defined(Q_WS_MAC) - void setThreadChecks(bool threadChecks) - { - m_threadChecks = threadChecks; - } - - bool threadChecks() const - { - return m_threadChecks; - } -#endif - private: void init(const QString &txt); void removeSelectedText(); @@ -410,10 +375,6 @@ private: #ifndef QT_NO_VALIDATOR QPointer m_validator; #endif - QPointer m_completer; -#ifndef QT_NO_COMPLETER - bool advanceToEnabledItem(int dir); -#endif struct MaskInputData { enum Casemode { NoCaseMode, Upper, Lower }; @@ -454,29 +415,11 @@ private: QString stripString(const QString &str) const; int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar = QChar()) const; - // complex text layout (must be mutable so it can be reshaped at will) - mutable QTextLayout m_textLayout; + // complex text layout + QTextLayout m_textLayout; bool m_passwordEchoEditing; QChar m_passwordCharacter; -#ifdef QT_GUI_PASSWORD_ECHO_DELAY - int m_passwordEchoTimer; -#endif - void cancelPasswordEchoTimer() - { -#ifdef QT_GUI_PASSWORD_ECHO_DELAY - if (m_passwordEchoTimer != 0) { - killTimer(m_passwordEchoTimer); - m_passwordEchoTimer = 0; - } -#endif - } - - int redoTextLayout() const; -#if defined(Q_WS_MAC) - bool m_threadChecks; - mutable QThread *m_textLayoutThread; -#endif Q_SIGNALS: void cursorPositionChanged(int, int); @@ -509,6 +452,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QT_NO_LINEEDIT - -#endif // QLINECONTROL_P_H +#endif // QLineControl_P_H diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp index 059dc3e188a..7ad838561bc 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.cpp +++ b/src/gui/text/qplatformfontdatabase_qpa.cpp @@ -343,6 +343,30 @@ QString QPlatformFontDatabase::fontDir() const return fontpath; } +/*! + Returns the default system font. + + \sa QGuiApplication::font() + \since 5.0 +*/ + +QFont QPlatformFontDatabase::defaultFont() const +{ + return QFont(QLatin1String("Helvetica")); +} + +/*! + Returns fonts for class names. + + \sa QGuiApplication::font() + \since 5.0 +*/ + +QHash QPlatformFontDatabase::defaultFonts() const +{ + return QHash(); +} + /*! \class QPlatformFontDatabase \brief The QPlatformFontDatabase class makes it possible to customize how fonts diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h index 1fb3c32fead..d34d602e438 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.h +++ b/src/gui/text/qplatformfontdatabase_qpa.h @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -96,6 +97,9 @@ public: virtual QString fontDir() const; + virtual QFont defaultFont() const; + virtual QHash defaultFonts() const; + //callback static void registerQPF2Font(const QByteArray &dataArray, void *handle); static void registerFont(const QString &familyname, const QString &foundryname, QFont::Weight weight, diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 26b6a8aad75..e060c57aee7 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -46,7 +46,6 @@ #include "qrawfont.h" #include "qrawfont_p.h" -#include #include QT_BEGIN_NAMESPACE @@ -77,7 +76,7 @@ QT_BEGIN_NAMESPACE A QRawFont object represents a single, physical instance of a given font in a given pixel size. I.e. in the typical case it represents a set of TrueType or OpenType font tables and uses a - user specified pixel size to convert metrics into logical pixel units. In can be used in + user specified pixel size to convert metrics into logical pixel units. It can be used in combination with the QGlyphRun class to draw specific glyph indexes at specific positions, and also have accessors to some relevant data in the physical font. @@ -190,8 +189,7 @@ QRawFont &QRawFont::operator=(const QRawFont &other) */ bool QRawFont::isValid() const { - Q_ASSERT(d->thread == 0 || d->thread == QThread::currentThread()); - return d->fontEngine != 0; + return d->isValid(); } /*! @@ -225,7 +223,7 @@ void QRawFont::loadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { - detach(); + d.detach(); d->cleanUp(); d->hintingPreference = hintingPreference; d->thread = QThread::currentThread(); @@ -247,13 +245,13 @@ void QRawFont::loadFromData(const QByteArray &fontData, QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialiasingType, const QTransform &transform) const { - if (!isValid()) + if (!d->isValid()) return QImage(); if (antialiasingType == SubPixelAntialiasing) return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), 0, transform); - else - return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform); + + return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform); } /*! @@ -266,7 +264,7 @@ QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialias */ QPainterPath QRawFont::pathForGlyph(quint32 glyphIndex) const { - if (!isValid()) + if (!d->isValid()) return QPainterPath(); QFixedPoint position; @@ -283,6 +281,12 @@ bool QRawFont::operator==(const QRawFont &other) const return d->fontEngine == other.d->fontEngine; } +/*! + \fn bool QRawFont::operator!=(const QRawFont &other) const + + Returns true if this QRawFont is not equal to \a other. Otherwise, returns false. +*/ + /*! Returns the ascent of this QRawFont in pixel units. @@ -290,10 +294,7 @@ bool QRawFont::operator==(const QRawFont &other) const */ qreal QRawFont::ascent() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->ascent().toReal(); + return d->isValid() ? d->fontEngine->ascent().toReal() : 0.0; } /*! @@ -303,10 +304,7 @@ qreal QRawFont::ascent() const */ qreal QRawFont::descent() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->descent().toReal(); + return d->isValid() ? d->fontEngine->descent().toReal() : 0.0; } /*! @@ -316,10 +314,7 @@ qreal QRawFont::descent() const */ qreal QRawFont::xHeight() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->xHeight().toReal(); + return d->isValid() ? d->fontEngine->xHeight().toReal() : 0.0; } /*! @@ -329,10 +324,7 @@ qreal QRawFont::xHeight() const */ qreal QRawFont::leading() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->leading().toReal(); + return d->isValid() ? d->fontEngine->leading().toReal() : 0.0; } /*! @@ -342,10 +334,7 @@ qreal QRawFont::leading() const */ qreal QRawFont::averageCharWidth() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->averageCharWidth().toReal(); + return d->isValid() ? d->fontEngine->averageCharWidth().toReal() : 0.0; } /*! @@ -355,10 +344,7 @@ qreal QRawFont::averageCharWidth() const */ qreal QRawFont::maxCharWidth() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->maxCharWidth(); + return d->isValid() ? d->fontEngine->maxCharWidth() : 0.0; } /*! @@ -370,10 +356,7 @@ qreal QRawFont::maxCharWidth() const */ qreal QRawFont::pixelSize() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->fontDef.pixelSize; + return d->isValid() ? d->fontEngine->fontDef.pixelSize : 0.0; } /*! @@ -386,10 +369,7 @@ qreal QRawFont::pixelSize() const */ qreal QRawFont::unitsPerEm() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->emSquareSize().toReal(); + return d->isValid() ? d->fontEngine->emSquareSize().toReal() : 0.0; } /*! @@ -421,10 +401,7 @@ qreal QRawFont::underlinePosition() const */ QString QRawFont::familyName() const { - if (!isValid()) - return QString(); - - return d->fontEngine->fontDef.family; + return d->isValid() ? d->fontEngine->fontDef.family : QString(); } /*! @@ -434,10 +411,7 @@ QString QRawFont::familyName() const */ QString QRawFont::styleName() const { - if (!isValid()) - return QString(); - - return d->fontEngine->fontDef.styleName; + return d->isValid() ? d->fontEngine->fontDef.styleName : QString(); } /*! @@ -447,10 +421,7 @@ QString QRawFont::styleName() const */ QFont::Style QRawFont::style() const { - if (!isValid()) - return QFont::StyleNormal; - - return QFont::Style(d->fontEngine->fontDef.style); + return d->isValid() ? QFont::Style(d->fontEngine->fontDef.style) : QFont::StyleNormal; } /*! @@ -460,10 +431,7 @@ QFont::Style QRawFont::style() const */ int QRawFont::weight() const { - if (!isValid()) - return -1; - - return int(d->fontEngine->fontDef.weight); + return d->isValid() ? int(d->fontEngine->fontDef.weight) : -1; } /*! @@ -481,7 +449,7 @@ int QRawFont::weight() const */ QVector QRawFont::glyphIndexesForString(const QString &text) const { - if (!isValid()) + if (!d->isValid()) return QVector(); int nglyphs = text.size(); @@ -513,7 +481,7 @@ QVector QRawFont::glyphIndexesForString(const QString &text) const */ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *glyphIndexes, int *numGlyphs) const { - if (!isValid()) + if (!d->isValid()) return false; QGlyphLayout glyphs; @@ -530,7 +498,7 @@ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *g */ QVector QRawFont::advancesForGlyphIndexes(const QVector &glyphIndexes) const { - if (!isValid()) + if (!d->isValid()) return QVector(); int numGlyphs = glyphIndexes.size(); @@ -557,7 +525,7 @@ QVector QRawFont::advancesForGlyphIndexes(const QVector &glyph */ bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs) const { - if (!isValid()) + if (!d->isValid()) return false; QGlyphLayout glyphs; @@ -583,10 +551,7 @@ bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *adv */ QFont::HintingPreference QRawFont::hintingPreference() const { - if (!isValid()) - return QFont::PreferDefaultHinting; - - return d->hintingPreference; + return d->isValid() ? d->hintingPreference : QFont::PreferDefaultHinting; } /*! @@ -597,7 +562,7 @@ QFont::HintingPreference QRawFont::hintingPreference() const */ QByteArray QRawFont::fontTable(const char *tagName) const { - if (!isValid()) + if (!d->isValid()) return QByteArray(); const quint32 *tagId = reinterpret_cast(tagName); @@ -620,9 +585,9 @@ extern QList qt_determine_writing_systems_from_tru */ QList QRawFont::supportedWritingSystems() const { - if (isValid()) { + if (d->isValid()) { QByteArray os2Table = fontTable("OS/2"); - if (!os2Table.isEmpty() && os2Table.size() > 86) { + if (os2Table.size() > 86) { char *data = os2Table.data(); quint32 *bigEndianUnicodeRanges = reinterpret_cast(data + 42); quint32 *bigEndianCodepageRanges = reinterpret_cast(data + 78); @@ -650,10 +615,7 @@ QList QRawFont::supportedWritingSystems() const */ bool QRawFont::supportsCharacter(const QChar &character) const { - if (!isValid()) - return false; - - return d->fontEngine->canRender(&character, 1); + return d->isValid() && d->fontEngine->canRender(&character, 1); } /*! @@ -663,7 +625,7 @@ bool QRawFont::supportsCharacter(const QChar &character) const */ bool QRawFont::supportsCharacter(quint32 ucs4) const { - if (!isValid()) + if (!d->isValid()) return false; QString str = QString::fromUcs4(&ucs4, 1); @@ -682,6 +644,7 @@ extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSyst */ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writingSystem) { + QRawFont rawFont; #if defined(Q_WS_MAC) QTextLayout layout(QFontDatabase::writingSystemSample(writingSystem), font); layout.beginLayout(); @@ -692,14 +655,12 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ // Pick the one matches the family name we originally requested, // if none of them match, just pick the first one for (int i = 0; i < list.size(); i++) { - QGlyphRun glyphs = list.at(i); - QRawFont rawfont = glyphs.rawFont(); + rawfont = list.at(i).rawFont(); if (rawfont.familyName() == font.family()) return rawfont; } return list.at(0).rawFont(); } - return QRawFont(); #else QFontPrivate *font_d = QFontPrivate::get(font); int script = qt_script_for_writing_system(writingSystem); @@ -715,15 +676,12 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ } if (fe != 0) { - QRawFont rawFont; rawFont.d.data()->fontEngine = fe; rawFont.d.data()->fontEngine->ref.ref(); rawFont.d.data()->hintingPreference = font.hintingPreference(); - return rawFont; - } else { - return QRawFont(); } #endif + return rawFont; } /*! @@ -734,7 +692,7 @@ void QRawFont::setPixelSize(qreal pixelSize) if (d->fontEngine == 0) return; - detach(); + d.detach(); QFontEngine *oldFontEngine = d->fontEngine; d->fontEngine = d->fontEngine->cloneWithSize(pixelSize); @@ -746,15 +704,6 @@ void QRawFont::setPixelSize(qreal pixelSize) delete oldFontEngine; } -/*! - \internal -*/ -void QRawFont::detach() -{ - if (d->ref != 1) - d.detach(); -} - /*! \internal */ diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index f7d7494f0b1..b66bc04eabf 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -81,7 +81,10 @@ public: bool isValid() const; QRawFont &operator=(const QRawFont &other); + bool operator==(const QRawFont &other) const; + inline bool operator!=(const QRawFont &other) const + { return !operator==(other); } QString familyName() const; QString styleName() const; @@ -137,8 +140,6 @@ private: friend class QRawFontPrivate; friend class QTextLayout; - void detach(); - QExplicitlySharedDataPointer d; }; diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h index 4a4ed56223e..0187c374a0a 100644 --- a/src/gui/text/qrawfont_p.h +++ b/src/gui/text/qrawfont_p.h @@ -54,7 +54,9 @@ // #include "qrawfont.h" + #include "qfontengine_p.h" +#include #include #if !defined(QT_NO_RAWFONT) @@ -96,6 +98,12 @@ public: cleanUp(); } + inline bool isValid() const + { + Q_ASSERT(thread == 0 || thread == QThread::currentThread()); + return fontEngine != 0; + } + void cleanUp(); void platformCleanUp(); void platformLoadFromData(const QByteArray &fontData, diff --git a/src/gui/text/qrawfont_qpa.cpp b/src/gui/text/qrawfont_qpa.cpp index 6a69804facb..47815baf062 100644 --- a/src/gui/text/qrawfont_qpa.cpp +++ b/src/gui/text/qrawfont_qpa.cpp @@ -45,7 +45,7 @@ #include "qrawfont_p.h" #include -#include +#include QT_BEGIN_NAMESPACE @@ -58,7 +58,7 @@ void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, qreal pix { Q_ASSERT(fontEngine == 0); - QPlatformFontDatabase *pfdb = QApplicationPrivate::platformIntegration()->fontDatabase(); + QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); fontEngine = pfdb->fontEngine(fontData, pixelSize, hintingPreference); if (fontEngine != 0) fontEngine->ref.ref(); diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 388be3999c8..bed0da62da7 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -45,8 +45,6 @@ #include #include -#include - QT_BEGIN_NAMESPACE /*! @@ -141,7 +139,7 @@ QT_BEGIN_NAMESPACE can be used to indicate that the QStaticText should use additional caches, if possible, to improve performance at the expense of memory. In particular, setting the performance hint AggressiveCaching on the QStaticText will improve performance when using the OpenGL graphics - system or when drawing to a QGLWidget. + system or when drawing to a QOpenGLWidget. \value ModerateCaching Do basic caching for high performance at a low memory cost. \value AggressiveCaching Use additional caching when available. This may improve performance diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 5d6c0052f41..5f1a53b556e 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -50,7 +50,6 @@ #include #include #include -#include #include QT_BEGIN_NAMESPACE @@ -311,10 +310,19 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block) /*! Constructs a QSyntaxHighlighter with the given \a parent. + + If the parent is a QTextEdit, it installs the syntaxhighlighter on the + parents document. The specified QTextEdit also becomes the owner of + the QSyntaxHighlighter. */ QSyntaxHighlighter::QSyntaxHighlighter(QObject *parent) : QObject(*new QSyntaxHighlighterPrivate, parent) { + if (parent->inherits("QTextEdit")) { + QTextDocument *doc = qobject_cast(parent->property("document").value()); + if (doc) + setDocument(doc); + } } /*! @@ -328,17 +336,6 @@ QSyntaxHighlighter::QSyntaxHighlighter(QTextDocument *parent) setDocument(parent); } -/*! - Constructs a QSyntaxHighlighter and installs it on \a parent 's - QTextDocument. The specified QTextEdit also becomes the owner of - the QSyntaxHighlighter. -*/ -QSyntaxHighlighter::QSyntaxHighlighter(QTextEdit *parent) - : QObject(*new QSyntaxHighlighterPrivate, parent) -{ - setDocument(parent->document()); -} - /*! Destructor. Uninstalls this syntax highlighter from the text document. */ diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h index 9ee09c1f1df..1c421d1c260 100644 --- a/src/gui/text/qsyntaxhighlighter.h +++ b/src/gui/text/qsyntaxhighlighter.h @@ -61,7 +61,6 @@ class QTextCharFormat; class QFont; class QColor; class QTextBlockUserData; -class QTextEdit; class Q_GUI_EXPORT QSyntaxHighlighter : public QObject { @@ -70,7 +69,6 @@ class Q_GUI_EXPORT QSyntaxHighlighter : public QObject public: QSyntaxHighlighter(QObject *parent); QSyntaxHighlighter(QTextDocument *parent); - QSyntaxHighlighter(QTextEdit *parent); virtual ~QSyntaxHighlighter(); void setDocument(QTextDocument *doc); diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index a04bcc561a9..2faa5e20789 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -51,43 +51,40 @@ #include #include #include -#include -#include #include +#include #include "private/qtextdocumentlayout_p.h" #include "private/qabstracttextdocumentlayout_p.h" -#include "private/qtextedit_p.h" #include "qtextdocument.h" #include "private/qtextdocument_p.h" #include "qtextlist.h" -#include "private/qtextcontrol_p.h" -#include "qgraphicssceneevent.h" -#include "qprinter.h" #include "qtextdocumentwriter.h" #include "private/qtextcursor_p.h" +#include "qpagedpaintdevice.h" +#include "private/qpagedpaintdevice_p.h" #include #include #include -#include +#include #include #include #include #include -#include -#include -#include -#include -#include +#include -#ifndef QT_NO_SHORTCUT -#include "private/qapplication_p.h" -#include "private/qshortcutmap_p.h" -#include -#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString()) -#else -#define ACCEL_KEY(k) QString() -#endif +// ### these should come from QStyleHints +const int textCursorWidth = 1; +const bool fullWidthSelection = true; + +//#ifndef QT_NO_SHORTCUT +//#include "private/QGuiApplication_p.h" +//#include "private/qshortcutmap_p.h" +//#include +//#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString()) +//#else +//#define ACCEL_KEY(k) QString() +//#endif QT_BEGIN_NAMESPACE @@ -273,9 +270,9 @@ bool QTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) bool isNavigationEvent = e->key() == Qt::Key_Up || e->key() == Qt::Key_Down; #ifdef QT_KEYPAD_NAVIGATION - ignoreNavigationEvents = ignoreNavigationEvents || QApplication::keypadNavigationEnabled(); + ignoreNavigationEvents = ignoreNavigationEvents || QGuiApplication::keypadNavigationEnabled(); isNavigationEvent = isNavigationEvent || - (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional + (QGuiApplication::navigationMode() == Qt::NavigationModeKeypadDirectional && (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right)); #else isNavigationEvent = isNavigationEvent || e->key() == Qt::Key_Left || e->key() == Qt::Key_Right; @@ -427,7 +424,7 @@ void QTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, doc = document; clearDocument = false; } else { - palette = QApplication::palette("QTextControl"); + palette = QGuiApplication::palette(); doc = new QTextDocument(q); } _q_documentLayoutChanged(); @@ -506,11 +503,11 @@ void QTextControlPrivate::startDrag() #ifndef QT_NO_DRAGANDDROP Q_Q(QTextControl); mousePressed = false; - if (!contextWidget) + if (!contextObject) return; QMimeData *data = q->createMimeDataFromSelection(); - QDrag *drag = new QDrag(contextWidget); + QDrag *drag = new QDrag(contextObject); drag->setMimeData(data); Qt::DropActions actions = Qt::CopyAction; @@ -522,7 +519,7 @@ void QTextControlPrivate::startDrag() action = drag->exec(actions, Qt::CopyAction); } - if (action == Qt::MoveAction && drag->target() != contextWidget) + if (action == Qt::MoveAction && drag->target() != contextObject) cursor.removeSelectedText(); #endif } @@ -606,7 +603,7 @@ void QTextControlPrivate::_q_updateCurrentCharFormatAndSelection() #ifndef QT_NO_CLIPBOARD void QTextControlPrivate::setClipboardSelection() { - QClipboard *clipboard = QApplication::clipboard(); + QClipboard *clipboard = QGuiApplication::clipboard(); if (!cursor.hasSelection() || !clipboard->supportsSelection()) return; Q_Q(QTextControl); @@ -638,8 +635,8 @@ void QTextControlPrivate::setBlinkingCursorEnabled(bool enable) { Q_Q(QTextControl); - if (enable && QApplication::cursorFlashTime() > 0) - cursorBlinkTimer.start(QApplication::cursorFlashTime() / 2, q); + if (enable && qApp->styleHints()->cursorFlashTime() > 0) + cursorBlinkTimer.start(qApp->styleHints()->cursorFlashTime() / 2, q); else cursorBlinkTimer.stop(); @@ -808,6 +805,18 @@ QTextControl::~QTextControl() { } +void QTextControl::setView(QObject *view) +{ + Q_D(QTextControl); + d->contextObject = view; +} + +QObject *QTextControl::view() const +{ + Q_D(const QTextControl); + return d->contextObject; +} + void QTextControl::setDocument(QTextDocument *document) { Q_D(QTextControl); @@ -869,12 +878,12 @@ void QTextControl::copy() if (!d->cursor.hasSelection()) return; QMimeData *data = createMimeDataFromSelection(); - QApplication::clipboard()->setMimeData(data); + QGuiApplication::clipboard()->setMimeData(data); } void QTextControl::paste(QClipboard::Mode mode) { - const QMimeData *md = QApplication::clipboard()->mimeData(mode); + const QMimeData *md = QGuiApplication::clipboard()->mimeData(mode); if (md) insertFromMimeData(md); } @@ -899,14 +908,14 @@ void QTextControl::selectAll() emit updateRequest(); } -void QTextControl::processEvent(QEvent *e, const QPointF &coordinateOffset, QWidget *contextWidget) +void QTextControl::processEvent(QEvent *e, const QPointF &coordinateOffset) { QMatrix m; m.translate(coordinateOffset.x(), coordinateOffset.y()); - processEvent(e, m, contextWidget); + processEvent(e, m); } -void QTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget) +void QTextControl::processEvent(QEvent *e, const QMatrix &matrix) { Q_D(QTextControl); if (d->interactionFlags == Qt::NoTextInteraction) { @@ -914,33 +923,6 @@ void QTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *conte return; } - d->contextWidget = contextWidget; - - if (!d->contextWidget) { - switch (e->type()) { -#ifndef QT_NO_GRAPHICSVIEW - case QEvent::GraphicsSceneMouseMove: - case QEvent::GraphicsSceneMousePress: - case QEvent::GraphicsSceneMouseRelease: - case QEvent::GraphicsSceneMouseDoubleClick: - case QEvent::GraphicsSceneContextMenu: - case QEvent::GraphicsSceneHoverEnter: - case QEvent::GraphicsSceneHoverMove: - case QEvent::GraphicsSceneHoverLeave: - case QEvent::GraphicsSceneHelp: - case QEvent::GraphicsSceneDragEnter: - case QEvent::GraphicsSceneDragMove: - case QEvent::GraphicsSceneDragLeave: - case QEvent::GraphicsSceneDrop: { - QGraphicsSceneEvent *ev = static_cast(e); - d->contextWidget = ev->widget(); - break; - } -#endif // QT_NO_GRAPHICSVIEW - default: break; - }; - } - switch (e->type()) { case QEvent::KeyPress: d->keyPressEvent(static_cast(e)); @@ -968,12 +950,6 @@ void QTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *conte case QEvent::InputMethod: d->inputMethodEvent(static_cast(e)); break; -#ifndef QT_NO_CONTEXTMENU - case QEvent::ContextMenu: { - QContextMenuEvent *ev = static_cast(e); - d->contextMenuEvent(ev->globalPos(), matrix.map(ev->pos()), contextWidget); - break; } -#endif // QT_NO_CONTEXTMENU case QEvent::FocusIn: case QEvent::FocusOut: d->focusEvent(static_cast(e)); @@ -983,14 +959,6 @@ void QTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *conte d->isEnabled = e->isAccepted(); break; -#ifndef QT_NO_TOOLTIP - case QEvent::ToolTip: { - QHelpEvent *ev = static_cast(e); - d->showToolTip(ev->globalPos(), matrix.map(ev->pos()), contextWidget); - break; - } -#endif // QT_NO_TOOLTIP - #ifndef QT_NO_DRAGANDDROP case QEvent::DragEnter: { QDragEnterEvent *ev = static_cast(e); @@ -1015,61 +983,10 @@ void QTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *conte } #endif -#ifndef QT_NO_GRAPHICSVIEW - case QEvent::GraphicsSceneMousePress: { - QGraphicsSceneMouseEvent *ev = static_cast(e); - d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), - ev->screenPos()); - break; } - case QEvent::GraphicsSceneMouseMove: { - QGraphicsSceneMouseEvent *ev = static_cast(e); - d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), - ev->screenPos()); - break; } - case QEvent::GraphicsSceneMouseRelease: { - QGraphicsSceneMouseEvent *ev = static_cast(e); - d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), - ev->screenPos()); - break; } - case QEvent::GraphicsSceneMouseDoubleClick: { - QGraphicsSceneMouseEvent *ev = static_cast(e); - d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), - ev->screenPos()); - break; } - case QEvent::GraphicsSceneContextMenu: { - QGraphicsSceneContextMenuEvent *ev = static_cast(e); - d->contextMenuEvent(ev->screenPos(), matrix.map(ev->pos()), contextWidget); - break; } - - case QEvent::GraphicsSceneHoverMove: { - QGraphicsSceneHoverEvent *ev = static_cast(e); - d->mouseMoveEvent(ev, Qt::NoButton, matrix.map(ev->pos()), ev->modifiers(),Qt::NoButton, - ev->screenPos()); - break; } - - case QEvent::GraphicsSceneDragEnter: { - QGraphicsSceneDragDropEvent *ev = static_cast(e); - if (d->dragEnterEvent(e, ev->mimeData())) - ev->acceptProposedAction(); - break; } - case QEvent::GraphicsSceneDragLeave: - d->dragLeaveEvent(); - break; - case QEvent::GraphicsSceneDragMove: { - QGraphicsSceneDragDropEvent *ev = static_cast(e); - if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))) - ev->acceptProposedAction(); - break; } - case QEvent::GraphicsSceneDrop: { - QGraphicsSceneDragDropEvent *ev = static_cast(e); - if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())) - ev->accept(); - break; } -#endif // QT_NO_GRAPHICSVIEW #ifdef QT_KEYPAD_NAVIGATION case QEvent::EnterEditFocus: case QEvent::LeaveEditFocus: - if (QApplication::keypadNavigationEnabled()) + if (QGuiApplication::keypadNavigationEnabled()) d->editFocusEvent(e); break; #endif @@ -1140,9 +1057,10 @@ void QTextControl::timerEvent(QTimerEvent *e) if (e->timerId() == d->cursorBlinkTimer.timerId()) { d->cursorOn = !d->cursorOn; - if (d->cursor.hasSelection()) - d->cursorOn &= (QApplication::style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected) - != 0); + // ### +// if (d->cursor.hasSelection()) +// d->cursorOn &= (QGuiApplication::style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected) +// != 0); d->repaintCursor(); } else if (e->timerId() == d->trippleClickTimer.timerId()) { @@ -1323,7 +1241,7 @@ process: QVariant QTextControl::loadResource(int type, const QUrl &name) { -#ifdef QT_NO_TEXTEDIT +#if 1 Q_UNUSED(type); Q_UNUSED(name); #else @@ -1544,7 +1462,7 @@ void QTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton button, con #endif if (trippleClickTimer.isActive() - && ((pos - trippleClickPoint).toPoint().manhattanLength() < QApplication::startDragDistance())) { + && ((pos - trippleClickPoint).toPoint().manhattanLength() < qApp->styleHints()->startDragDistance())) { cursor.movePosition(QTextCursor::StartOfBlock); cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); @@ -1642,7 +1560,7 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons const int oldCursorPos = cursor.position(); if (mightStartDrag) { - if ((mousePos.toPoint() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) + if ((mousePos.toPoint() - dragStartPos).manhattanLength() > qApp->styleHints()->startDragDistance()) startDrag(); return; } @@ -1675,13 +1593,8 @@ void QTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, cons if (cursor.position() != oldCursorPos) emit q->cursorPositionChanged(); _q_updateCurrentCharFormatAndSelection(); -#ifndef QT_NO_IM - if (contextWidget) { - if (QInputContext *ic = inputContext()) { - ic->update(); - } - } -#endif //QT_NO_IM + if (qGuiApp) + qGuiApp->inputPanel()->update(Qt::ImQueryAll); } else { //emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1))); if (cursor.position() != oldCursorPos) { @@ -1721,9 +1634,9 @@ void QTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton button, c selectionChanged(true); } else if (button == Qt::MidButton && (interactionFlags & Qt::TextEditable) - && QApplication::clipboard()->supportsSelection()) { + && QGuiApplication::clipboard()->supportsSelection()) { setCursorPosition(pos); - const QMimeData *md = QApplication::clipboard()->mimeData(QClipboard::Selection); + const QMimeData *md = QGuiApplication::clipboard()->mimeData(QClipboard::Selection); if (md) q->insertFromMimeData(md); #endif @@ -1793,7 +1706,7 @@ void QTextControlPrivate::mouseDoubleClickEvent(QEvent *e, Qt::MouseButton butto selectedWordOnDoubleClick = cursor; trippleClickPoint = pos; - trippleClickTimer.start(QApplication::doubleClickInterval(), q); + trippleClickTimer.start(qApp->styleHints()->mouseDoubleClickInterval(), q); if (doEmit) { selectionChanged(); #ifndef QT_NO_CLIPBOARD @@ -1807,11 +1720,11 @@ bool QTextControlPrivate::sendMouseEventToInputContext( QEvent *e, QEvent::Type eventType, Qt::MouseButton button, const QPointF &pos, Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint &globalPos) { -#if !defined(QT_NO_IM) +#if 0 // ### !defined(QT_NO_IM) Q_Q(QTextControl); QTextLayout *layout = cursor.block().layout(); - if (contextWidget && layout && !layout->preeditAreaText().isEmpty()) { + if (contextObject && layout && !layout->preeditAreaText().isEmpty()) { QInputContext *ctx = inputContext(); int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position(); @@ -1822,7 +1735,7 @@ bool QTextControlPrivate::sendMouseEventToInputContext( return true; } if (ctx) { - QMouseEvent ev(eventType, contextWidget->mapFromGlobal(globalPos), globalPos, + QMouseEvent ev(eventType, contextObject->mapFromGlobal(globalPos), globalPos, button, buttons, modifiers); ctx->mouseHandler(cursorPos, &ev); e->setAccepted(ev.isAccepted()); @@ -1842,24 +1755,6 @@ bool QTextControlPrivate::sendMouseEventToInputContext( return false; } -void QTextControlPrivate::contextMenuEvent(const QPoint &screenPos, const QPointF &docPos, QWidget *contextWidget) -{ -#ifdef QT_NO_CONTEXTMENU - Q_UNUSED(screenPos); - Q_UNUSED(docPos); - Q_UNUSED(contextWidget); -#else - Q_Q(QTextControl); - if (!hasFocus) - return; - QMenu *menu = q->createStandardContextMenu(docPos, contextWidget); - if (!menu) - return; - menu->setAttribute(Qt::WA_DeleteOnClose); - menu->popup(screenPos); -#endif -} - bool QTextControlPrivate::dragEnterEvent(QEvent *e, const QMimeData *mimeData) { Q_Q(QTextControl); @@ -1908,7 +1803,7 @@ bool QTextControlPrivate::dragMoveEvent(QEvent *e, const QMimeData *mimeData, co return true; // accept proposed action } -bool QTextControlPrivate::dropEvent(const QMimeData *mimeData, const QPointF &pos, Qt::DropAction dropAction, QWidget *source) +bool QTextControlPrivate::dropEvent(const QMimeData *mimeData, const QPointF &pos, Qt::DropAction dropAction, QObject *source) { Q_Q(QTextControl); dndFeedbackCursor = QTextCursor(); @@ -1921,7 +1816,7 @@ bool QTextControlPrivate::dropEvent(const QMimeData *mimeData, const QPointF &po QTextCursor insertionCursor = q->cursorForPosition(pos); insertionCursor.beginEditBlock(); - if (dropAction == Qt::MoveAction && source == contextWidget) + if (dropAction == Qt::MoveAction && source == contextObject) cursor.removeSelectedText(); cursor = insertionCursor; @@ -1995,8 +1890,9 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) } layout->setAdditionalFormats(overrides); cursor.endEditBlock(); - if (cursor.d) - cursor.d->setX(); + QTextCursorPrivate *cursor_d = QTextCursorPrivate::getPrivate(&cursor); + if (cursor_d) + cursor_d->setX(); if (oldPreeditCursor != preeditCursor) emit q->microFocusChanged(); selectionChanged(forceSelectionChanged); @@ -2007,7 +1903,7 @@ QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const Q_D(const QTextControl); QTextBlock block = d->cursor.block(); switch(property) { - case Qt::ImMicroFocus: + case Qt::ImCursorRectangle: return cursorRect(); case Qt::ImFont: return QVariant(d->cursor.charFormat().font()); @@ -2039,7 +1935,7 @@ void QTextControlPrivate::focusEvent(QFocusEvent *e) emit q->updateRequest(q->selectionRect()); if (e->gotFocus()) { #ifdef QT_KEYPAD_NAVIGATION - if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason + if (!QGuiApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason #ifdef Q_OS_SYMBIAN || e->reason() == Qt::ActiveWindowFocusReason #endif @@ -2084,7 +1980,7 @@ void QTextControlPrivate::editFocusEvent(QEvent *e) { Q_Q(QTextControl); - if (QApplication::keypadNavigationEnabled()) { + if (QGuiApplication::keypadNavigationEnabled()) { if (e->type() == QEvent::EnterEditFocus && interactionFlags & Qt::TextEditable) { const QTextCursor oldSelection = cursor; const int oldCursorPos = cursor.position(); @@ -2107,87 +2003,6 @@ void QTextControlPrivate::editFocusEvent(QEvent *e) } #endif -#ifndef QT_NO_CONTEXTMENU -QMenu *QTextControl::createStandardContextMenu(const QPointF &pos, QWidget *parent) -{ - Q_D(QTextControl); - - const bool showTextSelectionActions = d->interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse); - - d->linkToCopy = QString(); - if (!pos.isNull()) - d->linkToCopy = anchorAt(pos); - - if (d->linkToCopy.isEmpty() && !showTextSelectionActions) - return 0; - - QMenu *menu = new QMenu(parent); - QAction *a; - - if (d->interactionFlags & Qt::TextEditable) { - a = menu->addAction(tr("&Undo") + ACCEL_KEY(QKeySequence::Undo), this, SLOT(undo())); - a->setEnabled(d->doc->isUndoAvailable()); - a = menu->addAction(tr("&Redo") + ACCEL_KEY(QKeySequence::Redo), this, SLOT(redo())); - a->setEnabled(d->doc->isRedoAvailable()); - menu->addSeparator(); - - a = menu->addAction(tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut), this, SLOT(cut())); - a->setEnabled(d->cursor.hasSelection()); - } - - if (showTextSelectionActions) { - a = menu->addAction(tr("&Copy") + ACCEL_KEY(QKeySequence::Copy), this, SLOT(copy())); - a->setEnabled(d->cursor.hasSelection()); - } - - if ((d->interactionFlags & Qt::LinksAccessibleByKeyboard) - || (d->interactionFlags & Qt::LinksAccessibleByMouse)) { - - a = menu->addAction(tr("Copy &Link Location"), this, SLOT(_q_copyLink())); - a->setEnabled(!d->linkToCopy.isEmpty()); - } - - if (d->interactionFlags & Qt::TextEditable) { -#if !defined(QT_NO_CLIPBOARD) - a = menu->addAction(tr("&Paste") + ACCEL_KEY(QKeySequence::Paste), this, SLOT(paste())); - a->setEnabled(canPaste()); -#endif - a = menu->addAction(tr("Delete"), this, SLOT(_q_deleteSelected())); - a->setEnabled(d->cursor.hasSelection()); - } - - - if (showTextSelectionActions) { - menu->addSeparator(); - a = menu->addAction(tr("Select All") + ACCEL_KEY(QKeySequence::SelectAll), this, SLOT(selectAll())); - a->setEnabled(!d->doc->isEmpty()); - } - -#if !defined(QT_NO_IM) - if (d->contextWidget) { - QInputContext *qic = d->inputContext(); - if (qic) { - QList imActions = qic->actions(); - for (int i = 0; i < imActions.size(); ++i) - menu->addAction(imActions.at(i)); - } - } -#endif - -#if defined(Q_WS_WIN) || defined(Q_WS_X11) - if ((d->interactionFlags & Qt::TextEditable) && qt_use_rtl_extensions) { -#else - if (d->interactionFlags & Qt::TextEditable) { -#endif - menu->addSeparator(); - QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, menu); - menu->addMenu(ctrlCharacterMenu); - } - - return menu; -} -#endif // QT_NO_CONTEXTMENU - QTextCursor QTextControl::cursorForPosition(const QPointF &pos) const { Q_D(const QTextControl); @@ -2264,7 +2079,7 @@ void QTextControl::setCursorWidth(int width) Q_UNUSED(width); #else if (width == -1) - width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth); + width = textCursorWidth; d->doc->documentLayout()->setProperty("cursorWidth", width); #endif d->repaintCursor(); @@ -2282,9 +2097,7 @@ void QTextControl::setAcceptRichText(bool accept) d->acceptRichText = accept; } -#ifndef QT_NO_TEXTEDIT - -void QTextControl::setExtraSelections(const QList &selections) +void QTextControl::setExtraSelections(const QVector &selections) { Q_D(QTextControl); @@ -2295,7 +2108,7 @@ void QTextControl::setExtraSelections(const QList &se } for (int i = 0; i < selections.count(); ++i) { - const QTextEdit::ExtraSelection &sel = selections.at(i); + const QAbstractTextDocumentLayout::Selection &sel = selections.at(i); QHash::iterator it = hash.find(sel.cursor.anchor()); if (it != hash.end()) { const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(it.value()); @@ -2323,28 +2136,15 @@ void QTextControl::setExtraSelections(const QList &se emit updateRequest(r); } - d->extraSelections.resize(selections.count()); - for (int i = 0; i < selections.count(); ++i) { - d->extraSelections[i].cursor = selections.at(i).cursor; - d->extraSelections[i].format = selections.at(i).format; - } + d->extraSelections = selections; } -QList QTextControl::extraSelections() const +QVector QTextControl::extraSelections() const { Q_D(const QTextControl); - QList selections; - for (int i = 0; i < d->extraSelections.count(); ++i) { - QTextEdit::ExtraSelection sel; - sel.cursor = d->extraSelections.at(i).cursor; - sel.format = d->extraSelections.at(i).format; - selections.append(sel); - } - return selections; + return d->extraSelections; } -#endif // QT_NO_TEXTEDIT - void QTextControl::setTextWidth(qreal width) { Q_D(QTextControl); @@ -2404,7 +2204,7 @@ bool QTextControl::canPaste() const #ifndef QT_NO_CLIPBOARD Q_D(const QTextControl); if (d->interactionFlags & Qt::TextEditable) { - const QMimeData *md = QApplication::clipboard()->mimeData(); + const QMimeData *md = QGuiApplication::clipboard()->mimeData(); return md && canInsertFromMimeData(md); } #endif @@ -2449,16 +2249,14 @@ bool QTextControl::isWordSelectionEnabled() const return d->wordSelectionEnabled; } -#ifndef QT_NO_PRINTER -void QTextControl::print(QPrinter *printer) const +void QTextControl::print(QPagedPaintDevice *printer) const { -#ifndef QT_NO_PRINTER Q_D(const QTextControl); - if (!printer || !printer->isValid()) + if (!printer) return; QTextDocument *tempDoc = 0; const QTextDocument *doc = d->doc; - if (printer->printRange() == QPrinter::Selection) { + if (QPagedPaintDevicePrivate::get(printer)->printSelectionOnly) { if (!d->cursor.hasSelection()) return; tempDoc = new QTextDocument(const_cast(doc)); @@ -2474,9 +2272,7 @@ void QTextControl::print(QPrinter *printer) const } doc->print(printer); delete tempDoc; -#endif } -#endif // QT_NO_PRINTER QMimeData *QTextControl::createMimeDataFromSelection() const { @@ -2734,7 +2530,7 @@ void QTextControlPrivate::activateLinkUnderCursor(QString href) } repaintOldAndNewSelection(oldCursor); -#ifndef QT_NO_DESKTOPSERVICES +#if 0 // ###ndef QT_NO_DESKTOPSERVICES if (openExternalLinks) QDesktopServices::openUrl(href); else @@ -2742,16 +2538,6 @@ void QTextControlPrivate::activateLinkUnderCursor(QString href) emit q_func()->linkActivated(href); } -#ifndef QT_NO_TOOLTIP -void QTextControlPrivate::showToolTip(const QPoint &globalPos, const QPointF &pos, QWidget *contextWidget) -{ - const QString toolTip = q_func()->cursorForPosition(pos).charFormat().toolTip(); - if (toolTip.isEmpty()) - return; - QToolTip::showText(globalPos, toolTip, contextWidget); -} -#endif // QT_NO_TOOLTIP - bool QTextControl::setFocusToNextOrPreviousAnchor(bool next) { Q_D(QTextControl); @@ -2988,7 +2774,7 @@ bool QTextControl::cursorOn() const return d->cursorOn; } -QAbstractTextDocumentLayout::PaintContext QTextControl::getPaintContext(QWidget *widget) const +QAbstractTextDocumentLayout::PaintContext QTextControl::getPaintContext() const { Q_D(const QTextControl); @@ -3008,31 +2794,28 @@ QAbstractTextDocumentLayout::PaintContext QTextControl::getPaintContext(QWidget if (!d->dndFeedbackCursor.isNull()) ctx.cursorPosition = d->dndFeedbackCursor.position(); #ifdef QT_KEYPAD_NAVIGATION - if (!QApplication::keypadNavigationEnabled() || d->hasEditFocus) + if (!QGuiApplication::keypadNavigationEnabled() || d->hasEditFocus) #endif if (d->cursor.hasSelection()) { QAbstractTextDocumentLayout::Selection selection; selection.cursor = d->cursor; - if (d->cursorIsFocusIndicator) { + if (0 && d->cursorIsFocusIndicator) { +#if 0 + // ### QStyleOption opt; opt.palette = ctx.palette; QStyleHintReturnVariant ret; - QStyle *style = QApplication::style(); + QStyle *style = QGuiApplication::style(); if (widget) style = widget->style(); style->styleHint(QStyle::SH_TextControl_FocusIndicatorTextCharFormat, &opt, widget, &ret); selection.format = qvariant_cast(ret.variant).toCharFormat(); +#endif } else { QPalette::ColorGroup cg = d->hasFocus ? QPalette::Active : QPalette::Inactive; selection.format.setBackground(ctx.palette.brush(cg, QPalette::Highlight)); selection.format.setForeground(ctx.palette.brush(cg, QPalette::HighlightedText)); - QStyleOption opt; - QStyle *style = QApplication::style(); - if (widget) { - opt.initFrom(widget); - style = widget->style(); - } - if (style->styleHint(QStyle::SH_RichText_FullWidthSelection, &opt, widget)) + if (fullWidthSelection) selection.format.setProperty(QTextFormat::FullWidthSelection, true); } ctx.selections.append(selection); @@ -3041,11 +2824,11 @@ QAbstractTextDocumentLayout::PaintContext QTextControl::getPaintContext(QWidget return ctx; } -void QTextControl::drawContents(QPainter *p, const QRectF &rect, QWidget *widget) +void QTextControl::drawContents(QPainter *p, const QRectF &rect) { Q_D(QTextControl); p->save(); - QAbstractTextDocumentLayout::PaintContext ctx = getPaintContext(widget); + QAbstractTextDocumentLayout::PaintContext ctx = getPaintContext(); if (rect.isValid()) p->setClipRect(rect, Qt::IntersectClip); ctx.clip = rect; @@ -3059,16 +2842,21 @@ void QTextControlPrivate::_q_copyLink() #ifndef QT_NO_CLIPBOARD QMimeData *md = new QMimeData; md->setText(linkToCopy); - QApplication::clipboard()->setMimeData(md); + QGuiApplication::clipboard()->setMimeData(md); #endif } QInputContext *QTextControlPrivate::inputContext() { - QInputContext *ctx = contextWidget->inputContext(); - if (!ctx && contextWidget->parentWidget()) - ctx = contextWidget->parentWidget()->inputContext(); +#if 0 + // ### + QInputContext *ctx = contextObject->inputContext(); + if (!ctx && contextObject->parentWidget()) + ctx = contextObject->parentWidget()->inputContext(); return ctx; +#else + return 0; +#endif } int QTextControl::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const @@ -3083,59 +2871,7 @@ QRectF QTextControl::blockBoundingRect(const QTextBlock &block) const return d->doc->documentLayout()->blockBoundingRect(block); } -#ifndef QT_NO_CONTEXTMENU -#define NUM_CONTROL_CHARACTERS 10 -const struct QUnicodeControlCharacter { - const char *text; - ushort character; -} qt_controlCharacters[NUM_CONTROL_CHARACTERS] = { - { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRM Left-to-right mark"), 0x200e }, - { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLM Right-to-left mark"), 0x200f }, - { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWJ Zero width joiner"), 0x200d }, - { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWNJ Zero width non-joiner"), 0x200c }, - { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWSP Zero width space"), 0x200b }, - { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRE Start of left-to-right embedding"), 0x202a }, - { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLE Start of right-to-left embedding"), 0x202b }, - { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRO Start of left-to-right override"), 0x202d }, - { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLO Start of right-to-left override"), 0x202e }, - { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "PDF Pop directional formatting"), 0x202c }, -}; -QUnicodeControlCharacterMenu::QUnicodeControlCharacterMenu(QObject *_editWidget, QWidget *parent) - : QMenu(parent), editWidget(_editWidget) -{ - setTitle(tr("Insert Unicode control character")); - for (int i = 0; i < NUM_CONTROL_CHARACTERS; ++i) { - addAction(tr(qt_controlCharacters[i].text), this, SLOT(menuActionTriggered())); - } -} - -void QUnicodeControlCharacterMenu::menuActionTriggered() -{ - QAction *a = qobject_cast(sender()); - int idx = actions().indexOf(a); - if (idx < 0 || idx >= NUM_CONTROL_CHARACTERS) - return; - QChar c(qt_controlCharacters[idx].character); - QString str(c); - -#ifndef QT_NO_TEXTEDIT - if (QTextEdit *edit = qobject_cast(editWidget)) { - edit->insertPlainText(str); - return; - } -#endif - if (QTextControl *control = qobject_cast(editWidget)) { - control->insertPlainText(str); - } -#ifndef QT_NO_LINEEDIT - if (QLineEdit *edit = qobject_cast(editWidget)) { - edit->insert(str); - return; - } -#endif -} -#endif // QT_NO_CONTEXTMENU QStringList QTextEditMimeData::formats() const { diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h index c5ed0ee1e01..bb91415fd23 100644 --- a/src/gui/text/qtextcontrol_p.h +++ b/src/gui/text/qtextcontrol_p.h @@ -57,18 +57,11 @@ #include #include #include -#include -#include #include #include #include #include -#ifdef QT3_SUPPORT -#include -#include -#endif - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -77,12 +70,12 @@ QT_MODULE(Gui) class QStyleSheet; class QTextDocument; -class QMenu; class QTextControlPrivate; class QMimeData; class QAbstractScrollArea; class QEvent; class QTimerEvent; +class QPagedPaintDevice; class Q_GUI_EXPORT QTextControl : public QObject { @@ -103,6 +96,9 @@ public: explicit QTextControl(QTextDocument *doc, QObject *parent = 0); virtual ~QTextControl(); + void setView(QObject *view); + QObject *view() const; + void setDocument(QTextDocument *document); QTextDocument *document() const; @@ -129,9 +125,6 @@ public: virtual void ensureCursorVisible(); virtual QVariant loadResource(int type, const QUrl &name); -#ifndef QT_NO_CONTEXTMENU - QMenu *createStandardContextMenu(const QPointF &pos, QWidget *parent); -#endif QTextCursor cursorForPosition(const QPointF &pos) const; QRectF cursorRect(const QTextCursor &cursor) const; @@ -153,10 +146,8 @@ public: bool acceptRichText() const; void setAcceptRichText(bool accept); -#ifndef QT_NO_TEXTEDIT - void setExtraSelections(const QList &selections); - QList extraSelections() const; -#endif + void setExtraSelections(const QVector &selections); + QVector extraSelections() const; void setTextWidth(qreal width); qreal textWidth() const; @@ -181,13 +172,11 @@ public: bool isWordSelectionEnabled() const; void setWordSelectionEnabled(bool enabled); -#ifndef QT_NO_PRINTER - void print(QPrinter *printer) const; -#endif + void print(QPagedPaintDevice *printer) const; virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const; virtual QRectF blockBoundingRect(const QTextBlock &block) const; - QAbstractTextDocumentLayout::PaintContext getPaintContext(QWidget *widget) const; + QAbstractTextDocumentLayout::PaintContext getPaintContext() const; public Q_SLOTS: void setPlainText(const QString &text); @@ -241,11 +230,11 @@ public: QPalette palette() const; void setPalette(const QPalette &pal); - virtual void processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget = 0); - void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF(), QWidget *contextWidget = 0); + virtual void processEvent(QEvent *e, const QMatrix &matrix); + void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF()); // control methods - void drawContents(QPainter *painter, const QRectF &rect = QRectF(), QWidget *widget = 0); + void drawContents(QPainter *painter, const QRectF &rect = QRectF()); void setFocus(bool focus, Qt::FocusReason = Qt::OtherFocusReason); @@ -277,22 +266,6 @@ private: }; -#ifndef QT_NO_CONTEXTMENU -class QUnicodeControlCharacterMenu : public QMenu -{ - Q_OBJECT -public: - QUnicodeControlCharacterMenu(QObject *editWidget, QWidget *parent); - -private Q_SLOTS: - void menuActionTriggered(); - -private: - QObject *editWidget; -}; -#endif // QT_NO_CONTEXTMENU - - // also used by QLabel class QTextEditMimeData : public QMimeData { @@ -312,4 +285,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QTEXTCONTROL_H +#endif // QTextControl_H diff --git a/src/gui/text/qtextcontrol_p_p.h b/src/gui/text/qtextcontrol_p_p.h index 1d7f9e9945c..9c7ab563956 100644 --- a/src/gui/text/qtextcontrol_p_p.h +++ b/src/gui/text/qtextcontrol_p_p.h @@ -54,10 +54,8 @@ // #include "QtGui/qtextdocumentfragment.h" -#include "QtGui/qscrollbar.h" #include "QtGui/qtextcursor.h" #include "QtGui/qtextformat.h" -#include "QtGui/qmenu.h" #include "QtGui/qabstracttextdocumentlayout.h" #include "QtCore/qbasictimer.h" #include "QtCore/qpointer.h" @@ -160,16 +158,12 @@ public: bool dragEnterEvent(QEvent *e, const QMimeData *mimeData); void dragLeaveEvent(); bool dragMoveEvent(QEvent *e, const QMimeData *mimeData, const QPointF &pos); - bool dropEvent(const QMimeData *mimeData, const QPointF &pos, Qt::DropAction dropAction, QWidget *source); + bool dropEvent(const QMimeData *mimeData, const QPointF &pos, Qt::DropAction dropAction, QObject *source); void inputMethodEvent(QInputMethodEvent *); void activateLinkUnderCursor(QString href = QString()); -#ifndef QT_NO_TOOLTIP - void showToolTip(const QPoint &globalPos, const QPointF &pos, QWidget *contextWidget); -#endif - void append(const QString &text, Qt::TextFormat format = Qt::AutoText); QInputContext *inputContext(); @@ -194,7 +188,7 @@ public: bool mightStartDrag; QPoint dragStartPos; - QPointer contextWidget; + QPointer contextObject; bool lastSelectionState; @@ -235,4 +229,4 @@ public: QT_END_NAMESPACE -#endif // QTEXTCONTROL_P_H +#endif // QTextControl_P_H diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h index 697899bcfa4..bc4cdb5fb6a 100644 --- a/src/gui/text/qtextcursor.h +++ b/src/gui/text/qtextcursor.h @@ -228,9 +228,10 @@ public: private: QSharedDataPointer d; + friend class QTextCursorPrivate; friend class QTextDocumentFragmentPrivate; friend class QTextCopyHelper; - friend class QTextControlPrivate; + friend class QWidgetTextControlPrivate; }; QT_END_NAMESPACE diff --git a/src/gui/text/qtextcursor_p.h b/src/gui/text/qtextcursor_p.h index aae512b0d15..c612169acfc 100644 --- a/src/gui/text/qtextcursor_p.h +++ b/src/gui/text/qtextcursor_p.h @@ -61,13 +61,15 @@ QT_BEGIN_NAMESPACE -class QTextCursorPrivate : public QSharedData +class Q_GUI_EXPORT QTextCursorPrivate : public QSharedData { public: QTextCursorPrivate(QTextDocumentPrivate *p); QTextCursorPrivate(const QTextCursorPrivate &rhs); ~QTextCursorPrivate(); + static inline QTextCursorPrivate *getPrivate(QTextCursor *c) { return c->d; } + enum AdjustResult { CursorMoved, CursorUnchanged }; AdjustResult adjustPosition(int positionOfChange, int charsAddedOrRemoved, QTextUndoCommand::Operation op); diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 143dc1ab8c2..c1714edb0c4 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -51,22 +51,20 @@ #include #include #include +#include + #include "qtexthtmlparser_p.h" #include "qpainter.h" -#include "qprinter.h" -#include "qtextedit.h" #include #include #include -#include -#include "qtextcontrol_p.h" #include "qfont_p.h" -#include "private/qtextedit_p.h" #include "private/qdataurl_p.h" #include "qtextdocument_p.h" -#include #include +#include "qpagedpaintdevice.h" +#include "private/qpagedpaintdevice_p.h" #include @@ -1696,7 +1694,7 @@ static void printPage(int index, QPainter *painter, const QTextDocument *doc, co } /*! - Prints the document to the given \a printer. The QPrinter must be + Prints the document to the given \a device. The QPageablePaintDevice must be set up before being used with this function. This is only a convenience method to print the whole document to the printer. @@ -1706,33 +1704,32 @@ static void printPage(int index, QPainter *painter, const QTextDocument *doc, co If the document is not paginated, like for example a document used in a QTextEdit, then a temporary copy of the document is created and the copy is broken into - multiple pages according to the size of the QPrinter's paperRect(). By default + multiple pages according to the size of the paint device's paperRect(). By default a 2 cm margin is set around the document contents. In addition the current page number is printed at the bottom of each page. - Note that QPrinter::Selection is not supported as print range with this function since - the selection is a property of QTextCursor. If you have a QTextEdit associated with - your QTextDocument then you can use QTextEdit's print() function because QTextEdit has - access to the user's selection. - \sa QTextEdit::print() */ -void QTextDocument::print(QPrinter *printer) const +void QTextDocument::print(QPagedPaintDevice *printer) const { Q_D(const QTextDocument); - if (!printer || !printer->isValid()) + if (!printer) return; - if (!d->title.isEmpty()) - printer->setDocName(d->title); - bool documentPaginated = d->pageSize.isValid() && !d->pageSize.isNull() && d->pageSize.height() != INT_MAX; - if (!documentPaginated && !printer->fullPage() && !printer->d_func()->hasCustomPageMargins) - printer->setPageMargins(23.53, 23.53, 23.53, 23.53, QPrinter::Millimeter); + QPagedPaintDevicePrivate *pd = QPagedPaintDevicePrivate::get(printer); + + // ### set page size to paginated size? + QPagedPaintDevice::Margins m = printer->margins(); + if (!documentPaginated && m.left == 0. && m.right == 0. && m.top == 0. && m.bottom == 0.) { + m.left = m.right = m.top = m.bottom = 2.; + printer->setMargins(m); + } + // ### use the margins correctly QPainter p(printer); @@ -1767,7 +1764,7 @@ void QTextDocument::print(QPrinter *printer) const scaledPageSize.rwidth() *= dpiScaleX; scaledPageSize.rheight() *= dpiScaleY; - const QSizeF printerPageSize(printer->pageRect().size()); + const QSizeF printerPageSize(printer->width(), printer->height()); // scale to page p.scale(printerPageSize.width() / scaledPageSize.width(), @@ -1789,17 +1786,12 @@ void QTextDocument::print(QPrinter *printer) const layout->d_func()->handlers = documentLayout()->d_func()->handlers; int dpiy = p.device()->logicalDpiY(); - int margin = 0; - if (printer->fullPage() && !printer->d_func()->hasCustomPageMargins) { - // for compatibility - margin = (int) ((2/2.54)*dpiy); // 2 cm margins - QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); - fmt.setMargin(margin); - doc->rootFrame()->setFrameFormat(fmt); - } + int margin = (int) ((2/2.54)*dpiy); // 2 cm margins + QTextFrameFormat fmt = doc->rootFrame()->frameFormat(); + fmt.setMargin(margin); + doc->rootFrame()->setFrameFormat(fmt); - QRectF pageRect(printer->pageRect()); - body = QRectF(0, 0, pageRect.width(), pageRect.height()); + body = QRectF(0, 0, printer->width(), printer->height()); pageNumberPos = QPointF(body.width() - margin, body.height() - margin + QFontMetrics(doc->defaultFont(), p.device()).ascent() @@ -1807,18 +1799,8 @@ void QTextDocument::print(QPrinter *printer) const clonedDoc->setPageSize(body.size()); } - int docCopies; - int pageCopies; - if (printer->collateCopies() == true){ - docCopies = 1; - pageCopies = printer->supportsMultipleCopies() ? 1 : printer->copyCount(); - } else { - docCopies = printer->supportsMultipleCopies() ? 1 : printer->copyCount(); - pageCopies = 1; - } - - int fromPage = printer->fromPage(); - int toPage = printer->toPage(); + int fromPage = pd->fromPage; + int toPage = pd->toPage; bool ascending = true; if (fromPage == 0 && toPage == 0) { @@ -1835,39 +1817,27 @@ void QTextDocument::print(QPrinter *printer) const return; } - if (printer->pageOrder() == QPrinter::LastPageFirst) { - int tmp = fromPage; - fromPage = toPage; - toPage = tmp; - ascending = false; - } +// if (printer->pageOrder() == QPrinter::LastPageFirst) { +// int tmp = fromPage; +// fromPage = toPage; +// toPage = tmp; +// ascending = false; +// } - for (int i = 0; i < docCopies; ++i) { + int page = fromPage; + while (true) { + printPage(page, &p, doc, body, pageNumberPos); - int page = fromPage; - while (true) { - for (int j = 0; j < pageCopies; ++j) { - if (printer->printerState() == QPrinter::Aborted - || printer->printerState() == QPrinter::Error) - return; - printPage(page, &p, doc, body, pageNumberPos); - if (j < pageCopies - 1) - printer->newPage(); - } + if (page == toPage) + break; - if (page == toPage) - break; + if (ascending) + ++page; + else + --page; - if (ascending) - ++page; - else - --page; - - printer->newPage(); - } - - if ( i < docCopies - 1) - printer->newPage(); + if (!printer->newPage()) + return; } } #endif @@ -1971,6 +1941,8 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name) if (doc) { r = doc->loadResource(type, name); } +#if 0 + // ### Qt5: reenable #ifndef QT_NO_TEXTEDIT else if (QTextEdit *edit = qobject_cast(parent())) { QUrl resolvedName = edit->d_func()->resolveUrl(name); @@ -1978,9 +1950,10 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name) } #endif #ifndef QT_NO_TEXTCONTROL - else if (QTextControl *control = qobject_cast(parent())) { + else if (QWidgetTextControl *control = qobject_cast(parent())) { r = control->loadResource(type, name); } +#endif #endif // handle data: URLs diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index 268b72e514a..363d7abb214 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -57,7 +57,7 @@ class QTextFormatCollection; class QTextListFormat; class QRect; class QPainter; -class QPrinter; +class QPagedPaintDevice; class QAbstractTextDocumentLayout; class QPoint; class QTextObject; @@ -206,9 +206,7 @@ public: bool isModified() const; -#ifndef QT_NO_PRINTER - void print(QPrinter *printer) const; -#endif + void print(QPagedPaintDevice *printer) const; enum ResourceType { HtmlResource = 1, diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index a50798834a4..04bdfa8d303 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -46,6 +46,7 @@ #include "qtextlist.h" #include "qtextengine_p.h" #include "private/qcssutil_p.h" +#include "private/qguiapplication_p.h" #include "qabstracttextdocumentlayout_p.h" #include "qcssparser_p.h" @@ -57,7 +58,6 @@ #include #include #include -#include #include #include "private/qfunctions_p.h" @@ -2572,7 +2572,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi Qt::Alignment align = docPrivate->defaultTextOption.alignment(); if (blockFormat.hasProperty(QTextFormat::BlockAlignment)) align = blockFormat.alignment(); - option.setAlignment(QStyle::visualAlignment(dir, align)); // for paragraph that are RTL, alignment is auto-reversed; + option.setAlignment(QGuiApplicationPrivate::visualAlignment(dir, align)); // for paragraph that are RTL, alignment is auto-reversed; if (blockFormat.nonBreakableLines() || document->pageSize().width() < 0) { option.setWrapMode(QTextOption::ManualWrap); diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h index 620b9bd7dd6..b103d886be6 100644 --- a/src/gui/text/qtextdocumentlayout_p.h +++ b/src/gui/text/qtextdocumentlayout_p.h @@ -63,7 +63,7 @@ class QTextListFormat; class QTextDocumentLayoutPrivate; -class Q_AUTOTEST_EXPORT QTextDocumentLayout : public QAbstractTextDocumentLayout +class Q_GUI_EXPORT QTextDocumentLayout : public QAbstractTextDocumentLayout { Q_DECLARE_PRIVATE(QTextDocumentLayout) Q_OBJECT diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 7539ea7d2db..97d5a3baaf8 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -53,7 +53,7 @@ #include "qstring.h" #include #include "qtextdocument_p.h" -#include +#include #include @@ -968,7 +968,7 @@ void QTextEngine::shapeText(int item) const } for (int i = 0; i < si.num_glyphs; ++i) - si.width += glyphs.advances_x[i]; + si.width += glyphs.advances_x[i] * !glyphs.attributes[i].dontPrint; } static inline bool hasCaseChange(const QScriptItem &si) @@ -1628,7 +1628,7 @@ bool QTextEngine::isRightToLeft() const itemize(); // this places the cursor in the right position depending on the keyboard layout if (layoutData->string.isEmpty()) - return QApplication::keyboardInputDirection() == Qt::RightToLeft; + return QGuiApplication::keyboardInputDirection() == Qt::RightToLeft; return layoutData->string.isRightToLeft(); } @@ -2663,7 +2663,7 @@ void QTextEngine::splitItem(int item, int pos) const QFixed w = 0; const QGlyphLayout g = shapedGlyphs(&oldItem); for(int j = 0; j < breakGlyph; ++j) - w += g.advances_x[j]; + w += g.advances_x[j] * !g.attributes[j].dontPrint; newItem.width = oldItem.width - w; oldItem.width = w; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 6e82de8f5c6..325623fc63e 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -93,7 +93,7 @@ class QAbstractTextDocumentLayout; // * negative yoff means the following stuff is drawn higher up. // the characters bounding rect is given by QRect(x,y,width,height), its advance by // xoo and yoff -struct glyph_metrics_t +struct Q_GUI_EXPORT glyph_metrics_t { inline glyph_metrics_t() : x(100000), y(100000) {} @@ -426,7 +426,7 @@ public: InLayout, LayoutFailed, }; - struct LayoutData { + struct Q_GUI_EXPORT LayoutData { LayoutData(const QString &str, void **stack_memory, int mem_size); LayoutData(); ~LayoutData(); @@ -650,7 +650,7 @@ private: int getClusterLength(unsigned short *logClusters, const HB_CharAttributes *attributes, int from, int to, int glyph_pos, int *start); }; -class QStackTextEngine : public QTextEngine { +class Q_GUI_EXPORT QStackTextEngine : public QTextEngine { public: enum { MemSize = 256*40/sizeof(void *) }; QStackTextEngine(const QString &string, const QFont &f); diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index d130c614452..ced71f5c60b 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -43,10 +43,10 @@ #include #include -#include #include #include #include +#include #include "qtextdocument.h" #include "qtextformat_p.h" @@ -1051,7 +1051,7 @@ void QTextHtmlParserNode::initializeProperties(const QTextHtmlParserNode *parent && !attributes.at(i + 1).isEmpty()) { hasHref = true; charFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline); - charFormat.setForeground(QApplication::palette().link()); + charFormat.setForeground(Qt::blue); // ### Qt5: QApplication::palette().link()); } } @@ -1402,7 +1402,7 @@ void QTextHtmlParserNode::applyBackgroundImage(const QString &url, const QTextDo if (!url.isEmpty() && resourceProvider) { QVariant val = resourceProvider->resource(QTextDocument::ImageResource, url); - if (qApp->thread() != QThread::currentThread()) { + if (QCoreApplication::instance()->thread() != QThread::currentThread()) { // must use images in non-GUI threads if (val.type() == QVariant::Image) { QImage image = qvariant_cast(val); diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp index 78761184dfd..fcc13a58ffe 100644 --- a/src/gui/text/qtextimagehandler.cpp +++ b/src/gui/text/qtextimagehandler.cpp @@ -42,13 +42,12 @@ #include "qtextimagehandler_p.h" -#include +#include #include #include #include #include #include -#include #include QT_BEGIN_NAMESPACE @@ -73,7 +72,8 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format) if (pm.isNull()) { QString context; -#ifndef QT_NO_TEXTBROWSER +#if 0 + // ### Qt5 QTextBrowser *browser = qobject_cast(doc->parent()); if (browser) context = browser->source().toString(); @@ -150,7 +150,9 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format) if (image.isNull()) { QString context; -#ifndef QT_NO_TEXTBROWSER + +#if 0 + // ### Qt5 QTextBrowser *browser = qobject_cast(doc->parent()); if (browser) context = browser->source().toString(); @@ -210,7 +212,7 @@ QSizeF QTextImageHandler::intrinsicSize(QTextDocument *doc, int posInDocument, c Q_UNUSED(posInDocument) const QTextImageFormat imageFormat = format.toImageFormat(); - if (qApp->thread() != QThread::currentThread()) + if (QCoreApplication::instance()->thread() != QThread::currentThread()) return getImageSize(doc, imageFormat); return getPixmapSize(doc, imageFormat); } @@ -220,7 +222,7 @@ void QTextImageHandler::drawObject(QPainter *p, const QRectF &rect, QTextDocumen Q_UNUSED(posInDocument) const QTextImageFormat imageFormat = format.toImageFormat(); - if (qApp->thread() != QThread::currentThread()) { + if (QCoreApplication::instance()->thread() != QThread::currentThread()) { const QImage image = getImage(doc, imageFormat); p->drawImage(rect, image, image.rect()); } else { diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index d253c02052f..5539acffd73 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -44,14 +44,12 @@ #include #include -#include #include #include #include #include #include "qtextdocument_p.h" #include "qtextformat_p.h" -#include "qstyleoption.h" #include "qpainterpath.h" #include "qglyphrun.h" #include "qglyphrun_p.h" diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp index d384cbeaee2..fe58583d046 100644 --- a/src/gui/text/qtextoption.cpp +++ b/src/gui/text/qtextoption.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qtextoption.h" -#include "qapplication.h" +#include "qguiapplication.h" #include "qlist.h" QT_BEGIN_NAMESPACE @@ -82,7 +82,7 @@ QTextOption::QTextOption(Qt::Alignment alignment) tab(-1), d(0) { - direction = QApplication::layoutDirection(); + direction = QGuiApplication::layoutDirection(); } /*! diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index eb5937a493e..5e5f8e31c80 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -9,9 +9,8 @@ HEADERS += \ text/qfontmetrics.h \ text/qfont_p.h \ text/qfontsubset_p.h \ - text/qtextcontrol_p.h \ - text/qtextcontrol_p_p.h \ - text/qtextengine_p.h \ + text/qlinecontrol_p.h \ + text/qtextengine_p.h \ text/qtextlayout.h \ text/qtextformat.h \ text/qtextformat_p.h \ @@ -24,7 +23,9 @@ HEADERS += \ text/qtexthtmlparser_p.h \ text/qabstracttextdocumentlayout.h \ text/qtextdocumentlayout_p.h \ - text/qtextcursor.h \ + text/qtextcontrol_p.h \ + text/qtextcontrol_p_p.h \ + text/qtextcursor.h \ text/qtextcursor_p.h \ text/qtextdocumentfragment.h \ text/qtextdocumentfragment_p.h \ @@ -52,8 +53,9 @@ SOURCES += \ text/qfontsubset.cpp \ text/qfontmetrics.cpp \ text/qfontdatabase.cpp \ - text/qtextcontrol.cpp \ - text/qtextengine.cpp \ + text/qlinecontrol.cpp \ + text/qtextcontrol.cpp \ + text/qtextengine.cpp \ text/qtextlayout.cpp \ text/qtextformat.cpp \ text/qtextobject.cpp \ @@ -78,7 +80,7 @@ SOURCES += \ text/qrawfont.cpp \ text/qglyphrun.cpp -win32 { +win32:!qpa { SOURCES += \ text/qfont_win.cpp \ text/qfontengine_win.cpp \ @@ -104,7 +106,7 @@ unix:x11 { text/qrawfont_ft.cpp } -!embedded:!qpa:!x11:mac { +!qpa:!x11:mac { HEADERS += \ text/qfontengine_mac_p.h OBJECTIVE_HEADERS += \ @@ -120,22 +122,6 @@ unix:x11 { } } -embedded { - SOURCES += \ - text/qfont_qws.cpp \ - text/qfontengine_qws.cpp \ - text/qfontengine_ft.cpp \ - text/qfontengine_qpf.cpp \ - text/qabstractfontengine_qws.cpp \ - text/qrawfont_ft.cpp - HEADERS += \ - text/qfontengine_ft_p.h \ - text/qfontengine_qpf_p.h \ - text/qabstractfontengine_qws.h \ - text/qabstractfontengine_p.h - DEFINES += QT_NO_FONTCONFIG -} - qpa { SOURCES += \ text/qfont_qpa.cpp \ @@ -233,9 +219,7 @@ contains(QT_CONFIG, freetype) { DEFINES += FT2_BUILD_LIBRARY FT_CONFIG_OPTION_SYSTEM_ZLIB - embedded:CONFIG += opentype } else:contains(QT_CONFIG, system-freetype) { - embedded:CONFIG += opentype # pull in the proper freetype2 include directory include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) LIBS_PRIVATE += -lfreetype diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index e79819e69fd..669f7ea893d 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -46,7 +46,7 @@ #include #if defined(Q_WS_QWS) || defined(Q_WS_QPA) -#include "qdesktopservices_qws.cpp" +#include "qdesktopservices_qpa.cpp" #elif defined(Q_WS_X11) #include "qdesktopservices_x11.cpp" #elif defined(Q_WS_WIN) diff --git a/src/gui/util/qdesktopservices_qws.cpp b/src/gui/util/qdesktopservices_qpa.cpp similarity index 99% rename from src/gui/util/qdesktopservices_qws.cpp rename to src/gui/util/qdesktopservices_qpa.cpp index e3847e5bfd8..374b06b4f07 100644 --- a/src/gui/util/qdesktopservices_qws.cpp +++ b/src/gui/util/qdesktopservices_qpa.cpp @@ -41,6 +41,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/gui/util/qhexstring_p.h b/src/gui/util/qhexstring_p.h new file mode 100644 index 00000000000..3c8d5627565 --- /dev/null +++ b/src/gui/util/qhexstring_p.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +#ifndef QHEXSTRING_P_H +#define QHEXSTRING_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. +// + +QT_BEGIN_NAMESPACE + +// internal helper. Converts an integer value to an unique string token +template + struct HexString +{ + inline HexString(const T t) + : val(t) + {} + + inline void write(QChar *&dest) const + { + const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + const char *c = reinterpret_cast(&val); + for (uint i = 0; i < sizeof(T); ++i) { + *dest++ = hexChars[*c & 0xf]; + *dest++ = hexChars[(*c & 0xf0) >> 4]; + ++c; + } + } + const T val; +}; + +// specialization to enable fast concatenating of our string tokens to a string +template + struct QConcatenable > +{ + typedef HexString type; + enum { ExactSize = true }; + static int size(const HexString &) { return sizeof(T) * 2; } + static inline void appendTo(const HexString &str, QChar *&out) { str.write(out); } + typedef QString ConvertTo; +}; + +QT_END_NAMESPACE + +#endif // QHEXSTRING_P_H diff --git a/src/gui/widgets/qvalidator.cpp b/src/gui/util/qvalidator.cpp similarity index 100% rename from src/gui/widgets/qvalidator.cpp rename to src/gui/util/qvalidator.cpp diff --git a/src/gui/widgets/qvalidator.h b/src/gui/util/qvalidator.h similarity index 100% rename from src/gui/widgets/qvalidator.h rename to src/gui/util/qvalidator.h diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index 2814a2d30ae..dfb221667ef 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -1,71 +1,10 @@ # Qt util module HEADERS += \ - util/qsystemtrayicon.h \ - util/qcompleter.h \ - util/qcompleter_p.h \ util/qdesktopservices.h \ - util/qsystemtrayicon_p.h \ - util/qscroller.h \ - util/qscroller_p.h \ - util/qscrollerproperties.h \ - util/qscrollerproperties_p.h \ - util/qflickgesture_p.h \ - util/qundogroup.h \ - util/qundostack.h \ - util/qundostack_p.h \ - util/qundoview.h + util/qhexstring_p.h \ + util/qvalidator.h SOURCES += \ - util/qsystemtrayicon.cpp \ - util/qcompleter.cpp \ util/qdesktopservices.cpp \ - util/qscroller.cpp \ - util/qscrollerproperties.cpp \ - util/qflickgesture.cpp \ - util/qundogroup.cpp \ - util/qundostack.cpp \ - util/qundoview.cpp - - -wince* { - SOURCES += \ - util/qsystemtrayicon_wince.cpp -} else:win32 { - SOURCES += \ - util/qsystemtrayicon_win.cpp -} - -unix:x11 { - SOURCES += \ - util/qsystemtrayicon_x11.cpp -} - -embedded|qpa { - SOURCES += \ - util/qsystemtrayicon_qws.cpp -} - -!embedded:!qpa:!x11:mac { - OBJECTIVE_SOURCES += util/qsystemtrayicon_mac.mm -} - -symbian { - LIBS += -letext -lplatformenv - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - LIBS += -lsendas2 -lapmime - contains(QT_CONFIG, s60) { - contains(CONFIG, is_using_gnupoc) { - LIBS += -lcommonui - } else { - LIBS += -lCommonUI - } - } - } else { - DEFINES += USE_SCHEMEHANDLER - } -} - -macx { - OBJECTIVE_SOURCES += util/qscroller_mac.mm -} + util/qvalidator.cpp diff --git a/src/gui/widgets/qabstractplatformmenubar_p.h b/src/gui/widgets/qabstractplatformmenubar_p.h deleted file mode 100644 index 10e6fdcab2e..00000000000 --- a/src/gui/widgets/qabstractplatformmenubar_p.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QABSTRACTPLATFORMMENUBAR_P_H -#define QABSTRACTPLATFORMMENUBAR_P_H - -#include -#include -#include - -#ifndef QT_NO_MENUBAR - -QT_BEGIN_NAMESPACE - -class QAction; -class QActionEvent; -class QEvent; -class QMenuBar; -class QObject; -class QWidget; - -class QAbstractPlatformMenuBar; - -struct QPlatformMenuBarFactoryInterface : public QFactoryInterface -{ - virtual QAbstractPlatformMenuBar *create() = 0; -}; - -#define QPlatformMenuBarFactoryInterface_iid "com.nokia.qt.QPlatformMenuBarFactoryInterface" -Q_DECLARE_INTERFACE(QPlatformMenuBarFactoryInterface, QPlatformMenuBarFactoryInterface_iid) - -/*! - The platform-specific implementation of a menubar -*/ -class QAbstractPlatformMenuBar -{ -public: - virtual ~QAbstractPlatformMenuBar() {} - - virtual void init(QMenuBar *) = 0; - - virtual void setVisible(bool visible) = 0; - - virtual void actionEvent(QActionEvent *) = 0; - - virtual void handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow) = 0; - - virtual bool allowCornerWidgets() const = 0; - - virtual void popupAction(QAction *) = 0; - - virtual void setNativeMenuBar(bool) = 0; - - virtual bool isNativeMenuBar() const = 0; - - /*! - Return true if the native menubar is capable of listening to the - shortcut keys. If false is returned, QMenuBar will trigger actions on - shortcut itself. - */ - virtual bool shortcutsHandledByNativeMenuBar() const = 0; - - virtual bool menuBarEventFilter(QObject *, QEvent *event) = 0; -}; - -QT_END_NAMESPACE - -#endif // QT_NO_MENUBAR - -#endif // QABSTRACTPLATFORMMENUBAR_P_H diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h deleted file mode 100644 index 053fdee01e3..00000000000 --- a/src/gui/widgets/qmenu.h +++ /dev/null @@ -1,434 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMENU_H -#define QMENU_H - -#include -#include -#include -#include - -#ifdef QT3_SUPPORT -#include -#endif - -#ifdef Q_WS_WINCE -#include // for HMENU -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_MENU - -class QMenuPrivate; -class QStyleOptionMenuItem; -#ifdef QT3_SUPPORT -class QMenuItem; -#endif - -class Q_GUI_EXPORT QMenu : public QWidget -{ -private: - Q_OBJECT - Q_DECLARE_PRIVATE(QMenu) - - Q_PROPERTY(bool tearOffEnabled READ isTearOffEnabled WRITE setTearOffEnabled) - Q_PROPERTY(QString title READ title WRITE setTitle) - Q_PROPERTY(QIcon icon READ icon WRITE setIcon) - Q_PROPERTY(bool separatorsCollapsible READ separatorsCollapsible WRITE setSeparatorsCollapsible) - -public: - explicit QMenu(QWidget *parent = 0); - explicit QMenu(const QString &title, QWidget *parent = 0); - ~QMenu(); - -#ifdef Q_NO_USING_KEYWORD - inline void addAction(QAction *action) { QWidget::addAction(action); } -#else - using QWidget::addAction; -#endif - QAction *addAction(const QString &text); - QAction *addAction(const QIcon &icon, const QString &text); - QAction *addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); - QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); - - QAction *addMenu(QMenu *menu); - QMenu *addMenu(const QString &title); - QMenu *addMenu(const QIcon &icon, const QString &title); - - QAction *addSeparator(); - - QAction *insertMenu(QAction *before, QMenu *menu); - QAction *insertSeparator(QAction *before); - - bool isEmpty() const; - void clear(); - - void setTearOffEnabled(bool); - bool isTearOffEnabled() const; - - bool isTearOffMenuVisible() const; - void hideTearOffMenu(); - - void setDefaultAction(QAction *); - QAction *defaultAction() const; - - void setActiveAction(QAction *act); - QAction *activeAction() const; - - void popup(const QPoint &pos, QAction *at=0); - QAction *exec(); - QAction *exec(const QPoint &pos, QAction *at=0); - - // ### Qt 5: merge - static QAction *exec(QList actions, const QPoint &pos, QAction *at=0); - static QAction *exec(QList actions, const QPoint &pos, QAction *at, QWidget *parent); - - QSize sizeHint() const; - - QRect actionGeometry(QAction *) const; - QAction *actionAt(const QPoint &) const; - - QAction *menuAction() const; - - QString title() const; - void setTitle(const QString &title); - - QIcon icon() const; - void setIcon(const QIcon &icon); - - void setNoReplayFor(QWidget *widget); -#ifdef Q_WS_MAC - OSMenuRef macMenu(OSMenuRef merge=0); -#endif - -#ifdef Q_WS_WINCE - HMENU wceMenu(); -#endif - - bool separatorsCollapsible() const; - void setSeparatorsCollapsible(bool collapse); - -Q_SIGNALS: - void aboutToShow(); - void aboutToHide(); - void triggered(QAction *action); - void hovered(QAction *action); - -protected: - int columnCount() const; - - void changeEvent(QEvent *); - void keyPressEvent(QKeyEvent *); - void mouseReleaseEvent(QMouseEvent *); - void mousePressEvent(QMouseEvent *); - void mouseMoveEvent(QMouseEvent *); -#ifndef QT_NO_WHEELEVENT - void wheelEvent(QWheelEvent *); -#endif - void enterEvent(QEvent *); - void leaveEvent(QEvent *); - void hideEvent(QHideEvent *); - void paintEvent(QPaintEvent *); - void actionEvent(QActionEvent *); - void timerEvent(QTimerEvent *); - bool event(QEvent *); - bool focusNextPrevChild(bool next); - void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; - -#ifdef Q_WS_WINCE - QAction* wceCommands(uint command); -#endif - -private Q_SLOTS: - void internalSetSloppyAction(); - void internalDelayedPopup(); - -private: - Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered()) - Q_PRIVATE_SLOT(d_func(), void _q_actionHovered()) - Q_PRIVATE_SLOT(d_func(), void _q_overrideMenuActionDestroyed()) - -#ifdef QT3_SUPPORT -public: - //menudata - inline QT3_SUPPORT uint count() const { return actions().count(); } - inline QT3_SUPPORT int insertItem(const QString &text, const QObject *receiver, const char* member, - const QKeySequence& shortcut = 0, int id = -1, int index = -1) { - return insertAny(0, &text, receiver, member, &shortcut, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, - const QObject *receiver, const char* member, - const QKeySequence& shortcut = 0, int id = -1, int index = -1) { - return insertAny(&icon, &text, receiver, member, &shortcut, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, const QObject *receiver, const char* member, - const QKeySequence& shortcut = 0, int id = -1, int index = -1) { - QIcon icon(pixmap); - return insertAny(&icon, 0, receiver, member, &shortcut, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QString &text, int id=-1, int index=-1) { - return insertAny(0, &text, 0, 0, 0, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, int id=-1, int index=-1) { - return insertAny(&icon, &text, 0, 0, 0, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QString &text, QMenu *popup, int id=-1, int index=-1) { - return insertAny(0, &text, 0, 0, 0, popup, id, index); - } - inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, QMenu *popup, int id=-1, int index=-1) { - return insertAny(&icon, &text, 0, 0, 0, popup, id, index); - } - inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, int id=-1, int index=-1) { - QIcon icon(pixmap); - return insertAny(&icon, 0, 0, 0, 0, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, QMenu *popup, int id=-1, int index=-1) { - QIcon icon(pixmap); - return insertAny(&icon, 0, 0, 0, 0, popup, id, index); - } - QT3_SUPPORT int insertItem(QMenuItem *item, int id=-1, int index=-1); - QT3_SUPPORT int insertSeparator(int index=-1); - inline QT3_SUPPORT void removeItem(int id) { - if(QAction *act = findActionForId(id)) - removeAction(act); } - inline QT3_SUPPORT void removeItemAt(int index) { - if(QAction *act = actions().value(index)) - removeAction(act); } -#ifndef QT_NO_SHORTCUT - inline QT3_SUPPORT QKeySequence accel(int id) const { - if(QAction *act = findActionForId(id)) - return act->shortcut(); - return QKeySequence(); } - inline QT3_SUPPORT void setAccel(const QKeySequence& key, int id) { - if(QAction *act = findActionForId(id)) - act->setShortcut(key); - } -#endif - inline QT3_SUPPORT QIcon iconSet(int id) const { - if(QAction *act = findActionForId(id)) - return act->icon(); - return QIcon(); } - inline QT3_SUPPORT QString text(int id) const { - if(QAction *act = findActionForId(id)) - return act->text(); - return QString(); } - inline QT3_SUPPORT QPixmap pixmap(int id) const { - if(QAction *act = findActionForId(id)) - return act->icon().pixmap(QSize(22, 22)); - return QPixmap(); } - inline QT3_SUPPORT void setWhatsThis(int id, const QString &w) { - if(QAction *act = findActionForId(id)) - act->setWhatsThis(w); } - inline QT3_SUPPORT QString whatsThis(int id) const { - if(QAction *act = findActionForId(id)) - return act->whatsThis(); - return QString(); } - - inline QT3_SUPPORT void changeItem(int id, const QString &text) { - if(QAction *act = findActionForId(id)) - act->setText(text); } - inline QT3_SUPPORT void changeItem(int id, const QPixmap &pixmap) { - if(QAction *act = findActionForId(id)) - act->setIcon(QIcon(pixmap)); } - inline QT3_SUPPORT void changeItem(int id, const QIcon &icon, const QString &text) { - if(QAction *act = findActionForId(id)) { - act->setIcon(icon); - act->setText(text); - } - } - inline QT3_SUPPORT void setActiveItem(int id) { - setActiveAction(findActionForId(id)); - } - inline QT3_SUPPORT bool isItemActive(int id) const { - return findActionForId(id) == activeAction(); - } - inline QT3_SUPPORT bool isItemEnabled(int id) const { - if(QAction *act = findActionForId(id)) - return act->isEnabled(); - return false; } - inline QT3_SUPPORT void setItemEnabled(int id, bool enable) { - if(QAction *act = findActionForId(id)) - act->setEnabled(enable); - } - inline QT3_SUPPORT bool isItemChecked(int id) const { - if(QAction *act = findActionForId(id)) - return act->isChecked(); - return false; - } - inline QT3_SUPPORT void setItemChecked(int id, bool check) { - if(QAction *act = findActionForId(id)) { - act->setCheckable(true); - act->setChecked(check); - } - } - inline QT3_SUPPORT bool isItemVisible(int id) const { - if(QAction *act = findActionForId(id)) - return act->isVisible(); - return false; - } - inline QT3_SUPPORT void setItemVisible(int id, bool visible) { - if(QAction *act = findActionForId(id)) - act->setVisible(visible); - } - inline QT3_SUPPORT QRect itemGeometry(int index) { - if(QAction *act = actions().value(index)) - return actionGeometry(act); - return QRect(); - } - inline QT3_SUPPORT QFont itemFont(int id) const { - if(QAction *act = findActionForId(id)) - return act->font(); - return QFont(); - } - inline QT3_SUPPORT void setItemFont(int id, const QFont &font) { - if(QAction *act = findActionForId(id)) - act->setFont(font); - } - inline QT3_SUPPORT int indexOf(int id) const { - return actions().indexOf(findActionForId(id)); - } - inline QT3_SUPPORT int idAt(int index) const { - return findIdForAction(actions().value(index)); - } - QT3_SUPPORT void setId (int index, int id); - inline QT3_SUPPORT void activateItemAt(int index) { - if(QAction *ret = actions().value(index)) - ret->activate(QAction::Trigger); - } - inline QT3_SUPPORT bool connectItem(int id, const QObject *receiver, const char* member) { - if(QAction *act = findActionForId(id)) { - QObject::connect(act, SIGNAL(activated(int)), receiver, member); - return true; - } - return false; - } - inline QT3_SUPPORT bool disconnectItem(int id,const QObject *receiver, const char* member) { - if(QAction *act = findActionForId(id)) { - QObject::disconnect(act, SIGNAL(triggered()), receiver, member); - return true; - } - return false; - } - inline QT3_SUPPORT QMenuItem *findItem(int id) const { - return reinterpret_cast(findActionForId(id)); - } - - inline QT3_SUPPORT void setCheckable(bool){} - inline QT3_SUPPORT bool isCheckable() const {return true;} - - QT3_SUPPORT QMenuItem *findPopup( QMenu *popup, int *index ); - - QT3_SUPPORT bool setItemParameter(int id, int param); - QT3_SUPPORT int itemParameter(int id) const; - - //frame - QT3_SUPPORT int frameWidth() const; - - //popupmenu - inline QT3_SUPPORT void popup(const QPoint & pos, int indexAtPoint) { popup(pos, actions().value(indexAtPoint)); } - inline QT3_SUPPORT int insertTearOffHandle(int = 0, int = 0) { - setTearOffEnabled(true); - return -1; - } - -protected: - inline QT3_SUPPORT int itemAtPos(const QPoint &p, bool ignoreSeparator = true) { - QAction *ret = actionAt(p); - if(ignoreSeparator && ret && ret->isSeparator()) - return -1; - return findIdForAction(ret); - } - inline QT3_SUPPORT int columns() const { return columnCount(); } - inline QT3_SUPPORT int itemHeight(int index) { - return actionGeometry(actions().value(index)).height(); - } - inline QT3_SUPPORT int itemHeight(QMenuItem *mi) { - return actionGeometry(reinterpret_cast(mi)).height(); - } - -Q_SIGNALS: - QT_MOC_COMPAT void activated(int itemId); - QT_MOC_COMPAT void highlighted(int itemId); - -private: - int insertAny(const QIcon *icon, const QString *text, const QObject *receiver, const char *member, - const QKeySequence *shorcut, const QMenu *popup, int id, int index); - QAction *findActionForId(int id) const; - int findIdForAction(QAction*) const; -#endif - -protected: - QMenu(QMenuPrivate &dd, QWidget* parent = 0); - -private: - Q_DISABLE_COPY(QMenu) - - friend class QMenuBar; - friend class QMenuBarPrivate; - friend class QTornOffMenu; - friend class Q3PopupMenu; - friend class QComboBox; - friend class QAction; - friend class QToolButtonPrivate; - -#ifdef Q_WS_MAC - friend void qt_mac_trayicon_activate_action(QMenu *, QAction *action); - friend bool qt_mac_watchingAboutToShow(QMenu *); - friend OSStatus qt_mac_menu_event(EventHandlerCallRef, EventRef, void *); - friend bool qt_mac_activate_action(OSMenuRef, uint, QAction::ActionEvent, bool); - friend void qt_mac_emit_menuSignals(QMenu *, bool); - friend void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action); -#endif -}; - -#endif // QT_NO_MENU - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMENU_H diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm deleted file mode 100644 index 56658b3718d..00000000000 --- a/src/gui/widgets/qmenu_mac.mm +++ /dev/null @@ -1,2217 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmenu.h" -#include "qhash.h" -#include -#include "qapplication.h" -#include -#include "qregexp.h" -#include "qmainwindow.h" -#include "qdockwidget.h" -#include "qtoolbar.h" -#include "qevent.h" -#include "qstyle.h" -#include "qwidgetaction.h" -#include "qmacnativewidget_mac.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -/***************************************************************************** - QMenu debug facilities - *****************************************************************************/ - -/***************************************************************************** - QMenu globals - *****************************************************************************/ -bool qt_mac_no_menubar_merge = false; -bool qt_mac_quit_menu_item_enabled = true; -int qt_mac_menus_open_count = 0; - -static OSMenuRef qt_mac_create_menu(QWidget *w); - -#ifndef QT_MAC_USE_COCOA -static uint qt_mac_menu_static_cmd_id = 'QT00'; -const UInt32 kMenuCreatorQt = 'cute'; -enum { - kMenuPropertyQAction = 'QAcT', - kMenuPropertyQWidget = 'QWId', - kMenuPropertyCausedQWidget = 'QCAU', - kMenuPropertyMergeMenu = 'QApP', - kMenuPropertyMergeList = 'QAmL', - kMenuPropertyWidgetActionWidget = 'QWid', - kMenuPropertyWidgetMenu = 'QWMe', - - kHICommandAboutQt = 'AOQT', - kHICommandCustomMerge = 'AQt0' -}; -#endif - -static struct { - QPointer qmenubar; - bool modal; -} qt_mac_current_menubar = { 0, false }; - - - - -/***************************************************************************** - Externals - *****************************************************************************/ -extern OSViewRef qt_mac_hiview_for(const QWidget *w); //qwidget_mac.cpp -extern HIViewRef qt_mac_hiview_for(OSWindowRef w); //qwidget_mac.cpp -extern IconRef qt_mac_create_iconref(const QPixmap &px); //qpixmap_mac.cpp -extern QWidget * mac_keyboard_grabber; //qwidget_mac.cpp -extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); //qapplication_xxx.cpp -RgnHandle qt_mac_get_rgn(); //qregion_mac.cpp -void qt_mac_dispose_rgn(RgnHandle r); //qregion_mac.cpp - -/***************************************************************************** - QMenu utility functions - *****************************************************************************/ -bool qt_mac_watchingAboutToShow(QMenu *menu) -{ - return menu && menu->receivers(SIGNAL(aboutToShow())); -} - -static int qt_mac_CountMenuItems(OSMenuRef menu) -{ - if (menu) { -#ifndef QT_MAC_USE_COCOA - int ret = 0; - const int items = CountMenuItems(menu); - for(int i = 0; i < items; i++) { - MenuItemAttributes attr; - if (GetMenuItemAttributes(menu, i+1, &attr) == noErr && - attr & kMenuItemAttrHidden) - continue; - ++ret; - } - return ret; -#else - return [menu numberOfItems]; -#endif - } - return 0; -} - -static quint32 constructModifierMask(quint32 accel_key) -{ - quint32 ret = 0; - const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta); -#ifndef QT_MAC_USE_COCOA - if ((accel_key & Qt::ALT) == Qt::ALT) - ret |= kMenuOptionModifier; - if ((accel_key & Qt::SHIFT) == Qt::SHIFT) - ret |= kMenuShiftModifier; - if (dontSwap) { - if ((accel_key & Qt::META) != Qt::META) - ret |= kMenuNoCommandModifier; - if ((accel_key & Qt::CTRL) == Qt::CTRL) - ret |= kMenuControlModifier; - } else { - if ((accel_key & Qt::CTRL) != Qt::CTRL) - ret |= kMenuNoCommandModifier; - if ((accel_key & Qt::META) == Qt::META) - ret |= kMenuControlModifier; - } -#else - if ((accel_key & Qt::CTRL) == Qt::CTRL) - ret |= (dontSwap ? NSControlKeyMask : NSCommandKeyMask); - if ((accel_key & Qt::META) == Qt::META) - ret |= (dontSwap ? NSCommandKeyMask : NSControlKeyMask); - if ((accel_key & Qt::ALT) == Qt::ALT) - ret |= NSAlternateKeyMask; - if ((accel_key & Qt::SHIFT) == Qt::SHIFT) - ret |= NSShiftKeyMask; -#endif - return ret; -} - -static void cancelAllMenuTracking() -{ -#ifdef QT_MAC_USE_COCOA - QMacCocoaAutoReleasePool pool; - NSMenu *mainMenu = [NSApp mainMenu]; - [mainMenu cancelTracking]; - for (NSMenuItem *item in [mainMenu itemArray]) { - if ([item submenu]) { - [[item submenu] cancelTracking]; - } - } -#else - CancelMenuTracking(AcquireRootMenu(), true, 0); -#endif -} - -static bool actualMenuItemVisibility(const QMenuBarPrivate::QMacMenuBarPrivate *mbp, - const QMacMenuAction *action) -{ - bool visible = action->action->isVisible(); - if (visible && action->action->text() == QString(QChar(0x14))) - return false; - if (visible && action->action->menu() && !action->action->menu()->actions().isEmpty() && - !qt_mac_CountMenuItems(action->action->menu()->macMenu(mbp->apple_menu)) && - !qt_mac_watchingAboutToShow(action->action->menu())) { - return false; - } - return visible; -} - -#ifndef QT_MAC_USE_COCOA -bool qt_mac_activate_action(MenuRef menu, uint command, QAction::ActionEvent action_e, bool by_accel) -{ - //fire event - QMacMenuAction *action = 0; - if (GetMenuCommandProperty(menu, command, kMenuCreatorQt, kMenuPropertyQAction, sizeof(action), 0, &action) != noErr) { - QMenuMergeList *list = 0; - GetMenuItemProperty(menu, 0, kMenuCreatorQt, kMenuPropertyMergeList, - sizeof(list), 0, &list); - if (!list && qt_mac_current_menubar.qmenubar && qt_mac_current_menubar.qmenubar->isNativeMenuBar()) { - MenuRef apple_menu = qt_mac_current_menubar.qmenubar->d_func()->mac_menubar->apple_menu; - GetMenuItemProperty(apple_menu, 0, kMenuCreatorQt, kMenuPropertyMergeList, sizeof(list), 0, &list); - if (list) - menu = apple_menu; - } - if (list) { - for(int i = 0; i < list->size(); ++i) { - QMenuMergeItem item = list->at(i); - if (item.command == command && item.action) { - action = item.action; - break; - } - } - } - if (!action) - return false; - } - - if (action_e == QAction::Trigger && by_accel && action->ignore_accel) //no, not a real accel (ie tab) - return false; - - // Unhighlight the highlighted menu item before triggering the action to - // prevent items from staying highlighted while a modal dialog is shown. - // This also fixed the problem that parentless modal dialogs leave - // the menu item highlighted (since the menu bar is cleared for these types of dialogs). - if (action_e == QAction::Trigger) - HiliteMenu(0); - - action->action->activate(action_e); - - //now walk up firing for each "caused" widget (like in the platform independent menu) - QWidget *caused = 0; - if (action_e == QAction::Hover && GetMenuItemProperty(menu, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), 0, &caused) == noErr) { - MenuRef caused_menu = 0; - if (QMenu *qmenu2 = qobject_cast(caused)) - caused_menu = qmenu2->macMenu(); - else if (QMenuBar *qmenubar2 = qobject_cast(caused)) - caused_menu = qmenubar2->macMenu(); - else - caused_menu = 0; - while(caused_menu) { - //fire - QWidget *widget = 0; - GetMenuItemProperty(caused_menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(widget), 0, &widget); - if (QMenu *qmenu = qobject_cast(widget)) { - action->action->showStatusText(widget); - emit qmenu->hovered(action->action); - } else if (QMenuBar *qmenubar = qobject_cast(widget)) { - action->action->showStatusText(widget); - emit qmenubar->hovered(action->action); - break; //nothing more.. - } - - //walk up - if (GetMenuItemProperty(caused_menu, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, - sizeof(caused), 0, &caused) != noErr) - break; - if (QMenu *qmenu2 = qobject_cast(caused)) - caused_menu = qmenu2->macMenu(); - else if (QMenuBar *qmenubar2 = qobject_cast(caused)) - caused_menu = qmenubar2->macMenu(); - else - caused_menu = 0; - } - } - return true; -} - -//lookup a QMacMenuAction in a menu -static int qt_mac_menu_find_action(MenuRef menu, MenuCommand cmd) -{ - MenuItemIndex ret_idx; - MenuRef ret_menu; - if (GetIndMenuItemWithCommandID(menu, cmd, 1, &ret_menu, &ret_idx) == noErr) { - if (ret_menu == menu) - return (int)ret_idx; - } - return -1; -} -static int qt_mac_menu_find_action(MenuRef menu, QMacMenuAction *action) -{ - return qt_mac_menu_find_action(menu, action->command); -} - -typedef QMultiHash EventHandlerHash; -Q_GLOBAL_STATIC(EventHandlerHash, menu_eventHandlers_hash) - -static EventTypeSpec widget_in_menu_events[] = { - { kEventClassMenu, kEventMenuMeasureItemWidth }, - { kEventClassMenu, kEventMenuMeasureItemHeight }, - { kEventClassMenu, kEventMenuDrawItem }, - { kEventClassMenu, kEventMenuCalculateSize } -}; - -static OSStatus qt_mac_widget_in_menu_eventHandler(EventHandlerCallRef er, EventRef event, void *) -{ - UInt32 ekind = GetEventKind(event); - UInt32 eclass = GetEventClass(event); - OSStatus result = eventNotHandledErr; - switch (eclass) { - case kEventClassMenu: - switch (ekind) { - default: - break; - case kEventMenuMeasureItemWidth: { - MenuItemIndex item; - GetEventParameter(event, kEventParamMenuItemIndex, typeMenuItemIndex, - 0, sizeof(item), 0, &item); - OSMenuRef menu; - GetEventParameter(event, kEventParamDirectObject, typeMenuRef, 0, sizeof(menu), 0, &menu); - QWidget *widget; - if (GetMenuItemProperty(menu, item, kMenuCreatorQt, kMenuPropertyWidgetActionWidget, - sizeof(widget), 0, &widget) == noErr) { - short width = short(widget->sizeHint().width()); - SetEventParameter(event, kEventParamMenuItemWidth, typeSInt16, - sizeof(short), &width); - result = noErr; - } - break; } - case kEventMenuMeasureItemHeight: { - MenuItemIndex item; - GetEventParameter(event, kEventParamMenuItemIndex, typeMenuItemIndex, - 0, sizeof(item), 0, &item); - OSMenuRef menu; - GetEventParameter(event, kEventParamDirectObject, typeMenuRef, 0, sizeof(menu), 0, &menu); - QWidget *widget; - if (GetMenuItemProperty(menu, item, kMenuCreatorQt, kMenuPropertyWidgetActionWidget, - sizeof(widget), 0, &widget) == noErr && widget) { - short height = short(widget->sizeHint().height()); - SetEventParameter(event, kEventParamMenuItemHeight, typeSInt16, - sizeof(short), &height); - result = noErr; - } - break; } - case kEventMenuDrawItem: - result = noErr; - break; - case kEventMenuCalculateSize: { - result = CallNextEventHandler(er, event); - if (result == noErr) { - OSMenuRef menu; - GetEventParameter(event, kEventParamDirectObject, typeMenuRef, 0, sizeof(menu), 0, &menu); - HIViewRef content; - HIMenuGetContentView(menu, kThemeMenuTypePullDown, &content); - UInt16 count = CountMenuItems(menu); - for (MenuItemIndex i = 1; i <= count; ++i) { - QWidget *widget; - if (GetMenuItemProperty(menu, i, kMenuCreatorQt, kMenuPropertyWidgetActionWidget, - sizeof(widget), 0, &widget) == noErr && widget) { - RgnHandle itemRgn = qt_mac_get_rgn(); - GetControlRegion(content, i, itemRgn); - - Rect bounds; - GetRegionBounds( itemRgn, &bounds ); - qt_mac_dispose_rgn(itemRgn); - widget->setGeometry(bounds.left, bounds.top, - bounds.right - bounds.left, bounds.bottom - bounds.top); - } - } - } - break; } - } - } - return result; -} - -//handling of events for menurefs created by Qt.. -static EventTypeSpec menu_events[] = { - { kEventClassCommand, kEventCommandProcess }, - { kEventClassMenu, kEventMenuTargetItem }, - { kEventClassMenu, kEventMenuOpening }, - { kEventClassMenu, kEventMenuClosed } -}; - -// Special case for kEventMenuMatchKey, see qt_mac_create_menu below. -static EventTypeSpec menu_menu_events[] = { - { kEventClassMenu, kEventMenuMatchKey } -}; - -OSStatus qt_mac_menu_event(EventHandlerCallRef er, EventRef event, void *) -{ - QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData); - - bool handled_event = true; - UInt32 ekind = GetEventKind(event), eclass = GetEventClass(event); - switch(eclass) { - case kEventClassCommand: - if (ekind == kEventCommandProcess) { - UInt32 context; - GetEventParameter(event, kEventParamMenuContext, typeUInt32, - 0, sizeof(context), 0, &context); - HICommand cmd; - GetEventParameter(event, kEventParamDirectObject, typeHICommand, - 0, sizeof(cmd), 0, &cmd); - if (!mac_keyboard_grabber && (context & kMenuContextKeyMatching)) { - QMacMenuAction *action = 0; - if (GetMenuCommandProperty(cmd.menu.menuRef, cmd.commandID, kMenuCreatorQt, - kMenuPropertyQAction, sizeof(action), 0, &action) == noErr) { - QWidget *widget = 0; - if (qApp->activePopupWidget()) - widget = (qApp->activePopupWidget()->focusWidget() ? - qApp->activePopupWidget()->focusWidget() : qApp->activePopupWidget()); - else if (QApplicationPrivate::focus_widget) - widget = QApplicationPrivate::focus_widget; - if (widget) { - int key = action->action->shortcut(); - QKeyEvent accel_ev(QEvent::ShortcutOverride, (key & (~Qt::KeyboardModifierMask)), - Qt::KeyboardModifiers(key & Qt::KeyboardModifierMask)); - accel_ev.ignore(); - qt_sendSpontaneousEvent(widget, &accel_ev); - if (accel_ev.isAccepted()) { - handled_event = false; - break; - } - } - } - } - handled_event = qt_mac_activate_action(cmd.menu.menuRef, cmd.commandID, - QAction::Trigger, context & kMenuContextKeyMatching); - } - break; - case kEventClassMenu: { - MenuRef menu; - GetEventParameter(event, kEventParamDirectObject, typeMenuRef, NULL, sizeof(menu), NULL, &menu); - if (ekind == kEventMenuMatchKey) { - // Don't activate any actions if we are showing a native modal dialog, - // the key events should go to the dialog in this case. - if (QApplicationPrivate::native_modal_dialog_active) - return menuItemNotFoundErr; - - handled_event = false; - } else if (ekind == kEventMenuTargetItem) { - MenuCommand command; - GetEventParameter(event, kEventParamMenuCommand, typeMenuCommand, - 0, sizeof(command), 0, &command); - handled_event = qt_mac_activate_action(menu, command, QAction::Hover, false); - } else if (ekind == kEventMenuOpening || ekind == kEventMenuClosed) { - qt_mac_menus_open_count += (ekind == kEventMenuOpening) ? 1 : -1; - MenuRef mr; - GetEventParameter(event, kEventParamDirectObject, typeMenuRef, - 0, sizeof(mr), 0, &mr); - - QWidget *widget = 0; - if (GetMenuItemProperty(mr, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(widget), 0, &widget) == noErr) { - if (QMenu *qmenu = qobject_cast(widget)) { - handled_event = true; - if (ekind == kEventMenuOpening) { - emit qmenu->aboutToShow(); - - int merged = 0; - const QMenuPrivate::QMacMenuPrivate *mac_menu = qmenu->d_func()->mac_menu; - const int ActionItemsCount = mac_menu->actionItems.size(); - for(int i = 0; i < ActionItemsCount; ++i) { - QMacMenuAction *action = mac_menu->actionItems.at(i); - if (action->action->isSeparator()) { - bool hide = false; - if(!action->action->isVisible()) { - hide = true; - } else if (merged && merged == i) { - hide = true; - } else { - for(int l = i+1; l < mac_menu->actionItems.size(); ++l) { - QMacMenuAction *action = mac_menu->actionItems.at(l); - if (action->merged) { - hide = true; - } else if (action->action->isSeparator()) { - if (hide) - break; - } else if (!action->merged) { - hide = false; - break; - } - } - } - - const int index = qt_mac_menu_find_action(mr, action); - if (hide) { - ++merged; - ChangeMenuItemAttributes(mr, index, kMenuItemAttrHidden, 0); - } else { - ChangeMenuItemAttributes(mr, index, 0, kMenuItemAttrHidden); - } - } else if (action->merged) { - ++merged; - } - } - } else { - emit qmenu->aboutToHide(); - } - } - } - } else { - handled_event = false; - } - break; } - default: - handled_event = false; - break; - } - if (!handled_event) //let the event go through - return CallNextEventHandler(er, event); - return noErr; //we eat the event -} -static EventHandlerRef mac_menu_event_handler = 0; -static EventHandlerUPP mac_menu_eventUPP = 0; -static void qt_mac_cleanup_menu_event() -{ - if (mac_menu_event_handler) { - RemoveEventHandler(mac_menu_event_handler); - mac_menu_event_handler = 0; - } - if (mac_menu_eventUPP) { - DisposeEventHandlerUPP(mac_menu_eventUPP); - mac_menu_eventUPP = 0; - } -} -static inline void qt_mac_create_menu_event_handler() -{ - if (!mac_menu_event_handler) { - mac_menu_eventUPP = NewEventHandlerUPP(qt_mac_menu_event); - InstallEventHandler(GetApplicationEventTarget(), mac_menu_eventUPP, - GetEventTypeCount(menu_events), menu_events, 0, - &mac_menu_event_handler); - qAddPostRoutine(qt_mac_cleanup_menu_event); - } -} - - -//enabling of commands -static void qt_mac_command_set_enabled(MenuRef menu, UInt32 cmd, bool b) -{ - if (cmd == kHICommandQuit) - qt_mac_quit_menu_item_enabled = b; - - if (b) { - EnableMenuCommand(menu, cmd); - if (MenuRef dock_menu = GetApplicationDockTileMenu()) - EnableMenuCommand(dock_menu, cmd); - } else { - DisableMenuCommand(menu, cmd); - if (MenuRef dock_menu = GetApplicationDockTileMenu()) - DisableMenuCommand(dock_menu, cmd); - } -} - -static bool qt_mac_auto_apple_menu(MenuCommand cmd) -{ - return (cmd == kHICommandPreferences || cmd == kHICommandQuit); -} - -static void qt_mac_get_accel(quint32 accel_key, quint32 *modif, quint32 *key) { - if (modif) { - *modif = constructModifierMask(accel_key); - } - - accel_key &= ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL); - if (key) { - *key = 0; - if (accel_key == Qt::Key_Return) - *key = kMenuReturnGlyph; - else if (accel_key == Qt::Key_Enter) - *key = kMenuEnterGlyph; - else if (accel_key == Qt::Key_Tab) - *key = kMenuTabRightGlyph; - else if (accel_key == Qt::Key_Backspace) - *key = kMenuDeleteLeftGlyph; - else if (accel_key == Qt::Key_Delete) - *key = kMenuDeleteRightGlyph; - else if (accel_key == Qt::Key_Escape) - *key = kMenuEscapeGlyph; - else if (accel_key == Qt::Key_PageUp) - *key = kMenuPageUpGlyph; - else if (accel_key == Qt::Key_PageDown) - *key = kMenuPageDownGlyph; - else if (accel_key == Qt::Key_Up) - *key = kMenuUpArrowGlyph; - else if (accel_key == Qt::Key_Down) - *key = kMenuDownArrowGlyph; - else if (accel_key == Qt::Key_Left) - *key = kMenuLeftArrowGlyph; - else if (accel_key == Qt::Key_Right) - *key = kMenuRightArrowGlyph; - else if (accel_key == Qt::Key_CapsLock) - *key = kMenuCapsLockGlyph; - else if (accel_key >= Qt::Key_F1 && accel_key <= Qt::Key_F15) - *key = (accel_key - Qt::Key_F1) + kMenuF1Glyph; - else if (accel_key == Qt::Key_Home) - *key = kMenuNorthwestArrowGlyph; - else if (accel_key == Qt::Key_End) - *key = kMenuSoutheastArrowGlyph; - } -} -#else // Cocoa -static inline void syncNSMenuItemVisiblity(NSMenuItem *menuItem, bool actionVisibility) -{ - [menuItem setHidden:NO]; - [menuItem setHidden:YES]; - [menuItem setHidden:!actionVisibility]; -} - -static inline void syncNSMenuItemEnabled(NSMenuItem *menuItem, bool enabled) -{ - [menuItem setEnabled:NO]; - [menuItem setEnabled:YES]; - [menuItem setEnabled:enabled]; -} - -static inline void syncMenuBarItemsVisiblity(const QMenuBarPrivate::QMacMenuBarPrivate *mac_menubar) -{ - const QList &menubarActions = mac_menubar->actionItems; - for (int i = 0; i < menubarActions.size(); ++i) { - const QMacMenuAction *action = menubarActions.at(i); - syncNSMenuItemVisiblity(action->menuItem, actualMenuItemVisibility(mac_menubar, action)); - } -} - -static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader() -{ - return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)]; -} - -static NSMenuItem *createNSMenuItem(const QString &title) -{ - NSMenuItem *item = [[NSMenuItem alloc] - initWithTitle:qt_mac_QStringToNSString(title) - action:@selector(qtDispatcherToQAction:) keyEquivalent:@""]; - [item setTarget:nil]; - return item; -} -#endif - - - -// helper that recurses into a menu structure and en/dis-ables them -void qt_mac_set_modal_state_helper_recursive(OSMenuRef menu, OSMenuRef merge, bool on) -{ -#ifndef QT_MAC_USE_COCOA - for (int i = 0; i < CountMenuItems(menu); i++) { - OSMenuRef submenu; - GetMenuItemHierarchicalMenu(menu, i+1, &submenu); - if (submenu != merge) { - if (submenu) - qt_mac_set_modal_state_helper_recursive(submenu, merge, on); - if (on) - DisableMenuItem(submenu, 0); - else - EnableMenuItem(submenu, 0); - } - } -#else - bool modalWindowOnScreen = qApp->activeModalWidget() != 0; - for (NSMenuItem *item in [menu itemArray]) { - OSMenuRef submenu = [item submenu]; - if (submenu != merge) { - if (submenu) - qt_mac_set_modal_state_helper_recursive(submenu, merge, on); - if (!on) { - // The item should follow what the QAction has. - if ([item tag]) { - QAction *action = reinterpret_cast([item tag]); - syncNSMenuItemEnabled(item, action->isEnabled()); - } else { - syncNSMenuItemEnabled(item, YES); - } - // We sneak in some extra code here to handle a menu problem: - // If there is no window on screen, we cannot set 'nil' as - // menu item target, because then cocoa will disable the item - // (guess it assumes that there will be no first responder to - // catch the trigger anyway?) OTOH, If we have a modal window, - // then setting the menu loader as target will make cocoa not - // deliver the trigger because the loader is then seen as modally - // shaddowed). So either way there are shortcomings. Instead, we - // decide the target as late as possible: - [item setTarget:modalWindowOnScreen ? nil : getMenuLoader()]; - } else { - syncNSMenuItemEnabled(item, NO); - } - } - } -#endif -} - -//toggling of modal state -static void qt_mac_set_modal_state(OSMenuRef menu, bool on) -{ -#ifndef QT_MAC_USE_COCOA - OSMenuRef merge = 0; - GetMenuItemProperty(menu, 0, kMenuCreatorQt, kMenuPropertyMergeMenu, - sizeof(merge), 0, &merge); - - qt_mac_set_modal_state_helper_recursive(menu, merge, on); - - UInt32 commands[] = { kHICommandQuit, kHICommandPreferences, kHICommandAbout, kHICommandAboutQt, 0 }; - for(int c = 0; commands[c]; c++) { - bool enabled = !on; - if (enabled) { - QMacMenuAction *action = 0; - GetMenuCommandProperty(menu, commands[c], kMenuCreatorQt, kMenuPropertyQAction, - sizeof(action), 0, &action); - if (!action && merge) { - GetMenuCommandProperty(merge, commands[c], kMenuCreatorQt, kMenuPropertyQAction, - sizeof(action), 0, &action); - if (!action) { - QMenuMergeList *list = 0; - GetMenuItemProperty(merge, 0, kMenuCreatorQt, kMenuPropertyMergeList, - sizeof(list), 0, &list); - for(int i = 0; list && i < list->size(); ++i) { - QMenuMergeItem item = list->at(i); - if (item.command == commands[c] && item.action) { - action = item.action; - break; - } - } - } - } - - if (!action) { - if (commands[c] != kHICommandQuit) - enabled = false; - } else { - enabled = action->action ? action->action->isEnabled() : 0; - } - } - qt_mac_command_set_enabled(menu, commands[c], enabled); - } -#else - OSMenuRef merge = QMenuPrivate::mergeMenuHash.value(menu); - qt_mac_set_modal_state_helper_recursive(menu, merge, on); - // I'm ignoring the special items now, since they should get handled via a syncAction() -#endif -} - -bool qt_mac_menubar_is_open() -{ - return qt_mac_menus_open_count > 0; -} - -QMacMenuAction::~QMacMenuAction() -{ -#ifdef QT_MAC_USE_COCOA - [menu release]; - // Update the menu item if this action still owns it. For some items - // (like 'Quit') ownership will be transferred between all menu bars... - if (action && action.data() == reinterpret_cast([menuItem tag])) { - QAction::MenuRole role = action->menuRole(); - // Check if the item is owned by Qt, and should be hidden to keep it from causing - // problems. Do it for everything but the quit menu item since that should always - // be visible. - if (role > QAction::ApplicationSpecificRole && role < QAction::QuitRole) { - [menuItem setHidden:YES]; - } else if (role == QAction::TextHeuristicRole - && menuItem != [getMenuLoader() quitMenuItem]) { - [menuItem setHidden:YES]; - } - [menuItem setTag:nil]; - } - [menuItem release]; -#endif -} - -#ifndef QT_MAC_USE_COCOA -static MenuCommand qt_mac_menu_merge_action(MenuRef merge, QMacMenuAction *action) -#else -static NSMenuItem *qt_mac_menu_merge_action(OSMenuRef merge, QMacMenuAction *action) -#endif -{ - if (qt_mac_no_menubar_merge || action->action->menu() || action->action->isSeparator() - || action->action->menuRole() == QAction::NoRole) - return 0; - - QString t = qt_mac_removeMnemonics(action->action->text().toLower()); - int st = t.lastIndexOf(QLatin1Char('\t')); - if (st != -1) - t.remove(st, t.length()-st); - t.replace(QRegExp(QString::fromLatin1("\\.*$")), QLatin1String("")); //no ellipses - //now the fun part -#ifndef QT_MAC_USE_COCOA - MenuCommand ret = 0; -#else - NSMenuItem *ret = 0; - QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); -#endif - switch (action->action->menuRole()) { - case QAction::NoRole: - ret = 0; - break; - case QAction::ApplicationSpecificRole: -#ifndef QT_MAC_USE_COCOA - { - QMenuMergeList *list = 0; - if (GetMenuItemProperty(merge, 0, kMenuCreatorQt, kMenuPropertyMergeList, - sizeof(list), 0, &list) == noErr && list) { - MenuCommand lastCustom = kHICommandCustomMerge; - for(int i = 0; i < list->size(); ++i) { - QMenuMergeItem item = list->at(i); - if (item.command == lastCustom) - ++lastCustom; - } - ret = lastCustom; - } else { - // The list hasn't been created, so, must be the first one. - ret = kHICommandCustomMerge; - } - } -#else - ret = [loader appSpecificMenuItem]; -#endif - break; - case QAction::AboutRole: -#ifndef QT_MAC_USE_COCOA - ret = kHICommandAbout; -#else - ret = [loader aboutMenuItem]; -#endif - break; - case QAction::AboutQtRole: -#ifndef QT_MAC_USE_COCOA - ret = kHICommandAboutQt; -#else - ret = [loader aboutQtMenuItem]; -#endif - break; - case QAction::QuitRole: -#ifndef QT_MAC_USE_COCOA - ret = kHICommandQuit; -#else - ret = [loader quitMenuItem]; -#endif - break; - case QAction::PreferencesRole: -#ifndef QT_MAC_USE_COCOA - ret = kHICommandPreferences; -#else - ret = [loader preferencesMenuItem]; -#endif - break; - case QAction::TextHeuristicRole: { - QString aboutString = QMenuBar::tr("About").toLower(); - if (t.startsWith(aboutString) || t.endsWith(aboutString)) { - if (t.indexOf(QRegExp(QString::fromLatin1("qt$"), Qt::CaseInsensitive)) == -1) { -#ifndef QT_MAC_USE_COCOA - ret = kHICommandAbout; -#else - ret = [loader aboutMenuItem]; -#endif - } else { -#ifndef QT_MAC_USE_COCOA - ret = kHICommandAboutQt; -#else - ret = [loader aboutQtMenuItem]; -#endif - } - } else if (t.startsWith(QMenuBar::tr("Config").toLower()) - || t.startsWith(QMenuBar::tr("Preference").toLower()) - || t.startsWith(QMenuBar::tr("Options").toLower()) - || t.startsWith(QMenuBar::tr("Setting").toLower()) - || t.startsWith(QMenuBar::tr("Setup").toLower())) { -#ifndef QT_MAC_USE_COCOA - ret = kHICommandPreferences; -#else - ret = [loader preferencesMenuItem]; -#endif - } else if (t.startsWith(QMenuBar::tr("Quit").toLower()) - || t.startsWith(QMenuBar::tr("Exit").toLower())) { -#ifndef QT_MAC_USE_COCOA - ret = kHICommandQuit; -#else - ret = [loader quitMenuItem]; -#endif - } - } - break; - } - -#ifndef QT_MAC_USE_COCOA - QMenuMergeList *list = 0; - if (GetMenuItemProperty(merge, 0, kMenuCreatorQt, kMenuPropertyMergeList, - sizeof(list), 0, &list) == noErr && list) { - for(int i = 0; i < list->size(); ++i) { - QMenuMergeItem item = list->at(i); - if (item.command == ret && item.action) - return 0; - } - } - - QAction *cmd_action = 0; - if (GetMenuCommandProperty(merge, ret, kMenuCreatorQt, kMenuPropertyQAction, - sizeof(cmd_action), 0, &cmd_action) == noErr && cmd_action) - return 0; //already taken -#else - if (QMenuMergeList *list = QMenuPrivate::mergeMenuItemsHash.value(merge)) { - for(int i = 0; i < list->size(); ++i) { - const QMenuMergeItem &item = list->at(i); - if (item.menuItem == ret && item.action) - return 0; - } - } - -#endif - return ret; -} - -static QString qt_mac_menu_merge_text(QMacMenuAction *action) -{ - QString ret; - extern QString qt_mac_applicationmenu_string(int type); -#ifdef QT_MAC_USE_COCOA - QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); -#endif - if (action->action->menuRole() == QAction::ApplicationSpecificRole) - ret = action->action->text(); -#ifndef QT_MAC_USE_COCOA - else if (action->command == kHICommandAbout) - ret = qt_mac_applicationmenu_string(6).arg(qAppName()); - else if (action->command == kHICommandAboutQt) - ret = QMenuBar::tr("About Qt"); - else if (action->command == kHICommandPreferences) - ret = qt_mac_applicationmenu_string(4); - else if (action->command == kHICommandQuit) - ret = qt_mac_applicationmenu_string(5).arg(qAppName()); -#else - else if (action->menuItem == [loader aboutMenuItem]) { - ret = qt_mac_applicationmenu_string(6).arg(qAppName()); - } else if (action->menuItem == [loader aboutQtMenuItem]) { - if (action->action->text() == QString("About Qt")) - ret = QMenuBar::tr("About Qt"); - else - ret = action->action->text(); - } else if (action->menuItem == [loader preferencesMenuItem]) { - ret = qt_mac_applicationmenu_string(4); - } else if (action->menuItem == [loader quitMenuItem]) { - ret = qt_mac_applicationmenu_string(5).arg(qAppName()); - } -#endif - return ret; -} - -static QKeySequence qt_mac_menu_merge_accel(QMacMenuAction *action) -{ - QKeySequence ret; -#ifdef QT_MAC_USE_COCOA - QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); -#endif - if (action->action->menuRole() == QAction::ApplicationSpecificRole) - ret = action->action->shortcut(); -#ifndef QT_MAC_USE_COCOA - else if (action->command == kHICommandPreferences) - ret = QKeySequence(QKeySequence::Preferences); - else if (action->command == kHICommandQuit) - ret = QKeySequence(QKeySequence::Quit); -#else - else if (action->menuItem == [loader preferencesMenuItem]) - ret = QKeySequence(QKeySequence::Preferences); - else if (action->menuItem == [loader quitMenuItem]) - ret = QKeySequence(QKeySequence::Quit); -#endif - return ret; -} - -void Q_GUI_EXPORT qt_mac_set_menubar_icons(bool b) -{ QApplication::instance()->setAttribute(Qt::AA_DontShowIconsInMenus, !b); } -void Q_GUI_EXPORT qt_mac_set_native_menubar(bool b) -{ QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, !b); } -void Q_GUI_EXPORT qt_mac_set_menubar_merge(bool b) { qt_mac_no_menubar_merge = !b; } - -/***************************************************************************** - QMenu bindings - *****************************************************************************/ -QMenuPrivate::QMacMenuPrivate::QMacMenuPrivate() : menu(0) -{ -} - -QMenuPrivate::QMacMenuPrivate::~QMacMenuPrivate() -{ -#ifndef QT_MAC_USE_COCOA - for(QList::Iterator it = actionItems.begin(); it != actionItems.end(); ++it) { - QMacMenuAction *action = (*it); - RemoveMenuCommandProperty(action->menu, action->command, kMenuCreatorQt, kMenuPropertyQAction); - if (action->merged) { - QMenuMergeList *list = 0; - GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyMergeList, - sizeof(list), 0, &list); - for(int i = 0; list && i < list->size(); ) { - QMenuMergeItem item = list->at(i); - if (item.action == action) - list->removeAt(i); - else - ++i; - } - } - delete action; - } - if (menu) { - EventHandlerHash::iterator it = menu_eventHandlers_hash()->find(menu); - while (it != menu_eventHandlers_hash()->end() && it.key() == menu) { - RemoveEventHandler(it.value()); - ++it; - } - menu_eventHandlers_hash()->remove(menu); - ReleaseMenu(menu); - } -#else - QMacCocoaAutoReleasePool pool; - while (actionItems.size()) { - QMacMenuAction *action = actionItems.takeFirst(); - if (QMenuMergeList *list = mergeMenuItemsHash.value(action->menu)) { - int i = 0; - while (i < list->size()) { - const QMenuMergeItem &item = list->at(i); - if (item.action == action) - list->removeAt(i); - else - ++i; - } - } - delete action; - } - mergeMenuHash.remove(menu); - mergeMenuItemsHash.remove(menu); - [menu release]; -#endif -} - -void -QMenuPrivate::QMacMenuPrivate::addAction(QAction *a, QMacMenuAction *before, QMenuPrivate *qmenu) -{ - QMacMenuAction *action = new QMacMenuAction; - action->action = a; - action->ignore_accel = 0; - action->merged = 0; - action->menu = 0; -#ifndef QT_MAC_USE_COCOA - action->command = qt_mac_menu_static_cmd_id++; -#endif - addAction(action, before, qmenu); -} - -void -QMenuPrivate::QMacMenuPrivate::addAction(QMacMenuAction *action, QMacMenuAction *before, QMenuPrivate *qmenu) -{ -#ifdef QT_MAC_USE_COCOA - QMacCocoaAutoReleasePool pool; - Q_UNUSED(qmenu); -#endif - if (!action) - return; - int before_index = actionItems.indexOf(before); - if (before_index < 0) { - before = 0; - before_index = actionItems.size(); - } - actionItems.insert(before_index, action); - -#ifndef QT_MAC_USE_COCOA - int index = qt_mac_menu_find_action(menu, action); -#else - [menu retain]; - [action->menu release]; -#endif - action->menu = menu; - - /* When the action is considered a mergable action it - will stay that way, until removed.. */ - if (!qt_mac_no_menubar_merge) { -#ifndef QT_MAC_USE_COCOA - MenuRef merge = 0; - GetMenuItemProperty(menu, 0, kMenuCreatorQt, kMenuPropertyMergeMenu, - sizeof(merge), 0, &merge); -#else - OSMenuRef merge = QMenuPrivate::mergeMenuHash.value(menu); -#endif - if (merge) { -#ifndef QT_MAC_USE_COCOA - if (MenuCommand cmd = qt_mac_menu_merge_action(merge, action)) { - action->merged = 1; - action->menu = merge; - action->command = cmd; - if (qt_mac_auto_apple_menu(cmd)) - index = 0; //no need - - QMenuMergeList *list = 0; - if (GetMenuItemProperty(merge, 0, kMenuCreatorQt, kMenuPropertyMergeList, - sizeof(list), 0, &list) != noErr || !list) { - list = new QMenuMergeList; - SetMenuItemProperty(merge, 0, kMenuCreatorQt, kMenuPropertyMergeList, - sizeof(list), &list); - } - list->append(QMenuMergeItem(cmd, action)); - } -#else - if (NSMenuItem *cmd = qt_mac_menu_merge_action(merge, action)) { - action->merged = 1; - [merge retain]; - [action->menu release]; - action->menu = merge; - [cmd retain]; - [cmd setAction:@selector(qtDispatcherToQAction:)]; - [cmd setTarget:nil]; - [action->menuItem release]; - action->menuItem = cmd; - QMenuMergeList *list = QMenuPrivate::mergeMenuItemsHash.value(merge); - if (!list) { - list = new QMenuMergeList; - QMenuPrivate::mergeMenuItemsHash.insert(merge, list); - } - list->append(QMenuMergeItem(cmd, action)); - } -#endif - } - } - -#ifdef QT_MAC_USE_COCOA - NSMenuItem *newItem = action->menuItem; -#endif - if ( -#ifndef QT_MAC_USE_COCOA - index == -1 -#else - newItem == 0 -#endif - ) { -#ifndef QT_MAC_USE_COCOA - index = before_index; - MenuItemAttributes attr = kMenuItemAttrAutoRepeat; -#else - newItem = createNSMenuItem(action->action->text()); - action->menuItem = newItem; -#endif - if (before) { -#ifndef QT_MAC_USE_COCOA - InsertMenuItemTextWithCFString(action->menu, 0, qMax(before_index, 0), attr, action->command); -#else - [menu insertItem:newItem atIndex:qMax(before_index, 0)]; -#endif - } else { -#ifndef QT_MAC_USE_COCOA - // Append the menu item to the menu. If it is a kHICommandAbout or a kHICommandAboutQt append - // a separator also (to get a separator above "Preferences"), but make sure that we don't - // add separators between two "about" items. - - // Build a set of all commands that could possibly be before the separator. - QSet mergedItems; - mergedItems.insert(kHICommandAbout); - mergedItems.insert(kHICommandAboutQt); - mergedItems.insert(kHICommandCustomMerge); - - QMenuMergeList *list = 0; - if (GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyMergeList, - sizeof(list), 0, &list) == noErr && list) { - for (int i = 0; i < list->size(); ++i) { - MenuCommand command = list->at(i).command; - if (command > kHICommandCustomMerge) { - mergedItems.insert(command); - } - } - } - - const int itemCount = CountMenuItems(action->menu); - MenuItemAttributes testattr; - GetMenuItemAttributes(action->menu, itemCount , &testattr); - if (mergedItems.contains(action->command) - && (testattr & kMenuItemAttrSeparator)) { - InsertMenuItemTextWithCFString(action->menu, 0, qMax(itemCount - 1, 0), attr, action->command); - index = itemCount; - } else { - MenuItemIndex tmpIndex; - AppendMenuItemTextWithCFString(action->menu, 0, attr, action->command, &tmpIndex); - index = tmpIndex; - if (mergedItems.contains(action->command)) - AppendMenuItemTextWithCFString(action->menu, 0, kMenuItemAttrSeparator, 0, &tmpIndex); - } -#else - [menu addItem:newItem]; -#endif - } - - QWidget *widget = qmenu ? qmenu->widgetItems.value(action->action) : 0; - if (widget) { -#ifndef QT_MAC_USE_COCOA - ChangeMenuAttributes(action->menu, kMenuAttrDoNotCacheImage, 0); - attr = kMenuItemAttrCustomDraw; - SetMenuItemProperty(action->menu, index, kMenuCreatorQt, kMenuPropertyWidgetActionWidget, - sizeof(QWidget *), &widget); - HIViewRef content; - HIMenuGetContentView(action->menu, kThemeMenuTypePullDown, &content); - - EventHandlerRef eventHandlerRef; - InstallMenuEventHandler(action->menu, qt_mac_widget_in_menu_eventHandler, - GetEventTypeCount(widget_in_menu_events), - widget_in_menu_events, 0, &eventHandlerRef); - menu_eventHandlers_hash()->insert(action->menu, eventHandlerRef); - - QWidget *menuWidget = 0; - GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyWidgetMenu, - sizeof(menuWidget), 0, &menuWidget); - if(!menuWidget) { - menuWidget = new QMacNativeWidget(content); - SetMenuItemProperty(menu, 0, kMenuCreatorQt, kMenuPropertyWidgetMenu, - sizeof(menuWidget), &menuWidget); - menuWidget->show(); - } - widget->setParent(menuWidget); -#else - QMacNativeWidget *container = new QMacNativeWidget(0); - container->resize(widget->sizeHint()); - widget->setAttribute(Qt::WA_LayoutUsesWidgetRect); - widget->setParent(container); - - NSView *containerView = qt_mac_nativeview_for(container); - [containerView setAutoresizesSubviews:YES]; - [containerView setAutoresizingMask:NSViewWidthSizable]; - [qt_mac_nativeview_for(widget) setAutoresizingMask:NSViewWidthSizable]; - - [newItem setView:containerView]; - container->show(); -#endif - widget->show(); - } - - } else { -#ifndef QT_MAC_USE_COCOA - qt_mac_command_set_enabled(action->menu, action->command, !QApplicationPrivate::modalState()); -#else - [newItem setEnabled:!QApplicationPrivate::modalState()]; -#endif - } -#ifndef QT_MAC_USE_COCOA - SetMenuCommandProperty(action->menu, action->command, kMenuCreatorQt, kMenuPropertyQAction, - sizeof(action), &action); -#else - [newItem setTag:long(static_cast(action->action))]; -#endif - syncAction(action); -} - -// return an autoreleased string given a QKeySequence (currently only looks at the first one). -NSString *keySequenceToKeyEqivalent(const QKeySequence &accel) -{ - quint32 accel_key = (accel[0] & ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL)); - extern QChar qtKey2CocoaKey(Qt::Key key); - QChar cocoa_key = qtKey2CocoaKey(Qt::Key(accel_key)); - if (cocoa_key.isNull()) - cocoa_key = QChar(accel_key).toLower().unicode(); - return [NSString stringWithCharacters:&cocoa_key.unicode() length:1]; -} - -// return the cocoa modifier mask for the QKeySequence (currently only looks at the first one). -NSUInteger keySequenceModifierMask(const QKeySequence &accel) -{ - return constructModifierMask(accel[0]); -} - -void -QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action) -{ - if (!action) - return; - -#ifndef QT_MAC_USE_COCOA - const int index = qt_mac_menu_find_action(action->menu, action); - if (index == -1) - return; -#else - NSMenuItem *item = action->menuItem; - if (!item) - return; -#endif - -#ifndef QT_MAC_USE_COCOA - if (!action->action->isVisible()) { - ChangeMenuItemAttributes(action->menu, index, kMenuItemAttrHidden, 0); - return; - } - ChangeMenuItemAttributes(action->menu, index, 0, kMenuItemAttrHidden); -#else - QMacCocoaAutoReleasePool pool; - NSMenu *menu = [item menu]; - bool actionVisible = action->action->isVisible(); - [item setHidden:!actionVisible]; - if (!actionVisible) - return; -#endif - -#ifndef QT_MAC_USE_COCOA - if (action->action->isSeparator()) { - ChangeMenuItemAttributes(action->menu, index, kMenuItemAttrSeparator, 0); - return; - } - ChangeMenuItemAttributes(action->menu, index, 0, kMenuItemAttrSeparator); -#else - int itemIndex = [menu indexOfItem:item]; - Q_ASSERT(itemIndex != -1); - if (action->action->isSeparator()) { - action->menuItem = [NSMenuItem separatorItem]; - [action->menuItem retain]; - [menu insertItem: action->menuItem atIndex:itemIndex]; - [menu removeItem:item]; - [item release]; - item = action->menuItem; - return; - } else if ([item isSeparatorItem]) { - // I'm no longer a separator... - action->menuItem = createNSMenuItem(action->action->text()); - [menu insertItem:action->menuItem atIndex:itemIndex]; - [menu removeItem:item]; - [item release]; - item = action->menuItem; - } -#endif - - //find text (and accel) - action->ignore_accel = 0; - QString text = action->action->text(); - QKeySequence accel = action->action->shortcut(); - { - int st = text.lastIndexOf(QLatin1Char('\t')); - if (st != -1) { - action->ignore_accel = 1; - accel = QKeySequence(text.right(text.length()-(st+1))); - text.remove(st, text.length()-st); - } - } - { - QString cmd_text = qt_mac_menu_merge_text(action); - if (!cmd_text.isEmpty()) { - text = cmd_text; - accel = qt_mac_menu_merge_accel(action); - } - } - // Show multiple key sequences as part of the menu text. - if (accel.count() > 1) - text += QLatin1String(" (") + accel.toString(QKeySequence::NativeText) + QLatin1String(")"); - - QString finalString = qt_mac_removeMnemonics(text); - -#ifndef QT_MAC_USE_COCOA - MenuItemDataRec data; - memset(&data, '\0', sizeof(data)); - - //Carbon text - data.whichData |= kMenuItemDataCFString; - QCFString cfstring(finalString); // Hold the reference to the end of the function. - data.cfText = cfstring; - - // Carbon enabled - data.whichData |= kMenuItemDataEnabled; - data.enabled = action->action->isEnabled(); - // Carbon icon - data.whichData |= kMenuItemDataIconHandle; - if (!action->action->icon().isNull() - && action->action->isIconVisibleInMenu()) { - data.iconType = kMenuIconRefType; - data.iconHandle = (Handle)qt_mac_create_iconref(action->action->icon().pixmap(16, QIcon::Normal)); - } else { - data.iconType = kMenuNoIcon; - } - if (action->action->font().resolve()) { // Carbon font - if (action->action->font().bold()) - data.style |= bold; - if (action->action->font().underline()) - data.style |= underline; - if (action->action->font().italic()) - data.style |= italic; - if (data.style) - data.whichData |= kMenuItemDataStyle; - data.whichData |= kMenuItemDataFontID; - data.fontID = action->action->font().macFontID(); - } -#else - // Cocoa Font and title - if (action->action->font().resolve()) { - const QFont &actionFont = action->action->font(); - NSFont *customMenuFont = [NSFont fontWithName:qt_mac_QStringToNSString(actionFont.family()) - size:actionFont.pointSize()]; - NSArray *keys = [NSArray arrayWithObjects:NSFontAttributeName, nil]; - NSArray *objects = [NSArray arrayWithObjects:customMenuFont, nil]; - NSDictionary *attributes = [NSDictionary dictionaryWithObjects:objects forKeys:keys]; - NSAttributedString *str = [[[NSAttributedString alloc] initWithString:qt_mac_QStringToNSString(finalString) - attributes:attributes] autorelease]; - [item setAttributedTitle: str]; - } else { - [item setTitle: qt_mac_QStringToNSString(finalString)]; - } - - if (action->action->menuRole() == QAction::AboutRole || action->action->menuRole() == QAction::QuitRole) - [item setTitle:qt_mac_QStringToNSString(text)]; - else - [item setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(text))]; - - // Cocoa Enabled - [item setEnabled: action->action->isEnabled()]; - - // Cocoa icon - NSImage *nsimage = 0; - if (!action->action->icon().isNull() && action->action->isIconVisibleInMenu()) { - nsimage = static_cast(qt_mac_create_nsimage(action->action->icon().pixmap(16, QIcon::Normal))); - } - [item setImage:nsimage]; - [nsimage release]; -#endif - - if (action->action->menu()) { //submenu -#ifndef QT_MAC_USE_COCOA - data.whichData |= kMenuItemDataSubmenuHandle; - data.submenuHandle = action->action->menu()->macMenu(); - QWidget *caused = 0; - GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(caused), 0, &caused); - SetMenuItemProperty(data.submenuHandle, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused); -#else - NSMenu *subMenu = static_cast(action->action->menu()->macMenu()); - if ([subMenu supermenu] && [subMenu supermenu] != [item menu]) { - // The menu is already a sub-menu of another one. Cocoa will throw an exception, - // in such cases. For the time being, a new QMenu with same set of actions is the - // only workaround. - action->action->setEnabled(false); - } else { - [item setSubmenu:subMenu]; - } -#endif - } else { //respect some other items -#ifndef QT_MAC_USE_COCOA - //shortcuts (say we are setting them all so that we can also clear them). - data.whichData |= kMenuItemDataCmdKey; - data.whichData |= kMenuItemDataCmdKeyModifiers; - data.whichData |= kMenuItemDataCmdKeyGlyph; - if (accel.count() == 1) { - qt_mac_get_accel(accel[0], (quint32*)&data.cmdKeyModifiers, (quint32*)&data.cmdKeyGlyph); - if (data.cmdKeyGlyph == 0) - data.cmdKey = (UniChar)accel[0]; - } -#else - [item setSubmenu:0]; - // No key equivalent set for multiple key QKeySequence. - if (accel.count() == 1) { - [item setKeyEquivalent:keySequenceToKeyEqivalent(accel)]; - [item setKeyEquivalentModifierMask:keySequenceModifierMask(accel)]; - } else { - [item setKeyEquivalent:@""]; - [item setKeyEquivalentModifierMask:NSCommandKeyMask]; - } -#endif - } -#ifndef QT_MAC_USE_COCOA - //mark glyph - data.whichData |= kMenuItemDataMark; - if (action->action->isChecked()) { -#if 0 - if (action->action->actionGroup() && - action->action->actionGroup()->isExclusive()) - data.mark = diamondMark; - else -#endif - data.mark = checkMark; - } else { - data.mark = noMark; - } - - //actually set it - SetMenuItemData(action->menu, action->command, true, &data); - - // Free up memory - if (data.iconHandle) - ReleaseIconRef(IconRef(data.iconHandle)); -#else - //mark glyph - [item setState:action->action->isChecked() ? NSOnState : NSOffState]; -#endif -} - -void -QMenuPrivate::QMacMenuPrivate::removeAction(QMacMenuAction *action) -{ - if (!action) - return; -#ifndef QT_MAC_USE_COCOA - if (action->command == kHICommandQuit || action->command == kHICommandPreferences) - qt_mac_command_set_enabled(action->menu, action->command, false); - else - DeleteMenuItem(action->menu, qt_mac_menu_find_action(action->menu, action)); -#else - QMacCocoaAutoReleasePool pool; - if (action->merged) { - if (reinterpret_cast([action->menuItem tag]) == action->action) { - QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); - [action->menuItem setEnabled:false]; - if (action->menuItem != [loader quitMenuItem] - && action->menuItem != [loader preferencesMenuItem]) { - [[action->menuItem menu] removeItem:action->menuItem]; - } - } - } else { - [[action->menuItem menu] removeItem:action->menuItem]; - } -#endif - actionItems.removeAll(action); -} - -OSMenuRef -QMenuPrivate::macMenu(OSMenuRef merge) -{ - Q_UNUSED(merge); - Q_Q(QMenu); - if (mac_menu && mac_menu->menu) - return mac_menu->menu; - if (!mac_menu) - mac_menu = new QMacMenuPrivate; - mac_menu->menu = qt_mac_create_menu(q); - if (merge) { -#ifndef QT_MAC_USE_COCOA - SetMenuItemProperty(mac_menu->menu, 0, kMenuCreatorQt, kMenuPropertyMergeMenu, sizeof(merge), &merge); -#else - mergeMenuHash.insert(mac_menu->menu, merge); -#endif - } - QList items = q->actions(); - for(int i = 0; i < items.count(); i++) - mac_menu->addAction(items[i], 0, this); - syncSeparatorsCollapsible(collapsibleSeparators); - return mac_menu->menu; -} - -/*! - \internal -*/ -void -QMenuPrivate::syncSeparatorsCollapsible(bool collapse) -{ -#ifndef QT_MAC_USE_COCOA - if (collapse) - ChangeMenuAttributes(mac_menu->menu, kMenuAttrCondenseSeparators, 0); - else - ChangeMenuAttributes(mac_menu->menu, 0, kMenuAttrCondenseSeparators); -#else - qt_mac_menu_collapseSeparators(mac_menu->menu, collapse); -#endif -} - - - -/*! - \internal -*/ -void QMenuPrivate::setMacMenuEnabled(bool enable) -{ - if (!macMenu(0)) - return; - - QMacCocoaAutoReleasePool pool; - if (enable) { - for (int i = 0; i < mac_menu->actionItems.count(); ++i) { - QMacMenuAction *menuItem = mac_menu->actionItems.at(i); - if (menuItem && menuItem->action && menuItem->action->isEnabled()) { -#ifndef QT_MAC_USE_COCOA - // Only enable those items which contains an enabled QAction. - // i == 0 -> the menu itself, hence i + 1 for items. - EnableMenuItem(mac_menu->menu, i + 1); -#else - [menuItem->menuItem setEnabled:true]; -#endif - } - } - } else { -#ifndef QT_MAC_USE_COCOA - DisableAllMenuItems(mac_menu->menu); -#else - NSMenu *menu = mac_menu->menu; - for (NSMenuItem *item in [menu itemArray]) { - [item setEnabled:false]; - } -#endif - } -} - -/*! - \internal - - This function will return the OSMenuRef used to create the native menu bar - bindings. - - If Qt is built against Carbon, the OSMenuRef is a MenuRef that can be used - with Carbon's Menu Manager API. - - If Qt is built against Cocoa, the OSMenuRef is a NSMenu pointer. - - \warning This function is not portable. - - \sa QMenuBar::macMenu() -*/ -OSMenuRef QMenu::macMenu(OSMenuRef merge) { return d_func()->macMenu(merge); } - -/***************************************************************************** - QMenuBar bindings - *****************************************************************************/ -typedef QHash MenuBarHash; -Q_GLOBAL_STATIC(MenuBarHash, menubars) -static QMenuBar *fallback = 0; -QMenuBarPrivate::QMacMenuBarPrivate::QMacMenuBarPrivate() : menu(0), apple_menu(0) -{ -} - -QMenuBarPrivate::QMacMenuBarPrivate::~QMacMenuBarPrivate() -{ - for(QList::Iterator it = actionItems.begin(); it != actionItems.end(); ++it) - delete (*it); -#ifndef QT_MAC_USE_COCOA - if (apple_menu) { - QMenuMergeList *list = 0; - GetMenuItemProperty(apple_menu, 0, kMenuCreatorQt, kMenuPropertyMergeList, - sizeof(list), 0, &list); - if (list) { - RemoveMenuItemProperty(apple_menu, 0, kMenuCreatorQt, kMenuPropertyMergeList); - delete list; - } - ReleaseMenu(apple_menu); - } - if (menu) - ReleaseMenu(menu); -#else - [apple_menu release]; - [menu release]; -#endif -} - -void -QMenuBarPrivate::QMacMenuBarPrivate::addAction(QAction *a, QAction *before) -{ - if (a->isSeparator() || !menu) - return; - QMacMenuAction *action = new QMacMenuAction; - action->action = a; - action->ignore_accel = 1; -#ifndef QT_MAC_USE_COCOA - action->command = qt_mac_menu_static_cmd_id++; -#endif - addAction(action, findAction(before)); -} - -void -QMenuBarPrivate::QMacMenuBarPrivate::addAction(QMacMenuAction *action, QMacMenuAction *before) -{ - if (!action || !menu) - return; - - int before_index = actionItems.indexOf(before); - if (before_index < 0) { - before = 0; - before_index = actionItems.size(); - } - actionItems.insert(before_index, action); - - MenuItemIndex index = actionItems.size()-1; - - action->menu = menu; -#ifdef QT_MAC_USE_COCOA - QMacCocoaAutoReleasePool pool; - [action->menu retain]; - NSMenuItem *newItem = createNSMenuItem(action->action->text()); - action->menuItem = newItem; -#endif - if (before) { -#ifndef QT_MAC_USE_COCOA - InsertMenuItemTextWithCFString(action->menu, 0, qMax(1, before_index+1), 0, action->command); -#else - [menu insertItem:newItem atIndex:qMax(1, before_index + 1)]; -#endif - index = before_index; - } else { -#ifndef QT_MAC_USE_COCOA - AppendMenuItemTextWithCFString(action->menu, 0, 0, action->command, &index); -#else - [menu addItem:newItem]; -#endif - } -#ifndef QT_MAC_USE_COCOA - SetMenuItemProperty(action->menu, index, kMenuCreatorQt, kMenuPropertyQAction, sizeof(action), - &action); -#else - [newItem setTag:long(static_cast(action->action))]; -#endif - syncAction(action); -} - -void -QMenuBarPrivate::QMacMenuBarPrivate::syncAction(QMacMenuAction *action) -{ - if (!action || !menu) - return; -#ifndef QT_MAC_USE_COCOA - const int index = qt_mac_menu_find_action(action->menu, action); -#else - QMacCocoaAutoReleasePool pool; - NSMenuItem *item = action->menuItem; -#endif - - OSMenuRef submenu = 0; - bool release_submenu = false; - if (action->action->menu()) { - if ((submenu = action->action->menu()->macMenu(apple_menu))) { -#ifndef QT_MAC_USE_COCOA - QWidget *caused = 0; - GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(caused), 0, &caused); - SetMenuItemProperty(submenu, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused); -#else - if ([submenu supermenu] && [submenu supermenu] != [item menu]) - return; - else - [item setSubmenu:submenu]; -#endif - } -#ifndef QT_MAC_USE_COCOA - } else { // create a submenu to act as menu - release_submenu = true; - CreateNewMenu(0, 0, &submenu); -#endif - } - - if (submenu) { - bool visible = actualMenuItemVisibility(this, action); -#ifndef QT_MAC_USE_COCOA - SetMenuItemHierarchicalMenu(action->menu, index, submenu); - SetMenuTitleWithCFString(submenu, QCFString(qt_mac_removeMnemonics(action->action->text()))); - if (visible) - ChangeMenuAttributes(submenu, 0, kMenuAttrHidden); - else - ChangeMenuAttributes(submenu, kMenuAttrHidden, 0); -#else - [item setSubmenu: submenu]; - [submenu setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(action->action->text()))]; - syncNSMenuItemVisiblity(item, visible); -#endif - if (release_submenu) { //no pointers to it -#ifndef QT_MAC_USE_COCOA - ReleaseMenu(submenu); -#else - [submenu release]; -#endif - } - } else { - qWarning("QMenu: No OSMenuRef created for popup menu"); - } -} - -void -QMenuBarPrivate::QMacMenuBarPrivate::removeAction(QMacMenuAction *action) -{ - if (!action || !menu) - return; -#ifndef QT_MAC_USE_COCOA - DeleteMenuItem(action->menu, qt_mac_menu_find_action(action->menu, action)); -#else - QMacCocoaAutoReleasePool pool; - [action->menu removeItem:action->menuItem]; -#endif - actionItems.removeAll(action); -} - -bool QMenuBarPrivate::macWidgetHasNativeMenubar(QWidget *widget) -{ - // This function is different from q->isNativeMenuBar(), as - // it returns true only if a native menu bar is actually - // _created_. - if (!widget) - return false; - return menubars()->contains(widget->window()); -} - -void -QMenuBarPrivate::macCreateMenuBar(QWidget *parent) -{ - Q_Q(QMenuBar); - static int dontUseNativeMenuBar = -1; - // We call the isNativeMenuBar function here - // because that will make sure that local overrides - // are dealt with correctly. q->isNativeMenuBar() will, if not - // overridden, depend on the attribute Qt::AA_DontUseNativeMenuBar: - bool qt_mac_no_native_menubar = !q->isNativeMenuBar(); - if (qt_mac_no_native_menubar == false && dontUseNativeMenuBar < 0) { - // The menubar is set to be native. Let's check (one time only - // for all menubars) if this is OK with the rest of the environment. - // As a result, Qt::AA_DontUseNativeMenuBar is set. NB: the application - // might still choose to not respect, or change, this flag. - bool isPlugin = QApplication::testAttribute(Qt::AA_MacPluginApplication); - bool environmentSaysNo = !qgetenv("QT_MAC_NO_NATIVE_MENUBAR").isEmpty(); - dontUseNativeMenuBar = isPlugin || environmentSaysNo; - QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, dontUseNativeMenuBar); - qt_mac_no_native_menubar = !q->isNativeMenuBar(); - } - if (qt_mac_no_native_menubar == false) { - // INVARIANT: Use native menubar. - extern void qt_event_request_menubarupdate(); //qapplication_mac.cpp - qt_event_request_menubarupdate(); - if (!parent && !fallback) { - fallback = q; - mac_menubar = new QMacMenuBarPrivate; - } else if (parent && parent->isWindow()) { - menubars()->insert(q->window(), q); - mac_menubar = new QMacMenuBarPrivate; - } - } -} - -void QMenuBarPrivate::macDestroyMenuBar() -{ - Q_Q(QMenuBar); - QMacCocoaAutoReleasePool pool; - if (fallback == q) - fallback = 0; - delete mac_menubar; - QWidget *tlw = q->window(); - menubars()->remove(tlw); - mac_menubar = 0; - - if (!qt_mac_current_menubar.qmenubar || qt_mac_current_menubar.qmenubar == q) { -#ifdef QT_MAC_USE_COCOA - QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); - [loader removeActionsFromAppMenu]; -#else - cancelAllMenuTracking(); -#endif - extern void qt_event_request_menubarupdate(); //qapplication_mac.cpp - qt_event_request_menubarupdate(); - } -} - -OSMenuRef QMenuBarPrivate::macMenu() -{ - Q_Q(QMenuBar); - if (!q->isNativeMenuBar() || !mac_menubar) { - return 0; - } else if (!mac_menubar->menu) { - mac_menubar->menu = qt_mac_create_menu(q); - ProcessSerialNumber mine, front; - if (GetCurrentProcess(&mine) == noErr && GetFrontProcess(&front) == noErr) { - if (!qt_mac_no_menubar_merge && !mac_menubar->apple_menu) { - mac_menubar->apple_menu = qt_mac_create_menu(q); -#ifndef QT_MAC_USE_COCOA - MenuItemIndex index; - AppendMenuItemTextWithCFString(mac_menubar->menu, 0, 0, 0, &index); - - SetMenuTitleWithCFString(mac_menubar->apple_menu, QCFString(QString(QChar(0x14)))); - SetMenuItemHierarchicalMenu(mac_menubar->menu, index, mac_menubar->apple_menu); - SetMenuItemProperty(mac_menubar->apple_menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(q), &q); -#else - [mac_menubar->apple_menu setTitle:qt_mac_QStringToNSString(QString(QChar(0x14)))]; - NSMenuItem *apple_menuItem = [[NSMenuItem alloc] init]; - [apple_menuItem setSubmenu:mac_menubar->menu]; - [mac_menubar->apple_menu addItem:apple_menuItem]; - [apple_menuItem release]; -#endif - } - if (mac_menubar->apple_menu) { -#ifndef QT_MAC_USE_COCOA - SetMenuItemProperty(mac_menubar->menu, 0, kMenuCreatorQt, kMenuPropertyMergeMenu, - sizeof(mac_menubar->apple_menu), &mac_menubar->apple_menu); -#else - QMenuPrivate::mergeMenuHash.insert(mac_menubar->menu, mac_menubar->apple_menu); -#endif - } - QList items = q->actions(); - for(int i = 0; i < items.count(); i++) - mac_menubar->addAction(items[i]); - } - } - return mac_menubar->menu; -} - -/*! - \internal - - This function will return the OSMenuRef used to create the native menu bar - bindings. This OSMenuRef is then set as the root menu for the Menu - Manager. - - \warning This function is not portable. - - \sa QMenu::macMenu() -*/ -OSMenuRef QMenuBar::macMenu() { return d_func()->macMenu(); } - -/* ! - \internal - Ancestor function that crosses windows (QWidget::isAncestorOf - only considers widgets within the same window). -*/ -static bool qt_mac_is_ancestor(QWidget* possibleAncestor, QWidget *child) -{ - if (!possibleAncestor) - return false; - - QWidget * current = child->parentWidget(); - while (current != 0) { - if (current == possibleAncestor) - return true; - current = current->parentWidget(); - } - return false; -} - -/* ! - \internal - Returns true if the entries of menuBar should be disabled, - based on the modality type of modalWidget. -*/ -static bool qt_mac_should_disable_menu(QMenuBar *menuBar) -{ - QWidget *modalWidget = qApp->activeModalWidget(); - if (!modalWidget) - return false; - - if (menuBar && menuBar == menubars()->value(modalWidget)) - // The menu bar is owned by the modal widget. - // In that case we should enable it: - return false; - - // When there is an application modal window on screen, the entries of - // the menubar should be disabled. The exception in Qt is that if the - // modal window is the only window on screen, then we enable the menu bar. - QWidget *w = modalWidget; - QWidgetList topLevelWidgets = QApplication::topLevelWidgets(); - while (w) { - if (w->isVisible() && w->windowModality() == Qt::ApplicationModal) { - for (int i=0; iisVisible()) { - // INVARIANT: we found another visible window - // on screen other than our modalWidget. We therefore - // disable the menu bar to follow normal modality logic: - return true; - } - } - // INVARIANT: We have only one window on screen that happends - // to be application modal. We choose to enable the menu bar - // in that case to e.g. enable the quit menu item. - return false; - } - w = w->parentWidget(); - } - - // INVARIANT: modalWidget is window modal. Disable menu entries - // if the menu bar belongs to an ancestor of modalWidget. If menuBar - // is nil, we understand it as the default menu bar set by the nib: - return menuBar ? qt_mac_is_ancestor(menuBar->parentWidget(), modalWidget) : false; -} - -static QWidget *findWindowThatShouldDisplayMenubar() -{ - QWidget *w = qApp->activeWindow(); - if (!w) { - // We have no active window on screen. Try to - // find a window from the list of top levels: - QWidgetList tlws = QApplication::topLevelWidgets(); - for(int i = 0; i < tlws.size(); ++i) { - QWidget *tlw = tlws.at(i); - if ((tlw->isVisible() && tlw->windowType() != Qt::Tool && - tlw->windowType() != Qt::Popup)) { - w = tlw; - break; - } - } - } - return w; -} - -static QMenuBar *findMenubarForWindow(QWidget *w) -{ - QMenuBar *mb = 0; - if (w) { - mb = menubars()->value(w); -#ifndef QT_NO_MAINWINDOW - QDockWidget *dw = qobject_cast(w); - if (!mb && dw) { - QMainWindow *mw = qobject_cast(dw->parentWidget()); - if (mw && (mb = menubars()->value(mw))) - w = mw; - } -#endif - while(w && !mb) - mb = menubars()->value((w = w->parentWidget())); - } - - if (!mb) { - // We could not find a menu bar for the window. Lets - // check if we have a global (parentless) menu bar instead: - mb = fallback; - } - - return mb; -} - -void qt_mac_clear_menubar() -{ - if (QApplication::testAttribute(Qt::AA_MacPluginApplication)) - return; - -#ifndef QT_MAC_USE_COCOA - MenuRef clear_menu = 0; - if (CreateNewMenu(0, 0, &clear_menu) == noErr) { - SetRootMenu(clear_menu); - ReleaseMenu(clear_menu); - } else { - qWarning("QMenu: Internal error at %s:%d", __FILE__, __LINE__); - } - ClearMenuBar(); - qt_mac_command_set_enabled(0, kHICommandPreferences, false); - InvalMenuBar(); -#else - QMacCocoaAutoReleasePool pool; - QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); - NSMenu *menu = [loader menu]; - [loader ensureAppMenuInMenu:menu]; - [NSApp setMainMenu:menu]; - const bool modal = qt_mac_should_disable_menu(0); - if (qt_mac_current_menubar.qmenubar || modal != qt_mac_current_menubar.modal) - qt_mac_set_modal_state(menu, modal); - qt_mac_current_menubar.qmenubar = 0; - qt_mac_current_menubar.modal = modal; -#endif -} - -/*! - \internal - - This function will update the current menu bar and set it as the - active menu bar in the Menu Manager. - - \warning This function is not portable. - - \sa QMenu::macMenu(), QMenuBar::macMenu() -*/ -bool QMenuBar::macUpdateMenuBar() -{ -#ifdef QT_MAC_USE_COCOA - QMacCocoaAutoReleasePool pool; - qt_cocoaPostMessage(getMenuLoader(), @selector(qtUpdateMenubar)); - return true; -#else - return QMenuBarPrivate::macUpdateMenuBarImmediatly(); -#endif -} - -bool QMenuBarPrivate::macUpdateMenuBarImmediatly() -{ - bool ret = false; - cancelAllMenuTracking(); - QWidget *w = findWindowThatShouldDisplayMenubar(); - QMenuBar *mb = findMenubarForWindow(w); - extern bool qt_mac_app_fullscreen; //qapplication_mac.mm - - // We need to see if we are in full screen mode, if so we need to - // switch the full screen mode to be able to show or hide the menubar. - if(w && mb) { - // This case means we are creating a menubar, check if full screen - if(w->isFullScreen()) { - // Ok, switch to showing the menubar when hovering over it. - SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar); - qt_mac_app_fullscreen = true; - } - } else if(w) { - // Removing a menubar - if(w->isFullScreen()) { - // Ok, switch to not showing the menubar when hovering on it - SetSystemUIMode(kUIModeAllHidden, 0); - qt_mac_app_fullscreen = true; - } - } - - if (mb && mb->isNativeMenuBar()) { - bool modal = QApplicationPrivate::modalState(); -#ifdef QT_MAC_USE_COCOA - QMacCocoaAutoReleasePool pool; -#endif - if (OSMenuRef menu = mb->macMenu()) { -#ifndef QT_MAC_USE_COCOA - SetRootMenu(menu); -#else - QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); - [loader ensureAppMenuInMenu:menu]; - [NSApp setMainMenu:menu]; - syncMenuBarItemsVisiblity(mb->d_func()->mac_menubar); - - if (OSMenuRef tmpMerge = QMenuPrivate::mergeMenuHash.value(menu)) { - if (QMenuMergeList *mergeList - = QMenuPrivate::mergeMenuItemsHash.value(tmpMerge)) { - const int mergeListSize = mergeList->size(); - - for (int i = 0; i < mergeListSize; ++i) { - const QMenuMergeItem &mergeItem = mergeList->at(i); - // Ideally we would call QMenuPrivate::syncAction, but that requires finding - // the original QMen and likely doing more work than we need. - // For example, enabled is handled below. - [mergeItem.menuItem setTag:reinterpret_cast( - static_cast(mergeItem.action->action))]; - [mergeItem.menuItem setHidden:!(mergeItem.action->action->isVisible())]; - } - } - } -#endif - // Check if menu is modally shaddowed and should be disabled: - modal = qt_mac_should_disable_menu(mb); - if (mb != qt_mac_current_menubar.qmenubar || modal != qt_mac_current_menubar.modal) - qt_mac_set_modal_state(menu, modal); - } - qt_mac_current_menubar.qmenubar = mb; - qt_mac_current_menubar.modal = modal; - ret = true; - } else if (qt_mac_current_menubar.qmenubar && qt_mac_current_menubar.qmenubar->isNativeMenuBar()) { - // INVARIANT: The currently active menu bar (if any) is not native. But we do have a - // native menu bar from before. So we need to decide whether or not is should be enabled: - const bool modal = qt_mac_should_disable_menu(qt_mac_current_menubar.qmenubar); - if (modal != qt_mac_current_menubar.modal) { - ret = true; - if (OSMenuRef menu = qt_mac_current_menubar.qmenubar->macMenu()) { -#ifndef QT_MAC_USE_COCOA - SetRootMenu(menu); -#else - QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); - [loader ensureAppMenuInMenu:menu]; - [NSApp setMainMenu:menu]; - syncMenuBarItemsVisiblity(qt_mac_current_menubar.qmenubar->d_func()->mac_menubar); -#endif - qt_mac_set_modal_state(menu, modal); - } - qt_mac_current_menubar.modal = modal; - } - } - - if (!ret) { - qt_mac_clear_menubar(); - } - return ret; -} - -QHash QMenuPrivate::mergeMenuHash; -QHash QMenuPrivate::mergeMenuItemsHash; - -bool QMenuPrivate::QMacMenuPrivate::merged(const QAction *action) const -{ -#ifndef QT_MAC_USE_COCOA - MenuRef merge = 0; - GetMenuItemProperty(menu, 0, kMenuCreatorQt, kMenuPropertyMergeMenu, - sizeof(merge), 0, &merge); - if (merge) { - QMenuMergeList *list = 0; - if (GetMenuItemProperty(merge, 0, kMenuCreatorQt, kMenuPropertyMergeList, - sizeof(list), 0, &list) == noErr && list) { - for(int i = 0; i < list->size(); ++i) { - QMenuMergeItem item = list->at(i); - if (item.action->action == action) - return true; - } - } - } -#else - if (OSMenuRef merge = mergeMenuHash.value(menu)) { - if (QMenuMergeList *list = mergeMenuItemsHash.value(merge)) { - for(int i = 0; i < list->size(); ++i) { - const QMenuMergeItem &item = list->at(i); - if (item.action->action == action) - return true; - } - } - } -#endif - return false; -} - -//creation of the OSMenuRef -static OSMenuRef qt_mac_create_menu(QWidget *w) -{ - OSMenuRef ret; -#ifndef QT_MAC_USE_COCOA - ret = 0; - if (CreateNewMenu(0, 0, &ret) == noErr) { - qt_mac_create_menu_event_handler(); - SetMenuItemProperty(ret, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(w), &w); - - // kEventMenuMatchKey is only sent to the menu itself and not to - // the application, install a separate handler for that event. - EventHandlerRef eventHandlerRef; - InstallMenuEventHandler(ret, qt_mac_menu_event, - GetEventTypeCount(menu_menu_events), - menu_menu_events, 0, &eventHandlerRef); - menu_eventHandlers_hash()->insert(ret, eventHandlerRef); - } else { - qWarning("QMenu: Internal error"); - } -#else - if (QMenu *qmenu = qobject_cast(w)){ - ret = [[QT_MANGLE_NAMESPACE(QCocoaMenu) alloc] initWithQMenu:qmenu]; - } else { - ret = [[NSMenu alloc] init]; - } -#endif - return ret; -} - - - -QT_END_NAMESPACE - diff --git a/src/gui/widgets/qmenubar.h b/src/gui/widgets/qmenubar.h deleted file mode 100644 index 48b0c05a7bc..00000000000 --- a/src/gui/widgets/qmenubar.h +++ /dev/null @@ -1,367 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMENUBAR_H -#define QMENUBAR_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_MENUBAR - -class QMenuBarPrivate; -class QStyleOptionMenuItem; -class QWindowsStyle; -#ifdef QT3_SUPPORT -class QMenuItem; -#endif - -class Q_GUI_EXPORT QMenuBar : public QWidget -{ - Q_OBJECT - - Q_PROPERTY(bool defaultUp READ isDefaultUp WRITE setDefaultUp) - Q_PROPERTY(bool nativeMenuBar READ isNativeMenuBar WRITE setNativeMenuBar) - -public: - explicit QMenuBar(QWidget *parent = 0); - ~QMenuBar(); - -#ifdef Q_NO_USING_KEYWORD - void addAction(QAction *action) { QWidget::addAction(action); } -#else - using QWidget::addAction; -#endif - QAction *addAction(const QString &text); - QAction *addAction(const QString &text, const QObject *receiver, const char* member); - - QAction *addMenu(QMenu *menu); - QMenu *addMenu(const QString &title); - QMenu *addMenu(const QIcon &icon, const QString &title); - - - QAction *addSeparator(); - QAction *insertSeparator(QAction *before); - - QAction *insertMenu(QAction *before, QMenu *menu); - - void clear(); - - QAction *activeAction() const; - void setActiveAction(QAction *action); - - void setDefaultUp(bool); - bool isDefaultUp() const; - - QSize sizeHint() const; - QSize minimumSizeHint() const; - int heightForWidth(int) const; - - QRect actionGeometry(QAction *) const; - QAction *actionAt(const QPoint &) const; - - void setCornerWidget(QWidget *w, Qt::Corner corner = Qt::TopRightCorner); - QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const; - -#ifdef Q_WS_MAC - OSMenuRef macMenu(); - static bool macUpdateMenuBar(); -#endif - -#ifdef Q_WS_WINCE - void setDefaultAction(QAction *); - QAction *defaultAction() const; - - static void wceCommands(uint command); - static void wceRefresh(); -#endif - - bool isNativeMenuBar() const; - void setNativeMenuBar(bool nativeMenuBar); - -public Q_SLOTS: - virtual void setVisible(bool visible); - -Q_SIGNALS: - void triggered(QAction *action); - void hovered(QAction *action); - -protected: - void changeEvent(QEvent *); - void keyPressEvent(QKeyEvent *); - void mouseReleaseEvent(QMouseEvent *); - void mousePressEvent(QMouseEvent *); - void mouseMoveEvent(QMouseEvent *); - void leaveEvent(QEvent *); - void paintEvent(QPaintEvent *); - void resizeEvent(QResizeEvent *); - void actionEvent(QActionEvent *); - void focusOutEvent(QFocusEvent *); - void focusInEvent(QFocusEvent *); - void timerEvent(QTimerEvent *); - bool eventFilter(QObject *, QEvent *); - bool event(QEvent *); - void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; - -#ifdef QT3_SUPPORT -public: - QT3_SUPPORT_CONSTRUCTOR QMenuBar(QWidget *parent, const char *name); - inline QT3_SUPPORT uint count() const { return actions().count(); } - inline QT3_SUPPORT int insertItem(const QString &text, const QObject *receiver, const char* member, - const QKeySequence& shortcut = 0, int id = -1, int index = -1) { - return insertAny(0, &text, receiver, member, &shortcut, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, - const QObject *receiver, const char* member, - const QKeySequence& shortcut = 0, int id = -1, int index = -1) { - return insertAny(&icon, &text, receiver, member, &shortcut, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, const QObject *receiver, const char* member, - const QKeySequence& shortcut = 0, int id = -1, int index = -1) { - QIcon icon(pixmap); - return insertAny(&icon, 0, receiver, member, &shortcut, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QString &text, int id=-1, int index=-1) { - return insertAny(0, &text, 0, 0, 0, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, int id=-1, int index=-1) { - return insertAny(&icon, &text, 0, 0, 0, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QString &text, QMenu *popup, int id=-1, int index=-1) { - return insertAny(0, &text, 0, 0, 0, popup, id, index); - } - inline QT3_SUPPORT int insertItem(const QIcon& icon, const QString &text, QMenu *popup, int id=-1, int index=-1) { - return insertAny(&icon, &text, 0, 0, 0, popup, id, index); - } - inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, int id=-1, int index=-1) { - QIcon icon(pixmap); - return insertAny(&icon, 0, 0, 0, 0, 0, id, index); - } - inline QT3_SUPPORT int insertItem(const QPixmap &pixmap, QMenu *popup, int id=-1, int index=-1) { - QIcon icon(pixmap); - return insertAny(&icon, 0, 0, 0, 0, popup, id, index); - } - QT3_SUPPORT int insertSeparator(int index=-1); - inline QT3_SUPPORT void removeItem(int id) { - if(QAction *act = findActionForId(id)) - removeAction(act); } - inline QT3_SUPPORT void removeItemAt(int index) { - if(QAction *act = actions().value(index)) - removeAction(act); } -#ifndef QT_NO_SHORTCUT - inline QT3_SUPPORT QKeySequence accel(int id) const { - if(QAction *act = findActionForId(id)) - return act->shortcut(); - return QKeySequence(); } - inline QT3_SUPPORT void setAccel(const QKeySequence& key, int id) { - if(QAction *act = findActionForId(id)) - act->setShortcut(key); - } -#endif - inline QT3_SUPPORT QIcon iconSet(int id) const { - if(QAction *act = findActionForId(id)) - return act->icon(); - return QIcon(); } - inline QT3_SUPPORT QString text(int id) const { - if(QAction *act = findActionForId(id)) - return act->text(); - return QString(); } - inline QT3_SUPPORT QPixmap pixmap(int id) const { - if(QAction *act = findActionForId(id)) - return act->icon().pixmap(QSize(22,22)); - return QPixmap(); } - inline QT3_SUPPORT void setWhatsThis(int id, const QString &w) { - if(QAction *act = findActionForId(id)) - act->setWhatsThis(w); } - inline QT3_SUPPORT QString whatsThis(int id) const { - if(QAction *act = findActionForId(id)) - return act->whatsThis(); - return QString(); } - - inline QT3_SUPPORT void changeItem(int id, const QString &text) { - if(QAction *act = findActionForId(id)) - act->setText(text); } - inline QT3_SUPPORT void changeItem(int id, const QPixmap &pixmap) { - if(QAction *act = findActionForId(id)) - act->setIcon(QIcon(pixmap)); } - inline QT3_SUPPORT void changeItem(int id, const QIcon &icon, const QString &text) { - if(QAction *act = findActionForId(id)) { - act->setIcon(icon); - act->setText(text); - } - } - inline QT3_SUPPORT bool isItemActive(int id) const { return findActionForId(id) == activeAction(); } - inline QT3_SUPPORT bool isItemEnabled(int id) const { - if(QAction *act = findActionForId(id)) - return act->isEnabled(); - return false; } - inline QT3_SUPPORT void setItemEnabled(int id, bool enable) { - if(QAction *act = findActionForId(id)) - act->setEnabled(enable); } - inline QT3_SUPPORT bool isItemChecked(int id) const { - if(QAction *act = findActionForId(id)) - return act->isChecked(); - return false; } - inline QT3_SUPPORT void setItemChecked(int id, bool check) { - if(QAction *act = findActionForId(id)) - act->setChecked(check); } - inline QT3_SUPPORT bool isItemVisible(int id) const { - if(QAction *act = findActionForId(id)) - return act->isVisible(); - return false; } - inline QT3_SUPPORT void setItemVisible(int id, bool visible) { - if(QAction *act = findActionForId(id)) - act->setVisible(visible); } - inline QT3_SUPPORT int indexOf(int id) const { return actions().indexOf(findActionForId(id)); } - inline QT3_SUPPORT int idAt(int index) const { - return index >= 0 && index < actions().size() - ? findIdForAction(actions().at(index)) - : -1; - } - inline QT3_SUPPORT void activateItemAt(int index) { - if(QAction *ret = actions().value(index)) - setActiveAction(ret); - } - inline QT3_SUPPORT bool connectItem(int id, const QObject *receiver, const char* member) { - if(QAction *act = findActionForId(id)) { - QObject::connect(act, SIGNAL(triggered()), receiver, member); - return true; - } - return false; - } - inline QT3_SUPPORT bool disconnectItem(int id,const QObject *receiver, const char* member) { - if(QAction *act = findActionForId(id)) { - QObject::disconnect(act, SIGNAL(triggered()), receiver, member); - return true; - } - return false; - } - inline QT3_SUPPORT QMenuItem *findItem(int id) const { - return (QMenuItem*)findActionForId(id); - } - QT3_SUPPORT bool setItemParameter(int id, int param); - QT3_SUPPORT int itemParameter(int id) const; - - //frame - QT3_SUPPORT int frameWidth() const; - - QT3_SUPPORT void setFrameRect(QRect) {} - QT3_SUPPORT QRect frameRect() const { return QRect(); } - enum DummyFrame { Box, Sunken, Plain, Raised, MShadow, NoFrame, Panel, StyledPanel, - HLine, VLine, GroupBoxPanel, WinPanel, ToolBarPanel, MenuBarPanel, - PopupPanel, LineEditPanel, TabWidgetPanel, MShape }; - QT3_SUPPORT void setFrameShadow(DummyFrame) {} - QT3_SUPPORT DummyFrame frameShadow() const { return Plain; } - QT3_SUPPORT void setFrameShape(DummyFrame) {} - QT3_SUPPORT DummyFrame frameShape() const { return NoFrame; } - QT3_SUPPORT void setFrameStyle(int) {} - QT3_SUPPORT int frameStyle() const { return 0; } - QT3_SUPPORT void setLineWidth(int) {} - QT3_SUPPORT int lineWidth() const { return 0; } - QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); } - QT3_SUPPORT int margin() const - { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; } - QT3_SUPPORT void setMidLineWidth(int) {} - QT3_SUPPORT int midLineWidth() const { return 0; } - - //menubar - enum Separator { Never=0, InWindowsStyle=1 }; - inline QT3_SUPPORT Separator separator() const { return InWindowsStyle; } - inline QT3_SUPPORT void setSeparator(Separator) { } - - QT3_SUPPORT void setAutoGeometry(bool); - QT3_SUPPORT bool autoGeometry() const; - -Q_SIGNALS: - QT_MOC_COMPAT void activated(int itemId); - QT_MOC_COMPAT void highlighted(int itemId); - -protected: - inline QT3_SUPPORT QRect itemRect(int index) { - if(QAction *act = actions().value(index)) - return actionGeometry(act); - return QRect(); - } - inline QT3_SUPPORT int itemAtPos(const QPoint &p) { - return findIdForAction(actionAt(p)); - } -private: - QAction *findActionForId(int id) const; - int insertAny(const QIcon *icon, const QString *text, const QObject *receiver, const char *member, - const QKeySequence *shorcut, const QMenu *popup, int id, int index); - int findIdForAction(QAction*) const; -#endif - -private: - Q_DECLARE_PRIVATE(QMenuBar) - Q_DISABLE_COPY(QMenuBar) - Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered()) - Q_PRIVATE_SLOT(d_func(), void _q_actionHovered()) - Q_PRIVATE_SLOT(d_func(), void _q_internalShortcutActivated(int)) - Q_PRIVATE_SLOT(d_func(), void _q_updateLayout()) - -#ifdef Q_WS_WINCE - Q_PRIVATE_SLOT(d_func(), void _q_updateDefaultAction()) -#endif - - friend class QMenu; - friend class QMenuPrivate; - friend class QWindowsStyle; - -#ifdef Q_WS_MAC - friend class QApplicationPrivate; - friend class QWidgetPrivate; - friend bool qt_mac_activate_action(MenuRef, uint, QAction::ActionEvent, bool); -#endif -}; - -#endif // QT_NO_MENUBAR - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMENUBAR_H diff --git a/src/gui/widgets/qmenubar_x11.cpp b/src/gui/widgets/qmenubar_x11.cpp deleted file mode 100644 index 25336d43780..00000000000 --- a/src/gui/widgets/qmenubar_x11.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmenubar_x11_p.h" - -#ifndef QT_NO_MENUBAR - -#include "qapplication.h" -#include "qdebug.h" -#include "qevent.h" -#include "qmenu.h" -#include "qmenubar.h" - -#include - -QT_BEGIN_NAMESPACE - -QX11MenuBar::~QX11MenuBar() -{ -} - -void QX11MenuBar::init(QMenuBar *_menuBar) -{ - nativeMenuBar = -1; - menuBar = _menuBar; -} - -void QX11MenuBar::setVisible(bool visible) -{ - menuBar->QWidget::setVisible(visible); -} - -void QX11MenuBar::actionEvent(QActionEvent *e) -{ - Q_UNUSED(e); -} - -void QX11MenuBar::handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow) -{ - Q_UNUSED(oldParent) - Q_UNUSED(newParent) - Q_UNUSED(oldWindow) - Q_UNUSED(newWindow) -} - -bool QX11MenuBar::allowCornerWidgets() const -{ - return true; -} - -void QX11MenuBar::popupAction(QAction *) -{ -} - -void QX11MenuBar::setNativeMenuBar(bool value) -{ - if (nativeMenuBar == -1 || (value != bool(nativeMenuBar))) { - nativeMenuBar = value; - } -} - -bool QX11MenuBar::isNativeMenuBar() const -{ - return false; -} - -bool QX11MenuBar::shortcutsHandledByNativeMenuBar() const -{ - return false; -} - -bool QX11MenuBar::menuBarEventFilter(QObject *, QEvent *) -{ - return false; -} - -struct QX11MenuBarFactory : public QPlatformMenuBarFactoryInterface -{ - QAbstractPlatformMenuBar *create() { return new QX11MenuBar; } - virtual QStringList keys() const { return QStringList(); } -}; - -QPlatformMenuBarFactoryInterface *qt_guiPlatformMenuBarFactory() -{ - static QPlatformMenuBarFactoryInterface *factory = 0; - if (!factory) { -#ifndef QT_NO_LIBRARY - QFactoryLoader loader(QPlatformMenuBarFactoryInterface_iid, QLatin1String("/menubar")); - factory = qobject_cast(loader.instance(QLatin1String("default"))); -#endif // QT_NO_LIBRARY - if(!factory) { - static QX11MenuBarFactory def; - factory = &def; - } - } - return factory; -} - -QT_END_NAMESPACE - -#endif // QT_NO_MENUBAR diff --git a/src/gui/widgets/qmenubar_x11_p.h b/src/gui/widgets/qmenubar_x11_p.h deleted file mode 100644 index 41debd062af..00000000000 --- a/src/gui/widgets/qmenubar_x11_p.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QX11MENUBAR_P_H -#define QX11MENUBAR_P_H - -#ifndef QT_NO_MENUBAR - -#include "qabstractplatformmenubar_p.h" - -QT_BEGIN_NAMESPACE - -class QMenuBar; - -class QX11MenuBar : public QAbstractPlatformMenuBar -{ -public: - ~QX11MenuBar(); - - virtual void init(QMenuBar *); - - virtual void setVisible(bool visible); - - virtual void actionEvent(QActionEvent *e); - - virtual void handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow); - - virtual bool allowCornerWidgets() const; - - virtual void popupAction(QAction*); - - virtual void setNativeMenuBar(bool); - virtual bool isNativeMenuBar() const; - - virtual bool shortcutsHandledByNativeMenuBar() const; - virtual bool menuBarEventFilter(QObject *, QEvent *event); - -private: - QMenuBar *menuBar; - int nativeMenuBar : 3; // Only has values -1, 0, and 1 -}; - -QPlatformMenuBarFactoryInterface *qt_guiPlatformMenuBarFactory(); - -QT_END_NAMESPACE - -#endif // QT_NO_MENUBAR - -#endif /* QX11MENUBAR_P_H */ diff --git a/src/modules/qt_gui.pri b/src/modules/qt_gui.pri index 0d1b2109f89..2dfbb4a604a 100644 --- a/src/modules/qt_gui.pri +++ b/src/modules/qt_gui.pri @@ -10,5 +10,6 @@ QT.gui.sources = $$QT_MODULE_BASE/src/gui QT.gui.libs = $$QT_MODULE_LIB_BASE QT.gui.plugins = $$QT_MODULE_PLUGIN_BASE QT.gui.imports = $$QT_MODULE_IMPORT_BASE -QT.gui.depends = core network +QT.gui.depends = core +QT.gui.CONFIG = opengl QT.gui.DEFINES = QT_GUI_LIB diff --git a/src/modules/qt_opengl.pri b/src/modules/qt_opengl.pri index 2cc9b8682c4..22476cf9495 100644 --- a/src/modules/qt_opengl.pri +++ b/src/modules/qt_opengl.pri @@ -11,6 +11,6 @@ QT.opengl.sources = $$QT_MODULE_BASE/src/opengl QT.opengl.libs = $$QT_MODULE_LIB_BASE QT.opengl.plugins = $$QT_MODULE_PLUGIN_BASE QT.opengl.imports = $$QT_MODULE_IMPORT_BASE -QT.opengl.depends = core gui +QT.opengl.depends = core gui widgets QT.opengl.CONFIG = opengl QT.opengl.DEFINES = QT_OPENGL_LIB diff --git a/src/modules/qt_openvg.pri b/src/modules/qt_openvg.pri deleted file mode 100644 index a773eb0cca1..00000000000 --- a/src/modules/qt_openvg.pri +++ /dev/null @@ -1,16 +0,0 @@ -QT.openvg.VERSION = 5.0.0 -QT.openvg.MAJOR_VERSION = 5 -QT.openvg.MINOR_VERSION = 0 -QT.openvg.PATCH_VERSION = 0 - -QT.openvg.name = QtOpenVG -QT.openvg.bins = $$QT_MODULE_BIN_BASE -QT.openvg.includes = $$QT_MODULE_INCLUDE_BASE/QtOpenVG -QT.openvg.private_includes = $$QT_MODULE_INCLUDE_BASE/QtOpenVG/$$QT.openvg.VERSION -QT.openvg.sources = $$QT_MODULE_BASE/src/openvg -QT.openvg.libs = $$QT_MODULE_LIB_BASE -QT.openvg.plugins = $$QT_MODULE_PLUGIN_BASE -QT.openvg.imports = $$QT_MODULE_IMPORT_BASE -QT.openvg.depends = core gui -QT.openvg.CONFIG = openvg -QT.openvg.DEFINES = QT_OPENVG_LIB diff --git a/src/modules/qt_platformsupport.pri b/src/modules/qt_platformsupport.pri new file mode 100644 index 00000000000..152f69b3e9e --- /dev/null +++ b/src/modules/qt_platformsupport.pri @@ -0,0 +1,15 @@ +QT.platformsupport.VERSION = 5.0.0 +QT.platformsupport.MAJOR_VERSION = 5 +QT.platformsupport.MINOR_VERSION = 0 +QT.platformsupport.PATCH_VERSION = 0 + +QT.platformsupport.name = QtPlatformSupport +QT.platformsupport.bins = $$QT_MODULE_BIN_BASE +QT.platformsupport.includes = $$QT_MODULE_INCLUDE_BASE/QtPlatformSupport +QT.platformsupport.private_includes = $$QT_MODULE_INCLUDE_BASE/QtPlatformSupport/$$QT.platformsupport.VERSION +QT.platformsupport.sources = $$QT_MODULE_BASE/src/platformsupport +QT.platformsupport.libs = $$QT_MODULE_LIB_BASE +QT.platformsupport.plugins = $$QT_MODULE_PLUGIN_BASE +QT.platformsupport.imports = $$QT_MODULE_IMPORT_BASE +QT.platformsupport.depends = core gui +QT.platformsupport.DEFINES = diff --git a/src/modules/qt_printsupport.pri b/src/modules/qt_printsupport.pri new file mode 100644 index 00000000000..898f8b82b61 --- /dev/null +++ b/src/modules/qt_printsupport.pri @@ -0,0 +1,16 @@ +QT.printsupport.VERSION = 5.0.0 +QT.printsupport.MAJOR_VERSION = 5 +QT.printsupport.MINOR_VERSION = 0 +QT.printsupport.PATCH_VERSION = 0 + +QT.printsupport.name = QtPrintSupport +QT.printsupport.includes = $$QT_MODULE_INCLUDE_BASE/QtPrintSupport +QT.printsupport.private_includes = $$QT_MODULE_INCLUDE_BASE/QtPrintSupport/$$QT.printsupport.VERSION +QT.printsupport.sources = $$QT_MODULE_BASE/src/printsupport +QT.printsupport.libs = $$QT_MODULE_LIB_BASE +QT.printsupport.plugins = $$QT_MODULE_PLUGIN_BASE +QT.printsupport.imports = $$QT_MODULE_IMPORT_BASE +QT.printsupport.depends = core gui widgets +QT.printsupport.DEFINES = QT_PRINTSUPPORT_LIB +# To be implemented: +win32: QT.printsupport.DEFINES *= QT_NO_PRINTER diff --git a/src/modules/qt_widgets.pri b/src/modules/qt_widgets.pri new file mode 100644 index 00000000000..95d2489cf9a --- /dev/null +++ b/src/modules/qt_widgets.pri @@ -0,0 +1,14 @@ +QT.widgets.VERSION = 5.0.0 +QT.widgets.MAJOR_VERSION = 5 +QT.widgets.MINOR_VERSION = 0 +QT.widgets.PATCH_VERSION = 0 + +QT.widgets.name = QtWidgets +QT.widgets.includes = $$QT_MODULE_INCLUDE_BASE/QtWidgets +QT.widgets.private_includes = $$QT_MODULE_INCLUDE_BASE/QtWidgets/$$QT.widgets.VERSION +QT.widgets.sources = $$QT_MODULE_BASE/src/widgets +QT.widgets.libs = $$QT_MODULE_LIB_BASE +QT.widgets.plugins = $$QT_MODULE_PLUGIN_BASE +QT.widgets.imports = $$QT_MODULE_IMPORT_BASE +QT.widgets.depends = core network gui +QT.widgets.DEFINES = QT_WIDGETS_LIB diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 4c50089f6d4..aebdce6e014 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -44,6 +44,8 @@ #include "qpaintengineex_opengl2_p.h" #include "qglshadercache_p.h" +#include + #if defined(QT_DEBUG) #include #endif @@ -52,18 +54,50 @@ QT_BEGIN_NAMESPACE +class QGLEngineSharedShadersResource : public QOpenGLSharedResource +{ +public: + QGLEngineSharedShadersResource(QOpenGLContext *ctx) + : QOpenGLSharedResource(ctx->shareGroup()) + , m_shaders(new QGLEngineSharedShaders(QGLContext::fromOpenGLContext(ctx))) + { + } + + ~QGLEngineSharedShadersResource() + { + delete m_shaders; + } + + void invalidateResource() + { + delete m_shaders; + m_shaders = 0; + } + + void freeResource(QOpenGLContext *) + { + } + + QGLEngineSharedShaders *shaders() const { return m_shaders; } + +private: + QGLEngineSharedShaders *m_shaders; +}; + class QGLShaderStorage { public: QGLEngineSharedShaders *shadersForThread(const QGLContext *context) { - QGLContextGroupResource *&shaders = m_storage.localData(); + QOpenGLMultiGroupSharedResource *&shaders = m_storage.localData(); if (!shaders) - shaders = new QGLContextGroupResource(); - return shaders->value(context); + shaders = new QOpenGLMultiGroupSharedResource; + QGLEngineSharedShadersResource *resource = + shaders->value(context->contextHandle()); + return resource ? resource->shaders() : 0; } private: - QThreadStorage *> m_storage; + QThreadStorage m_storage; }; Q_GLOBAL_STATIC(QGLShaderStorage, qt_shader_storage); @@ -81,8 +115,7 @@ const char* QGLEngineSharedShaders::qShaderSnippets[] = { }; QGLEngineSharedShaders::QGLEngineSharedShaders(const QGLContext* context) - : ctxGuard(context) - , blitShaderProg(0) + : blitShaderProg(0) , simpleShaderProg(0) { @@ -327,14 +360,14 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS vertexSource.append(qShaderSnippets[prog.mainVertexShader]); vertexSource.append(qShaderSnippets[prog.positionVertexShader]); - QScopedPointer shaderProgram(new QGLShaderProgram(ctxGuard.context(), 0)); + QScopedPointer shaderProgram(new QGLShaderProgram); CachedShader shaderCache(fragSource, vertexSource); - bool inCache = shaderCache.load(shaderProgram.data(), ctxGuard.context()); + bool inCache = shaderCache.load(shaderProgram.data(), QGLContext::currentContext()); if (!inCache) { - QScopedPointer fragShader(new QGLShader(QGLShader::Fragment, ctxGuard.context(), 0)); + QScopedPointer fragShader(new QGLShader(QGLShader::Fragment)); QByteArray description; #if defined(QT_DEBUG) // Name the shader for easier debugging @@ -357,7 +390,7 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS break; } - QScopedPointer vertexShader(new QGLShader(QGLShader::Vertex, ctxGuard.context(), 0)); + QScopedPointer vertexShader(new QGLShader(QGLShader::Vertex)); #if defined(QT_DEBUG) // Name the shader for easier debugging description.clear(); @@ -396,7 +429,7 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS newProg->program->link(); if (newProg->program->isLinked()) { if (!inCache) - shaderCache.store(newProg->program, ctxGuard.context()); + shaderCache.store(newProg->program, QGLContext::currentContext()); } else { QLatin1String none("none"); QLatin1String br("\n"); diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 921df369f4c..58c761df43e 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -365,7 +365,6 @@ public: void cleanupCustomStage(QGLCustomShaderStage* stage); private: - QGLSharedResourceGuard ctxGuard; QGLShaderProgram *blitShaderProg; QGLShaderProgram *simpleShaderProg; QList cachedPrograms; diff --git a/src/opengl/gl2paintengineex/qglgradientcache.cpp b/src/opengl/gl2paintengineex/qglgradientcache.cpp index 9e6b801c403..6ca09ba140b 100644 --- a/src/opengl/gl2paintengineex/qglgradientcache.cpp +++ b/src/opengl/gl2paintengineex/qglgradientcache.cpp @@ -51,21 +51,42 @@ class QGL2GradientCacheWrapper public: QGL2GradientCache *cacheForContext(const QGLContext *context) { QMutexLocker lock(&m_mutex); - return m_resource.value(context); + return m_resource.value(context->contextHandle()); } private: - QGLContextGroupResource m_resource; + QOpenGLMultiGroupSharedResource m_resource; QMutex m_mutex; }; Q_GLOBAL_STATIC(QGL2GradientCacheWrapper, qt_gradient_caches) +QGL2GradientCache::QGL2GradientCache(QOpenGLContext *ctx) + : QOpenGLSharedResource(ctx->shareGroup()) +{ +} + +QGL2GradientCache::~QGL2GradientCache() +{ + cache.clear(); +} + QGL2GradientCache *QGL2GradientCache::cacheForContext(const QGLContext *context) { return qt_gradient_caches()->cacheForContext(context); } +void QGL2GradientCache::invalidateResource() +{ + QMutexLocker lock(&m_mutex); + cache.clear(); +} + +void QGL2GradientCache::freeResource(QOpenGLContext *) +{ + cleanCache(); +} + void QGL2GradientCache::cleanCache() { QMutexLocker lock(&m_mutex); diff --git a/src/opengl/gl2paintengineex/qglgradientcache_p.h b/src/opengl/gl2paintengineex/qglgradientcache_p.h index 1c2d0a029a6..600085a75f2 100644 --- a/src/opengl/gl2paintengineex/qglgradientcache_p.h +++ b/src/opengl/gl2paintengineex/qglgradientcache_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -class QGL2GradientCache +class QGL2GradientCache : public QOpenGLSharedResource { struct CacheInfo { @@ -76,12 +76,15 @@ class QGL2GradientCache public: static QGL2GradientCache *cacheForContext(const QGLContext *context); - QGL2GradientCache(const QGLContext *) {} - ~QGL2GradientCache() { cleanCache(); } + QGL2GradientCache(QOpenGLContext *); + ~QGL2GradientCache(); GLuint getBuffer(const QGradient &gradient, qreal opacity); inline int paletteSize() const { return 1024; } + void invalidateResource(); + void freeResource(QOpenGLContext *ctx); + private: inline int maxCacheSize() const { return 60; } inline void generateGradientColorTable(const QGradient& gradient, diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index d2c63ddc101..e6a12cd40cc 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -76,10 +76,9 @@ #include #include #include -#include #include #include -#include +#include #include "qglengineshadermanager_p.h" #include "qgl2pexvertexarray_p.h" @@ -668,6 +667,7 @@ struct QGL2PEVectorPathCache int indexCount; GLenum primitiveType; qreal iscale; + QVertexIndexVector::Type indexType; }; void QGL2PaintEngineExPrivate::cleanupVectorPath(QPaintEngineEx *engine, void *data) @@ -825,13 +825,14 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) cache->indexCount = polys.indices.size(); cache->primitiveType = GL_TRIANGLES; cache->iscale = inverseScale; + cache->indexType = polys.indices.type(); #ifdef QT_OPENGL_CACHE_AS_VBOS glGenBuffers(1, &cache->vbo); glGenBuffers(1, &cache->ibo); glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); - if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) + if (polys.indices.type() == QVertexIndexVector::UnsignedInt) glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint32) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW); else glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint16) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW); @@ -842,7 +843,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW); #else cache->vertices = (float *) qMalloc(sizeof(float) * polys.vertices.size()); - if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) { + if (polys.indices.type() == QVertexIndexVector::UnsignedInt) { cache->indices = (quint32 *) qMalloc(sizeof(quint32) * polys.indices.size()); memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size()); } else { @@ -859,7 +860,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo); setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); - if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) + if (cache->indexType == QVertexIndexVector::UnsignedInt) glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0); else glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0); @@ -867,7 +868,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) glBindBuffer(GL_ARRAY_BUFFER, 0); #else setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); - if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) + if (cache->indexType == QVertexIndexVector::UnsignedInt) glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices); else glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices); @@ -896,7 +897,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) prepareForDraw(currentBrush.isOpaque()); setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertices.constData()); - if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) + if (polys.indices.type() == QVertexIndexVector::UnsignedInt) glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_INT, polys.indices.data()); else glDrawElements(GL_TRIANGLES, polys.indices.size(), GL_UNSIGNED_SHORT, polys.indices.data()); @@ -1581,10 +1582,9 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp QGLTextureGlyphCache *cache = (QGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(cacheKey, glyphType, QTransform()); - if (!cache || cache->cacheType() != glyphType || cache->context() == 0) { - cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform()); + if (!cache || cache->cacheType() != glyphType || cache->contextGroup() == 0) { + cache = new QGLTextureGlyphCache(glyphType, QTransform()); staticTextItem->fontEngine()->setGlyphCache(cacheKey, cache); - cache->insert(ctx, cache); recreateVertexArrays = true; } @@ -2048,21 +2048,13 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) bool QGL2PaintEngineEx::end() { Q_D(QGL2PaintEngineEx); - QGLContext *ctx = d->ctx; + QGLContext *ctx = d->ctx; glUseProgram(0); d->transferMode(BrushDrawingMode); d->device->endPaint(); -#if defined(Q_WS_X11) - // On some (probably all) drivers, deleting an X pixmap which has been bound to a texture - // before calling glFinish/swapBuffers renders garbage. Presumably this is because X deletes - // the pixmap behind the driver's back before it's had a chance to use it. To fix this, we - // reference all QPixmaps which have been bound to stop them being deleted and only deref - // them here, after swapBuffers, where they can be safely deleted. - ctx->d_func()->boundPixmaps.clear(); -#endif - d->ctx->d_ptr->active_engine = 0; + ctx->d_ptr->active_engine = 0; d->resetGLState(); @@ -2335,8 +2327,8 @@ void QGL2PaintEngineExPrivate::systemStateChanged() if (systemClip.isEmpty()) { useSystemClip = false; } else { - if (q->paintDevice()->devType() == QInternal::Widget && currentClipWidget) { - QWidgetPrivate *widgetPrivate = qt_widget_private(currentClipWidget->window()); + if (q->paintDevice()->devType() == QInternal::Widget && currentClipDevice) { + QWidgetPrivate *widgetPrivate = qt_widget_private(static_cast(currentClipDevice)->window()); useSystemClip = widgetPrivate->extra && widgetPrivate->extra->inRenderWithPainter; } else { useSystemClip = true; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 2895d5a9b0f..dbf760929ca 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -59,7 +59,6 @@ #include #include #include -#include #include #include #include @@ -153,8 +152,6 @@ public: void invalidateState(); - QPixmapFilter *pixmapFilter(int type, const QPixmapFilter *prototype); - void setRenderTextActive(bool); bool isNativePaintingActive() const; @@ -302,11 +299,6 @@ public: QTriangulatingStroker stroker; QDashedStrokeProcessor dasher; - QScopedPointer convolutionFilter; - QScopedPointer colorizeFilter; - QScopedPointer blurFilter; - QScopedPointer dropShadowFilter; - QSet pathCaches; QVector unusedVBOSToClean; QVector unusedIBOSToClean; diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index dbed354dfba..af6cb53a3a0 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -43,10 +43,6 @@ #include "qpaintengineex_opengl2_p.h" #include "private/qglengineshadersource_p.h" -#if defined QT_OPENGL_ES_2 && !defined(QT_NO_EGL) -#include "private/qeglcontext_p.h" -#endif - QT_BEGIN_NAMESPACE #ifdef Q_WS_WIN @@ -55,19 +51,16 @@ extern Q_GUI_EXPORT bool qt_cleartype_enabled; QBasicAtomicInt qgltextureglyphcache_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); -QGLTextureGlyphCache::QGLTextureGlyphCache(const QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix) - : QImageTextureGlyphCache(type, matrix), QGLContextGroupResourceBase() - , ctx(0) +QGLTextureGlyphCache::QGLTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix) + : QImageTextureGlyphCache(type, matrix) , pex(0) , m_blitProgram(0) , m_filterMode(Nearest) , m_serialNumber(qgltextureglyphcache_serial_number.fetchAndAddRelaxed(1)) { #ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG - qDebug(" -> QGLTextureGlyphCache() %p for context %p.", this, ctx); + qDebug(" -> QGLTextureGlyphCache() %p for context %p.", this, QOpenGLContext::currentContext()); #endif - setContext(context); - m_vertexCoordinateArray[0] = -1.0f; m_vertexCoordinateArray[1] = -1.0f; m_vertexCoordinateArray[2] = 1.0f; @@ -95,14 +88,9 @@ QGLTextureGlyphCache::~QGLTextureGlyphCache() delete m_blitProgram; } -void QGLTextureGlyphCache::setContext(const QGLContext *context) -{ - ctx = context; - m_h = 0; -} - void QGLTextureGlyphCache::createTextureData(int width, int height) { + QGLContext *ctx = const_cast(QGLContext::currentContext()); if (ctx == 0) { qWarning("QGLTextureGlyphCache::createTextureData: Called with no context"); return; @@ -120,12 +108,17 @@ void QGLTextureGlyphCache::createTextureData(int width, int height) if (height < 16) height = 16; - QGLGlyphTexture *glyphTexture = m_textureResource.value(ctx); - glGenTextures(1, &glyphTexture->m_texture); - glBindTexture(GL_TEXTURE_2D, glyphTexture->m_texture); + if (m_textureResource && !m_textureResource->m_texture) + delete m_textureResource; - glyphTexture->m_width = width; - glyphTexture->m_height = height; + if (!m_textureResource) + m_textureResource = new QGLGlyphTexture(ctx); + + glGenTextures(1, &m_textureResource->m_texture); + glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); + + m_textureResource->m_width = width; + m_textureResource->m_height = height; if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { QVarLengthArray data(width * height * 4); @@ -148,14 +141,14 @@ void QGLTextureGlyphCache::createTextureData(int width, int height) void QGLTextureGlyphCache::resizeTextureData(int width, int height) { + QGLContext *ctx = const_cast(QGLContext::currentContext()); if (ctx == 0) { qWarning("QGLTextureGlyphCache::resizeTextureData: Called with no context"); return; } - QGLGlyphTexture *glyphTexture = m_textureResource.value(ctx); - int oldWidth = glyphTexture->m_width; - int oldHeight = glyphTexture->m_height; + int oldWidth = m_textureResource->m_width; + int oldHeight = m_textureResource->m_height; // Make the lower glyph texture size 16 x 16. if (width < 16) @@ -163,7 +156,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) if (height < 16) height = 16; - GLuint oldTexture = glyphTexture->m_texture; + GLuint oldTexture = m_textureResource->m_texture; createTextureData(width, height); if (ctx->d_ptr->workaround_brokenFBOReadBack) { @@ -177,7 +170,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) // ### the QTextureGlyphCache API needs to be reworked to allow // ### resizeTextureData to fail - glBindFramebuffer(GL_FRAMEBUFFER_EXT, glyphTexture->m_fbo); + glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_textureResource->m_fbo); GLuint tmp_texture; glGenTextures(1, &tmp_texture); @@ -261,7 +254,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glBindTexture(GL_TEXTURE_2D, glyphTexture->m_texture); + glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight); @@ -280,16 +273,16 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) { + QGLContext *ctx = const_cast(QGLContext::currentContext()); if (ctx == 0) { qWarning("QGLTextureGlyphCache::fillTexture: Called with no context"); return; } - QGLGlyphTexture *glyphTexture = m_textureResource.value(ctx); if (ctx->d_ptr->workaround_brokenFBOReadBack) { QImageTextureGlyphCache::fillTexture(c, glyph, subPixelPosition); - glBindTexture(GL_TEXTURE_2D, glyphTexture->m_texture); + glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); const QImage &texture = image(); const uchar *bits = texture.constBits(); bits += c.y * texture.bytesPerLine() + c.x; @@ -326,7 +319,7 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed sub } } - glBindTexture(GL_TEXTURE_2D, glyphTexture->m_texture); + glBindTexture(GL_TEXTURE_2D, m_textureResource->m_texture); if (mask.format() == QImage::Format_RGB32) { glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits()); } else { @@ -362,6 +355,7 @@ int QGLTextureGlyphCache::glyphPadding() const int QGLTextureGlyphCache::maxTextureWidth() const { + QGLContext *ctx = const_cast(QGLContext::currentContext()); if (ctx == 0) return QImageTextureGlyphCache::maxTextureWidth(); else @@ -370,6 +364,7 @@ int QGLTextureGlyphCache::maxTextureWidth() const int QGLTextureGlyphCache::maxTextureHeight() const { + QGLContext *ctx = const_cast(QGLContext::currentContext()); if (ctx == 0) return QImageTextureGlyphCache::maxTextureHeight(); @@ -381,16 +376,15 @@ int QGLTextureGlyphCache::maxTextureHeight() const void QGLTextureGlyphCache::clear() { - if (ctx != 0) { - m_textureResource.cleanup(ctx); + m_textureResource->free(); + m_textureResource = 0; - m_w = 0; - m_h = 0; - m_cx = 0; - m_cy = 0; - m_currentRowHeight = 0; - coords.clear(); - } + m_w = 0; + m_h = 0; + m_cx = 0; + m_cy = 0; + m_currentRowHeight = 0; + coords.clear(); } QT_END_NAMESPACE diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h index 83ca06d0402..7b7da9d8e80 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h @@ -63,10 +63,11 @@ QT_BEGIN_NAMESPACE class QGL2PaintEngineExPrivate; -struct QGLGlyphTexture +struct QGLGlyphTexture : public QOpenGLSharedResource { QGLGlyphTexture(const QGLContext *ctx) - : m_width(0) + : QOpenGLSharedResource(ctx->contextHandle()->shareGroup()) + , m_width(0) , m_height(0) { if (ctx && !ctx->d_ptr->workaround_brokenFBOReadBack) @@ -77,19 +78,24 @@ struct QGLGlyphTexture #endif } - ~QGLGlyphTexture() { - const QGLContext *ctx = QGLContext::currentContext(); + void freeResource(QOpenGLContext *context) + { + const QGLContext *ctx = QGLContext::fromOpenGLContext(context); #ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG qDebug("~QGLGlyphTexture() %p for context %p.", this, ctx); #endif - // At this point, the context group is made current, so it's safe to - // release resources without a makeCurrent() call - if (ctx) { - if (!ctx->d_ptr->workaround_brokenFBOReadBack) - glDeleteFramebuffers(1, &m_fbo); - if (m_width || m_height) - glDeleteTextures(1, &m_texture); - } + if (!ctx->d_ptr->workaround_brokenFBOReadBack) + glDeleteFramebuffers(1, &m_fbo); + if (m_width || m_height) + glDeleteTextures(1, &m_texture); + } + + void invalidateResource() + { + m_texture = 0; + m_fbo = 0; + m_width = 0; + m_height = 0; } GLuint m_texture; @@ -98,10 +104,10 @@ struct QGLGlyphTexture int m_height; }; -class Q_OPENGL_EXPORT QGLTextureGlyphCache : public QImageTextureGlyphCache, public QGLContextGroupResourceBase +class Q_OPENGL_EXPORT QGLTextureGlyphCache : public QImageTextureGlyphCache { public: - QGLTextureGlyphCache(const QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix); + QGLTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix); ~QGLTextureGlyphCache(); virtual void createTextureData(int width, int height); @@ -113,25 +119,24 @@ public: inline GLuint texture() const { QGLTextureGlyphCache *that = const_cast(this); - QGLGlyphTexture *glyphTexture = that->m_textureResource.value(ctx); + QGLGlyphTexture *glyphTexture = that->m_textureResource; return glyphTexture ? glyphTexture->m_texture : 0; } inline int width() const { QGLTextureGlyphCache *that = const_cast(this); - QGLGlyphTexture *glyphTexture = that->m_textureResource.value(ctx); + QGLGlyphTexture *glyphTexture = that->m_textureResource; return glyphTexture ? glyphTexture->m_width : 0; } inline int height() const { QGLTextureGlyphCache *that = const_cast(this); - QGLGlyphTexture *glyphTexture = that->m_textureResource.value(ctx); + QGLGlyphTexture *glyphTexture = that->m_textureResource; return glyphTexture ? glyphTexture->m_height : 0; } inline void setPaintEnginePrivate(QGL2PaintEngineExPrivate *p) { pex = p; } - void setContext(const QGLContext *context); - inline const QGLContext *context() const { return ctx; } + inline const QOpenGLContextGroup *contextGroup() const { return m_textureResource ? m_textureResource->group() : 0; } inline int serialNumber() const { return m_serialNumber; } @@ -144,12 +149,9 @@ public: void clear(); - void freeResource(void *) { ctx = 0; } - private: - QGLContextGroupResource m_textureResource; + QGLGlyphTexture *m_textureResource; - const QGLContext *ctx; QGL2PaintEngineExPrivate *pex; QGLShaderProgram *m_blitProgram; FilterMode m_filterMode; diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index e2dc011532c..658cdd5eb40 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -2,7 +2,7 @@ load(qt_module) TARGET = QtOpenGL QPRO_PWD = $$PWD -QT = core-private gui-private +QT = core-private gui-private widgets-private CONFIG += module MODULE_PRI = ../modules/qt_opengl.pri @@ -19,7 +19,7 @@ load(qt_module_config) HEADERS += $$QT_SOURCE_TREE/src/opengl/qtopenglversion.h -!win32:!embedded:!mac:!symbian:!qpa: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 @@ -47,144 +47,32 @@ SOURCES += qgl.cpp \ qglpaintdevice.cpp \ qglbuffer.cpp \ +HEADERS += qglshaderprogram.h \ + qgraphicsshadereffect_p.h \ + gl2paintengineex/qglgradientcache_p.h \ + gl2paintengineex/qglengineshadermanager_p.h \ + gl2paintengineex/qgl2pexvertexarray_p.h \ + gl2paintengineex/qpaintengineex_opengl2_p.h \ + gl2paintengineex/qglengineshadersource_p.h \ + gl2paintengineex/qglcustomshaderstage_p.h \ + gl2paintengineex/qtriangulatingstroker_p.h \ + gl2paintengineex/qtextureglyphcache_gl_p.h \ + gl2paintengineex/qglshadercache_p.h \ + gl2paintengineex/qglshadercache_meego_p.h -!contains(QT_CONFIG, opengles2) { - HEADERS += qpaintengine_opengl_p.h - SOURCES += qpaintengine_opengl.cpp -} +SOURCES += qglshaderprogram.cpp \ + qgraphicsshadereffect.cpp \ + gl2paintengineex/qglgradientcache.cpp \ + gl2paintengineex/qglengineshadermanager.cpp \ + gl2paintengineex/qgl2pexvertexarray.cpp \ + gl2paintengineex/qpaintengineex_opengl2.cpp \ + gl2paintengineex/qglcustomshaderstage.cpp \ + gl2paintengineex/qtriangulatingstroker.cpp \ + gl2paintengineex/qtextureglyphcache_gl.cpp -!contains(QT_CONFIG, opengles1) { - HEADERS += qglshaderprogram.h \ - qglpixmapfilter_p.h \ - qgraphicsshadereffect_p.h \ - qgraphicssystem_gl_p.h \ - qwindowsurface_gl_p.h \ - qpixmapdata_gl_p.h \ - gl2paintengineex/qglgradientcache_p.h \ - gl2paintengineex/qglengineshadermanager_p.h \ - gl2paintengineex/qgl2pexvertexarray_p.h \ - gl2paintengineex/qpaintengineex_opengl2_p.h \ - gl2paintengineex/qglengineshadersource_p.h \ - gl2paintengineex/qglcustomshaderstage_p.h \ - gl2paintengineex/qtriangulatingstroker_p.h \ - gl2paintengineex/qtriangulator_p.h \ - gl2paintengineex/qrbtree_p.h \ - gl2paintengineex/qtextureglyphcache_gl_p.h \ - gl2paintengineex/qglshadercache_p.h \ - gl2paintengineex/qglshadercache_meego_p.h +SOURCES += qgl_qpa.cpp \ + qglpixelbuffer_stub.cpp - SOURCES += qglshaderprogram.cpp \ - qglpixmapfilter.cpp \ - qgraphicsshadereffect.cpp \ - qgraphicssystem_gl.cpp \ - qwindowsurface_gl.cpp \ - qpixmapdata_gl.cpp \ - gl2paintengineex/qglgradientcache.cpp \ - gl2paintengineex/qglengineshadermanager.cpp \ - gl2paintengineex/qgl2pexvertexarray.cpp \ - gl2paintengineex/qpaintengineex_opengl2.cpp \ - gl2paintengineex/qglcustomshaderstage.cpp \ - gl2paintengineex/qtriangulatingstroker.cpp \ - gl2paintengineex/qtriangulator.cpp \ - gl2paintengineex/qtextureglyphcache_gl.cpp - -} - -qpa { - SOURCES += qgl_qpa.cpp \ - qglpixelbuffer_stub.cpp -} - -x11 { - contains(QT_CONFIG, egl) { - SOURCES += qgl_x11egl.cpp \ - qglpixelbuffer_egl.cpp \ - qgl_egl.cpp \ - qpixmapdata_x11gl_egl.cpp \ - qwindowsurface_x11gl.cpp - - HEADERS += qgl_egl_p.h \ - qpixmapdata_x11gl_p.h \ - qwindowsurface_x11gl_p.h - - } else { - SOURCES += qgl_x11.cpp \ - qglpixelbuffer_x11.cpp - } - - contains(QT_CONFIG, fontconfig) { - contains(QT_CONFIG, system-freetype) { - embedded:CONFIG += opentype - # pull in the proper freetype2 include directory - include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) - LIBS_PRIVATE += -lfreetype - } else { - ### Note: how does this compile with a non-system freetype? - # This probably does not compile - } - } else { - DEFINES *= QT_NO_FREETYPE - } - - LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD -} - -mac:!qpa { - OBJECTIVE_SOURCES += qgl_mac.mm \ - qglpixelbuffer_mac.mm - LIBS_PRIVATE += -framework AppKit -framework Carbon -} -win32:!wince*: { - DEFINES += QT_NO_EGL - SOURCES += qgl_win.cpp \ - qglpixelbuffer_win.cpp -} -wince*: { - SOURCES += qgl_wince.cpp \ - qglpixelbuffer_egl.cpp \ - qgl_egl.cpp - - HEADERS += qgl_egl_p.h -} - -embedded { - SOURCES += qgl_qws.cpp \ - qglpixelbuffer_egl.cpp \ - qglscreen_qws.cpp \ - qglwindowsurface_qws.cpp \ - qgl_egl.cpp - - HEADERS += qglscreen_qws.h \ - qglwindowsurface_qws_p.h \ - qgl_egl_p.h - - contains(QT_CONFIG, fontconfig) { - include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) - } else { - DEFINES *= QT_NO_FREETYPE - } -} - -symbian { - DEFINES += QGL_USE_TEXTURE_POOL QGL_NO_PRESERVED_SWAP - SOURCES -= qpixmapdata_gl.cpp - SOURCES += qgl_symbian.cpp \ - qpixmapdata_poolgl.cpp \ - qglpixelbuffer_egl.cpp \ - qgl_egl.cpp \ - qgltexturepool.cpp - - HEADERS += qgl_egl_p.h \ - qgltexturepool_p.h - - contains(QT_CONFIG, freetype) { - DEFINES += QT_NO_FONTCONFIG - INCLUDEPATH += \ - ../3rdparty/freetype/src \ - ../3rdparty/freetype/include - } - - symbian:TARGET.UID3 = 0x2002131A -} +DEFINES += QT_NO_EGL INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index f1fb2b4e7f6..ad53b20098d 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -45,21 +45,6 @@ #include #include -#if defined(Q_WS_X11) -#include "private/qt_x11_p.h" -#include "private/qpixmap_x11_p.h" -#define INT32 dummy_INT32 -#define INT8 dummy_INT8 -#ifdef QT_NO_EGL -# include -#endif -#undef INT32 -#undef INT8 -#include "qx11info_x11.h" -#elif defined(Q_WS_MAC) -# include -#endif - #include #include // malloc @@ -68,29 +53,15 @@ #include "qimage.h" #include "qgl_p.h" -#if !defined(QT_OPENGL_ES_1) #include "gl2paintengineex/qpaintengineex_opengl2_p.h" -#include -#endif -#ifndef QT_OPENGL_ES_2 -#include -#endif - -#ifdef Q_WS_QWS -#include -#endif - -#ifdef Q_WS_QPA -#include -#endif +#include #include #include #include -#include -#include +#include #include #include #include "qcolormap.h" @@ -98,24 +69,11 @@ #include "qlibrary.h" #include -#if defined(QT_OPENGL_ES) && !defined(QT_NO_EGL) -#include -#endif -#ifdef QGL_USE_TEXTURE_POOL -#include -#endif - // #define QT_GL_CONTEXT_RESOURCE_DEBUG QT_BEGIN_NAMESPACE -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs; -#endif - -#ifdef Q_WS_X11 -extern const QX11Info *qt_x11Info(const QPaintDevice *pd); -#endif struct QGLThreadContext { ~QGLThreadContext() { @@ -125,10 +83,6 @@ struct QGLThreadContext { QGLContext *context; }; -#ifndef Q_WS_QPA -static QThreadStorage qgl_context_storage; -#endif - Q_GLOBAL_STATIC(QGLFormat, qgl_default_format) class QGLDefaultOverlayFormat: public QGLFormat @@ -155,71 +109,6 @@ QGLSignalProxy *QGLSignalProxy::instance() } -class QGLEngineSelector -{ -public: - QGLEngineSelector() : engineType(QPaintEngine::MaxUser) - { - } - - void setPreferredPaintEngine(QPaintEngine::Type type) { - if (type == QPaintEngine::OpenGL || type == QPaintEngine::OpenGL2) - engineType = type; - } - - QPaintEngine::Type preferredPaintEngine() { -#ifdef Q_WS_MAC - // The ATI X1600 driver for Mac OS X does not support return - // values from functions in GLSL. Since working around this in - // the GL2 engine would require a big, ugly rewrite, we're - // falling back to the GL 1 engine.. - static bool mac_x1600_check_done = false; - if (!mac_x1600_check_done) { - QGLTemporaryContext *tmp = 0; - if (!QGLContext::currentContext()) - tmp = new QGLTemporaryContext(); - if (strstr((char *) glGetString(GL_RENDERER), "X1600")) - engineType = QPaintEngine::OpenGL; - if (tmp) - delete tmp; - mac_x1600_check_done = true; - } -#endif - if (engineType == QPaintEngine::MaxUser) { - // No user-set engine - use the defaults -#if defined(QT_OPENGL_ES_2) - engineType = QPaintEngine::OpenGL2; -#else - // We can't do this in the constructor for this object because it - // needs to be called *before* the QApplication constructor. - // Also check for the FragmentShader extension in conjunction with - // the 2.0 version flag, to cover the case where we export the display - // from an old GL 1.1 server to a GL 2.x client. In that case we can't - // use GL 2.0. - if ((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) - && (QGLExtensions::glExtensions() & QGLExtensions::FragmentShader) - && qgetenv("QT_GL_USE_OPENGL1ENGINE").isEmpty()) - engineType = QPaintEngine::OpenGL2; - else - engineType = QPaintEngine::OpenGL; -#endif - } - return engineType; - } - -private: - QPaintEngine::Type engineType; -}; - -Q_GLOBAL_STATIC(QGLEngineSelector, qgl_engine_selector) - - -bool qt_gl_preferGL2Engine() -{ - return qgl_engine_selector()->preferredPaintEngine() == QPaintEngine::OpenGL2; -} - - /*! \namespace QGL \inmodule QtOpenGL @@ -266,32 +155,6 @@ bool qt_gl_preferGL2Engine() \sa {Sample Buffers Example} */ -/*! - \fn void QGL::setPreferredPaintEngine(QPaintEngine::Type engineType) - - \since 4.6 - - Sets the preferred OpenGL paint engine that is used to draw onto - QGLWidget, QGLPixelBuffer and QGLFramebufferObject targets with QPainter - in Qt. - - The \a engineType parameter specifies which of the GL engines to - use. Only \c QPaintEngine::OpenGL and \c QPaintEngine::OpenGL2 are - valid parameters to this function. All other values are ignored. - - By default, the \c QPaintEngine::OpenGL2 engine is used if GL/GLES - version 2.0 is available, otherwise \c QPaintEngine::OpenGL is - used. - - \warning This function must be called before the QApplication - constructor is called. -*/ -void QGL::setPreferredPaintEngine(QPaintEngine::Type engineType) -{ - qgl_engine_selector()->setPreferredPaintEngine(engineType); -} - - /***************************************************************************** QGLFormat implementation *****************************************************************************/ @@ -1613,42 +1476,16 @@ Q_GLOBAL_STATIC(QGLContextGroupList, qt_context_groups) *****************************************************************************/ QGLContextGroup::QGLContextGroup(const QGLContext *context) - : m_context(context), m_guards(0), m_refs(1) + : m_context(context), m_refs(1) { qt_context_groups()->append(this); } QGLContextGroup::~QGLContextGroup() { - // Clear any remaining QGLSharedResourceGuard objects on the group. - QGLSharedResourceGuard *guard = m_guards; - while (guard != 0) { - guard->m_group = 0; - guard->m_id = 0; - guard = guard->m_next; - } qt_context_groups()->remove(this); } -void QGLContextGroup::addGuard(QGLSharedResourceGuard *guard) -{ - if (m_guards) - m_guards->m_prev = guard; - guard->m_next = m_guards; - guard->m_prev = 0; - m_guards = guard; -} - -void QGLContextGroup::removeGuard(QGLSharedResourceGuard *guard) -{ - if (guard->m_next) - guard->m_next->m_prev = guard->m_prev; - if (guard->m_prev) - guard->m_prev->m_next = guard->m_next; - else - m_guards = guard->m_next; -} - const QGLContext *qt_gl_transfer_context(const QGLContext *ctx) { if (!ctx) @@ -1664,11 +1501,15 @@ const QGLContext *qt_gl_transfer_context(const QGLContext *ctx) QGLContextPrivate::QGLContextPrivate(QGLContext *context) : internal_context(false) , q_ptr(context) + , texture_destroyer(0) , functions(0) { group = new QGLContextGroup(context); - texture_destroyer = new QGLTextureDestroyer; - texture_destroyer->moveToThread(qApp->thread()); + + if (qApp) { + texture_destroyer = new QGLTextureDestroyer; + texture_destroyer->moveToThread(qApp->thread()); + } } QGLContextPrivate::~QGLContextPrivate() @@ -1689,35 +1530,9 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) glFormat = reqFormat = format; valid = false; q->setDevice(dev); -#if defined(Q_WS_X11) - pbuf = 0; - gpm = 0; - vi = 0; - screen = QX11Info::appScreen(); -#endif -#if defined(Q_WS_WIN) - dc = 0; - win = 0; - threadId = 0; - pixelFormatId = 0; - cmap = 0; - hbitmap = 0; - hbitmap_hdc = 0; -#endif -#if defined(Q_WS_MAC) -# ifndef QT_MAC_USE_COCOA - update = false; -# endif - vi = 0; -#endif -#if defined(Q_WS_QPA) - platformContext = 0; -#endif -#if !defined(QT_NO_EGL) - ownsEglContext = false; - eglContext = 0; - eglSurface = EGL_NO_SURFACE; -#endif + + guiGlContext = 0; + ownContext = false; fbo = 0; crWin = false; initDone = false; @@ -1795,7 +1610,7 @@ static void convertFromGLImage(QImage &img, int w, int h, bool alpha_format, boo img = img.mirrored(); } -Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha) +QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha) { QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); @@ -1811,7 +1626,7 @@ QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alp QImage img(size, alpha_format ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); int w = size.width(); int h = size.height(); -#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_ES_1) +#if !defined(QT_OPENGL_ES_2) //### glGetTexImage not in GL ES 2.0, need to do something else here! glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.bits()); #endif @@ -1845,15 +1660,15 @@ Q_GLOBAL_STATIC(QGLTextureCache, qt_gl_texture_cache) QGLTextureCache::QGLTextureCache() : m_cache(64*1024) // cache ~64 MB worth of textures - this is not accurate though { - QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(cleanupTexturesForPixampData); - QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(cleanupBeforePixmapDestruction); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapModificationHook(cleanupTexturesForPixampData); + QImagePixmapCleanupHooks::instance()->addPlatformPixmapDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->addImageHook(cleanupTexturesForCacheKey); } QGLTextureCache::~QGLTextureCache() { - QImagePixmapCleanupHooks::instance()->removePixmapDataModificationHook(cleanupTexturesForPixampData); - QImagePixmapCleanupHooks::instance()->removePixmapDataDestructionHook(cleanupBeforePixmapDestruction); + QImagePixmapCleanupHooks::instance()->removePlatformPixmapModificationHook(cleanupTexturesForPixampData); + QImagePixmapCleanupHooks::instance()->removePlatformPixmapDestructionHook(cleanupBeforePixmapDestruction); QImagePixmapCleanupHooks::instance()->removeImageHook(cleanupTexturesForCacheKey); } @@ -1912,22 +1727,15 @@ void QGLTextureCache::cleanupTexturesForCacheKey(qint64 cacheKey) } -void QGLTextureCache::cleanupTexturesForPixampData(QPixmapData* pmd) +void QGLTextureCache::cleanupTexturesForPixampData(QPlatformPixmap* pmd) { cleanupTexturesForCacheKey(pmd->cacheKey()); } -void QGLTextureCache::cleanupBeforePixmapDestruction(QPixmapData* pmd) +void QGLTextureCache::cleanupBeforePixmapDestruction(QPlatformPixmap* pmd) { // Remove any bound textures first: cleanupTexturesForPixampData(pmd); - -#if defined(Q_WS_X11) - if (pmd->classId() == QPixmapData::X11Class) { - Q_ASSERT(pmd->ref == 0); // Make sure reference counting isn't broken - QGLContextPrivate::destroyGlSurfaceForPixmap(pmd); - } -#endif } QGLTextureCache *QGLTextureCache::instance() @@ -2105,8 +1913,6 @@ QGLContext::~QGLContext() // clean up resources specific to this context d_ptr->cleanup(); - // clean up resources belonging to this context's group - d_ptr->group->cleanupResources(this); QGLSignalProxy::instance()->emitAboutToDestroyContext(this); reset(); @@ -2114,10 +1920,6 @@ QGLContext::~QGLContext() void QGLContextPrivate::cleanup() { - QHash::ConstIterator it; - for (it = m_resources.begin(); it != m_resources.end(); ++it) - it.key()->freeResource(it.value()); - m_resources.clear(); } #define ctx q_ptr @@ -2152,13 +1954,11 @@ void QGLContextPrivate::syncGlState() } #undef ctx -#ifdef QT_NO_EGL void QGLContextPrivate::swapRegion(const QRegion &) { Q_Q(QGLContext); q->swapBuffers(); } -#endif /*! \overload @@ -2303,12 +2103,10 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu } } -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) QGLExtensionFuncs& QGLContextPrivate::extensionFuncs(const QGLContext *) { return qt_extensionFuncs; } -#endif QImage QGLContextPrivate::convertToGLFormat(const QImage &image, bool force_premul, GLenum texture_format) @@ -2547,18 +2345,8 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #endif const QImage &constRef = img; // to avoid detach in bits()... -#ifdef QGL_USE_TEXTURE_POOL - QGLTexturePool::instance()->createPermanentTexture(tx_id, - target, - 0, internalFormat, - img.width(), img.height(), - externalFormat, - pixel_type, - constRef.bits()); -#else glTexImage2D(target, 0, internalFormat, img.width(), img.height(), 0, externalFormat, pixel_type, constRef.bits()); -#endif #if defined(QT_OPENGL_ES_2) if (genMipmap) glGenerateMipmap(target); @@ -2601,19 +2389,8 @@ QGLTexture *QGLContextPrivate::textureCacheLookup(const qint64 key, GLenum targe QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, QGLContext::BindOptions options) { Q_Q(QGLContext); - QPixmapData *pd = pixmap.pixmapData(); -#if !defined(QT_OPENGL_ES_1) - if (target == GL_TEXTURE_2D && pd->classId() == QPixmapData::OpenGLClass) { - const QGLPixmapData *data = static_cast(pd); - - if (data->isValidContext(q)) { - data->bind(); - return data->texture(); - } - } -#else + QPlatformPixmap *pd = pixmap.handle(); Q_UNUSED(pd); -#endif const qint64 key = pixmap.cacheKey(); QGLTexture *texture = textureCacheLookup(key, target); @@ -2628,39 +2405,6 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, } } -#if defined(Q_WS_X11) - // Try to use texture_from_pixmap - const QX11Info *xinfo = qt_x11Info(paintDevice); - if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType - && xinfo && xinfo->screen() == pixmap.x11Info().screen() - && target == GL_TEXTURE_2D - && QApplication::instance()->thread() == QThread::currentThread()) - { - if (!workaround_brokenTextureFromPixmap_init) { - workaround_brokenTextureFromPixmap_init = true; - - const QByteArray versionString(reinterpret_cast(glGetString(GL_VERSION))); - const int pos = versionString.indexOf("NVIDIA "); - - if (pos >= 0) { - const QByteArray nvidiaVersionString = versionString.mid(pos + strlen("NVIDIA ")); - - if (nvidiaVersionString.startsWith("195") || nvidiaVersionString.startsWith("256")) - workaround_brokenTextureFromPixmap = true; - } - } - - if (!workaround_brokenTextureFromPixmap) { - texture = bindTextureFromNativePixmap(const_cast(&pixmap), key, options); - if (texture) { - texture->options |= QGLContext::MemoryManagedBindOption; - texture->boundPixmap = pd; - boundPixmaps.insert(pd, QPixmap(pixmap)); - } - } - } -#endif - if (!texture) { QImage image = pixmap.toImage(); // If the system depth is 16 and the pixmap doesn't have an alpha channel @@ -2779,31 +2523,6 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, return texture->id; } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) -{ - if (image.isNull()) - return 0; - - Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), DefaultBindOption); - return texture->id; -} - -/*! \internal */ -GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, - BindOptions options) -{ - if (image.isNull()) - return 0; - - Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), options); - return texture->id; -} -#endif - /*! \overload Generates and binds a 2D GL texture based on \a pixmap. @@ -2835,30 +2554,6 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma return texture->id; } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format) -{ - if (pixmap.isNull()) - return 0; - - Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), DefaultBindOption); - return texture->id; -} -/*! \internal */ -GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format, - BindOptions options) -{ - if (pixmap.isNull()) - return 0; - - Q_D(QGLContext); - QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), options); - return texture->id; -} -#endif - /*! Removes the texture identified by \a id from the texture cache, and calls glDeleteTextures() to delete the texture from the @@ -2873,14 +2568,6 @@ void QGLContext::deleteTexture(GLuint id) glDeleteTextures(1, &id); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLContext::deleteTexture(QMacCompatGLuint id) -{ - return deleteTexture(GLuint(id)); -} -#endif - void qt_add_rect_to_array(const QRectF &r, GLfloat *array) { qreal left = r.left(); @@ -3020,14 +2707,6 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text #endif } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLContext::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) -{ - drawTexture(target, GLuint(textureId), GLenum(textureTarget)); -} -#endif - /*! \since 4.4 @@ -3091,15 +2770,6 @@ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum text #endif } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLContext::drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) -{ - drawTexture(point, GLuint(textureId), GLenum(textureTarget)); -} -#endif - - /*! This function sets the limit for the texture cache to \a size, expressed in kilobytes. @@ -3329,11 +2999,7 @@ bool QGLContext::areSharing(const QGLContext *context1, const QGLContext *contex bool QGLContext::create(const QGLContext* shareContext) { Q_D(QGLContext); -#ifdef Q_WS_QPA - if (!d->paintDevice && !d->platformContext) -#else - if (!d->paintDevice) -#endif + if (!d->paintDevice && !d->guiGlContext) return false; reset(); @@ -3342,10 +3008,6 @@ bool QGLContext::create(const QGLContext* shareContext) QWidgetPrivate *wd = qt_widget_private(static_cast(d->paintDevice)); wd->usesDoubleBufferedGLContext = d->glFormat.doubleBuffer(); } -#ifndef Q_WS_QPA //We do this in choose context->setupSharing() - if (d->sharing) // ok, we managed to share - QGLContextGroup::addShare(this, shareContext); -#endif return d->valid; } @@ -3419,37 +3081,15 @@ void QGLContext::setInitialized(bool on) const QGLContext* QGLContext::currentContext() { -#ifdef Q_WS_QPA - if (const QPlatformGLContext *threadContext = QPlatformGLContext::currentContext()) { - return QGLContext::fromPlatformGLContext(const_cast(threadContext)); + if (const QOpenGLContext *threadContext = QOpenGLContext::currentContext()) { + return QGLContext::fromOpenGLContext(const_cast(threadContext)); } return 0; -#else - QGLThreadContext *threadContext = qgl_context_storage.localData(); - if (threadContext) - return threadContext->context; - return 0; -#endif //Q_WS_QPA } void QGLContextPrivate::setCurrentContext(QGLContext *context) { -#ifdef Q_WS_QPA Q_UNUSED(context); -#else - QGLThreadContext *threadContext = qgl_context_storage.localData(); - if (!threadContext) { - if (!QThread::currentThread()) { - // We don't have a current QThread, so just set the static. - QGLContext::currentCtx = context; - return; - } - threadContext = new QGLThreadContext; - qgl_context_storage.setLocalData(threadContext); - } - threadContext->context = context; - QGLContext::currentCtx = context; // XXX: backwards-compat, not thread-safe -#endif } /*! @@ -3761,11 +3401,6 @@ void QGLContextPrivate::setCurrentContext(QGLContext *context) on a QGLWidget and the widget's rendering context is current in another thread, it will fail. - Note that under X11 it is necessary to set the - Qt::AA_X11InitThreads application attribute to make the X11 - library and GLX calls thread safe, otherwise the above scenarios - will fail. - In addition to this, rendering using raw GL calls in a separate thread is supported. @@ -3906,30 +3541,9 @@ QGLWidget::QGLWidget(QGLContext *context, QWidget *parent, const QGLWidget *shar QGLWidget::~QGLWidget() { Q_D(QGLWidget); -#if defined(GLX_MESA_release_buffers) && defined(QGL_USE_MESA_EXT) - bool doRelease = (glcx && glcx->windowCreated()); -#endif delete d->glcx; d->glcx = 0; -#if defined(Q_WS_WIN) - delete d->olcx; - d->olcx = 0; -#endif -#if defined(GLX_MESA_release_buffers) && defined(QGL_USE_MESA_EXT) - if (doRelease) - glXReleaseBuffersMESA(x11Display(), winId()); -#endif d->cleanupColormaps(); - -#ifdef Q_WS_MAC - QWidget *current = parentWidget(); - while (current) { - qt_widget_private(current)->glWidgets.removeAll(QWidgetPrivate::GlWidgetInfo(this)); - if (current->isWindow()) - break; - current = current->parentWidget(); - }; -#endif } /*! @@ -4275,125 +3889,6 @@ void QGLWidget::resizeOverlayGL(int, int) { } -/*! \fn bool QGLWidget::event(QEvent *e) - \reimp -*/ -#if !defined(Q_OS_WINCE) && !defined(Q_WS_QWS) && !defined(Q_WS_QPA) -bool QGLWidget::event(QEvent *e) -{ - Q_D(QGLWidget); - - if (e->type() == QEvent::Paint) { - QPoint offset; - QPaintDevice *redirectedDevice = d->redirected(&offset); - if (redirectedDevice && redirectedDevice->devType() == QInternal::Pixmap) { - d->restoreRedirected(); - QPixmap pixmap = renderPixmap(); - d->setRedirected(redirectedDevice, offset); - QPainter p(redirectedDevice); - p.drawPixmap(-offset, pixmap); - return true; - } - } - -#if defined(Q_WS_X11) - if (e->type() == QEvent::ParentChange) { - // if we've reparented a window that has the current context - // bound, we need to rebind that context to the new window id - if (d->glcx == QGLContext::currentContext()) - makeCurrent(); - - if (d->glcx->d_func()->screen != d->xinfo.screen() || testAttribute(Qt::WA_TranslucentBackground)) { - setContext(new QGLContext(d->glcx->requestedFormat(), this)); - // ### recreating the overlay isn't supported atm - } - } - -#ifndef QT_NO_EGL - // A re-parent is likely to destroy the X11 window and re-create it. It is important - // that we free the EGL surface _before_ the winID changes - otherwise we can leak. - if (e->type() == QEvent::ParentAboutToChange) - d->glcx->d_func()->destroyEglSurfaceForDevice(); - - if ((e->type() == QEvent::ParentChange) || (e->type() == QEvent::WindowStateChange)) { - // The window may have been re-created during re-parent or state change - if so, the EGL - // surface will need to be re-created. - d->recreateEglSurface(); - } -#endif -#elif defined(Q_WS_WIN) - if (e->type() == QEvent::ParentChange) { - QGLContext *newContext = new QGLContext(d->glcx->requestedFormat(), this); - setContext(newContext, d->glcx); - - // the overlay needs to be recreated as well - delete d->olcx; - if (isValid() && context()->format().hasOverlay()) { - d->olcx = new QGLContext(QGLFormat::defaultOverlayFormat(), this); - if (!d->olcx->create(isSharing() ? d->glcx : 0)) { - delete d->olcx; - d->olcx = 0; - d->glcx->d_func()->glFormat.setOverlay(false); - } - } else { - d->olcx = 0; - } - } else if (e->type() == QEvent::Show) { - if (!format().rgba()) - d->updateColormap(); - } -#elif defined(Q_WS_MAC) - if (e->type() == QEvent::MacGLWindowChange -#if 0 //(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) - && ((QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5 && isWindow()) - || QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4) -#endif - ) { - if (d->needWindowChange) { - d->needWindowChange = false; - d->glcx->updatePaintDevice(); - update(); - } - return true; -# if defined(QT_MAC_USE_COCOA) - } else if (e->type() == QEvent::MacGLClearDrawable) { - d->glcx->d_ptr->clearDrawable(); -# endif - } -#elif defined(Q_OS_SYMBIAN) - // prevents errors on some systems, where we get a flush to a - // hidden widget - if (e->type() == QEvent::Hide) { - makeCurrent(); - glFinish(); - doneCurrent(); - } else if (e->type() == QEvent::ParentChange) { - // if we've reparented a window that has the current context - // bound, we need to rebind that context to the new window id - if (d->glcx == QGLContext::currentContext()) - makeCurrent(); - - if (testAttribute(Qt::WA_TranslucentBackground)) - setContext(new QGLContext(d->glcx->requestedFormat(), this)); - } - - // A re-parent is likely to destroy the Symbian window and re-create it. It is important - // that we free the EGL surface _before_ the winID changes - otherwise we can leak. - if (e->type() == QEvent::ParentAboutToChange) - d->glcx->d_func()->destroyEglSurfaceForDevice(); - - if ((e->type() == QEvent::ParentChange) || (e->type() == QEvent::WindowStateChange)) { - // The window may have been re-created during re-parent or state change - if so, the EGL - // surface will need to be re-created. - d->recreateEglSurface(); - } - -#endif - - return QWidget::event(e); -} -#endif - /*! \fn void QGLWidget::paintEvent(QPaintEvent *event) @@ -4467,28 +3962,7 @@ QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext) if ((w > 0) && (h > 0)) sz = QSize(w, h); -#if defined(Q_WS_X11) - extern int qt_x11_preferred_pixmap_depth; - int old_depth = qt_x11_preferred_pixmap_depth; - qt_x11_preferred_pixmap_depth = x11Info().depth(); - - QPixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); - data->resize(sz.width(), sz.height()); - QPixmap pm(data); - qt_x11_preferred_pixmap_depth = old_depth; - QX11Info xinfo = x11Info(); - - // make sure we use a pixmap with the same depth/visual as the widget - if (xinfo.visual() != QX11Info::appVisual()) { - QX11InfoData* xd = pm.x11Info().getX11Data(true); - xd->depth = xinfo.depth(); - xd->visual = static_cast(xinfo.visual()); - const_cast(pm.x11Info()).setX11Data(xd); - } - -#else QPixmap pm(sz); -#endif d->glcx->doneCurrent(); @@ -4500,9 +3974,6 @@ QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext) QGLFormat fmt = d->glcx->requestedFormat(); fmt.setDirectRendering(false); // Direct is unlikely to work fmt.setDoubleBuffer(false); // We don't need dbl buf -#ifdef Q_WS_MAC // crash prevention on the Mac - it's unlikely to work anyway - fmt.setSampleBuffers(false); -#endif QGLContext* ocx = d->glcx; ocx->doneCurrent(); @@ -4520,13 +3991,6 @@ QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext) ocx->makeCurrent(); if (success) { -#if defined(Q_WS_X11) - if (xinfo.visual() != QX11Info::appVisual()) { - QImage image = pm.toImage(); - QPixmap p = QPixmap::fromImage(image); - return p; - } -#endif return pm; } return QPixmap(); @@ -4546,21 +4010,8 @@ QImage QGLWidget::grabFrameBuffer(bool withAlpha) QImage res; int w = width(); int h = height(); - if (format().rgba()) { + if (format().rgba()) res = qt_gl_read_framebuffer(QSize(w, h), format().alpha(), withAlpha); - } else { -#if defined (Q_WS_WIN) && !defined(QT_OPENGL_ES) - res = QImage(w, h, QImage::Format_Indexed8); - glReadPixels(0, 0, w, h, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, res.bits()); - const QVector pal = QColormap::instance().colormap(); - if (pal.size()) { - res.setColorCount(pal.size()); - for (int i = 0; i < pal.size(); i++) - res.setColor(i, pal.at(i).rgb()); - } - res = res.mirrored(); -#endif - } return res; } @@ -4595,11 +4046,6 @@ void QGLWidget::glDraw() Q_D(QGLWidget); if (!isValid()) return; -#ifdef Q_OS_SYMBIAN - // Crashes on Symbian if trying to render to invisible surfaces - if (!isVisible() && d->glcx->device()->devType() == QInternal::Widget) - return; -#endif makeCurrent(); #ifndef QT_OPENGL_ES if (d->glcx->deviceIsPixmap()) @@ -4918,18 +4364,13 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, int height = d->glcx->device()->height(); bool auto_swap = autoBufferSwap(); - QPaintEngine::Type oldEngineType = qgl_engine_selector()->preferredPaintEngine(); - QPaintEngine *engine = paintEngine(); - if (engine && (oldEngineType == QPaintEngine::OpenGL2) && engine->isActive()) { + if (engine && engine->isActive()) { qWarning("QGLWidget::renderText(): Calling renderText() while a GL 2 paint engine is" " active on the same device is not allowed."); return; } - // this changes what paintEngine() returns - qgl_engine_selector()->setPreferredPaintEngine(QPaintEngine::OpenGL); - engine = paintEngine(); QPainter *p; bool reuse_painter = false; if (engine->isActive()) { @@ -4973,7 +4414,6 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, setAutoBufferSwap(auto_swap); d->disable_clear_on_painter_begin = false; } - qgl_engine_selector()->setPreferredPaintEngine(oldEngineType); #else // QT_OPENGL_ES Q_UNUSED(x); Q_UNUSED(y); @@ -5021,18 +4461,14 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con &win_x, &win_y, &win_z); win_y = height - win_y; // y is inverted - QPaintEngine::Type oldEngineType = qgl_engine_selector()->preferredPaintEngine(); QPaintEngine *engine = paintEngine(); - if (engine && (oldEngineType == QPaintEngine::OpenGL2) && engine->isActive()) { + if (engine && engine->isActive()) { qWarning("QGLWidget::renderText(): Calling renderText() while a GL 2 paint engine is" " active on the same device is not allowed."); return; } - // this changes what paintEngine() returns - qgl_engine_selector()->setPreferredPaintEngine(QPaintEngine::OpenGL); - engine = paintEngine(); QPainter *p; bool reuse_painter = false; bool use_depth_testing = glIsEnabled(GL_DEPTH_TEST); @@ -5077,7 +4513,6 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con setAutoBufferSwap(auto_swap); d->disable_clear_on_painter_begin = false; } - qgl_engine_selector()->setPreferredPaintEngine(oldEngineType); #else // QT_OPENGL_ES Q_UNUSED(x); Q_UNUSED(y); @@ -5150,28 +4585,6 @@ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format) -{ - if (image.isNull()) - return 0; - - Q_D(QGLWidget); - return d->glcx->bindTexture(image, GLenum(target), GLint(format), QGLContext::DefaultBindOption); -} - -GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format, - QGLContext::BindOptions options) -{ - if (image.isNull()) - return 0; - - Q_D(QGLWidget); - return d->glcx->bindTexture(image, GLenum(target), GLint(format), options); -} -#endif - /*! Calls QGLContext:::bindTexture(\a pixmap, \a target, \a format) on the currently set context. @@ -5204,23 +4617,6 @@ GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format return d->glcx->bindTexture(pixmap, target, format, options); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -GLuint QGLWidget::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format) -{ - Q_D(QGLWidget); - return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption); -} - -GLuint QGLWidget::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format, - QGLContext::BindOptions options) -{ - Q_D(QGLWidget); - return d->glcx->bindTexture(pixmap, target, format, options); -} -#endif - - /*! \overload Calls QGLContext::bindTexture(\a fileName) on the currently set context. @@ -5245,15 +4641,6 @@ void QGLWidget::deleteTexture(GLuint id) d->glcx->deleteTexture(id); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLWidget::deleteTexture(QMacCompatGLuint id) -{ - Q_D(QGLWidget); - d->glcx->deleteTexture(GLuint(id)); -} -#endif - /*! \since 4.4 @@ -5267,15 +4654,6 @@ void QGLWidget::drawTexture(const QRectF &target, GLuint textureId, GLenum textu d->glcx->drawTexture(target, textureId, textureTarget); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLWidget::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) -{ - Q_D(QGLWidget); - d->glcx->drawTexture(target, GLint(textureId), GLenum(textureTarget)); -} -#endif - /*! \since 4.4 @@ -5289,42 +4667,17 @@ void QGLWidget::drawTexture(const QPointF &point, GLuint textureId, GLenum textu d->glcx->drawTexture(point, textureId, textureTarget); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLWidget::drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) -{ - Q_D(QGLWidget); - d->glcx->drawTexture(point, GLuint(textureId), GLenum(textureTarget)); -} -#endif - -#ifndef QT_OPENGL_ES_1 Q_GLOBAL_STATIC(QGLEngineThreadStorage, qt_gl_2_engine) -#endif -#ifndef QT_OPENGL_ES_2 -Q_GLOBAL_STATIC(QGLEngineThreadStorage, qt_gl_engine) -#endif - -Q_OPENGL_EXPORT QPaintEngine* qt_qgl_paint_engine() +QPaintEngine* qt_qgl_paint_engine() { -#if defined(QT_OPENGL_ES_1) - return qt_gl_engine()->engine(); -#elif defined(QT_OPENGL_ES_2) return qt_gl_2_engine()->engine(); -#else - if (qt_gl_preferGL2Engine()) - return qt_gl_2_engine()->engine(); - else - return qt_gl_engine()->engine(); -#endif } /*! \internal - Returns the GL widget's paint engine. This is normally a - QOpenGLPaintEngine. + Returns the GL widget's paint engine. */ QPaintEngine *QGLWidget::paintEngine() const { @@ -5492,10 +4845,6 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= GenerateMipmap; glExtensions |= FragmentShader; #endif -#if defined(QT_OPENGL_ES_1) - if (extensions.match("GL_OES_framebuffer_object")) - glExtensions |= FramebufferObject; -#endif #if defined(QT_OPENGL_ES) if (extensions.match("GL_OES_packed_depth_stencil")) glExtensions |= PackedDepthStencil; @@ -5588,32 +4937,24 @@ 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) || defined(Q_WS_QPA) Q_GLOBAL_STATIC(QString, qt_gl_lib_name) -Q_OPENGL_EXPORT void qt_set_gl_library_name(const QString& name) +void qt_set_gl_library_name(const QString& name) { qt_gl_lib_name()->operator=(name); } -Q_OPENGL_EXPORT const QString qt_gl_library_name() +const QString qt_gl_library_name() { if (qt_gl_lib_name()->isNull()) { -#ifdef Q_WS_MAC - return QLatin1String("/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"); -#else -# if defined(QT_OPENGL_ES_1) - return QLatin1String("GLES_CM"); -# elif defined(QT_OPENGL_ES_2) +# if defined(QT_OPENGL_ES_2) return QLatin1String("GLESv2"); # else return QLatin1String("GL"); # endif -#endif // defined Q_WS_MAC } return *qt_gl_lib_name(); } -#endif void QGLContextGroup::addShare(const QGLContext *context, const QGLContext *share) { Q_ASSERT(context && share); @@ -5653,108 +4994,6 @@ void QGLContextGroup::removeShare(const QGLContext *context) { group->m_shares.clear(); } -QGLContextGroupResourceBase::QGLContextGroupResourceBase() - : active(0) -{ -#ifdef QT_GL_CONTEXT_RESOURCE_DEBUG - qDebug("Creating context group resource object %p.", this); -#endif -} - -QGLContextGroupResourceBase::~QGLContextGroupResourceBase() -{ -#ifdef QT_GL_CONTEXT_RESOURCE_DEBUG - qDebug("Deleting context group resource %p. Group size: %d.", this, m_groups.size()); -#endif - for (int i = 0; i < m_groups.size(); ++i) { - m_groups.at(i)->m_resources.remove(this); - active.deref(); - } -#ifndef QT_NO_DEBUG - if (active != 0) { - qWarning("QtOpenGL: Resources are still available at program shutdown.\n" - " This is possibly caused by a leaked QGLWidget, \n" - " QGLFramebufferObject or QGLPixelBuffer."); - } -#endif -} - -void QGLContextGroupResourceBase::insert(const QGLContext *context, void *value) -{ -#ifdef QT_GL_CONTEXT_RESOURCE_DEBUG - qDebug("Inserting context group resource %p for context %p, managed by %p.", value, context, this); -#endif - QGLContextGroup *group = QGLContextPrivate::contextGroup(context); - Q_ASSERT(!group->m_resources.contains(this)); - group->m_resources.insert(this, value); - m_groups.append(group); - active.ref(); -} - -void *QGLContextGroupResourceBase::value(const QGLContext *context) -{ - QGLContextGroup *group = QGLContextPrivate::contextGroup(context); - return group->m_resources.value(this, 0); -} - -void QGLContextGroupResourceBase::cleanup(const QGLContext *ctx) -{ - void *resource = value(ctx); - - if (resource != 0) { - QGLShareContextScope scope(ctx); - freeResource(resource); - - QGLContextGroup *group = QGLContextPrivate::contextGroup(ctx); - group->m_resources.remove(this); - m_groups.removeOne(group); - active.deref(); - } -} - -void QGLContextGroupResourceBase::cleanup(const QGLContext *ctx, void *value) -{ -#ifdef QT_GL_CONTEXT_RESOURCE_DEBUG - qDebug("Cleaning up context group resource %p, for context %p in thread %p.", this, ctx, QThread::currentThread()); -#endif - QGLShareContextScope scope(ctx); - freeResource(value); - active.deref(); - - QGLContextGroup *group = QGLContextPrivate::contextGroup(ctx); - m_groups.removeOne(group); -} - -void QGLContextGroup::cleanupResources(const QGLContext *context) -{ - // If there are still shares, then no cleanup to be done yet. - if (m_shares.size() > 1) - return; - - // Iterate over all resources and free each in turn. - QHash::ConstIterator it; - for (it = m_resources.begin(); it != m_resources.end(); ++it) - it.key()->cleanup(context, it.value()); -} - -QGLSharedResourceGuard::~QGLSharedResourceGuard() -{ - if (m_group) - m_group->removeGuard(this); -} - -void QGLSharedResourceGuard::setContext(const QGLContext *context) -{ - if (m_group) - m_group->removeGuard(this); - if (context) { - m_group = QGLContextPrivate::contextGroup(context); - m_group->addGuard(this); - } else { - m_group = 0; - } -} - QSize QGLTexture::bindCompressedTexture (const QString& fileName, const char *format) { diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index f7685ed8b45..665dcac4124 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -42,34 +42,22 @@ #ifndef QGL_H #define QGL_H -#include +#include #include #include #include #include -#ifdef Q_WS_QPA -#include -#endif +#include QT_BEGIN_HEADER -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) # include #endif -#if defined(QT_OPENGL_ES_1) -# if defined(Q_OS_MAC) -# include -# else -# include -# endif -# ifndef GL_DOUBLE -# define GL_DOUBLE GL_FLOAT -# endif -# ifndef GLdouble -typedef GLfloat GLdouble; -# endif +#if defined(Q_OS_MAC) +# include #elif defined(QT_OPENGL_ES_2) # if defined(Q_OS_MAC) # include @@ -94,31 +82,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(OpenGL) -#if defined(Q_WS_MAC) && defined (QT_BUILD_OPENGL_LIB) && !defined(QT_MAC_USE_COCOA) && !defined(QDOC) -#define Q_MAC_COMPAT_GL_FUNCTIONS - -template -struct QMacGLCompatTypes -{ - typedef long CompatGLint; - typedef unsigned long CompatGLuint; - typedef unsigned long CompatGLenum; -}; - -template <> -struct QMacGLCompatTypes -{ - typedef int CompatGLint; - typedef unsigned int CompatGLuint; - typedef unsigned int CompatGLenum; -}; - -typedef QMacGLCompatTypes::CompatGLint QMacCompatGLint; -typedef QMacGLCompatTypes::CompatGLuint QMacCompatGLuint; -typedef QMacGLCompatTypes::CompatGLenum QMacCompatGLenum; - -#endif - #ifdef QT3_SUPPORT #define QGL_VERSION 460 #define QGL_VERSION_STR "4.6" @@ -132,17 +95,12 @@ class QGLCmap; #endif class QPixmap; -#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES) -class QGLOverlayWidget; -#endif class QGLWidgetPrivate; class QGLContextPrivate; // Namespace class: namespace QGL { - Q_OPENGL_EXPORT void setPreferredPaintEngine(QPaintEngine::Type engineType); - enum FormatOption { DoubleBuffer = 0x0001, DepthBuffer = 0x0002, @@ -284,10 +242,8 @@ public: static OpenGLVersionFlags openGLVersionFlags(); -#if defined(Q_WS_QPA) - static QGLFormat fromPlatformWindowFormat(const QPlatformWindowFormat &format); - static QPlatformWindowFormat toPlatformWindowFormat(const QGLFormat &format); -#endif + static QGLFormat fromSurfaceFormat(const QSurfaceFormat &format); + static QSurfaceFormat toSurfaceFormat(const QGLFormat &format); private: QGLFormatPrivate *d; @@ -373,22 +329,6 @@ public: void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS - GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D, - QMacCompatGLint format = GL_RGBA); - GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, - QMacCompatGLint format = GL_RGBA); - GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, - BindOptions); - GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, - BindOptions); - - void deleteTexture(QMacCompatGLuint tx_id); - - void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); - void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); -#endif - static void setTextureCacheLimit(int size); static int textureCacheLimit(); @@ -398,23 +338,12 @@ public: static const QGLContext* currentContext(); -#ifdef Q_WS_QPA - static QGLContext *fromPlatformGLContext(QPlatformGLContext *platformContext); -#endif + static QGLContext *fromOpenGLContext(QOpenGLContext *platformContext); + QOpenGLContext *contextHandle() const; + protected: virtual bool chooseContext(const QGLContext* shareContext = 0); -#if defined(Q_WS_WIN) - virtual int choosePixelFormat(void* pfd, HDC pdc); -#endif -#if defined(Q_WS_X11) - virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1); - virtual void* chooseVisual(); -#endif -#if defined(Q_WS_MAC) - virtual void* chooseMacVisual(GDHandle); -#endif - bool deviceIsPixmap() const; bool windowCreated() const; void setWindowCreated(bool on); @@ -430,9 +359,7 @@ protected: static QGLContext* currentCtx; private: -#ifdef Q_WS_QPA - QGLContext(QPlatformGLContext *platformContext); -#endif + QGLContext(QOpenGLContext *windowContext); QScopedPointer d_ptr; @@ -441,18 +368,12 @@ private: friend class QGLWidget; friend class QGLWidgetPrivate; friend class QGLGlyphCache; - friend class QOpenGLPaintEngine; - friend class QOpenGLPaintEnginePrivate; friend class QGL2PaintEngineEx; friend class QGL2PaintEngineExPrivate; friend class QGLEngineShaderManager; - friend class QGLWindowSurface; - friend class QGLPixmapData; - friend class QGLPixmapFilterBase; friend class QGLTextureGlyphCache; friend struct QGLGlyphTexture; friend class QGLContextGroup; - friend class QGLSharedResourceGuard; friend class QGLPixmapBlurFilter; friend class QGLExtensions; friend class QGLTexture; @@ -469,7 +390,6 @@ private: friend class QGLFBOGLPaintDevice; friend class QGLPaintDevice; friend class QGLWidgetGLPaintDevice; - friend class QX11GLPixmapData; friend class QX11GLSharedContexts; friend class QGLContextResourceBase; friend class QSGDistanceFieldGlyphCache; @@ -556,22 +476,6 @@ public: void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS - GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D, - QMacCompatGLint format = GL_RGBA); - GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, - QMacCompatGLint format = GL_RGBA); - GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, - QGLContext::BindOptions); - GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, - QGLContext::BindOptions); - - void deleteTexture(QMacCompatGLuint tx_id); - - void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); - void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); -#endif - public Q_SLOTS: virtual void updateGL(); virtual void updateOverlayGL(); @@ -613,7 +517,6 @@ private: friend class QGLContext; friend class QGLContextPrivate; friend class QGLOverlayWidget; - friend class QOpenGLPaintEngine; friend class QGLPaintDevice; friend class QGLWidgetGLPaintDevice; }; diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp deleted file mode 100644 index 4de5122a866..00000000000 --- a/src/opengl/qgl_egl.cpp +++ /dev/null @@ -1,351 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include "qgl_p.h" -#include "qgl_egl_p.h" -#include "qglpixelbuffer_p.h" - -#ifdef Q_WS_X11 -#include -#endif - -QT_BEGIN_NAMESPACE - -QEglProperties *QGLContextPrivate::extraWindowSurfaceCreationProps = NULL; - -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 available. 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); - 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 - format.setDoubleBuffer(true); // We don't support single buffered EGL contexts - - // 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(); -} - -bool QGLFormat::hasOpenGL() -{ - return true; -} - -void QGLContext::reset() -{ - Q_D(QGLContext); - if (!d->valid) - return; - d->cleanup(); - doneCurrent(); - if (d->eglContext && d->ownsEglContext) { - d->destroyEglSurfaceForDevice(); - delete d->eglContext; - } - d->ownsEglContext = false; - d->eglContext = 0; - d->eglSurface = EGL_NO_SURFACE; - d->crWin = false; - d->sharing = false; - d->valid = false; - d->transpColor = QColor(); - d->initDone = false; - QGLContextGroup::removeShare(this); -} - -void QGLContext::makeCurrent() -{ - Q_D(QGLContext); - if (!d->valid || !d->eglContext || d->eglSurfaceForDevice() == EGL_NO_SURFACE) { - qWarning("QGLContext::makeCurrent(): Cannot make invalid context current"); - return; - } - - if (d->eglContext->makeCurrent(d->eglSurfaceForDevice())) { - QGLContextPrivate::setCurrentContext(this); - if (!d->workaroundsCached) { - d->workaroundsCached = true; - const char *renderer = reinterpret_cast(glGetString(GL_RENDERER)); - if (renderer && (strstr(renderer, "SGX") || strstr(renderer, "MBX"))) { - // PowerVR MBX/SGX chips needs to clear all buffers when starting to render - // a new frame, otherwise there will be a performance penalty to pay for - // each frame. - qDebug() << "Found SGX/MBX driver, enabling FullClearOnEveryFrame"; - d->workaround_needsFullClearOnEveryFrame = true; - - // Older PowerVR SGX drivers (like the one in the N900) have a - // bug which prevents glCopyTexSubImage2D() to work with a POT - // or GL_ALPHA texture bound to an FBO. The only way to - // identify that driver is to check the EGL version number for it. - const char *egl_version = eglQueryString(d->eglContext->display(), EGL_VERSION); - - if (egl_version && strstr(egl_version, "1.3")) { - qDebug() << "Found v1.3 driver, enabling brokenFBOReadBack"; - d->workaround_brokenFBOReadBack = true; - } else if (egl_version && strstr(egl_version, "1.4")) { - qDebug() << "Found v1.4 driver, enabling brokenTexSubImage"; - d->workaround_brokenTexSubImage = true; - - // this is a bit complicated; 1.4 version SGX drivers from - // Nokia have fixed the brokenFBOReadBack problem, but - // official drivers from TI haven't, meaning that things - // like the beagleboard are broken unless we hack around it - // - but at the same time, we want to not reduce performance - // by not enabling this elsewhere. - // - // so, let's check for a Nokia-specific addon, and only - // enable if it isn't present. - // (see MeeGo bug #5616) - if (!QEgl::hasExtension("EGL_NOK_image_shared")) { - // no Nokia extension, this is probably a standard SGX - // driver, so enable the workaround - qDebug() << "Found non-Nokia v1.4 driver, enabling brokenFBOReadBack"; - d->workaround_brokenFBOReadBack = true; - } - } - } - } - } -} - -void QGLContext::doneCurrent() -{ - Q_D(QGLContext); - if (d->eglContext) - d->eglContext->doneCurrent(); - - QGLContextPrivate::setCurrentContext(0); -} - - -void QGLContext::swapBuffers() const -{ - Q_D(const QGLContext); - if (!d->valid || !d->eglContext) - return; - - d->eglContext->swapBuffers(d->eglSurfaceForDevice()); -} - -void QGLContextPrivate::destroyEglSurfaceForDevice() -{ - if (eglSurface != EGL_NO_SURFACE) { -#if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN) - // Make sure we don't call eglDestroySurface on a surface which - // was created for a different winId. This applies only to QGLWidget - // paint device, so make sure this is the one we're operating on - // (as opposed to a QGLWindowSurface use case). - if (paintDevice && paintDevice->devType() == QInternal::Widget) { - QWidget *w = static_cast(paintDevice); - if (QGLWidget *wgl = qobject_cast(w)) { - if (wgl->d_func()->eglSurfaceWindowId != wgl->winId()) { - qWarning("WARNING: Potential EGL surface leak! Not destroying surface."); - eglSurface = EGL_NO_SURFACE; - return; - } - } - } -#endif - eglDestroySurface(eglContext->display(), eglSurface); - eglSurface = EGL_NO_SURFACE; - } -} - -EGLSurface QGLContextPrivate::eglSurfaceForDevice() const -{ - // If a QPixmapData had to create the QGLContext, we don't have a paintDevice - if (!paintDevice) - return eglSurface; - -#ifdef Q_WS_X11 - if (paintDevice->devType() == QInternal::Pixmap) { - QPixmapData *pmd = static_cast(paintDevice)->data_ptr().data(); - if (pmd->classId() == QPixmapData::X11Class) { - QX11PixmapData* x11PixmapData = static_cast(pmd); - return (EGLSurface)x11PixmapData->gl_surface; - } - } -#endif - - if (paintDevice->devType() == QInternal::Pbuffer) { - QGLPixelBuffer* pbuf = static_cast(paintDevice); - return pbuf->d_func()->pbuf; - } - - return eglSurface; -} - -void QGLContextPrivate::swapRegion(const QRegion ®ion) -{ - if (!valid || !eglContext) - return; - - eglContext->swapBuffersRegion2NOK(eglSurfaceForDevice(), ®ion); -} - -void QGLContextPrivate::setExtraWindowSurfaceCreationProps(QEglProperties *props) -{ - extraWindowSurfaceCreationProps = props; -} - -void QGLWidget::setMouseTracking(bool enable) -{ - QWidget::setMouseTracking(enable); -} - -QColor QGLContext::overlayTransparentColor() const -{ - return d_func()->transpColor; -} - -uint QGLContext::colorIndex(const QColor &c) const -{ - Q_UNUSED(c); - return 0; -} - -void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) -{ - Q_UNUSED(fnt); - Q_UNUSED(listBase); -} - -void *QGLContext::getProcAddress(const QString &proc) const -{ - return (void*)eglGetProcAddress(reinterpret_cast(proc.toLatin1().data())); -} - -bool QGLWidgetPrivate::renderCxPm(QPixmap*) -{ - return false; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qgl_egl_p.h b/src/opengl/qgl_egl_p.h deleted file mode 100644 index 2522fca822f..00000000000 --- a/src/opengl/qgl_egl_p.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGL_EGL_P_H -#define QGL_EGL_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 QGLWidget class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QGLFormat; - -void qt_eglproperties_set_glformat(QEglProperties& props, const QGLFormat& format); -void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config); - -QT_END_NAMESPACE - -#endif // QGL_EGL_P_H diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm deleted file mode 100644 index d4b2a40e93c..00000000000 --- a/src/opengl/qgl_mac.mm +++ /dev/null @@ -1,996 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgl.h" - -// There are functions that are deprecated in 10.5, but really there's no way around them -// for Carbon, so just undefine them. -#undef DEPRECATED_ATTRIBUTE -#define DEPRECATED_ATTRIBUTE -#if defined(Q_WS_MAC) -#ifndef QT_MAC_USE_COCOA -#ifdef qDebug -# undef qDebug -# include -# include -# include -# ifdef QT_NO_DEBUG -# define qDebug qt_noop(),1?(void)0:qDebug -# endif -#else -# include -# include -# include -#endif -#else -#include -#endif - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE -#ifdef QT_MAC_USE_COCOA -QT_END_NAMESPACE - -QT_FORWARD_DECLARE_CLASS(QWidget) -QT_FORWARD_DECLARE_CLASS(QWidgetPrivate) -QT_FORWARD_DECLARE_CLASS(QGLWidgetPrivate) - -QT_BEGIN_NAMESPACE - -void *qt_current_nsopengl_context() -{ - return [NSOpenGLContext currentContext]; -} - -static GLint attribValue(NSOpenGLPixelFormat *fmt, NSOpenGLPixelFormatAttribute attrib) -{ - GLint res; - [fmt getValues:&res forAttribute:attrib forVirtualScreen:0]; - return res; -} - -static int def(int val, int defVal) -{ - return val != -1 ? val : defVal; -} -#else -QRegion qt_mac_get_widget_rgn(const QWidget *widget); -#endif - -extern quint32 *qt_mac_pixmap_get_base(const QPixmap *); -extern int qt_mac_pixmap_get_bytes_per_line(const QPixmap *); -extern RgnHandle qt_mac_get_rgn(); //qregion_mac.cpp -extern void qt_mac_dispose_rgn(RgnHandle); //qregion_mac.cpp -extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp -extern void qt_mac_to_pascal_string(QString s, Str255 str, TextEncoding encoding=0, int len=-1); //qglobal.cpp - -/* - QGLTemporaryContext implementation -*/ - -class QGLTemporaryContextPrivate -{ -public: -#ifndef QT_MAC_USE_COCOA - AGLContext ctx; -#else - NSOpenGLContext *ctx; -#endif -}; - -QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) - : d(new QGLTemporaryContextPrivate) -{ - d->ctx = 0; -#ifndef QT_MAC_USE_COCOA - GLint attribs[] = {AGL_RGBA, AGL_NONE}; - AGLPixelFormat fmt = aglChoosePixelFormat(0, 0, attribs); - if (!fmt) { - qDebug("QGLTemporaryContext: Couldn't find any RGB visuals"); - return; - } - d->ctx = aglCreateContext(fmt, 0); - if (!d->ctx) - qDebug("QGLTemporaryContext: Unable to create context"); - else - aglSetCurrentContext(d->ctx); - aglDestroyPixelFormat(fmt); -#else - QMacCocoaAutoReleasePool pool; - NSOpenGLPixelFormatAttribute attribs[] = { 0 }; - NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; - if (!fmt) { - qWarning("QGLTemporaryContext: Cannot find any visuals"); - return; - } - - d->ctx = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:0]; - if (!d->ctx) - qWarning("QGLTemporaryContext: Cannot create context"); - else - [d->ctx makeCurrentContext]; - [fmt release]; -#endif -} - -QGLTemporaryContext::~QGLTemporaryContext() -{ - if (d->ctx) { -#ifndef QT_MAC_USE_COCOA - aglSetCurrentContext(0); - aglDestroyContext(d->ctx); -#else - [NSOpenGLContext clearCurrentContext]; - [d->ctx release]; -#endif - } -} - -bool QGLFormat::hasOpenGL() -{ - return true; -} - -bool QGLFormat::hasOpenGLOverlays() -{ - return false; -} - -bool QGLContext::chooseContext(const QGLContext *shareContext) -{ - QMacCocoaAutoReleasePool pool; - Q_D(QGLContext); - d->cx = 0; - d->vi = chooseMacVisual(0); - if (!d->vi) - return false; - -#ifndef QT_MAC_USE_COCOA - AGLPixelFormat fmt = (AGLPixelFormat)d->vi; - GLint res; - aglDescribePixelFormat(fmt, AGL_LEVEL, &res); - d->glFormat.setPlane(res); - if (deviceIsPixmap()) - res = 0; - else - aglDescribePixelFormat(fmt, AGL_DOUBLEBUFFER, &res); - d->glFormat.setDoubleBuffer(res); - aglDescribePixelFormat(fmt, AGL_DEPTH_SIZE, &res); - d->glFormat.setDepth(res); - if (d->glFormat.depth()) - d->glFormat.setDepthBufferSize(res); - aglDescribePixelFormat(fmt, AGL_RGBA, &res); - d->glFormat.setRgba(res); - aglDescribePixelFormat(fmt, AGL_RED_SIZE, &res); - d->glFormat.setRedBufferSize(res); - aglDescribePixelFormat(fmt, AGL_GREEN_SIZE, &res); - d->glFormat.setGreenBufferSize(res); - aglDescribePixelFormat(fmt, AGL_BLUE_SIZE, &res); - d->glFormat.setBlueBufferSize(res); - aglDescribePixelFormat(fmt, AGL_ALPHA_SIZE, &res); - d->glFormat.setAlpha(res); - if (d->glFormat.alpha()) - d->glFormat.setAlphaBufferSize(res); - aglDescribePixelFormat(fmt, AGL_ACCUM_RED_SIZE, &res); - // Bug in Apple OpenGL (rdr://5015603), when we don't have an accumulation - // buffer, it still claims that we have a 16-bit one (which is pretty rare). - // So, we just assume we can never have a buffer that small. - d->glFormat.setAccum(res > 5); - if (d->glFormat.accum()) - d->glFormat.setAccumBufferSize(res); - aglDescribePixelFormat(fmt, AGL_STENCIL_SIZE, &res); - d->glFormat.setStencil(res); - if (d->glFormat.stencil()) - d->glFormat.setStencilBufferSize(res); - aglDescribePixelFormat(fmt, AGL_STEREO, &res); - d->glFormat.setStereo(res); - aglDescribePixelFormat(fmt, AGL_SAMPLE_BUFFERS_ARB, &res); - d->glFormat.setSampleBuffers(res); - if (d->glFormat.sampleBuffers()) { - aglDescribePixelFormat(fmt, AGL_SAMPLES_ARB, &res); - d->glFormat.setSamples(res); - } -#else - NSOpenGLPixelFormat *fmt = static_cast(d->vi); - - d->glFormat = QGLFormat(); - - // ### make sure to reset other options - d->glFormat.setDoubleBuffer(attribValue(fmt, NSOpenGLPFADoubleBuffer)); - - int depthSize = attribValue(fmt, NSOpenGLPFADepthSize); - d->glFormat.setDepth(depthSize > 0); - if (depthSize > 0) - d->glFormat.setDepthBufferSize(depthSize); - - int alphaSize = attribValue(fmt, NSOpenGLPFAAlphaSize); - d->glFormat.setAlpha(alphaSize > 0); - if (alphaSize > 0) - d->glFormat.setAlphaBufferSize(alphaSize); - - int accumSize = attribValue(fmt, NSOpenGLPFAAccumSize); - d->glFormat.setAccum(accumSize > 0); - if (accumSize > 0) - d->glFormat.setAccumBufferSize(accumSize); - - int stencilSize = attribValue(fmt, NSOpenGLPFAStencilSize); - d->glFormat.setStencil(stencilSize > 0); - if (stencilSize > 0) - d->glFormat.setStencilBufferSize(stencilSize); - - d->glFormat.setStereo(attribValue(fmt, NSOpenGLPFAStereo)); - - int sampleBuffers = attribValue(fmt, NSOpenGLPFASampleBuffers); - d->glFormat.setSampleBuffers(sampleBuffers); - if (sampleBuffers > 0) - d->glFormat.setSamples(attribValue(fmt, NSOpenGLPFASamples)); -#endif - if (shareContext && (!shareContext->isValid() || !shareContext->d_func()->cx)) { - qWarning("QGLContext::chooseContext: Cannot share with invalid context"); - shareContext = 0; - } - - // sharing between rgba and color-index will give wrong colors - if (shareContext && (format().rgba() != shareContext->format().rgba())) - shareContext = 0; - -#ifndef QT_MAC_USE_COCOA - AGLContext ctx = aglCreateContext(fmt, (AGLContext) (shareContext ? shareContext->d_func()->cx : 0)); -#else - NSOpenGLContext *ctx = [[NSOpenGLContext alloc] initWithFormat:fmt - shareContext:(shareContext ? static_cast(shareContext->d_func()->cx) - : 0)]; -#endif - if (!ctx) { -#ifndef QT_MAC_USE_COCOA - GLenum err = aglGetError(); - if (err == AGL_BAD_MATCH || err == AGL_BAD_CONTEXT) { - if (shareContext && shareContext->d_func()->cx) { - qWarning("QGLContext::chooseContext(): Context sharing mismatch!"); - if (!(ctx = aglCreateContext(fmt, 0))) - return false; - shareContext = 0; - } - } -#else - if (shareContext) { - ctx = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:0]; - if (ctx) { - qWarning("QGLContext::chooseContext: Context sharing mismatch"); - shareContext = 0; - } - } -#endif - if (!ctx) { - qWarning("QGLContext::chooseContext: Unable to create QGLContext"); - return false; - } - } - d->cx = ctx; - if (shareContext && shareContext->d_func()->cx) { - QGLContext *share = const_cast(shareContext); - d->sharing = true; - share->d_func()->sharing = true; - } - if (deviceIsPixmap()) - updatePaintDevice(); - - // vblank syncing - GLint interval = d->reqFormat.swapInterval(); - if (interval != -1) { -#ifndef QT_MAC_USE_COCOA - aglSetInteger((AGLContext)d->cx, AGL_SWAP_INTERVAL, &interval); - if (interval != 0) - aglEnable((AGLContext)d->cx, AGL_SWAP_INTERVAL); - else - aglDisable((AGLContext)d->cx, AGL_SWAP_INTERVAL); -#else - [ctx setValues:&interval forParameter:NSOpenGLCPSwapInterval]; -#endif - } -#ifndef QT_MAC_USE_COCOA - aglGetInteger((AGLContext)d->cx, AGL_SWAP_INTERVAL, &interval); -#else - [ctx getValues:&interval forParameter:NSOpenGLCPSwapInterval]; -#endif - d->glFormat.setSwapInterval(interval); - return true; -} - -void *QGLContextPrivate::tryFormat(const QGLFormat &format) -{ - static const int Max = 40; -#ifndef QT_MAC_USE_COCOA - GLint attribs[Max], cnt = 0; - bool device_is_pixmap = (paintDevice->devType() == QInternal::Pixmap); - - attribs[cnt++] = AGL_RGBA; - attribs[cnt++] = AGL_BUFFER_SIZE; - attribs[cnt++] = device_is_pixmap ? static_cast(paintDevice)->depth() : 32; - attribs[cnt++] = AGL_LEVEL; - attribs[cnt++] = format.plane(); - - if (format.redBufferSize() != -1) { - attribs[cnt++] = AGL_RED_SIZE; - attribs[cnt++] = format.redBufferSize(); - } - if (format.greenBufferSize() != -1) { - attribs[cnt++] = AGL_GREEN_SIZE; - attribs[cnt++] = format.greenBufferSize(); - } - if (format.blueBufferSize() != -1) { - attribs[cnt++] = AGL_BLUE_SIZE; - attribs[cnt++] = format.blueBufferSize(); - } - if (device_is_pixmap) { - attribs[cnt++] = AGL_PIXEL_SIZE; - attribs[cnt++] = static_cast(paintDevice)->depth(); - attribs[cnt++] = AGL_OFFSCREEN; - if (!format.alpha()) { - attribs[cnt++] = AGL_ALPHA_SIZE; - attribs[cnt++] = 8; - } - } else { - if (format.doubleBuffer()) - attribs[cnt++] = AGL_DOUBLEBUFFER; - } - - if (format.stereo()) - attribs[cnt++] = AGL_STEREO; - if (format.alpha()) { - attribs[cnt++] = AGL_ALPHA_SIZE; - attribs[cnt++] = format.alphaBufferSize() == -1 ? 8 : format.alphaBufferSize(); - } - if (format.stencil()) { - attribs[cnt++] = AGL_STENCIL_SIZE; - attribs[cnt++] = format.stencilBufferSize() == -1 ? 8 : format.stencilBufferSize(); - } - if (format.depth()) { - attribs[cnt++] = AGL_DEPTH_SIZE; - attribs[cnt++] = format.depthBufferSize() == -1 ? 32 : format.depthBufferSize(); - } - if (format.accum()) { - attribs[cnt++] = AGL_ACCUM_RED_SIZE; - attribs[cnt++] = format.accumBufferSize() == -1 ? 1 : format.accumBufferSize(); - attribs[cnt++] = AGL_ACCUM_BLUE_SIZE; - attribs[cnt++] = format.accumBufferSize() == -1 ? 1 : format.accumBufferSize(); - attribs[cnt++] = AGL_ACCUM_GREEN_SIZE; - attribs[cnt++] = format.accumBufferSize() == -1 ? 1 : format.accumBufferSize(); - attribs[cnt++] = AGL_ACCUM_ALPHA_SIZE; - attribs[cnt++] = format.accumBufferSize() == -1 ? 1 : format.accumBufferSize(); - } - if (format.sampleBuffers()) { - attribs[cnt++] = AGL_SAMPLE_BUFFERS_ARB; - attribs[cnt++] = 1; - attribs[cnt++] = AGL_SAMPLES_ARB; - attribs[cnt++] = format.samples() == -1 ? 4 : format.samples(); - } - - attribs[cnt] = AGL_NONE; - Q_ASSERT(cnt < Max); - return aglChoosePixelFormat(0, 0, attribs); -#else - NSOpenGLPixelFormatAttribute attribs[Max]; - int cnt = 0; - int devType = paintDevice->devType(); - bool device_is_pixmap = (devType == QInternal::Pixmap); - int depth = device_is_pixmap ? static_cast(paintDevice)->depth() : 32; - - attribs[cnt++] = NSOpenGLPFAColorSize; - attribs[cnt++] = depth; - - if (device_is_pixmap) { - attribs[cnt++] = NSOpenGLPFAOffScreen; - } else { - if (format.doubleBuffer()) - attribs[cnt++] = NSOpenGLPFADoubleBuffer; - } - if (glFormat.stereo()) - attribs[cnt++] = NSOpenGLPFAStereo; - if (device_is_pixmap || format.alpha()) { - attribs[cnt++] = NSOpenGLPFAAlphaSize; - attribs[cnt++] = def(format.alphaBufferSize(), 8); - } - if (format.stencil()) { - attribs[cnt++] = NSOpenGLPFAStencilSize; - attribs[cnt++] = def(format.stencilBufferSize(), 8); - } - if (format.depth()) { - attribs[cnt++] = NSOpenGLPFADepthSize; - attribs[cnt++] = def(format.depthBufferSize(), 32); - } - if (format.accum()) { - attribs[cnt++] = NSOpenGLPFAAccumSize; - attribs[cnt++] = def(format.accumBufferSize(), 1); - } - if (format.sampleBuffers()) { - attribs[cnt++] = NSOpenGLPFASampleBuffers; - attribs[cnt++] = 1; - attribs[cnt++] = NSOpenGLPFASamples; - attribs[cnt++] = def(format.samples(), 4); - } - - if (format.directRendering()) - attribs[cnt++] = NSOpenGLPFAAccelerated; - - if (devType == QInternal::Pbuffer) - attribs[cnt++] = NSOpenGLPFAPixelBuffer; - - attribs[cnt] = 0; - Q_ASSERT(cnt < Max); - return [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs]; -#endif -} - -void QGLContextPrivate::clearDrawable() -{ - [static_cast(cx) clearDrawable]; -} - -/*! - \bold{Mac OS X only:} This virtual function tries to find a visual that - matches the format, reducing the demands if the original request - cannot be met. - - The algorithm for reducing the demands of the format is quite - simple-minded, so override this method in your subclass if your - application has spcific requirements on visual selection. - - The \a handle argument is always zero and is not used - - \sa chooseContext() -*/ - -void *QGLContext::chooseMacVisual(GDHandle /* handle */) -{ - Q_D(QGLContext); - - void *fmt = d->tryFormat(d->glFormat); - if (!fmt && d->glFormat.stereo()) { - d->glFormat.setStereo(false); - fmt = d->tryFormat(d->glFormat); - } - if (!fmt && d->glFormat.sampleBuffers()) { - d->glFormat.setSampleBuffers(false); - fmt = d->tryFormat(d->glFormat); - } - if (!fmt) - qWarning("QGLContext::chooseMacVisual: Unable to choose a pixel format"); - return fmt; -} - -void QGLContext::reset() -{ - Q_D(QGLContext); - if (!d->valid) - return; - d->cleanup(); - doneCurrent(); -#ifndef QT_MAC_USE_COCOA - if (d->cx) - aglDestroyContext((AGLContext)d->cx); -#else - QMacCocoaAutoReleasePool pool; - [static_cast(d->cx) release]; -#endif - d->cx = 0; -#ifndef QT_MAC_USE_COCOA - if (d->vi) - aglDestroyPixelFormat((AGLPixelFormat)d->vi); -#else - [static_cast(d->vi) release]; -#endif - d->vi = 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); - - if (!d->valid) { - qWarning("QGLContext::makeCurrent: Cannot make invalid context current"); - return; - } -#ifndef QT_MAC_USE_COCOA - aglSetCurrentContext((AGLContext)d->cx); - if (d->update) - updatePaintDevice(); -#else - [static_cast(d->cx) makeCurrentContext]; -#endif - QGLContextPrivate::setCurrentContext(this); -} - -#ifndef QT_MAC_USE_COCOA -/* - Returns the effective scale factor for a widget. For this value to be - different than 1, the following must be true: - - The system scale factor must be greater than 1. - - The widget window must have WA_MacFrameworkScaled set. -*/ -float qt_mac_get_scale_factor(QWidget *widget) -{ - if (!widget | !widget->window()) - return 1; - - if (widget->window()->testAttribute(Qt::WA_MacFrameworkScaled) == false) - return 1; - - float systemScale = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4 ? HIGetScaleFactor() : 1; - if (systemScale == float(1)) - return 1; - - return systemScale; -} -#endif - -/*! \internal -*/ -void QGLContext::updatePaintDevice() -{ - Q_D(QGLContext); -#ifndef QT_MAC_USE_COCOA - d->update = false; - if (d->paintDevice->devType() == QInternal::Widget) { - //get control information - QWidget *w = (QWidget *)d->paintDevice; - HIViewRef hiview = (HIViewRef)w->winId(); - WindowRef window = HIViewGetWindow(hiview); -#ifdef DEBUG_OPENGL_REGION_UPDATE - static int serial_no_gl = 0; - qDebug("[%d] %p setting on %s::%s %p/%p [%s]", ++serial_no_gl, w, - w->metaObject()->className(), w->objectName().toLatin1().constData(), - hiview, window, w->handle() ? "Inside" : "Outside"); -#endif - - //update drawable - if (0 && w->isWindow() && w->isFullScreen()) { - aglSetDrawable((AGLContext)d->cx, 0); - aglSetFullScreen((AGLContext)d->cx, w->width(), w->height(), 0, QApplication::desktop()->screenNumber(w)); - w->hide(); - } else { - AGLDrawable old_draw = aglGetDrawable((AGLContext)d->cx), new_draw = GetWindowPort(window); - if (old_draw != new_draw) - aglSetDrawable((AGLContext)d->cx, new_draw); - } - - float scale = qt_mac_get_scale_factor(w); - - if (!w->isWindow()) { - QRegion clp = qt_mac_get_widget_rgn(w); //get drawable area - -#ifdef DEBUG_OPENGL_REGION_UPDATE - if (clp.isEmpty()) { - qDebug(" Empty area!"); - } else { - QVector rs = clp.rects(); - for(int i = 0; i < rs.count(); i++) - qDebug(" %d %d %d %d", rs[i].x(), rs[i].y(), rs[i].width(), rs[i].height()); - } -#endif - //update the clip - if (!aglIsEnabled((AGLContext)d->cx, AGL_BUFFER_RECT)) - aglEnable((AGLContext)d->cx, AGL_BUFFER_RECT); - if (clp.isEmpty()) { - GLint offs[4] = { 0, 0, 0, 0 }; - aglSetInteger((AGLContext)d->cx, AGL_BUFFER_RECT, offs); - if (aglIsEnabled((AGLContext)d->cx, AGL_CLIP_REGION)) - aglDisable((AGLContext)d->cx, AGL_CLIP_REGION); - } else { - HIPoint origin = { 0., 0. }; - HIViewConvertPoint(&origin, HIViewRef(w->winId()), 0); - const GLint offs[4] = { qRound(origin.x), - w->window()->frameGeometry().height() * scale - - (qRound(origin.y) + w->height() * scale), - w->width() * scale, w->height() * scale}; - - RgnHandle region = clp.handle(true); - - if (scale != float(1)) { - // Sacle the clip region by the scale factor - Rect regionBounds; - GetRegionBounds(region, ®ionBounds); - Rect regionBoundsDest = regionBounds; - regionBoundsDest.bottom *= scale; - regionBoundsDest.right *= scale; - MapRgn(region, ®ionBounds, ®ionBoundsDest); - } - - aglSetInteger((AGLContext)d->cx, AGL_BUFFER_RECT, offs); - aglSetInteger((AGLContext)d->cx, AGL_CLIP_REGION, (const GLint *)region); - if (!aglIsEnabled((AGLContext)d->cx, AGL_CLIP_REGION)) - aglEnable((AGLContext)d->cx, AGL_CLIP_REGION); - } - } else { - // Set the buffer rect for top-level gl contexts when scaled. - if (scale != float(1)) { - aglEnable((AGLContext)d->cx, AGL_BUFFER_RECT); - const GLint offs[4] = { 0, 0, w->width() * scale , w->height() * scale}; - aglSetInteger((AGLContext)d->cx, AGL_BUFFER_RECT, offs); - } - } - } else if (d->paintDevice->devType() == QInternal::Pixmap) { - QPixmap *pm = reinterpret_cast(d->paintDevice); - - unsigned long qdformat = k32ARGBPixelFormat; - if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) - qdformat = k32BGRAPixelFormat; - Rect rect; - SetRect(&rect, 0, 0, pm->width(), pm->height()); - - GWorldPtr gworld; - NewGWorldFromPtr(&gworld, qdformat, &rect, 0, 0, 0, - reinterpret_cast(qt_mac_pixmap_get_base(pm)), - qt_mac_pixmap_get_bytes_per_line(pm)); - - PixMapHandle pixmapHandle = GetGWorldPixMap(gworld); - aglSetOffScreen(reinterpret_cast(d->cx), pm->width(), pm->height(), - GetPixRowBytes(pixmapHandle), GetPixBaseAddr(pixmapHandle)); - } else { - qWarning("QGLContext::updatePaintDevice(): Not sure how to render OpenGL on this device!"); - } - aglUpdateContext((AGLContext)d->cx); - -#else - QMacCocoaAutoReleasePool pool; - - if (d->paintDevice->devType() == QInternal::Widget) { - //get control information - QWidget *w = (QWidget *)d->paintDevice; - NSView *view = qt_mac_nativeview_for(w); - - // Trying to attach the GL context to the NSView will fail with - // "invalid drawable" if done too soon, but we have to make sure - // the connection is made before the first paint event. Using - // the NSView do to this check fails as the NSView is visible - // before it's safe to connect, and using the NSWindow fails as - // the NSWindow will become visible after the first paint event. - // This leaves us with the QWidget, who's visible state seems - // to match the point in time when it's safe to connect. - if (!w || !w->isVisible()) - return; // Not safe to attach GL context to view yet - - if ([static_cast(d->cx) view] != view && ![view isHidden]) - [static_cast(d->cx) setView:view]; - } else if (d->paintDevice->devType() == QInternal::Pixmap) { - const QPixmap *pm = static_cast(d->paintDevice); - [static_cast(d->cx) setOffScreen:qt_mac_pixmap_get_base(pm) - width:pm->width() - height:pm->height() - rowbytes:qt_mac_pixmap_get_bytes_per_line(pm)]; - } else { - qWarning("QGLContext::updatePaintDevice: Not sure how to render OpenGL on this device"); - } - [static_cast(d->cx) update]; -#endif -} - -void QGLContext::doneCurrent() -{ - - if ( -#ifndef QT_MAC_USE_COCOA - aglGetCurrentContext() != (AGLContext) d_func()->cx -#else - [NSOpenGLContext currentContext] != d_func()->cx -#endif - ) - return; - - QGLContextPrivate::setCurrentContext(0); -#ifndef QT_MAC_USE_COCOA - aglSetCurrentContext(0); -#else - [NSOpenGLContext clearCurrentContext]; -#endif -} - -void QGLContext::swapBuffers() const -{ - Q_D(const QGLContext); - if (!d->valid) - return; -#ifndef QT_MAC_USE_COCOA - aglSwapBuffers((AGLContext)d->cx); -#else - [static_cast(d->cx) flushBuffer]; -#endif -} - -QColor QGLContext::overlayTransparentColor() const -{ - return QColor(0, 0, 0); // Invalid color -} - -#ifndef QT_MAC_USE_COCOA -static QColor cmap[256]; -static bool cmap_init = false; -#endif -uint QGLContext::colorIndex(const QColor &c) const -{ -#ifndef QT_MAC_USE_COCOA - int ret = -1; - if(!cmap_init) { - cmap_init = true; - for(int i = 0; i < 256; i++) - cmap[i] = QColor(); - } else { - for(int i = 0; i < 256; i++) { - if(cmap[i].isValid() && cmap[i] == c) { - ret = i; - break; - } - } - } - if(ret == -1) { - for(ret = 0; ret < 256; ret++) - if(!cmap[ret].isValid()) - break; - if(ret == 256) { - ret = -1; - qWarning("QGLContext::colorIndex(): Internal error!"); - } else { - cmap[ret] = c; - - GLint vals[4]; - vals[0] = ret; - vals[1] = c.red(); - vals[2] = c.green(); - vals[3] = c.blue(); - aglSetInteger((AGLContext)d_func()->cx, AGL_COLORMAP_ENTRY, vals); - } - } - return (uint)(ret == -1 ? 0 : ret); -#else - Q_UNUSED(c); - return 0; -#endif -} - -void QGLContext::generateFontDisplayLists(const QFont & /* fnt */, int /* listBase */) -{ -} - -static CFBundleRef qt_getOpenGLBundle() -{ - CFBundleRef bundle = 0; - CFStringRef urlString = QCFString::toCFStringRef(QLatin1String("/System/Library/Frameworks/OpenGL.framework")); - QCFType url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, - urlString, kCFURLPOSIXPathStyle, false); - if (url) - bundle = CFBundleCreate(kCFAllocatorDefault, url); - CFRelease(urlString); - return bundle; -} - -void *QGLContext::getProcAddress(const QString &proc) const -{ - CFStringRef procName = QCFString(proc).toCFStringRef(proc); - void *result = CFBundleGetFunctionPointerForName(QCFType(qt_getOpenGLBundle()), - procName); - CFRelease(procName); - return result; -} -#ifndef QT_MAC_USE_COCOA -/***************************************************************************** - QGLWidget AGL-specific code - *****************************************************************************/ - -/**************************************************************************** - Hacks to glue AGL to an HIView - ***************************************************************************/ -QRegion qt_mac_get_widget_rgn(const QWidget *widget) -{ - if(!widget->isVisible() || widget->isMinimized()) - return QRegion(); - const QRect wrect = QRect(qt_mac_posInWindow(widget), widget->size()); - if(!wrect.isValid()) - return QRegion(); - - RgnHandle macr = qt_mac_get_rgn(); - GetControlRegion((HIViewRef)widget->winId(), kControlStructureMetaPart, macr); - OffsetRgn(macr, wrect.x(), wrect.y()); - QRegion ret = qt_mac_convert_mac_region(macr); - - QPoint clip_pos = wrect.topLeft(); - for(const QWidget *last_clip = 0, *clip = widget; clip; last_clip = clip, clip = clip->parentWidget()) { - if(clip != widget) { - GetControlRegion((HIViewRef)clip->winId(), kControlStructureMetaPart, macr); - OffsetRgn(macr, clip_pos.x(), clip_pos.y()); - ret &= qt_mac_convert_mac_region(macr); - } - const QObjectList &children = clip->children(); - for(int i = children.size()-1; i >= 0; --i) { - if(QWidget *child = qobject_cast(children.at(i))) { - if(child == last_clip) - break; - - // This check may seem weird, but when we are using a unified toolbar - // The widget is actually being owned by that toolbar and not by Qt. - // This means that the geometry it reports will be wrong - // and will accidentally cause problems when calculating the region - // So, it is better to skip these widgets since they aren't the hierarchy - // anyway. - if (HIViewGetSuperview(HIViewRef(child->winId())) != HIViewRef(clip->winId())) - continue; - - if(child->isVisible() && !child->isMinimized() && !child->isTopLevel()) { - const QRect childRect = QRect(clip_pos+child->pos(), child->size()); - if(childRect.isValid() && wrect.intersects(childRect)) { - GetControlRegion((HIViewRef)child->winId(), kControlStructureMetaPart, macr); - OffsetRgn(macr, childRect.x(), childRect.y()); - ret -= qt_mac_convert_mac_region(macr); - } - } - } - } - if(clip->isWindow()) - break; - clip_pos -= clip->pos(); - } - qt_mac_dispose_rgn(macr); - return ret; -} - -#endif - -void QGLWidget::setMouseTracking(bool enable) -{ - QWidget::setMouseTracking(enable); -} - -void QGLWidget::resizeEvent(QResizeEvent *) -{ - Q_D(QGLWidget); - if (!isValid()) - return; -#ifndef QT_MAC_USE_COCOA - if (!isWindow()) - d->glcx->d_func()->update = true; -#endif - makeCurrent(); - if (!d->glcx->initialized()) - glInit(); -#ifdef QT_MAC_USE_COCOA - d->glcx->updatePaintDevice(); -#endif -#ifndef QT_MAC_USE_COCOA - float scale = qt_mac_get_scale_factor(this); - resizeGL(width() * scale, height() * scale); -#else - resizeGL(width(), height()); -#endif -} - -const QGLContext* QGLWidget::overlayContext() const -{ - return 0; -} - -void QGLWidget::makeOverlayCurrent() -{ -} - -void QGLWidget::updateOverlayGL() -{ -} - -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 (d->glcx) - d->glcx->doneCurrent(); - QGLContext* oldcx = d->glcx; - d->glcx = context; - if (!d->glcx->isValid()) - d->glcx->create(shareContext ? shareContext : oldcx); - if (deleteOldContext && oldcx) - delete oldcx; -} - -void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) -{ - Q_Q(QGLWidget); - - initContext(context, shareWidget); - - QWidget *current = q; - while (current) { - qt_widget_private(current)->glWidgets.append(QWidgetPrivate::GlWidgetInfo(q)); - if (current->isWindow()) - break; - current = current->parentWidget(); - } -} - -bool QGLWidgetPrivate::renderCxPm(QPixmap*) -{ - return false; -} - -void QGLWidgetPrivate::cleanupColormaps() -{ -} - -const QGLColormap & QGLWidget::colormap() const -{ - return d_func()->cmap; -} - -void QGLWidget::setColormap(const QGLColormap &) -{ -} - -void QGLWidgetPrivate::updatePaintDevice() -{ - Q_Q(QGLWidget); - glcx->updatePaintDevice(); - q->update(); -} - -#endif - -QT_END_NAMESPACE diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 4c22f0f3d73..668728be209 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -60,24 +60,18 @@ #include "QtCore/qthreadstorage.h" #include "QtCore/qhash.h" #include "QtCore/qatomic.h" -#include "private/qwidget_p.h" +#include "QtWidgets/private/qwidget_p.h" +#include "QtGui/private/qopenglcontext_p.h" #include "qcache.h" #include "qglpaintdevice_p.h" -#ifndef QT_NO_EGL -#include -#endif - -#if defined(Q_WS_QPA) -#include -#endif +#include QT_BEGIN_NAMESPACE class QGLContext; class QGLOverlayWidget; class QPixmap; -class QPixmapFilter; #ifdef Q_WS_MAC # ifdef qDebug # define old_qDebug qDebug @@ -96,14 +90,6 @@ QT_END_INCLUDE_NAMESPACE class QMacWindowChangeEvent; #endif -#ifdef Q_WS_QWS -class QWSGLWindowSurface; -#endif - -#ifndef QT_NO_EGL -class QEglContext; -#endif - QT_BEGIN_INCLUDE_NAMESPACE #include QT_END_INCLUDE_NAMESPACE @@ -165,15 +151,6 @@ class Q_OPENGL_EXPORT QGLWidgetPrivate : public QWidgetPrivate public: QGLWidgetPrivate() : QWidgetPrivate() , disable_clear_on_painter_begin(false) -#if defined(Q_WS_QWS) - , wsurf(0) -#endif -#if defined(Q_WS_X11) && !defined(QT_NO_EGL) - , eglSurfaceWindowId(0) -#endif -#if defined(Q_OS_SYMBIAN) - , eglSurfaceWindowId(0) -#endif { isGLWidget = 1; } @@ -199,31 +176,8 @@ public: #endif bool disable_clear_on_painter_begin; - -#if defined(Q_WS_WIN) - void updateColormap(); - QGLContext *olcx; -#elif defined(Q_WS_X11) - QGLOverlayWidget *olw; -#ifndef QT_NO_EGL - void recreateEglSurface(); - WId eglSurfaceWindowId; -#endif -#elif defined(Q_WS_MAC) - QGLContext *olcx; - void updatePaintDevice(); -#elif defined(Q_WS_QWS) - QWSGLWindowSurface *wsurf; -#endif -#ifdef Q_OS_SYMBIAN - void recreateEglSurface(); - WId eglSurfaceWindowId; -#endif }; -class QGLContextGroupResourceBase; -class QGLSharedResourceGuard; - // QGLContextPrivate has the responsibility of creating context groups. // QGLContextPrivate maintains the reference counter and destroys // context groups when needed. @@ -237,9 +191,6 @@ public: bool isSharing() const { return m_shares.size() >= 2; } QList shares() const { return m_shares; } - void addGuard(QGLSharedResourceGuard *guard); - void removeGuard(QGLSharedResourceGuard *guard); - static void addShare(const QGLContext *context, const QGLContext *share); static void removeShare(const QGLContext *context); @@ -249,12 +200,8 @@ private: QGLExtensionFuncs m_extensionFuncs; const QGLContext *m_context; // context group's representative QList m_shares; - QHash m_resources; - QGLSharedResourceGuard *m_guards; // double-linked list of active guards. QAtomicInt m_refs; - void cleanupResources(const QGLContext *ctx); - friend class QGLContext; friend class QGLContextPrivate; friend class QGLContextGroupResourceBase; @@ -262,7 +209,7 @@ private: // Get the context that resources for "ctx" will transfer to once // "ctx" is destroyed. Returns null if nothing is sharing with ctx. -Q_OPENGL_EXPORT const QGLContext *qt_gl_transfer_context(const QGLContext *); +const QGLContext *qt_gl_transfer_context(const QGLContext *); // GL extension definitions class QGLExtensions { @@ -351,54 +298,11 @@ public: void syncGlState(); // Makes sure the GL context's state is what we think it is void swapRegion(const QRegion ®ion); -#if defined(Q_WS_WIN) - void updateFormatVersion(); -#endif + QOpenGLContext *guiGlContext; + bool ownContext; -#if defined(Q_WS_WIN) - HGLRC rc; - HDC dc; - WId win; - int pixelFormatId; - QGLCmap* cmap; - HBITMAP hbitmap; - HDC hbitmap_hdc; - Qt::HANDLE threadId; -#endif -#ifndef QT_NO_EGL - QEglContext *eglContext; - EGLSurface eglSurface; - void destroyEglSurfaceForDevice(); - EGLSurface eglSurfaceForDevice() const; - static QEglProperties *extraWindowSurfaceCreationProps; - static void setExtraWindowSurfaceCreationProps(QEglProperties *props); -#endif - -#if defined(Q_WS_QPA) - QPlatformGLContext *platformContext; void setupSharing(); -#elif defined(Q_WS_X11) || defined(Q_WS_MAC) - void* cx; -#endif -#if defined(Q_WS_X11) || defined(Q_WS_MAC) - void* vi; -#endif -#if defined(Q_WS_X11) - void* pbuf; - quint32 gpm; - int screen; - QHash boundPixmaps; - QGLTexture *bindTextureFromNativePixmap(QPixmap*, const qint64 key, - QGLContext::BindOptions options); - static void destroyGlSurfaceForPixmap(QPixmapData*); - static void unbindPixmapFromTexture(QPixmapData*); -#endif -#if defined(Q_WS_MAC) - bool update; - void *tryFormat(const QGLFormat &format); - void clearDrawable(); -#endif QGLFormat glFormat; QGLFormat reqFormat; GLuint fbo; @@ -423,10 +327,6 @@ public: uint workaround_brokenAlphaTexSubImage : 1; uint workaround_brokenAlphaTexSubImage_init : 1; -#ifndef QT_NO_EGL - uint ownsEglContext : 1; -#endif - QPaintDevice *paintDevice; QColor transpColor; QGLContext *q_ptr; @@ -439,7 +339,6 @@ public: GLuint current_fbo; GLuint default_fbo; QPaintEngine *active_engine; - QHash m_resources; QGLTextureDestroyer *texture_destroyer; QGLFunctions *functions; @@ -448,14 +347,8 @@ public: static inline QGLContextGroup *contextGroup(const QGLContext *ctx) { return ctx->d_ptr->group; } -#ifdef Q_WS_WIN - 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_QPA) || defined(Q_OS_SYMBIAN) static Q_OPENGL_EXPORT QGLExtensionFuncs qt_extensionFuncs; static Q_OPENGL_EXPORT QGLExtensionFuncs& extensionFuncs(const QGLContext *); -#endif static void setCurrentContext(QGLContext *context); }; @@ -508,34 +401,19 @@ class Q_OPENGL_EXPORT QGLTextureDestroyer : public QObject public: QGLTextureDestroyer() : QObject() { qRegisterMetaType("GLuint"); - connect(this, SIGNAL(freeTexture(QGLContext *, QPixmapData *, GLuint)), - this, SLOT(freeTexture_slot(QGLContext *, QPixmapData *, GLuint))); + connect(this, SIGNAL(freeTexture(QGLContext *, QPlatformPixmap *, GLuint)), + this, SLOT(freeTexture_slot(QGLContext *, QPlatformPixmap *, GLuint))); } - void emitFreeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id) { + void emitFreeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) { emit freeTexture(context, boundPixmap, id); } Q_SIGNALS: - void freeTexture(QGLContext *context, QPixmapData *boundPixmap, GLuint id); + void freeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id); private slots: - void freeTexture_slot(QGLContext *context, QPixmapData *boundPixmap, GLuint id) { + void freeTexture_slot(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) { Q_UNUSED(boundPixmap); -#if defined(Q_WS_X11) - if (boundPixmap) { - QGLContext *oldContext = const_cast(QGLContext::currentContext()); - context->makeCurrent(); - // Although glXReleaseTexImage is a glX call, it must be called while there - // is a current context - the context the pixmap was bound to a texture in. - // Otherwise the release doesn't do anything and you get BadDrawable errors - // when you come to delete the context. - QGLContextPrivate::unbindPixmapFromTexture(boundPixmap); - glDeleteTextures(1, &id); - if (oldContext) - oldContext->makeCurrent(); - return; - } -#endif QGLShareContextScope scope(context); glDeleteTextures(1, &id); } @@ -562,17 +440,12 @@ public: id(tx_id), target(tx_target), options(opt) -#if defined(Q_WS_X11) - , boundPixmap(0) -#endif {} ~QGLTexture() { if (options & QGLContext::MemoryManagedBindOption) { Q_ASSERT(context); -#if !defined(Q_WS_X11) - QPixmapData *boundPixmap = 0; -#endif + QPlatformPixmap *boundPixmap = 0; context->d_ptr->texture_destroyer->emitFreeTexture(context, boundPixmap, id); } } @@ -583,10 +456,6 @@ public: QGLContext::BindOptions options; -#if defined(Q_WS_X11) - QPixmapData* boundPixmap; -#endif - bool canBindCompressedTexture (const char *buf, int len, const char *format, bool *hasAlpha); QSize bindCompressedTexture @@ -629,8 +498,8 @@ public: void removeContextTextures(QGLContext *ctx); static QGLTextureCache *instance(); static void cleanupTexturesForCacheKey(qint64 cacheKey); - static void cleanupTexturesForPixampData(QPixmapData* pixmap); - static void cleanupBeforePixmapDestruction(QPixmapData* pixmap); + static void cleanupTexturesForPixampData(QPlatformPixmap* pixmap); + static void cleanupBeforePixmapDestruction(QPlatformPixmap* pixmap); private: QCache m_cache; @@ -661,199 +530,71 @@ QGLTexture* QGLTextureCache::getTexture(QGLContext *ctx, qint64 key) return m_cache.object(cacheKey); } -extern Q_OPENGL_EXPORT QPaintEngine* qt_qgl_paint_engine(); - -bool qt_gl_preferGL2Engine(); - -inline GLenum qt_gl_preferredTextureFormat() -{ - return (QGLExtensions::glExtensions() & QGLExtensions::BGRATextureFormat) && QSysInfo::ByteOrder == QSysInfo::LittleEndian - ? GL_BGRA : GL_RGBA; -} - -inline GLenum qt_gl_preferredTextureTarget() -{ -#if defined(QT_OPENGL_ES_2) - return GL_TEXTURE_2D; -#else - return (QGLExtensions::glExtensions() & QGLExtensions::TextureRectangle) - && !qt_gl_preferGL2Engine() - ? GL_TEXTURE_RECTANGLE_NV - : GL_TEXTURE_2D; -#endif -} - -/* - Base for resources that are shared in a context group. -*/ -class Q_OPENGL_EXPORT QGLContextGroupResourceBase -{ -public: - QGLContextGroupResourceBase(); - virtual ~QGLContextGroupResourceBase(); - void insert(const QGLContext *context, void *value); - void *value(const QGLContext *context); - void cleanup(const QGLContext *context); - void cleanup(const QGLContext *context, void *value); - virtual void freeResource(void *value) = 0; - -protected: - QList m_groups; - -private: - QAtomicInt active; -}; - -/* - The QGLContextGroupResource template is used to manage a resource - for a group of sharing GL contexts. When the last context in the - group is destroyed, or when the QGLContextGroupResource object - itself is destroyed (implies potential context switches), the - resource will be freed. - - The class used as the template class type needs to have a - constructor with the following signature: - T(const QGLContext *); -*/ -template -class QGLContextGroupResource : public QGLContextGroupResourceBase -{ -public: - ~QGLContextGroupResource() { - for (int i = 0; i < m_groups.size(); ++i) { - const QGLContext *context = m_groups.at(i)->context(); - T *resource = reinterpret_cast(QGLContextGroupResourceBase::value(context)); - if (resource) { - QGLShareContextScope scope(context); - delete resource; - } - } - } - - T *value(const QGLContext *context) { - T *resource = reinterpret_cast(QGLContextGroupResourceBase::value(context)); - if (!resource) { - resource = new T(context); - insert(context, resource); - } - return resource; - } - -protected: - void freeResource(void *resource) { - delete reinterpret_cast(resource); - } -}; - -/* - Base for resources that are context specific. -*/ -class Q_OPENGL_EXPORT QGLContextResourceBase -{ -public: - virtual ~QGLContextResourceBase() { - for (int i = 0; i < m_contexts.size(); ++i) - m_contexts.at(i)->d_ptr->m_resources.remove(this); - } - - void insert(const QGLContext *context, void *value) { - context->d_ptr->m_resources.insert(this, value); - } - - void *value(const QGLContext *context) { - return context->d_ptr->m_resources.value(this, 0); - } - virtual void freeResource(void *value) = 0; - -protected: - QList m_contexts; -}; - -/* - The QGLContextResource template is used to manage a resource for a - single GL context. Just before the context is destroyed (while it's - still the current context), or when the QGLContextResource object - itself is destroyed (implies potential context switches), the - resource will be freed. The class used as the template class type - needs to have a constructor with the following signature: T(const - QGLContext *); -*/ -template -class QGLContextResource : public QGLContextResourceBase -{ -public: - ~QGLContextResource() { - for (int i = 0; i < m_contexts.size(); ++i) { - const QGLContext *context = m_contexts.at(i); - T *resource = reinterpret_cast(QGLContextResourceBase::value(context)); - if (resource) { - QGLShareContextScope scope(context); - delete resource; - } - } - } - - T *value(const QGLContext *context) { - T *resource = reinterpret_cast(QGLContextResourceBase::value(context)); - if (!resource) { - resource = new T(context); - insert(context, resource); - } - return resource; - } - -protected: - void freeResource(void *resource) { - delete reinterpret_cast(resource); - } -}; +extern QPaintEngine* qt_qgl_paint_engine(); // Put a guard around a GL object identifier and its context. // When the context goes away, a shared context will be used // in its place. If there are no more shared contexts, then // the identifier is returned as zero - it is assumed that the // context destruction cleaned up the identifier in this case. -class Q_OPENGL_EXPORT QGLSharedResourceGuard +class QGLSharedResourceGuardBase : public QOpenGLSharedResource { public: - QGLSharedResourceGuard(const QGLContext *context) - : m_group(0), m_id(0), m_next(0), m_prev(0) + QGLSharedResourceGuardBase(QGLContext *context, GLuint id) + : QOpenGLSharedResource(context->contextHandle()->shareGroup()) + , m_id(id) { - setContext(context); } - QGLSharedResourceGuard(const QGLContext *context, GLuint id) - : m_group(0), m_id(id), m_next(0), m_prev(0) - { - setContext(context); - } - ~QGLSharedResourceGuard(); - - const QGLContext *context() const - { - return m_group ? m_group->context() : 0; - } - - void setContext(const QGLContext *context); GLuint id() const { return m_id; } - void setId(GLuint id) +protected: + void invalidateResource() { - m_id = id; + m_id = 0; + } + + void freeResource(QOpenGLContext *context) + { + if (m_id) { + freeResource(QGLContext::fromOpenGLContext(context), m_id); + } + } + + virtual void freeResource(QGLContext *ctx, GLuint id) = 0; + +private: + GLuint m_id; +}; + +template +class QGLSharedResourceGuard : public QGLSharedResourceGuardBase +{ +public: + QGLSharedResourceGuard(QGLContext *context, GLuint id, Func func) + : QGLSharedResourceGuardBase(context, id) + , m_func(func) + { + } + +protected: + void freeResource(QGLContext *ctx, GLuint id) + { + m_func(ctx, id); } private: - QGLContextGroup *m_group; - GLuint m_id; - QGLSharedResourceGuard *m_next; - QGLSharedResourceGuard *m_prev; - - friend class QGLContextGroup; + Func m_func; }; +template +QGLSharedResourceGuardBase *createSharedResourceGuard(QGLContext *context, GLuint id, Func cleanupFunc) +{ + return new QGLSharedResourceGuard(context, id, cleanupFunc); +} class QGLExtensionMatcher { diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 9ba8b75362b..afa2772a6f8 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -40,12 +40,14 @@ ****************************************************************************/ #include -#include +#include #include #include -#include +#include +#include #include +#include #include "qgl.h" #include "qgl_p.h" @@ -53,81 +55,66 @@ QT_BEGIN_NAMESPACE /*! - Returns an OpenGL format for the platform window format specified by \a format. + Returns an OpenGL format for the window format specified by \a format. */ -QGLFormat QGLFormat::fromPlatformWindowFormat(const QPlatformWindowFormat &format) +QGLFormat QGLFormat::fromSurfaceFormat(const QSurfaceFormat &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) + if (format.depthBufferSize() >= 0) + retFormat.setDepthBufferSize(format.depthBufferSize()); + if (format.samples() > 1) { + retFormat.setSampleBuffers(format.samples()); + retFormat.setSamples(true); + } + if (format.stencilBufferSize() > 0) { + retFormat.setStencil(true); retFormat.setStencilBufferSize(format.stencilBufferSize()); + } + retFormat.setDoubleBuffer(format.swapBehavior() != QSurfaceFormat::SingleBuffer); retFormat.setStereo(format.stereo()); - retFormat.setSwapInterval(format.swapInterval()); return retFormat; } /*! - Returns a platform window format for the OpenGL format specified by \a format. + Returns a window format for the OpenGL format specified by \a format. */ -QPlatformWindowFormat QGLFormat::toPlatformWindowFormat(const QGLFormat &format) +QSurfaceFormat QGLFormat::toSurfaceFormat(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()); + QSurfaceFormat retFormat; + if (format.alpha()) + retFormat.setAlphaBufferSize(format.alphaBufferSize() == -1 ? 1 : 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()); - if (format.samples() >= 0) - retFormat.setSamples(format.samples()); - retFormat.setStencil(format.stencil()); - if (format.stencilBufferSize() >= 0) - retFormat.setStencilBufferSize(format.stencilBufferSize()); + if (format.depth()) + retFormat.setDepthBufferSize(format.depthBufferSize() == -1 ? 1 : format.depthBufferSize()); + retFormat.setSwapBehavior(format.doubleBuffer() ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::DefaultSwapBehavior); + if (format.sampleBuffers()) + retFormat.setSamples(format.samples() == -1 ? 4 : format.samples()); + if (format.stencil()) + retFormat.setStencilBufferSize(format.stencilBufferSize() == -1 ? 1 : format.stencilBufferSize()); retFormat.setStereo(format.stereo()); - retFormat.setSwapInterval(format.swapInterval()); return retFormat; } void QGLContextPrivate::setupSharing() { Q_Q(QGLContext); - QPlatformGLContext *sharedPlatformGLContext = platformContext->platformWindowFormat().sharedGLContext(); - if (sharedPlatformGLContext) { - QGLContext *actualSharedContext = QGLContext::fromPlatformGLContext(sharedPlatformGLContext); + QOpenGLContext *sharedContext = guiGlContext->shareContext(); + if (sharedContext) { + QGLContext *actualSharedContext = QGLContext::fromOpenGLContext(sharedContext); sharing = true; - QGLContextGroup::addShare(q,actualSharedContext); + QGLContextGroup::addShare(q, actualSharedContext); } } @@ -150,26 +137,30 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) d->valid = false; }else { QWidget *widget = static_cast(d->paintDevice); - if (!widget->platformWindow()){ - QGLFormat glformat = format(); - QPlatformWindowFormat winFormat = QGLFormat::toPlatformWindowFormat(glformat); - if (shareContext) { - winFormat.setSharedContext(shareContext->d_func()->platformContext); - } - if (widget->testAttribute(Qt::WA_TranslucentBackground)) - winFormat.setAlpha(true); - winFormat.setWindowApi(QPlatformWindowFormat::OpenGL); - winFormat.setWindowSurface(false); - widget->setPlatformWindowFormat(winFormat); + QGLFormat glformat = format(); + QSurfaceFormat winFormat = QGLFormat::toSurfaceFormat(glformat); + if (widget->testAttribute(Qt::WA_TranslucentBackground)) + winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8)); + + if (!widget->windowHandle()->handle()) { + widget->windowHandle()->setSurfaceType(QWindow::OpenGLSurface); + widget->windowHandle()->setFormat(winFormat); widget->winId();//make window } - d->platformContext = widget->platformWindow()->glContext(); - Q_ASSERT(d->platformContext); - d->glFormat = QGLFormat::fromPlatformWindowFormat(d->platformContext->platformWindowFormat()); - d->valid =(bool) d->platformContext; - if (d->valid) { - d->platformContext->setQGLContextHandle(this,qDeleteQGLContext); - } + + if (d->ownContext) + delete d->guiGlContext; + d->ownContext = true; + QOpenGLContext *shareGlContext = shareContext ? shareContext->d_func()->guiGlContext : 0; + d->guiGlContext = new QOpenGLContext; + d->guiGlContext->setFormat(winFormat); + d->guiGlContext->setShareContext(shareGlContext); + d->valid = d->guiGlContext->create(); + + if (d->valid) + d->guiGlContext->setQGLContextHandle(this,qDeleteQGLContext); + + d->glFormat = QGLFormat::fromSurfaceFormat(d->guiGlContext->format()); d->setupSharing(); } @@ -190,42 +181,60 @@ void QGLContext::reset() d->transpColor = QColor(); d->initDone = false; QGLContextGroup::removeShare(this); - if (d->platformContext) { - d->platformContext->setQGLContextHandle(0,0); + if (d->guiGlContext) { + if (d->ownContext) + delete d->guiGlContext; + else + d->guiGlContext->setQGLContextHandle(0,0); + d->guiGlContext = 0; } + d->ownContext = false; } void QGLContext::makeCurrent() { Q_D(QGLContext); - d->platformContext->makeCurrent(); + if (!d->paintDevice || d->paintDevice->devType() != QInternal::Widget) + return; - if (!d->workaroundsCached) { - d->workaroundsCached = true; - const char *renderer = reinterpret_cast(glGetString(GL_RENDERER)); - if (renderer && strstr(renderer, "Mali")) { - d->workaround_brokenFBOReadBack = true; + QWidget *widget = static_cast(d->paintDevice); + if (!widget->windowHandle()) + return; + + if (d->guiGlContext->makeCurrent(widget->windowHandle())) { + if (!d->workaroundsCached) { + d->workaroundsCached = true; + const char *renderer = reinterpret_cast(glGetString(GL_RENDERER)); + if (renderer && strstr(renderer, "Mali")) { + d->workaround_brokenFBOReadBack = true; + } } } - } void QGLContext::doneCurrent() { Q_D(QGLContext); - d->platformContext->doneCurrent(); + d->guiGlContext->doneCurrent(); } void QGLContext::swapBuffers() const { Q_D(const QGLContext); - d->platformContext->swapBuffers(); + if (!d->paintDevice || d->paintDevice->devType() != QInternal::Widget) + return; + + QWidget *widget = static_cast(d->paintDevice); + if (!widget->windowHandle()) + return; + + d->guiGlContext->swapBuffers(widget->windowHandle()); } void *QGLContext::getProcAddress(const QString &procName) const { Q_D(const QGLContext); - return d->platformContext->getProcAddress(procName); + return (void *)d->guiGlContext->getProcAddress(procName.toAscii()); } void QGLWidget::setContext(QGLContext *context, @@ -283,33 +292,34 @@ void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) class QGLTemporaryContextPrivate { public: - QWidget *widget; - QPlatformGLContext *context; + QWindow *window; + QOpenGLContext *context; + + QGLContext *oldContext; }; QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) : d(new QGLTemporaryContextPrivate) { - d->context = const_cast(QPlatformGLContext::currentContext()); - if (d->context) - d->context->doneCurrent(); - d->widget = new QWidget; - d->widget->setGeometry(0,0,3,3); - QPlatformWindowFormat format = d->widget->platformWindowFormat(); - format.setWindowApi(QPlatformWindowFormat::OpenGL); - format.setWindowSurface(false); - d->widget->setPlatformWindowFormat(format); - d->widget->winId(); + d->oldContext = const_cast(QGLContext::currentContext()); - d->widget->platformWindow()->glContext()->makeCurrent(); + d->window = new QWindow; + d->window->setSurfaceType(QWindow::OpenGLSurface); + d->window->setGeometry(QRect(0, 0, 3, 3)); + d->window->create(); + + d->context = new QOpenGLContext; + d->context->create(); + d->context->makeCurrent(d->window); } QGLTemporaryContext::~QGLTemporaryContext() { - d->widget->platformWindow()->glContext()->doneCurrent(); - if (d->context) - d->context->makeCurrent(); - delete d->widget; + if (d->oldContext) + d->oldContext->makeCurrent(); + + delete d->context; + delete d->window; } @@ -375,29 +385,35 @@ void QGLWidget::setColormap(const QGLColormap & c) Q_UNUSED(c); } -QGLContext::QGLContext(QPlatformGLContext *platformContext) +QGLContext::QGLContext(QOpenGLContext *context) : d_ptr(new QGLContextPrivate(this)) { Q_D(QGLContext); - d->init(0,QGLFormat::fromPlatformWindowFormat(platformContext->platformWindowFormat())); - d->platformContext = platformContext; - d->platformContext->setQGLContextHandle(this,qDeleteQGLContext); - d->valid = true; + d->init(0, QGLFormat::fromSurfaceFormat(context->format())); + d->guiGlContext = context; + d->guiGlContext->setQGLContextHandle(this,qDeleteQGLContext); + d->ownContext = false; + d->valid = context->isValid(); d->setupSharing(); } -/*! - Returns a OpenGL context for the platform-specific OpenGL context given by - \a platformContext. -*/ -QGLContext *QGLContext::fromPlatformGLContext(QPlatformGLContext *platformContext) +QOpenGLContext *QGLContext::contextHandle() const { - if (!platformContext) + Q_D(const QGLContext); + return d->guiGlContext; +} + +/*! + Returns a OpenGL context for the window context specified by \a windowContext +*/ +QGLContext *QGLContext::fromOpenGLContext(QOpenGLContext *context) +{ + if (!context) return 0; - if (platformContext->qGLContextHandle()) { - return reinterpret_cast(platformContext->qGLContextHandle()); + if (context->qGLContextHandle()) { + return reinterpret_cast(context->qGLContextHandle()); } - QGLContext *glContext = new QGLContext(platformContext); + QGLContext *glContext = new QGLContext(context); //Dont call create on context. This can cause the platformFormat to be set on the widget, which //will cause the platformWindow to be recreated. return glContext; diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp deleted file mode 100644 index c0844786e29..00000000000 --- a/src/opengl/qgl_qws.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgl.h" -#include "qgl_egl_p.h" -#include "qglpixelbuffer.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -static QGLScreen *glScreenForDevice(QPaintDevice *device) -{ - QScreen *screen = qt_screen; - if (screen->classId() == QScreen::MultiClass) { - int screenNumber; - if (device && device->devType() == QInternal::Widget) - screenNumber = qApp->desktop()->screenNumber(static_cast(device)); - else - screenNumber = 0; - screen = screen->subScreens()[screenNumber]; - } - while (screen->classId() == QScreen::ProxyClass || - screen->classId() == QScreen::TransformedClass) { - screen = static_cast(screen)->screen(); - } - if (screen->classId() == QScreen::GLClass) - return static_cast(screen); - else - return 0; -} - -/* - 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; -} - -/***************************************************************************** - QOpenGL debug facilities - *****************************************************************************/ -//#define DEBUG_OPENGL_REGION_UPDATE - -bool QGLFormat::hasOpenGLOverlays() -{ - QGLScreen *glScreen = glScreenForDevice(0); - if (glScreen) - return (glScreen->options() & QGLScreen::Overlays); - else - return false; -} - -static EGLSurface qt_egl_create_surface - (QEglContext *context, QPaintDevice *device, - const QEglProperties *properties = 0) -{ - // Get the screen surface functions, which are used to create native ids. - QGLScreen *glScreen = glScreenForDevice(device); - if (!glScreen) - return EGL_NO_SURFACE; - QGLScreenSurfaceFunctions *funcs = glScreen->surfaceFunctions(); - if (!funcs) - return EGL_NO_SURFACE; - - // Create the native drawable for the paint device. - int devType = device->devType(); - EGLNativePixmapType pixmapDrawable = 0; - EGLNativeWindowType windowDrawable = 0; - bool ok; - if (devType == QInternal::Pixmap) { - ok = funcs->createNativePixmap(static_cast(device), &pixmapDrawable); - } else if (devType == QInternal::Image) { - ok = funcs->createNativeImage(static_cast(device), &pixmapDrawable); - } else { - ok = funcs->createNativeWindow(static_cast(device), &windowDrawable); - } - if (!ok) { - qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable"); - return EGL_NO_SURFACE; - } - - // Create the EGL surface to draw into, based on the native drawable. - const int *props; - if (properties) - props = properties->properties(); - else - props = 0; - EGLSurface surf; - if (devType == QInternal::Widget) { - surf = eglCreateWindowSurface - (context->display(), context->config(), windowDrawable, props); - } else { - surf = eglCreatePixmapSurface - (context->display(), context->config(), pixmapDrawable, props); - } - if (surf == EGL_NO_SURFACE) - qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); - return surf; -} - -bool QGLContext::chooseContext(const QGLContext* shareContext) -{ - Q_D(QGLContext); - - // Validate the device. - if (!device()) - return false; - int devType = device()->devType(); - if (devType != QInternal::Pixmap && devType != QInternal::Image && devType != QInternal::Widget) { - qWarning("QGLContext::chooseContext(): Cannot create QGLContext's for paint device type %d", devType); - return false; - } - - // Get the display and initialize it. - d->eglContext = new QEglContext(); - d->ownsEglContext = true; - d->eglContext->setApi(QEgl::OpenGL); - - // Construct the configuration we need for this surface. - QEglProperties configProps; - qt_eglproperties_set_glformat(configProps, d->glFormat); - configProps.setDeviceType(devType); - configProps.setPaintDeviceFormat(device()); - configProps.setRenderableType(QEgl::OpenGL); - - // Search for a matching configuration, reducing the complexity - // each time until we get something that matches. - if (!d->eglContext->chooseConfig(configProps)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - - // Inform the higher layers about the actual format properties. - qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config()); - - // Create a new context for the configuration. - if (!d->eglContext->createContext - (shareContext ? shareContext->d_func()->eglContext : 0)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - d->sharing = d->eglContext->isSharing(); - if (d->sharing && shareContext) - const_cast(shareContext)->d_func()->sharing = true; - -#if defined(EGL_VERSION_1_1) - if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget) - eglSwapInterval(d->eglContext->display(), d->glFormat.swapInterval()); -#endif - - // Create the EGL surface to draw into. We cannot use - // QEglContext::createSurface() because it does not have - // access to the QGLScreen. - d->eglSurface = qt_egl_create_surface(d->eglContext, device()); - if (d->eglSurface == EGL_NO_SURFACE) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - - return true; -} - - -bool QGLWidget::event(QEvent *e) -{ - return QWidget::event(e); -} - - -void QGLWidget::resizeEvent(QResizeEvent *) -{ - Q_D(QGLWidget); - if (!isValid()) - return; - makeCurrent(); - if (!d->glcx->initialized()) - glInit(); - resizeGL(width(), height()); - //handle overlay -} - -const QGLContext* QGLWidget::overlayContext() const -{ - return 0; -} - -void QGLWidget::makeOverlayCurrent() -{ - //handle overlay -} - -void QGLWidget::updateOverlayGL() -{ - //handle overlay -} - -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(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) -{ - Q_Q(QGLWidget); - - QGLScreen *glScreen = glScreenForDevice(q); - if (glScreen) { - wsurf = static_cast(glScreen->createSurface(q)); - q->setWindowSurface(wsurf); - } - - initContext(context, shareWidget); - - if(q->isValid() && glcx->format().hasOverlay()) { - //no overlay - qWarning("QtOpenGL ES doesn't currently support overlays"); - } -} - -void QGLWidgetPrivate::cleanupColormaps() -{ -} - -const QGLColormap & QGLWidget::colormap() const -{ - return d_func()->cmap; -} - -void QGLWidget::setColormap(const QGLColormap &) -{ -} - -QT_END_NAMESPACE diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp deleted file mode 100644 index bc65bcd44a4..00000000000 --- a/src/opengl/qgl_symbian.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include "qgl.h" -#include -#include -#include -#include -#include -#include -#include // to access QWExtra -#include -#include "qgl_egl_p.h" -#include "qpixmapdata_gl_p.h" -#include "qgltexturepool_p.h" -#include "qcolormap.h" -#include - -QT_BEGIN_NAMESPACE - -// Turn off "direct to window" rendering if EGL cannot support it. -#if !defined(EGL_RENDER_BUFFER) || !defined(EGL_SINGLE_BUFFER) -#if defined(QGL_DIRECT_TO_WINDOW) -#undef QGL_DIRECT_TO_WINDOW -#endif -#endif - -// Determine if preserved window contents should be used. -#if !defined(EGL_SWAP_BEHAVIOR) || !defined(EGL_BUFFER_PRESERVED) -#if !defined(QGL_NO_PRESERVED_SWAP) -#define QGL_NO_PRESERVED_SWAP 1 -#endif -#endif - -extern int qt_gl_pixmap_serial; - -/* - QGLTemporaryContext implementation -*/ - - -class QGLTemporaryContextPrivate -{ -public: - bool initialized; - RWindow *window; - EGLContext context; - EGLSurface surface; - EGLDisplay display; -}; - -QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) - : d(new QGLTemporaryContextPrivate) -{ - d->initialized = false; - d->window = 0; - d->context = 0; - d->surface = 0; - - d->display = d->display = QEgl::display(); - - EGLConfig config; - int numConfigs = 0; - EGLint attribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, -#ifdef QT_OPENGL_ES_2 - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, -#endif - EGL_NONE - }; - - eglChooseConfig(d->display, attribs, &config, 1, &numConfigs); - if (!numConfigs) { - qWarning("QGLTemporaryContext: No EGL configurations available."); - return; - } - - d->window = new RWindow(CCoeEnv::Static()->WsSession()); - d->window->Construct(CCoeEnv::Static()->RootWin(),(uint)this); - - d->surface = eglCreateWindowSurface(d->display, config, (EGLNativeWindowType) d->window, NULL); - - if (d->surface == EGL_NO_SURFACE) { - qWarning("QGLTemporaryContext: Error creating EGL surface."); - delete d->window; - d->window = 0; - return; - } - - EGLint contextAttribs[] = { -#ifdef QT_OPENGL_ES_2 - EGL_CONTEXT_CLIENT_VERSION, 2, -#endif - EGL_NONE - }; - d->context = eglCreateContext(d->display, config, 0, contextAttribs); - if (d->context != EGL_NO_CONTEXT - && eglMakeCurrent(d->display, d->surface, d->surface, d->context)) - { - d->initialized = true; - } else { - qWarning("QGLTemporaryContext: Error creating EGL context."); - d->window = 0; - return; - } -} - -QGLTemporaryContext::~QGLTemporaryContext() -{ - if (d->initialized) { - eglMakeCurrent(d->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroyContext(d->display, d->context); - eglDestroySurface(d->display, d->surface); - delete d->window; - } -} - -bool QGLFormat::hasOpenGLOverlays() -{ - return false; -} - -// Chooses the EGL config and creates the EGL context -bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as in qgl_x11egl.cpp -{ - Q_D(QGLContext); - - if (!device()) - return false; - - int devType = device()->devType(); - - if ((devType != QInternal::Widget) && (devType != QInternal::Pbuffer)) { - qWarning("WARNING: Creating a QGLContext not supported on device type %d", devType); - return false; - } - - // Get the display and initialize it. - if (d->eglContext == 0) { - d->eglContext = new QEglContext(); - d->ownsEglContext = true; - d->eglContext->setApi(QEgl::OpenGL); - - // If the device is a widget with WA_TranslucentBackground set, make sure the glFormat - // has the alpha channel option set: - if (devType == QInternal::Widget) { - QWidget* widget = static_cast(device()); - if (widget->testAttribute(Qt::WA_TranslucentBackground)) - d->glFormat.setAlpha(true); - } - - // Construct the configuration we need for this surface. - QEglProperties configProps; - configProps.setDeviceType(devType); - configProps.setPaintDeviceFormat(device()); - configProps.setRenderableType(QEgl::OpenGL); - configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_SWAP_BEHAVIOR_PRESERVED_BIT); - - qt_eglproperties_set_glformat(configProps, d->glFormat); - - if (!d->eglContext->chooseConfig(configProps, QEgl::BestPixelFormat)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - - // Create a new context for the configuration. - QEglContext* eglSharedContext = shareContext ? shareContext->d_func()->eglContext : 0; - if (!d->eglContext->createContext(eglSharedContext)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - d->sharing = d->eglContext->isSharing(); - if (d->sharing && shareContext) - const_cast(shareContext)->d_func()->sharing = true; - } - - // Inform the higher layers about the actual format properties - qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config()); - - // Do don't create the EGLSurface for everything. - // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface - // QGLWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface - // QGLPixelBuffer - no, it creates the surface itself and stores it in QGLPixelBufferPrivate::pbuf - - if (devType == QInternal::Widget) { - if (d->eglSurface != EGL_NO_SURFACE) - eglDestroySurface(d->eglContext->display(), d->eglSurface); - - d->eglSurface = QEgl::createSurface(device(), d->eglContext->config()); - - eglGetError(); // Clear error state first. - -#ifdef QGL_NO_PRESERVED_SWAP - eglSurfaceAttrib(QEgl::display(), d->eglSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); - - if (eglGetError() != EGL_SUCCESS) - qWarning("QGLContext: could not enable destroyed swap behaviour"); -#else - eglSurfaceAttrib(QEgl::display(), d->eglSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - - if (eglGetError() != EGL_SUCCESS) - qWarning("QGLContext: could not enable preserved swap behaviour"); -#endif - - setWindowCreated(true); - } - - return true; -} - -void QGLWidget::resizeEvent(QResizeEvent *) -{ - Q_D(QGLWidget); - if (!isValid()) - return; - - if (QGLContext::currentContext()) - doneCurrent(); - - // Symbian needs to recreate the surface on resize. - d->recreateEglSurface(); - - makeCurrent(); - if (!d->glcx->initialized()) - glInit(); - resizeGL(width(), height()); - //handle overlay -} - -const QGLContext* QGLWidget::overlayContext() const -{ - return 0; -} - -void QGLWidget::makeOverlayCurrent() -{ - //handle overlay -} - -void QGLWidget::updateOverlayGL() -{ - //handle overlay -} - -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; - - bool createFailed = false; - if (!d->glcx->isValid()) { - // Create the QGLContext here, which in turn chooses the EGL config - // and creates the EGL context: - if (!d->glcx->create(shareContext ? shareContext : oldcx)) - createFailed = true; - } - if (createFailed) { - if (deleteOldContext) - delete oldcx; - return; - } - - d->eglSurfaceWindowId = winId(); // Remember the window id we created the surface for -} - -void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget* shareWidget) -{ - Q_Q(QGLWidget); - - initContext(context, shareWidget); - - if(q->isValid() && glcx->format().hasOverlay()) { - //no overlay - qWarning("QtOpenGL ES doesn't currently support overlays"); - } -} - -void QGLWidgetPrivate::cleanupColormaps() -{ -} - -const QGLColormap & QGLWidget::colormap() const -{ - return d_func()->cmap; -} - -void QGLWidget::setColormap(const QGLColormap &) -{ -} - -void QGLWidgetPrivate::recreateEglSurface() -{ - Q_Q(QGLWidget); - - WId currentId = q->winId(); - - if (glcx->d_func()->eglSurface != EGL_NO_SURFACE) { - eglDestroySurface(glcx->d_func()->eglContext->display(), - glcx->d_func()->eglSurface); - } - - glcx->d_func()->eglSurface = QEgl::createSurface(glcx->device(), - glcx->d_func()->eglContext->config()); - -#if !defined(QGL_NO_PRESERVED_SWAP) - eglGetError(); // Clear error state first. - eglSurfaceAttrib(QEgl::display(), glcx->d_func()->eglSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - if (eglGetError() != EGL_SUCCESS) { - qWarning("QGLContext: could not enable preserved swap"); - } -#endif - - eglSurfaceWindowId = currentId; -} - -static inline bool knownGoodFormat(QImage::Format format) -{ - switch (format) { - case QImage::Format_RGB16: // EColor64K - case QImage::Format_RGB32: // EColor16MU - case QImage::Format_ARGB32_Premultiplied: // EColor16MAP - return true; - default: - return false; - } -} - -void QGLPixmapData::fromNativeType(void* pixmap, NativeType type) -{ - if (type == QPixmapData::FbsBitmap) { - CFbsBitmap *bitmap = reinterpret_cast(pixmap); - QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight); - if (size.width() == w && size.height() == h) - setSerialNumber(++qt_gl_pixmap_serial); - resize(size.width(), size.height()); - m_source = QVolatileImage(bitmap); - if (pixelType() == BitmapType) { - m_source.ensureFormat(QImage::Format_MonoLSB); - } else if (!knownGoodFormat(m_source.format())) { - m_source.beginDataAccess(); - QImage::Format format = idealFormat(m_source.imageRef(), Qt::AutoColor); - m_source.endDataAccess(true); - m_source.ensureFormat(format); - } - m_hasAlpha = m_source.hasAlphaChannel(); - m_hasFillColor = false; - m_dirty = true; - - } else if (type == QPixmapData::VolatileImage && pixmap) { - // Support QS60Style in more efficient skin graphics retrieval. - QVolatileImage *img = static_cast(pixmap); - if (img->width() == w && img->height() == h) - setSerialNumber(++qt_gl_pixmap_serial); - resize(img->width(), img->height()); - m_source = *img; - m_hasAlpha = m_source.hasAlphaChannel(); - m_hasFillColor = false; - m_dirty = true; - } else if (type == QPixmapData::NativeImageHandleProvider && pixmap) { - destroyTexture(); - nativeImageHandleProvider = static_cast(pixmap); - // Cannot defer the retrieval, we need at least the size right away. - createFromNativeImageHandleProvider(); - } -} - -void* QGLPixmapData::toNativeType(NativeType type) -{ - if (type == QPixmapData::FbsBitmap) { - if (m_source.isNull()) - m_source = QVolatileImage(w, h, QImage::Format_ARGB32_Premultiplied); - return m_source.duplicateNativeImage(); - } - - return 0; -} - -bool QGLPixmapData::initFromNativeImageHandle(void *handle, const QString &type) -{ - if (type == QLatin1String("RSgImage")) { - fromNativeType(handle, QPixmapData::SgImage); - return true; - } else if (type == QLatin1String("CFbsBitmap")) { - fromNativeType(handle, QPixmapData::FbsBitmap); - return true; - } - return false; -} - -void QGLPixmapData::createFromNativeImageHandleProvider() -{ - void *handle = 0; - QString type; - nativeImageHandleProvider->get(&handle, &type); - if (handle) { - if (initFromNativeImageHandle(handle, type)) { - nativeImageHandle = handle; - nativeImageType = type; - } else { - qWarning("QGLPixmapData: Unknown native image type '%s'", qPrintable(type)); - } - } else { - qWarning("QGLPixmapData: Native handle is null"); - } -} - -void QGLPixmapData::releaseNativeImageHandle() -{ - if (nativeImageHandleProvider && nativeImageHandle) { - nativeImageHandleProvider->release(nativeImageHandle, nativeImageType); - nativeImageHandle = 0; - nativeImageType = QString(); - } -} - -QT_END_NAMESPACE diff --git a/src/opengl/qgl_win.cpp b/src/opengl/qgl_win.cpp deleted file mode 100644 index 3b1643f4c26..00000000000 --- a/src/opengl/qgl_win.cpp +++ /dev/null @@ -1,1601 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -typedef bool (APIENTRY *PFNWGLGETPIXELFORMATATTRIBIVARB)(HDC hdc, - int iPixelFormat, - int iLayerPlane, - uint nAttributes, - const int *piAttributes, - int *piValues); -typedef bool (APIENTRY *PFNWGLCHOOSEPIXELFORMATARB)(HDC hdc, - const int *piAttribList, - const float *pfAttribFList, - uint nMaxFormats, - int *piFormats, - UINT *nNumFormats); -#ifndef WGL_ARB_multisample -#define WGL_SAMPLE_BUFFERS_ARB 0x2041 -#define WGL_SAMPLES_ARB 0x2042 -#endif - -#ifndef WGL_ARB_pixel_format -#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 -#define WGL_DRAW_TO_WINDOW_ARB 0x2001 -#define WGL_DRAW_TO_BITMAP_ARB 0x2002 -#define WGL_ACCELERATION_ARB 0x2003 -#define WGL_NEED_PALETTE_ARB 0x2004 -#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 -#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 -#define WGL_SWAP_METHOD_ARB 0x2007 -#define WGL_NUMBER_OVERLAYS_ARB 0x2008 -#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 -#define WGL_TRANSPARENT_ARB 0x200A -#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 -#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 -#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 -#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A -#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B -#define WGL_SHARE_DEPTH_ARB 0x200C -#define WGL_SHARE_STENCIL_ARB 0x200D -#define WGL_SHARE_ACCUM_ARB 0x200E -#define WGL_SUPPORT_GDI_ARB 0x200F -#define WGL_SUPPORT_OPENGL_ARB 0x2010 -#define WGL_DOUBLE_BUFFER_ARB 0x2011 -#define WGL_STEREO_ARB 0x2012 -#define WGL_PIXEL_TYPE_ARB 0x2013 -#define WGL_COLOR_BITS_ARB 0x2014 -#define WGL_RED_BITS_ARB 0x2015 -#define WGL_RED_SHIFT_ARB 0x2016 -#define WGL_GREEN_BITS_ARB 0x2017 -#define WGL_GREEN_SHIFT_ARB 0x2018 -#define WGL_BLUE_BITS_ARB 0x2019 -#define WGL_BLUE_SHIFT_ARB 0x201A -#define WGL_ALPHA_BITS_ARB 0x201B -#define WGL_ALPHA_SHIFT_ARB 0x201C -#define WGL_ACCUM_BITS_ARB 0x201D -#define WGL_ACCUM_RED_BITS_ARB 0x201E -#define WGL_ACCUM_GREEN_BITS_ARB 0x201F -#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 -#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 -#define WGL_DEPTH_BITS_ARB 0x2022 -#define WGL_STENCIL_BITS_ARB 0x2023 -#define WGL_AUX_BUFFERS_ARB 0x2024 -#define WGL_NO_ACCELERATION_ARB 0x2025 -#define WGL_GENERIC_ACCELERATION_ARB 0x2026 -#define WGL_FULL_ACCELERATION_ARB 0x2027 -#define WGL_SWAP_EXCHANGE_ARB 0x2028 -#define WGL_SWAP_COPY_ARB 0x2029 -#define WGL_SWAP_UNDEFINED_ARB 0x202A -#define WGL_TYPE_RGBA_ARB 0x202B -#define WGL_TYPE_COLORINDEX_ARB 0x202C -#endif - -#ifndef WGL_ARB_create_context -#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 -#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 -#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 -#define WGL_CONTEXT_FLAGS_ARB 0x2094 -#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 -#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 -#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 -#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x0001 -#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x0002 -// Error codes returned by GetLastError(). -#define ERROR_INVALID_VERSION_ARB 0x2095 -#define ERROR_INVALID_PROFILE_ARB 0x2096 -#endif - -#ifndef GL_VERSION_3_2 -#define GL_CONTEXT_PROFILE_MASK 0x9126 -#define GL_MAJOR_VERSION 0x821B -#define GL_MINOR_VERSION 0x821C -#define GL_NUM_EXTENSIONS 0x821D -#define GL_CONTEXT_FLAGS 0x821E -#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 -#endif - -QT_BEGIN_NAMESPACE - -class QGLCmapPrivate -{ -public: - QGLCmapPrivate() : count(1) { } - void ref() { ++count; } - bool deref() { return !--count; } - uint count; - - enum AllocState{ UnAllocated = 0, Allocated = 0x01, Reserved = 0x02 }; - - int maxSize; - QVector colorArray; - QVector allocArray; - QVector contextArray; - QMap colorMap; -}; - -/***************************************************************************** - QColorMap class - temporarily here, until it is ready for prime time - *****************************************************************************/ - -/**************************************************************************** -** -** Definition of QColorMap class -** -****************************************************************************/ - -class QGLCmapPrivate; - -class /*Q_EXPORT*/ QGLCmap -{ -public: - enum Flags { Reserved = 0x01 }; - - QGLCmap(int maxSize = 256); - QGLCmap(const QGLCmap& map); - ~QGLCmap(); - - QGLCmap& operator=(const QGLCmap& map); - - // isEmpty and/or isNull ? - int size() const; - int maxSize() const; - - void resize(int newSize); - - int find(QRgb color) const; - int findNearest(QRgb color) const; - int allocate(QRgb color, uint flags = 0, quint8 context = 0); - - void setEntry(int idx, QRgb color, uint flags = 0, quint8 context = 0); - - const QRgb* colors() const; - -private: - void detach(); - QGLCmapPrivate* d; -}; - - -QGLCmap::QGLCmap(int maxSize) // add a bool prealloc? -{ - d = new QGLCmapPrivate; - d->maxSize = maxSize; -} - - -QGLCmap::QGLCmap(const QGLCmap& map) -{ - d = map.d; - d->ref(); -} - - -QGLCmap::~QGLCmap() -{ - if (d && d->deref()) - delete d; - d = 0; -} - - -QGLCmap& QGLCmap::operator=(const QGLCmap& map) -{ - map.d->ref(); - if (d->deref()) - delete d; - d = map.d; - return *this; -} - - -int QGLCmap::size() const -{ - return d->colorArray.size(); -} - - -int QGLCmap::maxSize() const -{ - return d->maxSize; -} - - -void QGLCmap::detach() -{ - if (d->count != 1) { - d->deref(); - QGLCmapPrivate* newd = new QGLCmapPrivate; - newd->maxSize = d->maxSize; - newd->colorArray = d->colorArray; - newd->allocArray = d->allocArray; - newd->contextArray = d->contextArray; - newd->colorArray.detach(); - newd->allocArray.detach(); - newd->contextArray.detach(); - newd->colorMap = d->colorMap; - d = newd; - } -} - - -void QGLCmap::resize(int newSize) -{ - if (newSize < 0 || newSize > d->maxSize) { - qWarning("QGLCmap::resize(): size out of range"); - return; - } - int oldSize = size(); - detach(); - //if shrinking; remove the lost elems from colorMap - d->colorArray.resize(newSize); - d->allocArray.resize(newSize); - d->contextArray.resize(newSize); - if (newSize > oldSize) { - memset(d->allocArray.data() + oldSize, 0, newSize - oldSize); - memset(d->contextArray.data() + oldSize, 0, newSize - oldSize); - } -} - - -int QGLCmap::find(QRgb color) const -{ - QMap::ConstIterator it = d->colorMap.find(color); - if (it != d->colorMap.end()) - return *it; - return -1; -} - - -int QGLCmap::findNearest(QRgb color) const -{ - int idx = find(color); - if (idx >= 0) - return idx; - int mapSize = size(); - int mindist = 200000; - int r = qRed(color); - int g = qGreen(color); - int b = qBlue(color); - int rx, gx, bx, dist; - for (int i=0; i < mapSize; i++) { - if (!(d->allocArray[i] & QGLCmapPrivate::Allocated)) - continue; - QRgb ci = d->colorArray[i]; - rx = r - qRed(ci); - gx = g - qGreen(ci); - bx = b - qBlue(ci); - dist = rx*rx + gx*gx + bx*bx; // calculate distance - if (dist < mindist) { // minimal? - mindist = dist; - idx = i; - } - } - return idx; -} - - - - -// Does not always allocate; returns existing c idx if found - -int QGLCmap::allocate(QRgb color, uint flags, quint8 context) -{ - int idx = find(color); - if (idx >= 0) - return idx; - - int mapSize = d->colorArray.size(); - int newIdx = d->allocArray.indexOf(QGLCmapPrivate::UnAllocated); - - if (newIdx < 0) { // Must allocate more room - if (mapSize < d->maxSize) { - newIdx = mapSize; - mapSize++; - resize(mapSize); - } - else { - //# add a bool param that says what to do in case no more room - - // fail (-1) or return nearest? - return -1; - } - } - - d->colorArray[newIdx] = color; - if (flags & QGLCmap::Reserved) { - d->allocArray[newIdx] = QGLCmapPrivate::Reserved; - } - else { - d->allocArray[newIdx] = QGLCmapPrivate::Allocated; - d->colorMap.insert(color, newIdx); - } - d->contextArray[newIdx] = context; - return newIdx; -} - - -void QGLCmap::setEntry(int idx, QRgb color, uint flags, quint8 context) -{ - if (idx < 0 || idx >= d->maxSize) { - qWarning("QGLCmap::set(): Index out of range"); - return; - } - detach(); - int mapSize = size(); - if (idx >= mapSize) { - mapSize = idx + 1; - resize(mapSize); - } - d->colorArray[idx] = color; - if (flags & QGLCmap::Reserved) { - d->allocArray[idx] = QGLCmapPrivate::Reserved; - } - else { - d->allocArray[idx] = QGLCmapPrivate::Allocated; - d->colorMap.insert(color, idx); - } - d->contextArray[idx] = context; -} - - -const QRgb* QGLCmap::colors() const -{ - return d->colorArray.data(); -} - - - -/***************************************************************************** - QGLFormat Win32/WGL-specific code - *****************************************************************************/ - - -void qwglError(const char* method, const char* func) -{ -#ifndef QT_NO_DEBUG - char* lpMsgBuf; - FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - 0, GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (char*) &lpMsgBuf, 0, 0); - qWarning("%s : %s failed: %s", method, func, lpMsgBuf); - LocalFree(lpMsgBuf); -#else - Q_UNUSED(method); - Q_UNUSED(func); -#endif -} - - - -bool QGLFormat::hasOpenGL() -{ - return true; -} - -static bool opengl32dll = false; - -bool QGLFormat::hasOpenGLOverlays() -{ - // workaround for matrox driver: - // make a cheap call to opengl to force loading of DLL - if (!opengl32dll) { - GLint params; - glGetIntegerv(GL_DEPTH_BITS, ¶ms); - opengl32dll = true; - } - - static bool checkDone = false; - static bool hasOl = false; - - if (!checkDone) { - checkDone = true; - HDC display_dc = GetDC(0); - int pfiMax = DescribePixelFormat(display_dc, 0, 0, NULL); - PIXELFORMATDESCRIPTOR pfd; - for (int pfi = 1; pfi <= pfiMax; pfi++) { - DescribePixelFormat(display_dc, pfi, sizeof(PIXELFORMATDESCRIPTOR), &pfd); - if ((pfd.bReserved & 0x0f) && (pfd.dwFlags & PFD_SUPPORT_OPENGL)) { - // This format has overlays/underlays - LAYERPLANEDESCRIPTOR lpd; - wglDescribeLayerPlane(display_dc, pfi, 1, - sizeof(LAYERPLANEDESCRIPTOR), &lpd); - if (lpd.dwFlags & LPD_SUPPORT_OPENGL) { - hasOl = true; - break; - } - } - } - ReleaseDC(0, display_dc); - } - return hasOl; -} - - -/***************************************************************************** - QGLContext Win32/WGL-specific code - *****************************************************************************/ - -static uchar qgl_rgb_palette_comp(int idx, uint nbits, uint shift) -{ - const uchar map_3_to_8[8] = { - 0, 0111>>1, 0222>>1, 0333>>1, 0444>>1, 0555>>1, 0666>>1, 0377 - }; - const uchar map_2_to_8[4] = { - 0, 0x55, 0xaa, 0xff - }; - const uchar map_1_to_8[2] = { - 0, 255 - }; - - uchar val = (uchar) (idx >> shift); - uchar res = 0; - switch (nbits) { - case 1: - val &= 0x1; - res = map_1_to_8[val]; - break; - case 2: - val &= 0x3; - res = map_2_to_8[val]; - break; - case 3: - val &= 0x7; - res = map_3_to_8[val]; - break; - default: - res = 0; - } - return res; -} - - -static QRgb* qgl_create_rgb_palette(const PIXELFORMATDESCRIPTOR* pfd) -{ - if ((pfd->iPixelType != PFD_TYPE_RGBA) || - !(pfd->dwFlags & PFD_NEED_PALETTE) || - (pfd->cColorBits != 8)) - return 0; - int numEntries = 1 << pfd->cColorBits; - QRgb* pal = new QRgb[numEntries]; - for (int i = 0; i < numEntries; i++) { - int r = qgl_rgb_palette_comp(i, pfd->cRedBits, pfd->cRedShift); - int g = qgl_rgb_palette_comp(i, pfd->cGreenBits, pfd->cGreenShift); - int b = qgl_rgb_palette_comp(i, pfd->cBlueBits, pfd->cBlueShift); - pal[i] = qRgb(r, g, b); - } - - const int syscol_indices[12] = { - 3, 24, 27, 64, 67, 88, 173, 181, 236, 247, 164, 91 - }; - - const uint syscols[20] = { - 0x000000, 0x800000, 0x008000, 0x808000, 0x000080, 0x800080, - 0x008080, 0xc0c0c0, 0xc0dcc0, 0xa6caf0, 0xfffbf0, 0xa0a0a4, - 0x808080, 0xff0000, 0x00ff00, 0xffff00, 0x0000ff, 0xff00ff, - 0x00ffff, 0xffffff - }; // colors #1 - #12 are not present in pal; gets added below - - if ((pfd->cColorBits == 8) && - (pfd->cRedBits == 3) && (pfd->cRedShift == 0) && - (pfd->cGreenBits == 3) && (pfd->cGreenShift == 3) && - (pfd->cBlueBits == 2) && (pfd->cBlueShift == 6)) { - for (int j = 0 ; j < 12 ; j++) - pal[syscol_indices[j]] = QRgb(syscols[j+1]); - } - - return pal; -} - -static QGLFormat pfdToQGLFormat(const PIXELFORMATDESCRIPTOR* pfd) -{ - QGLFormat fmt; - fmt.setDoubleBuffer(pfd->dwFlags & PFD_DOUBLEBUFFER); - fmt.setDepth(pfd->cDepthBits); - if (fmt.depth()) - fmt.setDepthBufferSize(pfd->cDepthBits); - fmt.setRgba(pfd->iPixelType == PFD_TYPE_RGBA); - fmt.setRedBufferSize(pfd->cRedBits); - fmt.setGreenBufferSize(pfd->cGreenBits); - fmt.setBlueBufferSize(pfd->cBlueBits); - fmt.setAlpha(pfd->cAlphaBits); - if (fmt.alpha()) - fmt.setAlphaBufferSize(pfd->cAlphaBits); - fmt.setAccum(pfd->cAccumBits); - if (fmt.accum()) - fmt.setAccumBufferSize(pfd->cAccumRedBits); - fmt.setStencil(pfd->cStencilBits); - if (fmt.stencil()) - fmt.setStencilBufferSize(pfd->cStencilBits); - fmt.setStereo(pfd->dwFlags & PFD_STEREO); - fmt.setDirectRendering((pfd->dwFlags & PFD_GENERIC_ACCELERATED) || - !(pfd->dwFlags & PFD_GENERIC_FORMAT)); - fmt.setOverlay((pfd->bReserved & 0x0f) != 0); - return fmt; -} - -/* - NB! requires a current GL context to work -*/ -QGLFormat pfiToQGLFormat(HDC hdc, int pfi) -{ - QGLFormat fmt; - QVarLengthArray iAttributes(40); - QVarLengthArray iValues(40); - int i = 0; - bool has_sample_buffers = QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers; - - iAttributes[i++] = WGL_DOUBLE_BUFFER_ARB; // 0 - iAttributes[i++] = WGL_DEPTH_BITS_ARB; // 1 - iAttributes[i++] = WGL_PIXEL_TYPE_ARB; // 2 - iAttributes[i++] = WGL_RED_BITS_ARB; // 3 - iAttributes[i++] = WGL_GREEN_BITS_ARB; // 4 - iAttributes[i++] = WGL_BLUE_BITS_ARB; // 5 - iAttributes[i++] = WGL_ALPHA_BITS_ARB; // 6 - iAttributes[i++] = WGL_ACCUM_BITS_ARB; // 7 - iAttributes[i++] = WGL_STENCIL_BITS_ARB; // 8 - iAttributes[i++] = WGL_STEREO_ARB; // 9 - iAttributes[i++] = WGL_ACCELERATION_ARB; // 10 - iAttributes[i++] = WGL_NUMBER_OVERLAYS_ARB; // 11 - if (has_sample_buffers) { - iAttributes[i++] = WGL_SAMPLE_BUFFERS_ARB; // 12 - iAttributes[i++] = WGL_SAMPLES_ARB; // 13 - } - PFNWGLGETPIXELFORMATATTRIBIVARB wglGetPixelFormatAttribivARB = - (PFNWGLGETPIXELFORMATATTRIBIVARB) wglGetProcAddress("wglGetPixelFormatAttribivARB"); - - if (wglGetPixelFormatAttribivARB - && wglGetPixelFormatAttribivARB(hdc, pfi, 0, i, - iAttributes.constData(), - iValues.data())) - { - fmt.setDoubleBuffer(iValues[0]); - fmt.setDepth(iValues[1]); - if (fmt.depth()) - fmt.setDepthBufferSize(iValues[1]); - fmt.setRgba(iValues[2] == WGL_TYPE_RGBA_ARB); - fmt.setRedBufferSize(iValues[3]); - fmt.setGreenBufferSize(iValues[4]); - fmt.setBlueBufferSize(iValues[5]); - fmt.setAlpha(iValues[6]); - if (fmt.alpha()) - fmt.setAlphaBufferSize(iValues[6]); - fmt.setAccum(iValues[7]); - if (fmt.accum()) - fmt.setAccumBufferSize(iValues[7]); - fmt.setStencil(iValues[8]); - if (fmt.stencil()) - fmt.setStencilBufferSize(iValues[8]); - fmt.setStereo(iValues[9]); - if (iValues[10] == WGL_FULL_ACCELERATION_ARB) - fmt.setDirectRendering(true); - else - fmt.setDirectRendering(false); - fmt.setOverlay(iValues[11]); - if (has_sample_buffers) { - fmt.setSampleBuffers(iValues[12]); - if (fmt.sampleBuffers()) - fmt.setSamples(iValues[13]); - } - } -#if 0 - qDebug() << "values for pfi:" << pfi; - qDebug() << "doublebuffer 0:" << fmt.doubleBuffer(); - qDebug() << "depthbuffer 1:" << fmt.depthBufferSize(); - qDebug() << "rgba 2:" << fmt.rgba(); - qDebug() << "red size 3:" << fmt.redBufferSize(); - qDebug() << "green size 4:" << fmt.greenBufferSize(); - qDebug() << "blue size 5:" << fmt.blueBufferSize(); - qDebug() << "alpha size 6:" << fmt.alphaBufferSize(); - qDebug() << "accum size 7:" << fmt.accumBufferSize(); - qDebug() << "stencil size 8:" << fmt.stencilBufferSize(); - qDebug() << "stereo 9:" << fmt.stereo(); - qDebug() << "direct 10:" << fmt.directRendering(); - qDebug() << "has overlays 11:" << fmt.hasOverlay(); - qDebug() << "sample buff 12:" << fmt.sampleBuffers(); - qDebug() << "num samples 13:" << fmt.samples(); -#endif - return fmt; -} - - -/* - QGLTemporaryContext implementation -*/ - -Q_GUI_EXPORT const QString qt_getRegisteredWndClass(); - -class QGLTemporaryContextPrivate -{ -public: - HDC dmy_pdc; - HGLRC dmy_rc; - HDC old_dc; - HGLRC old_context; - WId dmy_id; -}; - -QGLTemporaryContext::QGLTemporaryContext(bool directRendering, QWidget *parent) - : d(new QGLTemporaryContextPrivate) -{ - QString windowClassName = qt_getRegisteredWndClass(); - if (parent && !parent->internalWinId()) - parent = parent->nativeParentWidget(); - - d->dmy_id = CreateWindow((const wchar_t *)windowClassName.utf16(), - 0, 0, 0, 0, 1, 1, - parent ? parent->winId() : 0, 0, qWinAppInst(), 0); - - d->dmy_pdc = GetDC(d->dmy_id); - PIXELFORMATDESCRIPTOR dmy_pfd; - memset(&dmy_pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); - dmy_pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); - dmy_pfd.nVersion = 1; - dmy_pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW; - dmy_pfd.iPixelType = PFD_TYPE_RGBA; - if (!directRendering) - dmy_pfd.dwFlags |= PFD_GENERIC_FORMAT; - - int dmy_pf = ChoosePixelFormat(d->dmy_pdc, &dmy_pfd); - SetPixelFormat(d->dmy_pdc, dmy_pf, &dmy_pfd); - d->dmy_rc = wglCreateContext(d->dmy_pdc); - d->old_dc = wglGetCurrentDC(); - d->old_context = wglGetCurrentContext(); - wglMakeCurrent(d->dmy_pdc, d->dmy_rc); -} - -QGLTemporaryContext::~QGLTemporaryContext() -{ - wglMakeCurrent(d->dmy_pdc, 0); - wglDeleteContext(d->dmy_rc); - ReleaseDC(d->dmy_id, d->dmy_pdc); - DestroyWindow(d->dmy_id); - if (d->old_dc && d->old_context) - wglMakeCurrent(d->old_dc, d->old_context); -} - -static bool qgl_create_context(HDC hdc, QGLContextPrivate *d, QGLContextPrivate *shareContext) -{ - d->rc = 0; - - typedef HGLRC (APIENTRYP PFNWGLCREATECONTEXTATTRIBSARB)(HDC, HGLRC, const int *); - PFNWGLCREATECONTEXTATTRIBSARB wglCreateContextAttribsARB = - (PFNWGLCREATECONTEXTATTRIBSARB) wglGetProcAddress("wglCreateContextAttribsARB"); - if (wglCreateContextAttribsARB) { - int attributes[11]; - int attribIndex = 0; - const int major = d->reqFormat.majorVersion(); - const int minor = d->reqFormat.minorVersion(); - attributes[attribIndex++] = WGL_CONTEXT_MAJOR_VERSION_ARB; - attributes[attribIndex++] = major; - attributes[attribIndex++] = WGL_CONTEXT_MINOR_VERSION_ARB; - attributes[attribIndex++] = minor; - - if (major >= 3 && !d->reqFormat.testOption(QGL::DeprecatedFunctions)) { - attributes[attribIndex++] = WGL_CONTEXT_FLAGS_ARB; - attributes[attribIndex++] = WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; - } - - if ((major == 3 && minor >= 2) || major > 3) { - switch (d->reqFormat.profile()) { - case QGLFormat::NoProfile: - break; - case QGLFormat::CoreProfile: - attributes[attribIndex++] = WGL_CONTEXT_PROFILE_MASK_ARB; - attributes[attribIndex++] = WGL_CONTEXT_CORE_PROFILE_BIT_ARB; - break; - case QGLFormat::CompatibilityProfile: - attributes[attribIndex++] = WGL_CONTEXT_PROFILE_MASK_ARB; - attributes[attribIndex++] = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; - break; - default: - qWarning("QGLContext::chooseContext(): Context profile not supported."); - return false; - } - } - - if (d->reqFormat.plane() != 0) { - attributes[attribIndex++] = WGL_CONTEXT_LAYER_PLANE_ARB; - attributes[attribIndex++] = d->reqFormat.plane(); - } - - attributes[attribIndex++] = 0; // Terminate list. - d->rc = wglCreateContextAttribsARB(hdc, shareContext && shareContext->valid - ? shareContext->rc : 0, attributes); - if (d->rc) { - if (shareContext) - shareContext->sharing = d->sharing = true; - return true; - } - } - - d->rc = wglCreateLayerContext(hdc, d->reqFormat.plane()); - if (d->rc && shareContext && shareContext->valid) - shareContext->sharing = d->sharing = wglShareLists(shareContext->rc, d->rc); - return d->rc != 0; -} - -void QGLContextPrivate::updateFormatVersion() -{ - const GLubyte *s = glGetString(GL_VERSION); - - if (!(s && s[0] >= '0' && s[0] <= '9' && s[1] == '.' && s[2] >= '0' && s[2] <= '9')) { - if (!s) - qWarning("QGLContext::chooseContext(): OpenGL version string is null."); - else - qWarning("QGLContext::chooseContext(): Unexpected OpenGL version string format."); - glFormat.setVersion(0, 0); - glFormat.setProfile(QGLFormat::NoProfile); - glFormat.setOption(QGL::DeprecatedFunctions); - return; - } - - int major = s[0] - '0'; - int minor = s[2] - '0'; - glFormat.setVersion(major, minor); - - if (major < 3) { - glFormat.setProfile(QGLFormat::NoProfile); - glFormat.setOption(QGL::DeprecatedFunctions); - } else { - GLint value = 0; - if (major > 3 || minor >= 2) - glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value); - - switch (value) { - case WGL_CONTEXT_CORE_PROFILE_BIT_ARB: - glFormat.setProfile(QGLFormat::CoreProfile); - break; - case WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: - glFormat.setProfile(QGLFormat::CompatibilityProfile); - break; - default: - glFormat.setProfile(QGLFormat::NoProfile); - break; - } - - glGetIntegerv(GL_CONTEXT_FLAGS, &value); - if (value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) - glFormat.setOption(QGL::NoDeprecatedFunctions); - else - glFormat.setOption(QGL::DeprecatedFunctions); - } -} - -bool QGLContext::chooseContext(const QGLContext* shareContext) -{ - QGLContextPrivate *share = shareContext ? const_cast(shareContext)->d_func() : 0; - - Q_D(QGLContext); - // workaround for matrox driver: - // make a cheap call to opengl to force loading of DLL - if (!opengl32dll) { - GLint params; - glGetIntegerv(GL_DEPTH_BITS, ¶ms); - opengl32dll = true; - } - - bool result = true; - HDC myDc; - QWidget *widget = 0; - - if (deviceIsPixmap()) { - if (d->glFormat.plane()) - return false; // Pixmaps can't have overlay - d->win = 0; - HDC display_dc = GetDC(0); - myDc = d->hbitmap_hdc = CreateCompatibleDC(display_dc); - QPixmap *px = static_cast(d->paintDevice); - - BITMAPINFO bmi; - memset(&bmi, 0, sizeof(bmi)); - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi.bmiHeader.biWidth = px->width(); - bmi.bmiHeader.biHeight = px->height(); - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = 32; - bmi.bmiHeader.biCompression = BI_RGB; - d->hbitmap = CreateDIBSection(display_dc, &bmi, DIB_RGB_COLORS, 0, 0, 0); - SelectObject(myDc, d->hbitmap); - ReleaseDC(0, display_dc); - } else { - widget = static_cast(d->paintDevice); - d->win = widget->winId(); - myDc = GetDC(d->win); - } - - // NB! the QGLTemporaryContext object is needed for the - // wglGetProcAddress() calls to succeed and are absolutely - // necessary - don't remove! - QGLTemporaryContext tmp_ctx(d->glFormat.directRendering(), widget); - - if (!myDc) { - qWarning("QGLContext::chooseContext(): Paint device cannot be null"); - result = false; - goto end; - } - - if (d->glFormat.plane()) { - d->pixelFormatId = ((QGLWidget*)d->paintDevice)->context()->d_func()->pixelFormatId; - if (!d->pixelFormatId) { // I.e. the glwidget is invalid - qWarning("QGLContext::chooseContext(): Cannot create overlay context for invalid widget"); - result = false; - goto end; - } - - if (!qgl_create_context(myDc, d, share)) { - qwglError("QGLContext::chooseContext()", "CreateLayerContext"); - result = false; - goto end; - } - - LAYERPLANEDESCRIPTOR lpfd; - wglDescribeLayerPlane(myDc, d->pixelFormatId, d->glFormat.plane(), sizeof(LAYERPLANEDESCRIPTOR), &lpfd); - d->glFormat.setDoubleBuffer(lpfd.dwFlags & LPD_DOUBLEBUFFER); - d->glFormat.setDepth(lpfd.cDepthBits); - d->glFormat.setRgba(lpfd.iPixelType == PFD_TYPE_RGBA); - if (d->glFormat.rgba()) { - if (d->glFormat.redBufferSize() != -1) - d->glFormat.setRedBufferSize(lpfd.cRedBits); - if (d->glFormat.greenBufferSize() != -1) - d->glFormat.setGreenBufferSize(lpfd.cGreenBits); - if (d->glFormat.blueBufferSize() != -1) - d->glFormat.setBlueBufferSize(lpfd.cBlueBits); - } - d->glFormat.setAlpha(lpfd.cAlphaBits); - d->glFormat.setAccum(lpfd.cAccumBits); - d->glFormat.setStencil(lpfd.cStencilBits); - d->glFormat.setStereo(lpfd.dwFlags & LPD_STEREO); - d->glFormat.setDirectRendering(false); - if (d->glFormat.depth()) - d->glFormat.setDepthBufferSize(lpfd.cDepthBits); - if (d->glFormat.alpha()) - d->glFormat.setAlphaBufferSize(lpfd.cAlphaBits); - if (d->glFormat.accum()) - d->glFormat.setAccumBufferSize(lpfd.cAccumRedBits); - if (d->glFormat.stencil()) - d->glFormat.setStencilBufferSize(lpfd.cStencilBits); - - if (d->glFormat.rgba()) { - if (lpfd.dwFlags & LPD_TRANSPARENT) - d->transpColor = QColor(lpfd.crTransparent & 0xff, - (lpfd.crTransparent >> 8) & 0xff, - (lpfd.crTransparent >> 16) & 0xff); - else - d->transpColor = QColor(0, 0, 0); - } - else { - if (lpfd.dwFlags & LPD_TRANSPARENT) - d->transpColor = QColor(qRgb(1, 2, 3));//, lpfd.crTransparent); - else - d->transpColor = QColor(qRgb(1, 2, 3));//, 0); - - d->cmap = new QGLCmap(1 << lpfd.cColorBits); - d->cmap->setEntry(lpfd.crTransparent, qRgb(1, 2, 3));//, QGLCmap::Reserved); - } - } else { - PIXELFORMATDESCRIPTOR pfd; - PIXELFORMATDESCRIPTOR realPfd; - d->pixelFormatId = choosePixelFormat(&pfd, myDc); - if (d->pixelFormatId == 0) { - qwglError("QGLContext::chooseContext()", "ChoosePixelFormat"); - result = false; - goto end; - } - - bool overlayRequested = d->glFormat.hasOverlay(); - DescribePixelFormat(myDc, d->pixelFormatId, sizeof(PIXELFORMATDESCRIPTOR), &realPfd); - - if (!deviceIsPixmap() && wglGetProcAddress("wglGetPixelFormatAttribivARB")) - d->glFormat = pfiToQGLFormat(myDc, d->pixelFormatId); - else - d->glFormat = pfdToQGLFormat(&realPfd); - - d->glFormat.setOverlay(d->glFormat.hasOverlay() && overlayRequested); - - if (deviceIsPixmap() && !(realPfd.dwFlags & PFD_DRAW_TO_BITMAP)) { - qWarning("QGLContext::chooseContext(): Failed to get pixmap rendering context."); - result = false; - goto end; - } - - if (deviceIsPixmap() && - (((QPixmap*)d->paintDevice)->depth() != realPfd.cColorBits)) { - qWarning("QGLContext::chooseContext(): Failed to get pixmap rendering context of suitable depth."); - result = false; - goto end; - } - - if (!SetPixelFormat(myDc, d->pixelFormatId, &realPfd)) { - qwglError("QGLContext::chooseContext()", "SetPixelFormat"); - result = false; - goto end; - } - - if (!qgl_create_context(myDc, d, share)) { - qwglError("QGLContext::chooseContext()", "wglCreateContext"); - result = false; - goto end; - } - - if(!deviceIsPixmap()) { - QRgb* pal = qgl_create_rgb_palette(&realPfd); - if (pal) { - QGLColormap cmap; - cmap.setEntries(256, pal); - ((QGLWidget*)d->paintDevice)->setColormap(cmap); - delete[] pal; - } - } - } - -end: - // vblanking - wglMakeCurrent(myDc, d->rc); - if (d->rc) - d->updateFormatVersion(); - - typedef BOOL (APIENTRYP PFNWGLSWAPINTERVALEXT) (int interval); - typedef int (APIENTRYP PFNWGLGETSWAPINTERVALEXT) (void); - PFNWGLSWAPINTERVALEXT wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXT) wglGetProcAddress("wglSwapIntervalEXT"); - PFNWGLGETSWAPINTERVALEXT wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXT) wglGetProcAddress("wglGetSwapIntervalEXT"); - if (wglSwapIntervalEXT && wglGetSwapIntervalEXT) { - if (d->reqFormat.swapInterval() != -1) - wglSwapIntervalEXT(d->reqFormat.swapInterval()); - d->glFormat.setSwapInterval(wglGetSwapIntervalEXT()); - } - - if (d->win) - ReleaseDC(d->win, myDc); - return result; -} - - - -static bool qLogEq(bool a, bool b) -{ - return (((!a) && (!b)) || (a && b)); -} - -/* - See qgl.cpp for qdoc comment. - */ -int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc) -{ - Q_D(QGLContext); - // workaround for matrox driver: - // make a cheap call to opengl to force loading of DLL - if (!opengl32dll) { - GLint params; - glGetIntegerv(GL_DEPTH_BITS, ¶ms); - opengl32dll = true; - } - - PFNWGLCHOOSEPIXELFORMATARB wglChoosePixelFormatARB = - (PFNWGLCHOOSEPIXELFORMATARB) wglGetProcAddress("wglChoosePixelFormatARB"); - int chosenPfi = 0; - if (!deviceIsPixmap() && wglChoosePixelFormatARB) { - bool valid; - int pixelFormat = 0; - uint numFormats = 0; - QVarLengthArray iAttributes(40); - int i = 0; - iAttributes[i++] = WGL_ACCELERATION_ARB; - if (d->glFormat.directRendering()) - iAttributes[i++] = WGL_FULL_ACCELERATION_ARB; - else - iAttributes[i++] = WGL_NO_ACCELERATION_ARB; - iAttributes[i++] = WGL_SUPPORT_OPENGL_ARB; - iAttributes[i++] = TRUE; - iAttributes[i++] = WGL_DRAW_TO_WINDOW_ARB; - iAttributes[i++] = TRUE; - iAttributes[i++] = WGL_COLOR_BITS_ARB; - iAttributes[i++] = 24; - iAttributes[i++] = WGL_DOUBLE_BUFFER_ARB; - iAttributes[i++] = d->glFormat.doubleBuffer(); - if (d->glFormat.stereo()) { - iAttributes[i++] = WGL_STEREO_ARB; - iAttributes[i++] = TRUE; - } - if (d->glFormat.depth()) { - iAttributes[i++] = WGL_DEPTH_BITS_ARB; - iAttributes[i++] = d->glFormat.depthBufferSize() == -1 ? 24 : d->glFormat.depthBufferSize(); - } - iAttributes[i++] = WGL_PIXEL_TYPE_ARB; - if (d->glFormat.rgba()) { - iAttributes[i++] = WGL_TYPE_RGBA_ARB; - if (d->glFormat.redBufferSize() != -1) { - iAttributes[i++] = WGL_RED_BITS_ARB; - iAttributes[i++] = d->glFormat.redBufferSize(); - } - if (d->glFormat.greenBufferSize() != -1) { - iAttributes[i++] = WGL_GREEN_BITS_ARB; - iAttributes[i++] = d->glFormat.greenBufferSize(); - } - if (d->glFormat.blueBufferSize() != -1) { - iAttributes[i++] = WGL_BLUE_BITS_ARB; - iAttributes[i++] = d->glFormat.blueBufferSize(); - } - } else { - iAttributes[i++] = WGL_TYPE_COLORINDEX_ARB; - } - if (d->glFormat.alpha()) { - iAttributes[i++] = WGL_ALPHA_BITS_ARB; - iAttributes[i++] = d->glFormat.alphaBufferSize() == -1 ? 8 : d->glFormat.alphaBufferSize(); - } - if (d->glFormat.accum()) { - iAttributes[i++] = WGL_ACCUM_BITS_ARB; - iAttributes[i++] = d->glFormat.accumBufferSize() == -1 ? 16 : d->glFormat.accumBufferSize(); - } - if (d->glFormat.stencil()) { - iAttributes[i++] = WGL_STENCIL_BITS_ARB; - iAttributes[i++] = d->glFormat.stencilBufferSize() == -1 ? 8 : d->glFormat.stencilBufferSize(); - } - if (d->glFormat.hasOverlay()) { - iAttributes[i++] = WGL_NUMBER_OVERLAYS_ARB; - iAttributes[i++] = 1; - } - int si = 0; - bool trySampleBuffers = QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers; - if (trySampleBuffers && d->glFormat.sampleBuffers()) { - iAttributes[i++] = WGL_SAMPLE_BUFFERS_ARB; - iAttributes[i++] = TRUE; - iAttributes[i++] = WGL_SAMPLES_ARB; - si = i; - iAttributes[i++] = d->glFormat.samples() == -1 ? 4 : d->glFormat.samples(); - } - iAttributes[i] = 0; - - do { - valid = wglChoosePixelFormatARB(pdc, iAttributes.constData(), 0, 1, - &pixelFormat, &numFormats); - if (trySampleBuffers && (!valid || numFormats < 1) && d->glFormat.sampleBuffers()) - iAttributes[si] /= 2; // try different no. samples - we aim for the best one - else - break; - } while ((!valid || numFormats < 1) && iAttributes[si] > 1); - chosenPfi = pixelFormat; - } - - if (!chosenPfi) { // fallback if wglChoosePixelFormatARB() failed - int pmDepth = deviceIsPixmap() ? ((QPixmap*)d->paintDevice)->depth() : 0; - PIXELFORMATDESCRIPTOR* p = (PIXELFORMATDESCRIPTOR*)dummyPfd; - memset(p, 0, sizeof(PIXELFORMATDESCRIPTOR)); - p->nSize = sizeof(PIXELFORMATDESCRIPTOR); - p->nVersion = 1; - p->dwFlags = PFD_SUPPORT_OPENGL; - if (deviceIsPixmap()) - p->dwFlags |= PFD_DRAW_TO_BITMAP; - else - p->dwFlags |= PFD_DRAW_TO_WINDOW; - if (!d->glFormat.directRendering()) - p->dwFlags |= PFD_GENERIC_FORMAT; - if (d->glFormat.doubleBuffer() && !deviceIsPixmap()) - p->dwFlags |= PFD_DOUBLEBUFFER; - if (d->glFormat.stereo()) - p->dwFlags |= PFD_STEREO; - if (d->glFormat.depth()) - p->cDepthBits = d->glFormat.depthBufferSize() == -1 ? 32 : d->glFormat.depthBufferSize(); - else - p->dwFlags |= PFD_DEPTH_DONTCARE; - if (d->glFormat.rgba()) { - p->iPixelType = PFD_TYPE_RGBA; - if (d->glFormat.redBufferSize() != -1) - p->cRedBits = d->glFormat.redBufferSize(); - if (d->glFormat.greenBufferSize() != -1) - p->cGreenBits = d->glFormat.greenBufferSize(); - if (d->glFormat.blueBufferSize() != -1) - p->cBlueBits = d->glFormat.blueBufferSize(); - if (deviceIsPixmap()) - p->cColorBits = pmDepth; - else - p->cColorBits = 32; - } else { - p->iPixelType = PFD_TYPE_COLORINDEX; - p->cColorBits = 8; - } - if (d->glFormat.alpha()) - p->cAlphaBits = d->glFormat.alphaBufferSize() == -1 ? 8 : d->glFormat.alphaBufferSize(); - if (d->glFormat.accum()) { - p->cAccumRedBits = p->cAccumGreenBits = p->cAccumBlueBits = p->cAccumAlphaBits = - d->glFormat.accumBufferSize() == -1 ? 16 : d->glFormat.accumBufferSize(); - } - if (d->glFormat.stencil()) - p->cStencilBits = d->glFormat.stencilBufferSize() == -1 ? 8 : d->glFormat.stencilBufferSize(); - p->iLayerType = PFD_MAIN_PLANE; - chosenPfi = ChoosePixelFormat(pdc, p); - - if (!chosenPfi) - qErrnoWarning("QGLContext: ChoosePixelFormat failed"); - - // Since the GDI function ChoosePixelFormat() does not handle - // overlay and direct-rendering requests, we must roll our own here - - bool doSearch = chosenPfi <= 0; - PIXELFORMATDESCRIPTOR pfd; - QGLFormat fmt; - if (!doSearch) { - DescribePixelFormat(pdc, chosenPfi, sizeof(PIXELFORMATDESCRIPTOR), - &pfd); - fmt = pfdToQGLFormat(&pfd); - if (d->glFormat.hasOverlay() && !fmt.hasOverlay()) - doSearch = true; - else if (!qLogEq(d->glFormat.directRendering(), fmt.directRendering())) - doSearch = true; - else if (deviceIsPixmap() && (!(pfd.dwFlags & PFD_DRAW_TO_BITMAP) || - pfd.cColorBits != pmDepth)) - doSearch = true; - else if (!deviceIsPixmap() && !(pfd.dwFlags & PFD_DRAW_TO_WINDOW)) - doSearch = true; - else if (!qLogEq(d->glFormat.rgba(), fmt.rgba())) - doSearch = true; - } - - if (doSearch) { - int pfiMax = DescribePixelFormat(pdc, 0, 0, NULL); - int bestScore = -1; - int bestPfi = -1; - for (int pfi = 1; pfi <= pfiMax; pfi++) { - DescribePixelFormat(pdc, pfi, sizeof(PIXELFORMATDESCRIPTOR), &pfd); - if (!(pfd.dwFlags & PFD_SUPPORT_OPENGL)) - continue; - if (deviceIsPixmap() && (!(pfd.dwFlags & PFD_DRAW_TO_BITMAP) || - pfd.cColorBits != pmDepth)) - continue; - if (!deviceIsPixmap() && !(pfd.dwFlags & PFD_DRAW_TO_WINDOW)) - continue; - - fmt = pfdToQGLFormat(&pfd); - if (d->glFormat.hasOverlay() && !fmt.hasOverlay()) - continue; - - int score = pfd.cColorBits; - if (qLogEq(d->glFormat.depth(), fmt.depth())) - score += pfd.cDepthBits; - if (qLogEq(d->glFormat.alpha(), fmt.alpha())) - score += pfd.cAlphaBits; - if (qLogEq(d->glFormat.accum(), fmt.accum())) - score += pfd.cAccumBits; - if (qLogEq(d->glFormat.stencil(), fmt.stencil())) - score += pfd.cStencilBits; - if (qLogEq(d->glFormat.doubleBuffer(), fmt.doubleBuffer())) - score += 1000; - if (qLogEq(d->glFormat.stereo(), fmt.stereo())) - score += 2000; - if (qLogEq(d->glFormat.directRendering(), fmt.directRendering())) - score += 4000; - if (qLogEq(d->glFormat.rgba(), fmt.rgba())) - score += 8000; - if (score > bestScore) { - bestScore = score; - bestPfi = pfi; - } - } - - if (bestPfi > 0) - chosenPfi = bestPfi; - } - } - return chosenPfi; -} - - - -void QGLContext::reset() -{ - Q_D(QGLContext); - // workaround for matrox driver: - // make a cheap call to opengl to force loading of DLL - if (!opengl32dll) { - GLint params; - glGetIntegerv(GL_DEPTH_BITS, ¶ms); - opengl32dll = true; - } - - if (!d->valid) - return; - d->cleanup(); - doneCurrent(); - if (d->rc) - wglDeleteContext(d->rc); - d->rc = 0; - if (d->win && d->dc) - ReleaseDC(d->win, d->dc); - if (deviceIsPixmap()) { - DeleteDC(d->hbitmap_hdc); - DeleteObject(d->hbitmap); - d->hbitmap_hdc = 0; - d->hbitmap = 0; - } - d->dc = 0; - d->win = 0; - d->threadId = 0; - d->pixelFormatId = 0; - d->sharing = false; - d->valid = false; - d->transpColor = QColor(); - delete d->cmap; - d->cmap = 0; - d->initDone = false; - QGLContextGroup::removeShare(this); -} - -// -// NOTE: In a multi-threaded environment, each thread has a current -// context. If we want to make this code thread-safe, we probably -// have to use TLS (thread local storage) for keeping current contexts. -// - -void QGLContext::makeCurrent() -{ - Q_D(QGLContext); - if (d->rc == wglGetCurrentContext() || !d->valid) // already current - return; - - if (d->win && (!d->dc || d->threadId != QThread::currentThreadId())) { - d->dc = GetDC(d->win); - d->threadId = QThread::currentThreadId(); - if (!d->dc) { - qwglError("QGLContext::makeCurrent()", "GetDC()"); - return; - } - } else if (deviceIsPixmap()) { - d->dc = d->hbitmap_hdc; - } - - HPALETTE hpal = QColormap::hPal(); - if (hpal) { - SelectPalette(d->dc, hpal, FALSE); - RealizePalette(d->dc); - } - if (d->glFormat.plane()) { - wglRealizeLayerPalette(d->dc, d->glFormat.plane(), TRUE); - } - - if (wglMakeCurrent(d->dc, d->rc)) { - QGLContextPrivate::setCurrentContext(this); - } else { - qwglError("QGLContext::makeCurrent()", "wglMakeCurrent"); - } -} - - -void QGLContext::doneCurrent() -{ - Q_D(QGLContext); - wglMakeCurrent(0, 0); - QGLContextPrivate::setCurrentContext(0); - if (deviceIsPixmap() && d->hbitmap) { - QPixmap *pm = static_cast(d->paintDevice); - *pm = QPixmap::fromWinHBITMAP(d->hbitmap); - } - if (d->win && d->dc) { - ReleaseDC(d->win, d->dc); - d->dc = 0; - d->threadId = 0; - } -} - -void QGLContext::swapBuffers() const -{ - Q_D(const QGLContext); - if (d->dc && d->glFormat.doubleBuffer() && !deviceIsPixmap()) { - if (d->glFormat.plane()) - wglSwapLayerBuffers(d->dc, WGL_SWAP_OVERLAY1); - else { - if (d->glFormat.hasOverlay()) - wglSwapLayerBuffers(d->dc, WGL_SWAP_MAIN_PLANE); - else - SwapBuffers(d->dc); - } - } -} - - -QColor QGLContext::overlayTransparentColor() const -{ - return d_func()->transpColor; -} - - -uint QGLContext::colorIndex(const QColor& c) const -{ - Q_D(const QGLContext); - if (!isValid()) - return 0; - if (d->cmap) { - int idx = d->cmap->find(c.rgb()); - if (idx >= 0) - return idx; - if (d->dc && d->glFormat.plane()) { - idx = d->cmap->allocate(c.rgb()); - if (idx >= 0) { - COLORREF r = RGB(qRed(c.rgb()),qGreen(c.rgb()),qBlue(c.rgb())); - wglSetLayerPaletteEntries(d->dc, d->glFormat.plane(), idx, 1, &r); - wglRealizeLayerPalette(d->dc, d->glFormat.plane(), TRUE); - return idx; - } - } - return d->cmap->findNearest(c.rgb()); - } - QColormap cmap = QColormap::instance(); - return cmap.pixel(c) & 0x00ffffff; // Assumes standard palette -} - -void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) -{ - if (!isValid()) - return; - - HDC display_dc = GetDC(0); - HDC tmp_dc = CreateCompatibleDC(display_dc); - HGDIOBJ old_font = SelectObject(tmp_dc, fnt.handle()); - - ReleaseDC(0, display_dc); - - if (!wglUseFontBitmaps(tmp_dc, 0, 256, listBase)) - qWarning("QGLContext::generateFontDisplayLists: Could not generate display lists for font '%s'", fnt.family().toLatin1().data()); - - SelectObject(tmp_dc, old_font); - DeleteDC(tmp_dc); -} - -void *QGLContext::getProcAddress(const QString &proc) const -{ - return (void *)wglGetProcAddress(proc.toLatin1()); -} - -/***************************************************************************** - QGLWidget Win32/WGL-specific code - *****************************************************************************/ - -void QGLWidgetPrivate::init(QGLContext *ctx, const QGLWidget* shareWidget) -{ - Q_Q(QGLWidget); - olcx = 0; - initContext(ctx, shareWidget); - - if (q->isValid() && q->context()->format().hasOverlay()) { - olcx = new QGLContext(QGLFormat::defaultOverlayFormat(), q); - if (!olcx->create(shareWidget ? shareWidget->overlayContext() : 0)) { - delete olcx; - olcx = 0; - glcx->d_func()->glFormat.setOverlay(false); - } - } else { - olcx = 0; - } -} - -/*\internal - Store color values in the given colormap. -*/ -static void qStoreColors(HPALETTE cmap, const QGLColormap & cols) -{ - QRgb color; - PALETTEENTRY pe; - - for (int i = 0; i < cols.size(); i++) { - color = cols.entryRgb(i); - pe.peRed = qRed(color); - pe.peGreen = qGreen(color); - pe.peBlue = qBlue(color); - pe.peFlags = 0; - - SetPaletteEntries(cmap, i, 1, &pe); - } -} - -void QGLWidgetPrivate::updateColormap() -{ - Q_Q(QGLWidget); - if (!cmap.handle()) - return; - HDC hdc = GetDC(q->winId()); - SelectPalette(hdc, (HPALETTE) cmap.handle(), TRUE); - qStoreColors((HPALETTE) cmap.handle(), cmap); - RealizePalette(hdc); - ReleaseDC(q->winId(), hdc); -} - -void QGLWidget::setMouseTracking(bool enable) -{ - QWidget::setMouseTracking(enable); -} - - -void QGLWidget::resizeEvent(QResizeEvent *) -{ - Q_D(QGLWidget); - if (!isValid()) - return; - makeCurrent(); - if (!d->glcx->initialized()) - glInit(); - resizeGL(width(), height()); - if (d->olcx) { - makeOverlayCurrent(); - resizeOverlayGL(width(), height()); - } -} - - -const QGLContext* QGLWidget::overlayContext() const -{ - return d_func()->olcx; -} - - -void QGLWidget::makeOverlayCurrent() -{ - Q_D(QGLWidget); - if (d->olcx) { - d->olcx->makeCurrent(); - if (!d->olcx->initialized()) { - initializeOverlayGL(); - d->olcx->setInitialized(true); - } - } -} - - -void QGLWidget::updateOverlayGL() -{ - Q_D(QGLWidget); - if (d->olcx) { - makeOverlayCurrent(); - paintOverlayGL(); - if (d->olcx->format().doubleBuffer()) { - if (d->autoSwap) - d->olcx->swapBuffers(); - } - else { - glFlush(); - } - } -} - - -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; - - bool doShow = false; - if (oldcx && oldcx->d_func()->win == winId() && !d->glcx->deviceIsPixmap()) { - // We already have a context and must therefore create a new - // window since Windows does not permit setting a new OpenGL - // context for a window that already has one set. - doShow = isVisible(); - QWidget *pW = static_cast(parent()); - QPoint pos = geometry().topLeft(); - setParent(pW, windowFlags()); - move(pos); - } - - if (!d->glcx->isValid()) { - bool wasSharing = shareContext || (oldcx && oldcx->isSharing()); - d->glcx->create(shareContext ? shareContext : oldcx); - // the above is a trick to keep disp lists etc when a - // QGLWidget has been reparented, so remove the sharing - // flag if we don't actually have a sharing context. - if (!wasSharing) - d->glcx->d_ptr->sharing = false; - } - - if (deleteOldContext) - delete oldcx; - - if (doShow) - show(); -} - - -bool QGLWidgetPrivate::renderCxPm(QPixmap*) -{ - return false; -} - -void QGLWidgetPrivate::cleanupColormaps() -{ - Q_Q(QGLWidget); - if (cmap.handle()) { - HDC hdc = GetDC(q->winId()); - SelectPalette(hdc, (HPALETTE) GetStockObject(DEFAULT_PALETTE), FALSE); - DeleteObject((HPALETTE) cmap.handle()); - ReleaseDC(q->winId(), hdc); - cmap.setHandle(0); - } - return; -} - -const QGLColormap & QGLWidget::colormap() const -{ - return d_func()->cmap; -} - -void QGLWidget::setColormap(const QGLColormap & c) -{ - Q_D(QGLWidget); - d->cmap = c; - - if (d->cmap.handle()) { // already have an allocated cmap - d->updateColormap(); - } else { - LOGPALETTE *lpal = (LOGPALETTE *) malloc(sizeof(LOGPALETTE) - +c.size()*sizeof(PALETTEENTRY)); - lpal->palVersion = 0x300; - lpal->palNumEntries = c.size(); - d->cmap.setHandle(CreatePalette(lpal)); - free(lpal); - d->updateColormap(); - } -} - -QT_END_NAMESPACE diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp deleted file mode 100644 index d6d8f24bfaf..00000000000 --- a/src/opengl/qgl_wince.cpp +++ /dev/null @@ -1,636 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - - -QT_BEGIN_NAMESPACE - - - -class QGLCmapPrivate -{ -public: - QGLCmapPrivate() : count(1) { } - void ref() { ++count; } - bool deref() { return !--count; } - uint count; - - enum AllocState{ UnAllocated = 0, Allocated = 0x01, Reserved = 0x02 }; - - int maxSize; - QVector colorArray; - QVector allocArray; - QVector contextArray; - QMap colorMap; -}; - -/***************************************************************************** - QColorMap class - temporarily here, until it is ready for prime time - *****************************************************************************/ - -/**************************************************************************** -** -** Definition of QColorMap class -** -****************************************************************************/ - -#ifndef QGLCMAP_H -#define QGLCMAP_H - -#include - -/* - 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; -} - -/***************************************************************************** - QGLFormat Win32/WGL-specific code - *****************************************************************************/ - -static bool opengl32dll = false; - -bool QGLFormat::hasOpenGLOverlays() -{ - return false; // ### -} - - -bool QGLContext::chooseContext(const QGLContext* shareContext) -{ - Q_D(QGLContext); - - // Validate the device. - if (!device()) - return false; - int devType = device()->devType(); - if (devType != QInternal::Pixmap && devType != QInternal::Image && devType != QInternal::Widget) { - qWarning("QGLContext::chooseContext(): Cannot create QGLContext's for paint device type %d", devType); - return false; - } - - // Get the display and initialize it. - d->eglContext = new QEglContext(); - d->ownsEglContext = true; - d->eglContext->setApi(QEgl::OpenGL); - - // Construct the configuration we need for this surface. - QEglProperties configProps; - qt_eglproperties_set_glformat(configProps, d->glFormat); - configProps.setDeviceType(devType); - configProps.setPaintDeviceFormat(device()); - configProps.setRenderableType(QEgl::OpenGL); - - // Search for a matching configuration, reducing the complexity - // each time until we get something that matches. - if (!d->eglContext->chooseConfig(configProps)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - - // Inform the higher layers about the actual format properties. - qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config()); - - // Create a new context for the configuration. - if (!d->eglContext->createContext - (shareContext ? shareContext->d_func()->eglContext : 0)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - d->sharing = d->eglContext->isSharing(); - if (d->sharing && shareContext) - const_cast(shareContext)->d_func()->sharing = true; - -#if defined(EGL_VERSION_1_1) - if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget) - eglSwapInterval(d->eglContext->display(), d->glFormat.swapInterval()); -#endif - - // Create the EGL surface to draw into. - d->eglSurface = d->eglContext->createSurface(device()); - if (d->eglSurface == EGL_NO_SURFACE) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - - return true; - -} - - - -static bool qLogEq(bool a, bool b) -{ - return (((!a) && (!b)) || (a && b)); -} - -int QGLContext::choosePixelFormat(void* , HDC ) -{ - - return 0; -} - -class QGLCmapPrivate; - -class /*Q_EXPORT*/ QGLCmap -{ -public: - enum Flags { Reserved = 0x01 }; - - QGLCmap(int maxSize = 256); - QGLCmap(const QGLCmap& map); - ~QGLCmap(); - - QGLCmap& operator=(const QGLCmap& map); - - // isEmpty and/or isNull ? - int size() const; - int maxSize() const; - - void resize(int newSize); - - int find(QRgb color) const; - int findNearest(QRgb color) const; - int allocate(QRgb color, uint flags = 0, quint8 context = 0); - - void setEntry(int idx, QRgb color, uint flags = 0, quint8 context = 0); - - const QRgb* colors() const; - -private: - void detach(); - QGLCmapPrivate* d; -}; - -#endif - - -QGLCmap::QGLCmap(int maxSize) // add a bool prealloc? -{ - d = new QGLCmapPrivate; - d->maxSize = maxSize; -} - -QGLCmap::QGLCmap(const QGLCmap& map) -{ - d = map.d; - d->ref(); -} - -QGLCmap::~QGLCmap() -{ - if (d && d->deref()) - delete d; - d = 0; -} - -QGLCmap& QGLCmap::operator=(const QGLCmap& map) -{ - map.d->ref(); - if (d->deref()) - delete d; - d = map.d; - return *this; -} - -int QGLCmap::size() const -{ - return d->colorArray.size(); -} - -int QGLCmap::maxSize() const -{ - return d->maxSize; -} - -void QGLCmap::detach() -{ - if (d->count != 1) { - d->deref(); - QGLCmapPrivate* newd = new QGLCmapPrivate; - newd->maxSize = d->maxSize; - newd->colorArray = d->colorArray; - newd->allocArray = d->allocArray; - newd->contextArray = d->contextArray; - newd->colorArray.detach(); - newd->allocArray.detach(); - newd->contextArray.detach(); - newd->colorMap = d->colorMap; - d = newd; - } -} - - -void QGLCmap::resize(int newSize) -{ - if (newSize < 0 || newSize > d->maxSize) { - qWarning("QGLCmap::resize(): size out of range"); - return; - } - int oldSize = size(); - detach(); - //if shrinking; remove the lost elems from colorMap - d->colorArray.resize(newSize); - d->allocArray.resize(newSize); - d->contextArray.resize(newSize); - if (newSize > oldSize) { - memset(d->allocArray.data() + oldSize, 0, newSize - oldSize); - memset(d->contextArray.data() + oldSize, 0, newSize - oldSize); - } -} - - -int QGLCmap::find(QRgb color) const -{ - QMap::ConstIterator it = d->colorMap.find(color); - if (it != d->colorMap.end()) - return *it; - return -1; -} - - -int QGLCmap::findNearest(QRgb color) const -{ - int idx = find(color); - if (idx >= 0) - return idx; - int mapSize = size(); - int mindist = 200000; - int r = qRed(color); - int g = qGreen(color); - int b = qBlue(color); - int rx, gx, bx, dist; - for (int i=0; i < mapSize; i++) { - if (!(d->allocArray[i] & QGLCmapPrivate::Allocated)) - continue; - QRgb ci = d->colorArray[i]; - rx = r - qRed(ci); - gx = g - qGreen(ci); - bx = b - qBlue(ci); - dist = rx*rx + gx*gx + bx*bx; // calculate distance - if (dist < mindist) { // minimal? - mindist = dist; - idx = i; - } - } - return idx; -} - - -// Does not always allocate; returns existing c idx if found - -int QGLCmap::allocate(QRgb color, uint flags, quint8 context) -{ - int idx = find(color); - if (idx >= 0) - return idx; - - int mapSize = d->colorArray.size(); - int newIdx = d->allocArray.indexOf(QGLCmapPrivate::UnAllocated); - - if (newIdx < 0) { // Must allocate more room - if (mapSize < d->maxSize) { - newIdx = mapSize; - mapSize++; - resize(mapSize); - } - else { - //# add a bool param that says what to do in case no more room - - // fail (-1) or return nearest? - return -1; - } - } - - d->colorArray[newIdx] = color; - if (flags & QGLCmap::Reserved) { - d->allocArray[newIdx] = QGLCmapPrivate::Reserved; - } - else { - d->allocArray[newIdx] = QGLCmapPrivate::Allocated; - d->colorMap.insert(color, newIdx); - } - d->contextArray[newIdx] = context; - return newIdx; -} - - -void QGLCmap::setEntry(int idx, QRgb color, uint flags, quint8 context) -{ - if (idx < 0 || idx >= d->maxSize) { - qWarning("QGLCmap::set(): Index out of range"); - return; - } - detach(); - int mapSize = size(); - if (idx >= mapSize) { - mapSize = idx + 1; - resize(mapSize); - } - d->colorArray[idx] = color; - if (flags & QGLCmap::Reserved) { - d->allocArray[idx] = QGLCmapPrivate::Reserved; - } - else { - d->allocArray[idx] = QGLCmapPrivate::Allocated; - d->colorMap.insert(color, idx); - } - d->contextArray[idx] = context; -} - - -const QRgb* QGLCmap::colors() const -{ - return d->colorArray.data(); -} - - -/***************************************************************************** - QGLWidget Win32/WGL-specific code - *****************************************************************************/ - -void QGLWidgetPrivate::init(QGLContext *ctx, const QGLWidget* shareWidget) -{ - Q_Q(QGLWidget); - olcx = 0; - initContext(ctx, shareWidget); - - if (q->isValid() && q->context()->format().hasOverlay()) { - olcx = new QGLContext(QGLFormat::defaultOverlayFormat(), q); - if (!olcx->create(shareWidget ? shareWidget->overlayContext() : 0)) { - delete olcx; - olcx = 0; - glcx->d_func()->glFormat.setOverlay(false); - } - } else { - olcx = 0; - } -} - -/*\internal - Store color values in the given colormap. -*/ -static void qStoreColors(HPALETTE cmap, const QGLColormap & cols) -{ - QRgb color; - PALETTEENTRY pe; - - for (int i = 0; i < cols.size(); i++) { - color = cols.entryRgb(i); - pe.peRed = qRed(color); - pe.peGreen = qGreen(color); - pe.peBlue = qBlue(color); - pe.peFlags = 0; - - SetPaletteEntries(cmap, i, 1, &pe); - } -} - -void QGLWidgetPrivate::updateColormap() -{ - Q_Q(QGLWidget); - if (!cmap.handle()) - return; - HDC hdc = GetDC(q->winId()); - SelectPalette(hdc, (HPALETTE) cmap.handle(), TRUE); - qStoreColors((HPALETTE) cmap.handle(), cmap); - RealizePalette(hdc); - ReleaseDC(q->winId(), hdc); -} - -bool QGLWidget::event(QEvent *e) -{ - Q_D(QGLWidget); - if (e->type() == QEvent::ParentChange) { - setContext(new QGLContext(d->glcx->requestedFormat(), this)); - // the overlay needs to be recreated as well - delete d->olcx; - if (isValid() && context()->format().hasOverlay()) { - d->olcx = new QGLContext(QGLFormat::defaultOverlayFormat(), this); - if (!d->olcx->create(isSharing() ? d->glcx : 0)) { - delete d->olcx; - d->olcx = 0; - d->glcx->d_func()->glFormat.setOverlay(false); - } - } else { - d->olcx = 0; - } - } else if (e->type() == QEvent::Show && !format().rgba()) { - d->updateColormap(); - } - - return QWidget::event(e); -} - - -void QGLWidget::resizeEvent(QResizeEvent *) -{ - Q_D(QGLWidget); - if (!isValid()) - return; - makeCurrent(); - if (!d->glcx->initialized()) - glInit(); - resizeGL(width(), height()); - if (d->olcx) { - makeOverlayCurrent(); - resizeOverlayGL(width(), height()); - } -} - - -const QGLContext* QGLWidget::overlayContext() const -{ - return d_func()->olcx; -} - - -void QGLWidget::makeOverlayCurrent() -{ - Q_D(QGLWidget); - if (d->olcx) { - d->olcx->makeCurrent(); - if (!d->olcx->initialized()) { - initializeOverlayGL(); - d->olcx->setInitialized(true); - } - } -} - - -void QGLWidget::updateOverlayGL() -{ - Q_D(QGLWidget); - if (d->olcx) { - makeOverlayCurrent(); - paintOverlayGL(); - if (d->olcx->format().doubleBuffer()) { - if (d->autoSwap) - d->olcx->swapBuffers(); - } - else { - glFlush(); - } - } -} - -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; - - bool doShow = false; - if (oldcx && oldcx->d_func()->win == winId() && !d->glcx->deviceIsPixmap()) { - // We already have a context and must therefore create a new - // window since Windows does not permit setting a new OpenGL - // context for a window that already has one set. - doShow = isVisible(); - QWidget *pW = static_cast(parent()); - QPoint pos = geometry().topLeft(); - setParent(pW, windowFlags()); - move(pos); - } - - if (!d->glcx->isValid()) { - d->glcx->create(shareContext ? shareContext : oldcx); - // the above is a trick to keep disp lists etc when a - // QGLWidget has been reparented, so remove the sharing - // flag if we don't actually have a sharing context. - if (!shareContext) - d->glcx->d_ptr->sharing = false; - } - - if (deleteOldContext) - delete oldcx; - - if (doShow) - show(); -} - - -void QGLWidgetPrivate::cleanupColormaps() -{ - Q_Q(QGLWidget); - if (cmap.handle()) { - HDC hdc = GetDC(q->winId()); - SelectPalette(hdc, (HPALETTE) GetStockObject(DEFAULT_PALETTE), FALSE); - DeleteObject((HPALETTE) cmap.handle()); - ReleaseDC(q->winId(), hdc); - cmap.setHandle(0); - } - return; -} - -const QGLColormap & QGLWidget::colormap() const -{ - return d_func()->cmap; -} - -void QGLWidget::setColormap(const QGLColormap & c) -{ - Q_D(QGLWidget); - d->cmap = c; - - if (d->cmap.handle()) { // already have an allocated cmap - d->updateColormap(); - } else { - LOGPALETTE *lpal = (LOGPALETTE *) malloc(sizeof(LOGPALETTE) - +c.size()*sizeof(PALETTEENTRY)); - lpal->palVersion = 0x300; - lpal->palNumEntries = c.size(); - d->cmap.setHandle(CreatePalette(lpal)); - free(lpal); - d->updateColormap(); - } -} - -QT_END_NAMESPACE diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp deleted file mode 100644 index 22a222eb1b1..00000000000 --- a/src/opengl/qgl_x11.cpp +++ /dev/null @@ -1,1904 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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 -#include -#include -#include -#include -#ifdef Q_OS_HPUX -// for GLXPBuffer -#include -#endif - -// We always define GLX_EXT_texture_from_pixmap ourselves because -// we can't trust system headers to do it properly -#define GLX_EXT_texture_from_pixmap 1 - -#define INT8 dummy_INT8 -#define INT32 dummy_INT32 -#include -#undef INT8 -#undef INT32 - -#include -#include -#include -#ifdef Q_OS_VXWORS -# ifdef open -# undef open -# endif -# ifdef getpid -# undef getpid -# endif -#endif // Q_OS_VXWORKS -#include - -#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) -#include -#endif - -QT_BEGIN_NAMESPACE - -extern Drawable qt_x11Handle(const QPaintDevice *pd); -extern const QX11Info *qt_x11Info(const QPaintDevice *pd); - -#ifndef GLX_ARB_multisample -#define GLX_SAMPLE_BUFFERS_ARB 100000 -#define GLX_SAMPLES_ARB 100001 -#endif - -#ifndef GLX_TEXTURE_2D_BIT_EXT -#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 -#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 -#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 -#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 -#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 -#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 -#define GLX_Y_INVERTED_EXT 0x20D4 -#define GLX_TEXTURE_FORMAT_EXT 0x20D5 -#define GLX_TEXTURE_TARGET_EXT 0x20D6 -#define GLX_MIPMAP_TEXTURE_EXT 0x20D7 -#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 -#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 -#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA -#define GLX_TEXTURE_2D_EXT 0x20DC -#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD -#define GLX_FRONT_LEFT_EXT 0x20DE -#endif - -#ifndef GLX_ARB_create_context -#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 -#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 -#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 -#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 -#define GLX_CONTEXT_FLAGS_ARB 0x2094 -#endif - -#ifndef GLX_ARB_create_context_profile -#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 -#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 -#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 -#endif - -/* - The qt_gl_choose_cmap function is internal and used by QGLWidget::setContext() - and GLX (not Windows). If the application can't find any sharable - colormaps, it must at least create as few colormaps as possible. The - dictionary solution below ensures only one colormap is created per visual. - Colormaps are also deleted when the application terminates. -*/ - -struct QCMapEntry { - QCMapEntry(); - ~QCMapEntry(); - - Colormap cmap; - bool alloc; - XStandardColormap scmap; -}; - -QCMapEntry::QCMapEntry() -{ - cmap = 0; - alloc = false; - scmap.colormap = 0; -} - -QCMapEntry::~QCMapEntry() -{ - if (alloc) - XFreeColormap(X11->display, cmap); -} -typedef QHash CMapEntryHash; -typedef QHash > GLCMapHash; -static bool mesa_gl = false; -static bool first_time = true; - -static void cleanup_cmaps(); - -struct QGLCMapCleanupHandler { - QGLCMapCleanupHandler() { - cmap_hash = new CMapEntryHash; - qglcmap_hash = new GLCMapHash; - } - ~QGLCMapCleanupHandler() { - delete cmap_hash; - delete qglcmap_hash; - } - CMapEntryHash *cmap_hash; - GLCMapHash *qglcmap_hash; -}; -Q_GLOBAL_STATIC(QGLCMapCleanupHandler, cmap_handler) - -static void cleanup_cmaps() -{ - CMapEntryHash *hash = cmap_handler()->cmap_hash; - QHash::ConstIterator it = hash->constBegin(); - while (it != hash->constEnd()) { - delete it.value(); - ++it; - } - - hash->clear(); - cmap_handler()->qglcmap_hash->clear(); -} - -Colormap qt_gl_choose_cmap(Display *dpy, XVisualInfo *vi) -{ - if (first_time) { - const char *v = glXQueryServerString(dpy, vi->screen, GLX_VERSION); - if (v) - mesa_gl = (strstr(v, "Mesa") != 0); - first_time = false; - } - - CMapEntryHash *hash = cmap_handler()->cmap_hash; - CMapEntryHash::ConstIterator it = hash->constFind((long) vi->visualid + (vi->screen * 256)); - if (it != hash->constEnd()) - return it.value()->cmap; // found colormap for visual - - if (vi->visualid == - XVisualIDFromVisual((Visual *) QX11Info::appVisual(vi->screen))) { - // qDebug("Using x11AppColormap"); - return QX11Info::appColormap(vi->screen); - } - - QCMapEntry *x = new QCMapEntry(); - - XStandardColormap *c; - int n, i; - - // qDebug("Choosing cmap for vID %0x", vi->visualid); - - if (mesa_gl) { // we're using MesaGL - Atom hp_cmaps = XInternAtom(dpy, "_HP_RGB_SMOOTH_MAP_LIST", true); - if (hp_cmaps && vi->visual->c_class == TrueColor && vi->depth == 8) { - if (XGetRGBColormaps(dpy,RootWindow(dpy,vi->screen),&c,&n, - hp_cmaps)) { - i = 0; - while (i < n && x->cmap == 0) { - if (c[i].visualid == vi->visual->visualid) { - x->cmap = c[i].colormap; - x->scmap = c[i]; - //qDebug("Using HP_RGB scmap"); - - } - i++; - } - XFree((char *)c); - } - } - } - if (!x->cmap) { - if (XGetRGBColormaps(dpy,RootWindow(dpy,vi->screen),&c,&n, - XA_RGB_DEFAULT_MAP)) { - for (int i = 0; i < n && x->cmap == 0; ++i) { - if (!c[i].red_max || - !c[i].green_max || - !c[i].blue_max || - !c[i].red_mult || - !c[i].green_mult || - !c[i].blue_mult) - continue; // invalid stdcmap - if (c[i].visualid == vi->visualid) { - x->cmap = c[i].colormap; - x->scmap = c[i]; - //qDebug("Using RGB_DEFAULT scmap"); - } - } - XFree((char *)c); - } - } - if (!x->cmap) { // no shared cmap found - x->cmap = XCreateColormap(dpy, RootWindow(dpy,vi->screen), vi->visual, - AllocNone); - x->alloc = true; - // qDebug("Allocating cmap"); - } - - // colormap hash should be cleanup only when the QApplication dtor is called - if (hash->isEmpty()) - qAddPostRoutine(cleanup_cmaps); - - // associate cmap with visualid - hash->insert((long) vi->visualid + (vi->screen * 256), x); - return x->cmap; -} - -struct QTransColor -{ - VisualID vis; - int screen; - long color; -}; - -static QVector trans_colors; -static int trans_colors_init = false; - -static void find_trans_colors() -{ - struct OverlayProp { - long visual; - long type; - long value; - long layer; - }; - - trans_colors_init = true; - - Display* appDisplay = X11->display; - - int scr; - int lastsize = 0; - for (scr = 0; scr < ScreenCount(appDisplay); scr++) { - QWidget* rootWin = QApplication::desktop()->screen(scr); - if (!rootWin) - return; // Should not happen - Atom overlayVisualsAtom = XInternAtom(appDisplay, - "SERVER_OVERLAY_VISUALS", True); - if (overlayVisualsAtom == XNone) - return; // Server has no overlays - - Atom actualType; - int actualFormat; - ulong nItems; - ulong bytesAfter; - unsigned char *retval = 0; - int res = XGetWindowProperty(appDisplay, rootWin->winId(), - overlayVisualsAtom, 0, 10000, False, - overlayVisualsAtom, &actualType, - &actualFormat, &nItems, &bytesAfter, - &retval); - - if (res != Success || actualType != overlayVisualsAtom - || actualFormat != 32 || nItems < 4 || !retval) - return; // Error reading property - - OverlayProp *overlayProps = (OverlayProp *)retval; - - int numProps = nItems / 4; - trans_colors.resize(lastsize + numProps); - int j = lastsize; - for (int i = 0; i < numProps; i++) { - if (overlayProps[i].type == 1) { - trans_colors[j].vis = (VisualID)overlayProps[i].visual; - trans_colors[j].screen = scr; - trans_colors[j].color = (int)overlayProps[i].value; - j++; - } - } - XFree(overlayProps); - lastsize = j; - trans_colors.resize(lastsize); - } -} - -/***************************************************************************** - QGLFormat UNIX/GLX-specific code - *****************************************************************************/ - -void (*qglx_getProcAddress(const char* procName))() -{ - // On systems where the GL driver is pluggable (like Mesa), we have to use - // the glXGetProcAddressARB extension to resolve other function pointers as - // the symbols wont be in the GL library, but rather in a plugin loaded by - // the GL library. - typedef void (*(*qt_glXGetProcAddressARB)(const char *))(); - static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; - static bool triedResolvingGlxGetProcAddress = false; - if (!triedResolvingGlxGetProcAddress) { - triedResolvingGlxGetProcAddress = true; - QGLExtensionMatcher extensions(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); - if (extensions.match("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 - { -#if !defined(QT_NO_LIBRARY) - extern const QString qt_gl_library_name(); - QLibrary lib(qt_gl_library_name()); - glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); -#endif - } - } - } - - void (*procAddress)() = 0; - if (glXGetProcAddressARB) - procAddress = glXGetProcAddressARB(procName); - - // If glXGetProcAddress didn't work, try looking the symbol up in the GL library -#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) - if (!procAddress) { - void *handle = dlopen(NULL, RTLD_LAZY); - if (handle) { - procAddress = (void (*)())dlsym(handle, procName); - dlclose(handle); - } - } -#endif -#if !defined(QT_NO_LIBRARY) - if (!procAddress) { - extern const QString qt_gl_library_name(); - QLibrary lib(qt_gl_library_name()); - procAddress = lib.resolve(procName); - } -#endif - - return procAddress; -} - -bool QGLFormat::hasOpenGL() -{ - return glXQueryExtension(X11->display, 0, 0) != 0; -} - - -bool QGLFormat::hasOpenGLOverlays() -{ - if (!trans_colors_init) - find_trans_colors(); - return trans_colors.size() > 0; -} - -static bool buildSpec(int* spec, const QGLFormat& f, QPaintDevice* paintDevice, - int bufDepth, bool onlyFBConfig = false) -{ - int i = 0; - spec[i++] = GLX_LEVEL; - spec[i++] = f.plane(); - const QX11Info *xinfo = qt_x11Info(paintDevice); - bool useFBConfig = onlyFBConfig; - -#if defined(GLX_VERSION_1_3) && !defined(QT_NO_XRENDER) && !defined(Q_OS_HPUX) - /* - HPUX defines GLX_VERSION_1_3 but does not implement the corresponding functions. - Specifically glXChooseFBConfig and glXGetVisualFromFBConfig are not implemented. - */ - QWidget* widget = 0; - if (paintDevice->devType() == QInternal::Widget) - widget = static_cast(paintDevice); - - // Only use glXChooseFBConfig for widgets if we're trying to get an ARGB visual - if (widget && widget->testAttribute(Qt::WA_TranslucentBackground) && X11->use_xrender) - useFBConfig = true; -#endif - -#if defined(GLX_VERSION_1_1) && defined(GLX_EXT_visual_info) - static bool useTranspExt = false; - static bool useTranspExtChecked = false; - if (f.plane() && !useTranspExtChecked && paintDevice) { - QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen())); - useTranspExt = extensions.match("GLX_EXT_visual_info"); - //# (A bit simplistic; that could theoretically be a substring) - if (useTranspExt) { - QByteArray cstr(glXGetClientString(xinfo->display(), GLX_VENDOR)); - useTranspExt = !cstr.contains("Xi Graphics"); // bug workaround - if (useTranspExt) { - // bug workaround - some systems (eg. FireGL) refuses to return an overlay - // visual if the GLX_TRANSPARENT_TYPE_EXT attribute is specified, even if - // the implementation supports transparent overlays - int tmpSpec[] = { GLX_LEVEL, f.plane(), GLX_TRANSPARENT_TYPE_EXT, - f.rgba() ? GLX_TRANSPARENT_RGB_EXT : GLX_TRANSPARENT_INDEX_EXT, - XNone }; - XVisualInfo * vinf = glXChooseVisual(xinfo->display(), xinfo->screen(), tmpSpec); - if (!vinf) { - useTranspExt = false; - } - } - } - - useTranspExtChecked = true; - } - if (f.plane() && useTranspExt && !useFBConfig) { - // Required to avoid non-transparent overlay visual(!) on some systems - spec[i++] = GLX_TRANSPARENT_TYPE_EXT; - spec[i++] = f.rgba() ? GLX_TRANSPARENT_RGB_EXT : GLX_TRANSPARENT_INDEX_EXT; - } -#endif - -#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - // GLX_RENDER_TYPE is only in glx >=1.3 - if (useFBConfig) { - spec[i++] = GLX_RENDER_TYPE; - spec[i++] = f.rgba() ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT; - } -#endif - - if (f.doubleBuffer()) - spec[i++] = GLX_DOUBLEBUFFER; - if (useFBConfig) - spec[i++] = True; - if (f.depth()) { - spec[i++] = GLX_DEPTH_SIZE; - spec[i++] = f.depthBufferSize() == -1 ? 1 : f.depthBufferSize(); - } - if (f.stereo()) { - spec[i++] = GLX_STEREO; - if (useFBConfig) - spec[i++] = True; - } - if (f.stencil()) { - spec[i++] = GLX_STENCIL_SIZE; - spec[i++] = f.stencilBufferSize() == -1 ? 1 : f.stencilBufferSize(); - } - if (f.rgba()) { - if (!useFBConfig) - spec[i++] = GLX_RGBA; - spec[i++] = GLX_RED_SIZE; - spec[i++] = f.redBufferSize() == -1 ? 1 : f.redBufferSize(); - spec[i++] = GLX_GREEN_SIZE; - spec[i++] = f.greenBufferSize() == -1 ? 1 : f.greenBufferSize(); - spec[i++] = GLX_BLUE_SIZE; - spec[i++] = f.blueBufferSize() == -1 ? 1 : f.blueBufferSize(); - if (f.alpha()) { - spec[i++] = GLX_ALPHA_SIZE; - spec[i++] = f.alphaBufferSize() == -1 ? 1 : f.alphaBufferSize(); - } - if (f.accum()) { - spec[i++] = GLX_ACCUM_RED_SIZE; - spec[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize(); - spec[i++] = GLX_ACCUM_GREEN_SIZE; - spec[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize(); - spec[i++] = GLX_ACCUM_BLUE_SIZE; - spec[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize(); - if (f.alpha()) { - spec[i++] = GLX_ACCUM_ALPHA_SIZE; - spec[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize(); - } - } - } else { - spec[i++] = GLX_BUFFER_SIZE; - spec[i++] = bufDepth; - } - - if (f.sampleBuffers()) { - spec[i++] = GLX_SAMPLE_BUFFERS_ARB; - spec[i++] = 1; - spec[i++] = GLX_SAMPLES_ARB; - spec[i++] = f.samples() == -1 ? 4 : f.samples(); - } - -#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - if (useFBConfig) { - spec[i++] = GLX_DRAWABLE_TYPE; - switch(paintDevice->devType()) { - case QInternal::Pixmap: - spec[i++] = GLX_PIXMAP_BIT; - break; - case QInternal::Pbuffer: - spec[i++] = GLX_PBUFFER_BIT; - break; - default: - qWarning("QGLContext: Unknown paint device type %d", paintDevice->devType()); - // Fall-through & assume it's a window - case QInternal::Widget: - spec[i++] = GLX_WINDOW_BIT; - break; - }; - } -#endif - - spec[i] = XNone; - return useFBConfig; -} - -/***************************************************************************** - QGLContext UNIX/GLX-specific code - *****************************************************************************/ - -bool QGLContext::chooseContext(const QGLContext* shareContext) -{ - Q_D(QGLContext); - const QX11Info *xinfo = qt_x11Info(d->paintDevice); - - Display* disp = xinfo->display(); - d->vi = chooseVisual(); - if (!d->vi) - return false; - - if (deviceIsPixmap() && - (((XVisualInfo*)d->vi)->depth != xinfo->depth() || - ((XVisualInfo*)d->vi)->screen != xinfo->screen())) - { - XFree(d->vi); - XVisualInfo appVisInfo; - memset(&appVisInfo, 0, sizeof(XVisualInfo)); - appVisInfo.visualid = XVisualIDFromVisual((Visual *) xinfo->visual()); - appVisInfo.screen = xinfo->screen(); - int nvis; - d->vi = XGetVisualInfo(disp, VisualIDMask | VisualScreenMask, &appVisInfo, &nvis); - if (!d->vi) - return false; - - int useGL; - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_USE_GL, &useGL); - if (!useGL) - return false; //# Chickening out already... - } - int res; - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_LEVEL, &res); - d->glFormat.setPlane(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_DOUBLEBUFFER, &res); - d->glFormat.setDoubleBuffer(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_DEPTH_SIZE, &res); - d->glFormat.setDepth(res); - if (d->glFormat.depth()) - d->glFormat.setDepthBufferSize(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_RGBA, &res); - d->glFormat.setRgba(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_RED_SIZE, &res); - d->glFormat.setRedBufferSize(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_GREEN_SIZE, &res); - d->glFormat.setGreenBufferSize(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_BLUE_SIZE, &res); - d->glFormat.setBlueBufferSize(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_ALPHA_SIZE, &res); - d->glFormat.setAlpha(res); - if (d->glFormat.alpha()) - d->glFormat.setAlphaBufferSize(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_ACCUM_RED_SIZE, &res); - d->glFormat.setAccum(res); - if (d->glFormat.accum()) - d->glFormat.setAccumBufferSize(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_STENCIL_SIZE, &res); - d->glFormat.setStencil(res); - if (d->glFormat.stencil()) - d->glFormat.setStencilBufferSize(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_STEREO, &res); - d->glFormat.setStereo(res); - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_SAMPLE_BUFFERS_ARB, &res); - d->glFormat.setSampleBuffers(res); - if (d->glFormat.sampleBuffers()) { - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_SAMPLES_ARB, &res); - d->glFormat.setSamples(res); - } - - Bool direct = format().directRendering() ? True : False; - - if (shareContext && - (!shareContext->isValid() || !shareContext->d_func()->cx)) { - qWarning("QGLContext::chooseContext(): Cannot share with invalid context"); - shareContext = 0; - } - - // 1. Sharing between rgba and color-index will give wrong colors. - // 2. Contexts cannot be shared btw. direct/non-direct renderers. - // 3. Pixmaps cannot share contexts that are set up for direct rendering. - // 4. If the contexts are not created on the same screen, they can't be shared - - if (shareContext - && (format().rgba() != shareContext->format().rgba() - || (deviceIsPixmap() && glXIsDirect(disp, (GLXContext)shareContext->d_func()->cx)) - || (shareContext->d_func()->screen != xinfo->screen()))) - { - shareContext = 0; - } - - const int major = d->reqFormat.majorVersion(); - const int minor = d->reqFormat.minorVersion(); - const int profile = d->reqFormat.profile() == QGLFormat::CompatibilityProfile - ? GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB - : GLX_CONTEXT_CORE_PROFILE_BIT_ARB; - - d->cx = 0; - -#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - /* - HPUX defines GLX_VERSION_1_3 but does not implement the corresponding functions. - Specifically glXChooseFBConfig and glXGetVisualFromFBConfig are not implemented. - */ - if ((major == 3 && minor >= 2) || major > 3) { - QGLTemporaryContext *tmpContext = 0; - if (!QGLContext::currentContext()) - tmpContext = new QGLTemporaryContext; - - int attributes[] = { GLX_CONTEXT_MAJOR_VERSION_ARB, major, - GLX_CONTEXT_MINOR_VERSION_ARB, minor, - GLX_CONTEXT_PROFILE_MASK_ARB, profile, - 0 }; - - typedef GLXContext ( * Q_PFNGLXCREATECONTEXTATTRIBSARBPROC) - (Display* dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); - - - Q_PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = - (Q_PFNGLXCREATECONTEXTATTRIBSARBPROC) qglx_getProcAddress("glXCreateContextAttribsARB"); - - if (glXCreateContextAttribs) { - int spec[45]; - glXGetConfig(disp, (XVisualInfo*)d->vi, GLX_BUFFER_SIZE, &res); - buildSpec(spec, format(), d->paintDevice, res, true); - - GLXFBConfig *configs; - int configCount = 0; - configs = glXChooseFBConfig(disp, xinfo->screen(), spec, &configCount); - - if (configs && configCount > 0) { - d->cx = glXCreateContextAttribs(disp, configs[0], - shareContext ? (GLXContext)shareContext->d_func()->cx : 0, direct, attributes); - if (!d->cx && shareContext) { - shareContext = 0; - d->cx = glXCreateContextAttribs(disp, configs[0], 0, direct, attributes); - } - d->screen = ((XVisualInfo*)d->vi)->screen; - } - XFree(configs); - } else { - qWarning("QGLContext::chooseContext(): OpenGL %d.%d is not supported", major, minor); - } - - if (tmpContext) - delete tmpContext; - } -#else - Q_UNUSED(major); - Q_UNUSED(minor); - Q_UNUSED(profile); -#endif - - if (!d->cx && shareContext) { - d->cx = glXCreateContext(disp, (XVisualInfo *)d->vi, - (GLXContext)shareContext->d_func()->cx, direct); - d->screen = ((XVisualInfo*)d->vi)->screen; - } - if (!d->cx) { - d->cx = glXCreateContext(disp, (XVisualInfo *)d->vi, NULL, direct); - d->screen = ((XVisualInfo*)d->vi)->screen; - shareContext = 0; - } - - if (shareContext && d->cx) { - QGLContext *share = const_cast(shareContext); - d->sharing = true; - share->d_func()->sharing = true; - } - - if (!d->cx) - return false; - d->glFormat.setDirectRendering(glXIsDirect(disp, (GLXContext)d->cx)); - if (deviceIsPixmap()) { -#if defined(GLX_MESA_pixmap_colormap) && defined(QGL_USE_MESA_EXT) - d->gpm = glXCreateGLXPixmapMESA(disp, (XVisualInfo *)d->vi, - qt_x11Handle(d->paintDevice), - qt_gl_choose_cmap(disp, (XVisualInfo *)d->vi)); -#else - d->gpm = (quint32)glXCreateGLXPixmap(disp, (XVisualInfo *)d->vi, - qt_x11Handle(d->paintDevice)); -#endif - if (!d->gpm) - return false; - } - QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen())); - if (extensions.match("GLX_SGI_video_sync")) { - if (d->glFormat.swapInterval() == -1) - d->glFormat.setSwapInterval(0); - } else { - d->glFormat.setSwapInterval(-1); - } - return true; -} - -/* - See qgl.cpp for qdoc comment. - */ -void *QGLContext::chooseVisual() -{ - Q_D(QGLContext); - static const int bufDepths[] = { 8, 4, 2, 1 }; // Try 16, 12 also? - //todo: if pixmap, also make sure that vi->depth == pixmap->depth - void* vis = 0; - int i = 0; - bool fail = false; - QGLFormat fmt = format(); - bool tryDouble = !fmt.doubleBuffer(); // Some GL impl's only have double - bool triedDouble = false; - bool triedSample = false; - if (fmt.sampleBuffers()) - fmt.setSampleBuffers(QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers); - while(!fail && !(vis = tryVisual(fmt, bufDepths[i]))) { - if (!fmt.rgba() && bufDepths[i] > 1) { - i++; - continue; - } - if (tryDouble) { - fmt.setDoubleBuffer(true); - tryDouble = false; - triedDouble = true; - continue; - } else if (triedDouble) { - fmt.setDoubleBuffer(false); - triedDouble = false; - } - if (!triedSample && fmt.sampleBuffers()) { - fmt.setSampleBuffers(false); - triedSample = true; - continue; - } - if (fmt.stereo()) { - fmt.setStereo(false); - continue; - } - if (fmt.accum()) { - fmt.setAccum(false); - continue; - } - if (fmt.stencil()) { - fmt.setStencil(false); - continue; - } - if (fmt.alpha()) { - fmt.setAlpha(false); - continue; - } - if (fmt.depth()) { - fmt.setDepth(false); - continue; - } - if (fmt.doubleBuffer()) { - fmt.setDoubleBuffer(false); - continue; - } - fail = true; - } - d->glFormat = fmt; - return vis; -} - -/* - See qgl.cpp for qdoc comment. - */ -void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth) -{ - Q_D(QGLContext); - int spec[45]; - const QX11Info *xinfo = qt_x11Info(d->paintDevice); - bool useFBConfig = buildSpec(spec, f, d->paintDevice, bufDepth, false); - - XVisualInfo* chosenVisualInfo = 0; - -#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - while (useFBConfig) { - GLXFBConfig *configs; - int configCount = 0; - configs = glXChooseFBConfig(xinfo->display(), xinfo->screen(), spec, &configCount); - - if (!configs) - break; // fallback to trying glXChooseVisual - - for (int i = 0; i < configCount; ++i) { - XVisualInfo* vi; - vi = glXGetVisualFromFBConfig(xinfo->display(), configs[i]); - if (!vi) - continue; - -#if !defined(QT_NO_XRENDER) - QWidget* w = 0; - if (d->paintDevice->devType() == QInternal::Widget) - w = static_cast(d->paintDevice); - - if (w && w->testAttribute(Qt::WA_TranslucentBackground) && f.alpha()) { - // Attempt to find a config who's visual has a proper alpha channel - XRenderPictFormat *pictFormat; - pictFormat = XRenderFindVisualFormat(xinfo->display(), vi->visual); - - if (pictFormat && (pictFormat->type == PictTypeDirect) && pictFormat->direct.alphaMask) { - // The pict format for the visual matching the FBConfig indicates ARGB - if (chosenVisualInfo) - XFree(chosenVisualInfo); - chosenVisualInfo = vi; - break; - } - } else -#endif //QT_NO_XRENDER - if (chosenVisualInfo) { - // If we've got a visual we can use and we're not trying to find one with a - // real alpha channel, we might as well just use the one we've got - break; - } - - if (!chosenVisualInfo) - chosenVisualInfo = vi; // Have something to fall back to - else - XFree(vi); - } - - XFree(configs); - break; - } -#endif // defined(GLX_VERSION_1_3) - - if (!chosenVisualInfo) - chosenVisualInfo = glXChooseVisual(xinfo->display(), xinfo->screen(), spec); - - return chosenVisualInfo; -} - - -void QGLContext::reset() -{ - Q_D(QGLContext); - if (!d->valid) - return; - d->cleanup(); - const QX11Info *xinfo = qt_x11Info(d->paintDevice); - doneCurrent(); - if (d->gpm) - glXDestroyGLXPixmap(xinfo->display(), (GLXPixmap)d->gpm); - d->gpm = 0; - glXDestroyContext(xinfo->display(), (GLXContext)d->cx); - if (d->vi) - XFree(d->vi); - d->vi = 0; - d->cx = 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); - if (!d->valid) { - qWarning("QGLContext::makeCurrent(): Cannot make invalid context current."); - return; - } - const QX11Info *xinfo = qt_x11Info(d->paintDevice); - bool ok = true; - if (d->paintDevice->devType() == QInternal::Pixmap) { - ok = glXMakeCurrent(xinfo->display(), (GLXPixmap)d->gpm, (GLXContext)d->cx); - } else if (d->paintDevice->devType() == QInternal::Pbuffer) { - ok = glXMakeCurrent(xinfo->display(), (GLXPbuffer)d->pbuf, (GLXContext)d->cx); - } else if (d->paintDevice->devType() == QInternal::Widget) { - ok = glXMakeCurrent(xinfo->display(), ((QWidget *)d->paintDevice)->internalWinId(), (GLXContext)d->cx); - } - if (!ok) - qWarning("QGLContext::makeCurrent(): Failed."); - - if (ok) - QGLContextPrivate::setCurrentContext(this); -} - -void QGLContext::doneCurrent() -{ - Q_D(QGLContext); - glXMakeCurrent(qt_x11Info(d->paintDevice)->display(), 0, 0); - QGLContextPrivate::setCurrentContext(0); -} - - -void QGLContext::swapBuffers() const -{ - Q_D(const QGLContext); - if (!d->valid) - return; - if (!deviceIsPixmap()) { - int interval = d->glFormat.swapInterval(); - if (interval > 0) { - typedef int (*qt_glXGetVideoSyncSGI)(uint *); - typedef int (*qt_glXWaitVideoSyncSGI)(int, int, uint *); - static qt_glXGetVideoSyncSGI glXGetVideoSyncSGI = 0; - static qt_glXWaitVideoSyncSGI glXWaitVideoSyncSGI = 0; - static bool resolved = false; - if (!resolved) { - const QX11Info *xinfo = qt_x11Info(d->paintDevice); - QGLExtensionMatcher extensions(glXQueryExtensionsString(xinfo->display(), xinfo->screen())); - if (extensions.match("GLX_SGI_video_sync")) { - glXGetVideoSyncSGI = (qt_glXGetVideoSyncSGI)qglx_getProcAddress("glXGetVideoSyncSGI"); - glXWaitVideoSyncSGI = (qt_glXWaitVideoSyncSGI)qglx_getProcAddress("glXWaitVideoSyncSGI"); - } - resolved = true; - } - if (glXGetVideoSyncSGI && glXWaitVideoSyncSGI) { - uint counter; - if (!glXGetVideoSyncSGI(&counter)) - glXWaitVideoSyncSGI(interval + 1, (counter + interval) % (interval + 1), &counter); - } - } - glXSwapBuffers(qt_x11Info(d->paintDevice)->display(), - static_cast(d->paintDevice)->winId()); - } -} - -QColor QGLContext::overlayTransparentColor() const -{ - if (isValid()) - return Qt::transparent; - return QColor(); // Invalid color -} - -static uint qt_transparent_pixel(VisualID id, int screen) -{ - for (int i = 0; i < trans_colors.size(); i++) { - if (trans_colors[i].vis == id && trans_colors[i].screen == screen) - return trans_colors[i].color; - } - return 0; -} - -uint QGLContext::colorIndex(const QColor& c) const -{ - Q_D(const QGLContext); - int screen = ((XVisualInfo *)d->vi)->screen; - QColormap colmap = QColormap::instance(screen); - if (isValid()) { - if (format().plane() && c == Qt::transparent) { - return qt_transparent_pixel(((XVisualInfo *)d->vi)->visualid, - ((XVisualInfo *)d->vi)->screen); - } - if (((XVisualInfo*)d->vi)->visualid == - XVisualIDFromVisual((Visual *) QX11Info::appVisual(screen))) - return colmap.pixel(c); // We're using QColor's cmap - - XVisualInfo *info = (XVisualInfo *) d->vi; - CMapEntryHash *hash = cmap_handler()->cmap_hash; - CMapEntryHash::ConstIterator it = hash->constFind(long(info->visualid) - + (info->screen * 256)); - QCMapEntry *x = 0; - if (it != hash->constEnd()) - x = it.value(); - if (x && !x->alloc) { // It's a standard colormap - int rf = (int)(((float)c.red() * (x->scmap.red_max+1))/256.0); - int gf = (int)(((float)c.green() * (x->scmap.green_max+1))/256.0); - int bf = (int)(((float)c.blue() * (x->scmap.blue_max+1))/256.0); - uint p = x->scmap.base_pixel - + (rf * x->scmap.red_mult) - + (gf * x->scmap.green_mult) - + (bf * x->scmap.blue_mult); - return p; - } else { - QMap &cmap = (*cmap_handler()->qglcmap_hash)[(long)info->visualid]; - - // already in the map? - QRgb target = c.rgb(); - QMap::Iterator it = cmap.begin(); - for (; it != cmap.end(); ++it) { - if ((*it) == target) - return it.key(); - } - - // need to alloc color - unsigned long plane_mask[2]; - unsigned long color_map_entry; - if (!XAllocColorCells (QX11Info::display(), x->cmap, true, plane_mask, 0, - &color_map_entry, 1)) - return colmap.pixel(c); - - XColor col; - col.flags = DoRed | DoGreen | DoBlue; - col.pixel = color_map_entry; - col.red = (ushort)((qRed(c.rgb()) / 255.0) * 65535.0 + 0.5); - col.green = (ushort)((qGreen(c.rgb()) / 255.0) * 65535.0 + 0.5); - col.blue = (ushort)((qBlue(c.rgb()) / 255.0) * 65535.0 + 0.5); - XStoreColor(QX11Info::display(), x->cmap, &col); - - cmap.insert(color_map_entry, target); - return color_map_entry; - } - } - return 0; -} - -#ifndef QT_NO_FONTCONFIG -/*! \internal - This is basically a substitute for glxUseXFont() which can only - handle XLFD fonts. This version relies on freetype to render the - glyphs, but it works with all fonts that fontconfig provides - both - antialiased and aliased bitmap and outline fonts. -*/ -static void qgl_use_font(QFontEngineFT *engine, int first, int count, int listBase) -{ - GLfloat color[4]; - glGetFloatv(GL_CURRENT_COLOR, color); - - // save the pixel unpack state - GLint gl_swapbytes, gl_lsbfirst, gl_rowlength, gl_skiprows, gl_skippixels, gl_alignment; - glGetIntegerv (GL_UNPACK_SWAP_BYTES, &gl_swapbytes); - glGetIntegerv (GL_UNPACK_LSB_FIRST, &gl_lsbfirst); - glGetIntegerv (GL_UNPACK_ROW_LENGTH, &gl_rowlength); - glGetIntegerv (GL_UNPACK_SKIP_ROWS, &gl_skiprows); - glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &gl_skippixels); - glGetIntegerv (GL_UNPACK_ALIGNMENT, &gl_alignment); - - glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); - glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - const bool antialiased = engine->drawAntialiased(); - FT_Face face = engine->lockFace(); - - // start generating font glyphs - for (int i = first; i < count; ++i) { - int list = listBase + i; - GLfloat x0, y0, dx, dy; - - FT_Error err; - - err = FT_Load_Glyph(face, FT_Get_Char_Index(face, i), FT_LOAD_DEFAULT); - if (err) { - qDebug("failed loading glyph %d from font", i); - Q_ASSERT(!err); - } - err = FT_Render_Glyph(face->glyph, (antialiased ? FT_RENDER_MODE_NORMAL - : FT_RENDER_MODE_MONO)); - if (err) { - qDebug("failed rendering glyph %d from font", i); - Q_ASSERT(!err); - } - - FT_Bitmap bm = face->glyph->bitmap; - x0 = face->glyph->metrics.horiBearingX >> 6; - y0 = (face->glyph->metrics.height - face->glyph->metrics.horiBearingY) >> 6; - dx = face->glyph->metrics.horiAdvance >> 6; - dy = 0; - int sz = bm.pitch * bm.rows; - uint *aa_glyph = 0; - uchar *ua_glyph = 0; - - if (antialiased) - aa_glyph = new uint[sz]; - else - ua_glyph = new uchar[sz]; - - // convert to GL format - for (int y = 0; y < bm.rows; ++y) { - for (int x = 0; x < bm.pitch; ++x) { - int c1 = y*bm.pitch + x; - int c2 = (bm.rows - y - 1) > 0 ? (bm.rows-y-1)*bm.pitch + x : x; - if (antialiased) { - aa_glyph[c1] = (int(color[0]*255) << 24) - | (int(color[1]*255) << 16) - | (int(color[2]*255) << 8) | bm.buffer[c2]; - } else { - ua_glyph[c1] = bm.buffer[c2]; - } - } - } - - glNewList(list, GL_COMPILE); - if (antialiased) { - // calling glBitmap() is just a trick to move the current - // raster pos, since glGet*() won't work in display lists - glBitmap(0, 0, 0, 0, x0, -y0, 0); - glDrawPixels(bm.pitch, bm.rows, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, aa_glyph); - glBitmap(0, 0, 0, 0, dx-x0, y0, 0); - } else { - glBitmap(bm.pitch*8, bm.rows, -x0, y0, dx, dy, ua_glyph); - } - glEndList(); - antialiased ? delete[] aa_glyph : delete[] ua_glyph; - } - - engine->unlockFace(); - - // restore pixel unpack settings - glPixelStorei(GL_UNPACK_SWAP_BYTES, gl_swapbytes); - glPixelStorei(GL_UNPACK_LSB_FIRST, gl_lsbfirst); - glPixelStorei(GL_UNPACK_ROW_LENGTH, gl_rowlength); - glPixelStorei(GL_UNPACK_SKIP_ROWS, gl_skiprows); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, gl_skippixels); - glPixelStorei(GL_UNPACK_ALIGNMENT, gl_alignment); -} -#endif - -#undef d -void QGLContext::generateFontDisplayLists(const QFont & fnt, int listBase) -{ - QFont f(fnt); - QFontEngine *engine = f.d->engineForScript(QUnicodeTables::Common); - - if (engine->type() == QFontEngine::Multi) - engine = static_cast(engine)->engine(0); -#ifndef QT_NO_FONTCONFIG - if(engine->type() == QFontEngine::Freetype) { - qgl_use_font(static_cast(engine), 0, 256, listBase); - return; - } -#endif - // glXUseXFont() only works with XLFD font structures and a few GL - // drivers crash if 0 is passed as the font handle - f.setStyleStrategy(QFont::OpenGLCompatible); - if (f.handle() && engine->type() == QFontEngine::XLFD) - glXUseXFont(static_cast(f.handle()), 0, 256, listBase); -} - -void *QGLContext::getProcAddress(const QString &proc) const -{ - typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); - static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; - static bool resolved = false; - - if (resolved && !glXGetProcAddressARB) - return 0; - if (!glXGetProcAddressARB) { - QGLExtensionMatcher extensions(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); - if (extensions.match("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 - { -#if !defined(QT_NO_LIBRARY) - extern const QString qt_gl_library_name(); - QLibrary lib(qt_gl_library_name()); - glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); -#endif - } - } - resolved = true; - } - if (!glXGetProcAddressARB) - return 0; - return glXGetProcAddressARB(reinterpret_cast(proc.toLatin1().data())); -} - -/* - QGLTemporaryContext implementation -*/ - -class QGLTemporaryContextPrivate { -public: - bool initialized; - Window drawable; - GLXContext context; - GLXDrawable oldDrawable; - GLXContext oldContext; -}; - -QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) - : d(new QGLTemporaryContextPrivate) -{ - d->initialized = false; - d->oldDrawable = 0; - d->oldContext = 0; - int screen = 0; - - int attribs[] = {GLX_RGBA, XNone}; - XVisualInfo *vi = glXChooseVisual(X11->display, screen, attribs); - if (!vi) { - qWarning("QGLTempContext: No GL capable X visuals available."); - return; - } - - int useGL; - glXGetConfig(X11->display, vi, GLX_USE_GL, &useGL); - if (!useGL) { - XFree(vi); - return; - } - - d->oldDrawable = glXGetCurrentDrawable(); - d->oldContext = glXGetCurrentContext(); - - XSetWindowAttributes a; - a.colormap = qt_gl_choose_cmap(X11->display, vi); - d->drawable = XCreateWindow(X11->display, RootWindow(X11->display, screen), - 0, 0, 1, 1, 0, - vi->depth, InputOutput, vi->visual, - CWColormap, &a); - d->context = glXCreateContext(X11->display, vi, 0, True); - if (d->context && glXMakeCurrent(X11->display, d->drawable, d->context)) { - d->initialized = true; - } else { - qWarning("QGLTempContext: Unable to create GL context."); - XDestroyWindow(X11->display, d->drawable); - } - XFree(vi); -} - -QGLTemporaryContext::~QGLTemporaryContext() -{ - if (d->initialized) { - glXMakeCurrent(X11->display, 0, 0); - glXDestroyContext(X11->display, d->context); - XDestroyWindow(X11->display, d->drawable); - } - if (d->oldDrawable && d->oldContext) - glXMakeCurrent(X11->display, d->oldDrawable, d->oldContext); -} - -/***************************************************************************** - QGLOverlayWidget (Internal overlay class for X11) - *****************************************************************************/ - -class QGLOverlayWidget : public QGLWidget -{ - Q_OBJECT -public: - QGLOverlayWidget(const QGLFormat& format, QGLWidget* parent, const QGLWidget* shareWidget=0); - -protected: - void initializeGL(); - void paintGL(); - void resizeGL(int w, int h); - bool x11Event(XEvent *e) { return realWidget->x11Event(e); } - -private: - QGLWidget* realWidget; - -private: - Q_DISABLE_COPY(QGLOverlayWidget) -}; - - -QGLOverlayWidget::QGLOverlayWidget(const QGLFormat& format, QGLWidget* parent, - const QGLWidget* shareWidget) - : QGLWidget(format, parent, shareWidget ? shareWidget->d_func()->olw : 0) -{ - setAttribute(Qt::WA_X11OpenGLOverlay); - realWidget = parent; -} - - - -void QGLOverlayWidget::initializeGL() -{ - QColor transparentColor = context()->overlayTransparentColor(); - if (transparentColor.isValid()) - qglClearColor(transparentColor); - else - qWarning("QGLOverlayWidget::initializeGL(): Could not get transparent color"); - realWidget->initializeOverlayGL(); -} - - -void QGLOverlayWidget::resizeGL(int w, int h) -{ - glViewport(0, 0, w, h); - realWidget->resizeOverlayGL(w, h); -} - - -void QGLOverlayWidget::paintGL() -{ - realWidget->paintOverlayGL(); -} - -#undef Bool -QT_BEGIN_INCLUDE_NAMESPACE -#include "qgl_x11.moc" -QT_END_INCLUDE_NAMESPACE - -/***************************************************************************** - QGLWidget UNIX/GLX-specific code - *****************************************************************************/ -void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) -{ - Q_Q(QGLWidget); - initContext(context, shareWidget); - olw = 0; - - if (q->isValid() && context->format().hasOverlay()) { - QString olwName = q->objectName(); - olwName += QLatin1String("-QGL_internal_overlay_widget"); - olw = new QGLOverlayWidget(QGLFormat::defaultOverlayFormat(), q, shareWidget); - olw->setObjectName(olwName); - if (olw->isValid()) { - olw->setAutoBufferSwap(false); - olw->setFocusProxy(q); - } - else { - delete olw; - olw = 0; - glcx->d_func()->glFormat.setOverlay(false); - } - } -} - -bool QGLWidgetPrivate::renderCxPm(QPixmap* pm) -{ - Q_Q(QGLWidget); - if (((XVisualInfo*)glcx->d_func()->vi)->depth != pm->depth()) - return false; - - GLXPixmap glPm; -#if defined(GLX_MESA_pixmap_colormap) && defined(QGL_USE_MESA_EXT) - glPm = glXCreateGLXPixmapMESA(X11->display, - (XVisualInfo*)glcx->vi, - (Pixmap)pm->handle(), - qt_gl_choose_cmap(pm->X11->display, - (XVisualInfo*)glcx->vi)); -#else - glPm = (quint32)glXCreateGLXPixmap(X11->display, - (XVisualInfo*)glcx->d_func()->vi, - (Pixmap)pm->handle()); -#endif - - if (!glXMakeCurrent(X11->display, glPm, (GLXContext)glcx->d_func()->cx)) { - glXDestroyGLXPixmap(X11->display, glPm); - return false; - } - - glDrawBuffer(GL_FRONT); - if (!glcx->initialized()) - q->glInit(); - q->resizeGL(pm->width(), pm->height()); - q->paintGL(); - glFlush(); - q->makeCurrent(); - glXDestroyGLXPixmap(X11->display, glPm); - q->resizeGL(q->width(), q->height()); - return true; -} - -void QGLWidgetPrivate::cleanupColormaps() -{ - if (!cmap.handle()) { - return; - } else { - XFreeColormap(X11->display, (Colormap) cmap.handle()); - cmap.setHandle(0); - } -} - -void QGLWidget::setMouseTracking(bool enable) -{ - Q_D(QGLWidget); - if (d->olw) - d->olw->setMouseTracking(enable); - QWidget::setMouseTracking(enable); -} - - -void QGLWidget::resizeEvent(QResizeEvent *) -{ - Q_D(QGLWidget); - if (!isValid()) - return; - makeCurrent(); - if (!d->glcx->initialized()) - glInit(); - glXWaitX(); - resizeGL(width(), height()); - if (d->olw) - d->olw->setGeometry(rect()); -} - -const QGLContext* QGLWidget::overlayContext() const -{ - Q_D(const QGLWidget); - if (d->olw) - return d->olw->context(); - else - return 0; -} - - -void QGLWidget::makeOverlayCurrent() -{ - Q_D(QGLWidget); - if (d->olw) - d->olw->makeCurrent(); -} - - -void QGLWidget::updateOverlayGL() -{ - Q_D(QGLWidget); - if (d->olw) - d->olw->updateGL(); -} - -/*! - \internal - - Sets a new QGLContext, \a context, for this QGLWidget, using the - shared context, \a shareContext. If \a deleteOldContext is true, - the original context is deleted; otherwise it is overridden. -*/ -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 (parentWidget()) { - // force creation of delay-created widgets - parentWidget()->winId(); - if (parentWidget()->x11Info().screen() != x11Info().screen()) - d_func()->xinfo = parentWidget()->d_func()->xinfo; - } - - // 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 createFailed = false; - if (!d->glcx->isValid()) { - if (!d->glcx->create(shareContext ? shareContext : oldcx)) - createFailed = true; - } - if (createFailed) { - if (deleteOldContext) - delete oldcx; - return; - } - - if (d->glcx->windowCreated() || d->glcx->deviceIsPixmap()) { - if (deleteOldContext) - delete oldcx; - return; - } - - bool visible = isVisible(); - if (visible) - hide(); - - XVisualInfo *vi = (XVisualInfo*)d->glcx->d_func()->vi; - XSetWindowAttributes a; - - QColormap colmap = QColormap::instance(vi->screen); - a.colormap = qt_gl_choose_cmap(QX11Info::display(), vi); // find best colormap - a.background_pixel = colmap.pixel(palette().color(backgroundRole())); - a.border_pixel = colmap.pixel(Qt::black); - Window p = RootWindow(X11->display, vi->screen); - if (parentWidget()) - p = parentWidget()->winId(); - - Window w = XCreateWindow(X11->display, p, x(), y(), width(), height(), - 0, vi->depth, InputOutput, vi->visual, - CWBackPixel|CWBorderPixel|CWColormap, &a); - Window *cmw; - Window *cmwret; - int count; - if (XGetWMColormapWindows(X11->display, window()->winId(), - &cmwret, &count)) { - cmw = new Window[count+1]; - memcpy((char *)cmw, (char *)cmwret, sizeof(Window)*count); - XFree((char *)cmwret); - int i; - for (i=0; i= count) // append new window - cmw[count++] = w; - } else { - count = 1; - cmw = new Window[count]; - cmw[0] = w; - } - -#if defined(GLX_MESA_release_buffers) && defined(QGL_USE_MESA_EXT) - if (oldcx && oldcx->windowCreated()) - glXReleaseBuffersMESA(X11->display, winId()); -#endif - if (deleteOldContext) - delete oldcx; - oldcx = 0; - - if (testAttribute(Qt::WA_WState_Created)) - create(w); - else - d->createWinId(w); - XSetWMColormapWindows(X11->display, window()->winId(), cmw, count); - delete [] cmw; - - // calling QWidget::create() will always result in a new paint - // engine being created - get rid of it and replace it with our - // own - - if (visible) - show(); - XFlush(X11->display); - d->glcx->setWindowCreated(true); -} - -const QGLColormap & QGLWidget::colormap() const -{ - Q_D(const QGLWidget); - return d->cmap; -} - -/*\internal - Store color values in the given colormap. -*/ -static void qStoreColors(QWidget * tlw, Colormap cmap, - const QGLColormap & cols) -{ - Q_UNUSED(tlw); - XColor c; - QRgb color; - - for (int i = 0; i < cols.size(); i++) { - color = cols.entryRgb(i); - c.pixel = i; - c.red = (ushort)((qRed(color) / 255.0) * 65535.0 + 0.5); - c.green = (ushort)((qGreen(color) / 255.0) * 65535.0 + 0.5); - c.blue = (ushort)((qBlue(color) / 255.0) * 65535.0 + 0.5); - c.flags = DoRed | DoGreen | DoBlue; - XStoreColor(X11->display, cmap, &c); - } -} - -/*\internal - Check whether the given visual supports dynamic colormaps or not. -*/ -static bool qCanAllocColors(QWidget * w) -{ - bool validVisual = false; - int numVisuals; - long mask; - XVisualInfo templ; - XVisualInfo * visuals; - VisualID id = XVisualIDFromVisual((Visual *) w->window()->x11Info().visual()); - - mask = VisualScreenMask; - templ.screen = w->x11Info().screen(); - visuals = XGetVisualInfo(X11->display, mask, &templ, &numVisuals); - - for (int i = 0; i < numVisuals; i++) { - if (visuals[i].visualid == id) { - switch (visuals[i].c_class) { - case TrueColor: - case StaticColor: - case StaticGray: - case XGrayScale: - validVisual = false; - break; - case DirectColor: - case PseudoColor: - validVisual = true; - break; - } - break; - } - } - XFree(visuals); - - if (!validVisual) - return false; - return true; -} - - -void QGLWidget::setColormap(const QGLColormap & c) -{ - Q_D(QGLWidget); - QWidget * tlw = window(); // must return a valid widget - - d->cmap = c; - if (!d->cmap.handle()) - return; - - if (!qCanAllocColors(this)) { - qWarning("QGLWidget::setColormap: Cannot create a read/write " - "colormap for this visual"); - return; - } - - // If the child GL widget is not of the same visual class as the - // toplevel widget we will get in trouble.. - Window wid = tlw->winId(); - Visual * vis = (Visual *) tlw->x11Info().visual();; - VisualID cvId = XVisualIDFromVisual((Visual *) x11Info().visual()); - VisualID tvId = XVisualIDFromVisual((Visual *) tlw->x11Info().visual()); - if (cvId != tvId) { - wid = winId(); - vis = (Visual *) x11Info().visual(); - } - - if (!d->cmap.handle()) // allocate a cmap if necessary - d->cmap.setHandle(XCreateColormap(X11->display, wid, vis, AllocAll)); - - qStoreColors(this, (Colormap) d->cmap.handle(), c); - XSetWindowColormap(X11->display, wid, (Colormap) d->cmap.handle()); - - // tell the wm that this window has a special colormap - Window * cmw; - Window * cmwret; - int count; - if (XGetWMColormapWindows(X11->display, tlw->winId(), &cmwret, &count)) - { - cmw = new Window[count+1]; - memcpy((char *) cmw, (char *) cmwret, sizeof(Window) * count); - XFree((char *) cmwret); - int i; - for (i = 0; i < count; i++) { - if (cmw[i] == winId()) { - break; - } - } - if (i >= count) // append new window only if not in the list - cmw[count++] = winId(); - } else { - count = 1; - cmw = new Window[count]; - cmw[0] = winId(); - } - XSetWMColormapWindows(X11->display, tlw->winId(), cmw, count); - delete [] cmw; -} - -// Solaris defines glXBindTexImageEXT as part of the GL library -#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) -typedef void (*qt_glXBindTexImageEXT)(Display*, GLXDrawable, int, const int*); -typedef void (*qt_glXReleaseTexImageEXT)(Display*, GLXDrawable, int); -static qt_glXBindTexImageEXT glXBindTexImageEXT = 0; -static qt_glXReleaseTexImageEXT glXReleaseTexImageEXT = 0; - -static bool qt_resolveTextureFromPixmap(QPaintDevice *paintDevice) -{ - static bool resolvedTextureFromPixmap = false; - - if (!resolvedTextureFromPixmap) { - resolvedTextureFromPixmap = true; - - // Check to see if we have NPOT texture support - if ( !(QGLExtensions::glExtensions() & QGLExtensions::NPOTTextures) && - !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)) - { - return false; // Can't use TFP without NPOT - } - - const QX11Info *xinfo = qt_x11Info(paintDevice); - Display *display = xinfo ? xinfo->display() : X11->display; - int screen = xinfo ? xinfo->screen() : X11->defaultScreen; - - QGLExtensionMatcher serverExtensions(glXQueryExtensionsString(display, screen)); - QGLExtensionMatcher clientExtensions(glXGetClientString(display, GLX_EXTENSIONS)); - if (serverExtensions.match("GLX_EXT_texture_from_pixmap") - && clientExtensions.match("GLX_EXT_texture_from_pixmap")) - { - glXBindTexImageEXT = (qt_glXBindTexImageEXT) qglx_getProcAddress("glXBindTexImageEXT"); - glXReleaseTexImageEXT = (qt_glXReleaseTexImageEXT) qglx_getProcAddress("glXReleaseTexImageEXT"); - } - } - - return glXBindTexImageEXT && glXReleaseTexImageEXT; -} -#endif //defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - - -QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, const qint64 key, - QGLContext::BindOptions options) -{ -#if !defined(GLX_VERSION_1_3) || defined(Q_OS_HPUX) - return 0; -#else - - // Check we have GLX 1.3, as it is needed for glXCreatePixmap & glXDestroyPixmap - int majorVersion = 0; - int minorVersion = 0; - glXQueryVersion(X11->display, &majorVersion, &minorVersion); - if (majorVersion < 1 || (majorVersion == 1 && minorVersion < 3)) - return 0; - - Q_Q(QGLContext); - - QX11PixmapData *pixmapData = static_cast(pixmap->data_ptr().data()); - Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); - - // We can't use TFP if the pixmap has a separate X11 mask - if (pixmapData->x11_mask) - return 0; - - if (!qt_resolveTextureFromPixmap(paintDevice)) - return 0; - - const QX11Info &x11Info = pixmapData->xinfo; - - // Store the configs (Can be static because configs aren't dependent on current context) - static GLXFBConfig glxRGBPixmapConfig = 0; - static bool RGBConfigInverted = false; - static GLXFBConfig glxRGBAPixmapConfig = 0; - static bool RGBAConfigInverted = false; - - bool hasAlpha = pixmapData->hasAlphaChannel(); - - // Check to see if we need a config - if ( (hasAlpha && !glxRGBAPixmapConfig) || (!hasAlpha && !glxRGBPixmapConfig) ) { - GLXFBConfig *configList = 0; - int configCount = 0; - - int configAttribs[] = { - hasAlpha ? GLX_BIND_TO_TEXTURE_RGBA_EXT : GLX_BIND_TO_TEXTURE_RGB_EXT, True, - GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, - GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, - // QGLContext::bindTexture() can't return an inverted texture, but QPainter::drawPixmap() can: - GLX_Y_INVERTED_EXT, options & QGLContext::CanFlipNativePixmapBindOption ? GLX_DONT_CARE : False, - XNone - }; - configList = glXChooseFBConfig(x11Info.display(), x11Info.screen(), configAttribs, &configCount); - if (!configList) - return 0; - - int yInv; - glXGetFBConfigAttrib(x11Info.display(), configList[0], GLX_Y_INVERTED_EXT, &yInv); - - if (hasAlpha) { - glxRGBAPixmapConfig = configList[0]; - RGBAConfigInverted = yInv; - } - else { - glxRGBPixmapConfig = configList[0]; - RGBConfigInverted = yInv; - } - - XFree(configList); - } - - // Check to see if the surface is still valid - if (pixmapData->gl_surface && - hasAlpha != (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) - { - // Surface is invalid! - destroyGlSurfaceForPixmap(pixmapData); - } - - // Check to see if we need a surface - if (!pixmapData->gl_surface) { - GLXPixmap glxPixmap; - int pixmapAttribs[] = { - GLX_TEXTURE_FORMAT_EXT, hasAlpha ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT, - GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, - GLX_MIPMAP_TEXTURE_EXT, False, // Maybe needs to be don't care - XNone - }; - - // Wrap the X Pixmap into a GLXPixmap: - glxPixmap = glXCreatePixmap(x11Info.display(), - hasAlpha ? glxRGBAPixmapConfig : glxRGBPixmapConfig, - pixmapData->handle(), pixmapAttribs); - - if (!glxPixmap) - return 0; - - pixmapData->gl_surface = (void*)glxPixmap; - - // Make sure the cleanup hook gets called so we can delete the glx pixmap - QImagePixmapCleanupHooks::enableCleanupHooks(pixmapData); - } - - GLuint textureId; - glGenTextures(1, &textureId); - glBindTexture(GL_TEXTURE_2D, textureId); - glXBindTexImageEXT(x11Info.display(), (GLXPixmap)pixmapData->gl_surface, GLX_FRONT_LEFT_EXT, 0); - - glBindTexture(GL_TEXTURE_2D, textureId); - GLuint filtering = (options & QGLContext::LinearFilteringBindOption) ? GL_LINEAR : GL_NEAREST; - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering); - - if (!((hasAlpha && RGBAConfigInverted) || (!hasAlpha && RGBConfigInverted))) - options &= ~QGLContext::InvertedYBindOption; - - QGLTexture *texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); - if (texture->options & QGLContext::InvertedYBindOption) - pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; - - // We assume the cost of bound pixmaps is zero - QGLTextureCache::instance()->insert(q, key, texture, 0); - - return texture; -#endif //!defined(GLX_VERSION_1_3) || defined(Q_OS_HPUX) -} - - -void QGLContextPrivate::destroyGlSurfaceForPixmap(QPixmapData* pmd) -{ -#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - QX11PixmapData *pixmapData = static_cast(pmd); - if (pixmapData->gl_surface) { - glXDestroyPixmap(QX11Info::display(), (GLXPixmap)pixmapData->gl_surface); - pixmapData->gl_surface = 0; - } -#endif -} - -void QGLContextPrivate::unbindPixmapFromTexture(QPixmapData* pmd) -{ -#if defined(GLX_VERSION_1_3) && !defined(Q_OS_HPUX) - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - Q_ASSERT(QGLContext::currentContext()); - QX11PixmapData *pixmapData = static_cast(pmd); - if (pixmapData->gl_surface) - glXReleaseTexImageEXT(QX11Info::display(), (GLXPixmap)pixmapData->gl_surface, GLX_FRONT_LEFT_EXT); -#endif -} - -QT_END_NAMESPACE diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp deleted file mode 100644 index 4dd7fc2f5d8..00000000000 --- a/src/opengl/qgl_x11egl.cpp +++ /dev/null @@ -1,562 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgl.h" -#include -#include -#include -#include -#include "qgl_egl_p.h" -#include "qcolormap.h" -#include -#include - - -QT_BEGIN_NAMESPACE - - -/* - QGLTemporaryContext implementation -*/ - -class QGLTemporaryContextPrivate -{ -public: - bool initialized; - Window window; - EGLContext context; - EGLSurface surface; - EGLDisplay display; -}; - -QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) - : d(new QGLTemporaryContextPrivate) -{ - d->initialized = false; - d->window = 0; - d->context = 0; - d->surface = 0; - int screen = 0; - - d->display = QEgl::display(); - - EGLConfig config; - int numConfigs = 0; - EGLint attribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, -#ifdef QT_OPENGL_ES_2 - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, -#endif - EGL_NONE - }; - - eglChooseConfig(d->display, attribs, &config, 1, &numConfigs); - if (!numConfigs) { - qWarning("QGLTemporaryContext: No EGL configurations available."); - return; - } - - XVisualInfo visualInfo; - XVisualInfo *vi; - int numVisuals; - - visualInfo.visualid = QEgl::getCompatibleVisualId(config); - vi = XGetVisualInfo(X11->display, VisualIDMask, &visualInfo, &numVisuals); - if (!vi || numVisuals < 1) { - qWarning("QGLTemporaryContext: Unable to get X11 visual info id."); - return; - } - - XSetWindowAttributes attr; - unsigned long mask; - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(X11->display, DefaultRootWindow(X11->display), vi->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask; - mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - - d->window = XCreateWindow(X11->display, RootWindow(X11->display, screen), - 0, 0, 1, 1, 0, - vi->depth, InputOutput, vi->visual, - mask, &attr); - - d->surface = eglCreateWindowSurface(d->display, config, (EGLNativeWindowType) d->window, NULL); - - if (d->surface == EGL_NO_SURFACE) { - qWarning("QGLTemporaryContext: Error creating EGL surface."); - XFree(vi); - XDestroyWindow(X11->display, d->window); - return; - } - - EGLint contextAttribs[] = { -#ifdef QT_OPENGL_ES_2 - EGL_CONTEXT_CLIENT_VERSION, 2, -#endif - EGL_NONE - }; - d->context = eglCreateContext(d->display, config, 0, contextAttribs); - if (d->context != EGL_NO_CONTEXT - && eglMakeCurrent(d->display, d->surface, d->surface, d->context)) - { - d->initialized = true; - } else { - qWarning("QGLTemporaryContext: Error creating EGL context."); - eglDestroySurface(d->display, d->surface); - XDestroyWindow(X11->display, d->window); - } - XFree(vi); -} - -QGLTemporaryContext::~QGLTemporaryContext() -{ - if (d->initialized) { - eglMakeCurrent(d->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroyContext(d->display, d->context); - eglDestroySurface(d->display, d->surface); - XDestroyWindow(X11->display, d->window); - } -} - -bool QGLFormat::hasOpenGLOverlays() -{ - return false; -} - -// Chooses the EGL config and creates the EGL context -bool QGLContext::chooseContext(const QGLContext* shareContext) -{ - Q_D(QGLContext); - - if (!device()) - return false; - - int devType = device()->devType(); - - QX11PixmapData *x11PixmapData = 0; - if (devType == QInternal::Pixmap) { - QPixmapData *pmd = static_cast(device())->data_ptr().data(); - if (pmd->classId() == QPixmapData::X11Class) - x11PixmapData = static_cast(pmd); - else { - // TODO: Replace the pixmap's data with a new QX11PixmapData - qWarning("WARNING: Creating a QGLContext on a QPixmap is only supported for X11 pixmap backend"); - return false; - } - } else if ((devType != QInternal::Widget) && (devType != QInternal::Pbuffer)) { - qWarning("WARNING: Creating a QGLContext not supported on device type %d", devType); - return false; - } - - // Only create the eglContext if we don't already have one: - if (d->eglContext == 0) { - d->eglContext = new QEglContext(); - d->ownsEglContext = true; - d->eglContext->setApi(QEgl::OpenGL); - - // If the device is a widget with WA_TranslucentBackground set, make sure the glFormat - // has the alpha channel option set: - if (devType == QInternal::Widget) { - QWidget* widget = static_cast(device()); - if (widget->testAttribute(Qt::WA_TranslucentBackground)) - d->glFormat.setAlpha(true); - } - - // Construct the configuration we need for this surface. - QEglProperties configProps; - configProps.setDeviceType(devType); - configProps.setRenderableType(QEgl::OpenGL); - qt_eglproperties_set_glformat(configProps, d->glFormat); - - // Set buffer preserved for regular QWidgets, QGLWidgets are ok with either preserved or destroyed: - if ((devType == QInternal::Widget) && qobject_cast(static_cast(device())) == 0) - configProps.setValue(EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - - if (!d->eglContext->chooseConfig(configProps, QEgl::BestPixelFormat)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - - // Create a new context for the configuration. - QEglContext* eglSharedContext = shareContext ? shareContext->d_func()->eglContext : 0; - if (!d->eglContext->createContext(eglSharedContext)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - d->sharing = d->eglContext->isSharing(); - if (d->sharing && shareContext) - const_cast(shareContext)->d_func()->sharing = true; - } - - // Inform the higher layers about the actual format properties - qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config()); - - // Do don't create the EGLSurface for everything. - // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface - // QGLWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface - // QPixmap - yes, create the EGLSurface but store it in QX11PixmapData::gl_surface - // QGLPixelBuffer - no, it creates the surface itself and stores it in QGLPixelBufferPrivate::pbuf - - if (devType == QInternal::Widget) { - if (d->eglSurface != EGL_NO_SURFACE) - eglDestroySurface(d->eglContext->display(), d->eglSurface); - // extraWindowSurfaceCreationProps default to NULL unless were specifically set before - d->eglSurface = QEgl::createSurface(device(), d->eglContext->config(), d->extraWindowSurfaceCreationProps); - XFlush(X11->display); - setWindowCreated(true); - } - - if (x11PixmapData) { - // TODO: Actually check to see if the existing surface can be re-used - if (x11PixmapData->gl_surface) - eglDestroySurface(d->eglContext->display(), (EGLSurface)x11PixmapData->gl_surface); - - x11PixmapData->gl_surface = (void*)QEgl::createSurface(device(), d->eglContext->config()); - } - - return true; -} - -void *QGLContext::chooseVisual() -{ - qFatal("QGLContext::chooseVisual - this method must not be called as Qt is built with EGL support"); - return 0; -} - -void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth) -{ - Q_UNUSED(f); - Q_UNUSED(bufDepth); - qFatal("QGLContext::tryVisual - this method must not be called as Qt is built with EGL support"); - return 0; -} - -void QGLWidget::resizeEvent(QResizeEvent *) -{ - Q_D(QGLWidget); - if (!isValid()) - return; - makeCurrent(); - if (!d->glcx->initialized()) - glInit(); - resizeGL(width(), height()); - //handle overlay -} - -const QGLContext* QGLWidget::overlayContext() const -{ - return 0; -} - -void QGLWidget::makeOverlayCurrent() -{ - //handle overlay -} - -void QGLWidget::updateOverlayGL() -{ - //handle overlay -} - -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; - - bool createFailed = false; - if (!d->glcx->isValid()) { - // Create the QGLContext here, which in turn chooses the EGL config - // and creates the EGL context: - if (!d->glcx->create(shareContext ? shareContext : oldcx)) - createFailed = true; - } - if (createFailed) { - if (deleteOldContext) - delete oldcx; - return; - } - - - d->eglSurfaceWindowId = winId(); // Remember the window id we created the surface for -} - -void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget* shareWidget) -{ - Q_Q(QGLWidget); - - initContext(context, shareWidget); - - if (q->isValid() && glcx->format().hasOverlay()) { - //no overlay - qWarning("QtOpenGL ES doesn't currently support overlays"); - } -} - -void QGLWidgetPrivate::cleanupColormaps() -{ -} - -const QGLColormap & QGLWidget::colormap() const -{ - return d_func()->cmap; -} - -void QGLWidget::setColormap(const QGLColormap &) -{ -} - -// Re-creates the EGL surface if the window ID has changed or if there isn't a surface -void QGLWidgetPrivate::recreateEglSurface() -{ - Q_Q(QGLWidget); - - Window currentId = q->winId(); - - // If the window ID has changed since the surface was created, we need to delete the - // old surface before re-creating a new one. Note: This should not be the case as the - // surface should be deleted before the old window id. - if (glcx->d_func()->eglSurface != EGL_NO_SURFACE && (currentId != eglSurfaceWindowId)) { - qWarning("EGL surface for deleted window %lx was not destroyed", uint(eglSurfaceWindowId)); - glcx->d_func()->destroyEglSurfaceForDevice(); - } - - if (glcx->d_func()->eglSurface == EGL_NO_SURFACE) { - glcx->d_func()->eglSurface = glcx->d_func()->eglContext->createSurface(q); - eglSurfaceWindowId = currentId; - } -} - - -QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, const qint64 key, - QGLContext::BindOptions options) -{ - Q_Q(QGLContext); - - // The EGL texture_from_pixmap has no facility to invert the y coordinate - if (!(options & QGLContext::CanFlipNativePixmapBindOption)) - return 0; - - - static bool checkedForTFP = false; - static bool haveTFP = false; - static bool checkedForEglImageTFP = false; - static bool haveEglImageTFP = false; - - - if (!checkedForEglImageTFP) { - checkedForEglImageTFP = true; - - // We need to be able to create an EGLImage from a native pixmap, which was split - // into a separate EGL extension, EGL_KHR_image_pixmap. It is possible to have - // eglCreateImageKHR & eglDestroyImageKHR without support for pixmaps, so we must - // check we have the EGLImage from pixmap functionality. - if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_pixmap")) { - - // Being able to create an EGLImage from a native pixmap is also pretty useless - // without the ability to bind that EGLImage as a texture, which is provided by - // the GL_OES_EGL_image extension, which we try to resolve here: - haveEglImageTFP = qt_resolve_eglimage_gl_extensions(q); - - if (haveEglImageTFP) - qDebug("Found EGL_KHR_image_pixmap & GL_OES_EGL_image extensions (preferred method)!"); - } - } - - if (!checkedForTFP) { - // Check for texture_from_pixmap egl extension - checkedForTFP = true; - if (QEgl::hasExtension("EGL_NOKIA_texture_from_pixmap") || - QEgl::hasExtension("EGL_EXT_texture_from_pixmap")) - { - qDebug("Found texture_from_pixmap EGL extension!"); - haveTFP = true; - } - } - - if (!haveTFP && !haveEglImageTFP) - return 0; - - - QX11PixmapData *pixmapData = static_cast(pixmap->data_ptr().data()); - Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); - bool hasAlpha = pixmapData->hasAlphaChannel(); - bool pixmapHasValidSurface = false; - bool textureIsBound = false; - GLuint textureId; - glGenTextures(1, &textureId); - glBindTexture(GL_TEXTURE_2D, textureId); - - if (haveTFP && pixmapData->gl_surface && - hasAlpha == (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) - { - pixmapHasValidSurface = true; - } - - // If we already have a valid EGL surface for the pixmap, we should use it - if (pixmapHasValidSurface) { - EGLBoolean success; - success = eglBindTexImage(QEgl::display(), (EGLSurface)pixmapData->gl_surface, EGL_BACK_BUFFER); - if (success == EGL_FALSE) { - qWarning() << "eglBindTexImage() failed:" << QEgl::errorString(); - eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); - pixmapData->gl_surface = (void*)EGL_NO_SURFACE; - } else - textureIsBound = true; - } - - // If the pixmap doesn't already have a valid surface, try binding it via EGLImage - // first, as going through EGLImage should be faster and better supported: - if (!textureIsBound && haveEglImageTFP) { - EGLImageKHR eglImage; - - EGLint attribs[] = { - EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, - EGL_NONE - }; - eglImage = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer)QEgl::nativePixmap(pixmap), attribs); - - QGLContext* ctx = q; - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglImage); - - GLint err = glGetError(); - if (err == GL_NO_ERROR) - textureIsBound = true; - - // Once the egl image is bound, the texture becomes a new sibling image and we can safely - // destroy the EGLImage we created for the pixmap: - if (eglImage != EGL_NO_IMAGE_KHR) - QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); - } - - if (!textureIsBound && haveTFP) { - // Check to see if the surface is still valid - if (pixmapData->gl_surface && - hasAlpha != (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) - { - // Surface is invalid! - destroyGlSurfaceForPixmap(pixmapData); - } - - if (pixmapData->gl_surface == 0) { - EGLConfig config = QEgl::defaultConfig(QInternal::Pixmap, - QEgl::OpenGL, - hasAlpha ? QEgl::Translucent : QEgl::NoOptions); - - pixmapData->gl_surface = (void*)QEgl::createSurface(pixmap, config); - if (pixmapData->gl_surface == (void*)EGL_NO_SURFACE) - return false; - } - - EGLBoolean success; - success = eglBindTexImage(QEgl::display(), (EGLSurface)pixmapData->gl_surface, EGL_BACK_BUFFER); - if (success == EGL_FALSE) { - qWarning() << "eglBindTexImage() failed:" << QEgl::errorString(); - eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); - pixmapData->gl_surface = (void*)EGL_NO_SURFACE; - haveTFP = false; // If TFP isn't working, disable it's use - } else - textureIsBound = true; - } - - QGLTexture *texture = 0; - - if (textureIsBound) { - texture = new QGLTexture(q, textureId, GL_TEXTURE_2D, options); - pixmapData->flags |= QX11PixmapData::InvertedWhenBoundToTexture; - - // We assume the cost of bound pixmaps is zero - QGLTextureCache::instance()->insert(q, key, texture, 0); - - glBindTexture(GL_TEXTURE_2D, textureId); - } else - glDeleteTextures(1, &textureId); - - return texture; -} - - -void QGLContextPrivate::destroyGlSurfaceForPixmap(QPixmapData* pmd) -{ - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - QX11PixmapData *pixmapData = static_cast(pmd); - if (pixmapData->gl_surface) { - EGLBoolean success; - success = eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); - if (success == EGL_FALSE) { - qWarning() << "destroyGlSurfaceForPixmap() - Error deleting surface: " - << QEgl::errorString(); - } - pixmapData->gl_surface = 0; - } -} - -void QGLContextPrivate::unbindPixmapFromTexture(QPixmapData* pmd) -{ - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - QX11PixmapData *pixmapData = static_cast(pmd); - if (pixmapData->gl_surface) { - EGLBoolean success; - success = eglReleaseTexImage(QEgl::display(), - (EGLSurface)pixmapData->gl_surface, - EGL_BACK_BUFFER); - if (success == EGL_FALSE) { - qWarning() << "unbindPixmapFromTexture() - Unable to release bound texture: " - << QEgl::errorString(); - } - } -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglbuffer.cpp b/src/opengl/qglbuffer.cpp index a1ec3ef8e08..c1128a0ebd2 100644 --- a/src/opengl/qglbuffer.cpp +++ b/src/opengl/qglbuffer.cpp @@ -141,7 +141,7 @@ public: QAtomicInt ref; QGLBuffer::Type type; - QGLSharedResourceGuard guard; + QGLSharedResourceGuardBase *guard; QGLBuffer::UsagePattern usagePattern; QGLBuffer::UsagePattern actualUsagePattern; }; @@ -184,7 +184,7 @@ QGLBuffer::QGLBuffer(const QGLBuffer &other) d_ptr->ref.ref(); } -#define ctx d->guard.context() +#define ctx QGLContext::currentContext(); /*! Destroys this buffer object, including the storage being @@ -245,21 +245,19 @@ QGLBuffer::UsagePattern QGLBuffer::usagePattern() const void QGLBuffer::setUsagePattern(QGLBuffer::UsagePattern value) { Q_D(QGLBuffer); -#if defined(QT_OPENGL_ES_1) - // OpenGL/ES 1.1 does not support GL_STREAM_DRAW, so use GL_STATIC_DRAW. - // OpenGL/ES 2.0 does support GL_STREAM_DRAW. - d->usagePattern = value; - if (value == StreamDraw) - d->actualUsagePattern = StaticDraw; - else - d->actualUsagePattern = value; -#else d->usagePattern = d->actualUsagePattern = value; -#endif } #undef ctx +namespace { + void freeBufferFunc(QGLContext *ctx, GLuint id) + { + Q_UNUSED(ctx); + glDeleteBuffers(1, &id); + } +} + /*! Creates the buffer object in the GL server. Returns true if the object was created; false otherwise. @@ -276,24 +274,26 @@ void QGLBuffer::setUsagePattern(QGLBuffer::UsagePattern value) bool QGLBuffer::create() { Q_D(QGLBuffer); - if (d->guard.id()) + if (d->guard && d->guard->id()) return true; - const QGLContext *ctx = QGLContext::currentContext(); + QGLContext *ctx = const_cast(QGLContext::currentContext()); if (ctx) { - if (!qt_resolve_buffer_extensions(const_cast(ctx))) + if (!qt_resolve_buffer_extensions(ctx)) return false; GLuint bufferId = 0; glGenBuffers(1, &bufferId); if (bufferId) { - d->guard.setContext(ctx); - d->guard.setId(bufferId); + if (d->guard) + d->guard->free(); + + d->guard = createSharedResourceGuard(ctx, bufferId, freeBufferFunc); return true; } } return false; } -#define ctx d->guard.context() +#define ctx QGLContext::currentContext() /*! Returns true if this buffer has been created; false otherwise. @@ -303,7 +303,7 @@ bool QGLBuffer::create() bool QGLBuffer::isCreated() const { Q_D(const QGLBuffer); - return d->guard.id() != 0; + return d->guard && d->guard->id(); } /*! @@ -314,14 +314,10 @@ bool QGLBuffer::isCreated() const void QGLBuffer::destroy() { Q_D(QGLBuffer); - GLuint bufferId = d->guard.id(); - if (bufferId) { - // Switch to the original creating context to destroy it. - QGLShareContextScope scope(d->guard.context()); - glDeleteBuffers(1, &bufferId); + if (d->guard) { + d->guard->free(); + d->guard = 0; } - d->guard.setId(0); - d->guard.setContext(0); } /*! @@ -338,7 +334,7 @@ bool QGLBuffer::read(int offset, void *data, int count) { #if !defined(QT_OPENGL_ES) Q_D(QGLBuffer); - if (!glGetBufferSubData || !d->guard.id()) + if (!glGetBufferSubData || !d->guard->id()) return false; while (glGetError() != GL_NO_ERROR) ; // Clear error state. glGetBufferSubData(d->type, offset, count, data); @@ -368,7 +364,7 @@ void QGLBuffer::write(int offset, const void *data, int count) qWarning("QGLBuffer::allocate(): buffer not created"); #endif Q_D(QGLBuffer); - if (d->guard.id()) + if (d->guard && d->guard->id()) glBufferSubData(d->type, offset, count, data); } @@ -388,7 +384,7 @@ void QGLBuffer::allocate(const void *data, int count) qWarning("QGLBuffer::allocate(): buffer not created"); #endif Q_D(QGLBuffer); - if (d->guard.id()) + if (d->guard && d->guard->id()) glBufferData(d->type, count, data, d->actualUsagePattern); } @@ -423,10 +419,9 @@ bool QGLBuffer::bind() qWarning("QGLBuffer::bind(): buffer not created"); #endif Q_D(const QGLBuffer); - GLuint bufferId = d->guard.id(); + GLuint bufferId = d->guard ? d->guard->id() : 0; if (bufferId) { - if (!QGLContext::areSharing(QGLContext::currentContext(), - d->guard.context())) { + if (d->guard->group() != QOpenGLContextGroup::currentContextGroup()) { #ifndef QT_NO_DEBUG qWarning("QGLBuffer::bind: buffer is not valid in the current context"); #endif @@ -455,7 +450,7 @@ void QGLBuffer::release() qWarning("QGLBuffer::release(): buffer not created"); #endif Q_D(const QGLBuffer); - if (d->guard.id()) + if (d->guard && d->guard->id()) glBindBuffer(d->type, 0); } @@ -481,7 +476,7 @@ void QGLBuffer::release(QGLBuffer::Type type) glBindBuffer(GLenum(type), 0); } -#define ctx d->guard.context() +#define ctx QGLContext::currentContext() /*! Returns the GL identifier associated with this buffer; zero if @@ -492,7 +487,7 @@ void QGLBuffer::release(QGLBuffer::Type type) GLuint QGLBuffer::bufferId() const { Q_D(const QGLBuffer); - return d->guard.id(); + return d->guard ? d->guard->id() : 0; } #ifndef GL_BUFFER_SIZE @@ -511,7 +506,7 @@ GLuint QGLBuffer::bufferId() const int QGLBuffer::size() const { Q_D(const QGLBuffer); - if (!d->guard.id()) + if (!d->guard || !d->guard->id()) return -1; GLint value = -1; glGetBufferParameteriv(d->type, GL_BUFFER_SIZE, &value); @@ -539,7 +534,7 @@ void *QGLBuffer::map(QGLBuffer::Access access) if (!isCreated()) qWarning("QGLBuffer::map(): buffer not created"); #endif - if (!d->guard.id()) + if (!d->guard || !d->guard->id()) return 0; if (!glMapBufferARB) return 0; @@ -566,7 +561,7 @@ bool QGLBuffer::unmap() if (!isCreated()) qWarning("QGLBuffer::unmap(): buffer not created"); #endif - if (!d->guard.id()) + if (!d->guard || !d->guard->id()) return false; if (!glUnmapBufferARB) return false; diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp index 98d2960e1b8..0734f713c6b 100644 --- a/src/opengl/qglextensions.cpp +++ b/src/opengl/qglextensions.cpp @@ -222,17 +222,6 @@ bool qt_resolve_buffer_extensions(QGLContext *ctx) #endif } -#ifndef QT_NO_EGL -bool qt_resolve_eglimage_gl_extensions(QGLContext *ctx) -{ - if (glEGLImageTargetTexture2DOES || glEGLImageTargetRenderbufferStorageOES) - return true; - glEGLImageTargetTexture2DOES = (_glEGLImageTargetTexture2DOES) ctx->getProcAddress(QLatin1String("glEGLImageTargetTexture2DOES")); - glEGLImageTargetRenderbufferStorageOES = (_glEGLImageTargetRenderbufferStorageOES) ctx->getProcAddress(QLatin1String("glEGLImageTargetRenderbufferStorageOES")); - return glEGLImageTargetTexture2DOES && glEGLImageTargetRenderbufferStorageOES; -} -#endif - bool qt_resolve_glsl_extensions(QGLContext *ctx) { diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h index 98433c366dc..991fbba8c70 100644 --- a/src/opengl/qglextensions_p.h +++ b/src/opengl/qglextensions_p.h @@ -68,11 +68,6 @@ # define APIENTRYP * #endif -#ifndef QT_NO_EGL -// Needed for EGLImageKHR definition: -#include -#endif - #include #ifndef GL_ARB_vertex_buffer_object @@ -214,15 +209,6 @@ typedef void (APIENTRY *_glFramebufferTextureFaceEXT)(GLenum target, GLenum atta // ARB_texture_compression typedef void (APIENTRY *_glCompressedTexImage2DARB) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); - -#ifndef QT_NO_EGL -// OES_EGL_image -// Note: We define these to take EGLImage whereas spec says they take a new GLeglImageOES -// type, which the EGL image should be cast to. -typedef void (APIENTRY *_glEGLImageTargetTexture2DOES) (GLenum, EGLImageKHR); -typedef void (APIENTRY *_glEGLImageTargetRenderbufferStorageOES) (GLenum, EGLImageKHR); -#endif - QT_BEGIN_NAMESPACE struct QGLExtensionFuncs @@ -340,12 +326,6 @@ struct QGLExtensionFuncs // Texture compression qt_glCompressedTexImage2DARB = 0; #endif - -#ifndef QT_NO_EGL - // OES_EGL_image - qt_glEGLImageTargetTexture2DOES = 0; - qt_glEGLImageTargetRenderbufferStorageOES = 0; -#endif } @@ -466,12 +446,6 @@ struct QGLExtensionFuncs // Texture compression _glCompressedTexImage2DARB qt_glCompressedTexImage2DARB; #endif - -#ifndef QT_NO_EGL - // OES_EGL_image - _glEGLImageTargetTexture2DOES qt_glEGLImageTargetTexture2DOES; - _glEGLImageTargetRenderbufferStorageOES qt_glEGLImageTargetRenderbufferStorageOES; -#endif }; @@ -880,26 +854,16 @@ struct QGLExtensionFuncs #define glCompressedTexImage2D QGLContextPrivate::extensionFuncs(ctx).qt_glCompressedTexImage2DARB #endif -#ifndef QT_NO_EGL -// OES_EGL_image -#define glEGLImageTargetTexture2DOES QGLContextPrivate::extensionFuncs(ctx).qt_glEGLImageTargetTexture2DOES -#define glEGLImageTargetRenderbufferStorageOES QGLContextPrivate::extensionFuncs(ctx).qt_glEGLImageTargetRenderbufferStorageOES -#endif - extern bool qt_resolve_framebufferobject_extensions(QGLContext *ctx); -bool Q_OPENGL_EXPORT qt_resolve_buffer_extensions(QGLContext *ctx); +bool qt_resolve_buffer_extensions(QGLContext *ctx); bool qt_resolve_version_1_3_functions(QGLContext *ctx); -bool Q_OPENGL_EXPORT qt_resolve_version_2_0_functions(QGLContext *ctx); +bool qt_resolve_version_2_0_functions(QGLContext *ctx); bool qt_resolve_stencil_face_extension(QGLContext *ctx); bool qt_resolve_frag_program_extensions(QGLContext *ctx); bool qt_resolve_glsl_extensions(QGLContext *ctx); -#ifndef QT_NO_EGL -Q_OPENGL_EXPORT bool qt_resolve_eglimage_gl_extensions(QGLContext *ctx); -#endif - QT_END_NAMESPACE #endif // QGL_EXTENSIONS_P_H diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 682c26255d1..5e140ab9daa 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -45,24 +45,17 @@ #include #include #include -#if !defined(QT_OPENGL_ES_1) -#include -#endif +#include "gl2paintengineex/qpaintengineex_opengl2_p.h" -#ifndef QT_OPENGL_ES_2 -#include -#endif - -#include #include #include QT_BEGIN_NAMESPACE -extern Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer(const QSize&, bool, bool); +extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); -#define QGL_FUNC_CONTEXT const QGLContext *ctx = d_ptr->fbo_guard.context(); -#define QGL_FUNCP_CONTEXT const QGLContext *ctx = fbo_guard.context(); +#define QGL_FUNC_CONTEXT const QGLContext *ctx = QGLContext::currentContext(); +#define QGL_FUNCP_CONTEXT const QGLContext *ctx = QGLContext::currentContext(); #ifndef QT_NO_DEBUG #define QT_RESET_GLERROR() \ @@ -306,22 +299,6 @@ GLenum QGLFramebufferObjectFormat::internalTextureFormat() const return d->internal_format; } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLFramebufferObjectFormat::setTextureTarget(QMacCompatGLenum target) -{ - detach(); - d->target = target; -} - -/*! \internal */ -void QGLFramebufferObjectFormat::setInternalTextureFormat(QMacCompatGLenum internalTextureFormat) -{ - detach(); - d->internal_format = internalTextureFormat; -} -#endif - /*! Returns true if all the options of this framebuffer object format are the same as \a other; otherwise returns false. @@ -373,13 +350,7 @@ void QGLFBOGLPaintDevice::setFBO(QGLFramebufferObject* f, QGLContext *QGLFBOGLPaintDevice::context() const { - QGLContext *fboContext = const_cast(fbo->d_ptr->fbo_guard.context()); - QGLContext *currentContext = const_cast(QGLContext::currentContext()); - - if (QGLContextPrivate::contextGroup(fboContext) == QGLContextPrivate::contextGroup(currentContext)) - return currentContext; - else - return fboContext; + return const_cast(QGLContext::currentContext()); } bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const @@ -429,13 +400,33 @@ bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const return false; } +namespace +{ + void freeFramebufferFunc(QGLContext *ctx, GLuint id) + { + Q_UNUSED(ctx); + glDeleteFramebuffers(1, &id); + } + + void freeRenderbufferFunc(QGLContext *ctx, GLuint id) + { + Q_UNUSED(ctx); + glDeleteRenderbuffers(1, &id); + } + + void freeTextureFunc(QGLContext *ctx, GLuint id) + { + Q_UNUSED(ctx); + glDeleteTextures(1, &id); + } +} + void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, QGLFramebufferObject::Attachment attachment, GLenum texture_target, GLenum internal_format, GLint samples, bool mipmap) { QGLContext *ctx = const_cast(QGLContext::currentContext()); - fbo_guard.setContext(ctx); bool ext_detected = (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject); if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx))) @@ -449,9 +440,11 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, GLuint fbo = 0; glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbo); - fbo_guard.setId(fbo); - glDevice.setFBO(q, attachment); + GLuint texture = 0; + GLuint color_buffer = 0; + GLuint depth_buffer = 0; + GLuint stencil_buffer = 0; QT_CHECK_GLERROR(); // init texture @@ -625,7 +618,21 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, } glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); - if (!valid) { + if (valid) { + fbo_guard = createSharedResourceGuard(ctx, fbo, freeFramebufferFunc); + if (color_buffer) + color_buffer_guard = createSharedResourceGuard(ctx, color_buffer, freeRenderbufferFunc); + else + texture_guard = createSharedResourceGuard(ctx, texture, freeTextureFunc); + if (depth_buffer) + depth_buffer_guard = createSharedResourceGuard(ctx, depth_buffer, freeRenderbufferFunc); + if (stencil_buffer) { + if (stencil_buffer == depth_buffer) + stencil_buffer_guard = depth_buffer_guard; + else + stencil_buffer_guard = createSharedResourceGuard(ctx, stencil_buffer, freeRenderbufferFunc); + } + } else { if (color_buffer) glDeleteRenderbuffers(1, &color_buffer); else @@ -635,7 +642,6 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, if (stencil_buffer && depth_buffer != stencil_buffer) glDeleteRenderbuffers(1, &stencil_buffer); glDeleteFramebuffers(1, &fbo); - fbo_guard.setId(0); } QT_CHECK_GLERROR(); @@ -644,6 +650,8 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, format.setAttachment(fbo_attachment); format.setInternalTextureFormat(internal_format); format.setMipmap(mipmap); + + glDevice.setFBO(q, attachment); } /*! @@ -720,8 +728,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, As of Qt 4.8, it's possible to draw into a QGLFramebufferObject using a QPainter in a separate thread. Note that OpenGL 2.0 or - OpenGL ES 2.0 is required for this to work. Also, under X11, it's - necessary to set the Qt::AA_X11InitThreads application attribute. + OpenGL ES 2.0 is required for this to work. \sa {Framebuffer Object Example} */ @@ -780,16 +787,6 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, GLenum target) d->init(this, size, NoAttachment, target, DEFAULT_FORMAT); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -QGLFramebufferObject::QGLFramebufferObject(const QSize &size, QMacCompatGLenum target) - : d_ptr(new QGLFramebufferObjectPrivate) -{ - Q_D(QGLFramebufferObject); - d->init(this, size, NoAttachment, target, DEFAULT_FORMAT); -} -#endif - /*! \overload Constructs an OpenGL framebuffer object and binds a 2D GL texture @@ -832,16 +829,6 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, const QGLFrame format.internalTextureFormat(), format.samples(), format.mipmap()); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -QGLFramebufferObject::QGLFramebufferObject(int width, int height, QMacCompatGLenum target) - : d_ptr(new QGLFramebufferObjectPrivate) -{ - Q_D(QGLFramebufferObject); - d->init(this, QSize(width, height), NoAttachment, target, DEFAULT_FORMAT); -} -#endif - /*! \overload Constructs an OpenGL framebuffer object and binds a texture to the @@ -863,17 +850,6 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, Attachment att d->init(this, QSize(width, height), attachment, target, internal_format); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -QGLFramebufferObject::QGLFramebufferObject(int width, int height, Attachment attachment, - QMacCompatGLenum target, QMacCompatGLenum internal_format) - : d_ptr(new QGLFramebufferObjectPrivate) -{ - Q_D(QGLFramebufferObject); - d->init(this, QSize(width, height), attachment, target, internal_format); -} -#endif - /*! \overload Constructs an OpenGL framebuffer object and binds a texture to the @@ -895,17 +871,6 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, Attachment attachm d->init(this, size, attachment, target, internal_format); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -QGLFramebufferObject::QGLFramebufferObject(const QSize &size, Attachment attachment, - QMacCompatGLenum target, QMacCompatGLenum internal_format) - : d_ptr(new QGLFramebufferObjectPrivate) -{ - Q_D(QGLFramebufferObject); - d->init(this, size, attachment, target, internal_format); -} -#endif - /*! \fn QGLFramebufferObject::~QGLFramebufferObject() @@ -914,23 +879,19 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, Attachment attachm QGLFramebufferObject::~QGLFramebufferObject() { Q_D(QGLFramebufferObject); - QGL_FUNC_CONTEXT; delete d->engine; - if (isValid() && ctx) { - QGLShareContextScope scope(ctx); - if (d->texture) - glDeleteTextures(1, &d->texture); - if (d->color_buffer) - glDeleteRenderbuffers(1, &d->color_buffer); - if (d->depth_buffer) - glDeleteRenderbuffers(1, &d->depth_buffer); - if (d->stencil_buffer && d->stencil_buffer != d->depth_buffer) - glDeleteRenderbuffers(1, &d->stencil_buffer); - GLuint fbo = d->fbo(); - glDeleteFramebuffers(1, &fbo); - } + if (d->texture_guard) + d->texture_guard->free(); + if (d->color_buffer_guard) + d->color_buffer_guard->free(); + if (d->depth_buffer_guard) + d->depth_buffer_guard->free(); + if (d->stencil_buffer_guard && d->stencil_buffer_guard != d->depth_buffer_guard) + d->stencil_buffer_guard->free(); + if (d->fbo_guard) + d->fbo_guard->free(); } /*! @@ -954,7 +915,7 @@ QGLFramebufferObject::~QGLFramebufferObject() bool QGLFramebufferObject::isValid() const { Q_D(const QGLFramebufferObject); - return d->valid && d->fbo_guard.context(); + return d->valid && d->fbo_guard && d->fbo_guard->id(); } /*! @@ -1037,7 +998,7 @@ bool QGLFramebufferObject::release() GLuint QGLFramebufferObject::texture() const { Q_D(const QGLFramebufferObject); - return d->texture; + return d->texture_guard ? d->texture_guard->id() : 0; } /*! @@ -1092,13 +1053,7 @@ QImage QGLFramebufferObject::toImage() const return image; } -#if !defined(QT_OPENGL_ES_1) Q_GLOBAL_STATIC(QGLEngineThreadStorage, qt_buffer_2_engine) -#endif - -#ifndef QT_OPENGL_ES_2 -Q_GLOBAL_STATIC(QGLEngineThreadStorage, qt_buffer_engine) -#endif /*! \reimp */ QPaintEngine *QGLFramebufferObject::paintEngine() const @@ -1107,29 +1062,12 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const if (d->engine) return d->engine; -#if !defined(QT_OPENGL_ES_1) -#if !defined (QT_OPENGL_ES_2) - if (qt_gl_preferGL2Engine()) { -#endif - QPaintEngine *engine = qt_buffer_2_engine()->engine(); - if (engine->isActive() && engine->paintDevice() != this) { - d->engine = new QGL2PaintEngineEx; - return d->engine; - } - return engine; -#if !defined (QT_OPENGL_ES_2) - } -#endif -#endif - -#if !defined(QT_OPENGL_ES_2) - QPaintEngine *engine = qt_buffer_engine()->engine(); + QPaintEngine *engine = qt_buffer_2_engine()->engine(); if (engine->isActive() && engine->paintDevice() != this) { - d->engine = new QOpenGLPaintEngine; + d->engine = new QGL2PaintEngineEx; return d->engine; } return engine; -#endif } /*! @@ -1189,14 +1127,6 @@ void QGLFramebufferObject::drawTexture(const QRectF &target, GLuint textureId, G const_cast(QGLContext::currentContext())->drawTexture(target, textureId, textureTarget); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLFramebufferObject::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) -{ - const_cast(QGLContext::currentContext())->drawTexture(target, textureId, textureTarget); -} -#endif - /*! \since 4.4 @@ -1212,14 +1142,6 @@ void QGLFramebufferObject::drawTexture(const QPointF &point, GLuint textureId, G const_cast(QGLContext::currentContext())->drawTexture(point, textureId, textureTarget); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLFramebufferObject::drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) -{ - const_cast(QGLContext::currentContext())->drawTexture(point, textureId, textureTarget); -} -#endif - /*! \reimp */ int QGLFramebufferObject::metric(PaintDeviceMetric metric) const { @@ -1370,10 +1292,12 @@ void QGLFramebufferObject::blitFramebuffer(QGLFramebufferObject *target, const Q return; const QGLContext *ctx = QGLContext::currentContext(); - if (!ctx) + if (!ctx || !ctx->contextHandle()) return; - const int height = ctx->device()->height(); + QSurface *surface = ctx->contextHandle()->surface(); + + const int height = static_cast(surface)->height(); const int sh = source ? source->height() : height; const int th = target ? target->height() : height; diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h index d5e5c482fba..817aecd9b74 100644 --- a/src/opengl/qglframebufferobject.h +++ b/src/opengl/qglframebufferobject.h @@ -81,16 +81,6 @@ public: QGLFramebufferObject(const QSize &size, const QGLFramebufferObjectFormat &format); QGLFramebufferObject(int width, int height, const QGLFramebufferObjectFormat &format); -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS - QGLFramebufferObject(const QSize &size, QMacCompatGLenum target = GL_TEXTURE_2D); - QGLFramebufferObject(int width, int height, QMacCompatGLenum target = GL_TEXTURE_2D); - - QGLFramebufferObject(const QSize &size, Attachment attachment, - QMacCompatGLenum target = GL_TEXTURE_2D, QMacCompatGLenum internal_format = GL_RGBA8); - QGLFramebufferObject(int width, int height, Attachment attachment, - QMacCompatGLenum target = GL_TEXTURE_2D, QMacCompatGLenum internal_format = GL_RGBA8); -#endif - virtual ~QGLFramebufferObject(); QGLFramebufferObjectFormat format() const; @@ -114,10 +104,6 @@ public: void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS - void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); - void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); -#endif static bool hasOpenGLFramebufferBlit(); static void blitFramebuffer(QGLFramebufferObject *target, const QRect &targetRect, @@ -160,11 +146,6 @@ public: void setInternalTextureFormat(GLenum internalTextureFormat); GLenum internalTextureFormat() const; -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS - void setTextureTarget(QMacCompatGLenum target); - void setInternalTextureFormat(QMacCompatGLenum internalTextureFormat); -#endif - bool operator==(const QGLFramebufferObjectFormat& other) const; bool operator!=(const QGLFramebufferObjectFormat& other) const; diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index f82361279dc..61d39c6a07e 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -130,8 +130,9 @@ private: class QGLFramebufferObjectPrivate { public: - QGLFramebufferObjectPrivate() : fbo_guard(0), texture(0), depth_buffer(0), stencil_buffer(0) - , color_buffer(0), valid(false), engine(0) {} + QGLFramebufferObjectPrivate() : fbo_guard(0), texture_guard(0), depth_buffer_guard(0) + , stencil_buffer_guard(0), color_buffer_guard(0) + , valid(false), engine(0) {} ~QGLFramebufferObjectPrivate() {} void init(QGLFramebufferObject *q, const QSize& sz, @@ -139,11 +140,11 @@ public: GLenum internal_format, GLenum texture_target, GLint samples = 0, bool mipmap = false); bool checkFramebufferStatus() const; - QGLSharedResourceGuard fbo_guard; - GLuint texture; - GLuint depth_buffer; - GLuint stencil_buffer; - GLuint color_buffer; + QGLSharedResourceGuardBase *fbo_guard; + QGLSharedResourceGuardBase *texture_guard; + QGLSharedResourceGuardBase *depth_buffer_guard; + QGLSharedResourceGuardBase *stencil_buffer_guard; + QGLSharedResourceGuardBase *color_buffer_guard; GLenum target; QSize size; QGLFramebufferObjectFormat format; @@ -152,7 +153,7 @@ public: mutable QPaintEngine *engine; QGLFBOGLPaintDevice glDevice; - inline GLuint fbo() const { return fbo_guard.id(); } + inline GLuint fbo() const { return fbo_guard ? fbo_guard->id() : 0; } }; diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp index 02e7091c9ea..227e6cc176d 100644 --- a/src/opengl/qglfunctions.cpp +++ b/src/opengl/qglfunctions.cpp @@ -41,6 +41,7 @@ #include "qglfunctions.h" #include "qgl_p.h" +#include "QtGui/private/qopenglcontext_p.h" QT_BEGIN_NAMESPACE @@ -139,25 +140,28 @@ QT_BEGIN_NAMESPACE */ // Hidden private fields for additional extension data. -struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate +struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate, public QOpenGLSharedResource { - QGLFunctionsPrivateEx(const QGLContext *context = 0) - : QGLFunctionsPrivate(context) + QGLFunctionsPrivateEx(QOpenGLContext *context) + : QGLFunctionsPrivate(QGLContext::fromOpenGLContext(context)) + , QOpenGLSharedResource(context->shareGroup()) , m_features(-1) {} + void invalidateResource() + { + m_features = -1; + } + + void freeResource(QOpenGLContext *) + { + // no gl resources to free + } + int m_features; }; -#if QT_VERSION >= 0x040800 -Q_GLOBAL_STATIC(QGLContextGroupResource, qt_gl_functions_resource) -#else -static void qt_gl_functions_free(void *data) -{ - delete reinterpret_cast(data); -} +Q_GLOBAL_STATIC(QOpenGLMultiGroupSharedResource, qt_gl_functions_resource) -Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_gl_functions_resource, (qt_gl_functions_free)) -#endif static QGLFunctionsPrivateEx *qt_gl_functions(const QGLContext *context = 0) { if (!context) @@ -165,13 +169,7 @@ static QGLFunctionsPrivateEx *qt_gl_functions(const QGLContext *context = 0) Q_ASSERT(context); QGLFunctionsPrivateEx *funcs = reinterpret_cast - (qt_gl_functions_resource()->value(context)); -#if QT_VERSION < 0x040800 - if (!funcs) { - funcs = new QGLFunctionsPrivateEx(); - qt_gl_functions_resource()->insert(context, funcs); - } -#endif + (qt_gl_functions_resource()->value(context->contextHandle())); return funcs; } diff --git a/src/opengl/qglfunctions.h b/src/opengl/qglfunctions.h index 2bb6119b29d..e789d4020df 100644 --- a/src/opengl/qglfunctions.h +++ b/src/opengl/qglfunctions.h @@ -419,7 +419,7 @@ struct QGLFunctionsPrivate inline void QGLFunctions::glActiveTexture(GLenum texture) { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) ::glActiveTexture(texture); #else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); @@ -449,7 +449,7 @@ inline void QGLFunctions::glBindAttribLocation(GLuint program, GLuint index, con inline void QGLFunctions::glBindBuffer(GLenum target, GLuint buffer) { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) ::glBindBuffer(target, buffer); #else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); @@ -519,7 +519,7 @@ inline void QGLFunctions::glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLen inline void QGLFunctions::glBufferData(GLenum target, qgl_GLsizeiptr size, const void* data, GLenum usage) { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) ::glBufferData(target, size, data, usage); #else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); @@ -529,7 +529,7 @@ inline void QGLFunctions::glBufferData(GLenum target, qgl_GLsizeiptr size, const inline void QGLFunctions::glBufferSubData(GLenum target, qgl_GLintptr offset, qgl_GLsizeiptr size, const void* data) { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) ::glBufferSubData(target, offset, size, data); #else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); @@ -568,7 +568,7 @@ inline void QGLFunctions::glCompileShader(GLuint shader) inline void QGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) ::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); #else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); @@ -578,7 +578,7 @@ inline void QGLFunctions::glCompressedTexImage2D(GLenum target, GLint level, GLe inline void QGLFunctions::glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) ::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); #else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); @@ -608,7 +608,7 @@ inline GLuint QGLFunctions::glCreateShader(GLenum type) inline void QGLFunctions::glDeleteBuffers(GLsizei n, const GLuint* buffers) { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) ::glDeleteBuffers(n, buffers); #else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); @@ -717,7 +717,7 @@ inline void QGLFunctions::glFramebufferTexture2D(GLenum target, GLenum attachmen inline void QGLFunctions::glGenBuffers(GLsizei n, GLuint* buffers) { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) ::glGenBuffers(n, buffers); #else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); @@ -947,7 +947,7 @@ inline void QGLFunctions::glGetVertexAttribPointerv(GLuint index, GLenum pname, inline GLboolean QGLFunctions::glIsBuffer(GLuint buffer) { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) return ::glIsBuffer(buffer); #else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); @@ -1027,7 +1027,7 @@ inline void QGLFunctions::glRenderbufferStorage(GLenum target, GLenum internalfo inline void QGLFunctions::glSampleCoverage(GLclampf value, GLboolean invert) { -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) ::glSampleCoverage(value, invert); #else Q_ASSERT(QGLFunctions::isInitialized(d_ptr)); diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index b4e12d8b7e5..08807bdd49d 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -43,14 +43,6 @@ #include #include #include -#ifdef Q_WS_X11 -#include -#endif - -#if !defined(QT_OPENGL_ES_1) -#include -#include -#endif QT_BEGIN_NAMESPACE @@ -220,19 +212,7 @@ QGLPaintDevice* QGLPaintDevice::getDevice(QPaintDevice* pd) glpd = &(static_cast(pd)->d_func()->glDevice); break; case QInternal::Pixmap: { -#if !defined(QT_OPENGL_ES_1) - QPixmapData* pmd = static_cast(pd)->pixmapData(); - if (pmd->classId() == QPixmapData::OpenGLClass) - glpd = static_cast(pmd)->glDevice(); -#ifdef Q_WS_X11 - else if (pmd->classId() == QPixmapData::X11Class) - glpd = static_cast(pmd); -#endif - else - qWarning("Pixmap type not supported for GL rendering"); -#else - qWarning("Pixmap render targets not supported on OpenGL ES 1.x"); -#endif + qWarning("Pixmap type not supported for GL rendering"); break; } default: diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h index c5390645e28..32ae85dc904 100644 --- a/src/opengl/qglpaintdevice_p.h +++ b/src/opengl/qglpaintdevice_p.h @@ -55,7 +55,7 @@ #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index 45e7cdd8750..ddabbef0b23 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -81,8 +81,7 @@ As of Qt 4.8, it's possible to render into a QGLPixelBuffer using a QPainter in a separate thread. Note that OpenGL 2.0 or OpenGL ES - 2.0 is required for this to work. Also, under X11, it's necessary - to set the Qt::AA_X11InitThreads application attribute. + 2.0 is required for this to work. Pbuffers are provided by the OpenGL \c pbuffer extension; call hasOpenGLPbuffer() to find out if the system provides pbuffers. @@ -92,28 +91,16 @@ #include -#if !defined(QT_OPENGL_ES_1) -#include -#endif +#include "gl2paintengineex/qpaintengineex_opengl2_p.h" #include #include #include #include -#ifndef QT_OPENGL_ES_2 -#include -#endif - QT_BEGIN_NAMESPACE -#if !defined(QT_OPENGL_ES_2) -extern void qgl_cleanup_glyph_cache(QGLContext *); -#else -void qgl_cleanup_glyph_cache(QGLContext *) {} -#endif - -extern Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer(const QSize&, bool, bool); +extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); QGLContext* QGLPBufferGLPaintDevice::context() const @@ -149,20 +136,6 @@ void QGLPixelBufferPrivate::common_init(const QSize &size, const QGLFormat &form glDevice.setPBuffer(q); qctx->d_func()->paintDevice = q; qctx->d_func()->valid = true; -#if defined(Q_WS_WIN) && !defined(QT_OPENGL_ES) - qctx->d_func()->dc = dc; - qctx->d_func()->rc = ctx; -#elif (defined(Q_WS_X11) && defined(QT_NO_EGL)) - qctx->d_func()->cx = ctx; - qctx->d_func()->pbuf = (void *) pbuf; - qctx->d_func()->vi = 0; -#elif defined(Q_WS_MAC) - qctx->d_func()->cx = ctx; - qctx->d_func()->vi = 0; -#elif !defined(QT_NO_EGL) - qctx->d_func()->eglContext = ctx; - qctx->d_func()->eglSurface = pbuf; -#endif } } @@ -221,7 +194,6 @@ QGLPixelBuffer::~QGLPixelBuffer() QGLContext *current = const_cast(QGLContext::currentContext()); if (current != d->qctx) makeCurrent(); - qgl_cleanup_glyph_cache(d->qctx); d->cleanup(); delete d->qctx; if (current && current != d->qctx) @@ -261,6 +233,8 @@ bool QGLPixelBuffer::doneCurrent() } /*! + \fn GLuint QGLPixelBuffer::generateDynamicTexture() const + Generates and binds a 2D GL texture that is the same size as the pbuffer, and returns the texture's ID. This can be used in conjunction with bindToDynamicTexture() and @@ -269,20 +243,6 @@ bool QGLPixelBuffer::doneCurrent() \sa size() */ -#if (defined(Q_WS_X11) || defined(Q_WS_WIN)) && defined(QT_NO_EGL) -GLuint QGLPixelBuffer::generateDynamicTexture() const -{ - Q_D(const QGLPixelBuffer); - GLuint texture; - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, d->req_size.width(), d->req_size.height(), 0, GL_RGBA, GL_FLOAT, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - return texture; -} -#endif - /*! \fn bool QGLPixelBuffer::bindToDynamicTexture(GLuint texture_id) Binds the texture specified by \a texture_id to this pbuffer. @@ -353,13 +313,6 @@ void QGLPixelBuffer::updateDynamicTexture(GLuint texture_id) const #endif } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -void QGLPixelBuffer::updateDynamicTexture(QMacCompatGLuint texture_id) const -{ - updateDynamicTexture(GLuint(texture_id)); -} -#endif - /*! Returns the size of the pbuffer. */ @@ -402,27 +355,12 @@ bool QGLPixelBuffer::isValid() const return !d->invalid; } -#if !defined(QT_OPENGL_ES_1) Q_GLOBAL_STATIC(QGLEngineThreadStorage, qt_buffer_2_engine) -#endif - -#ifndef QT_OPENGL_ES_2 -Q_GLOBAL_STATIC(QGLEngineThreadStorage, qt_buffer_engine) -#endif /*! \reimp */ QPaintEngine *QGLPixelBuffer::paintEngine() const { -#if defined(QT_OPENGL_ES_1) - return qt_buffer_engine()->engine(); -#elif defined(QT_OPENGL_ES_2) return qt_buffer_2_engine()->engine(); -#else - if (qt_gl_preferGL2Engine()) - return qt_buffer_2_engine()->engine(); - else - return qt_buffer_engine()->engine(); -#endif } /*! \reimp */ @@ -493,15 +431,6 @@ GLuint QGLPixelBuffer::bindTexture(const QImage &image, GLenum target) #endif } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -GLuint QGLPixelBuffer::bindTexture(const QImage &image, QMacCompatGLenum target) -{ - Q_D(QGLPixelBuffer); - return d->qctx->bindTexture(image, target, QMacCompatGLint(GL_RGBA8)); -} -#endif - /*! \overload Generates and binds a 2D GL texture based on \a pixmap. @@ -520,15 +449,6 @@ GLuint QGLPixelBuffer::bindTexture(const QPixmap &pixmap, GLenum target) #endif } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -GLuint QGLPixelBuffer::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target) -{ - Q_D(QGLPixelBuffer); - return d->qctx->bindTexture(pixmap, target, QMacCompatGLint(GL_RGBA8)); -} -#endif - /*! \overload Reads the DirectDrawSurface (DDS) compressed file \a fileName and @@ -555,15 +475,6 @@ void QGLPixelBuffer::deleteTexture(GLuint texture_id) d->qctx->deleteTexture(texture_id); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLPixelBuffer::deleteTexture(QMacCompatGLuint texture_id) -{ - Q_D(QGLPixelBuffer); - d->qctx->deleteTexture(texture_id); -} -#endif - /*! \since 4.4 @@ -579,15 +490,6 @@ void QGLPixelBuffer::drawTexture(const QRectF &target, GLuint textureId, GLenum d->qctx->drawTexture(target, textureId, textureTarget); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLPixelBuffer::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) -{ - Q_D(QGLPixelBuffer); - d->qctx->drawTexture(target, textureId, textureTarget); -} -#endif - /*! \since 4.4 @@ -602,15 +504,6 @@ void QGLPixelBuffer::drawTexture(const QPointF &point, GLuint textureId, GLenum d->qctx->drawTexture(point, textureId, textureTarget); } -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLPixelBuffer::drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget) -{ - Q_D(QGLPixelBuffer); - d->qctx->drawTexture(point, textureId, textureTarget); -} -#endif - /*! Returns the format of the pbuffer. The format may be different from the one that was requested. diff --git a/src/opengl/qglpixelbuffer.h b/src/opengl/qglpixelbuffer.h index dcd1a6ca714..0c7ad38237c 100644 --- a/src/opengl/qglpixelbuffer.h +++ b/src/opengl/qglpixelbuffer.h @@ -80,18 +80,6 @@ public: void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D); -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS - bool bindToDynamicTexture(QMacCompatGLuint texture); - void updateDynamicTexture(QMacCompatGLuint texture_id) const; - GLuint bindTexture(const QImage &image, QMacCompatGLenum target = GL_TEXTURE_2D); - GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum target = GL_TEXTURE_2D); - - void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); - void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D); - - void deleteTexture(QMacCompatGLuint texture_id); -#endif - QSize size() const; Qt::HANDLE handle() const; QImage toImage() const; @@ -109,7 +97,6 @@ private: Q_DISABLE_COPY(QGLPixelBuffer) QScopedPointer d_ptr; friend class QGLDrawable; - friend class QGLWindowSurface; friend class QGLPaintDevice; friend class QGLPBufferGLPaintDevice; friend class QGLContextPrivate; diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp deleted file mode 100644 index 64d032799a1..00000000000 --- a/src/opengl/qglpixelbuffer_egl.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qglpixelbuffer.h" -#include "qglpixelbuffer_p.h" -#include "qgl_egl_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -#ifdef EGL_BIND_TO_TEXTURE_RGBA -#define QGL_RENDER_TEXTURE 1 -#else -#define QGL_RENDER_TEXTURE 0 -#endif - -bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget) -{ - // Create the EGL context. - ctx = new QEglContext(); - ctx->setApi(QEgl::OpenGL); - - // Find the shared context. - QEglContext *shareContext = 0; - if (shareWidget && shareWidget->d_func()->glcx) - shareContext = shareWidget->d_func()->glcx->d_func()->eglContext; - - // Choose an appropriate configuration. We use the best format - // we can find, even if it is greater than the requested format. - // We try for a pbuffer that is capable of texture rendering if possible. - textureFormat = EGL_NONE; - if (shareContext) { - // Use the same configuration as the widget we are sharing with. - ctx->setConfig(shareContext->config()); -#if QGL_RENDER_TEXTURE - if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGBA) == EGL_TRUE) - textureFormat = EGL_TEXTURE_RGBA; - else if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGB) == EGL_TRUE) - textureFormat = EGL_TEXTURE_RGB; -#endif - } else { - QEglProperties configProps; - qt_eglproperties_set_glformat(configProps, f); - configProps.setDeviceType(QInternal::Pbuffer); - configProps.setRenderableType(ctx->api()); - bool ok = false; -#if QGL_RENDER_TEXTURE - textureFormat = EGL_TEXTURE_RGBA; - configProps.setValue(EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE); - ok = ctx->chooseConfig(configProps, QEgl::BestPixelFormat); - if (!ok) { - // Try again with RGB texture rendering. - textureFormat = EGL_TEXTURE_RGB; - configProps.removeValue(EGL_BIND_TO_TEXTURE_RGBA); - configProps.setValue(EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE); - ok = ctx->chooseConfig(configProps, QEgl::BestPixelFormat); - if (!ok) { - // One last try for a pbuffer with no texture rendering. - configProps.removeValue(EGL_BIND_TO_TEXTURE_RGB); - textureFormat = EGL_NONE; - } - } -#endif - if (!ok) { - if (!ctx->chooseConfig(configProps, QEgl::BestPixelFormat)) { - delete ctx; - ctx = 0; - return false; - } - } - } - - // Retrieve the actual format properties. - qt_glformat_from_eglconfig(format, ctx->config()); - - // Create the attributes needed for the pbuffer. - QEglProperties attribs; - attribs.setValue(EGL_WIDTH, size.width()); - attribs.setValue(EGL_HEIGHT, size.height()); -#if QGL_RENDER_TEXTURE - if (textureFormat != EGL_NONE) { - attribs.setValue(EGL_TEXTURE_FORMAT, textureFormat); - attribs.setValue(EGL_TEXTURE_TARGET, EGL_TEXTURE_2D); - } -#endif - - // Create the pbuffer surface. - pbuf = eglCreatePbufferSurface(ctx->display(), ctx->config(), attribs.properties()); -#if QGL_RENDER_TEXTURE - if (pbuf == EGL_NO_SURFACE && textureFormat != EGL_NONE) { - // Try again with texture rendering disabled. - textureFormat = EGL_NONE; - attribs.removeValue(EGL_TEXTURE_FORMAT); - attribs.removeValue(EGL_TEXTURE_TARGET); - pbuf = eglCreatePbufferSurface(ctx->display(), ctx->config(), attribs.properties()); - } -#endif - if (pbuf == EGL_NO_SURFACE) { - qWarning() << "QGLPixelBufferPrivate::init(): Unable to create EGL pbuffer surface:" << QEgl::errorString(); - return false; - } - - // Create a new context for the configuration. - if (!ctx->createContext(shareContext)) { - delete ctx; - ctx = 0; - return false; - } - - return true; -} - -bool QGLPixelBufferPrivate::cleanup() -{ - // No need to destroy "pbuf" here - it is done in QGLContext::reset(). - return true; -} - -bool QGLPixelBuffer::bindToDynamicTexture(GLuint texture_id) -{ -#if QGL_RENDER_TEXTURE - Q_D(QGLPixelBuffer); - if (d->invalid || d->textureFormat == EGL_NONE || !d->ctx) - return false; - glBindTexture(GL_TEXTURE_2D, texture_id); - return eglBindTexImage(d->ctx->display(), d->pbuf, EGL_BACK_BUFFER); -#else - Q_UNUSED(texture_id); - return false; -#endif -} - -void QGLPixelBuffer::releaseFromDynamicTexture() -{ -#if QGL_RENDER_TEXTURE - Q_D(QGLPixelBuffer); - if (d->invalid || d->textureFormat == EGL_NONE || !d->ctx) - return; - eglReleaseTexImage(d->ctx->display(), d->pbuf, EGL_BACK_BUFFER); -#endif -} - - -GLuint QGLPixelBuffer::generateDynamicTexture() const -{ -#if QGL_RENDER_TEXTURE - Q_D(const QGLPixelBuffer); - GLuint texture; - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - if (d->textureFormat == EGL_TEXTURE_RGB) - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, d->req_size.width(), d->req_size.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); - else - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, d->req_size.width(), d->req_size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - return texture; -#else - return 0; -#endif -} - -bool QGLPixelBuffer::hasOpenGLPbuffers() -{ - // See if we have at least 1 configuration that matches the default format. - EGLDisplay dpy = QEgl::display(); - if (dpy == EGL_NO_DISPLAY) - return false; - QEglProperties configProps; - qt_eglproperties_set_glformat(configProps, QGLFormat::defaultFormat()); - configProps.setDeviceType(QInternal::Pbuffer); - configProps.setRenderableType(QEgl::OpenGL); - do { - EGLConfig cfg = 0; - EGLint matching = 0; - if (eglChooseConfig(dpy, configProps.properties(), - &cfg, 1, &matching) && matching > 0) - return true; - } while (configProps.reduceConfiguration()); - return false; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglpixelbuffer_mac.mm b/src/opengl/qglpixelbuffer_mac.mm deleted file mode 100644 index b364209b955..00000000000 --- a/src/opengl/qglpixelbuffer_mac.mm +++ /dev/null @@ -1,331 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qglpixelbuffer.h" -#include "qglpixelbuffer_p.h" - -#ifndef QT_MAC_USE_COCOA -#include -#endif - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#ifndef GL_TEXTURE_RECTANGLE_EXT -#define GL_TEXTURE_RECTANGLE_EXT 0x84F5 -#endif - -static int nearest_gl_texture_size(int v) -{ - int n = 0, last = 0; - for (int s = 0; s < 32; ++s) { - if (((v>>s) & 1) == 1) { - ++n; - last = s; - } - } - if (n > 1) - return 1 << (last+1); - return 1 << last; -} - -bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget) -{ -#ifdef QT_MAC_USE_COCOA - Q_Q(QGLPixelBuffer); - // create a dummy context - QGLContext context(f, q); - context.create(shareWidget ? shareWidget->context() : 0); - - if (context.isSharing()) - share_ctx = shareWidget->context()->d_func()->cx; - - // steal the NSOpenGLContext and update the format - ctx = context.d_func()->cx; - context.d_func()->cx = 0; - // d->cx will be set to ctx later in - // QGLPixelBufferPrivate::common_init, so we need to retain it: - [static_cast(ctx) retain]; - - format = context.format(); - - GLenum target = GL_TEXTURE_2D; - - if ((QGLExtensions::glExtensions() & QGLExtensions::TextureRectangle) - && (size.width() != nearest_gl_texture_size(size.width()) - || size.height() != nearest_gl_texture_size(size.height()))) - { - target = GL_TEXTURE_RECTANGLE_EXT; - } - - pbuf = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:target - textureInternalFormat:GL_RGBA - textureMaxMipMapLevel:0 - pixelsWide:size.width() - pixelsHigh:size.height()]; - if (!pbuf) { - qWarning("QGLPixelBuffer: Cannot create a pbuffer"); - return false; - } - - [static_cast(ctx) setPixelBuffer:static_cast(pbuf) - cubeMapFace:0 - mipMapLevel:0 - currentVirtualScreen:0]; - return true; -#else - GLint attribs[40], i=0; - attribs[i++] = AGL_RGBA; - attribs[i++] = AGL_BUFFER_SIZE; - attribs[i++] = 32; - attribs[i++] = AGL_LEVEL; - attribs[i++] = f.plane(); - if (f.redBufferSize() != -1) { - attribs[i++] = AGL_RED_SIZE; - attribs[i++] = f.redBufferSize(); - } - if (f.greenBufferSize() != -1) { - attribs[i++] = AGL_GREEN_SIZE; - attribs[i++] = f.greenBufferSize(); - } - if (f.blueBufferSize() != -1) { - attribs[i++] = AGL_BLUE_SIZE; - attribs[i++] = f.blueBufferSize(); - } - if (f.stereo()) - attribs[i++] = AGL_STEREO; - if (f.alpha()) { - attribs[i++] = AGL_ALPHA_SIZE; - attribs[i++] = f.alphaBufferSize() == -1 ? 8 : f.alphaBufferSize(); - } - if (f.stencil()) { - attribs[i++] = AGL_STENCIL_SIZE; - attribs[i++] = f.stencilBufferSize() == -1 ? 8 : f.stencilBufferSize(); - } - if (f.depth()) { - attribs[i++] = AGL_DEPTH_SIZE; - attribs[i++] = f.depthBufferSize() == -1 ? 32 : f.depthBufferSize(); - } - if (f.accum()) { - attribs[i++] = AGL_ACCUM_RED_SIZE; - attribs[i++] = f.accumBufferSize() == -1 ? 16 : f.accumBufferSize(); - attribs[i++] = AGL_ACCUM_BLUE_SIZE; - attribs[i++] = f.accumBufferSize() == -1 ? 16 : f.accumBufferSize(); - attribs[i++] = AGL_ACCUM_GREEN_SIZE; - attribs[i++] = f.accumBufferSize() == -1 ? 16 : f.accumBufferSize(); - attribs[i++] = AGL_ACCUM_ALPHA_SIZE; - attribs[i++] = f.accumBufferSize() == -1 ? 16 : f.accumBufferSize(); - } - - if (f.sampleBuffers()) { - attribs[i++] = AGL_SAMPLE_BUFFERS_ARB; - attribs[i++] = 1; - attribs[i++] = AGL_SAMPLES_ARB; - attribs[i++] = f.samples() == -1 ? 4 : f.samples(); - } - attribs[i] = AGL_NONE; - - AGLPixelFormat format = aglChoosePixelFormat(0, 0, attribs); - if (!format) { - qWarning("QGLPixelBuffer: Unable to find a pixel format (AGL error %d).", - (int) aglGetError()); - return false; - } - - GLint res; - aglDescribePixelFormat(format, AGL_LEVEL, &res); - this->format.setPlane(res); - aglDescribePixelFormat(format, AGL_DOUBLEBUFFER, &res); - this->format.setDoubleBuffer(res); - aglDescribePixelFormat(format, AGL_DEPTH_SIZE, &res); - this->format.setDepth(res); - if (this->format.depth()) - this->format.setDepthBufferSize(res); - aglDescribePixelFormat(format, AGL_RGBA, &res); - this->format.setRgba(res); - aglDescribePixelFormat(format, AGL_RED_SIZE, &res); - this->format.setRedBufferSize(res); - aglDescribePixelFormat(format, AGL_GREEN_SIZE, &res); - this->format.setGreenBufferSize(res); - aglDescribePixelFormat(format, AGL_BLUE_SIZE, &res); - this->format.setBlueBufferSize(res); - aglDescribePixelFormat(format, AGL_ALPHA_SIZE, &res); - this->format.setAlpha(res); - if (this->format.alpha()) - this->format.setAlphaBufferSize(res); - aglDescribePixelFormat(format, AGL_ACCUM_RED_SIZE, &res); - this->format.setAccum(res); - if (this->format.accum()) - this->format.setAccumBufferSize(res); - aglDescribePixelFormat(format, AGL_STENCIL_SIZE, &res); - this->format.setStencil(res); - if (this->format.stencil()) - this->format.setStencilBufferSize(res); - aglDescribePixelFormat(format, AGL_STEREO, &res); - this->format.setStereo(res); - aglDescribePixelFormat(format, AGL_SAMPLE_BUFFERS_ARB, &res); - this->format.setSampleBuffers(res); - if (this->format.sampleBuffers()) { - aglDescribePixelFormat(format, AGL_SAMPLES_ARB, &res); - this->format.setSamples(res); - } - - AGLContext share = 0; - if (shareWidget) - share = share_ctx = static_cast(shareWidget->d_func()->glcx->d_func()->cx); - ctx = aglCreateContext(format, share); - if (!ctx) { - qWarning("QGLPixelBuffer: Unable to create a context (AGL error %d).", - (int) aglGetError()); - return false; - } - - GLenum target = GL_TEXTURE_2D; - - if ((QGLExtensions::glExtensions() & QGLExtensions::TextureRectangle) - && (size.width() != nearest_gl_texture_size(size.width()) - || size.height() != nearest_gl_texture_size(size.height()))) - { - target = GL_TEXTURE_RECTANGLE_EXT; - } - - if (!aglCreatePBuffer(size.width(), size.height(), target, GL_RGBA, 0, &pbuf)) { - qWarning("QGLPixelBuffer: Unable to create a pbuffer (AGL error %d).", - (int) aglGetError()); - return false; - } - - if (!aglSetPBuffer(ctx, pbuf, 0, 0, 0)) { - qWarning("QGLPixelBuffer: Unable to set pbuffer (AGL error %d).", - (int) aglGetError()); - return false; - } - - aglDestroyPixelFormat(format); - return true; - -#endif -} - -bool QGLPixelBufferPrivate::cleanup() -{ -#ifdef QT_MAC_USE_COCOA - [static_cast(pbuf) release]; - pbuf = 0; - [static_cast(ctx) release]; - ctx = 0; -#else - aglDestroyPBuffer(pbuf); -#endif - return true; -} - -bool QGLPixelBuffer::bindToDynamicTexture(GLuint texture_id) -{ - Q_D(QGLPixelBuffer); - if (d->invalid || !d->share_ctx) - return false; - -#ifdef QT_MAC_USE_COCOA - NSOpenGLContext *oldContext = [NSOpenGLContext currentContext]; - if (d->share_ctx != oldContext) - [static_cast(d->share_ctx) makeCurrentContext]; - glBindTexture(GL_TEXTURE_2D, texture_id); - [static_cast(d->share_ctx) - setTextureImageToPixelBuffer:static_cast(d->pbuf) - colorBuffer:GL_FRONT]; - if (oldContext && oldContext != d->share_ctx) - [oldContext makeCurrentContext]; - return true; -#else - aglSetCurrentContext(d->share_ctx); - glBindTexture(GL_TEXTURE_2D, texture_id); - aglTexImagePBuffer(d->share_ctx, d->pbuf, GL_FRONT); - return true; -#endif -} - -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -bool QGLPixelBuffer::bindToDynamicTexture(QMacCompatGLuint texture_id) -{ - return bindToDynamicTexture(GLuint(texture_id)); -} -#endif - -void QGLPixelBuffer::releaseFromDynamicTexture() -{ -} - -GLuint QGLPixelBuffer::generateDynamicTexture() const -{ -#ifdef QT_MAC_USE_COCOA - Q_D(const QGLPixelBuffer); - NSOpenGLContext *oldContext = [NSOpenGLContext currentContext]; - if (d->share_ctx != oldContext) - [static_cast(d->share_ctx) makeCurrentContext]; - GLuint texture; - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - - if (oldContext && oldContext != d->share_ctx) - [oldContext makeCurrentContext]; - return texture; -#else - GLuint texture; - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - return texture; -#endif -} - -bool QGLPixelBuffer::hasOpenGLPbuffers() -{ - return true; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h index eb761047e72..05e161b7eff 100644 --- a/src/opengl/qglpixelbuffer_p.h +++ b/src/opengl/qglpixelbuffer_p.h @@ -59,77 +59,6 @@ QT_BEGIN_INCLUDE_NAMESPACE #include "QtOpenGL/qglpixelbuffer.h" #include #include - -#if defined(Q_WS_X11) && defined(QT_NO_EGL) -#include - -// The below is needed to for compilation on HPUX, due to broken GLX -// headers. Some of the systems define GLX_VERSION_1_3 without -// defining the GLXFBConfig structure, which is wrong. -#if defined (Q_OS_HPUX) && defined(QT_DEFINE_GLXFBCONFIG_STRUCT) -typedef unsigned long GLXPbuffer; - -struct GLXFBConfig { - int visualType; - int transparentType; - /* colors are floats scaled to ints */ - int transparentRed, transparentGreen, transparentBlue, transparentAlpha; - int transparentIndex; - - int visualCaveat; - - int associatedVisualId; - int screen; - - int drawableType; - int renderType; - - int maxPbufferWidth, maxPbufferHeight, maxPbufferPixels; - int optimalPbufferWidth, optimalPbufferHeight; /* for SGIX_pbuffer */ - - int visualSelectGroup; /* visuals grouped by select priority */ - - unsigned int id; - - GLboolean rgbMode; - GLboolean colorIndexMode; - GLboolean doubleBufferMode; - GLboolean stereoMode; - GLboolean haveAccumBuffer; - GLboolean haveDepthBuffer; - GLboolean haveStencilBuffer; - - /* The number of bits present in various buffers */ - GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; - GLint depthBits; - GLint stencilBits; - GLint indexBits; - GLint redBits, greenBits, blueBits, alphaBits; - GLuint redMask, greenMask, blueMask, alphaMask; - - GLuint multiSampleSize; /* Number of samples per pixel (0 if no ms) */ - - GLuint nMultiSampleBuffers; /* Number of available ms buffers */ - GLint maxAuxBuffers; - - /* frame buffer level */ - GLint level; - - /* color ranges (for SGI_color_range) */ - GLboolean extendedRange; - GLdouble minRed, maxRed; - GLdouble minGreen, maxGreen; - GLdouble minBlue, maxBlue; - GLdouble minAlpha, maxAlpha; -}; - -#endif // Q_OS_HPUX - -#elif defined(Q_WS_WIN) -DECLARE_HANDLE(HPBUFFERARB); -#elif !defined(QT_NO_EGL) -#include -#endif QT_END_INCLUDE_NAMESPACE class QEglContext; @@ -152,11 +81,6 @@ class QGLPixelBufferPrivate { public: QGLPixelBufferPrivate(QGLPixelBuffer *q) : q_ptr(q), invalid(true), qctx(0), pbuf(0), ctx(0) { -#ifdef Q_WS_WIN - dc = 0; -#elif defined(Q_WS_MACX) - share_ctx = 0; -#endif } bool init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget); void common_init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget); @@ -172,36 +96,9 @@ public: QPointer req_shareWidget; QSize req_size; -#if defined(Q_WS_X11) && defined(QT_NO_EGL) - GLXPbuffer pbuf; - GLXContext ctx; -#elif defined(Q_WS_WIN) - HDC dc; - bool has_render_texture :1; -#if !defined(QT_OPENGL_ES) - HPBUFFERARB pbuf; - HGLRC ctx; -#endif -#elif defined(Q_WS_MACX) -# ifdef QT_MAC_USE_COCOA - void *pbuf; - void *ctx; - void *share_ctx; -# else - AGLPbuffer pbuf; - AGLContext ctx; - AGLContext share_ctx; -# endif -#endif -#ifndef QT_NO_EGL - EGLSurface pbuf; - QEglContext *ctx; - int textureFormat; -#elif defined(Q_WS_QPA) //stubs void *pbuf; void *ctx; -#endif }; QT_END_NAMESPACE diff --git a/src/opengl/qglpixelbuffer_win.cpp b/src/opengl/qglpixelbuffer_win.cpp deleted file mode 100644 index 80ce99219ee..00000000000 --- a/src/opengl/qglpixelbuffer_win.cpp +++ /dev/null @@ -1,403 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -/* WGL_WGLEXT_PROTOTYPES */ -typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); -typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); -typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); -typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); -typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); -typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); -typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); -typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); -typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); -typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); -typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int * piAttribList); - -#ifndef WGL_ARB_pbuffer -#define WGL_DRAW_TO_PBUFFER_ARB 0x202D -#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E -#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F -#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 -#define WGL_PBUFFER_LARGEST_ARB 0x2033 -#define WGL_PBUFFER_WIDTH_ARB 0x2034 -#define WGL_PBUFFER_HEIGHT_ARB 0x2035 -#define WGL_PBUFFER_LOST_ARB 0x2036 -#endif - -#ifndef WGL_ARB_pixel_format -#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 -#define WGL_DRAW_TO_WINDOW_ARB 0x2001 -#define WGL_DRAW_TO_BITMAP_ARB 0x2002 -#define WGL_ACCELERATION_ARB 0x2003 -#define WGL_NEED_PALETTE_ARB 0x2004 -#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 -#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 -#define WGL_SWAP_METHOD_ARB 0x2007 -#define WGL_NUMBER_OVERLAYS_ARB 0x2008 -#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 -#define WGL_TRANSPARENT_ARB 0x200A -#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 -#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 -#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 -#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A -#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B -#define WGL_SHARE_DEPTH_ARB 0x200C -#define WGL_SHARE_STENCIL_ARB 0x200D -#define WGL_SHARE_ACCUM_ARB 0x200E -#define WGL_SUPPORT_GDI_ARB 0x200F -#define WGL_SUPPORT_OPENGL_ARB 0x2010 -#define WGL_DOUBLE_BUFFER_ARB 0x2011 -#define WGL_STEREO_ARB 0x2012 -#define WGL_PIXEL_TYPE_ARB 0x2013 -#define WGL_COLOR_BITS_ARB 0x2014 -#define WGL_RED_BITS_ARB 0x2015 -#define WGL_RED_SHIFT_ARB 0x2016 -#define WGL_GREEN_BITS_ARB 0x2017 -#define WGL_GREEN_SHIFT_ARB 0x2018 -#define WGL_BLUE_BITS_ARB 0x2019 -#define WGL_BLUE_SHIFT_ARB 0x201A -#define WGL_ALPHA_BITS_ARB 0x201B -#define WGL_ALPHA_SHIFT_ARB 0x201C -#define WGL_ACCUM_BITS_ARB 0x201D -#define WGL_ACCUM_RED_BITS_ARB 0x201E -#define WGL_ACCUM_GREEN_BITS_ARB 0x201F -#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 -#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 -#define WGL_DEPTH_BITS_ARB 0x2022 -#define WGL_STENCIL_BITS_ARB 0x2023 -#define WGL_AUX_BUFFERS_ARB 0x2024 -#define WGL_NO_ACCELERATION_ARB 0x2025 -#define WGL_GENERIC_ACCELERATION_ARB 0x2026 -#define WGL_FULL_ACCELERATION_ARB 0x2027 -#define WGL_SWAP_EXCHANGE_ARB 0x2028 -#define WGL_SWAP_COPY_ARB 0x2029 -#define WGL_SWAP_UNDEFINED_ARB 0x202A -#define WGL_TYPE_RGBA_ARB 0x202B -#define WGL_TYPE_COLORINDEX_ARB 0x202C -#endif - -#ifndef WGL_ARB_render_texture -#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 -#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 -#define WGL_TEXTURE_FORMAT_ARB 0x2072 -#define WGL_TEXTURE_TARGET_ARB 0x2073 -#define WGL_MIPMAP_TEXTURE_ARB 0x2074 -#define WGL_TEXTURE_RGB_ARB 0x2075 -#define WGL_TEXTURE_RGBA_ARB 0x2076 -#define WGL_NO_TEXTURE_ARB 0x2077 -#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 -#define WGL_TEXTURE_1D_ARB 0x2079 -#define WGL_TEXTURE_2D_ARB 0x207A -#define WGL_MIPMAP_LEVEL_ARB 0x207B -#define WGL_CUBE_MAP_FACE_ARB 0x207C -#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D -#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E -#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F -#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 -#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 -#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 -#define WGL_FRONT_LEFT_ARB 0x2083 -#define WGL_FRONT_RIGHT_ARB 0x2084 -#define WGL_BACK_LEFT_ARB 0x2085 -#define WGL_BACK_RIGHT_ARB 0x2086 -#define WGL_AUX0_ARB 0x2087 -#define WGL_AUX1_ARB 0x2088 -#define WGL_AUX2_ARB 0x2089 -#define WGL_AUX3_ARB 0x208A -#define WGL_AUX4_ARB 0x208B -#define WGL_AUX5_ARB 0x208C -#define WGL_AUX6_ARB 0x208D -#define WGL_AUX7_ARB 0x208E -#define WGL_AUX8_ARB 0x208F -#define WGL_AUX9_ARB 0x2090 -#endif - -#ifndef WGL_FLOAT_COMPONENTS_NV -#define WGL_FLOAT_COMPONENTS_NV 0x20B0 -#endif - -#ifndef WGL_ARB_multisample -#define WGL_SAMPLE_BUFFERS_ARB 0x2041 -#define WGL_SAMPLES_ARB 0x2042 -#endif - -#ifndef GL_SAMPLES_ARB -#define GL_SAMPLES_ARB 0x80A9 -#endif - -QGLFormat pfiToQGLFormat(HDC hdc, int pfi); - -static void qt_format_to_attrib_list(bool has_render_texture, const QGLFormat &f, int attribs[]) -{ - int i = 0; - attribs[i++] = WGL_SUPPORT_OPENGL_ARB; - attribs[i++] = TRUE; - attribs[i++] = WGL_DRAW_TO_PBUFFER_ARB; - attribs[i++] = TRUE; - - if (has_render_texture) { - attribs[i++] = WGL_BIND_TO_TEXTURE_RGBA_ARB; - attribs[i++] = TRUE; - } - - attribs[i++] = WGL_COLOR_BITS_ARB; - attribs[i++] = 32; - attribs[i++] = WGL_DOUBLE_BUFFER_ARB; - attribs[i++] = FALSE; - - if (f.stereo()) { - attribs[i++] = WGL_STEREO_ARB; - attribs[i++] = TRUE; - } - if (f.depth()) { - attribs[i++] = WGL_DEPTH_BITS_ARB; - attribs[i++] = f.depthBufferSize() == -1 ? 24 : f.depthBufferSize(); - } - if (f.redBufferSize() != -1) { - attribs[i++] = WGL_RED_BITS_ARB; - attribs[i++] = f.redBufferSize(); - } - if (f.greenBufferSize() != -1) { - attribs[i++] = WGL_GREEN_BITS_ARB; - attribs[i++] = f.greenBufferSize(); - } - if (f.blueBufferSize() != -1) { - attribs[i++] = WGL_BLUE_BITS_ARB; - attribs[i++] = f.blueBufferSize(); - } - if (f.alpha()) { - attribs[i++] = WGL_ALPHA_BITS_ARB; - attribs[i++] = f.alphaBufferSize() == -1 ? 8 : f.alphaBufferSize(); - } - if (f.accum()) { - attribs[i++] = WGL_ACCUM_BITS_ARB; - attribs[i++] = f.accumBufferSize() == -1 ? 16 : f.accumBufferSize(); - } - if (f.stencil()) { - attribs[i++] = WGL_STENCIL_BITS_ARB; - attribs[i++] = f.stencilBufferSize() == -1 ? 8 : f.stencilBufferSize(); - } - if ((f.redBufferSize() > 8 || f.greenBufferSize() > 8 - || f.blueBufferSize() > 8 || f.alphaBufferSize() > 8) - && (QGLExtensions::glExtensions() & QGLExtensions::NVFloatBuffer)) - { - attribs[i++] = WGL_FLOAT_COMPONENTS_NV; - attribs[i++] = TRUE; - } - if (f.sampleBuffers()) { - attribs[i++] = WGL_SAMPLE_BUFFERS_ARB; - attribs[i++] = 1; - attribs[i++] = WGL_SAMPLES_ARB; - attribs[i++] = f.samples() == -1 ? 16 : f.samples(); - } - attribs[i] = 0; -} - -bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget) -{ - QGLTemporaryContext tempContext; - - PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB = - (PFNWGLCREATEPBUFFERARBPROC) wglGetProcAddress("wglCreatePbufferARB"); - PFNWGLGETPBUFFERDCARBPROC wglGetPbufferDCARB = - (PFNWGLGETPBUFFERDCARBPROC) wglGetProcAddress("wglGetPbufferDCARB"); - PFNWGLQUERYPBUFFERARBPROC wglQueryPbufferARB = - (PFNWGLQUERYPBUFFERARBPROC) wglGetProcAddress("wglQueryPbufferARB"); - PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = - (PFNWGLCHOOSEPIXELFORMATARBPROC) wglGetProcAddress("wglChoosePixelFormatARB"); - - if (!wglCreatePbufferARB) // assumes that if one can be resolved, all of them can - return false; - - dc = wglGetCurrentDC(); - Q_ASSERT(dc); - has_render_texture = false; - - // sample buffers doesn't work in conjunction with the render_texture extension - if (!f.sampleBuffers()) { - PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = - (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB"); - - if (wglGetExtensionsStringARB) { - QString extensions(QLatin1String(wglGetExtensionsStringARB(dc))); - has_render_texture = extensions.contains(QLatin1String("WGL_ARB_render_texture")); - } - } - - int attribs[40]; - qt_format_to_attrib_list(has_render_texture, f, attribs); - - // Find pbuffer capable pixel format. - unsigned int num_formats = 0; - int pixel_format; - wglChoosePixelFormatARB(dc, attribs, 0, 1, &pixel_format, &num_formats); - - // some GL implementations don't support pbuffers with accum - // buffers, so try that before we give up - if (num_formats == 0 && f.accum()) { - QGLFormat tmp = f; - tmp.setAccum(false); - qt_format_to_attrib_list(has_render_texture, tmp, attribs); - wglChoosePixelFormatARB(dc, attribs, 0, 1, &pixel_format, &num_formats); - } - - if (num_formats == 0) { - qWarning("QGLPixelBuffer: Unable to find a pixel format with pbuffer - giving up."); - return false; - } - format = pfiToQGLFormat(dc, pixel_format); - - // NB! The below ONLY works if the width/height are powers of 2. - // Set some pBuffer attributes so that we can use this pBuffer as - // a 2D RGBA texture target. - int pb_attribs[] = {WGL_TEXTURE_FORMAT_ARB, WGL_TEXTURE_RGBA_ARB, - WGL_TEXTURE_TARGET_ARB, WGL_TEXTURE_2D_ARB, 0}; - - pbuf = wglCreatePbufferARB(dc, pixel_format, size.width(), size.height(), - has_render_texture ? pb_attribs : 0); - if (!pbuf) { - // try again without the render_texture extension - pbuf = wglCreatePbufferARB(dc, pixel_format, size.width(), size.height(), 0); - has_render_texture = false; - if (!pbuf) { - qWarning("QGLPixelBuffer: Unable to create pbuffer [w=%d, h=%d] - giving up.", size.width(), size.height()); - return false; - } - } - - dc = wglGetPbufferDCARB(pbuf); - ctx = wglCreateContext(dc); - if (!dc || !ctx) { - qWarning("QGLPixelBuffer: Unable to create pbuffer context - giving up."); - return false; - } - - // Explicitly disable the render_texture extension if we have a - // multi-sampled pbuffer context. This seems to be a problem only with - // ATI cards if multi-sampling is forced globally in the driver. - wglMakeCurrent(dc, ctx); - GLint samples = 0; - glGetIntegerv(GL_SAMPLES_ARB, &samples); - if (has_render_texture && samples != 0) - has_render_texture = false; - - HGLRC share_ctx = shareWidget ? shareWidget->d_func()->glcx->d_func()->rc : 0; - if (share_ctx && !wglShareLists(share_ctx, ctx)) - qWarning("QGLPixelBuffer: Unable to share display lists - with share widget."); - - int width, height; - wglQueryPbufferARB(pbuf, WGL_PBUFFER_WIDTH_ARB, &width); - wglQueryPbufferARB(pbuf, WGL_PBUFFER_HEIGHT_ARB, &height); - return true; -} - -bool QGLPixelBufferPrivate::cleanup() -{ - PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB = - (PFNWGLRELEASEPBUFFERDCARBPROC) wglGetProcAddress("wglReleasePbufferDCARB"); - PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB = - (PFNWGLDESTROYPBUFFERARBPROC) wglGetProcAddress("wglDestroyPbufferARB"); - if (!invalid && wglReleasePbufferDCARB && wglDestroyPbufferARB) { - wglReleasePbufferDCARB(pbuf, dc); - wglDestroyPbufferARB(pbuf); - } - return true; -} - -bool QGLPixelBuffer::bindToDynamicTexture(GLuint texture_id) -{ - Q_D(QGLPixelBuffer); - if (d->invalid || !d->has_render_texture) - return false; - PFNWGLBINDTEXIMAGEARBPROC wglBindTexImageARB = - (PFNWGLBINDTEXIMAGEARBPROC) wglGetProcAddress("wglBindTexImageARB"); - if (wglBindTexImageARB) { - glBindTexture(GL_TEXTURE_2D, texture_id); - return wglBindTexImageARB(d->pbuf, WGL_FRONT_LEFT_ARB); - } - return false; -} - -void QGLPixelBuffer::releaseFromDynamicTexture() -{ - Q_D(QGLPixelBuffer); - if (d->invalid || !d->has_render_texture) - return; - PFNWGLRELEASETEXIMAGEARBPROC wglReleaseTexImageARB = - (PFNWGLRELEASETEXIMAGEARBPROC) wglGetProcAddress("wglReleaseTexImageARB"); - if (wglReleaseTexImageARB) - wglReleaseTexImageARB(d->pbuf, WGL_FRONT_LEFT_ARB); -} - -bool QGLPixelBuffer::hasOpenGLPbuffers() -{ - bool ret = false; - QGLTemporaryContext *tmpContext = 0; - if (!QGLContext::currentContext()) - tmpContext = new QGLTemporaryContext; - PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = - (PFNWGLGETEXTENSIONSSTRINGARBPROC) wglGetProcAddress("wglGetExtensionsStringARB"); - if (wglGetExtensionsStringARB) { - QString extensions(QLatin1String(wglGetExtensionsStringARB(wglGetCurrentDC()))); - if (extensions.contains(QLatin1String("WGL_ARB_pbuffer")) - && extensions.contains(QLatin1String("WGL_ARB_pixel_format"))) { - ret = true; - } - } - if (tmpContext) - delete tmpContext; - return ret; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglpixelbuffer_x11.cpp b/src/opengl/qglpixelbuffer_x11.cpp deleted file mode 100644 index fcd7b521bb0..00000000000 --- a/src/opengl/qglpixelbuffer_x11.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "qglpixelbuffer.h" -#include "qglpixelbuffer_p.h" - -#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) -#include -#endif - -QT_BEGIN_NAMESPACE - -#ifndef GLX_VERSION_1_3 -#define GLX_RGBA_BIT 0x00000002 -#define GLX_PBUFFER_BIT 0x00000004 -#define GLX_DRAWABLE_TYPE 0x8010 -#define GLX_RENDER_TYPE 0x8011 -#define GLX_RGBA_TYPE 0x8014 -#define GLX_PBUFFER_HEIGHT 0x8040 -#define GLX_PBUFFER_WIDTH 0x8041 -#endif - -#ifndef GLX_ARB_multisample -#define GLX_SAMPLE_BUFFERS_ARB 100000 -#define GLX_SAMPLES_ARB 100001 -#endif - -typedef GLXFBConfig* (*_glXChooseFBConfig) (Display *dpy, int screen, const int *attrib_list, int *nelements); -typedef int (*_glXGetFBConfigAttrib) (Display *dpy, GLXFBConfig config, int attribute, int *value); -typedef GLXPbuffer (*_glXCreatePbuffer) (Display *dpy, GLXFBConfig config, const int *attrib_list); -typedef void (*_glXDestroyPbuffer) (Display *dpy, GLXPbuffer pbuf); -typedef GLXContext (*_glXCreateNewContext) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); -typedef Bool (*_glXMakeContextCurrent) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); - -static _glXChooseFBConfig qt_glXChooseFBConfig = 0; -static _glXCreateNewContext qt_glXCreateNewContext = 0; -static _glXCreatePbuffer qt_glXCreatePbuffer = 0; -static _glXDestroyPbuffer qt_glXDestroyPbuffer = 0; -static _glXGetFBConfigAttrib qt_glXGetFBConfigAttrib = 0; -static _glXMakeContextCurrent qt_glXMakeContextCurrent = 0; - -#define glXChooseFBConfig qt_glXChooseFBConfig -#define glXCreateNewContext qt_glXCreateNewContext -#define glXCreatePbuffer qt_glXCreatePbuffer -#define glXDestroyPbuffer qt_glXDestroyPbuffer -#define glXGetFBConfigAttrib qt_glXGetFBConfigAttrib -#define glXMakeContextCurrent qt_glXMakeContextCurrent - -extern void (*qglx_getProcAddress(const char* procName))(); // in qgl_x11.cpp - -static bool qt_resolve_pbuffer_extensions() -{ - static int resolved = false; - if (resolved && qt_glXMakeContextCurrent) - return true; - else if (resolved) - return false; - - qt_glXChooseFBConfig = (_glXChooseFBConfig) qglx_getProcAddress("glXChooseFBConfig"); - qt_glXCreateNewContext = (_glXCreateNewContext) qglx_getProcAddress("glXCreateNewContext"); - qt_glXCreatePbuffer = (_glXCreatePbuffer) qglx_getProcAddress("glXCreatePbuffer"); - qt_glXDestroyPbuffer = (_glXDestroyPbuffer) qglx_getProcAddress("glXDestroyPbuffer"); - qt_glXGetFBConfigAttrib = (_glXGetFBConfigAttrib) qglx_getProcAddress("glXGetFBConfigAttrib"); - qt_glXMakeContextCurrent = (_glXMakeContextCurrent) qglx_getProcAddress("glXMakeContextCurrent"); - - resolved = qt_glXMakeContextCurrent ? true : false; - return resolved; -} - -static void qt_format_to_attrib_list(const QGLFormat &f, int attribs[]) -{ - int i = 0; - attribs[i++] = GLX_RENDER_TYPE; - attribs[i++] = GLX_RGBA_BIT; - attribs[i++] = GLX_DRAWABLE_TYPE; - attribs[i++] = GLX_PBUFFER_BIT; - attribs[i++] = GLX_RED_SIZE; - attribs[i++] = f.redBufferSize() == -1 ? 1 : f.redBufferSize(); - attribs[i++] = GLX_GREEN_SIZE; - attribs[i++] = f.greenBufferSize() == -1 ? 1 : f.greenBufferSize(); - attribs[i++] = GLX_BLUE_SIZE; - attribs[i++] = f.blueBufferSize() == -1 ? 1 : f.blueBufferSize(); - if (f.doubleBuffer()) { - attribs[i++] = GLX_DOUBLEBUFFER; - attribs[i++] = true; - } - if (f.depth()) { - attribs[i++] = GLX_DEPTH_SIZE; - attribs[i++] = f.depthBufferSize() == -1 ? 1 : f.depthBufferSize(); - } - if (f.stereo()) { - attribs[i++] = GLX_STEREO; - attribs[i++] = true; - } - if (f.stencil()) { - attribs[i++] = GLX_STENCIL_SIZE; - attribs[i++] = f.stencilBufferSize() == -1 ? 1 : f.stencilBufferSize(); - } - if (f.alpha()) { - attribs[i++] = GLX_ALPHA_SIZE; - attribs[i++] = f.alphaBufferSize() == -1 ? 1 : f.alphaBufferSize(); - } - if (f.accum()) { - attribs[i++] = GLX_ACCUM_RED_SIZE; - attribs[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize(); - attribs[i++] = GLX_ACCUM_GREEN_SIZE; - attribs[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize(); - attribs[i++] = GLX_ACCUM_BLUE_SIZE; - attribs[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize(); - if (f.alpha()) { - attribs[i++] = GLX_ACCUM_ALPHA_SIZE; - attribs[i++] = f.accumBufferSize() == -1 ? 1 : f.accumBufferSize(); - } - } - if (f.sampleBuffers()) { - attribs[i++] = GLX_SAMPLE_BUFFERS_ARB; - attribs[i++] = 1; - attribs[i++] = GLX_SAMPLES_ARB; - attribs[i++] = f.samples() == -1 ? 4 : f.samples(); - } - - attribs[i] = XNone; -} - -bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget) -{ - if (!qt_resolve_pbuffer_extensions()) { - qWarning("QGLPixelBuffer: pbuffers are not supported on this system."); - return false; - } - - int attribs[40]; - int num_configs = 0; - - qt_format_to_attrib_list(f, attribs); - - int screen = X11->defaultScreen; - if (shareWidget) - screen = shareWidget->x11Info().screen(); - - GLXFBConfig *configs = glXChooseFBConfig(X11->display, screen, attribs, &num_configs); - if (configs && num_configs) { - int res; - glXGetFBConfigAttrib(X11->display, configs[0], GLX_LEVEL, &res); - format.setPlane(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_DOUBLEBUFFER, &res); - format.setDoubleBuffer(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_DEPTH_SIZE, &res); - format.setDepth(res); - if (format.depth()) - format.setDepthBufferSize(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_RGBA, &res); - format.setRgba(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_RED_SIZE, &res); - format.setRedBufferSize(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_GREEN_SIZE, &res); - format.setGreenBufferSize(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_BLUE_SIZE, &res); - format.setBlueBufferSize(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_ALPHA_SIZE, &res); - format.setAlpha(res); - if (format.alpha()) - format.setAlphaBufferSize(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_ACCUM_RED_SIZE, &res); - format.setAccum(res); - if (format.accum()) - format.setAccumBufferSize(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_STENCIL_SIZE, &res); - format.setStencil(res); - if (format.stencil()) - format.setStencilBufferSize(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_STEREO, &res); - format.setStereo(res); - glXGetFBConfigAttrib(X11->display, configs[0], GLX_SAMPLE_BUFFERS_ARB, &res); - format.setSampleBuffers(res); - if (format.sampleBuffers()) { - glXGetFBConfigAttrib(X11->display, configs[0], GLX_SAMPLES_ARB, &res); - format.setSamples(res); - } - - int pb_attribs[] = {GLX_PBUFFER_WIDTH, size.width(), GLX_PBUFFER_HEIGHT, size.height(), XNone}; - GLXContext shareContext = 0; - if (shareWidget && shareWidget->d_func()->glcx) - shareContext = (GLXContext) shareWidget->d_func()->glcx->d_func()->cx; - - pbuf = glXCreatePbuffer(QX11Info::display(), configs[0], pb_attribs); - ctx = glXCreateNewContext(QX11Info::display(), configs[0], GLX_RGBA_TYPE, shareContext, true); - - XFree(configs); - if (!pbuf || !ctx) { - qWarning("QGLPixelBuffer: Unable to create a pbuffer/context - giving up."); - return false; - } - return true; - } else { - qWarning("QGLPixelBuffer: Unable to find a context/format match - giving up."); - return false; - } -} - -bool QGLPixelBufferPrivate::cleanup() -{ - glXDestroyPbuffer(QX11Info::display(), pbuf); - return true; -} - -bool QGLPixelBuffer::bindToDynamicTexture(GLuint) -{ - return false; -} - -void QGLPixelBuffer::releaseFromDynamicTexture() -{ -} - -bool QGLPixelBuffer::hasOpenGLPbuffers() -{ - bool ret = qt_resolve_pbuffer_extensions(); - - if (!ret) - return false; - - int attribs[40]; - int num_configs = 0; - - qt_format_to_attrib_list(QGLFormat::defaultFormat(), attribs); - - GLXFBConfig *configs = glXChooseFBConfig(X11->display, X11->defaultScreen, attribs, &num_configs); - GLXPbuffer pbuf = 0; - GLXContext ctx = 0; - - if (configs && num_configs) { - int pb_attribs[] = {GLX_PBUFFER_WIDTH, 128, GLX_PBUFFER_HEIGHT, 128, XNone}; - pbuf = glXCreatePbuffer(X11->display, configs[0], pb_attribs); - ctx = glXCreateNewContext(X11->display, configs[0], GLX_RGBA_TYPE, 0, true); - XFree(configs); - glXDestroyContext(X11->display, ctx); - glXDestroyPbuffer(X11->display, pbuf); - } - return pbuf && ctx; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp deleted file mode 100644 index 7546d84064b..00000000000 --- a/src/opengl/qglpixmapfilter.cpp +++ /dev/null @@ -1,621 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "private/qpixmapfilter_p.h" -#include "private/qpixmapdata_gl_p.h" -#include "private/qpaintengineex_opengl2_p.h" -#include "private/qglengineshadermanager_p.h" -#include "private/qpixmapdata_p.h" -#include "private/qimagepixmapcleanuphooks_p.h" -#include "qglpixmapfilter_p.h" -#include "qgraphicssystem_gl_p.h" -#include "qpaintengine_opengl_p.h" -#include "qcache.h" - -#include "qglframebufferobject.h" -#include "qglshaderprogram.h" -#include "qgl_p.h" - -#include "private/qapplication_p.h" -#include "private/qdrawhelper_p.h" -#include "private/qmemrotate_p.h" -#include "private/qmath_p.h" -#include "qmath.h" - -QT_BEGIN_NAMESPACE - -// qpixmapfilter.cpp -Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0); -Q_GUI_EXPORT QImage qt_halfScaled(const QImage &source); - -void QGLPixmapFilterBase::bindTexture(const QPixmap &src) const -{ - const_cast(QGLContext::currentContext())->d_func()->bindTexture(src, GL_TEXTURE_2D, GL_RGBA, QGLContext::BindOptions(QGLContext::DefaultBindOption | QGLContext::MemoryManagedBindOption)); -} - -void QGLPixmapFilterBase::drawImpl(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF& source) const -{ - processGL(painter, pos, src, source); -} - -class QGLPixmapColorizeFilter: public QGLCustomShaderStage, public QGLPixmapFilter -{ -public: - QGLPixmapColorizeFilter(); - - void setUniforms(QGLShaderProgram *program); - -protected: - bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &pixmap, const QRectF &srcRect) const; -}; - -class QGLPixmapConvolutionFilter: public QGLCustomShaderStage, public QGLPixmapFilter -{ -public: - QGLPixmapConvolutionFilter(); - ~QGLPixmapConvolutionFilter(); - - void setUniforms(QGLShaderProgram *program); - -protected: - bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const; - -private: - QByteArray generateConvolutionShader() const; - - mutable QSize m_srcSize; - mutable int m_prevKernelSize; -}; - -class QGLPixmapBlurFilter : public QGLCustomShaderStage, public QGLPixmapFilter -{ -public: - QGLPixmapBlurFilter(); - -protected: - bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const; -}; - -class QGLPixmapDropShadowFilter : public QGLCustomShaderStage, public QGLPixmapFilter -{ -public: - QGLPixmapDropShadowFilter(); - - void setUniforms(QGLShaderProgram *program); - -protected: - bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const; -}; - -extern const QGLContext *qt_gl_share_context(); - -QPixmapFilter *QGL2PaintEngineEx::pixmapFilter(int type, const QPixmapFilter *prototype) -{ - Q_D(QGL2PaintEngineEx); - switch (type) { - case QPixmapFilter::ColorizeFilter: - if (!d->colorizeFilter) - d->colorizeFilter.reset(new QGLPixmapColorizeFilter); - return d->colorizeFilter.data(); - - case QPixmapFilter::BlurFilter: { - if (!d->blurFilter) - d->blurFilter.reset(new QGLPixmapBlurFilter()); - return d->blurFilter.data(); - } - - case QPixmapFilter::DropShadowFilter: { - if (!d->dropShadowFilter) - d->dropShadowFilter.reset(new QGLPixmapDropShadowFilter()); - return d->dropShadowFilter.data(); - } - - case QPixmapFilter::ConvolutionFilter: - if (!d->convolutionFilter) - d->convolutionFilter.reset(new QGLPixmapConvolutionFilter); - return d->convolutionFilter.data(); - - default: break; - } - return QPaintEngineEx::pixmapFilter(type, prototype); -} - -static const char *qt_gl_colorize_filter = - "uniform lowp vec4 colorizeColor;" - "uniform lowp float colorizeStrength;" - "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)" - "{" - " lowp vec4 srcPixel = texture2D(src, srcCoords);" - " lowp float gray = dot(srcPixel.rgb, vec3(0.212671, 0.715160, 0.072169));" - " lowp vec3 colorized = 1.0-((1.0-gray)*(1.0-colorizeColor.rgb));" - " return vec4(mix(srcPixel.rgb, colorized * srcPixel.a, colorizeStrength), srcPixel.a);" - "}"; - -QGLPixmapColorizeFilter::QGLPixmapColorizeFilter() -{ - setSource(qt_gl_colorize_filter); -} - -bool QGLPixmapColorizeFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const -{ - QGLPixmapColorizeFilter *filter = const_cast(this); - - filter->setOnPainter(painter); - painter->drawPixmap(pos, src); - filter->removeFromPainter(painter); - - return true; -} - -void QGLPixmapColorizeFilter::setUniforms(QGLShaderProgram *program) -{ - program->setUniformValue("colorizeColor", color()); - program->setUniformValue("colorizeStrength", float(strength())); -} - -void QGLPixmapConvolutionFilter::setUniforms(QGLShaderProgram *program) -{ - const qreal *kernel = convolutionKernel(); - int kernelWidth = columns(); - int kernelHeight = rows(); - int kernelSize = kernelWidth * kernelHeight; - - QVarLengthArray matrix(kernelSize); - QVarLengthArray offset(kernelSize * 2); - - for(int i = 0; i < kernelSize; ++i) - matrix[i] = kernel[i]; - - for(int y = 0; y < kernelHeight; ++y) { - for(int x = 0; x < kernelWidth; ++x) { - offset[(y * kernelWidth + x) * 2] = x - (kernelWidth / 2); - offset[(y * kernelWidth + x) * 2 + 1] = (kernelHeight / 2) - y; - } - } - - const qreal iw = 1.0 / m_srcSize.width(); - const qreal ih = 1.0 / m_srcSize.height(); - program->setUniformValue("inv_texture_size", iw, ih); - program->setUniformValueArray("matrix", matrix.constData(), kernelSize, 1); - program->setUniformValueArray("offset", offset.constData(), kernelSize, 2); -} - -// generates convolution filter code for arbitrary sized kernel -QByteArray QGLPixmapConvolutionFilter::generateConvolutionShader() const { - QByteArray code; - int kernelWidth = columns(); - int kernelHeight = rows(); - int kernelSize = kernelWidth * kernelHeight; - code.append("uniform highp vec2 inv_texture_size;\n" - "uniform mediump float matrix["); - code.append(QByteArray::number(kernelSize)); - code.append("];\n" - "uniform highp vec2 offset["); - code.append(QByteArray::number(kernelSize)); - code.append("];\n"); - code.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n"); - - code.append(" int i = 0;\n" - " lowp vec4 sum = vec4(0.0);\n" - " for (i = 0; i < "); - code.append(QByteArray::number(kernelSize)); - code.append("; i++) {\n" - " sum += matrix[i] * texture2D(src,srcCoords+inv_texture_size*offset[i]);\n" - " }\n" - " return sum;\n" - "}"); - return code; -} - -QGLPixmapConvolutionFilter::QGLPixmapConvolutionFilter() - : m_prevKernelSize(-1) -{ -} - -QGLPixmapConvolutionFilter::~QGLPixmapConvolutionFilter() -{ -} - -bool QGLPixmapConvolutionFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const -{ - QGLPixmapConvolutionFilter *filter = const_cast(this); - - m_srcSize = src.size(); - - int kernelSize = rows() * columns(); - if (m_prevKernelSize == -1 || m_prevKernelSize != kernelSize) { - filter->setSource(generateConvolutionShader()); - m_prevKernelSize = kernelSize; - } - - filter->setOnPainter(painter); - painter->drawPixmap(pos, src, srcRect); - filter->removeFromPainter(painter); - - return true; -} - -QGLPixmapBlurFilter::QGLPixmapBlurFilter() -{ -} - -class QGLBlurTextureInfo -{ -public: - QGLBlurTextureInfo(const QImage &image, GLuint tex, qreal r) - : m_texture(tex) - , m_radius(r) - { - m_paddedImage << image; - } - - ~QGLBlurTextureInfo() - { - glDeleteTextures(1, &m_texture); - } - - QImage paddedImage(int scaleLevel = 0) const; - GLuint texture() const { return m_texture; } - qreal radius() const { return m_radius; } - -private: - mutable QList m_paddedImage; - GLuint m_texture; - qreal m_radius; -}; - -QImage QGLBlurTextureInfo::paddedImage(int scaleLevel) const -{ - for (int i = m_paddedImage.size() - 1; i <= scaleLevel; ++i) - m_paddedImage << qt_halfScaled(m_paddedImage.at(i)); - - return m_paddedImage.at(scaleLevel); -} - -class QGLBlurTextureCache : public QObject -{ -public: - static QGLBlurTextureCache *cacheForContext(const QGLContext *context); - - QGLBlurTextureCache(const QGLContext *); - ~QGLBlurTextureCache(); - - QGLBlurTextureInfo *takeBlurTextureInfo(const QPixmap &pixmap); - bool hasBlurTextureInfo(quint64 cacheKey) const; - void insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info); - void clearBlurTextureInfo(quint64 cacheKey); - - void timerEvent(QTimerEvent *event); - -private: - static void pixmapDestroyed(QPixmapData *pixmap); - - QCache cache; - - static QList blurTextureCaches; - - int timerId; -}; - -QList QGLBlurTextureCache::blurTextureCaches; -Q_GLOBAL_STATIC(QGLContextGroupResource, qt_blur_texture_caches) - -QGLBlurTextureCache::QGLBlurTextureCache(const QGLContext *) - : timerId(0) -{ - cache.setMaxCost(4 * 1024 * 1024); - blurTextureCaches.append(this); -} - -QGLBlurTextureCache::~QGLBlurTextureCache() -{ - blurTextureCaches.removeAt(blurTextureCaches.indexOf(this)); -} - -void QGLBlurTextureCache::timerEvent(QTimerEvent *) -{ - killTimer(timerId); - timerId = 0; - - cache.clear(); -} - -QGLBlurTextureCache *QGLBlurTextureCache::cacheForContext(const QGLContext *context) -{ - return qt_blur_texture_caches()->value(context); -} - -QGLBlurTextureInfo *QGLBlurTextureCache::takeBlurTextureInfo(const QPixmap &pixmap) -{ - return cache.take(pixmap.cacheKey()); -} - -void QGLBlurTextureCache::clearBlurTextureInfo(quint64 cacheKey) -{ - cache.remove(cacheKey); -} - -bool QGLBlurTextureCache::hasBlurTextureInfo(quint64 cacheKey) const -{ - return cache.contains(cacheKey); -} - -void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTextureInfo *info) -{ - static bool hookAdded = false; - if (!hookAdded) { - QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(pixmapDestroyed); - QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(pixmapDestroyed); - hookAdded = true; - } - - QImagePixmapCleanupHooks::enableCleanupHooks(pixmap); - cache.insert(pixmap.cacheKey(), info, pixmap.width() * pixmap.height()); - - if (timerId) - killTimer(timerId); - - timerId = startTimer(8000); -} - -void QGLBlurTextureCache::pixmapDestroyed(QPixmapData *pmd) -{ - foreach (QGLBlurTextureCache *cache, blurTextureCaches) { - if (cache->hasBlurTextureInfo(pmd->cacheKey())) - cache->clearBlurTextureInfo(pmd->cacheKey()); - } -} - -static const int qAnimatedBlurLevelIncrement = 16; -static const int qMaxBlurHalfScaleLevel = 1; - -static GLuint generateBlurTexture(const QSize &size, GLenum format = GL_RGBA) -{ - GLuint texture; - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - glTexImage2D(GL_TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, - GL_UNSIGNED_BYTE, 0); - return texture; -} - -static inline uint nextMultiple(uint x, uint multiplier) -{ - uint mod = x % multiplier; - if (mod == 0) - return x; - return x + multiplier - mod; -} - -Q_GUI_EXPORT void qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride, - quint32 *dest, int dstStride); - -bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const -{ - if (radius() < 1) { - painter->drawPixmap(pos, src); - return true; - } - - qreal actualRadius = radius(); - - QGLContext *ctx = const_cast(QGLContext::currentContext()); - - QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); - QGLBlurTextureInfo *info = 0; - int padding = nextMultiple(qCeil(actualRadius), qAnimatedBlurLevelIncrement); - QRect targetRect = src.rect().adjusted(-padding, -padding, padding, padding); - - // pad so that we'll be able to half-scale qMaxBlurHalfScaleLevel times - targetRect.setWidth((targetRect.width() + (qMaxBlurHalfScaleLevel-1)) & ~(qMaxBlurHalfScaleLevel-1)); - targetRect.setHeight((targetRect.height() + (qMaxBlurHalfScaleLevel-1)) & ~(qMaxBlurHalfScaleLevel-1)); - - QSize textureSize; - - info = blurTextureCache->takeBlurTextureInfo(src); - if (!info || info->radius() < actualRadius) { - QSize paddedSize = targetRect.size() / 2; - - QImage padded(paddedSize.height(), paddedSize.width(), QImage::Format_ARGB32_Premultiplied); - padded.fill(0); - - if (info) { - int oldPadding = qRound(info->radius()); - - QPainter p(&padded); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.drawImage((padding - oldPadding) / 2, (padding - oldPadding) / 2, info->paddedImage()); - p.end(); - } else { - // TODO: combine byteswapping and memrotating into one by declaring - // custom GL_RGBA pixel type and qt_colorConvert template for it - QImage prepadded = qt_halfScaled(src.toImage()).convertToFormat(QImage::Format_ARGB32_Premultiplied); - - // byte-swap and memrotates in one go - qt_memrotate90_gl(reinterpret_cast(prepadded.bits()), - prepadded.width(), prepadded.height(), prepadded.bytesPerLine(), - reinterpret_cast(padded.scanLine(padding / 2)) + padding / 2, - padded.bytesPerLine()); - } - - delete info; - info = new QGLBlurTextureInfo(padded, generateBlurTexture(paddedSize), padding); - - textureSize = paddedSize; - } else { - textureSize = QSize(info->paddedImage().height(), info->paddedImage().width()); - } - - actualRadius *= qreal(0.5); - int level = 1; - for (; level < qMaxBlurHalfScaleLevel; ++level) { - if (actualRadius <= 16) - break; - actualRadius *= qreal(0.5); - } - - const int s = (1 << level); - - int prepadding = qRound(info->radius()); - padding = qMin(prepadding, qCeil(actualRadius) << level); - targetRect = src.rect().adjusted(-padding, -padding, padding, padding); - - targetRect.setWidth(targetRect.width() & ~(s-1)); - targetRect.setHeight(targetRect.height() & ~(s-1)); - - int paddingDelta = (prepadding - padding) >> level; - - QRect subRect(paddingDelta, paddingDelta, targetRect.width() >> level, targetRect.height() >> level); - QImage sourceImage = info->paddedImage(level-1); - - QImage subImage(subRect.height(), subRect.width(), QImage::Format_ARGB32_Premultiplied); - qt_rectcopy((QRgb *)subImage.bits(), ((QRgb *)sourceImage.scanLine(paddingDelta)) + paddingDelta, - 0, 0, subRect.height(), subRect.width(), subImage.bytesPerLine(), sourceImage.bytesPerLine()); - - GLuint texture = info->texture(); - - qt_blurImage(subImage, actualRadius, blurHints() & QGraphicsBlurEffect::QualityHint, 1); - - // subtract one pixel off the end to prevent the bilinear sampling from sampling uninitialized data - QRect textureSubRect = subImage.rect().adjusted(0, 0, -1, -1); - QRectF targetRectF = QRectF(targetRect).adjusted(0, 0, -targetRect.width() / qreal(textureSize.width()), -targetRect.height() / qreal(textureSize.height())); - - glBindTexture(GL_TEXTURE_2D, texture); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subImage.width(), subImage.height(), GL_RGBA, - GL_UNSIGNED_BYTE, const_cast(subImage).bits()); - - QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); - painter->setRenderHint(QPainter::SmoothPixmapTransform); - - // texture is flipped on the y-axis - targetRectF = QRectF(targetRectF.x(), targetRectF.bottom(), targetRectF.width(), -targetRectF.height()); - engine->drawTexture(targetRectF.translated(pos), texture, textureSize, textureSubRect); - - blurTextureCache->insertBlurTextureInfo(src, info); - - return true; -} - -static const char *qt_gl_drop_shadow_filter = - "uniform lowp vec4 shadowColor;" - "lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords)" - "{" - " return shadowColor * texture2D(src, srcCoords.yx).a;" - "}"; - - -QGLPixmapDropShadowFilter::QGLPixmapDropShadowFilter() -{ - setSource(qt_gl_drop_shadow_filter); -} - -bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const -{ - QGLPixmapDropShadowFilter *filter = const_cast(this); - - qreal r = blurRadius(); - QRectF targetRectUnaligned = QRectF(src.rect()).translated(pos + offset()).adjusted(-r, -r, r, r); - QRect targetRect = targetRectUnaligned.toAlignedRect(); - - // ensure even dimensions (going to divide by two) - targetRect.setWidth((targetRect.width() + 1) & ~1); - targetRect.setHeight((targetRect.height() + 1) & ~1); - - QGLContext *ctx = const_cast(QGLContext::currentContext()); - QGLBlurTextureCache *blurTextureCache = QGLBlurTextureCache::cacheForContext(ctx); - - QGLBlurTextureInfo *info = blurTextureCache->takeBlurTextureInfo(src); - if (!info || info->radius() != r) { - QImage half = qt_halfScaled(src.toImage().alphaChannel()); - - qreal rx = r + targetRect.left() - targetRectUnaligned.left(); - qreal ry = r + targetRect.top() - targetRectUnaligned.top(); - - QImage image = QImage(targetRect.size() / 2, QImage::Format_Indexed8); - image.setColorTable(half.colorTable()); - image.fill(0); - int dx = qRound(rx * qreal(0.5)); - int dy = qRound(ry * qreal(0.5)); - qt_rectcopy(image.bits(), half.bits(), dx, dy, - half.width(), half.height(), - image.bytesPerLine(), half.bytesPerLine()); - - qt_blurImage(image, r * qreal(0.5), false, 1); - - GLuint texture; - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, image.width(), image.height(), - 0, GL_ALPHA, GL_UNSIGNED_BYTE, image.bits()); - - info = new QGLBlurTextureInfo(image, texture, r); - } - - GLuint texture = info->texture(); - - filter->setOnPainter(painter); - - QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); - painter->setRenderHint(QPainter::SmoothPixmapTransform); - - engine->drawTexture(targetRect, texture, info->paddedImage().size(), info->paddedImage().rect()); - - filter->removeFromPainter(painter); - - // Now draw the actual pixmap over the top. - painter->drawPixmap(pos, src, srcRect); - - blurTextureCache->insertBlurTextureInfo(src, info); - - return true; -} - -void QGLPixmapDropShadowFilter::setUniforms(QGLShaderProgram *program) -{ - QColor col = color(); - qreal alpha = col.alphaF(); - program->setUniformValue("shadowColor", col.redF() * alpha, - col.greenF() * alpha, - col.blueF() * alpha, - alpha); -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglpixmapfilter_p.h b/src/opengl/qglpixmapfilter_p.h deleted file mode 100644 index 1aa234a25b9..00000000000 --- a/src/opengl/qglpixmapfilter_p.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGLPIXMAPFILTER_P_H -#define QGLPIXMAPFILTER_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 - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QGLPixelBuffer; - -QT_MODULE(OpenGL) - -class QGLPixmapFilterBase -{ -public: - virtual ~QGLPixmapFilterBase() {} -protected: - void bindTexture(const QPixmap &src) const; - void drawImpl(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect = QRectF()) const; - - virtual bool processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect) const = 0; -}; - -template -class QGLPixmapFilter : public Filter, public QGLPixmapFilterBase -{ -public: - void draw(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &srcRect = QRectF()) const { - const QRectF source = srcRect.isNull() ? QRectF(src.rect()) : srcRect; - if (painter) - drawImpl(painter, pos, src, source); - } -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QGLPIXMAPFILTER_P_H diff --git a/src/opengl/qglscreen_qws.cpp b/src/opengl/qglscreen_qws.cpp deleted file mode 100644 index 517813e6283..00000000000 --- a/src/opengl/qglscreen_qws.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include "private/qglwindowsurface_qws_p.h" - -QT_BEGIN_NAMESPACE - -class QGLScreenPrivate -{ -public: - QGLScreen::Options options; - QGLScreenSurfaceFunctions *functions; -}; - -/*! - \internal - \preliminary - \class QGLScreen - - \brief This class encapsulates an OpenGL screen driver. -*/ - -QGLScreen::QGLScreen(int displayId) - : QScreen(displayId, GLClass), d_ptr(new QGLScreenPrivate) -{ - d_ptr->options = NoOptions; - d_ptr->functions = new QGLScreenSurfaceFunctions(); -} - -QGLScreen::~QGLScreen() -{ - delete d_ptr->functions; - delete d_ptr; -} - -/*! - \since 4.3 - \obsolete - - Initializes the \a context and sets up the QGLWindowSurface of the - QWidget of \a context based on the parameters of \a context and - based on its own requirements. The format() of \a context needs - to be updated with the actual parameters of the OpenGLES drawable - that was set up. - - \a shareContext is used in the same way as for QGLContext. It is - the context with which \a context shares display lists and texture - ids etc. The window surface must be set up so that this sharing - works. - - Returns true in case of success and false if it is not possible to - create the necessary OpenGLES drawable/context. - - Since 4.4.2, this function will be not be called if options() - indicates that a native window or pixmap drawable can be created - via the functions in the surfaceFunctions() object. - - This function is obsolete in Qt 4.5 and higher. Use surfaceFunctions() - instead. - - \sa options(), surfaceFunctions() -*/ -bool -QGLScreen::chooseContext(QGLContext *context, const QGLContext *shareContext) -{ - Q_UNUSED(context); - Q_UNUSED(shareContext); - return false; -} - -/*! - \enum QGLScreen::Option - This enum defines options that can be set on QGLScreen instances. - - \value NoOptions There are no special options on the screen. This is the default. - \value NativeWindows Native windows can be created with QGLScreenSurfaceFunctions::createNativeWindow(). - \value NativePixmaps Native pixmaps can be created with QGLScreenSurfaceFunctions::createNativePixmap(). - \value NativeImages Native images can be created with QGLScreenSurfaceFunctions::createNativeImage(). - \value Overlays The screen supports GL overlays. -*/ - -/*! - \since 4.4.2 - - Returns the options associated with this QGLScreen. - - \sa setOptions() -*/ -QGLScreen::Options QGLScreen::options() const -{ - return d_ptr->options; -} - -/*! - \since 4.4.2 - - Sets the options associated with this QGLScreen to \a value. - - \sa options() -*/ -void QGLScreen::setOptions(QGLScreen::Options value) -{ - d_ptr->options = value; -} - -/*! - \since 4.4.2 - - Returns the surface functions object for this QGLScreen. - - \sa setSurfaceFunctions() -*/ -QGLScreenSurfaceFunctions *QGLScreen::surfaceFunctions() const -{ - return d_ptr->functions; -} - -/*! - \since 4.4.2 - - Sets the surface functions object for this QGLScreen to \a functions. - The QGLScreen will take over ownership of \a functions and delete - it when the QGLScreen is deleted. - - \sa setSurfaceFunctions() -*/ -void QGLScreen::setSurfaceFunctions(QGLScreenSurfaceFunctions *functions) -{ - if (functions && functions != d_ptr->functions) { - delete d_ptr->functions; - d_ptr->functions = functions; - } -} - -/*! - \internal - \preliminary - \class QGLScreenSurfaceFunctions - \brief The QGLScreenSurfaceFunctions class encapsulates the functions for creating native windows and pixmaps for OpenGL ES. -*/ - -/*! - \since 4.4.2 - - Creates a native OpenGLES drawable for the surface of \a widget and - returns it in \a native. Returns true if the OpenGLES drawable could - be created, or false if windows are not supported. - - This function will be called if the NativeWindows option is set on - the screen. - - \sa createNativePixmap(), createNativeImage(), QGLScreen::options() -*/ -bool QGLScreenSurfaceFunctions::createNativeWindow(QWidget *widget, EGLNativeWindowType *native) -{ - Q_UNUSED(widget); - Q_UNUSED(native); - return false; -} - -/*! - \since 4.4.2 - - Creates a native OpenGLES drawable for directly rendering into - \a pixmap and returns it in \a native. Returns true if the OpenGLES - drawable could be created, or false if direct rendering into pixmaps - is not supported. - - This function will be called if the NativePixmaps option is set on - the screen. - - \sa createNativeWindow(), createNativeImage(), QGLScreen::options() -*/ -bool QGLScreenSurfaceFunctions::createNativePixmap(QPixmap *pixmap, EGLNativePixmapType *native) -{ - Q_UNUSED(pixmap); - Q_UNUSED(native); - return false; -} - -/*! - \since 4.4.2 - - Creates a native OpenGLES drawable for directly rendering into - \a image and returns it in \a native. Returns true if the OpenGLES - drawable could be created, or false if direct rendering into images - is not supported. - - This function will be called if the NativeImages option is set on - the screen. - - \sa createNativeWindow(), createNativePixmap(), QGLScreen::options() -*/ -bool QGLScreenSurfaceFunctions::createNativeImage(QImage *image, EGLNativePixmapType *native) -{ - Q_UNUSED(image); - Q_UNUSED(native); - return false; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglscreen_qws.h b/src/opengl/qglscreen_qws.h deleted file mode 100644 index a033b6badbd..00000000000 --- a/src/opengl/qglscreen_qws.h +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSCREENEGL_P_H -#define QSCREENEGL_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 QScreenEGL class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#if defined(QT_OPENGL_ES_2) -#include -#else -#include -#endif -#if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED) -#undef EGLNativeWindowType -#undef EGLNativePixmapType -#undef EGLNativeDisplayType -typedef NativeWindowType EGLNativeWindowType; -typedef NativePixmapType EGLNativePixmapType; -typedef NativeDisplayType EGLNativeDisplayType; -#define QEGL_NATIVE_TYPES_DEFINED 1 -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(OpenGL) - -class QGLScreenPrivate; - -class Q_OPENGL_EXPORT QGLScreenSurfaceFunctions -{ -public: - virtual bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native); - virtual bool createNativePixmap(QPixmap *pixmap, EGLNativePixmapType *native); - virtual bool createNativeImage(QImage *image, EGLNativePixmapType *native); -}; - -class Q_OPENGL_EXPORT QGLScreen : public QScreen -{ - Q_DECLARE_PRIVATE(QGLScreen) -public: - QGLScreen(int displayId); - virtual ~QGLScreen(); - - enum Option - { - NoOptions = 0, - NativeWindows = 1, - NativePixmaps = 2, - NativeImages = 4, - Overlays = 8 - }; - Q_DECLARE_FLAGS(Options, Option) - - QGLScreen::Options options() const; - - virtual bool chooseContext(QGLContext *context, const QGLContext *shareContext); - virtual bool hasOpenGL() = 0; - - QGLScreenSurfaceFunctions *surfaceFunctions() const; - -protected: - void setOptions(QGLScreen::Options value); - void setSurfaceFunctions(QGLScreenSurfaceFunctions *functions); - -private: - QGLScreenPrivate *d_ptr; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QGLScreen::Options) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSCREENEGL_P_H diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index e9cae44662a..0163d60f0c5 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_OPENGL_ES_1) - /*! \class QGLShaderProgram \brief The QGLShaderProgram class allows OpenGL shader programs to be linked and used. @@ -191,15 +189,15 @@ class QGLShaderPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QGLShader) public: - QGLShaderPrivate(const QGLContext *context, QGLShader::ShaderType type) - : shaderGuard(context) + QGLShaderPrivate(const QGLContext *, QGLShader::ShaderType type) + : shaderGuard(0) , shaderType(type) , compiled(false) { } ~QGLShaderPrivate(); - QGLSharedResourceGuard shaderGuard; + QGLSharedResourceGuardBase *shaderGuard; QGLShader::ShaderType shaderType; bool compiled; QString log; @@ -209,22 +207,28 @@ public: void deleteShader(); }; -#define ctx shaderGuard.context() +namespace { + void freeShaderFunc(QGLContext *ctx, GLuint id) + { + Q_UNUSED(ctx); + glDeleteShader(id); + } +} + +#define ctx QGLContext::currentContext() QGLShaderPrivate::~QGLShaderPrivate() { - if (shaderGuard.id()) { - QGLShareContextScope scope(shaderGuard.context()); - glDeleteShader(shaderGuard.id()); - } + if (shaderGuard) + shaderGuard->free(); } bool QGLShaderPrivate::create() { - const QGLContext *context = shaderGuard.context(); + QGLContext *context = const_cast(QGLContext::currentContext()); if (!context) return false; - if (qt_resolve_glsl_extensions(const_cast(context))) { + if (qt_resolve_glsl_extensions(context)) { GLuint shader; if (shaderType == QGLShader::Vertex) shader = glCreateShader(GL_VERTEX_SHADER); @@ -236,7 +240,7 @@ bool QGLShaderPrivate::create() qWarning() << "QGLShader: could not create shader"; return false; } - shaderGuard.setId(shader); + shaderGuard = createSharedResourceGuard(context, shader, freeShaderFunc); return true; } else { return false; @@ -245,7 +249,7 @@ bool QGLShaderPrivate::create() bool QGLShaderPrivate::compile(QGLShader *q) { - GLuint shader = shaderGuard.id(); + GLuint shader = shaderGuard ? shaderGuard->id() : 0; if (!shader) return false; glCompileShader(shader); @@ -288,15 +292,12 @@ bool QGLShaderPrivate::compile(QGLShader *q) void QGLShaderPrivate::deleteShader() { - if (shaderGuard.id()) { - glDeleteShader(shaderGuard.id()); - shaderGuard.setId(0); + if (shaderGuard) { + shaderGuard->free(); + shaderGuard = 0; } } -#undef ctx -#define ctx d->shaderGuard.context() - /*! Constructs a new QGLShader object of the specified \a type and attaches it to \a parent. If shader programs are not supported, @@ -389,7 +390,7 @@ static const char redefineHighp[] = bool QGLShader::compileSourceCode(const char *source) { Q_D(QGLShader); - if (d->shaderGuard.id()) { + if (d->shaderGuard && d->shaderGuard->id()) { QVarLengthArray src; QVarLengthArray srclen; int headerLen = 0; @@ -422,7 +423,7 @@ bool QGLShader::compileSourceCode(const char *source) #endif src.append(source + headerLen); srclen.append(GLint(qstrlen(source + headerLen))); - glShaderSource(d->shaderGuard.id(), src.size(), src.data(), srclen.data()); + glShaderSource(d->shaderGuard->id(), src.size(), src.data(), srclen.data()); return d->compile(this); } else { return false; @@ -482,7 +483,7 @@ bool QGLShader::compileSourceFile(const QString& fileName) QByteArray QGLShader::sourceCode() const { Q_D(const QGLShader); - GLuint shader = d->shaderGuard.id(); + GLuint shader = d->shaderGuard ? d->shaderGuard->id() : 0; if (!shader) return QByteArray(); GLint size = 0; @@ -527,22 +528,17 @@ QString QGLShader::log() const GLuint QGLShader::shaderId() const { Q_D(const QGLShader); - return d->shaderGuard.id(); + return d->shaderGuard ? d->shaderGuard->id() : 0; } - - - - #undef ctx -#define ctx programGuard.context() class QGLShaderProgramPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QGLShaderProgram) public: - QGLShaderProgramPrivate(const QGLContext *context) - : programGuard(context) + QGLShaderProgramPrivate(const QGLContext *) + : programGuard(0) , linked(false) , inited(false) , removingShaders(false) @@ -553,7 +549,7 @@ public: } ~QGLShaderProgramPrivate(); - QGLSharedResourceGuard programGuard; + QGLSharedResourceGuardBase *programGuard; bool linked; bool inited; bool removingShaders; @@ -569,12 +565,19 @@ public: bool hasShader(QGLShader::ShaderType type) const; }; +namespace { + void freeProgramFunc(QGLContext *ctx, GLuint id) + { + Q_UNUSED(ctx); + glDeleteProgram(id); + } +} + + QGLShaderProgramPrivate::~QGLShaderProgramPrivate() { - if (programGuard.id()) { - QGLShareContextScope scope(programGuard.context()); - glDeleteProgram(programGuard.id()); - } + if (programGuard) + programGuard->free(); } bool QGLShaderProgramPrivate::hasShader(QGLShader::ShaderType type) const @@ -586,8 +589,7 @@ bool QGLShaderProgramPrivate::hasShader(QGLShader::ShaderType type) const return false; } -#undef ctx -#define ctx d->programGuard.context() +#define ctx QGLContext::currentContext() /*! Constructs a new shader program and attaches it to \a parent. @@ -625,24 +627,21 @@ QGLShaderProgram::~QGLShaderProgram() bool QGLShaderProgram::init() { Q_D(QGLShaderProgram); - if (d->programGuard.id() || d->inited) + if ((d->programGuard && d->programGuard->id()) || d->inited) return true; d->inited = true; - const QGLContext *context = d->programGuard.context(); - if (!context) { - context = QGLContext::currentContext(); - d->programGuard.setContext(context); - } - + QGLContext *context = const_cast(QGLContext::currentContext()); if (!context) return false; - if (qt_resolve_glsl_extensions(const_cast(context))) { + if (qt_resolve_glsl_extensions(context)) { GLuint program = glCreateProgram(); if (!program) { qWarning() << "QGLShaderProgram: could not create shader program"; return false; } - d->programGuard.setId(program); + if (d->programGuard) + delete d->programGuard; + d->programGuard = createSharedResourceGuard(context, program, freeProgramFunc); return true; } else { qWarning() << "QGLShaderProgram: shader programs are not supported"; @@ -669,15 +668,14 @@ bool QGLShaderProgram::addShader(QGLShader *shader) return false; if (d->shaders.contains(shader)) return true; // Already added to this shader program. - if (d->programGuard.id() && shader) { - if (!QGLContext::areSharing(shader->d_func()->shaderGuard.context(), - d->programGuard.context())) { + if (d->programGuard && d->programGuard->id() && shader) { + if (!shader->d_func()->shaderGuard || !shader->d_func()->shaderGuard->id()) + return false; + if (d->programGuard->group() != shader->d_func()->shaderGuard->group()) { qWarning("QGLShaderProgram::addShader: Program and shader are not associated with same context."); return false; } - if (!shader->d_func()->shaderGuard.id()) - return false; - glAttachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id()); + glAttachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id()); d->linked = false; // Program needs to be relinked. d->shaders.append(shader); connect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed())); @@ -786,14 +784,17 @@ bool QGLShaderProgram::addShaderFromSourceFile /*! Removes \a shader from this shader program. The object is not deleted. + The shader program must be valid in the current QGLContext. + \sa addShader(), link(), removeAllShaders() */ void QGLShaderProgram::removeShader(QGLShader *shader) { Q_D(QGLShaderProgram); - if (d->programGuard.id() && shader && shader->d_func()->shaderGuard.id()) { - QGLShareContextScope scope(d->programGuard.context()); - glDetachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id()); + if (d->programGuard && d->programGuard->id() + && shader && shader->d_func()->shaderGuard) + { + glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id()); } d->linked = false; // Program needs to be relinked. if (shader) { @@ -828,8 +829,11 @@ void QGLShaderProgram::removeAllShaders() Q_D(QGLShaderProgram); d->removingShaders = true; foreach (QGLShader *shader, d->shaders) { - if (d->programGuard.id() && shader && shader->d_func()->shaderGuard.id()) - glDetachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id()); + if (d->programGuard && d->programGuard->id() + && shader && shader->d_func()->shaderGuard) + { + glDetachShader(d->programGuard->id(), shader->d_func()->shaderGuard->id()); + } } foreach (QGLShader *shader, d->anonShaders) { // Delete shader objects that were created anonymously. @@ -858,7 +862,7 @@ void QGLShaderProgram::removeAllShaders() bool QGLShaderProgram::link() { Q_D(QGLShaderProgram); - GLuint program = d->programGuard.id(); + GLuint program = d->programGuard ? d->programGuard->id() : 0; if (!program) return false; @@ -948,13 +952,13 @@ QString QGLShaderProgram::log() const bool QGLShaderProgram::bind() { Q_D(QGLShaderProgram); - GLuint program = d->programGuard.id(); + GLuint program = d->programGuard ? d->programGuard->id() : 0; if (!program) return false; if (!d->linked && !link()) return false; #ifndef QT_NO_DEBUG - if (!QGLContext::areSharing(d->programGuard.context(), QGLContext::currentContext())) { + if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) { qWarning("QGLShaderProgram::bind: program is not valid in the current context."); return false; } @@ -976,7 +980,7 @@ void QGLShaderProgram::release() { #ifndef QT_NO_DEBUG Q_D(QGLShaderProgram); - if (!QGLContext::areSharing(d->programGuard.context(), QGLContext::currentContext())) + if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) qWarning("QGLShaderProgram::release: program is not valid in the current context."); #endif #if defined(QT_OPENGL_ES_2) @@ -987,9 +991,6 @@ void QGLShaderProgram::release() #endif } -#undef ctx -#define ctx d->programGuard.context() - /*! Returns the OpenGL identifier associated with this shader program. @@ -998,7 +999,7 @@ void QGLShaderProgram::release() GLuint QGLShaderProgram::programId() const { Q_D(const QGLShaderProgram); - GLuint id = d->programGuard.id(); + GLuint id = d->programGuard ? d->programGuard->id() : 0; if (id) return id; @@ -1007,7 +1008,7 @@ GLuint QGLShaderProgram::programId() const // themselves, particularly those using program binaries. if (!const_cast(this)->init()) return 0; - return d->programGuard.id(); + return d->programGuard ? d->programGuard->id() : 0; } /*! @@ -1024,9 +1025,9 @@ GLuint QGLShaderProgram::programId() const void QGLShaderProgram::bindAttributeLocation(const char *name, int location) { Q_D(QGLShaderProgram); - if (!init()) + if (!init() || !d->programGuard || !d->programGuard->id()) return; - glBindAttribLocation(d->programGuard.id(), location, name); + glBindAttribLocation(d->programGuard->id(), location, name); d->linked = false; // Program needs to be relinked. } @@ -1076,8 +1077,8 @@ void QGLShaderProgram::bindAttributeLocation(const QString& name, int location) int QGLShaderProgram::attributeLocation(const char *name) const { Q_D(const QGLShaderProgram); - if (d->linked) { - return glGetAttribLocation(d->programGuard.id(), name); + if (d->linked && d->programGuard && d->programGuard->id()) { + return glGetAttribLocation(d->programGuard->id(), name); } else { qWarning() << "QGLShaderProgram::attributeLocation(" << name << "): shader program is not linked"; @@ -1754,8 +1755,8 @@ int QGLShaderProgram::uniformLocation(const char *name) const { Q_D(const QGLShaderProgram); Q_UNUSED(d); - if (d->linked) { - return glGetUniformLocation(d->programGuard.id(), name); + if (d->linked && d->programGuard && d->programGuard->id()) { + return glGetUniformLocation(d->programGuard->id(), name); } else { qWarning() << "QGLShaderProgram::uniformLocation(" << name << "): shader program is not linked"; @@ -3269,86 +3270,4 @@ bool QGLShader::hasOpenGLShaders(ShaderType type, const QGLContext *context) return true; } - - -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS -/*! \internal */ -void QGLShaderProgram::setAttributeArray - (int location, QMacCompatGLenum type, const void *values, int tupleSize, int stride) -{ - setAttributeArray(location, GLenum(type), values, tupleSize, stride); -} - -/*! \internal */ -void QGLShaderProgram::setAttributeArray - (const char *name, QMacCompatGLenum type, const void *values, int tupleSize, int stride) -{ - setAttributeArray(name, GLenum(type), values, tupleSize, stride); -} - -/*! \internal */ -void QGLShaderProgram::setAttributeBuffer - (int location, QMacCompatGLenum type, int offset, int tupleSize, int stride) -{ - setAttributeBuffer(location, GLenum(type), offset, tupleSize, stride); -} - -/*! \internal */ -void QGLShaderProgram::setAttributeBuffer - (const char *name, QMacCompatGLenum type, int offset, int tupleSize, int stride) -{ - setAttributeBuffer(name, GLenum(type), offset, tupleSize, stride); -} - -/*! \internal */ -void QGLShaderProgram::setUniformValue(int location, QMacCompatGLint value) -{ - setUniformValue(location, GLint(value)); -} - -/*! \internal */ -void QGLShaderProgram::setUniformValue(int location, QMacCompatGLuint value) -{ - setUniformValue(location, GLuint(value)); -} - -/*! \internal */ -void QGLShaderProgram::setUniformValue(const char *name, QMacCompatGLint value) -{ - setUniformValue(name, GLint(value)); -} - -/*! \internal */ -void QGLShaderProgram::setUniformValue(const char *name, QMacCompatGLuint value) -{ - setUniformValue(name, GLuint(value)); -} - -/*! \internal */ -void QGLShaderProgram::setUniformValueArray(int location, const QMacCompatGLint *values, int count) -{ - setUniformValueArray(location, (const GLint *)values, count); -} - -/*! \internal */ -void QGLShaderProgram::setUniformValueArray(int location, const QMacCompatGLuint *values, int count) -{ - setUniformValueArray(location, (const GLuint *)values, count); -} - -/*! \internal */ -void QGLShaderProgram::setUniformValueArray(const char *name, const QMacCompatGLint *values, int count) -{ - setUniformValueArray(name, (const GLint *)values, count); -} - -/*! \internal */ -void QGLShaderProgram::setUniformValueArray(const char *name, const QMacCompatGLuint *values, int count) -{ - setUniformValueArray(name, (const GLuint *)values, count); -} -#endif - -#endif // !defined(QT_OPENGL_ES_1) - QT_END_NAMESPACE diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h index 09b6184bcb4..591aab27cd6 100644 --- a/src/opengl/qglshaderprogram.h +++ b/src/opengl/qglshaderprogram.h @@ -54,8 +54,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(OpenGL) -#if !defined(QT_OPENGL_ES_1) - class QGLShaderProgram; class QGLShaderPrivate; @@ -204,17 +202,6 @@ public: void setAttributeBuffer (const char *name, GLenum type, int offset, int tupleSize, int stride = 0); -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS - void setAttributeArray - (int location, QMacCompatGLenum type, const void *values, int tupleSize, int stride = 0); - void setAttributeArray - (const char *name, QMacCompatGLenum type, const void *values, int tupleSize, int stride = 0); - void setAttributeBuffer - (int location, QMacCompatGLenum type, int offset, int tupleSize, int stride = 0); - void setAttributeBuffer - (const char *name, QMacCompatGLenum type, int offset, int tupleSize, int stride = 0); -#endif - void enableAttributeArray(int location); void enableAttributeArray(const char *name); void disableAttributeArray(int location); @@ -224,17 +211,6 @@ public: int uniformLocation(const QByteArray& name) const; int uniformLocation(const QString& name) const; -#ifdef Q_MAC_COMPAT_GL_FUNCTIONS - void setUniformValue(int location, QMacCompatGLint value); - void setUniformValue(int location, QMacCompatGLuint value); - void setUniformValue(const char *name, QMacCompatGLint value); - void setUniformValue(const char *name, QMacCompatGLuint value); - void setUniformValueArray(int location, const QMacCompatGLint *values, int count); - void setUniformValueArray(int location, const QMacCompatGLuint *values, int count); - void setUniformValueArray(const char *name, const QMacCompatGLint *values, int count); - void setUniformValueArray(const char *name, const QMacCompatGLuint *values, int count); -#endif - void setUniformValue(int location, GLfloat value); void setUniformValue(int location, GLint value); void setUniformValue(int location, GLuint value); @@ -335,8 +311,6 @@ private: bool init(); }; -#endif - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/opengl/qgltexturepool.cpp b/src/opengl/qgltexturepool.cpp deleted file mode 100644 index d8093287255..00000000000 --- a/src/opengl/qgltexturepool.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgltexturepool_p.h" -#include "qpixmapdata_gl_p.h" - -QT_BEGIN_NAMESPACE - -Q_OPENGL_EXPORT extern QGLWidget* qt_gl_share_widget(); - -static QGLTexturePool *qt_gl_texture_pool = 0; - -class QGLTexturePoolPrivate -{ -public: - QGLTexturePoolPrivate() : lruFirst(0), lruLast(0) {} - - QGLPixmapData *lruFirst; - QGLPixmapData *lruLast; -}; - -QGLTexturePool::QGLTexturePool() - : d_ptr(new QGLTexturePoolPrivate()) -{ -} - -QGLTexturePool::~QGLTexturePool() -{ -} - -QGLTexturePool *QGLTexturePool::instance() -{ - if (!qt_gl_texture_pool) - qt_gl_texture_pool = new QGLTexturePool(); - return qt_gl_texture_pool; -} - -GLuint QGLTexturePool::createTextureForPixmap(GLenum target, - GLint level, - GLint internalformat, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - QGLPixmapData *data) -{ - GLuint texture; - glGenTextures(1, &texture); - glBindTexture(target, texture); - do { - glTexImage2D(target, level, internalformat, width, height, 0, format, type, 0); - GLenum error = glGetError(); - if (error == GL_NO_ERROR) { - if (data) - moveToHeadOfLRU(data); - return texture; - } else if (error != GL_OUT_OF_MEMORY) { - qWarning("QGLTexturePool: cannot create temporary texture because of invalid params"); - return 0; - } - } while (reclaimSpace(internalformat, width, height, format, type, data)); - qWarning("QGLTexturePool: cannot reclaim sufficient space for a %dx%d pixmap", - width, height); - return 0; -} - -bool QGLTexturePool::createPermanentTexture(GLuint texture, - GLenum target, - GLint level, - GLint internalformat, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - const GLvoid *data) -{ - glBindTexture(target, texture); - do { - glTexImage2D(target, level, internalformat, width, height, 0, format, type, data); - - GLenum error = glGetError(); - if (error == GL_NO_ERROR) { - return true; - } else if (error != GL_OUT_OF_MEMORY) { - qWarning("QGLTexturePool: cannot create permanent texture because of invalid params"); - return false; - } - } while (reclaimSpace(internalformat, width, height, format, type, 0)); - qWarning("QGLTexturePool: cannot reclaim sufficient space for a %dx%d pixmap", - width, height); - return 0; -} - -void QGLTexturePool::releaseTexture(QGLPixmapData *data, GLuint texture) -{ - // Very simple strategy at the moment: just destroy the texture. - if (data) - removeFromLRU(data); - - QGLWidget *shareWidget = qt_gl_share_widget(); - if (shareWidget) { - QGLShareContextScope ctx(shareWidget->context()); - glDeleteTextures(1, &texture); - } -} - -void QGLTexturePool::useTexture(QGLPixmapData *data) -{ - moveToHeadOfLRU(data); -} - -void QGLTexturePool::detachTexture(QGLPixmapData *data) -{ - removeFromLRU(data); -} - -bool QGLTexturePool::reclaimSpace(GLint internalformat, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - QGLPixmapData *data) -{ - Q_UNUSED(internalformat); // For future use in picking the best texture to eject. - Q_UNUSED(width); - Q_UNUSED(height); - Q_UNUSED(format); - Q_UNUSED(type); - - bool succeeded = false; - bool wasInLRU = false; - if (data) { - wasInLRU = data->inLRU; - moveToHeadOfLRU(data); - } - - QGLPixmapData *lrudata = pixmapLRU(); - if (lrudata && lrudata != data) { - lrudata->reclaimTexture(); - succeeded = true; - } - - if (data && !wasInLRU) - removeFromLRU(data); - - return succeeded; -} - -void QGLTexturePool::hibernate() -{ - Q_D(QGLTexturePool); - QGLPixmapData *pd = d->lruLast; - while (pd) { - QGLPixmapData *prevLRU = pd->prevLRU; - pd->inTexturePool = false; - pd->inLRU = false; - pd->nextLRU = 0; - pd->prevLRU = 0; - pd->hibernate(); - pd = prevLRU; - } - d->lruFirst = 0; - d->lruLast = 0; -} - -void QGLTexturePool::moveToHeadOfLRU(QGLPixmapData *data) -{ - Q_D(QGLTexturePool); - if (data->inLRU) { - if (!data->prevLRU) - return; // Already at the head of the list. - removeFromLRU(data); - } - data->inLRU = true; - data->nextLRU = d->lruFirst; - data->prevLRU = 0; - if (d->lruFirst) - d->lruFirst->prevLRU = data; - else - d->lruLast = data; - d->lruFirst = data; -} - -void QGLTexturePool::removeFromLRU(QGLPixmapData *data) -{ - Q_D(QGLTexturePool); - if (!data->inLRU) - return; - if (data->nextLRU) - data->nextLRU->prevLRU = data->prevLRU; - else - d->lruLast = data->prevLRU; - if (data->prevLRU) - data->prevLRU->nextLRU = data->nextLRU; - else - d->lruFirst = data->nextLRU; - data->inLRU = false; -} - -QGLPixmapData *QGLTexturePool::pixmapLRU() -{ - Q_D(QGLTexturePool); - return d->lruLast; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qgltexturepool_p.h b/src/opengl/qgltexturepool_p.h deleted file mode 100644 index 27b730cbb93..00000000000 --- a/src/opengl/qgltexturepool_p.h +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGLTEXTUREPOOL_P_H -#define QGLTEXTUREPOOL_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 "qgl.h" -#include - -QT_BEGIN_NAMESPACE - -class QGLPixmapData; -class QGLTexturePoolPrivate; - -class QGLTexturePool -{ -public: - QGLTexturePool(); - virtual ~QGLTexturePool(); - - static QGLTexturePool *instance(); - - // Create a new texture with the specified parameters and associate - // it with "data". The QGLPixmapData will be notified when the - // texture needs to be reclaimed by the pool. - // - // This function will call reclaimSpace() when texture creation fails. - GLuint createTextureForPixmap(GLenum target, - GLint level, - GLint internalformat, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - QGLPixmapData *data); - - // Create a permanent texture with the specified parameters. - // If there is insufficient space for the texture, - // then this function will call reclaimSpace() and try again. - // - // The caller is responsible for calling glDeleteTextures() - // when it no longer needs the texture, as the texture is not - // recorded in the texture pool. - bool createPermanentTexture(GLuint texture, - GLenum target, - GLint level, - GLint internalformat, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - const GLvoid *data); - - // Release a texture that is no longer required. - void releaseTexture(QGLPixmapData *data, GLuint texture); - - // Notify the pool that a QGLPixmapData object is using - // an texture again. This allows the pool to move the texture - // within a least-recently-used list of QGLPixmapData objects. - void useTexture(QGLPixmapData *data); - - // Notify the pool that the texture associated with a - // QGLPixmapData is being detached from the pool. The caller - // will become responsible for calling glDeleteTextures(). - void detachTexture(QGLPixmapData *data); - - // Reclaim space for an image allocation with the specified parameters. - // Returns true if space was reclaimed, or false if there is no - // further space that can be reclaimed. The "data" parameter - // indicates the pixmap that is trying to obtain space which should - // not itself be reclaimed. - bool reclaimSpace(GLint internalformat, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - QGLPixmapData *data); - - // Hibernate the image pool because the context is about to be - // destroyed. All textures left in the pool should be released. - void hibernate(); - -protected: - // Helper functions for managing the LRU list of QGLPixmapData objects. - void moveToHeadOfLRU(QGLPixmapData *data); - void removeFromLRU(QGLPixmapData *data); - QGLPixmapData *pixmapLRU(); - -private: - QScopedPointer d_ptr; - - Q_DECLARE_PRIVATE(QGLTexturePool) - Q_DISABLE_COPY(QGLTexturePool) -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/opengl/qglwindowsurface_qws.cpp b/src/opengl/qglwindowsurface_qws.cpp deleted file mode 100644 index b3ad45185e3..00000000000 --- a/src/opengl/qglwindowsurface_qws.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include "private/qglwindowsurface_qws_p.h" -#include "private/qpaintengine_opengl_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QWSGLWindowSurface - \since 4.3 - \ingroup qws - \preliminary - - \brief The QWSGLWindowSurface class provides the drawing area for top-level - windows with Qt for Embedded Linux on EGL/OpenGL ES. It also provides the - drawing area for \l{QGLWidget}s whether they are top-level windows or - children of another QWidget. - - Note that this class is only available in Qt for Embedded Linux and only - available if Qt is configured with OpenGL support. -*/ - -class QWSGLWindowSurfacePrivate -{ -public: - QWSGLWindowSurfacePrivate() : - qglContext(0), ownsContext(false) {} - - QGLContext *qglContext; - bool ownsContext; -}; - -/*! - Constructs an empty QWSGLWindowSurface for the given top-level \a window. - The window surface is later initialized from chooseContext() and resources for it - is typically allocated in setGeometry(). -*/ -QWSGLWindowSurface::QWSGLWindowSurface(QWidget *window) - : QWSWindowSurface(window), - d_ptr(new QWSGLWindowSurfacePrivate) -{ -} - -/*! - Constructs an empty QWSGLWindowSurface. -*/ -QWSGLWindowSurface::QWSGLWindowSurface() - : d_ptr(new QWSGLWindowSurfacePrivate) -{ -} - -/*! - Destroys the QWSGLWindowSurface object and frees any - allocated resources. - */ -QWSGLWindowSurface::~QWSGLWindowSurface() -{ - Q_D(QWSGLWindowSurface); - if (d->ownsContext) - delete d->qglContext; - delete d; -} - -/*! - Returns the QGLContext of the window surface. -*/ -QGLContext *QWSGLWindowSurface::context() const -{ - Q_D(const QWSGLWindowSurface); - if (!d->qglContext) { - QWSGLWindowSurface *that = const_cast(this); - that->setContext(new QGLContext(QGLFormat::defaultFormat())); - that->d_func()->ownsContext = true; - } - return d->qglContext; -} - -/*! - Sets the QGLContext for this window surface to \a context. -*/ -void QWSGLWindowSurface::setContext(QGLContext *context) -{ - Q_D(QWSGLWindowSurface); - if (d->ownsContext) { - delete d->qglContext; - d->ownsContext = false; - } - d->qglContext = context; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglwindowsurface_qws_p.h b/src/opengl/qglwindowsurface_qws_p.h deleted file mode 100644 index 07362b1b884..00000000000 --- a/src/opengl/qglwindowsurface_qws_p.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGLWINDOWSURFACE_QWS_P_H -#define QGLWINDOWSURFACE_QWS_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 QWSGLWindowSurface class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include "private/qwindowsurface_qws_p.h" - -QT_BEGIN_NAMESPACE - -class QPaintDevice; -class QPoint; -class QRegion; -class QSize; -class QWidget; -class QGLContext; - -class QWSGLWindowSurfacePrivate; - -class Q_OPENGL_EXPORT QWSGLWindowSurface : public QWSWindowSurface -{ - Q_DECLARE_PRIVATE(QWSGLWindowSurface) - -public: - QWSGLWindowSurface(QWidget *widget); - QWSGLWindowSurface(); - ~QWSGLWindowSurface(); - - QGLContext *context() const; - void setContext(QGLContext *context); - -private: - QWSGLWindowSurfacePrivate *d_ptr; -}; - - -QT_END_NAMESPACE - -#endif // QGLWINDOWSURFACE_QWS_P_H diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp index c7a058e9ef0..c785fb29ada 100644 --- a/src/opengl/qgraphicsshadereffect.cpp +++ b/src/opengl/qgraphicsshadereffect.cpp @@ -40,14 +40,12 @@ ****************************************************************************/ #include "qgraphicsshadereffect_p.h" -#if !defined(QT_OPENGL_ES_1) #include "qglshaderprogram.h" #include "gl2paintengineex/qglcustomshaderstage_p.h" #define QGL_HAVE_CUSTOM_SHADERS 1 -#endif #include -#include -#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/opengl/qgraphicsshadereffect_p.h b/src/opengl/qgraphicsshadereffect_p.h index 12d716524ba..7ae5f53d7e4 100644 --- a/src/opengl/qgraphicsshadereffect_p.h +++ b/src/opengl/qgraphicsshadereffect_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include +#include QT_BEGIN_HEADER diff --git a/src/opengl/qgraphicssystem_gl.cpp b/src/opengl/qgraphicssystem_gl.cpp deleted file mode 100644 index 01a2864ecc6..00000000000 --- a/src/opengl/qgraphicssystem_gl.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_gl_p.h" -#include - -#include "private/qpixmap_raster_p.h" -#include "private/qpixmapdata_gl_p.h" -#include "private/qwindowsurface_gl_p.h" -#include "private/qgl_p.h" -#include - -#if defined(Q_WS_X11) && !defined(QT_NO_EGL) -#include "private/qpixmapdata_x11gl_p.h" -#include "private/qwindowsurface_x11gl_p.h" -#endif - -#if defined(Q_OS_SYMBIAN) -#include -#endif - -#ifdef QGL_USE_TEXTURE_POOL -#include "private/qgltexturepool_p.h" -#endif - -QT_BEGIN_NAMESPACE - -extern QGLWidget *qt_gl_getShareWidget(); - -QPixmapData *QGLGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QGLPixmapData(type); -} - -QWindowSurface *QGLGraphicsSystem::createWindowSurface(QWidget *widget) const -{ -#ifdef Q_WS_WIN - // On Windows the QGLWindowSurface class can't handle - // drop shadows and native effects, e.g. fading a menu in/out using - // top level window opacity. - if (widget->windowType() == Qt::Popup) - return new QRasterWindowSurface(widget); -#endif - -#if defined(Q_WS_X11) && !defined(QT_NO_EGL) - if (m_useX11GL && QX11GLPixmapData::hasX11GLPixmaps()) { - // If the widget is a QGraphicsView which will be re-drawing the entire - // scene each frame anyway, we should use QGLWindowSurface as this may - // provide proper buffer flipping, which should be faster than QX11GL's - // blitting approach: - QGraphicsView* qgv = qobject_cast(widget); - if (qgv && qgv->viewportUpdateMode() == QGraphicsView::FullViewportUpdate) - return new QGLWindowSurface(widget); - else - return new QX11GLWindowSurface(widget); - } -#endif - -#if defined(Q_OS_SYMBIAN) - if (!QApplicationPrivate::instance()->useTranslucentEGLSurfaces) { - QWidgetPrivate *d = qt_widget_private(widget); - if (!d->isOpaque && widget->testAttribute(Qt::WA_TranslucentBackground)) - return d->createDefaultWindowSurface_sys(); - } -#endif - - return new QGLWindowSurface(widget); -} -#ifdef QGL_USE_TEXTURE_POOL -void QGLGraphicsSystem::releaseCachedResources() -{ - QGLTexturePool::instance()->hibernate(); -} -#endif -QT_END_NAMESPACE - diff --git a/src/opengl/qgraphicssystem_gl_p.h b/src/opengl/qgraphicssystem_gl_p.h deleted file mode 100644 index 6e8e9a8966f..00000000000 --- a/src/opengl/qgraphicssystem_gl_p.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_RASTER_P_H -#define QGRAPHICSSYSTEM_RASTER_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" - -#include - -QT_BEGIN_NAMESPACE - -class Q_OPENGL_EXPORT QGLGraphicsSystem : public QGraphicsSystem -{ -public: - QGLGraphicsSystem(bool useX11GL); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; - -#ifdef QGL_USE_TEXTURE_POOL - void releaseCachedResources(); -#endif -private: - bool m_useX11GL; -}; - -QT_END_NAMESPACE - -#endif - diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp deleted file mode 100644 index 56a6af1cfef..00000000000 --- a/src/opengl/qpaintengine_opengl.cpp +++ /dev/null @@ -1,5635 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "qapplication.h" -#include "qbrush.h" -#include "qgl.h" -#include -#include -#include -#include "qmap.h" -#include -#include -#include "qpen.h" -#include "qvarlengtharray.h" -#include -#include -#include -#include -#include - -#include "private/qtessellator_p.h" - -#include "util/fragmentprograms_p.h" - -#ifdef Q_WS_QWS -#include "private/qglwindowsurface_qws_p.h" -#include "qwsmanager_qws.h" -#include "private/qwsmanager_p.h" -#endif - -#define QGL_FUNC_CONTEXT QGLContext *ctx = const_cast(device->context()); - -#include -#include "qpaintengine_opengl_p.h" - -QT_BEGIN_NAMESPACE - -Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert); //in qbrush.cpp -#ifdef QT_MAC_USE_COCOA -extern void *qt_current_nsopengl_context(); // qgl_mac.mm -#endif - -#define QREAL_MAX 9e100 -#define QREAL_MIN -9e100 - -extern int qt_next_power_of_two(int v); - -#define DISABLE_DEBUG_ONCE - -//#define DEBUG_DISPLAY_MASK_TEXTURE - -#ifdef DISABLE_DEBUG_ONCE -#define DEBUG_OVERRIDE(state) ; -#define DEBUG_ONCE_STR(str) ; -#define DEBUG_ONCE if (0) -#else -static int DEBUG_OVERRIDE_FLAG = 0; -static bool DEBUG_TEMP_FLAG; -#define DEBUG_OVERRIDE(state) { state ? ++DEBUG_OVERRIDE_FLAG : --DEBUG_OVERRIDE_FLAG; } -#define DEBUG_ONCE if ((DEBUG_TEMP_FLAG = DEBUG_OVERRIDE_FLAG) && 0) ; else for (static int DEBUG_ONCE_FLAG = false; !DEBUG_ONCE_FLAG || DEBUG_TEMP_FLAG; DEBUG_ONCE_FLAG = true, DEBUG_TEMP_FLAG = false) -#define DEBUG_ONCE_STR(str) DEBUG_ONCE qDebug() << (str); -#endif - -#ifdef Q_WS_X11 -static bool qt_nvidiaFboNeedsFinish = false; -#endif - -static inline void qt_glColor4ubv(unsigned char *col) -{ - glColor4f(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, col[3]/255.0f); -} - -struct QT_PointF { - qreal x; - qreal y; -}; - -struct QGLTrapezoid -{ - QGLTrapezoid() - {} - - QGLTrapezoid(qreal top_, qreal bottom_, qreal topLeftX_, qreal topRightX_, qreal bottomLeftX_, qreal bottomRightX_) - : top(top_), - bottom(bottom_), - topLeftX(topLeftX_), - topRightX(topRightX_), - bottomLeftX(bottomLeftX_), - bottomRightX(bottomRightX_) - {} - - const QGLTrapezoid translated(const QPointF &delta) const; - - qreal top; - qreal bottom; - qreal topLeftX; - qreal topRightX; - qreal bottomLeftX; - qreal bottomRightX; -}; - -const QGLTrapezoid QGLTrapezoid::translated(const QPointF &delta) const -{ - QGLTrapezoid trap(*this); - trap.top += delta.y(); - trap.bottom += delta.y(); - trap.topLeftX += delta.x(); - trap.topRightX += delta.x(); - trap.bottomLeftX += delta.x(); - trap.bottomRightX += delta.x(); - return trap; -} - - -class QOpenGLImmediateModeTessellator; -class QGLMaskGenerator; -class QGLOffscreen; - -class QGLMaskTextureCache -{ -public: - void setOffscreenSize(const QSize &offscreenSize); - void setDrawableSize(const QSize &drawableSize); - - struct CacheLocation { - QRect rect; - int channel; - - QRect screen_rect; - }; - - struct CacheInfo { - inline CacheInfo(const QPainterPath &p, const QTransform &m, qreal w = -1) : - path(p), matrix(m), stroke_width(w), age(0) {} - - QPainterPath path; - QTransform matrix; - qreal stroke_width; - - CacheLocation loc; - - int age; - }; - - struct QuadTreeNode { - quint64 key; - - int largest_available_block; - int largest_used_block; - }; - - CacheLocation getMask(QGLMaskGenerator &maskGenerator, QOpenGLPaintEnginePrivate *engine); - - typedef QMultiHash QGLTextureCacheHash; - - enum {block_size = 64}; - - // throw out keys that are too old - void maintainCache(); - void clearCache(); - -private: - quint64 hash(const QPainterPath &p, const QTransform &m, qreal w); - - void createMask(quint64 key, CacheInfo &info, QGLMaskGenerator &maskGenerator); - - QSize offscreenSize; - QSize drawableSize; - - QGLTextureCacheHash cache; - - QVector occupied_quadtree[4]; - - void quadtreeUpdate(int channel, int node, int current_block_size); - void quadtreeAllocate(quint64 key, const QSize &size, QRect *rect, int *channel); - - bool quadtreeFindAvailableLocation(const QSize &size, QRect *rect, int *channel); - void quadtreeFindExistingLocation(const QSize &size, QRect *rect, int *channel); - - void quadtreeInsert(int channel, quint64 key, const QRect &rect, int node = 0); - void quadtreeClear(int channel, const QRect &rect, int node = 0); - - int quadtreeBlocksize(int node); - QPoint quadtreeLocation(int node); - - QOpenGLPaintEnginePrivate *engine; -}; - -Q_GLOBAL_STATIC(QGLMaskTextureCache, qt_mask_texture_cache) - -class QGLOffscreen : public QObject -{ - Q_OBJECT -public: - QGLOffscreen() - : QObject(), - offscreen(0), - ctx(0), - mask_dim(0), - activated(false), - bound(false) - { - connect(QGLSignalProxy::instance(), - SIGNAL(aboutToDestroyContext(const QGLContext*)), - SLOT(cleanupGLContextRefs(const QGLContext*))); - } - - inline void setDevice(QPaintDevice *pdev); - - void begin(); - void end(); - - inline void bind(); - inline void release(); - - inline bool isBound() const; - - inline QSize drawableSize() const; - inline QSize offscreenSize() const; - - inline GLuint offscreenTexture() const; - - QGLContext *context() const; - - static bool isSupported(); - - inline void initialize(); - - inline bool isValid() const; - -public Q_SLOTS: - void cleanupGLContextRefs(const QGLContext *context) { - if (context == ctx) { - delete offscreen; - ctx = 0; - offscreen = 0; - mask_dim = 0; - } - } - -private: - QGLPaintDevice* device; - - QGLFramebufferObject *offscreen; - QGLContext *ctx; - - // dimensions of mask texture (square) - int mask_dim; - QSize last_failed_size; - - bool drawable_fbo; - - bool activated; - bool initialized; - - bool bound; -}; - -inline void QGLOffscreen::setDevice(QPaintDevice *pdev) -{ - if (pdev->devType() == QInternal::OpenGL) - device = static_cast(pdev); - else - device = QGLPaintDevice::getDevice(pdev); - - if (!device) - return; - - drawable_fbo = (pdev->devType() == QInternal::FramebufferObject); -} - -void QGLOffscreen::begin() -{ -#ifndef QT_OPENGL_ES - initialized = false; - - if (activated) - initialize(); -#endif -} - -void QGLOffscreen::initialize() -{ -#ifndef QT_OPENGL_ES - if (initialized) - return; - - activated = true; - initialized = true; - - int dim = qMax(2048, static_cast(qt_next_power_of_two(qMax(device->size().width(), device->size().height())))); - - bool shared_context = QGLContext::areSharing(device->context(), ctx); - bool would_fail = last_failed_size.isValid() && - (device->size().width() >= last_failed_size.width() || - device->size().height() >= last_failed_size.height()); - bool needs_refresh = dim > mask_dim || !shared_context; - - if (needs_refresh && !would_fail) { - DEBUG_ONCE qDebug() << "QGLOffscreen::initialize(): creating offscreen of size" << dim; - delete offscreen; - offscreen = new QGLFramebufferObject(dim, dim, GLenum(GL_TEXTURE_2D)); - mask_dim = dim; - - if (!offscreen->isValid()) { - qWarning("QGLOffscreen: Invalid offscreen fbo (size %dx%d)", mask_dim, mask_dim); - delete offscreen; - offscreen = 0; - mask_dim = 0; - last_failed_size = device->size(); - } - } - - qt_mask_texture_cache()->setOffscreenSize(offscreenSize()); - qt_mask_texture_cache()->setDrawableSize(device->size()); - ctx = device->context(); -#endif -} - -inline bool QGLOffscreen::isValid() const -{ - return offscreen; -} - -void QGLOffscreen::end() -{ - if (bound) - release(); -#ifdef DEBUG_DISPLAY_MASK_TEXTURE - glReadBuffer(GL_BACK); - glDrawBuffer(GL_BACK); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glColor4f(1, 1, 1, 1); - glDisable(GL_DEPTH_TEST); - glBlendFunc(GL_ONE, GL_ZERO); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, offscreen->texture()); - - glBegin(GL_QUADS); - glTexCoord2f(0.0, 1.0); glVertex2f(0.0, 0.0); - glTexCoord2f(1.0, 1.0); glVertex2f(drawable.size().width(), 0.0); - glTexCoord2f(1.0, 0.0); glVertex2f(drawable.size().width(), drawable.size().height()); - glTexCoord2f(0.0, 0.0); glVertex2f(0.0, drawable.size().height()); - glEnd(); - - glBindTexture(GL_TEXTURE_2D, 0); - glDisable(GL_TEXTURE_2D); -#endif -} - -inline void QGLOffscreen::bind() -{ -#ifndef QT_OPENGL_ES - Q_ASSERT(initialized); - - if (!offscreen || bound) - return; - - DEBUG_ONCE qDebug() << "QGLOffscreen: binding offscreen"; - offscreen->bind(); - - bound = true; - - glViewport(0, 0, offscreenSize().width(), offscreenSize().height()); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, offscreenSize().width(), offscreenSize().height(), 0, -999999, 999999); - glMatrixMode(GL_MODELVIEW); -#endif -} - -inline void QGLOffscreen::release() -{ -#ifndef QT_OPENGL_ES - if (!offscreen || !bound) - return; - -#ifdef Q_WS_X11 - // workaround for bug in nvidia driver versions 9x.xx - if (qt_nvidiaFboNeedsFinish) - glFinish(); -#endif - - DEBUG_ONCE_STR("QGLOffscreen: releasing offscreen"); - - if (drawable_fbo) - device->ensureActiveTarget(); //### - else - offscreen->release(); - - QSize sz(device->size()); - glViewport(0, 0, sz.width(), sz.height()); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -#ifndef QT_OPENGL_ES - glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999); -#else - glOrthof(0, sz.width(), sz.height(), 0, -999999, 999999); -#endif - glMatrixMode(GL_MODELVIEW); - - bound = false; -#endif -} - -inline bool QGLOffscreen::isBound() const -{ - return bound; -} - -inline QSize QGLOffscreen::drawableSize() const -{ - return device->size(); -} - -inline QSize QGLOffscreen::offscreenSize() const -{ - return QSize(mask_dim, mask_dim); -} - -inline GLuint QGLOffscreen::offscreenTexture() const -{ - return offscreen ? offscreen->texture() : 0; -} - -inline QGLContext *QGLOffscreen::context() const -{ - return ctx; -} - -bool QGLOffscreen::isSupported() -{ - return (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject); // for fbo -} - -struct QDrawQueueItem -{ - QDrawQueueItem(qreal _opacity, - QBrush _brush, - const QPointF &_brush_origion, - QPainter::CompositionMode _composition_mode, - const QTransform &_matrix, - QGLMaskTextureCache::CacheLocation _location) - : opacity(_opacity), - brush(_brush), - brush_origin(_brush_origion), - composition_mode(_composition_mode), - matrix(_matrix), - location(_location) {} - qreal opacity; - QBrush brush; - QPointF brush_origin; - QPainter::CompositionMode composition_mode; - - QTransform matrix; - QGLMaskTextureCache::CacheLocation location; -}; - -////////// GL program cache: start - -struct GLProgram { - int brush; // brush index or mask index - int mode; // composition mode index - bool mask; - GLuint program; -}; - -typedef QMultiHash QGLProgramHash; - -class QGLProgramCache : public QObject -{ - Q_OBJECT -public: - QGLProgramCache() { - // we have to know when a context is deleted so we can free - // any program handles it holds - connect(QGLSignalProxy::instance(), SIGNAL(aboutToDestroyContext(const QGLContext*)), - SLOT(cleanupPrograms(const QGLContext*))); - - } - ~QGLProgramCache() { - // at this point the cache should contain 0 elements - // Q_ASSERT(program.size() == 0); - } - - GLuint getProgram(const QGLContext *ctx, int brush, int mode, bool mask_mode) - { - // 1. see if we have an entry for the ctx context - QList progs = programs.values(ctx); - for (int i=0; i contexts = programs.uniqueKeys(); - for (int i=0; i progs = programs.values(cx); - for (int k=0; k(src); - - while (glGetError() != GL_NO_ERROR) {} // reset error state - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - int(strlen(src)), gl_src); - if (glGetError() != GL_NO_ERROR) { -// qDebug() << "QGLProgramCache: Unable to compile fragment program."; - glDeleteProgramsARB(1, &prg.program); - return 0; - } - -// qDebug() << "QGLProgramCache: Creating GL program:" << prg.program << hex << ctx; - programs.insert(ctx, prg); - return prg.program; - } - -public Q_SLOTS: - void cleanupPrograms(const QGLContext *context) - { - QGLProgramHash::iterator it = programs.begin(); - while (it != programs.end()) { - if (it.key() == context) { - if (!context->isSharing()) { - // the ctx variable below is needed for the glDeleteProgramARB call - // since it is resolved from our extension system - // NB! assumes context is the current GL context - const QGLContext *ctx = context; - // qDebug() << "QGLProgramHash: Deleting GL program:" << it.value().program << hex << it.key(); - glDeleteProgramsARB(1, &it.value().program); - } - it = programs.erase(it); - } else { - ++it; - } - } - } - -private: - QGLProgramHash programs; -}; - -Q_GLOBAL_STATIC(QGLProgramCache, qt_gl_program_cache) - -////////// GL program cache: end - -class QOpenGLPaintEnginePrivate; -class QGLPrivateCleanup : public QObject -{ - Q_OBJECT -public: - QGLPrivateCleanup(QOpenGLPaintEnginePrivate *priv) - : p(priv) - { - connect(QGLSignalProxy::instance(), - SIGNAL(aboutToDestroyContext(const QGLContext*)), - SLOT(cleanupGLContextRefs(const QGLContext*))); - } - -public Q_SLOTS: - void cleanupGLContextRefs(const QGLContext *context); - -private: - QOpenGLPaintEnginePrivate *p; -}; - -class QOpenGLPaintEnginePrivate : public QPaintEngineExPrivate -{ - Q_DECLARE_PUBLIC(QOpenGLPaintEngine) -public: - QOpenGLPaintEnginePrivate() - : opacity(1) - , composition_mode(QPainter::CompositionMode_SourceOver) - , has_fast_pen(false) - , use_stencil_method(false) - , dirty_drawable_texture(false) - , has_stencil_face_ext(false) - , use_fragment_programs(false) - , high_quality_antialiasing(false) - , use_smooth_pixmap_transform(false) - , use_emulation(false) - , txop(QTransform::TxNone) - , inverseScale(1) - , moveToCount(0) - , last_created_state(0) - , shader_ctx(0) - , grad_palette(0) - , tess_points(0) - , drawable_texture(0) - , ref_cleaner(this) - {} - - inline void setGLPen(const QColor &c) { - uint alpha = qRound(c.alpha() * opacity); - pen_color[0] = qt_div_255(c.red() * alpha); - pen_color[1] = qt_div_255(c.green() * alpha); - pen_color[2] = qt_div_255(c.blue() * alpha); - pen_color[3] = alpha; - } - - inline void setGLBrush(const QColor &c) { - uint alpha = qRound(c.alpha() * opacity); - brush_color[0] = qt_div_255(c.red() * alpha); - brush_color[1] = qt_div_255(c.green() * alpha); - brush_color[2] = qt_div_255(c.blue() * alpha); - brush_color[3] = alpha; - } - - inline void setGradientOps(const QBrush &brush, const QRectF &bounds); - void createGradientPaletteTexture(const QGradient& g); - - void updateGradient(const QBrush &brush, const QRectF &bounds); - - inline void lineToStencil(qreal x, qreal y); - inline void curveToStencil(const QPointF &cp1, const QPointF &cp2, const QPointF &ep); - void pathToVertexArrays(const QPainterPath &path); - void fillVertexArray(Qt::FillRule fillRule); - void drawVertexArrays(); - void fillPath(const QPainterPath &path); - void fillPolygon_dev(const QPointF *polygonPoints, int pointCount, - Qt::FillRule fill); - - void drawFastRect(const QRectF &rect); - void strokePath(const QPainterPath &path, bool use_cache); - void strokePathFastPen(const QPainterPath &path, bool needsResolving); - void strokeLines(const QPainterPath &path); - - void updateDepthClip(); - void systemStateChanged(); - - void cleanupGLContextRefs(const QGLContext *context) { - if (context == shader_ctx) - shader_ctx = 0; - } - - inline void updateFastPen() { - qreal pen_width = cpen.widthF(); - has_fast_pen = - ((pen_width == 0 || (pen_width <= 1 && matrix.type() <= QTransform::TxTranslate)) - || cpen.isCosmetic()) - && cpen.style() == Qt::SolidLine - && cpen.isSolid(); - - } - - void disableClipping(); - void enableClipping(); - void ensureDrawableTexture(); - - QPen cpen; - QBrush cbrush; - Qt::BrushStyle brush_style; - QPointF brush_origin; - Qt::BrushStyle pen_brush_style; - qreal opacity; - QPainter::CompositionMode composition_mode; - - Qt::BrushStyle current_style; - - uint has_pen : 1; - uint has_brush : 1; - uint has_fast_pen : 1; - uint use_stencil_method : 1; - uint dirty_drawable_texture : 1; - uint has_stencil_face_ext : 1; - uint use_fragment_programs : 1; - uint high_quality_antialiasing : 1; - uint has_antialiasing : 1; - uint has_fast_composition_mode : 1; - uint use_smooth_pixmap_transform : 1; - uint use_system_clip : 1; - uint use_emulation : 1; - - QRegion dirty_stencil; - - void updateUseEmulation(); - - QTransform matrix; - GLubyte pen_color[4]; - GLubyte brush_color[4]; - QTransform::TransformationType txop; - QGLPaintDevice* device; - QGLOffscreen offscreen; - - qreal inverseScale; - - int moveToCount; - QPointF path_start; - - bool isFastRect(const QRectF &r); - - void drawImageAsPath(const QRectF &r, const QImage &img, const QRectF &sr); - void drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy, const QPointF &offset); - - void drawOffscreenPath(const QPainterPath &path); - - void composite(const QRectF &rect, const QPoint &maskOffset = QPoint()); - void composite(GLuint primitive, const GLfloat *vertexArray, int vertexCount, const QPoint &maskOffset = QPoint()); - - bool createFragmentPrograms(); - void deleteFragmentPrograms(); - void updateFragmentProgramData(int locations[]); - - void cacheItemErased(int channel, const QRect &rect); - - void addItem(const QGLMaskTextureCache::CacheLocation &location); - void drawItem(const QDrawQueueItem &item); - void flushDrawQueue(); - - void copyDrawable(const QRectF &rect); - - void updateGLMatrix() const; - - mutable QPainterState *last_created_state; - - QGLContext *shader_ctx; - GLuint grad_palette; - - GLuint painter_fragment_programs[num_fragment_brushes][num_fragment_composition_modes]; - GLuint mask_fragment_programs[num_fragment_masks]; - - float inv_matrix_data[3][4]; - float fmp_data[4]; - float fmp2_m_radius2_data[4]; - float angle_data[4]; - float linear_data[4]; - - float porterduff_ab_data[4]; - float porterduff_xyz_data[4]; - - float mask_offset_data[4]; - float mask_channel_data[4]; - - FragmentBrushType fragment_brush; - FragmentCompositionModeType fragment_composition_mode; - - void setPorterDuffData(float a, float b, float x, float y, float z); - void setInvMatrixData(const QTransform &inv_matrix); - - qreal max_x; - qreal max_y; - qreal min_x; - qreal min_y; - - QDataBuffer tess_points; - QVector tess_points_stops; - - GLdouble projection_matrix[4][4]; - -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) - GLfloat mv_matrix[4][4]; -#else - GLdouble mv_matrix[4][4]; -#endif - - QList drawQueue; - - GLuint drawable_texture; - QSize drawable_texture_size; - - int max_texture_size; - - QGLPrivateCleanup ref_cleaner; - friend class QGLMaskTextureCache; -}; - -class QOpenGLCoordinateOffset -{ -public: - QOpenGLCoordinateOffset(QOpenGLPaintEnginePrivate *d); - ~QOpenGLCoordinateOffset(); - - static void enableOffset(QOpenGLPaintEnginePrivate *d); - static void disableOffset(QOpenGLPaintEnginePrivate *d); - -private: - QOpenGLPaintEnginePrivate *d; -}; - -QOpenGLCoordinateOffset::QOpenGLCoordinateOffset(QOpenGLPaintEnginePrivate *d_) - : d(d_) -{ - enableOffset(d); -} - -void QOpenGLCoordinateOffset::enableOffset(QOpenGLPaintEnginePrivate *d) -{ - if (!d->has_antialiasing) { - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - d->mv_matrix[3][0] += 0.5; - d->mv_matrix[3][1] += 0.5; - d->updateGLMatrix(); - } -} - -QOpenGLCoordinateOffset::~QOpenGLCoordinateOffset() -{ - disableOffset(d); -} - -void QOpenGLCoordinateOffset::disableOffset(QOpenGLPaintEnginePrivate *d) -{ - if (!d->has_antialiasing) { - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - d->mv_matrix[3][0] -= 0.5; - d->mv_matrix[3][1] -= 0.5; - } -} - -void QGLPrivateCleanup::cleanupGLContextRefs(const QGLContext *context) -{ - p->cleanupGLContextRefs(context); -} - - -static inline void updateTextureFilter(GLenum target, GLenum wrapMode, bool smoothPixmapTransform) -{ - if (smoothPixmapTransform) { - glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - } else { - glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - glTexParameterf(target, GL_TEXTURE_WRAP_S, wrapMode); - glTexParameterf(target, GL_TEXTURE_WRAP_T, wrapMode); -} - -static inline QPainterPath strokeForPath(const QPainterPath &path, const QPen &cpen) { - QPainterPathStroker stroker; - if (cpen.style() == Qt::CustomDashLine) - stroker.setDashPattern(cpen.dashPattern()); - else - stroker.setDashPattern(cpen.style()); - - stroker.setCapStyle(cpen.capStyle()); - stroker.setJoinStyle(cpen.joinStyle()); - stroker.setMiterLimit(cpen.miterLimit()); - stroker.setDashOffset(cpen.dashOffset()); - - qreal width = cpen.widthF(); - if (width == 0) - stroker.setWidth(1); - else - stroker.setWidth(width); - - QPainterPath stroke = stroker.createStroke(path); - stroke.setFillRule(Qt::WindingFill); - return stroke; -} - -class QGLStrokeCache -{ - struct CacheInfo - { - inline CacheInfo(QPainterPath p, QPainterPath sp, QPen stroke_pen) : - path(p), stroked_path(sp), pen(stroke_pen) {} - QPainterPath path; - QPainterPath stroked_path; - QPen pen; - }; - - typedef QMultiHash QGLStrokeTableHash; - -public: - inline QPainterPath getStrokedPath(const QPainterPath &path, const QPen &pen) { - quint64 hash_val = 0; - - for (int i = 0; i < path.elementCount() && i <= 2; i++) { - hash_val += quint64(path.elementAt(i).x); - hash_val += quint64(path.elementAt(i).y); - } - - QGLStrokeTableHash::const_iterator it = cache.constFind(hash_val); - - if (it == cache.constEnd()) - return addCacheElement(hash_val, path, pen); - else { - do { - const CacheInfo &cache_info = it.value(); - if (cache_info.path == path && cache_info.pen == pen) - return cache_info.stroked_path; - ++it; - } while (it != cache.constEnd() && it.key() == hash_val); - // an exact match for this path was not found, create new cache element - return addCacheElement(hash_val, path, pen); - } - } - -protected: - inline int maxCacheSize() const { return 500; } - QPainterPath addCacheElement(quint64 hash_val, QPainterPath path, const QPen &pen) { - if (cache.size() == maxCacheSize()) { - int elem_to_remove = qrand() % maxCacheSize(); - cache.remove(cache.keys()[elem_to_remove]); // may remove more than 1, but OK - } - QPainterPath stroke = strokeForPath(path, pen); - CacheInfo cache_entry(path, stroke, pen); - return cache.insert(hash_val, cache_entry).value().stroked_path; - } - - QGLStrokeTableHash cache; -}; - -Q_GLOBAL_STATIC(QGLStrokeCache, qt_opengl_stroke_cache) - -class QGLGradientCache : public QObject -{ - Q_OBJECT - struct CacheInfo - { - inline CacheInfo(QGradientStops s, qreal op, QGradient::InterpolationMode mode) : - stops(s), opacity(op), interpolationMode(mode) {} - - GLuint texId; - QGradientStops stops; - qreal opacity; - QGradient::InterpolationMode interpolationMode; - }; - - typedef QMultiHash QGLGradientColorTableHash; - -public: - QGLGradientCache() : QObject(), buffer_ctx(0) - { - connect(QGLSignalProxy::instance(), - SIGNAL(aboutToDestroyContext(const QGLContext*)), - SLOT(cleanupGLContextRefs(const QGLContext*))); - } - - inline GLuint getBuffer(const QGradient &gradient, qreal opacity, QGLContext *ctx) { - if (buffer_ctx && !QGLContext::areSharing(buffer_ctx, ctx)) - cleanCache(); - - buffer_ctx = ctx; - - quint64 hash_val = 0; - - QGradientStops stops = gradient.stops(); - for (int i = 0; i < stops.size() && i <= 2; i++) - hash_val += stops[i].second.rgba(); - - QGLGradientColorTableHash::const_iterator it = cache.constFind(hash_val); - - if (it == cache.constEnd()) - return addCacheElement(hash_val, gradient, opacity); - else { - do { - const CacheInfo &cache_info = it.value(); - if (cache_info.stops == stops && cache_info.opacity == opacity && cache_info.interpolationMode == gradient.interpolationMode()) { - return cache_info.texId; - } - ++it; - } while (it != cache.constEnd() && it.key() == hash_val); - // an exact match for these stops and opacity was not found, create new cache - return addCacheElement(hash_val, gradient, opacity); - } - } - - inline int paletteSize() const { return 1024; } - -protected: - inline int maxCacheSize() const { return 60; } - inline void generateGradientColorTable(const QGradient& g, - uint *colorTable, - int size, qreal opacity) const; - GLuint addCacheElement(quint64 hash_val, const QGradient &gradient, qreal opacity) { - if (cache.size() == maxCacheSize()) { - int elem_to_remove = qrand() % maxCacheSize(); - quint64 key = cache.keys()[elem_to_remove]; - - // need to call glDeleteTextures on each removed cache entry: - QGLGradientColorTableHash::const_iterator it = cache.constFind(key); - do { - glDeleteTextures(1, &it.value().texId); - } while (++it != cache.constEnd() && it.key() == key); - cache.remove(key); // may remove more than 1, but OK - } - CacheInfo cache_entry(gradient.stops(), opacity, gradient.interpolationMode()); - uint buffer[1024]; - generateGradientColorTable(gradient, buffer, paletteSize(), opacity); - glGenTextures(1, &cache_entry.texId); -#ifndef QT_OPENGL_ES - glBindTexture(GL_TEXTURE_1D, cache_entry.texId); - glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, paletteSize(), - 0, GL_BGRA, GL_UNSIGNED_BYTE, buffer); -#else - // create 2D one-line texture instead. This requires an impl of manual GL_TEXGEN for all primitives -#endif - return cache.insert(hash_val, cache_entry).value().texId; - } - - void cleanCache() { - QGLShareContextScope scope(buffer_ctx); - QGLGradientColorTableHash::const_iterator it = cache.constBegin(); - for (; it != cache.constEnd(); ++it) { - const CacheInfo &cache_info = it.value(); - glDeleteTextures(1, &cache_info.texId); - } - cache.clear(); - } - - QGLGradientColorTableHash cache; - - QGLContext *buffer_ctx; - -public Q_SLOTS: - void cleanupGLContextRefs(const QGLContext *context) { - if (context == buffer_ctx) { - cleanCache(); - buffer_ctx = 0; - } - } -}; - -static inline uint endianColor(uint c) -{ -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - return c; -#else - return ( (c << 24) & 0xff000000) - | ((c >> 24) & 0x000000ff) - | ((c << 8) & 0x00ff0000) - | ((c >> 8) & 0x0000ff00); -#endif // Q_BYTE_ORDER -} - -void QGLGradientCache::generateGradientColorTable(const QGradient& gradient, uint *colorTable, int size, qreal opacity) const -{ - int pos = 0; - QGradientStops s = gradient.stops(); - QVector colors(s.size()); - - for (int i = 0; i < s.size(); ++i) - colors[i] = s[i].second.rgba(); - - bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation); - - uint alpha = qRound(opacity * 256); - uint current_color = ARGB_COMBINE_ALPHA(colors[0], alpha); - qreal incr = 1.0 / qreal(size); - qreal fpos = 1.5 * incr; - colorTable[pos++] = endianColor(PREMUL(current_color)); - - while (fpos <= s.first().first) { - colorTable[pos] = colorTable[pos - 1]; - pos++; - fpos += incr; - } - - if (colorInterpolation) - current_color = PREMUL(current_color); - - for (int i = 0; i < s.size() - 1; ++i) { - qreal delta = 1/(s[i+1].first - s[i].first); - uint next_color = ARGB_COMBINE_ALPHA(colors[i+1], alpha); - if (colorInterpolation) - next_color = PREMUL(next_color); - - while (fpos < s[i+1].first && pos < size) { - int dist = int(256 * ((fpos - s[i].first) * delta)); - int idist = 256 - dist; - if (colorInterpolation) - colorTable[pos] = endianColor(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)); - else - colorTable[pos] = endianColor(PREMUL(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist))); - ++pos; - fpos += incr; - } - current_color = next_color; - } - - Q_ASSERT(s.size() > 0); - - uint last_color = endianColor(PREMUL(ARGB_COMBINE_ALPHA(colors[s.size() - 1], alpha))); - for (;pos < size; ++pos) - colorTable[pos] = last_color; - - // Make sure the last color stop is represented at the end of the table - colorTable[size-1] = last_color; -} - -#ifndef Q_WS_QWS -Q_GLOBAL_STATIC(QGLGradientCache, qt_opengl_gradient_cache) -#endif - -void QOpenGLPaintEnginePrivate::createGradientPaletteTexture(const QGradient& g) -{ -#ifdef QT_OPENGL_ES //### - Q_UNUSED(g); -#else - GLuint texId = qt_opengl_gradient_cache()->getBuffer(g, opacity, device->context()); - glBindTexture(GL_TEXTURE_1D, texId); - grad_palette = texId; - if (g.spread() == QGradient::RepeatSpread || g.type() == QGradient::ConicalGradient) - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); - else if (g.spread() == QGradient::ReflectSpread) - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT_IBM); - else - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - -#endif -} - - -inline void QOpenGLPaintEnginePrivate::setGradientOps(const QBrush &brush, const QRectF &bounds) -{ - current_style = brush.style(); - - if (current_style < Qt::LinearGradientPattern || current_style > Qt::ConicalGradientPattern) { - setGLBrush(brush.color()); - qt_glColor4ubv(brush_color); - } - - updateGradient(brush, bounds); - -#ifndef QT_OPENGL_ES //### GLES does not have GL_TEXTURE_GEN_ so we are falling back for gradients - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_1D); - - if (current_style == Qt::LinearGradientPattern) { - if (high_quality_antialiasing || !has_fast_composition_mode) { - fragment_brush = FRAGMENT_PROGRAM_BRUSH_LINEAR; - } else { - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_1D); - } - } else { - if (use_fragment_programs) { - if (current_style == Qt::RadialGradientPattern) - fragment_brush = FRAGMENT_PROGRAM_BRUSH_RADIAL; - else if (current_style == Qt::ConicalGradientPattern) - fragment_brush = FRAGMENT_PROGRAM_BRUSH_CONICAL; - else if (current_style == Qt::SolidPattern) - fragment_brush = FRAGMENT_PROGRAM_BRUSH_SOLID; - else if (current_style == Qt::TexturePattern && !brush.texture().isQBitmap()) - fragment_brush = FRAGMENT_PROGRAM_BRUSH_TEXTURE; - else - fragment_brush = FRAGMENT_PROGRAM_BRUSH_PATTERN; - } - } -#endif -} - -QOpenGLPaintEngine::QOpenGLPaintEngine() - : QPaintEngineEx(*(new QOpenGLPaintEnginePrivate)) -{ -} - -QOpenGLPaintEngine::~QOpenGLPaintEngine() -{ -} - -bool QOpenGLPaintEngine::begin(QPaintDevice *pdev) -{ - Q_D(QOpenGLPaintEngine); - - if (pdev->devType() == QInternal::OpenGL) - d->device = static_cast(pdev); - else - d->device = QGLPaintDevice::getDevice(pdev); - - if (!d->device) - return false; - - d->offscreen.setDevice(pdev); - d->has_fast_pen = false; - d->inverseScale = 1; - d->opacity = 1; - d->device->beginPaint(); - d->matrix = QTransform(); - d->has_antialiasing = false; - d->high_quality_antialiasing = false; - - QSize sz(d->device->size()); - d->dirty_stencil = QRect(0, 0, sz.width(), sz.height()); - - d->use_emulation = false; - - for (int i = 0; i < 4; ++i) - for (int j = 0; j < 4; ++j) - d->mv_matrix[i][j] = (i == j ? qreal(1) : qreal(0)); - - bool has_frag_program = (QGLExtensions::glExtensions() & QGLExtensions::FragmentProgram) - && (pdev->devType() != QInternal::Pixmap); - - QGLContext *ctx = const_cast(d->device->context()); - if (!ctx) { - qWarning() << "QOpenGLPaintEngine: paint device doesn't have a valid GL context."; - return false; - } - - if (has_frag_program) - has_frag_program = qt_resolve_frag_program_extensions(ctx) && qt_resolve_version_1_3_functions(ctx); - - d->use_stencil_method = d->device->format().stencil() - && (QGLExtensions::glExtensions() & QGLExtensions::StencilWrap); - if (d->device->format().directRendering() - && (d->use_stencil_method && QGLExtensions::glExtensions() & QGLExtensions::StencilTwoSide)) - d->has_stencil_face_ext = qt_resolve_stencil_face_extension(ctx); - -#ifdef Q_WS_X11 - static bool nvidia_workaround_needs_init = true; - if (nvidia_workaround_needs_init) { - // nvidia 9x.xx unix drivers contain a bug which requires us to - // call glFinish before releasing an fbo to avoid painting - // artifacts - const QByteArray versionString(reinterpret_cast(glGetString(GL_VERSION))); - const int pos = versionString.indexOf("NVIDIA"); - if (pos >= 0) { - const float nvidiaDriverVersion = versionString.mid(pos + strlen("NVIDIA")).toFloat(); - qt_nvidiaFboNeedsFinish = nvidiaDriverVersion >= 90.0 && nvidiaDriverVersion < 100.0; - } - nvidia_workaround_needs_init = false; - } -#endif - -#ifndef QT_OPENGL_ES - if (!ctx->d_ptr->internal_context) { - glGetDoublev(GL_PROJECTION_MATRIX, &d->projection_matrix[0][0]); - glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS); - glPushAttrib(GL_ALL_ATTRIB_BITS); - - glDisableClientState(GL_EDGE_FLAG_ARRAY); - glDisableClientState(GL_INDEX_ARRAY); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glDisable(GL_TEXTURE_1D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glPixelTransferi(GL_MAP_COLOR, false); - glPixelTransferi(GL_MAP_STENCIL, false); - glDisable(GL_TEXTURE_GEN_S); - - glPixelStorei(GL_PACK_SWAP_BYTES, false); - glPixelStorei(GL_PACK_LSB_FIRST, false); - glPixelStorei(GL_PACK_ROW_LENGTH, 0); - glPixelStorei(GL_PACK_SKIP_ROWS, 0); - glPixelStorei(GL_PACK_SKIP_PIXELS, 0); - glPixelStorei(GL_PACK_ALIGNMENT, 4); - - glPixelStorei(GL_UNPACK_SWAP_BYTES, false); - glPixelStorei(GL_UNPACK_LSB_FIRST, false); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - - if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2) { - glPixelStorei(GL_PACK_IMAGE_HEIGHT, 0); - glPixelStorei(GL_PACK_SKIP_IMAGES, 0); - glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); - glPixelStorei(GL_UNPACK_SKIP_IMAGES, 0); - } - } -#endif - - if (!ctx->d_ptr->internal_context) { - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - glLoadIdentity(); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_VERTEX_ARRAY); - - if (QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers) - glDisable(GL_MULTISAMPLE); - glDisable(GL_TEXTURE_2D); - if (QGLExtensions::glExtensions() & QGLExtensions::TextureRectangle) - glDisable(GL_TEXTURE_RECTANGLE_NV); - glDisable(GL_STENCIL_TEST); - glDisable(GL_CULL_FACE); - glDisable(GL_LIGHTING); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - } - - d->offscreen.begin(); - - glViewport(0, 0, sz.width(), sz.height()); // XXX (Embedded): We need a solution for GLWidgets that draw in a part or a bigger surface... - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -#ifdef QT_OPENGL_ES - glOrthof(0, sz.width(), sz.height(), 0, -999999, 999999); -#else - glOrtho(0, sz.width(), sz.height(), 0, -999999, 999999); -#endif - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glEnable(GL_BLEND); - d->composition_mode = QPainter::CompositionMode_SourceOver; - -#ifdef QT_OPENGL_ES - d->max_texture_size = ctx->d_func()->maxTextureSize(); -#else - bool shared_ctx = QGLContext::areSharing(d->device->context(), d->shader_ctx); - - if (shared_ctx) { - d->max_texture_size = d->shader_ctx->d_func()->maxTextureSize(); - } else { - d->max_texture_size = ctx->d_func()->maxTextureSize(); - - if (d->shader_ctx) { - d->shader_ctx->makeCurrent(); - glBindTexture(GL_TEXTURE_1D, 0); - glDeleteTextures(1, &d->grad_palette); - - if (has_frag_program && d->use_fragment_programs) - glDeleteTextures(1, &d->drawable_texture); - ctx->makeCurrent(); - } - d->shader_ctx = d->device->context(); - glGenTextures(1, &d->grad_palette); - - qt_mask_texture_cache()->clearCache(); - d->use_fragment_programs = has_frag_program; - } - - if (d->use_fragment_programs && (!shared_ctx || sz.width() > d->drawable_texture_size.width() - || sz.height() > d->drawable_texture_size.height())) - { - // delete old texture if size has increased, otherwise it was deleted earlier - if (shared_ctx) - glDeleteTextures(1, &d->drawable_texture); - - d->dirty_drawable_texture = true; - d->drawable_texture_size = QSize(qt_next_power_of_two(sz.width()), - qt_next_power_of_two(sz.height())); - } -#endif - - updateClipRegion(QRegion(), Qt::NoClip); - penChanged(); - brushChanged(); - opacityChanged(); - compositionModeChanged(); - renderHintsChanged(); - transformChanged(); - return true; -} - -bool QOpenGLPaintEngine::end() -{ - Q_D(QOpenGLPaintEngine); - d->flushDrawQueue(); - d->offscreen.end(); - QGLContext *ctx = const_cast(d->device->context()); - if (!ctx->d_ptr->internal_context) { - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - } -#ifndef QT_OPENGL_ES - if (ctx->d_ptr->internal_context) { - glDisable(GL_SCISSOR_TEST); - } else { - glMatrixMode(GL_PROJECTION); - glLoadMatrixd(&d->projection_matrix[0][0]); - glPopAttrib(); - glPopClientAttrib(); - } -#endif - d->device->endPaint(); - qt_mask_texture_cache()->maintainCache(); - -#if defined(Q_WS_X11) - // clear out the references we hold for textures bound with the - // texture_from_pixmap extension - ctx->d_func()->boundPixmaps.clear(); -#endif - return true; -} - -void QOpenGLPaintEngine::updateState(const QPaintEngineState &state) -{ - Q_D(QOpenGLPaintEngine); - QPaintEngine::DirtyFlags flags = state.state(); - - bool update_fast_pen = false; - - if (flags & DirtyOpacity) { - update_fast_pen = true; - d->opacity = state.opacity(); - if (d->opacity > 1.0f) - d->opacity = 1.0f; - if (d->opacity < 0.f) - d->opacity = 0.f; - // force update - flags |= DirtyPen; - flags |= DirtyBrush; - } - - if (flags & DirtyTransform) { - update_fast_pen = true; - updateMatrix(state.transform()); - // brush setup depends on transform state - if (state.brush().style() != Qt::NoBrush) - flags |= DirtyBrush; - } - - if (flags & DirtyPen) { - update_fast_pen = true; - updatePen(state.pen()); - } - - if (flags & (DirtyBrush | DirtyBrushOrigin)) { - updateBrush(state.brush(), state.brushOrigin()); - } - - if (flags & DirtyFont) { - updateFont(state.font()); - } - - if (state.state() & DirtyClipEnabled) { - if (state.isClipEnabled()) - updateClipRegion(painter()->clipRegion(), Qt::ReplaceClip); - else - updateClipRegion(QRegion(), Qt::NoClip); - } - - if (flags & DirtyClipPath) { - updateClipRegion(QRegion(state.clipPath().toFillPolygon().toPolygon(), - state.clipPath().fillRule()), - state.clipOperation()); - } - - if (flags & DirtyClipRegion) { - updateClipRegion(state.clipRegion(), state.clipOperation()); - } - - if (flags & DirtyHints) { - updateRenderHints(state.renderHints()); - } - - if (flags & DirtyCompositionMode) { - updateCompositionMode(state.compositionMode()); - } - - if (update_fast_pen) { - Q_D(QOpenGLPaintEngine); - qreal pen_width = d->cpen.widthF(); - d->has_fast_pen = - ((pen_width == 0 || (pen_width <= 1 && d->txop <= QTransform::TxTranslate)) - || d->cpen.isCosmetic()) - && d->cpen.style() == Qt::SolidLine - && d->cpen.isSolid(); - } -} - - -void QOpenGLPaintEnginePrivate::setInvMatrixData(const QTransform &inv_matrix) -{ - inv_matrix_data[0][0] = inv_matrix.m11(); - inv_matrix_data[1][0] = inv_matrix.m21(); - inv_matrix_data[2][0] = inv_matrix.m31(); - - inv_matrix_data[0][1] = inv_matrix.m12(); - inv_matrix_data[1][1] = inv_matrix.m22(); - inv_matrix_data[2][1] = inv_matrix.m32(); - - inv_matrix_data[0][2] = inv_matrix.m13(); - inv_matrix_data[1][2] = inv_matrix.m23(); - inv_matrix_data[2][2] = inv_matrix.m33(); -} - - -void QOpenGLPaintEnginePrivate::updateGradient(const QBrush &brush, const QRectF &) -{ -#ifdef QT_OPENGL_ES - Q_UNUSED(brush); -#else - bool has_mirrored_repeat = QGLExtensions::glExtensions() & QGLExtensions::MirroredRepeat; - Qt::BrushStyle style = brush.style(); - - QTransform m = brush.transform(); - - if (has_mirrored_repeat && style == Qt::LinearGradientPattern) { - const QLinearGradient *g = static_cast(brush.gradient()); - QTransform m = brush.transform(); - QPointF realStart = g->start(); - QPointF realFinal = g->finalStop(); - QPointF start = m.map(realStart); - QPointF stop; - - if (qFuzzyCompare(m.m11(), m.m22()) && m.m12() == 0.0 && m.m21() == 0.0) { - // It is a simple uniform scale and/or translation - stop = m.map(realFinal); - } else { - // It is not enough to just transform the endpoints. - // We have to make sure the _pattern_ is transformed correctly. - - qreal odx = realFinal.x() - realStart.x(); - qreal ody = realFinal.y() - realStart.y(); - - // nx, ny and dx, dy are normal and gradient direction after transform: - qreal nx = m.m11()*ody - m.m21()*odx; - qreal ny = m.m12()*ody - m.m22()*odx; - - qreal dx = m.m11()*odx + m.m21()*ody; - qreal dy = m.m12()*odx + m.m22()*ody; - - qreal lx = 1 / (dx - dy*nx/ny); - qreal ly = 1 / (dy - dx*ny/nx); - qreal l = 1 / qSqrt(lx*lx+ly*ly); - - stop = start + QPointF(-ny, nx) * l/qSqrt(nx*nx+ny*ny); - } - - float tr[4], f; - tr[0] = stop.x() - start.x(); - tr[1] = stop.y() - start.y(); - f = 1.0 / (tr[0]*tr[0] + tr[1]*tr[1]); - tr[0] *= f; - tr[1] *= f; - tr[2] = 0; - tr[3] = -(start.x()*tr[0] + start.y()*tr[1]); - brush_color[0] = brush_color[1] = brush_color[2] = brush_color[3] = 255; - qt_glColor4ubv(brush_color); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenfv(GL_S, GL_OBJECT_PLANE, tr); - } - - if (use_fragment_programs) { - if (style == Qt::RadialGradientPattern) { - const QRadialGradient *g = static_cast(brush.gradient()); - QPointF realCenter = g->center(); - QPointF realFocal = g->focalPoint(); - qreal realRadius = g->radius(); - QTransform translate(1, 0, 0, 1, -realFocal.x(), -realFocal.y()); - QTransform gl_to_qt(1, 0, 0, -1, 0, pdev->height()); - QTransform m = QTransform(matrix).translate(brush_origin.x(), brush_origin.y()); - QTransform inv_matrix = gl_to_qt * (brush.transform() * m).inverted() * translate; - - setInvMatrixData(inv_matrix); - - fmp_data[0] = realCenter.x() - realFocal.x(); - fmp_data[1] = realCenter.y() - realFocal.y(); - - fmp2_m_radius2_data[0] = -fmp_data[0] * fmp_data[0] - fmp_data[1] * fmp_data[1] + realRadius * realRadius; - } else if (style == Qt::ConicalGradientPattern) { - const QConicalGradient *g = static_cast(brush.gradient()); - QPointF realCenter = g->center(); - QTransform translate(1, 0, 0, 1, -realCenter.x(), -realCenter.y()); - QTransform gl_to_qt(1, 0, 0, -1, 0, pdev->height()); - QTransform m = QTransform(matrix).translate(brush_origin.x(), brush_origin.y()); - QTransform inv_matrix = gl_to_qt * (brush.transform() * m).inverted() * translate; - - setInvMatrixData(inv_matrix); - - angle_data[0] = -(g->angle() * 2 * Q_PI) / 360.0; - } else if (style == Qt::LinearGradientPattern) { - const QLinearGradient *g = static_cast(brush.gradient()); - - QPointF realStart = g->start(); - QPointF realFinal = g->finalStop(); - QTransform translate(1, 0, 0, 1, -realStart.x(), -realStart.y()); - QTransform gl_to_qt(1, 0, 0, -1, 0, pdev->height()); - QTransform m = QTransform(matrix).translate(brush_origin.x(), brush_origin.y()); - QTransform inv_matrix = gl_to_qt * (brush.transform() * m).inverted() * translate; - - setInvMatrixData(inv_matrix); - - QPointF l = realFinal - realStart; - - linear_data[0] = l.x(); - linear_data[1] = l.y(); - - linear_data[2] = 1.0f / (l.x() * l.x() + l.y() * l.y()); - } else if (style != Qt::SolidPattern) { - QTransform gl_to_qt(1, 0, 0, -1, 0, pdev->height()); - QTransform m = QTransform(matrix).translate(brush_origin.x(), brush_origin.y()); - QTransform inv_matrix = gl_to_qt * (brush.transform() * m).inverted(); - - setInvMatrixData(inv_matrix); - } - } - - if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { - createGradientPaletteTexture(*brush.gradient()); - } -#endif -} - - -class QOpenGLTessellator : public QTessellator -{ -public: - QOpenGLTessellator() {} - ~QOpenGLTessellator() { } - QGLTrapezoid toGLTrapezoid(const Trapezoid &trap); -}; - -QGLTrapezoid QOpenGLTessellator::toGLTrapezoid(const Trapezoid &trap) -{ - QGLTrapezoid t; - - t.top = Q27Dot5ToDouble(trap.top); - t.bottom = Q27Dot5ToDouble(trap.bottom); - - Q27Dot5 y = trap.topLeft->y - trap.bottomLeft->y; - - qreal topLeftY = Q27Dot5ToDouble(trap.topLeft->y); - - qreal tx = Q27Dot5ToDouble(trap.topLeft->x); - qreal m = (-tx + Q27Dot5ToDouble(trap.bottomLeft->x)) / Q27Dot5ToDouble(y); - t.topLeftX = tx + m * (topLeftY - t.top); - t.bottomLeftX = tx + m * (topLeftY - t.bottom); - - y = trap.topRight->y - trap.bottomRight->y; - - qreal topRightY = Q27Dot5ToDouble(trap.topRight->y); - - tx = Q27Dot5ToDouble(trap.topRight->x); - m = (-tx + Q27Dot5ToDouble(trap.bottomRight->x)) / Q27Dot5ToDouble(y); - - t.topRightX = tx + m * (topRightY - Q27Dot5ToDouble(trap.top)); - t.bottomRightX = tx + m * (topRightY - Q27Dot5ToDouble(trap.bottom)); - - return t; -} - -class QOpenGLImmediateModeTessellator : public QOpenGLTessellator -{ -public: - void addTrap(const Trapezoid &trap); - void tessellate(const QPointF *points, int nPoints, bool winding) { - trapezoids.reserve(trapezoids.size() + nPoints); - setWinding(winding); - QTessellator::tessellate(points, nPoints); - } - - QVector trapezoids; -}; - -void QOpenGLImmediateModeTessellator::addTrap(const Trapezoid &trap) -{ - trapezoids.append(toGLTrapezoid(trap)); -} - -#ifndef QT_OPENGL_ES -static void drawTrapezoid(const QGLTrapezoid &trap, const qreal offscreenHeight, QGLContext *ctx) -{ - qreal minX = qMin(trap.topLeftX, trap.bottomLeftX); - qreal maxX = qMax(trap.topRightX, trap.bottomRightX); - - if (qFuzzyCompare(trap.top, trap.bottom) || qFuzzyCompare(minX, maxX) || - (qFuzzyCompare(trap.topLeftX, trap.topRightX) && qFuzzyCompare(trap.bottomLeftX, trap.bottomRightX))) - return; - - const qreal xpadding = 1.0; - const qreal ypadding = 1.0; - - qreal topDist = offscreenHeight - trap.top; - qreal bottomDist = offscreenHeight - trap.bottom; - - qreal reciprocal = bottomDist / (bottomDist - topDist); - - qreal leftB = trap.bottomLeftX + (trap.topLeftX - trap.bottomLeftX) * reciprocal; - qreal rightB = trap.bottomRightX + (trap.topRightX - trap.bottomRightX) * reciprocal; - - const bool topZero = qFuzzyIsNull(topDist); - - reciprocal = topZero ? 1.0 / bottomDist : 1.0 / topDist; - - qreal leftA = topZero ? (trap.bottomLeftX - leftB) * reciprocal : (trap.topLeftX - leftB) * reciprocal; - qreal rightA = topZero ? (trap.bottomRightX - rightB) * reciprocal : (trap.topRightX - rightB) * reciprocal; - - qreal invLeftA = qFuzzyIsNull(leftA) ? 0.0 : 1.0 / leftA; - qreal invRightA = qFuzzyIsNull(rightA) ? 0.0 : 1.0 / rightA; - - // fragment program needs the negative of invRightA as it mirrors the line - glTexCoord4f(topDist, bottomDist, invLeftA, -invRightA); - glMultiTexCoord4f(GL_TEXTURE1, leftA, leftB, rightA, rightB); - - qreal topY = trap.top - ypadding; - qreal bottomY = trap.bottom + ypadding; - - qreal bounds_bottomLeftX = leftA * (offscreenHeight - bottomY) + leftB; - qreal bounds_bottomRightX = rightA * (offscreenHeight - bottomY) + rightB; - qreal bounds_topLeftX = leftA * (offscreenHeight - topY) + leftB; - qreal bounds_topRightX = rightA * (offscreenHeight - topY) + rightB; - - QPointF leftNormal(1, -leftA); - leftNormal /= qSqrt(leftNormal.x() * leftNormal.x() + leftNormal.y() * leftNormal.y()); - QPointF rightNormal(1, -rightA); - rightNormal /= qSqrt(rightNormal.x() * rightNormal.x() + rightNormal.y() * rightNormal.y()); - - qreal left_padding = xpadding / qAbs(leftNormal.x()); - qreal right_padding = xpadding / qAbs(rightNormal.x()); - - glVertex2d(bounds_topLeftX - left_padding, topY); - glVertex2d(bounds_topRightX + right_padding, topY); - glVertex2d(bounds_bottomRightX + right_padding, bottomY); - glVertex2d(bounds_bottomLeftX - left_padding, bottomY); - - glTexCoord4f(0.0f, 0.0f, 0.0f, 1.0f); -} -#endif // !Q_WS_QWS - -class QOpenGLTrapezoidToArrayTessellator : public QOpenGLTessellator -{ -public: - QOpenGLTrapezoidToArrayTessellator() : vertices(0), allocated(0), size(0) {} - ~QOpenGLTrapezoidToArrayTessellator() { free(vertices); } - GLfloat *vertices; - int allocated; - int size; - QRectF bounds; - void addTrap(const Trapezoid &trap); - void tessellate(const QPointF *points, int nPoints, bool winding) { - size = 0; - setWinding(winding); - bounds = QTessellator::tessellate(points, nPoints); - } -}; - -void QOpenGLTrapezoidToArrayTessellator::addTrap(const Trapezoid &trap) -{ - // On OpenGL ES we convert the trap to 2 triangles -#ifndef QT_OPENGL_ES - if (size > allocated - 8) { -#else - if (size > allocated - 12) { -#endif - allocated = qMax(2*allocated, 512); - vertices = (GLfloat *)realloc(vertices, allocated * sizeof(GLfloat)); - } - - QGLTrapezoid t = toGLTrapezoid(trap); - -#ifndef QT_OPENGL_ES - vertices[size++] = t.topLeftX; - vertices[size++] = t.top; - vertices[size++] = t.topRightX; - vertices[size++] = t.top; - vertices[size++] = t.bottomRightX; - vertices[size++] = t.bottom; - vertices[size++] = t.bottomLeftX; - vertices[size++] = t.bottom; -#else - // First triangle - vertices[size++] = t.topLeftX; - vertices[size++] = t.top; - vertices[size++] = t.topRightX; - vertices[size++] = t.top; - vertices[size++] = t.bottomRightX; - vertices[size++] = t.bottom; - - // Second triangle - vertices[size++] = t.bottomLeftX; - vertices[size++] = t.bottom; - vertices[size++] = t.topLeftX; - vertices[size++] = t.top; - vertices[size++] = t.bottomRightX; - vertices[size++] = t.bottom; -#endif -} - - -void QOpenGLPaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int pointCount, - Qt::FillRule fill) -{ - QOpenGLTrapezoidToArrayTessellator tessellator; - tessellator.tessellate(polygonPoints, pointCount, fill == Qt::WindingFill); - - DEBUG_ONCE qDebug() << "QOpenGLPaintEnginePrivate: Drawing polygon with" << pointCount << "points using fillPolygon_dev"; - - setGradientOps(cbrush, tessellator.bounds); - - bool fast_style = current_style == Qt::LinearGradientPattern - || current_style == Qt::SolidPattern; - -#ifndef QT_OPENGL_ES - GLenum geometry_mode = GL_QUADS; -#else - GLenum geometry_mode = GL_TRIANGLES; -#endif - - if (use_fragment_programs && !(fast_style && has_fast_composition_mode)) { - composite(geometry_mode, tessellator.vertices, tessellator.size / 2); - } else { - glVertexPointer(2, GL_FLOAT, 0, tessellator.vertices); - glEnableClientState(GL_VERTEX_ARRAY); - glDrawArrays(geometry_mode, 0, tessellator.size/2); - glDisableClientState(GL_VERTEX_ARRAY); - } -} - - -inline void QOpenGLPaintEnginePrivate::lineToStencil(qreal x, qreal y) -{ - tess_points.add(QPointF(x, y)); - - if (x > max_x) - max_x = x; - else if (x < min_x) - min_x = x; - if (y > max_y) - max_y = y; - else if (y < min_y) - min_y = y; -} - -inline void QOpenGLPaintEnginePrivate::curveToStencil(const QPointF &cp1, const QPointF &cp2, const QPointF &ep) -{ - qreal inverseScaleHalf = inverseScale / 2; - - QBezier beziers[32]; - beziers[0] = QBezier::fromPoints(tess_points.last(), cp1, cp2, ep); - QBezier *b = beziers; - while (b >= beziers) { - // check if we can pop the top bezier curve from the stack - qreal l = qAbs(b->x4 - b->x1) + qAbs(b->y4 - b->y1); - qreal d; - if (l > inverseScale) { - d = qAbs( (b->x4 - b->x1)*(b->y1 - b->y2) - (b->y4 - b->y1)*(b->x1 - b->x2) ) - + qAbs( (b->x4 - b->x1)*(b->y1 - b->y3) - (b->y4 - b->y1)*(b->x1 - b->x3) ); - d /= l; - } else { - d = qAbs(b->x1 - b->x2) + qAbs(b->y1 - b->y2) + - qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3); - } - if (d < inverseScaleHalf || b == beziers + 31) { - // good enough, we pop it off and add the endpoint - lineToStencil(b->x4, b->y4); - --b; - } else { - // split, second half of the polygon goes lower into the stack - b->split(b+1, b); - ++b; - } - } -} - - -void QOpenGLPaintEnginePrivate::pathToVertexArrays(const QPainterPath &path) -{ - const QPainterPath::Element &first = path.elementAt(0); - min_x = max_x = first.x; - min_y = max_y = first.y; - - tess_points.reset(); - tess_points_stops.clear(); - lineToStencil(first.x, first.y); - - for (int i=1; isystemClip().intersected(dirty_stencil).boundingRect(); - - glStencilMask(~0); - - if (!rect.isEmpty()) { - disableClipping(); - - glEnable(GL_SCISSOR_TEST); - - const int left = rect.left(); - const int width = rect.width(); - const int bottom = device->size().height() - (rect.bottom() + 1); - const int height = rect.height(); - - glScissor(left, bottom, width, height); - - glClearStencil(0); - glClear(GL_STENCIL_BUFFER_BIT); - dirty_stencil -= rect; - - glDisable(GL_SCISSOR_TEST); - - enableClipping(); - } - - // Enable stencil. - glEnable(GL_STENCIL_TEST); - - // Disable color writes. - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - - GLuint stencilMask = 0; - - if (fillRule == Qt::OddEvenFill) { - stencilMask = 1; - - // Enable stencil writes. - glStencilMask(stencilMask); - - // Set stencil xor mode. - glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); - - // Disable stencil func. - glStencilFunc(GL_ALWAYS, 0, ~0); - - drawVertexArrays(); - } else if (fillRule == Qt::WindingFill) { - stencilMask = ~0; - - if (has_stencil_face_ext) { - QGL_FUNC_CONTEXT; - glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT); - - glActiveStencilFaceEXT(GL_BACK); - glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT); - glStencilFunc(GL_ALWAYS, 0, ~0); - - glActiveStencilFaceEXT(GL_FRONT); - glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT); - glStencilFunc(GL_ALWAYS, 0, ~0); - - drawVertexArrays(); - - glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT); - } else { - glStencilFunc(GL_ALWAYS, 0, ~0); - glEnable(GL_CULL_FACE); - - glCullFace(GL_BACK); - glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT); - drawVertexArrays(); - - glCullFace(GL_FRONT); - glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT); - drawVertexArrays(); - - glDisable(GL_CULL_FACE); - } - } - - // Enable color writes. - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glStencilMask(stencilMask); - - setGradientOps(cbrush, QRectF(QPointF(min_x, min_y), QSizeF(max_x - min_x, max_y - min_y))); - - bool fast_fill = has_fast_composition_mode && (current_style == Qt::LinearGradientPattern || current_style == Qt::SolidPattern); - - if (use_fragment_programs && !fast_fill) { - DEBUG_ONCE qDebug() << "QOpenGLPaintEnginePrivate: Drawing polygon using stencil method (fragment programs)"; - QRectF rect(QPointF(min_x, min_y), QSizeF(max_x - min_x, max_y - min_y)); - - // Enable stencil func. - glStencilFunc(GL_NOTEQUAL, 0, stencilMask); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - composite(rect); - } else { - DEBUG_ONCE qDebug() << "QOpenGLPaintEnginePrivate: Drawing polygon using stencil method (no fragment programs)"; - - // Enable stencil func. - glStencilFunc(GL_NOTEQUAL, 0, stencilMask); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); -#ifndef QT_OPENGL_ES - glBegin(GL_QUADS); - glVertex2f(min_x, min_y); - glVertex2f(max_x, min_y); - glVertex2f(max_x, max_y); - glVertex2f(min_x, max_y); - glEnd(); -#endif - } - - // Disable stencil writes. - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glStencilMask(0); - glDisable(GL_STENCIL_TEST); -} - -void QOpenGLPaintEnginePrivate::fillPath(const QPainterPath &path) -{ - if (path.isEmpty()) - return; - - if (use_stencil_method && !high_quality_antialiasing) { - pathToVertexArrays(path); - fillVertexArray(path.fillRule()); - return; - } - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - if (high_quality_antialiasing) - drawOffscreenPath(path); - else { - QPolygonF poly = path.toFillPolygon(matrix); - fillPolygon_dev(poly.data(), poly.count(), - path.fillRule()); - } - - updateGLMatrix(); -} - -extern bool qt_isExtendedRadialGradient(const QBrush &brush); - -static inline bool needsEmulation(Qt::BrushStyle style) -{ - return !(style == Qt::SolidPattern - || (style == Qt::LinearGradientPattern - && (QGLExtensions::glExtensions() & QGLExtensions::MirroredRepeat))); -} - -void QOpenGLPaintEnginePrivate::updateUseEmulation() -{ - use_emulation = (!use_fragment_programs - && ((has_pen && needsEmulation(pen_brush_style)) - || (has_brush && needsEmulation(brush_style)))) - || (has_pen && qt_isExtendedRadialGradient(cpen.brush())) - || (has_brush && qt_isExtendedRadialGradient(cbrush)); -} - -void QOpenGLPaintEngine::updatePen(const QPen &pen) -{ - Q_D(QOpenGLPaintEngine); - Qt::PenStyle pen_style = pen.style(); - d->pen_brush_style = pen.brush().style(); - d->cpen = pen; - d->has_pen = (pen_style != Qt::NoPen) && (d->pen_brush_style != Qt::NoBrush); - d->updateUseEmulation(); - - if (pen.isCosmetic()) { - GLfloat width = pen.widthF() == 0.0f ? 1.0f : pen.widthF(); - glLineWidth(width); - glPointSize(width); - } - - if (d->pen_brush_style >= Qt::LinearGradientPattern - && d->pen_brush_style <= Qt::ConicalGradientPattern) - { - d->setGLPen(Qt::white); - } else { - d->setGLPen(pen.color()); - } - - d->updateFastPen(); -} - -void QOpenGLPaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) -{ - Q_D(QOpenGLPaintEngine); - d->cbrush = brush; - d->brush_style = brush.style(); - d->brush_origin = origin; - d->has_brush = (d->brush_style != Qt::NoBrush); - d->updateUseEmulation(); -} - -void QOpenGLPaintEngine::updateFont(const QFont &) -{ -} - -void QOpenGLPaintEngine::updateMatrix(const QTransform &mtx) -{ - Q_D(QOpenGLPaintEngine); - - d->matrix = mtx; - - d->mv_matrix[0][0] = mtx.m11(); - d->mv_matrix[0][1] = mtx.m12(); - d->mv_matrix[0][2] = 0; - d->mv_matrix[0][3] = mtx.m13(); - - d->mv_matrix[1][0] = mtx.m21(); - d->mv_matrix[1][1] = mtx.m22(); - d->mv_matrix[1][2] = 0; - d->mv_matrix[1][3] = mtx.m23(); - - d->mv_matrix[2][0] = 0; - d->mv_matrix[2][1] = 0; - d->mv_matrix[2][2] = 1; - d->mv_matrix[2][3] = 0; - - d->mv_matrix[3][0] = mtx.dx(); - d->mv_matrix[3][1] = mtx.dy(); - d->mv_matrix[3][2] = 0; - d->mv_matrix[3][3] = mtx.m33(); - - d->txop = mtx.type(); - - // 1/10000 == 0.0001, so we have good enough res to cover curves - // that span the entire widget... - d->inverseScale = qMax(1 / qMax( qMax(qAbs(mtx.m11()), qAbs(mtx.m22())), - qMax(qAbs(mtx.m12()), qAbs(mtx.m21())) ), - qreal(0.0001)); - - d->updateGLMatrix(); - d->updateFastPen(); -} - -void QOpenGLPaintEnginePrivate::updateGLMatrix() const -{ - glMatrixMode(GL_MODELVIEW); -#ifndef QT_OPENGL_ES - glLoadMatrixd(&mv_matrix[0][0]); -#else - glLoadMatrixf(&mv_matrix[0][0]); -#endif -} - -void QOpenGLPaintEnginePrivate::disableClipping() -{ - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); -} - -void QOpenGLPaintEnginePrivate::enableClipping() -{ - Q_Q(QOpenGLPaintEngine); - if (!q->state()->hasClipping) - return; - - if (q->state()->fastClip.isEmpty()) - glEnable(GL_DEPTH_TEST); - else - updateDepthClip(); // this will enable the scissor test -} - -void QOpenGLPaintEnginePrivate::updateDepthClip() -{ - Q_Q(QOpenGLPaintEngine); - - ++q->state()->depthClipId; - - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); - - if (!q->state()->hasClipping) - return; - - QRect fastClip; - if (q->state()->clipEnabled) { - fastClip = q->state()->fastClip; - } else if (use_system_clip && q->systemClip().rects().count() == 1) { - fastClip = q->systemClip().rects().at(0); - } - - if (!fastClip.isEmpty()) { - glEnable(GL_SCISSOR_TEST); - - const int left = fastClip.left(); - const int width = fastClip.width(); - const int bottom = device->size().height() - (fastClip.bottom() + 1); - const int height = fastClip.height(); - - glScissor(left, bottom, width, height); - return; - } - -#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_2) - glClearDepthf(0.0f); -#else - glClearDepth(0.0f); -#endif - - glEnable(GL_DEPTH_TEST); - glDepthMask(GL_TRUE); - glClear(GL_DEPTH_BUFFER_BIT); - - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - glDepthFunc(GL_ALWAYS); - - const QVector rects = q->state()->clipEnabled ? q->state()->clipRegion.rects() : q->systemClip().rects(); - - // rectangle count * 2 (triangles) * vertex count * component count (Z omitted) - QDataBuffer clipVertex(rects.size()*2*3*2); - for (int i = 0; i < rects.size(); ++i) { - GLfloat x = GLfloat(rects.at(i).left()); - GLfloat w = GLfloat(rects.at(i).width()); - GLfloat h = GLfloat(rects.at(i).height()); - GLfloat y = GLfloat(rects.at(i).top()); - - // First triangle - clipVertex.add(x); - clipVertex.add(y); - - clipVertex.add(x); - clipVertex.add(y + h); - - clipVertex.add(x + w); - clipVertex.add(y); - - // Second triangle - clipVertex.add(x); - clipVertex.add(y + h); - - clipVertex.add(x + w); - clipVertex.add(y + h); - - clipVertex.add (x + w); - clipVertex.add(y); - } - - if (rects.size()) { - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_FLOAT, 0, clipVertex.data()); - - glDrawArrays(GL_TRIANGLES, 0, rects.size()*2*3); - glDisableClientState(GL_VERTEX_ARRAY); - updateGLMatrix(); - } - - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glDepthMask(GL_FALSE); - glDepthFunc(GL_LEQUAL); -} - -void QOpenGLPaintEnginePrivate::systemStateChanged() -{ - Q_Q(QOpenGLPaintEngine); - if (q->painter()->hasClipping()) - q->updateClipRegion(q->painter()->clipRegion(), Qt::ReplaceClip); - else - q->updateClipRegion(QRegion(), Qt::NoClip); -} - -void QOpenGLPaintEngine::updateClipRegion(const QRegion &clipRegion, Qt::ClipOperation op) -{ - Q_D(QOpenGLPaintEngine); - - // clipping is only supported when a stencil or depth buffer is - // available - if (!d->device->format().depth()) - return; - - d->use_system_clip = false; - QRegion sysClip = systemClip(); - if (!sysClip.isEmpty()) { - if (d->pdev->devType() != QInternal::Widget) { - d->use_system_clip = true; - } else { -#ifndef Q_WS_QWS - // Only use the system clip if we're currently rendering a widget with a GL painter. - if (d->currentClipWidget) { - QWidgetPrivate *widgetPrivate = qt_widget_private(d->currentClipWidget->window()); - d->use_system_clip = widgetPrivate->extra && widgetPrivate->extra->inRenderWithPainter; - } -#endif - } - } - - d->flushDrawQueue(); - - if (op == Qt::NoClip && !d->use_system_clip) { - state()->hasClipping = false; - state()->clipRegion = QRegion(); - d->updateDepthClip(); - return; - } - - bool isScreenClip = false; - if (!d->use_system_clip) { - QVector untransformedRects = clipRegion.rects(); - - if (untransformedRects.size() == 1) { - QPainterPath path; - path.addRect(untransformedRects[0]); - path = d->matrix.map(path); - - if (path.contains(QRectF(QPointF(), d->device->size()))) - isScreenClip = true; - } - } - - QRegion region = isScreenClip ? QRegion() : clipRegion * d->matrix; - switch (op) { - case Qt::NoClip: - if (!d->use_system_clip) - break; - state()->clipRegion = sysClip; - break; - case Qt::IntersectClip: - if (isScreenClip) - return; - if (state()->hasClipping) { - state()->clipRegion &= region; - break; - } - // fall through - case Qt::ReplaceClip: - if (d->use_system_clip) - state()->clipRegion = region & sysClip; - else - state()->clipRegion = region; - break; - default: - break; - } - - if (isScreenClip) { - state()->hasClipping = false; - state()->clipRegion = QRegion(); - } else { - state()->hasClipping = op != Qt::NoClip || d->use_system_clip; - } - - if (state()->hasClipping && state()->clipRegion.rects().size() == 1) - state()->fastClip = state()->clipRegion.rects().at(0); - else - state()->fastClip = QRect(); - - d->updateDepthClip(); -} - -void QOpenGLPaintEngine::updateRenderHints(QPainter::RenderHints hints) -{ - Q_D(QOpenGLPaintEngine); - - d->flushDrawQueue(); - d->use_smooth_pixmap_transform = bool(hints & QPainter::SmoothPixmapTransform); - if ((hints & QPainter::Antialiasing) || (hints & QPainter::HighQualityAntialiasing)) { - if (d->use_fragment_programs && QGLOffscreen::isSupported() - && (hints & QPainter::HighQualityAntialiasing)) { - d->high_quality_antialiasing = true; - } else { - d->high_quality_antialiasing = false; - if (QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers) - glEnable(GL_MULTISAMPLE); - } - } else { - d->high_quality_antialiasing = false; - if (QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers) - glDisable(GL_MULTISAMPLE); - } - - if (d->high_quality_antialiasing) { - d->offscreen.initialize(); - - if (!d->offscreen.isValid()) { - DEBUG_ONCE_STR("Unable to initialize offscreen, disabling high quality antialiasing"); - d->high_quality_antialiasing = false; - if (QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers) - glEnable(GL_MULTISAMPLE); - } - } - - d->has_antialiasing = d->high_quality_antialiasing - || ((hints & QPainter::Antialiasing) - && (QGLExtensions::glExtensions() & QGLExtensions::SampleBuffers)); -} - - -void QOpenGLPaintEnginePrivate::setPorterDuffData(float a, float b, float x, float y, float z) -{ - porterduff_ab_data[0] = a; - porterduff_ab_data[1] = b; - - porterduff_xyz_data[0] = x; - porterduff_xyz_data[1] = y; - porterduff_xyz_data[2] = z; -} - - -void QOpenGLPaintEngine::updateCompositionMode(QPainter::CompositionMode composition_mode) -{ - Q_D(QOpenGLPaintEngine); - - if (!d->use_fragment_programs && composition_mode > QPainter::CompositionMode_Plus) - composition_mode = QPainter::CompositionMode_SourceOver; - - d->composition_mode = composition_mode; - - d->has_fast_composition_mode = (!d->high_quality_antialiasing && composition_mode <= QPainter::CompositionMode_Plus) - || composition_mode == QPainter::CompositionMode_SourceOver - || composition_mode == QPainter::CompositionMode_Destination - || composition_mode == QPainter::CompositionMode_DestinationOver - || composition_mode == QPainter::CompositionMode_DestinationOut - || composition_mode == QPainter::CompositionMode_SourceAtop - || composition_mode == QPainter::CompositionMode_Xor - || composition_mode == QPainter::CompositionMode_Plus; - - if (d->has_fast_composition_mode) - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODE_BLEND_MODE_MASK : COMPOSITION_MODE_BLEND_MODE_NOMASK; - else if (composition_mode <= QPainter::CompositionMode_Plus) - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_SIMPLE_PORTER_DUFF : COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK; - else - switch (composition_mode) { - case QPainter::CompositionMode_Multiply: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_MULTIPLY : COMPOSITION_MODES_MULTIPLY_NOMASK; - break; - case QPainter::CompositionMode_Screen: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_SCREEN : COMPOSITION_MODES_SCREEN_NOMASK; - break; - case QPainter::CompositionMode_Overlay: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_OVERLAY : COMPOSITION_MODES_OVERLAY_NOMASK; - break; - case QPainter::CompositionMode_Darken: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_DARKEN : COMPOSITION_MODES_DARKEN_NOMASK; - break; - case QPainter::CompositionMode_Lighten: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_LIGHTEN : COMPOSITION_MODES_LIGHTEN_NOMASK; - break; - case QPainter::CompositionMode_ColorDodge: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_COLORDODGE : COMPOSITION_MODES_COLORDODGE_NOMASK; - break; - case QPainter::CompositionMode_ColorBurn: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_COLORBURN : COMPOSITION_MODES_COLORBURN_NOMASK; - break; - case QPainter::CompositionMode_HardLight: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_HARDLIGHT : COMPOSITION_MODES_HARDLIGHT_NOMASK; - break; - case QPainter::CompositionMode_SoftLight: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_SOFTLIGHT : COMPOSITION_MODES_SOFTLIGHT_NOMASK; - break; - case QPainter::CompositionMode_Difference: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_DIFFERENCE : COMPOSITION_MODES_DIFFERENCE_NOMASK; - break; - case QPainter::CompositionMode_Exclusion: - d->fragment_composition_mode = d->high_quality_antialiasing ? COMPOSITION_MODES_EXCLUSION : COMPOSITION_MODES_EXCLUSION_NOMASK; - break; - default: - Q_ASSERT(false); - } - - switch(composition_mode) { - case QPainter::CompositionMode_DestinationOver: - glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); - d->setPorterDuffData(0, 1, 1, 1, 1); - break; - case QPainter::CompositionMode_Clear: - glBlendFunc(GL_ZERO, GL_ZERO); - d->setPorterDuffData(0, 0, 0, 0, 0); - break; - case QPainter::CompositionMode_Source: - glBlendFunc(GL_ONE, GL_ZERO); - d->setPorterDuffData(1, 0, 1, 1, 0); - break; - case QPainter::CompositionMode_Destination: - glBlendFunc(GL_ZERO, GL_ONE); - d->setPorterDuffData(0, 1, 1, 0, 1); - break; - case QPainter::CompositionMode_SourceIn: - glBlendFunc(GL_DST_ALPHA, GL_ZERO); - d->setPorterDuffData(1, 0, 1, 0, 0); - break; - case QPainter::CompositionMode_DestinationIn: - glBlendFunc(GL_ZERO, GL_SRC_ALPHA); - d->setPorterDuffData(0, 1, 1, 0, 0); - break; - case QPainter::CompositionMode_SourceOut: - glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ZERO); - d->setPorterDuffData(0, 0, 0, 1, 0); - break; - case QPainter::CompositionMode_DestinationOut: - glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); - d->setPorterDuffData(0, 0, 0, 0, 1); - break; - case QPainter::CompositionMode_SourceAtop: - glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - d->setPorterDuffData(1, 0, 1, 0, 1); - break; - case QPainter::CompositionMode_DestinationAtop: - glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_SRC_ALPHA); - d->setPorterDuffData(0, 1, 1, 1, 0); - break; - case QPainter::CompositionMode_Xor: - glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - d->setPorterDuffData(0, 0, 0, 1, 1); - break; - case QPainter::CompositionMode_SourceOver: - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - d->setPorterDuffData(1, 0, 1, 1, 1); - break; - case QPainter::CompositionMode_Plus: - glBlendFunc(GL_ONE, GL_ONE); - d->setPorterDuffData(1, 1, 1, 1, 1); - break; - default: - break; - } -} - -class QGLMaskGenerator -{ -public: - QGLMaskGenerator(const QPainterPath &path, const QTransform &matrix, qreal stroke_width = -1) - : p(path), - m(matrix), - w(stroke_width) - { - } - - virtual QRect screenRect() = 0; - virtual void drawMask(const QRect &rect) = 0; - - QPainterPath path() const { return p; } - QTransform matrix() const { return m; } - qreal strokeWidth() const { return w; } - - virtual ~QGLMaskGenerator() {} - -private: - QPainterPath p; - QTransform m; - qreal w; -}; - -void QGLMaskTextureCache::setOffscreenSize(const QSize &sz) -{ - Q_ASSERT(sz.width() == sz.height()); - - if (offscreenSize != sz) { - offscreenSize = sz; - clearCache(); - } -} - -void QGLMaskTextureCache::clearCache() -{ - cache.clear(); - - int quad_tree_size = 1; - - for (int i = block_size; i < offscreenSize.width(); i *= 2) - quad_tree_size += quad_tree_size * 4; - - for (int i = 0; i < 4; ++i) { - occupied_quadtree[i].resize(quad_tree_size); - - occupied_quadtree[i][0].key = 0; - occupied_quadtree[i][0].largest_available_block = offscreenSize.width(); - occupied_quadtree[i][0].largest_used_block = 0; - - DEBUG_ONCE qDebug() << "QGLMaskTextureCache:: created quad tree of size" << quad_tree_size; - } -} - -void QGLMaskTextureCache::setDrawableSize(const QSize &sz) -{ - drawableSize = sz; -} - -void QGLMaskTextureCache::maintainCache() -{ - QGLTextureCacheHash::iterator it = cache.begin(); - QGLTextureCacheHash::iterator end = cache.end(); - - while (it != end) { - CacheInfo &cache_info = it.value(); - ++cache_info.age; - - if (cache_info.age > 1) { - quadtreeInsert(cache_info.loc.channel, 0, cache_info.loc.rect); - it = cache.erase(it); - } else { - ++it; - } - } -} - -//#define DISABLE_MASK_CACHE - -QGLMaskTextureCache::CacheLocation QGLMaskTextureCache::getMask(QGLMaskGenerator &maskGenerator, QOpenGLPaintEnginePrivate *e) -{ -#ifndef DISABLE_MASK_CACHE - engine = e; - - quint64 key = hash(maskGenerator.path(), maskGenerator.matrix(), maskGenerator.strokeWidth()); - - if (key == 0) - key = 1; - - CacheInfo info(maskGenerator.path(), maskGenerator.matrix(), maskGenerator.strokeWidth()); - - QGLTextureCacheHash::iterator it = cache.find(key); - - while (it != cache.end() && it.key() == key) { - CacheInfo &cache_info = it.value(); - if (info.stroke_width == cache_info.stroke_width && info.matrix == cache_info.matrix && info.path == cache_info.path) { - DEBUG_ONCE_STR("QGLMaskTextureCache::getMask(): Using cached mask"); - - cache_info.age = 0; - return cache_info.loc; - } - ++it; - } - - // mask was not found, create new mask - - DEBUG_ONCE_STR("QGLMaskTextureCache::getMask(): Creating new mask..."); - - createMask(key, info, maskGenerator); - - cache.insert(key, info); - - return info.loc; -#else - CacheInfo info(maskGenerator.path(), maskGenerator.matrix()); - createMask(0, info, maskGenerator); - return info.loc; -#endif -} - -#ifndef FloatToQuint64 -#define FloatToQuint64(i) (quint64)((i) * 32) -#endif - -quint64 QGLMaskTextureCache::hash(const QPainterPath &p, const QTransform &m, qreal w) -{ - Q_ASSERT(sizeof(quint64) == 8); - - quint64 h = 0; - - for (int i = 0; i < p.elementCount(); ++i) { - h += FloatToQuint64(p.elementAt(i).x) << 32; - h += FloatToQuint64(p.elementAt(i).y); - h += p.elementAt(i).type; - } - - h += FloatToQuint64(m.m11()); -#ifndef Q_OS_WINCE // ### - //Compiler crashes for arm on WinCE - h += FloatToQuint64(m.m12()) << 4; - h += FloatToQuint64(m.m13()) << 8; - h += FloatToQuint64(m.m21()) << 12; - h += FloatToQuint64(m.m22()) << 16; - h += FloatToQuint64(m.m23()) << 20; - h += FloatToQuint64(m.m31()) << 24; - h += FloatToQuint64(m.m32()) << 28; -#endif - h += FloatToQuint64(m.m33()) << 32; - - h += FloatToQuint64(w); - - return h; -} - -void QGLMaskTextureCache::createMask(quint64 key, CacheInfo &info, QGLMaskGenerator &maskGenerator) -{ - info.loc.screen_rect = maskGenerator.screenRect(); - - if (info.loc.screen_rect.isEmpty()) { - info.loc.channel = 0; - info.loc.rect = QRect(); - return; - } - - quadtreeAllocate(key, info.loc.screen_rect.size(), &info.loc.rect, &info.loc.channel); - - int ch = info.loc.channel; - glColorMask(ch == 0, ch == 1, ch == 2, ch == 3); - - maskGenerator.drawMask(info.loc.rect); - - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); -} - -int QGLMaskTextureCache::quadtreeBlocksize(int node) -{ - DEBUG_ONCE qDebug() << "Offscreen size:" << offscreenSize.width(); - - int blocksize = offscreenSize.width(); - - while (node) { - node = (node - 1) / 4; - blocksize /= 2; - } - - return blocksize; -} - -QPoint QGLMaskTextureCache::quadtreeLocation(int node) -{ - QPoint location; - int blocksize = quadtreeBlocksize(node); - - while (node) { - --node; - - if (node & 1) - location.setX(location.x() + blocksize); - - if (node & 2) - location.setY(location.y() + blocksize); - - node /= 4; - blocksize *= 2; - } - - return location; -} - -void QGLMaskTextureCache::quadtreeUpdate(int channel, int node, int current_block_size) -{ - while (node) { - node = (node - 1) / 4; - - int first_child = node * 4 + 1; - - int largest_available = 0; - int largest_used = 0; - - bool all_empty = true; - - for (int i = 0; i < 4; ++i) { - largest_available = qMax(largest_available, occupied_quadtree[channel][first_child + i].largest_available_block); - largest_used = qMax(largest_used, occupied_quadtree[channel][first_child + i].largest_used_block); - - if (occupied_quadtree[channel][first_child + i].largest_available_block < current_block_size) - all_empty = false; - } - - current_block_size *= 2; - - if (all_empty) { - occupied_quadtree[channel][node].largest_available_block = current_block_size; - occupied_quadtree[channel][node].largest_used_block = 0; - } else { - occupied_quadtree[channel][node].largest_available_block = largest_available; - occupied_quadtree[channel][node].largest_used_block = largest_used; - } - } -} - -void QGLMaskTextureCache::quadtreeInsert(int channel, quint64 key, const QRect &rect, int node) -{ - int current_block_size = quadtreeBlocksize(node); - QPoint location = quadtreeLocation(node); - QRect relative = rect.translated(-location); - - if (relative.left() >= current_block_size || relative.top() >= current_block_size - || relative.right() < 0 || relative.bottom() < 0) - return; - - if (current_block_size == block_size // no more refining possible - || (relative.top() < block_size && relative.bottom() >= (current_block_size - block_size) - && relative.left() < block_size && relative.right() >= (current_block_size - block_size))) - { - if (key != 0) { - occupied_quadtree[channel][node].largest_available_block = 0; - occupied_quadtree[channel][node].largest_used_block = rect.width() * rect.height(); - } else { - occupied_quadtree[channel][node].largest_available_block = current_block_size; - occupied_quadtree[channel][node].largest_used_block = 0; - } - - occupied_quadtree[channel][node].key = key; - - quadtreeUpdate(channel, node, current_block_size); - } else { - if (key && occupied_quadtree[channel][node].largest_available_block == current_block_size) { - // refining the quad tree, initialize child nodes - int half_block_size = current_block_size / 2; - - int temp = node * 4 + 1; - for (int sibling = 0; sibling < 4; ++sibling) { - occupied_quadtree[channel][temp + sibling].largest_available_block = half_block_size; - occupied_quadtree[channel][temp + sibling].largest_used_block = 0; - occupied_quadtree[channel][temp + sibling].key = 0; - } - } - - node = node * 4 + 1; - - for (int sibling = 0; sibling < 4; ++sibling) - quadtreeInsert(channel, key, rect, node + sibling); - } -} - -void QGLMaskTextureCache::quadtreeClear(int channel, const QRect &rect, int node) -{ - const quint64 &key = occupied_quadtree[channel][node].key; - - int current_block_size = quadtreeBlocksize(node); - QPoint location = quadtreeLocation(node); - - QRect relative = rect.translated(-location); - - if (relative.left() >= current_block_size || relative.top() >= current_block_size - || relative.right() < 0 || relative.bottom() < 0) - return; - - if (key != 0) { - QGLTextureCacheHash::iterator it = cache.find(key); - - Q_ASSERT(it != cache.end()); - - while (it != cache.end() && it.key() == key) { - const CacheInfo &cache_info = it.value(); - - if (cache_info.loc.channel == channel - && cache_info.loc.rect.left() <= location.x() - && cache_info.loc.rect.top() <= location.y() - && cache_info.loc.rect.right() >= location.x() - && cache_info.loc.rect.bottom() >= location.y()) - { - quadtreeInsert(channel, 0, cache_info.loc.rect); - engine->cacheItemErased(channel, cache_info.loc.rect); - cache.erase(it); - goto found; - } else { - ++it; - } - } - - // if we don't find the key there's an error in the quadtree - Q_ASSERT(false); -found: - Q_ASSERT(occupied_quadtree[channel][node].key == 0); - } else if (occupied_quadtree[channel][node].largest_available_block < current_block_size) { - Q_ASSERT(current_block_size >= block_size); - - node = node * 4 + 1; - - for (int sibling = 0; sibling < 4; ++sibling) - quadtreeClear(channel, rect, node + sibling); - } -} - -bool QGLMaskTextureCache::quadtreeFindAvailableLocation(const QSize &size, QRect *rect, int *channel) -{ - int needed_block_size = qMax(1, qMax(size.width(), size.height())); - - for (int i = 0; i < 4; ++i) { - int current_block_size = offscreenSize.width(); - - if (occupied_quadtree[i][0].largest_available_block >= needed_block_size) { - int node = 0; - - while (current_block_size != occupied_quadtree[i][node].largest_available_block) { - Q_ASSERT(current_block_size > block_size); - Q_ASSERT(current_block_size > occupied_quadtree[i][node].largest_available_block); - - node = node * 4 + 1; - current_block_size /= 2; - - int sibling = 0; - - while (occupied_quadtree[i][node + sibling].largest_available_block < needed_block_size) - ++sibling; - - Q_ASSERT(sibling < 4); - node += sibling; - } - - *channel = i; - *rect = QRect(quadtreeLocation(node), size); - - return true; - } - } - - return false; -} - -void QGLMaskTextureCache::quadtreeFindExistingLocation(const QSize &size, QRect *rect, int *channel) -{ - // try to pick small masks to throw out, as large masks are more expensive to recompute - *channel = qrand() % 4; - for (int i = 0; i < 4; ++i) - if (occupied_quadtree[i][0].largest_used_block < occupied_quadtree[*channel][0].largest_used_block) - *channel = i; - - int needed_block_size = qt_next_power_of_two(qMax(1, qMax(size.width(), size.height()))); - - int node = 0; - int current_block_size = offscreenSize.width(); - - while (current_block_size > block_size - && current_block_size >= needed_block_size * 2 - && occupied_quadtree[*channel][node].key == 0) - { - node = node * 4 + 1; - - int sibling = 0; - - for (int i = 1; i < 4; ++i) { - if (occupied_quadtree[*channel][node + i].largest_used_block - <= occupied_quadtree[*channel][node + sibling].largest_used_block) - { - sibling = i; - } - } - - node += sibling; - current_block_size /= 2; - } - - *rect = QRect(quadtreeLocation(node), size); -} - -void QGLMaskTextureCache::quadtreeAllocate(quint64 key, const QSize &size, QRect *rect, int *channel) -{ -#ifndef DISABLE_MASK_CACHE - if (!quadtreeFindAvailableLocation(size, rect, channel)) { - quadtreeFindExistingLocation(size, rect, channel); - quadtreeClear(*channel, *rect); - } - - quadtreeInsert(*channel, key, *rect); -#else - *channel = 0; - *rect = QRect(QPoint(), size); -#endif -} - -class QGLTrapezoidMaskGenerator : public QGLMaskGenerator -{ -public: - QGLTrapezoidMaskGenerator(const QPainterPath &path, const QTransform &matrix, QGLOffscreen &offscreen, GLuint maskFragmentProgram, qreal strokeWidth = -1.0); - - QRect screenRect(); - void drawMask(const QRect &rect); - -private: - QRect screen_rect; - bool has_screen_rect; - - QGLOffscreen *offscreen; - - GLuint maskFragmentProgram; - - virtual QVector generateTrapezoids() = 0; - virtual QRect computeScreenRect() = 0; -}; - -class QGLPathMaskGenerator : public QGLTrapezoidMaskGenerator -{ -public: - QGLPathMaskGenerator(const QPainterPath &path, const QTransform &matrix, QGLOffscreen &offscreen, GLuint maskFragmentProgram); - -private: - QVector generateTrapezoids(); - QRect computeScreenRect(); - - QPolygonF poly; -}; - -class QGLLineMaskGenerator : public QGLTrapezoidMaskGenerator -{ -public: - QGLLineMaskGenerator(const QPainterPath &path, const QTransform &matrix, qreal width, QGLOffscreen &offscreen, GLuint maskFragmentProgram); - -private: - QVector generateTrapezoids(); - QRect computeScreenRect(); - - QPainterPath transformedPath; -}; - -class QGLRectMaskGenerator : public QGLTrapezoidMaskGenerator -{ -public: - QGLRectMaskGenerator(const QPainterPath &path, const QTransform &matrix, QGLOffscreen &offscreen, GLuint maskFragmentProgram); - -private: - QVector generateTrapezoids(); - QRect computeScreenRect(); - - QPainterPath transformedPath; -}; - -class QGLEllipseMaskGenerator : public QGLMaskGenerator -{ -public: - QGLEllipseMaskGenerator(const QRectF &rect, const QTransform &matrix, QGLOffscreen &offscreen, GLuint maskFragmentProgram, int *maskVariableLocations); - - QRect screenRect(); - void drawMask(const QRect &rect); - -private: - QRect screen_rect; - - QRectF ellipseRect; - - QGLOffscreen *offscreen; - - GLuint maskFragmentProgram; - - int *maskVariableLocations; - - float vertexArray[4 * 2]; -}; - -QGLTrapezoidMaskGenerator::QGLTrapezoidMaskGenerator(const QPainterPath &path, const QTransform &matrix, QGLOffscreen &offs, GLuint program, qreal stroke_width) - : QGLMaskGenerator(path, matrix, stroke_width) - , has_screen_rect(false) - , offscreen(&offs) - , maskFragmentProgram(program) -{ -} - -extern void qt_add_rect_to_array(const QRectF &r, GLfloat *array); -extern void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, GLfloat *array); - -void QGLTrapezoidMaskGenerator::drawMask(const QRect &rect) -{ -#ifdef QT_OPENGL_ES - Q_UNUSED(rect); -#else - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - QGLContext *ctx = offscreen->context(); - offscreen->bind(); - - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_1D); - - GLfloat vertexArray[4 * 2]; - qt_add_rect_to_array(rect, vertexArray); - - bool needs_scissor = rect != screen_rect; - - if (needs_scissor) { - glEnable(GL_SCISSOR_TEST); - glScissor(rect.left(), offscreen->offscreenSize().height() - rect.bottom() - 1, rect.width(), rect.height()); - } - - QVector trapezoids = generateTrapezoids(); - - // clear mask - glBlendFunc(GL_ZERO, GL_ZERO); // clear - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - glEnableClientState(GL_VERTEX_ARRAY); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glDisableClientState(GL_VERTEX_ARRAY); - - glBlendFunc(GL_ONE, GL_ONE); // add mask - glEnable(GL_FRAGMENT_PROGRAM_ARB); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, maskFragmentProgram); - - QPoint delta = rect.topLeft() - screen_rect.topLeft(); - glBegin(GL_QUADS); - for (int i = 0; i < trapezoids.size(); ++i) - drawTrapezoid(trapezoids[i].translated(delta), offscreen->offscreenSize().height(), ctx); - glEnd(); - - if (needs_scissor) - glDisable(GL_SCISSOR_TEST); - - glDisable(GL_FRAGMENT_PROGRAM_ARB); - - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); -#endif -} - -QRect QGLTrapezoidMaskGenerator::screenRect() -{ - if (!has_screen_rect) { - screen_rect = computeScreenRect(); - has_screen_rect = true; - } - - screen_rect = screen_rect.intersected(QRect(QPoint(), offscreen->drawableSize())); - - return screen_rect; -} - -QGLPathMaskGenerator::QGLPathMaskGenerator(const QPainterPath &path, const QTransform &matrix, QGLOffscreen &offs, GLuint program) - : QGLTrapezoidMaskGenerator(path, matrix, offs, program) -{ -} - -QRect QGLPathMaskGenerator::computeScreenRect() -{ - poly = path().toFillPolygon(matrix()); - return poly.boundingRect().toAlignedRect(); -} - -QVector QGLPathMaskGenerator::generateTrapezoids() -{ - QOpenGLImmediateModeTessellator tessellator; - tessellator.tessellate(poly.data(), poly.count(), path().fillRule() == Qt::WindingFill); - return tessellator.trapezoids; -} - -QGLRectMaskGenerator::QGLRectMaskGenerator(const QPainterPath &path, const QTransform &matrix, QGLOffscreen &offs, GLuint program) - : QGLTrapezoidMaskGenerator(path, matrix, offs, program) -{ -} - -QGLLineMaskGenerator::QGLLineMaskGenerator(const QPainterPath &path, const QTransform &matrix, qreal width, QGLOffscreen &offs, GLuint program) - : QGLTrapezoidMaskGenerator(path, matrix, offs, program, width) -{ -} - -QRect QGLRectMaskGenerator::computeScreenRect() -{ - transformedPath = matrix().map(path()); - - return transformedPath.controlPointRect().adjusted(-1, -1, 1, 1).toAlignedRect(); -} - -QRect QGLLineMaskGenerator::computeScreenRect() -{ - transformedPath = matrix().map(path()); - - return transformedPath.controlPointRect().adjusted(-1, -1, 1, 1).toAlignedRect(); -} - -QVector QGLLineMaskGenerator::generateTrapezoids() -{ - QOpenGLImmediateModeTessellator tessellator; - QPointF last; - for (int i = 0; i < transformedPath.elementCount(); ++i) { - QPainterPath::Element element = transformedPath.elementAt(i); - - Q_ASSERT(!element.isCurveTo()); - - if (element.isLineTo()) - tessellator.tessellateRect(last, element, strokeWidth()); - - last = element; - } - - return tessellator.trapezoids; -} - -QVector QGLRectMaskGenerator::generateTrapezoids() -{ - Q_ASSERT(transformedPath.elementCount() == 5); - - QOpenGLImmediateModeTessellator tessellator; - if (matrix().type() <= QTransform::TxScale) { - QPointF a = transformedPath.elementAt(0); - QPointF b = transformedPath.elementAt(1); - QPointF c = transformedPath.elementAt(2); - QPointF d = transformedPath.elementAt(3); - - QPointF first = (a + d) * 0.5; - QPointF last = (b + c) * 0.5; - - QPointF delta = a - d; - - // manhattan distance (no rotation) - qreal width = qAbs(delta.x()) + qAbs(delta.y()); - - Q_ASSERT(qFuzzyIsNull(delta.x()) || qFuzzyIsNull(delta.y())); - - tessellator.tessellateRect(first, last, width); - } else { - QPointF points[5]; - - for (int i = 0; i < 5; ++i) - points[i] = transformedPath.elementAt(i); - - tessellator.tessellateConvex(points, 5); - } - return tessellator.trapezoids; -} - -static QPainterPath ellipseRectToPath(const QRectF &rect) -{ - QPainterPath path; - path.addEllipse(rect); - return path; -} - -QGLEllipseMaskGenerator::QGLEllipseMaskGenerator(const QRectF &rect, const QTransform &matrix, QGLOffscreen &offs, GLuint program, int *locations) - : QGLMaskGenerator(ellipseRectToPath(rect), matrix), - ellipseRect(rect), - offscreen(&offs), - maskFragmentProgram(program), - maskVariableLocations(locations) -{ -} - -QRect QGLEllipseMaskGenerator::screenRect() -{ - QPointF center = ellipseRect.center(); - - QPointF points[] = { - QPointF(ellipseRect.left(), center.y()), - QPointF(ellipseRect.right(), center.y()), - QPointF(center.x(), ellipseRect.top()), - QPointF(center.x(), ellipseRect.bottom()) - }; - - qreal min_screen_delta_len = QREAL_MAX; - - for (int i = 0; i < 4; ++i) { - QPointF delta = points[i] - center; - - // normalize - delta /= qSqrt(delta.x() * delta.x() + delta.y() * delta.y()); - - QPointF screen_delta(matrix().m11() * delta.x() + matrix().m21() * delta.y(), - matrix().m12() * delta.x() + matrix().m22() * delta.y()); - - min_screen_delta_len = qMin(min_screen_delta_len, - qreal(qSqrt(screen_delta.x() * screen_delta.x() + screen_delta.y() * screen_delta.y()))); - } - - const qreal padding = 2.0f; - - qreal grow = padding / min_screen_delta_len; - - QRectF boundingRect = ellipseRect.adjusted(-grow, -grow, grow, grow); - - boundingRect = matrix().mapRect(boundingRect); - - QPointF p(0.5, 0.5); - - screen_rect = QRect((boundingRect.topLeft() - p).toPoint(), - (boundingRect.bottomRight() + p).toPoint()); - - return screen_rect; -} - -void QGLEllipseMaskGenerator::drawMask(const QRect &rect) -{ -#ifdef QT_OPENGL_ES - Q_UNUSED(rect); -#else - QGLContext *ctx = offscreen->context(); - offscreen->bind(); - - glDisable(GL_TEXTURE_GEN_S); - glDisable(GL_TEXTURE_1D); - - // fragment program needs the inverse radii of the ellipse - glTexCoord2f(1.0f / (ellipseRect.width() * 0.5f), - 1.0f / (ellipseRect.height() * 0.5f)); - - QTransform translate(1, 0, 0, 1, -ellipseRect.center().x(), -ellipseRect.center().y()); - QTransform gl_to_qt(1, 0, 0, -1, 0, offscreen->drawableSize().height()); - QTransform inv_matrix = gl_to_qt * matrix().inverted() * translate; - - float m[3][4] = { { float(inv_matrix.m11()), float(inv_matrix.m12()), float(inv_matrix.m13()) }, - { float(inv_matrix.m21()), float(inv_matrix.m22()), float(inv_matrix.m23()) }, - { float(inv_matrix.m31()), float(inv_matrix.m32()), float(inv_matrix.m33()) } }; - - QPoint offs(screen_rect.left() - rect.left(), (offscreen->drawableSize().height() - screen_rect.top()) - - (offscreen->offscreenSize().height() - rect.top())); - - // last component needs to be 1.0f to avoid Nvidia bug on linux - float ellipse_offset[4] = { float(offs.x()), float(offs.y()), 0.0f, 1.0f }; - - GLfloat vertexArray[4 * 2]; - qt_add_rect_to_array(rect, vertexArray); - - glBlendFunc(GL_ONE, GL_ZERO); // set mask - glEnable(GL_FRAGMENT_PROGRAM_ARB); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, maskFragmentProgram); - - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, maskVariableLocations[VAR_INV_MATRIX_M0], m[0]); - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, maskVariableLocations[VAR_INV_MATRIX_M1], m[1]); - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, maskVariableLocations[VAR_INV_MATRIX_M2], m[2]); - - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, maskVariableLocations[VAR_ELLIPSE_OFFSET], ellipse_offset); - - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glDisableClientState(GL_VERTEX_ARRAY); - glDisable(GL_FRAGMENT_PROGRAM_ARB); -#endif -} - -void QOpenGLPaintEnginePrivate::drawOffscreenPath(const QPainterPath &path) -{ -#ifdef Q_WS_QWS - Q_UNUSED(path); -#else - DEBUG_ONCE_STR("QOpenGLPaintEnginePrivate::drawOffscreenPath()"); - - disableClipping(); - - GLuint program = qt_gl_program_cache()->getProgram(device->context(), - FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA, 0, true); - QGLPathMaskGenerator maskGenerator(path, matrix, offscreen, program); - addItem(qt_mask_texture_cache()->getMask(maskGenerator, this)); - - enableClipping(); -#endif -} - -void QOpenGLPaintEnginePrivate::drawFastRect(const QRectF &r) -{ - Q_Q(QOpenGLPaintEngine); - DEBUG_ONCE_STR("QOpenGLPaintEngine::drawRects(): drawing fast rect"); - - GLfloat vertexArray[10]; - qt_add_rect_to_array(r, vertexArray); - - if (has_pen) - QOpenGLCoordinateOffset::enableOffset(this); - - if (has_brush) { - flushDrawQueue(); - - bool temp = high_quality_antialiasing; - high_quality_antialiasing = false; - - q->updateCompositionMode(composition_mode); - - setGradientOps(cbrush, r); - - bool fast_style = current_style == Qt::LinearGradientPattern - || current_style == Qt::SolidPattern; - - if (fast_style && has_fast_composition_mode) { - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glDisableClientState(GL_VERTEX_ARRAY); - } else { - composite(r); - } - - high_quality_antialiasing = temp; - - q->updateCompositionMode(composition_mode); - } - - if (has_pen) { - if (has_fast_pen && !high_quality_antialiasing) { - setGradientOps(cpen.brush(), r); - - vertexArray[8] = vertexArray[0]; - vertexArray[9] = vertexArray[1]; - - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - glEnableClientState(GL_VERTEX_ARRAY); - glDrawArrays(GL_LINE_STRIP, 0, 5); - glDisableClientState(GL_VERTEX_ARRAY); - } else { - QPainterPath path; - path.setFillRule(Qt::WindingFill); - - qreal left = r.left(); - qreal right = r.right(); - qreal top = r.top(); - qreal bottom = r.bottom(); - - path.moveTo(left, top); - path.lineTo(right, top); - path.lineTo(right, bottom); - path.lineTo(left, bottom); - path.lineTo(left, top); - - strokePath(path, false); - } - - QOpenGLCoordinateOffset::disableOffset(this); - } -} - -bool QOpenGLPaintEnginePrivate::isFastRect(const QRectF &rect) -{ - if (matrix.type() < QTransform::TxRotate) { - QRectF r = matrix.mapRect(rect); - return r.topLeft().toPoint() == r.topLeft() - && r.bottomRight().toPoint() == r.bottomRight(); - } - - return false; -} - -void QOpenGLPaintEngine::drawRects(const QRect *rects, int rectCount) -{ - struct RectF { - qreal x; - qreal y; - qreal w; - qreal h; - }; - Q_ASSERT(sizeof(RectF) == sizeof(QRectF)); - RectF fr[256]; - while (rectCount) { - int i = 0; - while (i < rectCount && i < 256) { - fr[i].x = rects[i].x(); - fr[i].y = rects[i].y(); - fr[i].w = rects[i].width(); - fr[i].h = rects[i].height(); - ++i; - } - drawRects((QRectF *)(void *)fr, i); - rects += i; - rectCount -= i; - } -} - -void QOpenGLPaintEngine::drawRects(const QRectF *rects, int rectCount) -{ - Q_D(QOpenGLPaintEngine); - - if (d->use_emulation) { - QPaintEngineEx::drawRects(rects, rectCount); - return; - } - - for (int i=0; ihigh_quality_antialiasing || d->isFastRect(r)) { - d->drawFastRect(r); - } else { - QPainterPath path; - path.addRect(r); - - if (d->has_brush) { - d->disableClipping(); - GLuint program = qt_gl_program_cache()->getProgram(d->device->context(), - FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA, 0, true); - - if (d->matrix.type() >= QTransform::TxProject) { - QGLPathMaskGenerator maskGenerator(path, d->matrix, d->offscreen, program); - d->addItem(qt_mask_texture_cache()->getMask(maskGenerator, d)); - } else { - QGLRectMaskGenerator maskGenerator(path, d->matrix, d->offscreen, program); - d->addItem(qt_mask_texture_cache()->getMask(maskGenerator, d)); - } - - d->enableClipping(); - } - - if (d->has_pen) { - if (d->has_fast_pen) - d->strokeLines(path); - else - d->strokePath(path, false); - } - } - } -} - -static void addQuadAsTriangle(GLfloat *quad, GLfloat *triangle) -{ - triangle[0] = quad[0]; - triangle[1] = quad[1]; - - triangle[2] = quad[2]; - triangle[3] = quad[3]; - - triangle[4] = quad[4]; - triangle[5] = quad[5]; - - triangle[6] = quad[4]; - triangle[7] = quad[5]; - - triangle[8] = quad[6]; - triangle[9] = quad[7]; - - triangle[10] = quad[0]; - triangle[11] = quad[1]; -} - -void QOpenGLPaintEngine::drawPoints(const QPoint *points, int pointCount) -{ - Q_ASSERT(sizeof(QT_PointF) == sizeof(QPointF)); - QT_PointF fp[256]; - while (pointCount) { - int i = 0; - while (i < pointCount && i < 256) { - fp[i].x = points[i].x(); - fp[i].y = points[i].y(); - ++i; - } - drawPoints((QPointF *)(void *)fp, i); - points += i; - pointCount -= i; - } -} - -void QOpenGLPaintEngine::drawPoints(const QPointF *points, int pointCount) -{ - Q_D(QOpenGLPaintEngine); - - if (d->use_emulation) { - QPaintEngineEx::drawPoints(points, pointCount); - return; - } - - d->setGradientOps(d->cpen.brush(), QRectF()); - - if (!d->cpen.isCosmetic() || d->high_quality_antialiasing) { - Qt::PenCapStyle capStyle = d->cpen.capStyle(); - if (capStyle == Qt::FlatCap) - d->cpen.setCapStyle(Qt::SquareCap); - QPaintEngine::drawPoints(points, pointCount); - d->cpen.setCapStyle(capStyle); - return; - } - - d->flushDrawQueue(); - - if (d->has_fast_pen) { - QVarLengthArray vertexArray(6 * pointCount); - - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - int j = 0; - for (int i = 0; i < pointCount; ++i) { - QPointF mapped = d->matrix.map(points[i]); - - GLfloat x = GLfloat(qRound(mapped.x())); - GLfloat y = GLfloat(qRound(mapped.y())); - - vertexArray[j++] = x; - vertexArray[j++] = y - 0.5f; - - vertexArray[j++] = x + 1.5f; - vertexArray[j++] = y + 1.0f; - - vertexArray[j++] = x; - vertexArray[j++] = y + 1.0f; - } - - glEnableClientState(GL_VERTEX_ARRAY); - - glVertexPointer(2, GL_FLOAT, 0, vertexArray.constData()); - glDrawArrays(GL_TRIANGLES, 0, pointCount*3); - - glDisableClientState(GL_VERTEX_ARRAY); - - glPopMatrix(); - return; - } - - const qreal *vertexArray = reinterpret_cast(&points[0]); - - if (sizeof(qreal) == sizeof(double)) { - Q_ASSERT(sizeof(QPointF) == 16); - glVertexPointer(2, GL_DOUBLE, 0, vertexArray); - } - else { - Q_ASSERT(sizeof(QPointF) == 8); - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - } - - glEnableClientState(GL_VERTEX_ARRAY); - glDrawArrays(GL_POINTS, 0, pointCount); - glDisableClientState(GL_VERTEX_ARRAY); -} - -void QOpenGLPaintEngine::drawLines(const QLine *lines, int lineCount) -{ - struct PointF { - qreal x; - qreal y; - }; - struct LineF { - PointF p1; - PointF p2; - }; - Q_ASSERT(sizeof(PointF) == sizeof(QPointF)); - Q_ASSERT(sizeof(LineF) == sizeof(QLineF)); - LineF fl[256]; - while (lineCount) { - int i = 0; - while (i < lineCount && i < 256) { - fl[i].p1.x = lines[i].x1(); - fl[i].p1.y = lines[i].y1(); - fl[i].p2.x = lines[i].x2(); - fl[i].p2.y = lines[i].y2(); - ++i; - } - drawLines((QLineF *)(void *)fl, i); - lines += i; - lineCount -= i; - } -} - -void QOpenGLPaintEngine::drawLines(const QLineF *lines, int lineCount) -{ - Q_D(QOpenGLPaintEngine); - - if (d->use_emulation) { - QPaintEngineEx::drawLines(lines, lineCount); - return; - } - - if (d->has_pen) { - QOpenGLCoordinateOffset offset(d); - if (d->has_fast_pen && !d->high_quality_antialiasing) { - //### gradient resolving on lines isn't correct - d->setGradientOps(d->cpen.brush(), QRectF()); - - bool useRects = false; - // scale or 90 degree rotation? - if (d->matrix.type() <= QTransform::TxTranslate - || (!d->cpen.isCosmetic() - && (d->matrix.type() <= QTransform::TxScale - || (d->matrix.type() == QTransform::TxRotate - && d->matrix.m11() == 0 && d->matrix.m22() == 0)))) { - useRects = true; - for (int i = 0; i < lineCount; ++i) { - if (lines[i].p1().x() != lines[i].p2().x() - && lines[i].p1().y() != lines[i].p2().y()) { - useRects = false; - break; - } - } - } - - GLfloat endCap = d->cpen.capStyle() == Qt::FlatCap ? 0.0f : 0.5f; - if (useRects) { - QVarLengthArray vertexArray(12 * lineCount); - - GLfloat quad[8]; - for (int i = 0; i < lineCount; ++i) { - GLfloat x1 = lines[i].x1(); - GLfloat x2 = lines[i].x2(); - GLfloat y1 = lines[i].y1(); - GLfloat y2 = lines[i].y2(); - - if (x1 == x2) { - if (y1 > y2) - qSwap(y1, y2); - - quad[0] = x1 - 0.5f; - quad[1] = y1 - endCap; - - quad[2] = x1 + 0.5f; - quad[3] = y1 - endCap; - - quad[4] = x1 + 0.5f; - quad[5] = y2 + endCap; - - quad[6] = x1 - 0.5f; - quad[7] = y2 + endCap; - } else { - if (x1 > x2) - qSwap(x1, x2); - - quad[0] = x1 - endCap; - quad[1] = y1 + 0.5f; - - quad[2] = x1 - endCap; - quad[3] = y1 - 0.5f; - - quad[4] = x2 + endCap; - quad[5] = y1 - 0.5f; - - quad[6] = x2 + endCap; - quad[7] = y1 + 0.5f; - } - - addQuadAsTriangle(quad, &vertexArray[12*i]); - } - - glEnableClientState(GL_VERTEX_ARRAY); - - glVertexPointer(2, GL_FLOAT, 0, vertexArray.constData()); - glDrawArrays(GL_TRIANGLES, 0, lineCount*6); - - glDisableClientState(GL_VERTEX_ARRAY); - } else { - QVarLengthArray vertexArray(4 * lineCount); - for (int i = 0; i < lineCount; ++i) { - const QPointF a = lines[i].p1(); - vertexArray[4*i] = lines[i].x1(); - vertexArray[4*i+1] = lines[i].y1(); - vertexArray[4*i+2] = lines[i].x2(); - vertexArray[4*i+3] = lines[i].y2(); - } - - glEnableClientState(GL_VERTEX_ARRAY); - - glVertexPointer(2, GL_FLOAT, 0, vertexArray.constData()); - glDrawArrays(GL_LINES, 0, lineCount*2); - - glVertexPointer(2, GL_FLOAT, 4*sizeof(GLfloat), vertexArray.constData() + 2); - glDrawArrays(GL_POINTS, 0, lineCount); - - glDisableClientState(GL_VERTEX_ARRAY); - } - } else { - QPainterPath path; - path.setFillRule(Qt::WindingFill); - for (int i=0; icpen.capStyle() != Qt::FlatCap) { - QPointF p = l.p1(); - drawPoints(&p, 1); - } - continue; - } - - path.moveTo(l.x1(), l.y1()); - path.lineTo(l.x2(), l.y2()); - } - - if (d->has_fast_pen && d->high_quality_antialiasing) - d->strokeLines(path); - else - d->strokePath(path, false); - } - } -} - -void QOpenGLPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) -{ - Q_ASSERT(sizeof(QT_PointF) == sizeof(QPointF)); - QVarLengthArray p(pointCount); - for (int i=0; iuse_emulation) { - QPaintEngineEx::drawPolygon(points, pointCount, mode); - return; - } - - QRectF bounds; - if ((mode == ConvexMode && !d->high_quality_antialiasing && state()->brushNeedsResolving()) || - ((d->has_fast_pen && !d->high_quality_antialiasing) && state()->penNeedsResolving())) { - qreal minx = points[0].x(), miny = points[0].y(), - maxx = points[0].x(), maxy = points[0].y(); - for (int i = 1; i < pointCount; ++i) { - const QPointF &pt = points[i]; - if (minx > pt.x()) - minx = pt.x(); - if (miny > pt.y()) - miny = pt.y(); - if (maxx < pt.x()) - maxx = pt.x(); - if (maxy < pt.y()) - maxy = pt.y(); - } - bounds = QRectF(minx, maxx, maxx-minx, maxy-miny); - } - - QOpenGLCoordinateOffset offset(d); - - if (d->has_brush && mode != PolylineMode) { - if (mode == ConvexMode && !d->high_quality_antialiasing) { - //### resolving on polygon from points isn't correct - d->setGradientOps(d->cbrush, bounds); - - const qreal *vertexArray = reinterpret_cast(&points[0]); - - if (sizeof(qreal) == sizeof(double)) { - Q_ASSERT(sizeof(QPointF) == 16); - glVertexPointer(2, GL_DOUBLE, 0, vertexArray); - } - else { - Q_ASSERT(sizeof(QPointF) == 8); - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - } - - glEnableClientState(GL_VERTEX_ARRAY); - glDrawArrays(GL_TRIANGLE_FAN, 0, pointCount); - glDisableClientState(GL_VERTEX_ARRAY); - } else { - QPainterPath path; - path.setFillRule(mode == WindingMode ? Qt::WindingFill : Qt::OddEvenFill); - path.moveTo(points[0]); - for (int i=1; ifillPath(path); - } - } - - if (d->has_pen) { - if (d->has_fast_pen && !d->high_quality_antialiasing) { - d->setGradientOps(d->cpen.brush(), bounds); - QVarLengthArray vertexArray(pointCount*2 + 2); - glVertexPointer(2, GL_FLOAT, 0, vertexArray.constData()); - int i; - for (i=0; ihas_fast_pen) - d->strokeLines(path); - else - d->strokePath(path, true); - } - } -} - -void QOpenGLPaintEnginePrivate::strokeLines(const QPainterPath &path) -{ - DEBUG_ONCE_STR("QOpenGLPaintEnginePrivate::strokeLines()"); - - qreal penWidth = cpen.widthF(); - - GLuint program = qt_gl_program_cache()->getProgram(device->context(), - FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA, 0, true); - QGLLineMaskGenerator maskGenerator(path, matrix, penWidth == 0 ? 1.0 : penWidth, - offscreen, program); - - disableClipping(); - - QBrush temp = cbrush; - QPointF origin = brush_origin; - - cbrush = cpen.brush(); - brush_origin = QPointF(); - - addItem(qt_mask_texture_cache()->getMask(maskGenerator, this)); - - cbrush = temp; - brush_origin = origin; - - enableClipping(); -} - -Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp - -void QOpenGLPaintEnginePrivate::strokePath(const QPainterPath &path, bool use_cache) -{ - QBrush old_brush = cbrush; - cbrush = cpen.brush(); - - qreal txscale = 1; - if (cpen.isCosmetic() || (qt_scaleForTransform(matrix, &txscale) && txscale != 1)) { - QTransform temp = matrix; - matrix = QTransform(); - glPushMatrix(); - - if (has_antialiasing) { - glLoadIdentity(); - } else { - float offs_matrix[] = - { 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0.5, 0.5, 0, 1 }; - glLoadMatrixf(offs_matrix); - } - - QPen pen = cpen; - if (txscale != 1) - pen.setWidthF(pen.widthF() * txscale); - if (use_cache) - fillPath(qt_opengl_stroke_cache()->getStrokedPath(temp.map(path), pen)); - else - fillPath(strokeForPath(temp.map(path), pen)); - - glPopMatrix(); - matrix = temp; - } else if (use_cache) { - fillPath(qt_opengl_stroke_cache()->getStrokedPath(path, cpen)); - } else { - fillPath(strokeForPath(path, cpen)); - } - - cbrush = old_brush; -} - -void QOpenGLPaintEnginePrivate::strokePathFastPen(const QPainterPath &path, bool needsResolving) -{ -#ifndef QT_OPENGL_ES - QRectF bounds; - if (needsResolving) - bounds = path.controlPointRect(); - setGradientOps(cpen.brush(), bounds); - - QBezier beziers[32]; - for (int i=0; i= beziers) { - // check if we can pop the top bezier curve from the stack - qreal l = qAbs(b->x4 - b->x1) + qAbs(b->y4 - b->y1); - qreal d; - if (l > inverseScale) { - d = qAbs( (b->x4 - b->x1)*(b->y1 - b->y2) - - (b->y4 - b->y1)*(b->x1 - b->x2) ) - + qAbs( (b->x4 - b->x1)*(b->y1 - b->y3) - - (b->y4 - b->y1)*(b->x1 - b->x3) ); - d /= l; - } else { - d = qAbs(b->x1 - b->x2) + qAbs(b->y1 - b->y2) + - qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3); - } - if (d < inverseScaleHalf || b == beziers + 31) { - // good enough, we pop it off and add the endpoint - glVertex2d(b->x4, b->y4); - --b; - } else { - // split, second half of the polygon goes lower into the stack - b->split(b+1, b); - ++b; - } - } - } // case CurveToElement - default: - break; - } // end of switch - } - glEnd(); // GL_LINE_STRIP -#else - // have to use vertex arrays on embedded - QRectF bounds; - if (needsResolving) - bounds = path.controlPointRect(); - setGradientOps(cpen.brush(), bounds); - - glEnableClientState(GL_VERTEX_ARRAY); - tess_points.reset(); - QBezier beziers[32]; - for (int i=0; i= beziers) { - // check if we can pop the top bezier curve from the stack - qreal l = qAbs(b->x4 - b->x1) + qAbs(b->y4 - b->y1); - qreal d; - if (l > inverseScale) { - d = qAbs( (b->x4 - b->x1)*(b->y1 - b->y2) - - (b->y4 - b->y1)*(b->x1 - b->x2) ) - + qAbs( (b->x4 - b->x1)*(b->y1 - b->y3) - - (b->y4 - b->y1)*(b->x1 - b->x3) ); - d /= l; - } else { - d = qAbs(b->x1 - b->x2) + qAbs(b->y1 - b->y2) + - qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3); - } - if (d < inverseScaleHalf || b == beziers + 31) { - // good enough, we pop it off and add the endpoint - tess_points.add(QPointF(b->x4, b->y4)); - --b; - } else { - // split, second half of the polygon goes lower into the stack - b->split(b+1, b); - ++b; - } - } - } // case CurveToElement - default: - break; - } // end of switch - } - glVertexPointer(2, GL_FLOAT, 0, tess_points.data()); - glDrawArrays(GL_LINE_STRIP, 0, tess_points.size()); - glDisableClientState(GL_VERTEX_ARRAY); -#endif -} - -static bool pathClosed(const QPainterPath &path) -{ - QPointF lastMoveTo = path.elementAt(0); - QPointF lastPoint = lastMoveTo; - - for (int i = 1; i < path.elementCount(); ++i) { - const QPainterPath::Element &e = path.elementAt(i); - switch (e.type) { - case QPainterPath::MoveToElement: - if (lastMoveTo != lastPoint) - return false; - lastMoveTo = lastPoint = e; - break; - case QPainterPath::LineToElement: - lastPoint = e; - break; - case QPainterPath::CurveToElement: - lastPoint = path.elementAt(i + 2); - i+=2; - break; - default: - break; - } - } - - return lastMoveTo == lastPoint; -} - -void QOpenGLPaintEngine::drawPath(const QPainterPath &path) -{ - Q_D(QOpenGLPaintEngine); - - if (path.isEmpty()) - return; - - if (d->use_emulation) { - QPaintEngineEx::drawPath(path); - return; - } - - QOpenGLCoordinateOffset offset(d); - - if (d->has_brush) { - bool path_closed = pathClosed(path); - - bool has_thick_pen = - path_closed - && d->has_pen - && d->cpen.style() == Qt::SolidLine - && d->cpen.isSolid() - && d->cpen.color().alpha() == 255 - && d->txop < QTransform::TxProject - && d->cpen.widthF() >= 2 / qSqrt(qMin(d->matrix.m11() * d->matrix.m11() - + d->matrix.m21() * d->matrix.m21(), - d->matrix.m12() * d->matrix.m12() - + d->matrix.m22() * d->matrix.m22())); - - if (has_thick_pen) { - DEBUG_ONCE qDebug() << "QOpenGLPaintEngine::drawPath(): Using thick pen optimization, style:" << d->cbrush.style(); - - d->flushDrawQueue(); - - bool temp = d->high_quality_antialiasing; - d->high_quality_antialiasing = false; - - updateCompositionMode(d->composition_mode); - - d->fillPath(path); - - d->high_quality_antialiasing = temp; - updateCompositionMode(d->composition_mode); - } else { - d->fillPath(path); - } - } - - if (d->has_pen) { - if (d->has_fast_pen && !d->high_quality_antialiasing) - d->strokePathFastPen(path, state()->penNeedsResolving()); - else - d->strokePath(path, true); - } -} - -void QOpenGLPaintEnginePrivate::drawImageAsPath(const QRectF &r, const QImage &img, const QRectF &sr) -{ - QBrush old_brush = cbrush; - QPointF old_brush_origin = brush_origin; - - qreal scaleX = r.width() / sr.width(); - qreal scaleY = r.height() / sr.height(); - - QTransform brush_matrix = QTransform::fromTranslate(r.left(), r.top()); - brush_matrix.scale(scaleX, scaleY); - brush_matrix.translate(-sr.left(), -sr.top()); - - cbrush = QBrush(img); - cbrush.setTransform(brush_matrix); - brush_origin = QPointF(); - - QPainterPath p; - p.addRect(r); - fillPath(p); - - cbrush = old_brush; - brush_origin = old_brush_origin; -} - -void QOpenGLPaintEnginePrivate::drawTiledImageAsPath(const QRectF &r, const QImage &img, qreal sx, qreal sy, - const QPointF &offset) -{ - QBrush old_brush = cbrush; - QPointF old_brush_origin = brush_origin; - - QTransform brush_matrix = QTransform::fromTranslate(r.left(), r.top()); - brush_matrix.scale(sx, sy); - brush_matrix.translate(-offset.x(), -offset.y()); - - cbrush = QBrush(img); - cbrush.setTransform(brush_matrix); - brush_origin = QPointF(); - - QPainterPath p; - p.addRect(r); - fillPath(p); - - cbrush = old_brush; - brush_origin = old_brush_origin; -} - -static const QRectF scaleRect(const QRectF &r, qreal sx, qreal sy) -{ - return QRectF(r.x() * sx, r.y() * sy, r.width() * sx, r.height() * sy); -} - -template -static const T qSubImage(const T &image, const QRectF &src, QRectF *srcNew) -{ - const int sx1 = qMax(0, qFloor(src.left())); - const int sy1 = qMax(0, qFloor(src.top())); - const int sx2 = qMin(image.width(), qCeil(src.right())); - const int sy2 = qMin(image.height(), qCeil(src.bottom())); - - const T sub = image.copy(sx1, sy1, sx2 - sx1, sy2 - sy1); - - if (srcNew) - *srcNew = src.translated(-sx1, -sy1); - - return sub; -} - -void QOpenGLPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) -{ - Q_D(QOpenGLPaintEngine); - if (pm.depth() == 1) { - QPixmap tpx(pm.size()); - tpx.fill(Qt::transparent); - QPainter p(&tpx); - p.setPen(d->cpen); - p.drawPixmap(0, 0, pm); - p.end(); - drawPixmap(r, tpx, sr); - return; - } - - const int sz = d->max_texture_size; - if (pm.width() > sz || pm.height() > sz) { - QRectF subsr; - const QPixmap sub = qSubImage(pm, sr, &subsr); - - if (sub.width() <= sz && sub.height() <= sz) { - drawPixmap(r, sub, subsr); - } else { - const QPixmap scaled = sub.scaled(sz, sz, Qt::KeepAspectRatio); - const qreal sx = scaled.width() / qreal(sub.width()); - const qreal sy = scaled.height() / qreal(sub.height()); - - drawPixmap(r, scaled, scaleRect(subsr, sx, sy)); - } - return; - } - - - if (d->composition_mode > QPainter::CompositionMode_Plus || (d->high_quality_antialiasing && !d->isFastRect(r))) - d->drawImageAsPath(r, pm.toImage(), sr); - else { - GLenum target = qt_gl_preferredTextureTarget(); - d->flushDrawQueue(); - QGLTexture *tex = - d->device->context()->d_func()->bindTexture(pm, target, GL_RGBA, - QGLContext::InternalBindOption); - drawTextureRect(pm.width(), pm.height(), r, sr, target, tex); - } -} - -void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &offset) -{ - Q_D(QOpenGLPaintEngine); - if (pm.depth() == 1) { - QPixmap tpx(pm.size()); - tpx.fill(Qt::transparent); - QPainter p(&tpx); - p.setPen(d->cpen); - p.drawPixmap(0, 0, pm); - p.end(); - drawTiledPixmap(r, tpx, offset); - return; - } - - QImage scaled; - const int sz = d->max_texture_size; - if (pm.width() > sz || pm.height() > sz) { - int rw = qCeil(r.width()); - int rh = qCeil(r.height()); - if (rw < pm.width() && rh < pm.height()) { - drawTiledPixmap(r, pm.copy(0, 0, rw, rh), offset); - return; - } - - scaled = pm.toImage().scaled(sz, sz, Qt::KeepAspectRatio); - } - - if (d->composition_mode > QPainter::CompositionMode_Plus || (d->high_quality_antialiasing && !d->isFastRect(r))) { - if (scaled.isNull()) - d->drawTiledImageAsPath(r, pm.toImage(), 1, 1, offset); - else { - const qreal sx = pm.width() / qreal(scaled.width()); - const qreal sy = pm.height() / qreal(scaled.height()); - d->drawTiledImageAsPath(r, scaled, sx, sy, offset); - } - } else { - d->flushDrawQueue(); - - QGLTexture *tex; - if (scaled.isNull()) - tex = d->device->context()->d_func()->bindTexture(pm, GL_TEXTURE_2D, GL_RGBA, - QGLContext::InternalBindOption); - else - tex = d->device->context()->d_func()->bindTexture(scaled, GL_TEXTURE_2D, GL_RGBA, - QGLContext::InternalBindOption); - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, d->use_smooth_pixmap_transform); - -#ifndef QT_OPENGL_ES - glPushAttrib(GL_CURRENT_BIT); - glDisable(GL_TEXTURE_GEN_S); -#endif - glColor4f(d->opacity, d->opacity, d->opacity, d->opacity); - glEnable(GL_TEXTURE_2D); - - GLdouble tc_w = r.width()/pm.width(); - GLdouble tc_h = r.height()/pm.height(); - - // Rotate the texture so that it is aligned correctly and the - // wrapping is done correctly - if (tex->options & QGLContext::InvertedYBindOption) { - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - glRotatef(180.0, 0.0, 1.0, 0.0); - glRotatef(180.0, 0.0, 0.0, 1.0); - } - - GLfloat vertexArray[4*2]; - GLfloat texCoordArray[4*2]; - - double offset_x = offset.x() / pm.width(); - double offset_y = offset.y() / pm.height(); - - qt_add_rect_to_array(r, vertexArray); - qt_add_texcoords_to_array(offset_x, offset_y, - tc_w + offset_x, tc_h + offset_y, texCoordArray); - - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - glTexCoordPointer(2, GL_FLOAT, 0, texCoordArray); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_VERTEX_ARRAY); - if (tex->options & QGLContext::InvertedYBindOption) - glPopMatrix(); - - glDisable(GL_TEXTURE_2D); -#ifndef QT_OPENGL_ES - glPopAttrib(); -#endif - } -} - -void QOpenGLPaintEngine::drawImage(const QRectF &r, const QImage &image, const QRectF &sr, - Qt::ImageConversionFlags) -{ - Q_D(QOpenGLPaintEngine); - - const int sz = d->max_texture_size; - if (image.width() > sz || image.height() > sz) { - QRectF subsr; - const QImage sub = qSubImage(image, sr, &subsr); - - if (sub.width() <= sz && sub.height() <= sz) { - drawImage(r, sub, subsr, 0); - } else { - const QImage scaled = sub.scaled(sz, sz, Qt::KeepAspectRatio); - const qreal sx = scaled.width() / qreal(sub.width()); - const qreal sy = scaled.height() / qreal(sub.height()); - - drawImage(r, scaled, scaleRect(subsr, sx, sy), 0); - } - return; - } - - if (d->composition_mode > QPainter::CompositionMode_Plus || (d->high_quality_antialiasing && !d->isFastRect(r))) - d->drawImageAsPath(r, image, sr); - else { - GLenum target = qt_gl_preferredTextureTarget(); - d->flushDrawQueue(); - QGLTexture *tex = - d->device->context()->d_func()->bindTexture(image, target, GL_RGBA, - QGLContext::InternalBindOption); - drawTextureRect(image.width(), image.height(), r, sr, target, tex); - } -} - -void QOpenGLPaintEngine::drawTextureRect(int tx_width, int tx_height, const QRectF &r, - const QRectF &sr, GLenum target, QGLTexture *tex) -{ - Q_D(QOpenGLPaintEngine); -#ifndef QT_OPENGL_ES - glPushAttrib(GL_CURRENT_BIT); - glDisable(GL_TEXTURE_GEN_S); -#endif - glColor4f(d->opacity, d->opacity, d->opacity, d->opacity); - glEnable(target); - updateTextureFilter(target, GL_CLAMP_TO_EDGE, d->use_smooth_pixmap_transform); - - qreal x1, x2, y1, y2; - if (target == GL_TEXTURE_2D) { - x1 = sr.x() / tx_width; - x2 = x1 + sr.width() / tx_width; - if (tex->options & QGLContext::InvertedYBindOption) { - y1 = 1 - (sr.bottom() / tx_height); - y2 = 1 - (sr.y() / tx_height); - } else { - y1 = sr.bottom() / tx_height; - y2 = sr.y() / tx_height; - } - } else { - x1 = sr.x(); - x2 = sr.right(); - y1 = sr.bottom(); - y2 = sr.y(); - } - - GLfloat vertexArray[4*2]; - GLfloat texCoordArray[4*2]; - - qt_add_rect_to_array(r, vertexArray); - qt_add_texcoords_to_array(x1, y2, x2, y1, texCoordArray); - - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - glTexCoordPointer(2, GL_FLOAT, 0, texCoordArray); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_VERTEX_ARRAY); - - glDisable(target); -#ifndef QT_OPENGL_ES - glPopAttrib(); -#endif -} - -#ifdef Q_WS_WIN -HDC -#else -Qt::HANDLE -#endif -QOpenGLPaintEngine::handle() const -{ - return 0; -} - -static const int x_margin = 1; -static const int y_margin = 0; - -struct QGLGlyphCoord { - // stores the offset and size of a glyph texture - qreal x; - qreal y; - qreal width; - qreal height; - qreal log_width; - qreal log_height; - QFixed x_offset; - QFixed y_offset; -}; - -struct QGLFontTexture { - int x_offset; // glyph offset within the - int y_offset; - GLuint texture; - int width; - int height; -}; - -typedef QHash QGLGlyphHash; -typedef QHash QGLFontGlyphHash; -typedef QHash QGLFontTexHash; -typedef QHash QGLContextHash; - -static inline void qt_delete_glyph_hash(QGLGlyphHash *hash) -{ - qDeleteAll(*hash); - delete hash; -} - -class QGLGlyphCache : public QObject -{ - Q_OBJECT -public: - QGLGlyphCache() : QObject(0) { current_cache = 0; } - ~QGLGlyphCache(); - QGLGlyphCoord *lookup(QFontEngine *, glyph_t); - void cacheGlyphs(QGLContext *, QFontEngine *, glyph_t *glyphs, int numGlyphs); - void cleanCache(); - void allocTexture(int width, int height, GLuint texture); - -public slots: - void cleanupContext(const QGLContext *); - void fontEngineDestroyed(QObject *); - void widgetDestroyed(QObject *); - -protected: - QGLGlyphHash *current_cache; - QGLFontTexHash qt_font_textures; - QGLContextHash qt_context_cache; -}; - -QGLGlyphCache::~QGLGlyphCache() -{ -// qDebug() << "cleaning out the QGLGlyphCache"; - cleanCache(); -} - -void QGLGlyphCache::fontEngineDestroyed(QObject *o) -{ -// qDebug() << "fontEngineDestroyed()"; - QFontEngine *fe = static_cast(o); // safe, since only the type is used - QList keys = qt_context_cache.keys(); - const QGLContext *ctx = 0; - - for (int i=0; i < keys.size(); ++i) { - QGLFontGlyphHash *font_cache = qt_context_cache.value(keys.at(i)); - if (font_cache->find(fe) != font_cache->end()) { - ctx = keys.at(i); - QGLGlyphHash *cache = font_cache->take(fe); - qt_delete_glyph_hash(cache); - break; - } - } - - quint64 font_key = (reinterpret_cast(ctx) << 32) | reinterpret_cast(fe); - QGLFontTexture *tex = qt_font_textures.take(font_key); - if (tex) { -#ifdef Q_WS_MAC - if ( -# ifndef QT_MAC_USE_COCOA - aglGetCurrentContext() != 0 -# else - qt_current_nsopengl_context() != 0 -# endif - ) -#endif - glDeleteTextures(1, &tex->texture); - delete tex; - } -} - -void QGLGlyphCache::widgetDestroyed(QObject *) -{ -// qDebug() << "widget destroyed"; - cleanCache(); // ### -} - -void QGLGlyphCache::cleanupContext(const QGLContext *ctx) -{ -// qDebug() << "==> cleaning for: " << hex << ctx; - QGLFontGlyphHash *font_cache = qt_context_cache.take(ctx); - - if (font_cache) { - QList keys = font_cache->keys(); - for (int i=0; i < keys.size(); ++i) { - QFontEngine *fe = keys.at(i); - qt_delete_glyph_hash(font_cache->take(fe)); - quint64 font_key = (reinterpret_cast(ctx) << 32) | reinterpret_cast(fe); - QGLFontTexture *font_tex = qt_font_textures.take(font_key); - if (font_tex) { -#ifdef Q_WS_MAC - if ( -# ifndef QT_MAC_USE_COCOA - aglGetCurrentContext() == 0 -# else - qt_current_nsopengl_context() != 0 -# endif - ) -#endif - glDeleteTextures(1, &font_tex->texture); - delete font_tex; - } - } - delete font_cache; - } -// qDebug() << "<=== done cleaning, num tex:" << qt_font_textures.size() << "num ctx:" << qt_context_cache.size(); -} - -void QGLGlyphCache::cleanCache() -{ - QGLFontTexHash::const_iterator it = qt_font_textures.constBegin(); - if (QGLContext::currentContext()) { - while (it != qt_font_textures.constEnd()) { -#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) - if (qt_current_nsopengl_context() == 0) - break; -#endif - glDeleteTextures(1, &it.value()->texture); - ++it; - } - } - qDeleteAll(qt_font_textures); - qt_font_textures.clear(); - - QList keys = qt_context_cache.keys(); - for (int i=0; i < keys.size(); ++i) { - QGLFontGlyphHash *font_cache = qt_context_cache.value(keys.at(i)); - QGLFontGlyphHash::Iterator it = font_cache->begin(); - for (; it != font_cache->end(); ++it) - qt_delete_glyph_hash(it.value()); - font_cache->clear(); - } - qDeleteAll(qt_context_cache); - qt_context_cache.clear(); -} - -void QGLGlyphCache::allocTexture(int width, int height, GLuint texture) -{ - uchar *tex_data = (uchar *) malloc(width*height*2); - memset(tex_data, 0, width*height*2); - glBindTexture(GL_TEXTURE_2D, texture); -#ifndef QT_OPENGL_ES - glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8_ALPHA8, - width, height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, tex_data); -#else - glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, - width, height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, tex_data); -#endif - free(tex_data); -} - -#if 0 -// useful for debugging the glyph cache -static QImage getCurrentTexture(const QColor &color, QGLFontTexture *font_tex) -{ - ushort *old_tex_data = (ushort *) malloc(font_tex->width*font_tex->height*2); - glGetTexImage(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, old_tex_data); - QImage im(font_tex->width, font_tex->height, QImage::Format_ARGB32); - for (int y=0; yheight; ++y) { - for (int x=0; xwidth; ++x) { - im.setPixel(x, y, ((*(old_tex_data+x+y*font_tex->width)) << 24) | (0x00ffffff & color.rgb())); - } - } - delete old_tex_data; - return im; -} -#endif - -void QGLGlyphCache::cacheGlyphs(QGLContext *context, QFontEngine *fontEngine, - glyph_t *glyphs, int numGlyphs) -{ - QGLContextHash::const_iterator dev_it = qt_context_cache.constFind(context); - QGLFontGlyphHash *font_cache = 0; - const QGLContext *context_key = 0; - - if (dev_it == qt_context_cache.constEnd()) { - // check for shared contexts - QList contexts = qt_context_cache.keys(); - for (int i=0; iisValid()) { - if (context->device() && context->device()->devType() == QInternal::Widget) { - QWidget *widget = static_cast(context->device()); - connect(widget, SIGNAL(destroyed(QObject*)), SLOT(widgetDestroyed(QObject*))); - } - connect(QGLSignalProxy::instance(), - SIGNAL(aboutToDestroyContext(const QGLContext*)), - SLOT(cleanupContext(const QGLContext*))); - } - } else { - font_cache = dev_it.value(); - } - Q_ASSERT(font_cache != 0); - - QGLFontGlyphHash::const_iterator cache_it = font_cache->constFind(fontEngine); - QGLGlyphHash *cache = 0; - if (cache_it == font_cache->constEnd()) { - cache = new QGLGlyphHash; - font_cache->insert(fontEngine, cache); - connect(fontEngine, SIGNAL(destroyed(QObject*)), SLOT(fontEngineDestroyed(QObject*))); - } else { - cache = cache_it.value(); - } - current_cache = cache; - - quint64 font_key = (reinterpret_cast(context_key ? context_key : context) << 32) - | reinterpret_cast(fontEngine); - QGLFontTexHash::const_iterator it = qt_font_textures.constFind(font_key); - QGLFontTexture *font_tex; - if (it == qt_font_textures.constEnd()) { - GLuint font_texture; - glGenTextures(1, &font_texture); - GLint tex_height = qt_next_power_of_two(qRound(fontEngine->ascent().toReal() + fontEngine->descent().toReal())+2); - GLint tex_width = qt_next_power_of_two(tex_height*30); // ### - GLint max_tex_size; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_tex_size); - Q_ASSERT(max_tex_size > 0); - if (tex_width > max_tex_size) - tex_width = max_tex_size; - allocTexture(tex_width, tex_height, font_texture); - font_tex = new QGLFontTexture; - font_tex->texture = font_texture; - font_tex->x_offset = x_margin; - font_tex->y_offset = y_margin; - font_tex->width = tex_width; - font_tex->height = tex_height; -// qDebug() << "new font tex - width:" << tex_width << "height:"<< tex_height -// << hex << "tex id:" << font_tex->texture << "key:" << font_key << "num cached:" << qt_font_textures.size(); - qt_font_textures.insert(font_key, font_tex); - } else { - font_tex = it.value(); - glBindTexture(GL_TEXTURE_2D, font_tex->texture); - } - - for (int i=0; i< numGlyphs; ++i) { - QGLGlyphHash::const_iterator it = cache->constFind(glyphs[i]); - if (it == cache->constEnd()) { - // render new glyph and put it in the cache - glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[i]); - int glyph_width = qRound(metrics.width.toReal())+2; - int glyph_height = qRound(fontEngine->ascent().toReal() + fontEngine->descent().toReal())+2; - - if (font_tex->x_offset + glyph_width + x_margin > font_tex->width) { - int strip_height = qt_next_power_of_two(qRound(fontEngine->ascent().toReal() + fontEngine->descent().toReal())+2); - font_tex->x_offset = x_margin; - font_tex->y_offset += strip_height; - if (font_tex->y_offset >= font_tex->height) { - // get hold of the old font texture - uchar *old_tex_data = (uchar *) malloc(font_tex->width*font_tex->height*2); - int old_tex_height = font_tex->height; -#ifndef QT_OPENGL_ES - glGetTexImage(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, old_tex_data); -#endif - - // realloc a larger texture - glDeleteTextures(1, &font_tex->texture); - glGenTextures(1, &font_tex->texture); - font_tex->height = qt_next_power_of_two(font_tex->height + strip_height); - allocTexture(font_tex->width, font_tex->height, font_tex->texture); - - // write back the old texture data - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, font_tex->width, old_tex_height, - GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, old_tex_data); - free(old_tex_data); - - // update the texture coords and the y offset for the existing glyphs in - // the cache, because of the texture size change - QGLGlyphHash::iterator it = cache->begin(); - while (it != cache->end()) { - it.value()->height = (it.value()->height * old_tex_height) / font_tex->height; - it.value()->y = (it.value()->y * old_tex_height) / font_tex->height; - ++it; - } - } - } - - QImage glyph_im(fontEngine->alphaMapForGlyph(glyphs[i])); - glyph_width = glyph_im.width(); - Q_ASSERT(glyph_width >= 0); - // pad the glyph width to an even number - if (glyph_width%2 != 0) - ++glyph_width; - - QGLGlyphCoord *qgl_glyph = new QGLGlyphCoord; - qgl_glyph->x = qreal(font_tex->x_offset) / font_tex->width; - qgl_glyph->y = qreal(font_tex->y_offset) / font_tex->height; - qgl_glyph->width = qreal(glyph_width) / font_tex->width; - qgl_glyph->height = qreal(glyph_height) / font_tex->height; - qgl_glyph->log_width = qreal(glyph_width); - qgl_glyph->log_height = qgl_glyph->height * font_tex->height; -#ifdef Q_WS_MAC - qgl_glyph->x_offset = -metrics.x + 1; - qgl_glyph->y_offset = metrics.y - 2; -#else - qgl_glyph->x_offset = -metrics.x; - qgl_glyph->y_offset = metrics.y; -#endif - - if (!glyph_im.isNull()) { - int idx = 0; - uchar *tex_data = (uchar *) malloc(glyph_width*glyph_im.height()*2); - memset(tex_data, 0, glyph_width*glyph_im.height()*2); - - bool is8BitGray = false; -#ifdef Q_WS_QPA - if (glyph_im.format() == QImage::Format_Indexed8) { - is8BitGray = true; - } -#endif - glyph_im = glyph_im.convertToFormat(QImage::Format_Indexed8); - for (int y=0; yx_offset, font_tex->y_offset, - glyph_width, glyph_im.height(), - GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, tex_data); - free(tex_data); - } - if (font_tex->x_offset + glyph_width + x_margin > font_tex->width) { - font_tex->x_offset = x_margin; - font_tex->y_offset += glyph_height + y_margin; - } else { - font_tex->x_offset += glyph_width + x_margin; - } - - cache->insert(glyphs[i], qgl_glyph); - } - } -} - -QGLGlyphCoord *QGLGlyphCache::lookup(QFontEngine *, glyph_t g) -{ - Q_ASSERT(current_cache != 0); - // ### careful here - QGLGlyphHash::const_iterator it = current_cache->constFind(g); - if (it == current_cache->constEnd()) - return 0; - else - return it.value(); -} - -Q_GLOBAL_STATIC(QGLGlyphCache, qt_glyph_cache) - -// -// assumption: the context that this is called for has to be the -// current context -// -void qgl_cleanup_glyph_cache(QGLContext *ctx) -{ - qt_glyph_cache()->cleanupContext(ctx); -} - -void QOpenGLPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) -{ - Q_D(QOpenGLPaintEngine); - - d->flushDrawQueue(); - - // make sure the glyphs we want to draw are in the cache - qt_glyph_cache()->cacheGlyphs(d->device->context(), textItem->fontEngine(), textItem->glyphs, - textItem->numGlyphs); - - d->setGradientOps(Qt::SolidPattern, QRectF()); // turns off gradient ops - qt_glColor4ubv(d->pen_color); - glEnable(GL_TEXTURE_2D); - -#ifdef Q_WS_QWS - // XXX: it is necessary to disable alpha writes on GLES/embedded because we don't want - // text rendering to update the alpha in the window surface. - // XXX: This may not be needed as this behavior does seem to be caused by driver bug - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); -#endif - - // do the actual drawing - GLfloat vertexArray[4*2]; - GLfloat texCoordArray[4*2]; - - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - glTexCoordPointer(2, GL_FLOAT, 0, texCoordArray); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - bool antialias = !(textItem->fontEngine()->fontDef.styleStrategy & QFont::NoAntialias) - && (d->matrix.type() > QTransform::TxTranslate); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, antialias ? GL_LINEAR : GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, antialias ? GL_LINEAR : GL_NEAREST); - - for (int i=0; i< textItem->numGlyphs; ++i) { - QGLGlyphCoord *g = qt_glyph_cache()->lookup(textItem->fontEngine(), textItem->glyphs[i]); - - // we don't cache glyphs with no width/height - if (!g) - continue; - - qreal x1, x2, y1, y2; - x1 = g->x; - y1 = g->y; - x2 = x1 + g->width; - y2 = y1 + g->height; - - QPointF logical_pos((textItem->glyphPositions[i].x - g->x_offset).toReal(), - (textItem->glyphPositions[i].y + g->y_offset).toReal()); - - qt_add_rect_to_array(QRectF(logical_pos, QSizeF(g->log_width, g->log_height)), vertexArray); - qt_add_texcoords_to_array(x1, y1, x2, y2, texCoordArray); - - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - } - - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_VERTEX_ARRAY); - - glDisable(GL_TEXTURE_2D); - -#ifdef Q_WS_QWS - // XXX: This may not be needed as this behavior does seem to be caused by driver bug - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); -#endif - -} - -void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) -{ - Q_D(QOpenGLPaintEngine); - - const QTextItemInt &ti = static_cast(textItem); - - // fall back to drawing a polygon if the scale factor is large, or - // we use a gradient pen - if ((d->matrix.det() > 1) || (d->pen_brush_style >= Qt::LinearGradientPattern - && d->pen_brush_style <= Qt::ConicalGradientPattern)) { - QPaintEngine::drawTextItem(p, textItem); - return; - } - - // add the glyphs used to the glyph texture cache - QVarLengthArray positions; - QVarLengthArray glyphs; - QTransform matrix = QTransform::fromTranslate(qRound(p.x()), qRound(p.y())); - ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); - - { - QStaticTextItem staticTextItem; - staticTextItem.chars = const_cast(ti.chars); - staticTextItem.setFontEngine(ti.fontEngine); - staticTextItem.glyphs = glyphs.data(); - staticTextItem.numChars = ti.num_chars; - staticTextItem.numGlyphs = glyphs.size(); - staticTextItem.glyphPositions = positions.data(); - drawStaticTextItem(&staticTextItem); - } - -} - - -void QOpenGLPaintEngine::drawEllipse(const QRectF &rect) -{ -#ifndef Q_WS_QWS - Q_D(QOpenGLPaintEngine); - - if (d->use_emulation) { - QPaintEngineEx::drawEllipse(rect); - return; - } - - if (d->high_quality_antialiasing) { - if (d->has_brush) { - d->disableClipping(); - - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - GLuint program = qt_gl_program_cache()->getProgram(d->device->context(), - FRAGMENT_PROGRAM_MASK_ELLIPSE_AA, 0, true); - QGLEllipseMaskGenerator maskGenerator(rect, - d->matrix, - d->offscreen, - program, - mask_variable_locations[FRAGMENT_PROGRAM_MASK_ELLIPSE_AA]); - - d->addItem(qt_mask_texture_cache()->getMask(maskGenerator, d)); - - d->enableClipping(); - - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - } - - if (d->has_pen) { - QPainterPath path; - path.addEllipse(rect); - - d->strokePath(path, false); - } - } else { - DEBUG_ONCE_STR("QOpenGLPaintEngine::drawEllipse(): falling back to drawPath()"); - - QPainterPath path; - path.addEllipse(rect); - drawPath(path); - } -#else - QPaintEngineEx::drawEllipse(rect); -#endif -} - - -void QOpenGLPaintEnginePrivate::updateFragmentProgramData(int locations[]) -{ -#ifdef Q_WS_QWS - Q_UNUSED(locations); -#else - QGL_FUNC_CONTEXT; - - QSize sz = offscreen.offscreenSize(); - - float inv_mask_size_data[4] = { 1.0f / sz.width(), 1.0f / sz.height(), 0.0f, 0.0f }; - - sz = drawable_texture_size; - - float inv_dst_size_data[4] = { 1.0f / sz.width(), 1.0f / sz.height(), 0.0f, 0.0f }; - - // default inv size 0.125f == 1.0f / 8.0f for pattern brushes - float inv_brush_texture_size_data[4] = { 0.125f, 0.125f }; - - // texture patterns have their own size - if (current_style == Qt::TexturePattern) { - QSize sz = cbrush.texture().size(); - - inv_brush_texture_size_data[0] = 1.0f / sz.width(); - inv_brush_texture_size_data[1] = 1.0f / sz.height(); - } - - for (unsigned int i = 0; i < num_fragment_variables; ++i) { - int location = locations[i]; - - if (location < 0) - continue; - - switch (i) { - case VAR_ANGLE: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, angle_data); - break; - case VAR_LINEAR: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, linear_data); - break; - case VAR_FMP: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, fmp_data); - break; - case VAR_FMP2_M_RADIUS2: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, fmp2_m_radius2_data); - break; - case VAR_INV_MASK_SIZE: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, inv_mask_size_data); - break; - case VAR_INV_DST_SIZE: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, inv_dst_size_data); - break; - case VAR_INV_MATRIX_M0: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, inv_matrix_data[0]); - break; - case VAR_INV_MATRIX_M1: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, inv_matrix_data[1]); - break; - case VAR_INV_MATRIX_M2: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, inv_matrix_data[2]); - break; - case VAR_PORTERDUFF_AB: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, porterduff_ab_data); - break; - case VAR_PORTERDUFF_XYZ: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, porterduff_xyz_data); - break; - case VAR_INV_BRUSH_TEXTURE_SIZE: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, inv_brush_texture_size_data); - break; - case VAR_MASK_OFFSET: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, mask_offset_data); - break; - case VAR_MASK_CHANNEL: - glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, location, mask_channel_data); - break; - case VAR_DST_TEXTURE: - case VAR_MASK_TEXTURE: - case VAR_PALETTE: - case VAR_BRUSH_TEXTURE: - // texture variables, not handled here - break; - default: - qDebug() << "QOpenGLPaintEnginePrivate: Unhandled fragment variable:" << i; - } - } -#endif -} - - -void QOpenGLPaintEnginePrivate::copyDrawable(const QRectF &rect) -{ -#ifdef Q_WS_QWS - Q_UNUSED(rect); -#else - ensureDrawableTexture(); - - DEBUG_ONCE qDebug() << "Refreshing drawable_texture for rectangle" << rect; - QRectF screen_rect = rect.adjusted(-1, -1, 1, 1); - - int left = qMax(0, static_cast(screen_rect.left())); - int width = qMin(device->size().width() - left, static_cast(screen_rect.width()) + 1); - - int bottom = qMax(0, static_cast(device->size().height() - screen_rect.bottom())); - int height = qMin(device->size().height() - bottom, static_cast(screen_rect.height()) + 1); - - glBindTexture(GL_TEXTURE_2D, drawable_texture); - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, left, bottom, left, bottom, width, height); -#endif -} - - -void QOpenGLPaintEnginePrivate::composite(const QRectF &rect, const QPoint &maskOffset) -{ -#ifdef Q_WS_QWS - Q_UNUSED(rect); - Q_UNUSED(maskOffset); -#else - GLfloat vertexArray[8]; - qt_add_rect_to_array(rect, vertexArray); - - composite(GL_TRIANGLE_FAN, vertexArray, 4, maskOffset); -#endif -} - - -void QOpenGLPaintEnginePrivate::composite(GLuint primitive, const GLfloat *vertexArray, int vertexCount, const QPoint &maskOffset) -{ -#ifdef QT_OPENGL_ES - Q_UNUSED(primitive); - Q_UNUSED(vertexArray); - Q_UNUSED(vertexCount); - Q_UNUSED(maskOffset); -#else - Q_Q(QOpenGLPaintEngine); - QGL_FUNC_CONTEXT; - - if (current_style == Qt::NoBrush) - return; - - DEBUG_ONCE qDebug() << "QOpenGLPaintEnginePrivate: Using compositing program: fragment_brush =" - << fragment_brush << ", fragment_composition_mode =" << fragment_composition_mode; - - if (has_fast_composition_mode) - q->updateCompositionMode(composition_mode); - else { - qreal minX = 1e9, minY = 1e9, maxX = -1e9, maxY = -1e9; - - for (int i = 0; i < vertexCount; ++i) { - qreal x = vertexArray[2 * i]; - qreal y = vertexArray[2 * i + 1]; - - qreal tx, ty; - matrix.map(x, y, &tx, &ty); - - minX = qMin(minX, tx); - minY = qMin(minY, ty); - maxX = qMax(maxX, tx); - maxY = qMax(maxY, ty); - } - - QRectF r(minX, minY, maxX - minX, maxY - minY); - copyDrawable(r); - - glBlendFunc(GL_ONE, GL_ZERO); - } - - int *locations = painter_variable_locations[fragment_brush][fragment_composition_mode]; - - int texture_locations[] = { locations[VAR_DST_TEXTURE], - locations[VAR_MASK_TEXTURE], - locations[VAR_PALETTE] }; - - int brush_texture_location = locations[VAR_BRUSH_TEXTURE]; - - GLuint texture_targets[] = { GL_TEXTURE_2D, - GL_TEXTURE_2D, - GL_TEXTURE_1D }; - - GLuint textures[] = { drawable_texture, - offscreen.offscreenTexture(), - grad_palette }; - - const int num_textures = sizeof(textures) / sizeof(*textures); - - Q_ASSERT(num_textures == sizeof(texture_locations) / sizeof(*texture_locations)); - Q_ASSERT(num_textures == sizeof(texture_targets) / sizeof(*texture_targets)); - - for (int i = 0; i < num_textures; ++i) - if (texture_locations[i] >= 0) { - glActiveTexture(GL_TEXTURE0 + texture_locations[i]); - glBindTexture(texture_targets[i], textures[i]); - } - - if (brush_texture_location >= 0) { - glActiveTexture(GL_TEXTURE0 + brush_texture_location); - - if (current_style == Qt::TexturePattern) - device->context()->d_func()->bindTexture(cbrush.textureImage(), GL_TEXTURE_2D, GL_RGBA, - QGLContext::InternalBindOption); - else - device->context()->d_func()->bindTexture(qt_imageForBrush(current_style, false), - GL_TEXTURE_2D, GL_RGBA, - QGLContext::InternalBindOption); - - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, use_smooth_pixmap_transform); - } - - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - glEnable(GL_FRAGMENT_PROGRAM_ARB); - GLuint program = qt_gl_program_cache()->getProgram(device->context(), - fragment_brush, - fragment_composition_mode, false); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, program); - - mask_offset_data[0] = maskOffset.x(); - mask_offset_data[1] = -maskOffset.y(); - - updateFragmentProgramData(locations); - - glDrawArrays(primitive, 0, vertexCount); - - glDisable(GL_FRAGMENT_PROGRAM_ARB); - glDisableClientState(GL_VERTEX_ARRAY); - - for (int i = 0; i < num_textures; ++i) - if (texture_locations[i] >= 0) { - glActiveTexture(GL_TEXTURE0 + texture_locations[i]); - glBindTexture(texture_targets[i], 0); - } - - if (brush_texture_location >= 0) { - glActiveTexture(GL_TEXTURE0 + brush_texture_location); - glBindTexture(GL_TEXTURE_2D, 0); - } - - glActiveTexture(GL_TEXTURE0); - - if (!has_fast_composition_mode) - q->updateCompositionMode(composition_mode); -#endif -} - -void QOpenGLPaintEnginePrivate::cacheItemErased(int channel, const QRect &rect) -{ - bool isInDrawQueue = false; - - foreach (const QDrawQueueItem &item, drawQueue) { - if (item.location.channel == channel && item.location.rect == rect) { - isInDrawQueue = true; - break; - } - } - - if (isInDrawQueue) - flushDrawQueue(); -} - -void QOpenGLPaintEnginePrivate::addItem(const QGLMaskTextureCache::CacheLocation &location) -{ - drawQueue << QDrawQueueItem(opacity, cbrush, brush_origin, composition_mode, matrix, location); -} - -void QOpenGLPaintEnginePrivate::drawItem(const QDrawQueueItem &item) -{ - Q_Q(QOpenGLPaintEngine); - - opacity = item.opacity; - brush_origin = item.brush_origin; - q->updateCompositionMode(item.composition_mode); - matrix = item.matrix; - cbrush = item.brush; - brush_style = item.brush.style(); - - mask_channel_data[0] = item.location.channel == 0; - mask_channel_data[1] = item.location.channel == 1; - mask_channel_data[2] = item.location.channel == 2; - mask_channel_data[3] = item.location.channel == 3; - - setGradientOps(item.brush, item.location.screen_rect); - - composite(item.location.screen_rect, item.location.rect.topLeft() - item.location.screen_rect.topLeft() - - QPoint(0, offscreen.offscreenSize().height() - device->size().height())); -} - -void QOpenGLPaintEnginePrivate::flushDrawQueue() -{ -#ifndef QT_OPENGL_ES - Q_Q(QOpenGLPaintEngine); - - offscreen.release(); - - if (!drawQueue.isEmpty()) { - DEBUG_ONCE qDebug() << "QOpenGLPaintEngine::flushDrawQueue():" << drawQueue.size() << "items"; - - glPushMatrix(); - glLoadIdentity(); - qreal old_opacity = opacity; - QPointF old_brush_origin = brush_origin; - QPainter::CompositionMode old_composition_mode = composition_mode; - QTransform old_matrix = matrix; - QBrush old_brush = cbrush; - - bool hqaa_old = high_quality_antialiasing; - - high_quality_antialiasing = true; - - foreach (const QDrawQueueItem &item, drawQueue) - drawItem(item); - - opacity = old_opacity; - brush_origin = old_brush_origin; - q->updateCompositionMode(old_composition_mode); - matrix = old_matrix; - cbrush = old_brush; - brush_style = old_brush.style(); - - high_quality_antialiasing = hqaa_old; - - setGLBrush(old_brush.color()); - qt_glColor4ubv(brush_color); - - drawQueue.clear(); - - glPopMatrix(); - } -#endif -} - -void QOpenGLPaintEngine::clipEnabledChanged() -{ - Q_D(QOpenGLPaintEngine); - - d->updateDepthClip(); -} - -void QOpenGLPaintEngine::penChanged() -{ - updatePen(state()->pen); -} - -void QOpenGLPaintEngine::brushChanged() -{ - updateBrush(state()->brush, state()->brushOrigin); -} - -void QOpenGLPaintEngine::brushOriginChanged() -{ - updateBrush(state()->brush, state()->brushOrigin); -} - -void QOpenGLPaintEngine::opacityChanged() -{ - Q_D(QOpenGLPaintEngine); - QPainterState *s = state(); - d->opacity = s->opacity; - updateBrush(s->brush, s->brushOrigin); - updatePen(s->pen); -} - -void QOpenGLPaintEngine::compositionModeChanged() -{ - updateCompositionMode(state()->composition_mode); -} - -void QOpenGLPaintEngine::renderHintsChanged() -{ - updateRenderHints(state()->renderHints); -} - -void QOpenGLPaintEngine::transformChanged() -{ - updateMatrix(state()->matrix); -} - -extern QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path); - -void QOpenGLPaintEngine::fill(const QVectorPath &path, const QBrush &brush) -{ - Q_D(QOpenGLPaintEngine); - - if (brush.style() == Qt::NoBrush) - return; - - if ((!d->use_fragment_programs && needsEmulation(brush.style())) || qt_isExtendedRadialGradient(brush)) { - QPainter *p = painter(); - QBrush oldBrush = p->brush(); - p->setBrush(brush); - qt_draw_helper(p->d_ptr.data(), qt_painterPathFromVectorPath(path), QPainterPrivate::FillDraw); - p->setBrush(oldBrush); - return; - } - - QBrush old_brush = state()->brush; - updateBrush(brush, state()->brushOrigin); - - const qreal *points = path.points(); - const QPainterPath::ElementType *types = path.elements(); - if (!types && path.shape() == QVectorPath::RectangleHint) { - QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]); - QPen old_pen = state()->pen; - updatePen(Qt::NoPen); - drawRects(&r, 1); - updatePen(old_pen); - } else { - d->fillPath(qt_painterPathFromVectorPath(path)); - } - - updateBrush(old_brush, state()->brushOrigin); -} - -template static inline bool isRect(const T *pts, int elementCount) { - return (elementCount == 5 // 5-point polygon, check for closed rect - && pts[0] == pts[8] && pts[1] == pts[9] // last point == first point - && pts[0] == pts[6] && pts[2] == pts[4] // x values equal - && pts[1] == pts[3] && pts[5] == pts[7] // y values equal... - ) || - (elementCount == 4 // 4-point polygon, check for unclosed rect - && pts[0] == pts[6] && pts[2] == pts[4] // x values equal - && pts[1] == pts[3] && pts[5] == pts[7] // y values equal... - ); -} - -void QOpenGLPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) -{ - const qreal *points = path.points(); - const QPainterPath::ElementType *types = path.elements(); - if (!types && path.shape() == QVectorPath::RectangleHint) { - QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]); - updateClipRegion(QRegion(r.toRect()), op); - return; - } - - QPainterPath p; - if (types) { - int id = 0; - for (int i=0; i(s); - QOpenGLPaintEngineState *old_state = state(); - - QPaintEngineEx::setState(s); - - // are we in a save() ? - if (s == d->last_created_state) { - d->last_created_state = 0; - return; - } - - if (isActive()) { - if (old_state->depthClipId != new_state->depthClipId) - d->updateDepthClip(); - penChanged(); - brushChanged(); - opacityChanged(); - compositionModeChanged(); - renderHintsChanged(); - transformChanged(); - } -} - -QPainterState *QOpenGLPaintEngine::createState(QPainterState *orig) const -{ - const Q_D(QOpenGLPaintEngine); - - QOpenGLPaintEngineState *s; - if (!orig) - s = new QOpenGLPaintEngineState(); - else - s = new QOpenGLPaintEngineState(*static_cast(orig)); - - d->last_created_state = s; - return s; -} - -// -// QOpenGLPaintEngineState -// - -QOpenGLPaintEngineState::QOpenGLPaintEngineState(QOpenGLPaintEngineState &other) - : QPainterState(other) -{ - clipRegion = other.clipRegion; - hasClipping = other.hasClipping; - fastClip = other.fastClip; - depthClipId = other.depthClipId; -} - -QOpenGLPaintEngineState::QOpenGLPaintEngineState() -{ - hasClipping = false; - depthClipId = 0; -} - -QOpenGLPaintEngineState::~QOpenGLPaintEngineState() -{ -} - -void QOpenGLPaintEnginePrivate::ensureDrawableTexture() -{ - if (!dirty_drawable_texture) - return; - - dirty_drawable_texture = false; - -#ifndef QT_OPENGL_ES - glGenTextures(1, &drawable_texture); - glBindTexture(GL_TEXTURE_2D, drawable_texture); - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, - drawable_texture_size.width(), - drawable_texture_size.height(), 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -#endif -} - -QT_END_NAMESPACE - -#include "qpaintengine_opengl.moc" diff --git a/src/opengl/qpaintengine_opengl_p.h b/src/opengl/qpaintengine_opengl_p.h deleted file mode 100644 index 8d0ea83a47e..00000000000 --- a/src/opengl/qpaintengine_opengl_p.h +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPAINTENGINE_OPENGL_P_H -#define QPAINTENGINE_OPENGL_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 - -QT_BEGIN_NAMESPACE - -class QOpenGLPaintEnginePrivate; -class QGLTexture; - -class QOpenGLPaintEngineState : public QPainterState -{ -public: - QOpenGLPaintEngineState(QOpenGLPaintEngineState &other); - QOpenGLPaintEngineState(); - ~QOpenGLPaintEngineState(); - - QRegion clipRegion; - bool hasClipping; - QRect fastClip; - uint depthClipId; -}; - -class QOpenGLPaintEngine : public QPaintEngineEx -{ - Q_DECLARE_PRIVATE(QOpenGLPaintEngine) -public: - QOpenGLPaintEngine(); - ~QOpenGLPaintEngine(); - - bool begin(QPaintDevice *pdev); - bool end(); - - // new stuff - void clipEnabledChanged(); - void penChanged(); - void brushChanged(); - void brushOriginChanged(); - void opacityChanged(); - void compositionModeChanged(); - void renderHintsChanged(); - void transformChanged(); - - void fill(const QVectorPath &path, const QBrush &brush); - void clip(const QVectorPath &path, Qt::ClipOperation op); - - void setState(QPainterState *s); - QPainterState *createState(QPainterState *orig) const; - inline QOpenGLPaintEngineState *state() { - return static_cast(QPaintEngineEx::state()); - } - inline const QOpenGLPaintEngineState *state() const { - return static_cast(QPaintEngineEx::state()); - } - - - // old stuff - void updateState(const QPaintEngineState &state); - - void updatePen(const QPen &pen); - void updateBrush(const QBrush &brush, const QPointF &pt); - void updateFont(const QFont &font); - void updateMatrix(const QTransform &matrix); - void updateClipRegion(const QRegion ®ion, Qt::ClipOperation op); - void updateRenderHints(QPainter::RenderHints hints); - void updateCompositionMode(QPainter::CompositionMode composition_mode); - - void drawRects(const QRectF *r, int rectCount); - void drawLines(const QLineF *lines, int lineCount); - void drawPoints(const QPointF *p, int pointCount); - void drawRects(const QRect *r, int rectCount); - void drawLines(const QLine *lines, int lineCount); - void drawPoints(const QPoint *p, int pointCount); - - void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - - void drawPath(const QPainterPath &path); - void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); - void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode); - void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); - void drawImage(const QRectF &r, const QImage &image, const QRectF &sr, - Qt::ImageConversionFlags conversionFlags); - void drawTextItem(const QPointF &p, const QTextItem &ti); - void drawStaticTextItem(QStaticTextItem *staticTextItem); - - void drawEllipse(const QRectF &rect); - -#ifdef Q_WS_WIN - HDC handle() const; -#else - Qt::HANDLE handle() const; -#endif - inline Type type() const { return QPaintEngine::OpenGL; } - bool supportsTransformations(qreal, const QTransform &) const { return true; } - -private: - void drawPolyInternal(const QPolygonF &pa, bool close = true); - void drawTextureRect(int tx_width, int tx_height, const QRectF &r, const QRectF &sr, - GLenum target, QGLTexture *tex); - Q_DISABLE_COPY(QOpenGLPaintEngine) -}; - - -QT_END_NAMESPACE - -#endif // QPAINTENGINE_OPENGL_P_H diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp deleted file mode 100644 index e909ff30b91..00000000000 --- a/src/opengl/qpixmapdata_gl.cpp +++ /dev/null @@ -1,829 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpixmap.h" -#include "qglframebufferobject.h" - -#include - -#include "qpixmapdata_gl_p.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -Q_OPENGL_EXPORT extern const QGLContext* qt_gl_share_context(); - -/*! - \class QGLFramebufferObjectPool - \since 4.6 - - \brief The QGLFramebufferObject class provides a pool of framebuffer - objects for offscreen rendering purposes. - - When requesting an FBO of a given size and format, an FBO of the same - format and a size at least as big as the requested size will be returned. - - \internal -*/ - -static inline int areaDiff(const QSize &size, const QGLFramebufferObject *fbo) -{ - return qAbs(size.width() * size.height() - fbo->width() * fbo->height()); -} - -extern int qt_next_power_of_two(int v); - -static inline QSize maybeRoundToNextPowerOfTwo(const QSize &sz) -{ -#ifdef QT_OPENGL_ES_2 - QSize rounded(qt_next_power_of_two(sz.width()), qt_next_power_of_two(sz.height())); - if (rounded.width() * rounded.height() < 1.20 * sz.width() * sz.height()) - return rounded; -#endif - return sz; -} - - -QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize, const QGLFramebufferObjectFormat &requestFormat, bool strictSize) -{ - QGLFramebufferObject *chosen = 0; - QGLFramebufferObject *candidate = 0; - for (int i = 0; !chosen && i < m_fbos.size(); ++i) { - QGLFramebufferObject *fbo = m_fbos.at(i); - - if (strictSize) { - if (fbo->size() == requestSize && fbo->format() == requestFormat) { - chosen = fbo; - break; - } else { - continue; - } - } - - if (fbo->format() == requestFormat) { - // choose the fbo with a matching format and the closest size - if (!candidate || areaDiff(requestSize, candidate) > areaDiff(requestSize, fbo)) - candidate = fbo; - } - - if (candidate) { - m_fbos.removeOne(candidate); - - const QSize fboSize = candidate->size(); - QSize sz = fboSize; - - if (sz.width() < requestSize.width()) - sz.setWidth(qMax(requestSize.width(), qRound(sz.width() * 1.5))); - if (sz.height() < requestSize.height()) - sz.setHeight(qMax(requestSize.height(), qRound(sz.height() * 1.5))); - - // wasting too much space? - if (sz.width() * sz.height() > requestSize.width() * requestSize.height() * 4) - sz = requestSize; - - if (sz != fboSize) { - delete candidate; - candidate = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(sz), requestFormat); - } - - chosen = candidate; - } - } - - if (!chosen) { - if (strictSize) - chosen = new QGLFramebufferObject(requestSize, requestFormat); - else - chosen = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(requestSize), requestFormat); - } - - if (!chosen->isValid()) { - delete chosen; - chosen = 0; - } - - return chosen; -} - -void QGLFramebufferObjectPool::release(QGLFramebufferObject *fbo) -{ - if (fbo) - m_fbos << fbo; -} - - -QPaintEngine* QGLPixmapGLPaintDevice::paintEngine() const -{ - return data->paintEngine(); -} - -void QGLPixmapGLPaintDevice::beginPaint() -{ - if (!data->isValid()) - return; - - // QGLPaintDevice::beginPaint will store the current binding and replace - // it with m_thisFBO: - m_thisFBO = data->m_renderFbo->handle(); - QGLPaintDevice::beginPaint(); - - Q_ASSERT(data->paintEngine()->type() == QPaintEngine::OpenGL2); - - // QPixmap::fill() is deferred until now, where we actually need to do the fill: - if (data->needsFill()) { - const QColor &c = data->fillColor(); - float alpha = c.alphaF(); - glDisable(GL_SCISSOR_TEST); - glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); - glClear(GL_COLOR_BUFFER_BIT); - } - else if (!data->isUninitialized()) { - // If the pixmap (GL Texture) has valid content (it has been - // uploaded from an image or rendered into before), we need to - // copy it from the texture to the render FBO. - - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); - glDisable(GL_BLEND); - -#if !defined(QT_OPENGL_ES_2) - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, data->width(), data->height(), 0, -999999, 999999); -#endif - - glViewport(0, 0, data->width(), data->height()); - - // Pass false to bind so it doesn't copy the FBO into the texture! - context()->drawTexture(QRect(0, 0, data->width(), data->height()), data->bind(false)); - } -} - -void QGLPixmapGLPaintDevice::endPaint() -{ - if (!data->isValid()) - return; - - data->copyBackFromRenderFbo(false); - - // Base's endPaint will restore the previous FBO binding - QGLPaintDevice::endPaint(); - - qgl_fbo_pool()->release(data->m_renderFbo); - data->m_renderFbo = 0; -} - -QGLContext* QGLPixmapGLPaintDevice::context() const -{ - data->ensureCreated(); - return data->m_ctx; -} - -QSize QGLPixmapGLPaintDevice::size() const -{ - return data->size(); -} - -bool QGLPixmapGLPaintDevice::alphaRequested() const -{ - return data->m_hasAlpha; -} - -void QGLPixmapGLPaintDevice::setPixmapData(QGLPixmapData* d) -{ - data = d; -} - -static int qt_gl_pixmap_serial = 0; - -QGLPixmapData::QGLPixmapData(PixelType type) - : QPixmapData(type, OpenGLClass) - , m_renderFbo(0) - , m_engine(0) - , m_ctx(0) - , m_dirty(false) - , m_hasFillColor(false) - , m_hasAlpha(false) -{ - setSerialNumber(++qt_gl_pixmap_serial); - m_glDevice.setPixmapData(this); -} - -QGLPixmapData::~QGLPixmapData() -{ - const QGLContext *shareContext = qt_gl_share_context(); - if (!shareContext) - return; - - delete m_engine; - - if (m_texture.id) { - QGLShareContextScope ctx(shareContext); - glDeleteTextures(1, &m_texture.id); - } -} - -QPixmapData *QGLPixmapData::createCompatiblePixmapData() const -{ - return new QGLPixmapData(pixelType()); -} - -bool QGLPixmapData::isValid() const -{ - return w > 0 && h > 0; -} - -bool QGLPixmapData::isValidContext(const QGLContext *ctx) const -{ - if (ctx == m_ctx) - return true; - - const QGLContext *share_ctx = qt_gl_share_context(); - return ctx == share_ctx || QGLContext::areSharing(ctx, share_ctx); -} - -void QGLPixmapData::resize(int width, int height) -{ - if (width == w && height == h) - return; - - if (width <= 0 || height <= 0) { - width = 0; - height = 0; - } - - w = width; - h = height; - is_null = (w <= 0 || h <= 0); - d = pixelType() == QPixmapData::PixmapType ? 32 : 1; - - if (m_texture.id) { - QGLShareContextScope ctx(qt_gl_share_context()); - glDeleteTextures(1, &m_texture.id); - m_texture.id = 0; - } - - m_source = QImage(); - m_dirty = isValid(); - setSerialNumber(++qt_gl_pixmap_serial); -} - -void QGLPixmapData::ensureCreated() const -{ - if (!m_dirty) - return; - - m_dirty = false; - - QGLShareContextScope ctx(qt_gl_share_context()); - m_ctx = ctx; - - const GLenum internal_format = m_hasAlpha ? GL_RGBA : GL_RGB; -#ifdef QT_OPENGL_ES_2 - const GLenum external_format = internal_format; -#else - const GLenum external_format = qt_gl_preferredTextureFormat(); -#endif - const GLenum target = GL_TEXTURE_2D; - - if (!m_texture.id) { - glGenTextures(1, &m_texture.id); - glBindTexture(target, m_texture.id); - glTexImage2D(target, 0, internal_format, w, h, 0, external_format, GL_UNSIGNED_BYTE, 0); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - } - - if (!m_source.isNull()) { - if (external_format == GL_RGB) { - const QImage tx = m_source.convertToFormat(QImage::Format_RGB888).mirrored(false, true); - - glBindTexture(target, m_texture.id); - glTexSubImage2D(target, 0, 0, 0, w, h, external_format, - GL_UNSIGNED_BYTE, tx.bits()); - } else { - const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format); - - glBindTexture(target, m_texture.id); - glTexSubImage2D(target, 0, 0, 0, w, h, external_format, - GL_UNSIGNED_BYTE, tx.bits()); - } - - if (useFramebufferObjects()) - m_source = QImage(); - } - - m_texture.options &= ~QGLContext::MemoryManagedBindOption; -} - -void QGLPixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags flags) -{ - QImage img = image; - createPixmapForImage(img, flags, false); -} - -void QGLPixmapData::fromImageReader(QImageReader *imageReader, - Qt::ImageConversionFlags flags) -{ - QImage image = imageReader->read(); - if (image.isNull()) - return; - - createPixmapForImage(image, flags, true); -} - -bool QGLPixmapData::fromFile(const QString &filename, const char *format, - Qt::ImageConversionFlags flags) -{ - if (pixelType() == QPixmapData::BitmapType) - return QPixmapData::fromFile(filename, format, flags); - QFile file(filename); - if (file.open(QIODevice::ReadOnly)) { - QByteArray data = file.peek(64); - bool alpha; - if (m_texture.canBindCompressedTexture - (data.constData(), data.size(), format, &alpha)) { - resize(0, 0); - data = file.readAll(); - file.close(); - QGLShareContextScope ctx(qt_gl_share_context()); - QSize size = m_texture.bindCompressedTexture - (data.constData(), data.size(), format); - if (!size.isEmpty()) { - w = size.width(); - h = size.height(); - is_null = false; - d = 32; - m_hasAlpha = alpha; - m_source = QImage(); - m_dirty = isValid(); - return true; - } - return false; - } - } - - QImage image = QImageReader(filename, format).read(); - if (image.isNull()) - return false; - - createPixmapForImage(image, flags, true); - - return !isNull(); -} - -bool QGLPixmapData::fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags) -{ - bool alpha; - const char *buf = reinterpret_cast(buffer); - if (m_texture.canBindCompressedTexture(buf, int(len), format, &alpha)) { - resize(0, 0); - QGLShareContextScope ctx(qt_gl_share_context()); - QSize size = m_texture.bindCompressedTexture(buf, int(len), format); - if (!size.isEmpty()) { - w = size.width(); - h = size.height(); - is_null = false; - d = 32; - m_hasAlpha = alpha; - m_source = QImage(); - m_dirty = isValid(); - return true; - } - } - - QByteArray a = QByteArray::fromRawData(reinterpret_cast(buffer), len); - QBuffer b(&a); - b.open(QIODevice::ReadOnly); - QImage image = QImageReader(&b, format).read(); - if (image.isNull()) - return false; - - createPixmapForImage(image, flags, true); - - return !isNull(); -} - -/*! - out-of-place conversion (inPlace == false) will always detach() - */ -void QGLPixmapData::createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace) -{ - if (image.size() == QSize(w, h)) - setSerialNumber(++qt_gl_pixmap_serial); - - resize(image.width(), image.height()); - - if (pixelType() == BitmapType) { - m_source = image.convertToFormat(QImage::Format_MonoLSB); - - } else { - QImage::Format format = QImage::Format_RGB32; - if (qApp->desktop()->depth() == 16) - format = QImage::Format_RGB16; - - if (image.hasAlphaChannel() - && ((flags & Qt::NoOpaqueDetection) - || const_cast(image).data_ptr()->checkForAlphaPixels())) - format = QImage::Format_ARGB32_Premultiplied;; - - if (inPlace && image.data_ptr()->convertInPlace(format, flags)) { - m_source = image; - } else { - m_source = image.convertToFormat(format); - - // convertToFormat won't detach the image if format stays the same. - if (image.format() == format) - m_source.detach(); - } - } - - m_dirty = true; - m_hasFillColor = false; - - m_hasAlpha = m_source.hasAlphaChannel(); - w = image.width(); - h = image.height(); - is_null = (w <= 0 || h <= 0); - d = m_source.depth(); - - if (m_texture.id) { - QGLShareContextScope ctx(qt_gl_share_context()); - glDeleteTextures(1, &m_texture.id); - m_texture.id = 0; - } -} - -bool QGLPixmapData::scroll(int dx, int dy, const QRect &rect) -{ - Q_UNUSED(dx); - Q_UNUSED(dy); - Q_UNUSED(rect); - return false; -} - -void QGLPixmapData::copy(const QPixmapData *data, const QRect &rect) -{ - if (data->classId() != QPixmapData::OpenGLClass || !static_cast(data)->useFramebufferObjects()) { - QPixmapData::copy(data, rect); - return; - } - - const QGLPixmapData *other = static_cast(data); - if (other->m_renderFbo) { - QGLShareContextScope ctx(qt_gl_share_context()); - - resize(rect.width(), rect.height()); - m_hasAlpha = other->m_hasAlpha; - ensureCreated(); - - if (!ctx->d_ptr->fbo) - glGenFramebuffers(1, &ctx->d_ptr->fbo); - - glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, ctx->d_ptr->fbo); - glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_2D, m_texture.id, 0); - - if (!other->m_renderFbo->isBound()) - glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, other->m_renderFbo->handle()); - - glDisable(GL_SCISSOR_TEST); - if (ctx->d_ptr->active_engine && ctx->d_ptr->active_engine->type() == QPaintEngine::OpenGL2) - static_cast(ctx->d_ptr->active_engine)->invalidateState(); - - glBlitFramebufferEXT(rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height(), - 0, 0, w, h, - GL_COLOR_BUFFER_BIT, - GL_NEAREST); - - glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); - } else { - QPixmapData::copy(data, rect); - } -} - -void QGLPixmapData::fill(const QColor &color) -{ - if (!isValid()) - return; - - bool hasAlpha = color.alpha() != 255; - if (hasAlpha && !m_hasAlpha) { - if (m_texture.id) { - glDeleteTextures(1, &m_texture.id); - m_texture.id = 0; - m_dirty = true; - } - m_hasAlpha = color.alpha() != 255; - } - - if (useFramebufferObjects()) { - m_source = QImage(); - m_hasFillColor = true; - m_fillColor = color; - } else { - - if (m_source.isNull()) { - m_fillColor = color; - m_hasFillColor = true; - - } else if (m_source.depth() == 32) { - m_source.fill(PREMUL(color.rgba())); - - } else if (m_source.depth() == 1) { - if (color == Qt::color1) - m_source.fill(1); - else - m_source.fill(0); - } - } -} - -bool QGLPixmapData::hasAlphaChannel() const -{ - return m_hasAlpha; -} - -QImage QGLPixmapData::fillImage(const QColor &color) const -{ - QImage img; - if (pixelType() == BitmapType) { - img = QImage(w, h, QImage::Format_MonoLSB); - - img.setColorCount(2); - img.setColor(0, QColor(Qt::color0).rgba()); - img.setColor(1, QColor(Qt::color1).rgba()); - - if (color == Qt::color1) - img.fill(1); - else - img.fill(0); - } else { - img = QImage(w, h, - m_hasAlpha - ? QImage::Format_ARGB32_Premultiplied - : QImage::Format_RGB32); - img.fill(PREMUL(color.rgba())); - } - return img; -} - -extern QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha); - -QImage QGLPixmapData::toImage() const -{ - if (!isValid()) - return QImage(); - - if (m_renderFbo) { - copyBackFromRenderFbo(true); - } else if (!m_source.isNull()) { - QImageData *data = const_cast(m_source).data_ptr(); - if (data->paintEngine && data->paintEngine->isActive() - && data->paintEngine->paintDevice() == &m_source) - { - return m_source.copy(); - } - return m_source; - } else if (m_dirty || m_hasFillColor) { - return fillImage(m_fillColor); - } else { - ensureCreated(); - } - - QGLShareContextScope ctx(qt_gl_share_context()); - glBindTexture(GL_TEXTURE_2D, m_texture.id); - return qt_gl_read_texture(QSize(w, h), true, true); -} - -struct TextureBuffer -{ - QGLFramebufferObject *fbo; - QGL2PaintEngineEx *engine; -}; - -Q_GLOBAL_STATIC(QGLFramebufferObjectPool, _qgl_fbo_pool) -QGLFramebufferObjectPool* qgl_fbo_pool() -{ - return _qgl_fbo_pool(); -} - -void QGLPixmapData::copyBackFromRenderFbo(bool keepCurrentFboBound) const -{ - if (!isValid()) - return; - - m_hasFillColor = false; - - const QGLContext *share_ctx = qt_gl_share_context(); - QGLShareContextScope ctx(share_ctx); - - ensureCreated(); - - if (!ctx->d_ptr->fbo) - glGenFramebuffers(1, &ctx->d_ptr->fbo); - - glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, ctx->d_ptr->fbo); - glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_2D, m_texture.id, 0); - - const int x0 = 0; - const int x1 = w; - const int y0 = 0; - const int y1 = h; - - if (!m_renderFbo->isBound()) - glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, m_renderFbo->handle()); - - glDisable(GL_SCISSOR_TEST); - - glBlitFramebufferEXT(x0, y0, x1, y1, - x0, y0, x1, y1, - GL_COLOR_BUFFER_BIT, - GL_NEAREST); - - if (keepCurrentFboBound) { - glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); - } else { - glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, m_renderFbo->handle()); - ctx->d_ptr->current_fbo = m_renderFbo->handle(); - } -} - -bool QGLPixmapData::useFramebufferObjects() const -{ - return QGLFramebufferObject::hasOpenGLFramebufferObjects() - && QGLFramebufferObject::hasOpenGLFramebufferBlit() - && qt_gl_preferGL2Engine() - && (w * h > 32*32); // avoid overhead of FBOs for small pixmaps -} - -QPaintEngine* QGLPixmapData::paintEngine() const -{ - if (!isValid()) - return 0; - - if (m_renderFbo) - return m_engine; - - if (useFramebufferObjects()) { - extern QGLWidget* qt_gl_share_widget(); - - if (!QGLContext::currentContext()) - const_cast(qt_gl_share_context())->makeCurrent(); - QGLShareContextScope ctx(qt_gl_share_context()); - - QGLFramebufferObjectFormat format; - format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); - format.setSamples(4); - format.setInternalTextureFormat(GLenum(m_hasAlpha ? GL_RGBA : GL_RGB)); - - m_renderFbo = qgl_fbo_pool()->acquire(size(), format); - - if (m_renderFbo) { - if (!m_engine) - m_engine = new QGL2PaintEngineEx; - return m_engine; - } - - qWarning() << "Failed to create pixmap texture buffer of size " << size() << ", falling back to raster paint engine"; - } - - m_dirty = true; - if (m_source.size() != size()) - m_source = QImage(size(), QImage::Format_ARGB32_Premultiplied); - if (m_hasFillColor) { - m_source.fill(PREMUL(m_fillColor.rgba())); - m_hasFillColor = false; - } - return m_source.paintEngine(); -} - -extern QRgb qt_gl_convertToGLFormat(QRgb src_pixel, GLenum texture_format); - -// If copyBack is true, bind will copy the contents of the render -// FBO to the texture (which is not bound to the texture, as it's -// a multisample FBO). -GLuint QGLPixmapData::bind(bool copyBack) const -{ - if (m_renderFbo && copyBack) { - copyBackFromRenderFbo(true); - } else { - ensureCreated(); - } - - GLuint id = m_texture.id; - glBindTexture(GL_TEXTURE_2D, id); - - if (m_hasFillColor) { - if (!useFramebufferObjects()) { - m_source = QImage(w, h, QImage::Format_ARGB32_Premultiplied); - m_source.fill(PREMUL(m_fillColor.rgba())); - } - - m_hasFillColor = false; - - GLenum format = qt_gl_preferredTextureFormat(); - QImage tx(w, h, QImage::Format_ARGB32_Premultiplied); - tx.fill(qt_gl_convertToGLFormat(m_fillColor.rgba(), format)); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, format, GL_UNSIGNED_BYTE, tx.bits()); - } - - return id; -} - -QGLTexture* QGLPixmapData::texture() const -{ - return &m_texture; -} - -int QGLPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const -{ - if (w == 0) - return 0; - - switch (metric) { - case QPaintDevice::PdmWidth: - return w; - case QPaintDevice::PdmHeight: - return h; - case QPaintDevice::PdmNumColors: - return 0; - case QPaintDevice::PdmDepth: - return d; - case QPaintDevice::PdmWidthMM: - return qRound(w * 25.4 / qt_defaultDpiX()); - case QPaintDevice::PdmHeightMM: - return qRound(h * 25.4 / qt_defaultDpiY()); - case QPaintDevice::PdmDpiX: - case QPaintDevice::PdmPhysicalDpiX: - return qt_defaultDpiX(); - case QPaintDevice::PdmDpiY: - case QPaintDevice::PdmPhysicalDpiY: - return qt_defaultDpiY(); - default: - qWarning("QGLPixmapData::metric(): Invalid metric"); - return 0; - } -} - -QGLPaintDevice *QGLPixmapData::glDevice() const -{ - return &m_glDevice; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qpixmapdata_gl_p.h b/src/opengl/qpixmapdata_gl_p.h deleted file mode 100644 index 909f264d056..00000000000 --- a/src/opengl/qpixmapdata_gl_p.h +++ /dev/null @@ -1,247 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPIXMAPDATA_GL_P_H -#define QPIXMAPDATA_GL_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 "qgl_p.h" -#include "qgl.h" - -#include "private/qpixmapdata_p.h" -#include "private/qglpaintdevice_p.h" - -#ifdef Q_OS_SYMBIAN -#include "private/qvolatileimage_p.h" -#endif - -QT_BEGIN_NAMESPACE - -class QPaintEngine; -class QGLFramebufferObject; -class QGLFramebufferObjectFormat; -class QGLPixmapData; - -#ifdef QGL_USE_TEXTURE_POOL -void qt_gl_register_pixmap(QGLPixmapData *pd); -void qt_gl_unregister_pixmap(QGLPixmapData *pd); -void qt_gl_hibernate_pixmaps(); -#endif - -#ifdef Q_OS_SYMBIAN -class QNativeImageHandleProvider; -#endif - -class QGLFramebufferObjectPool -{ -public: - QGLFramebufferObject *acquire(const QSize &size, const QGLFramebufferObjectFormat &format, bool strictSize = false); - void release(QGLFramebufferObject *fbo); - -private: - QList m_fbos; -}; - -QGLFramebufferObjectPool* qgl_fbo_pool(); - - -class QGLPixmapGLPaintDevice : public QGLPaintDevice -{ -public: - QPaintEngine* paintEngine() const; - - void beginPaint(); - void endPaint(); - QGLContext* context() const; - QSize size() const; - bool alphaRequested() const; - - void setPixmapData(QGLPixmapData*); -private: - QGLPixmapData *data; -}; - - -class Q_OPENGL_EXPORT QGLPixmapData : public QPixmapData -{ -public: - QGLPixmapData(PixelType type); - ~QGLPixmapData(); - - QPixmapData *createCompatiblePixmapData() const; - - // Re-implemented from QPixmapData: - void resize(int width, int height); - void fromImage(const QImage &image, Qt::ImageConversionFlags flags); - void fromImageReader(QImageReader *imageReader, - Qt::ImageConversionFlags flags); - bool fromFile(const QString &filename, const char *format, - Qt::ImageConversionFlags flags); - bool fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags); - void copy(const QPixmapData *data, const QRect &rect); - bool scroll(int dx, int dy, const QRect &rect); - void fill(const QColor &color); - bool hasAlphaChannel() const; - QImage toImage() const; - QPaintEngine *paintEngine() const; - int metric(QPaintDevice::PaintDeviceMetric metric) const; - - // For accessing as a target: - QGLPaintDevice *glDevice() const; - - // For accessing as a source: - bool isValidContext(const QGLContext *ctx) const; - GLuint bind(bool copyBack = true) const; - QGLTexture *texture() const; - -#ifdef QGL_USE_TEXTURE_POOL - void destroyTexture(); - // Detach this image from the image pool. - void detachTextureFromPool(); - // Release the GL resources associated with this pixmap and copy - // the pixmap's contents out of the GPU back into main memory. - // The GL resource will be automatically recreated the next time - // ensureCreated() is called. Does nothing if the pixmap cannot be - // hibernated for some reason (e.g. texture is shared with another - // process via a SgImage). - void hibernate(); - // Called when the QGLTexturePool wants to reclaim this pixmap's - // texture objects to reuse storage. - void reclaimTexture(); - void forceToImage(); -#endif - -#ifdef Q_OS_SYMBIAN - QImage::Format idealFormat(QImage &image, Qt::ImageConversionFlags flags); - void* toNativeType(NativeType type); - void fromNativeType(void* pixmap, NativeType type); - bool initFromNativeImageHandle(void *handle, const QString &type); - void createFromNativeImageHandleProvider(); - void releaseNativeImageHandle(); -#endif - -private: - bool isValid() const; - - void ensureCreated() const; - - bool isUninitialized() const { return m_dirty && m_source.isNull(); } - - bool needsFill() const { return m_hasFillColor; } - QColor fillColor() const { return m_fillColor; } - - - - QGLPixmapData(const QGLPixmapData &other); - QGLPixmapData &operator=(const QGLPixmapData &other); - - void copyBackFromRenderFbo(bool keepCurrentFboBound) const; - QSize size() const { return QSize(w, h); } - - bool useFramebufferObjects() const; - - QImage fillImage(const QColor &color) const; - - void createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace); - - mutable QGLFramebufferObject *m_renderFbo; - mutable QPaintEngine *m_engine; - mutable QGLContext *m_ctx; -#ifdef Q_OS_SYMBIAN - mutable QVolatileImage m_source; - mutable QNativeImageHandleProvider *nativeImageHandleProvider; - void *nativeImageHandle; - QString nativeImageType; -#else - mutable QImage m_source; -#endif - mutable QGLTexture m_texture; - - // the texture is not in sync with the source image - mutable bool m_dirty; - - // fill has been called and no painting has been done, so the pixmap is - // represented by a single fill color - mutable QColor m_fillColor; - mutable bool m_hasFillColor; - - mutable bool m_hasAlpha; - - mutable QGLPixmapGLPaintDevice m_glDevice; - -#ifdef QGL_USE_TEXTURE_POOL - QGLPixmapData *nextLRU; - QGLPixmapData *prevLRU; - mutable bool inLRU; - mutable bool failedToAlloc; - mutable bool inTexturePool; - - QGLPixmapData *next; - QGLPixmapData *prev; - - friend class QGLTexturePool; - - friend void qt_gl_register_pixmap(QGLPixmapData *pd); - friend void qt_gl_unregister_pixmap(QGLPixmapData *pd); - friend void qt_gl_hibernate_pixmaps(); -#endif - - friend class QGLPixmapGLPaintDevice; - friend class QMeeGoPixmapData; - friend class QMeeGoLivePixmapData; -}; - -QT_END_NAMESPACE - -#endif // QPIXMAPDATA_GL_P_H - - diff --git a/src/opengl/qpixmapdata_poolgl.cpp b/src/opengl/qpixmapdata_poolgl.cpp deleted file mode 100644 index 5dd7b09c648..00000000000 --- a/src/opengl/qpixmapdata_poolgl.cpp +++ /dev/null @@ -1,934 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpixmap.h" -#include "qglframebufferobject.h" - -#include - -#include "qpixmapdata_gl_p.h" - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include "qgltexturepool_p.h" - -QT_BEGIN_NAMESPACE - -Q_OPENGL_EXPORT extern QGLWidget* qt_gl_share_widget(); - -static inline int areaDiff(const QSize &size, const QGLFramebufferObject *fbo) -{ - return qAbs(size.width() * size.height() - fbo->width() * fbo->height()); -} - -extern int qt_next_power_of_two(int v); - -static inline QSize maybeRoundToNextPowerOfTwo(const QSize &sz) -{ -#ifdef QT_OPENGL_ES_2 - QSize rounded(qt_next_power_of_two(sz.width()), qt_next_power_of_two(sz.height())); - if (rounded.width() * rounded.height() < 1.20 * sz.width() * sz.height()) - return rounded; -#endif - return sz; -} - - -QGLFramebufferObject *QGLFramebufferObjectPool::acquire(const QSize &requestSize, const QGLFramebufferObjectFormat &requestFormat, bool strictSize) -{ - QGLFramebufferObject *chosen = 0; - QGLFramebufferObject *candidate = 0; - for (int i = 0; !chosen && i < m_fbos.size(); ++i) { - QGLFramebufferObject *fbo = m_fbos.at(i); - - if (strictSize) { - if (fbo->size() == requestSize && fbo->format() == requestFormat) { - chosen = fbo; - break; - } else { - continue; - } - } - - if (fbo->format() == requestFormat) { - // choose the fbo with a matching format and the closest size - if (!candidate || areaDiff(requestSize, candidate) > areaDiff(requestSize, fbo)) - candidate = fbo; - } - - if (candidate) { - m_fbos.removeOne(candidate); - - const QSize fboSize = candidate->size(); - QSize sz = fboSize; - - if (sz.width() < requestSize.width()) - sz.setWidth(qMax(requestSize.width(), qRound(sz.width() * 1.5))); - if (sz.height() < requestSize.height()) - sz.setHeight(qMax(requestSize.height(), qRound(sz.height() * 1.5))); - - // wasting too much space? - if (sz.width() * sz.height() > requestSize.width() * requestSize.height() * 4) - sz = requestSize; - - if (sz != fboSize) { - delete candidate; - candidate = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(sz), requestFormat); - } - - chosen = candidate; - } - } - - if (!chosen) { - if (strictSize) - chosen = new QGLFramebufferObject(requestSize, requestFormat); - else - chosen = new QGLFramebufferObject(maybeRoundToNextPowerOfTwo(requestSize), requestFormat); - } - - if (!chosen->isValid()) { - delete chosen; - chosen = 0; - } - - return chosen; -} - -void QGLFramebufferObjectPool::release(QGLFramebufferObject *fbo) -{ - if (fbo) - m_fbos << fbo; -} - - -QPaintEngine* QGLPixmapGLPaintDevice::paintEngine() const -{ - return data->paintEngine(); -} - -void QGLPixmapGLPaintDevice::beginPaint() -{ - if (!data->isValid()) - return; - - // QGLPaintDevice::beginPaint will store the current binding and replace - // it with m_thisFBO: - m_thisFBO = data->m_renderFbo->handle(); - QGLPaintDevice::beginPaint(); - - Q_ASSERT(data->paintEngine()->type() == QPaintEngine::OpenGL2); - - // QPixmap::fill() is deferred until now, where we actually need to do the fill: - if (data->needsFill()) { - const QColor &c = data->fillColor(); - float alpha = c.alphaF(); - glDisable(GL_SCISSOR_TEST); - glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha); - glClear(GL_COLOR_BUFFER_BIT); - } - else if (!data->isUninitialized()) { - // If the pixmap (GL Texture) has valid content (it has been - // uploaded from an image or rendered into before), we need to - // copy it from the texture to the render FBO. - - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); - glDisable(GL_BLEND); - -#if !defined(QT_OPENGL_ES_2) - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, data->width(), data->height(), 0, -999999, 999999); -#endif - - glViewport(0, 0, data->width(), data->height()); - - // Pass false to bind so it doesn't copy the FBO into the texture! - context()->drawTexture(QRect(0, 0, data->width(), data->height()), data->bind(false)); - } -} - -void QGLPixmapGLPaintDevice::endPaint() -{ - if (!data->isValid()) - return; - - data->copyBackFromRenderFbo(false); - - // Base's endPaint will restore the previous FBO binding - QGLPaintDevice::endPaint(); - - qgl_fbo_pool()->release(data->m_renderFbo); - data->m_renderFbo = 0; -} - -QGLContext* QGLPixmapGLPaintDevice::context() const -{ - data->ensureCreated(); - return data->m_ctx; -} - -QSize QGLPixmapGLPaintDevice::size() const -{ - return data->size(); -} - -bool QGLPixmapGLPaintDevice::alphaRequested() const -{ - return data->m_hasAlpha; -} - -void QGLPixmapGLPaintDevice::setPixmapData(QGLPixmapData* d) -{ - data = d; -} - -int qt_gl_pixmap_serial = 0; - -QGLPixmapData::QGLPixmapData(PixelType type) - : QPixmapData(type, OpenGLClass) - , m_renderFbo(0) - , m_engine(0) - , m_ctx(0) - , nativeImageHandleProvider(0) - , nativeImageHandle(0) - , m_dirty(false) - , m_hasFillColor(false) - , m_hasAlpha(false) - , inLRU(false) - , failedToAlloc(false) - , inTexturePool(false) -{ - setSerialNumber(++qt_gl_pixmap_serial); - m_glDevice.setPixmapData(this); - - qt_gl_register_pixmap(this); -} - -QGLPixmapData::~QGLPixmapData() -{ - delete m_engine; - - destroyTexture(); - qt_gl_unregister_pixmap(this); -} - -void QGLPixmapData::destroyTexture() -{ - if (inTexturePool) { - QGLTexturePool *pool = QGLTexturePool::instance(); - if (m_texture.id) - pool->releaseTexture(this, m_texture.id); - } else { - if (m_texture.id) { - QGLWidget *shareWidget = qt_gl_share_widget(); - if (shareWidget) { - QGLShareContextScope ctx(shareWidget->context()); - glDeleteTextures(1, &m_texture.id); - } - } - } - m_texture.id = 0; - inTexturePool = false; - - releaseNativeImageHandle(); -} - -QPixmapData *QGLPixmapData::createCompatiblePixmapData() const -{ - return new QGLPixmapData(pixelType()); -} - -bool QGLPixmapData::isValid() const -{ - return w > 0 && h > 0; -} - -bool QGLPixmapData::isValidContext(const QGLContext *ctx) const -{ - if (ctx == m_ctx) - return true; - - const QGLContext *share_ctx = qt_gl_share_widget()->context(); - return ctx == share_ctx || QGLContext::areSharing(ctx, share_ctx); -} - -void QGLPixmapData::resize(int width, int height) -{ - if (width == w && height == h) - return; - - if (width <= 0 || height <= 0) { - width = 0; - height = 0; - } - - w = width; - h = height; - is_null = (w <= 0 || h <= 0); - d = pixelType() == QPixmapData::PixmapType ? 32 : 1; - - destroyTexture(); - - m_source = QVolatileImage(); - m_dirty = isValid(); - setSerialNumber(++qt_gl_pixmap_serial); -} - -void QGLPixmapData::ensureCreated() const -{ - if (!m_dirty) - return; - - m_dirty = false; - - if (nativeImageHandleProvider && !nativeImageHandle) - const_cast(this)->createFromNativeImageHandleProvider(); - - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - m_ctx = ctx; - - const GLenum internal_format = m_hasAlpha ? GL_RGBA : GL_RGB; -#ifdef QT_OPENGL_ES_2 - const GLenum external_format = internal_format; -#else - const GLenum external_format = qt_gl_preferredTextureFormat(); -#endif - const GLenum target = GL_TEXTURE_2D; - - GLenum type = GL_UNSIGNED_BYTE; - // Avoid conversion when pixmap is created from CFbsBitmap of EColor64K. - if (!m_source.isNull() && m_source.format() == QImage::Format_RGB16) - type = GL_UNSIGNED_SHORT_5_6_5; - - m_texture.options &= ~QGLContext::MemoryManagedBindOption; - - if (!m_texture.id) { - m_texture.id = QGLTexturePool::instance()->createTextureForPixmap( - target, - 0, internal_format, - w, h, - external_format, - type, - const_cast(this)); - if (!m_texture.id) { - failedToAlloc = true; - return; - } - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - inTexturePool = true; - } else if (inTexturePool) { - glBindTexture(target, m_texture.id); - QGLTexturePool::instance()->useTexture(const_cast(this)); - } - - if (!m_source.isNull() && m_texture.id) { - if (external_format == GL_RGB) { - m_source.beginDataAccess(); - QImage tx; - if (type == GL_UNSIGNED_BYTE) - tx = m_source.imageRef().convertToFormat(QImage::Format_RGB888).mirrored(false, true); - else if (type == GL_UNSIGNED_SHORT_5_6_5) - tx = m_source.imageRef().mirrored(false, true); - m_source.endDataAccess(true); - - glBindTexture(target, m_texture.id); - if (!tx.isNull()) - glTexSubImage2D(target, 0, 0, 0, w, h, external_format, - type, tx.constBits()); - else - qWarning("QGLPixmapData: Failed to create GL_RGB image of size %dx%d", w, h); - } else { - // do byte swizzling ARGB -> RGBA - m_source.beginDataAccess(); - const QImage tx = ctx->d_func()->convertToGLFormat(m_source.imageRef(), true, external_format); - m_source.endDataAccess(true); - glBindTexture(target, m_texture.id); - if (!tx.isNull()) - glTexSubImage2D(target, 0, 0, 0, w, h, external_format, - type, tx.constBits()); - else - qWarning("QGLPixmapData: Failed to create GL_RGBA image of size %dx%d", w, h); - } - - if (useFramebufferObjects()) - m_source = QVolatileImage(); - } -} - - -void QGLPixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags flags) -{ - QImage img = image; - createPixmapForImage(img, flags, false); -} - -void QGLPixmapData::fromImageReader(QImageReader *imageReader, - Qt::ImageConversionFlags flags) -{ - QImage image = imageReader->read(); - if (image.isNull()) - return; - - createPixmapForImage(image, flags, true); -} - -bool QGLPixmapData::fromFile(const QString &filename, const char *format, - Qt::ImageConversionFlags flags) -{ - if (pixelType() == QPixmapData::BitmapType) - return QPixmapData::fromFile(filename, format, flags); - QFile file(filename); - if (file.open(QIODevice::ReadOnly)) { - QByteArray data = file.peek(64); - bool alpha; - if (m_texture.canBindCompressedTexture - (data.constData(), data.size(), format, &alpha)) { - resize(0, 0); - data = file.readAll(); - file.close(); - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - QSize size = m_texture.bindCompressedTexture - (data.constData(), data.size(), format); - if (!size.isEmpty()) { - w = size.width(); - h = size.height(); - is_null = false; - d = 32; - m_hasAlpha = alpha; - m_source = QVolatileImage(); - m_dirty = isValid(); - return true; - } - return false; - } - } - - QImage image = QImageReader(filename, format).read(); - if (image.isNull()) - return false; - - createPixmapForImage(image, flags, true); - - return !isNull(); -} - -bool QGLPixmapData::fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags) -{ - bool alpha; - const char *buf = reinterpret_cast(buffer); - if (m_texture.canBindCompressedTexture(buf, int(len), format, &alpha)) { - resize(0, 0); - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - QSize size = m_texture.bindCompressedTexture(buf, int(len), format); - if (!size.isEmpty()) { - w = size.width(); - h = size.height(); - is_null = false; - d = 32; - m_hasAlpha = alpha; - m_source = QVolatileImage(); - m_dirty = isValid(); - return true; - } - } - - QByteArray a = QByteArray::fromRawData(reinterpret_cast(buffer), len); - QBuffer b(&a); - b.open(QIODevice::ReadOnly); - QImage image = QImageReader(&b, format).read(); - if (image.isNull()) - return false; - - createPixmapForImage(image, flags, true); - - return !isNull(); -} - -QImage::Format QGLPixmapData::idealFormat(QImage &image, Qt::ImageConversionFlags flags) -{ - QImage::Format format = QImage::Format_RGB32; - if (qApp->desktop()->depth() == 16) - format = QImage::Format_RGB16; - - if (image.hasAlphaChannel() - && ((flags & Qt::NoOpaqueDetection) - || const_cast(image).data_ptr()->checkForAlphaPixels())) - format = QImage::Format_ARGB32_Premultiplied; - - return format; -} - -void QGLPixmapData::createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace) -{ - if (image.size() == QSize(w, h)) - setSerialNumber(++qt_gl_pixmap_serial); - - resize(image.width(), image.height()); - - if (pixelType() == BitmapType) { - QImage convertedImage = image.convertToFormat(QImage::Format_MonoLSB); - if (image.format() == QImage::Format_MonoLSB) - convertedImage.detach(); - - m_source = QVolatileImage(convertedImage); - - } else { - QImage::Format format = idealFormat(image, flags); - - if (inPlace && image.data_ptr()->convertInPlace(format, flags)) { - m_source = QVolatileImage(image); - } else { - QImage convertedImage = image.convertToFormat(format); - - // convertToFormat won't detach the image if format stays the same. - if (image.format() == format) - convertedImage.detach(); - - m_source = QVolatileImage(convertedImage); - } - } - - m_dirty = true; - m_hasFillColor = false; - - m_hasAlpha = m_source.hasAlphaChannel(); - w = image.width(); - h = image.height(); - is_null = (w <= 0 || h <= 0); - d = m_source.depth(); - - destroyTexture(); -} - -bool QGLPixmapData::scroll(int dx, int dy, const QRect &rect) -{ - Q_UNUSED(dx); - Q_UNUSED(dy); - Q_UNUSED(rect); - return false; -} - -void QGLPixmapData::copy(const QPixmapData *data, const QRect &rect) -{ - if (data->classId() != QPixmapData::OpenGLClass || !static_cast(data)->useFramebufferObjects()) { - QPixmapData::copy(data, rect); - return; - } - - const QGLPixmapData *other = static_cast(data); - if (other->m_renderFbo) { - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - - resize(rect.width(), rect.height()); - m_hasAlpha = other->m_hasAlpha; - ensureCreated(); - - if (!ctx->d_ptr->fbo) - glGenFramebuffers(1, &ctx->d_ptr->fbo); - - glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, ctx->d_ptr->fbo); - glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_2D, m_texture.id, 0); - - if (!other->m_renderFbo->isBound()) - glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, other->m_renderFbo->handle()); - - glDisable(GL_SCISSOR_TEST); - if (ctx->d_ptr->active_engine && ctx->d_ptr->active_engine->type() == QPaintEngine::OpenGL2) - static_cast(ctx->d_ptr->active_engine)->invalidateState(); - - glBlitFramebufferEXT(rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height(), - 0, 0, w, h, - GL_COLOR_BUFFER_BIT, - GL_NEAREST); - - glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); - } else { - QPixmapData::copy(data, rect); - } -} - -void QGLPixmapData::fill(const QColor &color) -{ - if (!isValid()) - return; - - bool hasAlpha = color.alpha() != 255; - if (hasAlpha && !m_hasAlpha) { - if (m_texture.id) { - destroyTexture(); - m_dirty = true; - } - m_hasAlpha = color.alpha() != 255; - } - - if (useFramebufferObjects()) { - m_source = QVolatileImage(); - m_hasFillColor = true; - m_fillColor = color; - } else { - forceToImage(); - - if (m_source.depth() == 32) { - m_source.fill(PREMUL(color.rgba())); - - } else if (m_source.depth() == 1) { - if (color == Qt::color1) - m_source.fill(1); - else - m_source.fill(0); - } - } -} - -bool QGLPixmapData::hasAlphaChannel() const -{ - return m_hasAlpha; -} - -QImage QGLPixmapData::fillImage(const QColor &color) const -{ - QImage img; - if (pixelType() == BitmapType) { - img = QImage(w, h, QImage::Format_MonoLSB); - - img.setColorCount(2); - img.setColor(0, QColor(Qt::color0).rgba()); - img.setColor(1, QColor(Qt::color1).rgba()); - - if (color == Qt::color1) - img.fill(1); - else - img.fill(0); - } else { - img = QImage(w, h, - m_hasAlpha - ? QImage::Format_ARGB32_Premultiplied - : QImage::Format_RGB32); - img.fill(PREMUL(color.rgba())); - } - return img; -} - -extern QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha); - -QImage QGLPixmapData::toImage() const -{ - if (!isValid()) - return QImage(); - - if (m_renderFbo) { - copyBackFromRenderFbo(true); - } else if (!m_source.isNull()) { - // QVolatileImage::toImage() will make a copy always so no check - // for active painting is needed. - QImage img = m_source.toImage(); - if (img.format() == QImage::Format_MonoLSB) { - img.setColorCount(2); - img.setColor(0, QColor(Qt::color0).rgba()); - img.setColor(1, QColor(Qt::color1).rgba()); - } - return img; - } else if (m_dirty || m_hasFillColor) { - return fillImage(m_fillColor); - } else { - ensureCreated(); - } - - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - glBindTexture(GL_TEXTURE_2D, m_texture.id); - return qt_gl_read_texture(QSize(w, h), true, true); -} - -struct TextureBuffer -{ - QGLFramebufferObject *fbo; - QGL2PaintEngineEx *engine; -}; - -Q_GLOBAL_STATIC(QGLFramebufferObjectPool, _qgl_fbo_pool) -QGLFramebufferObjectPool* qgl_fbo_pool() -{ - return _qgl_fbo_pool(); -} - -void QGLPixmapData::copyBackFromRenderFbo(bool keepCurrentFboBound) const -{ - if (!isValid()) - return; - - m_hasFillColor = false; - - const QGLContext *share_ctx = qt_gl_share_widget()->context(); - QGLShareContextScope ctx(share_ctx); - - ensureCreated(); - - if (!ctx->d_ptr->fbo) - glGenFramebuffers(1, &ctx->d_ptr->fbo); - - glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, ctx->d_ptr->fbo); - glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_2D, m_texture.id, 0); - - const int x0 = 0; - const int x1 = w; - const int y0 = 0; - const int y1 = h; - - if (!m_renderFbo->isBound()) - glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, m_renderFbo->handle()); - - glDisable(GL_SCISSOR_TEST); - - glBlitFramebufferEXT(x0, y0, x1, y1, - x0, y0, x1, y1, - GL_COLOR_BUFFER_BIT, - GL_NEAREST); - - if (keepCurrentFboBound) { - glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); - } else { - glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, m_renderFbo->handle()); - ctx->d_ptr->current_fbo = m_renderFbo->handle(); - } -} - -bool QGLPixmapData::useFramebufferObjects() const -{ -#ifdef Q_OS_SYMBIAN - // We don't want to use FBOs on Symbian - return false; -#else - return QGLFramebufferObject::hasOpenGLFramebufferObjects() - && QGLFramebufferObject::hasOpenGLFramebufferBlit() - && qt_gl_preferGL2Engine() - && (w * h > 32*32); // avoid overhead of FBOs for small pixmaps -#endif -} - -QPaintEngine* QGLPixmapData::paintEngine() const -{ - if (!isValid()) - return 0; - - if (m_renderFbo) - return m_engine; - - if (useFramebufferObjects()) { - extern QGLWidget* qt_gl_share_widget(); - - if (!QGLContext::currentContext()) - qt_gl_share_widget()->makeCurrent(); - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - - QGLFramebufferObjectFormat format; - format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); - format.setSamples(4); - format.setInternalTextureFormat(GLenum(m_hasAlpha ? GL_RGBA : GL_RGB)); - - m_renderFbo = qgl_fbo_pool()->acquire(size(), format); - - if (m_renderFbo) { - if (!m_engine) - m_engine = new QGL2PaintEngineEx; - return m_engine; - } - - qWarning() << "Failed to create pixmap texture buffer of size " << size() << ", falling back to raster paint engine"; - } - - // If the application wants to paint into the QPixmap, we first - // force it to QImage format and then paint into that. - // This is simpler than juggling multiple GL contexts. - const_cast(this)->forceToImage(); - - if (m_hasFillColor) { - m_source.fill(PREMUL(m_fillColor.rgba())); - m_hasFillColor = false; - } - return m_source.paintEngine(); -} - -extern QRgb qt_gl_convertToGLFormat(QRgb src_pixel, GLenum texture_format); - -// If copyBack is true, bind will copy the contents of the render -// FBO to the texture (which is not bound to the texture, as it's -// a multisample FBO). -GLuint QGLPixmapData::bind(bool copyBack) const -{ - if (m_renderFbo && copyBack) { - copyBackFromRenderFbo(true); - } else { - ensureCreated(); - } - - GLuint id = m_texture.id; - glBindTexture(GL_TEXTURE_2D, id); - - if (m_hasFillColor) { - if (!useFramebufferObjects()) { - m_source = QVolatileImage(w, h, QImage::Format_ARGB32_Premultiplied); - m_source.fill(PREMUL(m_fillColor.rgba())); - } - - m_hasFillColor = false; - - GLenum format = qt_gl_preferredTextureFormat(); - QImage tx(w, h, QImage::Format_ARGB32_Premultiplied); - tx.fill(qt_gl_convertToGLFormat(m_fillColor.rgba(), format)); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, format, GL_UNSIGNED_BYTE, tx.constBits()); - } - - return id; -} - -QGLTexture* QGLPixmapData::texture() const -{ - return &m_texture; -} - -void QGLPixmapData::detachTextureFromPool() -{ - if (inTexturePool) { - QGLTexturePool::instance()->detachTexture(this); - inTexturePool = false; - } -} - -void QGLPixmapData::hibernate() -{ - // If the image was imported (e.g, from an SgImage under Symbian), then - // skip the hibernation, there is no sense in copying it back to main - // memory because the data is most likely shared between several processes. - bool skipHibernate = (m_texture.id && m_source.isNull()); -#if defined(Q_OS_SYMBIAN) - // However we have to proceed normally if the image was retrieved via - // a handle provider. - skipHibernate &= !nativeImageHandleProvider; -#endif - if (skipHibernate) - return; - - forceToImage(); - destroyTexture(); -} - -void QGLPixmapData::reclaimTexture() -{ - if (!inTexturePool) - return; - forceToImage(); - destroyTexture(); -} - -int QGLPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const -{ - if (w == 0) - return 0; - - switch (metric) { - case QPaintDevice::PdmWidth: - return w; - case QPaintDevice::PdmHeight: - return h; - case QPaintDevice::PdmNumColors: - return 0; - case QPaintDevice::PdmDepth: - return d; - case QPaintDevice::PdmWidthMM: - return qRound(w * 25.4 / qt_defaultDpiX()); - case QPaintDevice::PdmHeightMM: - return qRound(h * 25.4 / qt_defaultDpiY()); - case QPaintDevice::PdmDpiX: - case QPaintDevice::PdmPhysicalDpiX: - return qt_defaultDpiX(); - case QPaintDevice::PdmDpiY: - case QPaintDevice::PdmPhysicalDpiY: - return qt_defaultDpiY(); - default: - qWarning("QGLPixmapData::metric(): Invalid metric"); - return 0; - } -} - -// Force the pixmap data to be backed by some valid data. -void QGLPixmapData::forceToImage() -{ - if (!isValid()) - return; - - if (m_source.isNull()) { - QImage::Format format = QImage::Format_ARGB32_Premultiplied; - if (pixelType() == BitmapType) - format = QImage::Format_MonoLSB; - m_source = QVolatileImage(w, h, format); - } - - m_dirty = true; -} - -QGLPaintDevice *QGLPixmapData::glDevice() const -{ - return &m_glDevice; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp deleted file mode 100644 index 8a8eb38b7c4..00000000000 --- a/src/opengl/qpixmapdata_x11gl_egl.cpp +++ /dev/null @@ -1,403 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include -#include -#include -#include - -#if !defined(QT_OPENGL_ES_1) -#include -#endif - -#ifndef QT_OPENGL_ES_2 -#include -#endif - -#include -#include - -#include "qpixmapdata_x11gl_p.h" - -QT_BEGIN_NAMESPACE - - -class QX11GLSharedContexts -{ -public: - QX11GLSharedContexts() - : rgbContext(0) - , argbContext(0) - , sharedQGLContext(0) - , sharePixmap(0) - { - EGLint rgbConfigId; - EGLint argbConfigId; - - do { - EGLConfig rgbConfig = QEgl::defaultConfig(QInternal::Pixmap, QEgl::OpenGL, QEgl::Renderable); - EGLConfig argbConfig = QEgl::defaultConfig(QInternal::Pixmap, QEgl::OpenGL, - QEgl::Renderable | QEgl::Translucent); - - eglGetConfigAttrib(QEgl::display(), rgbConfig, EGL_CONFIG_ID, &rgbConfigId); - eglGetConfigAttrib(QEgl::display(), argbConfig, EGL_CONFIG_ID, &argbConfigId); - - rgbContext = new QEglContext; - rgbContext->setConfig(rgbConfig); - rgbContext->createContext(); - - if (!rgbContext->isValid()) - break; - - // If the RGB & ARGB configs are the same, use the same egl context for both: - if (rgbConfig == argbConfig) - argbContext = rgbContext; - - // Otherwise, create a separate context to be used for ARGB pixmaps: - if (!argbContext) { - argbContext = new QEglContext; - argbContext->setConfig(argbConfig); - bool success = argbContext->createContext(rgbContext); - if (!success) { - qWarning("QX11GLPixmapData - RGB & ARGB contexts aren't shared"); - success = argbContext->createContext(); - if (!success) - argbContext = rgbContext; // Might work, worth a shot at least. - } - } - - if (!argbContext->isValid()) - break; - - // Create the pixmap which will be used to create the egl surface for the share QGLContext - QX11PixmapData *rgbPixmapData = new QX11PixmapData(QPixmapData::PixmapType); - rgbPixmapData->resize(8, 8); - rgbPixmapData->fill(Qt::red); - sharePixmap = new QPixmap(rgbPixmapData); - EGLSurface sharePixmapSurface = QEgl::createSurface(sharePixmap, rgbConfig); - rgbPixmapData->gl_surface = (void*)sharePixmapSurface; - - // Create the actual QGLContext which will be used for sharing - sharedQGLContext = new QGLContext(QX11GLPixmapData::glFormat()); - sharedQGLContext->d_func()->eglContext = rgbContext; - sharedQGLContext->d_func()->eglSurface = sharePixmapSurface; - sharedQGLContext->d_func()->valid = true; - qt_glformat_from_eglconfig(sharedQGLContext->d_func()->glFormat, rgbConfig); - - - valid = rgbContext->makeCurrent(sharePixmapSurface); - - // If the ARGB & RGB configs are different, check ARGB works too: - if (argbConfig != rgbConfig) { - QX11PixmapData *argbPixmapData = new QX11PixmapData(QPixmapData::PixmapType); - argbPixmapData->resize(8, 8); - argbPixmapData->fill(Qt::transparent); // Force ARGB - QPixmap argbPixmap(argbPixmapData); // destroys pixmap data when goes out of scope - EGLSurface argbPixmapSurface = QEgl::createSurface(&argbPixmap, argbConfig); - valid = argbContext->makeCurrent(argbPixmapSurface); - argbContext->doneCurrent(); - eglDestroySurface(QEgl::display(), argbPixmapSurface); - argbPixmapData->gl_surface = 0; - } - - if (!valid) { - qWarning() << "Unable to make pixmap surface current:" << QEgl::errorString(); - break; - } - - // The pixmap surface destruction hooks are installed by QGLTextureCache, so we - // must make sure this is instanciated: - QGLTextureCache::instance(); - } while(0); - - if (!valid) - cleanup(); - else - qDebug("Using QX11GLPixmapData with EGL config %d for ARGB and config %d for RGB", argbConfigId, rgbConfigId); - - } - - ~QX11GLSharedContexts() { - cleanup(); - } - - void cleanup() { - if (sharedQGLContext) { - delete sharedQGLContext; - sharedQGLContext = 0; - } - if (argbContext && argbContext != rgbContext) - delete argbContext; - argbContext = 0; - - if (rgbContext) { - delete rgbContext; - rgbContext = 0; - } - - // Deleting the QPixmap will fire the pixmap destruction cleanup hooks which in turn - // will destroy the egl surface: - if (sharePixmap) { - delete sharePixmap; - sharePixmap = 0; - } - } - - bool isValid() { return valid;} - - // On 16bpp systems, RGB & ARGB pixmaps are different bit-depths and therefore need - // different contexts: - QEglContext *rgbContext; - QEglContext *argbContext; - - // The share context wraps the rgbContext and is used as the master of the context share - // group. As all other contexts will have the same egl context (or a shared one if rgb != argb) - // all QGLContexts will actually be sharing and can be in the same context group. - QGLContext *sharedQGLContext; -private: - QPixmap *sharePixmap; - bool valid; -}; - -static void qt_cleanup_x11gl_share_contexts(); - -Q_GLOBAL_STATIC_WITH_INITIALIZER(QX11GLSharedContexts, qt_x11gl_share_contexts, - { - qAddPostRoutine(qt_cleanup_x11gl_share_contexts); - }) - -static void qt_cleanup_x11gl_share_contexts() -{ - qt_x11gl_share_contexts()->cleanup(); -} - - -QX11GLSharedContexts* QX11GLPixmapData::sharedContexts() -{ - return qt_x11gl_share_contexts(); -} - -bool QX11GLPixmapData::hasX11GLPixmaps() -{ - static bool checkedForX11GLPixmaps = false; - static bool haveX11GLPixmaps = false; - - if (checkedForX11GLPixmaps) - return haveX11GLPixmaps; - - haveX11GLPixmaps = qt_x11gl_share_contexts()->isValid(); - checkedForX11GLPixmaps = true; - - return haveX11GLPixmaps; -} - -QX11GLPixmapData::QX11GLPixmapData() - : QX11PixmapData(QPixmapData::PixmapType), - ctx(0) -{ -} - -QX11GLPixmapData::~QX11GLPixmapData() -{ - if (ctx) - delete ctx; -} - - -void QX11GLPixmapData::fill(const QColor &color) -{ - if (ctx) { - ctx->makeCurrent(); - glFinish(); - eglWaitClient(); - } - - QX11PixmapData::fill(color); - XSync(X11->display, False); - - if (ctx) { - ctx->makeCurrent(); - eglWaitNative(EGL_CORE_NATIVE_ENGINE); - } -} - -void QX11GLPixmapData::copy(const QPixmapData *data, const QRect &rect) -{ - if (ctx) { - ctx->makeCurrent(); - glFinish(); - eglWaitClient(); - } - - QX11PixmapData::copy(data, rect); - XSync(X11->display, False); - - if (ctx) { - ctx->makeCurrent(); - eglWaitNative(EGL_CORE_NATIVE_ENGINE); - } -} - -bool QX11GLPixmapData::scroll(int dx, int dy, const QRect &rect) -{ - if (ctx) { - ctx->makeCurrent(); - glFinish(); - eglWaitClient(); - } - - bool success = QX11PixmapData::scroll(dx, dy, rect); - XSync(X11->display, False); - - if (ctx) { - ctx->makeCurrent(); - eglWaitNative(EGL_CORE_NATIVE_ENGINE); - } - - return success; -} - -#if !defined(QT_OPENGL_ES_1) -Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_pixmap_2_engine) -#endif - -#ifndef QT_OPENGL_ES_2 -Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_gl_pixmap_engine) -#endif - - -QPaintEngine* QX11GLPixmapData::paintEngine() const -{ - // We need to create the context before beginPaint - do it here: - if (!ctx) { - ctx = new QGLContext(glFormat()); - Q_ASSERT(ctx->d_func()->eglContext == 0); - ctx->d_func()->eglContext = hasAlphaChannel() ? sharedContexts()->argbContext : sharedContexts()->rgbContext; - - // While we use a separate QGLContext for each pixmap, the underlying QEglContext is - // the same. So we must use a "fake" QGLContext and fool the texture cache into thinking - // each pixmap's QGLContext is sharing with this central one. The only place this is - // going to fail is where we the underlying EGL RGB and ARGB contexts aren't sharing. - ctx->d_func()->sharing = true; - QGLContextGroup::addShare(ctx, sharedContexts()->sharedQGLContext); - - // Update the glFormat for the QGLContext: - qt_glformat_from_eglconfig(ctx->d_func()->glFormat, ctx->d_func()->eglContext->config()); - } - - QPaintEngine* engine; - -#if defined(QT_OPENGL_ES_1) - engine = qt_gl_pixmap_engine(); -#elif defined(QT_OPENGL_ES_2) - engine = qt_gl_pixmap_2_engine(); -#else - if (qt_gl_preferGL2Engine()) - engine = qt_gl_pixmap_2_engine(); - else - engine = qt_gl_pixmap_engine(); -#endif - - - - // Support multiple painters on multiple pixmaps simultaniously - if (engine->isActive()) { - qWarning("Pixmap paint engine already active"); - -#if defined(QT_OPENGL_ES_1) - engine = new QOpenGLPaintEngine; -#elif defined(QT_OPENGL_ES_2) - engine = new QGL2PaintEngineEx; -#else - if (qt_gl_preferGL2Engine()) - engine = new QGL2PaintEngineEx; - else - engine = new QOpenGLPaintEngine; -#endif - - engine->setAutoDestruct(true); - return engine; - } - - return engine; -} - -void QX11GLPixmapData::beginPaint() -{ -// qDebug("QX11GLPixmapData::beginPaint()"); - // TODO: Check to see if the surface is renderable - if ((EGLSurface)gl_surface == EGL_NO_SURFACE) { - QPixmap tmpPixmap(this); - EGLConfig cfg = ctx->d_func()->eglContext->config(); - Q_ASSERT(cfg != QEGL_NO_CONFIG); - -// qDebug("QX11GLPixmapData - using EGL Config ID %d", ctx->d_func()->eglContext->configAttrib(EGL_CONFIG_ID)); - EGLSurface surface = QEgl::createSurface(&tmpPixmap, cfg); - if (surface == EGL_NO_SURFACE) { - qWarning() << "Error creating EGL surface for pixmap:" << QEgl::errorString(); - return; - } - gl_surface = (void*)surface; - ctx->d_func()->eglSurface = surface; - ctx->d_func()->valid = true; - } - QGLPaintDevice::beginPaint(); -} - -QGLContext* QX11GLPixmapData::context() const -{ - return ctx; -} - -QSize QX11GLPixmapData::size() const -{ - return QSize(w, h); -} - - -QGLFormat QX11GLPixmapData::glFormat() -{ - return QGLFormat::defaultFormat(); //### -} - -QT_END_NAMESPACE diff --git a/src/opengl/qpixmapdata_x11gl_p.h b/src/opengl/qpixmapdata_x11gl_p.h deleted file mode 100644 index 0a6c4e8f2f0..00000000000 --- a/src/opengl/qpixmapdata_x11gl_p.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPIXMAPDATA_X11GL_P_H -#define QPIXMAPDATA_X11GL_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 - -#ifndef QT_NO_EGL -#include -#endif - -QT_BEGIN_NAMESPACE - -class QX11GLSharedContexts; - -class QX11GLPixmapData : public QX11PixmapData, public QGLPaintDevice -{ -public: - QX11GLPixmapData(); - virtual ~QX11GLPixmapData(); - - // Re-implemented from QX11PixmapData: - void fill(const QColor &color); - void copy(const QPixmapData *data, const QRect &rect); - bool scroll(int dx, int dy, const QRect &rect); - - // Re-implemented from QGLPaintDevice - QPaintEngine* paintEngine() const; // Also re-implements QX11PixmapData::paintEngine - void beginPaint(); - QGLContext* context() const; - QSize size() const; - - static bool hasX11GLPixmaps(); - static QGLFormat glFormat(); - static QX11GLSharedContexts* sharedContexts(); - -private: - mutable QGLContext* ctx; -}; - - -QT_END_NAMESPACE - -#endif // QPIXMAPDATA_X11GL_P_H diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp deleted file mode 100644 index 4f00908b9d6..00000000000 --- a/src/opengl/qwindowsurface_gl.cpp +++ /dev/null @@ -1,1174 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include "qdebug.h" - -#ifdef Q_WS_X11 -#include -#include - -#ifndef QT_OPENGL_ES -#include -#include -#endif -#endif //Q_WS_X11 - -#include -#include - -#include - -#include -#include - -#include -#include - -#ifndef QT_OPENGL_ES_2 -#include -#endif - -#ifndef GLX_ARB_multisample -#define GLX_SAMPLE_BUFFERS_ARB 100000 -#define GLX_SAMPLES_ARB 100001 -#endif - -#ifndef QT_NO_EGL -#include -#endif - -QT_BEGIN_NAMESPACE - -// -// QGLGraphicsSystem -// -#ifdef Q_WS_WIN -extern Q_GUI_EXPORT bool qt_win_owndc_required; -#endif -QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL) - : QGraphicsSystem(), m_useX11GL(useX11GL) -{ -#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES) - // only override the system defaults if the user hasn't already - // picked a visual - if (X11->visual == 0 && X11->visual_id == -1 && X11->visual_class == -1) { - // find a double buffered, RGBA visual that supports OpenGL - // and set that as the default visual for windows in Qt - int i = 0; - int spec[16]; - spec[i++] = GLX_RGBA; - spec[i++] = GLX_DOUBLEBUFFER; - - if (!qgetenv("QT_GL_SWAPBUFFER_PRESERVE").isNull()) { - spec[i++] = GLX_DEPTH_SIZE; - spec[i++] = 8; - spec[i++] = GLX_STENCIL_SIZE; - spec[i++] = 8; - spec[i++] = GLX_SAMPLE_BUFFERS_ARB; - spec[i++] = 1; - spec[i++] = GLX_SAMPLES_ARB; - spec[i++] = 4; - } - - spec[i++] = XNone; - - XVisualInfo *vi = glXChooseVisual(X11->display, X11->defaultScreen, spec); - if (vi) { - X11->visual_id = vi->visualid; - X11->visual_class = vi->c_class; - - QGLFormat format; - int res; - glXGetConfig(X11->display, vi, GLX_LEVEL, &res); - format.setPlane(res); - glXGetConfig(X11->display, vi, GLX_DOUBLEBUFFER, &res); - format.setDoubleBuffer(res); - glXGetConfig(X11->display, vi, GLX_DEPTH_SIZE, &res); - format.setDepth(res); - if (format.depth()) - format.setDepthBufferSize(res); - glXGetConfig(X11->display, vi, GLX_RGBA, &res); - format.setRgba(res); - glXGetConfig(X11->display, vi, GLX_RED_SIZE, &res); - format.setRedBufferSize(res); - glXGetConfig(X11->display, vi, GLX_GREEN_SIZE, &res); - format.setGreenBufferSize(res); - glXGetConfig(X11->display, vi, GLX_BLUE_SIZE, &res); - format.setBlueBufferSize(res); - glXGetConfig(X11->display, vi, GLX_ALPHA_SIZE, &res); - format.setAlpha(res); - if (format.alpha()) - format.setAlphaBufferSize(res); - glXGetConfig(X11->display, vi, GLX_ACCUM_RED_SIZE, &res); - format.setAccum(res); - if (format.accum()) - format.setAccumBufferSize(res); - glXGetConfig(X11->display, vi, GLX_STENCIL_SIZE, &res); - format.setStencil(res); - if (format.stencil()) - format.setStencilBufferSize(res); - glXGetConfig(X11->display, vi, GLX_STEREO, &res); - format.setStereo(res); - glXGetConfig(X11->display, vi, GLX_SAMPLE_BUFFERS_ARB, &res); - format.setSampleBuffers(res); - if (format.sampleBuffers()) { - glXGetConfig(X11->display, vi, GLX_SAMPLES_ARB, &res); - format.setSamples(res); - } - - QGLWindowSurface::surfaceFormat = format; - XFree(vi); - - printf("using visual class %x, id %x\n", X11->visual_class, X11->visual_id); - } - } -#elif defined(Q_WS_WIN) - QGLWindowSurface::surfaceFormat.setDoubleBuffer(true); - - qt_win_owndc_required = true; -#endif -} - -static void qt_cleanup_gl_share_widget(); - -// -// QGLWindowSurface -// -class QGLGlobalShareWidget -{ -public: - QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) { - // ### FIXME - readd the post routine if the qApp is recreated - qAddPostRoutine(qt_cleanup_gl_share_widget); - created = true; - } - - QGLWidget *shareWidget() { - if (!initializing && !widget && !cleanedUp) { - initializing = true; - widget = new QGLWidget(QGLFormat(QGL::SingleBuffer | QGL::NoDepthBuffer | QGL::NoStencilBuffer)); - widget->resize(1, 1); - - // We don't need this internal widget to appear in QApplication::topLevelWidgets() - if (QWidgetPrivate::allWidgets) - QWidgetPrivate::allWidgets->remove(widget); - initializing = false; - } - return widget; - } - - // destroys the share widget and prevents recreation - void cleanup() { - QGLWidget *w = widget; - cleanedUp = true; - widget = 0; - delete w; - } - - // destroys the share widget, but allows it to be recreated later on - void destroy() { - if (cleanedUp) - return; - - QGLWidget *w = widget; - - // prevent potential recursions - cleanedUp = true; - widget = 0; - delete w; - cleanedUp = false; - } - - static bool cleanedUp; - static bool created; - - QGLPixmapData *firstPixmap; - int widgetRefCount; - -private: - QGLWidget *widget; - bool initializing; -}; - -bool QGLGlobalShareWidget::cleanedUp = false; -bool QGLGlobalShareWidget::created = false; - -Q_GLOBAL_STATIC(QGLGlobalShareWidget, _qt_gl_share_widget) - -static void qt_cleanup_gl_share_widget() -{ - if (QGLGlobalShareWidget::created) - _qt_gl_share_widget()->cleanup(); -} - -QGLWidget* qt_gl_share_widget() -{ - if (QGLGlobalShareWidget::cleanedUp) - return 0; - return _qt_gl_share_widget()->shareWidget(); -} - -void qt_destroy_gl_share_widget() -{ - if (QGLGlobalShareWidget::created) - _qt_gl_share_widget()->destroy(); -} - -const QGLContext *qt_gl_share_context() -{ - QGLWidget *widget = qt_gl_share_widget(); - if (widget) - return widget->context(); - return 0; -} - -#ifdef QGL_USE_TEXTURE_POOL -void qt_gl_register_pixmap(QGLPixmapData *pd) -{ - QGLGlobalShareWidget *shared = _qt_gl_share_widget(); - pd->next = shared->firstPixmap; - pd->prev = 0; - if (shared->firstPixmap) - shared->firstPixmap->prev = pd; - shared->firstPixmap = pd; -} - -void qt_gl_unregister_pixmap(QGLPixmapData *pd) -{ - if (pd->next) - pd->next->prev = pd->prev; - if (pd->prev) { - pd->prev->next = pd->next; - } else { - QGLGlobalShareWidget *shared = _qt_gl_share_widget(); - if (shared) - shared->firstPixmap = pd->next; - } -} - -void qt_gl_hibernate_pixmaps() -{ - QGLGlobalShareWidget *shared = _qt_gl_share_widget(); - - // Scan all QGLPixmapData objects in the system and hibernate them. - QGLPixmapData *pd = shared->firstPixmap; - while (pd != 0) { - pd->hibernate(); - pd = pd->next; - } -} -#endif - -struct QGLWindowSurfacePrivate -{ - QGLFramebufferObject *fbo; - QGLPixelBuffer *pb; - GLuint tex_id; - GLuint pb_tex_id; - - int tried_fbo : 1; - int tried_pb : 1; - int destructive_swap_buffers : 1; - int geometry_updated : 1; - int did_paint : 1; - - QGLContext *ctx; - - QList contexts; - - QRegion paintedRegion; - QSize size; - - QSize textureSize; - - QList buffers; - QGLWindowSurfaceGLPaintDevice glDevice; - QGLWindowSurface* q_ptr; - - bool swap_region_support; -}; - -QGLFormat QGLWindowSurface::surfaceFormat; -QGLWindowSurface::SwapMode QGLWindowSurface::swapBehavior = QGLWindowSurface::AutomaticSwap; - -void QGLWindowSurfaceGLPaintDevice::endPaint() -{ - glFlush(); - QGLPaintDevice::endPaint(); -} - -QSize QGLWindowSurfaceGLPaintDevice::size() const -{ - return d->size; -} - -QGLContext* QGLWindowSurfaceGLPaintDevice::context() const -{ - return d->ctx; -} - - -int QGLWindowSurfaceGLPaintDevice::metric(PaintDeviceMetric m) const -{ - return qt_paint_device_metric(d->q_ptr->window(), m); -} - -QPaintEngine *QGLWindowSurfaceGLPaintDevice::paintEngine() const -{ - return qt_qgl_paint_engine(); -} - -QGLWindowSurface::QGLWindowSurface(QWidget *window) - : QWindowSurface(window), d_ptr(new QGLWindowSurfacePrivate) -{ -// Q_ASSERT(window->isTopLevel()); - d_ptr->pb = 0; - d_ptr->fbo = 0; - d_ptr->ctx = 0; - d_ptr->tex_id = 0; -#if defined (QT_OPENGL_ES_2) - d_ptr->tried_fbo = true; - d_ptr->tried_pb = true; -#else - d_ptr->tried_fbo = false; - d_ptr->tried_pb = false; -#endif - d_ptr->destructive_swap_buffers = qgetenv("QT_GL_SWAPBUFFER_PRESERVE").isNull(); - d_ptr->glDevice.d = d_ptr; - d_ptr->q_ptr = this; - d_ptr->geometry_updated = false; - d_ptr->did_paint = false; - d_ptr->swap_region_support = false; -} - -QGLWindowSurface::~QGLWindowSurface() -{ - if (d_ptr->ctx) - glDeleteTextures(1, &d_ptr->tex_id); -#ifndef Q_WS_QPA // Dont delete the contexts. Destroying the window does that for us - foreach(QGLContext **ctx, d_ptr->contexts) { - delete *ctx; - *ctx = 0; - } -#endif - delete d_ptr->pb; - delete d_ptr->fbo; - delete d_ptr; - - if (QGLGlobalShareWidget::cleanedUp) - return; - - --(_qt_gl_share_widget()->widgetRefCount); - -#ifdef QGL_USE_TEXTURE_POOL - if (_qt_gl_share_widget()->widgetRefCount <= 0) { - // All of the widget window surfaces have been destroyed - // but we still have GL pixmaps active. Ask them to hibernate - // to free up GPU resources until a widget is shown again. - // This may eventually cause the EGLContext to be destroyed - // because nothing in the system needs a context, which will - // free up even more GPU resources. - qt_gl_hibernate_pixmaps(); - - // Destroy the context if necessary. - if (!qt_gl_share_widget()->context()->isSharing()) - qt_destroy_gl_share_widget(); - } -#endif // QGL_USE_TEXTURE_POOL -} - -void QGLWindowSurface::deleted(QObject *object) -{ - QWidget *widget = qobject_cast(object); - if (widget) { - if (widget == window()) { - // Make sure that the fbo is destroyed before destroying its context. - delete d_ptr->fbo; - d_ptr->fbo = 0; - } - -#ifndef Q_WS_QPA //no need to specifically delete the QGLContext as it will be deleted by QWidget - QWidgetPrivate *widgetPrivate = widget->d_func(); - if (widgetPrivate->extraData()) { - union { QGLContext **ctxPtrPtr; void **voidPtrPtr; }; - voidPtrPtr = &widgetPrivate->extraData()->glContext; - int index = d_ptr->contexts.indexOf(ctxPtrPtr); - if (index != -1) { - delete *ctxPtrPtr; - *ctxPtrPtr = 0; - d_ptr->contexts.removeAt(index); - } - } -#endif - } -} - -void QGLWindowSurface::hijackWindow(QWidget *widget) -{ - QWidgetPrivate *widgetPrivate = widget->d_func(); - widgetPrivate->createExtra(); - if (widgetPrivate->extraData()->glContext) - return; - - QGLContext *ctx = NULL; - - // For translucent top-level widgets we need alpha in the format. - if (widget->testAttribute(Qt::WA_TranslucentBackground)) { - QGLFormat modFormat(surfaceFormat); - modFormat.setSampleBuffers(false); - modFormat.setSamples(0); - modFormat.setAlpha(true); - ctx = new QGLContext(modFormat, widget); - } else - ctx = new QGLContext(surfaceFormat, widget); - - ctx->create(qt_gl_share_context()); - - if (widget != qt_gl_share_widget()) - ++(_qt_gl_share_widget()->widgetRefCount); - -#ifndef QT_NO_EGL - static bool checkedForNOKSwapRegion = false; - static bool haveNOKSwapRegion = false; - - if (!checkedForNOKSwapRegion) { - haveNOKSwapRegion = QEgl::hasExtension("EGL_NOK_swap_region2"); - checkedForNOKSwapRegion = true; - - if (haveNOKSwapRegion) - qDebug() << "Found EGL_NOK_swap_region2 extension. Using partial updates."; - } - - d_ptr->destructive_swap_buffers = true; - if (ctx->d_func()->eglContext->configAttrib(EGL_SURFACE_TYPE)&EGL_SWAP_BEHAVIOR_PRESERVED_BIT) { - EGLint swapBehavior; - if (eglQuerySurface(ctx->d_func()->eglContext->display(), ctx->d_func()->eglSurface - , EGL_SWAP_BEHAVIOR, &swapBehavior)) { - d_ptr->destructive_swap_buffers = (swapBehavior != EGL_BUFFER_PRESERVED); - } - } - - d_ptr->swap_region_support = haveNOKSwapRegion; -#endif - - widgetPrivate->extraData()->glContext = ctx; - - union { QGLContext **ctxPtrPtr; void **voidPtrPtr; }; - - connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(deleted(QObject*))); - - voidPtrPtr = &widgetPrivate->extraData()->glContext; - d_ptr->contexts << ctxPtrPtr; -#ifndef Q_OS_SYMBIAN - qDebug() << "hijackWindow() context created for" << widget << d_ptr->contexts.size(); -#endif -} - -QGLContext *QGLWindowSurface::context() const -{ - return d_ptr->ctx; -} - -QPaintDevice *QGLWindowSurface::paintDevice() -{ - updateGeometry(); - - if (d_ptr->pb) - return d_ptr->pb; - - if (d_ptr->ctx) - return &d_ptr->glDevice; - - QGLContext *ctx = reinterpret_cast(window()->d_func()->extraData()->glContext); - ctx->makeCurrent(); - - Q_ASSERT(d_ptr->fbo); - return d_ptr->fbo; -} - -static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, const QRectF &src = QRectF()); - -void QGLWindowSurface::beginPaint(const QRegion &) -{ - d_ptr->did_paint = true; - updateGeometry(); - - int clearFlags = 0; - - QGLContext *ctx = reinterpret_cast(window()->d_func()->extraData()->glContext); - - if (!ctx) - return; - - if (ctx->d_func()->workaround_needsFullClearOnEveryFrame) - clearFlags = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; - else if (ctx->format().alpha()) - clearFlags = GL_COLOR_BUFFER_BIT; - - if (clearFlags) { - if (d_ptr->fbo) - d_ptr->fbo->bind(); - - glClearColor(0.0, 0.0, 0.0, 0.0); - glClear(clearFlags); - - if (d_ptr->fbo) - d_ptr->fbo->release(); - } -} - -void QGLWindowSurface::endPaint(const QRegion &rgn) -{ - if (context()) - d_ptr->paintedRegion |= rgn; - - d_ptr->buffers.clear(); -} - -static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport, const QSize &texSize, const QRect &targetRect, const QRect &sourceRect) -{ - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); - glDisable(GL_BLEND); - - glViewport(0, 0, viewport.width(), viewport.height()); - - QGLShaderProgram *blitProgram = - QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram(); - blitProgram->bind(); - blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/); - - // The shader manager's blit program does not multiply the - // vertices by the pmv matrix, so we need to do the effect - // of the orthographic projection here ourselves. - QRectF r; - qreal w = viewport.width(); - qreal h = viewport.height(); - r.setLeft((targetRect.left() / w) * 2.0f - 1.0f); - if (targetRect.right() == (viewport.width() - 1)) - r.setRight(1.0f); - else - r.setRight((targetRect.right() / w) * 2.0f - 1.0f); - r.setBottom((targetRect.top() / h) * 2.0f - 1.0f); - if (targetRect.bottom() == (viewport.height() - 1)) - r.setTop(1.0f); - else - r.setTop((targetRect.bottom() / w) * 2.0f - 1.0f); - - drawTexture(r, texture, texSize, sourceRect); -} - - -void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset) -{ - //### Find out why d_ptr->geometry_updated isn't always false. - // flush() should not be called when d_ptr->geometry_updated is true. It assumes that either - // d_ptr->fbo or d_ptr->pb is allocated and has the correct size. - if (d_ptr->geometry_updated) - return; - - // did_paint is set to true in ::beginPaint. ::beginPaint means that we - // at least cleared the background (= painted something). In EGL API it's a - // mistake to call swapBuffers if nothing was painted unless - // EGL_BUFFER_PRESERVED is set. This check protects the flush func from - // being executed if it's for nothing. - if (!d_ptr->destructive_swap_buffers && !d_ptr->did_paint) - return; - -#ifdef Q_OS_SYMBIAN - if (window() != widget) { - // For performance reasons we don't support - // flushing native child widgets on Symbian. - // It breaks overlapping native child widget - // rendering in some cases but we prefer performance. - return; - } -#endif - - - QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); - Q_ASSERT(parent); - -#if !defined(Q_WS_QPA) - if (!geometry().isValid()) - return; -#else - if (!size().isValid()) - return; -#endif - - // Needed to support native child-widgets... - hijackWindow(parent); - - QRect br = rgn.boundingRect().translated(offset); - br = br.intersected(window()->rect()); - QPoint wOffset = qt_qwidget_data(parent)->wrect.topLeft(); - QRect rect = br.translated(-offset - wOffset); - - const GLenum target = GL_TEXTURE_2D; - Q_UNUSED(target); - - if (QGLWindowSurface::swapBehavior == QGLWindowSurface::KillSwap) - return; - - if (context()) { - context()->makeCurrent(); - - if (context()->format().doubleBuffer()) { -#if !defined(QT_OPENGL_ES_2) - if (d_ptr->destructive_swap_buffers) { - glBindTexture(target, d_ptr->tex_id); - - QVector rects = d_ptr->paintedRegion.rects(); - for (int i = 0; i < rects.size(); ++i) { - QRect br = rects.at(i); - if (br.isEmpty()) - continue; - - const uint bottom = window()->height() - (br.y() + br.height()); - glCopyTexSubImage2D(target, 0, br.x(), bottom, br.x(), bottom, br.width(), br.height()); - } - - glBindTexture(target, 0); - - QRegion dirtyRegion = QRegion(window()->rect()) - d_ptr->paintedRegion; - - if (!dirtyRegion.isEmpty()) { - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -#ifndef QT_OPENGL_ES - glOrtho(0, window()->width(), window()->height(), 0, -999999, 999999); -#else - glOrthof(0, window()->width(), window()->height(), 0, -999999, 999999); -#endif - glViewport(0, 0, window()->width(), window()->height()); - - QVector rects = dirtyRegion.rects(); - glColor4f(1, 1, 1, 1); - for (int i = 0; i < rects.size(); ++i) { - QRect rect = rects.at(i); - if (rect.isEmpty()) - continue; - - drawTexture(rect, d_ptr->tex_id, window()->size(), rect); - } - } - } -#endif - bool doingPartialUpdate = false; - if (d_ptr->swap_region_support) { - if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AutomaticSwap) - doingPartialUpdate = br.width() * br.height() < parent->geometry().width() * parent->geometry().height() * 0.2; - else if (QGLWindowSurface::swapBehavior == QGLWindowSurface::AlwaysPartialSwap) - doingPartialUpdate = true; - } - - QGLContext *ctx = reinterpret_cast(parent->d_func()->extraData()->glContext); - if (widget != window()) { - if (initializeOffscreenTexture(window()->size())) - qWarning() << "QGLWindowSurface: Flushing to native child widget, may lead to significant performance loss"; - glBindTexture(target, d_ptr->tex_id); - - const uint bottom = window()->height() - (br.y() + br.height()); - glCopyTexSubImage2D(target, 0, br.x(), bottom, br.x(), bottom, br.width(), br.height()); - - glBindTexture(target, 0); - - ctx->makeCurrent(); - if (doingPartialUpdate) - blitTexture(ctx, d_ptr->tex_id, parent->size(), window()->size(), rect, br); - else - blitTexture(ctx, d_ptr->tex_id, parent->size(), window()->size(), parent->rect(), parent->rect().translated(offset + wOffset)); - } - - if (doingPartialUpdate) - ctx->d_func()->swapRegion(br); - else - ctx->swapBuffers(); - - d_ptr->paintedRegion = QRegion(); - } else { - glFlush(); - } - return; - } - - QGLContext *previous_ctx = const_cast(QGLContext::currentContext()); - QGLContext *ctx = reinterpret_cast(parent->d_func()->extraData()->glContext); - - // QPainter::end() should have unbound the fbo, otherwise something is very wrong... - Q_ASSERT(!d_ptr->fbo || !d_ptr->fbo->isBound()); - - if (ctx != previous_ctx) { - ctx->makeCurrent(); - } - - QSize size = widget->rect().size(); - if (d_ptr->destructive_swap_buffers && ctx->format().doubleBuffer()) { - rect = parent->rect(); - br = rect.translated(wOffset + offset); - size = parent->size(); - } - - glDisable(GL_SCISSOR_TEST); - - if (d_ptr->fbo && (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit)) { - const int h = d_ptr->fbo->height(); - - const int sx0 = br.left(); - const int sx1 = br.left() + br.width(); - const int sy0 = h - (br.top() + br.height()); - const int sy1 = h - br.top(); - - const int tx0 = rect.left(); - const int tx1 = rect.left() + rect.width(); - const int ty0 = parent->height() - (rect.top() + rect.height()); - const int ty1 = parent->height() - rect.top(); - - if (window() == parent || d_ptr->fbo->format().samples() <= 1) { - if (ctx->d_ptr->current_fbo != 0) - glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, 0); - - glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, d_ptr->fbo->handle()); - - glBlitFramebufferEXT(sx0, sy0, sx1, sy1, - tx0, ty0, tx1, ty1, - GL_COLOR_BUFFER_BIT, - GL_NEAREST); - - glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, 0); - } else { - // can't do sub-region blits with multisample FBOs - QGLFramebufferObject *temp = qgl_fbo_pool()->acquire(d_ptr->fbo->size(), QGLFramebufferObjectFormat()); - - glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, temp->handle()); - glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, d_ptr->fbo->handle()); - - glBlitFramebufferEXT(0, 0, d_ptr->fbo->width(), d_ptr->fbo->height(), - 0, 0, d_ptr->fbo->width(), d_ptr->fbo->height(), - GL_COLOR_BUFFER_BIT, - GL_NEAREST); - - glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, temp->handle()); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, 0); - - glBlitFramebufferEXT(sx0, sy0, sx1, sy1, - tx0, ty0, tx1, ty1, - GL_COLOR_BUFFER_BIT, - GL_NEAREST); - - glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, 0); - - qgl_fbo_pool()->release(temp); - } - - ctx->d_ptr->current_fbo = 0; - } -#if !defined(QT_OPENGL_ES_2) - else { - GLuint texture; - if (d_ptr->fbo) { - texture = d_ptr->fbo->texture(); - } else { - d_ptr->pb->makeCurrent(); - glBindTexture(target, d_ptr->pb_tex_id); - const uint bottom = window()->height() - (br.y() + br.height()); - glCopyTexSubImage2D(target, 0, br.x(), bottom, br.x(), bottom, br.width(), br.height()); - texture = d_ptr->pb_tex_id; - glBindTexture(target, 0); - } - - glDisable(GL_DEPTH_TEST); - - if (d_ptr->fbo) { - d_ptr->fbo->release(); - } else { - ctx->makeCurrent(); - } - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -#ifndef QT_OPENGL_ES - glOrtho(0, size.width(), size.height(), 0, -999999, 999999); -#else - glOrthof(0, size.width(), size.height(), 0, -999999, 999999); -#endif - glViewport(0, 0, size.width(), size.height()); - - glColor4f(1, 1, 1, 1); - drawTexture(rect, texture, window()->size(), br); - - if (d_ptr->fbo) - d_ptr->fbo->bind(); - } -#else - // OpenGL/ES 2.0 version of the fbo blit. - else if (d_ptr->fbo) { - Q_UNUSED(target); - - if (d_ptr->fbo->isBound()) - d_ptr->fbo->release(); - - blitTexture(ctx, d_ptr->fbo->texture(), size, window()->size(), rect, br); - } -#endif - - if (ctx->format().doubleBuffer()) - ctx->swapBuffers(); - else - glFlush(); - - d_ptr->did_paint = false; -} - - -#if !defined(Q_WS_QPA) -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; - - bool hijack(true); - QWidgetPrivate *wd = window()->d_func(); - if (wd->extraData() && wd->extraData()->glContext) { -#ifdef Q_OS_SYMBIAN // Symbian needs to recreate the context when native window size changes - if (d_ptr->size != geometry().size()) { - if (window() != qt_gl_share_widget()) - --(_qt_gl_share_widget()->widgetRefCount); - - delete wd->extraData()->glContext; - wd->extraData()->glContext = 0; - d_ptr->ctx = 0; - } - else -#endif - { - hijack = false; // we already have gl context for widget - } - } - - if (hijack) - hijackWindow(window()); - - QGLContext *ctx = reinterpret_cast(wd->extraData()->glContext); - -#ifdef Q_WS_MAC - ctx->updatePaintDevice(); -#endif - - QSize surfSize = geometry().size(); - - if (surfSize.width() <= 0 || surfSize.height() <= 0) - return; - - if (d_ptr->size == surfSize) - return; - - d_ptr->size = surfSize; - - if (d_ptr->ctx) { -#ifndef QT_OPENGL_ES_2 - if (d_ptr->destructive_swap_buffers) - initializeOffscreenTexture(surfSize); -#endif - return; - } - - const GLenum target = GL_TEXTURE_2D; - if (d_ptr->destructive_swap_buffers - && (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject) - && (d_ptr->fbo || !d_ptr->tried_fbo) - && qt_gl_preferGL2Engine()) - { - d_ptr->tried_fbo = true; - ctx->d_ptr->internal_context = true; - ctx->makeCurrent(); - delete d_ptr->fbo; - - QGLFramebufferObjectFormat format; - format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); - format.setInternalTextureFormat(GLenum(GL_RGBA)); - format.setTextureTarget(target); - - if (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit) - format.setSamples(8); - - d_ptr->fbo = new QGLFramebufferObject(surfSize, format); - - if (d_ptr->fbo->isValid()) { - qDebug() << "Created Window Surface FBO" << surfSize - << "with samples" << d_ptr->fbo->format().samples(); - return; - } else { - qDebug() << "QGLWindowSurface: Failed to create valid FBO, falling back"; - delete d_ptr->fbo; - d_ptr->fbo = 0; - } - } - -#if !defined(QT_OPENGL_ES_2) && !defined(Q_WS_QPA) //QPA doesn't support pixelbuffers - if (d_ptr->destructive_swap_buffers && (d_ptr->pb || !d_ptr->tried_pb)) { - d_ptr->tried_pb = true; - - if (d_ptr->pb) { - d_ptr->pb->makeCurrent(); - glDeleteTextures(1, &d_ptr->pb_tex_id); - } - - delete d_ptr->pb; - - d_ptr->pb = new QGLPixelBuffer(surfSize.width(), surfSize.height(), - QGLFormat(QGL::SampleBuffers | QGL::StencilBuffer | QGL::DepthBuffer), - qt_gl_share_widget()); - - if (d_ptr->pb->isValid()) { - qDebug() << "Created Window Surface Pixelbuffer, Sample buffers:" << d_ptr->pb->format().sampleBuffers(); - d_ptr->pb->makeCurrent(); - - glGenTextures(1, &d_ptr->pb_tex_id); - glBindTexture(target, d_ptr->pb_tex_id); - 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); - glBindTexture(target, 0); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, d_ptr->pb->width(), d_ptr->pb->height(), 0, -999999, 999999); - - d_ptr->pb->d_ptr->qctx->d_func()->internal_context = true; - return; - } else { - qDebug() << "QGLWindowSurface: Failed to create valid pixelbuffer, falling back"; - delete d_ptr->pb; - d_ptr->pb = 0; - } - } -#endif // !defined(QT_OPENGL_ES_2) !defined(Q_WS_QPA) - - ctx->makeCurrent(); - -#ifndef QT_OPENGL_ES_2 - if (d_ptr->destructive_swap_buffers) - initializeOffscreenTexture(surfSize); -#endif -#ifndef Q_OS_SYMBIAN - qDebug() << "QGLWindowSurface: Using plain widget as window surface" << this; -#endif - d_ptr->ctx = ctx; - d_ptr->ctx->d_ptr->internal_context = true; -} - -bool QGLWindowSurface::initializeOffscreenTexture(const QSize &size) -{ - if (size == d_ptr->textureSize) - return false; - - glGenTextures(1, &d_ptr->tex_id); - glBindTexture(GL_TEXTURE_2D, d_ptr->tex_id); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, size.width(), size.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); - - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glBindTexture(GL_TEXTURE_2D, 0); - - d_ptr->textureSize = size; - return true; -} - -bool QGLWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - // this code randomly fails currently for unknown reasons - return false; - - if (!d_ptr->pb) - return false; - - d_ptr->pb->makeCurrent(); - - QRect br = area.boundingRect(); - -#if 0 - // ## workaround driver issue (scrolling by these deltas is unbearably slow for some reason) - // ## maybe we should use glCopyTexSubImage insteadk - if (dx == 1 || dx == -1 || dy == 1 || dy == -1 || dy == 2) - return false; - - glRasterPos2i(br.x() + dx, br.y() + br.height() + dy); - glCopyPixels(br.x(), d_ptr->pb->height() - (br.y() + br.height()), br.width(), br.height(), GL_COLOR); - return true; -#endif - - const GLenum target = GL_TEXTURE_2D; - - glBindTexture(target, d_ptr->tex_id); - glCopyTexImage2D(target, 0, GL_RGBA, br.x(), d_ptr->pb->height() - (br.y() + br.height()), br.width(), br.height(), 0); - glBindTexture(target, 0); - - drawTexture(br.translated(dx, dy), d_ptr->tex_id, window()->size()); - - return true; -} - -static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, const QRectF &br) -{ - const GLenum target = GL_TEXTURE_2D; - QRectF src = br.isEmpty() - ? QRectF(QPointF(), texSize) - : QRectF(QPointF(br.x(), texSize.height() - br.bottom()), br.size()); - - if (target == GL_TEXTURE_2D) { - qreal width = texSize.width(); - qreal height = texSize.height(); - - src.setLeft(src.left() / width); - src.setRight(src.right() / width); - src.setTop(src.top() / height); - src.setBottom(src.bottom() / height); - } - - const GLfloat tx1 = src.left(); - const GLfloat tx2 = src.right(); - const GLfloat ty1 = src.top(); - const GLfloat ty2 = src.bottom(); - - GLfloat texCoordArray[4*2] = { - tx1, ty2, tx2, ty2, tx2, ty1, tx1, ty1 - }; - - GLfloat vertexArray[4*2]; - extern void qt_add_rect_to_array(const QRectF &r, GLfloat *array); // qpaintengine_opengl.cpp - qt_add_rect_to_array(rect, vertexArray); - -#if !defined(QT_OPENGL_ES_2) - glVertexPointer(2, GL_FLOAT, 0, vertexArray); - glTexCoordPointer(2, GL_FLOAT, 0, texCoordArray); - - glBindTexture(target, tex_id); - glEnable(target); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - - glDisable(target); - glBindTexture(target, 0); -#else - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexArray); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, texCoordArray); - - glBindTexture(target, tex_id); - - glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR); - glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR); - glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR); - - glBindTexture(target, 0); -#endif -} - -QImage *QGLWindowSurface::buffer(const QWidget *widget) -{ - QImage image; - - if (d_ptr->pb) - image = d_ptr->pb->toImage(); - else if (d_ptr->fbo) - image = d_ptr->fbo->toImage(); - - if (image.isNull()) - return 0; - - QRect rect = widget->rect(); - rect.translate(widget->mapTo(widget->window(), QPoint())); - - QImage subImage = image.copy(rect); - d_ptr->buffers << subImage; - return &d_ptr->buffers.last(); -} - -QWindowSurface::WindowSurfaceFeatures QGLWindowSurface::features() const -{ - WindowSurfaceFeatures features = 0; - if (!d_ptr->destructive_swap_buffers || d_ptr->swap_region_support) - features |= PartialUpdates; - if (!d_ptr->destructive_swap_buffers) - features |= PreservedContents; - return features; -} - -QT_END_NAMESPACE - diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h deleted file mode 100644 index 91d1f9e245e..00000000000 --- a/src/opengl/qwindowsurface_gl_p.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_GL_P_H -#define QWINDOWSURFACE_GL_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 -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QPaintDevice; -class QPoint; -class QRegion; -class QWidget; -struct QGLWindowSurfacePrivate; - -Q_OPENGL_EXPORT QGLWidget* qt_gl_share_widget(); -Q_OPENGL_EXPORT void qt_destroy_gl_share_widget(); - -class QGLWindowSurfaceGLPaintDevice : public QGLPaintDevice -{ -public: - QPaintEngine* paintEngine() const; - void endPaint(); - QSize size() const; - int metric(PaintDeviceMetric m) const; - QGLContext* context() const; - QGLWindowSurfacePrivate* d; -}; - -class Q_OPENGL_EXPORT QGLWindowSurface : public QObject, public QWindowSurface // , public QPaintDevice -{ - Q_OBJECT -public: - QGLWindowSurface(QWidget *window); - ~QGLWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - -#if !defined(Q_WS_QPA) - void setGeometry(const QRect &rect); -#else - virtual void resize(const QSize &size); -#endif - - void updateGeometry(); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - - QImage *buffer(const QWidget *widget); - - WindowSurfaceFeatures features() const; - - QGLContext *context() const; - - static QGLFormat surfaceFormat; - - enum SwapMode { AutomaticSwap, AlwaysFullSwap, AlwaysPartialSwap, KillSwap }; - static SwapMode swapBehavior; - -private slots: - void deleted(QObject *object); - -private: - void hijackWindow(QWidget *widget); - bool initializeOffscreenTexture(const QSize &size); - - QGLWindowSurfacePrivate *d_ptr; -}; - -QT_END_NAMESPACE - -#endif // QWINDOWSURFACE_GL_P_H - diff --git a/src/opengl/qwindowsurface_x11gl.cpp b/src/opengl/qwindowsurface_x11gl.cpp deleted file mode 100644 index bec0ea7587f..00000000000 --- a/src/opengl/qwindowsurface_x11gl.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include -#include - -#include "qwindowsurface_x11gl_p.h" -#include "qpixmapdata_x11gl_p.h" - -QT_BEGIN_NAMESPACE - -QX11GLWindowSurface::QX11GLWindowSurface(QWidget* window) - : QWindowSurface(window), m_windowGC(0), m_pixmapGC(0), m_window(window) -{ -} - -QX11GLWindowSurface::~QX11GLWindowSurface() -{ - if (m_windowGC) - XFree(m_windowGC); - if (m_pixmapGC) - XFree(m_pixmapGC); -} - -QPaintDevice *QX11GLWindowSurface::paintDevice() -{ - return &m_backBuffer; -} - -extern void *qt_getClipRects(const QRegion &r, int &num); // in qpaintengine_x11.cpp - -void QX11GLWindowSurface::flush(QWidget *widget, const QRegion &widgetRegion, const QPoint &offset) -{ - // We don't need to know the widget which initiated the flush. Instead we just use the offset - // to translate the widgetRegion: - Q_UNUSED(widget); - - if (m_backBuffer.isNull()) { - qDebug("QX11GLWindowSurface::flush() - backBuffer is null, not flushing anything"); - return; - } - - Q_ASSERT(window()->size() != m_backBuffer.size()); - - // Wait for all GL rendering to the back buffer pixmap to complete before trying to - // copy it to the window. We do this by making sure the pixmap's context is current - // and then call eglWaitClient. The EGL 1.4 spec says eglWaitClient doesn't have to - // block, just that "All rendering calls...are guaranteed to be executed before native - // rendering calls". This makes it potentially less expensive than glFinish. - QGLContext* ctx = static_cast(m_backBuffer.data_ptr().data())->context(); - if (QGLContext::currentContext() != ctx && ctx && ctx->isValid()) - ctx->makeCurrent(); - eglWaitClient(); - - if (m_windowGC == 0) { - XGCValues attribs; - attribs.graphics_exposures = False; - m_windowGC = XCreateGC(X11->display, m_window->handle(), GCGraphicsExposures, &attribs); - } - - int rectCount; - XRectangle *rects = (XRectangle *)qt_getClipRects(widgetRegion, rectCount); - if (rectCount <= 0) - return; - - XSetClipRectangles(X11->display, m_windowGC, 0, 0, rects, rectCount, YXBanded); - - QRect dirtyRect = widgetRegion.boundingRect().translated(-offset); - XCopyArea(X11->display, m_backBuffer.handle(), m_window->handle(), m_windowGC, - dirtyRect.x(), dirtyRect.y(), dirtyRect.width(), dirtyRect.height(), - dirtyRect.x(), dirtyRect.y()); - - // Make sure the blit of the update from the back buffer to the window completes - // before allowing rendering to start again to the back buffer. Otherwise the GPU - // might start rendering to the back buffer again while the blit takes place. - eglWaitNative(EGL_CORE_NATIVE_ENGINE); -} - -void QX11GLWindowSurface::setGeometry(const QRect &rect) -{ - if (rect.width() > m_backBuffer.size().width() || rect.height() > m_backBuffer.size().height()) { - QX11GLPixmapData *pd = new QX11GLPixmapData; - QSize newSize = rect.size(); - pd->resize(newSize.width(), newSize.height()); - m_backBuffer = QPixmap(pd); - if (window()->testAttribute(Qt::WA_TranslucentBackground)) - m_backBuffer.fill(Qt::transparent); - if (m_pixmapGC) { - XFreeGC(X11->display, m_pixmapGC); - m_pixmapGC = 0; - } - } - - QWindowSurface::setGeometry(rect); -} - -bool QX11GLWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - if (m_backBuffer.isNull()) - return false; - - Q_ASSERT(m_backBuffer.data_ptr()->classId() == QPixmapData::X11Class); - - // Make sure all GL rendering is complete before starting the scroll operation: - QGLContext* ctx = static_cast(m_backBuffer.data_ptr().data())->context(); - if (QGLContext::currentContext() != ctx && ctx && ctx->isValid()) - ctx->makeCurrent(); - eglWaitClient(); - - if (!m_pixmapGC) - m_pixmapGC = XCreateGC(X11->display, m_backBuffer.handle(), 0, 0); - - foreach (const QRect& rect, area.rects()) { - XCopyArea(X11->display, m_backBuffer.handle(), m_backBuffer.handle(), m_pixmapGC, - rect.x(), rect.y(), rect.width(), rect.height(), - rect.x()+dx, rect.y()+dy); - } - - // Make sure the scroll operation is complete before allowing GL rendering to resume - eglWaitNative(EGL_CORE_NATIVE_ENGINE); - - return true; -} - - -QPixmap QX11GLWindowSurface::grabWidget(const QWidget *widget, const QRect& rect) const -{ - if (!widget || m_backBuffer.isNull()) - return QPixmap(); - - QRect srcRect; - - // make sure the rect is inside the widget & clip to widget's rect - if (!rect.isEmpty()) - srcRect = rect & widget->rect(); - else - srcRect = widget->rect(); - - if (srcRect.isEmpty()) - return QPixmap(); - - // If it's a child widget we have to translate the coordinates - if (widget != window()) - srcRect.translate(widget->mapTo(window(), QPoint(0, 0))); - - QPixmap::x11SetDefaultScreen(widget->x11Info().screen()); - - QX11PixmapData *pmd = new QX11PixmapData(QPixmapData::PixmapType); - pmd->resize(srcRect.width(), srcRect.height()); - QPixmap px(pmd); - - GC tmpGc = XCreateGC(X11->display, m_backBuffer.handle(), 0, 0); - - // Make sure all GL rendering is complete before copying the window - QGLContext* ctx = static_cast(m_backBuffer.pixmapData())->context(); - if (QGLContext::currentContext() != ctx && ctx && ctx->isValid()) - ctx->makeCurrent(); - eglWaitClient(); - - // Copy srcRect from the backing store to the new pixmap - XSetGraphicsExposures(X11->display, tmpGc, False); - XCopyArea(X11->display, m_backBuffer.handle(), px.handle(), tmpGc, - srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height(), 0, 0); - XFreeGC(X11->display, tmpGc); - - // Wait until the copy has finised before allowing more rendering into the back buffer - eglWaitNative(EGL_CORE_NATIVE_ENGINE); - - return px; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qwindowsurface_x11gl_p.h b/src/opengl/qwindowsurface_x11gl_p.h deleted file mode 100644 index 737997b879a..00000000000 --- a/src/opengl/qwindowsurface_x11gl_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_X11GL_P_H -#define QWINDOWSURFACE_X11GL_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 - -class QX11GLWindowSurface : public QWindowSurface -{ -public: - QX11GLWindowSurface(QWidget* window); - virtual ~QX11GLWindowSurface(); - - // Inherreted from QWindowSurface - 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); - QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const; - -private: - GC m_windowGC; - GC m_pixmapGC; - QPixmap m_backBuffer; - QWidget *m_window; -}; - - -QT_END_NAMESPACE - -#endif // QWINDOWSURFACE_X11GL_P_H diff --git a/src/opengl/util/README-GLSL b/src/opengl/util/README-GLSL deleted file mode 100644 index ff20eb45b2d..00000000000 --- a/src/opengl/util/README-GLSL +++ /dev/null @@ -1,18 +0,0 @@ -Use of GLSL for vertex and fragment programs in Qt ---------------------------------------------------- - -We don't compile the *.glsl files because we don't want the build process of -Qt to require cgc from nVidia to build the fragment programs. - -The script src/opengl/util/glsl_to_include.sh will compile a GLSL program to a file -that can be included in a C(++) program. The file is the output from cgc -quoted as a string. - -This can be done manually by: - -./glsl_to_include.sh radial.glsl -./glsl_to_include.sh conical.glsl - -This will produce the files radial.frag and radial.glsl_quoted. -(and also conical.frag and conical.glsl_quoted) -These files are included by qpaintengine_opengl.cpp diff --git a/src/opengl/util/brush_painter.glsl b/src/opengl/util/brush_painter.glsl deleted file mode 100644 index 6c4acdf924f..00000000000 --- a/src/opengl/util/brush_painter.glsl +++ /dev/null @@ -1,7 +0,0 @@ -// fast brush painter for composition modes which can be implemented with blendfuncs -// no mask, used for fast filling of aliased primitives (or multisampled) - -void main() -{ - gl_FragColor = brush(); -} diff --git a/src/opengl/util/brushes.conf b/src/opengl/util/brushes.conf deleted file mode 100644 index 93e2b3b295f..00000000000 --- a/src/opengl/util/brushes.conf +++ /dev/null @@ -1,6 +0,0 @@ -FRAGMENT_PROGRAM_BRUSH_SOLID solid_brush.glsl -FRAGMENT_PROGRAM_BRUSH_RADIAL radial_brush.glsl -FRAGMENT_PROGRAM_BRUSH_CONICAL conical_brush.glsl -FRAGMENT_PROGRAM_BRUSH_LINEAR linear_brush.glsl -FRAGMENT_PROGRAM_BRUSH_TEXTURE texture_brush.glsl -FRAGMENT_PROGRAM_BRUSH_PATTERN pattern_brush.glsl diff --git a/src/opengl/util/composition_mode_colorburn.glsl b/src/opengl/util/composition_mode_colorburn.glsl deleted file mode 100644 index c913b9737f3..00000000000 --- a/src/opengl/util/composition_mode_colorburn.glsl +++ /dev/null @@ -1,13 +0,0 @@ -// Dca' = Sca.Da + Dca.Sa <= Sa.Da ? -// Sca.(1 - Da) + Dca.(1 - Sa) -// Sa.(Sca.Da + Dca.Sa - Sa.Da)/Sca + Sca.(1 - Da) + Dca.(1 - Sa) -// Da' = Sa + Da - Sa.Da -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - result.rgb = mix(src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), - src.a * (src.rgb * dst.a + dst.rgb * src.a - src.a * dst.a) / max(src.rgb, 0.00001) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), - step(src.a * dst.a, src.rgb * dst.a + dst.rgb * src.a)); - result.a = src.a + dst.a - src.a * dst.a; - return result; -} diff --git a/src/opengl/util/composition_mode_colordodge.glsl b/src/opengl/util/composition_mode_colordodge.glsl deleted file mode 100644 index b75e83cf4e1..00000000000 --- a/src/opengl/util/composition_mode_colordodge.glsl +++ /dev/null @@ -1,15 +0,0 @@ -// Dca' = Sca.Da + Dca.Sa <= Sa.Da ? -// Dca.Sa/(1 - Sca/Sa) + Sca.(1 - Da) + Dca.(1 - Sa) : -// Sa.Da + Sca.(1 - Da) + Dca.(1 - Sa) -// Da' = Sa + Da - Sa.Da -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - vec3 temp = src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); - result.rgb = mix(dst.rgb * src.a / max(1.0 - src.rgb / max(src.a, 0.000001), 0.000001) + temp, - src.a * dst.a + temp, - step(src.a * dst.a, src.rgb * dst.a + dst.rgb * src.a)); - - result.a = src.a + dst.a - src.a * dst.a; - return result; -} diff --git a/src/opengl/util/composition_mode_darken.glsl b/src/opengl/util/composition_mode_darken.glsl deleted file mode 100644 index 8bbb82b3ce9..00000000000 --- a/src/opengl/util/composition_mode_darken.glsl +++ /dev/null @@ -1,9 +0,0 @@ -// Dca' = min(Sca.Da, Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa) -// Da' = Sa + Da - Sa.Da -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - result.rgb = min(src.rgb * dst.a, dst.rgb * src.a) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); - result.a = src.a + dst.a - src.a * dst.a; - return result; -} diff --git a/src/opengl/util/composition_mode_difference.glsl b/src/opengl/util/composition_mode_difference.glsl deleted file mode 100644 index 3c46ec71f2a..00000000000 --- a/src/opengl/util/composition_mode_difference.glsl +++ /dev/null @@ -1,9 +0,0 @@ -// Dca' = Sca + Dca - 2.min(Sca.Da, Dca.Sa) -// Da' = Sa + Da - Sa.Da -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - result.rgb = src.rgb + dst.rgb - 2.0 * min(src.rgb * dst.a, dst.rgb * src.a); - result.a = src.a + dst.a - src.a * dst.a; - return result; -} diff --git a/src/opengl/util/composition_mode_exclusion.glsl b/src/opengl/util/composition_mode_exclusion.glsl deleted file mode 100644 index 59c2da99eac..00000000000 --- a/src/opengl/util/composition_mode_exclusion.glsl +++ /dev/null @@ -1,9 +0,0 @@ -// Dca' = (Sca.Da + Dca.Sa - 2.Sca.Dca) + Sca.(1 - Da) + Dca.(1 - Sa) -// Da' = Sa + Da - Sa.Da -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - result.rgb = (src.rgb * dst.a + dst.rgb * src.a - 2.0 * src.rgb * dst.rgb) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); - result.a = src.a + dst.a - src.a * dst.a; - return result; -} diff --git a/src/opengl/util/composition_mode_hardlight.glsl b/src/opengl/util/composition_mode_hardlight.glsl deleted file mode 100644 index 4ea355029dc..00000000000 --- a/src/opengl/util/composition_mode_hardlight.glsl +++ /dev/null @@ -1,14 +0,0 @@ -// Dca' = 2.Sca < Sa ? -// 2.Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa) : -// Sa.Da - 2.(Da - Dca).(Sa - Sca) + Sca.(1 - Da) + Dca.(1 - Sa) -// Da' = Sa + Da - Sa.Da -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - result.rgb = mix(2.0 * src.rgb * dst.rgb + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), - src.a * dst.a - 2.0 * (dst.a - dst.rgb) * (src.a - src.rgb) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), - step(src.a, 2.0 * src.rgb)); - result.a = src.a + dst.a - src.a * dst.a; - - return result; -} diff --git a/src/opengl/util/composition_mode_lighten.glsl b/src/opengl/util/composition_mode_lighten.glsl deleted file mode 100644 index 13ef507a4c2..00000000000 --- a/src/opengl/util/composition_mode_lighten.glsl +++ /dev/null @@ -1,9 +0,0 @@ -// Dca' = max(Sca.Da, Dca.Sa) + Sca.(1 - Da) + Dca.(1 - Sa) -// Da' = Sa + Da - Sa.Da -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - result.rgb = max(src.rgb * dst.a, dst.rgb * src.a) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); - result.a = src.a + dst.a - src.a * dst.a; - return result; -} diff --git a/src/opengl/util/composition_mode_multiply.glsl b/src/opengl/util/composition_mode_multiply.glsl deleted file mode 100644 index f90b7f00ad6..00000000000 --- a/src/opengl/util/composition_mode_multiply.glsl +++ /dev/null @@ -1,9 +0,0 @@ -// Dca' = Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa) -// Da' = Sa + Da - Sa.Da -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - result.rgb = src.rgb * dst.rgb + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); - result.a = src.a + dst.a - src.a * dst.a; - return result; -} diff --git a/src/opengl/util/composition_mode_overlay.glsl b/src/opengl/util/composition_mode_overlay.glsl deleted file mode 100644 index f621bdee96c..00000000000 --- a/src/opengl/util/composition_mode_overlay.glsl +++ /dev/null @@ -1,13 +0,0 @@ -// Dca' = 2.Dca < Da ? -// 2.Sca.Dca + Sca.(1 - Da) + Dca.(1 - Sa) -// Sa.Da - 2.(Da - Dca).(Sa - Sca) + Sca.(1 - Da) + Dca.(1 - Sa) -// Da' = Sa + Da - Sa.Da -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - result.rgb = mix(2.0 * src.rgb * dst.rgb + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), - src.a * dst.a - 2.0 * (dst.a - dst.rgb) * (src.a - src.rgb) + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a), - step(dst.a, 2.0 * dst.rgb)); - result.a = src.a + dst.a - src.a * dst.a; - return result; -} diff --git a/src/opengl/util/composition_mode_screen.glsl b/src/opengl/util/composition_mode_screen.glsl deleted file mode 100644 index 8f4f0100329..00000000000 --- a/src/opengl/util/composition_mode_screen.glsl +++ /dev/null @@ -1,6 +0,0 @@ -// Dca' = Sca + Dca - Sca.Dca -// Da' = Sa + Da - Sa.Da -vec4 composite(vec4 src, vec4 dst) -{ - return src + dst - src * dst; -} diff --git a/src/opengl/util/composition_mode_softlight.glsl b/src/opengl/util/composition_mode_softlight.glsl deleted file mode 100644 index e4c1f891569..00000000000 --- a/src/opengl/util/composition_mode_softlight.glsl +++ /dev/null @@ -1,22 +0,0 @@ -// if 2.Sca <= Sa -// Dca' = Dca.(Sa + (2.Sca - Sa).(1 - Dca/Da)) + Sca.(1 - Da) + Dca.(1 - Sa) -// otherwise if 2.Sca > Sa and 4.Dca <= Da -// Dca' = Dca.Sa + Da.(2.Sca - Sa).(4.Dca/Da.(4.Dca/Da + 1).(Dca/Da - 1) + 7.Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) -// otherwise if 2.Sca > Sa and 4.Dca > Da -// Dca' = Dca.Sa + Da.(2.Sca - Sa).((Dca/Da)^0.5 - Dca/Da) + Sca.(1 - Da) + Dca.(1 - Sa) -// Da' = Sa + Da - Sa.Da - -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - float da = max(dst.a, 0.00001); - vec3 dst_np = dst.rgb / da; - result.rgb = mix(dst.rgb * (src.a + (2.0 * src.rgb - src.a) * (1.0 - dst_np)), - mix(dst.rgb * src.a + dst.a * (2.0 * src.rgb - src.a) * ((16.0 * dst_np - 12.0) * dst_np + 3.0) * dst_np, - dst.rgb * src.a + dst.a * (2.0 * src.rgb - src.a) * (sqrt(dst_np) - dst_np), - step(dst.a, 4.0 * dst.rgb)), - step(src.a, 2.0 * src.rgb)) - + src.rgb * (1.0 - dst.a) + dst.rgb * (1.0 - src.a); - result.a = src.a + dst.a - src.a * dst.a; - return result; -} diff --git a/src/opengl/util/composition_modes.conf b/src/opengl/util/composition_modes.conf deleted file mode 100644 index df52830b997..00000000000 --- a/src/opengl/util/composition_modes.conf +++ /dev/null @@ -1,12 +0,0 @@ -COMPOSITION_MODES_SIMPLE_PORTER_DUFF simple_porter_duff.glsl -COMPOSITION_MODES_MULTIPLY composition_mode_multiply.glsl -COMPOSITION_MODES_SCREEN composition_mode_screen.glsl -COMPOSITION_MODES_OVERLAY composition_mode_overlay.glsl -COMPOSITION_MODES_DARKEN composition_mode_darken.glsl -COMPOSITION_MODES_LIGHTEN composition_mode_lighten.glsl -COMPOSITION_MODES_COLORDODGE composition_mode_colordodge.glsl -COMPOSITION_MODES_COLORBURN composition_mode_colorburn.glsl -COMPOSITION_MODES_HARDLIGHT composition_mode_hardlight.glsl -COMPOSITION_MODES_SOFTLIGHT composition_mode_softlight.glsl -COMPOSITION_MODES_DIFFERENCE composition_mode_difference.glsl -COMPOSITION_MODES_EXCLUSION composition_mode_exclusion.glsl diff --git a/src/opengl/util/conical_brush.glsl b/src/opengl/util/conical_brush.glsl deleted file mode 100644 index b3ec1d7efef..00000000000 --- a/src/opengl/util/conical_brush.glsl +++ /dev/null @@ -1,27 +0,0 @@ -// conical gradient shader -#define M_PI 3.14159265358979323846 -uniform sampler1D palette; -uniform float angle; -uniform vec3 inv_matrix_m0; -uniform vec3 inv_matrix_m1; -uniform vec3 inv_matrix_m2; - -vec4 brush() -{ - mat3 mat; - - mat[0] = inv_matrix_m0; - mat[1] = inv_matrix_m1; - mat[2] = inv_matrix_m2; - - vec3 hcoords = mat * vec3(gl_FragCoord.xy, 1); - vec2 A = hcoords.xy / hcoords.z; - -/* float val = fmod((atan2(-A.y, A.x) + angle) / (2.0 * M_PI), 1); */ - if (abs(A.y) == abs(A.x)) - A.y += 0.002; - float t = (atan(-A.y, A.x) + angle) / (2.0 * M_PI); - float val = t - floor(t); - return texture1D(palette, val); -} - diff --git a/src/opengl/util/ellipse_aa.glsl b/src/opengl/util/ellipse_aa.glsl deleted file mode 100644 index 257e3bbd470..00000000000 --- a/src/opengl/util/ellipse_aa.glsl +++ /dev/null @@ -1,58 +0,0 @@ -uniform vec3 inv_matrix_m0; -uniform vec3 inv_matrix_m1; -uniform vec3 inv_matrix_m2; - -uniform vec2 ellipse_offset; - -// ellipse equation - -// s^2/a^2 + t^2/b^2 = 1 -// -// implicit equation: -// g(s,t) = 1 - s^2/r_s^2 - t^2/r_t^2 - -// distance from ellipse: -// grad = [dg/dx dg/dy] -// d(s, t) ~= g(s, t) / |grad| - -// dg/dx = dg/ds * ds/dx + dg/dt * dt/dx -// dg/dy = dg/ds * ds/dy + dg/dt * dt/dy - -float ellipse_aa() -{ - mat3 mat; - - mat[0] = inv_matrix_m0; - mat[1] = inv_matrix_m1; - mat[2] = inv_matrix_m2; - - vec3 hcoords = mat * vec3(gl_FragCoord.xy + ellipse_offset, 1); - float inv_w = 1.0 / hcoords.z; - vec2 st = hcoords.xy * inv_w; - - vec4 xy = vec4(mat[0].xy, mat[1].xy); - vec2 h = vec2(mat[0].z, mat[1].z); - - vec4 dstdxy = (xy.xzyw - h.xyxy * st.xxyy) * inv_w; - - //dstdxy.x = (mat[0].x - mat[0].z * st.x) * inv_w; // ds/dx - //dstdxy.y = (mat[1].x - mat[1].z * st.x) * inv_w; // ds/dy - //dstdxy.z = (mat[0].y - mat[0].z * st.y) * inv_w; // dt/dx - //dstdxy.w = (mat[1].y - mat[1].z * st.y) * inv_w; // dt/dy - - vec2 inv_r = gl_TexCoord[0].xy; - vec2 n = st * inv_r; - float g = 1.0 - dot(n, n); - - vec2 dgdst = -2.0 * n * inv_r; - - vec2 grad = vec2(dot(dgdst, dstdxy.xz), - dot(dgdst, dstdxy.yw)); - - return smoothstep(-0.5, 0.5, g * inversesqrt(dot(grad, grad))); -} - -void main() -{ - gl_FragColor = ellipse_aa().xxxx; -} diff --git a/src/opengl/util/fast_painter.glsl b/src/opengl/util/fast_painter.glsl deleted file mode 100644 index 63f5e5f3bea..00000000000 --- a/src/opengl/util/fast_painter.glsl +++ /dev/null @@ -1,19 +0,0 @@ -// fast painter for composition modes which can be implemented with blendfuncs - -uniform sampler2D mask_texture; -uniform vec2 inv_mask_size; -uniform vec2 mask_offset; -uniform vec4 mask_channel; - -float mask() -{ - return dot(mask_channel, texture2D(mask_texture, (gl_FragCoord.xy + mask_offset) * inv_mask_size)); -} - -void main() -{ - // combine clip and coverage channels - float mask_alpha = mask(); - - gl_FragColor = brush() * mask_alpha; -} diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h deleted file mode 100644 index b1a47e3d5f2..00000000000 --- a/src/opengl/util/fragmentprograms_p.h +++ /dev/null @@ -1,7287 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef FRAGMENTPROGRAMS_P_H -#define FRAGMENTPROGRAMS_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. -// - -enum FragmentVariable { - VAR_BRUSH_TEXTURE, - VAR_LINEAR, - VAR_INV_MATRIX_M1, - VAR_INV_MASK_SIZE, - VAR_INV_MATRIX_M2, - VAR_PORTERDUFF_AB, - VAR_MASK_CHANNEL, - VAR_ELLIPSE_OFFSET, - VAR_PORTERDUFF_XYZ, - VAR_INV_DST_SIZE, - VAR_MASK_TEXTURE, - VAR_DST_TEXTURE, - VAR_PALETTE, - VAR_MASK_OFFSET, - VAR_INV_BRUSH_TEXTURE_SIZE, - VAR_FMP2_M_RADIUS2, - VAR_FMP, - VAR_INV_MATRIX_M0, - VAR_ANGLE -}; - -enum FragmentBrushType { - FRAGMENT_PROGRAM_BRUSH_SOLID, - FRAGMENT_PROGRAM_BRUSH_RADIAL, - FRAGMENT_PROGRAM_BRUSH_CONICAL, - FRAGMENT_PROGRAM_BRUSH_LINEAR, - FRAGMENT_PROGRAM_BRUSH_TEXTURE, - FRAGMENT_PROGRAM_BRUSH_PATTERN -}; - -enum FragmentCompositionModeType { - COMPOSITION_MODES_SIMPLE_PORTER_DUFF, - COMPOSITION_MODES_MULTIPLY, - COMPOSITION_MODES_SCREEN, - COMPOSITION_MODES_OVERLAY, - COMPOSITION_MODES_DARKEN, - COMPOSITION_MODES_LIGHTEN, - COMPOSITION_MODES_COLORDODGE, - COMPOSITION_MODES_COLORBURN, - COMPOSITION_MODES_HARDLIGHT, - COMPOSITION_MODES_SOFTLIGHT, - COMPOSITION_MODES_DIFFERENCE, - COMPOSITION_MODES_EXCLUSION, - COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK, - COMPOSITION_MODES_MULTIPLY_NOMASK, - COMPOSITION_MODES_SCREEN_NOMASK, - COMPOSITION_MODES_OVERLAY_NOMASK, - COMPOSITION_MODES_DARKEN_NOMASK, - COMPOSITION_MODES_LIGHTEN_NOMASK, - COMPOSITION_MODES_COLORDODGE_NOMASK, - COMPOSITION_MODES_COLORBURN_NOMASK, - COMPOSITION_MODES_HARDLIGHT_NOMASK, - COMPOSITION_MODES_SOFTLIGHT_NOMASK, - COMPOSITION_MODES_DIFFERENCE_NOMASK, - COMPOSITION_MODES_EXCLUSION_NOMASK, - COMPOSITION_MODE_BLEND_MODE_MASK, - COMPOSITION_MODE_BLEND_MODE_NOMASK -}; - -enum FragmentMaskType { - FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA, - FRAGMENT_PROGRAM_MASK_ELLIPSE_AA -}; - -static const unsigned int num_fragment_variables = 19; - -static const unsigned int num_fragment_brushes = 6; -static const unsigned int num_fragment_composition_modes = 26; -static const unsigned int num_fragment_masks = 2; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA = - "!!ARBfp1.0\n" - "PARAM c[1] = { { 0.5, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "ADD R3.z, fragment.position.x, c[0].x;\n" - "ADD R0.y, fragment.position, -c[0].x;\n" - "MAX R4.x, fragment.texcoord[0].y, R0.y;\n" - "ADD R0.x, fragment.position.y, c[0];\n" - "MIN R3.w, R0.x, fragment.texcoord[0].x;\n" - "ADD R2.z, fragment.position.x, -c[0].x;\n" - "MOV R2.w, R3.z;\n" - "MOV R0.yw, R4.x;\n" - "MOV R0.xz, R3.w;\n" - "MAD R0, fragment.texcoord[1].xxzz, R0, fragment.texcoord[1].yyww;\n" - "MAD R0.zw, fragment.position.x, c[0].y, -R0;\n" - "MOV R2.x, R0;\n" - "MOV R2.y, R0.z;\n" - "MOV R1.w, R0;\n" - "MOV R1.z, R0.y;\n" - "MIN R1.xy, R2, R1.zwzw;\n" - "SGE R0.xy, R1.zwzw, R2;\n" - "ADD R0.zw, -fragment.texcoord[0], -fragment.texcoord[0];\n" - "MAD R3.xy, R0, R0.zwzw, fragment.texcoord[0].zwzw;\n" - "ADD R0, -R1.xxyy, R2.zwzw;\n" - "MAD R0, R0, R3.xxyy, R4.x;\n" - "ADD R3.xy, R0.ywzw, R0.xzzw;\n" - "ADD R4.zw, R3.w, -R0.xyxz;\n" - "ADD R0.zw, -R4.x, R0.xyyw;\n" - "ADD R0.xy, R3.z, -R1;\n" - "MAX R1.zw, R2.xyxy, R1;\n" - "MUL R0.xy, R0, R0.zwzw;\n" - "MAD R3.xy, -R3, c[0].x, R3.w;\n" - "ADD R2.w, R3.z, -R2.z;\n" - "MUL R2.xy, R3, R2.w;\n" - "ADD R2.w, R3, -R4.x;\n" - "ADD R3.xy, -R2.z, R1.zwzw;\n" - "MUL R3.xy, R4.zwzw, R3;\n" - "ADD R4.zw, R1.xyxy, R1;\n" - "MAD R0.zw, R4, c[0].x, -R2.z;\n" - "MAD R0.xy, -R0, c[0].x, R2.w;\n" - "MAD R4.zw, R0, R2.w, -R0.xyxy;\n" - "SGE R0.zw, R3.z, R1;\n" - "MAD R0.xy, R0.zwzw, R4.zwzw, R0;\n" - "MAD R3.xy, R3, c[0].x, -R2;\n" - "MAD R0.zw, R0, R3.xyxy, R2.xyxy;\n" - "ADD R2.xy, R0.zwzw, -R0;\n" - "SGE R0.zw, R2.z, R1.xyxy;\n" - "MAD R0.xy, R0.zwzw, R2, R0;\n" - "SGE R0.zw, R1, R2.z;\n" - "ADD R0.xy, R0, -R2.w;\n" - "SGE R1.xy, R3.z, R1;\n" - "MAD R0.xy, R1, R0, R2.w;\n" - "MAD R0.x, -R0, R0.z, R2.w;\n" - "SGE R0.z, R3.w, R4.x;\n" - "MAD R0.x, -R0.y, R0.w, R0;\n" - "MUL result.color, R0.x, R0.z;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_MASK_ELLIPSE_AA = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..3],\n" - " { -2, 1, -0.5, 2 },\n" - " { 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "ADD R0.xy, fragment.position, c[3];\n" - "MUL R1.xyz, R0.y, c[1];\n" - "MAD R0.xyz, R0.x, c[0], R1;\n" - "ADD R0.xyz, R0, c[2];\n" - "RCP R2.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R2.z;\n" - "MUL R2.xy, R0.zwzw, fragment.texcoord[0];\n" - "MOV R1.xy, c[0];\n" - "MOV R1.zw, c[1].xyxy;\n" - "MOV R0.x, c[0].z;\n" - "MOV R0.y, c[1].z;\n" - "MAD R0, R0.zzww, -R0.xyxy, R1.xzyw;\n" - "MUL R1.xy, R2, fragment.texcoord[0];\n" - "MUL R0, R2.z, R0;\n" - "MUL R1.xy, R1, c[4].x;\n" - "MUL R1.zw, R1.xyxy, R0.xyxz;\n" - "MUL R0.zw, R1.xyxy, R0.xyyw;\n" - "ADD R0.y, R0.z, R0.w;\n" - "ADD R0.x, R1.z, R1.w;\n" - "MUL R0.xy, R0, R0;\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, R2.xyxy, R2.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "ADD R0.y, -R0.z, c[4];\n" - "RSQ R0.x, R0.x;\n" - "MAD_SAT R0.x, R0, R0.y, -c[4].z;\n" - "MUL R0.y, -R0.x, c[4].w;\n" - "ADD R0.y, R0, c[5].x;\n" - "MUL R0.x, R0, R0;\n" - "MUL result.color, R0.x, R0.y;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[3];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.xyz, R0, c[0].y;\n" - "MUL R2.xyz, fragment.color.primary.w, R1;\n" - "MUL R1.xyz, fragment.color.primary, c[0].x;\n" - "MAD R2.xyz, R0.w, R1, R2;\n" - "ADD R3.xy, fragment.position, c[4];\n" - "ADD R1.w, -R0, c[6].x;\n" - "MUL R1.xyz, fragment.color.primary, c[1].y;\n" - "MAD R2.xyz, R1.w, R1, R2;\n" - "MUL R1.xyz, R0, c[1].z;\n" - "ADD R2.w, -fragment.color.primary, c[6].x;\n" - "MAD R2.xyz, R2.w, R1, R2;\n" - "MUL R1.z, R0.w, R2.w;\n" - "MUL R1.x, fragment.color.primary.w, R0.w;\n" - "MUL R1.y, fragment.color.primary.w, R1.w;\n" - "DP3 R2.w, R1, c[1];\n" - "MUL R3.xy, R3, c[2];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[5];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_MULTIPLY = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..3],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, -R0.w, c[4];\n" - "MUL R1.xyz, fragment.color.primary, R1.x;\n" - "MAD R1.xyz, fragment.color.primary, R0, R1;\n" - "ADD R1.w, -fragment.color.primary, c[4].x;\n" - "MAD R2.xyz, R0, R1.w, R1;\n" - "ADD R1.z, fragment.color.primary.w, R0.w;\n" - "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[2];\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[3];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SCREEN = - "!!ARBfp1.0\n" - "PARAM c[4] = { program.local[0..3] };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.xy, fragment.position, c[2];\n" - "ADD R2, fragment.color.primary, R0;\n" - "MUL R1.xy, R1, c[0];\n" - "MAD R2, -fragment.color.primary, R0, R2;\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[3];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_OVERLAY = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..3],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R1, R0, texture[0], 2D;\n" - "ADD R0.w, -R1, c[4].y;\n" - "MUL R3.xyz, fragment.color.primary, R0.w;\n" - "ADD R2.xyz, fragment.color.primary.w, -fragment.color.primary;\n" - "ADD R0.xyz, R1.w, -R1;\n" - "MUL R0.xyz, R0, R2;\n" - "MUL R0.xyz, R0, c[4].x;\n" - "MAD R0.xyz, fragment.color.primary.w, R1.w, -R0;\n" - "MAD R0.xyz, fragment.color.primary, R0.w, R0;\n" - "MUL R2.xyz, fragment.color.primary, R1;\n" - "MAD R2.xyz, R2, c[4].x, R3;\n" - "ADD R0.w, -fragment.color.primary, c[4].y;\n" - "MAD R3.xyz, R1, R0.w, R0;\n" - "MAD R2.xyz, R1, R0.w, R2;\n" - "MUL R0.xyz, R1, c[4].x;\n" - "SGE R0.xyz, R0, R1.w;\n" - "ADD R3.xyz, R3, -R2;\n" - "MAD R2.xyz, R0, R3, R2;\n" - "ADD R0.z, fragment.color.primary.w, R1.w;\n" - "MAD R2.w, -fragment.color.primary, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[2];\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[3];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_DARKEN = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..3],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, fragment.color.primary.w, R0;\n" - "MUL R1.xyz, fragment.color.primary, R0.w;\n" - "MIN R1.xyz, R1, R2;\n" - "ADD R1.w, -R0, c[4].x;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "ADD R1.w, -fragment.color.primary, c[4].x;\n" - "MAD R2.xyz, R0, R1.w, R1;\n" - "ADD R1.z, fragment.color.primary.w, R0.w;\n" - "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[2];\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[3];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_LIGHTEN = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..3],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, fragment.color.primary.w, R0;\n" - "MUL R1.xyz, fragment.color.primary, R0.w;\n" - "MAX R1.xyz, R1, R2;\n" - "ADD R1.w, -R0, c[4].x;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "ADD R1.w, -fragment.color.primary, c[4].x;\n" - "MAD R2.xyz, R0, R1.w, R1;\n" - "ADD R1.z, fragment.color.primary.w, R0.w;\n" - "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[2];\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[3];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORDODGE = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..3],\n" - " { 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, -fragment.color.primary.w, c[4];\n" - "MAX R1.y, fragment.color.primary.w, c[4];\n" - "MUL R2.xyz, R0, R1.x;\n" - "ADD R1.w, -R0, c[4].x;\n" - "MAD R3.xyz, fragment.color.primary, R1.w, R2;\n" - "RCP R1.y, R1.y;\n" - "MAD R1.xyz, -fragment.color.primary, R1.y, c[4].x;\n" - "MAX R1.xyz, R1, c[4].y;\n" - "MUL R2.xyz, fragment.color.primary.w, R0;\n" - "MUL R1.w, fragment.color.primary, R0;\n" - "RCP R1.x, R1.x;\n" - "RCP R1.y, R1.y;\n" - "RCP R1.z, R1.z;\n" - "MAD R1.xyz, R2, R1, R3;\n" - "MAD R3.xyz, fragment.color.primary.w, R0.w, R3;\n" - "MAD R2.xyz, fragment.color.primary, R0.w, R2;\n" - "ADD R3.xyz, R3, -R1;\n" - "SGE R2.xyz, R2, R1.w;\n" - "MAD R2.xyz, R2, R3, R1;\n" - "ADD R1.z, fragment.color.primary.w, R0.w;\n" - "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[2];\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[3];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORBURN = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..3],\n" - " { 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.w, -R0, c[4].x;\n" - "MUL R1.xyz, fragment.color.primary.w, R0;\n" - "MAD R2.xyz, fragment.color.primary, R0.w, R1;\n" - "MAD R1.xyz, -fragment.color.primary.w, R0.w, R2;\n" - "MUL R3.xyz, fragment.color.primary.w, R1;\n" - "MAX R1.xyz, fragment.color.primary, c[4].y;\n" - "ADD R2.w, -fragment.color.primary, c[4].x;\n" - "MUL R4.xyz, fragment.color.primary, R1.w;\n" - "RCP R1.x, R1.x;\n" - "RCP R1.y, R1.y;\n" - "RCP R1.z, R1.z;\n" - "MAD R3.xyz, R3, R1, R4;\n" - "MUL R1.xyz, R0, R2.w;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "MAD R3.xyz, R0, R2.w, R3;\n" - "MUL R1.w, fragment.color.primary, R0;\n" - "ADD R3.xyz, R3, -R1;\n" - "SGE R2.xyz, R2, R1.w;\n" - "MAD R2.xyz, R2, R3, R1;\n" - "ADD R1.z, fragment.color.primary.w, R0.w;\n" - "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[2];\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[3];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_HARDLIGHT = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..3],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R1, R0, texture[0], 2D;\n" - "ADD R0.w, -R1, c[4].y;\n" - "MUL R3.xyz, fragment.color.primary, R0.w;\n" - "ADD R2.xyz, fragment.color.primary.w, -fragment.color.primary;\n" - "ADD R0.xyz, R1.w, -R1;\n" - "MUL R0.xyz, R0, R2;\n" - "MUL R0.xyz, R0, c[4].x;\n" - "MAD R0.xyz, fragment.color.primary.w, R1.w, -R0;\n" - "MAD R0.xyz, fragment.color.primary, R0.w, R0;\n" - "MUL R2.xyz, fragment.color.primary, R1;\n" - "MAD R2.xyz, R2, c[4].x, R3;\n" - "ADD R0.w, -fragment.color.primary, c[4].y;\n" - "MAD R3.xyz, R1, R0.w, R0;\n" - "MAD R2.xyz, R1, R0.w, R2;\n" - "MUL R0.xyz, fragment.color.primary, c[4].x;\n" - "SGE R0.xyz, R0, fragment.color.primary.w;\n" - "ADD R3.xyz, R3, -R2;\n" - "MAD R2.xyz, R0, R3, R2;\n" - "ADD R0.z, fragment.color.primary.w, R1.w;\n" - "MAD R2.w, -fragment.color.primary, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[2];\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[3];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..3],\n" - " { 1, 2, 9.9999997e-006, 4 },\n" - " { 16, 12, 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[4].z;\n" - "RCP R1.x, R1.x;\n" - "MUL R2.xyz, R0, R1.x;\n" - "MAD R1.xyz, R2, c[5].x, -c[5].y;\n" - "MAD R3.xyz, R2, R1, c[5].z;\n" - "MAD R1.xyz, fragment.color.primary, c[4].y, -fragment.color.primary.w;\n" - "MUL R4.xyz, R0.w, R1;\n" - "MUL R5.xyz, R4, R3;\n" - "RSQ R1.w, R2.x;\n" - "RSQ R2.w, R2.z;\n" - "RCP R3.x, R1.w;\n" - "RSQ R1.w, R2.y;\n" - "MUL R5.xyz, R2, R5;\n" - "RCP R3.z, R2.w;\n" - "RCP R3.y, R1.w;\n" - "ADD R3.xyz, -R2, R3;\n" - "MUL R3.xyz, R4, R3;\n" - "ADD R2.xyz, -R2, c[4].x;\n" - "MAD R1.xyz, R1, R2, fragment.color.primary.w;\n" - "MUL R2.xyz, fragment.color.primary, c[4].y;\n" - "MAD R4.xyz, fragment.color.primary.w, R0, R5;\n" - "MAD R3.xyz, fragment.color.primary.w, R0, R3;\n" - "ADD R5.xyz, R3, -R4;\n" - "MUL R3.xyz, R0, c[4].w;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MAD R3.xyz, R3, R5, R4;\n" - "MAD R3.xyz, -R0, R1, R3;\n" - "MUL R1.xyz, R0, R1;\n" - "SGE R2.xyz, R2, fragment.color.primary.w;\n" - "MAD R2.xyz, R2, R3, R1;\n" - "ADD R1.x, -R0.w, c[4];\n" - "MAD R2.xyz, fragment.color.primary, R1.x, R2;\n" - "ADD R1.x, -fragment.color.primary.w, c[4];\n" - "MAD R2.xyz, R0, R1.x, R2;\n" - "ADD R1.z, fragment.color.primary.w, R0.w;\n" - "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[2];\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[3];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_DIFFERENCE = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..3],\n" - " { 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.xyz, fragment.color.primary, R0;\n" - "MUL R3.xyz, fragment.color.primary.w, R0;\n" - "MUL R2.xyz, fragment.color.primary, R0.w;\n" - "MIN R2.xyz, R2, R3;\n" - "MAD R2.xyz, -R2, c[4].x, R1;\n" - "ADD R1.z, fragment.color.primary.w, R0.w;\n" - "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[2];\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[3];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_EXCLUSION = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..3],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[1];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.xyz, fragment.color.primary.w, R0;\n" - "MAD R2.xyz, fragment.color.primary, R0.w, R1;\n" - "MUL R1.xyz, fragment.color.primary, R0;\n" - "MAD R1.xyz, -R1, c[4].x, R2;\n" - "ADD R1.w, -R0, c[4].y;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "ADD R1.w, -fragment.color.primary, c[4].y;\n" - "MAD R2.xyz, R0, R1.w, R1;\n" - "ADD R1.z, fragment.color.primary.w, R0.w;\n" - "MAD R2.w, -fragment.color.primary, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[2];\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[3];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[4] = { program.local[0..2],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[2];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.xyz, R0, c[0].y;\n" - "MUL R2.xyz, fragment.color.primary.w, R1;\n" - "MUL R1.xyz, fragment.color.primary, c[0].x;\n" - "MAD R2.xyz, R0.w, R1, R2;\n" - "MUL R0.xyz, R0, c[1].z;\n" - "ADD R1.w, -R0, c[3].x;\n" - "MUL R1.xyz, fragment.color.primary, c[1].y;\n" - "MAD R1.xyz, R1.w, R1, R2;\n" - "ADD R2.x, -fragment.color.primary.w, c[3];\n" - "MAD result.color.xyz, R2.x, R0, R1;\n" - "MUL R0.x, fragment.color.primary.w, R0.w;\n" - "MUL R0.z, R0.w, R2.x;\n" - "MUL R0.y, fragment.color.primary.w, R1.w;\n" - "DP3 result.color.w, R0, c[1];\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_MULTIPLY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[2] = { program.local[0],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, -R0.w, c[1];\n" - "MUL R1.xyz, fragment.color.primary, R1.x;\n" - "ADD R1.w, fragment.color.primary, R0;\n" - "MAD R1.xyz, fragment.color.primary, R0, R1;\n" - "ADD R2.x, -fragment.color.primary.w, c[1];\n" - "MAD result.color.xyz, R0, R2.x, R1;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SCREEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[1] = { program.local[0] };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1, fragment.color.primary, R0;\n" - "MAD result.color, -fragment.color.primary, R0, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_OVERLAY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[2] = { program.local[0],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.w, -R0, c[1].y;\n" - "ADD R2.xyz, fragment.color.primary.w, -fragment.color.primary;\n" - "ADD R1.xyz, R0.w, -R0;\n" - "MUL R1.xyz, R1, R2;\n" - "MUL R1.xyz, R1, c[1].x;\n" - "MAD R1.xyz, fragment.color.primary.w, R0.w, -R1;\n" - "MUL R3.xyz, fragment.color.primary, R1.w;\n" - "MUL R2.xyz, fragment.color.primary, R0;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "ADD R1.w, -fragment.color.primary, c[1].y;\n" - "MAD R2.xyz, R2, c[1].x, R3;\n" - "MAD R2.xyz, R0, R1.w, R2;\n" - "MAD R1.xyz, R0, R1.w, R1;\n" - "MUL R0.xyz, R0, c[1].x;\n" - "ADD R1.w, fragment.color.primary, R0;\n" - "ADD R1.xyz, R1, -R2;\n" - "SGE R0.xyz, R0, R0.w;\n" - "MAD result.color.xyz, R0, R1, R2;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_DARKEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[2] = { program.local[0],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, fragment.color.primary.w, R0;\n" - "MUL R1.xyz, fragment.color.primary, R0.w;\n" - "MIN R1.xyz, R1, R2;\n" - "ADD R1.w, -R0, c[1].x;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "ADD R1.w, fragment.color.primary, R0;\n" - "ADD R2.x, -fragment.color.primary.w, c[1];\n" - "MAD result.color.xyz, R0, R2.x, R1;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_LIGHTEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[2] = { program.local[0],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, fragment.color.primary.w, R0;\n" - "MUL R1.xyz, fragment.color.primary, R0.w;\n" - "MAX R1.xyz, R1, R2;\n" - "ADD R1.w, -R0, c[1].x;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "ADD R1.w, fragment.color.primary, R0;\n" - "ADD R2.x, -fragment.color.primary.w, c[1];\n" - "MAD result.color.xyz, R0, R2.x, R1;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORDODGE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[2] = { program.local[0],\n" - " { 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MAX R1.y, fragment.color.primary.w, c[1];\n" - "RCP R2.x, R1.y;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, -fragment.color.primary.w, c[1];\n" - "MUL R1.xyz, R0, R1.x;\n" - "ADD R1.w, -R0, c[1].x;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "MAD R2.xyz, -fragment.color.primary, R2.x, c[1].x;\n" - "MAX R2.xyz, R2, c[1].y;\n" - "MUL R0.xyz, fragment.color.primary.w, R0;\n" - "MUL R1.w, fragment.color.primary, R0;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R0, R2, R1;\n" - "MAD R1.xyz, fragment.color.primary.w, R0.w, R1;\n" - "MAD R0.xyz, fragment.color.primary, R0.w, R0;\n" - "SGE R0.xyz, R0, R1.w;\n" - "ADD R1.xyz, R1, -R2;\n" - "ADD R1.w, fragment.color.primary, R0;\n" - "MAD result.color.xyz, R0, R1, R2;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORBURN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[2] = { program.local[0],\n" - " { 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.xyz, fragment.color.primary.w, R0;\n" - "MAD R2.xyz, fragment.color.primary, R0.w, R1;\n" - "MAD R1.xyz, -fragment.color.primary.w, R0.w, R2;\n" - "MUL R3.xyz, fragment.color.primary.w, R1;\n" - "MAX R1.xyz, fragment.color.primary, c[1].y;\n" - "ADD R1.w, -R0, c[1].x;\n" - "MUL R4.xyz, fragment.color.primary, R1.w;\n" - "ADD R2.w, -fragment.color.primary, c[1].x;\n" - "RCP R1.x, R1.x;\n" - "RCP R1.y, R1.y;\n" - "RCP R1.z, R1.z;\n" - "MAD R1.xyz, R3, R1, R4;\n" - "MUL R3.xyz, R0, R2.w;\n" - "MAD R0.xyz, R0, R2.w, R1;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R3;\n" - "MUL R1.w, fragment.color.primary, R0;\n" - "SGE R2.xyz, R2, R1.w;\n" - "ADD R0.xyz, R0, -R1;\n" - "ADD R1.w, fragment.color.primary, R0;\n" - "MAD result.color.xyz, R2, R0, R1;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_HARDLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[2] = { program.local[0],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.w, -R0, c[1].y;\n" - "ADD R2.xyz, fragment.color.primary.w, -fragment.color.primary;\n" - "ADD R1.xyz, R0.w, -R0;\n" - "MUL R1.xyz, R1, R2;\n" - "MUL R1.xyz, R1, c[1].x;\n" - "MAD R1.xyz, fragment.color.primary.w, R0.w, -R1;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "MUL R3.xyz, fragment.color.primary, R1.w;\n" - "MUL R2.xyz, fragment.color.primary, R0;\n" - "ADD R1.w, -fragment.color.primary, c[1].y;\n" - "MAD R2.xyz, R2, c[1].x, R3;\n" - "MAD R2.xyz, R0, R1.w, R2;\n" - "MAD R0.xyz, R0, R1.w, R1;\n" - "ADD R1.xyz, R0, -R2;\n" - "MUL R0.xyz, fragment.color.primary, c[1].x;\n" - "ADD R1.w, fragment.color.primary, R0;\n" - "SGE R0.xyz, R0, fragment.color.primary.w;\n" - "MAD result.color.xyz, R0, R1, R2;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[3] = { program.local[0],\n" - " { 1, 2, 9.9999997e-006, 4 },\n" - " { 16, 12, 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[1].z;\n" - "RCP R1.x, R1.x;\n" - "MUL R2.xyz, R0, R1.x;\n" - "MAD R1.xyz, R2, c[2].x, -c[2].y;\n" - "MAD R3.xyz, R2, R1, c[2].z;\n" - "MAD R1.xyz, fragment.color.primary, c[1].y, -fragment.color.primary.w;\n" - "MUL R4.xyz, R0.w, R1;\n" - "MUL R5.xyz, R4, R3;\n" - "RSQ R1.w, R2.x;\n" - "RCP R3.x, R1.w;\n" - "RSQ R2.w, R2.z;\n" - "RSQ R1.w, R2.y;\n" - "MUL R5.xyz, R2, R5;\n" - "RCP R3.z, R2.w;\n" - "RCP R3.y, R1.w;\n" - "ADD R3.xyz, -R2, R3;\n" - "MUL R3.xyz, R4, R3;\n" - "ADD R2.xyz, -R2, c[1].x;\n" - "MAD R1.xyz, R1, R2, fragment.color.primary.w;\n" - "MUL R2.xyz, fragment.color.primary, c[1].y;\n" - "MAD R4.xyz, fragment.color.primary.w, R0, R5;\n" - "MAD R3.xyz, fragment.color.primary.w, R0, R3;\n" - "ADD R5.xyz, R3, -R4;\n" - "MUL R3.xyz, R0, c[1].w;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MAD R3.xyz, R3, R5, R4;\n" - "MAD R3.xyz, -R0, R1, R3;\n" - "MUL R1.xyz, R0, R1;\n" - "SGE R2.xyz, R2, fragment.color.primary.w;\n" - "MAD R2.xyz, R2, R3, R1;\n" - "ADD R1.x, -R0.w, c[1];\n" - "MAD R2.xyz, fragment.color.primary, R1.x, R2;\n" - "ADD R1.x, fragment.color.primary.w, R0.w;\n" - "ADD R1.y, -fragment.color.primary.w, c[1].x;\n" - "MAD result.color.xyz, R0, R1.y, R2;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_DIFFERENCE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[2] = { program.local[0],\n" - " { 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R2.xyz, fragment.color.primary.w, R0;\n" - "MUL R1.xyz, fragment.color.primary, R0.w;\n" - "ADD R1.w, fragment.color.primary, R0;\n" - "MIN R1.xyz, R1, R2;\n" - "ADD R0.xyz, fragment.color.primary, R0;\n" - "MAD result.color.xyz, -R1, c[1].x, R0;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_EXCLUSION_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[2] = { program.local[0],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xy, fragment.position, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.xyz, fragment.color.primary.w, R0;\n" - "MAD R2.xyz, fragment.color.primary, R0.w, R1;\n" - "MUL R1.xyz, fragment.color.primary, R0;\n" - "MAD R1.xyz, -R1, c[1].x, R2;\n" - "ADD R1.w, -R0, c[1].y;\n" - "MAD R1.xyz, fragment.color.primary, R1.w, R1;\n" - "ADD R1.w, fragment.color.primary, R0;\n" - "ADD R2.x, -fragment.color.primary.w, c[1].y;\n" - "MAD result.color.xyz, R0, R2.x, R1;\n" - "MAD result.color.w, -fragment.color.primary, R0, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE_BLEND_MODE_MASK = - "!!ARBfp1.0\n" - "PARAM c[3] = { program.local[0..2] };\n" - "TEMP R0;\n" - "ADD R0.xy, fragment.position, c[1];\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[0], 2D;\n" - "DP4 R0.x, R0, c[2];\n" - "MUL result.color, fragment.color.primary, R0.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE_BLEND_MODE_NOMASK = - "!!ARBfp1.0\n" - "MOV result.color, fragment.color.primary;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = - "!!ARBfp1.0\n" - "PARAM c[12] = { program.local[0..10],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[11].x;\n" - "MUL R0.z, R0, c[11].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.x, R0.x;\n" - "RCP R0.z, R0.x;\n" - "ADD R1.x, -R0.y, R0.z;\n" - "MOV R0.x, c[11];\n" - "MUL R0.z, R0.x, c[1].x;\n" - "RCP R1.y, R0.z;\n" - "MUL R0.xy, fragment.position, c[8];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.x, R1, R1.y;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R2.xyz, R0, c[5].y;\n" - "MUL R3.xyz, R1.w, R2;\n" - "MUL R2.xyz, R1, c[5].x;\n" - "MAD R2.xyz, R0.w, R2, R3;\n" - "ADD R3.xy, fragment.position, c[9];\n" - "ADD R2.w, -R0, c[11].z;\n" - "MUL R1.xyz, R1, c[6].y;\n" - "MAD R2.xyz, R2.w, R1, R2;\n" - "MUL R1.xyz, R0, c[6].z;\n" - "ADD R3.z, -R1.w, c[11];\n" - "MAD R2.xyz, R3.z, R1, R2;\n" - "MUL R1.y, R1.w, R2.w;\n" - "MUL R1.x, R1.w, R0.w;\n" - "MUL R1.z, R0.w, R3;\n" - "DP3 R2.w, R1, c[6];\n" - "MUL R3.xy, R3, c[7];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[10];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_MULTIPLY = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..8],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.x, R0.x;\n" - "RCP R0.z, R0.x;\n" - "ADD R1.x, -R0.y, R0.z;\n" - "MOV R0.x, c[9];\n" - "MUL R0.z, R0.x, c[1].x;\n" - "RCP R1.y, R0.z;\n" - "MUL R0.xy, fragment.position, c[6];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.x, R1, R1.y;\n" - "TEX R1, R1, texture[2], 1D;\n" - "ADD R2.x, -R0.w, c[9].z;\n" - "MUL R2.xyz, R1, R2.x;\n" - "MAD R1.xyz, R1, R0, R2;\n" - "ADD R2.x, -R1.w, c[9].z;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[7];\n" - "MUL R1.xy, R1, c[5];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[8];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SCREEN = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..8],\n" - " { 2, 4 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MOV R0.x, c[9];\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "ADD R3.xy, fragment.position, c[7];\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.z, R0.x, R0;\n" - "TEX R1, R0.z, texture[2], 1D;\n" - "MUL R0.xy, fragment.position, c[6];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R2, R1, R0;\n" - "MAD R2, -R1, R0, R2;\n" - "MUL R3.xy, R3, c[5];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[8];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_OVERLAY = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..8],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MOV R0.x, c[9];\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "ADD R2.w, -R1, c[9].z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[9].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MUL R3.xyz, R0, R1;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[9].z;\n" - "MAD R3.xyz, R3, c[9].x, R4;\n" - "MAD R3.xyz, R1, R2.x, R3;\n" - "MAD R0.xyz, R1, R2.x, R0;\n" - "MUL R2.xyz, R1, c[9].x;\n" - "ADD R0.xyz, R0, -R3;\n" - "SGE R2.xyz, R2, R1.w;\n" - "MAD R2.xyz, R2, R0, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[7];\n" - "MUL R0.xy, R0, c[5];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[8];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DARKEN = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..8],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[9];\n" - "MUL R0.x, R0, c[1];\n" - "RCP R0.z, R0.z;\n" - "ADD R0.z, -R0.y, R0;\n" - "RCP R0.w, R0.x;\n" - "MUL R1.x, R0.z, R0.w;\n" - "MUL R0.xy, fragment.position, c[6];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[9].z;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[9].z;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[7];\n" - "MUL R1.xy, R1, c[5];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[8];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_LIGHTEN = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..8],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[9];\n" - "MUL R0.x, R0, c[1];\n" - "RCP R0.z, R0.z;\n" - "ADD R0.z, -R0.y, R0;\n" - "RCP R0.w, R0.x;\n" - "MUL R1.x, R0.z, R0.w;\n" - "MUL R0.xy, fragment.position, c[6];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[9].z;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[9].z;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[7];\n" - "MUL R1.xy, R1, c[5];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[8];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORDODGE = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..8],\n" - " { 2, 4, 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MOV R0.x, c[9];\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MAX R1.x, R0.w, c[9].w;\n" - "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -R0, R1.x, c[9].z;\n" - "MAX R2.xyz, R1, c[9].w;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[9].z;\n" - "MUL R3.xyz, R1, R2.w;\n" - "ADD R2.w, -R1, c[9].z;\n" - "MAD R4.xyz, R0, R2.w, R3;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MUL R2.w, R0, R1;\n" - "MAD R0.xyz, R0, R1.w, R3;\n" - "SGE R0.xyz, R0, R2.w;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R3, R2, R4;\n" - "MAD R4.xyz, R0.w, R1.w, R4;\n" - "ADD R4.xyz, R4, -R2;\n" - "MAD R2.xyz, R0, R4, R2;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[7];\n" - "MUL R0.xy, R0, c[5];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[8];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORBURN = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..8],\n" - " { 2, 4, 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[9];\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0.y, R0.z;\n" - "RCP R0.y, R0.w;\n" - "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MAD R2.xyz, -R0.w, R1.w, R3;\n" - "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[9].w;\n" - "ADD R2.w, -R1, c[9].z;\n" - "MUL R5.xyz, R0, R2.w;\n" - "ADD R3.w, -R0, c[9].z;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R4, R2, R5;\n" - "MUL R4.xyz, R1, R3.w;\n" - "MAD R0.xyz, R0, R2.w, R4;\n" - "MUL R2.w, R0, R1;\n" - "MAD R2.xyz, R1, R3.w, R2;\n" - "ADD R2.xyz, R2, -R0;\n" - "SGE R3.xyz, R3, R2.w;\n" - "MAD R2.xyz, R3, R2, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[7];\n" - "MUL R0.xy, R0, c[5];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[8];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_HARDLIGHT = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..8],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MOV R0.x, c[9];\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "ADD R2.w, -R1, c[9].z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[9].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R3.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[9].z;\n" - "MAD R3.xyz, R3, c[9].x, R4;\n" - "MUL R0.xyz, R0, c[9].x;\n" - "SGE R0.xyz, R0, R0.w;\n" - "MAD R3.xyz, R1, R2.w, R3;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "ADD R2.xyz, R2, -R3;\n" - "MAD R2.xyz, R0, R2, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[7];\n" - "MUL R0.xy, R0, c[5];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[8];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SOFTLIGHT = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..8],\n" - " { 2, 4, 1, 9.9999997e-006 },\n" - " { 16, 12, 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[9];\n" - "MUL R0.x, R0, c[9];\n" - "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "ADD R0.y, -R0.x, R0;\n" - "MOV R0.x, c[9];\n" - "MUL R0.x, R0, c[1];\n" - "MAX R0.z, R1.w, c[9].w;\n" - "RCP R0.z, R0.z;\n" - "MUL R3.xyz, R1, R0.z;\n" - "MAD R4.xyz, R3, c[10].x, -c[10].y;\n" - "RCP R0.x, R0.x;\n" - "MUL R0.x, R0.y, R0;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MAD R2.xyz, R0, c[9].x, -R0.w;\n" - "MAD R4.xyz, R3, R4, c[10].z;\n" - "MUL R5.xyz, R1.w, R2;\n" - "MUL R6.xyz, R5, R4;\n" - "RSQ R2.w, R3.x;\n" - "RCP R4.x, R2.w;\n" - "RSQ R2.w, R3.y;\n" - "RSQ R3.w, R3.z;\n" - "RCP R4.y, R2.w;\n" - "RCP R4.z, R3.w;\n" - "ADD R4.xyz, -R3, R4;\n" - "MUL R6.xyz, R3, R6;\n" - "MUL R4.xyz, R5, R4;\n" - "ADD R3.xyz, -R3, c[9].z;\n" - "MAD R2.xyz, R2, R3, R0.w;\n" - "MUL R3.xyz, R0, c[9].x;\n" - "MAD R5.xyz, R0.w, R1, R6;\n" - "MAD R4.xyz, R0.w, R1, R4;\n" - "ADD R6.xyz, R4, -R5;\n" - "MUL R4.xyz, R1, c[9].y;\n" - "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R6, R5;\n" - "MAD R4.xyz, -R1, R2, R4;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MUL R2.xyz, R1, R2;\n" - "ADD R2.w, -R1, c[9].z;\n" - "MAD R2.xyz, R3, R4, R2;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.x, -R0.w, c[9].z;\n" - "MAD R2.xyz, R1, R0.x, R2;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[7];\n" - "MUL R0.xy, R0, c[5];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[8];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DIFFERENCE = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..8],\n" - " { 2, 4 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[9];\n" - "MUL R0.x, R0, c[1];\n" - "RCP R0.z, R0.z;\n" - "ADD R0.z, -R0.y, R0;\n" - "RCP R0.w, R0.x;\n" - "MUL R1.x, R0.z, R0.w;\n" - "MUL R0.xy, fragment.position, c[6];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "ADD R2.xyz, R1, R0;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R1.xyz, R1, R0.w;\n" - "MIN R1.xyz, R1, R3;\n" - "MAD R2.xyz, -R1, c[9].x, R2;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[7];\n" - "MUL R1.xy, R1, c[5];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[8];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_EXCLUSION = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..8],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[9].x;\n" - "MUL R0.z, R0, c[9].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[9];\n" - "MUL R0.x, R0, c[1];\n" - "RCP R0.z, R0.z;\n" - "ADD R0.z, -R0.y, R0;\n" - "RCP R0.w, R0.x;\n" - "MUL R1.x, R0.z, R0.w;\n" - "MUL R0.xy, fragment.position, c[6];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R2.xyz, R1.w, R0;\n" - "MAD R3.xyz, R1, R0.w, R2;\n" - "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[9].x, R3;\n" - "ADD R2.w, -R0, c[9].z;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[9].z;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[7];\n" - "MUL R1.xy, R1, c[5];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[8];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[8].x;\n" - "MUL R0.z, R0, c[8].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.x, R0.x;\n" - "RCP R0.z, R0.x;\n" - "ADD R0.y, -R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[7].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R2.xyz, R1, c[5].y;\n" - "MOV R0.x, c[8];\n" - "MUL R0.x, R0, c[1];\n" - "RCP R0.x, R0.x;\n" - "MUL R0.x, R0.y, R0;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R3.xyz, R0.w, R2;\n" - "MUL R2.xyz, R0, c[5].x;\n" - "MAD R2.xyz, R1.w, R2, R3;\n" - "ADD R2.w, -R1, c[8].z;\n" - "MUL R0.xyz, R0, c[6].y;\n" - "MAD R0.xyz, R2.w, R0, R2;\n" - "ADD R2.x, -R0.w, c[8].z;\n" - "MUL R1.xyz, R1, c[6].z;\n" - "MAD result.color.xyz, R2.x, R1, R0;\n" - "MUL R0.x, R0.w, R1.w;\n" - "MUL R0.z, R1.w, R2.x;\n" - "MUL R0.y, R0.w, R2.w;\n" - "DP3 result.color.w, R0, c[6];\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_MULTIPLY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.x, R0.x;\n" - "RCP R0.z, R0.x;\n" - "ADD R0.y, -R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MOV R0.x, c[6];\n" - "MUL R0.x, R0, c[1];\n" - "RCP R0.x, R0.x;\n" - "MUL R0.x, R0.y, R0;\n" - "TEX R0, R0, texture[1], 1D;\n" - "ADD R2.x, -R1.w, c[6].z;\n" - "MUL R2.xyz, R0, R2.x;\n" - "MAD R0.xyz, R0, R1, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[6].z;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SCREEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 2, 4 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[6];\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0.y, R0.z;\n" - "RCP R0.y, R0.w;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "ADD R2, R0, R1;\n" - "MAD result.color, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_OVERLAY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MOV R0.x, c[6];\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "ADD R2.w, -R1, c[6].z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[6].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R3.xyz, R0, R2.w;\n" - "MUL R0.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[6].z;\n" - "MAD R0.xyz, R0, c[6].x, R3;\n" - "MAD R0.xyz, R1, R2.w, R0;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "MUL R1.xyz, R1, c[6].x;\n" - "ADD R2.w, R0, R1;\n" - "ADD R2.xyz, R2, -R0;\n" - "SGE R1.xyz, R1, R1.w;\n" - "MAD result.color.xyz, R1, R2, R0;\n" - "MAD result.color.w, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DARKEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[6];\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0.y, R0.z;\n" - "RCP R0.y, R0.w;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[6].z;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[6].z;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_LIGHTEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[6];\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0.y, R0.z;\n" - "RCP R0.y, R0.w;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[6].z;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[6].z;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORDODGE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 2, 4, 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MOV R0.x, c[6];\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MAX R1.x, R0.w, c[6].w;\n" - "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -R0, R1.x, c[6].z;\n" - "MAX R2.xyz, R1, c[6].w;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[6].z;\n" - "MUL R3.xyz, R1, R2.w;\n" - "ADD R2.w, -R1, c[6].z;\n" - "MAD R3.xyz, R0, R2.w, R3;\n" - "MUL R1.xyz, R0.w, R1;\n" - "MAD R0.xyz, R0, R1.w, R1;\n" - "MUL R2.w, R0, R1;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R1, R2, R3;\n" - "MAD R3.xyz, R0.w, R1.w, R3;\n" - "ADD R1.x, R0.w, R1.w;\n" - "ADD R3.xyz, R3, -R2;\n" - "SGE R0.xyz, R0, R2.w;\n" - "MAD result.color.xyz, R0, R3, R2;\n" - "MAD result.color.w, -R0, R1, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORBURN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 2, 4, 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[6];\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0.y, R0.z;\n" - "RCP R0.y, R0.w;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "ADD R2.w, -R1, c[6].z;\n" - "MAD R2.xyz, -R0.w, R1.w, R3;\n" - "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[6].w;\n" - "MUL R5.xyz, R0, R2.w;\n" - "ADD R3.w, -R0, c[6].z;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R4, R2, R5;\n" - "MUL R4.xyz, R1, R3.w;\n" - "MAD R1.xyz, R1, R3.w, R2;\n" - "MAD R0.xyz, R0, R2.w, R4;\n" - "MUL R2.x, R0.w, R1.w;\n" - "ADD R2.w, R0, R1;\n" - "ADD R1.xyz, R1, -R0;\n" - "SGE R2.xyz, R3, R2.x;\n" - "MAD result.color.xyz, R2, R1, R0;\n" - "MAD result.color.w, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_HARDLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MOV R0.x, c[6];\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.z, R0.y, R0.y, -R0;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RSQ R0.z, R0.z;\n" - "RCP R0.x, R0.z;\n" - "ADD R2.w, -R1, c[6].z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0.y, R0;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[6].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MUL R3.xyz, R0, R1;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R2.w, -R0, c[6].z;\n" - "MUL R0.xyz, R0, c[6].x;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "MAD R3.xyz, R3, c[6].x, R4;\n" - "MAD R1.xyz, R1, R2.w, R3;\n" - "ADD R2.w, R0, R1;\n" - "ADD R2.xyz, R2, -R1;\n" - "SGE R0.xyz, R0, R0.w;\n" - "MAD result.color.xyz, R0, R2, R1;\n" - "MAD result.color.w, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SOFTLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..5],\n" - " { 2, 4, 1, 9.9999997e-006 },\n" - " { 16, 12, 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[6];\n" - "MUL R0.x, R0, c[6];\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "ADD R0.y, -R0.x, R0;\n" - "MOV R0.x, c[6];\n" - "MUL R0.x, R0, c[1];\n" - "MAX R0.z, R1.w, c[6].w;\n" - "RCP R0.z, R0.z;\n" - "MUL R3.xyz, R1, R0.z;\n" - "MAD R4.xyz, R3, c[7].x, -c[7].y;\n" - "RCP R0.x, R0.x;\n" - "MUL R0.x, R0.y, R0;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MAD R2.xyz, R0, c[6].x, -R0.w;\n" - "MAD R4.xyz, R3, R4, c[7].z;\n" - "MUL R5.xyz, R1.w, R2;\n" - "MUL R6.xyz, R5, R4;\n" - "RSQ R2.w, R3.x;\n" - "RCP R4.x, R2.w;\n" - "RSQ R2.w, R3.y;\n" - "RSQ R3.w, R3.z;\n" - "RCP R4.y, R2.w;\n" - "RCP R4.z, R3.w;\n" - "ADD R4.xyz, -R3, R4;\n" - "MUL R6.xyz, R3, R6;\n" - "MUL R4.xyz, R5, R4;\n" - "ADD R3.xyz, -R3, c[6].z;\n" - "MAD R2.xyz, R2, R3, R0.w;\n" - "MUL R3.xyz, R0, c[6].x;\n" - "MAD R5.xyz, R0.w, R1, R6;\n" - "MAD R4.xyz, R0.w, R1, R4;\n" - "ADD R6.xyz, R4, -R5;\n" - "MUL R4.xyz, R1, c[6].y;\n" - "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R6, R5;\n" - "MAD R4.xyz, -R1, R2, R4;\n" - "MUL R2.xyz, R1, R2;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MAD R2.xyz, R3, R4, R2;\n" - "ADD R2.w, -R1, c[6].z;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.x, R0.w, R1.w;\n" - "ADD R0.y, -R0.w, c[6].z;\n" - "MAD result.color.xyz, R1, R0.y, R2;\n" - "MAD result.color.w, -R0, R1, R0.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DIFFERENCE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 2, 4 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[6];\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0.y, R0.z;\n" - "RCP R0.y, R0.w;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "ADD R0.xyz, R0, R1;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R1.x, R0.w, R1.w;\n" - "MAD result.color.xyz, -R2, c[6].x, R0;\n" - "MAD result.color.w, -R0, R1, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_EXCLUSION_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..5],\n" - " { 2, 4, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.x, c[6].x;\n" - "MUL R0.z, R0, c[6].y;\n" - "MAD R0.x, R0.y, R0.y, -R0.z;\n" - "RSQ R0.z, R0.x;\n" - "MOV R0.x, c[6];\n" - "MUL R0.w, R0.x, c[1].x;\n" - "RCP R0.z, R0.z;\n" - "ADD R0.x, -R0.y, R0.z;\n" - "RCP R0.y, R0.w;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[6].x, R3;\n" - "ADD R2.w, -R1, c[6].z;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[6].z;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODE_BLEND_MODE_MASK = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 2, 4 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "ADD R0.z, R0, R0.w;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[8];\n" - "MUL R0.x, R0, c[8];\n" - "MAD R0.y, R0.x, R0.x, -R0;\n" - "RSQ R0.y, R0.y;\n" - "RCP R0.y, R0.y;\n" - "ADD R1.x, -R0, R0.y;\n" - "MOV R0.x, c[8];\n" - "MUL R0.x, R0, c[1];\n" - "RCP R1.y, R0.x;\n" - "ADD R0.zw, fragment.position.xyxy, c[6].xyxy;\n" - "MUL R0.zw, R0, c[5].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "MUL R1.x, R1, R1.y;\n" - "DP4 R1.y, R0, c[7];\n" - "TEX R0, R1, texture[1], 1D;\n" - "MUL result.color, R0, R1.y;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODE_BLEND_MODE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 2, 4 } };\n" - "TEMP R0;\n" - "MUL R0.xyz, fragment.position.y, c[3];\n" - "MAD R0.xyz, fragment.position.x, c[2], R0;\n" - "ADD R0.xyz, R0, c[4];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.xyxy;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.z, R0, R0.w;\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, -R0, c[1].x;\n" - "MUL R0.y, R0.z, c[5];\n" - "MUL R0.x, R0, c[5];\n" - "MAD R0.z, R0.x, R0.x, -R0.y;\n" - "MOV R0.y, c[5].x;\n" - "RSQ R0.z, R0.z;\n" - "MUL R0.w, R0.y, c[1].x;\n" - "RCP R0.y, R0.z;\n" - "RCP R0.z, R0.w;\n" - "ADD R0.x, -R0, R0.y;\n" - "MUL R0.x, R0, R0.z;\n" - "TEX result.color, R0, texture[0], 1D;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = - "!!ARBfp1.0\n" - "PARAM c[13] = { program.local[0..9],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[10].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[11].x, c[11].y;\n" - "MAD R1.z, R1, R1.y, -c[11];\n" - "MAD R1.z, R1, R1.y, c[11].w;\n" - "MAD R1.z, R1, R1.y, -c[12].x;\n" - "MAD R1.y, R1.z, R1, c[12];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[10].w;\n" - "ADD R0.z, -R0, R0.w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[10].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R1.x, R0, c[10];\n" - "FLR R1.y, R1.x;\n" - "MUL R0.xy, fragment.position, c[7];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, R1, -R1.y;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R2.xyz, R0, c[4].y;\n" - "MUL R3.xyz, R1.w, R2;\n" - "MUL R2.xyz, R1, c[4].x;\n" - "MAD R2.xyz, R0.w, R2, R3;\n" - "ADD R3.xy, fragment.position, c[8];\n" - "ADD R2.w, -R0, c[12].z;\n" - "MUL R1.xyz, R1, c[5].y;\n" - "MAD R2.xyz, R2.w, R1, R2;\n" - "MUL R1.xyz, R0, c[5].z;\n" - "ADD R3.z, -R1.w, c[12];\n" - "MAD R2.xyz, R3.z, R1, R2;\n" - "MUL R1.y, R1.w, R2.w;\n" - "MUL R1.x, R1.w, R0.w;\n" - "MUL R1.z, R0.w, R3;\n" - "DP3 R2.w, R1, c[5];\n" - "MUL R3.xy, R3, c[6];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[9];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_MULTIPLY = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[8].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[9].x, c[9].y;\n" - "MAD R1.z, R1, R1.y, -c[9];\n" - "MAD R1.z, R1, R1.y, c[9].w;\n" - "MAD R1.z, R1, R1.y, -c[10].x;\n" - "MAD R1.y, R1.z, R1, c[10];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[8].w;\n" - "ADD R0.z, -R0, R0.w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[8].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R1.x, R0, c[8];\n" - "FLR R1.y, R1.x;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, R1, -R1.y;\n" - "TEX R1, R1, texture[2], 1D;\n" - "ADD R2.x, -R0.w, c[10].z;\n" - "MUL R2.xyz, R1, R2.x;\n" - "MAD R1.xyz, R1, R0, R2;\n" - "ADD R2.x, -R1.w, c[10].z;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SCREEN = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ADD R3.xy, fragment.position, c[6];\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[8].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[9].x, c[9].y;\n" - "MAD R1.z, R1, R1.y, -c[9];\n" - "MAD R1.z, R1, R1.y, c[9].w;\n" - "MAD R1.z, R1, R1.y, -c[10].x;\n" - "MAD R1.y, R1.z, R1, c[10];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[8].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[8].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[8];\n" - "FLR R0.y, R0.x;\n" - "ADD R0.z, R0.x, -R0.y;\n" - "TEX R1, R0.z, texture[2], 1D;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R2, R1, R0;\n" - "MAD R2, -R1, R0, R2;\n" - "MUL R3.xy, R3, c[4];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_OVERLAY = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" - " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" - " { 3.141593, 0.15915494, 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[8];\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[8].y, c[8];\n" - "MAD R1.z, R1, R1.y, -c[8].w;\n" - "MAD R1.z, R1, R1.y, c[9].x;\n" - "MAD R1.z, R1, R1.y, -c[9].y;\n" - "MAD R1.y, R1.z, R1, c[9].z;\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[9].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[10].x;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[10].y;\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[10];\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[10].z;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MUL R3.xyz, R0, R1;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[10].w;\n" - "MAD R3.xyz, R3, c[10].z, R4;\n" - "MAD R3.xyz, R1, R2.x, R3;\n" - "MAD R0.xyz, R1, R2.x, R0;\n" - "MUL R2.xyz, R1, c[10].z;\n" - "ADD R0.xyz, R0, -R3;\n" - "SGE R2.xyz, R2, R1.w;\n" - "MAD R2.xyz, R2, R0, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DARKEN = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[8].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[9].x, c[9].y;\n" - "MAD R1.z, R1, R1.y, -c[9];\n" - "MAD R1.z, R1, R1.y, c[9].w;\n" - "MAD R1.z, R1, R1.y, -c[10].x;\n" - "MAD R1.y, R1.z, R1, c[10];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[8].w;\n" - "ADD R0.z, -R0, R0.w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[8].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.z, R0.x, c[8].x;\n" - "FLR R0.w, R0.z;\n" - "ADD R1.x, R0.z, -R0.w;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[10].z;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[10].z;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_LIGHTEN = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[8].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[9].x, c[9].y;\n" - "MAD R1.z, R1, R1.y, -c[9];\n" - "MAD R1.z, R1, R1.y, c[9].w;\n" - "MAD R1.z, R1, R1.y, -c[10].x;\n" - "MAD R1.y, R1.z, R1, c[10];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[8].w;\n" - "ADD R0.z, -R0, R0.w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[8].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.z, R0.x, c[8].x;\n" - "FLR R0.w, R0.z;\n" - "ADD R1.x, R0.z, -R0.w;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[10].z;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[10].z;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORDODGE = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" - " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" - " { 3.141593, 0.15915494, 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[8];\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[8].y, c[8];\n" - "MAD R1.z, R1, R1.y, -c[8].w;\n" - "MAD R1.z, R1, R1.y, c[9].x;\n" - "MAD R1.z, R1, R1.y, -c[9].y;\n" - "MAD R1.y, R1.z, R1, c[9].z;\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[9].w;\n" - "ADD R0.z, -R0, R0.w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[10].x;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[10].y;\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MAX R1.x, R0.w, c[10].w;\n" - "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -R0, R1.x, c[10].z;\n" - "MAX R2.xyz, R1, c[10].w;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[10].z;\n" - "MUL R3.xyz, R1, R2.w;\n" - "ADD R2.w, -R1, c[10].z;\n" - "MAD R4.xyz, R0, R2.w, R3;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MUL R2.w, R0, R1;\n" - "MAD R0.xyz, R0, R1.w, R3;\n" - "SGE R0.xyz, R0, R2.w;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R3, R2, R4;\n" - "MAD R4.xyz, R0.w, R1.w, R4;\n" - "ADD R4.xyz, R4, -R2;\n" - "MAD R2.xyz, R0, R4, R2;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORBURN = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" - " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" - " { 3.141593, 0.15915494, 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R1.x, R0.y, c[8];\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R1.x;\n" - "ABS R0.z, -R0.y;\n" - "MAX R1.x, R0.w, R0.z;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.w, R0.z;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[8].y, c[8];\n" - "MAD R1.z, R1, R1.y, -c[8].w;\n" - "MAD R1.z, R1, R1.y, c[9].x;\n" - "MAD R1.z, R1, R1.y, -c[9].y;\n" - "MAD R1.y, R1.z, R1, c[9].z;\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[9].w;\n" - "ADD R0.z, -R0.w, R0;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[10].x;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[10].y;\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MAD R2.xyz, -R0.w, R1.w, R3;\n" - "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[10].w;\n" - "ADD R2.w, -R1, c[10].z;\n" - "ADD R3.w, -R0, c[10].z;\n" - "MUL R5.xyz, R0, R2.w;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R4, R2, R5;\n" - "MUL R4.xyz, R1, R3.w;\n" - "MAD R0.xyz, R0, R2.w, R4;\n" - "MUL R2.w, R0, R1;\n" - "MAD R2.xyz, R1, R3.w, R2;\n" - "ADD R2.xyz, R2, -R0;\n" - "SGE R3.xyz, R3, R2.w;\n" - "MAD R2.xyz, R3, R2, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_HARDLIGHT = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" - " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" - " { 3.141593, 0.15915494, 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[8];\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[8].y, c[8];\n" - "MAD R1.z, R1, R1.y, -c[8].w;\n" - "MAD R1.z, R1, R1.y, c[9].x;\n" - "MAD R1.z, R1, R1.y, -c[9].y;\n" - "MAD R1.y, R1.z, R1, c[9].z;\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[9].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[10].x;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[10].y;\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[10];\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[10].z;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R3.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[10];\n" - "MAD R3.xyz, R3, c[10].z, R4;\n" - "MUL R0.xyz, R0, c[10].z;\n" - "SGE R0.xyz, R0, R0.w;\n" - "MAD R3.xyz, R1, R2.w, R3;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "ADD R2.xyz, R2, -R3;\n" - "MAD R2.xyz, R0, R2, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT = - "!!ARBfp1.0\n" - "PARAM c[13] = { program.local[0..7],\n" - " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" - " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" - " { 3.141593, 0.15915494, 1, 2 },\n" - " { 9.9999997e-006, 4, 16, 12 },\n" - " { 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R1.x, R0.y, c[8];\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R1.x;\n" - "ABS R0.z, -R0.y;\n" - "MAX R1.x, R0.w, R0.z;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.w, R0.z;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[8].y, c[8];\n" - "MAD R1.z, R1, R1.y, -c[8].w;\n" - "MAD R1.z, R1, R1.y, c[9].x;\n" - "MAD R1.z, R1, R1.y, -c[9].y;\n" - "MAD R1.y, R1.z, R1, c[9].z;\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[9].w;\n" - "ADD R0.z, -R0.w, R0;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[10].x;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MAX R0.z, R1.w, c[11].x;\n" - "RCP R2.x, R0.z;\n" - "MUL R3.xyz, R1, R2.x;\n" - "MAD R4.xyz, R3, c[11].z, -c[11].w;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[10].y;\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MAD R2.xyz, R0, c[10].w, -R0.w;\n" - "MAD R4.xyz, R3, R4, c[12].x;\n" - "MUL R5.xyz, R1.w, R2;\n" - "MUL R6.xyz, R5, R4;\n" - "RSQ R2.w, R3.x;\n" - "RCP R4.x, R2.w;\n" - "RSQ R2.w, R3.y;\n" - "RSQ R3.w, R3.z;\n" - "RCP R4.y, R2.w;\n" - "RCP R4.z, R3.w;\n" - "ADD R4.xyz, -R3, R4;\n" - "MUL R6.xyz, R3, R6;\n" - "MUL R4.xyz, R5, R4;\n" - "ADD R3.xyz, -R3, c[10].z;\n" - "MAD R2.xyz, R2, R3, R0.w;\n" - "MUL R3.xyz, R0, c[10].w;\n" - "MAD R5.xyz, R0.w, R1, R6;\n" - "MAD R4.xyz, R0.w, R1, R4;\n" - "ADD R6.xyz, R4, -R5;\n" - "MUL R4.xyz, R1, c[11].y;\n" - "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R6, R5;\n" - "MAD R4.xyz, -R1, R2, R4;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MUL R2.xyz, R1, R2;\n" - "ADD R2.w, -R1, c[10].z;\n" - "MAD R2.xyz, R3, R4, R2;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.x, -R0.w, c[10].z;\n" - "MAD R2.xyz, R1, R0.x, R2;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DIFFERENCE = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[8].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[9].x, c[9].y;\n" - "MAD R1.z, R1, R1.y, -c[9];\n" - "MAD R1.z, R1, R1.y, c[9].w;\n" - "MAD R1.z, R1, R1.y, -c[10].x;\n" - "MAD R1.y, R1.z, R1, c[10];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[8].w;\n" - "ADD R0.z, -R0, R0.w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[8].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.z, R0.x, c[8].x;\n" - "FLR R0.w, R0.z;\n" - "ADD R1.x, R0.z, -R0.w;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "ADD R2.xyz, R1, R0;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R1.xyz, R1, R0.w;\n" - "MIN R1.xyz, R1, R3;\n" - "MAD R2.xyz, -R1, c[10].z, R2;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_EXCLUSION = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..7],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[8].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[9].x, c[9].y;\n" - "MAD R1.z, R1, R1.y, -c[9];\n" - "MAD R1.z, R1, R1.y, c[9].w;\n" - "MAD R1.z, R1, R1.y, -c[10].x;\n" - "MAD R1.y, R1.z, R1, c[10];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[8].w;\n" - "ADD R0.z, -R0, R0.w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[8].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.z, R0.x, c[8].x;\n" - "FLR R0.w, R0.z;\n" - "ADD R1.x, R0.z, -R0.w;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R2.xyz, R1.w, R0;\n" - "MAD R3.xyz, R1, R0.w, R2;\n" - "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[10].z, R3;\n" - "ADD R2.w, -R0, c[10];\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[10].w;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[7].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[8].x, c[8].y;\n" - "MAD R1.z, R1, R1.y, -c[8];\n" - "MAD R1.z, R1, R1.y, c[8].w;\n" - "MAD R1.z, R1, R1.y, -c[9].x;\n" - "MAD R1.y, R1.z, R1, c[9];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[7].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[7].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R2.xyz, R1, c[4].y;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[7];\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R3.xyz, R0.w, R2;\n" - "MUL R2.xyz, R0, c[4].x;\n" - "MAD R2.xyz, R1.w, R2, R3;\n" - "ADD R2.w, -R1, c[9].z;\n" - "MUL R0.xyz, R0, c[5].y;\n" - "MAD R0.xyz, R2.w, R0, R2;\n" - "ADD R2.x, -R0.w, c[9].z;\n" - "MUL R1.xyz, R1, c[5].z;\n" - "MAD result.color.xyz, R2.x, R1, R0;\n" - "MUL R0.x, R0.w, R1.w;\n" - "MUL R0.z, R1.w, R2.x;\n" - "MUL R0.y, R0.w, R2.w;\n" - "DP3 result.color.w, R0, c[5];\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_MULTIPLY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[5].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[6].x, c[6].y;\n" - "MAD R1.z, R1, R1.y, -c[6];\n" - "MAD R1.z, R1, R1.y, c[6].w;\n" - "MAD R1.z, R1, R1.y, -c[7].x;\n" - "MAD R1.y, R1.z, R1, c[7];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[5].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[5].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[5];\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "ADD R2.x, -R1.w, c[7].z;\n" - "MUL R2.xyz, R0, R2.x;\n" - "MAD R0.xyz, R0, R1, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[7].z;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SCREEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[5].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[6].x, c[6].y;\n" - "MAD R1.z, R1, R1.y, -c[6];\n" - "MAD R1.z, R1, R1.y, c[6].w;\n" - "MAD R1.z, R1, R1.y, -c[7].x;\n" - "MAD R1.y, R1.z, R1, c[7];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[5].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[5].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[5];\n" - "FLR R0.y, R0.x;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "ADD R2, R0, R1;\n" - "MAD result.color, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_OVERLAY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" - " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" - " { 3.141593, 0.15915494, 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[5];\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[5].y, c[5];\n" - "MAD R1.z, R1, R1.y, -c[5].w;\n" - "MAD R1.z, R1, R1.y, c[6].x;\n" - "MAD R1.z, R1, R1.y, -c[6].y;\n" - "MAD R1.y, R1.z, R1, c[6].z;\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[6].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[7].x;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[7].y;\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[7];\n" - "MUL R2.xyz, R2, c[7].z;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R3.xyz, R0, R2.w;\n" - "MUL R0.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[7];\n" - "MAD R0.xyz, R0, c[7].z, R3;\n" - "MAD R0.xyz, R1, R2.w, R0;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "MUL R1.xyz, R1, c[7].z;\n" - "ADD R2.w, R0, R1;\n" - "ADD R2.xyz, R2, -R0;\n" - "SGE R1.xyz, R1, R1.w;\n" - "MAD result.color.xyz, R1, R2, R0;\n" - "MAD result.color.w, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DARKEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[5].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[6].x, c[6].y;\n" - "MAD R1.z, R1, R1.y, -c[6];\n" - "MAD R1.z, R1, R1.y, c[6].w;\n" - "MAD R1.z, R1, R1.y, -c[7].x;\n" - "MAD R1.y, R1.z, R1, c[7];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[5].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[5].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[5];\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[7].z;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[7].z;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_LIGHTEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[5].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[6].x, c[6].y;\n" - "MAD R1.z, R1, R1.y, -c[6];\n" - "MAD R1.z, R1, R1.y, c[6].w;\n" - "MAD R1.z, R1, R1.y, -c[7].x;\n" - "MAD R1.y, R1.z, R1, c[7];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[5].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[5].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[5];\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[7].z;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[7].z;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORDODGE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" - " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" - " { 3.141593, 0.15915494, 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[5];\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[5].y, c[5];\n" - "MAD R1.z, R1, R1.y, -c[5].w;\n" - "MAD R1.z, R1, R1.y, c[6].x;\n" - "MAD R1.z, R1, R1.y, -c[6].y;\n" - "MAD R1.y, R1.z, R1, c[6].z;\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[6].w;\n" - "ADD R0.z, -R0, R0.w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[7].x;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[7].y;\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MAX R1.x, R0.w, c[7].w;\n" - "RCP R1.x, R1.x;\n" - "MAD R1.xyz, -R0, R1.x, c[7].z;\n" - "MAX R2.xyz, R1, c[7].w;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[7].z;\n" - "MUL R3.xyz, R1, R2.w;\n" - "ADD R2.w, -R1, c[7].z;\n" - "MAD R3.xyz, R0, R2.w, R3;\n" - "MUL R1.xyz, R0.w, R1;\n" - "MAD R0.xyz, R0, R1.w, R1;\n" - "MUL R2.w, R0, R1;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R1, R2, R3;\n" - "MAD R3.xyz, R0.w, R1.w, R3;\n" - "ADD R1.x, R0.w, R1.w;\n" - "ADD R3.xyz, R3, -R2;\n" - "SGE R0.xyz, R0, R2.w;\n" - "MAD result.color.xyz, R0, R3, R2;\n" - "MAD result.color.w, -R0, R1, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORBURN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" - " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" - " { 3.141593, 0.15915494, 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R1.x, R0.y, c[5];\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R1.x;\n" - "ABS R0.z, -R0.y;\n" - "MAX R1.x, R0.w, R0.z;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.w, R0.z;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[5].y, c[5];\n" - "MAD R1.z, R1, R1.y, -c[5].w;\n" - "MAD R1.z, R1, R1.y, c[6].x;\n" - "MAD R1.z, R1, R1.y, -c[6].y;\n" - "MAD R1.y, R1.z, R1, c[6].z;\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[6].w;\n" - "ADD R0.z, -R0.w, R0;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[7].x;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[7].y;\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "ADD R2.w, -R1, c[7].z;\n" - "MAD R2.xyz, -R0.w, R1.w, R3;\n" - "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[7].w;\n" - "MUL R5.xyz, R0, R2.w;\n" - "ADD R3.w, -R0, c[7].z;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R4, R2, R5;\n" - "MUL R4.xyz, R1, R3.w;\n" - "MAD R1.xyz, R1, R3.w, R2;\n" - "MAD R0.xyz, R0, R2.w, R4;\n" - "MUL R2.x, R0.w, R1.w;\n" - "ADD R2.w, R0, R1;\n" - "ADD R1.xyz, R1, -R0;\n" - "SGE R2.xyz, R3, R2.x;\n" - "MAD result.color.xyz, R2, R1, R0;\n" - "MAD result.color.w, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_HARDLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" - " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" - " { 3.141593, 0.15915494, 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[5];\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[5].y, c[5];\n" - "MAD R1.z, R1, R1.y, -c[5].w;\n" - "MAD R1.z, R1, R1.y, c[6].x;\n" - "MAD R1.z, R1, R1.y, -c[6].y;\n" - "MAD R1.y, R1.z, R1, c[6].z;\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[6].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[7].x;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[7].y;\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[7];\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[7].z;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MUL R3.xyz, R0, R1;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R2.w, -R0, c[7];\n" - "MUL R0.xyz, R0, c[7].z;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "MAD R3.xyz, R3, c[7].z, R4;\n" - "MAD R1.xyz, R1, R2.w, R3;\n" - "ADD R2.w, R0, R1;\n" - "ADD R2.xyz, R2, -R1;\n" - "SGE R0.xyz, R0, R0.w;\n" - "MAD result.color.xyz, R0, R2, R1;\n" - "MAD result.color.w, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..4],\n" - " { 0.0020000001, -0.01348047, 0.05747731, 0.1212391 },\n" - " { 0.1956359, 0.33299461, 0.99999559, 1.570796 },\n" - " { 3.141593, 0.15915494, 1, 2 },\n" - " { 9.9999997e-006, 4, 16, 12 },\n" - " { 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.w, R0.x;\n" - "ABS R0.z, R0.y;\n" - "ADD R0.z, R0, -R0.w;\n" - "ADD R1.x, R0.y, c[5];\n" - "ABS R0.z, R0;\n" - "CMP R0.y, -R0.z, R0, R1.x;\n" - "ABS R0.z, -R0.y;\n" - "MAX R1.x, R0.w, R0.z;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.w, R0.z;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[5].y, c[5];\n" - "MAD R1.z, R1, R1.y, -c[5].w;\n" - "MAD R1.z, R1, R1.y, c[6].x;\n" - "MAD R1.z, R1, R1.y, -c[6].y;\n" - "MAD R1.y, R1.z, R1, c[6].z;\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[6].w;\n" - "ADD R0.z, -R0.w, R0;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[7].x;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MAX R0.z, R1.w, c[8].x;\n" - "RCP R2.x, R0.z;\n" - "MUL R3.xyz, R1, R2.x;\n" - "MAD R4.xyz, R3, c[8].z, -c[8].w;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[7].y;\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MAD R2.xyz, R0, c[7].w, -R0.w;\n" - "MAD R4.xyz, R3, R4, c[9].x;\n" - "MUL R5.xyz, R1.w, R2;\n" - "MUL R6.xyz, R5, R4;\n" - "RSQ R2.w, R3.x;\n" - "RCP R4.x, R2.w;\n" - "RSQ R2.w, R3.y;\n" - "RSQ R3.w, R3.z;\n" - "RCP R4.y, R2.w;\n" - "RCP R4.z, R3.w;\n" - "ADD R4.xyz, -R3, R4;\n" - "MUL R6.xyz, R3, R6;\n" - "MUL R4.xyz, R5, R4;\n" - "ADD R3.xyz, -R3, c[7].z;\n" - "MAD R2.xyz, R2, R3, R0.w;\n" - "MUL R3.xyz, R0, c[7].w;\n" - "MAD R5.xyz, R0.w, R1, R6;\n" - "MAD R4.xyz, R0.w, R1, R4;\n" - "ADD R6.xyz, R4, -R5;\n" - "MUL R4.xyz, R1, c[8].y;\n" - "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R6, R5;\n" - "MAD R4.xyz, -R1, R2, R4;\n" - "MUL R2.xyz, R1, R2;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MAD R2.xyz, R3, R4, R2;\n" - "ADD R2.w, -R1, c[7].z;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.x, R0.w, R1.w;\n" - "ADD R0.y, -R0.w, c[7].z;\n" - "MAD result.color.xyz, R1, R0.y, R2;\n" - "MAD result.color.w, -R0, R1, R0.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DIFFERENCE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[5].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[6].x, c[6].y;\n" - "MAD R1.z, R1, R1.y, -c[6];\n" - "MAD R1.z, R1, R1.y, c[6].w;\n" - "MAD R1.z, R1, R1.y, -c[7].x;\n" - "MAD R1.y, R1.z, R1, c[7];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[5].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[5].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[5];\n" - "FLR R0.y, R0.x;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "ADD R0.xyz, R0, R1;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R1.x, R0.w, R1.w;\n" - "MAD result.color.xyz, -R2, c[7].z, R0;\n" - "MAD result.color.w, -R0, R1, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_EXCLUSION_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..4],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559, 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[5].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[6].x, c[6].y;\n" - "MAD R1.z, R1, R1.y, -c[6];\n" - "MAD R1.z, R1, R1.y, c[6].w;\n" - "MAD R1.z, R1, R1.y, -c[7].x;\n" - "MAD R1.y, R1.z, R1, c[7];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[5].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[5].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[5];\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[7].z, R3;\n" - "ADD R2.w, -R1, c[7];\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[7].w;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODE_BLEND_MODE_MASK = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..6],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[7].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[8].x, c[8].y;\n" - "MAD R1.z, R1, R1.y, -c[8];\n" - "MAD R1.z, R1, R1.y, c[8].w;\n" - "MAD R1.z, R1, R1.y, -c[9].x;\n" - "MAD R1.y, R1.z, R1, c[9];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R1.y, -R1.x, c[7].w;\n" - "ADD R0.z, -R0, R0.w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[7].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R1.x, R0, c[7];\n" - "FLR R1.y, R1.x;\n" - "ADD R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "MUL R0.xy, R0.zwzw, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, R1, -R1.y;\n" - "DP4 R1.y, R0, c[6];\n" - "TEX R0, R1, texture[1], 1D;\n" - "MUL result.color, R0, R1.y;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODE_BLEND_MODE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..3],\n" - " { 0.15915494, 0.0020000001, 3.141593, 1.570796 },\n" - " { -0.01348047, 0.05747731, 0.1212391, 0.1956359 },\n" - " { 0.33299461, 0.99999559 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "ABS R0.z, R0.x;\n" - "ABS R0.w, R0.y;\n" - "ADD R0.w, R0, -R0.z;\n" - "ADD R1.x, R0.y, c[4].y;\n" - "ABS R0.w, R0;\n" - "CMP R0.y, -R0.w, R0, R1.x;\n" - "ABS R0.w, -R0.y;\n" - "MAX R1.x, R0.z, R0.w;\n" - "RCP R1.y, R1.x;\n" - "MIN R1.x, R0.z, R0.w;\n" - "MUL R1.x, R1, R1.y;\n" - "MUL R1.y, R1.x, R1.x;\n" - "MAD R1.z, R1.y, c[5].x, c[5].y;\n" - "MAD R1.z, R1, R1.y, -c[5];\n" - "MAD R1.z, R1, R1.y, c[5].w;\n" - "MAD R1.z, R1, R1.y, -c[6].x;\n" - "MAD R1.y, R1.z, R1, c[6];\n" - "MUL R1.x, R1.y, R1;\n" - "ADD R0.z, -R0, R0.w;\n" - "ADD R1.y, -R1.x, c[4].w;\n" - "CMP R0.z, -R0, R1.y, R1.x;\n" - "ADD R0.w, -R0.z, c[4].z;\n" - "CMP R0.x, R0, R0.w, R0.z;\n" - "CMP R0.x, -R0.y, -R0, R0;\n" - "ADD R0.x, R0, c[0];\n" - "MUL R0.x, R0, c[4];\n" - "FLR R0.y, R0.x;\n" - "ADD R0.x, R0, -R0.y;\n" - "TEX result.color, R0, texture[0], 1D;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..9],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "ADD R1.x, R0.z, R0.w;\n" - "MUL R0.xy, fragment.position, c[7];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.x, R1, c[0].z;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R2.xyz, R0, c[4].y;\n" - "MUL R3.xyz, R1.w, R2;\n" - "MUL R2.xyz, R1, c[4].x;\n" - "MAD R2.xyz, R0.w, R2, R3;\n" - "ADD R3.xy, fragment.position, c[8];\n" - "ADD R2.w, -R0, c[10].x;\n" - "MUL R1.xyz, R1, c[5].y;\n" - "MAD R2.xyz, R2.w, R1, R2;\n" - "MUL R1.xyz, R0, c[5].z;\n" - "ADD R3.z, -R1.w, c[10].x;\n" - "MAD R2.xyz, R3.z, R1, R2;\n" - "MUL R1.y, R1.w, R2.w;\n" - "MUL R1.x, R1.w, R0.w;\n" - "MUL R1.z, R0.w, R3;\n" - "DP3 R2.w, R1, c[5];\n" - "MUL R3.xy, R3, c[6];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[9];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_MULTIPLY = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "ADD R1.x, R0.z, R0.w;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.x, R1, c[0].z;\n" - "TEX R1, R1, texture[2], 1D;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MUL R2.xyz, R1, R2.x;\n" - "MAD R1.xyz, R1, R0, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SCREEN = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..7] };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.z, R0.x, c[0];\n" - "ADD R3.xy, fragment.position, c[6];\n" - "TEX R1, R0.z, texture[2], 1D;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R2, R1, R0;\n" - "MAD R2, -R1, R0, R2;\n" - "MUL R3.xy, R3, c[4];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_OVERLAY = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[8].y;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[8].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MUL R3.xyz, R0, R1;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8].y;\n" - "MAD R3.xyz, R3, c[8].x, R4;\n" - "MAD R3.xyz, R1, R2.x, R3;\n" - "MAD R0.xyz, R1, R2.x, R0;\n" - "MUL R2.xyz, R1, c[8].x;\n" - "ADD R0.xyz, R0, -R3;\n" - "SGE R2.xyz, R2, R1.w;\n" - "MAD R2.xyz, R2, R0, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_DARKEN = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.z, R0.x, R0.y;\n" - "MUL R1.x, R0.z, c[0].z;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_LIGHTEN = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.z, R0.x, R0.y;\n" - "MUL R1.x, R0.z, c[0].z;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORDODGE = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MAX R1.x, R0.w, c[8].y;\n" - "RCP R1.x, R1.x;\n" - "MAD R2.xyz, -R0, R1.x, c[8].x;\n" - "MAX R2.xyz, R2, c[8].y;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MUL R3.xyz, R1, R2.w;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R4.xyz, R0, R2.w, R3;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MUL R2.w, R0, R1;\n" - "MAD R0.xyz, R0, R1.w, R3;\n" - "SGE R0.xyz, R0, R2.w;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R3, R2, R4;\n" - "MAD R4.xyz, R0.w, R1.w, R4;\n" - "ADD R4.xyz, R4, -R2;\n" - "MAD R2.xyz, R0, R4, R2;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORBURN = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MAD R2.xyz, -R0.w, R1.w, R3;\n" - "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[8].y;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MUL R5.xyz, R0, R2.w;\n" - "ADD R3.w, -R0, c[8].x;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R4, R2, R5;\n" - "MUL R4.xyz, R1, R3.w;\n" - "MAD R0.xyz, R0, R2.w, R4;\n" - "MUL R2.w, R0, R1;\n" - "MAD R2.xyz, R1, R3.w, R2;\n" - "ADD R2.xyz, R2, -R0;\n" - "SGE R3.xyz, R3, R2.w;\n" - "MAD R2.xyz, R3, R2, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_HARDLIGHT = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[8].y;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[8].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R3.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[8].y;\n" - "MAD R3.xyz, R3, c[8].x, R4;\n" - "MUL R0.xyz, R0, c[8].x;\n" - "SGE R0.xyz, R0, R0.w;\n" - "MAD R3.xyz, R1, R2.w, R3;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "ADD R2.xyz, R2, -R3;\n" - "MAD R2.xyz, R0, R2, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..7],\n" - " { 1, 2, 9.9999997e-006, 4 },\n" - " { 16, 12, 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MAX R0.z, R1.w, c[8];\n" - "RCP R0.z, R0.z;\n" - "MUL R3.xyz, R1, R0.z;\n" - "MAD R2.xyz, R3, c[9].x, -c[9].y;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[2], 1D;\n" - "MAD R4.xyz, R3, R2, c[9].z;\n" - "MAD R2.xyz, R0, c[8].y, -R0.w;\n" - "MUL R5.xyz, R1.w, R2;\n" - "MUL R6.xyz, R5, R4;\n" - "RSQ R2.w, R3.x;\n" - "RCP R4.x, R2.w;\n" - "RSQ R2.w, R3.y;\n" - "RSQ R3.w, R3.z;\n" - "RCP R4.y, R2.w;\n" - "RCP R4.z, R3.w;\n" - "ADD R4.xyz, -R3, R4;\n" - "MUL R6.xyz, R3, R6;\n" - "MUL R4.xyz, R5, R4;\n" - "ADD R3.xyz, -R3, c[8].x;\n" - "MAD R2.xyz, R2, R3, R0.w;\n" - "MUL R3.xyz, R0, c[8].y;\n" - "MAD R5.xyz, R0.w, R1, R6;\n" - "MAD R4.xyz, R0.w, R1, R4;\n" - "ADD R6.xyz, R4, -R5;\n" - "MUL R4.xyz, R1, c[8].w;\n" - "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R6, R5;\n" - "MAD R4.xyz, -R1, R2, R4;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MUL R2.xyz, R1, R2;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R2.xyz, R3, R4, R2;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R0.x, R2;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_DIFFERENCE = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.z, R0.x, R0.y;\n" - "MUL R1.x, R0.z, c[0].z;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "ADD R2.xyz, R1, R0;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R1.xyz, R1, R0.w;\n" - "MIN R1.xyz, R1, R3;\n" - "MAD R2.xyz, -R1, c[8].x, R2;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_EXCLUSION = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.z, R0.x, R0.y;\n" - "MUL R1.x, R0.z, c[0].z;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 1D;\n" - "MUL R2.xyz, R1.w, R0;\n" - "MAD R3.xyz, R1, R0.w, R2;\n" - "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[8].x, R3;\n" - "ADD R2.w, -R0, c[8].y;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8].y;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..6],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R2.xyz, R1, c[4].y;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R3.xyz, R0.w, R2;\n" - "MUL R2.xyz, R0, c[4].x;\n" - "MAD R2.xyz, R1.w, R2, R3;\n" - "ADD R2.w, -R1, c[7].x;\n" - "MUL R0.xyz, R0, c[5].y;\n" - "MAD R0.xyz, R2.w, R0, R2;\n" - "ADD R2.x, -R0.w, c[7];\n" - "MUL R1.xyz, R1, c[5].z;\n" - "MAD result.color.xyz, R2.x, R1, R0;\n" - "MUL R0.x, R0.w, R1.w;\n" - "MUL R0.z, R1.w, R2.x;\n" - "MUL R0.y, R0.w, R2.w;\n" - "DP3 result.color.w, R0, c[5];\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_MULTIPLY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "ADD R2.x, -R1.w, c[5];\n" - "MUL R2.xyz, R0, R2.x;\n" - "MAD R0.xyz, R0, R1, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5].x;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SCREEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..4] };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "ADD R2, R0, R1;\n" - "MAD result.color, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_OVERLAY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[5].y;\n" - "MUL R2.xyz, R2, c[5].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R3.xyz, R0, R2.w;\n" - "MUL R0.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[5].y;\n" - "MAD R0.xyz, R0, c[5].x, R3;\n" - "MAD R0.xyz, R1, R2.w, R0;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "MUL R1.xyz, R1, c[5].x;\n" - "ADD R2.w, R0, R1;\n" - "ADD R2.xyz, R2, -R0;\n" - "SGE R1.xyz, R1, R1.w;\n" - "MAD result.color.xyz, R1, R2, R0;\n" - "MAD result.color.w, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_DARKEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5].x;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_LIGHTEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5].x;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORDODGE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MAX R1.x, R0.w, c[5].y;\n" - "RCP R1.x, R1.x;\n" - "MAD R3.xyz, -R0, R1.x, c[5].x;\n" - "MAX R3.xyz, R3, c[5].y;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.x, -R0.w, c[5];\n" - "MUL R2.xyz, R1, R2.x;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R1.xyz, R0.w, R1;\n" - "MAD R0.xyz, R0, R1.w, R1;\n" - "MUL R2.w, R0, R1;\n" - "RCP R3.x, R3.x;\n" - "RCP R3.y, R3.y;\n" - "RCP R3.z, R3.z;\n" - "MAD R3.xyz, R1, R3, R2;\n" - "MAD R2.xyz, R0.w, R1.w, R2;\n" - "ADD R1.x, R0.w, R1.w;\n" - "ADD R2.xyz, R2, -R3;\n" - "SGE R0.xyz, R0, R2.w;\n" - "MAD result.color.xyz, R0, R2, R3;\n" - "MAD result.color.w, -R0, R1, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORBURN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R2.xyz, -R0.w, R1.w, R3;\n" - "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[5].y;\n" - "MUL R5.xyz, R0, R2.w;\n" - "ADD R3.w, -R0, c[5].x;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R4, R2, R5;\n" - "MUL R4.xyz, R1, R3.w;\n" - "MAD R1.xyz, R1, R3.w, R2;\n" - "MAD R0.xyz, R0, R2.w, R4;\n" - "MUL R2.x, R0.w, R1.w;\n" - "ADD R2.w, R0, R1;\n" - "ADD R1.xyz, R1, -R0;\n" - "SGE R2.xyz, R3, R2.x;\n" - "MAD result.color.xyz, R2, R1, R0;\n" - "MAD result.color.w, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_HARDLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[5].y;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[5].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MUL R3.xyz, R0, R1;\n" - "MUL R0.xyz, R0, c[5].x;\n" - "ADD R2.w, -R0, c[5].y;\n" - "MAD R3.xyz, R3, c[5].x, R4;\n" - "MAD R3.xyz, R1, R2.w, R3;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R1.xyz, R1, -R3;\n" - "SGE R0.xyz, R0, R0.w;\n" - "MAD result.color.xyz, R0, R1, R3;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..4],\n" - " { 1, 2, 9.9999997e-006, 4 },\n" - " { 16, 12, 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MAX R0.z, R1.w, c[5];\n" - "RCP R0.z, R0.z;\n" - "MUL R3.xyz, R1, R0.z;\n" - "MAD R2.xyz, R3, c[6].x, -c[6].y;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MAD R4.xyz, R3, R2, c[6].z;\n" - "MAD R2.xyz, R0, c[5].y, -R0.w;\n" - "MUL R5.xyz, R1.w, R2;\n" - "MUL R6.xyz, R5, R4;\n" - "RSQ R2.w, R3.x;\n" - "RCP R4.x, R2.w;\n" - "RSQ R2.w, R3.y;\n" - "RSQ R3.w, R3.z;\n" - "RCP R4.y, R2.w;\n" - "RCP R4.z, R3.w;\n" - "ADD R4.xyz, -R3, R4;\n" - "MUL R6.xyz, R3, R6;\n" - "MUL R4.xyz, R5, R4;\n" - "ADD R3.xyz, -R3, c[5].x;\n" - "MAD R2.xyz, R2, R3, R0.w;\n" - "MUL R3.xyz, R0, c[5].y;\n" - "MAD R5.xyz, R0.w, R1, R6;\n" - "MAD R4.xyz, R0.w, R1, R4;\n" - "ADD R6.xyz, R4, -R5;\n" - "MUL R4.xyz, R1, c[5].w;\n" - "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R6, R5;\n" - "MAD R4.xyz, -R1, R2, R4;\n" - "MUL R2.xyz, R1, R2;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MAD R2.xyz, R3, R4, R2;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.x, R0.w, R1.w;\n" - "ADD R0.y, -R0.w, c[5].x;\n" - "MAD result.color.xyz, R1, R0.y, R2;\n" - "MAD result.color.w, -R0, R1, R0.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_DIFFERENCE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "ADD R0.xyz, R0, R1;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R1.x, R0.w, R1.w;\n" - "MAD result.color.xyz, -R2, c[5].x, R0;\n" - "MAD result.color.w, -R0, R1, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_EXCLUSION_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX R0, R0, texture[1], 1D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[5].x, R3;\n" - "ADD R2.w, -R1, c[5].y;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5];\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODE_BLEND_MODE_MASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..6] };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R0.zw, R0, c[0].xyxy;\n" - "ADD R1.x, R0.z, R0.w;\n" - "ADD R0.xy, fragment.position, c[5];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" - "DP4 R1.y, R0, c[6];\n" - "MUL R1.x, R1, c[0].z;\n" - "TEX R0, R1, texture[1], 1D;\n" - "MUL result.color, R0, R1.y;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODE_BLEND_MODE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[4] = { program.local[0..3] };\n" - "TEMP R0;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "ADD R0.x, R0, R0.y;\n" - "MUL R0.x, R0, c[0].z;\n" - "TEX result.color, R0, texture[0], 1D;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..9],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R1.xyz, R0, c[3];\n" - "RCP R0.z, R1.z;\n" - "MUL R1.xy, R1, R0.z;\n" - "MUL R0.xy, fragment.position, c[7];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1, R1, texture[2], 2D;\n" - "MUL R2.xyz, R0, c[4].y;\n" - "MUL R3.xyz, R1.w, R2;\n" - "MUL R2.xyz, R1, c[4].x;\n" - "MAD R2.xyz, R0.w, R2, R3;\n" - "ADD R3.xy, fragment.position, c[8];\n" - "ADD R2.w, -R0, c[10].x;\n" - "MUL R1.xyz, R1, c[5].y;\n" - "MAD R2.xyz, R2.w, R1, R2;\n" - "MUL R1.xyz, R0, c[5].z;\n" - "ADD R3.z, -R1.w, c[10].x;\n" - "MAD R2.xyz, R3.z, R1, R2;\n" - "MUL R1.y, R1.w, R2.w;\n" - "MUL R1.x, R1.w, R0.w;\n" - "MUL R1.z, R0.w, R3;\n" - "DP3 R2.w, R1, c[5];\n" - "MUL R3.xy, R3, c[6];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[9];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_MULTIPLY = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R1.xyz, R0, c[3];\n" - "RCP R0.z, R1.z;\n" - "MUL R1.xy, R1, R0.z;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1, R1, texture[2], 2D;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MUL R2.xyz, R1, R2.x;\n" - "MAD R1.xyz, R1, R0, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SCREEN = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..7] };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "ADD R3.xy, fragment.position, c[6];\n" - "TEX R1, R0.zwzw, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R2, R1, R0;\n" - "MAD R2, -R1, R0, R2;\n" - "MUL R3.xy, R3, c[4];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_OVERLAY = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[2], 2D;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[8].y;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[8].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MUL R3.xyz, R0, R1;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, -R0.w, c[8].y;\n" - "MAD R3.xyz, R3, c[8].x, R4;\n" - "MAD R3.xyz, R1, R2.x, R3;\n" - "MAD R0.xyz, R1, R2.x, R0;\n" - "MUL R2.xyz, R1, c[8].x;\n" - "ADD R0.xyz, R0, -R3;\n" - "SGE R2.xyz, R2, R1.w;\n" - "MAD R2.xyz, R2, R0, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_DARKEN = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 2D;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_LIGHTEN = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 2D;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORDODGE = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[2], 2D;\n" - "MAX R1.x, R0.w, c[8].y;\n" - "RCP R1.x, R1.x;\n" - "MAD R2.xyz, -R0, R1.x, c[8].x;\n" - "MAX R2.xyz, R2, c[8].y;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MUL R3.xyz, R1, R2.w;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R4.xyz, R0, R2.w, R3;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MUL R2.w, R0, R1;\n" - "MAD R0.xyz, R0, R1.w, R3;\n" - "SGE R0.xyz, R0, R2.w;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R3, R2, R4;\n" - "MAD R4.xyz, R0.w, R1.w, R4;\n" - "ADD R4.xyz, R4, -R2;\n" - "MAD R2.xyz, R0, R4, R2;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORBURN = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[2], 2D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MAD R2.xyz, -R0.w, R1.w, R3;\n" - "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[8].y;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MUL R5.xyz, R0, R2.w;\n" - "ADD R3.w, -R0, c[8].x;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R4, R2, R5;\n" - "MUL R4.xyz, R1, R3.w;\n" - "MAD R0.xyz, R0, R2.w, R4;\n" - "MUL R2.w, R0, R1;\n" - "MAD R2.xyz, R1, R3.w, R2;\n" - "ADD R2.xyz, R2, -R0;\n" - "SGE R3.xyz, R3, R2.w;\n" - "MAD R2.xyz, R3, R2, R0;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_HARDLIGHT = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[2], 2D;\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[8].y;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[8].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R3.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[8].y;\n" - "MAD R3.xyz, R3, c[8].x, R4;\n" - "MUL R0.xyz, R0, c[8].x;\n" - "SGE R0.xyz, R0, R0.w;\n" - "MAD R3.xyz, R1, R2.w, R3;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "ADD R2.xyz, R2, -R3;\n" - "MAD R2.xyz, R0, R2, R3;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..7],\n" - " { 1, 2, 9.9999997e-006, 4 },\n" - " { 16, 12, 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MUL R1.xy, fragment.position, c[5];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MAX R0.w, R1, c[8].z;\n" - "RCP R0.w, R0.w;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MAD R2.xyz, R3, c[9].x, -c[9].y;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[2], 2D;\n" - "MAD R4.xyz, R3, R2, c[9].z;\n" - "MAD R2.xyz, R0, c[8].y, -R0.w;\n" - "MUL R5.xyz, R1.w, R2;\n" - "MUL R6.xyz, R5, R4;\n" - "RSQ R2.w, R3.x;\n" - "RCP R4.x, R2.w;\n" - "RSQ R2.w, R3.y;\n" - "RSQ R3.w, R3.z;\n" - "RCP R4.y, R2.w;\n" - "RCP R4.z, R3.w;\n" - "ADD R4.xyz, -R3, R4;\n" - "MUL R6.xyz, R3, R6;\n" - "MUL R4.xyz, R5, R4;\n" - "ADD R3.xyz, -R3, c[8].x;\n" - "MAD R2.xyz, R2, R3, R0.w;\n" - "MUL R3.xyz, R0, c[8].y;\n" - "MAD R5.xyz, R0.w, R1, R6;\n" - "MAD R4.xyz, R0.w, R1, R4;\n" - "ADD R6.xyz, R4, -R5;\n" - "MUL R4.xyz, R1, c[8].w;\n" - "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R6, R5;\n" - "MAD R4.xyz, -R1, R2, R4;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MUL R2.xyz, R1, R2;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R2.xyz, R3, R4, R2;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.x, -R0.w, c[8];\n" - "MAD R2.xyz, R1, R0.x, R2;\n" - "ADD R0.z, R0.w, R1.w;\n" - "MAD R2.w, -R0, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[6];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R2, -R1;\n" - "DP4 R0.x, R0, c[7];\n" - "MAD result.color, R0.x, R2, R1;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_DIFFERENCE = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 2D;\n" - "ADD R2.xyz, R1, R0;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R1.xyz, R1, R0.w;\n" - "MIN R1.xyz, R1, R3;\n" - "MAD R2.xyz, -R1, c[8].x, R2;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_EXCLUSION = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "TEX R1, R1, texture[2], 2D;\n" - "MUL R2.xyz, R1.w, R0;\n" - "MAD R3.xyz, R1, R0.w, R2;\n" - "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[8].x, R3;\n" - "ADD R2.w, -R0, c[8].y;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8].y;\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..6],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R1.xy, fragment.position, c[6];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R2.xyz, R1, c[4].y;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "MUL R3.xyz, R0.w, R2;\n" - "MUL R2.xyz, R0, c[4].x;\n" - "MAD R2.xyz, R1.w, R2, R3;\n" - "ADD R2.w, -R1, c[7].x;\n" - "MUL R0.xyz, R0, c[5].y;\n" - "MAD R0.xyz, R2.w, R0, R2;\n" - "ADD R2.x, -R0.w, c[7];\n" - "MUL R1.xyz, R1, c[5].z;\n" - "MAD result.color.xyz, R2.x, R1, R0;\n" - "MUL R0.x, R0.w, R1.w;\n" - "MUL R0.z, R1.w, R2.x;\n" - "MUL R0.y, R0.w, R2.w;\n" - "DP3 result.color.w, R0, c[5];\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_MULTIPLY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2.x, -R1.w, c[5];\n" - "MUL R2.xyz, R0, R2.x;\n" - "MAD R0.xyz, R0, R1, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5].x;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SCREEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..4] };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "ADD R2, R0, R1;\n" - "MAD result.color, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_OVERLAY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[5].y;\n" - "MUL R2.xyz, R2, c[5].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R3.xyz, R0, R2.w;\n" - "MUL R0.xyz, R0, R1;\n" - "ADD R2.w, -R0, c[5].y;\n" - "MAD R0.xyz, R0, c[5].x, R3;\n" - "MAD R0.xyz, R1, R2.w, R0;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "MUL R1.xyz, R1, c[5].x;\n" - "ADD R2.w, R0, R1;\n" - "ADD R2.xyz, R2, -R0;\n" - "SGE R1.xyz, R1, R1.w;\n" - "MAD result.color.xyz, R1, R2, R0;\n" - "MAD result.color.w, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_DARKEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5].x;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_LIGHTEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5].x;\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORDODGE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "MAX R1.x, R0.w, c[5].y;\n" - "RCP R1.x, R1.x;\n" - "MAD R3.xyz, -R0, R1.x, c[5].x;\n" - "MAX R3.xyz, R3, c[5].y;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.x, -R0.w, c[5];\n" - "MUL R2.xyz, R1, R2.x;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R1.xyz, R0.w, R1;\n" - "MAD R0.xyz, R0, R1.w, R1;\n" - "MUL R2.w, R0, R1;\n" - "RCP R3.x, R3.x;\n" - "RCP R3.y, R3.y;\n" - "RCP R3.z, R3.z;\n" - "MAD R3.xyz, R1, R3, R2;\n" - "MAD R2.xyz, R0.w, R1.w, R2;\n" - "ADD R1.x, R0.w, R1.w;\n" - "ADD R2.xyz, R2, -R3;\n" - "SGE R0.xyz, R0, R2.w;\n" - "MAD result.color.xyz, R0, R2, R3;\n" - "MAD result.color.w, -R0, R1, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORBURN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R2.xyz, -R0.w, R1.w, R3;\n" - "MUL R4.xyz, R0.w, R2;\n" - "MAX R2.xyz, R0, c[5].y;\n" - "MUL R5.xyz, R0, R2.w;\n" - "ADD R3.w, -R0, c[5].x;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R4, R2, R5;\n" - "MUL R4.xyz, R1, R3.w;\n" - "MAD R1.xyz, R1, R3.w, R2;\n" - "MAD R0.xyz, R0, R2.w, R4;\n" - "MUL R2.x, R0.w, R1.w;\n" - "ADD R2.w, R0, R1;\n" - "ADD R1.xyz, R1, -R0;\n" - "SGE R2.xyz, R3, R2.x;\n" - "MAD result.color.xyz, R2, R1, R0;\n" - "MAD result.color.w, -R0, R1, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_HARDLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "ADD R2.w, -R1, c[5].y;\n" - "ADD R3.xyz, R0.w, -R0;\n" - "ADD R2.xyz, R1.w, -R1;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[5].x;\n" - "MAD R2.xyz, R0.w, R1.w, -R2;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R4.xyz, R0, R2.w;\n" - "MUL R3.xyz, R0, R1;\n" - "MUL R0.xyz, R0, c[5].x;\n" - "ADD R2.w, -R0, c[5].y;\n" - "MAD R3.xyz, R3, c[5].x, R4;\n" - "MAD R3.xyz, R1, R2.w, R3;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R1.xyz, R1, -R3;\n" - "SGE R0.xyz, R0, R0.w;\n" - "MAD result.color.xyz, R0, R1, R3;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..4],\n" - " { 1, 2, 9.9999997e-006, 4 },\n" - " { 16, 12, 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MUL R1.xy, fragment.position, c[4];\n" - "TEX R1, R1, texture[0], 2D;\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MAX R0.w, R1, c[5].z;\n" - "RCP R0.w, R0.w;\n" - "MUL R3.xyz, R1, R0.w;\n" - "MAD R2.xyz, R3, c[6].x, -c[6].y;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "MAD R4.xyz, R3, R2, c[6].z;\n" - "MAD R2.xyz, R0, c[5].y, -R0.w;\n" - "MUL R5.xyz, R1.w, R2;\n" - "MUL R6.xyz, R5, R4;\n" - "RSQ R2.w, R3.x;\n" - "RCP R4.x, R2.w;\n" - "RSQ R2.w, R3.y;\n" - "RSQ R3.w, R3.z;\n" - "RCP R4.y, R2.w;\n" - "RCP R4.z, R3.w;\n" - "ADD R4.xyz, -R3, R4;\n" - "MUL R6.xyz, R3, R6;\n" - "MUL R4.xyz, R5, R4;\n" - "ADD R3.xyz, -R3, c[5].x;\n" - "MAD R2.xyz, R2, R3, R0.w;\n" - "MUL R3.xyz, R0, c[5].y;\n" - "MAD R5.xyz, R0.w, R1, R6;\n" - "MAD R4.xyz, R0.w, R1, R4;\n" - "ADD R6.xyz, R4, -R5;\n" - "MUL R4.xyz, R1, c[5].w;\n" - "SGE R4.xyz, R4, R1.w;\n" - "MAD R4.xyz, R4, R6, R5;\n" - "MAD R4.xyz, -R1, R2, R4;\n" - "MUL R2.xyz, R1, R2;\n" - "SGE R3.xyz, R3, R0.w;\n" - "MAD R2.xyz, R3, R4, R2;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R0.x, R0.w, R1.w;\n" - "ADD R0.y, -R0.w, c[5].x;\n" - "MAD result.color.xyz, R1, R0.y, R2;\n" - "MAD result.color.w, -R0, R1, R0.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_DIFFERENCE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "MUL R2.xyz, R0, R1.w;\n" - "MUL R3.xyz, R0.w, R1;\n" - "ADD R0.xyz, R0, R1;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R1.x, R0.w, R1.w;\n" - "MAD result.color.xyz, -R2, c[5].x, R0;\n" - "MAD result.color.w, -R0, R1, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_EXCLUSION_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R1, R0.zwzw, texture[0], 2D;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0, R0, texture[1], 2D;\n" - "MUL R2.xyz, R0.w, R1;\n" - "MAD R3.xyz, R0, R1.w, R2;\n" - "MUL R2.xyz, R0, R1;\n" - "MAD R2.xyz, -R2, c[5].x, R3;\n" - "ADD R2.w, -R1, c[5].y;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R0.w, R1.w;\n" - "ADD R2.y, -R0.w, c[5];\n" - "MAD result.color.xyz, R1, R2.y, R0;\n" - "MAD result.color.w, -R0, R1, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODE_BLEND_MODE_MASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..6] };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R1.xyz, R0, c[3];\n" - "RCP R0.z, R1.z;\n" - "MUL R1.xy, R1, R0.z;\n" - "ADD R0.xy, fragment.position, c[5];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" - "DP4 R1.z, R0, c[6];\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R0, R1, texture[1], 2D;\n" - "MUL result.color, R0, R1.z;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODE_BLEND_MODE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[4] = { program.local[0..3] };\n" - "TEMP R0;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX result.color, R0, texture[0], 2D;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SIMPLE_PORTER_DUFF = - "!!ARBfp1.0\n" - "PARAM c[11] = { program.local[0..9],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[7];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, -R1, c[10];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R2.xyz, R0, c[4].y;\n" - "MUL R3.xyz, R1.w, R2;\n" - "MUL R2.xyz, R1, c[4].x;\n" - "MAD R2.xyz, R0.w, R2, R3;\n" - "ADD R3.xy, fragment.position, c[8];\n" - "ADD R2.w, -R0, c[10].x;\n" - "MUL R1.xyz, R1, c[5].y;\n" - "MAD R2.xyz, R2.w, R1, R2;\n" - "MUL R1.xyz, R0, c[5].z;\n" - "ADD R3.z, -R1.w, c[10].x;\n" - "MAD R2.xyz, R3.z, R1, R2;\n" - "MUL R1.y, R1.w, R2.w;\n" - "MUL R1.x, R1.w, R0.w;\n" - "MUL R1.z, R0.w, R3;\n" - "DP3 R2.w, R1, c[5];\n" - "MUL R3.xy, R3, c[6];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[9];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_MULTIPLY = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, -R1, c[8];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "ADD R2.x, -R0.w, c[8];\n" - "MUL R2.xyz, R1, R2.x;\n" - "MAD R1.xyz, R1, R0, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SCREEN = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "ADD R0.z, -R0.x, c[8].x;\n" - "ADD R3.xy, fragment.position, c[6];\n" - "MUL R1, fragment.color.primary, R0.z;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R2, R1, R0;\n" - "MAD R2, -R1, R0, R2;\n" - "MUL R3.xy, R3, c[4];\n" - "TEX R1, R3, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_OVERLAY = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "ADD R0.x, -R0, c[8];\n" - "MUL R1, fragment.color.primary, R0.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R2.w, -R0, c[8].x;\n" - "ADD R3.xyz, R1.w, -R1;\n" - "ADD R2.xyz, R0.w, -R0;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[8].y;\n" - "MAD R2.xyz, R1.w, R0.w, -R2;\n" - "MUL R4.xyz, R1, R2.w;\n" - "MUL R3.xyz, R1, R0;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R3.xyz, R3, c[8].y, R4;\n" - "MAD R3.xyz, R0, R2.x, R3;\n" - "MAD R1.xyz, R0, R2.x, R1;\n" - "MUL R2.xyz, R0, c[8].y;\n" - "ADD R1.xyz, R1, -R3;\n" - "SGE R2.xyz, R2, R0.w;\n" - "MAD R2.xyz, R2, R1, R3;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DARKEN = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, -R1, c[8];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_LIGHTEN = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, -R1, c[8];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORDODGE = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "ADD R0.x, -R0, c[8];\n" - "MUL R1, fragment.color.primary, R0.x;\n" - "MAX R0.x, R1.w, c[8].y;\n" - "RCP R0.x, R0.x;\n" - "MAD R2.xyz, -R1, R0.x, c[8].x;\n" - "MAX R2.xyz, R2, c[8].y;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MUL R3.xyz, R0, R2.w;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R4.xyz, R1, R2.w, R3;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.w, R1, R0;\n" - "MAD R1.xyz, R1, R0.w, R3;\n" - "SGE R1.xyz, R1, R2.w;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R3, R2, R4;\n" - "MAD R4.xyz, R1.w, R0.w, R4;\n" - "ADD R4.xyz, R4, -R2;\n" - "MAD R2.xyz, R1, R4, R2;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORBURN = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "ADD R1.x, -R0, c[8];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "MUL R2.xyz, R1.w, R0;\n" - "MAD R3.xyz, R1, R0.w, R2;\n" - "MAD R2.xyz, -R1.w, R0.w, R3;\n" - "MUL R4.xyz, R1.w, R2;\n" - "MAX R2.xyz, R1, c[8].y;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MUL R5.xyz, R1, R2.w;\n" - "ADD R3.w, -R1, c[8].x;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R4, R2, R5;\n" - "MUL R4.xyz, R0, R3.w;\n" - "MAD R1.xyz, R1, R2.w, R4;\n" - "MUL R2.w, R1, R0;\n" - "MAD R2.xyz, R0, R3.w, R2;\n" - "ADD R2.xyz, R2, -R1;\n" - "SGE R3.xyz, R3, R2.w;\n" - "MAD R2.xyz, R3, R2, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_HARDLIGHT = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[2], 2D;\n" - "ADD R0.x, -R0, c[8];\n" - "MUL R1, fragment.color.primary, R0.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R2.w, -R0, c[8].x;\n" - "ADD R3.xyz, R1.w, -R1;\n" - "ADD R2.xyz, R0.w, -R0;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[8].y;\n" - "MAD R2.xyz, R1.w, R0.w, -R2;\n" - "MUL R4.xyz, R1, R2.w;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "MUL R3.xyz, R1, R0;\n" - "ADD R2.w, -R1, c[8].x;\n" - "MAD R3.xyz, R3, c[8].y, R4;\n" - "MUL R1.xyz, R1, c[8].y;\n" - "SGE R1.xyz, R1, R1.w;\n" - "MAD R3.xyz, R0, R2.w, R3;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "ADD R2.xyz, R2, -R3;\n" - "MAD R2.xyz, R1, R2, R3;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT = - "!!ARBfp1.0\n" - "PARAM c[10] = { program.local[0..7],\n" - " { 1, 2, 9.9999997e-006, 4 },\n" - " { 16, 12, 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R1.xyz, R0, c[3];\n" - "RCP R1.z, R1.z;\n" - "MUL R1.xy, R1, R1.z;\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1.x, R1, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.z, R0.w, c[8];\n" - "RCP R1.z, R1.z;\n" - "MUL R3.xyz, R0, R1.z;\n" - "MAD R2.xyz, R3, c[9].x, -c[9].y;\n" - "ADD R1.x, -R1, c[8];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MAD R4.xyz, R3, R2, c[9].z;\n" - "MAD R2.xyz, R1, c[8].y, -R1.w;\n" - "MUL R5.xyz, R0.w, R2;\n" - "MUL R6.xyz, R5, R4;\n" - "RSQ R2.w, R3.x;\n" - "RCP R4.x, R2.w;\n" - "RSQ R2.w, R3.y;\n" - "RSQ R3.w, R3.z;\n" - "RCP R4.y, R2.w;\n" - "RCP R4.z, R3.w;\n" - "ADD R4.xyz, -R3, R4;\n" - "MUL R6.xyz, R3, R6;\n" - "MUL R4.xyz, R5, R4;\n" - "ADD R3.xyz, -R3, c[8].x;\n" - "MAD R2.xyz, R2, R3, R1.w;\n" - "MUL R3.xyz, R1, c[8].y;\n" - "MAD R5.xyz, R1.w, R0, R6;\n" - "MAD R4.xyz, R1.w, R0, R4;\n" - "ADD R6.xyz, R4, -R5;\n" - "MUL R4.xyz, R0, c[8].w;\n" - "SGE R4.xyz, R4, R0.w;\n" - "MAD R4.xyz, R4, R6, R5;\n" - "MAD R4.xyz, -R0, R2, R4;\n" - "SGE R3.xyz, R3, R1.w;\n" - "MUL R2.xyz, R0, R2;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R2.xyz, R3, R4, R2;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "ADD R1.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R1.x, R2;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DIFFERENCE = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "ADD R1.x, -R1, c[8];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "ADD R2.xyz, R1, R0;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R1.xyz, R1, R0.w;\n" - "MIN R1.xyz, R1, R3;\n" - "MAD R2.xyz, -R1, c[8].y, R2;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_EXCLUSION = - "!!ARBfp1.0\n" - "PARAM c[9] = { program.local[0..7],\n" - " { 1, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[5];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R1.x, -R1, c[8];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R2.xyz, R1.w, R0;\n" - "MAD R3.xyz, R1, R0.w, R2;\n" - "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[8].y, R3;\n" - "ADD R2.w, -R0, c[8].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8];\n" - "MAD R2.xyz, R0, R2.x, R1;\n" - "ADD R1.z, R1.w, R0.w;\n" - "MAD R2.w, -R1, R0, R1.z;\n" - "ADD R1.xy, fragment.position, c[6];\n" - "MUL R1.xy, R1, c[4];\n" - "TEX R1, R1, texture[1], 2D;\n" - "ADD R2, R2, -R0;\n" - "DP4 R1.x, R1, c[7];\n" - "MAD result.color, R1.x, R2, R0;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..6],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" - "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "MUL R2.xyz, R0, c[4].y;\n" - "ADD R1.x, -R1, c[7];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R3.xyz, R1.w, R2;\n" - "MUL R2.xyz, R1, c[4].x;\n" - "MUL R0.xyz, R0, c[5].z;\n" - "MAD R2.xyz, R0.w, R2, R3;\n" - "ADD R2.w, -R0, c[7].x;\n" - "MUL R1.xyz, R1, c[5].y;\n" - "MAD R1.xyz, R2.w, R1, R2;\n" - "ADD R2.x, -R1.w, c[7];\n" - "MAD result.color.xyz, R2.x, R0, R1;\n" - "MUL R0.x, R1.w, R0.w;\n" - "MUL R0.z, R0.w, R2.x;\n" - "MUL R0.y, R1.w, R2.w;\n" - "DP3 result.color.w, R0, c[5];\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_MULTIPLY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R1.x, -R1, c[5];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "ADD R2.x, -R0.w, c[5];\n" - "MUL R2.xyz, R1, R2.x;\n" - "MAD R1.xyz, R1, R0, R2;\n" - "ADD R2.x, R1.w, R0.w;\n" - "ADD R2.y, -R1.w, c[5].x;\n" - "MAD result.color.xyz, R0, R2.y, R1;\n" - "MAD result.color.w, -R1, R0, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SCREEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[1], 2D;\n" - "ADD R1.x, -R0, c[5];\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "ADD R2, R1, R0;\n" - "MAD result.color, -R1, R0, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_OVERLAY_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[1], 2D;\n" - "ADD R0.x, -R0, c[5];\n" - "MUL R1, fragment.color.primary, R0.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R3.xyz, R1.w, -R1;\n" - "ADD R2.xyz, R0.w, -R0;\n" - "MUL R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[5].x;\n" - "MUL R2.xyz, R2, c[5].y;\n" - "MAD R2.xyz, R1.w, R0.w, -R2;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "MUL R3.xyz, R1, R2.w;\n" - "MUL R1.xyz, R1, R0;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R1.xyz, R1, c[5].y, R3;\n" - "MAD R1.xyz, R0, R2.w, R1;\n" - "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R0.xyz, R0, c[5].y;\n" - "ADD R2.w, R1, R0;\n" - "ADD R2.xyz, R2, -R1;\n" - "SGE R0.xyz, R0, R0.w;\n" - "MAD result.color.xyz, R0, R2, R1;\n" - "MAD result.color.w, -R1, R0, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DARKEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[1], 2D;\n" - "ADD R1.x, -R0, c[5];\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[5].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, R1.w, R0.w;\n" - "ADD R2.y, -R1.w, c[5].x;\n" - "MAD result.color.xyz, R0, R2.y, R1;\n" - "MAD result.color.w, -R1, R0, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_LIGHTEN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[1], 2D;\n" - "ADD R1.x, -R0, c[5];\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R2.xyz, R1, R0.w;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MAX R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[5].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, R1.w, R0.w;\n" - "ADD R2.y, -R1.w, c[5].x;\n" - "MAD result.color.xyz, R0, R2.y, R1;\n" - "MAD result.color.w, -R1, R0, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORDODGE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1, 1e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[1], 2D;\n" - "ADD R0.x, -R0, c[5];\n" - "MUL R1, fragment.color.primary, R0.x;\n" - "MAX R0.x, R1.w, c[5].y;\n" - "RCP R0.x, R0.x;\n" - "MAD R3.xyz, -R1, R0.x, c[5].x;\n" - "MAX R3.xyz, R3, c[5].y;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" - "ADD R2.x, -R1.w, c[5];\n" - "MUL R2.xyz, R0, R2.x;\n" - "ADD R2.w, -R0, c[5].x;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "MUL R0.xyz, R1.w, R0;\n" - "RCP R3.x, R3.x;\n" - "RCP R3.y, R3.y;\n" - "RCP R3.z, R3.z;\n" - "MAD R3.xyz, R0, R3, R2;\n" - "MAD R0.xyz, R1, R0.w, R0;\n" - "MAD R2.xyz, R1.w, R0.w, R2;\n" - "MUL R2.w, R1, R0;\n" - "ADD R1.x, R1.w, R0.w;\n" - "ADD R2.xyz, R2, -R3;\n" - "SGE R0.xyz, R0, R2.w;\n" - "MAD result.color.xyz, R0, R2, R3;\n" - "MAD result.color.w, -R1, R0, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORBURN_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1, 9.9999997e-006 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[1], 2D;\n" - "ADD R1.x, -R0, c[5];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "MUL R2.xyz, R1.w, R0;\n" - "MAD R3.xyz, R1, R0.w, R2;\n" - "ADD R2.w, -R0, c[5].x;\n" - "MAD R2.xyz, -R1.w, R0.w, R3;\n" - "MUL R4.xyz, R1.w, R2;\n" - "MAX R2.xyz, R1, c[5].y;\n" - "MUL R5.xyz, R1, R2.w;\n" - "ADD R3.w, -R1, c[5].x;\n" - "RCP R2.x, R2.x;\n" - "RCP R2.y, R2.y;\n" - "RCP R2.z, R2.z;\n" - "MAD R2.xyz, R4, R2, R5;\n" - "MUL R4.xyz, R0, R3.w;\n" - "MAD R0.xyz, R0, R3.w, R2;\n" - "MAD R1.xyz, R1, R2.w, R4;\n" - "MUL R2.x, R1.w, R0.w;\n" - "ADD R2.w, R1, R0;\n" - "ADD R0.xyz, R0, -R1;\n" - "SGE R2.xyz, R3, R2.x;\n" - "MAD result.color.xyz, R2, R0, R1;\n" - "MAD result.color.w, -R1, R0, R2;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_HARDLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[1], 2D;\n" - "ADD R0.x, -R0, c[5];\n" - "MUL R1, fragment.color.primary, R0.x;\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R2.w, -R0, c[5].x;\n" - "ADD R3.xyz, R1.w, -R1;\n" - "ADD R2.xyz, R0.w, -R0;\n" - "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[5].y;\n" - "MAD R2.xyz, R1.w, R0.w, -R2;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "MUL R4.xyz, R1, R2.w;\n" - "MUL R3.xyz, R1, R0;\n" - "MUL R1.xyz, R1, c[5].y;\n" - "ADD R2.w, -R1, c[5].x;\n" - "MAD R3.xyz, R3, c[5].y, R4;\n" - "MAD R3.xyz, R0, R2.w, R3;\n" - "MAD R0.xyz, R0, R2.w, R2;\n" - "ADD R2.x, R1.w, R0.w;\n" - "ADD R0.xyz, R0, -R3;\n" - "SGE R1.xyz, R1, R1.w;\n" - "MAD result.color.xyz, R1, R0, R3;\n" - "MAD result.color.w, -R1, R0, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..4],\n" - " { 1, 2, 9.9999997e-006, 4 },\n" - " { 16, 12, 3 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "TEMP R4;\n" - "TEMP R5;\n" - "TEMP R6;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R1.xyz, R0, c[3];\n" - "RCP R1.z, R1.z;\n" - "MUL R1.xy, R1, R1.z;\n" - "MUL R1.xy, R1, c[0];\n" - "TEX R1.x, R1, texture[1], 2D;\n" - "MUL R0.xy, fragment.position, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.z, R0.w, c[5];\n" - "RCP R1.z, R1.z;\n" - "MUL R3.xyz, R0, R1.z;\n" - "MAD R2.xyz, R3, c[6].x, -c[6].y;\n" - "ADD R1.x, -R1, c[5];\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MAD R4.xyz, R3, R2, c[6].z;\n" - "MAD R2.xyz, R1, c[5].y, -R1.w;\n" - "MUL R5.xyz, R0.w, R2;\n" - "MUL R6.xyz, R5, R4;\n" - "RSQ R2.w, R3.x;\n" - "RCP R4.x, R2.w;\n" - "RSQ R2.w, R3.y;\n" - "RSQ R3.w, R3.z;\n" - "RCP R4.y, R2.w;\n" - "RCP R4.z, R3.w;\n" - "ADD R4.xyz, -R3, R4;\n" - "MUL R6.xyz, R3, R6;\n" - "MUL R4.xyz, R5, R4;\n" - "ADD R3.xyz, -R3, c[5].x;\n" - "MAD R2.xyz, R2, R3, R1.w;\n" - "MUL R3.xyz, R1, c[5].y;\n" - "MAD R5.xyz, R1.w, R0, R6;\n" - "MAD R4.xyz, R1.w, R0, R4;\n" - "ADD R6.xyz, R4, -R5;\n" - "MUL R4.xyz, R0, c[5].w;\n" - "SGE R4.xyz, R4, R0.w;\n" - "MAD R4.xyz, R4, R6, R5;\n" - "MAD R4.xyz, -R0, R2, R4;\n" - "MUL R2.xyz, R0, R2;\n" - "SGE R3.xyz, R3, R1.w;\n" - "MAD R2.xyz, R3, R4, R2;\n" - "ADD R2.w, -R0, c[5].x;\n" - "MAD R2.xyz, R1, R2.w, R2;\n" - "ADD R1.x, R1.w, R0.w;\n" - "ADD R1.y, -R1.w, c[5].x;\n" - "MAD result.color.xyz, R0, R1.y, R2;\n" - "MAD result.color.w, -R1, R0, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DIFFERENCE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[1], 2D;\n" - "ADD R1.x, -R0, c[5];\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R3.xyz, R1.w, R0;\n" - "MUL R2.xyz, R1, R0.w;\n" - "ADD R0.xyz, R1, R0;\n" - "MIN R2.xyz, R2, R3;\n" - "ADD R1.x, R1.w, R0.w;\n" - "MAD result.color.xyz, -R2, c[5].y, R0;\n" - "MAD result.color.w, -R1, R0, R1.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_EXCLUSION_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[6] = { program.local[0..4],\n" - " { 1, 2 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "TEMP R2;\n" - "TEMP R3;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[1], 2D;\n" - "ADD R1.x, -R0, c[5];\n" - "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" - "TEX R0, R0.zwzw, texture[0], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" - "MUL R2.xyz, R1.w, R0;\n" - "MAD R3.xyz, R1, R0.w, R2;\n" - "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[5].y, R3;\n" - "ADD R2.w, -R0, c[5].x;\n" - "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, R1.w, R0.w;\n" - "ADD R2.y, -R1.w, c[5].x;\n" - "MAD result.color.xyz, R0, R2.y, R1;\n" - "MAD result.color.w, -R1, R0, R2.x;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODE_BLEND_MODE_MASK = - "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..6],\n" - " { 1 } };\n" - "TEMP R0;\n" - "TEMP R1;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R0.zw, R0, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[1], 2D;\n" - "ADD R0.xy, fragment.position, c[5];\n" - "MUL R0.xy, R0, c[4];\n" - "TEX R0, R0, texture[0], 2D;\n" - "DP4 R1.y, R0, c[6];\n" - "ADD R1.x, -R1, c[7];\n" - "MUL R0, fragment.color.primary, R1.x;\n" - "MUL result.color, R0, R1.y;\n" - "END\n" - ; - -static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODE_BLEND_MODE_NOMASK = - "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..3],\n" - " { 1 } };\n" - "TEMP R0;\n" - "MUL R0.xyz, fragment.position.y, c[2];\n" - "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R0.xyz, R0, c[3];\n" - "RCP R0.z, R0.z;\n" - "MUL R0.xy, R0, R0.z;\n" - "MUL R0.xy, R0, c[0];\n" - "TEX R0.x, R0, texture[0], 2D;\n" - "ADD R0.x, -R0, c[4];\n" - "MUL result.color, fragment.color.primary, R0.x;\n" - "END\n" - ; - -static const char *mask_fragment_program_sources[num_fragment_masks] = { - FragmentProgram_FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA, - FragmentProgram_FRAGMENT_PROGRAM_MASK_ELLIPSE_AA, -}; - -static const char *painter_fragment_program_sources[num_fragment_brushes][num_fragment_composition_modes] = { - { - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SIMPLE_PORTER_DUFF, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_MULTIPLY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SCREEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_OVERLAY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_DARKEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_LIGHTEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORDODGE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORBURN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_HARDLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_DIFFERENCE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_EXCLUSION, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_MULTIPLY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SCREEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_OVERLAY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_DARKEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_LIGHTEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORDODGE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_COLORBURN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_HARDLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_SOFTLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_DIFFERENCE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODES_EXCLUSION_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE_BLEND_MODE_MASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_SOLID_COMPOSITION_MODE_BLEND_MODE_NOMASK, - }, - { - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_MULTIPLY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SCREEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_OVERLAY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DARKEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_LIGHTEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORDODGE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORBURN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_HARDLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SOFTLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DIFFERENCE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_EXCLUSION, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_MULTIPLY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SCREEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_OVERLAY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DARKEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_LIGHTEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORDODGE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_COLORBURN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_HARDLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_SOFTLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_DIFFERENCE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODES_EXCLUSION_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODE_BLEND_MODE_MASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_RADIAL_COMPOSITION_MODE_BLEND_MODE_NOMASK, - }, - { - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_MULTIPLY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SCREEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_OVERLAY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DARKEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_LIGHTEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORDODGE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORBURN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_HARDLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DIFFERENCE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_EXCLUSION, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_MULTIPLY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SCREEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_OVERLAY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DARKEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_LIGHTEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORDODGE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_COLORBURN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_HARDLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_SOFTLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_DIFFERENCE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODES_EXCLUSION_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODE_BLEND_MODE_MASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_CONICAL_COMPOSITION_MODE_BLEND_MODE_NOMASK, - }, - { - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SIMPLE_PORTER_DUFF, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_MULTIPLY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SCREEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_OVERLAY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_DARKEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_LIGHTEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORDODGE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORBURN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_HARDLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_DIFFERENCE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_EXCLUSION, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_MULTIPLY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SCREEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_OVERLAY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_DARKEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_LIGHTEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORDODGE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_COLORBURN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_HARDLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_SOFTLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_DIFFERENCE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODES_EXCLUSION_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODE_BLEND_MODE_MASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_LINEAR_COMPOSITION_MODE_BLEND_MODE_NOMASK, - }, - { - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SIMPLE_PORTER_DUFF, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_MULTIPLY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SCREEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_OVERLAY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_DARKEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_LIGHTEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORDODGE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORBURN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_HARDLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_DIFFERENCE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_EXCLUSION, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_MULTIPLY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SCREEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_OVERLAY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_DARKEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_LIGHTEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORDODGE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_COLORBURN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_HARDLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_SOFTLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_DIFFERENCE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODES_EXCLUSION_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODE_BLEND_MODE_MASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_TEXTURE_COMPOSITION_MODE_BLEND_MODE_NOMASK, - }, - { - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SIMPLE_PORTER_DUFF, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_MULTIPLY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SCREEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_OVERLAY, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DARKEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_LIGHTEN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORDODGE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORBURN, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_HARDLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DIFFERENCE, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_EXCLUSION, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SIMPLE_PORTER_DUFF_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_MULTIPLY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SCREEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_OVERLAY_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DARKEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_LIGHTEN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORDODGE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_COLORBURN_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_HARDLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SOFTLIGHT_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DIFFERENCE_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_EXCLUSION_NOMASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODE_BLEND_MODE_MASK, - FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODE_BLEND_MODE_NOMASK, - }, -}; - -static int painter_variable_locations[num_fragment_brushes][num_fragment_composition_modes][num_fragment_variables] = { - { - { -1, -1, -1, 2, -1, 0, 5, -1, 1, 3, 1, 0, -1, 4, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 3, -1, -1, 1, 1, 0, -1, 2, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, 0, -1, -1, 1, 2, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, 0, -1, -1, 2, -1, -1, -1, 0, -1, -1, 1, -1, -1, -1, -1, -1, }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - }, - { - { -1, -1, 3, 7, 4, 5, 10, -1, 6, 8, 1, 0, 2, 9, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 8, -1, -1, 6, 1, 0, 2, 7, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, 5, -1, -1, 6, 7, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, 5, -1, 0, 1, -1, -1, 1, 0, 2, -1, }, - { -1, -1, 3, 5, 4, -1, 7, -1, -1, -1, 0, -1, 1, 6, -1, 1, 0, 2, -1, }, - { -1, -1, 3, -1, 4, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 1, 0, 2, -1, }, - }, - { - { -1, -1, 2, 6, 3, 4, 9, -1, 5, 7, 1, 0, 2, 8, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, 4, -1, -1, 5, 6, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, 0, }, - { -1, -1, 2, 4, 3, -1, 6, -1, -1, -1, 0, -1, 1, 5, -1, -1, -1, 1, 0, }, - { -1, -1, 2, -1, 3, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 1, 0, }, - }, - { - { -1, 0, 2, 6, 3, 4, 9, -1, 5, 7, 1, 0, 2, 8, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, 2, 6, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, 4, -1, -1, 5, 6, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, 1, -1, -1, -1, -1, 1, -1, }, - { -1, 0, 2, 4, 3, -1, 6, -1, -1, -1, 0, -1, 1, 5, -1, -1, -1, 1, -1, }, - { -1, 0, 2, -1, 3, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 1, -1, }, - }, - { - { 2, -1, 2, 6, 3, 4, 9, -1, 5, 7, 1, 0, -1, 8, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, 4, -1, -1, 5, 6, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, 4, 3, -1, 6, -1, -1, -1, 0, -1, -1, 5, 0, -1, -1, 1, -1, }, - { 0, -1, 2, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 1, -1, }, - }, - { - { 2, -1, 2, 6, 3, 4, 9, -1, 5, 7, 1, 0, -1, 8, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 2, -1, 2, 4, 3, -1, 7, -1, -1, 5, 1, 0, -1, 6, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, 4, -1, -1, 5, 6, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, -1, 3, -1, -1, -1, -1, 4, -1, 0, -1, -1, 0, -1, -1, 1, -1, }, - { 1, -1, 2, 4, 3, -1, 6, -1, -1, -1, 0, -1, -1, 5, 0, -1, -1, 1, -1, }, - { 0, -1, 2, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 1, -1, }, - }, -}; - -static int mask_variable_locations[num_fragment_masks][num_fragment_variables] = { - { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { -1, -1, 1, -1, 2, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, }, -}; - -#endif diff --git a/src/opengl/util/generator.cpp b/src/opengl/util/generator.cpp deleted file mode 100644 index 3d124468425..00000000000 --- a/src/opengl/util/generator.cpp +++ /dev/null @@ -1,500 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -QT_USE_NAMESPACE - -#define TAB " " - -typedef QPair QStringPair; - -QString readSourceFile(const QString &sourceFile, bool fragmentProgram = false) -{ - QFile file(sourceFile); - - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qDebug() << "Missing source file" << sourceFile; - exit(0); - } - - QString source; - - QTextStream in(&file); - while (!in.atEnd()) { - QString line = in.readLine(); - - if (fragmentProgram && line[0] == '#' && !line.startsWith("#var")) - continue; - - if (fragmentProgram) - source.append(" \""); - - source.append(line); - - if (fragmentProgram) - source.append("\\n\""); - - source.append('\n'); - } - - if (fragmentProgram) - source.append(" ;\n"); - - return source; -} - -QList readConf(const QString &confFile) -{ - QFile file(confFile); - - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - qDebug() << "Missing file" << confFile; - exit(0); - } - - QList result; - - QTextStream in(&file); - while (!in.atEnd()) { - QString line = in.readLine(); - - if (line.startsWith('#')) - continue; - - QTextStream lineStream(&line); - - QString enumerator; - QString sourceFile; - - lineStream >> enumerator; - - if (lineStream.atEnd()) { - qDebug() << "Error in file" << confFile << '(' << enumerator << ')'; - exit(0); - } - - lineStream >> sourceFile; - - result << QStringPair(enumerator, readSourceFile(sourceFile)); - } - - return result; -} - -QString compileSource(const QString &source) -{ - { - QFile tempSourceFile("__tmp__.glsl"); - if (!tempSourceFile.open(QIODevice::WriteOnly | QIODevice::Text)) { - qDebug() << "Failed opening __tmp__.glsl"; - exit(0); - } - - QTextStream out(&tempSourceFile); - out << source; - } - - if (std::system("cgc -quiet -oglsl -profile arbfp1 __tmp__.glsl >__tmp__.frag") == -1) { - qDebug() << "Failed running cgc"; - exit(0); - } - - return readSourceFile("__tmp__.frag", true); -} - -QString getWord(QString line, int word) -{ - QTextStream in(&line); - - QString result; - - for (int i = 0; i < word; ++i) - in >> result; - - return result; -} - -static int toInt(const QByteArray &str) -{ - int value = 0; - - for (int i = 0; i < str.size(); ++i) { - if (str[i] < '0' || str[i] > '9') - break; - - value *= 10; - value += (str[i] - '0'); - } - - return value; -} -QList getLocations(const QSet &variables, QString source) -{ - QTextStream in(&source); - - QMap locations; - - foreach (QString variable, variables) - locations[variable] = -1; - - while (!in.atEnd()) { - QString line = in.readLine().trimmed(); - - line = line.right(line.size() - 1); - - if (line.startsWith("#var")) { - QByteArray temp; - QByteArray name; - - QTextStream lineStream(&line); - - lineStream >> temp >> temp >> name; - - int location = -1; - - while (!lineStream.atEnd()) { - lineStream >> temp; - - if (temp.startsWith("c[")) { - location = toInt(temp.right(temp.size() - 2)); - break; - } - - if (temp == "texunit") { - lineStream >> temp; - location = toInt(temp); - break; - } - } - - locations[name] = location; - } - } - - QList result; - - foreach (QString variable, variables) - result << locations[variable]; - - return result; -} - -// remove #var statements -QString trimmed(QString source) -{ - QTextStream in(&source); - - QString result; - - while (!in.atEnd()) { - QString line = in.readLine(); - if (!line.trimmed().startsWith("\"#")) - result += line + '\n'; - } - - return result; -} - -void writeVariablesEnum(QTextStream &out, const char *name, const QSet &s) -{ - out << "enum " << name << " {"; - QSet::const_iterator it = s.begin(); - if (it != s.end()) { - out << "\n" TAB "VAR_" << it->toUpper(); - for (++it; it != s.end(); ++it) - out << ",\n" TAB "VAR_" << it->toUpper(); - } - out << "\n};\n\n"; -} - -void writeTypesEnum(QTextStream &out, const char *name, const QList &s) -{ - out << "enum " << name << " {"; - QList::const_iterator it = s.begin(); - if (it != s.end()) { - out << "\n" TAB << it->first; - for (++it; it != s.end(); ++it) - out << ",\n" TAB << it->first; - } - out << "\n};\n\n"; -} - -void writeIncludeFile(const QSet &variables, - const QList &brushes, - const QList &compositionModes, - const QList &masks, - const QMap > &compiled) -{ - QFile includeFile("fragmentprograms_p.h"); - if (!includeFile.open(QIODevice::WriteOnly | QIODevice::Text)) { - qDebug() << "Failed opening fragmentprograms_p.h"; - exit(0); - } - - QTextStream out(&includeFile); - - QLatin1String tab(TAB); - - out << "/****************************************************************************\n" - "**\n" - "** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).\n" - "** All rights reserved.\n" - "** Contact: Nokia Corporation (qt-info@nokia.com)\n" - "**\n" - "** This file is part of the QtOpenGL module of the Qt Toolkit.\n" - "**\n" - "** $QT_BEGIN_LICENSE:LGPL$\n" - "** GNU Lesser General Public License Usage\n" - "** This file may be used under the terms of the GNU Lesser General Public\n" - "** License version 2.1 as published by the Free Software Foundation and\n" - "** appearing in the file LICENSE.LGPL included in the packaging of this\n" - "** file. Please review the following information to ensure the GNU Lesser\n" - "** General Public License version 2.1 requirements will be met:\n" - "** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\n" - "**\n" - "** In addition, as a special exception, Nokia gives you certain additional\n" - "** rights. These rights are described in the Nokia Qt LGPL Exception\n" - "** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.\n" - "**\n" - "** GNU General Public License Usage\n" - "** Alternatively, this file may be used under the terms of the GNU General\n" - "** Public License version 3.0 as published by the Free Software Foundation\n" - "** and appearing in the file LICENSE.GPL included in the packaging of this\n" - "** file. Please review the following information to ensure the GNU General\n" - "** Public License version 3.0 requirements will be met:\n" - "** http://www.gnu.org/copyleft/gpl.html.\n" - "**\n" - "** Other Usage\n" - "** Alternatively, this file may be used in accordance with the terms and\n" - "** conditions contained in a signed written agreement between you and Nokia.\n" - "**\n" - "**\n" - "**\n" - "**\n" - "**\n" - "** $QT_END_LICENSE$\n" - "**\n" - "****************************************************************************/\n" - "\n" - "#ifndef FRAGMENTPROGRAMS_P_H\n" - "#define FRAGMENTPROGRAMS_P_H\n" - "\n" - "//\n" - "// W A R N I N G\n" - "// -------------\n" - "//\n" - "// This file is not part of the Qt API. It exists purely as an\n" - "// implementation detail. This header file may change from version to\n" - "// version without notice, or even be removed.\n" - "//\n" - "// We mean it.\n" - "//\n" - "\n"; - - writeVariablesEnum(out, "FragmentVariable", variables); - writeTypesEnum(out, "FragmentBrushType", brushes); - writeTypesEnum(out, "FragmentCompositionModeType", compositionModes); - writeTypesEnum(out, "FragmentMaskType", masks); - - out << "static const unsigned int num_fragment_variables = " << variables.size() << ";\n\n"; - out << "static const unsigned int num_fragment_brushes = " << brushes.size() << ";\n"; - out << "static const unsigned int num_fragment_composition_modes = " << compositionModes.size() << ";\n"; - out << "static const unsigned int num_fragment_masks = " << masks.size() << ";\n\n"; - - foreach (QStringPair mask, masks) { - const QString compiledSource = compiled[mask.first]["MASK__"]; - - out << "static const char *FragmentProgram_" << mask.first << " =\n" - << trimmed(compiledSource) - << '\n'; - } - - foreach (QStringPair brush, brushes) { - foreach (QStringPair mode, compositionModes) { - const QString compiledSource = compiled[brush.first][mode.first]; - - out << "static const char *FragmentProgram_" << brush.first << '_' << mode.first << " =\n" - << trimmed(compiledSource) - << '\n'; - } - } - - out << "static const char *mask_fragment_program_sources[num_fragment_masks] = {\n"; - foreach (QStringPair mask, masks) - out << tab << "FragmentProgram_" << mask.first << ",\n"; - out << "};\n\n"; - - out << "static const char *painter_fragment_program_sources[num_fragment_brushes][num_fragment_composition_modes] = {\n"; - foreach (QStringPair brush, brushes) { - out << tab << "{\n"; - - foreach (QStringPair mode, compositionModes) - out << tab << tab << "FragmentProgram_" << brush.first << '_' << mode.first << ",\n"; - - out << tab << "},\n"; - } - out << "};\n\n"; - - out << "static int painter_variable_locations[num_fragment_brushes][num_fragment_composition_modes][num_fragment_variables] = {\n"; - foreach (QStringPair brush, brushes) { - out << tab << "{\n"; - - foreach (QStringPair mode, compositionModes) { - out << tab << tab << "{ "; - - QList locations = getLocations(variables, compiled[brush.first][mode.first]); - - foreach (int location, locations) - out << location << ", "; - - out << "},\n"; - } - - out << tab << "},\n"; - } - out << "};\n\n"; - - out << "static int mask_variable_locations[num_fragment_masks][num_fragment_variables] = {\n"; - foreach (QStringPair mask, masks) { - out << tab << "{ "; - - QList locations = getLocations(variables, compiled[mask.first]["MASK__"]); - - foreach (int location, locations) - out << location << ", "; - - out << "},\n"; - } - out << "};\n\n"; - out << "#endif\n"; -} - -QList getVariables(QString program) -{ - QList result; - - QTextStream in(&program); - while (!in.atEnd()) { - QString line = in.readLine(); - - if (line.startsWith("uniform")) { - QString word = getWord(line, 3); - result << word.left(word.size() - 1); - } else if (line.startsWith("#include")) { - QString file = getWord(line, 2); - result << getVariables(readSourceFile(file.mid(1, file.size() - 2))); - } - } - - return result; -} - -int main() -{ - QList brushes = readConf(QLatin1String("brushes.conf")); - QList compositionModes = readConf(QLatin1String("composition_modes.conf")); - QList masks = readConf(QLatin1String("masks.conf")); - - QString painterSource = readSourceFile("painter.glsl"); - QString painterNoMaskSource = readSourceFile("painter_nomask.glsl"); - QString fastPainterSource = readSourceFile("fast_painter.glsl"); - QString brushPainterSource = readSourceFile("brush_painter.glsl"); - - QSet variables; - - QList programs[3] = { brushes, compositionModes, masks }; - - for (int i = 0; i < 3; ++i) - foreach (QStringPair value, programs[i]) - variables += QSet::fromList(getVariables(value.second)); - - variables += QSet::fromList(getVariables(painterSource)); - variables += QSet::fromList(getVariables(fastPainterSource)); - - QMap > compiled; - - foreach (QStringPair brush, brushes) { - foreach (QStringPair mode, compositionModes) { - QString combinedSource = brush.second + mode.second + painterSource; - compiled[brush.first][mode.first] = compileSource(combinedSource); - - combinedSource = brush.second + mode.second + painterNoMaskSource; - compiled[brush.first][mode.first + "_NOMASK"] = compileSource(combinedSource); - } - - QString fastSource = brush.second + fastPainterSource; - QString brushSource = brush.second + brushPainterSource; - - compiled[brush.first]["COMPOSITION_MODE_BLEND_MODE_MASK"] = compileSource(fastSource); - compiled[brush.first]["COMPOSITION_MODE_BLEND_MODE_NOMASK"] = compileSource(brushSource); - } - - QList temp; - - foreach (QStringPair mode, compositionModes) - temp << QStringPair(mode.first + "_NOMASK", mode.second); - - compositionModes += temp; - - compositionModes << QStringPair("COMPOSITION_MODE_BLEND_MODE_MASK", "") - << QStringPair("COMPOSITION_MODE_BLEND_MODE_NOMASK", ""); - - foreach (QStringPair mask, masks) - compiled[mask.first]["MASK__"] = compileSource(mask.second); - - writeIncludeFile(variables, brushes, compositionModes, masks, compiled); - - return 0; -} - -QT_END_NAMESPACE diff --git a/src/opengl/util/glsl_to_include.sh b/src/opengl/util/glsl_to_include.sh deleted file mode 100755 index c97239bfdd4..00000000000 --- a/src/opengl/util/glsl_to_include.sh +++ /dev/null @@ -1,73 +0,0 @@ -#! /bin/sh -############################################################################# -## -## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -## All rights reserved. -## Contact: Nokia Corporation (qt-info@nokia.com) -## -## This file is the build configuration utility of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL$ -## GNU Lesser General Public License Usage -## This file may be used under the terms of the GNU Lesser General Public -## License version 2.1 as published by the Free Software Foundation and -## appearing in the file LICENSE.LGPL included in the packaging of this -## file. Please review the following information to ensure the GNU Lesser -## General Public License version 2.1 requirements will be met: -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## In addition, as a special exception, Nokia gives you certain additional -## rights. These rights are described in the Nokia Qt LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU General -## Public License version 3.0 as published by the Free Software Foundation -## and appearing in the file LICENSE.GPL included in the packaging of this -## file. Please review the following information to ensure the GNU General -## Public License version 3.0 requirements will be met: -## http://www.gnu.org/copyleft/gpl.html. -## -## Other Usage -## Alternatively, this file may be used in accordance with the terms and -## conditions contained in a signed written agreement between you and Nokia. -## -## -## -## -## -## $QT_END_LICENSE$ -## -############################################################################# - -# Compile a .glsl file to a file that can be included in a C++ program -USAGE="Usage: $0 " -CGC=cgc -CGC_PROFILE=arbfp1 - -if test $# -ne 1 -then - echo $USAGE - exit 1 -fi - -GLSL_FILE=$1 -FRAG_FILE=`basename $1 .glsl`.frag -#GLSL_INC_FILE=`basename $1 .glsl`.glsl_quoted - -echo "// Generated by src/opengl/util/$0 from $1" > $FRAG_FILE -$CGC -quiet -oglsl -profile $CGC_PROFILE $GLSL_FILE | while read line -do - if test `echo $line | cut -c1` != "#" - then - echo -e \"$line\" >> $FRAG_FILE - fi -done -echo "; // Generated by src/opengl/util/$0 from $1" >> $FRAG_FILE - -#echo "// Generated by src/opengl/util/$0 from $1" > $GLSL_INC_FILE -#cat $GLSL_FILE | while read line -#do -# printf \"%s\\\\n\"\\n "$line" >> $GLSL_INC_FILE -#done -#echo "; // Generated by src/opengl/util/$0 from $1" >> $GLSL_INC_FILE diff --git a/src/opengl/util/linear_brush.glsl b/src/opengl/util/linear_brush.glsl deleted file mode 100644 index 90a4440a99f..00000000000 --- a/src/opengl/util/linear_brush.glsl +++ /dev/null @@ -1,22 +0,0 @@ -uniform sampler1D palette; -uniform vec3 linear; -uniform vec3 inv_matrix_m0; -uniform vec3 inv_matrix_m1; -uniform vec3 inv_matrix_m2; - -vec4 brush() -{ - mat3 mat; - - mat[0] = inv_matrix_m0; - mat[1] = inv_matrix_m1; - mat[2] = inv_matrix_m2; - - vec3 hcoords = mat * vec3(gl_FragCoord.xy, 1); - vec2 A = hcoords.xy / hcoords.z; - - float val = dot(linear.xy, A) * linear.z; - - return texture1D(palette, val); -} - diff --git a/src/opengl/util/masks.conf b/src/opengl/util/masks.conf deleted file mode 100644 index d853d0b6e9a..00000000000 --- a/src/opengl/util/masks.conf +++ /dev/null @@ -1,2 +0,0 @@ -FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA trap_exact_aa.glsl -FRAGMENT_PROGRAM_MASK_ELLIPSE_AA ellipse_aa.glsl diff --git a/src/opengl/util/meego/main.cpp b/src/opengl/util/meego/main.cpp deleted file mode 100644 index 21ac5fd629b..00000000000 --- a/src/opengl/util/meego/main.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#define QT_DEBUG_SHADER_CACHE -#define QT_MEEGO_EXPERIMENTAL_SHADERCACHE -#define QT_OPENGL_ES_2 -#define QT_BOOTSTRAPPED - -typedef int GLsizei; -typedef unsigned int GLenum; - -#include "../../gl2paintengineex/qglshadercache_meego_p.h" - -#include -#include - -int main() -{ - ShaderCacheSharedMemory shm; - - if (!shm.isAttached()) { - fprintf(stderr, "Unable to attach to shared memory\n"); - return EXIT_FAILURE; - } - - ShaderCacheLocker locker(&shm); - if (!locker.isLocked()) { - fprintf(stderr, "Unable to lock shared memory\n"); - return EXIT_FAILURE; - } - - void *data = shm.data(); - Q_ASSERT(data); - - CachedShaders *cache = reinterpret_cast(data); - - for (int i = 0; i < cache->shaderCount; ++i) { - printf("Shader %d: %d bytes\n", i, cache->headers[i].size); - } - - printf("\nSummary:\n\n" - " Amount of cached shaders: %d\n" - " Bytes used: %d\n" - " Bytes available: %d\n", - cache->shaderCount, cache->dataSize, cache->availableSize()); - - return EXIT_SUCCESS; -} - diff --git a/src/opengl/util/meego/shader-cache-introspector.pro b/src/opengl/util/meego/shader-cache-introspector.pro deleted file mode 100644 index 520e9a51089..00000000000 --- a/src/opengl/util/meego/shader-cache-introspector.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app - -SOURCES += main.cpp - -TARGET = shader-cache-introspector - -QT = core diff --git a/src/opengl/util/painter.glsl b/src/opengl/util/painter.glsl deleted file mode 100644 index b990234778f..00000000000 --- a/src/opengl/util/painter.glsl +++ /dev/null @@ -1,21 +0,0 @@ -uniform sampler2D dst_texture; -uniform sampler2D mask_texture; -uniform vec2 inv_mask_size; -uniform vec2 inv_dst_size; -uniform vec2 mask_offset; -uniform vec4 mask_channel; - -float mask() -{ - return dot(mask_channel, texture2D(mask_texture, (gl_FragCoord.xy + mask_offset) * inv_mask_size)); -} - -void main() -{ - vec4 dst = texture2D(dst_texture, gl_FragCoord.xy * inv_dst_size); - - // combine clip and coverage channels - float mask_alpha = mask(); - - gl_FragColor = mix(dst, composite(brush(), dst), mask_alpha); -} diff --git a/src/opengl/util/painter_nomask.glsl b/src/opengl/util/painter_nomask.glsl deleted file mode 100644 index af5ad6505f7..00000000000 --- a/src/opengl/util/painter_nomask.glsl +++ /dev/null @@ -1,9 +0,0 @@ -uniform sampler2D dst_texture; -uniform vec2 inv_dst_size; - -void main() -{ - vec4 dst = texture2D(dst_texture, gl_FragCoord.xy * inv_dst_size); - - gl_FragColor = composite(brush(), dst); -} diff --git a/src/opengl/util/pattern_brush.glsl b/src/opengl/util/pattern_brush.glsl deleted file mode 100644 index 31702b887c8..00000000000 --- a/src/opengl/util/pattern_brush.glsl +++ /dev/null @@ -1,23 +0,0 @@ -uniform sampler2D brush_texture; -uniform vec2 inv_brush_texture_size; -uniform vec3 inv_matrix_m0; -uniform vec3 inv_matrix_m1; -uniform vec3 inv_matrix_m2; - -vec4 brush() -{ - mat3 mat; - - mat[0] = inv_matrix_m0; - mat[1] = inv_matrix_m1; - mat[2] = inv_matrix_m2; - - vec3 hcoords = mat * vec3(gl_FragCoord.xy, 1); - vec2 coords = hcoords.xy / hcoords.z; - - coords *= inv_brush_texture_size; - - float alpha = 1.0 - texture2D(brush_texture, coords).r; - - return gl_Color * alpha; -} diff --git a/src/opengl/util/radial_brush.glsl b/src/opengl/util/radial_brush.glsl deleted file mode 100644 index 84bec62e657..00000000000 --- a/src/opengl/util/radial_brush.glsl +++ /dev/null @@ -1,28 +0,0 @@ -uniform sampler1D palette; -uniform vec2 fmp; -uniform float fmp2_m_radius2; -uniform vec3 inv_matrix_m0; -uniform vec3 inv_matrix_m1; -uniform vec3 inv_matrix_m2; - -vec4 brush() -{ - mat3 mat; - - mat[0] = inv_matrix_m0; - mat[1] = inv_matrix_m1; - mat[2] = inv_matrix_m2; - - vec3 hcoords = mat * vec3(gl_FragCoord.xy, 1); - vec2 A = hcoords.xy / hcoords.z; - vec2 B = fmp; - - float a = fmp2_m_radius2; - float b = 2.0*dot(A, B); - float c = -dot(A, A); - - float val = (-b + sqrt(b*b - 4.0*a*c)) / (2.0*a); - - return texture1D(palette, val); -} - diff --git a/src/opengl/util/simple_porter_duff.glsl b/src/opengl/util/simple_porter_duff.glsl deleted file mode 100644 index 4cb0599ac52..00000000000 --- a/src/opengl/util/simple_porter_duff.glsl +++ /dev/null @@ -1,16 +0,0 @@ -uniform vec2 porterduff_ab; -uniform vec3 porterduff_xyz; - -vec4 composite(vec4 src, vec4 dst) -{ - vec4 result; - - result.xyz = porterduff_ab.x * src.xyz * dst.a - + porterduff_ab.y * dst.xyz * src.a - + porterduff_xyz.y * src.xyz * (1.0 - dst.a) - + porterduff_xyz.z * dst.xyz * (1.0 - src.a); - - result.a = dot(porterduff_xyz, vec3(src.a * dst.a, src.a * (1.0 - dst.a), dst.a * (1.0 - src.a))); - - return result; -} diff --git a/src/opengl/util/solid_brush.glsl b/src/opengl/util/solid_brush.glsl deleted file mode 100644 index 760afd1a72d..00000000000 --- a/src/opengl/util/solid_brush.glsl +++ /dev/null @@ -1,4 +0,0 @@ -vec4 brush() -{ - return gl_Color; -} diff --git a/src/opengl/util/texture_brush.glsl b/src/opengl/util/texture_brush.glsl deleted file mode 100644 index 949825583f8..00000000000 --- a/src/opengl/util/texture_brush.glsl +++ /dev/null @@ -1,21 +0,0 @@ -uniform sampler2D brush_texture; -uniform vec2 inv_brush_texture_size; -uniform vec3 inv_matrix_m0; -uniform vec3 inv_matrix_m1; -uniform vec3 inv_matrix_m2; - -vec4 brush() -{ - mat3 mat; - - mat[0] = inv_matrix_m0; - mat[1] = inv_matrix_m1; - mat[2] = inv_matrix_m2; - - vec3 hcoords = mat * vec3(gl_FragCoord.xy, 1); - vec2 coords = hcoords.xy / hcoords.z; - - coords *= inv_brush_texture_size; - - return texture2D(brush_texture, coords); -} diff --git a/src/opengl/util/trap_exact_aa.glsl b/src/opengl/util/trap_exact_aa.glsl deleted file mode 100644 index 1637f430b51..00000000000 --- a/src/opengl/util/trap_exact_aa.glsl +++ /dev/null @@ -1,58 +0,0 @@ -float quad_aa() -{ - float top = min(gl_FragCoord.y + 0.5, gl_TexCoord[0].x); - float bottom = max(gl_FragCoord.y - 0.5, gl_TexCoord[0].y); - - float area = top - bottom; - - float left = gl_FragCoord.x - 0.5; - float right = gl_FragCoord.x + 0.5; - - // use line equations to compute intersections of left/right edges with top/bottom of truncated pixel - vec4 vecX = gl_TexCoord[1].xxzz * vec2(top, bottom).xyxy + gl_TexCoord[1].yyww; - - vec2 invA = gl_TexCoord[0].zw; - - // transform right line to left to be able to use same calculations for both - vecX.zw = 2.0 * gl_FragCoord.x - vecX.zw; - - vec2 topX = vec2(vecX.x, vecX.z); - vec2 bottomX = vec2(vecX.y, vecX.w); - - // transform lines such that top intersection is to the right of bottom intersection - vec2 topXTemp = max(topX, bottomX); - vec2 bottomXTemp = min(topX, bottomX); - - // make sure line slope reflects mirrored lines - invA = mix(invA, -invA, step(topX, bottomX)); - - vec2 vecLeftRight = vec2(left, right); - - // compute the intersections of the lines with the left and right edges of the pixel - vec4 intersectY = bottom + (vecLeftRight.xyxy - bottomXTemp.xxyy) * invA.xxyy; - - vec2 temp = mix(area - 0.5 * (right - bottomXTemp) * (intersectY.yw - bottom), // left < bottom < right < top - (0.5 * (topXTemp + bottomXTemp) - left) * area, // left < bottom < top < right - step(topXTemp, right.xx)); - - vec2 excluded = 0.5 * (top - intersectY.xz) * (topXTemp - left); // bottom < left < top < right - - excluded = mix((top - 0.5 * (intersectY.yw + intersectY.xz)) * (right - left), // bottom < left < right < top - excluded, step(topXTemp, right.xx)); - - excluded = mix(temp, // left < bottom < right (see calculation of temp) - excluded, step(bottomXTemp, left.xx)); - - excluded = mix(vec2(area, area), // right < bottom < top - excluded, step(bottomXTemp, right.xx)); - - excluded *= step(left, topXTemp); - - return (area - excluded.x - excluded.y) * step(bottom, top); -} - -void main() -{ - gl_FragColor = quad_aa().xxxx; -} - diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro deleted file mode 100644 index bd9aa1a7320..00000000000 --- a/src/openvg/openvg.pro +++ /dev/null @@ -1,76 +0,0 @@ -TARGET = QtOpenVG -QT += core-private \ - gui-private - -CONFIG += module -MODULE_PRI = ../modules/qt_openvg.pri - -DEFINES+=QT_BUILD_OPENVG_LIB - -contains(QT_CONFIG, shivavg) { - DEFINES += QVG_NO_DRAW_GLYPHS - DEFINES += QVG_NO_RENDER_TO_MASK - DEFINES += QVG_SCISSOR_CLIP -} - -HEADERS += \ - qvg.h \ - qvg_p.h \ - qpaintengine_vg_p.h \ - qpixmapdata_vg_p.h \ - qpixmapfilter_vg_p.h \ - qvgcompositionhelper_p.h \ - qvgimagepool_p.h \ - qvgfontglyphcache_p.h -SOURCES += \ - qpaintengine_vg.cpp \ - qpixmapdata_vg.cpp \ - qpixmapfilter_vg.cpp \ - qvgimagepool.cpp - -contains(QT_CONFIG, egl) { - HEADERS += \ - qwindowsurface_vgegl_p.h \ - qwindowsurface_vg_p.h - SOURCES += \ - qwindowsurface_vg.cpp \ - qwindowsurface_vgegl.cpp -} - -symbian { - DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_BUFFER_SCROLLING QVG_SCISSOR_CLIP - SOURCES += \ - qvg_symbian.cpp - - contains(QT_CONFIG, freetype) { - DEFINES += QT_NO_FONTCONFIG - INCLUDEPATH += \ - ../3rdparty/freetype/src \ - ../3rdparty/freetype/include - } -} - -load(qt_module_config) - -HEADERS += $$QT_SOURCE_TREE/src/openvg/qtopenvgversion.h - -unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui -symbian:TARGET.UID3 = 0x2001E62F - -!isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG -!isEmpty(QMAKE_LIBDIR_OPENVG): LIBS_PRIVATE += -L$$QMAKE_LIBDIR_OPENVG -!isEmpty(QMAKE_LIBS_OPENVG): LIBS_PRIVATE += $$QMAKE_LIBS_OPENVG - -contains(QT_CONFIG, egl) { - !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL - !isEmpty(QMAKE_LIBDIR_EGL): LIBS_PRIVATE += -L$$QMAKE_LIBDIR_EGL - !isEmpty(QMAKE_LIBS_EGL): LIBS_PRIVATE += $$QMAKE_LIBS_EGL -} - -contains(QT_CONFIG, openvg_on_opengl) { - !isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL - !isEmpty(QMAKE_LIBDIR_OPENGL): LIBS_PRIVATE += -L$$QMAKE_LIBDIR_OPENGL - !isEmpty(QMAKE_LIBS_OPENGL): LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL -} - -INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp deleted file mode 100644 index b919b087cf1..00000000000 --- a/src/openvg/qpaintengine_vg.cpp +++ /dev/null @@ -1,4225 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpaintengine_vg_p.h" -#include "qpixmapdata_vg_p.h" -#include "qpixmapfilter_vg_p.h" -#include "qvgcompositionhelper_p.h" -#include "qvgimagepool_p.h" -#include "qvgfontglyphcache_p.h" -#if !defined(QT_NO_EGL) -#include -#include "qwindowsurface_vgegl_p.h" -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -// 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) -#define QVG_NO_RENDER_TO_MASK 1 -#endif -#if defined(QVG_SCISSOR_CLIP) && !defined(QVG_NO_RENDER_TO_MASK) -#define QVG_NO_RENDER_TO_MASK 1 -#endif - -// 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) - -class QVGPaintEnginePrivate; - -typedef QHash QVGFontCache; - -#endif - -class QVGFontEngineCleaner : public QObject -{ - Q_OBJECT -public: - QVGFontEngineCleaner(QVGPaintEnginePrivate *d); - ~QVGFontEngineCleaner(); - -public slots: - void fontEngineDestroyed(); - -private: - QVGPaintEnginePrivate *d_ptr; -}; - -class QVGPaintEnginePrivate : public QPaintEngineExPrivate -{ - Q_DECLARE_PUBLIC(QVGPaintEngine) -public: - // Extra blending modes from VG_KHR_advanced_blending extension. - // Use the QT_VG prefix to avoid conflicts with any definitions - // that may come in via . - enum AdvancedBlending { - QT_VG_BLEND_OVERLAY_KHR = 0x2010, - QT_VG_BLEND_HARDLIGHT_KHR = 0x2011, - QT_VG_BLEND_SOFTLIGHT_SVG_KHR = 0x2012, - QT_VG_BLEND_SOFTLIGHT_KHR = 0x2013, - QT_VG_BLEND_COLORDODGE_KHR = 0x2014, - QT_VG_BLEND_COLORBURN_KHR = 0x2015, - QT_VG_BLEND_DIFFERENCE_KHR = 0x2016, - QT_VG_BLEND_SUBTRACT_KHR = 0x2017, - QT_VG_BLEND_INVERT_KHR = 0x2018, - QT_VG_BLEND_EXCLUSION_KHR = 0x2019, - QT_VG_BLEND_LINEARDODGE_KHR = 0x201a, - QT_VG_BLEND_LINEARBURN_KHR = 0x201b, - QT_VG_BLEND_VIVIDLIGHT_KHR = 0x201c, - QT_VG_BLEND_LINEARLIGHT_KHR = 0x201d, - QT_VG_BLEND_PINLIGHT_KHR = 0x201e, - QT_VG_BLEND_HARDMIX_KHR = 0x201f, - QT_VG_BLEND_CLEAR_KHR = 0x2020, - QT_VG_BLEND_DST_KHR = 0x2021, - QT_VG_BLEND_SRC_OUT_KHR = 0x2022, - QT_VG_BLEND_DST_OUT_KHR = 0x2023, - QT_VG_BLEND_SRC_ATOP_KHR = 0x2024, - QT_VG_BLEND_DST_ATOP_KHR = 0x2025, - QT_VG_BLEND_XOR_KHR = 0x2026 - }; - - QVGPaintEnginePrivate(QVGPaintEngine *q_ptr); - ~QVGPaintEnginePrivate(); - - void init(); - void initObjects(); - void destroy(); - void setTransform(VGMatrixMode mode, const QTransform& transform); - void updateTransform(QPaintDevice *pdev); - void draw(VGPath path, const QPen& pen, const QBrush& brush, VGint rule = VG_EVEN_ODD); - void stroke(VGPath path, const QPen& pen); - void fill(VGPath path, const QBrush& brush, VGint rule = VG_EVEN_ODD); - VGPath vectorPathToVGPath(const QVectorPath& path); - VGPath painterPathToVGPath(const QPainterPath& path); - VGPath roundedRectPath(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode); - VGPaintType setBrush - (VGPaint paint, const QBrush& brush, VGMatrixMode mode, - VGPaintType prevPaintType); - void setPenParams(const QPen& pen); - void setBrushTransform(const QBrush& brush, VGMatrixMode mode); - void setupColorRamp(const QGradient *grad, VGPaint paint); - void setImageOptions(); - void systemStateChanged(); -#if !defined(QVG_SCISSOR_CLIP) - void ensureMask(QVGPaintEngine *engine, int width, int height); - void modifyMask - (QVGPaintEngine *engine, VGMaskOperation op, const QRegion& region); - void modifyMask - (QVGPaintEngine *engine, VGMaskOperation op, const QRect& rect); -#endif - - VGint maxScissorRects; // Maximum scissor rectangles for clipping. - - VGPaint penPaint; // Paint for currently active pen. - VGPaint brushPaint; // Paint for currently active brush. - VGPaint opacityPaint; // Paint for drawing images with opacity. - VGPaint fillPaint; // Current fill paint that is active. - - QPen currentPen; // Current pen set in "penPaint". - QBrush currentBrush; // Current brush set in "brushPaint". - - bool forcePenChange; // Force a pen change, even if the same. - bool forceBrushChange; // Force a brush change, even if the same. - - bool hasExtendedRadialGradientPen; // Current pen's brush is extended radial gradient. - bool hasExtendedRadialGradientBrush; // Current brush is extended radial gradient. - - VGPaintType penType; // Type of the last pen that was set. - VGPaintType brushType; // Type of the last brush that was set. - - QPointF brushOrigin; // Current brush origin. - - VGint fillRule; // Last fill rule that was set. - - qreal opacity; // Current drawing opacity. - qreal paintOpacity; // Opacity in opacityPaint. - -#if !defined(QVG_NO_MODIFY_PATH) - VGPath rectPath; // Cached path for quick drawing of rectangles. - VGPath linePath; // Cached path for quick drawing of lines. - VGPath roundRectPath; // Cached path for quick drawing of rounded rects. -#endif - - QTransform transform; // Currently active transform. - bool simpleTransform; // True if the transform is simple (non-projective). - qreal penScale; // Pen scaling factor from "transform". - - QTransform pathTransform; // Calculated VG path transformation. - QTransform imageTransform; // Calculated VG image transformation. - bool pathTransformSet; // True if path transform set in the VG context. - - bool maskValid; // True if vgMask() contains valid data. - bool maskIsSet; // True if mask would be fully set if it was valid. - bool scissorMask; // True if scissor is used in place of the mask. - bool rawVG; // True if processing a raw VG escape. - - QRect maskRect; // Rectangle version of mask if it is simple. - - QTransform penTransform; // Transform for the pen. - QTransform brushTransform; // Transform for the brush. - - VGMatrixMode matrixMode; // Last matrix mode that was set. - VGImageMode imageMode; // Last image mode that was set. - - QRegion scissorRegion; // Currently active scissor region. - bool scissorActive; // True if scissor region is active. - bool scissorDirty; // True if scissor is dirty after native painting. - - QPaintEngine::DirtyFlags dirty; - - QColor clearColor; // Last clear color that was set. - VGfloat clearOpacity; // Opacity during the last clear. - - VGBlendMode blendMode; // Active blend mode. - VGRenderingQuality renderingQuality; // Active rendering quality. - VGImageQuality imageQuality; // Active image quality. - -#if !defined(QVG_NO_DRAW_GLYPHS) - QVGFontCache fontCache; - QVGFontEngineCleaner *fontEngineCleaner; -#endif - - bool hasAdvancedBlending; - - QScopedPointer convolutionFilter; - QScopedPointer colorizeFilter; - QScopedPointer dropShadowFilter; - QScopedPointer blurFilter; - - // Ensure that the path transform is properly set in the VG context - // before we perform a vgDrawPath() operation. - inline void ensurePathTransform() - { - if (!pathTransformSet) { - 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; - } - } - - // Ensure that a specific pen has been set into penPaint. - inline void ensurePen(const QPen& pen) { - if (forcePenChange || pen != currentPen) { - currentPen = pen; - forcePenChange = false; - penType = setBrush - (penPaint, pen.brush(), - VG_MATRIX_STROKE_PAINT_TO_USER, penType); - setPenParams(pen); - } - } - - // Ensure that a specific brush has been set into brushPaint. - inline void ensureBrush(const QBrush& brush) { - if (forceBrushChange || brush != currentBrush) { - currentBrush = brush; - forceBrushChange = false; - brushType = setBrush - (brushPaint, brush, VG_MATRIX_FILL_PAINT_TO_USER, brushType); - } - if (fillPaint != brushPaint) { - vgSetPaint(brushPaint, VG_FILL_PATH); - fillPaint = brushPaint; - } - } - - inline bool needsEmulation(const QBrush &brush) const - { - extern bool qt_isExtendedRadialGradient(const QBrush &brush); - return qt_isExtendedRadialGradient(brush); - } - - inline bool needsEmulation() const - { - return hasExtendedRadialGradientPen || hasExtendedRadialGradientBrush; - } - - inline bool needsPenEmulation() const - { - return hasExtendedRadialGradientPen; - } - - inline bool needsBrushEmulation() const - { - return hasExtendedRadialGradientBrush; - } - - // Set various modes, but only if different. - inline void setImageMode(VGImageMode mode); - inline void setRenderingQuality(VGRenderingQuality mode); - inline void setImageQuality(VGImageQuality mode); - inline void setBlendMode(VGBlendMode mode); - inline void setFillRule(VGint mode); - - // Clear all lazily-set modes. - void clearModes(); - -private: - QVGPaintEngine *q; -}; - -inline void QVGPaintEnginePrivate::setImageMode(VGImageMode mode) -{ - if (imageMode != mode) { - imageMode = mode; - vgSeti(VG_IMAGE_MODE, mode); - } -} - -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 - } -} - -inline void QVGPaintEnginePrivate::setImageQuality(VGImageQuality mode) -{ - if (imageQuality != mode) { - vgSeti(VG_IMAGE_QUALITY, mode); - imageQuality = mode; - } -} - -inline void QVGPaintEnginePrivate::setBlendMode(VGBlendMode mode) -{ - if (blendMode != mode) { - vgSeti(VG_BLEND_MODE, mode); - blendMode = mode; - } -} - -inline void QVGPaintEnginePrivate::setFillRule(VGint mode) -{ - if (fillRule != mode) { - fillRule = mode; - vgSeti(VG_FILL_RULE, mode); - } -} - -void QVGPaintEnginePrivate::clearModes() -{ - matrixMode = (VGMatrixMode)0; - imageMode = (VGImageMode)0; - blendMode = (VGBlendMode)0; - renderingQuality = (VGRenderingQuality)0; - imageQuality = (VGImageQuality)0; -} - -QVGPaintEnginePrivate::QVGPaintEnginePrivate(QVGPaintEngine *q_ptr) : q(q_ptr) -{ - init(); -} - -void QVGPaintEnginePrivate::init() -{ - maxScissorRects = 0; - - penPaint = 0; - brushPaint = 0; - opacityPaint = 0; - fillPaint = 0; - - forcePenChange = true; - forceBrushChange = true; - - hasExtendedRadialGradientPen = false; - hasExtendedRadialGradientBrush = false; - - penType = (VGPaintType)0; - brushType = (VGPaintType)0; - - brushOrigin = QPointF(0.0f, 0.0f); - - fillRule = 0; - - opacity = 1.0; - paintOpacity = 1.0f; - -#if !defined(QVG_NO_MODIFY_PATH) - rectPath = 0; - linePath = 0; - roundRectPath = 0; -#endif - - simpleTransform = true; - pathTransformSet = false; - penScale = 1.0; - - maskValid = false; - maskIsSet = false; - scissorMask = false; - rawVG = false; - - scissorActive = false; - scissorDirty = false; - - dirty = 0; - - clearOpacity = 1.0f; - -#if !defined(QVG_NO_DRAW_GLYPHS) - fontEngineCleaner = 0; -#endif - - hasAdvancedBlending = false; - - clearModes(); -} - -QVGPaintEnginePrivate::~QVGPaintEnginePrivate() -{ - destroy(); -} - -void QVGPaintEnginePrivate::initObjects() -{ - maxScissorRects = vgGeti(VG_MAX_SCISSOR_RECTS); - - penPaint = vgCreatePaint(); - vgSetParameteri(penPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); - vgSetPaint(penPaint, VG_STROKE_PATH); - - vgSeti(VG_MATRIX_MODE, VG_MATRIX_STROKE_PAINT_TO_USER); - vgLoadIdentity(); - - brushPaint = vgCreatePaint(); - vgSetParameteri(brushPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); - vgSetPaint(brushPaint, VG_FILL_PATH); - fillPaint = brushPaint; - - vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER); - vgLoadIdentity(); - matrixMode = VG_MATRIX_FILL_PAINT_TO_USER; - - opacityPaint = vgCreatePaint(); - vgSetParameteri(opacityPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); - VGfloat values[4]; - values[0] = 1.0f; - values[1] = 1.0f; - values[2] = 1.0f; - values[3] = paintOpacity; - vgSetParameterfv(opacityPaint, VG_PAINT_COLOR, 4, values); - -#if !defined(QVG_NO_MODIFY_PATH) - // Create a dummy path for rectangle drawing, which we can - // modify later with vgModifyPathCoords(). This should be - // faster than constantly creating and destroying paths. - rectPath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 5, // segmentCapacityHint - 8, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - static VGubyte const segments[5] = { - VG_MOVE_TO_ABS, - VG_LINE_TO_ABS, - VG_LINE_TO_ABS, - VG_LINE_TO_ABS, - VG_CLOSE_PATH - }; - VGfloat coords[8]; - coords[0] = 0.0f; - coords[1] = 0.0f; - coords[2] = 100.0f; - coords[3] = coords[1]; - coords[4] = coords[2]; - coords[5] = 100.0f; - coords[6] = coords[0]; - coords[7] = coords[5]; - vgAppendPathData(rectPath, 5, segments, coords); - - // Create a dummy line drawing path as well. - linePath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 2, // segmentCapacityHint - 4, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - vgAppendPathData(linePath, 2, segments, coords); -#endif - - const char *extensions = reinterpret_cast(vgGetString(VG_EXTENSIONS)); - if (extensions) - hasAdvancedBlending = strstr(extensions, "VG_KHR_advanced_blending") != 0; -} - -void QVGPaintEnginePrivate::destroy() -{ - if (penPaint) - vgDestroyPaint(penPaint); - if (brushPaint) - vgDestroyPaint(brushPaint); - if (opacityPaint) - vgDestroyPaint(opacityPaint); - -#if !defined(QVG_NO_MODIFY_PATH) - if (rectPath) - vgDestroyPath(rectPath); - if (linePath) - vgDestroyPath(linePath); - if (roundRectPath) - vgDestroyPath(roundRectPath); -#endif - -#if !defined(QVG_NO_DRAW_GLYPHS) - QVGFontCache::Iterator it; - for (it = fontCache.begin(); it != fontCache.end(); ++it) - delete it.value(); - fontCache.clear(); - delete fontEngineCleaner; -#endif -} - -// Set a specific VG transformation matrix in the current VG context. -void QVGPaintEnginePrivate::setTransform - (VGMatrixMode mode, const QTransform& transform) -{ - VGfloat mat[9]; - if (mode != matrixMode) { - vgSeti(VG_MATRIX_MODE, mode); - matrixMode = mode; - } - mat[0] = transform.m11(); - mat[1] = transform.m12(); - mat[2] = transform.m13(); - mat[3] = transform.m21(); - mat[4] = transform.m22(); - mat[5] = transform.m23(); - mat[6] = transform.m31(); - mat[7] = transform.m32(); - mat[8] = transform.m33(); - vgLoadMatrix(mat); -} - -Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); - -void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) -{ - VGfloat devh = pdev->height(); - - // Construct the VG transform by combining the Qt transform with - // the following viewport transformation: - // | 1 0 0 | - // | 0 -1 devh | - // | 0 0 1 | - // The full VG transform is effectively: - // 1. Apply the user's transformation matrix. - // 2. Flip the co-ordinate system upside down. - QTransform viewport(1.0f, 0.0f, 0.0f, - 0.0f, -1.0f, 0.0f, - 0.0f, devh, 1.0f); - - // Compute the path transform and determine if it is projective. - pathTransform = transform * viewport; - bool projective = (pathTransform.m13() != 0.0f || - pathTransform.m23() != 0.0f || - pathTransform.m33() != 1.0f); - if (projective) { - // The engine cannot do projective path transforms for us, - // so we will have to convert the co-ordinates ourselves. - // Change the matrix to just the viewport transformation. - pathTransform = viewport; - simpleTransform = false; - } else { - simpleTransform = true; - } - pathTransformSet = false; - - // The image transform is always the full transformation, - imageTransform = transform * viewport; - - // Calculate the scaling factor to use for turning cosmetic pens - // into ordinary non-cosmetic pens. - qt_scaleForTransform(transform, &penScale); -} - -VGPath QVGPaintEnginePrivate::vectorPathToVGPath(const QVectorPath& path) -{ - int count = path.elementCount(); - const qreal *points = path.points(); - const QPainterPath::ElementType *elements = path.elements(); - - VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - count + 1, // segmentCapacityHint - count * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - - // Size is sufficient segments for drawRoundedRect() paths. - QVarLengthArray segments; - - 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. - for (int i = 0; i < count; ++i) { - switch (elements[i]) { - - case QPainterPath::MoveToElement: - segments.append(VG_MOVE_TO_ABS); break; - - case QPainterPath::LineToElement: - segments.append(VG_LINE_TO_ABS); break; - - case QPainterPath::CurveToElement: - segments.append(VG_CUBIC_TO_ABS); break; - - case QPainterPath::CurveToDataElement: break; - - } - } - if (path.hasImplicitClose()) - segments.append(VG_CLOSE_PATH); - - vgAppendPathData(vgpath, segments.count(), segments.constData(), - reinterpret_cast(points)); - - return vgpath; - } - - // Sizes chosen so that drawRoundedRect() paths fit in these arrays. - QVarLengthArray coords; - - int curvePos = 0; - QPointF temp; - - if (elements && simpleTransform) { - // Convert the members of the element array. - for (int i = 0; i < count; ++i) { - switch (elements[i]) { - - case QPainterPath::MoveToElement: - { - coords.append(points[0]); - coords.append(points[1]); - segments.append(VG_MOVE_TO_ABS); - } - break; - - case QPainterPath::LineToElement: - { - coords.append(points[0]); - coords.append(points[1]); - segments.append(VG_LINE_TO_ABS); - } - break; - - case QPainterPath::CurveToElement: - { - coords.append(points[0]); - coords.append(points[1]); - curvePos = 2; - } - break; - - case QPainterPath::CurveToDataElement: - { - coords.append(points[0]); - coords.append(points[1]); - curvePos += 2; - if (curvePos == 6) { - curvePos = 0; - segments.append(VG_CUBIC_TO_ABS); - } - } - break; - - } - points += 2; - } - } 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) { - switch (elements[i]) { - - case QPainterPath::MoveToElement: - { - temp = transform.map(QPointF(points[0], points[1])); - coords.append(temp.x()); - coords.append(temp.y()); - segments.append(VG_MOVE_TO_ABS); - } - break; - - case QPainterPath::LineToElement: - { - temp = transform.map(QPointF(points[0], points[1])); - coords.append(temp.x()); - coords.append(temp.y()); - segments.append(VG_LINE_TO_ABS); - } - break; - - case QPainterPath::CurveToElement: - { - temp = transform.map(QPointF(points[0], points[1])); - coords.append(temp.x()); - coords.append(temp.y()); - curvePos = 2; - } - break; - - case QPainterPath::CurveToDataElement: - { - temp = transform.map(QPointF(points[0], points[1])); - coords.append(temp.x()); - coords.append(temp.y()); - curvePos += 2; - if (curvePos == 6) { - curvePos = 0; - segments.append(VG_CUBIC_TO_ABS); - } - } - break; - - } - points += 2; - } - } 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]); - coords.append(points[1]); - segments.append(VG_MOVE_TO_ABS); - while (count > 1) { - points += 2; - coords.append(points[0]); - coords.append(points[1]); - segments.append(VG_LINE_TO_ABS); - --count; - } - } 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()); - coords.append(temp.y()); - segments.append(VG_MOVE_TO_ABS); - while (count > 1) { - points += 2; - temp = transform.map(QPointF(points[0], points[1])); - coords.append(temp.x()); - coords.append(temp.y()); - segments.append(VG_LINE_TO_ABS); - --count; - } - } - - // Close the path if specified. - if (path.hasImplicitClose()) - segments.append(VG_CLOSE_PATH); - - vgAppendPathData(vgpath, segments.count(), - segments.constData(), coords.constData()); - - return vgpath; -} - -VGPath QVGPaintEnginePrivate::painterPathToVGPath(const QPainterPath& path) -{ - int count = path.elementCount(); - - VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - count + 1, // segmentCapacityHint - count * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - - if (count == 0) - return vgpath; - - const QPainterPath::Element *elements = &(path.elementAt(0)); - - // Sizes chosen so that drawRoundedRect() paths fit in these arrays. - QVarLengthArray coords; - QVarLengthArray segments; - - int curvePos = 0; - QPointF temp; - - // Keep track of the start and end of each sub-path. QPainterPath - // does not have an "implicit close" flag like QVectorPath does. - // We therefore have to detect closed paths by looking for a LineTo - // element that connects back to the initial MoveTo element. - qreal startx = 0.0; - qreal starty = 0.0; - qreal endx = 0.0; - qreal endy = 0.0; - bool haveStart = false; - bool haveEnd = false; - - if (simpleTransform) { - // Convert the members of the element array. - for (int i = 0; i < count; ++i) { - switch (elements[i].type) { - - case QPainterPath::MoveToElement: - { - if (haveStart && haveEnd && startx == endx && starty == endy) { - // Implicitly close the previous sub-path. - segments.append(VG_CLOSE_PATH); - } - startx = elements[i].x; - starty = elements[i].y; - coords.append(startx); - coords.append(starty); - haveStart = true; - haveEnd = false; - segments.append(VG_MOVE_TO_ABS); - } - break; - - case QPainterPath::LineToElement: - { - endx = elements[i].x; - endy = elements[i].y; - coords.append(endx); - coords.append(endy); - haveEnd = true; - segments.append(VG_LINE_TO_ABS); - } - break; - - case QPainterPath::CurveToElement: - { - coords.append(elements[i].x); - coords.append(elements[i].y); - haveEnd = false; - curvePos = 2; - } - break; - - case QPainterPath::CurveToDataElement: - { - coords.append(elements[i].x); - coords.append(elements[i].y); - haveEnd = false; - curvePos += 2; - if (curvePos == 6) { - curvePos = 0; - segments.append(VG_CUBIC_TO_ABS); - } - } - break; - - } - } - } else { - // Convert the members of the element array after applying the - // current transform to the path locally. - for (int i = 0; i < count; ++i) { - switch (elements[i].type) { - - case QPainterPath::MoveToElement: - { - if (haveStart && haveEnd && startx == endx && starty == endy) { - // Implicitly close the previous sub-path. - segments.append(VG_CLOSE_PATH); - } - temp = transform.map(QPointF(elements[i].x, elements[i].y)); - startx = temp.x(); - starty = temp.y(); - coords.append(startx); - coords.append(starty); - haveStart = true; - haveEnd = false; - segments.append(VG_MOVE_TO_ABS); - } - break; - - case QPainterPath::LineToElement: - { - temp = transform.map(QPointF(elements[i].x, elements[i].y)); - endx = temp.x(); - endy = temp.y(); - coords.append(endx); - coords.append(endy); - haveEnd = true; - segments.append(VG_LINE_TO_ABS); - } - break; - - case QPainterPath::CurveToElement: - { - temp = transform.map(QPointF(elements[i].x, elements[i].y)); - coords.append(temp.x()); - coords.append(temp.y()); - haveEnd = false; - curvePos = 2; - } - break; - - case QPainterPath::CurveToDataElement: - { - temp = transform.map(QPointF(elements[i].x, elements[i].y)); - coords.append(temp.x()); - coords.append(temp.y()); - haveEnd = false; - curvePos += 2; - if (curvePos == 6) { - curvePos = 0; - segments.append(VG_CUBIC_TO_ABS); - } - } - break; - - } - } - } - - if (haveStart && haveEnd && startx == endx && starty == endy) { - // Implicitly close the last sub-path. - segments.append(VG_CLOSE_PATH); - } - - vgAppendPathData(vgpath, segments.count(), - segments.constData(), coords.constData()); - - return vgpath; -} - -VGPath QVGPaintEnginePrivate::roundedRectPath(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode) -{ - static VGubyte roundedrect_types[] = { - VG_MOVE_TO_ABS, - VG_LINE_TO_ABS, - VG_CUBIC_TO_ABS, - VG_LINE_TO_ABS, - VG_CUBIC_TO_ABS, - VG_LINE_TO_ABS, - VG_CUBIC_TO_ABS, - VG_LINE_TO_ABS, - VG_CUBIC_TO_ABS, - VG_CLOSE_PATH - }; - - qreal x1 = rect.left(); - qreal x2 = rect.right(); - qreal y1 = rect.top(); - qreal y2 = rect.bottom(); - - if (mode == Qt::RelativeSize) { - xRadius = xRadius * rect.width() / 200.; - yRadius = yRadius * rect.height() / 200.; - } - - xRadius = qMin(xRadius, rect.width() / 2); - yRadius = qMin(yRadius, rect.height() / 2); - - VGfloat pts[] = { - x1 + xRadius, y1, // MoveTo - x2 - xRadius, y1, // LineTo - x2 - (1 - KAPPA) * xRadius, y1, // CurveTo - x2, y1 + (1 - KAPPA) * yRadius, - x2, y1 + yRadius, - x2, y2 - yRadius, // LineTo - x2, y2 - (1 - KAPPA) * yRadius, // CurveTo - x2 - (1 - KAPPA) * xRadius, y2, - x2 - xRadius, y2, - x1 + xRadius, y2, // LineTo - x1 + (1 - KAPPA) * xRadius, y2, // CurveTo - x1, y2 - (1 - KAPPA) * yRadius, - x1, y2 - yRadius, - x1, y1 + yRadius, // LineTo - x1, y1 + (1 - KAPPA) * yRadius, // CurveTo - x1 + (1 - KAPPA) * xRadius, y1, - x1 + xRadius, y1 - }; - -#if !defined(QVG_NO_MODIFY_PATH) - VGPath vgpath = roundRectPath; - if (!vgpath) { - vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 10, // segmentCapacityHint - 17 * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - vgAppendPathData(vgpath, 10, roundedrect_types, pts); - roundRectPath = vgpath; - } else { - vgModifyPathCoords(vgpath, 0, 9, pts); - } -#else - VGPath vgpath = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 10, // segmentCapacityHint - 17 * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - vgAppendPathData(vgpath, 10, roundedrect_types, pts); -#endif - - return vgpath; -} - -Q_GUI_EXPORT QImage qt_imageForBrush(int style, bool invert); - -static QImage colorizeBitmap(const QImage &image, const QColor &color) -{ - QImage sourceImage = image.convertToFormat(QImage::Format_MonoLSB); - QImage dest = QImage(sourceImage.size(), QImage::Format_ARGB32_Premultiplied); - - QRgb fg = PREMUL(color.rgba()); - QRgb bg = 0; - - int height = sourceImage.height(); - int width = sourceImage.width(); - for (int y=0; y(dest.scanLine(y)); - for (int x=0; x < width; ++x) - target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg; - } - return dest; -} - -static VGImage toVGImage - (const QImage & image, Qt::ImageConversionFlags flags = Qt::AutoColor) -{ - QImage img(image); - - VGImageFormat format; - switch (img.format()) { - case QImage::Format_Mono: - img = image.convertToFormat(QImage::Format_MonoLSB, flags); - img.invertPixels(); - format = VG_BW_1; - break; - case QImage::Format_MonoLSB: - img.invertPixels(); - format = VG_BW_1; - break; - case QImage::Format_RGB32: - format = VG_sXRGB_8888; - break; - case QImage::Format_ARGB32: - format = VG_sARGB_8888; - break; - case QImage::Format_ARGB32_Premultiplied: - format = VG_sARGB_8888_PRE; - break; - case QImage::Format_RGB16: - format = VG_sRGB_565; - break; - default: - // Convert everything else into ARGB32_Premultiplied. - img = image.convertToFormat(QImage::Format_ARGB32_Premultiplied, flags); - format = VG_sARGB_8888_PRE; - break; - } - - const uchar *pixels = img.constBits(); - - VGImage vgImg = QVGImagePool::instance()->createPermanentImage - (format, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER); - vgImageSubData - (vgImg, pixels, img.bytesPerLine(), format, 0, 0, - img.width(), img.height()); - - return vgImg; -} - -static VGImage toVGImageSubRect - (const QImage & image, const QRect& sr, - Qt::ImageConversionFlags flags = Qt::AutoColor) -{ - QImage img(image); - - VGImageFormat format; - int bpp = 4; - - switch (img.format()) { - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - return VG_INVALID_HANDLE; - case QImage::Format_RGB32: - format = VG_sXRGB_8888; - break; - case QImage::Format_ARGB32: - format = VG_sARGB_8888; - break; - case QImage::Format_ARGB32_Premultiplied: - format = VG_sARGB_8888_PRE; - break; - case QImage::Format_RGB16: - format = VG_sRGB_565; - bpp = 2; - break; - default: - // Convert everything else into ARGB32_Premultiplied. - img = image.convertToFormat(QImage::Format_ARGB32_Premultiplied, flags); - format = VG_sARGB_8888_PRE; - break; - } - - const uchar *pixels = img.constBits() + bpp * sr.x() + - img.bytesPerLine() * sr.y(); - - VGImage vgImg = QVGImagePool::instance()->createPermanentImage - (format, sr.width(), sr.height(), VG_IMAGE_QUALITY_FASTER); - vgImageSubData - (vgImg, pixels, img.bytesPerLine(), format, 0, 0, - sr.width(), sr.height()); - - return vgImg; -} - -static VGImage toVGImageWithOpacity(const QImage & image, qreal opacity) -{ - QImage img(image.size(), QImage::Format_ARGB32_Premultiplied); - img.fill(0); - QPainter painter; - painter.begin(&img); - painter.setOpacity(opacity); - painter.drawImage(0, 0, image); - painter.end(); - - const uchar *pixels = img.constBits(); - - VGImage vgImg = QVGImagePool::instance()->createPermanentImage - (VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER); - vgImageSubData - (vgImg, pixels, img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, - img.width(), img.height()); - - return vgImg; -} - -static VGImage toVGImageWithOpacitySubRect - (const QImage & image, qreal opacity, const QRect& sr) -{ - QImage img(sr.size(), QImage::Format_ARGB32_Premultiplied); - img.fill(0); - QPainter painter; - painter.begin(&img); - painter.setOpacity(opacity); - painter.drawImage(QPoint(0, 0), image, sr); - painter.end(); - - const uchar *pixels = img.constBits(); - - VGImage vgImg = QVGImagePool::instance()->createPermanentImage - (VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER); - vgImageSubData - (vgImg, pixels, img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, - img.width(), img.height()); - - return vgImg; -} - -VGPaintType QVGPaintEnginePrivate::setBrush - (VGPaint paint, const QBrush& brush, VGMatrixMode mode, - VGPaintType prevType) -{ - VGfloat values[5]; - setBrushTransform(brush, mode); - - // Reset the paint pattern on the brush, which will discard - // the previous VGImage if one was set. - if (prevType == VG_PAINT_TYPE_PATTERN || prevType == (VGPaintType)0) - vgPaintPattern(paint, VG_INVALID_HANDLE); - - switch (brush.style()) { - - case Qt::SolidPattern: { - // The brush is a solid color. - QColor color(brush.color()); - values[0] = color.redF(); - values[1] = color.greenF(); - values[2] = color.blueF(); - values[3] = color.alphaF() * opacity; - if (prevType != VG_PAINT_TYPE_COLOR) - vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); - vgSetParameterfv(paint, VG_PAINT_COLOR, 4, values); - return VG_PAINT_TYPE_COLOR; - } - - case Qt::LinearGradientPattern: { - // The brush is a linear gradient. - Q_ASSERT(brush.gradient()->type() == QGradient::LinearGradient); - const QLinearGradient *grad = - static_cast(brush.gradient()); - values[0] = grad->start().x(); - values[1] = grad->start().y(); - values[2] = grad->finalStop().x(); - values[3] = grad->finalStop().y(); - if (prevType != VG_PAINT_TYPE_LINEAR_GRADIENT) - vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT); - vgSetParameterfv(paint, VG_PAINT_LINEAR_GRADIENT, 4, values); - setupColorRamp(grad, paint); - return VG_PAINT_TYPE_LINEAR_GRADIENT; - } - - case Qt::RadialGradientPattern: { - // The brush is a radial gradient. - Q_ASSERT(brush.gradient()->type() == QGradient::RadialGradient); - const QRadialGradient *grad = - static_cast(brush.gradient()); - values[0] = grad->center().x(); - values[1] = grad->center().y(); - values[2] = grad->focalPoint().x(); - values[3] = grad->focalPoint().y(); - values[4] = grad->radius(); - if (prevType != VG_PAINT_TYPE_RADIAL_GRADIENT) - vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT); - vgSetParameterfv(paint, VG_PAINT_RADIAL_GRADIENT, 5, values); - setupColorRamp(grad, paint); - return VG_PAINT_TYPE_RADIAL_GRADIENT; - } - - case Qt::TexturePattern: { - // The brush is a texture specified by a QPixmap/QImage. - QPixmapData *pd = brush.texture().pixmapData(); - if (!pd) - break; // null QPixmap - VGImage vgImg; - bool deref = false; - if (pd->pixelType() == QPixmapData::BitmapType) { - // Colorize bitmaps using the brush color and opacity. - QColor color = brush.color(); - if (opacity != 1.0) - color.setAlphaF(color.alphaF() * opacity); - QImage image = colorizeBitmap(*(pd->buffer()), color); - vgImg = toVGImage(image); - deref = true; - } else if (opacity == 1.0) { - if (pd->classId() == QPixmapData::OpenVGClass) { - QVGPixmapData *vgpd = static_cast(pd); - vgImg = vgpd->toVGImage(); - - // We don't want the pool to reclaim this image - // because we cannot predict when the paint object - // will stop using it. Replacing the image with - // new data will make the paint object invalid. - vgpd->detachImageFromPool(); - } else { - vgImg = toVGImage(*(pd->buffer())); - deref = true; - } - } else if (pd->classId() == QPixmapData::OpenVGClass) { - QVGPixmapData *vgpd = static_cast(pd); - vgImg = vgpd->toVGImage(opacity); - vgpd->detachImageFromPool(); - } else { - vgImg = toVGImageWithOpacity(*(pd->buffer()), opacity); - deref = true; - } - if (vgImg == VG_INVALID_HANDLE) - break; - if (prevType != VG_PAINT_TYPE_PATTERN) - vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN); - vgSetParameteri(paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_REPEAT); - vgPaintPattern(paint, vgImg); - if (deref) - vgDestroyImage(vgImg); // Will be valid until pattern is destroyed. - return VG_PAINT_TYPE_PATTERN; - } - - case Qt::ConicalGradientPattern: { - // Convert conical gradients into the first stop color. - qWarning() << "QVGPaintEnginePrivate::setBrush: conical gradients are not supported by OpenVG"; - Q_ASSERT(brush.gradient()->type() == QGradient::ConicalGradient); - const QConicalGradient *grad = - static_cast(brush.gradient()); - const QGradientStops stops = grad->stops(); - QColor color; - if (stops.size() > 0) - color = stops[0].second; - values[0] = color.redF(); - values[1] = color.greenF(); - values[2] = color.blueF(); - values[3] = color.alphaF() * opacity; - if (prevType != VG_PAINT_TYPE_COLOR) - vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); - vgSetParameterfv(paint, VG_PAINT_COLOR, 4, values); - return VG_PAINT_TYPE_COLOR; - } - - case Qt::Dense1Pattern: - case Qt::Dense2Pattern: - case Qt::Dense3Pattern: - case Qt::Dense4Pattern: - case Qt::Dense5Pattern: - case Qt::Dense6Pattern: - case Qt::Dense7Pattern: - case Qt::HorPattern: - case Qt::VerPattern: - case Qt::CrossPattern: - case Qt::BDiagPattern: - case Qt::FDiagPattern: - case Qt::DiagCrossPattern: { - // The brush is a traditional dotted or cross-hatched pattern brush. - QColor color = brush.color(); - if (opacity != 1.0) - color.setAlphaF(color.alphaF() * opacity); - QImage image = colorizeBitmap - (qt_imageForBrush(brush.style(), true), color); - VGImage vgImg = toVGImage(image); - if (prevType != VG_PAINT_TYPE_PATTERN) - vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN); - vgSetParameteri(paint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_REPEAT); - vgPaintPattern(paint, vgImg); - vgDestroyImage(vgImg); // Will stay valid until pattern is destroyed. - return VG_PAINT_TYPE_PATTERN; - } - - default: break; - } - return (VGPaintType)0; -} - -void QVGPaintEnginePrivate::setPenParams(const QPen& pen) -{ - // Note: OpenVG does not support zero-width or cosmetic pens, - // so we have to simulate cosmetic pens by reversing the scale. - VGfloat width = pen.widthF(); - if (width <= 0.0f) - width = 1.0f; - if (pen.isCosmetic()) { - if (penScale != 1.0 && penScale != 0.0) - width /= penScale; - } - vgSetf(VG_STROKE_LINE_WIDTH, width); - - if (pen.capStyle() == Qt::FlatCap) - vgSetf(VG_STROKE_CAP_STYLE, VG_CAP_BUTT); - else if (pen.capStyle() == Qt::SquareCap) - vgSetf(VG_STROKE_CAP_STYLE, VG_CAP_SQUARE); - else - vgSetf(VG_STROKE_CAP_STYLE, VG_CAP_ROUND); - - if (pen.joinStyle() == Qt::MiterJoin) { - vgSetf(VG_STROKE_JOIN_STYLE, VG_JOIN_MITER); - vgSetf(VG_STROKE_MITER_LIMIT, pen.miterLimit()); - } else if (pen.joinStyle() == Qt::BevelJoin) { - vgSetf(VG_STROKE_JOIN_STYLE, VG_JOIN_BEVEL); - } else { - vgSetf(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND); - } - - if (pen.style() == Qt::SolidLine) { - vgSetfv(VG_STROKE_DASH_PATTERN, 0, NULL); - } else { - const QVector dashPattern = pen.dashPattern(); - QVector currentDashPattern(dashPattern.count()); - for (int i = 0; i < dashPattern.count(); ++i) - currentDashPattern[i] = dashPattern[i] * width; - vgSetfv(VG_STROKE_DASH_PATTERN, currentDashPattern.count(), currentDashPattern.data()); - vgSetf(VG_STROKE_DASH_PHASE, pen.dashOffset()); - vgSetf(VG_STROKE_DASH_PHASE_RESET, VG_FALSE); - } -} - -void QVGPaintEnginePrivate::setBrushTransform - (const QBrush& brush, VGMatrixMode mode) -{ - // Compute the new brush transformation matrix. - QTransform transform(brush.transform()); - if (brushOrigin.x() != 0.0f || brushOrigin.y() != 0.0f) - transform.translate(brushOrigin.x(), brushOrigin.y()); - - // Bail out if the matrix is the same as last time, to avoid - // updating the VG context state unless absolutely necessary. - // Most applications won't have a brush transformation set, - // which will leave the VG setting at its default of identity. - // Always change the transform if coming out of raw VG mode. - if (mode == VG_MATRIX_FILL_PAINT_TO_USER) { - if (!rawVG && transform == brushTransform) - return; - brushTransform = transform; - } else { - if (!rawVG && transform == penTransform) - return; - penTransform = transform; - } - - // Set the brush transformation matrix. - if (mode != matrixMode) { - vgSeti(VG_MATRIX_MODE, mode); - matrixMode = mode; - } - if (transform.isIdentity()) { - vgLoadIdentity(); - } else { - VGfloat mat[9]; - mat[0] = transform.m11(); - mat[1] = transform.m12(); - mat[2] = transform.m13(); - mat[3] = transform.m21(); - mat[4] = transform.m22(); - mat[5] = transform.m23(); - mat[6] = transform.m31(); - mat[7] = transform.m32(); - mat[8] = transform.m33(); - vgLoadMatrix(mat); - } -} - -void QVGPaintEnginePrivate::setupColorRamp(const QGradient *grad, VGPaint paint) -{ - QGradient::Spread spread = grad->spread(); - VGColorRampSpreadMode spreadMode; - if (spread == QGradient::ReflectSpread) - spreadMode = VG_COLOR_RAMP_SPREAD_REFLECT; - else if (spread == QGradient::RepeatSpread) - spreadMode = VG_COLOR_RAMP_SPREAD_REPEAT; - else - spreadMode = VG_COLOR_RAMP_SPREAD_PAD; - - const QGradientStops stops = grad->stops(); - int n = 5*stops.size(); - QVector fill_stops(n); - - for (int i = 0; i < stops.size(); ++i ) { - QColor col = stops[i].second; - fill_stops[i*5] = stops[i].first; - fill_stops[i*5 + 1] = col.redF(); - fill_stops[i*5 + 2] = col.greenF(); - fill_stops[i*5 + 3] = col.blueF(); - fill_stops[i*5 + 4] = col.alphaF() * opacity; - } - - vgSetParameteri(paint, VG_PAINT_COLOR_RAMP_SPREAD_MODE, spreadMode); - vgSetParameteri(paint, VG_PAINT_COLOR_RAMP_PREMULTIPLIED, VG_FALSE); - vgSetParameterfv(paint, VG_PAINT_COLOR_RAMP_STOPS, n, fill_stops.data()); -} - -QVGPainterState::QVGPainterState(QVGPainterState& other) - : QPainterState(other), - isNew(true), clipRegion(other.clipRegion), - savedDirty(0) -{ -} - -QVGPainterState::QVGPainterState() - : isNew(true), savedDirty(0) -{ -} - -QVGPainterState::~QVGPainterState() -{ -} - -QVGPaintEngine::QVGPaintEngine() - : QPaintEngineEx(*new QVGPaintEnginePrivate(this)) -{ -} - -QVGPaintEngine::QVGPaintEngine(QVGPaintEnginePrivate &data) - : QPaintEngineEx(data) -{ -} - -QVGPaintEngine::~QVGPaintEngine() -{ -} - -QPainterState *QVGPaintEngine::createState(QPainterState *orig) const -{ - if (!orig) { - return new QVGPainterState(); - } else { - Q_D(const QVGPaintEngine); - QVGPaintEnginePrivate *d2 = const_cast(d); - QVGPainterState *origState = static_cast(orig); - origState->savedDirty = d2->dirty; - d2->dirty = 0; - return new QVGPainterState(*origState); - } -} - -void QVGPaintEnginePrivate::draw - (VGPath path, const QPen& pen, const QBrush& brush, VGint rule) -{ - VGbitfield mode = 0; - if (qpen_style(pen) != Qt::NoPen && qbrush_style(qpen_brush(pen)) != Qt::NoBrush) { - ensurePen(pen); - mode |= VG_STROKE_PATH; - } - if (brush.style() != Qt::NoBrush) { - ensureBrush(brush); - setFillRule(rule); - mode |= VG_FILL_PATH; - } - if (mode != 0) { - ensurePathTransform(); - vgDrawPath(path, mode); - } -} - -void QVGPaintEnginePrivate::stroke(VGPath path, const QPen& pen) -{ - if (pen.style() == Qt::NoPen) - return; - ensurePen(pen); - ensurePathTransform(); - vgDrawPath(path, VG_STROKE_PATH); -} - -void QVGPaintEnginePrivate::fill(VGPath path, const QBrush& brush, VGint rule) -{ - if (brush.style() == Qt::NoBrush) - return; - ensureBrush(brush); - setFillRule(rule); - QPen savedPen = currentPen; - currentPen = Qt::NoPen; - ensurePathTransform(); - currentPen = savedPen; - vgDrawPath(path, VG_FILL_PATH); -} - -bool QVGPaintEngine::begin(QPaintDevice *pdev) -{ - Q_UNUSED(pdev); - Q_D(QVGPaintEngine); - - // Initialize the VG painting objects if we haven't done it yet. - if (!d->penPaint) - d->initObjects(); - - // The initial clip region is the entire device area. - QVGPainterState *s = state(); - s->clipRegion = defaultClipRegion(); - - // Initialize the VG state for this paint operation. - restoreState(QPaintEngine::AllDirty); - d->dirty = 0; - d->rawVG = false; - return true; -} - -bool QVGPaintEngine::end() -{ - vgSeti(VG_SCISSORING, VG_FALSE); - vgSeti(VG_MASKING, VG_FALSE); - return true; -} - -void QVGPaintEngine::draw(const QVectorPath &path) -{ - Q_D(QVGPaintEngine); - if (d->needsEmulation()) { - QPaintEngineEx::draw(path); - return; - } - QVGPainterState *s = state(); - VGPath vgpath = d->vectorPathToVGPath(path); - if (!path.hasWindingFill()) - d->draw(vgpath, s->pen, s->brush, VG_EVEN_ODD); - else - d->draw(vgpath, s->pen, s->brush, VG_NON_ZERO); - vgDestroyPath(vgpath); -} - -extern QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path); - -void QVGPaintEngine::fill(const QVectorPath &path, const QBrush &brush) -{ - Q_D(QVGPaintEngine); - if (d->needsEmulation(brush)) { - QPainter *p = painter(); - QBrush oldBrush = p->brush(); - p->setBrush(brush); - qt_draw_helper(p->d_ptr.data(), qt_painterPathFromVectorPath(path), QPainterPrivate::FillDraw); - p->setBrush(oldBrush); - return; - } - VGPath vgpath = d->vectorPathToVGPath(path); - if (!path.hasWindingFill()) - d->fill(vgpath, brush, VG_EVEN_ODD); - else - d->fill(vgpath, brush, VG_NON_ZERO); - vgDestroyPath(vgpath); -} - -void QVGPaintEngine::stroke(const QVectorPath &path, const QPen &pen) -{ - Q_D(QVGPaintEngine); - if (d->needsEmulation(pen.brush())) { - QPaintEngineEx::stroke(path, pen); - return; - } - VGPath vgpath = d->vectorPathToVGPath(path); - d->stroke(vgpath, 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) -{ - Q_D(QVGPaintEngine); - QVGPainterState *s = state(); - - d->dirty |= QPaintEngine::DirtyClipRegion; - - if (op == Qt::NoClip) { - s->clipRegion = defaultClipRegion(); - updateScissor(); - return; - } - - // We aren't using masking, so handle simple QRectF's only. - if (path.shape() == QVectorPath::RectangleHint && - 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(); - QRectF rect(points[0], points[1], points[2] - points[0], - points[5] - points[1]); - clip(rect.toRect(), op); - return; - } - - // Try converting the path into a QRegion that tightly follows - // the outline of the path we want to clip with. - QRegion region; - if (!path.isEmpty()) - region = QRegion(path.convertToPainterPath().toFillPolygon(QTransform()).toPolygon()); - - switch (op) { - case Qt::NoClip: - { - region = defaultClipRegion(); - } - break; - - case Qt::ReplaceClip: - { - region = d->transform.map(region); - } - break; - - case Qt::IntersectClip: - { - region = s->clipRegion.intersect(d->transform.map(region)); - } - break; - } - if (region.numRects() <= d->maxScissorRects) { - // We haven't reached the maximum scissor count yet, so we can - // still make use of this region. - s->clipRegion = region; - updateScissor(); - return; - } - - // The best we can do is clip to the bounding rectangle - // of all control points. - clip(path.controlPointRect().toRect(), op); -} - -void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) -{ - Q_D(QVGPaintEngine); - QVGPainterState *s = state(); - - d->dirty |= QPaintEngine::DirtyClipRegion; - - switch (op) { - case Qt::NoClip: - { - s->clipRegion = defaultClipRegion(); - } - break; - - case Qt::ReplaceClip: - { - s->clipRegion = d->transform.map(QRegion(rect)); - } - break; - - case Qt::IntersectClip: - { - s->clipRegion = s->clipRegion.intersect(d->transform.map(QRegion(rect))); - } - break; - } - - updateScissor(); -} - -void QVGPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) -{ - Q_D(QVGPaintEngine); - QVGPainterState *s = state(); - - d->dirty |= QPaintEngine::DirtyClipRegion; - - switch (op) { - case Qt::NoClip: - { - s->clipRegion = defaultClipRegion(); - } - break; - - case Qt::ReplaceClip: - { - s->clipRegion = d->transform.map(region); - } - break; - - case Qt::IntersectClip: - { - s->clipRegion = s->clipRegion.intersect(d->transform.map(region)); - } - break; - } - - updateScissor(); -} - -void QVGPaintEngine::clip(const QPainterPath &path, Qt::ClipOperation op) -{ - QPaintEngineEx::clip(path, op); -} - -#else // !QVG_SCISSOR_CLIP - -void QVGPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) -{ - Q_D(QVGPaintEngine); - - d->dirty |= QPaintEngine::DirtyClipRegion; - - if (op == Qt::NoClip) { - d->maskValid = false; - d->maskIsSet = true; - d->scissorMask = false; - d->maskRect = QRect(); - vgSeti(VG_MASKING, VG_FALSE); - return; - } - - // We don't have vgRenderToMask(), so handle simple QRectF's only. - if (path.shape() == QVectorPath::RectangleHint && - 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(); - QRectF rect(points[0], points[1], points[2] - points[0], - points[5] - points[1]); - clip(rect.toRect(), op); - return; - } - -#if !defined(QVG_NO_RENDER_TO_MASK) - QPaintDevice *pdev = paintDevice(); - int width = pdev->width(); - int height = pdev->height(); - - if (op == Qt::ReplaceClip) { - vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK, 0, 0, width, height); - d->maskRect = QRect(); - } else if (!d->maskValid) { - d->ensureMask(this, width, height); - } - - d->ensurePathTransform(); - VGPath vgpath = d->vectorPathToVGPath(path); - switch (op) { - case Qt::ReplaceClip: - case Qt::IntersectClip: - vgRenderToMask(vgpath, VG_FILL_PATH, VG_INTERSECT_MASK); - break; - - default: break; - } - vgDestroyPath(vgpath); - - vgSeti(VG_MASKING, VG_TRUE); - d->maskValid = true; - d->maskIsSet = false; - d->scissorMask = false; -#endif -} - -void QVGPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) -{ - Q_D(QVGPaintEngine); - - d->dirty |= QPaintEngine::DirtyClipRegion; - - // If we have a non-simple transform, then use path-based clipping. - if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { - QPaintEngineEx::clip(rect, op); - return; - } - - switch (op) { - case Qt::NoClip: - { - d->maskValid = false; - d->maskIsSet = true; - d->scissorMask = false; - d->maskRect = QRect(); - vgSeti(VG_MASKING, VG_FALSE); - } - break; - - case Qt::ReplaceClip: - { - QRect r = d->transform.mapRect(rect); - if (isDefaultClipRect(r)) { - // Replacing the clip with a full-window region is the - // same as turning off clipping. - if (d->maskValid) - vgSeti(VG_MASKING, VG_FALSE); - d->maskValid = false; - d->maskIsSet = true; - d->scissorMask = false; - d->maskRect = QRect(); - } else { - // Special case: if the intersection of the system - // clip and "r" is a single rectangle, then use the - // scissor for clipping. We try to avoid allocating a - // QRegion copy on the heap for the test if we can. - QRegion clip = d->systemClip; // Reference-counted, no alloc. - QRect clipRect; - if (clip.rectCount() == 1) { - clipRect = clip.boundingRect().intersected(r); - } else if (clip.isEmpty()) { - clipRect = r; - } else { - clip = clip.intersect(r); - if (clip.rectCount() != 1) { - d->maskValid = false; - d->maskIsSet = false; - d->scissorMask = false; - d->maskRect = QRect(); - d->modifyMask(this, VG_FILL_MASK, r); - break; - } - clipRect = clip.boundingRect(); - } - d->maskValid = false; - d->maskIsSet = false; - d->scissorMask = true; - d->maskRect = clipRect; - vgSeti(VG_MASKING, VG_FALSE); - updateScissor(); - } - } - break; - - case Qt::IntersectClip: - { - QRect r = d->transform.mapRect(rect); - if (!d->maskValid) { - // Mask has not been used yet, so intersect with - // the previous scissor-based region in maskRect. - if (d->scissorMask) - r = r.intersect(d->maskRect); - if (isDefaultClipRect(r)) { - // The clip is the full window, so turn off clipping. - d->maskIsSet = true; - d->maskRect = QRect(); - } else { - // Activate the scissor on a smaller maskRect. - d->maskIsSet = false; - d->maskRect = r; - } - d->scissorMask = true; - updateScissor(); - } else if (d->maskIsSet && isDefaultClipRect(r)) { - // Intersecting a full-window clip with a full-window - // region is the same as turning off clipping. - if (d->maskValid) - vgSeti(VG_MASKING, VG_FALSE); - d->maskValid = false; - d->maskIsSet = true; - d->scissorMask = false; - d->maskRect = QRect(); - } else { - d->modifyMask(this, VG_INTERSECT_MASK, r); - } - } - break; - } -} - -void QVGPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) -{ - Q_D(QVGPaintEngine); - - // Use the QRect case if the region consists of a single rectangle. - if (region.rectCount() == 1) { - clip(region.boundingRect(), op); - return; - } - - d->dirty |= QPaintEngine::DirtyClipRegion; - - // If we have a non-simple transform, then use path-based clipping. - if (op != Qt::NoClip && !clipTransformIsSimple(d->transform)) { - QPaintEngineEx::clip(region, op); - return; - } - - switch (op) { - case Qt::NoClip: - { - d->maskValid = false; - d->maskIsSet = true; - d->scissorMask = false; - d->maskRect = QRect(); - vgSeti(VG_MASKING, VG_FALSE); - } - break; - - case Qt::ReplaceClip: - { - QRegion r = d->transform.map(region); - if (isDefaultClipRegion(r)) { - // Replacing the clip with a full-window region is the - // same as turning off clipping. - if (d->maskValid) - vgSeti(VG_MASKING, VG_FALSE); - d->maskValid = false; - d->maskIsSet = true; - d->scissorMask = false; - d->maskRect = QRect(); - } else { - // Special case: if the intersection of the system - // clip and the region is a single rectangle, then - // use the scissor for clipping. - QRegion clip = d->systemClip; - if (clip.isEmpty()) - clip = r; - else - clip = clip.intersect(r); - if (clip.rectCount() == 1) { - d->maskValid = false; - d->maskIsSet = false; - d->scissorMask = true; - d->maskRect = clip.boundingRect(); - vgSeti(VG_MASKING, VG_FALSE); - updateScissor(); - } else { - d->maskValid = false; - d->maskIsSet = false; - d->scissorMask = false; - d->maskRect = QRect(); - d->modifyMask(this, VG_FILL_MASK, r); - } - } - } - break; - - case Qt::IntersectClip: - { - if (region.rectCount() != 1) { - // If there is more than one rectangle, then intersecting - // the rectangles one by one in modifyMask() will not give - // the desired result. So fall back to path-based clipping. - QPaintEngineEx::clip(region, op); - return; - } - QRegion r = d->transform.map(region); - if (d->maskIsSet && isDefaultClipRegion(r)) { - // Intersecting a full-window clip with a full-window - // region is the same as turning off clipping. - if (d->maskValid) - vgSeti(VG_MASKING, VG_FALSE); - d->maskValid = false; - d->maskIsSet = true; - d->scissorMask = false; - d->maskRect = QRect(); - } else { - d->modifyMask(this, VG_INTERSECT_MASK, r); - } - } - break; - } -} - -#if !defined(QVG_NO_RENDER_TO_MASK) - -// Copied from qpathclipper.cpp. -static bool qt_vg_pathToRect(const QPainterPath &path, QRectF *rect) -{ - if (path.elementCount() != 5) - return false; - - const bool mightBeRect = path.elementAt(0).isMoveTo() - && path.elementAt(1).isLineTo() - && path.elementAt(2).isLineTo() - && path.elementAt(3).isLineTo() - && path.elementAt(4).isLineTo(); - - if (!mightBeRect) - return false; - - const qreal x1 = path.elementAt(0).x; - const qreal y1 = path.elementAt(0).y; - - const qreal x2 = path.elementAt(1).x; - const qreal y2 = path.elementAt(2).y; - - if (path.elementAt(1).y != y1) - return false; - - if (path.elementAt(2).x != x2) - return false; - - if (path.elementAt(3).x != x1 || path.elementAt(3).y != y2) - return false; - - if (path.elementAt(4).x != x1 || path.elementAt(4).y != y1) - return false; - - if (rect) - *rect = QRectF(QPointF(x1, y1), QPointF(x2, y2)); - - return true; -} - -#endif - -void QVGPaintEngine::clip(const QPainterPath &path, Qt::ClipOperation op) -{ -#if !defined(QVG_NO_RENDER_TO_MASK) - Q_D(QVGPaintEngine); - - // If the path is a simple rectangle, then use clip(QRect) instead. - QRectF simpleRect; - if (qt_vg_pathToRect(path, &simpleRect)) { - clip(simpleRect.toRect(), op); - return; - } - - d->dirty |= QPaintEngine::DirtyClipRegion; - - if (op == Qt::NoClip) { - d->maskValid = false; - d->maskIsSet = true; - d->scissorMask = false; - d->maskRect = QRect(); - vgSeti(VG_MASKING, VG_FALSE); - return; - } - - QPaintDevice *pdev = paintDevice(); - int width = pdev->width(); - int height = pdev->height(); - - if (op == Qt::ReplaceClip) { - vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK, 0, 0, width, height); - d->maskRect = QRect(); - } else if (!d->maskValid) { - d->ensureMask(this, width, height); - } - - d->ensurePathTransform(); - VGPath vgpath = d->painterPathToVGPath(path); - switch (op) { - case Qt::ReplaceClip: - case Qt::IntersectClip: - vgRenderToMask(vgpath, VG_FILL_PATH, VG_INTERSECT_MASK); - break; - - default: break; - } - vgDestroyPath(vgpath); - - vgSeti(VG_MASKING, VG_TRUE); - d->maskValid = true; - d->maskIsSet = false; - d->scissorMask = false; -#else - QPaintEngineEx::clip(path, op); -#endif -} - -void QVGPaintEnginePrivate::ensureMask - (QVGPaintEngine *engine, int width, int height) -{ - scissorMask = false; - if (maskIsSet) { - vgMask(VG_INVALID_HANDLE, VG_FILL_MASK, 0, 0, width, height); - maskRect = QRect(); - } else { - vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK, 0, 0, width, height); - if (maskRect.isValid()) { - vgMask(VG_INVALID_HANDLE, VG_FILL_MASK, - maskRect.x(), height - maskRect.y() - maskRect.height(), - maskRect.width(), maskRect.height()); - maskRect = QRect(); - engine->updateScissor(); - } - } -} - -void QVGPaintEnginePrivate::modifyMask - (QVGPaintEngine *engine, VGMaskOperation op, const QRegion& region) -{ - QPaintDevice *pdev = engine->paintDevice(); - int width = pdev->width(); - int height = pdev->height(); - - if (!maskValid) - ensureMask(engine, width, height); - - QVector rects = region.rects(); - for (int i = 0; i < rects.size(); ++i) { - vgMask(VG_INVALID_HANDLE, op, - rects[i].x(), height - rects[i].y() - rects[i].height(), - rects[i].width(), rects[i].height()); - } - - vgSeti(VG_MASKING, VG_TRUE); - maskValid = true; - maskIsSet = false; - scissorMask = false; -} - -void QVGPaintEnginePrivate::modifyMask - (QVGPaintEngine *engine, VGMaskOperation op, const QRect& rect) -{ - QPaintDevice *pdev = engine->paintDevice(); - int width = pdev->width(); - int height = pdev->height(); - - if (!maskValid) - ensureMask(engine, width, height); - - if (rect.isValid()) { - vgMask(VG_INVALID_HANDLE, op, - rect.x(), height - rect.y() - rect.height(), - rect.width(), rect.height()); - } - - vgSeti(VG_MASKING, VG_TRUE); - maskValid = true; - maskIsSet = false; - scissorMask = false; -} - -#endif // !QVG_SCISSOR_CLIP - -void QVGPaintEngine::updateScissor() -{ - Q_D(QVGPaintEngine); - - QRegion region = d->systemClip; - -#if defined(QVG_SCISSOR_CLIP) - // Using the scissor to do clipping, so combine the systemClip - // with the current painting clipRegion. - - if (d->maskValid) { - vgSeti(VG_MASKING, VG_FALSE); - d->maskValid = false; - } - - QVGPainterState *s = state(); - if (s->clipEnabled) { - if (region.isEmpty()) - region = s->clipRegion; - else - region = region.intersect(s->clipRegion); - if (isDefaultClipRegion(region)) { - // The scissor region is the entire drawing surface, - // so there is no point doing any scissoring. - vgSeti(VG_SCISSORING, VG_FALSE); - d->scissorActive = false; - d->scissorDirty = false; - return; - } - } else -#endif - { -#if !defined(QVG_SCISSOR_CLIP) - // Combine the system clip with the simple mask rectangle. - if (d->scissorMask) { - if (region.isEmpty()) - region = d->maskRect; - else - region = region.intersect(d->maskRect); - if (isDefaultClipRegion(region)) { - // The scissor region is the entire drawing surface, - // so there is no point doing any scissoring. - vgSeti(VG_SCISSORING, VG_FALSE); - d->scissorActive = false; - d->scissorDirty = false; - return; - } - } else -#endif - - // Disable the scissor completely if the system clip is empty. - if (region.isEmpty()) { - vgSeti(VG_SCISSORING, VG_FALSE); - d->scissorActive = false; - d->scissorDirty = false; - return; - } - } - - if (d->scissorActive && region == d->scissorRegion && !d->scissorDirty) - return; - - QVector rects = region.rects(); - int count = rects.count(); - if (count > d->maxScissorRects) { -#if !defined(QVG_SCISSOR_CLIP) - count = d->maxScissorRects; -#else - // Use masking - int width = paintDevice()->width(); - int height = paintDevice()->height(); - vgMask(VG_INVALID_HANDLE, VG_CLEAR_MASK, - 0, 0, width, height); - for (int i = 0; i < rects.size(); ++i) { - vgMask(VG_INVALID_HANDLE, VG_FILL_MASK, - rects[i].x(), height - rects[i].y() - rects[i].height(), - rects[i].width(), rects[i].height()); - } - - vgSeti(VG_SCISSORING, VG_FALSE); - vgSeti(VG_MASKING, VG_TRUE); - d->maskValid = true; - d->maskIsSet = false; - d->scissorMask = false; - d->scissorActive = false; - d->scissorDirty = false; - d->scissorRegion = region; - return; -#endif - } - - QVarLengthArray params(count * 4); - int height = paintDevice()->height(); - for (int i = 0; i < count; ++i) { - params[i * 4 + 0] = rects[i].x(); - params[i * 4 + 1] = height - rects[i].y() - rects[i].height(); - params[i * 4 + 2] = rects[i].width(); - params[i * 4 + 3] = rects[i].height(); - } - - vgSetiv(VG_SCISSOR_RECTS, count * 4, params.data()); - vgSeti(VG_SCISSORING, VG_TRUE); - d->scissorDirty = false; - d->scissorActive = true; - d->scissorRegion = region; -} - -QRegion QVGPaintEngine::defaultClipRegion() -{ - // The default clip region for a paint device is the whole drawing area. - QPaintDevice *pdev = paintDevice(); - return QRegion(0, 0, pdev->width(), pdev->height()); -} - -bool QVGPaintEngine::isDefaultClipRegion(const QRegion& region) -{ - if (region.rectCount() != 1) - return false; - - QPaintDevice *pdev = paintDevice(); - int width = pdev->width(); - int height = pdev->height(); - - QRect rect = region.boundingRect(); - return (rect.x() == 0 && rect.y() == 0 && - rect.width() == width && rect.height() == height); -} - -bool QVGPaintEngine::isDefaultClipRect(const QRect& rect) -{ - QPaintDevice *pdev = paintDevice(); - int width = pdev->width(); - int height = pdev->height(); - - return (rect.x() == 0 && rect.y() == 0 && - rect.width() == width && rect.height() == height); -} - -void QVGPaintEngine::clipEnabledChanged() -{ -#if defined(QVG_SCISSOR_CLIP) - vgSeti(VG_MASKING, VG_FALSE); // disable mask fallback - updateScissor(); -#else - Q_D(QVGPaintEngine); - QVGPainterState *s = state(); - d->dirty |= QPaintEngine::DirtyClipEnabled; - if (s->clipEnabled && s->clipOperation != Qt::NoClip) { - // Replay the entire clip stack to put the mask into the right state. - d->maskValid = false; - d->maskIsSet = true; - d->scissorMask = false; - d->maskRect = QRect(); - s->clipRegion = defaultClipRegion(); - d->replayClipOperations(); - d->transform = s->transform(); - d->updateTransform(paintDevice()); - } else { - vgSeti(VG_MASKING, VG_FALSE); - d->maskValid = false; - d->maskIsSet = false; - d->scissorMask = false; - d->maskRect = QRect(); - } -#endif -} - -void QVGPaintEngine::penChanged() -{ - Q_D(QVGPaintEngine); - d->dirty |= QPaintEngine::DirtyPen; - - d->hasExtendedRadialGradientPen = - state()->pen.style() != Qt::NoPen && d->needsEmulation(state()->pen.brush()); -} - -void QVGPaintEngine::brushChanged() -{ - Q_D(QVGPaintEngine); - d->dirty |= QPaintEngine::DirtyBrush; - - d->hasExtendedRadialGradientPen = d->needsEmulation(state()->brush); -} - -void QVGPaintEngine::brushOriginChanged() -{ - Q_D(QVGPaintEngine); - d->dirty |= QPaintEngine::DirtyBrushOrigin; - d->brushOrigin = state()->brushOrigin; - d->forcePenChange = true; - d->forceBrushChange = true; -} - -void QVGPaintEngine::opacityChanged() -{ - Q_D(QVGPaintEngine); - d->dirty |= QPaintEngine::DirtyOpacity; - d->opacity = state()->opacity; - d->forcePenChange = true; - d->forceBrushChange = true; -} - -void QVGPaintEngine::compositionModeChanged() -{ - Q_D(QVGPaintEngine); - d->dirty |= QPaintEngine::DirtyCompositionMode; - - VGint vgMode = VG_BLEND_SRC_OVER; - - switch (state()->composition_mode) { - case QPainter::CompositionMode_SourceOver: - vgMode = VG_BLEND_SRC_OVER; - break; - case QPainter::CompositionMode_DestinationOver: - vgMode = VG_BLEND_DST_OVER; - break; - case QPainter::CompositionMode_Source: - vgMode = VG_BLEND_SRC; - break; - case QPainter::CompositionMode_SourceIn: - vgMode = VG_BLEND_SRC_IN; - break; - case QPainter::CompositionMode_DestinationIn: - vgMode = VG_BLEND_DST_IN; - break; - case QPainter::CompositionMode_Plus: - vgMode = VG_BLEND_ADDITIVE; - break; - case QPainter::CompositionMode_Multiply: - vgMode = VG_BLEND_MULTIPLY; - break; - case QPainter::CompositionMode_Screen: - vgMode = VG_BLEND_SCREEN; - break; - case QPainter::CompositionMode_Darken: - vgMode = VG_BLEND_DARKEN; - break; - case QPainter::CompositionMode_Lighten: - vgMode = VG_BLEND_LIGHTEN; - break; - default: - if (d->hasAdvancedBlending) { - switch (state()->composition_mode) { - case QPainter::CompositionMode_Overlay: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_OVERLAY_KHR; - break; - case QPainter::CompositionMode_ColorDodge: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_COLORDODGE_KHR; - break; - case QPainter::CompositionMode_ColorBurn: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_COLORBURN_KHR; - break; - case QPainter::CompositionMode_HardLight: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_HARDLIGHT_KHR; - break; - case QPainter::CompositionMode_SoftLight: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_SOFTLIGHT_KHR; - break; - case QPainter::CompositionMode_Difference: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_DIFFERENCE_KHR; - break; - case QPainter::CompositionMode_Exclusion: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_EXCLUSION_KHR; - break; - case QPainter::CompositionMode_SourceOut: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_SRC_OUT_KHR; - break; - case QPainter::CompositionMode_DestinationOut: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_DST_OUT_KHR; - break; - case QPainter::CompositionMode_SourceAtop: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_SRC_ATOP_KHR; - break; - case QPainter::CompositionMode_DestinationAtop: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_DST_ATOP_KHR; - break; - case QPainter::CompositionMode_Xor: - vgMode = QVGPaintEnginePrivate::QT_VG_BLEND_XOR_KHR; - break; - default: break; // Fall back to VG_BLEND_SRC_OVER. - } - } - if (vgMode == VG_BLEND_SRC_OVER) - qWarning() << "QVGPaintEngine::compositionModeChanged unsupported mode" << state()->composition_mode; - break; - } - - d->setBlendMode(VGBlendMode(vgMode)); -} - -void QVGPaintEngine::renderHintsChanged() -{ - Q_D(QVGPaintEngine); - d->dirty |= QPaintEngine::DirtyHints; - - QPainter::RenderHints hints = state()->renderHints; - - VGRenderingQuality rq = - (hints & QPainter::Antialiasing) - ? VG_RENDERING_QUALITY_BETTER - : VG_RENDERING_QUALITY_NONANTIALIASED; - VGImageQuality iq = - (hints & QPainter::SmoothPixmapTransform) - ? VG_IMAGE_QUALITY_BETTER - : VG_IMAGE_QUALITY_NONANTIALIASED; - - d->setRenderingQuality(rq); - d->setImageQuality(iq); -} - -void QVGPaintEngine::transformChanged() -{ - Q_D(QVGPaintEngine); - QVGPainterState *s = state(); - d->dirty |= QPaintEngine::DirtyTransform; - d->transform = s->transform(); - qreal oldPenScale = d->penScale; - d->updateTransform(paintDevice()); - if (d->penScale != oldPenScale) - d->forcePenChange = true; -} - -bool QVGPaintEngine::clearRect(const QRectF &rect, const QColor &color) -{ - Q_D(QVGPaintEngine); - QVGPainterState *s = state(); - if (!s->clipEnabled || s->clipOperation == Qt::NoClip) { - QRect r = d->transform.mapRect(rect).toRect(); - int height = paintDevice()->height(); - if (d->clearColor != color || d->clearOpacity != s->opacity) { - VGfloat values[4]; - values[0] = color.redF(); - values[1] = color.greenF(); - values[2] = color.blueF(); - values[3] = color.alphaF() * s->opacity; - vgSetfv(VG_CLEAR_COLOR, 4, values); - d->clearColor = color; - d->clearOpacity = s->opacity; - } - vgClear(r.x(), height - r.y() - r.height(), - r.width(), r.height()); - return true; - } - return false; -} - -void QVGPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) -{ - Q_D(QVGPaintEngine); - - if (brush.style() == Qt::NoBrush) - return; - - // Check to see if we can use vgClear() for faster filling. - if (brush.style() == Qt::SolidPattern && brush.isOpaque() && - clipTransformIsSimple(d->transform) && d->opacity == 1.0f && - clearRect(rect, brush.color())) { - return; - } - - if (d->needsEmulation(brush)) { - QPaintEngineEx::fillRect(rect, brush); - return; - } - -#if !defined(QVG_NO_MODIFY_PATH) - VGfloat coords[8]; - if (d->simpleTransform) { - coords[0] = rect.x(); - coords[1] = rect.y(); - coords[2] = rect.x() + rect.width(); - coords[3] = coords[1]; - coords[4] = coords[2]; - coords[5] = rect.y() + rect.height(); - coords[6] = coords[0]; - coords[7] = coords[5]; - } else { - QPointF tl = d->transform.map(rect.topLeft()); - QPointF tr = d->transform.map(rect.topRight()); - QPointF bl = d->transform.map(rect.bottomLeft()); - QPointF br = d->transform.map(rect.bottomRight()); - coords[0] = tl.x(); - coords[1] = tl.y(); - coords[2] = tr.x(); - coords[3] = tr.y(); - coords[4] = br.x(); - coords[5] = br.y(); - coords[6] = bl.x(); - coords[7] = bl.y(); - } - vgModifyPathCoords(d->rectPath, 0, 4, coords); - d->fill(d->rectPath, brush); -#else - QPaintEngineEx::fillRect(rect, brush); -#endif -} - -void QVGPaintEngine::fillRect(const QRectF &rect, const QColor &color) -{ - Q_D(QVGPaintEngine); - - // Check to see if we can use vgClear() for faster filling. - 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->simpleTransform) { - coords[0] = rect.x(); - coords[1] = rect.y(); - coords[2] = rect.x() + rect.width(); - coords[3] = coords[1]; - coords[4] = coords[2]; - coords[5] = rect.y() + rect.height(); - coords[6] = coords[0]; - coords[7] = coords[5]; - } else { - QPointF tl = d->transform.map(rect.topLeft()); - QPointF tr = d->transform.map(rect.topRight()); - QPointF bl = d->transform.map(rect.bottomLeft()); - QPointF br = d->transform.map(rect.bottomRight()); - coords[0] = tl.x(); - coords[1] = tl.y(); - coords[2] = tr.x(); - coords[3] = tr.y(); - coords[4] = br.x(); - coords[5] = br.y(); - coords[6] = bl.x(); - coords[7] = bl.y(); - } - vgModifyPathCoords(d->rectPath, 0, 4, coords); - d->fill(d->rectPath, QBrush(color)); -#else - QPaintEngineEx::fillRect(rect, QBrush(color)); -#endif -} - -void QVGPaintEngine::drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode) -{ - Q_D(QVGPaintEngine); - if (d->needsEmulation()) { - QPaintEngineEx::drawRoundedRect(rect, xrad, yrad, mode); - return; - } - if (d->simpleTransform) { - QVGPainterState *s = state(); - VGPath vgpath = d->roundedRectPath(rect, xrad, yrad, mode); - d->draw(vgpath, s->pen, s->brush); -#if defined(QVG_NO_MODIFY_PATH) - vgDestroyPath(vgpath); -#endif - } else { - QPaintEngineEx::drawRoundedRect(rect, xrad, yrad, mode); - } -} - -void QVGPaintEngine::drawRects(const QRect *rects, int rectCount) -{ -#if !defined(QVG_NO_MODIFY_PATH) - Q_D(QVGPaintEngine); - if (d->needsEmulation()) { - QPaintEngineEx::drawRects(rects, rectCount); - return; - } - QVGPainterState *s = state(); - for (int i = 0; i < rectCount; ++i, ++rects) { - VGfloat coords[8]; - if (d->simpleTransform) { - coords[0] = rects->x(); - coords[1] = rects->y(); - coords[2] = rects->x() + rects->width(); - coords[3] = coords[1]; - coords[4] = coords[2]; - coords[5] = rects->y() + rects->height(); - coords[6] = coords[0]; - coords[7] = coords[5]; - } else { - QPointF tl = d->transform.map(QPointF(rects->x(), rects->y())); - QPointF tr = d->transform.map(QPointF(rects->x() + rects->width(), - rects->y())); - QPointF bl = d->transform.map(QPointF(rects->x(), - rects->y() + rects->height())); - QPointF br = d->transform.map(QPointF(rects->x() + rects->width(), - rects->y() + rects->height())); - coords[0] = tl.x(); - coords[1] = tl.y(); - coords[2] = tr.x(); - coords[3] = tr.y(); - coords[4] = br.x(); - coords[5] = br.y(); - coords[6] = bl.x(); - coords[7] = bl.y(); - } - vgModifyPathCoords(d->rectPath, 0, 4, coords); - d->draw(d->rectPath, s->pen, s->brush); - } -#else - QPaintEngineEx::drawRects(rects, rectCount); -#endif -} - -void QVGPaintEngine::drawRects(const QRectF *rects, int rectCount) -{ -#if !defined(QVG_NO_MODIFY_PATH) - Q_D(QVGPaintEngine); - if (d->needsEmulation()) { - QPaintEngineEx::drawRects(rects, rectCount); - return; - } - QVGPainterState *s = state(); - for (int i = 0; i < rectCount; ++i, ++rects) { - VGfloat coords[8]; - if (d->simpleTransform) { - coords[0] = rects->x(); - coords[1] = rects->y(); - coords[2] = rects->x() + rects->width(); - coords[3] = coords[1]; - coords[4] = coords[2]; - coords[5] = rects->y() + rects->height(); - coords[6] = coords[0]; - coords[7] = coords[5]; - } else { - QPointF tl = d->transform.map(rects->topLeft()); - QPointF tr = d->transform.map(rects->topRight()); - QPointF bl = d->transform.map(rects->bottomLeft()); - QPointF br = d->transform.map(rects->bottomRight()); - coords[0] = tl.x(); - coords[1] = tl.y(); - coords[2] = tr.x(); - coords[3] = tr.y(); - coords[4] = br.x(); - coords[5] = br.y(); - coords[6] = bl.x(); - coords[7] = bl.y(); - } - vgModifyPathCoords(d->rectPath, 0, 4, coords); - d->draw(d->rectPath, s->pen, s->brush); - } -#else - QPaintEngineEx::drawRects(rects, rectCount); -#endif -} - -void QVGPaintEngine::drawLines(const QLine *lines, int lineCount) -{ -#if !defined(QVG_NO_MODIFY_PATH) - Q_D(QVGPaintEngine); - if (d->needsEmulation()) { - QPaintEngineEx::drawLines(lines, lineCount); - return; - } - QVGPainterState *s = state(); - for (int i = 0; i < lineCount; ++i, ++lines) { - VGfloat coords[4]; - if (d->simpleTransform) { - coords[0] = lines->x1(); - coords[1] = lines->y1(); - coords[2] = lines->x2(); - coords[3] = lines->y2(); - } else { - QPointF p1 = d->transform.map(QPointF(lines->x1(), lines->y1())); - QPointF p2 = d->transform.map(QPointF(lines->x2(), lines->y2())); - coords[0] = p1.x(); - coords[1] = p1.y(); - coords[2] = p2.x(); - coords[3] = p2.y(); - } - vgModifyPathCoords(d->linePath, 0, 2, coords); - d->stroke(d->linePath, s->pen); - } -#else - QPaintEngineEx::drawLines(lines, lineCount); -#endif -} - -void QVGPaintEngine::drawLines(const QLineF *lines, int lineCount) -{ -#if !defined(QVG_NO_MODIFY_PATH) - Q_D(QVGPaintEngine); - if (d->needsEmulation()) { - QPaintEngineEx::drawLines(lines, lineCount); - return; - } - QVGPainterState *s = state(); - for (int i = 0; i < lineCount; ++i, ++lines) { - VGfloat coords[4]; - if (d->simpleTransform) { - coords[0] = lines->x1(); - coords[1] = lines->y1(); - coords[2] = lines->x2(); - coords[3] = lines->y2(); - } else { - QPointF p1 = d->transform.map(lines->p1()); - QPointF p2 = d->transform.map(lines->p2()); - coords[0] = p1.x(); - coords[1] = p1.y(); - coords[2] = p2.x(); - coords[3] = p2.y(); - } - vgModifyPathCoords(d->linePath, 0, 2, coords); - d->stroke(d->linePath, s->pen); - } -#else - QPaintEngineEx::drawLines(lines, lineCount); -#endif -} - -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->needsEmulation()) { - QPaintEngineEx::drawEllipse(r); - return; - } - if (d->simpleTransform) { - QVGPainterState *s = state(); - VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 4, // segmentCapacityHint - 12, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - static VGubyte segments[4] = { - VG_MOVE_TO_ABS, - VG_SCCWARC_TO_REL, - VG_SCCWARC_TO_REL, - VG_CLOSE_PATH - }; - VGfloat coords[12]; - VGfloat halfwid = r.width() / 2; - VGfloat halfht = r.height() / 2; - coords[0] = r.x() + r.width(); - coords[1] = r.y() + halfht; - coords[2] = halfwid; - coords[3] = halfht; - coords[4] = 0.0f; - coords[5] = -r.width(); - coords[6] = 0.0f; - coords[7] = halfwid; - coords[8] = halfht; - coords[9] = 0.0f; - coords[10] = r.width(); - coords[11] = 0.0f; - vgAppendPathData(path, 4, segments, coords); - d->draw(path, s->pen, s->brush); - vgDestroyPath(path); - } else { - // The projective transform version of an ellipse is difficult. - // Generate a QVectorPath containing cubic curves and transform that. - QPaintEngineEx::drawEllipse(r); - } -} - -void QVGPaintEngine::drawEllipse(const QRect &r) -{ - drawEllipse(QRectF(r)); -} - -void QVGPaintEngine::drawPath(const QPainterPath &path) -{ - // Shortcut past the QPainterPath -> QVectorPath conversion, - // converting the QPainterPath directly into a VGPath. - Q_D(QVGPaintEngine); - if (d->needsEmulation()) { - QPaintEngineEx::drawPath(path); - return; - } - QVGPainterState *s = state(); - VGPath vgpath = d->painterPathToVGPath(path); - if (path.fillRule() == Qt::OddEvenFill) - d->draw(vgpath, s->pen, s->brush, VG_EVEN_ODD); - else - d->draw(vgpath, s->pen, s->brush, VG_NON_ZERO); - vgDestroyPath(vgpath); -} - -void QVGPaintEngine::drawPoints(const QPointF *points, int pointCount) -{ -#if !defined(QVG_NO_MODIFY_PATH) - Q_D(QVGPaintEngine); - - if (d->needsPenEmulation()) { - QPaintEngineEx::drawPoints(points, pointCount); - return; - } - - // Set up a new pen if necessary. - QPen pen = state()->pen; - if (pen.style() == Qt::NoPen) - return; - if (pen.capStyle() == Qt::FlatCap) - pen.setCapStyle(Qt::SquareCap); - - for (int i = 0; i < pointCount; ++i, ++points) { - VGfloat coords[4]; - if (d->simpleTransform) { - coords[0] = points->x(); - coords[1] = points->y(); - coords[2] = coords[0]; - coords[3] = coords[1]; - } else { - QPointF p = d->transform.map(*points); - coords[0] = p.x(); - coords[1] = p.y(); - coords[2] = coords[0]; - coords[3] = coords[1]; - } - vgModifyPathCoords(d->linePath, 0, 2, coords); - d->stroke(d->linePath, pen); - } -#else - QPaintEngineEx::drawPoints(points, pointCount); -#endif -} - -void QVGPaintEngine::drawPoints(const QPoint *points, int pointCount) -{ -#if !defined(QVG_NO_MODIFY_PATH) - Q_D(QVGPaintEngine); - - if (d->needsEmulation()) { - QPaintEngineEx::drawPoints(points, pointCount); - return; - } - - // Set up a new pen if necessary. - QPen pen = state()->pen; - if (pen.style() == Qt::NoPen) - return; - if (pen.capStyle() == Qt::FlatCap) - pen.setCapStyle(Qt::SquareCap); - - for (int i = 0; i < pointCount; ++i, ++points) { - VGfloat coords[4]; - if (d->simpleTransform) { - coords[0] = points->x(); - coords[1] = points->y(); - coords[2] = coords[0]; - coords[3] = coords[1]; - } else { - QPointF p = d->transform.map(QPointF(*points)); - coords[0] = p.x(); - coords[1] = p.y(); - coords[2] = coords[0]; - coords[3] = coords[1]; - } - vgModifyPathCoords(d->linePath, 0, 2, coords); - d->stroke(d->linePath, pen); - } -#else - QPaintEngineEx::drawPoints(points, pointCount); -#endif -} - -void QVGPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) -{ - Q_D(QVGPaintEngine); - - if (d->needsEmulation()) { - QPaintEngineEx::drawPolygon(points, pointCount, mode); - return; - } - - QVGPainterState *s = state(); - VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - pointCount + 1, // segmentCapacityHint - pointCount * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - QVarLengthArray coords; - QVarLengthArray segments; - for (int i = 0; i < pointCount; ++i, ++points) { - if (d->simpleTransform) { - coords.append(points->x()); - coords.append(points->y()); - } else { - QPointF temp = d->transform.map(*points); - coords.append(temp.x()); - coords.append(temp.y()); - } - if (i == 0) - segments.append(VG_MOVE_TO_ABS); - else - segments.append(VG_LINE_TO_ABS); - } - if (mode != QPaintEngine::PolylineMode) - segments.append(VG_CLOSE_PATH); - vgAppendPathData(path, segments.count(), - segments.constData(), coords.constData()); - switch (mode) { - case QPaintEngine::WindingMode: - d->draw(path, s->pen, s->brush, VG_NON_ZERO); - break; - - case QPaintEngine::PolylineMode: - d->stroke(path, s->pen); - break; - - default: - d->draw(path, s->pen, s->brush, VG_EVEN_ODD); - break; - } - vgDestroyPath(path); -} - -void QVGPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) -{ - Q_D(QVGPaintEngine); - - if (d->needsEmulation()) { - QPaintEngineEx::drawPolygon(points, pointCount, mode); - return; - } - - QVGPainterState *s = state(); - VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - pointCount + 1, // segmentCapacityHint - pointCount * 2, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - QVarLengthArray coords; - QVarLengthArray segments; - for (int i = 0; i < pointCount; ++i, ++points) { - if (d->simpleTransform) { - coords.append(points->x()); - coords.append(points->y()); - } else { - QPointF temp = d->transform.map(QPointF(*points)); - coords.append(temp.x()); - coords.append(temp.y()); - } - if (i == 0) - segments.append(VG_MOVE_TO_ABS); - else - segments.append(VG_LINE_TO_ABS); - } - if (mode != QPaintEngine::PolylineMode) - segments.append(VG_CLOSE_PATH); - vgAppendPathData(path, segments.count(), - segments.constData(), coords.constData()); - switch (mode) { - case QPaintEngine::WindingMode: - d->draw(path, s->pen, s->brush, VG_NON_ZERO); - break; - - case QPaintEngine::PolylineMode: - d->stroke(path, s->pen); - break; - - default: - d->draw(path, s->pen, s->brush, VG_EVEN_ODD); - break; - } - vgDestroyPath(path); -} - -void QVGPaintEnginePrivate::setImageOptions() -{ - if (opacity != 1.0f && simpleTransform) { - if (opacity != paintOpacity) { - VGfloat values[4]; - values[0] = 1.0f; - values[1] = 1.0f; - values[2] = 1.0f; - values[3] = opacity; - vgSetParameterfv(opacityPaint, VG_PAINT_COLOR, 4, values); - paintOpacity = opacity; - } - if (fillPaint != opacityPaint) { - vgSetPaint(opacityPaint, VG_FILL_PATH); - fillPaint = opacityPaint; - } - setImageMode(VG_DRAW_IMAGE_MULTIPLY); - } else { - setImageMode(VG_DRAW_IMAGE_NORMAL); - } -} - -void QVGPaintEnginePrivate::systemStateChanged() -{ - q->updateScissor(); -} - -static void drawVGImage(QVGPaintEnginePrivate *d, - const QRectF& r, VGImage vgImg, - const QSize& imageSize, const QRectF& sr) -{ - if (vgImg == VG_INVALID_HANDLE) - return; - VGImage child = VG_INVALID_HANDLE; - - if (sr.topLeft().isNull() && sr.size() == imageSize) { - child = vgImg; - } else { - QRect src = sr.toRect(); -#if !defined(QT_SHIVAVG) - child = vgChildImage(vgImg, src.x(), src.y(), src.width(), src.height()); -#else - child = vgImg; // XXX: ShivaVG doesn't have vgChildImage(). -#endif - } - - 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(); - transform.translate(r.x(), r.y()); - transform.scale(scaleX, scaleY); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - - d->setImageOptions(); - vgDrawImage(child); - - if(child != vgImg) - vgDestroyImage(child); -} - -static void drawVGImage(QVGPaintEnginePrivate *d, - const QPointF& pos, VGImage vgImg) -{ - if (vgImg == VG_INVALID_HANDLE) - return; - - QTransform transform(d->imageTransform); - transform.translate(pos.x(), pos.y()); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - - d->setImageOptions(); - vgDrawImage(vgImg); -} - -static void drawImageTiled(QVGPaintEnginePrivate *d, - const QRectF &r, - const QImage &image, - const QRectF &sr = QRectF()) -{ - const int minTileSize = 16; - int tileWidth = 512; - int tileHeight = tileWidth; - - VGImageFormat tileFormat = qt_vg_image_to_vg_format(image.format()); - VGImage tile = VG_INVALID_HANDLE; - QVGImagePool *pool = QVGImagePool::instance(); - while (tile == VG_INVALID_HANDLE && tileWidth >= minTileSize) { - tile = pool->createPermanentImage(tileFormat, tileWidth, tileHeight, - VG_IMAGE_QUALITY_FASTER); - if (tile == VG_INVALID_HANDLE) { - tileWidth /= 2; - tileHeight /= 2; - } - } - if (tile == VG_INVALID_HANDLE) { - qWarning("drawImageTiled: Failed to create %dx%d tile, giving up", tileWidth, tileHeight); - return; - } - - VGfloat opacityMatrix[20] = { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, d->opacity, - 0.0f, 0.0f, 0.0f, 0.0f - }; - VGImage tileWithOpacity = VG_INVALID_HANDLE; - if (d->opacity != 1) { - tileWithOpacity = pool->createPermanentImage(VG_sARGB_8888_PRE, - tileWidth, tileHeight, VG_IMAGE_QUALITY_FASTER); - if (tileWithOpacity == VG_INVALID_HANDLE) - qWarning("drawImageTiled: Failed to create extra tile, ignoring opacity"); - } - - QRect sourceRect = sr.toRect(); - if (sourceRect.isNull()) - sourceRect = QRect(0, 0, image.width(), image.height()); - - VGfloat scaleX = r.width() / sourceRect.width(); - VGfloat scaleY = r.height() / sourceRect.height(); - - d->setImageOptions(); - - for (int y = sourceRect.y(); y < sourceRect.height(); y += tileHeight) { - int h = qMin(tileHeight, sourceRect.height() - y); - if (h < 1) - break; - for (int x = sourceRect.x(); x < sourceRect.width(); x += tileWidth) { - int w = qMin(tileWidth, sourceRect.width() - x); - if (w < 1) - break; - - int bytesPerPixel = image.depth() / 8; - const uchar *sptr = image.constBits() + x * bytesPerPixel + y * image.bytesPerLine(); - vgImageSubData(tile, sptr, image.bytesPerLine(), tileFormat, 0, 0, w, h); - - QTransform transform(d->imageTransform); - transform.translate(r.x() + x, r.y() + y); - transform.scale(scaleX, scaleY); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - - VGImage actualTile = tile; - if (tileWithOpacity != VG_INVALID_HANDLE) { - vgColorMatrix(tileWithOpacity, actualTile, opacityMatrix); - if (w < tileWidth || h < tileHeight) - actualTile = vgChildImage(tileWithOpacity, 0, 0, w, h); - else - actualTile = tileWithOpacity; - } else if (w < tileWidth || h < tileHeight) { - actualTile = vgChildImage(tile, 0, 0, w, h); - } - vgDrawImage(actualTile); - - if (actualTile != tile && actualTile != tileWithOpacity) - vgDestroyImage(actualTile); - } - } - - vgDestroyImage(tile); - if (tileWithOpacity != VG_INVALID_HANDLE) - vgDestroyImage(tileWithOpacity); -} - -// Used by qpixmapfilter_vg.cpp to draw filtered VGImage's. -void qt_vg_drawVGImage(QPainter *painter, const QPointF& pos, VGImage vgImg) -{ - QVGPaintEngine *engine = - static_cast(painter->paintEngine()); - drawVGImage(engine->vgPrivate(), pos, vgImg); -} - -// Used by qpixmapfilter_vg.cpp to draw filtered VGImage's as a stencil. -void qt_vg_drawVGImageStencil - (QPainter *painter, const QPointF& pos, VGImage vgImg, const QBrush& brush) -{ - QVGPaintEngine *engine = - static_cast(painter->paintEngine()); - - QVGPaintEnginePrivate *d = engine->vgPrivate(); - - QTransform transform(d->imageTransform); - transform.translate(pos.x(), pos.y()); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - - d->ensureBrush(brush); - d->setImageMode(VG_DRAW_IMAGE_STENCIL); - vgDrawImage(vgImg); -} - -bool QVGPaintEngine::canVgWritePixels(const QImage &image) const -{ - Q_D(const QVGPaintEngine); - - // qt_vg_image_to_vg_format returns VG_sARGB_8888 as - // fallback case if no matching VG format is found. - // If given image format is not Format_ARGB32 and returned - // format is VG_sARGB_8888, it means that no match was - // found. In that case vgWritePixels cannot be used. - // Also 1-bit formats cannot be used directly either. - if ((image.format() != QImage::Format_ARGB32 - && qt_vg_image_to_vg_format(image.format()) == VG_sARGB_8888) - || image.depth() == 1) { - return false; - } - - // vgWritePixels ignores masking, blending and xforms so we can only use it if - // ALL of the following conditions are true: - // - It is a simple translate, or a scale of -1 on the y-axis (inverted) - // - The opacity is totally opaque - // - The composition mode is "source" OR "source over" provided the image is opaque - return ( d->imageTransform.type() <= QTransform::TxScale - && d->imageTransform.m11() == 1.0 && qAbs(d->imageTransform.m22()) == 1.0) - && d->opacity == 1.0f - && (d->blendMode == VG_BLEND_SRC || (d->blendMode == VG_BLEND_SRC_OVER && - !image.hasAlphaChannel())); -} - -void QVGPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) -{ - QPixmapData *pd = pm.pixmapData(); - if (!pd) - return; // null QPixmap - if (pd->classId() == QPixmapData::OpenVGClass) { - Q_D(QVGPaintEngine); - QVGPixmapData *vgpd = static_cast(pd); - if (!vgpd->isValid()) - return; - if (d->simpleTransform) - drawVGImage(d, r, vgpd->toVGImage(), vgpd->size(), sr); - else - drawVGImage(d, r, vgpd->toVGImage(d->opacity), vgpd->size(), sr); - - if(!vgpd->failedToAlloc) - return; - - // try to reallocate next time if reasonable small pixmap - QSize screenSize = QApplication::desktop()->screenGeometry().size(); - if (pm.size().width() <= screenSize.width() - && pm.size().height() <= screenSize.height()) - vgpd->failedToAlloc = false; - - vgpd->source.beginDataAccess(); - drawImage(r, vgpd->source.imageRef(), sr, Qt::AutoColor); - vgpd->source.endDataAccess(true); - } else { - drawImage(r, *(pd->buffer()), sr, Qt::AutoColor); - } -} - -void QVGPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm) -{ - QPixmapData *pd = pm.pixmapData(); - if (!pd) - return; // null QPixmap - if (pd->classId() == QPixmapData::OpenVGClass) { - Q_D(QVGPaintEngine); - QVGPixmapData *vgpd = static_cast(pd); - if (!vgpd->isValid()) - return; - if (d->simpleTransform) - drawVGImage(d, pos, vgpd->toVGImage()); - else - drawVGImage(d, pos, vgpd->toVGImage(d->opacity)); - - if (!vgpd->failedToAlloc) - return; - - // try to reallocate next time if reasonable small pixmap - QSize screenSize = QApplication::desktop()->screenGeometry().size(); - if (pm.size().width() <= screenSize.width() - && pm.size().height() <= screenSize.height()) - vgpd->failedToAlloc = false; - - vgpd->source.beginDataAccess(); - drawImage(pos, vgpd->source.imageRef()); - vgpd->source.endDataAccess(true); - } else { - drawImage(pos, *(pd->buffer())); - } -} - -void QVGPaintEngine::drawImage - (const QRectF &r, const QImage &image, const QRectF &sr, - Qt::ImageConversionFlags flags) -{ - Q_D(QVGPaintEngine); - if (image.isNull()) - return; - VGImage vgImg; - if (d->simpleTransform || d->opacity == 1.0f) - vgImg = toVGImageSubRect(image, sr.toRect(), flags); - else - vgImg = toVGImageWithOpacitySubRect(image, d->opacity, sr.toRect()); - if (vgImg != VG_INVALID_HANDLE) { - if (r.size() == sr.size()) { - drawVGImage(d, r.topLeft(), vgImg); - } else { - drawVGImage(d, r, vgImg, sr.size().toSize(), - QRectF(QPointF(0, 0), sr.size())); - } - } else { - if (canVgWritePixels(image) && (r.size() == sr.size()) && !flags) { - // Optimization for straight blits, no blending - int x = sr.x(); - int y = sr.y(); - int bpp = image.depth() >> 3; // bytes - int offset = 0; - int bpl = image.bytesPerLine(); - if (d->imageTransform.m22() < 0) { - // inverted - offset = ((y + sr.height()) * bpl) - ((image.width() - x) * bpp); - bpl = -bpl; - } else { - offset = (y * bpl) + (x * bpp); - } - const uchar *bits = image.constBits() + offset; - - QPointF mapped = d->imageTransform.map(r.topLeft()); - vgWritePixels(bits, bpl, qt_vg_image_to_vg_format(image.format()), - mapped.x(), mapped.y() - sr.height(), r.width(), r.height()); - return; - } else { - // Monochrome images need to use the vgChildImage() path. - vgImg = toVGImage(image, flags); - if (vgImg == VG_INVALID_HANDLE) - drawImageTiled(d, r, image, sr); - else - drawVGImage(d, r, vgImg, image.size(), sr); - } - } - vgDestroyImage(vgImg); -} - -void QVGPaintEngine::drawImage(const QPointF &pos, const QImage &image) -{ - Q_D(QVGPaintEngine); - if (image.isNull()) - return; - VGImage vgImg; - if (canVgWritePixels(image)) { - // Optimization for straight blits, no blending - bool inverted = (d->imageTransform.m22() < 0); - const uchar *bits = inverted ? image.constBits() + image.byteCount() : image.constBits(); - int bpl = inverted ? -image.bytesPerLine() : image.bytesPerLine(); - - QPointF mapped = d->imageTransform.map(pos); - vgWritePixels(bits, bpl, qt_vg_image_to_vg_format(image.format()), - mapped.x(), mapped.y() - image.height(), image.width(), image.height()); - return; - } else if (d->simpleTransform || d->opacity == 1.0f) { - vgImg = toVGImage(image); - } else { - vgImg = toVGImageWithOpacity(image, d->opacity); - } - if (vgImg == VG_INVALID_HANDLE) - drawImageTiled(d, QRectF(pos, image.size()), image); - else - drawVGImage(d, pos, vgImg); - vgDestroyImage(vgImg); -} - -void QVGPaintEngine::drawTiledPixmap - (const QRectF &r, const QPixmap &pixmap, const QPointF &s) -{ - QBrush brush(state()->pen.color(), pixmap); - QTransform xform = QTransform::fromTranslate(r.x() - s.x(), r.y() - s.y()); - brush.setTransform(xform); - fillRect(r, brush); -} - -// Best performance will be achieved with QDrawPixmaps::OpaqueHint -// (i.e. no opacity), no rotation or scaling, and drawing the full -// pixmap rather than parts of the pixmap. Even having just one of -// these conditions will improve performance. -void QVGPaintEngine::drawPixmapFragments(const QPainter::PixmapFragment *drawingData, int dataCount, - const QPixmap &pixmap, QFlags hints) -{ -#if !defined(QT_SHIVAVG) - Q_D(QVGPaintEngine); - - // If the pixmap is not VG, or the transformation is projective, - // then fall back to the default implementation. - QPixmapData *pd = pixmap.pixmapData(); - if (!pd) - return; // null QPixmap - if (pd->classId() != QPixmapData::OpenVGClass || !d->simpleTransform) { - QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints); - return; - } - - // Bail out if nothing to do. - if (dataCount <= 0) - return; - - // Bail out if we don't have a usable VGImage for the pixmap. - QVGPixmapData *vgpd = static_cast(pd); - if (!vgpd->isValid()) - return; - VGImage vgImg = vgpd->toVGImage(); - if (vgImg == VG_INVALID_HANDLE) - return; - - // We cache the results of any vgChildImage() calls because the - // same child is very likely to be used over and over in particle - // systems. However, performance is even better if vgChildImage() - // isn't needed at all, so use full source rects where possible. - QVarLengthArray cachedImages; - QVarLengthArray cachedSources; - - // Select the opacity paint object. - if ((hints & QPainter::OpaqueHint) != 0 && d->opacity == 1.0f) { - d->setImageMode(VG_DRAW_IMAGE_NORMAL); - } else { - hints = 0; - if (d->fillPaint != d->opacityPaint) { - vgSetPaint(d->opacityPaint, VG_FILL_PATH); - d->fillPaint = d->opacityPaint; - } - } - - for (int i = 0; i < dataCount; ++i) { - QTransform transform(d->imageTransform); - transform.translate(drawingData[i].x, drawingData[i].y); - transform.rotate(drawingData[i].rotation); - - VGImage child; - QSize imageSize = vgpd->size(); - QRectF sr(drawingData[i].sourceLeft, drawingData[i].sourceTop, - drawingData[i].width, drawingData[i].height); - if (sr.topLeft().isNull() && sr.size() == imageSize) { - child = vgImg; - } else { - // Look for a previous child with the same source rectangle - // to avoid constantly calling vgChildImage()/vgDestroyImage(). - QRect src = sr.toRect(); - int j; - for (j = 0; j < cachedSources.size(); ++j) { - if (cachedSources[j] == src) - break; - } - if (j < cachedSources.size()) { - child = cachedImages[j]; - } else { - child = vgChildImage - (vgImg, src.x(), src.y(), src.width(), src.height()); - cachedImages.append(child); - cachedSources.append(src); - } - } - - VGfloat scaleX = drawingData[i].scaleX; - VGfloat scaleY = drawingData[i].scaleY; - transform.translate(-0.5 * scaleX * sr.width(), - -0.5 * scaleY * sr.height()); - transform.scale(scaleX, scaleY); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - - if ((hints & QPainter::OpaqueHint) == 0) { - qreal opacity = d->opacity * drawingData[i].opacity; - if (opacity != 1.0f) { - if (d->paintOpacity != opacity) { - VGfloat values[4]; - values[0] = 1.0f; - values[1] = 1.0f; - values[2] = 1.0f; - values[3] = opacity; - d->paintOpacity = opacity; - vgSetParameterfv - (d->opacityPaint, VG_PAINT_COLOR, 4, values); - } - d->setImageMode(VG_DRAW_IMAGE_MULTIPLY); - } else { - d->setImageMode(VG_DRAW_IMAGE_NORMAL); - } - } - - vgDrawImage(child); - } - - // Destroy the cached child sub-images. - for (int i = 0; i < cachedImages.size(); ++i) - vgDestroyImage(cachedImages[i]); -#else - QPaintEngineEx::drawPixmapFragments(drawingData, dataCount, pixmap, hints); -#endif -} - -QVGFontEngineCleaner::QVGFontEngineCleaner(QVGPaintEnginePrivate *d) - : QObject(), d_ptr(d) -{ -} - -QVGFontEngineCleaner::~QVGFontEngineCleaner() -{ -} - -void QVGFontEngineCleaner::fontEngineDestroyed() -{ -#if !defined(QVG_NO_DRAW_GLYPHS) - QFontEngine *engine = static_cast(sender()); - QVGFontCache::Iterator it = d_ptr->fontCache.find(engine); - if (it != d_ptr->fontCache.end()) { - delete it.value(); - d_ptr->fontCache.erase(it); - } -#endif -} - -#if !defined(QVG_NO_DRAW_GLYPHS) - -QVGFontGlyphCache::QVGFontGlyphCache() -{ - font = vgCreateFont(0); - scaleX = scaleY = 0.0; - invertedGlyphs = false; - memset(cachedGlyphsMask, 0, sizeof(cachedGlyphsMask)); -} - -QVGFontGlyphCache::~QVGFontGlyphCache() -{ - if (font != VG_INVALID_HANDLE) - vgDestroyFont(font); -} - -void QVGFontGlyphCache::setScaleFromText(const QFont &font, QFontEngine *fontEngine) -{ - QFontInfo fi(font); - qreal pixelSize = fi.pixelSize(); - qreal emSquare = fontEngine->properties().emSquare.toReal(); - scaleX = scaleY = static_cast(pixelSize / emSquare); -} - -void QVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d, - QFontEngine *fontEngine, - const glyph_t *g, int count) -{ - VGfloat origin[2]; - VGfloat escapement[2]; - glyph_metrics_t metrics; - // Some Qt font engines don't set yoff in getUnscaledGlyph(). - // Zero the metric structure so that everything has a default value. - memset(&metrics, 0, sizeof(metrics)); - while (count-- > 0) { - // Skip this glyph if we have already cached it before. - glyph_t glyph = *g++; - if (glyph < 256) { - if ((cachedGlyphsMask[glyph / 32] & (1 << (glyph % 32))) != 0) - continue; - cachedGlyphsMask[glyph / 32] |= (1 << (glyph % 32)); - } else if (cachedGlyphs.contains(glyph)) { - continue; - } else { - cachedGlyphs.insert(glyph); - } -#if !defined(QVG_NO_IMAGE_GLYPHS) - Q_UNUSED(d); - QImage scaledImage = fontEngine->alphaMapForGlyph(glyph); - VGImage vgImage = VG_INVALID_HANDLE; - metrics = fontEngine->boundingBox(glyph); - if (!scaledImage.isNull()) { // Not a space character - if (scaledImage.format() == QImage::Format_Indexed8) { - vgImage = vgCreateImage(VG_A_8, scaledImage.width(), scaledImage.height(), VG_IMAGE_QUALITY_FASTER); - vgImageSubData(vgImage, scaledImage.constBits(), scaledImage.bytesPerLine(), VG_A_8, 0, 0, scaledImage.width(), scaledImage.height()); - } else if (scaledImage.format() == QImage::Format_Mono) { - QImage img = scaledImage.convertToFormat(QImage::Format_Indexed8); - vgImage = vgCreateImage(VG_A_8, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER); - vgImageSubData(vgImage, img.constBits(), img.bytesPerLine(), VG_A_8, 0, 0, img.width(), img.height()); - } else { - QImage img = scaledImage.convertToFormat(QImage::Format_ARGB32_Premultiplied); - vgImage = vgCreateImage(VG_sARGB_8888_PRE, img.width(), img.height(), VG_IMAGE_QUALITY_FASTER); - vgImageSubData(vgImage, img.constBits(), img.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, img.width(), img.height()); - } - } - origin[0] = -metrics.x.toReal(); - origin[1] = -metrics.y.toReal(); - escapement[0] = 0; - escapement[1] = 0; - vgSetGlyphToImage(font, glyph, vgImage, origin, escapement); - vgDestroyImage(vgImage); // Reduce reference count. -#else - // Calculate the path for the glyph and cache it. - QPainterPath path; - fontEngine->getUnscaledGlyph(glyph, &path, &metrics); - VGPath vgPath; - if (!path.isEmpty()) { - vgPath = d->painterPathToVGPath(path); - } else { - // Probably a "space" character with no visible outline. - vgPath = VG_INVALID_HANDLE; - } - origin[0] = 0; - origin[1] = 0; - escapement[0] = 0; - escapement[1] = 0; - vgSetGlyphToPath(font, glyph, vgPath, VG_FALSE, origin, escapement); - vgDestroyPath(vgPath); // Reduce reference count. -#endif // !defined(QVG_NO_IMAGE_GLYPHS) - } -} - -#endif // !defined(QVG_NO_DRAW_GLYPHS) - -void QVGPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) -{ -#if !defined(QVG_NO_DRAW_GLYPHS) - Q_D(QVGPaintEngine); - const QTextItemInt &ti = static_cast(textItem); - - // If we are not using a simple transform, then fall back - // to the default Qt path stroking algorithm. - if (!d->simpleTransform) { - QPaintEngineEx::drawTextItem(p, textItem); - return; - } - - if (d->needsPenEmulation()) { - QPaintEngineEx::drawTextItem(p, textItem); - return; - } - - // Get the glyphs and positions associated with the text item. - QVarLengthArray positions; - QVarLengthArray glyphs; - QTransform matrix; - ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); - - if (!drawCachedGlyphs(glyphs.size(), glyphs.data(), ti.font(), ti.fontEngine, p, positions.data())) - QPaintEngineEx::drawTextItem(p, textItem); -#else - // OpenGL 1.0 does not have support for VGFont and glyphs, - // so fall back to the default Qt path stroking algorithm. - QPaintEngineEx::drawTextItem(p, textItem); -#endif -} - -void QVGPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) -{ - drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->font, textItem->fontEngine(), - QPointF(0, 0), textItem->glyphPositions); -} - - bool QVGPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFont &font, - QFontEngine *fontEngine, const QPointF &p, - const QFixedPoint *positions) - { -#if !defined(QVG_NO_DRAW_GLYPHS) - Q_D(QVGPaintEngine); - - // Find the glyph cache for this font. - QVGFontCache::ConstIterator it = d->fontCache.constFind(fontEngine); - QVGFontGlyphCache *glyphCache; - if (it != d->fontCache.constEnd()) { - glyphCache = it.value(); - } else { -#ifdef Q_OS_SYMBIAN - glyphCache = new QSymbianVGFontGlyphCache(); -#else - glyphCache = new QVGFontGlyphCache(); -#endif - if (glyphCache->font == VG_INVALID_HANDLE) { - qWarning("QVGPaintEngine::drawTextItem: OpenVG fonts are not supported by the OpenVG engine"); - delete glyphCache; - return false; - } - glyphCache->setScaleFromText(font, fontEngine); - d->fontCache.insert(fontEngine, glyphCache); - if (!d->fontEngineCleaner) - d->fontEngineCleaner = new QVGFontEngineCleaner(d); - QObject::connect(fontEngine, SIGNAL(destroyed()), - d->fontEngineCleaner, SLOT(fontEngineDestroyed())); - } - - // Set the transformation to use for drawing the current glyphs. - QTransform glyphTransform(d->pathTransform); - if (d->transform.type() <= QTransform::TxTranslate) { - // Prevent blurriness of unscaled, unrotated text by forcing integer coordinates. - glyphTransform.translate( - floor(p.x() + glyphTransform.dx() + aliasedCoordinateDelta) - glyphTransform.dx(), - floor(p.y() - glyphTransform.dy() + aliasedCoordinateDelta) + glyphTransform.dy()); - } else { - glyphTransform.translate(p.x(), p.y()); - } -#if defined(QVG_NO_IMAGE_GLYPHS) - glyphTransform.scale(glyphCache->scaleX, glyphCache->scaleY); -#endif - - // Some glyph caches can create the VGImage upright - if (glyphCache->invertedGlyphs) - glyphTransform.scale(1, -1); - - d->setTransform(VG_MATRIX_GLYPH_USER_TO_SURFACE, glyphTransform); - - // Add the glyphs from the text item into the glyph cache. - glyphCache->cacheGlyphs(d, fontEngine, glyphs, numGlyphs); - - // Create the array of adjustments between glyphs - QVarLengthArray adjustments_x(numGlyphs); - QVarLengthArray adjustments_y(numGlyphs); - for (int i = 1; i < numGlyphs; ++i) { - adjustments_x[i-1] = (positions[i].x - positions[i-1].x).round().toReal(); - adjustments_y[i-1] = (positions[i].y - positions[i-1].y).round().toReal(); - } - - // Set the glyph drawing origin. - VGfloat origin[2]; - origin[0] = positions[0].x.round().toReal(); - origin[1] = positions[0].y.round().toReal(); - vgSetfv(VG_GLYPH_ORIGIN, 2, origin); - - // Fast anti-aliasing for paths, better for images. -#if !defined(QVG_NO_IMAGE_GLYPHS) - d->setImageQuality(VG_IMAGE_QUALITY_BETTER); - d->setImageMode(VG_DRAW_IMAGE_STENCIL); -#else - d->setRenderingQuality(VG_RENDERING_QUALITY_FASTER); -#endif - - // Draw the glyphs. We need to fill with the brush associated with - // the Qt pen, not the Qt brush. - d->ensureBrush(state()->pen.brush()); - vgDrawGlyphs(glyphCache->font, numGlyphs, (VGuint*)glyphs, - adjustments_x.data(), adjustments_y.data(), VG_FILL_PATH, VG_TRUE); - return true; -#else - Q_UNUSED(numGlyphs); - Q_UNUSED(glyphs); - Q_UNUSED(font); - Q_UNUSED(fontEngine); - Q_UNUSED(p); - Q_UNUSED(positions); - return false; -#endif -} - -void QVGPaintEngine::setState(QPainterState *s) -{ - Q_D(QVGPaintEngine); - QPaintEngineEx::setState(s); - QVGPainterState *ps = static_cast(s); - if (ps->isNew) { - // Newly created state object. The call to setState() - // will either be followed by a call to begin(), or we are - // setting the state as part of a save(). - ps->isNew = false; - } else { - // This state object was set as part of a restore(). - restoreState(d->dirty); - d->dirty = ps->savedDirty; - } -} - -void QVGPaintEngine::beginNativePainting() -{ - Q_D(QVGPaintEngine); - - // About to enter raw VG mode: flush pending changes and make - // sure that all matrices are set to the current transformation. - QVGPainterState *s = this->state(); - d->ensurePen(s->pen); - d->ensureBrush(s->brush); - d->ensurePathTransform(); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, d->imageTransform); -#if !defined(QVG_NO_DRAW_GLYPHS) - d->setTransform(VG_MATRIX_GLYPH_USER_TO_SURFACE, d->pathTransform); -#endif - vgSeti(VG_SCISSORING, VG_FALSE); - vgSeti(VG_MASKING, VG_FALSE); - d->rawVG = true; -} - -void QVGPaintEngine::endNativePainting() -{ - Q_D(QVGPaintEngine); - // Exiting raw VG mode: force all state values to be - // explicitly set on the VG engine to undo any changes - // that were made by the raw VG function calls. - QPaintEngine::DirtyFlags dirty = d->dirty; - d->clearModes(); - d->forcePenChange = true; - d->forceBrushChange = true; - d->penType = (VGPaintType)0; - d->brushType = (VGPaintType)0; - d->clearColor = QColor(); - d->fillPaint = d->brushPaint; - d->scissorDirty = true; - restoreState(QPaintEngine::AllDirty); - d->dirty = dirty; - d->rawVG = false; - vgSetPaint(d->penPaint, VG_STROKE_PATH); - vgSetPaint(d->brushPaint, VG_FILL_PATH); -} - -QPixmapFilter *QVGPaintEngine::pixmapFilter(int type, const QPixmapFilter *prototype) -{ -#if !defined(QT_SHIVAVG) - Q_D(QVGPaintEngine); - switch (type) { - case QPixmapFilter::ConvolutionFilter: - if (!d->convolutionFilter) - d->convolutionFilter.reset(new QVGPixmapConvolutionFilter); - return d->convolutionFilter.data(); - case QPixmapFilter::ColorizeFilter: - if (!d->colorizeFilter) - d->colorizeFilter.reset(new QVGPixmapColorizeFilter); - return d->colorizeFilter.data(); - case QPixmapFilter::DropShadowFilter: - if (!d->dropShadowFilter) - d->dropShadowFilter.reset(new QVGPixmapDropShadowFilter); - return d->dropShadowFilter.data(); - case QPixmapFilter::BlurFilter: - if (!d->blurFilter) - d->blurFilter.reset(new QVGPixmapBlurFilter); - return d->blurFilter.data(); - default: break; - } -#endif - return QPaintEngineEx::pixmapFilter(type, prototype); -} - -void QVGPaintEngine::restoreState(QPaintEngine::DirtyFlags dirty) -{ - Q_D(QVGPaintEngine); - - // Restore the pen, brush, and other settings. - if ((dirty & QPaintEngine::DirtyBrushOrigin) != 0) - brushOriginChanged(); - d->fillRule = 0; - d->clearColor = QColor(); - if ((dirty & QPaintEngine::DirtyOpacity) != 0) - opacityChanged(); - if ((dirty & QPaintEngine::DirtyTransform) != 0) - transformChanged(); - if ((dirty & QPaintEngine::DirtyCompositionMode) != 0) - compositionModeChanged(); - if ((dirty & QPaintEngine::DirtyHints) != 0) - renderHintsChanged(); - if ((dirty & (QPaintEngine::DirtyClipRegion | - QPaintEngine::DirtyClipPath | - QPaintEngine::DirtyClipEnabled)) != 0) { - d->maskValid = false; - d->maskIsSet = false; - d->scissorMask = false; - d->maskRect = QRect(); - d->scissorDirty = true; - clipEnabledChanged(); - } - -#if defined(QVG_SCISSOR_CLIP) - if ((dirty & (QPaintEngine::DirtyClipRegion | - QPaintEngine::DirtyClipPath | - QPaintEngine::DirtyClipEnabled)) == 0) { - updateScissor(); - } -#else - updateScissor(); -#endif -} - -void QVGPaintEngine::fillRegion - (const QRegion& region, const QColor& color, const QSize& surfaceSize) -{ - Q_D(QVGPaintEngine); - if (d->clearColor != color || d->clearOpacity != 1.0f) { - VGfloat values[4]; - values[0] = color.redF(); - values[1] = color.greenF(); - values[2] = color.blueF(); - values[3] = color.alphaF(); - vgSetfv(VG_CLEAR_COLOR, 4, values); - d->clearColor = color; - d->clearOpacity = 1.0f; - } - if (region.rectCount() == 1) { - QRect r = region.boundingRect(); - vgClear(r.x(), surfaceSize.height() - r.y() - r.height(), - r.width(), r.height()); - } else { - const QVector rects = region.rects(); - for (int i = 0; i < rects.size(); ++i) { - QRect r = rects.at(i); - vgClear(r.x(), surfaceSize.height() - r.y() - r.height(), - r.width(), r.height()); - } - } -} - -#if !defined(QVG_NO_SINGLE_CONTEXT) && !defined(QT_NO_EGL) - -QVGCompositionHelper::QVGCompositionHelper() -{ - d = qt_vg_create_paint_engine()->vgPrivate(); -} - -QVGCompositionHelper::~QVGCompositionHelper() -{ -} - -void QVGCompositionHelper::startCompositing(const QSize& screenSize) -{ - this->screenSize = screenSize; - clearScissor(); - d->setBlendMode(VG_BLEND_SRC_OVER); -} - -void QVGCompositionHelper::endCompositing() -{ - clearScissor(); -} - -void QVGCompositionHelper::blitWindow - (VGImage image, const QSize& imageSize, - const QRect& rect, const QPoint& topLeft, int opacity) -{ - if (image == VG_INVALID_HANDLE) - return; - - // Determine which sub rectangle of the window to draw. - QRect sr = rect.translated(-topLeft); - - if (opacity >= 255) { - // Fully opaque: use vgSetPixels() to directly copy the sub-region. - int y = screenSize.height() - (rect.bottom() + 1); - vgSetPixels(rect.x(), y, image, sr.x(), - imageSize.height() - (sr.y() + sr.height()), - sr.width(), sr.height()); - } else { - // Extract the child image that we want to draw. - VGImage child; - if (sr.topLeft().isNull() && sr.size() == imageSize) - child = image; - else { - child = vgChildImage - (image, sr.x(), imageSize.height() - (sr.y() + sr.height()), - sr.width(), sr.height()); - } - - // Set the image transform. - QTransform transform; - int y = screenSize.height() - (rect.bottom() + 1); - transform.translate(rect.x() - 0.5f, y - 0.5f); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - - // Enable opacity for image drawing if necessary. - if (opacity != d->paintOpacity) { - VGfloat values[4]; - values[0] = 1.0f; - values[1] = 1.0f; - values[2] = 1.0f; - values[3] = ((VGfloat)opacity) / 255.0f; - vgSetParameterfv(d->opacityPaint, VG_PAINT_COLOR, 4, values); - d->paintOpacity = values[3]; - } - if (d->fillPaint != d->opacityPaint) { - vgSetPaint(d->opacityPaint, VG_FILL_PATH); - d->fillPaint = d->opacityPaint; - } - d->setImageMode(VG_DRAW_IMAGE_MULTIPLY); - - // Draw the child image. - vgDrawImage(child); - - // Destroy the child image. - if(child != image) - vgDestroyImage(child); - } -} - -static void fillBackgroundRect(const QRect& rect, QVGPaintEnginePrivate *d) -{ - VGfloat coords[8]; - coords[0] = rect.x(); - coords[1] = rect.y(); - coords[2] = rect.x() + rect.width(); - coords[3] = coords[1]; - coords[4] = coords[2]; - coords[5] = rect.y() + rect.height(); - coords[6] = coords[0]; - coords[7] = coords[5]; -#if !defined(QVG_NO_MODIFY_PATH) - vgModifyPathCoords(d->rectPath, 0, 4, coords); - vgDrawPath(d->rectPath, VG_FILL_PATH); -#else - Q_UNUSED(d); - VGPath rectPath = vgCreatePath - (VG_PATH_FORMAT_STANDARD, - VG_PATH_DATATYPE_F, - 1.0f, // scale - 0.0f, // bias - 5, // segmentCapacityHint - 8, // coordCapacityHint - VG_PATH_CAPABILITY_ALL); - static VGubyte const segments[5] = { - VG_MOVE_TO_ABS, - VG_LINE_TO_ABS, - VG_LINE_TO_ABS, - VG_LINE_TO_ABS, - VG_CLOSE_PATH - }; - vgAppendPathData(rectPath, 5, segments, coords); - vgDrawPath(rectPath, VG_FILL_PATH); - vgDestroyPath(rectPath); -#endif -} - -void QVGCompositionHelper::fillBackground - (const QRegion& region, const QBrush& brush) -{ - if (brush.style() == Qt::SolidPattern) { - // Use vgClear() to quickly fill the background. - QColor color = brush.color(); - if (d->clearColor != color || d->clearOpacity != 1.0f) { - VGfloat values[4]; - values[0] = color.redF(); - values[1] = color.greenF(); - values[2] = color.blueF(); - values[3] = color.alphaF(); - vgSetfv(VG_CLEAR_COLOR, 4, values); - d->clearColor = color; - d->clearOpacity = 1.0f; - } - if (region.rectCount() == 1) { - QRect r = region.boundingRect(); - vgClear(r.x(), screenSize.height() - r.y() - r.height(), - r.width(), r.height()); - } else { - const QVector rects = region.rects(); - for (int i = 0; i < rects.size(); ++i) { - QRect r = rects.at(i); - vgClear(r.x(), screenSize.height() - r.y() - r.height(), - r.width(), r.height()); - } - } - - } else { - // Set the path transform to the default viewport transformation. - VGfloat devh = screenSize.height(); - QTransform viewport(1.0f, 0.0f, 0.0f, - 0.0f, -1.0f, 0.0f, - 0.0f, devh, 1.0f); - d->setTransform(VG_MATRIX_PATH_USER_TO_SURFACE, viewport); - - // Set the brush to use to fill the background. - d->ensureBrush(brush); - d->setFillRule(VG_EVEN_ODD); - - if (region.rectCount() == 1) { - fillBackgroundRect(region.boundingRect(), d); - } else { - const QVector rects = region.rects(); - for (int i = 0; i < rects.size(); ++i) - fillBackgroundRect(rects.at(i), d); - } - - // We will need to reset the path transform during the next paint. - d->pathTransformSet = false; - } -} - -void QVGCompositionHelper::drawCursorPixmap - (const QPixmap& pixmap, const QPoint& offset) -{ - VGImage vgImage = VG_INVALID_HANDLE; - - // Fetch the VGImage from the pixmap if possible. - QPixmapData *pd = pixmap.pixmapData(); - if (!pd) - return; // null QPixmap - if (pd->classId() == QPixmapData::OpenVGClass) { - QVGPixmapData *vgpd = static_cast(pd); - if (vgpd->isValid()) - vgImage = vgpd->toVGImage(); - } - - // Set the image transformation and modes. - VGfloat devh = screenSize.height(); - QTransform transform(1.0f, 0.0f, 0.0f, - 0.0f, -1.0f, 0.0f, - 0.0f, devh, 1.0f); - transform.translate(offset.x(), offset.y()); - d->setTransform(VG_MATRIX_IMAGE_USER_TO_SURFACE, transform); - d->setImageMode(VG_DRAW_IMAGE_NORMAL); - - // Draw the VGImage. - if (vgImage != VG_INVALID_HANDLE) { - vgDrawImage(vgImage); - } else { - QImage img = pixmap.toImage().convertToFormat - (QImage::Format_ARGB32_Premultiplied); - - vgImage = vgCreateImage - (VG_sARGB_8888_PRE, img.width(), img.height(), - VG_IMAGE_QUALITY_FASTER); - if (vgImage == VG_INVALID_HANDLE) - return; - vgImageSubData - (vgImage, img.constBits() + img.bytesPerLine() * (img.height() - 1), - -(img.bytesPerLine()), VG_sARGB_8888_PRE, 0, 0, - img.width(), img.height()); - - vgDrawImage(vgImage); - vgDestroyImage(vgImage); - } -} - -void QVGCompositionHelper::setScissor(const QRegion& region) -{ - QVector rects = region.rects(); - int count = rects.count(); - if (count > d->maxScissorRects) - count = d->maxScissorRects; - QVarLengthArray params(count * 4); - int height = screenSize.height(); - for (int i = 0; i < count; ++i) { - params[i * 4 + 0] = rects[i].x(); - params[i * 4 + 1] = height - rects[i].y() - rects[i].height(); - params[i * 4 + 2] = rects[i].width(); - params[i * 4 + 3] = rects[i].height(); - } - - vgSetiv(VG_SCISSOR_RECTS, count * 4, params.data()); - vgSeti(VG_SCISSORING, VG_TRUE); - d->scissorDirty = false; - d->scissorActive = true; - d->scissorRegion = region; -} - -void QVGCompositionHelper::clearScissor() -{ - if (d->scissorActive || d->scissorDirty) { - vgSeti(VG_SCISSORING, VG_FALSE); - d->scissorActive = false; - d->scissorDirty = false; - } -} - -#endif // !QVG_NO_SINGLE_CONTEXT && !QT_NO_EGL - -VGImageFormat qt_vg_image_to_vg_format(QImage::Format format) -{ - switch (format) { - case QImage::Format_MonoLSB: - return VG_BW_1; - case QImage::Format_Indexed8: - return VG_sL_8; - case QImage::Format_ARGB32_Premultiplied: - return VG_sARGB_8888_PRE; - case QImage::Format_RGB32: - return VG_sXRGB_8888; - case QImage::Format_ARGB32: - return VG_sARGB_8888; - case QImage::Format_RGB16: - return VG_sRGB_565; - case QImage::Format_ARGB4444_Premultiplied: - return VG_sARGB_4444; - default: - break; - } - return VG_sARGB_8888; // XXX -} - -QT_END_NAMESPACE - -#include "qpaintengine_vg.moc" diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h deleted file mode 100644 index 267ecd443f9..00000000000 --- a/src/openvg/qpaintengine_vg_p.h +++ /dev/null @@ -1,179 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPAINTENGINE_VG_P_H -#define QPAINTENGINE_VG_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 - -QT_BEGIN_NAMESPACE - -struct QFixedPoint; -class QVGPaintEnginePrivate; -class QPixmapData; -class QVGEGLWindowSurfacePrivate; - -class Q_OPENVG_EXPORT QVGPainterState : public QPainterState -{ -public: - QVGPainterState(QVGPainterState& other); - QVGPainterState(); - ~QVGPainterState(); - - bool isNew; - QRegion clipRegion; - QPaintEngine::DirtyFlags savedDirty; -}; - -class Q_OPENVG_EXPORT QVGPaintEngine : public QPaintEngineEx -{ - Q_DECLARE_PRIVATE(QVGPaintEngine) -public: - QVGPaintEngine(); - ~QVGPaintEngine(); - - Type type() const { return OpenVG; } - - QPainterState *createState(QPainterState *orig) const; - - bool begin(QPaintDevice *pdev); - bool end(); - - void draw(const QVectorPath &path); - void fill(const QVectorPath &path, const QBrush &brush); - void stroke(const QVectorPath &path, const QPen &pen); - - void clip(const QVectorPath &path, Qt::ClipOperation op); - void clip(const QRect &rect, Qt::ClipOperation op); - void clip(const QRegion ®ion, Qt::ClipOperation op); - void clip(const QPainterPath &path, Qt::ClipOperation op); - - void clipEnabledChanged(); - void penChanged(); - void brushChanged(); - void brushOriginChanged(); - void opacityChanged(); - void compositionModeChanged(); - void renderHintsChanged(); - void transformChanged(); - - void fillRect(const QRectF &rect, const QBrush &brush); - void fillRect(const QRectF &rect, const QColor &color); - - void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode); - - void drawRects(const QRect *rects, int rectCount); - void drawRects(const QRectF *rects, int rectCount); - - void drawLines(const QLine *lines, int lineCount); - void drawLines(const QLineF *lines, int lineCount); - - void drawEllipse(const QRectF &r); - void drawEllipse(const QRect &r); - - void drawPath(const QPainterPath &path); - - void drawPoints(const QPointF *points, int pointCount); - void drawPoints(const QPoint *points, int pointCount); - - void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); - void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode); - - void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr); - void drawPixmap(const QPointF &pos, const QPixmap &pm); - - void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor); - void drawImage(const QPointF &pos, const QImage &image); - - void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); - - void drawPixmapFragments(const QPainter::PixmapFragment *drawingData, int dataCount, const QPixmap &pixmap, - QFlags hints); - - void drawTextItem(const QPointF &p, const QTextItem &textItem); - void drawStaticTextItem(QStaticTextItem *staticTextItem); - bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFont &font, - QFontEngine *fontEngine, const QPointF &p, - const QFixedPoint *positions); - - void setState(QPainterState *s); - QVGPainterState *state() { return static_cast(QPaintEngineEx::state()); } - const QVGPainterState *state() const { return static_cast(QPaintEngineEx::state()); } - - void beginNativePainting(); - void endNativePainting(); - - QPixmapFilter *pixmapFilter(int type, const QPixmapFilter *prototype); - - QVGPaintEnginePrivate *vgPrivate() { Q_D(QVGPaintEngine); return d; } - - void fillRegion(const QRegion& region, const QColor& color, const QSize& surfaceSize); - bool supportsTransformations(qreal, const QTransform &) const { return true; } - -protected: - QVGPaintEngine(QVGPaintEnginePrivate &data); - -private: - void restoreState(QPaintEngine::DirtyFlags dirty); - void updateScissor(); - QRegion defaultClipRegion(); - bool isDefaultClipRegion(const QRegion& region); - bool isDefaultClipRect(const QRect& rect); - bool clearRect(const QRectF &rect, const QColor &color); - bool canVgWritePixels(const QImage &image) const; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp deleted file mode 100644 index de22db8fa9b..00000000000 --- a/src/openvg/qpixmapdata_vg.cpp +++ /dev/null @@ -1,575 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpixmapdata_vg_p.h" -#include "qpaintengine_vg_p.h" -#include -#if !defined(QT_NO_EGL) -#include -#endif -#include "qvg_p.h" -#include "qvgimagepool_p.h" -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -static int qt_vg_pixmap_serial = 0; - -QVGPixmapData::QVGPixmapData(PixelType type) - : QPixmapData(type, OpenVGClass) -{ - Q_ASSERT(type == QPixmapData::PixmapType); - vgImage = VG_INVALID_HANDLE; - vgImageOpacity = VG_INVALID_HANDLE; - cachedOpacity = 1.0f; - recreate = true; - inImagePool = false; - inLRU = false; - failedToAlloc = false; -#if defined(Q_OS_SYMBIAN) - nativeImageHandleProvider = 0; - nativeImageHandle = 0; -#endif -#if !defined(QT_NO_EGL) - context = 0; - qt_vg_register_pixmap(this); -#endif - updateSerial(); -} - -QVGPixmapData::~QVGPixmapData() -{ - destroyImageAndContext(); -#if !defined(QT_NO_EGL) - qt_vg_unregister_pixmap(this); -#endif -} - -void QVGPixmapData::destroyImages() -{ - if (inImagePool) { - QVGImagePool *pool = QVGImagePool::instance(); - if (vgImage != VG_INVALID_HANDLE) - pool->releaseImage(this, vgImage); - if (vgImageOpacity != VG_INVALID_HANDLE) - pool->releaseImage(this, vgImageOpacity); - } else { - if (vgImage != VG_INVALID_HANDLE) - vgDestroyImage(vgImage); - if (vgImageOpacity != VG_INVALID_HANDLE) - vgDestroyImage(vgImageOpacity); - } - vgImage = VG_INVALID_HANDLE; - vgImageOpacity = VG_INVALID_HANDLE; - inImagePool = false; - -#if defined(Q_OS_SYMBIAN) - releaseNativeImageHandle(); -#endif -} - -void QVGPixmapData::destroyImageAndContext() -{ - if (vgImage != VG_INVALID_HANDLE) { - // We need to have a context current to destroy the image. -#if !defined(QT_NO_EGL) - if (!context) - context = qt_vg_create_context(0, QInternal::Pixmap); - if (context->isCurrent()) { - destroyImages(); - } else { - // We don't currently have a widget surface active, but we - // need a surface to make the context current. So use the - // shared pbuffer surface instead. - context->makeCurrent(qt_vg_shared_surface()); - destroyImages(); - context->lazyDoneCurrent(); - } -#else - destroyImages(); -#endif - } else { -#if defined(Q_OS_SYMBIAN) - releaseNativeImageHandle(); -#endif - } -#if !defined(QT_NO_EGL) - if (context) { - qt_vg_destroy_context(context, QInternal::Pixmap); - context = 0; - } -#endif - recreate = true; -} - -QPixmapData *QVGPixmapData::createCompatiblePixmapData() const -{ - return new QVGPixmapData(pixelType()); -} - -bool QVGPixmapData::isValid() const -{ - return (w > 0 && h > 0); -} - -void QVGPixmapData::updateSerial() -{ - setSerialNumber(++qt_vg_pixmap_serial); -} - -void QVGPixmapData::resize(int wid, int ht) -{ - if (w == wid && h == ht) { - updateSerial(); - return; - } - - w = wid; - h = ht; - d = 32; // We always use ARGB_Premultiplied for VG pixmaps. - is_null = (w <= 0 || h <= 0); - source = QVolatileImage(); - recreate = true; - - updateSerial(); -} - -void QVGPixmapData::fromImage(const QImage &image, Qt::ImageConversionFlags flags) -{ - if (image.isNull()) - return; - - QImage img = image; - createPixmapForImage(img, flags, false); -} - -void QVGPixmapData::fromImageReader(QImageReader *imageReader, - Qt::ImageConversionFlags flags) -{ - QImage image = imageReader->read(); - if (image.isNull()) - return; - - createPixmapForImage(image, flags, true); -} - -bool QVGPixmapData::fromFile(const QString &filename, const char *format, - Qt::ImageConversionFlags flags) -{ - QImage image = QImageReader(filename, format).read(); - if (image.isNull()) - return false; - - createPixmapForImage(image, flags, true); - - return !isNull(); -} - -bool QVGPixmapData::fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags) -{ - QByteArray a = QByteArray::fromRawData(reinterpret_cast(buffer), len); - QBuffer b(&a); - b.open(QIODevice::ReadOnly); - QImage image = QImageReader(&b, format).read(); - if (image.isNull()) - return false; - - createPixmapForImage(image, flags, true); - - return !isNull(); -} - -QImage::Format QVGPixmapData::idealFormat(QImage *image, Qt::ImageConversionFlags flags) const -{ - QImage::Format format = sourceFormat(); - int d = image->depth(); - if (d == 1 || d == 16 || d == 24 || (d == 32 && !image->hasAlphaChannel())) - format = QImage::Format_RGB32; - else if (!(flags & Qt::NoOpaqueDetection) && image->data_ptr()->checkForAlphaPixels()) - format = sourceFormat(); - else - format = image->hasAlphaChannel() ? sourceFormat() : QImage::Format_RGB32; - return format; -} - -void QVGPixmapData::createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace) -{ - resize(image.width(), image.height()); - - QImage::Format format = idealFormat(&image, flags); - - if (inPlace && image.data_ptr()->convertInPlace(format, flags)) { - source = QVolatileImage(image); - } else { - QImage convertedImage = image.convertToFormat(format); - // convertToFormat won't detach the image if format stays the - // same. Detaching is needed to prevent issues with painting - // onto this QPixmap later on. - convertedImage.detach(); - source = QVolatileImage(convertedImage); - } - - recreate = true; -} - -void QVGPixmapData::fill(const QColor &color) -{ - if (!isValid()) - return; - forceToImage(); - if (source.depth() == 1) { - // Pick the best approximate color in the image's colortable. - int gray = qGray(color.rgba()); - if (qAbs(qGray(source.imageRef().color(0)) - gray) - < qAbs(qGray(source.imageRef().color(1)) - gray)) - source.fill(0); - else - source.fill(1); - } else { - source.fill(PREMUL(color.rgba())); - } -} - -bool QVGPixmapData::hasAlphaChannel() const -{ - ensureReadback(true); - if (!source.isNull()) - return source.hasAlphaChannel(); - else - return isValid(); -} - -void QVGPixmapData::setAlphaChannel(const QPixmap &alphaChannel) -{ - if (!isValid()) - return; - forceToImage(); - source.setAlphaChannel(alphaChannel); -} - -QImage QVGPixmapData::toImage() const -{ - if (!isValid()) - return QImage(); - ensureReadback(true); - if (source.isNull()) { - source = QVolatileImage(w, h, sourceFormat()); - recreate = true; - } - return source.toImage(); -} - -void QVGPixmapData::copy(const QPixmapData *data, const QRect &rect) -{ - // toImage() is potentially expensive with QVolatileImage so provide a - // more efficient implementation of copy() that does not rely on it. - if (!data) { - return; - } - if (data->classId() != OpenVGClass) { - fromImage(data->toImage(rect), Qt::NoOpaqueDetection); - return; - } - const QVGPixmapData *pd = static_cast(data); - QRect r = rect; - if (r.isNull() || r.contains(QRect(0, 0, pd->w, pd->h))) { - r = QRect(0, 0, pd->w, pd->h); - } - resize(r.width(), r.height()); - recreate = true; - if (!pd->source.isNull()) { - source = QVolatileImage(r.width(), r.height(), pd->source.format()); - source.copyFrom(&pd->source, r); - } -} - -QImage *QVGPixmapData::buffer() -{ - // Cannot be safely implemented and QVGPixmapData is not (must not be) RasterClass anyway. - return 0; -} - -QPaintEngine* QVGPixmapData::paintEngine() const -{ - // If the application wants to paint into the QPixmap, we first - // force it to QImage format and then paint into that. - // This is simpler than juggling multiple VG contexts. - const_cast(this)->forceToImage(); - return source.paintEngine(); -} - -VGImage QVGPixmapData::toVGImage() -{ - if (!isValid() || failedToAlloc) - return VG_INVALID_HANDLE; - -#if !defined(QT_NO_EGL) - // Increase the reference count on the shared context. - if (!context) - context = qt_vg_create_context(0, QInternal::Pixmap); -#endif - - if (recreate && prevSize != QSize(w, h)) - destroyImages(); - else if (recreate) - cachedOpacity = -1.0f; // Force opacity image to be refreshed later. - -#if defined(Q_OS_SYMBIAN) - if (recreate && nativeImageHandleProvider && !nativeImageHandle) { - createFromNativeImageHandleProvider(); - } -#endif - - if (vgImage == VG_INVALID_HANDLE) { - vgImage = QVGImagePool::instance()->createImageForPixmap - (qt_vg_image_to_vg_format(source.format()), w, h, VG_IMAGE_QUALITY_FASTER, this); - - // Bail out if we run out of GPU memory - try again next time. - if (vgImage == VG_INVALID_HANDLE) { - failedToAlloc = true; - return VG_INVALID_HANDLE; - } - - inImagePool = true; - } else if (inImagePool) { - QVGImagePool::instance()->useImage(this); - } - - if (!source.isNull() && recreate) { - source.beginDataAccess(); - vgImageSubData - (vgImage, - source.constBits(), source.bytesPerLine(), - qt_vg_image_to_vg_format(source.format()), 0, 0, w, h); - source.endDataAccess(true); - } - - recreate = false; - prevSize = QSize(w, h); - - return vgImage; -} - -VGImage QVGPixmapData::toVGImage(qreal opacity) -{ -#if !defined(QT_SHIVAVG) - // Force the primary VG image to be recreated if necessary. - if (toVGImage() == VG_INVALID_HANDLE) - return VG_INVALID_HANDLE; - - if (opacity == 1.0f) - return vgImage; - - // Create an alternative image for the selected opacity. - if (vgImageOpacity == VG_INVALID_HANDLE || cachedOpacity != opacity) { - if (vgImageOpacity == VG_INVALID_HANDLE) { - if (inImagePool) { - vgImageOpacity = QVGImagePool::instance()->createImageForPixmap - (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER, this); - } else { - vgImageOpacity = vgCreateImage - (VG_sARGB_8888_PRE, w, h, VG_IMAGE_QUALITY_FASTER); - } - - // Bail out if we run out of GPU memory - try again next time. - if (vgImageOpacity == VG_INVALID_HANDLE) - return VG_INVALID_HANDLE; - } - VGfloat matrix[20] = { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, opacity, - 0.0f, 0.0f, 0.0f, 0.0f - }; - vgColorMatrix(vgImageOpacity, vgImage, matrix); - cachedOpacity = opacity; - } - - return vgImageOpacity; -#else - // vgColorMatrix() doesn't work with ShivaVG, so ignore the opacity. - Q_UNUSED(opacity); - return toVGImage(); -#endif -} - -void QVGPixmapData::detachImageFromPool() -{ - if (inImagePool) { - QVGImagePool::instance()->detachImage(this); - inImagePool = false; - } -} - -void QVGPixmapData::hibernate() -{ - // If the image was imported (e.g, from an SgImage under Symbian), then - // skip the hibernation, there is no sense in copying it back to main - // memory because the data is most likely shared between several processes. - bool skipHibernate = (vgImage != VG_INVALID_HANDLE && source.isNull()); -#if defined(Q_OS_SYMBIAN) - // However we have to proceed normally if the image was retrieved via - // a handle provider. - skipHibernate &= !nativeImageHandleProvider; -#endif - if (skipHibernate) - return; - - forceToImage(false); // no readback allowed here - destroyImageAndContext(); -} - -void QVGPixmapData::reclaimImages() -{ - if (!inImagePool) - return; - forceToImage(); - destroyImages(); -} - -int QVGPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const -{ - switch (metric) { - case QPaintDevice::PdmWidth: - return w; - case QPaintDevice::PdmHeight: - return h; - case QPaintDevice::PdmNumColors: - return 0; - case QPaintDevice::PdmDepth: - return d; - case QPaintDevice::PdmWidthMM: - return qRound(w * 25.4 / qt_defaultDpiX()); - case QPaintDevice::PdmHeightMM: - return qRound(h * 25.4 / qt_defaultDpiY()); - case QPaintDevice::PdmDpiX: - case QPaintDevice::PdmPhysicalDpiX: - return qt_defaultDpiX(); - case QPaintDevice::PdmDpiY: - case QPaintDevice::PdmPhysicalDpiY: - return qt_defaultDpiY(); - default: - qWarning("QVGPixmapData::metric(): Invalid metric"); - return 0; - } -} - -// Ensures that the pixmap is backed by some valid data and forces the data to -// be re-uploaded to the VGImage when toVGImage() is called next time. -void QVGPixmapData::forceToImage(bool allowReadback) -{ - if (!isValid()) - return; - - if (allowReadback) - ensureReadback(false); - - if (source.isNull()) - source = QVolatileImage(w, h, sourceFormat()); - - recreate = true; -} - -void QVGPixmapData::ensureReadback(bool readOnly) const -{ - if (vgImage != VG_INVALID_HANDLE && source.isNull()) { - source = QVolatileImage(w, h, sourceFormat()); - source.beginDataAccess(); - vgGetImageSubData(vgImage, source.bits(), source.bytesPerLine(), - qt_vg_image_to_vg_format(source.format()), - 0, 0, w, h); - source.endDataAccess(); - if (readOnly) { - recreate = false; - } else { - // Once we did a readback, the original VGImage must be destroyed - // because it may be shared (e.g. created via SgImage) and a subsequent - // upload of the image data may produce unexpected results. - const_cast(this)->destroyImages(); -#if defined(Q_OS_SYMBIAN) - // There is now an own copy of the data so drop the handle provider, - // otherwise toVGImage() would request the handle again, which is wrong. - nativeImageHandleProvider = 0; -#endif - recreate = true; - } - } -} - -QImage::Format QVGPixmapData::sourceFormat() const -{ - return QImage::Format_ARGB32_Premultiplied; -} - -/* - \internal - - Returns the VGImage that is storing the contents of \a pixmap. - Returns VG_INVALID_HANDLE if \a pixmap is not owned by the OpenVG - graphics system or \a pixmap is invalid. - - This function is typically used to access the backing store - for a pixmap when executing raw OpenVG calls. It must only - be used when a QPainter is active and the OpenVG paint engine - is in use by the QPainter. - - \sa {QtOpenVG Module} -*/ -Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap) -{ - QPixmapData *pd = pixmap.pixmapData(); - if (!pd) - return VG_INVALID_HANDLE; // null QPixmap - if (pd->classId() == QPixmapData::OpenVGClass) { - QVGPixmapData *vgpd = static_cast(pd); - if (vgpd->isValid()) - return vgpd->toVGImage(); - } - return VG_INVALID_HANDLE; -} - -QT_END_NAMESPACE diff --git a/src/openvg/qpixmapdata_vg_p.h b/src/openvg/qpixmapdata_vg_p.h deleted file mode 100644 index 901bad9864e..00000000000 --- a/src/openvg/qpixmapdata_vg_p.h +++ /dev/null @@ -1,202 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPIXMAPDATA_VG_P_H -#define QPIXMAPDATA_VG_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 -#include -#include "qvg_p.h" - -#if defined(Q_OS_SYMBIAN) -class RSGImage; -#endif - -QT_BEGIN_NAMESPACE - -class QEglContext; -class QVGImagePool; -class QImageReader; - -#if !defined(QT_NO_EGL) -class QVGPixmapData; -class QVGSharedContext; - -void qt_vg_register_pixmap(QVGPixmapData *pd); -void qt_vg_unregister_pixmap(QVGPixmapData *pd); -void qt_vg_hibernate_pixmaps(QVGSharedContext *context); -#endif - -class QNativeImageHandleProvider; - -class Q_OPENVG_EXPORT QVGPixmapData : public QPixmapData -{ -public: - QVGPixmapData(PixelType type); - ~QVGPixmapData(); - - QPixmapData *createCompatiblePixmapData() const; - - // Is this pixmap valid (i.e. non-zero in size)? - bool isValid() const; - - void resize(int width, int height); - void fromImage(const QImage &image, Qt::ImageConversionFlags flags); - void fromImageReader(QImageReader *imageReader, - Qt::ImageConversionFlags flags); - bool fromFile(const QString &filename, const char *format, - Qt::ImageConversionFlags flags); - bool fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags); - - void fill(const QColor &color); - bool hasAlphaChannel() const; - void setAlphaChannel(const QPixmap &alphaChannel); - QImage toImage() const; - void copy(const QPixmapData *data, const QRect &rect); - QImage *buffer(); - QPaintEngine* paintEngine() const; - - // Return the VGImage form of this pixmap, creating it if necessary. - // This assumes that there is a VG context current. - virtual VGImage toVGImage(); - - // Return the VGImage form for a specific opacity setting. - virtual VGImage toVGImage(qreal opacity); - - // Detach this image from the image pool. - virtual void detachImageFromPool(); - - // Release the VG resources associated with this pixmap and copy - // the pixmap's contents out of the GPU back into main memory. - // The VG resource will be automatically recreated the next time - // toVGImage() is called. Does nothing if the pixmap cannot be - // hibernated for some reason (e.g. VGImage is shared with another - // process via a SgImage). - virtual void hibernate(); - - // Called when the QVGImagePool wants to reclaim this pixmap's - // VGImage objects to reuse storage. - virtual void reclaimImages(); - - // If vgImage is valid but source is null, copies pixel data from GPU back - // into main memory and destroys vgImage. For a normal pixmap this function - // does nothing, however if the pixmap was created directly from a VGImage - // (e.g. via SgImage on Symbian) then by doing the readback this ensures - // that QImage-based functions can operate too. - virtual void ensureReadback(bool readOnly) const; - - QSize size() const { return QSize(w, h); } - -#if defined(Q_OS_SYMBIAN) - void* toNativeType(NativeType type); - void fromNativeType(void* pixmap, NativeType type); - bool initFromNativeImageHandle(void *handle, const QString &type); - void createFromNativeImageHandleProvider(); - void releaseNativeImageHandle(); -#endif - -protected: - int metric(QPaintDevice::PaintDeviceMetric metric) const; - void createPixmapForImage(QImage &image, Qt::ImageConversionFlags flags, bool inPlace); - -#if defined(Q_OS_SYMBIAN) - void cleanup(); -#endif - -private: - QVGPixmapData *nextLRU; - QVGPixmapData *prevLRU; - bool inLRU; - bool failedToAlloc; - friend class QVGImagePool; - friend class QVGPaintEngine; - -#if !defined(QT_NO_EGL) - QVGPixmapData *next; - QVGPixmapData *prev; - - friend void qt_vg_register_pixmap(QVGPixmapData *pd); - friend void qt_vg_unregister_pixmap(QVGPixmapData *pd); - friend void qt_vg_hibernate_pixmaps(QVGSharedContext *context); -#endif - -protected: - QSize prevSize; - VGImage vgImage; - VGImage vgImageOpacity; - qreal cachedOpacity; - mutable QVolatileImage source; - mutable bool recreate; - bool inImagePool; -#if !defined(QT_NO_EGL) - mutable QEglContext *context; -#endif - -#if defined(Q_OS_SYMBIAN) - mutable QNativeImageHandleProvider *nativeImageHandleProvider; - void *nativeImageHandle; - QString nativeImageType; -#endif - - void forceToImage(bool allowReadback = true); - QImage::Format sourceFormat() const; - QImage::Format idealFormat(QImage *image, Qt::ImageConversionFlags flags) const; - void updateSerial(); - - void destroyImageAndContext(); - void destroyImages(); -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp deleted file mode 100644 index 52dcca3706b..00000000000 --- a/src/openvg/qpixmapfilter_vg.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpixmapfilter_vg_p.h" -#include "qvgimagepool_p.h" -#include -#include - -QT_BEGIN_NAMESPACE - -#if !defined(QT_SHIVAVG) - -QVGPixmapConvolutionFilter::QVGPixmapConvolutionFilter() - : QPixmapConvolutionFilter() -{ -} - -QVGPixmapConvolutionFilter::~QVGPixmapConvolutionFilter() -{ -} - -extern void qt_vg_drawVGImage - (QPainter *painter, const QPointF& pos, VGImage vgImg); -extern void qt_vg_drawVGImageStencil - (QPainter *painter, const QPointF& pos, VGImage vgImg, const QBrush& brush); - -void QVGPixmapConvolutionFilter::draw - (QPainter *painter, const QPointF &dest, - const QPixmap &src, const QRectF &srcRect) const -{ - if (src.isNull()) - return; - - if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { - // The pixmap data is not an instance of QVGPixmapData, so fall - // back to the default convolution filter implementation. - QPixmapConvolutionFilter::draw(painter, dest, src, srcRect); - return; - } - - QVGPixmapData *pd = static_cast(src.pixmapData()); - - VGImage srcImage = pd->toVGImage(); - if (srcImage == VG_INVALID_HANDLE) - return; - - QSize size = pd->size(); - VGImage dstImage = QVGImagePool::instance()->createTemporaryImage - (VG_sARGB_8888_PRE, size.width(), size.height(), - VG_IMAGE_QUALITY_FASTER, pd); - if (dstImage == VG_INVALID_HANDLE) - return; - - int kernelWidth = rows(); - int kernelHeight = columns(); - const qreal *kern = convolutionKernel(); - QVarLengthArray kernel; - for (int i = 0; i < kernelWidth; ++i) { - for (int j = 0; j < kernelHeight; ++j) { - kernel.append((VGshort)(kern[j * kernelWidth + i] * 1024.0f)); - } - } - - VGfloat values[4]; - values[0] = 0.0f; - values[1] = 0.0f; - values[2] = 0.0f; - values[3] = 0.0f; - vgSetfv(VG_TILE_FILL_COLOR, 4, values); - - vgConvolve(dstImage, srcImage, - kernelWidth, kernelHeight, 0, 0, - kernel.constData(), 1.0f / 1024.0f, 0.0f, - VG_TILE_FILL); - - VGImage child = VG_INVALID_HANDLE; - - if (srcRect.isNull() || - (srcRect.topLeft().isNull() && srcRect.size() == size)) { - child = dstImage; - } else { - QRect src = srcRect.toRect(); - child = vgChildImage(dstImage, src.x(), src.y(), src.width(), src.height()); - } - - qt_vg_drawVGImage(painter, dest, child); - - if(child != dstImage) - vgDestroyImage(child); - QVGImagePool::instance()->releaseImage(0, dstImage); -} - -QVGPixmapColorizeFilter::QVGPixmapColorizeFilter() - : QPixmapColorizeFilter() -{ -} - -QVGPixmapColorizeFilter::~QVGPixmapColorizeFilter() -{ -} - -void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const -{ - if (src.isNull()) - return; - - if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { - // The pixmap data is not an instance of QVGPixmapData, so fall - // back to the default colorize filter implementation. - QPixmapColorizeFilter::draw(painter, dest, src, srcRect); - return; - } - - QVGPixmapData *pd = static_cast(src.pixmapData()); - - VGImage srcImage = pd->toVGImage(); - if (srcImage == VG_INVALID_HANDLE) - return; - - QSize size = pd->size(); - VGImage dstImage = QVGImagePool::instance()->createTemporaryImage - (VG_sARGB_8888_PRE, size.width(), size.height(), - VG_IMAGE_QUALITY_FASTER, pd); - if (dstImage == VG_INVALID_HANDLE) - return; - - // Determine the weights for the matrix from the color and strength. - QColor c = color(); - VGfloat strength = this->strength(); - VGfloat weights[3]; - VGfloat invweights[3]; - VGfloat alpha = c.alphaF(); - weights[0] = c.redF() * alpha; - weights[1] = c.greenF() * alpha; - weights[2] = c.blueF() * alpha; - invweights[0] = (1.0f - weights[0]) * strength; - invweights[1] = (1.0f - weights[1]) * strength; - invweights[2] = (1.0f - weights[2]) * strength; - - // Grayscale weights. - static const VGfloat redGray = 11.0f / 32.0f; - static const VGfloat greenGray = 16.0f / 32.0f; - static const VGfloat blueGray = 1.0f - (redGray + greenGray); - - VGfloat matrix[5][4]; - matrix[0][0] = redGray * invweights[0] + (1.0f - strength); - matrix[0][1] = redGray * invweights[1]; - matrix[0][2] = redGray * invweights[2]; - matrix[0][3] = 0.0f; - matrix[1][0] = greenGray * invweights[0]; - matrix[1][1] = greenGray * invweights[1] + (1.0f - strength); - matrix[1][2] = greenGray * invweights[2]; - matrix[1][3] = 0.0f; - matrix[2][0] = blueGray * invweights[0]; - matrix[2][1] = blueGray * invweights[1]; - matrix[2][2] = blueGray * invweights[2] + (1.0f - strength); - matrix[2][3] = 0.0f; - matrix[3][0] = 0.0f; - matrix[3][1] = 0.0f; - matrix[3][2] = 0.0f; - matrix[3][3] = 1.0f; - matrix[4][0] = weights[0] * strength; - matrix[4][1] = weights[1] * strength; - matrix[4][2] = weights[2] * strength; - matrix[4][3] = 0.0f; - - vgColorMatrix(dstImage, srcImage, matrix[0]); - - VGImage child = VG_INVALID_HANDLE; - - if (srcRect.isNull() || - (srcRect.topLeft().isNull() && srcRect.size() == size)) { - child = dstImage; - } else { - QRect src = srcRect.toRect(); - child = vgChildImage(dstImage, src.x(), src.y(), src.width(), src.height()); - } - - qt_vg_drawVGImage(painter, dest, child); - - if(child != dstImage) - vgDestroyImage(child); - QVGImagePool::instance()->releaseImage(0, dstImage); -} - -QVGPixmapDropShadowFilter::QVGPixmapDropShadowFilter() - : QPixmapDropShadowFilter() -{ -} - -QVGPixmapDropShadowFilter::~QVGPixmapDropShadowFilter() -{ -} - -void QVGPixmapDropShadowFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const -{ - if (src.isNull()) - return; - - if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { - // The pixmap data is not an instance of QVGPixmapData, so fall - // back to the default drop shadow filter implementation. - QPixmapDropShadowFilter::draw(painter, dest, src, srcRect); - return; - } - - QVGPixmapData *pd = static_cast(src.pixmapData()); - - VGImage srcImage = pd->toVGImage(); - if (srcImage == VG_INVALID_HANDLE) - return; - - QSize size = pd->size(); - VGImage dstImage = QVGImagePool::instance()->createTemporaryImage - (VG_A_8, size.width(), size.height(), - VG_IMAGE_QUALITY_FASTER, pd); - if (dstImage == VG_INVALID_HANDLE) - return; - - // Clamp the radius range. We divide by 2 because the OpenVG blur - // is "too blurry" compared to the default raster implementation. - VGfloat maxRadius = VGfloat(vgGeti(VG_MAX_GAUSSIAN_STD_DEVIATION)); - VGfloat radiusF = VGfloat(blurRadius()) / 2.0f; - if (radiusF < 0.001f) - radiusF = 0.001f; - else if (radiusF > maxRadius) - radiusF = maxRadius; - - // Blur the blackened source image. - vgGaussianBlur(dstImage, srcImage, radiusF, radiusF, VG_TILE_PAD); - - VGImage child = VG_INVALID_HANDLE; - - QRect srect; - if (srcRect.isNull() || - (srcRect.topLeft().isNull() && srcRect.size() == size)) { - child = dstImage; - srect = QRect(0, 0, size.width(), size.height()); - } else { - srect = srcRect.toRect(); - child = vgChildImage(dstImage, srect.x(), srect.y(), srect.width(), srect.height()); - } - - qt_vg_drawVGImageStencil(painter, dest + offset(), child, color()); - - if(child != dstImage) - vgDestroyImage(child); - QVGImagePool::instance()->releaseImage(0, dstImage); - - // Now draw the actual pixmap over the top. - painter->drawPixmap(dest, src, srect); -} - -QVGPixmapBlurFilter::QVGPixmapBlurFilter(QObject *parent) - : QPixmapBlurFilter(parent) -{ -} - -QVGPixmapBlurFilter::~QVGPixmapBlurFilter() -{ -} - -void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const -{ - if (src.isNull()) - return; - - if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) { - // The pixmap data is not an instance of QVGPixmapData, so fall - // back to the default blur filter implementation. - QPixmapBlurFilter::draw(painter, dest, src, srcRect); - return; - } - - QVGPixmapData *pd = static_cast(src.pixmapData()); - - VGImage srcImage = pd->toVGImage(); - if (srcImage == VG_INVALID_HANDLE) - return; - - QSize size = pd->size(); - VGImage dstImage = QVGImagePool::instance()->createTemporaryImage - (VG_sARGB_8888_PRE, size.width(), size.height(), - VG_IMAGE_QUALITY_FASTER, pd); - if (dstImage == VG_INVALID_HANDLE) - return; - - // Clamp the radius range. We divide by 2 because the OpenVG blur - // is "too blurry" compared to the default raster implementation. - VGfloat maxRadius = VGfloat(vgGeti(VG_MAX_GAUSSIAN_STD_DEVIATION)); - VGfloat radiusF = VGfloat(radius()) / 2.0f; - if (radiusF < 0.001f) - radiusF = 0.001f; - else if (radiusF > maxRadius) - radiusF = maxRadius; - - vgGaussianBlur(dstImage, srcImage, radiusF, radiusF, VG_TILE_PAD); - - VGImage child = VG_INVALID_HANDLE; - - if (srcRect.isNull() || - (srcRect.topLeft().isNull() && srcRect.size() == size)) { - child = dstImage; - } else { - QRect src = srcRect.toRect(); - child = vgChildImage(dstImage, src.x(), src.y(), src.width(), src.height()); - } - - qt_vg_drawVGImage(painter, dest, child); - - if(child != dstImage) - vgDestroyImage(child); - QVGImagePool::instance()->releaseImage(0, dstImage); -} - -#endif - -QT_END_NAMESPACE diff --git a/src/openvg/qpixmapfilter_vg_p.h b/src/openvg/qpixmapfilter_vg_p.h deleted file mode 100644 index 710bd8b266a..00000000000 --- a/src/openvg/qpixmapfilter_vg_p.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPIXMAPFILTER_VG_P_H -#define QPIXMAPFILTER_VG_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 "qpixmapdata_vg_p.h" -#include -#include - -QT_BEGIN_NAMESPACE - -#if !defined(QT_SHIVAVG) - -class QVGPixmapConvolutionFilter : public QPixmapConvolutionFilter -{ - Q_OBJECT -public: - QVGPixmapConvolutionFilter(); - ~QVGPixmapConvolutionFilter(); - - void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const; -}; - -class QVGPixmapColorizeFilter : public QPixmapColorizeFilter -{ - Q_OBJECT -public: - QVGPixmapColorizeFilter(); - ~QVGPixmapColorizeFilter(); - - void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const; -}; - -class QVGPixmapDropShadowFilter : public QPixmapDropShadowFilter -{ - Q_OBJECT -public: - QVGPixmapDropShadowFilter(); - ~QVGPixmapDropShadowFilter(); - - void draw(QPainter *p, const QPointF &pos, const QPixmap &px, const QRectF &src) const; -}; - -class QVGPixmapBlurFilter : public QPixmapBlurFilter -{ - Q_OBJECT -public: - QVGPixmapBlurFilter(QObject *parent = 0); - ~QVGPixmapBlurFilter(); - - void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const; -}; - -#endif - -QT_END_NAMESPACE - -#endif diff --git a/src/openvg/qvg.h b/src/openvg/qvg.h deleted file mode 100644 index fa1f099fb91..00000000000 --- a/src/openvg/qvg.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QVG_H -#define QVG_H - -#include - -// Include the OpenVG headers for use in applications that -// issue raw OpenVG function calls. -#if defined(QT_LOWER_CASE_VG_INCLUDES) -#include -#else -#include -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(OpenVG) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/openvg/qvg_p.h b/src/openvg/qvg_p.h deleted file mode 100644 index 2e313b08ed6..00000000000 --- a/src/openvg/qvg_p.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QVG_P_H -#define QVG_P_H - -#include "qvg.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. -// - -// 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) -#include -#endif - -QT_BEGIN_NAMESPACE - -class QVGPaintEngine; - -#if !defined(QT_NO_EGL) - -class QEglContext; - -// Create an EGL context, but don't bind it to a surface. If single-context -// mode is enabled, this will return the previously-created context. -// "devType" indicates the type of device using the context, usually -// QInternal::Widget or QInternal::Pixmap. -Q_OPENVG_EXPORT QEglContext *qt_vg_create_context - (QPaintDevice *device, int devType); - -// Destroy an EGL context that was created by qt_vg_create_context(). -// If single-context mode is enabled, this will decrease the reference count. -// "devType" indicates the type of device destroying the context, usually -// QInternal::Widget or QInternal::Pixmap. -Q_OPENVG_EXPORT void qt_vg_destroy_context - (QEglContext *context, int devType); - -// Return the shared pbuffer surface that can be made current to -// destroy VGImage objects when there is no other surface available. -Q_OPENVG_EXPORT EGLSurface qt_vg_shared_surface(void); - -// Convert the configuration format in a context to a VG or QImage format. -Q_OPENVG_EXPORT VGImageFormat qt_vg_config_to_vg_format(QEglContext *context); -Q_OPENVG_EXPORT QImage::Format qt_vg_config_to_image_format(QEglContext *context); - -#endif - -// Create a paint engine. Returns the common engine in single-context mode. -Q_OPENVG_EXPORT QVGPaintEngine *qt_vg_create_paint_engine(void); - -// Destroy a paint engine. Does nothing in single-context mode. -Q_OPENVG_EXPORT void qt_vg_destroy_paint_engine(QVGPaintEngine *engine); - -// Convert between QImage and VGImage format values. -Q_OPENVG_EXPORT VGImageFormat qt_vg_image_to_vg_format(QImage::Format format); - -QT_END_NAMESPACE - -#endif diff --git a/src/openvg/qvg_symbian.cpp b/src/openvg/qvg_symbian.cpp deleted file mode 100644 index 249b05387a1..00000000000 --- a/src/openvg/qvg_symbian.cpp +++ /dev/null @@ -1,366 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpixmapdata_vg_p.h" -#include "qvgfontglyphcache_p.h" -#include -#include - -#include - -#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE -# include -# ifdef SYMBIAN_FBSERV_GLYPHDATA // defined in fbs.h -# define QT_SYMBIAN_HARDWARE_GLYPH_CACHE -# include -# include -# endif -#endif - -QT_BEGIN_NAMESPACE - -typedef VGImage (*_vgCreateEGLImageTargetKHR)(VGeglImageKHR); -static _vgCreateEGLImageTargetKHR qt_vgCreateEGLImageTargetKHR = 0; - -namespace QVG -{ - VGImage vgCreateEGLImageTargetKHR(VGeglImageKHR eglImage); -} - -VGImage QVG::vgCreateEGLImageTargetKHR(VGeglImageKHR eglImage) -{ - if (!qt_vgCreateEGLImageTargetKHR && QEgl::hasExtension("EGL_KHR_image")) - qt_vgCreateEGLImageTargetKHR = (_vgCreateEGLImageTargetKHR) eglGetProcAddress("vgCreateEGLImageTargetKHR"); - - return qt_vgCreateEGLImageTargetKHR ? qt_vgCreateEGLImageTargetKHR(eglImage) : 0; -} - -extern int qt_vg_pixmap_serial; - -#ifdef QT_SYMBIAN_SUPPORTS_SGIMAGE -static VGImage sgImageToVGImage(QEglContext *context, const RSgImage &sgImage) -{ - // when "0" used as argument then - // default display, context are used - if (!context) - context = qt_vg_create_context(0, QInternal::Pixmap); - - VGImage vgImage = VG_INVALID_HANDLE; - - if (sgImage.IsNull()) - return vgImage; - - const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; - EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(), - EGL_NO_CONTEXT, - EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer)&sgImage, - (EGLint*)KEglImageAttribs); - - if (!eglImage) - return vgImage; - - vgImage = QVG::vgCreateEGLImageTargetKHR(eglImage); - - QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); - return vgImage; -} -#endif - -void QVGPixmapData::cleanup() -{ - is_null = w = h = 0; - recreate = false; - source = QVolatileImage(); -} - -bool QVGPixmapData::initFromNativeImageHandle(void *handle, const QString &type) -{ - if (type == QLatin1String("RSgImage")) { - fromNativeType(handle, QPixmapData::SgImage); - return true; - } else if (type == QLatin1String("CFbsBitmap")) { - fromNativeType(handle, QPixmapData::FbsBitmap); - return true; - } - return false; -} - -void QVGPixmapData::createFromNativeImageHandleProvider() -{ - void *handle = 0; - QString type; - nativeImageHandleProvider->get(&handle, &type); - if (handle) { - if (initFromNativeImageHandle(handle, type)) { - nativeImageHandle = handle; - nativeImageType = type; - } else { - qWarning("QVGPixmapData: Unknown native image type '%s'", qPrintable(type)); - } - } else { - qWarning("QVGPixmapData: Native handle is null"); - } -} - -void QVGPixmapData::releaseNativeImageHandle() -{ - if (nativeImageHandleProvider && nativeImageHandle) { - nativeImageHandleProvider->release(nativeImageHandle, nativeImageType); - nativeImageHandle = 0; - nativeImageType = QString(); - } -} - -static inline bool conversionLessFormat(QImage::Format format) -{ - switch (format) { - case QImage::Format_RGB16: // EColor64K - case QImage::Format_RGB32: // EColor16MU - case QImage::Format_ARGB32: // EColor16MA - case QImage::Format_ARGB32_Premultiplied: // EColor16MAP - case QImage::Format_Indexed8: // EGray256, EColor256 - return true; - default: - return false; - } -} - -void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) -{ - if (type == QPixmapData::SgImage && pixmap) { -#if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL) - RSgImage *sgImage = reinterpret_cast(pixmap); - destroyImages(); - prevSize = QSize(); - - vgImage = sgImageToVGImage(context, *sgImage); - if (vgImage != VG_INVALID_HANDLE) { - w = vgGetParameteri(vgImage, VG_IMAGE_WIDTH); - h = vgGetParameteri(vgImage, VG_IMAGE_HEIGHT); - d = 32; // We always use ARGB_Premultiplied for VG pixmaps. - } - - is_null = (w <= 0 || h <= 0); - source = QVolatileImage(); // readback will be done later, only when needed - recreate = false; - prevSize = QSize(w, h); - updateSerial(); -#endif - } else if (type == QPixmapData::FbsBitmap && pixmap) { - CFbsBitmap *bitmap = reinterpret_cast(pixmap); - QSize size(bitmap->SizeInPixels().iWidth, bitmap->SizeInPixels().iHeight); - resize(size.width(), size.height()); - source = QVolatileImage(bitmap); // duplicates only, if possible - if (source.isNull()) - return; - if (!conversionLessFormat(source.format())) { - // Here we may need to copy if the formats do not match. - // (e.g. for display modes other than EColor16MAP and EColor16MU) - source.beginDataAccess(); - QImage::Format format = idealFormat(&source.imageRef(), Qt::AutoColor); - source.endDataAccess(true); - source.ensureFormat(format); - } - recreate = true; - } else if (type == QPixmapData::VolatileImage && pixmap) { - QVolatileImage *img = static_cast(pixmap); - resize(img->width(), img->height()); - source = *img; - recreate = true; - } else if (type == QPixmapData::NativeImageHandleProvider && pixmap) { - destroyImages(); - nativeImageHandleProvider = static_cast(pixmap); - // Cannot defer the retrieval, we need at least the size right away. - createFromNativeImageHandleProvider(); - } -} - -void* QVGPixmapData::toNativeType(NativeType type) -{ - if (type == QPixmapData::SgImage) { -#if defined(QT_SYMBIAN_SUPPORTS_SGIMAGE) && !defined(QT_NO_EGL) - toVGImage(); - - if (!isValid() || vgImage == VG_INVALID_HANDLE) - return 0; - - TInt err = 0; - - RSgDriver driver; - err = driver.Open(); - if (err != KErrNone) - return 0; - - TSgImageInfo sgInfo; - sgInfo.iPixelFormat = EUidPixelFormatARGB_8888_PRE; - sgInfo.iSizeInPixels.SetSize(w, h); - sgInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface; - - QScopedPointer sgImage(new RSgImage()); - err = sgImage->Create(sgInfo, NULL, NULL); - if (err != KErrNone) { - driver.Close(); - return 0; - } - - const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; - EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(), - EGL_NO_CONTEXT, - EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer)sgImage.data(), - (EGLint*)KEglImageAttribs); - if (!eglImage || eglGetError() != EGL_SUCCESS) { - sgImage->Close(); - driver.Close(); - return 0; - } - - VGImage dstVgImage = QVG::vgCreateEGLImageTargetKHR(eglImage); - if (!dstVgImage || vgGetError() != VG_NO_ERROR) { - QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); - sgImage->Close(); - driver.Close(); - return 0; - } - - vgCopyImage(dstVgImage, 0, 0, - vgImage, 0, 0, - w, h, VG_FALSE); - - if (vgGetError() != VG_NO_ERROR) { - sgImage->Close(); - sgImage.reset(); - } - - // release stuff - vgDestroyImage(dstVgImage); - QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); - driver.Close(); - return reinterpret_cast(sgImage.take()); -#endif - } else if (type == QPixmapData::FbsBitmap && isValid()) { - ensureReadback(true); - if (source.isNull()) { - source = QVolatileImage(w, h, sourceFormat()); - } - // Just duplicate the bitmap handle, no data copying happens. - return source.duplicateNativeImage(); - } - return 0; -} - -QSymbianVGFontGlyphCache::QSymbianVGFontGlyphCache() : QVGFontGlyphCache() -{ -#ifdef QT_SYMBIAN_HARDWARE_GLYPH_CACHE - invertedGlyphs = true; -#endif -} - -void QSymbianVGFontGlyphCache::cacheGlyphs(QVGPaintEnginePrivate *d, - QFontEngine *fontEngine, - const glyph_t *g, int count) -{ -#ifdef QT_SYMBIAN_HARDWARE_GLYPH_CACHE - QFontEngineS60 *s60fontEngine = static_cast(fontEngine); - if (s60fontEngine->m_activeFont->TypeUid() != KCFbsFontUid) - return QVGFontGlyphCache::cacheGlyphs(d, fontEngine, g, count); - - QVector uncachedGlyphs; - while (count-- > 0) { - // Skip this glyph if we have already cached it before. - glyph_t glyph = *g++; - if (((glyph < 256) && ((cachedGlyphsMask[glyph / 32] & (1 << (glyph % 32))) != 0)) - || cachedGlyphs.contains(glyph)) - continue; - if (!uncachedGlyphs.contains(glyph)) - uncachedGlyphs.append(glyph); - } - - if (!uncachedGlyphs.isEmpty()) { - CFbsFont *cfbsFont = static_cast(s60fontEngine->m_activeFont); - RFbsGlyphDataIterator iter; - - int err = iter.Open(*cfbsFont, (const unsigned int*)uncachedGlyphs.constData(), uncachedGlyphs.count()); - - if (err == KErrNotSupported || err == KErrInUse) { // Fallback in possibly supported error cases - iter.Close(); - qWarning("Falling back to default QVGFontGlyphCache"); - return QVGFontGlyphCache::cacheGlyphs(d, fontEngine, g, count); - } - - for (; err == KErrNone; err = iter.Next()) { - const unsigned int glyph = iter.GlyphCode(); - - const RSgImage& image = iter.Image(); - const TOpenFontCharMetrics& metrics = iter.Metrics(); - - TRect glyphBounds; - metrics.GetHorizBounds(glyphBounds); - VGImage vgImage = sgImageToVGImage(0, image); - VGfloat origin[2]; - VGfloat escapement[2]; - origin[0] = -glyphBounds.iTl.iX; - origin[1] = glyphBounds.iBr.iY; - escapement[0] = 0; - escapement[1] = 0; - vgSetGlyphToImage(font, glyph, vgImage, origin, escapement); - vgDestroyImage(vgImage); - - // Add to cache - if (glyph < 256) - cachedGlyphsMask[glyph / 32] |= (1 << (glyph % 32)); - else - cachedGlyphs.insert(glyph); - } - iter.Close(); - - if (err == KErrNoMemory || err == KErrNoGraphicsMemory) - qWarning("Not enough memory to cache glyph"); - else if (err != KErrNotFound) - qWarning("Received error %d from glyph cache", err); - } -#else - QVGFontGlyphCache::cacheGlyphs(d, fontEngine, g, count); -#endif -} - -QT_END_NAMESPACE diff --git a/src/openvg/qvgcompositionhelper_p.h b/src/openvg/qvgcompositionhelper_p.h deleted file mode 100644 index b776b7692a9..00000000000 --- a/src/openvg/qvgcompositionhelper_p.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QVGCOMPOSITIONHELPER_H -#define QVGCOMPOSITIONHELPER_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 "qwindowsurface_vgegl_p.h" - -QT_BEGIN_NAMESPACE - -#if !defined(QVG_NO_SINGLE_CONTEXT) && !defined(QT_NO_EGL) - -class QVGPaintEnginePrivate; -class QVGEGLWindowSurfacePrivate; - -class Q_OPENVG_EXPORT QVGCompositionHelper -{ -public: - QVGCompositionHelper(); - virtual ~QVGCompositionHelper(); - - void startCompositing(const QSize& screenSize); - void endCompositing(); - - void blitWindow(VGImage image, const QSize& imageSize, - const QRect& rect, const QPoint& topLeft, int opacity); - void fillBackground(const QRegion& region, const QBrush& brush); - void drawCursorPixmap(const QPixmap& pixmap, const QPoint& offset); - void setScissor(const QRegion& region); - void clearScissor(); - -private: - QVGPaintEnginePrivate *d; - QSize screenSize; -}; - -#endif - -QT_END_NAMESPACE - -#endif diff --git a/src/openvg/qvgfontglyphcache_p.h b/src/openvg/qvgfontglyphcache_p.h deleted file mode 100644 index cf33d0139fe..00000000000 --- a/src/openvg/qvgfontglyphcache_p.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QVGFONTGLYPHCACHE_H -#define QVGFONTGLYPHCACHE_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 "qvg_p.h" - -QT_BEGIN_NAMESPACE - -class QVGPaintEnginePrivate; - -#ifndef QVG_NO_DRAW_GLYPHS - -class QVGFontGlyphCache -{ -public: - QVGFontGlyphCache(); - virtual ~QVGFontGlyphCache(); - - virtual void cacheGlyphs(QVGPaintEnginePrivate *d, - QFontEngine *fontEngine, - const glyph_t *g, int count); - void setScaleFromText(const QFont &font, QFontEngine *fontEngine); - - VGFont font; - VGfloat scaleX; - VGfloat scaleY; - bool invertedGlyphs; - uint cachedGlyphsMask[256 / 32]; - QSet cachedGlyphs; -}; - -#if defined(Q_OS_SYMBIAN) -class QSymbianVGFontGlyphCache : public QVGFontGlyphCache -{ -public: - QSymbianVGFontGlyphCache(); - void cacheGlyphs(QVGPaintEnginePrivate *d, - QFontEngine *fontEngine, - const glyph_t *g, int count); -}; -#endif - -#endif - -QT_END_NAMESPACE - -#endif // QVGFONTGLYPHCACHE_H diff --git a/src/openvg/qvgimagepool.cpp b/src/openvg/qvgimagepool.cpp deleted file mode 100644 index 3a187b01124..00000000000 --- a/src/openvg/qvgimagepool.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qvgimagepool_p.h" -#include "qpixmapdata_vg_p.h" - -QT_BEGIN_NAMESPACE - -static QVGImagePool *qt_vg_image_pool = 0; - -class QVGImagePoolPrivate -{ -public: - QVGImagePoolPrivate() : lruFirst(0), lruLast(0) {} - - QVGPixmapData *lruFirst; - QVGPixmapData *lruLast; -}; - -QVGImagePool::QVGImagePool() - : d_ptr(new QVGImagePoolPrivate()) -{ -} - -QVGImagePool::~QVGImagePool() -{ -} - -QVGImagePool *QVGImagePool::instance() -{ - if (!qt_vg_image_pool) - qt_vg_image_pool = new QVGImagePool(); - return qt_vg_image_pool; -} - -void QVGImagePool::setImagePool(QVGImagePool *pool) -{ - if (qt_vg_image_pool != pool) - delete qt_vg_image_pool; - qt_vg_image_pool = pool; -} - -VGImage QVGImagePool::createTemporaryImage(VGImageFormat format, - VGint width, VGint height, - VGbitfield allowedQuality, - QVGPixmapData *keepData) -{ - VGImage image; - do { - image = vgCreateImage(format, width, height, allowedQuality); - if (image != VG_INVALID_HANDLE) - return image; - } while (reclaimSpace(format, width, height, keepData)); - qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d temporary image", - width, height); - return VG_INVALID_HANDLE; -} - -VGImage QVGImagePool::createImageForPixmap(VGImageFormat format, - VGint width, VGint height, - VGbitfield allowedQuality, - QVGPixmapData *data) -{ - VGImage image; - do { - image = vgCreateImage(format, width, height, allowedQuality); - if (image != VG_INVALID_HANDLE) { - if (data) - moveToHeadOfLRU(data); - return image; - } - } while (reclaimSpace(format, width, height, data)); - qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d pixmap", - width, height); - return VG_INVALID_HANDLE; -} - -VGImage QVGImagePool::createPermanentImage(VGImageFormat format, - VGint width, VGint height, - VGbitfield allowedQuality) -{ - VGImage image; - do { - image = vgCreateImage(format, width, height, allowedQuality); - if (image != VG_INVALID_HANDLE) - return image; - } while (reclaimSpace(format, width, height, 0)); - qWarning("QVGImagePool: cannot reclaim sufficient space for a %dx%d image", - width, height); - return VG_INVALID_HANDLE; -} - -void QVGImagePool::releaseImage(QVGPixmapData *data, VGImage image) -{ - // Very simple strategy at the moment: just destroy the image. - if (data) - removeFromLRU(data); - vgDestroyImage(image); -} - -void QVGImagePool::useImage(QVGPixmapData *data) -{ - moveToHeadOfLRU(data); -} - -void QVGImagePool::detachImage(QVGPixmapData *data) -{ - removeFromLRU(data); -} - -bool QVGImagePool::reclaimSpace(VGImageFormat format, - VGint width, VGint height, - QVGPixmapData *data) -{ - Q_UNUSED(format); // For future use in picking the best image to eject. - Q_UNUSED(width); - Q_UNUSED(height); - - bool succeeded = false; - bool wasInLRU = false; - if (data) { - wasInLRU = data->inLRU; - moveToHeadOfLRU(data); - } - - QVGPixmapData *lrudata = pixmapLRU(); - if (lrudata && lrudata != data) { - lrudata->reclaimImages(); - succeeded = true; - } - - if (data && !wasInLRU) - removeFromLRU(data); - - return succeeded; -} - -void QVGImagePool::hibernate() -{ - Q_D(QVGImagePool); - QVGPixmapData *pd = d->lruLast; - while (pd) { - QVGPixmapData *prevLRU = pd->prevLRU; - pd->inImagePool = false; - pd->inLRU = false; - pd->nextLRU = 0; - pd->prevLRU = 0; - pd->hibernate(); - pd = prevLRU; - } - d->lruFirst = 0; - d->lruLast = 0; -} - -void QVGImagePool::moveToHeadOfLRU(QVGPixmapData *data) -{ - Q_D(QVGImagePool); - if (data->inLRU) { - if (!data->prevLRU) - return; // Already at the head of the list. - removeFromLRU(data); - } - data->inLRU = true; - data->nextLRU = d->lruFirst; - data->prevLRU = 0; - if (d->lruFirst) - d->lruFirst->prevLRU = data; - else - d->lruLast = data; - d->lruFirst = data; -} - -void QVGImagePool::removeFromLRU(QVGPixmapData *data) -{ - Q_D(QVGImagePool); - if (!data->inLRU) - return; - if (data->nextLRU) - data->nextLRU->prevLRU = data->prevLRU; - else - d->lruLast = data->prevLRU; - if (data->prevLRU) - data->prevLRU->nextLRU = data->nextLRU; - else - d->lruFirst = data->nextLRU; - data->inLRU = false; -} - -QVGPixmapData *QVGImagePool::pixmapLRU() -{ - Q_D(QVGImagePool); - return d->lruLast; -} - -QT_END_NAMESPACE diff --git a/src/openvg/qvgimagepool_p.h b/src/openvg/qvgimagepool_p.h deleted file mode 100644 index 07c57bf44ad..00000000000 --- a/src/openvg/qvgimagepool_p.h +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QVGIMAGEPOOL_P_H -#define QVGIMAGEPOOL_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 "qvg.h" -#include - -QT_BEGIN_NAMESPACE - -class QVGPixmapData; -class QVGImagePoolPrivate; - -class Q_OPENVG_EXPORT QVGImagePool -{ -public: - QVGImagePool(); - virtual ~QVGImagePool(); - - static QVGImagePool *instance(); - - // This function can be used from system-specific graphics system - // plugins to alter the image allocation strategy. - static void setImagePool(QVGImagePool *pool); - - // Create a new VGImage from the pool with the specified parameters - // that is not associated with a pixmap. The VGImage is returned to - // the pool when releaseImage() is called. - // - // This function will call reclaimSpace() when vgCreateImage() fails. - // - // This function is typically called when allocating temporary - // VGImage's for pixmap filters. The "keepData" object will not - // be reclaimed if reclaimSpace() needs to be called. - virtual VGImage createTemporaryImage(VGImageFormat format, - VGint width, VGint height, - VGbitfield allowedQuality, - QVGPixmapData *keepData = 0); - - // Create a new VGImage with the specified parameters and associate - // it with "data". The QVGPixmapData will be notified when the - // VGImage needs to be reclaimed by the pool. - // - // This function will call reclaimSpace() when vgCreateImage() fails. - virtual VGImage createImageForPixmap(VGImageFormat format, - VGint width, VGint height, - VGbitfield allowedQuality, - QVGPixmapData *data); - - // Create a permanent VGImage with the specified parameters. - // If there is insufficient space for the vgCreateImage call, - // then this function will call reclaimSpace() and try again. - // - // The caller is responsible for calling vgDestroyImage() - // when it no longer needs the VGImage, as the image is not - // recorded in the image pool. - // - // This function is typically used for pattern brushes where - // the OpenVG engine is responsible for managing the lifetime - // of the VGImage, destroying it automatically when the brush - // is no longer in use. - virtual VGImage createPermanentImage(VGImageFormat format, - VGint width, VGint height, - VGbitfield allowedQuality); - - // Release a VGImage that is no longer required. - virtual void releaseImage(QVGPixmapData *data, VGImage image); - - // Notify the pool that a QVGPixmapData object is using - // an image again. This allows the pool to move the image - // within a least-recently-used list of QVGPixmapData objects. - virtual void useImage(QVGPixmapData *data); - - // Notify the pool that the VGImage's associated with a - // QVGPixmapData are being detached from the pool. The caller - // will become responsible for calling vgDestroyImage(). - virtual void detachImage(QVGPixmapData *data); - - // Reclaim space for an image allocation with the specified parameters. - // Returns true if space was reclaimed, or false if there is no - // further space that can be reclaimed. The "data" parameter - // indicates the pixmap that is trying to obtain space which should - // not itself be reclaimed. - virtual bool reclaimSpace(VGImageFormat format, - VGint width, VGint height, - QVGPixmapData *data); - - // Hibernate the image pool because the context is about to be - // destroyed. All VGImage's left in the pool should be released. - virtual void hibernate(); - -protected: - // Helper functions for managing the LRU list of QVGPixmapData objects. - void moveToHeadOfLRU(QVGPixmapData *data); - void removeFromLRU(QVGPixmapData *data); - QVGPixmapData *pixmapLRU(); - -private: - QScopedPointer d_ptr; - - Q_DECLARE_PRIVATE(QVGImagePool) - Q_DISABLE_COPY(QVGImagePool) -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp deleted file mode 100644 index 778e14c0978..00000000000 --- a/src/openvg/qwindowsurface_vg.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_vg_p.h" -#include "qwindowsurface_vgegl_p.h" -#include "qpaintengine_vg_p.h" -#include "qpixmapdata_vg_p.h" -#include "qvg_p.h" - -#if !defined(QT_NO_EGL) - -#include -#include - -QT_BEGIN_NAMESPACE - -QVGWindowSurface::QVGWindowSurface(QWidget *window) - : QWindowSurface(window) -{ - // Create the default type of EGL window surface for windows. - d_ptr = new QVGEGLWindowSurfaceDirect(this); -} - -QVGWindowSurface::QVGWindowSurface - (QWidget *window, QVGEGLWindowSurfacePrivate *d) - : QWindowSurface(window), d_ptr(d) -{ -} - -QVGWindowSurface::~QVGWindowSurface() -{ - delete d_ptr; -} - -QPaintDevice *QVGWindowSurface::paintDevice() -{ - return this; -} - -void QVGWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(offset); - -#ifdef Q_OS_SYMBIAN - if (window() != widget) { - // For performance reasons we don't support - // flushing native child widgets on Symbian. - // It breaks overlapping native child widget - // rendering in some cases but we prefer performance. - return; - } -#endif - - QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); - d_ptr->endPaint(parent, region); -} - -void QVGWindowSurface::setGeometry(const QRect &rect) -{ - QWindowSurface::setGeometry(rect); -} - -bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - if (!d_ptr->scroll(window(), area, dx, dy)) - return QWindowSurface::scroll(area, dx, dy); - return true; -} - -void QVGWindowSurface::beginPaint(const QRegion ®ion) -{ - d_ptr->beginPaint(window()); - - // If the window is not opaque, then fill the region we are about - // to paint with the transparent color. - if (!qt_widget_private(window())->isOpaque && - window()->testAttribute(Qt::WA_TranslucentBackground)) { - QVGPaintEngine *engine = static_cast - (d_ptr->paintEngine()); - engine->fillRegion(region, Qt::transparent, d_ptr->surfaceSize()); - } -} - -void QVGWindowSurface::endPaint(const QRegion ®ion) -{ - // Nothing to do here. - Q_UNUSED(region); -} - -QPaintEngine *QVGWindowSurface::paintEngine() const -{ - return d_ptr->paintEngine(); -} - -QWindowSurface::WindowSurfaceFeatures QVGWindowSurface::features() const -{ - WindowSurfaceFeatures features = PartialUpdates | PreservedContents; - if (d_ptr->supportsStaticContents()) - features |= StaticContents; - return features; -} - -int QVGWindowSurface::metric(PaintDeviceMetric met) const -{ - return qt_paint_device_metric(window(), met); -} - -QT_END_NAMESPACE - -#endif diff --git a/src/openvg/qwindowsurface_vg_p.h b/src/openvg/qwindowsurface_vg_p.h deleted file mode 100644 index 4ce73eb99ad..00000000000 --- a/src/openvg/qwindowsurface_vg_p.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_VG_P_H -#define QWINDOWSURFACE_VG_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(QT_NO_EGL) - -class QVGEGLWindowSurfacePrivate; - -class Q_OPENVG_EXPORT QVGWindowSurface : public QWindowSurface, public QPaintDevice -{ -public: - QVGWindowSurface(QWidget *window); - QVGWindowSurface(QWidget *window, QVGEGLWindowSurfacePrivate *d); - ~QVGWindowSurface(); - - 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; - - WindowSurfaceFeatures features() const; - -protected: - int metric(PaintDeviceMetric metric) const; - -private: - QVGEGLWindowSurfacePrivate *d_ptr; -}; - -#endif - -QT_END_NAMESPACE - -#endif // QWINDOWSURFACE_VG_P_H diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp deleted file mode 100644 index f7961b4a7dc..00000000000 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ /dev/null @@ -1,783 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsurface_vgegl_p.h" -#include "qpaintengine_vg_p.h" -#include "qpixmapdata_vg_p.h" -#include "qvgimagepool_p.h" -#include "qvg_p.h" - -#if !defined(QT_NO_EGL) - -QT_BEGIN_NAMESPACE - -// Turn off "direct to window" rendering if EGL cannot support it. -#if !defined(EGL_RENDER_BUFFER) || !defined(EGL_SINGLE_BUFFER) -#if defined(QVG_DIRECT_TO_WINDOW) -#undef QVG_DIRECT_TO_WINDOW -#endif -#endif - -// Determine if preserved window contents should be used. -#if !defined(EGL_SWAP_BEHAVIOR) || !defined(EGL_BUFFER_PRESERVED) -#if !defined(QVG_NO_PRESERVED_SWAP) -#define QVG_NO_PRESERVED_SWAP 1 -#endif -#endif - -VGImageFormat qt_vg_config_to_vg_format(QEglContext *context) -{ - return qt_vg_image_to_vg_format - (qt_vg_config_to_image_format(context)); -} - -QImage::Format qt_vg_config_to_image_format(QEglContext *context) -{ - EGLint red = context->configAttrib(EGL_RED_SIZE); - EGLint green = context->configAttrib(EGL_GREEN_SIZE); - EGLint blue = context->configAttrib(EGL_BLUE_SIZE); - EGLint alpha = context->configAttrib(EGL_ALPHA_SIZE); - QImage::Format argbFormat; -#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT - EGLint type = context->configAttrib(EGL_SURFACE_TYPE); - if ((type & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0) - argbFormat = QImage::Format_ARGB32_Premultiplied; - else - argbFormat = QImage::Format_ARGB32; -#else - argbFormat = QImage::Format_ARGB32; -#endif - if (red == 8 && green == 8 && blue == 8 && alpha == 8) - return argbFormat; - else if (red == 8 && green == 8 && blue == 8 && alpha == 0) - return QImage::Format_RGB32; - else if (red == 5 && green == 6 && blue == 5 && alpha == 0) - return QImage::Format_RGB16; - else if (red == 4 && green == 4 && blue == 4 && alpha == 4) - return QImage::Format_ARGB4444_Premultiplied; - else - return argbFormat; // XXX -} - -#if !defined(QVG_NO_SINGLE_CONTEXT) - -class QVGSharedContext -{ -public: - QVGSharedContext(); - ~QVGSharedContext(); - - QEglContext *context; - int refCount; - int widgetRefCount; - QVGPaintEngine *engine; - EGLSurface surface; - QVGPixmapData *firstPixmap; -}; - -QVGSharedContext::QVGSharedContext() - : context(0) - , refCount(0) - , widgetRefCount(0) - , engine(0) - , surface(EGL_NO_SURFACE) - , firstPixmap(0) -{ -} - -QVGSharedContext::~QVGSharedContext() -{ - // Don't accidentally destroy the QEglContext if the reference - // count falls to zero while deleting the paint engine. - ++refCount; - - if (context) - context->makeCurrent(qt_vg_shared_surface()); - delete engine; - if (context) - context->doneCurrent(); - if (context && surface != EGL_NO_SURFACE) - context->destroySurface(surface); - delete context; -} - -Q_GLOBAL_STATIC(QVGSharedContext, sharedContext); - -QVGPaintEngine *qt_vg_create_paint_engine(void) -{ - QVGSharedContext *shared = sharedContext(); - if (!shared->engine) - shared->engine = new QVGPaintEngine(); - return shared->engine; -} - -void qt_vg_destroy_paint_engine(QVGPaintEngine *engine) -{ - Q_UNUSED(engine); -} - -void qt_vg_register_pixmap(QVGPixmapData *pd) -{ - QVGSharedContext *shared = sharedContext(); - pd->next = shared->firstPixmap; - pd->prev = 0; - if (shared->firstPixmap) - shared->firstPixmap->prev = pd; - shared->firstPixmap = pd; -} - -void qt_vg_unregister_pixmap(QVGPixmapData *pd) -{ - if (pd->next) - pd->next->prev = pd->prev; - if (pd->prev) { - pd->prev->next = pd->next; - } else { - QVGSharedContext *shared = sharedContext(); - if (shared) - shared->firstPixmap = pd->next; - } -} - -#else - -QVGPaintEngine *qt_vg_create_paint_engine(void) -{ - return new QVGPaintEngine(); -} - -void qt_vg_destroy_paint_engine(QVGPaintEngine *engine) -{ - delete engine; -} - -void qt_vg_register_pixmap(QVGPixmapData *pd) -{ - Q_UNUSED(pd); -} - -void qt_vg_unregister_pixmap(QVGPixmapData *pd) -{ - Q_UNUSED(pd); -} - -#endif - -#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT - -static bool isPremultipliedContext(const QEglContext *context) -{ - return context->configAttrib(EGL_SURFACE_TYPE) & EGL_VG_ALPHA_FORMAT_PRE_BIT; -} - -#endif - -static QEglContext *createContext(QPaintDevice *device) -{ - QEglContext *context; - - // Create the context object and open the display. - context = new QEglContext(); - context->setApi(QEgl::OpenVG); - - // Set the swap interval for the display. - QByteArray interval = qgetenv("QT_VG_SWAP_INTERVAL"); - if (!interval.isEmpty()) - eglSwapInterval(QEgl::display(), interval.toInt()); - else - eglSwapInterval(QEgl::display(), 1); - -#ifdef EGL_RENDERABLE_TYPE - // Has the user specified an explicit EGL configuration to use? - QByteArray configId = qgetenv("QT_VG_EGL_CONFIG"); - if (!configId.isEmpty()) { - EGLint cfgId = configId.toInt(); - EGLint properties[] = { - EGL_CONFIG_ID, cfgId, - EGL_NONE - }; - EGLint matching = 0; - EGLConfig cfg; - if (eglChooseConfig - (QEgl::display(), properties, &cfg, 1, &matching) && - matching > 0) { - // Check that the selected configuration actually supports OpenVG - // and then create the context with it. - EGLint id = 0; - EGLint type = 0; - eglGetConfigAttrib - (QEgl::display(), cfg, EGL_CONFIG_ID, &id); - eglGetConfigAttrib - (QEgl::display(), cfg, EGL_RENDERABLE_TYPE, &type); - if (cfgId == id && (type & EGL_OPENVG_BIT) != 0) { - context->setConfig(cfg); - if (!context->createContext()) { - delete context; - return 0; - } - return context; - } else { - qWarning("QT_VG_EGL_CONFIG: %d is not a valid OpenVG configuration", int(cfgId)); - } - } - } -#endif - - // Choose an appropriate configuration for rendering into the device. - QEglProperties configProps; - configProps.setPaintDeviceFormat(device); - int redSize = configProps.value(EGL_RED_SIZE); - if (redSize == EGL_DONT_CARE || redSize == 0) - configProps.setPixelFormat(QImage::Format_ARGB32); // XXX - configProps.setValue(EGL_ALPHA_MASK_SIZE, 1); -#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT - configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT - | EGL_SWAP_BEHAVIOR_PRESERVED_BIT - | EGL_VG_ALPHA_FORMAT_PRE_BIT); - configProps.setRenderableType(QEgl::OpenVG); - if (!context->chooseConfig(configProps)) { - // Try again without the "pre" bit. - configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT); - if (!context->chooseConfig(configProps)) { - delete context; - return 0; - } - } -#else - configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT); - configProps.setRenderableType(QEgl::OpenVG); - if (!context->chooseConfig(configProps)) { - delete context; - return 0; - } -#endif - - // Construct a new EGL context for the selected configuration. - if (!context->createContext()) { - delete context; - return 0; - } - - return context; -} - -#if !defined(QVG_NO_SINGLE_CONTEXT) - -QEglContext *qt_vg_create_context(QPaintDevice *device, int devType) -{ - QVGSharedContext *shared = sharedContext(); - if (devType == QInternal::Widget) - ++(shared->widgetRefCount); - if (shared->context) { - ++(shared->refCount); - return shared->context; - } else { - shared->context = createContext(device); - shared->refCount = 1; - return shared->context; - } -} - -static void qt_vg_destroy_shared_context(QVGSharedContext *shared) -{ - shared->context->makeCurrent(qt_vg_shared_surface()); - delete shared->engine; - shared->engine = 0; - shared->context->doneCurrent(); - if (shared->surface != EGL_NO_SURFACE) { - eglDestroySurface(QEgl::display(), shared->surface); - shared->surface = EGL_NO_SURFACE; - } - delete shared->context; - shared->context = 0; -} - -void qt_vg_hibernate_pixmaps(QVGSharedContext *shared) -{ - // Artificially increase the reference count to prevent the - // context from being destroyed until after we have finished - // the hibernation process. - ++(shared->refCount); - - // We need a context current to hibernate the VGImage objects. - shared->context->makeCurrent(qt_vg_shared_surface()); - - // Scan all QVGPixmapData objects in the system and hibernate them. - QVGPixmapData *pd = shared->firstPixmap; - while (pd != 0) { - pd->hibernate(); - pd = pd->next; - } - - // Hibernate any remaining VGImage's in the image pool. - QVGImagePool::instance()->hibernate(); - - // Don't need the current context any more. - shared->context->lazyDoneCurrent(); - - // Decrease the reference count and destroy the context if necessary. - if (--(shared->refCount) <= 0) - qt_vg_destroy_shared_context(shared); -} - -void qt_vg_destroy_context(QEglContext *context, int devType) -{ - QVGSharedContext *shared = sharedContext(); - if (shared->context != context) { - // This is not the shared context. Shouldn't happen! - delete context; - return; - } - if (devType == QInternal::Widget) - --(shared->widgetRefCount); - if (--(shared->refCount) <= 0) { - qt_vg_destroy_shared_context(shared); - } else if (shared->widgetRefCount <= 0 && devType == QInternal::Widget) { - // All of the widget window surfaces have been destroyed - // but we still have VG pixmaps active. Ask them to hibernate - // to free up GPU resources until a widget is shown again. - // This may eventually cause the EGLContext to be destroyed - // because nothing in the system needs a context, which will - // free up even more GPU resources. - qt_vg_hibernate_pixmaps(shared); - } -} - -EGLSurface qt_vg_shared_surface(void) -{ - QVGSharedContext *shared = sharedContext(); - if (shared->surface == EGL_NO_SURFACE) { - EGLint attribs[7]; - attribs[0] = EGL_WIDTH; - attribs[1] = 16; - attribs[2] = EGL_HEIGHT; - attribs[3] = 16; -#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT - if (isPremultipliedContext(shared->context)) { - attribs[4] = EGL_VG_ALPHA_FORMAT; - attribs[5] = EGL_VG_ALPHA_FORMAT_PRE; - attribs[6] = EGL_NONE; - } else -#endif - { - attribs[4] = EGL_NONE; - } - shared->surface = eglCreatePbufferSurface - (QEgl::display(), shared->context->config(), attribs); - } - return shared->surface; -} - -#else - -QEglContext *qt_vg_create_context(QPaintDevice *device, int devType) -{ - Q_UNUSED(devType); - return createContext(device); -} - -void qt_vg_destroy_context(QEglContext *context, int devType) -{ - Q_UNUSED(devType); - delete context; -} - -EGLSurface qt_vg_shared_surface(void) -{ - return EGL_NO_SURFACE; -} - -#endif - -QVGEGLWindowSurfacePrivate::QVGEGLWindowSurfacePrivate(QWindowSurface *win) -{ - winSurface = win; - engine = 0; -} - -QVGEGLWindowSurfacePrivate::~QVGEGLWindowSurfacePrivate() -{ - // Destroy the paint engine if it hasn't been destroyed already. - destroyPaintEngine(); -} - -QVGPaintEngine *QVGEGLWindowSurfacePrivate::paintEngine() -{ - if (!engine) - engine = qt_vg_create_paint_engine(); - return engine; -} - -VGImage QVGEGLWindowSurfacePrivate::surfaceImage() const -{ - return VG_INVALID_HANDLE; -} - -void QVGEGLWindowSurfacePrivate::destroyPaintEngine() -{ - if (engine) { - qt_vg_destroy_paint_engine(engine); - engine = 0; - } -} - -QSize QVGEGLWindowSurfacePrivate::windowSurfaceSize(QWidget *widget) const -{ - Q_UNUSED(widget); - - QRect rect = winSurface->geometry(); - QSize newSize = rect.size(); - -#if defined(Q_WS_QWS) - // Account for the widget mask, if any. - if (widget && !widget->mask().isEmpty()) { - const QRegion region = widget->mask() - & rect.translated(-widget->geometry().topLeft()); - newSize = region.boundingRect().size(); - } -#endif - - return newSize; -} - -#if defined(QVG_VGIMAGE_BACKBUFFERS) - -QVGEGLWindowSurfaceVGImage::QVGEGLWindowSurfaceVGImage(QWindowSurface *win) - : QVGEGLWindowSurfacePrivate(win) - , context(0) - , backBuffer(VG_INVALID_HANDLE) - , backBufferSurface(EGL_NO_SURFACE) - , recreateBackBuffer(false) - , isPaintingActive(false) - , windowSurface(EGL_NO_SURFACE) -{ -} - -QVGEGLWindowSurfaceVGImage::~QVGEGLWindowSurfaceVGImage() -{ - destroyPaintEngine(); - if (context) { - if (backBufferSurface != EGL_NO_SURFACE) { - // We need a current context to be able to destroy the image. - // We use the shared surface because the native window handle - // associated with "windowSurface" may have been destroyed already. - context->makeCurrent(qt_vg_shared_surface()); - context->destroySurface(backBufferSurface); - vgDestroyImage(backBuffer); - context->doneCurrent(); - } - if (windowSurface != EGL_NO_SURFACE) - context->destroySurface(windowSurface); - qt_vg_destroy_context(context, QInternal::Widget); - } -} - -QEglContext *QVGEGLWindowSurfaceVGImage::ensureContext(QWidget *widget) -{ - QSize newSize = windowSurfaceSize(widget); - if (context && size != newSize) { - // The surface size has changed, so we need to recreate - // the back buffer. Keep the same context and paint engine. - size = newSize; - if (isPaintingActive) - context->doneCurrent(); - isPaintingActive = false; - recreateBackBuffer = true; - } - if (!context) { - // Create a new EGL context. We create the surface in beginPaint(). - size = newSize; - context = qt_vg_create_context(widget, QInternal::Widget); - if (!context) - return 0; - isPaintingActive = false; - } - return context; -} - -void QVGEGLWindowSurfaceVGImage::beginPaint(QWidget *widget) -{ - QEglContext *context = ensureContext(widget); - if (context) { - if (recreateBackBuffer || backBufferSurface == EGL_NO_SURFACE) { - // Create a VGImage object to act as the back buffer - // for this window. We have to create the VGImage with a - // current context, so activate the main surface for the window. - context->makeCurrent(mainSurface()); - recreateBackBuffer = false; - if (backBufferSurface != EGL_NO_SURFACE) { - eglDestroySurface(QEgl::display(), backBufferSurface); - backBufferSurface = EGL_NO_SURFACE; - } - if (backBuffer != VG_INVALID_HANDLE) { - vgDestroyImage(backBuffer); - } - VGImageFormat format = qt_vg_config_to_vg_format(context); - backBuffer = vgCreateImage - (format, size.width(), size.height(), - VG_IMAGE_QUALITY_FASTER); - if (backBuffer != VG_INVALID_HANDLE) { - // Create an EGL surface for rendering into the VGImage. - backBufferSurface = eglCreatePbufferFromClientBuffer - (QEgl::display(), EGL_OPENVG_IMAGE, - (EGLClientBuffer)(backBuffer), - context->config(), NULL); - if (backBufferSurface == EGL_NO_SURFACE) { - vgDestroyImage(backBuffer); - backBuffer = VG_INVALID_HANDLE; - } - } - } - if (backBufferSurface != EGL_NO_SURFACE) - context->makeCurrent(backBufferSurface); - else - context->makeCurrent(mainSurface()); - isPaintingActive = true; - } -} - -void QVGEGLWindowSurfaceVGImage::endPaint - (QWidget *widget, const QRegion& region, QImage *image) -{ - Q_UNUSED(region); - Q_UNUSED(image); - QEglContext *context = ensureContext(widget); - if (context) { - if (backBufferSurface != EGL_NO_SURFACE) { - if (isPaintingActive) - vgFlush(); - context->lazyDoneCurrent(); - } - isPaintingActive = false; - } -} - -VGImage QVGEGLWindowSurfaceVGImage::surfaceImage() const -{ - return backBuffer; -} - -EGLSurface QVGEGLWindowSurfaceVGImage::mainSurface() const -{ - if (windowSurface != EGL_NO_SURFACE) - return windowSurface; - else - return qt_vg_shared_surface(); -} - -#endif // QVG_VGIMAGE_BACKBUFFERS - -QVGEGLWindowSurfaceDirect::QVGEGLWindowSurfaceDirect(QWindowSurface *win) - : QVGEGLWindowSurfacePrivate(win) - , context(0) - , isPaintingActive(false) - , needToSwap(false) - , windowSurface(EGL_NO_SURFACE) -{ -} - -QVGEGLWindowSurfaceDirect::~QVGEGLWindowSurfaceDirect() -{ - destroyPaintEngine(); - if (context) { - if (windowSurface != EGL_NO_SURFACE) - context->destroySurface(windowSurface); - qt_vg_destroy_context(context, QInternal::Widget); - } -} - -QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget) -{ - QSize newSize = windowSurfaceSize(widget); - QEglProperties surfaceProps; - -#if defined(QVG_RECREATE_ON_SIZE_CHANGE) -#if !defined(QVG_NO_SINGLE_CONTEXT) - if (context && size != newSize) { - // The surface size has changed, so we need to recreate it. - // We can keep the same context and paint engine. - size = newSize; - if (isPaintingActive) - context->doneCurrent(); - context->destroySurface(windowSurface); -#if defined(EGL_VG_ALPHA_FORMAT_PRE_BIT) - if (isPremultipliedContext(context)) { - surfaceProps.setValue - (EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE); - } else { - surfaceProps.removeValue(EGL_VG_ALPHA_FORMAT); - } -#endif - windowSurface = context->createSurface(widget, &surfaceProps); - isPaintingActive = false; - needToSwap = true; - } -#else - if (context && size != newSize) { - // The surface size has changed, so we need to recreate - // the EGL context for the widget. We also need to recreate - // the surface's paint engine if context sharing is not - // enabled because we cannot reuse the existing paint objects - // in the new context. - qt_vg_destroy_paint_engine(engine); - engine = 0; - context->destroySurface(windowSurface); - qt_vg_destroy_context(context, QInternal::Widget); - context = 0; - windowSurface = EGL_NO_SURFACE; - } -#endif -#endif - if (!context) { - // Create a new EGL context and bind it to the widget surface. - size = newSize; - context = qt_vg_create_context(widget, QInternal::Widget); - if (!context) - return 0; - // We want a direct to window rendering surface if possible. -#if defined(QVG_DIRECT_TO_WINDOW) - surfaceProps.setValue(EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER); -#endif -#if defined(EGL_VG_ALPHA_FORMAT_PRE_BIT) - if (isPremultipliedContext(context)) { - surfaceProps.setValue - (EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE); - } else { - surfaceProps.removeValue(EGL_VG_ALPHA_FORMAT); - } -#endif - EGLSurface surface = context->createSurface(widget, &surfaceProps); - if (surface == EGL_NO_SURFACE) { - qt_vg_destroy_context(context, QInternal::Widget); - context = 0; - return 0; - } - needToSwap = true; -#if defined(QVG_DIRECT_TO_WINDOW) - // Did we get a direct to window rendering surface? - EGLint buffer = 0; - if (eglQueryContext(QEgl::display(), context->context(), - EGL_RENDER_BUFFER, &buffer) && - buffer == EGL_SINGLE_BUFFER) { - needToSwap = false; - } -#endif - windowSurface = surface; - isPaintingActive = false; - } - -#if !defined(QVG_NO_PRESERVED_SWAP) - // Try to force the surface back buffer to preserve its contents. - if (needToSwap) { - bool succeeded = eglSurfaceAttrib(QEgl::display(), windowSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - if (!succeeded && eglGetError() != EGL_SUCCESS) { - qWarning("QVG: could not enable preserved swap"); - } - } -#endif - return context; -} - -void QVGEGLWindowSurfaceDirect::beginPaint(QWidget *widget) -{ - QEglContext *context = ensureContext(widget); - if (context) { - context->makeCurrent(windowSurface); - isPaintingActive = true; - } -} - -void QVGEGLWindowSurfaceDirect::endPaint - (QWidget *widget, const QRegion& region, QImage *image) -{ - Q_UNUSED(region); - Q_UNUSED(image); - QEglContext *context = ensureContext(widget); - if (context) { - if (needToSwap) { - if (!isPaintingActive) - context->makeCurrent(windowSurface); - context->swapBuffers(windowSurface); - context->lazyDoneCurrent(); - } else if (isPaintingActive) { - vgFlush(); - context->lazyDoneCurrent(); - } - isPaintingActive = false; - } -} - -bool QVGEGLWindowSurfaceDirect::supportsStaticContents() const -{ -#if defined(QVG_BUFFER_SCROLLING) && !defined(QVG_NO_PRESERVED_SWAP) - return true; -#else - return QVGEGLWindowSurfacePrivate::supportsStaticContents(); -#endif -} - -bool QVGEGLWindowSurfaceDirect::scroll(QWidget *widget, const QRegion& area, int dx, int dy) -{ -#ifdef QVG_BUFFER_SCROLLING - QEglContext *context = ensureContext(widget); - if (context) { - context->makeCurrent(windowSurface); - QRect scrollRect = area.boundingRect(); - int sx = scrollRect.x(); - int sy = size.height() - scrollRect.y() - scrollRect.height(); - vgSeti(VG_SCISSORING, VG_FALSE); - vgCopyPixels(sx + dx, sy - dy, sx, sy, scrollRect.width(), scrollRect.height()); - context->lazyDoneCurrent(); - return true; - } -#else - Q_UNUSED(widget); - Q_UNUSED(area); - Q_UNUSED(dx); - Q_UNUSED(dy); -#endif - return false; -} - -QT_END_NAMESPACE - -#endif diff --git a/src/openvg/qwindowsurface_vgegl_p.h b/src/openvg/qwindowsurface_vgegl_p.h deleted file mode 100644 index 231c5488a95..00000000000 --- a/src/openvg/qwindowsurface_vgegl_p.h +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_VGEGL_P_H -#define QWINDOWSURFACE_VGEGL_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 -#include "qvg_p.h" - -#if !defined(QT_NO_EGL) - -#include - -QT_BEGIN_NAMESPACE - -class QWindowSurface; - -class Q_OPENVG_EXPORT QVGEGLWindowSurfacePrivate -{ -public: - QVGEGLWindowSurfacePrivate(QWindowSurface *win); - virtual ~QVGEGLWindowSurfacePrivate(); - - QVGPaintEngine *paintEngine(); - virtual QEglContext *ensureContext(QWidget *widget) = 0; - virtual void beginPaint(QWidget *widget) = 0; - virtual void endPaint - (QWidget *widget, const QRegion& region, QImage *image = 0) = 0; - virtual VGImage surfaceImage() const; - virtual QSize surfaceSize() const = 0; - virtual bool supportsStaticContents() const { return false; } - virtual bool scroll(QWidget *, const QRegion&, int, int) { return false; } - -private: - QVGPaintEngine *engine; - -protected: - QWindowSurface *winSurface; - - void destroyPaintEngine(); - QSize windowSurfaceSize(QWidget *widget) const; -}; - -#if defined(EGL_OPENVG_IMAGE) && !defined(QVG_NO_SINGLE_CONTEXT) - -#define QVG_VGIMAGE_BACKBUFFERS 1 - -class Q_OPENVG_EXPORT QVGEGLWindowSurfaceVGImage : public QVGEGLWindowSurfacePrivate -{ -public: - QVGEGLWindowSurfaceVGImage(QWindowSurface *win); - virtual ~QVGEGLWindowSurfaceVGImage(); - - QEglContext *ensureContext(QWidget *widget); - void beginPaint(QWidget *widget); - void endPaint(QWidget *widget, const QRegion& region, QImage *image); - VGImage surfaceImage() const; - QSize surfaceSize() const { return size; } - -protected: - QEglContext *context; - VGImage backBuffer; - EGLSurface backBufferSurface; - bool recreateBackBuffer; - bool isPaintingActive; - QSize size; - EGLSurface windowSurface; - - EGLSurface mainSurface() const; -}; - -#endif // EGL_OPENVG_IMAGE - -class Q_OPENVG_EXPORT QVGEGLWindowSurfaceDirect : public QVGEGLWindowSurfacePrivate -{ -public: - QVGEGLWindowSurfaceDirect(QWindowSurface *win); - virtual ~QVGEGLWindowSurfaceDirect(); - - QEglContext *ensureContext(QWidget *widget); - void beginPaint(QWidget *widget); - void endPaint(QWidget *widget, const QRegion& region, QImage *image); - QSize surfaceSize() const { return size; } - bool supportsStaticContents() const; - bool scroll(QWidget *widget, const QRegion& area, int dx, int dy); - -protected: - QEglContext *context; - QSize size; - bool isPaintingActive; - bool needToSwap; - EGLSurface windowSurface; -}; - -QT_END_NAMESPACE - -#endif // !QT_NO_EGL - -#endif // QWINDOWSURFACE_VGEGL_P_H diff --git a/src/platformsupport/cglconvenience/cglconvenience.mm b/src/platformsupport/cglconvenience/cglconvenience.mm new file mode 100644 index 00000000000..6b0354834dc --- /dev/null +++ b/src/platformsupport/cglconvenience/cglconvenience.mm @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "cglconvenience_p.h" +#include +#include + +void (*qcgl_getProcAddress(const QByteArray &procName))() +{ + CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, + CFSTR("/System/Library/Frameworks/OpenGL.framework"), kCFURLPOSIXPathStyle, false); + CFBundleRef bundle = CFBundleCreate(kCFAllocatorDefault, url); + CFStringRef procNameCF = QCFString::toCFStringRef(QString::fromAscii(procName.constData())); + void *proc = CFBundleGetFunctionPointerForName(bundle, procNameCF); + CFRelease(url); + CFRelease(bundle); + CFRelease(procNameCF); + return (void (*) ())proc; +} + +// Match up with createNSOpenGLPixelFormat below! +QSurfaceFormat qcgl_surfaceFormat() +{ + QSurfaceFormat format; + format.setRedBufferSize(8); + format.setGreenBufferSize(8); + format.setBlueBufferSize(8); + format.setAlphaBufferSize(8); +/* + format.setDepthBufferSize(24); + format.setAccumBufferSize(0); + format.setStencilBufferSize(8); + format.setSampleBuffers(false); + format.setSamples(1); + format.setDepth(true); + format.setRgba(true); + format.setAlpha(true); + format.setAccum(false); + format.setStencil(true); + format.setStereo(false); + format.setDirectRendering(false); +*/ + return format; +} + +void *qcgl_createNSOpenGLPixelFormat() +{ + NSOpenGLPixelFormatAttribute attrs[] = + { + NSOpenGLPFADoubleBuffer, + NSOpenGLPFADepthSize, 32, + NSOpenGLPFAMultisample, + NSOpenGLPFASampleBuffers, (NSOpenGLPixelFormatAttribute)1, + NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute) 8, + 0 + }; + + NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]; + return pixelFormat; +} + +CGLContextObj qcgl_createGlContext() +{ + CGLContextObj context; + NSOpenGLPixelFormat *format = reinterpret_cast(qcgl_createNSOpenGLPixelFormat()); + CGLPixelFormatObj cglFormat = static_cast([format CGLPixelFormatObj]); + CGLCreateContext(cglFormat ,NULL, &context); + return context; +} + diff --git a/src/platformsupport/cglconvenience/cglconvenience.pri b/src/platformsupport/cglconvenience/cglconvenience.pri new file mode 100644 index 00000000000..fef3b50ea32 --- /dev/null +++ b/src/platformsupport/cglconvenience/cglconvenience.pri @@ -0,0 +1,11 @@ +mac { + INCLUDEPATH += $$PWD + + HEADERS += \ + $$PWD/cglconvenience_p.h + + OBJECTIVE_SOURCES += \ + $$PWD/cglconvenience.mm + + LIBS += -framework Cocoa -framework OpenGl +} diff --git a/src/platformsupport/cglconvenience/cglconvenience_p.h b/src/platformsupport/cglconvenience/cglconvenience_p.h new file mode 100644 index 00000000000..96433b69d08 --- /dev/null +++ b/src/platformsupport/cglconvenience/cglconvenience_p.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMACGLCONVENIENCE_H +#define QMACGLCONVENIENCE_H + +#include +#include +#include + +void (*qcgl_getProcAddress(const QByteArray &procName))(); +QSurfaceFormat qcgl_surfaceFormat(); +void *qcgl_createNSOpenGLPixelFormat(); +CGLContextObj qcgl_createGlContext(); + +#endif // QMACGLCONVENIENCE_H diff --git a/src/platformsupport/dnd/dnd.pri b/src/platformsupport/dnd/dnd.pri new file mode 100644 index 00000000000..e100dd10cbf --- /dev/null +++ b/src/platformsupport/dnd/dnd.pri @@ -0,0 +1,4 @@ +HEADERS += \ + $$PWD/qsimpledrag_p.h +SOURCES += \ + $$PWD/qsimpledrag.cpp diff --git a/src/platformsupport/dnd/qsimpledrag.cpp b/src/platformsupport/dnd/qsimpledrag.cpp new file mode 100644 index 00000000000..72da29c063d --- /dev/null +++ b/src/platformsupport/dnd/qsimpledrag.cpp @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qsimpledrag_p.h" + +#include "qbitmap.h" +#include "qdrag.h" +#include "qpixmap.h" +#include "qevent.h" +#include "qfile.h" +#include "qtextcodec.h" +#include "qguiapplication.h" +#include "qpoint.h" +#include "qbuffer.h" +#include "qimage.h" +#include "qregexp.h" +#include "qdir.h" +#include "qimagereader.h" +#include "qimagewriter.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +class QDropData : public QInternalMimeData +{ +public: + QDropData(); + ~QDropData(); + +protected: + bool hasFormat_sys(const QString &mimeType) const; + QStringList formats_sys() const; + QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const; +}; + +QSimpleDrag::QSimpleDrag() +{ + m_dropData = new QDropData(); + currentWindow = 0; +} + +QSimpleDrag::~QSimpleDrag() +{ + delete m_dropData; +} + +QMimeData *QSimpleDrag::platformDropData() +{ + return m_dropData; +} + +void QSimpleDrag::cancel() +{ + QDragManager *m = QDragManager::self(); +// qDebug("QDragManager::cancel"); + if (m->object->target()) { + QDragLeaveEvent dle; + QCoreApplication::sendEvent(m->object->target(), &dle); + } + +} + +void QSimpleDrag::move(const QMouseEvent *me) +{ + QWindow *window = QGuiApplication::topLevelAt(me->globalPos()); + QPoint pos; + if (window) + pos = me->globalPos() - window->geometry().topLeft(); + + QDragManager *m = QDragManager::self(); + + if (me->buttons()) { + Qt::DropAction prevAction = m->global_accepted_action; + + if (currentWindow != window) { + if (currentWindow) { + QDragLeaveEvent dle; + QCoreApplication::sendEvent(currentWindow, &dle); + m->willDrop = false; + m->global_accepted_action = Qt::IgnoreAction; + } + currentWindow = window; + if (currentWindow) { + QDragEnterEvent dee(pos, m->possible_actions, m->dropData(), me->buttons(), me->modifiers()); + QCoreApplication::sendEvent(currentWindow, &dee); + m->willDrop = dee.isAccepted() && dee.dropAction() != Qt::IgnoreAction; + m->global_accepted_action = m->willDrop ? dee.dropAction() : Qt::IgnoreAction; + } + m->updateCursor(); + } else if (window) { + Q_ASSERT(currentWindow); + QDragMoveEvent dme(pos, m->possible_actions, m->dropData(), me->buttons(), me->modifiers()); + if (m->global_accepted_action != Qt::IgnoreAction) { + dme.setDropAction(m->global_accepted_action); + dme.accept(); + } + QCoreApplication::sendEvent(currentWindow, &dme); + m->willDrop = dme.isAccepted(); + m->global_accepted_action = m->willDrop ? dme.dropAction() : Qt::IgnoreAction; + m->updatePixmap(); + m->updateCursor(); + } + if (m->global_accepted_action != prevAction) + m->emitActionChanged(m->global_accepted_action); + } +} + +void QSimpleDrag::drop(const QMouseEvent *me) +{ + QDragManager *m = QDragManager::self(); + + QWindow *window = QGuiApplication::topLevelAt(me->globalPos()); + + if (window) { + QPoint pos = me->globalPos() - window->geometry().topLeft(); + + QDropEvent de(pos, m->possible_actions, m->dropData(), me->buttons(), me->modifiers()); + QCoreApplication::sendEvent(window, &de); + if (de.isAccepted()) + m->global_accepted_action = de.dropAction(); + else + m->global_accepted_action = Qt::IgnoreAction; + } + currentWindow = 0; +} + + + +QDropData::QDropData() + : QInternalMimeData() +{ +} + +QDropData::~QDropData() +{ +} + +QVariant QDropData::retrieveData_sys(const QString &mimetype, QVariant::Type type) const +{ + QDrag *object = QDragManager::self()->object; + if (!object) + return QVariant(); + QByteArray data = object->mimeData()->data(mimetype); + if (type == QVariant::String) + return QString::fromUtf8(data); + return data; +} + +bool QDropData::hasFormat_sys(const QString &format) const +{ + return formats().contains(format); +} + +QStringList QDropData::formats_sys() const +{ + QDrag *object = QDragManager::self()->object; + if (object) + return object->mimeData()->formats(); + return QStringList(); +} + +QT_END_NAMESPACE diff --git a/src/gui/widgets/qmenudata.h b/src/platformsupport/dnd/qsimpledrag_p.h similarity index 79% rename from src/gui/widgets/qmenudata.h rename to src/platformsupport/dnd/qsimpledrag_p.h index d02fcbb9bb0..82668a68c9d 100644 --- a/src/gui/widgets/qmenudata.h +++ b/src/platformsupport/dnd/qsimpledrag_p.h @@ -39,42 +39,37 @@ ** ****************************************************************************/ -#ifndef QMENUDATA_H -#define QMENUDATA_H +#ifndef QSIMPLEDRAG_H +#define QSIMPLEDRAG_H -#include - -#ifdef QT3_SUPPORT -#include - -QT_BEGIN_HEADER +#include QT_BEGIN_NAMESPACE -QT_MODULE(Gui) +class QMouseEvent; +class QWindow; -class Q_GUI_EXPORT QMenuItem : public QAction +class QDropData; + +class QSimpleDrag : public QPlatformDrag { - Q_OBJECT - public: - QMenuItem(); + QSimpleDrag(); + ~QSimpleDrag(); - QT3_SUPPORT int id() const; - QT3_SUPPORT int signalValue() const; + virtual QMimeData *platformDropData(); + +// virtual Qt::DropAction drag(QDrag *); + + virtual void cancel(); + virtual void move(const QMouseEvent *me); + virtual void drop(const QMouseEvent *me); private: - friend class QMenu; - friend class QMenuBar; - void setId(int); - void setSignalValue(int); - - Q_DISABLE_COPY(QMenuItem) + QDropData *m_dropData; + + QWindow *currentWindow; }; QT_END_NAMESPACE -QT_END_HEADER - #endif - -#endif // QMENUDATA_H diff --git a/src/platformsupport/eglconvenience/eglconvenience.pri b/src/platformsupport/eglconvenience/eglconvenience.pri new file mode 100644 index 00000000000..868e12c02d6 --- /dev/null +++ b/src/platformsupport/eglconvenience/eglconvenience.pri @@ -0,0 +1,16 @@ +contains(QT_CONFIG,opengles2) { + CONFIG += opengl + HEADERS += \ + $$PWD/qeglconvenience_p.h \ + $$PWD/qeglplatformcontext_p.h + SOURCES += \ + $$PWD/qeglconvenience.cpp \ + $$PWD/qeglplatformcontext.cpp + + contains(QT_CONFIG,xlib) { + HEADERS += \ + $$PWD/qxlibeglintegration_p.h + SOURCES += \ + $$PWD/qxlibeglintegration.cpp + } +} diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp similarity index 82% rename from src/plugins/platforms/eglconvenience/qeglconvenience.cpp rename to src/platformsupport/eglconvenience/qeglconvenience.cpp index 69747a87e8d..bb2613e05b2 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -39,11 +39,13 @@ ** ****************************************************************************/ -#include "qeglconvenience.h" +#include + +#include "qeglconvenience_p.h" QT_BEGIN_NAMESPACE -QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format) +QVector q_createConfigAttributesFromFormat(const QSurfaceFormat &format) { int redSize = format.redBufferSize(); int greenSize = format.greenBufferSize(); @@ -53,17 +55,6 @@ QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat & 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 @@ -79,43 +70,43 @@ QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat & // "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, + // if the application sets the red/green/blue size to 5/6/5 on the QSurfaceFormat, // they will probably get a 32-bit config, even when there's an RGB565 config available. - // 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; +// // 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(redSize > 0 ? redSize : 0); configAttributes.append(EGL_GREEN_SIZE); - configAttributes.append(greenSize); + configAttributes.append(greenSize > 0 ? greenSize : 0); configAttributes.append(EGL_BLUE_SIZE); - configAttributes.append(blueSize); + configAttributes.append(blueSize > 0 ? blueSize : 0); configAttributes.append(EGL_ALPHA_SIZE); - configAttributes.append(alphaSize); + configAttributes.append(alphaSize > 0 ? alphaSize : 0); configAttributes.append(EGL_DEPTH_SIZE); - configAttributes.append(depthSize); + configAttributes.append(depthSize > 0 ? depthSize : 0); configAttributes.append(EGL_STENCIL_SIZE); - configAttributes.append(stencilSize); + configAttributes.append(stencilSize > 0 ? stencilSize : 0); configAttributes.append(EGL_SAMPLES); - configAttributes.append(sampleCount); + configAttributes.append(sampleCount > 0 ? sampleCount : 0); configAttributes.append(EGL_SAMPLE_BUFFERS); - configAttributes.append(sampleCount? 1:0); + configAttributes.append(sampleCount > 0); return configAttributes; } @@ -187,12 +178,19 @@ bool q_reduceConfigAttributes(QVector *configAttributes) i = configAttributes->indexOf(EGL_STENCIL_SIZE); if (i >= 0) { - configAttributes->remove(i,2); + if (configAttributes->at(i + 1) > 1) + configAttributes->replace(i + 1, 1); + else + configAttributes->remove(i, 2); return true; } + i = configAttributes->indexOf(EGL_DEPTH_SIZE); if (i >= 0) { - configAttributes->remove(i,2); + if (configAttributes->at(i + 1) > 1) + configAttributes->replace(i + 1, 1); + else + configAttributes->remove(i, 2); return true; } #ifdef EGL_BIND_TO_TEXTURE_RGB @@ -206,7 +204,7 @@ bool q_reduceConfigAttributes(QVector *configAttributes) return false; } -EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat, int surfaceType) +EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat, int surfaceType) { EGLConfig cfg = 0; QVector configureAttributes = q_createConfigAttributesFromFormat(format); @@ -214,11 +212,7 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW configureAttributes.append(surfaceType); 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_OPENGL_ES2_BIT); configureAttributes.append(EGL_NONE); do { @@ -245,7 +239,7 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW i = configureAttributes.indexOf(EGL_BLUE_SIZE); int confAttrBlue = configureAttributes.at(i+1); i = configureAttributes.indexOf(EGL_ALPHA_SIZE); - int confAttrAlpha = configureAttributes.at(i+1); + int confAttrAlpha = i == -1 ? 0 : configureAttributes.at(i+1); EGLint size = matching; EGLConfig *configs = new EGLConfig [size]; @@ -272,9 +266,9 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW return 0; } -QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, const EGLConfig config) +QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config) { - QPlatformWindowFormat format; + QSurfaceFormat format; EGLint redSize = 0; EGLint greenSize = 0; EGLint blueSize = 0; @@ -282,7 +276,6 @@ QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, con 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); @@ -291,7 +284,6 @@ QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, con 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); @@ -300,10 +292,7 @@ QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, con 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 diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/platformsupport/eglconvenience/qeglconvenience_p.h similarity index 83% rename from src/plugins/platforms/eglconvenience/qeglconvenience.h rename to src/platformsupport/eglconvenience/qeglconvenience_p.h index da4a0cddedd..7b5b9704153 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.h +++ b/src/platformsupport/eglconvenience/qeglconvenience_p.h @@ -43,16 +43,16 @@ #define QEGLCONVENIENCE_H -#include +#include #include #include QT_BEGIN_NAMESPACE -QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format); +QVector q_createConfigAttributesFromFormat(const QSurfaceFormat &format); bool q_reduceConfigAttributes(QVector *configAttributes); -EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat = false, int surfaceType = EGL_WINDOW_BIT); -QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, const EGLConfig config); +EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat = false, int surfaceType = EGL_WINDOW_BIT); +QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config); bool q_hasEglExtension(EGLDisplay display,const char* extensionName); QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp similarity index 72% rename from src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp rename to src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 4d1d63e37f2..58debb8ba83 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -39,63 +39,51 @@ ** ****************************************************************************/ -#include "qeglplatformcontext.h" +#include "qeglplatformcontext_p.h" +#include "qeglconvenience_p.h" #include -#include "qeglconvenience.h" - #include -QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi) - : QPlatformGLContext() - , m_eglDisplay(display) - , m_eglSurface(surface) +QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, + EGLint eglClientVersion, EGLenum eglApi) + : m_eglDisplay(display) , m_eglApi(eglApi) + , m_format(format) { - if (m_eglSurface == EGL_NO_SURFACE) { - qWarning("Createing QEGLPlatformContext with no surface"); - } + EGLConfig config = q_configFromGLFormat(display, format, true); + m_format = q_glFormatFromConfig(display, config); + + EGLContext shareContext = share ? static_cast(share)->m_eglContext : 0; + + QVector contextAttrs; + contextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + contextAttrs.append(eglClientVersion); + contextAttrs.append(EGL_NONE); eglBindAPI(m_eglApi); - m_eglContext = eglCreateContext(m_eglDisplay,config, 0,contextAttrs); + m_eglContext = eglCreateContext(m_eglDisplay, config, shareContext, contextAttrs.constData()); if (m_eglContext == EGL_NO_CONTEXT) { qWarning("Could not create the egl context\n"); eglTerminate(m_eglDisplay); qFatal("EGL error"); } - - m_windowFormat = qt_qPlatformWindowFormatFromConfig(display,config); } -QEGLPlatformContext::~QEGLPlatformContext() +bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface) { -#ifdef QEGL_EXTRA_DEBUG - qWarning("QEglContext::~QEglContext(): %p\n",this); -#endif - 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() -{ - QPlatformGLContext::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); + + EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface); + + bool ok = eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_eglContext); if (!ok) - qWarning("QEGLPlatformContext::makeCurrent: eglError: %d, this: %p \n", eglGetError(), this); + qWarning("QEGLPlatformContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this); #ifdef QEGL_EXTRA_DEBUG static bool showDebug = true; if (showDebug) { @@ -115,10 +103,22 @@ void QEGLPlatformContext::makeCurrent() } #endif + return ok; } + +QEGLPlatformContext::~QEGLPlatformContext() +{ +#ifdef QEGL_EXTRA_DEBUG + qWarning("QEglContext::~QEglContext(): %p\n",this); +#endif + if (m_eglContext != EGL_NO_CONTEXT) { + eglDestroyContext(m_eglDisplay, m_eglContext); + m_eglContext = EGL_NO_CONTEXT; + } +} + void QEGLPlatformContext::doneCurrent() { - QPlatformGLContext::doneCurrent(); #ifdef QEGL_EXTRA_DEBUG qWarning("QEglContext::doneCurrent:%p\n",this); #endif @@ -127,28 +127,31 @@ void QEGLPlatformContext::doneCurrent() if (!ok) qWarning("QEGLPlatformContext::doneCurrent(): eglError: %d, this: %p \n", eglGetError(), this); } -void QEGLPlatformContext::swapBuffers() + +void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface) { #ifdef QEGL_EXTRA_DEBUG qWarning("QEglContext::swapBuffers:%p\n",this); #endif eglBindAPI(m_eglApi); - bool ok = eglSwapBuffers(m_eglDisplay, m_eglSurface); + EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface); + bool ok = eglSwapBuffers(m_eglDisplay, eglSurface); if (!ok) qWarning("QEGLPlatformContext::swapBuffers(): eglError: %d, this: %p \n", eglGetError(), this); } -void* QEGLPlatformContext::getProcAddress(const QString& procName) + +void (*QEGLPlatformContext::getProcAddress(const QByteArray &procName)) () { #ifdef QEGL_EXTRA_DEBUG qWarning("QEglContext::getProcAddress%p\n",this); #endif eglBindAPI(m_eglApi); - return (void *)eglGetProcAddress(qPrintable(procName)); + return eglGetProcAddress(procName.constData()); } -QPlatformWindowFormat QEGLPlatformContext::platformWindowFormat() const +QSurfaceFormat QEGLPlatformContext::format() const { - return m_windowFormat; + return m_format; } EGLContext QEGLPlatformContext::eglContext() const diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h similarity index 72% rename from src/plugins/platforms/eglconvenience/qeglplatformcontext.h rename to src/platformsupport/eglconvenience/qeglplatformcontext_p.h index 9be14807353..2fe0e04388b 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -39,33 +39,38 @@ ** ****************************************************************************/ -#ifndef QOPENKODEGLINTEGRATION_H -#define QOPENKODEGLINTEGRATION_H +#ifndef QEGLPLATFORMCONTEXT_H +#define QEGLPLATFORMCONTEXT_H -#include +#include +#include #include -class QEGLPlatformContext : public QPlatformGLContext +class QEGLPlatformContext : public QPlatformOpenGLContext { public: - QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi); + QEGLPlatformContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, + EGLint eglClientVersion = 2, EGLenum eglApi = EGL_OPENGL_ES_API); ~QEGLPlatformContext(); - void makeCurrent(); + bool makeCurrent(QPlatformSurface *surface); void doneCurrent(); - void swapBuffers(); - void* getProcAddress(const QString& procName); + void swapBuffers(QPlatformSurface *surface); + void (*getProcAddress(const QByteArray &procName)) (); - QPlatformWindowFormat platformWindowFormat() const; + QSurfaceFormat format() const; EGLContext eglContext() const; + +protected: + virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) = 0; + private: EGLContext m_eglContext; EGLDisplay m_eglDisplay; - EGLSurface m_eglSurface; EGLenum m_eglApi; - QPlatformWindowFormat m_windowFormat; + QSurfaceFormat m_format; }; -#endif //QOPENKODEGLINTEGRATION_H +#endif //QEGLPLATFORMCONTEXT_H diff --git a/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp b/src/platformsupport/eglconvenience/qxlibeglintegration.cpp similarity index 99% rename from src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp rename to src/platformsupport/eglconvenience/qxlibeglintegration.cpp index cbd8f7d7c6f..aeebd35d21b 100644 --- a/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp +++ b/src/platformsupport/eglconvenience/qxlibeglintegration.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qxlibeglintegration.h" +#include "qxlibeglintegration_p.h" static int countBits(unsigned long mask) { diff --git a/src/plugins/platforms/eglconvenience/qxlibeglintegration.h b/src/platformsupport/eglconvenience/qxlibeglintegration_p.h similarity index 98% rename from src/plugins/platforms/eglconvenience/qxlibeglintegration.h rename to src/platformsupport/eglconvenience/qxlibeglintegration_p.h index 1d02ab86770..cce394758d0 100644 --- a/src/plugins/platforms/eglconvenience/qxlibeglintegration.h +++ b/src/platformsupport/eglconvenience/qxlibeglintegration_p.h @@ -42,7 +42,7 @@ #ifndef QTESTLITEEGLINTEGRATION_H #define QTESTLITEEGLINTEGRATION_H -#include "qeglconvenience.h" +#include "qeglconvenience_p.h" class QXlibEglIntegration { diff --git a/src/platformsupport/eventdispatchers/eventdispatchers.pri b/src/platformsupport/eventdispatchers/eventdispatchers.pri new file mode 100644 index 00000000000..38aca26b424 --- /dev/null +++ b/src/platformsupport/eventdispatchers/eventdispatchers.pri @@ -0,0 +1,16 @@ +unix { +SOURCES +=\ + $$PWD/qeventdispatcher_qpa.cpp\ + $$PWD/qgenericunixeventdispatcher.cpp\ + +HEADERS +=\ + $$PWD/qeventdispatcher_qpa_p.h\ + $$PWD/qgenericunixeventdispatcher_p.h\ +} + +contains(QT_CONFIG, glib) { + SOURCES +=$$PWD/qeventdispatcher_glib.cpp + HEADERS +=$$PWD/qeventdispatcher_glib_p.h + QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB + LIBS_PRIVATE += $$QT_LIBS_GLIB +} diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp b/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp similarity index 72% rename from src/gui/kernel/qeventdispatcher_glib_qpa.cpp rename to src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp index a9b10182d0c..005c44a0345 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -39,15 +39,14 @@ ** ****************************************************************************/ -#include "qeventdispatcher_glib_qpa_p.h" +#include "qeventdispatcher_glib_p.h" -#include "qapplication.h" +#include "qguiapplication.h" #include "qplatformdefs.h" -#include "qapplication.h" #include -#include "qapplication_p.h" +#include "private/qguiapplication_p.h" #include @@ -64,7 +63,7 @@ static gboolean userEventSourcePrepare(GSource *s, gint *timeout) Q_UNUSED(s) Q_UNUSED(timeout) - return QWindowSystemInterfacePrivate::windowSystemEventsQueued() > 0; + return QWindowSystemInterface::windowSystemEventsQueued() > 0; } static gboolean userEventSourceCheck(GSource *source) @@ -75,26 +74,10 @@ static gboolean userEventSourceCheck(GSource *source) static gboolean userEventSourceDispatch(GSource *s, GSourceFunc, gpointer) { GUserEventSource * source = reinterpret_cast(s); - - QWindowSystemInterfacePrivate::WindowSystemEvent * event; - while (QWindowSystemInterfacePrivate::windowSystemEventsQueued()) { - event = QWindowSystemInterfacePrivate::getWindowSystemEvent(); - if (!event) - break; - - // send through event filter - if (source->q->filterEvent(event)) { - delete event; - continue; - } - QApplicationPrivate::processWindowSystemEvent(event); - delete event; - } - + QWindowSystemInterface::sendWindowSystemEvents(source->q, QEventLoop::AllEvents); return true; } - static GSourceFuncs userEventSourceFuncs = { userEventSourcePrepare, userEventSourceCheck, @@ -131,17 +114,4 @@ QPAEventDispatcherGlib::~QPAEventDispatcherGlib() d->userEventSource = 0; } -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); -} - QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h similarity index 95% rename from src/gui/kernel/qeventdispatcher_glib_qpa_p.h rename to src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h index 8a8559dfb48..8a34e783573 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qpa_p.h +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -68,8 +68,6 @@ class QPAEventDispatcherGlib : public QEventDispatcherGlib public: explicit QPAEventDispatcherGlib(QObject *parent = 0); ~QPAEventDispatcherGlib(); - - bool processEvents(QEventLoop::ProcessEventsFlags flags); }; struct GUserEventSource; diff --git a/src/plugins/mousedrivers/tslib/main.cpp b/src/platformsupport/eventdispatchers/qeventdispatcher_qpa.cpp similarity index 62% rename from src/plugins/mousedrivers/tslib/main.cpp rename to src/platformsupport/eventdispatchers/qeventdispatcher_qpa.cpp index 1d6f8535bab..d39aae7e1ff 100644 --- a/src/plugins/mousedrivers/tslib/main.cpp +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_qpa.cpp @@ -39,39 +39,54 @@ ** ****************************************************************************/ -#include -#include +#include "qplatformdefs.h" +#include "qcoreapplication.h" +#include "qeventdispatcher_qpa_p.h" +#include "private/qguiapplication_p.h" + +#include +#include +#include +#include + +#include + +#include QT_BEGIN_NAMESPACE -class TslibMouseDriver : public QMouseDriverPlugin -{ -public: - TslibMouseDriver(); +QT_USE_NAMESPACE - QStringList keys() const; - QWSMouseHandler* create(const QString &driver, const QString &device); -}; -TslibMouseDriver::TslibMouseDriver() - : QMouseDriverPlugin() +QEventDispatcherQPA::QEventDispatcherQPA(QObject *parent) + : QEventDispatcherUNIX(parent) +{ } + +QEventDispatcherQPA::~QEventDispatcherQPA() +{ } + +bool QEventDispatcherQPA::processEvents(QEventLoop::ProcessEventsFlags flags) { + bool didSendEvents = QWindowSystemInterface::sendWindowSystemEvents(this, flags); + + if (QEventDispatcherUNIX::processEvents(flags)) { + QEventDispatcherUNIX::processEvents(flags); + return true; + } + + return didSendEvents; } -QStringList TslibMouseDriver::keys() const +bool QEventDispatcherQPA::hasPendingEvents() { - return (QStringList() << "tslib"); + extern uint qGlobalPostedEventsCount(); // from qapplication.cpp + return qGlobalPostedEventsCount() || QWindowSystemInterface::windowSystemEventsQueued(); } -QWSMouseHandler* TslibMouseDriver::create(const QString &driver, - const QString &device) +void QEventDispatcherQPA::flush() { - if (driver.toLower() != "tslib") - return 0; - return new QWSTslibMouseHandler(driver, device); + if(qApp) + qApp->sendPostedEvents(); } -Q_EXPORT_STATIC_PLUGIN(TslibMouseDriver) -Q_EXPORT_PLUGIN2(qwstslibmousehandler, TslibMouseDriver) - QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_qpa_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_qpa_p.h similarity index 81% rename from src/gui/kernel/qeventdispatcher_qpa_p.h rename to src/platformsupport/eventdispatchers/qeventdispatcher_qpa_p.h index c145e389f6f..cb677017508 100644 --- a/src/gui/kernel/qeventdispatcher_qpa_p.h +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_qpa_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QEVENTDISPATCHER_QPA_P_H -#define QEVENTDISPATCHER_QPA_P_H +#ifndef QEVENTDISPATCHER_QPA_H +#define QEVENTDISPATCHER_QPA_H // // W A R N I N G @@ -53,13 +53,14 @@ // We mean it. // -#include "private/qeventdispatcher_unix_p.h" +#include +#include QT_BEGIN_NAMESPACE class QEventDispatcherQPAPrivate; -class QEventDispatcherQPA : public QEventDispatcherUNIX +class Q_GUI_EXPORT QEventDispatcherQPA : public QEventDispatcherUNIX { Q_OBJECT Q_DECLARE_PRIVATE(QEventDispatcherQPA) @@ -71,16 +72,9 @@ public: bool processEvents(QEventLoop::ProcessEventsFlags flags); bool hasPendingEvents(); - void registerSocketNotifier(QSocketNotifier *notifier); - void unregisterSocketNotifier(QSocketNotifier *notifier); - void flush(); - -protected: - int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - timeval *timeout); }; QT_END_NAMESPACE -#endif // QEVENTDISPATCHER_QPA_P_H +#endif // QEVENTDISPATCHER_QPA_H diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp similarity index 79% rename from src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp rename to src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp index 493d14e962a..12981c57212 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp +++ b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp @@ -39,20 +39,17 @@ ** ****************************************************************************/ -#include -#include "qmeegographicssystemplugin.h" -#include "qmeegographicssystem.h" +#include "qgenericunixeventdispatcher_p.h" +#include "qeventdispatcher_qpa_p.h" +#include "qeventdispatcher_glib_p.h" +#include -QStringList QMeeGoGraphicsSystemPlugin::keys() const +class QAbstractEventDispatcher *createUnixEventDispatcher() { - QStringList list; - list << "meego"; - return list; +#if !defined(QT_NO_GLIB) && !defined(Q_OS_WIN) + if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported()) + return new QPAEventDispatcherGlib(); + else +#endif + return new QEventDispatcherQPA(); } - -QGraphicsSystem *QMeeGoGraphicsSystemPlugin::create(const QString&) -{ - return new QMeeGoGraphicsSystem; -} - -Q_EXPORT_PLUGIN2(meego, QMeeGoGraphicsSystemPlugin) diff --git a/mkspecs/qws/linux-arm-g++/qplatformdefs.h b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h similarity index 92% rename from mkspecs/qws/linux-arm-g++/qplatformdefs.h rename to src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h index 701c3301449..0d9f5b7db09 100644 --- a/mkspecs/qws/linux-arm-g++/qplatformdefs.h +++ b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the qmake spec of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -39,4 +39,5 @@ ** ****************************************************************************/ -#include "../../linux-g++/qplatformdefs.h" +class QAbstractEventDispatcher; +QAbstractEventDispatcher* createUnixEventDispatcher(); diff --git a/src/plugins/platforms/fb_base/fb_base.cpp b/src/platformsupport/fb_base/fb_base.cpp similarity index 99% rename from src/plugins/platforms/fb_base/fb_base.cpp rename to src/platformsupport/fb_base/fb_base.cpp index a83d739083b..aa395fec292 100644 --- a/src/plugins/platforms/fb_base/fb_base.cpp +++ b/src/platformsupport/fb_base/fb_base.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "fb_base.h" +#include "fb_base_p.h" #include #include #include diff --git a/src/platformsupport/fb_base/fb_base.pri b/src/platformsupport/fb_base/fb_base.pri new file mode 100644 index 00000000000..e80125d54ec --- /dev/null +++ b/src/platformsupport/fb_base/fb_base.pri @@ -0,0 +1,4 @@ +do_not_compile_untill_ported_to_qt5 { + SOURCES += $$PWD/fb_base.cpp + HEADERS += $$PWD/fb_base_p.h +} diff --git a/src/plugins/platforms/fb_base/fb_base.h b/src/platformsupport/fb_base/fb_base_p.h similarity index 100% rename from src/plugins/platforms/fb_base/fb_base.h rename to src/platformsupport/fb_base/fb_base_p.h diff --git a/src/platformsupport/fontdatabases/basicunix/basicunix.pri b/src/platformsupport/fontdatabases/basicunix/basicunix.pri new file mode 100644 index 00000000000..f83b89063b1 --- /dev/null +++ b/src/platformsupport/fontdatabases/basicunix/basicunix.pri @@ -0,0 +1,84 @@ +DEFINES += QT_NO_FONTCONFIG +QT += gui-private core-private + +HEADERS += \ + $$PWD/qbasicunixfontdatabase_p.h \ + $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h + +SOURCES += \ + $$PWD/qbasicunixfontdatabase.cpp \ + $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp + +CONFIG += opentype + +contains(QT_CONFIG, freetype) { + QT_FREETYPE_DIR = $$QT_SOURCE_TREE/src/3rdparty/freetype + SOURCES += \ + $$QT_FREETYPE_DIR/src/base/ftbase.c \ + $$QT_FREETYPE_DIR/src/base/ftbbox.c \ + $$QT_FREETYPE_DIR/src/base/ftdebug.c \ + $$QT_FREETYPE_DIR/src/base/ftglyph.c \ + $$QT_FREETYPE_DIR/src/base/ftinit.c \ + $$QT_FREETYPE_DIR/src/base/ftmm.c \ + $$QT_FREETYPE_DIR/src/base/fttype1.c \ + $$QT_FREETYPE_DIR/src/base/ftsynth.c \ + $$QT_FREETYPE_DIR/src/base/ftbitmap.c \ + $$QT_FREETYPE_DIR/src/bdf/bdf.c \ + $$QT_FREETYPE_DIR/src/cache/ftcache.c \ + $$QT_FREETYPE_DIR/src/cff/cff.c \ + $$QT_FREETYPE_DIR/src/cid/type1cid.c \ + $$QT_FREETYPE_DIR/src/gzip/ftgzip.c \ + $$QT_FREETYPE_DIR/src/pcf/pcf.c \ + $$QT_FREETYPE_DIR/src/pfr/pfr.c \ + $$QT_FREETYPE_DIR/src/psaux/psaux.c \ + $$QT_FREETYPE_DIR/src/pshinter/pshinter.c \ + $$QT_FREETYPE_DIR/src/psnames/psmodule.c \ + $$QT_FREETYPE_DIR/src/raster/raster.c \ + $$QT_FREETYPE_DIR/src/sfnt/sfnt.c \ + $$QT_FREETYPE_DIR/src/smooth/smooth.c \ + $$QT_FREETYPE_DIR/src/truetype/truetype.c \ + $$QT_FREETYPE_DIR/src/type1/type1.c \ + $$QT_FREETYPE_DIR/src/type42/type42.c \ + $$QT_FREETYPE_DIR/src/winfonts/winfnt.c \ + $$QT_FREETYPE_DIR/src/lzw/ftlzw.c\ + $$QT_FREETYPE_DIR/src/otvalid/otvalid.c\ + $$QT_FREETYPE_DIR/src/otvalid/otvbase.c\ + $$QT_FREETYPE_DIR/src/otvalid/otvgdef.c\ + $$QT_FREETYPE_DIR/src/otvalid/otvjstf.c\ + $$QT_FREETYPE_DIR/src/otvalid/otvcommn.c\ + $$QT_FREETYPE_DIR/src/otvalid/otvgpos.c\ + $$QT_FREETYPE_DIR/src/otvalid/otvgsub.c\ + $$QT_FREETYPE_DIR/src/otvalid/otvmod.c\ + $$QT_FREETYPE_DIR/src/autofit/afangles.c\ + $$QT_FREETYPE_DIR/src/autofit/afglobal.c\ + $$QT_FREETYPE_DIR/src/autofit/aflatin.c\ + $$QT_FREETYPE_DIR/src/autofit/afmodule.c\ + $$QT_FREETYPE_DIR/src/autofit/afdummy.c\ + $$QT_FREETYPE_DIR/src/autofit/afhints.c\ + $$QT_FREETYPE_DIR/src/autofit/afloader.c\ + $$QT_FREETYPE_DIR/src/autofit/autofit.c + + symbian { + SOURCES += \ + $$QT_FREETYPE_DIR/src/base/ftsystem.c + } else { + SOURCES += \ + $$QT_FREETYPE_DIR/builds/unix/ftsystem.c + INCLUDEPATH += \ + $$QT_FREETYPE_DIR/builds/unix + } + + INCLUDEPATH += \ + $$QT_FREETYPE_DIR/src \ + $$QT_FREETYPE_DIR/include + + DEFINES += FT2_BUILD_LIBRARY + contains(QT_CONFIG, system-zlib) { + DEFINES += 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) +} + diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp b/src/platformsupport/fontdatabases/basicunix/qbasicunixfontdatabase.cpp similarity index 84% rename from src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp rename to src/platformsupport/fontdatabases/basicunix/qbasicunixfontdatabase.cpp index d91cce59a9c..8012f847979 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/basicunix/qbasicunixfontdatabase.cpp @@ -39,14 +39,15 @@ ** ****************************************************************************/ -#include "qbasicunixfontdatabase.h" +#include "qbasicunixfontdatabase_p.h" -#include +#include #include #include #include #include +#include #undef QT_NO_FREETYPE #include @@ -237,11 +238,77 @@ QFontEngine *QBasicUnixFontDatabase::fontEngine(const QFontDef &fontDef, QUnicod return engine; } +namespace { + + class QFontEngineFTRawData: public QFontEngineFT + { + public: + QFontEngineFTRawData(const QFontDef &fontDef) : QFontEngineFT(fontDef) + { + } + + void updateFamilyNameAndStyle() + { + fontDef.family = QString::fromAscii(freetype->face->family_name); + + if (freetype->face->style_flags & FT_STYLE_FLAG_ITALIC) + fontDef.style = QFont::StyleItalic; + + if (freetype->face->style_flags & FT_STYLE_FLAG_BOLD) + fontDef.weight = QFont::Bold; + } + + bool initFromData(const QByteArray &fontData) + { + FaceId faceId; + faceId.filename = ""; + faceId.index = 0; + faceId.uuid = QUuid::createUuid().toByteArray(); + + return init(faceId, true, Format_None, fontData); + } + }; + +} + +QFontEngine *QBasicUnixFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, + QFont::HintingPreference hintingPreference) +{ + QFontDef fontDef; + fontDef.pixelSize = pixelSize; + + QFontEngineFTRawData *fe = new QFontEngineFTRawData(fontDef); + if (!fe->initFromData(fontData)) { + delete fe; + return 0; + } + + fe->updateFamilyNameAndStyle(); + + switch (hintingPreference) { + case QFont::PreferNoHinting: + fe->setDefaultHintStyle(QFontEngineFT::HintNone); + break; + case QFont::PreferFullHinting: + fe->setDefaultHintStyle(QFontEngineFT::HintFull); + break; + case QFont::PreferVerticalHinting: + fe->setDefaultHintStyle(QFontEngineFT::HintLight); + break; + default: + // Leave it as it is + break; + } + + return fe; +} + QStringList QBasicUnixFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const { Q_UNUSED(family); Q_UNUSED(style); Q_UNUSED(script); + Q_UNUSED(styleHint); return QStringList(); } @@ -339,12 +406,12 @@ QStringList QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const QString family = QString::fromAscii(face->family_name); FontFile *fontFile = new FontFile; - fontFile->fileName = file; + fontFile->fileName = QString::fromAscii(file); fontFile->indexValue = index; QFont::Stretch stretch = QFont::Unstretched; - registerFont(family,"",weight,style,stretch,true,true,0,writingSystems,fontFile); + registerFont(family,QString(),weight,style,stretch,true,true,0,writingSystems,fontFile); families.append(family); diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h b/src/platformsupport/fontdatabases/basicunix/qbasicunixfontdatabase_p.h similarity index 95% rename from src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h rename to src/platformsupport/fontdatabases/basicunix/qbasicunixfontdatabase_p.h index 0e17ed55b63..fa5fce0e200 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h +++ b/src/platformsupport/fontdatabases/basicunix/qbasicunixfontdatabase_p.h @@ -57,6 +57,7 @@ class QBasicUnixFontDatabase : public QPlatformFontDatabase public: void populateFontDatabase(); QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); + QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const; QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName); void releaseHandle(void *handle); diff --git a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri new file mode 100644 index 00000000000..2efcb4d4dcc --- /dev/null +++ b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri @@ -0,0 +1,2 @@ +HEADERS += $$PWD/qfontconfigdatabase_p.h +SOURCES += $$PWD/qfontconfigdatabase.cpp diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp similarity index 97% rename from src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp rename to src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 50cf4ed75a5..9726ad81199 100644 --- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -39,14 +39,13 @@ ** ****************************************************************************/ -#include "qfontconfigdatabase.h" +#include "qfontconfigdatabase_p.h" #include #include #include -#include #include #include @@ -447,10 +446,11 @@ void QFontconfigDatabase::populateFontDatabase() ws.setSupported(QFontDatabase::Latin); + QString familyQtName = QString::fromLatin1(f->qtname); while (f->qtname) { - registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleNormal,QFont::Unstretched,true,true,0,ws,0); - registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleItalic,QFont::Unstretched,true,true,0,ws,0); - registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleOblique,QFont::Unstretched,true,true,0,ws,0); + registerFont(familyQtName,QString(),QFont::Normal,QFont::StyleNormal,QFont::Unstretched,true,true,0,ws,0); + registerFont(familyQtName,QString(),QFont::Normal,QFont::StyleItalic,QFont::Unstretched,true,true,0,ws,0); + registerFont(familyQtName,QString(),QFont::Normal,QFont::StyleOblique,QFont::Unstretched,true,true,0,ws,0); ++f; } diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h similarity index 97% rename from src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h rename to src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h index 61700e391a0..5a5e4b670f7 100644 --- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.h +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h @@ -43,7 +43,7 @@ #define QFONTCONFIGDATABASE_H #include -#include "qbasicunixfontdatabase.h" +#include class QFontconfigDatabase : public QBasicUnixFontDatabase { diff --git a/src/platformsupport/fontdatabases/fontdatabases.pri b/src/platformsupport/fontdatabases/fontdatabases.pri new file mode 100644 index 00000000000..0e282d97dd5 --- /dev/null +++ b/src/platformsupport/fontdatabases/fontdatabases.pri @@ -0,0 +1,10 @@ +DEFINES += QT_COMPILES_IN_HARFBUZZ +INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src + +unix { + include($$PWD/basicunix/basicunix.pri) + include($$PWD/genericunix/genericunix.pri) + contains(QT_CONFIG,fontconfig) { + include($$PWD/fontconfig/fontconfig.pri) + } +} diff --git a/src/platformsupport/fontdatabases/genericunix/genericunix.pri b/src/platformsupport/fontdatabases/genericunix/genericunix.pri new file mode 100644 index 00000000000..e9db6c07e2c --- /dev/null +++ b/src/platformsupport/fontdatabases/genericunix/genericunix.pri @@ -0,0 +1 @@ +HEADERS += $$PWD/qgenericunixfontdatabase_p.h diff --git a/src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h b/src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h similarity index 94% rename from src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h rename to src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h index 8bf542a215c..63f214df54f 100644 --- a/src/plugins/platforms/fontdatabases/genericunix/qgenericunixfontdatabase.h +++ b/src/platformsupport/fontdatabases/genericunix/qgenericunixfontdatabase_p.h @@ -43,10 +43,10 @@ #define QGENERICUNIXFONTDATABASE_H #ifdef Q_FONTCONFIGDATABASE -#include "qfontconfigdatabase.h" +#include typedef QFontconfigDatabase QGenericUnixFontDatabase; #else -#include "qbasicunixfontdatabase.h" +#include typedef QBasicUnixFontDatabase QGenericUnixFontDatabase; #endif //Q_FONTCONFIGDATABASE diff --git a/src/platformsupport/glxconvenience/glxconvenience.pri b/src/platformsupport/glxconvenience/glxconvenience.pri new file mode 100644 index 00000000000..5b65e13306f --- /dev/null +++ b/src/platformsupport/glxconvenience/glxconvenience.pri @@ -0,0 +1,6 @@ +contains(QT_CONFIG,xlib) { + contains(QT_CONFIG,opengl):!contains(QT_CONFIG,opengles2) { + HEADERS += $$PWD/qglxconvenience_p.h + SOURCES += $$PWD/qglxconvenience.cpp + } +} diff --git a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp b/src/platformsupport/glxconvenience/qglxconvenience.cpp similarity index 62% rename from src/plugins/platforms/glxconvenience/qglxconvenience.cpp rename to src/platformsupport/glxconvenience/qglxconvenience.cpp index 34633d9692b..ce0c49d93f0 100644 --- a/src/plugins/platforms/glxconvenience/qglxconvenience.cpp +++ b/src/platformsupport/glxconvenience/qglxconvenience.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qglxconvenience.h" +#include "qglxconvenience_p.h" #include @@ -70,7 +70,7 @@ enum { #undef FontChange #endif -QVector qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit) +QVector qglx_buildSpec(const QSurfaceFormat &format, int drawableBit) { QVector spec(48); int i = 0; @@ -79,55 +79,43 @@ QVector qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit spec[i++] = 0; spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = drawableBit; - 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_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; - if (format.accum()) { - 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_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.hasAlpha()) { + spec[i++] = GLX_ALPHA_SIZE; spec[i++] = format.alphaBufferSize(); } - spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False; + spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.swapBehavior() != QSurfaceFormat::SingleBuffer ? True : False; + spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False; - if (format.depth()) { - spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize(); + if (format.depthBufferSize() > 0) { + spec[i++] = GLX_DEPTH_SIZE; spec[i++] = format.depthBufferSize(); } - if (format.stencil()) { + if (format.stencilBufferSize() > 0) { spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize(); } - if (format.sampleBuffers()) { + + if (format.samples() > 1) { spec[i++] = GLX_SAMPLE_BUFFERS_ARB; spec[i++] = 1; spec[i++] = GLX_SAMPLES_ARB; - spec[i++] = format.samples() == -1 ? 4 : format.samples(); + spec[i++] = format.samples(); } spec[i++] = XNone; return spec; } -GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindowFormat &format, int drawableBit) +GLXFBConfig qglx_findConfig(Display *display, int screen , const QSurfaceFormat &format, int drawableBit) { bool reduced = true; GLXFBConfig chosenConfig = 0; - QPlatformWindowFormat reducedFormat = format; + QSurfaceFormat reducedFormat = format; while (!chosenConfig && reduced) { QVector spec = qglx_buildSpec(reducedFormat, drawableBit); int confcount = 0; @@ -138,7 +126,7 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , 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 (reducedFormat.alpha()) { + if (reducedFormat.hasAlpha()) { int alphaSize; glXGetFBConfigAttrib(display,configs[i],GLX_ALPHA_SIZE,&alphaSize); if (alphaSize > 0) { @@ -159,7 +147,7 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindow XFree(configs); } - reducedFormat = qglx_reducePlatformWindowFormat(reducedFormat,&reduced); + reducedFormat = qglx_reduceSurfaceFormat(reducedFormat,&reduced); } if (!chosenConfig) @@ -168,16 +156,16 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QPlatformWindow return chosenConfig; } -XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QPlatformWindowFormat &format) +XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QSurfaceFormat &format) { GLXFBConfig config = qglx_findConfig(display,screen,format); XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display,config); return visualInfo; } -QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx) +QSurfaceFormat qglx_surfaceFormatFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext) { - QPlatformWindowFormat format; + QSurfaceFormat format; int redSize = 0; int greenSize = 0; int blueSize = 0; @@ -186,16 +174,9 @@ QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFB int stencilSize = 0; int sampleBuffers = 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; 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); @@ -204,12 +185,7 @@ QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFB glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize); glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize); glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers); - glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level); 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); @@ -217,39 +193,31 @@ QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFB format.setAlphaBufferSize(alphaSize); format.setDepthBufferSize(depthSize); format.setStencilBufferSize(stencilSize); - format.setSampleBuffers(sampleBuffers); - if (format.sampleBuffers()) { + if (sampleBuffers) { glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount); format.setSamples(sampleCount); } - format.setDirectRendering(glXIsDirect(display, ctx)); - format.setRgba(rgba); format.setStereo(stereo); - format.setAccumBufferSize(accumSizeB); return format; } -QPlatformWindowFormat qglx_reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced) +QSurfaceFormat qglx_reduceSurfaceFormat(const QSurfaceFormat &format, bool *reduced) { - QPlatformWindowFormat retFormat = format; + QSurfaceFormat retFormat = format; *reduced = true; - if (retFormat.sampleBuffers()) { - retFormat.setSampleBuffers(false); + if (retFormat.samples() > 1) { + retFormat.setSamples(0); } 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 if (retFormat.stencilBufferSize() > 0) { + retFormat.setStencilBufferSize(0); + }else if (retFormat.hasAlpha()) { + retFormat.setAlphaBufferSize(0); + }else if (retFormat.depthBufferSize() > 0) { + retFormat.setDepthBufferSize(0); }else{ *reduced = false; } diff --git a/src/plugins/platforms/glxconvenience/qglxconvenience.h b/src/platformsupport/glxconvenience/qglxconvenience_p.h similarity index 81% rename from src/plugins/platforms/glxconvenience/qglxconvenience.h rename to src/platformsupport/glxconvenience/qglxconvenience_p.h index 7478abfeba5..4892b077290 100644 --- a/src/plugins/platforms/glxconvenience/qglxconvenience.h +++ b/src/platformsupport/glxconvenience/qglxconvenience_p.h @@ -42,15 +42,16 @@ #ifndef QGLXCONVENIENCE_H #define QGLXCONVENIENCE_H -#include +#include +#include #include #include -XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QPlatformWindowFormat &format); -GLXFBConfig qglx_findConfig(Display *display, int screen, const QPlatformWindowFormat &format, int drawableBit = GLX_WINDOW_BIT); -QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); -QVector qglx_buildSpec(const QPlatformWindowFormat &format, int drawableBit = GLX_WINDOW_BIT); -QPlatformWindowFormat qglx_reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); +XVisualInfo *qglx_findVisualInfo(Display *display, int screen, const QSurfaceFormat &format); +GLXFBConfig qglx_findConfig(Display *display, int screen, const QSurfaceFormat &format, int drawableBit = GLX_WINDOW_BIT); +QSurfaceFormat qglx_surfaceFormatFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); +QVector qglx_buildSpec(const QSurfaceFormat &format, int drawableBit = GLX_WINDOW_BIT); +QSurfaceFormat qglx_reduceSurfaceFormat(const QSurfaceFormat &format, bool *reduced); #endif // QGLXCONVENIENCE_H diff --git a/src/platformsupport/inputcontext/inputcontext.pri b/src/platformsupport/inputcontext/inputcontext.pri new file mode 100644 index 00000000000..e1a44684bac --- /dev/null +++ b/src/platformsupport/inputcontext/inputcontext.pri @@ -0,0 +1,6 @@ +HEADERS += \ + $$PWD/qplatforminputcontextplugin_qpa_p.h \ + $$PWD/qplatforminputcontextfactory_qpa_p.h +SOURCES += \ + $$PWD/qplatforminputcontextplugin_qpa.cpp \ + $$PWD/qplatforminputcontextfactory_qpa.cpp diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp similarity index 52% rename from src/gui/painting/qgraphicssystem.cpp rename to src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp index de0b516e796..fa16fea6283 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa.cpp @@ -39,59 +39,72 @@ ** ****************************************************************************/ -#include "qgraphicssystem_p.h" +#include "qplatforminputcontextfactory_qpa_p.h" +#include "qplatforminputcontextplugin_qpa_p.h" +#include +#include "private/qfactoryloader_p.h" -#ifdef Q_WS_X11 -# include -#endif -#if defined(Q_WS_WIN) -# include -#endif -#ifdef Q_WS_MAC -# include -#endif -#ifdef Q_WS_QPA -# include -#endif -#ifdef Q_OS_SYMBIAN -# include -#endif +#include "qguiapplication.h" +#include "qdebug.h" +#include QT_BEGIN_NAMESPACE -QGraphicsSystem::~QGraphicsSystem() +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QPlatformInputContextFactoryInterface_iid, QLatin1String("/platforminputcontexts"), Qt::CaseInsensitive)) +#endif + +QStringList QPlatformInputContextFactory::keys() { +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + QStringList list = loader()->keys(); +#else + QStringList list; +#endif + return list; } -QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType type) +QPlatformInputContext *QPlatformInputContextFactory::create(const QString& key) { -#ifdef Q_WS_QWS - Q_UNUSED(type); -#endif -#if defined(Q_WS_X11) - return new QX11PixmapData(type); -#elif defined(Q_WS_WIN) - return new QRasterPixmapData(type); -#elif defined(Q_WS_MAC) - return new QMacPixmapData(type); -#elif defined(Q_WS_QPA) - return QApplicationPrivate::platformIntegration()->createPixmapData(type); -#elif defined(Q_OS_SYMBIAN) - return new QS60PixmapData(type); -#elif !defined(Q_WS_QWS) -#error QGraphicsSystem::createDefaultPixmapData() not implemented + QPlatformInputContext *ret = 0; + QStringList paramList = key.split(QLatin1Char(':')); + QString platform = paramList.takeFirst().toLower(); + +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + if (QPlatformInputContextFactoryInterface *factory = qobject_cast(loader()->instance(platform))) + ret = factory->create(platform, paramList); #endif + return ret; +} + +QPlatformInputContext *QPlatformInputContextFactory::create() +{ + QPlatformInputContext *ic = 0; + + QString icString = QString::fromLatin1(getenv("QT_IM_MODULE")); + ic = create(icString); + + if (ic && ic->isValid()) + return ic; + + delete ic; + ic = 0; + + QStringList k = keys(); + for (int i = 0; i < k.size(); ++i) { + if (k.at(i) == icString) + continue; + ic = create(k.at(i)); + if (ic && ic->isValid()) + return ic; + delete ic; + ic = 0; + } + return 0; } -QPixmapData *QGraphicsSystem::createPixmapData(QPixmapData *origin) -{ - return createPixmapData(origin->pixelType()); -} - -void QGraphicsSystem::releaseCachedResources() -{ - // Do nothing here -} QT_END_NAMESPACE + diff --git a/src/gui/painting/qgraphicssystemfactory_p.h b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h similarity index 88% rename from src/gui/painting/qgraphicssystemfactory_p.h rename to src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h index c8e55e049da..5c42931357e 100644 --- a/src/gui/painting/qgraphicssystemfactory_p.h +++ b/src/platformsupport/inputcontext/qplatforminputcontextfactory_qpa_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGRAPHICSSYSTEMFACTORY_H -#define QGRAPHICSSYSTEMFACTORY_H +#ifndef QPLATFORMINPUTCONTEXTFACTORY_H +#define QPLATFORMINPUTCONTEXTFACTORY_H // // W A R N I N G @@ -61,18 +61,19 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class QGraphicsSystem; +class QPlatformInputContext; -class QGraphicsSystemFactory +class QPlatformInputContextFactory { public: static QStringList keys(); - static QGraphicsSystem *create(const QString&); + static QPlatformInputContext *create(const QString &key); + static QPlatformInputContext *create(); }; QT_END_NAMESPACE QT_END_HEADER -#endif // QGRAPHICSSYSTEMFACTORY_H +#endif // QPLATFORMINPUTCONTEXTFACTORY_H diff --git a/src/gui/painting/qgraphicssystemplugin.cpp b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp similarity index 90% rename from src/gui/painting/qgraphicssystemplugin.cpp rename to src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp index 8153b8aa055..380ab06d9cb 100644 --- a/src/gui/painting/qgraphicssystemplugin.cpp +++ b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa.cpp @@ -39,17 +39,16 @@ ** ****************************************************************************/ -#include "qgraphicssystemplugin_p.h" -#include "qgraphicssystem_p.h" +#include "qplatforminputcontextplugin_qpa_p.h" QT_BEGIN_NAMESPACE -QGraphicsSystemPlugin::QGraphicsSystemPlugin(QObject *parent) +QPlatformInputContextPlugin::QPlatformInputContextPlugin(QObject *parent) : QObject(parent) { } -QGraphicsSystemPlugin::~QGraphicsSystemPlugin() +QPlatformInputContextPlugin::~QPlatformInputContextPlugin() { } diff --git a/src/gui/painting/qgraphicssystemplugin_p.h b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h similarity index 70% rename from src/gui/painting/qgraphicssystemplugin_p.h rename to src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h index 3d353abe796..1dfb7596823 100644 --- a/src/gui/painting/qgraphicssystemplugin_p.h +++ b/src/platformsupport/inputcontext/qplatforminputcontextplugin_qpa_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QGRAPHICSSYSTEMPLUGIN_H -#define QGRAPHICSSYSTEMPLUGIN_H +#ifndef QPLATFORMINPUTCONTEXTPLUGIN_H +#define QPLATFORMINPUTCONTEXTPLUGIN_H // // W A R N I N G @@ -62,31 +62,31 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class QGraphicsSystem; +class QPlatformInputContext; -struct QGraphicsSystemFactoryInterface : public QFactoryInterface + struct QPlatformInputContextFactoryInterface : public QFactoryInterface { - virtual QGraphicsSystem *create(const QString &key) = 0; + virtual QPlatformInputContext *create(const QString &key, const QStringList ¶mList) = 0; }; -#define QGraphicsSystemFactoryInterface_iid "com.trolltech.Qt.QGraphicsSystemFactoryInterface" +#define QPlatformInputContextFactoryInterface_iid "com.nokia.Qt.QPlatformInputContextFactoryInterface" -Q_DECLARE_INTERFACE(QGraphicsSystemFactoryInterface, QGraphicsSystemFactoryInterface_iid) +Q_DECLARE_INTERFACE(QPlatformInputContextFactoryInterface, QPlatformInputContextFactoryInterface_iid) -class Q_GUI_EXPORT QGraphicsSystemPlugin : public QObject, public QGraphicsSystemFactoryInterface +class Q_GUI_EXPORT QPlatformInputContextPlugin : public QObject, public QPlatformInputContextFactoryInterface { Q_OBJECT - Q_INTERFACES(QGraphicsSystemFactoryInterface:QFactoryInterface) + Q_INTERFACES(QPlatformInputContextFactoryInterface:QFactoryInterface) public: - explicit QGraphicsSystemPlugin(QObject *parent = 0); - ~QGraphicsSystemPlugin(); + explicit QPlatformInputContextPlugin(QObject *parent = 0); + ~QPlatformInputContextPlugin(); virtual QStringList keys() const = 0; - virtual QGraphicsSystem *create(const QString &key) = 0; + virtual QPlatformInputContext *create(const QString &key, const QStringList ¶mList) = 0; }; QT_END_NAMESPACE QT_END_HEADER -#endif // QGRAPHICSSYSTEMEPLUGIN_H +#endif // QPLATFORMINPUTCONTEXTPLUGIN_H diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro new file mode 100644 index 00000000000..9d6f8dcd41d --- /dev/null +++ b/src/platformsupport/platformsupport.pro @@ -0,0 +1,33 @@ +load(qt_module) +TARGET = QtPlatformSupport +QPRO_PWD = $$PWD +QT += core-private gui-private +TEMPLATE = lib +DESTDIR = $$QMAKE_LIBDIR_QT + +CONFIG += module +CONFIG += staticlib +mac:LIBS += -lz -framework CoreFoundation -framework Carbon + +MODULE_PRI = ../modules/qt_platformsupport.pri + +load(qt_module_config) + +unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui + +include(../qbase.pri) + +HEADERS += $$PWD/qtplatformsupportversion.h + +DEFINES += QT_NO_CAST_FROM_ASCII +PRECOMPILED_HEADER = ../corelib/global/qt_pch.h + +include(cglconvenience/cglconvenience.pri) +include(dnd/dnd.pri) +include(eglconvenience/eglconvenience.pri) +include(eventdispatchers/eventdispatchers.pri) +include(fb_base/fb_base.pri) +include(fontdatabases/fontdatabases.pri) +include(glxconvenience/glxconvenience.pri) +include(printersupport/printersupport.pri) +include(inputcontext/inputcontext.pri) diff --git a/src/platformsupport/printersupport/genericunix/genericunix.pri b/src/platformsupport/printersupport/genericunix/genericunix.pri new file mode 100644 index 00000000000..55534c098eb --- /dev/null +++ b/src/platformsupport/printersupport/genericunix/genericunix.pri @@ -0,0 +1,4 @@ +QT += printsupport printsupport-private + +HEADERS += $$PWD/qgenericunixprintersupport_p.h +SOURCES += $$PWD/qgenericunixprintersupport.cpp diff --git a/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport.cpp b/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport.cpp new file mode 100644 index 00000000000..bac5ba20f06 --- /dev/null +++ b/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgenericunixprintersupport_p.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +QList QGenericUnixPrinterSupport::supportedPaperSizes(const QPrinterInfo &printerInfo) const +{ +#ifndef QT_NO_CUPS + return QCUPSSupport::getCupsPrinterPaperSizes(QPlatformPrinterSupport::printerInfoCupsPrinterIndex(printerInfo)); +#else + return QList(); +#endif +} + +QList QGenericUnixPrinterSupport::availablePrinters() +{ + QList printers; +#ifndef QT_NO_CUPS + foreach (const QCUPSSupport::Printer &p, QCUPSSupport::availableUnixPrinters()) { + QPrinterInfo printer(QPlatformPrinterSupport::printerInfo(p.name, p.isDefault)); + QPlatformPrinterSupport::setPrinterInfoCupsPrinterIndex(&printer, p.cupsPrinterIndex); + printers.append(printer); + } +#endif + return printers; +} + +QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/shivavg/shivavggraphicssystem.h b/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport_p.h similarity index 82% rename from src/plugins/graphicssystems/shivavg/shivavggraphicssystem.h rename to src/platformsupport/printersupport/genericunix/qgenericunixprintersupport_p.h index a4c8cd67e46..bcfc36799fb 100644 --- a/src/plugins/graphicssystems/shivavg/shivavggraphicssystem.h +++ b/src/platformsupport/printersupport/genericunix/qgenericunixprintersupport_p.h @@ -39,22 +39,21 @@ ** ****************************************************************************/ -#ifndef SHIVAVGGRAPHICSSYSTEM_H -#define SHIVAVGGRAPHICSSYSTEM_H +#ifndef QGENERICUNIXPRINTINGSUPPORT_H +#define QGENERICUNIXPRINTINGSUPPORT_H -#include +#include QT_BEGIN_NAMESPACE -class ShivaVGGraphicsSystem : public QGraphicsSystem +class QGenericUnixPrinterSupport : public QPlatformPrinterSupport { public: - ShivaVGGraphicsSystem(); + virtual QList supportedPaperSizes(const QPrinterInfo &) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; + virtual QList availablePrinters(); }; QT_END_NAMESPACE -#endif +#endif // QGENERICUNIXPRINTINGSUPPORT_H diff --git a/src/platformsupport/printersupport/printersupport.pri b/src/platformsupport/printersupport/printersupport.pri new file mode 100644 index 00000000000..797ac771e7e --- /dev/null +++ b/src/platformsupport/printersupport/printersupport.pri @@ -0,0 +1,3 @@ +unix { + include($$PWD/genericunix/genericunix.pri) +} diff --git a/src/plugins/accessible/widgets/complexwidgets.h b/src/plugins/accessible/widgets/complexwidgets.h index c6453f19c48..3c014450917 100644 --- a/src/plugins/accessible/widgets/complexwidgets.h +++ b/src/plugins/accessible/widgets/complexwidgets.h @@ -43,9 +43,9 @@ #define COMPLEXWIDGETS_H #include -#include -#include -#include +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/accessible/widgets/itemviews.h b/src/plugins/accessible/widgets/itemviews.h index c8492e3c896..2c981ef0e85 100644 --- a/src/plugins/accessible/widgets/itemviews.h +++ b/src/plugins/accessible/widgets/itemviews.h @@ -42,11 +42,11 @@ #ifndef ACCESSIBLE_ITEMVIEWS_H #define ACCESSIBLE_ITEMVIEWS_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/accessible/widgets/qaccessiblemenu.cpp b/src/plugins/accessible/widgets/qaccessiblemenu.cpp index 1454c7c80b3..8e72910b450 100644 --- a/src/plugins/accessible/widgets/qaccessiblemenu.cpp +++ b/src/plugins/accessible/widgets/qaccessiblemenu.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #ifndef QT_NO_ACCESSIBILITY diff --git a/src/plugins/accessible/widgets/qaccessiblemenu.h b/src/plugins/accessible/widgets/qaccessiblemenu.h index 680594d667c..1ee6d5436f9 100644 --- a/src/plugins/accessible/widgets/qaccessiblemenu.h +++ b/src/plugins/accessible/widgets/qaccessiblemenu.h @@ -42,7 +42,7 @@ #ifndef QACCESSIBLEMENU_H #define QACCESSIBLEMENU_H -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index a0dde37ed66..a8f38b61a30 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -65,7 +65,7 @@ #include #include #include -#include +#include #ifndef QT_NO_ACCESSIBILITY diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.h b/src/plugins/accessible/widgets/qaccessiblewidgets.h index 242f8c16105..942012896b8 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.h +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.h @@ -42,8 +42,8 @@ #ifndef QACCESSIBLEWIDGETS_H #define QACCESSIBLEWIDGETS_H -#include -#include +#include +#include #ifndef QT_NO_ACCESSIBILITY diff --git a/src/plugins/accessible/widgets/rangecontrols.h b/src/plugins/accessible/widgets/rangecontrols.h index 0f21a5a1196..529a331c94f 100644 --- a/src/plugins/accessible/widgets/rangecontrols.h +++ b/src/plugins/accessible/widgets/rangecontrols.h @@ -42,8 +42,8 @@ #ifndef RANGECONTROLS_H #define RANGECONTROLS_H -#include -#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h index d5144caebd5..7cc14410cf1 100644 --- a/src/plugins/accessible/widgets/simplewidgets.h +++ b/src/plugins/accessible/widgets/simplewidgets.h @@ -43,8 +43,8 @@ #define SIMPLEWIDGETS_H #include -#include -#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/accessible/widgets/widgets.pro b/src/plugins/accessible/widgets/widgets.pro index d1a121ec94d..3bf7dede565 100644 --- a/src/plugins/accessible/widgets/widgets.pro +++ b/src/plugins/accessible/widgets/widgets.pro @@ -2,7 +2,7 @@ TARGET = qtaccessiblewidgets load(qt_plugin) include (../qaccessiblebase.pri) -QT += core-private gui-private +QT += core-private gui-private widgets-private DESTDIR = $$QT.gui.plugins/accessible QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)" diff --git a/src/plugins/decorations/decorations.pro b/src/plugins/decorations/decorations.pro deleted file mode 100644 index 3d6912e77c5..00000000000 --- a/src/plugins/decorations/decorations.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = subdirs -contains(decoration-plugins, default) :SUBDIRS += default -contains(decoration-plugins, styled) :SUBDIRS += styled -contains(decoration-plugins, windows) :SUBDIRS += windows diff --git a/src/plugins/decorations/default/default.pro b/src/plugins/decorations/default/default.pro deleted file mode 100644 index c323d109303..00000000000 --- a/src/plugins/decorations/default/default.pro +++ /dev/null @@ -1,10 +0,0 @@ -TARGET = qdecorationdefault -load(qt_plugin) - -HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qdecorationdefault_qws.h -SOURCES = main.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qdecorationdefault_qws.cpp - -DESTDIR = $$QT.gui.plugins/decorations -target.path += $$[QT_INSTALL_PLUGINS]/decorations -INSTALLS += target diff --git a/src/plugins/decorations/styled/styled.pro b/src/plugins/decorations/styled/styled.pro deleted file mode 100644 index c5329aea291..00000000000 --- a/src/plugins/decorations/styled/styled.pro +++ /dev/null @@ -1,13 +0,0 @@ -TARGET = qdecorationstyled -load(qt_plugin) - -DESTDIR = $$QT.gui.plugins/decorations -target.path += $$[QT_INSTALL_PLUGINS]/decorations -INSTALLS += target - -DEFINES += QT_QWS_DECORATION_STYLED - -HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qdecorationstyled_qws.h -SOURCES = main.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qdecorationstyled_qws.cpp - diff --git a/src/plugins/decorations/windows/windows.pro b/src/plugins/decorations/windows/windows.pro deleted file mode 100644 index f27adb908b0..00000000000 --- a/src/plugins/decorations/windows/windows.pro +++ /dev/null @@ -1,10 +0,0 @@ -TARGET = qdecorationwindows -load(qt_plugin) - -HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qdecorationwindows_qws.h -SOURCES = main.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qdecorationwindows_qws.cpp - -DESTDIR = $$QT.gui.plugins/decorations -target.path += $$[QT_INSTALL_PLUGINS]/decorations -INSTALLS += target diff --git a/src/plugins/generic/linuxinput/linuxinput.pro b/src/plugins/generic/linuxinput/linuxinput.pro index 18cb04e9730..6ef5f0fb3af 100644 --- a/src/plugins/generic/linuxinput/linuxinput.pro +++ b/src/plugins/generic/linuxinput/linuxinput.pro @@ -5,8 +5,6 @@ DESTDIR = $$QT.gui.plugins/generic target.path = $$[QT_INSTALL_PLUGINS]/generic INSTALLS += target -DEFINES += QT_QWS_KBD_LINUXINPUT - HEADERS = qlinuxinput.h QT += core-private @@ -14,7 +12,3 @@ QT += core-private 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 index 9c38dba1994..20391901bf9 100644 --- a/src/plugins/generic/linuxinput/main.cpp +++ b/src/plugins/generic/linuxinput/main.cpp @@ -61,8 +61,7 @@ QLinuxInputPlugin::QLinuxInputPlugin() QStringList QLinuxInputPlugin::keys() const { return (QStringList() - << QLatin1String("LinuxInputMouse") - << QLatin1String("LinuxInputKeyboard")); + << QLatin1String("LinuxInputMouse")); } QObject* QLinuxInputPlugin::create(const QString &key, @@ -70,8 +69,6 @@ QObject* QLinuxInputPlugin::create(const QString &key, { 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; } diff --git a/src/plugins/generic/linuxinput/qlinuxinput.cpp b/src/plugins/generic/linuxinput/qlinuxinput.cpp index 2316f089ccc..943b213ce07 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.cpp +++ b/src/plugins/generic/linuxinput/qlinuxinput.cpp @@ -48,9 +48,6 @@ #include #include -#include - - #include #include // overrides QT_OPEN @@ -361,195 +358,6 @@ void QLinuxInputMouseHandler::readMouseData() -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//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; - - 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; - } - - 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())); - - 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 translation 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; - } - } -} - - diff --git a/src/plugins/generic/linuxinput/qlinuxinput.h b/src/plugins/generic/linuxinput/qlinuxinput.h index 83b91d095db..b9475a1bf51 100644 --- a/src/plugins/generic/linuxinput/qlinuxinput.h +++ b/src/plugins/generic/linuxinput/qlinuxinput.h @@ -79,31 +79,6 @@ private: QLinuxInputMouseHandlerData *d; }; - -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 diff --git a/src/plugins/gfxdrivers/ahi/ahi.pro b/src/plugins/gfxdrivers/ahi/ahi.pro deleted file mode 100644 index fd078421f94..00000000000 --- a/src/plugins/gfxdrivers/ahi/ahi.pro +++ /dev/null @@ -1,14 +0,0 @@ -TARGET = qahiscreen -load(qt_plugin) - -DESTDIR = $$QT.gui.plugins/gfxdrivers - -target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers -INSTALLS += target - -HEADERS = qscreenahi_qws.h - -SOURCES = qscreenahi_qws.cpp \ - qscreenahiplugin.cpp - -LIBS += -lahi diff --git a/src/plugins/gfxdrivers/ahi/qscreenahi_qws.cpp b/src/plugins/gfxdrivers/ahi/qscreenahi_qws.cpp deleted file mode 100644 index 320aff9811d..00000000000 --- a/src/plugins/gfxdrivers/ahi/qscreenahi_qws.cpp +++ /dev/null @@ -1,598 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qscreenahi_qws.h" - -#ifndef QT_NO_QWS_AHI - -#include -#include -#include -#include -#include - -#include - -//#define QAHISCREEN_DEBUG - -static int depthForPixelFormat(const AhiPixelFormat_t format) -{ - switch (format) { - case AhiPix1bpp: - return 1; - case AhiPix2bpp: - return 2; - case AhiPix4bpp: - return 4; - case AhiPix8bpp_332RGB: - case AhiPix8bpp: - return 8; - case AhiPix16bpp_444RGB: - return 12; - case AhiPix16bpp_555RGB: - return 15; - case AhiPix16bpp_565RGB: - return 16; - case AhiPix32bpp_8888ARGB: - case AhiPix32bpp_8888BGRA: - return 32; - default: - return 0; - } -} - -static AhiPixelFormat_t pixelFormatForImageFormat(const QImage::Format format) -{ - switch (format) { - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - return AhiPix1bpp; - case QImage::Format_Indexed8: - return AhiPix8bpp; - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - return AhiPix32bpp_8888ARGB; - case QImage::Format_RGB16: - return AhiPix16bpp_565RGB; - case QImage::Format_RGB555: - return AhiPix16bpp_555RGB; - case QImage::Format_ARGB4444_Premultiplied: - case QImage::Format_RGB444: - return AhiPix16bpp_444RGB; - default: - return AhiPixelFormatMax; - } -} - -class QAhiScreenCursor : public QScreenCursor -{ -public: - QAhiScreenCursor(QScreen *screen, AhiDevCtx_t context); - - void set(const QImage &image, int hotx, int hoty); - void move(int x, int y); - void show(); - void hide(); - -private: - QScreen *screen; - AhiDevCtx_t context; -}; - -QAhiScreenCursor::QAhiScreenCursor(QScreen *s, AhiDevCtx_t c) - : QScreenCursor(), screen(s), context(c) -{ - hwaccel = true; - supportsAlpha = true; - - if (enable) - show(); - else - hide(); -} - -void QAhiScreenCursor::set(const QImage &image, int hotx, int hoty) -{ - if (image.isNull()) { - QScreenCursor::set(image, hotx, hoty); - return; - } - - if (image.format() != QImage::Format_MonoLSB) { - set(image.convertToFormat(QImage::Format_MonoLSB), hotx, hoty); - return; - } - - AhiPixelFormat_t pixFmt = pixelFormatForImageFormat(image.format()); - - if (pixFmt >= AhiPixelFormatMax) { // generic fallback - QImage::Format toFormat = screen->pixelFormat(); - if (toFormat == QImage::Format_Invalid) - toFormat = QImage::Format_ARGB32; - set(image.convertToFormat(toFormat), hotx, hoty); - return; - } - - AhiPoint_t hotSpot = { hotx, hoty }; - AhiSize_t bitmapSize = { image.width(), image.height() }; - AhiBitmap_t bitmap = { bitmapSize, (void*)(image.bits()), - image.bytesPerLine(), pixFmt }; - - AhiSts_t status; - status = AhiDispCursorSet(context, AhiCursor1, &bitmap, &hotSpot, - image.serialNumber(), 0); - if (status != AhiStsOk) - qWarning("QAhiScreenCursor::set(): AhiDispCursorSet failed: %x", - status); - - QScreenCursor::set(image, hotx, hoty); -} - -void QAhiScreenCursor::move(int x, int y) -{ - AhiPoint_t pos = { x, y }; - AhiSts_t status = AhiDispCursorPos(context, AhiCursor1, &pos, 0); - if (status != AhiStsOk) - qWarning("QAhiScreenCursor::move(): error setting mouse position: %x", - status); - QScreenCursor::move(x, y); -} - -void QAhiScreenCursor::show() -{ - AhiSts_t status; - status = AhiDispCursorState(context, AhiCursor1, AhiCursorStateOn, 0); - if (status != AhiStsOk) - qWarning("QAhiScreenCursor::show(): error setting state: %x", status); - QScreenCursor::show(); -} - -void QAhiScreenCursor::hide() -{ - AhiDispCursorState(context, AhiCursor1, AhiCursorStateOff, 0); - QScreenCursor::hide(); -} - -class QAhiScreenPrivate : public QObject -{ -public: - QAhiScreenPrivate(); - ~QAhiScreenPrivate(); - - bool setMode(AhiDispMode_t mode); - - AhiDevCtx_t context; - AhiSurf_t surface; - QAhiScreenCursor *cursor; -}; - -QT_BEGIN_NAMESPACE - -QAhiScreenPrivate::QAhiScreenPrivate() - : context(0), surface(0), cursor(0) -{ -#ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->addObject(this); -#endif -} - -QAhiScreenPrivate::~QAhiScreenPrivate() -{ - delete cursor; - - if (surface) { - AhiSurfFree(context, surface); - surface = 0; - } - if (context) { - AhiDevClose(context); - context = 0; - } - AhiTerm(); -} - -bool QAhiScreenPrivate::setMode(AhiDispMode_t mode) -{ - AhiSts_t status; - - status = AhiDispModeSet(context, &mode, 0); - if (status != AhiStsOk) { - qCritical("QAhiScreenPrivate::setMode(): AhiDispModeSet failed: %x", - status); - return false; - } - - if (surface) { - AhiSurfFree(context, surface); - surface = 0; - } - status = AhiSurfAlloc(context, &surface, &mode.size, mode.pixFmt, - AHIFLAG_SURFFIXED); - if (status != AhiStsOk) { - qCritical("QAhiScreenPrivate::setMode(): AhisurfAlloc failed: %x", - status); - return false; - } - - status = AhiDispSurfSet(context, surface, 0); - if (status != AhiStsOk) { - qCritical("QAhiScreenPrivate::setMode(): AhiDispSurfSet failed: %x", - status); - return false; - } - - return true; -} - -QAhiScreen::QAhiScreen(int displayId) - : QScreen(displayId), d_ptr(new QAhiScreenPrivate) -{ -} - -QAhiScreen::~QAhiScreen() -{ - delete d_ptr; -} - -bool QAhiScreen::configure() -{ - AhiSurfInfo_t surfaceInfo; - AhiSts_t status; - - status = AhiSurfInfo(d_ptr->context, d_ptr->surface, &surfaceInfo); - if (status != AhiStsOk) { - qCritical("QAhiScreen::configure(): AhiSurfInfo failed: %x", status); - return false; - } - - QScreen::data = 0; - QScreen::w = QScreen::dw = surfaceInfo.size.cx; - QScreen::h = QScreen::dh = surfaceInfo.size.cy; - QScreen::lstep = surfaceInfo.stride; - QScreen::size = surfaceInfo.sizeInBytes; - - switch (surfaceInfo.pixFmt) { - case AhiPix1bpp: - setPixelFormat(QImage::Format_Mono); - QScreen::d = 1; - break; - case AhiPix4bpp: - QScreen::d = 4; - break; - case AhiPix8bpp_332RGB: - case AhiPix8bpp: - QScreen::d = 8; - break; - case AhiPix16bpp_444RGB: - setPixelFormat(QImage::Format_RGB444); - QScreen::d = 12; - break; - case AhiPix16bpp_555RGB: - setPixelFormat(QImage::Format_RGB555); - QScreen::d = 15; - break; - case AhiPix16bpp_565RGB: - setPixelFormat(QImage::Format_RGB16); - QScreen::d = 16; - break; - case AhiPix2bpp: - QScreen::d = 2; - break; - case AhiPix32bpp_8888ARGB: - setPixelFormat(QImage::Format_ARGB32); - // fallthrough - case AhiPix32bpp_8888BGRA: - QScreen::d = 32; - break; - default: - qCritical("QAhiScreen::configure(): Unknown pixel format: %x", - surfaceInfo.pixFmt); - return false; - } - - const int dpi = 72; - QScreen::physWidth = qRound(QScreen::dw * 25.4 / dpi); - QScreen::physHeight = qRound(QScreen::dh * 25.4 / dpi); - - return true; -} - -bool QAhiScreen::connect(const QString &displaySpec) -{ - Q_UNUSED(displaySpec); - - AhiSts_t status; - - status = AhiInit(0); - if (status != AhiStsOk) { - qCritical("QAhiScreen::connect(): AhiInit failed: %x", status); - return false; - } - - AhiDev_t device; - AhiDevInfo_t info; - - status = AhiDevEnum(&device, &info, 0); - if (status != AhiStsOk) { - qCritical("QAhiScreen::connect(): AhiDevEnum failed: %x", status); - return false; - } -#ifdef QAHISCREEN_DEBUG - { - int displayNo = 0; - AhiDevInfo_t dispInfo = info; - qDebug("AHI supported devices:"); - do { - qDebug(" %2i: %s, sw version: %s (rev %u)\n" - " chip: 0x%x (rev %u), mem: %i (%i/%i), bus: 0x%x", - displayNo, dispInfo.name, - dispInfo.swVersion, uint(dispInfo.swRevision), - uint(dispInfo.chipId), uint(dispInfo.revisionId), - uint(dispInfo.totalMemory), - uint(dispInfo.internalMemSize), - uint(dispInfo.externalMemSize), - uint(dispInfo.cpuBusInterfaceMode)); - status = AhiDevEnum(&device, &info, ++displayNo); - } while (status == AhiStsOk); - } -#endif - - status = AhiDevOpen(&d_ptr->context, device, "qscreenahi", - AHIFLAG_USERLEVEL); - if (status != AhiStsOk) { - qCritical("QAhiScreen::connect(): AhiDevOpen failed: %x", status); - return false; - } - - AhiDispMode_t mode; - - status = AhiDispModeEnum(d_ptr->context, &mode, 0); - if (status != AhiStsOk) { - qCritical("QAhiScreen::connect(): AhiDispModeEnum failed: %x", status); - return false; - } - -#ifdef QAHISCREEN_DEBUG - { - int modeNo = 0; - AhiDispMode_t modeInfo = mode; - qDebug("AHI supported modes:"); - do { - qDebug(" %2i: %ux%u, fmt: %i, %u Hz, rot: %i, mirror: %i", - modeNo, uint(modeInfo.size.cx), uint(modeInfo.size.cy), - modeInfo.pixFmt, uint(modeInfo.frequency), - modeInfo.rotation, modeInfo.mirror); - status = AhiDispModeEnum(d_ptr->context, &modeInfo, ++modeNo); - } while (status == AhiStsOk); - } -#endif - - if (QApplication::type() == QApplication::GuiServer) { - if (!d_ptr->setMode(mode)) - return false; - } else { - status = AhiDispSurfGet(d_ptr->context, &d_ptr->surface); - if (status != AhiStsOk) { - qCritical("QAhiScreen::connect(): AhiDispSurfGet failed: %x", - status); - return false; - } - - status = AhiDispModeGet(d_ptr->context, &mode); - if (status != AhiStsOk) { - qCritical("QAhiScreen::context(): AhiDispModeGet failed: %x", - status); - return false; - } - } - - return configure(); -} - -void QAhiScreen::disconnect() -{ - AhiSurfFree(d_ptr->context, d_ptr->surface); - d_ptr->surface = 0; - AhiDevClose(d_ptr->context); - d_ptr->context = 0; - AhiTerm(); -} - -bool QAhiScreen::initDevice() -{ - QScreenCursor::initSoftwareCursor(); - - AhiSts_t status = AhiDispState(d_ptr->context, AhiDispStateOn, 0); - if (status != AhiStsOk) { - qCritical("QAhiScreen::connect(): AhiDispState failed: %x", status); - return false; - } - - return true; -} - -void QAhiScreen::shutdownDevice() -{ - AhiDispState(d_ptr->context, AhiDispStateOff, 0); -} - -void QAhiScreen::setMode(int width, int height, int depth) -{ - int modeNo = 0; - AhiDispMode_t mode; - AhiSts_t status = AhiStsOk; - - while (status == AhiStsOk) { - status = AhiDispModeEnum(d_ptr->context, &mode, modeNo); - if (mode.size.cx == uint(width) && - mode.size.cy == uint(height) && - depthForPixelFormat(mode.pixFmt) == depth) - { - d_ptr->setMode(mode); - configure(); - return; - } - } -} - -void QAhiScreen::blit(const QImage &image, const QPoint &topLeft, - const QRegion ®) -{ - AhiPixelFormat_t pixFmt = pixelFormatForImageFormat(image.format()); - - if (pixFmt >= AhiPixelFormatMax) { // generic fallback - QImage::Format toFormat = pixelFormat(); - if (toFormat == QImage::Format_Invalid) - toFormat = QImage::Format_ARGB32; - blit(image.convertToFormat(toFormat), topLeft, reg); - return; - } - - AhiSts_t status; - - status = AhiDrawSurfDstSet(d_ptr->context, d_ptr->surface, 0); - if (status != AhiStsOk) { - qWarning("QAhiScreen::blit(): AhiDrawSurfDstSet failed: %x", status); - return; - } - - const QVector rects = (reg & region()).rects(); - const int numRects = rects.size(); - QVarLengthArray src(numRects); - QVarLengthArray dest(numRects); - - for (int i = 0; i < numRects; ++i) { - const QRect rect = rects.at(i); - - src[i].x = rect.x() - topLeft.x(); - src[i].y = rect.y() - topLeft.y(); - dest[i].left = rect.left(); - dest[i].top = rect.top(); - dest[i].right = rect.x() + rect.width(); - dest[i].bottom = rect.y() + rect.height(); - } - - AhiSize_t bitmapSize = { image.width(), image.height() }; - AhiBitmap_t bitmap = { bitmapSize, (void*)(image.bits()), - image.bytesPerLine(), pixFmt }; - - status = AhiDrawRopSet(d_ptr->context, AHIMAKEROP3(AHIROPSRCCOPY)); - if (status != AhiStsOk) { - qWarning("QAhiScreen::blit(): AhiDrawRopSet failed: %x", status); - return; - } - - for (int i = 0; i < numRects; ++i) { - status = AhiDrawBitmapBlt(d_ptr->context, &dest[i], &src[i], - &bitmap, 0, 0); - if (status != AhiStsOk) { - qWarning("QAhiScreen::blit(): AhiDrawBitmapBlt failed: %x", - status); - break; - } - } -} - -void QAhiScreen::solidFill(const QColor &color, const QRegion ®) -{ - AhiSts_t status = AhiStsOk; - - switch (pixelFormat()) { - case QImage::Format_ARGB32_Premultiplied: - case QImage::Format_ARGB32: - case QImage::Format_RGB32: - status = AhiDrawBrushFgColorSet(d_ptr->context, color.rgba()); - break; - case QImage::Format_RGB16: - status = AhiDrawBrushFgColorSet(d_ptr->context, qt_convRgbTo16(color.rgb())); - break; - default: - qFatal("QAhiScreen::solidFill(): Not implemented for pixel format %d", - int(pixelFormat())); - break; - } - - if (status != AhiStsOk) { - qWarning("QAhiScreen::solidFill(): AhiDrawBrushFgColorSet failed: %x", - status); - return; - } - - status = AhiDrawBrushSet(d_ptr->context, 0, 0, 0, AHIFLAG_BRUSHSOLID); - if (status != AhiStsOk) { - qWarning("QAhiScreen::solidFill(): AhiDrawBrushSet failed: %x", - status); - return; - } - - status = AhiDrawRopSet(d_ptr->context, AHIMAKEROP3(AHIROPPATCOPY)); - if (status != AhiStsOk) { - qWarning("QAhiScreen::solidFill(): AhiDrawRopSet failed: %x", status); - return; - } - - status = AhiDrawSurfDstSet(d_ptr->context, d_ptr->surface, 0); - if (status != AhiStsOk) { - qWarning("QAhiScreen::solidFill(): AhiDrawSurfDst failed: %x", status); - return; - } - - const QVector rects = (reg & region()).rects(); - QVarLengthArray ahiRects(rects.size()); - - for (int i = 0; i < rects.size(); ++i) { - const QRect rect = rects.at(i); - ahiRects[i].left = rect.left(); - ahiRects[i].top = rect.top(); - ahiRects[i].right = rect.x() + rect.width(); - ahiRects[i].bottom = rect.y() + rect.height(); - } - - status = AhiDrawBitBltMulti(d_ptr->context, ahiRects.data(), - 0, ahiRects.size()); - if (status != AhiStsOk) - qWarning("QAhiScreen::solidFill(): AhiDrawBitBlt failed: %x", status); -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_AHI diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro deleted file mode 100644 index 6fb2a0f9aa6..00000000000 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ /dev/null @@ -1,15 +0,0 @@ -TARGET = qdirectfbscreen -load(qt_plugin) -include($$QT_SOURCE_TREE/src/gui/embedded/directfb.pri) - -DESTDIR = $$QT.gui.plugins/gfxdrivers - -target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers -INSTALLS += target - -SOURCES += qdirectfbscreenplugin.cpp - -QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB -LIBS += $$QT_LIBS_DIRECTFB -DEFINES += $$QT_DEFINES_DIRECTFB -contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp deleted file mode 100644 index 9ec3f71c7cc..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp +++ /dev/null @@ -1,436 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectfbkeyboard.h" - -#ifndef QT_NO_QWS_DIRECTFB - -#include "qdirectfbscreen.h" -#include -#include -#include - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class KeyMap : public QHash -{ -public: - KeyMap(); -}; - -Q_GLOBAL_STATIC(KeyMap, keymap); - -class QDirectFBKeyboardHandlerPrivate : public QObject -{ - Q_OBJECT -public: - QDirectFBKeyboardHandlerPrivate(QDirectFBKeyboardHandler *handler); - ~QDirectFBKeyboardHandlerPrivate(); - - void suspend(); - void resume(); - -private: - QDirectFBKeyboardHandler *handler; - IDirectFBEventBuffer *eventBuffer; - QSocketNotifier *keyboardNotifier; - DFBEvent event; - int bytesRead; - int lastUnicode, lastKeycode; - Qt::KeyboardModifiers lastModifiers; -private Q_SLOTS: - void readKeyboardData(); -}; - -QDirectFBKeyboardHandlerPrivate::QDirectFBKeyboardHandlerPrivate(QDirectFBKeyboardHandler *h) - : handler(h), eventBuffer(0), keyboardNotifier(0), bytesRead(0), - lastUnicode(0), lastKeycode(0), lastModifiers(0) -{ - Q_ASSERT(qt_screen); - - IDirectFB *fb = QDirectFBScreen::instance()->dfb(); - if (!fb) { - qCritical("QDirectFBKeyboardHandler: DirectFB not initialized"); - return; - } - - DFBResult result; - result = fb->CreateInputEventBuffer(fb, DICAPS_KEYS, DFB_TRUE, - &eventBuffer); - if (result != DFB_OK) { - DirectFBError("QDirectFBKeyboardHandler: " - "Unable to create input event buffer", result); - return; - } - - int fd; - result = eventBuffer->CreateFileDescriptor(eventBuffer, &fd); - if (result != DFB_OK) { - DirectFBError("QDirectFBKeyboardHandler: " - "Unable to create file descriptor", result); - return; - } - - int flags = ::fcntl(fd, F_GETFL, 0); - ::fcntl(fd, F_SETFL, flags | O_NONBLOCK); - - memset(&event, 0, sizeof(event)); - - keyboardNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); - connect(keyboardNotifier, SIGNAL(activated(int)), - this, SLOT(readKeyboardData())); - resume(); -} - -void QDirectFBKeyboardHandlerPrivate::suspend() -{ - keyboardNotifier->setEnabled(false); -} - -void QDirectFBKeyboardHandlerPrivate::resume() -{ - eventBuffer->Reset(eventBuffer); - keyboardNotifier->setEnabled(true); -} - -QDirectFBKeyboardHandlerPrivate::~QDirectFBKeyboardHandlerPrivate() -{ - if (eventBuffer) - eventBuffer->Release(eventBuffer); -} - -void QDirectFBKeyboardHandlerPrivate::readKeyboardData() -{ - if(!qt_screen) - return; - - for (;;) { - // GetEvent returns DFB_UNSUPPORTED after CreateFileDescriptor(). - // This seems stupid and I really hope it's a bug which will be fixed. - - // DFBResult ret = eventBuffer->GetEvent(eventBuffer, &event); - - char *buf = reinterpret_cast(&event); - int ret = ::read(keyboardNotifier->socket(), - buf + bytesRead, sizeof(DFBEvent) - bytesRead); - if (ret == -1) { - if (errno != EAGAIN) - qWarning("QDirectFBKeyboardHandlerPrivate::readKeyboardData(): %s", - strerror(errno)); - return; - } - - Q_ASSERT(ret >= 0); - bytesRead += ret; - if (bytesRead < int(sizeof(DFBEvent))) - break; - bytesRead = 0; - - Q_ASSERT(event.clazz == DFEC_INPUT); - - const DFBInputEvent input = event.input; - - Qt::KeyboardModifiers modifiers = Qt::NoModifier; - - // Not implemented: - // if (input.modifiers & DIMM_SUPER) - // if (input.modifiers & DIMM_HYPER) - - if (!(input.flags & DIEF_KEYSYMBOL) || - !(input.flags & DIEF_KEYID) || - !(input.type & (DIET_KEYPRESS|DIET_KEYRELEASE))) - { - static bool first = true; - if (first) { - qWarning("QDirectFBKeyboardHandler - Getting unexpected non-keyboard related events"); - first = false; - } - break; - } - - if (input.flags & DIEF_MODIFIERS) { - if (input.modifiers & DIMM_SHIFT) - modifiers |= Qt::ShiftModifier; - if (input.modifiers & DIMM_CONTROL) - modifiers |= Qt::ControlModifier; - if (input.modifiers & DIMM_ALT) - modifiers |= Qt::AltModifier; - if (input.modifiers & DIMM_ALTGR) - modifiers |= Qt::AltModifier; - if (input.modifiers & DIMM_META) - modifiers |= Qt::MetaModifier; - } - - - const bool press = input.type & DIET_KEYPRESS; - DFBInputDeviceKeySymbol symbol = input.key_symbol; - int unicode = -1; - int keycode = 0; - - keycode = keymap()->value(symbol); - if (DFB_KEY_TYPE(symbol) == DIKT_UNICODE) - unicode = symbol; - - if (unicode != -1 || keycode != 0) { - bool autoRepeat = false; - if (press) { - if (unicode == lastUnicode && keycode == lastKeycode && modifiers == lastModifiers) { - autoRepeat = true; - } else { - lastUnicode = unicode; - lastKeycode = keycode; - lastModifiers = modifiers; - } - } else { - lastUnicode = lastKeycode = -1; - lastModifiers = 0; - } - if (autoRepeat) { - handler->processKeyEvent(unicode, keycode, - modifiers, false, autoRepeat); - - } - - handler->processKeyEvent(unicode, keycode, - modifiers, press, autoRepeat); - } - } -} - -QDirectFBKeyboardHandler::QDirectFBKeyboardHandler(const QString &device) - : QWSKeyboardHandler() -{ - Q_UNUSED(device); - d = new QDirectFBKeyboardHandlerPrivate(this); -} - -QDirectFBKeyboardHandler::~QDirectFBKeyboardHandler() -{ - delete d; -} - -KeyMap::KeyMap() -{ - 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); -} - -QT_END_NAMESPACE -#include "qdirectfbkeyboard.moc" -#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp deleted file mode 100644 index f5f03e72eb9..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectfbmouse.h" - -#ifndef QT_NO_QWS_DIRECTFB - -#include "qdirectfbscreen.h" -#include - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QDirectFBMouseHandlerPrivate : public QObject -{ - Q_OBJECT -public: - QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler *h); - ~QDirectFBMouseHandlerPrivate(); - - void setEnabled(bool on); -private: - QDirectFBMouseHandler *handler; - IDirectFBEventBuffer *eventBuffer; -#ifndef QT_NO_DIRECTFB_LAYER - IDirectFBDisplayLayer *layer; -#endif - QSocketNotifier *mouseNotifier; - - QPoint prevPoint; - Qt::MouseButtons prevbuttons; - - DFBEvent event; - uint bytesRead; - -private Q_SLOTS: - void readMouseData(); -}; - -QDirectFBMouseHandlerPrivate::QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler *h) - : handler(h), eventBuffer(0) -{ - DFBResult result; - - QScreen *screen = QScreen::instance(); - if (!screen) { - qCritical("QDirectFBMouseHandler: no screen instance found"); - return; - } - - IDirectFB *fb = QDirectFBScreen::instance()->dfb(); - if (!fb) { - qCritical("QDirectFBMouseHandler: DirectFB not initialized"); - return; - } - -#ifndef QT_NO_DIRECTFB_LAYER - layer = QDirectFBScreen::instance()->dfbDisplayLayer(); - if (!layer) { - qCritical("QDirectFBMouseHandler: Unable to get primary display layer"); - return; - } -#endif - - DFBInputDeviceCapabilities caps; - caps = DICAPS_BUTTONS | DICAPS_AXES; - result = fb->CreateInputEventBuffer(fb, caps, DFB_TRUE, &eventBuffer); - if (result != DFB_OK) { - DirectFBError("QDirectFBMouseHandler: " - "Unable to create input event buffer", result); - return; - } - - int fd; - result = eventBuffer->CreateFileDescriptor(eventBuffer, &fd); - if (result != DFB_OK) { - DirectFBError("QDirectFBMouseHandler: " - "Unable to create file descriptor", result); - return; - } - - int flags = fcntl(fd, F_GETFL, 0); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); - - // DirectFB seems to assume that the mouse always starts centered - prevPoint = QPoint(screen->deviceWidth() / 2, screen->deviceHeight() / 2); - prevbuttons = Qt::NoButton; - memset(&event, 0, sizeof(event)); - bytesRead = 0; - - mouseNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); - connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); - setEnabled(true); -} - -QDirectFBMouseHandlerPrivate::~QDirectFBMouseHandlerPrivate() -{ - if (eventBuffer) - eventBuffer->Release(eventBuffer); -} - -void QDirectFBMouseHandlerPrivate::setEnabled(bool on) -{ - if (mouseNotifier->isEnabled() != on) { -#ifndef QT_NO_DIRECTFB_LAYER - DFBResult result; - result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::QDirectFBScreenCursor: " - "Unable to set cooperative level", result); - } - result = layer->EnableCursor(layer, on ? 1 : 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::QDirectFBScreenCursor: " - "Unable to enable cursor", result); - } - - result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to set cooperative level", result); - } - - layer->SetCooperativeLevel(layer, DLSCL_SHARED); -#endif - mouseNotifier->setEnabled(on); - } -} - -void QDirectFBMouseHandlerPrivate::readMouseData() -{ - if (!QScreen::instance()) - return; - - for (;;) { - // GetEvent returns DFB_UNSUPPORTED after CreateFileDescriptor(). - // This seems stupid and I really hope it's a bug which will be fixed. - - // DFBResult ret = eventBuffer->GetEvent(eventBuffer, &event); - - char *buf = reinterpret_cast(&event); - int ret = ::read(mouseNotifier->socket(), - buf + bytesRead, sizeof(DFBEvent) - bytesRead); - if (ret == -1) { - if (errno == EINTR) - continue; - if (errno == EAGAIN) - return; - qWarning("QDirectFBMouseHandlerPrivate::readMouseData(): %s", - strerror(errno)); - return; - } - - Q_ASSERT(ret >= 0); - bytesRead += ret; - if (bytesRead < sizeof(DFBEvent)) - break; - bytesRead = 0; - - Q_ASSERT(event.clazz == DFEC_INPUT); - - const DFBInputEvent input = event.input; - int x = prevPoint.x(); - int y = prevPoint.y(); - int wheel = 0; - - if (input.type == DIET_AXISMOTION) { -#if defined(QT_NO_DIRECTFB_LAYER) || defined(QT_DIRECTFB_WINDOW_AS_CURSOR) - if (input.flags & DIEF_AXISABS) { - switch (input.axis) { - case DIAI_X: x = input.axisabs; break; - case DIAI_Y: y = input.axisabs; break; - default: - qWarning("QDirectFBMouseHandlerPrivate::readMouseData: " - "unknown axis (absolute) %d", input.axis); - break; - } - } else if (input.flags & DIEF_AXISREL) { - switch (input.axis) { - case DIAI_X: x += input.axisrel; break; - case DIAI_Y: y += input.axisrel; break; - case DIAI_Z: wheel = -120 * input.axisrel; break; - default: - qWarning("QDirectFBMouseHandlerPrivate::readMouseData: " - "unknown axis (releative) %d", input.axis); - } - } -#else - if (input.axis == DIAI_X || input.axis == DIAI_Y) { - DFBResult result = layer->GetCursorPosition(layer, &x, &y); - if (result != DFB_OK) { - DirectFBError("QDirectFBMouseHandler::readMouseData", - result); - } - } else if (input.axis == DIAI_Z) { - Q_ASSERT(input.flags & DIEF_AXISREL); - wheel = input.axisrel; - wheel *= -120; - } -#endif - } - - Qt::MouseButtons buttons = Qt::NoButton; - if (input.flags & DIEF_BUTTONS) { - if (input.buttons & DIBM_LEFT) - buttons |= Qt::LeftButton; - if (input.buttons & DIBM_MIDDLE) - buttons |= Qt::MidButton; - if (input.buttons & DIBM_RIGHT) - buttons |= Qt::RightButton; - } - - QPoint p = QPoint(x, y); - handler->limitToScreen(p); - - if (p == prevPoint && wheel == 0 && buttons == prevbuttons) - continue; - - prevPoint = p; - prevbuttons = buttons; - - handler->mouseChanged(p, buttons, wheel); - } -} - -QDirectFBMouseHandler::QDirectFBMouseHandler(const QString &driver, - const QString &device) - : QWSMouseHandler(driver, device) -{ - d = new QDirectFBMouseHandlerPrivate(this); -} - -QDirectFBMouseHandler::~QDirectFBMouseHandler() -{ - delete d; -} - -void QDirectFBMouseHandler::suspend() -{ - d->setEnabled(false); -} - -void QDirectFBMouseHandler::resume() -{ - d->setEnabled(true); -} - -QT_END_NAMESPACE -#include "qdirectfbmouse.moc" -#endif // QT_NO_QWS_DIRECTFB - - diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp deleted file mode 100644 index 90d00907904..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectfbscreen.h" -#include "qdirectfbpaintdevice.h" -#include "qdirectfbpaintengine.h" - -#ifndef QT_NO_QWS_DIRECTFB - -QT_BEGIN_NAMESPACE - -QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr) - : QCustomRasterPaintDevice(0), dfbSurface(0), screen(scr), - bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), imageFormat(QImage::Format_Invalid) -{ -#ifdef QT_DIRECTFB_SUBSURFACE - subSurface = 0; - syncPending = false; -#endif -} - -QDirectFBPaintDevice::~QDirectFBPaintDevice() -{ - if (QDirectFBScreen::instance()) { - unlockSurface(); -#ifdef QT_DIRECTFB_SUBSURFACE - releaseSubSurface(); -#endif - if (dfbSurface) { - screen->releaseDFBSurface(dfbSurface); - } - } - delete engine; -} - -IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const -{ - return dfbSurface; -} - -bool QDirectFBPaintDevice::lockSurface(DFBSurfaceLockFlags lockFlags) -{ - if (lockFlgs && (lockFlags & ~lockFlgs)) - unlockSurface(); - if (!mem) { - Q_ASSERT(dfbSurface); -#ifdef QT_DIRECTFB_SUBSURFACE - if (!subSurface) { - DFBResult result; - subSurface = screen->getSubSurface(dfbSurface, QRect(), QDirectFBScreen::TrackSurface, &result); - if (result != DFB_OK || !subSurface) { - DirectFBError("Couldn't create sub surface", result); - return false; - } - } - IDirectFBSurface *surface = subSurface; -#else - IDirectFBSurface *surface = dfbSurface; -#endif - Q_ASSERT(surface); - mem = QDirectFBScreen::lockSurface(surface, lockFlags, &bpl); - lockFlgs = lockFlags; - Q_ASSERT(mem); - Q_ASSERT(bpl > 0); - const QSize s = size(); - lockedImage = QImage(mem, s.width(), s.height(), bpl, - QDirectFBScreen::getImageFormat(dfbSurface)); - return true; - } -#ifdef QT_DIRECTFB_SUBSURFACE - if (syncPending) { - syncPending = false; - screen->waitIdle(); - } -#endif - return false; -} - -void QDirectFBPaintDevice::unlockSurface() -{ - if (QDirectFBScreen::instance() && lockFlgs) { -#ifdef QT_DIRECTFB_SUBSURFACE - IDirectFBSurface *surface = subSurface; -#else - IDirectFBSurface *surface = dfbSurface; -#endif - if (surface) { - surface->Unlock(surface); - lockFlgs = static_cast(0); - mem = 0; - } - } -} - -void *QDirectFBPaintDevice::memory() const -{ - return mem; -} - -QImage::Format QDirectFBPaintDevice::format() const -{ - return imageFormat; -} - -int QDirectFBPaintDevice::bytesPerLine() const -{ - Q_ASSERT(!mem || bpl != -1); - return bpl; -} - -QSize QDirectFBPaintDevice::size() const -{ - int w, h; - dfbSurface->GetSize(dfbSurface, &w, &h); - return QSize(w, h); -} - -int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const -{ - if (!dfbSurface) - return 0; - - switch (metric) { - case QPaintDevice::PdmWidth: - case QPaintDevice::PdmHeight: - return (metric == PdmWidth ? size().width() : size().height()); - case QPaintDevice::PdmWidthMM: - return (size().width() * 1000) / dotsPerMeterX(); - case QPaintDevice::PdmHeightMM: - return (size().height() * 1000) / dotsPerMeterY(); - case QPaintDevice::PdmPhysicalDpiX: - case QPaintDevice::PdmDpiX: - return (dotsPerMeterX() * 254) / 10000; // 0.0254 meters-per-inch - case QPaintDevice::PdmPhysicalDpiY: - case QPaintDevice::PdmDpiY: - return (dotsPerMeterY() * 254) / 10000; // 0.0254 meters-per-inch - case QPaintDevice::PdmDepth: - return QDirectFBScreen::depth(imageFormat); - case QPaintDevice::PdmNumColors: { - if (!lockedImage.isNull()) - return lockedImage.colorCount(); - - DFBResult result; - IDirectFBPalette *palette = 0; - unsigned int numColors = 0; - - result = dfbSurface->GetPalette(dfbSurface, &palette); - if ((result != DFB_OK) || !palette) - return 0; - - result = palette->GetSize(palette, &numColors); - palette->Release(palette); - if (result != DFB_OK) - return 0; - - return numColors; - } - default: - qCritical("QDirectFBPaintDevice::metric(): Unhandled metric!"); - return 0; - } -} - -QPaintEngine *QDirectFBPaintDevice::paintEngine() const -{ - return engine; -} - -#ifdef QT_DIRECTFB_SUBSURFACE -void QDirectFBPaintDevice::releaseSubSurface() -{ - Q_ASSERT(QDirectFBScreen::instance()); - if (subSurface) { - unlockSurface(); - screen->releaseDFBSurface(subSurface); - subSurface = 0; - } -} -#endif - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h deleted file mode 100644 index 975954a4967..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDIRECTFBPAINTDEVICE_H -#define QDIRECTFBPAINTDEVICE_H - -#include -#include "qdirectfbscreen.h" - -#ifndef QT_NO_QWS_DIRECTFB - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -// Inherited by both window surface and pixmap -class QDirectFBPaintEngine; -class QDirectFBPaintDevice : public QCustomRasterPaintDevice -{ -public: - ~QDirectFBPaintDevice(); - - virtual IDirectFBSurface *directFBSurface() const; - - bool lockSurface(DFBSurfaceLockFlags lockFlags); - void unlockSurface(); - - // Reimplemented from QCustomRasterPaintDevice: - void *memory() const; - QImage::Format format() const; - int bytesPerLine() const; - QSize size() const; - int metric(QPaintDevice::PaintDeviceMetric metric) const; - DFBSurfaceLockFlags lockFlags() const { return lockFlgs; } - QPaintEngine *paintEngine() const; -protected: - QDirectFBPaintDevice(QDirectFBScreen *scr); - inline int dotsPerMeterX() const - { - return (screen->deviceWidth() * 1000) / screen->physicalWidth(); - } - inline int dotsPerMeterY() const - { - return (screen->deviceHeight() * 1000) / screen->physicalHeight(); - } - - IDirectFBSurface *dfbSurface; -#ifdef QT_DIRECTFB_SUBSURFACE - void releaseSubSurface(); - IDirectFBSurface *subSurface; - friend class QDirectFBPaintEnginePrivate; - bool syncPending; -#endif - QImage lockedImage; - QDirectFBScreen *screen; - int bpl; - DFBSurfaceLockFlags lockFlgs; - uchar *mem; - QDirectFBPaintEngine *engine; - QImage::Format imageFormat; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_QWS_DIRECTFB -#endif //QDIRECTFBPAINTDEVICE_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp deleted file mode 100644 index 18861cfac17..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ /dev/null @@ -1,1430 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectfbpaintengine.h" - -#ifndef QT_NO_QWS_DIRECTFB - -#include "qdirectfbwindowsurface.h" -#include "qdirectfbscreen.h" -#include "qdirectfbpixmap.h" -#include -#include -#include -#include -#include -#include -#include -#include - - -QT_BEGIN_NAMESPACE - -class SurfaceCache; -class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate -{ -public: - enum TransformationTypeFlags { - Matrix_NegativeScale = 0x100, - Matrix_RectsUnsupported = (QTransform::TxRotate|QTransform::TxShear|QTransform::TxProject), - Matrix_BlitsUnsupported = (Matrix_NegativeScale|Matrix_RectsUnsupported) - }; - - inline static uint getTransformationType(const QTransform &transform) - { - int ret = transform.type(); - if (qMin(transform.m11(), transform.m22()) < 0) { - ret |= QDirectFBPaintEnginePrivate::Matrix_NegativeScale; - } - return ret; - } - - enum CompositionModeStatus { - PorterDuff_None = 0x0, - PorterDuff_Supported = 0x1, - PorterDuff_PremultiplyColors = 0x2, - PorterDuff_AlwaysBlend = 0x4 - }; - - enum ClipType { - ClipUnset, - NoClip, - RectClip, - RegionClip, - ComplexClip - }; - - QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p); - ~QDirectFBPaintEnginePrivate(); - - inline void setTransform(const QTransform &transforma); - inline void setPen(const QPen &pen); - inline void setCompositionMode(QPainter::CompositionMode mode); - inline void setRenderHints(QPainter::RenderHints hints); - - inline void setDFBColor(const QColor &color); - - inline void lock(); - inline void unlock(); - static inline void unlock(QDirectFBPaintDevice *device); - - inline bool isSimpleBrush(const QBrush &brush) const; - - void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos, const QTransform &pixmapTransform); - void blit(const QRectF &dest, IDirectFBSurface *surface, const QRectF &src); - - inline bool supportsStretchBlit() const; - - inline void updateClip(); - virtual void systemStateChanged(); - - static IDirectFBSurface *getSurface(const QImage &img, bool *release); - -#ifdef QT_DIRECTFB_IMAGECACHE - static inline int cacheCost(const QImage &img) { return img.width() * img.height() * img.depth() / 8; } -#endif - - enum BlitFlag { - HasAlpha = 0x1, - Premultiplied = 0x2 - }; - void prepareForBlit(uint blitFlags); - - IDirectFBSurface *surface; - - bool antialiased; - bool simplePen; - - uint transformationType; // this is QTransform::type() + Matrix_NegativeScale if qMin(transform.m11(), transform.m22()) < 0 - - SurfaceCache *surfaceCache; - IDirectFB *fb; - quint8 opacity; - - ClipType clipType; - QDirectFBPaintDevice *dfbDevice; - uint compositionModeStatus; - bool isPremultiplied; - - bool inClip; - QRect currentClip; - - QDirectFBPaintEngine *q; -}; - -class SurfaceCache -{ -public: - SurfaceCache() : surface(0), buffer(0), bufsize(0) {} - ~SurfaceCache() { clear(); } - IDirectFBSurface *getSurface(const uint *buf, int size); - void clear(); -private: - IDirectFBSurface *surface; - uint *buffer; - int bufsize; -}; - - -#ifdef QT_DIRECTFB_IMAGECACHE -QT_BEGIN_INCLUDE_NAMESPACE -#include -QT_END_INCLUDE_NAMESPACE -struct CachedImage -{ - IDirectFBSurface *surface; - ~CachedImage() - { - if (surface && QDirectFBScreen::instance()) { - QDirectFBScreen::instance()->releaseDFBSurface(surface); - } - } -}; -static QCache imageCache(4*1024*1024); // 4 MB -#endif - -#define VOID_ARG() static_cast(false) -enum PaintOperation { - DRAW_RECTS = 0x0001, DRAW_LINES = 0x0002, DRAW_IMAGE = 0x0004, - DRAW_PIXMAP = 0x0008, DRAW_TILED_PIXMAP = 0x0010, STROKE_PATH = 0x0020, - DRAW_PATH = 0x0040, DRAW_POINTS = 0x0080, DRAW_ELLIPSE = 0x0100, - DRAW_POLYGON = 0x0200, DRAW_TEXT = 0x0400, FILL_PATH = 0x0800, - FILL_RECT = 0x1000, DRAW_COLORSPANS = 0x2000, DRAW_ROUNDED_RECT = 0x4000, - DRAW_STATICTEXT = 0x8000, ALL = 0xffff -}; - -enum { RasterWarn = 1, RasterDisable = 2 }; -static inline uint rasterFallbacksMask(PaintOperation op) -{ - uint ret = 0; -#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS - if (op & QT_DIRECTFB_WARN_ON_RASTERFALLBACKS) - ret |= RasterWarn; -#endif -#ifdef QT_DIRECTFB_DISABLE_RASTERFALLBACKS - if (op & QT_DIRECTFB_DISABLE_RASTERFALLBACKS) - ret |= RasterDisable; -#endif - static int warningMask = -1; - static int disableMask = -1; - if (warningMask < 0) { - struct { - const char *name; - PaintOperation operation; - } const operations[] = { - { "DRAW_RECTS", DRAW_RECTS }, - { "DRAW_LINES", DRAW_LINES }, - { "DRAW_IMAGE", DRAW_IMAGE }, - { "DRAW_PIXMAP", DRAW_PIXMAP }, - { "DRAW_TILED_PIXMAP", DRAW_TILED_PIXMAP }, - { "STROKE_PATH", STROKE_PATH }, - { "DRAW_PATH", DRAW_PATH }, - { "DRAW_POINTS", DRAW_POINTS }, - { "DRAW_ELLIPSE", DRAW_ELLIPSE }, - { "DRAW_POLYGON", DRAW_POLYGON }, - { "DRAW_TEXT", DRAW_TEXT }, - { "FILL_PATH", FILL_PATH }, - { "FILL_RECT", FILL_RECT }, - { "DRAW_COLORSPANS", DRAW_COLORSPANS }, - { "DRAW_ROUNDED_RECT", DRAW_ROUNDED_RECT }, - { "ALL", ALL }, - { 0, ALL } - }; - - QStringList warning = QString::fromLatin1(qgetenv("QT_DIRECTFB_WARN_ON_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'), - QString::SkipEmptyParts); - QStringList disable = QString::fromLatin1(qgetenv("QT_DIRECTFB_DISABLE_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'), - QString::SkipEmptyParts); - warningMask = 0; - disableMask = 0; - if (!warning.isEmpty() || !disable.isEmpty()) { - for (int i=0; operations[i].name; ++i) { - const QString name = QString::fromLatin1(operations[i].name); - int idx = warning.indexOf(name); - if (idx != -1) { - warningMask |= operations[i].operation; - warning.erase(warning.begin() + idx); - } - idx = disable.indexOf(name); - if (idx != -1) { - disableMask |= operations[i].operation; - disable.erase(disable.begin() + idx); - } - } - } - if (!warning.isEmpty()) { - qWarning("QDirectFBPaintEngine QT_DIRECTFB_WARN_ON_RASTERFALLBACKS Unknown operation(s): %s", - qPrintable(warning.join(QLatin1String("|")))); - } - if (!disable.isEmpty()) { - qWarning("QDirectFBPaintEngine QT_DIRECTFB_DISABLE_RASTERFALLBACKS Unknown operation(s): %s", - qPrintable(disable.join(QLatin1String("|")))); - } - } - if (op & warningMask) - ret |= RasterWarn; - if (op & disableMask) - ret |= RasterDisable; - return ret; -} - -template -static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, - uint transformationType, bool simplePen, - uint clipType, uint compositionModeStatus, - const char *nameOne, const T1 &one, - const char *nameTwo, const T2 &two, - const char *nameThree, const T3 &three); - -#define RASTERFALLBACK(op, one, two, three) \ - { \ - static const uint rasterFallbacks = rasterFallbacksMask(op); \ - switch (rasterFallbacks) { \ - case 0: break; \ - case RasterWarn: \ - rasterFallbackWarn("Falling back to raster engine for", \ - __FUNCTION__, \ - state()->painter->device(), \ - d_func()->transformationType, \ - d_func()->simplePen, \ - d_func()->clipType, \ - d_func()->compositionModeStatus, \ - #one, one, #two, two, #three, three); \ - break; \ - case RasterDisable|RasterWarn: \ - rasterFallbackWarn("Disabled raster engine operation", \ - __FUNCTION__, \ - state()->painter->device(), \ - d_func()->transformationType, \ - d_func()->simplePen, \ - d_func()->clipType, \ - d_func()->compositionModeStatus, \ - #one, one, #two, two, #three, three); \ - case RasterDisable: \ - return; \ - } \ - } - -template -static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface); -template -static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface); -template -static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface); - -#define CLIPPED_PAINT(operation) { \ - d->unlock(); \ - DFBRegion clipRegion; \ - switch (d->clipType) { \ - case QDirectFBPaintEnginePrivate::NoClip: \ - case QDirectFBPaintEnginePrivate::RectClip: \ - operation; \ - break; \ - case QDirectFBPaintEnginePrivate::RegionClip: { \ - Q_ASSERT(d->clip()); \ - const QVector cr = d->clip()->clipRegion.rects(); \ - const int size = cr.size(); \ - for (int i=0; icurrentClip = cr.at(i); \ - clipRegion.x1 = d->currentClip.x(); \ - clipRegion.y1 = d->currentClip.y(); \ - clipRegion.x2 = d->currentClip.right(); \ - clipRegion.y2 = d->currentClip.bottom(); \ - d->surface->SetClip(d->surface, &clipRegion); \ - operation; \ - } \ - d->updateClip(); \ - break; } \ - case QDirectFBPaintEnginePrivate::ComplexClip: \ - case QDirectFBPaintEnginePrivate::ClipUnset: \ - qFatal("CLIPPED_PAINT internal error %d", d->clipType); \ - break; \ - } \ - } - - -QDirectFBPaintEngine::QDirectFBPaintEngine(QPaintDevice *device) - : QRasterPaintEngine(*(new QDirectFBPaintEnginePrivate(this)), device) -{ -} - -QDirectFBPaintEngine::~QDirectFBPaintEngine() -{ -} - -bool QDirectFBPaintEngine::begin(QPaintDevice *device) -{ - Q_D(QDirectFBPaintEngine); - if (device->devType() == QInternal::CustomRaster) { - d->dfbDevice = static_cast(device); - } else if (device->devType() == QInternal::Pixmap) { - QPixmapData *data = static_cast(device)->pixmapData(); - Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData *dfbPixmapData = static_cast(data); - QDirectFBPaintEnginePrivate::unlock(dfbPixmapData); - d->dfbDevice = static_cast(dfbPixmapData); - } - - if (d->dfbDevice) - d->surface = d->dfbDevice->directFBSurface(); - - if (!d->surface) { - qFatal("QDirectFBPaintEngine used on an invalid device: 0x%x", - device->devType()); - } - d->isPremultiplied = QDirectFBScreen::isPremultiplied(d->dfbDevice->format()); - - d->prepare(d->dfbDevice); - gccaps = AllFeatures; - d->setCompositionMode(state()->composition_mode); - - return QRasterPaintEngine::begin(device); -} - -bool QDirectFBPaintEngine::end() -{ - Q_D(QDirectFBPaintEngine); - d->unlock(); - d->dfbDevice = 0; -#if (Q_DIRECTFB_VERSION >= 0x010000) - d->surface->ReleaseSource(d->surface); -#endif - d->currentClip = QRect(); - d->surface->SetClip(d->surface, NULL); - d->surface = 0; - return QRasterPaintEngine::end(); -} - -void QDirectFBPaintEngine::clipEnabledChanged() -{ - Q_D(QDirectFBPaintEngine); - QRasterPaintEngine::clipEnabledChanged(); - d->updateClip(); -} - -void QDirectFBPaintEngine::penChanged() -{ - Q_D(QDirectFBPaintEngine); - d->setPen(state()->pen); - - QRasterPaintEngine::penChanged(); -} - -void QDirectFBPaintEngine::opacityChanged() -{ - Q_D(QDirectFBPaintEngine); - d->opacity = quint8(state()->opacity * 255); - QRasterPaintEngine::opacityChanged(); -} - -void QDirectFBPaintEngine::compositionModeChanged() -{ - Q_D(QDirectFBPaintEngine); - d->setCompositionMode(state()->compositionMode()); - QRasterPaintEngine::compositionModeChanged(); -} - -void QDirectFBPaintEngine::renderHintsChanged() -{ - Q_D(QDirectFBPaintEngine); - d->setRenderHints(state()->renderHints); - QRasterPaintEngine::renderHintsChanged(); -} - -void QDirectFBPaintEngine::transformChanged() -{ - Q_D(QDirectFBPaintEngine); - d->setTransform(state()->matrix); - QRasterPaintEngine::transformChanged(); -} - -void QDirectFBPaintEngine::setState(QPainterState *state) -{ - Q_D(QDirectFBPaintEngine); - QRasterPaintEngine::setState(state); - d->setPen(state->pen); - d->opacity = quint8(state->opacity * 255); - d->setCompositionMode(state->compositionMode()); - d->setTransform(state->transform()); - d->setRenderHints(state->renderHints); - if (d->surface) - d->updateClip(); -} - -void QDirectFBPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) -{ - Q_D(QDirectFBPaintEngine); - const bool wasInClip = d->inClip; - d->inClip = true; - QRasterPaintEngine::clip(path, op); - if (!wasInClip) { - d->inClip = false; - d->updateClip(); - } -} - -void QDirectFBPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) -{ - Q_D(QDirectFBPaintEngine); - const bool wasInClip = d->inClip; - d->inClip = true; - QRasterPaintEngine::clip(region, op); - if (!wasInClip) { - d->inClip = false; - d->updateClip(); - } -} - -void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) -{ - Q_D(QDirectFBPaintEngine); - const bool wasInClip = d->inClip; - d->inClip = true; - QRasterPaintEngine::clip(rect, op); - if (!wasInClip) { - d->inClip = false; - d->updateClip(); - } -} - -void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) -{ - Q_D(QDirectFBPaintEngine); - const QPen &pen = state()->pen; - const QBrush &brush = state()->brush; - if (brush.style() == Qt::NoBrush && pen.style() == Qt::NoPen) - return; - - if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) - || !d->simplePen - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !d->isSimpleBrush(brush) - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { - RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); - d->lock(); - QRasterPaintEngine::drawRects(rects, rectCount); - return; - } - - if (brush.style() != Qt::NoBrush) { - d->setDFBColor(brush.color()); - CLIPPED_PAINT(QT_PREPEND_NAMESPACE(fillRects)(rects, rectCount, state()->matrix, d->surface)); - } - - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); - CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects)(rects, rectCount, state()->matrix, d->surface)); - } -} - -void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) -{ - Q_D(QDirectFBPaintEngine); - const QPen &pen = state()->pen; - const QBrush &brush = state()->brush; - if (brush.style() == Qt::NoBrush && pen.style() == Qt::NoPen) - return; - - if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) - || !d->simplePen - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !d->isSimpleBrush(brush) - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { - RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); - d->lock(); - QRasterPaintEngine::drawRects(rects, rectCount); - return; - } - - if (brush.style() != Qt::NoBrush) { - d->setDFBColor(brush.color()); - CLIPPED_PAINT(fillRects(rects, rectCount, state()->matrix, d->surface)); - } - - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); - CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects)(rects, rectCount, state()->matrix, d->surface)); - } -} - -void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) -{ - Q_D(QDirectFBPaintEngine); - - const QPen &pen = state()->pen; - if (!d->simplePen - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { - RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); - d->lock(); - QRasterPaintEngine::drawLines(lines, lineCount); - return; - } - - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); - CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines)(lines, lineCount, state()->matrix, d->surface)); - } -} - -void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) -{ - Q_D(QDirectFBPaintEngine); - - const QPen &pen = state()->pen; - if (!d->simplePen - || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { - RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); - d->lock(); - QRasterPaintEngine::drawLines(lines, lineCount); - return; - } - - if (pen.style() != Qt::NoPen) { - d->setDFBColor(pen.color()); - CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines)(lines, lineCount, state()->matrix, d->surface)); - } -} - -void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, - const QRectF &sr, - Qt::ImageConversionFlags flags) -{ - Q_D(QDirectFBPaintEngine); - Q_UNUSED(flags); - - /* This is hard to read. The way it works is like this: - - - If you do not have support for preallocated surfaces and do not use an - image cache we always fall back to raster engine. - - - If it's rotated/sheared/mirrored (negative scale) or we can't - clip it we fall back to raster engine. - - - If we don't cache the image, but we do have support for - preallocated surfaces we fall back to the raster engine if the - image is in a format DirectFB can't handle. - - - If we do cache the image but don't have support for preallocated - images and the cost of caching the image (bytes used) is higher - than the max image cache size we fall back to raster engine. - */ - -#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) - || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) - || (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size()) -#ifndef QT_DIRECTFB_IMAGECACHE - || (QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN) -#elif defined QT_NO_DIRECTFB_PREALLOCATED - || (QDirectFBPaintEnginePrivate::cacheCost(image) > imageCache.maxCost()) -#endif - ) -#endif - { - RASTERFALLBACK(DRAW_IMAGE, r, image.size(), sr); - d->lock(); - QRasterPaintEngine::drawImage(r, image, sr, flags); - return; - } -#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE - bool release; - IDirectFBSurface *imgSurface = d->getSurface(image, &release); - uint blitFlags = 0; - if (image.hasAlphaChannel()) - blitFlags |= QDirectFBPaintEnginePrivate::HasAlpha; - if (QDirectFBScreen::isPremultiplied(image.format())) - blitFlags |= QDirectFBPaintEnginePrivate::Premultiplied; - d->prepareForBlit(blitFlags); - CLIPPED_PAINT(d->blit(r, imgSurface, sr)); - if (release) { -#if (Q_DIRECTFB_VERSION >= 0x010000) - d->surface->ReleaseSource(d->surface); -#endif - imgSurface->Release(imgSurface); - } -#endif -} - -void QDirectFBPaintEngine::drawImage(const QPointF &p, const QImage &img) -{ - drawImage(QRectF(p, img.size()), img, img.rect()); -} - -void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, - const QRectF &sr) -{ - Q_D(QDirectFBPaintEngine); - - if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) { - RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); - d->lock(); - QRasterPaintEngine::drawPixmap(r, pixmap, sr); - } else { - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData *dfbData = static_cast(data); - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) - || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) - || (!d->supportsStretchBlit() && state()->matrix.mapRect(r).size() != sr.size())) { - RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); - const QImage *img = dfbData->buffer(); - d->lock(); - QRasterPaintEngine::drawImage(r, *img, sr); - } else { - QDirectFBPaintEnginePrivate::unlock(dfbData); - IDirectFBSurface *s = dfbData->directFBSurface(); - uint blitFlags = 0; - if (pixmap.hasAlphaChannel()) - blitFlags |= QDirectFBPaintEnginePrivate::HasAlpha; - if (QDirectFBScreen::isPremultiplied(dfbData->pixelFormat())) - blitFlags |= QDirectFBPaintEnginePrivate::Premultiplied; - - d->prepareForBlit(blitFlags); - CLIPPED_PAINT(d->blit(r, s, sr)); - } - } -} - -void QDirectFBPaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) -{ - drawPixmap(QRectF(p, pm.size()), pm, pm.rect()); -} - -void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, - const QPixmap &pixmap, - const QPointF &offset) -{ - Q_D(QDirectFBPaintEngine); - if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) { - RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); - d->lock(); - QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset); - } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) - || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) - || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) - || (!d->supportsStretchBlit() && state()->matrix.isScaling())) { - RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset); - QPixmapData *pixmapData = pixmap.pixmapData(); - Q_ASSERT(pixmapData->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData *dfbData = static_cast(pixmapData); - const QImage *img = dfbData->buffer(); - d->lock(); - QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType); - data->fromImage(*img, Qt::AutoColor); - const QPixmap pix(data); - QRasterPaintEngine::drawTiledPixmap(r, pix, offset); - } else { - QTransform transform(state()->matrix); - CLIPPED_PAINT(d->drawTiledPixmap(r, pixmap, offset, transform)); - } -} - - -void QDirectFBPaintEngine::stroke(const QVectorPath &path, const QPen &pen) -{ - RASTERFALLBACK(STROKE_PATH, path, VOID_ARG(), VOID_ARG()); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::stroke(path, pen); -} - -void QDirectFBPaintEngine::drawPath(const QPainterPath &path) -{ - RASTERFALLBACK(DRAW_PATH, path, VOID_ARG(), VOID_ARG()); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawPath(path); -} - -void QDirectFBPaintEngine::drawPoints(const QPointF *points, int pointCount) -{ - RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawPoints(points, pointCount); -} - -void QDirectFBPaintEngine::drawPoints(const QPoint *points, int pointCount) -{ - RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawPoints(points, pointCount); -} - -void QDirectFBPaintEngine::drawEllipse(const QRectF &rect) -{ - RASTERFALLBACK(DRAW_ELLIPSE, rect, VOID_ARG(), VOID_ARG()); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawEllipse(rect); -} - -void QDirectFBPaintEngine::drawPolygon(const QPointF *points, int pointCount, - PolygonDrawMode mode) -{ - RASTERFALLBACK(DRAW_POLYGON, pointCount, mode, VOID_ARG()); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawPolygon(points, pointCount, mode); -} - -void QDirectFBPaintEngine::drawPolygon(const QPoint *points, int pointCount, - PolygonDrawMode mode) -{ - RASTERFALLBACK(DRAW_POLYGON, pointCount, mode, VOID_ARG()); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawPolygon(points, pointCount, mode); -} - -void QDirectFBPaintEngine::drawTextItem(const QPointF &p, - const QTextItem &textItem) -{ - RASTERFALLBACK(DRAW_TEXT, p, textItem.text(), VOID_ARG()); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawTextItem(p, textItem); -} - -void QDirectFBPaintEngine::fill(const QVectorPath &path, const QBrush &brush) -{ - if (brush.style() == Qt::NoBrush) - return; - RASTERFALLBACK(FILL_PATH, path, brush, VOID_ARG()); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::fill(path, brush); -} - -void QDirectFBPaintEngine::drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode) -{ - RASTERFALLBACK(DRAW_ROUNDED_RECT, rect, xrad, yrad); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawRoundedRect(rect, xrad, yrad, mode); -} - -void QDirectFBPaintEngine::drawStaticTextItem(QStaticTextItem *item) -{ - RASTERFALLBACK(DRAW_STATICTEXT, item, VOID_ARG(), VOID_ARG()); - Q_D(QDirectFBPaintEngine); - d->lock(); - QRasterPaintEngine::drawStaticTextItem(item); -} - -void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) -{ - Q_D(QDirectFBPaintEngine); - if (brush.style() == Qt::NoBrush) - return; - if (d->clipType != QDirectFBPaintEnginePrivate::ComplexClip) { - switch (brush.style()) { - case Qt::SolidPattern: { - const QColor color = brush.color(); - if (!color.isValid()) - return; - - if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { - break; - } - d->setDFBColor(color); - const QRect r = state()->matrix.mapRect(rect).toRect(); - CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); - return; } - - case Qt::TexturePattern: { - const QPointF &brushOrigin = state()->brushOrigin; - const QTransform stateTransform = state()->matrix; - QTransform transform(stateTransform); - transform.translate(brushOrigin.x(), brushOrigin.y()); - transform = brush.transform() * transform; - if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported) - || (QDirectFBPaintEnginePrivate::getTransformationType(transform) & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported) - || (!d->supportsStretchBlit() && transform.isScaling())) { - break; - } - - const QPixmap texture = brush.texture(); - if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass) - break; - - CLIPPED_PAINT(d->drawTiledPixmap(stateTransform.mapRect(rect), texture, rect.topLeft() - brushOrigin, transform)); - return; } - default: - break; - } - } - RASTERFALLBACK(FILL_RECT, rect, brush, VOID_ARG()); - d->lock(); - QRasterPaintEngine::fillRect(rect, brush); -} - -void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) -{ - if (!color.isValid()) - return; - Q_D(QDirectFBPaintEngine); - if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported) - || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) - || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { - RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG()); - d->lock(); - QRasterPaintEngine::fillRect(rect, color); - } else { - d->setDFBColor(color); - const QRect r = state()->matrix.mapRect(rect).toRect(); - CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); - } -} - -void QDirectFBPaintEngine::drawBufferSpan(const uint *buffer, int bufsize, - int x, int y, int length, - uint const_alpha) -{ - Q_D(QDirectFBPaintEngine); - IDirectFBSurface *src = d->surfaceCache->getSurface(buffer, bufsize); - // ### how does this play with setDFBColor - src->SetColor(src, 0, 0, 0, const_alpha); - const DFBRectangle rect = { 0, 0, length, 1 }; - d->surface->Blit(d->surface, src, &rect, x, y); -} - -#ifdef QT_DIRECTFB_IMAGECACHE -static void cachedImageCleanupHook(qint64 key) -{ - delete imageCache.take(key); -} -void QDirectFBPaintEngine::initImageCache(int size) -{ - Q_ASSERT(size >= 0); - imageCache.setMaxCost(size); - QImagePixmapCleanupHooks::instance()->addImageHook(cachedImageCleanupHook); -} - -#endif // QT_DIRECTFB_IMAGECACHE - -// ---- QDirectFBPaintEnginePrivate ---- - - -QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p) - : surface(0), antialiased(false), simplePen(false), - transformationType(0), opacity(255), - clipType(ClipUnset), dfbDevice(0), - compositionModeStatus(0), isPremultiplied(false), inClip(false), q(p) -{ - fb = QDirectFBScreen::instance()->dfb(); - surfaceCache = new SurfaceCache; -} - -QDirectFBPaintEnginePrivate::~QDirectFBPaintEnginePrivate() -{ - delete surfaceCache; -} - -bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const -{ - return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased); -} - -void QDirectFBPaintEnginePrivate::lock() -{ - // We will potentially get a new pointer to the buffer after a - // lock so we need to call the base implementation of prepare so - // it updates its rasterBuffer to point to the new buffer address. - Q_ASSERT(dfbDevice); - if (dfbDevice->lockSurface(DSLF_READ|DSLF_WRITE)) { - prepare(dfbDevice); - } -} - -void QDirectFBPaintEnginePrivate::unlock() -{ - Q_ASSERT(dfbDevice); -#ifdef QT_DIRECTFB_SUBSURFACE - dfbDevice->syncPending = true; -#else - QDirectFBPaintEnginePrivate::unlock(dfbDevice); -#endif -} - -void QDirectFBPaintEnginePrivate::unlock(QDirectFBPaintDevice *device) -{ -#ifdef QT_NO_DIRECTFB_SUBSURFACE - Q_ASSERT(device); - device->unlockSurface(); -#else - Q_UNUSED(device); -#endif -} - -void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform) -{ - transformationType = getTransformationType(transform); - setPen(q->state()->pen); -} - -void QDirectFBPaintEnginePrivate::setPen(const QPen &pen) -{ - if (pen.style() == Qt::NoPen) { - simplePen = true; - } else if (pen.style() == Qt::SolidLine - && !antialiased - && pen.brush().style() == Qt::SolidPattern - && pen.widthF() <= 1.0 - && (transformationType < QTransform::TxScale || pen.isCosmetic())) { - simplePen = true; - } else { - simplePen = false; - } -} - -void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode) -{ - if (!surface) - return; - - static const bool forceRasterFallBack = qgetenv("QT_DIRECTFB_FORCE_RASTER").toInt() > 0; - if (forceRasterFallBack) { - compositionModeStatus = PorterDuff_None; - return; - } - - compositionModeStatus = PorterDuff_Supported|PorterDuff_PremultiplyColors|PorterDuff_AlwaysBlend; - switch (mode) { - case QPainter::CompositionMode_Clear: - surface->SetPorterDuff(surface, DSPD_CLEAR); - break; - case QPainter::CompositionMode_Source: - surface->SetPorterDuff(surface, DSPD_SRC); - compositionModeStatus &= ~PorterDuff_AlwaysBlend; - if (!isPremultiplied) - compositionModeStatus &= ~PorterDuff_PremultiplyColors; - break; - case QPainter::CompositionMode_SourceOver: - compositionModeStatus &= ~PorterDuff_AlwaysBlend; - surface->SetPorterDuff(surface, DSPD_SRC_OVER); - break; - case QPainter::CompositionMode_DestinationOver: - surface->SetPorterDuff(surface, DSPD_DST_OVER); - break; - case QPainter::CompositionMode_SourceIn: - surface->SetPorterDuff(surface, DSPD_SRC_IN); - if (!isPremultiplied) - compositionModeStatus &= ~PorterDuff_PremultiplyColors; - break; - case QPainter::CompositionMode_DestinationIn: - surface->SetPorterDuff(surface, DSPD_DST_IN); - break; - case QPainter::CompositionMode_SourceOut: - surface->SetPorterDuff(surface, DSPD_SRC_OUT); - break; - case QPainter::CompositionMode_DestinationOut: - surface->SetPorterDuff(surface, DSPD_DST_OUT); - break; - case QPainter::CompositionMode_Destination: - surface->SetSrcBlendFunction(surface, DSBF_ZERO); - surface->SetDstBlendFunction(surface, DSBF_ONE); - break; -#if (Q_DIRECTFB_VERSION >= 0x010000) - case QPainter::CompositionMode_SourceAtop: - surface->SetPorterDuff(surface, DSPD_SRC_ATOP); - break; - case QPainter::CompositionMode_DestinationAtop: - surface->SetPorterDuff(surface, DSPD_DST_ATOP); - break; - case QPainter::CompositionMode_Plus: - surface->SetPorterDuff(surface, DSPD_ADD); - break; - case QPainter::CompositionMode_Xor: - surface->SetPorterDuff(surface, DSPD_XOR); - break; -#endif - default: - compositionModeStatus = PorterDuff_None; - break; - } -} - -void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) -{ - const bool old = antialiased; - antialiased = bool(hints & QPainter::Antialiasing); - if (old != antialiased) { - setPen(q->state()->pen); - } -} - -void QDirectFBPaintEnginePrivate::prepareForBlit(uint flags) -{ - DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; - if (flags & Premultiplied) - blittingFlags |= DSBLIT_SRC_PREMULTIPLY; - if (flags & HasAlpha) - blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL; - if (opacity != 255) { - blittingFlags |= DSBLIT_BLEND_COLORALPHA; - surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); - } - - surface->SetBlittingFlags(surface, blittingFlags); -} - -static inline uint ALPHA_MUL(uint x, uint a) -{ - uint t = x * a; - t = ((t + (t >> 8) + 0x80) >> 8) & 0xff; - return t; -} - -void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) -{ - Q_ASSERT(surface); - Q_ASSERT(compositionModeStatus & PorterDuff_Supported); - const quint8 alpha = (opacity == 255 ? - color.alpha() : ALPHA_MUL(color.alpha(), opacity)); - QColor col; - if (compositionModeStatus & PorterDuff_PremultiplyColors) { - col = QColor(ALPHA_MUL(color.red(), alpha), - ALPHA_MUL(color.green(), alpha), - ALPHA_MUL(color.blue(), alpha), - alpha); - } else { - col = QColor(color.red(), color.green(), color.blue(), alpha); - } - surface->SetColor(surface, col.red(), col.green(), col.blue(), col.alpha()); - surface->SetDrawingFlags(surface, alpha == 255 && !(compositionModeStatus & PorterDuff_AlwaysBlend) ? DSDRAW_NOFX : DSDRAW_BLEND); -} - -IDirectFBSurface *QDirectFBPaintEnginePrivate::getSurface(const QImage &img, bool *release) -{ -#ifdef QT_NO_DIRECTFB_IMAGECACHE - *release = true; - return QDirectFBScreen::instance()->createDFBSurface(img, img.format(), QDirectFBScreen::DontTrackSurface); -#else - const qint64 key = img.cacheKey(); - *release = false; - if (imageCache.contains(key)) { - return imageCache[key]->surface; - } - - const int cost = cacheCost(img); - const bool cache = cost <= imageCache.maxCost(); - QDirectFBScreen *screen = QDirectFBScreen::instance(); - const QImage::Format format = (img.format() == screen->alphaPixmapFormat() || QDirectFBPixmapData::hasAlphaChannel(img) - ? screen->alphaPixmapFormat() : screen->pixelFormat()); - - IDirectFBSurface *surface = screen->createDFBSurface(img, format, - cache - ? QDirectFBScreen::TrackSurface - : QDirectFBScreen::DontTrackSurface); - if (cache) { - CachedImage *cachedImage = new CachedImage; - const_cast(img).data_ptr()->is_cached = true; - cachedImage->surface = surface; - imageCache.insert(key, cachedImage, cost); - } else { - *release = true; - } - return surface; -#endif -} - - -void QDirectFBPaintEnginePrivate::blit(const QRectF &dest, IDirectFBSurface *s, const QRectF &src) -{ - const QRect sr = src.toRect(); - const QRect dr = q->state()->matrix.mapRect(dest).toRect(); - if (dr.isEmpty()) - return; - const DFBRectangle sRect = { sr.x(), sr.y(), sr.width(), sr.height() }; - DFBResult result; - - if (dr.size() == sr.size()) { - result = surface->Blit(surface, s, &sRect, dr.x(), dr.y()); - } else { - Q_ASSERT(supportsStretchBlit()); - const DFBRectangle dRect = { dr.x(), dr.y(), dr.width(), dr.height() }; - result = surface->StretchBlit(surface, s, &sRect, &dRect); - } - if (result != DFB_OK) - DirectFBError("QDirectFBPaintEngine::drawPixmap()", result); -} - -static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset) -{ - qreal pos = rect_pos - offset; - while (pos > rect_pos) - pos -= pixmapSize; - while (pos + pixmapSize < rect_pos) - pos += pixmapSize; - return pos; -} - -void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, - const QPointF &off, const QTransform &pixmapTransform) -{ - const QTransform &transform = q->state()->matrix; - Q_ASSERT(!(getTransformationType(transform) & Matrix_BlitsUnsupported) && - !(getTransformationType(pixmapTransform) & Matrix_BlitsUnsupported)); - const QRect destinationRect = transform.mapRect(dest).toRect().normalized(); - QRect newClip = destinationRect; - if (!currentClip.isEmpty()) - newClip &= currentClip; - - if (newClip.isNull()) - return; - - const DFBRegion clip = { - newClip.x(), - newClip.y(), - newClip.right(), - newClip.bottom() - }; - surface->SetClip(surface, &clip); - - QPointF offset = pixmapTransform.inverted().map(off); - Q_ASSERT(transform.type() <= QTransform::TxScale); - QPixmapData *data = pixmap.pixmapData(); - Q_ASSERT(data->classId() == QPixmapData::DirectFBClass); - QDirectFBPixmapData *dfbData = static_cast(data); - IDirectFBSurface *sourceSurface = dfbData->directFBSurface(); - uint blitFlags = 0; - if (dfbData->hasAlphaChannel()) - blitFlags |= HasAlpha; - if (QDirectFBScreen::isPremultiplied(dfbData->pixelFormat())) - blitFlags |= Premultiplied; - prepareForBlit(blitFlags); - QDirectFBPaintEnginePrivate::unlock(dfbData); - const QSize pixmapSize = dfbData->size(); - if (transform.isScaling() || pixmapTransform.isScaling()) { - Q_ASSERT(supportsStretchBlit()); - Q_ASSERT(qMin(transform.m11(), transform.m22()) >= 0); - offset.rx() *= transform.m11(); - offset.ry() *= transform.m22(); - - const QSizeF mappedSize(pixmapSize.width() * pixmapTransform.m11(), pixmapSize.height() * pixmapTransform.m22()); - qreal y = fixCoord(destinationRect.y(), mappedSize.height(), offset.y()); - const qreal startX = fixCoord(destinationRect.x(), mappedSize.width(), offset.x()); - while (y <= destinationRect.bottom()) { - qreal x = startX; - while (x <= destinationRect.right()) { - const DFBRectangle destination = { qRound(x), qRound(y), mappedSize.width(), mappedSize.height() }; - surface->StretchBlit(surface, sourceSurface, 0, &destination); - x += mappedSize.width(); - } - y += mappedSize.height(); - } - } else { - qreal y = fixCoord(destinationRect.y(), pixmapSize.height(), offset.y()); - const qreal startX = fixCoord(destinationRect.x(), pixmapSize.width(), offset.x()); - int horizontal = qMax(1, destinationRect.width() / pixmapSize.width()) + 1; - if (startX != destinationRect.x()) - ++horizontal; - int vertical = qMax(1, destinationRect.height() / pixmapSize.height()) + 1; - if (y != destinationRect.y()) - ++vertical; - - const int maxCount = (vertical * horizontal); - QVarLengthArray sourceRects(maxCount); - QVarLengthArray points(maxCount); - - int i = 0; - while (y <= destinationRect.bottom()) { - Q_ASSERT(i < maxCount); - qreal x = startX; - while (x <= destinationRect.right()) { - points[i].x = qRound(x); - points[i].y = qRound(y); - sourceRects[i].x = 0; - sourceRects[i].y = 0; - sourceRects[i].w = int(pixmapSize.width()); - sourceRects[i].h = int(pixmapSize.height()); - x += pixmapSize.width(); - ++i; - } - y += pixmapSize.height(); - } - surface->BatchBlit(surface, sourceSurface, sourceRects.constData(), points.constData(), i); - } - - if (currentClip.isEmpty()) { - surface->SetClip(surface, 0); - } else { - const DFBRegion clip = { - currentClip.x(), - currentClip.y(), - currentClip.right(), - currentClip.bottom() - }; - surface->SetClip(surface, &clip); - } -} - -void QDirectFBPaintEnginePrivate::updateClip() -{ - Q_ASSERT(surface); - currentClip = QRect(); - const QClipData *clipData = clip(); - if (!clipData || !clipData->enabled) { - surface->SetClip(surface, NULL); - clipType = NoClip; - } else if (clipData->hasRectClip) { - const DFBRegion r = { - clipData->clipRect.x(), - clipData->clipRect.y(), - clipData->clipRect.right(), - clipData->clipRect.bottom() - }; - surface->SetClip(surface, &r); - currentClip = clipData->clipRect.normalized(); - // ### is this guaranteed to always be normalized? - clipType = RectClip; - } else if (clipData->hasRegionClip) { - clipType = RegionClip; - } else { - clipType = ComplexClip; - } -} - -bool QDirectFBPaintEnginePrivate::supportsStretchBlit() const -{ -#ifdef QT_DIRECTFB_STRETCHBLIT - return !(q->state()->renderHints & QPainter::SmoothPixmapTransform); -#else - return false; -#endif -} - - -void QDirectFBPaintEnginePrivate::systemStateChanged() -{ - QRasterPaintEnginePrivate::systemStateChanged(); - updateClip(); -} - -IDirectFBSurface *SurfaceCache::getSurface(const uint *buf, int size) -{ - if (buffer == buf && bufsize == size) - return surface; - - clear(); - - const DFBSurfaceDescription description = QDirectFBScreen::getSurfaceDescription(buf, size); - surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface, 0); - if (!surface) - qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface"); - - buffer = const_cast(buf); - bufsize = size; - - return surface; -} - -void SurfaceCache::clear() -{ - if (surface && QDirectFBScreen::instance()) - QDirectFBScreen::instance()->releaseDFBSurface(surface); - surface = 0; - buffer = 0; - bufsize = 0; -} - - -static inline QRect mapRect(const QTransform &transform, const QRect &rect) { return transform.mapRect(rect); } -static inline QRect mapRect(const QTransform &transform, const QRectF &rect) { return transform.mapRect(rect).toRect(); } -static inline QLine map(const QTransform &transform, const QLine &line) { return transform.map(line); } -static inline QLine map(const QTransform &transform, const QLineF &line) { return transform.map(line).toLine(); } -template -static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface) -{ - if (n == 1) { - const QLine l = map(transform, lines[0]); - surface->DrawLine(surface, l.x1(), l.y1(), l.x2(), l.y2()); - } else { - QVarLengthArray lineArray(n); - for (int i=0; iDrawLines(surface, lineArray.constData(), n); - } -} - -template -static inline void fillRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface) -{ - if (n == 1) { - const QRect r = mapRect(transform, rects[0]); - surface->FillRectangle(surface, r.x(), r.y(), r.width(), r.height()); - } else { - QVarLengthArray rectArray(n); - for (int i=0; iFillRectangles(surface, rectArray.constData(), n); - } -} - -template -static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface) -{ - for (int i=0; iDrawRectangle(surface, r.x(), r.y(), r.width(), r.height()); - } -} - -template inline const T *ptr(const T &t) { return &t; } -template <> inline const bool* ptr(const bool &) { return 0; } -template -static void rasterFallbackWarn(const char *msg, const char *func, const device *dev, - uint transformationType, bool simplePen, - uint clipType, uint compositionModeStatus, - const char *nameOne, const T1 &one, - const char *nameTwo, const T2 &two, - const char *nameThree, const T3 &three) -{ - QString out; - QDebug dbg(&out); - dbg << msg << (QByteArray(func) + "()") << "painting on"; - if (dev->devType() == QInternal::Widget) { - dbg << static_cast(dev); - } else { - dbg << dev << "of type" << dev->devType(); - } - - dbg << QString::fromLatin1("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0')) - << "simplePen" << simplePen - << "clipType" << clipType - << "compositionModeStatus" << compositionModeStatus; - - const T1 *t1 = ptr(one); - const T2 *t2 = ptr(two); - const T3 *t3 = ptr(three); - - if (t1) { - dbg << nameOne << *t1; - if (t2) { - dbg << nameTwo << *t2; - if (t3) { - dbg << nameThree << *t3; - } - } - } - qWarning("%s", qPrintable(out)); -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h deleted file mode 100644 index a3217d0f323..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPAINTENGINE_DIRECTFB_P_H -#define QPAINTENGINE_DIRECTFB_P_H - -#include -#include - -#ifndef QT_NO_QWS_DIRECTFB - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QDirectFBPaintEnginePrivate; - -class QDirectFBPaintEngine : public QRasterPaintEngine -{ - Q_DECLARE_PRIVATE(QDirectFBPaintEngine) -public: - QDirectFBPaintEngine(QPaintDevice *device); - virtual ~QDirectFBPaintEngine(); - - virtual bool begin(QPaintDevice *device); - virtual bool end(); - - virtual void drawRects(const QRect *rects, int rectCount); - virtual void drawRects(const QRectF *rects, int rectCount); - - virtual void fillRect(const QRectF &r, const QBrush &brush); - virtual void fillRect(const QRectF &r, const QColor &color); - - virtual void drawLines(const QLine *line, int lineCount); - virtual void drawLines(const QLineF *line, int lineCount); - - virtual void drawImage(const QPointF &p, const QImage &img); - virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags falgs = Qt::AutoColor); - - virtual void drawPixmap(const QPointF &p, const QPixmap &pm); - virtual void drawPixmap(const QRectF &r, const QPixmap &pixmap, const QRectF &sr); - virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr); - - virtual void drawBufferSpan(const uint *buffer, int bufsize, - int x, int y, int length, uint const_alpha); - - virtual void stroke(const QVectorPath &path, const QPen &pen); - virtual void drawPath(const QPainterPath &path); - virtual void drawPoints(const QPointF *points, int pointCount); - virtual void drawPoints(const QPoint *points, int pointCount); - virtual void drawEllipse(const QRectF &rect); - virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode); - virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode); - virtual void drawTextItem(const QPointF &p, const QTextItem &textItem); - virtual void fill(const QVectorPath &path, const QBrush &brush); - virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode); - - virtual void clipEnabledChanged(); - virtual void penChanged(); - virtual void opacityChanged(); - virtual void compositionModeChanged(); - virtual void renderHintsChanged(); - virtual void transformChanged(); - - virtual void setState(QPainterState *state); - - virtual void clip(const QVectorPath &path, Qt::ClipOperation op); - virtual void clip(const QRegion ®ion, Qt::ClipOperation op); - virtual void clip(const QRect &rect, Qt::ClipOperation op); - - virtual void drawStaticTextItem(QStaticTextItem *item); - - static void initImageCache(int size); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_QWS_DIRECTFB - -#endif // QPAINTENGINE_DIRECTFB_P_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp deleted file mode 100644 index 5259a936987..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ /dev/null @@ -1,588 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectfbpixmap.h" - -#ifndef QT_NO_QWS_DIRECTFB - -#include "qdirectfbscreen.h" -#include "qdirectfbpaintengine.h" - -#include -#include -#include - - -QT_BEGIN_NAMESPACE - -static int global_ser_no = 0; - -QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType) - : QPixmapData(pixelType, DirectFBClass), QDirectFBPaintDevice(screen), - alpha(false) -{ - setSerialNumber(0); -} - -QDirectFBPixmapData::~QDirectFBPixmapData() -{ -} - -void QDirectFBPixmapData::resize(int width, int height) -{ - if (width <= 0 || height <= 0) { - invalidate(); - return; - } - - imageFormat = screen->pixelFormat(); - dfbSurface = screen->createDFBSurface(QSize(width, height), - imageFormat, - QDirectFBScreen::TrackSurface); - d = QDirectFBScreen::depth(imageFormat); - alpha = false; - if (!dfbSurface) { - invalidate(); - qWarning("QDirectFBPixmapData::resize(): Unable to allocate surface"); - return; - } - - w = width; - h = height; - is_null = (w <= 0 || h <= 0); - setSerialNumber(++global_ser_no); -} - -#ifdef QT_DIRECTFB_OPAQUE_DETECTION -// mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels) -static bool checkForAlphaPixels(const QImage &img) -{ - const uchar *bits = img.bits(); - const int bytes_per_line = img.bytesPerLine(); - const uchar *end_bits = bits + bytes_per_line; - const int width = img.width(); - const int height = img.height(); - switch (img.format()) { - case QImage::Format_Indexed8: - return img.hasAlphaChannel(); - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - for (int y=0; y(data.constData()), data.size(), format, flags); - } else { - DFBDataBufferDescription description; - description.flags = DBDESC_FILE; - const QByteArray fileNameData = filename.toLocal8Bit(); - description.file = fileNameData.constData(); - if (fromDataBufferDescription(description)) { - return true; - } - // fall back to Qt - } - } - return QPixmapData::fromFile(filename, format, flags); -} - -bool QDirectFBPixmapData::fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags) -{ - if (flags == Qt::AutoColor) { - DFBDataBufferDescription description; - description.flags = DBDESC_MEMORY; - description.memory.data = buffer; - description.memory.length = len; - if (fromDataBufferDescription(description)) - return true; - // fall back to Qt - } - return QPixmapData::fromData(buffer, len, format, flags); -} - -template struct QDirectFBInterfaceCleanupHandler -{ - static void cleanup(T *t) { if (t) t->Release(t); } -}; - -template -class QDirectFBPointer : public QScopedPointer > -{ -public: - QDirectFBPointer(T *t = 0) - : QScopedPointer >(t) - {} -}; - -bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescription &dataBufferDescription) -{ - IDirectFB *dfb = screen->dfb(); - Q_ASSERT(dfb); - DFBResult result = DFB_OK; - IDirectFBDataBuffer *dataBufferPtr; - if ((result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, &dataBufferPtr)) != DFB_OK) { - DirectFBError("QDirectFBPixmapData::fromDataBufferDescription()", result); - return false; - } - QDirectFBPointer dataBuffer(dataBufferPtr); - - IDirectFBImageProvider *providerPtr; - if ((result = dataBuffer->CreateImageProvider(dataBuffer.data(), &providerPtr)) != DFB_OK) - return false; - - QDirectFBPointer provider(providerPtr); - - DFBImageDescription imageDescription; - result = provider->GetImageDescription(provider.data(), &imageDescription); - if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't get image description", result); - return false; - } - - if (imageDescription.caps & DICAPS_COLORKEY) { - return false; - } - - DFBSurfaceDescription surfaceDescription; - if ((result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription)) != DFB_OK) { - DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result); - return false; - } - - alpha = imageDescription.caps & DICAPS_ALPHACHANNEL; - imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); - - dfbSurface = screen->createDFBSurface(QSize(surfaceDescription.width, surfaceDescription.height), - imageFormat, QDirectFBScreen::TrackSurface); - - result = provider->RenderTo(provider.data(), dfbSurface, 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result); - return false; - } - - w = surfaceDescription.width; - h = surfaceDescription.height; - is_null = (w <= 0 || h <= 0); - d = QDirectFBScreen::depth(imageFormat); - setSerialNumber(++global_ser_no); - -#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE - screen->setDirectFBImageProvider(providerPtr); - provider.take(); -#endif - - return true; -} - -#endif - -void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) -{ - alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags); - imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); - - QImage image; - if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) { - image = img.convertToFormat(imageFormat, flags); - flags = Qt::AutoColor; - } else if (img.format() == QImage::Format_RGB32 || img.depth() == 1) { - image = img.convertToFormat(imageFormat, flags); - } else if (img.format() != imageFormat) { - image = img.convertToFormat(imageFormat, flags); - } else { - image = img; - } - - dfbSurface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::NoPreallocated | QDirectFBScreen::TrackSurface); - if (!dfbSurface) { - qWarning("QDirectFBPixmapData::fromImage()"); - invalidate(); - return; - } - - w = image.width(); - h = image.height(); - is_null = (w <= 0 || h <= 0); - d = QDirectFBScreen::depth(imageFormat); - setSerialNumber(++global_ser_no); -#ifdef QT_NO_DIRECTFB_OPAQUE_DETECTION - Q_UNUSED(flags); -#endif -} - -void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect) -{ - if (data->classId() != DirectFBClass) { - QPixmapData::copy(data, rect); - return; - } - - const QDirectFBPixmapData *otherData = static_cast(data); -#ifdef QT_NO_DIRECTFB_SUBSURFACE - if (otherData->lockFlags()) { - const_cast(otherData)->unlockSurface(); - } -#endif - IDirectFBSurface *src = otherData->directFBSurface(); - alpha = data->hasAlphaChannel(); - imageFormat = (alpha - ? QDirectFBScreen::instance()->alphaPixmapFormat() - : QDirectFBScreen::instance()->pixelFormat()); - - - dfbSurface = screen->createDFBSurface(rect.size(), imageFormat, - QDirectFBScreen::TrackSurface); - if (!dfbSurface) { - qWarning("QDirectFBPixmapData::copy()"); - invalidate(); - return; - } - - if (alpha) { - dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL); - } else { - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - } - const DFBRectangle blitRect = { rect.x(), rect.y(), - rect.width(), rect.height() }; - w = rect.width(); - h = rect.height(); - d = otherData->d; - is_null = (w <= 0 || h <= 0); - unlockSurface(); - DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0); -#if (Q_DIRECTFB_VERSION >= 0x010000) - dfbSurface->ReleaseSource(dfbSurface); -#endif - if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::copy()", result); - invalidate(); - return; - } - - setSerialNumber(++global_ser_no); -} - -static inline bool isOpaqueFormat(QImage::Format format) -{ - switch (format) { - case QImage::Format_RGB32: - case QImage::Format_RGB16: - case QImage::Format_RGB666: - case QImage::Format_RGB555: - case QImage::Format_RGB888: - case QImage::Format_RGB444: - return true; - default: - break; - } - return false; -} - -void QDirectFBPixmapData::fill(const QColor &color) -{ - if (!serialNumber()) - return; - - Q_ASSERT(dfbSurface); - - alpha |= (color.alpha() < 255); - - if (alpha && isOpaqueFormat(imageFormat)) { - QSize size; - dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight()); - screen->releaseDFBSurface(dfbSurface); - imageFormat = screen->alphaPixmapFormat(); - d = QDirectFBScreen::depth(imageFormat); - dfbSurface = screen->createDFBSurface(size, screen->alphaPixmapFormat(), QDirectFBScreen::TrackSurface); - setSerialNumber(++global_ser_no); - if (!dfbSurface) { - qWarning("QDirectFBPixmapData::fill()"); - invalidate(); - return; - } - } - - dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), color.alpha()); -} - -QPixmap QDirectFBPixmapData::transformed(const QTransform &transform, - Qt::TransformationMode mode) const -{ - QDirectFBPixmapData *that = const_cast(this); -#ifdef QT_NO_DIRECTFB_SUBSURFACE - if (lockFlags()) - that->unlockSurface(); -#endif - - if (!dfbSurface || transform.type() != QTransform::TxScale - || mode != Qt::FastTransformation) - { - const QImage *image = that->buffer(); - Q_ASSERT(image); - const QImage transformed = image->transformed(transform, mode); - QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType); - data->fromImage(transformed, Qt::AutoColor); - return QPixmap(data); - } - - const QSize size = transform.mapRect(QRect(0, 0, w, h)).size(); - if (size.isEmpty()) - return QPixmap(); - - QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType); - data->setSerialNumber(++global_ser_no); - DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; - data->alpha = alpha; - if (alpha) { - flags = DSBLIT_BLEND_ALPHACHANNEL; - } - data->dfbSurface = screen->createDFBSurface(size, - imageFormat, - QDirectFBScreen::TrackSurface); - if (flags & DSBLIT_BLEND_ALPHACHANNEL) { - data->dfbSurface->Clear(data->dfbSurface, 0, 0, 0, 0); - } - data->dfbSurface->SetBlittingFlags(data->dfbSurface, flags); - - const DFBRectangle destRect = { 0, 0, size.width(), size.height() }; - data->dfbSurface->StretchBlit(data->dfbSurface, dfbSurface, 0, &destRect); - data->w = size.width(); - data->h = size.height(); - data->is_null = (data->w <= 0 || data->h <= 0); - -#if (Q_DIRECTFB_VERSION >= 0x010000) - data->dfbSurface->ReleaseSource(data->dfbSurface); -#endif - return QPixmap(data); -} - -QImage QDirectFBPixmapData::toImage() const -{ - if (!dfbSurface) - return QImage(); - -#if 0 - // In later versions of DirectFB one can set a flag to tell - // DirectFB not to move the surface to videomemory. When that - // happens we can use this (hopefully faster) codepath -#ifndef QT_NO_DIRECTFB_PREALLOCATED - QImage ret(w, h, QDirectFBScreen::getImageFormat(dfbSurface)); - if (IDirectFBSurface *imgSurface = screen->createDFBSurface(ret, QDirectFBScreen::DontTrackSurface)) { - if (hasAlphaChannel()) { - imgSurface->SetBlittingFlags(imgSurface, DSBLIT_BLEND_ALPHACHANNEL); - imgSurface->Clear(imgSurface, 0, 0, 0, 0); - } else { - imgSurface->SetBlittingFlags(imgSurface, DSBLIT_NOFX); - } - imgSurface->Blit(imgSurface, dfbSurface, 0, 0, 0); -#if (Q_DIRECTFB_VERSION >= 0x010000) - imgSurface->ReleaseSource(imgSurface); -#endif - imgSurface->Release(imgSurface); - return ret; - } -#endif -#endif - - QDirectFBPixmapData *that = const_cast(this); - const QImage *img = that->buffer(); - return img->copy(); -} - -/* This is QPixmapData::paintEngine(), not QPaintDevice::paintEngine() */ - -QPaintEngine *QDirectFBPixmapData::paintEngine() const -{ - if (!engine) { - // QDirectFBPixmapData is also a QCustomRasterPaintDevice, so pass - // that to the paint engine: - QDirectFBPixmapData *that = const_cast(this); - that->engine = new QDirectFBPaintEngine(that); - } - return engine; -} - -QImage *QDirectFBPixmapData::buffer() -{ - if (!lockFlgs) { - lockSurface(DSLF_READ|DSLF_WRITE); - } - Q_ASSERT(lockFlgs); - Q_ASSERT(!lockedImage.isNull()); - return &lockedImage; -} - - -bool QDirectFBPixmapData::scroll(int dx, int dy, const QRect &rect) -{ - if (!dfbSurface) { - return false; - } - unlockSurface(); - DFBResult result = dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::scroll", result); - return false; - } - result = dfbSurface->SetPorterDuff(dfbSurface, DSPD_NONE); - if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::scroll", result); - return false; - } - - const DFBRectangle source = { rect.x(), rect.y(), rect.width(), rect.height() }; - result = dfbSurface->Blit(dfbSurface, dfbSurface, &source, source.x + dx, source.y + dy); - if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::scroll", result); - return false; - } - - return true; -} - -void QDirectFBPixmapData::invalidate() -{ - if (dfbSurface) { - screen->releaseDFBSurface(dfbSurface); - dfbSurface = 0; - } - setSerialNumber(0); - alpha = false; - d = w = h = 0; - is_null = true; - imageFormat = QImage::Format_Invalid; -} - -Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_pixmap(const QPixmap &pixmap) -{ - const QPixmapData *data = pixmap.pixmapData(); - if (!data || data->classId() != QPixmapData::DirectFBClass) - return 0; - const QDirectFBPixmapData *dfbData = static_cast(data); - return dfbData->directFBSurface(); -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h deleted file mode 100644 index bc94b426383..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDIRECTFBPIXMAP_H -#define QDIRECTFBPIXMAP_H - -#include - -#ifndef QT_NO_QWS_DIRECTFB - -#include -#include -#include "qdirectfbpaintdevice.h" -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QDirectFBPaintEngine; - -class QDirectFBPixmapData : public QPixmapData, public QDirectFBPaintDevice -{ -public: - QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType); - ~QDirectFBPixmapData(); - - // Re-implemented from QPixmapData: - virtual void resize(int width, int height); - virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags); -#ifdef QT_DIRECTFB_IMAGEPROVIDER - virtual bool fromFile(const QString &filename, const char *format, - Qt::ImageConversionFlags flags); - virtual bool fromData(const uchar *buffer, uint len, const char *format, - Qt::ImageConversionFlags flags); -#endif - virtual void copy(const QPixmapData *data, const QRect &rect); - virtual void fill(const QColor &color); - virtual QPixmap transformed(const QTransform &matrix, - Qt::TransformationMode mode) const; - virtual QImage toImage() const; - virtual QPaintEngine *paintEngine() const; - virtual QImage *buffer(); - virtual bool scroll(int dx, int dy, const QRect &rect); - // Pure virtual in QPixmapData, so re-implement here and delegate to QDirectFBPaintDevice - virtual int metric(QPaintDevice::PaintDeviceMetric m) const { return QDirectFBPaintDevice::metric(m); } - - inline QImage::Format pixelFormat() const { return imageFormat; } - inline bool hasAlphaChannel() const { return alpha; } - static bool hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor); -private: -#ifdef QT_DIRECTFB_IMAGEPROVIDER - bool fromDataBufferDescription(const DFBDataBufferDescription &dataBuffer); -#endif - void invalidate(); - bool alpha; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_QWS_DIRECTFB - -#endif // QDIRECTFBPIXMAP_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp deleted file mode 100644 index 7b1538bb492..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ /dev/null @@ -1,1819 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectfbscreen.h" -#include "qdirectfbwindowsurface.h" -#include "qdirectfbpixmap.h" -#include "qdirectfbmouse.h" -#include "qdirectfbkeyboard.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef QT_NO_QWS_DIRECTFB - -QT_BEGIN_NAMESPACE - -class QDirectFBScreenPrivate : public QObject, public QWSGraphicsSystem -{ - Q_OBJECT -public: - QDirectFBScreenPrivate(QDirectFBScreen *qptr); - ~QDirectFBScreenPrivate(); - - void setFlipFlags(const QStringList &args); - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; -public slots: -#ifdef QT_DIRECTFB_WM - void onWindowEvent(QWSWindow *window, QWSServer::WindowEvent event); -#endif -public: - IDirectFB *dfb; - DFBSurfaceFlipFlags flipFlags; - QDirectFBScreen::DirectFBFlags directFBFlags; - QImage::Format alphaPixmapFormat; - IDirectFBScreen *dfbScreen; -#ifdef QT_NO_DIRECTFB_WM - IDirectFBSurface *primarySurface; - QColor backgroundColor; -#endif -#ifndef QT_NO_DIRECTFB_LAYER - IDirectFBDisplayLayer *dfbLayer; -#endif - QSet allocatedSurfaces; - -#ifndef QT_NO_DIRECTFB_MOUSE - QDirectFBMouseHandler *mouse; -#endif -#ifndef QT_NO_DIRECTFB_KEYBOARD - QDirectFBKeyboardHandler *keyboard; -#endif -#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE - IDirectFBImageProvider *imageProvider; -#endif - IDirectFBSurface *cursorSurface; - qint64 cursorImageKey; - - QDirectFBScreen *q; - static QDirectFBScreen *instance; -}; - -QDirectFBScreen *QDirectFBScreenPrivate::instance = 0; - -QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr) - : QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE), - directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid), - dfbScreen(0) -#ifdef QT_NO_DIRECTFB_WM - , primarySurface(0) -#endif -#ifndef QT_NO_DIRECTFB_LAYER - , dfbLayer(0) -#endif -#ifndef QT_NO_DIRECTFB_MOUSE - , mouse(0) -#endif -#ifndef QT_NO_DIRECTFB_KEYBOARD - , keyboard(0) -#endif -#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE - , imageProvider(0) -#endif - , cursorSurface(0) - , cursorImageKey(0) - , q(qptr) -{ -#ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->addObject(this); -#endif -#ifdef QT_DIRECTFB_WM - connect(QWSServer::instance(), SIGNAL(windowEvent(QWSWindow*,QWSServer::WindowEvent)), - this, SLOT(onWindowEvent(QWSWindow*,QWSServer::WindowEvent))); -#endif -} - -QDirectFBScreenPrivate::~QDirectFBScreenPrivate() -{ -#ifndef QT_NO_DIRECTFB_MOUSE - delete mouse; -#endif -#ifndef QT_NO_DIRECTFB_KEYBOARD - delete keyboard; -#endif -#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE - if (imageProvider) - imageProvider->Release(imageProvider); -#endif - - for (QSet::const_iterator it = allocatedSurfaces.begin(); it != allocatedSurfaces.end(); ++it) { - (*it)->Release(*it); - } - -#ifdef QT_NO_DIRECTFB_WM - if (primarySurface) - primarySurface->Release(primarySurface); -#endif - -#ifndef QT_NO_DIRECTFB_LAYER - if (dfbLayer) - dfbLayer->Release(dfbLayer); -#endif - - if (dfbScreen) - dfbScreen->Release(dfbScreen); - - if (dfb) - dfb->Release(dfb); -} - -IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *resultPtr) -{ - if (image.isNull()) // assert? - return 0; - - if (QDirectFBScreen::getSurfacePixelFormat(format) == DSPF_UNKNOWN) { - format = QDirectFBPixmapData::hasAlphaChannel(image) ? d_ptr->alphaPixmapFormat : pixelFormat(); - } - if (image.format() != format) { - return createDFBSurface(image.convertToFormat(format), format, options | NoPreallocated, resultPtr); - } - - DFBSurfaceDescription description; - memset(&description, 0, sizeof(DFBSurfaceDescription)); - description.width = image.width(); - description.height = image.height(); - description.flags = DSDESC_WIDTH|DSDESC_HEIGHT|DSDESC_PIXELFORMAT; - initSurfaceDescriptionPixelFormat(&description, format); - bool doMemCopy = true; -#ifdef QT_DIRECTFB_PREALLOCATED - if (!(options & NoPreallocated)) { - doMemCopy = false; - description.flags |= DSDESC_PREALLOCATED; - description.preallocated[0].data = const_cast(image.bits()); - description.preallocated[0].pitch = image.bytesPerLine(); - description.preallocated[1].data = 0; - description.preallocated[1].pitch = 0; - } -#endif - DFBResult result; - IDirectFBSurface *surface = createDFBSurface(description, options, &result); - if (resultPtr) - *resultPtr = result; - if (!surface) { - DirectFBError("Couldn't create surface createDFBSurface(QImage, QImage::Format, SurfaceCreationOptions)", result); - return 0; - } - if (doMemCopy) { - int bplDFB; - uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bplDFB); - if (mem) { - const int height = image.height(); - const int bplQt = image.bytesPerLine(); - if (bplQt == bplDFB && bplQt == (image.width() * image.depth() / 8)) { - memcpy(mem, image.bits(), image.byteCount()); - } else { - for (int i=0; iUnlock(surface); - } - } -#ifdef QT_DIRECTFB_PALETTE - if (image.colorCount() != 0 && surface) - QDirectFBScreen::setSurfaceColorTable(surface, image); -#endif - return surface; -} - -IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src, - QImage::Format format, - SurfaceCreationOptions options, - DFBResult *result) -{ - Q_ASSERT(src); - QSize size; - src->GetSize(src, &size.rwidth(), &size.rheight()); - IDirectFBSurface *surface = createDFBSurface(size, format, options, result); - DFBSurfaceBlittingFlags flags = QDirectFBScreen::hasAlphaChannel(surface) - ? DSBLIT_BLEND_ALPHACHANNEL - : DSBLIT_NOFX; - if (flags & DSBLIT_BLEND_ALPHACHANNEL) - surface->Clear(surface, 0, 0, 0, 0); - - surface->SetBlittingFlags(surface, flags); - surface->Blit(surface, src, 0, 0, 0); -#if (Q_DIRECTFB_VERSION >= 0x010000) - surface->ReleaseSource(surface); -#endif - return surface; -} - -IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size, - QImage::Format format, - SurfaceCreationOptions options, - DFBResult *result) -{ - DFBSurfaceDescription desc; - memset(&desc, 0, sizeof(DFBSurfaceDescription)); - desc.flags |= DSDESC_WIDTH|DSDESC_HEIGHT; - if (!QDirectFBScreen::initSurfaceDescriptionPixelFormat(&desc, format)) - return 0; - desc.width = size.width(); - desc.height = size.height(); - return createDFBSurface(desc, options, result); -} - -IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options, DFBResult *resultPtr) -{ - DFBResult tmp; - DFBResult &result = (resultPtr ? *resultPtr : tmp); - result = DFB_OK; - IDirectFBSurface *newSurface = 0; - - if (!d_ptr->dfb) { - qWarning("QDirectFBScreen::createDFBSurface() - not connected"); - return 0; - } - - if (d_ptr->directFBFlags & VideoOnly - && !(desc.flags & DSDESC_PREALLOCATED) - && (!(desc.flags & DSDESC_CAPS) || !(desc.caps & DSCAPS_SYSTEMONLY))) { - // Add the video only capability. This means the surface will be created in video ram - if (!(desc.flags & DSDESC_CAPS)) { - desc.caps = DSCAPS_VIDEOONLY; - desc.flags |= DSDESC_CAPS; - } else { - desc.caps |= DSCAPS_VIDEOONLY; - } - result = d_ptr->dfb->CreateSurface(d_ptr->dfb, &desc, &newSurface); - if (result != DFB_OK -#ifdef QT_NO_DEBUG - && (desc.flags & DSDESC_CAPS) && (desc.caps & DSCAPS_PRIMARY) -#endif - ) { - qWarning("QDirectFBScreen::createDFBSurface() Failed to create surface in video memory!\n" - " Flags %0x Caps %0x width %d height %d pixelformat %0x %d preallocated %p %d\n%s", - desc.flags, desc.caps, desc.width, desc.height, - desc.pixelformat, DFB_PIXELFORMAT_INDEX(desc.pixelformat), - desc.preallocated[0].data, desc.preallocated[0].pitch, - DirectFBErrorString(result)); - } - desc.caps &= ~DSCAPS_VIDEOONLY; - } - - if (d_ptr->directFBFlags & SystemOnly) - desc.caps |= DSCAPS_SYSTEMONLY; - - if (!newSurface) - result = d_ptr->dfb->CreateSurface(d_ptr->dfb, &desc, &newSurface); - - if (result != DFB_OK) { - qWarning("QDirectFBScreen::createDFBSurface() Failed!\n" - " Flags %0x Caps %0x width %d height %d pixelformat %0x %d preallocated %p %d\n%s", - desc.flags, desc.caps, desc.width, desc.height, - desc.pixelformat, DFB_PIXELFORMAT_INDEX(desc.pixelformat), - desc.preallocated[0].data, desc.preallocated[0].pitch, - DirectFBErrorString(result)); - return 0; - } - - Q_ASSERT(newSurface); - - if (options & TrackSurface) { - d_ptr->allocatedSurfaces.insert(newSurface); - } - - return newSurface; -} - -#ifdef QT_DIRECTFB_SUBSURFACE -IDirectFBSurface *QDirectFBScreen::getSubSurface(IDirectFBSurface *surface, - const QRect &rect, - SurfaceCreationOptions options, - DFBResult *resultPtr) -{ - Q_ASSERT(!(options & NoPreallocated)); - Q_ASSERT(surface); - DFBResult res; - DFBResult &result = (resultPtr ? *resultPtr : res); - IDirectFBSurface *subSurface = 0; - if (rect.isNull()) { - result = surface->GetSubSurface(surface, 0, &subSurface); - } else { - const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() }; - result = surface->GetSubSurface(surface, &subRect, &subSurface); - } - if (result != DFB_OK) { - DirectFBError("Can't get sub surface", result); - } else if (options & TrackSurface) { - d_ptr->allocatedSurfaces.insert(subSurface); - } - return subSurface; -} -#endif - - -void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface *surface) -{ - Q_ASSERT(QDirectFBScreen::instance()); - Q_ASSERT(surface); - surface->Release(surface); - if (!d_ptr->allocatedSurfaces.remove(surface)) - qWarning("QDirectFBScreen::releaseDFBSurface() - %p not in list", surface); - - //qDebug("Released surface at %p. New count = %d", surface, d_ptr->allocatedSurfaces.count()); -} - -QDirectFBScreen::DirectFBFlags QDirectFBScreen::directFBFlags() const -{ - return d_ptr->directFBFlags; -} - -IDirectFB *QDirectFBScreen::dfb() -{ - return d_ptr->dfb; -} - -#ifdef QT_NO_DIRECTFB_WM -IDirectFBSurface *QDirectFBScreen::primarySurface() -{ - return d_ptr->primarySurface; -} -#endif - -#ifndef QT_NO_DIRECTFB_LAYER -IDirectFBDisplayLayer *QDirectFBScreen::dfbDisplayLayer() -{ - return d_ptr->dfbLayer; -} -#endif - -DFBSurfacePixelFormat QDirectFBScreen::getSurfacePixelFormat(QImage::Format format) -{ - switch (format) { -#ifndef QT_NO_DIRECTFB_PALETTE - case QImage::Format_Indexed8: - return DSPF_LUT8; -#endif - case QImage::Format_RGB888: - return DSPF_RGB24; - case QImage::Format_ARGB4444_Premultiplied: - return DSPF_ARGB4444; -#if (Q_DIRECTFB_VERSION >= 0x010100) - case QImage::Format_RGB444: - return DSPF_RGB444; - case QImage::Format_RGB555: - return DSPF_RGB555; -#endif - case QImage::Format_RGB16: - return DSPF_RGB16; -#if (Q_DIRECTFB_VERSION >= 0x010000) - case QImage::Format_ARGB6666_Premultiplied: - return DSPF_ARGB6666; - case QImage::Format_RGB666: - return DSPF_RGB18; -#endif - case QImage::Format_RGB32: - return DSPF_RGB32; - case QImage::Format_ARGB32_Premultiplied: - case QImage::Format_ARGB32: - return DSPF_ARGB; - default: - return DSPF_UNKNOWN; - }; -} - -QImage::Format QDirectFBScreen::getImageFormat(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; -#if (Q_DIRECTFB_VERSION >= 0x010100) - case DSPF_RGB444: - return QImage::Format_RGB444; - case DSPF_RGB555: -#endif - case DSPF_ARGB1555: - return QImage::Format_RGB555; - case DSPF_RGB16: - return QImage::Format_RGB16; -#if (Q_DIRECTFB_VERSION >= 0x010000) - case DSPF_ARGB6666: - return QImage::Format_ARGB6666_Premultiplied; - case DSPF_RGB18: - return QImage::Format_RGB666; -#endif - 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; -} - -DFBSurfaceDescription QDirectFBScreen::getSurfaceDescription(const uint *buffer, - int length) -{ - DFBSurfaceDescription description; - memset(&description, 0, sizeof(DFBSurfaceDescription)); - - description.flags = DSDESC_CAPS|DSDESC_WIDTH|DSDESC_HEIGHT|DSDESC_PIXELFORMAT|DSDESC_PREALLOCATED; - description.caps = DSCAPS_PREMULTIPLIED; - description.width = length; - description.height = 1; - description.pixelformat = DSPF_ARGB; - description.preallocated[0].data = (void*)buffer; - description.preallocated[0].pitch = length * sizeof(uint); - description.preallocated[1].data = 0; - description.preallocated[1].pitch = 0; - return description; -} - -#ifndef QT_NO_DIRECTFB_PALETTE -void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface, - const QImage &image) -{ - if (!surface) - return; - - const int numColors = image.colorCount(); - if (numColors == 0) - return; - - QVarLengthArray colors(numColors); - for (int i = 0; i < numColors; ++i) { - QRgb c = image.color(i); - colors[i].a = qAlpha(c); - colors[i].r = qRed(c); - colors[i].g = qGreen(c); - colors[i].b = qBlue(c); - } - - IDirectFBPalette *palette; - DFBResult result; - result = surface->GetPalette(surface, &palette); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::setSurfaceColorTable GetPalette", - result); - return; - } - result = palette->SetEntries(palette, colors.data(), numColors, 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::setSurfaceColorTable SetEntries", - result); - } - palette->Release(palette); -} - -#endif // QT_NO_DIRECTFB_PALETTE - -#if defined QT_DIRECTFB_CURSOR -class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor -{ -public: - QDirectFBScreenCursor(); - virtual void set(const QImage &image, int hotx, int hoty); - virtual void move(int x, int y); - virtual void show(); - virtual void hide(); -private: -#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR - ~QDirectFBScreenCursor(); - bool createWindow(); - IDirectFBWindow *window; -#endif - IDirectFBDisplayLayer *layer; -}; - -QDirectFBScreenCursor::QDirectFBScreenCursor() -{ - IDirectFB *fb = QDirectFBScreen::instance()->dfb(); - if (!fb) - qFatal("QDirectFBScreenCursor: DirectFB not initialized"); - - layer = QDirectFBScreen::instance()->dfbDisplayLayer(); - Q_ASSERT(layer); - - enable = false; - hwaccel = true; - supportsAlpha = true; -#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR - window = 0; - DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::hide: " - "Unable to set cooperative level", result); - } - result = layer->SetCursorOpacity(layer, 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::hide: " - "Unable to set cursor opacity", result); - } - - result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::hide: " - "Unable to set cooperative level", result); - } -#endif -} - -#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR -QDirectFBScreenCursor::~QDirectFBScreenCursor() -{ - if (window) { - window->Release(window); - window = 0; - } -} - -bool QDirectFBScreenCursor::createWindow() -{ - Q_ASSERT(!window); - Q_ASSERT(!cursor.isNull()); - DFBWindowDescription description; - memset(&description, 0, sizeof(DFBWindowDescription)); - description.flags = DWDESC_POSX|DWDESC_POSY|DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_CAPS|DWDESC_PIXELFORMAT|DWDESC_SURFACE_CAPS; - description.width = cursor.width(); - description.height = cursor.height(); - description.posx = pos.x() - hotspot.x(); - description.posy = pos.y() - hotspot.y(); -#if (Q_DIRECTFB_VERSION >= 0x010100) - description.flags |= DWDESC_OPTIONS; - description.options = DWOP_GHOST|DWOP_ALPHACHANNEL; -#endif - description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER; - const QImage::Format format = QDirectFBScreen::instance()->alphaPixmapFormat(); - description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); - if (QDirectFBScreen::isPremultiplied(format)) - description.surface_caps = DSCAPS_PREMULTIPLIED; - - DFBResult result = layer->CreateWindow(layer, &description, &window); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::createWindow: Unable to create window", result); - return false; - } - result = window->SetOpacity(window, 255); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::createWindow: Unable to set opacity ", result); - return false; - } - - result = window->SetStackingClass(window, DWSC_UPPER); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::createWindow: Unable to set stacking class ", result); - return false; - } - - result = window->RaiseToTop(window); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::createWindow: Unable to raise window ", result); - return false; - } - - return true; -} -#endif - -void QDirectFBScreenCursor::move(int x, int y) -{ - pos = QPoint(x, y); -#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR - if (window) { - const QPoint p = pos - hotspot; - DFBResult result = window->MoveTo(window, p.x(), p.y()); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::move: Unable to move window", result); - } - } -#else - layer->WarpCursor(layer, x, y); -#endif -} - -void QDirectFBScreenCursor::hide() -{ - if (enable) { - enable = false; - DFBResult result; -#ifndef QT_DIRECTFB_WINDOW_AS_CURSOR - result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::hide: " - "Unable to set cooperative level", result); - } - result = layer->SetCursorOpacity(layer, 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::hide: " - "Unable to set cursor opacity", result); - } - result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::hide: " - "Unable to set cooperative level", result); - } -#else - if (window) { - result = window->SetOpacity(window, 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::hide: " - "Unable to set window opacity", result); - } - } -#endif - } -} - -void QDirectFBScreenCursor::show() -{ - if (!enable) { - enable = true; - DFBResult result; - result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to set cooperative level", result); - } - result = layer->SetCursorOpacity(layer, -#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR - 0 -#else - 255 -#endif - ); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to set cursor shape", result); - } - result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to set cooperative level", result); - } -#ifdef QT_DIRECTFB_WINDOW_AS_CURSOR - if (window) { - DFBResult result = window->SetOpacity(window, 255); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to set window opacity", result); - } - } -#endif - } -} - -void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty) -{ - QDirectFBScreen *screen = QDirectFBScreen::instance(); - if (!screen) - return; - - if (image.isNull()) { - cursor = QImage(); - hide(); - } else { - cursor = image.convertToFormat(screen->alphaPixmapFormat()); - size = cursor.size(); - hotspot = QPoint(hotx, hoty); - DFBResult result = DFB_OK; - IDirectFBSurface *surface = screen->createDFBSurface(cursor, screen->alphaPixmapFormat(), - QDirectFBScreen::DontTrackSurface, &result); - if (!surface) { - DirectFBError("QDirectFBScreenCursor::set: Unable to create surface", result); - return; - } -#ifndef QT_DIRECTFB_WINDOW_AS_CURSOR - result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to set cooperative level", result); - } - result = layer->SetCursorShape(layer, surface, hotx, hoty); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to set cursor shape", result); - } - result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to set cooperative level", result); - } -#else - if (window || createWindow()) { - QSize windowSize; - result = window->GetSize(window, &windowSize.rwidth(), &windowSize.rheight()); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: " - "Unable to get window size", result); - } - result = window->Resize(window, size.width(), size.height()); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: Unable to resize window", result); - } - - IDirectFBSurface *windowSurface; - result = window->GetSurface(window, &windowSurface); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: Unable to get window surface", result); - } else { - result = windowSurface->Clear(windowSurface, 0, 0, 0, 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: Unable to clear surface", result); - } - - result = windowSurface->Blit(windowSurface, surface, 0, 0, 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: Unable to blit to surface", result); - } - } - result = windowSurface->Flip(windowSurface, 0, DSFLIP_NONE); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: Unable to flip window", result); - } - - windowSurface->Release(windowSurface); - } -#endif - surface->Release(surface); - show(); - } - -} -#endif // QT_DIRECTFB_CURSOR - -QDirectFBScreen::QDirectFBScreen(int display_id) - : QScreen(display_id, DirectFBClass), d_ptr(new QDirectFBScreenPrivate(this)) -{ - QDirectFBScreenPrivate::instance = this; -} - -QDirectFBScreen::~QDirectFBScreen() -{ - if (QDirectFBScreenPrivate::instance == this) - QDirectFBScreenPrivate::instance = 0; - delete d_ptr; -} - -QDirectFBScreen *QDirectFBScreen::instance() -{ - return QDirectFBScreenPrivate::instance; -} - -int QDirectFBScreen::depth(DFBSurfacePixelFormat format) -{ - switch (format) { - case DSPF_A1: - return 1; - case DSPF_A8: - case DSPF_RGB332: - case DSPF_LUT8: - case DSPF_ALUT44: - return 8; - case DSPF_I420: - case DSPF_YV12: - case DSPF_NV12: - case DSPF_NV21: -#if (Q_DIRECTFB_VERSION >= 0x010100) - case DSPF_RGB444: -#endif - return 12; -#if (Q_DIRECTFB_VERSION >= 0x010100) - case DSPF_RGB555: - return 15; -#endif - case DSPF_ARGB1555: - case DSPF_RGB16: - case DSPF_YUY2: - case DSPF_UYVY: - case DSPF_NV16: - case DSPF_ARGB2554: - case DSPF_ARGB4444: - return 16; - case DSPF_RGB24: - return 24; - case DSPF_RGB32: - case DSPF_ARGB: - case DSPF_AiRGB: - return 32; - case DSPF_UNKNOWN: - default: - return 0; - }; - return 0; -} - -int QDirectFBScreen::depth(QImage::Format format) -{ - int depth = 0; - switch(format) { - case QImage::Format_Invalid: - case QImage::NImageFormats: - Q_ASSERT(false); - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - depth = 1; - break; - case QImage::Format_Indexed8: - depth = 8; - break; - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - depth = 32; - break; - case QImage::Format_RGB555: - case QImage::Format_RGB16: - case QImage::Format_RGB444: - case QImage::Format_ARGB4444_Premultiplied: - depth = 16; - break; - case QImage::Format_RGB666: - case QImage::Format_ARGB6666_Premultiplied: - case QImage::Format_ARGB8565_Premultiplied: - case QImage::Format_ARGB8555_Premultiplied: - case QImage::Format_RGB888: - depth = 24; - break; - } - return depth; -} - -void QDirectFBScreenPrivate::setFlipFlags(const QStringList &args) -{ - QRegExp flipRegexp(QLatin1String("^flip=([\\w,]*)$")); - int index = args.indexOf(flipRegexp); - if (index >= 0) { - const QStringList flips = flipRegexp.cap(1).split(QLatin1Char(','), - QString::SkipEmptyParts); - flipFlags = DSFLIP_NONE; - foreach(const QString &flip, flips) { - if (flip == QLatin1String("wait")) - flipFlags |= DSFLIP_WAIT; - else if (flip == QLatin1String("blit")) - flipFlags |= DSFLIP_BLIT; - else if (flip == QLatin1String("onsync")) - flipFlags |= DSFLIP_ONSYNC; - else if (flip == QLatin1String("pipeline")) - flipFlags |= DSFLIP_PIPELINE; - else - qWarning("QDirectFBScreen: Unknown flip argument: %s", - qPrintable(flip)); - } - } else { - flipFlags = DSFLIP_BLIT|DSFLIP_ONSYNC; - } -} - -#ifdef QT_DIRECTFB_WM -void QDirectFBScreenPrivate::onWindowEvent(QWSWindow *window, QWSServer::WindowEvent event) -{ - if (event == QWSServer::Raise) { - QWSWindowSurface *windowSurface = window->windowSurface(); - if (windowSurface && windowSurface->key() == QLatin1String("directfb")) { - static_cast(windowSurface)->raise(); - } - } -} -#endif - -QPixmapData *QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType type) const -{ - if (type == QPixmapData::BitmapType) - return QWSGraphicsSystem::createPixmapData(type); - - return new QDirectFBPixmapData(q, type); -} - -#if (Q_DIRECTFB_VERSION >= 0x000923) -#ifdef QT_NO_DEBUG -struct FlagDescription; -static const FlagDescription *accelerationDescriptions = 0; -static const FlagDescription *blitDescriptions = 0; -static const FlagDescription *drawDescriptions = 0; -#else -struct FlagDescription { - const char *name; - uint flag; -}; - -static const FlagDescription accelerationDescriptions[] = { - { "DFXL_NONE", DFXL_NONE }, - { "DFXL_FILLRECTANGLE", DFXL_FILLRECTANGLE }, - { "DFXL_DRAWRECTANGLE", DFXL_DRAWRECTANGLE }, - { "DFXL_DRAWLINE", DFXL_DRAWLINE }, - { "DFXL_FILLTRIANGLE", DFXL_FILLTRIANGLE }, - { "DFXL_BLIT", DFXL_BLIT }, - { "DFXL_STRETCHBLIT", DFXL_STRETCHBLIT }, - { "DFXL_TEXTRIANGLES", DFXL_TEXTRIANGLES }, - { "DFXL_DRAWSTRING", DFXL_DRAWSTRING }, - { 0, 0 } -}; - -static const FlagDescription blitDescriptions[] = { - { "DSBLIT_NOFX", DSBLIT_NOFX }, - { "DSBLIT_BLEND_ALPHACHANNEL", DSBLIT_BLEND_ALPHACHANNEL }, - { "DSBLIT_BLEND_COLORALPHA", DSBLIT_BLEND_COLORALPHA }, - { "DSBLIT_COLORIZE", DSBLIT_COLORIZE }, - { "DSBLIT_SRC_COLORKEY", DSBLIT_SRC_COLORKEY }, - { "DSBLIT_DST_COLORKEY", DSBLIT_DST_COLORKEY }, - { "DSBLIT_SRC_PREMULTIPLY", DSBLIT_SRC_PREMULTIPLY }, - { "DSBLIT_DST_PREMULTIPLY", DSBLIT_DST_PREMULTIPLY }, - { "DSBLIT_DEMULTIPLY", DSBLIT_DEMULTIPLY }, - { "DSBLIT_DEINTERLACE", DSBLIT_DEINTERLACE }, -#if (Q_DIRECTFB_VERSION >= 0x000923) - { "DSBLIT_SRC_PREMULTCOLOR", DSBLIT_SRC_PREMULTCOLOR }, - { "DSBLIT_XOR", DSBLIT_XOR }, -#endif -#if (Q_DIRECTFB_VERSION >= 0x010000) - { "DSBLIT_INDEX_TRANSLATION", DSBLIT_INDEX_TRANSLATION }, -#endif - { 0, 0 } -}; - -static const FlagDescription drawDescriptions[] = { - { "DSDRAW_NOFX", DSDRAW_NOFX }, - { "DSDRAW_BLEND", DSDRAW_BLEND }, - { "DSDRAW_DST_COLORKEY", DSDRAW_DST_COLORKEY }, - { "DSDRAW_SRC_PREMULTIPLY", DSDRAW_SRC_PREMULTIPLY }, - { "DSDRAW_DST_PREMULTIPLY", DSDRAW_DST_PREMULTIPLY }, - { "DSDRAW_DEMULTIPLY", DSDRAW_DEMULTIPLY }, - { "DSDRAW_XOR", DSDRAW_XOR }, - { 0, 0 } -}; -#endif - -static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags) -{ -#ifdef QT_NO_DEBUG - Q_UNUSED(mask); - Q_UNUSED(flags); - return QByteArray(""); -#else - if (!mask) - return flags[0].name; - - QStringList list; - for (int i=1; flags[i].name; ++i) { - if (mask & flags[i].flag) { - list.append(QString::fromLatin1(flags[i].name)); - } - } - Q_ASSERT(!list.isEmpty()); - return (QLatin1Char(' ') + list.join(QLatin1String("|"))).toLatin1(); -#endif -} -static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface) -{ - DFBResult result; - DFBGraphicsDeviceDescription dev; - - result = fb->GetDeviceDescription(fb, &dev); - if (result != DFB_OK) { - DirectFBError("Error reading graphics device description", result); - return; - } - - DFBSurfacePixelFormat pixelFormat; - primarySurface->GetPixelFormat(primarySurface, &pixelFormat); - - qDebug("Device: %s (%s), Driver: %s v%i.%i (%s) Pixelformat: %d (%d)\n" - "acceleration: 0x%x%s\nblit: 0x%x%s\ndraw: 0x%0x%s\nvideo: %iKB\n", - dev.name, dev.vendor, dev.driver.name, dev.driver.major, - dev.driver.minor, dev.driver.vendor, DFB_PIXELFORMAT_INDEX(pixelFormat), - QDirectFBScreen::getImageFormat(primarySurface), dev.acceleration_mask, - flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(), - dev.blitting_flags, flagDescriptions(dev.blitting_flags, blitDescriptions).constData(), - dev.drawing_flags, flagDescriptions(dev.drawing_flags, drawDescriptions).constData(), - (dev.video_memory >> 10)); -} -#endif - -static inline bool setIntOption(const QStringList &arguments, const QString &variable, int *value) -{ - Q_ASSERT(value); - QRegExp rx(QString::fromLatin1("%1=?(\\d+)").arg(variable)); - rx.setCaseSensitivity(Qt::CaseInsensitive); - if (arguments.indexOf(rx) != -1) { - *value = rx.cap(1).toInt(); - return true; - } - return false; -} - -static inline QColor colorFromName(const QString &name) -{ - QRegExp rx(QLatin1String("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])")); - rx.setCaseSensitivity(Qt::CaseInsensitive); - if (rx.exactMatch(name)) { - Q_ASSERT(rx.captureCount() == 4); - int ints[4]; - int i; - for (i=0; i<4; ++i) { - bool ok; - ints[i] = rx.cap(i + 1).toUInt(&ok, 16); - if (!ok || ints[i] > 255) - break; - } - if (i == 4) - return QColor(ints[0], ints[1], ints[2], ints[3]); - } - return QColor(name); -} - -bool QDirectFBScreen::connect(const QString &displaySpec) -{ - 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; - } - - const QStringList displayArgs = displaySpec.split(QLatin1Char(':'), - QString::SkipEmptyParts); - - d_ptr->setFlipFlags(displayArgs); - - result = DirectFBCreate(&d_ptr->dfb); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen: error creating DirectFB interface", - result); - return false; - } - - if (displayArgs.contains(QLatin1String("videoonly"), Qt::CaseInsensitive)) - d_ptr->directFBFlags |= VideoOnly; - - if (displayArgs.contains(QLatin1String("systemonly"), Qt::CaseInsensitive)) { - if (d_ptr->directFBFlags & VideoOnly) { - qWarning("QDirectFBScreen: error. videoonly and systemonly are mutually exclusive"); - } else { - d_ptr->directFBFlags |= SystemOnly; - } - } - - if (displayArgs.contains(QLatin1String("boundingrectflip"), Qt::CaseInsensitive)) { - d_ptr->directFBFlags |= BoundingRectFlip; - } else if (displayArgs.contains(QLatin1String("nopartialflip"), Qt::CaseInsensitive)) { - d_ptr->directFBFlags |= NoPartialFlip; - } - -#ifdef QT_DIRECTFB_IMAGECACHE - int imageCacheSize = 4 * 1024 * 1024; // 4 MB - setIntOption(displayArgs, QLatin1String("imagecachesize"), &imageCacheSize); - QDirectFBPaintEngine::initImageCache(imageCacheSize); -#endif - -#ifndef QT_NO_DIRECTFB_WM - if (displayArgs.contains(QLatin1String("fullscreen"))) -#endif - d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN); - - const bool forcePremultiplied = displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive); - - DFBSurfaceDescription description; - memset(&description, 0, sizeof(DFBSurfaceDescription)); - IDirectFBSurface *surface; - -#ifdef QT_NO_DIRECTFB_WM - description.flags = DSDESC_CAPS; - if (::setIntOption(displayArgs, QLatin1String("width"), &description.width)) - description.flags |= DSDESC_WIDTH; - if (::setIntOption(displayArgs, QLatin1String("height"), &description.height)) - description.flags |= DSDESC_HEIGHT; - - description.caps = DSCAPS_PRIMARY|DSCAPS_DOUBLE; - struct { - const char *name; - const DFBSurfaceCapabilities cap; - } const capabilities[] = { - { "static_alloc", DSCAPS_STATIC_ALLOC }, - { "triplebuffer", DSCAPS_TRIPLE }, - { "interlaced", DSCAPS_INTERLACED }, - { "separated", DSCAPS_SEPARATED }, -// { "depthbuffer", DSCAPS_DEPTH }, // only makes sense with TextureTriangles which are not supported - { 0, DSCAPS_NONE } - }; - for (int i=0; capabilities[i].name; ++i) { - if (displayArgs.contains(QString::fromLatin1(capabilities[i].name), Qt::CaseInsensitive)) - description.caps |= capabilities[i].cap; - } - - if (forcePremultiplied) { - description.caps |= DSCAPS_PREMULTIPLIED; - } - - // We don't track the primary surface as it's released in disconnect - d_ptr->primarySurface = createDFBSurface(description, DontTrackSurface, &result); - if (!d_ptr->primarySurface) { - DirectFBError("QDirectFBScreen: error creating primary surface", - result); - return false; - } - - surface = d_ptr->primarySurface; -#else - description.flags = DSDESC_WIDTH|DSDESC_HEIGHT; - description.width = description.height = 1; - surface = createDFBSurface(description, DontTrackSurface, &result); - if (!surface) { - DirectFBError("QDirectFBScreen: error creating surface", result); - return false; - } -#endif - // Work out what format we're going to use for surfaces with an alpha channel - QImage::Format pixelFormat = QDirectFBScreen::getImageFormat(surface); - d_ptr->alphaPixmapFormat = pixelFormat; - - switch (pixelFormat) { - case QImage::Format_RGB666: - d_ptr->alphaPixmapFormat = QImage::Format_ARGB6666_Premultiplied; - break; - case QImage::Format_RGB444: - d_ptr->alphaPixmapFormat = QImage::Format_ARGB4444_Premultiplied; - break; - case QImage::Format_RGB32: - pixelFormat = d_ptr->alphaPixmapFormat = QImage::Format_ARGB32_Premultiplied; - // ### Format_RGB32 doesn't work so well with Qt. Force ARGB32 for windows/pixmaps - break; - case QImage::Format_Indexed8: - qWarning("QDirectFBScreen::connect(). Qt/DirectFB does not work with the LUT8 pixelformat."); - return false; - case QImage::NImageFormats: - case QImage::Format_Invalid: - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - case QImage::Format_RGB888: - case QImage::Format_RGB16: - case QImage::Format_RGB555: - d_ptr->alphaPixmapFormat = QImage::Format_ARGB32_Premultiplied; - break; - case QImage::Format_ARGB32: - if (forcePremultiplied) - d_ptr->alphaPixmapFormat = pixelFormat = QImage::Format_ARGB32_Premultiplied; - case QImage::Format_ARGB32_Premultiplied: - case QImage::Format_ARGB4444_Premultiplied: - case QImage::Format_ARGB8555_Premultiplied: - case QImage::Format_ARGB8565_Premultiplied: - case QImage::Format_ARGB6666_Premultiplied: - // works already - break; - } - setPixelFormat(pixelFormat); - QScreen::d = QDirectFBScreen::depth(pixelFormat); - data = 0; - lstep = 0; - size = 0; - - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::connect: " - "Unable to get screen!", result); - return false; - } - const QString qws_size = QString::fromLatin1(qgetenv("QWS_SIZE")); - if (!qws_size.isEmpty()) { - QRegExp rx(QLatin1String("(\\d+)x(\\d+)")); - if (!rx.exactMatch(qws_size)) { - qWarning("QDirectFBScreen::connect: Can't parse QWS_SIZE=\"%s\"", qPrintable(qws_size)); - } else { - int *ints[2] = { &w, &h }; - for (int i=0; i<2; ++i) { - *ints[i] = rx.cap(i + 1).toInt(); - if (*ints[i] <= 0) { - qWarning("QDirectFBScreen::connect: %s is not a positive integer", - qPrintable(rx.cap(i + 1))); - w = h = 0; - break; - } - } - } - } - - setIntOption(displayArgs, QLatin1String("width"), &w); - setIntOption(displayArgs, QLatin1String("height"), &h); - -#ifndef QT_NO_DIRECTFB_LAYER - int layerId = DLID_PRIMARY; - setIntOption(displayArgs, QLatin1String("layerid"), &layerId); - - result = d_ptr->dfb->GetDisplayLayer(d_ptr->dfb, static_cast(layerId), - &d_ptr->dfbLayer); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::connect: " - "Unable to get display layer!", result); - return false; - } - result = d_ptr->dfbLayer->GetScreen(d_ptr->dfbLayer, &d_ptr->dfbScreen); -#else - result = d_ptr->dfb->GetScreen(d_ptr->dfb, 0, &d_ptr->dfbScreen); -#endif - - if (w <= 0 || h <= 0) { -#ifdef QT_NO_DIRECTFB_WM - result = d_ptr->primarySurface->GetSize(d_ptr->primarySurface, &w, &h); -#elif (Q_DIRECTFB_VERSION >= 0x010000) - IDirectFBSurface *layerSurface; - if (d_ptr->dfbLayer->GetSurface(d_ptr->dfbLayer, &layerSurface) == DFB_OK) { - result = layerSurface->GetSize(layerSurface, &w, &h); - layerSurface->Release(layerSurface); - } - if (w <= 0 || h <= 0) { - result = d_ptr->dfbScreen->GetSize(d_ptr->dfbScreen, &w, &h); - } -#else - qWarning("QDirectFBScreen::connect: DirectFB versions prior to 1.0 do not offer a way\n" - "query the size of the primary surface in windowed mode. You have to specify\n" - "the size of the display using QWS_SIZE=[0-9]x[0-9] or\n" - "QWS_DISPLAY=directfb:width=[0-9]:height=[0-9]"); - return false; -#endif - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::connect: " - "Unable to get screen size!", result); - return false; - } - } - - - dw = w; - dh = h; - - Q_ASSERT(dw != 0 && dh != 0); - - physWidth = physHeight = -1; - setIntOption(displayArgs, QLatin1String("mmWidth"), &physWidth); - setIntOption(displayArgs, QLatin1String("mmHeight"), &physHeight); - const int dpi = 72; - if (physWidth < 0) - physWidth = qRound(dw * 25.4 / dpi); - if (physHeight < 0) - physHeight = qRound(dh * 25.4 / dpi); - - setGraphicsSystem(d_ptr); - -#if (Q_DIRECTFB_VERSION >= 0x000923) - if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive)) - printDirectFBInfo(d_ptr->dfb, surface); -#endif -#ifdef QT_DIRECTFB_WM - surface->Release(surface); - QColor backgroundColor; -#else - QColor &backgroundColor = d_ptr->backgroundColor; -#endif - - QRegExp backgroundColorRegExp(QLatin1String("bgcolor=(.+)")); - backgroundColorRegExp.setCaseSensitivity(Qt::CaseInsensitive); - if (displayArgs.indexOf(backgroundColorRegExp) != -1) { - backgroundColor = colorFromName(backgroundColorRegExp.cap(1)); - } -#ifdef QT_NO_DIRECTFB_WM - if (!backgroundColor.isValid()) - backgroundColor = Qt::green; - d_ptr->primarySurface->Clear(d_ptr->primarySurface, backgroundColor.red(), - backgroundColor.green(), backgroundColor.blue(), - backgroundColor.alpha()); - d_ptr->primarySurface->Flip(d_ptr->primarySurface, 0, d_ptr->flipFlags); -#else - if (backgroundColor.isValid()) { - DFBResult result = d_ptr->dfbLayer->SetCooperativeLevel(d_ptr->dfbLayer, DLSCL_ADMINISTRATIVE); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::connect " - "Unable to set cooperative level", result); - } - result = d_ptr->dfbLayer->SetBackgroundColor(d_ptr->dfbLayer, backgroundColor.red(), backgroundColor.green(), - backgroundColor.blue(), backgroundColor.alpha()); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::connect: " - "Unable to set background color", result); - } - - result = d_ptr->dfbLayer->SetBackgroundMode(d_ptr->dfbLayer, DLBM_COLOR); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::connect: " - "Unable to set background mode", result); - } - - result = d_ptr->dfbLayer->SetCooperativeLevel(d_ptr->dfbLayer, DLSCL_SHARED); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::connect " - "Unable to set cooperative level", result); - } - - } -#endif - - return true; -} - -void QDirectFBScreen::disconnect() -{ -#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE - if (d_ptr->imageProvider) - d_ptr->imageProvider->Release(d_ptr->imageProvider); -#endif -#ifdef QT_NO_DIRECTFB_WM - d_ptr->primarySurface->Release(d_ptr->primarySurface); - d_ptr->primarySurface = 0; -#endif - - foreach (IDirectFBSurface *surf, d_ptr->allocatedSurfaces) - surf->Release(surf); - d_ptr->allocatedSurfaces.clear(); - -#ifndef QT_NO_DIRECTFB_LAYER - d_ptr->dfbLayer->Release(d_ptr->dfbLayer); - d_ptr->dfbLayer = 0; -#endif - - d_ptr->dfbScreen->Release(d_ptr->dfbScreen); - d_ptr->dfbScreen = 0; - - d_ptr->dfb->Release(d_ptr->dfb); - d_ptr->dfb = 0; -} - -bool QDirectFBScreen::initDevice() -{ -#ifndef QT_NO_DIRECTFB_MOUSE - if (qgetenv("QWS_MOUSE_PROTO").isEmpty()) { - QWSServer::instance()->setDefaultMouse("None"); - d_ptr->mouse = new QDirectFBMouseHandler; - } -#endif -#ifndef QT_NO_DIRECTFB_KEYBOARD - if (qgetenv("QWS_KEYBOARD").isEmpty()) { - QWSServer::instance()->setDefaultKeyboard("None"); - d_ptr->keyboard = new QDirectFBKeyboardHandler(QString()); - } -#endif - -#ifdef QT_DIRECTFB_CURSOR - qt_screencursor = new QDirectFBScreenCursor; -#elif !defined QT_NO_QWS_CURSOR - QScreenCursor::initSoftwareCursor(); -#endif - return true; -} - -void QDirectFBScreen::shutdownDevice() -{ -#ifndef QT_NO_DIRECTFB_MOUSE - delete d_ptr->mouse; - d_ptr->mouse = 0; -#endif -#ifndef QT_NO_DIRECTFB_KEYBOARD - delete d_ptr->keyboard; - d_ptr->keyboard = 0; -#endif - -#ifndef QT_NO_QWS_CURSOR - delete qt_screencursor; - qt_screencursor = 0; -#endif -} - -void QDirectFBScreen::setMode(int width, int height, int depth) -{ - d_ptr->dfb->SetVideoMode(d_ptr->dfb, width, height, depth); -} - -void QDirectFBScreen::blank(bool on) -{ - d_ptr->dfbScreen->SetPowerMode(d_ptr->dfbScreen, - (on ? DSPM_ON : DSPM_SUSPEND)); -} - -QWSWindowSurface *QDirectFBScreen::createSurface(QWidget *widget) const -{ -#ifdef QT_NO_DIRECTFB_WM - if (QApplication::type() == QApplication::GuiServer) { - return new QDirectFBWindowSurface(d_ptr->flipFlags, const_cast(this), widget); - } else { - return QScreen::createSurface(widget); - } -#else - return new QDirectFBWindowSurface(d_ptr->flipFlags, const_cast(this), widget); -#endif -} - -QWSWindowSurface *QDirectFBScreen::createSurface(const QString &key) const -{ - if (key == QLatin1String("directfb")) { - return new QDirectFBWindowSurface(d_ptr->flipFlags, const_cast(this)); - } - return QScreen::createSurface(key); -} - -#if defined QT_NO_DIRECTFB_WM -struct PaintCommand { - PaintCommand() : dfbSurface(0), windowOpacity(255), blittingFlags(DSBLIT_NOFX) {} - IDirectFBSurface *dfbSurface; - QImage image; - QPoint windowPosition; - QRegion source; - quint8 windowOpacity; - DFBSurfaceBlittingFlags blittingFlags; -}; - -static inline void initParameters(DFBRectangle &source, const QRect &sourceGlobal, const QPoint &pos) -{ - source.x = sourceGlobal.x() - pos.x(); - source.y = sourceGlobal.y() - pos.y(); - source.w = sourceGlobal.width(); - source.h = sourceGlobal.height(); -} -#endif - -void QDirectFBScreen::exposeRegion(QRegion r, int) -{ - Q_UNUSED(r); -#if defined QT_NO_DIRECTFB_WM - - r &= region(); - if (r.isEmpty()) { - return; - } - r = r.boundingRect(); - - IDirectFBSurface *primary = d_ptr->primarySurface; - const QList windows = QWSServer::instance()->clientWindows(); - QVarLengthArray commands(windows.size()); - QRegion region = r; - int idx = 0; - for (int i=0; iwindowSurface(); - if (!surface) - continue; - - const QRect windowGeometry = surface->geometry(); - const QRegion intersection = region & windowGeometry; - if (intersection.isEmpty()) { - continue; - } - - PaintCommand &cmd = commands[idx]; - - if (surface->key() == QLatin1String("directfb")) { - const QDirectFBWindowSurface *ws = static_cast(surface); - cmd.dfbSurface = ws->directFBSurface(); - - if (!cmd.dfbSurface) { - continue; - } - } else { - cmd.image = surface->image(); - if (cmd.image.isNull()) { - continue; - } - } - ++idx; - - cmd.windowPosition = windowGeometry.topLeft(); - cmd.source = intersection; - if (windows.at(i)->isOpaque()) { - region -= intersection; - if (region.isEmpty()) - break; - } else { - cmd.windowOpacity = windows.at(i)->opacity(); - cmd.blittingFlags = cmd.windowOpacity == 255 - ? DSBLIT_BLEND_ALPHACHANNEL - : (DSBLIT_BLEND_ALPHACHANNEL|DSBLIT_BLEND_COLORALPHA); - } - } - - solidFill(d_ptr->backgroundColor, region); - - while (idx > 0) { - const PaintCommand &cmd = commands[--idx]; - Q_ASSERT(cmd.dfbSurface || !cmd.image.isNull()); - IDirectFBSurface *surface; - if (cmd.dfbSurface) { - surface = cmd.dfbSurface; - } else { - Q_ASSERT(!cmd.image.isNull()); - DFBResult result; - surface = createDFBSurface(cmd.image, cmd.image.format(), DontTrackSurface, &result); - Q_ASSERT((result != DFB_OK) == !surface); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::exposeRegion: Can't create surface from image", result); - continue; - } - } - - primary->SetBlittingFlags(primary, cmd.blittingFlags); - if (cmd.blittingFlags & DSBLIT_BLEND_COLORALPHA) { - primary->SetColor(primary, 0xff, 0xff, 0xff, cmd.windowOpacity); - } - const QRegion ®ion = cmd.source; - const int rectCount = region.rectCount(); - DFBRectangle source; - if (rectCount == 1) { - ::initParameters(source, region.boundingRect(), cmd.windowPosition); - primary->Blit(primary, surface, &source, cmd.windowPosition.x() + source.x, cmd.windowPosition.y() + source.y); - } else { - const QVector rects = region.rects(); - for (int i=0; iBlit(primary, surface, &source, cmd.windowPosition.x() + source.x, cmd.windowPosition.y() + source.y); - } - } - if (surface != cmd.dfbSurface) { - surface->Release(surface); - } - } - - primary->SetColor(primary, 0xff, 0xff, 0xff, 0xff); - -#if defined QT_NO_DIRECTFB_CURSOR and !defined QT_NO_QWS_CURSOR - if (QScreenCursor *cursor = QScreenCursor::instance()) { - const QRect cursorRectangle = cursor->boundingRect(); - if (cursor->isVisible() && !cursor->isAccelerated() && r.intersects(cursorRectangle)) { - const QImage image = cursor->image(); - if (image.cacheKey() != d_ptr->cursorImageKey) { - if (d_ptr->cursorSurface) { - releaseDFBSurface(d_ptr->cursorSurface); - } - d_ptr->cursorSurface = createDFBSurface(image, image.format(), QDirectFBScreen::TrackSurface); - d_ptr->cursorImageKey = image.cacheKey(); - } - - Q_ASSERT(d_ptr->cursorSurface); - primary->SetBlittingFlags(primary, DSBLIT_BLEND_ALPHACHANNEL); - primary->Blit(primary, d_ptr->cursorSurface, 0, cursorRectangle.x(), cursorRectangle.y()); - } - } -#endif - flipSurface(primary, d_ptr->flipFlags, r, QPoint()); - primary->SetBlittingFlags(primary, DSBLIT_NOFX); -#endif -} - -void QDirectFBScreen::solidFill(const QColor &color, const QRegion ®ion) -{ -#ifdef QT_DIRECTFB_WM - Q_UNUSED(color); - Q_UNUSED(region); -#else - QDirectFBScreen::solidFill(d_ptr->primarySurface, color, region); -#endif -} - -static inline void clearRect(IDirectFBSurface *surface, const QColor &color, const QRect &rect) -{ - Q_ASSERT(surface); - const DFBRegion region = { rect.left(), rect.top(), rect.right(), rect.bottom() }; - // could just reinterpret_cast this to a DFBRegion - surface->SetClip(surface, ®ion); - surface->Clear(surface, color.red(), color.green(), color.blue(), color.alpha()); -} - -void QDirectFBScreen::solidFill(IDirectFBSurface *surface, const QColor &color, const QRegion ®ion) -{ - if (region.isEmpty()) - return; - - const int n = region.rectCount(); - if (n == 1) { - clearRect(surface, color, region.boundingRect()); - } else { - const QVector rects = region.rects(); - for (int i=0; iSetClip(surface, 0); -} - -QImage::Format QDirectFBScreen::alphaPixmapFormat() const -{ - return d_ptr->alphaPixmapFormat; -} - -bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description, - QImage::Format format) -{ - const DFBSurfacePixelFormat pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); - if (pixelformat == DSPF_UNKNOWN) - return false; - description->flags |= DSDESC_PIXELFORMAT; - description->pixelformat = pixelformat; - if (QDirectFBScreen::isPremultiplied(format)) { - if (!(description->flags & DSDESC_CAPS)) { - description->caps = DSCAPS_PREMULTIPLIED; - description->flags |= DSDESC_CAPS; - } else { - description->caps |= DSCAPS_PREMULTIPLIED; - } - } - return true; -} - -uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl) -{ - void *mem = 0; - const DFBResult result = surface->Lock(surface, flags, &mem, bpl); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::lockSurface()", result); - } - - return reinterpret_cast(mem); -} - -static inline bool isFullUpdate(IDirectFBSurface *surface, const QRegion ®ion, const QPoint &offset) -{ - if (offset == QPoint(0, 0) && region.rectCount() == 1) { - QSize size; - surface->GetSize(surface, &size.rwidth(), &size.rheight()); - if (region.boundingRect().size() == size) - return true; - } - return false; -} - -void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags, - const QRegion ®ion, const QPoint &offset) -{ - if (d_ptr->directFBFlags & NoPartialFlip - || (!(flipFlags & DSFLIP_BLIT) && QT_PREPEND_NAMESPACE(isFullUpdate(surface, region, offset)))) { - surface->Flip(surface, 0, flipFlags); - } else { - if (!(d_ptr->directFBFlags & BoundingRectFlip) && region.rectCount() > 1) { - const QVector rects = region.rects(); - const DFBSurfaceFlipFlags nonWaitFlags = flipFlags & ~DSFLIP_WAIT; - for (int i=0; iFlip(surface, &dfbReg, i + 1 < rects.size() ? nonWaitFlags : flipFlags); - } - } else { - const QRect r = region.boundingRect(); - const DFBRegion dfbReg = { r.x() + offset.x(), r.y() + offset.y(), - r.right() + offset.x(), - r.bottom() + offset.y() }; - surface->Flip(surface, &dfbReg, flipFlags); - } - } -} - -#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE -void QDirectFBScreen::setDirectFBImageProvider(IDirectFBImageProvider *provider) -{ - Q_ASSERT(provider); - if (d_ptr->imageProvider) - d_ptr->imageProvider->Release(d_ptr->imageProvider); - d_ptr->imageProvider = provider; -} -#endif - -void QDirectFBScreen::waitIdle() -{ - d_ptr->dfb->WaitIdle(d_ptr->dfb); -} - -#ifdef QT_DIRECTFB_WM -IDirectFBWindow *QDirectFBScreen::windowForWidget(const QWidget *widget) const -{ - if (widget) { - const QWSWindowSurface *surface = static_cast(widget->windowSurface()); - if (surface && surface->key() == QLatin1String("directfb")) { - return static_cast(surface)->directFBWindow(); - } - } - return 0; -} -#endif - -IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRect *rect) const -{ - Q_ASSERT(widget); - if (!widget->isVisible() || widget->size().isNull()) - return 0; - - const QWSWindowSurface *surface = static_cast(widget->windowSurface()); - if (surface && surface->key() == QLatin1String("directfb")) { - return static_cast(surface)->surfaceForWidget(widget, rect); - } - return 0; -} - -#ifdef QT_DIRECTFB_SUBSURFACE -IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, const QRect &area) const -{ - Q_ASSERT(widget); - QRect rect; - IDirectFBSurface *surface = surfaceForWidget(widget, &rect); - IDirectFBSurface *subSurface = 0; - if (surface) { - if (!area.isNull()) - rect &= area.translated(widget->mapTo(widget->window(), QPoint(0, 0))); - if (!rect.isNull()) { - const DFBRectangle subRect = { rect.x(), rect.y(), rect.width(), rect.height() }; - const DFBResult result = surface->GetSubSurface(surface, &subRect, &subSurface); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreen::subSurface(): Can't get sub surface", result); - } - } - } - return subSurface; -} -#endif - -Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_widget(const QWidget *widget, QRect *rect) -{ - return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->surfaceForWidget(widget, rect) : 0; -} -#ifdef QT_DIRECTFB_SUBSURFACE -Q_GUI_EXPORT IDirectFBSurface *qt_directfb_subsurface_for_widget(const QWidget *widget, const QRect &area) -{ - return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->subSurfaceForWidget(widget, area) : 0; -} -#endif -#ifdef QT_DIRECTFB_WM -Q_GUI_EXPORT IDirectFBWindow *qt_directfb_window_for_widget(const QWidget *widget) -{ - return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->windowForWidget(widget) : 0; -} - -#endif - -QT_END_NAMESPACE - -#include "qdirectfbscreen.moc" -#endif // QT_NO_QWS_DIRECTFB - diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h deleted file mode 100644 index afc153bab21..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ /dev/null @@ -1,303 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDIRECTFBSCREEN_H -#define QDIRECTFBSCREEN_H - -#include -#ifndef QT_NO_QWS_DIRECTFB -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#if !defined QT_DIRECTFB_SUBSURFACE && !defined QT_NO_DIRECTFB_SUBSURFACE -#define QT_NO_DIRECTFB_SUBSURFACE -#endif -#if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER -#define QT_DIRECTFB_LAYER -#endif -#if !defined QT_NO_DIRECTFB_WM && !defined QT_DIRECTFB_WM -#define QT_DIRECTFB_WM -#endif -#if !defined QT_DIRECTFB_IMAGECACHE && !defined QT_NO_DIRECTFB_IMAGECACHE -#define QT_NO_DIRECTFB_IMAGECACHE -#endif -#if !defined QT_NO_DIRECTFB_IMAGEPROVIDER && !defined QT_DIRECTFB_IMAGEPROVIDER -#define QT_DIRECTFB_IMAGEPROVIDER -#endif -#if !defined QT_NO_DIRECTFB_STRETCHBLIT && !defined QT_DIRECTFB_STRETCHBLIT -#define QT_DIRECTFB_STRETCHBLIT -#endif -#if !defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && !defined QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE -#define QT_NO_DIRECTFB_IMAGEPROVIDER_KEEPALIVE -#endif -#if !defined QT_DIRECTFB_WINDOW_AS_CURSOR && !defined QT_NO_DIRECTFB_WINDOW_AS_CURSOR -#define QT_NO_DIRECTFB_WINDOW_AS_CURSOR -#endif -#if !defined QT_DIRECTFB_PALETTE && !defined QT_NO_DIRECTFB_PALETTE -#define QT_NO_DIRECTFB_PALETTE -#endif -#if !defined QT_NO_DIRECTFB_PREALLOCATED && !defined QT_DIRECTFB_PREALLOCATED -#define QT_DIRECTFB_PREALLOCATED -#endif -#if !defined QT_NO_DIRECTFB_MOUSE && !defined QT_DIRECTFB_MOUSE -#define QT_DIRECTFB_MOUSE -#endif -#if !defined QT_NO_DIRECTFB_KEYBOARD && !defined QT_DIRECTFB_KEYBOARD -#define QT_DIRECTFB_KEYBOARD -#endif -#if !defined QT_NO_DIRECTFB_OPAQUE_DETECTION && !defined QT_DIRECTFB_OPAQUE_DETECTION -#define QT_DIRECTFB_OPAQUE_DETECTION -#endif -#ifndef QT_NO_QWS_CURSOR -#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR -#define QT_DIRECTFB_CURSOR -#elif defined QT_DIRECTFB_LAYER -#define QT_DIRECTFB_CURSOR -#endif -#endif -#ifndef QT_DIRECTFB_CURSOR -#define QT_NO_DIRECTFB_CURSOR -#endif -#if defined QT_NO_DIRECTFB_LAYER && defined QT_DIRECTFB_WM -#error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM -#endif -#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE && defined QT_NO_DIRECTFB_IMAGEPROVIDER -#error QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE requires QT_DIRECTFB_IMAGEPROVIDER to be defined -#endif -#if defined QT_DIRECTFB_WINDOW_AS_CURSOR && defined QT_NO_DIRECTFB_WM -#error QT_DIRECTFB_WINDOW_AS_CURSOR requires QT_DIRECTFB_WM to be defined -#endif - -#define Q_DIRECTFB_VERSION ((DIRECTFB_MAJOR_VERSION << 16) | (DIRECTFB_MINOR_VERSION << 8) | DIRECTFB_MICRO_VERSION) - -#define DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(F) \ - static inline F operator~(F f) { return F(~int(f)); } \ - static inline F operator&(F left, F right) { return F(int(left) & int(right)); } \ - static inline F operator|(F left, F right) { return F(int(left) | int(right)); } \ - static inline F &operator|=(F &left, F right) { left = (left | right); return left; } \ - static inline F &operator&=(F &left, F right) { left = (left & right); return left; } - -DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBInputDeviceCapabilities); -DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowDescriptionFlags); -DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowCapabilities); -DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBWindowOptions); -DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceDescriptionFlags); -DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceCapabilities); -DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceLockFlags); -DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceBlittingFlags); -DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceDrawingFlags); -DIRECTFB_DECLARE_OPERATORS_FOR_FLAGS(DFBSurfaceFlipFlags); - -class QDirectFBScreenPrivate; -class Q_GUI_EXPORT QDirectFBScreen : public QScreen -{ -public: - QDirectFBScreen(int display_id); - ~QDirectFBScreen(); - - enum DirectFBFlag { - NoFlags = 0x00, - VideoOnly = 0x01, - SystemOnly = 0x02, - BoundingRectFlip = 0x04, - NoPartialFlip = 0x08 - }; - - Q_DECLARE_FLAGS(DirectFBFlags, DirectFBFlag); - - DirectFBFlags directFBFlags() const; - - bool connect(const QString &displaySpec); - void disconnect(); - bool initDevice(); - void shutdownDevice(); - - void exposeRegion(QRegion r, int changing); - void solidFill(const QColor &color, const QRegion ®ion); - static void solidFill(IDirectFBSurface *surface, const QColor &color, const QRegion ®ion); - - void setMode(int width, int height, int depth); - void blank(bool on); - - QWSWindowSurface *createSurface(QWidget *widget) const; - QWSWindowSurface *createSurface(const QString &key) const; - - static QDirectFBScreen *instance(); - void waitIdle(); - IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; -#ifdef QT_DIRECTFB_SUBSURFACE - IDirectFBSurface *subSurfaceForWidget(const QWidget *widget, const QRect &area = QRect()) const; -#endif - IDirectFB *dfb(); -#ifdef QT_DIRECTFB_WM - IDirectFBWindow *windowForWidget(const QWidget *widget) const; -#else - IDirectFBSurface *primarySurface(); -#endif -#ifndef QT_NO_DIRECTFB_LAYER - IDirectFBDisplayLayer *dfbDisplayLayer(); -#endif - - // Track surface creation/release so we can release all on exit - enum SurfaceCreationOption { - DontTrackSurface = 0x1, - TrackSurface = 0x2, - NoPreallocated = 0x4 - }; - Q_DECLARE_FLAGS(SurfaceCreationOptions, SurfaceCreationOption); - IDirectFBSurface *createDFBSurface(const QImage &image, - QImage::Format format, - SurfaceCreationOptions options, - DFBResult *result = 0); - IDirectFBSurface *createDFBSurface(const QSize &size, - QImage::Format format, - SurfaceCreationOptions options, - DFBResult *result = 0); - IDirectFBSurface *copyDFBSurface(IDirectFBSurface *src, - QImage::Format format, - SurfaceCreationOptions options, - DFBResult *result = 0); - IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc, - SurfaceCreationOptions options, - DFBResult *result); -#ifdef QT_DIRECTFB_SUBSURFACE - IDirectFBSurface *getSubSurface(IDirectFBSurface *surface, - const QRect &rect, - SurfaceCreationOptions options, - DFBResult *result); -#endif - - void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags, - const QRegion ®ion, const QPoint &offset); - void releaseDFBSurface(IDirectFBSurface *surface); - - using QScreen::depth; - static int depth(DFBSurfacePixelFormat format); - static int depth(QImage::Format format); - - static DFBSurfacePixelFormat getSurfacePixelFormat(QImage::Format format); - static DFBSurfaceDescription getSurfaceDescription(const uint *buffer, - int length); - static QImage::Format getImageFormat(IDirectFBSurface *surface); - static bool initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *description, QImage::Format format); - static inline bool isPremultiplied(QImage::Format format); - static inline bool hasAlphaChannel(DFBSurfacePixelFormat format); - static inline bool hasAlphaChannel(IDirectFBSurface *surface); - QImage::Format alphaPixmapFormat() const; - -#ifndef QT_NO_DIRECTFB_PALETTE - static void setSurfaceColorTable(IDirectFBSurface *surface, - const QImage &image); -#endif - - static uchar *lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl = 0); -#if defined QT_DIRECTFB_IMAGEPROVIDER && defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE - void setDirectFBImageProvider(IDirectFBImageProvider *provider); -#endif -private: - QDirectFBScreenPrivate *d_ptr; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::SurfaceCreationOptions); -Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::DirectFBFlags); - -inline bool QDirectFBScreen::isPremultiplied(QImage::Format format) -{ - switch (format) { - 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: - return true; - default: - break; - } - return false; -} - -inline bool QDirectFBScreen::hasAlphaChannel(DFBSurfacePixelFormat format) -{ - switch (format) { - case DSPF_ARGB1555: - case DSPF_ARGB: - case DSPF_LUT8: - case DSPF_AiRGB: - case DSPF_A1: - case DSPF_ARGB2554: - case DSPF_ARGB4444: -#if (Q_DIRECTFB_VERSION >= 0x000923) - case DSPF_AYUV: -#endif -#if (Q_DIRECTFB_VERSION >= 0x010000) - case DSPF_A4: - case DSPF_ARGB1666: - case DSPF_ARGB6666: - case DSPF_LUT2: -#endif - return true; - default: - return false; - } -} - -inline bool QDirectFBScreen::hasAlphaChannel(IDirectFBSurface *surface) -{ - Q_ASSERT(surface); - DFBSurfacePixelFormat format; - surface->GetPixelFormat(surface, &format); - return QDirectFBScreen::hasAlphaChannel(format); -} - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_QWS_DIRECTFB -#endif // QDIRECTFBSCREEN_H - diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp deleted file mode 100644 index 228e7b8dea5..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectfbscreen.h" - -#include -#include -#ifndef QT_NO_QWS_DIRECTFB - -class DirectFBScreenDriverPlugin : public QScreenDriverPlugin -{ -public: - DirectFBScreenDriverPlugin(); - - QStringList keys() const; - QScreen *create(const QString&, int displayId); -}; - -DirectFBScreenDriverPlugin::DirectFBScreenDriverPlugin() - : QScreenDriverPlugin() -{ -} - -QStringList DirectFBScreenDriverPlugin::keys() const -{ - return (QStringList() << "directfb"); -} - -QScreen* DirectFBScreenDriverPlugin::create(const QString& driver, - int displayId) -{ - if (driver.toLower() != "directfb") - return 0; - - return new QDirectFBScreen(displayId); -} - -Q_EXPORT_PLUGIN2(qdirectfbscreen, DirectFBScreenDriverPlugin) - -#endif diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp deleted file mode 100644 index b8fc811e4d9..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ /dev/null @@ -1,506 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectfbwindowsurface.h" -#include "qdirectfbscreen.h" -#include "qdirectfbpaintengine.h" - -#include -#include -#include -#include -#include - -#ifndef QT_NO_QWS_DIRECTFB - -QT_BEGIN_NAMESPACE - -QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr) - : QDirectFBPaintDevice(scr) -#ifndef QT_NO_DIRECTFB_WM - , dfbWindow(0) -#endif - , flipFlags(flip) - , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) - , flushPending(false) -{ -#ifdef QT_NO_DIRECTFB_WM - mode = Offscreen; -#endif - setSurfaceFlags(Opaque | Buffered); -#ifdef QT_DIRECTFB_TIMING - frames = 0; - timer.start(); -#endif -} - -QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget) - : QWSWindowSurface(widget), QDirectFBPaintDevice(scr) -#ifndef QT_NO_DIRECTFB_WM - , dfbWindow(0) -#endif - , flipFlags(flip) - , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) - , flushPending(false) -{ - SurfaceFlags flags = 0; - if (!widget || widget->window()->windowOpacity() == 0xff) - flags |= Opaque; -#ifdef QT_NO_DIRECTFB_WM - if (widget && widget->testAttribute(Qt::WA_PaintOnScreen)) { - flags = RegionReserved; - mode = Primary; - } else { - mode = Offscreen; - flags = Buffered; - } -#endif - setSurfaceFlags(flags); -#ifdef QT_DIRECTFB_TIMING - frames = 0; - timer.start(); -#endif -} - -QDirectFBWindowSurface::~QDirectFBWindowSurface() -{ - releaseSurface(); - // these are not tracked by QDirectFBScreen so we don't want QDirectFBPaintDevice to release it -} - -bool QDirectFBWindowSurface::isValid() const -{ - return true; -} - -#ifdef QT_DIRECTFB_WM -void QDirectFBWindowSurface::raise() -{ - if (IDirectFBWindow *window = directFBWindow()) { - window->RaiseToTop(window); - } -} - -IDirectFBWindow *QDirectFBWindowSurface::directFBWindow() const -{ - return dfbWindow; -} - -void QDirectFBWindowSurface::createWindow(const QRect &rect) -{ - IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer(); - if (!layer) - qFatal("QDirectFBWindowSurface: Unable to get primary display layer!"); - - updateIsOpaque(); - - DFBWindowDescription description; - memset(&description, 0, sizeof(DFBWindowDescription)); - - description.flags = DWDESC_CAPS|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT; - description.caps = DWCAPS_NODECORATION; - description.surface_caps = DSCAPS_NONE; - imageFormat = screen->pixelFormat(); - - if (!(surfaceFlags() & Opaque)) { - imageFormat = screen->alphaPixmapFormat(); - description.caps |= DWCAPS_ALPHACHANNEL; -#if (Q_DIRECTFB_VERSION >= 0x010200) - description.flags |= DWDESC_OPTIONS; - description.options |= DWOP_ALPHACHANNEL; -#endif - } - description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(imageFormat); - description.posx = rect.x(); - description.posy = rect.y(); - description.width = rect.width(); - description.height = rect.height(); - - if (QDirectFBScreen::isPremultiplied(imageFormat)) - description.surface_caps = DSCAPS_PREMULTIPLIED; - - if (screen->directFBFlags() & QDirectFBScreen::VideoOnly) - description.surface_caps |= DSCAPS_VIDEOONLY; - - DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow); - - if (result != DFB_OK) - DirectFBErrorFatal("QDirectFBWindowSurface::createWindow", result); - - if (window()) { - if (window()->windowFlags() & Qt::WindowStaysOnTopHint) { - dfbWindow->SetStackingClass(dfbWindow, DWSC_UPPER); - } - DFBWindowID winid; - result = dfbWindow->GetID(dfbWindow, &winid); - if (result != DFB_OK) { - DirectFBError("QDirectFBWindowSurface::createWindow. Can't get ID", result); - } else { - window()->setProperty("_q_DirectFBWindowID", winid); - } - } - - Q_ASSERT(!dfbSurface); - dfbWindow->GetSurface(dfbWindow, &dfbSurface); -} - -static DFBResult setWindowGeometry(IDirectFBWindow *dfbWindow, const QRect &old, const QRect &rect) -{ - DFBResult result = DFB_OK; - const bool isMove = old.isEmpty() || rect.topLeft() != old.topLeft(); - const bool isResize = rect.size() != old.size(); - -#if (Q_DIRECTFB_VERSION >= 0x010000) - if (isResize && isMove) { - result = dfbWindow->SetBounds(dfbWindow, rect.x(), rect.y(), - rect.width(), rect.height()); - } else if (isResize) { - result = dfbWindow->Resize(dfbWindow, - rect.width(), rect.height()); - } else if (isMove) { - result = dfbWindow->MoveTo(dfbWindow, rect.x(), rect.y()); - } -#else - if (isResize) { - result = dfbWindow->Resize(dfbWindow, - rect.width(), rect.height()); - } - if (isMove) { - result = dfbWindow->MoveTo(dfbWindow, rect.x(), rect.y()); - } -#endif - return result; -} -#endif // QT_NO_DIRECTFB_WM - -void QDirectFBWindowSurface::setGeometry(const QRect &rect) -{ - const QRect oldRect = geometry(); - if (oldRect == rect) - return; - - IDirectFBSurface *oldSurface = dfbSurface; - const bool sizeChanged = oldRect.size() != rect.size(); - if (sizeChanged) { - delete engine; - engine = 0; - releaseSurface(); - Q_ASSERT(!dfbSurface); - } - - if (rect.isNull()) { -#ifndef QT_NO_DIRECTFB_WM - if (dfbWindow) { - if (window()) - window()->setProperty("_q_DirectFBWindowID", QVariant()); - - dfbWindow->Release(dfbWindow); - dfbWindow = 0; - } -#endif - Q_ASSERT(!dfbSurface); -#ifdef QT_DIRECTFB_SUBSURFACE - Q_ASSERT(!subSurface); -#endif - } else { -#ifdef QT_DIRECTFB_WM - if (!dfbWindow) { - createWindow(rect); - } else { - setWindowGeometry(dfbWindow, oldRect, rect); - Q_ASSERT(!sizeChanged || !dfbSurface); - if (sizeChanged) - dfbWindow->GetSurface(dfbWindow, &dfbSurface); - } -#else - IDirectFBSurface *primarySurface = screen->primarySurface(); - DFBResult result = DFB_OK; - if (mode == Primary) { - Q_ASSERT(primarySurface); - if (rect == screen->region().boundingRect()) { - dfbSurface = primarySurface; - } else { - const DFBRectangle r = { rect.x(), rect.y(), - rect.width(), rect.height() }; - result = primarySurface->GetSubSurface(primarySurface, &r, &dfbSurface); - } - } else { // mode == Offscreen - if (!dfbSurface) { - dfbSurface = screen->createDFBSurface(rect.size(), surfaceFlags() & Opaque ? screen->pixelFormat() : screen->alphaPixmapFormat(), - QDirectFBScreen::DontTrackSurface); - } - } - if (result != DFB_OK) - DirectFBErrorFatal("QDirectFBWindowSurface::setGeometry()", result); -#endif - } - if (oldSurface != dfbSurface) { - imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; - } - - if (oldRect.size() != rect.size()) { - QWSWindowSurface::setGeometry(rect); - } else { - QWindowSurface::setGeometry(rect); - } -} - -QByteArray QDirectFBWindowSurface::permanentState() const -{ - QByteArray state(sizeof(SurfaceFlags) + sizeof(DFBWindowID), 0); - char *ptr = state.data(); - SurfaceFlags flags = surfaceFlags(); - memcpy(ptr, &flags, sizeof(SurfaceFlags)); - ptr += sizeof(SurfaceFlags); - DFBWindowID did = (DFBWindowID)(-1); - if (dfbWindow) - dfbWindow->GetID(dfbWindow, &did); - memcpy(ptr, &did, sizeof(DFBWindowID)); - return state; -} - -void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) -{ - const char *ptr = state.constData(); - IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer(); - SurfaceFlags flags; - memcpy(&flags, ptr, sizeof(SurfaceFlags)); - - setSurfaceFlags(flags); - ptr += sizeof(SurfaceFlags); - DFBWindowID id; - memcpy(&id, ptr, sizeof(DFBWindowID)); - if (dfbSurface) - dfbSurface->Release(dfbSurface); - if (id != (DFBWindowID)-1) { - IDirectFBWindow *dw; - layer->GetWindow(layer, id, &dw); - if (dw->GetSurface(dw, &dfbSurface) != DFB_OK) - dfbSurface = 0; - dw->Release(dw); - } - else { - dfbSurface = 0; - } -} - -bool QDirectFBWindowSurface::scroll(const QRegion ®ion, int dx, int dy) -{ - if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.rectCount() != 1) - return false; - if (flushPending) { - dfbSurface->Flip(dfbSurface, 0, DSFLIP_BLIT); - } else { - flushPending = true; - } - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - const QRect r = region.boundingRect(); - const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; - dfbSurface->Blit(dfbSurface, dfbSurface, &rect, r.x() + dx, r.y() + dy); - return true; -} - -bool QDirectFBWindowSurface::move(const QPoint &moveBy) -{ - setGeometry(geometry().translated(moveBy)); - return true; -} - -void QDirectFBWindowSurface::setOpaque(bool opaque) -{ - SurfaceFlags flags = surfaceFlags(); - if (opaque != (flags & Opaque)) { - if (opaque) { - flags |= Opaque; - } else { - flags &= ~Opaque; - } - setSurfaceFlags(flags); - } -} - - -void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, - const QPoint &offset) -{ - QWidget *win = window(); - if (!win) - return; - -#if !defined(QT_NO_QWS_PROXYSCREEN) && !defined(QT_NO_GRAPHICSVIEW) - QWExtra *extra = qt_widget_private(widget)->extraData(); - if (extra && extra->proxyWidget) - return; -#else - Q_UNUSED(widget); -#endif - - const quint8 windowOpacity = quint8(win->windowOpacity() * 0xff); - const QRect windowGeometry = geometry(); -#ifdef QT_DIRECTFB_WM - quint8 currentOpacity; - Q_ASSERT(dfbWindow); - dfbWindow->GetOpacity(dfbWindow, ¤tOpacity); - if (currentOpacity != windowOpacity) { - dfbWindow->SetOpacity(dfbWindow, windowOpacity); - } - - screen->flipSurface(dfbSurface, flipFlags, region, offset); -#else - setOpaque(windowOpacity == 0xff); - if (mode == Offscreen) { - screen->exposeRegion(region.translated(offset + geometry().topLeft()), 0); - } else { - screen->flipSurface(dfbSurface, flipFlags, region, offset); - } -#endif - -#ifdef QT_DIRECTFB_TIMING - enum { Secs = 3 }; - ++frames; - if (timer.elapsed() >= Secs * 1000) { - qDebug("%d fps", int(double(frames) / double(Secs))); - frames = 0; - timer.restart(); - } -#endif - flushPending = false; -} - -void QDirectFBWindowSurface::beginPaint(const QRegion ®ion) -{ - if (!engine) { - engine = new QDirectFBPaintEngine(this); - } - - if (dfbSurface) { - const QWidget *win = window(); - if (win && win->testAttribute(Qt::WA_NoSystemBackground)) { - QDirectFBScreen::solidFill(dfbSurface, Qt::transparent, region); - } - } - flushPending = true; -} - -void QDirectFBWindowSurface::endPaint(const QRegion &) -{ -#ifdef QT_NO_DIRECTFB_SUBSURFACE - unlockSurface(); -#endif -} - -IDirectFBSurface *QDirectFBWindowSurface::directFBSurface() const -{ - return dfbSurface; -} - - -IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const -{ - Q_ASSERT(widget); - if (!dfbSurface) - return 0; - QWidget *win = window(); - Q_ASSERT(win); - if (rect) { - if (win == widget) { - *rect = widget->rect(); - } else { - *rect = QRect(widget->mapTo(win, QPoint(0, 0)), widget->size()); - } - } - - Q_ASSERT(win == widget || win->isAncestorOf(widget)); - return dfbSurface; -} - -void QDirectFBWindowSurface::releaseSurface() -{ - if (dfbSurface) { -#ifdef QT_DIRECTFB_SUBSURFACE - releaseSubSurface(); -#else - unlockSurface(); -#endif -#ifdef QT_NO_DIRECTFB_WM - Q_ASSERT(screen->primarySurface()); - if (dfbSurface != screen->primarySurface()) -#endif - - dfbSurface->Release(dfbSurface); - dfbSurface = 0; - } -} - -void QDirectFBWindowSurface::updateIsOpaque() -{ - const QWidget *win = window(); - Q_ASSERT(win); - if (win->testAttribute(Qt::WA_OpaquePaintEvent) || win->testAttribute(Qt::WA_PaintOnScreen)) { - setOpaque(true); - return; - } - - if (qFuzzyCompare(static_cast(win->windowOpacity()), 1.0f)) { - const QPalette &pal = win->palette(); - - if (win->autoFillBackground()) { - const QBrush &autoFillBrush = pal.brush(win->backgroundRole()); - if (autoFillBrush.style() != Qt::NoBrush && autoFillBrush.isOpaque()) { - setOpaque(true); - return; - } - } - - if (win->isWindow() && !win->testAttribute(Qt::WA_NoSystemBackground)) { - const QBrush &windowBrush = win->palette().brush(QPalette::Window); - if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) { - setOpaque(true); - return; - } - } - } - setOpaque(false); -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h deleted file mode 100644 index df9baa1ff21..00000000000 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDIRECFBWINDOWSURFACE_H -#define QDIRECFBWINDOWSURFACE_H - -#include "qdirectfbpaintengine.h" -#include "qdirectfbpaintdevice.h" -#include "qdirectfbscreen.h" - -#ifndef QT_NO_QWS_DIRECTFB - -#include -#include - -#ifdef QT_DIRECTFB_TIMING -#include -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -class QDirectFBWindowSurface : public QWSWindowSurface, public QDirectFBPaintDevice -{ -public: - QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen *scr); - QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen *scr, QWidget *widget); - ~QDirectFBWindowSurface(); - -#ifdef QT_DIRECTFB_WM - void raise(); -#endif - bool isValid() const; - - void setGeometry(const QRect &rect); - - QString key() const { return QLatin1String("directfb"); } - QByteArray permanentState() const; - void setPermanentState(const QByteArray &state); - - bool scroll(const QRegion &area, int dx, int dy); - - bool move(const QPoint &offset); - - QImage image() const { return QImage(); } - QPaintDevice *paintDevice() { return this; } - - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - - void beginPaint(const QRegion &); - void endPaint(const QRegion &); - - IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; - IDirectFBSurface *directFBSurface() const; -#ifdef QT_DIRECTFB_WM - IDirectFBWindow *directFBWindow() const; -#endif -private: - void updateIsOpaque(); - void setOpaque(bool opaque); - void releaseSurface(); - -#ifdef QT_DIRECTFB_WM - void createWindow(const QRect &rect); - IDirectFBWindow *dfbWindow; -#else - enum Mode { - Primary, - Offscreen - } mode; -#endif - - DFBSurfaceFlipFlags flipFlags; - bool boundingRectFlip; - bool flushPending; -#ifdef QT_DIRECTFB_TIMING - int frames; - QTime timer; -#endif -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QT_NO_QWS_DIRECTFB - -#endif // QDIRECFBWINDOWSURFACE_H diff --git a/src/plugins/gfxdrivers/eglnullws/README b/src/plugins/gfxdrivers/eglnullws/README deleted file mode 100644 index 80b88c7e01a..00000000000 --- a/src/plugins/gfxdrivers/eglnullws/README +++ /dev/null @@ -1,48 +0,0 @@ -EGL NullWS QScreen Driver -========================= - -If your application draws everything within a single full-screen QGLWidget then -you may wish to use this QScreen plugin driver. This driver simply returns 0 -(as a EGLNativeWindowType value) when asked by the QtOpenGl module to create a -native window. Some OpenGL ES implementations (including PowerVR) interpret this -to mean that a full-screen OpenGL context is desired without any windowing -support (NullWS). - -To tell a Qt/Embedded application to use this driver use the -display command -line option or the QWS_DISPLAY environment variable. The following driver -options are supported: - -size=WIDTHxHEIGHT Screen size reported by the driver -format=FORMAT Screen format - -Run with '-display eglnullws:help' to get a full list of options (including a -list of supported format strings). - -If you choose a screen format that is not supported by the hardware then the -QtOpenGl module will write out a list of supported EGL configurations. Use -one of the supported screen formats from this list. - -Using this driver with PowerVR hardware ---------------------------------------- - -Using this plugin with PowerVR hardware should give a significant speedup -compared to running with the Qt powervr driver (with a full-screen QGLWidget). -This is because sacrificing the window system allows less work to be done in -order to get graphics on the screen. Using this driver also avoids the memory -fragmentation issues present in the powervr driver and avoids any direct -dependencies on the deprecated PVR2D API from Imagination Technologies. - -To use this driver ensure you have /etc/powervr.ini with contents similar to -this: - -[default] -WindowSystem=libpvrPVR2D_FLIPWSEGL.so - -This driver will also function with libpvrPVR2D_FRONTWSEGL.so, but that draws -straight into the framebuffer and will therefore cause flickering (it can be -useful for performance testing though). The flip plugin uses triple buffering, -so you will need to set the virtual vertical resolution of your framebuffer to -be three times the physical vertical resolution of your screen. This can be -done with 'fbset -vyres'. Failure to do this can cause system crashes. You -should also ensure that the plugin you choose in powervr.ini is in your library -path (it may just silently default to the flip plugin if not). diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullws.pro b/src/plugins/gfxdrivers/eglnullws/eglnullws.pro deleted file mode 100644 index cb65c2b6279..00000000000 --- a/src/plugins/gfxdrivers/eglnullws/eglnullws.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = qeglnullws -load(qt_plugin) - -CONFIG += warn_on -QT += opengl - -DESTDIR = $$QT.gui.plugins/gfxdrivers - -target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers -INSTALLS += target - -HEADERS = eglnullwsscreen.h \ - eglnullwsscreenplugin.h \ - eglnullwswindowsurface.h - -SOURCES = eglnullwsscreen.cpp \ - eglnullwsscreenplugin.cpp \ - eglnullwswindowsurface.cpp diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp deleted file mode 100644 index e8c73cf31d4..00000000000 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "eglnullwsscreen.h" -#include "eglnullwswindowsurface.h" -#include "eglnullwsscreenplugin.h" - -#include -#include - -namespace -{ - class EGLNullWSScreenSurfaceFunctions : public QGLScreenSurfaceFunctions - { - public: - virtual bool createNativeWindow(QWidget *, EGLNativeWindowType *native) - { *native = 0; return true; } - }; -} - -EGLNullWSScreen::EGLNullWSScreen(int displayId) : QGLScreen(displayId) {} - -EGLNullWSScreen::~EGLNullWSScreen() {} - -bool EGLNullWSScreen::initDevice() -{ - setSurfaceFunctions(new EGLNullWSScreenSurfaceFunctions); - return true; -} - -static const QHash formatDictionary() -{ - QHash dictionary; - dictionary["rgb32"] = QImage::Format_RGB32; - dictionary["argb32"] = QImage::Format_ARGB32; - dictionary["rgb16"] = QImage::Format_RGB16; - dictionary["rgb666"] = QImage::Format_RGB666; - dictionary["rgb555"] = QImage::Format_RGB555; - dictionary["rgb888"] = QImage::Format_RGB888; - dictionary["rgb444"] = QImage::Format_RGB444; - return dictionary; -} - -static int depthForFormat(QImage::Format format) -{ - switch (format) { - case QImage::Format_RGB32: return 32; - case QImage::Format_ARGB32: return 32; - case QImage::Format_RGB16: return 16; - case QImage::Format_RGB666: return 24; - case QImage::Format_RGB555: return 16; - case QImage::Format_RGB888: return 24; - case QImage::Format_RGB444: return 16; - default: - Q_ASSERT_X(false, "EGLNullWSScreen", "Unknown format"); - return -1; - } -} - -static void printHelp(const QHash &formatDictionary) -{ - QByteArray formatsBuf; - QTextStream(&formatsBuf) << QStringList(formatDictionary.keys()).join(", "); - qWarning( - "%s: Valid options are:\n" - "size=WIDTHxHEIGHT Screen size reported by this driver\n" - "format=FORMAT Screen format, where FORMAT is one of the following:\n" - " %s\n", - PluginName, - formatsBuf.constData()); -} - -bool EGLNullWSScreen::connect(const QString &displaySpec) -{ - const QStringList args = displaySpec.section(':', 1).split(':', QString::SkipEmptyParts); - const QHash formatDict = formatDictionary(); - Q_FOREACH(const QString arg, args) { - const QString optionName = arg.section('=', 0, 0); - const QString optionArg = arg.section('=', 1); - if (optionName == QLatin1String("size")) { - w = optionArg.section('x', 0, 0).toInt(); - h = optionArg.section('x', 1, 1).toInt(); - } else if (optionName == QLatin1String("format")) { - if (formatDict.contains(optionArg)) - setPixelFormat(formatDict.value(optionArg)); - else - printHelp(formatDict); - } else { - printHelp(formatDict); - } - } - - if (w == 0 || h == 0) { - w = 640; - h = 480; - qWarning("%s: Using default screen size %dx%d", PluginName, w, h); - } - dw = w; - dh = h; - - if (pixelFormat() == QImage::Format_Invalid) { - qWarning("%s: Using default screen format argb32", PluginName); - setPixelFormat(QImage::Format_ARGB32); - } - d = depthForFormat(pixelFormat()); - - static const int Dpi = 120; - static const qreal ScalingFactor = static_cast(25.4) / Dpi; - physWidth = qRound(dw * ScalingFactor); - physHeight = qRound(dh * ScalingFactor); - - return true; -} - -void EGLNullWSScreen::disconnect() {} - -void EGLNullWSScreen::shutdownDevice() {} - -void EGLNullWSScreen::setMode(int /*width*/, int /*height*/, int /*depth*/) {} - -void EGLNullWSScreen::blank(bool /*on*/) {} - -void EGLNullWSScreen::exposeRegion(QRegion /*r*/, int /*changing*/) {} - -QWSWindowSurface* EGLNullWSScreen::createSurface(QWidget *widget) const -{ - if (qobject_cast(widget)) { - return new EGLNullWSWindowSurface(widget); - } else { - qWarning("%s: Creating non-GL surface", PluginName); - return QScreen::createSurface(widget); - } -} - -QWSWindowSurface* EGLNullWSScreen::createSurface(const QString &key) const -{ - if (key == QLatin1String("eglnullws")) { - return new EGLNullWSWindowSurface; - } else { - qWarning("%s: Creating non-GL surface", PluginName); - return QScreen::createSurface(key); - } -} diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h deleted file mode 100644 index 8295e5daaaf..00000000000 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreen.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef EGLNULLWSSCREEN -#define EGLNULLWSSCREEN - -#include - -class EGLNullWSScreen : public QGLScreen -{ -public: - EGLNullWSScreen(int displayId); - ~EGLNullWSScreen(); - - bool initDevice(); - bool connect(const QString &displaySpec); - void disconnect(); - void shutdownDevice(); - - void setMode(int width, int height, int depth); - void blank(bool on); - - void exposeRegion(QRegion r, int changing); - - QWSWindowSurface* createSurface(QWidget *widget) const; - QWSWindowSurface* createSurface(const QString &key) const; - - bool hasOpenGL() { return true; } -}; - -#endif // EGLNULLWSSCREEN diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp b/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp deleted file mode 100644 index ebae53d8c4e..00000000000 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "eglnullwsscreenplugin.h" -#include "eglnullwsscreen.h" - -#include -#include - -class EGLNullWSScreenPlugin : public QScreenDriverPlugin -{ -public: - virtual QStringList keys() const; - virtual QScreen *create(const QString& driver, int displayId); -}; - -QStringList EGLNullWSScreenPlugin::keys() const -{ - return QStringList() << QLatin1String(PluginName); -} - -QScreen *EGLNullWSScreenPlugin::create(const QString& driver, int displayId) -{ - return (driver.toLower() == QLatin1String(PluginName) ? - new EGLNullWSScreen(displayId) : 0); -} - -Q_EXPORT_PLUGIN2(qeglnullws, EGLNullWSScreenPlugin) diff --git a/src/plugins/gfxdrivers/gfxdrivers.pro b/src/plugins/gfxdrivers/gfxdrivers.pro deleted file mode 100644 index 1f38942a508..00000000000 --- a/src/plugins/gfxdrivers/gfxdrivers.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = subdirs -contains(gfx-plugins, ahi) :SUBDIRS += ahi -contains(gfx-plugins, directfb) :SUBDIRS += directfb -contains(gfx-plugins, linuxfb) :SUBDIRS += linuxfb -contains(gfx-plugins, qvfb) :SUBDIRS += qvfb -contains(gfx-plugins, vnc) :SUBDIRS += vnc -contains(gfx-plugins, transformed) :SUBDIRS += transformed -contains(gfx-plugins, svgalib) :SUBDIRS += svgalib -contains(gfx-plugins, powervr) :SUBDIRS += powervr -contains(gfx-plugins, eglnullws) :SUBDIRS += eglnullws diff --git a/src/plugins/gfxdrivers/linuxfb/linuxfb.pro b/src/plugins/gfxdrivers/linuxfb/linuxfb.pro deleted file mode 100644 index 2bbe910e639..00000000000 --- a/src/plugins/gfxdrivers/linuxfb/linuxfb.pro +++ /dev/null @@ -1,14 +0,0 @@ -TARGET = qscreenlinuxfb -load(qt_plugin) - -DESTDIR = $$QT.gui.plugins/gfxdrivers - -target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers -INSTALLS += target - -DEFINES += QT_QWS_LINUXFB - -HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qscreenlinuxfb_qws.h - -SOURCES = main.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qscreenlinuxfb_qws.cpp diff --git a/src/plugins/gfxdrivers/linuxfb/main.cpp b/src/plugins/gfxdrivers/linuxfb/main.cpp deleted file mode 100644 index 187237f042e..00000000000 --- a/src/plugins/gfxdrivers/linuxfb/main.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QScreenLinuxFbPlugin : public QScreenDriverPlugin -{ -public: - QScreenLinuxFbPlugin(); - - QStringList keys() const; - QScreen *create(const QString&, int displayId); -}; - -QScreenLinuxFbPlugin::QScreenLinuxFbPlugin() - : QScreenDriverPlugin() -{ -} - -QStringList QScreenLinuxFbPlugin::keys() const -{ - QStringList list; - list << QLatin1String("LinuxFb"); - return list; -} - -QScreen* QScreenLinuxFbPlugin::create(const QString& driver, int displayId) -{ - if (driver.toLower() == QLatin1String("linuxfb")) - return new QLinuxFbScreen(displayId); - - return 0; -} - -Q_EXPORT_PLUGIN2(qscreenlinuxfb, QScreenLinuxFbPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro b/src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro deleted file mode 100644 index 595cf45301f..00000000000 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/QWSWSEGL.pro +++ /dev/null @@ -1,26 +0,0 @@ -TEMPLATE = lib -TARGET = pvrQWSWSEGL -CONFIG += dll warn_on -CONFIG -= qt - -HEADERS+=\ - pvrqwsdrawable.h \ - pvrqwsdrawable_p.h - -SOURCES+=\ - pvrqwsdrawable.c \ - pvrqwswsegl.c - -INCLUDEPATH += $$QMAKE_INCDIR_EGL - -for(p, QMAKE_LIBDIR_EGL) { - exists($$p):LIBS += -L$$p -} - -LIBS += -lpvr2d - -DESTDIR = $$QMAKE_LIBDIR_QT -target.path = $$[QT_INSTALL_LIBS] -INSTALLS += target - -include(../powervr.pri) \ No newline at end of file diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c deleted file mode 100644 index c453279155b..00000000000 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ /dev/null @@ -1,830 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "pvrqwsdrawable_p.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -PvrQwsDisplay pvrQwsDisplay; - -static void pvrQwsDestroyDrawableForced(PvrQwsDrawable *drawable); - -/* Initialize the /dev/fbN device for a specific screen */ -static int pvrQwsInitFbScreen(int screen) -{ - struct fb_var_screeninfo var; - struct fb_fix_screeninfo fix; - unsigned long start; - unsigned long length; - int width, height, stride; - PVR2DFORMAT format; - void *mapped; - int fd, bytesPerPixel; - char name[64]; - PVR2DMEMINFO *memInfo; - unsigned long pageAddresses[2]; - - /* Bail out if already initialized, or the number is incorrect */ - if (screen < 0 || screen >= PVRQWS_MAX_SCREENS) - return 0; - if (pvrQwsDisplay.screens[screen].initialized) - return 1; - - /* Open the framebuffer and fetch its properties */ - sprintf(name, "/dev/fb%d", screen); - fd = open(name, O_RDWR, 0); - if (fd < 0) { - perror(name); - return 0; - } - if (ioctl(fd, FBIOGET_VSCREENINFO, &var) < 0) { - perror("FBIOGET_VSCREENINFO"); - close(fd); - return 0; - } - if (ioctl(fd, FBIOGET_FSCREENINFO, &fix) < 0) { - perror("FBIOGET_FSCREENINFO"); - close(fd); - return 0; - } - width = var.xres; - height = var.yres; - bytesPerPixel = var.bits_per_pixel / 8; - stride = fix.line_length; - format = PVR2D_1BPP; - if (var.bits_per_pixel == 16) { - if (var.red.length == 5 && var.green.length == 6 && - var.blue.length == 5 && var.red.offset == 11 && - var.green.offset == 5 && var.blue.offset == 0) { - format = PVR2D_RGB565; - } - if (var.red.length == 4 && var.green.length == 4 && - var.blue.length == 4 && var.transp.length == 4 && - var.red.offset == 8 && var.green.offset == 4 && - var.blue.offset == 0 && var.transp.offset == 12) { - format = PVR2D_ARGB4444; - } - } else if (var.bits_per_pixel == 32) { - if (var.red.length == 8 && var.green.length == 8 && - var.blue.length == 8 && var.transp.length == 8 && - var.red.offset == 16 && var.green.offset == 8 && - var.blue.offset == 0 && var.transp.offset == 24) { - format = PVR2D_ARGB8888; - } - } - if (format == PVR2D_1BPP) { - fprintf(stderr, "%s: could not find a suitable PVR2D pixel format\n", name); - close(fd); - return 0; - } - start = fix.smem_start; - length = var.xres_virtual * var.yres_virtual * bytesPerPixel; - - if (screen == 0) { - /* We use PVR2DGetFrameBuffer to map the first screen. - On some chipsets it is more reliable than using PVR2DMemWrap */ - mapped = 0; - memInfo = 0; - } else { - /* Other screens: map the framebuffer region into memory */ - mapped = mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (!mapped || mapped == (void *)(-1)) { - perror("mmap"); - close(fd); - return 0; - } - - /* Allocate a PVR2D memory region for the framebuffer */ - memInfo = 0; - if (pvrQwsDisplay.context) { - pageAddresses[0] = start & 0xFFFFF000; - pageAddresses[1] = 0; - if (PVR2DMemWrap - (pvrQwsDisplay.context, mapped, PVR2D_WRAPFLAG_CONTIGUOUS, - length, pageAddresses, &memInfo) != PVR2D_OK) { - munmap(mapped, length); - close(fd); - return 0; - } - } - } - - /* We don't need the file descriptor any more */ - close(fd); - - /* The framebuffer is ready, so initialize the PvrQwsScreenInfo */ - pvrQwsDisplay.screens[screen].screenRect.x = 0; - pvrQwsDisplay.screens[screen].screenRect.y = 0; - pvrQwsDisplay.screens[screen].screenRect.width = width; - pvrQwsDisplay.screens[screen].screenRect.height = height; - pvrQwsDisplay.screens[screen].screenStride = stride; - pvrQwsDisplay.screens[screen].pixelFormat = format; - pvrQwsDisplay.screens[screen].bytesPerPixel = bytesPerPixel; - pvrQwsDisplay.screens[screen].screenDrawable = 0; - if (mapped) { - /* Don't set these fields if mapped is 0, because PVR2DGetFrameBuffer - may have already been called and set them */ - pvrQwsDisplay.screens[screen].frameBuffer = memInfo; - pvrQwsDisplay.screens[screen].mapped = mapped; - } - pvrQwsDisplay.screens[screen].mappedLength = length; - pvrQwsDisplay.screens[screen].screenStart = start; - pvrQwsDisplay.screens[screen].needsUnmap = (mapped != 0); - pvrQwsDisplay.screens[screen].initialized = 1; - return 1; -} - -/* Called when a new drawable is added to ensure that we have a - PVR2D context and framebuffer PVR2DMEMINFO blocks */ -static int pvrQwsAddDrawable(void) -{ - int numDevs, screen; - PVR2DDEVICEINFO *devs; - unsigned long devId; - unsigned long pageAddresses[2]; - PVR2DMEMINFO *memInfo; - PVR2DDISPLAYINFO displayInfo; - - /* Bail out early if this is not the first drawable */ - if (pvrQwsDisplay.numDrawables > 0) { - ++(pvrQwsDisplay.numDrawables); - return 1; - } - - /* Find the first PVR2D device in the system and open it */ - numDevs = PVR2DEnumerateDevices(0); - if (numDevs <= 0) - return 0; - devs = (PVR2DDEVICEINFO *)malloc(sizeof(PVR2DDEVICEINFO) * numDevs); - if (!devs) - return 0; - if (PVR2DEnumerateDevices(devs) != PVR2D_OK) { - free(devs); - return 0; - } - devId = devs[0].ulDevID; - free(devs); - if (PVR2DCreateDeviceContext(devId, &pvrQwsDisplay.context, 0) != PVR2D_OK) - return 0; - pvrQwsDisplay.numFlipBuffers = 0; - pvrQwsDisplay.flipChain = 0; - if (PVR2DGetDeviceInfo(pvrQwsDisplay.context, &displayInfo) == PVR2D_OK) { - if (displayInfo.ulMaxFlipChains > 0 && displayInfo.ulMaxBuffersInChain > 0) - pvrQwsDisplay.numFlipBuffers = displayInfo.ulMaxBuffersInChain; - if (pvrQwsDisplay.numFlipBuffers > PVRQWS_MAX_FLIP_BUFFERS) - pvrQwsDisplay.numFlipBuffers = PVRQWS_MAX_FLIP_BUFFERS; - } - - /* Create the PVR2DMEMINFO blocks for the active framebuffers */ - for (screen = 0; screen < PVRQWS_MAX_SCREENS; ++screen) { - if (screen != 0 && pvrQwsDisplay.screens[screen].mapped) { - pageAddresses[0] - = pvrQwsDisplay.screens[screen].screenStart & 0xFFFFF000; - pageAddresses[1] = 0; - if (PVR2DMemWrap - (pvrQwsDisplay.context, - pvrQwsDisplay.screens[screen].mapped, - PVR2D_WRAPFLAG_CONTIGUOUS, - pvrQwsDisplay.screens[screen].mappedLength, - pageAddresses, &memInfo) != PVR2D_OK) { - PVR2DDestroyDeviceContext(pvrQwsDisplay.context); - pvrQwsDisplay.context = 0; - return 0; - } - pvrQwsDisplay.screens[screen].frameBuffer = memInfo; - } else if (screen == 0) { - if (PVR2DGetFrameBuffer - (pvrQwsDisplay.context, - PVR2D_FB_PRIMARY_SURFACE, &memInfo) != PVR2D_OK) { - fprintf(stderr, "QWSWSEGL: could not get the primary framebuffer surface\n"); - PVR2DDestroyDeviceContext(pvrQwsDisplay.context); - pvrQwsDisplay.context = 0; - return 0; - } - pvrQwsDisplay.screens[screen].frameBuffer = memInfo; - pvrQwsDisplay.screens[screen].mapped = memInfo->pBase; - } - } - - /* Create a flip chain for the screen if supported by the hardware */ - pvrQwsDisplay.usePresentBlit = 0; - if (pvrQwsDisplay.numFlipBuffers > 0) { - long stride = 0; - unsigned long flipId = 0; - unsigned long numBuffers; - if (PVR2DCreateFlipChain(pvrQwsDisplay.context, 0, - //PVR2D_CREATE_FLIPCHAIN_SHARED | - //PVR2D_CREATE_FLIPCHAIN_QUERY, - pvrQwsDisplay.numFlipBuffers, - pvrQwsDisplay.screens[0].screenRect.width, - pvrQwsDisplay.screens[0].screenRect.height, - pvrQwsDisplay.screens[0].pixelFormat, - &stride, &flipId, &(pvrQwsDisplay.flipChain)) - == PVR2D_OK) { - pvrQwsDisplay.screens[0].screenStride = stride; - PVR2DGetFlipChainBuffers(pvrQwsDisplay.context, - pvrQwsDisplay.flipChain, - &numBuffers, - pvrQwsDisplay.flipBuffers); - } else { - pvrQwsDisplay.flipChain = 0; - pvrQwsDisplay.numFlipBuffers = 0; - } - - /* PVR2DPresentBlt is a little more reliable than PVR2DBlt - when flip chains are present, even if we cannot create a - flip chain at the moment */ - pvrQwsDisplay.usePresentBlit = 1; - } - - /* The context is ready to go */ - ++(pvrQwsDisplay.numDrawables); - return 1; -} - -/* Called when the last drawable is destroyed. The PVR2D context - will be destroyed but the raw framebuffer memory will stay mapped */ -static void pvrQwsDestroyContext(void) -{ - int screen; - for (screen = 0; screen < PVRQWS_MAX_SCREENS; ++screen) { - if (pvrQwsDisplay.screens[screen].frameBuffer) { - PVR2DMemFree - (pvrQwsDisplay.context, - pvrQwsDisplay.screens[screen].frameBuffer); - pvrQwsDisplay.screens[screen].frameBuffer = 0; - } - } - - if (pvrQwsDisplay.numFlipBuffers > 0) - PVR2DDestroyFlipChain(pvrQwsDisplay.context, pvrQwsDisplay.flipChain); - PVR2DDestroyDeviceContext(pvrQwsDisplay.context); - pvrQwsDisplay.context = 0; - pvrQwsDisplay.flipChain = 0; - pvrQwsDisplay.numFlipBuffers = 0; - pvrQwsDisplay.usePresentBlit = 0; -} - -int pvrQwsDisplayOpen(void) -{ - int screen; - - /* If the display is already open, increase reference count and return */ - if (pvrQwsDisplay.refCount > 0) { - ++(pvrQwsDisplay.refCount); - return 1; - } - - /* Open the framebuffer and map it directly */ - if (!pvrQwsInitFbScreen(0)) { - --(pvrQwsDisplay.refCount); - return 0; - } - - /* Clear the other screens. We will create them if they are referenced */ - for (screen = 1; screen < PVRQWS_MAX_SCREENS; ++screen) - memset(&(pvrQwsDisplay.screens[screen]), 0, sizeof(PvrQwsScreenInfo)); - - /* The display is open and ready */ - ++(pvrQwsDisplay.refCount); - return 1; -} - -void pvrQwsDisplayClose(void) -{ - int screen; - - if (pvrQwsDisplay.refCount == 0) - return; - if (--(pvrQwsDisplay.refCount) > 0) - return; - - /* Prevent pvrQwsDestroyContext from being called for the time being */ - ++pvrQwsDisplay.numDrawables; - - /* Free the screens */ - for (screen = 0; screen < PVRQWS_MAX_SCREENS; ++screen) { - PvrQwsScreenInfo *info = &(pvrQwsDisplay.screens[screen]); - if (info->screenDrawable) - pvrQwsDestroyDrawableForced(info->screenDrawable); - if (info->frameBuffer) - PVR2DMemFree(pvrQwsDisplay.context, info->frameBuffer); - if (info->mapped && info->needsUnmap) - munmap(info->mapped, info->mappedLength); - } - - /* Now it is safe to destroy the PVR2D context */ - --pvrQwsDisplay.numDrawables; - if (pvrQwsDisplay.context) - PVR2DDestroyDeviceContext(pvrQwsDisplay.context); - - memset(&pvrQwsDisplay, 0, sizeof(pvrQwsDisplay)); -} - -int pvrQwsDisplayIsOpen(void) -{ - return (pvrQwsDisplay.refCount > 0); -} - -/* Ensure that a specific screen has been initialized */ -static int pvrQwsEnsureScreen(int screen) -{ - if (screen < 0 || screen >= PVRQWS_MAX_SCREENS) - return 0; - if (!screen) - return 1; - return pvrQwsInitFbScreen(screen); -} - -PvrQwsDrawable *pvrQwsScreenWindow(int screen) -{ - PvrQwsDrawable *drawable; - - if (!pvrQwsEnsureScreen(screen)) - return 0; - - drawable = pvrQwsDisplay.screens[screen].screenDrawable; - if (drawable) - return drawable; - - drawable = (PvrQwsDrawable *)calloc(1, sizeof(PvrQwsDrawable)); - if (!drawable) - return 0; - - drawable->type = PvrQwsScreen; - drawable->screen = screen; - drawable->pixelFormat = pvrQwsDisplay.screens[screen].pixelFormat; - drawable->rect = pvrQwsDisplay.screens[screen].screenRect; - drawable->visibleRects[0] = drawable->rect; - drawable->numVisibleRects = 1; - drawable->isFullScreen = 1; - - if (!pvrQwsAddDrawable()) { - free(drawable); - return 0; - } - - pvrQwsDisplay.screens[screen].screenDrawable = drawable; - - return drawable; -} - -PvrQwsDrawable *pvrQwsCreateWindow(int screen, long winId, const PvrQwsRect *rect) -{ - PvrQwsDrawable *drawable; - - if (!pvrQwsEnsureScreen(screen)) - return 0; - - drawable = (PvrQwsDrawable *)calloc(1, sizeof(PvrQwsDrawable)); - if (!drawable) - return 0; - - drawable->type = PvrQwsWindow; - drawable->winId = winId; - drawable->refCount = 1; - drawable->screen = screen; - drawable->pixelFormat = pvrQwsDisplay.screens[screen].pixelFormat; - drawable->rect = *rect; - - if (!pvrQwsAddDrawable()) { - free(drawable); - return 0; - } - - drawable->nextWinId = pvrQwsDisplay.firstWinId; - pvrQwsDisplay.firstWinId = drawable; - - return drawable; -} - -PvrQwsDrawable *pvrQwsFetchWindow(long winId) -{ - PvrQwsDrawable *drawable = pvrQwsDisplay.firstWinId; - while (drawable != 0 && drawable->winId != winId) - drawable = drawable->nextWinId; - - if (drawable) - ++(drawable->refCount); - return drawable; -} - -int pvrQwsReleaseWindow(PvrQwsDrawable *drawable) -{ - if (drawable->type == PvrQwsWindow) - return (--(drawable->refCount) <= 0); - else - return 0; -} - -PvrQwsDrawable *pvrQwsCreatePixmap(int width, int height, int screen) -{ - PvrQwsDrawable *drawable; - - if (!pvrQwsEnsureScreen(screen)) - return 0; - - drawable = (PvrQwsDrawable *)calloc(1, sizeof(PvrQwsDrawable)); - if (!drawable) - return 0; - - drawable->type = PvrQwsPixmap; - drawable->screen = screen; - drawable->pixelFormat = pvrQwsDisplay.screens[screen].pixelFormat; - drawable->rect.x = 0; - drawable->rect.y = 0; - drawable->rect.width = width; - drawable->rect.height = height; - - if (!pvrQwsAddDrawable()) { - free(drawable); - return 0; - } - - return drawable; -} - -static void pvrQwsDestroyDrawableForced(PvrQwsDrawable *drawable) -{ - /* Remove the drawable from the display's winId list */ - PvrQwsDrawable *current = pvrQwsDisplay.firstWinId; - PvrQwsDrawable *prev = 0; - while (current != 0 && current != drawable) { - prev = current; - current = current->nextWinId; - } - if (current != 0) { - if (prev) - prev->nextWinId = current->nextWinId; - else - pvrQwsDisplay.firstWinId = current->nextWinId; - } - - pvrQwsFreeBuffers(drawable); - free(drawable); - - --pvrQwsDisplay.numDrawables; - if (pvrQwsDisplay.numDrawables == 0) - pvrQwsDestroyContext(); -} - -void pvrQwsDestroyDrawable(PvrQwsDrawable *drawable) -{ - if (drawable && drawable->type != PvrQwsScreen) - pvrQwsDestroyDrawableForced(drawable); -} - -PvrQwsDrawableType pvrQwsGetDrawableType(PvrQwsDrawable *drawable) -{ - return drawable->type; -} - -void pvrQwsSetVisibleRegion - (PvrQwsDrawable *drawable, const PvrQwsRect *rects, int numRects) -{ - int index, indexOut; - PvrQwsRect *rect; - PvrQwsRect *screenRect; - - /* Visible regions don't make sense for pixmaps */ - if (drawable->type == PvrQwsPixmap) - return; - - /* Restrict the number of rectangles to prevent buffer overflow */ - if (numRects > PVRQWS_MAX_VISIBLE_RECTS) - numRects = PVRQWS_MAX_VISIBLE_RECTS; - if (numRects > 0) - memcpy(drawable->visibleRects, rects, numRects * sizeof(PvrQwsRect)); - - /* Convert the rectangles into screen-relative co-ordinates and - then clamp them to the screen boundaries. If any of the - clamped rectangles are empty, remove them from the list */ - screenRect = &(pvrQwsDisplay.screens[drawable->screen].screenRect); - indexOut = 0; - for (index = 0, rect = drawable->visibleRects; index < numRects; ++index, ++rect) { - if (rect->x < 0) { - rect->width += rect->x; - rect->x = 0; - if (rect->width < 0) - rect->width = 0; - } else if (rect->x >= screenRect->width) { - rect->x = screenRect->width; - rect->width = 0; - } - if ((rect->x + rect->width) > screenRect->width) { - rect->width = screenRect->width - rect->x; - } - if (rect->y < 0) { - rect->height += rect->y; - rect->y = 0; - if (rect->height < 0) - rect->height = 0; - } else if (rect->y >= screenRect->height) { - rect->y = screenRect->height; - rect->height = 0; - } - if ((rect->y + rect->height) > screenRect->height) { - rect->height = screenRect->height - rect->y; - } - if (rect->width > 0 && rect->height > 0) { - if (index != indexOut) - drawable->visibleRects[indexOut] = *rect; - ++indexOut; - } - } - drawable->numVisibleRects = indexOut; -} - -void pvrQwsClearVisibleRegion(PvrQwsDrawable *drawable) -{ - if (drawable->type != PvrQwsPixmap) - drawable->numVisibleRects = 0; -} - -void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect) -{ - /* We can only change the geometry of window drawables */ - if (drawable->type != PvrQwsWindow) - return; - - /* If the position has changed, then clear the visible region */ - if (drawable->rect.x != rect->x || drawable->rect.y != rect->y) { - drawable->rect.x = rect->x; - drawable->rect.y = rect->y; - drawable->numVisibleRects = 0; - } - - /* If the size has changed, then clear the visible region and - invalidate the drawable's buffers. Invalidating the buffers - will force EGL to recreate the drawable, which will then - allocate new buffers for the new size */ - if (drawable->rect.width != rect->width || - drawable->rect.height != rect->height) { - drawable->rect.width = rect->width; - drawable->rect.height = rect->height; - drawable->numVisibleRects = 0; - pvrQwsInvalidateBuffers(drawable); - } -} - -void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect) -{ - *rect = drawable->rect; -} - -void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle) -{ - if (drawable->rotationAngle != angle) { - drawable->rotationAngle = angle; - - /* Force the buffers to be recreated if the rotation angle changes */ - pvrQwsInvalidateBuffers(drawable); - } -} - -int pvrQwsGetStride(PvrQwsDrawable *drawable) -{ - if (drawable->backBuffersValid) - return drawable->strideBytes; - else - return 0; -} - -PvrQwsPixelFormat pvrQwsGetPixelFormat(PvrQwsDrawable *drawable) -{ - return (PvrQwsPixelFormat)(drawable->pixelFormat); -} - -void *pvrQwsGetRenderBuffer(PvrQwsDrawable *drawable) -{ - if (drawable->backBuffersValid) - return drawable->backBuffers[drawable->currentBackBuffer]->pBase; - else - return 0; -} - -int pvrQwsAllocBuffers(PvrQwsDrawable *drawable) -{ - int index; - int numBuffers = PVRQWS_MAX_BACK_BUFFERS; - if (drawable->type == PvrQwsPixmap) - numBuffers = 1; - if (drawable->backBuffers[0]) { - if (drawable->backBuffersValid) - return 1; - if (!drawable->usingFlipBuffers) { - for (index = 0; index < numBuffers; ++index) - PVR2DMemFree(pvrQwsDisplay.context, drawable->backBuffers[index]); - } - } - drawable->stridePixels = (drawable->rect.width + 31) & ~31; - drawable->strideBytes = - drawable->stridePixels * - pvrQwsDisplay.screens[drawable->screen].bytesPerPixel; - drawable->usingFlipBuffers = - (pvrQwsDisplay.numFlipBuffers > 0 && drawable->isFullScreen); - if (drawable->usingFlipBuffers) { - if (numBuffers > (int)(pvrQwsDisplay.numFlipBuffers)) - numBuffers = pvrQwsDisplay.numFlipBuffers; - for (index = 0; index < numBuffers; ++index) - drawable->backBuffers[index] = pvrQwsDisplay.flipBuffers[index]; - } else { - for (index = 0; index < numBuffers; ++index) { - if (PVR2DMemAlloc(pvrQwsDisplay.context, - drawable->strideBytes * drawable->rect.height, - 128, 0, - &(drawable->backBuffers[index])) != PVR2D_OK) { - while (--index >= 0) - PVR2DMemFree(pvrQwsDisplay.context, drawable->backBuffers[index]); - memset(drawable->backBuffers, 0, sizeof(drawable->backBuffers)); - drawable->backBuffersValid = 0; - return 0; - } - } - } - for (index = numBuffers; index < PVRQWS_MAX_BACK_BUFFERS; ++index) { - drawable->backBuffers[index] = drawable->backBuffers[0]; - } - drawable->backBuffersValid = 1; - drawable->currentBackBuffer = 0; - return 1; -} - -void pvrQwsFreeBuffers(PvrQwsDrawable *drawable) -{ - int index; - int numBuffers = PVRQWS_MAX_BACK_BUFFERS; - if (drawable->type == PvrQwsPixmap) - numBuffers = 1; - if (!drawable->usingFlipBuffers) { - for (index = 0; index < numBuffers; ++index) { - if (drawable->backBuffers[index]) - PVR2DMemFree(pvrQwsDisplay.context, drawable->backBuffers[index]); - } - } - memset(drawable->backBuffers, 0, sizeof(drawable->backBuffers)); - drawable->backBuffersValid = 0; - drawable->usingFlipBuffers = 0; -} - -void pvrQwsInvalidateBuffers(PvrQwsDrawable *drawable) -{ - drawable->backBuffersValid = 0; -} - -int pvrQwsGetBuffers - (PvrQwsDrawable *drawable, PVR2DMEMINFO **source, PVR2DMEMINFO **render) -{ - if (!drawable->backBuffersValid) - return 0; - *render = drawable->backBuffers[drawable->currentBackBuffer]; - *source = drawable->backBuffers - [(drawable->currentBackBuffer + PVRQWS_MAX_BACK_BUFFERS - 1) % - PVRQWS_MAX_BACK_BUFFERS]; - return 1; -} - -int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly) -{ - PVR2DMEMINFO *buffer; - PvrQwsRect *rect; - int index; - - /* Bail out if the back buffers have been invalidated */ - if (!drawable->backBuffersValid) - return 0; - - /* If there is a swap function, then use that instead */ - if (drawable->swapFunction) { - (*(drawable->swapFunction))(drawable, drawable->userData, repaintOnly); - if (!repaintOnly) { - drawable->currentBackBuffer - = (drawable->currentBackBuffer + 1) % PVRQWS_MAX_BACK_BUFFERS; - } - return 1; - } - - /* Iterate through the visible rectangles and blit them to the screen */ - if (!repaintOnly) { - index = drawable->currentBackBuffer; - } else { - index = (drawable->currentBackBuffer + PVRQWS_MAX_BACK_BUFFERS - 1) - % PVRQWS_MAX_BACK_BUFFERS; - } - buffer = drawable->backBuffers[index]; - rect = drawable->visibleRects; - if (drawable->usingFlipBuffers) { - PVR2DPresentFlip(pvrQwsDisplay.context, pvrQwsDisplay.flipChain, buffer, 0); - } else if (pvrQwsDisplay.usePresentBlit && drawable->numVisibleRects > 0) { - PVR2DRECT pvrRects[PVRQWS_MAX_VISIBLE_RECTS]; - for (index = 0; index < drawable->numVisibleRects; ++index, ++rect) { - pvrRects[index].left = rect->x; - pvrRects[index].top = rect->y; - pvrRects[index].right = rect->x + rect->width; - pvrRects[index].bottom = rect->y + rect->height; - } - for (index = 0; index < drawable->numVisibleRects; index += 4) { - int numClip = drawable->numVisibleRects - index; - if (numClip > 4) /* No more than 4 clip rects at a time */ - numClip = 4; - PVR2DSetPresentBltProperties - (pvrQwsDisplay.context, - PVR2D_PRESENT_PROPERTY_SRCSTRIDE | - PVR2D_PRESENT_PROPERTY_DSTSIZE | - PVR2D_PRESENT_PROPERTY_DSTPOS | - PVR2D_PRESENT_PROPERTY_CLIPRECTS, - drawable->strideBytes, - drawable->rect.width, drawable->rect.height, - drawable->rect.x, drawable->rect.y, - numClip, pvrRects + index, 0); - PVR2DPresentBlt(pvrQwsDisplay.context, buffer, 0); - } - PVR2DQueryBlitsComplete(pvrQwsDisplay.context, buffer, 1); - } else { - /* TODO: use PVR2DBltClipped for faster transfers of clipped windows */ - PVR2DBLTINFO blit; - for (index = 0; index < drawable->numVisibleRects; ++index, ++rect) { - memset(&blit, 0, sizeof(blit)); - - blit.CopyCode = PVR2DROPcopy; - blit.BlitFlags = PVR2D_BLIT_DISABLE_ALL; - - blit.pSrcMemInfo = buffer; - blit.SrcStride = drawable->strideBytes; - blit.SrcX = rect->x - drawable->rect.x; - blit.SrcY = rect->y - drawable->rect.y; - blit.SizeX = rect->width; - blit.SizeY = rect->height; - blit.SrcFormat = drawable->pixelFormat; - - blit.pDstMemInfo = pvrQwsDisplay.screens[drawable->screen].frameBuffer; - blit.DstStride = pvrQwsDisplay.screens[drawable->screen].screenStride; - blit.DstX = rect->x; - blit.DstY = rect->y; - blit.DSizeX = rect->width; - blit.DSizeY = rect->height; - blit.DstFormat = pvrQwsDisplay.screens[drawable->screen].pixelFormat; - - PVR2DBlt(pvrQwsDisplay.context, &blit); - } - } - - /* Swap the buffers */ - if (!repaintOnly) { - drawable->currentBackBuffer - = (drawable->currentBackBuffer + 1) % PVRQWS_MAX_BACK_BUFFERS; - } - return 1; -} - -void pvrQwsSetSwapFunction - (PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData) -{ - drawable->swapFunction = func; - drawable->userData = userData; -} diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h deleted file mode 100644 index 40119b0a41c..00000000000 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PVRQWSDRAWABLE_H -#define PVRQWSDRAWABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int x, y, width, height; -} PvrQwsRect; - -typedef enum -{ - PvrQwsScreen, - PvrQwsWindow, - PvrQwsPixmap - -} PvrQwsDrawableType; - -typedef enum -{ - PvrQws_1BPP = 0, - PvrQws_RGB565, - PvrQws_ARGB4444, - PvrQws_RGB888, - PvrQws_ARGB8888, - PvrQws_VGAEMU - -} PvrQwsPixelFormat; - -typedef struct _PvrQwsDrawable PvrQwsDrawable; - -typedef void (*PvrQwsSwapFunction) - (PvrQwsDrawable *drawable, void *userData, int repaintOnly); - -/* Open the display and prepare for window operations. The display - can be opened multiple times and each time is reference counted. - The display will be finally closed when the same number of - calls to pvrQwsDisplayClose() have been encountered */ -int pvrQwsDisplayOpen(void); - -/* Close the display */ -void pvrQwsDisplayClose(void); - -/* Determine if the display is already open */ -int pvrQwsDisplayIsOpen(void); - -/* Create a window that represents a particular framebuffer screen. - Initially the visible region will be the whole screen. If the screen - window has already been created, then will return the same value */ -PvrQwsDrawable *pvrQwsScreenWindow(int screen); - -/* Create a top-level window on a particular framebuffer screen. - Initially the window will not have a visible region */ -PvrQwsDrawable *pvrQwsCreateWindow(int screen, long winId, const PvrQwsRect *rect); - -/* Fetch an existing window for a window id and increase its refcount */ -PvrQwsDrawable *pvrQwsFetchWindow(long winId); - -/* Release the refcount on a window. Returns 1 if refcount is zero */ -int pvrQwsReleaseWindow(PvrQwsDrawable *drawable); - -/* Create an off-screen pixmap */ -PvrQwsDrawable *pvrQwsCreatePixmap(int width, int height, int screen); - -/* Destroy a previously-created drawable. Will not destroy screens. */ -void pvrQwsDestroyDrawable(PvrQwsDrawable *drawable); - -/* Get a drawable's type */ -PvrQwsDrawableType pvrQwsGetDrawableType(PvrQwsDrawable *drawable); - -/* Sets the visible region for a window or screen drawable. Pixels within - the specified rectangles will be copied to the framebuffer when the window - or screen is swapped. The rectangles should be in global co-ordinates */ -void pvrQwsSetVisibleRegion - (PvrQwsDrawable *drawable, const PvrQwsRect *rects, int numRects); - -/* Clear the visible region for a window or screen drawable, - effectively removing it from the screen */ -void pvrQwsClearVisibleRegion(PvrQwsDrawable *drawable); - -/* Set the geometry for a drawable. This can only be used on windows */ -void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect); - -/* Get the current geometry for a drawable */ -void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect); - -/* Set the rotation angle in degrees */ -void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle); - -/* Get the line stride for a drawable. Returns zero if the buffers - are not allocated or have been invalidated */ -int pvrQwsGetStride(PvrQwsDrawable *drawable); - -/* Get the pixel format for a drawable */ -PvrQwsPixelFormat pvrQwsGetPixelFormat(PvrQwsDrawable *drawable); - -/* Get a pointer to the beginning of a drawable's current render buffer. - Returns null if the buffers are not allocated or have been invalidated */ -void *pvrQwsGetRenderBuffer(PvrQwsDrawable *drawable); - -/* Allocate the buffers associated with a drawable. We allocate one buffer - for pixmaps, and several for windows and screens */ -int pvrQwsAllocBuffers(PvrQwsDrawable *drawable); - -/* Free the buffers associated with a drawable */ -void pvrQwsFreeBuffers(PvrQwsDrawable *drawable); - -/* Invalidate the buffers associated with a drawable. The buffers will - still be allocated but the next attempt to swap the buffers will fail */ -void pvrQwsInvalidateBuffers(PvrQwsDrawable *drawable); - -/* Swap the back buffers for a window or screen and copy to the framebuffer */ -int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly); - -/* Set the swap function for a drawable. When pvrQwsSwapBuffers() - is called on the drawable, the supplied function will be called - instead of copying the drawable contents to the screen. This allows - higher-level compositors to know when a drawable has changed. - The swap function can be set to null to return to normal processing */ -void pvrQwsSetSwapFunction - (PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData); - -#ifdef __cplusplus -}; -#endif - -#endif diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h deleted file mode 100644 index b20dc023d67..00000000000 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PVRQWSDRAWABLE_P_H -#define PVRQWSDRAWABLE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// reasons. This header file may change from version to version -// without notice, or even be removed. -// -// We mean it. -// - -#include -#include "pvrqwsdrawable.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define PVRQWS_MAX_VISIBLE_RECTS 32 -#define PVRQWS_MAX_SCREENS 1 -#define PVRQWS_MAX_BACK_BUFFERS 2 -#define PVRQWS_MAX_FLIP_BUFFERS 2 - -typedef struct { - - PvrQwsRect screenRect; - int screenStride; - PVR2DFORMAT pixelFormat; - int bytesPerPixel; - PVR2DMEMINFO *frameBuffer; - PvrQwsDrawable *screenDrawable; - void *mapped; - int mappedLength; - unsigned long screenStart; - int needsUnmap; - int initialized; - -} PvrQwsScreenInfo; - -typedef struct { - - int refCount; - PvrQwsScreenInfo screens[PVRQWS_MAX_SCREENS]; - PVR2DCONTEXTHANDLE context; - int numDrawables; - unsigned long numFlipBuffers; - PVR2DFLIPCHAINHANDLE flipChain; - PVR2DMEMINFO *flipBuffers[PVRQWS_MAX_FLIP_BUFFERS]; - int usePresentBlit; - PvrQwsDrawable *firstWinId; - -} PvrQwsDisplay; - -extern PvrQwsDisplay pvrQwsDisplay; - -struct _PvrQwsDrawable -{ - PvrQwsDrawableType type; - long winId; - int refCount; - PvrQwsRect rect; - int screen; - PVR2DFORMAT pixelFormat; - PvrQwsRect visibleRects[PVRQWS_MAX_VISIBLE_RECTS]; - int numVisibleRects; - PVR2DMEMINFO *backBuffers[PVRQWS_MAX_BACK_BUFFERS]; - int currentBackBuffer; - int backBuffersValid; - int usingFlipBuffers; - int isFullScreen; - int strideBytes; - int stridePixels; - int rotationAngle; - PvrQwsSwapFunction swapFunction; - void *userData; - PvrQwsDrawable *nextWinId; - -}; - -/* Get the current source and render buffers for a drawable */ -int pvrQwsGetBuffers - (PvrQwsDrawable *drawable, PVR2DMEMINFO **source, PVR2DMEMINFO **render); - -#ifdef __cplusplus -}; -#endif - -#endif diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c deleted file mode 100644 index ce99e607f2f..00000000000 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c +++ /dev/null @@ -1,402 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include "pvrqwsdrawable_p.h" - -#define WSEGL_UNUSED(x) (void)x; - -// If the PVR2D version is not specified, then assume MBX-style headers. -// If the version is defined, then we assume that we have SGX-style headers. -#if !defined(PVR2D_REV_MAJOR) -#define WSEGL_CAP_WINDOWS_USE_HW_SYNC WSEGL_CAP_WINDOWS_USE_MBX_SYNC -#define WSEGL_CAP_PIXMAPS_USE_HW_SYNC WSEGL_CAP_PIXMAPS_USE_MBX_SYNC -#endif - -/* Capability information for the display */ -static WSEGLCaps const wseglDisplayCaps[] = { - {WSEGL_CAP_WINDOWS_USE_HW_SYNC, 1}, - {WSEGL_CAP_PIXMAPS_USE_HW_SYNC, 1}, - {WSEGL_NO_CAPS, 0} -}; - -/* Configuration information for the display */ -static WSEGLConfig wseglDisplayConfigs[] = { - {WSEGL_DRAWABLE_WINDOW, WSEGL_PIXELFORMAT_565, WSEGL_FALSE, - 0, 0, 0, WSEGL_OPAQUE, 0}, - {WSEGL_DRAWABLE_PIXMAP, WSEGL_PIXELFORMAT_565, WSEGL_FALSE, - 0, 0, 0, WSEGL_OPAQUE, 0}, - {WSEGL_NO_DRAWABLE, 0, 0, 0, 0, 0, 0, 0} -}; - -/* Determine if nativeDisplay is a valid display handle */ -static WSEGLError wseglIsDisplayValid(NativeDisplayType nativeDisplay) -{ - /* We only have the default display in this system */ - if (nativeDisplay == WSEGL_DEFAULT_DISPLAY) - return WSEGL_SUCCESS; - else - return WSEGL_BAD_NATIVE_DISPLAY; -} - -/* Initialize a native display for use with WSEGL */ -static WSEGLError wseglInitializeDisplay - (NativeDisplayType nativeDisplay, WSEGLDisplayHandle *display, - const WSEGLCaps **caps, WSEGLConfig **configs) -{ - WSEGLPixelFormat pixelFormat; - - /* Bail out if the native display is incorrect */ - if (nativeDisplay != WSEGL_DEFAULT_DISPLAY) - return WSEGL_CANNOT_INITIALISE; - - /* Open the PVR/QWS display, which will initialize the framebuffer */ - if (!pvrQwsDisplayOpen()) - return WSEGL_CANNOT_INITIALISE; - - /* Convert the PVR2D pixel format into a WSEGL pixel format */ - switch (pvrQwsDisplay.screens[0].pixelFormat) { - case PVR2D_RGB565: - pixelFormat = WSEGL_PIXELFORMAT_565; - break; - - case PVR2D_ARGB4444: - pixelFormat = WSEGL_PIXELFORMAT_4444; - break; - - case PVR2D_ARGB8888: - pixelFormat = WSEGL_PIXELFORMAT_8888; - break; - - default: - pvrQwsDisplayClose(); - return WSEGL_CANNOT_INITIALISE; - } - wseglDisplayConfigs[0].ePixelFormat = pixelFormat; - wseglDisplayConfigs[1].ePixelFormat = pixelFormat; - - /* The display has been initialized */ - *display = (WSEGLDisplayHandle)&pvrQwsDisplay; - *caps = wseglDisplayCaps; - *configs = wseglDisplayConfigs; - return WSEGL_SUCCESS; -} - -/* Close the WSEGL display */ -static WSEGLError wseglCloseDisplay(WSEGLDisplayHandle display) -{ - if (display == (WSEGLDisplayHandle)&pvrQwsDisplay) - pvrQwsDisplayClose(); - return WSEGL_SUCCESS; -} - -static WSEGLRotationAngle wseglRotationValue(int degrees) -{ - switch (degrees) { - case 90: return WSEGL_ROTATE_90; - case 180: return WSEGL_ROTATE_180; - case 270: return WSEGL_ROTATE_270; - default: return WSEGL_ROTATE_0; - } -} - -/* Create the WSEGL drawable version of a native window */ -static WSEGLError wseglCreateWindowDrawable - (WSEGLDisplayHandle display, WSEGLConfig *config, - WSEGLDrawableHandle *drawable, NativeWindowType nativeWindow, - WSEGLRotationAngle *rotationAngle) -{ - PvrQwsDrawable *draw; - - WSEGL_UNUSED(display); - WSEGL_UNUSED(config); - - /* Check for special handles that indicate framebuffer screens */ - if (nativeWindow >= (NativeWindowType)0 && - nativeWindow < (NativeWindowType)PVRQWS_MAX_SCREENS) { - PvrQwsDrawable *screen = pvrQwsScreenWindow((int)nativeWindow); - if (!screen) - return WSEGL_OUT_OF_MEMORY; - *drawable = (WSEGLDrawableHandle)screen; - if (!pvrQwsAllocBuffers(screen)) - return WSEGL_OUT_OF_MEMORY; - *rotationAngle = wseglRotationValue(screen->rotationAngle); - return WSEGL_SUCCESS; - } - - /* The native window is the winId - fetch the underlying drawable */ - draw = pvrQwsFetchWindow((long)nativeWindow); - if (!draw) - return WSEGL_BAD_DRAWABLE; - - /* The drawable is ready to go */ - *drawable = (WSEGLDrawableHandle)draw; - *rotationAngle = wseglRotationValue(draw->rotationAngle); - if (!pvrQwsAllocBuffers(draw)) - return WSEGL_OUT_OF_MEMORY; - return WSEGL_SUCCESS; -} - -/* Create the WSEGL drawable version of a native pixmap */ -static WSEGLError wseglCreatePixmapDrawable - (WSEGLDisplayHandle display, WSEGLConfig *config, - WSEGLDrawableHandle *drawable, NativePixmapType nativePixmap, - WSEGLRotationAngle *rotationAngle) -{ - WSEGL_UNUSED(display); - WSEGL_UNUSED(config); - if (!nativePixmap) - return WSEGL_BAD_NATIVE_PIXMAP; - if (!pvrQwsAllocBuffers((PvrQwsDrawable *)nativePixmap)) - return WSEGL_OUT_OF_MEMORY; - *drawable = (WSEGLDrawableHandle)nativePixmap; - *rotationAngle = WSEGL_ROTATE_0; - return WSEGL_SUCCESS; -} - -/* Delete a specific drawable */ -static WSEGLError wseglDeleteDrawable(WSEGLDrawableHandle _drawable) -{ - PvrQwsDrawable *drawable = (PvrQwsDrawable *)_drawable; - if (!drawable || drawable->type == PvrQwsScreen) - return WSEGL_SUCCESS; - if (pvrQwsDisplay.numFlipBuffers == 0) - pvrQwsFreeBuffers(drawable); - if (pvrQwsReleaseWindow(drawable)) - pvrQwsDestroyDrawable(drawable); - return WSEGL_SUCCESS; -} - -/* Swap the contents of a drawable to the screen */ -static WSEGLError wseglSwapDrawable - (WSEGLDrawableHandle _drawable, unsigned long data) -{ - WSEGL_UNUSED(data); - PvrQwsDrawable *drawable = (PvrQwsDrawable *)_drawable; - if (drawable->type != PvrQwsPixmap && !pvrQwsSwapBuffers(drawable, 0)) - return WSEGL_BAD_DRAWABLE; - else - return WSEGL_SUCCESS; -} - -/* Set the swap interval of a window drawable */ -static WSEGLError wseglSwapControlInterval - (WSEGLDrawableHandle drawable, unsigned long interval) -{ - WSEGL_UNUSED(drawable); - if (pvrQwsDisplay.flipChain) { - PVR2DSetPresentFlipProperties - (pvrQwsDisplay.context, pvrQwsDisplay.flipChain, - PVR2D_PRESENT_PROPERTY_INTERVAL, 0, 0, 0, NULL, interval); - } - return WSEGL_SUCCESS; -} - -/* Flush native rendering requests on a drawable */ -static WSEGLError wseglWaitNative - (WSEGLDrawableHandle drawable, unsigned long engine) -{ - WSEGL_UNUSED(drawable); - if (engine == WSEGL_DEFAULT_NATIVE_ENGINE) - return WSEGL_SUCCESS; - else - return WSEGL_BAD_NATIVE_ENGINE; -} - -/* Copy color data from a drawable to a native pixmap */ -static WSEGLError wseglCopyFromDrawable - (WSEGLDrawableHandle _drawable, NativePixmapType nativePixmap) -{ - PvrQwsDrawable *drawable = (PvrQwsDrawable *)_drawable; - PvrQwsDrawable *pixmap = (PvrQwsDrawable *)nativePixmap; - PVR2DBLTINFO blit; - - if (!drawable || !drawable->backBuffersValid) - return WSEGL_BAD_NATIVE_WINDOW; - if (!pixmap || !pixmap->backBuffersValid) - return WSEGL_BAD_NATIVE_PIXMAP; - - memset(&blit, 0, sizeof(blit)); - - blit.CopyCode = PVR2DROPcopy; - blit.BlitFlags = PVR2D_BLIT_DISABLE_ALL; - - blit.pSrcMemInfo = drawable->backBuffers[drawable->currentBackBuffer]; - blit.SrcStride = drawable->strideBytes; - blit.SrcX = 0; - blit.SrcY = 0; - blit.SizeX = drawable->rect.width; - blit.SizeY = drawable->rect.height; - blit.SrcFormat = drawable->pixelFormat; - - blit.pDstMemInfo = pixmap->backBuffers[pixmap->currentBackBuffer]; - blit.DstStride = pixmap->strideBytes; - blit.DstX = 0; - blit.DstY = 0; - blit.DSizeX = pixmap->rect.width; - blit.DSizeY = pixmap->rect.height; - blit.DstFormat = pixmap->pixelFormat; - - PVR2DBlt(pvrQwsDisplay.context, &blit); - PVR2DQueryBlitsComplete - (pvrQwsDisplay.context, pixmap->backBuffers[pixmap->currentBackBuffer], 1); - - return WSEGL_SUCCESS; -} - -/* Copy color data from a PBuffer to a native pixmap */ -static WSEGLError wseglCopyFromPBuffer - (void *address, unsigned long width, unsigned long height, - unsigned long stride, WSEGLPixelFormat format, - NativePixmapType nativePixmap) -{ - PvrQwsDrawable *pixmap = (PvrQwsDrawable *)nativePixmap; - PVR2DFORMAT pixelFormat; - - if (!pixmap) - return WSEGL_BAD_NATIVE_PIXMAP; - - /* We can only copy under certain conditions */ - switch (format) { - case WSEGL_PIXELFORMAT_565: - pixelFormat = PVR2D_RGB565; break; - case WSEGL_PIXELFORMAT_4444: - pixelFormat = PVR2D_ARGB4444; break; - case WSEGL_PIXELFORMAT_8888: - pixelFormat = PVR2D_ARGB8888; break; - default: - return WSEGL_BAD_CONFIG; - } - if (width > (unsigned long)(pixmap->rect.width) || - height > (unsigned long)(pixmap->rect.height) || - pixelFormat != pixmap->pixelFormat) { - return WSEGL_BAD_CONFIG; - } - - /* We'd like to use PVR2DBlt to do this, but there is no easy way - to map the virtual "address" into physical space to be able - to use the hardware assist. Use memcpy to do the work instead. - Note: PBuffer's are upside down, so we copy from the bottom up */ - char *srcaddr = (char *)address; - char *dstaddr = (char *)(pixmap->backBuffers[pixmap->currentBackBuffer]->pBase); - int dststride = pixmap->strideBytes; - int srcwidth = ((int)width) * pvrQwsDisplay.screens[0].bytesPerPixel; - srcaddr += height * stride; - while (height > 0) { - srcaddr -= (int)stride; - memcpy(dstaddr, srcaddr, srcwidth); - dstaddr += dststride; - --height; - } - return WSEGL_SUCCESS; -} - -/* Return the parameters of a drawable that are needed by the EGL layer */ -static WSEGLError wseglGetDrawableParameters - (WSEGLDrawableHandle _drawable, WSEGLDrawableParams *sourceParams, - WSEGLDrawableParams *renderParams) -{ - PvrQwsDrawable *drawable = (PvrQwsDrawable *)_drawable; - PVR2DMEMINFO *source, *render; - WSEGLPixelFormat pixelFormat; - - if (!pvrQwsGetBuffers(drawable, &source, &render)) - return WSEGL_BAD_DRAWABLE; - - switch (drawable->pixelFormat) { - case PVR2D_RGB565: - default: - pixelFormat = WSEGL_PIXELFORMAT_565; - break; - - case PVR2D_ARGB4444: - pixelFormat = WSEGL_PIXELFORMAT_4444; - break; - - case PVR2D_ARGB8888: - pixelFormat = WSEGL_PIXELFORMAT_8888; - break; - } - - sourceParams->ui32Width = drawable->rect.width; - sourceParams->ui32Height = drawable->rect.height; - sourceParams->ui32Stride = drawable->stridePixels; - sourceParams->ePixelFormat = pixelFormat; - sourceParams->pvLinearAddress = source->pBase; - sourceParams->ui32HWAddress = source->ui32DevAddr; - sourceParams->hPrivateData = source->hPrivateData; - - renderParams->ui32Width = drawable->rect.width; - renderParams->ui32Height = drawable->rect.height; - renderParams->ui32Stride = drawable->stridePixels; - renderParams->ePixelFormat = pixelFormat; - renderParams->pvLinearAddress = render->pBase; - renderParams->ui32HWAddress = render->ui32DevAddr; - renderParams->hPrivateData = render->hPrivateData; - - return WSEGL_SUCCESS; -} - -static WSEGL_FunctionTable const wseglFunctions = { - WSEGL_VERSION, - wseglIsDisplayValid, - wseglInitializeDisplay, - wseglCloseDisplay, - wseglCreateWindowDrawable, - wseglCreatePixmapDrawable, - wseglDeleteDrawable, - wseglSwapDrawable, - wseglSwapControlInterval, - wseglWaitNative, - wseglCopyFromDrawable, - wseglCopyFromPBuffer, - wseglGetDrawableParameters -}; - -/* Return the table of WSEGL functions to the EGL implementation */ -const WSEGL_FunctionTable *WSEGL_GetFunctionTablePointer(void) -{ - return &wseglFunctions; -} diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README deleted file mode 100644 index 513e7f5e9e8..00000000000 --- a/src/plugins/gfxdrivers/powervr/README +++ /dev/null @@ -1,66 +0,0 @@ -PowerVR QScreen Driver -====================== - -This QScreen plugin driver allows the QtOpenGl module to integrate with PowerVR -hardware from Imagination Technologies. Using this plugin, applications may use -QGLWidget & QGLPixelBuffer with OpenGL ES. The integration with PowerVR drivers -is built as two libraries: The actual QScreen plugin used by Qt (in the -pvreglscreen directory) and a WSEGL plugin for the PowerVR drivers (in the -QWSWSEGL directory). - -Qt/Embedded needs to be configured with the QT_QWS_CLIENTBLIT and -QT_NO_QWS_CURSOR defines. - -The PowerVR drivers provide the WSEGL plugin API to allow window systems such as -QWS to integrate correctly. In order to use the integration, the WSEGL plugin -(libpvrQWSWSEGL.so, usually installed into the Qt library directory) must be in -the LD library path. The PowerVR driver also needs to be told which WSEGL library -to use. This is done by creating/modifying /etc/powervr.ini: - -[default] -WindowSystem=libpvrQWSWSEGL.so - -Note: It is important that the /etc/powervr.ini file not contain ^M (Ctrl-M) DOS -end of line markers at the end of its lines. If ^M markers are present, then the -libpvrQWSWSEGL.so driver will not be loaded and the default null Linux driver -will be loaded silently instead. Make sure that the end of line markers are -strictly Unix-style markers. - - -*************************************************************************** -* IMPORTANT: To build the QScreen plugin and the WSEGL library it depends * -* on, the pvr2d.h, wsegl.h headers for your platform are required. You * -* can find a copy of these headers in src/3rdparty/powervr for SGX based * -* platforms like the TI OMAP3xxx. They probably will not work on MBX * -* because of differences in the layout of certain PVR2D structures. * -* You can tell Qt where to find the actual headers for your system by * -* setting QMAKE_INCDIR_POWERVR in the mkspec. * -*************************************************************************** - -When you start a Qt/Embedded application, you should modify the QWS_DISPLAY -environment variable to use the "powervr" driver instead of "LinuxFb". For -example, if your original QWS_DISPLAY variable was: - - LinuxFb:mmWidth40:mmHeight54:0 - -then it should be changed to: - - powervr:mmWidth40:mmHeight54:0 - -To test the OpenGL ES integration, you can use the hellogl_es example and run it -on the device with: - - hellogl_es -qws - -The driver also supports screen rotation if Qt is configured with the --qt-gfx-transformed option and the QWS_DISPLAY variable is wrapped in a -"Transformed" declaration: - - Transformed:powervr:mmWidth40:mmHeight54:Rot90:0 - -Know Issues: - * A QGLWidget may not have window decorations if it is a top-level window. - * On some platforms, starting a QWS application after the system has been up - for a long time may cause the driver to fail. This is due to fragmentation - of main memory prevening older PowerVR drivers from allocating a contiguous - region of phyical RAM for the GL surface. diff --git a/src/plugins/gfxdrivers/powervr/powervr.pri b/src/plugins/gfxdrivers/powervr/powervr.pri deleted file mode 100644 index 9df8c0ed5b0..00000000000 --- a/src/plugins/gfxdrivers/powervr/powervr.pri +++ /dev/null @@ -1,2 +0,0 @@ - -INCLUDEPATH += $$QMAKE_INCDIR_POWERVR diff --git a/src/plugins/gfxdrivers/powervr/powervr.pro b/src/plugins/gfxdrivers/powervr/powervr.pro deleted file mode 100644 index f31ad042d85..00000000000 --- a/src/plugins/gfxdrivers/powervr/powervr.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = QWSWSEGL pvreglscreen -CONFIG += ordered diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp deleted file mode 100644 index 0171de67974..00000000000 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ /dev/null @@ -1,351 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "pvreglscreen.h" -#include "pvreglwindowsurface.h" -#include "pvrqwsdrawable_p.h" -#include -#include -#ifndef QT_NO_QWS_TRANSFORMED -#include -#endif -#include -#include -#include -#include -#include - -//![0] -PvrEglScreen::PvrEglScreen(int displayId) - : QGLScreen(displayId) -{ - setOptions(NativeWindows); - setSupportsBlitInClients(true); - setSurfaceFunctions(new PvrEglScreenSurfaceFunctions(this, displayId)); -//![0] - fd = -1; - ttyfd = -1; - doGraphicsMode = true; - oldKdMode = KD_TEXT; - parent = 0; - - // Make sure that the EGL layer is initialized and the drivers loaded. - EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); - if (!eglInitialize(dpy, 0, 0)) - qWarning("Could not initialize EGL display - are the drivers loaded?"); - - // Make sure that screen 0 is initialized. - pvrQwsScreenWindow(0); -} - -PvrEglScreen::~PvrEglScreen() -{ - if (fd >= 0) - ::close(fd); -} - -bool PvrEglScreen::initDevice() -{ - openTty(); - return true; -} - -bool PvrEglScreen::connect(const QString &displaySpec) -{ - if (!pvrQwsDisplayOpen()) - return false; - - // Initialize the QScreen properties. - data = (uchar *)(pvrQwsDisplay.screens[0].mapped); - w = pvrQwsDisplay.screens[0].screenRect.width; - h = pvrQwsDisplay.screens[0].screenRect.height; - lstep = pvrQwsDisplay.screens[0].screenStride; - dw = w; - dh = h; - size = h * lstep; - mapsize = size; - switch (pvrQwsDisplay.screens[0].pixelFormat) { - case PVR2D_RGB565: - d = 16; - setPixelFormat(QImage::Format_RGB16); - break; - case PVR2D_ARGB4444: - d = 16; - setPixelFormat(QImage::Format_ARGB4444_Premultiplied); - break; - case PVR2D_ARGB8888: - d = 32; - setPixelFormat(QImage::Format_ARGB32_Premultiplied); - break; - default: - pvrQwsDisplayClose(); - qWarning("PvrEglScreen::connect: unsupported pixel format %d", (int)(pvrQwsDisplay.screens[0].pixelFormat)); - return false; - } - - // 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) { - const int dpi = 72; - physWidth = qRound(dw * 25.4 / dpi); - physHeight = qRound(dh * 25.4 / dpi); - } - - // Find the name of the tty device to use. - QRegExp ttyRegExp(QLatin1String("tty=(.*)")); - if (displayArgs.indexOf(ttyRegExp) != -1) - ttyDevice = ttyRegExp.cap(1); - if (displayArgs.contains(QLatin1String("nographicsmodeswitch"))) - doGraphicsMode = false; - - // The screen is ready. - return true; -} - -void PvrEglScreen::disconnect() -{ - pvrQwsDisplayClose(); -} - -void PvrEglScreen::shutdownDevice() -{ - closeTty(); -} - -void PvrEglScreen::blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion) -{ - QGLScreen::blit(img, topLeft, region); - sync(); -} - -void PvrEglScreen::solidFill(const QColor &color, const QRegion ®ion) -{ - QGLScreen::solidFill(color, region); - sync(); -} - -bool PvrEglScreen::chooseContext - (QGLContext *context, const QGLContext *shareContext) -{ - // We use PvrEglScreenSurfaceFunctions instead. - Q_UNUSED(context); - Q_UNUSED(shareContext); - return false; -} - -bool PvrEglScreen::hasOpenGL() -{ - return true; -} - -//![1] -QWSWindowSurface* PvrEglScreen::createSurface(QWidget *widget) const -{ - if (qobject_cast(widget)) - return new PvrEglWindowSurface(widget, (PvrEglScreen *)this, displayId); - - return QScreen::createSurface(widget); -} - -QWSWindowSurface* PvrEglScreen::createSurface(const QString &key) const -{ - if (key == QLatin1String("PvrEgl")) - return new PvrEglWindowSurface(); - - return QScreen::createSurface(key); -} -//![1] - -#ifndef QT_NO_QWS_TRANSFORMED - -static const QScreen *parentScreen - (const QScreen *current, const QScreen *lookingFor) -{ - if (!current) - return 0; - switch (current->classId()) { - case QScreen::ProxyClass: - case QScreen::TransformedClass: { - const QScreen *child = - static_cast(current)->screen(); - if (child == lookingFor) - return current; - else - return parentScreen(child, lookingFor); - } - // Not reached. - - case QScreen::MultiClass: { - QList screens = current->subScreens(); - foreach (QScreen *screen, screens) { - if (screen == lookingFor) - return current; - const QScreen *parent = parentScreen(screen, lookingFor); - if (parent) - return parent; - } - } - break; - - default: break; - } - return 0; -} - -int PvrEglScreen::transformation() const -{ - // We need to search for our parent screen, which is assumed to be - // "Transformed". If it isn't, then there is no transformation. - // There is no direct method to get the parent screen so we need - // to search every screen until we find ourselves. - if (!parent && qt_screen != this) - parent = parentScreen(qt_screen, this); - if (!parent) - return 0; - if (parent->classId() != QScreen::TransformedClass) - return 0; - return 90 * static_cast(parent) - ->transformOrientation(); -} - -#else - -int PvrEglScreen::transformation() const -{ - return 0; -} - -#endif - -void PvrEglScreen::sync() -{ - // Put code here to synchronize 2D and 3D operations if necessary. -} - -void PvrEglScreen::openTty() -{ - const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0}; - - if (ttyDevice.isEmpty()) { - for (const char * const *dev = devs; *dev; ++dev) { - ttyfd = ::open(*dev, O_RDWR); - if (ttyfd != -1) - break; - } - } else { - ttyfd = ::open(ttyDevice.toAscii().constData(), O_RDWR); - } - - if (ttyfd == -1) - return; - - ::fcntl(ttyfd, F_SETFD, FD_CLOEXEC); - - 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"; - ::write(ttyfd, termctl, sizeof(termctl)); -} - -void PvrEglScreen::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"; - ::write(ttyfd, termctl, sizeof(termctl)); - - ::close(ttyfd); - ttyfd = -1; -} - -//![2] -bool PvrEglScreenSurfaceFunctions::createNativeWindow(QWidget *widget, EGLNativeWindowType *native) -{ -//![2] - QWSWindowSurface *surface = - static_cast(widget->windowSurface()); - if (!surface) { - // The widget does not have a surface yet, so give it one. - surface = new PvrEglWindowSurface(widget, screen, displayId); - widget->setWindowSurface(surface); - } else if (surface->key() != QLatin1String("PvrEgl")) { - // The application has attached a QGLContext to an ordinary QWidget. - // Replace the widget's window surface with a new one that can do GL. - QRect geometry = widget->frameGeometry(); - geometry.moveTo(widget->mapToGlobal(QPoint(0, 0))); - surface = new PvrEglWindowSurface(widget, screen, displayId); - surface->setGeometry(geometry); - widget->setWindowSurface(surface); - widget->setAttribute(Qt::WA_NoSystemBackground, true); - } - PvrEglWindowSurface *nsurface = static_cast(surface); - *native = (EGLNativeWindowType)(nsurface->nativeDrawable()); - return true; -} diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro deleted file mode 100644 index 2b5212a6b3e..00000000000 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.pro +++ /dev/null @@ -1,27 +0,0 @@ -TEMPLATE = lib -TARGET = qgfxpvregl -CONFIG += qt plugin warn_on -QT += opengl - -LIBS += -lpvrQWSWSEGL - -DEFINES += QT_QWS_CLIENTBLIT - -INCLUDEPATH += ../QWSWSEGL - - -HEADERS = \ - pvreglscreen.h \ - pvreglwindowsurface.h - -SOURCES = \ - pvreglscreenplugin.cpp \ - pvreglscreen.cpp \ - pvreglwindowsurface.cpp - -DESTDIR = $$QT.gui.plugins/gfxdrivers - -target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers -INSTALLS += target - -include(../powervr.pri) \ No newline at end of file diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreenplugin.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreenplugin.cpp deleted file mode 100644 index 943bf9473c8..00000000000 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreenplugin.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "pvreglscreen.h" - -#include -#include - -class PvrEglScreenPlugin : public QScreenDriverPlugin -{ -public: - PvrEglScreenPlugin(); - - QStringList keys() const; - QScreen *create(const QString&, int displayId); -}; - -PvrEglScreenPlugin::PvrEglScreenPlugin() - : QScreenDriverPlugin() -{ -} - -QStringList PvrEglScreenPlugin::keys() const -{ - return (QStringList() << "powervr"); -} - -QScreen* PvrEglScreenPlugin::create(const QString& driver, int displayId) -{ - if (driver.toLower() != "powervr") - return 0; - - return new PvrEglScreen(displayId); -} - -Q_EXPORT_PLUGIN2(qgfxpvregl, PvrEglScreenPlugin) diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp deleted file mode 100644 index f23f5c1cc42..00000000000 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "pvreglwindowsurface.h" -#include "pvreglscreen.h" -#include -#include -#include - -PvrEglWindowSurface::PvrEglWindowSurface - (QWidget *widget, PvrEglScreen *screen, int screenNum) - : QWSGLWindowSurface(widget) -{ - setSurfaceFlags(QWSWindowSurface::Opaque); - - this->widget = widget; - this->screen = screen; - this->pdevice = 0; - - QPoint pos = offset(widget); - QSize size = widget->size(); - - PvrQwsRect pvrRect; - pvrRect.x = pos.x(); - pvrRect.y = pos.y(); - pvrRect.width = size.width(); - pvrRect.height = size.height(); - transformRects(&pvrRect, 1); - - // Try to recover a previous PvrQwsDrawable object for the widget - // if there is one. This can happen when a PvrEglWindowSurface - // is created for a widget, bound to a EGLSurface, and then destroyed. - // When a new PvrEglWindowSurface is created for the widget, it will - // pick up the previous PvrQwsDrawable if the EGLSurface has not been - // destroyed in the meantime. - drawable = pvrQwsFetchWindow((long)widget); - if (drawable) - pvrQwsSetGeometry(drawable, &pvrRect); - else - drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect); - pvrQwsSetRotation(drawable, screen->transformation()); -} - -PvrEglWindowSurface::PvrEglWindowSurface() - : QWSGLWindowSurface() -{ - setSurfaceFlags(QWSWindowSurface::Opaque); - drawable = 0; - widget = 0; - screen = 0; - pdevice = 0; -} - -PvrEglWindowSurface::~PvrEglWindowSurface() -{ - // Release the PvrQwsDrawable. If it is bound to an EGLSurface, - // then it will stay around until a new PvrEglWindowSurface is - // created for the widget. If it is not bound to an EGLSurface, - // it will be destroyed immediately. - if (drawable && pvrQwsReleaseWindow(drawable)) - pvrQwsDestroyDrawable(drawable); - - delete pdevice; -} - -bool PvrEglWindowSurface::isValid() const -{ - return (widget != 0); -} - -void PvrEglWindowSurface::setGeometry(const QRect &rect) -{ - if (drawable) { - // XXX: adjust for the screen offset. - PvrQwsRect pvrRect; - pvrRect.x = rect.x(); - pvrRect.y = rect.y(); - pvrRect.width = rect.width(); - pvrRect.height = rect.height(); - transformRects(&pvrRect, 1); - pvrQwsSetGeometry(drawable, &pvrRect); - pvrQwsSetRotation(drawable, screen->transformation()); - } - QWSGLWindowSurface::setGeometry(rect); -} - -bool PvrEglWindowSurface::move(const QPoint &offset) -{ - QRect rect = geometry().translated(offset); - if (drawable) { - PvrQwsRect pvrRect; - pvrRect.x = rect.x(); - pvrRect.y = rect.y(); - pvrRect.width = rect.width(); - pvrRect.height = rect.height(); - transformRects(&pvrRect, 1); - pvrQwsSetGeometry(drawable, &pvrRect); - pvrQwsSetRotation(drawable, screen->transformation()); - } - return QWSGLWindowSurface::move(offset); -} - -QByteArray PvrEglWindowSurface::permanentState() const -{ - // Nothing interesting to pass to the server just yet. - return QByteArray(); -} - -void PvrEglWindowSurface::setPermanentState(const QByteArray &state) -{ - Q_UNUSED(state); -} - -void PvrEglWindowSurface::flush - (QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - // The GL paint engine is responsible for the swapBuffers() call. - // If we were to call the base class's implementation of flush() - // then it would fetch the image() and manually blit it to the - // screeen instead of using the fast PVR2D blit. - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); -} - -QImage PvrEglWindowSurface::image() const -{ - if (drawable) { - PvrQwsRect pvrRect; - pvrQwsGetGeometry(drawable, &pvrRect); - void *data = pvrQwsGetRenderBuffer(drawable); - if (data) { - return QImage((uchar *)data, pvrRect.width, pvrRect.height, - pvrQwsGetStride(drawable), screen->pixelFormat()); - } - } - return QImage(16, 16, screen->pixelFormat()); -} - -QPaintDevice *PvrEglWindowSurface::paintDevice() -{ - return widget; -} - -void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) -{ - QWSGLWindowSurface::setDirectRegion(r, id); - - if (!drawable) - return; - - // Clip the region to the window boundaries in case the child - // is partially outside the geometry of the parent. - QWidget *window = widget->window(); - QRegion region = r; - if (widget != window) { - QRect rect = window->geometry(); - rect.moveTo(window->mapToGlobal(QPoint(0, 0))); - region = region.intersect(rect); - } - - if (region.isEmpty()) { - pvrQwsClearVisibleRegion(drawable); - } else if (region.rectCount() == 1) { - QRect rect = region.boundingRect(); - PvrQwsRect pvrRect; - pvrRect.x = rect.x(); - pvrRect.y = rect.y(); - pvrRect.width = rect.width(); - pvrRect.height = rect.height(); - transformRects(&pvrRect, 1); - pvrQwsSetVisibleRegion(drawable, &pvrRect, 1); - pvrQwsSetRotation(drawable, screen->transformation()); - if (!pvrQwsSwapBuffers(drawable, 1)) - screen->solidFill(QColor(0, 0, 0), region); - } else { - QVector rects = region.rects(); - PvrQwsRect *pvrRects = new PvrQwsRect [rects.size()]; - for (int index = 0; index < rects.size(); ++index) { - QRect rect = rects[index]; - pvrRects[index].x = rect.x(); - pvrRects[index].y = rect.y(); - pvrRects[index].width = rect.width(); - pvrRects[index].height = rect.height(); - } - transformRects(pvrRects, rects.size()); - pvrQwsSetVisibleRegion(drawable, pvrRects, rects.size()); - pvrQwsSetRotation(drawable, screen->transformation()); - if (!pvrQwsSwapBuffers(drawable, 1)) - screen->solidFill(QColor(0, 0, 0), region); - delete [] pvrRects; - } -} - -void PvrEglWindowSurface::transformRects(PvrQwsRect *rects, int count) const -{ - switch (screen->transformation()) { - case 0: break; - - case 90: - { - for (int index = 0; index < count; ++index) { - int x = rects[index].y; - int y = screen->height() - (rects[index].x + rects[index].width); - rects[index].x = x; - rects[index].y = y; - qSwap(rects[index].width, rects[index].height); - } - } - break; - - case 180: - { - for (int index = 0; index < count; ++index) { - int x = screen->width() - (rects[index].x + rects[index].width); - int y = screen->height() - (rects[index].y + rects[index].height); - rects[index].x = x; - rects[index].y = y; - } - } - break; - - case 270: - { - for (int index = 0; index < count; ++index) { - int x = screen->width() - (rects[index].y + rects[index].height); - int y = rects[index].x; - rects[index].x = x; - rects[index].y = y; - qSwap(rects[index].width, rects[index].height); - } - } - break; - } -} diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h deleted file mode 100644 index 365fed91705..00000000000 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PVREGLWINDOWSURFACE_H -#define PVREGLWINDOWSURFACE_H - -#include -#include "pvrqwsdrawable.h" - -class PvrEglScreen; - -class PvrEglWindowSurface : public QWSGLWindowSurface -{ -public: - PvrEglWindowSurface(QWidget *widget, PvrEglScreen *screen, int screenNum); - PvrEglWindowSurface(); - ~PvrEglWindowSurface(); - - QString key() const { return QLatin1String("PvrEgl"); } - - bool isValid() const; - - void setGeometry(const QRect &rect); - bool move(const QPoint &offset); - - QByteArray permanentState() const; - void setPermanentState(const QByteArray &state); - - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - - QImage image() const; - QPaintDevice *paintDevice(); - - void setDirectRegion(const QRegion ®ion, int id); - - long nativeDrawable() const { return (long)widget; } - -private: - QWidget *widget; - PvrQwsDrawable *drawable; - PvrEglScreen *screen; - QPaintDevice *pdevice; - - void transformRects(PvrQwsRect *rects, int count) const; -}; - -#endif diff --git a/src/plugins/gfxdrivers/qvfb/qvfb.pro b/src/plugins/gfxdrivers/qvfb/qvfb.pro deleted file mode 100644 index 99376be81c1..00000000000 --- a/src/plugins/gfxdrivers/qvfb/qvfb.pro +++ /dev/null @@ -1,19 +0,0 @@ -TARGET = qscreenvfb -load(qt_plugin) - -DEFINES += QT_QWS_QVFB QT_QWS_MOUSE_QVFB QT_QWS_KBD_QVFB - -DESTDIR = $$QT.gui.plugins/gfxdrivers - -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 = main.cpp \ - $$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/transformed/main.cpp b/src/plugins/gfxdrivers/transformed/main.cpp deleted file mode 100644 index 612068e3a65..00000000000 --- a/src/plugins/gfxdrivers/transformed/main.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#ifndef QT_NO_LIBRARY -QT_BEGIN_NAMESPACE - -class GfxTransformedDriver : public QScreenDriverPlugin -{ -public: - GfxTransformedDriver(); - - QStringList keys() const; - QScreen *create(const QString&, int displayId); -}; - -GfxTransformedDriver::GfxTransformedDriver() -: QScreenDriverPlugin() -{ -} - -QStringList GfxTransformedDriver::keys() const -{ - QStringList list; - list << "Transformed"; - return list; -} - -QScreen* GfxTransformedDriver::create(const QString& driver, int displayId) -{ -#ifndef QT_NO_QWS_TRANSFORMED - if (driver.toLower() == "transformed") - return new QTransformedScreen(displayId); -#else //QT_NO_QWS_TRANSFORMED - printf("QT buildt with QT_NO_QWS_TRANSFORMED. No screen driver returned\n"); -#endif //QT_NO_QWS_TRANSFORMED - return 0; -} - -Q_EXPORT_STATIC_PLUGIN(GfxTransformedDriver) -Q_EXPORT_PLUGIN2(qgfxtransformed, GfxTransformedDriver) - -QT_END_NAMESPACE -#endif //QT_NO_LIBRARY diff --git a/src/plugins/gfxdrivers/transformed/transformed.pro b/src/plugins/gfxdrivers/transformed/transformed.pro deleted file mode 100644 index f97713fc38b..00000000000 --- a/src/plugins/gfxdrivers/transformed/transformed.pro +++ /dev/null @@ -1,13 +0,0 @@ -TARGET = qgfxtransformed -load(qt_plugin) - -DEFINES += QT_QWS_TRANSFORMED - -DESTDIR = $$QT.gui.plugins/gfxdrivers - -HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qscreentransformed_qws.h -SOURCES = main.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qscreentransformed_qws.cpp - -target.path=$$[QT_INSTALL_PLUGINS]/gfxdrivers -INSTALLS += target diff --git a/src/plugins/gfxdrivers/vnc/main.cpp b/src/plugins/gfxdrivers/vnc/main.cpp deleted file mode 100644 index 0a7ae592e04..00000000000 --- a/src/plugins/gfxdrivers/vnc/main.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#ifndef QT_NO_LIBRARY -QT_BEGIN_NAMESPACE - -class GfxVncDriver : public QScreenDriverPlugin -{ -public: - GfxVncDriver(); - - QStringList keys() const; - QScreen *create(const QString&, int displayId); -}; - -GfxVncDriver::GfxVncDriver() -: QScreenDriverPlugin() -{ -} - -QStringList GfxVncDriver::keys() const -{ - QStringList list; - list << "VNC"; - return list; -} - -QScreen* GfxVncDriver::create(const QString& driver, int displayId) -{ -#ifndef QT_NO_QWS_VNC - if (driver.toLower() == "vnc") - return new QVNCScreen(displayId); -#else //QT_NO_QWS_VNC - printf("QT buildt with QT_NO_QWS_VNC. No screen driver returned\n"); -#endif //QT_NO_QWS_VNC - return 0; -} - -Q_EXPORT_STATIC_PLUGIN(GfxVncDriver) -Q_EXPORT_PLUGIN2(qgfxvnc, GfxVncDriver) - -QT_END_NAMESPACE - -#endif //QT_NO_LIBRARY diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_p.h b/src/plugins/gfxdrivers/vnc/qscreenvnc_p.h deleted file mode 100644 index e64393a8c9f..00000000000 --- a/src/plugins/gfxdrivers/vnc/qscreenvnc_p.h +++ /dev/null @@ -1,524 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $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 "qscreenvnc_qws.h" - -#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(QVNCScreen *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; - QVNCScreen *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(QScreen *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; - QScreen *screen; - uchar *buffer; - int bufferWidth; - int bufferHeight; - int bufferStride; - int numTiles; -}; - -template -class QVNCDirtyMapOptimized : public QVNCDirtyMap -{ -public: - QVNCDirtyMapOptimized(QScreen *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); - - uint buttons; - quint16 x; - quint16 y; -}; - -class QRfbClientCutText -{ -public: - bool read(QTcpSocket *s); - - quint32 length; -}; - -class QVNCScreenPrivate : public QObject -{ -public: - QVNCScreenPrivate(QVNCScreen *parent); - ~QVNCScreenPrivate(); - - 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 - - QVNCScreen *q_ptr; - - bool noDisablePainting; -}; - -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(QVNCScreen *screen); - QVNCServer(QVNCScreen *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 QVNCScreen* screen() const { return qvnc_screen; } - inline QVNCDirtyMap* dirtyMap() const { return qvnc_screen->d_ptr->dirty; } - 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; - 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; - QVNCScreen *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/gfxdrivers/vnc/qscreenvnc_qws.cpp b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp deleted file mode 100644 index 3ddedc63ea6..00000000000 --- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp +++ /dev/null @@ -1,2338 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qscreenvnc_qws.h" - -#ifndef QT_NO_QWS_VNC - -#include "qscreenvnc_p.h" -#include "qwindowsystem_qws.h" -#include "qwsdisplay_qws.h" -#include "qscreendriverfactory_qws.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -//#define QT_QWS_VNC_DEBUG - -extern QString qws_qtePipeFilename(); - -#ifndef QT_NO_QWS_CURSOR - -QVNCCursor::QVNCCursor(QVNCScreen *s) - : screen(s) -{ - if (qt_screencursor) - setScreenCursor(qt_screencursor); - else - hwaccel = true; -} - -QVNCCursor::~QVNCCursor() -{ - if (screenCursor()) - qt_screencursor = screenCursor(); -} - -void QVNCCursor::setDirty(const QRect &r) const -{ - screen->d_ptr->setDirty(r, true); -} - -void QVNCCursor::hide() -{ - QProxyScreenCursor::hide(); - if (enable) - setDirty(boundingRect()); -} - -void QVNCCursor::show() -{ - QProxyScreenCursor::show(); - if (enable) - setDirty(boundingRect()); -} - -void QVNCCursor::set(const QImage &image, int hotx, int hoty) -{ - QRegion dirty = boundingRect(); - QProxyScreenCursor::set(image, hotx, hoty); - dirty |= boundingRect(); - if (enable && hwaccel && !screen->d_ptr->vncServer->hasClientCursor()) { - const QVector rects = dirty.rects(); - for (int i = 0; i < rects.size(); ++i) - setDirty(rects.at(i)); - } -} - -void QVNCCursor::move(int x, int y) -{ - if (enable && hwaccel && !screen->d_ptr->vncServer->hasClientCursor()) { - QRegion dirty = boundingRect(); - QProxyScreenCursor::move(x, y); - dirty |= boundingRect(); - if (enable) { - const QVector rects = dirty.rects(); - for (int i = 0; i < rects.size(); ++i) - setDirty(rects.at(i)); - } - } else { - QProxyScreenCursor::move(x, y); - } -} - -QVNCClientCursor::QVNCClientCursor(QVNCServer *s) - : server(s) -{ - setScreenCursor(qt_screencursor); - Q_ASSERT(hwaccel); - qt_screencursor = this; // hw: XXX - - set(image(), hotspot.x(), hotspot.y()); -} - -QVNCClientCursor::~QVNCClientCursor() -{ - qt_screencursor = screenCursor(); -} - -void QVNCClientCursor::set(const QImage &image, int hotx, int hoty) -{ - QScreenCursor::set(image, hotx, hoty); - server->setDirtyCursor(); -} - -void QVNCClientCursor::write() const -{ - QTcpSocket *socket = server->clientSocket(); - - // FramebufferUpdate header - { - const quint16 tmp[6] = { htons(0), - htons(1), - htons(hotspot.x()), htons(hotspot.y()), - htons(cursor.width()), - htons(cursor.height()) }; - socket->write((char*)tmp, sizeof(tmp)); - - const quint32 encoding = htonl(-239); - socket->write((char*)(&encoding), sizeof(encoding)); - } - - if (cursor.isNull()) - return; - - // write pixels - Q_ASSERT(cursor.hasAlphaChannel()); - const QImage img = cursor.convertToFormat(server->screen()->pixelFormat()); - 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 = cursor.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); -} - -#endif // QT_NO_QWS_CURSOR - -QVNCScreenPrivate::QVNCScreenPrivate(QVNCScreen *parent) - : dpiX(72), dpiY(72), doOnScreenSurface(false), refreshRate(25), - vncServer(0), q_ptr(parent), noDisablePainting(false) -{ -#ifdef QT_BUILD_INTERNAL - noDisablePainting = (qgetenv("QT_VNC_NO_DISABLEPAINTING").toInt() > 0); -#endif -#ifndef QT_NO_QWS_SIGNALHANDLER - QWSSignalHandler::instance()->addObject(this); -#endif -} - -QVNCScreenPrivate::~QVNCScreenPrivate() -{ -#if defined(QT_NO_QWS_MULTIPROCESS) || defined(QT_NO_SHAREDMEMORY) - if (q_ptr->screen()) - return; - - delete[] q_ptr->data; - q_ptr->data = 0; -#else - shm.detach(); -#endif -} - -void QVNCScreenPrivate::configure() -{ - if (q_ptr->screen()) - return; - - q_ptr->lstep = q_ptr->dw * ((q_ptr->d + 7) / 8); - q_ptr->size = q_ptr->h * q_ptr->lstep; - q_ptr->mapsize = q_ptr->size; - q_ptr->physWidth = qRound(q_ptr->dw * qreal(25.4) / dpiX); - q_ptr->physHeight = qRound(q_ptr->dh * qreal(25.4) / dpiY); - - switch (q_ptr->d) { - case 1: - q_ptr->setPixelFormat(QImage::Format_Mono); //### LSB??? - break; - case 8: - q_ptr->setPixelFormat(QImage::Format_Indexed8); - break; - case 12: - q_ptr->setPixelFormat(QImage::Format_RGB444); - break; - case 15: - q_ptr->setPixelFormat(QImage::Format_RGB555); - break; - case 16: - q_ptr->setPixelFormat(QImage::Format_RGB16); - break; - case 18: - q_ptr->setPixelFormat(QImage::Format_RGB666); - break; - case 24: - q_ptr->setPixelFormat(QImage::Format_RGB888); - break; - case 32: - q_ptr->setPixelFormat(QImage::Format_ARGB32_Premultiplied); - break; - } - -#if !defined(QT_NO_QWS_MULTIPROCESS) && !defined(QT_NO_SHAREDMEMORY) - if (q_ptr->size != shm.size()) { - shm.detach(); - const QString key = qws_qtePipeFilename() + - QString().sprintf("_vnc_%d_%d", - q_ptr->displayId, q_ptr->size); - shm.setKey(key); - if (QApplication::type() == QApplication::GuiServer) { - if (!shm.create(q_ptr->size)) { - qWarning() << "QVNCScreen could not create shared memory:" - << shm.errorString(); - if (!shm.attach()) { - qWarning() << "QVNCScreen could not attach to shared memory:" - << shm.errorString(); - } - } - } else if (!shm.attach()) { - qWarning() << "QVNCScreen could not attach to shared memory:" - << shm.errorString(); - } - q_ptr->data = reinterpret_cast(shm.data()); - } -#else - if (q_ptr->data) - delete[] q_ptr->data; - q_ptr->data = new uchar[q_ptr->size]; -#endif -} - -//=========================================================================== - -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 }, - - { 0xffb0, Qt::Key_0 }, - { 0xffb1, Qt::Key_1 }, - { 0xffb2, Qt::Key_2 }, - { 0xffb3, Qt::Key_3 }, - { 0xffb4, Qt::Key_4 }, - { 0xffb5, Qt::Key_5 }, - { 0xffb6, Qt::Key_6 }, - { 0xffb7, Qt::Key_7 }, - { 0xffb8, Qt::Key_8 }, - { 0xffb9, Qt::Key_9 }, - - { 0xff8d, Qt::Key_Return }, - { 0xffaa, Qt::Key_Asterisk }, - { 0xffab, Qt::Key_Plus }, - { 0xffad, Qt::Key_Minus }, - { 0xffae, Qt::Key_Period }, - { 0xffaf, Qt::Key_Slash }, - - { 0xff95, Qt::Key_Home }, - { 0xff96, Qt::Key_Left }, - { 0xff97, Qt::Key_Up }, - { 0xff98, Qt::Key_Right }, - { 0xff99, Qt::Key_Down }, - { 0xff9a, Qt::Key_PageUp }, - { 0xff9b, Qt::Key_PageDown }, - { 0xff9c, Qt::Key_End }, - { 0xff9e, Qt::Key_Insert }, - { 0xff9f, Qt::Key_Delete }, - - { 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 >= ' ' && keycode <= '~') - unicode = keycode; - - 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 = 0; - 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(QVNCScreen *screen) - : qvnc_screen(screen) -{ - init(5900); -} - -QVNCServer::QVNCServer(QVNCScreen *screen, int id) - : qvnc_screen(screen) -{ - init(5900 + id); -} - -void QVNCServer::init(uint 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() && !qvnc_screen->d_ptr->noDisablePainting) - 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->deviceWidth(); - sim.height = qvnc_screen->deviceHeight(); - 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 Q_BYTE_ORDER == Q_BIG_ENDIAN -bool QVNCScreen::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; - } -} - -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); - 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) - QWSServer::sendKeyEvent(ev.unicode, ev.keycode, keymod, ev.down, false); - handleMsg = false; - } -} - -void QVNCServer::clientCutText() -{ - QRfbClientCutText ev; - - if (cutTextPending == 0 && 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 = 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 = 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 - case 8: { - QRgb rgb = qvnc_screen->clut()[int(*src)]; - r = qRed(rgb); - g = qGreen(rgb); - b = qBlue(rgb); - src++; - break; - } -#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(QScreen *s) - : bytesPerPixel(0), numDirty(0), screen(s) -{ - bytesPerPixel = (screen->depth() + 7) / 8; - bufferWidth = screen->deviceWidth(); - bufferHeight = screen->deviceHeight(); - 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); - - for (int y = 0; y < map->mapHeight; ++y) { - if (rect.y + MAP_TILE_SIZE > server->screen()->height()) - rect.h = server->screen()->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 > server->screen()->deviceWidth()) - rect.w = server->screen()->deviceWidth() - 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(); - - // 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, server->screen()->deviceWidth(), - server->screen()->deviceHeight()); - } - 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 QImage(qvnc_screen->base(), qvnc_screen->deviceWidth(), - qvnc_screen->deviceHeight(), qvnc_screen->linestep(), - qvnc_screen->pixelFormat()); -} - -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() && !qvnc_screen->d_ptr->noDisablePainting && QWSServer::instance()) - QWSServer::instance()->enablePainting(false); -} - - -//=========================================================================== - -/*! - \class QVNCScreen - \internal - \ingroup qws - - \brief The QVNCScreen class implements a screen driver for VNC - servers. - - Note that this class is only available in \l{Qt for Embedded Linux}. - Custom screen drivers can be added by subclassing the QScreen - class, using the QScreenDriverFactory class to dynamically load - the driver into the application. - - The VNC protocol allows you to view and interact with the - computer's display from anywhere on the network. See the - \l{The VNC Protocol and Qt for Embedded Linux}{VNC protocol} - documentation for more details. - - The default implementation of QVNCScreen inherits QLinuxFbScreen, - but any QScreen subclass, or QScreen itself, can serve as its base - class. This is easily achieved by manipulating the \c - VNCSCREEN_BASE definition in the header file. - - \sa QScreen, {Running Applications} -*/ - -/*! - \fn QVNCScreen::QVNCScreen(int displayId) - - Constructs a QVNCScreen object. The \a displayId argument - identifies the Qt for Embedded Linux server to connect to. -*/ -QVNCScreen::QVNCScreen(int display_id) - : QProxyScreen(display_id, VNCClass) -{ - d_ptr = new QVNCScreenPrivate(this); -} - -/*! - Destroys this QVNCScreen object. -*/ -QVNCScreen::~QVNCScreen() -{ - delete d_ptr; -} - -/*! - \reimp -*/ -void QVNCScreen::setDirty(const QRect &rect) -{ - d_ptr->setDirty(rect); -} - -void QVNCScreenPrivate::setDirty(const QRect& rect, bool force) -{ - if (rect.isEmpty()) - return; - - if (q_ptr->screen()) - q_ptr->screen()->setDirty(rect); - - if (!vncServer || !vncServer->isConnected()) - 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(); -} - -static int getDisplayId(const QString &spec) -{ - QRegExp regexp(QLatin1String(":(\\d+)\\b")); - if (regexp.lastIndexIn(spec) != -1) { - const QString capture = regexp.cap(1); - return capture.toInt(); - } - return 0; -} - -/*! - \reimp -*/ -bool QVNCScreen::connect(const QString &displaySpec) -{ - QString dspec = displaySpec; - if (dspec.startsWith(QLatin1String("vnc:"), Qt::CaseInsensitive)) - dspec = dspec.mid(QString::fromLatin1("vnc:").size()); - else if (dspec.compare(QLatin1String("vnc"), Qt::CaseInsensitive) == 0) - dspec = QString(); - - const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId); - if (dspec.endsWith(displayIdSpec)) - dspec = dspec.left(dspec.size() - displayIdSpec.size()); - - QStringList args = dspec.split(QLatin1Char(':'), - QString::SkipEmptyParts); - QRegExp refreshRegexp(QLatin1String("^refreshrate=(\\d+)$")); - int index = args.indexOf(refreshRegexp); - if (index >= 0) { - d_ptr->refreshRate = refreshRegexp.cap(1).toInt(); - args.removeAt(index); - dspec = args.join(QLatin1String(":")); - } - - QString driver = dspec; - int colon = driver.indexOf(QLatin1Char(':')); - if (colon >= 0) - driver.truncate(colon); - - if (QScreenDriverFactory::keys().contains(driver, Qt::CaseInsensitive)) { - const int id = getDisplayId(dspec); - QScreen *s = qt_get_screen(id, dspec.toLatin1().constData()); - if (s->pixelFormat() == QImage::Format_Indexed8 - || s->pixelFormat() == QImage::Format_Invalid && s->depth() == 8) - qFatal("QVNCScreen: unsupported screen format"); - setScreen(s); - } else { // create virtual screen -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - QScreen::setFrameBufferLittleEndian(false); -#endif - - d = qgetenv("QWS_DEPTH").toInt(); - if (!d) - d = 16; - - QByteArray str = qgetenv("QWS_SIZE"); - if(!str.isEmpty()) { - sscanf(str.constData(), "%dx%d", &w, &h); - dw = w; - dh = h; - } else { - dw = w = 640; - dh = h = 480; - } - - const QStringList args = displaySpec.split(QLatin1Char(':'), - QString::SkipEmptyParts); - - if (args.contains(QLatin1String("paintonscreen"), Qt::CaseInsensitive)) - d_ptr->doOnScreenSurface = true; - - QRegExp depthRegexp(QLatin1String("^depth=(\\d+)$")); - if (args.indexOf(depthRegexp) != -1) - d = depthRegexp.cap(1).toInt(); - - QRegExp sizeRegexp(QLatin1String("^size=(\\d+)x(\\d+)$")); - if (args.indexOf(sizeRegexp) != -1) { - dw = w = sizeRegexp.cap(1).toInt(); - dh = h = sizeRegexp.cap(2).toInt(); - } - - // Handle display physical size spec. - QRegExp mmWidthRegexp(QLatin1String("^mmWidth=?(\\d+)$")); - if (args.indexOf(mmWidthRegexp) != -1) { - const int mmWidth = mmWidthRegexp.cap(1).toInt(); - if (mmWidth > 0) - d_ptr->dpiX = dw * 25.4 / mmWidth; - } - QRegExp mmHeightRegexp(QLatin1String("^mmHeight=?(\\d+)$")); - if (args.indexOf(mmHeightRegexp) != -1) { - const int mmHeight = mmHeightRegexp.cap(1).toInt(); - if (mmHeight > 0) - d_ptr->dpiY = dh * 25.4 / mmHeight; - } - QRegExp dpiRegexp(QLatin1String("^dpi=(\\d+)(?:,(\\d+))?$")); - if (args.indexOf(dpiRegexp) != -1) { - const qreal dpiX = dpiRegexp.cap(1).toFloat(); - const qreal dpiY = dpiRegexp.cap(2).toFloat(); - if (dpiX > 0) - d_ptr->dpiX = dpiX; - d_ptr->dpiY = (dpiY > 0 ? dpiY : dpiX); - } - - if (args.contains(QLatin1String("noDisablePainting"))) - d_ptr->noDisablePainting = true; - - QWSServer::setDefaultMouse("None"); - QWSServer::setDefaultKeyboard("None"); - - d_ptr->configure(); - } - - // XXX - qt_screen = this; - - return true; -} - -/*! - \reimp -*/ -void QVNCScreen::disconnect() -{ - QProxyScreen::disconnect(); -#if !defined(QT_NO_QWS_MULTIPROCESS) && !defined(QT_NO_SHAREDMEMORY) - d_ptr->shm.detach(); -#endif -} - -/*! - \reimp -*/ -bool QVNCScreen::initDevice() -{ - if (!QProxyScreen::screen() && d == 4) { - screencols = 16; - int val = 0; - for (int idx = 0; idx < 16; idx++, val += 17) { - screenclut[idx] = qRgb(val, val, val); - } - } - d_ptr->vncServer = new QVNCServer(this, displayId); - d_ptr->vncServer->setRefreshRate(d_ptr->refreshRate); - - switch (depth()) { -#ifdef QT_QWS_DEPTH_32 - case 32: - d_ptr->dirty = new QVNCDirtyMapOptimized(this); - break; -#endif -#ifdef QT_QWS_DEPTH_24 - case 24: - d_ptr->dirty = new QVNCDirtyMapOptimized(this); - break; -#endif -#ifdef QT_QWS_DEPTH_18 - case 18: - d_ptr->dirty = new QVNCDirtyMapOptimized(this); - break; -#endif -#ifdef QT_QWS_DEPTH_16 - case 16: - d_ptr->dirty = new QVNCDirtyMapOptimized(this); - break; -#endif -#ifdef QT_QWS_DEPTH_15 - case 15: - d_ptr->dirty = new QVNCDirtyMapOptimized(this); - break; -#endif -#ifdef QT_QWS_DEPTH_12 - case 12: - d_ptr->dirty = new QVNCDirtyMapOptimized(this); - break; -#endif -#ifdef QT_QWS_DEPTH_8 - case 8: - d_ptr->dirty = new QVNCDirtyMapOptimized(this); - break; -#endif - default: - qWarning("QVNCScreen::initDevice: No support for screen depth %d", - depth()); - d_ptr->dirty = 0; - return false; - } - - - const bool ok = QProxyScreen::initDevice(); -#ifndef QT_NO_QWS_CURSOR - qt_screencursor = new QVNCCursor(this); -#endif - if (QProxyScreen::screen()) - return ok; - - // Disable painting if there is only 1 display and nothing is attached to the VNC server - if (!d_ptr->noDisablePainting) - QWSServer::instance()->enablePainting(false); - - return true; -} - -/*! - \reimp -*/ -void QVNCScreen::shutdownDevice() -{ - QProxyScreen::shutdownDevice(); - delete d_ptr->vncServer; - delete d_ptr->dirty; -} - -QT_END_NAMESPACE - -#endif // QT_NO_QWS_VNC diff --git a/src/plugins/gfxdrivers/vnc/vnc.pro b/src/plugins/gfxdrivers/vnc/vnc.pro deleted file mode 100644 index 95e2ba7cf8c..00000000000 --- a/src/plugins/gfxdrivers/vnc/vnc.pro +++ /dev/null @@ -1,16 +0,0 @@ -TARGET = qgfxvnc -load(qt_plugin) - -DEFINES += QT_QWS_VNC - -DESTDIR = $$QT.gui.plugins/gfxdrivers - -HEADERS = \ - qscreenvnc_qws.h \ - qscreenvnc_p.h - -SOURCES = main.cpp \ - qscreenvnc_qws.cpp - -target.path += $$[QT_INSTALL_PLUGINS]/gfxdrivers -INSTALLS += target diff --git a/src/plugins/graphicssystems/graphicssystems.pro b/src/plugins/graphicssystems/graphicssystems.pro deleted file mode 100644 index 5c992910478..00000000000 --- a/src/plugins/graphicssystems/graphicssystems.pro +++ /dev/null @@ -1,15 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += trace -!wince*:contains(QT_CONFIG, opengl):SUBDIRS += opengl -contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl) { - SUBDIRS += openvg -} - -contains(QT_CONFIG, shivavg) { - # Only works under X11 at present - !win32:!embedded:!mac:SUBDIRS += shivavg -} - -!win32:!embedded:!mac:!symbian:CONFIG += x11 - -x11:contains(QT_CONFIG, opengles2):contains(QT_CONFIG, egl):SUBDIRS += meego diff --git a/src/plugins/graphicssystems/meego/dithering.cpp b/src/plugins/graphicssystems/meego/dithering.cpp deleted file mode 100644 index 6e4b61c7541..00000000000 --- a/src/plugins/graphicssystems/meego/dithering.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// Implements two dithering methods: -// -// * convertRGBA32_to_RGB565 -// -// This is implemented using Ordered Bayer Dithering. The code has been adapted -// from QX11PixmapData::fromImage. This method was originally implemented using -// Floyd-Steinberg dithering but was later changed to Ordered Dithering because -// of the better quality of the results. -// -// * convertRGBA32_to_RGBA4444 -// -// This is implemented using Floyd-Steinberg dithering. -// -// The alghorithm used here is not the fastest possible but it's prolly fast enough: -// uses look-up tables, integer-only arthmetics and works in one pass on two lines -// at a time. It's a high-quality dithering using 1/8 diffusion precission. -// Each channel (RGBA) is diffused independently and alpha is dithered too. - -#include -#include -#include -#include -#include - -// Gets a component (red = 1, green = 2...) from a RGBA data structure. -// data is unsigned char. stride is the number of bytes per line. -#define GET_RGBA_COMPONENT(data, x, y, stride, c) (data[(y * stride) + (x << 2) + c]) - -// Writes a new pixel with r, g, b to data in 565 16bit format. Data is a short. -#define PUT_565(data, x, y, width, r, g, b) (data[(y * width) + x] = (r << 11) | (g << 5) | b) - -// Writes a new pixel with r, g, b, a to data in 4444 RGBA 16bit format. Data is a short. -#define PUT_4444(data, x, y, width, r, g, b, a) (data[(y * width) + x] = (r << 12) | (g << 8) | (b << 4) | a) - -// Writes(ads) a new value to the diffusion accumulator. accumulator is a short. -// x, y is a position in the accumulation buffer. y can be 0 or 1 -- we operate on two lines at time. -#define ACCUMULATE(accumulator, x, y, width, v) if (x < width && x >= 0) accumulator[(y * width) + x] += v - -// Clamps a value to be in 0..255 range. -#define CLAMP_256(v) if (v > 255) v = 255; if (v < 0) v = 0; - -// Converts incoming RGB32 (QImage::Format_RGB32) to RGB565. Returns the newly allocated data. -unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride) -{ - static bool thresholdMapInitialized = false; - static int thresholdMap[16][16]; - - if (!thresholdMapInitialized) { - int i; - int j; - int n; - - thresholdMap[0][0] = 0; - thresholdMap[1][0] = 2; - thresholdMap[0][1] = 3; - thresholdMap[1][1] = 1; - - for (n=2; n<16; n*=2) { - for (i=0; i 0) - alignedWidth++; - - // Will store output - unsigned short *out = (unsigned short *)malloc (alignedWidth * height * 2); - - int x; - int y; - int threshold; - - // For each line... - for (y = 0; y < height; y++) { - - // For each column.... - for (x = 0; x < width; x++) { - - int r = GET_RGBA_COMPONENT(in, x, y, stride, 0); - int g = GET_RGBA_COMPONENT(in, x, y, stride, 1); - int b = GET_RGBA_COMPONENT(in, x, y, stride, 2); - - threshold = thresholdMap[x%16][y%16]; - - if (r <= (255-(1<<3)) && ((r<<5) & 255) > threshold) r += (1<<3); - if (g <= (255-(1<<2)) && ((g<<6) & 255) > threshold) g += (1<<2); - if (b <= (255-(1<<3)) && ((b<<5) & 255) > threshold) b += (1<<3); - - // Write the newly produced pixel - PUT_565(out, x, y, alignedWidth, ((b >> 3) & 0x1f), ((g >> 2) & 0x3f), ((r >> 3) & 0x1f)); - } - } - - return out; -} - -// Converts incoming RGBA32 (QImage::Format_ARGB32_Premultiplied) to RGB565. Returns the newly allocated data. -// This function is similar (yet different) to the _565 variant but it makes sense to duplicate it here for simplicity. -// The output has each scan line aligned to 4 bytes (as expected by GL by default). -unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride) -{ - // Output line stride. Aligned to 4 bytes. - int alignedWidth = width; - if (alignedWidth % 2 > 0) - alignedWidth++; - - // Will store output - unsigned short *out = (unsigned short *) malloc(alignedWidth * 2 * height); - - // Lookup tables for the 8bit => 4bit conversion - unsigned char lookup_8bit_to_4bit[256]; - short lookup_8bit_to_4bit_diff[256]; - - // Macros for the conversion using the lookup table. - #define CONVERT_8BIT_TO_4BIT(v) (lookup_8bit_to_4bit[v]) - #define DIFF_8BIT_TO_4BIT(v) (lookup_8bit_to_4bit_diff[v]) - - int i; - int x, y, c; // Pixel we're processing. c is component number (0, 1, 2, 3 for r, b, b, a) - short component[4]; // Stores the new components (r, g, b, a) for pixel produced during conversion - short diff; // The difference between the converted value and the original one. To be accumulated. - QVarLengthArray accumulatorData(4 * width * 2); // Data for three acumulators for r, g, b. Each accumulator is two lines. - short *accumulator[4]; // Helper for accessing the accumulator on a per-channel basis more easily. - accumulator[0] = accumulatorData.data(); - accumulator[1] = accumulatorData.data() + width; - accumulator[2] = accumulatorData.data() + (width * 2); - accumulator[3] = accumulatorData.data() + (width * 3); - - // Produce the conversion lookup tables. - for (i = 0; i < 256; i++) { - lookup_8bit_to_4bit[i] = round(i / 16.0); - // Before bitshifts: (i * 8) - (... * 16 * 8) - lookup_8bit_to_4bit_diff[i] = (i << 3) - (lookup_8bit_to_4bit[i] << 7); - - if (lookup_8bit_to_4bit[i] > 15) - lookup_8bit_to_4bit[i] = 15; - } - - // Clear the accumulators - memset(accumulator[0], 0, width * 4); - memset(accumulator[1], 0, width * 4); - memset(accumulator[2], 0, width * 4); - memset(accumulator[3], 0, width * 4); - - // For each line... - for (y = 0; y < height; y++) { - - // For each component (r, g, b, a)... - memcpy(accumulator[0], accumulator[0] + width, width * 2); - memset(accumulator[0] + width, 0, width * 2); - - memcpy(accumulator[1], accumulator[1] + width, width * 2); - memset(accumulator[1] + width, 0, width * 2); - - memcpy(accumulator[2], accumulator[2] + width, width * 2); - memset(accumulator[2] + width, 0, width * 2); - - memcpy(accumulator[3], accumulator[3] + width, width * 2); - memset(accumulator[3] + width, 0, width * 2); - - // For each column.... - for (x = 0; x < width; x++) { - - // For each component (r, g, b, a)... - for (c = 0; c < 4; c++) { - - // Get the 8bit value from the original image - component[c] = GET_RGBA_COMPONENT(in, x, y, stride, c); - - // Add the diffusion for this pixel we stored in the accumulator. - // >> 7 because the values in accumulator are stored * 128 - component[c] += accumulator[c][x] >> 7; - - // Make sure we're not over the boundaries. - CLAMP_256(component[c]); - - // Store the difference from converting 8bit => 4bit and the orig pixel. - // Convert 8bit => 4bit. - diff = DIFF_8BIT_TO_4BIT(component[c]); - component[c] = CONVERT_8BIT_TO_4BIT(component[c]); - - // Distribute the difference according to the matrix in the - // accumulation bufffer. - ACCUMULATE(accumulator[c], x + 1, 0, width, diff * 7); - ACCUMULATE(accumulator[c], x - 1, 1, width, diff * 3); - ACCUMULATE(accumulator[c], x, 1, width, diff * 5); - ACCUMULATE(accumulator[c], x + 1, 1, width, diff * 1); - } - - // Write the newly produced pixel - PUT_4444(out, x, y, alignedWidth, component[0], component[1], component[2], component[3]); - } - } - - return out; -} - -unsigned char* convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride) -{ - unsigned char *out = (unsigned char *) malloc(stride * height); - - // For each line... - for (int y = 0; y < height; y++) { - // For each column - for (int x = 0; x < width; x++) { - out[(stride * y) + (x * 4) + 0] = in[(stride * y) + (x * 4) + 2]; - out[(stride * y) + (x * 4) + 1] = in[(stride * y) + (x * 4) + 1]; - out[(stride * y) + (x * 4) + 2] = in[(stride * y) + (x * 4) + 0]; - out[(stride * y) + (x * 4) + 3] = in[(stride * y) + (x * 4) + 3]; - } - } - - return out; -} diff --git a/src/plugins/graphicssystems/meego/meego.pro b/src/plugins/graphicssystems/meego/meego.pro deleted file mode 100644 index 6432825888c..00000000000 --- a/src/plugins/graphicssystems/meego/meego.pro +++ /dev/null @@ -1,13 +0,0 @@ -TARGET = qmeegographicssystem -load(qt_plugin) - -QT += core-private gui-private opengl-private - -DESTDIR = $$QT.gui.plugins/graphicssystems - -HEADERS = qmeegographicssystem.h qmeegopixmapdata.h qmeegoextensions.h qmeegorasterpixmapdata.h qmeegolivepixmapdata.h -SOURCES = qmeegographicssystem.cpp qmeegographicssystem.h qmeegographicssystemplugin.h qmeegographicssystemplugin.cpp qmeegopixmapdata.h qmeegopixmapdata.cpp qmeegoextensions.h qmeegoextensions.cpp qmeegorasterpixmapdata.h qmeegorasterpixmapdata.cpp qmeegolivepixmapdata.cpp qmeegolivepixmapdata.h dithering.cpp - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target - diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp deleted file mode 100644 index c1a8eb70287..00000000000 --- a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmeegoextensions.h" -#include -#include - -bool QMeeGoExtensions::initialized = false; -bool QMeeGoExtensions::hasImageShared = false; -bool QMeeGoExtensions::hasSurfaceScaling = false; -bool QMeeGoExtensions::hasLockSurface = false; -bool QMeeGoExtensions::hasFenceSync = false; - -/* Extension funcs */ - -typedef EGLBoolean (EGLAPIENTRY *eglQueryImageNOKFunc)(EGLDisplay, EGLImageKHR, EGLint, EGLint*); -typedef EGLNativeSharedImageTypeNOK (EGLAPIENTRY *eglCreateSharedImageNOKFunc)(EGLDisplay, EGLImageKHR, EGLint*); -typedef EGLBoolean (EGLAPIENTRY *eglDestroySharedImageNOKFunc)(EGLDisplay, EGLNativeSharedImageTypeNOK); -typedef EGLBoolean (EGLAPIENTRY *eglSetSurfaceScalingNOKFunc)(EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint); -typedef EGLBoolean (EGLAPIENTRY *eglLockSurfaceKHRFunc)(EGLDisplay, EGLSurface, const EGLint*); -typedef EGLBoolean (EGLAPIENTRY *eglUnlockSurfaceKHRFunc)(EGLDisplay, EGLSurface); -typedef EGLSyncKHR (EGLAPIENTRY *eglCreateSyncKHRFunc)(EGLDisplay, EGLenum, const EGLint*); -typedef EGLBoolean (EGLAPIENTRY *eglDestroySyncKHRFunc)(EGLDisplay, EGLSyncKHR); -typedef EGLint (EGLAPIENTRY *eglClientWaitSyncKHRFunc)(EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR); -typedef EGLBoolean (EGLAPIENTRY *eglGetSyncAttribKHRFunc)(EGLDisplay, EGLSyncKHR, EGLint, EGLint*); - -static eglQueryImageNOKFunc _eglQueryImageNOK = 0; -static eglCreateSharedImageNOKFunc _eglCreateSharedImageNOK = 0; -static eglDestroySharedImageNOKFunc _eglDestroySharedImageNOK = 0; -static eglSetSurfaceScalingNOKFunc _eglSetSurfaceScalingNOK = 0; -static eglLockSurfaceKHRFunc _eglLockSurfaceKHR = 0; -static eglUnlockSurfaceKHRFunc _eglUnlockSurfaceKHR = 0; -static eglCreateSyncKHRFunc _eglCreateSyncKHR = 0; -static eglDestroySyncKHRFunc _eglDestroySyncKHR = 0; -static eglClientWaitSyncKHRFunc _eglClientWaitSyncKHR = 0; -static eglGetSyncAttribKHRFunc _eglGetSyncAttribKHR = 0; - -/* Public */ - -void QMeeGoExtensions::ensureInitialized() -{ - if (!initialized) - initialize(); - - initialized = true; -} - -EGLNativeSharedImageTypeNOK QMeeGoExtensions::eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props) -{ - if (!hasImageShared) - qFatal("EGL_NOK_image_shared not found but trying to use capability!"); - - return _eglCreateSharedImageNOK(dpy, image, props); -} - -bool QMeeGoExtensions::eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v) -{ - if (!hasImageShared) - qFatal("EGL_NOK_image_shared not found but trying to use capability!"); - - return _eglQueryImageNOK(dpy, image, prop, v); -} - -bool QMeeGoExtensions::eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img) -{ - if (!hasImageShared) - qFatal("EGL_NOK_image_shared not found but trying to use capability!"); - - return _eglDestroySharedImageNOK(dpy, img); -} - -bool QMeeGoExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height) -{ - if (!hasSurfaceScaling) - qFatal("EGL_NOK_surface_scaling not found but trying to use capability!"); - - return _eglSetSurfaceScalingNOK(dpy, surface, x, y, width, height); -} - -bool QMeeGoExtensions::eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list) -{ - if (!hasLockSurface) - qFatal("EGL_KHR_lock_surface2 not found but trying to use capability!"); - - return _eglLockSurfaceKHR(display, surface, attrib_list); -} - -bool QMeeGoExtensions::eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface) -{ - if (!hasLockSurface) - qFatal("EGL_KHR_lock_surface2 not found but trying to use capability!"); - - return _eglUnlockSurfaceKHR(display, surface); -} - -EGLSyncKHR QMeeGoExtensions::eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) -{ - if (!hasFenceSync) - qFatal("EGL_KHR_fence_sync not found but trying to use capability!"); - - return _eglCreateSyncKHR(dpy, type, attrib_list); -} - -bool QMeeGoExtensions::eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) -{ - if (!hasFenceSync) - qFatal("EGL_KHR_fence_sync not found but trying to use capability!"); - - return _eglDestroySyncKHR(dpy, sync); -} - -EGLint QMeeGoExtensions::eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) -{ - if (!hasFenceSync) - qFatal("EGL_KHR_fence_sync not found but trying to use capability!"); - - return _eglClientWaitSyncKHR(dpy, sync, flags, timeout); -} - -EGLBoolean QMeeGoExtensions::eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value) -{ - if (!hasFenceSync) - qFatal("EGL_KHR_fence_sync not found but trying to use capability!"); - - return _eglGetSyncAttribKHR(dpy, sync, attribute, value); -} - -/* Private */ - -void QMeeGoExtensions::initialize() -{ - QGLContext *ctx = (QGLContext *) QGLContext::currentContext(); - qt_resolve_eglimage_gl_extensions(ctx); - - if (QEgl::hasExtension("EGL_NOK_image_shared")) { - qDebug("MeegoGraphics: found EGL_NOK_image_shared"); - _eglQueryImageNOK = (eglQueryImageNOKFunc) eglGetProcAddress("eglQueryImageNOK"); - _eglCreateSharedImageNOK = (eglCreateSharedImageNOKFunc) eglGetProcAddress("eglCreateSharedImageNOK"); - _eglDestroySharedImageNOK = (eglDestroySharedImageNOKFunc) eglGetProcAddress("eglDestroySharedImageNOK"); - _eglLockSurfaceKHR = (eglLockSurfaceKHRFunc) eglGetProcAddress("eglLockSurfaceKHR"); - _eglUnlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) eglGetProcAddress("eglUnlockSurfaceKHR"); - - Q_ASSERT(_eglQueryImageNOK && _eglCreateSharedImageNOK && _eglDestroySharedImageNOK); - hasImageShared = true; - } - - if (QEgl::hasExtension("EGL_NOK_surface_scaling")) { - qDebug("MeegoGraphics: found EGL_NOK_surface_scaling"); - _eglSetSurfaceScalingNOK = (eglSetSurfaceScalingNOKFunc) eglGetProcAddress("eglSetSurfaceScalingNOK"); - - Q_ASSERT(_eglSetSurfaceScalingNOK); - hasSurfaceScaling = true; - } - - if (QEgl::hasExtension("EGL_KHR_lock_surface2")) { - qDebug("MeegoGraphics: found EGL_KHR_lock_surface2"); - _eglLockSurfaceKHR = (eglLockSurfaceKHRFunc) eglGetProcAddress("eglLockSurfaceKHR"); - _eglUnlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) eglGetProcAddress("eglUnlockSurfaceKHR"); - - Q_ASSERT(_eglLockSurfaceKHR && _eglUnlockSurfaceKHR); - hasLockSurface = true; - } - - if (QEgl::hasExtension("EGL_KHR_fence_sync")) { - qDebug("MeegoGraphics: found EGL_KHR_fence_sync"); - _eglCreateSyncKHR = (eglCreateSyncKHRFunc) eglGetProcAddress("eglCreateSyncKHR"); - _eglDestroySyncKHR = (eglDestroySyncKHRFunc) eglGetProcAddress("eglDestroySyncKHR"); - _eglClientWaitSyncKHR = (eglClientWaitSyncKHRFunc) eglGetProcAddress("eglClientWaitSyncKHR"); - _eglGetSyncAttribKHR = (eglGetSyncAttribKHRFunc) eglGetProcAddress("eglGetSyncAttribKHR"); - - Q_ASSERT(_eglCreateSyncKHR && _eglDestroySyncKHR && _eglClientWaitSyncKHR && _eglGetSyncAttribKHR); - hasFenceSync = true; - } -} - diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.h b/src/plugins/graphicssystems/meego/qmeegoextensions.h deleted file mode 100644 index e4ceed3a315..00000000000 --- a/src/plugins/graphicssystems/meego/qmeegoextensions.h +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MEXTENSIONS_H -#define MEXTENSIONS_H - -#include -#include -#include -#include -#include -#include - -/* Extensions decls */ - -#ifndef EGL_SHARED_IMAGE_NOK -#define EGL_SHARED_IMAGE_NOK 0x30DA -typedef void* EGLNativeSharedImageTypeNOK; -#endif - -#ifndef EGL_GL_TEXTURE_2D_KHR -#define EGL_GL_TEXTURE_2D_KHR 0x30B1 -#endif - -#ifndef EGL_FIXED_WIDTH_NOK -#define EGL_FIXED_WIDTH_NOK 0x30DB -#define EGL_FIXED_HEIGHT_NOK 0x30DC -#endif - -#ifndef EGL_BITMAP_POINTER_KHR -#define EGL_BITMAP_POINTER_KHR 0x30C6 -#define EGL_BITMAP_PITCH_KHR 0x30C7 -#endif - -#ifndef EGL_MAP_PRESERVE_PIXELS_KHR -#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 -#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 -#define EGL_READ_SURFACE_BIT_KHR 0x0001 -#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 -#endif - -#ifndef EGL_SYNC_FENCE_KHR -#define EGL_SYNC_FENCE_KHR 0x30F9 -#define EGL_SYNC_TYPE_KHR 0x30F7 -#define EGL_SYNC_STATUS_KHR 0x30F1 -#define EGL_SYNC_CONDITION_KHR 0x30F8 -#define EGL_SIGNALED_KHR 0x30F2 -#define EGL_UNSIGNALED_KHR 0x30F3 -#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 -#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 -#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull -#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 -#define EGL_CONDITION_SATISFIED_KHR 0x30F6 -#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) -typedef void* EGLSyncKHR; -typedef khronos_utime_nanoseconds_t EGLTimeKHR; -#endif - -/* Class */ - -class QMeeGoExtensions -{ -public: - static void ensureInitialized(); - - static EGLNativeSharedImageTypeNOK eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props); - static bool eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v); - static bool eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img); - static bool eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height); - static bool eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); - static bool eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface); - static EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); - static bool eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync); - static EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); - static EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); - -private: - static void initialize(); - - static bool initialized; - static bool hasImageShared; - static bool hasSurfaceScaling; - static bool hasLockSurface; - static bool hasFenceSync; -}; - -#endif diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp deleted file mode 100644 index ab403797df6..00000000000 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ /dev/null @@ -1,534 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "qmeegopixmapdata.h" -#include "qmeegolivepixmapdata.h" -#include "qmeegographicssystem.h" -#include "qmeegoextensions.h" - -#include - -bool QMeeGoGraphicsSystem::surfaceWasCreated = false; - -QHash QMeeGoGraphicsSystem::liveTexturePixmaps; - -QList QMeeGoGraphicsSystem::switchCallbacks; - -QMeeGoGraphicsSystem::SwitchPolicy QMeeGoGraphicsSystem::switchPolicy = QMeeGoGraphicsSystem::AutomaticSwitch; - -QMeeGoGraphicsSystem::QMeeGoGraphicsSystem() -{ - qDebug("Using the meego graphics system"); -} - -QMeeGoGraphicsSystem::~QMeeGoGraphicsSystem() -{ - qDebug("Meego graphics system destroyed"); - qt_destroy_gl_share_widget(); -} - -class QMeeGoGraphicsSystemSwitchHandler : public QObject -{ - Q_OBJECT -public: - QMeeGoGraphicsSystemSwitchHandler(); - - void addWidget(QWidget *widget); - bool eventFilter(QObject *, QEvent *); - - void handleMapNotify(); - -private slots: - void removeWidget(QObject *object); - void switchToRaster(); - void switchToMeeGo(); - -private: - int visibleWidgets() const; - -private: - QList m_widgets; -}; - -typedef bool(*QX11FilterFunction)(XEvent *event); -Q_GUI_EXPORT void qt_installX11EventFilter(QX11FilterFunction func); - -static bool x11EventFilter(XEvent *event); - -QMeeGoGraphicsSystemSwitchHandler::QMeeGoGraphicsSystemSwitchHandler() -{ - qt_installX11EventFilter(x11EventFilter); -} - -void QMeeGoGraphicsSystemSwitchHandler::addWidget(QWidget *widget) -{ - if (widget != qt_gl_share_widget() && !m_widgets.contains(widget)) { - widget->installEventFilter(this); - connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(removeWidget(QObject *))); - m_widgets << widget; - } -} - -void QMeeGoGraphicsSystemSwitchHandler::handleMapNotify() -{ - if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) - QTimer::singleShot(0, this, SLOT(switchToMeeGo())); -} - -void QMeeGoGraphicsSystemSwitchHandler::removeWidget(QObject *object) -{ - m_widgets.removeOne(static_cast(object)); - if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) - QTimer::singleShot(0, this, SLOT(switchToRaster())); -} - -void QMeeGoGraphicsSystemSwitchHandler::switchToRaster() -{ - QMeeGoGraphicsSystem::switchToRaster(); -} - -void QMeeGoGraphicsSystemSwitchHandler::switchToMeeGo() -{ - QMeeGoGraphicsSystem::switchToMeeGo(); -} - -int QMeeGoGraphicsSystemSwitchHandler::visibleWidgets() const -{ - int count = 0; - for (int i = 0; i < m_widgets.size(); ++i) - count += m_widgets.at(i)->isVisible() && !(m_widgets.at(i)->windowState() & Qt::WindowMinimized); - return count; -} - -bool QMeeGoGraphicsSystemSwitchHandler::eventFilter(QObject *object, QEvent *event) -{ - if (event->type() == QEvent::WindowStateChange - && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) - { - QWindowStateChangeEvent *change = static_cast(event); - QWidget *widget = static_cast(object); - - Qt::WindowStates current = widget->windowState(); - Qt::WindowStates old = change->oldState(); - - // did minimized flag change? - if ((current ^ old) & Qt::WindowMinimized) { - if (current & Qt::WindowMinimized) { - if (visibleWidgets() == 0) - QMeeGoGraphicsSystem::switchToRaster(); - } else { - if (visibleWidgets() > 0) - QMeeGoGraphicsSystem::switchToMeeGo(); - } - } - } - - // resume processing of event - return false; -} - -Q_GLOBAL_STATIC(QMeeGoGraphicsSystemSwitchHandler, switch_handler) - -bool x11EventFilter(XEvent *event) -{ - if (event->type == MapNotify) - switch_handler()->handleMapNotify(); - return false; -} - -QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - QGLWidget *shareWidget = qt_gl_share_widget(); - - if (!shareWidget) - return new QRasterWindowSurface(widget); - - QGLShareContextScope ctx(shareWidget->context()); - - if (QApplicationPrivate::instance()->graphics_system_name == QLatin1String("runtime")) - switch_handler()->addWidget(widget); - - QMeeGoGraphicsSystem::surfaceWasCreated = true; - QWindowSurface *surface = new QGLWindowSurface(widget); - return surface; -} - -QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData *origin) -{ - // If the pixmap is a raster type... - // and if the pixmap pointer matches our mapping... - // create a shared image instead with the given handle. - - if (!origin->isNull() && origin->classId() == QPixmapData::RasterClass) { - QRasterPixmapData *rasterClass = static_cast (origin); - void *rawResource = static_cast (rasterClass->buffer()->data_ptr()->data); - - if (QMeeGoPixmapData::sharedImagesMap.contains(rawResource)) - return new QMeeGoPixmapData(); - } - - return new QRasterPixmapData(origin->pixelType()); -} - -QPixmapData* QMeeGoGraphicsSystem::wrapPixmapData(QPixmapData *pmd) -{ - QString name = QApplicationPrivate::instance()->graphics_system_name; - if (name == "runtime") { - QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system; - QRuntimePixmapData *rt = new QRuntimePixmapData(rsystem, pmd->pixelType());; - rt->m_data = pmd; - rt->readBackInfo(); - rsystem->m_pixmapDatas << rt; - return rt; - } else - return pmd; -} - -void QMeeGoGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/) -{ - if (QMeeGoGraphicsSystem::surfaceWasCreated) { - qWarning("Trying to set surface fixed size but surface already created!"); - return; - } - -#ifdef QT_WAS_PATCHED - QEglProperties *properties = new QEglProperties(); - properties->setValue(EGL_FIXED_WIDTH_NOK, width); - properties->setValue(EGL_FIXED_HEIGHT_NOK, height); - QGLContextPrivate::setExtraWindowSurfaceCreationProps(properties); -#endif -} - -void QMeeGoGraphicsSystem::setSurfaceScaling(int x, int y, int width, int height) -{ - QMeeGoExtensions::ensureInitialized(); - QMeeGoExtensions::eglSetSurfaceScalingNOK(QEgl::display(), QEglContext::currentContext(QEgl::OpenGL)->currentSurface, x, y, width, height); -} - -void QMeeGoGraphicsSystem::setTranslucent(bool translucent) -{ - if (QMeeGoGraphicsSystem::surfaceWasCreated) { - qWarning("Trying to set translucency but surface already created!"); - return; - } - - QGLWindowSurface::surfaceFormat.setSampleBuffers(false); - QGLWindowSurface::surfaceFormat.setSamples(0); - QGLWindowSurface::surfaceFormat.setAlpha(translucent); -} - -QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage) -{ - if (softImage.format() != QImage::Format_ARGB32_Premultiplied && - softImage.format() != QImage::Format_RGB32) { - qFatal("For egl shared images, the soft image has to be ARGB32_Premultiplied or RGB32"); - return NULL; - } - - if (QMeeGoGraphicsSystem::meeGoRunning()) { - QMeeGoPixmapData *pmd = new QMeeGoPixmapData; - pmd->fromEGLSharedImage(handle, softImage); - return QMeeGoGraphicsSystem::wrapPixmapData(pmd); - } else { - QRasterPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType); - pmd->fromImage(softImage, Qt::NoFormatConversion); - - // Make sure that the image was not converted in any way - if (pmd->buffer()->data_ptr()->data != - const_cast(softImage).data_ptr()->data) - qFatal("Iternal misalignment of raster data detected. Prolly a QImage copy fail."); - - QMeeGoPixmapData::registerSharedImage(handle, softImage); - return QMeeGoGraphicsSystem::wrapPixmapData(pmd); - } -} - -void QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(QPixmap *pixmap) -{ - QMeeGoPixmapData *pmd = (QMeeGoPixmapData *) pixmap->pixmapData(); - - // Basic sanity check to make sure this is really a QMeeGoPixmapData... - if (pmd->classId() != QPixmapData::OpenGLClass) - qFatal("Trying to updated EGLSharedImage pixmap but it's not really a shared image pixmap!"); - - pmd->updateFromSoftImage(); -} - -QPixmapData *QMeeGoGraphicsSystem::pixmapDataWithGLTexture(int w, int h) -{ - QGLPixmapData *pmd = new QGLPixmapData(QPixmapData::PixmapType); - pmd->resize(w, h); - return QMeeGoGraphicsSystem::wrapPixmapData(pmd); -} - -bool QMeeGoGraphicsSystem::meeGoRunning() -{ - return runningGraphicsSystemName() == "meego"; -} - -QPixmapData* QMeeGoGraphicsSystem::pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format) -{ - return new QMeeGoLivePixmapData(w, h, format); -} - -QPixmapData* QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle(Qt::HANDLE handle) -{ - return new QMeeGoLivePixmapData(handle); -} - -QImage* QMeeGoGraphicsSystem::lockLiveTexture(QPixmap* pixmap, void* fenceSync) -{ - QMeeGoLivePixmapData *pixmapData = static_cast(pixmap->data_ptr().data()); - return pixmapData->lock(fenceSync); -} - -bool QMeeGoGraphicsSystem::releaseLiveTexture(QPixmap *pixmap, QImage *image) -{ - QMeeGoLivePixmapData *pixmapData = static_cast(pixmap->data_ptr().data()); - return pixmapData->release(image); -} - -Qt::HANDLE QMeeGoGraphicsSystem::getLiveTextureHandle(QPixmap *pixmap) -{ - QMeeGoLivePixmapData *pixmapData = static_cast(pixmap->data_ptr().data()); - return pixmapData->handle(); -} - -void* QMeeGoGraphicsSystem::createFenceSync() -{ - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - QMeeGoExtensions::ensureInitialized(); - return QMeeGoExtensions::eglCreateSyncKHR(QEgl::display(), EGL_SYNC_FENCE_KHR, NULL); -} - -void QMeeGoGraphicsSystem::destroyFenceSync(void *fenceSync) -{ - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - QMeeGoExtensions::ensureInitialized(); - QMeeGoExtensions::eglDestroySyncKHR(QEgl::display(), fenceSync); -} - -QString QMeeGoGraphicsSystem::runningGraphicsSystemName() -{ - if (!QApplicationPrivate::instance()) { - qWarning("Querying graphics system but application not running yet!"); - return QString(); - } - - QString name = QApplicationPrivate::instance()->graphics_system_name; - if (name == QLatin1String("runtime")) { - QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system; - name = rsystem->graphicsSystemName(); - } - - return name; -} - -void QMeeGoGraphicsSystem::switchToMeeGo() -{ - if (switchPolicy == NoSwitch || meeGoRunning()) - return; - - if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) - qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system."); - else { - triggerSwitchCallbacks(0, "meego"); - - QApplication *app = static_cast(QCoreApplication::instance()); - app->setGraphicsSystem(QLatin1String("meego")); - - triggerSwitchCallbacks(1, "meego"); - } -} - -void QMeeGoGraphicsSystem::switchToRaster() -{ - if (switchPolicy == NoSwitch || runningGraphicsSystemName() == QLatin1String("raster")) - return; - - if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) - qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system."); - else { - triggerSwitchCallbacks(0, "raster"); - - QApplication *app = static_cast(QCoreApplication::instance()); - app->setGraphicsSystem(QLatin1String("raster")); - - QMeeGoLivePixmapData::invalidateSurfaces(); - - triggerSwitchCallbacks(1, "raster"); - } -} - -void QMeeGoGraphicsSystem::registerSwitchCallback(QMeeGoSwitchCallback callback) -{ - switchCallbacks << callback; -} - -void QMeeGoGraphicsSystem::triggerSwitchCallbacks(int type, const char *name) -{ - for (int i = 0; i < switchCallbacks.size(); ++i) - switchCallbacks.at(i)(type, name); -} - -/* C API */ - -int qt_meego_image_to_egl_shared_image(const QImage &image) -{ - return QMeeGoPixmapData::imageToEGLSharedImage(image); -} - -QPixmapData* qt_meego_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage) -{ - return QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(handle, softImage); -} - -QPixmapData* qt_meego_pixmapdata_with_gl_texture(int w, int h) -{ - return QMeeGoGraphicsSystem::pixmapDataWithGLTexture(w, h); -} - -bool qt_meego_destroy_egl_shared_image(Qt::HANDLE handle) -{ - return QMeeGoPixmapData::destroyEGLSharedImage(handle); -} - -void qt_meego_set_surface_fixed_size(int width, int height) -{ - QMeeGoGraphicsSystem::setSurfaceFixedSize(width, height); -} - -void qt_meego_set_surface_scaling(int x, int y, int width, int height) -{ - QMeeGoGraphicsSystem::setSurfaceScaling(x, y, width, height); -} - -void qt_meego_set_translucent(bool translucent) -{ - QMeeGoGraphicsSystem::setTranslucent(translucent); -} - -void qt_meego_update_egl_shared_image_pixmap(QPixmap *pixmap) -{ - QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(pixmap); -} - -QPixmapData* qt_meego_pixmapdata_with_new_live_texture(int w, int h, QImage::Format format) -{ - return QMeeGoGraphicsSystem::pixmapDataWithNewLiveTexture(w, h, format); -} - -QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle) -{ - return QMeeGoGraphicsSystem::pixmapDataFromLiveTextureHandle(handle); -} - -QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync) -{ - return QMeeGoGraphicsSystem::lockLiveTexture(pixmap, fenceSync); -} - -bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image) -{ - return QMeeGoGraphicsSystem::releaseLiveTexture(pixmap, image); -} - -Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap) -{ - return QMeeGoGraphicsSystem::getLiveTextureHandle(pixmap); -} - -void* qt_meego_create_fence_sync(void) -{ - return QMeeGoGraphicsSystem::createFenceSync(); -} - -void qt_meego_destroy_fence_sync(void* fs) -{ - return QMeeGoGraphicsSystem::destroyFenceSync(fs); -} - -void qt_meego_invalidate_live_surfaces(void) -{ - return QMeeGoLivePixmapData::invalidateSurfaces(); -} - -void qt_meego_switch_to_raster(void) -{ - QMeeGoGraphicsSystem::switchToRaster(); -} - -void qt_meego_switch_to_meego(void) -{ - QMeeGoGraphicsSystem::switchToMeeGo(); -} - -void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback) -{ - QMeeGoGraphicsSystem::registerSwitchCallback(callback); -} - -void qt_meego_set_switch_policy(int policy) -{ - QMeeGoGraphicsSystem::switchPolicy = QMeeGoGraphicsSystem::SwitchPolicy(policy); -} - -#include "qmeegographicssystem.moc" diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h deleted file mode 100644 index 7299af56bed..00000000000 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MGRAPHICSSYSTEM_H -#define MGRAPHICSSYSTEM_H - -#include -#include -#include -#include - -extern "C" typedef void (*QMeeGoSwitchCallback)(int type, const char *name); - -class QMeeGoGraphicsSystem : public QGraphicsSystem -{ -public: - enum SwitchPolicy { AutomaticSwitch, ManualSwitch, NoSwitch }; - - QMeeGoGraphicsSystem(); - ~QMeeGoGraphicsSystem(); - - virtual QWindowSurface *createWindowSurface(QWidget *widget) const; - virtual QPixmapData *createPixmapData(QPixmapData::PixelType) const; - virtual QPixmapData *createPixmapData(QPixmapData *origin); - - static QPixmapData *wrapPixmapData(QPixmapData *pmd); - static void setSurfaceFixedSize(int width, int height); - static void setSurfaceScaling(int x, int y, int width, int height); - static void setTranslucent(bool translucent); - - static QPixmapData *pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage); - static QPixmapData *pixmapDataFromEGLImage(Qt::HANDLE handle); - static QPixmapData *pixmapDataWithGLTexture(int w, int h); - static void updateEGLSharedImagePixmap(QPixmap *pixmap); - - static QPixmapData *pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format); - static QPixmapData *pixmapDataFromLiveTextureHandle(Qt::HANDLE handle); - static QImage *lockLiveTexture(QPixmap* pixmap, void* fenceSync); - static bool releaseLiveTexture(QPixmap *pixmap, QImage *image); - static Qt::HANDLE getLiveTextureHandle(QPixmap *pixmap); - - static void* createFenceSync(); - static void destroyFenceSync(void* fenceSync); - - static void switchToRaster(); - static void switchToMeeGo(); - static QString runningGraphicsSystemName(); - - static void registerSwitchCallback(QMeeGoSwitchCallback callback); - - static SwitchPolicy switchPolicy; - -private: - static bool meeGoRunning(); - static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap); - static void destroySurfaceForLiveTexturePixmap(QPixmapData* pmd); - static void triggerSwitchCallbacks(int type, const char *name); - - static bool surfaceWasCreated; - static QHash liveTexturePixmaps; - static QList switchCallbacks; -}; - -/* C api */ - -extern "C" { - Q_DECL_EXPORT int qt_meego_image_to_egl_shared_image(const QImage &image); - Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage); - Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_gl_texture(int w, int h); - Q_DECL_EXPORT void qt_meego_update_egl_shared_image_pixmap(QPixmap *pixmap); - Q_DECL_EXPORT bool qt_meego_destroy_egl_shared_image(Qt::HANDLE handle); - Q_DECL_EXPORT void qt_meego_set_surface_fixed_size(int width, int height); - Q_DECL_EXPORT void qt_meego_set_surface_scaling(int x, int y, int width, int height); - Q_DECL_EXPORT void qt_meego_set_translucent(bool translucent); - Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_new_live_texture(int w, int h, QImage::Format format); - Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle); - Q_DECL_EXPORT QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync); - Q_DECL_EXPORT bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image); - Q_DECL_EXPORT Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap); - Q_DECL_EXPORT void* qt_meego_create_fence_sync(void); - Q_DECL_EXPORT void qt_meego_destroy_fence_sync(void* fs); - Q_DECL_EXPORT void qt_meego_invalidate_live_surfaces(void); - Q_DECL_EXPORT void qt_meego_switch_to_raster(void); - Q_DECL_EXPORT void qt_meego_switch_to_meego(void); - Q_DECL_EXPORT void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback); - Q_DECL_EXPORT void qt_meego_set_switch_policy(int policy); -} - -#endif diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp deleted file mode 100644 index 40421bc8f0a..00000000000 --- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmeegolivepixmapdata.h" -#include "qmeegorasterpixmapdata.h" -#include -#include -#include -#include -#include -#include -#include - -static QMeeGoLivePixmapDataList all_live_pixmaps; - -static EGLint lock_attribs[] = { - EGL_MAP_PRESERVE_PIXELS_KHR, EGL_TRUE, - EGL_LOCK_USAGE_HINT_KHR, EGL_READ_SURFACE_BIT_KHR | EGL_WRITE_SURFACE_BIT_KHR, - EGL_NONE -}; - -static EGLint preserved_attribs[] = { - EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, - EGL_NONE -}; - -// as copied from qwindowsurface.cpp -void 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); - } -} - -/* Public */ - -QMeeGoLivePixmapData::QMeeGoLivePixmapData(int w, int h, QImage::Format format) : QGLPixmapData(QPixmapData::PixmapType) -{ - QImage image(w, h, format); - QX11PixmapData *pmd = new QX11PixmapData(QPixmapData::PixmapType); - pmd->fromImage(image, Qt::NoOpaqueDetection); - backingX11Pixmap = new QPixmap(pmd); - - initializeThroughEGLImage(); - - pos = all_live_pixmaps.insert(all_live_pixmaps.begin(), this); -} - -QMeeGoLivePixmapData::QMeeGoLivePixmapData(Qt::HANDLE h) : QGLPixmapData(QPixmapData::PixmapType) -{ - backingX11Pixmap = new QPixmap(QPixmap::fromX11Pixmap(h)); - initializeThroughEGLImage(); - - pos = all_live_pixmaps.insert(all_live_pixmaps.begin(), this); -} - -QMeeGoLivePixmapData::~QMeeGoLivePixmapData() -{ - delete backingX11Pixmap; - all_live_pixmaps.erase(pos); -} - -void QMeeGoLivePixmapData::initializeThroughEGLImage() -{ - if (texture()->id != 0) - return; - - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - QMeeGoExtensions::ensureInitialized(); - - EGLImageKHR eglImage = EGL_NO_IMAGE_KHR; - GLuint newTextureId = 0; - - eglImage = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer) backingX11Pixmap->handle(), preserved_attribs); - - if (eglImage == EGL_NO_IMAGE_KHR) { - qWarning("eglCreateImageKHR failed (live texture)!"); - return; - } - - glGenTextures(1, &newTextureId); - glBindTexture(GL_TEXTURE_2D, newTextureId); - - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (EGLImageKHR) eglImage); - if (glGetError() == GL_NO_ERROR) { - resize(backingX11Pixmap->width(), backingX11Pixmap->height()); - texture()->id = newTextureId; - texture()->options &= ~QGLContext::InvertedYBindOption; - m_hasAlpha = backingX11Pixmap->hasAlphaChannel(); - } else { - qWarning("Failed to create a texture from an egl image (live texture)!"); - glDeleteTextures(1, &newTextureId); - } - - QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); -} - -QPixmapData *QMeeGoLivePixmapData::createCompatiblePixmapData() const -{ - qWarning("Create compatible called on live pixmap! Expect fail soon..."); - return new QMeeGoRasterPixmapData(pixelType()); -} - -QImage* QMeeGoLivePixmapData::lock(EGLSyncKHR fenceSync) -{ - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - QMeeGoExtensions::ensureInitialized(); - - if (fenceSync) { - QMeeGoExtensions::eglClientWaitSyncKHR(QEgl::display(), - fenceSync, - EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, - EGL_FOREVER_KHR); - } - - void *data = 0; - int pitch = 0; - int surfaceWidth = 0; - int surfaceHeight = 0; - EGLSurface surface = 0; - QImage::Format format; - lockedImage = QImage(); - - surface = getSurfaceForBackingPixmap(); - if (! QMeeGoExtensions::eglLockSurfaceKHR(QEgl::display(), surface, lock_attribs)) { - qWarning("Failed to lock surface (live texture)!"); - return &lockedImage; - } - - eglQuerySurface(QEgl::display(), surface, EGL_BITMAP_POINTER_KHR, (EGLint*) &data); - eglQuerySurface(QEgl::display(), surface, EGL_BITMAP_PITCH_KHR, (EGLint*) &pitch); - eglQuerySurface(QEgl::display(), surface, EGL_WIDTH, (EGLint*) &surfaceWidth); - eglQuerySurface(QEgl::display(), surface, EGL_HEIGHT, (EGLint*) &surfaceHeight); - - // Ok, here we know we just support those two formats. Real solution would be: - // query also the format. - if (backingX11Pixmap->depth() > 16) - format = QImage::Format_ARGB32_Premultiplied; - else - format = QImage::Format_RGB16; - - if (data == NULL || pitch == 0) { - qWarning("Failed to query the live texture!"); - return &lockedImage; - } - - if (width() != surfaceWidth || height() != surfaceHeight) { - qWarning("Live texture dimensions don't match!"); - QMeeGoExtensions::eglUnlockSurfaceKHR(QEgl::display(), surface); - return &lockedImage; - } - - lockedImage = QImage((uchar *) data, width(), height(), pitch, format); - return &lockedImage; -} - -bool QMeeGoLivePixmapData::release(QImage* /*img*/) -{ - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - QMeeGoExtensions::ensureInitialized(); - - if (QMeeGoExtensions::eglUnlockSurfaceKHR(QEgl::display(), getSurfaceForBackingPixmap())) { - lockedImage = QImage(); - return true; - } else { - lockedImage = QImage(); - return false; - } -} - -Qt::HANDLE QMeeGoLivePixmapData::handle() -{ - return backingX11Pixmap->handle(); -} - -bool QMeeGoLivePixmapData::scroll(int dx, int dy, const QRect &rect) -{ - lock(NULL); - - if (!lockedImage.isNull()) - qt_scrollRectInImage(lockedImage, rect, QPoint(dx, dy)); - - release(&lockedImage); - return true; -} - -EGLSurface QMeeGoLivePixmapData::getSurfaceForBackingPixmap() -{ - initializeThroughEGLImage(); - - // This code is a crative remix of the stuff that can be found in the - // Qt's TFP implementation in /src/opengl/qgl_x11egl.cpp ::bindiTextureFromNativePixmap - QX11PixmapData *pixmapData = static_cast(backingX11Pixmap->data_ptr().data()); - Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); - bool hasAlpha = pixmapData->hasAlphaChannel(); - - if (pixmapData->gl_surface && - hasAlpha == (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) - return pixmapData->gl_surface; - - // Check to see if the surface is still valid - if (pixmapData->gl_surface && - hasAlpha != ((pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha) > 0)) { - // Surface is invalid! - destroySurfaceForPixmapData(pixmapData); - } - - if (pixmapData->gl_surface == 0) { - EGLConfig config = QEgl::defaultConfig(QInternal::Pixmap, - QEgl::OpenGL, - hasAlpha ? QEgl::Translucent : QEgl::NoOptions); - - pixmapData->gl_surface = (void*)QEgl::createSurface(backingX11Pixmap, config); - - if (hasAlpha) - pixmapData->flags |= QX11PixmapData::GlSurfaceCreatedWithAlpha; - else - pixmapData->flags &= ~QX11PixmapData::GlSurfaceCreatedWithAlpha; - - if (pixmapData->gl_surface == (void*)EGL_NO_SURFACE) - return NULL; - } - - return pixmapData->gl_surface; -} - -void QMeeGoLivePixmapData::destroySurfaceForPixmapData(QPixmapData* pmd) -{ - Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - QX11PixmapData *pixmapData = static_cast(pmd); - if (pixmapData->gl_surface) { - eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface); - pixmapData->gl_surface = 0; - } -} - -void QMeeGoLivePixmapData::invalidateSurfaces() -{ - foreach (QMeeGoLivePixmapData *data, all_live_pixmaps) { - QX11PixmapData *pixmapData = static_cast(data->backingX11Pixmap->data_ptr().data()); - *data->texture() = QGLTexture(); - pixmapData->gl_surface = 0; - } -} diff --git a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h b/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h deleted file mode 100644 index 73f75143e30..00000000000 --- a/src/plugins/graphicssystems/meego/qmeegolivepixmapdata.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MLIVEPIXMAPDATA_H -#define MLIVEPIXMAPDATA_H - -#include -#include -#include "qmeegoextensions.h" - -class QMeeGoLivePixmapData; -typedef QLinkedList QMeeGoLivePixmapDataList; - -class QMeeGoLivePixmapData : public QGLPixmapData -{ -public: - QMeeGoLivePixmapData(int w, int h, QImage::Format format); - QMeeGoLivePixmapData(Qt::HANDLE h); - ~QMeeGoLivePixmapData(); - - QPixmapData *createCompatiblePixmapData() const; - bool scroll(int dx, int dy, const QRect &rect); - - void initializeThroughEGLImage(); - - QImage* lock(EGLSyncKHR fenceSync); - bool release(QImage *img); - Qt::HANDLE handle(); - - EGLSurface getSurfaceForBackingPixmap(); - void destroySurfaceForPixmapData(QPixmapData* pmd); - - QPixmap *backingX11Pixmap; - QImage lockedImage; - QMeeGoLivePixmapDataList::Iterator pos; - - static void invalidateSurfaces(); -}; - -#endif diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp deleted file mode 100644 index ec6c33fa07e..00000000000 --- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmeegopixmapdata.h" -#include "qmeegoextensions.h" -#include "qmeegorasterpixmapdata.h" -#include -#include -#include -#include -#include - -// from dithering.cpp -extern unsigned short* convertRGB32_to_RGB565(const unsigned char *in, int width, int height, int stride); -extern unsigned short* convertARGB32_to_RGBA4444(const unsigned char *in, int width, int height, int stride); -extern unsigned char* convertBGRA32_to_RGBA32(const unsigned char *in, int width, int height, int stride); - -static EGLint preserved_image_attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE }; - -QHash QMeeGoPixmapData::sharedImagesMap; - -/* Public */ - -QMeeGoPixmapData::QMeeGoPixmapData() : QGLPixmapData(QPixmapData::PixmapType) -{ -} - -void QMeeGoPixmapData::fromTexture(GLuint textureId, int w, int h, bool alpha) -{ - resize(w, h); - texture()->id = textureId; - m_hasAlpha = alpha; - softImage = QImage(); -} - -QImage QMeeGoPixmapData::toImage() const -{ - return softImage; -} - -void QMeeGoPixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags flags) -{ - void *rawResource = static_cast (((QImage &) image).data_ptr()->data); - - if (sharedImagesMap.contains(rawResource)) { - QMeeGoImageInfo *info = sharedImagesMap.value(rawResource); - fromEGLSharedImage(info->handle, image); - } else { - // This should *never* happen since the graphics system should never - // create a QMeeGoPixmapData for an origin that doesn't contain a raster - // image we know about. But... - qWarning("QMeeGoPixmapData::fromImage called on non-know resource. Falling back..."); - QGLPixmapData::fromImage(image, flags); - } -} - -void QMeeGoPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si) -{ - if (si.isNull()) - qFatal("Trying to build pixmap with an empty/null softimage!"); - - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - - QMeeGoExtensions::ensureInitialized(); - - bool textureIsBound = false; - GLuint newTextureId; - GLint newWidth, newHeight; - - glGenTextures(1, &newTextureId); - glBindTexture(GL_TEXTURE_2D, newTextureId); - - EGLImageKHR image = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_SHARED_IMAGE_NOK, - (EGLClientBuffer)handle, preserved_image_attribs); - - if (image != EGL_NO_IMAGE_KHR) { - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image); - GLint err = glGetError(); - if (err == GL_NO_ERROR) - textureIsBound = true; - - QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), image, EGL_WIDTH, &newWidth); - QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), image, EGL_HEIGHT, &newHeight); - - QEgl::eglDestroyImageKHR(QEgl::display(), image); - } - - if (textureIsBound) { - fromTexture(newTextureId, newWidth, newHeight, - (si.hasAlphaChannel() && const_cast(si).data_ptr()->checkForAlphaPixels())); - texture()->options &= ~QGLContext::InvertedYBindOption; - softImage = si; - QMeeGoPixmapData::registerSharedImage(handle, softImage); - } else { - qWarning("Failed to create a texture from a shared image!"); - glDeleteTextures(1, &newTextureId); - } -} - -Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image) -{ - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - - QMeeGoExtensions::ensureInitialized(); - - GLuint textureId; - - glGenTextures(1, &textureId); - glBindTexture(GL_TEXTURE_2D, textureId); - if (image.hasAlphaChannel() && const_cast(image).data_ptr()->checkForAlphaPixels()) { - void *converted = convertBGRA32_to_RGBA32(image.bits(), image.width(), image.height(), image.bytesPerLine()); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, converted); - free(converted); - } else { - void *converted = convertRGB32_to_RGB565(image.bits(), image.width(), image.height(), image.bytesPerLine()); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, converted); - free(converted); - } - - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - 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); - if (eglimage) { - EGLNativeSharedImageTypeNOK handle = QMeeGoExtensions::eglCreateSharedImageNOK(QEgl::display(), eglimage, NULL); - QEgl::eglDestroyImageKHR(QEgl::display(), eglimage); - return (Qt::HANDLE) handle; - } else { - qWarning("Failed to create shared image from pixmap/texture!"); - return 0; - } -} - -void QMeeGoPixmapData::updateFromSoftImage() -{ - // FIXME That's broken with recent 16bit textures changes. - m_dirty = true; - m_source = softImage; - ensureCreated(); - - if (softImage.width() != w || softImage.height() != h) - qWarning("Ooops, looks like softImage changed dimensions since last updated! Corruption ahead?!"); -} - -bool QMeeGoPixmapData::destroyEGLSharedImage(Qt::HANDLE h) -{ - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - QMeeGoExtensions::ensureInitialized(); - - QMutableHashIterator i(sharedImagesMap); - while (i.hasNext()) { - i.next(); - if (i.value()->handle == h) - i.remove(); - } - - return QMeeGoExtensions::eglDestroySharedImageNOK(QEgl::display(), (EGLNativeSharedImageTypeNOK) h); -} - -void QMeeGoPixmapData::registerSharedImage(Qt::HANDLE handle, const QImage &si) -{ - void *raw = static_cast (((QImage) si).data_ptr()->data); - QMeeGoImageInfo *info; - - if (! sharedImagesMap.contains(raw)) { - info = new QMeeGoImageInfo; - info->handle = handle; - info->rawFormat = si.format(); - sharedImagesMap.insert(raw, info); - } else { - info = sharedImagesMap.value(raw); - if (info->handle != handle || info->rawFormat != si.format()) - qWarning("Inconsistency detected: overwriting entry in sharedImagesMap but handle/format different"); - } -} - -QPixmapData *QMeeGoPixmapData::createCompatiblePixmapData() const -{ - return new QMeeGoRasterPixmapData(pixelType()); -} diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.h b/src/plugins/graphicssystems/meego/qmeegopixmapdata.h deleted file mode 100644 index f1ff255b08d..00000000000 --- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MPIXMAPDATA_H -#define MPIXMAPDATA_H - -#include - -struct QMeeGoImageInfo -{ - Qt::HANDLE handle; - QImage::Format rawFormat; -}; - -class QMeeGoPixmapData : public QGLPixmapData -{ -public: - QMeeGoPixmapData(); - void fromTexture(GLuint textureId, int w, int h, bool alpha); - QPixmapData *createCompatiblePixmapData() const; - - virtual void fromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage); - virtual void fromImage (const QImage &image, Qt::ImageConversionFlags flags); - virtual QImage toImage() const; - virtual void updateFromSoftImage(); - - QImage softImage; - - static QHash sharedImagesMap; - - static Qt::HANDLE imageToEGLSharedImage(const QImage &image); - static bool destroyEGLSharedImage(Qt::HANDLE h); - static void registerSharedImage(Qt::HANDLE handle, const QImage &si); -}; - -#endif diff --git a/src/plugins/graphicssystems/opengl/opengl.pro b/src/plugins/graphicssystems/opengl/opengl.pro deleted file mode 100644 index fd3542ecf0b..00000000000 --- a/src/plugins/graphicssystems/opengl/opengl.pro +++ /dev/null @@ -1,13 +0,0 @@ -TARGET = qglgraphicssystem -load(qt_plugin) - -QT += core-private gui-private opengl-private - -DESTDIR = $$QT.gui.plugins/graphicssystems - -SOURCES = main.cpp - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target - -symbian: TARGET.UID3 = 0x2002131B diff --git a/src/plugins/graphicssystems/openvg/openvg.pro b/src/plugins/graphicssystems/openvg/openvg.pro deleted file mode 100644 index 6a737790a2f..00000000000 --- a/src/plugins/graphicssystems/openvg/openvg.pro +++ /dev/null @@ -1,14 +0,0 @@ -TARGET = qvggraphicssystem -load(qt_plugin) - -QT += openvg - -DESTDIR = $$QT.gui.plugins/graphicssystems - -SOURCES = main.cpp qgraphicssystem_vg.cpp -HEADERS = qgraphicssystem_vg_p.h - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target - -symbian: TARGET.UID3 = 0x2001E62C diff --git a/src/plugins/graphicssystems/shivavg/README b/src/plugins/graphicssystems/shivavg/README deleted file mode 100644 index 15ee7101e8d..00000000000 --- a/src/plugins/graphicssystems/shivavg/README +++ /dev/null @@ -1,8 +0,0 @@ - -This graphics system uses ShivaVG (http://sourceforge.net/projects/shivavg) -to perform OpenVG rendering on X11 systems. The graphics system name for -the "-graphicssystem" command-line option is "ShivaVG". - -ShivaVG support is experimental, mostly to demonstrate how to integrate -non-EGL OpenVG engines into the system. It will probably not produce -good output. diff --git a/src/plugins/graphicssystems/shivavg/shivavg.pro b/src/plugins/graphicssystems/shivavg/shivavg.pro deleted file mode 100644 index 1d934cd685a..00000000000 --- a/src/plugins/graphicssystems/shivavg/shivavg.pro +++ /dev/null @@ -1,12 +0,0 @@ -TARGET = qshivavggraphicssystem -load(qt_plugin) - -QT += openvg - -DESTDIR = $$QT.gui.plugins/graphicssystems - -SOURCES = main.cpp shivavggraphicssystem.cpp shivavgwindowsurface.cpp -HEADERS = shivavggraphicssystem.h shivavgwindowsurface.h - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target diff --git a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp b/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp deleted file mode 100644 index 448532ae924..00000000000 --- a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#define GL_GLEXT_PROTOTYPES -#include "shivavgwindowsurface.h" -#include -#if defined(Q_WS_X11) -#include "private/qt_x11_p.h" -#include "qx11info_x11.h" -#include - -extern QX11Info *qt_x11Info(const QPaintDevice *pd); -#endif - -// Define this to use framebuffer objects. -//#define QVG_USE_FBO 1 - -#include - -QT_BEGIN_NAMESPACE - -class QShivaContext -{ -public: - QShivaContext(); - ~QShivaContext(); - - bool makeCurrent(ShivaVGWindowSurfacePrivate *surface); - void doneCurrent(); - - bool initialized; - QSize currentSize; - ShivaVGWindowSurfacePrivate *currentSurface; -}; - -Q_GLOBAL_STATIC(QShivaContext, shivaContext); - -class ShivaVGWindowSurfacePrivate -{ -public: - ShivaVGWindowSurfacePrivate() - : isCurrent(false) - , needsResize(true) - , engine(0) -#if defined(QVG_USE_FBO) - , fbo(0) - , texture(0) -#endif -#if defined(Q_WS_X11) - , drawable(0) - , context(0) -#endif - { - } - ~ShivaVGWindowSurfacePrivate(); - - void ensureContext(QWidget *widget); - - QSize size; - bool isCurrent; - bool needsResize; - QVGPaintEngine *engine; -#if defined(QVG_USE_FBO) - GLuint fbo; - GLuint texture; -#endif -#if defined(Q_WS_X11) - GLXDrawable drawable; - GLXContext context; -#endif -}; - -QShivaContext::QShivaContext() - : initialized(false) - , currentSurface(0) -{ -} - -QShivaContext::~QShivaContext() -{ - if (initialized) - vgDestroyContextSH(); -} - -bool QShivaContext::makeCurrent(ShivaVGWindowSurfacePrivate *surface) -{ - if (currentSurface) - currentSurface->isCurrent = false; - surface->isCurrent = true; - currentSurface = surface; - currentSize = surface->size; -#if defined(Q_WS_X11) - glXMakeCurrent(X11->display, surface->drawable, surface->context); -#endif - if (!initialized) { - if (!vgCreateContextSH(currentSize.width(), currentSize.height())) { - qWarning("vgCreateContextSH(%d, %d): could not create context", currentSize.width(), currentSize.height()); - return false; - } - initialized = true; - } else { - vgResizeSurfaceSH(currentSize.width(), currentSize.height()); - } -#if defined(QVG_USE_FBO) - if (surface->fbo) - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, surface->fbo); - else - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); -#endif - return true; -} - -void QShivaContext::doneCurrent() -{ - if (currentSurface) { - currentSurface->isCurrent = false; - currentSurface = 0; - } -#if defined(Q_WS_X11) - glXMakeCurrent(X11->display, 0, 0); -#endif -} - -ShivaVGWindowSurfacePrivate::~ShivaVGWindowSurfacePrivate() -{ -#if defined(QVG_USE_FBO) - if (fbo) { - glDeleteTextures(1, &texture); - glDeleteFramebuffersEXT(1, &fbo); - } -#endif -} - -void ShivaVGWindowSurfacePrivate::ensureContext(QWidget *widget) -{ -#if defined(Q_WS_X11) - Window win = widget->winId(); - if (win != drawable) { - if (context) - glXDestroyContext(X11->display, context); - drawable = win; - } - if (context == 0) { - const QX11Info *xinfo = qt_x11Info(widget); - int spec[64]; - int i = 0; - spec[i++] = GLX_DOUBLEBUFFER; - spec[i++] = GLX_DEPTH_SIZE; - spec[i++] = 1; - spec[i++] = GLX_STENCIL_SIZE; - spec[i++] = 1; - spec[i++] = GLX_RGBA; - spec[i++] = GLX_RED_SIZE; - spec[i++] = 1; - spec[i++] = GLX_GREEN_SIZE; - spec[i++] = 1; - spec[i++] = GLX_BLUE_SIZE; - spec[i++] = 1; - spec[i++] = GLX_SAMPLE_BUFFERS_ARB; - spec[i++] = 1; - spec[i++] = GLX_SAMPLES_ARB; - spec[i++] = 4; - spec[i] = XNone; - XVisualInfo *visual = glXChooseVisual - (xinfo->display(), xinfo->screen(), spec); - context = glXCreateContext(X11->display, visual, 0, True); - if (!context) - qWarning("glXCreateContext: could not create GL context for VG rendering"); - } -#else - Q_UNUSED(widget); -#endif -#if defined(QVG_USE_FBO) - if (needsResize && fbo) { -#if defined(Q_WS_X11) - glXMakeCurrent(X11->display, drawable, context); -#endif - glDeleteTextures(1, &texture); - glDeleteFramebuffersEXT(1, &fbo); -#if defined(Q_WS_X11) - glXMakeCurrent(X11->display, 0, 0); -#endif - fbo = 0; - texture = 0; - } - if (!fbo) { -#if defined(Q_WS_X11) - glXMakeCurrent(X11->display, drawable, context); -#endif - glGenFramebuffersEXT(1, &fbo); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); - - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, size.width(), size.height(), 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2DEXT - (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, - texture, 0); - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); -#if defined(Q_WS_X11) - glXMakeCurrent(X11->display, 0, 0); -#endif - } -#endif - needsResize = false; -} - -ShivaVGWindowSurface::ShivaVGWindowSurface(QWidget *window) - : QWindowSurface(window), d_ptr(new ShivaVGWindowSurfacePrivate) -{ -} - -ShivaVGWindowSurface::~ShivaVGWindowSurface() -{ - if (d_ptr->isCurrent) { - shivaContext()->doneCurrent(); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } -#if defined(Q_WS_X11) - if (d_ptr->context) - glXDestroyContext(X11->display, d_ptr->context); -#endif - delete d_ptr; -} - -QPaintDevice *ShivaVGWindowSurface::paintDevice() -{ - d_ptr->ensureContext(window()); - shivaContext()->makeCurrent(d_ptr); - glClearDepth(0.0f); - glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - return this; -} - -void ShivaVGWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(region); - Q_UNUSED(offset); - QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); - d_ptr->ensureContext(parent); - QShivaContext *context = shivaContext(); - if (!d_ptr->isCurrent) - context->makeCurrent(d_ptr); -#if defined(QVG_USE_FBO) - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - if (d_ptr->fbo) { - static GLfloat const vertices[][2] = { - {-1, -1}, {1, -1}, {1, 1}, {-1, 1} - }; - static GLfloat const texCoords[][2] = { - {0, 0}, {1, 0}, {1, 1}, {0, 1} - }; - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glVertexPointer(2, GL_FLOAT, 0, vertices); - glTexCoordPointer(2, GL_FLOAT, 0, texCoords); - glBindTexture(GL_TEXTURE_2D, d_ptr->texture); - glEnable(GL_TEXTURE_2D); - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_VERTEX_ARRAY); - glDisable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, 0); - } -#endif -#if defined(Q_WS_X11) - glXSwapBuffers(X11->display, d_ptr->drawable); -#endif - context->doneCurrent(); -} - -void ShivaVGWindowSurface::setGeometry(const QRect &rect) -{ - QWindowSurface::setGeometry(rect); - d_ptr->needsResize = true; - d_ptr->size = rect.size(); -} - -bool ShivaVGWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - return QWindowSurface::scroll(area, dx, dy); -} - -void ShivaVGWindowSurface::beginPaint(const QRegion ®ion) -{ - // Nothing to do here. - Q_UNUSED(region); -} - -void ShivaVGWindowSurface::endPaint(const QRegion ®ion) -{ - // Nothing to do here. - Q_UNUSED(region); -} - -Q_GLOBAL_STATIC(QVGPaintEngine, sharedPaintEngine); - -QPaintEngine *ShivaVGWindowSurface::paintEngine() const -{ - if (!d_ptr->engine) - d_ptr->engine = sharedPaintEngine(); - return d_ptr->engine; -} - -int ShivaVGWindowSurface::metric(PaintDeviceMetric met) const -{ - return qt_paint_device_metric(window(), met); -} - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/trace/main.cpp b/src/plugins/graphicssystems/trace/main.cpp deleted file mode 100644 index c0043a2cddd..00000000000 --- a/src/plugins/graphicssystems/trace/main.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qgraphicssystem_trace_p.h" - -QT_BEGIN_NAMESPACE - -class QTraceGraphicsSystemPlugin : public QGraphicsSystemPlugin -{ -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QTraceGraphicsSystemPlugin::keys() const -{ - return QStringList(QLatin1String("Trace")); -} - -QGraphicsSystem* QTraceGraphicsSystemPlugin::create(const QString& system) -{ - if (system.toLower() == QLatin1String("trace")) - return new QTraceGraphicsSystem; - - return 0; -} - -Q_EXPORT_PLUGIN2(trace, QTraceGraphicsSystemPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp b/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp deleted file mode 100644 index 502a198099c..00000000000 --- a/src/plugins/graphicssystems/trace/qgraphicssystem_trace.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgraphicssystem_trace_p.h" -#include -#include -#include - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QTraceWindowSurface : public QRasterWindowSurface -{ -public: - QTraceWindowSurface(QWidget *widget); - ~QTraceWindowSurface(); - - QPaintDevice *paintDevice(); - void beginPaint(const QRegion &rgn); - void endPaint(const QRegion &rgn); - - bool scroll(const QRegion &area, int dx, int dy); - -private: - QPaintBuffer *buffer; - QList updates; - - qulonglong winId; -}; - -QTraceWindowSurface::QTraceWindowSurface(QWidget *widget) - : QRasterWindowSurface(widget) - , buffer(0) - , winId(0) -{ -} - -QTraceWindowSurface::~QTraceWindowSurface() -{ - if (buffer) { - QFile outputFile(QString(QLatin1String("qtgraphics-%0.trace")).arg(winId)); - if (outputFile.open(QIODevice::WriteOnly)) { - QDataStream out(&outputFile); - out.setFloatingPointPrecision(QDataStream::SinglePrecision); - - out.writeBytes("qttraceV2", 9); - - uint version = 1; - - out << version << *buffer << updates; - } - delete buffer; - } -} - -QPaintDevice *QTraceWindowSurface::paintDevice() -{ - if (!buffer) { - buffer = new QPaintBuffer; -#ifdef Q_WS_QPA - buffer->setBoundingRect(QRect(QPoint(), size())); -#else - buffer->setBoundingRect(geometry()); -#endif - } - return buffer; -} - -void QTraceWindowSurface::beginPaint(const QRegion &rgn) -{ - // ensure paint buffer is created - paintDevice(); - buffer->beginNewFrame(); - - QRasterWindowSurface::beginPaint(rgn); -} - -void QTraceWindowSurface::endPaint(const QRegion &rgn) -{ - QPainter p(QRasterWindowSurface::paintDevice()); - buffer->draw(&p, buffer->numFrames()-1); - p.end(); - - winId = (qulonglong)window()->winId(); - - updates << rgn; - - QRasterWindowSurface::endPaint(rgn); -} - -bool QTraceWindowSurface::scroll(const QRegion &, int, int) -{ - // TODO: scrolling should also be streamed and replayed - // to test scrolling performance - return false; -} - -QTraceGraphicsSystem::QTraceGraphicsSystem() -{ -} - -QPixmapData *QTraceGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} - -QWindowSurface *QTraceGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - return new QTraceWindowSurface(widget); -} - -QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/trace/trace.pro b/src/plugins/graphicssystems/trace/trace.pro deleted file mode 100644 index f44bb3211eb..00000000000 --- a/src/plugins/graphicssystems/trace/trace.pro +++ /dev/null @@ -1,13 +0,0 @@ -TARGET = qtracegraphicssystem -load(qt_plugin) - -QT += core-private gui-private network - -DESTDIR = $$QT.gui.plugins/graphicssystems -symbian:TARGET.UID3 = 0x2002130E - -SOURCES = main.cpp qgraphicssystem_trace.cpp - -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems -INSTALLS += target -INCLUDEPATH += ../../../3rdparty/harfbuzz/src diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index 5e1f16bad4f..da6b8a75bc5 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -589,7 +589,6 @@ QImage ICOReader::iconAt(int index) mask.setColor(1, qRgba(0 ,0 ,0 ,0xff)); read1BitBMP(mask); if (!mask.isNull()) { - img = QImage(image.width(), image.height(), QImage::Format_ARGB32 ); img = image; img.setAlphaChannel(mask); // (Luckily, it seems that setAlphaChannel() does not ruin the alpha values diff --git a/src/plugins/inputmethods/imsw-multi/imsw-multi.pro b/src/plugins/inputmethods/imsw-multi/imsw-multi.pro deleted file mode 100644 index 4c7b9b96d81..00000000000 --- a/src/plugins/inputmethods/imsw-multi/imsw-multi.pro +++ /dev/null @@ -1,13 +0,0 @@ -TARGET = qimsw-multi -load(qt_plugin) -CONFIG += warn_on - -DESTDIR = $$QT.gui.plugins/inputmethods - -HEADERS += qmultiinputcontext.h \ - qmultiinputcontextplugin.h -SOURCES += qmultiinputcontext.cpp \ - qmultiinputcontextplugin.cpp - -target.path += $$[QT_INSTALL_PLUGINS]/inputmethods -INSTALLS += target diff --git a/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp b/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp deleted file mode 100644 index 258d5865643..00000000000 --- a/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/**************************************************************************** -** -** Implementation of QMultiInputContext class -** -** Copyright (C) 2004 immodule for Qt Project. All rights reserved. -** -** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** licence. You may use this file under your Qt license. Following -** description is copied from their original file headers. Contact -** immodule-qt@freedesktop.org if any conditions of this licensing are -** not clear to you. -** -****************************************************************************/ - -#ifndef QT_NO_IM -#include "qmultiinputcontext.h" -#include -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -QMultiInputContext::QMultiInputContext() - : QInputContext(), current(-1) -{ - keys = QInputContextFactory::keys(); - for (int i = keys.size()-1; i >= 0; --i) - if (keys.at(i).contains(QLatin1String("imsw"))) - keys.removeAt(i); - - QString def = QLatin1String(getenv("QT4_IM_MODULE")); - if (def.isEmpty()) - def = QLatin1String(getenv("QT_IM_MODULE")); - if (def.isEmpty()) { - QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); - settings.beginGroup(QLatin1String("Qt")); - def = settings.value(QLatin1String("DefaultInputMethod"), QLatin1String("xim")).toString(); - } - current = keys.indexOf(def); - if (current < 0) - current = 0; - - menu = new QMenu(tr("Select IM")); - separator = new QAction(this); - separator->setSeparator(true); - - QActionGroup *group = new QActionGroup(this); - for (int i = 0; i < keys.size(); ++i) { - slaves.append(0); - const QString key = keys.at(i); - QAction *a = menu->addAction(QInputContextFactory::displayName(key)); - a->setData(key); - a->setCheckable(true); - group->addAction(a); - if (i == current) { - slaves.replace(current, QInputContextFactory::create(key, this)); - a->setChecked(true); - } - } - connect(group, SIGNAL(triggered(QAction*)), this, SLOT(changeSlave(QAction*))); -} - -QMultiInputContext::~QMultiInputContext() -{ - delete menu; -} - - -QString QMultiInputContext::identifierName() -{ - return (slave()) ? slave()->identifierName() : QLatin1String(""); -} - -QString QMultiInputContext::language() -{ - return (slave()) ? slave()->language() : QLatin1String(""); -} - - -#if defined(Q_WS_X11) -bool QMultiInputContext::x11FilterEvent(QWidget *keywidget, XEvent *event) -{ - return (slave()) ? slave()->x11FilterEvent(keywidget, event) : false; -} -#endif // Q_WS_X11 - - -bool QMultiInputContext::filterEvent(const QEvent *event) -{ - return (slave()) ? slave()->filterEvent(event) : false; -} - -void QMultiInputContext::reset() -{ - if (slave()) - slave()->reset(); -} - -void QMultiInputContext::update() -{ - if (slave()) - slave()->update(); -} - -void QMultiInputContext::mouseHandler(int x, QMouseEvent *event) -{ - if (slave()) - slave()->mouseHandler(x, event); -} - -QFont QMultiInputContext::font() const -{ - return (slave()) ? slave()->font() : QInputContext::font(); -} - -void QMultiInputContext::setFocusWidget(QWidget *w) -{ - QInputContext::setFocusWidget(w); - if (slave()) - slave()->setFocusWidget(w); -} - -QWidget *QMultiInputContext::focusWidget() const -{ - return QInputContext::focusWidget(); -} - -void QMultiInputContext::widgetDestroyed(QWidget *w) -{ - if (slave()) - slave()->widgetDestroyed(w); -} - -bool QMultiInputContext::isComposing() const -{ - return (slave()) ? slave()->isComposing() : false; -} - -QList QMultiInputContext::actions() -{ - QList a = slave()->actions(); - a.append(separator); - a.append(menu->menuAction()); - return a; -} - -void QMultiInputContext::changeSlave(QAction *a) -{ - for (int i = 0; i < slaves.size(); ++i) { - if (keys.at(i) == a->data().toString()) { - if (slaves.at(i) == 0) - slaves.replace(i, QInputContextFactory::create(keys.at(i), this)); - QInputContext *qic = slaves.at(current); - QWidget *oldWidget = qic->focusWidget(); - qic->reset(); - qic->setFocusWidget(0); - current = i; - qic = slaves.at(current); - qic->setFocusWidget(oldWidget); - return; - } - } -} - -QT_END_NAMESPACE - -#endif // QT_NO_IM diff --git a/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h b/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h deleted file mode 100644 index 5d311b3f4b7..00000000000 --- a/src/plugins/inputmethods/imsw-multi/qmultiinputcontext.h +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/**************************************************************************** -** -** Definition of QMultiInputContext class -** -** Copyright (C) 2004 immodule for Qt Project. All rights reserved. -** -** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** licence. You may use this file under your Qt license. Following -** description is copied from their original file headers. Contact -** immodule-qt@freedesktop.org if any conditions of this licensing are -** not clear to you. -** -****************************************************************************/ - -#ifndef QMULTIINPUTCONTEXT_H -#define QMULTIINPUTCONTEXT_H - -#ifndef QT_NO_IM - -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QMultiInputContext : public QInputContext -{ - Q_OBJECT -public: - QMultiInputContext(); - ~QMultiInputContext(); - - QString identifierName(); - QString language(); - -#if defined(Q_WS_X11) - bool x11FilterEvent( QWidget *keywidget, XEvent *event ); -#endif // Q_WS_X11 - bool filterEvent( const QEvent *event ); - - void reset(); - void update(); - void mouseHandler( int x, QMouseEvent *event ); - QFont font() const; - bool isComposing() const; - - QList actions(); - - QWidget *focusWidget() const; - void setFocusWidget(QWidget *w); - - void widgetDestroyed( QWidget *w ); - - QInputContext *slave() { return slaves.at(current); } - const QInputContext *slave() const { return slaves.at(current); } - -protected Q_SLOTS: - void changeSlave(QAction *); -private: - void *unused; - int current; - QList slaves; - QMenu *menu; - QAction *separator; - QStringList keys; -}; - -#endif // Q_NO_IM - -QT_END_NAMESPACE - -#endif // QMULTIINPUTCONTEXT_H diff --git a/src/plugins/inputmethods/imsw-multi/qmultiinputcontextplugin.cpp b/src/plugins/inputmethods/imsw-multi/qmultiinputcontextplugin.cpp deleted file mode 100644 index 1f56e2350b8..00000000000 --- a/src/plugins/inputmethods/imsw-multi/qmultiinputcontextplugin.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/**************************************************************************** -** -** Implementation of QMultiInputContextPlugin class -** -** Copyright (C) 2004 immodule for Qt Project. All rights reserved. -** -** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** license. You may use this file under your Qt license. Following -** description is copied from their original file headers. Contact -** immodule-qt@freedesktop.org if any conditions of this licensing are -** not clear to you. -** -****************************************************************************/ - -#ifndef QT_NO_IM -#include "qmultiinputcontext.h" -#include "qmultiinputcontextplugin.h" -#include -#include - -QT_BEGIN_NAMESPACE - -QMultiInputContextPlugin::QMultiInputContextPlugin() -{ -} - -QMultiInputContextPlugin::~QMultiInputContextPlugin() -{ -} - -QStringList QMultiInputContextPlugin::keys() const -{ - // input method switcher should named with "imsw-" prefix to - // prevent to be listed in ordinary input method list. - return QStringList( QLatin1String("imsw-multi") ); -} - -QInputContext *QMultiInputContextPlugin::create( const QString &key ) -{ - if (key != QLatin1String("imsw-multi")) - return 0; - return new QMultiInputContext; -} - -QStringList QMultiInputContextPlugin::languages( const QString & ) -{ - return QStringList(); -} - -QString QMultiInputContextPlugin::displayName( const QString &key ) -{ - if (key != QLatin1String("imsw-multi")) - return QString(); - return tr( "Multiple input method switcher" ); -} - -QString QMultiInputContextPlugin::description( const QString &key ) -{ - if (key != QLatin1String("imsw-multi")) - return QString(); - return tr( "Multiple input method switcher that uses the context menu of the text widgets" ); -} - - -Q_EXPORT_STATIC_PLUGIN(QMultiInputContextPlugin) -Q_EXPORT_PLUGIN2(qimsw_multi, QMultiInputContextPlugin) - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/inputmethods/imsw-multi/qmultiinputcontextplugin.h b/src/plugins/inputmethods/imsw-multi/qmultiinputcontextplugin.h deleted file mode 100644 index c18112ff8ba..00000000000 --- a/src/plugins/inputmethods/imsw-multi/qmultiinputcontextplugin.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/**************************************************************************** -** -** Definition of QMultiInputContextPlugin class -** -** Copyright (C) 2004 immodule for Qt Project. All rights reserved. -** -** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own -** license. You may use this file under your Qt license. Following -** description is copied from their original file headers. Contact -** immodule-qt@freedesktop.org if any conditions of this licensing are -** not clear to you. -** -****************************************************************************/ - -#ifndef QMULTIINPUTCONTEXTPLUGIN_H -#define QMULTIINPUTCONTEXTPLUGIN_H - -#ifndef QT_NO_IM - -#include "qmultiinputcontext.h" -#include -#include - -QT_BEGIN_NAMESPACE - -class QMultiInputContextPlugin : public QInputContextPlugin -{ - Q_OBJECT -public: - QMultiInputContextPlugin(); - ~QMultiInputContextPlugin(); - - QStringList keys() const; - QInputContext *create( const QString &key ); - QStringList languages( const QString &key ); - QString displayName( const QString &key ); - QString description( const QString &key ); -}; - -#endif // QT_NO_IM - -QT_END_NAMESPACE - -#endif // QMULTIINPUTCONTEXTPLUGIN_H diff --git a/src/plugins/inputmethods/inputmethods.pro b/src/plugins/inputmethods/inputmethods.pro deleted file mode 100644 index e1ca847519f..00000000000 --- a/src/plugins/inputmethods/inputmethods.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS = imsw-multi diff --git a/src/plugins/kbddrivers/kbddrivers.pro b/src/plugins/kbddrivers/kbddrivers.pro deleted file mode 100644 index dbab47b366a..00000000000 --- a/src/plugins/kbddrivers/kbddrivers.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -contains(kbd-plugins, linuxinput): SUBDIRS += linuxinput diff --git a/src/plugins/kbddrivers/linuxinput/linuxinput.pro b/src/plugins/kbddrivers/linuxinput/linuxinput.pro deleted file mode 100644 index 8eaa786ce04..00000000000 --- a/src/plugins/kbddrivers/linuxinput/linuxinput.pro +++ /dev/null @@ -1,14 +0,0 @@ -TARGET = qlinuxinputkbddriver -load(qt_plugin) - -DESTDIR = $$QT.gui.plugins/kbddrivers -target.path = $$[QT_INSTALL_PLUGINS]/kbddrivers -INSTALLS += target - -DEFINES += QT_QWS_KBD_LINUXINPUT - -HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qkbdlinuxinput_qws.h - -SOURCES = main.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qkbdlinuxinput_qws.cpp - diff --git a/src/plugins/kbddrivers/linuxinput/main.cpp b/src/plugins/kbddrivers/linuxinput/main.cpp deleted file mode 100644 index 9affaa67eac..00000000000 --- a/src/plugins/kbddrivers/linuxinput/main.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -QT_BEGIN_NAMESPACE - -class QLinuxInputKbdDriver : public QKbdDriverPlugin -{ -public: - QLinuxInputKbdDriver(); - - QStringList keys() const; - QWSKeyboardHandler* create(const QString &driver, const QString &device); -}; - -QLinuxInputKbdDriver::QLinuxInputKbdDriver() - : QKbdDriverPlugin() -{ -} - -QStringList QLinuxInputKbdDriver::keys() const -{ - return (QStringList() << QLatin1String("LinuxInput")); -} - -QWSKeyboardHandler* QLinuxInputKbdDriver::create(const QString &driver, - const QString &device) -{ - Q_UNUSED(device); - if (driver.compare(QLatin1String("LinuxInput"), Qt::CaseInsensitive)) - return 0; - return new QWSLinuxInputKeyboardHandler(device); -} - -Q_EXPORT_PLUGIN2(qwslinuxinputkbddriver, QLinuxInputKbdDriver) - -QT_END_NAMESPACE diff --git a/src/plugins/mousedrivers/linuxtp/linuxtp.pro b/src/plugins/mousedrivers/linuxtp/linuxtp.pro deleted file mode 100644 index e5d274a0b75..00000000000 --- a/src/plugins/mousedrivers/linuxtp/linuxtp.pro +++ /dev/null @@ -1,14 +0,0 @@ -TARGET = qlinuxtpmousedriver -load(qt_plugin) - -DESTDIR = $$QT.gui.plugins/mousedrivers -target.path = $$[QT_INSTALL_PLUGINS]/mousedrivers -INSTALLS += target - -DEFINES += QT_QWS_MOUSE_LINUXTP - -HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qmouselinuxtp_qws.h - -SOURCES = main.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qmouselinuxtp_qws.cpp - diff --git a/src/plugins/mousedrivers/linuxtp/main.cpp b/src/plugins/mousedrivers/linuxtp/main.cpp deleted file mode 100644 index 64a69ef7f11..00000000000 --- a/src/plugins/mousedrivers/linuxtp/main.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -QT_BEGIN_NAMESPACE - -class QLinuxTPMouseDriver : public QMouseDriverPlugin -{ -public: - QLinuxTPMouseDriver(); - - QStringList keys() const; - QWSMouseHandler* create(const QString &driver, const QString &device); -}; - -QLinuxTPMouseDriver::QLinuxTPMouseDriver() - : QMouseDriverPlugin() -{ -} - -QStringList QLinuxTPMouseDriver::keys() const -{ - return (QStringList() << "LinuxTP"); -} - -QWSMouseHandler* QLinuxTPMouseDriver::create(const QString &driver, - const QString &device) -{ - if (driver.compare(QLatin1String("LinuxTP"), Qt::CaseInsensitive)) - return 0; - return new QWSLinuxTPMouseHandler(driver, device); -} - -Q_EXPORT_PLUGIN2(qwslinuxtpmousehandler, QLinuxTPMouseDriver) - -QT_END_NAMESPACE diff --git a/src/plugins/mousedrivers/mousedrivers.pro b/src/plugins/mousedrivers/mousedrivers.pro deleted file mode 100644 index f89682b8807..00000000000 --- a/src/plugins/mousedrivers/mousedrivers.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs -contains(mouse-plugins, linuxtp): SUBDIRS += linuxtp -contains(mouse-plugins, pc): SUBDIRS += pc -contains(mouse-plugins, tslib): SUBDIRS += tslib -contains(mouse-plugins, linuxinput): SUBDIRS += linuxinput diff --git a/src/plugins/mousedrivers/pc/main.cpp b/src/plugins/mousedrivers/pc/main.cpp deleted file mode 100644 index fbd23dab0fb..00000000000 --- a/src/plugins/mousedrivers/pc/main.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -QT_BEGIN_NAMESPACE - -class QPcMouseDriver : public QMouseDriverPlugin -{ -public: - QPcMouseDriver(); - - QStringList keys() const; - QWSMouseHandler* create(const QString &driver, const QString &device); -}; - -QPcMouseDriver::QPcMouseDriver() - : QMouseDriverPlugin() -{ -} - -QStringList QPcMouseDriver::keys() const -{ - return (QStringList() - << QLatin1String("Auto") - << QLatin1String("IntelliMouse") - << QLatin1String("Microsoft") - << QLatin1String("MouseSystems") - << QLatin1String("MouseMan")); -} - -QWSMouseHandler* QPcMouseDriver::create(const QString &driver, - const QString &device) -{ - if (!keys().contains(driver, Qt::CaseInsensitive)) - return 0; - return new QWSPcMouseHandler(driver, device); -} - -Q_EXPORT_PLUGIN2(qwspcmousehandler, QPcMouseDriver) - -QT_END_NAMESPACE diff --git a/src/plugins/mousedrivers/pc/pc.pro b/src/plugins/mousedrivers/pc/pc.pro deleted file mode 100644 index 04d7b0f06fa..00000000000 --- a/src/plugins/mousedrivers/pc/pc.pro +++ /dev/null @@ -1,14 +0,0 @@ -TARGET = qpcmousedriver -load(qt_plugin) - -DESTDIR = $$QT.gui.plugins/mousedrivers -target.path = $$[QT_INSTALL_PLUGINS]/mousedrivers -INSTALLS += target - -DEFINES += QT_QWS_MOUSE_PC - -HEADERS = $$QT_SOURCE_TREE/src/gui/embedded/qmousepc_qws.h - -SOURCES = main.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qmousepc_qws.cpp - diff --git a/src/plugins/mousedrivers/tslib/tslib.pro b/src/plugins/mousedrivers/tslib/tslib.pro deleted file mode 100644 index 552a2e71733..00000000000 --- a/src/plugins/mousedrivers/tslib/tslib.pro +++ /dev/null @@ -1,16 +0,0 @@ -TARGET = qtslibmousedriver -load(qt_plugin) - -DESTDIR = $$QT.gui.plugins/mousedrivers - -HEADERS = \ - $$QT_SOURCE_TREE/src/gui/embedded/qmousedriverplugin_qws.h \ - $$QT_SOURCE_TREE/src/gui/embedded/qmousetslib_qws.h -SOURCES = main.cpp \ - $$QT_SOURCE_TREE/src/gui/embedded/qmousetslib_qws.cpp - -LIBS += -lts - -target.path += $$[QT_INSTALL_PLUGINS]/mousedrivers -INSTALLS += target - diff --git a/src/plugins/platforminputcontexts/ibus/ibus.pro b/src/plugins/platforminputcontexts/ibus/ibus.pro new file mode 100644 index 00000000000..193dad0018f --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/ibus.pro @@ -0,0 +1,19 @@ +TARGET = ibusplatforminputcontextplugin +load(qt_plugin) + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforminputcontexts + +QT += dbus platformsupport-private +SOURCES += $$PWD/qibusplatforminputcontext.cpp \ + $$PWD/qibusproxy.cpp \ + $$PWD/qibusinputcontextproxy.cpp \ + $$PWD/qibustypes.cpp \ + $$PWD/main.cpp + +HEADERS += $$PWD/qibusplatforminputcontext.h \ + $$PWD/qibusproxy.h \ + $$PWD/qibusinputcontextproxy.h \ + $$PWD/qibustypes.h + +target.path += $$[QT_INSTALL_PLUGINS]/platforminputcontexts +INSTALLS += target diff --git a/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml new file mode 100644 index 00000000000..dbc79c178b1 --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.InputContext.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.xml b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.xml new file mode 100644 index 00000000000..6ac48917712 --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/interfaces/org.freedesktop.IBus.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/gfxdrivers/qvfb/main.cpp b/src/plugins/platforminputcontexts/ibus/main.cpp similarity index 69% rename from src/plugins/gfxdrivers/qvfb/main.cpp rename to src/plugins/platforminputcontexts/ibus/main.cpp index 98661b61b92..eb773c88564 100644 --- a/src/plugins/gfxdrivers/qvfb/main.cpp +++ b/src/plugins/platforminputcontexts/ibus/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. ** @@ -39,44 +39,33 @@ ** ****************************************************************************/ -#include -#include -#include +#include +#include +#include "qibusplatforminputcontext.h" -#ifndef QT_NO_LIBRARY QT_BEGIN_NAMESPACE -class ScreenVfbDriver : public QScreenDriverPlugin +class QIbusPlatformInputContextPlugin : public QPlatformInputContextPlugin { public: - ScreenVfbDriver(); - QStringList keys() const; - QScreen *create(const QString&, int displayId); + QIBusPlatformInputContext *create(const QString&, const QStringList&); }; -ScreenVfbDriver::ScreenVfbDriver() -: QScreenDriverPlugin() +QStringList QIbusPlatformInputContextPlugin::keys() const { + return QStringList(QStringLiteral("ibus")); } -QStringList ScreenVfbDriver::keys() const +QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString& system, const QStringList& paramList) { - QStringList list; - list << "QVFb"; - return list; -} - -QScreen* ScreenVfbDriver::create(const QString& driver, int displayId) -{ - if (driver.toLower() == "qvfb") - return new QVFbScreen(displayId); + Q_UNUSED(paramList); + if (system.compare(system, QStringLiteral("ibus"), Qt::CaseInsensitive) == 0) + return new QIBusPlatformInputContext; return 0; } -Q_EXPORT_STATIC_PLUGIN(ScreenVfbDriver) -Q_EXPORT_PLUGIN2(qscreenvfb, ScreenVfbDriver) +Q_EXPORT_PLUGIN2(ibusplatforminputcontextplugin, QIbusPlatformInputContextPlugin) QT_END_NAMESPACE -#endif //QT_NO_LIBRARY diff --git a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp new file mode 100644 index 00000000000..7adffbc2e2f --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.cpp @@ -0,0 +1,26 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -N -p qibusinputcontextproxy -c QIBusInputContextProxy interfaces/org.freedesktop.IBus.InputContext.xml + * + * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#include "qibusinputcontextproxy.h" + +/* + * Implementation of interface class QIBusInputContextProxy + */ + +QIBusInputContextProxy::QIBusInputContextProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) +{ +} + +QIBusInputContextProxy::~QIBusInputContextProxy() +{ +} + diff --git a/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h new file mode 100644 index 00000000000..9a91c4e484b --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/qibusinputcontextproxy.h @@ -0,0 +1,144 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -N -p qibusinputcontextproxy -c QIBusInputContextProxy interfaces/org.freedesktop.IBus.InputContext.xml + * + * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#ifndef QIBUSINPUTCONTEXTPROXY_H_1308831153 +#define QIBUSINPUTCONTEXTPROXY_H_1308831153 + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Proxy class for interface org.freedesktop.IBus.InputContext + */ +class QIBusInputContextProxy: public QDBusAbstractInterface +{ + Q_OBJECT +public: + static inline const char *staticInterfaceName() + { return "org.freedesktop.IBus.InputContext"; } + +public: + QIBusInputContextProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); + + ~QIBusInputContextProxy(); + +public Q_SLOTS: // METHODS + inline QDBusPendingReply<> Destroy() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("Destroy"), argumentList); + } + + inline QDBusPendingReply<> Disable() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("Disable"), argumentList); + } + + inline QDBusPendingReply<> Enable() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("Enable"), argumentList); + } + + inline QDBusPendingReply<> FocusIn() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("FocusIn"), argumentList); + } + + inline QDBusPendingReply<> FocusOut() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("FocusOut"), argumentList); + } + + inline QDBusPendingReply GetEngine() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("GetEngine"), argumentList); + } + + inline QDBusPendingReply IsEnabled() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("IsEnabled"), argumentList); + } + + inline QDBusPendingReply ProcessKeyEvent(uint keyval, uint keycode, uint state) + { + QList argumentList; + argumentList << QVariant::fromValue(keyval) << QVariant::fromValue(keycode) << QVariant::fromValue(state); + return asyncCallWithArgumentList(QLatin1String("ProcessKeyEvent"), argumentList); + } + + inline QDBusPendingReply<> PropertyActivate(const QString &name, int state) + { + QList argumentList; + argumentList << QVariant::fromValue(name) << QVariant::fromValue(state); + return asyncCallWithArgumentList(QLatin1String("PropertyActivate"), argumentList); + } + + inline QDBusPendingReply<> Reset() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("Reset"), argumentList); + } + + inline QDBusPendingReply<> SetCapabilities(uint caps) + { + QList argumentList; + argumentList << QVariant::fromValue(caps); + return asyncCallWithArgumentList(QLatin1String("SetCapabilities"), argumentList); + } + + inline QDBusPendingReply<> SetCursorLocation(int x, int y, int w, int h) + { + QList argumentList; + argumentList << QVariant::fromValue(x) << QVariant::fromValue(y) << QVariant::fromValue(w) << QVariant::fromValue(h); + return asyncCallWithArgumentList(QLatin1String("SetCursorLocation"), argumentList); + } + + inline QDBusPendingReply<> SetEngine(const QString &name) + { + QList argumentList; + argumentList << QVariant::fromValue(name); + return asyncCallWithArgumentList(QLatin1String("SetEngine"), argumentList); + } + +Q_SIGNALS: // SIGNALS + void CommitText(const QDBusVariant &text); + void CursorDownLookupTable(); + void CursorUpLookupTable(); + void Disabled(); + void Enabled(); + void ForwardKeyEvent(uint keyval, uint keycode, uint state); + void HideAuxiliaryText(); + void HideLookupTable(); + void HidePreeditText(); + void PageDownLookupTable(); + void PageUpLookupTable(); + void RegisterProperties(const QDBusVariant &props); + void ShowAuxiliaryText(); + void ShowLookupTable(); + void ShowPreeditText(); + void UpdateAuxiliaryText(const QDBusVariant &text, bool visible); + void UpdateLookupTable(const QDBusVariant &table, bool visible); + void UpdatePreeditText(const QDBusVariant &text, uint cursor_pos, bool visible); + void UpdateProperty(const QDBusVariant &prop); +}; + +#endif diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp new file mode 100644 index 00000000000..af8fd5a1f11 --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -0,0 +1,329 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qibusplatforminputcontext.h" + +#include +#include +#include +#include +#include + +#include "qibusproxy.h" +#include "qibusinputcontextproxy.h" +#include "qibustypes.h" + +#include +#include + +#include + +enum { debug = 0 }; + +class QIBusPlatformInputContextPrivate +{ +public: + QIBusPlatformInputContextPrivate(); + ~QIBusPlatformInputContextPrivate() + { + delete context; + delete bus; + delete connection; + } + + static QDBusConnection *createConnection(); + + QDBusConnection *connection; + QIBusProxy *bus; + QIBusInputContextProxy *context; + + bool valid; +}; + + +QIBusPlatformInputContext::QIBusPlatformInputContext () + : d(new QIBusPlatformInputContextPrivate()) +{ + if (d->context) { + connect(d->context, SIGNAL(CommitText(QDBusVariant)), SLOT(commitText(QDBusVariant))); + connect(d->context, SIGNAL(UpdatePreeditText(QDBusVariant,uint,bool)), this, SLOT(updatePreeditText(QDBusVariant,uint,bool))); + } + QInputPanel *p = qApp->inputPanel(); + connect(p, SIGNAL(inputItemChanged()), this, SLOT(inputItemChanged())); + connect(p, SIGNAL(cursorRectangleChanged()), this, SLOT(cursorRectChanged())); +} + +QIBusPlatformInputContext::~QIBusPlatformInputContext (void) +{ + delete d; +} + +bool QIBusPlatformInputContext::isValid() const +{ + return d->valid; +} + +void QIBusPlatformInputContext::invokeAction(QInputPanel::Action a, int x) +{ + QPlatformInputContext::invokeAction(a, x); + + if (!d->valid) + return; +} + +void QIBusPlatformInputContext::reset() +{ + QPlatformInputContext::reset(); + + if (!d->valid) + return; + + d->context->Reset(); +} + +void QIBusPlatformInputContext::update(Qt::InputMethodQueries q) +{ + QPlatformInputContext::update(q); +} + +void QIBusPlatformInputContext::cursorRectChanged() +{ + if (!d->valid) + return; + + QRect r = qApp->inputPanel()->cursorRectangle().toRect(); + if(!r.isValid()) + return; + + QWindow *inputWindow = qApp->inputPanel()->inputWindow(); + r.moveTopLeft(inputWindow->mapToGlobal(r.topLeft())); + if (debug) + qDebug() << "microFocus" << r; + d->context->SetCursorLocation(r.x(), r.y(), r.width(), r.height()); +} + +void QIBusPlatformInputContext::inputItemChanged() +{ + if (!d->valid) + return; + + QObject *input = qApp->inputPanel()->inputItem(); + if (debug) + qDebug() << "setFocusObject" << input; + if (input) + d->context->FocusIn(); + else + d->context->FocusOut(); +} + + +void QIBusPlatformInputContext::commitText(const QDBusVariant &text) +{ + QObject *input = qApp->inputPanel()->inputItem(); + if (!input) + return; + + const QDBusArgument arg = text.variant().value(); + + QIBusText t; + if (debug) + qDebug() << arg.currentSignature(); + t.fromDBusArgument(arg); + if (debug) + qDebug() << "commit text:" << t.text; + + QInputMethodEvent event; + event.setCommitString(t.text); + QCoreApplication::sendEvent(input, &event); +} + +void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint cursorPos, bool visible) +{ + QObject *input = qApp->inputPanel()->inputItem(); + if (!input) + return; + + const QDBusArgument arg = text.variant().value(); + + QIBusText t; + t.fromDBusArgument(arg); + if (debug) + qDebug() << "preedit text:" << t.text; + + QList attributes = t.attributes.imAttributes(); + attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0, QVariant()); + + QInputMethodEvent event(t.text, attributes); + QCoreApplication::sendEvent(input, &event); +} + + +/* Kernel keycode -> X keycode table */ +static const unsigned int keycode_table[256] = { + 0, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 76, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 111, 221, 94, 95, 96, 211, 128, 127, 129, 208, 131, 126, + 108, 109, 112, 111, 113, 181, 97, 98, 99, 100, 102, 103, 104, 105, 106, 107, + 239, 160, 174, 176, 222, 157, 123, 110, 139, 134, 209, 210, 133, 115, 116, 117, + 232, 133, 134, 135, 140, 248, 191, 192, 122, 188, 245, 158, 161, 193, 223, 227, + 198, 199, 200, 147, 159, 151, 178, 201, 146, 203, 166, 236, 230, 235, 234, 233, + 163, 204, 253, 153, 162, 144, 164, 177, 152, 190, 208, 129, 130, 231, 209, 210, + 136, 220, 143, 246, 251, 137, 138, 182, 183, 184, 93, 184, 247, 132, 170, 219, + 249, 205, 207, 149, 150, 154, 155, 167, 168, 169, 171, 172, 173, 165, 175, 179, + 180, 0, 185, 186, 187, 118, 119, 120, 121, 229, 194, 195, 196, 197, 148, 202, + 101, 212, 237, 214, 215, 216, 217, 218, 228, 142, 213, 240, 241, 242, 243, 244, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +bool +QIBusPlatformInputContext::x11FilterEvent(uint keyval, uint keycode, uint state, bool press) +{ + if (!d->valid) + return false; + + if (!press) + return false; + + keycode -= 8; // ### + QDBusReply reply = d->context->ProcessKeyEvent(keyval, keycode, state); + +// qDebug() << "x11FilterEvent return" << reply.value(); + + return reply.value(); +} + +QIBusPlatformInputContextPrivate::QIBusPlatformInputContextPrivate() + : connection(createConnection()), + bus(0), + context(0), + valid(false) +{ + if (!connection || !connection->isConnected()) { + qDebug("QIBusPlatformInputContext: not connected."); + return; + } + + bus = new QIBusProxy(QLatin1String("org.freedesktop.IBus"), + QLatin1String("/org/freedesktop/IBus"), + *connection); + if (!bus->isValid()) { + qWarning("QIBusPlatformInputContext: invalid bus."); + return; + } + + QDBusReply ic = bus->CreateInputContext(QLatin1String("QIBusInputContext")); + if (!ic.isValid()) { + qWarning("QIBusPlatformInputContext: CreateInputContext failed."); + return; + } + + context = new QIBusInputContextProxy(QLatin1String("org.freedesktop.IBus"), ic.value().path(), *connection); + + if (!context->isValid()) { + qWarning("QIBusPlatformInputContext: invalid input context."); + return; + } + + enum Capabilities { + IBUS_CAP_PREEDIT_TEXT = 1 << 0, + IBUS_CAP_AUXILIARY_TEXT = 1 << 1, + IBUS_CAP_LOOKUP_TABLE = 1 << 2, + IBUS_CAP_FOCUS = 1 << 3, + IBUS_CAP_PROPERTY = 1 << 4, + IBUS_CAP_SURROUNDING_TEXT = 1 << 5 + }; + context->SetCapabilities(IBUS_CAP_PREEDIT_TEXT|IBUS_CAP_FOCUS); + + if (debug) + qDebug(">>>> valid!"); + valid = true; +} + +QDBusConnection *QIBusPlatformInputContextPrivate::createConnection() +{ + QByteArray display(getenv("DISPLAY")); + QByteArray host = "unix"; + QByteArray displayNumber = "0"; + + int pos = display.indexOf(':'); + if (pos > 0) + host = display.left(pos); + ++pos; + int pos2 = display.indexOf('.', pos); + if (pos2 > 0) + displayNumber = display.mid(pos, pos2 - pos); + if (debug) + qDebug() << "host=" << host << "displayNumber" << displayNumber; + + QFile file(QDir::homePath() + QLatin1String("/.config/ibus/bus/") + + QLatin1String(QDBusConnection::localMachineId()) + + QLatin1Char('-') + QString::fromLocal8Bit(host) + QLatin1Char('-') + QString::fromLocal8Bit(displayNumber)); + + if (!file.exists()) { + qWarning("QIBusPlatformInputContext: ibus config file '%s' does not exist.", qPrintable(file.fileName())); + return 0; + } + + file.open(QFile::ReadOnly); + + QByteArray address; + int pid = -1; + + while (!file.atEnd()) { + QByteArray line = file.readLine().trimmed(); + if (line.startsWith('#')) + continue; + + if (line.startsWith("IBUS_ADDRESS=")) + address = line.mid(sizeof("IBUS_ADDRESS=") - 1); + if (line.startsWith("IBUS_DAEMON_PID=")) + pid = line.mid(sizeof("IBUS_DAEMON_PID=") - 1).toInt(); + } + + if (debug) + qDebug() << "IBUS_ADDRESS=" << address << "PID=" << pid; + if (address.isEmpty() || pid < 0 || kill(pid, 0) != 0) + return 0; + + return new QDBusConnection(QDBusConnection::connectToBus(QString::fromLatin1(address), QLatin1String("QIBusProxy"))); +} diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h new file mode 100644 index 00000000000..84b578db16d --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QIBUSPLATFORMINPUTCONTEXT_H +#define QIBUSPLATFORMINPUTCONTEXT_H + +#include + +class QIBusPlatformInputContextPrivate; +class QDBusVariant; + +class QIBusPlatformInputContext : public QPlatformInputContext +{ + Q_OBJECT +public: + QIBusPlatformInputContext(); + ~QIBusPlatformInputContext(); + + bool isValid() const; + + void invokeAction(QInputPanel::Action a, int x); + void reset(void); + void update(Qt::InputMethodQueries); + + Q_INVOKABLE bool x11FilterEvent(uint keyval, uint keycode, uint state, bool press); + +public Q_SLOTS: + void commitText(const QDBusVariant &text); + void updatePreeditText(const QDBusVariant &text, uint cursor_pos, bool visible); + void inputItemChanged(); + void cursorRectChanged(); + +private: + QIBusPlatformInputContextPrivate *d; +}; + +#endif diff --git a/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp b/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp new file mode 100644 index 00000000000..9d64b603f3c --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp @@ -0,0 +1,26 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -N -p qibusproxy -c QIBusProxy interfaces/org.freedesktop.IBus.xml + * + * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#include "qibusproxy.h" + +/* + * Implementation of interface class QIBusProxy + */ + +QIBusProxy::QIBusProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) +{ +} + +QIBusProxy::~QIBusProxy() +{ +} + diff --git a/src/plugins/platforminputcontexts/ibus/qibusproxy.h b/src/plugins/platforminputcontexts/ibus/qibusproxy.h new file mode 100644 index 00000000000..389eec3175f --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/qibusproxy.h @@ -0,0 +1,88 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -N -p qibusproxy -c QIBusProxy interfaces/org.freedesktop.IBus.xml + * + * qdbusxml2cpp is Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#ifndef QIBUSPROXY_H_1308831142 +#define QIBUSPROXY_H_1308831142 + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Proxy class for interface org.freedesktop.IBus + */ +class QIBusProxy: public QDBusAbstractInterface +{ + Q_OBJECT +public: + static inline const char *staticInterfaceName() + { return "org.freedesktop.IBus"; } + +public: + QIBusProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); + + ~QIBusProxy(); + +public Q_SLOTS: // METHODS + inline QDBusPendingReply CreateInputContext(const QString &name) + { + QList argumentList; + argumentList << QVariant::fromValue(name); + return asyncCallWithArgumentList(QLatin1String("CreateInputContext"), argumentList); + } + + inline QDBusPendingReply<> Exit(bool restart) + { + QList argumentList; + argumentList << QVariant::fromValue(restart); + return asyncCallWithArgumentList(QLatin1String("Exit"), argumentList); + } + + inline QDBusPendingReply GetAddress() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("GetAddress"), argumentList); + } + + inline QDBusPendingReply ListActiveEngines() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("ListActiveEngines"), argumentList); + } + + inline QDBusPendingReply ListEngines() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("ListEngines"), argumentList); + } + + inline QDBusPendingReply Ping(const QDBusVariant &data) + { + QList argumentList; + argumentList << QVariant::fromValue(data); + return asyncCallWithArgumentList(QLatin1String("Ping"), argumentList); + } + + inline QDBusPendingReply<> RegisterComponent(const QDBusVariant &components) + { + QList argumentList; + argumentList << QVariant::fromValue(components); + return asyncCallWithArgumentList(QLatin1String("RegisterComponent"), argumentList); + } + +Q_SIGNALS: // SIGNALS +}; + +#endif diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp new file mode 100644 index 00000000000..8d8c61afb75 --- /dev/null +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp @@ -0,0 +1,209 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qibustypes.h" +#include +#include + +QIBusSerializable::QIBusSerializable() +{ +} + +QIBusSerializable::~QIBusSerializable() +{ +} + +void QIBusSerializable::fromDBusArgument(const QDBusArgument &arg) +{ + arg >> name; + arg.beginMap(); + while (!arg.atEnd()) { + arg.beginMapEntry(); + QString key; + QDBusVariant value; + arg >> key; + arg >> value; + arg.endMapEntry(); + attachments[key] = value.variant().value(); + } + arg.endMap(); +} + + + +QIBusAttribute::QIBusAttribute() + : type(Invalid), + value(0), + start(0), + end(0) +{ +} + +QIBusAttribute::~QIBusAttribute() +{ + +} + +void QIBusAttribute::fromDBusArgument(const QDBusArgument &arg) +{ +// qDebug() << "QIBusAttribute::fromDBusArgument()" << arg.currentSignature(); + arg.beginStructure(); + + QIBusSerializable::fromDBusArgument(arg); + + quint32 t; + arg >> t; + type = (Type)t; + arg >> value; + arg >> start; + arg >> end; + + arg.endStructure(); +} + +QTextFormat QIBusAttribute::format() const +{ + QTextCharFormat fmt; + switch (type) { + case Invalid: + break; + case Underline: { + QTextCharFormat::UnderlineStyle style = QTextCharFormat::NoUnderline; + + switch (value) { + case UnderlineNone: + break; + case UnderlineSingle: + style = QTextCharFormat::SingleUnderline; + break; + case UnderlineDouble: + style = QTextCharFormat::DashUnderline; + break; + case UnderlineLow: + style = QTextCharFormat::DashDotLine; + break; + case UnderlineError: + style = QTextCharFormat::WaveUnderline; + fmt.setUnderlineColor(Qt::red); + break; + } + + fmt.setUnderlineStyle(style); + break; + } + case Foreground: + fmt.setForeground(QColor(value)); + break; + case Background: + fmt.setBackground(QColor(value)); + break; + } + return fmt; +} + + +QIBusAttributeList::QIBusAttributeList() +{ + +} + +QIBusAttributeList::~QIBusAttributeList() +{ + +} + +void QIBusAttributeList::fromDBusArgument(const QDBusArgument &arg) +{ +// qDebug() << "QIBusAttributeList::fromDBusArgument()" << arg.currentSignature(); + arg.beginStructure(); + + QIBusSerializable::fromDBusArgument(arg); + + arg.beginArray(); + while(!arg.atEnd()) { + QDBusVariant var; + arg >> var; + + QIBusAttribute attr; + attr.fromDBusArgument(var.variant().value()); + attributes.append(attr); + } + arg.endArray(); + + arg.endStructure(); +} + +QList QIBusAttributeList::imAttributes() const +{ + QList imAttrs; + for (int i = 0; i < attributes.size(); ++i) { + const QIBusAttribute &attr = attributes.at(i); + imAttrs += QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, attr.start, attr.end - attr.start, attr.format()); + } + return imAttrs; +} + + +QIBusText::QIBusText() +{ + +} + +QIBusText::~QIBusText() +{ + +} + +void QIBusText::fromDBusArgument(const QDBusArgument &arg) +{ +// qDebug() << "QIBusText::fromDBusArgument()" << arg.currentSignature(); + arg.beginStructure(); + + QIBusSerializable::fromDBusArgument(arg); + + arg >> text; + QDBusVariant variant; + arg >> variant; + attributes.fromDBusArgument(variant.variant().value()); + + arg.endStructure(); +} + diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h b/src/plugins/platforminputcontexts/ibus/qibustypes.h similarity index 57% rename from src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h rename to src/plugins/platforminputcontexts/ibus/qibustypes.h index f1893e3e96d..c426ff7eda7 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.h @@ -38,62 +38,79 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#ifndef QIBUSTYPES_H +#define QIBUSTYPES_H -#ifndef PVREGLSCREEN_H -#define PVREGLSCREEN_H +#include +#include -#include -#include -#include "pvrqwsdrawable.h" +class QDBusArgument; -class PvrEglScreen; - -class PvrEglScreenSurfaceFunctions : public QGLScreenSurfaceFunctions +class QIBusSerializable { public: - PvrEglScreenSurfaceFunctions(PvrEglScreen *s, int screenNum) - : screen(s), displayId(screenNum) {} + QIBusSerializable(); + virtual ~QIBusSerializable(); - bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native); + virtual void fromDBusArgument(const QDBusArgument &arg); -private: - PvrEglScreen *screen; - int displayId; + QString name; + QHash attachments; }; -class PvrEglScreen : public QGLScreen +class QIBusAttribute : public QIBusSerializable { public: - PvrEglScreen(int displayId); - ~PvrEglScreen(); + enum Type { + Invalid = 0, + Underline = 1, + Foreground = 2, + Background = 3, + }; - bool initDevice(); - bool connect(const QString &displaySpec); - void disconnect(); - void shutdownDevice(); - void setMode(int, int, int) {} + enum Underline { + UnderlineNone = 0, + UnderlineSingle = 1, + UnderlineDouble = 2, + UnderlineLow = 3, + UnderlineError = 4, + }; - void blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion); - void solidFill(const QColor &color, const QRegion ®ion); + QIBusAttribute(); + ~QIBusAttribute(); - bool chooseContext(QGLContext *context, const QGLContext *shareContext); - bool hasOpenGL(); + void fromDBusArgument(const QDBusArgument &arg); + QTextFormat format() const; - QWSWindowSurface* createSurface(QWidget *widget) const; - QWSWindowSurface* createSurface(const QString &key) const; + Type type; + quint32 value; + quint32 start; + quint32 end; +}; - int transformation() const; +class QIBusAttributeList : public QIBusSerializable +{ +public: + QIBusAttributeList(); + ~QIBusAttributeList(); -private: - void sync(); - void openTty(); - void closeTty(); + void fromDBusArgument(const QDBusArgument &arg); - int fd; - int ttyfd, oldKdMode; - QString ttyDevice; - bool doGraphicsMode; - mutable const QScreen *parent; + QList imAttributes() const; + + QVector attributes; +}; + +class QIBusText : public QIBusSerializable +{ +public: + QIBusText(); + ~QIBusText(); + + void fromDBusArgument(const QDBusArgument &arg); + + QString text; + QIBusAttributeList attributes; }; #endif diff --git a/src/plugins/platforminputcontexts/platforminputcontexts.pro b/src/plugins/platforminputcontexts/platforminputcontexts.pro new file mode 100644 index 00000000000..b6e2b6e775c --- /dev/null +++ b/src/plugins/platforminputcontexts/platforminputcontexts.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +!macx:!win:SUBDIRS += ibus + diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index bfa147f9481..d6801e0bedf 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -2,28 +2,46 @@ TARGET = qcocoa load(qt_plugin) DESTDIR = $$QT.gui.plugins/platforms -OBJECTIVE_SOURCES = main.mm \ +OBJECTIVE_SOURCES += main.mm \ qcocoaintegration.mm \ - qcocoawindowsurface.mm \ + qcocoabackingstore.mm \ qcocoawindow.mm \ qnsview.mm \ - qcocoaeventloopintegration.mm \ qcocoaautoreleasepool.mm \ - qnswindowdelegate.mm + qnswindowdelegate.mm \ + qcocoaglcontext.mm \ + qcocoanativeinterface.mm \ + qcocoaeventdispatcher.mm \ + qcocoamenuloader.mm \ + qcocoaapplicationdelegate.mm \ + qcocoaapplication.mm \ + qcocoamenu.mm \ + qmenu_mac.mm \ + qcocoahelpers.mm \ -OBJECTIVE_HEADERS = qcocoaintegration.h \ - qcocoawindowsurface.h \ +HEADERS += qcocoaintegration.h \ + qcocoabackingstore.h \ qcocoawindow.h \ qnsview.h \ - qcocoaeventloopintegration.h \ qcocoaautoreleasepool.h \ - qnswindowdelegate.h + qnswindowdelegate.h \ + qcocoaglcontext.h \ + qcocoanativeinterface.h \ + qcocoaeventdispatcher.h \ + qcocoamenuloader.h \ + qcocoaapplicationdelegate.h \ + qcocoaapplication.h \ + qcocoamenu.h \ + qmenu_mac.h \ + qcocoahelpers.h \ + +RESOURCES += qcocoaresources.qrc #add libz for freetype. -LIBS += -lz -LIBS += -framework cocoa +LIBS += -lz -framework Cocoa -include(../fontdatabases/coretext/coretext.pri) +QT += core-private gui-private widgets-private platformsupport-private + +CONFIG += qpa/basicunixfontdatabase target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target - diff --git a/src/gui/mac/images/copyarrowcursor.png b/src/plugins/platforms/cocoa/images/copyarrowcursor.png similarity index 100% rename from src/gui/mac/images/copyarrowcursor.png rename to src/plugins/platforms/cocoa/images/copyarrowcursor.png diff --git a/src/gui/mac/images/forbiddencursor.png b/src/plugins/platforms/cocoa/images/forbiddencursor.png similarity index 100% rename from src/gui/mac/images/forbiddencursor.png rename to src/plugins/platforms/cocoa/images/forbiddencursor.png diff --git a/src/gui/mac/images/leopard-unified-toolbar-on.png b/src/plugins/platforms/cocoa/images/leopard-unified-toolbar-on.png similarity index 100% rename from src/gui/mac/images/leopard-unified-toolbar-on.png rename to src/plugins/platforms/cocoa/images/leopard-unified-toolbar-on.png diff --git a/src/gui/mac/images/pluscursor.png b/src/plugins/platforms/cocoa/images/pluscursor.png similarity index 100% rename from src/gui/mac/images/pluscursor.png rename to src/plugins/platforms/cocoa/images/pluscursor.png diff --git a/src/gui/mac/images/spincursor.png b/src/plugins/platforms/cocoa/images/spincursor.png similarity index 100% rename from src/gui/mac/images/spincursor.png rename to src/plugins/platforms/cocoa/images/spincursor.png diff --git a/src/gui/mac/images/waitcursor.png b/src/plugins/platforms/cocoa/images/waitcursor.png similarity index 100% rename from src/gui/mac/images/waitcursor.png rename to src/plugins/platforms/cocoa/images/waitcursor.png diff --git a/src/gui/kernel/qcocoaapplication_mac_p.h b/src/plugins/platforms/cocoa/qcocoaapplication.h similarity index 97% rename from src/gui/kernel/qcocoaapplication_mac_p.h rename to src/plugins/platforms/cocoa/qcocoaapplication.h index a8a16f35474..5b6b2f48f2a 100644 --- a/src/gui/kernel/qcocoaapplication_mac_p.h +++ b/src/plugins/platforms/cocoa/qcocoaapplication.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -88,8 +88,8 @@ /* Cocoa Application Categories */ -#include "qmacdefines_mac.h" -#ifdef QT_MAC_USE_COCOA +#include "qglobal.h" + #import QT_FORWARD_DECLARE_CLASS(QApplicationPrivate) @class QT_MANGLE_NAMESPACE(QCocoaMenuLoader); @@ -114,4 +114,3 @@ void qt_redirectNSApplicationSendEvent(); QT_END_NAMESPACE -#endif diff --git a/src/gui/kernel/qcocoaapplication_mac.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm similarity index 96% rename from src/gui/kernel/qcocoaapplication_mac.mm rename to src/plugins/platforms/cocoa/qcocoaapplication.mm index 6c47a9e2ec4..2adf6a57f0f 100644 --- a/src/gui/kernel/qcocoaapplication_mac.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -73,12 +73,12 @@ ** ****************************************************************************/ -#include -#ifdef QT_MAC_USE_COCOA -#include -#include -#include -#include +#include + +#include +#include +#include +#include QT_USE_NAMESPACE @@ -112,7 +112,8 @@ QT_USE_NAMESPACE - (void)qt_sendPostedMessage:(NSEvent *)event { - // WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5! +/* + // WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5! // That is why we need to split the address in two parts: quint64 lower = [event data1]; quint64 upper = [event data2]; @@ -134,10 +135,12 @@ QT_USE_NAMESPACE } delete args; +*/ } - (BOOL)qt_filterEvent:(NSEvent *)event { +/* if (qApp->macEventFilter(0, reinterpret_cast(event))) return true; @@ -150,6 +153,7 @@ QT_USE_NAMESPACE break; } } +*/ return false; } @@ -200,6 +204,7 @@ QT_BEGIN_NAMESPACE void qt_redirectNSApplicationSendEvent() { +/* if ([NSApp isMemberOfClass:[QNSApplication class]]) { // No need to change implementation since Qt // already controls a subclass of NSApplication @@ -216,7 +221,7 @@ void qt_redirectNSApplicationSendEvent() [QNSApplication class], @selector(qt_sendEvent_replacement:), @selector(qt_sendEvent_original:)); + */ } QT_END_NAMESPACE -#endif diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h similarity index 97% rename from src/gui/kernel/qcocoaapplicationdelegate_mac_p.h rename to src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h index 275ea0696a4..7f8d1dfacd4 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac_p.h +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -87,10 +87,10 @@ // -#include "qmacdefines_mac.h" -#ifdef QT_MAC_USE_COCOA #import +#include + QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); @class QT_MANGLE_NAMESPACE(QCocoaMenuLoader); @@ -125,4 +125,3 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate); - (void)setReflectionDelegate:(NSObject *)oldDelegate; - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent; @end -#endif diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm similarity index 91% rename from src/gui/kernel/qcocoaapplicationdelegate_mac.mm rename to src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm index cd9ad2262a7..6a2508359bd 100644 --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -73,30 +73,14 @@ ** ****************************************************************************/ -#include "qmacdefines_mac.h" -#ifdef QT_MAC_USE_COCOA -#import -#import -#import -#include -#include -#include -#include +#import "qcocoaapplicationdelegate.h" +#import "qnswindowdelegate.h" #include #include -#include +#include +#include -QT_BEGIN_NAMESPACE -extern void onApplicationChangedActivation(bool); // qapplication_mac.mm -extern void qt_release_apple_event_handler(); //qapplication_mac.mm -extern QPointer qt_last_mouse_receiver; // qapplication_mac.cpp -extern QPointer qt_last_native_mouse_receiver; // qt_cocoa_helpers_mac.mm -extern QPointer qt_button_down; // qapplication_mac.cpp - -QT_END_NAMESPACE - -QT_FORWARD_DECLARE_CLASS(QDesktopWidgetImplementation) QT_USE_NAMESPACE static QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) *sharedCocoaApplicationDelegate = nil; @@ -188,6 +172,7 @@ static void cleanupCocoaApplicationDelegate() // QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { +/* Q_UNUSED(sender); // The reflection delegate gets precedence if (reflectionDelegate @@ -212,17 +197,25 @@ static void cleanupCocoaApplicationDelegate() } return NSTerminateCancel; +*/ + return NSTerminateNow; } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { Q_UNUSED(aNotification); inLaunch = false; - qt_release_apple_event_handler(); + // qt_release_apple_event_handler(); + + + // Insert code here to initialize your application } + + - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { +/* for (NSString *fileName in filenames) { QString qtFileName = qt_mac_NSStringToQString(fileName); if (inLaunch) { @@ -240,6 +233,7 @@ static void cleanupCocoaApplicationDelegate() if (reflectionDelegate && [reflectionDelegate respondsToSelector:@selector(application:openFiles:)]) [reflectionDelegate application:sender openFiles:filenames]; +*/ } - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender @@ -255,6 +249,7 @@ static void cleanupCocoaApplicationDelegate() - (void)applicationDidBecomeActive:(NSNotification *)notification { +/* if (reflectionDelegate && [reflectionDelegate respondsToSelector:@selector(applicationDidBecomeActive:)]) [reflectionDelegate applicationDidBecomeActive:notification]; @@ -272,10 +267,12 @@ static void cleanupCocoaApplicationDelegate() qt_last_native_mouse_receiver = widgetUnderMouse ? (widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget()) : 0; } +*/ } - (void)applicationDidResignActive:(NSNotification *)notification { +/* if (reflectionDelegate && [reflectionDelegate respondsToSelector:@selector(applicationDidResignActive:)]) [reflectionDelegate applicationDidResignActive:notification]; @@ -287,12 +284,13 @@ static void cleanupCocoaApplicationDelegate() qt_last_mouse_receiver = 0; qt_last_native_mouse_receiver = 0; qt_button_down = 0; +*/ } - (void)applicationDidChangeScreenParameters:(NSNotification *)notification { Q_UNUSED(notification); - QDesktopWidgetImplementation::instance()->onResize(); + //QDesktopWidgetImplementation::instance()->onResize(); } - (void)setReflectionDelegate:(NSObject *)oldDelegate @@ -331,24 +329,26 @@ static void cleanupCocoaApplicationDelegate() - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { Q_UNUSED(replyEvent); - +/* NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; QUrl url(qt_mac_NSStringToQString(urlString)); QFileOpenEvent qtEvent(url); qt_sendSpontaneousEvent(qAppInstance(), &qtEvent); +*/ } - (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { Q_UNUSED(event); Q_UNUSED(replyEvent); + qDebug() << "appleEventQuit"; + [NSApp terminate:self]; } - (void)qtDispatcherToQAction:(id)sender { - [[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender]; + //[[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender]; } @end -#endif diff --git a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h index 862bc27f9de..359b5d34d01 100644 --- a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h +++ b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h @@ -42,6 +42,8 @@ #ifndef QCOCOAAUTORELEASEPOOL_H #define QCOCOAAUTORELEASEPOOL_H +#undef slots + #include class QCocoaAutoReleasePool diff --git a/src/plugins/platforms/cocoa/qcocoawindowsurface.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h similarity index 84% rename from src/plugins/platforms/cocoa/qcocoawindowsurface.h rename to src/plugins/platforms/cocoa/qcocoabackingstore.h index 95eea2b7ea2..938e27347c8 100644 --- a/src/plugins/platforms/cocoa/qcocoawindowsurface.h +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h @@ -39,33 +39,31 @@ ** ****************************************************************************/ -#ifndef QWINDOWSURFACE_COCOA_H -#define QWINDOWSURFACE_COCOA_H +#ifndef QBACKINGSTORE_COCOA_H +#define QBACKINGSTORE_COCOA_H #include #include "qcocoawindow.h" #include "qnsview.h" -#include +#include QT_BEGIN_NAMESPACE -class QCocoaWindowSurface : public QWindowSurface +class QCocoaBackingStore : public QPlatformBackingStore { public: - QCocoaWindowSurface(QWidget *window, WId wid); - ~QCocoaWindowSurface(); + QCocoaBackingStore(QWindow *window); + ~QCocoaBackingStore(); QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize (const QSize &size); + void flush(QWindow *widget, const QRegion ®ion, const QPoint &offset); + void resize (const QSize &size, const QRegion &); private: - QCocoaWindow *m_cocoaWindow; QImage *m_image; - QNSView *m_contentView; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoawindowsurface.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm similarity index 77% rename from src/plugins/platforms/cocoa/qcocoawindowsurface.mm rename to src/plugins/platforms/cocoa/qcocoabackingstore.mm index 16bb3271967..5a59fb5c499 100644 --- a/src/plugins/platforms/cocoa/qcocoawindowsurface.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -39,10 +39,9 @@ ** ****************************************************************************/ -#include "qcocoawindowsurface.h" +#include "qcocoabackingstore.h" #include - #include QT_BEGIN_NAMESPACE @@ -56,30 +55,28 @@ QRect flipedRect(const QRect &sourceRect,int height) return flippedRect; } -QCocoaWindowSurface::QCocoaWindowSurface(QWidget *window, WId wId) - : QWindowSurface(window) +QCocoaBackingStore::QCocoaBackingStore(QWindow *window) + : QPlatformBackingStore(window) { - m_cocoaWindow = static_cast(window->platformWindow()); + m_cocoaWindow = static_cast(window->handle()); const QRect geo = window->geometry(); NSRect rect = NSMakeRect(geo.x(),geo.y(),geo.width(),geo.height()); - m_contentView = [[QNSView alloc] initWithWidget:window]; - m_cocoaWindow->setContentView(m_contentView); - m_image = new QImage(window->size(),QImage::Format_ARGB32); + m_image = new QImage(window->geometry().size(),QImage::Format_ARGB32); } -QCocoaWindowSurface::~QCocoaWindowSurface() +QCocoaBackingStore::~QCocoaBackingStore() { delete m_image; } -QPaintDevice *QCocoaWindowSurface::paintDevice() +QPaintDevice *QCocoaBackingStore::paintDevice() { return m_image; } -void QCocoaWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QCocoaBackingStore::flush(QWindow *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(widget); Q_UNUSED(offset); @@ -87,17 +84,15 @@ void QCocoaWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QP QRect geo = region.boundingRect(); NSRect rect = NSMakeRect(geo.x(), geo.y(), geo.width(), geo.height()); - [m_contentView displayRect:rect]; + [m_cocoaWindow->m_contentView displayRect:rect]; } -void QCocoaWindowSurface::resize(const QSize &size) +void QCocoaBackingStore::resize(const QSize &size, const QRegion &) { - QWindowSurface::resize(size); delete m_image; m_image = new QImage(size,QImage::Format_ARGB32_Premultiplied); NSSize newSize = NSMakeSize(size.width(),size.height()); - [m_contentView setImage:m_image]; - + [static_cast(m_cocoaWindow->m_contentView) setImage:m_image]; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h new file mode 100644 index 00000000000..7184db84fac --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h @@ -0,0 +1,220 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** Copyright (c) 2007-2008, Apple, Inc. +** +** All rights reserved. +** +** 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 Apple, Inc. 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. +** +****************************************************************************/ + +#ifndef QEVENTDISPATCHER_MAC_P_H +#define QEVENTDISPATCHER_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 + +#include + +QT_BEGIN_NAMESPACE + +typedef struct _NSModalSession *NSModalSession; +typedef struct _QCocoaModalSessionInfo { + QPointer window; + NSModalSession session; + void *nswindow; +} QCocoaModalSessionInfo; + +class QCocoaEventDispatcherPrivate; +class QCocoaEventDispatcher : public QEventDispatcherUNIX +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QCocoaEventDispatcher) + +public: + QCocoaEventDispatcher(QAbstractEventDispatcherPrivate &priv, QObject *parent = 0); + explicit QCocoaEventDispatcher(QObject *parent = 0); + ~QCocoaEventDispatcher(); + + + bool processEvents(QEventLoop::ProcessEventsFlags flags); + bool hasPendingEvents(); + + void registerSocketNotifier(QSocketNotifier *notifier); + void unregisterSocketNotifier(QSocketNotifier *notifier); + + void registerTimer(int timerId, int interval, QObject *object); + bool unregisterTimer(int timerId); + bool unregisterTimers(QObject *object); + QList registeredTimers(QObject *object) const; + + void wakeUp(); + void interrupt(); + +private: + //friend void qt_mac_select_timer_callbk(__EventLoopTimer*, void*); + friend class QApplicationPrivate; +}; + +struct MacTimerInfo { + int id; + int interval; + QObject *obj; + bool pending; + CFRunLoopTimerRef runLoopTimer; + bool operator==(const MacTimerInfo &other) + { + return (id == other.id); + } +}; +typedef QHash MacTimerHash; + +struct MacSocketInfo { + MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0) {} + CFSocketRef socket; + CFRunLoopSourceRef runloop; + QObject *readNotifier; + QObject *writeNotifier; +}; +typedef QHash MacSocketHash; + +class QCocoaEventDispatcherPrivate : public QEventDispatcherUNIXPrivate +{ + Q_DECLARE_PUBLIC(QCocoaEventDispatcher) + +public: + QCocoaEventDispatcherPrivate(); + + static MacTimerHash macTimerHash; + // Set 'blockSendPostedEvents' to true if you _really_ need + // to make sure that qt events are not posted while calling + // low-level cocoa functions (like beginModalForWindow). And + // use a QBoolBlocker to be safe: + static bool blockSendPostedEvents; + // The following variables help organizing modal sessions: + static QStack cocoaModalSessionStack; + static bool currentExecIsNSAppRun; + static bool nsAppRunCalledByQt; + static bool cleanupModalSessionsNeeded; + static NSModalSession currentModalSessionCached; + static NSModalSession currentModalSession(); + static void updateChildrenWorksWhenModal(); + static void temporarilyStopAllModalSessions(); + static void beginModalSession(QWindow *widget); + static void endModalSession(QWindow *widget); + static void cancelWaitForMoreEvents(); + static void cleanupModalSessions(); + static void ensureNSAppInitialized(); + + MacSocketHash macSockets; + QList queuedUserInputEvents; // NSEvent * + CFRunLoopSourceRef postedEventsSource; + CFRunLoopObserverRef waitingObserver; + CFRunLoopObserverRef firstTimeObserver; + QAtomicInt serialNumber; + int lastSerial; + static bool interrupt; +private: + static Boolean postedEventSourceEqualCallback(const void *info1, const void *info2); + static void postedEventsSourcePerformCallback(void *info); + static void activateTimer(CFRunLoopTimerRef, void *info); + static void waitingObserverCallback(CFRunLoopObserverRef observer, + CFRunLoopActivity activity, void *info); + static void firstLoopEntry(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info); + friend void processPostedEvents(QCocoaEventDispatcherPrivate *const d, const bool blockSendPostedEvents); +}; + +class QtCocoaInterruptDispatcher : public QObject +{ + static QtCocoaInterruptDispatcher *instance; + bool cancelled; + + QtCocoaInterruptDispatcher(); + ~QtCocoaInterruptDispatcher(); + + public: + static void interruptLater(); + static void cancelInterruptLater(); +}; + +QT_END_NAMESPACE + +#endif // QEVENTDISPATCHER_MAC_P_H diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm new file mode 100644 index 00000000000..9525b47c65f --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -0,0 +1,1123 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** +** +** Copyright (c) 2007-2008, Apple, Inc. +** +** All rights reserved. +** +** 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 Apple, Inc. 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. +** +****************************************************************************/ + +#include "qcocoaeventdispatcher.h" +#include "qcocoaautoreleasepool.h" + +#include "qguiapplication.h" +#include "qevent.h" +#include "qhash.h" +#include "qmutex.h" +#include "qsocketnotifier.h" +#include +#include "private/qthread_p.h" +#include "private/qguiapplication_p.h" +#include + +#undef slots +#include +#include + +QT_BEGIN_NAMESPACE + +QT_USE_NAMESPACE + +enum { + QtCocoaEventSubTypeWakeup = SHRT_MAX, + QtCocoaEventSubTypePostMessage = SHRT_MAX-1 +}; + +static inline CFRunLoopRef mainRunLoop() +{ + return CFRunLoopGetMain(); +} + +/***************************************************************************** + Timers stuff + *****************************************************************************/ + +/* timer call back */ +void QCocoaEventDispatcherPrivate::activateTimer(CFRunLoopTimerRef, void *info) +{ + int timerID = +#ifdef Q_OS_MAC64 + qint64(info); +#else + int(info); +#endif + + MacTimerInfo *tmr; + tmr = macTimerHash.value(timerID); + if (tmr == 0 || tmr->pending == true) + return; // Can't send another timer event if it's pending. + + + if (blockSendPostedEvents) { + QCoreApplication::postEvent(tmr->obj, new QTimerEvent(tmr->id)); + } else { + tmr->pending = true; + QTimerEvent e(tmr->id); + + QCoreApplication::sendSpontaneousEvent(tmr->obj, &e); + // Get the value again in case the timer gets unregistered during the sendEvent. + tmr = macTimerHash.value(timerID); + if (tmr != 0) + tmr->pending = false; + } + +} + +void QCocoaEventDispatcher::registerTimer(int timerId, int interval, QObject *obj) +{ +#ifndef QT_NO_DEBUG + if (timerId < 1 || interval < 0 || !obj) { + qWarning("QEventDispatcherMac::registerTimer: invalid arguments"); + return; + } else if (obj->thread() != thread() || thread() != QThread::currentThread()) { + qWarning("QObject::startTimer: timers cannot be started from another thread"); + return; + } +#endif + + MacTimerInfo *t = new MacTimerInfo(); + t->id = timerId; + t->interval = interval; + t->obj = obj; + t->runLoopTimer = 0; + t->pending = false; + + CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent(); + CFTimeInterval cfinterval = qMax(CFTimeInterval(interval) / 1000, 0.0000001); + fireDate += cfinterval; + QCocoaEventDispatcherPrivate::macTimerHash.insert(timerId, t); + CFRunLoopTimerContext info = { 0, (void *)timerId, 0, 0, 0 }; + t->runLoopTimer = CFRunLoopTimerCreate(0, fireDate, cfinterval, 0, 0, + QCocoaEventDispatcherPrivate::activateTimer, &info); + if (t->runLoopTimer == 0) { + qFatal("QEventDispatcherMac::registerTimer: Cannot create timer"); + } + CFRunLoopAddTimer(mainRunLoop(), t->runLoopTimer, kCFRunLoopCommonModes); +} + +bool QCocoaEventDispatcher::unregisterTimer(int identifier) +{ +#ifndef QT_NO_DEBUG + if (identifier < 1) { + qWarning("QEventDispatcherMac::unregisterTimer: invalid argument"); + return false; + } else if (thread() != QThread::currentThread()) { + qWarning("QObject::killTimer: timers cannot be stopped from another thread"); + return false; + } +#endif + if (identifier <= 0) + return false; // not init'd or invalid timer + + MacTimerInfo *timerInfo = QCocoaEventDispatcherPrivate::macTimerHash.take(identifier); + if (timerInfo == 0) + return false; + + if (!QObjectPrivate::get(timerInfo->obj)->inThreadChangeEvent) + QAbstractEventDispatcherPrivate::releaseTimerId(identifier); + CFRunLoopTimerInvalidate(timerInfo->runLoopTimer); + CFRelease(timerInfo->runLoopTimer); + delete timerInfo; + + return true; +} + +bool QCocoaEventDispatcher::unregisterTimers(QObject *obj) +{ +#ifndef QT_NO_DEBUG + if (!obj) { + qWarning("QEventDispatcherMac::unregisterTimers: invalid argument"); + return false; + } else if (obj->thread() != thread() || thread() != QThread::currentThread()) { + qWarning("QObject::killTimers: timers cannot be stopped from another thread"); + return false; + } +#endif + + MacTimerHash::iterator it = QCocoaEventDispatcherPrivate::macTimerHash.begin(); + while (it != QCocoaEventDispatcherPrivate::macTimerHash.end()) { + MacTimerInfo *timerInfo = it.value(); + if (timerInfo->obj != obj) { + ++it; + } else { + if (!QObjectPrivate::get(timerInfo->obj)->inThreadChangeEvent) + QAbstractEventDispatcherPrivate::releaseTimerId(timerInfo->id); + CFRunLoopTimerInvalidate(timerInfo->runLoopTimer); + CFRelease(timerInfo->runLoopTimer); + delete timerInfo; + it = QCocoaEventDispatcherPrivate::macTimerHash.erase(it); + } + } + return true; +} + +QList +QCocoaEventDispatcher::registeredTimers(QObject *object) const +{ + if (!object) { + qWarning("QEventDispatcherMac:registeredTimers: invalid argument"); + return QList(); + } + + QList list; + + MacTimerHash::const_iterator it = QCocoaEventDispatcherPrivate::macTimerHash.constBegin(); + while (it != QCocoaEventDispatcherPrivate::macTimerHash.constEnd()) { + MacTimerInfo *t = it.value(); + if (t->obj == object) + list << TimerInfo(t->id, t->interval); + ++it; + } + return list; +} + +/************************************************************************** + Socket Notifiers + *************************************************************************/ +void qt_mac_socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef, + const void *, void *info) { + QCocoaEventDispatcherPrivate *const eventDispatcher + = static_cast(info); + int nativeSocket = CFSocketGetNative(s); + MacSocketInfo *socketInfo = eventDispatcher->macSockets.value(nativeSocket); + QEvent notifierEvent(QEvent::SockAct); + + // There is a race condition that happen where we disable the notifier and + // the kernel still has a notification to pass on. We then get this + // notification after we've successfully disabled the CFSocket, but our Qt + // notifier is now gone. The upshot is we have to check the notifier + // everytime. + if (callbackType == kCFSocketReadCallBack) { + if (socketInfo->readNotifier) + QGuiApplication::sendEvent(socketInfo->readNotifier, ¬ifierEvent); + } else if (callbackType == kCFSocketWriteCallBack) { + if (socketInfo->writeNotifier) + QGuiApplication::sendEvent(socketInfo->writeNotifier, ¬ifierEvent); + } +} + +/* + Adds a loop source for the given socket to the current run loop. +*/ +CFRunLoopSourceRef qt_mac_add_socket_to_runloop(const CFSocketRef socket) +{ + CFRunLoopSourceRef loopSource = CFSocketCreateRunLoopSource(kCFAllocatorDefault, socket, 0); + if (!loopSource) + return 0; + + CFRunLoopAddSource(mainRunLoop(), loopSource, kCFRunLoopCommonModes); + return loopSource; +} + +/* + Removes the loop source for the given socket from the current run loop. +*/ +void qt_mac_remove_socket_from_runloop(const CFSocketRef socket, CFRunLoopSourceRef runloop) +{ + Q_ASSERT(runloop); + CFRunLoopRemoveSource(mainRunLoop(), runloop, kCFRunLoopCommonModes); + CFSocketDisableCallBacks(socket, kCFSocketReadCallBack); + CFSocketDisableCallBacks(socket, kCFSocketWriteCallBack); + CFRunLoopSourceInvalidate(runloop); +} + +/* + Register a QSocketNotifier with the mac event system by creating a CFSocket with + with a read/write callback. + + Qt has separate socket notifiers for reading and writing, but on the mac there is + a limitation of one CFSocket object for each native socket. +*/ +void QCocoaEventDispatcher::registerSocketNotifier(QSocketNotifier *notifier) +{ + Q_ASSERT(notifier); + int nativeSocket = notifier->socket(); + int type = notifier->type(); +#ifndef QT_NO_DEBUG + if (nativeSocket < 0 || nativeSocket > FD_SETSIZE) { + qWarning("QSocketNotifier: Internal error"); + return; + } else if (notifier->thread() != thread() + || thread() != QThread::currentThread()) { + qWarning("QSocketNotifier: socket notifiers cannot be enabled from another thread"); + return; + } +#endif + + Q_D(QCocoaEventDispatcher); + + if (type == QSocketNotifier::Exception) { + qWarning("QSocketNotifier::Exception is not supported on Mac OS X"); + return; + } + + // Check if we have a CFSocket for the native socket, create one if not. + MacSocketInfo *socketInfo = d->macSockets.value(nativeSocket); + if (!socketInfo) { + socketInfo = new MacSocketInfo(); + + // Create CFSocket, specify that we want both read and write callbacks (the callbacks + // are enabled/disabled later on). + const int callbackTypes = kCFSocketReadCallBack | kCFSocketWriteCallBack; + CFSocketContext context = {0, d, 0, 0, 0}; + socketInfo->socket = CFSocketCreateWithNative(kCFAllocatorDefault, nativeSocket, callbackTypes, qt_mac_socket_callback, &context); + if (CFSocketIsValid(socketInfo->socket) == false) { + qWarning("QEventDispatcherMac::registerSocketNotifier: Failed to create CFSocket"); + return; + } + + CFOptionFlags flags = CFSocketGetSocketFlags(socketInfo->socket); + flags |= kCFSocketAutomaticallyReenableWriteCallBack; //QSocketNotifier stays enabled after a write + flags &= ~kCFSocketCloseOnInvalidate; //QSocketNotifier doesn't close the socket upon destruction/invalidation + CFSocketSetSocketFlags(socketInfo->socket, flags); + + // Add CFSocket to runloop. + if(!(socketInfo->runloop = qt_mac_add_socket_to_runloop(socketInfo->socket))) { + qWarning("QEventDispatcherMac::registerSocketNotifier: Failed to add CFSocket to runloop"); + CFSocketInvalidate(socketInfo->socket); + CFRelease(socketInfo->socket); + return; + } + + // Disable both callback types by default. This must be done after + // we add the CFSocket to the runloop, or else these calls will have + // no effect. + CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack); + CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack); + + d->macSockets.insert(nativeSocket, socketInfo); + } + + // Increment read/write counters and select enable callbacks if necessary. + if (type == QSocketNotifier::Read) { + Q_ASSERT(socketInfo->readNotifier == 0); + socketInfo->readNotifier = notifier; + CFSocketEnableCallBacks(socketInfo->socket, kCFSocketReadCallBack); + } else if (type == QSocketNotifier::Write) { + Q_ASSERT(socketInfo->writeNotifier == 0); + socketInfo->writeNotifier = notifier; + CFSocketEnableCallBacks(socketInfo->socket, kCFSocketWriteCallBack); + } +} + +/* + Unregister QSocketNotifer. The CFSocket correspoding to this notifier is + removed from the runloop of this is the last notifier that users + that CFSocket. +*/ +void QCocoaEventDispatcher::unregisterSocketNotifier(QSocketNotifier *notifier) +{ + Q_ASSERT(notifier); + int nativeSocket = notifier->socket(); + int type = notifier->type(); +#ifndef QT_NO_DEBUG + if (nativeSocket < 0 || nativeSocket > FD_SETSIZE) { + qWarning("QSocketNotifier: Internal error"); + return; + } else if (notifier->thread() != thread() || thread() != QThread::currentThread()) { + qWarning("QSocketNotifier: socket notifiers cannot be disabled from another thread"); + return; + } +#endif + + Q_D(QCocoaEventDispatcher); + + if (type == QSocketNotifier::Exception) { + qWarning("QSocketNotifier::Exception is not supported on Mac OS X"); + return; + } + MacSocketInfo *socketInfo = d->macSockets.value(nativeSocket); + if (!socketInfo) { + qWarning("QEventDispatcherMac::unregisterSocketNotifier: Tried to unregister a not registered notifier"); + return; + } + + // Decrement read/write counters and disable callbacks if necessary. + if (type == QSocketNotifier::Read) { + Q_ASSERT(notifier == socketInfo->readNotifier); + socketInfo->readNotifier = 0; + CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack); + } else if (type == QSocketNotifier::Write) { + Q_ASSERT(notifier == socketInfo->writeNotifier); + socketInfo->writeNotifier = 0; + CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack); + } + + // Remove CFSocket from runloop if this was the last QSocketNotifier. + if (socketInfo->readNotifier == 0 && socketInfo->writeNotifier == 0) { + if (CFSocketIsValid(socketInfo->socket)) + qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop); + CFRunLoopSourceInvalidate(socketInfo->runloop); + CFRelease(socketInfo->runloop); + CFSocketInvalidate(socketInfo->socket); + CFRelease(socketInfo->socket); + delete socketInfo; + d->macSockets.remove(nativeSocket); + } +} + +bool QCocoaEventDispatcher::hasPendingEvents() +{ + extern uint qGlobalPostedEventsCount(); + extern bool qt_is_gui_used; //qapplication.cpp + return qGlobalPostedEventsCount() || (qt_is_gui_used && GetNumEventsInQueue(GetMainEventQueue())); +} + +static bool IsMouseOrKeyEvent( NSEvent* event ) +{ + bool result = false; + + switch( [event type] ) + { + case NSLeftMouseDown: + case NSLeftMouseUp: + case NSRightMouseDown: + case NSRightMouseUp: + case NSMouseMoved: // ?? + case NSLeftMouseDragged: + case NSRightMouseDragged: + case NSMouseEntered: + case NSMouseExited: + case NSKeyDown: + case NSKeyUp: + case NSFlagsChanged: // key modifiers changed? + case NSCursorUpdate: // ?? + case NSScrollWheel: + case NSTabletPoint: + case NSTabletProximity: + case NSOtherMouseDown: + case NSOtherMouseUp: + case NSOtherMouseDragged: +#ifndef QT_NO_GESTURES +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 + case NSEventTypeGesture: // touch events + case NSEventTypeMagnify: + case NSEventTypeSwipe: + case NSEventTypeRotate: + case NSEventTypeBeginGesture: + case NSEventTypeEndGesture: +#endif +#endif // QT_NO_GESTURES + result = true; + break; + + default: + break; + } + return result; +} + +static inline void qt_mac_waitForMoreEvents() +{ + // If no event exist in the cocoa event que, wait + // (and free up cpu time) until at least one event occur. + // This implementation is a bit on the edge, but seems to + // work fine: + NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:[NSDate distantFuture] + inMode:NSDefaultRunLoopMode + dequeue:YES]; + if (event) + [NSApp postEvent:event atStart:YES]; +} + +static inline void qt_mac_waitForMoreModalSessionEvents() +{ + // If no event exist in the cocoa event que, wait + // (and free up cpu time) until at least one event occur. + // This implementation is a bit on the edge, but seems to + // work fine: + NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:[NSDate distantFuture] + inMode:NSModalPanelRunLoopMode + dequeue:YES]; + if (event) + [NSApp postEvent:event atStart:YES]; +} + +bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) +{ + Q_D(QCocoaEventDispatcher); + d->interrupt = false; + + bool interruptLater = false; + QtCocoaInterruptDispatcher::cancelInterruptLater(); + + // In case we end up recursing while we now process events, make sure + // that we send remaining posted Qt events before this call returns: + wakeUp(); + emit awake(); + + bool excludeUserEvents = flags & QEventLoop::ExcludeUserInputEvents; + bool retVal = false; + forever { + if (d->interrupt) + break; + + QCocoaAutoReleasePool pool; + NSEvent* event = 0; + + // First, send all previously excluded input events, if any: + if (!excludeUserEvents) { + while (!d->queuedUserInputEvents.isEmpty()) { + event = static_cast(d->queuedUserInputEvents.takeFirst()); + if (!filterEvent(event)) { + [NSApp sendEvent:event]; + retVal = true; + } + [event release]; + } + } + + // If Qt is used as a plugin, or as an extension in a native cocoa + // application, we should not run or stop NSApplication; This will be + // done from the application itself. And if processEvents is called + // manually (rather than from a QEventLoop), we cannot enter a tight + // loop and block this call, but instead we need to return after one flush. + // Finally, if we are to exclude user input events, we cannot call [NSApp run] + // as we then loose control over which events gets dispatched: + const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![NSApp isRunning]; + const bool canExec_Qt = !excludeUserEvents && + (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) ; + + if (canExec_Qt && canExec_3rdParty) { + // We can use exec-mode, meaning that we can stay in a tight loop until + // interrupted. This is mostly an optimization, but it allow us to use + // [NSApp run], which is the normal code path for cocoa applications. + if (NSModalSession session = d->currentModalSession()) { + QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); + while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt) + qt_mac_waitForMoreModalSessionEvents(); + + if (!d->interrupt && session == d->currentModalSessionCached) { + // Someone called [NSApp stopModal:] from outside the event + // dispatcher (e.g to stop a native dialog). But that call wrongly stopped + // 'session' as well. As a result, we need to restart all internal sessions: + d->temporarilyStopAllModalSessions(); + } + } else { + d->nsAppRunCalledByQt = true; + QBoolBlocker execGuard(d->currentExecIsNSAppRun, true); + [NSApp run]; + } + retVal = true; + } else { + // We cannot block the thread (and run in a tight loop). + // Instead we will process all current pending events and return. + d->ensureNSAppInitialized(); + if (NSModalSession session = d->currentModalSession()) { + // INVARIANT: a modal window is executing. + if (!excludeUserEvents) { + // Since we can dispatch all kinds of events, we choose + // to use cocoa's native way of running modal sessions: + if (flags & QEventLoop::WaitForMoreEvents) + qt_mac_waitForMoreModalSessionEvents(); + NSInteger status = [NSApp runModalSession:session]; + if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) { + // INVARIANT: Someone called [NSApp stopModal:] from outside the event + // dispatcher (e.g to stop a native dialog). But that call wrongly stopped + // 'session' as well. As a result, we need to restart all internal sessions: + d->temporarilyStopAllModalSessions(); + } + retVal = true; + } else do { + // Dispatch all non-user events (but que non-user events up for later). In + // this case, we need more control over which events gets dispatched, and + // cannot use [NSApp runModalSession:session]: + event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:nil + inMode:NSModalPanelRunLoopMode + dequeue: YES]; + + if (event) { + if (IsMouseOrKeyEvent(event)) { + [event retain]; + d->queuedUserInputEvents.append(event); + continue; + } + if (!filterEvent(event)) { + [NSApp sendEvent:event]; + retVal = true; + } + } + } while (!d->interrupt && event != nil); + } else do { + // INVARIANT: No modal window is executing. + event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:nil + inMode:NSDefaultRunLoopMode + dequeue: YES]; + + if (event) { + if (flags & QEventLoop::ExcludeUserInputEvents) { + if (IsMouseOrKeyEvent(event)) { + [event retain]; + d->queuedUserInputEvents.append(event); + continue; + } + } + if (!filterEvent(event)) { + [NSApp sendEvent:event]; + retVal = true; + } + } + } while (!d->interrupt && event != nil); + + // Be sure to flush the Qt posted events when not using exec mode + // (exec mode will always do this call from the event loop source): + if (!d->interrupt) + QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); + + // Since the window that holds modality might have changed while processing + // events, we we need to interrupt when we return back the previous process + // event recursion to ensure that we spin the correct modal session. + // We do the interruptLater at the end of the function to ensure that we don't + // disturb the 'wait for more events' below (as deleteLater will post an event): + interruptLater = true; + } + bool canWait = (d->threadData->canWait + && !retVal + && !d->interrupt + && (flags & QEventLoop::WaitForMoreEvents)); + if (canWait) { + // INVARIANT: We haven't processed any events yet. And we're told + // to stay inside this function until at least one event is processed. + qt_mac_waitForMoreEvents(); + flags &= ~QEventLoop::WaitForMoreEvents; + } else { + // Done with event processing for now. + // Leave the function: + break; + } + } + + // If we're interrupted, we need to interrupt the _current_ + // recursion as well to check if it is still supposed to be + // executing. This way we wind down the stack until we land + // on a recursion that again calls processEvents (typically + // from QEventLoop), and set interrupt to false: + if (d->interrupt) + interrupt(); + + if (interruptLater) + QtCocoaInterruptDispatcher::interruptLater(); + + return retVal; +} + +void QCocoaEventDispatcher::wakeUp() +{ + Q_D(QCocoaEventDispatcher); + d->serialNumber.ref(); + CFRunLoopSourceSignal(d->postedEventsSource); + CFRunLoopWakeUp(mainRunLoop()); +} + +/***************************************************************************** + QEventDispatcherMac Implementation + *****************************************************************************/ +MacTimerHash QCocoaEventDispatcherPrivate::macTimerHash; +bool QCocoaEventDispatcherPrivate::blockSendPostedEvents = false; +bool QCocoaEventDispatcherPrivate::interrupt = false; + + +QStack QCocoaEventDispatcherPrivate::cocoaModalSessionStack; +bool QCocoaEventDispatcherPrivate::currentExecIsNSAppRun = false; +bool QCocoaEventDispatcherPrivate::nsAppRunCalledByQt = false; +bool QCocoaEventDispatcherPrivate::cleanupModalSessionsNeeded = false; +NSModalSession QCocoaEventDispatcherPrivate::currentModalSessionCached = 0; + +void QCocoaEventDispatcherPrivate::ensureNSAppInitialized() +{ + // Some elements in Cocoa require NSApplication to be running before + // they get fully initialized, in particular the menu bar. This + // function is intended for cases where a dialog is told to execute before + // QGuiApplication::exec is called, or the application spins the events loop + // manually rather than calling QGuiApplication:exec. + // The function makes sure that NSApplication starts running, but stops + // it again as soon as the send posted events callback is called. That way + // we let Cocoa finish the initialization it seems to need. We'll only + // apply this trick at most once for any application, and we avoid doing it + // for the common case where main just starts QGuiApplication::exec. + if (nsAppRunCalledByQt || [NSApp isRunning]) + return; + nsAppRunCalledByQt = true; + QBoolBlocker block1(interrupt, true); + QBoolBlocker block2(currentExecIsNSAppRun, true); + [NSApp run]; +} + +void QCocoaEventDispatcherPrivate::temporarilyStopAllModalSessions() +{ + // Flush, and Stop, all created modal session, and as + // such, make them pending again. The next call to + // currentModalSession will recreate them again. The + // reason to stop all session like this is that otherwise + // a call [NSApp stop] would not stop NSApp, but rather + // the current modal session. So if we need to stop NSApp + // we need to stop all the modal session first. To avoid changing + // the stacking order of the windows while doing so, we put + // up a block that is used in QCocoaWindow and QCocoaPanel: + int stackSize = cocoaModalSessionStack.size(); + for (int i=0; itestAttribute(Qt::WA_DontShowOnScreen)) +// continue; + + if (!info.session) { + QCocoaAutoReleasePool pool; + NSWindow *window = reinterpret_cast(info.window->handle()->winId()); + if (!window) + continue; + + ensureNSAppInitialized(); + QBoolBlocker block1(blockSendPostedEvents, true); + info.nswindow = window; + [(NSWindow*) info.nswindow retain]; + int levelBeforeEnterModal = [window level]; + info.session = [NSApp beginModalSessionForWindow:window]; + // Make sure we don't stack the window lower that it was before + // entering modal, in case it e.g. had the stays-on-top flag set: + if (levelBeforeEnterModal > [window level]) + [window setLevel:levelBeforeEnterModal]; + } + currentModalSessionCached = info.session; + cleanupModalSessionsNeeded = false; + } + return currentModalSessionCached; +} + +static void setChildrenWorksWhenModal(QWindow *window, bool worksWhenModal) +{ + // For NSPanels (but not NSWindows, sadly), we can set the flag + // worksWhenModal, so that they are active even when they are not modal. +/* + ### not ported + QList dialogs = window->findChildren(); + for (int i=0; i(window) setWorksWhenModal:worksWhenModal]; + if (worksWhenModal && [window isVisible]){ + [window orderFront:window]; + } + } + } +*/ +} + +void QCocoaEventDispatcherPrivate::updateChildrenWorksWhenModal() +{ + // Make the dialog children of the window + // active. And make the dialog children of + // the previous modal dialog unactive again: + QCocoaAutoReleasePool pool; + int size = cocoaModalSessionStack.size(); + if (size > 0){ + if (QWindow *prevModal = cocoaModalSessionStack[size-1].window) + setChildrenWorksWhenModal(prevModal, true); + if (size > 1){ + if (QWindow *prevModal = cocoaModalSessionStack[size-2].window) + setChildrenWorksWhenModal(prevModal, false); + } + } +} + +void QCocoaEventDispatcherPrivate::cleanupModalSessions() +{ + // Go through the list of modal sessions, and end those + // that no longer has a window assosiated; no window means + // the the session has logically ended. The reason we wait like + // this to actually end the sessions for real (rather than at the + // point they were marked as stopped), is that ending a session + // when no other session runs below it on the stack will make cocoa + // drop some events on the floor. + QCocoaAutoReleasePool pool; + int stackSize = cocoaModalSessionStack.size(); + + for (int i=stackSize-1; i>=0; --i) { + QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; + if (info.window) { + // This session has a window, and is therefore not marked + // as stopped. So just make it current. There might still be other + // stopped sessions on the stack, but those will be stopped on + // a later "cleanup" call. + currentModalSessionCached = info.session; + break; + } + cocoaModalSessionStack.remove(i); + currentModalSessionCached = 0; + if (info.session) { + [NSApp endModalSession:info.session]; + [(NSWindow *)info.nswindow release]; + } + } + + updateChildrenWorksWhenModal(); + cleanupModalSessionsNeeded = false; +} + +void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window) +{ + // Add a new, empty (null), NSModalSession to the stack. + // It will become active the next time QEventDispatcher::processEvents is called. + // A QCocoaModalSessionInfo is considered pending to become active if the window pointer + // is non-zero, and the session pointer is zero (it will become active upon a call to + // currentModalSession). A QCocoaModalSessionInfo is considered pending to be stopped if + // the window pointer is zero, and the session pointer is non-zero (it will be fully + // stopped in cleanupModalSessions()). + QCocoaModalSessionInfo info = {window, 0, 0}; + cocoaModalSessionStack.push(info); + updateChildrenWorksWhenModal(); + currentModalSessionCached = 0; +} + +void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window) +{ + // Mark all sessions attached to window as pending to be stopped. We do this + // by setting the window pointer to zero, but leave the session pointer. + // We don't tell cocoa to stop any sessions just yet, because cocoa only understands + // when we stop the _current_ modal session (which is the session on top of + // the stack, and might not belong to 'window'). + int stackSize = cocoaModalSessionStack.size(); + for (int i=stackSize-1; i>=0; --i) { + QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; + if (info.window == window) { + info.window = 0; + if (i == stackSize-1) { + // The top sessions ended. Interrupt the event dispatcher + // to start spinning the correct session immidiatly: + currentModalSessionCached = 0; + cleanupModalSessionsNeeded = true; + QCocoaEventDispatcher::instance()->interrupt(); + } + } + } +} + +QCocoaEventDispatcherPrivate::QCocoaEventDispatcherPrivate() +{ +} + +QCocoaEventDispatcher::QCocoaEventDispatcher(QObject *parent) + : QEventDispatcherUNIX(*new QCocoaEventDispatcherPrivate, parent) +{ + Q_D(QCocoaEventDispatcher); + CFRunLoopSourceContext context; + bzero(&context, sizeof(CFRunLoopSourceContext)); + context.info = d; + context.equal = QCocoaEventDispatcherPrivate::postedEventSourceEqualCallback; + context.perform = QCocoaEventDispatcherPrivate::postedEventsSourcePerformCallback; + d->postedEventsSource = CFRunLoopSourceCreate(0, 0, &context); + Q_ASSERT(d->postedEventsSource); + CFRunLoopAddSource(mainRunLoop(), d->postedEventsSource, kCFRunLoopCommonModes); + + CFRunLoopObserverContext observerContext; + bzero(&observerContext, sizeof(CFRunLoopObserverContext)); + observerContext.info = this; + d->waitingObserver = CFRunLoopObserverCreate(kCFAllocatorDefault, + kCFRunLoopBeforeWaiting | kCFRunLoopAfterWaiting, + true, 0, + QCocoaEventDispatcherPrivate::waitingObserverCallback, + &observerContext); + CFRunLoopAddObserver(mainRunLoop(), d->waitingObserver, kCFRunLoopCommonModes); + + /* The first cycle in the loop adds the source and the events of the source + are not processed. + We use an observer to process the posted events for the first + execution of the loop. */ + CFRunLoopObserverContext firstTimeObserverContext; + bzero(&firstTimeObserverContext, sizeof(CFRunLoopObserverContext)); + firstTimeObserverContext.info = d; + d->firstTimeObserver = CFRunLoopObserverCreate(kCFAllocatorDefault, + kCFRunLoopEntry, + /* repeats = */ false, + 0, + QCocoaEventDispatcherPrivate::firstLoopEntry, + &firstTimeObserverContext); + CFRunLoopAddObserver(mainRunLoop(), d->firstTimeObserver, kCFRunLoopCommonModes); +} + +void QCocoaEventDispatcherPrivate::waitingObserverCallback(CFRunLoopObserverRef, + CFRunLoopActivity activity, void *info) +{ + if (activity == kCFRunLoopBeforeWaiting) + emit static_cast(info)->aboutToBlock(); + else + emit static_cast(info)->awake(); +} + +Boolean QCocoaEventDispatcherPrivate::postedEventSourceEqualCallback(const void *info1, const void *info2) +{ + return info1 == info2; +} + +void processPostedEvents(QCocoaEventDispatcherPrivate *const d, const bool blockSendPostedEvents) +{ + if (blockSendPostedEvents) { + // We're told to not send posted events (because the event dispatcher + // is currently working on setting up the correct session to run). But + // we still need to make sure that we don't fall asleep until pending events + // are sendt, so we just signal this need, and return: + CFRunLoopSourceSignal(d->postedEventsSource); + return; + } + + if (d->cleanupModalSessionsNeeded) + d->cleanupModalSessions(); + + if (d->interrupt) { + if (d->currentExecIsNSAppRun) { + // The event dispatcher has been interrupted. But since + // [NSApplication run] is running the event loop, we + // delayed stopping it until now (to let cocoa process + // pending cocoa events first). + if (d->currentModalSessionCached) + d->temporarilyStopAllModalSessions(); + [NSApp stop:NSApp]; + d->cancelWaitForMoreEvents(); + } + return; + } + + if (!d->threadData->canWait || (d->serialNumber != d->lastSerial)) { + d->lastSerial = d->serialNumber; + QWindowSystemInterface::sendWindowSystemEvents(d->q_func(), QEventLoop::AllEvents); + } +} + +void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref, + CFRunLoopActivity activity, + void *info) +{ + Q_UNUSED(ref); + Q_UNUSED(activity); +/* + // This function is called when NSApplication has finished initialization, + // which appears to be just after [NSApplication run] has started to execute. + // By setting up our apple events handlers this late, we override the ones + // set up by NSApplication. + + // If Qt is used as a plugin, we let the 3rd party application handle events + // like quit and open file events. Otherwise, if we install our own handlers, we + // easily end up breaking functionallity the 3rd party application depend on: + if (QGuiApplication::testAttribute(Qt::AA_MacPluginApplication)) + return; + + QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) *newDelegate = [QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate]; + NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager]; + [eventManager setEventHandler:newDelegate andSelector:@selector(appleEventQuit:withReplyEvent:) + forEventClass:kCoreEventClass andEventID:kAEQuitApplication]; + [eventManager setEventHandler:newDelegate andSelector:@selector(getUrl:withReplyEvent:) + forEventClass:kInternetEventClass andEventID:kAEGetURL]; +*/ + + processPostedEvents(static_cast(info), blockSendPostedEvents); +} + +void QCocoaEventDispatcherPrivate::postedEventsSourcePerformCallback(void *info) +{ + processPostedEvents(static_cast(info), blockSendPostedEvents); +} + +void QCocoaEventDispatcherPrivate::cancelWaitForMoreEvents() +{ + // In case the event dispatcher is waiting for more + // events somewhere, we post a dummy event to wake it up: + QCocoaAutoReleasePool pool; + [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint + modifierFlags:0 timestamp:0. windowNumber:0 context:0 + subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO]; +} + +void QCocoaEventDispatcher::interrupt() +{ + Q_D(QCocoaEventDispatcher); + d->interrupt = true; + wakeUp(); + + // We do nothing more here than setting d->interrupt = true, and + // poke the event loop if it is sleeping. Actually stopping + // NSApp, or the current modal session, is done inside the send + // posted events callback. We do this to ensure that all current pending + // cocoa events gets delivered before we stop. Otherwise, if we now stop + // the last event loop recursion, cocoa will just drop pending posted + // events on the floor before we get a chance to reestablish a new session. + d->cancelWaitForMoreEvents(); +} + +QCocoaEventDispatcher::~QCocoaEventDispatcher() +{ + Q_D(QCocoaEventDispatcher); + //timer cleanup + MacTimerHash::iterator it = QCocoaEventDispatcherPrivate::macTimerHash.begin(); + while (it != QCocoaEventDispatcherPrivate::macTimerHash.end()) { + MacTimerInfo *t = it.value(); + if (t->runLoopTimer) { + CFRunLoopTimerInvalidate(t->runLoopTimer); + CFRelease(t->runLoopTimer); + } + delete t; + ++it; + } + QCocoaEventDispatcherPrivate::macTimerHash.clear(); + + // Remove CFSockets from the runloop. + for (MacSocketHash::ConstIterator it = d->macSockets.constBegin(); it != d->macSockets.constEnd(); ++it) { + MacSocketInfo *socketInfo = (*it); + if (CFSocketIsValid(socketInfo->socket)) { + qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop); + CFRunLoopSourceInvalidate(socketInfo->runloop); + CFRelease(socketInfo->runloop); + CFSocketInvalidate(socketInfo->socket); + CFRelease(socketInfo->socket); + } + } + CFRunLoopRemoveSource(mainRunLoop(), d->postedEventsSource, kCFRunLoopCommonModes); + CFRelease(d->postedEventsSource); + + CFRunLoopObserverInvalidate(d->waitingObserver); + CFRelease(d->waitingObserver); + + CFRunLoopObserverInvalidate(d->firstTimeObserver); + CFRelease(d->firstTimeObserver); +} + +QtCocoaInterruptDispatcher* QtCocoaInterruptDispatcher::instance = 0; + +QtCocoaInterruptDispatcher::QtCocoaInterruptDispatcher() : cancelled(false) +{ + // The whole point of this class is that we enable a way to interrupt + // the event dispatcher when returning back to a lower recursion level + // than where interruptLater was called. This is needed to detect if + // [NSApp run] should still be running at the recursion level it is at. + // Since the interrupt is canceled if processEvents is called before + // this object gets deleted, we also avoid interrupting unnecessary. + deleteLater(); +} + +QtCocoaInterruptDispatcher::~QtCocoaInterruptDispatcher() +{ + if (cancelled) + return; + instance = 0; + QCocoaEventDispatcher::instance()->interrupt(); +} + +void QtCocoaInterruptDispatcher::cancelInterruptLater() +{ + if (!instance) + return; + instance->cancelled = true; + delete instance; + instance = 0; +} + +void QtCocoaInterruptDispatcher::interruptLater() +{ + cancelInterruptLater(); + instance = new QtCocoaInterruptDispatcher; +} + +QT_END_NAMESPACE + diff --git a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm deleted file mode 100644 index ac0b75e9ea2..00000000000 --- a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcocoaeventloopintegration.h" - -#import - -#include "qcocoaautoreleasepool.h" - -#include - -#include -#include - -void wakeupCallback ( void * ) { - QPlatformEventLoopIntegration::processEvents(); -} - -void timerCallback( CFRunLoopTimerRef timer, void *info) -{ - QPlatformEventLoopIntegration::processEvents(); - QCocoaEventLoopIntegration *eventLoopIntegration = - static_cast(info); - qint64 nextTime = eventLoopIntegration->nextTimerEvent(); - CFAbsoluteTime nexttime = CFAbsoluteTimeGetCurrent(); - nexttime = nexttime + (double(nextTime)/1000); - CFRunLoopTimerSetNextFireDate(timer,nexttime); -} - -QCocoaEventLoopIntegration::QCocoaEventLoopIntegration() : - QPlatformEventLoopIntegration() -{ - [NSApplication sharedApplication]; - m_sourceContext.version = 0; - m_sourceContext.info = this; - m_sourceContext.retain = 0; - m_sourceContext.release = 0; - m_sourceContext.copyDescription = 0; - m_sourceContext.equal = 0; - m_sourceContext.hash = 0; - m_sourceContext.schedule = 0; - m_sourceContext.cancel = 0; - m_sourceContext.perform = wakeupCallback; - - m_source = CFRunLoopSourceCreate(0,0,&m_sourceContext); - CFRunLoopAddSource(CFRunLoopGetMain(),m_source,kCFRunLoopCommonModes); - - m_timerContext.version = 0; - m_timerContext.info = this; - m_timerContext.retain = 0; - m_timerContext.release = 0; - m_timerContext.copyDescription = 0; - CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent (); - CFTimeInterval interval = 30; - - CFRunLoopTimerRef m_timerSource = CFRunLoopTimerCreate(0,fireDate,interval,0,0,timerCallback,&m_timerContext); - CFRunLoopAddTimer(CFRunLoopGetMain(),m_timerSource,kCFRunLoopCommonModes); -} - -void QCocoaEventLoopIntegration::startEventLoop() -{ - [[NSApplication sharedApplication] run]; -} - -void QCocoaEventLoopIntegration::quitEventLoop() -{ - [[NSApplication sharedApplication] terminate:nil]; -} - -void QCocoaEventLoopIntegration::qtNeedsToProcessEvents() -{ - CFRunLoopSourceSignal(m_source); -} - diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h new file mode 100644 index 00000000000..1b84e7b3054 --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -0,0 +1,43 @@ +#ifndef QCOCOAGLCONTEXT_H +#define QCOCOAGLCONTEXT_H + +#include +#include +#include +#include + +#undef slots +#include + +QT_BEGIN_NAMESPACE + +class QCocoaGLContext : public QPlatformOpenGLContext +{ +public: + QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share); + + QSurfaceFormat format() const; + + void swapBuffers(QPlatformSurface *surface); + + bool makeCurrent(QPlatformSurface *surface); + void doneCurrent(); + + void (*getProcAddress(const QByteArray &procName)) (); + + void update(); + + static NSOpenGLPixelFormat *createNSOpenGLPixelFormat(); + NSOpenGLContext *nsOpenGLContext() const; + +private: + void setActiveWindow(QWindow *window); + + NSOpenGLContext *m_context; + QSurfaceFormat m_format; + QWeakPointer m_currentWindow; +}; + +QT_END_NAMESPACE + +#endif // QCOCOAGLCONTEXT_H diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm new file mode 100644 index 00000000000..8b07315378a --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -0,0 +1,99 @@ +#include "qcocoaglcontext.h" +#include "qcocoawindow.h" +#include "qcocoaautoreleasepool.h" +#include +#include +#include + +#import + +QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share) + : m_format(format) +{ + QCocoaAutoReleasePool pool; // For the SG Canvas render thread. + + NSOpenGLPixelFormat *pixelFormat = static_cast (qcgl_createNSOpenGLPixelFormat()); + NSOpenGLContext *actualShare = share ? static_cast(share)->m_context : 0; + + m_context = [NSOpenGLContext alloc]; + [m_context initWithFormat:pixelFormat shareContext:actualShare]; + + const GLint interval = 1; + [m_context setValues:&interval forParameter:NSOpenGLCPSwapInterval]; + +} + +// Match up with createNSOpenGLPixelFormat! +QSurfaceFormat QCocoaGLContext::format() const +{ + return m_format; +} + +void QCocoaGLContext::swapBuffers(QPlatformSurface *surface) +{ + QWindow *window = static_cast(surface)->window(); + setActiveWindow(window); + + [m_context flushBuffer]; +} + +bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface) +{ + QCocoaAutoReleasePool pool; + + QWindow *window = static_cast(surface)->window(); + setActiveWindow(window); + + [m_context makeCurrentContext]; + return true; +} + +void QCocoaGLContext::setActiveWindow(QWindow *window) +{ + if (window == m_currentWindow.data()) + return; + + if (m_currentWindow) + static_cast(m_currentWindow.data()->handle())->setCurrentContext(0); + + Q_ASSERT(window->handle()); + + m_currentWindow = window; + + QCocoaWindow *cocoaWindow = static_cast(window->handle()); + cocoaWindow->setCurrentContext(this); + + NSView *view = cocoaWindow->contentView(); + [m_context setView:view]; +} + +void QCocoaGLContext::doneCurrent() +{ + if (m_currentWindow) + static_cast(m_currentWindow.data()->handle())->setCurrentContext(0); + + m_currentWindow.clear(); + + [NSOpenGLContext clearCurrentContext]; +} + +void (*QCocoaGLContext::getProcAddress(const QByteArray &procName))() +{ + return qcgl_getProcAddress(procName); +} + +void QCocoaGLContext::update() +{ + [m_context update]; +} + +NSOpenGLPixelFormat *QCocoaGLContext::createNSOpenGLPixelFormat() +{ + return static_cast(qcgl_createNSOpenGLPixelFormat()); +} + +NSOpenGLContext *QCocoaGLContext::nsOpenGLContext() const +{ + return m_context; +} + diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h new file mode 100644 index 00000000000..8e807cc2888 --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -0,0 +1,90 @@ +/**************************************************************************** + ** + ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (qt-info@nokia.com) + ** + ** This file is part of the plugins of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** GNU Lesser General Public License Usage + ** This file may be used under the terms of the GNU Lesser General Public + ** License version 2.1 as published by the Free Software Foundation and + ** appearing in the file LICENSE.LGPL included in the packaging of this + ** file. Please review the following information to ensure the GNU Lesser + ** General Public License version 2.1 requirements will be met: + ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Nokia gives you certain additional + ** rights. These rights are described in the Nokia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU General + ** Public License version 3.0 as published by the Free Software Foundation + ** and appearing in the file LICENSE.GPL included in the packaging of this + ** file. Please review the following information to ensure the GNU General + ** Public License version 3.0 requirements will be met: + ** http://www.gnu.org/copyleft/gpl.html. + ** + ** Other Usage + ** Alternatively, this file may be used in accordance with the terms and + ** conditions contained in a signed written agreement between you and Nokia. + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#ifndef QCOCOAHELPERS_H +#define QCOCOAHELPERS_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It provides helper functions +// for the Cocoa lighthouse plugin. This header file may +// change from version to version without notice, or even be removed. +// +// We mean it. +// + +#include + +class QPixmap; +class QString; + +// Conversion functions +QStringList qt_mac_NSArrayToQStringList(void *nsarray); +void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list); + +inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist) +{ return reinterpret_cast(qt_mac_QStringListToNSMutableArrayVoid(qstrlist)); } + +inline QString qt_mac_NSStringToQString(const NSString *nsstr) +{ return QCFString::toQString(reinterpret_cast(nsstr)); } + +inline NSString *qt_mac_QStringToNSString(const QString &qstr) +{ return [const_cast(reinterpret_cast(QCFString::toCFStringRef(qstr))) autorelease]; } + +CGImageRef qt_mac_image_to_cgimage(const QImage &image); +NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge); +NSImage *qt_mac_create_nsimage(const QPixmap &pm); + +QChar qt_mac_qtKey2CocoaKey(Qt::Key key); +Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode); + +// Misc +void qt_mac_transformProccessToForegroundApplication(); +QString qt_mac_removeMnemonics(const QString &original); +CGColorSpaceRef qt_mac_genericColorSpace(); +CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget); +QString qt_mac_applicationName(); + + +#endif //QCOCOAHELPERS_H + diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm new file mode 100644 index 00000000000..03e83f1130c --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -0,0 +1,448 @@ +/**************************************************************************** + ** + ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (qt-info@nokia.com) + ** + ** This file is part of the plugins of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** GNU Lesser General Public License Usage + ** This file may be used under the terms of the GNU Lesser General Public + ** License version 2.1 as published by the Free Software Foundation and + ** appearing in the file LICENSE.LGPL included in the packaging of this + ** file. Please review the following information to ensure the GNU Lesser + ** General Public License version 2.1 requirements will be met: + ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Nokia gives you certain additional + ** rights. These rights are described in the Nokia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU General + ** Public License version 3.0 as published by the Free Software Foundation + ** and appearing in the file LICENSE.GPL included in the packaging of this + ** file. Please review the following information to ensure the GNU General + ** Public License version 3.0 requirements will be met: + ** http://www.gnu.org/copyleft/gpl.html. + ** + ** Other Usage + ** Alternatively, this file may be used in accordance with the terms and + ** conditions contained in a signed written agreement between you and Nokia. + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#include "qcocoahelpers.h" + +#include "qcocoaautoreleasepool.h" + +#include +#include + +// +// Conversion Functions +// + +QStringList qt_mac_NSArrayToQStringList(void *nsarray) +{ + QStringList result; + NSArray *array = static_cast(nsarray); + for (NSUInteger i=0; i<[array count]; ++i) + result << qt_mac_NSStringToQString([array objectAtIndex:i]); + return result; +} + +void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list) +{ + NSMutableArray *result = [NSMutableArray arrayWithCapacity:list.size()]; + for (int i=0; i(QCFString::toCFStringRef(list[i]))]; + } + return result; +} + +static void drawImageReleaseData (void *info, const void *, size_t) +{ + delete static_cast(info); +} + +CGImageRef qt_mac_image_to_cgimage(const QImage &img) +{ + QImage *image; + if (img.depth() != 32) + image = new QImage(img.convertToFormat(QImage::Format_ARGB32_Premultiplied)); + else + image = new QImage(img); + + uint cgflags = kCGImageAlphaNone; + switch (image->format()) { + case QImage::Format_ARGB32_Premultiplied: + cgflags = kCGImageAlphaPremultipliedFirst; + break; + case QImage::Format_ARGB32: + cgflags = kCGImageAlphaFirst; + break; + case QImage::Format_RGB32: + cgflags = kCGImageAlphaNoneSkipFirst; + default: + break; + } + cgflags |= kCGBitmapByteOrder32Host; + QCFType dataProvider = CGDataProviderCreateWithData(image, + static_cast(image)->bits(), + image->byteCount(), + drawImageReleaseData); + + return CGImageCreate(image->width(), image->height(), 8, 32, + image->bytesPerLine(), + qt_mac_genericColorSpace(), + cgflags, dataProvider, 0, false, kCGRenderingIntentDefault); + +} + +NSImage *qt_mac_cgimage_to_nsimage(CGImageRef image) +{ + QCocoaAutoReleasePool pool; + NSImage *newImage = 0; + NSRect imageRect = NSMakeRect(0.0, 0.0, CGImageGetWidth(image), CGImageGetHeight(image)); + newImage = [[NSImage alloc] initWithSize:imageRect.size]; + [newImage lockFocus]; + { + CGContextRef imageContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; + CGContextDrawImage(imageContext, *(CGRect*)&imageRect, image); + } + [newImage unlockFocus]; + return newImage; +} + +NSImage *qt_mac_create_nsimage(const QPixmap &pm) +{ + QImage image = pm.toImage(); + return qt_mac_cgimage_to_nsimage(qt_mac_image_to_cgimage(image)); +} + + +// Use this method to keep all the information in the TextSegment. As long as it is ordered +// we are in OK shape, and we can influence that ourselves. +struct KeyPair +{ + QChar cocoaKey; + Qt::Key qtKey; +}; + +bool operator==(const KeyPair &entry, QChar qchar) +{ + return entry.cocoaKey == qchar; +} + +bool operator<(const KeyPair &entry, QChar qchar) +{ + return entry.cocoaKey < qchar; +} + +bool operator<(QChar qchar, const KeyPair &entry) +{ + return qchar < entry.cocoaKey; +} + +bool operator<(const Qt::Key &key, const KeyPair &entry) +{ + return key < entry.qtKey; +} + +bool operator<(const KeyPair &entry, const Qt::Key &key) +{ + return entry.qtKey < key; +} + +static bool qtKey2CocoaKeySortLessThan(const KeyPair &entry1, const KeyPair &entry2) +{ + return entry1.qtKey < entry2.qtKey; +} + +static const int NumEntries = 59; +static const KeyPair entries[NumEntries] = { + { NSEnterCharacter, Qt::Key_Enter }, + { NSBackspaceCharacter, Qt::Key_Backspace }, + { NSTabCharacter, Qt::Key_Tab }, + { NSNewlineCharacter, Qt::Key_Return }, + { NSCarriageReturnCharacter, Qt::Key_Return }, + { NSBackTabCharacter, Qt::Key_Backtab }, + { kEscapeCharCode, Qt::Key_Escape }, + // Cocoa sends us delete when pressing backspace! + // (NB when we reverse this list in qtKey2CocoaKey, there + // will be two indices of Qt::Key_Backspace. But is seems to work + // ok for menu shortcuts (which uses that function): + { NSDeleteCharacter, Qt::Key_Backspace }, + { NSUpArrowFunctionKey, Qt::Key_Up }, + { NSDownArrowFunctionKey, Qt::Key_Down }, + { NSLeftArrowFunctionKey, Qt::Key_Left }, + { NSRightArrowFunctionKey, Qt::Key_Right }, + { NSF1FunctionKey, Qt::Key_F1 }, + { NSF2FunctionKey, Qt::Key_F2 }, + { NSF3FunctionKey, Qt::Key_F3 }, + { NSF4FunctionKey, Qt::Key_F4 }, + { NSF5FunctionKey, Qt::Key_F5 }, + { NSF6FunctionKey, Qt::Key_F6 }, + { NSF7FunctionKey, Qt::Key_F7 }, + { NSF8FunctionKey, Qt::Key_F8 }, + { NSF9FunctionKey, Qt::Key_F8 }, + { NSF10FunctionKey, Qt::Key_F10 }, + { NSF11FunctionKey, Qt::Key_F11 }, + { NSF12FunctionKey, Qt::Key_F12 }, + { NSF13FunctionKey, Qt::Key_F13 }, + { NSF14FunctionKey, Qt::Key_F14 }, + { NSF15FunctionKey, Qt::Key_F15 }, + { NSF16FunctionKey, Qt::Key_F16 }, + { NSF17FunctionKey, Qt::Key_F17 }, + { NSF18FunctionKey, Qt::Key_F18 }, + { NSF19FunctionKey, Qt::Key_F19 }, + { NSF20FunctionKey, Qt::Key_F20 }, + { NSF21FunctionKey, Qt::Key_F21 }, + { NSF22FunctionKey, Qt::Key_F22 }, + { NSF23FunctionKey, Qt::Key_F23 }, + { NSF24FunctionKey, Qt::Key_F24 }, + { NSF25FunctionKey, Qt::Key_F25 }, + { NSF26FunctionKey, Qt::Key_F26 }, + { NSF27FunctionKey, Qt::Key_F27 }, + { NSF28FunctionKey, Qt::Key_F28 }, + { NSF29FunctionKey, Qt::Key_F29 }, + { NSF30FunctionKey, Qt::Key_F30 }, + { NSF31FunctionKey, Qt::Key_F31 }, + { NSF32FunctionKey, Qt::Key_F32 }, + { NSF33FunctionKey, Qt::Key_F33 }, + { NSF34FunctionKey, Qt::Key_F34 }, + { NSF35FunctionKey, Qt::Key_F35 }, + { NSInsertFunctionKey, Qt::Key_Insert }, + { NSDeleteFunctionKey, Qt::Key_Delete }, + { NSHomeFunctionKey, Qt::Key_Home }, + { NSEndFunctionKey, Qt::Key_End }, + { NSPageUpFunctionKey, Qt::Key_PageUp }, + { NSPageDownFunctionKey, Qt::Key_PageDown }, + { NSPrintScreenFunctionKey, Qt::Key_Print }, + { NSScrollLockFunctionKey, Qt::Key_ScrollLock }, + { NSPauseFunctionKey, Qt::Key_Pause }, + { NSSysReqFunctionKey, Qt::Key_SysReq }, + { NSMenuFunctionKey, Qt::Key_Menu }, + { NSHelpFunctionKey, Qt::Key_Help }, +}; +static const KeyPair * const end = entries + NumEntries; + +QChar qt_mac_qtKey2CocoaKey(Qt::Key key) +{ + // The first time this function is called, create a reverse + // looup table sorted on Qt Key rather than Cocoa key: + static QVector rev_entries(NumEntries); + static bool mustInit = true; + if (mustInit){ + mustInit = false; + for (int i=0; i::iterator i + = qBinaryFind(rev_entries.begin(), rev_entries.end(), key); + if (i == rev_entries.end()) + return QChar(); + return i->cocoaKey; +} + +Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode) +{ + const KeyPair *i = qBinaryFind(entries, end, keyCode); + if (i == end) + return Qt::Key(keyCode.unicode()); + return i->qtKey; +} + +// +// Misc +// + +// Changes the process type for this process to kProcessTransformToForegroundApplication, +// unless either LSUIElement or LSBackgroundOnly is set in the Info.plist. +void qt_mac_transformProccessToForegroundApplication() +{ + ProcessSerialNumber psn; + if (GetCurrentProcess(&psn) == noErr) { + bool forceTransform = true; + CFTypeRef value = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), + CFSTR("LSUIElement")); + if (value) { + CFTypeID valueType = CFGetTypeID(value); + // Officially it's supposed to be a string, a boolean makes sense, so we'll check. + // A number less so, but OK. + if (valueType == CFStringGetTypeID()) + forceTransform = !(QCFString::toQString(static_cast(value)).toInt()); + else if (valueType == CFBooleanGetTypeID()) + forceTransform = !CFBooleanGetValue(static_cast(value)); + else if (valueType == CFNumberGetTypeID()) { + int valueAsInt; + CFNumberGetValue(static_cast(value), kCFNumberIntType, &valueAsInt); + forceTransform = !valueAsInt; + } + } + + if (forceTransform) { + value = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), + CFSTR("LSBackgroundOnly")); + if (value) { + CFTypeID valueType = CFGetTypeID(value); + if (valueType == CFBooleanGetTypeID()) + forceTransform = !CFBooleanGetValue(static_cast(value)); + else if (valueType == CFStringGetTypeID()) + forceTransform = !(QCFString::toQString(static_cast(value)).toInt()); + else if (valueType == CFNumberGetTypeID()) { + int valueAsInt; + CFNumberGetValue(static_cast(value), kCFNumberIntType, &valueAsInt); + forceTransform = !valueAsInt; + } + } + } + + if (forceTransform) { + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + } + } +} + +QString qt_mac_removeMnemonics(const QString &original) +{ + QString returnText(original.size(), 0); + int finalDest = 0; + int currPos = 0; + int l = original.length(); + while (l) { + if (original.at(currPos) == QLatin1Char('&') + && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) { + ++currPos; + --l; + if (l == 0) + break; + } + returnText[finalDest] = original.at(currPos); + ++currPos; + ++finalDest; + --l; + } + returnText.truncate(finalDest); + return returnText; +} + + +CGColorSpaceRef m_genericColorSpace = 0; +QHash m_displayColorSpaceHash; +bool m_postRoutineRegistered = false; + +CGColorSpaceRef qt_mac_genericColorSpace() +{ +#if 0 + if (!m_genericColorSpace) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { + m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); + } else +#endif + { + m_genericColorSpace = CGColorSpaceCreateDeviceRGB(); + } + if (!m_postRoutineRegistered) { + m_postRoutineRegistered = true; + qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces); + } + } + return m_genericColorSpace; +#else + // Just return the main display colorspace for the moment. + return qt_mac_displayColorSpace(0); +#endif +} + +/* + Ideally, we should pass the widget in here, and use CGGetDisplaysWithRect() etc. + to support multiple displays correctly. +*/ +CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget) +{ + CGColorSpaceRef colorSpace; + + CGDirectDisplayID displayID; + CMProfileRef displayProfile = 0; + if (widget == 0) { + displayID = CGMainDisplayID(); + } else { + displayID = CGMainDisplayID(); + /* + ### get correct display + const QRect &qrect = widget->window()->geometry(); + CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height()); + CGDisplayCount throwAway; + CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway); + if (dErr != kCGErrorSuccess) + return macDisplayColorSpace(0); // fall back on main display + */ + } + if ((colorSpace = m_displayColorSpaceHash.value(displayID))) + return colorSpace; + + CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile); + if (err == noErr) { + colorSpace = CGColorSpaceCreateWithPlatformColorSpace(displayProfile); + } else if (widget) { + return qt_mac_displayColorSpace(0); // fall back on main display + } + + if (colorSpace == 0) + colorSpace = CGColorSpaceCreateDeviceRGB(); + + m_displayColorSpaceHash.insert(displayID, colorSpace); + CMCloseProfile(displayProfile); + if (!m_postRoutineRegistered) { + m_postRoutineRegistered = true; + void qt_mac_cleanUpMacColorSpaces(); + qAddPostRoutine(qt_mac_cleanUpMacColorSpaces); + } + return colorSpace; +} + +void qt_mac_cleanUpMacColorSpaces() +{ + if (m_genericColorSpace) { + CFRelease(m_genericColorSpace); + m_genericColorSpace = 0; + } + QHash::const_iterator it = m_displayColorSpaceHash.constBegin(); + while (it != m_displayColorSpaceHash.constEnd()) { + if (it.value()) + CFRelease(it.value()); + ++it; + } + m_displayColorSpaceHash.clear(); +} + +QString qt_mac_applicationName() +{ + QString appName; + CFTypeRef string = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), CFSTR("CFBundleName")); + if (string) + appName = QCFString::toQString(static_cast(string)); + + if (appName.isEmpty()) { + QString arg0 = qApp->arguments().at(0); + if (arg0.contains("/")) { + QStringList parts = arg0.split("/"); + appName = parts.at(parts.count() - 1); + } else { + appName = arg0; + } + } + return appName; +} + diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index 120bee46b79..a253a6bea3a 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -76,19 +76,19 @@ public: ~QCocoaIntegration(); bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - - QList screens() const { return mScreens; } + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const; + QAbstractEventDispatcher *guiThreadEventDispatcher() const; QPlatformFontDatabase *fontDatabase() const; + QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const; + QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const; - QPlatformEventLoopIntegration *createEventLoopIntegration() const; - + QPlatformNativeInterface *nativeInterface() const; private: - QList mScreens; QPlatformFontDatabase *mFontDb; + QAbstractEventDispatcher *mEventDispatcher; QCocoaAutoReleasePool *mPool; }; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 086f7b62e97..e3e204226f9 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -42,14 +42,18 @@ #include "qcocoaintegration.h" #include "qcocoawindow.h" -#include "qcocoawindowsurface.h" -#include "qcocoaeventloopintegration.h" +#include "qcocoabackingstore.h" +#include "qcocoanativeinterface.h" +#include "qcocoamenuloader.h" +#include "qcocoaeventdispatcher.h" +#include "qcocoahelpers.h" +#include "qcocoaapplication.h" +#include "qcocoaapplicationdelegate.h" +#include "qmenu_mac.h" -#include "qcoretextfontdatabase.h" +#include -#include - -#include +#include QT_BEGIN_NAMESPACE @@ -74,18 +78,47 @@ QCocoaScreen::~QCocoaScreen() } QCocoaIntegration::QCocoaIntegration() - : mFontDb(new QCoreTextFontDatabase()) + : mFontDb(new QBasicUnixFontDatabase()) + , mEventDispatcher(new QCocoaEventDispatcher()) { mPool = new QCocoaAutoReleasePool; - //Make sure we have a nsapplication :) - [NSApplication sharedApplication]; -// [[OurApplication alloc] init]; + QNSApplication *cocoaApplication = [QNSApplication sharedApplication]; + + // Applications launched from plain executables (without an app + // bundle) are "background" applications that does not take keybaord + // focus or have a dock icon or task switcher entry. Qt Gui apps generally + // wants to be foreground applications so change the process type. (But + // see the function implementation for exceptions.) + qt_mac_transformProccessToForegroundApplication(); + + // Move the application window to front to avoid launching behind the terminal. + // Ignoring other apps is neccessary (we must ignore the terminal), but makes + // Qt apps play slightly less nice with other apps when lanching from Finder + // (See the activateIgnoringOtherApps docs.) + [cocoaApplication activateIgnoringOtherApps : YES]; + + // ### For AA_MacPluginApplication we don't want to load the menu nib. + // Qt 4 also does not set the application delegate, so that behavior + // is matched here. + if (!QCoreApplication::testAttribute(Qt::AA_MacPluginApplication)) { + + // Set app delegate, link to the current delegate (if any) + QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) *newDelegate = [QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate]; + [newDelegate setReflectionDelegate:[cocoaApplication delegate]]; + [cocoaApplication setDelegate:newDelegate]; + + // Load the application menu. This menu contains Preferences, Hide, Quit. + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader = [[QT_MANGLE_NAMESPACE(QCocoaMenuLoader) alloc] init]; + qt_mac_loadMenuNib(qtMenuLoader); + [cocoaApplication setMenu:[qtMenuLoader menu]]; + [newDelegate setMenuLoader:qtMenuLoader]; + } NSArray *screens = [NSScreen screens]; for (uint i = 0; i < [screens count]; i++) { QCocoaScreen *screen = new QCocoaScreen(i); - mScreens.append(screen); + screenAdded(screen); } } @@ -98,26 +131,32 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons { switch (cap) { case ThreadedPixmaps: return true; + case OpenGL : return true; + case ThreadedOpenGL : return true; default: return QPlatformIntegration::hasCapability(cap); } } -QPixmapData *QCocoaIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformWindow *QCocoaIntegration::createPlatformWindow(QWindow *window) const { - return new QRasterPixmapData(type); + return new QCocoaWindow(window); } -QPlatformWindow *QCocoaIntegration::createPlatformWindow(QWidget *widget, WId winId) const +QPlatformOpenGLContext *QCocoaIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { - Q_UNUSED(winId); - return new QCocoaWindow(widget); + return new QCocoaGLContext(context->format(), context->shareHandle()); } -QWindowSurface *QCocoaIntegration::createWindowSurface(QWidget *widget, WId winId) const +QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *window) const { - return new QCocoaWindowSurface(widget,winId); + return new QCocoaBackingStore(window); +} + +QAbstractEventDispatcher *QCocoaIntegration::guiThreadEventDispatcher() const +{ + return mEventDispatcher; } QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const @@ -125,8 +164,21 @@ QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const return mFontDb; } -QPlatformEventLoopIntegration *QCocoaIntegration::createEventLoopIntegration() const +QPlatformMenu *QCocoaIntegration::createPlatformMenu(QMenu *menu) const { - return new QCocoaEventLoopIntegration(); + // return new QCocoaMenu(menu); + return 0; } + +QPlatformMenuBar *QCocoaIntegration::createPlatformMenuBar(QMenuBar *menuBar) const +{ + //return new QCocoaMenuBar(menuBar); + return 0; +} + +QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const +{ + return new QCocoaNativeInterface(); +} + QT_END_NAMESPACE diff --git a/src/gui/widgets/qcocoamenu_mac_p.h b/src/plugins/platforms/cocoa/qcocoamenu.h similarity index 96% rename from src/gui/widgets/qcocoamenu_mac_p.h rename to src/plugins/platforms/cocoa/qcocoamenu.h index 6160a2656f2..4e8ce20580f 100644 --- a/src/gui/widgets/qcocoamenu_mac_p.h +++ b/src/plugins/platforms/cocoa/qcocoamenu.h @@ -51,7 +51,6 @@ // #include "qmacdefines_mac.h" -#ifdef QT_MAC_USE_COCOA #import QT_FORWARD_DECLARE_CLASS(QMenu) @@ -69,7 +68,7 @@ QT_FORWARD_DECLARE_CLASS(QAction) #endif -@interface QT_MANGLE_NAMESPACE(QCocoaMenu) : NSMenu +@interface QT_MANGLE_NAMESPACE(QNativeCocoaMenu) : NSMenu { QMenu *qmenu; QAction *previousAction; @@ -78,5 +77,4 @@ QT_FORWARD_DECLARE_CLASS(QAction) - (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action; - (NSInteger)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector; @end -#endif diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm similarity index 82% rename from src/gui/widgets/qcocoamenu_mac.mm rename to src/plugins/platforms/cocoa/qcocoamenu.mm index 95075b95d17..1bb5f45a94d 100644 --- a/src/gui/widgets/qcocoamenu_mac.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -39,18 +39,14 @@ ** ****************************************************************************/ -#include "qmacdefines_mac.h" #include "qapplication.h" -#ifdef QT_MAC_USE_COCOA -#import -#import -#import -#include +#include "qvarlengtharray.h" +#import "qcocoamenu.h" +#import "qcocoamenuloader.h" +#import "qcocoaapplication.h" +#include "qcocoahelpers.h" #include #include -#include - -#include QT_FORWARD_DECLARE_CLASS(QAction) QT_FORWARD_DECLARE_CLASS(QWidget) @@ -61,13 +57,15 @@ QT_FORWARD_DECLARE_CLASS(QKeyEvent) QT_FORWARD_DECLARE_CLASS(QEvent) QT_BEGIN_NAMESPACE -extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); //qapplication.cpp -extern NSString *qt_mac_removePrivateUnicode(NSString* string); +extern void qt_mac_menu_collapseSeparators(NSMenu *menu, bool collapse); +void qt_mac_clear_status_text(QAction *action); +extern void qt_mac_emit_menuSignals(QMenu *menu, bool show); +extern void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action); QT_END_NAMESPACE QT_USE_NAMESPACE -@implementation QT_MANGLE_NAMESPACE(QCocoaMenu) +@implementation QT_MANGLE_NAMESPACE(QNativeCocoaMenu) - (id)initWithQMenu:(QMenu*)menu { @@ -94,7 +92,7 @@ QT_USE_NAMESPACE } if (QAction *action = reinterpret_cast([item tag])) { - QMenu *qtmenu = static_cast(menu)->qmenu; + QMenu *qtmenu = static_cast(menu)->qmenu; previousAction = action; action->activate(QAction::Hover); qt_mac_menu_emit_hovered(qtmenu, action); @@ -107,14 +105,14 @@ QT_USE_NAMESPACE while (QWidget *popup = QApplication::activePopupWidget()) popup->close(); - QMenu *qtmenu = static_cast(menu)->qmenu; + QMenu *qtmenu = static_cast(menu)->qmenu; qt_mac_emit_menuSignals(qtmenu, true); qt_mac_menu_collapseSeparators(menu, qtmenu->separatorsCollapsible()); } - (void)menuDidClose:(NSMenu*)menu { - qt_mac_emit_menuSignals(((QT_MANGLE_NAMESPACE(QCocoaMenu) *)menu)->qmenu, false); + qt_mac_emit_menuSignals(((QT_MANGLE_NAMESPACE(QNativeCocoaMenu) *)menu)->qmenu, false); if (previousAction) { qt_mac_clear_status_text(previousAction); previousAction = 0; @@ -149,6 +147,27 @@ QT_USE_NAMESPACE return NO; } +NSString *qt_mac_removePrivateUnicode(NSString* string) +{ + int len = [string length]; + if (len) { + QVarLengthArray characters(len); + bool changed = false; + for (int i = 0; i +#include @interface QT_MANGLE_NAMESPACE(QCocoaMenuLoader) : NSResponder { @@ -91,5 +90,6 @@ - (void)orderFrontCharacterPalette:(id)sender; @end -#endif // QT_MAC_USE_COCOA +void qt_mac_loadMenuNib(QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader); + #endif // QCOCOAMENULOADER_P_H diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm similarity index 75% rename from src/gui/kernel/qcocoamenuloader_mac.mm rename to src/plugins/platforms/cocoa/qcocoamenuloader.mm index da11c3a1c67..353808655fb 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -39,16 +39,16 @@ ** ****************************************************************************/ -#include "qmacdefines_mac.h" -#ifdef QT_MAC_USE_COCOA -#include -#include -#include -#include -#include -#include -#include -#include +#include "qcocoamenuloader.h" + +#include "qmenu_mac.h" +#include "qcocoahelpers.h" + +#include +#include +#include +#include +#include QT_FORWARD_DECLARE_CLASS(QCFString) QT_FORWARD_DECLARE_CLASS(QString) @@ -61,6 +61,53 @@ QT_FORWARD_DECLARE_CLASS(QString) QT_USE_NAMESPACE +/* + Loads and instantiates the main app menu from the menu nib file(s). + + The main app menu contains the Quit, Hide About, Preferences entries, and + The reason for having the nib file is that those can not be created + programmatically. To ease deployment the nib files are stored in Qt resources + and written to QDir::temp() before loading. (Earlier Qt versions used + to require having the nib file in the QtGui framework.) +*/ +void qt_mac_loadMenuNib(QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader) +{ + // Create qt_menu.nib dir in temp. + QDir temp = QDir::temp(); + temp.mkdir("qt_menu.nib"); + QString nibDir = temp.canonicalPath() + QLatin1String("/") + QLatin1String("qt_menu.nib/"); + if (!QDir(nibDir).exists()) { + qWarning("qt_mac_loadMenuNib: could not create nib directory in temp"); + return; + } + + // Copy nib files from resources to temp. + QDir nibResource(":/trolltech/mac/qt_menu.nib/"); + if (!nibResource.exists()) { + qWarning("qt_mac_loadMenuNib: could not load nib from resources"); + return; + } + foreach (const QFileInfo &file, nibResource.entryInfoList()) { + QFile::copy(file.absoluteFilePath(), nibDir + QLatin1String("/") + file.fileName()); + } + + // Load and instantiate nib file from temp + NSURL *nibUrl = [NSURL fileURLWithPath : const_cast(reinterpret_cast(QCFString::toCFStringRef(nibDir)))]; + [nibUrl autorelease]; + NSNib *nib = [[NSNib alloc] initWithContentsOfURL : nibUrl]; + [nib autorelease]; + if(!nib) { + qWarning("qt_mac_loadMenuNib: could not load nib from temp"); + return; + } + bool ok = [nib instantiateNibWithOwner : qtMenuLoader topLevelObjects : nil]; + if (!ok) { + qWarning("qt_mac_loadMenuNib: could not instantiate nib"); + } +} + + + @implementation QT_MANGLE_NAMESPACE(QCocoaMenuLoader) - (void)awakeFromNib @@ -70,7 +117,7 @@ QT_USE_NAMESPACE showAllItem = [[appMenu itemWithTitle:@"Show All"] retain]; // Get the names in the nib to match the app name set by Qt. - const NSString *appName = reinterpret_cast(QCFString::toCFStringRef(qAppName())); + const NSString *appName = reinterpret_cast(QCFString::toCFStringRef(qt_mac_applicationName())); [quitItem setTitle:[[quitItem title] stringByReplacingOccurrencesOfString:@"NewApplication" withString:const_cast(appName)]]; [hideItem setTitle:[[hideItem title] stringByReplacingOccurrencesOfString:@"NewApplication" @@ -226,25 +273,29 @@ QT_USE_NAMESPACE - (void)qtUpdateMenubar { - QMenuBarPrivate::macUpdateMenuBarImmediatly(); + QCocoaMenuBar::macUpdateMenuBarImmediatly(); } - (void)qtTranslateApplicationMenu { + + qDebug() << "qtTranslateApplicationMenu"; + #ifndef QT_NO_TRANSLATION [servicesItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(0))]; - [hideItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(1).arg(qAppName()))]; + [hideItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(1).arg(qt_mac_applicationName()))]; [hideAllOthersItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(2))]; [showAllItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(3))]; [preferencesItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(4))]; - [quitItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(5).arg(qAppName()))]; - [aboutItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(6).arg(qAppName()))]; + [quitItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(5).arg(qt_mac_applicationName()))]; + [aboutItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName()))]; #endif } - (IBAction)qtDispatcherToQAction:(id)sender { - QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData); + // + //QScopedLoopLevelCounter loopLevelCounter(QApplicationPrivate::instance()->threadData); NSMenuItem *item = static_cast(sender); if (QAction *action = reinterpret_cast([item tag])) { action->trigger(); @@ -261,4 +312,3 @@ QT_USE_NAMESPACE [NSApp orderFrontCharacterPalette:sender]; } @end -#endif // QT_MAC_USE_COCOA diff --git a/src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h similarity index 85% rename from src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.h rename to src/plugins/platforms/cocoa/qcocoanativeinterface.h index 10fa61c9727..f8216d8e616 100644 --- a/src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.h +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h @@ -39,17 +39,17 @@ ** ****************************************************************************/ -#ifndef MRASTERPIXMAPDATA_H -#define MRASTERPIXMAPDATA_H +#ifndef QCOCOANATIVEINTERFACE_H +#define QCOCOANATIVEINTERFACE_H -#include +#include -class QMeeGoRasterPixmapData : public QRasterPixmapData +class QWidget; + +class QCocoaNativeInterface : public QPlatformNativeInterface { public: - QMeeGoRasterPixmapData(); - QMeeGoRasterPixmapData(QPixmapData::PixelType t); - void copy(const QPixmapData *data, const QRect &rect); + void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); }; -#endif +#endif // QCOCOANATIVEINTERFACE_H diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm new file mode 100644 index 00000000000..c6aa0d39e63 --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcocoanativeinterface.h" +#include "qcocoaglcontext.h" +#include "qcocoawindow.h" +#include +#include +#include "qplatformwindow_qpa.h" +#include "qsurfaceformat.h" +#include "qplatformopenglcontext_qpa.h" +#include "qopenglcontext.h" +#include + +void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) +{ + if (resourceString == "nsopenglcontext") { + return static_cast(window->handle())->currentContext()->nsOpenGLContext(); + } + return 0; +} diff --git a/src/gui/mac/macresources.qrc b/src/plugins/platforms/cocoa/qcocoaresources.qrc similarity index 70% rename from src/gui/mac/macresources.qrc rename to src/plugins/platforms/cocoa/qcocoaresources.qrc index 96960022059..de50d397c69 100644 --- a/src/gui/mac/macresources.qrc +++ b/src/plugins/platforms/cocoa/qcocoaresources.qrc @@ -9,4 +9,9 @@ images/leopard-unified-toolbar-on.png + +qt_menu.nib/classes.nib +qt_menu.nib/info.nib +qt_menu.nib/keyedobjects.nib + diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 9e7e68b7d2a..ce79d3967f3 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -45,28 +45,55 @@ #include #include +#include + +#include "qcocoaglcontext.h" +#include "qnsview.h" QT_BEGIN_NAMESPACE +@interface QNSWindow : NSWindow { + +} + +@end + class QCocoaWindow : public QPlatformWindow { public: - QCocoaWindow(QWidget *tlw); + QCocoaWindow(QWindow *tlw); ~QCocoaWindow(); void setGeometry(const QRect &rect); - void setVisible(bool visible); + void setWindowTitle(const QString &title); + void raise(); + void lower(); WId winId() const; - NSView *contentView() const; - void setContentView(NSView *contentView); + void windowDidMove(); void windowDidResize(); + void windowWillClose(); + + void setCurrentContext(QCocoaGLContext *context); + QCocoaGLContext *currentContext() const; + +protected: + void determineWindowClass(); + QNSWindow *createWindow(); + NSRect globalGeometry(const QRect localWindowGeometry) const; + QRect windowGeometry() const; + QCocoaWindow *parentCocoaWindow() const; private: - NSWindow *m_nsWindow; + friend class QCocoaBackingStore; + QNSWindow *m_nsWindow; + QNSView *m_contentView; + quint32 m_windowAttributes; + quint32 m_windowClass; + QCocoaGLContext *m_glContext; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index a2fdce35203..7e4d4217ef8 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -41,54 +41,116 @@ #include "qcocoawindow.h" #include "qnswindowdelegate.h" #include "qcocoaautoreleasepool.h" - -#include - -#include - +#include "qcocoaglcontext.h" +#include "qnsview.h" +#include +#include #include +#include + +#include +#include #include -QCocoaWindow::QCocoaWindow(QWidget *tlw) +@implementation QNSWindow + +- (BOOL)canBecomeKeyWindow +{ + return YES; +} + +- (BOOL)canBecomeMainWindow +{ + return YES; +} + +@end + +QCocoaWindow::QCocoaWindow(QWindow *tlw) : QPlatformWindow(tlw) + , m_windowAttributes(0) + , m_windowClass(0) + , m_glContext(0) { QCocoaAutoReleasePool pool; - const QRect geo = tlw->geometry(); - NSRect frame = NSMakeRect(geo.x(), geo.y(), geo.width(), geo.height()); - m_nsWindow = [[NSWindow alloc] initWithContentRect:frame - styleMask:NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask - backing:NSBackingStoreBuffered - defer:YES]; + determineWindowClass(); + m_nsWindow = createWindow(); QNSWindowDelegate *delegate = [[QNSWindowDelegate alloc] initWithQCocoaWindow:this]; [m_nsWindow setDelegate:delegate]; - - [m_nsWindow makeKeyAndOrderFront:nil]; [m_nsWindow setAcceptsMouseMovedEvents:YES]; + + // Prevent Cocoa from releasing the window on close. Qt + // handles the close event asynchronously and we want to + // make sure that m_nsWindow stays valid until the + // QCocoaWindow is deleted by Qt. + [m_nsWindow setReleasedWhenClosed : NO]; + + m_contentView = [[QNSView alloc] initWithQWindow:tlw]; + + setGeometry(tlw->geometry()); + + [m_nsWindow setContentView:m_contentView]; } QCocoaWindow::~QCocoaWindow() { + [m_nsWindow release]; } void QCocoaWindow::setGeometry(const QRect &rect) { QPlatformWindow::setGeometry(rect); - NSRect bounds = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()); + NSRect bounds = globalGeometry(rect); [[m_nsWindow contentView]setFrameSize:bounds.size]; + [m_nsWindow setContentSize : bounds.size]; + [m_nsWindow setFrameOrigin : bounds.origin]; + + if (m_glContext) + m_glContext->update(); } void QCocoaWindow::setVisible(bool visible) { - Q_UNUSED(visible); + if (visible) { + // The parent window might have moved while this window was hidden, + // update the window geometry if there is a parent. + if (window()->transientParent()) + setGeometry(window()->geometry()); + + // Make sure the QWindow has a frame ready before we show the NSWindow. + QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRect(QPoint(), geometry().size())); + + [m_nsWindow makeKeyAndOrderFront:nil]; + } else { + [m_nsWindow orderOut:nil]; + } +} + +void QCocoaWindow::setWindowTitle(const QString &title) +{ + CFStringRef windowTitle = QCFString::toCFStringRef(title); + [m_nsWindow setTitle: const_cast(reinterpret_cast(windowTitle))]; + CFRelease(windowTitle); +} + +void QCocoaWindow::raise() +{ + // ### handle spaces (see Qt 4 raise_sys in qwidget_mac.mm) + [m_nsWindow orderFront: m_nsWindow]; +} + +void QCocoaWindow::lower() +{ + [m_nsWindow orderFront: m_nsWindow]; } WId QCocoaWindow::winId() const { - return WId([m_nsWindow windowNumber]); + return WId(m_nsWindow); } NSView *QCocoaWindow::contentView() const @@ -96,15 +158,231 @@ NSView *QCocoaWindow::contentView() const return [m_nsWindow contentView]; } -void QCocoaWindow::setContentView(NSView *contentView) +void QCocoaWindow::windowDidMove() { - [m_nsWindow setContentView:contentView]; + if (m_glContext) + m_glContext->update(); } void QCocoaWindow::windowDidResize() { - //jlind: XXX This isn't ideal. Eventdispatcher does not run when resizing... + if (m_glContext) + m_glContext->update(); + NSRect rect = [[m_nsWindow contentView]frame]; QRect geo(rect.origin.x,rect.origin.y,rect.size.width,rect.size.height); - QWindowSystemInterface::handleGeometryChange(widget(),geo); + QWindowSystemInterface::handleSynchronousGeometryChange(window(), geo); } + + +void QCocoaWindow::windowWillClose() +{ + QWindowSystemInterface::handleCloseEvent(window()); +} + +void QCocoaWindow::setCurrentContext(QCocoaGLContext *context) +{ + m_glContext = context; +} + +QCocoaGLContext *QCocoaWindow::currentContext() const +{ + return m_glContext; +} + +/* + Determine the window class based on the window type and + window flags, and widget attr Sets m_windowAttributes + and m_windowClass. +*/ +void QCocoaWindow::determineWindowClass() +{ + Qt::WindowType type = window()->windowType(); + Qt::WindowFlags flags = window()->windowFlags(); + + const bool popup = (type == Qt::Popup); + + if (type == Qt::ToolTip || type == Qt::SplashScreen || popup) + flags |= Qt::FramelessWindowHint; + + m_windowClass = kSheetWindowClass; + + if (popup || type == Qt::SplashScreen) + m_windowClass = kModalWindowClass; + else if (type == Qt::ToolTip) + m_windowClass = kHelpWindowClass; + else if (type == Qt::Tool) + m_windowClass = kFloatingWindowClass; + else + m_windowClass = kDocumentWindowClass; + + m_windowAttributes = (kWindowCompositingAttribute | kWindowStandardHandlerAttribute); + +// if(qt_mac_is_macsheet(window())) { +// m_windowClass = kSheetWindowClass; +// } else + + { + // Shift things around a bit to get the correct window class based on the presence + // (or lack) of the border. + + bool customize = flags & Qt::CustomizeWindowHint; + bool framelessWindow = (flags & Qt::FramelessWindowHint || (customize && !(flags & Qt::WindowTitleHint))); + if (framelessWindow) { + if (m_windowClass == kDocumentWindowClass) { + m_windowAttributes |= kWindowNoTitleBarAttribute; + } else if (m_windowClass == kFloatingWindowClass) { + m_windowAttributes |= kWindowNoTitleBarAttribute; + } else if (m_windowClass == kMovableModalWindowClass) { + m_windowClass = kModalWindowClass; + } + } else { + m_windowAttributes |= NSTitledWindowMask; + if (m_windowClass != kModalWindowClass) + m_windowAttributes |= NSResizableWindowMask; + } + + // Only add extra decorations (well, buttons) for widgets that can have them + // and have an actual border we can put them on. + + if(m_windowClass != kModalWindowClass && m_windowClass != kMovableModalWindowClass + && m_windowClass != kSheetWindowClass && m_windowClass != kPlainWindowClass + && !framelessWindow && m_windowClass != kDrawerWindowClass + && m_windowClass != kHelpWindowClass) { + if (flags & Qt::WindowMinimizeButtonHint) + m_windowAttributes |= NSMiniaturizableWindowMask; + if (flags & Qt::WindowSystemMenuHint || flags & Qt::WindowCloseButtonHint) + m_windowAttributes |= NSClosableWindowMask; + } else { + // Clear these hints so that we aren't call them on invalid windows + flags &= ~(Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint + | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint); + } + + } + + if((popup || type == Qt::Tool) && !window()->isModal()) + m_windowAttributes |= kWindowHideOnSuspendAttribute; + m_windowAttributes |= kWindowLiveResizeAttribute; +} + +/* + +*/ +QNSWindow * QCocoaWindow::createWindow() +{ + // Determine if we need to add in our "custom window" attribute. Cocoa is rather clever + // in deciding if we need the maximize button or not (i.e., it's resizeable, so you + // must need a maximize button). So, the only buttons we have control over are the + // close and minimize buttons. If someone wants to customize and NOT have the maximize + // button, then we have to do our hack. We only do it for these cases because otherwise + // the window looks different when activated. This "QtMacCustomizeWindow" attribute is + // intruding on a public space and WILL BREAK in the future. + // One can hope that there is a more public API available by that time. +/* + Qt::WindowFlags flags = widget ? widget->windowFlags() : Qt::WindowFlags(0); + if ((flags & Qt::CustomizeWindowHint)) { + if ((flags & (Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint + | Qt::WindowMinimizeButtonHint | Qt::WindowTitleHint)) + && !(flags & Qt::WindowMaximizeButtonHint)) + wattr |= QtMacCustomizeWindow; + } +*/ + NSRect frame = globalGeometry(window()->geometry()); + QCocoaAutoReleasePool pool; + QNSWindow *window; + + switch (m_windowClass) { + case kMovableModalWindowClass: + case kModalWindowClass: + case kSheetWindowClass: + case kFloatingWindowClass: + case kOverlayWindowClass: + case kHelpWindowClass: { + NSPanel *panel; + + BOOL needFloating = NO; + BOOL worksWhenModal = (this->window()->windowType() == Qt::Popup); + + // Add in the extra flags if necessary. + switch (m_windowClass) { + case kSheetWindowClass: + m_windowAttributes |= NSDocModalWindowMask; + break; + case kFloatingWindowClass: + case kHelpWindowClass: + needFloating = YES; + m_windowAttributes |= NSUtilityWindowMask; + break; + default: + break; + } + + panel = [[NSPanel alloc] initWithContentRect:frame + styleMask:m_windowAttributes + backing:NSBackingStoreBuffered + defer:NO]; // see window case below +// ### crashes +// [panel setFloatingPanel:needFloating]; +// [panel setWorksWhenModal:worksWhenModal]; + window = static_cast(panel); + break; + } + default: + window = [[QNSWindow alloc] initWithContentRect:frame + styleMask:(NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask) + backing:NSBackingStoreBuffered + defer:NO]; // Deferring window creation breaks OpenGL (the GL context is set up + // before the window is shown and needs a proper window.). + break; + } + + //qt_syncCocoaTitleBarButtons(window, widget); + return window; +} + +// Calculate the global screen geometry for the given local geometry, which +// might be in the parent window coordinate system. +NSRect QCocoaWindow::globalGeometry(const QRect localGeometry) const +{ + QRect finalGeometry = localGeometry; + + if (QCocoaWindow *parent = parentCocoaWindow()) { + QRect parentGeometry = parent->windowGeometry(); + finalGeometry.adjust(parentGeometry.x(), parentGeometry.y(), parentGeometry.x(), parentGeometry.y()); + + // Qt child window geometry assumes that the origin is at the + // top-left of the content area of the parent window. The title + // bar is not a part of this contet area, but is still included + // in the NSWindow height. Move the child window down to acccount + // for this if the parent window has a title bar. + const int titlebarHeight = 22; + if (!(window()->windowFlags() & Qt::FramelessWindowHint)) + finalGeometry.adjust(0, titlebarHeight, 0, titlebarHeight); + } + + // The final "y invert" to get OS X global geometry: + QPlatformScreen *onScreen = QPlatformScreen::platformScreenForWindow(window()); + int flippedY = onScreen->geometry().height() - finalGeometry.y() - finalGeometry.height(); + return NSMakeRect(finalGeometry.x(), flippedY, finalGeometry.width(), finalGeometry.height()); +} + +// Returns the current global screen geometry for the nswindow accociated with this window. +QRect QCocoaWindow::windowGeometry() const +{ + NSRect rect = [m_nsWindow frame]; + QPlatformScreen *onScreen = QPlatformScreen::platformScreenForWindow(window()); + int flippedY = onScreen->geometry().height() - rect.origin.y - rect.size.height; // account for nswindow inverted y. + QRect qRect = QRect(rect.origin.x, flippedY, rect.size.width, rect.size.height); + return qRect; +} + +// Returns a pointer to the parent QCocoaWindow for this window, or 0 if there is none. +QCocoaWindow *QCocoaWindow::parentCocoaWindow() const +{ + if (window() && window()->transientParent()) { + return static_cast(window()->transientParent()->handle()); + } + return 0; +} + diff --git a/src/plugins/platforms/cocoa/qmenu_mac.h b/src/plugins/platforms/cocoa/qmenu_mac.h new file mode 100644 index 00000000000..f20f82c7611 --- /dev/null +++ b/src/plugins/platforms/cocoa/qmenu_mac.h @@ -0,0 +1,85 @@ + +#include +#include +#include +#include +#include + +@class NSMenuItem; +class QCocoaMenuAction : public QPlatformMenuAction +{ +public: + QCocoaMenuAction(); + ~QCocoaMenuAction(); + + NSMenuItem *menuItem; + uchar ignore_accel : 1; + uchar merged : 1; + OSMenuRef menu; + QPointer qtMenu; +}; + +struct QMenuMergeItem +{ + inline QMenuMergeItem(NSMenuItem *c, QCocoaMenuAction *a) : menuItem(c), action(a) { } + NSMenuItem *menuItem; + QCocoaMenuAction *action; +}; +typedef QList QMenuMergeList; + +class QCocoaMenu : public QPlatformMenu +{ +public: + QCocoaMenu(QMenu *qtMenu); + ~QCocoaMenu(); + + OSMenuRef macMenu(OSMenuRef merge = 0); + void syncSeparatorsCollapsible(bool collapse); + void setMenuEnabled(bool enable); + + void addAction(QAction *action, QAction *before); + void syncAction(QAction *action); + void removeAction(QAction *action); + + void addAction(QCocoaMenuAction *action, QCocoaMenuAction *before); + void syncAction(QCocoaMenuAction *action); + void removeAction(QCocoaMenuAction *action); + bool merged(const QAction *action) const; + QCocoaMenuAction *findAction(QAction *action) const; + + OSMenuRef menu; + static QHash mergeMenuHash; + static QHash mergeMenuItemsHash; + QList actionItems; + QMenu *qtMenu; +}; + +class QCocoaMenuBar : public QPlatformMenuBar +{ +public: + QCocoaMenuBar(QMenuBar *qtMenuBar); + ~QCocoaMenuBar(); + + void handleReparent(QWidget *newParent); + + void addAction(QAction *action, QAction *before); + void syncAction(QAction *action); + void removeAction(QAction *action); + + void addAction(QCocoaMenuAction *action, QCocoaMenuAction *before); + void syncAction(QCocoaMenuAction *action); + void removeAction(QCocoaMenuAction *action); + + bool macWidgetHasNativeMenubar(QWidget *widget); + void macCreateMenuBar(QWidget *parent); + void macDestroyMenuBar(); + OSMenuRef macMenu(); + static bool macUpdateMenuBarImmediatly(); + static void macUpdateMenuBar(); + QCocoaMenuAction *findAction(QAction *action) const; + + OSMenuRef menu; + OSMenuRef apple_menu; + QList actionItems; + QMenuBar *qtMenuBar; +}; diff --git a/src/plugins/platforms/cocoa/qmenu_mac.mm b/src/plugins/platforms/cocoa/qmenu_mac.mm new file mode 100644 index 00000000000..7ca546dd797 --- /dev/null +++ b/src/plugins/platforms/cocoa/qmenu_mac.mm @@ -0,0 +1,1274 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmenu_mac.h" + +#include + +#include "qmenu.h" +#include "qhash.h" +#include +#include "qapplication.h" +#include "qregexp.h" +#include "qtoolbar.h" +#include "qevent.h" +#include "qstyle.h" +#include "qwidgetaction.h" + +#include +#include +#include + +#include "qcocoahelpers.h" +#include "qcocoaapplication.h" +#include "qcocoamenuloader.h" +#include "qcocoamenu.h" +#include "qcocoahelpers.h" +#include "qcocoaautoreleasepool.h" + +QT_BEGIN_NAMESPACE + +/***************************************************************************** + QMenu debug facilities + *****************************************************************************/ + +/***************************************************************************** + QMenu globals + *****************************************************************************/ +bool qt_mac_no_menubar_merge = false; +bool qt_mac_quit_menu_item_enabled = true; +int qt_mac_menus_open_count = 0; + +static OSMenuRef qt_mac_create_menu(QWidget *w); + +static struct { + QPointer qmenubar; + bool modal; +} qt_mac_current_menubar = { 0, false }; + + + + +/***************************************************************************** + Externals + *****************************************************************************/ +extern OSViewRef qt_mac_hiview_for(const QWidget *w); //qwidget_mac.cpp +extern IconRef qt_mac_create_iconref(const QPixmap &px); //qpixmap_mac.cpp +extern QWidget * mac_keyboard_grabber; //qwidget_mac.cpp +extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); //qapplication_xxx.cpp +RgnHandle qt_mac_get_rgn(); //qregion_mac.cpp +void qt_mac_dispose_rgn(RgnHandle r); //qregion_mac.cpp + +/***************************************************************************** + QMenu utility functions + *****************************************************************************/ +bool qt_mac_watchingAboutToShow(QMenu *menu) +{ + return menu; /* && menu->receivers(SIGNAL(aboutToShow()));*/ +} + +static int qt_mac_CountMenuItems(OSMenuRef menu) +{ + if (menu) { + return [menu numberOfItems]; + } + return 0; +} + +void qt_mac_menu_collapseSeparators(NSMenu * theMenu, bool collapse) +{ + QCocoaAutoReleasePool pool; + OSMenuRef menu = static_cast(theMenu); + if (collapse) { + bool previousIsSeparator = true; // setting to true kills all the separators placed at the top. + NSMenuItem *previousItem = nil; + + NSArray *itemArray = [menu itemArray]; + for (unsigned int i = 0; i < [itemArray count]; ++i) { + NSMenuItem *item = reinterpret_cast([itemArray objectAtIndex:i]); + if ([item isSeparatorItem]) { + [item setHidden:previousIsSeparator]; + } + + if (![item isHidden]) { + previousItem = item; + previousIsSeparator = ([previousItem isSeparatorItem]); + } + } + + // We now need to check the final item since we don't want any separators at the end of the list. + if (previousItem && previousIsSeparator) + [previousItem setHidden:YES]; + } else { + NSArray *itemArray = [menu itemArray]; + for (unsigned int i = 0; i < [itemArray count]; ++i) { + NSMenuItem *item = reinterpret_cast([itemArray objectAtIndex:i]); + if (QAction *action = reinterpret_cast([item tag])) + [item setHidden:!action->isVisible()]; + } + } +} + +#ifndef QT_NO_TRANSLATION +static const char *application_menu_strings[] = { + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Services"), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide %1"), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide Others"), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Show All"), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Preferences..."), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Quit %1"), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","About %1") + }; + +QString qt_mac_applicationmenu_string(int 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 + + +static quint32 constructModifierMask(quint32 accel_key) +{ + quint32 ret = 0; + const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta); + if ((accel_key & Qt::CTRL) == Qt::CTRL) + ret |= (dontSwap ? NSControlKeyMask : NSCommandKeyMask); + if ((accel_key & Qt::META) == Qt::META) + ret |= (dontSwap ? NSCommandKeyMask : NSControlKeyMask); + if ((accel_key & Qt::ALT) == Qt::ALT) + ret |= NSAlternateKeyMask; + if ((accel_key & Qt::SHIFT) == Qt::SHIFT) + ret |= NSShiftKeyMask; + return ret; +} + +static void cancelAllMenuTracking() +{ + QCocoaAutoReleasePool pool; + NSMenu *mainMenu = [NSApp mainMenu]; + [mainMenu cancelTracking]; + for (NSMenuItem *item in [mainMenu itemArray]) { + if ([item submenu]) { + [[item submenu] cancelTracking]; + } + } +} + +static bool actualMenuItemVisibility(const QCocoaMenuBar *mbp, + const QCocoaMenuAction *action) +{ + bool visible = action->action->isVisible(); + if (visible && action->action->text() == QString(QChar(0x14))) + return false; + + if (visible && action->action->menu() && !action->action->menu()->actions().isEmpty() && +/* ### !qt_mac_CountMenuItems(cocoaMenu->macMenu(mbp->apple_menu)) &&*/ + !qt_mac_watchingAboutToShow(action->action->menu())) { + return false; + } + return visible; +} + +static inline void syncNSMenuItemVisiblity(NSMenuItem *menuItem, bool actionVisibility) +{ + [menuItem setHidden:NO]; + [menuItem setHidden:YES]; + [menuItem setHidden:!actionVisibility]; +} + +static inline void syncNSMenuItemEnabled(NSMenuItem *menuItem, bool enabled) +{ + [menuItem setEnabled:NO]; + [menuItem setEnabled:YES]; + [menuItem setEnabled:enabled]; +} + +static inline void syncMenuBarItemsVisiblity(const QCocoaMenuBar *mac_menubar) +{ + const QList &menubarActions = mac_menubar->actionItems; + for (int i = 0; i < menubarActions.size(); ++i) { + const QCocoaMenuAction *action = menubarActions.at(i); + syncNSMenuItemVisiblity(action->menuItem, actualMenuItemVisibility(mac_menubar, action)); + } +} + +static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader() +{ + return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)]; +} + +static NSMenuItem *createNSMenuItem(const QString &title) +{ + NSMenuItem *item = [[NSMenuItem alloc] + initWithTitle:qt_mac_QStringToNSString(title) + action:@selector(qtDispatcherToQAction:) keyEquivalent:@""]; + [item setTarget:nil]; + return item; +} + +// helper that recurses into a menu structure and en/dis-ables them +void qt_mac_set_modal_state_helper_recursive(OSMenuRef menu, OSMenuRef merge, bool on) +{ + bool modalWindowOnScreen = qApp->activeModalWidget() != 0; + for (NSMenuItem *item in [menu itemArray]) { + OSMenuRef submenu = [item submenu]; + if (submenu != merge) { + if (submenu) + qt_mac_set_modal_state_helper_recursive(submenu, merge, on); + if (!on) { + // The item should follow what the QAction has. + if ([item tag]) { + QAction *action = reinterpret_cast([item tag]); + syncNSMenuItemEnabled(item, action->isEnabled()); + } else { + syncNSMenuItemEnabled(item, YES); + } + // We sneak in some extra code here to handle a menu problem: + // If there is no window on screen, we cannot set 'nil' as + // menu item target, because then cocoa will disable the item + // (guess it assumes that there will be no first responder to + // catch the trigger anyway?) OTOH, If we have a modal window, + // then setting the menu loader as target will make cocoa not + // deliver the trigger because the loader is then seen as modally + // shaddowed). So either way there are shortcomings. Instead, we + // decide the target as late as possible: + [item setTarget:modalWindowOnScreen ? nil : getMenuLoader()]; + } else { + syncNSMenuItemEnabled(item, NO); + } + } + } +} + +//toggling of modal state +static void qt_mac_set_modal_state(OSMenuRef menu, bool on) +{ + OSMenuRef merge = QCocoaMenu::mergeMenuHash.value(menu); + qt_mac_set_modal_state_helper_recursive(menu, merge, on); + // I'm ignoring the special items now, since they should get handled via a syncAction() +} + +bool qt_mac_menubar_is_open() +{ + return qt_mac_menus_open_count > 0; +} + +QCocoaMenuAction::~QCocoaMenuAction() +{ + [menu release]; + // Update the menu item if this action still owns it. For some items + // (like 'Quit') ownership will be transferred between all menu bars... + if (action && action.data() == reinterpret_cast([menuItem tag])) { + QAction::MenuRole role = action->menuRole(); + // Check if the item is owned by Qt, and should be hidden to keep it from causing + // problems. Do it for everything but the quit menu item since that should always + // be visible. + if (role > QAction::ApplicationSpecificRole && role < QAction::QuitRole) { + [menuItem setHidden:YES]; + } else if (role == QAction::TextHeuristicRole + && menuItem != [getMenuLoader() quitMenuItem]) { + [menuItem setHidden:YES]; + } + [menuItem setTag:nil]; + } + [menuItem release]; +} + +static NSMenuItem *qt_mac_menu_merge_action(OSMenuRef merge, QCocoaMenuAction *action) +{ + if (qt_mac_no_menubar_merge || action->action->menu() || action->action->isSeparator() + || action->action->menuRole() == QAction::NoRole) + return 0; + + QString t = qt_mac_removeMnemonics(action->action->text().toLower()); + int st = t.lastIndexOf(QLatin1Char('\t')); + if (st != -1) + t.remove(st, t.length()-st); + t.replace(QRegExp(QString::fromLatin1("\\.*$")), QLatin1String("")); //no ellipses + //now the fun part + NSMenuItem *ret = 0; + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); + + switch (action->action->menuRole()) { + case QAction::NoRole: + ret = 0; + break; + case QAction::ApplicationSpecificRole: + ret = [loader appSpecificMenuItem]; + break; + case QAction::AboutRole: + ret = [loader aboutMenuItem]; + break; + case QAction::AboutQtRole: + ret = [loader aboutQtMenuItem]; + break; + case QAction::QuitRole: + ret = [loader quitMenuItem]; + break; + case QAction::PreferencesRole: + ret = [loader preferencesMenuItem]; + break; + case QAction::TextHeuristicRole: { + QString aboutString = QMenuBar::tr("About").toLower(); + if (t.startsWith(aboutString) || t.endsWith(aboutString)) { + if (t.indexOf(QRegExp(QString::fromLatin1("qt$"), Qt::CaseInsensitive)) == -1) { + ret = [loader aboutMenuItem]; + } else { + ret = [loader aboutQtMenuItem]; + } + } else if (t.startsWith(QMenuBar::tr("Config").toLower()) + || t.startsWith(QMenuBar::tr("Preference").toLower()) + || t.startsWith(QMenuBar::tr("Options").toLower()) + || t.startsWith(QMenuBar::tr("Setting").toLower()) + || t.startsWith(QMenuBar::tr("Setup").toLower())) { + ret = [loader preferencesMenuItem]; + } else if (t.startsWith(QMenuBar::tr("Quit").toLower()) + || t.startsWith(QMenuBar::tr("Exit").toLower())) { + ret = [loader quitMenuItem]; + } + } + break; + } + + if (QMenuMergeList *list = QCocoaMenu::mergeMenuItemsHash.value(merge)) { + for(int i = 0; i < list->size(); ++i) { + const QMenuMergeItem &item = list->at(i); + if (item.menuItem == ret && item.action) + return 0; + } + } + + return ret; +} + +static QString qt_mac_menu_merge_text(QCocoaMenuAction *action) +{ + QString ret; + extern QString qt_mac_applicationmenu_string(int type); + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); + if (action->action->menuRole() == QAction::ApplicationSpecificRole) + ret = action->action->text(); + else if (action->menuItem == [loader aboutMenuItem]) { + ret = qt_mac_applicationmenu_string(6).arg(qt_mac_applicationName()); + } else if (action->menuItem == [loader aboutQtMenuItem]) { + if (action->action->text() == QString("About Qt")) + ret = QMenuBar::tr("About Qt"); + else + ret = action->action->text(); + } else if (action->menuItem == [loader preferencesMenuItem]) { + ret = qt_mac_applicationmenu_string(4); + } else if (action->menuItem == [loader quitMenuItem]) { + ret = qt_mac_applicationmenu_string(5).arg(qt_mac_applicationName()); + } + return ret; +} + +static QKeySequence qt_mac_menu_merge_accel(QCocoaMenuAction *action) +{ + QKeySequence ret; + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); + if (action->action->menuRole() == QAction::ApplicationSpecificRole) + ret = action->action->shortcut(); + else if (action->menuItem == [loader preferencesMenuItem]) + ret = QKeySequence(QKeySequence::Preferences); + else if (action->menuItem == [loader quitMenuItem]) + ret = QKeySequence(QKeySequence::Quit); + return ret; +} + +void Q_WIDGETS_EXPORT qt_mac_set_menubar_icons(bool b) +{ QApplication::instance()->setAttribute(Qt::AA_DontShowIconsInMenus, !b); } +void Q_WIDGETS_EXPORT qt_mac_set_native_menubar(bool b) +{ QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, !b); } +void Q_WIDGETS_EXPORT qt_mac_set_menubar_merge(bool b) { qt_mac_no_menubar_merge = !b; } + +/***************************************************************************** + QMenu bindings + *****************************************************************************/ + +QCocoaMenuAction::QCocoaMenuAction() + : menuItem(0) + , ignore_accel(0), merged(0), menu(0) +{ + +} + +QCocoaMenu::QCocoaMenu(QMenu *a_qtMenu) : menu(0), qtMenu(a_qtMenu) +{ +} + +QCocoaMenu::~QCocoaMenu() +{ + QCocoaAutoReleasePool pool; + while (actionItems.size()) { + QCocoaMenuAction *action = static_cast(actionItems.takeFirst()); + if (QMenuMergeList *list = mergeMenuItemsHash.value(action->menu)) { + int i = 0; + while (i < list->size()) { + const QMenuMergeItem &item = list->at(i); + if (item.action == action) + list->removeAt(i); + else + ++i; + } + } + delete action; + } + mergeMenuHash.remove(menu); + mergeMenuItemsHash.remove(menu); + [menu release]; +} + + +void QCocoaMenu::addAction(QAction *a, QAction *before) +{ + QCocoaMenuAction *action = new QCocoaMenuAction; + action->action = a; + action->ignore_accel = 0; + action->merged = 0; + action->menu = 0; + + QCocoaMenuAction *cocoaBefore = findAction(before); + addAction(action, cocoaBefore); +} + + +void QCocoaMenu::addAction(QCocoaMenuAction *action, QCocoaMenuAction *before) +{ + QCocoaAutoReleasePool pool; + if (!action) + return; + int before_index = actionItems.indexOf(before); + if (before_index < 0) { + before = 0; + before_index = actionItems.size(); + } + actionItems.insert(before_index, action); + + [menu retain]; + [action->menu release]; + action->menu = menu; + + /* When the action is considered a mergable action it + will stay that way, until removed.. */ + if (!qt_mac_no_menubar_merge) { + OSMenuRef merge = QCocoaMenu::mergeMenuHash.value(menu); + if (merge) { + if (NSMenuItem *cmd = qt_mac_menu_merge_action(merge, action)) { + action->merged = 1; + [merge retain]; + [action->menu release]; + action->menu = merge; + [cmd retain]; + [cmd setAction:@selector(qtDispatcherToQAction:)]; + [cmd setTarget:nil]; + [action->menuItem release]; + action->menuItem = cmd; + QMenuMergeList *list = QCocoaMenu::mergeMenuItemsHash.value(merge); + if (!list) { + list = new QMenuMergeList; + QCocoaMenu::mergeMenuItemsHash.insert(merge, list); + } + list->append(QMenuMergeItem(cmd, action)); + } + } + } + + NSMenuItem *newItem = action->menuItem; + if (newItem == 0) { + newItem = createNSMenuItem(action->action->text()); + action->menuItem = newItem; + if (before) { + [menu insertItem:newItem atIndex:qMax(before_index, 0)]; + } else { + [menu addItem:newItem]; + } + } else { + [newItem setEnabled:YES]; + // ### + //[newItem setEnabled:!QApplicationPrivate::modalState()]; + + } + [newItem setTag:long(static_cast(action->action))]; + syncAction(action); +} + +void QCocoaMenu::syncAction(QAction *a) +{ + syncAction(findAction(a)); +} + +void QCocoaMenu::removeAction(QAction *a) +{ + removeAction(findAction(a)); +} + +QCocoaMenuAction *QCocoaMenu::findAction(QAction *action) const +{ + for (int i = 0; i < actionItems.size(); i++) { + QCocoaMenuAction *act = actionItems[i]; + if (action == act->action) + return act; + } + return 0; +} + + +// return an autoreleased string given a QKeySequence (currently only looks at the first one). +NSString *keySequenceToKeyEqivalent(const QKeySequence &accel) +{ + quint32 accel_key = (accel[0] & ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL)); + QChar cocoa_key = qt_mac_qtKey2CocoaKey(Qt::Key(accel_key)); + if (cocoa_key.isNull()) + cocoa_key = QChar(accel_key).toLower().unicode(); + return [NSString stringWithCharacters:&cocoa_key.unicode() length:1]; +} + +// return the cocoa modifier mask for the QKeySequence (currently only looks at the first one). +NSUInteger keySequenceModifierMask(const QKeySequence &accel) +{ + return constructModifierMask(accel[0]); +} + +void QCocoaMenu::syncAction(QCocoaMenuAction *action) +{ + if (!action) + return; + + NSMenuItem *item = action->menuItem; + if (!item) + return; + + QCocoaAutoReleasePool pool; + NSMenu *menu = [item menu]; + bool actionVisible = action->action->isVisible(); + [item setHidden:!actionVisible]; + if (!actionVisible) + return; + + int itemIndex = [menu indexOfItem:item]; + Q_ASSERT(itemIndex != -1); + if (action->action->isSeparator()) { + action->menuItem = [NSMenuItem separatorItem]; + [action->menuItem retain]; + [menu insertItem: action->menuItem atIndex:itemIndex]; + [menu removeItem:item]; + [item release]; + item = action->menuItem; + return; + } else if ([item isSeparatorItem]) { + // I'm no longer a separator... + action->menuItem = createNSMenuItem(action->action->text()); + [menu insertItem:action->menuItem atIndex:itemIndex]; + [menu removeItem:item]; + [item release]; + item = action->menuItem; + } + + //find text (and accel) + action->ignore_accel = 0; + QString text = action->action->text(); + QKeySequence accel = action->action->shortcut(); + { + int st = text.lastIndexOf(QLatin1Char('\t')); + if (st != -1) { + action->ignore_accel = 1; + accel = QKeySequence(text.right(text.length()-(st+1))); + text.remove(st, text.length()-st); + } + } + { + QString cmd_text = qt_mac_menu_merge_text(action); + if (!cmd_text.isEmpty()) { + text = cmd_text; + accel = qt_mac_menu_merge_accel(action); + } + } + // Show multiple key sequences as part of the menu text. + if (accel.count() > 1) + text += QLatin1String(" (") + accel.toString(QKeySequence::NativeText) + QLatin1String(")"); + +#if 0 + QString finalString = qt_mac_removeMnemonics(text); +#else + QString finalString = qt_mac_removeMnemonics(text); +#endif + // Cocoa Font and title + if (action->action->font().resolve()) { + const QFont &actionFont = action->action->font(); + NSFont *customMenuFont = [NSFont fontWithName:qt_mac_QStringToNSString(actionFont.family()) + size:actionFont.pointSize()]; + NSArray *keys = [NSArray arrayWithObjects:NSFontAttributeName, nil]; + NSArray *objects = [NSArray arrayWithObjects:customMenuFont, nil]; + NSDictionary *attributes = [NSDictionary dictionaryWithObjects:objects forKeys:keys]; + NSAttributedString *str = [[[NSAttributedString alloc] initWithString:qt_mac_QStringToNSString(finalString) + attributes:attributes] autorelease]; + [item setAttributedTitle: str]; + } else { + [item setTitle: qt_mac_QStringToNSString(finalString)]; + } + + if (action->action->menuRole() == QAction::AboutRole || action->action->menuRole() == QAction::QuitRole) + [item setTitle:qt_mac_QStringToNSString(text)]; + else + [item setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(text))]; + + // Cocoa Enabled + [item setEnabled: action->action->isEnabled()]; + + // Cocoa icon + NSImage *nsimage = 0; + if (!action->action->icon().isNull() && action->action->isIconVisibleInMenu()) { + nsimage = static_cast(qt_mac_create_nsimage(action->action->icon().pixmap(16, QIcon::Normal))); + } + [item setImage:nsimage]; + [nsimage release]; + + if (action->action->menu()) { //submenu + QCocoaMenu *cocoaMenu = static_cast(action->action->menu()->platformMenu()); + NSMenu *subMenu = cocoaMenu->macMenu(); + if ([subMenu supermenu] && [subMenu supermenu] != [item menu]) { + // The menu is already a sub-menu of another one. Cocoa will throw an exception, + // in such cases. For the time being, a new QMenu with same set of actions is the + // only workaround. + action->action->setEnabled(false); + } else { + [item setSubmenu:subMenu]; + } + } else { //respect some other items + [item setSubmenu:0]; + // No key equivalent set for multiple key QKeySequence. + if (accel.count() == 1) { + [item setKeyEquivalent:keySequenceToKeyEqivalent(accel)]; + [item setKeyEquivalentModifierMask:keySequenceModifierMask(accel)]; + } else { + [item setKeyEquivalent:@""]; + [item setKeyEquivalentModifierMask:NSCommandKeyMask]; + } + } + //mark glyph + [item setState:action->action->isChecked() ? NSOnState : NSOffState]; +} + +void QCocoaMenu::removeAction(QCocoaMenuAction *action) +{ + if (!action) + return; + QCocoaAutoReleasePool pool; + if (action->merged) { + if (reinterpret_cast([action->menuItem tag]) == action->action) { + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); + [action->menuItem setEnabled:false]; + if (action->menuItem != [loader quitMenuItem] + && action->menuItem != [loader preferencesMenuItem]) { + [[action->menuItem menu] removeItem:action->menuItem]; + } + } + } else { + [[action->menuItem menu] removeItem:action->menuItem]; + } + actionItems.removeAll(action); +} + +OSMenuRef QCocoaMenu::macMenu(OSMenuRef merge) +{ + if (menu) + return menu; + menu = qt_mac_create_menu(qtMenu); + if (merge) { + mergeMenuHash.insert(menu, merge); + } + QList items = qtMenu->actions(); + for(int i = 0; i < items.count(); i++) + addAction(items[i], 0); + syncSeparatorsCollapsible(qtMenu->separatorsCollapsible()); + return menu; +} + +/*! + \internal +*/ +void +QCocoaMenu::syncSeparatorsCollapsible(bool collapse) +{ + qt_mac_menu_collapseSeparators(menu, collapse); +} + +/*! + \internal +*/ +void QCocoaMenu::setMenuEnabled(bool enable) +{ + QCocoaAutoReleasePool pool; + if (enable) { + for (int i = 0; i < actionItems.count(); ++i) { + QCocoaMenuAction *menuItem = static_cast(actionItems.at(i)); + if (menuItem && menuItem->action && menuItem->action->isEnabled()) { + [menuItem->menuItem setEnabled:true]; + } + } + } else { + NSMenu *menu = menu; + for (NSMenuItem *item in [menu itemArray]) { + [item setEnabled:false]; + } + } +} + +/*! + \internal + + This function will return the OSMenuRef used to create the native menu bar + bindings. + + If Qt is built against Carbon, the OSMenuRef is a MenuRef that can be used + with Carbon's Menu Manager API. + + If Qt is built against Cocoa, the OSMenuRef is a NSMenu pointer. + + \warning This function is not portable. + + \sa QMenuBar::macMenu() +*/ +/// OSMenuRef QMenu::macMenu(OSMenuRef merge) { return d_func()->macMenu(merge); } + +/***************************************************************************** + QMenuBar bindings + *****************************************************************************/ +typedef QHash MenuBarHash; +Q_GLOBAL_STATIC(MenuBarHash, menubars) +static QMenuBar *fallback = 0; + +QCocoaMenuBar::QCocoaMenuBar(QMenuBar *a_qtMenuBar) : menu(0), apple_menu(0), qtMenuBar(a_qtMenuBar) +{ + macCreateMenuBar(qtMenuBar->parentWidget()); +} + +QCocoaMenuBar::~QCocoaMenuBar() +{ + for(QList::Iterator it = actionItems.begin(); it != actionItems.end(); ++it) + delete (*it); + [apple_menu release]; + [menu release]; +} +void QCocoaMenuBar::handleReparent(QWidget *newParent) +{ + if (macWidgetHasNativeMenubar(newParent)) { + // If the new parent got a native menubar from before, keep that + // menubar rather than replace it with this one (because a parents + // menubar has precedence over children menubars). + macDestroyMenuBar(); + macCreateMenuBar(newParent); + } + +} + +void QCocoaMenuBar::addAction(QAction *action, QAction *beforeAction) +{ + if (action->isSeparator() || !menu) + return; + QCocoaMenuAction *cocoaAction = new QCocoaMenuAction; + cocoaAction->action = action; + cocoaAction->ignore_accel = 1; + QCocoaMenuAction *cocoaBeforeAction = findAction(beforeAction); + addAction(cocoaAction, cocoaBeforeAction); +} + +void QCocoaMenuBar::addAction(QCocoaMenuAction *action, QCocoaMenuAction *before) +{ + if (!action || !menu) + return; + + int before_index = actionItems.indexOf(before); + if (before_index < 0) { + before = 0; + before_index = actionItems.size(); + } + actionItems.insert(before_index, action); + + MenuItemIndex index = actionItems.size()-1; + + action->menu = menu; + QCocoaAutoReleasePool pool; + [action->menu retain]; + NSMenuItem *newItem = createNSMenuItem(action->action->text()); + action->menuItem = newItem; + + if (before) { + [menu insertItem:newItem atIndex:qMax(1, before_index + 1)]; + index = before_index; + } else { + [menu addItem:newItem]; + } + [newItem setTag:long(static_cast(action->action))]; + syncAction(action); +} + + +void QCocoaMenuBar::syncAction(QCocoaMenuAction *action) +{ + if (!action || !menu) + return; + + QCocoaAutoReleasePool pool; + NSMenuItem *item = action->menuItem; + + OSMenuRef submenu = 0; + bool release_submenu = false; + if (action->action->menu()) { + QCocoaMenu *cocoaMenu = static_cast(action->action->menu()->platformMenu()); + if (!cocoaMenu) { + + } + + if ((submenu = cocoaMenu->macMenu(apple_menu))) { + if ([submenu supermenu] && [submenu supermenu] != [item menu]) + return; + else + [item setSubmenu:submenu]; + } + } + + if (submenu) { + bool visible = actualMenuItemVisibility(this, action); + [item setSubmenu: submenu]; + [submenu setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(action->action->text()))]; + syncNSMenuItemVisiblity(item, visible); + if (release_submenu) { //no pointers to it + [submenu release]; + } + } else { + qWarning("QMenu: No OSMenuRef created for popup menu"); + } +} + + +void QCocoaMenuBar::removeAction(QCocoaMenuAction *action) +{ + if (!action || !menu) + return; + QCocoaAutoReleasePool pool; + [action->menu removeItem:action->menuItem]; + actionItems.removeAll(action); +} + +void QCocoaMenuBar::syncAction(QAction *a) +{ + syncAction(findAction(a)); +} + +void QCocoaMenuBar::removeAction(QAction *a) +{ + removeAction(findAction(a)); +} + +QCocoaMenuAction *QCocoaMenuBar::findAction(QAction *action) const +{ + for (int i = 0; i < actionItems.size(); i++) { + QCocoaMenuAction *act = actionItems[i]; + if (action == act->action) + return act; + } + return 0; +} + +bool QCocoaMenuBar::macWidgetHasNativeMenubar(QWidget *widget) +{ + // This function is different from q->isNativeMenuBar(), as + // it returns true only if a native menu bar is actually + // _created_. + if (!widget) + return false; + return menubars()->contains(widget->window()); +} + +void QCocoaMenuBar::macCreateMenuBar(QWidget *parent) +{ + static int dontUseNativeMenuBar = -1; + // We call the isNativeMenuBar function here + // because that will make sure that local overrides + // are dealt with correctly. q->isNativeMenuBar() will, if not + // overridden, depend on the attribute Qt::AA_DontUseNativeMenuBar: + bool qt_mac_no_native_menubar = !qtMenuBar->isNativeMenuBar(); + if (qt_mac_no_native_menubar == false && dontUseNativeMenuBar < 0) { + // The menubar is set to be native. Let's check (one time only + // for all menubars) if this is OK with the rest of the environment. + // As a result, Qt::AA_DontUseNativeMenuBar is set. NB: the application + // might still choose to not respect, or change, this flag. + bool isPlugin = QApplication::testAttribute(Qt::AA_MacPluginApplication); + bool environmentSaysNo = !qgetenv("QT_MAC_NO_NATIVE_MENUBAR").isEmpty(); + dontUseNativeMenuBar = isPlugin || environmentSaysNo; + QApplication::instance()->setAttribute(Qt::AA_DontUseNativeMenuBar, dontUseNativeMenuBar); + qt_mac_no_native_menubar = !qtMenuBar->isNativeMenuBar(); + } + if (qt_mac_no_native_menubar == false) { + // INVARIANT: Use native menubar. + macUpdateMenuBar(); + if (!parent && !fallback) { + fallback = qtMenuBar; + } else if (parent && parent->isWindow()) { + menubars()->insert(qtMenuBar->window(), qtMenuBar); + } + } +} + +void QCocoaMenuBar::macDestroyMenuBar() +{ + QCocoaAutoReleasePool pool; + if (fallback == qtMenuBar) + fallback = 0; + QWidget *tlw = qtMenuBar->window(); + menubars()->remove(tlw); + + if (!qt_mac_current_menubar.qmenubar || qt_mac_current_menubar.qmenubar == qtMenuBar) { + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); + [loader removeActionsFromAppMenu]; + QCocoaMenuBar::macUpdateMenuBar(); + } +} + +OSMenuRef QCocoaMenuBar::macMenu() +{ + if (!qtMenuBar->isNativeMenuBar()) { + return 0; + } else if (!menu) { + menu = qt_mac_create_menu(qtMenuBar); + ProcessSerialNumber mine, front; + if (GetCurrentProcess(&mine) == noErr && GetFrontProcess(&front) == noErr) { + if (!qt_mac_no_menubar_merge && !apple_menu) { + apple_menu = qt_mac_create_menu(qtMenuBar); + [apple_menu setTitle:qt_mac_QStringToNSString(QString(QChar(0x14)))]; + NSMenuItem *apple_menuItem = [[NSMenuItem alloc] init]; + [apple_menuItem setSubmenu:menu]; + [apple_menu addItem:apple_menuItem]; + [apple_menuItem release]; + } + if (apple_menu) { + QCocoaMenu::mergeMenuHash.insert(menu, apple_menu); + } + QList items = qtMenuBar->actions(); + for(int i = 0; i < items.count(); i++) + addAction(items[i], 0); + } + } + return menu; +} + +/*! + \internal + + This function will return the OSMenuRef used to create the native menu bar + bindings. This OSMenuRef is then set as the root menu for the Menu + Manager. + + \warning This function is not portable. + + \sa QMenu::macMenu() +*/ +//OSMenuRef QMenuBar::macMenu() { return d_func()->macMenu(); } + +/* ! + \internal + Ancestor function that crosses windows (QWidget::isAncestorOf + only considers widgets within the same window). +*/ +static bool qt_mac_is_ancestor(QWidget* possibleAncestor, QWidget *child) +{ + if (!possibleAncestor) + return false; + + QWidget * current = child->parentWidget(); + while (current != 0) { + if (current == possibleAncestor) + return true; + current = current->parentWidget(); + } + return false; +} + +/* ! + \internal + Returns true if the entries of menuBar should be disabled, + based on the modality type of modalWidget. +*/ +static bool qt_mac_should_disable_menu(QMenuBar *menuBar) +{ + QWidget *modalWidget = qApp->activeModalWidget(); + if (!modalWidget) + return false; + + if (menuBar && menuBar == menubars()->value(modalWidget)) + // The menu bar is owned by the modal widget. + // In that case we should enable it: + return false; + + // When there is an application modal window on screen, the entries of + // the menubar should be disabled. The exception in Qt is that if the + // modal window is the only window on screen, then we enable the menu bar. + QWidget *w = modalWidget; + QWidgetList topLevelWidgets = QApplication::topLevelWidgets(); + while (w) { + if (w->isVisible() && w->windowModality() == Qt::ApplicationModal) { + for (int i=0; iisVisible()) { + // INVARIANT: we found another visible window + // on screen other than our modalWidget. We therefore + // disable the menu bar to follow normal modality logic: + return true; + } + } + // INVARIANT: We have only one window on screen that happends + // to be application modal. We choose to enable the menu bar + // in that case to e.g. enable the quit menu item. + return false; + } + w = w->parentWidget(); + } + + // INVARIANT: modalWidget is window modal. Disable menu entries + // if the menu bar belongs to an ancestor of modalWidget. If menuBar + // is nil, we understand it as the default menu bar set by the nib: + return menuBar ? qt_mac_is_ancestor(menuBar->parentWidget(), modalWidget) : false; +} + +static QWidget *findWindowThatShouldDisplayMenubar() +{ + QWidget *w = qApp->activeWindow(); + + if (!w) { + // We have no active window on screen. Try to + // find a window from the list of top levels: + QWidgetList tlws = QApplication::topLevelWidgets(); + for(int i = 0; i < tlws.size(); ++i) { + QWidget *tlw = tlws.at(i); + if ((tlw->isVisible() && tlw->windowType() != Qt::Tool && + tlw->windowType() != Qt::Popup)) { + w = tlw; + break; + } + } + } + + return w; +} + +static QMenuBar *findMenubarForWindow(QWidget *w) +{ + QMenuBar *mb = 0; + if (w) { + mb = menubars()->value(w); + +#if 0 +// ### +//#ifndef QT_NO_MAINWINDOW + QDockWidget *dw = qobject_cast(w); + if (!mb && dw) { + QMainWindow *mw = qobject_cast(dw->parentWidget()); + if (mw && (mb = menubars()->value(mw))) + w = mw; + } +#endif + while(w && !mb) + mb = menubars()->value((w = w->parentWidget())); + } + + if (!mb) { + // We could not find a menu bar for the window. Lets + // check if we have a global (parentless) menu bar instead: + mb = fallback; + } + + return mb; +} + +void qt_mac_clear_menubar() +{ + if (QApplication::testAttribute(Qt::AA_MacPluginApplication)) + return; + + QCocoaAutoReleasePool pool; + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); + NSMenu *menu = [loader menu]; + [loader ensureAppMenuInMenu:menu]; + [NSApp setMainMenu:menu]; + const bool modal = qt_mac_should_disable_menu(0); + if (qt_mac_current_menubar.qmenubar || modal != qt_mac_current_menubar.modal) + qt_mac_set_modal_state(menu, modal); + qt_mac_current_menubar.qmenubar = 0; + qt_mac_current_menubar.modal = modal; +} + +/*! + \internal + + This function will update the current menu bar and set it as the + active menu bar in the Menu Manager. + + \warning This function is not portable. +*/ +void QCocoaMenuBar::macUpdateMenuBar() +{ + [getMenuLoader() performSelectorOnMainThread: @selector(qtUpdateMenubar) withObject: nil waitUntilDone: NO]; +} + +bool QCocoaMenuBar::macUpdateMenuBarImmediatly() +{ + bool ret = false; + cancelAllMenuTracking(); + QWidget *w = findWindowThatShouldDisplayMenubar(); + QMenuBar *mb = findMenubarForWindow(w); + + // ### extern bool qt_mac_app_fullscreen; //qapplication_mac.mm + bool qt_mac_app_fullscreen = false; + // We need to see if we are in full screen mode, if so we need to + // switch the full screen mode to be able to show or hide the menubar. + if(w && mb) { + // This case means we are creating a menubar, check if full screen + if(w->isFullScreen()) { + // Ok, switch to showing the menubar when hovering over it. + SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar); + qt_mac_app_fullscreen = true; + } + } else if(w) { + // Removing a menubar + if(w->isFullScreen()) { + // Ok, switch to not showing the menubar when hovering on it + SetSystemUIMode(kUIModeAllHidden, 0); + qt_mac_app_fullscreen = true; + } + } + + if (mb && mb->isNativeMenuBar()) { + + // ### + bool modal = false; + //bool modal = QGuiApplicationPrivate::modalState(); + QCocoaAutoReleasePool pool; + if (OSMenuRef menu = reinterpret_cast(mb->platformMenuBar())->macMenu()) { + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); + [loader ensureAppMenuInMenu:menu]; + [NSApp setMainMenu:menu]; + syncMenuBarItemsVisiblity(reinterpret_cast(mb->platformMenuBar())); + + if (OSMenuRef tmpMerge = QCocoaMenu::mergeMenuHash.value(menu)) { + if (QMenuMergeList *mergeList + = QCocoaMenu::mergeMenuItemsHash.value(tmpMerge)) { + const int mergeListSize = mergeList->size(); + + for (int i = 0; i < mergeListSize; ++i) { + const QMenuMergeItem &mergeItem = mergeList->at(i); + // Ideally we would call QCocoaMenu::syncAction, but that requires finding + // the original QMen and likely doing more work than we need. + // For example, enabled is handled below. + [mergeItem.menuItem setTag:reinterpret_cast( + static_cast(mergeItem.action->action))]; + [mergeItem.menuItem setHidden:!(mergeItem.action->action->isVisible())]; + } + } + } + // Check if menu is modally shaddowed and should be disabled: + modal = qt_mac_should_disable_menu(mb); + if (mb != qt_mac_current_menubar.qmenubar || modal != qt_mac_current_menubar.modal) + qt_mac_set_modal_state(menu, modal); + } + qt_mac_current_menubar.qmenubar = mb; + qt_mac_current_menubar.modal = modal; + ret = true; + } else if (qt_mac_current_menubar.qmenubar && qt_mac_current_menubar.qmenubar->isNativeMenuBar()) { + // INVARIANT: The currently active menu bar (if any) is not native. But we do have a + // native menu bar from before. So we need to decide whether or not is should be enabled: + const bool modal = qt_mac_should_disable_menu(qt_mac_current_menubar.qmenubar); + if (modal != qt_mac_current_menubar.modal) { + ret = true; + if (OSMenuRef menu = reinterpret_cast(qt_mac_current_menubar.qmenubar->platformMenuBar())->macMenu()) { + QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); + [loader ensureAppMenuInMenu:menu]; + [NSApp setMainMenu:menu]; + syncMenuBarItemsVisiblity(reinterpret_cast(qt_mac_current_menubar.qmenubar->platformMenuBar())); + qt_mac_set_modal_state(menu, modal); + } + qt_mac_current_menubar.modal = modal; + } + } + + if (!ret) { + qt_mac_clear_menubar(); + } + return ret; +} + +QHash QCocoaMenu::mergeMenuHash; +QHash QCocoaMenu::mergeMenuItemsHash; + +bool QCocoaMenu::merged(const QAction *action) const +{ + if (OSMenuRef merge = mergeMenuHash.value(menu)) { + if (QMenuMergeList *list = mergeMenuItemsHash.value(merge)) { + for(int i = 0; i < list->size(); ++i) { + const QMenuMergeItem &item = list->at(i); + if (item.action->action == action) + return true; + } + } + } + return false; +} + +//creation of the OSMenuRef +static OSMenuRef qt_mac_create_menu(QWidget *w) +{ + OSMenuRef ret; + if (QMenu *qmenu = qobject_cast(w)){ + ret = [[QT_MANGLE_NAMESPACE(QNativeCocoaMenu) alloc] initWithQMenu:qmenu]; + } else { + ret = [[NSMenu alloc] init]; + } + return ret; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 69a11134bd2..0b96928d5be 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -48,17 +48,18 @@ @interface QNSView : NSView { CGImageRef m_cgImage; - QWidget *m_widget; + QWindow *m_window; Qt::MouseButtons m_buttons; } - (id)init; -- (id)initWithWidget:(QWidget *)widget; +- (id)initWithQWindow:(QWindow *)window; - (void)setImage:(QImage *)image; - (void)drawRect:(NSRect)dirtyRect; - (BOOL)isFlipped; +- (BOOL)acceptsFirstResponder; - (void)handleMouseEvent:(NSEvent *)theEvent; - (void)mouseDown:(NSEvent *)theEvent; @@ -74,6 +75,12 @@ - (void)otherMouseDragged:(NSEvent *)theEvent; - (void)otherMouseUp:(NSEvent *)theEvent; +- (int) convertKeyCode : (QChar)keyCode; +- (Qt::KeyboardModifiers) convertKeyModifiers : (ulong)modifierFlags; +- (void)handleKeyEvent:(NSEvent *)theEvent eventType:(int)eventType; +- (void)keyDown:(NSEvent *)theEvent; +- (void)keyUp:(NSEvent *)theEvent; + @end #endif //QNSVIEW_H diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 037cbdb5d62..f3c71d9eed4 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -39,12 +39,20 @@ ** ****************************************************************************/ +#include + #include "qnsview.h" +#include "qcocoahelpers.h" #include - #include +@interface NSEvent (Qt_Compile_Leopard_DeviceDelta) + - (CGFloat)deviceDeltaX; + - (CGFloat)deviceDeltaY; + - (CGFloat)deviceDeltaZ; +@end + @implementation QNSView - (id) init @@ -52,16 +60,16 @@ self = [super init]; if (self) { m_cgImage = 0; - m_widget = 0; + m_window = 0; m_buttons = Qt::NoButton; } return self; } -- (id)initWithWidget:(QWidget *)widget { +- (id)initWithQWindow:(QWindow *)widget { self = [self init]; if (self) { - m_widget = widget; + m_window = widget; } return self; } @@ -91,7 +99,7 @@ bitDepth, bytesPrLine, cgColourSpaceRef, - kCGImageAlphaNone, + kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, cgDataProviderRef, NULL, false, @@ -130,82 +138,185 @@ return YES; } +- (BOOL)acceptsFirstResponder +{ + return YES; +} + - (void)handleMouseEvent:(NSEvent *)theEvent; { - NSPoint point = [self convertPoint: [theEvent locationInWindow] fromView: nil]; - QPoint qt_localPoint(point.x,point.y); + NSPoint windowPoint = [self convertPoint: [theEvent locationInWindow] fromView: nil]; + QPoint qt_windowPoint(windowPoint.x, windowPoint.y); NSTimeInterval timestamp = [theEvent timestamp]; ulong qt_timestamp = timestamp * 1000; - QWindowSystemInterface::handleMouseEvent(m_widget,qt_timestamp,qt_localPoint,QPoint(),m_buttons); - + // ### Should the points be windowPoint and screenPoint? + QWindowSystemInterface::handleMouseEvent(m_window, qt_timestamp, qt_windowPoint, qt_windowPoint, m_buttons); +} + +- (void)mouseDown:(NSEvent *)theEvent +{ + m_buttons |= Qt::LeftButton; + [self handleMouseEvent:theEvent]; +} + +- (void)mouseDragged:(NSEvent *)theEvent +{ + if (!(m_buttons & Qt::LeftButton)) + qWarning("Internal Mousebutton tracking invalid(missing Qt::LeftButton"); + [self handleMouseEvent:theEvent]; +} + +- (void)mouseUp:(NSEvent *)theEvent +{ + m_buttons &= QFlag(~int(Qt::LeftButton)); + [self handleMouseEvent:theEvent]; } - - (void)mouseDown:(NSEvent *)theEvent - { - m_buttons |= Qt::LeftButton; - [self handleMouseEvent:theEvent]; - } - - (void)mouseDragged:(NSEvent *)theEvent - { - if (!(m_buttons & Qt::LeftButton)) - qWarning("Internal Mousebutton tracking invalid(missing Qt::LeftButton"); - [self handleMouseEvent:theEvent]; - } - - (void)mouseUp:(NSEvent *)theEvent - { - m_buttons &= QFlag(~int(Qt::LeftButton)); - [self handleMouseEvent:theEvent]; - } - (void)mouseMoved:(NSEvent *)theEvent { - qDebug() << "mouseMove"; [self handleMouseEvent:theEvent]; } + - (void)mouseEntered:(NSEvent *)theEvent { - Q_UNUSED(theEvent); - QWindowSystemInterface::handleEnterEvent(m_widget); + Q_UNUSED(theEvent); + QWindowSystemInterface::handleEnterEvent(m_window); } + - (void)mouseExited:(NSEvent *)theEvent { - Q_UNUSED(theEvent); - QWindowSystemInterface::handleLeaveEvent(m_widget); + Q_UNUSED(theEvent); + QWindowSystemInterface::handleLeaveEvent(m_window); } + - (void)rightMouseDown:(NSEvent *)theEvent { - m_buttons |= Qt::RightButton; + m_buttons |= Qt::RightButton; [self handleMouseEvent:theEvent]; } + - (void)rightMouseDragged:(NSEvent *)theEvent { - if (!(m_buttons & Qt::LeftButton)) - qWarning("Internal Mousebutton tracking invalid(missing Qt::LeftButton"); - [self handleMouseEvent:theEvent]; -} -- (void)rightMouseUp:(NSEvent *)theEvent -{ - m_buttons &= QFlag(~int(Qt::RightButton)); - [self handleMouseEvent:theEvent]; -} -- (void)otherMouseDown:(NSEvent *)theEvent -{ - m_buttons |= Qt::RightButton; + if (!(m_buttons & Qt::LeftButton)) + qWarning("Internal Mousebutton tracking invalid(missing Qt::LeftButton"); [self handleMouseEvent:theEvent]; } + +- (void)rightMouseUp:(NSEvent *)theEvent +{ + m_buttons &= QFlag(~int(Qt::RightButton)); + [self handleMouseEvent:theEvent]; +} + +- (void)otherMouseDown:(NSEvent *)theEvent +{ + m_buttons |= Qt::RightButton; + [self handleMouseEvent:theEvent]; +} + - (void)otherMouseDragged:(NSEvent *)theEvent { - if (!(m_buttons & Qt::LeftButton)) - qWarning("Internal Mousebutton tracking invalid(missing Qt::LeftButton"); - [self handleMouseEvent:theEvent]; + if (!(m_buttons & Qt::LeftButton)) + qWarning("Internal Mousebutton tracking invalid(missing Qt::LeftButton"); + [self handleMouseEvent:theEvent]; } + - (void)otherMouseUp:(NSEvent *)theEvent { - m_buttons &= QFlag(~int(Qt::MiddleButton)); - [self handleMouseEvent:theEvent]; + m_buttons &= QFlag(~int(Qt::MiddleButton)); + [self handleMouseEvent:theEvent]; } +#ifndef QT_NO_WHEELEVENT +- (void)scrollWheel:(NSEvent *)theEvent +{ + int deltaX = 0; + int deltaY = 0; + int deltaZ = 0; + const EventRef carbonEvent = (EventRef)[theEvent eventRef]; + const UInt32 carbonEventKind = carbonEvent ? ::GetEventKind(carbonEvent) : 0; + const bool scrollEvent = carbonEventKind == kEventMouseScroll; + + if (scrollEvent) { + // The mouse device containts pixel scroll wheel support (Mighty Mouse, Trackpad). + // Since deviceDelta is delivered as pixels rather than degrees, we need to + // convert from pixels to degrees in a sensible manner. + // It looks like 1/4 degrees per pixel behaves most native. + // (NB: Qt expects the unit for delta to be 8 per degree): + const int pixelsToDegrees = 2; // 8 * 1/4 + deltaX = [theEvent deviceDeltaX] * pixelsToDegrees; + deltaY = [theEvent deviceDeltaY] * pixelsToDegrees; + deltaZ = [theEvent deviceDeltaZ] * pixelsToDegrees; + } else { + // carbonEventKind == kEventMouseWheelMoved + // Remove acceleration, and use either -120 or 120 as delta: + deltaX = qBound(-120, int([theEvent deltaX] * 10000), 120); + deltaY = qBound(-120, int([theEvent deltaY] * 10000), 120); + deltaZ = qBound(-120, int([theEvent deltaZ] * 10000), 120); + } + + NSPoint windowPoint = [self convertPoint: [theEvent locationInWindow] fromView: nil]; + QPoint qt_windowPoint(windowPoint.x, windowPoint.y); + NSTimeInterval timestamp = [theEvent timestamp]; + ulong qt_timestamp = timestamp * 1000; + + if (deltaX != 0) + QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_windowPoint, deltaX, Qt::Horizontal); + + if (deltaY != 0) + QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_windowPoint, deltaY, Qt::Vertical); + + if (deltaZ != 0) + // Qt doesn't explicitly support wheels with a Z component. In a misguided attempt to + // try to be ahead of the pack, I'm adding this extra value. + QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_windowPoint, deltaY, (Qt::Orientation)3); +} +#endif //QT_NO_WHEELEVENT + +- (int) convertKeyCode : (QChar)keyChar +{ + return qt_mac_cocoaKey2QtKey(keyChar); +} + +- (Qt::KeyboardModifiers) convertKeyModifiers : (ulong)modifierFlags +{ + Qt::KeyboardModifiers qtMods =Qt::NoModifier; + if (modifierFlags & NSShiftKeyMask) + qtMods |= Qt::ShiftModifier; + if (modifierFlags & NSControlKeyMask) + qtMods |= Qt::MetaModifier; + if (modifierFlags & NSAlternateKeyMask) + qtMods |= Qt::AltModifier; + if (modifierFlags & NSCommandKeyMask) + qtMods |= Qt::ControlModifier; + if (modifierFlags & NSNumericPadKeyMask) + qtMods |= Qt::KeypadModifier; + return qtMods; +} + +- (void)handleKeyEvent:(NSEvent *)theEvent eventType:(int)eventType +{ + NSTimeInterval timestamp = [theEvent timestamp]; + ulong qt_timestamp = timestamp * 1000; + QString characters = QString::fromUtf8([[theEvent characters] UTF8String]); + Qt::KeyboardModifiers modifiers = [self convertKeyModifiers : [theEvent modifierFlags]]; + QChar ch([[theEvent charactersIgnoringModifiers] characterAtIndex:0]); + int keyCode = [self convertKeyCode : ch]; + + QWindowSystemInterface::handleKeyEvent(m_window, qt_timestamp, QEvent::Type(eventType), keyCode, modifiers, characters); +} + +- (void)keyDown:(NSEvent *)theEvent +{ + [self handleKeyEvent : theEvent eventType :int(QEvent::KeyPress)]; +} + +- (void)keyUp:(NSEvent *)theEvent +{ + [self handleKeyEvent : theEvent eventType :int(QEvent::KeyRelease)]; +} @end diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h index cf296c4a8b8..5cd226a71d3 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.h +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h @@ -46,6 +46,26 @@ #include "qcocoawindow.h" +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 +@protocol NSWindowDelegate +//- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize; +//- (void)windowDidMiniaturize:(NSNotification*)notification; +- (void)windowDidResize:(NSNotification *)notification; +- (void)windowWillClose:(NSNotification *)notification; +//- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)defaultFrame; +- (void)windowDidMove:(NSNotification *)notification; +//- (BOOL)windowShouldClose:(id)window; +//- (void)windowDidDeminiaturize:(NSNotification *)notification; +//- (void)windowDidBecomeMain:(NSNotification*)notification; +//- (void)windowDidResignMain:(NSNotification*)notification; +//- (void)windowDidBecomeKey:(NSNotification*)notification; +//- (void)windowDidResignKey:(NSNotification*)notification; +//- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu; +//- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard; +//- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; +@end +#endif + @interface QNSWindowDelegate : NSObject { QCocoaWindow *m_cocoaWindow; @@ -54,6 +74,7 @@ - (id)initWithQCocoaWindow: (QCocoaWindow *) cocoaWindow; - (void)windowDidResize:(NSNotification *)notification; +- (void)windowDidMove:(NSNotification *)notification; - (void)windowWillClose:(NSNotification *)notification; @end diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index 887b08f6d20..869ef7840b8 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -64,10 +64,20 @@ } } +- (void)windowDidMove:(NSNotification *)notification +{ + Q_UNUSED(notification); + if (m_cocoaWindow) { + m_cocoaWindow->windowDidMove(); + } +} + - (void)windowWillClose:(NSNotification *)notification { Q_UNUSED(notification); - QWindowSystemInterface::handleCloseEvent(m_cocoaWindow->widget()); + if (m_cocoaWindow) { + m_cocoaWindow->windowWillClose(); + } } @end diff --git a/src/gui/mac/qt_menu.nib/classes.nib b/src/plugins/platforms/cocoa/qt_menu.nib/classes.nib similarity index 100% rename from src/gui/mac/qt_menu.nib/classes.nib rename to src/plugins/platforms/cocoa/qt_menu.nib/classes.nib diff --git a/src/gui/mac/qt_menu.nib/info.nib b/src/plugins/platforms/cocoa/qt_menu.nib/info.nib similarity index 100% rename from src/gui/mac/qt_menu.nib/info.nib rename to src/plugins/platforms/cocoa/qt_menu.nib/info.nib diff --git a/src/gui/mac/qt_menu.nib/keyedobjects.nib b/src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib similarity index 100% rename from src/gui/mac/qt_menu.nib/keyedobjects.nib rename to src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index f830177dcb4..e516fb11f3c 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -2,6 +2,8 @@ TARGET = qdirectfb load(qt_plugin) DESTDIR = $$QT.gui.plugins/platforms +QT += core-private gui-private platformsupport-private + isEmpty(DIRECTFB_LIBS) { DIRECTFB_LIBS = -ldirectfb -lfusion -ldirect -lpthread } @@ -19,16 +21,16 @@ SOURCES = main.cpp \ qdirectfbconvenience.cpp \ qdirectfbinput.cpp \ qdirectfbcursor.cpp \ - qdirectfbwindow.cpp \ - qdirectfbglcontext.cpp + qdirectfbwindow.cpp HEADERS = qdirectfbintegration.h \ qdirectfbwindowsurface.h \ qdirectfbblitter.h \ qdirectfbconvenience.h \ qdirectfbinput.h \ qdirectfbcursor.h \ - qdirectfbwindow.h \ - qdirectfbglcontext.h + qdirectfbwindow.h + +# ### port the GL context include(../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp index 86a8bf7cb74..a4da2d81426 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp +++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp @@ -92,10 +92,10 @@ void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &srcRect) { - QPixmapData *data = pixmap.pixmapData(); + QPlatformPixmap *data = pixmap.handle(); Q_ASSERT(data->width() && data->height()); - Q_ASSERT(data->classId() == QPixmapData::BlitterClass); - QBlittablePixmapData *blitPm = static_cast(data); + Q_ASSERT(data->classId() == QPlatformPixmap::BlitterClass); + QBlittablePlatformPixmap *blitPm = static_cast(data); QDirectFbBlitter *dfbBlitter = static_cast(blitPm->blittable()); dfbBlitter->unlock(); diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h index 16d7599c83f..2dcb2be07af 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.h +++ b/src/plugins/platforms/directfb/qdirectfbblitter.h @@ -67,7 +67,7 @@ protected: friend class QDirectFbConvenience; }; -class QDirectFbBlitterPixmapData : public QBlittablePixmapData +class QDirectFbBlitterPlatformPixmap : public QBlittablePlatformPixmap { public: QBlittable *createBlittable(const QSize &size) const { return new QDirectFbBlitter(size); } diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp index 37810dc461b..38130c8debb 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp @@ -106,9 +106,9 @@ int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat forma return ((0x1f << 7) & format) >> 7; } -IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData) +IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPlatformPixmap(QPlatformPixmap *handle) { - QBlittablePixmapData *blittablePmData = static_cast(pixmapData); + QBlittablePlatformPixmap *blittablePmData = static_cast(handle); if (blittablePmData) { QBlittable *blittable = blittablePmData->blittable(); QDirectFbBlitter *dfbBlitter = static_cast(blittable); diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.h b/src/plugins/platforms/directfb/qdirectfbconvenience.h index c82bea84c7d..93d47f3644b 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.h +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.h @@ -67,7 +67,7 @@ public: static IDirectFB *dfbInterface(); static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); - static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); + static IDirectFBSurface *dfbSurfaceForPlatformPixmap(QPlatformPixmap *); static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp index 8a38bc4e83c..b39a3f3c0a8 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.cpp +++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp @@ -43,25 +43,26 @@ #include "qdirectfbconvenience.h" -QDirectFBCursor::QDirectFBCursor(QPlatformScreen* screen) : - QPlatformCursor(screen), surface(0) +QDirectFBCursor::QDirectFBCursor(QPlatformScreen *screen) + : QPlatformCursor(screen) { QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY, &m_layer); - image = new QPlatformCursorImage(0, 0, 0, 0, 0, 0); + m_image = new QPlatformCursorImage(0, 0, 0, 0, 0, 0); } -void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) +#warning "Memory leak?" + +void QDirectFBCursor::changeCursor(QCursor *cursor, QWindow *) { - 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(); + m_image->set(cursor->shape()); + xSpot = m_image->hotspot().x(); + ySpot = m_image->hotspot().y(); + QImage *i = m_image->image(); map = QPixmap::fromImage(*i); } else { QPoint point = cursor->hotSpot(); @@ -70,7 +71,7 @@ void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) map = cursor->pixmap(); } - IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData()); + IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPlatformPixmap(map.handle()); if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { return; diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.h b/src/plugins/platforms/directfb/qdirectfbcursor.h index b148de55893..22328da402c 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.h +++ b/src/plugins/platforms/directfb/qdirectfbcursor.h @@ -51,13 +51,11 @@ class QDirectFBCursor : public QPlatformCursor { public: QDirectFBCursor(QPlatformScreen *screem); - void changeCursor(QCursor * cursor, QWidget * widget); + void changeCursor(QCursor *cursor, QWindow *window); private: - IDirectFBDisplayLayer * m_layer; - IDirectFBSurface * surface; - QPlatformCursorImage * image; - QDirectFbBlitter *blitter; + IDirectFBDisplayLayer *m_layer; + QPlatformCursorImage *m_image; }; #endif // QDIRECTFBCURSOR_H diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp index aca28f1d620..1121a429443 100644 --- a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp +++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp @@ -70,13 +70,13 @@ QDirectFbGLContext::QDirectFbGLContext(IDirectFBGL *glContext) void QDirectFbGLContext::makeCurrent() { - QPlatformGLContext::makeCurrent(); + QPlatformOpenGLContext::makeCurrent(); m_dfbGlContext->Lock(m_dfbGlContext); } void QDirectFbGLContext::doneCurrent() { - QPlatformGLContext::doneCurrent(); + QPlatformOpenGLContext::doneCurrent(); m_dfbGlContext->Unlock(m_dfbGlContext); } diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.h b/src/plugins/platforms/directfb/qdirectfbglcontext.h index bff8b28d08c..97bab0dcb08 100644 --- a/src/plugins/platforms/directfb/qdirectfbglcontext.h +++ b/src/plugins/platforms/directfb/qdirectfbglcontext.h @@ -42,11 +42,11 @@ #ifndef QDIRECTFBGLCONTEXT_H #define QDIRECTFBGLCONTEXT_H -#include +#include #include "qdirectfbconvenience.h" -class QDirectFbGLContext : public QPlatformGLContext +class QDirectFbGLContext : public QPlatformOpenGLContext { public: explicit QDirectFbGLContext(IDirectFBGL *glContext); diff --git a/src/plugins/platforms/directfb/qdirectfbinput.cpp b/src/plugins/platforms/directfb/qdirectfbinput.cpp index d35cea5ee9e..d05729b992a 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.cpp +++ b/src/plugins/platforms/directfb/qdirectfbinput.cpp @@ -47,7 +47,6 @@ #include #include #include -#include #include @@ -82,9 +81,9 @@ void QDirectFbInput::stopInputEventLoop() m_waitStop.acquire(); } -void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) +void QDirectFbInput::addWindow(DFBWindowID id, QWindow *qt_window) { - m_tlwMap.insert(id,tlw); + m_tlwMap.insert(id,qt_window); IDirectFBWindow *window; m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer,id,&window); @@ -152,7 +151,7 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) } else if (event.window.type == DWET_BUTTONUP) { window->UngrabPointer(window); } - QWidget *tlw = m_tlwMap.value(event.window.window_id); + QWindow *tlw = m_tlwMap.value(event.window.window_id); QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons); } @@ -161,7 +160,7 @@ 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 = m_tlwMap.value(event.window.window_id); + QWindow *tlw = m_tlwMap.value(event.window.window_id); QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos, event.window.step*120, Qt::Vertical); @@ -178,13 +177,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 = m_tlwMap.value(event.window.window_id); + QWindow *tlw = m_tlwMap.value(event.window.window_id); QWindowSystemInterface::handleKeyEvent(tlw, timestamp, type, key, modifiers, character); } void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) { - QWidget *tlw = m_tlwMap.value(event.window.window_id); + QWindow *tlw = m_tlwMap.value(event.window.window_id); switch (event.window.type) { case DWET_ENTER: QWindowSystemInterface::handleEnterEvent(tlw); diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h index 3b8008f1fe7..b0fe0c79eb7 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.h +++ b/src/plugins/platforms/directfb/qdirectfbinput.h @@ -57,7 +57,7 @@ class QDirectFbInput : public QObject Q_OBJECT public: QDirectFbInput(QObject *parent); - void addWindow(DFBWindowID id, QWidget *tlw); + void addWindow(DFBWindowID id, QWindow *window); void removeWindow(WId wId); public slots: @@ -80,7 +80,7 @@ private: bool m_shouldStop; QSemaphore m_waitStop; - QHashm_tlwMap; + QHashm_tlwMap; }; #endif // QDIRECTFBINPUT_H diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index 61f1d2513ba..7bf26b433a3 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -46,20 +46,21 @@ #include "qdirectfbcursor.h" #include "qdirectfbwindow.h" -#include "qgenericunixfontdatabase.h" - -#include -#include +#include +#include #include -#include +#include +#include +#include #include #include +#include QT_BEGIN_NAMESPACE QDirectFbScreen::QDirectFbScreen(int display) - :QPlatformScreen() + : QPlatformScreen() { m_layer = QDirectFbConvenience::dfbDisplayLayer(display); m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); @@ -74,16 +75,20 @@ QDirectFbScreen::QDirectFbScreen(int display) m_depth = QDirectFbConvenience::colorDepthForSurface(config.pixelformat); m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); - cursor = new QDirectFBCursor(this); + m_cursor = new QDirectFBCursor(this); } QDirectFbScreen::~QDirectFbScreen() { +#warning "Delete the cursor?" } QDirectFbIntegration::QDirectFbIntegration() - : mFontDb(new QGenericUnixFontDatabase()) + : m_fontDb(new QGenericUnixFontDatabase()) + , m_eventDispatcher(createUnixEventDispatcher()) { + QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); + const QStringList args = QCoreApplication::arguments(); int argc = args.size(); char **argv = new char*[argc]; @@ -99,46 +104,51 @@ 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(); + QDirectFbScreen *primaryScreen = new QDirectFbScreen(0); + screenAdded(primaryScreen); + + m_inputRunner = new QThread; + m_input = new QDirectFbInput(0); + m_input->moveToThread(m_inputRunner); + QObject::connect(m_inputRunner,SIGNAL(started()),m_input,SLOT(runInputEventLoop())); + m_inputRunner->start(); } QDirectFbIntegration::~QDirectFbIntegration() { - mInput->stopInputEventLoop(); - delete mInputRunner; - delete mInput; + m_input->stopInputEventLoop(); + delete m_inputRunner; + delete m_input; } -QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QDirectFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - if (type == QPixmapData::BitmapType) - return new QRasterPixmapData(type); + if (type == QPlatformPixmap::BitmapType) + return new QRasterPlatformPixmap(type); else - return new QDirectFbBlitterPixmapData; + return new QDirectFbBlitterPlatformPixmap; } -QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const +QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWindow *window) const { - Q_UNUSED(winId); - QDirectFbInput *input = const_cast(mInput);//gah - return new QDirectFbWindow(widget,input); + QDirectFbInput *input = const_cast(m_input);//gah + return new QDirectFbWindow(window,input); } -QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *widget, WId winId) const +QAbstractEventDispatcher *QDirectFbIntegration::guiThreadEventDispatcher() const { - return new QDirectFbWindowSurface(widget,winId); + return m_eventDispatcher; +} + +QPlatformBackingStore *QDirectFbIntegration::createPlatformBackingStore(QWindow *window) const +{ + return new QDirectFbWindowSurface(window); } QPlatformFontDatabase *QDirectFbIntegration::fontDatabase() const { - return mFontDb; + return m_fontDb; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h index 0e8337a5fb4..64f3b6005a7 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.h +++ b/src/plugins/platforms/directfb/qdirectfbintegration.h @@ -51,11 +51,11 @@ QT_BEGIN_NAMESPACE class QThread; +class QAbstractEventDispatcher; class QDirectFBCursor; class QDirectFbScreen : public QPlatformScreen { -Q_OBJECT public: QDirectFbScreen(int display); ~QDirectFbScreen(); @@ -74,8 +74,7 @@ public: IDirectFBDisplayLayer *m_layer; private: - QDirectFBCursor * cursor; - + QDirectFBCursor *m_cursor; }; class QDirectFbIntegration : public QPlatformIntegration @@ -84,19 +83,18 @@ public: QDirectFbIntegration(); ~QDirectFbIntegration(); - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - - QList screens() const { return mScreens; } + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QAbstractEventDispatcher *guiThreadEventDispatcher() const; QPlatformFontDatabase *fontDatabase() const; private: - QList mScreens; - QDirectFbInput *mInput; - QThread *mInputRunner; - QPlatformFontDatabase *mFontDb; + QDirectFbInput *m_input; + QThread *m_inputRunner; + QPlatformFontDatabase *m_fontDb; + QAbstractEventDispatcher *m_eventDispatcher; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp index d2c411eaeb2..e75291b5c1f 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -41,16 +41,13 @@ #include "qdirectfbwindow.h" #include "qdirectfbinput.h" -#include "qdirectfbglcontext.h" - -#include #include "qdirectfbwindowsurface.h" #include -QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler) - : QPlatformWindow(tlw), m_inputHandler(inputhandler), m_context(0) +QDirectFbWindow::QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler) + : QPlatformWindow(tlw), m_inputHandler(inputhandler) { IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); DFBDisplayLayerConfig layerConfig; @@ -63,10 +60,10 @@ QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler) |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(); + description.width = tlw->width(); + description.height = tlw->height(); + description.posx = tlw->x(); + description.posy = tlw->y(); if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED) description.surface_caps = DSCAPS_PREMULTIPLIED; @@ -85,7 +82,7 @@ QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler) m_dfbWindow->SetOpacity(m_dfbWindow,0xff); - setVisible(widget()->isVisible()); + setVisible(window()->visible()); DFBWindowID id; m_dfbWindow->GetID(m_dfbWindow, &id); @@ -100,17 +97,20 @@ QDirectFbWindow::~QDirectFbWindow() void QDirectFbWindow::setGeometry(const QRect &rect) { - bool isMoveOnly = (rect.topLeft() != geometry().topLeft()) && (rect.size() == geometry().size()); +// bool isMoveOnly = (rect.topLeft() != geometry().topLeft()) && (rect.size() == geometry().size()); + QPlatformWindow::setGeometry(rect); - if (widget()->isVisible() && !(widget()->testAttribute(Qt::WA_DontShowOnScreen))) { + if (window()->visible()) { m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), rect.width(), rect.height()); - +// ### TODO port, verify if this is needed +#if 0 //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(); + window()->update(); } +#endif } } @@ -169,23 +169,3 @@ 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 4f839a05faf..4c9bbaaab5e 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.h +++ b/src/plugins/platforms/directfb/qdirectfbwindow.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QDirectFbWindow : public QPlatformWindow { public: - QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler); + QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler); ~QDirectFbWindow(); void setGeometry(const QRect &rect); @@ -65,13 +65,9 @@ public: void lower(); WId winId() const; - QPlatformGLContext *glContext() const; - private: IDirectFBWindow *m_dfbWindow; QDirectFbInput *m_inputHandler; - - QPlatformGLContext *m_context; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp index 730f01fa1be..ab355c48f45 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp @@ -49,21 +49,21 @@ QT_BEGIN_NAMESPACE -QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId) - : QWindowSurface(window), m_pixmap(0), m_pmdata(0), m_dfbSurface(0) +QDirectFbWindowSurface::QDirectFbWindowSurface(QWindow *window) + : QPlatformBackingStore(window), m_pixmap(0), m_pmdata(0), m_dfbSurface(0) { IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); - DFBWindowID id(wId); + DFBWindowID id(window->winId()); 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 QDirectFbBlitterPixmapData; + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->size(), m_dfbSurface); + m_pmdata = new QDirectFbBlitterPlatformPixmap; m_pmdata->setBlittable(blitter); m_pixmap = new QPixmap(m_pmdata); } @@ -78,9 +78,8 @@ QPaintDevice *QDirectFbWindowSurface::paintDevice() return m_pixmap; } -void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QDirectFbWindowSurface::flush(QWindow *, const QRegion ®ion, const QPoint &offset) { - Q_UNUSED(widget); m_pmdata->blittable()->unlock(); QVector rects = region.rects(); @@ -91,9 +90,9 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const } } -void QDirectFbWindowSurface::resize(const QSize &size) +void QDirectFbWindowSurface::resize(const QSize &size, const QRegion& reg) { - QWindowSurface::resize(size); + QPlatformBackingStore::resize(size, reg); //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable m_dfbSurface->AddRef(m_dfbSurface); diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.h b/src/plugins/platforms/directfb/qdirectfbwindowsurface.h index 7f1140d4eb7..2b6cb58aef7 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.h @@ -42,22 +42,22 @@ #ifndef QWINDOWSURFACE_DIRECTFB_H #define QWINDOWSURFACE_DIRECTFB_H -#include +#include #include #include QT_BEGIN_NAMESPACE -class QDirectFbWindowSurface : public QWindowSurface +class QDirectFbWindowSurface : public QPlatformBackingStore { public: - QDirectFbWindowSurface(QWidget *window, WId wid); + QDirectFbWindowSurface(QWindow *window); ~QDirectFbWindowSurface(); QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize (const QSize &size); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize (const QSize &size, const QRegion &staticContents); bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion ®ion); @@ -67,7 +67,7 @@ private: void lockSurfaceToImage(); QPixmap *m_pixmap; - QBlittablePixmapData *m_pmdata; + QBlittablePlatformPixmap *m_pmdata; IDirectFBSurface *m_dfbSurface; }; diff --git a/src/plugins/platforms/eglconvenience/eglconvenience.pri b/src/plugins/platforms/eglconvenience/eglconvenience.pri deleted file mode 100644 index 322d4e4633d..00000000000 --- a/src/plugins/platforms/eglconvenience/eglconvenience.pri +++ /dev/null @@ -1,7 +0,0 @@ -INCLUDEPATH += $$PWD - -SOURCES += \ - $$PWD/qeglconvenience.cpp - -HEADERS += \ - $$PWD/qeglconvenience.h diff --git a/src/plugins/platforms/eglconvenience/xlibeglintegration.pri b/src/plugins/platforms/eglconvenience/xlibeglintegration.pri deleted file mode 100644 index 9404a703732..00000000000 --- a/src/plugins/platforms/eglconvenience/xlibeglintegration.pri +++ /dev/null @@ -1,7 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/qxlibeglintegration.h - -SOURCES += \ - $$PWD/qxlibeglintegration.cpp diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro index 471cf63dd8e..73698322dd1 100644 --- a/src/plugins/platforms/eglfs/eglfs.pro +++ b/src/plugins/platforms/eglfs/eglfs.pro @@ -2,7 +2,7 @@ TARGET = qeglfs TEMPLATE = lib CONFIG += plugin -QT += opengl core-private gui-private opengl-private +QT += opengl core-private gui-private opengl-private platformsupport-private widgets-private DESTDIR = $$QT.gui.plugins/platforms @@ -12,20 +12,16 @@ DESTDIR = $$QT.gui.plugins/platforms SOURCES = main.cpp \ qeglfsintegration.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - ../eglconvenience/qeglplatformcontext.cpp \ qeglfswindow.cpp \ - qeglfswindowsurface.cpp \ + qeglfsbackingstore.cpp \ qeglfsscreen.cpp HEADERS = qeglfsintegration.h \ - ../eglconvenience/qeglconvenience.h \ - ../eglconvenience/qeglplatformcontext.h \ qeglfswindow.h \ - qeglfswindowsurface.h \ + qeglfsbackingstore.h \ qeglfsscreen.h -include(../fontdatabases/genericunix/genericunix.pri) +include(../../../platformsupport/fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp similarity index 72% rename from src/plugins/platforms/eglfs/qeglfswindowsurface.cpp rename to src/plugins/platforms/eglfs/qeglfsbackingstore.cpp index 970402015fa..1d27be7fb34 100644 --- a/src/plugins/platforms/eglfs/qeglfswindowsurface.cpp +++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.cpp @@ -39,11 +39,13 @@ ** ****************************************************************************/ -#include "qeglfswindowsurface.h" - -#include - #include + +#include "qeglfsbackingstore.h" + +#include +#include + #include QT_BEGIN_NAMESPACE @@ -51,16 +53,16 @@ QT_BEGIN_NAMESPACE class QEglFSPaintDevice : public QGLPaintDevice { public: - QEglFSPaintDevice(QEglFSScreen *screen, QWidget *widget) + QEglFSPaintDevice(QEglFSScreen *screen) :QGLPaintDevice(), m_screen(screen) { #ifdef QEGL_EXTRA_DEBUG - qWarning("QEglPaintDevice %p, %p, %p",this, screen, widget); + qWarning("QEglPaintDevice %p, %p",this, screen); #endif } QSize size() const { return m_screen->geometry().size(); } - QGLContext* context() const { return QGLContext::fromPlatformGLContext(m_screen->platformContext());} + QGLContext* context() const { return QGLContext::fromOpenGLContext(m_screen->platformContext()->context()); } QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); } @@ -73,29 +75,30 @@ private: }; -QEglFSWindowSurface::QEglFSWindowSurface( QEglFSScreen *screen, QWidget *window ) - :QWindowSurface(window) +QEglFSBackingStore::QEglFSBackingStore(QWindow *window) + : QPlatformBackingStore(window) { #ifdef QEGL_EXTRA_DEBUG - qWarning("QEglWindowSurface %p, %p", window, screen); + qWarning("QEglBackingStore %p, %p", window, screen); #endif - m_paintDevice = new QEglFSPaintDevice(screen,window); + m_paintDevice = new QEglFSPaintDevice(static_cast(window->screen()->handle())); } -void QEglFSWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QEglFSBackingStore::flush(QWindow *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); + qWarning("QEglBackingStore::flush %p",widget); #endif - widget->platformWindow()->glContext()->swapBuffers(); + static_cast(m_paintDevice)->context()->swapBuffers(); } -void QEglFSWindowSurface::resize(const QSize &size) +void QEglFSBackingStore::resize(const QSize &size, const QRegion &staticContents) { Q_UNUSED(size); + Q_UNUSED(staticContents); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfswindowsurface.h b/src/plugins/platforms/eglfs/qeglfsbackingstore.h similarity index 86% rename from src/plugins/platforms/eglfs/qeglfswindowsurface.h rename to src/plugins/platforms/eglfs/qeglfsbackingstore.h index 9ce8fd4f53d..d6a28a76657 100644 --- a/src/plugins/platforms/eglfs/qeglfswindowsurface.h +++ b/src/plugins/platforms/eglfs/qeglfsbackingstore.h @@ -45,19 +45,20 @@ #include "qeglfsintegration.h" #include "qeglfswindow.h" -#include +#include QT_BEGIN_NAMESPACE -class QEglFSWindowSurface : public QWindowSurface +class QEglFSBackingStore : public QPlatformBackingStore { public: - QEglFSWindowSurface(QEglFSScreen *screen, QWidget *window); - ~QEglFSWindowSurface() {} + QEglFSBackingStore(QWindow *window); + ~QEglFSBackingStore() {} QPaintDevice *paintDevice() { return m_paintDevice; } - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size, const QRegion &staticContents); + private: QPaintDevice *m_paintDevice; }; diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 9e8596f19ed..3d3e05d3512 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -42,13 +42,15 @@ #include "qeglfsintegration.h" #include "qeglfswindow.h" -#include "qeglfswindowsurface.h" +#include "qeglfsbackingstore.h" -#include "qgenericunixfontdatabase.h" +#include +#include #include -#include -#include +#include +#include +#include #include @@ -57,9 +59,8 @@ QT_BEGIN_NAMESPACE QEglFSIntegration::QEglFSIntegration() : mFontDb(new QGenericUnixFontDatabase()) { - m_primaryScreen = new QEglFSScreen(EGL_DEFAULT_DISPLAY); + screenAdded(new QEglFSScreen(EGL_DEFAULT_DISPLAY)); - mScreens.append(m_primaryScreen); #ifdef QEGL_EXTRA_DEBUG qWarning("QEglIntegration\n"); #endif @@ -69,36 +70,32 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons { switch (cap) { case ThreadedPixmaps: return true; + case OpenGL: return true; + case ThreadedOpenGL: return true; default: return QPlatformIntegration::hasCapability(cap); } } -QPixmapData *QEglFSIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const { #ifdef QEGL_EXTRA_DEBUG - qWarning("QEglIntegration::createPixmapData %d\n", type); + qWarning("QEglIntegration::createPlatformWindow %p\n",window); #endif - return new QRasterPixmapData(type); -} - -QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWidget *widget, WId winId) const -{ - Q_UNUSED(winId); -#ifdef QEGL_EXTRA_DEBUG - qWarning("QEglIntegration::createPlatformWindow %p\n",widget); -#endif - return new QEglFSWindow(widget, m_primaryScreen); + return new QEglFSWindow(window); } -QWindowSurface *QEglFSIntegration::createWindowSurface(QWidget *widget, WId winId) const +QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *window) const { - Q_UNUSED(winId); - #ifdef QEGL_EXTRA_DEBUG qWarning("QEglIntegration::createWindowSurface %p\n",widget); #endif - return new QEglFSWindowSurface(m_primaryScreen,widget); + return new QEglFSBackingStore(window); +} + +QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const +{ + return static_cast(context->screen()->handle())->platformContext(); } QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const @@ -106,4 +103,9 @@ QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const return mFontDb; } +QAbstractEventDispatcher *QEglFSIntegration::guiThreadEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index 6252a9c0e41..9538850faf5 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -57,18 +57,17 @@ public: QEglFSIntegration(); bool hasCapability(QPlatformIntegration::Capability cap) const; - 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; } + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; QPlatformFontDatabase *fontDatabase() const; + QAbstractEventDispatcher *guiThreadEventDispatcher() const; + private: QPlatformFontDatabase *mFontDb; - QList mScreens; - QEglFSScreen *m_primaryScreen; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index 42195364aeb..6f317a375f4 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -40,9 +40,10 @@ ****************************************************************************/ #include "qeglfsscreen.h" +#include "qeglfswindow.h" -#include "../eglconvenience/qeglconvenience.h" -#include "../eglconvenience/qeglplatformcontext.h" +#include +#include #ifdef Q_OPENKODE #include @@ -86,6 +87,23 @@ static struct AttrInfo attrs[] = { {-1, 0}}; #endif //QEGL_EXTRA_DEBUG +class QEglFSContext : public QEGLPlatformContext +{ +public: + QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, + EGLint eglClientVersion = 2, EGLenum eglApi = EGL_OPENGL_ES_API) + : QEGLPlatformContext(format, share, display, eglClientVersion, eglApi) + { + } + + EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) + { + QEglFSWindow *window = static_cast(surface); + QEglFSScreen *screen = static_cast(window->screen()); + return screen->surface(); + } +}; + QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display) : m_depth(32) , m_format(QImage::Format_Invalid) @@ -136,32 +154,29 @@ void QEglFSScreen::createAndSetPlatformContext() const { void QEglFSScreen::createAndSetPlatformContext() { - QPlatformWindowFormat platformFormat = QPlatformWindowFormat::defaultFormat(); - - platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL); + QSurfaceFormat platformFormat; QByteArray depthString = qgetenv("QT_QPA_EGLFS_DEPTH"); if (depthString.toInt() == 16) { - platformFormat.setDepth(16); + platformFormat.setDepthBufferSize(16); platformFormat.setRedBufferSize(5); platformFormat.setGreenBufferSize(6); platformFormat.setBlueBufferSize(5); m_depth = 16; m_format = QImage::Format_RGB16; } else { - platformFormat.setDepth(32); + platformFormat.setDepthBufferSize(32); platformFormat.setRedBufferSize(8); platformFormat.setGreenBufferSize(8); platformFormat.setBlueBufferSize(8); m_depth = 32; m_format = QImage::Format_RGB32; } - if (!qgetenv("QT_QPA_EGLFS_MULTISAMPLE").isEmpty()) { - platformFormat.setSampleBuffers(true); - } + if (!qgetenv("QT_QPA_EGLFS_MULTISAMPLE").isEmpty()) + platformFormat.setSamples(4); - EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat); + EGLConfig config = q_configFromGLFormat(m_dpy, platformFormat); EGLNativeWindowType eglWindow = 0; #ifdef Q_OPENKODE @@ -193,16 +208,7 @@ void QEglFSScreen::createAndSetPlatformContext() 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; - - QEGLPlatformContext *platformContext = new QEGLPlatformContext(m_dpy,config,attribList,m_surface,EGL_OPENGL_ES_API); + QEGLPlatformContext *platformContext = new QEglFSContext(platformFormat, 0, m_dpy); m_platformContext = platformContext; EGLint w,h; // screen size detection @@ -232,7 +238,7 @@ QImage::Format QEglFSScreen::format() const createAndSetPlatformContext(); return m_format; } -QPlatformGLContext *QEglFSScreen::platformContext() const +QPlatformOpenGLContext *QEglFSScreen::platformContext() const { if (!m_platformContext) { QEglFSScreen *that = const_cast(this); diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.h b/src/plugins/platforms/eglfs/qeglfsscreen.h index 5cf1daca6f3..41465d871c4 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.h +++ b/src/plugins/platforms/eglfs/qeglfsscreen.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE -class QPlatformGLContext; +class QPlatformOpenGLContext; class QEglFSScreen : public QPlatformScreen //huh: FullScreenScreen ;) just to follow namespace { @@ -62,7 +62,9 @@ public: int depth() const; QImage::Format format() const; - QPlatformGLContext *platformContext() const; + QPlatformOpenGLContext *platformContext() const; + + EGLSurface surface() const { return m_surface; } private: void createAndSetPlatformContext() const; @@ -71,7 +73,7 @@ private: QRect m_geometry; int m_depth; QImage::Format m_format; - QPlatformGLContext *m_platformContext; + QPlatformOpenGLContext *m_platformContext; EGLDisplay m_dpy; EGLSurface m_surface; }; diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index 24b17b75e75..a6115cc8290 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -45,25 +45,26 @@ QT_BEGIN_NAMESPACE -QEglFSWindow::QEglFSWindow(QWidget *w, QEglFSScreen *screen) - : QPlatformWindow(w), m_screen(screen) +QEglFSWindow::QEglFSWindow(QWindow *w) + : QPlatformWindow(w) { 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)); + qWarning("QEglWindow %p: %p 0x%x\n", this, w, uint(m_winid)); #endif -} + QRect screenGeometry(screen()->availableGeometry()); + if (w->geometry() != screenGeometry) { + QWindowSystemInterface::handleGeometryChange(w, screenGeometry); + } +} void QEglFSWindow::setGeometry(const QRect &) { // We only support full-screen windows - QRect rect(m_screen->availableGeometry()); - QWindowSystemInterface::handleGeometryChange(this->widget(), rect); - - // Since toplevels are fullscreen, propegate the screen size back to the widget - widget()->setGeometry(rect); + QRect rect(screen()->availableGeometry()); + QWindowSystemInterface::handleGeometryChange(window(), rect); QPlatformWindow::setGeometry(rect); } @@ -73,15 +74,4 @@ WId QEglFSWindow::winId() const return m_winid; } - - -QPlatformGLContext *QEglFSWindow::glContext() const -{ -#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 index 95a9ff51b93..09f553d3b78 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.h +++ b/src/plugins/platforms/eglfs/qeglfswindow.h @@ -46,22 +46,19 @@ #include "qeglfsscreen.h" #include -#include +#include QT_BEGIN_NAMESPACE class QEglFSWindow : public QPlatformWindow { public: - QEglFSWindow(QWidget *w, QEglFSScreen *screen); + QEglFSWindow(QWindow *w); void setGeometry(const QRect &); WId winId() const; - QPlatformGLContext *glContext() const; - private: - QEglFSScreen *m_screen; WId m_winid; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/externalplugin.pri b/src/plugins/platforms/externalplugin.pri deleted file mode 100644 index 9b00acb4e95..00000000000 --- a/src/plugins/platforms/externalplugin.pri +++ /dev/null @@ -1,29 +0,0 @@ -# -# Lighthouse now has preliminarily support for building and -# loading platform plugins from outside the Qt source/build -# tree. -# -# 1) Building external plugins: -# Set QTDIR to the Qt build directory, copy this file to -# the plugin source repository and include it at the top -# of the plugin's pro file. Use QT_SOURCE_TREE if you -# want to pull in source code from Qt: -# -# include($$QT_SOURCE_TREE/src/plugins/platforms/fontdatabases/genericunix/genericunix.pri) -# -# 2) Loading external plugins: -# Specify the path to the directory containing the -# plugin on the command line, in addition to the -# platform name. -# -# ./wiggly -platformPluginPath /path/to/myPlugin -platform gullfaksA -# - -!exists($$(QTDIR)/.qmake.cache) { - error("Please set QTDIR to the Qt build directory") -} - -QT_SOURCE_TREE = $$fromfile($$(QTDIR)/.qmake.cache,QT_SOURCE_TREE) -QT_BUILD_TREE = $$fromfile($$(QTDIR)/.qmake.cache,QT_BUILD_TREE) - -load(qt_plugin) diff --git a/src/plugins/platforms/fb_base/fb_base.pri b/src/plugins/platforms/fb_base/fb_base.pri deleted file mode 100644 index 41bd87fbcaf..00000000000 --- a/src/plugins/platforms/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/platforms/fb_base/fb_base.pro b/src/plugins/platforms/fb_base/fb_base.pro deleted file mode 100644 index 4ebd53b407c..00000000000 --- a/src/plugins/platforms/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 -#load(qt_plugin) - -DESTDIR = $$QT.gui.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/fontdatabases/basicunix/basicunix.pri b/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri deleted file mode 100644 index c1fbf3e411b..00000000000 --- a/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri +++ /dev/null @@ -1,88 +0,0 @@ -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 - -DEFINES += QT_COMPILES_IN_HARFBUZZ - -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 - contains(QT_CONFIG, system-zlib) { - DEFINES += 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/fontconfig/fontconfig.pri b/src/plugins/platforms/fontdatabases/fontconfig/fontconfig.pri deleted file mode 100644 index 19c74ed0891..00000000000 --- a/src/plugins/platforms/fontdatabases/fontconfig/fontconfig.pri +++ /dev/null @@ -1,12 +0,0 @@ -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/genericunix/genericunix.pri b/src/plugins/platforms/fontdatabases/genericunix/genericunix.pri deleted file mode 100644 index 1153ab36b7d..00000000000 --- a/src/plugins/platforms/fontdatabases/genericunix/genericunix.pri +++ /dev/null @@ -1,10 +0,0 @@ -contains(QT_CONFIG, fontconfig) { - include(../fontconfig/fontconfig.pri) - DEFINES += Q_FONTCONFIGDATABASE -} else { - include(../basicunix/basicunix.pri) -} - -INCLUDEPATH += $$PWD -HEADERS += \ - $$PWD/qgenericunixfontdatabase.h diff --git a/src/plugins/platforms/glxconvenience/glxconvenience.pri b/src/plugins/platforms/glxconvenience/glxconvenience.pri deleted file mode 100644 index b4d43a30b58..00000000000 --- a/src/plugins/platforms/glxconvenience/glxconvenience.pri +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/qglxconvenience.h - -SOURCES += \ - $$PWD/qglxconvenience.cpp - -CONFIG += xrender - -xrender { - LIBS += -lXrender -} else { - DEFINES += QT_NO_XRENDER -} diff --git a/src/plugins/platforms/kms/kms.pro b/src/plugins/platforms/kms/kms.pro new file mode 100644 index 00000000000..73a3fa04180 --- /dev/null +++ b/src/plugins/platforms/kms/kms.pro @@ -0,0 +1,42 @@ +TARGET = qkms + +load(qt_plugin) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +QT = core-private gui-private platformsupport-private opengl-private + +CONFIG += link_pkgconfig qpa/genericunixfontdatabase + +PKGCONFIG += libdrm egl gbm glesv2 + +SOURCES = main.cpp \ + qkmsintegration.cpp \ + qkmsscreen.cpp \ + qkmscontext.cpp \ + qkmswindow.cpp \ + qkmscursor.cpp \ + qkmsdevice.cpp \ + qkmsbuffermanager.cpp \ + qkmsbackingstore.cpp +HEADERS = qkmsintegration.h \ + qkmsscreen.h \ + qkmscontext.h \ + qkmswindow.h \ + qkmscursor.h \ + qkmsdevice.h \ + qkmsbuffermanager.h \ + qkmsbackingstore.h + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target + + + + + + + + + + + diff --git a/src/plugins/graphicssystems/openvg/main.cpp b/src/plugins/platforms/kms/main.cpp similarity index 78% rename from src/plugins/graphicssystems/openvg/main.cpp rename to src/plugins/platforms/kms/main.cpp index 0aa265e50bb..a07f1645dcb 100644 --- a/src/plugins/graphicssystems/openvg/main.cpp +++ b/src/plugins/platforms/kms/main.cpp @@ -39,33 +39,34 @@ ** ****************************************************************************/ -#include -#include "qgraphicssystem_vg_p.h" +#include +#include "qkmsintegration.h" QT_BEGIN_NAMESPACE -class QVGGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QKmsIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&, const QStringList&); }; -QStringList QVGGraphicsSystemPlugin::keys() const +QStringList QKmsIntegrationPlugin::keys() const { QStringList list; - list << "OpenVG"; + list << "kms"; return list; } -QGraphicsSystem* QVGGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration *QKmsIntegrationPlugin::create(const QString& system, const QStringList& paramList) { - if (system.toLower() == "openvg") - return new QVGGraphicsSystem; + Q_UNUSED(paramList); + if (system.toLower() == "kms") + return new QKmsIntegration; return 0; } -Q_EXPORT_PLUGIN2(openvg, QVGGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(kms, QKmsIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/decorations/styled/main.cpp b/src/plugins/platforms/kms/qkmsbackingstore.cpp similarity index 72% rename from src/plugins/decorations/styled/main.cpp rename to src/plugins/platforms/kms/qkmsbackingstore.cpp index 69c339843ae..eb682e8ab3c 100644 --- a/src/plugins/decorations/styled/main.cpp +++ b/src/plugins/platforms/kms/qkmsbackingstore.cpp @@ -39,39 +39,34 @@ ** ****************************************************************************/ -#include -#include +#include "qkmsbackingstore.h" QT_BEGIN_NAMESPACE -class DecorationStyled : public QDecorationPlugin -{ -public: - DecorationStyled(); - - QStringList keys() const; - QDecoration *create(const QString&); -}; - -DecorationStyled::DecorationStyled() : QDecorationPlugin() +QKmsBackingStore::QKmsBackingStore(QWindow *window) + : QPlatformBackingStore(window) { } -QStringList DecorationStyled::keys() const +QPaintDevice *QKmsBackingStore::paintDevice() { - return (QStringList() << QLatin1String("Styled")); + return &m_image; } -QDecoration* DecorationStyled::create(const QString& s) +void QKmsBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { - if (s.toLower() != QLatin1String("styled")) - return 0; + //'window' can be a child window, in which case 'region' is in child window coordinates and + // offset is the (child) window's offset in relation to the window surface. - qDebug("creatign styled decoration"); - - return new QDecorationStyled; + Q_UNUSED(region) + Q_UNUSED(offset) + Q_UNUSED(window) } -Q_EXPORT_PLUGIN2(qdecorationstyled, DecorationStyled) +void QKmsBackingStore::resize(const QSize &size, const QRegion &staticContents) +{ + Q_UNUSED(staticContents) + m_image = QImage(size, QImage::Format_RGB32); +} QT_END_NAMESPACE diff --git a/src/plugins/graphicssystems/shivavg/shivavggraphicssystem.cpp b/src/plugins/platforms/kms/qkmsbackingstore.h similarity index 80% rename from src/plugins/graphicssystems/shivavg/shivavggraphicssystem.cpp rename to src/plugins/platforms/kms/qkmsbackingstore.h index 48526538ab1..e270d04db0d 100644 --- a/src/plugins/graphicssystems/shivavg/shivavggraphicssystem.cpp +++ b/src/plugins/platforms/kms/qkmsbackingstore.h @@ -39,24 +39,27 @@ ** ****************************************************************************/ -#include "shivavggraphicssystem.h" -#include "shivavgwindowsurface.h" -#include +#ifndef QBACKINGSTORE_KMS_H +#define QBACKINGSTORE_KMS_H + +#include +#include QT_BEGIN_NAMESPACE -ShivaVGGraphicsSystem::ShivaVGGraphicsSystem() +class QKmsBackingStore : public QPlatformBackingStore { -} +public: + QKmsBackingStore(QWindow *window); -QPixmapData *ShivaVGGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const -{ - return new QRasterPixmapData(type); -} + QPaintDevice *paintDevice(); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size, const QRegion &staticContents); -QWindowSurface *ShivaVGGraphicsSystem::createWindowSurface(QWidget *widget) const -{ - return new ShivaVGWindowSurface(widget); -} +private: + QImage m_image; +}; QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/kms/qkmsbuffermanager.cpp b/src/plugins/platforms/kms/qkmsbuffermanager.cpp new file mode 100644 index 00000000000..0c2eec0f3b6 --- /dev/null +++ b/src/plugins/platforms/kms/qkmsbuffermanager.cpp @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qkmsbuffermanager.h" +#include "qkmsscreen.h" +#include "qkmscontext.h" +#include "qkmsdevice.h" + +QT_BEGIN_NAMESPACE + +QKmsBufferManager::QKmsBufferManager(QKmsScreen *screen) : + m_screen(screen), + m_frameBufferObject(0), + m_renderTarget(0), + m_displayCanidate(0), + m_currentDisplay(0) +{ +} + +QKmsBufferManager::~QKmsBufferManager() +{ + clearBuffers(); + glDeleteFramebuffers(1, &m_frameBufferObject); +} + +void QKmsBufferManager::setupBuffersForMode(const drmModeModeInfo &mode, int numBuffers) +{ + eglMakeCurrent(m_screen->device()->eglDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, m_screen->device()->eglContext()); + m_screen->bindFramebuffer(); + + + if (m_frameBufferObject) { + clearBuffers(); + } else { + //Setup Framebuffer Object + glGenFramebuffers(1, &m_frameBufferObject); + glBindFramebuffer(GL_FRAMEBUFFER, m_frameBufferObject); + } + + //Setup shared Depth/Stencil buffer + glGenRenderbuffers(1, &m_depthAndStencilBufferObject); + glBindRenderbuffer(GL_RENDERBUFFER, m_depthAndStencilBufferObject); + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, + mode.hdisplay, mode.vdisplay); + + //Setup "numBuffer" many rendering targets + for (int i = 0; i < numBuffers; i++) { + QKmsFramebuffer *buffer = new QKmsFramebuffer(); + + glGenRenderbuffers(1, &buffer->renderBuffer); + glBindRenderbuffer(GL_RENDERBUFFER, buffer->renderBuffer); + + buffer->graphicsBufferObject = gbm_bo_create(m_screen->device()->gbmDevice(), + mode.hdisplay, mode.vdisplay, + GBM_BO_FORMAT_XRGB8888, + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + buffer->eglImage = eglCreateImageKHR(m_screen->device()->eglDisplay(), 0, EGL_NATIVE_PIXMAP_KHR, + buffer->graphicsBufferObject, 0); + glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER, buffer->eglImage); + + quint32 stride = gbm_bo_get_pitch(buffer->graphicsBufferObject); + quint32 handle = gbm_bo_get_handle(buffer->graphicsBufferObject).u32; + + int status = drmModeAddFB(m_screen->device()->fd(), mode.hdisplay, mode.vdisplay, + 32, 32, stride, handle, &buffer->framebufferId); + //Todo: IF this returns true, then this is one less buffer that we use + //Not so fatal, but not handled at the moment. + if (status) + qFatal("failed to add framebuffer"); + m_framebuffers.append(buffer); + } + //Attach the Depth and Stencil buffer + glFramebufferRenderbuffer(GL_FRAMEBUFFER, + GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, + m_depthAndStencilBufferObject); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, + GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, + m_depthAndStencilBufferObject); + //Attach renderbuffer as Color Attachment. + glFramebufferRenderbuffer(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, + this->renderTargetBuffer()); +} + +void QKmsBufferManager::clearBuffers() +{ + //Make sure that the FBO is binded + glBindFramebuffer(GL_FRAMEBUFFER, m_frameBufferObject); + //Detach the Color/Depth/Stencil Attachments. + glFramebufferRenderbuffer(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, + 0); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, + GL_DEPTH_ATTACHMENT, + GL_RENDERBUFFER, + 0); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, + GL_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, + 0); + glBindRenderbuffer(GL_RENDERBUFFER, 0); + //Delete the shared Depth/Stencil buffer + glDeleteRenderbuffers(1, &m_depthAndStencilBufferObject); + + //Delete each renderbuffer object + //Delete each EGLImage + //Remove each drm Framebuffer + foreach (QKmsFramebuffer *buffer, m_framebuffers) { + glDeleteRenderbuffers(1, &buffer->renderBuffer); + eglDestroyImageKHR(m_screen->device()->eglDisplay(), buffer->eglImage); + drmModeRmFB(m_screen->device()->fd(), buffer->framebufferId); + delete buffer; + } + m_framebuffers.clear(); +} + +GLuint QKmsBufferManager::renderTargetBuffer() +{ + //TODO: Handle more senarios than assuming at least 2 buffers + if (!m_renderTarget) { + m_renderTarget = m_framebuffers.at(1); + } + return m_renderTarget->renderBuffer; +} + +quint32 QKmsBufferManager::displayFramebufferId() +{ + if (!m_currentDisplay) { + m_currentDisplay = m_framebuffers.at(0); + m_currentDisplay->available = false; + return m_currentDisplay->framebufferId; + } + + if (!m_displayCanidate) + return m_currentDisplay->framebufferId; + + m_currentDisplay->available = true; + m_displayCanidate->available = false; + m_currentDisplay = m_displayCanidate; + return m_currentDisplay->framebufferId; + +} + +bool QKmsBufferManager::nextBuffer() +{ + m_displayCanidate = m_renderTarget; + foreach (QKmsFramebuffer *buffer, m_framebuffers) { + if (buffer->available && buffer != m_displayCanidate) { + m_renderTarget = buffer; + return true; + } + } + return false; +} + +QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/kms/qkmsbuffermanager.h b/src/plugins/platforms/kms/qkmsbuffermanager.h new file mode 100644 index 00000000000..59db7ebeb1f --- /dev/null +++ b/src/plugins/platforms/kms/qkmsbuffermanager.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKMSBUFFERMANAGER_H +#define QKMSBUFFERMANAGER_H + +#include +#include + +#define EGL_EGLEXT_PROTOTYPES 1 +#define GL_GLEXT_PROTOTYPES 1 + +extern "C" { +#include +#include +#include +} + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QKmsScreen; + +class QKmsFramebuffer +{ +public: + QKmsFramebuffer() : available(true) {} + gbm_bo *graphicsBufferObject; + GLuint renderBuffer; + EGLImageKHR eglImage; + quint32 framebufferId; + bool available; +}; + + +class QKmsBufferManager +{ +public: + explicit QKmsBufferManager(QKmsScreen *screen); + ~QKmsBufferManager(); + void setupBuffersForMode(const drmModeModeInfo &mode, int numBuffers = 3); + GLuint framebufferObject() const { return m_frameBufferObject; } + quint32 displayFramebufferId(); + GLuint renderTargetBuffer(); + bool nextBuffer(); + +private: + void clearBuffers(); + + QKmsScreen *m_screen; + QList m_framebuffers; + GLuint m_frameBufferObject; + GLuint m_depthAndStencilBufferObject; + + QKmsFramebuffer *m_renderTarget; + QKmsFramebuffer *m_displayCanidate; + QKmsFramebuffer *m_currentDisplay; + +}; + +QT_END_NAMESPACE + +#endif // QKMSBUFFERMANAGER_H diff --git a/src/plugins/platforms/kms/qkmscontext.cpp b/src/plugins/platforms/kms/qkmscontext.cpp new file mode 100644 index 00000000000..f27673a24db --- /dev/null +++ b/src/plugins/platforms/kms/qkmscontext.cpp @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qkmsscreen.h" +#include "qkmsdevice.h" +#include "qkmscontext.h" +#include "qkmswindow.h" + + +QT_BEGIN_NAMESPACE + +QKmsContext::QKmsContext(QKmsDevice *device) + : QPlatformOpenGLContext(), + m_device(device) +{ +} + +bool QKmsContext::makeCurrent(QPlatformSurface *surface) +{ + EGLDisplay display = m_device->eglDisplay(); + EGLContext context = m_device->eglContext(); + + bool ok = eglMakeCurrent(display, EGL_NO_SURFACE, + EGL_NO_SURFACE, context); + if (!ok) + qWarning("QKmsContext::makeCurrent(): eglError: %d, this: %p", + eglGetError(), this); + + QPlatformWindow *window = static_cast(surface); + QKmsScreen *screen = static_cast (QPlatformScreen::platformScreenForWindow(window->window())); + screen->bindFramebuffer(); + return true; +} + +void QKmsContext::doneCurrent() +{ + QPlatformOpenGLContext::doneCurrent(); + bool ok = eglMakeCurrent(m_device->eglDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT); + if (!ok) + qWarning("QKmsContext::doneCurrent(): eglError: %d, this: %p", + eglGetError(), this); + +} + +void QKmsContext::swapBuffers(QPlatformSurface *surface) +{ + //After flush, the current render target should be moved to + //latest complete + glFlush(); + + //Cast context to a window surface and get the screen the context + //is on and call swapBuffers on that screen. + QPlatformWindow *window = static_cast(surface); + QKmsScreen *screen = static_cast (QPlatformScreen::platformScreenForWindow(window->window())); + screen->swapBuffers(); +} + +void (*QKmsContext::getProcAddress(const QByteArray &procName)) () +{ + return eglGetProcAddress(procName.data()); +} + + +EGLContext QKmsContext::eglContext() const +{ + return m_device->eglContext(); +} + +QSurfaceFormat QKmsContext::format() const +{ + return QSurfaceFormat(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/kms/qkmscontext.h b/src/plugins/platforms/kms/qkmscontext.h new file mode 100644 index 00000000000..2f4f44c3d04 --- /dev/null +++ b/src/plugins/platforms/kms/qkmscontext.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKMSCONTEXT_H +#define QKMSCONTEXT_H + +#include + +#define EGL_EGLEXT_PROTOTYPES 1 +#include + +QT_BEGIN_NAMESPACE + +class QKmsDevice; + +class QKmsContext : public QPlatformOpenGLContext +{ +public: + QKmsContext(QKmsDevice *device); + + bool makeCurrent(QPlatformSurface *surface); + void doneCurrent(); + void swapBuffers(QPlatformSurface *surface); + void (*getProcAddress(const QByteArray &procName)) (); + + QSurfaceFormat format() const; + + EGLContext eglContext() const; + +private: + + QKmsDevice *m_device; +}; + +QT_END_NAMESPACE + +#endif // QKMSCONTEXT_H diff --git a/src/plugins/platforms/kms/qkmscursor.cpp b/src/plugins/platforms/kms/qkmscursor.cpp new file mode 100644 index 00000000000..91c23b0f1cd --- /dev/null +++ b/src/plugins/platforms/kms/qkmscursor.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//#include +#include "qkmscursor.h" +#include "qkmsscreen.h" +#include "qkmsdevice.h" + +QT_BEGIN_NAMESPACE + +QKmsCursor::QKmsCursor(QKmsScreen *screen) + : QPlatformCursor(screen), m_screen(screen), + m_graphicsBufferManager(screen->device()->gbmDevice()) +{ + gbm_bo *bo = gbm_bo_create(m_graphicsBufferManager, 64, 64, + GBM_BO_FORMAT_ARGB8888, + GBM_BO_USE_CURSOR_64X64 | GBM_BO_USE_RENDERING); + + m_eglImage = eglCreateImageKHR(m_screen->device()->eglDisplay(), 0, EGL_NATIVE_PIXMAP_KHR, + bo, 0); + gbm_bo_destroy(bo); + m_cursorImage = new QPlatformCursorImage(0, 0, 0, 0, 0, 0); +} + +void QKmsCursor::pointerEvent(const QMouseEvent &event) +{ + int status = drmModeMoveCursor(m_screen->device()->fd(), + m_screen->crtcId(), + event.globalX(), + event.globalY()); + if (status) { + qWarning("failed to move cursor: %d", status); + } +} + +void QKmsCursor::changeCursor(QCursor *widgetCursor, QWindow *window) +{ + Q_UNUSED(window) + + if (widgetCursor->shape() != Qt::BitmapCursor) { + m_cursorImage->set(widgetCursor->shape()); + } else { + m_cursorImage->set(widgetCursor->pixmap().toImage(), + widgetCursor->hotSpot().x(), + widgetCursor->hotSpot().y()); + } + + if ((m_cursorImage->image()->width() > 64) || (m_cursorImage->image()->width() > 64)) { + qWarning("failed to set hardware cursor: larger than 64x64."); + return; + } + + QImage cursorImage = m_cursorImage->image()->convertToFormat(QImage::Format_RGB32); + + //Load cursor image into EGLImage + GLuint cursorTexture; + glGenTextures(1, &cursorTexture); + glBindTexture(GL_TEXTURE_2D, cursorTexture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + + //TODO: Format may be wrong here, need a color icon to test. + if (m_eglImage != EGL_NO_IMAGE_KHR) { + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_eglImage); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, cursorImage.width(), + cursorImage.height(), GL_RGBA, + GL_UNSIGNED_BYTE, cursorImage.constBits()); + } else { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cursorImage.width(), + cursorImage.height(), 0, GL_RGBA, + GL_UNSIGNED_BYTE, cursorImage.constBits()); + } + + //EGLImage needs to contain sprite before calling this: + gbm_bo *bufferObject = gbm_bo_create_from_egl_image(m_graphicsBufferManager, + m_screen->device()->eglDisplay(), + m_eglImage, 64, 64, + GBM_BO_USE_CURSOR_64X64); + quint32 handle = gbm_bo_get_handle(bufferObject).u32; + + gbm_bo_destroy(bufferObject); + + int status = drmModeSetCursor(m_screen->device()->fd(), + m_screen->crtcId(), handle, 64, 64); + + if (status) { + qWarning("failed to set cursor: %d", status); + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/kms/qkmscursor.h b/src/plugins/platforms/kms/qkmscursor.h new file mode 100644 index 00000000000..96be88e991c --- /dev/null +++ b/src/plugins/platforms/kms/qkmscursor.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKMSCURSOR_H +#define QKMSCURSOR_H + +#include + +#define EGL_EGLEXT_PROTOTYPES 1 + +#include +#include + +QT_BEGIN_NAMESPACE + +class QKmsScreen; +class gbm_device; + +class QKmsCursor : public QPlatformCursor +{ +public: + QKmsCursor(QKmsScreen *screen); + + void pointerEvent(const QMouseEvent &event); + void changeCursor(QCursor *widgetCursor, QWindow *window); + +private: + QKmsScreen *m_screen; + gbm_device *m_graphicsBufferManager; + EGLImageKHR m_eglImage; + QPlatformCursorImage *m_cursorImage; +}; + +QT_END_NAMESPACE + +#endif // QKMSCURSOR_H diff --git a/src/plugins/platforms/kms/qkmsdevice.cpp b/src/plugins/platforms/kms/qkmsdevice.cpp new file mode 100644 index 00000000000..e0fac5611db --- /dev/null +++ b/src/plugins/platforms/kms/qkmsdevice.cpp @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//#include +#include "qkmsscreen.h" +#include "qkmsdevice.h" + +#include "qkmsintegration.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +QKmsDevice::QKmsDevice(const QString &path, QKmsIntegration *parent) : + QObject(0), m_integration(parent) +{ + m_fd = QT_OPEN(path.toAscii().constData(), O_RDWR); + if (m_fd < 0) { + qWarning("Could not open %s.", path.toAscii().constData()); + qFatal("No DRM display device"); + } + + m_graphicsBufferManager = gbm_create_device(m_fd); + m_eglDisplay = eglGetDisplay(m_graphicsBufferManager); + + if (m_eglDisplay == EGL_NO_DISPLAY) { + qWarning("Could not open EGL display"); + qFatal("EGL error"); + } + + EGLint major; + EGLint minor; + if (!eglInitialize(m_eglDisplay, &major, &minor)) { + qWarning("Could not initialize EGL display"); + qFatal("EGL error"); + } + + QString extensions = eglQueryString(m_eglDisplay, EGL_EXTENSIONS); + if (!extensions.contains(QString::fromLatin1("EGL_KHR_surfaceless_opengl"))) { + qFatal("EGL_KHR_surfaceless_opengl extension not available"); + } + + //Initialize EGLContext + static EGLint contextAttribs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + + eglBindAPI(EGL_OPENGL_ES_API); + m_eglContext = eglCreateContext(m_eglDisplay, 0, 0, contextAttribs); + if (m_eglContext == EGL_NO_CONTEXT) { + qWarning("Could not create the EGL context."); + eglTerminate(m_eglDisplay); + qFatal("EGL error"); + } + + createScreens(); + + QSocketNotifier *notifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); + connect(notifier, SIGNAL(activated(int)), this, SLOT(handlePageFlipCompleted())); +} + +QKmsDevice::~QKmsDevice() +{ + if (m_eglContext != EGL_NO_CONTEXT) { + eglDestroyContext(m_eglDisplay, m_eglContext); + m_eglContext = EGL_NO_CONTEXT; + } +} + +void QKmsDevice::createScreens() +{ + drmModeRes *resources = 0; + resources = drmModeGetResources(m_fd); + if (!resources) + qFatal("drmModeGetResources failed"); + + //Iterate connectors and create screens on each one active + for (int i = 0; i < resources->count_connectors; i++) { + drmModeConnector *connector = 0; + connector = drmModeGetConnector(m_fd, resources->connectors[i]); + if (connector && connector->connection == DRM_MODE_CONNECTED) { + m_integration->addScreen(new QKmsScreen(this, connector->connector_id)); + } + drmModeFreeConnector(connector); + } + drmModeFreeResources(resources); +} + +void QKmsDevice::handlePageFlipCompleted() +{ + //qDebug() << "Display signal recieved"; + drmEventContext eventContext; + + memset(&eventContext, 0, sizeof eventContext); + eventContext.version = DRM_EVENT_CONTEXT_VERSION; + eventContext.page_flip_handler = QKmsDevice::pageFlipHandler; + drmHandleEvent(m_fd, &eventContext); + +} + +void QKmsDevice::pageFlipHandler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data) +{ + Q_UNUSED(fd) + Q_UNUSED(frame) + Q_UNUSED(sec) + Q_UNUSED(usec) + static unsigned int previousTime = 0; + + unsigned int currentTime = sec * 1000000 + usec; + unsigned int refreshTime = 0; +// qDebug() << "fd: " << fd << " frame: " << frame << " sec: " +// << sec << " usec: " << usec << " data: " << data +// << "msecs" << sec * 1000 + usec / 1000; + QKmsScreen *screen = static_cast(data); + + if (previousTime == 0) + refreshTime = 16000; + else + refreshTime = currentTime - previousTime; + + screen->setFlipReady(refreshTime); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/kms/qkmsdevice.h b/src/plugins/platforms/kms/qkmsdevice.h new file mode 100644 index 00000000000..4868a72ede1 --- /dev/null +++ b/src/plugins/platforms/kms/qkmsdevice.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKMSDEVICE_H +#define QKMSDEVICE_H + +extern "C" { +#include +} +#include + +#include + +QT_BEGIN_NAMESPACE + +class gbm_device; +class QKmsIntegration; + +class QKmsDevice : public QObject +{ + Q_OBJECT +public: + explicit QKmsDevice(const QString &path, QKmsIntegration *parent); + ~QKmsDevice(); + + EGLDisplay eglDisplay() { return m_eglDisplay; } + gbm_device *gbmDevice() { return m_graphicsBufferManager; } + EGLContext eglContext() { return m_eglContext; } + int fd() const { return m_fd; } + + static void pageFlipHandler(int fd, unsigned int frame, unsigned int sec, + unsigned int usec, void *data); + +public slots: + void handlePageFlipCompleted(); +private: + void createScreens(); + + QKmsIntegration *m_integration; + + EGLDisplay m_eglDisplay; + EGLContext m_eglContext; + gbm_device *m_graphicsBufferManager; + int m_fd; +}; + +QT_END_NAMESPACE + +#endif // QKMSDEVICE_H diff --git a/src/plugins/platforms/kms/qkmsintegration.cpp b/src/plugins/platforms/kms/qkmsintegration.cpp new file mode 100644 index 00000000000..d8e4876eeef --- /dev/null +++ b/src/plugins/platforms/kms/qkmsintegration.cpp @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qkmsintegration.h" +#include "qkmsdevice.h" +#include "qkmsscreen.h" +#include "qkmswindow.h" +#include "qkmsbackingstore.h" +#include "qkmscontext.h" + +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QKmsIntegration::QKmsIntegration() + : QPlatformIntegration(), + m_fontDatabase(new QGenericUnixFontDatabase()), + m_printerSupport(new QGenericUnixPrinterSupport()), + m_eventDispatcher(createUnixEventDispatcher()) +{ + QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); + setenv("EGL_PLATFORM", "drm",1); + QStringList drmDevices = findDrmDevices(); + foreach (QString path, drmDevices) { + m_devices.append(new QKmsDevice(path, this)); + } +} + +QKmsIntegration::~QKmsIntegration() +{ + foreach (QKmsDevice *device, m_devices) { + delete device; + } + foreach (QPlatformScreen *screen, m_screens) { + delete screen; + } + delete m_printerSupport; + delete m_fontDatabase; +} + +bool QKmsIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + case OpenGL: return true; + case ThreadedOpenGL: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + +QPlatformOpenGLContext *QKmsIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const +{ + QKmsScreen *screen = static_cast(context->screen()->handle()); + return new QKmsContext(screen->device()); +} + +QPlatformWindow *QKmsIntegration::createPlatformWindow(QWindow *window) const +{ + return new QKmsWindow(window); +} + +QPlatformBackingStore *QKmsIntegration::createPlatformBackingStore(QWindow *window) const +{ + return new QKmsBackingStore(window); +} + +QPlatformFontDatabase *QKmsIntegration::fontDatabase() const +{ + return m_fontDatabase; +} + +QStringList QKmsIntegration::findDrmDevices() +{ + //Return a list addresses of DRM supported devices + //Hardcoded now, but could use udev to return a list + //of multiple devices. + return QStringList(QString::fromLatin1("/dev/dri/card0")); +} + +void QKmsIntegration::addScreen(QKmsScreen *screen) +{ + m_screens.append(screen); + screenAdded(screen); +} + +QAbstractEventDispatcher *QKmsIntegration::guiThreadEventDispatcher() const +{ + return m_eventDispatcher; +} + +QPlatformPrinterSupport *QKmsIntegration::printerSupport() const +{ + return m_printerSupport; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/kms/qkmsintegration.h b/src/plugins/platforms/kms/qkmsintegration.h new file mode 100644 index 00000000000..a1f36232805 --- /dev/null +++ b/src/plugins/platforms/kms/qkmsintegration.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATION_KMS_H +#define QPLATFORMINTEGRATION_KMS_H + +#include + +QT_BEGIN_NAMESPACE + +class QKmsScreen; +class QKmsDevice; + +class QKmsIntegration : public QPlatformIntegration +{ +public: + QKmsIntegration(); + ~QKmsIntegration(); + + bool hasCapability(QPlatformIntegration::Capability cap) const; + + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + + QPlatformFontDatabase *fontDatabase() const; + QPlatformPrinterSupport *printerSupport() const; + QAbstractEventDispatcher *guiThreadEventDispatcher() const; + + void addScreen(QKmsScreen *screen); + +private: + QStringList findDrmDevices(); + + QList m_screens; + QList m_devices; + QPlatformFontDatabase *m_fontDatabase; + QPlatformPrinterSupport *m_printerSupport; + QAbstractEventDispatcher *m_eventDispatcher; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/kms/qkmsscreen.cpp b/src/plugins/platforms/kms/qkmsscreen.cpp new file mode 100644 index 00000000000..0cd15309308 --- /dev/null +++ b/src/plugins/platforms/kms/qkmsscreen.cpp @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +//#include +#include "qkmscursor.h" +#include "qkmsscreen.h" +#include "qkmsdevice.h" +#include "qkmscontext.h" +#include "qkmsbuffermanager.h" + +QT_BEGIN_NAMESPACE + +//Fallback mode (taken from Wayland DRM demo compositor) +static drmModeModeInfo builtin_1024x768 = { + 63500, //clock + 1024, 1072, 1176, 1328, 0, + 768, 771, 775, 798, 0, + 59920, + DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, + 0, + "1024x768" +}; + +QKmsScreen::QKmsScreen(QKmsDevice *device, int connectorId) + : m_device(device), + m_flipReady(true), + m_connectorId(connectorId), + m_depth(32), + m_format(QImage::Format_Invalid), + m_bufferManager(this), + m_refreshTime(16000) +{ + m_cursor = new QKmsCursor(this); + initializeScreenMode(); +} + +QKmsScreen::~QKmsScreen() +{ + delete m_cursor; +} + +QRect QKmsScreen::geometry() const +{ + return m_geometry; +} + +int QKmsScreen::depth() const +{ + return m_depth; +} + +QImage::Format QKmsScreen::format() const +{ + return m_format; +} + +QSize QKmsScreen::physicalSize() const +{ + return m_physicalSize; +} + +GLuint QKmsScreen::framebufferObject() const +{ + return m_bufferManager.framebufferObject(); +} + +void QKmsScreen::initializeScreenMode() +{ + //Determine optimal mode for screen + drmModeRes *resources = drmModeGetResources(m_device->fd()); + if (!resources) + qFatal("drmModeGetResources failed"); + + drmModeConnector *connector = drmModeGetConnector(m_device->fd(), m_connectorId); + drmModeModeInfo *mode = 0; + if (connector->count_modes > 0) + mode = &connector->modes[0]; + else + mode = &builtin_1024x768; + + drmModeEncoder *encoder = drmModeGetEncoder(m_device->fd(), connector->encoders[0]); + if (encoder == 0) + qFatal("No encoder for connector."); + + int i; + for (i = 0; i < resources->count_crtcs; i++) { + if (encoder->possible_crtcs & (1 << i)) + break; + } + if (i == resources->count_crtcs) + qFatal("No usable crtc for encoder."); + + m_crtcId = resources->crtcs[i]; + m_mode = *mode; + m_geometry = QRect(0, 0, m_mode.hdisplay, m_mode.vdisplay); + m_depth = 32; + m_format = QImage::Format_RGB32; + m_physicalSize = QSize(connector->mmWidth, connector->mmHeight); + + //Setup three buffers for current mode + m_bufferManager.setupBuffersForMode(m_mode, 3); + + //Set the Mode of the screen. + int ret = drmModeSetCrtc(m_device->fd(), m_crtcId, m_bufferManager.displayFramebufferId(), + 0, 0, &m_connectorId, 1, &m_mode); + if (ret) + qFatal("failed to set mode"); + + //Cleanup + drmModeFreeEncoder(encoder); + drmModeFreeConnector(connector); + drmModeFreeResources(resources); +} + +void QKmsScreen::bindFramebuffer() +{ + if (m_bufferManager.framebufferObject()) { + glBindFramebuffer(GL_FRAMEBUFFER, m_bufferManager.framebufferObject()); + + glFramebufferRenderbuffer(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, + m_bufferManager.renderTargetBuffer()); + } +} + +void QKmsScreen::swapBuffers() +{ + waitForPageFlipComplete(); + + if ( m_flipReady ) + performPageFlip(); + //TODO: Do something with return value here + m_bufferManager.nextBuffer(); + //qDebug() << "swapBuffers now rendering to " << m_bufferManager.renderTargetBuffer(); + bindFramebuffer(); +} + +void QKmsScreen::performPageFlip() +{ + quint32 displayFramebufferId = m_bufferManager.displayFramebufferId(); + //qDebug() << "Flipping to framebuffer: " << displayFramebufferId; + + int pageFlipStatus = drmModePageFlip(m_device->fd(), m_crtcId, + displayFramebufferId, + DRM_MODE_PAGE_FLIP_EVENT, this); + if (pageFlipStatus) + qWarning("Pageflip status: %d", pageFlipStatus); + + m_flipReady = false; +} + +void QKmsScreen::setFlipReady(unsigned int time) +{ + m_flipReady = true; + m_refreshTime = time; + performPageFlip(); +} + +QKmsDevice * QKmsScreen::device() const +{ + return m_device; +} + +void QKmsScreen::waitForPageFlipComplete() +{ + //Check manually if there is something to be read on the device + //as there are senarios where the signal is not received (starvation) + fd_set fdSet; + timeval timeValue; + int returnValue; + + FD_ZERO(&fdSet); + FD_SET(m_device->fd(), &fdSet); + timeValue.tv_sec = 0; + timeValue.tv_usec = m_refreshTime; + + returnValue = select(1, &fdSet, 0, 0, &timeValue); + + if (returnValue) { + m_device->handlePageFlipCompleted(); + } + +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/kms/qkmsscreen.h b/src/plugins/platforms/kms/qkmsscreen.h new file mode 100644 index 00000000000..5c8b5ca4f52 --- /dev/null +++ b/src/plugins/platforms/kms/qkmsscreen.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QKMSSCREEN_H +#define QKMSSCREEN_H + +#include +#include "qkmsbuffermanager.h" + +QT_BEGIN_NAMESPACE + +class QKmsCursor; +class QKmsDevice; +class QKmsContext; + +class QKmsScreen : public QPlatformScreen +{ +public: + QKmsScreen(QKmsDevice *device, int connectorId); + ~QKmsScreen(); + + QRect geometry() const; + int depth() const; + QImage::Format format() const; + QSize physicalSize() const; + + GLuint framebufferObject() const; + quint32 crtcId() const { return m_crtcId; } + QKmsDevice *device() const; + + //Called by context for each screen + void bindFramebuffer(); + void swapBuffers(); + void setFlipReady(unsigned int time); + +private: + void performPageFlip(); + void initializeScreenMode(); + void waitForPageFlipComplete(); + + QKmsDevice *m_device; + bool m_flipReady; + quint32 m_connectorId; + + quint32 m_crtcId; + drmModeModeInfo m_mode; + QRect m_geometry; + QSize m_physicalSize; + int m_depth; + QImage::Format m_format; + + QKmsCursor *m_cursor; + QKmsBufferManager m_bufferManager; + unsigned int m_refreshTime; +}; + +QT_END_NAMESPACE + +#endif // QKMSSCREEN_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h b/src/plugins/platforms/kms/qkmswindow.cpp similarity index 77% rename from src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h rename to src/plugins/platforms/kms/qkmswindow.cpp index 66413792615..63271c4ef5d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h +++ b/src/plugins/platforms/kms/qkmswindow.cpp @@ -39,36 +39,26 @@ ** ****************************************************************************/ -#ifndef QDIRECTFBKEYBOARD_H -#define QDIRECTFBKEYBOARD_H - -#include -#include - -#ifndef QT_NO_QWS_DIRECTFB - -QT_BEGIN_HEADER +#include "qkmswindow.h" +#include "qkmsscreen.h" +#include QT_BEGIN_NAMESPACE -QT_MODULE(Gui) - -class QDirectFBKeyboardHandlerPrivate; - -class QDirectFBKeyboardHandler : public QWSKeyboardHandler +QKmsWindow::QKmsWindow(QWindow *window) + : QPlatformWindow(window) { -public: - QDirectFBKeyboardHandler(const QString &device); - ~QDirectFBKeyboardHandler(); + m_screen = QPlatformScreen::platformScreenForWindow(window); +} -private: - QDirectFBKeyboardHandlerPrivate *d; -}; +void QKmsWindow::setGeometry(const QRect &rect) +{ + Q_UNUSED(rect) + //All Windows must be fullscreen + QRect fullscreenRect = m_screen->availableGeometry(); + QWindowSystemInterface::handleGeometryChange(window(), fullscreenRect); + + QPlatformWindow::setGeometry(fullscreenRect); +} QT_END_NAMESPACE - -#endif // QT_NO_QWS_DIRECTFB - -QT_END_HEADER - -#endif // QDIRECTFBKEYBOARD_H diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h b/src/plugins/platforms/kms/qkmswindow.h similarity index 85% rename from src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h rename to src/plugins/platforms/kms/qkmswindow.h index e38033a6cd6..789d42e6f85 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h +++ b/src/plugins/platforms/kms/qkmswindow.h @@ -39,16 +39,24 @@ ** ****************************************************************************/ -#ifndef MGRAPHICSSYSTEMPLUGIN_H -#define MGRAPHICSSYSTEMPLUGIN_H +#ifndef QKMSWINDOW_H +#define QKMSWINDOW_H -#include +#include -class QMeeGoGraphicsSystemPlugin : public QGraphicsSystemPlugin +QT_BEGIN_NAMESPACE + +class QKmsWindow : public QPlatformWindow { public: - virtual QStringList keys() const; - virtual QGraphicsSystem *create(const QString&); + QKmsWindow(QWindow *window); + + void setGeometry(const QRect &rect); + +private: + QPlatformScreen *m_screen; }; -#endif +QT_END_NAMESPACE + +#endif // QKMSWINDOW_H diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index ce6814ecc16..9375486d8b7 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -3,6 +3,8 @@ load(qt_plugin) DESTDIR = $$QT.gui.plugins/platforms +QT += core-private gui-private platformsupport-private + SOURCES = main.cpp qlinuxfbintegration.cpp HEADERS = qlinuxfbintegration.h diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index 4a24d6614a2..1c098a0ffc1 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -42,6 +42,7 @@ #include "qlinuxfbintegration.h" #include "../fb_base/fb_base.h" #include "qgenericunixfontdatabase.h" +#include #include #include // overrides QT_OPEN #include @@ -791,9 +792,9 @@ bool QLinuxFbIntegration::hasCapability(QPlatformIntegration::Capability cap) co } -QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QLinuxFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QWindowSurface *QLinuxFbIntegration::createWindowSurface(QWidget *widget, WId) const @@ -810,6 +811,11 @@ QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWidget *widget, WId return w; } +QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + QPlatformFontDatabase *QLinuxFbIntegration::fontDatabase() const { return fontDb; diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index b96749ff03a..f972a304526 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -70,6 +70,7 @@ class QLinuxFbIntegrationPrivate; struct fb_cmap; struct fb_var_screeninfo; struct fb_fix_screeninfo; +class QAbstractEventDispatcher; class QLinuxFbIntegration : public QPlatformIntegration { @@ -79,9 +80,10 @@ public: bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const; + QAbstractEventDispatcher *createEventDispatcher() const; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index d51b6b2ed0c..392d12d19a5 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -1,14 +1,14 @@ TARGET = qminimal load(qt_plugin) -QT = core-private gui-private +QT += core-private gui-private platformsupport-private DESTDIR = $$QT.gui.plugins/platforms SOURCES = main.cpp \ qminimalintegration.cpp \ - qminimalwindowsurface.cpp + qminimalbackingstore.cpp HEADERS = qminimalintegration.h \ - qminimalwindowsurface.h + qminimalbackingstore.h target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/minimal/qminimalwindowsurface.cpp b/src/plugins/platforms/minimal/qminimalbackingstore.cpp similarity index 69% rename from src/plugins/platforms/minimal/qminimalwindowsurface.cpp rename to src/plugins/platforms/minimal/qminimalbackingstore.cpp index 91c68d1d2d1..08281405a4e 100644 --- a/src/plugins/platforms/minimal/qminimalwindowsurface.cpp +++ b/src/plugins/platforms/minimal/qminimalbackingstore.cpp @@ -40,45 +40,45 @@ ****************************************************************************/ -#include "qminimalwindowsurface.h" +#include "qminimalbackingstore.h" +#include "qscreen.h" #include -#include +#include QT_BEGIN_NAMESPACE -QMinimalWindowSurface::QMinimalWindowSurface(QWidget *window) - : QWindowSurface(window) +QMinimalBackingStore::QMinimalBackingStore(QWindow *window) + : QPlatformBackingStore(window) { - //qDebug() << "QMinimalWindowSurface::QMinimalWindowSurface:" << (long)this; + //qDebug() << "QMinimalBackingStore::QMinimalBackingStore:" << (long)this; } -QMinimalWindowSurface::~QMinimalWindowSurface() +QMinimalBackingStore::~QMinimalBackingStore() { } -QPaintDevice *QMinimalWindowSurface::paintDevice() +QPaintDevice *QMinimalBackingStore::paintDevice() { - //qDebug() << "QMinimalWindowSurface::paintDevice"; + //qDebug() << "QMinimalBackingStore::paintDevice"; return &mImage; } -void QMinimalWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QMinimalBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { - Q_UNUSED(widget); + Q_UNUSED(window); 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(); + qDebug() << "QMinimalBackingStore::flush() saving contents to" << filename.toLocal8Bit().constData(); mImage.save(filename); } -void QMinimalWindowSurface::resize(const QSize &size) +void QMinimalBackingStore::resize(const QSize &size, const QRegion &) { - //qDebug() << "QMinimalWindowSurface::setGeometry:" << (long)this << rect; - QWindowSurface::resize(size); - QImage::Format format = QApplicationPrivate::platformIntegration()->screens().first()->format(); + //qDebug() << "QMinimalBackingStore::setGeometry:" << (long)this << rect; + QImage::Format format = QGuiApplication::primaryScreen()->handle()->format(); if (mImage.size() != size) mImage = QImage(size, format); } diff --git a/src/plugins/platforms/minimal/qminimalwindowsurface.h b/src/plugins/platforms/minimal/qminimalbackingstore.h similarity index 82% rename from src/plugins/platforms/minimal/qminimalwindowsurface.h rename to src/plugins/platforms/minimal/qminimalbackingstore.h index 2c6196a19a6..9b61275e9d1 100644 --- a/src/plugins/platforms/minimal/qminimalwindowsurface.h +++ b/src/plugins/platforms/minimal/qminimalbackingstore.h @@ -39,24 +39,24 @@ ** ****************************************************************************/ -#ifndef QWINDOWSURFACE_MINIMAL_H -#define QWINDOWSURFACE_MINIMAL_H - -#include +#ifndef QBACKINGSTORE_MINIMAL_H +#define QBACKINGSTORE_MINIMAL_H +#include #include +#include QT_BEGIN_NAMESPACE -class QMinimalWindowSurface : public QWindowSurface +class QMinimalBackingStore : public QPlatformBackingStore { public: - QMinimalWindowSurface(QWidget *window); - ~QMinimalWindowSurface(); + QMinimalBackingStore(QWindow *window); + ~QMinimalBackingStore(); QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size, const QRegion &staticContents); private: QImage mImage; diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index b9ab528b508..2f2da6967a2 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -40,20 +40,34 @@ ****************************************************************************/ #include "qminimalintegration.h" -#include "qminimalwindowsurface.h" +#include "qminimalbackingstore.h" +#ifndef Q_OS_WIN +#include +#else +#include +#endif #include +#include #include -QMinimalIntegration::QMinimalIntegration() +QT_BEGIN_NAMESPACE + +QMinimalIntegration::QMinimalIntegration() : +#ifdef Q_OS_WIN + m_eventDispatcher(new QEventDispatcherWin32()) +#else + m_eventDispatcher(createUnixEventDispatcher()) +#endif { + QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); mPrimaryScreen->mDepth = 32; mPrimaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied; - mScreens.append(mPrimaryScreen); + screenAdded(mPrimaryScreen); } bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const @@ -64,19 +78,20 @@ bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) co } } -QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) const { - return new QRasterPixmapData(type); + Q_UNUSED(window); + return new QPlatformWindow(window); } -QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWidget *widget, WId winId) const +QPlatformBackingStore *QMinimalIntegration::createPlatformBackingStore(QWindow *window) const { - Q_UNUSED(winId); - return new QPlatformWindow(widget); + return new QMinimalBackingStore(window); } -QWindowSurface *QMinimalIntegration::createWindowSurface(QWidget *widget, WId winId) const +QAbstractEventDispatcher *QMinimalIntegration::guiThreadEventDispatcher() const { - Q_UNUSED(winId); - return new QMinimalWindowSurface(widget); + return m_eventDispatcher; } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index d1fcc42c68f..0835c39ab69 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -71,14 +71,12 @@ public: bool hasCapability(QPlatformIntegration::Capability cap) const; - 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; } + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QAbstractEventDispatcher *guiThreadEventDispatcher() const; private: - QList mScreens; + QAbstractEventDispatcher *m_eventDispatcher; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 89475db54b1..38c4325bb41 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -43,7 +43,7 @@ #include "qopenkodewindow.h" #include "qopenkodeeventloopintegration.h" -#include +#include #include #include @@ -197,9 +197,9 @@ bool QOpenKODEIntegration::hasCapability(QPlatformIntegration::Capability cap) c } } -QPixmapData *QOpenKODEIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QOpenKODEIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QGLPixmapData(type); + return new QGLPlatformPixmap(type); } QPlatformWindow *QOpenKODEIntegration::createPlatformWindow(QWidget *tlw, WId ) const diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index 0f001c957b9..43961add6d4 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -48,7 +48,7 @@ #include #include -#include +#include #include #include @@ -92,7 +92,7 @@ public: bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/openkode/qopenkodewindow.cpp b/src/plugins/platforms/openkode/qopenkodewindow.cpp index c6fe6d01762..e20904470f1 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.cpp +++ b/src/plugins/platforms/openkode/qopenkodewindow.cpp @@ -53,7 +53,7 @@ #include -#include +#include #include #include @@ -235,7 +235,7 @@ WId QOpenKODEWindow::winId() const return i++; } -QPlatformGLContext *QOpenKODEWindow::glContext() const +QPlatformOpenGLContext *QOpenKODEWindow::glContext() const { return m_platformGlContext; } diff --git a/src/plugins/platforms/openkode/qopenkodewindow.h b/src/plugins/platforms/openkode/qopenkodewindow.h index 317a6b5cd62..f48c3a2bc05 100644 --- a/src/plugins/platforms/openkode/qopenkodewindow.h +++ b/src/plugins/platforms/openkode/qopenkodewindow.h @@ -63,7 +63,7 @@ public: void setVisible(bool visible); WId winId() const; - QPlatformGLContext *glContext() const; + QPlatformOpenGLContext *glContext() const; void raise(); void lower(); diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp index 203896f489a..d8e4cc984cc 100644 --- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp +++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp @@ -41,7 +41,7 @@ #include "qgraphicssystem_vglite.h" #include "qwindowsurface_vglite.h" -#include +#include #include #include #ifdef OPENVG_USBHP_INIT @@ -163,16 +163,16 @@ QVGLiteGraphicsSystem::~QVGLiteGraphicsSystem() { } -QPixmapData *QVGLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QVGLiteGraphicsSystem::createPlatformPixmap(QPlatformPixmap::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); + // Pixmaps can use QVGLitePlatformPixmap; bitmaps must use raster. + if (type == QPlatformPixmap::PixmapType) + return new QVGPlatformPixmap(type); else - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); #else - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); #endif } diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h index 41b1d286bc4..6dc6a38439f 100644 --- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h +++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h @@ -57,7 +57,7 @@ public: QVGLiteGraphicsSystem(); ~QVGLiteGraphicsSystem(); - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QWindowSurface *createWindowSurface(QWidget *widget) const; QList screens() const { return mScreens; } diff --git a/src/plugins/graphicssystems/shivavg/main.cpp b/src/plugins/platforms/openwfd/main.cpp similarity index 76% rename from src/plugins/graphicssystems/shivavg/main.cpp rename to src/plugins/platforms/openwfd/main.cpp index 53bc7823780..c0159e72180 100644 --- a/src/plugins/graphicssystems/shivavg/main.cpp +++ b/src/plugins/platforms/openwfd/main.cpp @@ -39,33 +39,34 @@ ** ****************************************************************************/ -#include -#include "shivavggraphicssystem.h" +#include +#include "qopenwfdintegration.h" QT_BEGIN_NAMESPACE -class ShivaVGGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QOpenWFDIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&, const QStringList&); }; -QStringList ShivaVGGraphicsSystemPlugin::keys() const +QStringList QOpenWFDIntegrationPlugin::keys() const { QStringList list; - list << "ShivaVG"; + list << "OpenWFD"; return list; } -QGraphicsSystem* ShivaVGGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QOpenWFDIntegrationPlugin::create(const QString& system, const QStringList& paramList) { - if (system.toLower() == "shivavg") - return new ShivaVGGraphicsSystem; + Q_UNUSED(paramList); + if (system.toLower() == "openwfd") + return new QOpenWFDIntegration; return 0; } -Q_EXPORT_PLUGIN2(shivavg, ShivaVGGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(openwfd, QOpenWFDIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/openwfd/openwf.pro b/src/plugins/platforms/openwfd/openwf.pro new file mode 100644 index 00000000000..d913a84411d --- /dev/null +++ b/src/plugins/platforms/openwfd/openwf.pro @@ -0,0 +1,41 @@ +TARGET = qopenwf + +load(qt_plugin) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +QT += core-private gui-private platformsupport-private + +CONFIG += qpa/genericunixfontdatabase + +HEADERS += \ + qopenwfddevice.h \ + qopenwfdintegration.h \ + qopenwfdnativeinterface.h \ + qopenwfdscreen.h \ + qopenwfdbackingstore.h \ + qopenwfdevent.h \ + qopenwfdglcontext.h \ + qopenwfdoutputbuffer.h \ + qopenwfdport.h \ + qopenwfdwindow.h \ + qopenwfdportmode.h + +SOURCES += \ + main.cpp \ + qopenwfddevice.cpp \ + qopenwfdintegration.cpp \ + qopenwfdnativeinterface.cpp \ + qopenwfdscreen.cpp \ + qopenwfdbackingstore.cpp \ + qopenwfdevent.cpp \ + qopenwfdglcontext.cpp \ + qopenwfdoutputbuffer.cpp \ + qopenwfdport.cpp \ + qopenwfdportmode.cpp \ + qopenwfdwindow.cpp + +LIBS += -lWFD -lgbm -lGLESv2 -lEGL + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target + diff --git a/src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp b/src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp new file mode 100644 index 00000000000..2638d8cd5ab --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp @@ -0,0 +1,25 @@ +#include "qopenwfdbackingstore.h" + +QOpenWFDBackingStore::QOpenWFDBackingStore(QWindow *window) + : QPlatformBackingStore(window) +{ +} + +QPaintDevice * QOpenWFDBackingStore::paintDevice() +{ + return &mImage; +} + +//we don't support flush yet :) +void QOpenWFDBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(window); + Q_UNUSED(region); + Q_UNUSED(offset); +} + +void QOpenWFDBackingStore::resize(const QSize &size, const QRegion &staticContents) +{ + Q_UNUSED(staticContents); + mImage = QImage(size,QImage::Format_RGB32); +} diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h b/src/plugins/platforms/openwfd/qopenwfdbackingstore.h similarity index 75% rename from src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h rename to src/plugins/platforms/openwfd/qopenwfdbackingstore.h index 00da6976b8e..c173de6c196 100644 --- a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.h +++ b/src/plugins/platforms/openwfd/qopenwfdbackingstore.h @@ -39,31 +39,27 @@ ** ****************************************************************************/ -#ifndef QWAYLANDDRMSURFACE_H -#define QWAYLANDDRMSURFACE_H +#ifndef QOPENWFDBACKINGSTORE_H +#define QOPENWFDBACKINGSTORE_H -#include "qwaylanddisplay.h" +#include +#include -#include - -class QGLFramebufferObject; - -class QWaylandGLWindowSurface : public QWindowSurface +class QOpenWFDBackingStore : public QPlatformBackingStore { public: - QWaylandGLWindowSurface(QWidget *window); - ~QWaylandGLWindowSurface(); - - void beginPaint(const QRegion &); + QOpenWFDBackingStore(QWindow *window); QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size); + // 'window' can be a child window, in which case 'region' is in child window coordinates and + // offset is the (child) window's offset in relation to the window surface. + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + + void resize(const QSize &size, const QRegion &staticContents); private: - QWaylandDisplay *mDisplay; - QGLFramebufferObject *mPaintDevice; + QImage mImage; }; -#endif // QWAYLANDDRMSURFACE_H +#endif // QOPENWFDBACKINGSTORE_H diff --git a/src/plugins/platforms/openwfd/qopenwfddevice.cpp b/src/plugins/platforms/openwfd/qopenwfddevice.cpp new file mode 100644 index 00000000000..d3ff6d45d8f --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfddevice.cpp @@ -0,0 +1,317 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenwfddevice.h" + +#include "qopenwfdport.h" +#include "qopenwfdscreen.h" + +#include + +#include +#include + +QOpenWFDDevice::QOpenWFDDevice(QOpenWFDIntegration *integration, WFDint device_enumeration) + : mIntegration(integration) + , mDeviceEnum(device_enumeration) + , mCommitedDevice(false) + , mWaitingForBindSourceEvent(false) +{ + mDevice = wfdCreateDevice(WFD_DEFAULT_DEVICE_ID,WFD_NONE); + if (mDevice == WFD_INVALID_HANDLE) + qDebug() << "failed to create device"; + + mEvent = wfdCreateEvent(mDevice,0); + if (mEvent == WFD_INVALID_HANDLE) + qDebug() << "failed to create event handle"; + + //initialize pipelines for device. + wfdEnumeratePipelines(mDevice,WFD_NONE,0,WFD_NONE); + + initializeGbmAndEgl(); + + WFDint numberOfPorts = wfdEnumeratePorts(mDevice,0,0,0); + WFDint port_enumerations[numberOfPorts]; + WFDint actualNumberOfPorts = wfdEnumeratePorts(mDevice,port_enumerations,numberOfPorts,WFD_NONE); + Q_ASSERT(actualNumberOfPorts == numberOfPorts); + + for (int i = 0; i < actualNumberOfPorts; i++) + { + QOpenWFDPort *port = new QOpenWFDPort(this,port_enumerations[i]); + if (port->attached()) { + mPorts.append(port); + } else { + delete port; + } + } + + int fd = wfdDeviceEventGetFD(mDevice,mEvent); + mEventSocketNotifier = new QSocketNotifier(fd,QSocketNotifier::Read,this); + connect(mEventSocketNotifier,SIGNAL(activated(int)),SLOT(readEvents())); + + mCommitedDevice = true; + commit(WFD_COMMIT_ENTIRE_DEVICE, handle()); +} + +QOpenWFDDevice::~QOpenWFDDevice() +{ + delete mEventSocketNotifier; + wfdDestroyEvent(mDevice,mEvent); + + for (int i = 0; i < mPorts.size(); i++) { + //probably don't need to remove them from the list + QList keys = mUsedPipelines.keys(mPorts.at(i)); + for (int keyIndex = 0; keyIndex < keys.size(); keyIndex++) { + mUsedPipelines.remove(keys.at(keyIndex)); + } + //but we have to delete them :) + delete mPorts[i]; + } + + eglDestroyContext(mEglDisplay,mEglContext); + eglTerminate(mEglDisplay); + + gbm_device_destroy(mGbmDevice); + + wfdDestroyDevice(mDevice); +} + +WFDDevice QOpenWFDDevice::handle() const +{ + return mDevice; +} + +QOpenWFDIntegration * QOpenWFDDevice::integration() const +{ + return mIntegration; +} + +bool QOpenWFDDevice::isPipelineUsed(WFDint pipelineId) +{ + return mUsedPipelines.contains(pipelineId); +} + +void QOpenWFDDevice::addToUsedPipelineSet(WFDint pipelineId,QOpenWFDPort *port) +{ + mUsedPipelines.insert(pipelineId,port); +} + +void QOpenWFDDevice::removeFromUsedPipelineSet(WFDint pipelineId) +{ + mUsedPipelines.remove(pipelineId); +} + +gbm_device * QOpenWFDDevice::gbmDevice() const + +{ + return mGbmDevice; +} + +EGLDisplay QOpenWFDDevice::eglDisplay() const +{ + return mEglDisplay; +} + +EGLContext QOpenWFDDevice::eglContext() const +{ + return mEglContext; +} + +void QOpenWFDDevice::commit(WFDCommitType type, WFDHandle handle) +{ + if (mCommitedDevice) { + wfdDeviceCommit(mDevice,type,handle); + } +} + +void QOpenWFDDevice::waitForPipelineBindSourceCompleteEvent() +{ + mWaitingForBindSourceEvent = true; + + while (mWaitingForBindSourceEvent) { + readEvents(WFD_FOREVER); + } +} + +void QOpenWFDDevice::readEvents(WFDtime wait) +{ + WFDEventType type = wfdDeviceEventWait(mDevice,mEvent,wait); + + if (type == WFD_EVENT_NONE || type == WFD_EVENT_DESTROYED) { + return; + } + switch (type) { + case WFD_EVENT_INVALID: + case WFD_EVENT_NONE: + return; + case WFD_EVENT_DESTROYED: + qDebug() << "Event or Device destoryed!"; + return; + case WFD_EVENT_PORT_ATTACH_DETACH: + handlePortAttachDetach(); + break; + case WFD_EVENT_PORT_PROTECTION_FAILURE: + qDebug() << "Port protection event handling not implemented"; + break; + case WFD_EVENT_PIPELINE_BIND_SOURCE_COMPLETE: + handlePipelineBindSourceComplete(); + break; + case WFD_EVENT_PIPELINE_BIND_MASK_COMPLETE: + qDebug() << "Pipeline bind mask event handling not implemented"; + break; + default: + qDebug() << "Not recognised event type"; + break; + } + + +} + +void QOpenWFDDevice::initializeGbmAndEgl() +{ + + qDebug() << "initializing GBM and EGL"; + int fd = wfdGetDeviceAttribi(mDevice,WFD_DEVICE_ID); + if (fd < 0) { + qDebug() << "failed to get WFD_DEVICE_ID"; + } + + mGbmDevice = gbm_create_device(fd); + + setenv("EGL_PLATFORM", "drm",1); + + mEglDisplay = eglGetDisplay(mGbmDevice); + + EGLint minor, major; + + if (!eglInitialize(mEglDisplay,&major,&minor)) { + qDebug() << "failed to initialize egl"; + } + + QByteArray eglExtensions = eglQueryString(mEglDisplay, EGL_EXTENSIONS); + if (!eglExtensions.contains("EGL_KHR_surfaceless_opengl")) { + qDebug() << "This egl implementation does not have the required EGL extension EGL_KHR_surfaceless_opengl"; + } + + eglBindAPI(EGL_OPENGL_ES_API); + + EGLint contextAttribs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + + mEglContext = eglCreateContext(mEglDisplay,NULL,EGL_NO_CONTEXT,contextAttribs); + if (mEglContext == EGL_NO_CONTEXT) { + qDebug() << "Failed to create EGL context"; + } + + eglCreateImage = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR"); + if (!eglCreateImage) { + qWarning("failed to load extension eglCreateImageKHR"); + } + + eglDestroyImage = (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR"); + if (!eglDestroyImage) { + qWarning("failed to load extension eglDestoryImageKHR"); + } + + glEglImageTargetRenderBufferStorage = (PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) eglGetProcAddress("glEGLImageTargetRenderbufferStorageOES"); + if (!glEglImageTargetRenderBufferStorage) { + qWarning("failed to load extension glEGLImageTargetRenderbufferStorageOES"); + } +} + +void QOpenWFDDevice::handlePortAttachDetach() +{ + WFDint id = wfdGetEventAttribi(mDevice,mEvent,WFD_EVENT_PORT_ATTACH_PORT_ID); + if (id == WFD_INVALID_PORT_ID) + return; + + WFDint attachState = wfdGetEventAttribi(mDevice,mEvent,WFD_EVENT_PORT_ATTACH_STATE); + if (attachState == WFD_TRUE) { + int indexToAdd = -1; + for (int i = 0; i < mPorts.size(); i++) { + if (mPorts.at(i)->portId() == id) { + indexToAdd = i; + qDebug() << "found index to attach"; + break; + } + } + if (indexToAdd >= 0) { + mPorts[indexToAdd]->attach(); + } else { + mPorts.append(new QOpenWFDPort(this,id)); + } + + } else { + int indexToDelete = -1; + for (int i = 0; i < mPorts.size(); i++) { + if (mPorts.at(i)->portId() == id) { + indexToDelete = i; + break; + } + } + if (indexToDelete >= 0) { + QOpenWFDPort *portToDelete = mPorts.at(indexToDelete); + mPorts.removeAt(indexToDelete); + delete portToDelete; + } + } +} + +void QOpenWFDDevice::handlePipelineBindSourceComplete() +{ + mWaitingForBindSourceEvent = false; + + WFDint overflow = wfdGetEventAttribi(mDevice,mEvent, WFD_EVENT_PIPELINE_BIND_QUEUE_OVERFLOW); + if (overflow == WFD_TRUE) { + qDebug() << "PIPELINE_BIND_QUEUE_OVERFLOW event occured"; + } + + WFDint pipelineId = wfdGetEventAttribi(mDevice,mEvent,WFD_EVENT_PIPELINE_BIND_PIPELINE_ID); + for (int i = 0; i < mPorts.size(); i++) { + if (pipelineId != WFD_INVALID_PIPELINE_ID && mUsedPipelines.contains(pipelineId)) { + QOpenWFDPort *port = mUsedPipelines.value(pipelineId); + port->screen()->pipelineBindSourceComplete(); + break; + } + } +} diff --git a/src/plugins/platforms/openwfd/qopenwfddevice.h b/src/plugins/platforms/openwfd/qopenwfddevice.h new file mode 100644 index 00000000000..83a55391245 --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfddevice.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENWFDDEVICE_H +#define QOPENWFDDEVICE_H + +#include "qopenwfdintegration.h" + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +class QOpenWFDPort; + +class QOpenWFDDevice : public QObject +{ + Q_OBJECT +public: + QOpenWFDDevice(QOpenWFDIntegration *integration, WFDint handle); + ~QOpenWFDDevice(); + WFDDevice handle() const; + QOpenWFDIntegration *integration() const; + + + bool isPipelineUsed(WFDint pipelineId); + void addToUsedPipelineSet(WFDint pipelineId, QOpenWFDPort *port); + void removeFromUsedPipelineSet(WFDint pipelineId); + + gbm_device *gbmDevice() const; + EGLDisplay eglDisplay() const; + EGLContext eglContext() const; + + PFNEGLCREATEIMAGEKHRPROC eglCreateImage; + PFNEGLDESTROYIMAGEKHRPROC eglDestroyImage; + PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEglImageTargetRenderBufferStorage; + + void commit(WFDCommitType type, WFDHandle handle); + bool isDeviceInitializedAndCommited() const { return mCommitedDevice; } + + void waitForPipelineBindSourceCompleteEvent(); + +public slots: + void readEvents(WFDtime wait = 0); +private: + void initializeGbmAndEgl(); + void handlePortAttachDetach(); + void handlePipelineBindSourceComplete(); + QOpenWFDIntegration *mIntegration; + WFDint mDeviceEnum; + WFDDevice mDevice; + + WFDEvent mEvent; + QSocketNotifier *mEventSocketNotifier; + + QList mPorts; + + QMap mUsedPipelines; + + struct gbm_device *mGbmDevice; + EGLDisplay mEglDisplay; + EGLContext mEglContext; + + bool mCommitedDevice; + bool mWaitingForBindSourceEvent; +}; + +#endif // QOPENWFDDEVICE_H diff --git a/mkspecs/qws/linux-armv6-g++/qplatformdefs.h b/src/plugins/platforms/openwfd/qopenwfdevent.cpp similarity index 93% rename from mkspecs/qws/linux-armv6-g++/qplatformdefs.h rename to src/plugins/platforms/openwfd/qopenwfdevent.cpp index 701c3301449..748dde65e7f 100644 --- a/mkspecs/qws/linux-armv6-g++/qplatformdefs.h +++ b/src/plugins/platforms/openwfd/qopenwfdevent.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the qmake spec of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -39,4 +39,8 @@ ** ****************************************************************************/ -#include "../../linux-g++/qplatformdefs.h" +#include "qopenwfdevent.h" + +QOpenWFDEvent::QOpenWFDEvent() +{ +} diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h b/src/plugins/platforms/openwfd/qopenwfdevent.h similarity index 92% rename from src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h rename to src/plugins/platforms/openwfd/qopenwfdevent.h index c0e5c2a5249..3010fdb55b5 100644 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwsscreenplugin.h +++ b/src/plugins/platforms/openwfd/qopenwfdevent.h @@ -39,9 +39,13 @@ ** ****************************************************************************/ -#ifndef EGLNULLWSSCREENPLUGIN_H -#define EGLNULLWSSCREENPLUGIN_H +#ifndef QOPENWFDEVENT_H +#define QOPENWFDEVENT_H -const char *const PluginName = "eglnullws"; +class QOpenWFDEvent +{ +public: + QOpenWFDEvent(); +}; -#endif // EGLNULLWSSCREENPLUGIN_H +#endif // QOPENWFDEVENT_H diff --git a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp b/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp similarity index 55% rename from src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp rename to src/plugins/platforms/openwfd/qopenwfdglcontext.cpp index 829996b0b0e..0db717c4d61 100644 --- a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg.cpp +++ b/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp @@ -39,50 +39,59 @@ ** ****************************************************************************/ -#include "qgraphicssystem_vg_p.h" -#include -#include -#include -#if defined(Q_OS_SYMBIAN) -#include -#endif -#include +#include "qopenwfdglcontext.h" -QT_BEGIN_NAMESPACE +#include "qopenwfdwindow.h" +#include "qopenwfdscreen.h" -QVGGraphicsSystem::QVGGraphicsSystem() +QOpenWFDGLContext::QOpenWFDGLContext(QOpenWFDDevice *device) + : QPlatformOpenGLContext() + , mWfdDevice(device) { - QApplicationPrivate::graphics_system_name = QLatin1String("openvg"); } -QPixmapData *QVGGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +QSurfaceFormat QOpenWFDGLContext::format() const { -#if !defined(QVG_NO_SINGLE_CONTEXT) && !defined(QVG_NO_PIXMAP_DATA) - // Pixmaps can use QVGPixmapData; bitmaps must use raster. - if (type == QPixmapData::PixmapType) - return new QVGPixmapData(type); - else - return new QRasterPixmapData(type); -#else - return new QRasterPixmapData(type); -#endif + return QSurfaceFormat(); } -QWindowSurface *QVGGraphicsSystem::createWindowSurface(QWidget *widget) const +bool QOpenWFDGLContext::makeCurrent(QPlatformSurface *surface) { -#if defined(Q_OS_SYMBIAN) - if (!QApplicationPrivate::instance()->useTranslucentEGLSurfaces) { - QWidgetPrivate *d = qt_widget_private(widget); - if (!d->isOpaque && widget->testAttribute(Qt::WA_TranslucentBackground)) - return d->createDefaultWindowSurface_sys(); + EGLDisplay display = mWfdDevice->eglDisplay(); + EGLContext context = mWfdDevice->eglContext(); + if (!eglMakeCurrent(display,EGL_NO_SURFACE,EGL_NO_SURFACE,context)) { + qDebug() << "GLContext: eglMakeCurrent FAILED!"; } -#endif - return new QVGWindowSurface(widget); + + QPlatformWindow *window = static_cast(surface); + QOpenWFDScreen *screen = static_cast(QPlatformScreen::platformScreenForWindow(window->window())); + screen->bindFramebuffer(); + return true; } -void QVGGraphicsSystem::releaseCachedResources() +void QOpenWFDGLContext::doneCurrent() { - QVGImagePool::instance()->hibernate(); + //do nothing :) } -QT_END_NAMESPACE +void QOpenWFDGLContext::swapBuffers(QPlatformSurface *surface) +{ + glFlush(); + + QPlatformWindow *window = static_cast(surface); + QOpenWFDScreen *screen = static_cast(QPlatformScreen::platformScreenForWindow(window->window())); + + screen->swapBuffers(); +} + +void (*QOpenWFDGLContext::getProcAddress(const QByteArray &procName)) () +{ + return eglGetProcAddress(procName.data()); +} + +EGLContext QOpenWFDGLContext::eglContext() const +{ + return mWfdDevice->eglContext(); +} + + diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h b/src/plugins/platforms/openwfd/qopenwfdglcontext.h similarity index 76% rename from src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h rename to src/plugins/platforms/openwfd/qopenwfdglcontext.h index bdb1d42d7e1..3287a853c78 100644 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.h +++ b/src/plugins/platforms/openwfd/qopenwfdglcontext.h @@ -39,25 +39,30 @@ ** ****************************************************************************/ -#ifndef EGLNULLWSWINDOWSURFACE_H -#define EGLNULLWSWINDOWSURFACE_H +#ifndef QOPENWFDGLCONTEXT_H +#define QOPENWFDGLCONTEXT_H -#include +#include -class EGLNullWSWindowSurface : public QWSGLWindowSurface +#include "qopenwfddevice.h" + +class QOpenWFDGLContext : public QPlatformOpenGLContext { public: - EGLNullWSWindowSurface(QWidget *widget); - EGLNullWSWindowSurface(); - virtual ~EGLNullWSWindowSurface(); + QOpenWFDGLContext(QOpenWFDDevice *device); - virtual QString key() const; - virtual QPaintDevice *paintDevice(); - virtual bool isValid() const; - virtual QImage image() const; + QSurfaceFormat format() const; + bool makeCurrent(QPlatformSurface *surface); + void doneCurrent(); + + void swapBuffers(QPlatformSurface *surface); + + void (*getProcAddress(const QByteArray &procName)) (); + + EGLContext eglContext() const; private: - QWidget *widget; + QOpenWFDDevice *mWfdDevice; }; -#endif // EGLNULLWSWINDOWSURFACE_H +#endif // QOPENWFDGLCONTEXT_H diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp new file mode 100644 index 00000000000..3d577591833 --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenwfdintegration.h" +#include "qopenwfdscreen.h" +#include "qopenwfdnativeinterface.h" +#include "qopenwfddevice.h" +#include "qopenwfdwindow.h" +#include "qopenwfdglcontext.h" +#include "qopenwfdbackingstore.h" + +#include + +#include +#include +#include + +#include +#include + +#include + +#include + +QOpenWFDIntegration::QOpenWFDIntegration() + : QPlatformIntegration() + , mPrinterSupport(new QGenericUnixPrinterSupport) + , mEventDispatcher(createUnixEventDispatcher()) +{ + QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher); + int numberOfDevices = wfdEnumerateDevices(0,0,0); + + WFDint devices[numberOfDevices]; + int actualNumberOfDevices = wfdEnumerateDevices(devices,numberOfDevices,0); + Q_ASSERT(actualNumberOfDevices == numberOfDevices); + + for (int i = 0; i < actualNumberOfDevices; i++) { + mDevices.append(new QOpenWFDDevice(this,devices[i])); + } + + mFontDatabase = new QGenericUnixFontDatabase(); + mNativeInterface = new QOpenWFDNativeInterface; +} + +QOpenWFDIntegration::~QOpenWFDIntegration() +{ + //dont delete screens since they are deleted by the devices + qDebug() << "deleting platform integration"; + for (int i = 0; i < mDevices.size(); i++) { + delete mDevices[i]; + } + + delete mFontDatabase; + delete mNativeInterface; + delete mPrinterSupport; +} + +bool QOpenWFDIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + case OpenGL: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + +QPlatformWindow *QOpenWFDIntegration::createPlatformWindow(QWindow *window) const +{ + return new QOpenWFDWindow(window); +} + +QPlatformOpenGLContext *QOpenWFDIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const +{ + QOpenWFDScreen *screen = static_cast(context->screen()->handle()); + + return new QOpenWFDGLContext(screen->port()->device()); +} + +QPlatformBackingStore *QOpenWFDIntegration::createPlatformBackingStore(QWindow *window) const +{ + return new QOpenWFDBackingStore(window); +} + +QAbstractEventDispatcher *QOpenWFDIntegration::guiThreadEventDispatcher() const +{ + return mEventDispatcher; +} + +QPlatformFontDatabase *QOpenWFDIntegration::fontDatabase() const +{ + return mFontDatabase; +} + +QPlatformNativeInterface * QOpenWFDIntegration::nativeInterface() const +{ + return mNativeInterface; +} + +QPlatformPrinterSupport * QOpenWFDIntegration::printerSupport() const +{ + return mPrinterSupport; +} + +void QOpenWFDIntegration::addScreen(QOpenWFDScreen *screen) +{ + screenAdded(screen); +} diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.h b/src/plugins/platforms/openwfd/qopenwfdintegration.h new file mode 100644 index 00000000000..b5315b31da0 --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdintegration.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENWFDINTEGRATION_H +#define QOPENWFDINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QOpenWFDDevice; +class QOpenWFDScreen; + +class QOpenWFDIntegration : public QPlatformIntegration +{ +public: + QOpenWFDIntegration(); + ~QOpenWFDIntegration(); + + bool hasCapability(Capability cap) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + + //This should not be a factory interface, but rather a accessor + QAbstractEventDispatcher *guiThreadEventDispatcher() const; + + QPlatformFontDatabase *fontDatabase() const; + + QPlatformNativeInterface *nativeInterface()const; + + QPlatformPrinterSupport *printerSupport() const; + + void addScreen(QOpenWFDScreen *screen); +private: + QList mScreens; + QListmDevices; + + QPlatformFontDatabase *mFontDatabase; + QPlatformNativeInterface *mNativeInterface; + QPlatformPrinterSupport *mPrinterSupport; + QAbstractEventDispatcher *mEventDispatcher; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp b/src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp new file mode 100644 index 00000000000..758e0c43980 --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenwfdnativeinterface.h" + +#include "qopenwfdscreen.h" +#include "qopenwfdwindow.h" +#include "qopenwfdglcontext.h" + +#include +#include + +#include + +#include + +class QOpenWFDResourceMap : public QMap +{ +public: + QOpenWFDResourceMap() + :QMap() + { + insert("wfddevice",QOpenWFDNativeInterface::WFDDevice); + insert("egldisplay",QOpenWFDNativeInterface::EglDisplay); + insert("eglcontext",QOpenWFDNativeInterface::EglContext); + insert("wfdport",QOpenWFDNativeInterface::WFDPort); + insert("wfdpipeline",QOpenWFDNativeInterface::WFDPipeline); + } +}; + +Q_GLOBAL_STATIC(QOpenWFDResourceMap, qOpenWFDResourceMap) + +void *QOpenWFDNativeInterface::nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) +{ + QByteArray lowerCaseResource = resourceString.toLower(); + ResourceType resource = qOpenWFDResourceMap()->value(lowerCaseResource); + void *result = 0; + switch (resource) { + case EglContext: + result = eglContextForContext(context); + break; + default: + result = 0; + } + return result; +} + +void *QOpenWFDNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) +{ + QByteArray lowerCaseResource = resourceString.toLower(); + ResourceType resource = qOpenWFDResourceMap()->value(lowerCaseResource); + void *result = 0; + switch (resource) { + //What should we do for int wfd handles? This is clearly not the solution + case WFDDevice: + result = (void *)wfdDeviceForWindow(window); + break; + case WFDPort: + result = (void *)wfdPortForWindow(window); + break; + case WFDPipeline: + result = (void *)wfdPipelineForWindow(window); + break; + case EglDisplay: + result = eglDisplayForWindow(window); + break; + default: + result = 0; + } + return result; +} + +WFDHandle QOpenWFDNativeInterface::wfdDeviceForWindow(QWindow *window) +{ + QOpenWFDWindow *openWFDwindow = static_cast(window->handle()); + return openWFDwindow->port()->device()->handle(); +} + +WFDHandle QOpenWFDNativeInterface::wfdPortForWindow(QWindow *window) +{ + QOpenWFDWindow *openWFDwindow = static_cast(window->handle()); + return openWFDwindow->port()->handle(); +} + +WFDHandle QOpenWFDNativeInterface::wfdPipelineForWindow(QWindow *window) + +{ + QOpenWFDWindow *openWFDwindow = static_cast(window->handle()); + return openWFDwindow->port()->pipeline(); + +} + +void *QOpenWFDNativeInterface::eglDisplayForWindow(QWindow *window) +{ + QOpenWFDWindow *openWFDwindow = static_cast(window->handle()); + return openWFDwindow->port()->device()->eglDisplay(); +} + +void * QOpenWFDNativeInterface::eglContextForContext(QOpenGLContext *context) +{ + QOpenWFDGLContext *openWFDContext = static_cast(context->handle()); + return openWFDContext->eglContext(); +} diff --git a/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h b/src/plugins/platforms/openwfd/qopenwfdnativeinterface.h similarity index 67% rename from src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h rename to src/plugins/platforms/openwfd/qopenwfdnativeinterface.h index b6cfc60293e..cff49dc8b07 100644 --- a/src/plugins/graphicssystems/trace/qgraphicssystem_trace_p.h +++ b/src/plugins/platforms/openwfd/qopenwfdnativeinterface.h @@ -39,33 +39,38 @@ ** ****************************************************************************/ -#ifndef QGRAPHICSSYSTEM_TRACE_P_H -#define QGRAPHICSSYSTEM_TRACE_P_H +#ifndef QOPENWFDNATIVEINTERFACE_H +#define QOPENWFDNATIVEINTERFACE_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 -#include +#include -QT_BEGIN_NAMESPACE +class QOpenWFDScreen; -class QTraceGraphicsSystem : public QGraphicsSystem +class QOpenWFDNativeInterface : public QPlatformNativeInterface { public: - QTraceGraphicsSystem(); + enum ResourceType { + WFDDevice, + EglDisplay, + EglContext, + WFDPort, + WFDPipeline + }; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; + void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context); + void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); + + WFDHandle wfdDeviceForWindow(QWindow *window); + void *eglDisplayForWindow(QWindow *window); + WFDHandle wfdPortForWindow(QWindow *window); + WFDHandle wfdPipelineForWindow(QWindow *window); + + void *eglContextForContext(QOpenGLContext *context); + +private: + static QOpenWFDScreen *qPlatformScreenForWindow(QWindow *window); }; -QT_END_NAMESPACE - -#endif +#endif // QOPENWFDNATIVEINTERFACE_H diff --git a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp new file mode 100644 index 00000000000..fb3292c31ab --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenwfdoutputbuffer.h" + +#include "qopenwfdport.h" + +QOpenWFDOutputBuffer::QOpenWFDOutputBuffer(const QSize &size, QOpenWFDPort *port) + : mPort(port) + , mAvailable(true) +{ + qDebug() << "creating output buffer for size" << size; + glGenRenderbuffers(1,&mRbo); + glBindRenderbuffer(GL_RENDERBUFFER, mRbo); + + mGbm_buffer = gbm_bo_create(port->device()->gbmDevice(), + size.width(), + size.height(), + GBM_BO_FORMAT_XRGB8888, + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + + mEglImage = port->device()->eglCreateImage(port->device()->eglDisplay(),0, EGL_NATIVE_PIXMAP_KHR, mGbm_buffer, 0); + + port->device()->glEglImageTargetRenderBufferStorage(GL_RENDERBUFFER,mEglImage); + + mWfdSource = wfdCreateSourceFromImage(port->device()->handle(),port->pipeline(),mEglImage,WFD_NONE); + if (mWfdSource == WFD_INVALID_HANDLE) { + qWarning("failed to create wfdSource from image"); + } +} + +QOpenWFDOutputBuffer::~QOpenWFDOutputBuffer() +{ + wfdDestroySource(mPort->device()->handle(),mWfdSource); + if (!mPort->device()->eglDestroyImage(mPort->device()->eglDisplay(),mEglImage)) { + qDebug() << "could not delete eglImage"; + } + gbm_bo_destroy(mGbm_buffer); + + glDeleteRenderbuffers(1, &mRbo); +} + +void QOpenWFDOutputBuffer::bindToCurrentFbo() +{ + glFramebufferRenderbuffer(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, + mRbo); + if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { + qDebug() << "framebuffer not ready!"; + } +} diff --git a/src/gui/embedded/qmouselinuxinput_qws.h b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h similarity index 73% rename from src/gui/embedded/qmouselinuxinput_qws.h rename to src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h index a02bccfde08..1697f076a9b 100644 --- a/src/gui/embedded/qmouselinuxinput_qws.h +++ b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h @@ -39,40 +39,31 @@ ** ****************************************************************************/ -#ifndef QMOUSELINUXINPUT_QWS_H -#define QMOUSELINUXINPUT_QWS_H +#ifndef QOPENWFDOUTPUTBUFFER_H +#define QOPENWFDOUTPUTBUFFER_H -#include +#include "qopenwfdport.h" -QT_BEGIN_HEADER +#include +#include -QT_BEGIN_NAMESPACE - -QT_MODULE(Gui) - -#ifndef QT_NO_QWS_MOUSE_LINUXINPUT - -class QWSLinuxInputMousePrivate; - -class QWSLinuxInputMouseHandler : public QWSCalibratedMouseHandler +class QOpenWFDOutputBuffer { public: - QWSLinuxInputMouseHandler(const QString &); - ~QWSLinuxInputMouseHandler(); - - void suspend(); - void resume(); + QOpenWFDOutputBuffer(const QSize &size, QOpenWFDPort *port); + ~QOpenWFDOutputBuffer(); + void bindToCurrentFbo(); + bool isAvailable() const { return mAvailable; } + void setAvailable(bool available) { mAvailable = available; } + WFDSource wfdSource() const { return mWfdSource; } private: - QWSLinuxInputMousePrivate *d; - - friend class QWSLinuxInputMousePrivate; + QOpenWFDPort *mPort; + WFDSource mWfdSource; + GLuint mRbo; + EGLImageKHR mEglImage; + struct gbm_bo *mGbm_buffer; + bool mAvailable; }; -#endif // QT_NO_QWS_MOUSE_LINUXINPUT - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMOUSELINUXINPUT_QWS_H +#endif // QOPENWFDOUTPUTBUFFER_H diff --git a/src/plugins/platforms/openwfd/qopenwfdport.cpp b/src/plugins/platforms/openwfd/qopenwfdport.cpp new file mode 100644 index 00000000000..5f38e48eed6 --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdport.cpp @@ -0,0 +1,212 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenwfdport.h" + +#include "qopenwfdportmode.h" +#include "qopenwfdscreen.h" + +#include + +QOpenWFDPort::QOpenWFDPort(QOpenWFDDevice *device, WFDint portEnumeration) + : mDevice(device) + , mPortId(portEnumeration) + , mAttached(false) + , mPipelineId(WFD_INVALID_PIPELINE_ID) + , mPipeline(WFD_INVALID_HANDLE) +{ + mPort = wfdCreatePort(device->handle(),portEnumeration,0); + WFDint isPortAttached = wfdGetPortAttribi(device->handle(),mPort,WFD_PORT_ATTACHED); + if (isPortAttached) { + attach(); + } +} + +QOpenWFDPort::~QOpenWFDPort() +{ + detach(); + + wfdDestroyPort(mDevice->handle(),mPort); +} + +void QOpenWFDPort::attach() +{ + if (mAttached) { + return; + } + + //just forcing port to be on + wfdSetPortAttribi(mDevice->handle(), mPort, WFD_PORT_POWER_MODE, WFD_POWER_MODE_ON); + + int numberOfPortModes = wfdGetPortModes(mDevice->handle(),mPort,0,0); + WFDPortMode portModes[numberOfPortModes]; + int actualNumberOfPortModes = wfdGetPortModes(mDevice->handle(),mPort,portModes,numberOfPortModes); + Q_ASSERT(actualNumberOfPortModes == numberOfPortModes); + + if (!actualNumberOfPortModes) { + qDebug() << "didn't find any available port modes"; + return; + } + + for (int i = 0; i < actualNumberOfPortModes; i++) { + if (portModes[i] != WFD_INVALID_HANDLE) { + mPortModes.append(QOpenWFDPortMode(this,portModes[i])); + qDebug() << "PortModeAdded:" << mPortModes.at(mPortModes.size()-1); + } + } + + + mPixelSize = setNativeResolutionMode(); + if (mPixelSize.isEmpty()) { + qDebug() << "Could not set native resolution mode in QOpenWFPort"; + } + + WFDfloat physicalWFDSize[2]; + wfdGetPortAttribfv(mDevice->handle(),mPort,WFD_PORT_PHYSICAL_SIZE,2,physicalWFDSize); + mPhysicalSize = QSizeF(physicalWFDSize[0],physicalWFDSize[1]); + + WFDint numAvailablePipelines = wfdGetPortAttribi(mDevice->handle(),mPort,WFD_PORT_PIPELINE_ID_COUNT); + if (!numAvailablePipelines) { + qFatal("Not possible to make screen that is not possible to create WFPort with no pipline"); + } + + WFDint pipeIds[numAvailablePipelines]; + wfdGetPortAttribiv(mDevice->handle(),mPort,WFD_PORT_BINDABLE_PIPELINE_IDS,numAvailablePipelines,pipeIds); + + for (int i = 0; i < numAvailablePipelines; i++) { + if (pipeIds[i] != WFD_INVALID_PIPELINE_ID && !mDevice->isPipelineUsed(pipeIds[i])) { + mPipelineId = pipeIds[i]; + mDevice-> addToUsedPipelineSet(mPipelineId,this); + + mPipeline = wfdCreatePipeline(mDevice->handle(),mPipelineId,WFD_NONE); + if (mPipeline == WFD_INVALID_HANDLE) { + qFatal("Failed to create pipeline for port %p", this); + } + break; + } + } + + if (mPipeline == WFD_INVALID_HANDLE) { + qWarning("Failed to create pipeline and cant bind it to port"); + } + + WFDint geomerty[] = { 0, 0, mPixelSize.width(), mPixelSize.height() }; + + wfdSetPipelineAttribiv(mDevice->handle(),mPipeline, WFD_PIPELINE_SOURCE_RECTANGLE, 4, geomerty); + wfdSetPipelineAttribiv(mDevice->handle(),mPipeline, WFD_PIPELINE_DESTINATION_RECTANGLE, 4, geomerty); + + wfdBindPipelineToPort(mDevice->handle(),mPort,mPipeline); + + mScreen = new QOpenWFDScreen(this); + mDevice->integration()->addScreen(mScreen); + mAttached = true; +} + +void QOpenWFDPort::detach() +{ + if (!mAttached) + return; + + mAttached = false; + mOn = false; + + delete mScreen; + + wfdDestroyPipeline(mDevice->handle(),mPipeline); + mPipelineId = WFD_INVALID_PIPELINE_ID; + mPipeline = WFD_INVALID_HANDLE; +} + +bool QOpenWFDPort::attached() const +{ + return mAttached; +} + +QSize QOpenWFDPort::setNativeResolutionMode() +{ + WFDint nativePixelSize[2]; + wfdGetPortAttribiv(device()->handle(),mPort,WFD_PORT_NATIVE_RESOLUTION,2,nativePixelSize); + QSize nativeSize(nativePixelSize[0],nativePixelSize[1]); + + for (int i = 0; i < mPortModes.size(); i++) { + const QOpenWFDPortMode &mode = mPortModes.at(i); + if (nativeSize == mode.size()) { + wfdSetPortMode(device()->handle(),mPort,mode.handle()); + return nativeSize; + } + } + return QSize(); +} + +QSize QOpenWFDPort::pixelSize() const +{ + return mPixelSize; +} + +QSizeF QOpenWFDPort::physicalSize() const +{ + return mPhysicalSize; +} + +QOpenWFDDevice * QOpenWFDPort::device() const +{ + return mDevice; +} + +WFDPort QOpenWFDPort::handle() const +{ + return mPort; +} + +WFDint QOpenWFDPort::portId() const +{ + return mPortId; +} + +WFDPipeline QOpenWFDPort::pipeline() const +{ + return mPipeline; +} + +QOpenWFDScreen * QOpenWFDPort::screen() const +{ + return mScreen; +} diff --git a/src/plugins/platforms/openwfd/qopenwfdport.h b/src/plugins/platforms/openwfd/qopenwfdport.h new file mode 100644 index 00000000000..497c43749ef --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdport.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENWFDPORT_H +#define QOPENWFDPORT_H + +#include "qopenwfddevice.h" +#include "qopenwfdportmode.h" + +#include + +class QOpenWFDPort +{ +public: + QOpenWFDPort(QOpenWFDDevice *device, WFDint portEnumeration); + ~QOpenWFDPort(); + void attach(); + void detach(); + bool attached() const; + + QSize setNativeResolutionMode(); + + QSize pixelSize() const; + QSizeF physicalSize() const; + + QOpenWFDDevice *device() const; + WFDPort handle() const; + WFDint portId() const; + WFDPipeline pipeline() const; + QOpenWFDScreen *screen() const; + +private: + QOpenWFDDevice *mDevice; + WFDPort mPort; + WFDint mPortId; + + QList mPortModes; + + bool mAttached; + bool mOn; + QSize mPixelSize; + QSizeF mPhysicalSize; + + QOpenWFDScreen *mScreen; + + WFDint mPipelineId; + WFDPipeline mPipeline; + +}; + +#endif // QOPENWFDPORT_H diff --git a/src/plugins/gfxdrivers/ahi/qscreenahiplugin.cpp b/src/plugins/platforms/openwfd/qopenwfdportmode.cpp similarity index 62% rename from src/plugins/gfxdrivers/ahi/qscreenahiplugin.cpp rename to src/plugins/platforms/openwfd/qopenwfdportmode.cpp index 8cbc0447e5b..4e507a42a15 100644 --- a/src/plugins/gfxdrivers/ahi/qscreenahiplugin.cpp +++ b/src/plugins/platforms/openwfd/qopenwfdportmode.cpp @@ -39,36 +39,25 @@ ** ****************************************************************************/ -#include "qscreenahi_qws.h" +#include "qopenwfdportmode.h" -#include -#include +#include "qopenwfdport.h" -class QAhiScreenPlugin : public QScreenDriverPlugin +QOpenWFDPortMode::QOpenWFDPortMode(QOpenWFDPort *port, WFDPortMode portMode) + : mPortMode(portMode) { -public: - QAhiScreenPlugin(); + int width = wfdGetPortModeAttribi(port->device()->handle(),port->handle(),portMode,WFD_PORT_MODE_WIDTH); + int height = wfdGetPortModeAttribi(port->device()->handle(),port->handle(),portMode,WFD_PORT_MODE_HEIGHT); + mSize = QSize(width,height); - QStringList keys() const; - QScreen *create(const QString&, int displayId); -}; - -QAhiScreenPlugin::QAhiScreenPlugin() - : QScreenDriverPlugin() -{ + mRefresh = wfdGetPortModeAttribf(port->device()->handle(),port->handle(),portMode,WFD_PORT_MODE_REFRESH_RATE); + mFlipMirror = wfdGetPortModeAttribi(port->device()->handle(),port->handle(),portMode,WFD_PORT_MODE_FLIP_MIRROR_SUPPORT); + mInterlaced = wfdGetPortModeAttribi(port->device()->handle(), port->handle(),portMode,WFD_PORT_MODE_INTERLACED); } -QStringList QAhiScreenPlugin::keys() const +QDebug operator<<(QDebug s, const QOpenWFDPortMode &portMode) { - return (QStringList() << "ahi"); + s.nospace() << "QOpenWFPortMode( " << portMode.size() << " Refreash: " << portMode.refreshRate() + << " FlipMirror: " << portMode.flipMirror() << " Interlaced: " << portMode.interlaced(); + return s; } - -QScreen* QAhiScreenPlugin::create(const QString& driver, int displayId) -{ - if (driver.toLower() != "ahi") - return 0; - - return new QAhiScreen(displayId); -} - -Q_EXPORT_PLUGIN2(qahiscreen, QAhiScreenPlugin) diff --git a/src/plugins/platforms/openwfd/qopenwfdportmode.h b/src/plugins/platforms/openwfd/qopenwfdportmode.h new file mode 100644 index 00000000000..dd953394049 --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdportmode.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENWFDPORTMODE_H +#define QOPENWFDPORTMODE_H + +#include + +#include + +#include + +class QOpenWFDPort; + +class QOpenWFDPortMode +{ +public: + QOpenWFDPortMode(QOpenWFDPort *port, WFDPortMode portMode); + + QSize size() const {return mSize;} + qreal refreshRate() const { return mRefresh; } + bool flipMirror() const { return mFlipMirror; } + bool interlaced() const { return mInterlaced; } + + WFDPortMode handle() const { return mPortMode; } +private: + WFDPortMode mPortMode; + + QSize mSize; + qreal mRefresh; + bool mFlipMirror; + bool mInterlaced; +}; + +QDebug operator<<(QDebug, const QOpenWFDPortMode &); +#endif // QOPENWFPORTMODE_H diff --git a/src/plugins/platforms/openwfd/qopenwfdscreen.cpp b/src/plugins/platforms/openwfd/qopenwfdscreen.cpp new file mode 100644 index 00000000000..785bee9c556 --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdscreen.cpp @@ -0,0 +1,192 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qopenwfdscreen.h" + +#include "qopenwfdport.h" +#include "qopenwfdoutputbuffer.h" + +#include + +QOpenWFDScreen::QOpenWFDScreen(QOpenWFDPort *port) + : mPort(port) + , mFbo(0) + , mOutputBuffers(BUFFER_NUM) + , mCurrentRenderBufferIndex(0) + , mStagedBackBufferIndex(-1) + , mCommitedBackBufferIndex(-1) + , mBackBufferIndex(-1) +{ + printf ("\n"); + printf ("Information of screen %p:\n", this); + printf (" width..........: %d\n", port->pixelSize().width()); + printf (" height.........: %d\n", port->pixelSize().height()); + printf (" physical width.: %f\n", port->physicalSize().width()); + printf (" physical height: %f\n", port->physicalSize().height()); + printf ("\n"); + + EGLDisplay display = mPort->device()->eglDisplay(); + EGLContext context = mPort->device()->eglContext(); + + if (!eglMakeCurrent(display,EGL_NO_SURFACE,EGL_NO_SURFACE,context)) { + qDebug() << "screen: eglMakeCurrent FAILED"; + } + + glGenFramebuffers(1,&mFbo); + glBindFramebuffer(GL_FRAMEBUFFER,mFbo); + + for (int i = 0; i < mOutputBuffers.size(); i++) { + mOutputBuffers[i] = new QOpenWFDOutputBuffer(mPort->pixelSize(),mPort); + } + + mStagedBackBufferIndex = mOutputBuffers.size()-1; + mOutputBuffers[mStagedBackBufferIndex]->setAvailable(false);; + commitStagedOutputBuffer(); + + mOutputBuffers.at(mCurrentRenderBufferIndex)->bindToCurrentFbo(); + + if (mPort->device()->isDeviceInitializedAndCommited()) { + mPort->device()->commit(WFD_COMMIT_ENTIRE_PORT,mPort->handle()); + } + +} + +QOpenWFDScreen::~QOpenWFDScreen() +{ + for (int i = 0; i < mOutputBuffers.size(); i++) { + delete mOutputBuffers[i]; + } + glDeleteFramebuffers(1, &mFbo); +} + +QRect QOpenWFDScreen::geometry() const +{ + return QRect(QPoint(),mPort->pixelSize()); +} + +int QOpenWFDScreen::depth() const +{ + return 32; +} + +QImage::Format QOpenWFDScreen::format() const +{ + return QImage::Format_RGB32; +} + +QSize QOpenWFDScreen::physicalSize() const +{ + return mPort->physicalSize().toSize(); +} + +QOpenWFDPort * QOpenWFDScreen::port() const +{ + return mPort; +} + +void QOpenWFDScreen::swapBuffers() +{ + glFlush(); + + setStagedBackBuffer(mCurrentRenderBufferIndex); + mCurrentRenderBufferIndex = nextAvailableRenderBuffer(); + + bindFramebuffer(); + mOutputBuffers.at(mCurrentRenderBufferIndex)->bindToCurrentFbo(); +} + +void QOpenWFDScreen::bindFramebuffer() +{ + glBindFramebuffer(GL_FRAMEBUFFER,mFbo); +} + +void QOpenWFDScreen::setStagedBackBuffer(int bufferIndex) +{ + if (mStagedBackBufferIndex >= 0) { + mOutputBuffers[mStagedBackBufferIndex]->setAvailable(true); + } + + mOutputBuffers[bufferIndex]->setAvailable(false);; + mStagedBackBufferIndex = bufferIndex; + + if (mCommitedBackBufferIndex < 0) { + commitStagedOutputBuffer(); + } +} + +void QOpenWFDScreen::commitStagedOutputBuffer() +{ + Q_ASSERT(mStagedBackBufferIndex >= 0); + wfdBindSourceToPipeline(mPort->device()->handle(), + mPort->pipeline(), + mOutputBuffers.at(mStagedBackBufferIndex)->wfdSource(), + WFD_TRANSITION_AT_VSYNC, + 0); + mPort->device()->commit(WFD_COMMIT_PIPELINE,mPort->pipeline()); + mCommitedBackBufferIndex = mStagedBackBufferIndex; + mStagedBackBufferIndex = -1; +} + +int QOpenWFDScreen::nextAvailableRenderBuffer() const +{ + while (true) { + for (int i = 0; i < mOutputBuffers.size(); i++) { + if (mOutputBuffers.at(i)->isAvailable()) { + return i; + } + } + mPort->device()->waitForPipelineBindSourceCompleteEvent(); + } +} + +void QOpenWFDScreen::pipelineBindSourceComplete() +{ + if (mBackBufferIndex >= 0) { + mOutputBuffers[mBackBufferIndex]->setAvailable(true); + } + + mBackBufferIndex = mCommitedBackBufferIndex; + mCommitedBackBufferIndex = -1; + + if (mStagedBackBufferIndex >= 0) { + commitStagedOutputBuffer(); + } +} diff --git a/src/plugins/platforms/openwfd/qopenwfdscreen.h b/src/plugins/platforms/openwfd/qopenwfdscreen.h new file mode 100644 index 00000000000..bb23744ac42 --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdscreen.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENWFDSCREEN_H +#define QOPENWFDSCREEN_H + +#include + + +#include "qopenwfdoutputbuffer.h" + +#include + +#include +#include + +#define BUFFER_NUM 4 + +class QOpenWFDPort; +class QOpenWFDScreen : public QPlatformScreen +{ +public: + QOpenWFDScreen(QOpenWFDPort *port); + ~QOpenWFDScreen(); + + QRect geometry() const; + int depth() const; + QImage::Format format() const; + QSize physicalSize() const; + + QOpenWFDPort *port() const; + + void swapBuffers(); + void bindFramebuffer(); + void pipelineBindSourceComplete(); + +private: + void setStagedBackBuffer(int bufferIndex); + void commitStagedOutputBuffer(); + int nextAvailableRenderBuffer() const; + + QOpenWFDPort *mPort; + + GLuint mFbo; + + QVarLengthArray mOutputBuffers; + int mCurrentRenderBufferIndex; + int mStagedBackBufferIndex; + int mCommitedBackBufferIndex; + int mBackBufferIndex; +}; + +#endif diff --git a/src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.cpp b/src/plugins/platforms/openwfd/qopenwfdwindow.cpp similarity index 77% rename from src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.cpp rename to src/plugins/platforms/openwfd/qopenwfdwindow.cpp index 3d6545e017a..15dc4b11c45 100644 --- a/src/plugins/graphicssystems/meego/qmeegorasterpixmapdata.cpp +++ b/src/plugins/platforms/openwfd/qopenwfdwindow.cpp @@ -39,22 +39,23 @@ ** ****************************************************************************/ -#include "qmeegorasterpixmapdata.h" +#include "qopenwfdwindow.h" -/* Public */ +#include "qopenwfdscreen.h" +#include "QtGui/QWindowSystemInterface" -QMeeGoRasterPixmapData::QMeeGoRasterPixmapData() : QRasterPixmapData(QPixmapData::PixmapType) +QOpenWFDWindow::QOpenWFDWindow(QWindow *window) + : QPlatformWindow(window) { + + QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(window); + mPort = static_cast(platformScreen)->port(); + + QWindowSystemInterface::handleGeometryChange(window,QRect(QPoint(0,0),mPort->screen()->geometry().size())); } -QMeeGoRasterPixmapData::QMeeGoRasterPixmapData(QPixmapData::PixelType t) : QRasterPixmapData(t) +QOpenWFDPort *QOpenWFDWindow::port() const { + return mPort; } -void QMeeGoRasterPixmapData::copy(const QPixmapData *data, const QRect &rect) -{ - if (data->classId() == QPixmapData::OpenGLClass) - fromImage(data->toImage(rect).copy(), Qt::NoOpaqueDetection); - else - QRasterPixmapData::copy(data, rect); -} diff --git a/src/plugins/platforms/openwfd/qopenwfdwindow.h b/src/plugins/platforms/openwfd/qopenwfdwindow.h new file mode 100644 index 00000000000..3c97b014b1d --- /dev/null +++ b/src/plugins/platforms/openwfd/qopenwfdwindow.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QOPENWFDWINDOW_H +#define QOPENWFDWINDOW_H + +#include +#include + +#include "qopenwfdport.h" + +class QOpenWFDWindow : public QPlatformWindow +{ +public: + QOpenWFDWindow(QWindow *window); + + QOpenWFDPort *port() const; + +private: + QOpenWFDPort *mPort; +}; + +#endif // QOPENWFWINDOW_H diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro index 492569796fd..ac001b665b2 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro @@ -9,3 +9,9 @@ contains(QT_CONFIG, wayland) { contains(QT_CONFIG, xcb) { SUBDIRS += xcb } + +mac { + SUBDIRS += cocoa +} + +win32: SUBDIRS += windows diff --git a/src/plugins/platforms/qvfb/qvfb.pro b/src/plugins/platforms/qvfb/qvfb.pro index 5db85332647..a95b13efc7c 100644 --- a/src/plugins/platforms/qvfb/qvfb.pro +++ b/src/plugins/platforms/qvfb/qvfb.pro @@ -3,6 +3,7 @@ load(qt_plugin) DESTDIR = $$QT.gui.plugins/platforms +QT += core-private gui-private platformsupport-private SOURCES = main.cpp qvfbintegration.cpp qvfbwindowsurface.cpp HEADERS = qvfbintegration.h qvfbwindowsurface.h diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp index 6b54420402f..d4d8183936b 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.cpp +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -63,6 +63,7 @@ #include #include "qgenericunixfontdatabase.h" +#include "qgenericunixeventdispatcher.h" QT_BEGIN_NAMESPACE @@ -422,9 +423,9 @@ QVFbIntegration::QVFbIntegration(const QStringList ¶mList) mScreens.append(mPrimaryScreen); } -QPixmapData *QVFbIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QVFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QWindowSurface *QVFbIntegration::createWindowSurface(QWidget *widget, WId) const @@ -438,6 +439,11 @@ QPlatformWindow *QVFbIntegration::createPlatformWindow(QWidget *widget, WId) con return new QVFbWindow(mPrimaryScreen, widget); } +QAbstractEventDispatcher *QVFbIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + QPlatformFontDatabase *QVFbIntegration::fontDatabase() const { return mFontDb; diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h index ae3ba7bcc36..1c736c24e00 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.h +++ b/src/plugins/platforms/qvfb/qvfbintegration.h @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE class QVFbScreenPrivate; +class QAbstractEventDispatcher; class QVFbScreen : public QPlatformScreen { @@ -78,9 +79,10 @@ class QVFbIntegration : public QPlatformIntegration public: QVFbIntegration(const QStringList ¶mList); - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + QAbstractEventDispatcher *createEventDispatcher() const; QList screens() const { return mScreens; } diff --git a/src/plugins/platforms/uikit/quikitintegration.h b/src/plugins/platforms/uikit/quikitintegration.h index 92247fdff36..b8a15b38075 100644 --- a/src/plugins/platforms/uikit/quikitintegration.h +++ b/src/plugins/platforms/uikit/quikitintegration.h @@ -52,7 +52,7 @@ public: QUIKitIntegration(); ~QUIKitIntegration(); - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/uikit/quikitintegration.mm b/src/plugins/platforms/uikit/quikitintegration.mm index 737fa40d057..37ba2b9a021 100644 --- a/src/plugins/platforms/uikit/quikitintegration.mm +++ b/src/plugins/platforms/uikit/quikitintegration.mm @@ -64,9 +64,9 @@ QUIKitIntegration::~QUIKitIntegration() { } -QPixmapData *QUIKitIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QUIKitIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QPlatformWindow *QUIKitIntegration::createPlatformWindow(QWidget *widget, WId winId) const diff --git a/src/plugins/platforms/uikit/quikitwindow.h b/src/plugins/platforms/uikit/quikitwindow.h index c482dae3d5a..67f0242a483 100644 --- a/src/plugins/platforms/uikit/quikitwindow.h +++ b/src/plugins/platforms/uikit/quikitwindow.h @@ -117,7 +117,7 @@ public: UIWindow *ensureNativeWindow(); - QPlatformGLContext *glContext() const; + QPlatformOpenGLContext *glContext() const; private: QUIKitScreen *mScreen; diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm index 29ca88b75a2..cc17dbcbfb4 100644 --- a/src/plugins/platforms/uikit/quikitwindow.mm +++ b/src/plugins/platforms/uikit/quikitwindow.mm @@ -48,12 +48,12 @@ #include #include #include -#include +#include #include #include -class EAGLPlatformContext : public QPlatformGLContext +class EAGLPlatformContext : public QPlatformOpenGLContext { public: EAGLPlatformContext(EAGLView *view) @@ -91,13 +91,13 @@ public: void makeCurrent() { - QPlatformGLContext::makeCurrent(); + QPlatformOpenGLContext::makeCurrent(); [mView makeCurrent]; } void doneCurrent() { - QPlatformGLContext::doneCurrent(); + QPlatformOpenGLContext::doneCurrent(); } void swapBuffers() @@ -381,7 +381,7 @@ UIWindow *QUIKitWindow::ensureNativeWindow() return mWindow; } -QPlatformGLContext *QUIKitWindow::glContext() const +QPlatformOpenGLContext *QUIKitWindow::glContext() const { if (!mContext) { mContext = new EAGLPlatformContext(mView); diff --git a/src/plugins/platforms/uikit/uikit.pro b/src/plugins/platforms/uikit/uikit.pro index 45a48dc92ad..5e3a0e6b7cc 100644 --- a/src/plugins/platforms/uikit/uikit.pro +++ b/src/plugins/platforms/uikit/uikit.pro @@ -1,5 +1,5 @@ TARGET = quikit -load(qt_plugin) +load(qpa/plugin) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms QT += opengl @@ -22,6 +22,6 @@ HEADERS = quikitsoftwareinputhandler.h #add libz for freetype. LIBS += -lz -#include(../fontdatabases/basicunix/basicunix.pri) +#load(qpa/fontdatabases/basicunix) 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 1e8c6c1bc5f..7506bff3072 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -161,9 +161,9 @@ bool QVNCIntegration::hasCapability(QPlatformIntegration::Capability cap) const } -QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformPixmap *QVNCIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPlatformPixmap(type); } QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const @@ -173,6 +173,10 @@ QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const return surface; } +QAbstractEventDispatcher *QVFbIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} QPlatformWindow *QVNCIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index 3e13bc3b8d2..9787a59f0fb 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -74,7 +74,7 @@ private: }; class QVNCIntegrationPrivate; - +class QAbstractEventDispatcher; class QVNCIntegration : public QPlatformIntegration { @@ -82,9 +82,10 @@ public: QVNCIntegration(const QStringList& paramList); bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + QAbstractEventDispatcher createEventDispatcher() const; QPixmap grabWindow(WId window, int x, int y, int width, int height) const; diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp index 8b25e054d11..37412b6bd10 100644 --- a/src/plugins/platforms/vnc/qvncserver.cpp +++ b/src/plugins/platforms/vnc/qvncserver.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro index 85bffb0637e..321cee47907 100644 --- a/src/plugins/platforms/vnc/vnc.pro +++ b/src/plugins/platforms/vnc/vnc.pro @@ -1,7 +1,7 @@ TARGET = qvncgraphicssystem load(qt_plugin) -QT += network +QT += network core-private gui-private platformsupport-private DESTDIR = $$QT.gui.plugins/platforms diff --git a/src/plugins/platforms/wayland/gl_integration/gl_integration.pri b/src/plugins/platforms/wayland/gl_integration/gl_integration.pri index d9b5fa9bff4..20c3aa0bd9e 100644 --- a/src/plugins/platforms/wayland/gl_integration/gl_integration.pri +++ b/src/plugins/platforms/wayland/gl_integration/gl_integration.pri @@ -3,12 +3,10 @@ contains(QT_CONFIG, opengl) { QT += opengl HEADERS += \ - $$PWD/qwaylandglintegration.h \ - $$PWD/qwaylandglwindowsurface.h + $$PWD/qwaylandglintegration.h SOURCES += \ - $$PWD/qwaylandglintegration.cpp \ - $$PWD/qwaylandglwindowsurface.cpp + $$PWD/qwaylandglintegration.cpp QT_WAYLAND_GL_CONFIG = $$(QT_WAYLAND_GL_CONFIG) contains(QT_CONFIG, opengles2) { @@ -22,6 +20,9 @@ SOURCES += \ QT_WAYLAND_GL_INTEGRATION = xcomposite_egl CONFIG += xcomposite_egl } + } else:mac { + QT_WAYLAND_GL_INTEGRATION = readback_cgl + CONFIG += readback_cgl } else { isEqual(QT_WAYLAND_GL_CONFIG, readback) { QT_WAYLAND_GL_INTEGRATION = readback_glx @@ -48,6 +49,10 @@ readback_glx { include ($$PWD/readback_glx/readback_glx.pri) } +readback_cgl { + include ($$PWD/readback_cgl/readback_cgl.pri) +} + xcomposite_glx { include ($$PWD/xcomposite_glx/xcomposite_glx.pri) } diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h b/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h index 4b50b4bd68c..4f688e41d80 100644 --- a/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/qwaylandglintegration.h @@ -44,7 +44,10 @@ class QWaylandWindow; class QWaylandDisplay; -class QWidget; +class QWindow; + +class QPlatformOpenGLContext; +class QSurfaceFormat; class QWaylandGLIntegration { @@ -54,7 +57,8 @@ public: virtual void initialize() = 0; - virtual QWaylandWindow *createEglWindow(QWidget *widget) = 0; + virtual QWaylandWindow *createEglWindow(QWindow *window) = 0; + virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0; static QWaylandGLIntegration *createGLIntegration(QWaylandDisplay *waylandDisplay); }; diff --git a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp b/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp deleted file mode 100644 index fef07e6bf7e..00000000000 --- a/src/plugins/platforms/wayland/gl_integration/qwaylandglwindowsurface.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandglwindowsurface.h" - -#include "qwaylanddisplay.h" -#include "qwaylandwindow.h" -#include "qwaylandscreen.h" - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, const QRectF &br) -{ -#if !defined(QT_OPENGL_ES_2) - QGLContext *ctx = const_cast(QGLContext::currentContext()); -#endif - const GLenum target = GL_TEXTURE_2D; - QRectF src = br.isEmpty() - ? QRectF(QPointF(), texSize) - : QRectF(QPointF(br.x(), texSize.height() - br.bottom()), br.size()); - - if (target == GL_TEXTURE_2D) { - qreal width = texSize.width(); - qreal height = texSize.height(); - - src.setLeft(src.left() / width); - src.setRight(src.right() / width); - src.setTop(src.top() / height); - src.setBottom(src.bottom() / height); - } - - const GLfloat tx1 = src.left(); - const GLfloat tx2 = src.right(); - const GLfloat ty1 = src.top(); - const GLfloat ty2 = src.bottom(); - - GLfloat texCoordArray[4*2] = { - tx1, ty2, tx2, ty2, tx2, ty1, tx1, ty1 - }; - - GLfloat vertexArray[4*2]; - vertexArray[0] = rect.left(); vertexArray[1] = rect.top(); - vertexArray[2] = rect.right(); vertexArray[3] = rect.top(); - vertexArray[4] = rect.right(); vertexArray[5] = rect.bottom(); - vertexArray[6] = rect.left(); vertexArray[7] = rect.bottom(); - - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexArray); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, texCoordArray); - - glBindTexture(target, tex_id); - - glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR); - glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR); - glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR); - - glBindTexture(target, 0); -} - -static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport, const QSize &texSize, const QRect &targetRect, const QRect &sourceRect) -{ - glDisable(GL_DEPTH_TEST); - glDisable(GL_SCISSOR_TEST); - glDisable(GL_BLEND); - glViewport(0, 0, viewport.width(), viewport.height()); - - QGLShaderProgram *blitProgram = - QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram(); - blitProgram->bind(); - blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/); - - // The shader manager's blit program does not multiply the - // vertices by the pmv matrix, so we need to do the effect - // of the orthographic projection here ourselves. - QRectF r; - qreal w = viewport.width(); - qreal h = viewport.height(); - r.setLeft((targetRect.left() / w) * 2.0f - 1.0f); - if (targetRect.right() == (viewport.width() - 1)) - r.setRight(1.0f); - else - r.setRight((targetRect.right() / w) * 2.0f - 1.0f); - r.setBottom((targetRect.top() / h) * 2.0f - 1.0f); - if (targetRect.bottom() == (viewport.height() - 1)) - r.setTop(1.0f); - else - r.setTop((targetRect.bottom() / w) * 2.0f - 1.0f); - - drawTexture(r, texture, texSize, sourceRect); -} - -QWaylandGLWindowSurface::QWaylandGLWindowSurface(QWidget *window) - : QWindowSurface(window) - , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display()) - , mPaintDevice(0) -{ - -} - -QWaylandGLWindowSurface::~QWaylandGLWindowSurface() -{ - delete mPaintDevice; -} - -QPaintDevice *QWaylandGLWindowSurface::paintDevice() -{ - return mPaintDevice; -} - -void QWaylandGLWindowSurface::beginPaint(const QRegion &) -{ - window()->platformWindow()->glContext()->makeCurrent(); - glClearColor(0,0,0,0xff); - glClear(GL_COLOR_BUFFER_BIT); -} - -void QWaylandGLWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(offset); - Q_UNUSED(region); - QWaylandWindow *ww = (QWaylandWindow *) widget->platformWindow(); - - if (mPaintDevice->isBound()) - mPaintDevice->release(); - - QRect rect(0,0,size().width(),size().height()); - QGLContext *ctx = QGLContext::fromPlatformGLContext(ww->glContext()); - blitTexture(ctx,mPaintDevice->texture(),size(),mPaintDevice->size(),rect,rect); - ww->glContext()->swapBuffers(); -} - -void QWaylandGLWindowSurface::resize(const QSize &size) -{ - QWindowSurface::resize(size); - window()->platformWindow()->glContext()->makeCurrent(); - delete mPaintDevice; - mPaintDevice = new QGLFramebufferObject(size,QGLFramebufferObject::CombinedDepthStencil); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp new file mode 100644 index 00000000000..5f7663ef553 --- /dev/null +++ b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandreadbackcglcontext.h" + +#include "qwaylandshmbackingstore.h" +#include "qwaylandreadbackcglwindow.h" + +#include +#include + +#include +#include +#include + +#include + +QWaylandReadbackCGLContext::QWaylandReadbackCGLContext(QPlatformOpenGLContext *share) + : QPlatformOpenGLContext() +{ + Q_UNUSED(share); + m_glContext = qcgl_createGlContext(); +} + +QSurfaceFormat QWaylandReadbackCGLContext::format() const +{ + return qcgl_surfaceFormat(); +} + +bool QWaylandReadbackCGLContext::makeCurrent(QPlatformSurface *surface) +{ + QWaylandReadbackCGLWindow *window = static_cast(surface); + CGLSetPBuffer(m_glContext, window->pixelBuffer(), 0, 0, 0); + CGLSetCurrentContext(m_glContext); + return true; +} + +void QWaylandReadbackCGLContext::doneCurrent() +{ + CGLSetCurrentContext(0); +} + +void QWaylandReadbackCGLContext::swapBuffers(QPlatformSurface *surface) +{ + Q_UNUSED(surface); + + if (QOpenGLContext::currentContext()->handle() != this) { + makeCurrent(surface); + } + CGLFlushDrawable(m_glContext); + + QWaylandReadbackCGLWindow *window = static_cast(surface); + QSize size = window->geometry().size(); + + uchar *dstBits = const_cast(window->buffer()); + glReadPixels(0,0, size.width(), size.height(), GL_BGRA,GL_UNSIGNED_BYTE, dstBits); + + window->damage(QRect(QPoint(0,0),size)); + + // ### Should sync here but this call deadlocks with the server. + //window->waitForFrameSync(); +} + +void (*QWaylandReadbackCGLContext::getProcAddress(const QByteArray &procName)) () +{ + return qcgl_getProcAddress(procName); +} + diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.h b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.h new file mode 100644 index 00000000000..eb065c3f691 --- /dev/null +++ b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDREADBACKCGLCONTEXT_H +#define QWAYLANDREADBACKCGLCONTEXT_H + +#include + +#include "qwaylandreadbackcglintegration.h" + +#include + +class QWaylandReadbackCGLWindow; +class QWaylandShmBuffer; + +class QWaylandReadbackCGLContext : public QPlatformOpenGLContext +{ +public: + QWaylandReadbackCGLContext(QPlatformOpenGLContext *share); + + QSurfaceFormat format() const; + + bool makeCurrent(QPlatformSurface *surface); + void doneCurrent(); + void swapBuffers(QPlatformSurface *surface); + void (*getProcAddress(const QByteArray &procName)) (); + + void geometryChanged(); + +private: + CGLContextObj m_glContext; +}; + +#endif // QWAYLANDREADBACKCGLCONTEXT_H diff --git a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.cpp similarity index 61% rename from src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp rename to src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.cpp index e5ac994a053..2878f9e2927 100644 --- a/src/plugins/gfxdrivers/eglnullws/eglnullwswindowsurface.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.cpp @@ -39,46 +39,44 @@ ** ****************************************************************************/ -#include "eglnullwswindowsurface.h" -#include "eglnullwsscreenplugin.h" +#include "qwaylandreadbackcglintegration.h" +#include "qwaylandreadbackcglcontext.h" +#include "qwaylandreadbackcglwindow.h" -#include +#include -static const QWSWindowSurface::SurfaceFlags Flags - = QWSWindowSurface::RegionReserved | QWSWindowSurface::RegionReserved; - -EGLNullWSWindowSurface::EGLNullWSWindowSurface(QWidget *w) - : - QWSGLWindowSurface(w), - widget(w) +QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) { - setSurfaceFlags(Flags); + return new QWaylandReadbackCGLIntegration(waylandDisplay); } -EGLNullWSWindowSurface::EGLNullWSWindowSurface() - : widget(0) +QWaylandReadbackCGLIntegration::QWaylandReadbackCGLIntegration(QWaylandDisplay * waylandDispaly) + : QWaylandGLIntegration() + , mWaylandDisplay(waylandDispaly) { - setSurfaceFlags(Flags); + qDebug() << "Using Readback-CGL"; } -EGLNullWSWindowSurface::~EGLNullWSWindowSurface() {} - -QString EGLNullWSWindowSurface::key() const +QWaylandReadbackCGLIntegration::~QWaylandReadbackCGLIntegration() { - return QLatin1String(PluginName); + } -QPaintDevice *EGLNullWSWindowSurface::paintDevice() +void QWaylandReadbackCGLIntegration::initialize() { - return widget; } -bool EGLNullWSWindowSurface::isValid() const +QWaylandWindow * QWaylandReadbackCGLIntegration::createEglWindow(QWindow *window) { - return qobject_cast(window()); + return new QWaylandReadbackCGLWindow(window,this); } -QImage EGLNullWSWindowSurface::image() const +QPlatformOpenGLContext *QWaylandReadbackCGLIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const { - return QImage(); + return new QWaylandReadbackCGLContext(share); +} + +QWaylandDisplay * QWaylandReadbackCGLIntegration::waylandDisplay() const +{ + return mWaylandDisplay; } diff --git a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.h similarity index 69% rename from src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h rename to src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.h index 6f8f8dce668..34c8d00a7c7 100644 --- a/src/plugins/graphicssystems/openvg/qgraphicssystem_vg_p.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.h @@ -39,35 +39,33 @@ ** ****************************************************************************/ -#ifndef QGRAPHICSSYSTEM_VG_P_H -#define QGRAPHICSSYSTEM_VG_P_H +#ifndef QWAYLANDREADBACKGLXINTEGRATION_H +#define QWAYLANDREADBACKGLXINTEGRATION_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 "gl_integration/qwaylandglintegration.h" -#include +#include +#include +#include +#include +#include -QT_BEGIN_NAMESPACE +#include -class QVGGraphicsSystem : public QGraphicsSystem +class QWaylandReadbackCGLIntegration : public QWaylandGLIntegration { public: - QVGGraphicsSystem(); + QWaylandReadbackCGLIntegration(QWaylandDisplay * waylandDispaly); + ~QWaylandReadbackCGLIntegration(); - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; + void initialize(); - void releaseCachedResources(); + QWaylandWindow *createEglWindow(QWindow *window); + QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; + QWaylandDisplay *waylandDisplay() const; + +private: + QWaylandDisplay *mWaylandDisplay; }; -QT_END_NAMESPACE - -#endif +#endif // QWAYLANDREADBACKGLXINTEGRATION_H diff --git a/src/plugins/graphicssystems/opengl/main.cpp b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.cpp similarity index 54% rename from src/plugins/graphicssystems/opengl/main.cpp rename to src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.cpp index ee0fa802dda..9e7f8520c90 100644 --- a/src/plugins/graphicssystems/opengl/main.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.cpp @@ -39,57 +39,68 @@ ** ****************************************************************************/ -#include -#include -#include +#include "qwaylandreadbackcglwindow.h" +#include "qwaylandshmbackingstore.h" -QT_BEGIN_NAMESPACE +#include +#include -class QGLGraphicsSystemPlugin : public QGraphicsSystemPlugin +QWaylandReadbackCGLWindow::QWaylandReadbackCGLWindow(QWindow *window, QWaylandReadbackCGLIntegration *cglIntegration) + : QWaylandShmWindow(window) + , m_CglIntegration(cglIntegration) + , mContext(0) + , m_buffer(0) + , m_pixelBuffer(0) { -public: - QStringList keys() const; - QGraphicsSystem *create(const QString&); -}; - -QStringList QGLGraphicsSystemPlugin::keys() const -{ - QStringList list; - list << QLatin1String("OpenGL") << QLatin1String("OpenGL1"); -#if !defined(QT_OPENGL_ES_1) - list << QLatin1String("OpenGL2"); -#endif -#if defined(Q_WS_X11) && !defined(QT_NO_EGL) - list << QLatin1String("X11GL"); -#endif - return list; } -QGraphicsSystem* QGLGraphicsSystemPlugin::create(const QString& system) +QWaylandWindow::WindowType QWaylandReadbackCGLWindow::windowType() const { - if (system.toLower() == QLatin1String("opengl1")) { - QGL::setPreferredPaintEngine(QPaintEngine::OpenGL); - return new QGLGraphicsSystem(false); - } - -#if !defined(QT_OPENGL_ES_1) - if (system.toLower() == QLatin1String("opengl2")) { - QGL::setPreferredPaintEngine(QPaintEngine::OpenGL2); - return new QGLGraphicsSystem(false); - } -#endif - -#if defined(Q_WS_X11) && !defined(QT_NO_EGL) - if (system.toLower() == QLatin1String("x11gl")) - return new QGLGraphicsSystem(true); -#endif - - if (system.toLower() == QLatin1String("opengl")) - return new QGLGraphicsSystem(false); - - return 0; + //yeah. this type needs a new name + return QWaylandWindow::Egl; } -Q_EXPORT_PLUGIN2(opengl, QGLGraphicsSystemPlugin) -QT_END_NAMESPACE +void QWaylandReadbackCGLWindow::setGeometry(const QRect &rect) +{ + QWaylandShmWindow::setGeometry(rect); + + if (m_buffer) { + delete m_buffer; + m_buffer = 0; + + CGLDestroyPBuffer(m_pixelBuffer); + m_pixelBuffer = 0; + } +} + +CGLPBufferObj QWaylandReadbackCGLWindow::pixelBuffer() +{ + if (!m_pixelBuffer) + createSurface(); + + return m_pixelBuffer; +} + +uchar *QWaylandReadbackCGLWindow::buffer() +{ + return m_buffer->image()->bits(); +} + +void QWaylandReadbackCGLWindow::createSurface() +{ + QSize size(geometry().size()); + if (size.isEmpty()) { + //QGLWidget wants a context for a window without geometry + size = QSize(1,1); + } + + waitForFrameSync(); + + CGLCreatePBuffer(size.width(), size.height(), GL_TEXTURE_RECTANGLE_ARB, GL_BGRA, 0, &m_pixelBuffer); + + delete m_buffer; + m_buffer = new QWaylandShmBuffer(m_CglIntegration->waylandDisplay(),size,QImage::Format_ARGB32); + attach(m_buffer); +} + diff --git a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.h b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.h similarity index 70% rename from src/plugins/graphicssystems/shivavg/shivavgwindowsurface.h rename to src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.h index a9de7f5239e..0598cf90375 100644 --- a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.h @@ -39,38 +39,32 @@ ** ****************************************************************************/ -#ifndef SHIVAVGWINDOWSURFACE_H -#define SHIVAVGWINDOWSURFACE_H +#ifndef QWAYLANDREADBACKGLXWINDOW_H +#define QWAYLANDREADBACKGLXWINDOW_H -#include +#include "qwaylandshmwindow.h" +#include "qwaylandreadbackcglintegration.h" +#include "qwaylandreadbackcglcontext.h" -QT_BEGIN_NAMESPACE +#include -class ShivaVGWindowSurfacePrivate; - -class ShivaVGWindowSurface : public QWindowSurface, public QPaintDevice +class QWaylandReadbackCGLWindow : public QWaylandShmWindow { public: - ShivaVGWindowSurface(QWidget *window); - virtual ~ShivaVGWindowSurface(); + QWaylandReadbackCGLWindow(QWindow *window, QWaylandReadbackCGLIntegration *cglIntegration); + WindowType windowType() const; - 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; - + CGLPBufferObj pixelBuffer(); + uchar *buffer(); private: - ShivaVGWindowSurfacePrivate *d_ptr; + void createSurface(); + + QWaylandReadbackCGLIntegration *m_CglIntegration; + QWaylandReadbackCGLContext *mContext; + + QWaylandShmBuffer *m_buffer; + CGLPBufferObj m_pixelBuffer; }; -QT_END_NAMESPACE - -#endif +#endif // QWAYLANDREADBACKGLXWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/readback_cgl.pri b/src/plugins/platforms/wayland/gl_integration/readback_cgl/readback_cgl.pri new file mode 100644 index 00000000000..91cb90a30cd --- /dev/null +++ b/src/plugins/platforms/wayland/gl_integration/readback_cgl/readback_cgl.pri @@ -0,0 +1,10 @@ +HEADERS += \ + $$PWD/qwaylandreadbackcglintegration.h \ + $$PWD/qwaylandreadbackcglwindow.h \ + $$PWD/qwaylandreadbackcglcontext.h + +SOURCES += \ + $$PWD/qwaylandreadbackcglintegration.cpp \ + $$PWD/qwaylandreadbackcglwindow.cpp \ + $$PWD/qwaylandreadbackcglcontext.cpp + diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp index f02a10a05bf..c03e8a94441 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.cpp @@ -41,14 +41,16 @@ #include "qwaylandreadbackeglcontext.h" -#include "../../../eglconvenience/qeglconvenience.h" +#include + +#include +#include #include #include #include "qwaylandshmsurface.h" -#include static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type) { @@ -77,7 +79,7 @@ QWaylandReadbackEglContext::QWaylandReadbackEglContext(QWaylandReadbackEglIntegr , mWindow(window) , mBuffer(0) , mPixmap(0) - , mConfig(q_configFromQPlatformWindowFormat(eglIntegration->eglDisplay(),window->widget()->platformWindowFormat(),true,EGL_PIXMAP_BIT)) + , mConfig(q_configFromQWindowFormat(eglIntegration->eglDisplay(),window->window()->requestedWindowFormat(),true,EGL_PIXMAP_BIT)) , mPixmapSurface(EGL_NO_SURFACE) { QVector eglContextAttrs; @@ -97,8 +99,6 @@ QWaylandReadbackEglContext::~QWaylandReadbackEglContext() void QWaylandReadbackEglContext::makeCurrent() { - QPlatformGLContext::makeCurrent(); - mWindow->waitForFrameSync(); eglMakeCurrent(mEglIntegration->eglDisplay(),mPixmapSurface,mPixmapSurface,mContext); @@ -106,7 +106,7 @@ void QWaylandReadbackEglContext::makeCurrent() void QWaylandReadbackEglContext::doneCurrent() { - QPlatformGLContext::doneCurrent(); + QPlatformOpenGLContext::doneCurrent(); eglMakeCurrent(mEglIntegration->eglDisplay(),EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT); } @@ -114,7 +114,7 @@ void QWaylandReadbackEglContext::swapBuffers() { eglSwapBuffers(mEglIntegration->eglDisplay(),mPixmapSurface); - if (QPlatformGLContext::currentContext() != this) { + if (QWindowContext::currentContext()->handle() != this) { makeCurrent(); } @@ -143,9 +143,9 @@ void * QWaylandReadbackEglContext::getProcAddress(const QString &procName) return (void *) eglGetProcAddress(procName.toLatin1().data()); } -QPlatformWindowFormat QWaylandReadbackEglContext::platformWindowFormat() const +QWindowFormat QWaylandReadbackEglContext::windowFormat() const { - return qt_qPlatformWindowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig); + return q_windowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig); } void QWaylandReadbackEglContext::geometryChanged() diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h index f9ab3783dde..75755fbd1a8 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglcontext.h @@ -42,15 +42,14 @@ #ifndef QWAYLANDREADBACKEGLGLCONTEXT_H #define QWAYLANDREADBACKEGLGLCONTEXT_H -#include -#include +#include #include "qwaylandreadbackeglintegration.h" #include "qwaylandreadbackeglwindow.h" class QWaylandShmBuffer; -class QWaylandReadbackEglContext : public QPlatformGLContext +class QWaylandReadbackEglContext : public QPlatformOpenGLContext { public: QWaylandReadbackEglContext(QWaylandReadbackEglIntegration *eglIntegration, QWaylandReadbackEglWindow *window); @@ -61,7 +60,7 @@ public: void swapBuffers(); void* getProcAddress(const QString& procName); - virtual QPlatformWindowFormat platformWindowFormat() const; + virtual QWindowFormat windowFormat() const; void geometryChanged(); diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp index 6bbac603cf1..39fa3d589ca 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.cpp @@ -81,9 +81,14 @@ void QWaylandReadbackEglIntegration::initialize() } } -QWaylandWindow * QWaylandReadbackEglIntegration::createEglWindow(QWidget *widget) +QWaylandWindow * QWaylandReadbackEglIntegration::createEglWindow(QWindow *window) { - return new QWaylandReadbackEglWindow(widget,this); + return new QWaylandReadbackEglWindow(window, this); +} + +QPlatformOpenGLContext *QWaylandReadbackEglWindow::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const +{ + return new QWaylandReadbackEglContext(glFormat, share, this); } EGLDisplay QWaylandReadbackEglIntegration::eglDisplay() diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h index ae1e8e5095c..0d6aa55e4ef 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglintegration.h @@ -48,7 +48,8 @@ #include #include #include -#include +#include +#include #include @@ -61,7 +62,8 @@ public: ~QWaylandReadbackEglIntegration(); void initialize(); - QWaylandWindow *createEglWindow(QWidget *widget); + QWaylandWindow *createEglWindow(QWindow *window); + QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; QWaylandDisplay *waylandDisplay() const; Display *xDisplay() const; diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp index 868e32e030f..f4bc6379d69 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.cpp @@ -43,7 +43,7 @@ #include "qwaylandreadbackeglcontext.h" -QWaylandReadbackEglWindow::QWaylandReadbackEglWindow(QWidget *window, QWaylandReadbackEglIntegration *eglIntegration) +QWaylandReadbackEglWindow::QWaylandReadbackEglWindow(QWindow *window, QWaylandReadbackEglIntegration *eglIntegration) : QWaylandShmWindow(window) , mEglIntegration(eglIntegration) , mContext(0) @@ -57,7 +57,7 @@ QWaylandWindow::WindowType QWaylandReadbackEglWindow::windowType() const return QWaylandWindow::Egl; } -QPlatformGLContext *QWaylandReadbackEglWindow::glContext() const +QPlatformOpenGLContext *QWaylandReadbackEglWindow::glContext() const { if (!mContext) { QWaylandReadbackEglWindow *that = const_cast(this); diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h index 14334839232..0852a8ee66f 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/qwaylandreadbackeglwindow.h @@ -50,11 +50,11 @@ class QWaylandReadbackEglContext; class QWaylandReadbackEglWindow : public QWaylandShmWindow { public: - QWaylandReadbackEglWindow(QWidget *window, QWaylandReadbackEglIntegration *eglIntegration); + QWaylandReadbackEglWindow(QWindow *window, QWaylandReadbackEglIntegration *eglIntegration); WindowType windowType() const; - QPlatformGLContext *glContext() const; + QPlatformOpenGLContext *glContext() const; void setGeometry(const QRect &rect); diff --git a/src/plugins/platforms/wayland/gl_integration/readback_egl/readback_egl.pri b/src/plugins/platforms/wayland/gl_integration/readback_egl/readback_egl.pri index 0d8e01b6bba..3325fe8ec9d 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_egl/readback_egl.pri +++ b/src/plugins/platforms/wayland/gl_integration/readback_egl/readback_egl.pri @@ -1,14 +1,12 @@ - LIBS += -lX11 -lXext -lEGL +load(qpa/egl/convenience) HEADERS += \ $$PWD/qwaylandreadbackeglintegration.h \ $$PWD/qwaylandreadbackeglcontext.h \ $$PWD/qwaylandreadbackeglwindow.h \ - $$PWD/../../../eglconvenience/qeglconvenience.h SOURCES += \ $$PWD/qwaylandreadbackeglintegration.cpp \ $$PWD/qwaylandreadbackeglwindow.cpp \ $$PWD/qwaylandreadbackeglcontext.cpp \ - $$PWD/../../../eglconvenience/qeglconvenience.cpp diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp index 857c1db6e37..850e7bb0ac7 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.cpp @@ -41,9 +41,10 @@ #include "qwaylandreadbackglxcontext.h" -#include "qwaylandshmsurface.h" +#include "qwaylandshmbackingstore.h" #include "qwaylandreadbackglxwindow.h" +#include #include static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type) @@ -68,96 +69,66 @@ static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type) } } -QWaylandReadbackGlxContext::QWaylandReadbackGlxContext(QWaylandReadbackGlxIntegration *glxIntegration, QWaylandReadbackGlxWindow *window) - : QPlatformGLContext() - , mGlxIntegration(glxIntegration) - , mWindow(window) - , mBuffer(0) - , mPixmap(0) - , mConfig(qglx_findConfig(glxIntegration->xDisplay(),glxIntegration->screen(),window->widget()->platformWindowFormat(),GLX_PIXMAP_BIT)) - , mGlxPixmap(0) +QWaylandReadbackGlxContext::QWaylandReadbackGlxContext(const QSurfaceFormat &format, + QPlatformOpenGLContext *share, Display *display, int screen) + : m_display(display) { - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(glxIntegration->xDisplay(),mConfig); - mContext = glXCreateContext(glxIntegration->xDisplay(),visualInfo,0,TRUE); + GLXFBConfig config = qglx_findConfig(display, screen, format, GLX_PIXMAP_BIT); - geometryChanged(); + GLXContext shareContext = share ? static_cast(share)->m_context : 0; + + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display, config); + m_context = glXCreateContext(display, visualInfo, shareContext, TRUE); + m_format = qglx_surfaceFormatFromGLXFBConfig(display, config, m_context); } -void QWaylandReadbackGlxContext::makeCurrent() +QSurfaceFormat QWaylandReadbackGlxContext::format() const { - QPlatformGLContext::makeCurrent(); + return m_format; +} - glXMakeCurrent(mGlxIntegration->xDisplay(),mGlxPixmap,mContext); +bool QWaylandReadbackGlxContext::makeCurrent(QPlatformSurface *surface) +{ + GLXPixmap glxPixmap = static_cast(surface)->glxPixmap(); + + return glXMakeCurrent(m_display, glxPixmap, m_context); } void QWaylandReadbackGlxContext::doneCurrent() { - QPlatformGLContext::doneCurrent(); + glXMakeCurrent(m_display, 0, 0); } -void QWaylandReadbackGlxContext::swapBuffers() +void QWaylandReadbackGlxContext::swapBuffers(QPlatformSurface *surface) { - if (QPlatformGLContext::currentContext() != this) { - makeCurrent(); - } + // #### makeCurrent() directly on the platform context doesn't update QOpenGLContext::currentContext() + if (QOpenGLContext::currentContext()->handle() != this) + makeCurrent(surface); - QSize size = mWindow->geometry().size(); + QWaylandReadbackGlxWindow *w = static_cast(surface); - QImage img(size,QImage::Format_ARGB32); + QSize size = w->geometry().size(); + + QImage img(size, QImage::Format_ARGB32); const uchar *constBits = img.bits(); void *pixels = const_cast(constBits); - glReadPixels(0,0, size.width(), size.height(), GL_RGBA,GL_UNSIGNED_BYTE, pixels); + glReadPixels(0, 0, size.width(), size.height(), GL_RGBA,GL_UNSIGNED_BYTE, pixels); img = img.mirrored(); - qgl_byteSwapImage(img,GL_UNSIGNED_INT_8_8_8_8_REV); + qgl_byteSwapImage(img, GL_UNSIGNED_INT_8_8_8_8_REV); constBits = img.bits(); - const uchar *constDstBits = mBuffer->image()->bits(); + const uchar *constDstBits = w->buffer(); uchar *dstBits = const_cast(constDstBits); - memcpy(dstBits,constBits,(img.width()*4) * img.height()); + memcpy(dstBits, constBits, (img.width() * 4) * img.height()); + w->damage(QRect(QPoint(), size)); - mWindow->damage(QRegion(QRect(QPoint(0,0),size))); - mWindow->waitForFrameSync(); - + w->waitForFrameSync(); } -void * QWaylandReadbackGlxContext::getProcAddress(const QString &procName) +void (*QWaylandReadbackGlxContext::getProcAddress(const QByteArray &procName)) () { - return (void *) glXGetProcAddress(reinterpret_cast(procName.toLatin1().data())); -} - -QPlatformWindowFormat QWaylandReadbackGlxContext::platformWindowFormat() const -{ - return qglx_platformWindowFromGLXFBConfig(mGlxIntegration->xDisplay(),mConfig,mContext); -} - -void QWaylandReadbackGlxContext::geometryChanged() -{ - QSize size(mWindow->geometry().size()); - if (size.isEmpty()) { - //QGLWidget wants a context for a window without geometry - size = QSize(1,1); - } - - mWindow->waitForFrameSync(); - - delete mBuffer; - //XFreePixmap deletes the glxPixmap as well - if (mPixmap) { - XFreePixmap(mGlxIntegration->xDisplay(),mPixmap); - } - - mBuffer = new QWaylandShmBuffer(mGlxIntegration->waylandDisplay(),size,QImage::Format_ARGB32); - mWindow->attach(mBuffer); - int depth = XDefaultDepth(mGlxIntegration->xDisplay(),mGlxIntegration->screen()); - mPixmap = XCreatePixmap(mGlxIntegration->xDisplay(),mGlxIntegration->rootWindow(),size.width(),size.height(),depth); - XSync(mGlxIntegration->xDisplay(),False); - - mGlxPixmap = glXCreatePixmap(mGlxIntegration->xDisplay(),mConfig,mPixmap,0); - - if (!mGlxPixmap) { - qDebug() << "Could not make egl surface out of pixmap :("; - } + return glXGetProcAddress(reinterpret_cast(procName.constData())); } diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h index 07e0f620dec..7b5eeece93c 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxcontext.h @@ -42,38 +42,35 @@ #ifndef QWAYLANDREADBACKGLXCONTEXT_H #define QWAYLANDREADBACKGLXCONTEXT_H -#include +#include +#include #include "qwaylandreadbackglxintegration.h" -#include "qglxconvenience.h" +#include class QWaylandReadbackGlxWindow; class QWaylandShmBuffer; -class QWaylandReadbackGlxContext : public QPlatformGLContext +class QWaylandReadbackGlxContext : public QPlatformOpenGLContext { public: - QWaylandReadbackGlxContext(QWaylandReadbackGlxIntegration *glxIntegration, QWaylandReadbackGlxWindow *window); + QWaylandReadbackGlxContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen); - void makeCurrent(); + QSurfaceFormat format() const; + + void swapBuffers(QPlatformSurface *surface); + + bool makeCurrent(QPlatformSurface *surface); void doneCurrent(); - void swapBuffers(); - void* getProcAddress(const QString& procName); - QPlatformWindowFormat platformWindowFormat() const; - - void geometryChanged(); + void (*getProcAddress(const QByteArray &procName)) (); private: - QWaylandReadbackGlxIntegration *mGlxIntegration; - QWaylandReadbackGlxWindow *mWindow; - QWaylandShmBuffer *mBuffer; + GLXContext m_context; - Pixmap mPixmap; - GLXFBConfig mConfig; - GLXContext mContext; - GLXPixmap mGlxPixmap; + Display *m_display; + QSurfaceFormat m_format; }; #endif // QWAYLANDREADBACKGLXCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp index 37a14a9f4c9..752bb06a437 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.cpp @@ -66,9 +66,14 @@ void QWaylandReadbackGlxIntegration::initialize() { } -QWaylandWindow * QWaylandReadbackGlxIntegration::createEglWindow(QWidget *widget) +QWaylandWindow * QWaylandReadbackGlxIntegration::createEglWindow(QWindow *window) { - return new QWaylandReadbackGlxWindow(widget,this); + return new QWaylandReadbackGlxWindow(window,this); +} + +QPlatformOpenGLContext *QWaylandReadbackGlxIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const +{ + return new QWaylandReadbackGlxContext(glFormat, share, mDisplay, mScreen); } QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h index d267d8dffe8..ee50d74ebd8 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxintegration.h @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include @@ -60,7 +60,8 @@ public: void initialize(); - QWaylandWindow *createEglWindow(QWidget *widget); + QWaylandWindow *createEglWindow(QWindow *window); + QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; QWaylandDisplay *waylandDisplay() const; diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp index 98198dfa062..35c3ca31540 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.cpp @@ -39,12 +39,19 @@ ** ****************************************************************************/ -#include "qwaylandreadbackglxwindow.h" +#include -QWaylandReadbackGlxWindow::QWaylandReadbackGlxWindow(QWidget *window, QWaylandReadbackGlxIntegration *glxIntegration) +#include "qwaylandreadbackglxwindow.h" +#include "qwaylandshmbackingstore.h" + +QWaylandReadbackGlxWindow::QWaylandReadbackGlxWindow(QWindow *window, QWaylandReadbackGlxIntegration *glxIntegration) : QWaylandShmWindow(window) - , mGlxIntegration(glxIntegration) - , mContext(0) + , m_glxIntegration(glxIntegration) + , m_buffer(0) + , m_pixmap(0) + , m_config(0) + , m_glxPixmap(0) + , m_window(window) { } @@ -54,20 +61,54 @@ QWaylandWindow::WindowType QWaylandReadbackGlxWindow::windowType() const return QWaylandWindow::Egl; } -QPlatformGLContext * QWaylandReadbackGlxWindow::glContext() const -{ - if (!mContext) { - QWaylandReadbackGlxWindow *that = const_cast(this); - that->mContext = new QWaylandReadbackGlxContext(mGlxIntegration,that); - } - return mContext; -} - void QWaylandReadbackGlxWindow::setGeometry(const QRect &rect) { QWaylandShmWindow::setGeometry(rect); - if (mContext) { - mContext->geometryChanged(); + if (m_pixmap) { + delete mBuffer; + //XFreePixmap deletes the glxPixmap as well + XFreePixmap(m_glxIntegration->xDisplay(), m_pixmap); + m_pixmap = 0; } } + +GLXPixmap QWaylandReadbackGlxWindow::glxPixmap() const +{ + if (!m_pixmap) + const_cast(this)->createSurface(); + + return m_glxPixmap; +} + +uchar *QWaylandReadbackGlxWindow::buffer() +{ + return m_buffer->image()->bits(); +} + +void QWaylandReadbackGlxWindow::createSurface() +{ + QSize size(geometry().size()); + if (size.isEmpty()) { + //QGLWidget wants a context for a window without geometry + size = QSize(1,1); + } + + waitForFrameSync(); + + m_buffer = new QWaylandShmBuffer(m_glxIntegration->waylandDisplay(), size, QImage::Format_ARGB32); + attach(m_buffer); + + int depth = XDefaultDepth(m_glxIntegration->xDisplay(), m_glxIntegration->screen()); + m_pixmap = XCreatePixmap(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(), size.width(), size.height(), depth); + XSync(m_glxIntegration->xDisplay(), False); + + if (!m_config) + m_config = qglx_findConfig(m_glxIntegration->xDisplay(), m_glxIntegration->screen(), m_window->format()); + + m_glxPixmap = glXCreatePixmap(m_glxIntegration->xDisplay(), m_config, m_pixmap,0); + + if (!m_glxPixmap) + qDebug() << "Could not make glx surface out of pixmap :("; +} + diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h index d478961d537..c92646c80d4 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/qwaylandreadbackglxwindow.h @@ -49,17 +49,25 @@ class QWaylandReadbackGlxWindow : public QWaylandShmWindow { public: - QWaylandReadbackGlxWindow(QWidget *window, QWaylandReadbackGlxIntegration *glxIntegration); + QWaylandReadbackGlxWindow(QWindow *window, QWaylandReadbackGlxIntegration *glxIntegration); WindowType windowType() const; - QPlatformGLContext *glContext() const; - void setGeometry(const QRect &rect); -private: - QWaylandReadbackGlxIntegration *mGlxIntegration; - QWaylandReadbackGlxContext *mContext; + Pixmap glxPixmap() const; + uchar *buffer(); + +private: + void createSurface(); + + QWaylandReadbackGlxIntegration *m_glxIntegration; + QWaylandShmBuffer *m_buffer; + + Pixmap m_pixmap; + GLXFBConfig m_config; + GLXPixmap m_glxPixmap; + QWindow *m_window; }; #endif // QWAYLANDREADBACKGLXWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_glx/readback_glx.pri b/src/plugins/platforms/wayland/gl_integration/readback_glx/readback_glx.pri index f8ea0059376..746d594fa2e 100644 --- a/src/plugins/platforms/wayland/gl_integration/readback_glx/readback_glx.pri +++ b/src/plugins/platforms/wayland/gl_integration/readback_glx/readback_glx.pri @@ -1,4 +1,3 @@ -include (../../../glxconvenience/glxconvenience.pri) HEADERS += \ $$PWD/qwaylandreadbackglxintegration.h \ $$PWD/qwaylandreadbackglxwindow.h \ diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp index d4deb010225..27f17a61531 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.cpp @@ -44,11 +44,12 @@ #include "gl_integration/qwaylandglintegration.h" #include "qwaylandeglwindow.h" +#include "qwaylandglcontext.h" #include QWaylandEglIntegration::QWaylandEglIntegration(struct wl_display *waylandDisplay) - : mWaylandDisplay(waylandDisplay) + : m_waylandDisplay(waylandDisplay) { qDebug() << "Using Wayland-EGL"; } @@ -56,31 +57,41 @@ QWaylandEglIntegration::QWaylandEglIntegration(struct wl_display *waylandDisplay QWaylandEglIntegration::~QWaylandEglIntegration() { - eglTerminate(mEglDisplay); + eglTerminate(m_eglDisplay); } void QWaylandEglIntegration::initialize() { + QByteArray eglPlatform = qgetenv("EGL_PLATFORM"); + if (eglPlatform.isEmpty()) { + setenv("EGL_PLATFORM","wayland",true); + } + EGLint major,minor; - mEglDisplay = eglGetDisplay(mWaylandDisplay); - if (mEglDisplay == NULL) { + m_eglDisplay = eglGetDisplay(m_waylandDisplay); + if (m_eglDisplay == NULL) { qWarning("EGL not available"); } else { - if (!eglInitialize(mEglDisplay, &major, &minor)) { + if (!eglInitialize(m_eglDisplay, &major, &minor)) { qWarning("failed to initialize EGL display"); return; } } } -QWaylandWindow *QWaylandEglIntegration::createEglWindow(QWidget *window) +QWaylandWindow *QWaylandEglIntegration::createEglWindow(QWindow *window) { return new QWaylandEglWindow(window); } +QPlatformOpenGLContext *QWaylandEglIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const +{ + return new QWaylandGLContext(m_eglDisplay, glFormat, share); +} + EGLDisplay QWaylandEglIntegration::eglDisplay() const { - return mEglDisplay; + return m_eglDisplay; } QWaylandGLIntegration *QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h index ea8b0f725c2..7a26c576588 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglintegration.h @@ -47,7 +47,7 @@ #include "qwaylandeglinclude.h" class QWaylandWindow; -class QWidget; +class QWindow; class QWaylandEglIntegration : public QWaylandGLIntegration { @@ -57,14 +57,15 @@ public: void initialize(); - QWaylandWindow *createEglWindow(QWidget *window); + QWaylandWindow *createEglWindow(QWindow *window); + QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; EGLDisplay eglDisplay() const; - struct wl_egl_display *nativeDisplay() const; -private: - struct wl_display *mWaylandDisplay; - EGLDisplay mEglDisplay; +private: + struct wl_display *m_waylandDisplay; + + EGLDisplay m_eglDisplay; }; #endif // QWAYLANDEGLINTEGRATION_H diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp index cd8b5b35246..e0e1f772b97 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.cpp @@ -44,19 +44,30 @@ #include "qwaylandscreen.h" #include "qwaylandglcontext.h" -QWaylandEglWindow::QWaylandEglWindow(QWidget *window) +#include + +#include +#include + +QWaylandEglWindow::QWaylandEglWindow(QWindow *window) : QWaylandWindow(window) - , mGLContext(0) - , mWaylandEglWindow(0) + , m_waylandEglWindow(0) + , m_eglSurface(0) + , m_eglConfig(0) + , m_format(window->format()) { - mEglIntegration = static_cast(mDisplay->eglIntegration()); + m_eglIntegration = static_cast(mDisplay->eglIntegration()); + //super creates a new surface newSurfaceCreated(); } QWaylandEglWindow::~QWaylandEglWindow() { - delete mGLContext; + if (m_eglSurface) { + eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurface); + m_eglSurface = 0; + } } QWaylandWindow::WindowType QWaylandEglWindow::windowType() const @@ -67,46 +78,48 @@ QWaylandWindow::WindowType QWaylandEglWindow::windowType() const void QWaylandEglWindow::setGeometry(const QRect &rect) { QWaylandWindow::setGeometry(rect); - if (mWaylandEglWindow) { - wl_egl_window_resize(mWaylandEglWindow,rect.width(),rect.height(),0,0); + if (m_waylandEglWindow){ + wl_egl_window_resize(m_waylandEglWindow, rect.width(), rect.height(), 0, 0); + QWindowSystemInterface::handleGeometryChange(window(), rect); } } -void QWaylandEglWindow::setParent(const QPlatformWindow *parent) -{ - const QWaylandWindow *wParent = static_cast(parent); - - mParentWindow = wParent; -} - -QPlatformGLContext * QWaylandEglWindow::glContext() const -{ - if (!mGLContext) { - QWaylandEglWindow *that = const_cast(this); - that->mGLContext = new QWaylandGLContext(mEglIntegration->eglDisplay(),widget()->platformWindowFormat()); - - EGLNativeWindowType window(reinterpret_cast(mWaylandEglWindow)); - EGLSurface surface = eglCreateWindowSurface(mEglIntegration->eglDisplay(),mGLContext->eglConfig(),window,NULL); - that->mGLContext->setEglSurface(surface); - } - - return mGLContext; -} - void QWaylandEglWindow::newSurfaceCreated() { - if (mWaylandEglWindow) { - wl_egl_window_destroy(mWaylandEglWindow); - } - wl_visual *visual = QWaylandScreen::waylandScreenFromWidget(widget())->visual(); + if (m_waylandEglWindow) + wl_egl_window_destroy(m_waylandEglWindow); + + wl_visual *visual = QWaylandScreen::waylandScreenFromWindow(window())->visual(); QSize size = geometry().size(); if (!size.isValid()) size = QSize(0,0); - mWaylandEglWindow = wl_egl_window_create(mSurface,size.width(),size.height(),visual); - if (mGLContext) { - EGLNativeWindowType window(reinterpret_cast(mWaylandEglWindow)); - EGLSurface surface = eglCreateWindowSurface(mEglIntegration->eglDisplay(),mGLContext->eglConfig(),window,NULL); - mGLContext->setEglSurface(surface); + if (m_eglSurface) { + eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurface); + m_eglSurface = 0; } + + m_waylandEglWindow = wl_egl_window_create(mSurface, size.width(), size.height(), visual); } + +QSurfaceFormat QWaylandEglWindow::format() const +{ + return m_format; +} + +EGLSurface QWaylandEglWindow::eglSurface() const +{ + if (!m_waylandEglWindow) + return 0; + + if (!m_eglSurface) { + if (!m_eglConfig) + m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), window()->format(), true); + + EGLNativeWindowType window = m_waylandEglWindow; + m_eglSurface = eglCreateWindowSurface(m_eglIntegration->eglDisplay(), m_eglConfig, window, 0); + } + + return m_eglSurface; +} + diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h index 6d2038824af..d435a511c4d 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandeglwindow.h @@ -51,20 +51,28 @@ class QWaylandGLContext; class QWaylandEglWindow : public QWaylandWindow { public: - QWaylandEglWindow(QWidget *window); + QWaylandEglWindow(QWindow *window); ~QWaylandEglWindow(); WindowType windowType() const; void setGeometry(const QRect &rect); - void setParent(const QPlatformWindow *parent); - QPlatformGLContext *glContext() const; + + EGLSurface eglSurface() const; + + QSurfaceFormat format() const; + protected: void newSurfaceCreated(); -private: - QWaylandEglIntegration *mEglIntegration; - QWaylandGLContext *mGLContext; - struct wl_egl_window *mWaylandEglWindow; - const QWaylandWindow *mParentWindow; +private: + QWaylandEglIntegration *m_eglIntegration; + struct wl_egl_window *m_waylandEglWindow; + + const QWaylandWindow *m_parentWindow; + + mutable EGLSurface m_eglSurface; + mutable EGLConfig m_eglConfig; + + QSurfaceFormat m_format; }; #endif // QWAYLANDEGLWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp index 0f27501c71b..aa61405eb60 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp @@ -43,26 +43,21 @@ #include "qwaylanddisplay.h" #include "qwaylandwindow.h" +#include "qwaylandeglwindow.h" -#include "../../../eglconvenience/qeglconvenience.h" +#include -#include -#include +#include +#include #include -QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QPlatformWindowFormat &format) - : QPlatformGLContext() - , mEglDisplay(eglDisplay) - , mSurface(EGL_NO_SURFACE) - , mConfig(q_configFromQPlatformWindowFormat(mEglDisplay,format,true)) - , mFormat(qt_qPlatformWindowFormatFromConfig(mEglDisplay,mConfig)) +QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share) + : QPlatformOpenGLContext() + , m_eglDisplay(eglDisplay) + , m_config(q_configFromGLFormat(m_eglDisplay, format, true)) + , m_format(q_glFormatFromConfig(m_eglDisplay, m_config)) { - QPlatformGLContext *sharePlatformContext = 0; - sharePlatformContext = format.sharedGLContext(); - mFormat.setSharedContext(sharePlatformContext); - EGLContext shareEGLContext = EGL_NO_CONTEXT; - if (sharePlatformContext) - shareEGLContext = static_cast(sharePlatformContext)->mContext; + EGLContext shareEGLContext = share ? static_cast(share)->eglContext() : EGL_NO_CONTEXT; eglBindAPI(EGL_OPENGL_ES_API); @@ -71,63 +66,38 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QPlatformWindo eglContextAttrs.append(2); eglContextAttrs.append(EGL_NONE); - mContext = eglCreateContext(mEglDisplay, mConfig, - shareEGLContext, eglContextAttrs.constData()); + m_context = eglCreateContext(m_eglDisplay, m_config, shareEGLContext, eglContextAttrs.constData()); } -QWaylandGLContext::QWaylandGLContext() - : QPlatformGLContext() - , mEglDisplay(0) - , mContext(EGL_NO_CONTEXT) - , mSurface(EGL_NO_SURFACE) - , mConfig(0) -{ } - QWaylandGLContext::~QWaylandGLContext() { - eglDestroyContext(mEglDisplay,mContext); + eglDestroyContext(m_eglDisplay, m_context); } -void QWaylandGLContext::makeCurrent() +bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface) { - QPlatformGLContext::makeCurrent(); - if (mSurface == EGL_NO_SURFACE) { - qWarning("makeCurrent with EGL_NO_SURFACE"); - } - eglMakeCurrent(mEglDisplay, mSurface, mSurface, mContext); + EGLSurface eglSurface = static_cast(surface)->eglSurface(); + return eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context); } void QWaylandGLContext::doneCurrent() { - QPlatformGLContext::doneCurrent(); - eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); } -void QWaylandGLContext::swapBuffers() +void QWaylandGLContext::swapBuffers(QPlatformSurface *surface) { - eglSwapBuffers(mEglDisplay,mSurface); + EGLSurface eglSurface = static_cast(surface)->eglSurface(); + eglSwapBuffers(m_eglDisplay, eglSurface); } -void *QWaylandGLContext::getProcAddress(const QString &string) +void (*QWaylandGLContext::getProcAddress(const QByteArray &procName)) () { - return (void *) eglGetProcAddress(string.toLatin1().data()); -} - -void QWaylandGLContext::setEglSurface(EGLSurface surface) -{ - bool wasCurrent = false; - if (QPlatformGLContext::currentContext() == this) { - wasCurrent = true; - doneCurrent(); - } - mSurface = surface; - if (wasCurrent) { - makeCurrent(); - } + return eglGetProcAddress(procName.constData()); } EGLConfig QWaylandGLContext::eglConfig() const { - return mConfig; + return m_config; } diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h index 2c6feb498c2..16d9fa4adaa 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h @@ -44,36 +44,36 @@ #include "qwaylanddisplay.h" -#include +#include #include "qwaylandeglinclude.h" class QWaylandWindow; class QWaylandGLWindowSurface; -class QWaylandGLContext : public QPlatformGLContext { +class QWaylandGLContext : public QPlatformOpenGLContext { public: - QWaylandGLContext(EGLDisplay eglDisplay, const QPlatformWindowFormat &format); + QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share); ~QWaylandGLContext(); - void makeCurrent(); + + void swapBuffers(QPlatformSurface *surface); + + bool makeCurrent(QPlatformSurface *surface); void doneCurrent(); - void swapBuffers(); - void* getProcAddress(const QString&); - QPlatformWindowFormat platformWindowFormat() const { return mFormat; } + void (*getProcAddress(const QByteArray &procName)) (); + + QSurfaceFormat format() const { return m_format; } - void setEglSurface(EGLSurface surface); EGLConfig eglConfig() const; + EGLContext eglContext() const { return m_context; } + private: - EGLDisplay mEglDisplay; - - EGLContext mContext; - EGLSurface mSurface; - EGLConfig mConfig; - QPlatformWindowFormat mFormat; - - QWaylandGLContext(); + EGLDisplay m_eglDisplay; + EGLContext m_context; + EGLConfig m_config; + QSurfaceFormat m_format; }; diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri b/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri index cd0701150fe..8b4b163b037 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/wayland_egl.pri @@ -1,5 +1,3 @@ -include (../../../eglconvenience/eglconvenience.pri) - LIBS += -lwayland-egl -lEGL INCLUDEPATH += $$PWD SOURCES += $$PWD/qwaylandeglintegration.cpp \ diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp index 999a4113976..f2f9d1ceb62 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.cpp @@ -42,128 +42,31 @@ #include "qwaylandxcompositeeglcontext.h" #include "qwaylandxcompositeeglwindow.h" -#include "qwaylandxcompositebuffer.h" -#include "wayland-xcomposite-client-protocol.h" #include +#include -#include "qeglconvenience.h" -#include "qxlibeglintegration.h" +#include -#include - -QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(QWaylandXCompositeEGLIntegration *glxIntegration, QWaylandXCompositeEGLWindow *window) - : QPlatformGLContext() - , mEglIntegration(glxIntegration) - , mWindow(window) - , mBuffer(0) - , mXWindow(0) - , mConfig(q_configFromQPlatformWindowFormat(glxIntegration->eglDisplay(),window->widget()->platformWindowFormat(),true,EGL_WINDOW_BIT)) - , mWaitingForSync(false) +QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display) + : QEGLPlatformContext(format, share, display) { - QVector eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); eglContextAttrs.append(2); - eglContextAttrs.append(EGL_NONE); - - mContext = eglCreateContext(glxIntegration->eglDisplay(),mConfig,EGL_NO_CONTEXT,eglContextAttrs.constData()); - if (mContext == EGL_NO_CONTEXT) { - qFatal("failed to find context"); - } - - geometryChanged(); } -void QWaylandXCompositeEGLContext::makeCurrent() +void QWaylandXCompositeEGLContext::swapBuffers(QPlatformSurface *surface) { - QPlatformGLContext::makeCurrent(); + QEGLPlatformContext::swapBuffers(surface); - eglMakeCurrent(mEglIntegration->eglDisplay(),mEglWindowSurface,mEglWindowSurface,mContext); + QWaylandXCompositeEGLWindow *w = + static_cast(surface); + + QSize size = w->geometry().size(); + + w->damage(QRect(QPoint(), size)); + w->waitForFrameSync(); } -void QWaylandXCompositeEGLContext::doneCurrent() +EGLSurface QWaylandXCompositeEGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) { - QPlatformGLContext::doneCurrent(); - eglMakeCurrent(mEglIntegration->eglDisplay(),EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT); -} - -void QWaylandXCompositeEGLContext::swapBuffers() -{ - QSize size = mWindow->geometry().size(); - - eglSwapBuffers(mEglIntegration->eglDisplay(),mEglWindowSurface); - mWindow->damage(QRect(QPoint(0,0),size)); - mWindow->waitForFrameSync(); -} - -void * QWaylandXCompositeEGLContext::getProcAddress(const QString &procName) -{ - return (void *)eglGetProcAddress(qPrintable(procName)); -} - -QPlatformWindowFormat QWaylandXCompositeEGLContext::platformWindowFormat() const -{ - return qt_qPlatformWindowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig); -} - -void QWaylandXCompositeEGLContext::sync_function(void *data) -{ - QWaylandXCompositeEGLContext *that = static_cast(data); - that->mWaitingForSync = false; -} - -void QWaylandXCompositeEGLContext::geometryChanged() -{ - QSize size(mWindow->geometry().size()); - if (size.isEmpty()) { - //QGLWidget wants a context for a window without geometry - size = QSize(1,1); - } - - delete mBuffer; - //XFreePixmap deletes the glxPixmap as well - if (mXWindow) { - XDestroyWindow(mEglIntegration->xDisplay(),mXWindow); - } - - VisualID visualId = QXlibEglIntegration::getCompatibleVisualId(mEglIntegration->xDisplay(),mEglIntegration->eglDisplay(),mConfig); - - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = visualId; - - int matchingCount = 0; - XVisualInfo *visualInfo = XGetVisualInfo(mEglIntegration->xDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount); - - Colormap cmap = XCreateColormap(mEglIntegration->xDisplay(),mEglIntegration->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.colormap = cmap; - mXWindow = XCreateWindow(mEglIntegration->xDisplay(), mEglIntegration->rootWindow(),0, 0, size.width(), size.height(), - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - - XCompositeRedirectWindow(mEglIntegration->xDisplay(), mXWindow, CompositeRedirectManual); - XMapWindow(mEglIntegration->xDisplay(), mXWindow); - - mEglWindowSurface = eglCreateWindowSurface(mEglIntegration->eglDisplay(),mConfig,mXWindow,0); - if (mEglWindowSurface == EGL_NO_SURFACE) { - qFatal("Could not make eglsurface"); - } - - XSync(mEglIntegration->xDisplay(),False); - mBuffer = new QWaylandXCompositeBuffer(mEglIntegration->waylandXComposite(), - (uint32_t)mXWindow, - size, - mEglIntegration->waylandDisplay()->argbVisual()); - mWindow->attach(mBuffer); - wl_display_sync_callback(mEglIntegration->waylandDisplay()->wl_display(), - QWaylandXCompositeEGLContext::sync_function, - this); - - mWaitingForSync = true; - wl_display_sync(mEglIntegration->waylandDisplay()->wl_display(),0); - mEglIntegration->waylandDisplay()->flushRequests(); - while (mWaitingForSync) { - mEglIntegration->waylandDisplay()->readEvents(); - } + return static_cast(surface)->eglSurface(); } diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h index 9d9dd53e0b9..8420f2be133 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglcontext.h @@ -42,41 +42,23 @@ #ifndef QWAYLANDXCOMPOSITEEGLCONTEXT_H #define QWAYLANDXCOMPOSITEEGLCONTEXT_H -#include +#include -#include - -#include "qwaylandbuffer.h" #include "qwaylandxcompositeeglintegration.h" +#include + class QWaylandXCompositeEGLWindow; -class QWaylandXCompositeEGLContext : public QPlatformGLContext +class QWaylandXCompositeEGLContext : public QEGLPlatformContext { public: - QWaylandXCompositeEGLContext(QWaylandXCompositeEGLIntegration *glxIntegration, QWaylandXCompositeEGLWindow *window); + QWaylandXCompositeEGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display); - void makeCurrent(); - void doneCurrent(); - void swapBuffers(); - void* getProcAddress(const QString& procName); - - QPlatformWindowFormat platformWindowFormat() const; - - void geometryChanged(); + void swapBuffers(QPlatformSurface *surface); private: - QWaylandXCompositeEGLIntegration *mEglIntegration; - QWaylandXCompositeEGLWindow *mWindow; - QWaylandBuffer *mBuffer; - - Window mXWindow; - EGLConfig mConfig; - EGLContext mContext; - EGLSurface mEglWindowSurface; - - static void sync_function(void *data); - bool mWaitingForSync; + EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface); }; #endif // QWAYLANDXCOMPOSITEEGLCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp index 53199e87b88..d7e37f8e702 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.cpp @@ -70,9 +70,14 @@ void QWaylandXCompositeEGLIntegration::initialize() { } -QWaylandWindow * QWaylandXCompositeEGLIntegration::createEglWindow(QWidget *widget) +QWaylandWindow * QWaylandXCompositeEGLIntegration::createEglWindow(QWindow *window) { - return new QWaylandXCompositeEGLWindow(widget,this); + return new QWaylandXCompositeEGLWindow(window,this); +} + +QPlatformOpenGLContext *QWaylandXCompositeEGLIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const +{ + return new QWaylandXCompositeEGLContext(glFormat, share, eglDisplay()); } Display * QWaylandXCompositeEGLIntegration::xDisplay() const diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h index 1e8055944fe..74ea930e9ab 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglintegration.h @@ -49,7 +49,9 @@ #include #include #include -#include +#include + +#include #include @@ -66,7 +68,8 @@ public: void initialize(); - QWaylandWindow *createEglWindow(QWidget *widget); + QWaylandWindow *createEglWindow(QWindow *window); + QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; QWaylandDisplay *waylandDisplay() const; struct wl_xcomposite *waylandXComposite() const; diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp index 1047cb8b0a6..320113f58d1 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.cpp @@ -40,17 +40,29 @@ ****************************************************************************/ #include "qwaylandxcompositeeglwindow.h" +#include "qwaylandxcompositebuffer.h" + +#include +#include + +#include "wayland-xcomposite-client-protocol.h" + +#include #include "qwaylandxcompositeeglintegration.h" #include "windowmanager_integration/qwaylandwindowmanagerintegration.h" #include -QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWidget *window, QWaylandXCompositeEGLIntegration *glxIntegration) +QWaylandXCompositeEGLWindow::QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLIntegration *glxIntegration) : QWaylandWindow(window) - , mGlxIntegration(glxIntegration) - , mContext(0) + , m_glxIntegration(glxIntegration) + , m_context(0) + , m_buffer(0) + , m_xWindow(0) + , m_config(q_configFromGLFormat(glxIntegration->eglDisplay(), window->format(), true)) + , m_surface(0) + , m_waitingForSync(false) { - } QWaylandWindow::WindowType QWaylandXCompositeEGLWindow::windowType() const @@ -59,25 +71,85 @@ QWaylandWindow::WindowType QWaylandXCompositeEGLWindow::windowType() const return QWaylandWindow::Egl; } -QPlatformGLContext * QWaylandXCompositeEGLWindow::glContext() const -{ - if (!mContext) { - qDebug() << "creating glcontext;"; - QWaylandXCompositeEGLWindow *that = const_cast(this); - that->mContext = new QWaylandXCompositeEGLContext(mGlxIntegration,that); - } - return mContext; -} - void QWaylandXCompositeEGLWindow::setGeometry(const QRect &rect) { QWaylandWindow::setGeometry(rect); - if (mContext) { - mContext->geometryChanged(); + if (m_surface) { + eglDestroySurface(m_glxIntegration->eglDisplay(), m_surface); + m_surface = 0; } } +EGLSurface QWaylandXCompositeEGLWindow::eglSurface() const +{ + if (!m_surface) + const_cast(this)->createEglSurface(); + return m_surface; +} + +void QWaylandXCompositeEGLWindow::createEglSurface() +{ + QSize size(geometry().size()); + if (size.isEmpty()) { + // QGLWidget wants a context for a window without geometry + size = QSize(1,1); + } + + delete m_buffer; + //XFreePixmap deletes the glxPixmap as well + if (m_xWindow) { + XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow); + } + + VisualID visualId = QXlibEglIntegration::getCompatibleVisualId(m_glxIntegration->xDisplay(), m_glxIntegration->eglDisplay(), m_config); + + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = visualId; + + int matchingCount = 0; + XVisualInfo *visualInfo = XGetVisualInfo(m_glxIntegration->xDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount); + + Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(),m_glxIntegration->rootWindow(),visualInfo->visual,AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(), + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + + XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual); + XMapWindow(m_glxIntegration->xDisplay(), m_xWindow); + + m_surface = eglCreateWindowSurface(m_glxIntegration->eglDisplay(), m_config, m_xWindow,0); + if (m_surface == EGL_NO_SURFACE) { + qFatal("Could not make eglsurface"); + } + + XSync(m_glxIntegration->xDisplay(),False); + mBuffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), + (uint32_t)m_xWindow, + size, + m_glxIntegration->waylandDisplay()->argbVisual()); + attach(m_buffer); + wl_display_sync_callback(m_glxIntegration->waylandDisplay()->wl_display(), + QWaylandXCompositeEGLWindow::sync_function, + this); + + m_waitingForSync = true; + wl_display_sync(m_glxIntegration->waylandDisplay()->wl_display(),0); + m_glxIntegration->waylandDisplay()->flushRequests(); + while (m_waitingForSync) + m_glxIntegration->waylandDisplay()->readEvents(); +} + +void QWaylandXCompositeEGLWindow::sync_function(void *data) +{ + QWaylandXCompositeEGLWindow *that = static_cast(data); + that->m_waitingForSync = false; +} + void QWaylandXCompositeEGLWindow::requestActivateWindow() { #ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h index ea4dd2d6266..b2f8fbe6c4b 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/qwaylandxcompositeeglwindow.h @@ -43,24 +43,36 @@ #define QWAYLANDXCOMPOSITEEGLWINDOW_H #include "qwaylandwindow.h" +#include "qwaylandbuffer.h" + #include "qwaylandxcompositeeglintegration.h" #include "qwaylandxcompositeeglcontext.h" class QWaylandXCompositeEGLWindow : public QWaylandWindow { public: - QWaylandXCompositeEGLWindow(QWidget *window, QWaylandXCompositeEGLIntegration *glxIntegration); + QWaylandXCompositeEGLWindow(QWindow *window, QWaylandXCompositeEGLIntegration *glxIntegration); WindowType windowType() const; - QPlatformGLContext *glContext() const; - void setGeometry(const QRect &rect); void requestActivateWindow(); -private: - QWaylandXCompositeEGLIntegration *mGlxIntegration; - QWaylandXCompositeEGLContext *mContext; + EGLSurface eglSurface() const; +private: + void createEglSurface(); + + QWaylandXCompositeEGLIntegration *m_glxIntegration; + QWaylandXCompositeEGLContext *m_context; + QWaylandBuffer *m_buffer; + + Window m_xWindow; + EGLConfig m_config; + EGLSurface m_surface; + + bool m_waitingForSync; + + static void sync_function(void *data); }; #endif // QWAYLANDXCOMPOSITEEGLWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/xcomposite_egl.pri b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/xcomposite_egl.pri index c3533f9ce3b..5f86bd9588b 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/xcomposite_egl.pri +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_egl/xcomposite_egl.pri @@ -1,6 +1,4 @@ include (../xcomposite_share/xcomposite_share.pri) -include (../../../eglconvenience/eglconvenience.pri) -include (../../../eglconvenience/xlibeglintegration.pri) LIBS += -lXcomposite -lEGL diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp index 3d49790f3a2..75881a7fdd2 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.cpp @@ -39,114 +39,56 @@ ** ****************************************************************************/ +#include + #include "qwaylandxcompositeglxcontext.h" #include "qwaylandxcompositeglxwindow.h" -#include "qwaylandxcompositebuffer.h" -#include "wayland-xcomposite-client-protocol.h" -#include +#include -#include - -QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(QWaylandXCompositeGLXIntegration *glxIntegration, QWaylandXCompositeGLXWindow *window) - : QPlatformGLContext() - , mGlxIntegration(glxIntegration) - , mWindow(window) - , mBuffer(0) - , mXWindow(0) - , mConfig(qglx_findConfig(glxIntegration->xDisplay(),glxIntegration->screen(),window->widget()->platformWindowFormat())) - , mWaitingForSyncCallback(false) +QWaylandXCompositeGLXContext::QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen) + : m_display(display) { - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(glxIntegration->xDisplay(),mConfig); - mContext = glXCreateContext(glxIntegration->xDisplay(),visualInfo,0,TRUE); - - geometryChanged(); + qDebug("creating XComposite-GLX context"); + GLXContext shareContext = share ? static_cast(share)->m_context : 0; + GLXFBConfig config = qglx_findConfig(display, screen, format); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(display, config); + m_context = glXCreateContext(display, visualInfo, shareContext, true); + m_format = qglx_surfaceFormatFromGLXFBConfig(display, config, m_context); } -void QWaylandXCompositeGLXContext::makeCurrent() +bool QWaylandXCompositeGLXContext::makeCurrent(QPlatformSurface *surface) { - QPlatformGLContext::makeCurrent(); - glXMakeCurrent(mGlxIntegration->xDisplay(),mXWindow,mContext); + Window xWindow = static_cast(surface)->xWindow(); + + return glXMakeCurrent(m_display, xWindow, m_context); } void QWaylandXCompositeGLXContext::doneCurrent() { - glXMakeCurrent(mGlxIntegration->xDisplay(),0,0); - QPlatformGLContext::doneCurrent(); + glXMakeCurrent(m_display, 0, 0); } -void QWaylandXCompositeGLXContext::swapBuffers() +void QWaylandXCompositeGLXContext::swapBuffers(QPlatformSurface *surface) { - QSize size = mWindow->geometry().size(); + QWaylandXCompositeGLXWindow *w = static_cast(surface); - glXSwapBuffers(mGlxIntegration->xDisplay(),mXWindow); - mWindow->damage(QRect(QPoint(0,0),size)); - mWindow->waitForFrameSync(); + QSize size = w->geometry().size(); + + glXSwapBuffers(m_display, w->xWindow()); + + w->damage(QRect(QPoint(), size)); + w->waitForFrameSync(); } -void * QWaylandXCompositeGLXContext::getProcAddress(const QString &procName) +void (*QWaylandXCompositeGLXContext::getProcAddress(const QByteArray &procName)) () { - return (void *) glXGetProcAddress(reinterpret_cast(procName.toLatin1().data())); + return glXGetProcAddress(reinterpret_cast(procName.constData())); } -QPlatformWindowFormat QWaylandXCompositeGLXContext::platformWindowFormat() const +QSurfaceFormat QWaylandXCompositeGLXContext::format() const { - return qglx_platformWindowFromGLXFBConfig(mGlxIntegration->xDisplay(),mConfig,mContext); + return m_format; } -void QWaylandXCompositeGLXContext::sync_function(void *data) -{ - QWaylandXCompositeGLXContext *that = static_cast(data); - that->mWaitingForSyncCallback = false; -} - -void QWaylandXCompositeGLXContext::waitForSync() -{ - wl_display_sync_callback(mGlxIntegration->waylandDisplay()->wl_display(), - QWaylandXCompositeGLXContext::sync_function, - this); - mWaitingForSyncCallback = true; - wl_display_sync(mGlxIntegration->waylandDisplay()->wl_display(),0); - mGlxIntegration->waylandDisplay()->flushRequests(); - while (mWaitingForSyncCallback) { - mGlxIntegration->waylandDisplay()->readEvents(); - } -} - -void QWaylandXCompositeGLXContext::geometryChanged() -{ - QSize size(mWindow->geometry().size()); - if (size.isEmpty()) { - //QGLWidget wants a context for a window without geometry - size = QSize(1,1); - } - - delete mBuffer; - //XFreePixmap deletes the glxPixmap as well - if (mXWindow) { - XDestroyWindow(mGlxIntegration->xDisplay(),mXWindow); - } - - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(mGlxIntegration->xDisplay(),mConfig); - Colormap cmap = XCreateColormap(mGlxIntegration->xDisplay(),mGlxIntegration->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.background_pixel = WhitePixel(mGlxIntegration->xDisplay(), mGlxIntegration->screen()); - a.border_pixel = BlackPixel(mGlxIntegration->xDisplay(), mGlxIntegration->screen()); - a.colormap = cmap; - mXWindow = XCreateWindow(mGlxIntegration->xDisplay(), mGlxIntegration->rootWindow(),0, 0, size.width(), size.height(), - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWBackPixel|CWBorderPixel|CWColormap, &a); - - XCompositeRedirectWindow(mGlxIntegration->xDisplay(), mXWindow, CompositeRedirectManual); - XMapWindow(mGlxIntegration->xDisplay(), mXWindow); - - XSync(mGlxIntegration->xDisplay(),False); - mBuffer = new QWaylandXCompositeBuffer(mGlxIntegration->waylandXComposite(), - (uint32_t)mXWindow, - size, - mGlxIntegration->waylandDisplay()->argbVisual()); - mWindow->attach(mBuffer); - waitForSync(); -} diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h index b6ee2bbc236..3364d88ec40 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxcontext.h @@ -42,44 +42,33 @@ #ifndef QWAYLANDXCOMPOSITEGLXCONTEXT_H #define QWAYLANDXCOMPOSITEGLXCONTEXT_H -#include +#include -#include - -#include "qwaylandbuffer.h" #include "qwaylandxcompositeglxintegration.h" - -#include "qglxconvenience.h" +#include class QWaylandXCompositeGLXWindow; class QWaylandShmBuffer; -class QWaylandXCompositeGLXContext : public QPlatformGLContext +class QWaylandXCompositeGLXContext : public QPlatformOpenGLContext { public: - QWaylandXCompositeGLXContext(QWaylandXCompositeGLXIntegration *glxIntegration, QWaylandXCompositeGLXWindow *window); + QWaylandXCompositeGLXContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, Display *display, int screen); - void makeCurrent(); + QSurfaceFormat format() const; + + void swapBuffers(QPlatformSurface *surface); + + bool makeCurrent(QPlatformSurface *surface); void doneCurrent(); - void swapBuffers(); - void* getProcAddress(const QString& procName); - QPlatformWindowFormat platformWindowFormat() const; - - void geometryChanged(); + void (*getProcAddress(const QByteArray &procName)) (); private: - QWaylandXCompositeGLXIntegration *mGlxIntegration; - QWaylandXCompositeGLXWindow *mWindow; - QWaylandBuffer *mBuffer; + GLXContext m_context; - Window mXWindow; - GLXFBConfig mConfig; - GLXContext mContext; - - static void sync_function(void *data); - void waitForSync(); - bool mWaitingForSyncCallback; + Display *m_display; + QSurfaceFormat m_format; }; #endif // QWAYLANDXCOMPOSITEGLXCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp index e8dbea48c6d..e1eb2e635a8 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.cpp @@ -52,12 +52,15 @@ QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDispl return new QWaylandXCompositeGLXIntegration(waylandDisplay); } -QWaylandXCompositeGLXIntegration::QWaylandXCompositeGLXIntegration(QWaylandDisplay * waylandDispaly) - : QWaylandGLIntegration() - , mWaylandDisplay(waylandDispaly) +QWaylandXCompositeGLXIntegration::QWaylandXCompositeGLXIntegration(QWaylandDisplay *waylandDisplay) + : mWaylandDisplay(waylandDisplay) + , mWaylandComposite(0) + , mDisplay(0) + , mScreen(0) + , mRootWindow(0) { qDebug() << "Using XComposite-GLX"; - wl_display_add_global_listener(waylandDispaly->wl_display(), QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal, + wl_display_add_global_listener(waylandDisplay->wl_display(), QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal, this); } @@ -70,9 +73,14 @@ void QWaylandXCompositeGLXIntegration::initialize() { } -QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWidget *widget) +QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWindow *window) { - return new QWaylandXCompositeGLXWindow(widget,this); + return new QWaylandXCompositeGLXWindow(window, this); +} + +QPlatformOpenGLContext *QWaylandXCompositeGLXIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const +{ + return new QWaylandXCompositeGLXContext(glFormat, share, mDisplay, mScreen); } Display * QWaylandXCompositeGLXIntegration::xDisplay() const @@ -107,6 +115,7 @@ void QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal(wl_display *display { Q_UNUSED(version); if (strcmp(interface, "wl_xcomposite") == 0) { + qDebug("XComposite-GLX: got wl_xcomposite global"); QWaylandXCompositeGLXIntegration *integration = static_cast(data); integration->mWaylandComposite = wl_xcomposite_create(display,id,1); wl_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration); @@ -119,6 +128,8 @@ void QWaylandXCompositeGLXIntegration::rootInformation(void *data, wl_xcomposite Q_UNUSED(xcomposite); QWaylandXCompositeGLXIntegration *integration = static_cast(data); + qDebug("XComposite-GLX: xcomposite listener callback"); + integration->mDisplay = XOpenDisplay(display_name); integration->mRootWindow = (Window) root_window; integration->mScreen = XDefaultScreen(integration->mDisplay); diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h index 17f2f6d4e42..b028067d8e1 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxintegration.h @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include @@ -63,7 +63,8 @@ public: void initialize(); - QWaylandWindow *createEglWindow(QWidget *widget); + QWaylandWindow *createEglWindow(QWindow *window); + QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; QWaylandDisplay *waylandDisplay() const; struct wl_xcomposite *waylandXComposite() const; diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp index cd7ae1964cf..abaf3b16a97 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.cpp @@ -40,15 +40,24 @@ ****************************************************************************/ #include "qwaylandxcompositeglxwindow.h" +#include "qwaylandxcompositebuffer.h" #include -QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWidget *window, QWaylandXCompositeGLXIntegration *glxIntegration) - : QWaylandWindow(window) - , mGlxIntegration(glxIntegration) - , mContext(0) -{ +#include "wayland-xcomposite-client-protocol.h" +#include +#include + + +QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration) + : QWaylandWindow(window) + , m_glxIntegration(glxIntegration) + , m_xWindow(0) + , m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->format())) + , m_buffer(0) + , m_waitingForSync(false) +{ } QWaylandWindow::WindowType QWaylandXCompositeGLXWindow::windowType() const @@ -57,21 +66,79 @@ QWaylandWindow::WindowType QWaylandXCompositeGLXWindow::windowType() const return QWaylandWindow::Egl; } -QPlatformGLContext * QWaylandXCompositeGLXWindow::glContext() const -{ - if (!mContext) { - qDebug() << "creating glcontext;"; - QWaylandXCompositeGLXWindow *that = const_cast(this); - that->mContext = new QWaylandXCompositeGLXContext(mGlxIntegration,that); - } - return mContext; -} - void QWaylandXCompositeGLXWindow::setGeometry(const QRect &rect) { QWaylandWindow::setGeometry(rect); - if (mContext) { - mContext->geometryChanged(); + if (m_xWindow) { + delete m_buffer; + + XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow); + m_xWindow = 0; } } + +Window QWaylandXCompositeGLXWindow::xWindow() const +{ + if (!m_xWindow) + const_cast(this)->createSurface(); + + return m_xWindow; +} + +void QWaylandXCompositeGLXWindow::waitForSync() +{ + wl_display_sync_callback(m_glxIntegration->waylandDisplay()->wl_display(), + QWaylandXCompositeGLXWindow::sync_function, + this); + m_waitingForSync= true; + wl_display_sync(m_glxIntegration->waylandDisplay()->wl_display(), 0); + m_glxIntegration->waylandDisplay()->flushRequests(); + while (m_waitingForSync) + m_glxIntegration->waylandDisplay()->readEvents(); +} + + +void QWaylandXCompositeGLXWindow::createSurface() +{ + QSize size(geometry().size()); + if (size.isEmpty()) { + //QGLWidget wants a context for a window without geometry + size = QSize(1,1); + } + + if (!m_glxIntegration->xDisplay()) { + qWarning("XCompositeGLXWindow: X display still null?!"); + return; + } + + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(m_glxIntegration->xDisplay(), m_config); + Colormap cmap = XCreateColormap(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(), + visualInfo->visual, AllocNone); + + XSetWindowAttributes a; + a.background_pixel = WhitePixel(m_glxIntegration->xDisplay(), m_glxIntegration->screen()); + a.border_pixel = BlackPixel(m_glxIntegration->xDisplay(), m_glxIntegration->screen()); + a.colormap = cmap; + m_xWindow = XCreateWindow(m_glxIntegration->xDisplay(), m_glxIntegration->rootWindow(),0, 0, size.width(), size.height(), + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWBackPixel|CWBorderPixel|CWColormap, &a); + + XCompositeRedirectWindow(m_glxIntegration->xDisplay(), m_xWindow, CompositeRedirectManual); + XMapWindow(m_glxIntegration->xDisplay(), m_xWindow); + + XSync(m_glxIntegration->xDisplay(), False); + m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), + (uint32_t)m_xWindow, + size, + m_glxIntegration->waylandDisplay()->argbVisual()); + attach(m_buffer); + waitForSync(); +} + +void QWaylandXCompositeGLXWindow::sync_function(void *data) +{ + QWaylandXCompositeGLXWindow *that = static_cast(data); + that->m_waitingForSync = false; +} + diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h index 8808f2d4824..acf6c8e63e3 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/qwaylandxcompositeglxwindow.h @@ -46,20 +46,34 @@ #include "qwaylandxcompositeglxintegration.h" #include "qwaylandxcompositeglxcontext.h" +#include + +#include "qwaylandbuffer.h" + class QWaylandXCompositeGLXWindow : public QWaylandWindow { public: - QWaylandXCompositeGLXWindow(QWidget *window, QWaylandXCompositeGLXIntegration *glxIntegration); + QWaylandXCompositeGLXWindow(QWindow *window, QWaylandXCompositeGLXIntegration *glxIntegration); WindowType windowType() const; - QPlatformGLContext *glContext() const; - void setGeometry(const QRect &rect); -private: - QWaylandXCompositeGLXIntegration *mGlxIntegration; - QWaylandXCompositeGLXContext *mContext; + Window xWindow() const; +private: + void createSurface(); + + QWaylandXCompositeGLXIntegration *m_glxIntegration; + + Window m_xWindow; + GLXFBConfig m_config; + + QWaylandBuffer *m_buffer; + + void waitForSync(); + bool m_waitingForSync; + + static void sync_function(void *data); }; #endif // QWAYLANDXCOMPOSITEGLXWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/xcomposite_glx.pri b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/xcomposite_glx.pri index 43295e91e71..bbd6c12e42a 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/xcomposite_glx.pri +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_glx/xcomposite_glx.pri @@ -1,5 +1,4 @@ include (../xcomposite_share/xcomposite_share.pri) -include (../../../glxconvenience/glxconvenience.pri) LIBS += -lXcomposite SOURCES += \ diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp index 7d309ef8771..f4bacc3c1fe 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.cpp @@ -42,6 +42,7 @@ #include "qwaylandxcompositebuffer.h" #include "wayland-client.h" +#include "wayland-xcomposite-client-protocol.h" QWaylandXCompositeBuffer::QWaylandXCompositeBuffer(wl_xcomposite *xcomposite, uint32_t window, const QSize &size, wl_visual *visual) :mSize(size) diff --git a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h index cbd40ad3813..02176d7850d 100644 --- a/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h +++ b/src/plugins/platforms/wayland/gl_integration/xcomposite_share/qwaylandxcompositebuffer.h @@ -43,8 +43,10 @@ #define QWAYLANDXCOMPOSITEBUFFER_H #include "qwaylandbuffer.h" +#include -#include "wayland-xcomposite-client-protocol.h" +struct wl_xcomposite; +struct wl_visual; class QWaylandXCompositeBuffer : public QWaylandBuffer { diff --git a/src/plugins/platforms/wayland/main.cpp b/src/plugins/platforms/wayland/main.cpp index ba365ca3a1e..e4d420d68a3 100644 --- a/src/plugins/platforms/wayland/main.cpp +++ b/src/plugins/platforms/wayland/main.cpp @@ -54,8 +54,7 @@ public: QStringList QWaylandIntegrationPlugin::keys() const { QStringList list; - list << "Wayland"; - list << "WaylandGL"; + list << "wayland"; return list; } @@ -63,9 +62,7 @@ QPlatformIntegration *QWaylandIntegrationPlugin::create(const QString& system, c { Q_UNUSED(paramList); if (system.toLower() == "wayland") - return new QWaylandIntegration; - if (system.toLower() == "waylandgl") - return new QWaylandIntegration(true); + return new QWaylandIntegration(); return 0; } diff --git a/src/plugins/platforms/wayland/qwaylandclipboard.cpp b/src/plugins/platforms/wayland/qwaylandclipboard.cpp index 45f0abc00a0..f90d1a9802b 100644 --- a/src/plugins/platforms/wayland/qwaylandclipboard.cpp +++ b/src/plugins/platforms/wayland/qwaylandclipboard.cpp @@ -44,7 +44,7 @@ #include "qwaylandinputdevice.h" #include "qwaylandmime.h" #include -#include +#include #include #include #include diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 87b846cefbf..bbbab6dca7c 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -43,10 +43,11 @@ #include "qwaylanddisplay.h" #include "qwaylandinputdevice.h" -#include "qwaylandshmsurface.h" #include "qwaylandscreen.h" +#include "qwaylandshmbackingstore.h" #include +#include #define DATADIR "/usr/share" @@ -108,14 +109,15 @@ QWaylandCursor::QWaylandCursor(QWaylandScreen *screen) { } -void QWaylandCursor::changeCursor(QCursor *cursor, QWidget *widget) +void QWaylandCursor::changeCursor(QCursor *cursor, QWindow *window) { const struct pointer_image *p; - if (widget == NULL) + if (window == NULL) return; p = NULL; + bool isBitmap = false; switch (cursor->shape()) { case Qt::ArrowCursor: @@ -152,32 +154,53 @@ void QWaylandCursor::changeCursor(QCursor *cursor, QWidget *widget) p = &pointer_images[cursor->shape()]; break; - default: case Qt::BitmapCursor: + isBitmap = true; + break; + + default: break; } - if (!p) { + if (!p && !isBitmap) { p = &pointer_images[0]; qWarning("unhandled cursor %d", cursor->shape()); } - QImageReader reader(p->filename); - - if (!reader.canRead()) - return; - - if (mBuffer == NULL || mBuffer->size() != reader.size()) { - if (mBuffer) + if (isBitmap && !cursor->pixmap().isNull()) { + setupPixmapCursor(cursor); + } else if (isBitmap && cursor->bitmap()) { + qWarning("unsupported QBitmap cursor"); + } else { + QImageReader reader(p->filename); + if (!reader.canRead()) + return; + if (mBuffer == NULL || mBuffer->size() != reader.size()) { delete mBuffer; + mBuffer = new QWaylandShmBuffer(mDisplay, reader.size(), + QImage::Format_ARGB32); + } + reader.read(mBuffer->image()); + mDisplay->setCursor(mBuffer, p->hotspot_x, p->hotspot_y); + } +} - mBuffer = new QWaylandShmBuffer(mDisplay, reader.size(), +void QWaylandCursor::setupPixmapCursor(QCursor *cursor) +{ + if (!cursor) { + delete mBuffer; + mBuffer = 0; + return; + } + if (!mBuffer || mBuffer->size() != cursor->pixmap().size()) { + delete mBuffer; + mBuffer = new QWaylandShmBuffer(mDisplay, cursor->pixmap().size(), QImage::Format_ARGB32); } - - reader.read(mBuffer->image()); - - mDisplay->setCursor(mBuffer, p->hotspot_x, p->hotspot_y); + QImage src = cursor->pixmap().toImage().convertToFormat(QImage::Format_ARGB32); + for (int y = 0; y < src.height(); ++y) + qMemCopy(mBuffer->image()->scanLine(y), src.scanLine(y), src.bytesPerLine()); + mDisplay->setCursor(mBuffer, cursor->hotSpot().x(), cursor->hotSpot().y()); } void QWaylandDisplay::setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y) @@ -189,3 +212,19 @@ void QWaylandDisplay::setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y) inputDevice->attach(buffer, x, y); } } + +void QWaylandCursor::pointerEvent(const QMouseEvent &event) +{ + mLastPos = event.globalPos(); +} + +QPoint QWaylandCursor::pos() const +{ + return mLastPos; +} + +void QWaylandCursor::setPos(const QPoint &pos) +{ + Q_UNUSED(pos); + qWarning() << "QWaylandCursor::setPos: not implemented"; +} diff --git a/src/plugins/platforms/wayland/qwaylandcursor.h b/src/plugins/platforms/wayland/qwaylandcursor.h index 236bfc56eee..8753aa56987 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.h +++ b/src/plugins/platforms/wayland/qwaylandcursor.h @@ -48,13 +48,23 @@ class QWaylandShmBuffer; class QWaylandDisplay; class QWaylandScreen; -class QWaylandCursor : QPlatformCursor { +class QWaylandCursor : public QPlatformCursor +{ public: QWaylandCursor(QWaylandScreen *screen); - void changeCursor(QCursor *cursor, QWidget *widget); + void changeCursor(QCursor *cursor, QWindow *window); + void pointerEvent(const QMouseEvent &event); + QPoint pos() const; + void setPos(const QPoint &pos); + + void setupPixmapCursor(QCursor *cursor); + QWaylandShmBuffer *mBuffer; QWaylandDisplay *mDisplay; + +private: + QPoint mLastPos; }; #endif // QWAYLANDCURSOR_H diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 26e0e8ebeb3..588096933c3 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -46,6 +46,7 @@ #include "qwaylandcursor.h" #include "qwaylandinputdevice.h" #include "qwaylandclipboard.h" +#include "qwaylanddnd.h" #ifdef QT_WAYLAND_GL_SUPPORT #include "gl_integration/qwaylandglintegration.h" @@ -56,8 +57,7 @@ #endif #include -#include -#include +#include #include #include @@ -142,6 +142,13 @@ QWaylandDisplay::QWaylandDisplay(void) wl_display_add_global_listener(mDisplay, QWaylandDisplay::displayHandleGlobal, this); + mFd = wl_display_get_fd(mDisplay, sourceUpdate, this); + QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; + connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(flushRequests())); + + mReadNotifier = new QSocketNotifier(mFd, QSocketNotifier::Read, this); + connect(mReadNotifier, SIGNAL(activated(int)), this, SLOT(readEvents())); + #ifdef QT_WAYLAND_GL_SUPPORT mEglIntegration = QWaylandGLIntegration::createGLIntegration(this); #endif @@ -156,13 +163,6 @@ QWaylandDisplay::QWaylandDisplay(void) mEglIntegration->initialize(); #endif - connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), this, SLOT(flushRequests())); - - mFd = wl_display_get_fd(mDisplay, sourceUpdate, this); - - mReadNotifier = new QSocketNotifier(mFd, QSocketNotifier::Read, this); - connect(mReadNotifier, SIGNAL(activated(int)), this, SLOT(readEvents())); - waitForScreens(); } @@ -313,6 +313,8 @@ void QWaylandDisplay::displayHandleGlobal(uint32_t id, mInputDevices.append(inputDevice); } else if (interface == "wl_selection_offer") { QWaylandClipboard::instance(display)->createSelectionOffer(id); + } else if (interface == "wl_drag_offer") { + QWaylandDrag::instance(display)->createDragOffer(id); } } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 4dff24d086f..2b7f33f4f6b 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -49,6 +49,7 @@ #include +class QAbstractEventDispatcher; class QWaylandInputDevice; class QSocketNotifier; class QWaylandBuffer; @@ -142,6 +143,7 @@ private: static void handleVisual(void *data, struct wl_compositor *compositor, uint32_t id, uint32_t token); + #ifdef QT_WAYLAND_GL_SUPPORT QWaylandGLIntegration *mEglIntegration; #endif diff --git a/src/plugins/platforms/wayland/qwaylanddnd.cpp b/src/plugins/platforms/wayland/qwaylanddnd.cpp new file mode 100644 index 00000000000..5368daaf632 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddnd.cpp @@ -0,0 +1,423 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylanddnd.h" +#include "qwaylandinputdevice.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "qwaylandcursor.h" + +class QWaylandDragWrapper +{ +public: + QWaylandDragWrapper(QWaylandDisplay *display, QMimeData *data); + ~QWaylandDragWrapper(); + QMimeData *mimeData() const { return mData; } + +private: + static void target(void *data, wl_drag *drag, const char *mimeType); + static void finish(void *data, wl_drag *drag, int fd); + static void reject(void *data, wl_drag *drag); + static const wl_drag_listener dragListener; + + QWaylandDisplay *mDisplay; + wl_drag *mDrag; + QMimeData *mData; + QString mAcceptedType; +}; + +class QWaylandDragOfferWrapper +{ +public: + QWaylandDragOfferWrapper(QWaylandDisplay *display, QMimeData *data, uint32_t id); + ~QWaylandDragOfferWrapper(); + +private: + static void offer(void *data, struct wl_drag_offer *offer, const char *mimeType); + static void pointerFocus(void *data, struct wl_drag_offer *offer, uint32_t time, + wl_surface *surface, + int32_t x, int32_t y, + int32_t surfaceX, int32_t surfaceY); + static void motion(void *data, struct wl_drag_offer *offer, uint32_t time, + int32_t x, int32_t y, + int32_t surfaceX, int32_t surfaceY); + static void drop(void *data, struct wl_drag_offer *offer); + static const wl_drag_offer_listener dragOfferListener; + + void sendEventToWindow(struct wl_drag_offer *offer, uint32_t time, + wl_surface *surface, const QPoint &pos); + + QWaylandDisplay *mDisplay; + QMimeData *mData; + struct wl_drag_offer *mOffer; + QMimeData mOfferedTypes; // no data in this one, just the formats + wl_surface *mFocusSurface; + bool mAccepted; + QPoint mLastEventPos; + friend class QWaylandDrag; +}; + +static QWaylandDrag *dnd = 0; + +QWaylandDrag *QWaylandDrag::instance(QWaylandDisplay *display) +{ + if (!dnd) + dnd = new QWaylandDrag(display); + return dnd; +} + +QWaylandDrag::QWaylandDrag(QWaylandDisplay *display) + : mDisplay(display), mDropData(0), mCurrentDrag(0), mCurrentOffer(0) +{ + mDropData = new QMimeData; +} + +QWaylandDrag::~QWaylandDrag() +{ + delete mCurrentDrag; + delete mCurrentOffer; + delete mDropData; +} + +QMimeData *QWaylandDrag::platformDropData() +{ + return mDropData; +} + +static void showDragPixmap(bool show) +{ + QCursor c(QDragManager::self()->object->pixmap()); + QList > cursors = QPlatformCursorPrivate::getInstances(); + foreach (QWeakPointer cursor, cursors) + if (cursor) + static_cast(cursor.data())->setupPixmapCursor(show ? &c : 0); +} + + +QWaylandDragWrapper::QWaylandDragWrapper(QWaylandDisplay *display, QMimeData *data) + : mDisplay(display), mDrag(0), mData(data) +{ + QWaylandWindow *w = mDisplay->inputDevices().at(0)->pointerFocus(); + if (!w) { + qWarning("QWaylandDragWrapper: No window with pointer focus?!"); + return; + } + qDebug() << "QWaylandDragWrapper" << data->formats(); + struct wl_shell *shell = display->wl_shell(); + mDrag = wl_shell_create_drag(shell); + wl_drag_add_listener(mDrag, &dragListener, this); + foreach (const QString &format, data->formats()) + wl_drag_offer(mDrag, format.toLatin1().constData()); + struct timeval tv; + gettimeofday(&tv, 0); + wl_drag_activate(mDrag, + w->wl_surface(), + display->inputDevices().at(0)->wl_input_device(), + tv.tv_sec * 1000 + tv.tv_usec / 1000); + showDragPixmap(true); +} + +QWaylandDragWrapper::~QWaylandDragWrapper() +{ + QWaylandDrag *dragHandler = QWaylandDrag::instance(mDisplay); + if (dragHandler->mCurrentDrag == this) + dragHandler->mCurrentDrag = 0; + wl_drag_destroy(mDrag); +} + +const wl_drag_listener QWaylandDragWrapper::dragListener = { + QWaylandDragWrapper::target, + QWaylandDragWrapper::finish, + QWaylandDragWrapper::reject +}; + +void QWaylandDragWrapper::target(void *data, wl_drag *drag, const char *mimeType) +{ + Q_UNUSED(drag); + QWaylandDragWrapper *self = static_cast(data); + self->mAcceptedType = mimeType ? QString::fromLatin1(mimeType) : QString(); + qDebug() << "target" << self->mAcceptedType; + QDragManager *manager = QDragManager::self(); + if (mimeType) + manager->global_accepted_action = manager->defaultAction(manager->possible_actions, + QGuiApplication::keyboardModifiers()); + else + manager->global_accepted_action = Qt::IgnoreAction; +} + +void QWaylandDragWrapper::finish(void *data, wl_drag *drag, int fd) +{ + Q_UNUSED(drag); + QWaylandDragWrapper *self = static_cast(data); + qDebug() << "finish" << self->mAcceptedType; + if (self->mAcceptedType.isEmpty()) + return; // no drag target was valid when the drag finished + QByteArray content = self->mData->data(self->mAcceptedType); + if (!content.isEmpty()) { + QFile f; + if (f.open(fd, QIODevice::WriteOnly)) + f.write(content); + } + close(fd); + // Drag finished on source side with drop. + + QDragManager::self()->stopDrag(); + showDragPixmap(false); + delete self; + qDebug() << " *** DRAG OVER WITH DROP"; +} + +void QWaylandDragWrapper::reject(void *data, wl_drag *drag) +{ + Q_UNUSED(drag); + QWaylandDragWrapper *self = static_cast(data); + self->mAcceptedType = QString(); + qDebug() << "reject"; + QDragManager::self()->global_accepted_action = Qt::IgnoreAction; +} + + +QWaylandDragOfferWrapper::QWaylandDragOfferWrapper(QWaylandDisplay *display, + QMimeData *data, + uint32_t id) + : mDisplay(display), mData(data), mOffer(0), mFocusSurface(0), + mAccepted(false) +{ + mOffer = wl_drag_offer_create(mDisplay->wl_display(), id, 1); + wl_drag_offer_add_listener(mOffer, &dragOfferListener, this); +} + +QWaylandDragOfferWrapper::~QWaylandDragOfferWrapper() +{ + QWaylandDrag *dragHandler = QWaylandDrag::instance(mDisplay); + if (dragHandler->mCurrentOffer == this) + dragHandler->mCurrentOffer = 0; + wl_drag_offer_destroy(mOffer); +} + +const wl_drag_offer_listener QWaylandDragOfferWrapper::dragOfferListener = { + QWaylandDragOfferWrapper::offer, + QWaylandDragOfferWrapper::pointerFocus, + QWaylandDragOfferWrapper::motion, + QWaylandDragOfferWrapper::drop +}; + +void QWaylandDragOfferWrapper::offer(void *data, struct wl_drag_offer *offer, const char *mimeType) +{ + // Called for each type before pointerFocus. + Q_UNUSED(offer); + QWaylandDragOfferWrapper *self = static_cast(data); + self->mOfferedTypes.setData(QString::fromLatin1(mimeType), QByteArray()); +} + +void QWaylandDragOfferWrapper::pointerFocus(void *data, struct wl_drag_offer *offer, uint32_t time, + wl_surface *surface, + int32_t x, int32_t y, + int32_t surfaceX, int32_t surfaceY) +{ + qDebug() << "pointerFocus" << surface << x << y << surfaceX << surfaceY; + QWaylandDragOfferWrapper *self = static_cast(data); + QWaylandDrag *mgr = QWaylandDrag::instance(self->mDisplay); + + if (!surface) { + if (self->mFocusSurface) { + // This is a DragLeave. + QWindow *window = static_cast( + wl_surface_get_user_data(self->mFocusSurface))->window(); + QWindowSystemInterface::handleDrag(window, 0, QPoint()); + if (self->mAccepted) { + wl_drag_offer_reject(offer); + self->mAccepted = false; + } + if (!mgr->mCurrentDrag) // no drag -> this is not the source side -> offer can be destroyed + delete mgr->mCurrentOffer; + } else { + // Drag finished on source side without drop. + QDragManager::self()->stopDrag(); + showDragPixmap(false); + delete mgr->mCurrentDrag; + qDebug() << " *** DRAG OVER WITHOUT DROP"; + } + } + + self->mFocusSurface = surface; + + // This is a DragMove or DragEnter+DragMove. + if (surface) + self->sendEventToWindow(offer, time, surface, QPoint(surfaceX, surfaceY)); +} + +void QWaylandDragOfferWrapper::motion(void *data, struct wl_drag_offer *offer, uint32_t time, + int32_t x, int32_t y, + int32_t surfaceX, int32_t surfaceY) +{ + Q_UNUSED(x); + Q_UNUSED(y); + QWaylandDragOfferWrapper *self = static_cast(data); + if (!self->mFocusSurface) + return; +// qDebug() << "motion" << self->mFocusSurface << x << y << surfaceX << surfaceY; + self->sendEventToWindow(offer, time, self->mFocusSurface, QPoint(surfaceX, surfaceY)); +} + +void QWaylandDragOfferWrapper::sendEventToWindow(struct wl_drag_offer *offer, uint32_t time, + wl_surface *surface, const QPoint &pos) +{ + QWindow *window = static_cast(wl_surface_get_user_data(surface))->window(); + Qt::DropAction action = QWindowSystemInterface::handleDrag(window, &mOfferedTypes, pos); + bool accepted = (action != Qt::IgnoreAction && !mOfferedTypes.formats().isEmpty()); + if (accepted != mAccepted) { + mAccepted = accepted; + if (mAccepted) { + // What can we do, just accept the first type... + QByteArray ba = mOfferedTypes.formats().first().toLatin1(); + qDebug() << "wl_drag_offer_accept" << ba; + wl_drag_offer_accept(offer, time, ba.constData()); + } else { + qDebug() << "wl_drag_offer_reject"; + wl_drag_offer_reject(offer); + } + } + mLastEventPos = pos; +} + +void QWaylandDragOfferWrapper::drop(void *data, struct wl_drag_offer *offer) +{ + QWaylandDragOfferWrapper *self = static_cast(data); + if (!self->mAccepted) { + wl_drag_offer_reject(offer); + return; + } + + QWaylandDrag *mgr = QWaylandDrag::instance(self->mDisplay); + QMimeData *mimeData = QWaylandDrag::instance(self->mDisplay)->platformDropData(); + mimeData->clear(); + if (mgr->mCurrentDrag) { // means this offer is the client's own + QMimeData *localData = mgr->mCurrentDrag->mimeData(); + foreach (const QString &format, localData->formats()) + mimeData->setData(format, localData->data(format)); + QWindow *window = static_cast( + wl_surface_get_user_data(self->mFocusSurface))->window(); + QWindowSystemInterface::handleDrop(window, mimeData, self->mLastEventPos); + // Drag finished with drop (source == target). + QDragManager::self()->stopDrag(); + showDragPixmap(false); + delete mgr->mCurrentOffer; + qDebug() << " *** DRAG OVER WITH DROP, SOURCE == TARGET"; + } else { + // ### TODO + // This is a bit broken: The QMimeData will only contain the data for + // the first type. The Wayland protocol and QDropEvents/QMimeData do not + // match perfectly at the moment. + QString format = self->mOfferedTypes.formats().first(); + QByteArray mimeTypeBa = format.toLatin1(); + int pipefd[2]; + if (pipe(pipefd) == -1) { + qWarning("QWaylandDragOfferWrapper: pipe() failed"); + return; + } + fcntl(pipefd[0], F_SETFL, fcntl(pipefd[0], F_GETFL, 0) | O_NONBLOCK); + wl_drag_offer_receive(offer, pipefd[1]); + mgr->mPipeData.clear(); + mgr->mMimeFormat = format; + mgr->mPipeWriteEnd = pipefd[1]; + mgr->mPipeWatcher = new QSocketNotifier(pipefd[0], QSocketNotifier::Read); + QObject::connect(mgr->mPipeWatcher, SIGNAL(activated(int)), mgr, SLOT(pipeReadable(int))); + } +} + + +void QWaylandDrag::pipeReadable(int fd) +{ + if (mPipeWriteEnd) { + close(mPipeWriteEnd); + mPipeWriteEnd = 0; + } + char buf[256]; + int n; + while ((n = read(fd, &buf, sizeof buf)) > 0 || errno == EINTR) + if (n > 0) + mPipeData.append(buf, n); + if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) + return; + delete mPipeWatcher; + close(fd); + + QMimeData *mimeData = platformDropData(); + mimeData->setData(mMimeFormat, mPipeData); + foreach (const QString &format, mimeData->formats()) + qDebug() << " got type" << format << "with data" << mimeData->data(format); + + QWindow *window = static_cast( + wl_surface_get_user_data(mCurrentOffer->mFocusSurface))->window(); + QWindowSystemInterface::handleDrop(window, mimeData, mCurrentOffer->mLastEventPos); + + // Drag finished on target side with drop. + delete mCurrentOffer; + qDebug() << " *** DRAG OVER ON TARGET WITH DROP"; +} + +void QWaylandDrag::createDragOffer(uint32_t id) +{ + delete mCurrentOffer; + mCurrentOffer = new QWaylandDragOfferWrapper(mDisplay, mDropData, id); +} + +void QWaylandDrag::startDrag() +{ + QDragManager *manager = QDragManager::self(); + + // No need for the traditional desktop-oriented event handling in QDragManager. + manager->unmanageEvents(); + + delete mCurrentDrag; + mCurrentDrag = new QWaylandDragWrapper(mDisplay, manager->dropData()); +} diff --git a/src/plugins/platforms/wayland/qwaylanddnd.h b/src/plugins/platforms/wayland/qwaylanddnd.h new file mode 100644 index 00000000000..ebafd960ec5 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylanddnd.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDDND_H +#define QWAYLANDDND_H + +#include +#include +#include "qwaylanddisplay.h" + +class QWaylandDragWrapper; +class QWaylandDragOfferWrapper; +class QSocketNotifier; + +class QWaylandDrag : public QObject, public QPlatformDrag +{ + Q_OBJECT + +public: + static QWaylandDrag *instance(QWaylandDisplay *display); + ~QWaylandDrag(); + void createDragOffer(uint32_t id); + + QMimeData *platformDropData(); + void startDrag(); + void move(const QMouseEvent *) { } + void drop(const QMouseEvent *) { } + void cancel() { } + +private slots: + void pipeReadable(int fd); + +private: + QWaylandDrag(QWaylandDisplay *display); + + QWaylandDisplay *mDisplay; + QMimeData *mDropData; + QWaylandDragWrapper *mCurrentDrag; + QWaylandDragOfferWrapper *mCurrentOffer; + int mPipeWriteEnd; + QSocketNotifier *mPipeWatcher; + QByteArray mPipeData; + QString mMimeFormat; + friend class QWaylandDragWrapper; + friend class QWaylandDragOfferWrapper; +}; + +#endif // QWAYLANDDND_H diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 3c9afafada9..c1e2325766e 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -113,7 +113,7 @@ void QWaylandInputDevice::inputHandleMotion(void *data, inputDevice->mSurfacePos = QPoint(surface_x, surface_y); inputDevice->mGlobalPos = QPoint(x, y); inputDevice->mTime = time; - QWindowSystemInterface::handleMouseEvent(window->widget(), + QWindowSystemInterface::handleMouseEvent(window->window(), time, inputDevice->mSurfacePos, inputDevice->mGlobalPos, @@ -155,7 +155,7 @@ void QWaylandInputDevice::inputHandleButton(void *data, inputDevice->mButtons &= ~qt_button; inputDevice->mTime = time; - QWindowSystemInterface::handleMouseEvent(window->widget(), + QWindowSystemInterface::handleMouseEvent(window->window(), time, inputDevice->mSurfacePos, inputDevice->mGlobalPos, @@ -272,7 +272,7 @@ void QWaylandInputDevice::inputHandleKey(void *data, sym = translateKey(sym, s, sizeof s); if (window) { - QWindowSystemInterface::handleKeyEvent(window->widget(), + QWindowSystemInterface::handleKeyEvent(window->window(), time, type, sym, inputDevice->mModifiers, QString::fromLatin1(s)); @@ -295,13 +295,13 @@ void QWaylandInputDevice::inputHandlePointerFocus(void *data, if (inputDevice->mPointerFocus) { window = inputDevice->mPointerFocus; - QWindowSystemInterface::handleLeaveEvent(window->widget()); + QWindowSystemInterface::handleLeaveEvent(window->window()); inputDevice->mPointerFocus = NULL; } if (surface) { window = (QWaylandWindow *) wl_surface_get_user_data(surface); - QWindowSystemInterface::handleEnterEvent(window->widget()); + QWindowSystemInterface::handleEnterEvent(window->window()); inputDevice->mPointerFocus = window; } @@ -333,7 +333,7 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data, if (surface) { window = (QWaylandWindow *) wl_surface_get_user_data(surface); inputDevice->mKeyboardFocus = window; - QWindowSystemInterface::handleWindowActivated(window->widget()); + QWindowSystemInterface::handleWindowActivated(window->window()); } else { inputDevice->mKeyboardFocus = NULL; QWindowSystemInterface::handleWindowActivated(0); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.h b/src/plugins/platforms/wayland/qwaylandinputdevice.h index 008ecf144db..05ebe059697 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.h +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.h @@ -63,6 +63,7 @@ public: void attach(QWaylandBuffer *buffer, int x, int y); void handleWindowDestroyed(QWaylandWindow *window); struct wl_input_device *wl_input_device() const { return mInputDevice; } + QWaylandWindow *pointerFocus() const { return mPointerFocus; } private: QWaylandDisplay *mQDisplay; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 5df71dc9360..e17c2f8d952 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -42,30 +42,36 @@ #include "qwaylandintegration.h" #include "qwaylanddisplay.h" -#include "qwaylandshmsurface.h" +#include "qwaylandshmbackingstore.h" #include "qwaylandshmwindow.h" #include "qwaylandnativeinterface.h" #include "qwaylandclipboard.h" +#include "qwaylanddnd.h" -#include "qgenericunixfontdatabase.h" +#include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h" +#include + +#include #include #include -#include +#include +#include -#include #ifdef QT_WAYLAND_GL_SUPPORT #include "gl_integration/qwaylandglintegration.h" -#include "gl_integration/qwaylandglwindowsurface.h" -#include #endif -QWaylandIntegration::QWaylandIntegration(bool useOpenGL) +QWaylandIntegration::QWaylandIntegration() : mFontDb(new QGenericUnixFontDatabase()) - , mDisplay(new QWaylandDisplay()) - , mUseOpenGL(useOpenGL) + , mEventDispatcher(createUnixEventDispatcher()) , mNativeInterface(new QWaylandNativeInterface) { + QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher); + mDisplay = new QWaylandDisplay(); + + foreach (QPlatformScreen *screen, mDisplay->screens()) + screenAdded(screen); } QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const @@ -73,51 +79,50 @@ QPlatformNativeInterface * QWaylandIntegration::nativeInterface() const return mNativeInterface; } -QList -QWaylandIntegration::screens() const -{ - return mDisplay->screens(); -} - bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) const { switch (cap) { case ThreadedPixmaps: return true; - case OpenGL: return hasOpenGL(); + case OpenGL: +#ifdef QT_WAYLAND_GL_SUPPORT + return true; +#else + return false; +#endif + case ThreadedOpenGL: + return hasCapability(OpenGL); default: return QPlatformIntegration::hasCapability(cap); } } -QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) const { #ifdef QT_WAYLAND_GL_SUPPORT - if (mUseOpenGL) - return new QGLPixmapData(type); + if (window->surfaceType() == QWindow::OpenGLSurface) + return mDisplay->eglIntegration()->createEglWindow(window); #endif - return new QRasterPixmapData(type); + return new QWaylandShmWindow(window); } -QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWidget *widget, WId winId) const +QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { - Q_UNUSED(winId); #ifdef QT_WAYLAND_GL_SUPPORT - bool useOpenGL = mUseOpenGL || (widget->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL); - if (useOpenGL) - return mDisplay->eglIntegration()->createEglWindow(widget); + return mDisplay->eglIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle()); +#else + Q_UNUSED(glFormat); + Q_UNUSED(share); + return 0; #endif - return new QWaylandShmWindow(widget); } -QWindowSurface *QWaylandIntegration::createWindowSurface(QWidget *widget, WId winId) const +QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const { - Q_UNUSED(winId); - Q_UNUSED(winId); -#ifdef QT_WAYLAND_GL_SUPPORT - bool useOpenGL = mUseOpenGL || (widget->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL); - if (useOpenGL) - return new QWaylandGLWindowSurface(widget); -#endif - return new QWaylandShmWindowSurface(widget); + return new QWaylandShmBackingStore(window); +} + +QAbstractEventDispatcher *QWaylandIntegration::guiThreadEventDispatcher() const +{ + return mEventDispatcher; } QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const @@ -125,16 +130,12 @@ QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const return mFontDb; } -bool QWaylandIntegration::hasOpenGL() const -{ -#ifdef QT_WAYLAND_GL_SUPPORT - return true; -#else - return false; -#endif -} - QPlatformClipboard *QWaylandIntegration::clipboard() const { return QWaylandClipboard::instance(mDisplay); } + +QPlatformDrag *QWaylandIntegration::drag() const +{ + return QWaylandDrag::instance(mDisplay); +} diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index f617d9697b6..61e8559a7db 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -48,18 +48,19 @@ QT_BEGIN_NAMESPACE class QWaylandBuffer; class QWaylandDisplay; +class QAbstractEventDispatcher; class QWaylandIntegration : public QPlatformIntegration { public: - QWaylandIntegration(bool useOpenGL = false); + QWaylandIntegration(); bool hasCapability(QPlatformIntegration::Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; - QList screens() const; + QAbstractEventDispatcher *guiThreadEventDispatcher() const; QPlatformFontDatabase *fontDatabase() const; @@ -67,12 +68,12 @@ public: QPlatformClipboard *clipboard() const; -private: - bool hasOpenGL() const; + QPlatformDrag *drag() const; +private: QPlatformFontDatabase *mFontDb; + QAbstractEventDispatcher *mEventDispatcher; QWaylandDisplay *mDisplay; - bool mUseOpenGL; QPlatformNativeInterface *mNativeInterface; }; diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp index 17736968c69..d81fa350e96 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.cpp @@ -42,34 +42,33 @@ #include "qwaylandnativeinterface.h" #include "qwaylanddisplay.h" #include "qwaylandwindow.h" +#include +#include #include "windowmanager_integration/qwaylandwindowmanagerintegration.h" -#include -#include - -void *QWaylandNativeInterface::nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget) +void *QWaylandNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) { QByteArray lowerCaseResource = resourceString.toLower(); if (lowerCaseResource == "display") - return qPlatformScreenForWidget(widget)->display()->wl_display(); + return qPlatformScreenForWindow(window)->display()->wl_display(); if (lowerCaseResource == "surface") { - return ((QWaylandWindow *) widget->platformWindow())->wl_surface(); + return ((QWaylandWindow *) window->handle())->wl_surface(); } return NULL; } -QWaylandScreen * QWaylandNativeInterface::qPlatformScreenForWidget(QWidget *widget) +QWaylandScreen * QWaylandNativeInterface::qPlatformScreenForWindow(QWindow *window) { QWaylandScreen *screen; - if (widget) { - screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); + if (window) { + screen = static_cast(window->screen()->handle()); } else { - screen = static_cast(QApplicationPrivate::platformIntegration()->screens()[0]); + screen = static_cast(QGuiApplication::primaryScreen()->handle()); } return screen; } diff --git a/src/plugins/platforms/wayland/qwaylandnativeinterface.h b/src/plugins/platforms/wayland/qwaylandnativeinterface.h index c92b44eb038..9db442a265f 100644 --- a/src/plugins/platforms/wayland/qwaylandnativeinterface.h +++ b/src/plugins/platforms/wayland/qwaylandnativeinterface.h @@ -49,8 +49,8 @@ class QWaylandNativeInterface : public QPlatformNativeInterface { public: - void *nativeResourceForWidget(const QByteArray &resourceString, - QWidget *widget); + void *nativeResourceForWindow(const QByteArray &resourceString, + QWindow *window); QVariantMap windowProperties(QPlatformWindow *window) const; QVariant windowProperty(QPlatformWindow *window, const QString &name) const; @@ -58,7 +58,7 @@ public: void setWindowProperty(QPlatformWindow *window, const QString &name, const QVariant &value); private: - static QWaylandScreen *qPlatformScreenForWidget(QWidget *widget); + static QWaylandScreen *qPlatformScreenForWindow(QWindow *window); private: QHash m_windowProperties; diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index be6dcb2e88d..7b064bac400 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -53,7 +53,6 @@ QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, struct wl_output , mFormat(QImage::Format_ARGB32_Premultiplied) , mWaylandCursor(new QWaylandCursor(this)) { - moveToThread(waylandDisplay->thread()); } QWaylandScreen::~QWaylandScreen() @@ -81,9 +80,9 @@ QImage::Format QWaylandScreen::format() const return mFormat; } -QWaylandScreen * QWaylandScreen::waylandScreenFromWidget(QWidget *widget) +QWaylandScreen * QWaylandScreen::waylandScreenFromWindow(QWindow *window) { - QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWidget(widget); + QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(window); return static_cast(platformScreen); } diff --git a/src/plugins/platforms/wayland/qwaylandscreen.h b/src/plugins/platforms/wayland/qwaylandscreen.h index f2b3bcefbc6..9bf4f6574a4 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.h +++ b/src/plugins/platforms/wayland/qwaylandscreen.h @@ -62,7 +62,7 @@ public: wl_visual *visual() const; - static QWaylandScreen *waylandScreenFromWidget(QWidget *widget); + static QWaylandScreen *waylandScreenFromWindow(QWindow *window); private: QWaylandDisplay *mWaylandDisplay; diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp similarity index 84% rename from src/plugins/platforms/wayland/qwaylandshmsurface.cpp rename to src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index b24c419424a..25a1b466d46 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -38,10 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qwaylandshmsurface.h" +#include "qwaylandshmbackingstore.h" #include -#include #include "qwaylanddisplay.h" #include "qwaylandshmwindow.h" @@ -91,34 +90,34 @@ QWaylandShmBuffer::~QWaylandShmBuffer(void) wl_buffer_destroy(mBuffer); } -QWaylandShmWindowSurface::QWaylandShmWindowSurface(QWidget *window) - : QWindowSurface(window) +QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window) + : QPlatformBackingStore(window) , mBuffer(0) - , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display()) + , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display()) { } -QWaylandShmWindowSurface::~QWaylandShmWindowSurface() +QWaylandShmBackingStore::~QWaylandShmBackingStore() { } -QPaintDevice *QWaylandShmWindowSurface::paintDevice() +QPaintDevice *QWaylandShmBackingStore::paintDevice() { return mBuffer->image(); } -void QWaylandShmWindowSurface::beginPaint(const QRegion &) +void QWaylandShmBackingStore::beginPaint(const QRegion &) { - QWaylandShmWindow *waylandWindow = static_cast(window()->platformWindow()); + QWaylandShmWindow *waylandWindow = static_cast(window()->handle()); Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); waylandWindow->waitForFrameSync(); } -void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QWaylandShmBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { - Q_UNUSED(widget); + Q_UNUSED(window); Q_UNUSED(offset); - QWaylandShmWindow *waylandWindow = static_cast(window()->platformWindow()); + QWaylandShmWindow *waylandWindow = static_cast(window->handle()); Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); QVector rects = region.rects(); for (int i = 0; i < rects.size(); i++) { @@ -128,13 +127,12 @@ void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion ®ion, con } } -void QWaylandShmWindowSurface::resize(const QSize &size) +void QWaylandShmBackingStore::resize(const QSize &size, const QRegion &) { - QWaylandShmWindow *waylandWindow = static_cast(window()->platformWindow()); + QWaylandShmWindow *waylandWindow = static_cast(window()->handle()); Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); - QWindowSurface::resize(size); - QImage::Format format = QPlatformScreen::platformScreenForWidget(window())->format(); + QImage::Format format = QPlatformScreen::platformScreenForWindow(window())->format(); if (mBuffer != NULL && mBuffer->size() == size) return; diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.h b/src/plugins/platforms/wayland/qwaylandshmbackingstore.h similarity index 85% rename from src/plugins/platforms/wayland/qwaylandshmsurface.h rename to src/plugins/platforms/wayland/qwaylandshmbackingstore.h index f3db8b86e5e..5e6959dc2fd 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.h +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.h @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#ifndef QWINDOWSURFACE_WAYLAND_H -#define QWINDOWSURFACE_WAYLAND_H +#ifndef QWAYLANDSHMBACKINGSTORE_H +#define QWAYLANDSHMBACKINGSTORE_H #include "qwaylandbuffer.h" -#include - +#include +#include #include QT_BEGIN_NAMESPACE @@ -62,15 +62,15 @@ private: QImage mImage; }; -class QWaylandShmWindowSurface : public QWindowSurface +class QWaylandShmBackingStore : public QPlatformBackingStore { public: - QWaylandShmWindowSurface(QWidget *window); - ~QWaylandShmWindowSurface(); + QWaylandShmBackingStore(QWindow *window); + ~QWaylandShmBackingStore(); QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size, const QRegion &staticContents); void beginPaint(const QRegion &); private: diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp index a6b7050f7aa..ba5e46cab1f 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -47,8 +47,8 @@ #include -QWaylandShmWindow::QWaylandShmWindow(QWidget *widget) - : QWaylandWindow(widget) +QWaylandShmWindow::QWaylandShmWindow(QWindow *window) + : QWaylandWindow(window) { newSurfaceCreated(); } @@ -63,9 +63,3 @@ QWaylandWindow::WindowType QWaylandShmWindow::windowType() const return QWaylandWindow::Shm; } -QPlatformGLContext * QWaylandShmWindow::glContext() const -{ - qWarning("Trying to retrieve a glContext from a Raster window surface!"); - return 0; -} - diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.h b/src/plugins/platforms/wayland/qwaylandshmwindow.h index 80337033916..36f9f225b7d 100644 --- a/src/plugins/platforms/wayland/qwaylandshmwindow.h +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.h @@ -48,11 +48,11 @@ class QWaylandShmWindow : public QWaylandWindow { public: - QWaylandShmWindow(QWidget *widget); + QWaylandShmWindow(QWindow *window); ~QWaylandShmWindow(); WindowType windowType() const; - QPlatformGLContext *glContext() const; + QSurfaceFormat format() const { return QSurfaceFormat(); } }; #endif // QWAYLANDSHMWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 099ebabb06b..60116210446 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -46,20 +46,21 @@ #include "qwaylandinputdevice.h" #include "qwaylandscreen.h" +#include + #ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT #include "windowmanager_integration/qwaylandwindowmanagerintegration.h" #endif #include -#include #include #include -QWaylandWindow::QWaylandWindow(QWidget *window) +QWaylandWindow::QWaylandWindow(QWindow *window) : QPlatformWindow(window) , mSurface(0) - , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display()) + , mDisplay(QWaylandScreen::waylandScreenFromWindow(window)->display()) , mBuffer(0) , mWaitingForFrameSync(false) { @@ -112,11 +113,11 @@ void QWaylandWindow::configure(uint32_t time, uint32_t edges, { Q_UNUSED(time); Q_UNUSED(edges); - QRect geometry = QRect(x, y, width, height); + QRect geometry = QRect(x, y, width, height); setGeometry(geometry); - QWindowSystemInterface::handleGeometryChange(widget(), geometry); + QWindowSystemInterface::handleGeometryChange(window(), geometry); } void QWaylandWindow::attach(QWaylandBuffer *buffer) @@ -124,6 +125,7 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer) mBuffer = buffer; if (mSurface) { wl_surface_attach(mSurface, buffer->buffer(),0,0); + QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRect(QPoint(), geometry().size())); } } diff --git a/src/plugins/platforms/wayland/qwaylandwindow.h b/src/plugins/platforms/wayland/qwaylandwindow.h index b91f6b6eb8d..4f1e2c8183a 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.h +++ b/src/plugins/platforms/wayland/qwaylandwindow.h @@ -59,7 +59,7 @@ public: Egl }; - QWaylandWindow(QWidget *window); + QWaylandWindow(QWindow *window); ~QWaylandWindow(); virtual WindowType windowType() const = 0; diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 1e0bbe6cdde..fd6ffc06dea 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -1,19 +1,23 @@ TARGET = qwayland load(qt_plugin) -QT+=gui-private core-private opengl-private +CONFIG += qpa/genericunixfontdatabase DESTDIR = $$QT.gui.plugins/platforms DEFINES += Q_PLATFORM_WAYLAND DEFINES += $$QMAKE_DEFINES_WAYLAND -QT += core-private gui-private opengl-private +mac { + DEFINES += QT_NO_WAYLAND_XKB +} + +QT += core-private gui-private opengl-private platformsupport-private SOURCES = main.cpp \ qwaylandintegration.cpp \ qwaylandnativeinterface.cpp \ - qwaylandshmsurface.cpp \ + qwaylandshmbackingstore.cpp \ qwaylandinputdevice.cpp \ qwaylandcursor.cpp \ qwaylanddisplay.cpp \ @@ -21,6 +25,7 @@ SOURCES = main.cpp \ qwaylandscreen.cpp \ qwaylandshmwindow.cpp \ qwaylandclipboard.cpp \ + qwaylanddnd.cpp \ qwaylandmime.cpp HEADERS = qwaylandintegration.h \ @@ -29,23 +34,23 @@ HEADERS = qwaylandintegration.h \ qwaylanddisplay.h \ qwaylandwindow.h \ qwaylandscreen.h \ - qwaylandshmsurface.h \ + qwaylandshmbackingstore.h \ qwaylandbuffer.h \ qwaylandshmwindow.h \ qwaylandclipboard.h \ + qwaylanddnd.h \ qwaylandmime.h INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND LIBS += $$QMAKE_LIBS_WAYLAND +mac { + LIBS += -lwayland-client +} + QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND -INCLUDEPATH += $$PWD - -include ($$PWD/gl_integration/gl_integration.pri) -include ($$PWD/windowmanager_integration/windowmanager_integration.pri) - -include (../fontdatabases/genericunix/genericunix.pri) - target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target +include ($$PWD/gl_integration/gl_integration.pri) +include ($$PWD/windowmanager_integration/windowmanager_integration.pri) diff --git a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp index 798900bbced..7d68571c24b 100644 --- a/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp +++ b/src/plugins/platforms/wayland/windowmanager_integration/qwaylandwindowmanagerintegration.cpp @@ -49,8 +49,7 @@ #include #include #include -#include -#include +#include #include @@ -237,15 +236,15 @@ void QWaylandWindowManagerIntegration::wlHandleWindowPropertyChange(void *data, QPlatformNativeInterface *nativeInterface = qApp->platformNativeInterface(); QWaylandWindowManagerIntegration *inst = QWaylandWindowManagerIntegration::instance(); - QWidgetList widgets = qApp->topLevelWidgets(); - foreach (QWidget *widget, widgets) { - QPlatformWindow *platformWindowForWidget = widget->platformWindow(); - if (!platformWindowForWidget) + QList windows = qApp->topLevelWindows(); + foreach (QWindow *window, windows) { + QPlatformWindow *platformWindowForWindow = window->handle(); + if (!platformWindowForWindow) continue; - QWaylandWindow *window = static_cast(platformWindowForWidget); - wl_surface *windowSurface = (wl_surface*)nativeInterface->nativeResourceForWidget(QByteArray("surface"), widget); + QWaylandWindow *waylandWindow = static_cast(platformWindowForWindow); + wl_surface *windowSurface = (wl_surface*)nativeInterface->nativeResourceForWindow(QByteArray("surface"), window); if (windowSurface == surface) { - inst->handleWindowPropertyChange(window, QString(propertyName), variantValue); + inst->handleWindowPropertyChange(waylandWindow, QString(propertyName), variantValue); break; } } diff --git a/src/plugins/platforms/windows/array.h b/src/plugins/platforms/windows/array.h new file mode 100644 index 00000000000..216f1e89452 --- /dev/null +++ b/src/plugins/platforms/windows/array.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ARRAY_H +#define ARRAY_H + +#include + +QT_BEGIN_NAMESPACE + +/* A simple, non-shared array. */ + +template +class Array +{ + Q_DISABLE_COPY(Array) +public: + enum { initialSize = 5 }; + + typedef T* const_iterator; + + explicit Array(size_t size= 0) : data(0), m_capacity(0), m_size(0) + { if (size) resize(size); } + ~Array() { delete [] data; } + + T *data; + inline size_t size() const { return m_size; } + inline const_iterator begin() const { return data; } + inline const_iterator end() const { return data + m_size; } + + inline void append(const T &value) + { + const size_t oldSize = m_size; + resize(m_size + 1); + data[oldSize] = value; + } + + inline void resize(size_t size) + { + if (size > m_size) + reserve(size > 1 ? size + size / 2 : size_t(initialSize)); + m_size = size; + } + + void reserve(size_t capacity) + { + if (capacity > m_capacity) { + const T *oldData = data; + data = new T[capacity]; + if (oldData) { + qCopy(oldData, oldData + m_size, data); + delete [] oldData; + } + m_capacity = capacity; + } + } + +private: + size_t m_capacity; + size_t m_size; +}; + +QT_END_NAMESPACE + +#endif // ARRAY_H diff --git a/src/plugins/decorations/default/main.cpp b/src/plugins/platforms/windows/main.cpp similarity index 52% rename from src/plugins/decorations/default/main.cpp rename to src/plugins/platforms/windows/main.cpp index b93b6f8b0e2..933aa76df84 100644 --- a/src/plugins/decorations/default/main.cpp +++ b/src/plugins/platforms/windows/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. ** @@ -39,38 +39,74 @@ ** ****************************************************************************/ -#include -#include + +#include +#include + +#include "qwindowsintegration.h" QT_BEGIN_NAMESPACE -class DecorationDefault : public QDecorationPlugin +/*! + \group qt-lighthouse-win + \title Qt Lighthouse plugin for Windows + + \brief Class documentation of the Qt Lighthouse plugin for Windows. + + \section1 Tips + + \list + \o The environment variable \c QT_LIGHTHOUSE_WINDOWS_VERBOSE controls + the debug level. It takes the form + \c{:,:}, where + keyword is one of \c integration, \c windows, \c backingstore and + \c fonts. Level is an integer 0..9. + \endlist + */ + +/*! + \class QWindowsIntegrationPlugin + \brief Plugin. + \ingroup qt-lighthouse-win + */ + +/*! + \namespace QtWindows + + \brief Namespace for enumerations, etc. + \ingroup qt-lighthouse-win +*/ + +/*! + \enum QtWindows::WindowsEventType + + \brief Enumerations for WM_XX events. + + With flags that should help to structure the code. + + \ingroup qt-lighthouse-win +*/ + +class QWindowsIntegrationPlugin : public QPlatformIntegrationPlugin { public: - DecorationDefault(); - QStringList keys() const; - QDecoration *create(const QString&); + QPlatformIntegration *create(const QString&, const QStringList&); }; -DecorationDefault::DecorationDefault() - : QDecorationPlugin() +QStringList QWindowsIntegrationPlugin::keys() const { + return QStringList(QStringLiteral("windows")); } -QStringList DecorationDefault::keys() const +QPlatformIntegration *QWindowsIntegrationPlugin::create(const QString& system, const QStringList& paramList) { - return (QStringList() << QLatin1String("Default")); -} - -QDecoration* DecorationDefault::create(const QString& s) -{ - if (s.toLower() == QLatin1String("default")) - return new QDecorationDefault(); - + Q_UNUSED(paramList); + if (system.compare(system, QStringLiteral("windows"), Qt::CaseInsensitive) == 0) + return new QWindowsIntegration; return 0; } -Q_EXPORT_PLUGIN2(qdecorationdefault, DecorationDefault) +Q_EXPORT_PLUGIN2(windows, QWindowsIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/pixmaputils.cpp b/src/plugins/platforms/windows/pixmaputils.cpp new file mode 100644 index 00000000000..111df5a4b9b --- /dev/null +++ b/src/plugins/platforms/windows/pixmaputils.cpp @@ -0,0 +1,316 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "pixmaputils.h" + +#include +#include +#include +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +HBITMAP createIconMask(const QBitmap &bitmap) +{ + QImage bm = bitmap.toImage().convertToFormat(QImage::Format_Mono); + const int w = bm.width(); + const int h = bm.height(); + const int bpl = ((w+15)/16)*2; // bpl, 16 bit alignment + QScopedArrayPointer bits(new uchar[bpl * h]); + bm.invertPixels(); + for (int y = 0; y < h; ++y) + memcpy(bits.data() + y * bpl, bm.scanLine(y), bpl); + HBITMAP hbm = CreateBitmap(w, h, 1, 1, bits.data()); + return hbm; +} + +HBITMAP qPixmapToWinHBITMAP(const QPixmap &p, HBitmapFormat format) +{ + if (p.isNull()) + return 0; + + HBITMAP bitmap = 0; + if (p.handle()->classId() != QPlatformPixmap::RasterClass) { + QRasterPlatformPixmap *data = new QRasterPlatformPixmap(p.depth() == 1 ? + QRasterPlatformPixmap::BitmapType : QRasterPlatformPixmap::PixmapType); + data->fromImage(p.toImage(), Qt::AutoColor); + return qPixmapToWinHBITMAP(QPixmap(data), format); + } + + QRasterPlatformPixmap *d = static_cast(p.handle()); + const QImage *rasterImage = d->buffer(); + const int w = rasterImage->width(); + const int h = rasterImage->height(); + + HDC display_dc = GetDC(0); + + // Define the header + BITMAPINFO bmi; + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = w; + bmi.bmiHeader.biHeight = -h; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 32; + bmi.bmiHeader.biCompression = BI_RGB; + bmi.bmiHeader.biSizeImage = w * h * 4; + + // Create the pixmap + uchar *pixels = 0; + bitmap = CreateDIBSection(display_dc, &bmi, DIB_RGB_COLORS, (void **) &pixels, 0, 0); + ReleaseDC(0, display_dc); + if (!bitmap) { + qErrnoWarning("%s, failed to create dibsection", __FUNCTION__); + return 0; + } + if (!pixels) { + qErrnoWarning("%s, did not allocate pixel data", __FUNCTION__); + return 0; + } + + // Copy over the data + QImage::Format imageFormat = QImage::Format_ARGB32; + if (format == HBitmapAlpha) + imageFormat = QImage::Format_RGB32; + else if (format == HBitmapPremultipliedAlpha) + imageFormat = QImage::Format_ARGB32_Premultiplied; + const QImage image = rasterImage->convertToFormat(imageFormat); + const int bytes_per_line = w * 4; + for (int y=0; y < h; ++y) + memcpy(pixels + y * bytes_per_line, image.scanLine(y), bytes_per_line); + + return bitmap; +} + +QPixmap qPixmapFromWinHBITMAP(HBITMAP bitmap, HBitmapFormat format) +{ + // Verify size + BITMAP bitmap_info; + memset(&bitmap_info, 0, sizeof(BITMAP)); + + const int res = GetObject(bitmap, sizeof(BITMAP), &bitmap_info); + if (!res) { + qErrnoWarning("QPixmap::fromWinHBITMAP(), failed to get bitmap info"); + return QPixmap(); + } + const int w = bitmap_info.bmWidth; + const int h = bitmap_info.bmHeight; + + BITMAPINFO bmi; + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = w; + bmi.bmiHeader.biHeight = -h; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 32; + bmi.bmiHeader.biCompression = BI_RGB; + bmi.bmiHeader.biSizeImage = w * h * 4; + + // Get bitmap bits + QScopedArrayPointer data(new uchar[bmi.bmiHeader.biSizeImage]); + HDC display_dc = GetDC(0); + if (!GetDIBits(display_dc, bitmap, 0, h, data.data(), &bmi, DIB_RGB_COLORS)) { + ReleaseDC(0, display_dc); + qWarning("%s, failed to get bitmap bits", __FUNCTION__); + return QPixmap(); + } + + QImage::Format imageFormat = QImage::Format_ARGB32_Premultiplied; + uint mask = 0; + if (format == HBitmapNoAlpha) { + imageFormat = QImage::Format_RGB32; + mask = 0xff000000; + } + + // Create image and copy data into image. + QImage image(w, h, imageFormat); + if (image.isNull()) { // failed to alloc? + ReleaseDC(0, display_dc); + qWarning("%s, failed create image of %dx%d", __FUNCTION__, w, h); + return QPixmap(); + } + const int bytes_per_line = w * sizeof(QRgb); + for (int y = 0; y < h; ++y) { + QRgb *dest = (QRgb *) image.scanLine(y); + const QRgb *src = (const QRgb *) (data.data() + y * bytes_per_line); + for (int x = 0; x < w; ++x) { + const uint pixel = src[x]; + if ((pixel & 0xff000000) == 0 && (pixel & 0x00ffffff) != 0) + dest[x] = pixel | 0xff000000; + else + dest[x] = pixel | mask; + } + } + ReleaseDC(0, display_dc); + return QPixmap::fromImage(image); +} + +HICON qPixmapToWinHICON(const QPixmap &p) +{ + QBitmap maskBitmap = p.mask(); + if (maskBitmap.isNull()) { + maskBitmap = QBitmap(p.size()); + maskBitmap.fill(Qt::color1); + } + + ICONINFO ii; + ii.fIcon = true; + ii.hbmMask = createIconMask(maskBitmap); + ii.hbmColor = qPixmapToWinHBITMAP(p, HBitmapAlpha); + ii.xHotspot = 0; + ii.yHotspot = 0; + + HICON hIcon = CreateIconIndirect(&ii); + + DeleteObject(ii.hbmColor); + DeleteObject(ii.hbmMask); + + return hIcon; +} + +static QImage qImageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h) +{ + BITMAPINFO bmi; + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = w; + bmi.bmiHeader.biHeight = -h; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 32; + bmi.bmiHeader.biCompression = BI_RGB; + bmi.bmiHeader.biSizeImage = w * h * 4; + + QImage image(w, h, QImage::Format_ARGB32_Premultiplied); + if (image.isNull()) + return image; + + // Get bitmap bits + QScopedPointer data(new uchar [bmi.bmiHeader.biSizeImage]); + if (!GetDIBits(hdc, bitmap, 0, h, data.data(), &bmi, DIB_RGB_COLORS)) { + qErrnoWarning("%s: failed to get bitmap bits", __FUNCTION__); + return QImage(); + } + // Create image and copy data into image. + for (int y = 0; y < h; ++y) { + void *dest = (void *) image.scanLine(y); + void *src = data.data() + y * image.bytesPerLine(); + memcpy(dest, src, image.bytesPerLine()); + } + return image; +} + +QPixmap qPixmapFromWinHICON(HICON icon) +{ + bool foundAlpha = false; + HDC screenDevice = GetDC(0); + HDC hdc = CreateCompatibleDC(screenDevice); + ReleaseDC(0, screenDevice); + + ICONINFO iconinfo; + const bool result = GetIconInfo(icon, &iconinfo); //x and y Hotspot describes the icon center + if (!result) { + qErrnoWarning("QPixmap::fromWinHICON(), failed to GetIconInfo()"); + return QPixmap(); + } + + const int w = iconinfo.xHotspot * 2; + const int h = iconinfo.yHotspot * 2; + + BITMAPINFOHEADER bitmapInfo; + bitmapInfo.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.biWidth = w; + bitmapInfo.biHeight = h; + bitmapInfo.biPlanes = 1; + bitmapInfo.biBitCount = 32; + bitmapInfo.biCompression = BI_RGB; + bitmapInfo.biSizeImage = 0; + bitmapInfo.biXPelsPerMeter = 0; + bitmapInfo.biYPelsPerMeter = 0; + bitmapInfo.biClrUsed = 0; + bitmapInfo.biClrImportant = 0; + DWORD* bits; + + HBITMAP winBitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bitmapInfo, DIB_RGB_COLORS, (VOID**)&bits, NULL, 0); + HGDIOBJ oldhdc = (HBITMAP)SelectObject(hdc, winBitmap); + DrawIconEx( hdc, 0, 0, icon, iconinfo.xHotspot * 2, iconinfo.yHotspot * 2, 0, 0, DI_NORMAL); + QImage image = qImageFromWinHBITMAP(hdc, winBitmap, w, h); + + for (int y = 0 ; y < h && !foundAlpha ; y++) { + const QRgb *scanLine= reinterpret_cast(image.scanLine(y)); + for (int x = 0; x < w ; x++) { + if (qAlpha(scanLine[x]) != 0) { + foundAlpha = true; + break; + } + } + } + if (!foundAlpha) { + //If no alpha was found, we use the mask to set alpha values + DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_MASK); + const QImage mask = qImageFromWinHBITMAP(hdc, winBitmap, w, h); + + for (int y = 0 ; y < h ; y++){ + QRgb *scanlineImage = reinterpret_cast(image.scanLine(y)); + const QRgb *scanlineMask = mask.isNull() ? 0 : reinterpret_cast(mask.scanLine(y)); + for (int x = 0; x < w ; x++){ + if (scanlineMask && qRed(scanlineMask[x]) != 0) + scanlineImage[x] = 0; //mask out this pixel + else + scanlineImage[x] |= 0xff000000; // set the alpha channel to 255 + } + } + } + //dispose resources created by iconinfo call + DeleteObject(iconinfo.hbmMask); + DeleteObject(iconinfo.hbmColor); + + SelectObject(hdc, oldhdc); //restore state + DeleteObject(winBitmap); + DeleteDC(hdc); + return QPixmap::fromImage(image); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/pixmaputils.h b/src/plugins/platforms/windows/pixmaputils.h new file mode 100644 index 00000000000..bf94a2695cc --- /dev/null +++ b/src/plugins/platforms/windows/pixmaputils.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PIXMAPUTILS_H +#define PIXMAPUTILS_H + +#include "qtwindows_additional.h" + +#include + +QT_BEGIN_NAMESPACE + +class QBitmap; +class QPixmap; + +enum HBitmapFormat +{ + HBitmapNoAlpha, + HBitmapPremultipliedAlpha, + HBitmapAlpha +}; + +HBITMAP createIconMask(const QBitmap &bitmap); + +HBITMAP qPixmapToWinHBITMAP(const QPixmap &p, HBitmapFormat format); +HICON qPixmapToWinHICON(const QPixmap &p); + +QPixmap qPixmapFromWinHBITMAP(HBITMAP bitmap, HBitmapFormat format); +QPixmap qPixmapFromWinHICON(HICON icon); + +QT_END_NAMESPACE + +#endif // PIXMAPUTILS_H diff --git a/src/plugins/platforms/windows/qtwindows_additional.h b/src/plugins/platforms/windows/qtwindows_additional.h new file mode 100644 index 00000000000..e262159b7b8 --- /dev/null +++ b/src/plugins/platforms/windows/qtwindows_additional.h @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTWINDOWS_ADDITIONAL_H +#define QTWINDOWS_ADDITIONAL_H + +#include // get compiler define +#include + +/* Complement the definitions and declarations missing + * when using MinGW or older Windows SDKs. */ + +#if defined(Q_CC_MINGW) +# if !defined(ULW_ALPHA) +# define ULW_ALPHA 0x00000002 +# define LWA_ALPHA 0x00000002 +# endif // !defined(ULW_ALPHA) +# define SPI_GETFONTSMOOTHINGTYPE 0x200A +# define FE_FONTSMOOTHINGCLEARTYPE 0x0002 +# define CLEARTYPE_QUALITY 5 + +# define CF_DIBV5 17 + +#define CO_E_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x80004021L) + +typedef struct tagUPDATELAYEREDWINDOWINFO { + DWORD cbSize; + HDC hdcDst; + const POINT *pptDst; + const SIZE *psize; + HDC hdcSrc; + const POINT *pptSrc; + COLORREF crKey; + const BLENDFUNCTION *pblend; + DWORD dwFlags; + const RECT *prcDirty; +} UPDATELAYEREDWINDOWINFO, *PUPDATELAYEREDWINDOWINFO; + +// OpenGL Pixelformat flags. +#define PFD_SUPPORT_DIRECTDRAW 0x00002000 +#define PFD_DIRECT3D_ACCELERATED 0x00004000 +#define PFD_SUPPORT_COMPOSITION 0x00008000 + +// IME. +#define IMR_CONFIRMRECONVERTSTRING 0x0005 + +#endif // if defined(Q_CC_MINGW) + +/* Touch is supported from Windows 7 onwards and data structures + * are present in the Windows SDK's, but not in older MSVC Express + * versions. */ + +#if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE) + +#define WM_TOUCH 0x0240 + +typedef struct tagTOUCHINPUT { + LONG x; + LONG y; + HANDLE hSource; + DWORD dwID; + DWORD dwFlags; + DWORD dwMask; + DWORD dwTime; + ULONG_PTR dwExtraInfo; + DWORD cxContact; + DWORD cyContact; +} TOUCHINPUT, *PTOUCHINPUT; +typedef TOUCHINPUT const * PCTOUCHINPUT; + +# define TOUCHEVENTF_MOVE 0x0001 +# define TOUCHEVENTF_DOWN 0x0002 +# define TOUCHEVENTF_UP 0x0004 +# define TOUCHEVENTF_INRANGE 0x0008 +# define TOUCHEVENTF_PRIMARY 0x0010 +# define TOUCHEVENTF_NOCOALESCE 0x0020 +# define TOUCHEVENTF_PALM 0x0080 +# define TOUCHINPUTMASKF_CONTACTAREA 0x0004 +# define TOUCHINPUTMASKF_EXTRAINFO 0x0002 + +#endif // if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE) + +#endif // QTWINDOWS_ADDITIONAL_H diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h new file mode 100644 index 00000000000..692489dfc66 --- /dev/null +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -0,0 +1,182 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTWINDOWSGLOBAL_H +#define QTWINDOWSGLOBAL_H + +#include "qtwindows_additional.h" +#include + +QT_BEGIN_NAMESPACE + +namespace QtWindows +{ + +enum +{ + WindowEventFlag = 0x10000, + MouseEventFlag = 0x20000, + NonClientEventFlag = 0x40000, + InputMethodEventFlag = 0x80000, + KeyEventFlag = 0x100000, + KeyDownEventFlag = 0x200000, + TouchEventFlag = 0x400000, + ClipboardEventFlag = 0x800000, + ApplicationEventFlag = 0x1000000 +}; + +enum WindowsEventType // Simplify event types +{ + ExposeEvent = WindowEventFlag + 1, + ActivateWindowEvent = WindowEventFlag + 2, + DeactivateWindowEvent = WindowEventFlag + 3, + LeaveEvent = WindowEventFlag + 5, + CloseEvent = WindowEventFlag + 6, + ShowEvent = WindowEventFlag + 7, + HideEvent = WindowEventFlag + 8, + DestroyEvent = WindowEventFlag + 9, + MoveEvent = WindowEventFlag + 10, + ResizeEvent = WindowEventFlag + 12, + QuerySizeHints = WindowEventFlag + 15, + CalculateSize = WindowEventFlag + 16, + MouseEvent = MouseEventFlag + 1, + MouseWheelEvent = MouseEventFlag + 2, + TouchEvent = TouchEventFlag + 1, + NonClientMouseEvent = NonClientEventFlag + MouseEventFlag + 1, + KeyEvent = KeyEventFlag + 1, + KeyDownEvent = KeyEventFlag + KeyDownEventFlag + 1, + InputMethodKeyEvent = InputMethodEventFlag + KeyEventFlag + 1, + InputMethodKeyDownEvent = InputMethodEventFlag + KeyEventFlag + KeyDownEventFlag + 1, + ClipboardEvent = ClipboardEventFlag + 1, + ActivateApplicationEvent = ApplicationEventFlag + 1, + DeactivateApplicationEvent = ApplicationEventFlag + 2, + InputMethodStartCompositionEvent = InputMethodEventFlag + 1, + InputMethodCompositionEvent = InputMethodEventFlag + 2, + InputMethodEndCompositionEvent = InputMethodEventFlag + 3, + InputMethodOpenCandidateWindowEvent = InputMethodEventFlag + 4, + InputMethodCloseCandidateWindowEvent = InputMethodEventFlag + 5, + InputMethodRequest = InputMethodEventFlag + 6, + UnknownEvent = 542 +}; + +} // namespace QtWindows + +inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamIn) +{ + switch (message) { + case WM_PAINT: + case WM_ERASEBKGND: + return QtWindows::ExposeEvent; + case WM_CLOSE: + return QtWindows::CloseEvent; + case WM_DESTROY: + return QtWindows::DestroyEvent; + case WM_ACTIVATEAPP: + return (int)wParamIn ? + QtWindows::ActivateApplicationEvent : QtWindows::DeactivateApplicationEvent; + case WM_ACTIVATE: + return LOWORD(wParamIn) == WA_INACTIVE ? + QtWindows::DeactivateWindowEvent : QtWindows::ActivateWindowEvent; + case WM_MOUSELEAVE: + return QtWindows::MouseEvent; + case WM_MOUSEWHEEL: + case WM_MOUSEHWHEEL: + return QtWindows::MouseWheelEvent; + case WM_MOVE: + return QtWindows::MoveEvent; + case WM_SHOWWINDOW: + return wParamIn ? QtWindows::ShowEvent : QtWindows::HideEvent; + case WM_SIZE: + return QtWindows::ResizeEvent; + case WM_NCCALCSIZE: + return QtWindows::CalculateSize; + case WM_GETMINMAXINFO: + return QtWindows::QuerySizeHints; + case WM_KEYDOWN: // keyboard event + case WM_SYSKEYDOWN: + return QtWindows::KeyDownEvent; + case WM_KEYUP: + case WM_SYSKEYUP: + case WM_CHAR: + return QtWindows::KeyEvent; + case WM_IME_CHAR: + return QtWindows::InputMethodKeyEvent; + case WM_IME_KEYDOWN: + return QtWindows::InputMethodKeyDownEvent; + case WM_TOUCH: + return QtWindows::TouchEvent; + case WM_CHANGECBCHAIN: + case WM_DRAWCLIPBOARD: + case WM_RENDERFORMAT: + case WM_RENDERALLFORMATS: + case WM_DESTROYCLIPBOARD: + return QtWindows::ClipboardEvent; + case WM_IME_STARTCOMPOSITION: + return QtWindows::InputMethodStartCompositionEvent; + case WM_IME_ENDCOMPOSITION: + return QtWindows::InputMethodEndCompositionEvent; + case WM_IME_COMPOSITION: + return QtWindows::InputMethodCompositionEvent; + case WM_IME_REQUEST: + return QtWindows::InputMethodRequest; + case WM_IME_NOTIFY: + switch (int(wParamIn)) { + case IMN_OPENCANDIDATE: + return QtWindows::InputMethodOpenCandidateWindowEvent; + case IMN_CLOSECANDIDATE: + return QtWindows::InputMethodCloseCandidateWindowEvent; + default: + break; + } + default: + break; + } + if (message >= WM_NCMOUSEMOVE && message <= WM_NCMBUTTONDBLCLK) + return QtWindows::NonClientMouseEvent; // + if ((message >= WM_MOUSEFIRST && message <= WM_MOUSELAST) + || (message >= WM_XBUTTONDOWN && message <= WM_XBUTTONDBLCLK)) + return QtWindows::MouseEvent; + return QtWindows::UnknownEvent; +} + +QT_END_NAMESPACE + +#endif // QTWINDOWSGLOBAL_H diff --git a/src/plugins/platforms/windows/qwindows.qdocconf b/src/plugins/platforms/windows/qwindows.qdocconf new file mode 100644 index 00000000000..c5a1ee904aa --- /dev/null +++ b/src/plugins/platforms/windows/qwindows.qdocconf @@ -0,0 +1,27 @@ +project = "Qt Windows Lighthouse Plugin" +description = "Documentation of the Qt Windows Lighthouse Plugin" + +language = Cpp + +headerdirs = . + +sourcedirs = . + +showinternal = true + +headers.fileextensions = "*.h" +sources.fileextensions = "*.cpp *.qdoc" + +outputdir = doc + +qhp.projects = QtLighthouseWindows +qhp.QtLighthouseWindowsDev.file = qtlighthousewindows-dev.qhp +qhp.QtLighthouseWindowsDev.namespace = com.nokia.qt.developer.lighthouse +qhp.QtLighthouseWindowsDev.virtualFolder = doc +qhp.QtLighthouseWindowsDev.indexTitle = Qt Windows Lighthouse Plugin +qhp.QtLighthouseWindowsDev.indexRoot = + +# Doxygen compatibility commands + +macro.see = "\\sa" +macro.function = "\\fn" diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp new file mode 100644 index 00000000000..a3698c4a7c6 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsbackingstore.h" +#include "qwindowswindow.h" +#include "qwindowsnativeimage.h" +#include "qwindowscontext.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QWindowsBackingStore + \brief Backing store for windows. + \ingroup qt-lighthouse-win +*/ + +QWindowsBackingStore::QWindowsBackingStore(QWindow *window) : + QPlatformBackingStore(window) +{ + if (QWindowsContext::verboseBackingStore) + qDebug() << __FUNCTION__ << this << window; +} + +QWindowsBackingStore::~QWindowsBackingStore() +{ + if (QWindowsContext::verboseBackingStore) + qDebug() << __FUNCTION__ << this; +} + +QPaintDevice *QWindowsBackingStore::paintDevice() +{ + Q_ASSERT(!m_image.isNull()); + return &m_image->image(); +} + +void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, + const QPoint &offset) +{ + // TODO: Prepare paint for translucent windows. + const QRect br = region.boundingRect(); + if (QWindowsContext::verboseBackingStore > 1) + qDebug() << __FUNCTION__ << window << offset << br; + QWindowsWindow *rw = rasterWindow(); + const HDC dc = rw->getDC(); + if (!dc) { + qErrnoWarning("%s: GetDC failed", __FUNCTION__); + return; + } + + if (!BitBlt(dc, br.x(), br.y(), br.width(), br.height(), + m_image->hdc(), br.x() + offset.x(), br.y() + offset.y(), SRCCOPY)) + qErrnoWarning("%s: BitBlt failed", __FUNCTION__); + rw->releaseDC(); + // Write image for debug purposes. + if (QWindowsContext::verboseBackingStore > 2) { + static int n = 0; + const QString fileName = QString::fromAscii("win%1_%2.png"). + arg(rw->winId()).arg(n++); + m_image->image().save(fileName); + qDebug() << "Wrote " << m_image->image().size() << fileName; + } +} + +void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) +{ + if (m_image.isNull() || m_image->image().size() != size) { + if (QWindowsContext::verboseBackingStore) { + QDebug nsp = qDebug().nospace(); + nsp << __FUNCTION__ << ' ' << rasterWindow()->window() + << ' ' << size << ' ' << region; + if (!m_image.isNull()) + nsp << " from: " << m_image->image().size(); + } + m_image.reset(new QWindowsNativeImage(size.width(), size.height(), + QWindowsNativeImage::systemFormat())); + } +} + +void QWindowsBackingStore::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + if (QWindowsContext::verboseBackingStore > 1) + qDebug() << __FUNCTION__; +} + +QWindowsWindow *QWindowsBackingStore::rasterWindow() const +{ + if (const QWindow *w = window()) + if (QPlatformWindow *pw = w->handle()) + return static_cast(pw); + return 0; +} + +HDC QWindowsBackingStore::getDC() const +{ + if (!m_image.isNull()) + return m_image->hdc(); + return 0; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.h b/src/plugins/platforms/windows/qwindowsbackingstore.h new file mode 100644 index 00000000000..53f033d14b8 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsbackingstore.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSBACKINGSTORE_H +#define QWINDOWSBACKINGSTORE_H + +#include "qtwindows_additional.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWindowsWindow; +class QWindowsNativeImage; + +class QWindowsBackingStore : public QPlatformBackingStore +{ + Q_DISABLE_COPY(QWindowsBackingStore) +public: + QWindowsBackingStore(QWindow *window); + ~QWindowsBackingStore(); + + virtual QPaintDevice *paintDevice(); + virtual void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + virtual void resize(const QSize &size, const QRegion &r); + virtual void beginPaint(const QRegion &); + + HDC getDC() const; + +private: + QWindowsWindow *rasterWindow() const; + + QScopedPointer m_image; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSBACKINGSTORE_H diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp new file mode 100644 index 00000000000..93063441bae --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -0,0 +1,366 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsclipboard.h" +#include "qwindowscontext.h" +#include "qwindowsole.h" +#include "qwindowsmime.h" +#include "qwindowsguieventdispatcher.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static const char formatTextPlainC[] = "text/plain"; +static const char formatTextHtmlC[] = "text/html"; + +/*! + \class QWindowsClipboard + \brief Clipboard implementation. + + Registers a non-visible clipboard viewer window that + receives clipboard events in its own window procedure to be + able to receive clipboard-changed events, which + QPlatformClipboard needs to emit. That requires housekeeping + of the next in the viewer chain. + + \note The OLE-functions used in this class require OleInitialize(). + + \ingroup qt-lighthouse-win +*/ + +QDebug operator<<(QDebug d, const QMimeData &m) +{ + QDebug nospace = d.nospace(); + const QStringList formats = m.formats(); + nospace << "QMimeData: " << formats.join(QStringLiteral(", ")) << '\n' + << " Text=" << m.hasText() << " HTML=" << m.hasHtml() + << " Color=" << m.hasColor() << " Image=" << m.hasImage() + << " URLs=" << m.hasUrls() << '\n'; + if (m.hasText()) + nospace << " Text: '" << m.text() << "'\n"; + if (m.hasHtml()) + nospace << " HTML: '" << m.html() << "'\n"; + if (m.hasColor()) + nospace << " Color: " << qvariant_cast(m.colorData()) << '\n'; + if (m.hasImage()) + nospace << " Image: " << qvariant_cast(m.imageData()).size() << '\n'; + if (m.hasUrls()) + nospace << " URLs: " << m.urls() << '\n'; + return d; +} + +/*! + \class QWindowsInternalMimeDataBase + \brief Base for implementations of QInternalMimeData using a IDataObject COM object. + + In clipboard handling and Drag and drop, static instances + of QInternalMimeData implementations are kept and passed to the client. + + QInternalMimeData provides virtuals that query the formats and retrieve + mime data on demand when the client invokes functions like QMimeData::hasHtml(), + QMimeData::html() on the instance returned. Otherwise, expensive + construction of a new QMimeData object containing all possible + formats would have to be done in each call to mimeData(). + + The base class introduces new virtuals to obtain and release + the instances IDataObject from the clipboard or Drag and Drop and + does conversion using QWindowsMime classes. + + \sa QInternalMimeData, QWindowsMime, QWindowsMimeConverter + \ingroup qt-lighthouse-win +*/ + +bool QWindowsInternalMimeData::hasFormat_sys(const QString &mime) const +{ + IDataObject *pDataObj = retrieveDataObject(); + if (!pDataObj) + return false; + + const QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter(); + const bool has = mc.converterToMime(mime, pDataObj) != 0; + releaseDataObject(pDataObj); + if (QWindowsContext::verboseOLE) + qDebug() << __FUNCTION__ << mime << has; + return has; +} + +QStringList QWindowsInternalMimeData::formats_sys() const +{ + IDataObject *pDataObj = retrieveDataObject(); + if (!pDataObj) + return QStringList(); + + const QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter(); + const QStringList fmts = mc.allMimesForFormats(pDataObj); + releaseDataObject(pDataObj); + if (QWindowsContext::verboseOLE) + qDebug() << __FUNCTION__ << fmts; + return fmts; +} + +QVariant QWindowsInternalMimeData::retrieveData_sys(const QString &mimeType, + QVariant::Type type) const +{ + IDataObject *pDataObj = retrieveDataObject(); + if (!pDataObj) + return QVariant(); + + QVariant result; + const QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter(); + if (const QWindowsMime *converter = mc.converterToMime(mimeType, pDataObj)) + result = converter->convertToMime(mimeType, pDataObj, type); + releaseDataObject(pDataObj); + if (QWindowsContext::verboseOLE) { + QDebug nospace = qDebug().nospace(); + nospace << __FUNCTION__ << ' ' << mimeType << ' ' << type + << " returns " << result.type(); + if (result.type() != QVariant::ByteArray) + nospace << ' ' << result; + } + return result; +} + +/*! + \class QWindowsClipboardRetrievalMimeData + \brief Special mime data class managing delayed retrieval of clipboard data. + + Implementation of QWindowsInternalMimeDataBase that obtains the + IDataObject from the clipboard. + + \sa QWindowsInternalMimeDataBase, QWindowsClipboard + \ingroup qt-lighthouse-win +*/ + +IDataObject *QWindowsClipboardRetrievalMimeData::retrieveDataObject() const +{ + IDataObject * pDataObj = 0; + if (OleGetClipboard(&pDataObj) == S_OK) + return pDataObj; + return 0; +} + +void QWindowsClipboardRetrievalMimeData::releaseDataObject(IDataObject *dataObject) const +{ + dataObject->Release(); +} + +extern "C" LRESULT QT_WIN_CALLBACK qClipboardViewerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT result = 0; + if (QWindowsClipboard::instance() + && QWindowsClipboard::instance()->clipboardViewerWndProc(hwnd, message, wParam, lParam, &result)) + return result; + return DefWindowProc(hwnd, message, wParam, lParam); +} + +QWindowsClipboard *QWindowsClipboard::m_instance = 0; + +QWindowsClipboard::QWindowsClipboard() : + m_data(0), m_clipboardViewer(0), m_nextClipboardViewer(0) +{ + QWindowsClipboard::m_instance = this; +} + +QWindowsClipboard::~QWindowsClipboard() +{ + unregisterViewer(); // Should release data if owner. + releaseIData(); + QWindowsClipboard::m_instance = 0; +} + +void QWindowsClipboard::releaseIData() +{ + if (m_data) { + delete m_data->mimeData(); + m_data->releaseQt(); + m_data->Release(); + m_data = 0; + } +} + +void QWindowsClipboard::registerViewer() +{ + m_clipboardViewer = QWindowsContext::instance()-> + createDummyWindow(QStringLiteral("Qt5ClipboardView"), L"Qt5ClipboardView", + qClipboardViewerWndProc, WS_OVERLAPPED); + m_nextClipboardViewer = SetClipboardViewer(m_clipboardViewer); + + if (QWindowsContext::verboseOLE) + qDebug("%s m_clipboardViewer: %p next=%p", __FUNCTION__, + m_clipboardViewer, m_nextClipboardViewer); +} + +void QWindowsClipboard::unregisterViewer() +{ + if (m_clipboardViewer) { + ChangeClipboardChain(m_clipboardViewer, m_nextClipboardViewer); + DestroyWindow(m_clipboardViewer); + m_clipboardViewer = m_nextClipboardViewer = 0; + } +} + +void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, LPARAM lParam) const +{ + if (!m_nextClipboardViewer) + return; + // In rare cases, a clipboard viewer can hang (application crashed, + // suspended by a shell prompt 'Select' or debugger). + if (QWindowsContext::user32dll.isHungAppWindow + && QWindowsContext::user32dll.isHungAppWindow(m_nextClipboardViewer)) { + qWarning("%s: Cowardly refusing to send clipboard message to hung application...", Q_FUNC_INFO); + return; + } + SendMessage(m_nextClipboardViewer, message, wParam, lParam); +} + +/*! + \brief Windows procedure of the clipboard viewer. Emits changed and does + housekeeping of the viewer chain. +*/ + +bool QWindowsClipboard::clipboardViewerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result) +{ + *result = 0; + if (QWindowsContext::verboseOLE) + qDebug("%s HWND=%p 0x%x %s", __FUNCTION__, hwnd, message, + QWindowsGuiEventDispatcher::windowsMessageName(message)); + + switch (message) { + case WM_CHANGECBCHAIN: { + const HWND toBeRemoved = (HWND)wParam; + if (toBeRemoved == m_nextClipboardViewer) { + m_nextClipboardViewer = (HWND)lParam; + } else { + propagateClipboardMessage(message, wParam, lParam); + } + } + return true; + case WM_DRAWCLIPBOARD: + if (QWindowsContext::verboseOLE) + qDebug("Clipboard changed"); + emitChanged(QClipboard::Clipboard); + // clean up the clipboard object if we no longer own the clipboard + if (!ownsClipboard() && m_data) + releaseIData(); + propagateClipboardMessage(message, wParam, lParam); + return true; + case WM_DESTROY: + // Recommended shutdown + if (ownsClipboard()) { + if (QWindowsContext::verboseOLE) + qDebug("Clipboard owner on shutdown, releasing."); + OleFlushClipboard(); + releaseIData(); + } + return true; + } // switch (message) + return false; +} + +QMimeData *QWindowsClipboard::mimeData(QClipboard::Mode mode) +{ + if (QWindowsContext::verboseOLE) + qDebug() << __FUNCTION__ << mode; + if (mode != QClipboard::Clipboard) + return 0; + return &m_retrievalData; +} + +void QWindowsClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode) +{ + if (QWindowsContext::verboseOLE) + qDebug() << __FUNCTION__ << mode << *mimeData; + if (mode != QClipboard::Clipboard) + return; + + const bool newData = !m_data || m_data->mimeData() != mimeData; + if (newData) { + releaseIData(); + m_data = new QWindowsOleDataObject(mimeData); + } + + const HRESULT src = OleSetClipboard(m_data); + if (src != S_OK) { + qErrnoWarning("OleSetClipboard: Failed to set data on clipboard: %s", + QWindowsContext::comErrorString(src).constData()); + releaseIData(); + return; + } +} + +void QWindowsClipboard::clear() +{ + const HRESULT src = OleSetClipboard(0); + if (src != S_OK) + qErrnoWarning("OleSetClipboard: Failed to clear the clipboard: 0x%lx", src); +} + +bool QWindowsClipboard::supportsMode(QClipboard::Mode mode) const +{ + return mode == QClipboard::Clipboard; +} + +// Need a non-virtual in destructor. +bool QWindowsClipboard::ownsClipboard() const +{ + return m_data && OleIsCurrentClipboard(m_data) == S_OK; +} + +bool QWindowsClipboard::ownsMode(QClipboard::Mode mode) const +{ + const bool result = mode == QClipboard::Clipboard ? + ownsClipboard() : false; + if (QWindowsContext::verboseOLE) + qDebug("%s %d returns %d", __FUNCTION__, mode, result); + return result; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsclipboard.h b/src/plugins/platforms/windows/qwindowsclipboard.h new file mode 100644 index 00000000000..fab68710120 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsclipboard.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSCLIPBOARD_H +#define QWINDOWSCLIPBOARD_H + +#include "qwindowsinternalmimedata.h" + +#include + +QT_BEGIN_NAMESPACE + +class QWindowsOleDataObject; + +class QWindowsClipboardRetrievalMimeData : public QWindowsInternalMimeData { +public: + +protected: + virtual IDataObject *retrieveDataObject() const; + virtual void releaseDataObject(IDataObject *) const; +}; + +class QWindowsClipboard : public QPlatformClipboard +{ +public: + QWindowsClipboard(); + ~QWindowsClipboard(); + void registerViewer(); // Call in initialization, when context is up. + + virtual QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard); + virtual void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard); + virtual bool supportsMode(QClipboard::Mode mode) const; + virtual bool ownsMode(QClipboard::Mode mode) const; + + inline bool clipboardViewerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result); + + static QWindowsClipboard *instance() { return m_instance; } + +private: + void clear(); + void releaseIData(); + inline void propagateClipboardMessage(UINT message, WPARAM wParam, LPARAM lParam) const; + inline void unregisterViewer(); + inline bool ownsClipboard() const; + + static QWindowsClipboard *m_instance; + + QWindowsClipboardRetrievalMimeData m_retrievalData; + QWindowsOleDataObject *m_data; + HWND m_clipboardViewer; + HWND m_nextClipboardViewer; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSCLIPBOARD_H diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp new file mode 100644 index 00000000000..c77a1114909 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -0,0 +1,750 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowscontext.h" +#include "qwindowswindow.h" +#include "qwindowskeymapper.h" +#include "qwindowsguieventdispatcher.h" +#include "qwindowsmousehandler.h" +#include "qtwindowsglobal.h" +#include "qwindowsmime.h" +#include "qwindowsinputcontext.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +// Verbosity of components +int QWindowsContext::verboseIntegration = 0; +int QWindowsContext::verboseWindows = 0; +int QWindowsContext::verboseEvents = 0; +int QWindowsContext::verboseBackingStore = 0; +int QWindowsContext::verboseFonts = 0; +int QWindowsContext::verboseGL = 0; +int QWindowsContext::verboseOLE = 0; +int QWindowsContext::verboseInputMethods = 0; + +// Get verbosity of components from "foo:2,bar:3" +static inline int componentVerbose(const char *v, const char *keyWord) +{ + if (const char *k = strstr(v, keyWord)) { + k += qstrlen(keyWord); + if (*k == ':') { + ++k; + if (isdigit(*k)) + return *k - '0'; + } + } + return 0; +} + +static inline bool hasTouchSupport(QSysInfo::WinVersion wv) +{ + enum { QT_SM_DIGITIZER = 94, QT_NID_INTEGRATED_TOUCH = 0x1, + QT_NID_EXTERNAL_TOUCH = 0x02, QT_NID_MULTI_INPUT = 0x40 }; + + return wv < QSysInfo::WV_WINDOWS7 ? false : + (GetSystemMetrics(QT_SM_DIGITIZER) & (QT_NID_INTEGRATED_TOUCH | QT_NID_EXTERNAL_TOUCH | QT_NID_MULTI_INPUT)) != 0; +} + +#if !defined(LANG_SYRIAC) +# define LANG_SYRIAC 0x5a +#endif + +static inline bool useRTL_Extensions(QSysInfo::WinVersion ver) +{ + if ((ver & QSysInfo::WV_NT_based) && (ver >= QSysInfo::WV_VISTA)) { + // Since the IsValidLanguageGroup/IsValidLocale functions always return true on + // Vista, check the Keyboard Layouts for enabling RTL. + if (const UINT nLayouts = GetKeyboardLayoutList(0, 0)) { + QScopedArrayPointer lpList(new HKL[nLayouts]); + GetKeyboardLayoutList(nLayouts, lpList.data()); + for (UINT i = 0; i < nLayouts; ++i) { + switch (PRIMARYLANGID((quintptr)lpList[i])) { + case LANG_ARABIC: + case LANG_HEBREW: + case LANG_FARSI: + case LANG_SYRIAC: + return true; + default: + break; + } + } + } + return false; + } // NT/Vista + // Pre-NT: figure out whether a RTL language is installed + return IsValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED) + || IsValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED) + || IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) + || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) + || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) + || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED); +} + +/*! + \class QWindowsUser32DLL + \brief Struct that contains dynamically resolved symbols of User32.dll. + + The stub libraries shipped with the MinGW compiler miss some of the + functions. They need to be retrieved dynamically. + + In addition, touch-related functions are available only from Windows onwards. + These need to resolved dynamically for Q_CC_MSVC as well. + + \ingroup qt-lighthouse-win +*/ + +QWindowsUser32DLL::QWindowsUser32DLL() : + setLayeredWindowAttributes(0), updateLayeredWindow(0), + updateLayeredWindowIndirect(0), + isHungAppWindow(0), + registerTouchWindow(0), getTouchInputInfo(0), closeTouchInputHandle(0) +{ +} + +void QWindowsUser32DLL::init() +{ + QSystemLibrary library(QStringLiteral("user32")); + // MinGW (g++ 3.4.5) accepts only C casts. + setLayeredWindowAttributes = (SetLayeredWindowAttributes)(library.resolve("SetLayeredWindowAttributes")); + updateLayeredWindow = (UpdateLayeredWindow)(library.resolve("UpdateLayeredWindow")); + updateLayeredWindowIndirect = (UpdateLayeredWindowIndirect)(library.resolve("UpdateLayeredWindowIndirect")); + + Q_ASSERT(setLayeredWindowAttributes && updateLayeredWindow + && updateLayeredWindowIndirect); + + isHungAppWindow = (IsHungAppWindow)library.resolve("IsHungAppWindow"); +} + +bool QWindowsUser32DLL::initTouch() +{ + QSystemLibrary library(QStringLiteral("user32")); + registerTouchWindow = (RegisterTouchWindow)(library.resolve("RegisterTouchWindow")); + getTouchInputInfo = (GetTouchInputInfo)(library.resolve("GetTouchInputInfo")); + closeTouchInputHandle = (CloseTouchInputHandle)(library.resolve("CloseTouchInputHandle")); + return registerTouchWindow && getTouchInputInfo && getTouchInputInfo; +} + +QWindowsUser32DLL QWindowsContext::user32dll; + +QWindowsContext *QWindowsContext::m_instance = 0; + +/*! + \class QWindowsContext + \brief Singleton container for all relevant information. + + Holds state information formerly stored in \c qapplication_win.cpp. + \ingroup qt-lighthouse-win +*/ + +typedef QHash HandleBaseWindowHash; + +struct QWindowsContextPrivate { + explicit QWindowsContextPrivate(bool isOpenGL); + + const bool m_isOpenGL; + unsigned m_systemInfo; + QSet m_registeredWindowClassNames; + HandleBaseWindowHash m_windows; + HDC m_displayContext; + const int m_defaultDPI; + QWindowsKeyMapper m_keyMapper; + QWindowsMouseHandler m_mouseHandler; + QWindowsMimeConverter m_mimeConverter; + QSharedPointer m_creationContext; + const HRESULT m_oleInitializeResult; +}; + +QWindowsContextPrivate::QWindowsContextPrivate(bool isOpenGL) : + m_isOpenGL(isOpenGL), + m_systemInfo(0), + m_displayContext(GetDC(0)), + m_defaultDPI(GetDeviceCaps(m_displayContext,LOGPIXELSY)), + m_oleInitializeResult(OleInitialize(NULL)) +{ + QWindowsContext::user32dll.init(); + + const QSysInfo::WinVersion ver = QSysInfo::windowsVersion(); + + if (hasTouchSupport(ver) && QWindowsContext::user32dll.initTouch()) + m_systemInfo |= QWindowsContext::SI_SupportsTouch; + + if (useRTL_Extensions(ver)) { + m_systemInfo |= QWindowsContext::SI_RTL_Extensions; + m_keyMapper.setUseRTLExtensions(true); + } +} + +QWindowsContext::QWindowsContext(bool isOpenGL) : + d(new QWindowsContextPrivate(isOpenGL)) +{ +#ifdef Q_CC_MSVC +# pragma warning( disable : 4996 ) +#endif + m_instance = this; + if (const char *v = getenv("QT_LIGHTHOUSE_WINDOWS_VERBOSE")) { + QWindowsContext::verboseIntegration = componentVerbose(v, "integration"); + QWindowsContext::verboseWindows = componentVerbose(v, "windows"); + QWindowsContext::verboseEvents = componentVerbose(v, "events"); + QWindowsContext::verboseBackingStore = componentVerbose(v, "backingstore"); + QWindowsContext::verboseFonts = componentVerbose(v, "fonts"); + QWindowsContext::verboseGL = componentVerbose(v, "gl"); + QWindowsContext::verboseOLE = componentVerbose(v, "ole"); + QWindowsContext::verboseInputMethods = componentVerbose(v, "im"); + } +} + +QWindowsContext::~QWindowsContext() +{ + unregisterWindowClasses(); + if (d->m_oleInitializeResult == S_OK || d->m_oleInitializeResult == S_FALSE) + OleUninitialize(); + + m_instance = 0; +} + +QWindowsContext *QWindowsContext::instance() +{ + return m_instance; +} + +unsigned QWindowsContext::systemInfo() const +{ + return d->m_systemInfo; +} + +void QWindowsContext::setWindowCreationContext(const QSharedPointer &ctx) +{ + d->m_creationContext = ctx; +} + +bool QWindowsContext::isOpenGL() const +{ + return d->m_isOpenGL; +} + +int QWindowsContext::defaultDPI() const +{ + return d->m_defaultDPI; +} + +HDC QWindowsContext::displayContext() const +{ + return d->m_displayContext; +} + +QWindow *QWindowsContext::keyGrabber() const +{ + return d->m_keyMapper.keyGrabber(); +} + +void QWindowsContext::setKeyGrabber(QWindow *w) +{ + d->m_keyMapper.setKeyGrabber(w); +} + +// Window class registering code (from qapplication_win.cpp) +// If 0 is passed as the widget pointer, register a window class +// for QWidget as default. This is used in QGLTemporaryContext +// during GL initialization, where we don't want to use temporary +// QWidgets or QGLWidgets, neither do we want to have separate code +// to register window classes. + +QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL) +{ + const Qt::WindowFlags flags = w ? w->windowFlags() : (Qt::WindowFlags)0; + const Qt::WindowFlags type = flags & Qt::WindowType_Mask; + + uint style = 0; + bool icon = false; + QString cname = "Qt5"; + if (w && isGL) { + cname += QStringLiteral("QGLWindow"); + style = CS_DBLCLKS|CS_OWNDC; + icon = true; + } else if (w && (flags & Qt::MSWindowsOwnDC)) { + cname += QStringLiteral("QWindowOwnDC"); + style = CS_DBLCLKS|CS_OWNDC; + icon = true; + } else if (w && (type == Qt::Tool || type == Qt::ToolTip)) { + style = CS_DBLCLKS; + if (w->inherits("QTipLabel") || w->inherits("QAlphaWidget")) { + if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP + && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { + style |= CS_DROPSHADOW; + } + cname += QStringLiteral("QToolTip"); + } else { + cname += QStringLiteral("QTool"); + } + style |= CS_SAVEBITS; + icon = false; + } else if (w && (type == Qt::Popup)) { + cname += QStringLiteral("QPopup"); + style = CS_DBLCLKS|CS_SAVEBITS; + if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP + && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + style |= CS_DROPSHADOW; + icon = false; + } else { + cname += QStringLiteral("QWindow"); + style = CS_DBLCLKS; + icon = true; + } + + // force CS_OWNDC when the GL graphics system is + // used as the default renderer + if (d->m_isOpenGL) + style |= CS_OWNDC; + + HBRUSH brush = 0; + if (w && !isGL) + brush = GetSysColorBrush(COLOR_WINDOW); + return registerWindowClass(cname, qWindowsWndProc, style, brush, icon); +} + +QString QWindowsContext::registerWindowClass(QString cname, + WNDPROC proc, + unsigned style, + HBRUSH brush, + bool icon) +{ + // since multiple Qt versions can be used in one process + // each one has to have window class names with a unique name + // The first instance gets the unmodified name; if the class + // has already been registered by another instance of Qt then + // add an instance-specific ID, the address of the window proc. + static int classExists = -1; + + const HINSTANCE appInstance = (HINSTANCE)GetModuleHandle(0); + if (classExists == -1) { + WNDCLASS wcinfo; + classExists = GetClassInfo(appInstance, (wchar_t*)cname.utf16(), &wcinfo); + classExists = classExists && wcinfo.lpfnWndProc != proc; + } + + if (classExists) + cname += QString::number((quintptr)proc); + + if (d->m_registeredWindowClassNames.contains(cname)) // already registered in our list + return cname; + + WNDCLASSEX wc; + wc.cbSize = sizeof(WNDCLASSEX); + wc.style = style; + wc.lpfnWndProc = proc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = appInstance; + if (icon) { + wc.hIcon = (HICON)LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); + if (wc.hIcon) { + int sw = GetSystemMetrics(SM_CXSMICON); + int sh = GetSystemMetrics(SM_CYSMICON); + wc.hIconSm = (HICON)LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, sw, sh, 0); + } else { + wc.hIcon = (HICON)LoadImage(0, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED); + wc.hIconSm = 0; + } + } else { + wc.hIcon = 0; + wc.hIconSm = 0; + } + wc.hCursor = 0; + wc.hbrBackground = brush; + wc.lpszMenuName = 0; + wc.lpszClassName = (wchar_t*)cname.utf16(); + ATOM atom = RegisterClassEx(&wc); + + if (!atom) + qErrnoWarning("QApplication::regClass: Registering window class '%s' failed.", + qPrintable(cname)); + + d->m_registeredWindowClassNames.insert(cname); + if (QWindowsContext::verboseIntegration || QWindowsContext::verboseWindows) + qDebug().nospace() << __FUNCTION__ << ' ' << cname + << " style=0x" << QString::number(style, 16) + << " brush=" << brush << " icon=" << icon << " atom=" << atom; + return cname; +} + +void QWindowsContext::unregisterWindowClasses() +{ + const HINSTANCE appInstance = (HINSTANCE)GetModuleHandle(0); + + foreach (const QString &name, d->m_registeredWindowClassNames) { + if (QWindowsContext::verboseIntegration) + qDebug() << __FUNCTION__ << name; + UnregisterClass((wchar_t*)name.utf16(), appInstance); + } + d->m_registeredWindowClassNames.clear(); +} + +int QWindowsContext::screenDepth() const +{ + return GetDeviceCaps(d->m_displayContext, BITSPIXEL); +} + +QString QWindowsContext::windowsErrorMessage(unsigned long errorCode) +{ + QString rc = QString::fromLatin1("#%1: ").arg(errorCode); + ushort *lpMsgBuf; + + const int len = FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, errorCode, 0, (LPTSTR)&lpMsgBuf, 0, NULL); + if (len) { + rc = QString::fromUtf16(lpMsgBuf, len); + LocalFree(lpMsgBuf); + } else { + rc += QString::fromLatin1(""); + } + return rc; +} + +void QWindowsContext::addWindow(HWND hwnd, QWindowsWindow *w) +{ + d->m_windows.insert(hwnd, w); +} + +void QWindowsContext::removeWindow(HWND hwnd) +{ + const HandleBaseWindowHash::iterator it = d->m_windows.find(hwnd); + if (it != d->m_windows.end()) { + if (d->m_keyMapper.keyGrabber() == it.value()->window()) + d->m_keyMapper.setKeyGrabber(0); + d->m_windows.erase(it); + } +} + +QWindowsWindow *QWindowsContext::findPlatformWindow(HWND hwnd) const +{ + return d->m_windows.value(hwnd); +} + +QWindow *QWindowsContext::findWindow(HWND hwnd) const +{ + if (const QWindowsWindow *bw = findPlatformWindow(hwnd)) + return bw->window(); + return 0; +} + +QWindow *QWindowsContext::windowUnderMouse() const +{ + return d->m_mouseHandler.windowUnderMouse(); +} + +/*! + \brief Find a child window at a screen point. + + Deep search for a QWindow at global point, skipping non-owned + windows (accessibility?). Implemented using ChildWindowFromPointEx() + instead of (historically used) WindowFromPoint() to get a well-defined + behaviour for hidden/transparent windows. + + \a cwex_flags are flags of ChildWindowFromPointEx(). + \a parent is the parent window, pass GetDesktopWindow() for top levels. +*/ + +QWindowsWindow *QWindowsContext::findPlatformWindowAt(HWND parent, + const QPoint &screenPointIn, + unsigned cwex_flags) const +{ + QWindowsWindow *result = 0; + const POINT screenPoint = { screenPointIn.x(), screenPointIn.y() }; + while (true) { + POINT point = screenPoint; + ScreenToClient(parent, &point); + // Returns parent if inside & none matched. + const HWND child = ChildWindowFromPointEx(parent, point, cwex_flags); + if (child && child != parent) { + if (QWindowsWindow *window = findPlatformWindow(child)) + result = window; + parent = child; + } else { + break; + } + } + return result; +} + +QWindowsMimeConverter &QWindowsContext::mimeConverter() const +{ + return d->m_mimeConverter; +} + +/*! + \brief Convenience to create a non-visible dummy window + for example used as clipboard watcher or for GL. +*/ + +HWND QWindowsContext::createDummyWindow(const QString &classNameIn, + const wchar_t *windowName, + WNDPROC wndProc, DWORD style) +{ + if (!wndProc) + wndProc = DefWindowProc; + QString className = registerWindowClass(classNameIn, wndProc); + return CreateWindowEx(0, (wchar_t*)className.utf16(), + windowName, style, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + 0, NULL, (HINSTANCE)GetModuleHandle(0), NULL); +} + +/*! + \brief Common COM error strings. +*/ + +QByteArray QWindowsContext::comErrorString(HRESULT hr) +{ + switch (hr) { + case S_OK: + return QByteArray("S_OK"); + case S_FALSE: + return QByteArray("S_FALSE"); + case E_UNEXPECTED: + return QByteArray("E_UNEXPECTED"); + case CO_E_ALREADYINITIALIZED: + return QByteArray("CO_E_ALREADYINITIALIZED"); + case CO_E_NOTINITIALIZED: + return QByteArray("CO_E_NOTINITIALIZED"); + case RPC_E_CHANGED_MODE: + return QByteArray("RPC_E_CHANGED_MODE"); + case OLE_E_WRONGCOMPOBJ: + return QByteArray("OLE_E_WRONGCOMPOBJ"); + case CO_E_NOT_SUPPORTED: + return QByteArray("CO_E_NOT_SUPPORTED"); + case E_NOTIMPL: + return QByteArray("E_NOTIMPL"); + case E_INVALIDARG: + return QByteArray(""); + case E_NOINTERFACE: + return QByteArray(""); + case E_POINTER: + return QByteArray(""); + case E_HANDLE: + return QByteArray(""); + case E_ABORT: + return QByteArray(""); + case E_FAIL: + return QByteArray(""); + case E_ACCESSDENIED: + return QByteArray(""); + default: + break; + } + return "Unknown error 0x" + QByteArray::number(quint64(hr), 16); +} + +/*! + \brief Main windows procedure registered for windows. + + \sa QWindowsGuiEventDispatcher +*/ + +bool QWindowsContext::windowsProc(HWND hwnd, UINT message, + QtWindows::WindowsEventType et, + WPARAM wParam, LPARAM lParam, LRESULT *result) +{ + *result = 0; + // Events without an associated QWindow or events we are not interested in. + switch (et) { + case QtWindows::DeactivateApplicationEvent: + case QtWindows::DeactivateWindowEvent: + QWindowSystemInterface::handleWindowActivated(0); + return true; + case QtWindows::InputMethodStartCompositionEvent: + return QWindowsInputContext::instance()->startComposition(hwnd); + case QtWindows::InputMethodCompositionEvent: + return QWindowsInputContext::instance()->composition(hwnd, lParam); + case QtWindows::InputMethodEndCompositionEvent: + return QWindowsInputContext::instance()->endComposition(hwnd); + case QtWindows::InputMethodRequest: + return QWindowsInputContext::instance()->handleIME_Request(wParam, lParam, result); + case QtWindows::InputMethodOpenCandidateWindowEvent: + case QtWindows::InputMethodCloseCandidateWindowEvent: + // TODO: Release/regrab mouse if a popup has mouse grab. + return false; + case QtWindows::ClipboardEvent: + case QtWindows::DestroyEvent: + + case QtWindows::UnknownEvent: + return false; + default: + break; + } + + QWindowsWindow *platformWindow = findPlatformWindow(hwnd); + // Before CreateWindowEx() returns, some events are sent, + // for example WM_GETMINMAXINFO asking for size constraints for top levels. + // Pass on to current creation context + if (!platformWindow && !d->m_creationContext.isNull()) { + switch (et) { + case QtWindows::QuerySizeHints: + d->m_creationContext->applyToMinMaxInfo(reinterpret_cast(lParam)); + return true; + case QtWindows::ResizeEvent: + d->m_creationContext->obtainedGeometry.setSize(QSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); + return true; + case QtWindows::MoveEvent: + d->m_creationContext->obtainedGeometry.moveTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + return true; + case QtWindows::CalculateSize: + return false; + default: + break; + } + } + if (platformWindow) { + if (QWindowsContext::verboseEvents > 1) + qDebug().nospace() << "Event window: " << platformWindow->window(); + } else { + qWarning("%s: No Qt Window found for event 0x%x (%s), hwnd=0x%p.", + __FUNCTION__, message, + QWindowsGuiEventDispatcher::windowsMessageName(message), hwnd); + return false; + } + + MSG msg; + msg.hwnd = hwnd; // re-create MSG structure + msg.message = message; // time and pt fields ignored + msg.wParam = wParam; + msg.lParam = lParam; + msg.pt.x = GET_X_LPARAM(lParam); + msg.pt.y = GET_Y_LPARAM(lParam); + + switch (et) { + case QtWindows::KeyDownEvent: + case QtWindows::KeyEvent: + case QtWindows::InputMethodKeyEvent: + case QtWindows::InputMethodKeyDownEvent: + return d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); + case QtWindows::MoveEvent: + platformWindow->handleMoved(); + return true; + case QtWindows::ResizeEvent: + platformWindow->handleResized((int)wParam); + return true; + case QtWindows::QuerySizeHints: + platformWindow->getSizeHints(reinterpret_cast(lParam)); + return true; + case QtWindows::CalculateSize: + // NCCALCSIZE_PARAMS structure if wParam==TRUE + if (wParam && QWindowsContext::verboseWindows) { + const NCCALCSIZE_PARAMS *ncp = reinterpret_cast(lParam); + qDebug() << platformWindow->window() << *ncp; + } + break; + case QtWindows::ExposeEvent: + platformWindow->handleWmPaint(hwnd, message, wParam, lParam); + return true; + case QtWindows::MouseWheelEvent: + case QtWindows::MouseEvent: + case QtWindows::NonClientMouseEvent: + case QtWindows::LeaveEvent: + return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); + case QtWindows::TouchEvent: + return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); + case QtWindows::ActivateWindowEvent: + QWindowSystemInterface::handleWindowActivated(platformWindow->window()); + return true; + case QtWindows::ShowEvent: + platformWindow->handleShown(); + return true; + case QtWindows::HideEvent: + platformWindow->handleHidden(); + return true; + case QtWindows::CloseEvent: + QWindowSystemInterface::handleCloseEvent(platformWindow->window()); + return true; + default: + break; + } + return false; +} + +/*! + \brief Windows functions for actual windows. + + There is another one for timers, sockets, etc in + QEventDispatcherWin32. + + \ingroup qt-lighthouse-win +*/ + +extern "C" LRESULT QT_WIN_CALLBACK qWindowsWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT result; + const QtWindows::WindowsEventType et = windowsEventType(message, wParam); + const bool handled = QWindowsContext::instance()->windowsProc(hwnd, message, et, wParam, lParam, &result); + const bool guiEventsQueued = QWindowSystemInterface::windowSystemEventsQueued(); + if (QWindowsContext::verboseEvents > 1) + if (const char *eventName = QWindowsGuiEventDispatcher::windowsMessageName(message)) + qDebug("EVENT: hwd=%p %s msg=0x%x et=0x%x wp=%d at %d,%d handled=%d gui=%d", + hwnd, eventName, message, et, int(wParam), + GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), handled, guiEventsQueued); + if (guiEventsQueued) { + const QWindowsGuiEventDispatcher::DispatchContext dispatchContext = + QWindowsGuiEventDispatcher::currentDispatchContext(); + if (dispatchContext.first) + QWindowSystemInterface::sendWindowSystemEvents(dispatchContext.first, dispatchContext.second); + } + if (!handled) + result = DefWindowProc(hwnd, message, wParam, lParam); + return result; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h new file mode 100644 index 00000000000..93662384c0c --- /dev/null +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -0,0 +1,172 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSCONTEXT_H +#define QWINDOWSCONTEXT_H + +#include "qtwindowsglobal.h" +#include "qtwindows_additional.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWindow; +class QPlatformScreen; +class QWindowsWindow; +class QWindowsMimeConverter; +struct QWindowCreationContext; +struct QWindowsContextPrivate; +class QPoint; + +struct QWindowsUser32DLL +{ + QWindowsUser32DLL(); + inline void init(); + inline bool initTouch(); + + typedef BOOL (WINAPI *RegisterTouchWindow)(HWND, ULONG); + typedef BOOL (WINAPI *GetTouchInputInfo)(HANDLE, UINT, PVOID, int); + typedef BOOL (WINAPI *CloseTouchInputHandle)(HANDLE); + typedef BOOL (WINAPI *SetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD); + typedef BOOL (WINAPI *UpdateLayeredWindow)(HWND, HDC , const POINT *, + const SIZE *, HDC, const POINT *, COLORREF, + const BLENDFUNCTION *, DWORD); + typedef BOOL (WINAPI *UpdateLayeredWindowIndirect)(HWND, const UPDATELAYEREDWINDOWINFO *); + typedef BOOL (WINAPI *IsHungAppWindow)(HWND); + + // Functions missing in Q_CC_GNU stub libraries. + SetLayeredWindowAttributes setLayeredWindowAttributes; + UpdateLayeredWindow updateLayeredWindow; + UpdateLayeredWindowIndirect updateLayeredWindowIndirect; + + // Functions missing in older versions of Windows + IsHungAppWindow isHungAppWindow; + + // Touch functions from Windows 7 onwards (also for use with Q_CC_MSVC). + RegisterTouchWindow registerTouchWindow; + GetTouchInputInfo getTouchInputInfo; + CloseTouchInputHandle closeTouchInputHandle; +}; + +class QWindowsContext +{ + Q_DISABLE_COPY(QWindowsContext) +public: + enum SystemInfoFlags + { + SI_RTL_Extensions = 0x1, + SI_SupportsTouch = 0x2 + }; + + // Verbose flag set by environment variable QT_LIGHTHOUSE_WINDOWS_VERBOSE + static int verboseIntegration; + static int verboseWindows; + static int verboseBackingStore; + static int verboseEvents; + static int verboseFonts; + static int verboseGL; + static int verboseOLE; + static int verboseInputMethods; + + explicit QWindowsContext(bool isOpenGL); + ~QWindowsContext(); + + bool isOpenGL() const; + + int defaultDPI() const; + + QString registerWindowClass(const QWindow *w, bool isGL); + QString registerWindowClass(QString cname, WNDPROC proc, + unsigned style = 0, HBRUSH brush = 0, + bool icon = false); + HWND createDummyWindow(const QString &classNameIn, + const wchar_t *windowName, + WNDPROC wndProc = 0, DWORD style = WS_OVERLAPPED); + + HDC displayContext() const; + int screenDepth() const; + + static QWindowsContext *instance(); + + static QString windowsErrorMessage(unsigned long errorCode); + + void addWindow(HWND, QWindowsWindow *w); + void removeWindow(HWND); + + QWindowsWindow *findPlatformWindow(HWND) const; + QWindow *findWindow(HWND) const; + QWindowsWindow *findPlatformWindowAt(HWND parent, const QPoint &screenPoint, + unsigned cwex_flags) const; + + QWindow *windowUnderMouse() const; + + inline bool windowsProc(HWND hwnd, UINT message, + QtWindows::WindowsEventType et, + WPARAM wParam, LPARAM lParam, LRESULT *result); + + QWindow *keyGrabber() const; + void setKeyGrabber(QWindow *hwnd); + + void setWindowCreationContext(const QSharedPointer &ctx); + + // Returns a combination of SystemInfoFlags + unsigned systemInfo() const; + + QWindowsMimeConverter &mimeConverter() const; + + static QWindowsUser32DLL user32dll; + + static QByteArray comErrorString(HRESULT hr); + +private: + void unregisterWindowClasses(); + + QScopedPointer d; + static QWindowsContext *m_instance; +}; + +extern "C" LRESULT QT_WIN_CALLBACK qWindowsWndProc(HWND, UINT, WPARAM, LPARAM); + +QT_END_NAMESPACE + +#endif // QWINDOWSCONTEXT_H diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp new file mode 100644 index 00000000000..1ad20799621 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -0,0 +1,451 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowscursor.h" +#include "qwindowscontext.h" +#include "qwindowswindow.h" +#include "qwindowsscreen.h" +#include "pixmaputils.h" + +#include +#include +#include +#include +#include +#include // getPixmapCursor() + +#include +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QWindowsCursor + \brief Platform cursor implementation + + Note that whereas under X11, a cursor can be set as a property of + a window, there is only a global SetCursor() function on Windows. + Each Window sets on the global cursor on receiving a Enter-event + as do the Window manager frames (resize/move handles). + + \ingroup qt-lighthouse-win + \sa QWindowsWindowCursor +*/ + +QWindowsCursor::QWindowsCursor(QPlatformScreen *s) : + QPlatformCursor(s) +{ +} + +HCURSOR QWindowsCursor::createPixmapCursor(const QPixmap &pixmap, int hotX, int hotY) +{ + HCURSOR cur = 0; + QBitmap mask = pixmap.mask(); + if (mask.isNull()) { + mask = QBitmap(pixmap.size()); + mask.fill(Qt::color1); + } + + HBITMAP ic = qPixmapToWinHBITMAP(pixmap, HBitmapAlpha); + const HBITMAP im = createIconMask(mask); + + ICONINFO ii; + ii.fIcon = 0; + ii.xHotspot = hotX; + ii.yHotspot = hotY; + ii.hbmMask = im; + ii.hbmColor = ic; + + cur = CreateIconIndirect(&ii); + + DeleteObject(ic); + DeleteObject(im); + return cur; +} + +HCURSOR QWindowsCursor::createSystemCursor(const QCursor &c) +{ + int hx = c.hotSpot().x(); + int hy = c.hotSpot().y(); + const Qt::CursorShape cshape = c.shape(); + if (cshape == Qt::BitmapCursor) { + const QPixmap pixmap = c.pixmap(); + if (!pixmap.isNull()) + if (const HCURSOR hc = createPixmapCursor(pixmap, hx, hy)) + return hc; + } + + // Non-standard Windows cursors are created from bitmaps + + 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 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 phand_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, + 0x80, 0x04, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, + 0x80, 0x1c, 0x00, 0x00, 0x80, 0xe4, 0x00, 0x00, 0x80, 0x24, 0x03, 0x00, + 0x80, 0x24, 0x05, 0x00, 0xb8, 0x24, 0x09, 0x00, 0xc8, 0x00, 0x09, 0x00, + 0x88, 0x00, 0x08, 0x00, 0x90, 0x00, 0x08, 0x00, 0xa0, 0x00, 0x08, 0x00, + 0x20, 0x00, 0x08, 0x00, 0x40, 0x00, 0x08, 0x00, 0x40, 0x00, 0x04, 0x00, + 0x80, 0x00, 0x04, 0x00, 0x80, 0x00, 0x04, 0x00, 0x00, 0x01, 0x02, 0x00, + 0x00, 0x01, 0x02, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, + 0x80, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, + 0x80, 0x1f, 0x00, 0x00, 0x80, 0xff, 0x00, 0x00, 0x80, 0xff, 0x03, 0x00, + 0x80, 0xff, 0x07, 0x00, 0xb8, 0xff, 0x0f, 0x00, 0xf8, 0xff, 0x0f, 0x00, + 0xf8, 0xff, 0x0f, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0xe0, 0xff, 0x0f, 0x00, + 0xe0, 0xff, 0x0f, 0x00, 0xc0, 0xff, 0x0f, 0x00, 0xc0, 0xff, 0x07, 0x00, + 0x80, 0xff, 0x07, 0x00, 0x80, 0xff, 0x07, 0x00, 0x00, 0xff, 0x03, 0x00, + 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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 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, + 0xf6,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}; + + static const uchar * const cursor_bits32[] = { + vsplit_bits, vsplitm_bits, hsplit_bits, hsplitm_bits, + phand_bits, phandm_bits + }; + + wchar_t *sh = 0; + switch (c.shape()) { // map to windows cursor + case Qt::ArrowCursor: + sh = IDC_ARROW; + break; + case Qt::UpArrowCursor: + sh = IDC_UPARROW; + break; + case Qt::CrossCursor: + sh = IDC_CROSS; + break; + case Qt::WaitCursor: + sh = IDC_WAIT; + break; + case Qt::IBeamCursor: + sh = IDC_IBEAM; + break; + case Qt::SizeVerCursor: + sh = IDC_SIZENS; + break; + case Qt::SizeHorCursor: + sh = IDC_SIZEWE; + break; + case Qt::SizeBDiagCursor: + sh = IDC_SIZENESW; + break; + case Qt::SizeFDiagCursor: + sh = IDC_SIZENWSE; + break; + case Qt::SizeAllCursor: + sh = IDC_SIZEALL; + break; + case Qt::ForbiddenCursor: + sh = IDC_NO; + break; + case Qt::WhatsThisCursor: + sh = IDC_HELP; + break; + case Qt::BusyCursor: + sh = IDC_APPSTARTING; + break; + case Qt::PointingHandCursor: + sh = IDC_HAND; + break; + case Qt::BlankCursor: + case Qt::SplitVCursor: + case Qt::SplitHCursor: + case Qt::OpenHandCursor: + case Qt::ClosedHandCursor: + case Qt::BitmapCursor: { + QImage bbits, mbits; + bool invb, invm; + if (cshape == Qt::BlankCursor) { + bbits = QImage(32, 32, QImage::Format_Mono); + bbits.fill(0); // ignore color table + mbits = bbits.copy(); + hx = hy = 16; + invb = invm = false; + } else if (cshape == Qt::OpenHandCursor || cshape == Qt::ClosedHandCursor) { + bool open = cshape == Qt::OpenHandCursor; + QBitmap cb = QBitmap::fromData(QSize(16, 16), open ? openhand_bits : closedhand_bits); + QBitmap cm = QBitmap::fromData(QSize(16, 16), open ? openhandm_bits : closedhandm_bits); + bbits = cb.toImage().convertToFormat(QImage::Format_Mono); + mbits = cm.toImage().convertToFormat(QImage::Format_Mono); + hx = hy = 8; + invb = invm = false; + } else if (cshape != Qt::BitmapCursor) { + int i = cshape - Qt::SplitVCursor; + QBitmap cb = QBitmap::fromData(QSize(32, 32), cursor_bits32[i * 2]); + QBitmap cm = QBitmap::fromData(QSize(32, 32), cursor_bits32[i * 2 + 1]); + bbits = cb.toImage().convertToFormat(QImage::Format_Mono); + mbits = cm.toImage().convertToFormat(QImage::Format_Mono); + if (cshape == Qt::PointingHandCursor) { + hx = 7; + hy = 0; + } else + hx = hy = 16; + invb = invm = false; + } else { + bbits = c.bitmap()->toImage().convertToFormat(QImage::Format_Mono); + mbits = c.mask()->toImage().convertToFormat(QImage::Format_Mono); + invb = bbits.colorCount() > 1 && qGray(bbits.color(0)) < qGray(bbits.color(1)); + invm = mbits.colorCount() > 1 && qGray(mbits.color(0)) < qGray(mbits.color(1)); + } + const int n = qMax(1, bbits.width() / 8); + const int h = bbits.height(); + QScopedArrayPointer xBits(new uchar[h * n]); + QScopedArrayPointer xMask(new uchar[h * n]); + int x = 0; + for (int i = 0; i < h; ++i) { + uchar *bits = bbits.scanLine(i); + uchar *mask = mbits.scanLine(i); + for (int j = 0; j < n; ++j) { + uchar b = bits[j]; + uchar m = mask[j]; + if (invb) + b ^= 0xff; + if (invm) + m ^= 0xff; + xBits[x] = ~m; + xMask[x] = b ^ m; + ++x; + } + } + return CreateCursor(GetModuleHandle(0), hx, hy, bbits.width(), bbits.height(), + xBits.data(), xMask.data()); + } + case Qt::DragCopyCursor: + case Qt::DragMoveCursor: + case Qt::DragLinkCursor: { + const QPixmap pixmap = QGuiApplicationPrivate::instance()->getPixmapCursor(cshape); + return createPixmapCursor(pixmap, hx, hy); + } + default: + qWarning("%s: Invalid cursor shape %d", __FUNCTION__, cshape); + return 0; + } + return (HCURSOR)LoadImage(0, sh, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED); +} + +/*! + \brief Return cached standard cursor resources or create new ones. +*/ + +QWindowsWindowCursor QWindowsCursor::standardWindowCursor(Qt::CursorShape shape) +{ + StandardCursorCache::iterator it = m_standardCursorCache.find(shape); + if (it == m_standardCursorCache.end()) + it = m_standardCursorCache.insert(shape, QWindowsWindowCursor(QCursor(shape))); + return it.value(); +} + +/*! + \brief Set a cursor on a window. + + This is called frequently as the mouse moves over widgets in the window + (QLineEdits, etc). +*/ + +void QWindowsCursor::changeCursor(QCursor *cursorIn, QWindow *window) +{ + + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << cursorIn << window; + if (!cursorIn || !window) + return; + const QWindowsWindowCursor wcursor = + cursorIn->shape() == Qt::BitmapCursor ? + QWindowsWindowCursor(*cursorIn) : standardWindowCursor(cursorIn->shape()); + if (wcursor.handle()) { + QWindowsWindow::baseWindowOf(window)->setCursor(wcursor); + } else { + qWarning("%s: Unable to obtain system cursor for %d", + __FUNCTION__, cursorIn->shape()); + } +} + +QPoint QWindowsCursor::mousePosition() +{ + POINT p; + GetCursorPos(&p); + if (QWindowsContext::verboseWindows) + qDebug("%s %ld,%ld", __FUNCTION__, p.x, p.y); + return QPoint(p.x, p.y); +} + +void QWindowsCursor::setPos(const QPoint &pos) +{ + if (QWindowsContext::verboseWindows) + qDebug("%s %d,%d", __FUNCTION__, pos.x(), pos.y()); + SetCursorPos(pos.x(), pos.y()); +} + +/*! + \class QWindowsWindowCursor + \brief Per-Window cursor. Contains a QCursor and manages its associated system + cursor handle resource. + + Based on QSharedDataPointer, so that it can be passed around and + used as a property of QWindowsBaseWindow. + + \ingroup qt-lighthouse-win + \sa QWindowsCursor +*/ + +class QWindowsWindowCursorData : public QSharedData +{ +public: + explicit QWindowsWindowCursorData(const QCursor &c); + ~QWindowsWindowCursorData(); + + const QCursor m_cursor; + const HCURSOR m_handle; +}; + +QWindowsWindowCursorData::QWindowsWindowCursorData(const QCursor &c) : + m_cursor(c), + m_handle(QWindowsCursor::createSystemCursor(c)) +{ +} + +QWindowsWindowCursorData::~QWindowsWindowCursorData() +{ + DestroyCursor(m_handle); +} + +QWindowsWindowCursor::QWindowsWindowCursor(const QCursor &c) : + m_data(new QWindowsWindowCursorData(c)) +{ +} + +QWindowsWindowCursor::~QWindowsWindowCursor() +{ +} + +QWindowsWindowCursor::QWindowsWindowCursor(const QWindowsWindowCursor &rhs) : + m_data(rhs.m_data) +{ +} + +QWindowsWindowCursor & QWindowsWindowCursor::operator =(const QWindowsWindowCursor &rhs) +{ + if (this != &rhs) + m_data.operator =(rhs.m_data); + return *this; +} + +QCursor QWindowsWindowCursor::cursor() const +{ + return m_data->m_cursor; +} + +HCURSOR QWindowsWindowCursor::handle() const +{ + return m_data->m_handle; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h new file mode 100644 index 00000000000..bf8cb837d94 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowscursor.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSCURSOR_H +#define QWINDOWSCURSOR_H + +#include "qtwindows_additional.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QWindowsWindowCursorData; + +class QWindowsWindowCursor +{ +public: + explicit QWindowsWindowCursor(const QCursor &c); + ~QWindowsWindowCursor(); + QWindowsWindowCursor(const QWindowsWindowCursor &c); + QWindowsWindowCursor &operator=(const QWindowsWindowCursor &c); + + QCursor cursor() const; + HCURSOR handle() const; + +private: + QSharedDataPointer m_data; +}; + +class QWindowsCursor : public QPlatformCursor +{ +public: + explicit QWindowsCursor(QPlatformScreen *); + + virtual void changeCursor(QCursor * widgetCursor, QWindow * widget); + virtual QPoint pos() const { return mousePosition(); } + virtual void setPos(const QPoint &pos); + + static HCURSOR createPixmapCursor(const QPixmap &pixmap, int hotX, int hotY); + static HCURSOR createSystemCursor(const QCursor &c); + static QPoint mousePosition(); + + QWindowsWindowCursor standardWindowCursor(Qt::CursorShape s = Qt::ArrowCursor); + +private: + typedef QHash StandardCursorCache; + + StandardCursorCache m_standardCursorCache; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSCURSOR_H diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp new file mode 100644 index 00000000000..1535437a32d --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsdrag.cpp @@ -0,0 +1,721 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsdrag.h" +#include "qwindowscontext.h" +#include "qwindowsclipboard.h" +#include "qwindowsintegration.h" +#include "qwindowsole.h" +#include "qtwindows_additional.h" +#include "qwindowswindow.h" +#include "qwindowsmousehandler.h" +#include "qwindowscursor.h" + +#include +#include +#include +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QWindowsDropMimeData + \brief Special mime data class for data retrieval from Drag operations. + + Implementation of QWindowsInternalMimeDataBase which retrieves the + current drop data object from QWindowsDrag. + + \sa QWindowsDrag + \ingroup qt-lighthouse-win +*/ + +IDataObject *QWindowsDropMimeData::retrieveDataObject() const +{ + return QWindowsDrag::instance()->dropDataObject(); +} + +static inline Qt::DropActions translateToQDragDropActions(DWORD pdwEffects) +{ + Qt::DropActions actions = Qt::IgnoreAction; + if (pdwEffects & DROPEFFECT_LINK) + actions |= Qt::LinkAction; + if (pdwEffects & DROPEFFECT_COPY) + actions |= Qt::CopyAction; + if (pdwEffects & DROPEFFECT_MOVE) + actions |= Qt::MoveAction; + return actions; +} + +static inline Qt::DropAction translateToQDragDropAction(DWORD pdwEffect) +{ + if (pdwEffect & DROPEFFECT_LINK) + return Qt::LinkAction; + if (pdwEffect & DROPEFFECT_COPY) + return Qt::CopyAction; + if (pdwEffect & DROPEFFECT_MOVE) + return Qt::MoveAction; + return Qt::IgnoreAction; +} + +static inline DWORD translateToWinDragEffects(Qt::DropActions action) +{ + DWORD effect = DROPEFFECT_NONE; + if (action & Qt::LinkAction) + effect |= DROPEFFECT_LINK; + if (action & Qt::CopyAction) + effect |= DROPEFFECT_COPY; + if (action & Qt::MoveAction) + effect |= DROPEFFECT_MOVE; + return effect; +} + +static inline Qt::KeyboardModifiers toQtKeyboardModifiers(DWORD keyState) +{ + Qt::KeyboardModifiers modifiers = Qt::NoModifier; + + if (keyState & MK_SHIFT) + modifiers |= Qt::ShiftModifier; + if (keyState & MK_CONTROL) + modifiers |= Qt::ControlModifier; + if (keyState & MK_ALT) + modifiers |= Qt::AltModifier; + + return modifiers; +} + +/*! + \class QWindowsOleDropSource + \brief Implementation of IDropSource + + Used for drag operations. + + \sa QWindowsDrag + \ingroup qt-lighthouse-win +*/ + +class QWindowsOleDropSource : public IDropSource +{ +public: + QWindowsOleDropSource(); + virtual ~QWindowsOleDropSource(); + + void createCursors(); + + // IUnknown methods + STDMETHOD(QueryInterface)(REFIID riid, void ** ppvObj); + STDMETHOD_(ULONG,AddRef)(void); + STDMETHOD_(ULONG,Release)(void); + + // IDropSource methods + STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD grfKeyState); + STDMETHOD(GiveFeedback)(DWORD dwEffect); + +private: + typedef QMap ActionCursorMap; + + inline void clearCursors(); + + Qt::MouseButtons m_currentButtons; + Qt::DropAction m_currentAction; + ActionCursorMap m_cursors; + + ULONG m_refs; +}; + +QWindowsOleDropSource::QWindowsOleDropSource() : + m_currentButtons(Qt::NoButton), m_currentAction(Qt::IgnoreAction), + m_refs(1) +{ + if (QWindowsContext::verboseOLE) + qDebug("%s", __FUNCTION__); +} + +QWindowsOleDropSource::~QWindowsOleDropSource() +{ + clearCursors(); + if (QWindowsContext::verboseOLE) + qDebug("%s", __FUNCTION__); +} + +void QWindowsOleDropSource::createCursors() +{ + QDragManager *manager = QDragManager::self(); + if (!manager || !manager->object) + return; + const QPixmap pixmap = manager->object->pixmap(); + const bool hasPixmap = !pixmap.isNull(); + if (!hasPixmap && manager->dragPrivate()->customCursors.isEmpty()) + return; + + QList actions; + actions << Qt::MoveAction << Qt::CopyAction << Qt::LinkAction; + if (hasPixmap) + actions << Qt::IgnoreAction; + const QPoint hotSpot = manager->object->hotSpot(); + for (int cnum = 0; cnum < actions.size(); ++cnum) { + const QPixmap cpm = manager->dragCursor(actions.at(cnum)); + int w = cpm.width(); + int h = cpm.height(); + + if (hasPixmap) { + const int x1 = qMin(-hotSpot.x(), 0); + const int x2 = qMax(pixmap.width() - hotSpot.x(), cpm.width()); + const int y1 = qMin(-hotSpot.y(), 0); + const int y2 = qMax(pixmap.height() - hotSpot.y(), cpm.height()); + + w = x2 - x1 + 1; + h = y2 - y1 + 1; + } + + const QRect srcRect = pixmap.rect(); + const QPoint pmDest = QPoint(qMax(0, -hotSpot.x()), qMax(0, -hotSpot.y())); + const QPoint newHotSpot = hotSpot; + QPixmap newCursor(w, h); + if (hasPixmap) { + newCursor.fill(QColor(0, 0, 0, 0)); + QPainter p(&newCursor); + p.drawPixmap(pmDest, pixmap, srcRect); + p.drawPixmap(qMax(0,newHotSpot.x()),qMax(0,newHotSpot.y()),cpm); + } else { + newCursor = cpm; + } + + const int hotX = hasPixmap ? qMax(0,newHotSpot.x()) : 0; + const int hotY = hasPixmap ? qMax(0,newHotSpot.y()) : 0; + + if (const HCURSOR sysCursor = QWindowsCursor::createPixmapCursor(newCursor, hotX, hotY)) + m_cursors.insert(actions.at(cnum), sysCursor); + } + if (QWindowsContext::verboseOLE) + qDebug("%s %d cursors", __FUNCTION__, m_cursors.size()); +} + +void QWindowsOleDropSource::clearCursors() +{ + if (!m_cursors.isEmpty()) { + const ActionCursorMap::const_iterator cend = m_cursors.constEnd(); + for (ActionCursorMap::const_iterator it = m_cursors.constBegin(); it != cend; ++it) + DestroyCursor(it.value()); + m_cursors.clear(); + } +} + +//--------------------------------------------------------------------- +// IUnknown Methods +//--------------------------------------------------------------------- + +STDMETHODIMP +QWindowsOleDropSource::QueryInterface(REFIID iid, void FAR* FAR* ppv) +{ + if (iid == IID_IUnknown || iid == IID_IDropSource) { + *ppv = this; + ++m_refs; + return NOERROR; + } + *ppv = NULL; + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP_(ULONG) +QWindowsOleDropSource::AddRef(void) +{ + return ++m_refs; +} + +STDMETHODIMP_(ULONG) +QWindowsOleDropSource::Release(void) +{ + if (--m_refs == 0) { + delete this; + return 0; + } + return m_refs; +} + +/*! + \brief Check for cancel. +*/ + +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP +QWindowsOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) +{ + HRESULT hr = S_OK; + do { + if (fEscapePressed || QWindowsDrag::instance()->dragBeingCancelled()) { + hr = ResultFromScode(DRAGDROP_S_CANCEL); + break; + } + + // grfKeyState is broken on CE & some Windows XP versions, + // therefore we need to check the state manually + if ((GetAsyncKeyState(VK_LBUTTON) == 0) + && (GetAsyncKeyState(VK_MBUTTON) == 0) + && (GetAsyncKeyState(VK_RBUTTON) == 0)) { + hr = ResultFromScode(DRAGDROP_S_DROP); + break; + } + + const Qt::MouseButtons buttons = QWindowsMouseHandler::keyStateToMouseButtons(grfKeyState); + if (m_currentButtons == Qt::NoButton) { + m_currentButtons = buttons; + } else { + // Button changed: Complete Drop operation. + if (!(m_currentButtons & buttons)) { + hr = ResultFromScode(DRAGDROP_S_DROP); + break; + } + } + + QGuiApplication::processEvents(); + + } while (false); + + QDragManager::self()->willDrop = hr == DRAGDROP_S_DROP; + + if (QWindowsContext::verboseOLE + && (QWindowsContext::verboseOLE > 1 || hr != S_OK)) + qDebug("%s fEscapePressed=%d, grfKeyState=%lu buttons=%d willDrop = %d returns 0x%x", + __FUNCTION__, fEscapePressed,grfKeyState, int(m_currentButtons), + QDragManager::self()->willDrop, int(hr)); + return hr; +} + +/*! + \brief Give feedback: Change cursor accoding to action. +*/ + +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP +QWindowsOleDropSource::GiveFeedback(DWORD dwEffect) +{ + const Qt::DropAction action = translateToQDragDropAction(dwEffect); + + if (QWindowsContext::verboseOLE > 2) + qDebug("%s dwEffect=%lu, action=%d", __FUNCTION__, dwEffect, action); + + if (m_currentAction != action) { + m_currentAction = action; + QDragManager::self()->emitActionChanged(m_currentAction); + } + + const ActionCursorMap::const_iterator it = m_cursors.constFind(m_currentAction); + if (it != m_cursors.constEnd()) { + SetCursor(it.value()); + return ResultFromScode(S_OK); + } + + return ResultFromScode(DRAGDROP_S_USEDEFAULTCURSORS); +} + +/*! + \class QWindowsOleDropTarget + \brief Implementation of IDropTarget + + To be registered for each window. Currently, drop sites + are enabled for top levels. The child window handling + (sending DragEnter/Leave, etc) is handled in here. + + \sa QWindowsDrag + \ingroup qt-lighthouse-win +*/ + +QWindowsOleDropTarget::QWindowsOleDropTarget(QWindow *w) : + m_refs(1), m_window(w), m_currentWindow(0), m_chosenEffect(0), m_lastKeyState(0) +{ + if (QWindowsContext::verboseOLE) + qDebug() << __FUNCTION__ << this << w; +} + +QWindowsOleDropTarget::~QWindowsOleDropTarget() +{ + if (QWindowsContext::verboseOLE) + qDebug("%s %p", __FUNCTION__, this); +} + +STDMETHODIMP +QWindowsOleDropTarget::QueryInterface(REFIID iid, void FAR* FAR* ppv) +{ + if (iid == IID_IUnknown || iid == IID_IDropTarget) { + *ppv = this; + AddRef(); + return NOERROR; + } + *ppv = NULL; + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP_(ULONG) +QWindowsOleDropTarget::AddRef(void) +{ + return ++m_refs; +} + +STDMETHODIMP_(ULONG) +QWindowsOleDropTarget::Release(void) +{ + if (--m_refs == 0) { + delete this; + return 0; + } + return m_refs; +} + +QWindow *QWindowsOleDropTarget::findDragOverWindow(const POINTL &pt) const +{ + if (QWindowsWindow *child = + QWindowsWindow::baseWindowOf(m_window)->childAtScreenPoint(QPoint(pt.x, pt.y))) + return child->window(); + return m_window; +} + +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP +QWindowsOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, + POINTL pt, LPDWORD pdwEffect) +{ + if (QWindowsContext::verboseOLE) + qDebug("%s widget=%p key=%lu, pt=%ld,%ld", __FUNCTION__, m_window, grfKeyState, pt.x, pt.y); + + QWindowsDrag::instance()->setDropDataObject(pDataObj); + pDataObj->AddRef(); + m_currentWindow = m_window; + sendDragEnterEvent(m_window, grfKeyState, pt, pdwEffect); + *pdwEffect = m_chosenEffect; + return NOERROR; +} + +void QWindowsOleDropTarget::sendDragEnterEvent(QWindow *dragEnterWidget, + DWORD grfKeyState, + POINTL pt, LPDWORD pdwEffect) +{ + Q_ASSERT(dragEnterWidget); + + m_lastPoint = QWindowsGeometryHint::mapFromGlobal(dragEnterWidget, QPoint(pt.x,pt.y)); + m_lastKeyState = grfKeyState; + + m_chosenEffect = DROPEFFECT_NONE; + + QDragManager *manager = QDragManager::self(); + QMimeData *md = manager->dropData(); + const Qt::MouseButtons mouseButtons + = QWindowsMouseHandler::keyStateToMouseButtons(grfKeyState); + const Qt::DropActions actions = translateToQDragDropActions(*pdwEffect); + const Qt::KeyboardModifiers keyMods = toQtKeyboardModifiers(grfKeyState); + QDragEnterEvent enterEvent(m_lastPoint, actions, md, mouseButtons, keyMods); + QGuiApplication::sendEvent(m_currentWindow, &enterEvent); + m_answerRect = enterEvent.answerRect(); + if (QWindowsContext::verboseOLE) + qDebug() << __FUNCTION__ << " sent drag enter to " << m_window + << *md << " actions=" << actions + << " mods=" << keyMods << " accepted: " + << enterEvent.isAccepted(); + + if (enterEvent.isAccepted()) + m_chosenEffect = translateToWinDragEffects(enterEvent.dropAction()); + // Documentation states that a drag move event is sent immediately after + // a drag enter event. This will honor widgets overriding dragMoveEvent only: + if (enterEvent.isAccepted()) { + QDragMoveEvent moveEvent(m_lastPoint, actions, md, mouseButtons, keyMods); + m_answerRect = enterEvent.answerRect(); + moveEvent.setDropAction(enterEvent.dropAction()); + moveEvent.accept(); // accept by default, since enter event was accepted. + + QGuiApplication::sendEvent(dragEnterWidget, &moveEvent); + if (moveEvent.isAccepted()) { + m_answerRect = moveEvent.answerRect(); + m_chosenEffect = translateToWinDragEffects(moveEvent.dropAction()); + } else { + m_chosenEffect = DROPEFFECT_NONE; + } + } +} + +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP +QWindowsOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) +{ + QWindow *dragOverWindow = findDragOverWindow(pt); + + const QPoint tmpPoint = QWindowsGeometryHint::mapFromGlobal(dragOverWindow, QPoint(pt.x,pt.y)); + // see if we should compress this event + if ((tmpPoint == m_lastPoint || m_answerRect.contains(tmpPoint)) + && m_lastKeyState == grfKeyState) { + *pdwEffect = m_chosenEffect; + return NOERROR; + } + + if (QWindowsContext::verboseOLE > 1) + qDebug().nospace() << '>' << __FUNCTION__ << ' ' << m_window << " current " + << dragOverWindow << " key=" << grfKeyState + << " pt=" < dragOverWindowGuard(dragOverWindow); + // Send drag leave event to the previous drag widget. + // Drag-Over widget might be deleted in DragLeave, + // (tasktracker 218353). + QDragLeaveEvent dragLeave; + if (m_currentWindow) + QGuiApplication::sendEvent(m_currentWindow, &dragLeave); + if (!dragOverWindowGuard) { + dragOverWindow = findDragOverWindow(pt); + } + // Send drag enter event to the current drag widget. + m_currentWindow = dragOverWindow; + sendDragEnterEvent(dragOverWindow, grfKeyState, pt, pdwEffect); + } + + QDragManager *manager = QDragManager::self(); + QMimeData *md = manager->dropData(); + + const Qt::DropActions actions = translateToQDragDropActions(*pdwEffect); + + QDragMoveEvent oldEvent(m_lastPoint, actions, md, + QWindowsMouseHandler::keyStateToMouseButtons(m_lastKeyState), + toQtKeyboardModifiers(m_lastKeyState)); + + m_lastPoint = tmpPoint; + m_lastKeyState = grfKeyState; + + QDragMoveEvent e(tmpPoint, actions, md, + QWindowsMouseHandler::keyStateToMouseButtons(grfKeyState), + toQtKeyboardModifiers(grfKeyState)); + if (m_chosenEffect != DROPEFFECT_NONE) { + if (oldEvent.dropAction() == e.dropAction() && + oldEvent.keyboardModifiers() == e.keyboardModifiers()) + e.setDropAction(translateToQDragDropAction(m_chosenEffect)); + e.accept(); + } + QGuiApplication::sendEvent(dragOverWindow, &e); + + m_answerRect = e.answerRect(); + if (e.isAccepted()) + m_chosenEffect = translateToWinDragEffects(e.dropAction()); + else + m_chosenEffect = DROPEFFECT_NONE; + *pdwEffect = m_chosenEffect; + + if (QWindowsContext::verboseOLE > 1) + qDebug("<%s effect=0x%lx", __FUNCTION__, m_chosenEffect); + return NOERROR; +} + +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP +QWindowsOleDropTarget::DragLeave() +{ + if (QWindowsContext::verboseOLE) + qDebug().nospace() <<__FUNCTION__ << ' ' << m_window; + + m_currentWindow = 0; + QDragLeaveEvent e; + QGuiApplication::sendEvent(m_window, &e); + QWindowsDrag::instance()->releaseDropDataObject(); + + return NOERROR; +} + +#define KEY_STATE_BUTTON_MASK (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON) + +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP +QWindowsOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState, + POINTL pt, LPDWORD pdwEffect) +{ + QWindow *dropWindow = findDragOverWindow(pt); + + if (QWindowsContext::verboseOLE) + qDebug().nospace() << __FUNCTION__ << ' ' << m_window + << " on " << dropWindow + << " keys=" << grfKeyState << " pt=" + << pt.x << ',' << pt.y; + + m_lastPoint = QWindowsGeometryHint::mapFromGlobal(dropWindow, QPoint(pt.x,pt.y)); + // grfKeyState does not all ways contain button state in the drop so if + // it doesn't then use the last known button state; + if ((grfKeyState & KEY_STATE_BUTTON_MASK) == 0) + grfKeyState |= m_lastKeyState & KEY_STATE_BUTTON_MASK; + m_lastKeyState = grfKeyState; + + QWindowsDrag *windowsDrag = QWindowsDrag::instance(); + QDragManager *manager = QDragManager::self(); + QMimeData *md = manager->dropData(); + QDropEvent e(m_lastPoint, translateToQDragDropActions(*pdwEffect), md, + QWindowsMouseHandler::keyStateToMouseButtons(grfKeyState), + toQtKeyboardModifiers(grfKeyState)); + if (m_chosenEffect != DROPEFFECT_NONE) + e.setDropAction(translateToQDragDropAction(m_chosenEffect)); + + QGuiApplication::sendEvent(dropWindow, &e); + if (m_chosenEffect != DROPEFFECT_NONE) + e.accept(); + + if (e.isAccepted()) { + if (e.dropAction() == Qt::MoveAction || e.dropAction() == Qt::TargetMoveAction) { + if (e.dropAction() == Qt::MoveAction) + m_chosenEffect = DROPEFFECT_MOVE; + else + m_chosenEffect = DROPEFFECT_COPY; + HGLOBAL hData = GlobalAlloc(0, sizeof(DWORD)); + if (hData) { + DWORD *moveEffect = (DWORD *)GlobalLock(hData);; + *moveEffect = DROPEFFECT_MOVE; + GlobalUnlock(hData); + STGMEDIUM medium; + memset(&medium, 0, sizeof(STGMEDIUM)); + medium.tymed = TYMED_HGLOBAL; + medium.hGlobal = hData; + FORMATETC format; + format.cfFormat = RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT); + format.tymed = TYMED_HGLOBAL; + format.ptd = 0; + format.dwAspect = 1; + format.lindex = -1; + windowsDrag->dropDataObject()->SetData(&format, &medium, true); + } + } else { + m_chosenEffect = translateToWinDragEffects(e.dropAction()); + } + } else { + m_chosenEffect = DROPEFFECT_NONE; + } + *pdwEffect = m_chosenEffect; + + windowsDrag->releaseDropDataObject(); + return NOERROR; +} + +/*! + \class QWindowsDrag + \brief Windows drag implementation. + + \ingroup qt-lighthouse-win +*/ + +QWindowsDrag::QWindowsDrag() : m_dropDataObject(0), m_dragBeingCancelled(false) +{ +} + +QWindowsDrag::~QWindowsDrag() +{ +} + +void QWindowsDrag::startDrag() +{ + // TODO: Accessibility handling? + QDragManager *dragManager = QDragManager::self(); + QMimeData *dropData = dragManager->dropData(); + m_dragBeingCancelled = false; + + DWORD resultEffect; + QWindowsOleDropSource *windowDropSource = new QWindowsOleDropSource(); + windowDropSource->createCursors(); + QWindowsOleDataObject *dropDataObject = new QWindowsOleDataObject(dropData); + const Qt::DropActions possibleActions = dragManager->possible_actions; + const DWORD allowedEffects = translateToWinDragEffects(possibleActions); + if (QWindowsContext::verboseOLE) + qDebug(">%s possible Actions=%x, effects=0x%lx", __FUNCTION__, + int(possibleActions), allowedEffects); + const HRESULT r = DoDragDrop(dropDataObject, windowDropSource, allowedEffects, &resultEffect); + const DWORD reportedPerformedEffect = dropDataObject->reportedPerformedEffect(); + Qt::DropAction ret = Qt::IgnoreAction; + if (r == DRAGDROP_S_DROP) { + if (reportedPerformedEffect == DROPEFFECT_MOVE && resultEffect != DROPEFFECT_MOVE) { + ret = Qt::TargetMoveAction; + resultEffect = DROPEFFECT_MOVE; + } else { + ret = translateToQDragDropAction(resultEffect); + } + // Force it to be a copy if an unsupported operation occurred. + // This indicates a bug in the drop target. + if (resultEffect != DROPEFFECT_NONE && !(resultEffect & allowedEffects)) + ret = Qt::CopyAction; + } else { + dragManager->setCurrentTarget(0); + } + + // clean up + dropDataObject->releaseQt(); + dropDataObject->Release(); // Will delete obj if refcount becomes 0 + windowDropSource->Release(); // Will delete src if refcount becomes 0 + if (QWindowsContext::verboseOLE) + qDebug("<%s allowedEffects=0x%lx, reportedPerformedEffect=0x%lx, resultEffect=0x%lx, hr=0x%x, dropAction=%d", + __FUNCTION__, allowedEffects, reportedPerformedEffect, resultEffect, int(r), ret); +} + +void QWindowsDrag::move(const QMouseEvent *me) +{ + const QPoint pos = me->pos(); + if (QWindowsContext::verboseOLE) + qDebug("%s %d %d", __FUNCTION__, pos.x(), pos.y()); +} + +void QWindowsDrag::drop(const QMouseEvent *me) +{ + const QPoint pos = me->pos(); + if (QWindowsContext::verboseOLE) + qDebug("%s %d %d", __FUNCTION__, pos.x(), pos.y()); +} + +void QWindowsDrag::cancel() +{ + // TODO: Accessibility handling? + if (QWindowsContext::verboseOLE) + qDebug("%s", __FUNCTION__); + m_dragBeingCancelled = true; +} + +QWindowsDrag *QWindowsDrag::instance() +{ + return static_cast(QWindowsIntegration::instance()->drag()); +} + +void QWindowsDrag::releaseDropDataObject() +{ + if (QWindowsContext::verboseOLE) + qDebug("%s %p", __FUNCTION__, m_dropDataObject); + if (m_dropDataObject) { + m_dropDataObject->Release(); + m_dropDataObject = 0; + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsdrag.h b/src/plugins/platforms/windows/qwindowsdrag.h new file mode 100644 index 00000000000..6e6ebe04242 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsdrag.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSDRAG_H +#define QWINDOWSDRAG_H + +#include "qwindowsinternalmimedata.h" + +#include + +QT_BEGIN_NAMESPACE + +class QWindowsDropMimeData : public QWindowsInternalMimeData { +public: + QWindowsDropMimeData() {} + virtual IDataObject *retrieveDataObject() const; +}; + +class QWindowsOleDropTarget : public IDropTarget +{ +public: + explicit QWindowsOleDropTarget(QWindow *w); + virtual ~QWindowsOleDropTarget(); + + // IUnknown methods + STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); + STDMETHOD_(ULONG, AddRef)(void); + STDMETHOD_(ULONG, Release)(void); + + // IDropTarget methods + STDMETHOD(DragEnter)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); + STDMETHOD(DragOver)(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); + STDMETHOD(DragLeave)(); + STDMETHOD(Drop)(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); + +private: + inline QWindow *findDragOverWindow(const POINTL &pt) const; + void sendDragEnterEvent(QWindow *to, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect); + + ULONG m_refs; + QWindow *const m_window; + QWindow *m_currentWindow; + QRect m_answerRect; + QPoint m_lastPoint; + DWORD m_chosenEffect; + DWORD m_lastKeyState; +}; + +class QWindowsDrag : public QPlatformDrag +{ +public: + QWindowsDrag(); + virtual ~QWindowsDrag(); + + virtual QMimeData *platformDropData() { return &m_dropData; } + + virtual void startDrag(); + virtual void move(const QMouseEvent *me); + virtual void drop(const QMouseEvent *me); + virtual void cancel(); + + static QWindowsDrag *instance(); + + IDataObject *dropDataObject() const { return m_dropDataObject; } + void setDropDataObject(IDataObject *dataObject) { m_dropDataObject = dataObject; } + void releaseDropDataObject(); + + bool dragBeingCancelled() const { return m_dragBeingCancelled; } + +private: + QWindowsDropMimeData m_dropData; + IDataObject *m_dropDataObject; + bool m_dragBeingCancelled; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSDRAG_H diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp new file mode 100644 index 00000000000..ea35ab5f9fa --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -0,0 +1,950 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsfontdatabase.h" +#include "qwindowscontext.h" +#include "qwindowsfontengine.h" +#include "qwindowsfontenginedirectwrite.h" +#include "qtwindows_additional.h" + +#include +#include + +#include +#include + +#if !defined(QT_NO_DIRECTWRITE) +# include +# include +#endif + +QT_BEGIN_NAMESPACE + +/*! + \struct QWindowsFontEngineData + \brief Static constant data shared by the font engines. + \ingroup qt-lighthouse-win +*/ + +QWindowsFontEngineData::QWindowsFontEngineData() +#if !defined(QT_NO_DIRECTWRITE) + : directWriteFactory(0) + , directWriteGdiInterop(0) +#endif +{ + // from qapplication_win.cpp + UINT result = 0; + if (SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0)) + clearTypeEnabled = (result == FE_FONTSMOOTHINGCLEARTYPE); + + int winSmooth; + if (SystemParametersInfo(0x200C /* SPI_GETFONTSMOOTHINGCONTRAST */, 0, &winSmooth, 0)) { + fontSmoothingGamma = winSmooth / qreal(1000.0); + } else { + fontSmoothingGamma = 1.0; + } + + // Safeguard ourselves against corrupt registry values... + if (fontSmoothingGamma > 5 || fontSmoothingGamma < 1) + fontSmoothingGamma = qreal(1.4); + + const qreal gray_gamma = 2.31; + for (int i=0; i<256; ++i) + pow_gamma[i] = uint(qRound(qPow(i / qreal(255.), gray_gamma) * 2047)); + + HDC displayDC = GetDC(0); + hdc = CreateCompatibleDC(displayDC); + ReleaseDC(0, displayDC); +} + +QWindowsFontEngineData::~QWindowsFontEngineData() +{ + if (hdc) + ReleaseDC(0, hdc); +#if !defined(QT_NO_DIRECTWRITE) + if (directWriteGdiInterop) + directWriteGdiInterop->Release(); + if (directWriteFactory) + directWriteFactory->Release(); +#endif +} + +#if !defined(QT_NO_DIRECTWRITE) +static inline bool initDirectWrite(QWindowsFontEngineData *d) +{ + if (!d->directWriteFactory) { + const HRESULT hr = DWriteCreateFactory( + DWRITE_FACTORY_TYPE_SHARED, + __uuidof(IDWriteFactory), + reinterpret_cast(&d->directWriteFactory) + ); + if (FAILED(hr)) { + qErrnoWarning("%s: DWriteCreateFactory failed", __FUNCTION__); + return false; + } + } + if (!d->directWriteGdiInterop) { + const HRESULT hr = d->directWriteFactory->GetGdiInterop(&d->directWriteGdiInterop); + if (FAILED(hr)) { + qErrnoWarning("%s: GetGdiInterop failed", __FUNCTION__); + return false; + } + } + return true; +} + +#endif // !defined(QT_NO_DIRECTWRITE) + +/*! + \class QWindowsFontDatabase + \brief Font database for Windows + + \note The Qt 4.8 WIndows font database employed a mechanism of + delayed population of the database again passing a font name + to EnumFontFamiliesEx(), working around the fact that + EnumFontFamiliesEx() does not list all fonts by default. + This should be introduced to Lighthouse as well? + + \ingroup qt-lighthouse-win +*/ + +QDebug operator<<(QDebug d, const QFontDef &def) +{ + d.nospace() << "Family=" << def.family << " Stylename=" << def.styleName + << " pointsize=" << def.pointSize << " pixelsize=" << def.pixelSize + << " styleHint=" << def.styleHint << " weight=" << def.weight + << " stretch=" << def.stretch << " hintingPreference=" + << def.hintingPreference << ' '; + return d; +} + +/* From QFontDatabase.cpp, qt_determine_writing_systems_from_truetype_bits(). + * Fixme: Make public? */ + +// see the Unicode subset bitfields in the MSDN docs +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 }, +}; + +enum +{ + SimplifiedChineseCsbBit = 18, + TraditionalChineseCsbBit = 20, + JapaneseCsbBit = 17, + KoreanCsbBit = 21 +}; + +static inline void writingSystemsFromTrueTypeBits(quint32 unicodeRange[4], + quint32 codePageRange[2], + QSupportedWritingSystems *ws) +{ + bool hasScript = false; + for(int 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) { + ws->setSupported(QFontDatabase::WritingSystem(i), true); + hasScript = true; + } + } + } + if(codePageRange[0] & (1 << SimplifiedChineseCsbBit)) { + ws->setSupported(QFontDatabase::SimplifiedChinese, true); + hasScript = true; + } + if(codePageRange[0] & (1 << TraditionalChineseCsbBit)) { + ws->setSupported(QFontDatabase::TraditionalChinese, true); + hasScript = true; + } + if(codePageRange[0] & (1 << JapaneseCsbBit)) { + ws->setSupported(QFontDatabase::Japanese, true); + hasScript = true; + //qDebug("font %s supports Japanese", familyName.latin1()); + } + if(codePageRange[0] & (1 << KoreanCsbBit)) { + ws->setSupported(QFontDatabase::Korean, true); + hasScript = true; + } + if (!hasScript) + ws->setSupported(QFontDatabase::Symbol, true); +} + +// convert 0 ~ 1000 integer to QFont::Weight +static inline QFont::Weight weightFromInteger(long weight) +{ + if (weight < 400) + return QFont::Light; + if (weight < 600) + return QFont::Normal; + if (weight < 700) + return QFont::DemiBold; + if (weight < 800) + return QFont::Bold; + return QFont::Black; +} + +static inline QFontDatabase::WritingSystem writingSystemFromScript(const QString &scriptName) +{ + if (scriptName == QStringLiteral("Western") + || scriptName == QStringLiteral("Baltic") + || scriptName == QStringLiteral("Central European") + || scriptName == QStringLiteral("Turkish") + || scriptName == QStringLiteral("Vietnamese") + || scriptName == QStringLiteral("OEM/Dos")) + return QFontDatabase::Latin; + if (scriptName == QStringLiteral("Thai")) + return QFontDatabase::Thai; + if (scriptName == QStringLiteral("Symbol") + || scriptName == QStringLiteral("Other")) + return QFontDatabase::Symbol; + if (scriptName == QStringLiteral("CHINESE_GB2312")) + return QFontDatabase::SimplifiedChinese; + if (scriptName == QStringLiteral("CHINESE_BIG5")) + return QFontDatabase::TraditionalChinese; + if (scriptName == QStringLiteral("Cyrillic")) + return QFontDatabase::Cyrillic; + if (scriptName == QStringLiteral("Hangul")) + return QFontDatabase::Korean; + if (scriptName == QStringLiteral("Hebrew")) + return QFontDatabase::Hebrew; + if (scriptName == QStringLiteral("Greek")) + return QFontDatabase::Greek; + if (scriptName == QStringLiteral("Japanese")) + return QFontDatabase::Japanese; + if (scriptName == QStringLiteral("Arabic")) + return QFontDatabase::Arabic; + return QFontDatabase::Any; +} + +static bool addFontToDatabase(QString familyName, const QString &scriptName, + const TEXTMETRIC *textmetric, + const FONTSIGNATURE *signature, + int type) +{ + // the "@family" fonts are just the same as "family". Ignore them. + if (familyName.at(0) == QLatin1Char('@') || familyName.startsWith(QStringLiteral("WST_"))) + return false; + + static const int SMOOTH_SCALABLE = 0xffff; + const QString foundryName; // No such concept. + const NEWTEXTMETRIC *tm = (NEWTEXTMETRIC *)textmetric; + const bool fixed = !(tm->tmPitchAndFamily & TMPF_FIXED_PITCH); + const bool ttf = (tm->tmPitchAndFamily & TMPF_TRUETYPE); + const bool scalable = tm->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE); + const int size = scalable ? SMOOTH_SCALABLE : tm->tmHeight; + const QFont::Style style = tm->tmItalic ? QFont::StyleItalic : QFont::StyleNormal; + const bool antialias = false; + const QFont::Weight weight = weightFromInteger(tm->tmWeight); + const QFont::Stretch stretch = QFont::Unstretched; + + Q_UNUSED(fixed) + + if (QWindowsContext::verboseFonts > 2) { + QDebug nospace = qDebug().nospace(); + nospace << __FUNCTION__ << familyName << scriptName + << "TTF=" << ttf; + if (type & DEVICE_FONTTYPE) + nospace << " DEVICE"; + if (type & RASTER_FONTTYPE) + nospace << " RASTER"; + if (type & TRUETYPE_FONTTYPE) + nospace << " TRUETYPE"; + nospace << " scalable=" << scalable << " Size=" << size + << " Style=" << style << " Weight=" << weight + << " stretch=" << stretch; + } + +/* Fixme: omitted for the moment + if(ttf && localizedName(familyName) && family->english_name.isEmpty()) + family->english_name = getEnglishName(familyName); +*/ + QSupportedWritingSystems writingSystems; + if (type & TRUETYPE_FONTTYPE) { + quint32 unicodeRange[4] = { + signature->fsUsb[0], signature->fsUsb[1], + signature->fsUsb[2], signature->fsUsb[3] + }; + quint32 codePageRange[2] = { + signature->fsCsb[0], signature->fsCsb[1] + }; + writingSystemsFromTrueTypeBits(unicodeRange, codePageRange, &writingSystems); + // ### Hack to work around problem with Thai text on Windows 7. Segoe UI contains + // the symbol for Baht, and Windows thus reports that it supports the Thai script. + // Since it's the default UI font on this platform, most widgets will be unable to + // display Thai text by default. As a temporary work around, we special case Segoe UI + // and remove the Thai script from its list of supported writing systems. + if (writingSystems.supported(QFontDatabase::Thai) && + familyName == QStringLiteral("Segoe UI")) + writingSystems.setSupported(QFontDatabase::Thai, false); + } else { + const QFontDatabase::WritingSystem ws = writingSystemFromScript(scriptName); + if (ws != QFontDatabase::Any) + writingSystems.setSupported(ws); + } + + QPlatformFontDatabase::registerFont(familyName, foundryName, weight, + style, stretch, antialias, scalable, size, writingSystems, 0); + // add fonts windows can generate for us: + if (weight <= QFont::DemiBold) + QPlatformFontDatabase::registerFont(familyName, foundryName, QFont::Bold, + style, stretch, antialias, scalable, size, writingSystems, 0); + if (style != QFont::StyleItalic) + QPlatformFontDatabase::registerFont(familyName, foundryName, weight, + QFont::StyleItalic, stretch, antialias, scalable, size, writingSystems, 0); + if (weight <= QFont::DemiBold && style != QFont::StyleItalic) + QPlatformFontDatabase::registerFont(familyName, foundryName, QFont::Bold, + QFont::StyleItalic, stretch, antialias, scalable, size, writingSystems, 0); + return true; +} + +static int CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, + int type, LPARAM namesSetIn) +{ + typedef QSet StringSet; + const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName); + const QString script = QString::fromWCharArray(f->elfScript); + + const FONTSIGNATURE signature = textmetric->ntmFontSig; + + // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is + // identical to a TEXTMETRIC except for the last four members, which we don't use + // anyway + if (addFontToDatabase(familyName, script, (TEXTMETRIC *)textmetric, &signature, type)) + reinterpret_cast(namesSetIn)->insert(familyName); + + // keep on enumerating + return 1; +} + +void QWindowsFontDatabase::populateFontDatabase() +{ + if (m_families.isEmpty()) { + QPlatformFontDatabase::populateFontDatabase(); + populate(); // Called multiple times. + // Work around EnumFontFamiliesEx() not listing the system font, see below. + const QString sysFontFamily = QGuiApplication::font().family(); + if (!m_families.contains(sysFontFamily)) + populate(sysFontFamily); + } +} + +/*! + \brief Populate font database using EnumFontFamiliesEx(). + + Normally, leaving the name empty should enumerate + all fonts, however, system fonts like "MS Shell Dlg 2" + are only found when specifying the name explicitly. +*/ + +void QWindowsFontDatabase::populate(const QString &family) + { + + if (QWindowsContext::verboseFonts) + qDebug() << __FUNCTION__ << m_families.size() << family; + + HDC dummy = GetDC(0); + LOGFONT lf; + lf.lfCharSet = DEFAULT_CHARSET; + if (family.size() >= LF_FACESIZE) { + qWarning("%s: Unable to enumerate family '%s'.", + __FUNCTION__, qPrintable(family)); + return; + } + wmemcpy(lf.lfFaceName, reinterpret_cast(family.utf16()), + family.size() + 1); + lf.lfPitchAndFamily = 0; + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, + (LPARAM)&m_families, 0); + ReleaseDC(0, dummy); +} + +QWindowsFontDatabase::QWindowsFontDatabase() : + m_fontEngineData(new QWindowsFontEngineData) +{ + if (QWindowsContext::verboseFonts) + qDebug() << __FUNCTION__ << "Clear type: " + << m_fontEngineData->clearTypeEnabled << "gamma: " + << m_fontEngineData->fontSmoothingGamma; +} + +QWindowsFontDatabase::~QWindowsFontDatabase() +{ +} + +QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, + QUnicodeTables::Script script, + void *handle) +{ + QFontEngine *fe = QWindowsFontDatabase::createEngine(script, fontDef, + 0, QWindowsContext::instance()->defaultDPI(), false, + QStringList(), m_fontEngineData); + if (QWindowsContext::verboseFonts) + qDebug() << __FUNCTION__ << "FONTDEF" << fontDef << script << fe << handle; + return fe; +} + +QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) +{ + QFontEngine *fe = QPlatformFontDatabase::fontEngine(fontData, pixelSize, hintingPreference); + if (QWindowsContext::verboseFonts) + qDebug() << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fe; + return fe; +} + +QStringList QWindowsFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const +{ + QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script); + if (!result.isEmpty()) + return result; + if (QWindowsContext::verboseFonts) + qDebug() << __FUNCTION__ << family << style << styleHint + << script << result << m_families.size(); + return result; +} + +QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) +{ + const QStringList result = QPlatformFontDatabase::addApplicationFont(fontData, fileName); + Q_UNIMPLEMENTED(); + return result; +} + +void QWindowsFontDatabase::releaseHandle(void *handle) +{ + if (handle && QWindowsContext::verboseFonts) + qDebug() << __FUNCTION__ << handle; +} + +QString QWindowsFontDatabase::fontDir() const +{ + const QString result = QPlatformFontDatabase::fontDir(); + if (QWindowsContext::verboseFonts) + qDebug() << __FUNCTION__ << result; + return result; +} + +HFONT QWindowsFontDatabase::systemFont() +{ + static const HFONT stock_sysfont = (HFONT)GetStockObject(SYSTEM_FONT); + return stock_sysfont; +} + +// Creation functions + +static inline bool scriptRequiresOpenType(int script) +{ + return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala) + || script == QUnicodeTables::Khmer || script == QUnicodeTables::Nko); +} + +static const char *other_tryFonts[] = { + "Arial", + "MS UI Gothic", + "Gulim", + "SimSun", + "PMingLiU", + "Arial Unicode MS", + 0 +}; + +static const char *jp_tryFonts [] = { + "MS UI Gothic", + "Arial", + "Gulim", + "SimSun", + "PMingLiU", + "Arial Unicode MS", + 0 +}; + +static const char *ch_CN_tryFonts [] = { + "SimSun", + "Arial", + "PMingLiU", + "Gulim", + "MS UI Gothic", + "Arial Unicode MS", + 0 +}; + +static const char *ch_TW_tryFonts [] = { + "PMingLiU", + "Arial", + "SimSun", + "Gulim", + "MS UI Gothic", + "Arial Unicode MS", + 0 +}; + +static const char *kr_tryFonts[] = { + "Gulim", + "Arial", + "PMingLiU", + "SimSun", + "MS UI Gothic", + "Arial Unicode MS", + 0 +}; + +static const char **tryFonts = 0; + +QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &request, + HDC fontHdc, int dpi, bool rawMode, + const QStringList &family_list, + const QSharedPointer &data) +{ + LOGFONT lf; + memset(&lf, 0, sizeof(LOGFONT)); + + const bool useDevice = (request.styleStrategy & QFont::PreferDevice) && fontHdc; + + const HDC hdc = useDevice ? fontHdc : data->hdc; + + bool stockFont = false; + bool preferClearTypeAA = false; + + HFONT hfont = 0; + +#if !defined(QT_NO_DIRECTWRITE) + bool useDirectWrite = (request.hintingPreference == QFont::PreferNoHinting) + || (request.hintingPreference == QFont::PreferVerticalHinting); + IDWriteFont *directWriteFont = 0; +#else + bool useDirectWrite = false; +#endif + + if (rawMode) { // will choose a stock font + int f = SYSTEM_FONT; + const QString fam = request.family.toLower(); + if (fam == QStringLiteral("default") || fam == QStringLiteral("system")) + f = SYSTEM_FONT; + else if (fam == QStringLiteral("system_fixed")) + f = SYSTEM_FIXED_FONT; + else if (fam == QStringLiteral("ansi_fixed")) + f = ANSI_FIXED_FONT; + else if (fam == QStringLiteral("ansi_var")) + f = ANSI_VAR_FONT; + else if (fam == QStringLiteral("device_default")) + f = DEVICE_DEFAULT_FONT; + else if (fam == QStringLiteral("oem_fixed")) + f = OEM_FIXED_FONT; + else if (fam.at(0) == QLatin1Char('#')) + f = fam.right(fam.length()-1).toInt(); + hfont = (HFONT)GetStockObject(f); + if (!hfont) { + qErrnoWarning("%s: GetStockObject failed", __FUNCTION__); + hfont = QWindowsFontDatabase::systemFont(); + } + stockFont = true; + } else { + int hint = FF_DONTCARE; + switch (request.styleHint) { + case QFont::Helvetica: + hint = FF_SWISS; + break; + case QFont::Times: + hint = FF_ROMAN; + break; + case QFont::Courier: + hint = FF_MODERN; + break; + case QFont::OldEnglish: + hint = FF_DECORATIVE; + break; + case QFont::System: + hint = FF_MODERN; + break; + default: + break; + } + + lf.lfHeight = -qRound(request.pixelSize); + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + if (request.weight == 50) + lf.lfWeight = FW_DONTCARE; + else + lf.lfWeight = (request.weight*900)/99; + lf.lfItalic = request.style != QFont::StyleNormal; + lf.lfCharSet = DEFAULT_CHARSET; + + int strat = OUT_DEFAULT_PRECIS; + if (request.styleStrategy & QFont::PreferBitmap) { + strat = OUT_RASTER_PRECIS; + } else if (request.styleStrategy & QFont::PreferDevice) { + strat = OUT_DEVICE_PRECIS; + } else if (request.styleStrategy & QFont::PreferOutline) { + strat = OUT_OUTLINE_PRECIS; + } else if (request.styleStrategy & QFont::ForceOutline) { + strat = OUT_TT_ONLY_PRECIS; + } + + lf.lfOutPrecision = strat; + + int qual = DEFAULT_QUALITY; + + if (request.styleStrategy & QFont::PreferMatch) + qual = DRAFT_QUALITY; + else if (request.styleStrategy & QFont::PreferQuality) + qual = PROOF_QUALITY; + + if (request.styleStrategy & QFont::PreferAntialias) { + if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP) { + qual = CLEARTYPE_QUALITY; + preferClearTypeAA = true; + } else { + qual = ANTIALIASED_QUALITY; + } + } else if (request.styleStrategy & QFont::NoAntialias) { + qual = NONANTIALIASED_QUALITY; + } + + lf.lfQuality = qual; + + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfPitchAndFamily = DEFAULT_PITCH | hint; + + QString fam = request.family; + + if(fam.isEmpty()) + fam = QStringLiteral("MS Sans Serif"); + + if ((fam == QStringLiteral("MS Sans Serif")) + && (request.style == QFont::StyleItalic || (-lf.lfHeight > 18 && -lf.lfHeight != 24))) { + fam = QStringLiteral("Arial"); // MS Sans Serif has bearing problems in italic, and does not scale + } + if (fam == QStringLiteral("Courier") && !(request.styleStrategy & QFont::PreferBitmap)) + fam = QStringLiteral("Courier New"); + + memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded + + hfont = CreateFontIndirect(&lf); + if (!hfont) + qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__); + + stockFont = (hfont == 0); + bool ttf = false; + int avWidth = 0; + BOOL res; + HGDIOBJ oldObj = SelectObject(hdc, hfont); + + TEXTMETRIC tm; + res = GetTextMetrics(hdc, &tm); + avWidth = tm.tmAveCharWidth; + ttf = tm.tmPitchAndFamily & TMPF_TRUETYPE; + SelectObject(hdc, oldObj); + + if (!ttf || !useDirectWrite) { + useDirectWrite = false; + + if (hfont && (!ttf || request.stretch != 100)) { + DeleteObject(hfont); + if (!res) + qErrnoWarning("QFontEngine::loadEngine: GetTextMetrics failed"); + lf.lfWidth = avWidth * request.stretch/100; + hfont = CreateFontIndirect(&lf); + if (!hfont) + qErrnoWarning("%s: CreateFontIndirect with stretch failed", __FUNCTION__); + } + + if (hfont == 0) { + hfont = (HFONT)GetStockObject(ANSI_VAR_FONT); + stockFont = true; + } + } + +#if !defined(QT_NO_DIRECTWRITE) + else { + // Default to false for DirectWrite (and re-enable once/if everything + // turns out okay) + useDirectWrite = false; + if (initDirectWrite(data.data())) { + const QString nameSubstitute = QWindowsFontEngineDirectWrite::fontNameSubstitute(QString::fromWCharArray(lf.lfFaceName)); + memcpy(lf.lfFaceName, nameSubstitute.utf16(), + sizeof(wchar_t) * qMin(nameSubstitute.length() + 1, LF_FACESIZE)); + + HRESULT hr = data->directWriteGdiInterop->CreateFontFromLOGFONT( + &lf, + &directWriteFont); + if (FAILED(hr)) { + qErrnoWarning("%s: CreateFontFromLOGFONT failed", __FUNCTION__); + } else { + DeleteObject(hfont); + useDirectWrite = true; + } + } + } +#endif + } + + QFontEngine *fe = 0; + if (!useDirectWrite) { + QWindowsFontEngine *few = new QWindowsFontEngine(request.family, hfont, stockFont, lf, data); + few->setObjectName(QStringLiteral("QWindowsFontEngine_") + request.family); + if (preferClearTypeAA) + few->glyphFormat = QFontEngineGlyphCache::Raster_RGBMask; + + // Also check for OpenType tables when using complex scripts + // ### TODO: This only works for scripts that require OpenType. More generally + // for scripts that do not require OpenType we should just look at the list of + // supported writing systems in the font's OS/2 table. + if (scriptRequiresOpenType(script)) { + HB_Face hbFace = few->harfbuzzFace(); + if (!hbFace || !hbFace->supported_scripts[script]) { + qWarning(" OpenType support missing for script\n"); + delete few; + return 0; + } + } + + few->initFontInfo(request, fontHdc, dpi); + fe = few; + } + +#if !defined(QT_NO_DIRECTWRITE) + else { + IDWriteFontFace *directWriteFontFace = NULL; + HRESULT hr = directWriteFont->CreateFontFace(&directWriteFontFace); + if (SUCCEEDED(hr)) { + QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace, + request.pixelSize, + data); + fedw->initFontInfo(request, dpi, directWriteFont); + fedw->setObjectName(QStringLiteral("QWindowsFontEngineDirectWrite_") + request.family); + fe = fedw; + } else { + qErrnoWarning("%s: CreateFontFace failed", __FUNCTION__); + } + } + + if (directWriteFont != 0) + directWriteFont->Release(); +#endif + + if(script == QUnicodeTables::Common + && !(request.styleStrategy & QFont::NoFontMerging)) { + QFontDatabase db; + if (!db.writingSystems(request.family).contains(QFontDatabase::Symbol)) { + if(!tryFonts) { + LANGID lid = GetUserDefaultLangID(); + switch( lid&0xff ) { + case LANG_CHINESE: // Chinese (Taiwan) + if ( lid == 0x0804 ) // Taiwan + tryFonts = ch_TW_tryFonts; + else + tryFonts = ch_CN_tryFonts; + break; + case LANG_JAPANESE: + tryFonts = jp_tryFonts; + break; + case LANG_KOREAN: + tryFonts = kr_tryFonts; + break; + default: + tryFonts = other_tryFonts; + break; + } + } + QStringList fm = QFontDatabase().families(); + QStringList list = family_list; + const char **tf = tryFonts; + while(tf && *tf) { + if(fm.contains(QLatin1String(*tf))) + list << QLatin1String(*tf); + ++tf; + } + QFontEngine *mfe = new QWindowsMultiFontEngine(fe, list); + mfe->setObjectName(QStringLiteral("QWindowsMultiFontEngine_") + request.family); + mfe->fontDef = fe->fontDef; + fe = mfe; + } + } + return fe; +} + +static inline int verticalDPI() +{ + return GetDeviceCaps(QWindowsContext::instance()->displayContext(), LOGPIXELSY); +} + +QFont QWindowsFontDatabase::defaultFont() const +{ + LOGFONT lf; + GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf); + QFont systemFont = QWindowsFontDatabase::LOGFONT_to_QFont(lf); + // "MS Shell Dlg 2" is the correct system font >= Win2k + if (systemFont.family() == QStringLiteral("MS Shell Dlg")) + systemFont.setFamily(QStringLiteral("MS Shell Dlg 2")); + if (QWindowsContext::verboseFonts) + qDebug() << __FUNCTION__ << systemFont; + return systemFont; +} + +QHash QWindowsFontDatabase::defaultFonts() const +{ + QHash result; + NONCLIENTMETRICS ncm; + ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize , &ncm, 0); + + const int verticalRes = verticalDPI(); + + const QFont menuFont = LOGFONT_to_QFont(ncm.lfMenuFont, verticalRes); + const QFont messageFont = LOGFONT_to_QFont(ncm.lfMessageFont, verticalRes); + const QFont statusFont = LOGFONT_to_QFont(ncm.lfStatusFont, verticalRes); + const QFont titleFont = LOGFONT_to_QFont(ncm.lfCaptionFont, verticalRes); + + LOGFONT lfIconTitleFont; + SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lfIconTitleFont), &lfIconTitleFont, 0); + const QFont iconTitleFont = LOGFONT_to_QFont(lfIconTitleFont, verticalRes); + + result.insert(QByteArray("QMenu"), menuFont); + result.insert(QByteArray("QMenuBar"), menuFont); + result.insert(QByteArray("QMessageBox"), messageFont); + result.insert(QByteArray("QTipLabel"), statusFont); + result.insert(QByteArray("QStatusBar"), statusFont); + result.insert(QByteArray("Q3TitleBar"), titleFont); + result.insert(QByteArray("QWorkspaceTitleBar"), titleFont); + result.insert(QByteArray("QAbstractItemView"), iconTitleFont); + result.insert(QByteArray("QDockWidgetTitle"), iconTitleFont); + if (QWindowsContext::verboseFonts) { + typedef QHash::const_iterator CIT; + QDebug nsp = qDebug().nospace(); + nsp << __FUNCTION__ << " DPI=" << verticalRes << "\n"; + const CIT cend = result.constEnd(); + for (CIT it = result.constBegin(); it != cend; ++it) + nsp << it.key() << ' ' << it.value() << '\n'; + } + return result; +} + +QFont QWindowsFontDatabase::LOGFONT_to_QFont(const LOGFONT& logFont, int verticalDPI_In) +{ + if (verticalDPI_In <= 0) + verticalDPI_In = verticalDPI(); + QFont qFont(QString::fromWCharArray(logFont.lfFaceName)); + qFont.setItalic(logFont.lfItalic); + if (logFont.lfWeight != FW_DONTCARE) + qFont.setWeight(weightFromInteger(logFont.lfWeight)); + const qreal logFontHeight = qAbs(logFont.lfHeight); + qFont.setPointSizeF(logFontHeight * 72.0 / qreal(verticalDPI_In)); + qFont.setUnderline(false); + qFont.setOverline(false); + qFont.setStrikeOut(false); + return qFont; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h new file mode 100644 index 00000000000..a80482f6e2a --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSFONTDATABASE_H +#define QWINDOWSFONTDATABASE_H + +#include +#include +#include "qtwindows_additional.h" + +QT_BEGIN_NAMESPACE + +#if !defined(QT_NO_DIRECTWRITE) + struct IDWriteFactory; + struct IDWriteGdiInterop; +#endif + +class QWindowsFontEngineData +{ + Q_DISABLE_COPY(QWindowsFontEngineData) +public: + QWindowsFontEngineData(); + ~QWindowsFontEngineData(); + + uint pow_gamma[256]; + + bool clearTypeEnabled; + qreal fontSmoothingGamma; + HDC hdc; +#if !defined(QT_NO_DIRECTWRITE) + IDWriteFactory *directWriteFactory; + IDWriteGdiInterop *directWriteGdiInterop; +#endif +}; + +class QWindowsFontDatabase : public QPlatformFontDatabase +{ +public: + QWindowsFontDatabase(); + ~QWindowsFontDatabase(); + + virtual void populateFontDatabase(); + virtual QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle); + virtual QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); + virtual QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const; + virtual QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName); + virtual void releaseHandle(void *handle); + virtual QString fontDir() const; + + virtual QFont defaultFont() const; + virtual QHash defaultFonts() const; + + static QFontEngine *createEngine(int script, const QFontDef &request, + HDC fontHdc, int dpi, bool rawMode, + const QStringList &family_list, + const QSharedPointer &data); + + static HFONT systemFont(); + static QFont LOGFONT_to_QFont(const LOGFONT& lf, int verticalDPI = 0); + +private: + void populate(const QString &family = QString()); + QSharedPointer m_fontEngineData; + QSet m_families; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSFONTDATABASE_H diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp new file mode 100644 index 00000000000..80d9ed4686f --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -0,0 +1,1223 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#if _WIN32_WINNT < 0x0500 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 +#endif + +#include "qwindowsfontengine.h" +#include "qwindowsnativeimage.h" +#include "qwindowscontext.h" +#include "qwindowsfontdatabase.h" +#include "qtwindows_additional.h" + +#include // glyph_metrics_t +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +//### mingw needed define +#ifndef TT_PRIM_CSPLINE +#define TT_PRIM_CSPLINE 3 +#endif + +#ifdef MAKE_TAG +#undef MAKE_TAG +#endif +// GetFontData expects the tags in little endian ;( +#define MAKE_TAG(ch1, ch2, ch3, ch4) (\ + (((quint32)(ch4)) << 24) | \ + (((quint32)(ch3)) << 16) | \ + (((quint32)(ch2)) << 8) | \ + ((quint32)(ch1)) \ + ) + +// common DC for all fonts + +QT_BEGIN_NAMESPACE + +typedef BOOL (WINAPI *PtrGetCharWidthI)(HDC, UINT, UINT, LPWORD, LPINT); +static PtrGetCharWidthI ptrGetCharWidthI = 0; +static bool resolvedGetCharWidthI = false; + +static void resolveGetCharWidthI() +{ + if (resolvedGetCharWidthI) + return; + resolvedGetCharWidthI = true; + ptrGetCharWidthI = (PtrGetCharWidthI)QSystemLibrary::resolve(QStringLiteral("gdi32"), "GetCharWidthI"); +} + +// defined in qtextengine_win.cpp +typedef void *SCRIPT_CACHE; +typedef HRESULT (WINAPI *fScriptFreeCache)(SCRIPT_CACHE *); +extern fScriptFreeCache ScriptFreeCache; + +static inline quint32 getUInt(unsigned char *p) +{ + quint32 val; + val = *p++ << 24; + val |= *p++ << 16; + val |= *p++ << 8; + val |= *p; + + return val; +} + +static inline quint16 getUShort(unsigned char *p) +{ + quint16 val; + val = *p++ << 8; + val |= *p; + + return val; +} + +// general font engine + +QFixed QWindowsFontEngine::lineThickness() const +{ + if(lineWidth > 0) + return lineWidth; + + return QFontEngine::lineThickness(); +} + +static OUTLINETEXTMETRIC *getOutlineTextMetric(HDC hdc) +{ + int size; + size = GetOutlineTextMetrics(hdc, 0, 0); + OUTLINETEXTMETRIC *otm = (OUTLINETEXTMETRIC *)malloc(size); + GetOutlineTextMetrics(hdc, size, otm); + return otm; +} + +void QWindowsFontEngine::getCMap() +{ + ttf = (bool)(tm.tmPitchAndFamily & TMPF_TRUETYPE); + HDC hdc = m_fontEngineData->hdc; + SelectObject(hdc, hfont); + bool symb = false; + if (ttf) { + cmapTable = getSfntTable(qbswap(MAKE_TAG('c', 'm', 'a', 'p'))); + int size = 0; + cmap = QFontEngine::getCMap(reinterpret_cast(cmapTable.constData()), + cmapTable.size(), &symb, &size); + } + if (!cmap) { + ttf = false; + symb = false; + } + symbol = symb; + designToDevice = 1; + _faceId.index = 0; + if(cmap) { + OUTLINETEXTMETRIC *otm = getOutlineTextMetric(hdc); + designToDevice = QFixed((int)otm->otmEMSquare)/int(otm->otmTextMetrics.tmHeight); + unitsPerEm = otm->otmEMSquare; + x_height = (int)otm->otmsXHeight; + loadKerningPairs(designToDevice); + _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName)).toLatin1(); + lineWidth = otm->otmsUnderscoreSize; + fsType = otm->otmfsType; + free(otm); + } else { + unitsPerEm = tm.tmHeight; + } +} + + +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; +} + +int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout *glyphs, bool mirrored) const +{ + int i = 0; + int glyph_pos = 0; + if (mirrored) { + if (symbol) { + for (; i < numChars; ++i, ++glyph_pos) { + unsigned int uc = getChar(str, i, numChars); + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); + if (!glyphs->glyphs[glyph_pos] && uc < 0x100) + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc + 0xf000); + } + } else if (ttf) { + for (; i < numChars; ++i, ++glyph_pos) { + unsigned int uc = getChar(str, i, numChars); + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, QChar::mirroredChar(uc)); + } + } else { + wchar_t first = tm.tmFirstChar; + wchar_t last = tm.tmLastChar; + + for (; i < numChars; ++i, ++glyph_pos) { + uint ucs = QChar::mirroredChar(getChar(str, i, numChars)); + if (ucs >= first && ucs <= last) + glyphs->glyphs[glyph_pos] = ucs; + else + glyphs->glyphs[glyph_pos] = 0; + } + } + } else { + if (symbol) { + for (; i < numChars; ++i, ++glyph_pos) { + unsigned int uc = getChar(str, i, numChars); + glyphs->glyphs[i] = getTrueTypeGlyphIndex(cmap, uc); + if(!glyphs->glyphs[glyph_pos] && uc < 0x100) + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc + 0xf000); + } + } else if (ttf) { + for (; i < numChars; ++i, ++glyph_pos) { + unsigned int uc = getChar(str, i, numChars); + glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); + } + } else { + wchar_t first = tm.tmFirstChar; + wchar_t last = tm.tmLastChar; + + for (; i < numChars; ++i, ++glyph_pos) { + uint uc = getChar(str, i, numChars); + if (uc >= first && uc <= last) + glyphs->glyphs[glyph_pos] = uc; + else + glyphs->glyphs[glyph_pos] = 0; + } + } + } + glyphs->numGlyphs = glyph_pos; + return glyph_pos; +} + +/*! + \class QWindowsFontEngine + \brief Standard Windows font engine. + \ingroup qt-lighthouse-win + + Will probably be superseded by a common Free Type font engine in Qt 5.X. +*/ + +QWindowsFontEngine::QWindowsFontEngine(const QString &name, + HFONT _hfont, bool stockFontIn, LOGFONT lf, + QSharedPointer fontEngineData) : + m_fontEngineData(fontEngineData), + _name(name), + hfont(_hfont), + m_logfont(lf), + stockFont(stockFontIn), + ttf(0), + hasOutline(0), + lw(0), + cmap(0), + lbearing(SHRT_MIN), + rbearing(SHRT_MIN), + x_height(-1), + synthesized_flags(-1), + lineWidth(-1), + widthCache(0), + widthCacheSize(0), + designAdvances(0), + designAdvancesSize(0) +{ + if (QWindowsContext::verboseFonts) + qDebug("%s: font='%s', size=%ld", __FUNCTION__, qPrintable(name), lf.lfHeight); + HDC hdc = m_fontEngineData->hdc; + SelectObject(hdc, hfont); + fontDef.pixelSize = -lf.lfHeight; + const BOOL res = GetTextMetrics(hdc, &tm); + fontDef.fixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH); + if (!res) { + qErrnoWarning("%s: GetTextMetrics failed", __FUNCTION__); + ZeroMemory(&tm, sizeof(TEXTMETRIC)); + } + + cache_cost = tm.tmHeight * tm.tmAveCharWidth * 2000; + getCMap(); + + if (!resolvedGetCharWidthI) + resolveGetCharWidthI(); +} + +QWindowsFontEngine::~QWindowsFontEngine() +{ + if (designAdvances) + free(designAdvances); + + if (widthCache) + free(widthCache); + + // make sure we aren't by accident still selected + SelectObject(m_fontEngineData->hdc, (HFONT)GetStockObject(SYSTEM_FONT)); + + if (!stockFont) { + if (!DeleteObject(hfont)) + qErrnoWarning("%s: QFontEngineWin: failed to delete non-stock font... failed", __FUNCTION__); + } + if (QWindowsContext::verboseFonts) + if (QWindowsContext::verboseFonts) + qDebug("%s: font='%s", __FUNCTION__, qPrintable(_name)); +} + +HGDIOBJ QWindowsFontEngine::selectDesignFont() const +{ + LOGFONT f = m_logfont; + f.lfHeight = unitsPerEm; + HFONT designFont = CreateFontIndirect(&f); + return SelectObject(m_fontEngineData->hdc, designFont); +} + +bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const +{ + if (*nglyphs < len) { + *nglyphs = len; + return false; + } + + *nglyphs = getGlyphIndexes(str, len, glyphs, flags & QTextEngine::RightToLeft); + + if (flags & QTextEngine::GlyphIndicesOnly) + return true; + + recalcAdvances(glyphs, flags); + return true; +} + +inline void calculateTTFGlyphWidth(HDC hdc, UINT glyph, int &width) +{ + if (ptrGetCharWidthI) + ptrGetCharWidthI(hdc, glyph, 1, 0, &width); +} + +void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const +{ + HGDIOBJ oldFont = 0; + HDC hdc = m_fontEngineData->hdc; + if (ttf && (flags & QTextEngine::DesignMetrics)) { + for(int i = 0; i < glyphs->numGlyphs; i++) { + unsigned int glyph = glyphs->glyphs[i]; + if(int(glyph) >= designAdvancesSize) { + int newSize = (glyph + 256) >> 8 << 8; + designAdvances = q_check_ptr((QFixed *)realloc(designAdvances, + newSize*sizeof(QFixed))); + for(int i = designAdvancesSize; i < newSize; ++i) + designAdvances[i] = -1000000; + designAdvancesSize = newSize; + } + if (designAdvances[glyph] < -999999) { + if (!oldFont) + oldFont = selectDesignFont(); + + int width = 0; + calculateTTFGlyphWidth(hdc, glyph, width); + designAdvances[glyph] = QFixed(width) / designToDevice; + } + glyphs->advances_x[i] = designAdvances[glyph]; + glyphs->advances_y[i] = 0; + } + if(oldFont) + DeleteObject(SelectObject(hdc, oldFont)); + } else { + for(int i = 0; i < glyphs->numGlyphs; i++) { + unsigned int glyph = glyphs->glyphs[i]; + + glyphs->advances_y[i] = 0; + + if (glyph >= widthCacheSize) { + int newSize = (glyph + 256) >> 8 << 8; + widthCache = q_check_ptr((unsigned char *)realloc(widthCache, + newSize*sizeof(QFixed))); + memset(widthCache + widthCacheSize, 0, newSize - widthCacheSize); + widthCacheSize = newSize; + } + glyphs->advances_x[i] = widthCache[glyph]; + // font-width cache failed + if (glyphs->advances_x[i] == 0) { + int width = 0; + if (!oldFont) + oldFont = SelectObject(hdc, hfont); + + if (!ttf) { + QChar ch[2] = { ushort(glyph), 0 }; + int chrLen = 1; + if (glyph > 0xffff) { + ch[0] = QChar::highSurrogate(glyph); + ch[1] = QChar::lowSurrogate(glyph); + ++chrLen; + } + SIZE size = {0, 0}; + GetTextExtentPoint32(hdc, (wchar_t *)ch, chrLen, &size); + width = size.cx; + } else { + calculateTTFGlyphWidth(hdc, glyph, width); + } + glyphs->advances_x[i] = width; + // if glyph's within cache range, store it for later + if (width > 0 && width < 0x100) + widthCache[glyph] = width; + } + } + + if (oldFont) + SelectObject(hdc, oldFont); + } +} + +glyph_metrics_t QWindowsFontEngine::boundingBox(const QGlyphLayout &glyphs) +{ + if (glyphs.numGlyphs == 0) + return glyph_metrics_t(); + + QFixed w = 0; + for (int i = 0; i < glyphs.numGlyphs; ++i) + w += glyphs.effectiveAdvance(i); + + return glyph_metrics_t(0, -tm.tmAscent, w - lastRightBearing(glyphs), tm.tmHeight, w, 0); +} + +bool QWindowsFontEngine::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const +{ + Q_ASSERT(metrics != 0); + + HDC hdc = m_fontEngineData->hdc; + + GLYPHMETRICS gm; + DWORD res = 0; + MAT2 mat; + mat.eM11.value = mat.eM22.value = 1; + mat.eM11.fract = mat.eM22.fract = 0; + mat.eM21.value = mat.eM12.value = 0; + mat.eM21.fract = mat.eM12.fract = 0; + + if (t.type() > QTransform::TxTranslate) { + // We need to set the transform using the HDC's world + // matrix rather than using the MAT2 above, because the + // results provided when transforming via MAT2 does not + // match the glyphs that are drawn using a WorldTransform + XFORM xform; + xform.eM11 = t.m11(); + xform.eM12 = t.m12(); + xform.eM21 = t.m21(); + xform.eM22 = t.m22(); + xform.eDx = 0; + xform.eDy = 0; + SetGraphicsMode(hdc, GM_ADVANCED); + SetWorldTransform(hdc, &xform); + } + + uint format = GGO_METRICS; + if (ttf) + format |= GGO_GLYPH_INDEX; + res = GetGlyphOutline(hdc, glyph, format, &gm, 0, 0, &mat); + + if (t.type() > QTransform::TxTranslate) { + XFORM xform; + xform.eM11 = xform.eM22 = 1; + xform.eM12 = xform.eM21 = xform.eDx = xform.eDy = 0; + SetWorldTransform(hdc, &xform); + SetGraphicsMode(hdc, GM_COMPATIBLE); + } + + if (res != GDI_ERROR) { + *metrics = glyph_metrics_t(gm.gmptGlyphOrigin.x, -gm.gmptGlyphOrigin.y, + (int)gm.gmBlackBoxX, (int)gm.gmBlackBoxY, gm.gmCellIncX, gm.gmCellIncY); + return true; + } else { + return false; + } +} + +glyph_metrics_t QWindowsFontEngine::boundingBox(glyph_t glyph, const QTransform &t) +{ + HDC hdc = m_fontEngineData->hdc; + SelectObject(hdc, hfont); + + glyph_metrics_t glyphMetrics; + bool success = getOutlineMetrics(glyph, t, &glyphMetrics); + + if (!ttf && !success) { + // Bitmap fonts + wchar_t ch = glyph; + ABCFLOAT abc; + GetCharABCWidthsFloat(hdc, ch, ch, &abc); + int width = qRound(abc.abcfB); + + return glyph_metrics_t(QFixed::fromReal(abc.abcfA), -tm.tmAscent, width, tm.tmHeight, width, 0).transformed(t); + } + + return glyphMetrics; +} + +QFixed QWindowsFontEngine::ascent() const +{ + return tm.tmAscent; +} + +QFixed QWindowsFontEngine::descent() const +{ + // ### we subtract 1 to even out the historical +1 in QFontMetrics' + // ### height=asc+desc+1 equation. Fix in Qt5. + return tm.tmDescent - 1; +} + +QFixed QWindowsFontEngine::leading() const +{ + return tm.tmExternalLeading; +} + + +QFixed QWindowsFontEngine::xHeight() const +{ + if(x_height >= 0) + return x_height; + return QFontEngine::xHeight(); +} + +QFixed QWindowsFontEngine::averageCharWidth() const +{ + return tm.tmAveCharWidth; +} + +qreal QWindowsFontEngine::maxCharWidth() const +{ + return tm.tmMaxCharWidth; +} + +enum { max_font_count = 256 }; +static const ushort char_table[] = { + 40, + 67, + 70, + 75, + 86, + 88, + 89, + 91, + 102, + 114, + 124, + 127, + 205, + 645, + 884, + 922, + 1070, + 12386, + 0 +}; + +static const int char_table_entries = sizeof(char_table)/sizeof(ushort); + +#ifndef Q_CC_MINGW +void QWindowsFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) +{ + HDC hdc = m_fontEngineData->hdc; + SelectObject(hdc, hfont); + + if (ttf) + { + ABC abcWidths; + GetCharABCWidthsI(hdc, glyph, 1, 0, &abcWidths); + if (leftBearing) + *leftBearing = abcWidths.abcA; + if (rightBearing) + *rightBearing = abcWidths.abcC; + } else { + QFontEngine::getGlyphBearings(glyph, leftBearing, rightBearing); + } +} +#endif // Q_CC_MINGW + +qreal QWindowsFontEngine::minLeftBearing() const +{ + if (lbearing == SHRT_MIN) + minRightBearing(); // calculates both + + return lbearing; +} + +qreal QWindowsFontEngine::minRightBearing() const +{ + if (rbearing == SHRT_MIN) { + int ml = 0; + int mr = 0; + HDC hdc = m_fontEngineData->hdc; + SelectObject(hdc, hfont); + if (ttf) { + ABC *abc = 0; + int n = tm.tmLastChar - tm.tmFirstChar; + if (n <= max_font_count) { + abc = new ABC[n+1]; + GetCharABCWidths(hdc, tm.tmFirstChar, tm.tmLastChar, abc); + } else { + abc = new ABC[char_table_entries+1]; + for(int i = 0; i < char_table_entries; i++) + GetCharABCWidths(hdc, char_table[i], char_table[i], abc + i); + n = char_table_entries; + } + ml = abc[0].abcA; + mr = abc[0].abcC; + for (int i = 1; i < n; i++) { + if (abc[i].abcA + abc[i].abcB + abc[i].abcC != 0) { + ml = qMin(ml,abc[i].abcA); + mr = qMin(mr,abc[i].abcC); + } + } + delete [] abc; + } else { + ABCFLOAT *abc = 0; + int n = tm.tmLastChar - tm.tmFirstChar+1; + if (n <= max_font_count) { + abc = new ABCFLOAT[n]; + GetCharABCWidthsFloat(hdc, tm.tmFirstChar, tm.tmLastChar, abc); + } else { + abc = new ABCFLOAT[char_table_entries]; + for(int i = 0; i < char_table_entries; i++) + GetCharABCWidthsFloat(hdc, char_table[i], char_table[i], abc+i); + n = char_table_entries; + } + float fml = abc[0].abcfA; + float fmr = abc[0].abcfC; + for (int i=1; i string->unicode() || tm.tmLastChar < string->unicode()) + return false; + } + } + return true; +} + +QFontEngine::Type QWindowsFontEngine::type() const +{ + return QFontEngine::Win; +} + +static inline double qt_fixed_to_double(const FIXED &p) { + return ((p.value << 16) + p.fract) / 65536.0; +} + +static inline QPointF qt_to_qpointf(const POINTFX &pt, qreal scale) { + return QPointF(qt_fixed_to_double(pt.x) * scale, -qt_fixed_to_double(pt.y) * scale); +} + +#ifndef GGO_UNHINTED +#define GGO_UNHINTED 0x0100 +#endif + +static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, + QPainterPath *path, bool ttf, glyph_metrics_t *metric = 0, qreal scale = 1) +{ + MAT2 mat; + mat.eM11.value = mat.eM22.value = 1; + mat.eM11.fract = mat.eM22.fract = 0; + mat.eM21.value = mat.eM12.value = 0; + mat.eM21.fract = mat.eM12.fract = 0; + uint glyphFormat = GGO_NATIVE; + + if (ttf) + glyphFormat |= GGO_GLYPH_INDEX; + + GLYPHMETRICS gMetric; + memset(&gMetric, 0, sizeof(GLYPHMETRICS)); + int bufferSize = GDI_ERROR; + bufferSize = GetGlyphOutline(hdc, glyph, glyphFormat, &gMetric, 0, 0, &mat); + if ((DWORD)bufferSize == GDI_ERROR) { + return false; + } + + void *dataBuffer = new char[bufferSize]; + DWORD ret = GDI_ERROR; + ret = GetGlyphOutline(hdc, glyph, glyphFormat, &gMetric, bufferSize, dataBuffer, &mat); + if (ret == GDI_ERROR) { + delete [](char *)dataBuffer; + return false; + } + + if(metric) { + // #### obey scale + *metric = glyph_metrics_t(gMetric.gmptGlyphOrigin.x, -gMetric.gmptGlyphOrigin.y, + (int)gMetric.gmBlackBoxX, (int)gMetric.gmBlackBoxY, + gMetric.gmCellIncX, gMetric.gmCellIncY); + } + + int offset = 0; + int headerOffset = 0; + TTPOLYGONHEADER *ttph = 0; + + QPointF oset = position.toPointF(); + while (headerOffset < bufferSize) { + ttph = (TTPOLYGONHEADER*)((char *)dataBuffer + headerOffset); + + QPointF lastPoint(qt_to_qpointf(ttph->pfxStart, scale)); + path->moveTo(lastPoint + oset); + offset += sizeof(TTPOLYGONHEADER); + TTPOLYCURVE *curve; + while (offsetcb)) { + curve = (TTPOLYCURVE*)((char*)(dataBuffer) + offset); + switch (curve->wType) { + case TT_PRIM_LINE: { + for (int i=0; icpfx; ++i) { + QPointF p = qt_to_qpointf(curve->apfx[i], scale) + oset; + path->lineTo(p); + } + break; + } + case TT_PRIM_QSPLINE: { + const QPainterPath::Element &elm = path->elementAt(path->elementCount()-1); + QPointF prev(elm.x, elm.y); + QPointF endPoint; + for (int i=0; icpfx - 1; ++i) { + QPointF p1 = qt_to_qpointf(curve->apfx[i], scale) + oset; + QPointF p2 = qt_to_qpointf(curve->apfx[i+1], scale) + oset; + if (i < curve->cpfx - 2) { + endPoint = QPointF((p1.x() + p2.x()) / 2, (p1.y() + p2.y()) / 2); + } else { + endPoint = p2; + } + + path->quadTo(p1, endPoint); + prev = endPoint; + } + + break; + } + case TT_PRIM_CSPLINE: { + for (int i=0; icpfx; ) { + QPointF p2 = qt_to_qpointf(curve->apfx[i++], scale) + oset; + QPointF p3 = qt_to_qpointf(curve->apfx[i++], scale) + oset; + QPointF p4 = qt_to_qpointf(curve->apfx[i++], scale) + oset; + path->cubicTo(p2, p3, p4); + } + break; + } + default: + qWarning("QFontEngineWin::addOutlineToPath, unhandled switch case"); + } + offset += sizeof(TTPOLYCURVE) + (curve->cpfx-1) * sizeof(POINTFX); + } + path->closeSubpath(); + headerOffset += ttph->cb; + } + delete [] (char*)dataBuffer; + + return true; +} + +void QWindowsFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, + QPainterPath *path, QTextItem::RenderFlags) +{ + LOGFONT lf = m_logfont; + // The sign must be negative here to make sure we match against character height instead of + // hinted cell height. This ensures that we get linear matching, and we need this for + // paths since we later on apply a scaling transform to the glyph outline to get the + // font at the correct pixel size. + lf.lfHeight = -unitsPerEm; + lf.lfWidth = 0; + HFONT hf = CreateFontIndirect(&lf); + HDC hdc = m_fontEngineData->hdc; + HGDIOBJ oldfont = SelectObject(hdc, hf); + + for(int i = 0; i < nglyphs; ++i) { + if (!addGlyphToPath(glyphs[i], positions[i], hdc, path, ttf, /*metric*/0, + qreal(fontDef.pixelSize) / unitsPerEm)) { + // Some windows fonts, like "Modern", are vector stroke + // fonts, which are reported as TMPF_VECTOR but do not + // support GetGlyphOutline, and thus we set this bit so + // that addOutLineToPath can check it and return safely... + hasOutline = false; + break; + } + } + DeleteObject(SelectObject(hdc, oldfont)); +} + +void QWindowsFontEngine::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, + QPainterPath *path, QTextItem::RenderFlags flags) +{ + if(tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) { + hasOutline = true; + QFontEngine::addOutlineToPath(x, y, glyphs, path, flags); + if (hasOutline) { + // has_outline is set to false if addGlyphToPath gets + // false from GetGlyphOutline, meaning its not an outline + // font. + return; + } + } + QFontEngine::addBitmapFontToPath(x, y, glyphs, path, flags); +} + +QFontEngine::FaceId QWindowsFontEngine::faceId() const +{ + return _faceId; +} + +QT_BEGIN_INCLUDE_NAMESPACE +#include +QT_END_INCLUDE_NAMESPACE + +int QWindowsFontEngine::synthesized() const +{ + if(synthesized_flags == -1) { + synthesized_flags = 0; + if(ttf) { + const DWORD HEAD = MAKE_TAG('h', 'e', 'a', 'd'); + HDC hdc = m_fontEngineData->hdc; + SelectObject(hdc, hfont); + uchar data[4]; + GetFontData(hdc, HEAD, 44, &data, 4); + USHORT macStyle = getUShort(data); + if (tm.tmItalic && !(macStyle & 2)) + synthesized_flags = SynthesizedItalic; + if (fontDef.stretch != 100 && ttf) + synthesized_flags |= SynthesizedStretch; + if (tm.tmWeight >= 500 && !(macStyle & 1)) + synthesized_flags |= SynthesizedBold; + //qDebug() << "font is" << _name << + // "it=" << (macStyle & 2) << fontDef.style << "flags=" << synthesized_flags; + } + } + return synthesized_flags; +} + +QFixed QWindowsFontEngine::emSquareSize() const +{ + return unitsPerEm; +} + +QFontEngine::Properties QWindowsFontEngine::properties() const +{ + LOGFONT lf = m_logfont; + lf.lfHeight = unitsPerEm; + HFONT hf = CreateFontIndirect(&lf); + HDC hdc = m_fontEngineData->hdc; + HGDIOBJ oldfont = SelectObject(hdc, hf); + OUTLINETEXTMETRIC *otm = getOutlineTextMetric(hdc); + Properties p; + p.emSquare = unitsPerEm; + p.italicAngle = otm->otmItalicAngle; + p.postscriptName = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFamilyName)).toLatin1(); + p.postscriptName += QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpStyleName)).toLatin1(); + p.postscriptName = QFontEngine::convertToPostscriptFontFamilyName(p.postscriptName); + p.boundingBox = QRectF(otm->otmrcFontBox.left, -otm->otmrcFontBox.top, + otm->otmrcFontBox.right - otm->otmrcFontBox.left, + otm->otmrcFontBox.top - otm->otmrcFontBox.bottom); + p.ascent = otm->otmAscent; + p.descent = -otm->otmDescent; + p.leading = (int)otm->otmLineGap; + p.capHeight = 0; + p.lineWidth = otm->otmsUnderscoreSize; + free(otm); + DeleteObject(SelectObject(hdc, oldfont)); + return p; +} + +void QWindowsFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) +{ + LOGFONT lf = m_logfont; + lf.lfHeight = unitsPerEm; + int flags = synthesized(); + if(flags & SynthesizedItalic) + lf.lfItalic = false; + lf.lfWidth = 0; + HFONT hf = CreateFontIndirect(&lf); + HDC hdc = m_fontEngineData->hdc; + HGDIOBJ oldfont = SelectObject(hdc, hf); + QFixedPoint p; + p.x = 0; + p.y = 0; + addGlyphToPath(glyph, p, hdc, path, ttf, metrics); + DeleteObject(SelectObject(hdc, oldfont)); +} + +bool QWindowsFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) const +{ + if (!ttf) + return false; + HDC hdc = m_fontEngineData->hdc; + SelectObject(hdc, hfont); + DWORD t = qbswap(tag); + *length = GetFontData(hdc, t, 0, buffer, *length); + return *length != GDI_ERROR; +} + +#if !defined(CLEARTYPE_QUALITY) +# define CLEARTYPE_QUALITY 5 +#endif + +QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, int margin, + const QTransform &t, + QImage::Format mask_format) +{ + Q_UNUSED(mask_format) + glyph_metrics_t gm = boundingBox(glyph); + +// printf(" -> for glyph %4x\n", glyph); + + int gx = gm.x.toInt(); + int gy = gm.y.toInt(); + int iw = gm.width.toInt(); + int ih = gm.height.toInt(); + + if (iw <= 0 || iw <= 0) + return 0; + + bool has_transformation = t.type() > QTransform::TxTranslate; + + unsigned int options = ttf ? ETO_GLYPH_INDEX : 0; + XFORM xform; + + if (has_transformation) { + xform.eM11 = t.m11(); + xform.eM12 = t.m12(); + xform.eM21 = t.m21(); + xform.eM22 = t.m22(); + xform.eDx = margin; + xform.eDy = margin; + + HDC hdc = CreateCompatibleDC(QWindowsContext::instance()->displayContext()); + + SetGraphicsMode(hdc, GM_ADVANCED); + SetWorldTransform(hdc, &xform); + HGDIOBJ old_font = SelectObject(hdc, font); + + int ggo_options = GGO_METRICS | (ttf ? GGO_GLYPH_INDEX : 0); + GLYPHMETRICS tgm; + MAT2 mat; + memset(&mat, 0, sizeof(mat)); + mat.eM11.value = mat.eM22.value = 1; + + if (GetGlyphOutline(hdc, glyph, ggo_options, &tgm, 0, 0, &mat) == GDI_ERROR) { + qWarning("QWinFontEngine: unable to query transformed glyph metrics..."); + return 0; + } + + iw = tgm.gmBlackBoxX; + ih = tgm.gmBlackBoxY; + + xform.eDx -= tgm.gmptGlyphOrigin.x; + xform.eDy += tgm.gmptGlyphOrigin.y; + + SetGraphicsMode(hdc, GM_COMPATIBLE); + SelectObject(hdc, old_font); + ReleaseDC(0, hdc); + } + QWindowsNativeImage *ni = new QWindowsNativeImage(iw + 2 * margin + 4, + ih + 2 * margin + 4, + QWindowsNativeImage::systemFormat()); + + /*If cleartype is enabled we use the standard system format even on Windows CE + and not the special textbuffer format we have to use if cleartype is disabled*/ + + ni->image().fill(0xffffffff); + + HDC hdc = ni->hdc(); + + SelectObject(hdc, GetStockObject(NULL_BRUSH)); + SelectObject(hdc, GetStockObject(BLACK_PEN)); + SetTextColor(hdc, RGB(0,0,0)); + SetBkMode(hdc, TRANSPARENT); + SetTextAlign(hdc, TA_BASELINE); + + HGDIOBJ old_font = SelectObject(hdc, font); + + if (has_transformation) { + SetGraphicsMode(hdc, GM_ADVANCED); + SetWorldTransform(hdc, &xform); + ExtTextOut(hdc, 0, 0, options, 0, (LPCWSTR) &glyph, 1, 0); + } else + { + ExtTextOut(hdc, -gx + margin, -gy + margin, options, 0, (LPCWSTR) &glyph, 1, 0); + } + + SelectObject(hdc, old_font); + return ni; +} + +QImage QWindowsFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &xform) +{ + HFONT font = hfont; + if (m_fontEngineData->clearTypeEnabled) { + LOGFONT lf = m_logfont; + lf.lfQuality = ANTIALIASED_QUALITY; + font = CreateFontIndirect(&lf); + } + QImage::Format mask_format = QWindowsNativeImage::systemFormat(); + mask_format = QImage::Format_RGB32; + + QWindowsNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform, mask_format); + if (mask == 0) + return QImage(); + + QImage indexed(mask->width(), mask->height(), QImage::Format_Indexed8); + + // ### This part is kinda pointless, but we'll crash later if we don't because some + // code paths expects there to be colortables for index8-bit... + QVector colors(256); + for (int i=0; i<256; ++i) + colors[i] = qRgba(0, 0, 0, i); + indexed.setColorTable(colors); + + // Copy data... Cannot use QPainter here as GDI has messed up the + // Alpha channel of the ni.image pixels... + for (int y=0; yheight(); ++y) { + uchar *dest = indexed.scanLine(y); + if (mask->image().format() == QImage::Format_RGB16) { + const qint16 *src = (qint16 *) ((const QImage &) mask->image()).scanLine(y); + for (int x=0; xwidth(); ++x) + dest[x] = 255 - qGray(src[x]); + } else { + const uint *src = (uint *) ((const QImage &) mask->image()).scanLine(y); + for (int x=0; xwidth(); ++x) { + if (QWindowsNativeImage::systemFormat() == QImage::Format_RGB16) + dest[x] = 255 - qGray(src[x]); + else + dest[x] = 255 - (m_fontEngineData->pow_gamma[qGray(src[x])] * 255. / 2047.); + } + } + } + + // Cleanup... + delete mask; + if (m_fontEngineData->clearTypeEnabled) { + DeleteObject(font); + } + + return indexed; +} + +#define SPI_GETFONTSMOOTHINGCONTRAST 0x200C +#define SPI_SETFONTSMOOTHINGCONTRAST 0x200D + +QImage QWindowsFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed, int margin, const QTransform &t) +{ + HFONT font = hfont; + + int contrast; + SystemParametersInfo(SPI_GETFONTSMOOTHINGCONTRAST, 0, &contrast, 0); + SystemParametersInfo(SPI_SETFONTSMOOTHINGCONTRAST, 0, (void *) 1000, 0); + + QWindowsNativeImage *mask = drawGDIGlyph(font, glyph, margin, t, QImage::Format_RGB32); + SystemParametersInfo(SPI_SETFONTSMOOTHINGCONTRAST, 0, (void *) contrast, 0); + + if (mask == 0) + return QImage(); + + // Gracefully handle the odd case when the display is 16-bit + const QImage source = mask->image().depth() == 32 + ? mask->image() + : mask->image().convertToFormat(QImage::Format_RGB32); + + QImage rgbMask(mask->width(), mask->height(), QImage::Format_RGB32); + for (int y=0; yheight(); ++y) { + uint *dest = (uint *) rgbMask.scanLine(y); + const uint *src = (uint *) source.scanLine(y); + for (int x=0; xwidth(); ++x) { + dest[x] = 0xffffffff - (0x00ffffff & src[x]); + } + } + + delete mask; + + return rgbMask; +} + +QFontEngine *QWindowsFontEngine::cloneWithSize(qreal pixelSize) const +{ + QFontDef request = fontDef; + QString actualFontName = request.family; + if (!uniqueFamilyName.isEmpty()) + request.family = uniqueFamilyName; + request.pixelSize = pixelSize; + + QFontEngine *fontEngine = + QWindowsFontDatabase::createEngine(QUnicodeTables::Common, request, 0, + QWindowsContext::instance()->defaultDPI(), + false, + QStringList(), m_fontEngineData); + if (fontEngine) + fontEngine->fontDef.family = actualFontName; + return fontEngine; +} + +void QWindowsFontEngine::initFontInfo(const QFontDef &request, + HDC fontHdc, + int dpi) +{ + fontDef = request; // most settings are equal + HDC dc = ((request.styleStrategy & QFont::PreferDevice) && fontHdc) ? fontHdc : m_fontEngineData->hdc; + SelectObject(dc, hfont); + wchar_t n[64]; + GetTextFace(dc, 64, n); + fontDef.family = QString::fromWCharArray(n); + fontDef.fixedPitch = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH); + if (fontDef.pointSize < 0) { + fontDef.pointSize = fontDef.pixelSize * 72. / dpi; + } else if (fontDef.pixelSize == -1) { + fontDef.pixelSize = qRound(fontDef.pointSize * dpi / 72.); + } +} + +/*! + \class QWindowsMultiFontEngine + \brief Standard Windows Multi font engine. + \ingroup qt-lighthouse-win + + "Merges" several font engines that have gaps in the + supported writing systems. + + Will probably be superseded by a common Free Type font engine in Qt 5.X. +*/ + +QWindowsMultiFontEngine::QWindowsMultiFontEngine(QFontEngine *first, const QStringList &fallbacks) + : QFontEngineMulti(fallbacks.size()+1), + fallbacks(fallbacks) +{ + if (QWindowsContext::verboseFonts) + qDebug() << __FUNCTION__ << engines.size() << first << first->fontDef.family << fallbacks; + engines[0] = first; + first->ref.ref(); + fontDef = engines[0]->fontDef; + cache_cost = first->cache_cost; +} + +QWindowsMultiFontEngine::~QWindowsMultiFontEngine() +{ + if (QWindowsContext::verboseFonts) + qDebug("%s", __FUNCTION__); +} + +void QWindowsMultiFontEngine::loadEngine(int at) +{ + Q_ASSERT(at < engines.size()); + Q_ASSERT(engines.at(at) == 0); + + const QString fam = fallbacks.at(at-1); + QWindowsFontEngine *fe = static_cast(engines.at(0)); + LOGFONT lf = fe->logfont(); + memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded + HFONT hfont = CreateFontIndirect(&lf); + + bool stockFont = false; + if (hfont == 0) { + hfont = (HFONT)GetStockObject(ANSI_VAR_FONT); + stockFont = true; + } + engines[at] = new QWindowsFontEngine(fam, hfont, stockFont, lf, fe->fontEngineData()); + engines[at]->ref.ref(); + engines[at]->fontDef = fontDef; + if (QWindowsContext::verboseFonts) + qDebug("%s %d %s", __FUNCTION__, at, qPrintable(fam)); + + + // TODO: increase cost in QFontCache for the font engine loaded here +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h new file mode 100644 index 00000000000..bed5ecffbd0 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSFONTENGINE_H +#define QWINDOWSFONTENGINE_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. +// + +// Enable access to HB_Face in harfbuzz includes included by qfontengine_p.h. +#define QT_BUILD_GUI_LIB +#include +#undef QT_BUILD_GUI_LIB + +#include +#include + +#include "qtwindows_additional.h" + +QT_BEGIN_NAMESPACE + +class QWindowsNativeImage; +class QWindowsFontEngineData; + +class QWindowsFontEngine : public QFontEngine +{ + Q_DISABLE_COPY(QWindowsFontEngine) +public: + QWindowsFontEngine(const QString &name, HFONT, bool, LOGFONT, + QSharedPointer fontEngineData); + + ~QWindowsFontEngine(); + void initFontInfo(const QFontDef &request, + HDC fontHdc, int dpi); + + virtual QFixed lineThickness() const; + virtual Properties properties() const; + virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics); + virtual FaceId faceId() const; + virtual bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; + virtual int synthesized() const; + virtual QFixed emSquareSize() const; + + virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; + virtual void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const; + + virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags); + virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, + QPainterPath *path, QTextItem::RenderFlags flags); + + HGDIOBJ selectDesignFont() const; + + virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); + virtual glyph_metrics_t boundingBox(glyph_t g) { return boundingBox(g, QTransform()); } + virtual glyph_metrics_t boundingBox(glyph_t g, const QTransform &t); + + + virtual QFixed ascent() const; + virtual QFixed descent() const; + virtual QFixed leading() const; + virtual QFixed xHeight() const; + virtual QFixed averageCharWidth() const; + virtual qreal maxCharWidth() const; + virtual qreal minLeftBearing() const; + virtual qreal minRightBearing() const; + + virtual const char *name() const; + + bool canRender(const QChar *string, int len); + + Type type() const; + + virtual QImage alphaMapForGlyph(glyph_t t) { return alphaMapForGlyph(t, QTransform()); } + virtual QImage alphaMapForGlyph(glyph_t, const QTransform &xform); + virtual QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, int margin, const QTransform &xform); + + virtual QFontEngine *cloneWithSize(qreal pixelSize) const; + +#ifndef Q_CC_MINGW + virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0); +#endif + + int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const; + void getCMap(); + + bool getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const; + + static QFontEngine *createEngine(int script, const QFontDef &request, + HDC fontHdc, int dpi, bool rawMode, + const QStringList &family_list, + const QSharedPointer &data); + + QSharedPointer fontEngineData() const { return m_fontEngineData; } + LOGFONT logfont() const { return m_logfont; } + +private: + QWindowsNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform, + QImage::Format mask_format); + + const QSharedPointer m_fontEngineData; + + const QString _name; + QString uniqueFamilyName; + const HFONT hfont; + const LOGFONT m_logfont; + uint stockFont : 1; + uint ttf : 1; + uint hasOutline : 1; + TEXTMETRIC tm; + int lw; + const unsigned char *cmap; + QByteArray cmapTable; + mutable qreal lbearing; + mutable qreal rbearing; + QFixed designToDevice; + int unitsPerEm; + QFixed x_height; + FaceId _faceId; + + mutable int synthesized_flags; + mutable QFixed lineWidth; + mutable unsigned char *widthCache; + mutable uint widthCacheSize; + mutable QFixed *designAdvances; + mutable int designAdvancesSize; +}; + +class QWindowsMultiFontEngine : public QFontEngineMulti +{ +public: + QWindowsMultiFontEngine(QFontEngine *first, const QStringList &fallbacks); + virtual ~QWindowsMultiFontEngine(); + void loadEngine(int at); + + QStringList fallbacks; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSFONTENGINE_H diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp new file mode 100644 index 00000000000..46f0b0c3365 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -0,0 +1,737 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT_NO_DIRECTWRITE + +#include "qwindowsfontenginedirectwrite.h" +#include "qwindowsfontdatabase.h" +#include "qwindowscontext.h" + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +// Convert from design units to logical pixels +#define DESIGN_TO_LOGICAL(DESIGN_UNIT_VALUE) \ + QFixed::fromReal((qreal(DESIGN_UNIT_VALUE) / qreal(m_unitsPerEm)) * fontDef.pixelSize) + +namespace { + + class GeometrySink: public IDWriteGeometrySink + { + public: + GeometrySink(QPainterPath *path) : m_path(path), m_refCount(0) + { + Q_ASSERT(m_path != 0); + } + + IFACEMETHOD_(void, AddBeziers)(const D2D1_BEZIER_SEGMENT *beziers, UINT bezierCount); + IFACEMETHOD_(void, AddLines)(const D2D1_POINT_2F *points, UINT pointCount); + IFACEMETHOD_(void, BeginFigure)(D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin); + IFACEMETHOD(Close)(); + IFACEMETHOD_(void, EndFigure)(D2D1_FIGURE_END figureEnd); + IFACEMETHOD_(void, SetFillMode)(D2D1_FILL_MODE fillMode); + IFACEMETHOD_(void, SetSegmentFlags)(D2D1_PATH_SEGMENT vertexFlags); + + IFACEMETHOD_(unsigned long, AddRef)(); + IFACEMETHOD_(unsigned long, Release)(); + IFACEMETHOD(QueryInterface)(IID const &riid, void **ppvObject); + + private: + inline static QPointF fromD2D1_POINT_2F(const D2D1_POINT_2F &inp) + { + return QPointF(inp.x, inp.y); + } + + unsigned long m_refCount; + QPointF m_startPoint; + QPainterPath *m_path; + }; + + void GeometrySink::AddBeziers(const D2D1_BEZIER_SEGMENT *beziers, + UINT bezierCount) + { + for (uint i=0; icubicTo(c1, c2, p2); + } + } + + void GeometrySink::AddLines(const D2D1_POINT_2F *points, UINT pointsCount) + { + for (uint i=0; ilineTo(fromD2D1_POINT_2F(points[i])); + } + + void GeometrySink::BeginFigure(D2D1_POINT_2F startPoint, + D2D1_FIGURE_BEGIN /*figureBegin*/) + { + m_startPoint = fromD2D1_POINT_2F(startPoint); + m_path->moveTo(m_startPoint); + } + + IFACEMETHODIMP GeometrySink::Close() + { + return E_NOTIMPL; + } + + void GeometrySink::EndFigure(D2D1_FIGURE_END figureEnd) + { + if (figureEnd == D2D1_FIGURE_END_CLOSED) + m_path->closeSubpath(); + } + + void GeometrySink::SetFillMode(D2D1_FILL_MODE fillMode) + { + m_path->setFillRule(fillMode == D2D1_FILL_MODE_ALTERNATE + ? Qt::OddEvenFill + : Qt::WindingFill); + } + + void GeometrySink::SetSegmentFlags(D2D1_PATH_SEGMENT /*vertexFlags*/) + { + /* Not implemented */ + } + + IFACEMETHODIMP_(unsigned long) GeometrySink::AddRef() + { + return InterlockedIncrement(&m_refCount); + } + + IFACEMETHODIMP_(unsigned long) GeometrySink::Release() + { + unsigned long newCount = InterlockedDecrement(&m_refCount); + if (newCount == 0) + { + delete this; + return 0; + } + + return newCount; + } + + IFACEMETHODIMP GeometrySink::QueryInterface(IID const &riid, void **ppvObject) + { + if (__uuidof(IDWriteGeometrySink) == riid) { + *ppvObject = this; + } else if (__uuidof(IUnknown) == riid) { + *ppvObject = this; + } else { + *ppvObject = NULL; + return E_FAIL; + } + + AddRef(); + return S_OK; + } + +} + +/*! + \class QWindowsFontEngineDirectWrite + \brief Windows font engine using Direct Write. + \ingroup qt-lighthouse-win + + Font engine for subpixel positioned text on Windows Vista + (with platform update) and Windows 7. If selected during + configuration, the engine will be selected only when the hinting + preference of a font is set to None or Vertical hinting. The font + database uses most of the same logic but creates a direct write + font based on the LOGFONT rather than a GDI handle. + + The engine is currently regarded as experimental, meaning that code + using it should do substantial testing to make sure it covers their + use cases. + + Will probably be superseded by a common Free Type font engine in Qt 5.X. +*/ + +QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace, + qreal pixelSize, + const QSharedPointer &d) + + : m_fontEngineData(d) + , m_directWriteFontFace(directWriteFontFace) + , m_directWriteBitmapRenderTarget(0) + , m_lineThickness(-1) + , m_unitsPerEm(-1) + , m_ascent(-1) + , m_descent(-1) + , m_xHeight(-1) + , m_lineGap(-1) +{ + if (QWindowsContext::verboseFonts) + qDebug("%s %g", __FUNCTION__, pixelSize); + + d->directWriteFactory->AddRef(); + m_directWriteFontFace->AddRef(); + + fontDef.pixelSize = pixelSize; + collectMetrics(); +} + +QWindowsFontEngineDirectWrite::~QWindowsFontEngineDirectWrite() +{ + if (QWindowsContext::verboseFonts) + qDebug("%s", __FUNCTION__); + + m_fontEngineData->directWriteFactory->Release(); + m_directWriteFontFace->Release(); + + if (m_directWriteBitmapRenderTarget != 0) + m_directWriteBitmapRenderTarget->Release(); +} + +void QWindowsFontEngineDirectWrite::collectMetrics() +{ + if (m_directWriteFontFace != 0) { + DWRITE_FONT_METRICS metrics; + + m_directWriteFontFace->GetMetrics(&metrics); + m_unitsPerEm = metrics.designUnitsPerEm; + + m_lineThickness = DESIGN_TO_LOGICAL(metrics.underlineThickness); + m_ascent = DESIGN_TO_LOGICAL(metrics.ascent); + m_descent = DESIGN_TO_LOGICAL(metrics.descent); + m_xHeight = DESIGN_TO_LOGICAL(metrics.xHeight); + m_lineGap = DESIGN_TO_LOGICAL(metrics.lineGap); + } +} + +QFixed QWindowsFontEngineDirectWrite::lineThickness() const +{ + if (m_lineThickness > 0) + return m_lineThickness; + else + return QFontEngine::lineThickness(); +} + +bool QWindowsFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, uint *length) const +{ + if (m_directWriteFontFace) { + DWORD t = qbswap(tag); + + const void *tableData = 0; + void *tableContext = 0; + UINT32 tableSize; + BOOL exists; + HRESULT hr = m_directWriteFontFace->TryGetFontTable( + t, &tableData, &tableSize, &tableContext, &exists + ); + + if (SUCCEEDED(hr)) { + if (!exists) + return false; + + if (buffer == 0) { + *length = tableSize; + return true; + } else if (*length < tableSize) { + return false; + } + + qMemCopy(buffer, tableData, tableSize); + m_directWriteFontFace->ReleaseFontTable(tableContext); + + return true; + } else { + qErrnoWarning("%s: TryGetFontTable failed", __FUNCTION__); + } + } + + return false; +} + +QFixed QWindowsFontEngineDirectWrite::emSquareSize() const +{ + if (m_unitsPerEm > 0) + return m_unitsPerEm; + else + return QFontEngine::emSquareSize(); +} + +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; +} + +bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, + int *nglyphs, QTextEngine::ShaperFlags flags) const +{ + if (m_directWriteFontFace != 0) { + QVarLengthArray codePoints(len); + for (int i=0; i glyphIndices(len); + HRESULT hr = m_directWriteFontFace->GetGlyphIndicesW(codePoints.data(), + len, + glyphIndices.data()); + + if (SUCCEEDED(hr)) { + for (int i=0; iglyphs[i] = glyphIndices[i]; + + *nglyphs = len; + + if (!(flags & QTextEngine::GlyphIndicesOnly)) + recalcAdvances(glyphs, 0); + + return true; + } else { + qErrnoWarning("%s: GetGlyphIndicesW failed", __FUNCTION__); + } + } + + return false; +} + +void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const +{ + if (m_directWriteFontFace == 0) + return; + + QVarLengthArray glyphIndices(glyphs->numGlyphs); + + // ### Caching? + for(int i=0; inumGlyphs; i++) + glyphIndices[i] = UINT16(glyphs->glyphs[i]); + + QVarLengthArray glyphMetrics(glyphIndices.size()); + HRESULT hr = m_directWriteFontFace->GetDesignGlyphMetrics(glyphIndices.data(), + glyphIndices.size(), + glyphMetrics.data()); + if (SUCCEEDED(hr)) { + for (int i=0; inumGlyphs; ++i) { + glyphs->advances_x[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth); + if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) + glyphs->advances_x[i] = glyphs->advances_x[i].round(); + glyphs->advances_y[i] = 0; + } + } else { + qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__); + } +} + +void QWindowsFontEngineDirectWrite::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, + QPainterPath *path, QTextItem::RenderFlags flags) +{ + if (m_directWriteFontFace == 0) + return; + + QVarLengthArray glyphIndices(nglyphs); + QVarLengthArray glyphOffsets(nglyphs); + QVarLengthArray glyphAdvances(nglyphs); + + for (int i=0; iGetGlyphRunOutline( + fontDef.pixelSize, + glyphIndices.data(), + glyphAdvances.data(), + glyphOffsets.data(), + nglyphs, + false, + flags & QTextItem::RightToLeft, + &geometrySink + ); + + if (FAILED(hr)) + qErrnoWarning("%s: GetGlyphRunOutline failed", __FUNCTION__); +} + +glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(const QGlyphLayout &glyphs) +{ + if (glyphs.numGlyphs == 0) + return glyph_metrics_t(); + + bool round = fontDef.styleStrategy & QFont::ForceIntegerMetrics; + + QFixed w = 0; + for (int i = 0; i < glyphs.numGlyphs; ++i) { + w += round ? glyphs.effectiveAdvance(i).round() : glyphs.effectiveAdvance(i); + + } + + return glyph_metrics_t(0, -m_ascent, w - lastRightBearing(glyphs), m_ascent + m_descent, w, 0); +} + +glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g) +{ + if (m_directWriteFontFace == 0) + return glyph_metrics_t(); + + UINT16 glyphIndex = g; + + DWRITE_GLYPH_METRICS glyphMetrics; + HRESULT hr = m_directWriteFontFace->GetDesignGlyphMetrics(&glyphIndex, 1, &glyphMetrics); + if (SUCCEEDED(hr)) { + QFixed advanceWidth = DESIGN_TO_LOGICAL(glyphMetrics.advanceWidth); + QFixed leftSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.leftSideBearing); + QFixed rightSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.rightSideBearing); + QFixed advanceHeight = DESIGN_TO_LOGICAL(glyphMetrics.advanceHeight); + QFixed verticalOriginY = DESIGN_TO_LOGICAL(glyphMetrics.verticalOriginY); + + if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) { + advanceWidth = advanceWidth.round(); + advanceHeight = advanceHeight.round(); + } + + QFixed width = advanceWidth - leftSideBearing - rightSideBearing; + + return glyph_metrics_t(-leftSideBearing, -verticalOriginY, + width, m_ascent + m_descent, + advanceWidth, advanceHeight); + } else { + qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__); + } + + return glyph_metrics_t(); +} + +QFixed QWindowsFontEngineDirectWrite::ascent() const +{ + return fontDef.styleStrategy & QFont::ForceIntegerMetrics + ? m_ascent.round() + : m_ascent; +} + +QFixed QWindowsFontEngineDirectWrite::descent() const +{ + return fontDef.styleStrategy & QFont::ForceIntegerMetrics + ? (m_descent - 1).round() + : (m_descent - 1); +} + +QFixed QWindowsFontEngineDirectWrite::leading() const +{ + return fontDef.styleStrategy & QFont::ForceIntegerMetrics + ? m_lineGap.round() + : m_lineGap; +} + +QFixed QWindowsFontEngineDirectWrite::xHeight() const +{ + return fontDef.styleStrategy & QFont::ForceIntegerMetrics + ? m_xHeight.round() + : m_xHeight; +} + +qreal QWindowsFontEngineDirectWrite::maxCharWidth() const +{ + // ### + return 0; +} + +QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) +{ + QImage im = imageForGlyph(glyph, subPixelPosition, 0, QTransform()); + + QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); + QVector colors(256); + for (int i=0; i<256; ++i) + colors[i] = qRgba(0, 0, 0, i); + indexed.setColorTable(colors); + + for (int y=0; ypow_gamma[qGray(0xffffffff - *src)] * 255. / 2047.); + ++dst; + ++src; + } + } + + return indexed; +} + +bool QWindowsFontEngineDirectWrite::supportsSubPixelPositions() const +{ + return true; +} + +QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t, + QFixed subPixelPosition, + int margin, + const QTransform &xform) +{ + glyph_metrics_t metrics = QFontEngine::boundingBox(t, xform); + int width = (metrics.width + margin * 2 + 4).ceil().toInt() ; + int height = (metrics.height + margin * 2 + 4).ceil().toInt(); + + UINT16 glyphIndex = t; + FLOAT glyphAdvance = metrics.xoff.toReal(); + + DWRITE_GLYPH_OFFSET glyphOffset; + glyphOffset.advanceOffset = 0; + glyphOffset.ascenderOffset = 0; + + DWRITE_GLYPH_RUN glyphRun; + glyphRun.fontFace = m_directWriteFontFace; + glyphRun.fontEmSize = fontDef.pixelSize; + glyphRun.glyphCount = 1; + glyphRun.glyphIndices = &glyphIndex; + glyphRun.glyphAdvances = &glyphAdvance; + glyphRun.isSideways = false; + glyphRun.bidiLevel = 0; + glyphRun.glyphOffsets = &glyphOffset; + + QFixed x = margin - metrics.x.round() + subPixelPosition; + QFixed y = margin - metrics.y.floor(); + + DWRITE_MATRIX transform; + transform.dx = x.toReal(); + transform.dy = y.toReal(); + transform.m11 = xform.m11(); + transform.m12 = xform.m12(); + transform.m21 = xform.m21(); + transform.m22 = xform.m22(); + + IDWriteGlyphRunAnalysis *glyphAnalysis = NULL; + HRESULT hr = m_fontEngineData->directWriteFactory->CreateGlyphRunAnalysis( + &glyphRun, + 1.0f, + &transform, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC, + DWRITE_MEASURING_MODE_NATURAL, + 0.0, 0.0, + &glyphAnalysis + ); + + if (SUCCEEDED(hr)) { + RECT rect; + rect.left = 0; + rect.top = 0; + rect.right = width; + rect.bottom = height; + + int size = width * height * 3; + BYTE *alphaValues = new BYTE[size]; + qMemSet(alphaValues, size, 0); + + hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1, + &rect, + alphaValues, + size); + + if (SUCCEEDED(hr)) { + QImage img(width, height, QImage::Format_RGB32); + img.fill(0xffffffff); + + for (int y=0; y(img.scanLine(y)); + BYTE *src = alphaValues + width * 3 * y; + + for (int x=0; xRelease(); + + return img; + } else { + delete[] alphaValues; + glyphAnalysis->Release(); + + qErrnoWarning("%s: CreateAlphaTexture failed", __FUNCTION__); + } + + } else { + qErrnoWarning("%s: CreateGlyphRunAnalysis failed", __FUNCTION__); + } + + return QImage(); +} + +QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t, + QFixed subPixelPosition, + int margin, + const QTransform &xform) +{ + QImage mask = imageForGlyph(t, subPixelPosition, margin, xform); + return mask.depth() == 32 + ? mask + : mask.convertToFormat(QImage::Format_RGB32); +} + +const char *QWindowsFontEngineDirectWrite::name() const +{ + return 0; +} + +bool QWindowsFontEngineDirectWrite::canRender(const QChar *string, int len) +{ + QVarLengthArray codePoints(len); + int actualLength = 0; + for (int i=0; i glyphIndices(actualLength); + HRESULT hr = m_directWriteFontFace->GetGlyphIndices(codePoints.data(), actualLength, + glyphIndices.data()); + if (FAILED(hr)) { + qErrnoWarning("%s: GetGlyphIndices failed", __FUNCTION__); + return false; + } else { + for (int i=0; ifontDef = fontDef; + fontEngine->fontDef.pixelSize = pixelSize; + + return fontEngine; +} + +void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request, + int dpi, IDWriteFont *font) +{ + fontDef = request; + + IDWriteFontFamily *fontFamily = NULL; + HRESULT hr = font->GetFontFamily(&fontFamily); + + IDWriteLocalizedStrings *familyNames = NULL; + if (SUCCEEDED(hr)) + hr = fontFamily->GetFamilyNames(&familyNames); + + UINT32 index = 0; + BOOL exists = false; + + wchar_t localeName[LOCALE_NAME_MAX_LENGTH]; + + if (SUCCEEDED(hr)) { + int defaultLocaleSuccess = GetUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH); + + if (defaultLocaleSuccess) + hr = familyNames->FindLocaleName(localeName, &index, &exists); + + if (SUCCEEDED(hr) && !exists) + hr = familyNames->FindLocaleName(L"en-us", &index, &exists); + } + + if (!exists) + index = 0; + + UINT32 length = 0; + if (SUCCEEDED(hr)) + hr = familyNames->GetStringLength(index, &length); + + wchar_t *name = new (std::nothrow) wchar_t[length+1]; + if (name == NULL) + hr = E_OUTOFMEMORY; + + // Get the family name. + if (SUCCEEDED(hr)) + hr = familyNames->GetString(index, name, length + 1); + + if (SUCCEEDED(hr)) + fontDef.family = QString::fromWCharArray(name); + + delete[] name; + if (familyNames != NULL) + familyNames->Release(); + + if (FAILED(hr)) + qErrnoWarning(hr, "initFontInfo: Failed to get family name"); + + if (fontDef.pointSize < 0) + fontDef.pointSize = fontDef.pixelSize * 72. / dpi; + else if (fontDef.pixelSize == -1) + fontDef.pixelSize = qRound(fontDef.pointSize * dpi / 72.); +} + +QString QWindowsFontEngineDirectWrite::fontNameSubstitute(const QString &familyName) +{ + static const char keyC[] = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\" + "FontSubstitutes"; + return QSettings(QLatin1String(keyC), QSettings::NativeFormat).value(familyName, familyName).toString(); +} + +QT_END_NAMESPACE + +#endif // QT_NO_DIRECTWRITE diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h new file mode 100644 index 00000000000..1333720481e --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSFONTENGINEDIRECTWRITE_H +#define QWINDOWSFONTENGINEDIRECTWRITE_H + +#ifndef QT_NO_DIRECTWRITE + +// Enable access to HB_Face in harfbuzz includes included by qfontengine_p.h. +#define QT_BUILD_GUI_LIB +#include +#undef QT_BUILD_GUI_LIB + +#include + +class QWindowsFontEngineData; + +struct IDWriteFont ; +struct IDWriteFontFace ; +struct IDWriteFactory ; +struct IDWriteBitmapRenderTarget ; +struct IDWriteGdiInterop ; + +QT_BEGIN_NAMESPACE + +class QWindowsFontEngineDirectWrite : public QFontEngine +{ + Q_OBJECT +public: + explicit QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace, + qreal pixelSize, + const QSharedPointer &d); + ~QWindowsFontEngineDirectWrite(); + + void initFontInfo(const QFontDef &request, int dpi, IDWriteFont *font); + + QFixed lineThickness() const; + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; + QFixed emSquareSize() const; + + bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; + void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const; + + void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, + QPainterPath *path, QTextItem::RenderFlags flags); + + glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); + glyph_metrics_t boundingBox(glyph_t g); + + QFixed ascent() const; + QFixed descent() const; + QFixed leading() const; + QFixed xHeight() const; + qreal maxCharWidth() const; + + const char *name() const; + + bool supportsSubPixelPositions() const; + + QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition); + QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, int margin, + const QTransform &xform); + + QFontEngine *cloneWithSize(qreal pixelSize) const; + + bool canRender(const QChar *string, int len); + Type type() const; + + static QString fontNameSubstitute(const QString &familyName); + +private: + friend class QRawFontPrivate; + + QImage imageForGlyph(glyph_t t, QFixed subPixelPosition, int margin, const QTransform &xform); + void collectMetrics(); + + const QSharedPointer m_fontEngineData; + + IDWriteFontFace *m_directWriteFontFace; + IDWriteBitmapRenderTarget *m_directWriteBitmapRenderTarget; + + QFixed m_lineThickness; + int m_unitsPerEm; + QFixed m_ascent; + QFixed m_descent; + QFixed m_xHeight; + QFixed m_lineGap; + FaceId m_faceId; +}; + +QT_END_NAMESPACE + +#endif // QT_NO_DIRECTWRITE + +#endif // QWINDOWSFONTENGINEDIRECTWRITE_H diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp new file mode 100644 index 00000000000..4abccfb4163 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -0,0 +1,971 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsglcontext.h" +#include "qwindowscontext.h" +#include "qwindowswindow.h" + +#include +#include + +#include +#if defined(Q_CC_MINGW) +# include +#else +# include +#endif + +// #define DEBUG_GL + +// ARB extension API +#ifndef WGL_ARB_multisample +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +#endif + +#ifndef WGL_ARB_create_context +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x0001 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x0002 +// Error codes returned by GetLastError(). +#define ERROR_INVALID_VERSION_ARB 0x2095 +#define ERROR_INVALID_PROFILE_ARB 0x2096 +#endif + +#ifndef GL_VERSION_3_2 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_CONTEXT_FLAGS 0x821E +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 +#endif + +QT_BEGIN_NAMESPACE + +template inline bool testFlag(MaskType mask, FlagType flag) +{ + return (mask & MaskType(flag)) != 0; +} + +static inline bool hasGLOverlay(const PIXELFORMATDESCRIPTOR &pd) +{ return (pd.bReserved & 0x0f) != 0; } + +static inline bool isDirectRendering(const PIXELFORMATDESCRIPTOR &pfd) +{ return (pfd.dwFlags & PFD_GENERIC_ACCELERATED) || !(pfd.dwFlags & PFD_GENERIC_FORMAT); } + +static inline void initPixelFormatDescriptor(PIXELFORMATDESCRIPTOR *d) +{ + memset(d, 0, sizeof(PIXELFORMATDESCRIPTOR)); + d->nSize = sizeof(PIXELFORMATDESCRIPTOR); + d->nVersion = 1; +} + +QDebug operator<<(QDebug d, const PIXELFORMATDESCRIPTOR &pd) +{ + QDebug nsp = d.nospace(); + nsp << "PIXELFORMATDESCRIPTOR " + << "dwFlags=" << hex << showbase << pd.dwFlags << dec << noshowbase; + if (pd.dwFlags & PFD_DRAW_TO_WINDOW) nsp << " PFD_DRAW_TO_WINDOW"; + if (pd.dwFlags & PFD_DRAW_TO_BITMAP) nsp << " PFD_DRAW_TO_BITMAP"; + if (pd.dwFlags & PFD_SUPPORT_GDI) nsp << " PFD_SUPPORT_GDI"; + if (pd.dwFlags & PFD_SUPPORT_OPENGL) nsp << " PFD_SUPPORT_OPENGL"; + if (pd.dwFlags & PFD_GENERIC_ACCELERATED) nsp << " PFD_GENERIC_ACCELERATED"; + if (pd.dwFlags & PFD_SUPPORT_DIRECTDRAW) nsp << " PFD_SUPPORT_DIRECTDRAW"; + if (pd.dwFlags & PFD_DIRECT3D_ACCELERATED) nsp << " PFD_DIRECT3D_ACCELERATED"; + if (pd.dwFlags & PFD_SUPPORT_COMPOSITION) nsp << " PFD_SUPPORT_COMPOSITION"; + if (pd.dwFlags & PFD_GENERIC_FORMAT) nsp << " PFD_GENERIC_FORMAT"; + if (pd.dwFlags & PFD_NEED_PALETTE) nsp << " PFD_NEED_PALETTE"; + if (pd.dwFlags & PFD_NEED_SYSTEM_PALETTE) nsp << " PFD_NEED_SYSTEM_PALETTE"; + if (pd.dwFlags & PFD_DOUBLEBUFFER) nsp << " PFD_DOUBLEBUFFER"; + if (pd.dwFlags & PFD_STEREO) nsp << " PFD_STEREO"; + if (pd.dwFlags & PFD_SWAP_LAYER_BUFFERS) nsp << " PFD_SWAP_LAYER_BUFFERS"; + if (hasGLOverlay(pd)) nsp << " overlay"; + nsp << " iPixelType=" << pd.iPixelType << " cColorBits=" << pd.cColorBits + << " cRedBits=" << pd.cRedBits << " cRedShift=" << pd.cRedShift + << " cGreenBits=" << pd.cGreenBits << " cGreenShift=" << pd.cGreenShift + << " cBlueBits=" << pd.cBlueBits << " cBlueShift=" << pd.cBlueShift; + nsp << " cDepthBits=" << pd.cDepthBits; + if (pd.cStencilBits) + nsp << " cStencilBits=" << pd.cStencilBits; + if (pd.cAuxBuffers) + nsp << " cAuxBuffers=" << pd.cAuxBuffers; + nsp << " iLayerType=" << pd.iLayerType; + if (pd.dwVisibleMask) + nsp << " dwVisibleMask=" << pd.dwVisibleMask; + if (pd.cAlphaBits) + nsp << " cAlphaBits=" << pd.cAlphaBits << " cAlphaShift=" << pd.cAlphaShift; + if (pd.cAccumBits) + nsp << " cAccumBits=" << pd.cAccumBits << " cAccumRedBits=" << pd.cAccumRedBits + << " cAccumGreenBits=" << pd.cAccumGreenBits << " cAccumBlueBits=" << pd.cAccumBlueBits + << " cAccumAlphaBits=" << pd.cAccumAlphaBits; + return d; +} + +// Check whether an obtained PIXELFORMATDESCRIPTOR matches the request. +static inline bool + isAcceptableFormat(const QWindowsOpenGLAdditionalFormat &additional, + const PIXELFORMATDESCRIPTOR &pfd, + bool ignoreGLSupport = false) // ARB format may not contain it. +{ + const bool pixmapRequested = testFlag(additional.formatFlags, QWindowsGLRenderToPixmap); + return (ignoreGLSupport || testFlag(pfd.dwFlags, PFD_SUPPORT_OPENGL)) + && testFlag(pfd.dwFlags, PFD_DRAW_TO_BITMAP) == pixmapRequested + && hasGLOverlay(pfd) == testFlag(additional.formatFlags, QWindowsGLOverlay) + && (!pixmapRequested || pfd.cColorBits == additional.pixmapDepth); +} + +static void describeFormats(HDC hdc) +{ + const int pfiMax = DescribePixelFormat(hdc, 0, 0, NULL); + for (int i = 0; i < pfiMax; i++) { + PIXELFORMATDESCRIPTOR pfd; + initPixelFormatDescriptor(&pfd); + DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd); + qDebug() << '#' << i << '/' << pfiMax << ':' << pfd; + } +} + +// Classic GDI API +namespace GDI { +static QSurfaceFormat + qSurfaceFormatFromPixelFormat(const PIXELFORMATDESCRIPTOR &pfd, + QWindowsOpenGLAdditionalFormat *additionalIn = 0) +{ + QSurfaceFormat format; + if (pfd.dwFlags & PFD_DOUBLEBUFFER) + format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); + format.setDepthBufferSize(pfd.cDepthBits); + + if (pfd.iPixelType == PFD_TYPE_RGBA) + format.setAlphaBufferSize(pfd.cAlphaBits); + format.setRedBufferSize(pfd.cRedBits); + format.setGreenBufferSize(pfd.cGreenBits); + format.setBlueBufferSize(pfd.cBlueBits); + format.setStencilBufferSize(pfd.cStencilBits); + format.setStereo(pfd.dwFlags & PFD_STEREO); + if (additionalIn) { + QWindowsOpenGLAdditionalFormat additional; + if (isDirectRendering(pfd)) + additional.formatFlags |= QWindowsGLDirectRendering; + if (hasGLOverlay(pfd)) + additional.formatFlags |= QWindowsGLOverlay; + if (pfd.cAccumRedBits) + additional.formatFlags |= QWindowsGLAccumBuffer; + if (testFlag(pfd.dwFlags, PFD_DRAW_TO_BITMAP)) { + additional.formatFlags |= QWindowsGLRenderToPixmap; + additional.pixmapDepth = pfd.cColorBits; + } + *additionalIn = additional; + } + return format; +} + +static PIXELFORMATDESCRIPTOR + qPixelFormatFromSurfaceFormat(const QSurfaceFormat &format, + const QWindowsOpenGLAdditionalFormat &additional) +{ + PIXELFORMATDESCRIPTOR pfd; + initPixelFormatDescriptor(&pfd); + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.iLayerType = PFD_MAIN_PLANE; + pfd.dwFlags = PFD_SUPPORT_OPENGL; + if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) + pfd.dwFlags = PFD_SUPPORT_COMPOSITION; + const bool isPixmap = (additional.formatFlags & QWindowsGLRenderToPixmap) != 0; + pfd.dwFlags |= isPixmap ? PFD_DRAW_TO_BITMAP : PFD_DRAW_TO_WINDOW; + if (!(additional.formatFlags & QWindowsGLDirectRendering)) + pfd.dwFlags |= PFD_GENERIC_FORMAT; + + if (format.stereo()) + pfd.dwFlags |= PFD_STEREO; + if (format.swapBehavior() == QSurfaceFormat::DoubleBuffer && !isPixmap) + pfd.dwFlags |= PFD_DOUBLEBUFFER; + pfd.cDepthBits = + format.depthBufferSize() >= 0 ? format.depthBufferSize() : 32; + pfd.cAlphaBits = format.alphaBufferSize() > 0 ? format.alphaBufferSize() : 8; + pfd.cStencilBits = format.stencilBufferSize() > 0 ? format.stencilBufferSize() : 8; + if (additional.formatFlags & QWindowsGLAccumBuffer) + pfd.cAccumRedBits = pfd.cAccumGreenBits = pfd.cAccumBlueBits = pfd.cAccumAlphaBits = 16; + return pfd; +} + +// Choose a suitable pixelformat using GDI WinAPI in case ARB +// functions cannot be found. First tries to find a suitable +// format using GDI function ChoosePixelFormat(). Since that +// does not handle overlay and direct-rendering requests, manually loop +// over the available formats to find the best one. +// Note: As of Windows 7, it seems direct-rendering is handled, so, +// the code might be obsolete? +static int choosePixelFormat(HDC hdc, const QSurfaceFormat &format, + const QWindowsOpenGLAdditionalFormat &additional, + PIXELFORMATDESCRIPTOR *obtainedPfd) +{ + // 1) Try ChoosePixelFormat(). + PIXELFORMATDESCRIPTOR requestedPfd = qPixelFormatFromSurfaceFormat(format, QWindowsGLDirectRendering); + initPixelFormatDescriptor(obtainedPfd); + int pixelFormat = ChoosePixelFormat(hdc, &requestedPfd); + if (pixelFormat >= 0) { + DescribePixelFormat(hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), obtainedPfd); + if (isAcceptableFormat(additional, *obtainedPfd)) + return pixelFormat; + } + // 2) No matching format found, manual search loop. + const int pfiMax = DescribePixelFormat(hdc, 0, 0, NULL); + int bestScore = -1; + int bestPfi = -1; + const bool stereoRequested = format.stereo(); + const bool accumBufferRequested = testFlag(additional.formatFlags, QWindowsGLAccumBuffer); + const bool doubleBufferRequested = format.swapBehavior() == QSurfaceFormat::DoubleBuffer; + const bool directRenderingRequested = testFlag(additional.formatFlags, QWindowsGLDirectRendering); + for (int pfi = 1; pfi <= pfiMax; pfi++) { + PIXELFORMATDESCRIPTOR checkPfd; + initPixelFormatDescriptor(&checkPfd); + DescribePixelFormat(hdc, pfi, sizeof(PIXELFORMATDESCRIPTOR), &checkPfd); + if (isAcceptableFormat(additional, checkPfd)) { + int score = checkPfd.cColorBits + checkPfd.cAlphaBits + checkPfd.cStencilBits; + if (accumBufferRequested) + score += checkPfd.cAccumBits; + if (doubleBufferRequested == testFlag(checkPfd.dwFlags, PFD_DOUBLEBUFFER)) + score += 1000; + if (stereoRequested == testFlag(checkPfd.dwFlags, PFD_STEREO)) + score += 2000; + if (directRenderingRequested == isDirectRendering(checkPfd)) + score += 4000; + if (checkPfd.iPixelType == PFD_TYPE_RGBA) + score += 8000; + if (score > bestScore) { + bestScore = score; + bestPfi = pfi; + *obtainedPfd = checkPfd; + } + if (QWindowsContext::verboseGL) + qDebug() << __FUNCTION__ << " checking " << pfi << '/' << pfiMax + << " score=" << score << " (best " << bestPfi << '/' << bestScore + << ") " << checkPfd; + } + } // for + if (bestPfi > 0) + pixelFormat = bestPfi; + return pixelFormat; +} + +static inline HGLRC createContext(HDC hdc, HGLRC shared) +{ + HGLRC result = wglCreateContext(hdc); + if (!result) { + qErrnoWarning("%s: wglCreateContext failed.", __FUNCTION__); + return 0; + } + if (shared && !wglShareLists(shared, result)) + qErrnoWarning("%s: wglShareLists() failed.", __FUNCTION__); + return result; +} +} // namespace GDI + +// ARB OpenGL extension API +namespace ARB { +// Choose a suitable pixelformat using ARB extension functions. +static int choosePixelFormat(HDC hdc, + const QOpenGLStaticContext &staticContext, + const QSurfaceFormat &format, + const QWindowsOpenGLAdditionalFormat &additional, + PIXELFORMATDESCRIPTOR *obtainedPfd) +{ + enum { attribSize =40 }; + if ((additional.formatFlags & QWindowsGLRenderToPixmap) || !staticContext.hasExtensions()) + return 0; + + int iAttributes[attribSize]; + qFill(iAttributes, iAttributes + attribSize, int(0)); + int i = 0; + iAttributes[i++] = WGL_ACCELERATION_ARB; + iAttributes[i++] = testFlag(additional.formatFlags, QWindowsGLDirectRendering) ? + WGL_FULL_ACCELERATION_ARB : WGL_NO_ACCELERATION_ARB; + iAttributes[i++] = WGL_SUPPORT_OPENGL_ARB; + iAttributes[i++] = TRUE; + iAttributes[i++] = WGL_DRAW_TO_WINDOW_ARB; + iAttributes[i++] = TRUE; + iAttributes[i++] = WGL_COLOR_BITS_ARB; + iAttributes[i++] = 24; + switch (format.swapBehavior()) { + case QSurfaceFormat::DefaultSwapBehavior: + case QSurfaceFormat::TripleBuffer: + break; + case QSurfaceFormat::SingleBuffer: + iAttributes[i++] = WGL_DOUBLE_BUFFER_ARB; + iAttributes[i++] = FALSE; + break; + case QSurfaceFormat::DoubleBuffer: + iAttributes[i++] = WGL_DOUBLE_BUFFER_ARB; + iAttributes[i++] = TRUE; + break; + } + if (format.stereo()) { + iAttributes[i++] = WGL_STEREO_ARB; + iAttributes[i++] = TRUE; + } + if (format.depthBufferSize() >= 0) { + iAttributes[i++] = WGL_DEPTH_BITS_ARB; + iAttributes[i++] = format.depthBufferSize(); + } + iAttributes[i++] = WGL_PIXEL_TYPE_ARB; + iAttributes[i++] = WGL_TYPE_RGBA_ARB; + if (format.redBufferSize() >= 0) { + iAttributes[i++] = WGL_RED_BITS_ARB; + iAttributes[i++] = format.redBufferSize(); + } + if (format.greenBufferSize() >= 0) { + iAttributes[i++] = WGL_GREEN_BITS_ARB; + iAttributes[i++] = format.greenBufferSize(); + } + if (format.blueBufferSize() >= 0) { + iAttributes[i++] = WGL_BLUE_BITS_ARB; + iAttributes[i++] = format.blueBufferSize(); + } + iAttributes[i++] = WGL_ALPHA_BITS_ARB; + iAttributes[i++] = format.alphaBufferSize() >= 0 ? format.alphaBufferSize() : 8; + if (additional.formatFlags & QWindowsGLAccumBuffer) { + iAttributes[i++] = WGL_ACCUM_BITS_ARB; + iAttributes[i++] = 16; + } + iAttributes[i++] = WGL_STENCIL_BITS_ARB; + iAttributes[i++] = 8; + if (additional.formatFlags & QWindowsGLOverlay) { + iAttributes[i++] = WGL_NUMBER_OVERLAYS_ARB; + iAttributes[i++] = 1; + } + const bool sampleBuffersRequested = format.samples() > 1 + && testFlag(staticContext.extensions, QOpenGLStaticContext::SampleBuffers); + int samplesValuePosition = 0; + int samplesEnabledPosition = 0; + if (sampleBuffersRequested) { + iAttributes[i++] = WGL_SAMPLE_BUFFERS_ARB; + samplesEnabledPosition = i; + iAttributes[i++] = TRUE; + iAttributes[i++] = WGL_SAMPLES_ARB; + samplesValuePosition = i; + iAttributes[i++] = format.samples(); + } + // If sample buffer request cannot be satisfied, reduce request. + int pixelFormat = 0; + uint numFormats = 0; + while (true) { + const bool valid = + staticContext.wglChoosePixelFormatARB(hdc, iAttributes, 0, 1, + &pixelFormat, &numFormats) + && numFormats >= 1; + if (valid || !sampleBuffersRequested) + break; + if (iAttributes[samplesValuePosition] > 1) { + iAttributes[samplesValuePosition] /= 2; + } else { + break; + } + } + // Verify if format is acceptable. Note that the returned + // formats have been observed to not contain PFD_SUPPORT_OPENGL, ignore. + initPixelFormatDescriptor(obtainedPfd); + DescribePixelFormat(hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), obtainedPfd); + if (!isAcceptableFormat(additional, *obtainedPfd, true)) { + if (QWindowsContext::verboseGL) + qDebug() << __FUNCTION__ << " obtained px #" << pixelFormat + << " not acceptable=" << *obtainedPfd; + pixelFormat = 0; + } + + if (QWindowsContext::verboseGL) { + QDebug nsp = qDebug().nospace(); + nsp << __FUNCTION__; + if (sampleBuffersRequested) + nsp << " samples=" << iAttributes[samplesValuePosition]; + nsp << " Attributes: " << hex << showbase; + for (int ii = 0; ii < i; ++ii) + nsp << iAttributes[ii] << ','; + nsp << noshowbase << dec << "\n obtained px #" << pixelFormat + << " of " << numFormats << "\n " << *obtainedPfd; + } // Debug + + return pixelFormat; +} + +static QSurfaceFormat + qSurfaceFormatFromHDC(const QOpenGLStaticContext &staticContext, + HDC hdc, int pixelFormat, + QWindowsOpenGLAdditionalFormat *additionalIn = 0) +{ + enum { attribSize =40 }; + + QSurfaceFormat result; + if (!staticContext.hasExtensions()) + return result; + int iAttributes[attribSize]; + int iValues[attribSize]; + qFill(iAttributes, iAttributes + attribSize, int(0)); + qFill(iValues, iValues + attribSize, int(0)); + + int i = 0; + const bool hasSampleBuffers = testFlag(staticContext.extensions, QOpenGLStaticContext::SampleBuffers); + + iAttributes[i++] = WGL_DOUBLE_BUFFER_ARB; // 0 + iAttributes[i++] = WGL_DEPTH_BITS_ARB; // 1 + iAttributes[i++] = WGL_PIXEL_TYPE_ARB; // 2 + iAttributes[i++] = WGL_RED_BITS_ARB; // 3 + iAttributes[i++] = WGL_GREEN_BITS_ARB; // 4 + iAttributes[i++] = WGL_BLUE_BITS_ARB; // 5 + iAttributes[i++] = WGL_ALPHA_BITS_ARB; // 6 + iAttributes[i++] = WGL_ACCUM_BITS_ARB; // 7 + iAttributes[i++] = WGL_STENCIL_BITS_ARB; // 8 + iAttributes[i++] = WGL_STEREO_ARB; // 9 + iAttributes[i++] = WGL_ACCELERATION_ARB; // 10 + iAttributes[i++] = WGL_NUMBER_OVERLAYS_ARB; // 11 + if (hasSampleBuffers) { + iAttributes[i++] = WGL_SAMPLE_BUFFERS_ARB; // 12 + iAttributes[i++] = WGL_SAMPLES_ARB; // 13 + } + if (!staticContext.wglGetPixelFormatAttribIVARB(hdc, pixelFormat, 0, i, + iAttributes, iValues)) + return result; + if (iValues[0]) + result.setSwapBehavior(QSurfaceFormat::DoubleBuffer); + result.setDepthBufferSize(iValues[1]); + result.setRedBufferSize(iValues[3]); + result.setGreenBufferSize(iValues[4]); + result.setBlueBufferSize(iValues[5]); + result.setAlphaBufferSize(iValues[6]); + result.setStencilBufferSize(iValues[8]); + result.setStereo(iValues[9]); + if (hasSampleBuffers) + result.setSamples(iValues[13]); + if (additionalIn) { + if (iValues[7]) + additionalIn->formatFlags |= QWindowsGLAccumBuffer; + if (iValues[10] == WGL_FULL_ACCELERATION_ARB) + additionalIn->formatFlags |= QWindowsGLDirectRendering; + if (iValues[11]) + additionalIn->formatFlags |= QWindowsGLOverlay; + } + return result; +} + +static HGLRC createContext(const QOpenGLStaticContext &staticContext, + HDC hdc, + const QSurfaceFormat &format, + const QWindowsOpenGLAdditionalFormat &additional, + int majorVersion = 0, + int minorVersion = 0, + HGLRC shared = 0) +{ + enum { attribSize = 11 }; + + if (!staticContext.hasExtensions()) + return 0; + int attributes[attribSize]; + int attribIndex = 0; + qFill(attributes, attributes + attribSize, int(0)); + + if (majorVersion) { + attributes[attribIndex++] = WGL_CONTEXT_MAJOR_VERSION_ARB; + attributes[attribIndex++] = majorVersion; + attributes[attribIndex++] = WGL_CONTEXT_MINOR_VERSION_ARB; + attributes[attribIndex++] = minorVersion; + } + if (majorVersion >= 3 && additional.formatFlags & QWindowsGLDeprecatedFunctions) { + attributes[attribIndex++] = WGL_CONTEXT_FLAGS_ARB; + attributes[attribIndex++] = WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; + } + if ((staticContext.majorVersion == 3 && staticContext.minorVersion >= 2) + || staticContext.majorVersion > 3) { + switch (format.profile()) { + case QSurfaceFormat::NoProfile: + break; + case QSurfaceFormat::CoreProfile: + attributes[attribIndex++] = WGL_CONTEXT_PROFILE_MASK_ARB; + attributes[attribIndex++] = WGL_CONTEXT_CORE_PROFILE_BIT_ARB; + break; + case QSurfaceFormat::CompatibilityProfile: + attributes[attribIndex++] = WGL_CONTEXT_PROFILE_MASK_ARB; + attributes[attribIndex++] = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; + break; + } + } + const HGLRC result = + staticContext.wglCreateContextAttribsARB(hdc, shared, attributes); + if (!result) + qErrnoWarning("%s: wglCreateContextAttribsARB() failed.", __FUNCTION__); + return result; +} + +} // namespace ARB + +// Helpers for temporary contexts +static inline HWND createDummyGLWindow() +{ + return QWindowsContext::instance()-> + createDummyWindow(QStringLiteral("QtOpenGLDummyWindow"), + L"OpenGLDummyWindow", 0, WS_OVERLAPPED | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); +} + +// Create a dummy GL context (see QOpenGLTemporaryContext). +static inline HGLRC createDummyGLContext(HDC dc) +{ + if (!dc) + return 0; + PIXELFORMATDESCRIPTOR pixelFormDescriptor; + initPixelFormatDescriptor(&pixelFormDescriptor); + pixelFormDescriptor.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_GENERIC_FORMAT; + pixelFormDescriptor.iPixelType = PFD_TYPE_RGBA; + const int pixelFormat = ChoosePixelFormat(dc, &pixelFormDescriptor); + if (!pixelFormat) { + qErrnoWarning("%s: ChoosePixelFormat failed.", __FUNCTION__); + return 0; + } + if (!SetPixelFormat(dc, pixelFormat, &pixelFormDescriptor)) { + qErrnoWarning("%s: SetPixelFormat failed.", __FUNCTION__); + return 0; + } + HGLRC rc = wglCreateContext(dc); + if (!rc) { + qErrnoWarning("%s: wglCreateContext failed.", __FUNCTION__); + return 0; + } + return rc; +} + +static inline QOpenGLContextData currentOpenGLContextData() +{ + QOpenGLContextData result; + result.hdc = wglGetCurrentDC(); + result.renderingContext = wglGetCurrentContext(); + return result; +} + +static inline QOpenGLContextData createDummyWindowOpenGLContextData() +{ + QOpenGLContextData result; + result.hwnd = createDummyGLWindow(); + result.hdc = GetDC(result.hwnd); + result.renderingContext = createDummyGLContext(result.hdc); + return result; +} + +/*! + \class QOpenGLTemporaryContext + \brief A temporary context that can be instantiated on the stack. + + Functions like wglGetProcAddress() or glGetString() only work if there + is a current GL context. + + \ingroup qt-lighthouse-win +*/ + +class QOpenGLTemporaryContext +{ + Q_DISABLE_COPY(QOpenGLTemporaryContext) +public: + QOpenGLTemporaryContext(); + ~QOpenGLTemporaryContext(); + +private: + const QOpenGLContextData m_previous; + const QOpenGLContextData m_current; +}; + +QOpenGLTemporaryContext::QOpenGLTemporaryContext() : + m_previous(currentOpenGLContextData()), + m_current(createDummyWindowOpenGLContextData()) +{ + wglMakeCurrent(m_current.hdc, m_current.renderingContext); +} + +QOpenGLTemporaryContext::~QOpenGLTemporaryContext() +{ + wglMakeCurrent(m_previous.hdc, m_previous.renderingContext); + ReleaseDC(m_current.hwnd, m_current.hdc); + DestroyWindow(m_current.hwnd); + wglDeleteContext(m_current.renderingContext); +} + +/*! + \class QWindowsOpenGLAdditionalFormat + \brief Additional format information that is not in QSurfaceFormat + \ingroup qt-lighthouse-win +*/ + +/*! + \class QOpenGLStaticContext + \brief Static Open GL context containing version information, extension function pointers, etc. + + Functions pending integration in the next version of OpenGL are post-fixed ARB. + + \note Initialization requires an active context (see create()). + + \sa QWindowsGLContext + \ingroup qt-lighthouse-win +*/ + +#define SAMPLE_BUFFER_EXTENSION "GL_ARB_multisample" + +QOpenGLStaticContext::QOpenGLStaticContext() : + vendor(QOpenGLStaticContext::getGlString(GL_VENDOR)), + renderer(QOpenGLStaticContext::getGlString(GL_RENDERER)), + extensionNames(QOpenGLStaticContext::getGlString(GL_EXTENSIONS)), + majorVersion(0), minorVersion(0), + extensions(0), + wglGetPixelFormatAttribIVARB((WglGetPixelFormatAttribIVARB)wglGetProcAddress("wglGetPixelFormatAttribivARB")), + wglChoosePixelFormatARB((WglChoosePixelFormatARB)wglGetProcAddress("wglChoosePixelFormatARB")), + wglCreateContextAttribsARB((WglCreateContextAttribsARB)wglGetProcAddress("wglCreateContextAttribsARB")) +{ + if (extensionNames.startsWith(SAMPLE_BUFFER_EXTENSION" ") + || extensionNames.indexOf(" "SAMPLE_BUFFER_EXTENSION" ") != -1) + extensions |= SampleBuffers; + // Get version + do { + const QByteArray version = QOpenGLStaticContext::getGlString(GL_VERSION); + if (version.isEmpty()) + break; + const int majorDot = version.indexOf('.'); + if (majorDot == -1) + break; + int minorDot = version.indexOf('.', majorDot + 1); + if (minorDot == -1) + minorDot = version.size(); + majorVersion = version.mid(0, majorDot).toInt(); + minorVersion = version.mid(majorDot + 1, minorDot - majorDot - 1).toInt(); + } while (false); +} + +QByteArray QOpenGLStaticContext::getGlString(unsigned int which) +{ + if (const GLubyte *s = glGetString(which)) + return QByteArray((const char*)s); + return QByteArray(); +} + +QOpenGLStaticContext *QOpenGLStaticContext::create() +{ + // We need a current context for wglGetProcAdress()/getGLString() to work. + QScopedPointer temporaryContext; + if (!wglGetCurrentContext()) + temporaryContext.reset(new QOpenGLTemporaryContext); + QOpenGLStaticContext *result = new QOpenGLStaticContext; + if (QWindowsContext::verboseGL) + qDebug() << __FUNCTION__ << *result; + return result; +} + +QDebug operator<<(QDebug d, const QOpenGLStaticContext &s) +{ + QDebug nsp = d.nospace(); + nsp << "OpenGL: " << s.vendor << ',' << s.renderer << ",v" + << s.majorVersion << '.' << s.minorVersion; + if (s.extensions & QOpenGLStaticContext::SampleBuffers) + nsp << ",SampleBuffers"; + if (s.hasExtensions()) + nsp << ", Extension-API present"; + nsp << "\nExtensions: " << s.extensionNames; + return d; +} + +/*! + \class QWindowsGLContext + \brief Open GL context. + + An Open GL context for use with several windows. + As opposed to other implementations, activating a GL context for + a window requires a HDC allocated for it. The first time this + HDC is created for the window, the pixel format must be applied, + which will affect the window as well. The HDCs are stored in a list of + QOpenGLContextData and are released in doneCurrent(). + + \ingroup qt-lighthouse-win +*/ + +QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContext, + QOpenGLContext *context) : + m_staticContext(staticContext), + m_context(context), + m_pixelFormat(0), m_extensionsUsed(false) +{ + // workaround for matrox driver: + // make a cheap call to opengl to force loading of DLL + static bool opengl32dll = false; + if (!opengl32dll) { + GLint params; + glGetIntegerv(GL_DEPTH_BITS, ¶ms); + opengl32dll = true; + } + + // SetPixelFormat (as of Windows 7) requires a real window. + // Create a dummy one as we are not associated with a window yet. + // Try to find a suitable pixel format using preferably ARB extensions + // (default to GDI) and store that. + HWND dummyWindow = 0; + HDC hdc = 0; + do { + dummyWindow = createDummyGLWindow(); + if (!dummyWindow) + break; + hdc = GetDC(dummyWindow); + if (!hdc) + break; + + if (QWindowsContext::verboseGL > 1) + describeFormats(hdc); + // Preferably use direct rendering and ARB extensions (unless pixmap) + const QWindowsOpenGLAdditionalFormat + requestedAdditional(QWindowsGLDirectRendering|QWindowsGLDeprecatedFunctions); + const bool tryExtensions = m_staticContext->hasExtensions() + && !testFlag(requestedAdditional.formatFlags, QWindowsGLRenderToPixmap); + QWindowsOpenGLAdditionalFormat obtainedAdditional; + if (tryExtensions) { + m_pixelFormat = + ARB::choosePixelFormat(hdc, *m_staticContext, context->format(), + requestedAdditional, &m_obtainedPixelFormatDescriptor); + if (m_pixelFormat > 0) { + m_obtainedFormat = + ARB::qSurfaceFormatFromHDC(*m_staticContext, hdc, m_pixelFormat, + &obtainedAdditional); + m_extensionsUsed = true; + } + } // tryExtensions + if (!m_pixelFormat) { // Failed, try GDI + m_pixelFormat = GDI::choosePixelFormat(hdc, context->format(), requestedAdditional, + &m_obtainedPixelFormatDescriptor); + if (m_pixelFormat) + m_obtainedFormat = + GDI::qSurfaceFormatFromPixelFormat(m_obtainedPixelFormatDescriptor, + &obtainedAdditional); + } // try GDI + if (!m_pixelFormat) { + qWarning("%s: Unable find a suitable pixel format.", __FUNCTION__); + break; + } + if (!SetPixelFormat(hdc, m_pixelFormat, &m_obtainedPixelFormatDescriptor)) { + qErrnoWarning("SetPixelFormat failed."); + break; + } + // Create context with sharing, again preferably using ARB. + HGLRC sharingRenderingContext = 0; + if (const QPlatformOpenGLContext *sc = context->shareHandle()) + sharingRenderingContext = static_cast(sc)->renderingContext(); + + if (m_extensionsUsed) + m_renderingContext = + ARB::createContext(*m_staticContext, hdc, context->format(), + requestedAdditional, 0, 0, sharingRenderingContext); + if (!m_renderingContext) + m_renderingContext = GDI::createContext(hdc, sharingRenderingContext); + + if (!m_renderingContext) { + qWarning("Unable to create a GL Context."); + break; + } + } while (false); + if (hdc) + ReleaseDC(dummyWindow, hdc); + if (dummyWindow) + DestroyWindow(dummyWindow); + + if (QWindowsContext::verboseGL) + qDebug() + << __FUNCTION__ << this << " requested: " << context->format() + << "\n obtained #" << m_pixelFormat << (m_extensionsUsed ? "ARB" : "GDI") + << m_obtainedFormat << "\n " << m_obtainedPixelFormatDescriptor + << "\n HGLRC=" << m_renderingContext; +} + +QWindowsGLContext::~QWindowsGLContext() +{ + if (m_renderingContext) + wglDeleteContext(m_renderingContext); + releaseDCs(); +} + +void QWindowsGLContext::releaseDCs() +{ + const QOpenGLContextData *end = m_windowContexts.end(); + for (const QOpenGLContextData *p = m_windowContexts.begin(); p < end; ++p) + ReleaseDC(p->hwnd, p->hdc); + m_windowContexts.resize(0); +} + +static inline QWindowsWindow *glWindowOf(QPlatformSurface *s) +{ + return static_cast(s); +} + +static inline HWND handleOf(QPlatformSurface *s) +{ + return glWindowOf(s)->handle(); +} + +// Find a window in a context list. +static inline const QOpenGLContextData * + findByHWND(const Array &data, HWND hwnd) +{ + const QOpenGLContextData *end = data.end(); + for (const QOpenGLContextData *p = data.begin(); p < end; ++p) + if (p->hwnd == hwnd) + return p; + return 0; +} + +void QWindowsGLContext::swapBuffers(QPlatformSurface *surface) +{ + if (QWindowsContext::verboseGL > 1) + qDebug() << __FUNCTION__ << surface; + if (const QOpenGLContextData *contextData = findByHWND(m_windowContexts, handleOf(surface))) { + SwapBuffers(contextData->hdc); + } else { + qWarning("%s: Cannot find window %p", __FUNCTION__, handleOf(surface)); + } +} + +bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface) +{ +#ifdef DEBUG_GL + if (QWindowsContext::verboseGL > 1) + qDebug("%s context=%p contexts=%d", __FUNCTION__, this, m_windowContexts.size()); +#endif // DEBUG_GL + // Do we already have a DC entry for that window? + QWindowsWindow *window = static_cast(surface); + const HWND hwnd = window->handle(); + if (const QOpenGLContextData *contextData = findByHWND(m_windowContexts, hwnd)) + return wglMakeCurrent(contextData->hdc, contextData->renderingContext); + // Create a new entry. + const QOpenGLContextData newContext(m_renderingContext, hwnd, GetDC(hwnd)); + if (!newContext.hdc) + return false; + // Initialize pixel format first time. This will apply to + // the HWND as well and must be done only once. + if (!window->testFlag(QWindowsWindow::PixelFormatInitialized)) { + if (!SetPixelFormat(newContext.hdc, m_pixelFormat, &m_obtainedPixelFormatDescriptor)) { + qErrnoWarning("%s: SetPixelFormat() failed", __FUNCTION__); + ReleaseDC(newContext.hwnd, newContext.hdc); + return false; + } + window->setFlag(QWindowsWindow::PixelFormatInitialized); + } + m_windowContexts.append(newContext); + return wglMakeCurrent(newContext.hdc, newContext.renderingContext); +} + +void QWindowsGLContext::doneCurrent() +{ +#ifdef DEBUG_GL + if (QWindowsContext::verboseGL > 1) + qDebug("%s context=%p %d contexts", __FUNCTION__, this, m_windowContexts.size()); +#endif // DEBUG_GL + wglMakeCurrent(0, 0); + releaseDCs(); +} + +QWindowsGLContext::GL_Proc QWindowsGLContext::getProcAddress(const QByteArray &procName) +{ + // TODO: Will that work with the calling conventions? + GL_Proc procAddress = reinterpret_cast(wglGetProcAddress(procName.constData())); + if (QWindowsContext::verboseGL) + qDebug("%s('%s') with current_hglrc=%p returns %p", + __FUNCTION__, procName.constData(), + wglGetCurrentContext(), procAddress); + return procAddress; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h new file mode 100644 index 00000000000..0bf8ffbbc57 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsglcontext.h @@ -0,0 +1,165 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSGLCONTEXT_H +#define QWINDOWSGLCONTEXT_H + +#include "array.h" +#include "qtwindows_additional.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QDebug; + +enum QWindowsGLFormatFlags +{ + QWindowsGLDirectRendering = 0x1, + QWindowsGLOverlay = 0x2, + QWindowsGLRenderToPixmap = 0x4, + QWindowsGLAccumBuffer = 0x8, + QWindowsGLDeprecatedFunctions = 0x10 +}; + +// Additional format information for Windows. +struct QWindowsOpenGLAdditionalFormat +{ + QWindowsOpenGLAdditionalFormat(unsigned formatFlagsIn = 0, unsigned pixmapDepthIn = 0) : + formatFlags(formatFlagsIn), pixmapDepth(pixmapDepthIn) {} + unsigned formatFlags; // QWindowsGLFormatFlags. + unsigned pixmapDepth; // for QWindowsGLRenderToPixmap +}; + +// Per-window data for active OpenGL contexts. +struct QOpenGLContextData +{ + QOpenGLContextData(HGLRC r, HWND h, HDC d) : renderingContext(r), hwnd(h), hdc(d) {} + QOpenGLContextData() : renderingContext(0), hwnd(0), hdc(0) {} + + HGLRC renderingContext; + HWND hwnd; + HDC hdc; +}; + +class QOpenGLStaticContext +{ + Q_DISABLE_COPY(QOpenGLStaticContext) + QOpenGLStaticContext(); +public: + enum Extensions + { + SampleBuffers = 0x1 + }; + + typedef bool + (APIENTRY *WglGetPixelFormatAttribIVARB) + (HDC hdc, int iPixelFormat, int iLayerPlane, + uint nAttributes, const int *piAttributes, int *piValues); + + typedef bool + (APIENTRY *WglChoosePixelFormatARB)(HDC hdc, const int *piAttribList, + const float *pfAttribFList, uint nMaxFormats, int *piFormats, + UINT *nNumFormats); + + typedef HGLRC + (APIENTRY *WglCreateContextAttribsARB)(HDC, HGLRC, const int *); + + bool hasExtensions() const + { return wglGetPixelFormatAttribIVARB && wglChoosePixelFormatARB && wglCreateContextAttribsARB; } + + static QOpenGLStaticContext *create(); + static QByteArray getGlString(unsigned int which); + + const QByteArray vendor; + const QByteArray renderer; + const QByteArray extensionNames; + int majorVersion; + int minorVersion; + unsigned extensions; + + WglGetPixelFormatAttribIVARB wglGetPixelFormatAttribIVARB; + WglChoosePixelFormatARB wglChoosePixelFormatARB; + WglCreateContextAttribsARB wglCreateContextAttribsARB; +}; + +QDebug operator<<(QDebug d, const QOpenGLStaticContext &); + +class QWindowsGLContext : public QPlatformOpenGLContext +{ +public: + typedef QSharedPointer QOpenGLStaticContextPtr; + + explicit QWindowsGLContext(const QOpenGLStaticContextPtr &staticContext, + QOpenGLContext *context); + virtual ~QWindowsGLContext(); + bool isValid() const { return m_renderingContext; } + virtual QSurfaceFormat format() const { return m_obtainedFormat; } + + virtual void swapBuffers(QPlatformSurface *surface); + + virtual bool makeCurrent(QPlatformSurface *surface); + virtual void doneCurrent(); + + typedef void (*GL_Proc) (); + + virtual GL_Proc getProcAddress(const QByteArray &procName); + + HGLRC renderingContext() const { return m_renderingContext; } + +private: + inline void releaseDCs(); + + const QOpenGLStaticContextPtr m_staticContext; + QOpenGLContext *m_context; + QSurfaceFormat m_obtainedFormat; + HGLRC m_renderingContext; + Array m_windowContexts; + PIXELFORMATDESCRIPTOR m_obtainedPixelFormatDescriptor; + int m_pixelFormat; + bool m_extensionsUsed; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSGLCONTEXT_H diff --git a/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp new file mode 100644 index 00000000000..fe03a7ffe88 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsguieventdispatcher.cpp @@ -0,0 +1,215 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsguieventdispatcher.h" +#include "qwindowscontext.h" + +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QWindowsGuiEventDispatcher + \brief Event dispatcher for Windows + + Maintains a global stack storing the current event dispatcher and + its processing flags for access from the Windows procedure + qWindowsWndProc. Handling the Lighthouse gui events should be done + from within the qWindowsWndProc to ensure correct processing of messages. + + \ingroup qt-lighthouse-win +*/ + +typedef QStack DispatchContextStack; + +Q_GLOBAL_STATIC(DispatchContextStack, dispatchContextStack) + +QWindowsGuiEventDispatcher::QWindowsGuiEventDispatcher(QObject *parent) : + QEventDispatcherWin32(parent) +{ + setObjectName(QStringLiteral("QWindowsGuiEventDispatcher_0x") + QString::number((quintptr)this, 16)); + if (QWindowsContext::verboseEvents) + qDebug("%s %s", __FUNCTION__, qPrintable(objectName())); + dispatchContextStack()->push(DispatchContext(this, QEventLoop::AllEvents)); +} + +QWindowsGuiEventDispatcher::~QWindowsGuiEventDispatcher() +{ + if (QWindowsContext::verboseEvents) + qDebug("%s %s", __FUNCTION__, qPrintable(objectName())); + if (!dispatchContextStack()->isEmpty()) + dispatchContextStack()->pop(); +} + +bool QWindowsGuiEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) +{ + DispatchContextStack &stack = *dispatchContextStack(); + if (QWindowsContext::verboseEvents > 2) + qDebug(">%s %s %d", __FUNCTION__, qPrintable(objectName()), stack.size()); + stack.push(DispatchContext(this, flags)); + const bool rc = QEventDispatcherWin32::processEvents(flags); + stack.pop(); + if (QWindowsContext::verboseEvents > 2) + qDebug("<%s %s returns %d", __FUNCTION__, qPrintable(objectName()), rc); + return rc; +} + +QWindowsGuiEventDispatcher::DispatchContext QWindowsGuiEventDispatcher::currentDispatchContext() +{ + const DispatchContextStack &stack = *dispatchContextStack(); + if (stack.isEmpty()) { + qWarning("%s: No dispatch context", __FUNCTION__); + return DispatchContext(0, 0); + } + return stack.top(); +} + +// Helpers for printing debug output for WM_* messages. +struct MessageDebugEntry +{ + UINT message; + const char *description; + bool interesting; +}; + +static const MessageDebugEntry +messageDebugEntries[] = { + {WM_CREATE, "WM_CREATE", true}, + {WM_PAINT, "WM_PAINT", true}, + {WM_CLOSE, "WM_CLOSE", true}, + {WM_DESTROY, "WM_DESTROY", true}, + {WM_MOVE, "WM_MOVE", true}, + {WM_SIZE, "WM_SIZE", true}, + {WM_MOUSEACTIVATE,"WM_MOUSEACTIVATE", true}, + {WM_CHILDACTIVATE, "WM_CHILDACTIVATE", true}, + {WM_PARENTNOTIFY, "WM_PARENTNOTIFY", true}, + {WM_GETICON, "WM_GETICON", false}, + {WM_KEYDOWN, "WM_KEYDOWN", true}, + {WM_SYSKEYDOWN, "WM_SYSKEYDOWN", true}, + {WM_SYSCOMMAND, "WM_SYSCOMMAND", true}, + {WM_KEYUP, "WM_KEYUP", true}, + {WM_SYSKEYUP, "WM_SYSKEYUP", true}, + {WM_IME_CHAR, "WM_IMECHAR", true}, + {WM_IME_KEYDOWN, "WM_IMECHAR", true}, + {WM_CANCELMODE, "WM_CANCELMODE", true}, + {WM_CHAR, "WM_CHAR", true}, + {WM_DEADCHAR, "WM_DEADCHAR", true}, + {WM_ACTIVATE, "WM_ACTIVATE", true}, + {WM_GETMINMAXINFO, "WM_GETMINMAXINFO", true}, + {WM_SETFOCUS, "WM_SETFOCUS", true}, + {WM_KILLFOCUS, "WM_KILLFOCUS", true}, + {WM_ENABLE, "WM_ENABLE", true}, + {WM_SHOWWINDOW, "WM_SHOWWINDOW", true}, + {WM_GETMINMAXINFO, "WM_GETMINMAXINFO"}, + {WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING", true}, + {WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED", true}, + {WM_SETCURSOR, "WM_SETCURSOR", false}, + {WM_GETFONT, "WM_GETFONT", true}, + {WM_NCMOUSEMOVE, "WM_NCMOUSEMOVE", true}, + {WM_LBUTTONDOWN, "WM_LBUTTONDOWN", true}, + {WM_LBUTTONUP, "WM_LBUTTONUP", true}, + {WM_LBUTTONDBLCLK, "WM_LBUTTONDBLCLK", true}, + {WM_RBUTTONDOWN, "WM_RBUTTONDOWN", true}, + {WM_RBUTTONUP, "WM_RBUTTONUP", true}, + {WM_RBUTTONDBLCLK, "WM_RBUTTONDBLCLK", true}, + {WM_MBUTTONDOWN, "WM_MBUTTONDOWN", true}, + {WM_MBUTTONUP, "WM_MBUTTONUP", true}, + {WM_MBUTTONDBLCLK, "WM_MBUTTONDBLCLK", true}, + {WM_MOUSEWHEEL, "WM_MOUSEWHEEL", true}, + {WM_XBUTTONDOWN, "WM_XBUTTONDOWN", true}, + {WM_XBUTTONUP, "WM_XBUTTONUP", true}, + {WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK", true}, + {WM_MOUSEHWHEEL, "WM_MOUSEHWHEEL", true}, + {WM_NCCREATE, "WM_NCCREATE", true}, + {WM_NCCALCSIZE, "WM_NCCALCSIZE", true}, + {WM_NCACTIVATE, "WM_NCACTIVATE", true}, + {WM_NCMOUSELEAVE, "WM_NCMOUSELEAVE", true}, + {WM_NCLBUTTONDOWN, "WM_NCLBUTTONDOWN", true}, + {WM_NCLBUTTONUP, "WM_NCLBUTTONUP", true}, + {WM_ACTIVATEAPP, "WM_ACTIVATEAPP", true}, + {WM_NCPAINT, "WM_NCPAINT", true}, + {WM_ERASEBKGND, "WM_ERASEBKGND", true}, + {WM_MOUSEMOVE, "WM_MOUSEMOVE", true}, + {WM_MOUSELEAVE, "WM_MOUSELEAVE", true}, + {WM_NCHITTEST, "WM_NCHITTEST", false}, + {WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", true}, + {WM_INPUTLANGCHANGE, "WM_INPUTLANGCHANGE", true}, + {WM_IME_NOTIFY, "WM_IME_NOTIFY", true}, +#if defined(WM_DWMNCRENDERINGCHANGED) + {WM_DWMNCRENDERINGCHANGED, "WM_DWMNCRENDERINGCHANGED", true}, +#endif + {WM_IME_SETCONTEXT, "WM_IME_SETCONTEXT", true}, + {WM_IME_NOTIFY, "WM_IME_NOTIFY", true}, + {WM_TOUCH, "WM_TOUCH", true}, + {WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN", true}, + {WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD", true}, + {WM_RENDERFORMAT, "WM_RENDERFORMAT", true}, + {WM_RENDERALLFORMATS, "WM_RENDERALLFORMATS", true}, + {WM_DESTROYCLIPBOARD, "WM_DESTROYCLIPBOARD", true}, + {WM_CAPTURECHANGED, "WM_CAPTURECHANGED", true}, + {WM_IME_STARTCOMPOSITION, "WM_IME_STARTCOMPOSITION"}, + {WM_IME_COMPOSITION, "WM_IME_COMPOSITION"}, + {WM_IME_ENDCOMPOSITION, "WM_IME_ENDCOMPOSITION"}, + {WM_IME_NOTIFY, "WM_IME_NOTIFY"}, + {WM_IME_REQUEST, "WM_IME_REQUEST"} +}; + +static inline const MessageDebugEntry *messageDebugEntry(UINT msg) +{ + for (size_t i = 0; i < sizeof(messageDebugEntries)/sizeof(MessageDebugEntry); i++) + if (messageDebugEntries[i].message == msg) + return messageDebugEntries + i; + return 0; +} + +const char *QWindowsGuiEventDispatcher::windowsMessageName(UINT msg) +{ + if (const MessageDebugEntry *e = messageDebugEntry(msg)) + return e->description; + return "Unknown"; +} + +QT_END_NAMESPACE diff --git a/src/plugins/gfxdrivers/ahi/qscreenahi_qws.h b/src/plugins/platforms/windows/qwindowsguieventdispatcher.h similarity index 68% rename from src/plugins/gfxdrivers/ahi/qscreenahi_qws.h rename to src/plugins/platforms/windows/qwindowsguieventdispatcher.h index a00cf77abff..00fd234eff1 100644 --- a/src/plugins/gfxdrivers/ahi/qscreenahi_qws.h +++ b/src/plugins/platforms/windows/qwindowsguieventdispatcher.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. ** @@ -39,46 +39,33 @@ ** ****************************************************************************/ -#ifndef QAHISCREEN_H -#define QAHISCREEN_H +#ifndef QWINDOWSGUIEVENTDISPATCHER_H +#define QWINDOWSGUIEVENTDISPATCHER_H -#include +#include "qtwindowsglobal.h" +#include "qtwindows_additional.h" -#ifndef QT_NO_QWS_AHI - -QT_BEGIN_HEADER +#include +#include QT_BEGIN_NAMESPACE -QT_MODULE(Gui) - -class QAhiScreenPrivate; - -class QAhiScreen : public QScreen +class QWindowsGuiEventDispatcher : public QEventDispatcherWin32 { + Q_OBJECT public: - QAhiScreen(int displayId); - ~QAhiScreen(); + explicit QWindowsGuiEventDispatcher(QObject *parent = 0); + ~QWindowsGuiEventDispatcher(); - bool connect(const QString &displaySpec); - void disconnect(); - bool initDevice(); - void shutdownDevice(); - void setMode(int width, int height, int depth); + typedef QPair DispatchContext; - void blit(const QImage &image, const QPoint &topLeft, - const QRegion ®ion); - void solidFill(const QColor &color, const QRegion ®ion); + static DispatchContext currentDispatchContext(); -private: - bool configure(); + static const char *windowsMessageName(UINT msg); - QAhiScreenPrivate *d_ptr; + virtual bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags); }; QT_END_NAMESPACE -QT_END_HEADER - -#endif // QT_NO_QWS_AHI -#endif // QAHISCREEN_H +#endif // QWINDOWSGUIEVENTDISPATCHER_H diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp new file mode 100644 index 00000000000..e3dc1008055 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -0,0 +1,598 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsinputcontext.h" +#include "qwindowscontext.h" +#include "qwindowswindow.h" +#include "qwindowsintegration.h" +#include "qwindowsmousehandler.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static inline QByteArray debugComposition(int lParam) +{ + QByteArray str; + if (lParam & GCS_RESULTSTR) + str += "RESULTSTR "; + if (lParam & GCS_COMPSTR) + str += "COMPSTR "; + if (lParam & GCS_COMPATTR) + str += "COMPATTR "; + if (lParam & GCS_CURSORPOS) + str += "CURSORPOS "; + if (lParam & GCS_COMPCLAUSE) + str += "COMPCLAUSE "; + if (lParam & CS_INSERTCHAR) + str += "INSERTCHAR "; + if (lParam & CS_NOMOVECARET) + str += "NOMOVECARET "; + return str; +} + +// Cancel current IME composition. +static inline void imeNotifyCancelComposition(HWND hwnd) +{ + const HIMC himc = ImmGetContext(hwnd); + ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0); + ImmReleaseContext(hwnd, himc); +} + +// Query a QObject for an InputMethod-related value +// by sending a QInputMethodQueryEvent. +template + bool inputMethodQuery(QObject *fo, Qt::InputMethodQuery query, T *result) +{ + QInputMethodQueryEvent queryEvent(query); + if (!QCoreApplication::sendEvent(fo, &queryEvent)) + return false; + *result = qvariant_cast(queryEvent.value()); + return true; +} + +/*! + \class QWindowsInputContext + \brief Windows Input context implementation + + Handles input of foreign characters (particularly East Asian) + languages. + + \section1 Testing + + \list + \o Install the East Asian language support and choose Japanese (say). + \o Compile the \a mainwindows/mdi example and open a text window. + \o In the language bar, switch to Japanese and choose the + Input method 'Hiragana'. + \o In a text editor control, type the syllable \a 'la'. + Underlined characters show up, indicating that there is completion + available. Press the Space key two times. A completion popup occurs + which shows the options. + \endlist + + Reconversion: Input texts can be 'converted' into different + input modes or more completion suggestions can be made based on + context to correct errors. This is bound to the 'Conversion key' + (F13-key in Japanese, which can be changed in the + configuration). After writing text, pressing the key selects text + and triggers a conversion popup, which shows the alternatives for + the word. + + \section1 Interaction + + When the user activates input methods, Windows sends + WM_IME_STARTCOMPOSITION, WM_IME_COMPOSITION, + WM_IME_ENDCOMPOSITION messages that trigger startComposition(), + composition(), endComposition(), respectively. No key events are sent. + + composition() determines the markup of the pre-edit or selected + text and/or the final text and sends that to the focus object. + + In between startComposition(), endComposition(), multiple + compositions may happen (isComposing). + + update() is called to synchronize the position of the candidate + window with the microfocus rectangle of the focus object. + Also, a hidden caret is moved along with that position, + which is important for some Chinese input methods. + + reset() is called to cancel a composition if the mouse is + moved outside or for example some Undo/Redo operation is + invoked. + + \note Mouse interaction of popups with + QtWindows::InputMethodOpenCandidateWindowEvent and + QtWindows::InputMethodCloseCandidateWindowEvent + needs to be checked (mouse grab might interfere with candidate window). + + \ingroup qt-lighthouse-win +*/ + +QWindowsInputContext::CompositionContext::CompositionContext() : + hwnd(0), haveCaret(false), position(0), isComposing(false) +{ +} + +QWindowsInputContext::QWindowsInputContext() : + m_WM_MSIME_MOUSE(RegisterWindowMessage(L"MSIMEMouseOperation")), + m_endCompositionRecursionGuard(false) +{ +} + +QWindowsInputContext::~QWindowsInputContext() +{ +} + +/*! + \brief Cancels a composition. +*/ + +void QWindowsInputContext::reset() +{ + QPlatformInputContext::reset(); + if (!m_compositionContext.hwnd) + return; + QObject *fo = focusObject(); + if (QWindowsContext::verboseInputMethods) + qDebug() << __FUNCTION__<< fo; + if (!fo) + return; + if (m_compositionContext.isComposing) { + QInputMethodEvent event; + if (!m_compositionContext.composition.isEmpty()) + event.setCommitString(m_compositionContext.composition); + QCoreApplication::sendEvent(fo, &event); + endContextComposition(); + } + imeNotifyCancelComposition(m_compositionContext.hwnd); + doneContext(); +} + +/*! + \brief Moves the candidate window along with microfocus of the focus object. +*/ + +void QWindowsInputContext::update() +{ + QPlatformInputContext::update(); + if (!m_compositionContext.hwnd) + return; + QObject *fo = focusObject(); + if (!fo) + return; + const HIMC himc = ImmGetContext(m_compositionContext.hwnd); + if (!himc) + return; + // Move candidate list window to the microfocus position. + QRect globalMicroFocusRect; + if (!inputMethodQuery(fo, Qt::ImCursorRectangle, &globalMicroFocusRect) || !globalMicroFocusRect.isValid()) + return; + if (QWindowsContext::verboseInputMethods) + qDebug() << __FUNCTION__ << himc << globalMicroFocusRect; + + if (globalMicroFocusRect.isValid()) { + const QRect microFocusRect(QWindowsGeometryHint::mapFromGlobal(m_compositionContext.hwnd, + globalMicroFocusRect.topLeft()), + globalMicroFocusRect.size()); + COMPOSITIONFORM cf; + // ### need X-like inputStyle config settings + cf.dwStyle = CFS_FORCE_POSITION; + cf.ptCurrentPos.x = microFocusRect.x(); + cf.ptCurrentPos.y = microFocusRect.y(); + + CANDIDATEFORM candf; + candf.dwIndex = 0; + candf.dwStyle = CFS_EXCLUDE; + candf.ptCurrentPos.x = microFocusRect.x(); + candf.ptCurrentPos.y = microFocusRect.y() + microFocusRect.height(); + candf.rcArea.left = microFocusRect.x(); + candf.rcArea.top = microFocusRect.y(); + candf.rcArea.right = microFocusRect.x() + microFocusRect.width(); + candf.rcArea.bottom = microFocusRect.y() + microFocusRect.height(); + + if (m_compositionContext.haveCaret) + SetCaretPos(microFocusRect.x(), microFocusRect.y()); + + ImmSetCompositionWindow(himc, &cf); + ImmSetCandidateWindow(himc, &candf); + } + ImmReleaseContext(m_compositionContext.hwnd, himc); +} + +void QWindowsInputContext::mouseHandler(int pos, QMouseEvent *event) +{ + if (event->type() != QEvent::MouseButtonPress || !m_compositionContext.hwnd) + return; + if (QWindowsContext::verboseInputMethods) + qDebug() << __FUNCTION__ << pos << event; + + if (pos < 0 || pos > m_compositionContext.composition.size()) + reset(); + + // Magic code that notifies Japanese IME about the cursor + // position. + const DWORD button = QWindowsMouseHandler::mouseButtonsToKeyState(event->buttons()); + const HIMC himc = ImmGetContext(m_compositionContext.hwnd); + const HWND imeWindow = ImmGetDefaultIMEWnd(m_compositionContext.hwnd); + SendMessage(imeWindow, m_WM_MSIME_MOUSE, MAKELONG(MAKEWORD(button, pos == 0 ? 2 : 1), pos), (LPARAM)himc); + ImmReleaseContext(m_compositionContext.hwnd, himc); +} + +void QWindowsInputContext::setFocusObject(QObject *object) +{ + if (QWindowsContext::verboseInputMethods) + qDebug() << __FUNCTION__ << object; + + QPlatformInputContext::setFocusObject(object); +} + +QWindowsInputContext *QWindowsInputContext::instance() +{ + return static_cast(QWindowsIntegration::instance()->inputContext()); +} + +static inline QString getCompositionString(HIMC himc, DWORD dwIndex) +{ + enum { bufferSize = 256 }; + wchar_t buffer[bufferSize]; + const int length = ImmGetCompositionString(himc, dwIndex, buffer, bufferSize * sizeof(wchar_t)); + return QString::fromWCharArray(buffer, length / sizeof(wchar_t)); +} + +// Determine the converted string range as pair of start/length to be selected. +static inline void getCompositionStringConvertedRange(HIMC himc, int *selStart, int *selLength) +{ + enum { bufferSize = 256 }; + // Find the range of bytes with ATTR_TARGET_CONVERTED set. + char attrBuffer[bufferSize]; + *selStart = *selLength = 0; + if (const int attrLength = ImmGetCompositionString(himc, GCS_COMPATTR, attrBuffer, bufferSize)) { + int start = 0; + while (start < attrLength && !(attrBuffer[start] & ATTR_TARGET_CONVERTED)) + start++; + if (start < attrLength) { + int end = start + 1; + while (end < attrLength && (attrBuffer[end] & ATTR_TARGET_CONVERTED)) + end++; + *selStart = start; + *selLength = end - start; + } + } +} + +enum StandardFormat { + PreeditFormat, + SelectionFormat +}; + +static inline QTextFormat standardFormat(StandardFormat format) +{ + QTextCharFormat result; + switch (format) { + case PreeditFormat: + result.setUnderlineStyle(QTextCharFormat::DashUnderline); + break; + case SelectionFormat: { + // TODO: Should be that of the widget? + const QPalette palette = QGuiApplication::palette(); + const QColor background = palette.text().color(); + result.setBackground(QBrush(background)); + result.setForeground(palette.background()); + break; + } + } + return result; +} + +bool QWindowsInputContext::startComposition(HWND hwnd) +{ + const QObject *fo = focusObject(); + if (!fo) + return false; + // This should always match the object. + QWindow *window = QGuiApplication::activeWindow(); + if (!window) + return false; + if (QWindowsContext::verboseInputMethods) + qDebug() << __FUNCTION__ << fo << window; + if (!fo || QWindowsWindow::handleOf(window) != hwnd) + return false; + initContext(hwnd); + startContextComposition(); + return true; +} + +void QWindowsInputContext::startContextComposition() +{ + if (m_compositionContext.isComposing) { + qWarning("%s: Called out of sequence.", __FUNCTION__); + return; + } + m_compositionContext.isComposing = true; + m_compositionContext.composition.clear(); + m_compositionContext.position = 0; + update(); +} + +void QWindowsInputContext::endContextComposition() +{ + if (!m_compositionContext.isComposing) { + qWarning("%s: Called out of sequence.", __FUNCTION__); + return; + } + m_compositionContext.composition.clear(); + m_compositionContext.position = 0; + m_compositionContext.isComposing = false; +} + +// Create a list of markup attributes for QInputMethodEvent +// to display the selected part of the intermediate composition +// result differently. +static inline QList + intermediateMarkup(int position, int compositionLength, + int selStart, int selLength) +{ + QList attributes; + if (selStart > 0) + attributes << QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, 0, selStart, + standardFormat(PreeditFormat)); + if (selLength) + attributes << QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, selStart, selLength, + standardFormat(SelectionFormat)); + if (selStart + selLength < compositionLength) + attributes << QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, selStart + selLength, + compositionLength - selStart - selLength, + standardFormat(PreeditFormat)); + if (position >= 0) + attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, position, selLength ? 0 : 1, QVariant()); + return attributes; +} + +/*! + \brief Notify focus object about markup or final text. +*/ + +bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn) +{ + QObject *fo = focusObject(); + const int lParam = int(lParamIn); + if (QWindowsContext::verboseInputMethods) + qDebug() << '>' << __FUNCTION__ << fo << debugComposition(lParam) + << " composing=" << m_compositionContext.isComposing; + if (!fo || m_compositionContext.hwnd != hwnd || !lParam) + return false; + const HIMC himc = ImmGetContext(m_compositionContext.hwnd); + if (!himc) + return false; + + QScopedPointer event; + if (lParam & (GCS_COMPSTR | GCS_COMPATTR | GCS_CURSORPOS)) { + if (!m_compositionContext.isComposing) + startContextComposition(); + // Some intermediate composition result. Parametrize event with + // attribute sequence specifying the formatting of the converted part. + int selStart, selLength; + m_compositionContext.composition = getCompositionString(himc, GCS_COMPSTR); + m_compositionContext.position = ImmGetCompositionString(himc, GCS_CURSORPOS, 0, 0); + getCompositionStringConvertedRange(himc, &selStart, &selLength); + if ((lParam & CS_INSERTCHAR) && (lParam & CS_NOMOVECARET)) { + // make Korean work correctly. Hope this is correct for all IMEs + selStart = 0; + selLength = m_compositionContext.composition.size(); + } + if (!selLength) + selStart = 0; + + event.reset(new QInputMethodEvent(m_compositionContext.composition, + intermediateMarkup(m_compositionContext.position, + m_compositionContext.composition.size(), + selStart, selLength))); + } + if (event.isNull()) + event.reset(new QInputMethodEvent); + + if (lParam & GCS_RESULTSTR) { + // A fixed result, return the converted string + event->setCommitString(getCompositionString(himc, GCS_RESULTSTR)); + endContextComposition(); + } + const bool result = QCoreApplication::sendEvent(fo, event.data()); + if (QWindowsContext::verboseInputMethods) + qDebug() << '<' << __FUNCTION__ << "sending markup=" + << event->attributes().size() + << " commit=" << event->commitString() + << " to " << fo << " returns " << result; + update(); + ImmReleaseContext(m_compositionContext.hwnd, himc); + return result; +} + +bool QWindowsInputContext::endComposition(HWND hwnd) +{ + if (QWindowsContext::verboseInputMethods) + qDebug() << __FUNCTION__ << m_endCompositionRecursionGuard << hwnd; + // Googles Pinyin Input Method likes to call endComposition again + // when we call notifyIME with CPS_CANCEL, so protect ourselves + // against that. + if (m_endCompositionRecursionGuard || m_compositionContext.hwnd != hwnd) + return false; + QObject *fo = focusObject(); + if (!fo) + return false; + + m_endCompositionRecursionGuard = true; + + imeNotifyCancelComposition(m_compositionContext.hwnd); + if (m_compositionContext.isComposing) { + QInputMethodEvent event; + QCoreApplication::sendEvent(fo, &event); + } + doneContext(); + + m_endCompositionRecursionGuard = false; + return true; +} + +void QWindowsInputContext::initContext(HWND hwnd) +{ + if (m_compositionContext.hwnd) + doneContext(); + m_compositionContext.hwnd = hwnd; + // Create a hidden caret which is kept at the microfocus + // position in update(). This is important for some + // Chinese input methods. + m_compositionContext.haveCaret = CreateCaret(hwnd, 0, 1, 1); + HideCaret(hwnd); + update(); + m_compositionContext.isComposing = false; + m_compositionContext.position = 0; +} + +void QWindowsInputContext::doneContext() +{ + if (!m_compositionContext.hwnd) + return; + if (m_compositionContext.haveCaret) + DestroyCaret(); + m_compositionContext.hwnd = 0; + m_compositionContext.composition.clear(); + m_compositionContext.position = 0; + m_compositionContext.isComposing = m_compositionContext.haveCaret = false; +} + +bool QWindowsInputContext::handleIME_Request(WPARAM wParam, + LPARAM lParam, + LRESULT *result) +{ + switch (int(wParam)) { + case IMR_RECONVERTSTRING: { + const int size = reconvertString(reinterpret_cast(lParam)); + if (size < 0) + return false; + *result = size; + return true; + } + break; + case IMR_CONFIRMRECONVERTSTRING: + return true; + default: + break; + } + return false; +} + +/*! + \brief Determines the string for reconversion with selection. + + This is triggered twice by WM_IME_REQUEST, first with reconv=0 + to determine the length and later with a reconv struct to obtain + the string with the position of the selection to be reconverted. + + Obtains the text from the focus object and marks the word + for selection (might not be entirely correct for Japanese). +*/ + +int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv) +{ + QObject *fo = focusObject(); + if (!fo) + return false; + + QString surroundingText; + if (!inputMethodQuery(fo, Qt::ImSurroundingText, &surroundingText)) + return -1; + const DWORD memSize = sizeof(RECONVERTSTRING) + + (surroundingText.length() + 1) * sizeof(ushort); + if (QWindowsContext::verboseInputMethods) + qDebug() << __FUNCTION__ << " reconv=" << reconv + << " surroundingText=" << surroundingText + << " size=" << memSize; + // If memory is not allocated, return the required size. + if (!reconv) + return surroundingText.isEmpty() ? -1 : int(memSize); + + int pos = 0; + inputMethodQuery(fo, Qt::ImCursorPosition, &pos); + // Find the word in the surrounding text. + QTextBoundaryFinder bounds(QTextBoundaryFinder::Word, surroundingText); + bounds.setPosition(pos); + if (bounds.isAtBoundary()) { + if (QTextBoundaryFinder::EndWord == bounds.boundaryReasons()) + bounds.toPreviousBoundary(); + } else { + bounds.toPreviousBoundary(); + } + const int startPos = bounds.position(); + bounds.toNextBoundary(); + const int endPos = bounds.position(); + if (QWindowsContext::verboseInputMethods) + qDebug() << __FUNCTION__ << " boundary=" << startPos << endPos; + // Select the text, this will be overwritten by following IME events. + QList attributes; + attributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, startPos, endPos-startPos, QVariant()); + QInputMethodEvent selectEvent(QString(), attributes); + QCoreApplication::sendEvent(fo, &selectEvent); + + reconv->dwSize = memSize; + reconv->dwVersion = 0; + + reconv->dwStrLen = surroundingText.size(); + reconv->dwStrOffset = sizeof(RECONVERTSTRING); + reconv->dwCompStrLen = endPos - startPos; // TCHAR count. + reconv->dwCompStrOffset = startPos * sizeof(ushort); // byte count. + reconv->dwTargetStrLen = reconv->dwCompStrLen; + reconv->dwTargetStrOffset = reconv->dwCompStrOffset; + ushort *pastReconv = reinterpret_cast(reconv + 1); + qCopy(surroundingText.utf16(), surroundingText.utf16() + surroundingText.size(), + pastReconv); + return memSize; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.h b/src/plugins/platforms/windows/qwindowsinputcontext.h new file mode 100644 index 00000000000..8ea66774d48 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsinputcontext.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSINPUTCONTEXT_H +#define QWINDOWSINPUTCONTEXT_H + +#include "qtwindows_additional.h" + +#include + +QT_BEGIN_NAMESPACE + +class QInputMethodEvent; + +class QWindowsInputContext : public QPlatformInputContext +{ + struct CompositionContext + { + CompositionContext(); + + HWND hwnd; + bool haveCaret; + QString composition; + int position; + bool isComposing; + }; +public: + explicit QWindowsInputContext(); + ~QWindowsInputContext(); + + virtual void reset(); + virtual void update(); + + virtual void mouseHandler(int x, QMouseEvent *event); + virtual void setFocusObject(QObject *o); + + static QWindowsInputContext *instance(); + + bool startComposition(HWND hwnd); + bool composition(HWND hwnd, LPARAM lParam); + bool endComposition(HWND hwnd); + + int reconvertString(RECONVERTSTRING *reconv); + + bool handleIME_Request(WPARAM wparam, LPARAM lparam, LRESULT *result); + +private: + void initContext(HWND hwnd); + void doneContext(); + void startContextComposition(); + void endContextComposition(); + + const DWORD m_WM_MSIME_MOUSE; + CompositionContext m_compositionContext; + bool m_endCompositionRecursionGuard; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSINPUTCONTEXT_H diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp new file mode 100644 index 00000000000..cde6da671a8 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -0,0 +1,271 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsintegration.h" +#include "qwindowsbackingstore.h" +#include "qwindowswindow.h" +#include "qwindowscontext.h" +#include "qwindowsglcontext.h" +#include "qwindowsscreen.h" +#include "qwindowsfontdatabase.h" +#include "qwindowsguieventdispatcher.h" +#include "qwindowsclipboard.h" +#include "qwindowsdrag.h" +#include "qwindowsinputcontext.h" + +#include +#include +#include +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QWindowsNativeInterface + \brief Provides access to native handles. + + Currently implemented keys + \list + \o handle (HWND) + \o getDC (DC) + \o releaseDC Releases the previously acquired DC and returns 0. + \endlist + + \ingroup qt-lighthouse-win +*/ + +class QWindowsNativeInterface : public QPlatformNativeInterface +{ +public: + virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); + virtual void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *bs); +}; + +void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window) +{ + if (!window || !window->handle()) { + qWarning("%s: '%s' requested for null window or window without handle.", __FUNCTION__, resource.constData()); + return 0; + } + QWindowsWindow *bw = static_cast(window->handle()); + if (resource == "handle") + return bw->handle(); + if (window->surfaceType() == QWindow::RasterSurface) { + if (resource == "getDC") + return bw->getDC(); + if (resource == "releaseDC") { + bw->releaseDC(); + return 0; + } + } + qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData()); + return 0; +} + +void *QWindowsNativeInterface::nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *bs) +{ + if (!bs || !bs->handle()) { + qWarning("%s: '%s' requested for null backingstore or backingstore without handle.", __FUNCTION__, resource.constData()); + return 0; + } + QWindowsBackingStore *wbs = static_cast(bs->handle()); + if (resource == "getDC") + return wbs->getDC(); + qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData()); + return 0; +} + +/*! + \class QWindowsIntegration + \brief QPlatformIntegration implementation for Windows. + \ingroup qt-lighthouse-win +*/ + +struct QWindowsIntegrationPrivate +{ + typedef QSharedPointer QOpenGLStaticContextPtr; + + explicit QWindowsIntegrationPrivate(bool openGL); + + const bool m_openGL; + QWindowsContext m_context; + QWindowsFontDatabase m_fontDatabase; + QWindowsNativeInterface m_nativeInterface; + QWindowsClipboard m_clipboard; + QWindowsDrag m_drag; + QWindowsGuiEventDispatcher *m_eventDispatcher; + QOpenGLStaticContextPtr m_staticOpenGLContext; + QWindowsInputContext m_inputContext; +}; + +QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(bool openGL) + : m_openGL(openGL) + , m_context(openGL) + , m_eventDispatcher(new QWindowsGuiEventDispatcher) +{ +} + +QWindowsIntegration::QWindowsIntegration(bool openGL) : + d(new QWindowsIntegrationPrivate(openGL)) +{ + QGuiApplicationPrivate::instance()->setEventDispatcher(d->m_eventDispatcher); + d->m_clipboard.registerViewer(); + foreach (QPlatformScreen *pscr, QWindowsScreen::screens()) + screenAdded(pscr); +} + +QWindowsIntegration::~QWindowsIntegration() +{ + if (QWindowsContext::verboseIntegration) + qDebug("%s", __FUNCTION__); +} + +bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: + return true; + case OpenGL: + return true; + case ThreadedOpenGL: + return true; + default: + return QPlatformIntegration::hasCapability(cap); + } + return false; +} + +QPlatformPixmap *QWindowsIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const +{ + if (QWindowsContext::verboseIntegration) + qDebug() << __FUNCTION__ << type; + return new QRasterPlatformPixmap(type); +} + +QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) const +{ + const bool isGL = window->surfaceType() == QWindow::OpenGLSurface; + QWindowsWindow::WindowData requested; + requested.flags = window->windowFlags(); + requested.geometry = window->geometry(); + const QWindowsWindow::WindowData obtained + = QWindowsWindow::WindowData::create(window, requested, window->windowTitle(), isGL); + if (QWindowsContext::verboseIntegration || QWindowsContext::verboseWindows) + qDebug().nospace() + << __FUNCTION__ << ' ' << window << '\n' + << " Requested: " << requested.geometry << " Flags=" + << QWindowsWindow::debugWindowFlags(requested.flags) << '\n' + << " Obtained : " << obtained.geometry << " Margins " + << obtained.frame << " Flags=" + << QWindowsWindow::debugWindowFlags(obtained.flags) + << " Handle=" << obtained.hwnd << '\n'; + if (!obtained.hwnd) + return 0; + if (requested.flags != obtained.flags) + window->setWindowFlags(obtained.flags); + if (requested.geometry != obtained.geometry) + QWindowSystemInterface::handleGeometryChange(window, obtained.geometry); + return new QWindowsWindow(window, obtained); +} + +QPlatformBackingStore *QWindowsIntegration::createPlatformBackingStore(QWindow *window) const +{ + if (QWindowsContext::verboseIntegration) + qDebug() << __FUNCTION__ << window; + return new QWindowsBackingStore(window); +} + +QPlatformOpenGLContext + *QWindowsIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const +{ + if (QWindowsContext::verboseIntegration) + qDebug() << __FUNCTION__ << context->format(); + if (d->m_staticOpenGLContext.isNull()) + d->m_staticOpenGLContext = + QSharedPointer(QOpenGLStaticContext::create()); + QScopedPointer result(new QWindowsGLContext(d->m_staticOpenGLContext, context)); + if (result->isValid()) + return result.take(); + return 0; +} + +QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const +{ + return &d->m_fontDatabase; +} + +QPlatformNativeInterface *QWindowsIntegration::nativeInterface() const +{ + return &d->m_nativeInterface; +} + +QPlatformClipboard * QWindowsIntegration::clipboard() const +{ + return &d->m_clipboard; +} + +QPlatformDrag *QWindowsIntegration::drag() const +{ + if (QWindowsContext::verboseIntegration) + qDebug("%s", __FUNCTION__ ); + return &d->m_drag; +} + +QPlatformInputContext * QWindowsIntegration::inputContext() const +{ + return &d->m_inputContext; +} + +QWindowsIntegration *QWindowsIntegration::instance() +{ + return static_cast(QGuiApplicationPrivate::platformIntegration()); +} + +QAbstractEventDispatcher * QWindowsIntegration::guiThreadEventDispatcher() const +{ + return d->m_eventDispatcher; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h new file mode 100644 index 00000000000..14a65c67e05 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSINTEGRATION_H +#define QWINDOWSINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +struct QWindowsIntegrationPrivate; + +class QWindowsIntegration : public QPlatformIntegration +{ +public: + QWindowsIntegration(bool openGL = false); + virtual ~QWindowsIntegration(); + + bool hasCapability(QPlatformIntegration::Capability cap) const; + + virtual QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const; + + virtual QPlatformClipboard *clipboard() const; + virtual QPlatformDrag *drag() const; + virtual QPlatformInputContext *inputContext() const; + virtual QPlatformNativeInterface *nativeInterface() const; + virtual QPlatformFontDatabase *fontDatabase() const; + + static QWindowsIntegration *instance(); + +private: + QScopedPointer d; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h b/src/plugins/platforms/windows/qwindowsinternalmimedata.h similarity index 69% rename from src/plugins/gfxdrivers/directfb/qdirectfbmouse.h rename to src/plugins/platforms/windows/qwindowsinternalmimedata.h index 12004571cbe..49fc69059bf 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h +++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** ** This file is part of the plugins of the Qt Toolkit. ** @@ -39,37 +39,32 @@ ** ****************************************************************************/ -#ifndef QDIRECTFBMOUSE_H -#define QDIRECTFBMOUSE_H +#ifndef QWINDOWSINTERNALMIME_H +#define QWINDOWSINTERNALMIME_H -#include -#include +#include "qtwindows_additional.h" -#ifndef QT_NO_QWS_DIRECTFB - -QT_BEGIN_HEADER +#include // QInternalMime +#include QT_BEGIN_NAMESPACE -QT_MODULE(Gui) +class QDebug; -class QDirectFBMouseHandlerPrivate; - -class QDirectFBMouseHandler : public QWSMouseHandler -{ +// Implementation in qwindowsclipboard.cpp. +class QWindowsInternalMimeData : public QInternalMimeData { public: - explicit QDirectFBMouseHandler(const QString &driver = QString(), - const QString &device = QString()); - ~QDirectFBMouseHandler(); + virtual bool hasFormat_sys(const QString &mimetype) const; + virtual QStringList formats_sys() const; + virtual QVariant retrieveData_sys(const QString &mimetype, QVariant::Type preferredType) const; - void suspend(); - void resume(); protected: - QDirectFBMouseHandlerPrivate *d; + virtual IDataObject *retrieveDataObject() const = 0; + virtual void releaseDataObject(IDataObject *) const {} }; +QDebug operator<<(QDebug d, const QMimeData &m); + QT_END_NAMESPACE -QT_END_HEADER -#endif // QT_NO_QWS_DIRECTFB -#endif // QDIRECTFBMOUSE_H +#endif // QWINDOWSINTERNALMIME_H diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp new file mode 100644 index 00000000000..40613ea1f13 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -0,0 +1,1075 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowskeymapper.h" +#include "qwindowscontext.h" +#include "qwindowswindow.h" +#include "qwindowsguieventdispatcher.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QWindowsKeyMapper + \brief Translates Windows keys to QWindowSystemInterface events. + \ingroup qt-lighthouse-win + + In addition, handles some special keys to display system menus, etc. + The code originates from \c qkeymapper_win.cpp. +*/ + +QWindowsKeyMapper::QWindowsKeyMapper() + : m_useRTLExtensions(false), m_keyGrabber(0) +{ + memset(keyLayout, 0, sizeof(keyLayout)); +} + +QWindowsKeyMapper::~QWindowsKeyMapper() +{ + deleteLayouts(); +} + +#ifndef LANG_PASHTO +#define LANG_PASHTO 0x63 +#endif +#ifndef LANG_SYRIAC +#define LANG_SYRIAC 0x5a +#endif +#ifndef LANG_DIVEHI +#define LANG_DIVEHI 0x65 +#endif +#ifndef VK_OEM_PLUS +#define VK_OEM_PLUS 0xBB +#endif +#ifndef VK_OEM_3 +#define VK_OEM_3 0xC0 +#endif + +// Key recorder ------------------------------------------------------------------------[ start ] -- +struct KeyRecord { + KeyRecord(int c, int a, int s, const QString &t) : code(c), ascii(a), state(s), text(t) {} + KeyRecord() {} + + int code; + int ascii; + int state; + QString text; +}; + +static const int QT_MAX_KEY_RECORDINGS = 64; // User has LOTS of fingers... +struct KeyRecorder +{ + KeyRecorder() : nrecs(0) {} + + inline KeyRecord *findKey(int code, bool remove); + inline void storeKey(int code, int ascii, int state, const QString& text); + inline void clearKeys(); + + int nrecs; + KeyRecord deleted_record; // A copy of last entry removed from records[] + KeyRecord records[QT_MAX_KEY_RECORDINGS]; +}; +static KeyRecorder key_recorder; + +KeyRecord *KeyRecorder::findKey(int code, bool remove) +{ + KeyRecord *result = 0; + for (int i = 0; i < nrecs; ++i) { + if (records[i].code == code) { + if (remove) { + deleted_record = records[i]; + // Move rest down, and decrease count + while (i + 1 < nrecs) { + records[i] = records[i + 1]; + ++i; + } + --nrecs; + result = &deleted_record; + } else { + result = &records[i]; + } + break; + } + } + return result; +} + +void KeyRecorder::storeKey(int code, int ascii, int state, const QString& text) +{ + Q_ASSERT_X(nrecs != QT_MAX_KEY_RECORDINGS, + "Internal KeyRecorder", + "Keyboard recorder buffer overflow, consider increasing QT_MAX_KEY_RECORDINGS"); + + if (nrecs == QT_MAX_KEY_RECORDINGS) { + qWarning("Qt: Internal keyboard buffer overflow"); + return; + } + records[nrecs++] = KeyRecord(code,ascii,state,text); +} + +void KeyRecorder::clearKeys() +{ + nrecs = 0; +} +// Key recorder --------------------------------------------------------------------------[ end ] -- + + +// Key translation ---------------------------------------------------------------------[ start ] -- +// Meaning of values: +// 0 = Character output key, needs keyboard driver mapping +// Key_unknown = Unknown Virtual Key, no translation possible, ignore +static const uint KeyTbl[] = { // Keyboard mapping table + // Dec | Hex | Windows Virtual key + Qt::Key_unknown, // 0 0x00 + Qt::Key_unknown, // 1 0x01 VK_LBUTTON | Left mouse button + Qt::Key_unknown, // 2 0x02 VK_RBUTTON | Right mouse button + Qt::Key_Cancel, // 3 0x03 VK_CANCEL | Control-Break processing + Qt::Key_unknown, // 4 0x04 VK_MBUTTON | Middle mouse button + Qt::Key_unknown, // 5 0x05 VK_XBUTTON1 | X1 mouse button + Qt::Key_unknown, // 6 0x06 VK_XBUTTON2 | X2 mouse button + Qt::Key_unknown, // 7 0x07 -- unassigned -- + Qt::Key_Backspace, // 8 0x08 VK_BACK | BackSpace key + Qt::Key_Tab, // 9 0x09 VK_TAB | Tab key + Qt::Key_unknown, // 10 0x0A -- reserved -- + Qt::Key_unknown, // 11 0x0B -- reserved -- + Qt::Key_Clear, // 12 0x0C VK_CLEAR | Clear key + Qt::Key_Return, // 13 0x0D VK_RETURN | Enter key + Qt::Key_unknown, // 14 0x0E -- unassigned -- + Qt::Key_unknown, // 15 0x0F -- unassigned -- + Qt::Key_Shift, // 16 0x10 VK_SHIFT | Shift key + Qt::Key_Control, // 17 0x11 VK_CONTROL | Ctrl key + Qt::Key_Alt, // 18 0x12 VK_MENU | Alt key + Qt::Key_Pause, // 19 0x13 VK_PAUSE | Pause key + Qt::Key_CapsLock, // 20 0x14 VK_CAPITAL | Caps-Lock + Qt::Key_unknown, // 21 0x15 VK_KANA / VK_HANGUL | IME Kana or Hangul mode + Qt::Key_unknown, // 22 0x16 -- unassigned -- + Qt::Key_unknown, // 23 0x17 VK_JUNJA | IME Junja mode + Qt::Key_unknown, // 24 0x18 VK_FINAL | IME final mode + Qt::Key_unknown, // 25 0x19 VK_HANJA / VK_KANJI | IME Hanja or Kanji mode + Qt::Key_unknown, // 26 0x1A -- unassigned -- + Qt::Key_Escape, // 27 0x1B VK_ESCAPE | Esc key + Qt::Key_unknown, // 28 0x1C VK_CONVERT | IME convert + Qt::Key_unknown, // 29 0x1D VK_NONCONVERT | IME non-convert + Qt::Key_unknown, // 30 0x1E VK_ACCEPT | IME accept + Qt::Key_Mode_switch,// 31 0x1F VK_MODECHANGE | IME mode change request + Qt::Key_Space, // 32 0x20 VK_SPACE | Spacebar + Qt::Key_PageUp, // 33 0x21 VK_PRIOR | Page Up key + Qt::Key_PageDown, // 34 0x22 VK_NEXT | Page Down key + Qt::Key_End, // 35 0x23 VK_END | End key + Qt::Key_Home, // 36 0x24 VK_HOME | Home key + Qt::Key_Left, // 37 0x25 VK_LEFT | Left arrow key + Qt::Key_Up, // 38 0x26 VK_UP | Up arrow key + Qt::Key_Right, // 39 0x27 VK_RIGHT | Right arrow key + Qt::Key_Down, // 40 0x28 VK_DOWN | Down arrow key + Qt::Key_Select, // 41 0x29 VK_SELECT | Select key + Qt::Key_Printer, // 42 0x2A VK_PRINT | Print key + Qt::Key_Execute, // 43 0x2B VK_EXECUTE | Execute key + Qt::Key_Print, // 44 0x2C VK_SNAPSHOT | Print Screen key + Qt::Key_Insert, // 45 0x2D VK_INSERT | Ins key + Qt::Key_Delete, // 46 0x2E VK_DELETE | Del key + Qt::Key_Help, // 47 0x2F VK_HELP | Help key + 0, // 48 0x30 (VK_0) | 0 key + 0, // 49 0x31 (VK_1) | 1 key + 0, // 50 0x32 (VK_2) | 2 key + 0, // 51 0x33 (VK_3) | 3 key + 0, // 52 0x34 (VK_4) | 4 key + 0, // 53 0x35 (VK_5) | 5 key + 0, // 54 0x36 (VK_6) | 6 key + 0, // 55 0x37 (VK_7) | 7 key + 0, // 56 0x38 (VK_8) | 8 key + 0, // 57 0x39 (VK_9) | 9 key + Qt::Key_unknown, // 58 0x3A -- unassigned -- + Qt::Key_unknown, // 59 0x3B -- unassigned -- + Qt::Key_unknown, // 60 0x3C -- unassigned -- + Qt::Key_unknown, // 61 0x3D -- unassigned -- + Qt::Key_unknown, // 62 0x3E -- unassigned -- + Qt::Key_unknown, // 63 0x3F -- unassigned -- + Qt::Key_unknown, // 64 0x40 -- unassigned -- + 0, // 65 0x41 (VK_A) | A key + 0, // 66 0x42 (VK_B) | B key + 0, // 67 0x43 (VK_C) | C key + 0, // 68 0x44 (VK_D) | D key + 0, // 69 0x45 (VK_E) | E key + 0, // 70 0x46 (VK_F) | F key + 0, // 71 0x47 (VK_G) | G key + 0, // 72 0x48 (VK_H) | H key + 0, // 73 0x49 (VK_I) | I key + 0, // 74 0x4A (VK_J) | J key + 0, // 75 0x4B (VK_K) | K key + 0, // 76 0x4C (VK_L) | L key + 0, // 77 0x4D (VK_M) | M key + 0, // 78 0x4E (VK_N) | N key + 0, // 79 0x4F (VK_O) | O key + 0, // 80 0x50 (VK_P) | P key + 0, // 81 0x51 (VK_Q) | Q key + 0, // 82 0x52 (VK_R) | R key + 0, // 83 0x53 (VK_S) | S key + 0, // 84 0x54 (VK_T) | T key + 0, // 85 0x55 (VK_U) | U key + 0, // 86 0x56 (VK_V) | V key + 0, // 87 0x57 (VK_W) | W key + 0, // 88 0x58 (VK_X) | X key + 0, // 89 0x59 (VK_Y) | Y key + 0, // 90 0x5A (VK_Z) | Z key + Qt::Key_Meta, // 91 0x5B VK_LWIN | Left Windows - MS Natural kbd + Qt::Key_Meta, // 92 0x5C VK_RWIN | Right Windows - MS Natural kbd + Qt::Key_Menu, // 93 0x5D VK_APPS | Application key-MS Natural kbd + Qt::Key_unknown, // 94 0x5E -- reserved -- + Qt::Key_Sleep, // 95 0x5F VK_SLEEP + Qt::Key_0, // 96 0x60 VK_NUMPAD0 | Numeric keypad 0 key + Qt::Key_1, // 97 0x61 VK_NUMPAD1 | Numeric keypad 1 key + Qt::Key_2, // 98 0x62 VK_NUMPAD2 | Numeric keypad 2 key + Qt::Key_3, // 99 0x63 VK_NUMPAD3 | Numeric keypad 3 key + Qt::Key_4, // 100 0x64 VK_NUMPAD4 | Numeric keypad 4 key + Qt::Key_5, // 101 0x65 VK_NUMPAD5 | Numeric keypad 5 key + Qt::Key_6, // 102 0x66 VK_NUMPAD6 | Numeric keypad 6 key + Qt::Key_7, // 103 0x67 VK_NUMPAD7 | Numeric keypad 7 key + Qt::Key_8, // 104 0x68 VK_NUMPAD8 | Numeric keypad 8 key + Qt::Key_9, // 105 0x69 VK_NUMPAD9 | Numeric keypad 9 key + Qt::Key_Asterisk, // 106 0x6A VK_MULTIPLY | Multiply key + Qt::Key_Plus, // 107 0x6B VK_ADD | Add key + Qt::Key_Comma, // 108 0x6C VK_SEPARATOR | Separator key + Qt::Key_Minus, // 109 0x6D VK_SUBTRACT | Subtract key + Qt::Key_Period, // 110 0x6E VK_DECIMAL | Decimal key + Qt::Key_Slash, // 111 0x6F VK_DIVIDE | Divide key + Qt::Key_F1, // 112 0x70 VK_F1 | F1 key + Qt::Key_F2, // 113 0x71 VK_F2 | F2 key + Qt::Key_F3, // 114 0x72 VK_F3 | F3 key + Qt::Key_F4, // 115 0x73 VK_F4 | F4 key + Qt::Key_F5, // 116 0x74 VK_F5 | F5 key + Qt::Key_F6, // 117 0x75 VK_F6 | F6 key + Qt::Key_F7, // 118 0x76 VK_F7 | F7 key + Qt::Key_F8, // 119 0x77 VK_F8 | F8 key + Qt::Key_F9, // 120 0x78 VK_F9 | F9 key + Qt::Key_F10, // 121 0x79 VK_F10 | F10 key + Qt::Key_F11, // 122 0x7A VK_F11 | F11 key + Qt::Key_F12, // 123 0x7B VK_F12 | F12 key + Qt::Key_F13, // 124 0x7C VK_F13 | F13 key + Qt::Key_F14, // 125 0x7D VK_F14 | F14 key + Qt::Key_F15, // 126 0x7E VK_F15 | F15 key + Qt::Key_F16, // 127 0x7F VK_F16 | F16 key + Qt::Key_F17, // 128 0x80 VK_F17 | F17 key + Qt::Key_F18, // 129 0x81 VK_F18 | F18 key + Qt::Key_F19, // 130 0x82 VK_F19 | F19 key + Qt::Key_F20, // 131 0x83 VK_F20 | F20 key + Qt::Key_F21, // 132 0x84 VK_F21 | F21 key + Qt::Key_F22, // 133 0x85 VK_F22 | F22 key + Qt::Key_F23, // 134 0x86 VK_F23 | F23 key + Qt::Key_F24, // 135 0x87 VK_F24 | F24 key + Qt::Key_unknown, // 136 0x88 -- unassigned -- + Qt::Key_unknown, // 137 0x89 -- unassigned -- + Qt::Key_unknown, // 138 0x8A -- unassigned -- + Qt::Key_unknown, // 139 0x8B -- unassigned -- + Qt::Key_unknown, // 140 0x8C -- unassigned -- + Qt::Key_unknown, // 141 0x8D -- unassigned -- + Qt::Key_unknown, // 142 0x8E -- unassigned -- + Qt::Key_unknown, // 143 0x8F -- unassigned -- + Qt::Key_NumLock, // 144 0x90 VK_NUMLOCK | Num Lock key + Qt::Key_ScrollLock, // 145 0x91 VK_SCROLL | Scroll Lock key + // Fujitsu/OASYS kbd -------------------- + 0, //Qt::Key_Jisho, // 146 0x92 VK_OEM_FJ_JISHO | 'Dictionary' key / + // VK_OEM_NEC_EQUAL = key on numpad on NEC PC-9800 kbd + Qt::Key_Massyo, // 147 0x93 VK_OEM_FJ_MASSHOU | 'Unregister word' key + Qt::Key_Touroku, // 148 0x94 VK_OEM_FJ_TOUROKU | 'Register word' key + 0, //Qt::Key_Oyayubi_Left,//149 0x95 VK_OEM_FJ_LOYA | 'Left OYAYUBI' key + 0, //Qt::Key_Oyayubi_Right,//150 0x96 VK_OEM_FJ_ROYA | 'Right OYAYUBI' key + Qt::Key_unknown, // 151 0x97 -- unassigned -- + Qt::Key_unknown, // 152 0x98 -- unassigned -- + Qt::Key_unknown, // 153 0x99 -- unassigned -- + Qt::Key_unknown, // 154 0x9A -- unassigned -- + Qt::Key_unknown, // 155 0x9B -- unassigned -- + Qt::Key_unknown, // 156 0x9C -- unassigned -- + Qt::Key_unknown, // 157 0x9D -- unassigned -- + Qt::Key_unknown, // 158 0x9E -- unassigned -- + Qt::Key_unknown, // 159 0x9F -- unassigned -- + Qt::Key_Shift, // 160 0xA0 VK_LSHIFT | Left Shift key + Qt::Key_Shift, // 161 0xA1 VK_RSHIFT | Right Shift key + Qt::Key_Control, // 162 0xA2 VK_LCONTROL | Left Ctrl key + Qt::Key_Control, // 163 0xA3 VK_RCONTROL | Right Ctrl key + Qt::Key_Alt, // 164 0xA4 VK_LMENU | Left Menu key + Qt::Key_Alt, // 165 0xA5 VK_RMENU | Right Menu key + Qt::Key_Back, // 166 0xA6 VK_BROWSER_BACK | Browser Back key + Qt::Key_Forward, // 167 0xA7 VK_BROWSER_FORWARD | Browser Forward key + Qt::Key_Refresh, // 168 0xA8 VK_BROWSER_REFRESH | Browser Refresh key + Qt::Key_Stop, // 169 0xA9 VK_BROWSER_STOP | Browser Stop key + Qt::Key_Search, // 170 0xAA VK_BROWSER_SEARCH | Browser Search key + Qt::Key_Favorites, // 171 0xAB VK_BROWSER_FAVORITES| Browser Favorites key + Qt::Key_HomePage, // 172 0xAC VK_BROWSER_HOME | Browser Start and Home key + Qt::Key_VolumeMute, // 173 0xAD VK_VOLUME_MUTE | Volume Mute key + Qt::Key_VolumeDown, // 174 0xAE VK_VOLUME_DOWN | Volume Down key + Qt::Key_VolumeUp, // 175 0xAF VK_VOLUME_UP | Volume Up key + Qt::Key_MediaNext, // 176 0xB0 VK_MEDIA_NEXT_TRACK | Next Track key + Qt::Key_MediaPrevious, //177 0xB1 VK_MEDIA_PREV_TRACK | Previous Track key + Qt::Key_MediaStop, // 178 0xB2 VK_MEDIA_STOP | Stop Media key + Qt::Key_MediaPlay, // 179 0xB3 VK_MEDIA_PLAY_PAUSE | Play/Pause Media key + Qt::Key_LaunchMail, // 180 0xB4 VK_LAUNCH_MAIL | Start Mail key + Qt::Key_LaunchMedia,// 181 0xB5 VK_LAUNCH_MEDIA_SELECT Select Media key + Qt::Key_Launch0, // 182 0xB6 VK_LAUNCH_APP1 | Start Application 1 key + Qt::Key_Launch1, // 183 0xB7 VK_LAUNCH_APP2 | Start Application 2 key + Qt::Key_unknown, // 184 0xB8 -- reserved -- + Qt::Key_unknown, // 185 0xB9 -- reserved -- + 0, // 186 0xBA VK_OEM_1 | ';:' for US + 0, // 187 0xBB VK_OEM_PLUS | '+' any country + 0, // 188 0xBC VK_OEM_COMMA | ',' any country + 0, // 189 0xBD VK_OEM_MINUS | '-' any country + 0, // 190 0xBE VK_OEM_PERIOD | '.' any country + 0, // 191 0xBF VK_OEM_2 | '/?' for US + 0, // 192 0xC0 VK_OEM_3 | '`~' for US + Qt::Key_unknown, // 193 0xC1 -- reserved -- + Qt::Key_unknown, // 194 0xC2 -- reserved -- + Qt::Key_unknown, // 195 0xC3 -- reserved -- + Qt::Key_unknown, // 196 0xC4 -- reserved -- + Qt::Key_unknown, // 197 0xC5 -- reserved -- + Qt::Key_unknown, // 198 0xC6 -- reserved -- + Qt::Key_unknown, // 199 0xC7 -- reserved -- + Qt::Key_unknown, // 200 0xC8 -- reserved -- + Qt::Key_unknown, // 201 0xC9 -- reserved -- + Qt::Key_unknown, // 202 0xCA -- reserved -- + Qt::Key_unknown, // 203 0xCB -- reserved -- + Qt::Key_unknown, // 204 0xCC -- reserved -- + Qt::Key_unknown, // 205 0xCD -- reserved -- + Qt::Key_unknown, // 206 0xCE -- reserved -- + Qt::Key_unknown, // 207 0xCF -- reserved -- + Qt::Key_unknown, // 208 0xD0 -- reserved -- + Qt::Key_unknown, // 209 0xD1 -- reserved -- + Qt::Key_unknown, // 210 0xD2 -- reserved -- + Qt::Key_unknown, // 211 0xD3 -- reserved -- + Qt::Key_unknown, // 212 0xD4 -- reserved -- + Qt::Key_unknown, // 213 0xD5 -- reserved -- + Qt::Key_unknown, // 214 0xD6 -- reserved -- + Qt::Key_unknown, // 215 0xD7 -- reserved -- + Qt::Key_unknown, // 216 0xD8 -- unassigned -- + Qt::Key_unknown, // 217 0xD9 -- unassigned -- + Qt::Key_unknown, // 218 0xDA -- unassigned -- + 0, // 219 0xDB VK_OEM_4 | '[{' for US + 0, // 220 0xDC VK_OEM_5 | '\|' for US + 0, // 221 0xDD VK_OEM_6 | ']}' for US + 0, // 222 0xDE VK_OEM_7 | ''"' for US + 0, // 223 0xDF VK_OEM_8 + Qt::Key_unknown, // 224 0xE0 -- reserved -- + Qt::Key_unknown, // 225 0xE1 VK_OEM_AX | 'AX' key on Japanese AX kbd + Qt::Key_unknown, // 226 0xE2 VK_OEM_102 | "<>" or "\|" on RT 102-key kbd + Qt::Key_unknown, // 227 0xE3 VK_ICO_HELP | Help key on ICO + Qt::Key_unknown, // 228 0xE4 VK_ICO_00 | 00 key on ICO + Qt::Key_unknown, // 229 0xE5 VK_PROCESSKEY | IME Process key + Qt::Key_unknown, // 230 0xE6 VK_ICO_CLEAR | + Qt::Key_unknown, // 231 0xE7 VK_PACKET | Unicode char as keystrokes + Qt::Key_unknown, // 232 0xE8 -- unassigned -- + // Nokia/Ericsson definitions --------------- + Qt::Key_unknown, // 233 0xE9 VK_OEM_RESET + Qt::Key_unknown, // 234 0xEA VK_OEM_JUMP + Qt::Key_unknown, // 235 0xEB VK_OEM_PA1 + Qt::Key_unknown, // 236 0xEC VK_OEM_PA2 + Qt::Key_unknown, // 237 0xED VK_OEM_PA3 + Qt::Key_unknown, // 238 0xEE VK_OEM_WSCTRL + Qt::Key_unknown, // 239 0xEF VK_OEM_CUSEL + Qt::Key_unknown, // 240 0xF0 VK_OEM_ATTN + Qt::Key_unknown, // 241 0xF1 VK_OEM_FINISH + Qt::Key_unknown, // 242 0xF2 VK_OEM_COPY + Qt::Key_unknown, // 243 0xF3 VK_OEM_AUTO + Qt::Key_unknown, // 244 0xF4 VK_OEM_ENLW + Qt::Key_unknown, // 245 0xF5 VK_OEM_BACKTAB + Qt::Key_unknown, // 246 0xF6 VK_ATTN | Attn key + Qt::Key_unknown, // 247 0xF7 VK_CRSEL | CrSel key + Qt::Key_unknown, // 248 0xF8 VK_EXSEL | ExSel key + Qt::Key_unknown, // 249 0xF9 VK_EREOF | Erase EOF key + Qt::Key_Play, // 250 0xFA VK_PLAY | Play key + Qt::Key_Zoom, // 251 0xFB VK_ZOOM | Zoom key + Qt::Key_unknown, // 252 0xFC VK_NONAME | Reserved + Qt::Key_unknown, // 253 0xFD VK_PA1 | PA1 key + Qt::Key_Clear, // 254 0xFE VK_OEM_CLEAR | Clear key + 0 +}; + +// Possible modifier states. +// NOTE: The order of these states match the order in QWindowsKeyMapper::updatePossibleKeyCodes()! +static const Qt::KeyboardModifiers ModsTbl[] = { + Qt::NoModifier, // 0 + Qt::ShiftModifier, // 1 + Qt::ControlModifier, // 2 + Qt::ControlModifier | Qt::ShiftModifier, // 3 + Qt::AltModifier, // 4 + Qt::AltModifier | Qt::ShiftModifier, // 5 + Qt::AltModifier | Qt::ControlModifier, // 6 + Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 7 + Qt::NoModifier, // Fall-back to raw Key_* +}; + +/** + Remap return or action key to select key for windows mobile. +*/ +inline int winceKeyBend(int keyCode) +{ + return KeyTbl[keyCode]; +} + +// Translate a VK into a Qt key code, or unicode character +static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer, bool *isDeadkey = 0) +{ + Q_ASSERT(vk > 0 && vk < 256); + int code = 0; + QChar unicodeBuffer[5]; + int res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast(unicodeBuffer), 5, 0); + if (res) + code = unicodeBuffer[0].toUpper().unicode(); + + // Qt::Key_*'s are not encoded below 0x20, so try again, and DEL keys (0x7f) is encoded with a + // proper Qt::Key_ code + if (code < 0x20 || code == 0x7f) // Handles res==0 too + code = winceKeyBend(vk); + + if (isDeadkey) + *isDeadkey = (res == -1); + + return code == Qt::Key_unknown ? 0 : code; +} + +int qt_translateKeyCode(int vk) +{ + int code = winceKeyBend((vk < 0 || vk > 255) ? 0 : vk); + return code == Qt::Key_unknown ? 0 : code; +} + +static inline int asciiToKeycode(char a, int state) +{ + if (a >= 'a' && a <= 'z') + a = toupper(a); + if ((state & Qt::ControlModifier) != 0) { + if (a >= 0 && a <= 31) // Ctrl+@..Ctrl+A..CTRL+Z..Ctrl+_ + a += '@'; // to @..A..Z.._ + } + return a & 0xff; +} + +static inline bool isModifierKey(int code) +{ + return (code >= Qt::Key_Shift) && (code <= Qt::Key_ScrollLock); +} +// Key translation -----------------------------------------------------------------------[ end ]--- + + +// Keyboard map private ----------------------------------------------------------------[ start ]--- + +/* + \internal + A Windows KeyboardLayoutItem has 8 possible states: + 1. Unmodified + 2. Shift + 3. Control + 4. Control + Shift + 5. Alt + 6. Alt + Shift + 7. Alt + Control + 8. Alt + Control + Shift +*/ +struct KeyboardLayoutItem { + bool dirty; + quint8 deadkeys; + quint32 qtKey[9]; // Can by any Qt::Key_, or unicode character +}; + +void QWindowsKeyMapper::deleteLayouts() +{ + for (int i = 0; i < 255; ++i) { + if (keyLayout[i]) { + delete keyLayout[i]; + keyLayout[i] = 0; + } + } +} + +void QWindowsKeyMapper::changeKeyboard() +{ + deleteLayouts(); + + /* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout() + * returns a DWORD. */ + + LCID newLCID = MAKELCID((quintptr)GetKeyboardLayout(0), SORT_DEFAULT); +// keyboardInputLocale = qt_localeFromLCID(newLCID); + + bool bidi = false; + wchar_t LCIDFontSig[16]; + if (GetLocaleInfo(newLCID, LOCALE_FONTSIGNATURE, LCIDFontSig, sizeof(LCIDFontSig) / sizeof(wchar_t)) + && (LCIDFontSig[7] & (wchar_t)0x0800)) + bidi = true; + + keyboardInputDirection = bidi ? Qt::RightToLeft : Qt::LeftToRight; +} + +void QWindowsKeyMapper::clearRecordedKeys() +{ + key_recorder.clearKeys(); +} + + +inline void setKbdState(unsigned char *kbd, bool shift, bool ctrl, bool alt) +{ + kbd[VK_LSHIFT ] = (shift ? 0x80 : 0); + kbd[VK_SHIFT ] = (shift ? 0x80 : 0); + kbd[VK_LCONTROL] = (ctrl ? 0x80 : 0); + kbd[VK_CONTROL ] = (ctrl ? 0x80 : 0); + kbd[VK_RMENU ] = (alt ? 0x80 : 0); + kbd[VK_MENU ] = (alt ? 0x80 : 0); +} + +void QWindowsKeyMapper::updateKeyMap(const MSG &msg) +{ + unsigned char kbdBuffer[256]; // Will hold the complete keyboard state + GetKeyboardState(kbdBuffer); + quint32 scancode = (msg.lParam >> 16) & 0xfff; + updatePossibleKeyCodes(kbdBuffer, scancode, msg.wParam); +} + +void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 scancode, + quint32 vk_key) +{ + if (!vk_key || (keyLayout[vk_key] && !keyLayout[vk_key]->dirty)) + return; + + if (!keyLayout[vk_key]) + keyLayout[vk_key] = new KeyboardLayoutItem; + + // Copy keyboard state, so we can modify and query output for each possible permutation + unsigned char buffer[256]; + memcpy(buffer, kbdBuffer, sizeof(buffer)); + // Always 0, as Windows doesn't treat these as modifiers; + buffer[VK_LWIN ] = 0; + buffer[VK_RWIN ] = 0; + buffer[VK_CAPITAL ] = 0; + buffer[VK_NUMLOCK ] = 0; + buffer[VK_SCROLL ] = 0; + // Always 0, since we'll only change the other versions + buffer[VK_RSHIFT ] = 0; + buffer[VK_RCONTROL] = 0; + buffer[VK_LMENU ] = 0; // Use right Alt, since left Ctrl + right Alt is considered AltGraph + + bool isDeadKey = false; + keyLayout[vk_key]->deadkeys = 0; + keyLayout[vk_key]->dirty = false; + setKbdState(buffer, false, false, false); + keyLayout[vk_key]->qtKey[0] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey); + keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x01 : 0; + setKbdState(buffer, true, false, false); + keyLayout[vk_key]->qtKey[1] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey); + keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x02 : 0; + setKbdState(buffer, false, true, false); + keyLayout[vk_key]->qtKey[2] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey); + keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x04 : 0; + setKbdState(buffer, true, true, false); + keyLayout[vk_key]->qtKey[3] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey); + keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x08 : 0; + setKbdState(buffer, false, false, true); + keyLayout[vk_key]->qtKey[4] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey); + keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x10 : 0; + setKbdState(buffer, true, false, true); + keyLayout[vk_key]->qtKey[5] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey); + keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x20 : 0; + setKbdState(buffer, false, true, true); + keyLayout[vk_key]->qtKey[6] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey); + keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x40 : 0; + setKbdState(buffer, true, true, true); + keyLayout[vk_key]->qtKey[7] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey); + keyLayout[vk_key]->deadkeys |= isDeadKey ? 0x80 : 0; + // Add a fall back key for layouts which don't do composition and show non-latin1 characters + int fallbackKey = winceKeyBend(vk_key); + if (!fallbackKey || fallbackKey == Qt::Key_unknown) { + fallbackKey = 0; + if (vk_key != keyLayout[vk_key]->qtKey[0] && vk_key < 0x5B && vk_key > 0x2F) + fallbackKey = vk_key; + } + keyLayout[vk_key]->qtKey[8] = fallbackKey; + + // If this vk_key a Dead Key + if (MapVirtualKey(vk_key, 2) & 0x80000000) { + // Push a Space, then the original key through the low-level ToAscii functions. + // We do this because these functions (ToAscii / ToUnicode) will alter the internal state of + // the keyboard driver By doing the following, we set the keyboard driver state back to what + // it was before we wrecked it with the code above. + // We need to push the space with an empty keystate map, since the driver checks the map for + // transitions in modifiers, so this helps us capture all possible deadkeys. + unsigned char emptyBuffer[256]; + memset(emptyBuffer, 0, sizeof(emptyBuffer)); + ::ToAscii(VK_SPACE, 0, emptyBuffer, reinterpret_cast(&buffer), 0); + ::ToAscii(vk_key, scancode, kbdBuffer, reinterpret_cast(&buffer), 0); + } + + if (QWindowsContext::verboseEvents > 1) { + qDebug("updatePossibleKeyCodes for virtual key = 0x%02x!", vk_key); + for (int i = 0; i < 9; ++i) { + qDebug(" [%d] (%d,0x%02x,'%c') %s", i, + keyLayout[vk_key]->qtKey[i], + keyLayout[vk_key]->qtKey[i], + keyLayout[vk_key]->qtKey[i] ? keyLayout[vk_key]->qtKey[i] : 0x03, + keyLayout[vk_key]->deadkeys & (1<deadkeys & 1<windowFlags() & Qt::WindowMinimizeButtonHint)?enabled:disabled); + bool maximized = IsZoomed(topLevelHwnd); + + EnableMenuItem(menu, SC_MAXIMIZE, ! (topLevel->windowFlags() & Qt::WindowMaximizeButtonHint) || maximized?disabled:enabled); + EnableMenuItem(menu, SC_RESTORE, maximized?enabled:disabled); + + // We should _not_ check with the setFixedSize(x,y) case here, since Windows is not able to check + // this and our menu here would be out-of-sync with the menu produced by mouse-click on the + // System Menu, or right-click on the title bar. + EnableMenuItem(menu, SC_SIZE, (topLevel->windowFlags() & Qt::MSWindowsFixedSizeDialogHint) || maximized?disabled:enabled); + EnableMenuItem(menu, SC_MOVE, maximized?disabled:enabled); + EnableMenuItem(menu, SC_CLOSE, enabled); + // Set bold on close menu item + MENUITEMINFO closeItem; + closeItem.cbSize = sizeof(MENUITEMINFO); + closeItem.fMask = MIIM_STATE; + closeItem.fState = MFS_DEFAULT; + SetMenuItemInfo(menu, SC_CLOSE, FALSE, &closeItem); + +#undef enabled +#undef disabled + const int ret = TrackPopupMenuEx(menu, + TPM_LEFTALIGN | TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD, + topLevel->geometry().x(), topLevel->geometry().y(), + topLevelHwnd, + 0); + if (ret) + qWindowsWndProc(topLevelHwnd, WM_SYSCOMMAND, ret, 0); +} + +static inline void sendExtendedPressRelease(QWindow *w, int k, + Qt::KeyboardModifiers mods, + quint32 nativeScanCode, + quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString & text = QString(), + bool autorep = false, + ushort count = 1) +{ + QWindowSystemInterface::handleExtendedKeyEvent(w, QEvent::KeyPress, k, mods, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); + QWindowSystemInterface::handleExtendedKeyEvent(w, QEvent::KeyRelease, k, mods, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); +} + +/*! + \brief To be called from the window procedure. +*/ + +bool QWindowsKeyMapper::translateKeyEvent(QWindow *widget, HWND hwnd, + const MSG &msg, LRESULT *result) +{ + *result = 0; + MSG peekedMsg; + // consume dead chars?(for example, typing '`','a' resulting in a-accent). + if (PeekMessage(&peekedMsg, hwnd, 0, 0, PM_NOREMOVE) && peekedMsg.message == WM_DEADCHAR) + return true; + if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) + updateKeyMap(msg); + return translateKeyEventInternal(widget, msg, false); +} + +bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &msg, bool /* grab */) +{ + const int msgType = msg.message; + + const quint32 scancode = (msg.lParam >> 16) & 0xfff; + const quint32 vk_key = MapVirtualKey(scancode, 1); + const bool isNumpad = (msg.wParam >= VK_NUMPAD0 && msg.wParam <= VK_NUMPAD9); + quint32 nModifiers = 0; + + QWindow *receiver = m_keyGrabber ? m_keyGrabber : window; + + // Map native modifiers to some bit representation + nModifiers |= (GetKeyState(VK_LSHIFT ) & 0x80 ? ShiftLeft : 0); + nModifiers |= (GetKeyState(VK_RSHIFT ) & 0x80 ? ShiftRight : 0); + nModifiers |= (GetKeyState(VK_LCONTROL) & 0x80 ? ControlLeft : 0); + nModifiers |= (GetKeyState(VK_RCONTROL) & 0x80 ? ControlRight : 0); + nModifiers |= (GetKeyState(VK_LMENU ) & 0x80 ? AltLeft : 0); + nModifiers |= (GetKeyState(VK_RMENU ) & 0x80 ? AltRight : 0); + nModifiers |= (GetKeyState(VK_LWIN ) & 0x80 ? MetaLeft : 0); + nModifiers |= (GetKeyState(VK_RWIN ) & 0x80 ? MetaRight : 0); + // Add Lock keys to the same bits + nModifiers |= (GetKeyState(VK_CAPITAL ) & 0x01 ? CapsLock : 0); + nModifiers |= (GetKeyState(VK_NUMLOCK ) & 0x01 ? NumLock : 0); + nModifiers |= (GetKeyState(VK_SCROLL ) & 0x01 ? ScrollLock : 0); + + if (msg.lParam & ExtendedKey) + nModifiers |= msg.lParam & ExtendedKey; + + // Get the modifier states (may be altered later, depending on key code) + int state = 0; + state |= (nModifiers & ShiftAny ? Qt::ShiftModifier : 0); + state |= (nModifiers & ControlAny ? Qt::ControlModifier : 0); + state |= (nModifiers & AltAny ? Qt::AltModifier : 0); + state |= (nModifiers & MetaAny ? Qt::MetaModifier : 0); + + // Now we know enough to either have MapVirtualKey or our own keymap tell us if it's a deadkey + const bool isDeadKey = isADeadKey(msg.wParam, state) + || MapVirtualKey(msg.wParam, 2) & 0x80000000; + + // A multi-character key or a Input method character + // not found by our look-ahead + if (msgType == WM_CHAR || msgType == WM_IME_CHAR) { + sendExtendedPressRelease(receiver, 0, Qt::KeyboardModifier(state), scancode, vk_key, nModifiers, messageKeyText(msg), false, 0); + return true; + } + + bool result = false; + // handle Directionality changes (BiDi) with RTL extensions + if (m_useRTLExtensions) { + static int dirStatus = 0; + if (!dirStatus && state == Qt::ControlModifier + && msg.wParam == VK_CONTROL + && msgType == WM_KEYDOWN) { + if (GetKeyState(VK_LCONTROL) < 0) + dirStatus = VK_LCONTROL; + else if (GetKeyState(VK_RCONTROL) < 0) + dirStatus = VK_RCONTROL; + } else if (dirStatus) { + if (msgType == WM_KEYDOWN) { + if (msg.wParam == VK_SHIFT) { + if (dirStatus == VK_LCONTROL && GetKeyState(VK_LSHIFT) < 0) + dirStatus = VK_LSHIFT; + else if (dirStatus == VK_RCONTROL && GetKeyState(VK_RSHIFT) < 0) + dirStatus = VK_RSHIFT; + } else { + dirStatus = 0; + } + } else if (msgType == WM_KEYUP) { + if (dirStatus == VK_LSHIFT + && ((msg.wParam == VK_SHIFT && GetKeyState(VK_LCONTROL)) + || (msg.wParam == VK_CONTROL && GetKeyState(VK_LSHIFT)))) { + sendExtendedPressRelease(receiver, Qt::Key_Direction_L, 0, scancode, msg.wParam, nModifiers, QString(), false, 0); + result = true; + dirStatus = 0; + } else if (dirStatus == VK_RSHIFT + && ( (msg.wParam == VK_SHIFT && GetKeyState(VK_RCONTROL)) + || (msg.wParam == VK_CONTROL && GetKeyState(VK_RSHIFT)))) { + sendExtendedPressRelease(receiver, Qt::Key_Direction_R, 0, scancode, msg.wParam, nModifiers, QString(), false, 0); + result = true; + dirStatus = 0; + } else { + dirStatus = 0; + } + } else { + dirStatus = 0; + } + } + } // RTL + + // IME will process these keys, so simply return + if (msg.wParam == VK_PROCESSKEY) + return true; + + // Ignore invalid virtual keycodes (see bugs 127424, QTBUG-3630) + if (msg.wParam == 0 || msg.wParam == 0xFF) + return true; + + // Translate VK_* (native) -> Key_* (Qt) keys + // If it's a dead key, we cannot use the toKeyOrUnicode() function, since that will change + // the internal state of the keyboard driver, resulting in that dead keys no longer works. + // ..also if we're typing numbers on the keypad, while holding down the Alt modifier. + int code = 0; + if (isNumpad && (nModifiers & AltAny)) { + code = winceKeyBend(msg.wParam); + } else if (!isDeadKey) { + unsigned char kbdBuffer[256]; // Will hold the complete keyboard state + GetKeyboardState(kbdBuffer); + code = toKeyOrUnicode(msg.wParam, scancode, kbdBuffer); + } + + // Invert state logic: + // If the key actually pressed is a modifier key, then we remove its modifier key from the + // state, since a modifier-key can't have itself as a modifier + if (code == Qt::Key_Control) + state = state ^ Qt::ControlModifier; + else if (code == Qt::Key_Shift) + state = state ^ Qt::ShiftModifier; + else if (code == Qt::Key_Alt) + state = state ^ Qt::AltModifier; + + // If the bit 24 of lParm is set you received a enter, + // otherwise a Return. (This is the extended key bit) + if ((code == Qt::Key_Return) && (msg.lParam & 0x1000000)) + code = Qt::Key_Enter; + + // All cursor keys without extended bit + if (!(msg.lParam & 0x1000000)) { + switch (code) { + case Qt::Key_Left: + case Qt::Key_Right: + case Qt::Key_Up: + case Qt::Key_Down: + case Qt::Key_PageUp: + case Qt::Key_PageDown: + case Qt::Key_Home: + case Qt::Key_End: + case Qt::Key_Insert: + case Qt::Key_Delete: + case Qt::Key_Asterisk: + case Qt::Key_Plus: + case Qt::Key_Minus: + case Qt::Key_Period: + case Qt::Key_0: + case Qt::Key_1: + case Qt::Key_2: + case Qt::Key_3: + case Qt::Key_4: + case Qt::Key_5: + case Qt::Key_6: + case Qt::Key_7: + case Qt::Key_8: + case Qt::Key_9: + state |= ((msg.wParam >= '0' && msg.wParam <= '9') + || (msg.wParam >= VK_OEM_PLUS && msg.wParam <= VK_OEM_3)) + ? 0 : Qt::KeypadModifier; + default: + if ((uint)msg.lParam == 0x004c0001 || (uint)msg.lParam == 0xc04c0001) + state |= Qt::KeypadModifier; + break; + } + } + // Other keys with with extended bit + else { + switch (code) { + case Qt::Key_Enter: + case Qt::Key_Slash: + case Qt::Key_NumLock: + state |= Qt::KeypadModifier; + default: + break; + } + } + + // KEYDOWN --------------------------------------------------------------------------------- + if (msgType == WM_KEYDOWN || msgType == WM_IME_KEYDOWN || msgType == WM_SYSKEYDOWN) { + // Get the last record of this key press, so we can validate the current state + // The record is not removed from the list + KeyRecord *rec = key_recorder.findKey(msg.wParam, false); + + // If rec's state doesn't match the current state, something has changed behind our back + // (Consumed by modal widget is one possibility) So, remove the record from the list + // This will stop the auto-repeat of the key, should a modifier change, for example + if (rec && rec->state != state) { + key_recorder.findKey(msg.wParam, true); + rec = 0; + } + + // Find unicode character from Windows Message Queue + MSG wm_char; + UINT charType = (msgType == WM_KEYDOWN + ? WM_CHAR + : msgType == WM_IME_KEYDOWN ? WM_IME_CHAR : WM_SYSCHAR); + + QChar uch; + if (PeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) { + // Found a ?_CHAR + uch = QChar((ushort)wm_char.wParam); + if (msgType == WM_SYSKEYDOWN && uch.isLetter() && (msg.lParam & KF_ALTDOWN)) + uch = uch.toLower(); // (See doc of WM_SYSCHAR) Alt-letter + if (!code && !uch.row()) + code = asciiToKeycode(uch.cell(), state); + } + + // Special handling for the WM_IME_KEYDOWN message. Microsoft IME (Korean) will not + // generate a WM_IME_CHAR message corresponding to this message. We might get wrong + // results, if we map this virtual key-code directly (for eg '?' US layouts). So try + // to find the correct key using the current message parameters & keyboard state. + if (uch.isNull() && msgType == WM_IME_KEYDOWN) { + BYTE keyState[256]; + wchar_t newKey[3] = {0}; + GetKeyboardState(keyState); + int val = ToUnicode(vk_key, scancode, keyState, newKey, 2, 0); + if (val == 1) { + uch = QChar(newKey[0]); + } else { + // If we are still not able to find a unicode key, pass the WM_IME_KEYDOWN + // message to DefWindowProc() for generating a proper WM_KEYDOWN. + return false; + } + } + + // If no ?_CHAR was found in the queue; deduct character from the ?_KEYDOWN parameters + if (uch.isNull()) { + if (msg.wParam == VK_DELETE) { + uch = QChar(QLatin1Char(0x7f)); // Windows doesn't know this one. + } else { + if (msgType != WM_SYSKEYDOWN || !code) { + UINT map = MapVirtualKey(msg.wParam, 2); + // If the high bit of the return value is set, it's a deadkey + if (!(map & 0x80000000)) + uch = QChar((ushort)map); + } + } + if (!code && !uch.row()) + code = asciiToKeycode(uch.cell(), state); + } + + // Special handling of global Windows hotkeys + if (state == Qt::AltModifier) { + switch (code) { + case Qt::Key_Escape: + case Qt::Key_Tab: + case Qt::Key_Enter: + case Qt::Key_F4: + return false; // Send the event on to Windows + case Qt::Key_Space: + // do not pass this key to windows, we will process it ourselves + showSystemMenu(receiver); + return true; + default: + break; + } + } + + // Map SHIFT + Tab to SHIFT + BackTab, QShortcutMap knows about this translation + if (code == Qt::Key_Tab && (state & Qt::ShiftModifier) == Qt::ShiftModifier) + code = Qt::Key_Backtab; + + // If we have a record, it means that the key is already pressed, the state is the same + // so, we have an auto-repeating key + if (rec) { + if (code < Qt::Key_Shift || code > Qt::Key_ScrollLock) { + QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code, + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true, 0); + QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code, + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true, 0); + result = true; + } + } + // No record of the key being previous pressed, so we now send a QEvent::KeyPress event, + // and store the key data into our records. + else { + const QString text = uch.isNull() ? QString() : QString(uch); + const char a = uch.row() ? 0 : uch.cell(); + key_recorder.storeKey(msg.wParam, a, state, text); + QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code, + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, text, false, 0); + result =true; + bool store = true; + // Alt+ go to the Win32 menu system if unhandled by Qt + if (msgType == WM_SYSKEYDOWN && !result && a) { + HWND parent = GetParent(QWindowsWindow::handleOf(receiver)); + while (parent) { + if (GetMenu(parent)) { + SendMessage(parent, WM_SYSCOMMAND, SC_KEYMENU, a); + store = false; + result = true; + break; + } + parent = GetParent(parent); + } + } + if (!store) + key_recorder.findKey(msg.wParam, true); + } + } + + // KEYUP ----------------------------------------------------------------------------------- + else { + // Try to locate the key in our records, and remove it if it exists. + // The key may not be in our records if, for example, the down event was handled by + // win32 natively, or our window gets focus while a key is already press, but now gets + // the key release event. + KeyRecord* rec = key_recorder.findKey(msg.wParam, true); + if (!rec && !(code == Qt::Key_Shift + || code == Qt::Key_Control + || code == Qt::Key_Meta + || code == Qt::Key_Alt)) { + // Someone ate the key down event + } else { + if (!code) + code = asciiToKeycode(rec->ascii ? rec->ascii : msg.wParam, state); + + // Map SHIFT + Tab to SHIFT + BackTab, QShortcutMap knows about this translation + if (code == Qt::Key_Tab && (state & Qt::ShiftModifier) == Qt::ShiftModifier) + code = Qt::Key_Backtab; + QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code, + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, + (rec ? rec->text : QString()), false, 0); + result = true; + // don't pass Alt to Windows unless we are embedded in a non-Qt window + if (code == Qt::Key_Alt) { + const QWindowsContext *context = QWindowsContext::instance(); + HWND parent = GetParent(QWindowsWindow::handleOf(receiver)); + while (parent) { + if (!context->findPlatformWindow(parent) && GetMenu(parent)) { + result = false; + break; + } + parent = GetParent(parent); + } + } + } + } + return result; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h new file mode 100644 index 00000000000..0d50193730f --- /dev/null +++ b/src/plugins/platforms/windows/qwindowskeymapper.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSKEYMAPPER_H +#define QWINDOWSKEYMAPPER_H + +#include "qtwindows_additional.h" + +#include + +QT_BEGIN_NAMESPACE + +class QWindow; + +struct KeyboardLayoutItem; + +class QWindowsKeyMapper +{ + Q_DISABLE_COPY(QWindowsKeyMapper) +public: + explicit QWindowsKeyMapper(); + ~QWindowsKeyMapper(); + + void changeKeyboard(); + + void setUseRTLExtensions(bool e) { m_useRTLExtensions = e; } + bool useRTLExtensions() const { return m_useRTLExtensions; } + + bool translateKeyEvent(QWindow *widget, HWND hwnd, const MSG &msg, LRESULT *result); + + QWindow *keyGrabber() const { return m_keyGrabber; } + void setKeyGrabber(QWindow *w) { m_keyGrabber = w; } + +private: + bool translateKeyEventInternal(QWindow *receiver, const MSG &msg, bool grab); + void updateKeyMap(const MSG &msg); + + bool m_useRTLExtensions; + + QLocale keyboardInputLocale; + Qt::LayoutDirection keyboardInputDirection; + + void clearRecordedKeys(); + void updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32 scancode, quint32 vk_key); + bool isADeadKey(unsigned int vk_key, unsigned int modifiers); + void deleteLayouts(); + + KeyboardLayoutItem *keyLayout[256]; + QWindow *m_keyGrabber; +}; + +enum WindowsNativeModifiers { + ShiftLeft = 0x00000001, + ControlLeft = 0x00000002, + AltLeft = 0x00000004, + MetaLeft = 0x00000008, + ShiftRight = 0x00000010, + ControlRight = 0x00000020, + AltRight = 0x00000040, + MetaRight = 0x00000080, + CapsLock = 0x00000100, + NumLock = 0x00000200, + ScrollLock = 0x00000400, + ExtendedKey = 0x01000000, + + // Convenience mappings + ShiftAny = 0x00000011, + ControlAny = 0x00000022, + AltAny = 0x00000044, + MetaAny = 0x00000088, + LockAny = 0x00000700 +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSKEYMAPPER_H diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp new file mode 100644 index 00000000000..09104a43cf1 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -0,0 +1,1557 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsmime.h" +#include "qwindowscontext.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +/* The MSVC compilers allows multi-byte characters, that has the behavior of + * that each character gets shifted into position. 0x73524742 below is for MSVC + * equivalent to doing 'sRGB', but this does of course not work + * on conformant C++ compilers. */ +#define BMP_LCS_sRGB 0x73524742 +#define BMP_LCS_GM_IMAGES 0x00000004L + +struct _CIEXYZ { + long ciexyzX, ciexyzY, ciexyzZ; +}; + +struct _CIEXYZTRIPLE { + _CIEXYZ ciexyzRed, ciexyzGreen, ciexyzBlue; +}; + +struct BMP_BITMAPV5HEADER { + DWORD bV5Size; + LONG bV5Width; + LONG bV5Height; + WORD bV5Planes; + WORD bV5BitCount; + DWORD bV5Compression; + DWORD bV5SizeImage; + LONG bV5XPelsPerMeter; + LONG bV5YPelsPerMeter; + DWORD bV5ClrUsed; + DWORD bV5ClrImportant; + DWORD bV5RedMask; + DWORD bV5GreenMask; + DWORD bV5BlueMask; + DWORD bV5AlphaMask; + DWORD bV5CSType; + _CIEXYZTRIPLE bV5Endpoints; + DWORD bV5GammaRed; + DWORD bV5GammaGreen; + DWORD bV5GammaBlue; + DWORD bV5Intent; + DWORD bV5ProfileData; + DWORD bV5ProfileSize; + DWORD bV5Reserved; +}; +static const int BMP_BITFIELDS = 3; + +static const char dibFormatC[] = "dib"; + +static inline QByteArray msgConversionError(const char *func, const char *format) +{ + QByteArray msg = func; + msg += ": Unable to convert DIB image. The image converter plugin for '"; + msg += format; + msg += "' is not available. Available formats: "; + foreach (const QByteArray &af, QImageReader::supportedImageFormats()) { + msg += af; + msg += ' '; + } + return msg; +} + +static inline QImage readDib(QByteArray data) +{ + QBuffer buffer(&data); + buffer.open(QIODevice::ReadOnly); + QImageReader reader(&buffer, dibFormatC); + if (!reader.canRead()) { + qWarning("%s", msgConversionError(__FUNCTION__, dibFormatC).constData()); + return QImage(); + } + return reader.read(); +} + +static QByteArray writeDib(const QImage &img) +{ + QByteArray ba; + QBuffer buffer(&ba); + buffer.open(QIODevice::ReadWrite); + QImageWriter writer(&buffer, dibFormatC); + if (!writer.canWrite()) { + qWarning("%s", msgConversionError(__FUNCTION__, dibFormatC).constData()); + return ba; + } + if (!writer.write(img)) + ba.clear(); + return ba; +} + +static bool qt_write_dibv5(QDataStream &s, QImage image) +{ + QIODevice* d = s.device(); + if (!d->isWritable()) + return false; + + //depth will be always 32 + int bpl_bmp = image.width()*4; + + BMP_BITMAPV5HEADER bi ={0}; + bi.bV5Size = sizeof(BMP_BITMAPV5HEADER); + bi.bV5Width = image.width(); + bi.bV5Height = image.height(); + bi.bV5Planes = 1; + bi.bV5BitCount = 32; + bi.bV5Compression = BI_BITFIELDS; + bi.bV5SizeImage = bpl_bmp*image.height(); + bi.bV5XPelsPerMeter = 0; + bi.bV5YPelsPerMeter = 0; + bi.bV5ClrUsed = 0; + bi.bV5ClrImportant = 0; + bi.bV5BlueMask = 0x000000ff; + bi.bV5GreenMask = 0x0000ff00; + bi.bV5RedMask = 0x00ff0000; + bi.bV5AlphaMask = 0xff000000; + bi.bV5CSType = BMP_LCS_sRGB; //LCS_sRGB + bi.bV5Intent = BMP_LCS_GM_IMAGES; //LCS_GM_IMAGES + + d->write(reinterpret_cast(&bi), bi.bV5Size); + if (s.status() != QDataStream::Ok) + return false; + + DWORD colorSpace[3] = {0x00ff0000,0x0000ff00,0x000000ff}; + d->write(reinterpret_cast(colorSpace), sizeof(colorSpace)); + if (s.status() != QDataStream::Ok) + return false; + + if (image.format() != QImage::Format_ARGB32) + image = image.convertToFormat(QImage::Format_ARGB32); + + uchar *buf = new uchar[bpl_bmp]; + uchar *b; + + memset(buf, 0, bpl_bmp); + for (int y=image.height()-1; y>=0; y--) { + // write the image bits + QRgb *p = (QRgb *)image.scanLine(y); + QRgb *end = p + image.width(); + b = buf; + while (p < end) { + int alpha = qAlpha(*p); + if (alpha) { + *b++ = qBlue(*p); + *b++ = qGreen(*p); + *b++ = qRed(*p); + } else { + //white for fully transparent pixels. + *b++ = 0xff; + *b++ = 0xff; + *b++ = 0xff; + } + *b++ = alpha; + p++; + } + d->write((char*)buf, bpl_bmp); + if (s.status() != QDataStream::Ok) { + delete[] buf; + return false; + } + } + delete[] buf; + return true; +} + +static int calc_shift(int mask) +{ + int result = 0; + while (!(mask & 1)) { + result++; + mask >>= 1; + } + return result; +} + +//Supports only 32 bit DIBV5 +static bool qt_read_dibv5(QDataStream &s, QImage &image) +{ + BMP_BITMAPV5HEADER bi; + QIODevice* d = s.device(); + if (d->atEnd()) + return false; + + d->read((char *)&bi, sizeof(bi)); // read BITMAPV5HEADER header + if (s.status() != QDataStream::Ok) + return false; + + int nbits = bi.bV5BitCount; + int comp = bi.bV5Compression; + if (nbits != 32 || bi.bV5Planes != 1 || comp != BMP_BITFIELDS) + return false; //Unsupported DIBV5 format + + int w = bi.bV5Width, h = bi.bV5Height; + int red_mask = bi.bV5RedMask; + int green_mask = bi.bV5GreenMask; + int blue_mask = bi.bV5BlueMask; + int alpha_mask = bi.bV5AlphaMask; + int red_shift = 0; + int green_shift = 0; + int blue_shift = 0; + int alpha_shift = 0; + QImage::Format format = QImage::Format_ARGB32; + + if (bi.bV5Height < 0) + h = -h; // support images with negative height + if (image.size() != QSize(w, h) || image.format() != format) { + image = QImage(w, h, format); + if (image.isNull()) // could not create image + return false; + } + image.setDotsPerMeterX(bi.bV5XPelsPerMeter); + image.setDotsPerMeterY(bi.bV5YPelsPerMeter); + // read color table + DWORD colorSpace[3]; + if (d->read((char *)colorSpace, sizeof(colorSpace)) != sizeof(colorSpace)) + return false; + + red_shift = calc_shift(red_mask); + green_shift = calc_shift(green_mask); + blue_shift = calc_shift(blue_mask); + if (alpha_mask) { + alpha_shift = calc_shift(alpha_mask); + } + + int bpl = image.bytesPerLine(); + uchar *data = image.bits(); + register QRgb *p; + QRgb *end; + uchar *buf24 = new uchar[bpl]; + int bpl24 = ((w*nbits+31)/32)*4; + uchar *b; + unsigned int c; + + while (--h >= 0) { + p = (QRgb *)(data + h*bpl); + end = p + w; + if (d->read((char *)buf24,bpl24) != bpl24) + break; + b = buf24; + while (p < end) { + c = *b | (*(b+1))<<8 | (*(b+2))<<16 | (*(b+3))<<24; + *p++ = qRgba(((c & red_mask) >> red_shift) , + ((c & green_mask) >> green_shift), + ((c & blue_mask) >> blue_shift), + ((c & alpha_mask) >> alpha_shift)); + b += 4; + } + } + delete[] buf24; + + if (bi.bV5Height < 0) { + // Flip the image + uchar *buf = new uchar[bpl]; + h = -bi.bV5Height; + for (int y = 0; y < h/2; ++y) { + memcpy(buf, data + y*bpl, bpl); + memcpy(data + y*bpl, data + (h-y-1)*bpl, bpl); + memcpy(data + (h-y-1)*bpl, buf, bpl); + } + delete [] buf; + } + + return true; +} + +//#define QMIME_DEBUG + +// helpers for using global memory + +static int getCf(const FORMATETC &formatetc) +{ + return formatetc.cfFormat; +} + +static FORMATETC setCf(int cf) +{ + FORMATETC formatetc; + formatetc.cfFormat = cf; + formatetc.dwAspect = DVASPECT_CONTENT; + formatetc.lindex = -1; + formatetc.ptd = NULL; + formatetc.tymed = TYMED_HGLOBAL; + return formatetc; +} + +static bool setData(const QByteArray &data, STGMEDIUM *pmedium) +{ + HGLOBAL hData = GlobalAlloc(0, data.size()); + if (!hData) + return false; + + void *out = GlobalLock(hData); + memcpy(out, data.data(), data.size()); + GlobalUnlock(hData); + pmedium->tymed = TYMED_HGLOBAL; + pmedium->hGlobal = hData; + pmedium->pUnkForRelease = 0; + return true; +} + +static QByteArray getData(int cf, IDataObject *pDataObj) +{ + QByteArray data; + FORMATETC formatetc = setCf(cf); + STGMEDIUM s; + if (pDataObj->GetData(&formatetc, &s) == S_OK) { + DWORD * val = (DWORD*)GlobalLock(s.hGlobal); + data = QByteArray::fromRawData((char*)val, GlobalSize(s.hGlobal)); + data.detach(); + GlobalUnlock(s.hGlobal); + ReleaseStgMedium(&s); + } else { + //Try reading IStream data + formatetc.tymed = TYMED_ISTREAM; + if (pDataObj->GetData(&formatetc, &s) == S_OK) { + char szBuffer[4096]; + ULONG actualRead = 0; + LARGE_INTEGER pos = {{0, 0}}; + //Move to front (can fail depending on the data model implemented) + HRESULT hr = s.pstm->Seek(pos, STREAM_SEEK_SET, NULL); + while(SUCCEEDED(hr)){ + hr = s.pstm->Read(szBuffer, sizeof(szBuffer), &actualRead); + if (SUCCEEDED(hr) && actualRead > 0) { + data += QByteArray::fromRawData(szBuffer, actualRead); + } + if (actualRead != sizeof(szBuffer)) + break; + } + data.detach(); + ReleaseStgMedium(&s); + } + } + return data; +} + +static bool canGetData(int cf, IDataObject * pDataObj) +{ + FORMATETC formatetc = setCf(cf); + if (pDataObj->QueryGetData(&formatetc) != S_OK){ + formatetc.tymed = TYMED_ISTREAM; + return pDataObj->QueryGetData(&formatetc) == S_OK; + } + return true; +} + +/*! + \class QWindowsMime + \brief The QWindowsMime class maps open-standard MIME to Window Clipboard formats. + \ingroup qt-lighthouse-win + + Qt's drag-and-drop and clipboard facilities use the MIME standard. + On X11, this maps trivially to the Xdnd protocol, but on Windows + although some applications use MIME types to describe clipboard + formats, others use arbitrary non-standardized naming conventions, + or unnamed built-in formats of Windows. + + By instantiating subclasses of QWindowsMime that provide conversions + between Windows Clipboard and MIME formats, you can convert + proprietary clipboard formats to MIME formats. + + Qt has predefined support for the following Windows Clipboard formats: + + \table + \header \o Windows Format \o Equivalent MIME type + \row \o \c CF_UNICODETEXT \o \c text/plain + \row \o \c CF_TEXT \o \c text/plain + \row \o \c CF_DIB \o \c{image/xyz}, where \c xyz is + a \l{QImageWriter::supportedImageFormats()}{Qt image format} + \row \o \c CF_HDROP \o \c text/uri-list + \row \o \c CF_INETURL \o \c text/uri-list + \row \o \c CF_HTML \o \c text/html + \endtable + + An example use of this class would be to map the Windows Metafile + clipboard format (\c CF_METAFILEPICT) to and from the MIME type + \c{image/x-wmf}. This conversion might simply be adding or removing + a header, or even just passing on the data. See \l{Drag and Drop} + for more information on choosing and definition MIME types. + + You can check if a MIME type is convertible using canConvertFromMime() and + can perform conversions with convertToMime() and convertFromMime(). + + \sa QWindowsMimeConverter +*/ + +/*! +Constructs a new conversion object, adding it to the globally accessed +list of available converters. +*/ +QWindowsMime::QWindowsMime() +{ +} + +/*! +Destroys a conversion object, removing it from the global +list of available converters. +*/ +QWindowsMime::~QWindowsMime() +{ +} + +/*! + Registers the MIME type \a mime, and returns an ID number + identifying the format on Windows. +*/ +int QWindowsMime::registerMimeType(const QString &mime) +{ + int f = RegisterClipboardFormat(reinterpret_cast (mime.utf16())); + if (!f) + qErrnoWarning("QWindowsMime::registerMimeType: Failed to register clipboard format"); + + return f; +} + +/*! +\fn bool QWindowsMime::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const + + Returns true if the converter can convert from the \a mimeData to + the format specified in \a formatetc. + + All subclasses must reimplement this pure virtual function. +*/ + +/*! + \fn bool QWindowsMime::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const + + Returns true if the converter can convert to the \a mimeType from + the available formats in \a pDataObj. + + All subclasses must reimplement this pure virtual function. +*/ + +/*! +\fn QString QWindowsMime::mimeForFormat(const FORMATETC &formatetc) const + + Returns the mime type that will be created form the format specified + in \a formatetc, or an empty string if this converter does not support + \a formatetc. + + All subclasses must reimplement this pure virtual function. +*/ + +/*! +\fn QVector QWindowsMime::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const + + Returns a QVector of FORMATETC structures representing the different windows clipboard + formats that can be provided for the \a mimeType from the \a mimeData. + + All subclasses must reimplement this pure virtual function. +*/ + +/*! + \fn QVariant QWindowsMime::convertToMime(const QString &mimeType, IDataObject *pDataObj, + QVariant::Type preferredType) const + + Returns a QVariant containing the converted data for \a mimeType from \a pDataObj. + If possible the QVariant should be of the \a preferredType to avoid needless conversions. + + All subclasses must reimplement this pure virtual function. +*/ + +/*! +\fn bool QWindowsMime::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const + + Convert the \a mimeData to the format specified in \a formatetc. + The converted data should then be placed in \a pmedium structure. + + Return true if the conversion was successful. + + All subclasses must reimplement this pure virtual function. +*/ + +class QWindowsMimeText : public QWindowsMime +{ +public: + bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const; + QVariant convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const; + QString mimeForFormat(const FORMATETC &formatetc) const; + bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const; + bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const; + QVector formatsForMime(const QString &mimeType, const QMimeData *mimeData) const; +}; + +bool QWindowsMimeText::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const +{ + int cf = getCf(formatetc); + return (cf == CF_UNICODETEXT || cf == CF_TEXT) && mimeData->hasText(); +} + +/* +text/plain is defined as using CRLF, but so many programs don't, +and programmers just look for '\n' in strings. +Windows really needs CRLF, so we ensure it here. +*/ +bool QWindowsMimeText::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const +{ + if (canConvertFromMime(formatetc, mimeData)) { + QByteArray data; + int cf = getCf(formatetc); + if (cf == CF_TEXT) { + data = mimeData->text().toLocal8Bit(); + // Anticipate required space for CRLFs at 1/40 + int maxsize=data.size()+data.size()/40+3; + QByteArray r(maxsize, '\0'); + char* o = r.data(); + const char* d = data.data(); + const int s = data.size(); + bool cr=false; + int j=0; + for (int i=0; i= maxsize) { + maxsize += maxsize/4; + r.resize(maxsize); + o = r.data(); + } + } + o[j]=0; + return setData(r, pmedium); + } else if (cf == CF_UNICODETEXT) { + QString str = mimeData->text(); + const QChar *u = str.unicode(); + QString res; + const int s = str.length(); + int maxsize = s + s/40 + 3; + res.resize(maxsize); + int ri = 0; + bool cr = false; + for (int i=0; i < s; ++i) { + if (*u == QLatin1Char('\r')) + cr = true; + else { + if (*u == QLatin1Char('\n') && !cr) + res[ri++] = QLatin1Char('\r'); + cr = false; + } + res[ri++] = *u; + if (ri+3 >= maxsize) { + maxsize += maxsize/4; + res.resize(maxsize); + } + ++u; + } + res.truncate(ri); + const int byteLength = res.length() * sizeof(ushort); + QByteArray r(byteLength + 2, '\0'); + memcpy(r.data(), res.unicode(), byteLength); + r[byteLength] = 0; + r[byteLength+1] = 0; + return setData(r, pmedium); + } + } + return false; +} + +bool QWindowsMimeText::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const +{ + return mimeType.startsWith(QStringLiteral("text/plain")) + && (canGetData(CF_UNICODETEXT, pDataObj) + || canGetData(CF_TEXT, pDataObj)); +} + +QString QWindowsMimeText::mimeForFormat(const FORMATETC &formatetc) const +{ + int cf = getCf(formatetc); + if (cf == CF_UNICODETEXT || cf == CF_TEXT) + return QStringLiteral("text/plain"); + return QString(); +} + + +QVector QWindowsMimeText::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const +{ + QVector formatics; + if (mimeType.startsWith(QStringLiteral("text/plain")) && mimeData->hasText()) { + formatics += setCf(CF_UNICODETEXT); + formatics += setCf(CF_TEXT); + } + return formatics; +} + +QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const +{ + QVariant ret; + + if (canConvertToMime(mime, pDataObj)) { + QString str; + QByteArray data = getData(CF_UNICODETEXT, pDataObj); + if (!data.isEmpty()) { + str = QString::fromWCharArray((const wchar_t *)data.data()); + str.replace(QStringLiteral("\r\n"), QStringLiteral("\n")); + } else { + data = getData(CF_TEXT, pDataObj); + if (!data.isEmpty()) { + const char* d = data.data(); + const int s = qstrlen(d); + QByteArray r(data.size()+1, '\0'); + char* o = r.data(); + int j=0; + for (int i=0; i formatsForMime(const QString &mimeType, const QMimeData *mimeData) const; +private: + int CF_INETURL_W; // wide char version + int CF_INETURL; +}; + +QWindowsMimeURI::QWindowsMimeURI() +{ + CF_INETURL_W = QWindowsMime::registerMimeType(QStringLiteral("UniformResourceLocatorW")); + CF_INETURL = QWindowsMime::registerMimeType(QStringLiteral("UniformResourceLocator")); +} + +bool QWindowsMimeURI::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const +{ + if (getCf(formatetc) == CF_HDROP) { + QList urls = mimeData->urls(); + for (int i=0; ihasFormat(QStringLiteral("text/uri-list")); +} + +bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const +{ + if (canConvertFromMime(formatetc, mimeData)) { + if (getCf(formatetc) == CF_HDROP) { + QList urls = mimeData->urls(); + QStringList fileNames; + int size = sizeof(DROPFILES)+2; + for (int i=0; ipFiles = sizeof(DROPFILES); + GetCursorPos(&d->pt); // try + d->fNC = true; + char* files = ((char*)d) + d->pFiles; + + d->fWide = true; + wchar_t* f = (wchar_t*)files; + for (int i=0; i urls = mimeData->urls(); + QByteArray result; + if (!urls.isEmpty()) { + QString url = urls.at(0).toString(); + result = QByteArray((const char *)url.utf16(), url.length() * sizeof(ushort)); + } + result.append('\0'); + result.append('\0'); + return setData(result, pmedium); + } else if (getCf(formatetc) == CF_INETURL) { + QList urls = mimeData->urls(); + QByteArray result; + if (!urls.isEmpty()) + result = urls.at(0).toString().toLocal8Bit(); + return setData(result, pmedium); + } + } + + return false; +} + +bool QWindowsMimeURI::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const +{ + return mimeType == QStringLiteral("text/uri-list") + && (canGetData(CF_HDROP, pDataObj) || canGetData(CF_INETURL_W, pDataObj) || canGetData(CF_INETURL, pDataObj)); +} + +QString QWindowsMimeURI::mimeForFormat(const FORMATETC &formatetc) const +{ + QString format; + if (getCf(formatetc) == CF_HDROP || getCf(formatetc) == CF_INETURL_W || getCf(formatetc) == CF_INETURL) + format = QStringLiteral("text/uri-list"); + return format; +} + +QVector QWindowsMimeURI::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const +{ + QVector formatics; + if (mimeType == QStringLiteral("text/uri-list")) { + if (canConvertFromMime(setCf(CF_HDROP), mimeData)) + formatics += setCf(CF_HDROP); + if (canConvertFromMime(setCf(CF_INETURL_W), mimeData)) + formatics += setCf(CF_INETURL_W); + if (canConvertFromMime(setCf(CF_INETURL), mimeData)) + formatics += setCf(CF_INETURL); + } + return formatics; +} + +QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const +{ + if (mimeType == QStringLiteral("text/uri-list")) { + if (canGetData(CF_HDROP, pDataObj)) { + QByteArray texturi; + QList urls; + + QByteArray data = getData(CF_HDROP, pDataObj); + if (data.isEmpty()) + return QVariant(); + + LPDROPFILES hdrop = (LPDROPFILES)data.data(); + if (hdrop->fWide) { + const wchar_t* filesw = (const wchar_t *)(data.data() + hdrop->pFiles); + int i = 0; + while (filesw[i]) { + QString fileurl = QString::fromWCharArray(filesw + i); + urls += QUrl::fromLocalFile(fileurl); + i += fileurl.length()+1; + } + } else { + const char* files = (const char *)data.data() + hdrop->pFiles; + int i=0; + while (files[i]) { + urls += QUrl::fromLocalFile(QString::fromLocal8Bit(files+i)); + i += int(strlen(files+i))+1; + } + } + + if (preferredType == QVariant::Url && urls.size() == 1) + return urls.at(0); + else if (!urls.isEmpty()) + return urls; + } else if (canGetData(CF_INETURL_W, pDataObj)) { + QByteArray data = getData(CF_INETURL_W, pDataObj); + if (data.isEmpty()) + return QVariant(); + return QUrl(QString::fromWCharArray((const wchar_t *)data.constData())); + } else if (canGetData(CF_INETURL, pDataObj)) { + QByteArray data = getData(CF_INETURL, pDataObj); + if (data.isEmpty()) + return QVariant(); + return QUrl(QString::fromLocal8Bit(data.constData())); + } + } + return QVariant(); +} + +class QWindowsMimeHtml : public QWindowsMime +{ +public: + QWindowsMimeHtml(); + + // for converting from Qt + bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const; + bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const; + QVector formatsForMime(const QString &mimeType, const QMimeData *mimeData) const; + + // for converting to Qt + bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const; + QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const; + QString mimeForFormat(const FORMATETC &formatetc) const; + +private: + int CF_HTML; +}; + +QWindowsMimeHtml::QWindowsMimeHtml() +{ + CF_HTML = QWindowsMime::registerMimeType(QStringLiteral("HTML Format")); +} + +QVector QWindowsMimeHtml::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const +{ + QVector formatetcs; + if (mimeType == QStringLiteral("text/html") && (!mimeData->html().isEmpty())) + formatetcs += setCf(CF_HTML); + return formatetcs; +} + +QString QWindowsMimeHtml::mimeForFormat(const FORMATETC &formatetc) const +{ + if (getCf(formatetc) == CF_HTML) + return QStringLiteral("text/html"); + return QString(); +} + +bool QWindowsMimeHtml::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const +{ + return mimeType == QStringLiteral("text/html") && canGetData(CF_HTML, pDataObj); +} + + +bool QWindowsMimeHtml::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const +{ + return getCf(formatetc) == CF_HTML && (!mimeData->html().isEmpty()); +} + +/* +The windows HTML clipboard format is as follows (xxxxxxxxxx is a 10 integer number giving the positions +in bytes). Charset used is mostly utf8, but can be different, ie. we have to look for the charset tag + + Version: 1.0 + StartHTML:xxxxxxxxxx + EndHTML:xxxxxxxxxx + StartFragment:xxxxxxxxxx + EndFragment:xxxxxxxxxx + ...html... + +*/ +QVariant QWindowsMimeHtml::convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const +{ + Q_UNUSED(preferredType); + QVariant result; + if (canConvertToMime(mime, pDataObj)) { + QByteArray html = getData(CF_HTML, pDataObj); +#ifdef QMIME_DEBUG + qDebug("QWindowsMimeHtml::convertToMime"); + qDebug("raw :"); + qDebug(html); +#endif + int start = html.indexOf("StartFragment:"); + int end = html.indexOf("EndFragment:"); + + if (start != -1) { + int startOffset = start + 14; + int i = startOffset; + while (html.at(i) != '\r' && html.at(i) != '\n') + ++i; + QByteArray bytecount = html.mid(startOffset, i - startOffset); + start = bytecount.toInt(); + } + + if (end != -1) { + int endOffset = end + 12; + int i = endOffset ; + while (html.at(i) != '\r' && html.at(i) != '\n') + ++i; + QByteArray bytecount = html.mid(endOffset , i - endOffset); + end = bytecount.toInt(); + } + + if (end > start && start > 0) { + html = "" + html.mid(start, end - start); + html += ""; + html.replace('\r', ""); + result = QString::fromUtf8(html); + } + } + return result; +} + +bool QWindowsMimeHtml::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const +{ + if (canConvertFromMime(formatetc, mimeData)) { + QByteArray data = mimeData->html().toUtf8(); + QByteArray result = + "Version:1.0\r\n" // 0-12 + "StartHTML:0000000105\r\n" // 13-35 + "EndHTML:0000000000\r\n" // 36-55 + "StartFragment:0000000000\r\n" // 58-86 + "EndFragment:0000000000\r\n\r\n"; // 87-105 + + if (data.indexOf("") == -1) + result += ""; + result += data; + if (data.indexOf("") == -1) + result += ""; + + // set the correct number for EndHTML + QByteArray pos = QString::number(result.size()).toLatin1(); + memcpy((char *)(result.data() + 53 - pos.length()), pos.constData(), pos.length()); + + // set correct numbers for StartFragment and EndFragment + pos = QString::number(result.indexOf("") + 20).toLatin1(); + memcpy((char *)(result.data() + 79 - pos.length()), pos.constData(), pos.length()); + pos = QString::number(result.indexOf("")).toLatin1(); + memcpy((char *)(result.data() + 103 - pos.length()), pos.constData(), pos.length()); + + return setData(result, pmedium); + } + return false; +} + + +#ifndef QT_NO_IMAGEFORMAT_BMP +class QWindowsMimeImage : public QWindowsMime +{ +public: + QWindowsMimeImage(); + // for converting from Qt + bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const; + bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const; + QVector formatsForMime(const QString &mimeType, const QMimeData *mimeData) const; + + // for converting to Qt + bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const; + QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const; + QString mimeForFormat(const FORMATETC &formatetc) const; +private: + bool hasOriginalDIBV5(IDataObject *pDataObj) const; + UINT CF_PNG; +}; + +QWindowsMimeImage::QWindowsMimeImage() +{ + CF_PNG = RegisterClipboardFormat(L"PNG"); +} + +QVector QWindowsMimeImage::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const +{ + QVector formatetcs; + if (mimeData->hasImage() && mimeType == QStringLiteral("application/x-qt-image")) { + //add DIBV5 if image has alpha channel + QImage image = qvariant_cast(mimeData->imageData()); + if (!image.isNull() && image.hasAlphaChannel()) + formatetcs += setCf(CF_DIBV5); + formatetcs += setCf(CF_DIB); + } + return formatetcs; +} + +QString QWindowsMimeImage::mimeForFormat(const FORMATETC &formatetc) const +{ + int cf = getCf(formatetc); + if (cf == CF_DIB || cf == CF_DIBV5 || cf == int(CF_PNG)) + return QStringLiteral("application/x-qt-image"); + return QString(); +} + +bool QWindowsMimeImage::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const +{ + if ((mimeType == QStringLiteral("application/x-qt-image")) && + (canGetData(CF_DIB, pDataObj) || canGetData(CF_PNG, pDataObj))) + return true; + return false; +} + +bool QWindowsMimeImage::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const +{ + int cf = getCf(formatetc); + if (mimeData->hasImage()) { + if (cf == CF_DIB) + return true; + else if (cf == CF_DIBV5) { + //support DIBV5 conversion only if the image has alpha channel + QImage image = qvariant_cast(mimeData->imageData()); + if (!image.isNull() && image.hasAlphaChannel()) + return true; + } + } + return false; +} + +bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const +{ + int cf = getCf(formatetc); + if ((cf == CF_DIB || cf == CF_DIBV5) && mimeData->hasImage()) { + QImage img = qvariant_cast(mimeData->imageData()); + if (img.isNull()) + return false; + QByteArray ba; + if (cf == CF_DIB) { + if (img.format() > QImage::Format_ARGB32) + img = img.convertToFormat(QImage::Format_RGB32); + const QByteArray ba = writeDib(img); + if (!ba.isEmpty()) + return setData(ba, pmedium); + } else { + QDataStream s(&ba, QIODevice::WriteOnly); + s.setByteOrder(QDataStream::LittleEndian);// Intel byte order #### + if (qt_write_dibv5(s, img)) + return setData(ba, pmedium); + } + } + return false; +} + +bool QWindowsMimeImage::hasOriginalDIBV5(IDataObject *pDataObj) const +{ + bool isSynthesized = true; + IEnumFORMATETC *pEnum =NULL; + HRESULT res = pDataObj->EnumFormatEtc(1, &pEnum); + if (res == S_OK && pEnum) { + FORMATETC fc; + while ((res = pEnum->Next(1, &fc, 0)) == S_OK) { + if (fc.ptd) + CoTaskMemFree(fc.ptd); + if (fc.cfFormat == CF_DIB) + break; + else if (fc.cfFormat == CF_DIBV5) { + isSynthesized = false; + break; + } + } + pEnum->Release(); + } + return !isSynthesized; +} + +QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const +{ + Q_UNUSED(preferredType); + QVariant result; + if (mimeType != QStringLiteral("application/x-qt-image")) + return result; + //Try to convert from a format which has more data + //DIBV5, use only if its is not synthesized + if (canGetData(CF_DIBV5, pDataObj) && hasOriginalDIBV5(pDataObj)) { + QImage img; + QByteArray data = getData(CF_DIBV5, pDataObj); + QDataStream s(&data, QIODevice::ReadOnly); + s.setByteOrder(QDataStream::LittleEndian); + if (qt_read_dibv5(s, img)) { // #### supports only 32bit DIBV5 + return img; + } + } + //PNG, MS Office place this (undocumented) + if (canGetData(CF_PNG, pDataObj)) { + QImage img; + QByteArray data = getData(CF_PNG, pDataObj); + if (img.loadFromData(data, "PNG")) { + return img; + } + } + //Fallback to DIB + if (canGetData(CF_DIB, pDataObj)) { + const QImage img = readDib(getData(CF_DIB, pDataObj)); + if (!img.isNull()) + return img; + } + // Failed + return result; +} +#endif + +class QBuiltInMimes : public QWindowsMime +{ +public: + QBuiltInMimes(); + + // for converting from Qt + bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const; + bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const; + QVector formatsForMime(const QString &mimeType, const QMimeData *mimeData) const; + + // for converting to Qt + bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const; + QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const; + QString mimeForFormat(const FORMATETC &formatetc) const; + +private: + QMap outFormats; + QMap inFormats; +}; + +QBuiltInMimes::QBuiltInMimes() +: QWindowsMime() +{ + outFormats.insert(QWindowsMime::registerMimeType(QStringLiteral("application/x-color")), QStringLiteral("application/x-color")); + inFormats.insert(QWindowsMime::registerMimeType(QStringLiteral("application/x-color")), QStringLiteral("application/x-color")); +} + +bool QBuiltInMimes::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const +{ + // really check + return formatetc.tymed & TYMED_HGLOBAL + && outFormats.contains(formatetc.cfFormat) + && mimeData->formats().contains(outFormats.value(formatetc.cfFormat)); +} + +bool QBuiltInMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const +{ + if (canConvertFromMime(formatetc, mimeData)) { + QByteArray data; + if (outFormats.value(getCf(formatetc)) == QStringLiteral("text/html")) { + // text/html is in wide chars on windows (compatible with mozillia) + QString html = mimeData->html(); + // same code as in the text converter up above + const QChar *u = html.unicode(); + QString res; + const int s = html.length(); + int maxsize = s + s/40 + 3; + res.resize(maxsize); + int ri = 0; + bool cr = false; + for (int i=0; i < s; ++i) { + if (*u == QLatin1Char('\r')) + cr = true; + else { + if (*u == QLatin1Char('\n') && !cr) + res[ri++] = QLatin1Char('\r'); + cr = false; + } + res[ri++] = *u; + if (ri+3 >= maxsize) { + maxsize += maxsize/4; + res.resize(maxsize); + } + ++u; + } + res.truncate(ri); + const int byteLength = res.length() * sizeof(ushort); + QByteArray r(byteLength + 2, '\0'); + memcpy(r.data(), res.unicode(), byteLength); + r[byteLength] = 0; + r[byteLength+1] = 0; + data = r; + } else { +#ifndef QT_NO_DRAGANDDROP + data = QInternalMimeData::renderDataHelper(outFormats.value(getCf(formatetc)), mimeData); +#endif //QT_NO_DRAGANDDROP + } + return setData(data, pmedium); + } + return false; +} + +QVector QBuiltInMimes::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const +{ + QVector formatetcs; + if (!outFormats.keys(mimeType).isEmpty() && mimeData->formats().contains(mimeType)) + formatetcs += setCf(outFormats.key(mimeType)); + return formatetcs; +} + +bool QBuiltInMimes::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const +{ + return (!inFormats.keys(mimeType).isEmpty()) + && canGetData(inFormats.key(mimeType), pDataObj); +} + +QVariant QBuiltInMimes::convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const +{ + QVariant val; + if (canConvertToMime(mimeType, pDataObj)) { + QByteArray data = getData(inFormats.key(mimeType), pDataObj); + if (!data.isEmpty()) { +#ifdef QMIME_DEBUG + qDebug("QBuiltInMimes::convertToMime()"); +#endif + if (mimeType == QStringLiteral("text/html") && preferredType == QVariant::String) { + // text/html is in wide chars on windows (compatible with Mozilla) + val = QString::fromWCharArray((const wchar_t *)data.data()); + } else { + val = data; // it should be enough to return the data and let QMimeData do the rest. + } + } + } + return val; +} + +QString QBuiltInMimes::mimeForFormat(const FORMATETC &formatetc) const +{ + return inFormats.value(getCf(formatetc)); +} + + +class QLastResortMimes : public QWindowsMime +{ +public: + + QLastResortMimes(); + // for converting from Qt + bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const; + bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const; + QVector formatsForMime(const QString &mimeType, const QMimeData *mimeData) const; + + // for converting to Qt + bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const; + QVariant convertToMime(const QString &mime, IDataObject *pDataObj, QVariant::Type preferredType) const; + QString mimeForFormat(const FORMATETC &formatetc) const; + +private: + QMap formats; + static QStringList ianaTypes; + static QStringList excludeList; +}; + +QStringList QLastResortMimes::ianaTypes; +QStringList QLastResortMimes::excludeList; + +QLastResortMimes::QLastResortMimes() +{ + //MIME Media-Types + if (!ianaTypes.size()) { + ianaTypes.append(QStringLiteral("application/")); + ianaTypes.append(QStringLiteral("audio/")); + ianaTypes.append(QStringLiteral("example/")); + ianaTypes.append(QStringLiteral("image/")); + ianaTypes.append(QStringLiteral("message/")); + ianaTypes.append(QStringLiteral("model/")); + ianaTypes.append(QStringLiteral("multipart/")); + ianaTypes.append(QStringLiteral("text/")); + ianaTypes.append(QStringLiteral("video/")); + } + //Types handled by other classes + if (!excludeList.size()) { + excludeList.append(QStringLiteral("HTML Format")); + excludeList.append(QStringLiteral("UniformResourceLocator")); + excludeList.append(QStringLiteral("text/html")); + excludeList.append(QStringLiteral("text/plain")); + excludeList.append(QStringLiteral("text/uri-list")); + excludeList.append(QStringLiteral("application/x-qt-image")); + excludeList.append(QStringLiteral("application/x-color")); + } +} + +bool QLastResortMimes::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const +{ + // really check +#ifndef QT_NO_DRAGANDDROP + return formatetc.tymed & TYMED_HGLOBAL + && (formats.contains(formatetc.cfFormat) + && QInternalMimeData::hasFormatHelper(formats.value(formatetc.cfFormat), mimeData)); +#else + Q_UNUSED(mimeData); + Q_UNUSED(formatetc); + return formatetc.tymed & TYMED_HGLOBAL + && formats.contains(formatetc.cfFormat); +#endif //QT_NO_DRAGANDDROP +} + +bool QLastResortMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const +{ +#ifndef QT_NO_DRAGANDDROP + return canConvertFromMime(formatetc, mimeData) + && setData(QInternalMimeData::renderDataHelper(formats.value(getCf(formatetc)), mimeData), pmedium); +#else + Q_UNUSED(mimeData); + Q_UNUSED(formatetc); + Q_UNUSED(pmedium); + return false; +#endif //QT_NO_DRAGANDDROP +} + +QVector QLastResortMimes::formatsForMime(const QString &mimeType, const QMimeData * /*mimeData*/) const +{ + QVector formatetcs; + if (!formats.keys(mimeType).isEmpty()) { + formatetcs += setCf(formats.key(mimeType)); + } else if (!excludeList.contains(mimeType, Qt::CaseInsensitive)){ + // register any other available formats + int cf = QWindowsMime::registerMimeType(mimeType); + QLastResortMimes *that = const_cast(this); + that->formats.insert(cf, mimeType); + formatetcs += setCf(cf); + } + return formatetcs; +} +static const char x_qt_windows_mime[] = "application/x-qt-windows-mime;value=\""; + +static bool isCustomMimeType(const QString &mimeType) +{ + return mimeType.startsWith(QLatin1String(x_qt_windows_mime), Qt::CaseInsensitive); +} + +static QString customMimeType(const QString &mimeType) +{ + int len = sizeof(x_qt_windows_mime) - 1; + int n = mimeType.lastIndexOf(QLatin1Char('\"'))-len; + return mimeType.mid(len, n); +} + +bool QLastResortMimes::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const +{ + if (isCustomMimeType(mimeType)) { + QString clipFormat = customMimeType(mimeType); + int cf = RegisterClipboardFormat(reinterpret_cast (clipFormat.utf16())); + return canGetData(cf, pDataObj); + } else if (formats.keys(mimeType).isEmpty()) { + // if it is not in there then register it an see if we can get it + int cf = QWindowsMime::registerMimeType(mimeType); + return canGetData(cf, pDataObj); + } else { + return canGetData(formats.key(mimeType), pDataObj); + } + return false; +} + +QVariant QLastResortMimes::convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const +{ + Q_UNUSED(preferredType); + QVariant val; + if (canConvertToMime(mimeType, pDataObj)) { + QByteArray data; + if (isCustomMimeType(mimeType)) { + QString clipFormat = customMimeType(mimeType); + int cf = RegisterClipboardFormat(reinterpret_cast (clipFormat.utf16())); + data = getData(cf, pDataObj); + } else if (formats.keys(mimeType).isEmpty()) { + int cf = QWindowsMime::registerMimeType(mimeType); + data = getData(cf, pDataObj); + } else { + data = getData(formats.key(mimeType), pDataObj); + } + if (!data.isEmpty()) + val = data; // it should be enough to return the data and let QMimeData do the rest. + } + return val; +} + +QString QLastResortMimes::mimeForFormat(const FORMATETC &formatetc) const +{ + QString format = formats.value(getCf(formatetc)); + if (!format.isEmpty()) + return format; + + wchar_t buffer[256]; + int len = GetClipboardFormatName(getCf(formatetc), buffer, 256); + + if (len) { + QString clipFormat = QString::fromWCharArray(buffer, len); +#ifndef QT_NO_DRAGANDDROP + if (QInternalMimeData::canReadData(clipFormat)) + format = clipFormat; + else if((formatetc.cfFormat >= 0xC000)){ + //create the mime as custom. not registered. + if (!excludeList.contains(clipFormat, Qt::CaseInsensitive)) { + //check if this is a mime type + bool ianaType = false; + int sz = ianaTypes.size(); + for (int i = 0; i < sz; i++) { + if (clipFormat.startsWith(ianaTypes[i], Qt::CaseInsensitive)) { + ianaType = true; + break; + } + } + if (!ianaType) + format = QLatin1String(x_qt_windows_mime) + clipFormat + QLatin1Char('\"'); + else + format = clipFormat; + } + } +#endif //QT_NO_DRAGANDDROP + } + + return format; +} + +/*! + \class QWindowsMimeConverter + \brief Manages the list of QWindowsMime instances. + \ingroup qt-lighthouse-win + \sa QWindowsMime +*/ + +QWindowsMimeConverter::QWindowsMimeConverter() +{ +} + +QWindowsMimeConverter::~QWindowsMimeConverter() +{ + qDeleteAll(m_mimes); +} + +QWindowsMime * QWindowsMimeConverter::converterToMime(const QString &mimeType, IDataObject *pDataObj) const +{ + ensureInitialized(); + for (int i = m_mimes.size()-1; i >= 0; --i) { + if (m_mimes.at(i)->canConvertToMime(mimeType, pDataObj)) + return m_mimes.at(i); + } + return 0; +} + +QStringList QWindowsMimeConverter::allMimesForFormats(IDataObject *pDataObj) const +{ + ensureInitialized(); + QStringList formats; + LPENUMFORMATETC FAR fmtenum; + HRESULT hr = pDataObj->EnumFormatEtc(DATADIR_GET, &fmtenum); + + if (hr == NOERROR) { + FORMATETC fmtetc; + while (S_OK == fmtenum->Next(1, &fmtetc, 0)) { +#if defined(QMIME_DEBUG) + qDebug("QWindowsMime::allMimesForFormats()"); + wchar_t buf[256] = {0}; + GetClipboardFormatName(fmtetc.cfFormat, buf, 255); + qDebug("CF = %d : %s", fmtetc.cfFormat, QString::fromWCharArray(buf)); +#endif + for (int i= m_mimes.size() - 1; i >= 0; --i) { + QString format = m_mimes.at(i)->mimeForFormat(fmtetc); + if (!format.isEmpty() && !formats.contains(format)) { + formats += format; + } + } + // as documented in MSDN to avoid possible memleak + if (fmtetc.ptd) + CoTaskMemFree(fmtetc.ptd); + } + fmtenum->Release(); + } + if (QWindowsContext::verboseOLE) + qDebug() << __FUNCTION__ << pDataObj << formats; + return formats; +} + +QWindowsMime * QWindowsMimeConverter::converterFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const +{ + ensureInitialized(); + for (int i = m_mimes.size()-1; i >= 0; --i) { + if (m_mimes.at(i)->canConvertFromMime(formatetc, mimeData)) + return m_mimes.at(i); + } + return 0; +} + +QVector QWindowsMimeConverter::allFormatsForMime(const QMimeData *mimeData) const +{ + ensureInitialized(); + QVector formatics; +#ifdef QT_NO_DRAGANDDROP + Q_UNUSED(mimeData); +#else + formatics.reserve(20); + const QStringList formats = QInternalMimeData::formatsHelper(mimeData); + for (int f = 0; f < formats.size(); ++f) { + for (int i = m_mimes.size() - 1; i >= 0; --i) + formatics += m_mimes.at(i)->formatsForMime(formats.at(f), mimeData); + } +#endif //QT_NO_DRAGANDDROP + return formatics; +} + +void QWindowsMimeConverter::ensureInitialized() const +{ + if (m_mimes.isEmpty()) { + m_mimes << new QWindowsMimeImage << new QLastResortMimes + << new QWindowsMimeText << new QWindowsMimeURI + << new QWindowsMimeHtml << new QBuiltInMimes; + } +} + +QVariant QWindowsMimeConverter::convertToMime(const QStringList &mimeTypes, + IDataObject *pDataObj, + QVariant::Type preferredType, + QString *formatIn /* = 0 */) const +{ + foreach (const QString &format, mimeTypes) { + if (const QWindowsMime *converter = converterToMime(format, pDataObj)) { + if (converter->canConvertToMime(format, pDataObj)) { + const QVariant dataV = converter->convertToMime(format, pDataObj, preferredType); + if (dataV.isValid()) { + if (QWindowsContext::verboseOLE) + qDebug() << __FUNCTION__ << mimeTypes << "\nFormat: " + << format << pDataObj << " returns " << dataV; + if (formatIn) + *formatIn = format; + return dataV; + } + } + } + } + if (QWindowsContext::verboseOLE) + qDebug() << __FUNCTION__ << "fails" << mimeTypes << pDataObj << preferredType; + return QVariant(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsmime.h b/src/plugins/platforms/windows/qwindowsmime.h new file mode 100644 index 00000000000..85f61a91e2a --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsmime.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSMIME_H +#define QWINDOWSMIME_H + +#include "qtwindows_additional.h" + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QMimeData; + +class QWindowsMime +{ + Q_DISABLE_COPY(QWindowsMime) +public: + QWindowsMime(); + virtual ~QWindowsMime(); + + // for converting from Qt + virtual bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const = 0; + virtual bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const = 0; + virtual QVector formatsForMime(const QString &mimeType, const QMimeData *mimeData) const = 0; + + // for converting to Qt + virtual bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const = 0; + virtual QVariant convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const = 0; + virtual QString mimeForFormat(const FORMATETC &formatetc) const = 0; + + static int registerMimeType(const QString &mime); +}; + +class QWindowsMimeConverter +{ + Q_DISABLE_COPY(QWindowsMimeConverter) +public: + QWindowsMimeConverter(); + ~QWindowsMimeConverter(); + + QWindowsMime *converterToMime(const QString &mimeType, IDataObject *pDataObj) const; + QStringList allMimesForFormats(IDataObject *pDataObj) const; + QWindowsMime *converterFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const; + QVector allFormatsForMime(const QMimeData *mimeData) const; + + // Convenience. + QVariant convertToMime(const QStringList &mimeTypes, IDataObject *pDataObj, QVariant::Type preferredType, + QString *format = 0) const; + +private: + typedef QSharedPointer MimePtr; + + void ensureInitialized() const; + + mutable QList m_mimes; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSMIME_H diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp new file mode 100644 index 00000000000..dea965b4391 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -0,0 +1,288 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsmousehandler.h" +#include "qwindowscontext.h" +#include "qwindowswindow.h" +#include "qwindowsintegration.h" + +#include +#include +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +static inline void compressMouseMove(MSG *msg) +{ + // Compress mouse move events + if (msg->message == WM_MOUSEMOVE) { + MSG mouseMsg; + while (PeekMessage(&mouseMsg, msg->hwnd, WM_MOUSEFIRST, + WM_MOUSELAST, PM_NOREMOVE)) { + if (mouseMsg.message == WM_MOUSEMOVE) { +#define PEEKMESSAGE_IS_BROKEN 1 +#ifdef PEEKMESSAGE_IS_BROKEN + // Since the Windows PeekMessage() function doesn't + // correctly return the wParam for WM_MOUSEMOVE events + // if there is a key release event in the queue + // _before_ the mouse event, we have to also consider + // key release events (kls 2003-05-13): + MSG keyMsg; + bool done = false; + while (PeekMessage(&keyMsg, 0, WM_KEYFIRST, WM_KEYLAST, + PM_NOREMOVE)) { + if (keyMsg.time < mouseMsg.time) { + if ((keyMsg.lParam & 0xC0000000) == 0x40000000) { + PeekMessage(&keyMsg, 0, keyMsg.message, + keyMsg.message, PM_REMOVE); + } else { + done = true; + break; + } + } else { + break; // no key event before the WM_MOUSEMOVE event + } + } + if (done) + break; +#else + // Actually the following 'if' should work instead of + // the above key event checking, but apparently + // PeekMessage() is broken :-( + if (mouseMsg.wParam != msg.wParam) + break; // leave the message in the queue because + // the key state has changed +#endif + // Update the passed in MSG structure with the + // most recent one. + msg->lParam = mouseMsg.lParam; + msg->wParam = mouseMsg.wParam; + // Extract the x,y coordinates from the lParam as we do in the WndProc + msg->pt.x = GET_X_LPARAM(mouseMsg.lParam); + msg->pt.y = GET_Y_LPARAM(mouseMsg.lParam); + ClientToScreen(msg->hwnd, &(msg->pt)); + // Remove the mouse move message + PeekMessage(&mouseMsg, msg->hwnd, WM_MOUSEMOVE, + WM_MOUSEMOVE, PM_REMOVE); + } else { + break; // there was no more WM_MOUSEMOVE event + } + } + } +} + +/*! + \class QWindowsMouseHandler + \brief Windows mouse handler + + Dispatches mouse and touch events. Separate for code cleanliness. + + \ingroup qt-lighthouse-win +*/ + +QWindowsMouseHandler::QWindowsMouseHandler() : + m_windowUnderMouse(0) +{ +} + +bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, + QtWindows::WindowsEventType et, + MSG msg, LRESULT *result) +{ + if (et & QtWindows::NonClientEventFlag) + return false; + if (et == QtWindows::MouseWheelEvent) + return translateMouseWheelEvent(window, hwnd, msg, result); + *result = 0; + if (msg.message == WM_MOUSELEAVE) { + // When moving out of a child, MouseMove within parent is received first + // (see below) + if (QWindowsContext::verboseEvents) + qDebug() << "WM_MOUSELEAVE for " << window << " current= " << m_windowUnderMouse; + if (window == m_windowUnderMouse) { + QWindowSystemInterface::handleLeaveEvent(window); + m_windowUnderMouse = 0; + } + return true; + } + compressMouseMove(&msg); + const QPoint client(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); + // Enter new window: track to generate leave event. + if (m_windowUnderMouse != window) { + // The tracking on m_windowUnderMouse might still be active and + // trigger later on. + if (m_windowUnderMouse) { + if (QWindowsContext::verboseEvents) + qDebug() << "Synthetic leave for " << m_windowUnderMouse; + QWindowSystemInterface::handleLeaveEvent(m_windowUnderMouse); + } + m_windowUnderMouse = window; + if (QWindowsContext::verboseEvents) + qDebug() << "Entering " << window; + QWindowsWindow::baseWindowOf(window)->applyCursor(); + QWindowSystemInterface::handleEnterEvent(window); + TRACKMOUSEEVENT tme; + tme.cbSize = sizeof(TRACKMOUSEEVENT); + tme.dwFlags = TME_LEAVE; + tme.hwndTrack = hwnd; + tme.dwHoverTime = HOVER_DEFAULT; // + if (!TrackMouseEvent(&tme)) + qWarning("TrackMouseEvent failed."); + } + QWindowSystemInterface::handleMouseEvent(window, client, + QWindowsGeometryHint::mapToGlobal(hwnd, client), + keyStateToMouseButtons((int)msg.wParam)); + return true; +} + +bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND, + MSG msg, LRESULT *) +{ + const Qt::MouseButtons buttons = keyStateToMouseButtons((int)msg.wParam); + int delta; + if (msg.message == WM_MOUSEWHEEL || msg.message == WM_MOUSEHWHEEL) + delta = (short) HIWORD (msg.wParam); + else + delta = (int) msg.wParam; + + Qt::Orientation orientation = (msg.message == WM_MOUSEHWHEEL + || (buttons & Qt::AltModifier)) ? + Qt::Horizontal : Qt::Vertical; + + // according to the MSDN documentation on WM_MOUSEHWHEEL: + // a positive value indicates that the wheel was rotated to the right; + // a negative value indicates that the wheel was rotated to the left. + // Qt defines this value as the exact opposite, so we have to flip the value! + if (msg.message == WM_MOUSEHWHEEL) + delta = -delta; + + const QPoint globalPos(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); + // TODO: if there is a widget under the mouse and it is not shadowed + // QWindow *receiver = windowAt(pos); + // by modality, we send the event to it first. + //synaptics touchpad shows its own widget at this position + //so widgetAt() will fail with that HWND, try child of this widget + // if (!receiver) receiver = window->childAt(pos); + QWindow *receiver = window; + QWindowSystemInterface::handleWheelEvent(receiver, + QWindowsGeometryHint::mapFromGlobal(receiver, globalPos), + globalPos, + delta, orientation); + return true; +} + +// from bool QApplicationPrivate::translateTouchEvent() +bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, + QtWindows::WindowsEventType, + MSG msg, LRESULT *) +{ + typedef QWindowSystemInterface::TouchPoint QTouchPoint; + typedef QList QTouchPointList; + + const QRect screenGeometry = window->screen()->geometry(); + + const int winTouchPointCount = msg.wParam; + QScopedArrayPointer winTouchInputs(new TOUCHINPUT[winTouchPointCount]); + memset(winTouchInputs.data(), 0, sizeof(TOUCHINPUT) * winTouchPointCount); + + QTouchPointList touchPoints; + touchPoints.reserve(winTouchPointCount); + Qt::TouchPointStates allStates = 0; + + Q_ASSERT(QWindowsContext::user32dll.getTouchInputInfo); + + QWindowsContext::user32dll.getTouchInputInfo((HANDLE) msg.lParam, msg.wParam, winTouchInputs.data(), sizeof(TOUCHINPUT)); + for (int i = 0; i < winTouchPointCount; ++i) { + const TOUCHINPUT &winTouchInput = winTouchInputs[i]; + QTouchPoint touchPoint; + touchPoint.pressure = 1.0; + touchPoint.isPrimary = (winTouchInput.dwFlags & TOUCHEVENTF_PRIMARY) != 0; + touchPoint.id = m_touchInputIDToTouchPointID.value(winTouchInput.dwID, -1); + if (touchPoint.id == -1) { + touchPoint.id = m_touchInputIDToTouchPointID.size(); + m_touchInputIDToTouchPointID.insert(winTouchInput.dwID, touchPoint.id); + } + + QPointF screenPos = QPointF(qreal(winTouchInput.x) / qreal(100.), qreal(winTouchInput.y) / qreal(100.)); + if (winTouchInput.dwMask & TOUCHINPUTMASKF_CONTACTAREA) + touchPoint.area.setSize(QSizeF(qreal(winTouchInput.cxContact) / qreal(100.), + qreal(winTouchInput.cyContact) / qreal(100.))); + touchPoint.area.moveCenter(screenPos); + + if (winTouchInput.dwFlags & TOUCHEVENTF_DOWN) { + touchPoint.state = Qt::TouchPointPressed; + } else if (winTouchInput.dwFlags & TOUCHEVENTF_UP) { + touchPoint.state = Qt::TouchPointReleased; + } else { + // TODO: Previous code checked" + // screenPos == touchPoint.normalPosition -> Qt::TouchPointStationary, but + // but touchPoint.normalPosition was never initialized? + touchPoint.state = touchPoint.state; + } + + touchPoint.normalPosition = QPointF(screenPos.x() / screenGeometry.width(), + screenPos.y() / screenGeometry.height()); + + allStates |= touchPoint.state; + + touchPoints.append(touchPoint); + } + + QWindowsContext::user32dll.closeTouchInputHandle((HANDLE) msg.lParam); + + // all touch points released, forget the ids we've seen, they may not be reused + if ((allStates & Qt::TouchPointStateMask) == Qt::TouchPointReleased) + m_touchInputIDToTouchPointID.clear(); + + // TODO: Device used to be hardcoded to screen in previous code. + // What is the correct event type? Which parts of translateRawTouchEvent() are required? + QWindowSystemInterface::handleTouchEvent(window, QEvent::TouchBegin, + QTouchEvent::TouchScreen, + touchPoints); + return true; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h new file mode 100644 index 00000000000..953649102a2 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSMOUSEHANDLER_H +#define QWINDOWSMOUSEHANDLER_H + +#include "qtwindowsglobal.h" +#include "qtwindows_additional.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +class QWindow; + +class QWindowsMouseHandler +{ + Q_DISABLE_COPY(QWindowsMouseHandler) +public: + QWindowsMouseHandler(); + + bool translateMouseEvent(QWindow *widget, HWND hwnd, + QtWindows::WindowsEventType t, MSG msg, + LRESULT *result); + bool translateTouchEvent(QWindow *widget, HWND hwnd, + QtWindows::WindowsEventType t, MSG msg, + LRESULT *result); + + static inline Qt::MouseButtons keyStateToMouseButtons(int); + static inline int mouseButtonsToKeyState(Qt::MouseButtons); + + QWindow *windowUnderMouse() const { return m_windowUnderMouse.data(); } + +private: + inline bool translateMouseWheelEvent(QWindow *window, HWND hwnd, + MSG msg, LRESULT *result); + + QPointer m_windowUnderMouse; + QHash m_touchInputIDToTouchPointID; +}; + +Qt::MouseButtons QWindowsMouseHandler::keyStateToMouseButtons(int wParam) +{ + Qt::MouseButtons mb(Qt::NoButton); + if (wParam & MK_LBUTTON) + mb |= Qt::LeftButton; + if (wParam & MK_MBUTTON) + mb |= Qt::MiddleButton; + if (wParam & MK_RBUTTON) + mb |= Qt::RightButton; + if (wParam & MK_XBUTTON1) + mb |= Qt::XButton1; + if (wParam & MK_XBUTTON2) + mb |= Qt::XButton2; + return mb; +} + +int QWindowsMouseHandler::mouseButtonsToKeyState(Qt::MouseButtons mb) +{ + int result = 0; + if (mb & Qt::LeftButton) + result |= MK_LBUTTON; + if (mb & Qt::MiddleButton) + result |= MK_MBUTTON; + if (mb & Qt::RightButton) + result |= MK_RBUTTON; + if (mb & Qt::XButton1) + result |= MK_XBUTTON1; + if (mb & Qt::XButton2) + result |= MK_XBUTTON2; + return result; +} + +QT_END_NAMESPACE + +#endif // QWINDOWSMOUSEHANDLER_H diff --git a/src/plugins/platforms/windows/qwindowsnativeimage.cpp b/src/plugins/platforms/windows/qwindowsnativeimage.cpp new file mode 100644 index 00000000000..2ecf334b396 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsnativeimage.cpp @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsnativeimage.h" +#include "qwindowscontext.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +typedef struct { + BITMAPINFOHEADER bmiHeader; + DWORD redMask; + DWORD greenMask; + DWORD blueMask; +} BITMAPINFO_MASK; + +/*! + \class QWindowsNativeImage + \brief Windows Native image + + Note that size can be 0 (widget autotests with zero size), which + causes CreateDIBSection() to fail. + + \sa QWindowsBackingStore + \ingroup qt-lighthouse-win +*/ + +static inline HDC createDC() +{ + HDC display_dc = GetDC(0); + HDC hdc = CreateCompatibleDC(display_dc); + ReleaseDC(0, display_dc); + Q_ASSERT(hdc); + return hdc; +} + +static inline HBITMAP createDIB(HDC hdc, int width, int height, + QImage::Format format, + uchar **bitsIn) +{ + BITMAPINFO_MASK bmi; + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi.bmiHeader.biWidth = width; + bmi.bmiHeader.biHeight = -height; // top-down. + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biSizeImage = 0; + + if (format == QImage::Format_RGB16) { + bmi.bmiHeader.biBitCount = 16; + bmi.bmiHeader.biCompression = BI_BITFIELDS; + bmi.redMask = 0xF800; + bmi.greenMask = 0x07E0; + bmi.blueMask = 0x001F; + } else { + bmi.bmiHeader.biBitCount = 32; + bmi.bmiHeader.biCompression = BI_RGB; + bmi.redMask = 0; + bmi.greenMask = 0; + bmi.blueMask = 0; + } + + void *bits = 0; + HBITMAP bitmap = CreateDIBSection(hdc, reinterpret_cast(&bmi), + DIB_RGB_COLORS, &bits, 0, 0); + if (!bitmap || !bits) + qFatal("%s: CreateDIBSection failed.", __FUNCTION__); + + *bitsIn = (uchar*)bits; + return bitmap; +} + +QWindowsNativeImage::QWindowsNativeImage(int width, int height, + QImage::Format format) : + m_hdc(createDC()), + m_bitmap(0), + m_null_bitmap(0) +{ + if (width != 0 && height != 0) { + uchar *bits; + m_bitmap = createDIB(m_hdc, width, height, format, &bits); + m_null_bitmap = (HBITMAP)SelectObject(m_hdc, m_bitmap); + m_image = QImage(bits, width, height, format); + Q_ASSERT(m_image.paintEngine()->type() == QPaintEngine::Raster); + static_cast(m_image.paintEngine())->setDC(m_hdc); + } else { + m_image = QImage(width, height, format); + } + + GdiFlush(); +} + +QWindowsNativeImage::~QWindowsNativeImage() +{ + if (m_hdc) { + if (m_bitmap) { + if (m_null_bitmap) + SelectObject(m_hdc, m_null_bitmap); + DeleteObject(m_bitmap); + } + DeleteDC(m_hdc); + } +} + +QImage::Format QWindowsNativeImage::systemFormat() +{ + static const int depth = QWindowsContext::instance()->screenDepth(); + return depth == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsnativeimage.h b/src/plugins/platforms/windows/qwindowsnativeimage.h new file mode 100644 index 00000000000..c77805a10ac --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsnativeimage.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSNATIVEIMAGE_H +#define QWINDOWSNATIVEIMAGE_H + +#include "qtwindows_additional.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QWindowsNativeImage +{ + Q_DISABLE_COPY(QWindowsNativeImage) +public: + QWindowsNativeImage(int width, int height, + QImage::Format format); + + ~QWindowsNativeImage(); + + inline int width() const { return m_image.width(); } + inline int height() const { return m_image.height(); } + + QImage &image() { return m_image; } + const QImage &image() const { return m_image; } + + HDC hdc() const { return m_hdc; } + + static QImage::Format systemFormat(); + +private: + const HDC m_hdc; + QImage m_image; + + HBITMAP m_bitmap; + HBITMAP m_null_bitmap; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSNATIVEIMAGE_H diff --git a/src/plugins/platforms/windows/qwindowsole.cpp b/src/plugins/platforms/windows/qwindowsole.cpp new file mode 100644 index 00000000000..864dc3dbb75 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsole.cpp @@ -0,0 +1,476 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsole.h" +#include "qwindowsmime.h" +#include "qwindowscontext.h" +\ +#include +#include +#include +#include +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +/*! + \class QWindowsOleDataObject + \brief OLE data container + + The following methods are NOT supported for data transfer using the + clipboard or drag-drop: + \list + \o IDataObject::SetData -- return E_NOTIMPL + \o IDataObject::DAdvise -- return OLE_E_ADVISENOTSUPPORTED + \o ::DUnadvise + \o ::EnumDAdvise + \o IDataObject::GetCanonicalFormatEtc -- return E_NOTIMPL + (NOTE: must set pformatetcOut->ptd = NULL) + \endlist + + \ingroup qt-lighthouse-win +*/ + +QWindowsOleDataObject::QWindowsOleDataObject(QMimeData *mimeData) : + m_refs(1), data(mimeData), + CF_PERFORMEDDROPEFFECT(RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT)), + performedEffect(DROPEFFECT_NONE) +{ + if (QWindowsContext::verboseOLE) + qDebug("%s '%s'", __FUNCTION__, qPrintable(mimeData->formats().join(QStringLiteral(", ")))); +} + +QWindowsOleDataObject::~QWindowsOleDataObject() +{ + if (QWindowsContext::verboseOLE) + qDebug("%s", __FUNCTION__); +} + +void QWindowsOleDataObject::releaseQt() +{ + data = 0; +} + +QMimeData *QWindowsOleDataObject::mimeData() const +{ + return data.data(); +} + +DWORD QWindowsOleDataObject::reportedPerformedEffect() const +{ + return performedEffect; +} + +//--------------------------------------------------------------------- +// IUnknown Methods +//--------------------------------------------------------------------- + +STDMETHODIMP +QWindowsOleDataObject::QueryInterface(REFIID iid, void FAR* FAR* ppv) +{ + if (iid == IID_IUnknown || iid == IID_IDataObject) { + *ppv = this; + AddRef(); + return NOERROR; + } + *ppv = NULL; + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP_(ULONG) +QWindowsOleDataObject::AddRef(void) +{ + return ++m_refs; +} + +STDMETHODIMP_(ULONG) +QWindowsOleDataObject::Release(void) +{ + if (--m_refs == 0) { + releaseQt(); + delete this; + return 0; + } + return m_refs; +} + +STDMETHODIMP +QWindowsOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium) +{ + HRESULT hr = ResultFromScode(DATA_E_FORMATETC); + + if (QWindowsContext::verboseOLE) { + wchar_t buf[256] = {0}; + GetClipboardFormatName(pformatetc->cfFormat, buf, 255); + qDebug("%s CF = %d : %s", __FUNCTION__, pformatetc->cfFormat, qPrintable(QString::fromWCharArray(buf))); + } + + if (data) { + const QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter(); + if (QWindowsMime *converter = mc.converterFromMime(*pformatetc, data)) + if (converter->convertFromMime(*pformatetc, data, pmedium)) + hr = ResultFromScode(S_OK); + } + + if (QWindowsContext::verboseOLE) { + wchar_t buf[256] = {0}; + GetClipboardFormatName(pformatetc->cfFormat, buf, 255); + qDebug("%s CF = %d : %s returns 0x%x", __FUNCTION__, pformatetc->cfFormat, + qPrintable(QString::fromWCharArray(buf)), int(hr)); + } + + return hr; +} + +STDMETHODIMP +QWindowsOleDataObject::GetDataHere(LPFORMATETC, LPSTGMEDIUM) +{ + return ResultFromScode(DATA_E_FORMATETC); +} + +STDMETHODIMP +QWindowsOleDataObject::QueryGetData(LPFORMATETC pformatetc) +{ + HRESULT hr = ResultFromScode(DATA_E_FORMATETC); + + if (QWindowsContext::verboseOLE > 1) + qDebug("%s", __FUNCTION__); + + if (data) { + const QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter(); + hr = mc.converterFromMime(*pformatetc, data) ? + ResultFromScode(S_OK) : ResultFromScode(S_FALSE); + } + if (QWindowsContext::verboseOLE > 1) + qDebug("%s returns 0x%x", __FUNCTION__, int(hr)); + return hr; +} + +STDMETHODIMP +QWindowsOleDataObject::GetCanonicalFormatEtc(LPFORMATETC, LPFORMATETC pformatetcOut) +{ + pformatetcOut->ptd = NULL; + return ResultFromScode(E_NOTIMPL); +} + +STDMETHODIMP +QWindowsOleDataObject::SetData(LPFORMATETC pFormatetc, STGMEDIUM *pMedium, BOOL fRelease) +{ + if (QWindowsContext::verboseOLE > 1) + qDebug("%s", __FUNCTION__); + + HRESULT hr = ResultFromScode(E_NOTIMPL); + + if (pFormatetc->cfFormat == CF_PERFORMEDDROPEFFECT && pMedium->tymed == TYMED_HGLOBAL) { + DWORD * val = (DWORD*)GlobalLock(pMedium->hGlobal); + performedEffect = *val; + GlobalUnlock(pMedium->hGlobal); + if (fRelease) + ReleaseStgMedium(pMedium); + hr = ResultFromScode(S_OK); + } + if (QWindowsContext::verboseOLE > 1) + qDebug("%s returns 0x%x", __FUNCTION__, int(hr)); + return hr; +} + + +STDMETHODIMP +QWindowsOleDataObject::EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc) +{ + if (QWindowsContext::verboseOLE > 1) + qDebug("%s", __FUNCTION__); + + if (!data) + return ResultFromScode(DATA_E_FORMATETC); + + SCODE sc = S_OK; + + QVector fmtetcs; + if (dwDirection == DATADIR_GET) { + QWindowsMimeConverter &mc = QWindowsContext::instance()->mimeConverter(); + fmtetcs = mc.allFormatsForMime(data); + } else { + FORMATETC formatetc; + formatetc.cfFormat = CF_PERFORMEDDROPEFFECT; + formatetc.dwAspect = DVASPECT_CONTENT; + formatetc.lindex = -1; + formatetc.ptd = NULL; + formatetc.tymed = TYMED_HGLOBAL; + fmtetcs.append(formatetc); + } + + QWindowsOleEnumFmtEtc *enumFmtEtc = new QWindowsOleEnumFmtEtc(fmtetcs); + *ppenumFormatEtc = enumFmtEtc; + if (enumFmtEtc->isNull()) { + delete enumFmtEtc; + *ppenumFormatEtc = NULL; + sc = E_OUTOFMEMORY; + } + + return ResultFromScode(sc); +} + +STDMETHODIMP +QWindowsOleDataObject::DAdvise(FORMATETC FAR*, DWORD, + LPADVISESINK, DWORD FAR*) +{ + return ResultFromScode(OLE_E_ADVISENOTSUPPORTED); +} + + +STDMETHODIMP +QWindowsOleDataObject::DUnadvise(DWORD) +{ + return ResultFromScode(OLE_E_ADVISENOTSUPPORTED); +} + +STDMETHODIMP +QWindowsOleDataObject::EnumDAdvise(LPENUMSTATDATA FAR*) +{ + return ResultFromScode(OLE_E_ADVISENOTSUPPORTED); +} + +/*! + \class QWindowsOleEnumFmtEtc + \brief Enumerates the FORMATETC structures supported by QWindowsOleDataObject. + \ingroup qt-lighthouse-win +*/ + +QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector &fmtetcs) : + m_dwRefs(1), m_nIndex(0), m_isNull(false) +{ + if (QWindowsContext::verboseOLE > 1) + qDebug("%s", __FUNCTION__); + m_lpfmtetcs.reserve(fmtetcs.count()); + for (int idx = 0; idx < fmtetcs.count(); ++idx) { + LPFORMATETC destetc = new FORMATETC(); + if (copyFormatEtc(destetc, (LPFORMATETC)&(fmtetcs.at(idx)))) { + m_lpfmtetcs.append(destetc); + } else { + m_isNull = true; + delete destetc; + break; + } + } +} + +QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector &lpfmtetcs) : + m_dwRefs(1), m_nIndex(0), m_isNull(false) +{ + if (QWindowsContext::verboseOLE > 1) + qDebug("%s", __FUNCTION__); + m_lpfmtetcs.reserve(lpfmtetcs.count()); + for (int idx = 0; idx < lpfmtetcs.count(); ++idx) { + LPFORMATETC srcetc = lpfmtetcs.at(idx); + LPFORMATETC destetc = new FORMATETC(); + if (copyFormatEtc(destetc, srcetc)) { + m_lpfmtetcs.append(destetc); + } else { + m_isNull = true; + delete destetc; + break; + } + } +} + +QWindowsOleEnumFmtEtc::~QWindowsOleEnumFmtEtc() +{ + LPMALLOC pmalloc; + + if (CoGetMalloc(MEMCTX_TASK, &pmalloc) == NOERROR) { + for (int idx = 0; idx < m_lpfmtetcs.count(); ++idx) { + LPFORMATETC tmpetc = m_lpfmtetcs.at(idx); + if (tmpetc->ptd) + pmalloc->Free(tmpetc->ptd); + delete tmpetc; + } + + pmalloc->Release(); + } + m_lpfmtetcs.clear(); +} + +bool QWindowsOleEnumFmtEtc::isNull() const +{ + return m_isNull; +} + +// IUnknown methods +STDMETHODIMP +QWindowsOleEnumFmtEtc::QueryInterface(REFIID riid, void FAR* FAR* ppvObj) +{ + if (riid == IID_IUnknown || riid == IID_IEnumFORMATETC) { + *ppvObj = this; + AddRef(); + return NOERROR; + } + *ppvObj = NULL; + return ResultFromScode(E_NOINTERFACE); +} + +STDMETHODIMP_(ULONG) +QWindowsOleEnumFmtEtc::AddRef(void) +{ + return ++m_dwRefs; +} + +STDMETHODIMP_(ULONG) +QWindowsOleEnumFmtEtc::Release(void) +{ + if (--m_dwRefs == 0) { + delete this; + return 0; + } + return m_dwRefs; +} + +// IEnumFORMATETC methods +STDMETHODIMP +QWindowsOleEnumFmtEtc::Next(ULONG celt, LPFORMATETC rgelt, ULONG FAR* pceltFetched) +{ + ULONG i=0; + ULONG nOffset; + + if (rgelt == NULL) + return ResultFromScode(E_INVALIDARG); + + while (i < celt) { + nOffset = m_nIndex + i; + + if (nOffset < ULONG(m_lpfmtetcs.count())) { + copyFormatEtc((LPFORMATETC)&(rgelt[i]), m_lpfmtetcs.at(nOffset)); + i++; + } else { + break; + } + } + + m_nIndex += (WORD)i; + + if (pceltFetched != NULL) + *pceltFetched = i; + + if (i != celt) + return ResultFromScode(S_FALSE); + + return NOERROR; +} + +STDMETHODIMP +QWindowsOleEnumFmtEtc::Skip(ULONG celt) +{ + ULONG i=0; + ULONG nOffset; + + while (i < celt) { + nOffset = m_nIndex + i; + + if (nOffset < ULONG(m_lpfmtetcs.count())) { + i++; + } else { + break; + } + } + + m_nIndex += (WORD)i; + + if (i != celt) + return ResultFromScode(S_FALSE); + + return NOERROR; +} + +STDMETHODIMP +QWindowsOleEnumFmtEtc::Reset() +{ + m_nIndex = 0; + return NOERROR; +} + +STDMETHODIMP +QWindowsOleEnumFmtEtc::Clone(LPENUMFORMATETC FAR* newEnum) +{ + if (newEnum == NULL) + return ResultFromScode(E_INVALIDARG); + + QWindowsOleEnumFmtEtc *result = new QWindowsOleEnumFmtEtc(m_lpfmtetcs); + result->m_nIndex = m_nIndex; + + if (result->isNull()) { + delete result; + return ResultFromScode(E_OUTOFMEMORY); + } else { + *newEnum = result; + } + + return NOERROR; +} + +bool QWindowsOleEnumFmtEtc::copyFormatEtc(LPFORMATETC dest, LPFORMATETC src) const +{ + if (dest == NULL || src == NULL) + return false; + + *dest = *src; + + if (src->ptd) { + LPVOID pout; + LPMALLOC pmalloc; + + if (CoGetMalloc(MEMCTX_TASK, &pmalloc) != NOERROR) + return false; + + pout = (LPVOID)pmalloc->Alloc(src->ptd->tdSize); + memcpy(dest->ptd, src->ptd, size_t(src->ptd->tdSize)); + + pmalloc->Release(); + } + + return true; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsole.h b/src/plugins/platforms/windows/qwindowsole.h new file mode 100644 index 00000000000..d979af3b310 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsole.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSOLE_H +#define QWINDOWSOLE_H + +#include "qtwindows_additional.h" + +#include +#include +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QMimeData; +class QWindow; + +class QWindowsOleDataObject : public IDataObject +{ +public: + explicit QWindowsOleDataObject(QMimeData *mimeData); + virtual ~QWindowsOleDataObject(); + + void releaseQt(); + QMimeData *mimeData() const; + DWORD reportedPerformedEffect() const; + + // IUnknown methods + STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); + STDMETHOD_(ULONG,AddRef)(void); + STDMETHOD_(ULONG,Release)(void); + + // IDataObject methods + STDMETHOD(GetData)(LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium); + STDMETHOD(GetDataHere)(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium); + STDMETHOD(QueryGetData)(LPFORMATETC pformatetc); + STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC pformatetc, LPFORMATETC pformatetcOut); + STDMETHOD(SetData)(LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium, + BOOL fRelease); + STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc); + STDMETHOD(DAdvise)(FORMATETC FAR* pFormatetc, DWORD advf, + LPADVISESINK pAdvSink, DWORD FAR* pdwConnection); + STDMETHOD(DUnadvise)(DWORD dwConnection); + STDMETHOD(EnumDAdvise)(LPENUMSTATDATA FAR* ppenumAdvise); + +private: + ULONG m_refs; + QPointer data; + int CF_PERFORMEDDROPEFFECT; + DWORD performedEffect; +}; + +class QWindowsOleEnumFmtEtc : public IEnumFORMATETC +{ +public: + explicit QWindowsOleEnumFmtEtc(const QVector &fmtetcs); + explicit QWindowsOleEnumFmtEtc(const QVector &lpfmtetcs); + virtual ~QWindowsOleEnumFmtEtc(); + + bool isNull() const; + + // IUnknown methods + STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppvObj); + STDMETHOD_(ULONG,AddRef)(void); + STDMETHOD_(ULONG,Release)(void); + + // IEnumFORMATETC methods + STDMETHOD(Next)(ULONG celt, LPFORMATETC rgelt, ULONG FAR* pceltFetched); + STDMETHOD(Skip)(ULONG celt); + STDMETHOD(Reset)(void); + STDMETHOD(Clone)(LPENUMFORMATETC FAR* newEnum); + +private: + bool copyFormatEtc(LPFORMATETC dest, LPFORMATETC src) const; + + ULONG m_dwRefs; + ULONG m_nIndex; + QVector m_lpfmtetcs; + bool m_isNull; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSOLE_H diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp new file mode 100644 index 00000000000..3de508a1c74 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -0,0 +1,230 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowsscreen.h" +#include "qwindowscontext.h" +#include "qwindowswindow.h" +#include "pixmaputils.h" +#include "qwindowscursor.h" + +#include "qtwindows_additional.h" + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +typedef QPair DPI; + +QWindowsScreenData::QWindowsScreenData() : + dpi(96, 96), + depth(32), + format(QImage::Format_ARGB32_Premultiplied), primary(false) +{ +} + +static inline DPI deviceDPI(HDC hdc) +{ + return DPI(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY)); +} + +static inline QSize deviceSizeMM(const QSize &pixels, const DPI &dpi) +{ + const qreal inchToMM = 25.4; + const qreal h = qreal(pixels.width()) / qreal(dpi.first) * inchToMM; + const qreal v = qreal(pixels.height()) / qreal(dpi.second) * inchToMM; + return QSize(qRound(h), qRound(v)); +} + +static inline DPI deviceDPI(const QSize &pixels, const QSize &physicalSizeMM) +{ + const qreal inchToMM = 25.4; + const qreal h = qreal(pixels.width()) / (qreal(physicalSizeMM.width()) / inchToMM); + const qreal v = qreal(pixels.height()) / (qreal(physicalSizeMM.height()) / inchToMM); + return DPI(qRound(v), qRound(h)); +} + +typedef QList WindowsScreenDataList; + +// from QDesktopWidget, taking WindowsScreenDataList as LPARAM +BOOL QT_WIN_CALLBACK monitorEnumCallback(HMONITOR hMonitor, HDC, LPRECT, LPARAM p) +{ + MONITORINFOEX info; + memset(&info, 0, sizeof(MONITORINFOEX)); + info.cbSize = sizeof(MONITORINFOEX); + if (GetMonitorInfo(hMonitor, &info) == FALSE) + return TRUE; + + WindowsScreenDataList *result = reinterpret_cast(p); + QWindowsScreenData data; + data.geometry = QRect(QPoint(info.rcMonitor.left, info.rcMonitor.top), QPoint(info.rcMonitor.right - 1, info.rcMonitor.bottom - 1)); + if (HDC hdc = CreateDC(info.szDevice, NULL, NULL, NULL)) { + data.dpi = deviceDPI(hdc); + DeleteDC(hdc); + } else { + qWarning("%s: Unable to obtain handle for monitor '%s', defaulting to %d DPI.", + __FUNCTION__, qPrintable(QString::fromWCharArray(info.szDevice)), + data.dpi.first); + } + data.physicalSizeMM = deviceSizeMM(data.geometry.size(), data.dpi); + data.geometry = QRect(QPoint(info.rcMonitor.left, info.rcMonitor.top), QPoint(info.rcMonitor.right - 1, info.rcMonitor.bottom - 1)); + data.availableGeometry = QRect(QPoint(info.rcWork.left, info.rcWork.top), QPoint(info.rcWork.right - 1, info.rcWork.bottom - 1)); + data.primary = (info.dwFlags & MONITORINFOF_PRIMARY) != 0; + result->append(data); + return TRUE; +} + +/*! + \class QWindowsScreen + \brief Windows screen. + \ingroup qt-lighthouse-win +*/ + +QWindowsScreen::QWindowsScreen(const QWindowsScreenData &data) : + m_data(data), m_cursor(this) +{ +} + +QList QWindowsScreen::screens() +{ + // Retrieve monitors and add static depth information to each. + WindowsScreenDataList data; + EnumDisplayMonitors(0, 0, monitorEnumCallback, (LPARAM)&data); + + const int depth = QWindowsContext::instance()->screenDepth(); + const QImage::Format format = depth == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32; + QList result; + + const WindowsScreenDataList::const_iterator scend = data.constEnd(); + for (WindowsScreenDataList::const_iterator it = data.constBegin(); it != scend; ++it) { + QWindowsScreenData d = *it; + d.depth = depth; + d.format = format; + if (QWindowsContext::verboseIntegration) + qDebug() << "Screen" << d.geometry << d.availableGeometry << d.primary + << " physical " << d.physicalSizeMM << " DPI" << d.dpi + << "Depth: " << d.depth << " Format: " << d.format; + result.append(new QWindowsScreen(d)); + } + return result; +} + +QPixmap QWindowsScreen::grabWindow(WId window, int x, int y, int width, int height) const +{ + if (QWindowsContext::verboseIntegration) + qDebug() << __FUNCTION__ << window << x << y << width << height; + RECT r; + HWND hwnd = (HWND)window; + GetClientRect(hwnd, &r); + + if (width < 0) width = r.right - r.left; + if (height < 0) height = r.bottom - r.top; + + // Create and setup bitmap + HDC display_dc = GetDC(0); + HDC bitmap_dc = CreateCompatibleDC(display_dc); + HBITMAP bitmap = CreateCompatibleBitmap(display_dc, width, height); + HGDIOBJ null_bitmap = SelectObject(bitmap_dc, bitmap); + + // copy data + HDC window_dc = GetDC(hwnd); + BitBlt(bitmap_dc, 0, 0, width, height, window_dc, x, y, SRCCOPY | CAPTUREBLT); + + // clean up all but bitmap + ReleaseDC(hwnd, window_dc); + SelectObject(bitmap_dc, null_bitmap); + DeleteDC(bitmap_dc); + + const QPixmap pixmap = qPixmapFromWinHBITMAP(bitmap, HBitmapNoAlpha); + + DeleteObject(bitmap); + ReleaseDC(0, display_dc); + + return pixmap; +} + +/*! + \brief Find a top level window taking the flags of ChildWindowFromPointEx. +*/ + +QWindow *QWindowsScreen::findTopLevelAt(const QPoint &point, unsigned flags) +{ + QWindow* result = 0; + if (QPlatformWindow *bw = QWindowsContext::instance()-> + findPlatformWindowAt(GetDesktopWindow(), point, flags)) + result = QWindowsWindow::topLevelOf(bw->window()); + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << point << flags << result; + return result; +} + +QWindow *QWindowsScreen::windowAt(const QPoint &screenPoint, unsigned flags) +{ + QWindow* result = 0; + if (QPlatformWindow *bw = QWindowsContext::instance()-> + findPlatformWindowAt(GetDesktopWindow(), screenPoint, flags)) + result = bw->window(); + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << screenPoint << " returns " << result; + return result; +} + +QWindow *QWindowsScreen::windowUnderMouse(unsigned flags) +{ + return QWindowsScreen::windowAt(QWindowsCursor::mousePosition(), flags); +} + +QWindowsScreen *QWindowsScreen::screenOf(const QWindow *w) +{ + if (w) + if (const QScreen *s = w->screen()) + if (QPlatformScreen *pscr = s->handle()) + return static_cast(pscr); + if (const QScreen *ps = QGuiApplication::primaryScreen()) + if (QPlatformScreen *ppscr = ps->handle()) + return static_cast(ppscr); + return 0; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h new file mode 100644 index 00000000000..e24af7af092 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSSCREEN_H +#define QWINDOWSSCREEN_H + +#include "qwindowscursor.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +struct QWindowsScreenData +{ + QWindowsScreenData(); + + QRect geometry; + QRect availableGeometry; + QPair dpi; + QSize physicalSizeMM; + int depth; + QImage::Format format; + bool primary; +}; + +class QWindowsScreen : public QPlatformScreen +{ +public: + explicit QWindowsScreen(const QWindowsScreenData &data); + + static QWindowsScreen *screenOf(const QWindow *w = 0); + + virtual QRect geometry() const { return m_data.geometry; } + virtual QRect availableGeometry() const { return m_data.availableGeometry; } + virtual int depth() const { return m_data.depth; } + virtual QImage::Format format() const { return m_data.format; } + virtual QSize physicalSize() const { return m_data.physicalSizeMM; } + + virtual QWindow *topLevelAt(const QPoint &point) const + { return QWindowsScreen::findTopLevelAt(point, CWP_SKIPINVISIBLE); } + + static QWindow *findTopLevelAt(const QPoint &point, unsigned flags); + static QWindow *windowAt(const QPoint &point, unsigned flags = CWP_SKIPINVISIBLE); + static QWindow *windowUnderMouse(unsigned flags = CWP_SKIPINVISIBLE); + + static QList screens(); + + virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + const QWindowsCursor &cursor() const { return m_cursor; } + QWindowsCursor &cursor() { return m_cursor; } + +private: + const QWindowsScreenData m_data; + QWindowsCursor m_cursor; +}; + +QT_END_NAMESPACE + +#endif // QWINDOWSSCREEN_H diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp new file mode 100644 index 00000000000..8e10ae694a7 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -0,0 +1,1317 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindowswindow.h" +#include "qwindowsnativeimage.h" +#include "qwindowscontext.h" +#include "qwindowsdrag.h" +#include "qwindowsscreen.h" +#include "qwindowscursor.h" + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +static QByteArray debugWinStyle(DWORD style) +{ + + QByteArray rc = "0x"; + rc += QByteArray::number(qulonglong(style), 16); + if (style & WS_POPUP) + rc += " WS_POPUP"; + if (style & WS_CHILD) + rc += " WS_CHILD"; + if (style & WS_OVERLAPPED) + rc += " WS_OVERLAPPED"; + if (style & WS_CLIPSIBLINGS) + rc += " WS_CLIPSIBLINGS"; + if (style & WS_CLIPCHILDREN) + rc += " WS_CLIPCHILDREN"; + if (style & WS_THICKFRAME) + rc += " WS_THICKFRAME"; + if (style & WS_DLGFRAME) + rc += " WS_DLGFRAME"; + if (style & WS_SYSMENU) + rc += " WS_SYSMENU"; + if (style & WS_MINIMIZEBOX) + rc += " WS_MINIMIZEBOX"; + if (style & WS_MAXIMIZEBOX) + rc += " WS_MAXIMIZEBOX"; + return rc; +} + +static QByteArray debugWindowStates(Qt::WindowStates s) +{ + + QByteArray rc = "0x"; + rc += QByteArray::number(int(s), 16); + if (s & Qt::WindowMinimized) + rc += " WindowMinimized"; + if (s & Qt::WindowMaximized) + rc += " WindowMaximized"; + if (s & Qt::WindowFullScreen) + rc += " WindowFullScreen"; + if (s & Qt::WindowActive) + rc += " WindowActive"; + return rc; +} + +QDebug operator<<(QDebug d, const MINMAXINFO &i) +{ + d.nospace() << "MINMAXINFO maxSize=" << i.ptMaxSize.x << ',' + << i.ptMaxSize.y << " maxpos=" << i.ptMaxPosition.x + << ',' << i.ptMaxPosition.y << " mintrack=" + << i.ptMinTrackSize.x << ',' << i.ptMinTrackSize.y + << " maxtrack=" << i.ptMaxTrackSize.x << ',' + << i.ptMaxTrackSize.y; + return d; +} + +static inline QSize qSizeOfRect(const RECT &rect) +{ + return QSize(rect.right -rect.left, rect.bottom - rect.top); +} + +static inline QRect qrectFromRECT(const RECT &rect) +{ + return QRect(QPoint(rect.left, rect.top), qSizeOfRect(rect)); +} + +QDebug operator<<(QDebug d, const RECT &r) +{ + d.nospace() << "RECT: left/top=" << r.left << ',' << r.top + << " right/bottom=" << r.right << ',' << r.bottom; + return d; +} + +QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p) +{ + qDebug().nospace() << "NCCALCSIZE_PARAMS " + << qrectFromRECT(p.rgrc[0]) + << ' ' << qrectFromRECT(p.rgrc[1]) << ' ' + << qrectFromRECT(p.rgrc[2]); + return d; +} + +static inline QRect frameGeometry(HWND hwnd) +{ + RECT rect = { 0, 0, 0, 0 }; + GetWindowRect(hwnd, &rect); + return qrectFromRECT(rect); +} + +QSize clientSize(HWND hwnd) +{ + RECT rect = { 0, 0, 0, 0 }; + GetClientRect(hwnd, &rect); // Always returns point 0,0, thus unusable for geometry. + return qSizeOfRect(rect); +} + +// from qwidget_win.cpp/maximum layout size check removed. +static bool shouldShowMaximizeButton(Qt::WindowFlags flags) +{ + if (flags & Qt::MSWindowsFixedSizeDialogHint) + return false; + // if the user explicitly asked for the maximize button, we try to add + // it even if the window has fixed size. + if (flags & Qt::CustomizeWindowHint && + flags & Qt::WindowMaximizeButtonHint) + return true; + return flags & Qt::WindowMaximizeButtonHint; +} + +/*! + \class WindowCreationData + \brief Window creation code. + + This struct gathers all information required to create a window. + Window creation is split in 3 steps: + + \list + \o fromWindow() Gather all required information + \o create() Create the system handle. + \o initialize() Post creation initialization steps. + \endlist + + The reason for this split is to also enable changing the QWindowFlags + by calling: + + \list + \o fromWindow() Gather information and determine new system styles + \o applyWindowFlags() to apply the new window system styles. + \o initialize() Post creation initialization steps. + \endlist + + Contains the window creation code formerly in qwidget_win.cpp. + + \sa QWindowCreationContext + \ingroup qt-lighthouse-win +*/ + +struct WindowCreationData +{ + typedef QWindowsWindow::WindowData WindowData; + + WindowCreationData() : parentHandle(0), type(Qt::Widget), style(0), exStyle(0), + topLevel(false), popup(false), dialog(false), desktop(false), + tool(false) {} + + void fromWindow(const QWindow *w, const Qt::WindowFlags flags, bool isGL); + inline WindowData create(const QWindow *w, const QRect &geometry, QString title) const; + inline void applyWindowFlags(HWND hwnd) const; + void initialize(HWND h, bool frameChange) const; + + Qt::WindowFlags flags; + HWND parentHandle; + Qt::WindowType type; + unsigned style; + unsigned exStyle; + bool isGL; + bool topLevel; + bool popup; + bool dialog; + bool desktop; + bool tool; +}; + +QDebug operator<<(QDebug debug, const WindowCreationData &d) +{ + debug.nospace() << QWindowsWindow::debugWindowFlags(d.flags) + << " gs=" << d.isGL << " topLevel=" << d.topLevel << " popup=" + << d.popup << " dialog=" << d.dialog << " desktop=" << d.desktop + << " tool=" << d.tool << " style=" << debugWinStyle(d.style) + << " exStyle=0x" << QString::number(d.exStyle, 16) + << " parent=" << d.parentHandle; + return debug; +} + +void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flagsIn, + bool isGLin) +{ + isGL = isGLin; + flags = flagsIn; + topLevel = w->isTopLevel(); + + if (topLevel && flags == 1) { + qWarning("Remove me: fixing toplevel window flags"); + flags |= Qt::WindowTitleHint|Qt::WindowSystemMenuHint|Qt::WindowMinimizeButtonHint + |Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint; + } + + type = static_cast(int(flags) & Qt::WindowType_Mask); + switch (type) { + case Qt::Dialog: + case Qt::Sheet: + dialog = true; + break; + case Qt::Drawer: + case Qt::Tool: + tool = true; + break; + case Qt::Popup: + popup = true; + break; + case Qt::Desktop: + desktop = true; + break; + default: + break; + } + if ((flags & Qt::MSWindowsFixedSizeDialogHint)) + dialog = true; + + // Parent: Use transient parent for top levels. + if (popup) { + flags |= Qt::WindowStaysOnTopHint; // a popup stays on top, no parent. + } else { + if (const QWindow *parentWindow = topLevel ? w->transientParent() : w->parent()) + parentHandle = QWindowsWindow::handleOf(parentWindow); + } + + if (popup || (type == Qt::ToolTip) || (type == Qt::SplashScreen)) { + style = WS_POPUP; + } else if (topLevel && !desktop) { + if (flags & Qt::FramelessWindowHint) + style = WS_POPUP; // no border + else if (flags & Qt::WindowTitleHint) + style = WS_OVERLAPPED; + else + style = 0; + } else { + style = WS_CHILD; + } + + if (!desktop) { + // if (!testAttribute(Qt::WA_PaintUnclipped)) + // ### Commented out for now as it causes some problems, but + // this should be correct anyway, so dig some more into this +#ifdef Q_FLATTEN_EXPOSE + if (isGL) + style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN; // see SetPixelFormat +#else + style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN ; +#endif + if (topLevel) { + if ((type == Qt::Window || dialog || tool)) { + if (!(flags & Qt::FramelessWindowHint)) { + style |= WS_POPUP; + if (flags & Qt::MSWindowsFixedSizeDialogHint) { + style |= WS_DLGFRAME; + } else { + style |= WS_THICKFRAME; + } + } + if (flags & Qt::WindowTitleHint) + style |= WS_CAPTION; + if (flags & Qt::WindowSystemMenuHint) + style |= WS_SYSMENU; + if (flags & Qt::WindowMinimizeButtonHint) + style |= WS_MINIMIZEBOX; + if (shouldShowMaximizeButton(flags)) + style |= WS_MAXIMIZEBOX; + if (tool) + exStyle |= WS_EX_TOOLWINDOW; + if (flags & Qt::WindowContextHelpButtonHint) + exStyle |= WS_EX_CONTEXTHELP; + } else { + exStyle |= WS_EX_TOOLWINDOW; + } + } + } +} + +QWindowsWindow::WindowData + WindowCreationData::create(const QWindow *w, const QRect &geometry, QString title) const +{ + typedef QSharedPointer QWindowCreationContextPtr; + + WindowData result; + result.flags = flags; + + if (desktop) { // desktop widget. No frame, hopefully? + result.hwnd = GetDesktopWindow(); + result.geometry = frameGeometry(result.hwnd); + if (QWindowsContext::verboseWindows) + qDebug().nospace() << "Created desktop window " << w << result.hwnd; + return result; + } + + const HINSTANCE appinst = (HINSTANCE)GetModuleHandle(0); + + const QString windowClassName = QWindowsContext::instance()->registerWindowClass(w, isGL); + + if (title.isEmpty() && (result.flags & Qt::WindowTitleHint)) + title = topLevel ? qAppName() : w->objectName(); + + const wchar_t *titleUtf16 = reinterpret_cast(title.utf16()); + const wchar_t *classNameUtf16 = reinterpret_cast(windowClassName.utf16()); + + // Capture events before CreateWindowEx() returns. + const QWindowCreationContextPtr context(new QWindowCreationContext(w, geometry, style, exStyle)); + QWindowsContext::instance()->setWindowCreationContext(context); + + if (QWindowsContext::verboseWindows) + qDebug().nospace() + << "CreateWindowEx: " << w << *this + << " class=" <frameWidth << 'x' << context->frameHeight + << '+' << context->frameX << '+' << context->frameY; + + result.hwnd = CreateWindowEx(exStyle, classNameUtf16, titleUtf16, + style, + context->frameX, context->frameY, + context->frameWidth, context->frameHeight, + parentHandle, NULL, appinst, NULL); + QWindowsContext::instance()->setWindowCreationContext(QWindowCreationContextPtr()); + if (QWindowsContext::verboseWindows) + qDebug().nospace() + << "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: " + << context->obtainedGeometry << context->margins; + + if (!result.hwnd) { + qErrnoWarning("%s: CreateWindowEx failed", __FUNCTION__); + return result; + } + + result.geometry = context->obtainedGeometry; + result.frame = context->margins; + return result; +} + +void WindowCreationData::applyWindowFlags(HWND hwnd) const +{ + // Keep enabled and visible from the current style. + const LONG_PTR oldStyle = GetWindowLongPtr(hwnd, GWL_STYLE); + const LONG_PTR oldExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE); + + const LONG_PTR newStyle = style | (oldStyle & (WS_DISABLED|WS_VISIBLE)); + if (oldStyle != newStyle) + SetWindowLongPtr(hwnd, GWL_STYLE, newStyle); + const LONG_PTR newExStyle = exStyle; + if (newExStyle != oldExStyle) + SetWindowLongPtr(hwnd, GWL_EXSTYLE, newExStyle); + if (QWindowsContext::verboseWindows) + qDebug().nospace() << __FUNCTION__ << hwnd << *this + << "\n Style from " << debugWinStyle(oldStyle) << "\n to " + << debugWinStyle(newStyle) << "\n ExStyle from 0x" + << QByteArray::number(qulonglong(oldExStyle), 16) << " to 0x" + << QByteArray::number(qulonglong(newExStyle), 16); +} + +void WindowCreationData::initialize(HWND hwnd, bool frameChange) const +{ + if (desktop || !hwnd) + return; + UINT flags = SWP_NOMOVE | SWP_NOSIZE; + if (frameChange) + flags |= SWP_FRAMECHANGED; + if (topLevel) { + flags |= SWP_NOACTIVATE; + if ((flags & Qt::WindowStaysOnTopHint) || (type == Qt::ToolTip)) { + SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, flags); + if (flags & Qt::WindowStaysOnBottomHint) + qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; + } else if (flags & Qt::WindowStaysOnBottomHint) { + SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, flags); + } + if (flags & (Qt::CustomizeWindowHint|Qt::WindowTitleHint)) { + HMENU systemMenu = GetSystemMenu(hwnd, FALSE); + if (flags & Qt::WindowCloseButtonHint) + EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_ENABLED); + else + EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED); + } + } else { // child. + SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, flags); + } +} + +/*! + \class QWindowsGeometryHint + \brief Stores geometry constraints and provides utility functions. + + Geometry constraints ready to apply to a MINMAXINFO taking frame + into account. + + \ingroup qt-lighthouse-win +*/ + +#define QWINDOWSIZE_MAX ((1<<24)-1) + +QWindowsGeometryHint::QWindowsGeometryHint(const QWindow *w) : + minimumSize(w->minimumSize()), + maximumSize(w->maximumSize()) +{ +} + +bool QWindowsGeometryHint::validSize(const QSize &s) const +{ + const int width = s.width(); + const int height = s.height(); + return width >= minimumSize.width() && width <= maximumSize.width() + && height >= minimumSize.height() && height <= maximumSize.height(); +} + +QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle) +{ + RECT rect = {0,0,0,0}; + style &= ~(WS_OVERLAPPED); // Not permitted, see docs. + if (!AdjustWindowRectEx(&rect, style, FALSE, exStyle)) + qErrnoWarning("%s: AdjustWindowRectEx failed", __FUNCTION__); + const QMargins result(qAbs(rect.left), qAbs(rect.top), + qAbs(rect.right), qAbs(rect.bottom)); + if (QWindowsContext::verboseWindows) + qDebug().nospace() << __FUNCTION__ << " style= 0x" + << QString::number(style, 16) + << " exStyle=0x" << QString::number(exStyle, 16) << ' ' << rect << ' ' << result; + + return result; +} + +void QWindowsGeometryHint::applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const +{ + return applyToMinMaxInfo(GetWindowLong(hwnd, GWL_STYLE), + GetWindowLong(hwnd, GWL_EXSTYLE), mmi); +} + +void QWindowsGeometryHint::applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXINFO *mmi) const +{ + if (QWindowsContext::verboseWindows) + qDebug().nospace() << '>' << __FUNCTION__ << '<' << " min=" + << minimumSize.width() << ',' << minimumSize.height() + << " max=" << maximumSize.width() << ',' << maximumSize.height() + << " in " << *mmi; + + const QMargins margins = QWindowsGeometryHint::frame(style, exStyle); + const int frameWidth = margins.left() + margins.right(); + const int frameHeight = margins.top() + margins.bottom(); + if (minimumSize.width() > 0) + mmi->ptMinTrackSize.x = minimumSize.width() + frameWidth; + if (minimumSize.height() > 0) + mmi->ptMinTrackSize.y = minimumSize.height() + frameHeight; + + const int maximumWidth = qMax(maximumSize.width(), minimumSize.width()); + const int maximumHeight = qMax(maximumSize.height(), minimumSize.height()); + if (maximumWidth < QWINDOWSIZE_MAX) + mmi->ptMaxTrackSize.x = maximumWidth + frameWidth; + // windows with title bar have an implicit size limit of 112 pixels + if (maximumHeight < QWINDOWSIZE_MAX) + mmi->ptMaxTrackSize.y = qMax(maximumHeight + frameHeight, 112); + if (QWindowsContext::verboseWindows) + qDebug().nospace() << '<' << __FUNCTION__ + << " frame=" << margins << ' ' << frameWidth << ',' << frameHeight + << " out " << *mmi; +} + +/*! + \class QWindowCreationContext + \brief Active Context for creating windows. + + There is a phase in window creation (WindowCreationData::create()) + in which events are sent before the system API CreateWindowEx() returns + the handle. These cannot be handled by the platform window as the association + of the unknown handle value to the window does not exist yet and as not + to trigger recursive handle creation, etc. + + In that phase, an instance of QWindowCreationContext is set on + QWindowsContext. + + QWindowCreationContext stores the information to answer the initial + WM_GETMINMAXINFO and obtains the corrected size/position. + + \sa WindowCreationData, QWindowsContext + \ingroup qt-lighthouse-win +*/ + +QWindowCreationContext::QWindowCreationContext(const QWindow *w, + const QRect &geometry, + DWORD style_, DWORD exStyle_) : + geometryHint(w), style(style_), exStyle(exStyle_), + requestedGeometry(geometry), obtainedGeometry(geometry), + margins(QWindowsGeometryHint::frame(style, exStyle)), + frameX(CW_USEDEFAULT), frameY(CW_USEDEFAULT), + frameWidth(CW_USEDEFAULT), frameHeight(CW_USEDEFAULT) +{ + // Geometry of toplevels does not consider window frames. + // TODO: No concept of WA_wasMoved yet that would indicate a + // CW_USEDEFAULT unless set. For now, assume that 0,0 means 'default' + // for toplevels. + if (geometry.isValid()) { + if (!w->isTopLevel() || geometry.y() >= margins.top()) { + frameX = geometry.x() - margins.left(); + frameY = geometry.y() - margins.top(); + } + frameWidth = geometry.width() + margins.left() + margins.right(); + frameHeight = geometry.height() + margins.top() + margins.bottom(); + } + if (QWindowsContext::verboseWindows) + qDebug().nospace() + << __FUNCTION__ << ' ' << w << " min" << geometryHint.minimumSize + << " min" << geometryHint.maximumSize; +} + +/*! + \class QWindowsBaseWindow + \brief Raster or OpenGL Window. + + \list + \o Raster type: handleWmPaint() is implemented to + to bitblt the image. The DC can be accessed + via getDC/Relase DC, which has a special handling + when within a paint event (in that case, the DC obtained + from BeginPaint() is returned). + + \o Open GL: The first time QWindowsGLContext accesses + the handle, it sets up the pixelformat on the DC + which in turn sets it on the window (see flag + PixelFormatInitialized). + handleWmPaint() is empty (although required). + \endlist + + \ingroup qt-lighthouse-win +*/ + +QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : + QPlatformWindow(aWindow), + m_data(data), + m_flags(0), + m_hdc(0), + m_windowState(aWindow->windowState()), + m_opacity(1.0), + m_mouseGrab(false), + m_cursor(QWindowsScreen::screenOf(aWindow)->cursor().standardWindowCursor()), + m_dropTarget(0) +{ + if (aWindow->surfaceType() == QWindow::OpenGLSurface) + setFlag(OpenGL_Surface); + QWindowsContext::instance()->addWindow(m_data.hwnd, this); + if (aWindow->isTopLevel()) { + switch (aWindow->windowType()) { + case Qt::Window: + case Qt::Dialog: + case Qt::Sheet: + case Qt::Drawer: + case Qt::Popup: + case Qt::Tool: + registerDropSite(); + break; + default: + break; + } + } +} + +QWindowsWindow::~QWindowsWindow() +{ + destroyWindow(); +} + +void QWindowsWindow::destroyWindow() +{ + if (QWindowsContext::verboseIntegration || QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << this << window() << m_data.hwnd; + if (m_data.hwnd) { + unregisterDropSite(); + if (m_data.hwnd != GetDesktopWindow()) + DestroyWindow(m_data.hwnd); + QWindowsContext::instance()->removeWindow(m_data.hwnd); + m_data.hwnd = 0; + } +} + +void QWindowsWindow::registerDropSite() +{ + if (m_data.hwnd && !m_dropTarget) { + m_dropTarget = new QWindowsOleDropTarget(window()); + RegisterDragDrop(m_data.hwnd, m_dropTarget); + CoLockObjectExternal(m_dropTarget, true, true); + } +} + +void QWindowsWindow::unregisterDropSite() +{ + if (m_data.hwnd && m_dropTarget) { + m_dropTarget->Release(); + CoLockObjectExternal(m_dropTarget, false, true); + RevokeDragDrop(m_data.hwnd); + m_dropTarget = 0; + } +} + +QWindow *QWindowsWindow::topLevelOf(QWindow *w) +{ + while (QWindow *parent = w->parent()) + w = parent; + return w; +} + +QWindowsWindow::WindowData + QWindowsWindow::WindowData::create(const QWindow *w, + const WindowData ¶meters, + const QString &title, + bool isGL) +{ + WindowCreationData creationData; + creationData.fromWindow(w, parameters.flags, isGL); + WindowData result = creationData.create(w, parameters.geometry, title); + creationData.initialize(result.hwnd, false); + return result; +} + +void QWindowsWindow::setVisible(bool visible) +{ + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << this << window() << m_data.hwnd << visible; + if (m_data.hwnd) { + if (visible) { + show_sys(); + } else { + hide_sys(); + } + } +} + +bool QWindowsWindow::isVisible() const +{ + return m_data.hwnd && IsWindowVisible(m_data.hwnd); +} + +// partially from QWidgetPrivate::show_sys() +void QWindowsWindow::show_sys() const +{ + int sm = SW_SHOWNORMAL; + bool fakedMaximize = false; + const QWindow *w = window(); + const Qt::WindowFlags flags = w->windowFlags(); + const Qt::WindowType type = w->windowType(); + if (w->isTopLevel()) { + const Qt::WindowState state = w->windowState(); + if (state & Qt::WindowMinimized) { + sm = SW_SHOWMINIMIZED; + if (!isVisible()) + sm = SW_SHOWMINNOACTIVE; + } else if (state & Qt::WindowMaximized) { + sm = SW_SHOWMAXIMIZED; + // Windows will not behave correctly when we try to maximize a window which does not + // have minimize nor maximize buttons in the window frame. Windows would then ignore + // non-available geometry, and rather maximize the widget to the full screen, minus the + // window frame (caption). So, we do a trick here, by adding a maximize button before + // maximizing the widget, and then remove the maximize button afterwards. + if (flags & Qt::WindowTitleHint && + !(flags & (Qt::WindowMinMaxButtonsHint | Qt::FramelessWindowHint))) { + fakedMaximize = TRUE; + setStyle(style() | WS_MAXIMIZEBOX); + } + } + } + if (type == Qt::Popup || type == Qt::ToolTip || type == Qt::Tool) + sm = SW_SHOWNOACTIVATE; + + ShowWindow(m_data.hwnd, sm); + + if (fakedMaximize) { + setStyle(style() & ~WS_MAXIMIZEBOX); + SetWindowPos(m_data.hwnd, 0, 0, 0, 0, 0, + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER + | SWP_FRAMECHANGED); + } +} + +// partially from QWidgetPrivate::hide_sys() +void QWindowsWindow::hide_sys() const +{ + const Qt::WindowFlags flags = window()->windowFlags(); + if (flags != Qt::Desktop) { + if (flags & Qt::Popup) + ShowWindow(m_data.hwnd, SW_HIDE); + else + SetWindowPos(m_data.hwnd,0, 0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER); + } +} + +void QWindowsWindow::setParent(const QPlatformWindow *newParent) +{ + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << window() << newParent; + + if (newParent != parent() && m_data.hwnd) + setParent_sys(newParent); +} + +void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) const +{ + HWND parentHWND = 0; + if (parent) { + const QWindowsWindow *parentW = static_cast(parent); + parentHWND = parentW->handle(); + } + SetParent(m_data.hwnd, parentHWND); +} + +void QWindowsWindow::handleShown() +{ + QWindowSystemInterface::handleMapEvent(window()); +} + +void QWindowsWindow::handleHidden() +{ + QWindowSystemInterface::handleUnmapEvent(window()); +} + +void QWindowsWindow::setGeometry(const QRect &rect) +{ + const QSize oldSize = m_data.geometry.size(); + m_data.geometry = rect; + const QSize newSize = rect.size(); + // Check on hint. + if (newSize != oldSize) { + const QWindowsGeometryHint hint(window()); + if (!hint.validSize(newSize)) { + qWarning("%s: Attempt to set a size (%dx%d) violating the constraints" + "(%dx%d - %dx%d) on window '%s'.", __FUNCTION__, + newSize.width(), newSize.height(), + hint.minimumSize.width(), hint.minimumSize.height(), + hint.maximumSize.width(), hint.maximumSize.height(), + qPrintable(window()->objectName())); + } + } + if (m_data.hwnd) { + // A ResizeEvent with resulting geometry will be sent. If we cannot + // achieve that size (for example, window title minimal constraint), + // notify and warn. + setGeometry_sys(rect); + if (m_data.geometry != rect) { + qWarning("%s: Unable to set geometry %dx%d+%d+%d on '%s'." + " Resulting geometry: %dx%d+%d+%d.", + __FUNCTION__, + rect.width(), rect.height(), rect.x(), rect.y(), + qPrintable(window()->objectName()), + m_data.geometry.width(), m_data.geometry.height(), + m_data.geometry.x(), m_data.geometry.y()); + } + } else { + QPlatformWindow::setGeometry(rect); + } +} + +void QWindowsWindow::handleMoved() +{ + if (!IsIconic(m_data.hwnd)) // Minimize can send nonsensical move events. + handleGeometryChange(); +} + +void QWindowsWindow::handleResized(int wParam) +{ + switch (wParam) { + case SIZE_MAXHIDE: // Some other window affected. + case SIZE_MAXSHOW: + return; + case SIZE_MINIMIZED: + handleWindowStateChange(Qt::WindowMinimized); + return; + case SIZE_MAXIMIZED: + handleWindowStateChange(Qt::WindowMaximized); + handleGeometryChange(); + break; + case SIZE_RESTORED: + if (m_windowState != Qt::WindowNoState) + handleWindowStateChange(Qt::WindowNoState); + handleGeometryChange(); + break; + } +} + +void QWindowsWindow::handleGeometryChange() +{ + m_data.geometry = geometry_sys(); + QPlatformWindow::setGeometry(m_data.geometry); + QWindowSystemInterface::handleGeometryChange(window(), m_data.geometry); + + if (QWindowsContext::verboseEvents || QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << this << window() << m_data.geometry; +} + +void QWindowsWindow::setGeometry_sys(const QRect &rect) const +{ + const QRect frameGeometry = rect + frameMargins(); + + if (QWindowsContext::verboseWindows) + qDebug() << '>' << __FUNCTION__ << this << window() + << " \n from " << geometry_sys() << " to " <' << __FUNCTION__ << this << window() << "\n from: " + << QWindowsWindow::debugWindowFlags(m_data.flags) + << "\n to: " << QWindowsWindow::debugWindowFlags(flags); + if (m_data.flags != flags) { + m_data.flags = flags; + if (m_data.hwnd) + m_data = setWindowFlags_sys(flags); + } + if (QWindowsContext::verboseWindows) + qDebug() << '<' << __FUNCTION__ << "\n returns: " + << QWindowsWindow::debugWindowFlags(m_data.flags); + return m_data.flags; +} + +QWindowsWindow::WindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt) const +{ + // Geometry changes have not been observed here. Frames change, though. + WindowCreationData creationData; + creationData.fromWindow(window(), wt, window()->surfaceType() == QWindow::OpenGLSurface); + creationData.applyWindowFlags(m_data.hwnd); + creationData.initialize(m_data.hwnd, true); + WindowData result = m_data; + result.flags = creationData.flags; + setFlag(FrameDirty); + return result; +} + +void QWindowsWindow::handleWindowStateChange(Qt::WindowState state) +{ + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << this << window() + << "\n from " << debugWindowStates(m_windowState) + << " to " << debugWindowStates(state); + setFlag(FrameDirty); + m_windowState = state; + QWindowSystemInterface::handleWindowStateChanged(window(), state); +} + +Qt::WindowState QWindowsWindow::setWindowState(Qt::WindowState state) +{ + if (m_data.hwnd) { + setWindowState_sys(state); + m_windowState = state; + } + return state; +} + +Qt::WindowState QWindowsWindow::windowState_sys() const +{ + if (IsIconic(m_data.hwnd)) + return Qt::WindowMinimized; + if (IsZoomed(m_data.hwnd)) + return Qt::WindowMaximized; + if (geometry_sys() == window()->screen()->geometry()) + return Qt::WindowFullScreen; + return Qt::WindowNoState; +} + +Qt::WindowStates QWindowsWindow::windowStates_sys() const +{ + Qt::WindowStates result = windowState_sys(); + if (GetActiveWindow() == m_data.hwnd) + result |= Qt::WindowActive; + return result; +} + +/*! + \brief Change the window state. + + \note Window frames change when maximized; + the top margin shrinks somewhat but that cannot be obtained using + AdjustWindowRectEx(). + + \note Some calls to SetWindowLong require a subsequent call + to ShowWindow. +*/ + +void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) +{ + const Qt::WindowStates oldStates = windowStates_sys(); + // Maintain the active flag as the platform window API does not + // use it. + Qt::WindowStates newStates = newState; + if (oldStates & Qt::WindowActive) + newStates |= Qt::WindowActive; + if (oldStates == newStates) + return; + if (QWindowsContext::verboseWindows) + qDebug() << '>' << __FUNCTION__ << this << window() + << " from " << debugWindowStates(oldStates) + << " to " << debugWindowStates(newStates); + + const bool isActive = newStates & Qt::WindowActive; + const int max = isActive ? SW_SHOWMAXIMIZED : SW_MAXIMIZE; + const int normal = isActive ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE; + const int min = isActive ? SW_SHOWMINIMIZED : SW_MINIMIZE; + const bool visible = isVisible(); + + setFlag(FrameDirty); + + if ((oldStates & Qt::WindowMaximized) != (newStates & Qt::WindowMaximized)) { + if (visible && !(newStates & Qt::WindowMinimized)) + ShowWindow(m_data.hwnd, (newStates & Qt::WindowMaximized) ? max : normal); + } + + if ((oldStates & Qt::WindowFullScreen) != (newStates & Qt::WindowFullScreen)) { + if (newStates & Qt::WindowFullScreen) { +#ifndef Q_FLATTEN_EXPOSE + UINT newStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP; +#else + UINT newStyle = WS_POPUP; +#endif + if (style() & WS_SYSMENU) + newStyle |= WS_SYSMENU; + if (visible) + newStyle |= WS_VISIBLE; + setStyle(newStyle); + + const QRect r = window()->screen()->geometry(); + UINT swpf = SWP_FRAMECHANGED; + if (newStates & Qt::WindowActive) + swpf |= SWP_NOACTIVATE; + + SetWindowPos(m_data.hwnd, HWND_TOP, r.left(), r.top(), r.width(), r.height(), swpf); + } else { + if (visible) + setStyle(style() | WS_VISIBLE); + UINT swpf = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE; + if (newStates & Qt::WindowActive) + swpf |= SWP_NOACTIVATE; + SetWindowPos(m_data.hwnd, 0, 0, 0, 0, 0, swpf); + + // preserve maximized state + if (visible) + ShowWindow(m_data.hwnd, (newStates & Qt::WindowMaximized) ? max : normal); + } + } + + if ((oldStates & Qt::WindowMinimized) != (newStates & Qt::WindowMinimized)) { + if (visible) + ShowWindow(m_data.hwnd, (newStates & Qt::WindowMinimized) ? min : + (newStates & Qt::WindowMaximized) ? max : normal); + } + if (QWindowsContext::verboseWindows) + qDebug() << '<' << __FUNCTION__ << this << window() + << debugWindowStates(newStates); +} + +void QWindowsWindow::setStyle(unsigned s) const +{ + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << this << window() << debugWinStyle(s); + setFlag(FrameDirty); + SetWindowLongPtr(m_data.hwnd, GWL_STYLE, s); +} + +void QWindowsWindow::setExStyle(unsigned s) const +{ + if (QWindowsContext::verboseWindows) + qDebug().nospace() << __FUNCTION__ << ' ' << this << ' ' << window() + << " 0x" << QByteArray::number(s, 16); + setFlag(FrameDirty); + SetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE, s); +} + +void QWindowsWindow::raise() +{ + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << this << window(); + SetWindowPos(m_data.hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); +} + +void QWindowsWindow::lower() +{ + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << this << window(); + if (m_data.hwnd) + SetWindowPos(m_data.hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); +} + +void QWindowsWindow::propagateSizeHints() +{ + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << this << window(); +} + +QMargins QWindowsWindow::frameMargins() const +{ + // Frames are invalidated by style changes (window state, flags). + // As they are also required for geometry calculations in resize + // event sequences, introduce a dirty flag mechanism to be able + // to cache results. + if (testFlag(FrameDirty)) { + m_data.frame = QWindowsGeometryHint::frame(style(), exStyle()); + clearFlag(FrameDirty); + } + return m_data.frame; +} + +void QWindowsWindow::setOpacity(qreal level) +{ + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << level; + if (m_opacity != level) { + m_opacity = level; + if (m_data.hwnd) + setOpacity_sys(level); + } +} + +void QWindowsWindow::setOpacity_sys(qreal level) const +{ + const long wl = GetWindowLong(m_data.hwnd, GWL_EXSTYLE); + const bool isOpaque = level == 1.0; + + if (isOpaque) { + if (wl & WS_EX_LAYERED) + SetWindowLong(m_data.hwnd, GWL_EXSTYLE, wl & ~WS_EX_LAYERED); + } else { + if ((wl & WS_EX_LAYERED) == 0) + SetWindowLong(m_data.hwnd, GWL_EXSTYLE, wl | WS_EX_LAYERED); + if (m_data.flags & Qt::FramelessWindowHint) { + BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * level), AC_SRC_ALPHA}; + QWindowsContext::user32dll.updateLayeredWindow(m_data.hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); + } else { + QWindowsContext::user32dll.setLayeredWindowAttributes(m_data.hwnd, 0, (int)(level * 255), LWA_ALPHA); + } + } +} + +void QWindowsWindow::requestActivateWindow() +{ + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << this << window(); + if (m_data.hwnd) + SetForegroundWindow(m_data.hwnd); +} + +bool QWindowsWindow::setKeyboardGrabEnabled(bool grab) +{ + if (!m_data.hwnd) { + qWarning("%s: No handle", __FUNCTION__); + return false; + } + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << this << window() << grab; + + QWindowsContext *context = QWindowsContext::instance(); + if (grab) { + context->setKeyGrabber(window()); + } else { + if (context->keyGrabber() == window()) + context->setKeyGrabber(0); + } + return true; +} + +bool QWindowsWindow::setMouseGrabEnabled(bool grab) +{ + bool result = false; + if (!m_data.hwnd) { + qWarning("%s: No handle", __FUNCTION__); + return result; + } + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << window() << grab; + + if (m_mouseGrab != grab) { + m_mouseGrab = grab; + if (isVisible()) + setMouseGrabEnabled_sys(grab); + } + return grab; +} + +void QWindowsWindow::setMouseGrabEnabled_sys(bool grab) +{ + if (grab) { + SetCapture(m_data.hwnd); + } else { + ReleaseCapture(); + } +} + +void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const +{ + const QWindowsGeometryHint hint(window()); + hint.applyToMinMaxInfo(m_data.hwnd, mmi); + if (QWindowsContext::verboseWindows) + qDebug() << __FUNCTION__ << window() << *mmi; +} + +/*! + \brief Applies to cursor property set on the window to the global cursor + unless there is an override cursor. + + \sa QWindowsCursor +*/ + +void QWindowsWindow::applyCursor() +{ + if (!QGuiApplication::overrideCursor()) + SetCursor(m_cursor.handle()); +} + +void QWindowsWindow::setCursor(const QWindowsWindowCursor &c) +{ + if (c.handle() != m_cursor.handle()) { + const bool underMouse = QWindowsContext::instance()->windowUnderMouse() == window(); + if (QWindowsContext::verboseWindows) + qDebug() << window() << __FUNCTION__ << "Shape=" << c.cursor().shape() + << " isWUM=" << underMouse; + m_cursor = c; + if (underMouse) + applyCursor(); + } +} + +/*! + \brief Find a child window using flags from ChildWindowFromPointEx. +*/ + +QWindowsWindow *QWindowsWindow::childAtScreenPoint(const QPoint &screenPoint, + unsigned cwexflags) const +{ + if (m_data.hwnd) + return QWindowsContext::instance()->findPlatformWindowAt(m_data.hwnd, screenPoint, cwexflags); + return 0; +} + +QWindowsWindow *QWindowsWindow::childAt(const QPoint &clientPoint, unsigned cwexflags) const +{ + if (m_data.hwnd) + return childAtScreenPoint(QWindowsGeometryHint::mapToGlobal(m_data.hwnd, clientPoint), + cwexflags); + return 0; +} + +QByteArray QWindowsWindow::debugWindowFlags(Qt::WindowFlags wf) +{ + const int iwf = int(wf); + QByteArray rc = "0x"; + rc += QByteArray::number(iwf, 16); + rc += " ["; + + switch ((iwf & Qt::WindowType_Mask)) { + case Qt::Widget: + rc += " Widget"; + break; + case Qt::Window: + rc += " Window"; + break; + case Qt::Dialog: + rc += " Dialog"; + break; + case Qt::Sheet: + rc += " Sheet"; + break; + case Qt::Popup: + rc += " Popup"; + break; + case Qt::Tool: + rc += " Tool"; + break; + case Qt::ToolTip: + rc += " ToolTip"; + break; + case Qt::SplashScreen: + rc += " SplashScreen"; + break; + case Qt::Desktop: + rc += " Desktop"; + break; + case Qt::SubWindow: + rc += " SubWindow"; + break; + } + if (iwf & Qt::MSWindowsFixedSizeDialogHint) rc += " MSWindowsFixedSizeDialogHint"; + if (iwf & Qt::MSWindowsOwnDC) rc += " MSWindowsOwnDC"; + if (iwf & Qt::FramelessWindowHint) rc += " FramelessWindowHint"; + if (iwf & Qt::WindowTitleHint) rc += " WindowTitleHint"; + if (iwf & Qt::WindowSystemMenuHint) rc += " WindowSystemMenuHint"; + if (iwf & Qt::WindowMinimizeButtonHint) rc += " WindowMinimizeButtonHint"; + if (iwf & Qt::WindowMaximizeButtonHint) rc += " WindowMaximizeButtonHint"; + if (iwf & Qt::WindowContextHelpButtonHint) rc += " WindowContextHelpButtonHint"; + if (iwf & Qt::WindowShadeButtonHint) rc += " WindowShadeButtonHint"; + if (iwf & Qt::WindowStaysOnTopHint) rc += " WindowStaysOnTopHint"; + if (iwf & Qt::CustomizeWindowHint) rc += " CustomizeWindowHint"; + if (iwf & Qt::WindowStaysOnBottomHint) rc += " WindowStaysOnBottomHint"; + if (iwf & Qt::WindowCloseButtonHint) rc += " WindowCloseButtonHint"; + rc += ']'; + return rc; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h new file mode 100644 index 00000000000..dfaeb2a86d4 --- /dev/null +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -0,0 +1,284 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSWINDOW_H +#define QWINDOWSWINDOW_H + +#include "qtwindows_additional.h" +#include "qwindowscursor.h" + +#include + +QT_BEGIN_NAMESPACE + +class QWindowsOleDropTarget; +class QDebug; + +struct QWindowsGeometryHint +{ + QWindowsGeometryHint() {} + explicit QWindowsGeometryHint(const QWindow *w); + static QMargins frame(DWORD style, DWORD exStyle); + void applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXINFO *mmi) const; + void applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const; + bool validSize(const QSize &s) const; + + static inline QPoint mapToGlobal(HWND hwnd, const QPoint &); + static inline QPoint mapToGlobal(const QWindow *w, const QPoint &); + static inline QPoint mapFromGlobal(const HWND hwnd, const QPoint &); + static inline QPoint mapFromGlobal(const QWindow *w, const QPoint &); + + QSize minimumSize; + QSize maximumSize; +}; + +struct QWindowCreationContext +{ + QWindowCreationContext(const QWindow *w, const QRect &r, + DWORD style, DWORD exStyle); + + void applyToMinMaxInfo(MINMAXINFO *mmi) const + { geometryHint.applyToMinMaxInfo(style, exStyle, mmi); } + + QWindowsGeometryHint geometryHint; + DWORD style; + DWORD exStyle; + QRect requestedGeometry; + QRect obtainedGeometry; + QMargins margins; + int frameX; // Passed on to CreateWindowEx(), including frame. + int frameY; + int frameWidth; + int frameHeight; +}; + +class QWindowsWindow : public QPlatformWindow +{ +public: + enum Flags + { + OpenGL_Surface = 0x1, + WithinWmPaint = 0x2, + PixelFormatInitialized = 0x4, + FrameDirty = 0x8 //! Frame outdated by setStyle, recalculate in next query. + }; + + struct WindowData + { + WindowData() : hwnd(0) {} + + Qt::WindowFlags flags; + QRect geometry; + QMargins frame; // Do not use directly for windows, see FrameDirty. + HWND hwnd; + + static WindowData create(const QWindow *w, + const WindowData ¶meters, + const QString &title, + bool isGL); + }; + + QWindowsWindow(QWindow *window, const WindowData &data); + ~QWindowsWindow(); + + virtual void setGeometry(const QRect &rect); + virtual QRect geometry() const { return m_data.geometry; } + + virtual void setVisible(bool visible); + bool isVisible() const; + virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + virtual Qt::WindowState setWindowState(Qt::WindowState state); + + HWND handle() const { return m_data.hwnd; } + + virtual WId winId() const { return WId(m_data.hwnd); } + virtual void setParent(const QPlatformWindow *window); + + virtual void setWindowTitle(const QString &title); + virtual void raise(); + virtual void lower(); + + virtual void propagateSizeHints(); + virtual QMargins frameMargins() const; + + virtual void setOpacity(qreal level); + virtual void requestActivateWindow(); + + virtual bool setKeyboardGrabEnabled(bool grab); + virtual bool setMouseGrabEnabled(bool grab); + + Qt::WindowState windowState_sys() const; + Qt::WindowStates windowStates_sys() const; + + inline unsigned style() const + { return GetWindowLongPtr(m_data.hwnd, GWL_STYLE); } + void setStyle(unsigned s) const; + inline unsigned exStyle() const + { return GetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE); } + void setExStyle(unsigned s) const; + + void handleWmPaint(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + + void handleMoved(); + void handleResized(int wParam); + void handleShown(); + void handleHidden(); + + static inline HWND handleOf(const QWindow *w); + static inline QWindowsWindow *baseWindowOf(const QWindow *w); + static QWindow *topLevelOf(QWindow *w); + static inline void *userDataOf(HWND hwnd); + static inline void setUserDataOf(HWND hwnd, void *ud); + + HDC getDC(); + void releaseDC(); + + void getSizeHints(MINMAXINFO *mmi) const; + + QWindowsWindowCursor cursor() const { return m_cursor; } + void setCursor(const QWindowsWindowCursor &c); + void applyCursor(); + + QWindowsWindow *childAt(const QPoint &clientPoint, + unsigned cwexflags = CWP_SKIPINVISIBLE) const; + QWindowsWindow *childAtScreenPoint(const QPoint &screenPoint, + unsigned cwexflags = CWP_SKIPINVISIBLE) const; + + static QByteArray debugWindowFlags(Qt::WindowFlags wf); + + inline bool testFlag(unsigned f) const { return (m_flags & f) != 0; } + inline void setFlag(unsigned f) const { m_flags |= f; } + inline void clearFlag(unsigned f) const { m_flags &= ~f; } + +private: + inline void show_sys() const; + inline void hide_sys() const; + inline void setGeometry_sys(const QRect &rect) const; + inline QRect geometry_sys() const; + inline WindowData setWindowFlags_sys(Qt::WindowFlags wt) const; + inline void setWindowState_sys(Qt::WindowState newState); + inline void setParent_sys(const QPlatformWindow *parent) const; + inline void setOpacity_sys(qreal level) const; + inline void setMouseGrabEnabled_sys(bool grab); + void destroyWindow(); + void registerDropSite(); + void unregisterDropSite(); + void handleGeometryChange(); + void handleWindowStateChange(Qt::WindowState state); + + mutable WindowData m_data; + mutable unsigned m_flags; + HDC m_hdc; + Qt::WindowState m_windowState; + qreal m_opacity; + bool m_mouseGrab; + QWindowsWindowCursor m_cursor; + QWindowsOleDropTarget *m_dropTarget; +}; + +// Conveniences for window frames. +inline QRect operator+(const QRect &r, const QMargins &m) +{ + return r.adjusted(-m.left(), -m.top(), m.right(), m.bottom()); +} + +inline QRect operator-(const QRect &r, const QMargins &m) +{ + return r.adjusted(m.left(), m.top(), -m.right(), -m.bottom()); +} + +// Debug +QDebug operator<<(QDebug d, const RECT &r); +QDebug operator<<(QDebug d, const MINMAXINFO &i); +QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p); + +// ---------- QWindowsGeometryHint inline functions. +QPoint QWindowsGeometryHint::mapToGlobal(HWND hwnd, const QPoint &qp) +{ + POINT p = { qp.x(), qp.y() }; + ClientToScreen(hwnd, &p); + return QPoint(p.x, p.y); +} + +QPoint QWindowsGeometryHint::mapFromGlobal(const HWND hwnd, const QPoint &qp) +{ + POINT p = { qp.x(), qp.y() }; + ScreenToClient(hwnd, &p); + return QPoint(p.x, p.y); +} + +QPoint QWindowsGeometryHint::mapToGlobal(const QWindow *w, const QPoint &p) + { return QWindowsGeometryHint::mapToGlobal(QWindowsWindow::handleOf(w), p); } + +QPoint QWindowsGeometryHint::mapFromGlobal(const QWindow *w, const QPoint &p) + { return QWindowsGeometryHint::mapFromGlobal(QWindowsWindow::handleOf(w), p); } + + +// ---------- QWindowsBaseWindow inline functions. + +QWindowsWindow *QWindowsWindow::baseWindowOf(const QWindow *w) +{ + if (w) + if (QPlatformWindow *pw = w->handle()) + return static_cast(pw); + return 0; +} + +HWND QWindowsWindow::handleOf(const QWindow *w) +{ + if (const QWindowsWindow *bw = QWindowsWindow::baseWindowOf(w)) + return bw->handle(); + return 0; +} + +void *QWindowsWindow::userDataOf(HWND hwnd) +{ + return (void *)GetWindowLongPtr(hwnd, GWLP_USERDATA); +} + +void QWindowsWindow::setUserDataOf(HWND hwnd, void *ud) +{ + SetWindowLongPtr(hwnd, GWLP_USERDATA, LONG_PTR(ud)); +} + +QT_END_NAMESPACE + +#endif // QWINDOWSWINDOW_H diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro new file mode 100644 index 00000000000..e5627ae5746 --- /dev/null +++ b/src/plugins/platforms/windows/windows.pro @@ -0,0 +1,70 @@ +TARGET = windows +load(qt_plugin) + +QT *= core-private +QT *= gui-private + +INCLUDEPATH += ../../../3rdparty/harfbuzz/src +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +# Note: OpenGL32 must precede Gdi32 as it overwrites some functions. +LIBS *= -lOpenGL32 -lGdi32 -lUser32 -lOle32 -lWinspool -lImm32 +win32-g++: LIBS *= -luuid + +contains(QT_CONFIG, directwrite) { + LIBS *= -ldwrite + SOURCES += qwindowsfontenginedirectwrite.cpp + HEADERS += qwindowsfontenginedirectwrite.h +} else { + DEFINES *= QT_NO_DIRECTWRITE +} + +SOURCES += \ + main.cpp \ + qwindowsnativeimage.cpp \ + qwindowswindow.cpp \ + qwindowsintegration.cpp \ + qwindowscontext.cpp \ + qwindowsbackingstore.cpp \ + qwindowsscreen.cpp \ + qwindowskeymapper.cpp \ + qwindowsfontengine.cpp \ + qwindowsfontdatabase.cpp \ + qwindowsmousehandler.cpp \ + qwindowsguieventdispatcher.cpp \ + qwindowsglcontext.cpp \ + qwindowsclipboard.cpp \ + qwindowsole.cpp \ + qwindowsmime.cpp \ + qwindowsdrag.cpp \ + qwindowscursor.cpp \ + pixmaputils.cpp \ + qwindowsinputcontext.cpp + +HEADERS += \ + qwindowsnativeimage.h \ + qwindowswindow.h \ + qwindowsintegration.h \ + qwindowscontext.h \ + qwindowsbackingstore.h \ + qwindowsscreen.h \ + qwindowskeymapper.h \ + qwindowsfontengine.h \ + qwindowsfontdatabase.h \ + qwindowsmousehandler.h \ + qwindowsguieventdispatcher.h \ + qtwindowsglobal.h \ + qtwindows_additional.h \ + qwindowsglcontext.h \ + qwindowsclipboard.h \ + qwindowsole.h \ + qwindowsmime.h \ + qwindowsdrag.h \ + qwindowsinternalmimedata.h \ + qwindowscursor.h \ + pixmaputils.h \ + array.h \ + qwindowsinputcontext.h + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README index 17a86e6d083..d2884f109c4 100644 --- a/src/plugins/platforms/xcb/README +++ b/src/plugins/platforms/xcb/README @@ -1,3 +1,3 @@ Required packages: -libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm1 libxcb-icccm1-dev libxcb-sync0 libxcb-sync0-dev +libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm1 libxcb-icccm1-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev diff --git a/src/plugins/platforms/xcb/main.cpp b/src/plugins/platforms/xcb/main.cpp index 7fee7455beb..c544f7073dc 100644 --- a/src/plugins/platforms/xcb/main.cpp +++ b/src/plugins/platforms/xcb/main.cpp @@ -58,11 +58,10 @@ QStringList QXcbIntegrationPlugin::keys() const return list; } -QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters) { - Q_UNUSED(paramList); if (system.toLower() == "xcb") - return new QXcbIntegration; + return new QXcbIntegration(parameters); return 0; } diff --git a/src/plugins/platforms/xcb/qdri2context.cpp b/src/plugins/platforms/xcb/qdri2context.cpp index 8bcdacb92b6..5f4aff5455f 100644 --- a/src/plugins/platforms/xcb/qdri2context.cpp +++ b/src/plugins/platforms/xcb/qdri2context.cpp @@ -45,7 +45,7 @@ #include "qxcbconnection.h" #include -#include +#include #include #include @@ -134,9 +134,9 @@ QDri2Context::QDri2Context(QXcbWindow *window) glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERER,d->depth); //restore the old current context - const QPlatformGLContext *currentContext = QPlatformGLContext::currentContext(); + const QPlatformOpenGLContext *currentContext = QPlatformOpenGLContext::currentContext(); if (currentContext) - const_cast(currentContext)->makeCurrent(); + const_cast(currentContext)->makeCurrent(); } QDri2Context::~QDri2Context() @@ -146,7 +146,6 @@ QDri2Context::~QDri2Context() void QDri2Context::makeCurrent() { - QPlatformGLContext::makeCurrent(); Q_D(QDri2Context); eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,d->eglContext); @@ -156,7 +155,6 @@ void QDri2Context::makeCurrent() void QDri2Context::doneCurrent() { - QPlatformGLContext::doneCurrent(); Q_D(QDri2Context); eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT); } diff --git a/src/plugins/platforms/xcb/qdri2context.h b/src/plugins/platforms/xcb/qdri2context.h index be7d6376437..ec8b251c3ff 100644 --- a/src/plugins/platforms/xcb/qdri2context.h +++ b/src/plugins/platforms/xcb/qdri2context.h @@ -42,14 +42,14 @@ #ifndef QDRI2CONTEXT_H #define QDRI2CONTEXT_H -#include +#include class QXcbWindow; class QDri2ContextPrivate; struct xcb_dri2_dri2_buffer_t; -class QDri2Context : public QPlatformGLContext +class QDri2Context : public QPlatformOpenGLContext { Q_DECLARE_PRIVATE(QDri2Context); public: diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 8e04cbcb71b..41bceaf4060 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -41,7 +41,6 @@ #include #include -#include #include "qxcbwindow.h" #include "qxcbscreen.h" @@ -50,72 +49,56 @@ #include #include +#include + #include "qglxintegration.h" -#include "qglxconvenience.h" +#include #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) #include #endif -QGLXContext::QGLXContext(Window window, QXcbScreen *screen, const QPlatformWindowFormat &format) - : QPlatformGLContext() +QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share) + : QPlatformOpenGLContext() , m_screen(screen) - , m_drawable((Drawable)window) , m_context(0) { - Q_XCB_NOOP(m_screen->connection()); - const QPlatformGLContext *sharePlatformContext; - sharePlatformContext = format.sharedGLContext(); GLXContext shareGlxContext = 0; - if (sharePlatformContext) - shareGlxContext = static_cast(sharePlatformContext)->glxContext(); + if (share) + shareGlxContext = static_cast(share)->glxContext(); GLXFBConfig config = qglx_findConfig(DISPLAY_FROM_XCB(screen),screen->screenNumber(),format); m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, shareGlxContext, TRUE); - m_windowFormat = qglx_platformWindowFromGLXFBConfig(DISPLAY_FROM_XCB(screen), config, m_context); - Q_XCB_NOOP(m_screen->connection()); -} - -QGLXContext::QGLXContext(QXcbScreen *screen, Drawable drawable, GLXContext context) - : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) -{ - + m_format = qglx_surfaceFormatFromGLXFBConfig(DISPLAY_FROM_XCB(screen), config, m_context); } QGLXContext::~QGLXContext() { - Q_XCB_NOOP(m_screen->connection()); - if (m_context) - glXDestroyContext(DISPLAY_FROM_XCB(m_screen), m_context); - Q_XCB_NOOP(m_screen->connection()); + glXDestroyContext(DISPLAY_FROM_XCB(m_screen), m_context); } -void QGLXContext::makeCurrent() +bool QGLXContext::makeCurrent(QPlatformSurface *surface) { - Q_XCB_NOOP(m_screen->connection()); - QPlatformGLContext::makeCurrent(); - glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), m_drawable, m_context); - Q_XCB_NOOP(m_screen->connection()); + Q_ASSERT(surface); + + GLXDrawable glxDrawable = static_cast(surface)->xcb_window(); + + return glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), glxDrawable, m_context); } void QGLXContext::doneCurrent() { - Q_XCB_NOOP(m_screen->connection()); - QPlatformGLContext::doneCurrent(); glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), 0, 0); - Q_XCB_NOOP(m_screen->connection()); } -void QGLXContext::swapBuffers() +void QGLXContext::swapBuffers(QPlatformSurface *surface) { - Q_XCB_NOOP(m_screen->connection()); - glXSwapBuffers(DISPLAY_FROM_XCB(m_screen), m_drawable); - Q_XCB_NOOP(m_screen->connection()); + GLXDrawable glxDrawable = static_cast(surface)->xcb_window(); + glXSwapBuffers(DISPLAY_FROM_XCB(m_screen), glxDrawable); } -void* QGLXContext::getProcAddress(const QString& procName) +void (*QGLXContext::getProcAddress(const QByteArray &procName)) () { - Q_XCB_NOOP(m_screen->connection()); typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; static bool resolved = false; @@ -144,10 +127,10 @@ void* QGLXContext::getProcAddress(const QString& procName) } if (!glXGetProcAddressARB) return 0; - return glXGetProcAddressARB(reinterpret_cast(procName.toLatin1().data())); + return (void (*)())glXGetProcAddressARB(reinterpret_cast(procName.constData())); } -QPlatformWindowFormat QGLXContext::platformWindowFormat() const +QSurfaceFormat QGLXContext::format() const { - return m_windowFormat; + return m_format; } diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h index 84de7b71439..bbe67b653a0 100644 --- a/src/plugins/platforms/xcb/qglxintegration.h +++ b/src/plugins/platforms/xcb/qglxintegration.h @@ -43,36 +43,34 @@ #define QGLXINTEGRATION_H #include "qxcbwindow.h" +#include "qxcbscreen.h" -#include -#include +#include +#include #include #include -class QGLXContext : public QPlatformGLContext +class QGLXContext : public QPlatformOpenGLContext { public: - QGLXContext(Window window, QXcbScreen *xd, const QPlatformWindowFormat &format); + QGLXContext(QXcbScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share); ~QGLXContext(); - virtual void makeCurrent(); - virtual void doneCurrent(); - virtual void swapBuffers(); - virtual void* getProcAddress(const QString& procName); + bool makeCurrent(QPlatformSurface *surface); + void doneCurrent(); + void swapBuffers(QPlatformSurface *surface); + void (*getProcAddress(const QByteArray &procName)) (); + + QSurfaceFormat format() const; GLXContext glxContext() const { return m_context; } - QPlatformWindowFormat platformWindowFormat() const; - private: QXcbScreen *m_screen; - Drawable m_drawable; GLXContext m_context; - QPlatformWindowFormat m_windowFormat; - - QGLXContext (QXcbScreen *screen, Drawable drawable, GLXContext context); + QSurfaceFormat m_format; }; #endif diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp similarity index 65% rename from src/plugins/platforms/xcb/qxcbwindowsurface.cpp rename to src/plugins/platforms/xcb/qxcbbackingstore.cpp index 4fcd207df3a..fadcb4d5b8c 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qxcbwindowsurface.h" +#include "qxcbbackingstore.h" #include "qxcbconnection.h" #include "qxcbscreen.h" @@ -52,9 +52,11 @@ #include #include +#include #include #include +#include class QXcbShmImage : public QXcbObject { @@ -63,6 +65,7 @@ public: ~QXcbShmImage() { destroy(); } QImage *image() { return &m_qimage; } + QSize size() const { return m_qimage.size(); } void put(xcb_window_t window, const QPoint &dst, const QRect &source); void preparePaint(const QRegion ®ion); @@ -97,30 +100,54 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI ~0, 0); - m_shm_info.shmid = shmget (IPC_PRIVATE, - m_xcb_image->stride * m_xcb_image->height, IPC_CREAT|0777); + const int segmentSize = m_xcb_image->stride * m_xcb_image->height; + if (!segmentSize) + return; + int id = shmget(IPC_PRIVATE, segmentSize, IPC_CREAT | 0777); + if (id == -1) + qWarning("QXcbShmImage: shmget() failed (%d) for size %d (%dx%d)", + errno, segmentSize, size.width(), size.height()); + else + m_shm_info.shmid = id; m_shm_info.shmaddr = m_xcb_image->data = (quint8 *)shmat (m_shm_info.shmid, 0, 0); m_shm_info.shmseg = xcb_generate_id(xcb_connection()); xcb_generic_error_t *error = xcb_request_check(xcb_connection(), xcb_shm_attach_checked(xcb_connection(), m_shm_info.shmseg, m_shm_info.shmid, false)); if (error) { - qWarning() << "QXcbWindowSurface: Unable to attach to shared memory segment"; free(error); - } - if (shmctl(m_shm_info.shmid, IPC_RMID, 0) == -1) - qWarning() << "QXcbWindowSurface: Error while marking the shared memory segment to be destroyed"; + shmdt(m_shm_info.shmaddr); + shmctl(m_shm_info.shmid, IPC_RMID, 0); + + m_shm_info.shmaddr = 0; + + m_xcb_image->data = (uint8_t *)qMalloc(segmentSize); + } else { + if (shmctl(m_shm_info.shmid, IPC_RMID, 0) == -1) + qWarning() << "QXcbBackingStore: Error while marking the shared memory segment to be destroyed"; + } m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, format); } void QXcbShmImage::destroy() { - Q_XCB_CALL(xcb_shm_detach(xcb_connection(), m_shm_info.shmseg)); + const int segmentSize = m_xcb_image ? (m_xcb_image->stride * m_xcb_image->height) : 0; + if (segmentSize && m_shm_info.shmaddr) + Q_XCB_CALL(xcb_shm_detach(xcb_connection(), m_shm_info.shmseg)); + xcb_image_destroy(m_xcb_image); - shmdt(m_shm_info.shmaddr); - shmctl(m_shm_info.shmid, IPC_RMID, 0); + + if (segmentSize) { + if (m_shm_info.shmaddr) { + shmdt(m_shm_info.shmaddr); + shmctl(m_shm_info.shmid, IPC_RMID, 0); + } else { + qFree(m_xcb_image->data); + } + } + if (m_gc) Q_XCB_CALL(xcb_free_gc(xcb_connection(), m_gc)); } @@ -139,18 +166,32 @@ void QXcbShmImage::put(xcb_window_t window, const QPoint &target, const QRect &s } Q_XCB_NOOP(connection()); - xcb_image_shm_put(xcb_connection(), + if (m_shm_info.shmaddr) { + xcb_image_shm_put(xcb_connection(), + window, + m_gc, + m_xcb_image, + m_shm_info, + source.x(), + source.y(), + target.x(), + target.y(), + source.width(), + source.height(), + false); + } else { + xcb_image_t *subimage = xcb_image_subimage(m_xcb_image, source.x(), source.y(), source.width(), source.height(), + 0, 0, 0); + xcb_image_put(xcb_connection(), window, m_gc, - m_xcb_image, - m_shm_info, - source.x(), - source.y(), + subimage, target.x(), target.y(), - source.width(), - source.height(), - false); + 0); + + xcb_image_destroy(subimage); + } Q_XCB_NOOP(connection()); m_dirty = m_dirty | source; @@ -168,29 +209,30 @@ void QXcbShmImage::preparePaint(const QRegion ®ion) } } -QXcbWindowSurface::QXcbWindowSurface(QWidget *widget, bool setDefaultSurface) - : QWindowSurface(widget, setDefaultSurface) +QXcbBackingStore::QXcbBackingStore(QWindow *window) + : QPlatformBackingStore(window) , m_image(0) , m_syncingResize(false) { - QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); + QXcbScreen *screen = static_cast(window->screen()->handle()); setConnection(screen->connection()); } -QXcbWindowSurface::~QXcbWindowSurface() +QXcbBackingStore::~QXcbBackingStore() { delete m_image; } -QPaintDevice *QXcbWindowSurface::paintDevice() +QPaintDevice *QXcbBackingStore::paintDevice() { return m_image->image(); } -void QXcbWindowSurface::beginPaint(const QRegion ®ion) +void QXcbBackingStore::beginPaint(const QRegion ®ion) { m_image->preparePaint(region); +#if 0 if (m_image->image()->hasAlphaChannel()) { QPainter p(m_image->image()); p.setCompositionMode(QPainter::CompositionMode_Source); @@ -200,29 +242,27 @@ void QXcbWindowSurface::beginPaint(const QRegion ®ion) p.fillRect(*it, blank); } } +#endif } -void QXcbWindowSurface::endPaint(const QRegion &) +void QXcbBackingStore::endPaint(const QRegion &) { } -void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QXcbBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) { QRect bounds = region.boundingRect(); - if (size().isEmpty() || !geometry().contains(bounds)) + if (!m_image || m_image->size().isEmpty()) return; Q_XCB_NOOP(connection()); - QXcbWindow *window = static_cast(widget->window()->platformWindow()); - - extern QWidgetData* qt_widget_data(QWidget *); - QPoint widgetOffset = qt_qwidget_data(widget)->wrect.topLeft(); + QXcbWindow *platformWindow = static_cast(window->handle()); QVector rects = region.rects(); for (int i = 0; i < rects.size(); ++i) - m_image->put(window->window(), rects.at(i).topLeft() - widgetOffset, rects.at(i).translated(offset)); + m_image->put(platformWindow->xcb_window(), rects.at(i).topLeft(), rects.at(i).translated(offset)); Q_XCB_NOOP(connection()); @@ -230,23 +270,22 @@ void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoi xcb_flush(xcb_connection()); connection()->sync(); m_syncingResize = false; - window->updateSyncRequestCounter(); + platformWindow->updateSyncRequestCounter(); } } -void QXcbWindowSurface::resize(const QSize &size) +void QXcbBackingStore::resize(const QSize &size, const QRegion &) { - if (size == QWindowSurface::size()) + if (m_image && size == m_image->size()) return; Q_XCB_NOOP(connection()); - QWindowSurface::resize(size); - QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(window())); - QXcbWindow* win = static_cast(window()->platformWindow()); + QXcbScreen *screen = static_cast(window()->screen()->handle()); + QXcbWindow* win = static_cast(window()->handle()); delete m_image; - m_image = new QXcbShmImage(screen, size, win->depth(), win->format()); + m_image = new QXcbShmImage(screen, size, win->depth(), win->imageFormat()); Q_XCB_NOOP(connection()); m_syncingResize = true; @@ -254,9 +293,9 @@ void QXcbWindowSurface::resize(const QSize &size) extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); -bool QXcbWindowSurface::scroll(const QRegion &area, int dx, int dy) +bool QXcbBackingStore::scroll(const QRegion &area, int dx, int dy) { - if (m_image->image()->isNull()) + if (!m_image || m_image->image()->isNull()) return false; m_image->preparePaint(area); diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.h b/src/plugins/platforms/xcb/qxcbbackingstore.h similarity index 84% rename from src/plugins/platforms/xcb/qxcbwindowsurface.h rename to src/plugins/platforms/xcb/qxcbbackingstore.h index 5f61815b652..db94d26b094 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#ifndef QXCBWINDOWSURFACE_H -#define QXCBWINDOWSURFACE_H +#ifndef QXCBBACKINGSTORE_H +#define QXCBBACKINGSTORE_H -#include +#include #include @@ -50,15 +50,15 @@ class QXcbShmImage; -class QXcbWindowSurface : public QXcbObject, public QWindowSurface +class QXcbBackingStore : public QXcbObject, public QPlatformBackingStore { public: - QXcbWindowSurface(QWidget *widget, bool setDefaultSurface = true); - ~QXcbWindowSurface(); + QXcbBackingStore(QWindow *widget); + ~QXcbBackingStore(); QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void resize(const QSize &size); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size, const QRegion &staticContents); bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion &); diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp new file mode 100644 index 00000000000..550b8cbd731 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -0,0 +1,848 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the 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 "qxcbclipboard.h" + +#include "qxcbconnection.h" +#include "qxcbscreen.h" +#include "qxcbmime.h" + +#include +#include + +#include + +#include + +class QXcbClipboardMime : public QXcbMime +{ + Q_OBJECT +public: + QXcbClipboardMime(QClipboard::Mode mode, QXcbClipboard *clipboard) + : QXcbMime() + , m_clipboard(clipboard) + { + switch (mode) { + case QClipboard::Selection: + modeAtom = XCB_ATOM_PRIMARY; + break; + + case QClipboard::Clipboard: + modeAtom = m_clipboard->atom(QXcbAtom::CLIPBOARD); + break; + + default: + qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); + break; + } + } + +protected: + QStringList formats_sys() const + { + if (empty()) + return QStringList(); + + if (!formatList.count()) { + QXcbClipboardMime *that = const_cast(this); + // get the list of targets from the current clipboard owner - we do this + // once so that multiple calls to this function don't require multiple + // server round trips... + that->format_atoms = m_clipboard->getDataInFormat(modeAtom, m_clipboard->atom(QXcbAtom::TARGETS)); + + if (format_atoms.size() > 0) { + xcb_atom_t *targets = (xcb_atom_t *) format_atoms.data(); + int size = format_atoms.size() / sizeof(xcb_atom_t); + + for (int i = 0; i < size; ++i) { + if (targets[i] == 0) + continue; + + QString format = mimeAtomToString(m_clipboard->connection(), targets[i]); + if (!formatList.contains(format)) + that->formatList.append(format); + } + } + } + + return formatList; + } + + bool hasFormat_sys(const QString &format) const + { + QStringList list = formats(); + return list.contains(format); + } + + QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const + { + if (fmt.isEmpty() || empty()) + return QByteArray(); + + (void)formats(); // trigger update of format list + + QList atoms; + xcb_atom_t *targets = (xcb_atom_t *) format_atoms.data(); + int size = format_atoms.size() / sizeof(xcb_atom_t); + for (int i = 0; i < size; ++i) + atoms.append(targets[i]); + + QByteArray encoding; + xcb_atom_t fmtatom = mimeAtomForFormat(m_clipboard->connection(), fmt, requestedType, atoms, &encoding); + + if (fmtatom == 0) + return QVariant(); + + return mimeConvertToFormat(m_clipboard->connection(), fmtatom, m_clipboard->getDataInFormat(modeAtom, fmtatom), fmt, requestedType, encoding); + } +private: + bool empty() const + { + return m_clipboard->getSelectionOwner(modeAtom) == XCB_NONE; + } + + + xcb_atom_t modeAtom; + QXcbClipboard *m_clipboard; + QStringList formatList; + QByteArray format_atoms; +}; + +const int QXcbClipboard::clipboard_timeout = 5000; + +QXcbClipboard::QXcbClipboard(QXcbConnection *c) + : QXcbObject(c), QPlatformClipboard() + , m_requestor(XCB_NONE) + , m_owner(XCB_NONE) +{ + Q_ASSERT(QClipboard::Clipboard == 0); + Q_ASSERT(QClipboard::Selection == 1); + m_xClipboard[QClipboard::Clipboard] = 0; + m_xClipboard[QClipboard::Selection] = 0; + m_clientClipboard[QClipboard::Clipboard] = 0; + m_clientClipboard[QClipboard::Selection] = 0; + m_timestamp[QClipboard::Clipboard] = XCB_CURRENT_TIME; + m_timestamp[QClipboard::Selection] = XCB_CURRENT_TIME; + + m_screen = connection()->screens().at(connection()->primaryScreen()); + + int x = 0, y = 0, w = 3, h = 3; + + m_owner = xcb_generate_id(xcb_connection()); + Q_XCB_CALL(xcb_create_window(xcb_connection(), + XCB_COPY_FROM_PARENT, // depth -- same as root + m_owner, // window id + m_screen->screen()->root, // parent window id + x, y, w, h, + 0, // border width + XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class + m_screen->screen()->root_visual, // visual + 0, // value mask + 0)); // value list + + if (connection()->hasXFixes()) { + const uint32_t mask = XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER | + XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY | + XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE; + Q_XCB_CALL(xcb_xfixes_select_selection_input_checked(xcb_connection(), m_owner, XCB_ATOM_PRIMARY, mask)); + Q_XCB_CALL(xcb_xfixes_select_selection_input_checked(xcb_connection(), m_owner, atom(QXcbAtom::CLIPBOARD), mask)); + } +} + +QXcbClipboard::~QXcbClipboard() +{ + // Transfer the clipboard content to the clipboard manager if we own a selection + if (m_timestamp[QClipboard::Clipboard] != XCB_CURRENT_TIME || + m_timestamp[QClipboard::Selection] != XCB_CURRENT_TIME) { + + // First we check if there is a clipboard manager. + xcb_get_selection_owner_cookie_t cookie = xcb_get_selection_owner(xcb_connection(), atom(QXcbAtom::CLIPBOARD_MANAGER)); + xcb_get_selection_owner_reply_t *reply = xcb_get_selection_owner_reply(xcb_connection(), cookie, 0); + if (reply && reply->owner != XCB_NONE) { + // we delete the property so the manager saves all TARGETS. + xcb_delete_property(xcb_connection(), m_owner, atom(QXcbAtom::_QT_SELECTION)); + xcb_convert_selection(xcb_connection(), m_owner, atom(QXcbAtom::CLIPBOARD_MANAGER), atom(QXcbAtom::SAVE_TARGETS), + atom(QXcbAtom::_QT_SELECTION), connection()->time()); + connection()->sync(); + + // waiting until the clipboard manager fetches the content. + if (!waitForClipboardEvent(m_owner, XCB_SELECTION_NOTIFY, 5000)) { + qWarning("QClipboard: Unable to receive an event from the " + "clipboard manager in a reasonable time"); + } + } + } +} + + +xcb_window_t QXcbClipboard::getSelectionOwner(xcb_atom_t atom) const +{ + xcb_connection_t *c = xcb_connection(); + xcb_get_selection_owner_cookie_t cookie = xcb_get_selection_owner(c, atom); + xcb_get_selection_owner_reply_t *reply; + reply = xcb_get_selection_owner_reply(c, cookie, 0); + xcb_window_t win = reply->owner; + free(reply); + return win; +} + +xcb_atom_t QXcbClipboard::atomForMode(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard) + return atom(QXcbAtom::CLIPBOARD); + if (mode == QClipboard::Selection) + return XCB_ATOM_PRIMARY; + return XCB_NONE; +} + +QClipboard::Mode QXcbClipboard::modeForAtom(xcb_atom_t a) const +{ + if (a == XCB_ATOM_PRIMARY) + return QClipboard::Selection; + if (a == atom(QXcbAtom::CLIPBOARD)) + return QClipboard::Clipboard; + // not supported enum value, used to detect errors + return QClipboard::FindBuffer; +} + + +QMimeData * QXcbClipboard::mimeData(QClipboard::Mode mode) +{ + if (mode > QClipboard::Selection) + return 0; + + xcb_window_t clipboardOwner = getSelectionOwner(atomForMode(mode)); + if (clipboardOwner == owner()) { + return m_clientClipboard[mode]; + } else { + if (!m_xClipboard[mode]) + m_xClipboard[mode] = new QXcbClipboardMime(mode, this); + + return m_xClipboard[mode]; + } +} + +void QXcbClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +{ + if (mode > QClipboard::Selection) + return; + + xcb_atom_t modeAtom = atomForMode(mode); + + if (m_clientClipboard[mode] == data) + return; + + xcb_window_t newOwner = XCB_NONE; + + if (m_clientClipboard[QClipboard::Clipboard] != m_clientClipboard[QClipboard::Selection]) + delete m_clientClipboard[mode]; + m_clientClipboard[mode] = 0; + m_timestamp[mode] = XCB_CURRENT_TIME; + + if (data) { + newOwner = owner(); + + m_clientClipboard[mode] = data; + m_timestamp[mode] = connection()->time(); + } + + xcb_set_selection_owner(xcb_connection(), newOwner, modeAtom, connection()->time()); + + if (getSelectionOwner(modeAtom) != newOwner) { + qWarning("QClipboard::setData: Cannot set X11 selection owner"); + } + +} + +bool QXcbClipboard::supportsMode(QClipboard::Mode mode) const +{ + if (mode <= QClipboard::Selection) + return true; + return false; +} + +bool QXcbClipboard::ownsMode(QClipboard::Mode mode) const +{ + if (m_owner == XCB_NONE || mode > QClipboard::Selection) + return false; + + Q_ASSERT(m_timestamp[mode] == XCB_CURRENT_TIME || getSelectionOwner(atomForMode(mode)) == m_owner); + + return m_timestamp[mode] != XCB_CURRENT_TIME; +} + +xcb_window_t QXcbClipboard::requestor() const +{ + if (!m_requestor) { + const int x = 0, y = 0, w = 3, h = 3; + QXcbClipboard *that = const_cast(this); + + xcb_window_t window = xcb_generate_id(xcb_connection()); + Q_XCB_CALL(xcb_create_window(xcb_connection(), + XCB_COPY_FROM_PARENT, // depth -- same as root + window, // window id + m_screen->screen()->root, // parent window id + x, y, w, h, + 0, // border width + XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class + m_screen->screen()->root_visual, // visual + 0, // value mask + 0)); // value list + + uint32_t mask = XCB_EVENT_MASK_PROPERTY_CHANGE; + xcb_change_window_attributes(xcb_connection(), window, XCB_CW_EVENT_MASK, &mask); + + that->setRequestor(window); + } + return m_requestor; +} + +void QXcbClipboard::setRequestor(xcb_window_t window) +{ + if (m_requestor != XCB_NONE) { + xcb_destroy_window(xcb_connection(), m_requestor); + } + m_requestor = window; +} + +xcb_window_t QXcbClipboard::owner() const +{ + return m_owner; +} + +xcb_atom_t QXcbClipboard::sendTargetsSelection(QMimeData *d, xcb_window_t window, xcb_atom_t property) +{ + QVector types; + QStringList formats = QInternalMimeData::formatsHelper(d); + for (int i = 0; i < formats.size(); ++i) { + QList atoms = QXcbMime::mimeAtomsForFormat(connection(), formats.at(i)); + for (int j = 0; j < atoms.size(); ++j) { + if (!types.contains(atoms.at(j))) + types.append(atoms.at(j)); + } + } + types.append(atom(QXcbAtom::TARGETS)); + types.append(atom(QXcbAtom::MULTIPLE)); + types.append(atom(QXcbAtom::TIMESTAMP)); + types.append(atom(QXcbAtom::SAVE_TARGETS)); + + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, window, property, XCB_ATOM_ATOM, + 32, types.size(), (const void *)types.constData()); + return property; +} + +xcb_atom_t QXcbClipboard::sendSelection(QMimeData *d, xcb_atom_t target, xcb_window_t window, xcb_atom_t property) +{ + xcb_atom_t atomFormat = target; + int dataFormat = 0; + QByteArray data; + + QString fmt = QXcbMime::mimeAtomToString(connection(), target); + if (fmt.isEmpty()) { // Not a MIME type we have +// qDebug() << "QClipboard: send_selection(): converting to type" << connection()->atomName(target) << "is not supported"; + return XCB_NONE; + } +// qDebug() << "QClipboard: send_selection(): converting to type" << fmt; + + if (QXcbMime::mimeDataForAtom(connection(), target, d, &data, &atomFormat, &dataFormat)) { + + // don't allow INCR transfers when using MULTIPLE or to + // Motif clients (since Motif doesn't support INCR) + static xcb_atom_t motif_clip_temporary = atom(QXcbAtom::CLIP_TEMPORARY); + bool allow_incr = property != motif_clip_temporary; + + // X_ChangeProperty protocol request is 24 bytes + const int increment = (xcb_get_maximum_request_length(xcb_connection()) * 4) - 24; + if (data.size() > increment && allow_incr) { + long bytes = data.size(); + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, window, property, + atom(QXcbAtom::INCR), 32, 1, (const void *)&bytes); + +// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); + qWarning() << "not implemented INCR just YET!"; + return property; + } + + // make sure we can perform the XChangeProperty in a single request + if (data.size() > increment) + return XCB_NONE; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? + int dataSize = data.size() / (dataFormat / 8); + // use a single request to transfer data + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, window, property, atomFormat, + dataFormat, dataSize, (const void *)data.constData()); + } + return property; +} + +void QXcbClipboard::handleSelectionClearRequest(xcb_selection_clear_event_t *event) +{ + QClipboard::Mode mode = modeForAtom(event->selection); + if (mode > QClipboard::Selection) + return; + + // ignore the event if it was generated before we gained selection ownership + if (m_timestamp[mode] != XCB_CURRENT_TIME && event->time <= m_timestamp[mode]) + return; + +// DEBUG("QClipboard: new selection owner 0x%lx at time %lx (ours %lx)", +// XGetSelectionOwner(dpy, XA_PRIMARY), +// xevent->xselectionclear.time, d->timestamp); + +// if (!waiting_for_data) { + setMimeData(0, mode); + emitChanged(mode); +// } else { +// pending_selection_changed = true; +// if (! pending_timer_id) +// pending_timer_id = QApplication::clipboard()->startTimer(0); +// } +} + +void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req) +{ + if (requestor() && req->requestor == requestor()) { + qDebug() << "This should be caught before"; + return; + } + + xcb_selection_notify_event_t event; + event.response_type = XCB_SELECTION_NOTIFY; + event.requestor = req->requestor; + event.selection = req->selection; + event.target = req->target; + event.property = XCB_NONE; + event.time = req->time; + + QMimeData *d; + QClipboard::Mode mode = modeForAtom(req->selection); + if (mode > QClipboard::Selection) { + qWarning() << "QClipboard: Unknown selection" << connection()->atomName(req->selection); + xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event); + return; + } + + d = m_clientClipboard[mode]; + + if (!d) { + qWarning("QClipboard: Cannot transfer data, no data available"); + xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event); + return; + } + + if (m_timestamp[mode] == XCB_CURRENT_TIME // we don't own the selection anymore + || (req->time != XCB_CURRENT_TIME && req->time < m_timestamp[mode])) { + qDebug("QClipboard: SelectionRequest too old"); + xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event); + return; + } + + xcb_atom_t xa_targets = atom(QXcbAtom::TARGETS); + xcb_atom_t xa_multiple = atom(QXcbAtom::MULTIPLE); + xcb_atom_t xa_timestamp = atom(QXcbAtom::TIMESTAMP); + + struct AtomPair { xcb_atom_t target; xcb_atom_t property; } *multi = 0; + xcb_atom_t multi_type = XCB_NONE; + int multi_format = 0; + int nmulti = 0; + int imulti = -1; + bool multi_writeback = false; + + if (req->target == xa_multiple) { + QByteArray multi_data; + if (req->property == XCB_NONE + || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, + 0, &multi_type, &multi_format) + || multi_format != 32) { + // MULTIPLE property not formatted correctly + xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event); + return; + } + nmulti = multi_data.size()/sizeof(*multi); + multi = new AtomPair[nmulti]; + memcpy(multi,multi_data.data(),multi_data.size()); + imulti = 0; + } + + for (; imulti < nmulti; ++imulti) { + xcb_atom_t target; + xcb_atom_t property; + + if (multi) { + target = multi[imulti].target; + property = multi[imulti].property; + } else { + target = req->target; + property = req->property; + if (property == XCB_NONE) // obsolete client + property = target; + } + + xcb_atom_t ret = XCB_NONE; + if (target == XCB_NONE || property == XCB_NONE) { + ; + } else if (target == xa_timestamp) { + if (m_timestamp[mode] != XCB_CURRENT_TIME) { + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, req->requestor, + property, XCB_ATOM_INTEGER, 32, 1, &m_timestamp[mode]); + ret = property; + } else { + qWarning("QClipboard: Invalid data timestamp"); + } + } else if (target == xa_targets) { + ret = sendTargetsSelection(d, req->requestor, property); + } else { + ret = sendSelection(d, target, req->requestor, property); + } + + if (nmulti > 0) { + if (ret == XCB_NONE) { + multi[imulti].property = XCB_NONE; + multi_writeback = true; + } + } else { + event.property = ret; + break; + } + } + + if (nmulti > 0) { + if (multi_writeback) { + // according to ICCCM 2.6.2 says to put None back + // into the original property on the requestor window + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, req->requestor, req->property, + multi_type, 32, nmulti*2, (const void *)multi); + } + + delete [] multi; + event.property = req->property; + } + + // send selection notify to requestor + xcb_send_event(xcb_connection(), false, req->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)&event); +} + +void QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_event_t *event) +{ + QClipboard::Mode mode = modeForAtom(event->selection); + if (event->owner != owner() && m_clientClipboard[mode] && m_timestamp[mode] < event->selection_timestamp) { + setMimeData(0, mode); + emitChanged(mode); + } +} + + +static inline int maxSelectionIncr(xcb_connection_t *c) +{ + int l = xcb_get_maximum_request_length(c); + return (l > 65536 ? 65536*4 : l*4) - 100; +} + +bool QXcbClipboard::clipboardReadProperty(xcb_window_t win, xcb_atom_t property, bool deleteProperty, QByteArray *buffer, int *size, xcb_atom_t *type, int *format) const +{ + int maxsize = maxSelectionIncr(xcb_connection()); + ulong bytes_left; // bytes_after + xcb_atom_t dummy_type; + int dummy_format; + + if (!type) // allow null args + type = &dummy_type; + if (!format) + format = &dummy_format; + + // Don't read anything, just get the size of the property data + xcb_get_property_cookie_t cookie = Q_XCB_CALL(xcb_get_property(xcb_connection(), false, win, property, XCB_GET_PROPERTY_TYPE_ANY, 0, 0)); + xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); + if (!reply || reply->type == XCB_NONE) { + buffer->resize(0); + return false; + } + *type = reply->type; + *format = reply->format; + bytes_left = reply->bytes_after; + free(reply); + + int offset = 0, buffer_offset = 0, format_inc = 1, proplen = bytes_left; + + switch (*format) { + case 8: + default: + format_inc = sizeof(char) / 1; + break; + + case 16: + format_inc = sizeof(short) / 2; + proplen *= sizeof(short) / 2; + break; + + case 32: + format_inc = sizeof(long) / 4; + proplen *= sizeof(long) / 4; + break; + } + + int newSize = proplen; + buffer->resize(newSize); + + bool ok = (buffer->size() == newSize); + + if (ok && newSize) { + // could allocate buffer + + while (bytes_left) { + // more to read... + + xcb_get_property_cookie_t cookie = Q_XCB_CALL(xcb_get_property(xcb_connection(), false, win, property, XCB_GET_PROPERTY_TYPE_ANY, offset, maxsize/4)); + reply = xcb_get_property_reply(xcb_connection(), cookie, 0); + if (!reply || reply->type == XCB_NONE) { + free(reply); + break; + } + *type = reply->type; + *format = reply->format; + bytes_left = reply->bytes_after; + char *data = (char *)xcb_get_property_value(reply); + int length = xcb_get_property_value_length(reply); + + offset += length / (32 / *format); + length *= format_inc * (*format) / 8; + + // Here we check if we get a buffer overflow and tries to + // recover -- this shouldn't normally happen, but it doesn't + // hurt to be defensive + if ((int)(buffer_offset + length) > buffer->size()) { + length = buffer->size() - buffer_offset; + + // escape loop + bytes_left = 0; + } + + memcpy(buffer->data() + buffer_offset, data, length); + buffer_offset += length; + + free(reply); + } + } + + + // correct size, not 0-term. + if (size) + *size = buffer_offset; + + if (deleteProperty) + xcb_delete_property(xcb_connection(), win, property); + + connection()->flush(); + + return ok; +} + + +namespace +{ + class Notify { + public: + Notify(xcb_window_t win, int t) + : window(win), type(t) {} + xcb_window_t window; + int type; + bool check(xcb_generic_event_t *event) const { + if (!event) + return false; + int t = event->response_type & 0x7f; + if (t != type) + return false; + if (t == XCB_PROPERTY_NOTIFY) { + xcb_property_notify_event_t *pn = (xcb_property_notify_event_t *)event; + if (pn->window == window) + return true; + } else if (t == XCB_SELECTION_NOTIFY) { + xcb_selection_notify_event_t *sn = (xcb_selection_notify_event_t *)event; + if (sn->requestor == window) + return true; + } + return false; + } + }; + class ClipboardEvent { + public: + ClipboardEvent(QXcbConnection *c) + { clipboard = c->internAtom("CLIPBOARD"); } + xcb_atom_t clipboard; + bool check(xcb_generic_event_t *e) const { + if (!e) + return false; + int type = e->response_type & 0x7f; + if (type == XCB_SELECTION_REQUEST) { + xcb_selection_request_event_t *sr = (xcb_selection_request_event_t *)e; + return sr->selection == XCB_ATOM_PRIMARY || sr->selection == clipboard; + } else if (type == XCB_SELECTION_CLEAR) { + xcb_selection_clear_event_t *sc = (xcb_selection_clear_event_t *)e; + return sc->selection == XCB_ATOM_PRIMARY || sc->selection == clipboard; + } + return false; + } + }; +} + +xcb_generic_event_t *QXcbClipboard::waitForClipboardEvent(xcb_window_t win, int type, int timeout) +{ + QElapsedTimer timer; + timer.start(); + do { + Notify notify(win, type); + xcb_generic_event_t *e = connection()->checkEvent(notify); + if (e) + return e; + + // process other clipboard events, since someone is probably requesting data from us + ClipboardEvent clipboard(connection()); + e = connection()->checkEvent(clipboard); + if (e) { + connection()->handleXcbEvent(e); + free(e); + } + + connection()->flush(); + + // sleep 50 ms, so we don't use up CPU cycles all the time. + struct timeval usleep_tv; + usleep_tv.tv_sec = 0; + usleep_tv.tv_usec = 50000; + select(0, 0, 0, 0, &usleep_tv); + } while (timer.elapsed() < timeout); + + return 0; +} + +QByteArray QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb_atom_t property, int nbytes, bool nullterm) +{ + QByteArray buf; + QByteArray tmp_buf; + bool alloc_error = false; + int length; + int offset = 0; + + if (nbytes > 0) { + // Reserve buffer + zero-terminator (for text data) + // We want to complete the INCR transfer even if we cannot + // allocate more memory + buf.resize(nbytes+1); + alloc_error = buf.size() != nbytes+1; + } + + for (;;) { + connection()->flush(); + xcb_generic_event_t *ge = waitForClipboardEvent(win, XCB_PROPERTY_NOTIFY, clipboard_timeout); + if (!ge) + break; + + xcb_property_notify_event_t *event = (xcb_property_notify_event_t *)ge; + if (event->atom != property || event->state != XCB_PROPERTY_NEW_VALUE) + continue; + if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { + if (length == 0) { // no more data, we're done + if (nullterm) { + buf.resize(offset+1); + buf[offset] = '\0'; + } else { + buf.resize(offset); + } + return buf; + } else if (!alloc_error) { + if (offset+length > (int)buf.size()) { + buf.resize(offset+length+65535); + if (buf.size() != offset+length+65535) { + alloc_error = true; + length = buf.size() - offset; + } + } + memcpy(buf.data()+offset, tmp_buf.constData(), length); + tmp_buf.resize(0); + offset += length; + } + } else { + break; + } + + free(ge); + } + + // timed out ... create a new requestor window, otherwise the requestor + // could consider next request to be still part of this timed out request + setRequestor(0); + + return QByteArray(); +} + +QByteArray QXcbClipboard::getDataInFormat(xcb_atom_t modeAtom, xcb_atom_t fmtAtom) +{ + return getSelection(modeAtom, fmtAtom, atom(QXcbAtom::_QT_SELECTION)); +} + +QByteArray QXcbClipboard::getSelection(xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property) +{ + QByteArray buf; + xcb_window_t win = requestor(); + + xcb_delete_property(xcb_connection(), win, property); + xcb_convert_selection(xcb_connection(), win, selection, target, property, connection()->time()); + + connection()->sync(); + + xcb_generic_event_t *ge = waitForClipboardEvent(win, XCB_SELECTION_NOTIFY, clipboard_timeout); + bool no_selection = !ge || ((xcb_selection_notify_event_t *)ge)->property == XCB_NONE; + free(ge); + + if (no_selection) + return buf; + + xcb_atom_t type; + if (clipboardReadProperty(win, property, true, &buf, 0, &type, 0)) { + if (type == atom(QXcbAtom::INCR)) { + int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; + buf = clipboardReadIncrementalProperty(win, property, nbytes, false); + } + } + + return buf; +} + +#include "qxcbclipboard.moc" diff --git a/src/plugins/platforms/xcb/qxcbclipboard.h b/src/plugins/platforms/xcb/qxcbclipboard.h new file mode 100644 index 00000000000..d23f93529bc --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbclipboard.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the 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 QXCBCLIPBOARD_H +#define QXCBCLIPBOARD_H + +#include +#include +#include +#include + +class QXcbConnection; +class QXcbScreen; +class QXcbClipboardMime; + +class QXcbClipboard : public QXcbObject, public QPlatformClipboard +{ +public: + QXcbClipboard(QXcbConnection *connection); + ~QXcbClipboard(); + + QMimeData *mimeData(QClipboard::Mode mode); + void setMimeData(QMimeData *data, QClipboard::Mode mode); + + bool supportsMode(QClipboard::Mode mode) const; + bool ownsMode(QClipboard::Mode mode) const; + + QXcbScreen *screen() const { return m_screen; } + + xcb_window_t requestor() const; + void setRequestor(xcb_window_t window); + + xcb_window_t owner() const; + + void handleSelectionRequest(xcb_selection_request_event_t *event); + void handleSelectionClearRequest(xcb_selection_clear_event_t *event); + void handleXFixesSelectionRequest(xcb_xfixes_selection_notify_event_t *event); + + bool clipboardReadProperty(xcb_window_t win, xcb_atom_t property, bool deleteProperty, QByteArray *buffer, int *size, xcb_atom_t *type, int *format) const; + QByteArray clipboardReadIncrementalProperty(xcb_window_t win, xcb_atom_t property, int nbytes, bool nullterm); + + QByteArray getDataInFormat(xcb_atom_t modeAtom, xcb_atom_t fmtatom); + + xcb_window_t getSelectionOwner(xcb_atom_t atom) const; + QByteArray getSelection(xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property); + +private: + xcb_generic_event_t *waitForClipboardEvent(xcb_window_t win, int type, int timeout); + + xcb_atom_t sendTargetsSelection(QMimeData *d, xcb_window_t window, xcb_atom_t property); + xcb_atom_t sendSelection(QMimeData *d, xcb_atom_t target, xcb_window_t window, xcb_atom_t property); + + xcb_atom_t atomForMode(QClipboard::Mode mode) const; + QClipboard::Mode modeForAtom(xcb_atom_t atom) const; + + QXcbScreen *m_screen; + + // Selection and Clipboard + QXcbClipboardMime *m_xClipboard[2]; + QMimeData *m_clientClipboard[2]; + xcb_timestamp_t m_timestamp[2]; + + xcb_window_t m_requestor; + xcb_window_t m_owner; + + static const int clipboard_timeout; + +}; + +#endif // QXCBCLIPBOARD_H diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 80a1624380f..a0b894602db 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -39,33 +39,41 @@ ** ****************************************************************************/ +#include +#include + #include "qxcbconnection.h" #include "qxcbkeyboard.h" #include "qxcbscreen.h" #include "qxcbwindow.h" +#include "qxcbclipboard.h" +#include "qxcbdrag.h" +#include "qxcbwmsupport.h" #include #include -#include #include - -#include +#include #include #include +#include #ifdef XCB_USE_XLIB #include #include #endif +#ifdef XCB_USE_RENDER +#include +#endif + #ifdef XCB_USE_EGL //dont pull in eglext prototypes #include #endif #ifdef XCB_USE_DRI2 #include -#include extern "C" { #include } @@ -83,12 +91,13 @@ QXcbConnection::QXcbConnection(const char *displayName) , m_dri2_support_probed(false) , m_has_support_for_dri2(false) #endif + , xfixes_first_event(0) { - int primaryScreen = 0; + m_primaryScreen = 0; #ifdef XCB_USE_XLIB Display *dpy = XOpenDisplay(m_displayName.constData()); - primaryScreen = DefaultScreen(dpy); + m_primaryScreen = DefaultScreen(dpy); m_connection = XGetXCBConnection(dpy); XSetEventQueueOwner(dpy, XCBOwnsEventQueue); m_xlib_display = dpy; @@ -100,13 +109,33 @@ QXcbConnection::QXcbConnection(const char *displayName) m_has_egl = eglInitialize(eglDisplay,&major,&minor); #endif //XCB_USE_EGL #else - m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); - + m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreen); #endif //XCB_USE_XLIB + + if (m_connection) + printf("Successfully connected to display %s\n", m_displayName.constData()); + + m_reader = new QXcbEventReader(m_connection); +#ifdef XCB_POLL_FOR_QUEUED_EVENT + connect(m_reader, SIGNAL(eventPending()), this, SLOT(processXcbEvents()), Qt::QueuedConnection); + m_reader->start(); +#else + QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this); + connect(notifier, SIGNAL(activated(int)), this, SLOT(processXcbEvents())); + + QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::eventDispatcher; + connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(processXcbEvents())); + connect(dispatcher, SIGNAL(awake()), this, SLOT(processXcbEvents())); +#endif + + xcb_prefetch_extension_data (m_connection, &xcb_xfixes_id); + m_setup = xcb_get_setup(xcb_connection()); initializeAllAtoms(); + m_time = XCB_CURRENT_TIME; + xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); int screenNumber = 0; @@ -115,25 +144,38 @@ QXcbConnection::QXcbConnection(const char *displayName) xcb_screen_next(&it); } + m_connectionEventListener = xcb_generate_id(m_connection); + xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, + m_connectionEventListener, m_screens.at(0)->root(), + 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY, + m_screens.at(0)->screen()->root_visual, 0, 0); + + initializeXFixes(); + initializeXRender(); + + m_wmSupport = new QXcbWMSupport(this); m_keyboard = new QXcbKeyboard(this); + m_clipboard = new QXcbClipboard(this); + m_drag = new QXcbDrag(this); #ifdef XCB_USE_DRI2 initializeDri2(); #endif - - QSocketNotifier *notifier = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)), this, SLOT(processXcbEvents())); - - QAbstractEventDispatcher *dispatcher = QAbstractEventDispatcher::instance(qApp->thread()); - connect(dispatcher, SIGNAL(aboutToBlock()), this, SLOT(processXcbEvents())); - sync(); } QXcbConnection::~QXcbConnection() { + delete m_clipboard; + qDeleteAll(m_screens); +#ifdef XCB_POLL_FOR_QUEUED_EVENT + sendConnectionEvent(QXcbAtom::_QT_CLOSE_CONNECTION); + m_reader->wait(); +#endif + delete m_reader; + #ifdef XCB_USE_XLIB XCloseDisplay((Display *)m_xlib_display); #else @@ -143,22 +185,26 @@ QXcbConnection::~QXcbConnection() delete m_keyboard; } -QXcbWindow *platformWindowFromId(xcb_window_t id) +void QXcbConnection::addWindow(xcb_window_t id, QXcbWindow *window) { - QWidget *widget = QWidget::find(id); - if (widget) - return static_cast(widget->platformWindow()); - return 0; + m_mapper.insert(id, window); } -#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, window, handler) \ +void QXcbConnection::removeWindow(xcb_window_t id) +{ + m_mapper.remove(id); +} + +QXcbWindow *QXcbConnection::platformWindowFromId(xcb_window_t id) +{ + return m_mapper.value(id, 0); +} + +#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, windowMember, handler) \ { \ event_t *e = (event_t *)event; \ - if (QXcbWindow *platformWindow = platformWindowFromId(e->window)) { \ - QObjectPrivate *d = QObjectPrivate::get(platformWindow->widget()); \ - if (!d->wasDeleted) \ - platformWindow->handler(e); \ - } \ + if (QXcbWindow *platformWindow = platformWindowFromId(e->windowMember)) \ + platformWindow->handler(e); \ } \ break; @@ -166,7 +212,7 @@ break; { \ event_t *e = (event_t *)event; \ if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) \ - m_keyboard->handler(platformWindow->widget(), e); \ + m_keyboard->handler(platformWindow, e); \ } \ break; @@ -373,6 +419,7 @@ const char *xcb_protocol_request_codes[] = #ifdef Q_XCB_DEBUG void QXcbConnection::log(const char *file, int line, int sequence) { + QMutexLocker locker(&m_callLogMutex); CallInfo info; info.sequence = sequence; info.file = file; @@ -392,6 +439,7 @@ void QXcbConnection::handleXcbError(xcb_generic_error_t *error) int(error->major_code), xcb_protocol_request_codes[clamped_major_code], int(error->minor_code)); #ifdef Q_XCB_DEBUG + QMutexLocker locker(&m_callLogMutex); int i = 0; for (; i < m_callLog.size(); ++i) { if (m_callLog.at(i).sequence == error->sequence) { @@ -409,69 +457,238 @@ void QXcbConnection::handleXcbError(xcb_generic_error_t *error) #endif } +void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) +{ +#ifdef Q_XCB_DEBUG + { + QMutexLocker locker(&m_callLogMutex); + int i = 0; + for (; i < m_callLog.size(); ++i) + if (m_callLog.at(i).sequence >= event->sequence) + break; + m_callLog.remove(0, i); + } +#endif + bool handled = true; + + uint response_type = event->response_type & ~0x80; + + switch (response_type) { + case XCB_EXPOSE: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent); + case XCB_BUTTON_PRESS: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_press_event_t, event, handleButtonPressEvent); + case XCB_BUTTON_RELEASE: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent); + case XCB_MOTION_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent); + case XCB_CONFIGURE_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent); + case XCB_MAP_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_map_notify_event_t, event, handleMapNotifyEvent); + case XCB_UNMAP_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_unmap_notify_event_t, event, handleUnmapNotifyEvent); + case XCB_CLIENT_MESSAGE: + handleClientMessageEvent((xcb_client_message_event_t *)event); + case XCB_ENTER_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent); + case XCB_LEAVE_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_leave_notify_event_t, event, handleLeaveNotifyEvent); + case XCB_FOCUS_IN: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_in_event_t, event, handleFocusInEvent); + case XCB_FOCUS_OUT: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_out_event_t, event, handleFocusOutEvent); + case XCB_KEY_PRESS: + HANDLE_KEYBOARD_EVENT(xcb_key_press_event_t, handleKeyPressEvent); + case XCB_KEY_RELEASE: + HANDLE_KEYBOARD_EVENT(xcb_key_release_event_t, handleKeyReleaseEvent); + case XCB_MAPPING_NOTIFY: + m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); + break; + case XCB_SELECTION_REQUEST: + { + xcb_selection_request_event_t *sr = (xcb_selection_request_event_t *)event; + if (sr->selection == atom(QXcbAtom::XdndSelection)) + m_drag->handleSelectionRequest(sr); + else + m_clipboard->handleSelectionRequest(sr); + break; + } + case XCB_SELECTION_CLEAR: + setTime(((xcb_selection_clear_event_t *)event)->time); + m_clipboard->handleSelectionClearRequest((xcb_selection_clear_event_t *)event); + handled = true; + break; + case XCB_SELECTION_NOTIFY: + setTime(((xcb_selection_notify_event_t *)event)->time); + qDebug() << "XCB_SELECTION_NOTIFY"; + handled = false; + break; + case XCB_PROPERTY_NOTIFY: + setTime(((xcb_property_notify_event_t *)event)->time); +// qDebug() << "XCB_PROPERTY_NOTIFY"; + handled = false; + break; + default: + handled = false; + break; + } + + if (!handled) { + if (response_type == xfixes_first_event + XCB_XFIXES_SELECTION_NOTIFY) { + setTime(((xcb_xfixes_selection_notify_event_t *)event)->timestamp); + m_clipboard->handleXFixesSelectionRequest((xcb_xfixes_selection_notify_event_t *)event); + handled = true; + } + } + + if (handled) + printXcbEvent("Handled XCB event", event); + else + printXcbEvent("Unhandled XCB event", event); +} + +void QXcbConnection::addPeekFunc(PeekFunc f) +{ + m_peekFuncs.append(f); +} + +#ifdef XCB_POLL_FOR_QUEUED_EVENT +void QXcbEventReader::run() +{ + xcb_generic_event_t *event; + while (m_connection && (event = xcb_wait_for_event(m_connection))) { + m_mutex.lock(); + addEvent(event); + while (m_connection && (event = xcb_poll_for_queued_event(m_connection))) + addEvent(event); + m_mutex.unlock(); + emit eventPending(); + } + + for (int i = 0; i < m_events.size(); ++i) + free(m_events.at(i)); +} +#endif + +void QXcbEventReader::addEvent(xcb_generic_event_t *event) +{ + if ((event->response_type & ~0x80) == XCB_CLIENT_MESSAGE + && ((xcb_client_message_event_t *)event)->type == QXcbAtom::_QT_CLOSE_CONNECTION) + m_connection = 0; + m_events << event; +} + +QList *QXcbEventReader::lock() +{ + m_mutex.lock(); +#ifndef XCB_POLL_FOR_QUEUED_EVENT + while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection)) + m_events << event; +#endif + return &m_events; +} + +void QXcbEventReader::unlock() +{ + m_mutex.unlock(); +} + +void QXcbConnection::sendConnectionEvent(QXcbAtom::Atom atom, uint id) +{ + xcb_client_message_event_t event; + memset(&event, 0, sizeof(event)); + + event.response_type = XCB_CLIENT_MESSAGE; + event.format = 32; + event.sequence = 0; + event.window = m_connectionEventListener; + event.type = atom; + event.data.data32[0] = id; + + Q_XCB_CALL(xcb_send_event(xcb_connection(), false, m_connectionEventListener, XCB_EVENT_MASK_NO_EVENT, (const char *)&event)); + xcb_flush(xcb_connection()); +} + void QXcbConnection::processXcbEvents() { - while (xcb_generic_event_t *event = xcb_poll_for_event(xcb_connection())) { - bool handled = true; + QList *eventqueue = m_reader->lock(); + + for(int i = 0; i < eventqueue->size(); ++i) { + xcb_generic_event_t *event = eventqueue->at(i); + if (!event) + continue; + (*eventqueue)[i] = 0; uint response_type = event->response_type & ~0x80; if (!response_type) { handleXcbError((xcb_generic_error_t *)event); - continue; + } else { + QVector::iterator it = m_peekFuncs.begin(); + while (it != m_peekFuncs.end()) { + // These callbacks return true if the event is what they were + // waiting for, remove them from the list in that case. + if ((*it)(event)) + it = m_peekFuncs.erase(it); + else + ++it; + } + handleXcbEvent(event); } -#ifdef Q_XCB_DEBUG - { - int i = 0; - for (; i < m_callLog.size(); ++i) - if (m_callLog.at(i).sequence >= event->sequence) - break; - m_callLog.remove(0, i); - } -#endif - - switch (response_type) { - case XCB_EXPOSE: - HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent); - case XCB_BUTTON_PRESS: - HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_press_event_t, event, handleButtonPressEvent); - case XCB_BUTTON_RELEASE: - HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent); - case XCB_MOTION_NOTIFY: - HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent); - case XCB_CONFIGURE_NOTIFY: - HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent); - case XCB_CLIENT_MESSAGE: - HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent); - case XCB_ENTER_NOTIFY: - HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent); - case XCB_LEAVE_NOTIFY: - HANDLE_PLATFORM_WINDOW_EVENT(xcb_leave_notify_event_t, event, handleLeaveNotifyEvent); - case XCB_FOCUS_IN: - HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_in_event_t, event, handleFocusInEvent); - case XCB_FOCUS_OUT: - HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_out_event_t, event, handleFocusOutEvent); - case XCB_KEY_PRESS: - HANDLE_KEYBOARD_EVENT(xcb_key_press_event_t, handleKeyPressEvent); - case XCB_KEY_RELEASE: - HANDLE_KEYBOARD_EVENT(xcb_key_release_event_t, handleKeyReleaseEvent); - case XCB_MAPPING_NOTIFY: - m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); - break; - default: - handled = false; - break; - } - if (handled) - printXcbEvent("Handled XCB event", event); - else - printXcbEvent("Unhandled XCB event", event); + free(event); } + eventqueue->clear(); + + m_reader->unlock(); + + // Indicate with a null event that the event the callbacks are waiting for + // is not in the queue currently. + Q_FOREACH (PeekFunc f, m_peekFuncs) + f(0); + m_peekFuncs.clear(); + xcb_flush(xcb_connection()); } +void QXcbConnection::handleClientMessageEvent(const xcb_client_message_event_t *event) +{ + if (event->format != 32) + return; + + if (event->type == atom(QXcbAtom::XdndStatus)) { + drag()->handleStatus(event, false); + } else if (event->type == atom(QXcbAtom::XdndFinished)) { + drag()->handleFinished(event, false); + } + + QXcbWindow *window = platformWindowFromId(event->window); + if (!window) + return; + + window->handleClientMessageEvent(event); +} + +xcb_generic_event_t *QXcbConnection::checkEvent(int type) +{ + QList *eventqueue = m_reader->lock(); + + for (int i = 0; i < eventqueue->size(); ++i) { + xcb_generic_event_t *event = eventqueue->at(i); + if (event->response_type == type) { + (*eventqueue)[i] = 0; + m_reader->unlock(); + return event; + } + } + + m_reader->unlock(); + + return 0; +} + static const char * xcb_atomnames = { // window-manager <-> client protocols "WM_PROTOCOLS\0" @@ -511,6 +728,8 @@ static const char * xcb_atomnames = { "_QT_SCROLL_DONE\0" "_QT_INPUT_ENCODING\0" + "_QT_CLOSE_CONNECTION\0" + "_MOTIF_WM_HINTS\0" "DTWM_IS_RUNNING\0" @@ -579,7 +798,6 @@ static const char * xcb_atomnames = { "_NET_ACTIVE_WINDOW\0" // Property formats - "COMPOUND_TEXT\0" "TEXT\0" "UTF8_STRING\0" @@ -659,8 +877,57 @@ void QXcbConnection::initializeAllAtoms() { for (i = 0; i < QXcbAtom::NAtoms; ++i) cookies[i] = xcb_intern_atom(xcb_connection(), false, strlen(names[i]), names[i]); - for (i = 0; i < QXcbAtom::NAtoms; ++i) - m_allAtoms[i] = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0)->atom; + for (i = 0; i < QXcbAtom::NAtoms; ++i) { + xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0); + m_allAtoms[i] = reply->atom; + free(reply); + } +} + +xcb_atom_t QXcbConnection::internAtom(const char *name) +{ + if (!name || *name == 0) + return XCB_NONE; + + xcb_intern_atom_cookie_t cookie = xcb_intern_atom(xcb_connection(), false, strlen(name), name); + xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(xcb_connection(), cookie, 0); + int atom = reply->atom; + free(reply); + return atom; +} + +QByteArray QXcbConnection::atomName(xcb_atom_t atom) +{ + if (!atom) + return QByteArray(); + + xcb_generic_error_t *error = 0; + xcb_get_atom_name_cookie_t cookie = Q_XCB_CALL(xcb_get_atom_name(xcb_connection(), atom)); + xcb_get_atom_name_reply_t *reply = xcb_get_atom_name_reply(xcb_connection(), cookie, &error); + if (error) { + qWarning() << "QXcbConnection::atomName: bad Atom" << atom; + } + if (reply) { + QByteArray result(xcb_get_atom_name_name(reply), xcb_get_atom_name_name_length(reply)); + free(reply); + return result; + } + return QByteArray(); +} + +const xcb_format_t *QXcbConnection::formatForDepth(uint8_t depth) const +{ + xcb_format_iterator_t iterator = + xcb_setup_pixmap_formats_iterator(m_setup); + + while (iterator.rem) { + xcb_format_t *format = iterator.data; + if (format->depth == depth) + return format; + xcb_format_next(&iterator); + } + + return 0; } void QXcbConnection::sync() @@ -670,6 +937,43 @@ void QXcbConnection::sync() free(xcb_get_input_focus_reply(xcb_connection(), cookie, 0)); } +void QXcbConnection::initializeXFixes() +{ + xcb_generic_error_t *error = 0; + const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xfixes_id); + xfixes_first_event = reply->first_event; + + xcb_xfixes_query_version_cookie_t xfixes_query_cookie = xcb_xfixes_query_version(m_connection, + XCB_XFIXES_MAJOR_VERSION, + XCB_XFIXES_MINOR_VERSION); + xcb_xfixes_query_version_reply_t *xfixes_query = xcb_xfixes_query_version_reply (m_connection, + xfixes_query_cookie, &error); + if (!xfixes_query || error || xfixes_query->major_version < 2) { + qWarning("Failed to initialize XFixes"); + free(error); + xfixes_first_event = 0; + } + free(xfixes_query); + +} + +void QXcbConnection::initializeXRender() +{ +#ifdef XCB_USE_RENDER + xcb_generic_error_t *error = 0; + xcb_render_query_version_cookie_t xrender_query_cookie = xcb_render_query_version(m_connection, + XCB_RENDER_MAJOR_VERSION, + XCB_RENDER_MINOR_VERSION); + xcb_render_query_version_reply_t *xrender_query = xcb_render_query_version_reply(m_connection, + xrender_query_cookie, &error); + if (!xrender_query || error || (xrender_query->major_version == 0 && xrender_query->minor_version < 5)) { + qWarning("Failed to initialize XRender"); + free(error); + } + free(xrender_query); +#endif +} + #if defined(XCB_USE_EGL) bool QXcbConnection::hasEgl() const { @@ -740,26 +1044,12 @@ bool QXcbConnection::hasSupportForDri2() const if (!m_dri2_support_probed) { xcb_generic_error_t *error = 0; - xcb_prefetch_extension_data (m_connection, &xcb_xfixes_id); xcb_prefetch_extension_data (m_connection, &xcb_dri2_id); - xcb_xfixes_query_version_cookie_t xfixes_query_cookie = xcb_xfixes_query_version(m_connection, - XCB_XFIXES_MAJOR_VERSION, - XCB_XFIXES_MINOR_VERSION); - xcb_dri2_query_version_cookie_t dri2_query_cookie = xcb_dri2_query_version (m_connection, XCB_DRI2_MAJOR_VERSION, XCB_DRI2_MINOR_VERSION); - xcb_xfixes_query_version_reply_t *xfixes_query = xcb_xfixes_query_version_reply (m_connection, - xfixes_query_cookie, &error); - if (!xfixes_query || error || xfixes_query->major_version < 2) { - delete error; - delete xfixes_query; - return false; - } - delete xfixes_query; - xcb_dri2_query_version_reply_t *dri2_query = xcb_dri2_query_version_reply (m_connection, dri2_query_cookie, &error); if (!dri2_query || error) { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 01bc7195468..6d93093072d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -44,13 +44,23 @@ #include +#include #include +#include #include +#include #include #define Q_XCB_DEBUG class QXcbScreen; +class QXcbWindow; +class QXcbDrag; +class QXcbKeyboard; +class QXcbClipboard; +class QXcbWMSupport; + +typedef QHash WindowMapper; namespace QXcbAtom { enum Atom { @@ -92,6 +102,9 @@ namespace QXcbAtom { _QT_SCROLL_DONE, _QT_INPUT_ENCODING, + // Qt/XCB specific + _QT_CLOSE_CONNECTION, + _MOTIF_WM_HINTS, DTWM_IS_RUNNING, @@ -160,7 +173,6 @@ namespace QXcbAtom { _NET_ACTIVE_WINDOW, // Property formats - COMPOUND_TEXT, TEXT, UTF8_STRING, @@ -215,8 +227,34 @@ namespace QXcbAtom { }; } -class QXcbKeyboard; +class QXcbEventReader : public QThread +{ + Q_OBJECT +public: + QXcbEventReader(xcb_connection_t *connection) + : m_connection(connection) + { + } +#ifdef XCB_POLL_FOR_QUEUED_EVENT + void run(); +#endif + + QList *lock(); + void unlock(); + +signals: + void eventPending(); + +private: + void addEvent(xcb_generic_event_t *event); + + QMutex m_mutex; + QList m_events; + xcb_connection_t *m_connection; +}; + +class QAbstractEventDispatcher; class QXcbConnection : public QObject { Q_OBJECT @@ -226,17 +264,26 @@ public: QXcbConnection *connection() const { return const_cast(this); } - QList screens() const { return m_screens; } + const QList &screens() const { return m_screens; } int primaryScreen() const { return m_primaryScreen; } xcb_atom_t atom(QXcbAtom::Atom atom); + xcb_atom_t internAtom(const char *name); + QByteArray atomName(xcb_atom_t atom); const char *displayName() const { return m_displayName.constData(); } xcb_connection_t *xcb_connection() const { return m_connection; } + const xcb_setup_t *setup() const { return m_setup; } + const xcb_format_t *formatForDepth(uint8_t depth) const; QXcbKeyboard *keyboard() const { return m_keyboard; } + QXcbClipboard *clipboard() const { return m_clipboard; } + QXcbDrag *drag() const { return m_drag; } + + QXcbWMSupport *wmSupport() const { return m_wmSupport; } + #ifdef XCB_USE_XLIB void *xlib_display() const { return m_xlib_display; } #endif @@ -253,7 +300,26 @@ public: #endif void sync(); + void flush() { xcb_flush(m_connection); } + void handleXcbError(xcb_generic_error_t *error); + void handleXcbEvent(xcb_generic_event_t *event); + + void addWindow(xcb_window_t id, QXcbWindow *window); + void removeWindow(xcb_window_t id); + QXcbWindow *platformWindowFromId(xcb_window_t id); + + xcb_generic_event_t *checkEvent(int type); + template + inline xcb_generic_event_t *checkEvent(const T &checker); + + typedef bool (*PeekFunc)(xcb_generic_event_t *); + void addPeekFunc(PeekFunc f); + + inline xcb_timestamp_t time() const { return m_time; } + inline void setTime(xcb_timestamp_t t) { if (t > m_time) m_time = t; } + + bool hasXFixes() const { return xfixes_first_event > 0; } private slots: void processXcbEvents(); @@ -261,9 +327,12 @@ private slots: private: void initializeAllAtoms(); void sendConnectionEvent(QXcbAtom::Atom atom, uint id = 0); + void initializeXFixes(); + void initializeXRender(); #ifdef XCB_USE_DRI2 void initializeDri2(); #endif + void handleClientMessageEvent(const xcb_client_message_event_t *event); xcb_connection_t *m_connection; const xcb_setup_t *m_setup; @@ -273,14 +342,21 @@ private: xcb_atom_t m_allAtoms[QXcbAtom::NAtoms]; + xcb_timestamp_t m_time; + QByteArray m_displayName; + xcb_window_t m_connectionEventListener; + QXcbKeyboard *m_keyboard; + QXcbClipboard *m_clipboard; + QXcbDrag *m_drag; + QXcbWMSupport *m_wmSupport; #if defined(XCB_USE_XLIB) void *m_xlib_display; #endif - + QXcbEventReader *m_reader; #ifdef XCB_USE_DRI2 uint32_t m_dri2_major; uint32_t m_dri2_minor; @@ -299,14 +375,39 @@ private: int line; }; QVector m_callLog; + QMutex m_callLogMutex; void log(const char *file, int line, int sequence); template friend cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection, const char *file, int line); #endif + + WindowMapper m_mapper; + + QVector m_peekFuncs; + + uint32_t xfixes_first_event; }; #define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) +template +xcb_generic_event_t *QXcbConnection::checkEvent(const T &checker) +{ + QList *eventqueue = m_reader->lock(); + + for (int i = 0; i < eventqueue->size(); ++i) { + xcb_generic_event_t *event = eventqueue->at(i); + if (checker.check(event)) { + (*eventqueue)[i] = 0; + m_reader->unlock(); + return event; + } + } + m_reader->unlock(); + return 0; +} + + #ifdef Q_XCB_DEBUG template cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection, const char *file, int line) diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp new file mode 100644 index 00000000000..f6856d56946 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -0,0 +1,546 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbcursor.h" +#include "qxcbconnection.h" +#include "qxcbwindow.h" +#include "qxcbimage.h" +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +typedef int (*PtrXcursorLibraryLoadCursor)(void *, const char *); +static PtrXcursorLibraryLoadCursor ptrXcursorLibraryLoadCursor = 0; +static xcb_font_t cursorFont = 0; +static int cursorCount = 0; + +static uint8_t 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 }; + +static const uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t *cursor_bits16[] = { + cur_ver_bits, mcur_ver_bits, cur_hor_bits, mcur_hor_bits, + cur_bdiag_bits, mcur_bdiag_bits, cur_fdiag_bits, mcur_fdiag_bits, + 0, 0, cur_blank_bits, cur_blank_bits }; + +static const uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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}; + +static const uint8_t * const cursor_bits32[] = { + vsplit_bits, vsplitm_bits, hsplit_bits, hsplitm_bits, + 0, 0, 0, 0, whatsthis_bits, whatsthism_bits, busy_bits, busym_bits +}; + +static const uint8_t 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 uint8_t 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}; + +static const uint8_t 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 uint8_t openhandm_bits[] = { + 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, + 0xf6,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, + 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; +static const uint8_t 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 uint8_t 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}; + +static const uint8_t * const cursor_bits20[] = { + forbidden_bits, forbiddenm_bits +}; + +static const char * const cursorNames[] = { + "left_ptr", + "up_arrow", + "cross", + "wait", + "ibeam", + "size_ver", + "size_hor", + "size_bdiag", + "size_fdiag", + "size_all", + "blank", + "split_v", + "split_h", + "pointing_hand", + "forbidden", + "whats_this", + "left_ptr_watch", + "openhand", + "closedhand", + "copy", + "move", + "link" +}; + +QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen) + : QXcbObject(conn), QPlatformCursor(screen), m_screen(screen) +{ + if (cursorCount++) + return; + + cursorFont = xcb_generate_id(xcb_connection()); + const char *cursorStr = "cursor"; + xcb_open_font(xcb_connection(), cursorFont, strlen(cursorStr), cursorStr); + +#ifdef XCB_USE_XLIB + QLibrary xcursorLib(QLatin1String("Xcursor"), 1); + bool xcursorFound = xcursorLib.load(); + if (!xcursorFound) { // try without the version number + xcursorLib.setFileName(QLatin1String("Xcursor")); + xcursorFound = xcursorLib.load(); + } + if (xcursorFound) + ptrXcursorLibraryLoadCursor = + (PtrXcursorLibraryLoadCursor) xcursorLib.resolve("XcursorLibraryLoadCursor"); +#endif +} + +QXcbCursor::~QXcbCursor() +{ + if (!--cursorCount) + xcb_close_font(xcb_connection(), cursorFont); +} + +void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget) +{ + QXcbWindow *w = 0; + if (widget && widget->handle()) + w = static_cast(widget->handle()); + else + // No X11 cursor control when there is no widget under the cursor + return; + + xcb_cursor_t c; + if (cursor->shape() == Qt::BitmapCursor) { + qint64 id = cursor->pixmap().cacheKey(); + if (!m_bitmapCursorMap.contains(id)) + m_bitmapCursorMap.insert(id, createBitmapCursor(cursor)); + c = m_bitmapCursorMap.value(id); + } else { + int id = cursor->handle(); + if (!m_shapeCursorMap.contains(id)) + m_shapeCursorMap.insert(id, createFontCursor(cursor->shape())); + c = m_shapeCursorMap.value(id); + } + + w->setCursor(c); +} + +static int cursorIdForShape(int cshape) +{ + int cursorId = 0; + switch (cshape) { + case Qt::ArrowCursor: + cursorId = XC_left_ptr; + break; + case Qt::UpArrowCursor: + cursorId = XC_center_ptr; + break; + case Qt::CrossCursor: + cursorId = XC_crosshair; + break; + case Qt::WaitCursor: + cursorId = XC_watch; + break; + case Qt::IBeamCursor: + cursorId = XC_xterm; + break; + case Qt::SizeAllCursor: + cursorId = XC_fleur; + break; + case Qt::PointingHandCursor: + cursorId = XC_hand2; + break; + case Qt::SizeBDiagCursor: + cursorId = XC_top_right_corner; + break; + case Qt::SizeFDiagCursor: + cursorId = XC_bottom_right_corner; + break; + case Qt::SizeVerCursor: + case Qt::SplitVCursor: + cursorId = XC_sb_v_double_arrow; + break; + case Qt::SizeHorCursor: + case Qt::SplitHCursor: + cursorId = XC_sb_h_double_arrow; + break; + case Qt::WhatsThisCursor: + cursorId = XC_question_arrow; + break; + case Qt::ForbiddenCursor: + cursorId = XC_circle; + break; + case Qt::BusyCursor: + cursorId = XC_watch; + break; + default: + break; + } + return cursorId; +} + +xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) +{ + xcb_cursor_t cursor = 0; + xcb_connection_t *conn = xcb_connection(); + + if (cshape == Qt::BlankCursor) { + xcb_pixmap_t cp = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), cur_blank_bits, 16, 16, + 1, 0, 0, 0); + xcb_pixmap_t mp = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), cur_blank_bits, 16, 16, + 1, 0, 0, 0); + cursor = xcb_generate_id(conn); + xcb_create_cursor(conn, cursor, cp, mp, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); + } else if (cshape >= Qt::SizeVerCursor && cshape < Qt::SizeAllCursor) { + int i = (cshape - Qt::SizeVerCursor) * 2; + xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), + const_cast(cursor_bits16[i]), + 16, 16, 1, 0, 0, 0); + xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), + const_cast(cursor_bits16[i + 1]), + 16, 16, 1, 0, 0, 0); + cursor = xcb_generate_id(conn); + xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); + } else if ((cshape >= Qt::SplitVCursor && cshape <= Qt::SplitHCursor) + || cshape == Qt::WhatsThisCursor || cshape == Qt::BusyCursor) { + int i = (cshape - Qt::SplitVCursor) * 2; + xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), + const_cast(cursor_bits32[i]), + 32, 32, 1, 0, 0, 0); + xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), + const_cast(cursor_bits32[i + 1]), + 32, 32, 1, 0, 0, 0); + int hs = (cshape == Qt::PointingHandCursor || cshape == Qt::WhatsThisCursor + || cshape == Qt::BusyCursor) ? 0 : 16; + cursor = xcb_generate_id(conn); + xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, hs, hs); + } else if (cshape == Qt::ForbiddenCursor) { + int i = (cshape - Qt::ForbiddenCursor) * 2; + xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), + const_cast(cursor_bits20[i]), + 20, 20, 1, 0, 0, 0); + xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), + const_cast(cursor_bits20[i + 1]), + 20, 20, 1, 0, 0, 0); + cursor = xcb_generate_id(conn); + xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 10, 10); + } else if (cshape == Qt::OpenHandCursor || cshape == Qt::ClosedHandCursor) { + bool open = cshape == Qt::OpenHandCursor; + xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), + const_cast(open ? openhand_bits : closedhand_bits), + 16, 16, 1, 0, 0, 0); + xcb_pixmap_t pmm = xcb_create_pixmap_from_bitmap_data(conn, m_screen->root(), + const_cast(open ? openhandm_bits : closedhandm_bits), + 16, 16, 1, 0, 0, 0); + cursor = xcb_generate_id(conn); + xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); + } else if (cshape == Qt::DragCopyCursor || cshape == Qt::DragMoveCursor + || cshape == Qt::DragLinkCursor) { + QImage image = QGuiApplicationPrivate::instance()->getPixmapCursor(static_cast(cshape)).toImage(); + xcb_pixmap_t pm = qt_xcb_XPixmapFromBitmap(m_screen, image); + xcb_pixmap_t pmm = qt_xcb_XPixmapFromBitmap(m_screen, image.createAlphaMask()); + cursor = xcb_generate_id(conn); + xcb_create_cursor(conn, cursor, pm, pmm, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, 8, 8); + } + + return cursor; +} + +xcb_cursor_t QXcbCursor::createFontCursor(int cshape) +{ + xcb_connection_t *conn = xcb_connection(); + int cursorId = cursorIdForShape(cshape); + xcb_cursor_t cursor = XCB_NONE; + + // Try Xcursor first +#ifdef XCB_USE_XLIB + if (ptrXcursorLibraryLoadCursor && cshape >= 0 && cshape < Qt::LastCursor) { + void *dpy = connection()->xlib_display(); + // special case for non-standard dnd-* cursors + switch (cshape) { + case Qt::DragCopyCursor: + cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-copy"); + break; + case Qt::DragMoveCursor: + cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-move"); + break; + case Qt::DragLinkCursor: + cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-link"); + break; + default: + break; + } + if (!cursor) + cursor = ptrXcursorLibraryLoadCursor(dpy, cursorNames[cshape]); + } + if (cursor) + return cursor; +#endif + + // Non-standard X11 cursors are created from bitmaps + cursor = createNonStandardCursor(cshape); + + // Create a glpyh cursor if everything else failed + if (!cursor && cursorId) { + cursor = xcb_generate_id(conn); + xcb_create_glyph_cursor(conn, cursor, cursorFont, cursorFont, + cursorId, cursorId + 1, + 0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0); + } + + if (cursor && cshape >= 0 && cshape < Qt::LastCursor) { + const char *name = cursorNames[cshape]; + xcb_xfixes_set_cursor_name(conn, cursor, strlen(name), name); + } + + return cursor; +} + +xcb_cursor_t QXcbCursor::createBitmapCursor(QCursor *cursor) +{ + xcb_connection_t *conn = xcb_connection(); + QPoint spot = cursor->hotSpot(); + xcb_cursor_t c = XCB_NONE; + if (cursor->pixmap().depth() > 1) + c = qt_xcb_createCursorXRender(m_screen, cursor->pixmap().toImage(), spot); + if (!c) { + xcb_pixmap_t cp = qt_xcb_XPixmapFromBitmap(m_screen, cursor->bitmap()->toImage()); + xcb_pixmap_t mp = qt_xcb_XPixmapFromBitmap(m_screen, cursor->mask()->toImage()); + c = xcb_generate_id(conn); + xcb_create_cursor(conn, c, cp, mp, 0, 0, 0, 0xFFFF, 0xFFFF, 0xFFFF, + spot.x(), spot.y()); + xcb_free_pixmap(conn, cp); + xcb_free_pixmap(conn, mp); + } + return c; +} + +static void getPosAndRoot(xcb_connection_t *conn, xcb_window_t *rootWin, QPoint *pos) +{ + if (pos) + *pos = QPoint(); + xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(conn)); + while (it.rem) { + xcb_window_t root = it.data->root; + xcb_query_pointer_cookie_t cookie = xcb_query_pointer(conn, root); + xcb_generic_error_t *err = 0; + xcb_query_pointer_reply_t *reply = xcb_query_pointer_reply(conn, cookie, &err); + if (!err && reply) { + if (pos) + *pos = QPoint(reply->root_x, reply->root_y); + if (rootWin) + *rootWin = root; + free(reply); + return; + } + free(err); + free(reply); + xcb_screen_next(&it); + } +} + +QPoint QXcbCursor::pos() const +{ + QPoint p; + getPosAndRoot(xcb_connection(), 0, &p); + return p; +} + +void QXcbCursor::setPos(const QPoint &pos) +{ + xcb_connection_t *conn = xcb_connection(); + xcb_window_t root; + getPosAndRoot(conn, &root, 0); + xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0, pos.x(), pos.y()); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h new file mode 100644 index 00000000000..4bbb9a928b8 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbcursor.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBCURSOR_H +#define QXCBCURSOR_H + +#include +#include "qxcbscreen.h" + +QT_BEGIN_NAMESPACE + +class QXcbCursor : public QXcbObject, public QPlatformCursor +{ +public: + QXcbCursor(QXcbConnection *conn, QXcbScreen *screen); + ~QXcbCursor(); + void changeCursor(QCursor *cursor, QWindow *widget); + QPoint pos() const; + void setPos(const QPoint &pos); + +private: + xcb_cursor_t createFontCursor(int cshape); + xcb_cursor_t createBitmapCursor(QCursor *cursor); + xcb_cursor_t createNonStandardCursor(int cshape); + + QXcbScreen *m_screen; + QMap m_shapeCursorMap; + QMap m_bitmapCursorMap; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp new file mode 100644 index 00000000000..8a6fd299863 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -0,0 +1,1332 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbdrag.h" +#include +#include "qxcbconnection.h" +#include "qxcbclipboard.h" +#include "qxcbmime.h" +#include "qxcbwindow.h" +#include "qxcbscreen.h" +#include "qwindow.h" +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +//#define DND_DEBUG +#ifdef DND_DEBUG +#define DEBUG qDebug +#else +#define DEBUG if(0) qDebug +#endif + +#ifdef DND_DEBUG +#define DNDDEBUG qDebug() +#else +#define DNDDEBUG if(0) qDebug() +#endif + +const int xdnd_version = 5; + +static inline xcb_window_t xcb_window(QWindow *w) +{ + return static_cast(w->handle())->xcb_window(); +} + + +static xcb_window_t xdndProxy(QXcbConnection *c, xcb_window_t w) +{ + xcb_window_t proxy = XCB_NONE; + + xcb_get_property_cookie_t cookie = Q_XCB_CALL2(xcb_get_property(c->xcb_connection(), false, w, c->atom(QXcbAtom::XdndProxy), + XCB_ATOM_WINDOW, 0, 1), c); + xcb_get_property_reply_t *reply = xcb_get_property_reply(c->xcb_connection(), cookie, 0); + + if (reply && reply->type == XCB_ATOM_WINDOW) + proxy = *((xcb_window_t *)xcb_get_property_value(reply)); + free(reply); + + if (proxy == XCB_NONE) + return proxy; + + // exists and is real? + cookie = Q_XCB_CALL2(xcb_get_property(c->xcb_connection(), false, proxy, c->atom(QXcbAtom::XdndProxy), + XCB_ATOM_WINDOW, 0, 1), c); + reply = xcb_get_property_reply(c->xcb_connection(), cookie, 0); + + if (reply && reply->type == XCB_ATOM_WINDOW) { + xcb_window_t p = *((xcb_window_t *)xcb_get_property_value(reply)); + if (proxy != p) + proxy = 0; + } else { + proxy = 0; + } + + free(reply); + + return proxy; +} + + +class QDropData : public QXcbMime +{ +public: + QDropData(QXcbDrag *d); + ~QDropData(); + +protected: + bool hasFormat_sys(const QString &mimeType) const; + QStringList formats_sys() const; + QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const; + + QVariant xdndObtainData(const QByteArray &format, QVariant::Type requestedType) const; + + QXcbDrag *drag; +}; + + +QXcbDrag::QXcbDrag(QXcbConnection *c) + : QXcbObject(c) +{ + dropData = new QDropData(this); + + init(); + heartbeat = -1; + + transaction_expiry_timer = -1; +} + +QXcbDrag::~QXcbDrag() +{ + delete dropData; +} + +void QXcbDrag::init() +{ + currentWindow.clear(); + + xdnd_dragsource = XCB_NONE; + last_target_accepted_action = Qt::IgnoreAction; + + waiting_for_status = false; + current_target = XCB_NONE; + current_proxy_target = XCB_NONE; + xdnd_dragging = false; + + source_time = XCB_CURRENT_TIME; + target_time = XCB_CURRENT_TIME; + + current_screen = 0; + drag_types.clear(); +} + +QMimeData *QXcbDrag::platformDropData() +{ + return dropData; +} + +void QXcbDrag::startDrag() +{ + init(); + + heartbeat = startTimer(200); + xdnd_dragging = true; + + xcb_set_selection_owner(xcb_connection(), connection()->clipboard()->owner(), + atom(QXcbAtom::XdndSelection), connection()->time()); + + QDragManager *manager = QDragManager::self(); + QStringList fmts = QXcbMime::formatsHelper(manager->dropData()); + for (int i = 0; i < fmts.size(); ++i) { + QList atoms = QXcbMime::mimeAtomsForFormat(connection(), fmts.at(i)); + for (int j = 0; j < atoms.size(); ++j) { + if (!drag_types.contains(atoms.at(j))) + drag_types.append(atoms.at(j)); + } + } + if (drag_types.size() > 3) + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, connection()->clipboard()->owner(), + atom(QXcbAtom::XdndTypelist), + XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData()); + + QPointF pos = QCursor::pos(); + QMouseEvent me(QEvent::MouseMove, pos, pos, pos, Qt::LeftButton, + QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); + move(&me); + +// if (!QWidget::mouseGrabber()) +// manager->shapedPixmapWindow->grabMouse(); +} + +void QXcbDrag::endDrag() +{ + Q_ASSERT(heartbeat != -1); + killTimer(heartbeat); + heartbeat = -1; + + xdnd_dragging = false; +} + +static xcb_translate_coordinates_reply_t * +translateCoordinates(QXcbConnection *c, xcb_window_t from, xcb_window_t to, int x, int y) +{ + xcb_translate_coordinates_cookie_t cookie = + xcb_translate_coordinates(c->xcb_connection(), from, to, x, y); + return xcb_translate_coordinates_reply(c->xcb_connection(), cookie, 0); +} + +void QXcbDrag::move(const QMouseEvent *me) +{ + DEBUG() << "QDragManager::move enter"; + + // ### + QPoint globalPos = me->globalPos(); + + if (source_sameanswer.contains(globalPos) && source_sameanswer.isValid()) + return; + + const QList &screens = connection()->screens(); + QXcbScreen *screen = screens.at(connection()->primaryScreen()); + for (int i = 0; i < screens.size(); ++i) { + if (screens.at(i)->geometry().contains(globalPos)) { + screen = screens.at(i); + break; + } + } + if (screen != current_screen) { + // ### need to recreate the shaped pixmap window? +// int screen = QCursor::x11Screen(); +// if ((qt_xdnd_current_screen == -1 && screen != X11->defaultScreen) || (screen != qt_xdnd_current_screen)) { +// // recreate the pixmap on the new screen... +// delete xdnd_data.deco; +// QWidget* parent = object->source()->window()->x11Info().screen() == screen +// ? object->source()->window() : QApplication::desktop()->screen(screen); +// xdnd_data.deco = new QShapedPixmapWidget(parent); +// if (!QWidget::mouseGrabber()) { +// updatePixmap(); +// xdnd_data.deco->grabMouse(); +// } +// } +// xdnd_data.deco->move(QCursor::pos() - xdnd_data.deco->pm_hot); + current_screen = screen; + } + + +// qt_xdnd_current_screen = screen; + xcb_window_t rootwin = current_screen->root(); + xcb_translate_coordinates_reply_t *translate = + ::translateCoordinates(connection(), rootwin, rootwin, globalPos.x(), globalPos.y()); + if (!translate) + return; + xcb_window_t target = translate->child; + int lx = translate->dst_x; + int ly = translate->dst_y; + free (translate); + + if (target == rootwin) { + // Ok. + } else if (target) { + //me + xcb_window_t src = rootwin; + while (target != 0) { + DNDDEBUG << "checking target for XdndAware" << target; + + // translate coordinates + translate = ::translateCoordinates(connection(), src, target, lx, ly); + if (!translate) { + target = 0; + break; + } + lx = translate->dst_x; + ly = translate->dst_y; + src = translate->child; + free(translate); + + // check if it has XdndAware + xcb_get_property_cookie_t cookie = Q_XCB_CALL(xcb_get_property(xcb_connection(), false, target, + atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 0)); + xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); + bool aware = reply && reply->type != XCB_NONE; + free(reply); + if (aware) { + DNDDEBUG << "Found XdndAware on " << target; + break; + } + + // find child at the coordinates + translate = ::translateCoordinates(connection(), src, src, lx, ly); + if (!translate) { + target = 0; + break; + } + target = translate->child; + free(translate); + } + // #### +// if (xdnd_data.deco && (!target || target == xdnd_data.deco->effectiveWinId())) { +// DNDDEBUG << "need to find real window"; +// target = findRealWindow(globalPos, rootwin, 6); +// DNDDEBUG << "real window found" << QWidget::find(target) << target; +// } + } + + QXcbWindow *w = 0; + if (target) { + w = connection()->platformWindowFromId(target); + if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/) + w = 0; + } else { + w = 0; + target = rootwin; + } + + DNDDEBUG << "and the final target is " << target; + DNDDEBUG << "the widget w is" << (w ? w->window() : 0); + + xcb_window_t proxy_target = xdndProxy(connection(), target); + if (!proxy_target) + proxy_target = target; + int target_version = 1; + + if (proxy_target) { + xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, target, + atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 1); + xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); + if (!reply || reply->type == XCB_NONE) + target = 0; + target_version = xcb_get_property_value_length(reply) == 1 ? *(uint32_t *)xcb_get_property_value(reply) : 1; + if (target_version > xdnd_version) + target_version = xdnd_version; + + free(reply); + } + + DEBUG() << "target=" << target << "current_target=" << current_target; + if (target != current_target) { + if (current_target) + send_leave(); + + current_target = target; + current_proxy_target = proxy_target; + if (target) { + int flags = target_version << 24; + if (drag_types.size() > 3) + flags |= 0x0001; + + xcb_client_message_event_t enter; + enter.response_type = XCB_CLIENT_MESSAGE; + enter.window = target; + enter.format = 32; + enter.type = atom(QXcbAtom::XdndEnter); + enter.data.data32[0] = connection()->clipboard()->owner(); + enter.data.data32[1] = flags; + enter.data.data32[2] = drag_types.size()>0 ? drag_types.at(0) : 0; + enter.data.data32[3] = drag_types.size()>1 ? drag_types.at(1) : 0; + enter.data.data32[4] = drag_types.size()>2 ? drag_types.at(2) : 0; + // provisionally set the rectangle to 5x5 pixels... + source_sameanswer = QRect(globalPos.x() - 2, globalPos.y() -2 , 5, 5); + + DEBUG() << "sending Xdnd enter source=" << enter.data.data32[0]; + if (w) + handleEnter(w->window(), &enter); + else if (target) + xcb_send_event(xcb_connection(), false, proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&enter); + waiting_for_status = false; + } + } + if (waiting_for_status) + return; + + QDragManager *m = QDragManager::self(); + + if (target) { + waiting_for_status = true; + + xcb_client_message_event_t move; + move.response_type = XCB_CLIENT_MESSAGE; + move.window = target; + move.format = 32; + move.type = atom(QXcbAtom::XdndPosition); + move.window = target; + move.data.data32[0] = connection()->clipboard()->owner(); + move.data.data32[1] = 0; // flags + move.data.data32[2] = (globalPos.x() << 16) + globalPos.y(); + move.data.data32[3] = connection()->time(); + move.data.data32[4] = toXdndAction(m->defaultAction(m->dragPrivate()->possible_actions, QGuiApplication::keyboardModifiers())); + DEBUG() << "sending Xdnd position source=" << move.data.data32[0] << "target=" << move.window; + + source_time = connection()->time(); + + if (w) + handle_xdnd_position(w->window(), &move, false); + else + xcb_send_event(xcb_connection(), false, proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&move); + } else { + if (m->willDrop) { + m->willDrop = false; + m->updateCursor(); + } + } + DEBUG() << "QDragManager::move leave"; +} + +void QXcbDrag::drop(const QMouseEvent *) +{ + endDrag(); + + if (!current_target) + return; + + xcb_client_message_event_t drop; + drop.response_type = XCB_CLIENT_MESSAGE; + drop.window = current_target; + drop.format = 32; + drop.type = atom(QXcbAtom::XdndDrop); + drop.data.data32[0] = connection()->clipboard()->owner(); + drop.data.data32[1] = 0; // flags + drop.data.data32[2] = connection()->time(); + + drop.data.data32[3] = 0; + drop.data.data32[4] = 0; + + QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target); + + if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/) + w = 0; + + QDragManager *manager = QDragManager::self(); + + Transaction t = { + connection()->time(), + current_target, + current_proxy_target, + (w ? w->window() : 0), +// current_embedding_widget, + manager->object + }; + transactions.append(t); + restartDropExpiryTimer(); + + if (w) + handleDrop(w->window(), &drop, false); + else + xcb_send_event(xcb_connection(), false, current_proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&drop); + + current_target = 0; + current_proxy_target = 0; + source_time = 0; +// current_embedding_widget = 0; + manager->object = 0; +} + +Qt::DropAction QXcbDrag::toDropAction(xcb_atom_t a) const +{ + if (a == atom(QXcbAtom::XdndActionCopy) || a == 0) + return Qt::CopyAction; + if (a == atom(QXcbAtom::XdndActionLink)) + return Qt::LinkAction; + if (a == atom(QXcbAtom::XdndActionMove)) + return Qt::MoveAction; + return Qt::CopyAction; +} + +xcb_atom_t QXcbDrag::toXdndAction(Qt::DropAction a) const +{ + switch (a) { + case Qt::CopyAction: + return atom(QXcbAtom::XdndActionCopy); + case Qt::LinkAction: + return atom(QXcbAtom::XdndActionLink); + case Qt::MoveAction: + case Qt::TargetMoveAction: + return atom(QXcbAtom::XdndActionMove); + case Qt::IgnoreAction: + return XCB_NONE; + default: + return atom(QXcbAtom::XdndActionCopy); + } +} + +// timer used to discard old XdndDrop transactions +enum { XdndDropTransactionTimeout = 5000 }; // 5 seconds + +void QXcbDrag::restartDropExpiryTimer() +{ + if (transaction_expiry_timer != -1) + killTimer(transaction_expiry_timer); + transaction_expiry_timer = startTimer(XdndDropTransactionTimeout); +} + +int QXcbDrag::findTransactionByWindow(xcb_window_t window) +{ + int at = -1; + for (int i = 0; i < transactions.count(); ++i) { + const Transaction &t = transactions.at(i); + if (t.target == window || t.proxy_target == window) { + at = i; + break; + } + } + return at; +} + +int QXcbDrag::findTransactionByTime(xcb_timestamp_t timestamp) +{ + int at = -1; + for (int i = 0; i < transactions.count(); ++i) { + const Transaction &t = transactions.at(i); + if (t.timestamp == timestamp) { + at = i; + break; + } + } + return at; +} + +#if 0 + +// find an ancestor with XdndAware on it +static Window findXdndAwareParent(Window window) +{ + Window target = 0; + forever { + // check if window has XdndAware + Atom type = 0; + int f; + unsigned long n, a; + unsigned char *data = 0; + if (XGetWindowProperty(X11->display, window, ATOM(XdndAware), 0, 0, False, + AnyPropertyType, &type, &f,&n,&a,&data) == Success) { + if (data) + XFree(data); + if (type) { + target = window; + break; + } + } + + // try window's parent + Window root; + Window parent; + Window *children; + uint unused; + if (!XQueryTree(X11->display, window, &root, &parent, &children, &unused)) + break; + if (children) + XFree(children); + if (window == root) + break; + window = parent; + } + return target; +} + + +// for embedding only +static QWidget* current_embedding_widget = 0; +static xcb_client_message_event_t last_enter_event; + + +static bool checkEmbedded(QWidget* w, const XEvent* xe) +{ + if (!w) + return false; + + if (current_embedding_widget != 0 && current_embedding_widget != w) { + current_target = ((QExtraWidget*)current_embedding_widget)->extraData()->xDndProxy; + current_proxy_target = current_target; + qt_xdnd_send_leave(); + current_target = 0; + current_proxy_target = 0; + current_embedding_widget = 0; + } + + QWExtra* extra = ((QExtraWidget*)w)->extraData(); + if (extra && extra->xDndProxy != 0) { + + if (current_embedding_widget != w) { + + last_enter_event.xany.window = extra->xDndProxy; + XSendEvent(X11->display, extra->xDndProxy, False, NoEventMask, &last_enter_event); + current_embedding_widget = w; + } + + ((XEvent*)xe)->xany.window = extra->xDndProxy; + XSendEvent(X11->display, extra->xDndProxy, False, NoEventMask, (XEvent*)xe); + if (currentWindow != w) { + currentWindow = w; + } + return true; + } + current_embedding_widget = 0; + return false; +} +#endif + + +void QXcbDrag::handleEnter(QWindow *window, const xcb_client_message_event_t *event) +{ + Q_UNUSED(window); + DEBUG() << "handleEnter" << window; + + xdnd_types.clear(); +// motifdnd_active = false; +// last_enter_event.xclient = xe->xclient; + + int version = (int)(event->data.data32[1] >> 24); + if (version > xdnd_version) + return; + + xdnd_dragsource = event->data.data32[0]; + + if (event->data.data32[1] & 1) { + // get the types from XdndTypeList + xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, xdnd_dragsource, + atom(QXcbAtom::XdndTypelist), XCB_ATOM_ATOM, + 0, xdnd_max_type); + xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); + if (reply && reply->type != XCB_NONE && reply->format == 32) { + int length = xcb_get_property_value_length(reply) / 4; + if (length > xdnd_max_type) + length = xdnd_max_type; + + xcb_atom_t *atoms = (xcb_atom_t *)xcb_get_property_value(reply); + for (int i = 0; i < length; ++i) + xdnd_types.append(atoms[i]); + } + free(reply); + } else { + // get the types from the message + for(int i = 2; i < 5; i++) { + if (event->data.data32[i]) + xdnd_types.append(event->data.data32[i]); + } + } + for(int i = 0; i < xdnd_types.length(); ++i) + DEBUG() << " " << connection()->atomName(xdnd_types.at(i)); +} + +void QXcbDrag::handle_xdnd_position(QWindow *w, const xcb_client_message_event_t *e, bool passive) +{ + QPoint p((e->data.data32[2] & 0xffff0000) >> 16, e->data.data32[2] & 0x0000ffff); + Q_ASSERT(w); + QRect geometry = w->geometry(); + + p -= geometry.topLeft(); + + // #### +// if (!passive && checkEmbedded(w, e)) +// return; + + if (!w || (/*!w->acceptDrops() &&*/ (w->windowType() == Qt::Desktop))) + return; + + if (e->data.data32[0] != xdnd_dragsource) { + DEBUG("xdnd drag position from unexpected source (%x not %x)", e->data.data32[0], xdnd_dragsource); + return; + } + + // timestamp from the source + if (e->data.data32[3] != XCB_NONE) + target_time /*= X11->userTime*/ = e->data.data32[3]; + + QDragManager *manager = QDragManager::self(); + QMimeData *dropData = manager->dropData(); + + xcb_client_message_event_t response; + response.response_type = XCB_CLIENT_MESSAGE; + response.window = xdnd_dragsource; + response.format = 32; + response.type = atom(QXcbAtom::XdndStatus); + response.data.data32[0] = xcb_window(w); + response.data.data32[1] = 0; // flags + response.data.data32[2] = 0; // x, y + response.data.data32[3] = 0; // w, h + response.data.data32[4] = 0; // action + + if (!passive) { // otherwise just reject + QRect answerRect(p + geometry.topLeft(), QSize(1,1)); + + if (manager->object) { + manager->possible_actions = manager->dragPrivate()->possible_actions; + } else { + manager->possible_actions = Qt::DropActions(toDropAction(e->data.data32[4])); + } + QDragMoveEvent me(p, manager->possible_actions, dropData, + QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); + + Qt::DropAction accepted_action = Qt::IgnoreAction; + + currentPosition = p; + + if (w != currentWindow.data()) { + if (currentWindow) { + QDragLeaveEvent e; + QGuiApplication::sendEvent(currentWindow.data(), &e); + } + currentWindow = w; + + last_target_accepted_action = Qt::IgnoreAction; + QDragEnterEvent de(p, manager->possible_actions, dropData, + QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); + QGuiApplication::sendEvent(w, &de); + if (de.isAccepted() && de.dropAction() != Qt::IgnoreAction) + last_target_accepted_action = de.dropAction(); + } + + DEBUG() << "qt_handle_xdnd_position action=" << connection()->atomName(e->data.data32[4]); + + if (last_target_accepted_action != Qt::IgnoreAction) { + me.setDropAction(last_target_accepted_action); + me.accept(); + } + QGuiApplication::sendEvent(w, &me); + if (me.isAccepted()) { + response.data.data32[1] = 1; // yes + accepted_action = me.dropAction(); + last_target_accepted_action = accepted_action; + } else { + response.data.data32[0] = 0; + last_target_accepted_action = Qt::IgnoreAction; + } + answerRect = me.answerRect().translated(geometry.topLeft()).intersected(geometry); + + if (answerRect.left() < 0) + answerRect.setLeft(0); + if (answerRect.right() > 4096) + answerRect.setRight(4096); + if (answerRect.top() < 0) + answerRect.setTop(0); + if (answerRect.bottom() > 4096) + answerRect.setBottom(4096); + if (answerRect.width() < 0) + answerRect.setWidth(0); + if (answerRect.height() < 0) + answerRect.setHeight(0); + +// response.data.data32[2] = (answerRect.x() << 16) + answerRect.y(); +// response.data.data32[3] = (answerRect.width() << 16) + answerRect.height(); + response.data.data32[4] = toXdndAction(accepted_action); + } + + // reset + target_time = XCB_CURRENT_TIME; + + DEBUG() << "sending XdndStatus" << (xdnd_dragsource == connection()->clipboard()->owner()) << xdnd_dragsource + << response.data.data32[1] << connection()->atomName(response.data.data32[4]); + if (xdnd_dragsource == connection()->clipboard()->owner()) + handle_xdnd_status(&response, passive); + else + Q_XCB_CALL(xcb_send_event(xcb_connection(), false, xdnd_dragsource, + XCB_EVENT_MASK_NO_EVENT, (const char *)&response)); +} + +namespace +{ + class ClientMessageScanner { + public: + ClientMessageScanner(xcb_atom_t a) : atom(a) {} + xcb_atom_t atom; + bool check(xcb_generic_event_t *event) const { + if (!event) + return false; + if ((event->response_type & 0x7f) != XCB_CLIENT_MESSAGE) + return false; + return ((xcb_client_message_event_t *)event)->type == atom; + } + }; +} + +void QXcbDrag::handlePosition(QWindow * w, const xcb_client_message_event_t *event, bool passive) +{ + xcb_client_message_event_t *lastEvent = const_cast(event); + xcb_generic_event_t *nextEvent; + ClientMessageScanner scanner(atom(QXcbAtom::XdndPosition)); + while ((nextEvent = connection()->checkEvent(scanner))) { + if (lastEvent != event) + free(lastEvent); + lastEvent = (xcb_client_message_event_t *)nextEvent; + } + + handle_xdnd_position(w, lastEvent, passive); + if (lastEvent != event) + free(lastEvent); +} + +void QXcbDrag::handle_xdnd_status(const xcb_client_message_event_t *event, bool) +{ + DEBUG("xdndHandleStatus"); + // ignore late status messages + if (event->data.data32[0] && event->data.data32[0] != current_proxy_target) + return; + + Qt::DropAction newAction = (event->data.data32[1] & 0x1) ? toDropAction(event->data.data32[4]) : Qt::IgnoreAction; + + if ((event->data.data32[1] & 2) == 0) { + QPoint p((event->data.data32[2] & 0xffff0000) >> 16, event->data.data32[2] & 0x0000ffff); + QSize s((event->data.data32[3] & 0xffff0000) >> 16, event->data.data32[3] & 0x0000ffff); + source_sameanswer = QRect(p, s); + } else { + source_sameanswer = QRect(); + } + QDragManager *manager = QDragManager::self(); + manager->willDrop = (event->data.data32[1] & 0x1); + if (manager->global_accepted_action != newAction) { + manager->global_accepted_action = newAction; + manager->emitActionChanged(newAction); + } + DEBUG() << "willDrop=" << manager->willDrop << "action=" << newAction; + manager->updateCursor(); + waiting_for_status = false; +} + +void QXcbDrag::handleStatus(const xcb_client_message_event_t *event, bool passive) +{ + if (event->window != connection()->clipboard()->owner()) + return; + + xcb_client_message_event_t *lastEvent = const_cast(event); + qDebug() << "handleStatus" << lastEvent->window << lastEvent->data.data32[0]; + xcb_generic_event_t *nextEvent; + ClientMessageScanner scanner(atom(QXcbAtom::XdndStatus)); + while ((nextEvent = connection()->checkEvent(scanner))) { + if (lastEvent != event) + free(lastEvent); + lastEvent = (xcb_client_message_event_t *)nextEvent; + } + + handle_xdnd_status(lastEvent, passive); + if (lastEvent != event) + free(lastEvent); + DEBUG("xdndHandleStatus end"); +} + +void QXcbDrag::handleLeave(QWindow *w, const xcb_client_message_event_t *event, bool /*passive*/) +{ + DEBUG("xdnd leave"); + if (!currentWindow || w != currentWindow.data()) + return; // sanity + + // ### +// if (checkEmbedded(current_embedding_widget, event)) { +// current_embedding_widget = 0; +// currentWindow.clear(); +// return; +// } + + if (event->data.data32[0] != xdnd_dragsource) { + // This often happens - leave other-process window quickly + DEBUG("xdnd drag leave from unexpected source (%x not %x", event->data.data32[0], xdnd_dragsource); + } + + QDragLeaveEvent e; + QGuiApplication::sendEvent(currentWindow.data(), &e); + + xdnd_dragsource = 0; + xdnd_types.clear(); + currentWindow.clear(); +} + +void QXcbDrag::send_leave() +{ + if (!current_target) + return; + + QDragManager *manager = QDragManager::self(); + + xcb_client_message_event_t leave; + leave.response_type = XCB_CLIENT_MESSAGE; + leave.window = current_target; + leave.format = 32; + leave.type = atom(QXcbAtom::XdndLeave); + leave.data.data32[0] = connection()->clipboard()->owner(); + leave.data.data32[1] = 0; // flags + leave.data.data32[2] = 0; // x, y + leave.data.data32[3] = 0; // w, h + leave.data.data32[4] = 0; // just null + + QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target); + + if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/) + w = 0; + + if (w) + handleLeave(w->window(), (const xcb_client_message_event_t *)&leave, false); + else + xcb_send_event(xcb_connection(), false,current_proxy_target, + XCB_EVENT_MASK_NO_EVENT, (const char *)&leave); + + // reset the drag manager state + manager->willDrop = false; + if (manager->global_accepted_action != Qt::IgnoreAction) + manager->emitActionChanged(Qt::IgnoreAction); + manager->global_accepted_action = Qt::IgnoreAction; + manager->updateCursor(); + current_target = 0; + current_proxy_target = 0; + source_time = XCB_CURRENT_TIME; + waiting_for_status = false; +} + +void QXcbDrag::handleDrop(QWindow *, const xcb_client_message_event_t *event, bool passive) +{ + DEBUG("xdndHandleDrop"); + if (!currentWindow) { + xdnd_dragsource = 0; + return; // sanity + } + + // ### +// if (!passive && checkEmbedded(currentWindow, xe)){ +// current_embedding_widget = 0; +// xdnd_dragsource = 0; +// currentWindow = 0; +// return; +// } + const uint32_t *l = event->data.data32; + + QDragManager *manager = QDragManager::self(); + DEBUG("xdnd drop"); + + if (l[0] != xdnd_dragsource) { + DEBUG("xdnd drop from unexpected source (%x not %x", l[0], xdnd_dragsource); + return; + } + + // update the "user time" from the timestamp in the event. + if (l[2] != 0) + target_time = /*X11->userTime =*/ l[2]; + + if (!passive) { + // this could be a same-application drop, just proxied due to + // some XEMBEDding, so try to find the real QMimeData used + // based on the timestamp for this drop. + QMimeData *dropData = 0; + // ### +// int at = findXdndDropTransactionByTime(target_time); +// if (at != -1) +// dropData = QDragManager::dragPrivate(X11->dndDropTransactions.at(at).object)->data; + // if we can't find it, then use the data in the drag manager + if (!dropData) + dropData = manager->dropData(); + + // Drop coming from another app? Update keyboard modifiers. +// if (!qt_xdnd_dragging) { +// QApplicationPrivate::modifier_buttons = currentKeyboardModifiers(); +// } + + QDropEvent de(currentPosition, manager->possible_actions, dropData, + QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); + QGuiApplication::sendEvent(currentWindow.data(), &de); + if (!de.isAccepted()) { + // Ignore a failed drag + manager->global_accepted_action = Qt::IgnoreAction; + } else { + manager->global_accepted_action = de.dropAction(); + } + xcb_client_message_event_t finished; + finished.response_type = XCB_CLIENT_MESSAGE; + finished.window = xdnd_dragsource; + finished.format = 32; + finished.type = atom(QXcbAtom::XdndFinished); + DNDDEBUG << "xdndHandleDrop" + << "currentWindow" << currentWindow.data() + << (currentWindow ? xcb_window(currentWindow.data()) : 0); + finished.data.data32[0] = currentWindow ? xcb_window(currentWindow.data()) : XCB_NONE; + finished.data.data32[1] = de.isAccepted() ? 1 : 0; // flags + finished.data.data32[2] = toXdndAction(manager->global_accepted_action); + Q_XCB_CALL(xcb_send_event(xcb_connection(), false, xdnd_dragsource, + XCB_EVENT_MASK_NO_EVENT, (char *)&finished)); + } else { + QDragLeaveEvent e; + QGuiApplication::sendEvent(currentWindow.data(), &e); + } + xdnd_dragsource = 0; + currentWindow.clear(); + waiting_for_status = false; + + // reset + target_time = XCB_CURRENT_TIME; +} + + +void QXcbDrag::handleFinished(const xcb_client_message_event_t *event, bool) +{ + DEBUG("xdndHandleFinished"); + if (event->window != connection()->clipboard()->owner()) + return; + + const unsigned long *l = (const unsigned long *)event->data.data32; + + DNDDEBUG << "xdndHandleFinished, l[0]" << l[0] + << "current_target" << current_target + << "qt_xdnd_current_proxy_targe" << current_proxy_target; + + if (l[0]) { + int at = findTransactionByWindow(l[0]); + if (at != -1) { + restartDropExpiryTimer(); + + Transaction t = transactions.takeAt(at); +// QDragManager *manager = QDragManager::self(); + +// Window target = current_target; +// Window proxy_target = current_proxy_target; +// QWidget *embedding_widget = current_embedding_widget; +// QDrag *currentObject = manager->object; + +// current_target = t.target; +// current_proxy_target = t.proxy_target; +// current_embedding_widget = t.embedding_widget; +// manager->object = t.object; + +// if (!passive) +// (void) checkEmbedded(currentWindow, xe); + +// current_embedding_widget = 0; +// current_target = 0; +// current_proxy_target = 0; + + if (t.object) + t.object->deleteLater(); + +// current_target = target; +// current_proxy_target = proxy_target; +// current_embedding_widget = embedding_widget; +// manager->object = currentObject; + } + } + waiting_for_status = false; +} + + +void QXcbDrag::timerEvent(QTimerEvent* e) +{ + if (e->timerId() == heartbeat && source_sameanswer.isNull()) { + QPointF pos = QCursor::pos(); + QMouseEvent me(QEvent::MouseMove, pos, pos, pos, Qt::LeftButton, + QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); + move(&me); + } else if (e->timerId() == transaction_expiry_timer) { + for (int i = 0; i < transactions.count(); ++i) { + const Transaction &t = transactions.at(i); + if (t.targetWindow) { + // dnd within the same process, don't delete these + continue; + } + t.object->deleteLater(); + transactions.removeAt(i--); + } + + killTimer(transaction_expiry_timer); + transaction_expiry_timer = -1; + } +} + +void QXcbDrag::cancel() +{ + DEBUG("QXcbDrag::cancel"); + endDrag(); + + if (current_target) + send_leave(); + + current_target = 0; +} + +#if 0 + +static +Window findRealWindow(const QPoint & pos, Window w, int md) +{ + if (xdnd_data.deco && w == xdnd_data.deco->effectiveWinId()) + return 0; + + if (md) { + X11->ignoreBadwindow(); + XWindowAttributes attr; + XGetWindowAttributes(X11->display, w, &attr); + if (X11->badwindow()) + return 0; + + if (attr.map_state == IsViewable + && QRect(attr.x,attr.y,attr.width,attr.height).contains(pos)) { + { + Atom type = XNone; + int f; + unsigned long n, a; + unsigned char *data; + + XGetWindowProperty(X11->display, w, ATOM(XdndAware), 0, 0, False, + AnyPropertyType, &type, &f,&n,&a,&data); + if (data) XFree(data); + if (type) + return w; + } + + Window r, p; + Window* c; + uint nc; + if (XQueryTree(X11->display, w, &r, &p, &c, &nc)) { + r=0; + for (uint i=nc; !r && i--;) { + r = findRealWindow(pos-QPoint(attr.x,attr.y), + c[i], md-1); + } + XFree(c); + if (r) + return r; + + // We didn't find a client window! Just use the + // innermost window. + } + + // No children! + return w; + } + } + return 0; +} +#endif + +void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event) +{ + xcb_selection_notify_event_t notify; + notify.response_type = XCB_SELECTION_NOTIFY; + notify.requestor = event->requestor; + notify.selection = event->selection; + notify.target = XCB_NONE; + notify.property = XCB_NONE; + notify.time = event->time; + + QDragManager *manager = QDragManager::self(); + QDrag *currentObject = manager->object; + + // which transaction do we use? (note: -2 means use current manager->object) + int at = -1; + + // figure out which data the requestor is really interested in + if (manager->object && event->time == source_time) { + // requestor wants the current drag data + at = -2; + } else { + // if someone has requested data in response to XdndDrop, find the corresponding transaction. the + // spec says to call XConvertSelection() using the timestamp from the XdndDrop + at = findTransactionByTime(event->time); + if (at == -1) { + // no dice, perhaps the client was nice enough to use the same window id in XConvertSelection() + // that we sent the XdndDrop event to. + at = findTransactionByWindow(event->requestor); + } +// if (at == -1 && event->time == XCB_CURRENT_TIME) { +// // previous Qt versions always requested the data on a child of the target window +// // using CurrentTime... but it could be asking for either drop data or the current drag's data +// Window target = findXdndAwareParent(event->requestor); +// if (target) { +// if (current_target && current_target == target) +// at = -2; +// else +// at = findXdndDropTransactionByWindow(target); +// } +// } + } + if (at >= 0) { + restartDropExpiryTimer(); + + // use the drag object from an XdndDrop tansaction + manager->object = transactions.at(at).object; + } else if (at != -2) { + // no transaction found, we'll have to reject the request + manager->object = 0; + } + if (manager->object) { + xcb_atom_t atomFormat = event->target; + int dataFormat = 0; + QByteArray data; + if (QXcbMime::mimeDataForAtom(connection(), event->target, manager->dragPrivate()->data, + &data, &atomFormat, &dataFormat)) { + int dataSize = data.size() / (dataFormat / 8); + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, event->requestor, event->property, + atomFormat, dataFormat, dataSize, (const void *)data.constData()); + notify.property = event->property; + notify.target = atomFormat; + } + } + + // reset manager->object in case we modified it above + manager->object = currentObject; + + xcb_send_event(xcb_connection(), false, event->requestor, XCB_EVENT_MASK_NO_EVENT, (const char *)¬ify); +} + + +bool QXcbDrag::dndEnable(QXcbWindow *w, bool on) +{ + DNDDEBUG << "xdndEnable" << w << on; + if (on) { + QXcbWindow *xdnd_widget = 0; + if ((w->window()->windowType() == Qt::Desktop)) { + if (desktop_proxy) // *WE* already have one. + return false; + + xcb_grab_server(xcb_connection()); + + // As per Xdnd4, use XdndProxy + xcb_window_t proxy_id = xdndProxy(connection(), w->xcb_window()); + + if (!proxy_id) { + desktop_proxy = new QWindow; + xdnd_widget = static_cast(desktop_proxy->handle()); + proxy_id = xdnd_widget->xcb_window(); + xcb_atom_t xdnd_proxy = atom(QXcbAtom::XdndProxy); + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, w->xcb_window(), xdnd_proxy, + XCB_ATOM_WINDOW, 32, 1, &proxy_id); + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, proxy_id, xdnd_proxy, + XCB_ATOM_WINDOW, 32, 1, &proxy_id); + } + + xcb_ungrab_server(xcb_connection()); + } else { + xdnd_widget = w; + } + if (xdnd_widget) { + DNDDEBUG << "setting XdndAware for" << xdnd_widget << xdnd_widget->xcb_window(); + xcb_atom_t atm = xdnd_version; + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, xdnd_widget->xcb_window(), + atom(QXcbAtom::XdndAware), XCB_ATOM_ATOM, 32, 1, &atm); + return true; + } else { + return false; + } + } else { + if ((w->window()->windowType() == Qt::Desktop)) { + xcb_delete_property(xcb_connection(), w->xcb_window(), atom(QXcbAtom::XdndProxy)); + delete desktop_proxy; + desktop_proxy = 0; + } else { + DNDDEBUG << "not deleting XDndAware"; + } + return true; + } +} + + + + +QDropData::QDropData(QXcbDrag *d) + : QXcbMime(), + drag(d) +{ +} + +QDropData::~QDropData() +{ +} + +QVariant QDropData::retrieveData_sys(const QString &mimetype, QVariant::Type requestedType) const +{ + QByteArray mime = mimetype.toLatin1(); + QVariant data = /*X11->motifdnd_active + ? X11->motifdndObtainData(mime) + :*/ xdndObtainData(mime, requestedType); + return data; +} + +QVariant QDropData::xdndObtainData(const QByteArray &format, QVariant::Type requestedType) const +{ + QByteArray result; + + QDragManager *manager = QDragManager::self(); + QXcbConnection *c = drag->connection(); + QXcbWindow *xcb_window = c->platformWindowFromId(drag->xdnd_dragsource); + if (xcb_window && manager->object && xcb_window->window()->windowType() != Qt::Desktop) { + QDragPrivate *o = manager->dragPrivate(); + if (o->data->hasFormat(QLatin1String(format))) + result = o->data->data(QLatin1String(format)); + return result; + } + + QList atoms = drag->xdnd_types; + QByteArray encoding; + xcb_atom_t a = mimeAtomForFormat(c, QLatin1String(format), requestedType, atoms, &encoding); + if (a == XCB_NONE) + return result; + + if (c->clipboard()->getSelectionOwner(drag->atom(QXcbAtom::XdndSelection)) == XCB_NONE) + return result; // should never happen? + + xcb_atom_t xdnd_selection = c->atom(QXcbAtom::XdndSelection); + result = c->clipboard()->getSelection(xdnd_selection, a, xdnd_selection); + + return mimeConvertToFormat(c, a, result, QLatin1String(format), requestedType, encoding); +} + + +bool QDropData::hasFormat_sys(const QString &format) const +{ + return formats().contains(format); +} + +QStringList QDropData::formats_sys() const +{ + QStringList formats; +// if (X11->motifdnd_active) { +// int i = 0; +// QByteArray fmt; +// while (!(fmt = X11->motifdndFormat(i)).isEmpty()) { +// formats.append(QLatin1String(fmt)); +// ++i; +// } +// } else { + for (int i = 0; i < drag->xdnd_types.size(); ++i) { + QString f = mimeAtomToString(drag->connection(), drag->xdnd_types.at(i)); + if (!formats.contains(f)) + formats.append(f); + } +// } + return formats; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h new file mode 100644 index 00000000000..ce0f8faa542 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBDRAG_H +#define QXCBDRAG_H + +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QMouseEvent; +class QWindow; +class QXcbConnection; +class QXcbWindow; +class QDropData; +class QXcbScreen; +class QDrag; + +class QXcbDrag : public QObject, public QXcbObject, public QPlatformDrag +{ +public: + QXcbDrag(QXcbConnection *c); + ~QXcbDrag(); + + virtual QMimeData *platformDropData(); + +// virtual Qt::DropAction drag(QDrag *); + + virtual void startDrag(); + virtual void cancel(); + virtual void move(const QMouseEvent *me); + virtual void drop(const QMouseEvent *me); + void endDrag(); + + void handleEnter(QWindow *window, const xcb_client_message_event_t *event); + void handlePosition(QWindow *w, const xcb_client_message_event_t *event, bool passive); + void handleLeave(QWindow *w, const xcb_client_message_event_t *event, bool /*passive*/); + void handleDrop(QWindow *, const xcb_client_message_event_t *event, bool passive); + + void handleStatus(const xcb_client_message_event_t *event, bool passive); + void handleSelectionRequest(const xcb_selection_request_event_t *event); + void handleFinished(const xcb_client_message_event_t *event, bool passive); + + bool dndEnable(QXcbWindow *win, bool on); + +protected: + void timerEvent(QTimerEvent* e); + +private: + friend class QDropData; + + void init(); + + void handle_xdnd_position(QWindow *w, const xcb_client_message_event_t *event, bool passive); + void handle_xdnd_status(const xcb_client_message_event_t *event, bool); + void send_leave(); + + Qt::DropAction toDropAction(xcb_atom_t atom) const; + xcb_atom_t toXdndAction(Qt::DropAction a) const; + + QWeakPointer currentWindow; + QPoint currentPosition; + + QDropData *dropData; + + QWindow *desktop_proxy; + + xcb_atom_t xdnd_dragsource; + + // the types in this drop. 100 is no good, but at least it's big. + enum { xdnd_max_type = 100 }; + QList xdnd_types; + + xcb_timestamp_t target_time; + xcb_timestamp_t source_time; + Qt::DropAction last_target_accepted_action; + + // rectangle in which the answer will be the same + QRect source_sameanswer; + bool waiting_for_status; + + // top-level window we sent position to last. + xcb_window_t current_target; + // window to send events to (always valid if current_target) + xcb_window_t current_proxy_target; + + QXcbScreen *current_screen; + + int heartbeat; + bool xdnd_dragging; + + QVector drag_types; + + struct Transaction + { + xcb_timestamp_t timestamp; + xcb_window_t target; + xcb_window_t proxy_target; + QWindow *targetWindow; +// QWidget *embedding_widget; + QDrag *object; + }; + QList transactions; + + int transaction_expiry_timer; + void restartDropExpiryTimer(); + int findTransactionByWindow(xcb_window_t window); + int findTransactionByTime(xcb_timestamp_t timestamp); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xcb/qxcbeglsurface.h b/src/plugins/platforms/xcb/qxcbeglsurface.h new file mode 100644 index 00000000000..a1e6c148a2f --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbeglsurface.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBEGLSURFACE_H +#define QXCBEGLSURFACE_H + +#include + +class QXcbEGLSurface +{ +public: + QXcbEGLSurface(EGLDisplay display, EGLSurface surface) + : m_display(display) + , m_surface(surface) + { + } + + ~QXcbEGLSurface() + { + eglDestroySurface(m_display, m_surface); + } + + EGLSurface surface() const { return m_surface; } + +private: + EGLDisplay m_display; + EGLSurface m_surface; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbimage.cpp b/src/plugins/platforms/xcb/qxcbimage.cpp new file mode 100644 index 00000000000..569e4fc4e47 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbimage.cpp @@ -0,0 +1,266 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbimage.h" +#include +#include +#include +#ifdef XCB_USE_RENDER +#include +// 'template' is used as a function argument name in xcb_renderutil.h +#define template template_param +// extern "C" is missing too +extern "C" { +#include +} +#undef template +#endif + +QT_BEGIN_NAMESPACE + +QImage::Format qt_xcb_imageFormatForVisual(QXcbConnection *connection, uint8_t depth, + const xcb_visualtype_t *visual) +{ + const xcb_format_t *format = connection->formatForDepth(depth); + + if (!visual || !format) + return QImage::Format_Invalid; + + if (depth == 32 && format->bits_per_pixel == 32 && visual->red_mask == 0xff0000 + && visual->green_mask == 0xff00 && visual->blue_mask == 0xff) + return QImage::Format_ARGB32_Premultiplied; + + if (depth == 24 && format->bits_per_pixel == 32 && visual->red_mask == 0xff0000 + && visual->green_mask == 0xff00 && visual->blue_mask == 0xff) + return QImage::Format_RGB32; + + if (depth == 16 && format->bits_per_pixel == 16 && visual->red_mask == 0xf800 + && visual->green_mask == 0x7e0 && visual->blue_mask == 0x1f) + return QImage::Format_RGB16; + + return QImage::Format_Invalid; +} + +QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap, + int width, int height, int depth, + const xcb_visualtype_t *visual) +{ + xcb_connection_t *conn = connection->xcb_connection(); + xcb_generic_error_t *error = 0; + + xcb_get_image_cookie_t get_image_cookie = + xcb_get_image(conn, XCB_IMAGE_FORMAT_Z_PIXMAP, pixmap, + 0, 0, width, height, 0xffffffff); + + xcb_get_image_reply_t *image_reply = + xcb_get_image_reply(conn, get_image_cookie, &error); + + if (!image_reply) { + if (error) { + connection->handleXcbError(error); + free(error); + } + return QPixmap(); + } + + uint8_t *data = xcb_get_image_data(image_reply); + uint32_t length = xcb_get_image_data_length(image_reply); + + QPixmap result; + + QImage::Format format = qt_xcb_imageFormatForVisual(connection, depth, visual); + if (format != QImage::Format_Invalid) { + uint32_t bytes_per_line = length / height; + QImage image(const_cast(data), width, height, bytes_per_line, format); + uint8_t image_byte_order = connection->setup()->image_byte_order; + + // we may have to swap the byte order + if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST) + || (QSysInfo::ByteOrder == QSysInfo::BigEndian && image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST)) + { + for (int i=0; i < image.height(); i++) { + switch (format) { + case QImage::Format_RGB16: { + ushort *p = (ushort*)image.scanLine(i); + ushort *end = p + image.width(); + while (p < end) { + *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); + p++; + } + break; + } + case QImage::Format_RGB32: // fall-through + case QImage::Format_ARGB32_Premultiplied: { + uint *p = (uint*)image.scanLine(i); + uint *end = p + image.width(); + while (p < end) { + *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) + | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); + p++; + } + break; + } + default: + Q_ASSERT(false); + } + } + } + + // fix-up alpha channel + if (format == QImage::Format_RGB32) { + QRgb *p = (QRgb *)image.bits(); + for (int y = 0; y < height; ++y) { + for (int x = 0; x < width; ++x) + p[x] |= 0xff000000; + p += bytes_per_line / 4; + } + } + + result = QPixmap::fromImage(image.copy()); + } + + free(image_reply); + return result; +} + +xcb_pixmap_t qt_xcb_XPixmapFromBitmap(QXcbScreen *screen, const QImage &image) +{ + xcb_connection_t *conn = screen->xcb_connection(); + QImage bitmap = image.convertToFormat(QImage::Format_MonoLSB); + const QRgb c0 = QColor(Qt::black).rgb(); + const QRgb c1 = QColor(Qt::white).rgb(); + if (bitmap.color(0) == c0 && bitmap.color(1) == c1) { + bitmap.invertPixels(); + bitmap.setColor(0, c1); + bitmap.setColor(1, c0); + } + const int width = bitmap.width(); + const int height = bitmap.height(); + const int bytesPerLine = bitmap.bytesPerLine(); + int destLineSize = width / 8; + if (width % 8) + ++destLineSize; + const uchar *map = bitmap.bits(); + uint8_t *buf = new uint8_t[height * destLineSize]; + for (int i = 0; i < height; i++) + memcpy(buf + (destLineSize * i), map + (bytesPerLine * i), destLineSize); + xcb_pixmap_t pm = xcb_create_pixmap_from_bitmap_data(conn, screen->root(), buf, + width, height, 1, 0, 0, 0); + delete[] buf; + return pm; +} + +xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image, + const QPoint &spot) +{ +#ifdef XCB_USE_RENDER + xcb_connection_t *conn = screen->xcb_connection(); + const int w = image.width(); + const int h = image.height(); + xcb_generic_error_t *error = 0; + xcb_render_query_pict_formats_cookie_t formatsCookie = xcb_render_query_pict_formats(conn); + xcb_render_query_pict_formats_reply_t *formatsReply = xcb_render_query_pict_formats_reply(conn, + formatsCookie, + &error); + if (!formatsReply || error) { + qWarning("createCursorXRender: query_pict_formats failed"); + free(formatsReply); + free(error); + return XCB_NONE; + } + xcb_render_pictforminfo_t *fmt = xcb_render_util_find_standard_format(formatsReply, + XCB_PICT_STANDARD_ARGB_32); + if (!fmt) { + qWarning("createCursorXRender: Failed to find format PICT_STANDARD_ARGB_32"); + free(formatsReply); + return XCB_NONE; + } + + QImage img = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); + xcb_image_t *xi = xcb_image_create(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP, + 32, 32, 32, 32, + QSysInfo::ByteOrder == QSysInfo::BigEndian ? XCB_IMAGE_ORDER_MSB_FIRST : XCB_IMAGE_ORDER_LSB_FIRST, + XCB_IMAGE_ORDER_MSB_FIRST, + 0, 0, 0); + if (!xi) { + qWarning("createCursorXRender: xcb_image_create failed"); + free(formatsReply); + return XCB_NONE; + } + xi->data = (uint8_t *) malloc(xi->stride * h); + if (!xi->data) { + qWarning("createCursorXRender: Failed to malloc() image data"); + xcb_image_destroy(xi); + free(formatsReply); + return XCB_NONE; + } + memcpy(xi->data, img.constBits(), img.byteCount()); + + xcb_pixmap_t pix = xcb_generate_id(conn); + xcb_create_pixmap(conn, 32, pix, screen->root(), w, h); + + xcb_render_picture_t pic = xcb_generate_id(conn); + xcb_render_create_picture(conn, pic, pix, fmt->id, 0, 0); + + xcb_gcontext_t gc = xcb_generate_id(conn); + xcb_create_gc(conn, gc, pix, 0, 0); + xcb_image_put(conn, pix, gc, xi, 0, 0, 0); + xcb_free_gc(conn, gc); + + xcb_cursor_t cursor = xcb_generate_id(conn); + xcb_render_create_cursor(conn, cursor, pic, spot.x(), spot.y()); + + free(xi->data); + xcb_image_destroy(xi); + xcb_render_free_picture(conn, pic); + xcb_free_pixmap(conn, pix); + free(formatsReply); + return cursor; + +#else + Q_UNUSED(screen); + Q_UNUSED(image); + Q_UNUSED(spot); + return XCB_NONE; +#endif +} + +QT_END_NAMESPACE diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.h b/src/plugins/platforms/xcb/qxcbimage.h similarity index 69% rename from src/plugins/gfxdrivers/vnc/qscreenvnc_qws.h rename to src/plugins/platforms/xcb/qxcbimage.h index 014486bdb48..1e7f1040847 100644 --- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.h +++ b/src/plugins/platforms/xcb/qxcbimage.h @@ -39,50 +39,26 @@ ** ****************************************************************************/ -#ifndef QSCREENVNC_QWS_H -#define QSCREENVNC_QWS_H +#ifndef QXCBIMAGE_H +#define QXCBIMAGE_H -#include - -#ifndef QT_NO_QWS_VNC - -QT_BEGIN_HEADER +#include "qxcbscreen.h" +#include +#include +#include +#include QT_BEGIN_NAMESPACE -QT_MODULE(Gui) - -class QVNCScreenPrivate; - -class QVNCScreen : public QProxyScreen -{ -public: - explicit QVNCScreen(int display_id); - virtual ~QVNCScreen(); - - bool initDevice(); - bool connect(const QString &displaySpec); - void disconnect(); - void shutdownDevice(); - - void setDirty(const QRect&); - -private: - friend class QVNCCursor; - friend class QVNCClientCursor; - friend class QVNCServer; - friend class QVNCScreenPrivate; - -#if Q_BYTE_ORDER == Q_BIG_ENDIAN - bool swapBytes() const; -#endif - - QVNCScreenPrivate *d_ptr; -}; +QImage::Format qt_xcb_imageFormatForVisual(QXcbConnection *connection, + uint8_t depth, const xcb_visualtype_t *visual); +QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap, + int width, int height, int depth, + const xcb_visualtype_t *visual); +xcb_pixmap_t qt_xcb_XPixmapFromBitmap(QXcbScreen *screen, const QImage &image); +xcb_cursor_t qt_xcb_createCursorXRender(QXcbScreen *screen, const QImage &image, + const QPoint &spot); QT_END_NAMESPACE -QT_END_HEADER - -#endif // QT_NO_QWS_VNC -#endif // QSCREENVNC_QWS_H +#endif diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 12b63f36ea0..b0d377bcacc 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -43,109 +43,184 @@ #include "qxcbconnection.h" #include "qxcbscreen.h" #include "qxcbwindow.h" -#include "qxcbwindowsurface.h" +#include "qxcbbackingstore.h" #include "qxcbnativeinterface.h" +#include "qxcbclipboard.h" +#include "qxcbdrag.h" #include -#include - -#include "qgenericunixfontdatabase.h" +#include +#include #include +//this has to be included before egl, since egl pulls in X headers +#include + #ifdef XCB_USE_EGL #include #endif -QXcbIntegration::QXcbIntegration() - : m_connection(new QXcbConnection) +#include +#include + +#if defined(XCB_USE_GLX) +#include "qglxintegration.h" +#elif defined(XCB_USE_EGL) +#include "qxcbeglsurface.h" +#include +#endif + +#include +#include + +QXcbIntegration::QXcbIntegration(const QStringList ¶meters) + : m_eventDispatcher(createUnixEventDispatcher()) { - foreach (QXcbScreen *screen, m_connection->screens()) - m_screens << screen; + QGuiApplicationPrivate::instance()->setEventDispatcher(m_eventDispatcher); + +#ifdef XCB_USE_XLIB + XInitThreads(); +#endif + + m_connections << new QXcbConnection; + + for (int i = 0; i < parameters.size() - 1; i += 2) { + qDebug() << parameters.at(i) << parameters.at(i+1); + QString display = parameters.at(i) + ':' + parameters.at(i+1); + m_connections << new QXcbConnection(display.toAscii().constData()); + } + + foreach (QXcbConnection *connection, m_connections) + foreach (QXcbScreen *screen, connection->screens()) + screenAdded(screen); m_fontDatabase = new QGenericUnixFontDatabase(); m_nativeInterface = new QXcbNativeInterface; + + m_inputContext = QPlatformInputContextFactory::create(); } QXcbIntegration::~QXcbIntegration() { - delete m_connection; + qDeleteAll(m_connections); +} + +QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const +{ + return new QXcbWindow(window); +} + +#if defined(XCB_USE_EGL) +class QEGLXcbPlatformContext : public QEGLPlatformContext +{ +public: + QEGLXcbPlatformContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share, + EGLDisplay display, QXcbConnection *c) + : QEGLPlatformContext(glFormat, share, display) + , m_connection(c) + { + Q_XCB_NOOP(m_connection); + } + + void swapBuffers(QPlatformSurface *surface) + { + Q_XCB_NOOP(m_connection); + QEGLPlatformContext::swapBuffers(surface); + Q_XCB_NOOP(m_connection); + } + + bool makeCurrent(QPlatformSurface *surface) + { + Q_XCB_NOOP(m_connection); + bool ret = QEGLPlatformContext::makeCurrent(surface); + Q_XCB_NOOP(m_connection); + return ret; + } + + void doneCurrent() + { + Q_XCB_NOOP(m_connection); + QEGLPlatformContext::doneCurrent(); + Q_XCB_NOOP(m_connection); + } + + EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) + { + return static_cast(surface)->eglSurface()->surface(); + } + +private: + QXcbConnection *m_connection; +}; +#endif + +QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const +{ + QXcbScreen *screen = static_cast(context->screen()->handle()); +#if defined(XCB_USE_GLX) + return new QGLXContext(screen, context->format(), context->shareHandle()); +#elif defined(XCB_USE_EGL) + return new QEGLXcbPlatformContext(context->format(), context->shareHandle(), + screen->connection()->egl_display(), screen->connection()); +#elif defined(XCB_USE_DRI2) + return new QDri2Context(context->format(), context->shareHandle()); +#endif +} + +QPlatformBackingStore *QXcbIntegration::createPlatformBackingStore(QWindow *window) const +{ + return new QXcbBackingStore(window); } bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const { switch (cap) { case ThreadedPixmaps: return true; - case OpenGL: return hasOpenGL(); + case OpenGL: return true; + case ThreadedOpenGL: +#ifdef XCB_POLL_FOR_QUEUED_EVENT + return true; +#else + return false; +#endif default: return QPlatformIntegration::hasCapability(cap); } } -QPixmapData *QXcbIntegration::createPixmapData(QPixmapData::PixelType type) const +QAbstractEventDispatcher *QXcbIntegration::guiThreadEventDispatcher() const { - return new QRasterPixmapData(type); + return m_eventDispatcher; } -QPlatformWindow *QXcbIntegration::createPlatformWindow(QWidget *widget, WId winId) const -{ - Q_UNUSED(winId); - return new QXcbWindow(widget); -} - -QWindowSurface *QXcbIntegration::createWindowSurface(QWidget *widget, WId winId) const -{ - Q_UNUSED(winId); - return new QXcbWindowSurface(widget); -} - -QList QXcbIntegration::screens() const -{ - return m_screens; -} - -void QXcbIntegration::moveToScreen(QWidget *window, int screen) +void QXcbIntegration::moveToScreen(QWindow *window, int screen) { Q_UNUSED(window); Q_UNUSED(screen); } -bool QXcbIntegration::isVirtualDesktop() -{ - return false; -} - QPlatformFontDatabase *QXcbIntegration::fontDatabase() const { return m_fontDatabase; } -QPixmap QXcbIntegration::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 QXcbIntegration::hasOpenGL() const -{ -#if defined(XCB_USE_GLX) - return true; -#elif defined(XCB_USE_EGL) - return m_connection->hasEgl(); -#elif defined(XCB_USE_DRI2) - if (m_connection->hasSupportForDri2()) { - return true; - } -#endif - return false; -} - QPlatformNativeInterface * QXcbIntegration::nativeInterface() const { return m_nativeInterface; } + +QPlatformClipboard *QXcbIntegration::clipboard() const +{ + return m_connections.at(0)->clipboard(); +} + +QPlatformDrag *QXcbIntegration::drag() const +{ + return m_connections.at(0)->drag(); +} + +QPlatformInputContext *QXcbIntegration::inputContext() const +{ + return m_inputContext; +} diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index cd68919b549..cad127c28e6 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -48,34 +48,40 @@ QT_BEGIN_NAMESPACE class QXcbConnection; +class QAbstractEventDispatcher; class QXcbIntegration : public QPlatformIntegration { public: - QXcbIntegration(); + QXcbIntegration(const QStringList ¶meters); ~QXcbIntegration(); - bool hasCapability(Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; - QList screens() const; - void moveToScreen(QWidget *window, int screen); - bool isVirtualDesktop(); - QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + bool hasCapability(Capability cap) const; + QAbstractEventDispatcher *guiThreadEventDispatcher() const; + + void moveToScreen(QWindow *window, int screen); QPlatformFontDatabase *fontDatabase() const; QPlatformNativeInterface *nativeInterface()const; + QPlatformClipboard *clipboard() const; + QPlatformDrag *drag() const; + + QPlatformInputContext *inputContext() const; + private: - bool hasOpenGL() const; - QList m_screens; - QXcbConnection *m_connection; + QList m_connections; QPlatformFontDatabase *m_fontDatabase; QPlatformNativeInterface *m_nativeInterface; + + QPlatformInputContext *m_inputContext; + QAbstractEventDispatcher *m_eventDispatcher; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 6bbc3c18ca8..907dd0f1b6b 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -40,16 +40,17 @@ ****************************************************************************/ #include "qxcbkeyboard.h" - +#include "qxcbwindow.h" +#include "qxcbscreen.h" #include - #include - #include #include - +#include #include +#include + #ifndef XK_ISO_Left_Tab #define XK_ISO_Left_Tab 0xFE20 #endif @@ -898,12 +899,9 @@ QString QXcbKeyboard::translateKeySym(xcb_keysym_t keysym, uint xmodifiers, QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) : QXcbObject(connection) - , m_alt_mask(0) - , m_super_mask(0) - , m_hyper_mask(0) - , m_meta_mask(0) { m_key_symbols = xcb_key_symbols_alloc(xcb_connection()); + setupModifiers(); } QXcbKeyboard::~QXcbKeyboard() @@ -911,18 +909,113 @@ QXcbKeyboard::~QXcbKeyboard() xcb_key_symbols_free(m_key_symbols); } +void QXcbKeyboard::setupModifiers() +{ + m_alt_mask = 0; + m_super_mask = 0; + m_hyper_mask = 0; + m_meta_mask = 0; + m_mode_switch_mask = 0; + m_num_lock_mask = 0; + m_caps_lock_mask = 0; + + xcb_generic_error_t *error = 0; + xcb_connection_t *conn = xcb_connection(); + xcb_get_modifier_mapping_cookie_t modMapCookie = xcb_get_modifier_mapping(conn); + xcb_get_modifier_mapping_reply_t *modMapReply = + xcb_get_modifier_mapping_reply(conn, modMapCookie, &error); + if (error) { + qWarning("xcb keyboard: failed to get modifier mapping"); + free(error); + return; + } + + // Figure out the modifier mapping, ICCCM 6.6 + typedef QPair SymCodes; + QList modKeyCodes; + + // for Alt and Meta L and R are the same + modKeyCodes << SymCodes(XK_Alt_L, xcb_key_symbols_get_keycode(m_key_symbols, XK_Alt_L)); + modKeyCodes << SymCodes(XK_Meta_L, xcb_key_symbols_get_keycode(m_key_symbols, XK_Meta_L)); + modKeyCodes << SymCodes(XK_Super_L, xcb_key_symbols_get_keycode(m_key_symbols, XK_Super_L)); + modKeyCodes << SymCodes(XK_Super_R, xcb_key_symbols_get_keycode(m_key_symbols, XK_Super_R)); + modKeyCodes << SymCodes(XK_Hyper_L, xcb_key_symbols_get_keycode(m_key_symbols, XK_Hyper_L)); + modKeyCodes << SymCodes(XK_Hyper_R, xcb_key_symbols_get_keycode(m_key_symbols, XK_Hyper_R)); + modKeyCodes << SymCodes(XK_Num_Lock, xcb_key_symbols_get_keycode(m_key_symbols, XK_Num_Lock)); + modKeyCodes << SymCodes(XK_Mode_switch, xcb_key_symbols_get_keycode(m_key_symbols, XK_Mode_switch)); + modKeyCodes << SymCodes(XK_Caps_Lock, xcb_key_symbols_get_keycode(m_key_symbols, XK_Caps_Lock)); + + xcb_keycode_t *modMap = xcb_get_modifier_mapping_keycodes(modMapReply); + const int w = modMapReply->keycodes_per_modifier; + for (int i = 0; i < modKeyCodes.count(); ++i) { + for (int bit = 0; bit < 8; ++bit) { + uint mask = 1 << bit; + for (int x = 0; x < w; ++x) { + xcb_keycode_t keyCode = modMap[x + bit * w]; + xcb_keycode_t *itk = modKeyCodes.at(i).second; + while (itk && *itk != XCB_NO_SYMBOL) + if (*itk++ == keyCode) + setMask(modKeyCodes.at(i).first, mask); + } + } + } + + for (int i = 0; i < modKeyCodes.count(); ++i) + free(modKeyCodes.at(i).second); + free(modMapReply); +} + +void QXcbKeyboard::setMask(uint sym, uint mask) +{ + if (m_alt_mask == 0 + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Alt_L || sym == XK_Alt_R)) + m_alt_mask = mask; + + if (m_meta_mask == 0 + && m_alt_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Meta_L || sym == XK_Meta_R)) + m_meta_mask = mask; + + if (m_super_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_hyper_mask != mask + && (sym == XK_Super_L || sym == XK_Super_R)) + m_super_mask = mask; + + if (m_hyper_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && (sym == XK_Hyper_L || sym == XK_Hyper_R)) + m_hyper_mask = mask; + + if (m_mode_switch_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && sym == XK_Mode_switch) + m_mode_switch_mask = mask; + + if (m_num_lock_mask == 0 && sym == XK_Num_Lock) + m_num_lock_mask = mask; + + if (m_caps_lock_mask == 0 && sym == XK_Caps_Lock) + m_caps_lock_mask = mask; +} + // #define XCB_KEYBOARD_DEBUG -void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time) +void QXcbKeyboard::handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, + quint16 state, xcb_timestamp_t time) { - int col = state & XCB_MOD_MASK_SHIFT ? 1 : 0; - - const int altGrOffset = 4; - if (state & 128) - col += altGrOffset; - Q_XCB_NOOP(connection()); - #ifdef XCB_KEYBOARD_DEBUG printf("key code: %d, state: %d, syms: ", code, state); for (int i = 0; i <= 5; ++i) { @@ -931,43 +1024,105 @@ void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycod printf("\n"); #endif - Q_XCB_NOOP(connection()); + QByteArray chars; + xcb_keysym_t sym = lookupString(window, state, code, type, &chars); + + if (QObject* inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext()) { + bool retval; + QMetaObject::invokeMethod(inputContext, "x11FilterEvent", Qt::DirectConnection, + Q_RETURN_ARG(bool, retval), + Q_ARG(uint, sym), + Q_ARG(uint, code), + Q_ARG(uint, state), + Q_ARG(bool, type == QEvent::KeyPress)); + if (retval) + return; + } + + Qt::KeyboardModifiers modifiers; + int qtcode = 0; + int count = chars.count(); + QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count); + QWindowSystemInterface::handleExtendedKeyEvent(window, time, type, qtcode, modifiers, + code, 0, state, string.left(count)); +} + +#ifdef XCB_USE_XLIB +extern "C" { + int XLookupString(void *event, char *buf, int count, void *keysym, void *comp); +} +typedef struct { // must match XKeyEvent in Xlib.h + int type; + unsigned long serial; + int send_event; + void *display; + unsigned long window; + unsigned long root; + unsigned long subwindow; + unsigned long time; + int x, y; + int x_root, y_root; + unsigned int state; + unsigned int keycode; + int same_screen; +} FakeXKeyEvent; +#endif + +xcb_keysym_t QXcbKeyboard::lookupString(QWindow *window, uint state, xcb_keycode_t code, + QEvent::Type type, QByteArray *chars) +{ +#ifdef XCB_USE_XLIB + + xcb_keysym_t sym = XCB_NO_SYMBOL; + chars->resize(512); + FakeXKeyEvent event; + memset(&event, 0, sizeof(event)); + event.type = (type == QEvent::KeyRelease ? 3 : 2); + event.display = connection()->xlib_display(); + event.window = static_cast(window->handle())->xcb_window(); + event.root = connection()->screens().at(0)->root(); + event.state = state; + event.keycode = code; + int count = XLookupString(&event, chars->data(), chars->size(), &sym, 0); + chars->resize(count); + return sym; + +#else + + // No XLookupString available. The following is really incomplete... + + int col = state & XCB_MOD_MASK_SHIFT ? 1 : 0; + const int altGrOffset = 4; + if (state & 128) + col += altGrOffset; xcb_keysym_t sym = xcb_key_symbols_get_keysym(m_key_symbols, code, col); if (sym == XCB_NO_SYMBOL) sym = xcb_key_symbols_get_keysym(m_key_symbols, code, col ^ 0x1); - if (state & XCB_MOD_MASK_LOCK && sym <= 0x7f && isprint(sym)) { if (isupper(sym)) sym = tolower(sym); else sym = toupper(sym); } + return sym; - Q_XCB_NOOP(connection()); - - QByteArray chars; - - Qt::KeyboardModifiers modifiers; - int qtcode = 0; - int count = 0; - - QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count); - - QWindowSystemInterface::handleExtendedKeyEvent(widget, time, type, qtcode, modifiers, code, 0, state, string.left(count)); +#endif } -void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) +void QXcbKeyboard::handleKeyPressEvent(QXcbWindow *window, const xcb_key_press_event_t *event) { - handleKeyEvent(widget, QEvent::KeyPress, event->detail, event->state, event->time); + window->updateNetWmUserTime(event->time); + handleKeyEvent(window->window(), QEvent::KeyPress, event->detail, event->state, event->time); } -void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event) +void QXcbKeyboard::handleKeyReleaseEvent(QXcbWindow *window, const xcb_key_release_event_t *event) { - handleKeyEvent(widget, QEvent::KeyRelease, event->detail, event->state, event->time); + handleKeyEvent(window->window(), QEvent::KeyRelease, event->detail, event->state, event->time); } void QXcbKeyboard::handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event) { xcb_refresh_keyboard_mapping(m_key_symbols, const_cast(event)); + setupModifiers(); } diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 095c3e4efb6..ea5f84e8c2e 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -48,26 +48,32 @@ #include +class QWindow; + class QXcbKeyboard : public QXcbObject { public: QXcbKeyboard(QXcbConnection *connection); ~QXcbKeyboard(); - void handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event); - void handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event); + void handleKeyPressEvent(QXcbWindow *window, const xcb_key_press_event_t *event); + void handleKeyReleaseEvent(QXcbWindow *window, const xcb_key_release_event_t *event); void handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event); Qt::KeyboardModifiers translateModifiers(int s); private: - void handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time); + void handleKeyEvent(QWindow *window, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time); int translateKeySym(uint key) const; QString translateKeySym(xcb_keysym_t keysym, uint xmodifiers, int &code, Qt::KeyboardModifiers &modifiers, QByteArray &chars, int &count); + void setupModifiers(); + void setMask(uint sym, uint mask); + xcb_keysym_t lookupString(QWindow *window, uint state, xcb_keycode_t code, + QEvent::Type type, QByteArray *chars); uint m_alt_mask; uint m_super_mask; @@ -75,6 +81,7 @@ private: uint m_meta_mask; uint m_mode_switch_mask; uint m_num_lock_mask; + uint m_caps_lock_mask; xcb_key_symbols_t *m_key_symbols; }; diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp new file mode 100644 index 00000000000..d4f80ca09d5 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -0,0 +1,288 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the 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 "qxcbmime.h" + +#include +#include +#include +#include + +#include + +#undef XCB_ATOM_STRING +#undef XCB_ATOM_PIXMAP +#undef XCB_ATOM_BITMAP + +QXcbMime::QXcbMime() + : QInternalMimeData() +{ } + +QXcbMime::~QXcbMime() +{} + + + +QString QXcbMime::mimeAtomToString(QXcbConnection *connection, xcb_atom_t a) +{ + if (a == XCB_NONE) + return QString(); + + // special cases for string type + if (a == XCB_ATOM_STRING + || a == connection->atom(QXcbAtom::UTF8_STRING) + || a == connection->atom(QXcbAtom::TEXT)) + return QLatin1String("text/plain"); + + // special case for images + if (a == XCB_ATOM_PIXMAP) + return QLatin1String("image/ppm"); + + QByteArray atomName = connection->atomName(a); + + // special cases for uris + if (atomName == "text/x-moz-url") + atomName = "text/uri-list"; + + return QString::fromLatin1(atomName.constData()); +} + +bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeData *mimeData, QByteArray *data, + xcb_atom_t *atomFormat, int *dataFormat) +{ + if (!data) + return false; + + bool ret = false; + *atomFormat = a; + *dataFormat = 8; + + if ((a == connection->atom(QXcbAtom::UTF8_STRING) + || a == XCB_ATOM_STRING + || a == connection->atom(QXcbAtom::TEXT)) + && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { + if (a == connection->atom(QXcbAtom::UTF8_STRING)) { + *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); + ret = true; + } else if (a == XCB_ATOM_STRING || + a == connection->atom(QXcbAtom::TEXT)) { + // ICCCM says STRING is latin1 + *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLatin1(); + ret = true; + } + return ret; + } + + QString atomName = mimeAtomToString(connection, a); + if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { + *data = QInternalMimeData::renderDataHelper(atomName, mimeData); + if (atomName == QLatin1String("application/x-color")) + *dataFormat = 16; + ret = true; + } else if (atomName == QLatin1String("text/x-moz-url") && + QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { + QByteArray uri = QInternalMimeData::renderDataHelper( + QLatin1String("text/uri-list"), mimeData).split('\n').first(); + QString mozUri = QString::fromLatin1(uri, uri.size()); + mozUri += QLatin1Char('\n'); + *data = QByteArray(reinterpret_cast(mozUri.utf16()), mozUri.length() * 2); + ret = true; + } else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) { + ret = true; + } + return ret; +} + +QList QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, const QString &format) +{ + QList atoms; + atoms.append(connection->internAtom(format.toLatin1())); + + // special cases for strings + if (format == QLatin1String("text/plain")) { + atoms.append(connection->atom(QXcbAtom::UTF8_STRING)); + atoms.append(XCB_ATOM_STRING); + atoms.append(connection->atom(QXcbAtom::TEXT)); + } + + // special cases for uris + if (format == QLatin1String("text/uri-list")) + atoms.append(connection->internAtom("text/x-moz-url")); + + //special cases for images + if (format == QLatin1String("image/ppm")) + atoms.append(XCB_ATOM_PIXMAP); + if (format == QLatin1String("image/pbm")) + atoms.append(XCB_ATOM_BITMAP); + + return atoms; +} + +QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &data, const QString &format, + QVariant::Type requestedType, const QByteArray &encoding) +{ + QString atomName = mimeAtomToString(connection, a); +// qDebug() << "mimeConvertDataToFormat" << format << atomName << data; + + if (!encoding.isEmpty() + && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { + + if (requestedType == QVariant::String) { + QTextCodec *codec = QTextCodec::codecForName(encoding); + if (codec) + return codec->toUnicode(data); + } + + return data; + } + + // special cases for string types + if (format == QLatin1String("text/plain")) { + if (a == connection->atom(QXcbAtom::UTF8_STRING)) + return QString::fromUtf8(data); + if (a == XCB_ATOM_STRING || + a == connection->atom(QXcbAtom::TEXT)) + return QString::fromLatin1(data); + } + + // special case for uri types + if (format == QLatin1String("text/uri-list")) { + if (atomName == QLatin1String("text/x-moz-url")) { + // we expect this as utf16 + // the first part is a url that should only contain ascci char + // so it should be safe to check that the second char is 0 + // to verify that it is utf16 + if (data.size() > 1 && data.at(1) == 0) + return QString::fromRawData((const QChar *)data.constData(), + data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); + } + } + + if (atomName == format) + return data; + +#if 0 // ### + // special case for images + if (format == QLatin1String("image/ppm")) { + if (a == XCB_ATOM_PIXMAP && data.size() == sizeof(Pixmap)) { + Pixmap xpm = *((Pixmap*)data.data()); + if (!xpm) + return QByteArray(); + Window root; + int x; + int y; + uint width; + uint height; + uint border_width; + uint depth; + + XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); + XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); + QImage qimg = QXlibStatic::qimageFromXImage(ximg); + XDestroyImage(ximg); + + QImageWriter imageWriter; + imageWriter.setFormat("PPMRAW"); + QBuffer buf; + buf.open(QIODevice::WriteOnly); + imageWriter.setDevice(&buf); + imageWriter.write(qimg); + return buf.buffer(); + } + } +#endif + return QVariant(); +} + +xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString &format, QVariant::Type requestedType, + const QList<xcb_atom_t> &atoms, QByteArray *requestedEncoding) +{ + requestedEncoding->clear(); + + // find matches for string types + if (format == QLatin1String("text/plain")) { + if (atoms.contains(connection->atom(QXcbAtom::UTF8_STRING))) + return connection->atom(QXcbAtom::UTF8_STRING); + if (atoms.contains(XCB_ATOM_STRING)) + return XCB_ATOM_STRING; + if (atoms.contains(connection->atom(QXcbAtom::TEXT))) + return connection->atom(QXcbAtom::TEXT); + } + + // find matches for uri types + if (format == QLatin1String("text/uri-list")) { + xcb_atom_t a = connection->internAtom(format.toLatin1()); + if (a && atoms.contains(a)) + return a; + a = connection->internAtom("text/x-moz-url"); + if (a && atoms.contains(a)) + return a; + } + + // find match for image + if (format == QLatin1String("image/ppm")) { + if (atoms.contains(XCB_ATOM_PIXMAP)) + return XCB_ATOM_PIXMAP; + } + + // for string/text requests try to use a format with a well-defined charset + // first to avoid encoding problems + if (requestedType == QVariant::String + && format.startsWith(QLatin1String("text/")) + && !format.contains(QLatin1String("charset="))) { + + QString formatWithCharset = format; + formatWithCharset.append(QLatin1String(";charset=utf-8")); + + xcb_atom_t a = connection->internAtom(formatWithCharset.toLatin1()); + if (a && atoms.contains(a)) { + *requestedEncoding = "utf-8"; + return a; + } + } + + xcb_atom_t a = connection->internAtom(format.toLatin1()); + if (a && atoms.contains(a)) + return a; + + return 0; +} diff --git a/src/plugins/platforms/xcb/qxcbmime.h b/src/plugins/platforms/xcb/qxcbmime.h new file mode 100644 index 00000000000..4ab38ed803d --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbmime.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the 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 QXCBMIME_H +#define QXCBMIME_H + +#include <private/qdnd_p.h> + +#include <QtGui/QClipboard> + +#include "qxcbintegration.h" +#include "qxcbconnection.h" + +class QXcbMime : public QInternalMimeData { + Q_OBJECT +public: + QXcbMime(); + ~QXcbMime(); + + static QList<xcb_atom_t> mimeAtomsForFormat(QXcbConnection *connection, const QString &format); + static QString mimeAtomToString(QXcbConnection *connection, xcb_atom_t a); + static bool mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeData *mimeData, QByteArray *data, + xcb_atom_t *atomFormat, int *dataFormat); + static QVariant mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &data, const QString &format, + QVariant::Type requestedType, const QByteArray &encoding); + static xcb_atom_t mimeAtomForFormat(QXcbConnection *connection, const QString &format, QVariant::Type requestedType, + const QList<xcb_atom_t> &atoms, QByteArray *requestedEncoding); +}; + +#endif // QXCBMIME_H diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 6423f1b7986..3c9cdfd2570 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -43,13 +43,16 @@ #include "qxcbscreen.h" -#include <QtGui/private/qapplication_p.h> +#include <private/qguiapplication_p.h> #include <QtCore/QMap> #include <QtCore/QDebug> +#include <QtGui/qopenglcontext.h> +#include <QtGui/qscreen.h> + #if defined(XCB_USE_EGL) -#include "../eglconvenience/qeglplatformcontext.h" +#include "QtPlatformSupport/private/qeglplatformcontext_p.h" #elif defined (XCB_USE_DRI2) #include "qdri2context.h" #endif @@ -71,29 +74,14 @@ public: Q_GLOBAL_STATIC(QXcbResourceMap, qXcbResourceMap) -void *QXcbNativeInterface::nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget) +void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) { QByteArray lowerCaseResource = resourceString.toLower(); ResourceType resource = qXcbResourceMap()->value(lowerCaseResource); void *result = 0; switch(resource) { - case Display: - result = displayForWidget(widget); - break; - case EglDisplay: - result = eglDisplayForWidget(widget); - break; - case Connection: - result = connectionForWidget(widget); - break; - case Screen: - result = qPlatformScreenForWidget(widget); - break; - case GraphicsDevice: - result = graphicsDeviceForWidget(widget); - break; case EglContext: - result = eglContextForWidget(widget); + result = eglContextForContext(context); break; default: result = 0; @@ -101,75 +89,103 @@ void *QXcbNativeInterface::nativeResourceForWidget(const QByteArray &resourceStr return result; } -QXcbScreen *QXcbNativeInterface::qPlatformScreenForWidget(QWidget *widget) +void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) +{ + QByteArray lowerCaseResource = resourceString.toLower(); + ResourceType resource = qXcbResourceMap()->value(lowerCaseResource); + void *result = 0; + switch(resource) { + case Display: + result = displayForWindow(window); + break; + case EglDisplay: + result = eglDisplayForWindow(window); + break; + case Connection: + result = connectionForWindow(window); + break; + case Screen: + result = qPlatformScreenForWindow(window); + break; + case GraphicsDevice: + result = graphicsDeviceForWindow(window); + break; + default: + result = 0; + } + return result; +} + +QXcbScreen *QXcbNativeInterface::qPlatformScreenForWindow(QWindow *window) { QXcbScreen *screen; - if (widget) { - screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(widget)); - }else { - screen = static_cast<QXcbScreen *>(QApplicationPrivate::platformIntegration()->screens()[0]); + if (window) { + screen = static_cast<QXcbScreen *>(window->screen()->handle()); + } else { + screen = static_cast<QXcbScreen *>(QGuiApplication::primaryScreen()->handle()); } return screen; } -void *QXcbNativeInterface::displayForWidget(QWidget *widget) +void *QXcbNativeInterface::displayForWindow(QWindow *window) { #if defined(XCB_USE_XLIB) - QXcbScreen *screen = qPlatformScreenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWindow(window); return screen->connection()->xlib_display(); #else - Q_UNUSED(widget); + Q_UNUSED(window); return 0; #endif } -void *QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) +void *QXcbNativeInterface::eglDisplayForWindow(QWindow *window) { #if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL) - QXcbScreen *screen = qPlatformScreenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWindow(window); return screen->connection()->egl_display(); #else - Q_UNUSED(widget) + Q_UNUSED(window) return 0; #endif } -void *QXcbNativeInterface::connectionForWidget(QWidget *widget) +void *QXcbNativeInterface::connectionForWindow(QWindow *window) { - QXcbScreen *screen = qPlatformScreenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWindow(window); return screen->xcb_connection(); } -void *QXcbNativeInterface::screenForWidget(QWidget *widget) +void *QXcbNativeInterface::screenForWindow(QWindow *window) { - QXcbScreen *screen = qPlatformScreenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWindow(window); return screen->screen(); } -void *QXcbNativeInterface::graphicsDeviceForWidget(QWidget *widget) +void *QXcbNativeInterface::graphicsDeviceForWindow(QWindow *window) { #if defined(XCB_USE_DRI2) - QXcbScreen *screen = qPlatformScreenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWindow(window); QByteArray deviceName = screen->connection()->dri2DeviceName(); return deviceName.data(); #else - Q_UNUSED(widget); + Q_UNUSED(window); return 0; #endif } -void * QXcbNativeInterface::eglContextForWidget(QWidget *widget) +void * QXcbNativeInterface::eglContextForContext(QOpenGLContext *context) { - Q_ASSERT(widget); - if (!widget->platformWindow()) { - qDebug() << "QPlatformWindow does not exist for widget" << widget - << "cannot return EGLContext"; - return 0; - } - QPlatformGLContext *platformContext = widget->platformWindow()->glContext(); + Q_ASSERT(context); +#if defined(XCB_USE_EGL) + QEGLPlatformContext *eglPlatformContext = static_cast<QEGLPlatformContext *>(context->handle()); + return eglPlatformContext->eglContext(); +#endif +#if 0 + Q_ASSERT(window); + QPlatformOpenGLContext *platformContext = window->glContext()->handle(); if (!platformContext) { - qDebug() << "QPlatformWindow" << widget->platformWindow() << "does not have a glContext" + qDebug() << "QWindow" << window << "does not have a glContext" << "cannot return EGLContext"; return 0; } @@ -182,4 +198,7 @@ void * QXcbNativeInterface::eglContextForWidget(QWidget *widget) #else return 0; #endif +#else + return 0; +#endif } diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 3fb0fa5e2d9..8dec83267a5 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -59,17 +59,19 @@ public: EglContext }; - void *nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget); + void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context); + void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); - void *displayForWidget(QWidget *widget); - void *eglDisplayForWidget(QWidget *widget); - void *connectionForWidget(QWidget *widget); - void *screenForWidget(QWidget *widget); - void *graphicsDeviceForWidget(QWidget *widget); - void *eglContextForWidget(QWidget *widget); + void *displayForWindow(QWindow *window); + void *eglDisplayForWindow(QWindow *window); + void *connectionForWindow(QWindow *window); + void *screenForWindow(QWindow *window); + void *graphicsDeviceForWindow(QWindow *window); + + void *eglContextForContext(QOpenGLContext *context); private: - static QXcbScreen *qPlatformScreenForWidget(QWidget *widget); + static QXcbScreen *qPlatformScreenForWindow(QWindow *window); }; #endif // QXCBNATIVEINTERFACE_H diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 9a4858123b1..42259feda82 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qxcbscreen.h" +#include "qxcbwindow.h" +#include "qxcbcursor.h" +#include "qxcbimage.h" #include <stdio.h> @@ -102,10 +105,104 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int num free(reply); m_syncRequestSupported = m_windowManagerName != QLatin1String("KWin"); + + m_clientLeader = xcb_generate_id(xcb_connection()); + Q_XCB_CALL2(xcb_create_window(xcb_connection(), + XCB_COPY_FROM_PARENT, + m_clientLeader, + m_screen->root, + 0, 0, 1, 1, + 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + m_screen->root_visual, + 0, 0), connection); + + Q_XCB_CALL2(xcb_change_property(xcb_connection(), + XCB_PROP_MODE_REPLACE, + m_clientLeader, + atom(QXcbAtom::WM_CLIENT_LEADER), + XCB_ATOM_WINDOW, + 32, + 1, + &m_clientLeader), connection); + + xcb_depth_iterator_t depth_iterator = + xcb_screen_allowed_depths_iterator(screen); + + while (depth_iterator.rem) { + xcb_depth_t *depth = depth_iterator.data; + xcb_visualtype_iterator_t visualtype_iterator = + xcb_depth_visuals_iterator(depth); + + while (visualtype_iterator.rem) { + xcb_visualtype_t *visualtype = visualtype_iterator.data; + m_visuals.insert(visualtype->visual_id, *visualtype); + xcb_visualtype_next(&visualtype_iterator); + } + + xcb_depth_next(&depth_iterator); + } + + m_cursor = new QXcbCursor(connection, this); } QXcbScreen::~QXcbScreen() { + delete m_cursor; +} + + +QWindow *QXcbScreen::topLevelAt(const QPoint &p) const +{ + xcb_window_t root = m_screen->root; + + int x = p.x(); + int y = p.y(); + + xcb_generic_error_t *error; + + xcb_window_t parent = root; + xcb_window_t child = root; + + do { + xcb_translate_coordinates_cookie_t translate_cookie = + xcb_translate_coordinates(xcb_connection(), parent, child, x, y); + + xcb_translate_coordinates_reply_t *translate_reply = + xcb_translate_coordinates_reply(xcb_connection(), translate_cookie, &error); + + if (!translate_reply) { + if (error) { + connection()->handleXcbError(error); + free(error); + } + return 0; + } + + parent = child; + child = translate_reply->child; + x = translate_reply->dst_x; + y = translate_reply->dst_y; + + free(translate_reply); + + if (!child || child == root) + return 0; + + QPlatformWindow *platformWindow = connection()->platformWindowFromId(child); + if (platformWindow) + return platformWindow->window(); + } while (parent != child); + + return 0; +} + +const xcb_visualtype_t *QXcbScreen::visualForId(xcb_visualid_t visualid) const +{ + QMap<xcb_visualid_t, xcb_visualtype_t>::const_iterator it = m_visuals.find(visualid); + if (it == m_visuals.constEnd()) + return 0; + return &*it; } QRect QXcbScreen::geometry() const @@ -132,3 +229,126 @@ int QXcbScreen::screenNumber() const { return m_number; } + +QPixmap QXcbScreen::grabWindow(WId window, int x, int y, int width, int height) const +{ + if (width == 0 || height == 0) + return QPixmap(); + + xcb_get_geometry_cookie_t geometry_cookie = xcb_get_geometry(xcb_connection(), window); + + xcb_generic_error_t *error; + xcb_get_geometry_reply_t *reply = + xcb_get_geometry_reply(xcb_connection(), geometry_cookie, &error); + + if (!reply) { + if (error) { + connection()->handleXcbError(error); + free(error); + } + return QPixmap(); + } + + if (width < 0) + width = reply->width - x; + if (height < 0) + height = reply->height - y; + + // TODO: handle multiple screens + QXcbScreen *screen = const_cast<QXcbScreen *>(this); + xcb_window_t root = screen->root(); + geometry_cookie = xcb_get_geometry(xcb_connection(), root); + xcb_get_geometry_reply_t *root_reply = + xcb_get_geometry_reply(xcb_connection(), geometry_cookie, &error); + + if (!root_reply) { + if (error) { + connection()->handleXcbError(error); + free(error); + } + free(reply); + return QPixmap(); + } + + if (reply->depth == root_reply->depth) { + // if the depth of the specified window and the root window are the + // same, grab pixels from the root window (so that we get the any + // overlapping windows and window manager frames) + + // map x and y to the root window + xcb_translate_coordinates_cookie_t translate_cookie = + xcb_translate_coordinates(xcb_connection(), window, root, x, y); + + xcb_translate_coordinates_reply_t *translate_reply = + xcb_translate_coordinates_reply(xcb_connection(), translate_cookie, &error); + + if (!translate_reply) { + if (error) { + connection()->handleXcbError(error); + free(error); + } + free(reply); + free(root_reply); + return QPixmap(); + } + + x = translate_reply->dst_x; + y = translate_reply->dst_y; + + window = root; + + free(translate_reply); + free(reply); + reply = root_reply; + } else { + free(root_reply); + root_reply = 0; + } + + xcb_get_window_attributes_reply_t *attributes_reply = + xcb_get_window_attributes_reply(xcb_connection(), xcb_get_window_attributes(xcb_connection(), window), &error); + + if (!attributes_reply) { + if (error) { + connection()->handleXcbError(error); + free(error); + } + free(reply); + return QPixmap(); + } + + const xcb_visualtype_t *visual = screen->visualForId(attributes_reply->visual); + free(attributes_reply); + + xcb_pixmap_t pixmap = xcb_generate_id(xcb_connection()); + error = xcb_request_check(xcb_connection(), xcb_create_pixmap_checked(xcb_connection(), reply->depth, pixmap, window, width, height)); + if (error) { + connection()->handleXcbError(error); + free(error); + } + + uint32_t gc_value_mask = XCB_GC_SUBWINDOW_MODE; + uint32_t gc_value_list[] = { XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS }; + + xcb_gcontext_t gc = xcb_generate_id(xcb_connection()); + xcb_create_gc(xcb_connection(), gc, pixmap, gc_value_mask, gc_value_list); + + error = xcb_request_check(xcb_connection(), xcb_copy_area_checked(xcb_connection(), window, pixmap, gc, x, y, 0, 0, width, height)); + if (error) { + connection()->handleXcbError(error); + free(error); + } + + QPixmap result = qt_xcb_pixmapFromXPixmap(connection(), pixmap, width, height, reply->depth, visual); + + free(reply); + xcb_free_gc(xcb_connection(), gc); + xcb_free_pixmap(xcb_connection(), pixmap); + + return result; +} + +QString QXcbScreen::name() const +{ + return connection()->displayName() + QLatin1String(".") + QString::number(screenNumber()); +} diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index a78ee822f4b..07d855b398e 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -50,6 +50,7 @@ #include "qxcbobject.h" class QXcbConnection; +class QXcbCursor; class QXcbScreen : public QXcbObject, public QPlatformScreen { @@ -57,6 +58,10 @@ public: QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int number); ~QXcbScreen(); + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + QWindow *topLevelAt(const QPoint &point) const; + QRect geometry() const; int depth() const; QImage::Format format() const; @@ -67,14 +72,23 @@ public: xcb_screen_t *screen() const { return m_screen; } xcb_window_t root() const { return m_screen->root; } + xcb_window_t clientLeader() const { return m_clientLeader; } + QString windowManagerName() const { return m_windowManagerName; } bool syncRequestSupported() const { return m_syncRequestSupported; } + const xcb_visualtype_t *visualForId(xcb_visualid_t) const; + + QString name() const; + private: xcb_screen_t *m_screen; int m_number; QString m_windowManagerName; bool m_syncRequestSupported; + xcb_window_t m_clientLeader; + QMap<xcb_visualid_t, xcb_visualtype_t> m_visuals; + QXcbCursor *m_cursor; }; #endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 20e4187541e..db8d37e8170 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -42,9 +42,13 @@ #include "qxcbwindow.h" #include <QtDebug> +#include <QScreen> #include "qxcbconnection.h" #include "qxcbscreen.h" +#include "qxcbdrag.h" +#include "qxcbwmsupport.h" + #ifdef XCB_USE_DRI2 #include "qdri2context.h" #endif @@ -61,9 +65,10 @@ #define xcb_set_wm_hints xcb_icccm_set_wm_hints #endif -#include <private/qapplication_p.h> -#include <private/qwindowsurface_p.h> +#include <private/qguiapplication_p.h> +#include <private/qwindow_p.h> +#include <QtGui/QPlatformBackingStore> #include <QtGui/QWindowSystemInterface> #include <stdio.h> @@ -75,38 +80,71 @@ #if defined(XCB_USE_GLX) #include "qglxintegration.h" -#include "qglxconvenience.h" +#include <QtPlatformSupport/private/qglxconvenience_p.h> #elif defined(XCB_USE_EGL) -#include "../eglconvenience/qeglplatformcontext.h" -#include "../eglconvenience/qeglconvenience.h" -#include "../eglconvenience/qxlibeglintegration.h" +#include "qxcbeglsurface.h" +#include <QtPlatformSupport/private/qeglconvenience_p.h> +#include <QtPlatformSupport/private/qxlibeglintegration_p.h> #endif +#define XCOORD_MAX 16383 + +//#ifdef NET_WM_STATE_DEBUG + // Returns true if we should set WM_TRANSIENT_FOR on \a w -static inline bool isTransient(const QWidget *w) +static inline bool isTransient(const QWindow *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)); + 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; } -QXcbWindow::QXcbWindow(QWidget *tlw) - : QPlatformWindow(tlw) - , m_context(0) +QXcbWindow::QXcbWindow(QWindow *window) + : QPlatformWindow(window) + , m_window(0) + , m_syncCounter(0) + , m_mapped(false) + , m_netWmUserTimeWindow(XCB_NONE) +#if defined(XCB_USE_EGL) + , m_eglSurface(0) +#endif { - m_screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(tlw)); + m_screen = static_cast<QXcbScreen *>(window->screen()->handle()); setConnection(m_screen->connection()); - const quint32 mask = XCB_CW_BACK_PIXMAP | XCB_CW_EVENT_MASK; + create(); +} + +void QXcbWindow::create() +{ + destroy(); + + m_windowState = Qt::WindowNoState; + m_dirtyFrameMargins = true; + + Qt::WindowType type = window()->windowType(); + + if (type == Qt::Desktop) { + m_window = m_screen->root(); + m_depth = m_screen->screen()->root_depth; + m_imageFormat = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; + connection()->addWindow(m_window, this); + return; + } + + const quint32 mask = XCB_CW_BACK_PIXMAP | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK; const quint32 values[] = { // XCB_CW_BACK_PIXMAP XCB_NONE, + // XCB_CW_OVERRIDE_REDIRECT + type == Qt::Popup || type == Qt::ToolTip, + // XCB_CW_SAVE_UNDER + type == Qt::Popup || type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip || type == Qt::Drawer, // XCB_CW_EVENT_MASK XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY @@ -117,20 +155,33 @@ QXcbWindow::QXcbWindow(QWidget *tlw) | XCB_EVENT_MASK_BUTTON_MOTION | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW + | XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_FOCUS_CHANGE }; -#if defined(XCB_USE_GLX) || defined(XCB_USE_EGL) - if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) - || tlw->platformWindowFormat().alpha()) + QRect rect = window()->geometry(); + QPlatformWindow::setGeometry(rect); + + rect.setWidth(qBound(1, rect.width(), XCOORD_MAX)); + rect.setHeight(qBound(1, rect.height(), XCOORD_MAX)); + + xcb_window_t xcb_parent_id = m_screen->root(); + if (parent()) + xcb_parent_id = static_cast<QXcbWindow *>(parent())->xcb_window(); + + m_requestedFormat = window()->format(); + +#if (defined(XCB_USE_GLX) || defined(XCB_USE_EGL)) && defined(XCB_USE_XLIB) + if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) + || window()->format().hasAlpha()) { #if defined(XCB_USE_GLX) - XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), tlw->platformWindowFormat()); + XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), window()->format()); + #elif defined(XCB_USE_EGL) EGLDisplay eglDisplay = connection()->egl_display(); - EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,tlw->platformWindowFormat(),true); + EGLConfig eglConfig = q_configFromGLFormat(eglDisplay, window()->format(), true); VisualID id = QXlibEglIntegration::getCompatibleVisualId(DISPLAY_FROM_XCB(this), eglDisplay, eglConfig); XVisualInfo visualInfoTemplate; @@ -143,18 +194,16 @@ QXcbWindow::QXcbWindow(QWidget *tlw) #endif //XCB_USE_GLX if (visualInfo) { m_depth = visualInfo->depth; - m_format = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; - Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), m_screen->root(), visualInfo->visual, AllocNone); + m_imageFormat = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; + Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), xcb_parent_id, visualInfo->visual, AllocNone); XSetWindowAttributes a; a.background_pixel = WhitePixel(DISPLAY_FROM_XCB(this), m_screen->screenNumber()); a.border_pixel = BlackPixel(DISPLAY_FROM_XCB(this), m_screen->screenNumber()); a.colormap = cmap; - m_window = XCreateWindow(DISPLAY_FROM_XCB(this), m_screen->root(), tlw->x(), tlw->y(), tlw->width(), tlw->height(), + m_window = XCreateWindow(DISPLAY_FROM_XCB(this), xcb_parent_id, rect.x(), rect.y(), rect.width(), rect.height(), 0, visualInfo->depth, InputOutput, visualInfo->visual, CWBackPixel|CWBorderPixel|CWColormap, &a); - - printf("created GL window: %d\n", m_window); } else { qFatal("no window!"); } @@ -163,25 +212,25 @@ QXcbWindow::QXcbWindow(QWidget *tlw) { m_window = xcb_generate_id(xcb_connection()); m_depth = m_screen->screen()->root_depth; - m_format = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; + m_imageFormat = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; Q_XCB_CALL(xcb_create_window(xcb_connection(), XCB_COPY_FROM_PARENT, // depth -- same as root m_window, // window id - m_screen->root(), // parent window id - tlw->x(), - tlw->y(), - tlw->width(), - tlw->height(), + xcb_parent_id, // parent window id + rect.x(), + rect.y(), + rect.width(), + rect.height(), 0, // border width XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class m_screen->screen()->root_visual, // visual 0, // value mask 0)); // value list - - printf("created regular window: %d\n", m_window); } + connection()->addWindow(m_window, this); + Q_XCB_CALL(xcb_change_window_attributes(xcb_connection(), m_window, mask, values)); xcb_atom_t properties[4]; @@ -193,7 +242,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw) if (m_screen->syncRequestSupported()) properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST); - if (tlw->windowFlags() & Qt::WindowContextHelpButtonHint) + if (window()->windowFlags() & Qt::WindowContextHelpButtonHint) properties[propertyCount++] = atom(QXcbAtom::_NET_WM_CONTEXT_HELP); Q_XCB_CALL(xcb_change_property(xcb_connection(), @@ -221,29 +270,49 @@ QXcbWindow::QXcbWindow(QWidget *tlw) &m_syncCounter)); } - if (isTransient(tlw) && tlw->parentWidget()) { - // ICCCM 4.1.2.6 - QWidget *p = tlw->parentWidget()->window(); - xcb_window_t parentWindow = p->winId(); - Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, - XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, - 1, &parentWindow)); - - } - // set the PID to let the WM kill the application if unresponsive long pid = getpid(); Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, atom(QXcbAtom::_NET_WM_PID), XCB_ATOM_CARDINAL, 32, 1, &pid)); + + xcb_wm_hints_t hints; + memset(&hints, 0, sizeof(hints)); + xcb_wm_hints_set_normal(&hints); + + xcb_set_wm_hints(xcb_connection(), m_window, &hints); + + xcb_window_t leader = m_screen->clientLeader(); + Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, + atom(QXcbAtom::WM_CLIENT_LEADER), XCB_ATOM_WINDOW, 32, + 1, &leader)); + + setWindowFlags(window()->windowFlags()); + setWindowTitle(window()->windowTitle()); + setWindowState(window()->windowState()); + + connection()->drag()->dndEnable(this, true); } QXcbWindow::~QXcbWindow() { - delete m_context; - if (m_screen->syncRequestSupported()) + destroy(); +} + +void QXcbWindow::destroy() +{ + if (m_syncCounter && m_screen->syncRequestSupported()) Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter)); - Q_XCB_CALL(xcb_destroy_window(xcb_connection(), m_window)); + if (m_window) { + connection()->removeWindow(m_window); + Q_XCB_CALL(xcb_destroy_window(xcb_connection(), m_window)); + } + m_mapped = false; + +#if defined(XCB_USE_EGL) + delete m_eglSurface; + m_eglSurface = 0; +#endif } void QXcbWindow::setGeometry(const QRect &rect) @@ -251,40 +320,182 @@ void QXcbWindow::setGeometry(const QRect &rect) QPlatformWindow::setGeometry(rect); const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; - const quint32 values[] = { rect.x(), rect.y(), rect.width(), rect.height() }; + const quint32 values[] = { rect.x(), + rect.y(), + qBound(1, rect.width(), XCOORD_MAX), + qBound(1, rect.height(), XCOORD_MAX) }; Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, values)); } +QMargins QXcbWindow::frameMargins() const +{ + if (m_dirtyFrameMargins) { + xcb_window_t window = m_window; + xcb_window_t parent = m_window; + + bool foundRoot = false; + + const QVector<xcb_window_t> &virtualRoots = + connection()->wmSupport()->virtualRoots(); + + while (!foundRoot) { + xcb_query_tree_cookie_t cookie = xcb_query_tree(xcb_connection(), parent); + + xcb_generic_error_t *error; + xcb_query_tree_reply_t *reply = xcb_query_tree_reply(xcb_connection(), cookie, &error); + if (reply) { + if (reply->root == reply->parent || virtualRoots.indexOf(reply->parent) != -1) { + foundRoot = true; + } else { + window = parent; + parent = reply->parent; + } + + free(reply); + } else { + if (error) { + connection()->handleXcbError(error); + free(error); + } + + m_dirtyFrameMargins = false; + m_frameMargins = QMargins(); + return m_frameMargins; + } + } + + QPoint offset; + + xcb_generic_error_t *error; + xcb_translate_coordinates_reply_t *reply = + xcb_translate_coordinates_reply( + xcb_connection(), + xcb_translate_coordinates(xcb_connection(), window, parent, 0, 0), + &error); + + if (reply) { + offset = QPoint(reply->dst_x, reply->dst_y); + free(reply); + } else if (error) { + free(error); + } + + xcb_get_geometry_reply_t *geom = + xcb_get_geometry_reply( + xcb_connection(), + xcb_get_geometry(xcb_connection(), parent), + &error); + + if (geom) { + // -- + // add the border_width for the window managers frame... some window managers + // do not use a border_width of zero for their frames, and if we the left and + // top strut, we ensure that pos() is absolutely correct. frameGeometry() + // will still be incorrect though... perhaps i should have foffset as well, to + // indicate the frame offset (equal to the border_width on X). + // - Brad + // -- copied from qwidget_x11.cpp + + int left = offset.x() + geom->border_width; + int top = offset.y() + geom->border_width; + int right = geom->width + geom->border_width - geometry().width() - offset.x(); + int bottom = geom->height + geom->border_width - geometry().height() - offset.y(); + + m_frameMargins = QMargins(left, top, right, bottom); + + free(geom); + } else if (error) { + free(error); + } + + m_dirtyFrameMargins = false; + } + + return m_frameMargins; +} + void QXcbWindow::setVisible(bool visible) { - xcb_wm_hints_t hints; - if (visible) { - if (widget()->isMinimized()) + if (visible) + show(); + else + hide(); +} + +void QXcbWindow::show() +{ + if (window()->isTopLevel()) { + xcb_get_property_cookie_t cookie = xcb_get_wm_hints(xcb_connection(), m_window); + + xcb_generic_error_t *error; + + xcb_wm_hints_t hints; + xcb_get_wm_hints_reply(xcb_connection(), cookie, &hints, &error); + + if (error) { + connection()->handleXcbError(error); + free(error); + } + + m_dirtyFrameMargins = true; + + if (window()->windowState() & Qt::WindowMinimized) xcb_wm_hints_set_iconic(&hints); else xcb_wm_hints_set_normal(&hints); + xcb_set_wm_hints(xcb_connection(), m_window, &hints); - Q_XCB_CALL(xcb_map_window(xcb_connection(), m_window)); - connection()->sync(); - } else { - Q_XCB_CALL(xcb_unmap_window(xcb_connection(), m_window)); - // send synthetic UnmapNotify event according to icccm 4.1.4 - xcb_unmap_notify_event_t event; - event.response_type = XCB_UNMAP_NOTIFY; - event.sequence = 0; // does this matter? - event.event = m_screen->root(); - event.window = m_window; - event.from_configure = false; - Q_XCB_CALL(xcb_send_event(xcb_connection(), false, m_screen->root(), - XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event)); + // update WM_NORMAL_HINTS + propagateSizeHints(); - xcb_flush(xcb_connection()); + // update WM_TRANSIENT_FOR + if (window()->transientParent() && isTransient(window())) { + QXcbWindow *transientXcbParent = static_cast<QXcbWindow *>(window()->transientParent()->handle()); + if (transientXcbParent) { + // ICCCM 4.1.2.6 + xcb_window_t parentWindow = transientXcbParent->xcb_window(); + + // todo: set transient for group (wm_client_leader) if no parent, a la qwidget_x11.cpp + Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, + XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, + 1, &parentWindow)); + } + } + + // update _MOTIF_WM_HINTS + updateMotifWmHintsBeforeMap(); + + // update _NET_WM_STATE + updateNetWmStateBeforeMap(); } + + Q_XCB_CALL(xcb_map_window(xcb_connection(), m_window)); + xcb_flush(xcb_connection()); + + connection()->sync(); } -struct QtMWMHints { +void QXcbWindow::hide() +{ + Q_XCB_CALL(xcb_unmap_window(xcb_connection(), m_window)); + + // send synthetic UnmapNotify event according to icccm 4.1.4 + xcb_unmap_notify_event_t event; + event.response_type = XCB_UNMAP_NOTIFY; + event.event = m_screen->root(); + event.window = m_window; + event.from_configure = false; + Q_XCB_CALL(xcb_send_event(xcb_connection(), false, m_screen->root(), + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event)); + + xcb_flush(xcb_connection()); + + m_mapped = false; +} + +struct QtMotifWmHints { quint32 flags, functions, decorations; qint32 input_mode; quint32 status; @@ -317,33 +528,142 @@ enum { MWM_INPUT_FULL_APPLICATION_MODAL = 3L }; +static QtMotifWmHints getMotifWmHints(QXcbConnection *c, xcb_window_t window) +{ + QtMotifWmHints hints; + + xcb_get_property_cookie_t get_cookie = + xcb_get_property(c->xcb_connection(), 0, window, c->atom(QXcbAtom::_MOTIF_WM_HINTS), + c->atom(QXcbAtom::_MOTIF_WM_HINTS), 0, 20); + + xcb_generic_error_t *error; + + xcb_get_property_reply_t *reply = + xcb_get_property_reply(c->xcb_connection(), get_cookie, &error); + + if (reply && reply->format == 32 && reply->type == c->atom(QXcbAtom::_MOTIF_WM_HINTS)) { + hints = *((QtMotifWmHints *)xcb_get_property_value(reply)); + } else if (error) { + c->handleXcbError(error); + free(error); + + hints.flags = 0L; + hints.functions = MWM_FUNC_ALL; + hints.decorations = MWM_DECOR_ALL; + hints.input_mode = 0L; + hints.status = 0L; + } + + free(reply); + + return hints; +} + +static void setMotifWmHints(QXcbConnection *c, xcb_window_t window, const QtMotifWmHints &hints) +{ + if (hints.flags != 0l) { + Q_XCB_CALL2(xcb_change_property(c->xcb_connection(), + XCB_PROP_MODE_REPLACE, + window, + c->atom(QXcbAtom::_MOTIF_WM_HINTS), + c->atom(QXcbAtom::_MOTIF_WM_HINTS), + 32, + 5, + &hints), c); + } else { + Q_XCB_CALL2(xcb_delete_property(c->xcb_connection(), window, c->atom(QXcbAtom::_MOTIF_WM_HINTS)), c); + } +} + +void QXcbWindow::printNetWmState(const QVector<xcb_atom_t> &state) +{ + printf("_NET_WM_STATE (%d): ", state.size()); + for (int i = 0; i < state.size(); ++i) { +#define CHECK_WM_STATE(state_atom) \ + if (state.at(i) == atom(QXcbAtom::state_atom))\ + printf(#state_atom " "); + CHECK_WM_STATE(_NET_WM_STATE_ABOVE) + CHECK_WM_STATE(_NET_WM_STATE_BELOW) + CHECK_WM_STATE(_NET_WM_STATE_FULLSCREEN) + CHECK_WM_STATE(_NET_WM_STATE_MAXIMIZED_HORZ) + CHECK_WM_STATE(_NET_WM_STATE_MAXIMIZED_VERT) + CHECK_WM_STATE(_NET_WM_STATE_MODAL) + CHECK_WM_STATE(_NET_WM_STATE_STAYS_ON_TOP) + CHECK_WM_STATE(_NET_WM_STATE_DEMANDS_ATTENTION) +#undef CHECK_WM_STATE + } + printf("\n"); +} + +QVector<xcb_atom_t> QXcbWindow::getNetWmState() +{ + QVector<xcb_atom_t> result; + + xcb_get_property_cookie_t get_cookie = + xcb_get_property(xcb_connection(), 0, m_window, atom(QXcbAtom::_NET_WM_STATE), + XCB_ATOM_ATOM, 0, 1024); + + xcb_generic_error_t *error; + + xcb_get_property_reply_t *reply = + xcb_get_property_reply(xcb_connection(), get_cookie, &error); + + if (reply && reply->format == 32 && reply->type == XCB_ATOM_ATOM) { + result.resize(reply->length); + + memcpy(result.data(), xcb_get_property_value(reply), reply->length * sizeof(xcb_atom_t)); + +#ifdef NET_WM_STATE_DEBUG + printf("getting net wm state (%x)\n", m_window); + printNetWmState(result); +#endif + + free(reply); + } else if (error) { + connection()->handleXcbError(error); + free(error); + } else { +#ifdef NET_WM_STATE_DEBUG + printf("getting net wm state (%x), empty\n", m_window); +#endif + } + + return result; +} + +void QXcbWindow::setNetWmState(const QVector<xcb_atom_t> &atoms) +{ + if (atoms.isEmpty()) { + Q_XCB_CALL(xcb_delete_property(xcb_connection(), m_window, atom(QXcbAtom::_NET_WM_STATE))); + } else { + Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, + atom(QXcbAtom::_NET_WM_STATE), XCB_ATOM_ATOM, 32, + atoms.count(), atoms.constData())); + } + xcb_flush(xcb_connection()); +} + + Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags) { Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); - setNetWmWindowTypes(flags); - 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); + setNetWmWindowFlags(flags); + setMotifWindowFlags(flags); - Q_UNUSED(topLevel); - Q_UNUSED(dialog); - Q_UNUSED(desktop); - Q_UNUSED(tool); + return flags; +} - bool tooltip = (type == Qt::ToolTip); +void QXcbWindow::setMotifWindowFlags(Qt::WindowFlags flags) +{ + Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); - QtMWMHints mwmhints; + QtMotifWmHints mwmhints; mwmhints.flags = 0L; mwmhints.functions = 0L; mwmhints.decorations = 0; @@ -403,30 +723,90 @@ Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags) mwmhints.decorations = 0; } - if (mwmhints.flags != 0l) { - Q_XCB_CALL(xcb_change_property(xcb_connection(), - XCB_PROP_MODE_REPLACE, - m_window, - atom(QXcbAtom::_MOTIF_WM_HINTS), - atom(QXcbAtom::_MOTIF_WM_HINTS), - 32, - 5, - &mwmhints)); - } else { - Q_XCB_CALL(xcb_delete_property(xcb_connection(), m_window, atom(QXcbAtom::_MOTIF_WM_HINTS))); - } - - if (popup || tooltip) { - const quint32 mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER; - const quint32 values[] = { true, true }; - - Q_XCB_CALL(xcb_change_window_attributes(xcb_connection(), m_window, mask, values)); - } - - return QPlatformWindow::setWindowFlags(flags); + setMotifWmHints(connection(), m_window, mwmhints); } -void QXcbWindow::setNetWmWindowTypes(Qt::WindowFlags flags) +void QXcbWindow::changeNetWmState(bool set, xcb_atom_t one, xcb_atom_t two) +{ + xcb_client_message_event_t event; + + event.response_type = XCB_CLIENT_MESSAGE; + event.format = 32; + event.window = m_window; + event.type = atom(QXcbAtom::_NET_WM_STATE); + event.data.data32[0] = set ? 1 : 0; + event.data.data32[1] = one; + event.data.data32[2] = two; + event.data.data32[3] = 0; + event.data.data32[4] = 0; + + Q_XCB_CALL(xcb_send_event(xcb_connection(), 0, m_screen->root(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event)); +} + +Qt::WindowState QXcbWindow::setWindowState(Qt::WindowState state) +{ + if (state == m_windowState) + return state; + + m_dirtyFrameMargins = true; + + // unset old state + switch (m_windowState) { + case Qt::WindowMinimized: + Q_XCB_CALL(xcb_map_window(xcb_connection(), m_window)); + break; + case Qt::WindowMaximized: + changeNetWmState(false, + atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ), + atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT)); + break; + case Qt::WindowFullScreen: + changeNetWmState(false, atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN)); + break; + default: + break; + } + + // set new state + switch (state) { + case Qt::WindowMinimized: + { + xcb_client_message_event_t event; + + event.response_type = XCB_CLIENT_MESSAGE; + event.format = 32; + event.window = m_window; + event.type = atom(QXcbAtom::WM_CHANGE_STATE); + event.data.data32[0] = XCB_WM_STATE_ICONIC; + event.data.data32[1] = 0; + event.data.data32[2] = 0; + event.data.data32[3] = 0; + event.data.data32[4] = 0; + + Q_XCB_CALL(xcb_send_event(xcb_connection(), 0, m_screen->root(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event)); + } + break; + case Qt::WindowMaximized: + changeNetWmState(true, + atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ), + atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT)); + break; + case Qt::WindowFullScreen: + changeNetWmState(true, atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN)); + break; + case Qt::WindowNoState: + break; + default: + break; + } + + connection()->sync(); + + m_windowState = state; + return m_windowState; +} + +void QXcbWindow::setNetWmWindowFlags(Qt::WindowFlags flags) { // in order of decreasing priority QVector<uint> windowTypes; @@ -462,6 +842,127 @@ void QXcbWindow::setNetWmWindowTypes(Qt::WindowFlags flags) windowTypes.count(), windowTypes.constData())); } +void QXcbWindow::updateMotifWmHintsBeforeMap() +{ + QtMotifWmHints mwmhints = getMotifWmHints(connection(), m_window); + + if (window()->windowModality() != Qt::NonModal) { + switch (window()->windowModality()) { + case Qt::WindowModal: + mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; + break; + case Qt::ApplicationModal: + default: + mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; + break; + } + mwmhints.flags |= MWM_HINTS_INPUT_MODE; + } else { + mwmhints.input_mode = MWM_INPUT_MODELESS; + mwmhints.flags &= ~MWM_HINTS_INPUT_MODE; + } + + if (window()->minimumSize() == window()->maximumSize()) { + // fixed size, remove the resize handle (since mwm/dtwm + // isn't smart enough to do it itself) + mwmhints.flags |= MWM_HINTS_FUNCTIONS; + if (mwmhints.functions == MWM_FUNC_ALL) { + mwmhints.functions = MWM_FUNC_MOVE; + } else { + mwmhints.functions &= ~MWM_FUNC_RESIZE; + } + + if (mwmhints.decorations == MWM_DECOR_ALL) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + mwmhints.decorations = (MWM_DECOR_BORDER + | MWM_DECOR_TITLE + | MWM_DECOR_MENU); + } else { + mwmhints.decorations &= ~MWM_DECOR_RESIZEH; + } + } + + if (window()->windowFlags() & Qt::WindowMinimizeButtonHint) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + mwmhints.decorations |= MWM_DECOR_MINIMIZE; + mwmhints.functions |= MWM_FUNC_MINIMIZE; + } + if (window()->windowFlags() & Qt::WindowMaximizeButtonHint) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + mwmhints.decorations |= MWM_DECOR_MAXIMIZE; + mwmhints.functions |= MWM_FUNC_MAXIMIZE; + } + if (window()->windowFlags() & Qt::WindowCloseButtonHint) + mwmhints.functions |= MWM_FUNC_CLOSE; + + setMotifWmHints(connection(), m_window, mwmhints); +} + +void QXcbWindow::updateNetWmStateBeforeMap() +{ + QVector<xcb_atom_t> netWmState; + + Qt::WindowFlags flags = window()->windowFlags(); + if (flags & Qt::WindowStaysOnTopHint) { + netWmState.append(atom(QXcbAtom::_NET_WM_STATE_ABOVE)); + netWmState.append(atom(QXcbAtom::_NET_WM_STATE_STAYS_ON_TOP)); + } else if (flags & Qt::WindowStaysOnBottomHint) { + netWmState.append(atom(QXcbAtom::_NET_WM_STATE_BELOW)); + } + + if (window()->windowState() & Qt::WindowFullScreen) { + netWmState.append(atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN)); + } + + if (window()->windowState() & Qt::WindowMaximized) { + netWmState.append(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ)); + netWmState.append(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT)); + } + + if (window()->windowModality() != Qt::NonModal) { + netWmState.append(atom(QXcbAtom::_NET_WM_STATE_MODAL)); + } + + setNetWmState(netWmState); +} + +void QXcbWindow::updateNetWmUserTime(xcb_timestamp_t timestamp) +{ + xcb_window_t wid = m_window; + + const bool isSupportedByWM = connection()->wmSupport()->isSupportedByWM(atom(QXcbAtom::_NET_WM_USER_TIME_WINDOW)); + if (m_netWmUserTimeWindow || isSupportedByWM) { + if (!m_netWmUserTimeWindow) { + m_netWmUserTimeWindow = xcb_generate_id(xcb_connection()); + Q_XCB_CALL(xcb_create_window(xcb_connection(), + XCB_COPY_FROM_PARENT, // depth -- same as root + m_netWmUserTimeWindow, // window id + m_window, // parent window id + -1, -1, 1, 1, + 0, // border width + XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class + m_screen->screen()->root_visual, // visual + 0, // value mask + 0)); // value list + wid = m_netWmUserTimeWindow; + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, atom(QXcbAtom::_NET_WM_USER_TIME_WINDOW), + XCB_ATOM_WINDOW, 32, 1, &m_netWmUserTimeWindow); + xcb_delete_property(xcb_connection(), m_window, atom(QXcbAtom::_NET_WM_USER_TIME)); + } else if (!isSupportedByWM) { + // WM no longer supports it, then we should remove the + // _NET_WM_USER_TIME_WINDOW atom. + xcb_delete_property(xcb_connection(), m_window, atom(QXcbAtom::_NET_WM_USER_TIME_WINDOW)); + xcb_destroy_window(xcb_connection(), m_netWmUserTimeWindow); + m_netWmUserTimeWindow = XCB_NONE; + } else { + wid = m_netWmUserTimeWindow; + } + } + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, wid, atom(QXcbAtom::_NET_WM_USER_TIME), + XCB_ATOM_CARDINAL, 32, 1, ×tamp); +} + + WId QXcbWindow::winId() const { return m_window; @@ -469,8 +970,13 @@ WId QXcbWindow::winId() const void QXcbWindow::setParent(const QPlatformWindow *parent) { + // re-create for compatibility + create(); + QPoint topLeft = geometry().topLeft(); - Q_XCB_CALL(xcb_reparent_window(xcb_connection(), window(), static_cast<const QXcbWindow *>(parent)->window(), topLeft.x(), topLeft.y())); + + xcb_window_t xcb_parent_id = parent ? static_cast<const QXcbWindow *>(parent)->xcb_window() : m_screen->root(); + Q_XCB_CALL(xcb_reparent_window(xcb_connection(), xcb_window(), xcb_parent_id, topLeft.x(), topLeft.y())); } void QXcbWindow::setWindowTitle(const QString &title) @@ -500,56 +1006,87 @@ void QXcbWindow::lower() Q_XCB_CALL(xcb_configure_window(xcb_connection(), m_window, mask, values)); } +void QXcbWindow::propagateSizeHints() +{ + // update WM_NORMAL_HINTS + xcb_size_hints_t hints; + memset(&hints, 0, sizeof(hints)); + + QRect rect = geometry(); + + xcb_size_hints_set_position(&hints, true, rect.x(), rect.y()); + xcb_size_hints_set_size(&hints, true, rect.width(), rect.height()); + xcb_size_hints_set_win_gravity(&hints, XCB_GRAVITY_STATIC); + + QWindow *win = window(); + + QSize minimumSize = win->minimumSize(); + QSize maximumSize = win->maximumSize(); + QSize baseSize = win->baseSize(); + QSize sizeIncrement = win->sizeIncrement(); + + if (minimumSize.width() > 0 || minimumSize.height() > 0) + xcb_size_hints_set_min_size(&hints, minimumSize.width(), minimumSize.height()); + + if (maximumSize.width() < QWINDOWSIZE_MAX || maximumSize.height() < QWINDOWSIZE_MAX) + xcb_size_hints_set_max_size(&hints, + qMin(XCOORD_MAX, maximumSize.width()), + qMin(XCOORD_MAX, maximumSize.height())); + + if (sizeIncrement.width() > 0 || sizeIncrement.height() > 0) { + xcb_size_hints_set_base_size(&hints, baseSize.width(), baseSize.height()); + xcb_size_hints_set_resize_inc(&hints, sizeIncrement.width(), sizeIncrement.height()); + } + + xcb_set_wm_normal_hints(xcb_connection(), m_window, &hints); +} + void QXcbWindow::requestActivateWindow() { - Q_XCB_CALL(xcb_set_input_focus(xcb_connection(), XCB_INPUT_FOCUS_PARENT, m_window, XCB_TIME_CURRENT_TIME)); + if (m_mapped){ + updateNetWmUserTime(connection()->time()); + Q_XCB_CALL(xcb_set_input_focus(xcb_connection(), XCB_INPUT_FOCUS_PARENT, m_window, connection()->time())); + } connection()->sync(); } -QPlatformGLContext *QXcbWindow::glContext() const +QSurfaceFormat QXcbWindow::format() const { - if (!QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) { - printf("no opengl\n"); - return 0; - } - if (!m_context) { -#if defined(XCB_USE_GLX) - QXcbWindow *that = const_cast<QXcbWindow *>(this); - that->m_context = new QGLXContext(m_window, m_screen, widget()->platformWindowFormat()); -#elif defined(XCB_USE_EGL) - EGLDisplay display = connection()->egl_display(); - EGLConfig config = q_configFromQPlatformWindowFormat(display,widget()->platformWindowFormat(),true); - QVector<EGLint> eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - eglContextAttrs.append(2); - eglContextAttrs.append(EGL_NONE); - - EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)m_window,0); - QXcbWindow *that = const_cast<QXcbWindow *>(this); - that->m_context = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); -#elif defined(XCB_USE_DRI2) - QXcbWindow *that = const_cast<QXcbWindow *>(this); - that->m_context = new QDri2Context(that); -#endif - } - return m_context; + // ### return actual format + return m_requestedFormat; } +#if defined(XCB_USE_EGL) +QXcbEGLSurface *QXcbWindow::eglSurface() const +{ + if (!m_eglSurface) { + EGLDisplay display = connection()->egl_display(); + EGLConfig config = q_configFromGLFormat(display, window()->format(), true); + EGLSurface surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType)m_window, 0); + + m_eglSurface = new QXcbEGLSurface(display, surface); + } + + return m_eglSurface; +} +#endif + void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) { - QWindowSurface *surface = widget()->windowSurface(); - if (surface) { - QRect rect(event->x, event->y, event->width, event->height); - - surface->flush(widget(), rect, QPoint()); - } + QRect rect(event->x, event->y, event->width, event->height); + QWindowSystemInterface::handleSynchronousExposeEvent(window(), rect); } void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *event) { - if (event->format == 32 && event->type == atom(QXcbAtom::WM_PROTOCOLS)) { + if (event->format != 32) + return; + + if (event->type == atom(QXcbAtom::WM_PROTOCOLS)) { if (event->data.data32[0] == atom(QXcbAtom::WM_DELETE_WINDOW)) { - QWindowSystemInterface::handleCloseEvent(widget()); + QWindowSystemInterface::handleCloseEvent(window()); + } else if (event->data.data32[0] == atom(QXcbAtom::WM_TAKE_FOCUS)) { + connection()->setTime(event->data.data32[1]); } else if (event->data.data32[0] == atom(QXcbAtom::_NET_WM_PING)) { xcb_client_message_event_t reply = *event; @@ -559,13 +1096,22 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even xcb_send_event(xcb_connection(), 0, m_screen->root(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&reply); xcb_flush(xcb_connection()); } else if (event->data.data32[0] == atom(QXcbAtom::_NET_WM_SYNC_REQUEST)) { - if (!m_hasReceivedSyncRequest) { - m_hasReceivedSyncRequest = true; - printf("Window manager supports _NET_WM_SYNC_REQUEST, syncing resizes\n"); - } + connection()->setTime(event->data.data32[1]); m_syncValue.lo = event->data.data32[2]; m_syncValue.hi = event->data.data32[3]; + } else { + qWarning() << "unhandled WM_PROTOCOLS message:" << connection()->atomName(event->data.data32[0]); } + } else if (event->type == atom(QXcbAtom::XdndEnter)) { + connection()->drag()->handleEnter(window(), event); + } else if (event->type == atom(QXcbAtom::XdndPosition)) { + connection()->drag()->handlePosition(window(), event, false); + } else if (event->type == atom(QXcbAtom::XdndLeave)) { + connection()->drag()->handleLeave(window(), event, false); + } else if (event->type == atom(QXcbAtom::XdndDrop)) { + connection()->drag()->handleDrop(window(), event, false); + } else { + qWarning() << "unhandled client message:" << connection()->atomName(event->type); } } @@ -581,11 +1127,8 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * QRect rect(xpos, ypos, event->width, event->height); - if (rect == geometry()) - return; - QPlatformWindow::setGeometry(rect); - QWindowSystemInterface::handleGeometryChange(widget(), rect); + QWindowSystemInterface::handleGeometryChange(window(), rect); #if XCB_USE_DRI2 if (m_context) @@ -593,6 +1136,22 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * #endif } +void QXcbWindow::handleMapNotifyEvent(const xcb_map_notify_event_t *event) +{ + if (event->window == m_window) { + m_mapped = true; + QWindowSystemInterface::handleMapEvent(window()); + } +} + +void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event) +{ + if (event->window == m_window) { + m_mapped = false; + QWindowSystemInterface::handleUnmapEvent(window()); + } +} + static Qt::MouseButtons translateMouseButtons(int s) { Qt::MouseButtons ret = 0; @@ -621,6 +1180,8 @@ static Qt::MouseButton translateMouseButton(xcb_button_t s) void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) { + updateNetWmUserTime(event->time); + QPoint local(event->event_x, event->event_y); QPoint global(event->root_x, event->root_y); @@ -633,7 +1194,7 @@ void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) && (modifiers & Qt::AltModifier)) || (event->detail == 6 || event->detail == 7)); - QWindowSystemInterface::handleWheelEvent(widget(), event->time, + QWindowSystemInterface::handleWheelEvent(window(), event->time, local, global, delta, hor ? Qt::Horizontal : Qt::Vertical); return; } @@ -659,32 +1220,65 @@ void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) void QXcbWindow::handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global) { + connection()->setTime(time); + Qt::MouseButtons buttons = translateMouseButtons(state); Qt::MouseButton button = translateMouseButton(detail); buttons ^= button; // X event uses state *before*, Qt uses state *after* - QWindowSystemInterface::handleMouseEvent(widget(), time, local, global, buttons); + QWindowSystemInterface::handleMouseEvent(window(), time, local, global, buttons); } -void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *) +void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *event) { - QWindowSystemInterface::handleEnterEvent(widget()); + connection()->setTime(event->time); + + if ((event->mode != XCB_NOTIFY_MODE_NORMAL && event->mode != XCB_NOTIFY_MODE_UNGRAB) + || event->detail == XCB_NOTIFY_DETAIL_VIRTUAL + || event->detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL) + { + return; + } + + QWindowSystemInterface::handleEnterEvent(window()); } -void QXcbWindow::handleLeaveNotifyEvent(const xcb_leave_notify_event_t *) +void QXcbWindow::handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event) { - QWindowSystemInterface::handleLeaveEvent(widget()); + connection()->setTime(event->time); + + if ((event->mode != XCB_NOTIFY_MODE_NORMAL && event->mode != XCB_NOTIFY_MODE_UNGRAB) + || event->detail == XCB_NOTIFY_DETAIL_INFERIOR) + { + return; + } + + QWindowSystemInterface::handleLeaveEvent(window()); } void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *) { - QWindowSystemInterface::handleWindowActivated(widget()); + QWindowSystemInterface::handleWindowActivated(window()); +} + +static bool focusInPeeker(xcb_generic_event_t *event) +{ + if (!event) { + // FocusIn event is not in the queue, proceed with FocusOut normally. + QWindowSystemInterface::handleWindowActivated(0); + return true; + } + uint response_type = event->response_type & ~0x80; + return response_type == XCB_FOCUS_IN; } void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *) { - QWindowSystemInterface::handleWindowActivated(0); + // Do not set the active window to 0 if there is a FocusIn coming. + // There is however no equivalent for XPutBackEvent so register a + // callback for QXcbConnection instead. + connection()->addPeekFunc(focusInPeeker); } void QXcbWindow::updateSyncRequestCounter() @@ -698,3 +1292,47 @@ void QXcbWindow::updateSyncRequestCounter() m_syncValue.hi = 0; } } + +bool QXcbWindow::setKeyboardGrabEnabled(bool grab) +{ + if (!grab) { + xcb_ungrab_keyboard(xcb_connection(), XCB_TIME_CURRENT_TIME); + return true; + } + xcb_grab_keyboard_cookie_t cookie = xcb_grab_keyboard(xcb_connection(), false, + m_window, XCB_TIME_CURRENT_TIME, + XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); + xcb_generic_error_t *err; + xcb_grab_keyboard_reply_t *reply = xcb_grab_keyboard_reply(xcb_connection(), cookie, &err); + bool result = !(err || !reply || reply->status != XCB_GRAB_STATUS_SUCCESS); + free(reply); + free(err); + return result; +} + +bool QXcbWindow::setMouseGrabEnabled(bool grab) +{ + if (!grab) { + xcb_ungrab_pointer(xcb_connection(), XCB_TIME_CURRENT_TIME); + return true; + } + xcb_grab_pointer_cookie_t cookie = xcb_grab_pointer(xcb_connection(), false, m_window, + (XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE + | XCB_EVENT_MASK_BUTTON_MOTION | XCB_EVENT_MASK_ENTER_WINDOW + | XCB_EVENT_MASK_LEAVE_WINDOW | XCB_EVENT_MASK_POINTER_MOTION), + XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, + XCB_WINDOW_NONE, XCB_CURSOR_NONE, + XCB_TIME_CURRENT_TIME); + xcb_generic_error_t *err; + xcb_grab_pointer_reply_t *reply = xcb_grab_pointer_reply(xcb_connection(), cookie, &err); + bool result = !(err || !reply || reply->status != XCB_GRAB_STATUS_SUCCESS); + free(reply); + free(err); + return result; +} + +void QXcbWindow::setCursor(xcb_cursor_t cursor) +{ + xcb_change_window_attributes(xcb_connection(), m_window, XCB_CW_CURSOR, &cursor); + xcb_flush(xcb_connection()); +} diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 69d0bc2f1d8..a85760ea8dd 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -43,7 +43,7 @@ #define QXCBWINDOW_H #include <QtGui/QPlatformWindow> -#include <QtGui/QPlatformWindowFormat> +#include <QtGui/QSurfaceFormat> #include <QtGui/QImage> #include <xcb/xcb.h> @@ -52,35 +52,47 @@ #include "qxcbobject.h" class QXcbScreen; +class QXcbEGLSurface; class QXcbWindow : public QXcbObject, public QPlatformWindow { public: - QXcbWindow(QWidget *tlw); + QXcbWindow(QWindow *window); ~QXcbWindow(); void setGeometry(const QRect &rect); + QMargins frameMargins() const; + void setVisible(bool visible); Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + Qt::WindowState setWindowState(Qt::WindowState state); WId winId() const; void setParent(const QPlatformWindow *window); void setWindowTitle(const QString &title); void raise(); void lower(); + void propagateSizeHints(); void requestActivateWindow(); - QPlatformGLContext *glContext() const; + bool setKeyboardGrabEnabled(bool grab); + bool setMouseGrabEnabled(bool grab); - xcb_window_t window() const { return m_window; } + void setCursor(xcb_cursor_t cursor); + + QSurfaceFormat format() const; + + xcb_window_t xcb_window() const { return m_window; } uint depth() const { return m_depth; } - QImage::Format format() const { return m_format; } + QImage::Format imageFormat() const { return m_imageFormat; } void handleExposeEvent(const xcb_expose_event_t *event); void handleClientMessageEvent(const xcb_client_message_event_t *event); void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event); + void handleMapNotifyEvent(const xcb_map_notify_event_t *event); + void handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event); void handleButtonPressEvent(const xcb_button_press_event_t *event); void handleButtonReleaseEvent(const xcb_button_release_event_t *event); void handleMotionNotifyEvent(const xcb_motion_notify_event_t *event); @@ -93,22 +105,54 @@ public: void handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global); void updateSyncRequestCounter(); + void updateNetWmUserTime(xcb_timestamp_t timestamp); + void netWmUserTime() const; + +#if defined(XCB_USE_EGL) + QXcbEGLSurface *eglSurface() const; +#endif private: - void setNetWmWindowTypes(Qt::WindowFlags flags); + void changeNetWmState(bool set, xcb_atom_t one, xcb_atom_t two = 0); + QVector<xcb_atom_t> getNetWmState(); + void setNetWmState(const QVector<xcb_atom_t> &atoms); + void printNetWmState(const QVector<xcb_atom_t> &state); + + void setNetWmWindowFlags(Qt::WindowFlags flags); + void setMotifWindowFlags(Qt::WindowFlags flags); + + void updateMotifWmHintsBeforeMap(); + void updateNetWmStateBeforeMap(); + + void create(); + void destroy(); + + void show(); + void hide(); QXcbScreen *m_screen; xcb_window_t m_window; - QPlatformGLContext *m_context; uint m_depth; - QImage::Format m_format; + QImage::Format m_imageFormat; xcb_sync_int64_t m_syncValue; xcb_sync_counter_t m_syncCounter; - bool m_hasReceivedSyncRequest; + Qt::WindowState m_windowState; + + bool m_mapped; + xcb_window_t m_netWmUserTimeWindow; + + QSurfaceFormat m_requestedFormat; + + mutable bool m_dirtyFrameMargins; + mutable QMargins m_frameMargins; + +#if defined(XCB_USE_EGL) + mutable QXcbEGLSurface *m_eglSurface; +#endif }; #endif diff --git a/src/plugins/platforms/xcb/qxcbwmsupport.cpp b/src/plugins/platforms/xcb/qxcbwmsupport.cpp new file mode 100644 index 00000000000..5fb67b63776 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbwmsupport.cpp @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbwmsupport.h" +#include "qxcbscreen.h" + +#include <qdebug.h> + +QXcbWMSupport::QXcbWMSupport(QXcbConnection *c) + : QXcbObject(c) +{ + updateNetWMAtoms(); + updateVirtualRoots(); +} + +bool QXcbWMSupport::isSupportedByWM(xcb_atom_t atom) const +{ + return net_wm_atoms.contains(atom); +} + + + +void QXcbWMSupport::updateNetWMAtoms() +{ + net_wm_atoms.clear(); + + xcb_window_t root = connection()->screens().at(connection()->primaryScreen())->root(); + int offset = 0; + int remaining = 0; + do { + xcb_generic_error_t *error = 0; + xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, root, atom(QXcbAtom::_NET_SUPPORTED), XCB_ATOM_ATOM, offset, 1024); + xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, &error); + if (!reply || error) + break; + + remaining = 0; + + if (reply->type == XCB_ATOM_ATOM && reply->format == 32) { + int len = xcb_get_property_value_length(reply)/4; + xcb_atom_t *atoms = (xcb_atom_t *)xcb_get_property_value(reply); + int s = net_wm_atoms.size(); + net_wm_atoms.resize(s + len); + memcpy(net_wm_atoms.data() + s, atoms, len*sizeof(xcb_atom_t)); + + remaining = reply->bytes_after; + offset += len; + } + + free(reply); + } while (remaining > 0); + +// qDebug() << "======== updateNetWMAtoms"; +// for (int i = 0; i < net_wm_atoms.size(); ++i) +// qDebug() << atomName(net_wm_atoms.at(i)); +// qDebug() << "======== updateNetWMAtoms"; +} + +// update the virtual roots array +void QXcbWMSupport::updateVirtualRoots() +{ + net_virtual_roots.clear(); + + if (!isSupportedByWM(atom(QXcbAtom::_NET_VIRTUAL_ROOTS))) + return; + + xcb_window_t root = connection()->screens().at(connection()->primaryScreen())->root(); + int offset = 0; + int remaining = 0; + do { + xcb_generic_error_t *error = 0; + xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, root, atom(QXcbAtom::_NET_VIRTUAL_ROOTS), XCB_ATOM_ATOM, offset, 1024); + xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, &error); + if (!reply || error) + break; + + remaining = 0; + + if (reply->type == XCB_ATOM_ATOM && reply->format == 32) { + int len = xcb_get_property_value_length(reply)/4; + xcb_atom_t *atoms = (xcb_atom_t *)xcb_get_property_value(reply); + int s = net_wm_atoms.size(); + net_wm_atoms.resize(s + len); + memcpy(net_wm_atoms.data() + s, atoms, len*sizeof(xcb_atom_t)); + + remaining = reply->bytes_after; + offset += len; + } + + free(reply); + } while (remaining > 0); + + qDebug() << "======== updateVirtualRoots"; + for (int i = 0; i < net_virtual_roots.size(); ++i) + qDebug() << connection()->atomName(net_virtual_roots.at(i)); + qDebug() << "======== updateVirtualRoots"; +} + diff --git a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h b/src/plugins/platforms/xcb/qxcbwmsupport.h similarity index 77% rename from src/plugins/platforms/cocoa/qcocoaeventloopintegration.h rename to src/plugins/platforms/xcb/qxcbwmsupport.h index 5765483fc72..3b02ef3e7e2 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h +++ b/src/plugins/platforms/xcb/qxcbwmsupport.h @@ -38,28 +38,30 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#ifndef QXCBWMSUPPORT_H +#define QXCBWMSUPPORT_H -#ifndef QCOCAEVENTLOOPINTEGRATION_H -#define QCOCAEVENTLOOPINTEGRATION_H +#include "qxcbobject.h" +#include "qxcbconnection.h" +#include <qvector.h> -#include <Cocoa/Cocoa.h> - -#include <QPlatformEventLoopIntegration> - - -class QCocoaEventLoopIntegration : public QPlatformEventLoopIntegration +class QXcbWMSupport : public QXcbObject { public: - QCocoaEventLoopIntegration(); - void startEventLoop(); - void quitEventLoop(); - void qtNeedsToProcessEvents(); + QXcbWMSupport(QXcbConnection *c); + + + bool isSupportedByWM(xcb_atom_t atom) const; + const QVector<xcb_window_t> &virtualRoots() const { return net_virtual_roots; } private: - CFRunLoopSourceContext m_sourceContext; - CFRunLoopTimerContext m_timerContext; - CFRunLoopSourceRef m_source; + friend class QXcbConnection; + void updateNetWMAtoms(); + void updateVirtualRoots(); + + QVector<xcb_atom_t> net_wm_atoms; + QVector<xcb_window_t> net_virtual_roots; }; -#endif // QCOCAEVENTLOOPINTEGRATION_H +#endif diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 27d10b67561..143a671047b 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -3,70 +3,91 @@ TARGET = xcb load(qt_plugin) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms -QT += core-private gui-private +QT += core-private gui-private platformsupport-private SOURCES = \ + qxcbclipboard.cpp \ qxcbconnection.cpp \ qxcbintegration.cpp \ qxcbkeyboard.cpp \ + qxcbmime.cpp \ + qxcbdrag.cpp \ qxcbscreen.cpp \ qxcbwindow.cpp \ - qxcbwindowsurface.cpp \ + qxcbbackingstore.cpp \ + qxcbwmsupport.cpp \ main.cpp \ - qxcbnativeinterface.cpp + qxcbnativeinterface.cpp \ + qxcbcursor.cpp \ + qxcbimage.cpp HEADERS = \ + qxcbclipboard.h \ qxcbconnection.h \ qxcbintegration.h \ qxcbkeyboard.h \ + qxcbdrag.h \ + qxcbmime.h \ qxcbobject.h \ qxcbscreen.h \ qxcbwindow.h \ - qxcbwindowsurface.h \ - qxcbnativeinterface.h + qxcbbackingstore.h \ + qxcbwmsupport.h \ + qxcbnativeinterface.h \ + qxcbcursor.h \ + qxcbimage.h -contains(QT_CONFIG, opengl) { - QT += opengl +contains(QT_CONFIG, xcb-poll-for-queued-event) { + DEFINES += XCB_POLL_FOR_QUEUED_EVENT +} + +# needed by GLX, Xcursor, XLookupString, ... +contains(QT_CONFIG, xcb-xlib) { + DEFINES += XCB_USE_XLIB + LIBS += -lX11 -lX11-xcb +} + +# to support custom cursors with depth > 1 +contains(QT_CONFIG, xcb-render) { + DEFINES += XCB_USE_RENDER + LIBS += -lxcb-render -lxcb-render-util -lXrender +} # DEFINES += XCB_USE_DRI2 - contains(DEFINES, XCB_USE_DRI2) { - LIBS += -lxcb-dri2 -lxcb-xfixes -lEGL +contains(DEFINES, XCB_USE_DRI2) { + LIBS += -lxcb-dri2 -lEGL - CONFIG += link_pkgconfig - PKGCONFIG += libdrm + CONFIG += link_pkgconfig + PKGCONFIG += libdrm - HEADERS += qdri2context.h - SOURCES += qdri2context.cpp + HEADERS += qdri2context.h + SOURCES += qdri2context.cpp - } else { - DEFINES += XCB_USE_XLIB - LIBS += -lX11 -lX11-xcb - - contains(QT_CONFIG, opengles2) { - DEFINES += XCB_USE_EGL - HEADERS += \ - ../eglconvenience/qeglplatformcontext.h \ - ../eglconvenience/qeglconvenience.h \ - ../eglconvenience/qxlibeglintegration.h - - SOURCES += \ - ../eglconvenience/qeglplatformcontext.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - ../eglconvenience/qxlibeglintegration.cpp - - LIBS += -lEGL - } else { - DEFINES += XCB_USE_GLX - include (../glxconvenience/glxconvenience.pri) - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp - } +} else { + contains(QT_CONFIG, opengles2) { + DEFINES += XCB_USE_EGL + LIBS += -lEGL + HEADERS += qxcbeglsurface.h + } else:contains(QT_CONFIG, xcb-xlib) { + DEFINES += XCB_USE_GLX + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp } } -LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync +LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-sync -lxcb-xfixes -include (../fontdatabases/genericunix/genericunix.pri) +DEFINES += $$QMAKE_DEFINES_XCB +LIBS += $$QMAKE_LIBS_XCB +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB + +CONFIG += qpa/genericunixfontdatabase + +contains(QT_CONFIG, dbus) { +DEFINES += XCB_USE_IBUS +QT += dbus +LIBS += -ldbus-1 +} target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/xlib/main.cpp b/src/plugins/platforms/xlib/main.cpp index 63eba3288b7..b4241fa2282 100644 --- a/src/plugins/platforms/xlib/main.cpp +++ b/src/plugins/platforms/xlib/main.cpp @@ -54,10 +54,7 @@ public: QStringList QXlibIntegrationPlugin::keys() const { QStringList list; - list << "Xlib"; -#ifndef QT_NO_OPENGL - list << "XlibGL"; -#endif + list << "xlib"; return list; } @@ -66,10 +63,6 @@ QPlatformIntegration* QXlibIntegrationPlugin::create(const QString& system, cons Q_UNUSED(paramList); if (system.toLower() == "xlib") return new QXlibIntegration; -#ifndef QT_NO_OPENGL - if (system.toLower() == "xlibgl") - return new QXlibIntegration(true); -#endif return 0; } diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp index d827d606bb9..6733f220937 100644 --- a/src/plugins/platforms/xlib/qglxintegration.cpp +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -51,7 +51,7 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> #include <GL/glx.h> -#include "qglxconvenience.h" +#include "private/qglxconvenience_p.h" #include "qglxintegration.h" @@ -61,34 +61,24 @@ QT_BEGIN_NAMESPACE -QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWindowFormat &format) - : QPlatformGLContext() +QGLXContext::QGLXContext(QXlibScreen *screen, const QSurfaceFormat &format, QPlatformOpenGLContext *share) + : QPlatformOpenGLContext() , m_screen(screen) - , m_drawable((Drawable)window) , m_context(0) { - - const QPlatformGLContext *sharePlatformContext; - sharePlatformContext = format.sharedGLContext(); GLXContext shareGlxContext = 0; - if (sharePlatformContext) - shareGlxContext = static_cast<const QGLXContext*>(sharePlatformContext)->glxContext(); + if (share) + shareGlxContext = static_cast<const QGLXContext*>(share)->glxContext(); GLXFBConfig config = qglx_findConfig(screen->display()->nativeDisplay(),screen->xScreenNumber(),format); m_context = glXCreateNewContext(screen->display()->nativeDisplay(),config,GLX_RGBA_TYPE,shareGlxContext,TRUE); - m_windowFormat = qglx_platformWindowFromGLXFBConfig(screen->display()->nativeDisplay(),config,m_context); + m_windowFormat = qglx_surfaceFormatFromGLXFBConfig(screen->display()->nativeDisplay(),config,m_context); #ifdef MYX11_DEBUG qDebug() << "QGLXGLContext::create context" << m_context; #endif } -QGLXContext::QGLXContext(QXlibScreen *screen, Drawable drawable, GLXContext context) - : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) -{ - -} - QGLXContext::~QGLXContext() { if (m_context) { @@ -97,27 +87,36 @@ QGLXContext::~QGLXContext() } } -void QGLXContext::makeCurrent() +QSurfaceFormat QGLXContext::format() const { - QPlatformGLContext::makeCurrent(); + return m_windowFormat; +} + +bool QGLXContext::makeCurrent(QPlatformSurface *surface) +{ + Q_UNUSED(surface); + + GLXDrawable glxDrawable = static_cast<QXlibWindow *>(surface)->winId(); #ifdef MYX11_DEBUG - qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); + qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", glxDrawable, m_context); #endif - glXMakeCurrent(m_screen->display()->nativeDisplay(), m_drawable, m_context); + return glXMakeCurrent(m_screen->display()->nativeDisplay(), glxDrawable, m_context); } void QGLXContext::doneCurrent() { - QPlatformGLContext::doneCurrent(); glXMakeCurrent(m_screen->display()->nativeDisplay(), 0, 0); } -void QGLXContext::swapBuffers() +void QGLXContext::swapBuffers(QPlatformSurface *surface) { - glXSwapBuffers(m_screen->display()->nativeDisplay(), m_drawable); + Q_UNUSED(surface); + + GLXDrawable glxDrawable = static_cast<QXlibWindow *>(surface)->winId(); + glXSwapBuffers(m_screen->display()->nativeDisplay(), glxDrawable); } -void* QGLXContext::getProcAddress(const QString& procName) +void (*QGLXContext::getProcAddress(const QByteArray& procName))() { typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; @@ -147,10 +146,10 @@ void* QGLXContext::getProcAddress(const QString& procName) } if (!glXGetProcAddressARB) return 0; - return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.toLatin1().data())); + return (void (*)())glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.constData())); } -QPlatformWindowFormat QGLXContext::platformWindowFormat() const +QSurfaceFormat QGLXContext::surfaceFormat() const { return m_windowFormat; } diff --git a/src/plugins/platforms/xlib/qglxintegration.h b/src/plugins/platforms/xlib/qglxintegration.h index 07c2a77f5df..e3172b718c3 100644 --- a/src/plugins/platforms/xlib/qglxintegration.h +++ b/src/plugins/platforms/xlib/qglxintegration.h @@ -44,8 +44,8 @@ #include "qxlibwindow.h" -#include <QtGui/QPlatformGLContext> -#include <QtGui/QPlatformWindowFormat> +#include <QtGui/QPlatformOpenGLContext> +#include <QtGui/qsurfaceformat.h> #include <QtCore/QMutex> @@ -54,28 +54,26 @@ QT_BEGIN_NAMESPACE -class QGLXContext : public QPlatformGLContext +class QGLXContext : public QPlatformOpenGLContext { public: - QGLXContext(Window window, QXlibScreen *xd, const QPlatformWindowFormat &format); + QGLXContext(QXlibScreen *xd, const QSurfaceFormat &format, QPlatformOpenGLContext *share); ~QGLXContext(); - virtual void makeCurrent(); - virtual void doneCurrent(); - virtual void swapBuffers(); - virtual void* getProcAddress(const QString& procName); + QSurfaceFormat format() const; + void swapBuffers(QPlatformSurface *surface); + bool makeCurrent(QPlatformSurface *surface); + void doneCurrent(); + virtual void (*getProcAddress(const QByteArray& procName))(); GLXContext glxContext() const {return m_context;} - QPlatformWindowFormat platformWindowFormat() const; + QSurfaceFormat surfaceFormat() const; private: QXlibScreen *m_screen; - Drawable m_drawable; GLXContext m_context; - QPlatformWindowFormat m_windowFormat; - - QGLXContext (QXlibScreen *screen, Drawable drawable, GLXContext context); + QSurfaceFormat m_windowFormat; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibbackingstore.cpp similarity index 76% rename from src/plugins/platforms/xlib/qxlibwindowsurface.cpp rename to src/plugins/platforms/xlib/qxlibbackingstore.cpp index e0c272d110c..24a346a29da 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp +++ b/src/plugins/platforms/xlib/qxlibbackingstore.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qxlibwindowsurface.h" +#include "qxlibbackingstore.h" #include "qxlibintegration.h" #include <QtCore/qdebug.h> @@ -57,7 +57,6 @@ QT_BEGIN_NAMESPACE - struct QXlibShmImageInfo { QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} ~QXlibShmImageInfo() { destroy(); } @@ -80,13 +79,15 @@ void QXlibShmImageInfo::destroy() } #endif -void QXlibWindowSurface::resizeShmImage(int width, int height) +void QXlibBackingStore::resizeShmImage(int width, int height) { QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); - QXlibWindow *win = static_cast<QXlibWindow*>(window()->platformWindow()); + QXlibWindow *win = static_cast<QXlibWindow*>(window()->handle()); + + QImage::Format format = win->depth() == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32; #ifdef DONT_USE_MIT_SHM - shm_img = QImage(width, height, win->format()); + shm_img = QImage(width, height, format); #else if (image_info) @@ -110,69 +111,68 @@ void QXlibWindowSurface::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, win->format() ); + shm_img = QImage((uchar*) image->data, image->width, image->height, image->bytes_per_line, format); #endif painted = false; } -void QXlibWindowSurface::resizeBuffer(QSize s) +void QXlibBackingStore::resizeBuffer(QSize s) { if (shm_img.size() != s) resizeShmImage(s.width(), s.height()); } -QSize QXlibWindowSurface::bufferSize() const +QSize QXlibBackingStore::bufferSize() const { return shm_img.size(); } -QXlibWindowSurface::QXlibWindowSurface (QWidget *window) - : QWindowSurface(window), +QXlibBackingStore::QXlibBackingStore(QWindow *window) + : QPlatformBackingStore(window), painted(false), image_info(0) { - xw = static_cast<QXlibWindow*>(window->platformWindow()); + xw = static_cast<QXlibWindow*>(window->handle()); // qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; } -QXlibWindowSurface::~QXlibWindowSurface() +QXlibBackingStore::~QXlibBackingStore() { delete image_info; } -QPaintDevice *QXlibWindowSurface::paintDevice() +QPaintDevice *QXlibBackingStore::paintDevice() { return &shm_img; } -void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QXlibBackingStore::flush(QWindow *w, const QRegion ®ion, const QPoint &offset) { - Q_UNUSED(widget); Q_UNUSED(region); Q_UNUSED(offset); if (!painted) return; - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(w); GC gc = xw->graphicsContext(); Window window = xw->xWindow(); #ifdef DONT_USE_MIT_SHM // just convert the image every time... if (!shm_img.isNull()) { - QXlibWindow *win = static_cast<QXlibWindow*>(window()->platformWindow()); + QXlibWindow *win = static_cast<QXlibWindow*>(w->handle()); QImage image = shm_img; //img.convertToFormat( - XImage *xi = XCreateImage(screen->display(), win->visual(), win->depth(), ZPixmap, + XImage *xi = XCreateImage(screen->display()->nativeDisplay(), win->visual(), win->depth(), ZPixmap, 0, (char *) image.scanLine(0), image.width(), image.height(), 32, image.bytesPerLine()); int x = 0; int y = 0; - /*int r =*/ XPutImage(screen->display(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); + /*int r =*/ XPutImage(screen->display()->nativeDisplay(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); xi->data = 0; // QImage owns these bits XDestroyImage(xi); @@ -195,26 +195,15 @@ void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPo #endif } -// from qwindowsurface.cpp -extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); - -bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) +void QXlibBackingStore::resize(const QSize &size, const QRegion &) { - if (shm_img.isNull()) - return false; - - const QVector<QRect> rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); - - return true; + resizeBuffer(size); } -void QXlibWindowSurface::beginPaint(const QRegion ®ion) +void QXlibBackingStore::beginPaint(const QRegion ®ion) { Q_UNUSED(region); - resizeBuffer(size()); if (shm_img.hasAlphaChannel()) { QPainter p(&shm_img); @@ -227,9 +216,8 @@ void QXlibWindowSurface::beginPaint(const QRegion ®ion) } } -void QXlibWindowSurface::endPaint(const QRegion ®ion) +void QXlibBackingStore::endPaint() { - Q_UNUSED(region); painted = true; //there is content in the buffer } QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.h b/src/plugins/platforms/xlib/qxlibbackingstore.h similarity index 86% rename from src/plugins/platforms/xlib/qxlibwindowsurface.h rename to src/plugins/platforms/xlib/qxlibbackingstore.h index aeec781fc91..35093f67844 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.h +++ b/src/plugins/platforms/xlib/qxlibbackingstore.h @@ -42,8 +42,8 @@ #ifndef QWINDOWSURFACE_TESTLITE_H #define QWINDOWSURFACE_TESTLITE_H -#include <QtGui/private/qwindowsurface_p.h> - +#include <QtGui/qplatformbackingstore_qpa.h> +#include <QtGui/QImage> QT_BEGIN_NAMESPACE @@ -52,18 +52,19 @@ class QXlibIntegration; class QXlibScreen; class QXlibShmImageInfo; -class QXlibWindowSurface : public QWindowSurface +class QXlibBackingStore : public QPlatformBackingStore { public: - QXlibWindowSurface (QWidget *window); - ~QXlibWindowSurface(); + QXlibBackingStore (QWindow *window); + ~QXlibBackingStore(); QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - bool scroll(const QRegion &area, int dx, int dy); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + + void resize(const QSize &size, const QRegion &staticContents); void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); + void endPaint(); private: bool painted; diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp index 2c1d91bde8b..3ee4d4269cc 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.cpp +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -39,14 +39,14 @@ ** ****************************************************************************/ +#include <private/qguiapplication_p.h> + #include "qxlibclipboard.h" #include "qxlibscreen.h" #include "qxlibmime.h" #include "qxlibdisplay.h" -#include <private/qapplication_p.h> - #include <QtCore/QDebug> class QXlibClipboardMime : public QXlibMime diff --git a/src/plugins/platforms/xlib/qxlibcursor.cpp b/src/plugins/platforms/xlib/qxlibcursor.cpp index 0af4aefecd5..7a074bc0e68 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.cpp +++ b/src/plugins/platforms/xlib/qxlibcursor.cpp @@ -57,12 +57,11 @@ QXlibCursor::QXlibCursor(QXlibScreen *screen) { } -void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) +void QXlibCursor::changeCursor(QCursor *cursor, QWindow *window) { QXlibWindow *w = 0; - if (widget) { - QWidget *window = widget->window(); - w = static_cast<QXlibWindow*>(window->platformWindow()); + if (window) { + w = static_cast<QXlibWindow*>(window->handle()); } else { // No X11 cursor control when there is no widget under the cursor return; diff --git a/src/plugins/platforms/xlib/qxlibcursor.h b/src/plugins/platforms/xlib/qxlibcursor.h index e2543d2e2a1..fd574778d7f 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.h +++ b/src/plugins/platforms/xlib/qxlibcursor.h @@ -53,7 +53,7 @@ class QXlibCursor : QPlatformCursor public: QXlibCursor(QXlibScreen *screen); - void changeCursor(QCursor * cursor, QWidget * widget); + void changeCursor(QCursor * cursor, QWindow * widget); private: Cursor createCursorBitmap(QCursor * cursor); diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index 02104d9f74c..c1f09416198 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -39,91 +39,66 @@ ** ****************************************************************************/ +#include <private/qguiapplication_p.h> #include "qxlibintegration.h" -#include "qxlibwindowsurface.h" +#include "qxlibbackingstore.h" #include <QtGui/private/qpixmap_raster_p.h> #include <QtCore/qdebug.h> +#include <QtGui/qopenglcontext.h> +#include <QtGui/qscreen.h> #include "qxlibwindow.h" -#include "qgenericunixfontdatabase.h" +#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> +#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> #include "qxlibscreen.h" #include "qxlibclipboard.h" #include "qxlibdisplay.h" #include "qxlibnativeinterface.h" - -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) -#include <GL/glx.h> -#else -#include <EGL/egl.h> -#endif //!defined(QT_OPENGL_ES_2) -#include <private/qwindowsurface_gl_p.h> -#include <private/qpixmapdata_gl_p.h> -#endif //QT_NO_OPENGL +#include "qglxintegration.h" QT_BEGIN_NAMESPACE -QXlibIntegration::QXlibIntegration(bool useOpenGL) - : mUseOpenGL(useOpenGL) - , mFontDb(new QGenericUnixFontDatabase()) +QXlibIntegration::QXlibIntegration() + : mFontDb(new QGenericUnixFontDatabase()) , mClipboard(0) , mNativeInterface(new QXlibNativeInterface) { + mEventDispatcher = createUnixEventDispatcher(); + QGuiApplicationPrivate::instance()->setEventDispatcher(mEventDispatcher); + + XInitThreads(); + mPrimaryScreen = new QXlibScreen(); mScreens.append(mPrimaryScreen); + screenAdded(mPrimaryScreen); } -bool QXlibIntegration::hasCapability(QPlatformIntegration::Capability cap) const +bool QXlibIntegration::hasCapability(QPlatformIntegration::Capability) const { - switch (cap) { - case ThreadedPixmaps: return true; - case OpenGL: return hasOpenGL(); - default: return QPlatformIntegration::hasCapability(cap); - } + return true; } -QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const +QPlatformBackingStore *QXlibIntegration::createPlatformBackingStore(QWindow *window) const { -#ifndef QT_NO_OPENGL - if (mUseOpenGL) - return new QGLPixmapData(type); -#endif - return new QRasterPixmapData(type); + return new QXlibBackingStore(window); } -QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const +QPlatformOpenGLContext *QXlibIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { -#ifndef QT_NO_OPENGL - if (mUseOpenGL) - return new QGLWindowSurface(widget); -#endif - return new QXlibWindowSurface(widget); + QXlibScreen *screen = static_cast<QXlibScreen *>(context->screen()->handle()); + + return new QGLXContext(screen, context->format(), context->shareHandle()); } -QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +QPlatformWindow *QXlibIntegration::createPlatformWindow(QWindow *window) const { - return new QXlibWindow(widget); + return new QXlibWindow(window); } - - -QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const +QAbstractEventDispatcher *QXlibIntegration::guiThreadEventDispatcher() const { - QImage image; - QWidget *widget = QWidget::find(window); - if (widget) { - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); - image = screen->grabWindow(window,x,y,width,height); - } else { - for (int i = 0; i < mScreens.size(); i++) { - QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens[i]); - if (screen->rootWindow() == window) { - image = screen->grabWindow(window,x,y,width,height); - } - } - } - return QPixmap::fromImage(image); + return mEventDispatcher; } QPlatformFontDatabase *QXlibIntegration::fontDatabase() const @@ -146,28 +121,4 @@ QPlatformNativeInterface * QXlibIntegration::nativeInterface() const return mNativeInterface; } -bool QXlibIntegration::hasOpenGL() const -{ -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens.at(0)); - return glXQueryExtension(screen->display()->nativeDisplay(), 0, 0) != 0; -#else - static bool eglHasbeenInitialized = false; - static bool wasEglInitialized = false; - if (!eglHasbeenInitialized) { - eglHasbeenInitialized = true; - QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens.at(0)); - EGLint major, minor; - eglBindAPI(EGL_OPENGL_ES_API); - EGLDisplay disp = eglGetDisplay(screen->display()->nativeDisplay()); - wasEglInitialized = eglInitialize(disp,&major,&minor); - screen->setEglDisplay(disp); - } - return wasEglInitialized; -#endif -#endif - return false; -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h index 9c814ead69f..f5150fca6fb 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.h +++ b/src/plugins/platforms/xlib/qxlibintegration.h @@ -58,12 +58,15 @@ class QXlibScreen; class QXlibIntegration : public QPlatformIntegration { public: - QXlibIntegration(bool useOpenGL = false); + QXlibIntegration(); bool hasCapability(Capability cap) const; - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QPlatformWindow *createPlatformWindow(QWindow *window) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + + QAbstractEventDispatcher *guiThreadEventDispatcher() const; QPixmap grabWindow(WId window, int x, int y, int width, int height) const; @@ -75,14 +78,12 @@ public: QPlatformNativeInterface *nativeInterface() const; private: - bool hasOpenGL() const; - - bool mUseOpenGL; QXlibScreen *mPrimaryScreen; QList<QPlatformScreen *> mScreens; QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; QPlatformNativeInterface *mNativeInterface; + QAbstractEventDispatcher *mEventDispatcher; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp index c152070e5aa..66e48fec93f 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.cpp +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -987,7 +987,7 @@ static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) } } -void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) +void QXlibKeyboard::handleKeyEvent(QWindow *widget, QEvent::Type type, XKeyEvent *ev) { int qtcode = 0; Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.h b/src/plugins/platforms/xlib/qxlibkeyboard.h index 71dbf8f78d8..a33ad61d273 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.h +++ b/src/plugins/platforms/xlib/qxlibkeyboard.h @@ -51,7 +51,7 @@ public: void changeLayout(); - void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev); + void handleKeyEvent(QWindow *widget, QEvent::Type type, XKeyEvent *ev); Qt::KeyboardModifiers translateModifiers(int s); diff --git a/src/plugins/platforms/xlib/qxlibnativeinterface.cpp b/src/plugins/platforms/xlib/qxlibnativeinterface.cpp index 76396aaeb6a..2c706e64e4f 100644 --- a/src/plugins/platforms/xlib/qxlibnativeinterface.cpp +++ b/src/plugins/platforms/xlib/qxlibnativeinterface.cpp @@ -39,10 +39,11 @@ ** ****************************************************************************/ +#include <private/qguiapplication_p.h> #include "qxlibnativeinterface.h" #include "qxlibdisplay.h" -#include <QtGui/private/qapplication_p.h> +#include "qscreen.h" class QXlibResourceMap : public QMap<QByteArray, QXlibNativeInterface::ResourceType> { @@ -62,29 +63,29 @@ public: Q_GLOBAL_STATIC(QXlibResourceMap, qXlibResourceMap) -void * QXlibNativeInterface::nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget) +void * QXlibNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) { QByteArray lowerCaseResource = resourceString.toLower(); ResourceType resource = qXlibResourceMap()->value(lowerCaseResource); void *result = 0; switch(resource) { case Display: - result = displayForWidget(widget); + result = displayForWindow(window); break; case EglDisplay: - result = eglDisplayForWidget(widget); + result = eglDisplayForWindow(window); break; case Connection: - result = connectionForWidget(widget); + result = connectionForWindow(window); break; case Screen: - result = reinterpret_cast<void *>(qPlatformScreenForWidget(widget)->xScreenNumber()); + result = reinterpret_cast<void *>(qPlatformScreenForWindow(window)->xScreenNumber()); break; case GraphicsDevice: - result = graphicsDeviceForWidget(widget); + result = graphicsDeviceForWindow(window); break; case EglContext: - result = eglContextForWidget(widget); + result = eglContextForWindow(window); break; default: result = 0; @@ -92,42 +93,37 @@ void * QXlibNativeInterface::nativeResourceForWidget(const QByteArray &resourceS return result; } -void * QXlibNativeInterface::displayForWidget(QWidget *widget) +void * QXlibNativeInterface::displayForWindow(QWindow *window) { - return qPlatformScreenForWidget(widget)->display()->nativeDisplay(); + return qPlatformScreenForWindow(window)->display()->nativeDisplay(); } -void * QXlibNativeInterface::eglDisplayForWidget(QWidget *widget) +void * QXlibNativeInterface::eglDisplayForWindow(QWindow *window) { - Q_UNUSED(widget); + Q_UNUSED(window); return 0; } -void * QXlibNativeInterface::screenForWidget(QWidget *widget) +void * QXlibNativeInterface::screenForWindow(QWindow *window) { - Q_UNUSED(widget); + Q_UNUSED(window); return 0; } -void * QXlibNativeInterface::graphicsDeviceForWidget(QWidget *widget) +void * QXlibNativeInterface::graphicsDeviceForWindow(QWindow *window) { - Q_UNUSED(widget); + Q_UNUSED(window); return 0; } -void * QXlibNativeInterface::eglContextForWidget(QWidget *widget) +void * QXlibNativeInterface::eglContextForWindow(QWindow *window) { - Q_UNUSED(widget); + Q_UNUSED(window); return 0; } -QXlibScreen * QXlibNativeInterface::qPlatformScreenForWidget(QWidget *widget) +QXlibScreen * QXlibNativeInterface::qPlatformScreenForWindow(QWindow *window) { - QXlibScreen *screen; - if (widget) { - screen = static_cast<QXlibScreen *>(QPlatformScreen::platformScreenForWidget(widget)); - }else { - screen = static_cast<QXlibScreen *>(QApplicationPrivate::platformIntegration()->screens()[0]); - } - return screen; + QScreen *screen = window ? window->screen() : QGuiApplication::primaryScreen(); + return static_cast<QXlibScreen *>(screen->handle()); } diff --git a/src/plugins/platforms/xlib/qxlibnativeinterface.h b/src/plugins/platforms/xlib/qxlibnativeinterface.h index e1f5cea8b26..4c6ce770b06 100644 --- a/src/plugins/platforms/xlib/qxlibnativeinterface.h +++ b/src/plugins/platforms/xlib/qxlibnativeinterface.h @@ -58,17 +58,17 @@ public: EglContext }; - void *nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget); + void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); - void *displayForWidget(QWidget *widget); - void *eglDisplayForWidget(QWidget *widget); - void *connectionForWidget(QWidget *widget); - void *screenForWidget(QWidget *widget); - void *graphicsDeviceForWidget(QWidget *widget); - void *eglContextForWidget(QWidget *widget); + void *displayForWindow(QWindow *window); + void *eglDisplayForWindow(QWindow *window); + void *connectionForWindow(QWindow *window); + void *screenForWindow(QWindow *window); + void *graphicsDeviceForWindow(QWindow *window); + void *eglContextForWindow(QWindow *window); private: - static QXlibScreen *qPlatformScreenForWidget(QWidget *widget); + static QXlibScreen *qPlatformScreenForWindow(QWindow *window); }; diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp index b069985a5cf..e6263c0b33b 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.cpp +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include <private/qguiapplication_p.h> #include "qxlibscreen.h" #include <X11/extensions/Xfixes.h> @@ -54,7 +55,7 @@ #include <QtCore/QSocketNotifier> #include <QtCore/QElapsedTimer> -#include <private/qapplication_p.h> +#include <QtGui/QScreen> QT_BEGIN_NAMESPACE @@ -263,11 +264,9 @@ unsigned long QXlibScreen::whitePixel() bool QXlibScreen::handleEvent(XEvent *xe) { int quit = false; - QXlibWindow *platformWindow = 0; - QWidget *widget = QWidget::find(xe->xany.window); - if (widget) { - platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); - } + QXlibWindow *platformWindow = QXlibWindow::platformWindowForXWindow(xe->xany.window); + if (!platformWindow) + return false; Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); @@ -282,56 +281,48 @@ bool QXlibScreen::handleEvent(XEvent *xe) break; case Expose: - if (platformWindow) - if (xe->xexpose.count == 0) - platformWindow->paintEvent(); + // ### +// if (xe->xexpose.count == 0) +// platformWindow->paintEvent(); break; case ConfigureNotify: - if (platformWindow) - platformWindow->resizeEvent(&xe->xconfigure); + platformWindow->resizeEvent(&xe->xconfigure); break; case ButtonPress: - if (platformWindow) - platformWindow->mousePressEvent(&xe->xbutton); + platformWindow->mousePressEvent(&xe->xbutton); break; case ButtonRelease: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); + platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); break; case MotionNotify: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); + platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); break; - case XKeyPress: - mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); + case XKeyPress: + mKeyboard->handleKeyEvent(platformWindow->window(), QEvent::KeyPress, &xe->xkey); break; case XKeyRelease: - mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); + mKeyboard->handleKeyEvent(platformWindow->window(), QEvent::KeyRelease, &xe->xkey); break; case EnterNotify: - if (platformWindow) - platformWindow->handleEnterEvent(); + platformWindow->handleEnterEvent(); break; case LeaveNotify: - if (platformWindow) - platformWindow->handleLeaveEvent(); + platformWindow->handleLeaveEvent(); break; case XFocusIn: - if (platformWindow) - platformWindow->handleFocusInEvent(); + platformWindow->handleFocusInEvent(); break; case XFocusOut: - if (platformWindow) - platformWindow->handleFocusOutEvent(); + platformWindow->handleFocusOutEvent(); break; case PropertyNotify: @@ -452,10 +443,9 @@ QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) return result; } -QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) +QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWindow *widget) { - QPlatformScreen *platformScreen = platformScreenForWidget(widget); - return static_cast<QXlibScreen *>(platformScreen); + return static_cast<QXlibScreen *>(widget->screen()->handle()); } QXlibDisplay * QXlibScreen::display() const @@ -480,7 +470,7 @@ QXlibKeyboard * QXlibScreen::keyboard() const void QXlibScreen::handleSelectionRequest(XEvent *event) { - QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); + QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration(); QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); clipboard->handleSelectionRequest(event); } diff --git a/src/plugins/platforms/xlib/qxlibscreen.h b/src/plugins/platforms/xlib/qxlibscreen.h index 81625e561ec..6e1a3e401da 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.h +++ b/src/plugins/platforms/xlib/qxlibscreen.h @@ -51,7 +51,7 @@ class QXlibCursor; class QXlibKeyboard; class QXlibDisplay; -class QXlibScreen : public QPlatformScreen +class QXlibScreen : public QObject, public QPlatformScreen { Q_OBJECT public: @@ -73,7 +73,7 @@ public: QImage grabWindow(Window window, int x, int y, int w, int h); - static QXlibScreen *testLiteScreenForWidget(QWidget *widget); + static QXlibScreen *testLiteScreenForWidget(QWindow *widget); QXlibDisplay *display() const; int xScreenNumber() const; diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp index 3ba0eb4c326..c9ed13aeea7 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.cpp +++ b/src/plugins/platforms/xlib/qxlibstatic.cpp @@ -39,13 +39,14 @@ ** ****************************************************************************/ +#include <private/qguiapplication_p.h> #include "qxlibstatic.h" #include "qxlibscreen.h" #include "qxlibdisplay.h" #include <qplatformdefs.h> +#include <QtGui/qscreen.h> -#include <QtGui/private/qapplication_p.h> #include <QtCore/QBuffer> #include <QtCore/QLibrary> @@ -258,7 +259,7 @@ public: , xfixes_eventbase(0) , xfixes_errorbase(0) { - QXlibScreen *screen = qobject_cast<QXlibScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); + QXlibScreen *screen = static_cast<QXlibScreen *> (QGuiApplication::primaryScreen()->handle()); Q_ASSERT(screen); initializeAllAtoms(screen); diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 823fae9de3c..e388f1054d1 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include <QtGui/private/qguiapplication_p.h> #include "qxlibwindow.h" #include "qxlibintegration.h" @@ -50,7 +51,7 @@ #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) #include "qglxintegration.h" -#include "qglxconvenience.h" +#include "private/qglxconvenience_p.h" #else #include "../eglconvenience/qeglconvenience.h" #include "../eglconvenience/qeglplatformcontext.h" @@ -64,14 +65,14 @@ #include <QApplication> #include <QDebug> -#include <QtGui/private/qwindowsurface_p.h> -#include <QtGui/private/qapplication_p.h> - //#define MYX11_DEBUG QT_BEGIN_NAMESPACE -QXlibWindow::QXlibWindow(QWidget *window) +QHash<Window, QXlibWindow *> QXlibWindow::windowMap; + + +QXlibWindow::QXlibWindow(QWindow *window) : QPlatformWindow(window) , mGLContext(0) , mScreen(QXlibScreen::testLiteScreenForWidget(window)) @@ -82,11 +83,10 @@ QXlibWindow::QXlibWindow(QWidget *window) int h = window->height(); #if !defined(QT_NO_OPENGL) - if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) - || window->platformWindowFormat().alpha()) { + if(window->surfaceType() == QWindow::OpenGLSurface) { #if !defined(QT_OPENGL_ES_2) - XVisualInfo *visualInfo = qglx_findVisualInfo(mScreen->display()->nativeDisplay(),mScreen->xScreenNumber(),window->platformWindowFormat()); + XVisualInfo *visualInfo = qglx_findVisualInfo(mScreen->display()->nativeDisplay(), mScreen->xScreenNumber(), + window->format()); #else QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); @@ -156,6 +156,8 @@ QXlibWindow::QXlibWindow(QWidget *window) if (window->windowFlags() & Qt::WindowContextHelpButtonHint) protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); XSetWMProtocols(mScreen->display()->nativeDisplay(), x_window, protocols, n); + + windowMap.insert(x_window, this); } @@ -165,6 +167,9 @@ QXlibWindow::~QXlibWindow() #ifdef MYX11_DEBUG qDebug() << "~QTestLiteWindow" << hex << x_window; #endif + + windowMap.remove(x_window); + delete mGLContext; XFreeGC(mScreen->display()->nativeDisplay(), gc); XDestroyWindow(mScreen->display()->nativeDisplay(), x_window); @@ -209,7 +214,7 @@ void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) bool hor = (((e->button == Button4 || e->button == Button5) && (modifiers & Qt::AltModifier)) || (e->button == 6 || e->button == 7)); - QWindowSystemInterface::handleWheelEvent(widget(), 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); @@ -222,7 +227,7 @@ void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) buttons ^= button; // X event uses state *before*, Qt uses state *after* - QWindowSystemInterface::handleMouseEvent(widget(), 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); @@ -231,23 +236,23 @@ void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) void QXlibWindow::handleCloseEvent() { - QWindowSystemInterface::handleCloseEvent(widget()); + QWindowSystemInterface::handleCloseEvent(window()); } void QXlibWindow::handleEnterEvent() { - QWindowSystemInterface::handleEnterEvent(widget()); + QWindowSystemInterface::handleEnterEvent(window()); } void QXlibWindow::handleLeaveEvent() { - QWindowSystemInterface::handleLeaveEvent(widget()); + QWindowSystemInterface::handleLeaveEvent(window()); } void QXlibWindow::handleFocusInEvent() { - QWindowSystemInterface::handleWindowActivated(widget()); + QWindowSystemInterface::handleWindowActivated(window()); } void QXlibWindow::handleFocusOutEvent() @@ -313,16 +318,6 @@ GC QXlibWindow::createGC() return gc; } -void QXlibWindow::paintEvent() -{ -#ifdef MYX11_DEBUG -// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; -#endif - - if (QWindowSurface *surface = widget()->windowSurface()) - surface->flush(widget(), widget()->geometry(), QPoint()); -} - void QXlibWindow::requestActivateWindow() { XSetInputFocus(mScreen->display()->nativeDisplay(), x_window, XRevertToParent, CurrentTime); @@ -340,11 +335,12 @@ void QXlibWindow::resizeEvent(XConfigureEvent *e) ypos = e->y; } #ifdef MYX11_DEBUG - qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; + qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << + "geometry" << xpos << ypos << e->width << e->height; #endif QRect newRect(xpos, ypos, e->width, e->height); - QWindowSystemInterface::handleGeometryChange(widget(), newRect); + QWindowSystemInterface::handleGeometryChange(window(), newRect); } void QXlibWindow::mousePressEvent(XButtonEvent *e) @@ -413,16 +409,15 @@ void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) } // Returns true if we should set WM_TRANSIENT_FOR on \a w -static inline bool isTransient(const QWidget *w) +static inline bool isTransient(const QWindow *w) { - return ((w->windowType() == Qt::Dialog + 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)); + || w->windowType() == Qt::Popup); } QVector<Atom> QXlibWindow::getNetWmState() const @@ -568,9 +563,9 @@ Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) mwmhints.decorations = 0; } - if (widget()->windowModality() == Qt::WindowModal) { + if (window()->windowModality() == Qt::WindowModal) { mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; - } else if (widget()->windowModality() == Qt::ApplicationModal) { + } else if (window()->windowModality() == Qt::ApplicationModal) { mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; } @@ -580,7 +575,7 @@ Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) if (flags & Qt::WindowStaysOnTopHint) { if (flags & Qt::WindowStaysOnBottomHint) - qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; + qWarning() << "QWindow: Incompatible window flags: the window can't be on top and on bottom at the same time"; if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) @@ -589,17 +584,17 @@ Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); } - if (widget()->isFullScreen()) { + if (window()->windowState() & Qt::WindowFullScreen) { if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); } - if (widget()->isMaximized()) { + if (window()->windowState() & Qt::WindowMaximized) { if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); } - if (widget()->windowModality() != Qt::NonModal) { + if (window()->windowModality() != Qt::NonModal) { if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); } @@ -634,24 +629,29 @@ Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) return flags; } +Qt::WindowState QXlibWindow::setWindowState(Qt::WindowState state) +{ + // #### + return state; +} + void QXlibWindow::setVisible(bool visible) { #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; #endif - if (isTransient(widget())) { + if (isTransient(window())) { Window parentXWindow = x_window; - if (widget()->parentWidget()) { - QWidget *widgetParent = widget()->parentWidget()->window(); - if (widgetParent && widgetParent->platformWindow()) { - QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); - parentXWindow = parentWidnow->x_window; - } + QWindow *parent = window()->parent(); + if (parent && parent->handle()) { + QXlibWindow *xlibParent = static_cast<QXlibWindow *>(parent->handle()); + parentXWindow = xlibParent->x_window; } XSetTransientForHint(mScreen->display()->nativeDisplay(),x_window,parentXWindow); } if (visible) { + qDebug() << ">>> mapping"; //ensure that the window is viewed in correct position. doSizeHints(); XMapWindow(mScreen->display()->nativeDisplay(), x_window); @@ -666,34 +666,12 @@ void QXlibWindow::setCursor(const Cursor &cursor) mScreen->display()->flush(); } -QPlatformGLContext *QXlibWindow::glContext() const +QSurfaceFormat QXlibWindow::format() const { - if (!QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) - return 0; - if (!mGLContext) { - QXlibWindow *that = const_cast<QXlibWindow *>(this); -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); -#else - EGLDisplay display = mScreen->eglDisplay(); - - QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); - - EGLConfig config = q_configFromQPlatformWindowFormat(display,windowFormat); - QVector<EGLint> eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - eglContextAttrs.append(2); - eglContextAttrs.append(EGL_NONE); - - EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)x_window,0); - that->mGLContext = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); -#endif -#endif - } - return mGLContext; + return window()->format(); } + Window QXlibWindow::xWindow() const { return x_window; @@ -706,7 +684,7 @@ GC QXlibWindow::graphicsContext() const void QXlibWindow::doSizeHints() { - Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); +// Q_ASSERT(window()->testAttribute(Qt::WA_WState_Created)); XSizeHints s; s.flags = 0; QRect g = geometry(); @@ -723,27 +701,10 @@ void QXlibWindow::doSizeHints() XSetWMNormalHints(mScreen->display()->nativeDisplay(), x_window, &s); } -QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const + +QXlibWindow *QXlibWindow::platformWindowForXWindow(Window window) { - // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, - // so this might be not what we want to do :) - if ( !(platformWindowFormat.redBufferSize() == -1 && - platformWindowFormat.greenBufferSize() == -1 && - platformWindowFormat.blueBufferSize() == -1)) - return platformWindowFormat; - - QPlatformWindowFormat windowFormat = platformWindowFormat; - if (mScreen->depth() == 16) { - windowFormat.setRedBufferSize(5); - windowFormat.setGreenBufferSize(6); - windowFormat.setBlueBufferSize(5); - } else { - windowFormat.setRedBufferSize(8); - windowFormat.setGreenBufferSize(8); - windowFormat.setBlueBufferSize(8); - } - - return windowFormat; + return windowMap.value(window); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h index da29efbff19..9b64dc56245 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.h +++ b/src/plugins/platforms/xlib/qxlibwindow.h @@ -49,6 +49,7 @@ #include <QObject> #include <QImage> +#include <QHash> struct QXlibMWMHints { ulong flags, functions, decorations; @@ -86,7 +87,7 @@ enum { class QXlibWindow : public QPlatformWindow { public: - QXlibWindow(QWidget *window); + QXlibWindow(QWindow *window); ~QXlibWindow(); @@ -100,7 +101,6 @@ public: void handleFocusOutEvent(); void resizeEvent(XConfigureEvent *configure_event); - void paintEvent(); void requestActivateWindow(); @@ -108,6 +108,8 @@ public: Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); Qt::WindowFlags windowFlags() const; + Qt::WindowState setWindowState(Qt::WindowState state); + void setVisible(bool visible); WId winId() const; void setParent(const QPlatformWindow *window); @@ -117,14 +119,14 @@ public: void setCursor(const Cursor &cursor); - QPlatformGLContext *glContext() const; - Window xWindow() const; GC graphicsContext() const; - inline uint depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } + QSurfaceFormat format() const; Visual* visual() const { return mVisual; } + int depth() const { return mDepth; } + + static QXlibWindow *platformWindowForXWindow(Window window); protected: QVector<Atom> getNetWmState() const; @@ -134,8 +136,6 @@ protected: void doSizeHints(); private: - QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const; - Window x_window; GC gc; @@ -145,9 +145,11 @@ private: GC createGC(); - QPlatformGLContext *mGLContext; + QPlatformOpenGLContext *mGLContext; QXlibScreen *mScreen; Qt::WindowFlags mWindowFlags; + + static QHash<Window, QXlibWindow *> windowMap; }; #endif diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro index 2cba5513d54..ea95ae83a1b 100644 --- a/src/plugins/platforms/xlib/xlib.pro +++ b/src/plugins/platforms/xlib/xlib.pro @@ -1,14 +1,14 @@ TARGET = qxlib load(qt_plugin) -DESTDIR = $$QT.gui.plugins/platforms +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms -QT += core-private gui-private opengl-private +QT += core-private gui-private platformsupport-private SOURCES = \ main.cpp \ qxlibintegration.cpp \ - qxlibwindowsurface.cpp \ + qxlibbackingstore.cpp \ qxlibwindow.cpp \ qxlibcursor.cpp \ qxlibscreen.cpp \ @@ -21,7 +21,7 @@ SOURCES = \ HEADERS = \ qxlibintegration.h \ - qxlibwindowsurface.h \ + qxlibbackingstore.h \ qxlibwindow.h \ qxlibcursor.h \ qxlibscreen.h \ @@ -38,24 +38,18 @@ mac { LIBS += -L/usr/X11/lib -lz -framework Carbon } -include (../fontdatabases/genericunix/genericunix.pri) +CONFIG += qpa/genericunixfontdatabase contains(QT_CONFIG, opengl) { QT += opengl !contains(QT_CONFIG, opengles2) { - include (../glxconvenience/glxconvenience.pri) +# load(qpa/glx/convenience) HEADERS += qglxintegration.h SOURCES += qglxintegration.cpp } else { # There is no easy way to detect if we'r suppose to use glx or not - HEADERS += \ - ../eglconvenience/qeglplatformcontext.h \ - ../eglconvenience/qeglconvenience.h \ - ../eglconvenience/qxlibeglintegration.h - - SOURCES += \ - ../eglconvenience/qeglplatformcontext.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - ../eglconvenience/qxlibeglintegration.cpp +# load(qpa/egl/context) +# load(qpa/egl/convenience) +# load(qpa/egl/xlibintegration) LIBS += -lEGL } } diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 0f2392eeeb9..f47c000dfb7 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -6,12 +6,11 @@ unix:!symbian { } else { SUBDIRS *= codecs } -!contains(QT_CONFIG, no-gui) { - SUBDIRS *= imageformats - !embedded:!qpa:SUBDIRS *= graphicssystems - !win32:!embedded:!mac:!symbian:SUBDIRS *= inputmethods - !symbian:SUBDIRS += accessible -} -embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers +!contains(QT_CONFIG, no-gui): SUBDIRS *= imageformats +!symbian:!contains(QT_CONFIG, no-gui):SUBDIRS += accessible + symbian:SUBDIRS += s60 -qpa:SUBDIRS += platforms +qpa: { + SUBDIRS += platforms + SUBDIRS += platforminputcontexts +} diff --git a/src/printsupport/dialogs/dialogs.pri b/src/printsupport/dialogs/dialogs.pri new file mode 100644 index 00000000000..5dbaa9fec34 --- /dev/null +++ b/src/printsupport/dialogs/dialogs.pri @@ -0,0 +1,43 @@ +# Qt dialogs module + +HEADERS += \ + dialogs/qabstractprintdialog.h \ + dialogs/qabstractprintdialog_p.h \ + dialogs/qabstractpagesetupdialog.h \ + dialogs/qabstractpagesetupdialog_p.h \ + dialogs/qpagesetupdialog.h \ + dialogs/qprintdialog.h \ + dialogs/qprintpreviewdialog.h + +!qpa:mac { + OBJECTIVE_SOURCES += dialogs/qpagesetupdialog_mac.mm \ + dialogs/qprintdialog_mac.mm + +} + +win32 { + qpa:DEFINES += QT_NO_PRINTDIALOG + + SOURCES += dialogs/qpagesetupdialog_win.cpp \ + dialogs/qprintdialog_win.cpp +} + +!mac:!symbian:unix|qpa:!win32 { + HEADERS += dialogs/qpagesetupdialog_unix_p.h + SOURCES += dialogs/qprintdialog_unix.cpp \ + dialogs/qpagesetupdialog_unix.cpp + FORMS += dialogs/qprintsettingsoutput.ui \ + dialogs/qprintwidget.ui \ + dialogs/qprintpropertieswidget.ui +} + +INCLUDEPATH += $$PWD + +SOURCES += \ + dialogs/qabstractprintdialog.cpp \ + dialogs/qabstractpagesetupdialog.cpp \ + dialogs/qpagesetupdialog.cpp \ + dialogs/qprintpreviewdialog.cpp + +FORMS += dialogs/qpagesetupwidget.ui +RESOURCES += dialogs/qprintdialog.qrc diff --git a/src/gui/dialogs/images/fit-page-24.png b/src/printsupport/dialogs/images/fit-page-24.png similarity index 100% rename from src/gui/dialogs/images/fit-page-24.png rename to src/printsupport/dialogs/images/fit-page-24.png diff --git a/src/gui/dialogs/images/fit-page-32.png b/src/printsupport/dialogs/images/fit-page-32.png similarity index 100% rename from src/gui/dialogs/images/fit-page-32.png rename to src/printsupport/dialogs/images/fit-page-32.png diff --git a/src/gui/dialogs/images/fit-width-24.png b/src/printsupport/dialogs/images/fit-width-24.png similarity index 100% rename from src/gui/dialogs/images/fit-width-24.png rename to src/printsupport/dialogs/images/fit-width-24.png diff --git a/src/gui/dialogs/images/fit-width-32.png b/src/printsupport/dialogs/images/fit-width-32.png similarity index 100% rename from src/gui/dialogs/images/fit-width-32.png rename to src/printsupport/dialogs/images/fit-width-32.png diff --git a/src/gui/dialogs/images/go-first-24.png b/src/printsupport/dialogs/images/go-first-24.png similarity index 100% rename from src/gui/dialogs/images/go-first-24.png rename to src/printsupport/dialogs/images/go-first-24.png diff --git a/src/gui/dialogs/images/go-first-32.png b/src/printsupport/dialogs/images/go-first-32.png similarity index 100% rename from src/gui/dialogs/images/go-first-32.png rename to src/printsupport/dialogs/images/go-first-32.png diff --git a/src/gui/dialogs/images/go-last-24.png b/src/printsupport/dialogs/images/go-last-24.png similarity index 100% rename from src/gui/dialogs/images/go-last-24.png rename to src/printsupport/dialogs/images/go-last-24.png diff --git a/src/gui/dialogs/images/go-last-32.png b/src/printsupport/dialogs/images/go-last-32.png similarity index 100% rename from src/gui/dialogs/images/go-last-32.png rename to src/printsupport/dialogs/images/go-last-32.png diff --git a/src/gui/dialogs/images/go-next-24.png b/src/printsupport/dialogs/images/go-next-24.png similarity index 100% rename from src/gui/dialogs/images/go-next-24.png rename to src/printsupport/dialogs/images/go-next-24.png diff --git a/src/gui/dialogs/images/go-next-32.png b/src/printsupport/dialogs/images/go-next-32.png similarity index 100% rename from src/gui/dialogs/images/go-next-32.png rename to src/printsupport/dialogs/images/go-next-32.png diff --git a/src/gui/dialogs/images/go-previous-24.png b/src/printsupport/dialogs/images/go-previous-24.png similarity index 100% rename from src/gui/dialogs/images/go-previous-24.png rename to src/printsupport/dialogs/images/go-previous-24.png diff --git a/src/gui/dialogs/images/go-previous-32.png b/src/printsupport/dialogs/images/go-previous-32.png similarity index 100% rename from src/gui/dialogs/images/go-previous-32.png rename to src/printsupport/dialogs/images/go-previous-32.png diff --git a/src/gui/dialogs/images/layout-landscape-24.png b/src/printsupport/dialogs/images/layout-landscape-24.png similarity index 100% rename from src/gui/dialogs/images/layout-landscape-24.png rename to src/printsupport/dialogs/images/layout-landscape-24.png diff --git a/src/gui/dialogs/images/layout-landscape-32.png b/src/printsupport/dialogs/images/layout-landscape-32.png similarity index 100% rename from src/gui/dialogs/images/layout-landscape-32.png rename to src/printsupport/dialogs/images/layout-landscape-32.png diff --git a/src/gui/dialogs/images/layout-portrait-24.png b/src/printsupport/dialogs/images/layout-portrait-24.png similarity index 100% rename from src/gui/dialogs/images/layout-portrait-24.png rename to src/printsupport/dialogs/images/layout-portrait-24.png diff --git a/src/gui/dialogs/images/layout-portrait-32.png b/src/printsupport/dialogs/images/layout-portrait-32.png similarity index 100% rename from src/gui/dialogs/images/layout-portrait-32.png rename to src/printsupport/dialogs/images/layout-portrait-32.png diff --git a/src/gui/dialogs/images/page-setup-24.png b/src/printsupport/dialogs/images/page-setup-24.png similarity index 100% rename from src/gui/dialogs/images/page-setup-24.png rename to src/printsupport/dialogs/images/page-setup-24.png diff --git a/src/gui/dialogs/images/page-setup-32.png b/src/printsupport/dialogs/images/page-setup-32.png similarity index 100% rename from src/gui/dialogs/images/page-setup-32.png rename to src/printsupport/dialogs/images/page-setup-32.png diff --git a/src/gui/dialogs/images/print-24.png b/src/printsupport/dialogs/images/print-24.png similarity index 100% rename from src/gui/dialogs/images/print-24.png rename to src/printsupport/dialogs/images/print-24.png diff --git a/src/gui/dialogs/images/print-32.png b/src/printsupport/dialogs/images/print-32.png similarity index 100% rename from src/gui/dialogs/images/print-32.png rename to src/printsupport/dialogs/images/print-32.png diff --git a/src/gui/dialogs/images/status-color.png b/src/printsupport/dialogs/images/status-color.png similarity index 100% rename from src/gui/dialogs/images/status-color.png rename to src/printsupport/dialogs/images/status-color.png diff --git a/src/gui/dialogs/images/status-gray-scale.png b/src/printsupport/dialogs/images/status-gray-scale.png similarity index 100% rename from src/gui/dialogs/images/status-gray-scale.png rename to src/printsupport/dialogs/images/status-gray-scale.png diff --git a/src/gui/dialogs/images/view-page-multi-24.png b/src/printsupport/dialogs/images/view-page-multi-24.png similarity index 100% rename from src/gui/dialogs/images/view-page-multi-24.png rename to src/printsupport/dialogs/images/view-page-multi-24.png diff --git a/src/gui/dialogs/images/view-page-multi-32.png b/src/printsupport/dialogs/images/view-page-multi-32.png similarity index 100% rename from src/gui/dialogs/images/view-page-multi-32.png rename to src/printsupport/dialogs/images/view-page-multi-32.png diff --git a/src/gui/dialogs/images/view-page-one-24.png b/src/printsupport/dialogs/images/view-page-one-24.png similarity index 100% rename from src/gui/dialogs/images/view-page-one-24.png rename to src/printsupport/dialogs/images/view-page-one-24.png diff --git a/src/gui/dialogs/images/view-page-one-32.png b/src/printsupport/dialogs/images/view-page-one-32.png similarity index 100% rename from src/gui/dialogs/images/view-page-one-32.png rename to src/printsupport/dialogs/images/view-page-one-32.png diff --git a/src/gui/dialogs/images/view-page-sided-24.png b/src/printsupport/dialogs/images/view-page-sided-24.png similarity index 100% rename from src/gui/dialogs/images/view-page-sided-24.png rename to src/printsupport/dialogs/images/view-page-sided-24.png diff --git a/src/gui/dialogs/images/view-page-sided-32.png b/src/printsupport/dialogs/images/view-page-sided-32.png similarity index 100% rename from src/gui/dialogs/images/view-page-sided-32.png rename to src/printsupport/dialogs/images/view-page-sided-32.png diff --git a/src/gui/dialogs/images/zoom-in-24.png b/src/printsupport/dialogs/images/zoom-in-24.png similarity index 100% rename from src/gui/dialogs/images/zoom-in-24.png rename to src/printsupport/dialogs/images/zoom-in-24.png diff --git a/src/gui/dialogs/images/zoom-in-32.png b/src/printsupport/dialogs/images/zoom-in-32.png similarity index 100% rename from src/gui/dialogs/images/zoom-in-32.png rename to src/printsupport/dialogs/images/zoom-in-32.png diff --git a/src/gui/dialogs/images/zoom-out-24.png b/src/printsupport/dialogs/images/zoom-out-24.png similarity index 100% rename from src/gui/dialogs/images/zoom-out-24.png rename to src/printsupport/dialogs/images/zoom-out-24.png diff --git a/src/gui/dialogs/images/zoom-out-32.png b/src/printsupport/dialogs/images/zoom-out-32.png similarity index 100% rename from src/gui/dialogs/images/zoom-out-32.png rename to src/printsupport/dialogs/images/zoom-out-32.png diff --git a/src/gui/dialogs/qabstractpagesetupdialog.cpp b/src/printsupport/dialogs/qabstractpagesetupdialog.cpp similarity index 99% rename from src/gui/dialogs/qabstractpagesetupdialog.cpp rename to src/printsupport/dialogs/qabstractpagesetupdialog.cpp index 7a0e0080b20..8268065bfd8 100644 --- a/src/gui/dialogs/qabstractpagesetupdialog.cpp +++ b/src/printsupport/dialogs/qabstractpagesetupdialog.cpp @@ -45,7 +45,7 @@ #ifndef QT_NO_PRINTDIALOG #include <QtCore/qcoreapplication.h> -#include <QtGui/qprinter.h> +#include <QtPrintSupport/qprinter.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/dialogs/qabstractpagesetupdialog.h b/src/printsupport/dialogs/qabstractpagesetupdialog.h similarity index 96% rename from src/gui/dialogs/qabstractpagesetupdialog.h rename to src/printsupport/dialogs/qabstractpagesetupdialog.h index 188b455c377..597a7258d90 100644 --- a/src/gui/dialogs/qabstractpagesetupdialog.h +++ b/src/printsupport/dialogs/qabstractpagesetupdialog.h @@ -42,7 +42,7 @@ #ifndef QABSTRACTPAGESETUPDIALOG_H #define QABSTRACTPAGESETUPDIALOG_H -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ class QAbstractPageSetupDialogPrivate; class QPrinter; // ### Qt 5: Remove this class -class Q_GUI_EXPORT QAbstractPageSetupDialog : public QDialog +class Q_PRINTSUPPORT_EXPORT QAbstractPageSetupDialog : public QDialog { Q_DECLARE_PRIVATE(QAbstractPageSetupDialog) Q_OBJECT diff --git a/src/gui/dialogs/qabstractpagesetupdialog_p.h b/src/printsupport/dialogs/qabstractpagesetupdialog_p.h similarity index 100% rename from src/gui/dialogs/qabstractpagesetupdialog_p.h rename to src/printsupport/dialogs/qabstractpagesetupdialog_p.h diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/printsupport/dialogs/qabstractprintdialog.cpp similarity index 93% rename from src/gui/dialogs/qabstractprintdialog.cpp rename to src/printsupport/dialogs/qabstractprintdialog.cpp index 4b495d11328..73b9c4f14ed 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/printsupport/dialogs/qabstractprintdialog.cpp @@ -115,6 +115,9 @@ QAbstractPrintDialog::QAbstractPrintDialog(QPrinter *printer, QWidget *parent) Q_D(QAbstractPrintDialog); setWindowTitle(QCoreApplication::translate("QPrintDialog", "Print")); d->setPrinter(printer); + d->minPage = printer->fromPage(); + int to = printer->toPage(); + d->maxPage = to > 0 ? to : INT_MAX; } /*! @@ -149,8 +152,8 @@ QAbstractPrintDialog::~QAbstractPrintDialog() void QPrintDialog::setOption(PrintDialogOption option, bool on) { Q_D(QPrintDialog); - if (!(d->pd->options & option) != !on) - setOptions(d->pd->options ^ option); + if (!(d->options & option) != !on) + setOptions(d->options ^ option); } /*! @@ -162,7 +165,7 @@ void QPrintDialog::setOption(PrintDialogOption option, bool on) bool QPrintDialog::testOption(PrintDialogOption option) const { Q_D(const QPrintDialog); - return (d->pd->options & option) != 0; + return (d->options & option) != 0; } /*! @@ -182,17 +185,17 @@ void QPrintDialog::setOptions(PrintDialogOptions options) { Q_D(QPrintDialog); - PrintDialogOptions changed = (options ^ d->pd->options); + PrintDialogOptions changed = (options ^ d->options); if (!changed) return; - d->pd->options = options; + d->options = options; } QPrintDialog::PrintDialogOptions QPrintDialog::options() const { Q_D(const QPrintDialog); - return d->pd->options; + return d->options; } /*! @@ -203,7 +206,7 @@ QPrintDialog::PrintDialogOptions QPrintDialog::options() const void QAbstractPrintDialog::setEnabledOptions(PrintDialogOptions options) { Q_D(QAbstractPrintDialog); - d->pd->options = options; + d->options = options; } /*! @@ -214,7 +217,7 @@ void QAbstractPrintDialog::setEnabledOptions(PrintDialogOptions options) void QAbstractPrintDialog::addEnabledOption(PrintDialogOption option) { Q_D(QAbstractPrintDialog); - d->pd->options |= option; + d->options |= option; } /*! @@ -225,7 +228,7 @@ void QAbstractPrintDialog::addEnabledOption(PrintDialogOption option) QAbstractPrintDialog::PrintDialogOptions QAbstractPrintDialog::enabledOptions() const { Q_D(const QAbstractPrintDialog); - return d->pd->options; + return d->options; } /*! @@ -236,7 +239,7 @@ QAbstractPrintDialog::PrintDialogOptions QAbstractPrintDialog::enabledOptions() bool QAbstractPrintDialog::isOptionEnabled(PrintDialogOption option) const { Q_D(const QAbstractPrintDialog); - return d->pd->options & option; + return d->options & option; } /*! @@ -245,7 +248,7 @@ bool QAbstractPrintDialog::isOptionEnabled(PrintDialogOption option) const void QAbstractPrintDialog::setPrintRange(PrintRange range) { Q_D(QAbstractPrintDialog); - d->pd->printRange = range; + d->printer->setPrintRange(QPrinter::PrintRange(range)); } /*! @@ -254,7 +257,7 @@ void QAbstractPrintDialog::setPrintRange(PrintRange range) QAbstractPrintDialog::PrintRange QAbstractPrintDialog::printRange() const { Q_D(const QAbstractPrintDialog); - return d->pd->printRange; + return QAbstractPrintDialog::PrintRange(d->pd->printRange); } /*! @@ -266,9 +269,9 @@ void QAbstractPrintDialog::setMinMax(int min, int max) Q_D(QAbstractPrintDialog); Q_ASSERT_X(min <= max, "QAbstractPrintDialog::setMinMax", "'min' must be less than or equal to 'max'"); - d->pd->minPage = min; - d->pd->maxPage = max; - d->pd->options |= PrintPageRange; + d->minPage = min; + d->maxPage = max; + d->options |= PrintPageRange; } /*! @@ -278,7 +281,7 @@ void QAbstractPrintDialog::setMinMax(int min, int max) int QAbstractPrintDialog::minPage() const { Q_D(const QAbstractPrintDialog); - return d->pd->minPage; + return d->minPage; } /*! @@ -289,7 +292,7 @@ int QAbstractPrintDialog::minPage() const int QAbstractPrintDialog::maxPage() const { Q_D(const QAbstractPrintDialog); - return d->pd->maxPage; + return d->maxPage; } /*! @@ -300,10 +303,9 @@ void QAbstractPrintDialog::setFromTo(int from, int to) Q_D(QAbstractPrintDialog); Q_ASSERT_X(from <= to, "QAbstractPrintDialog::setFromTo", "'from' must be less than or equal to 'to'"); - d->pd->fromPage = from; - d->pd->toPage = to; + d->printer->setFromTo(from, to); - if (d->pd->minPage == 0 && d->pd->maxPage == 0) + if (d->minPage == 0 && d->maxPage == 0) setMinMax(1, to); } @@ -314,7 +316,7 @@ void QAbstractPrintDialog::setFromTo(int from, int to) int QAbstractPrintDialog::fromPage() const { Q_D(const QAbstractPrintDialog); - return d->pd->fromPage; + return d->printer->fromPage(); } /*! @@ -324,7 +326,7 @@ int QAbstractPrintDialog::fromPage() const int QAbstractPrintDialog::toPage() const { Q_D(const QAbstractPrintDialog); - return d->pd->toPage; + return d->printer->toPage(); } @@ -343,6 +345,8 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter) if (newPrinter) { printer = newPrinter; ownsPrinter = false; + if (printer->fromPage() || printer->toPage()) + options |= QAbstractPrintDialog::PrintPageRange; } else { printer = new QPrinter; ownsPrinter = true; diff --git a/src/gui/dialogs/qabstractprintdialog.h b/src/printsupport/dialogs/qabstractprintdialog.h similarity index 96% rename from src/gui/dialogs/qabstractprintdialog.h rename to src/printsupport/dialogs/qabstractprintdialog.h index d2117a80fc8..2f8a750827e 100644 --- a/src/gui/dialogs/qabstractprintdialog.h +++ b/src/printsupport/dialogs/qabstractprintdialog.h @@ -42,7 +42,7 @@ #ifndef QABSTRACTPRINTDIALOG_H #define QABSTRACTPRINTDIALOG_H -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> QT_BEGIN_HEADER @@ -56,12 +56,13 @@ class QAbstractPrintDialogPrivate; class QPrinter; // ### Qt 5: remove this class -class Q_GUI_EXPORT QAbstractPrintDialog : public QDialog +class Q_PRINTSUPPORT_EXPORT QAbstractPrintDialog : public QDialog { Q_DECLARE_PRIVATE(QAbstractPrintDialog) Q_OBJECT public: + // Keep in sync with QPrinter::PrintRange enum PrintRange { AllPages, Selection, diff --git a/src/gui/dialogs/qabstractprintdialog_p.h b/src/printsupport/dialogs/qabstractprintdialog_p.h similarity index 88% rename from src/gui/dialogs/qabstractprintdialog_p.h rename to src/printsupport/dialogs/qabstractprintdialog_p.h index cda76074154..e329cb3169e 100644 --- a/src/gui/dialogs/qabstractprintdialog_p.h +++ b/src/printsupport/dialogs/qabstractprintdialog_p.h @@ -57,7 +57,7 @@ #ifndef QT_NO_PRINTDIALOG -#include "QtGui/qabstractprintdialog.h" +#include "QtPrintSupport/qabstractprintdialog.h" QT_BEGIN_NAMESPACE @@ -73,6 +73,9 @@ class QAbstractPrintDialogPrivate : public QDialogPrivate public: QAbstractPrintDialogPrivate() : printer(0), pd(0), ownsPrinter(false) + , options(QAbstractPrintDialog::PrintToFile | QAbstractPrintDialog::PrintPageRange | + QAbstractPrintDialog::PrintCollateCopies | QAbstractPrintDialog::PrintShowPageSize), + minPage(0), maxPage(INT_MAX) { } @@ -82,8 +85,12 @@ public: QPointer<QObject> receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; + QAbstractPrintDialog::PrintDialogOptions options; + virtual void setTabs(const QList<QWidget *> &) {} void setPrinter(QPrinter *newPrinter); + int minPage; + int maxPage; }; #endif //QT_NO_PRINTER diff --git a/src/gui/dialogs/qpagesetupdialog.cpp b/src/printsupport/dialogs/qpagesetupdialog.cpp similarity index 100% rename from src/gui/dialogs/qpagesetupdialog.cpp rename to src/printsupport/dialogs/qpagesetupdialog.cpp diff --git a/src/gui/dialogs/qpagesetupdialog.h b/src/printsupport/dialogs/qpagesetupdialog.h similarity index 96% rename from src/gui/dialogs/qpagesetupdialog.h rename to src/printsupport/dialogs/qpagesetupdialog.h index b1498d22d3b..1581ce6c418 100644 --- a/src/gui/dialogs/qpagesetupdialog.h +++ b/src/printsupport/dialogs/qpagesetupdialog.h @@ -42,7 +42,7 @@ #ifndef QPAGESETUPDIALOG_H #define QPAGESETUPDIALOG_H -#include <QtGui/qabstractpagesetupdialog.h> +#include <QtPrintSupport/qabstractpagesetupdialog.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QPageSetupDialogPrivate; -class Q_GUI_EXPORT QPageSetupDialog : public QAbstractPageSetupDialog +class Q_PRINTSUPPORT_EXPORT QPageSetupDialog : public QAbstractPageSetupDialog { Q_OBJECT Q_DECLARE_PRIVATE(QPageSetupDialog) diff --git a/src/gui/dialogs/qpagesetupdialog_mac.mm b/src/printsupport/dialogs/qpagesetupdialog_mac.mm similarity index 100% rename from src/gui/dialogs/qpagesetupdialog_mac.mm rename to src/printsupport/dialogs/qpagesetupdialog_mac.mm diff --git a/src/gui/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp similarity index 99% rename from src/gui/dialogs/qpagesetupdialog_unix.cpp rename to src/printsupport/dialogs/qpagesetupdialog_unix.cpp index 61a22981154..e5b12f8ba53 100644 --- a/src/gui/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -49,14 +49,14 @@ #include "qdialogbuttonbox.h" #include <ui_qpagesetupwidget.h> -#include <QtGui/qprinter.h> +#include <QtPrintSupport/qprinter.h> #include <private/qabstractpagesetupdialog_p.h> #include <private/qprinter_p.h> #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) # include <private/qcups_p.h> # include <cups/cups.h> -# include <private/qpdf_p.h> +# include <private/qprintengine_pdf_p.h> #endif @@ -367,7 +367,7 @@ void QPageSetupWidget::setupPrinter() const QRect paperRect = m_cups->paperRect(cupsPageSize); engine->setProperty(PPK_CupsPaperRect, paperRect); - for(ps = 0; ps < QPrinter::NPaperSize; ++ps) { + for(ps = 0; ps < QPrinter::NPageSize; ++ps) { QPdf::PaperSize size = QPdf::paperSize(QPrinter::PaperSize(ps)); if (size.width == paperRect.width() && size.height == paperRect.height()) break; diff --git a/src/gui/dialogs/qpagesetupdialog_unix_p.h b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h similarity index 100% rename from src/gui/dialogs/qpagesetupdialog_unix_p.h rename to src/printsupport/dialogs/qpagesetupdialog_unix_p.h diff --git a/src/gui/dialogs/qpagesetupdialog_win.cpp b/src/printsupport/dialogs/qpagesetupdialog_win.cpp similarity index 100% rename from src/gui/dialogs/qpagesetupdialog_win.cpp rename to src/printsupport/dialogs/qpagesetupdialog_win.cpp diff --git a/src/gui/dialogs/qpagesetupwidget.ui b/src/printsupport/dialogs/qpagesetupwidget.ui similarity index 100% rename from src/gui/dialogs/qpagesetupwidget.ui rename to src/printsupport/dialogs/qpagesetupwidget.ui diff --git a/src/gui/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h similarity index 96% rename from src/gui/dialogs/qprintdialog.h rename to src/printsupport/dialogs/qprintdialog.h index b1e30f04457..1b042632619 100644 --- a/src/gui/dialogs/qprintdialog.h +++ b/src/printsupport/dialogs/qprintdialog.h @@ -42,7 +42,7 @@ #ifndef QPRINTDIALOG_H #define QPRINTDIALOG_H -#include <QtGui/qabstractprintdialog.h> +#include <QtPrintSupport/qabstractprintdialog.h> QT_BEGIN_HEADER @@ -59,7 +59,7 @@ class QPrinter; #if defined (Q_OS_UNIX) && !defined(QTOPIA_PRINTDIALOG) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) class QUnixPrintWidgetPrivate; -class Q_GUI_EXPORT QUnixPrintWidget : public QWidget +class Q_PRINTSUPPORT_EXPORT QUnixPrintWidget : public QWidget { Q_OBJECT @@ -78,7 +78,7 @@ private: }; #endif -class Q_GUI_EXPORT QPrintDialog : public QAbstractPrintDialog +class Q_PRINTSUPPORT_EXPORT QPrintDialog : public QAbstractPrintDialog { Q_OBJECT Q_DECLARE_PRIVATE(QPrintDialog) diff --git a/src/gui/dialogs/qprintdialog.qdoc b/src/printsupport/dialogs/qprintdialog.qdoc similarity index 100% rename from src/gui/dialogs/qprintdialog.qdoc rename to src/printsupport/dialogs/qprintdialog.qdoc diff --git a/src/gui/dialogs/qprintdialog.qrc b/src/printsupport/dialogs/qprintdialog.qrc similarity index 100% rename from src/gui/dialogs/qprintdialog.qrc rename to src/printsupport/dialogs/qprintdialog.qrc diff --git a/src/gui/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm similarity index 100% rename from src/gui/dialogs/qprintdialog_mac.mm rename to src/printsupport/dialogs/qprintdialog_mac.mm diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp similarity index 94% rename from src/gui/dialogs/qprintdialog_unix.cpp rename to src/printsupport/dialogs/qprintdialog_unix.cpp index bb9b9306fd2..57baf767041 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -44,18 +44,18 @@ #ifndef QT_NO_PRINTDIALOG #include "private/qabstractprintdialog_p.h" -#include <QtGui/qmessagebox.h> +#include <QtWidgets/qmessagebox.h> #include "qprintdialog.h" #include "qfiledialog.h" #include <QtCore/qdir.h> #include <QtGui/qevent.h> -#include <QtGui/qfilesystemmodel.h> -#include <QtGui/qstyleditemdelegate.h> -#include <QtGui/qprinter.h> +#include <QtWidgets/qfilesystemmodel.h> +#include <QtWidgets/qstyleditemdelegate.h> +#include <QtPrintSupport/qprinter.h> -#include <QtGui/qdialogbuttonbox.h> +#include <QtWidgets/qdialogbuttonbox.h> -#include "qfscompleter_p.h" +#include "private/qfscompleter_p.h" #include "ui_qprintpropertieswidget.h" #include "ui_qprintsettingsoutput.h" #include "ui_qprintwidget.h" @@ -63,7 +63,7 @@ #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) # include <private/qcups_p.h> # include <cups/cups.h> -# include <private/qpdf_p.h> +# include <private/qprintengine_pdf_p.h> #else # include <QtCore/qlibrary.h> #endif @@ -726,7 +726,6 @@ void QUnixPrintWidgetPrivate::updateWidget() if (widget.printers->count()) widget.printers->insertSeparator(widget.printers->count()); widget.printers->addItem(QPrintDialog::tr("Print to File (PDF)")); - widget.printers->addItem(QPrintDialog::tr("Print to File (Postscript)")); filePrintersAdded = true; } if (!printToFile && filePrintersAdded) { @@ -740,8 +739,6 @@ void QUnixPrintWidgetPrivate::updateWidget() || printer->printerName().isEmpty())) { if (printer->outputFormat() == QPrinter::PdfFormat) - widget.printers->setCurrentIndex(widget.printers->count() - 2); - else if (printer->outputFormat() == QPrinter::PostScriptFormat) widget.printers->setCurrentIndex(widget.printers->count() - 1); widget.filename->setEnabled(true); widget.lOutput->setEnabled(true); @@ -771,19 +768,13 @@ void QUnixPrintWidgetPrivate::_q_printerChanged(int index) if (filePrintersAdded) { Q_ASSERT(index != printerCount - 3); // separator - if (index > printerCount - 3) { // PDF or postscript - bool pdfPrinter = (index == printerCount - 2); + if (index == printerCount - 1) { // PDF widget.location->setText(QPrintDialog::tr("Local file")); - widget.type->setText(QPrintDialog::tr("Write %1 file").arg(pdfPrinter ? QString::fromLatin1("PDF") - : QString::fromLatin1("PostScript"))); + widget.type->setText(QPrintDialog::tr("Write PDF file")); widget.properties->setEnabled(true); widget.filename->setEnabled(true); QString filename = widget.filename->text(); QString suffix = QFileInfo(filename).suffix(); - if (pdfPrinter && suffix == QLatin1String("ps")) - filename = filename.replace(QLatin1String(".ps"), QLatin1String(".pdf")); - if (!pdfPrinter && suffix == QLatin1String("pdf")) - filename = filename.replace(QLatin1String(".pdf"), QLatin1String(".ps")); widget.filename->setText(filename); widget.lOutput->setEnabled(true); if (propertiesDialog) @@ -852,12 +843,7 @@ void QUnixPrintWidgetPrivate::_q_btnBrowseClicked() #endif if (!filename.isEmpty()) { widget.filename->setText(filename); - if (filename.endsWith(QString::fromLatin1(".ps"), Qt::CaseInsensitive)) - widget.printers->setCurrentIndex(widget.printers->count() - 1); // the postscript one - else if (filename.endsWith(QString::fromLatin1(".pdf"), Qt::CaseInsensitive)) - widget.printers->setCurrentIndex(widget.printers->count() - 2); // the pdf one - else if (widget.printers->currentIndex() != widget.printers->count() - 1) // if ps is not selected, pdf is default - widget.printers->setCurrentIndex(widget.printers->count() - 2); // the pdf one + widget.printers->setCurrentIndex(widget.printers->count() - 1); // the pdf one } } @@ -877,20 +863,14 @@ void QUnixPrintWidgetPrivate::applyPrinterProperties(QPrinter *p) cur = home; #ifdef Q_WS_X11 if (p->docName().isEmpty()) { - if (p->outputFormat() == QPrinter::PostScriptFormat) - cur += QLatin1String("print.ps"); - else - cur += QLatin1String("print.pdf"); + cur += QLatin1String("print.pdf"); } else { QRegExp re(QString::fromLatin1("(.*)\\.\\S+")); if (re.exactMatch(p->docName())) cur += re.cap(1); else cur += p->docName(); - if (p->outputFormat() == QPrinter::PostScriptFormat) - cur += QLatin1String(".ps"); - else - cur += QLatin1String(".pdf"); + cur += QLatin1String(".pdf"); } #endif widget.filename->setText(cur); @@ -962,7 +942,7 @@ void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() propertiesDialog->applyPrinterProperties(q->printer()); if (q->isOptionEnabled(QPrintDialog::PrintToFile) - && (widget.printers->currentIndex() > widget.printers->count() - 3)) // PDF or postscript + && (widget.printers->currentIndex() == widget.printers->count() - 1)) // PDF propertiesDialog->selectPdfPsPrinter(q->printer()); else propertiesDialog->selectPrinter(); @@ -990,7 +970,7 @@ void QUnixPrintWidgetPrivate::setCupsProperties() QRect paperRect = cups->paperRect(cupsPageSize); engine->setProperty(PPK_CupsPaperRect, paperRect); - for (int ps = 0; ps < QPrinter::NPaperSize; ++ps) { + for (int ps = 0; ps < QPrinter::NPageSize; ++ps) { QPdf::PaperSize size = QPdf::paperSize(QPrinter::PaperSize(ps)); if (size.width == paperRect.width() && size.height == paperRect.height()) printer->setPaperSize(static_cast<QPrinter::PaperSize>(ps)); @@ -1004,13 +984,10 @@ void QUnixPrintWidgetPrivate::setupPrinter() const int printerCount = widget.printers->count(); const int index = widget.printers->currentIndex(); - if (filePrintersAdded && index > printerCount - 3) { // PDF or postscript + if (filePrintersAdded && index == printerCount - 1) { // PDF printer->setPrinterName(QString()); Q_ASSERT(index != printerCount - 3); // separator - if (index == printerCount - 2) - printer->setOutputFormat(QPrinter::PdfFormat); - else - printer->setOutputFormat(QPrinter::PostScriptFormat); + printer->setOutputFormat(QPrinter::PdfFormat); QString path = widget.filename->text(); if (QDir::isRelativePath(path)) path = QDir::homePath() + QDir::separator() + path; @@ -1303,7 +1280,9 @@ QT_END_NAMESPACE #include "moc_qprintdialog.cpp" #include "qprintdialog_unix.moc" +#ifndef Q_OS_MAC #include "qrc_qprintdialog.cpp" +#endif #endif // QT_NO_PRINTDIALOG diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/printsupport/dialogs/qprintdialog_win.cpp similarity index 100% rename from src/gui/dialogs/qprintdialog_win.cpp rename to src/printsupport/dialogs/qprintdialog_win.cpp diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp similarity index 98% rename from src/gui/dialogs/qprintpreviewdialog.cpp rename to src/printsupport/dialogs/qprintpreviewdialog.cpp index e65bfb5efc5..55ebc194f25 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp @@ -43,21 +43,22 @@ #include "qprintpreviewwidget.h" #include <private/qprinter_p.h> #include "private/qdialog_p.h" +#include "qprintdialog.h" -#include <QtGui/qaction.h> -#include <QtGui/qboxlayout.h> -#include <QtGui/qcombobox.h> -#include <QtGui/qlabel.h> -#include <QtGui/qlineedit.h> -#include <QtGui/qpagesetupdialog.h> -#include <QtGui/qprinter.h> -#include <QtGui/qstyle.h> -#include <QtGui/qtoolbutton.h> +#include <QtWidgets/qaction.h> +#include <QtWidgets/qboxlayout.h> +#include <QtWidgets/qcombobox.h> +#include <QtWidgets/qlabel.h> +#include <QtWidgets/qlineedit.h> +#include <QtPrintSupport/qpagesetupdialog.h> +#include <QtPrintSupport/qprinter.h> +#include <QtWidgets/qstyle.h> +#include <QtWidgets/qtoolbutton.h> #include <QtGui/qvalidator.h> -#include <QtGui/qfiledialog.h> -#include <QtGui/qmainwindow.h> -#include <QtGui/qtoolbar.h> -#include <QtGui/qformlayout.h> +#include <QtWidgets/qfiledialog.h> +#include <QtWidgets/qmainwindow.h> +#include <QtWidgets/qtoolbar.h> +#include <QtWidgets/qformlayout.h> #include <QtCore/QCoreApplication> #include <math.h> diff --git a/src/gui/dialogs/qprintpreviewdialog.h b/src/printsupport/dialogs/qprintpreviewdialog.h similarity index 96% rename from src/gui/dialogs/qprintpreviewdialog.h rename to src/printsupport/dialogs/qprintpreviewdialog.h index 144bee20896..f2997b09f5b 100644 --- a/src/gui/dialogs/qprintpreviewdialog.h +++ b/src/printsupport/dialogs/qprintpreviewdialog.h @@ -42,7 +42,7 @@ #ifndef QPRINTPREVIEWDIALOG_H #define QPRINTPREVIEWDIALOG_H -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> #ifndef QT_NO_PRINTPREVIEWDIALOG @@ -54,8 +54,9 @@ QT_MODULE(Gui) class QGraphicsView; class QPrintPreviewDialogPrivate; +class QPrinter; -class Q_GUI_EXPORT QPrintPreviewDialog : public QDialog +class Q_PRINTSUPPORT_EXPORT QPrintPreviewDialog : public QDialog { Q_OBJECT Q_DECLARE_PRIVATE(QPrintPreviewDialog) diff --git a/src/gui/dialogs/qprintpropertieswidget.ui b/src/printsupport/dialogs/qprintpropertieswidget.ui similarity index 100% rename from src/gui/dialogs/qprintpropertieswidget.ui rename to src/printsupport/dialogs/qprintpropertieswidget.ui diff --git a/src/gui/dialogs/qprintsettingsoutput.ui b/src/printsupport/dialogs/qprintsettingsoutput.ui similarity index 100% rename from src/gui/dialogs/qprintsettingsoutput.ui rename to src/printsupport/dialogs/qprintsettingsoutput.ui diff --git a/src/gui/dialogs/qprintwidget.ui b/src/printsupport/dialogs/qprintwidget.ui similarity index 100% rename from src/gui/dialogs/qprintwidget.ui rename to src/printsupport/dialogs/qprintwidget.ui diff --git a/src/printsupport/kernel/kernel.pri b/src/printsupport/kernel/kernel.pri new file mode 100644 index 00000000000..3868d9e2128 --- /dev/null +++ b/src/printsupport/kernel/kernel.pri @@ -0,0 +1,34 @@ +HEADERS += \ + $$PWD/qpaintengine_alpha_p.h \ + $$PWD/qpaintengine_preview_p.h \ + $$PWD/qprintengine.h \ + $$PWD/qprinter.h \ + $$PWD/qprinter_p.h \ + $$PWD/qprinterinfo.h \ + $$PWD/qprinterinfo_p.h \ + $$PWD/qplatformprintplugin_qpa.h \ + $$PWD/qplatformprintersupport_qpa.h + +SOURCES += \ + $$PWD/qpaintengine_alpha.cpp \ + $$PWD/qpaintengine_preview.cpp \ + $$PWD/qprintengine_pdf.cpp \ + $$PWD/qprinter.cpp \ + $$PWD/qprinterinfo.cpp \ + $$PWD/qplatformprintplugin.cpp \ + $$PWD/qplatformprintersupport_qpa.cpp + +unix:!symbian { + HEADERS += \ + $$PWD/qprinterinfo_unix_p.h + SOURCES += \ + $$PWD/qprinterinfo_unix.cpp +} + + +x11|qpa:!win32 { + SOURCES += $$PWD/qcups.cpp + HEADERS += $$PWD/qcups_p.h +} else { + DEFINES += QT_NO_CUPS QT_NO_LPR +} diff --git a/src/gui/painting/qcups.cpp b/src/printsupport/kernel/qcups.cpp similarity index 89% rename from src/gui/painting/qcups.cpp rename to src/printsupport/kernel/qcups.cpp index 3ec5f72395e..76050d9d71e 100644 --- a/src/gui/painting/qcups.cpp +++ b/src/printsupport/kernel/qcups.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include <qdebug.h> #include "qcups_p.h" +#include "qprinterinfo_unix_p.h" #ifndef QT_NO_CUPS @@ -396,6 +397,50 @@ int QCUPSSupport::printFile(const char * printerName, const char * filename, con return _cupsPrintFile(printerName, filename, title, num_options, options); } +QCUPSSupport::Printer::Printer(const QString &n) : name(n), isDefault(false), cupsPrinterIndex(-1) +{ +} + +QList<QCUPSSupport::Printer> QCUPSSupport::availableUnixPrinters() +{ + QList<Printer> printers; + +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + if (QCUPSSupport::isAvailable()) { + QCUPSSupport cups; + int cupsPrinterCount = cups.availablePrintersCount(); + const cups_dest_t* cupsPrinters = cups.availablePrinters(); + for (int i = 0; i < cupsPrinterCount; ++i) { + QString printerName(QString::fromLocal8Bit(cupsPrinters[i].name)); + if (cupsPrinters[i].instance) + printerName += QLatin1Char('/') + QString::fromLocal8Bit(cupsPrinters[i].instance); + + Printer p(printerName); + if (cupsPrinters[i].is_default) + p.isDefault = true; + p.cupsPrinterIndex = i; + printers.append(p); + } + } else +#endif + { + QList<QPrinterDescription> lprPrinters; + int defprn = qt_getLprPrinters(lprPrinters); + // populating printer combo + foreach (const QPrinterDescription &description, lprPrinters) + printers.append(Printer(description.name)); + if (defprn >= 0 && defprn < printers.size()) + printers[defprn].isDefault = true; + } + + return printers; +} + +QList<QPrinter::PaperSize> QCUPSSupport::getCupsPrinterPaperSizes(int cupsPrinterIndex) +{ + return qt_getCupsPrinterPaperSizes(cupsPrinterIndex); +} + QT_END_NAMESPACE #endif // QT_NO_CUPS diff --git a/src/gui/painting/qcups_p.h b/src/printsupport/kernel/qcups_p.h similarity index 90% rename from src/gui/painting/qcups_p.h rename to src/printsupport/kernel/qcups_p.h index 47ed7e14ef9..cb7a79e4868 100644 --- a/src/gui/painting/qcups_p.h +++ b/src/printsupport/kernel/qcups_p.h @@ -54,7 +54,8 @@ // #include "QtCore/qstring.h" #include "QtCore/qstringlist.h" -#include "QtGui/qprinter.h" +#include "QtCore/qpair.h" +#include "QtPrintSupport/qprinter.h" #ifndef QT_NO_CUPS #include <QtCore/qlibrary.h> @@ -65,9 +66,17 @@ QT_BEGIN_NAMESPACE Q_DECLARE_TYPEINFO(cups_option_t, Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE); -class QCUPSSupport +class Q_PRINTSUPPORT_EXPORT QCUPSSupport { public: + struct Printer + { + Printer(const QString &name = QString()); + + QString name; + bool isDefault; + int cupsPrinterIndex; + }; QCUPSSupport(); ~QCUPSSupport(); @@ -100,6 +109,9 @@ public: int printFile(const char * printerName, const char * filename, const char * title, int num_options, cups_option_t * options); + static QList<Printer> availableUnixPrinters(); + static QList<QPrinter::PaperSize> getCupsPrinterPaperSizes(int cupsPrinterIndex); + private: void collectMarkedOptions(QStringList& list, const ppd_group_t* group = 0) const; void collectMarkedOptionsHelper(QStringList& list, const ppd_group_t* group) const; diff --git a/src/gui/painting/qpaintengine_alpha.cpp b/src/printsupport/kernel/qpaintengine_alpha.cpp similarity index 100% rename from src/gui/painting/qpaintengine_alpha.cpp rename to src/printsupport/kernel/qpaintengine_alpha.cpp diff --git a/src/gui/painting/qpaintengine_alpha_p.h b/src/printsupport/kernel/qpaintengine_alpha_p.h similarity index 100% rename from src/gui/painting/qpaintengine_alpha_p.h rename to src/printsupport/kernel/qpaintengine_alpha_p.h diff --git a/src/gui/painting/qpaintengine_preview.cpp b/src/printsupport/kernel/qpaintengine_preview.cpp similarity index 99% rename from src/gui/painting/qpaintengine_preview.cpp rename to src/printsupport/kernel/qpaintengine_preview.cpp index d3b77565164..3cf06f5770b 100644 --- a/src/gui/painting/qpaintengine_preview.cpp +++ b/src/printsupport/kernel/qpaintengine_preview.cpp @@ -44,7 +44,7 @@ #include <private/qpaintengine_p.h> #include <private/qpicture_p.h> -#include <QtGui/qprintengine.h> +#include <QtPrintSupport/qprintengine.h> #include <QtGui/qpainter.h> #include <QtGui/qpicture.h> diff --git a/src/gui/painting/qpaintengine_preview_p.h b/src/printsupport/kernel/qpaintengine_preview_p.h similarity index 98% rename from src/gui/painting/qpaintengine_preview_p.h rename to src/printsupport/kernel/qpaintengine_preview_p.h index 902a03bd8f1..c2e11313c2a 100644 --- a/src/gui/painting/qpaintengine_preview_p.h +++ b/src/printsupport/kernel/qpaintengine_preview_p.h @@ -55,7 +55,7 @@ // #include <QtGui/qpaintengine.h> -#include <QtGui/qprintengine.h> +#include <QtPrintSupport/qprintengine.h> #ifndef QT_NO_PRINTPREVIEWWIDGET diff --git a/src/printsupport/kernel/qplatformprintersupport_qpa.cpp b/src/printsupport/kernel/qplatformprintersupport_qpa.cpp new file mode 100644 index 00000000000..3c11b3304c0 --- /dev/null +++ b/src/printsupport/kernel/qplatformprintersupport_qpa.cpp @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformprintersupport_qpa.h" + +#include <QtPrintSupport/qprinterinfo.h> + +#include <private/qprinterinfo_p.h> + +#ifndef QT_NO_PRINTER + +QT_BEGIN_NAMESPACE + +QPlatformPrinterSupport::QPlatformPrinterSupport() +{ +} + +QPlatformPrinterSupport::~QPlatformPrinterSupport() +{ +} + +QPrintEngine *QPlatformPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode) +{ + return 0; +} + +QPaintEngine *QPlatformPrinterSupport::createPaintEngine(QPrintEngine *, QPrinter::PrinterMode) +{ + return 0; +} + +QList<QPrinter::PaperSize> QPlatformPrinterSupport::supportedPaperSizes(const QPrinterInfo &) const +{ + return QList<QPrinter::PaperSize>(); +} + +QList<QPrinterInfo> QPlatformPrinterSupport::availablePrinters() +{ + return QList<QPrinterInfo>(); +} + +QPrinterInfo QPlatformPrinterSupport::defaultPrinter() +{ + const QList<QPrinterInfo> printers = availablePrinters(); + foreach (const QPrinterInfo &printerInfo, printers) { + if (printerInfo.isDefault()) + return printerInfo; + } + return printers.isEmpty() ? QPrinterInfo() : printers.front(); +} + +QPrinterInfo QPlatformPrinterSupport::printerInfo(const QString &printerName, bool isDefault) +{ + QPrinterInfo pi = QPrinterInfo(printerName); + pi.d_func()->isDefault = isDefault; + return pi; +} + +void QPlatformPrinterSupport::setPrinterInfoDefault(QPrinterInfo *p, bool isDefault) +{ + p->d_func()->isDefault = isDefault; +} + +bool QPlatformPrinterSupport::printerInfoIsDefault(const QPrinterInfo &p) +{ + return p.d_func()->isDefault; +} + +int QPlatformPrinterSupport::printerInfoCupsPrinterIndex(const QPrinterInfo &p) +{ + int i = -1; +#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN)) || defined(Q_WS_QPA) +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + if (!p.isNull()) + return i = p.d_func()->cupsPrinterIndex; +#endif +#endif + Q_UNUSED(p) + return i; +} + +void QPlatformPrinterSupport::setPrinterInfoCupsPrinterIndex(QPrinterInfo *p, int index) +{ +#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN)) || defined(Q_WS_QPA) +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + p->d_func()->cupsPrinterIndex = index; +#endif +#endif + Q_UNUSED(p) + Q_UNUSED(index) +} + +QT_END_NAMESPACE + +#endif // QT_NO_PRINTER diff --git a/src/gui/embedded/qmouselinuxtp_qws.h b/src/printsupport/kernel/qplatformprintersupport_qpa.h similarity index 63% rename from src/gui/embedded/qmouselinuxtp_qws.h rename to src/printsupport/kernel/qplatformprintersupport_qpa.h index cef47449d51..800713c5bbb 100644 --- a/src/gui/embedded/qmouselinuxtp_qws.h +++ b/src/printsupport/kernel/qplatformprintersupport_qpa.h @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#ifndef QMOUSELINUXTP_QWS_H -#define QMOUSELINUXTP_QWS_H +#ifndef QPLATFORMPRINTINGSUPPORT_H +#define QPLATFORMPRINTINGSUPPORT_H -#include <QtGui/qmouse_qws.h> +#include <QtPrintSupport/qprinter.h> QT_BEGIN_HEADER @@ -50,28 +50,35 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifndef QT_NO_QWS_MOUSE_LINUXTP +#ifndef QT_NO_PRINTER -class QWSLinuxTPMouseHandlerPrivate; +class QPrintEngine; -class QWSLinuxTPMouseHandler : public QWSCalibratedMouseHandler +class Q_PRINTSUPPORT_EXPORT QPlatformPrinterSupport { - friend class QWSLinuxTPMouseHandlerPrivate; public: - explicit QWSLinuxTPMouseHandler(const QString & = QString(), - const QString & = QString()); - ~QWSLinuxTPMouseHandler(); + QPlatformPrinterSupport(); + virtual ~QPlatformPrinterSupport(); + + virtual QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode); + virtual QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode); + virtual QList<QPrinter::PaperSize> supportedPaperSizes(const QPrinterInfo &) const; + + virtual QList<QPrinterInfo> availablePrinters(); + virtual QPrinterInfo defaultPrinter(); - void suspend(); - void resume(); protected: - QWSLinuxTPMouseHandlerPrivate *d; + static QPrinterInfo printerInfo(const QString &printerName, bool isDefault = false); + static void setPrinterInfoDefault(QPrinterInfo *p, bool isDefault); + static bool printerInfoIsDefault(const QPrinterInfo &p); + static int printerInfoCupsPrinterIndex(const QPrinterInfo &p); + static void setPrinterInfoCupsPrinterIndex(QPrinterInfo *p, int index); }; -#endif // QT_NO_QWS_MOUSE_LINUXTP +#endif // QT_NO_PRINTER QT_END_NAMESPACE QT_END_HEADER -#endif // QMOUSELINUXTP_QWS_H +#endif // QPLATFORMPRINTINGSUPPORT_H diff --git a/src/gui/widgets/qmenudata.cpp b/src/printsupport/kernel/qplatformprintplugin.cpp similarity index 69% rename from src/gui/widgets/qmenudata.cpp rename to src/printsupport/kernel/qplatformprintplugin.cpp index 595763aed17..8b3c75127e1 100644 --- a/src/gui/widgets/qmenudata.cpp +++ b/src/printsupport/kernel/qplatformprintplugin.cpp @@ -38,59 +38,35 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "qmenudata.h" -#ifdef QT3_SUPPORT -#include <qaction.h> -#include <private/qaction_p.h> +#include "qplatformprintplugin_qpa.h" +#include "private/qfactoryloader_p.h" QT_BEGIN_NAMESPACE -/*! - \class QMenuItem - \brief The QMenuItem class represents an item in a menu. +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QPlatformPrinterSupportFactoryInterface_iid, QLatin1String("/printsupport"), Qt::CaseInsensitive)) +#endif - \compat - - Use QAction instead. -*/ - -/*! - \compat - Constructs a new menu item. -*/ -QMenuItem::QMenuItem() : QAction((QWidget*)0) +QPlatformPrinterSupportPlugin::QPlatformPrinterSupportPlugin(QObject *parent) + : QObject(parent) { } -void QMenuItem::setId(int id) +QPlatformPrinterSupportPlugin::~QPlatformPrinterSupportPlugin() { - d_func()->param = d_func()->id = id; } -/*! - \compat - Returns the menu item's ID. -*/ -int QMenuItem::id() const +QPlatformPrinterSupport *QPlatformPrinterSupportPlugin::get() { - return d_func()->id; -} - -void QMenuItem::setSignalValue(int param) -{ - d_func()->param = param; -} - -/*! - \compat - Returns the signal value for the menu item. -*/ -int QMenuItem::signalValue() const -{ - return d_func()->param; + QStringList k = loader()->keys(); + if (k.isEmpty()) + return 0; + QPlatformPrinterSupportPlugin *plugin = qobject_cast<QPlatformPrinterSupportPlugin *>(loader()->instance(k.first())); + if (!plugin) + return 0; + return plugin->create(k.first()); } QT_END_NAMESPACE - -#endif diff --git a/src/printsupport/kernel/qplatformprintplugin_qpa.h b/src/printsupport/kernel/qplatformprintplugin_qpa.h new file mode 100644 index 00000000000..831a0546b0f --- /dev/null +++ b/src/printsupport/kernel/qplatformprintplugin_qpa.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMPRINTERSUPPORTPLUGIN_H +#define QPLATFORMPRINTERSUPPORTPLUGIN_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 <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QPlatformPrinterSupport; + +struct QPlatformPrinterSupportFactoryInterface : public QFactoryInterface +{ + virtual QPlatformPrinterSupport *create(const QString &key) = 0; +}; + +#define QPlatformPrinterSupportFactoryInterface_iid "org.qt-project.QPlatformPrinterSupportFactoryInterface" + +Q_DECLARE_INTERFACE(QPlatformPrinterSupportFactoryInterface, QPlatformPrinterSupportFactoryInterface_iid) + +class Q_PRINTSUPPORT_EXPORT QPlatformPrinterSupportPlugin : public QObject, public QPlatformPrinterSupportFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QPlatformPrinterSupportFactoryInterface:QFactoryInterface) +public: + explicit QPlatformPrinterSupportPlugin(QObject *parent = 0); + ~QPlatformPrinterSupportPlugin(); + + virtual QStringList keys() const = 0; + virtual QPlatformPrinterSupport *create(const QString &key) = 0; + + static QPlatformPrinterSupport *get(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMPRINTERSUPPORTPLUGIN_H diff --git a/src/gui/painting/qprintengine.h b/src/printsupport/kernel/qprintengine.h similarity index 97% rename from src/gui/painting/qprintengine.h rename to src/printsupport/kernel/qprintengine.h index da4fe2ac684..782b6ef8bd5 100644 --- a/src/gui/painting/qprintengine.h +++ b/src/printsupport/kernel/qprintengine.h @@ -43,7 +43,7 @@ #define QPRINTENGINE_H #include <QtCore/qvariant.h> -#include <QtGui/qprinter.h> +#include <QtPrintSupport/qprinter.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) #ifndef QT_NO_PRINTER -class Q_GUI_EXPORT QPrintEngine +class Q_PRINTSUPPORT_EXPORT QPrintEngine { public: virtual ~QPrintEngine() {} diff --git a/src/printsupport/kernel/qprintengine_pdf.cpp b/src/printsupport/kernel/qprintengine_pdf.cpp new file mode 100644 index 00000000000..c8ce2cfa0f7 --- /dev/null +++ b/src/printsupport/kernel/qprintengine_pdf.cpp @@ -0,0 +1,666 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtPrintSupport/qprintengine.h> + +#include <qiodevice.h> +#include <qfile.h> +#include <qdebug.h> +#include <qbuffer.h> +#include "private/qcups_p.h" +#include "qprinterinfo.h" + +#ifndef QT_NO_PRINTER +#include <limits.h> +#include <math.h> + +#include "qprintengine_pdf_p.h" + +#ifdef Q_OS_UNIX +#include "private/qcore_unix_p.h" // overrides QT_OPEN +#endif + +#ifdef Q_OS_WIN +#include <io.h> // _close. +#endif + +QT_BEGIN_NAMESPACE + +//#define FONT_DUMP + +extern QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size); + +#define Q_MM(n) int((n * 720 + 127) / 254) +#define Q_IN(n) int(n * 72) + +static const char * const psToStr[QPrinter::NPageSize+1] = +{ + "A4", "B5", "Letter", "Legal", "Executive", + "A0", "A1", "A2", "A3", "A5", "A6", "A7", "A8", "A9", "B0", "B1", + "B10", "B2", "B3", "B4", "B6", "B7", "B8", "B9", "C5E", "Comm10E", + "DLE", "Folio", "Ledger", "Tabloid", 0 +}; + +QPdf::PaperSize QPdf::paperSize(QPrinter::PaperSize paperSize) +{ + QSizeF s = qt_paperSizeToQSizeF(paperSize); + PaperSize p = { Q_MM(s.width()), Q_MM(s.height()) }; + return p; +} + +const char *QPdf::paperSizeToString(QPrinter::PaperSize paperSize) +{ + return psToStr[paperSize]; +} + + +QPdfPrintEngine::QPdfPrintEngine(QPrinter::PrinterMode m) + : QPdfEngine(*new QPdfPrintEnginePrivate(m)) +{ + Q_D(QPdfPrintEngine); +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + if (QCUPSSupport::isAvailable()) { + QCUPSSupport cups; + const cups_dest_t* printers = cups.availablePrinters(); + int prnCount = cups.availablePrintersCount(); + + for (int i = 0; i < prnCount; ++i) { + if (printers[i].is_default) { + d->printerName = QString::fromLocal8Bit(printers[i].name); + break; + } + } + + } else +#endif + { + d->printerName = QString::fromLocal8Bit(qgetenv("PRINTER")); + if (d->printerName.isEmpty()) + d->printerName = QString::fromLocal8Bit(qgetenv("LPDEST")); + if (d->printerName.isEmpty()) + d->printerName = QString::fromLocal8Bit(qgetenv("NPRINTER")); + if (d->printerName.isEmpty()) + d->printerName = QString::fromLocal8Bit(qgetenv("NGPRINTER")); + } + + state = QPrinter::Idle; +} + +QPdfPrintEngine::~QPdfPrintEngine() +{ +} + +bool QPdfPrintEngine::begin(QPaintDevice *pdev) +{ + Q_D(QPdfPrintEngine); + + if (!d->openPrintDevice()) { + state = QPrinter::Error; + return false; + } + state = QPrinter::Active; + + return QPdfEngine::begin(pdev); +} + +bool QPdfPrintEngine::end() +{ + Q_D(QPdfPrintEngine); + + QPdfEngine::end(); + + d->closePrintDevice(); + state = QPrinter::Idle; + + return true; +} + +bool QPdfPrintEngine::newPage() +{ + return QPdfEngine::newPage(); +} + +int QPdfPrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const +{ + return QPdfEngine::metric(m); +} + +void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value) +{ + Q_D(QPdfPrintEngine); + + switch (int(key)) { + case PPK_CollateCopies: + d->collate = value.toBool(); + break; + case PPK_ColorMode: + d->grayscale = (QPrinter::ColorMode(value.toInt()) == QPrinter::GrayScale); + break; + case PPK_Creator: + d->creator = value.toString(); + break; + case PPK_DocumentName: + d->title = value.toString(); + break; + case PPK_FullPage: + d->fullPage = value.toBool(); + break; + case PPK_CopyCount: // fallthrough + case PPK_NumberOfCopies: + d->copies = value.toInt(); + break; + case PPK_Orientation: + d->landscape = (QPrinter::Orientation(value.toInt()) == QPrinter::Landscape); + break; + case PPK_OutputFileName: + d->outputFileName = value.toString(); + break; + case PPK_PageOrder: + d->pageOrder = QPrinter::PageOrder(value.toInt()); + break; + case PPK_PaperSize: + d->printerPaperSize = QPrinter::PaperSize(value.toInt()); + d->updatePaperSize(); + break; + case PPK_PaperSource: + d->paperSource = QPrinter::PaperSource(value.toInt()); + break; + case PPK_PrinterName: + d->printerName = value.toString(); + break; + case PPK_PrinterProgram: + d->printProgram = value.toString(); + break; + case PPK_Resolution: + d->resolution = value.toInt(); + break; + case PPK_SelectionOption: + d->selectionOption = value.toString(); + break; + case PPK_FontEmbedding: + d->embedFonts = value.toBool(); + break; + case PPK_Duplex: + d->duplex = static_cast<QPrinter::DuplexMode> (value.toInt()); + break; + case PPK_CupsPageRect: + d->cupsPageRect = value.toRect(); + break; + case PPK_CupsPaperRect: + d->cupsPaperRect = value.toRect(); + break; + case PPK_CupsOptions: + d->cupsOptions = value.toStringList(); + break; + case PPK_CupsStringPageSize: + d->cupsStringPageSize = value.toString(); + break; + case PPK_CustomPaperSize: + d->printerPaperSize = QPrinter::Custom; + d->customPaperSize = value.toSizeF(); + d->updatePaperSize(); + break; + case PPK_PageMargins: + { + QList<QVariant> margins(value.toList()); + Q_ASSERT(margins.size() == 4); + d->leftMargin = margins.at(0).toReal(); + d->topMargin = margins.at(1).toReal(); + d->rightMargin = margins.at(2).toReal(); + d->bottomMargin = margins.at(3).toReal(); + break; + } + default: + break; + } +} + +QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const +{ + Q_D(const QPdfPrintEngine); + + QVariant ret; + switch (int(key)) { + case PPK_CollateCopies: + ret = d->collate; + break; + case PPK_ColorMode: + ret = d->grayscale ? QPrinter::GrayScale : QPrinter::Color; + break; + case PPK_Creator: + ret = d->creator; + break; + case PPK_DocumentName: + ret = d->title; + break; + case PPK_FullPage: + ret = d->fullPage; + break; + case PPK_CopyCount: + ret = d->copies; + break; + case PPK_SupportsMultipleCopies: +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + if (QCUPSSupport::isAvailable()) + ret = true; + else +#endif + ret = false; + break; + case PPK_NumberOfCopies: +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + if (QCUPSSupport::isAvailable()) + ret = 1; + else +#endif + ret = d->copies; + break; + case PPK_Orientation: + ret = d->landscape ? QPrinter::Landscape : QPrinter::Portrait; + break; + case PPK_OutputFileName: + ret = d->outputFileName; + break; + case PPK_PageOrder: + ret = d->pageOrder; + break; + case PPK_PaperSize: + ret = d->paperSize; + break; + case PPK_PaperSource: + ret = d->paperSource; + break; + case PPK_PrinterName: + ret = d->printerName; + break; + case PPK_PrinterProgram: + ret = d->printProgram; + break; + case PPK_Resolution: + ret = d->resolution; + break; + case PPK_SupportedResolutions: + ret = QList<QVariant>() << 72; + break; + case PPK_PaperRect: + ret = d->paperRect(); + break; + case PPK_PageRect: + ret = d->pageRect(); + break; + case PPK_SelectionOption: + ret = d->selectionOption; + break; + case PPK_FontEmbedding: + ret = d->embedFonts; + break; + case PPK_Duplex: + ret = d->duplex; + break; + case PPK_CupsPageRect: + ret = d->cupsPageRect; + break; + case PPK_CupsPaperRect: + ret = d->cupsPaperRect; + break; + case PPK_CupsOptions: + ret = d->cupsOptions; + break; + case PPK_CupsStringPageSize: + ret = d->cupsStringPageSize; + break; + case PPK_CustomPaperSize: + ret = d->customPaperSize; + break; + case PPK_PageMargins: + { + QList<QVariant> margins; + margins << d->leftMargin << d->topMargin + << d->rightMargin << d->bottomMargin; + ret = margins; + break; + } + default: + break; + } + return ret; +} + + +#ifndef QT_NO_LPR +static void closeAllOpenFds() +{ + // hack time... getting the maximum number of open + // files, if possible. if not we assume it's the + // larger of 256 and the fd we got + int i; +#if defined(_SC_OPEN_MAX) + i = (int)sysconf(_SC_OPEN_MAX); +#elif defined(_POSIX_OPEN_MAX) + i = (int)_POSIX_OPEN_MAX; +#elif defined(OPEN_MAX) + i = (int)OPEN_MAX; +#else + i = 256; +#endif + // leave stdin/out/err untouched + while(--i > 2) + QT_CLOSE(i); +} +#endif + +bool QPdfPrintEnginePrivate::openPrintDevice() +{ + if (outDevice) + return false; + + if (!outputFileName.isEmpty()) { + QFile *file = new QFile(outputFileName); + if (! file->open(QFile::WriteOnly|QFile::Truncate)) { + delete file; + return false; + } + outDevice = file; +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + } else if (QCUPSSupport::isAvailable()) { + QCUPSSupport cups; + QPair<int, QString> ret = cups.tempFd(); + if (ret.first < 0) { + qWarning("QPdfPrinter: Could not open temporary file to print"); + return false; + } + cupsTempFile = ret.second; + outDevice = new QFile(); + static_cast<QFile *>(outDevice)->open(ret.first, QIODevice::WriteOnly); +#endif +#ifndef QT_NO_LPR + } else { + QString pr; + if (!printerName.isEmpty()) + pr = printerName; + int fds[2]; + if (qt_safe_pipe(fds) != 0) { + qWarning("QPdfPrinter: Could not open pipe to print"); + return false; + } + + pid_t pid = fork(); + if (pid == 0) { // child process + // if possible, exit quickly, so the actual lp/lpr + // becomes a child of init, and ::waitpid() is + // guaranteed not to wait. + if (fork() > 0) { + closeAllOpenFds(); + + // try to replace this process with "true" - this prevents + // global destructors from being called (that could possibly + // do wrong things to the parent process) + (void)execlp("true", "true", (char *)0); + (void)execl("/bin/true", "true", (char *)0); + (void)execl("/usr/bin/true", "true", (char *)0); + ::_exit(0); + } + qt_safe_dup2(fds[0], 0, 0); + + closeAllOpenFds(); + + if (!printProgram.isEmpty()) { + if (!selectionOption.isEmpty()) + pr.prepend(selectionOption); + else + pr.prepend(QLatin1String("-P")); + (void)execlp(printProgram.toLocal8Bit().data(), printProgram.toLocal8Bit().data(), + pr.toLocal8Bit().data(), (char *)0); + } else { + // if no print program has been specified, be smart + // about the option string too. + QList<QByteArray> lprhack; + QList<QByteArray> lphack; + QByteArray media; + if (!pr.isEmpty() || !selectionOption.isEmpty()) { + if (!selectionOption.isEmpty()) { + QStringList list = selectionOption.split(QLatin1Char(' ')); + for (int i = 0; i < list.size(); ++i) + lprhack.append(list.at(i).toLocal8Bit()); + lphack = lprhack; + } else { + lprhack.append("-P"); + lphack.append("-d"); + } + lprhack.append(pr.toLocal8Bit()); + lphack.append(pr.toLocal8Bit()); + } + lphack.append("-s"); + + char ** lpargs = new char *[lphack.size()+6]; + char lp[] = "lp"; + lpargs[0] = lp; + int i; + for (i = 0; i < lphack.size(); ++i) + lpargs[i+1] = (char *)lphack.at(i).constData(); +#ifndef Q_OS_OSF + if (QPdf::paperSizeToString(printerPaperSize)) { + char dash_o[] = "-o"; + lpargs[++i] = dash_o; + lpargs[++i] = const_cast<char *>(QPdf::paperSizeToString(printerPaperSize)); + lpargs[++i] = dash_o; + media = "media="; + media += QPdf::paperSizeToString(printerPaperSize); + lpargs[++i] = media.data(); + } +#endif + lpargs[++i] = 0; + char **lprargs = new char *[lprhack.size()+2]; + char lpr[] = "lpr"; + lprargs[0] = lpr; + for (int i = 0; i < lprhack.size(); ++i) + lprargs[i+1] = (char *)lprhack[i].constData(); + lprargs[lprhack.size() + 1] = 0; + (void)execvp("lp", lpargs); + (void)execvp("lpr", lprargs); + (void)execv("/bin/lp", lpargs); + (void)execv("/bin/lpr", lprargs); + (void)execv("/usr/bin/lp", lpargs); + (void)execv("/usr/bin/lpr", lprargs); + + delete []lpargs; + delete []lprargs; + } + // if we couldn't exec anything, close the fd, + // wait for a second so the parent process (the + // child of the GUI process) has exited. then + // exit. + QT_CLOSE(0); + (void)::sleep(1); + ::_exit(0); + } + // parent process + QT_CLOSE(fds[0]); + fd = fds[1]; + (void)qt_safe_waitpid(pid, 0, 0); + + if (fd < 0) + return false; + + outDevice = new QFile(); + static_cast<QFile *>(outDevice)->open(fd, QIODevice::WriteOnly); +#endif + } + + return true; +} + +void QPdfPrintEnginePrivate::closePrintDevice() +{ + if (outDevice) { + outDevice->close(); + if (fd >= 0) + #if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400 + ::_close(fd); + #else + ::close(fd); + #endif + fd = -1; + delete outDevice; + outDevice = 0; + } + +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + if (!cupsTempFile.isEmpty()) { + QString tempFile = cupsTempFile; + cupsTempFile.clear(); + QCUPSSupport cups; + + // Set up print options. + QByteArray prnName; + QList<QPair<QByteArray, QByteArray> > options; + QVector<cups_option_t> cupsOptStruct; + + if (!printerName.isEmpty()) { + prnName = printerName.toLocal8Bit(); + } else { + QPrinterInfo def = QPrinterInfo::defaultPrinter(); + if (def.isNull()) { + qWarning("Could not determine printer to print to"); + QFile::remove(tempFile); + return; + } + prnName = def.printerName().toLocal8Bit(); + } + + if (!cupsStringPageSize.isEmpty()) { + options.append(QPair<QByteArray, QByteArray>("media", cupsStringPageSize.toLocal8Bit())); + } + + if (copies > 1) { + options.append(QPair<QByteArray, QByteArray>("copies", QString::number(copies).toLocal8Bit())); + } + + if (collate) { + options.append(QPair<QByteArray, QByteArray>("Collate", "True")); + } + + if (duplex != QPrinter::DuplexNone) { + switch(duplex) { + case QPrinter::DuplexNone: break; + case QPrinter::DuplexAuto: + if (!landscape) + options.append(QPair<QByteArray, QByteArray>("sides", "two-sided-long-edge")); + else + options.append(QPair<QByteArray, QByteArray>("sides", "two-sided-short-edge")); + break; + case QPrinter::DuplexLongSide: + options.append(QPair<QByteArray, QByteArray>("sides", "two-sided-long-edge")); + break; + case QPrinter::DuplexShortSide: + options.append(QPair<QByteArray, QByteArray>("sides", "two-sided-short-edge")); + break; + } + } + + if (QCUPSSupport::cupsVersion() >= 10300 && landscape) { + options.append(QPair<QByteArray, QByteArray>("landscape", "")); + } + + QStringList::const_iterator it = cupsOptions.constBegin(); + while (it != cupsOptions.constEnd()) { + options.append(QPair<QByteArray, QByteArray>((*it).toLocal8Bit(), (*(it+1)).toLocal8Bit())); + it += 2; + } + + for (int c = 0; c < options.size(); ++c) { + cups_option_t opt; + opt.name = options[c].first.data(); + opt.value = options[c].second.data(); + cupsOptStruct.append(opt); + } + + // Print the file. + cups_option_t* optPtr = cupsOptStruct.size() ? &cupsOptStruct.first() : 0; + cups.printFile(prnName.constData(), tempFile.toLocal8Bit().constData(), + title.toLocal8Bit().constData(), cupsOptStruct.size(), optPtr); + + QFile::remove(tempFile); + } +#endif +} + + + +QPdfPrintEnginePrivate::QPdfPrintEnginePrivate(QPrinter::PrinterMode m) + : QPdfEnginePrivate(), + duplex(QPrinter::DuplexNone), + collate(false), + copies(1), + pageOrder(QPrinter::FirstPageFirst), + paperSource(QPrinter::Auto), + printerPaperSize(QPrinter::A4), + fd(-1) +{ + resolution = 72; + if (m == QPrinter::HighResolution) + resolution = 1200; + else if (m == QPrinter::ScreenResolution) + resolution = qt_defaultDpi(); +} + +QPdfPrintEnginePrivate::~QPdfPrintEnginePrivate() +{ +} + + +void QPdfPrintEnginePrivate::updatePaperSize() +{ + if (printerPaperSize == QPrinter::Custom) { + paperSize = customPaperSize; + } else if (!cupsPaperRect.isNull()) { + QRect r = cupsPaperRect; + paperSize = r.size(); + } else{ + QPdf::PaperSize s = QPdf::paperSize(printerPaperSize); + paperSize = QSize(s.width, s.height); + } +} + + +QT_END_NAMESPACE + +#endif // QT_NO_PRINTER diff --git a/src/gui/painting/qprintengine_pdf_p.h b/src/printsupport/kernel/qprintengine_pdf_p.h similarity index 51% rename from src/gui/painting/qprintengine_pdf_p.h rename to src/printsupport/kernel/qprintengine_pdf_p.h index ee77e1599c0..483cde9af99 100644 --- a/src/gui/painting/qprintengine_pdf_p.h +++ b/src/printsupport/kernel/qprintengine_pdf_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include "QtGui/qprintengine.h" +#include "QtPrintSupport/qprintengine.h" #ifndef QT_NO_PRINTER #include "QtCore/qmap.h" @@ -67,125 +67,95 @@ #include "private/qfontengine_p.h" #include "private/qpdf_p.h" #include "private/qpaintengine_p.h" +#include "qprintengine.h" QT_BEGIN_NAMESPACE -// #define USE_NATIVE_GRADIENTS - class QImage; class QDataStream; class QPen; class QPointF; class QRegion; class QFile; -class QPdfEngine; +class QPdfPrintEngine; -class QPdfEnginePrivate; +#define PPK_CupsOptions QPrintEngine::PrintEnginePropertyKey(0xfe00) +#define PPK_CupsPageRect QPrintEngine::PrintEnginePropertyKey(0xfe01) +#define PPK_CupsPaperRect QPrintEngine::PrintEnginePropertyKey(0xfe02) +#define PPK_CupsStringPageSize QPrintEngine::PrintEnginePropertyKey(0xfe03) -class QPdfEngine : public QPdfBaseEngine +namespace QPdf { + + struct PaperSize { + int width, height; // in postscript points + }; + Q_PRINTSUPPORT_EXPORT PaperSize paperSize(QPrinter::PaperSize paperSize); + Q_PRINTSUPPORT_EXPORT const char *paperSizeToString(QPrinter::PaperSize paperSize); +} + +class QPdfPrintEnginePrivate; + +class QPdfPrintEngine : public QPdfEngine, public QPrintEngine { - Q_DECLARE_PRIVATE(QPdfEngine) + Q_DECLARE_PRIVATE(QPdfPrintEngine) public: - QPdfEngine(QPrinter::PrinterMode m); - virtual ~QPdfEngine(); + QPdfPrintEngine(QPrinter::PrinterMode m); + virtual ~QPdfPrintEngine(); // reimplementations QPaintEngine bool begin(QPaintDevice *pdev); bool end(); - void drawPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QRectF & sr); - void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, - Qt::ImageConversionFlags flags = Qt::AutoColor); - void drawTiledPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QPointF & point); - - Type type() const; // end reimplementations QPaintEngine // reimplementations QPrintEngine bool abort() {return false;} - bool newPage(); QPrinter::PrinterState printerState() const {return state;} + + bool newPage(); + int metric(QPaintDevice::PaintDeviceMetric) const; + void setProperty(PrintEnginePropertyKey key, const QVariant &value); + QVariant property(PrintEnginePropertyKey key) const; // end reimplementations QPrintEngine - void setBrush(); - - // ### unused, should have something for this in QPrintEngine - void setAuthor(const QString &author); - QString author() const; - - void setDevice(QIODevice* dev); + QPrinter::PrinterState state; private: - Q_DISABLE_COPY(QPdfEngine) - - QPrinter::PrinterState state; + Q_DISABLE_COPY(QPdfPrintEngine) }; -class QPdfEnginePrivate : public QPdfBaseEnginePrivate +class QPdfPrintEnginePrivate : public QPdfEnginePrivate { - Q_DECLARE_PUBLIC(QPdfEngine) + Q_DECLARE_PUBLIC(QPdfPrintEngine) public: - QPdfEnginePrivate(QPrinter::PrinterMode m); - ~QPdfEnginePrivate(); + QPdfPrintEnginePrivate(QPrinter::PrinterMode m); + ~QPdfPrintEnginePrivate(); - void newPage(); + bool openPrintDevice(); + void closePrintDevice(); - int width() const { - QRect r = paperRect(); - return qRound(r.width()*72./resolution); - } - int height() const { - QRect r = paperRect(); - return qRound(r.height()*72./resolution); - } - - void writeHeader(); - void writeTail(); - - int addImage(const QImage &image, bool *bitmap, qint64 serial_no); - int addConstantAlphaObject(int brushAlpha, int penAlpha = 255); - int addBrushPattern(const QTransform &matrix, bool *specifyColor, int *gStateObject); - - void drawTextItem(const QPointF &p, const QTextItemInt &ti); - - QTransform pageMatrix() const; + void updatePaperSize(); private: - Q_DISABLE_COPY(QPdfEnginePrivate) + Q_DISABLE_COPY(QPdfPrintEnginePrivate) -#ifdef USE_NATIVE_GRADIENTS - int gradientBrush(const QBrush &b, const QMatrix &matrix, int *gStateObject); -#endif + QString printerName; + QString printProgram; + QString selectionOption; + QStringList cupsOptions; + QString cupsStringPageSize; - void writeInfo(); - void writePageRoot(); - void writeFonts(); - void embedFont(QFontSubset *font); + QPrinter::DuplexMode duplex; + bool collate; + int copies; + QPrinter::PageOrder pageOrder; + QPrinter::PaperSource paperSource; - QVector<int> xrefPositions; - QDataStream* stream; - int streampos; + QPrinter::PaperSize printerPaperSize; + QRect cupsPaperRect; + QRect cupsPageRect; + QSizeF customPaperSize; // in postscript points - int writeImage(const QByteArray &data, int width, int height, int depth, - int maskObject, int softMaskObject, bool dct = false); - void writePage(); - - int addXrefEntry(int object, bool printostr = true); - void printString(const QString &string); - void xprintf(const char* fmt, ...); - inline void write(const QByteArray &data) { - stream->writeRawData(data.constData(), data.size()); - streampos += data.size(); - } - - int writeCompressed(const char *src, int len); - inline int writeCompressed(const QByteArray &data) { return writeCompressed(data.constData(), data.length()); } - int writeCompressed(QIODevice *dev); - - // various PDF objects - int pageRoot, catalog, info, graphicsState, patternColorSpace; - QVector<uint> pages; - QHash<qint64, uint> imageCache; - QHash<QPair<uint, uint>, uint > alphaCache; + int fd; }; QT_END_NAMESPACE diff --git a/src/gui/painting/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp similarity index 88% rename from src/gui/painting/qprinter.cpp rename to src/printsupport/kernel/qprinter.cpp index 74a8f6a9d80..ae215945d3a 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -44,8 +44,7 @@ #include "qprintengine.h" #include "qprinterinfo.h" #include "qlist.h" -#include <qpagesetupdialog.h> -#include <qapplication.h> +#include <qcoreapplication.h> #include <qfileinfo.h> #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) #include "private/qcups_p.h" @@ -53,6 +52,10 @@ #ifndef QT_NO_PRINTER +#include "qplatformprintplugin_qpa.h" +#include <QtPrintSupport/QPlatformPrinterSupport> +#include <private/qpagedpaintdevice_p.h> + #if defined (Q_WS_WIN) #include <private/qprintengine_win_p.h> #elif defined (Q_WS_MAC) @@ -60,7 +63,6 @@ #elif defined (QTOPIA_PRINTENGINE) #include <private/qprintengine_qws_p.h> #endif -#include <private/qprintengine_ps_p.h> #if defined(Q_WS_X11) #include <private/qt_x11_p.h> @@ -73,10 +75,6 @@ #include <qpicture.h> #include <private/qpaintengine_preview_p.h> -#if defined(QT3_SUPPORT) -# include "qprintdialog.h" -#endif // QT3_SUPPORT - QT_BEGIN_NAMESPACE #define ABORT_IF_ACTIVE(location) \ @@ -120,7 +118,7 @@ static const float qt_paperSizes[][2] = { }; /// return the multiplier of converting from the unit value to postscript-points. -double qt_multiplierForUnit(QPrinter::Unit unit, int resolution) +Q_PRINTSUPPORT_EXPORT double qt_multiplierForUnit(QPrinter::Unit unit, int resolution) { switch(unit) { case QPrinter::Millimeter: @@ -142,7 +140,7 @@ double qt_multiplierForUnit(QPrinter::Unit unit, int resolution) } // not static: it's needed in qpagesetupdialog_unix.cpp -QSizeF qt_printerPaperSize(QPrinter::Orientation orientation, +Q_PRINTSUPPORT_EXPORT QSizeF qt_printerPaperSize(QPrinter::Orientation orientation, QPrinter::PaperSize paperSize, QPrinter::Unit unit, int resolution) @@ -161,17 +159,25 @@ QSizeF qt_printerPaperSize(QPrinter::Orientation orientation, void QPrinterPrivate::createDefaultEngines() { QPrinter::OutputFormat realOutputFormat = outputFormat; -#if !defined (QTOPIA_PRINTENGINE) #if defined (Q_OS_UNIX) && ! defined (Q_WS_MAC) if(outputFormat == QPrinter::NativeFormat) { - realOutputFormat = QPrinter::PostScriptFormat; + realOutputFormat = QPrinter::PdfFormat; } -#endif #endif switch (realOutputFormat) { case QPrinter::NativeFormat: { -#if defined (Q_WS_WIN) +#if defined (Q_WS_QPA) + QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); + if (ps) { + printEngine = ps->createNativePrintEngine(printerMode); + paintEngine = ps->createPaintEngine(printEngine, printerMode); + } else { + QPdfPrintEngine *pdfEngine = new QPdfPrintEngine(printerMode); + paintEngine = pdfEngine; + printEngine = pdfEngine; + } +#elif defined (Q_WS_WIN) QWin32PrintEngine *winEngine = new QWin32PrintEngine(printerMode); paintEngine = winEngine; printEngine = winEngine; @@ -179,27 +185,17 @@ void QPrinterPrivate::createDefaultEngines() QMacPrintEngine *macEngine = new QMacPrintEngine(printerMode); paintEngine = macEngine; printEngine = macEngine; -#elif defined (QTOPIA_PRINTENGINE) - QtopiaPrintEngine *qwsEngine = new QtopiaPrintEngine(printerMode); - paintEngine = qwsEngine; - printEngine = qwsEngine; #elif defined (Q_OS_UNIX) Q_ASSERT(false); #endif } break; case QPrinter::PdfFormat: { - QPdfEngine *pdfEngine = new QPdfEngine(printerMode); + QPdfPrintEngine *pdfEngine = new QPdfPrintEngine(printerMode); paintEngine = pdfEngine; printEngine = pdfEngine; } break; - case QPrinter::PostScriptFormat: { - QPSPrintEngine *psEngine = new QPSPrintEngine(printerMode); - paintEngine = psEngine; - printEngine = psEngine; - } - break; } use_default_engine = true; had_default_engines = true; @@ -260,7 +256,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke When printing directly to a printer on Windows or Mac OS X, QPrinter uses the built-in printer drivers. On X11, QPrinter uses the \l{Common Unix Printing System (CUPS)} or the standard Unix \l lpr utility - to send PostScript or PDF output to the printer. As an alternative, + to send PDF output to the printer. As an alternative, the printProgram() function can be used to specify the command or utility to use instead of the system default. @@ -347,8 +343,8 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke printer code. \value HighResolution On Windows, sets the printer resolution to that - defined for the printer in use. For PostScript printing, sets the - resolution of the PostScript driver to 1200 dpi. + defined for the printer in use. For PDF printing, sets the + resolution of the PDF driver to 1200 dpi. \note When rendering text on a QPrinter device, it is important to realize that the size of text, when specified in points, is @@ -398,47 +394,6 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \value PrintPageRange */ -/*! - \enum QPrinter::PageSize - - \obsolete - Use QPrinter::PaperSize instead. - - \value A0 841 x 1189 mm - \value A1 594 x 841 mm - \value A2 420 x 594 mm - \value A3 297 x 420 mm - \value A4 210 x 297 mm, 8.26 x 11.69 inches - \value A5 148 x 210 mm - \value A6 105 x 148 mm - \value A7 74 x 105 mm - \value A8 52 x 74 mm - \value A9 37 x 52 mm - \value B0 1030 x 1456 mm - \value B1 728 x 1030 mm - \value B10 32 x 45 mm - \value B2 515 x 728 mm - \value B3 364 x 515 mm - \value B4 257 x 364 mm - \value B5 182 x 257 mm, 7.17 x 10.13 inches - \value B6 128 x 182 mm - \value B7 91 x 128 mm - \value B8 64 x 91 mm - \value B9 45 x 64 mm - \value C5E 163 x 229 mm - \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope - \value DLE 110 x 220 mm - \value Executive 7.5 x 10 inches, 191 x 254 mm - \value Folio 210 x 330 mm - \value Ledger 432 x 279 mm - \value Legal 8.5 x 14 inches, 216 x 356 mm - \value Letter 8.5 x 11 inches, 216 x 279 mm - \value Tabloid 279 x 432 mm - \value Custom Unknown, or a user defined size. - - \omitvalue NPageSize - */ - /*! \enum QPrinter::PaperSize \since 4.4 @@ -597,7 +552,7 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke Creates a new printer object with the given \a mode. */ QPrinter::QPrinter(PrinterMode mode) - : QPaintDevice(), + : QPagedPaintDevice(), d_ptr(new QPrinterPrivate(this)) { init(mode); @@ -617,7 +572,7 @@ QPrinter::QPrinter(PrinterMode mode) Creates a new printer object with the given \a printer and \a mode. */ QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode) - : QPaintDevice(), + : QPagedPaintDevice(), d_ptr(new QPrinterPrivate(this)) { init(mode); @@ -627,9 +582,9 @@ QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode) void QPrinter::init(PrinterMode mode) { #if !defined(Q_WS_X11) - if (!qApp) { + if (!QCoreApplication::instance()) { #else - if (!qApp || !X11) { + if (!QCoreApplication::instance() || !X11) { #endif qFatal("QPrinter: Must construct a QApplication before a QPaintDevice"); return; @@ -709,9 +664,6 @@ QPrinter::~QPrinter() \value PdfFormat QPrinter will generate its output as a searchable PDF file. This mode is the default when printing to a file. - \value PostScriptFormat QPrinter will generate its output as in the PostScript format. - (This feature was introduced in Qt 4.2.) - \sa outputFormat(), setOutputFormat(), setOutputFileName() */ @@ -753,7 +705,7 @@ void QPrinter::setOutputFormat(OutputFormat format) if (def_engine) delete oldPrintEngine; - if (d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat) + if (d->outputFormat == QPrinter::PdfFormat) d->validPrinter = true; #else Q_UNUSED(format); @@ -803,20 +755,15 @@ void QPrinter::setPrinterName(const QString &name) ABORT_IF_ACTIVE("QPrinter::setPrinterName"); #if defined(Q_OS_UNIX) && !defined(QT_NO_CUPS) - if(d->use_default_engine - && d->outputFormat == QPrinter::NativeFormat) { - if (QCUPSSupport::cupsVersion() >= 10200 - && QCUPSSupport::printerHasPPD(name.toLocal8Bit().constData())) - setOutputFormat(QPrinter::PdfFormat); - else - setOutputFormat(QPrinter::PostScriptFormat); + if(d->use_default_engine && d->outputFormat == QPrinter::NativeFormat) { + setOutputFormat(QPrinter::PdfFormat); d->outputFormat = QPrinter::NativeFormat; } #endif QList<QPrinterInfo> prnList = QPrinterInfo::availablePrinters(); if (name.isEmpty()) { - d->validPrinter = d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat; + d->validPrinter = d->outputFormat == QPrinter::PdfFormat; } else { d->validPrinter = false; for (int i = 0; i < prnList.size(); ++i) { @@ -836,7 +783,7 @@ void QPrinter::setPrinterName(const QString &name) \since 4.4 Returns true if the printer currently selected is a valid printer - in the system, or a pure PDF/PostScript printer; otherwise returns false. + in the system, or a pure PDF printer; otherwise returns false. To detect other failures check the output of QPainter::begin() or QPrinter::newPage(). @@ -902,13 +849,12 @@ QString QPrinter::outputFileName() const Setting a null or empty name (0 or "") disables printing to a file. Setting a non-empty name enables printing to a file. - This can change the value of outputFormat(). If the file name has the - suffix ".ps" then PostScript is automatically selected as output format. + This can change the value of outputFormat(). If the file name has the ".pdf" suffix PDF is generated. If the file name - has a suffix other than ".ps" and ".pdf", the output format used is the + has a suffix other than ".pdf", the output format used is the one set with setOutputFormat(). - QPrinter uses Qt's cross-platform PostScript or PDF print engines + QPrinter uses Qt's cross-platform PDF print engines respectively. If you can produce this format natively, for example Mac OS X can generate PDF's from its print engine, set the output format back to NativeFormat. @@ -922,9 +868,7 @@ void QPrinter::setOutputFileName(const QString &fileName) ABORT_IF_ACTIVE("QPrinter::setOutputFileName"); QFileInfo fi(fileName); - if (!fi.suffix().compare(QLatin1String("ps"), Qt::CaseInsensitive)) - setOutputFormat(QPrinter::PostScriptFormat); - else if (!fi.suffix().compare(QLatin1String("pdf"), Qt::CaseInsensitive)) + if (!fi.suffix().compare(QLatin1String("pdf"), Qt::CaseInsensitive)) setOutputFormat(QPrinter::PdfFormat); else if (fileName.isEmpty()) setOutputFormat(QPrinter::NativeFormat); @@ -956,7 +900,7 @@ QString QPrinter::printProgram() const Sets the name of the program that should do the print job to \a printProg. - On X11, this function sets the program to call with the PostScript + On X11, this function sets the program to call with the PDF output. On other platforms, it has no effect. \sa printProgram() @@ -1099,16 +1043,7 @@ QPrinter::PaperSize QPrinter::paperSize() const */ void QPrinter::setPaperSize(PaperSize newPaperSize) { - Q_D(QPrinter); - if (d->paintEngine->type() != QPaintEngine::Pdf) - ABORT_IF_ACTIVE("QPrinter::setPaperSize"); - if (newPaperSize < 0 || newPaperSize >= NPaperSize) { - qWarning("QPrinter::setPaperSize: Illegal paper size %d", newPaperSize); - return; - } - d->printEngine->setProperty(QPrintEngine::PPK_PaperSize, newPaperSize); - d->addToManualSetList(QPrintEngine::PPK_PaperSize); - d->hasUserSetPageSize = true; + setPageSize(newPaperSize); } /*! @@ -1134,7 +1069,18 @@ QPrinter::PageSize QPrinter::pageSize() const void QPrinter::setPageSize(PageSize newPageSize) { - setPaperSize(newPageSize); + QPagedPaintDevice::setPageSize(newPageSize); + + Q_D(QPrinter); + if (d->paintEngine->type() != QPaintEngine::Pdf) + ABORT_IF_ACTIVE("QPrinter::setPaperSize"); + if (newPageSize < 0 || newPageSize >= NPageSize) { + qWarning("QPrinter::setPaperSize: Illegal paper size %d", newPageSize); + return; + } + d->printEngine->setProperty(QPrintEngine::PPK_PaperSize, newPageSize); + d->addToManualSetList(QPrintEngine::PPK_PaperSize); + d->hasUserSetPageSize = true; } /*! @@ -1151,8 +1097,21 @@ void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit) if (d->paintEngine->type() != QPaintEngine::Pdf) ABORT_IF_ACTIVE("QPrinter::setPaperSize"); const qreal multiplier = qt_multiplierForUnit(unit, resolution()); - QSizeF size(paperSize.width() * multiplier, paperSize.height() * multiplier); - d->printEngine->setProperty(QPrintEngine::PPK_CustomPaperSize, size); + QSizeF size(paperSize.width() * multiplier * 25.4/72., paperSize.height() * multiplier * 25.4/72.); + setPageSizeMM(size); +} + +/*! + \reimp + */ +void QPrinter::setPageSizeMM(const QSizeF &size) +{ + Q_D(QPrinter); + + QPagedPaintDevice::setPageSizeMM(size); + + QSizeF s = size * 72./25.4; + d->printEngine->setProperty(QPrintEngine::PPK_CustomPaperSize, s); d->addToManualSetList(QPrintEngine::PPK_CustomPaperSize); d->hasUserSetPageSize = true; } @@ -1195,6 +1154,8 @@ QSizeF QPrinter::paperSize(Unit unit) const void QPrinter::setPageOrder(PageOrder pageOrder) { + d->pageOrderAscending = (pageOrder == FirstPageFirst); + Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setPageOrder"); d->printEngine->setProperty(QPrintEngine::PPK_PageOrder, pageOrder); @@ -1700,17 +1661,29 @@ QRect QPrinter::paperRect() const specified with the \a unit parameter. */ void QPrinter::setPageMargins(qreal left, qreal top, qreal right, qreal bottom, QPrinter::Unit unit) +{ + const qreal multiplier = qt_multiplierForUnit(unit, resolution()) * 25.4/72.; + Margins m = { left*multiplier, right*multiplier, top*multiplier, bottom*multiplier }; + setMargins(m); +} + +/*! + reimp + */ +void QPrinter::setMargins(const Margins &m) { Q_D(QPrinter); - const qreal multiplier = qt_multiplierForUnit(unit, resolution()); + + const qreal multiplier = 72./25.4; QList<QVariant> margins; - margins << (left * multiplier) << (top * multiplier) - << (right * multiplier) << (bottom * multiplier); + margins << (m.left * multiplier) << (m.top * multiplier) + << (m.right * multiplier) << (m.bottom * multiplier); d->printEngine->setProperty(QPrintEngine::PPK_PageMargins, margins); d->addToManualSetList(QPrintEngine::PPK_PageMargins); d->hasCustomPageMargins = true; } + /*! \since 4.4 @@ -1798,9 +1771,9 @@ int QPrinter::winPageSize() const Returns a list of the resolutions (a list of dots-per-inch integers) that the printer says it supports. - For X11 where all printing is directly to postscript, this + For X11 where all printing is directly to PDF, this function will always return a one item list containing only the - postscript resolution, i.e., 72 (72 dpi -- but see PrinterMode). + PDF resolution, i.e., 72 (72 dpi -- but see PrinterMode). */ QList<int> QPrinter::supportedResolutions() const { @@ -2014,7 +1987,6 @@ void QPrinter::setPrinterSelectionOption(const QString &option) int QPrinter::fromPage() const { - Q_D(const QPrinter); return d->fromPage; } @@ -2039,7 +2011,6 @@ int QPrinter::fromPage() const int QPrinter::toPage() const { - Q_D(const QPrinter); return d->toPage; } @@ -2062,19 +2033,12 @@ int QPrinter::toPage() const void QPrinter::setFromTo(int from, int to) { - Q_D(QPrinter); if (from > to) { qWarning() << "QPrinter::setFromTo: 'from' must be less than or equal to 'to'"; from = to; } d->fromPage = from; d->toPage = to; - - if (d->minPage == 0 && d->maxPage == 0) { - d->minPage = 1; - d->maxPage = to; - d->options |= QAbstractPrintDialog::PrintPageRange; - } } /*! @@ -2084,8 +2048,10 @@ void QPrinter::setFromTo(int from, int to) */ void QPrinter::setPrintRange( PrintRange range ) { + d->printSelectionOnly = (range == Selection); + Q_D(QPrinter); - d->printRange = QAbstractPrintDialog::PrintRange(range); + d->printRange = range; } /*! @@ -2100,164 +2066,9 @@ void QPrinter::setPrintRange( PrintRange range ) QPrinter::PrintRange QPrinter::printRange() const { Q_D(const QPrinter); - return PrintRange(d->printRange); + return d->printRange; } -#if defined(QT3_SUPPORT) - -void QPrinter::setOutputToFile(bool f) -{ - if (f) { - if (outputFileName().isEmpty()) - setOutputFileName(QLatin1String("untitled_printer_document")); - } else { - setOutputFileName(QString()); - } -} - -bool qt_compat_QPrinter_printSetup(QPrinter *printer, QPrinterPrivate *pd, QWidget *parent) -{ - Q_UNUSED(pd); - QPrintDialog dlg(printer, parent); - return dlg.exec() != 0; -} - - -#ifdef Q_WS_MAC -bool qt_compat_QPrinter_pageSetup(QPrinter *p, QWidget *parent) -{ - QPageSetupDialog psd(p, parent); - return psd.exec() != 0; -} - -/*! - Executes a page setup dialog so that the user can configure the type of - page used for printing. Returns true if the contents of the dialog are - accepted; returns false if the dialog is canceled. -*/ -bool QPrinter::pageSetup(QWidget *parent) -{ - return qt_compat_QPrinter_pageSetup(this, parent); -} - -/*! - Executes a print setup dialog so that the user can configure the printing - process. Returns true if the contents of the dialog are accepted; returns - false if the dialog is canceled. -*/ -bool QPrinter::printSetup(QWidget *parent) -{ - Q_D(QPrinter); - return qt_compat_QPrinter_printSetup(this, d, parent); -} -#endif // Q_WS_MAC - -/*! - Use QPrintDialog instead. - - \oldcode - if (printer->setup(parent)) - ... - \newcode - QPrintDialog dialog(printer, parent); - if (dialog.exec()) - ... - \endcode -*/ -bool QPrinter::setup(QWidget *parent) -{ - Q_D(QPrinter); - return qt_compat_QPrinter_printSetup(this, d, parent) -#ifdef Q_WS_MAC - && qt_compat_QPrinter_pageSetup(this, parent); -#endif - ; -} - -/*! - Use QPrintDialog::minPage() instead. -*/ -int QPrinter::minPage() const -{ - Q_D(const QPrinter); - return d->minPage; -} - -/*! - Use QPrintDialog::maxPage() instead. -*/ -int QPrinter::maxPage() const -{ - Q_D(const QPrinter); - return d->maxPage; -} - -/*! - Use QPrintDialog::setMinMax() instead. -*/ -void QPrinter::setMinMax( int minPage, int maxPage ) -{ - Q_D(QPrinter); - Q_ASSERT_X(minPage <= maxPage, "QPrinter::setMinMax", - "'min' must be less than or equal to 'max'"); - d->minPage = minPage; - d->maxPage = maxPage; - d->options |= QPrintDialog::PrintPageRange; -} - -/*! - Returns true if the printer is set up to collate copies of printed documents; - otherwise returns false. - - Use QPrintDialog::isOptionEnabled(QPrintDialog::PrintCollateCopies) - instead. - - \sa collateCopies() -*/ -bool QPrinter::collateCopiesEnabled() const -{ - Q_D(const QPrinter); - return (d->options & QPrintDialog::PrintCollateCopies); -} - -/*! - Use QPrintDialog::setOption(QPrintDialog::PrintCollateCopies) - or QPrintDialog::setOptions(QPrintDialog::options() - & ~QPrintDialog::PrintCollateCopies) instead, depending on \a - enable. -*/ -void QPrinter::setCollateCopiesEnabled(bool enable) -{ - Q_D(QPrinter); - - if (enable) - d->options |= QPrintDialog::PrintCollateCopies; - else - d->options &= ~QPrintDialog::PrintCollateCopies; -} - -/*! - Use QPrintDialog instead. -*/ -void QPrinter::setOptionEnabled( PrinterOption option, bool enable ) -{ - Q_D(QPrinter); - if (enable) - d->options |= QPrintDialog::PrintDialogOption(1 << option); - else - d->options &= ~QPrintDialog::PrintDialogOption(1 << option); -} - -/*! - Use QPrintDialog instead. -*/ -bool QPrinter::isOptionEnabled( PrinterOption option ) const -{ - Q_D(const QPrinter); - return (d->options & QPrintDialog::PrintDialogOption(option)); -} - -#endif // QT3_SUPPORT /*! \class QPrintEngine @@ -2436,7 +2247,7 @@ QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size) */ QPrinter::PaperSize qSizeFTopaperSize(const QSizeF& size) { - for (int i = 0; i < static_cast<int>(QPrinter::NPaperSize); ++i) { + for (int i = 0; i < static_cast<int>(QPrinter::NPageSize); ++i) { if (qt_paperSizes[i][0] >= size.width() - 1 && qt_paperSizes[i][0] <= size.width() + 1 && qt_paperSizes[i][1] >= size.height() - 1 && diff --git a/src/gui/painting/qprinter.h b/src/printsupport/kernel/qprinter.h similarity index 74% rename from src/gui/painting/qprinter.h rename to src/printsupport/kernel/qprinter.h index 58db6122e07..7d04099a8ff 100644 --- a/src/gui/painting/qprinter.h +++ b/src/printsupport/kernel/qprinter.h @@ -44,7 +44,7 @@ #include <QtCore/qstring.h> #include <QtCore/qscopedpointer.h> -#include <QtGui/qpaintdevice.h> +#include <QtGui/qpagedpaintdevice.h> QT_BEGIN_HEADER @@ -63,7 +63,7 @@ class QPaintEngine; class QPrintEngine; class QPrinterInfo; -class Q_GUI_EXPORT QPrinter : public QPaintDevice +class Q_PRINTSUPPORT_EXPORT QPrinter : public QPagedPaintDevice { Q_DECLARE_PRIVATE(QPrinter) public: @@ -78,16 +78,8 @@ public: enum Orientation { Portrait, Landscape }; #ifndef Q_QDOC - enum PageSize { A4, B5, Letter, Legal, Executive, - A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, - B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, - DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom, NPaperSize = Custom }; typedef PageSize PaperSize; #else - enum PageSize { A4, B5, Letter, Legal, Executive, - A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, - B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, - DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom }; enum PaperSize { A4, B5, Letter, Legal, Executive, A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, @@ -121,9 +113,9 @@ public: Aborted, Error }; - enum OutputFormat { NativeFormat, PdfFormat, PostScriptFormat }; + enum OutputFormat { NativeFormat, PdfFormat }; - // ### Qt 5: Merge with QAbstractPrintDialog::PrintRange + // Keep in sync with QAbstractPrintDialog::PrintRange enum PrintRange { AllPages, Selection, PageRange, CurrentPage }; enum Unit { @@ -143,10 +135,6 @@ public: DuplexShortSide }; -#ifdef QT3_SUPPORT - enum PrinterOption { PrintToFile, PrintSelection, PrintPageRange }; -#endif // QT3_SUPPORT - void setOutputFormat(OutputFormat format); OutputFormat outputFormat() const; @@ -173,6 +161,8 @@ public: void setPageSize(PageSize); PageSize pageSize() const; + void setPageSizeMM(const QSizeF &size); + void setPaperSize(PaperSize); PaperSize paperSize() const; @@ -256,36 +246,11 @@ public: void setPrintRange(PrintRange range); PrintRange printRange() const; + void setMargins(const Margins &m); + void setPageMargins(qreal left, qreal top, qreal right, qreal bottom, Unit unit); void getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, Unit unit) const; -#ifdef QT3_SUPPORT -#ifdef Q_WS_MAC - QT3_SUPPORT bool pageSetup(QWidget *parent = 0); - QT3_SUPPORT bool printSetup(QWidget *parent = 0); -#endif - - QT3_SUPPORT bool setup(QWidget *parent = 0); - - QT3_SUPPORT void setMinMax(int minPage, int maxPage); - QT3_SUPPORT int minPage() const; - QT3_SUPPORT int maxPage() const; - - QT3_SUPPORT void setCollateCopiesEnabled(bool); - QT3_SUPPORT bool collateCopiesEnabled() const; - - QT3_SUPPORT void setOptionEnabled(PrinterOption, bool enable); - QT3_SUPPORT bool isOptionEnabled(PrinterOption) const; - - inline QT3_SUPPORT QSize margins() const; - inline QT3_SUPPORT void margins(uint *top, uint *left, uint *bottom, uint *right) const; - - inline QT3_SUPPORT bool aborted() { return printerState() == Aborted; } - - QT3_SUPPORT void setOutputToFile(bool); - inline QT3_SUPPORT bool outputToFile() const { return !outputFileName().isEmpty(); } -#endif - protected: int metric(PaintDeviceMetric) const; void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine); @@ -305,29 +270,6 @@ private: friend class QPageSetupWidget; }; -#ifdef QT3_SUPPORT -inline QSize QPrinter::margins() const -{ - QRect page = pageRect(); - QRect paper = paperRect(); - return QSize(page.left() - paper.left(), page.top() - paper.top()); -} - -inline void QPrinter::margins(uint *top, uint *left, uint *bottom, uint *right) const -{ - QRect page = pageRect(); - QRect paper = paperRect(); - if (top) - *top = page.top() - paper.top(); - if (left) - *left = page.left() - paper.left(); - if (bottom) - *bottom = paper.bottom() - page.bottom(); - if (right) - *right = paper.right() - page.right(); -} -#endif - #endif // QT_NO_PRINTER QT_END_NAMESPACE diff --git a/src/gui/painting/qprinter_p.h b/src/printsupport/kernel/qprinter_p.h similarity index 85% rename from src/gui/painting/qprinter_p.h rename to src/printsupport/kernel/qprinter_p.h index 2d35672c2c3..08877f08c5c 100644 --- a/src/gui/painting/qprinter_p.h +++ b/src/printsupport/kernel/qprinter_p.h @@ -58,9 +58,8 @@ #ifndef QT_NO_PRINTER -#include "QtGui/qprinter.h" -#include "QtGui/qprintengine.h" -#include "QtGui/qprintdialog.h" +#include "QtPrintSupport/qprinter.h" +#include "QtPrintSupport/qprintengine.h" #include "QtCore/qpointer.h" #include <limits.h> @@ -71,7 +70,7 @@ class QPrintEngine; class QPreviewPaintEngine; class QPicture; -class QPrinterPrivate +class Q_PRINTSUPPORT_EXPORT QPrinterPrivate { Q_DECLARE_PUBLIC(QPrinter) public: @@ -79,13 +78,7 @@ public: : printEngine(0) , paintEngine(0) , q_ptr(printer) - , options(QAbstractPrintDialog::PrintToFile | QAbstractPrintDialog::PrintPageRange | - QAbstractPrintDialog::PrintCollateCopies | QAbstractPrintDialog::PrintShowPageSize) - , printRange(QAbstractPrintDialog::AllPages) - , minPage(1) - , maxPage(INT_MAX) - , fromPage(0) - , toPage(0) + , printRange(QPrinter::AllPages) , use_default_engine(true) , validPrinter(false) , hasCustomPageMargins(false) @@ -118,9 +111,7 @@ public: QPrinter *q_ptr; - QAbstractPrintDialog::PrintDialogOptions options; - QAbstractPrintDialog::PrintRange printRange; - int minPage, maxPage, fromPage, toPage; + QPrinter::PrintRange printRange; uint use_default_engine : 1; uint had_default_engines : 1; diff --git a/src/gui/painting/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp similarity index 82% rename from src/gui/painting/qprinterinfo.cpp rename to src/printsupport/kernel/qprinterinfo.cpp index a7ddc85a542..5be73e76b9d 100644 --- a/src/gui/painting/qprinterinfo.cpp +++ b/src/printsupport/kernel/qprinterinfo.cpp @@ -30,6 +30,9 @@ #ifndef QT_NO_PRINTER +#include "qplatformprintplugin_qpa.h" +#include <QtPrintSupport/QPlatformPrinterSupport> + QT_BEGIN_NAMESPACE QPrinterInfoPrivate QPrinterInfoPrivate::shared_null; @@ -168,6 +171,35 @@ bool QPrinterInfo::isDefault() const On Mac OS X 10.3, this function always returns an empty list. */ +#ifdef Q_WS_QPA +QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const +{ + const Q_D(QPrinterInfo); + if (!isNull() && !d->hasPaperSizes) { + d->paperSizes = QPlatformPrinterSupportPlugin::get()->supportedPaperSizes(*this); + d->hasPaperSizes = true; + } + return d->paperSizes; +} + +QList<QPrinterInfo> QPrinterInfo::availablePrinters() +{ + QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); + if (!ps) + return QList<QPrinterInfo>(); + return ps->availablePrinters(); +} + +QPrinterInfo QPrinterInfo::defaultPrinter() +{ + QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); + if (!ps) + return QPrinterInfo(); + return QPlatformPrinterSupportPlugin::get()->defaultPrinter(); +} + +#endif //Q_WS_QPA + QT_END_NAMESPACE #endif // QT_NO_PRINTER diff --git a/src/gui/painting/qprinterinfo.h b/src/printsupport/kernel/qprinterinfo.h similarity index 95% rename from src/gui/painting/qprinterinfo.h rename to src/printsupport/kernel/qprinterinfo.h index 9ff1bd16bdd..535c29c4d64 100644 --- a/src/gui/painting/qprinterinfo.h +++ b/src/printsupport/kernel/qprinterinfo.h @@ -44,7 +44,7 @@ #include <QtCore/QList> -#include <QtGui/QPrinter> +#include <QtPrintSupport/QPrinter> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) #ifndef QT_NO_PRINTER class QPrinterInfoPrivate; class QPrinterInfoPrivateDeleter; -class Q_GUI_EXPORT QPrinterInfo +class Q_PRINTSUPPORT_EXPORT QPrinterInfo { public: QPrinterInfo(); @@ -77,6 +77,7 @@ private: QPrinterInfo(const QString &name); private: + friend class QPlatformPrinterSupport; Q_DECLARE_PRIVATE(QPrinterInfo) QScopedPointer<QPrinterInfoPrivate, QPrinterInfoPrivateDeleter> d_ptr; }; diff --git a/src/gui/painting/qprinterinfo_p.h b/src/printsupport/kernel/qprinterinfo_p.h similarity index 98% rename from src/gui/painting/qprinterinfo_p.h rename to src/printsupport/kernel/qprinterinfo_p.h index a3f7d5d2529..a3c654e7b7d 100644 --- a/src/gui/painting/qprinterinfo_p.h +++ b/src/printsupport/kernel/qprinterinfo_p.h @@ -68,9 +68,10 @@ public: name(name), isDefault(false) #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN)) || defined(Q_WS_QPA) #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - , cupsPrinterIndex(0), hasPaperSizes(false) + , cupsPrinterIndex(0) #endif #endif + , hasPaperSizes(false) {} ~QPrinterInfoPrivate() {} @@ -83,10 +84,10 @@ public: #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_SYMBIAN)) || defined(Q_WS_QPA) #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) int cupsPrinterIndex; +#endif +#endif mutable bool hasPaperSizes; mutable QList<QPrinter::PaperSize> paperSizes; -#endif -#endif }; diff --git a/src/gui/painting/qprinterinfo_unix.cpp b/src/printsupport/kernel/qprinterinfo_unix.cpp similarity index 91% rename from src/gui/painting/qprinterinfo_unix.cpp rename to src/printsupport/kernel/qprinterinfo_unix.cpp index aa220aad57e..c7dbb7cc32c 100644 --- a/src/gui/painting/qprinterinfo_unix.cpp +++ b/src/printsupport/kernel/qprinterinfo_unix.cpp @@ -45,9 +45,9 @@ #include <qfile.h> #include <qfileinfo.h> #include <qdir.h> -#include <qprintdialog.h> #include <qlibrary.h> #include <qtextstream.h> +#include <qcoreapplication.h> #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) # include <private/qcups_p.h> @@ -130,10 +130,8 @@ void qt_perhapsAddPrinter(QList<QPrinterDescription> *printers, const QString &n if (printers->at(i).samePrinter(name)) return; -#ifndef QT_NO_PRINTDIALOG if (host.isEmpty()) - host = QPrintDialog::tr("locally connected"); -#endif + host = QCoreApplication::translate("QPrinter", "locally connected"); printers->append(QPrinterDescription(name.simplified(), host.simplified(), comment.simplified(), aliases)); } @@ -153,11 +151,9 @@ void qt_parsePrinterDesc(QString printerDesc, QList<QPrinterDescription> *printe if (j > 0 && j < i) { printerName = printerDesc.left(j); aliases = printerDesc.mid(j + 1, i - j - 1).split(QLatin1Char('|')); -#ifndef QT_NO_PRINTDIALOG // try extracting a comment from the aliases - printerComment = QPrintDialog::tr("Aliases: %1") + printerComment = QCoreApplication::translate("QPrinter", "Aliases: %1") .arg(aliases.join(QLatin1String(", "))); -#endif } else { printerName = printerDesc.left(i); } @@ -379,10 +375,8 @@ char *qt_parsePrintersConf(QList<QPrinterDescription> *printers, bool *found) if (j > 0) { // try extracting a comment from the aliases aliases = printerDesc.mid(j + 1, i - j - 1).split(QLatin1Char('|')); -#ifndef QT_NO_PRINTDIALOG - printerComment = QPrintDialog::tr("Aliases: %1") + printerComment = QCoreApplication::translate("QPrinter", "Aliases: %1") .arg(aliases.join(QLatin1String(", "))); -#endif } // look for signs of this being a remote printer i = printerDesc.indexOf( @@ -593,9 +587,6 @@ void qt_parseEtcLpMember(QList<QPrinterDescription> *printers) if (dirs.isEmpty()) return; -#ifdef QT_NO_PRINTDIALOG - Q_UNUSED(printers); -#else QString tmp; for (int i = 0; i < dirs.size(); ++i) { QFileInfo printer = dirs.at(i); @@ -605,10 +596,9 @@ void qt_parseEtcLpMember(QList<QPrinterDescription> *printers) // decent way to locate aliases and remote printers. if (printer.isFile()) qt_perhapsAddPrinter(printers, printer.fileName(), - QPrintDialog::tr("unknown"), + QCoreApplication::translate("QPrinter", "unknown"), QLatin1String("")); } -#endif } // IRIX 6.x @@ -751,7 +741,7 @@ void qt_parseQconfig(QList<QPrinterDescription> *printers) } while (!ts.atEnd()); } -int qt_getLprPrinters(QList<QPrinterDescription>& printers) +Q_PRINTSUPPORT_EXPORT int qt_getLprPrinters(QList<QPrinterDescription>& printers) { QByteArray etcLpDefault; qt_parsePrintcap(&printers, QLatin1String("/etc/printcap")); @@ -801,12 +791,10 @@ int qt_getLprPrinters(QList<QPrinterDescription>& printers) dollarPrinter = QString::fromLocal8Bit(qgetenv("NPRINTER")); if (dollarPrinter.isEmpty()) dollarPrinter = QString::fromLocal8Bit(qgetenv("NGPRINTER")); -#ifndef QT_NO_PRINTDIALOG if (!dollarPrinter.isEmpty()) qt_perhapsAddPrinter(&printers, dollarPrinter, - QPrintDialog::tr("unknown"), + QCoreApplication::translate("QPrinter", "unknown"), QLatin1String("")); -#endif } QRegExp ps(QLatin1String("[^a-z]ps(?:[^a-z]|$)")); @@ -847,78 +835,20 @@ int qt_getLprPrinters(QList<QPrinterDescription>& printers) ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -QList<QPrinterInfo> QPrinterInfo::availablePrinters() +QList<QPrinter::PaperSize> qt_getCupsPrinterPaperSizes(int cupsPrinterIndex) { - QList<QPrinterInfo> printers; - + QList<QPrinter::PaperSize> result; #if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - if (QCUPSSupport::isAvailable()) { - QCUPSSupport cups; - int cupsPrinterCount = cups.availablePrintersCount(); - const cups_dest_t* cupsPrinters = cups.availablePrinters(); - for (int i = 0; i < cupsPrinterCount; ++i) { - QString printerName(QString::fromLocal8Bit(cupsPrinters[i].name)); - if (cupsPrinters[i].instance) - printerName += QLatin1Char('/') + QString::fromLocal8Bit(cupsPrinters[i].instance); - - QPrinterInfo printerInfo(printerName); - if (cupsPrinters[i].is_default) - printerInfo.d_ptr->isDefault = true; - printerInfo.d_ptr->cupsPrinterIndex = i; - printers.append(printerInfo); - } - } else -#endif - { - QList<QPrinterDescription> lprPrinters; - int defprn = qt_getLprPrinters(lprPrinters); - // populating printer combo - foreach (const QPrinterDescription &description, lprPrinters) - printers.append(QPrinterInfo(description.name)); - if (defprn >= 0 && defprn < printers.size()) - printers[defprn].d_ptr->isDefault = true; + if (!QCUPSSupport::isAvailable() || cupsPrinterIndex < 0) + return result; + // Find paper sizes from CUPS. + QCUPSSupport cups; + cups.setCurrentPrinter(cupsPrinterIndex); + if (const ppd_option_t* size = cups.pageSizes()) { + for (int j = 0; j < size->num_choices; ++j) + result.append(string2PaperSize(size->choices[j].choice)); } - - return printers; -} - -QPrinterInfo QPrinterInfo::defaultPrinter() -{ - QList<QPrinterInfo> printers = availablePrinters(); - foreach (const QPrinterInfo &printerInfo, printers) { - if (printerInfo.isDefault()) - return printerInfo; - } - - return printers.value(0); -} - -QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const -{ -#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) - const Q_D(QPrinterInfo); - - if (isNull()) - return d->paperSizes; - - if (!d->hasPaperSizes) { - d->hasPaperSizes = true; - - if (QCUPSSupport::isAvailable()) { - // Find paper sizes from CUPS. - QCUPSSupport cups; - cups.setCurrentPrinter(d->cupsPrinterIndex); - const ppd_option_t* sizes = cups.pageSizes(); - if (sizes) { - for (int j = 0; j < sizes->num_choices; ++j) - d->paperSizes.append(string2PaperSize(sizes->choices[j].choice)); - } - } - } - - return d->paperSizes; -#else - return QList<QPrinter::PaperSize>(); + return result; #endif } diff --git a/src/gui/painting/qprinterinfo_unix_p.h b/src/printsupport/kernel/qprinterinfo_unix_p.h similarity index 96% rename from src/gui/painting/qprinterinfo_unix_p.h rename to src/printsupport/kernel/qprinterinfo_unix_p.h index 1ededf5a368..c12aa395561 100644 --- a/src/gui/painting/qprinterinfo_unix_p.h +++ b/src/printsupport/kernel/qprinterinfo_unix_p.h @@ -42,6 +42,9 @@ #ifndef QPRINTERINFO_UNIX_P_H #define QPRINTERINFO_UNIX_P_H +#include <QtPrintSupport/qprinter.h> +#include <QtCore/qstringlist.h> + #ifndef QT_NO_NIS # ifndef BOOL_DEFINED # define BOOL_DEFINED @@ -118,6 +121,8 @@ void qt_parseSpoolInterface(QList<QPrinterDescription> *printers); void qt_parseQconfig(QList<QPrinterDescription> *printers); int qt_getLprPrinters(QList<QPrinterDescription>& printers); +QList<QPrinter::PaperSize> qt_getCupsPrinterPaperSizes(int cupsPrinterIndex); + #endif // QT_NO_PRINTER QT_END_NAMESPACE diff --git a/src/printsupport/printsupport.pro b/src/printsupport/printsupport.pro new file mode 100644 index 00000000000..0aa92a95de7 --- /dev/null +++ b/src/printsupport/printsupport.pro @@ -0,0 +1,22 @@ +load(qt_module) + +TARGET = QtPrintSupport +QPRO_PWD = $$PWD +QT = core-private gui-private widgets-private + +CONFIG += module +MODULE_PRI = ../modules/qt_printsupport.pri + +DEFINES += QT_BUILD_PRINTSUPPORT_LIB QT_NO_USING_NAMESPACE + +unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui + +load(qt_module_config) + +HEADERS += $$QT_SOURCE_TREE/src/printsupport/qtprintsupportversion.h + +QMAKE_LIBS += $$QMAKE_LIBS_PRINTSUPPORT + +include(kernel/kernel.pri) +include(widgets/widgets.pri) +include(dialogs/dialogs.pri) diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/printsupport/widgets/qprintpreviewwidget.cpp similarity index 99% rename from src/gui/widgets/qprintpreviewwidget.cpp rename to src/printsupport/widgets/qprintpreviewwidget.cpp index 47e67a46fe7..96b009f8c13 100644 --- a/src/gui/widgets/qprintpreviewwidget.cpp +++ b/src/printsupport/widgets/qprintpreviewwidget.cpp @@ -44,11 +44,11 @@ #include <private/qprinter_p.h> #include <QtCore/qmath.h> -#include <QtGui/qboxlayout.h> -#include <QtGui/qgraphicsitem.h> -#include <QtGui/qgraphicsview.h> -#include <QtGui/qscrollbar.h> -#include <QtGui/qstyleoption.h> +#include <QtWidgets/qboxlayout.h> +#include <QtWidgets/qgraphicsitem.h> +#include <QtWidgets/qgraphicsview.h> +#include <QtWidgets/qscrollbar.h> +#include <QtWidgets/qstyleoption.h> #ifndef QT_NO_PRINTPREVIEWWIDGET diff --git a/src/gui/widgets/qprintpreviewwidget.h b/src/printsupport/widgets/qprintpreviewwidget.h similarity index 96% rename from src/gui/widgets/qprintpreviewwidget.h rename to src/printsupport/widgets/qprintpreviewwidget.h index aa42ba9f098..1c12bc09453 100644 --- a/src/gui/widgets/qprintpreviewwidget.h +++ b/src/printsupport/widgets/qprintpreviewwidget.h @@ -42,8 +42,8 @@ #ifndef QPRINTPREVIEWWIDGET_H #define QPRINTPREVIEWWIDGET_H -#include <QtGui/qwidget.h> -#include <QtGui/qprinter.h> +#include <QtWidgets/qwidget.h> +#include <QtPrintSupport/qprinter.h> #ifndef QT_NO_PRINTPREVIEWWIDGET @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QPrintPreviewWidgetPrivate; -class Q_GUI_EXPORT QPrintPreviewWidget : public QWidget +class Q_PRINTSUPPORT_EXPORT QPrintPreviewWidget : public QWidget { Q_OBJECT Q_DECLARE_PRIVATE(QPrintPreviewWidget) diff --git a/src/printsupport/widgets/widgets.pri b/src/printsupport/widgets/widgets.pri new file mode 100644 index 00000000000..40eb306623b --- /dev/null +++ b/src/printsupport/widgets/widgets.pri @@ -0,0 +1,2 @@ +HEADERS += widgets/qprintpreviewwidget.h +SOURCES += widgets/qprintpreviewwidget.cpp diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h index 76565461efc..93f0089c712 100644 --- a/src/sql/models/qsqlrelationaldelegate.h +++ b/src/sql/models/qsqlrelationaldelegate.h @@ -44,9 +44,9 @@ #ifdef QT_GUI_LIB -#include <QtGui/qitemdelegate.h> -#include <QtGui/qlistview.h> -#include <QtGui/qcombobox.h> +#include <QtWidgets/qitemdelegate.h> +#include <QtWidgets/qlistview.h> +#include <QtWidgets/qcombobox.h> #include <QtSql/qsqlrelationaltablemodel.h> QT_BEGIN_HEADER diff --git a/src/src.pro b/src/src.pro index 55a0ad3034f..4263c0eb926 100644 --- a/src/src.pro +++ b/src/src.pro @@ -4,16 +4,20 @@ TEMPLATE = subdirs unset(SRC_SUBDIRS) win32:SRC_SUBDIRS += src_winmain symbian:SRC_SUBDIRS += src_s60main -SRC_SUBDIRS += src_corelib src_network src_sql src_testlib src_xml src_uitools +!wince*:!symbian-abld:!symbian-sbsv2:include(tools/tools.pro) +SRC_SUBDIRS += src_corelib +# TODO: Move idc to ActiveQt +!cross_compile { + win32:!wince*: SRC_SUBDIRS += src_tools_idc +} +SRC_SUBDIRS += src_network src_sql src_gui src_xml src_uitools src_widgets src_printsupport src_testlib src_platformsupport nacl: SRC_SUBDIRS -= src_network src_testlib !symbian:contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus -!contains(QT_CONFIG, no-gui): SRC_SUBDIRS += src_gui + +contains(QT_CONFIG, no-gui): SRC_SUBDIRS -= src_gui contains(QT_CONFIG, v8): SRC_SUBDIRS += src_v8 -!wince*:!symbian-abld:!symbian-sbsv2:include(tools/tools.pro) - contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2): SRC_SUBDIRS += src_opengl -contains(QT_CONFIG, openvg): SRC_SUBDIRS += src_openvg SRC_SUBDIRS += src_plugins # s60installs need to be at the end, because qtbase.pro does an ordered build, @@ -44,29 +48,35 @@ src_network.subdir = $$QT_SOURCE_TREE/src/network src_network.target = sub-network src_opengl.subdir = $$QT_SOURCE_TREE/src/opengl src_opengl.target = sub-opengl -src_openvg.subdir = $$QT_SOURCE_TREE/src/openvg -src_openvg.target = sub-openvg src_plugins.subdir = $$QT_SOURCE_TREE/src/plugins src_plugins.target = sub-plugins +src_widgets.subdir = $$QT_SOURCE_TREE/src/widgets +src_widgets.target = sub-widgets +src_printsupport.subdir = $$QT_SOURCE_TREE/src/printsupport +src_printsupport.target = sub-printsupport src_testlib.subdir = $$QT_SOURCE_TREE/src/testlib src_testlib.target = sub-testlib +src_platformsupport.subdir = $$QT_SOURCE_TREE/src/platformsupport +src_platformsupport.target = sub-platformsupport + #CONFIG += ordered !wince*:!ordered:!symbian-abld:!symbian-sbsv2 { src_corelib.depends = src_tools_moc src_tools_rcc - src_gui.depends = src_corelib src_tools_uic + src_gui.depends = src_corelib + src_printsupport.depends = src_corelib src_gui src_widgets + src_widgets.depends = src_corelib src_gui src_tools_uic embedded: src_gui.depends += src_network src_xml.depends = src_corelib - src_uitools.depends = src_corelib src_xml + src_uitools.depends = src_corelib src_widgets src_dbus.depends = src_corelib src_xml src_network.depends = src_corelib - src_opengl.depends = src_gui - src_openvg.depends = src_gui + src_opengl.depends = src_gui src_widgets src_sql.depends = src_corelib - src_testlib.depends = src_corelib + src_testlib.depends = src_corelib src_gui src_widgets src_tools_idc.depends = src_corelib # target defined in tools.pro - src_tools_uic3.depends = src_qt3support src_xml # target defined in tools.pro src_plugins.depends = src_gui src_sql src_xml + qpa: src_plugins.depends = src_platformsupport src_s60installs.depends = $$TOOLS_SUBDIRS $$SRC_SUBDIRS src_s60installs.depends -= src_s60installs contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { diff --git a/src/testlib/qasciikey.cpp b/src/testlib/qasciikey.cpp index 874b9a06c7c..80e94acd0b3 100644 --- a/src/testlib/qasciikey.cpp +++ b/src/testlib/qasciikey.cpp @@ -59,6 +59,8 @@ Qt::Key QTest::asciiToKey(char ascii) case 0x0b: return Qt::Key_Backtab; case 0x0d: return Qt::Key_Return; case 0x1b: return Qt::Key_Escape; + case 0x13: return Qt::Key_Up; + case 0x15: return Qt::Key_Down; case 0x20: return Qt::Key_Space; case 0x21: return Qt::Key_Exclam; case 0x22: return Qt::Key_QuoteDbl; diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp index 8894d41beea..49fad5da4dc 100644 --- a/src/testlib/qbenchmark.cpp +++ b/src/testlib/qbenchmark.cpp @@ -44,7 +44,7 @@ #include "QtTest/private/qbenchmarkmetric_p.h" #ifdef QT_GUI_LIB -#include <QtGui/qapplication.h> +#include <QtGui/qguiapplication.h> #endif #include <QtCore/qprocess.h> diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 386f154f72c..e671828b77d 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -247,7 +247,7 @@ int main(int argc, char *argv[]) \ #include <QtTest/qtestsystem.h> -#ifdef QT_GUI_LIB +#if defined(QT_WIDGETS_LIB) #include <QtTest/qtest_gui.h> @@ -266,6 +266,18 @@ int main(int argc, char *argv[]) \ return QTest::qExec(&tc, argc, argv); \ } +#elif defined(QT_GUI_LIB) + +#include <QtTest/qtest_gui.h> + +#define QTEST_MAIN(TestObject) \ +int main(int argc, char *argv[]) \ +{ \ + QGuiApplication app(argc, argv); \ + TestObject tc; \ + return QTest::qExec(&tc, argc, argv); \ +} + #else #define QTEST_MAIN(TestObject) \ diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h index 722e20d9617..77b19f0e213 100644 --- a/src/testlib/qtest_gui.h +++ b/src/testlib/qtest_gui.h @@ -57,7 +57,7 @@ #include <QtTest/qtesttouch.h> #include <QtTest/qtestkeyboard.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qicon.h> #include <QtGui/qpixmap.h> #if 0 diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h index 9cec1a6bbe1..a58ed2ff69a 100644 --- a/src/testlib/qtestaccessible.h +++ b/src/testlib/qtestaccessible.h @@ -53,8 +53,8 @@ QVERIFY(QTestAccessibility::verifyEvent(object, child, (int)event)) #include <QtCore/qlist.h> -#include <QtGui/qaccessible.h> -#include <QtGui/qapplication.h> +#include <QtWidgets/qaccessible.h> +#include <QtWidgets/qapplication.h> QT_BEGIN_HEADER diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h index 43fed84abc9..4dfdaeaf564 100644 --- a/src/testlib/qtestkeyboard.h +++ b/src/testlib/qtestkeyboard.h @@ -53,9 +53,10 @@ #include <QtTest/qtestspontaneevent.h> #include <QtCore/qpointer.h> -#include <QtGui/qapplication.h> +#include <QtWidgets/qapplication.h> #include <QtGui/qevent.h> -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> +#include <QtGui/qwindowsysteminterface_qpa.h> QT_BEGIN_HEADER @@ -83,6 +84,14 @@ namespace QTest if (!qApp->notify(widget, &a)) QTest::qWarn("Keyboard event not accepted by receiving widget"); } + //QWindow overload + static void simulateEvent(QWindow *window, bool press, int code, + Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay=-1) + { + QEvent::Type type; + type = press ? QEvent::KeyPress : QEvent::KeyRelease; + QWindowSystemInterface::handleKeyEvent(window, type, code, modifier, text, repeat, delay); + } static void sendKeyEvent(KeyAction action, QWidget *widget, Qt::Key code, QString text, Qt::KeyboardModifiers modifier, int delay=-1) @@ -147,6 +156,52 @@ namespace QTest simulateEvent(widget, false, Qt::Key_Shift, modifier & Qt::ShiftModifier, QString(), false, delay); } } + //QWindow overload + static void sendKeyEvent(KeyAction action, QWindow *window, Qt::Key code, + QString text, Qt::KeyboardModifiers modifier, int delay=-1) + { + QTEST_ASSERT(qApp); + QTEST_ASSERT(window); + + if (action == Click) { + sendKeyEvent(Press, window, code, text, modifier, delay); + sendKeyEvent(Release, window, code, text, modifier, delay); + return; + } + + bool repeat = false; + + if (action == Press) { + if (modifier & Qt::ShiftModifier) + simulateEvent(window, true, Qt::Key_Shift, 0, QString(), false, delay); + + if (modifier & Qt::ControlModifier) + simulateEvent(window, true, Qt::Key_Control, modifier & Qt::ShiftModifier, QString(), false, delay); + + if (modifier & Qt::AltModifier) + simulateEvent(window, true, Qt::Key_Alt, + modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay); + if (modifier & Qt::MetaModifier) + simulateEvent(window, true, Qt::Key_Meta, modifier & (Qt::ShiftModifier + | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay); + simulateEvent(window, true, code, modifier, text, repeat, delay); + } else if (action == Release) { + simulateEvent(window, false, code, modifier, text, repeat, delay); + + if (modifier & Qt::MetaModifier) + simulateEvent(window, false, Qt::Key_Meta, modifier, QString(), false, delay); + if (modifier & Qt::AltModifier) + simulateEvent(window, false, Qt::Key_Alt, modifier & + (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay); + + if (modifier & Qt::ControlModifier) + simulateEvent(window, false, Qt::Key_Control, + modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay); + + if (modifier & Qt::ShiftModifier) + simulateEvent(window, false, Qt::Key_Shift, modifier & Qt::ShiftModifier, QString(), false, delay); + } + } // Convenience function static void sendKeyEvent(KeyAction action, QWidget *widget, Qt::Key code, @@ -157,6 +212,15 @@ namespace QTest text = QString(QChar::fromLatin1(ascii)); sendKeyEvent(action, widget, code, text, modifier, delay); } + // QWindow convenience function + static void sendKeyEvent(KeyAction action, QWindow *window, Qt::Key code, + char ascii, Qt::KeyboardModifiers modifier, int delay=-1) + { + QString text; + if (ascii) + text = QString(QChar::fromLatin1(ascii)); + sendKeyEvent(action, window, code, text, modifier, delay); + } inline static void keyEvent(KeyAction action, QWidget *widget, char ascii, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) @@ -165,6 +229,14 @@ namespace QTest Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) { sendKeyEvent(action, widget, key, keyToAscii(key), modifier, delay); } + //Support QWindow + inline static void keyEvent(KeyAction action, QWindow *window, char ascii, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { sendKeyEvent(action, window, asciiToKey(ascii), ascii, modifier, delay); } + inline static void keyEvent(KeyAction action, QWindow *window, Qt::Key key, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { sendKeyEvent(action, window, key, keyToAscii(key), modifier, delay); } + /////////////// inline static void keyClicks(QWidget *widget, const QString &sequence, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) { @@ -184,6 +256,17 @@ namespace QTest { keyEvent(Release, widget, key, modifier, delay); } inline static void keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) { keyEvent(Click, widget, key, modifier, delay); } + //Support QWindow + inline static void keyClick(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Click, window, key, modifier, delay); } + inline static void keyClick(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Click, window, key, modifier, delay); } + inline static void keyRelease(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Release, window, key, modifier, delay); } + inline static void keyPress(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Press, window, key, modifier, delay); } + inline static void keyPress(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) + { keyEvent(Press, window, key, modifier, delay); } } diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 942b041eb14..dfd07a9d423 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -51,12 +51,12 @@ #include <QtTest/qtestassert.h> #include <QtTest/qtestsystem.h> #include <QtTest/qtestspontaneevent.h> - #include <QtCore/qpoint.h> #include <QtCore/qstring.h> -#include <QtGui/qapplication.h> +#include <QtWidgets/qapplication.h> #include <QtGui/qevent.h> -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> +#include <QtGui/qwindowsysteminterface_qpa.h> QT_BEGIN_HEADER @@ -126,6 +126,66 @@ namespace QTest } + static void mouseEvent(MouseAction action, QWindow *window, Qt::MouseButton button, + Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1) + { + QTEST_ASSERT(window); + extern int Q_TESTLIB_EXPORT defaultMouseDelay(); + + static Qt::MouseButton lastButton = Qt::NoButton; + + if (delay == -1 || delay < defaultMouseDelay()) + delay = defaultMouseDelay(); + if (delay > 0) + QTest::qWait(delay); + + if (pos.isNull()) + pos = window->geometry().center(); + + if (action == MouseClick) { + mouseEvent(MousePress, window, button, stateKey, pos); + mouseEvent(MouseRelease, window, button, stateKey, pos); + return; + } + QTEST_ASSERT(button == Qt::NoButton || button & Qt::MouseButtonMask); + QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask); + + stateKey &= static_cast<unsigned int>(Qt::KeyboardModifierMask); + + + switch (action) + { + case MousePress: + QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),button); + lastButton = button; + break; + case MouseRelease: + QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),Qt::NoButton); + lastButton = Qt::NoButton; + break; + case MouseDClick: + QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),button); + qWait(10); + QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),Qt::NoButton); + qWait(20); + QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),button); + qWait(10); + QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),Qt::NoButton); + break; + case MouseMove: + QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),lastButton); + //QCursor::setPos(window->mapToGlobal(pos)); +#ifdef QT_MAC_USE_COCOA + QTest::qWait(20); +#else + qApp->processEvents(); +#endif + return; + default: + QTEST_ASSERT(false); + } + } + inline void mousePress(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, QPoint pos = QPoint(), int delay=-1) { mouseEvent(MousePress, widget, button, stateKey, pos, delay); } @@ -141,6 +201,21 @@ namespace QTest inline void mouseMove(QWidget *widget, QPoint pos = QPoint(), int delay=-1) { mouseEvent(MouseMove, widget, Qt::NoButton, 0, pos, delay); } + //Support QWindow + inline void mousePress(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { mouseEvent(MousePress, window, button, stateKey, pos, delay); } + inline void mouseRelease(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { mouseEvent(MouseRelease, window, button, stateKey, pos, delay); } + inline void mouseClick(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { mouseEvent(MouseClick, window, button, stateKey, pos, delay); } + inline void mouseDClick(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, + QPoint pos = QPoint(), int delay=-1) + { mouseEvent(MouseDClick, window, button, stateKey, pos, delay); } + inline void mouseMove(QWindow *window, QPoint pos = QPoint(), int delay=-1) + { mouseEvent(MouseMove, window, Qt::NoButton, 0, pos, delay); } } QT_END_NAMESPACE diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h index de20abeeee6..0165e515285 100644 --- a/src/testlib/qtestsystem.h +++ b/src/testlib/qtestsystem.h @@ -45,6 +45,7 @@ #include <QtTest/qtestcase.h> #include <QtCore/qcoreapplication.h> #include <QtCore/qelapsedtimer.h> +#include <QtGui/QWindow> QT_BEGIN_HEADER @@ -82,6 +83,12 @@ namespace QTest #endif return true; } + inline static bool qWaitForWindowShown(QWindow *window) + { + Q_UNUSED(window); + qWait(200); + return true; + } } diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h index a1fe2df382a..c8556771899 100644 --- a/src/testlib/qtesttouch.h +++ b/src/testlib/qtesttouch.h @@ -51,10 +51,10 @@ #include <QtTest/qtestassert.h> #include <QtTest/qtestsystem.h> #include <QtTest/qtestspontaneevent.h> - +#include <QtGui/QWindowSystemInterface> #include <QtCore/qmap.h> #include <QtGui/qevent.h> -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -84,6 +84,14 @@ namespace QTest p.setState(Qt::TouchPointPressed); return *this; } + QTouchEventSequence& press(int touchId, const QPoint &pt, QWindow *window = 0) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setScreenPos(mapToScreen(window, pt)); + p.setState(Qt::TouchPointPressed); + return *this; + } + QTouchEventSequence& move(int touchId, const QPoint &pt, QWidget *widget = 0) { QTouchEvent::TouchPoint &p = point(touchId); @@ -91,6 +99,13 @@ namespace QTest p.setState(Qt::TouchPointMoved); return *this; } + QTouchEventSequence& move(int touchId, const QPoint &pt, QWindow *window = 0) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setScreenPos(mapToScreen(window, pt)); + p.setState(Qt::TouchPointMoved); + return *this; + } QTouchEventSequence& release(int touchId, const QPoint &pt, QWidget *widget = 0) { QTouchEvent::TouchPoint &p = point(touchId); @@ -98,6 +113,13 @@ namespace QTest p.setState(Qt::TouchPointReleased); return *this; } + QTouchEventSequence& release(int touchId, const QPoint &pt, QWindow *window = 0) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setScreenPos(mapToScreen(window, pt)); + p.setState(Qt::TouchPointReleased); + return *this; + } QTouchEventSequence& stationary(int touchId) { QTouchEvent::TouchPoint &p = point(touchId); @@ -110,6 +132,10 @@ namespace QTest : targetWidget(widget), deviceType(aDeviceType) { } + QTouchEventSequence(QWindow *window, QTouchEvent::DeviceType aDeviceType) + : targetWindow(window), deviceType(aDeviceType) + { + } QTouchEventSequence(const QTouchEventSequence &v); void operator=(const QTouchEventSequence&); @@ -125,16 +151,53 @@ namespace QTest return widget->mapToGlobal(pt); return targetWidget ? targetWidget->mapToGlobal(pt) : pt; } + QPoint mapToScreen(QWindow *window, const QPoint &pt) + { + if(window) + return window->mapToGlobal(pt); + return targetWindow ? targetWindow->mapToGlobal(pt) : pt; + } + QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& point) + { + QWindowSystemInterface::TouchPoint p; + p.id = point.id(); + p.isPrimary = point.isPrimary(); + p.normalPosition = point.screenRect().topLeft(); + p.area = point.screenRect(); + p.pressure = point.pressure(); + p.state = point.state(); + return p; + } + QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList) + { + QList<struct QWindowSystemInterface::TouchPoint> newList; + + foreach(QTouchEvent::TouchPoint p, pointList) + { + newList.append(touchPoint(p)); + } + return newList; + } void commit() { - qt_translateRawTouchEvent(targetWidget, deviceType, points.values()); - targetWidget = 0; + if(targetWindow) + { + QWindowSystemInterface::handleTouchEvent(targetWindow,QEvent::None,deviceType, touchPointList(points.values())); + targetWindow = 0; + } + else if(targetWidget) + { + qt_translateRawTouchEvent(targetWidget, deviceType, points.values()); + targetWidget = 0; + } } QMap<int, QTouchEvent::TouchPoint> points; QWidget *targetWidget; + QWindow *targetWindow; QTouchEvent::DeviceType deviceType; friend QTouchEventSequence touchEvent(QWidget *, QTouchEvent::DeviceType); + friend QTouchEventSequence touchEvent(QWindow *, QTouchEvent::DeviceType); }; inline @@ -143,6 +206,12 @@ namespace QTest { return QTouchEventSequence(widget, deviceType); } + inline + QTouchEventSequence touchEvent(QWindow *window = 0, + QTouchEvent::DeviceType deviceType = QTouchEvent::TouchScreen) + { + return QTouchEventSequence(window, deviceType); + } } diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index d4dec9660e0..e8858ea1c42 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -2,7 +2,7 @@ load(qt_module) TARGET = QtTest QPRO_PWD = $$PWD -QT = core +QT = core gui widgets CONFIG += module MODULE_PRI = ../modules/qt_testlib.pri diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 6ff948c8e8e..11d35b75095 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -108,7 +108,6 @@ else:unix:SOURCES += ../../corelib/tools/qlocale_unix.cpp else:win32:SOURCES += ../../corelib/tools/qlocale_win.cpp macx: { - QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported) SOURCES += ../../corelib/io/qfilesystemengine_mac.cpp SOURCES += ../../corelib/kernel/qcore_mac.cpp LIBS += -framework CoreServices diff --git a/src/tools/idc/idc.pro b/src/tools/idc/idc.pro index c33de6797c6..5338ffb832d 100644 --- a/src/tools/idc/idc.pro +++ b/src/tools/idc/idc.pro @@ -6,6 +6,8 @@ build_all:!build_pass { CONFIG += release } +QT -= gui + DESTDIR = ../../../bin SOURCES = main.cpp diff --git a/src/tools/tools.pro b/src/tools/tools.pro index ca42da6edfb..47e216efc91 100644 --- a/src/tools/tools.pro +++ b/src/tools/tools.pro @@ -2,10 +2,6 @@ TEMPLATE = subdirs TOOLS_SUBDIRS = src_tools_bootstrap src_tools_moc src_tools_rcc !contains(QT_CONFIG, no-gui): TOOLS_SUBDIRS += src_tools_uic -!cross_compile { - win32:!wince*: SRC_SUBDIRS += src_tools_idc -} - # Set subdir and respective target name src_tools_bootstrap.subdir = $$QT_SOURCE_TREE/src/tools/bootstrap src_tools_bootstrap.target = sub-tools-bootstrap diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h index cf5a53deff9..09d275d8a10 100644 --- a/src/tools/uic/qclass_lib_map.h +++ b/src/tools/uic/qclass_lib_map.h @@ -603,163 +603,94 @@ QT_CLASS_LIB(QSQLite2Result, QtSql, qsql_sqlite2.h) QT_CLASS_LIB(QSQLite2Driver, QtSql, qsql_sqlite2.h) QT_CLASS_LIB(QTDSResult, QtSql, qsql_tds.h) QT_CLASS_LIB(QTDSDriver, QtSql, qsql_tds.h) -QT_CLASS_LIB(QAccessible, QtGui, qaccessible.h) -QT_CLASS_LIB(QAccessibleInterface, QtGui, qaccessible.h) -QT_CLASS_LIB(QAccessibleInterfaceEx, QtGui, qaccessible.h) -QT_CLASS_LIB(QAccessibleEvent, QtGui, qaccessible.h) -QT_CLASS_LIB(QAccessible2Interface, QtGui, qaccessible2.h) -QT_CLASS_LIB(QAccessibleTextInterface, QtGui, qaccessible2.h) -QT_CLASS_LIB(QAccessibleEditableTextInterface, QtGui, qaccessible2.h) -QT_CLASS_LIB(QAccessibleSimpleEditableTextInterface, QtGui, qaccessible2.h) -QT_CLASS_LIB(QAccessibleValueInterface, QtGui, qaccessible2.h) -QT_CLASS_LIB(QAccessibleTableInterface, QtGui, qaccessible2.h) -QT_CLASS_LIB(QAccessibleActionInterface, QtGui, qaccessible2.h) -QT_CLASS_LIB(QAccessibleImageInterface, QtGui, qaccessible2.h) -QT_CLASS_LIB(QAccessibleBridge, QtGui, qaccessiblebridge.h) -QT_CLASS_LIB(QAccessibleBridgeFactoryInterface, QtGui, qaccessiblebridge.h) -QT_CLASS_LIB(QAccessibleBridgePlugin, QtGui, qaccessiblebridge.h) -QT_CLASS_LIB(QAccessibleObject, QtGui, qaccessibleobject.h) -QT_CLASS_LIB(QAccessibleObjectEx, QtGui, qaccessibleobject.h) -QT_CLASS_LIB(QAccessibleApplication, QtGui, qaccessibleobject.h) -QT_CLASS_LIB(QAccessibleFactoryInterface, QtGui, qaccessibleplugin.h) -QT_CLASS_LIB(QAccessiblePlugin, QtGui, qaccessibleplugin.h) -QT_CLASS_LIB(QAccessibleWidget, QtGui, qaccessiblewidget.h) -QT_CLASS_LIB(QAccessibleWidgetEx, QtGui, qaccessiblewidget.h) -QT_CLASS_LIB(QAbstractPageSetupDialog, QtGui, qabstractpagesetupdialog.h) -QT_CLASS_LIB(QAbstractPrintDialog, QtGui, qabstractprintdialog.h) -QT_CLASS_LIB(QColorDialog, QtGui, qcolordialog.h) -QT_CLASS_LIB(QDialog, QtGui, qdialog.h) -QT_CLASS_LIB(QErrorMessage, QtGui, qerrormessage.h) -QT_CLASS_LIB(QFileDialog, QtGui, qfiledialog.h) -QT_CLASS_LIB(QFileSystemModel, QtGui, qfilesystemmodel.h) -QT_CLASS_LIB(QFontDialog, QtGui, qfontdialog.h) -QT_CLASS_LIB(QInputDialog, QtGui, qinputdialog.h) -QT_CLASS_LIB(QMessageBox, QtGui, qmessagebox.h) -QT_CLASS_LIB(QPageSetupDialog, QtGui, qpagesetupdialog.h) -QT_CLASS_LIB(QUnixPrintWidget, QtGui, qprintdialog.h) -QT_CLASS_LIB(QPrintDialog, QtGui, qprintdialog.h) -QT_CLASS_LIB(QPrintPreviewDialog, QtGui, qprintpreviewdialog.h) -QT_CLASS_LIB(QProgressDialog, QtGui, qprogressdialog.h) -QT_CLASS_LIB(QWizard, QtGui, qwizard.h) -QT_CLASS_LIB(QWizardPage, QtGui, qwizard.h) -QT_CLASS_LIB(QGraphicsEffect, QtGui, qgraphicseffect.h) -QT_CLASS_LIB(QGraphicsColorizeEffect, QtGui, qgraphicseffect.h) -QT_CLASS_LIB(QGraphicsBlurEffect, QtGui, qgraphicseffect.h) -QT_CLASS_LIB(QGraphicsDropShadowEffect, QtGui, qgraphicseffect.h) -QT_CLASS_LIB(QGraphicsOpacityEffect, QtGui, qgraphicseffect.h) -QT_CLASS_LIB(QCopChannel, QtGui, qcopchannel_qws.h) -QT_CLASS_LIB(QDecorationAction, QtGui, qdecoration_qws.h) -QT_CLASS_LIB(QDecoration, QtGui, qdecoration_qws.h) -QT_CLASS_LIB(QDecorationDefault, QtGui, qdecorationdefault_qws.h) -QT_CLASS_LIB(QDecorationFactory, QtGui, qdecorationfactory_qws.h) -QT_CLASS_LIB(QDecorationFactoryInterface, QtGui, qdecorationplugin_qws.h) -QT_CLASS_LIB(QDecorationPlugin, QtGui, qdecorationplugin_qws.h) -QT_CLASS_LIB(QDecorationStyled, QtGui, qdecorationstyled_qws.h) -QT_CLASS_LIB(QDecorationWindows, QtGui, qdecorationwindows_qws.h) -QT_CLASS_LIB(QDirectPainter, QtGui, qdirectpainter_qws.h) -QT_CLASS_LIB(QWSKeyboardHandler, QtGui, qkbd_qws.h) -QT_CLASS_LIB(QKbdDriverFactory, QtGui, qkbddriverfactory_qws.h) -QT_CLASS_LIB(QWSKeyboardHandlerFactoryInterface, QtGui, qkbddriverplugin_qws.h) -QT_CLASS_LIB(QKbdDriverPlugin, QtGui, qkbddriverplugin_qws.h) -QT_CLASS_LIB(QWSLinuxInputKeyboardHandler, QtGui, qkbdlinuxinput_qws.h) -QT_CLASS_LIB(QWSQnxKeyboardHandler, QtGui, qkbdqnx_qws.h) -QT_CLASS_LIB(QWSTtyKeyboardHandler, QtGui, qkbdtty_qws.h) -QT_CLASS_LIB(QWSUmKeyboardHandler, QtGui, qkbdum_qws.h) -QT_CLASS_LIB(QVFbKeyboardHandler, QtGui, qkbdvfb_qws.h) -QT_CLASS_LIB(QWSPointerCalibrationData, QtGui, qmouse_qws.h) -QT_CLASS_LIB(QWSMouseHandler, QtGui, qmouse_qws.h) -QT_CLASS_LIB(QWSCalibratedMouseHandler, QtGui, qmouse_qws.h) -QT_CLASS_LIB(QMouseDriverFactory, QtGui, qmousedriverfactory_qws.h) -QT_CLASS_LIB(QWSMouseHandlerFactoryInterface, QtGui, qmousedriverplugin_qws.h) -QT_CLASS_LIB(QMouseDriverPlugin, QtGui, qmousedriverplugin_qws.h) -QT_CLASS_LIB(QWSLinuxInputMouseHandler, QtGui, qmouselinuxinput_qws.h) -QT_CLASS_LIB(QWSLinuxTPMouseHandler, QtGui, qmouselinuxtp_qws.h) -QT_CLASS_LIB(QWSPcMouseHandler, QtGui, qmousepc_qws.h) -QT_CLASS_LIB(QQnxMouseHandler, QtGui, qmouseqnx_qws.h) -QT_CLASS_LIB(QWSTslibMouseHandler, QtGui, qmousetslib_qws.h) -QT_CLASS_LIB(QVFbMouseHandler, QtGui, qmousevfb_qws.h) -QT_CLASS_LIB(QScreenCursor, QtGui, qscreen_qws.h) -QT_CLASS_LIB(QPoolEntry, QtGui, qscreen_qws.h) -QT_CLASS_LIB(QScreen, QtGui, qscreen_qws.h) -QT_CLASS_LIB(QScreenDriverFactory, QtGui, qscreendriverfactory_qws.h) -QT_CLASS_LIB(QScreenDriverFactoryInterface, QtGui, qscreendriverplugin_qws.h) -QT_CLASS_LIB(QScreenDriverPlugin, QtGui, qscreendriverplugin_qws.h) -QT_CLASS_LIB(QLinuxFb_Shared, QtGui, qscreenlinuxfb_qws.h) -QT_CLASS_LIB(QLinuxFbScreen, QtGui, qscreenlinuxfb_qws.h) -QT_CLASS_LIB(QProxyScreenCursor, QtGui, qscreenproxy_qws.h) -QT_CLASS_LIB(QProxyScreen, QtGui, qscreenproxy_qws.h) -QT_CLASS_LIB(QQnxScreen, QtGui, qscreenqnx_qws.h) -QT_CLASS_LIB(QTransformedScreen, QtGui, qscreentransformed_qws.h) -QT_CLASS_LIB(QVFbScreen, QtGui, qscreenvfb_qws.h) -QT_CLASS_LIB(QWSSoundServer, QtGui, qsoundqss_qws.h) -QT_CLASS_LIB(QWSSoundClient, QtGui, qsoundqss_qws.h) -QT_CLASS_LIB(QWSSoundServerSocket, QtGui, qsoundqss_qws.h) -QT_CLASS_LIB(QTransportAuth, QtGui, qtransportauth_qws.h) -QT_CLASS_LIB(QAuthDevice, QtGui, qtransportauth_qws.h) -QT_CLASS_LIB(QVFbHeader, QtGui, qvfbhdr.h) -QT_CLASS_LIB(QVFbKeyData, QtGui, qvfbhdr.h) -QT_CLASS_LIB(QWSInternalWindowInfo, QtGui, qwindowsystem_qws.h) -QT_CLASS_LIB(QWSScreenSaver, QtGui, qwindowsystem_qws.h) -QT_CLASS_LIB(QWSWindow, QtGui, qwindowsystem_qws.h) -QT_CLASS_LIB(QWSSoundServer, QtGui, qwindowsystem_qws.h) -QT_CLASS_LIB(QWSServer, QtGui, qwindowsystem_qws.h) -QT_CLASS_LIB(QWSInputMethod, QtGui, qwindowsystem_qws.h) -QT_CLASS_LIB(QWSCursorMap, QtGui, qwindowsystem_qws.h) -QT_CLASS_LIB(QWSClient, QtGui, qwindowsystem_qws.h) -QT_CLASS_LIB(QWSCursor, QtGui, qwscursor_qws.h) -QT_CLASS_LIB(QWSWindowInfo, QtGui, qwsdisplay_qws.h) -QT_CLASS_LIB(QWSDisplay, QtGui, qwsdisplay_qws.h) -QT_CLASS_LIB(QWSEmbedWidget, QtGui, qwsembedwidget.h) -QT_CLASS_LIB(QWSEvent, QtGui, qwsevent_qws.h) -QT_CLASS_LIB(QWSManager, QtGui, qwsmanager_qws.h) -QT_CLASS_LIB(QWSPropertyManager, QtGui, qwsproperty_qws.h) -QT_CLASS_LIB(QWSProtocolItem, QtGui, qwsprotocolitem_qws.h) -QT_CLASS_LIB(QWSSocket, QtGui, qwssocket_qws.h) -QT_CLASS_LIB(QWSServerSocket, QtGui, qwssocket_qws.h) -QT_CLASS_LIB(QGraphicsAnchor, QtGui, qgraphicsanchorlayout.h) -QT_CLASS_LIB(QGraphicsAnchorLayout, QtGui, qgraphicsanchorlayout.h) -QT_CLASS_LIB(QGraphicsGridLayout, QtGui, qgraphicsgridlayout.h) -QT_CLASS_LIB(QGraphicsItem, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsObject, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QAbstractGraphicsShapeItem, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsPathItem, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsRectItem, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsEllipseItem, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsPolygonItem, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsLineItem, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsPixmapItem, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsTextItem, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsSimpleTextItem, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsItemGroup, QtGui, qgraphicsitem.h) -QT_CLASS_LIB(QGraphicsItemAnimation, QtGui, qgraphicsitemanimation.h) -QT_CLASS_LIB(QGraphicsLayout, QtGui, qgraphicslayout.h) -QT_CLASS_LIB(QGraphicsLayoutItem, QtGui, qgraphicslayoutitem.h) -QT_CLASS_LIB(QGraphicsLinearLayout, QtGui, qgraphicslinearlayout.h) -QT_CLASS_LIB(QGraphicsProxyWidget, QtGui, qgraphicsproxywidget.h) -QT_CLASS_LIB(QGraphicsScene, QtGui, qgraphicsscene.h) -QT_CLASS_LIB(QGraphicsSceneEvent, QtGui, qgraphicssceneevent.h) -QT_CLASS_LIB(QGraphicsSceneMouseEvent, QtGui, qgraphicssceneevent.h) -QT_CLASS_LIB(QGraphicsSceneWheelEvent, QtGui, qgraphicssceneevent.h) -QT_CLASS_LIB(QGraphicsSceneContextMenuEvent, QtGui, qgraphicssceneevent.h) -QT_CLASS_LIB(QGraphicsSceneHoverEvent, QtGui, qgraphicssceneevent.h) -QT_CLASS_LIB(QGraphicsSceneHelpEvent, QtGui, qgraphicssceneevent.h) -QT_CLASS_LIB(QGraphicsSceneDragDropEvent, QtGui, qgraphicssceneevent.h) -QT_CLASS_LIB(QGraphicsSceneResizeEvent, QtGui, qgraphicssceneevent.h) -QT_CLASS_LIB(QGraphicsSceneMoveEvent, QtGui, qgraphicssceneevent.h) -QT_CLASS_LIB(QGraphicsTransform, QtGui, qgraphicstransform.h) -QT_CLASS_LIB(QGraphicsScale, QtGui, qgraphicstransform.h) -QT_CLASS_LIB(QGraphicsRotation, QtGui, qgraphicstransform.h) -QT_CLASS_LIB(QGraphicsView, QtGui, qgraphicsview.h) -QT_CLASS_LIB(QGraphicsWidget, QtGui, qgraphicswidget.h) +QT_CLASS_LIB(QAccessible, QtWidgets, qaccessible.h) +QT_CLASS_LIB(QAccessibleInterface, QtWidgets, qaccessible.h) +QT_CLASS_LIB(QAccessibleInterfaceEx, QtWidgets, qaccessible.h) +QT_CLASS_LIB(QAccessibleEvent, QtWidgets, qaccessible.h) +QT_CLASS_LIB(QAccessible2Interface, QtWidgets, qaccessible2.h) +QT_CLASS_LIB(QAccessibleTextInterface, QtWidgets, qaccessible2.h) +QT_CLASS_LIB(QAccessibleEditableTextInterface, QtWidgets, qaccessible2.h) +QT_CLASS_LIB(QAccessibleSimpleEditableTextInterface, QtWidgets, qaccessible2.h) +QT_CLASS_LIB(QAccessibleValueInterface, QtWidgets, qaccessible2.h) +QT_CLASS_LIB(QAccessibleTableInterface, QtWidgets, qaccessible2.h) +QT_CLASS_LIB(QAccessibleActionInterface, QtWidgets, qaccessible2.h) +QT_CLASS_LIB(QAccessibleImageInterface, QtWidgets, qaccessible2.h) +QT_CLASS_LIB(QAccessibleBridge, QtWidgets, qaccessiblebridge.h) +QT_CLASS_LIB(QAccessibleBridgeFactoryInterface, QtWidgets, qaccessiblebridge.h) +QT_CLASS_LIB(QAccessibleBridgePlugin, QtWidgets, qaccessiblebridge.h) +QT_CLASS_LIB(QAccessibleObject, QtWidgets, qaccessibleobject.h) +QT_CLASS_LIB(QAccessibleObjectEx, QtWidgets, qaccessibleobject.h) +QT_CLASS_LIB(QAccessibleApplication, QtWidgets, qaccessibleobject.h) +QT_CLASS_LIB(QAccessibleFactoryInterface, QtWidgets, qaccessibleplugin.h) +QT_CLASS_LIB(QAccessiblePlugin, QtWidgets, qaccessibleplugin.h) +QT_CLASS_LIB(QAccessibleWidget, QtWidgets, qaccessiblewidget.h) +QT_CLASS_LIB(QAccessibleWidgetEx, QtWidgets, qaccessiblewidget.h) +QT_CLASS_LIB(QAbstractPageSetupDialog, QtWidgets, qabstractpagesetupdialog.h) +QT_CLASS_LIB(QAbstractPrintDialog, QtWidgets, qabstractprintdialog.h) +QT_CLASS_LIB(QColorDialog, QtWidgets, qcolordialog.h) +QT_CLASS_LIB(QDialog, QtWidgets, qdialog.h) +QT_CLASS_LIB(QErrorMessage, QtWidgets, qerrormessage.h) +QT_CLASS_LIB(QFileDialog, QtWidgets, qfiledialog.h) +QT_CLASS_LIB(QFileSystemModel, QtWidgets, qfilesystemmodel.h) +QT_CLASS_LIB(QFontDialog, QtWidgets, qfontdialog.h) +QT_CLASS_LIB(QInputDialog, QtWidgets, qinputdialog.h) +QT_CLASS_LIB(QMessageBox, QtWidgets, qmessagebox.h) +QT_CLASS_LIB(QPageSetupDialog, QtWidgets, qpagesetupdialog.h) +QT_CLASS_LIB(QUnixPrintWidget, QtWidgets, qprintdialog.h) +QT_CLASS_LIB(QPrintDialog, QtWidgets, qprintdialog.h) +QT_CLASS_LIB(QPrintPreviewDialog, QtWidgets, qprintpreviewdialog.h) +QT_CLASS_LIB(QProgressDialog, QtWidgets, qprogressdialog.h) +QT_CLASS_LIB(QWizard, QtWidgets, qwizard.h) +QT_CLASS_LIB(QWizardPage, QtWidgets, qwizard.h) +QT_CLASS_LIB(QGraphicsEffect, QtWidgets, qgraphicseffect.h) +QT_CLASS_LIB(QGraphicsColorizeEffect, QtWidgets, qgraphicseffect.h) +QT_CLASS_LIB(QGraphicsBlurEffect, QtWidgets, qgraphicseffect.h) +QT_CLASS_LIB(QGraphicsDropShadowEffect, QtWidgets, qgraphicseffect.h) +QT_CLASS_LIB(QGraphicsOpacityEffect, QtWidgets, qgraphicseffect.h) +QT_CLASS_LIB(QGraphicsAnchor, QtWidgets, qgraphicsanchorlayout.h) +QT_CLASS_LIB(QGraphicsAnchorLayout, QtWidgets, qgraphicsanchorlayout.h) +QT_CLASS_LIB(QGraphicsGridLayout, QtWidgets, qgraphicsgridlayout.h) +QT_CLASS_LIB(QGraphicsItem, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsObject, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QAbstractGraphicsShapeItem, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsPathItem, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsRectItem, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsEllipseItem, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsPolygonItem, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsLineItem, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsPixmapItem, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsTextItem, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsSimpleTextItem, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsItemGroup, QtWidgets, qgraphicsitem.h) +QT_CLASS_LIB(QGraphicsItemAnimation, QtWidgets, qgraphicsitemanimation.h) +QT_CLASS_LIB(QGraphicsLayout, QtWidgets, qgraphicslayout.h) +QT_CLASS_LIB(QGraphicsLayoutItem, QtWidgets, qgraphicslayoutitem.h) +QT_CLASS_LIB(QGraphicsLinearLayout, QtWidgets, qgraphicslinearlayout.h) +QT_CLASS_LIB(QGraphicsProxyWidget, QtWidgets, qgraphicsproxywidget.h) +QT_CLASS_LIB(QGraphicsScene, QtWidgets, qgraphicsscene.h) +QT_CLASS_LIB(QGraphicsSceneEvent, QtWidgets, qgraphicssceneevent.h) +QT_CLASS_LIB(QGraphicsSceneMouseEvent, QtWidgets, qgraphicssceneevent.h) +QT_CLASS_LIB(QGraphicsSceneWheelEvent, QtWidgets, qgraphicssceneevent.h) +QT_CLASS_LIB(QGraphicsSceneContextMenuEvent, QtWidgets, qgraphicssceneevent.h) +QT_CLASS_LIB(QGraphicsSceneHoverEvent, QtWidgets, qgraphicssceneevent.h) +QT_CLASS_LIB(QGraphicsSceneHelpEvent, QtWidgets, qgraphicssceneevent.h) +QT_CLASS_LIB(QGraphicsSceneDragDropEvent, QtWidgets, qgraphicssceneevent.h) +QT_CLASS_LIB(QGraphicsSceneResizeEvent, QtWidgets, qgraphicssceneevent.h) +QT_CLASS_LIB(QGraphicsSceneMoveEvent, QtWidgets, qgraphicssceneevent.h) +QT_CLASS_LIB(QGraphicsTransform, QtWidgets, qgraphicstransform.h) +QT_CLASS_LIB(QGraphicsScale, QtWidgets, qgraphicstransform.h) +QT_CLASS_LIB(QGraphicsRotation, QtWidgets, qgraphicstransform.h) +QT_CLASS_LIB(QGraphicsView, QtWidgets, qgraphicsview.h) +QT_CLASS_LIB(QGraphicsWidget, QtWidgets, qgraphicswidget.h) QT_CLASS_LIB(QBitmap, QtGui, qbitmap.h) -QT_CLASS_LIB(QIcon, QtGui, qicon.h) -QT_CLASS_LIB(QIconSet, QtGui, qicon.h) -QT_CLASS_LIB(QIconEngine, QtGui, qiconengine.h) -QT_CLASS_LIB(QIconEngineV2, QtGui, qiconengine.h) -QT_CLASS_LIB(QIconEngineFactoryInterface, QtGui, qiconengineplugin.h) -QT_CLASS_LIB(QIconEnginePlugin, QtGui, qiconengineplugin.h) -QT_CLASS_LIB(QIconEngineFactoryInterfaceV2, QtGui, qiconengineplugin.h) -QT_CLASS_LIB(QIconEnginePluginV2, QtGui, qiconengineplugin.h) +QT_CLASS_LIB(QIcon, QtWidgets, qicon.h) +QT_CLASS_LIB(QIconSet, QtWidgets, qicon.h) +QT_CLASS_LIB(QIconEngine, QtWidgets, qiconengine.h) +QT_CLASS_LIB(QIconEngineV2, QtWidgets, qiconengine.h) +QT_CLASS_LIB(QIconEngineFactoryInterface, QtWidgets, qiconengineplugin.h) +QT_CLASS_LIB(QIconEnginePlugin, QtWidgets, qiconengineplugin.h) +QT_CLASS_LIB(QIconEngineFactoryInterfaceV2, QtWidgets, qiconengineplugin.h) +QT_CLASS_LIB(QIconEnginePluginV2, QtWidgets, qiconengineplugin.h) QT_CLASS_LIB(QImageTextKeyLang, QtGui, qimage.h) QT_CLASS_LIB(QImage, QtGui, qimage.h) QT_CLASS_LIB(QImageIOHandler, QtGui, qimageiohandler.h) @@ -774,55 +705,55 @@ QT_CLASS_LIB(QPictureFormatInterface, QtGui, qpictureformatplugin.h) QT_CLASS_LIB(QPictureFormatPlugin, QtGui, qpictureformatplugin.h) QT_CLASS_LIB(QPixmap, QtGui, qpixmap.h) QT_CLASS_LIB(QPixmapCache, QtGui, qpixmapcache.h) -QT_CLASS_LIB(QInputContext, QtGui, qinputcontext.h) -QT_CLASS_LIB(QInputContextFactory, QtGui, qinputcontextfactory.h) -QT_CLASS_LIB(QInputContextFactoryInterface, QtGui, qinputcontextplugin.h) -QT_CLASS_LIB(QInputContextPlugin, QtGui, qinputcontextplugin.h) -QT_CLASS_LIB(QAbstractItemDelegate, QtGui, qabstractitemdelegate.h) -QT_CLASS_LIB(QAbstractItemView, QtGui, qabstractitemview.h) -QT_CLASS_LIB(QAbstractProxyModel, QtGui, qabstractproxymodel.h) -QT_CLASS_LIB(QColumnView, QtGui, qcolumnview.h) -QT_CLASS_LIB(QDataWidgetMapper, QtGui, qdatawidgetmapper.h) -QT_CLASS_LIB(QDirModel, QtGui, qdirmodel.h) -QT_CLASS_LIB(QFileIconProvider, QtGui, qfileiconprovider.h) -QT_CLASS_LIB(QHeaderView, QtGui, qheaderview.h) -QT_CLASS_LIB(QItemDelegate, QtGui, qitemdelegate.h) -QT_CLASS_LIB(QItemEditorCreatorBase, QtGui, qitemeditorfactory.h) -QT_CLASS_LIB(QItemEditorCreator, QtGui, qitemeditorfactory.h) -QT_CLASS_LIB(QStandardItemEditorCreator, QtGui, qitemeditorfactory.h) -QT_CLASS_LIB(QItemEditorFactory, QtGui, qitemeditorfactory.h) -QT_CLASS_LIB(QItemSelectionRange, QtGui, qitemselectionmodel.h) -QT_CLASS_LIB(QItemSelectionModel, QtGui, qitemselectionmodel.h) -QT_CLASS_LIB(QItemSelection, QtGui, qitemselectionmodel.h) -QT_CLASS_LIB(QListView, QtGui, qlistview.h) -QT_CLASS_LIB(QListWidgetItem, QtGui, qlistwidget.h) -QT_CLASS_LIB(QListWidget, QtGui, qlistwidget.h) -QT_CLASS_LIB(QProxyModel, QtGui, qproxymodel.h) -QT_CLASS_LIB(QSortFilterProxyModel, QtGui, qsortfilterproxymodel.h) -QT_CLASS_LIB(QStandardItem, QtGui, qstandarditemmodel.h) -QT_CLASS_LIB(QStandardItemModel, QtGui, qstandarditemmodel.h) -QT_CLASS_LIB(QStringListModel, QtGui, qstringlistmodel.h) -QT_CLASS_LIB(QStyledItemDelegate, QtGui, qstyleditemdelegate.h) -QT_CLASS_LIB(QTableView, QtGui, qtableview.h) -QT_CLASS_LIB(QTableWidgetSelectionRange, QtGui, qtablewidget.h) -QT_CLASS_LIB(QTableWidgetItem, QtGui, qtablewidget.h) -QT_CLASS_LIB(QTableWidget, QtGui, qtablewidget.h) -QT_CLASS_LIB(QTreeView, QtGui, qtreeview.h) -QT_CLASS_LIB(QTreeWidgetItem, QtGui, qtreewidget.h) -QT_CLASS_LIB(QTreeWidget, QtGui, qtreewidget.h) -QT_CLASS_LIB(QTreeWidgetItemIterator, QtGui, qtreewidgetitemiterator.h) -QT_CLASS_LIB(QAction, QtGui, qaction.h) -QT_CLASS_LIB(QActionGroup, QtGui, qactiongroup.h) -QT_CLASS_LIB(QApplication, QtGui, qapplication.h) -QT_CLASS_LIB(QBoxLayout, QtGui, qboxlayout.h) -QT_CLASS_LIB(QHBoxLayout, QtGui, qboxlayout.h) -QT_CLASS_LIB(QVBoxLayout, QtGui, qboxlayout.h) +QT_CLASS_LIB(QInputContext, QtWidgets, qinputcontext.h) +QT_CLASS_LIB(QInputContextFactory, QtWidgets, qinputcontextfactory.h) +QT_CLASS_LIB(QInputContextFactoryInterface, QtWidgets, qinputcontextplugin.h) +QT_CLASS_LIB(QInputContextPlugin, QtWidgets, qinputcontextplugin.h) +QT_CLASS_LIB(QAbstractItemDelegate, QtWidgets, qabstractitemdelegate.h) +QT_CLASS_LIB(QAbstractItemView, QtWidgets, qabstractitemview.h) +QT_CLASS_LIB(QAbstractProxyModel, QtWidgets, qabstractproxymodel.h) +QT_CLASS_LIB(QColumnView, QtWidgets, qcolumnview.h) +QT_CLASS_LIB(QDataWidgetMapper, QtWidgets, qdatawidgetmapper.h) +QT_CLASS_LIB(QDirModel, QtWidgets, qdirmodel.h) +QT_CLASS_LIB(QFileIconProvider, QtWidgets, qfileiconprovider.h) +QT_CLASS_LIB(QHeaderView, QtWidgets, qheaderview.h) +QT_CLASS_LIB(QItemDelegate, QtWidgets, qitemdelegate.h) +QT_CLASS_LIB(QItemEditorCreatorBase, QtWidgets, qitemeditorfactory.h) +QT_CLASS_LIB(QItemEditorCreator, QtWidgets, qitemeditorfactory.h) +QT_CLASS_LIB(QStandardItemEditorCreator, QtWidgets, qitemeditorfactory.h) +QT_CLASS_LIB(QItemEditorFactory, QtWidgets, qitemeditorfactory.h) +QT_CLASS_LIB(QItemSelectionRange, QtWidgets, qitemselectionmodel.h) +QT_CLASS_LIB(QItemSelectionModel, QtWidgets, qitemselectionmodel.h) +QT_CLASS_LIB(QItemSelection, QtWidgets, qitemselectionmodel.h) +QT_CLASS_LIB(QListView, QtWidgets, qlistview.h) +QT_CLASS_LIB(QListWidgetItem, QtWidgets, qlistwidget.h) +QT_CLASS_LIB(QListWidget, QtWidgets, qlistwidget.h) +QT_CLASS_LIB(QProxyModel, QtWidgets, qproxymodel.h) +QT_CLASS_LIB(QSortFilterProxyModel, QtWidgets, qsortfilterproxymodel.h) +QT_CLASS_LIB(QStandardItem, QtWidgets, qstandarditemmodel.h) +QT_CLASS_LIB(QStandardItemModel, QtWidgets, qstandarditemmodel.h) +QT_CLASS_LIB(QStringListModel, QtWidgets, qstringlistmodel.h) +QT_CLASS_LIB(QStyledItemDelegate, QtWidgets, qstyleditemdelegate.h) +QT_CLASS_LIB(QTableView, QtWidgets, qtableview.h) +QT_CLASS_LIB(QTableWidgetSelectionRange, QtWidgets, qtablewidget.h) +QT_CLASS_LIB(QTableWidgetItem, QtWidgets, qtablewidget.h) +QT_CLASS_LIB(QTableWidget, QtWidgets, qtablewidget.h) +QT_CLASS_LIB(QTreeView, QtWidgets, qtreeview.h) +QT_CLASS_LIB(QTreeWidgetItem, QtWidgets, qtreewidget.h) +QT_CLASS_LIB(QTreeWidget, QtWidgets, qtreewidget.h) +QT_CLASS_LIB(QTreeWidgetItemIterator, QtWidgets, qtreewidgetitemiterator.h) +QT_CLASS_LIB(QAction, QtWidgets, qaction.h) +QT_CLASS_LIB(QActionGroup, QtWidgets, qactiongroup.h) +QT_CLASS_LIB(QApplication, QtWidgets, qapplication.h) +QT_CLASS_LIB(QBoxLayout, QtWidgets, qboxlayout.h) +QT_CLASS_LIB(QHBoxLayout, QtWidgets, qboxlayout.h) +QT_CLASS_LIB(QVBoxLayout, QtWidgets, qboxlayout.h) QT_CLASS_LIB(QClipboard, QtGui, qclipboard.h) QT_CLASS_LIB(QCursor, QtGui, qcursor.h) QT_CLASS_LIB(QCursor, QtGui, qcursor.h) -QT_CLASS_LIB(QCursorShape, QtGui, qcursor.h) -QT_CLASS_LIB(QDesktopWidget, QtGui, qdesktopwidget.h) -QT_CLASS_LIB(QDrag, QtGui, qdrag.h) +QT_CLASS_LIB(QCursorShape, QtWidgets, qcursor.h) +QT_CLASS_LIB(QDesktopWidget, QtWidgets, qdesktopwidget.h) +QT_CLASS_LIB(QDrag, QtWidgets, qdrag.h) QT_CLASS_LIB(QtEvents, QtGui, qevent.h) QT_CLASS_LIB(QInputEvent, QtGui, qevent.h) QT_CLASS_LIB(QMouseEvent, QtGui, qevent.h) @@ -844,7 +775,6 @@ QT_CLASS_LIB(QInputMethodEvent, QtGui, qevent.h) QT_CLASS_LIB(QDropEvent, QtGui, qevent.h) QT_CLASS_LIB(QDragMoveEvent, QtGui, qevent.h) QT_CLASS_LIB(QDragEnterEvent, QtGui, qevent.h) -QT_CLASS_LIB(QDragResponseEvent, QtGui, qevent.h) QT_CLASS_LIB(QDragLeaveEvent, QtGui, qevent.h) QT_CLASS_LIB(QHelpEvent, QtGui, qevent.h) QT_CLASS_LIB(QStatusTipEvent, QtGui, qevent.h) @@ -860,37 +790,36 @@ QT_CLASS_LIB(QTouchEvent, QtGui, qevent.h) QT_CLASS_LIB(QGestureEvent, QtGui, qevent.h) QT_CLASS_LIB(QScrollPrepareEvent, QtGui, qevent.h) QT_CLASS_LIB(QScrollEvent, QtGui, qevent.h) -QT_CLASS_LIB(QFormLayout, QtGui, qformlayout.h) +QT_CLASS_LIB(QFormLayout, QtWidgets, qformlayout.h) QT_CLASS_LIB(QGenericPluginFactoryInterface, QtGui, qgenericplugin_qpa.h) QT_CLASS_LIB(QGenericPlugin, QtGui, qgenericplugin_qpa.h) QT_CLASS_LIB(QGenericPluginFactory, QtGui, qgenericpluginfactory_qpa.h) -QT_CLASS_LIB(QGesture, QtGui, qgesture.h) -QT_CLASS_LIB(QPanGesture, QtGui, qgesture.h) -QT_CLASS_LIB(QPinchGesture, QtGui, qgesture.h) -QT_CLASS_LIB(QSwipeGesture, QtGui, qgesture.h) -QT_CLASS_LIB(QTapGesture, QtGui, qgesture.h) -QT_CLASS_LIB(QTapAndHoldGesture, QtGui, qgesture.h) -QT_CLASS_LIB(QGestureRecognizer, QtGui, qgesturerecognizer.h) -QT_CLASS_LIB(QGridLayout, QtGui, qgridlayout.h) +QT_CLASS_LIB(QGesture, QtWidgets, qgesture.h) +QT_CLASS_LIB(QPanGesture, QtWidgets, qgesture.h) +QT_CLASS_LIB(QPinchGesture, QtWidgets, qgesture.h) +QT_CLASS_LIB(QSwipeGesture, QtWidgets, qgesture.h) +QT_CLASS_LIB(QTapGesture, QtWidgets, qgesture.h) +QT_CLASS_LIB(QTapAndHoldGesture, QtWidgets, qgesture.h) +QT_CLASS_LIB(QGestureRecognizer, QtWidgets, qgesturerecognizer.h) +QT_CLASS_LIB(QGridLayout, QtWidgets, qgridlayout.h) QT_CLASS_LIB(QKeySequence, QtGui, qkeysequence.h) QT_CLASS_LIB(QKeySequence, QtGui, qkeysequence.h) -QT_CLASS_LIB(QLayoutIterator, QtGui, qlayout.h) -QT_CLASS_LIB(QLayout, QtGui, qlayout.h) -QT_CLASS_LIB(QLayoutItem, QtGui, qlayoutitem.h) -QT_CLASS_LIB(QSpacerItem, QtGui, qlayoutitem.h) -QT_CLASS_LIB(QWidgetItem, QtGui, qlayoutitem.h) -QT_CLASS_LIB(QWidgetItemV2, QtGui, qlayoutitem.h) +QT_CLASS_LIB(QLayoutIterator, QtWidgets, qlayout.h) +QT_CLASS_LIB(QLayout, QtWidgets, qlayout.h) +QT_CLASS_LIB(QLayoutItem, QtWidgets, qlayoutitem.h) +QT_CLASS_LIB(QSpacerItem, QtWidgets, qlayoutitem.h) +QT_CLASS_LIB(QWidgetItem, QtWidgets, qlayoutitem.h) +QT_CLASS_LIB(QWidgetItemV2, QtWidgets, qlayoutitem.h) QT_CLASS_LIB(QMimeSource, QtGui, qmime.h) QT_CLASS_LIB(QWindowsMime, QtGui, qmime.h) QT_CLASS_LIB(QMacMime, QtGui, qmime.h) QT_CLASS_LIB(QMacPasteboardMime, QtGui, qmime.h) QT_CLASS_LIB(QPalette, QtGui, qpalette.h) -QT_CLASS_LIB(QColorGroup, QtGui, qpalette.h) +QT_CLASS_LIB(QColorGroup, QtWidgets, qpalette.h) QT_CLASS_LIB(QPlatformCursorImage, QtGui, qplatformcursor_qpa.h) QT_CLASS_LIB(QPlatformCursorPrivate, QtGui, qplatformcursor_qpa.h) QT_CLASS_LIB(QPlatformCursor, QtGui, qplatformcursor_qpa.h) -QT_CLASS_LIB(QPlatformEventLoopIntegration, QtGui, qplatformeventloopintegration_qpa.h) -QT_CLASS_LIB(QPlatformGLContext, QtGui, qplatformglcontext_qpa.h) +QT_CLASS_LIB(QPlatformOpenGLContext, QtGui, qplatformopenglcontext_qpa.h) QT_CLASS_LIB(QPlatformIntegration, QtGui, qplatformintegration_qpa.h) QT_CLASS_LIB(QPlatformIntegrationFactoryInterface, QtGui, qplatformintegrationplugin_qpa.h) QT_CLASS_LIB(QPlatformIntegrationPlugin, QtGui, qplatformintegrationplugin_qpa.h) @@ -898,22 +827,22 @@ QT_CLASS_LIB(QPlatformScreen, QtGui, qplatformscreen_qpa.h) QT_CLASS_LIB(QPlatformWindow, QtGui, qplatformwindow_qpa.h) QT_CLASS_LIB(QPlatformWindowFormat, QtGui, qplatformwindowformat_qpa.h) QT_CLASS_LIB(QSessionManager, QtGui, qsessionmanager.h) -QT_CLASS_LIB(QShortcut, QtGui, qshortcut.h) -QT_CLASS_LIB(QSizePolicy, QtGui, qsizepolicy.h) -QT_CLASS_LIB(QSound, QtGui, qsound.h) -QT_CLASS_LIB(QStackedLayout, QtGui, qstackedlayout.h) -QT_CLASS_LIB(QToolTip, QtGui, qtooltip.h) -QT_CLASS_LIB(QWhatsThis, QtGui, qwhatsthis.h) -QT_CLASS_LIB(QWidgetData, QtGui, qwidget.h) -QT_CLASS_LIB(QWidget, QtGui, qwidget.h) -QT_CLASS_LIB(QWidgetAction, QtGui, qwidgetaction.h) -QT_CLASS_LIB(QWidgetList, QtGui, qwindowdefs.h) -QT_CLASS_LIB(QWidgetMapper, QtGui, qwindowdefs.h) -QT_CLASS_LIB(QWidgetSet, QtGui, qwindowdefs.h) -QT_CLASS_LIB(QWindowSystemInterface, QtGui, qwindowsysteminterface_qpa.h) -QT_CLASS_LIB(QX11EmbedWidget, QtGui, qx11embed_x11.h) -QT_CLASS_LIB(QX11EmbedContainer, QtGui, qx11embed_x11.h) -QT_CLASS_LIB(QX11Info, QtGui, qx11info_x11.h) +QT_CLASS_LIB(QShortcut, QtWidgets, qshortcut.h) +QT_CLASS_LIB(QSizePolicy, QtWidgets, qsizepolicy.h) +QT_CLASS_LIB(QSound, QtWidgets, qsound.h) +QT_CLASS_LIB(QStackedLayout, QtWidgets, qstackedlayout.h) +QT_CLASS_LIB(QToolTip, QtWidgets, qtooltip.h) +QT_CLASS_LIB(QWhatsThis, QtWidgets, qwhatsthis.h) +QT_CLASS_LIB(QWidgetData, QtWidgets, qwidget.h) +QT_CLASS_LIB(QWidget, QtWidgets, qwidget.h) +QT_CLASS_LIB(QWidgetAction, QtWidgets, qwidgetaction.h) +QT_CLASS_LIB(QWidgetList, QtWidgets, qwindowdefs.h) +QT_CLASS_LIB(QWidgetMapper, QtWidgets, qwindowdefs.h) +QT_CLASS_LIB(QWidgetSet, QtWidgets, qwindowdefs.h) +QT_CLASS_LIB(QWindowSystemInterface, QtWidgets, qwindowsysteminterface_qpa.h) +QT_CLASS_LIB(QX11EmbedWidget, QtWidgets, qx11embed_x11.h) +QT_CLASS_LIB(QX11EmbedContainer, QtWidgets, qx11embed_x11.h) +QT_CLASS_LIB(QX11Info, QtWidgets, qx11info_x11.h) QT_CLASS_LIB(QGenericMatrix, QtGui, qgenericmatrix.h) QT_CLASS_LIB(QMatrix2x2, QtGui, qgenericmatrix.h) QT_CLASS_LIB(QMatrix2x3, QtGui, qgenericmatrix.h) @@ -960,80 +889,80 @@ QT_CLASS_LIB(QStylePainter, QtGui, qstylepainter.h) QT_CLASS_LIB(QTransform, QtGui, qtransform.h) QT_CLASS_LIB(QWMatrix, QtGui, qwmatrix.h) QT_CLASS_LIB(QS60MainApplicationBase, QtGui, qs60mainapplication.h) -QT_CLASS_LIB(QS60MainApplicationBase, QtGui, qs60mainapplication.h) -QT_CLASS_LIB(QS60MainApplication, QtGui, qs60mainapplication.h) -QT_CLASS_LIB(QS60MainAppUiBase, QtGui, qs60mainappui.h) -QT_CLASS_LIB(QS60StubAknAppUiBase, QtGui, qs60mainappui.h) -QT_CLASS_LIB(QS60StubMEikStatusPaneObserver, QtGui, qs60mainappui.h) -QT_CLASS_LIB(QS60StubMAknTouchPaneObserver, QtGui, qs60mainappui.h) -QT_CLASS_LIB(QS60StubAknAppUi, QtGui, qs60mainappui.h) -QT_CLASS_LIB(QS60MainAppUiBase, QtGui, qs60mainappui.h) -QT_CLASS_LIB(QS60MainAppUi, QtGui, qs60mainappui.h) -QT_CLASS_LIB(QS60MainDocumentBase, QtGui, qs60maindocument.h) -QT_CLASS_LIB(QS60MainDocumentBase, QtGui, qs60maindocument.h) -QT_CLASS_LIB(QS60MainDocument, QtGui, qs60maindocument.h) -QT_CLASS_LIB(QKeyEventTransition, QtGui, qkeyeventtransition.h) -QT_CLASS_LIB(QMouseEventTransition, QtGui, qmouseeventtransition.h) -QT_CLASS_LIB(QCDEStyle, QtGui, qcdestyle.h) -QT_CLASS_LIB(QCleanlooksStyle, QtGui, qcleanlooksstyle.h) -QT_CLASS_LIB(QCommonStyle, QtGui, qcommonstyle.h) -QT_CLASS_LIB(QGtkStyle, QtGui, qgtkstyle.h) -QT_CLASS_LIB(QMacStyle, QtGui, qmacstyle_mac.h) -QT_CLASS_LIB(QMotifStyle, QtGui, qmotifstyle.h) -QT_CLASS_LIB(QPlastiqueStyle, QtGui, qplastiquestyle.h) -QT_CLASS_LIB(QProxyStyle, QtGui, qproxystyle.h) -QT_CLASS_LIB(QS60Style, QtGui, qs60style.h) -QT_CLASS_LIB(QStyle, QtGui, qstyle.h) -QT_CLASS_LIB(QStyleFactory, QtGui, qstylefactory.h) -QT_CLASS_LIB(QStyleOption, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionFocusRect, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionFrame, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionFrameV2, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionFrameV3, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionTabWidgetFrame, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionTabWidgetFrameV2, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionTabBarBase, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionTabBarBaseV2, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionHeader, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionButton, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionTab, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionTabV2, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionTabV3, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionToolBar, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionProgressBar, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionProgressBarV2, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionMenuItem, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionQ3ListViewItem, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionQ3DockWindow, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionDockWidget, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionDockWidgetV2, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionViewItem, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionViewItemV2, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionViewItemV3, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionViewItemV4, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionToolBox, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionToolBoxV2, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionRubberBand, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionComplex, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionSlider, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionSpinBox, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionQ3ListView, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionToolButton, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionComboBox, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionTitleBar, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionGroupBox, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionSizeGrip, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleOptionGraphicsItem, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleHintReturn, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleHintReturnMask, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleHintReturnVariant, QtGui, qstyleoption.h) -QT_CLASS_LIB(QStyleFactoryInterface, QtGui, qstyleplugin.h) -QT_CLASS_LIB(QStylePlugin, QtGui, qstyleplugin.h) -QT_CLASS_LIB(QWindowsCEStyle, QtGui, qwindowscestyle.h) -QT_CLASS_LIB(QWindowsMobileStyle, QtGui, qwindowsmobilestyle.h) -QT_CLASS_LIB(QWindowsStyle, QtGui, qwindowsstyle.h) -QT_CLASS_LIB(QWindowsVistaStyle, QtGui, qwindowsvistastyle.h) -QT_CLASS_LIB(QWindowsXPStyle, QtGui, qwindowsxpstyle.h) +QT_CLASS_LIB(QS60MainApplicationBase, QtWidgets, qs60mainapplication.h) +QT_CLASS_LIB(QS60MainApplication, QtWidgets, qs60mainapplication.h) +QT_CLASS_LIB(QS60MainAppUiBase, QtWidgets, qs60mainappui.h) +QT_CLASS_LIB(QS60StubAknAppUiBase, QtWidgets, qs60mainappui.h) +QT_CLASS_LIB(QS60StubMEikStatusPaneObserver, QtWidgets, qs60mainappui.h) +QT_CLASS_LIB(QS60StubMAknTouchPaneObserver, QtWidgets, qs60mainappui.h) +QT_CLASS_LIB(QS60StubAknAppUi, QtWidgets, qs60mainappui.h) +QT_CLASS_LIB(QS60MainAppUiBase, QtWidgets, qs60mainappui.h) +QT_CLASS_LIB(QS60MainAppUi, QtWidgets, qs60mainappui.h) +QT_CLASS_LIB(QS60MainDocumentBase, QtWidgets, qs60maindocument.h) +QT_CLASS_LIB(QS60MainDocumentBase, QtWidgets, qs60maindocument.h) +QT_CLASS_LIB(QS60MainDocument, QtWidgets, qs60maindocument.h) +QT_CLASS_LIB(QKeyEventTransition, QtWidgets, qkeyeventtransition.h) +QT_CLASS_LIB(QMouseEventTransition, QtWidgets, qmouseeventtransition.h) +QT_CLASS_LIB(QCDEStyle, QtWidgets, qcdestyle.h) +QT_CLASS_LIB(QCleanlooksStyle, QtWidgets, qcleanlooksstyle.h) +QT_CLASS_LIB(QCommonStyle, QtWidgets, qcommonstyle.h) +QT_CLASS_LIB(QGtkStyle, QtWidgets, qgtkstyle.h) +QT_CLASS_LIB(QMacStyle, QtWidgets, qmacstyle_mac.h) +QT_CLASS_LIB(QMotifStyle, QtWidgets, qmotifstyle.h) +QT_CLASS_LIB(QPlastiqueStyle, QtWidgets, qplastiquestyle.h) +QT_CLASS_LIB(QProxyStyle, QtWidgets, qproxystyle.h) +QT_CLASS_LIB(QS60Style, QtWidgets, qs60style.h) +QT_CLASS_LIB(QStyle, QtWidgets, qstyle.h) +QT_CLASS_LIB(QStyleFactory, QtWidgets, qstylefactory.h) +QT_CLASS_LIB(QStyleOption, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionFocusRect, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionFrame, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionFrameV2, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionFrameV3, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionTabWidgetFrame, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionTabWidgetFrameV2, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionTabBarBase, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionTabBarBaseV2, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionHeader, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionButton, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionTab, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionTabV2, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionTabV3, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionToolBar, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionProgressBar, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionProgressBarV2, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionMenuItem, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionQ3ListViewItem, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionQ3DockWindow, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionDockWidget, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionDockWidgetV2, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionViewItem, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionViewItemV2, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionViewItemV3, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionViewItemV4, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionToolBox, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionToolBoxV2, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionRubberBand, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionComplex, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionSlider, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionSpinBox, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionQ3ListView, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionToolButton, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionComboBox, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionTitleBar, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionGroupBox, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionSizeGrip, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleOptionGraphicsItem, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleHintReturn, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleHintReturnMask, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleHintReturnVariant, QtWidgets, qstyleoption.h) +QT_CLASS_LIB(QStyleFactoryInterface, QtWidgets, qstyleplugin.h) +QT_CLASS_LIB(QStylePlugin, QtWidgets, qstyleplugin.h) +QT_CLASS_LIB(QWindowsCEStyle, QtWidgets, qwindowscestyle.h) +QT_CLASS_LIB(QWindowsMobileStyle, QtWidgets, qwindowsmobilestyle.h) +QT_CLASS_LIB(QWindowsStyle, QtWidgets, qwindowsstyle.h) +QT_CLASS_LIB(QWindowsVistaStyle, QtWidgets, qwindowsvistastyle.h) +QT_CLASS_LIB(QWindowsXPStyle, QtWidgets, qwindowsxpstyle.h) QT_CLASS_LIB(QSymbianEvent, QtGui, qsymbianevent.h) QT_CLASS_LIB(QFontEngineInfo, QtGui, qabstractfontengine_qws.h) QT_CLASS_LIB(QFontEngineFactoryInterface, QtGui, qabstractfontengine_qws.h) @@ -1078,76 +1007,76 @@ QT_CLASS_LIB(QTextBlock, QtGui, qtextobject.h) QT_CLASS_LIB(QTextFragment, QtGui, qtextobject.h) QT_CLASS_LIB(QTextOption, QtGui, qtextoption.h) QT_CLASS_LIB(QTextTableCell, QtGui, qtexttable.h) -QT_CLASS_LIB(QTextTable, QtGui, qtexttable.h) -QT_CLASS_LIB(QCompleter, QtGui, qcompleter.h) -QT_CLASS_LIB(QDesktopServices, QtGui, qdesktopservices.h) -QT_CLASS_LIB(QScroller, QtGui, qscroller.h) -QT_CLASS_LIB(QScrollerProperties, QtGui, qscrollerproperties.h) +QT_CLASS_LIB(QTextTable, QtWidgets, qtexttable.h) +QT_CLASS_LIB(QCompleter, QtWidgets, qcompleter.h) +QT_CLASS_LIB(QDesktopServices, QtWidgets, qdesktopservices.h) +QT_CLASS_LIB(QScroller, QtWidgets, qscroller.h) +QT_CLASS_LIB(QScrollerProperties, QtWidgets, qscrollerproperties.h) QT_CLASS_LIB(QSystemTrayIcon, QtGui, qsystemtrayicon.h) -QT_CLASS_LIB(QUndoGroup, QtGui, qundogroup.h) -QT_CLASS_LIB(QUndoCommand, QtGui, qundostack.h) -QT_CLASS_LIB(QUndoStack, QtGui, qundostack.h) -QT_CLASS_LIB(QUndoView, QtGui, qundoview.h) -QT_CLASS_LIB(QAbstractButton, QtGui, qabstractbutton.h) -QT_CLASS_LIB(QAbstractScrollArea, QtGui, qabstractscrollarea.h) -QT_CLASS_LIB(QAbstractSlider, QtGui, qabstractslider.h) -QT_CLASS_LIB(QAbstractSpinBox, QtGui, qabstractspinbox.h) -QT_CLASS_LIB(QButtonGroup, QtGui, qbuttongroup.h) -QT_CLASS_LIB(QCalendarWidget, QtGui, qcalendarwidget.h) -QT_CLASS_LIB(QCheckBox, QtGui, qcheckbox.h) -QT_CLASS_LIB(QComboBox, QtGui, qcombobox.h) -QT_CLASS_LIB(QCommandLinkButton, QtGui, qcommandlinkbutton.h) -QT_CLASS_LIB(QDateTimeEdit, QtGui, qdatetimeedit.h) -QT_CLASS_LIB(QTimeEdit, QtGui, qdatetimeedit.h) -QT_CLASS_LIB(QDateEdit, QtGui, qdatetimeedit.h) -QT_CLASS_LIB(QDial, QtGui, qdial.h) -QT_CLASS_LIB(QDialogButtonBox, QtGui, qdialogbuttonbox.h) -QT_CLASS_LIB(QDockWidget, QtGui, qdockwidget.h) -QT_CLASS_LIB(QFocusFrame, QtGui, qfocusframe.h) -QT_CLASS_LIB(QFontComboBox, QtGui, qfontcombobox.h) -QT_CLASS_LIB(QFrame, QtGui, qframe.h) -QT_CLASS_LIB(QGroupBox, QtGui, qgroupbox.h) -QT_CLASS_LIB(QLabel, QtGui, qlabel.h) -QT_CLASS_LIB(QLCDNumber, QtGui, qlcdnumber.h) -QT_CLASS_LIB(QLineEdit, QtGui, qlineedit.h) -QT_CLASS_LIB(QMacCocoaViewContainer, QtGui, qmaccocoaviewcontainer_mac.h) -QT_CLASS_LIB(QMacNativeWidget, QtGui, qmacnativewidget_mac.h) -QT_CLASS_LIB(QMainWindow, QtGui, qmainwindow.h) -QT_CLASS_LIB(QMdiArea, QtGui, qmdiarea.h) -QT_CLASS_LIB(QMdiSubWindow, QtGui, qmdisubwindow.h) -QT_CLASS_LIB(QMenu, QtGui, qmenu.h) -QT_CLASS_LIB(QMenuBar, QtGui, qmenubar.h) -QT_CLASS_LIB(QMenuItem, QtGui, qmenudata.h) -QT_CLASS_LIB(QPlainTextEdit, QtGui, qplaintextedit.h) -QT_CLASS_LIB(QPlainTextDocumentLayout, QtGui, qplaintextedit.h) -QT_CLASS_LIB(QPrintPreviewWidget, QtGui, qprintpreviewwidget.h) -QT_CLASS_LIB(QProgressBar, QtGui, qprogressbar.h) -QT_CLASS_LIB(QPushButton, QtGui, qpushbutton.h) -QT_CLASS_LIB(QRadioButton, QtGui, qradiobutton.h) -QT_CLASS_LIB(QRubberBand, QtGui, qrubberband.h) -QT_CLASS_LIB(QScrollArea, QtGui, qscrollarea.h) -QT_CLASS_LIB(QScrollBar, QtGui, qscrollbar.h) -QT_CLASS_LIB(QSizeGrip, QtGui, qsizegrip.h) -QT_CLASS_LIB(QSlider, QtGui, qslider.h) -QT_CLASS_LIB(QSpinBox, QtGui, qspinbox.h) -QT_CLASS_LIB(QDoubleSpinBox, QtGui, qspinbox.h) -QT_CLASS_LIB(QSplashScreen, QtGui, qsplashscreen.h) -QT_CLASS_LIB(QSplitter, QtGui, qsplitter.h) -QT_CLASS_LIB(QSplitterHandle, QtGui, qsplitter.h) -QT_CLASS_LIB(QStackedWidget, QtGui, qstackedwidget.h) -QT_CLASS_LIB(QStatusBar, QtGui, qstatusbar.h) -QT_CLASS_LIB(QTabBar, QtGui, qtabbar.h) -QT_CLASS_LIB(QTabWidget, QtGui, qtabwidget.h) -QT_CLASS_LIB(QTextBrowser, QtGui, qtextbrowser.h) -QT_CLASS_LIB(QTextEdit, QtGui, qtextedit.h) -QT_CLASS_LIB(QToolBar, QtGui, qtoolbar.h) -QT_CLASS_LIB(QToolBox, QtGui, qtoolbox.h) -QT_CLASS_LIB(QToolButton, QtGui, qtoolbutton.h) -QT_CLASS_LIB(QValidator, QtGui, qvalidator.h) -QT_CLASS_LIB(QIntValidator, QtGui, qvalidator.h) -QT_CLASS_LIB(QDoubleValidator, QtGui, qvalidator.h) -QT_CLASS_LIB(QRegExpValidator, QtGui, qvalidator.h) -QT_CLASS_LIB(QWorkspace, QtGui, qworkspace.h) +QT_CLASS_LIB(QUndoGroup, QtWidgets, qundogroup.h) +QT_CLASS_LIB(QUndoCommand, QtWidgets, qundostack.h) +QT_CLASS_LIB(QUndoStack, QtWidgets, qundostack.h) +QT_CLASS_LIB(QUndoView, QtWidgets, qundoview.h) +QT_CLASS_LIB(QAbstractButton, QtWidgets, qabstractbutton.h) +QT_CLASS_LIB(QAbstractScrollArea, QtWidgets, qabstractscrollarea.h) +QT_CLASS_LIB(QAbstractSlider, QtWidgets, qabstractslider.h) +QT_CLASS_LIB(QAbstractSpinBox, QtWidgets, qabstractspinbox.h) +QT_CLASS_LIB(QButtonGroup, QtWidgets, qbuttongroup.h) +QT_CLASS_LIB(QCalendarWidget, QtWidgets, qcalendarwidget.h) +QT_CLASS_LIB(QCheckBox, QtWidgets, qcheckbox.h) +QT_CLASS_LIB(QComboBox, QtWidgets, qcombobox.h) +QT_CLASS_LIB(QCommandLinkButton, QtWidgets, qcommandlinkbutton.h) +QT_CLASS_LIB(QDateTimeEdit, QtWidgets, qdatetimeedit.h) +QT_CLASS_LIB(QTimeEdit, QtWidgets, qdatetimeedit.h) +QT_CLASS_LIB(QDateEdit, QtWidgets, qdatetimeedit.h) +QT_CLASS_LIB(QDial, QtWidgets, qdial.h) +QT_CLASS_LIB(QDialogButtonBox, QtWidgets, qdialogbuttonbox.h) +QT_CLASS_LIB(QDockWidget, QtWidgets, qdockwidget.h) +QT_CLASS_LIB(QFocusFrame, QtWidgets, qfocusframe.h) +QT_CLASS_LIB(QFontComboBox, QtWidgets, qfontcombobox.h) +QT_CLASS_LIB(QFrame, QtWidgets, qframe.h) +QT_CLASS_LIB(QGroupBox, QtWidgets, qgroupbox.h) +QT_CLASS_LIB(QLabel, QtWidgets, qlabel.h) +QT_CLASS_LIB(QLCDNumber, QtWidgets, qlcdnumber.h) +QT_CLASS_LIB(QLineEdit, QtWidgets, qlineedit.h) +QT_CLASS_LIB(QMacCocoaViewContainer, QtWidgets, qmaccocoaviewcontainer_mac.h) +QT_CLASS_LIB(QMacNativeWidget, QtWidgets, qmacnativewidget_mac.h) +QT_CLASS_LIB(QMainWindow, QtWidgets, qmainwindow.h) +QT_CLASS_LIB(QMdiArea, QtWidgets, qmdiarea.h) +QT_CLASS_LIB(QMdiSubWindow, QtWidgets, qmdisubwindow.h) +QT_CLASS_LIB(QMenu, QtWidgets, qmenu.h) +QT_CLASS_LIB(QMenuBar, QtWidgets, qmenubar.h) +QT_CLASS_LIB(QMenuItem, QtWidgets, qmenudata.h) +QT_CLASS_LIB(QPlainTextEdit, QtWidgets, qplaintextedit.h) +QT_CLASS_LIB(QPlainTextDocumentLayout, QtWidgets, qplaintextedit.h) +QT_CLASS_LIB(QPrintPreviewWidget, QtWidgets, qprintpreviewwidget.h) +QT_CLASS_LIB(QProgressBar, QtWidgets, qprogressbar.h) +QT_CLASS_LIB(QPushButton, QtWidgets, qpushbutton.h) +QT_CLASS_LIB(QRadioButton, QtWidgets, qradiobutton.h) +QT_CLASS_LIB(QRubberBand, QtWidgets, qrubberband.h) +QT_CLASS_LIB(QScrollArea, QtWidgets, qscrollarea.h) +QT_CLASS_LIB(QScrollBar, QtWidgets, qscrollbar.h) +QT_CLASS_LIB(QSizeGrip, QtWidgets, qsizegrip.h) +QT_CLASS_LIB(QSlider, QtWidgets, qslider.h) +QT_CLASS_LIB(QSpinBox, QtWidgets, qspinbox.h) +QT_CLASS_LIB(QDoubleSpinBox, QtWidgets, qspinbox.h) +QT_CLASS_LIB(QSplashScreen, QtWidgets, qsplashscreen.h) +QT_CLASS_LIB(QSplitter, QtWidgets, qsplitter.h) +QT_CLASS_LIB(QSplitterHandle, QtWidgets, qsplitter.h) +QT_CLASS_LIB(QStackedWidget, QtWidgets, qstackedwidget.h) +QT_CLASS_LIB(QStatusBar, QtWidgets, qstatusbar.h) +QT_CLASS_LIB(QTabBar, QtWidgets, qtabbar.h) +QT_CLASS_LIB(QTabWidget, QtWidgets, qtabwidget.h) +QT_CLASS_LIB(QTextBrowser, QtWidgets, qtextbrowser.h) +QT_CLASS_LIB(QTextEdit, QtWidgets, qtextedit.h) +QT_CLASS_LIB(QToolBar, QtWidgets, qtoolbar.h) +QT_CLASS_LIB(QToolBox, QtWidgets, qtoolbox.h) +QT_CLASS_LIB(QToolButton, QtWidgets, qtoolbutton.h) +QT_CLASS_LIB(QValidator, QtWidgets, qvalidator.h) +QT_CLASS_LIB(QIntValidator, QtWidgets, qvalidator.h) +QT_CLASS_LIB(QDoubleValidator, QtWidgets, qvalidator.h) +QT_CLASS_LIB(QRegExpValidator, QtWidgets, qvalidator.h) +QT_CLASS_LIB(QWorkspace, QtWidgets, qworkspace.h) QT_CLASS_LIB(QScriptEngineDebugger, QtScriptTools, qscriptenginedebugger.h) QT_CLASS_LIB(QUiLoader, QtUiTools, quiloader.h) QT_CLASS_LIB(QDesignerComponents, QtDesigner, qdesigner_components.h) diff --git a/src/uitools/quiloader.cpp b/src/uitools/quiloader.cpp index 20f45851632..19d4277aed9 100644 --- a/src/uitools/quiloader.cpp +++ b/src/uitools/quiloader.cpp @@ -50,21 +50,21 @@ #include <ui4_p.h> #include <QtCore/qdebug.h> -#include <QtGui/QAction> -#include <QtGui/QActionGroup> -#include <QtGui/QApplication> +#include <QtWidgets/QAction> +#include <QtWidgets/QActionGroup> +#include <QtWidgets/QApplication> #include <QtCore/QDir> #include <QtCore/QLibraryInfo> -#include <QtGui/QLayout> -#include <QtGui/QWidget> +#include <QtWidgets/QLayout> +#include <QtWidgets/QWidget> #include <QtCore/QMap> -#include <QtGui/QTabWidget> -#include <QtGui/QTreeWidget> -#include <QtGui/QListWidget> -#include <QtGui/QTableWidget> -#include <QtGui/QToolBox> -#include <QtGui/QComboBox> -#include <QtGui/QFontComboBox> +#include <QtWidgets/QTabWidget> +#include <QtWidgets/QTreeWidget> +#include <QtWidgets/QListWidget> +#include <QtWidgets/QTableWidget> +#include <QtWidgets/QToolBox> +#include <QtWidgets/QComboBox> +#include <QtWidgets/QFontComboBox> QT_BEGIN_NAMESPACE diff --git a/src/v8/v8.pri b/src/v8/v8.pri index 79c4bd07147..1d1abc85c0b 100644 --- a/src/v8/v8.pri +++ b/src/v8/v8.pri @@ -9,6 +9,7 @@ equals(QT_ARCH, x86_64)|contains(CONFIG, x86_64):CONFIG += arch_x86_64 else:equals(QT_ARCH, "i386"):CONFIG += arch_i386 else:equals(QT_ARCH, "arm"):CONFIG += arch_arm else:equals(QMAKE_HOST.arch, armv7l):CONFIG += arch_arm +else:equals(QMAKE_HOST.arch, armv5tel):CONFIG += arch_arm else:equals(QMAKE_HOST.arch, x86_64):CONFIG += arch_x86_64 else:equals(QMAKE_HOST.arch, x86):CONFIG += arch_i386 else:equals(QMAKE_HOST.arch, i386):CONFIG += arch_i386 diff --git a/src/gui/QtGui.dynlist b/src/widgets/QtGui.dynlist similarity index 100% rename from src/gui/QtGui.dynlist rename to src/widgets/QtGui.dynlist diff --git a/src/gui/accessible/accessible.pri b/src/widgets/accessible/accessible.pri similarity index 94% rename from src/gui/accessible/accessible.pri rename to src/widgets/accessible/accessible.pri index 31362ffded5..ff75563eed1 100644 --- a/src/gui/accessible/accessible.pri +++ b/src/widgets/accessible/accessible.pri @@ -12,11 +12,11 @@ contains(QT_CONFIG, accessibility) { accessible/qaccessiblewidget.cpp \ accessible/qaccessibleplugin.cpp - mac:!embedded:!qpa { + mac:!qpa { HEADERS += accessible/qaccessible_mac_p.h OBJECTIVE_SOURCES += accessible/qaccessible_mac.mm \ accessible/qaccessible_mac_cocoa.mm - } else:win32 { + } else:win32:!qpa { SOURCES += accessible/qaccessible_win.cpp } else { HEADERS += accessible/qaccessiblebridge.h diff --git a/src/gui/accessible/qaccessible.cpp b/src/widgets/accessible/qaccessible.cpp similarity index 100% rename from src/gui/accessible/qaccessible.cpp rename to src/widgets/accessible/qaccessible.cpp diff --git a/src/gui/accessible/qaccessible.h b/src/widgets/accessible/qaccessible.h similarity index 98% rename from src/gui/accessible/qaccessible.h rename to src/widgets/accessible/qaccessible.h index 24a67446435..3a598108664 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/widgets/accessible/qaccessible.h @@ -61,7 +61,7 @@ QT_MODULE(Gui) class QAccessibleInterface; -class Q_GUI_EXPORT QAccessible +class Q_WIDGETS_EXPORT QAccessible { public: enum Event { @@ -365,7 +365,7 @@ class QAccessibleActionInterface; class QAccessibleImageInterface; class QAccessibleTable2Interface; -class Q_GUI_EXPORT QAccessibleInterface : public QAccessible +class Q_WIDGETS_EXPORT QAccessibleInterface : public QAccessible { public: virtual ~QAccessibleInterface() {} @@ -434,7 +434,7 @@ private: QAccessible2Interface *cast_helper(QAccessible2::InterfaceType); }; -class Q_GUI_EXPORT QAccessibleInterfaceEx: public QAccessibleInterface +class Q_WIDGETS_EXPORT QAccessibleInterfaceEx: public QAccessibleInterface { public: virtual QVariant invokeMethodEx(Method method, int child, const QVariantList ¶ms) = 0; @@ -444,7 +444,7 @@ public: }; -class Q_GUI_EXPORT QAccessibleEvent : public QEvent +class Q_WIDGETS_EXPORT QAccessibleEvent : public QEvent { public: inline QAccessibleEvent(Type type, int child); diff --git a/src/gui/accessible/qaccessible2.cpp b/src/widgets/accessible/qaccessible2.cpp similarity index 97% rename from src/gui/accessible/qaccessible2.cpp rename to src/widgets/accessible/qaccessible2.cpp index 078ff13e2c1..896c2c89155 100644 --- a/src/gui/accessible/qaccessible2.cpp +++ b/src/widgets/accessible/qaccessible2.cpp @@ -137,7 +137,7 @@ QT_BEGIN_NAMESPACE /*! \internal */ -QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, +QString Q_WIDGETS_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString& text) { QTextBoundaryFinder::BoundaryType type; @@ -175,7 +175,7 @@ QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::Bound /*! \internal */ -QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, +QString Q_WIDGETS_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString& text) { QTextBoundaryFinder::BoundaryType type; @@ -210,7 +210,7 @@ QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::Bounda /*! \internal */ -QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, +QString Q_WIDGETS_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int *startOffset, int *endOffset, const QString& text) { QTextBoundaryFinder::BoundaryType type; diff --git a/src/gui/accessible/qaccessible2.h b/src/widgets/accessible/qaccessible2.h similarity index 94% rename from src/gui/accessible/qaccessible2.h rename to src/widgets/accessible/qaccessible2.h index 106b69efcf1..69c19499c22 100644 --- a/src/gui/accessible/qaccessible2.h +++ b/src/widgets/accessible/qaccessible2.h @@ -42,7 +42,7 @@ #ifndef QACCESSIBLE2_H #define QACCESSIBLE2_H -#include <QtGui/qaccessible.h> +#include <QtWidgets/qaccessible.h> QT_BEGIN_HEADER @@ -90,7 +90,7 @@ namespace QAccessible2 }; } -class Q_GUI_EXPORT QAccessible2Interface +class Q_WIDGETS_EXPORT QAccessible2Interface { public: virtual ~QAccessible2Interface() {} @@ -129,7 +129,7 @@ inline QAccessible2Interface *qAccessibleTable2CastHelper() { return 0; } } \ private: -class Q_GUI_EXPORT QAccessibleTextInterface: public QAccessible2Interface +class Q_WIDGETS_EXPORT QAccessibleTextInterface: public QAccessible2Interface { public: inline QAccessible2Interface *qAccessibleTextCastHelper() { return this; } @@ -157,7 +157,7 @@ public: virtual void scrollToSubstring(int startIndex, int endIndex) = 0; }; -class Q_GUI_EXPORT QAccessibleEditableTextInterface: public QAccessible2Interface +class Q_WIDGETS_EXPORT QAccessibleEditableTextInterface: public QAccessible2Interface { public: inline QAccessible2Interface *qAccessibleEditableTextCastHelper() { return this; } @@ -173,7 +173,7 @@ public: virtual void setAttributes(int startOffset, int endOffset, const QString &attributes) = 0; }; -class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface +class Q_WIDGETS_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEditableTextInterface { public: QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface); @@ -190,7 +190,7 @@ private: QAccessibleInterface *iface; }; -class Q_GUI_EXPORT QAccessibleValueInterface: public QAccessible2Interface +class Q_WIDGETS_EXPORT QAccessibleValueInterface: public QAccessible2Interface { public: inline QAccessible2Interface *qAccessibleValueCastHelper() { return this; } @@ -203,7 +203,7 @@ public: virtual QVariant minimumValue() = 0; }; -class Q_GUI_EXPORT QAccessibleTableInterface: public QAccessible2Interface +class Q_WIDGETS_EXPORT QAccessibleTableInterface: public QAccessible2Interface { public: inline QAccessible2Interface *qAccessibleTableCastHelper() { return this; } @@ -237,7 +237,7 @@ public: int *columnSpan, bool *isSelected) = 0; }; -class Q_GUI_EXPORT QAccessibleTable2CellInterface: public QAccessibleInterface +class Q_WIDGETS_EXPORT QAccessibleTable2CellInterface: public QAccessibleInterface { public: // Returns the number of columns occupied by this cell accessible. @@ -266,7 +266,7 @@ public: virtual bool isExpandable() const = 0; }; -class Q_GUI_EXPORT QAccessibleTable2Interface: public QAccessible2Interface +class Q_WIDGETS_EXPORT QAccessibleTable2Interface: public QAccessible2Interface { public: inline QAccessible2Interface *qAccessibleTable2CastHelper() { return this; } @@ -326,7 +326,7 @@ friend class QAbstractItemView; friend class QAbstractItemViewPrivate; }; -class Q_GUI_EXPORT QAccessibleActionInterface : public QAccessible2Interface +class Q_WIDGETS_EXPORT QAccessibleActionInterface : public QAccessible2Interface { public: inline QAccessible2Interface *qAccessibleActionCastHelper() { return this; } @@ -339,7 +339,7 @@ public: virtual QStringList keyBindings(int actionIndex) = 0; }; -class Q_GUI_EXPORT QAccessibleImageInterface : public QAccessible2Interface +class Q_WIDGETS_EXPORT QAccessibleImageInterface : public QAccessible2Interface { public: inline QAccessible2Interface *qAccessibleImageCastHelper() { return this; } diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/widgets/accessible/qaccessible_mac.mm similarity index 100% rename from src/gui/accessible/qaccessible_mac.mm rename to src/widgets/accessible/qaccessible_mac.mm diff --git a/src/gui/accessible/qaccessible_mac_carbon.cpp b/src/widgets/accessible/qaccessible_mac_carbon.cpp similarity index 100% rename from src/gui/accessible/qaccessible_mac_carbon.cpp rename to src/widgets/accessible/qaccessible_mac_carbon.cpp diff --git a/src/gui/accessible/qaccessible_mac_cocoa.mm b/src/widgets/accessible/qaccessible_mac_cocoa.mm similarity index 100% rename from src/gui/accessible/qaccessible_mac_cocoa.mm rename to src/widgets/accessible/qaccessible_mac_cocoa.mm diff --git a/src/gui/accessible/qaccessible_mac_p.h b/src/widgets/accessible/qaccessible_mac_p.h similarity index 100% rename from src/gui/accessible/qaccessible_mac_p.h rename to src/widgets/accessible/qaccessible_mac_p.h diff --git a/src/gui/accessible/qaccessible_unix.cpp b/src/widgets/accessible/qaccessible_unix.cpp similarity index 100% rename from src/gui/accessible/qaccessible_unix.cpp rename to src/widgets/accessible/qaccessible_unix.cpp diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/widgets/accessible/qaccessible_win.cpp similarity index 99% rename from src/gui/accessible/qaccessible_win.cpp rename to src/widgets/accessible/qaccessible_win.cpp index 79ac4422ffd..f09f4bb631f 100644 --- a/src/gui/accessible/qaccessible_win.cpp +++ b/src/widgets/accessible/qaccessible_win.cpp @@ -49,9 +49,9 @@ #include "qsettings.h" #include <QtCore/qmap.h> #include <QtCore/qpair.h> -#include <QtGui/qgraphicsitem.h> -#include <QtGui/qgraphicsscene.h> -#include <QtGui/qgraphicsview.h> +#include <QtWidgets/qgraphicsitem.h> +#include <QtWidgets/qgraphicsscene.h> +#include <QtWidgets/qgraphicsview.h> #include <winuser.h> #if !defined(WINABLEAPI) diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/widgets/accessible/qaccessiblebridge.cpp similarity index 100% rename from src/gui/accessible/qaccessiblebridge.cpp rename to src/widgets/accessible/qaccessiblebridge.cpp diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/widgets/accessible/qaccessiblebridge.h similarity index 93% rename from src/gui/accessible/qaccessiblebridge.h rename to src/widgets/accessible/qaccessiblebridge.h index 73edf51183b..0ea04501d00 100644 --- a/src/gui/accessible/qaccessiblebridge.h +++ b/src/widgets/accessible/qaccessiblebridge.h @@ -63,7 +63,7 @@ public: virtual void notifyAccessibilityUpdate(int, QAccessibleInterface*, int) = 0; }; -struct Q_GUI_EXPORT QAccessibleBridgeFactoryInterface : public QFactoryInterface +struct Q_WIDGETS_EXPORT QAccessibleBridgeFactoryInterface : public QFactoryInterface { virtual QAccessibleBridge *create(const QString& name) = 0; }; @@ -71,7 +71,7 @@ struct Q_GUI_EXPORT QAccessibleBridgeFactoryInterface : public QFactoryInterface #define QAccessibleBridgeFactoryInterface_iid "com.trolltech.Qt.QAccessibleBridgeFactoryInterface" Q_DECLARE_INTERFACE(QAccessibleBridgeFactoryInterface, QAccessibleBridgeFactoryInterface_iid) -class Q_GUI_EXPORT QAccessibleBridgePlugin : public QObject, public QAccessibleBridgeFactoryInterface +class Q_WIDGETS_EXPORT QAccessibleBridgePlugin : public QObject, public QAccessibleBridgeFactoryInterface { Q_OBJECT Q_INTERFACES(QAccessibleBridgeFactoryInterface:QFactoryInterface) diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/widgets/accessible/qaccessibleobject.cpp similarity index 100% rename from src/gui/accessible/qaccessibleobject.cpp rename to src/widgets/accessible/qaccessibleobject.cpp diff --git a/src/gui/accessible/qaccessibleobject.h b/src/widgets/accessible/qaccessibleobject.h similarity index 93% rename from src/gui/accessible/qaccessibleobject.h rename to src/widgets/accessible/qaccessibleobject.h index 8ebd285a6f7..f2ec2ba9c97 100644 --- a/src/gui/accessible/qaccessibleobject.h +++ b/src/widgets/accessible/qaccessibleobject.h @@ -42,7 +42,7 @@ #ifndef QACCESSIBLEOBJECT_H #define QACCESSIBLEOBJECT_H -#include <QtGui/qaccessible.h> +#include <QtWidgets/qaccessible.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QAccessibleObjectPrivate; class QObject; -class Q_GUI_EXPORT QAccessibleObject : public QAccessibleInterface +class Q_WIDGETS_EXPORT QAccessibleObject : public QAccessibleInterface { public: explicit QAccessibleObject(QObject *object); @@ -81,7 +81,7 @@ private: Q_DISABLE_COPY(QAccessibleObject) }; -class Q_GUI_EXPORT QAccessibleObjectEx : public QAccessibleInterfaceEx +class Q_WIDGETS_EXPORT QAccessibleObjectEx : public QAccessibleInterfaceEx { public: explicit QAccessibleObjectEx(QObject *object); @@ -106,7 +106,7 @@ private: Q_DISABLE_COPY(QAccessibleObjectEx) }; -class Q_GUI_EXPORT QAccessibleApplication : public QAccessibleObject +class Q_WIDGETS_EXPORT QAccessibleApplication : public QAccessibleObject { public: QAccessibleApplication(); diff --git a/src/gui/accessible/qaccessibleplugin.cpp b/src/widgets/accessible/qaccessibleplugin.cpp similarity index 100% rename from src/gui/accessible/qaccessibleplugin.cpp rename to src/widgets/accessible/qaccessibleplugin.cpp diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/widgets/accessible/qaccessibleplugin.h similarity index 92% rename from src/gui/accessible/qaccessibleplugin.h rename to src/widgets/accessible/qaccessibleplugin.h index 3db84469cac..a71a1433e1b 100644 --- a/src/gui/accessible/qaccessibleplugin.h +++ b/src/widgets/accessible/qaccessibleplugin.h @@ -42,7 +42,7 @@ #ifndef QACCESSIBLEPLUGIN_H #define QACCESSIBLEPLUGIN_H -#include <QtGui/qaccessible.h> +#include <QtWidgets/qaccessible.h> #include <QtCore/qfactoryinterface.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QStringList; class QAccessibleInterface; -struct Q_GUI_EXPORT QAccessibleFactoryInterface : public QAccessible, public QFactoryInterface +struct Q_WIDGETS_EXPORT QAccessibleFactoryInterface : public QAccessible, public QFactoryInterface { virtual QAccessibleInterface* create(const QString &key, QObject *object) = 0; }; @@ -66,7 +66,7 @@ Q_DECLARE_INTERFACE(QAccessibleFactoryInterface, QAccessibleFactoryInterface_iid class QAccessiblePluginPrivate; -class Q_GUI_EXPORT QAccessiblePlugin : public QObject, public QAccessibleFactoryInterface +class Q_WIDGETS_EXPORT QAccessiblePlugin : public QObject, public QAccessibleFactoryInterface { Q_OBJECT Q_INTERFACES(QAccessibleFactoryInterface:QFactoryInterface) diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp similarity index 99% rename from src/gui/accessible/qaccessiblewidget.cpp rename to src/widgets/accessible/qaccessiblewidget.cpp index 6a7d7e97cc9..05948dcc9c3 100644 --- a/src/gui/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -53,8 +53,8 @@ #include "qdebug.h" #include <qmath.h> #include <QRubberBand> -#include <QtGui/QFocusFrame> -#include <QtGui/QMenu> +#include <QFocusFrame> +#include <QMenu> QT_BEGIN_NAMESPACE @@ -100,12 +100,12 @@ static QString buddyString(const QWidget *widget) return QString(); } -QString Q_GUI_EXPORT qt_accStripAmp(const QString &text) +QString Q_WIDGETS_EXPORT qt_accStripAmp(const QString &text) { return QString(text).remove(QLatin1Char('&')); } -QString Q_GUI_EXPORT qt_accHotKey(const QString &text) +QString Q_WIDGETS_EXPORT qt_accHotKey(const QString &text) { #ifndef QT_NO_SHORTCUT if (text.isEmpty()) diff --git a/src/gui/accessible/qaccessiblewidget.h b/src/widgets/accessible/qaccessiblewidget.h similarity index 96% rename from src/gui/accessible/qaccessiblewidget.h rename to src/widgets/accessible/qaccessiblewidget.h index 1b7f82d4d96..3b68e30a633 100644 --- a/src/gui/accessible/qaccessiblewidget.h +++ b/src/widgets/accessible/qaccessiblewidget.h @@ -42,7 +42,7 @@ #ifndef QACCESSIBLEWIDGET_H #define QACCESSIBLEWIDGET_H -#include <QtGui/qaccessibleobject.h> +#include <QtWidgets/qaccessibleobject.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QAccessibleWidgetPrivate; -class Q_GUI_EXPORT QAccessibleWidget : public QAccessibleObject +class Q_WIDGETS_EXPORT QAccessibleWidget : public QAccessibleObject { public: explicit QAccessibleWidget(QWidget *o, Role r = Client, const QString& name = QString()); @@ -94,7 +94,7 @@ private: Q_DISABLE_COPY(QAccessibleWidget) }; -class Q_GUI_EXPORT QAccessibleWidgetEx : public QAccessibleObjectEx +class Q_WIDGETS_EXPORT QAccessibleWidgetEx : public QAccessibleObjectEx { public: explicit QAccessibleWidgetEx(QWidget *o, Role r = Client, const QString& name = QString()); diff --git a/src/gui/animation/animation.pri b/src/widgets/animation/animation.pri similarity index 100% rename from src/gui/animation/animation.pri rename to src/widgets/animation/animation.pri diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/widgets/animation/qguivariantanimation.cpp similarity index 100% rename from src/gui/animation/qguivariantanimation.cpp rename to src/widgets/animation/qguivariantanimation.cpp diff --git a/src/gui/dialogs/dialogs.pri b/src/widgets/dialogs/dialogs.pri similarity index 61% rename from src/gui/dialogs/dialogs.pri rename to src/widgets/dialogs/dialogs.pri index 6ba707c9d31..41d81b8afc1 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/widgets/dialogs/dialogs.pri @@ -1,10 +1,6 @@ # Qt dialogs module HEADERS += \ - dialogs/qabstractprintdialog.h \ - dialogs/qabstractprintdialog_p.h \ - dialogs/qabstractpagesetupdialog.h \ - dialogs/qabstractpagesetupdialog_p.h \ dialogs/qcolordialog.h \ dialogs/qcolordialog_p.h \ dialogs/qfscompleter_p.h \ @@ -17,22 +13,17 @@ HEADERS += \ dialogs/qfontdialog_p.h \ dialogs/qinputdialog.h \ dialogs/qmessagebox.h \ - dialogs/qpagesetupdialog.h \ - dialogs/qprintdialog.h \ dialogs/qprogressdialog.h \ dialogs/qsidebar_p.h \ dialogs/qfilesystemmodel.h \ dialogs/qfilesystemmodel_p.h \ dialogs/qfileinfogatherer_p.h \ - dialogs/qwizard.h \ - dialogs/qprintpreviewdialog.h + dialogs/qwizard.h -!embedded:!qpa:mac { +!qpa:mac { OBJECTIVE_SOURCES += dialogs/qfiledialog_mac.mm \ dialogs/qfontdialog_mac.mm \ - dialogs/qnspanelproxy_mac.mm \ - dialogs/qpagesetupdialog_mac.mm \ - dialogs/qprintdialog_mac.mm + dialogs/qnspanelproxy_mac.mm # Compile qcolordialog_mac.mm with exception support, disregarding the -no-exceptions # configure option. (qcolordialog_mac needs to catch exceptions thrown by cocoa) @@ -50,49 +41,22 @@ HEADERS += \ } win32 { + qpa:DEFINES += QT_NO_PRINTDIALOG + HEADERS += dialogs/qwizard_win_p.h \ dialogs/qfiledialog_win_p.h SOURCES += dialogs/qdialogsbinarycompat_win.cpp \ dialogs/qfiledialog_win.cpp \ - dialogs/qpagesetupdialog_win.cpp \ - dialogs/qprintdialog_win.cpp \ dialogs/qwizard_win.cpp !win32-borland:!wince*: LIBS += -lshell32 # the filedialog needs this library } -!mac:!embedded:!symbian:unix|qpa { - HEADERS += dialogs/qpagesetupdialog_unix_p.h - SOURCES += dialogs/qprintdialog_unix.cpp \ - dialogs/qpagesetupdialog_unix.cpp - FORMS += dialogs/qprintsettingsoutput.ui \ - dialogs/qprintwidget.ui \ - dialogs/qprintpropertieswidget.ui -} - -embedded { - contains(QT_CONFIG,qtopia) { - HEADERS += dialogs/qpagesetupdialog_unix_p.h - DEFINES += QTOPIA_PRINTDIALOG - SOURCES += dialogs/qprintdialog_qws.cpp \ - dialogs/qpagesetupdialog_unix.cpp - } else { - HEADERS += dialogs/qpagesetupdialog_unix_p.h - SOURCES += dialogs/qprintdialog_unix.cpp \ - dialogs/qpagesetupdialog_unix.cpp - FORMS += dialogs/qprintsettingsoutput.ui \ - dialogs/qprintwidget.ui \ - dialogs/qprintpropertieswidget.ui - } -} - wince*|symbian: FORMS += dialogs/qfiledialog_embedded.ui else: FORMS += dialogs/qfiledialog.ui INCLUDEPATH += $$PWD SOURCES += \ - dialogs/qabstractprintdialog.cpp \ - dialogs/qabstractpagesetupdialog.cpp \ dialogs/qcolordialog.cpp \ dialogs/qdialog.cpp \ dialogs/qerrormessage.cpp \ @@ -104,9 +68,7 @@ SOURCES += \ dialogs/qsidebar.cpp \ dialogs/qfilesystemmodel.cpp \ dialogs/qfileinfogatherer.cpp \ - dialogs/qpagesetupdialog.cpp \ dialogs/qwizard.cpp \ - dialogs/qprintpreviewdialog.cpp symbian:contains(QT_CONFIG, s60) { LIBS += -lCommonDialogs @@ -114,8 +76,6 @@ symbian:contains(QT_CONFIG, s60) { dialogs/qcolordialog_symbian.cpp } -FORMS += dialogs/qpagesetupwidget.ui -RESOURCES += dialogs/qprintdialog.qrc RESOURCES += dialogs/qmessagebox.qrc # Compensate for lack of platform defines in Symbian3 diff --git a/src/gui/dialogs/images/qtlogo-64.png b/src/widgets/dialogs/images/qtlogo-64.png similarity index 100% rename from src/gui/dialogs/images/qtlogo-64.png rename to src/widgets/dialogs/images/qtlogo-64.png diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp similarity index 99% rename from src/gui/dialogs/qcolordialog.cpp rename to src/widgets/dialogs/qcolordialog.cpp index 015787433c0..b26e9118992 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -48,6 +48,7 @@ #include "qdrawutil.h" #include "qevent.h" #include "qimage.h" +#include "qdrag.h" #include "qlabel.h" #include "qlayout.h" #include "qlineedit.h" diff --git a/src/gui/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h similarity index 98% rename from src/gui/dialogs/qcolordialog.h rename to src/widgets/dialogs/qcolordialog.h index 7110069addd..2eb4658634e 100644 --- a/src/gui/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -42,7 +42,7 @@ #ifndef QCOLORDIALOG_H #define QCOLORDIALOG_H -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QColorDialogPrivate; -class Q_GUI_EXPORT QColorDialog : public QDialog +class Q_WIDGETS_EXPORT QColorDialog : public QDialog { Q_OBJECT Q_DECLARE_PRIVATE(QColorDialog) diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/widgets/dialogs/qcolordialog_mac.mm similarity index 100% rename from src/gui/dialogs/qcolordialog_mac.mm rename to src/widgets/dialogs/qcolordialog_mac.mm diff --git a/src/gui/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h similarity index 100% rename from src/gui/dialogs/qcolordialog_p.h rename to src/widgets/dialogs/qcolordialog_p.h diff --git a/src/gui/dialogs/qcolordialog_symbian.cpp b/src/widgets/dialogs/qcolordialog_symbian.cpp similarity index 100% rename from src/gui/dialogs/qcolordialog_symbian.cpp rename to src/widgets/dialogs/qcolordialog_symbian.cpp diff --git a/src/gui/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp similarity index 100% rename from src/gui/dialogs/qdialog.cpp rename to src/widgets/dialogs/qdialog.cpp diff --git a/src/gui/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h similarity index 97% rename from src/gui/dialogs/qdialog.h rename to src/widgets/dialogs/qdialog.h index adec044ada1..ce8aa91bc77 100644 --- a/src/gui/dialogs/qdialog.h +++ b/src/widgets/dialogs/qdialog.h @@ -42,7 +42,7 @@ #ifndef QDIALOG_H #define QDIALOG_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) class QPushButton; class QDialogPrivate; -class Q_GUI_EXPORT QDialog : public QWidget +class Q_WIDGETS_EXPORT QDialog : public QWidget { Q_OBJECT friend class QPushButton; diff --git a/src/gui/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h similarity index 97% rename from src/gui/dialogs/qdialog_p.h rename to src/widgets/dialogs/qdialog_p.h index 49ae18a10bb..3ee88f4703e 100644 --- a/src/gui/dialogs/qdialog_p.h +++ b/src/widgets/dialogs/qdialog_p.h @@ -56,8 +56,8 @@ #include "private/qwidget_p.h" #include "QtCore/qeventloop.h" #include "QtCore/qpointer.h" -#include "QtGui/qdialog.h" -#include "QtGui/qpushbutton.h" +#include "QtWidgets/qdialog.h" +#include "QtWidgets/qpushbutton.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/dialogs/qdialogsbinarycompat_win.cpp b/src/widgets/dialogs/qdialogsbinarycompat_win.cpp similarity index 97% rename from src/gui/dialogs/qdialogsbinarycompat_win.cpp rename to src/widgets/dialogs/qdialogsbinarycompat_win.cpp index 0a29422c2eb..09c96eaafdb 100644 --- a/src/gui/dialogs/qdialogsbinarycompat_win.cpp +++ b/src/widgets/dialogs/qdialogsbinarycompat_win.cpp @@ -69,7 +69,7 @@ class QFontDialogPrivate; class QInputDialogPrivate; class QWidget; -class Q_GUI_EXPORT QColorDialog +class Q_WIDGETS_EXPORT QColorDialog { private: explicit QColorDialog(QWidget *, bool); @@ -92,7 +92,7 @@ bool QColorDialog::selectColor(const QColor &) { return false; } void QColorDialog::setSelectedAlpha(int) {} int QColorDialog::selectedAlpha() const { return 0; } -class Q_GUI_EXPORT QFontDialog +class Q_WIDGETS_EXPORT QFontDialog { private: explicit QFontDialog(QWidget *, bool, Qt::WindowFlags); @@ -118,7 +118,7 @@ void QFontDialog::updateStyles() {} void QFontDialog::updateSizes() {} QFont QFontDialog::getFont(bool *, const QFont *, QWidget *) { return QFont(); } -class Q_GUI_EXPORT QInputDialog +class Q_WIDGETS_EXPORT QInputDialog { private: enum Type { LineEdit, SpinBox, DoubleSpinBox, ComboBox, EditableComboBox }; diff --git a/src/gui/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp similarity index 100% rename from src/gui/dialogs/qerrormessage.cpp rename to src/widgets/dialogs/qerrormessage.cpp diff --git a/src/gui/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h similarity index 96% rename from src/gui/dialogs/qerrormessage.h rename to src/widgets/dialogs/qerrormessage.h index 45492dba890..a8805a23720 100644 --- a/src/gui/dialogs/qerrormessage.h +++ b/src/widgets/dialogs/qerrormessage.h @@ -42,7 +42,7 @@ #ifndef QERRORMESSAGE_H #define QERRORMESSAGE_H -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QErrorMessagePrivate; -class Q_GUI_EXPORT QErrorMessage: public QDialog +class Q_WIDGETS_EXPORT QErrorMessage: public QDialog { Q_OBJECT Q_DECLARE_PRIVATE(QErrorMessage) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp similarity index 99% rename from src/gui/dialogs/qfiledialog.cpp rename to src/widgets/dialogs/qfiledialog.cpp index 5e8533e3bcf..9d6e348b0d4 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -81,16 +81,16 @@ Q_GLOBAL_STATIC(QString, lastVisitedDir) Exported hooks that can be used to customize the static functions. */ typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options); -Q_GUI_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook = 0; +Q_WIDGETS_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook = 0; typedef QString (*_qt_filedialog_open_filename_hook)(QWidget * parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options); -Q_GUI_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook = 0; +Q_WIDGETS_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook = 0; typedef QStringList (*_qt_filedialog_open_filenames_hook)(QWidget * parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options); -Q_GUI_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook = 0; +Q_WIDGETS_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook = 0; typedef QString (*_qt_filedialog_save_filename_hook)(QWidget * parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options); -Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook = 0; +Q_WIDGETS_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook = 0; /*! \class QFileDialog @@ -296,7 +296,7 @@ Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook */ #if defined(Q_WS_WIN) || defined(Q_WS_MAC) -bool Q_GUI_EXPORT qt_use_native_dialogs = true; // for the benefit of testing tools, until we have a proper API +bool Q_WIDGETS_EXPORT qt_use_native_dialogs = true; // for the benefit of testing tools, until we have a proper API #endif QT_BEGIN_INCLUDE_NAMESPACE diff --git a/src/gui/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h similarity index 99% rename from src/gui/dialogs/qfiledialog.h rename to src/widgets/dialogs/qfiledialog.h index a0001907aec..1fd7c25255d 100644 --- a/src/gui/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -44,7 +44,7 @@ #include <QtCore/qdir.h> #include <QtCore/qstring.h> -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> QT_BEGIN_HEADER @@ -63,7 +63,7 @@ class QAbstractItemDelegate; class QAbstractProxyModel; class QUrl; -class Q_GUI_EXPORT QFileDialog : public QDialog +class Q_WIDGETS_EXPORT QFileDialog : public QDialog { Q_OBJECT Q_ENUMS(ViewMode FileMode AcceptMode Option) diff --git a/src/gui/dialogs/qfiledialog.ui b/src/widgets/dialogs/qfiledialog.ui similarity index 100% rename from src/gui/dialogs/qfiledialog.ui rename to src/widgets/dialogs/qfiledialog.ui diff --git a/src/gui/dialogs/qfiledialog_embedded.ui b/src/widgets/dialogs/qfiledialog_embedded.ui similarity index 100% rename from src/gui/dialogs/qfiledialog_embedded.ui rename to src/widgets/dialogs/qfiledialog_embedded.ui diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/widgets/dialogs/qfiledialog_mac.mm similarity index 100% rename from src/gui/dialogs/qfiledialog_mac.mm rename to src/widgets/dialogs/qfiledialog_mac.mm diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h similarity index 100% rename from src/gui/dialogs/qfiledialog_p.h rename to src/widgets/dialogs/qfiledialog_p.h diff --git a/src/gui/dialogs/qfiledialog_symbian.cpp b/src/widgets/dialogs/qfiledialog_symbian.cpp similarity index 100% rename from src/gui/dialogs/qfiledialog_symbian.cpp rename to src/widgets/dialogs/qfiledialog_symbian.cpp diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/widgets/dialogs/qfiledialog_win.cpp similarity index 97% rename from src/gui/dialogs/qfiledialog_win.cpp rename to src/widgets/dialogs/qfiledialog_win.cpp index de8e33d897a..8c3b3cfda70 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/widgets/dialogs/qfiledialog_win.cpp @@ -54,6 +54,7 @@ #include <qstringlist.h> #include <private/qsystemlibrary_p.h> #include "qfiledialog_win_p.h" +#include "qplatformnativeinterface_qpa.h" #ifndef QT_NO_THREAD # include <private/qmutexpool_p.h> @@ -217,7 +218,7 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent, memset(ofn, 0, sizeof(OPENFILENAME)); ofn->lStructSize = sizeof(OPENFILENAME); - ofn->hwndOwner = parent ? parent->winId() : 0; + ofn->hwndOwner = QApplicationPrivate::getHWNDForWidget(parent); ofn->lpstrFilter = (wchar_t*)tFilters.utf16(); ofn->lpstrFile = tInitSel; ofn->nMaxFile = maxLen; @@ -242,7 +243,20 @@ static void qt_win_clean_up_OFN(OPENFILENAME **ofn) *ofn = 0; } -extern void qt_win_eatMouseMove(); +void qt_win_eatMouseMove() +{ + // after closing a windows dialog with a double click (i.e. open a file) + // the message queue still contains a dubious WM_MOUSEMOVE message where + // the left button is reported to be down (wParam != 0). + // remove all those messages (usually 1) and post the last one with a + // reset button state + + MSG msg = {0, 0, 0, 0, 0, {0, 0} }; + while (PeekMessage(&msg, 0, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)) + ; + if (msg.message == WM_MOUSEMOVE) + PostMessage(msg.hwnd, msg.message, 0, msg.lParam); +} QString qt_win_get_open_file_name(const QFileDialogArgs &args, QString *initialDirectory, @@ -522,7 +536,7 @@ static QStringList qt_win_CID_get_open_file_names(const QFileDialogArgs &args, else parentWindow = QApplication::activeWindow(); // Show the file dialog. - hr = pfd->Show(parentWindow ? parentWindow->winId() : 0); + hr = pfd->Show(QApplicationPrivate::getHWNDForWidget(parentWindow)); if (SUCCEEDED(hr)) { // Retrieve the results. IShellItemArray *psiaResults; @@ -611,7 +625,7 @@ QString qt_win_CID_get_existing_directory(const QFileDialogArgs &args) parentWindow = QApplication::activeWindow(); // Show the file dialog. - hr = pfd->Show(parentWindow ? parentWindow->winId() : 0); + hr = pfd->Show(QApplicationPrivate::getHWNDForWidget(parentWindow)); if (SUCCEEDED(hr)) { // Retrieve the result IShellItem *psi = 0; @@ -786,7 +800,7 @@ QString qt_win_get_existing_directory(const QFileDialogArgs &args) qt_BROWSEINFO bi; Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created)); - bi.hwndOwner = (parent ? parent->winId() : 0); + bi.hwndOwner = QApplicationPrivate::getHWNDForWidget(parent); bi.pidlRoot = NULL; //### This does not seem to be respected? - the dialog always displays "Browse for folder" bi.lpszTitle = (wchar_t*)tTitle.utf16(); diff --git a/src/gui/dialogs/qfiledialog_win_p.h b/src/widgets/dialogs/qfiledialog_win_p.h similarity index 100% rename from src/gui/dialogs/qfiledialog_win_p.h rename to src/widgets/dialogs/qfiledialog_win_p.h diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp similarity index 100% rename from src/gui/dialogs/qfileinfogatherer.cpp rename to src/widgets/dialogs/qfileinfogatherer.cpp diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h similarity index 100% rename from src/gui/dialogs/qfileinfogatherer_p.h rename to src/widgets/dialogs/qfileinfogatherer_p.h diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp similarity index 100% rename from src/gui/dialogs/qfilesystemmodel.cpp rename to src/widgets/dialogs/qfilesystemmodel.cpp diff --git a/src/gui/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h similarity index 98% rename from src/gui/dialogs/qfilesystemmodel.h rename to src/widgets/dialogs/qfilesystemmodel.h index 0b1fa47b180..ce907cd10e5 100644 --- a/src/gui/dialogs/qfilesystemmodel.h +++ b/src/widgets/dialogs/qfilesystemmodel.h @@ -45,7 +45,7 @@ #include <QtCore/qabstractitemmodel.h> #include <QtCore/qpair.h> #include <QtCore/qdir.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qicon.h> #include <QtCore/qdiriterator.h> QT_BEGIN_HEADER @@ -60,7 +60,7 @@ class ExtendedInformation; class QFileSystemModelPrivate; class QFileIconProvider; -class Q_GUI_EXPORT QFileSystemModel : public QAbstractItemModel +class Q_WIDGETS_EXPORT QFileSystemModel : public QAbstractItemModel { Q_OBJECT Q_PROPERTY(bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks) diff --git a/src/gui/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h similarity index 100% rename from src/gui/dialogs/qfilesystemmodel_p.h rename to src/widgets/dialogs/qfilesystemmodel_p.h diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp similarity index 99% rename from src/gui/dialogs/qfontdialog.cpp rename to src/widgets/dialogs/qfontdialog.cpp index 6a646ff555f..df49fee9bbb 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -66,7 +66,7 @@ #include <private/qfont_p.h> #if defined(Q_WS_S60) -#include <QtGui/qdesktopwidget.h> +#include <QtWidgets/qdesktopwidget.h> #endif QT_BEGIN_NAMESPACE diff --git a/src/gui/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h similarity index 98% rename from src/gui/dialogs/qfontdialog.h rename to src/widgets/dialogs/qfontdialog.h index 8e4957d11e2..03ef2b7e813 100644 --- a/src/gui/dialogs/qfontdialog.h +++ b/src/widgets/dialogs/qfontdialog.h @@ -43,7 +43,7 @@ #define QFONTDIALOG_H #include <QtGui/qwindowdefs.h> -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> #include <QtGui/qfont.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QFontDialogPrivate; -class Q_GUI_EXPORT QFontDialog : public QDialog +class Q_WIDGETS_EXPORT QFontDialog : public QDialog { Q_OBJECT Q_DECLARE_PRIVATE(QFontDialog) diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/widgets/dialogs/qfontdialog_mac.mm similarity index 100% rename from src/gui/dialogs/qfontdialog_mac.mm rename to src/widgets/dialogs/qfontdialog_mac.mm diff --git a/src/gui/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h similarity index 100% rename from src/gui/dialogs/qfontdialog_p.h rename to src/widgets/dialogs/qfontdialog_p.h diff --git a/src/gui/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h similarity index 96% rename from src/gui/dialogs/qfscompleter_p.h rename to src/widgets/dialogs/qfscompleter_p.h index a3d21ab0392..e078542cdc2 100644 --- a/src/gui/dialogs/qfscompleter_p.h +++ b/src/widgets/dialogs/qfscompleter_p.h @@ -54,14 +54,14 @@ // #include "qcompleter.h" -#include <QtGui/qfilesystemmodel.h> +#include <QtWidgets/qfilesystemmodel.h> QT_BEGIN_NAMESPACE #ifndef QT_NO_FSCOMPLETER /*! QCompleter that can deal with QFileSystemModel */ -class QFSCompleter : public QCompleter { +class Q_WIDGETS_EXPORT QFSCompleter : public QCompleter { public: QFSCompleter(QFileSystemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(model) diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp similarity index 100% rename from src/gui/dialogs/qinputdialog.cpp rename to src/widgets/dialogs/qinputdialog.cpp diff --git a/src/gui/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h similarity index 98% rename from src/gui/dialogs/qinputdialog.h rename to src/widgets/dialogs/qinputdialog.h index 7853945130c..51411c7ae1d 100644 --- a/src/gui/dialogs/qinputdialog.h +++ b/src/widgets/dialogs/qinputdialog.h @@ -42,9 +42,9 @@ #ifndef QINPUTDIALOG_H #define QINPUTDIALOG_H -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> #include <QtCore/qstring.h> -#include <QtGui/qlineedit.h> +#include <QtWidgets/qlineedit.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QInputDialogPrivate; -class Q_GUI_EXPORT QInputDialog : public QDialog +class Q_WIDGETS_EXPORT QInputDialog : public QDialog { Q_OBJECT Q_DECLARE_PRIVATE(QInputDialog) diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp similarity index 99% rename from src/gui/dialogs/qmessagebox.cpp rename to src/widgets/dialogs/qmessagebox.cpp index 90ca080715c..26180ab38b0 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -39,27 +39,27 @@ ** ****************************************************************************/ -#include <QtGui/qmessagebox.h> +#include <QtWidgets/qmessagebox.h> #ifndef QT_NO_MESSAGEBOX -#include <QtGui/qdialogbuttonbox.h> +#include <QtWidgets/qdialogbuttonbox.h> #include "private/qlabel_p.h" #include "private/qapplication_p.h" #include <QtCore/qlist.h> #include <QtCore/qdebug.h> -#include <QtGui/qstyle.h> -#include <QtGui/qstyleoption.h> -#include <QtGui/qgridlayout.h> -#include <QtGui/qdesktopwidget.h> -#include <QtGui/qpushbutton.h> -#include <QtGui/qaccessible.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qstyle.h> +#include <QtWidgets/qstyleoption.h> +#include <QtWidgets/qgridlayout.h> +#include <QtWidgets/qdesktopwidget.h> +#include <QtWidgets/qpushbutton.h> +#include <QtWidgets/qaccessible.h> +#include <QtWidgets/qicon.h> #include <QtGui/qtextdocument.h> -#include <QtGui/qapplication.h> -#include <QtGui/qtextedit.h> -#include <QtGui/qtextbrowser.h> -#include <QtGui/qmenu.h> +#include <QtWidgets/qapplication.h> +#include <QtWidgets/qtextedit.h> +#include <QtWidgets/qtextbrowser.h> +#include <QtWidgets/qmenu.h> #include "qdialog_p.h" #include <QtGui/qfont.h> #include <QtGui/qfontmetrics.h> @@ -341,7 +341,7 @@ void QMessageBoxPrivate::updateSize() if (width > hardLimit) { label->d_func()->ensureTextControl(); - if (QTextControl *control = label->d_func()->control) { + if (QWidgetTextControl *control = label->d_func()->control) { QTextOption opt = control->document()->defaultTextOption(); opt.setWrapMode(QTextOption::WrapAnywhere); control->document()->setDefaultTextOption(opt); @@ -367,7 +367,7 @@ void QMessageBoxPrivate::updateSize() width = qMax(width, layoutMinimumWidth()); if (width > hardLimit) { // longest word is really big, so wrap anywhere informativeLabel->d_func()->ensureTextControl(); - if (QTextControl *control = informativeLabel->d_func()->control) { + if (QWidgetTextControl *control = informativeLabel->d_func()->control) { QTextOption opt = control->document()->defaultTextOption(); opt.setWrapMode(QTextOption::WrapAnywhere); control->document()->setDefaultTextOption(opt); @@ -1855,6 +1855,8 @@ static QMessageBox::StandardButton newButton(int button) default: return QMessageBox::NoButton; } +#else + return QMessageBox::NoButton; #endif } diff --git a/src/gui/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h similarity index 99% rename from src/gui/dialogs/qmessagebox.h rename to src/widgets/dialogs/qmessagebox.h index f21562d8999..b2c99d3881d 100644 --- a/src/gui/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -42,7 +42,7 @@ #ifndef QMESSAGEBOX_H #define QMESSAGEBOX_H -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ class QLabel; class QMessageBoxPrivate; class QAbstractButton; -class Q_GUI_EXPORT QMessageBox : public QDialog +class Q_WIDGETS_EXPORT QMessageBox : public QDialog { Q_OBJECT Q_ENUMS(Icon) diff --git a/src/gui/dialogs/qmessagebox.qrc b/src/widgets/dialogs/qmessagebox.qrc similarity index 100% rename from src/gui/dialogs/qmessagebox.qrc rename to src/widgets/dialogs/qmessagebox.qrc diff --git a/src/gui/dialogs/qnspanelproxy_mac.mm b/src/widgets/dialogs/qnspanelproxy_mac.mm similarity index 100% rename from src/gui/dialogs/qnspanelproxy_mac.mm rename to src/widgets/dialogs/qnspanelproxy_mac.mm diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp similarity index 99% rename from src/gui/dialogs/qprogressdialog.cpp rename to src/widgets/dialogs/qprogressdialog.cpp index 87df49cc519..8701dc10fbb 100644 --- a/src/gui/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -61,7 +61,7 @@ #include <qaction.h> #endif #ifdef Q_WS_S60 -#include <QtGui/qdesktopwidget.h> +#include <QtWidgets/qdesktopwidget.h> #endif diff --git a/src/gui/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h similarity index 97% rename from src/gui/dialogs/qprogressdialog.h rename to src/widgets/dialogs/qprogressdialog.h index ca3ea5a0d9f..b981e5ef638 100644 --- a/src/gui/dialogs/qprogressdialog.h +++ b/src/widgets/dialogs/qprogressdialog.h @@ -42,7 +42,7 @@ #ifndef QPROGRESSDIALOG_H #define QPROGRESSDIALOG_H -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> QT_BEGIN_HEADER @@ -58,7 +58,7 @@ class QProgressBar; class QTimer; class QProgressDialogPrivate; -class Q_GUI_EXPORT QProgressDialog : public QDialog +class Q_WIDGETS_EXPORT QProgressDialog : public QDialog { Q_OBJECT Q_DECLARE_PRIVATE(QProgressDialog) diff --git a/src/gui/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp similarity index 100% rename from src/gui/dialogs/qsidebar.cpp rename to src/widgets/dialogs/qsidebar.cpp diff --git a/src/gui/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h similarity index 100% rename from src/gui/dialogs/qsidebar_p.h rename to src/widgets/dialogs/qsidebar_p.h diff --git a/src/gui/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp similarity index 100% rename from src/gui/dialogs/qwizard.cpp rename to src/widgets/dialogs/qwizard.cpp diff --git a/src/gui/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h similarity index 98% rename from src/gui/dialogs/qwizard.h rename to src/widgets/dialogs/qwizard.h index 69783664809..77eef530375 100644 --- a/src/gui/dialogs/qwizard.h +++ b/src/widgets/dialogs/qwizard.h @@ -42,7 +42,7 @@ #ifndef QWIZARD_H #define QWIZARD_H -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ class QAbstractButton; class QWizardPage; class QWizardPrivate; -class Q_GUI_EXPORT QWizard : public QDialog +class Q_WIDGETS_EXPORT QWizard : public QDialog { Q_OBJECT Q_ENUMS(WizardStyle WizardOption) @@ -211,7 +211,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QWizard::WizardOptions) class QWizardPagePrivate; -class Q_GUI_EXPORT QWizardPage : public QWidget +class Q_WIDGETS_EXPORT QWizardPage : public QWidget { Q_OBJECT Q_PROPERTY(QString title READ title WRITE setTitle) diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp similarity index 93% rename from src/gui/dialogs/qwizard_win.cpp rename to src/widgets/dialogs/qwizard_win.cpp index 9ea114c63f9..6177700d8c6 100644 --- a/src/gui/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -44,11 +44,13 @@ #include "qwizard_win_p.h" #include <private/qsystemlibrary_p.h> +#include <private/qapplication_p.h> +#include "qplatformnativeinterface_qpa.h" #include "qwizard.h" #include "qpaintengine.h" #include "qapplication.h" #include <QtGui/QMouseEvent> -#include <QtGui/QDesktopWidget> +#include <QtWidgets/QDesktopWidget> // Note, these tests are duplicates in qwindowsxpstyle_p.h. #ifdef Q_CC_GNU @@ -230,7 +232,9 @@ void QVistaBackButton::paintEvent(QPaintEvent *) else if (underMouse()) state = WIZ_NAV_BB_HOT; - pDrawThemeBackground(theme, p.paintEngine()->getDC(), WIZ_NAV_BACKBUTTON, state, &clipRect, &clipRect); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + HDC hdc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore())); + pDrawThemeBackground(theme, hdc, WIZ_NAV_BACKBUTTON, state, &clipRect, &clipRect); } /****************************************************************************** @@ -286,7 +290,8 @@ QVistaHelper::VistaState QVistaHelper::vistaState() QColor QVistaHelper::basicWindowFrameColor() { DWORD rgb; - HANDLE hTheme = pOpenThemeData(QApplication::desktop()->winId(), L"WINDOW"); + HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop()); + HANDLE hTheme = pOpenThemeData(handle, L"WINDOW"); pGetThemeColor( hTheme, WIZ_WP_CAPTION, WIZ_CS_ACTIVE, wizard->isActiveWindow() ? WIZ_TMT_FILLCOLORHINT : WIZ_TMT_BORDERCOLORHINT, @@ -306,7 +311,8 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type) mar.cyTopHeight = 0; else mar.cyTopHeight = titleBarSize() + topOffset(); - HRESULT hr = pDwmExtendFrameIntoClientArea(wizard->winId(), &mar); + HWND wizardHandle = QApplicationPrivate::getHWNDForWidget(wizard); + HRESULT hr = pDwmExtendFrameIntoClientArea(wizardHandle, &mar); value = SUCCEEDED(hr); } return value; @@ -314,12 +320,14 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type) void QVistaHelper::drawTitleBar(QPainter *painter) { - HDC hdc = painter->paintEngine()->getDC(); + Q_ASSERT(backButton_); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + QBackingStore *backingStore = backButton_->backingStore(); + HDC hdc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore)); if (vistaState() == VistaAero) drawBlackRect(QRect(0, 0, wizard->width(), titleBarSize() + topOffset()), hdc); - Q_ASSERT(backButton_); const int btnTop = backButton_->mapToParent(QPoint()).y(); const int btnHeight = backButton_->size().height(); const int verticalCenter = (btnTop + btnHeight / 2) - 1; @@ -345,7 +353,7 @@ void QVistaHelper::drawTitleBar(QPainter *painter) if (!wizard->windowIcon().isNull()) { QRect rect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize()); - HICON hIcon = wizard->windowIcon().pixmap(iconSize()).toWinHICON(); + HICON hIcon = 0; //###FIXME wizard->windowIcon().pixmap(iconSize()).toWinHICON(); DrawIconEx(hdc, rect.left(), rect.top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT); DestroyIcon(hIcon); } @@ -360,7 +368,8 @@ void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible) opt.dwMask = 0; else opt.dwMask = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION; - pSetWindowThemeAttribute(wizard->winId(), WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS)); + HWND handle = QApplicationPrivate::getHWNDForWidget(wizard); + pSetWindowThemeAttribute(handle, WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS)); } } @@ -437,7 +446,8 @@ void QVistaHelper::setWindowPosHack() const int y = wizard->geometry().y(); // ignored by SWP_NOMOVE const int w = wizard->width(); const int h = wizard->height(); - SetWindowPos(wizard->winId(), 0, x, y, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); + HWND handle = QApplicationPrivate::getHWNDForWidget(wizard); + SetWindowPos(handle, 0, x, y, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); } // The following hack allows any QWidget subclass to access @@ -575,7 +585,8 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event) msg.message = WM_NCHITTEST; msg.wParam = 0; msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY()); - msg.hwnd = wizard->winId(); + HWND handle = QApplicationPrivate::getHWNDForWidget(wizard); + msg.hwnd = handle; winEvent(&msg, &result); msg.wParam = result; msg.message = WM_NCMOUSEMOVE; @@ -587,7 +598,8 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event) msg.message = WM_NCHITTEST; msg.wParam = 0; msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY()); - msg.hwnd = wizard->winId(); + HWND handle = QApplicationPrivate::getHWNDForWidget(wizard); + msg.hwnd = handle; winEvent(&msg, &result); msg.wParam = result; msg.message = WM_NCLBUTTONDOWN; @@ -599,7 +611,8 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event) msg.message = WM_NCHITTEST; msg.wParam = 0; msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY()); - msg.hwnd = wizard->winId(); + HWND handle = QApplicationPrivate::getHWNDForWidget(wizard); + msg.hwnd = handle; winEvent(&msg, &result); msg.wParam = result; msg.message = WM_NCLBUTTONUP; @@ -628,7 +641,8 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q { bool value = false; if (vistaState() == VistaAero) { - HANDLE hTheme = pOpenThemeData(QApplication::desktop()->winId(), L"WINDOW"); + HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop()); + HANDLE hTheme = pOpenThemeData(handle, L"WINDOW"); if (!hTheme) return false; // Set up a memory DC and bitmap that we'll draw into HDC dcMem; diff --git a/src/gui/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h similarity index 98% rename from src/gui/dialogs/qwizard_win_p.h rename to src/widgets/dialogs/qwizard_win_p.h index 7009fa738d7..f53a9ba75c4 100644 --- a/src/gui/dialogs/qwizard_win_p.h +++ b/src/widgets/dialogs/qwizard_win_p.h @@ -60,8 +60,8 @@ #include <qobject.h> #include <qwidget.h> #include <qabstractbutton.h> -#include <QtGui/private/qwidget_p.h> -#include <QtGui/private/qstylehelper_p.h> +#include <QtWidgets/private/qwidget_p.h> +#include <QtWidgets/private/qstylehelper_p.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/effects/effects.pri b/src/widgets/effects/effects.pri new file mode 100644 index 00000000000..a21f941866b --- /dev/null +++ b/src/widgets/effects/effects.pri @@ -0,0 +1,6 @@ +HEADERS += effects/qgraphicseffect.h \ + effects/qgraphicseffect_p.h \ + effects/qpixmapfilter_p.h + +SOURCES += effects/qgraphicseffect.cpp \ + effects/qpixmapfilter.cpp diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp similarity index 99% rename from src/gui/effects/qgraphicseffect.cpp rename to src/widgets/effects/qgraphicseffect.cpp index a92d156e894..5df29cd297c 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/widgets/effects/qgraphicseffect.cpp @@ -106,7 +106,7 @@ #include "qgraphicseffect_p.h" #include "private/qgraphicsitem_p.h" -#include <QtGui/qgraphicsitem.h> +#include <QtWidgets/qgraphicsitem.h> #include <QtGui/qimage.h> #include <QtGui/qpainter.h> diff --git a/src/gui/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h similarity index 95% rename from src/gui/effects/qgraphicseffect.h rename to src/widgets/effects/qgraphicseffect.h index 6ddb6ae92c7..0ee6b264632 100644 --- a/src/gui/effects/qgraphicseffect.h +++ b/src/widgets/effects/qgraphicseffect.h @@ -63,7 +63,7 @@ class QPixmap; class QGraphicsEffectSource; class QGraphicsEffectPrivate; -class Q_GUI_EXPORT QGraphicsEffect : public QObject +class Q_WIDGETS_EXPORT QGraphicsEffect : public QObject { Q_OBJECT Q_FLAGS(ChangeFlags) @@ -127,7 +127,7 @@ public: Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsEffect::ChangeFlags) class QGraphicsColorizeEffectPrivate; -class Q_GUI_EXPORT QGraphicsColorizeEffect: public QGraphicsEffect +class Q_WIDGETS_EXPORT QGraphicsColorizeEffect: public QGraphicsEffect { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) @@ -156,7 +156,7 @@ private: }; class QGraphicsBlurEffectPrivate; -class Q_GUI_EXPORT QGraphicsBlurEffect: public QGraphicsEffect +class Q_WIDGETS_EXPORT QGraphicsBlurEffect: public QGraphicsEffect { Q_OBJECT Q_FLAGS(BlurHint BlurHints) @@ -196,7 +196,7 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsBlurEffect::BlurHints) class QGraphicsDropShadowEffectPrivate; -class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect +class Q_WIDGETS_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect { Q_OBJECT Q_PROPERTY(QPointF offset READ offset WRITE setOffset NOTIFY offsetChanged) @@ -252,7 +252,7 @@ private: }; class QGraphicsOpacityEffectPrivate; -class Q_GUI_EXPORT QGraphicsOpacityEffect: public QGraphicsEffect +class Q_WIDGETS_EXPORT QGraphicsOpacityEffect: public QGraphicsEffect { Q_OBJECT Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/widgets/effects/qgraphicseffect_p.h similarity index 98% rename from src/gui/effects/qgraphicseffect_p.h rename to src/widgets/effects/qgraphicseffect_p.h index 6a94db005e2..ac15f04d058 100644 --- a/src/gui/effects/qgraphicseffect_p.h +++ b/src/widgets/effects/qgraphicseffect_p.h @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE class QGraphicsEffectSourcePrivate; -class Q_GUI_EXPORT QGraphicsEffectSource : public QObject +class Q_WIDGETS_EXPORT QGraphicsEffectSource : public QObject { Q_OBJECT public: @@ -145,7 +145,7 @@ private: mutable QPixmapCache::Key m_cacheKey; }; -class Q_GUI_EXPORT QGraphicsEffectPrivate : public QObjectPrivate +class Q_WIDGETS_EXPORT QGraphicsEffectPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QGraphicsEffect) public: diff --git a/src/gui/image/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp similarity index 98% rename from src/gui/image/qpixmapfilter.cpp rename to src/widgets/effects/qpixmapfilter.cpp index a33e173f707..9cdedc19a33 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -48,8 +48,7 @@ #include "qpixmapfilter_p.h" #include "qvarlengtharray.h" -#include "private/qapplication_p.h" -#include "private/qgraphicssystem_p.h" +#include "private/qguiapplication_p.h" #include "private/qpaintengineex_p.h" #include "private/qpaintengine_raster_p.h" #include "qmath.h" @@ -782,7 +781,7 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp #define AVG(a,b) ( ((((a)^(b)) & 0xfefefefeUL) >> 1) + ((a)&(b)) ) #define AVG16(a,b) ( ((((a)^(b)) & 0xf7deUL) >> 1) + ((a)&(b)) ) -Q_GUI_EXPORT QImage qt_halfScaled(const QImage &source) +Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source) { if (source.width() < 2 || source.height() < 2) return QImage(); @@ -870,7 +869,7 @@ Q_GUI_EXPORT QImage qt_halfScaled(const QImage &source) return dest; } -Q_GUI_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0) +Q_WIDGETS_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, bool quality, bool alphaOnly, int transposed = 0) { if (blurImage.format() != QImage::Format_ARGB32_Premultiplied && blurImage.format() != QImage::Format_RGB32) @@ -897,7 +896,7 @@ Q_GUI_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, boo } } -Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0) +Q_WIDGETS_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0) { if (blurImage.format() == QImage::Format_Indexed8) expblur<12, 10, true>(blurImage, radius, quality, transposed); @@ -905,7 +904,7 @@ Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, in expblur<12, 10, false>(blurImage, radius, quality, transposed); } -Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); +Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); /*! \internal diff --git a/src/gui/image/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h similarity index 92% rename from src/gui/image/qpixmapfilter_p.h rename to src/widgets/effects/qpixmapfilter_p.h index 4ece5876bd4..b0edd8d4b00 100644 --- a/src/gui/image/qpixmapfilter_p.h +++ b/src/widgets/effects/qpixmapfilter_p.h @@ -55,7 +55,7 @@ #include <QtCore/qnamespace.h> #include <QtGui/qpixmap.h> -#include <QtGui/qgraphicseffect.h> +#include <QtWidgets/qgraphicseffect.h> #ifndef QT_NO_GRAPHICSEFFECT QT_BEGIN_HEADER @@ -65,11 +65,11 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QPainter; -class QPixmapData; +class QPlatformPixmap; class QPixmapFilterPrivate; -class Q_GUI_EXPORT QPixmapFilter : public QObject +class Q_WIDGETS_EXPORT QPixmapFilter : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QPixmapFilter) @@ -98,7 +98,7 @@ protected: class QPixmapConvolutionFilterPrivate; -class Q_GUI_EXPORT QPixmapConvolutionFilter : public QPixmapFilter +class Q_WIDGETS_EXPORT QPixmapConvolutionFilter : public QPixmapFilter { Q_OBJECT Q_DECLARE_PRIVATE(QPixmapConvolutionFilter) @@ -122,7 +122,7 @@ private: class QPixmapBlurFilterPrivate; -class Q_GUI_EXPORT QPixmapBlurFilter : public QPixmapFilter +class Q_WIDGETS_EXPORT QPixmapBlurFilter : public QPixmapFilter { Q_OBJECT Q_DECLARE_PRIVATE(QPixmapBlurFilter) @@ -146,7 +146,7 @@ private: class QPixmapColorizeFilterPrivate; -class Q_GUI_EXPORT QPixmapColorizeFilter : public QPixmapFilter +class Q_WIDGETS_EXPORT QPixmapColorizeFilter : public QPixmapFilter { Q_OBJECT Q_DECLARE_PRIVATE(QPixmapColorizeFilter) @@ -165,7 +165,7 @@ public: class QPixmapDropShadowFilterPrivate; -class Q_GUI_EXPORT QPixmapDropShadowFilter : public QPixmapFilter +class Q_WIDGETS_EXPORT QPixmapDropShadowFilter : public QPixmapFilter { Q_OBJECT Q_DECLARE_PRIVATE(QPixmapDropShadowFilter) diff --git a/src/gui/graphicsview/graphicsview.pri b/src/widgets/graphicsview/graphicsview.pri similarity index 100% rename from src/gui/graphicsview/graphicsview.pri rename to src/widgets/graphicsview/graphicsview.pri diff --git a/src/gui/graphicsview/qgraph_p.h b/src/widgets/graphicsview/qgraph_p.h similarity index 100% rename from src/gui/graphicsview/qgraph_p.h rename to src/widgets/graphicsview/qgraph_p.h diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicsanchorlayout.cpp rename to src/widgets/graphicsview/qgraphicsanchorlayout.cpp diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.h b/src/widgets/graphicsview/qgraphicsanchorlayout.h similarity index 95% rename from src/gui/graphicsview/qgraphicsanchorlayout.h rename to src/widgets/graphicsview/qgraphicsanchorlayout.h index c3878934675..4e57dbccf9a 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.h +++ b/src/widgets/graphicsview/qgraphicsanchorlayout.h @@ -42,8 +42,8 @@ #ifndef QGRAPHICSANCHORLAYOUT_H #define QGRAPHICSANCHORLAYOUT_H -#include <QtGui/qgraphicsitem.h> -#include <QtGui/qgraphicslayout.h> +#include <QtWidgets/qgraphicsitem.h> +#include <QtWidgets/qgraphicslayout.h> QT_BEGIN_HEADER @@ -58,7 +58,7 @@ class QGraphicsAnchorPrivate; class QGraphicsAnchorLayout; class QGraphicsAnchorLayoutPrivate; -class Q_GUI_EXPORT QGraphicsAnchor : public QObject +class Q_WIDGETS_EXPORT QGraphicsAnchor : public QObject { Q_OBJECT Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET unsetSpacing) @@ -79,7 +79,7 @@ private: friend struct AnchorData; }; -class Q_GUI_EXPORT QGraphicsAnchorLayout : public QGraphicsLayout +class Q_WIDGETS_EXPORT QGraphicsAnchorLayout : public QGraphicsLayout { public: QGraphicsAnchorLayout(QGraphicsLayoutItem *parent = 0); diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp similarity index 99% rename from src/gui/graphicsview/qgraphicsanchorlayout_p.cpp rename to src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp index eaa8ac2b50f..c9bda581239 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include <QtGui/qwidget.h> -#include <QtGui/qapplication.h> +#include <QtWidgets/qwidget.h> +#include <QtWidgets/qapplication.h> #include <QtCore/qlinkedlist.h> #include <QtCore/qstack.h> @@ -2966,11 +2966,12 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint AnchorData *ad = variables.at(i); ad->sizeAtPreferred = ad->result - g_offset; } - - // Make sure we delete the simplex solver -before- we delete the - // constraints used by it. - delete simplex; } + + // Make sure we delete the simplex solver -before- we delete the + // constraints used by it. + delete simplex; + // Delete constraints and variables we created. qDeleteAll(preferredConstraints); qDeleteAll(preferredVariables); diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h similarity index 100% rename from src/gui/graphicsview/qgraphicsanchorlayout_p.h rename to src/widgets/graphicsview/qgraphicsanchorlayout_p.h diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicsgridlayout.cpp rename to src/widgets/graphicsview/qgraphicsgridlayout.cpp diff --git a/src/gui/graphicsview/qgraphicsgridlayout.h b/src/widgets/graphicsview/qgraphicsgridlayout.h similarity index 97% rename from src/gui/graphicsview/qgraphicsgridlayout.h rename to src/widgets/graphicsview/qgraphicsgridlayout.h index 771c8a074c2..c6bc2229b63 100644 --- a/src/gui/graphicsview/qgraphicsgridlayout.h +++ b/src/widgets/graphicsview/qgraphicsgridlayout.h @@ -42,8 +42,8 @@ #ifndef QGRAPHICSGRIDLAYOUT_H #define QGRAPHICSGRIDLAYOUT_H -#include <QtGui/qgraphicsitem.h> -#include <QtGui/qgraphicslayout.h> +#include <QtWidgets/qgraphicsitem.h> +#include <QtWidgets/qgraphicslayout.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QGraphicsGridLayoutPrivate; -class Q_GUI_EXPORT QGraphicsGridLayout : public QGraphicsLayout +class Q_WIDGETS_EXPORT QGraphicsGridLayout : public QGraphicsLayout { public: QGraphicsGridLayout(QGraphicsLayoutItem *parent = 0); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp similarity index 99% rename from src/gui/graphicsview/qgraphicsitem.cpp rename to src/widgets/graphicsview/qgraphicsitem.cpp index 0c218fc9f46..c0f6339debe 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -735,22 +735,22 @@ #include <QtCore/qvariant.h> #include <QtCore/qvarlengtharray.h> #include <QtCore/qnumeric.h> -#include <QtGui/qapplication.h> +#include <QtWidgets/qapplication.h> #include <QtGui/qbitmap.h> #include <QtGui/qpainter.h> #include <QtGui/qpainterpath.h> #include <QtGui/qpixmapcache.h> -#include <QtGui/qstyleoption.h> +#include <QtWidgets/qstyleoption.h> #include <QtGui/qevent.h> -#include <QtGui/qinputcontext.h> -#include <QtGui/qgraphicseffect.h> +#include <QtWidgets/qinputcontext.h> +#include <QtWidgets/qgraphicseffect.h> #ifndef QT_NO_ACCESSIBILITY # include "qaccessible.h" #endif #include <private/qgraphicsitem_p.h> #include <private/qgraphicswidget_p.h> -#include <private/qtextcontrol_p.h> +#include <private/qwidgettextcontrol_p.h> #include <private/qtextdocumentlayout_p.h> #include <private/qtextengine_p.h> #include <private/qwidget_p.h> @@ -9856,8 +9856,8 @@ public: : control(0), pageNumber(0), useDefaultImpl(false), tabChangesFocus(false), clickCausedFocus(0) { } - mutable QTextControl *control; - QTextControl *textControl() const; + mutable QWidgetTextControl *control; + QWidgetTextControl *textControl() const; inline QPointF controlOffset() const { return QPointF(0., pageNumber * control->document()->pageSize().height()); } @@ -10007,7 +10007,7 @@ void QGraphicsTextItem::setFont(const QFont &font) */ void QGraphicsTextItem::setDefaultTextColor(const QColor &col) { - QTextControl *c = dd->textControl(); + QWidgetTextControl *c = dd->textControl(); QPalette pal = c->palette(); QColor old = pal.color(QPalette::Text); pal.setColor(QPalette::Text, col); @@ -10504,11 +10504,11 @@ void QGraphicsTextItemPrivate::_q_ensureVisible(QRectF rect) } } -QTextControl *QGraphicsTextItemPrivate::textControl() const +QWidgetTextControl *QGraphicsTextItemPrivate::textControl() const { if (!control) { QGraphicsTextItem *that = const_cast<QGraphicsTextItem *>(qq); - control = new QTextControl(that); + control = new QWidgetTextControl(that); control->setTextInteractionFlags(Qt::NoTextInteraction); QObject::connect(control, SIGNAL(updateRequest(QRectF)), diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h similarity index 96% rename from src/gui/graphicsview/qgraphicsitem.h rename to src/widgets/graphicsview/qgraphicsitem.h index a3443826c74..1e4cbaced66 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/widgets/graphicsview/qgraphicsitem.h @@ -86,7 +86,7 @@ class QRectF; class QStyleOptionGraphicsItem; class QGraphicsItemPrivate; -class Q_GUI_EXPORT QGraphicsItem +class Q_WIDGETS_EXPORT QGraphicsItem { public: enum GraphicsItemFlag { @@ -544,7 +544,7 @@ inline QRectF QGraphicsItem::mapRectFromScene(qreal ax, qreal ay, qreal w, qreal { return mapRectFromScene(QRectF(ax, ay, w, h)); } -class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem +class Q_WIDGETS_EXPORT QGraphicsObject : public QObject, public QGraphicsItem { Q_OBJECT Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false) @@ -607,7 +607,7 @@ private: class QAbstractGraphicsShapeItemPrivate; -class Q_GUI_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem +class Q_WIDGETS_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem { public: QAbstractGraphicsShapeItem(QGraphicsItem *parent = 0 @@ -637,7 +637,7 @@ private: }; class QGraphicsPathItemPrivate; -class Q_GUI_EXPORT QGraphicsPathItem : public QAbstractGraphicsShapeItem +class Q_WIDGETS_EXPORT QGraphicsPathItem : public QAbstractGraphicsShapeItem { public: QGraphicsPathItem(QGraphicsItem *parent = 0 @@ -680,7 +680,7 @@ private: }; class QGraphicsRectItemPrivate; -class Q_GUI_EXPORT QGraphicsRectItem : public QAbstractGraphicsShapeItem +class Q_WIDGETS_EXPORT QGraphicsRectItem : public QAbstractGraphicsShapeItem { public: QGraphicsRectItem(QGraphicsItem *parent = 0 @@ -733,7 +733,7 @@ inline void QGraphicsRectItem::setRect(qreal ax, qreal ay, qreal w, qreal h) { setRect(QRectF(ax, ay, w, h)); } class QGraphicsEllipseItemPrivate; -class Q_GUI_EXPORT QGraphicsEllipseItem : public QAbstractGraphicsShapeItem +class Q_WIDGETS_EXPORT QGraphicsEllipseItem : public QAbstractGraphicsShapeItem { public: QGraphicsEllipseItem(QGraphicsItem *parent = 0 @@ -792,7 +792,7 @@ inline void QGraphicsEllipseItem::setRect(qreal ax, qreal ay, qreal w, qreal h) { setRect(QRectF(ax, ay, w, h)); } class QGraphicsPolygonItemPrivate; -class Q_GUI_EXPORT QGraphicsPolygonItem : public QAbstractGraphicsShapeItem +class Q_WIDGETS_EXPORT QGraphicsPolygonItem : public QAbstractGraphicsShapeItem { public: QGraphicsPolygonItem(QGraphicsItem *parent = 0 @@ -839,7 +839,7 @@ private: }; class QGraphicsLineItemPrivate; -class Q_GUI_EXPORT QGraphicsLineItem : public QGraphicsItem +class Q_WIDGETS_EXPORT QGraphicsLineItem : public QGraphicsItem { public: QGraphicsLineItem(QGraphicsItem *parent = 0 @@ -893,7 +893,7 @@ private: }; class QGraphicsPixmapItemPrivate; -class Q_GUI_EXPORT QGraphicsPixmapItem : public QGraphicsItem +class Q_WIDGETS_EXPORT QGraphicsPixmapItem : public QGraphicsItem { public: enum ShapeMode { @@ -957,7 +957,7 @@ inline void QGraphicsPixmapItem::setOffset(qreal ax, qreal ay) class QGraphicsTextItemPrivate; class QTextDocument; class QTextCursor; -class Q_GUI_EXPORT QGraphicsTextItem : public QGraphicsObject +class Q_WIDGETS_EXPORT QGraphicsTextItem : public QGraphicsObject { Q_OBJECT QDOC_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) @@ -1062,7 +1062,7 @@ private: }; class QGraphicsSimpleTextItemPrivate; -class Q_GUI_EXPORT QGraphicsSimpleTextItem : public QAbstractGraphicsShapeItem +class Q_WIDGETS_EXPORT QGraphicsSimpleTextItem : public QAbstractGraphicsShapeItem { public: QGraphicsSimpleTextItem(QGraphicsItem *parent = 0 @@ -1108,7 +1108,7 @@ private: }; class QGraphicsItemGroupPrivate; -class Q_GUI_EXPORT QGraphicsItemGroup : public QGraphicsItem +class Q_WIDGETS_EXPORT QGraphicsItemGroup : public QGraphicsItem { public: QGraphicsItemGroup(QGraphicsItem *parent = 0 @@ -1149,11 +1149,11 @@ template <class T> inline T qgraphicsitem_cast(const QGraphicsItem *item) } #ifndef QT_NO_DEBUG_STREAM -Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem *item); -Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsObject *item); -Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change); -Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag); -Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlags flags); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem *item); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QGraphicsObject *item); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlags flags); #endif QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h similarity index 99% rename from src/gui/graphicsview/qgraphicsitem_p.h rename to src/widgets/graphicsview/qgraphicsitem_p.h index afcb2944425..3cd77f3cdbc 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/widgets/graphicsview/qgraphicsitem_p.h @@ -155,7 +155,7 @@ public: void purge(); }; -class Q_GUI_EXPORT QGraphicsItemPrivate +class Q_WIDGETS_EXPORT QGraphicsItemPrivate { Q_DECLARE_PUBLIC(QGraphicsItem) public: diff --git a/src/gui/graphicsview/qgraphicsitemanimation.cpp b/src/widgets/graphicsview/qgraphicsitemanimation.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicsitemanimation.cpp rename to src/widgets/graphicsview/qgraphicsitemanimation.cpp diff --git a/src/gui/graphicsview/qgraphicsitemanimation.h b/src/widgets/graphicsview/qgraphicsitemanimation.h similarity index 98% rename from src/gui/graphicsview/qgraphicsitemanimation.h rename to src/widgets/graphicsview/qgraphicsitemanimation.h index e4296cbb7b1..a6425a50e43 100644 --- a/src/gui/graphicsview/qgraphicsitemanimation.h +++ b/src/widgets/graphicsview/qgraphicsitemanimation.h @@ -59,7 +59,7 @@ class QTimeLine; template <class T1, class T2> struct QPair; class QGraphicsItemAnimationPrivate; -class Q_GUI_EXPORT QGraphicsItemAnimation : public QObject +class Q_WIDGETS_EXPORT QGraphicsItemAnimation : public QObject { Q_OBJECT public: diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/widgets/graphicsview/qgraphicslayout.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicslayout.cpp rename to src/widgets/graphicsview/qgraphicslayout.cpp diff --git a/src/gui/graphicsview/qgraphicslayout.h b/src/widgets/graphicsview/qgraphicslayout.h similarity index 96% rename from src/gui/graphicsview/qgraphicslayout.h rename to src/widgets/graphicsview/qgraphicslayout.h index d5bc841854e..6b19f0e6223 100644 --- a/src/gui/graphicsview/qgraphicslayout.h +++ b/src/widgets/graphicsview/qgraphicslayout.h @@ -42,7 +42,7 @@ #ifndef QGRAPHICSLAYOUT_H #define QGRAPHICSLAYOUT_H -#include <QtGui/qgraphicslayoutitem.h> +#include <QtWidgets/qgraphicslayoutitem.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ class QGraphicsLayoutPrivate; class QGraphicsLayoutItem; class QGraphicsWidget; -class Q_GUI_EXPORT QGraphicsLayout : public QGraphicsLayoutItem +class Q_WIDGETS_EXPORT QGraphicsLayout : public QGraphicsLayoutItem { public: QGraphicsLayout(QGraphicsLayoutItem *parent = 0); diff --git a/src/gui/graphicsview/qgraphicslayout_p.cpp b/src/widgets/graphicsview/qgraphicslayout_p.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicslayout_p.cpp rename to src/widgets/graphicsview/qgraphicslayout_p.cpp diff --git a/src/gui/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h similarity index 98% rename from src/gui/graphicsview/qgraphicslayout_p.h rename to src/widgets/graphicsview/qgraphicslayout_p.h index 071a2ade252..f11bfbf38c6 100644 --- a/src/gui/graphicsview/qgraphicslayout_p.h +++ b/src/widgets/graphicsview/qgraphicslayout_p.h @@ -59,9 +59,9 @@ #include "qgraphicslayout.h" #include "qgraphicslayoutitem_p.h" -#include <QtGui/qstyle.h> -#include <QtGui/qwidget.h> -#include <QtGui/qstyleoption.h> +#include <QtWidgets/qstyle.h> +#include <QtWidgets/qwidget.h> +#include <QtWidgets/qstyleoption.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/widgets/graphicsview/qgraphicslayoutitem.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicslayoutitem.cpp rename to src/widgets/graphicsview/qgraphicslayoutitem.cpp diff --git a/src/gui/graphicsview/qgraphicslayoutitem.h b/src/widgets/graphicsview/qgraphicslayoutitem.h similarity index 98% rename from src/gui/graphicsview/qgraphicslayoutitem.h rename to src/widgets/graphicsview/qgraphicslayoutitem.h index 12c1b892c46..c617959a063 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.h +++ b/src/widgets/graphicsview/qgraphicslayoutitem.h @@ -43,7 +43,7 @@ #define QGRAPHICSLAYOUTITEM_H #include <QtCore/qscopedpointer.h> -#include <QtGui/qsizepolicy.h> +#include <QtWidgets/qsizepolicy.h> #include <QtGui/qevent.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QGraphicsLayoutItemPrivate; class QGraphicsItem; -class Q_GUI_EXPORT QGraphicsLayoutItem +class Q_WIDGETS_EXPORT QGraphicsLayoutItem { public: QGraphicsLayoutItem(QGraphicsLayoutItem *parent = 0, bool isLayout = false); diff --git a/src/gui/graphicsview/qgraphicslayoutitem_p.h b/src/widgets/graphicsview/qgraphicslayoutitem_p.h similarity index 99% rename from src/gui/graphicsview/qgraphicslayoutitem_p.h rename to src/widgets/graphicsview/qgraphicslayoutitem_p.h index c44dd81d291..244c699faa8 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem_p.h +++ b/src/widgets/graphicsview/qgraphicslayoutitem_p.h @@ -54,7 +54,7 @@ // #include <QtCore/QSizeF> -#include <QtGui/QSizePolicy> +#include <QtWidgets/QSizePolicy> QT_BEGIN_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/widgets/graphicsview/qgraphicslinearlayout.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicslinearlayout.cpp rename to src/widgets/graphicsview/qgraphicslinearlayout.cpp diff --git a/src/gui/graphicsview/qgraphicslinearlayout.h b/src/widgets/graphicsview/qgraphicslinearlayout.h similarity index 96% rename from src/gui/graphicsview/qgraphicslinearlayout.h rename to src/widgets/graphicsview/qgraphicslinearlayout.h index 031015c5eb3..5d2d5c309f7 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.h +++ b/src/widgets/graphicsview/qgraphicslinearlayout.h @@ -42,8 +42,8 @@ #ifndef QGRAPHICSLINEARLAYOUT_H #define QGRAPHICSLINEARLAYOUT_H -#include <QtGui/qgraphicsitem.h> -#include <QtGui/qgraphicslayout.h> +#include <QtWidgets/qgraphicsitem.h> +#include <QtWidgets/qgraphicslayout.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QGraphicsLinearLayoutPrivate; -class Q_GUI_EXPORT QGraphicsLinearLayout : public QGraphicsLayout +class Q_WIDGETS_EXPORT QGraphicsLinearLayout : public QGraphicsLayout { public: QGraphicsLinearLayout(QGraphicsLayoutItem *parent = 0); diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp similarity index 99% rename from src/gui/graphicsview/qgraphicsproxywidget.cpp rename to src/widgets/graphicsview/qgraphicsproxywidget.cpp index fad88f5764a..cb8e2259f4f 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -51,15 +51,15 @@ #include <QtCore/qdebug.h> #include <QtGui/qevent.h> -#include <QtGui/qgraphicsscene.h> -#include <QtGui/qgraphicssceneevent.h> -#include <QtGui/qlayout.h> +#include <QtWidgets/qgraphicsscene.h> +#include <QtWidgets/qgraphicssceneevent.h> +#include <QtWidgets/qlayout.h> #include <QtGui/qpainter.h> -#include <QtGui/qstyleoption.h> -#include <QtGui/qgraphicsview.h> -#include <QtGui/qlistview.h> -#include <QtGui/qlineedit.h> -#include <QtGui/qtextedit.h> +#include <QtWidgets/qstyleoption.h> +#include <QtWidgets/qgraphicsview.h> +#include <QtWidgets/qlistview.h> +#include <QtWidgets/qlineedit.h> +#include <QtWidgets/qtextedit.h> QT_BEGIN_NAMESPACE @@ -189,7 +189,7 @@ QT_BEGIN_NAMESPACE */ extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); -Q_GUI_EXPORT extern bool qt_tab_all_widgets; +Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets; /*! \internal @@ -274,9 +274,9 @@ void QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent(QGraphicsSceneMouseEvent pos = mapToReceiver(pos, receiver); // Send mouse event. - QMouseEvent mouseEvent(type, pos, - receiver->mapToGlobal(pos.toPoint()), event->button(), - event->buttons(), event->modifiers()); + QMouseEvent mouseEvent(type, pos, receiver->mapTo(receiver->topLevelWidget(), pos.toPoint()), + receiver->mapToGlobal(pos.toPoint()), + event->button(), event->buttons(), event->modifiers()); QWidget *embeddedMouseGrabberPtr = (QWidget *)embeddedMouseGrabber; QApplicationPrivate::sendMouseEvent(receiver, &mouseEvent, alienWidget, widget, diff --git a/src/gui/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h similarity index 97% rename from src/gui/graphicsview/qgraphicsproxywidget.h rename to src/widgets/graphicsview/qgraphicsproxywidget.h index 3ff5ef1aac5..9f0a711c461 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.h +++ b/src/widgets/graphicsview/qgraphicsproxywidget.h @@ -42,7 +42,7 @@ #ifndef QGRAPHICSPROXYWIDGET_H #define QGRAPHICSPROXYWIDGET_H -#include <QtGui/qgraphicswidget.h> +#include <QtWidgets/qgraphicswidget.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QGraphicsProxyWidgetPrivate; -class Q_GUI_EXPORT QGraphicsProxyWidget : public QGraphicsWidget +class Q_WIDGETS_EXPORT QGraphicsProxyWidget : public QGraphicsWidget { Q_OBJECT public: diff --git a/src/gui/graphicsview/qgraphicsproxywidget_p.h b/src/widgets/graphicsview/qgraphicsproxywidget_p.h similarity index 100% rename from src/gui/graphicsview/qgraphicsproxywidget_p.h rename to src/widgets/graphicsview/qgraphicsproxywidget_p.h diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp similarity index 99% rename from src/gui/graphicsview/qgraphicsscene.cpp rename to src/widgets/graphicsview/qgraphicsscene.cpp index 1551944a091..165096637b1 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -229,26 +229,25 @@ #include <QtCore/qtimer.h> #include <QtCore/qvarlengtharray.h> #include <QtCore/QMetaMethod> -#include <QtGui/qapplication.h> -#include <QtGui/qdesktopwidget.h> +#include <QtWidgets/qapplication.h> +#include <QtWidgets/qdesktopwidget.h> #include <QtGui/qevent.h> -#include <QtGui/qgraphicslayout.h> -#include <QtGui/qgraphicsproxywidget.h> -#include <QtGui/qgraphicswidget.h> +#include <QtWidgets/qgraphicslayout.h> +#include <QtWidgets/qgraphicsproxywidget.h> +#include <QtWidgets/qgraphicswidget.h> #include <QtGui/qmatrix.h> #include <QtGui/qpaintengine.h> #include <QtGui/qpainter.h> #include <QtGui/qpixmapcache.h> #include <QtGui/qpolygon.h> -#include <QtGui/qstyleoption.h> -#include <QtGui/qtooltip.h> +#include <QtWidgets/qstyleoption.h> +#include <QtWidgets/qtooltip.h> #include <QtGui/qtransform.h> -#include <QtGui/qinputcontext.h> -#include <QtGui/qgraphicseffect.h> +#include <QtWidgets/qinputcontext.h> +#include <QtWidgets/qgraphicseffect.h> #ifndef QT_NO_ACCESSIBILITY -# include <QtGui/qaccessible.h> +# include <QtWidgets/qaccessible.h> #endif - #include <private/qapplication_p.h> #include <private/qobject_p.h> #ifdef Q_WS_X11 diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h similarity index 99% rename from src/gui/graphicsview/qgraphicsscene.h rename to src/widgets/graphicsview/qgraphicsscene.h index 5aff805b76c..7895584827d 100644 --- a/src/gui/graphicsview/qgraphicsscene.h +++ b/src/widgets/graphicsview/qgraphicsscene.h @@ -98,7 +98,7 @@ class QStyle; class QStyleOptionGraphicsItem; class QGraphicsScenePrivate; -class Q_GUI_EXPORT QGraphicsScene : public QObject +class Q_WIDGETS_EXPORT QGraphicsScene : public QObject { Q_OBJECT Q_PROPERTY(QBrush backgroundBrush READ backgroundBrush WRITE setBackgroundBrush) diff --git a/src/gui/graphicsview/qgraphicsscene_bsp.cpp b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicsscene_bsp.cpp rename to src/widgets/graphicsview/qgraphicsscene_bsp.cpp diff --git a/src/gui/graphicsview/qgraphicsscene_bsp_p.h b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h similarity index 100% rename from src/gui/graphicsview/qgraphicsscene_bsp_p.h rename to src/widgets/graphicsview/qgraphicsscene_bsp_p.h diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/widgets/graphicsview/qgraphicsscene_p.h similarity index 99% rename from src/gui/graphicsview/qgraphicsscene_p.h rename to src/widgets/graphicsview/qgraphicsscene_p.h index 1e5c358e40d..8cb24457d67 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/widgets/graphicsview/qgraphicsscene_p.h @@ -69,8 +69,8 @@ #include <QtCore/qset.h> #include <QtGui/qfont.h> #include <QtGui/qpalette.h> -#include <QtGui/qstyle.h> -#include <QtGui/qstyleoption.h> +#include <QtWidgets/qstyle.h> +#include <QtWidgets/qstyleoption.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp rename to src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h similarity index 100% rename from src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h rename to src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp similarity index 99% rename from src/gui/graphicsview/qgraphicssceneevent.cpp rename to src/widgets/graphicsview/qgraphicssceneevent.cpp index dd903be8ea3..97e5ff40c14 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp @@ -263,7 +263,7 @@ #include <QtCore/qstring.h> #include "qgraphicsview.h" #include "qgraphicsitem.h" -#include <QtGui/qgesture.h> +#include <QtWidgets/qgesture.h> #include <private/qevent_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/widgets/graphicsview/qgraphicssceneevent.h similarity index 92% rename from src/gui/graphicsview/qgraphicssceneevent.h rename to src/widgets/graphicsview/qgraphicssceneevent.h index cbc211c5425..f3677fbef8a 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.h +++ b/src/widgets/graphicsview/qgraphicssceneevent.h @@ -64,7 +64,7 @@ class QSizeF; class QWidget; class QGraphicsSceneEventPrivate; -class Q_GUI_EXPORT QGraphicsSceneEvent : public QEvent +class Q_WIDGETS_EXPORT QGraphicsSceneEvent : public QEvent { public: QGraphicsSceneEvent(Type type); @@ -82,7 +82,7 @@ private: }; class QGraphicsSceneMouseEventPrivate; -class Q_GUI_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent +class Q_WIDGETS_EXPORT QGraphicsSceneMouseEvent : public QGraphicsSceneEvent { public: QGraphicsSceneMouseEvent(Type type = None); @@ -130,7 +130,7 @@ private: }; class QGraphicsSceneWheelEventPrivate; -class Q_GUI_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent +class Q_WIDGETS_EXPORT QGraphicsSceneWheelEvent : public QGraphicsSceneEvent { public: QGraphicsSceneWheelEvent(Type type = None); @@ -163,7 +163,7 @@ private: }; class QGraphicsSceneContextMenuEventPrivate; -class Q_GUI_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEvent +class Q_WIDGETS_EXPORT QGraphicsSceneContextMenuEvent : public QGraphicsSceneEvent { public: enum Reason { Mouse, Keyboard, Other }; @@ -192,7 +192,7 @@ private: }; class QGraphicsSceneHoverEventPrivate; -class Q_GUI_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent +class Q_WIDGETS_EXPORT QGraphicsSceneHoverEvent : public QGraphicsSceneEvent { public: QGraphicsSceneHoverEvent(Type type = None); @@ -225,7 +225,7 @@ private: }; class QGraphicsSceneHelpEventPrivate; -class Q_GUI_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent +class Q_WIDGETS_EXPORT QGraphicsSceneHelpEvent : public QGraphicsSceneEvent { public: QGraphicsSceneHelpEvent(Type type = None); @@ -243,7 +243,7 @@ private: }; class QGraphicsSceneDragDropEventPrivate; -class Q_GUI_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent +class Q_WIDGETS_EXPORT QGraphicsSceneDragDropEvent : public QGraphicsSceneEvent { public: QGraphicsSceneDragDropEvent(Type type = None); @@ -286,7 +286,7 @@ private: }; class QGraphicsSceneResizeEventPrivate; -class Q_GUI_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent +class Q_WIDGETS_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent { Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent) Q_DISABLE_COPY(QGraphicsSceneResizeEvent) @@ -302,7 +302,7 @@ public: }; class QGraphicsSceneMoveEventPrivate; -class Q_GUI_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent +class Q_WIDGETS_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent { Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent) Q_DISABLE_COPY(QGraphicsSceneMoveEvent) diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/widgets/graphicsview/qgraphicssceneindex.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicssceneindex.cpp rename to src/widgets/graphicsview/qgraphicssceneindex.cpp diff --git a/src/gui/graphicsview/qgraphicssceneindex_p.h b/src/widgets/graphicsview/qgraphicssceneindex_p.h similarity index 100% rename from src/gui/graphicsview/qgraphicssceneindex_p.h rename to src/widgets/graphicsview/qgraphicssceneindex_p.h diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp b/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicsscenelinearindex.cpp rename to src/widgets/graphicsview/qgraphicsscenelinearindex.cpp diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h similarity index 98% rename from src/gui/graphicsview/qgraphicsscenelinearindex_p.h rename to src/widgets/graphicsview/qgraphicsscenelinearindex_p.h index 07dd6a22b6b..37ba363c1ee 100644 --- a/src/gui/graphicsview/qgraphicsscenelinearindex_p.h +++ b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h @@ -59,7 +59,7 @@ #include <QtCore/qrect.h> #include <QtCore/qlist.h> -#include <QtGui/qgraphicsitem.h> +#include <QtWidgets/qgraphicsitem.h> #include <private/qgraphicssceneindex_p.h> QT_BEGIN_HEADER diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/widgets/graphicsview/qgraphicstransform.cpp similarity index 100% rename from src/gui/graphicsview/qgraphicstransform.cpp rename to src/widgets/graphicsview/qgraphicstransform.cpp diff --git a/src/gui/graphicsview/qgraphicstransform.h b/src/widgets/graphicsview/qgraphicstransform.h similarity index 95% rename from src/gui/graphicsview/qgraphicstransform.h rename to src/widgets/graphicsview/qgraphicstransform.h index a686edebc72..4bceecc47c0 100644 --- a/src/gui/graphicsview/qgraphicstransform.h +++ b/src/widgets/graphicsview/qgraphicstransform.h @@ -57,7 +57,7 @@ QT_MODULE(Gui) class QGraphicsItem; class QGraphicsTransformPrivate; -class Q_GUI_EXPORT QGraphicsTransform : public QObject +class Q_WIDGETS_EXPORT QGraphicsTransform : public QObject { Q_OBJECT public: @@ -80,7 +80,7 @@ private: class QGraphicsScalePrivate; -class Q_GUI_EXPORT QGraphicsScale : public QGraphicsTransform +class Q_WIDGETS_EXPORT QGraphicsScale : public QGraphicsTransform { Q_OBJECT @@ -119,7 +119,7 @@ private: class QGraphicsRotationPrivate; -class Q_GUI_EXPORT QGraphicsRotation : public QGraphicsTransform +class Q_WIDGETS_EXPORT QGraphicsRotation : public QGraphicsTransform { Q_OBJECT diff --git a/src/gui/graphicsview/qgraphicstransform_p.h b/src/widgets/graphicsview/qgraphicstransform_p.h similarity index 100% rename from src/gui/graphicsview/qgraphicstransform_p.h rename to src/widgets/graphicsview/qgraphicstransform_p.h diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp similarity index 99% rename from src/gui/graphicsview/qgraphicsview.cpp rename to src/widgets/graphicsview/qgraphicsview.cpp index 548f79fa175..b5ec8a8d5d5 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -271,16 +271,16 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < #include <QtCore/qdatetime.h> #include <QtCore/qdebug.h> #include <QtCore/qmath.h> -#include <QtGui/qapplication.h> -#include <QtGui/qdesktopwidget.h> +#include <QtWidgets/qapplication.h> +#include <QtWidgets/qdesktopwidget.h> #include <QtGui/qevent.h> -#include <QtGui/qlayout.h> +#include <QtWidgets/qlayout.h> #include <QtGui/qtransform.h> #include <QtGui/qmatrix.h> #include <QtGui/qpainter.h> -#include <QtGui/qscrollbar.h> -#include <QtGui/qstyleoption.h> -#include <QtGui/qinputcontext.h> +#include <QtWidgets/qscrollbar.h> +#include <QtWidgets/qstyleoption.h> +#include <QtWidgets/qinputcontext.h> #ifdef Q_WS_X11 #include <QtGui/qpaintengine.h> #include <private/qt_x11_p.h> @@ -339,7 +339,7 @@ QGraphicsViewPrivate::QGraphicsViewPrivate() hasUpdateClip(false), mousePressButton(Qt::NoButton), leftIndent(0), topIndent(0), - lastMouseEvent(QEvent::None, QPoint(), Qt::NoButton, 0, 0), + lastMouseEvent(QEvent::None, QPointF(), QPointF(), QPointF(), Qt::NoButton, 0, 0), alignment(Qt::AlignCenter), transformationAnchor(QGraphicsView::AnchorViewCenter), resizeAnchor(QGraphicsView::NoAnchor), viewportUpdateMode(QGraphicsView::MinimalViewportUpdate), @@ -610,7 +610,7 @@ void QGraphicsViewPrivate::replayLastMouseEvent() void QGraphicsViewPrivate::storeMouseEvent(QMouseEvent *event) { useLastMouseEvent = true; - lastMouseEvent = QMouseEvent(QEvent::MouseMove, event->pos(), event->globalPos(), + lastMouseEvent = QMouseEvent(QEvent::MouseMove, event->localPos(), event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); } @@ -780,7 +780,7 @@ void QGraphicsViewPrivate::populateSceneDragDropEvent(QGraphicsSceneDragDropEven dest->setDropAction(source->dropAction()); dest->setMimeData(source->mimeData()); dest->setWidget(viewport); - dest->setSource(source->source()); + dest->setSource(qobject_cast<QWidget *>(source->source())); #else Q_UNUSED(dest) Q_UNUSED(source) diff --git a/src/gui/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h similarity index 98% rename from src/gui/graphicsview/qgraphicsview.h rename to src/widgets/graphicsview/qgraphicsview.h index 1447eebcb10..19b5753938e 100644 --- a/src/gui/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -44,8 +44,8 @@ #include <QtCore/qmetatype.h> #include <QtGui/qpainter.h> -#include <QtGui/qscrollarea.h> -#include <QtGui/qgraphicsscene.h> +#include <QtWidgets/qscrollarea.h> +#include <QtWidgets/qgraphicsscene.h> QT_BEGIN_HEADER @@ -61,7 +61,7 @@ class QPolygonF; class QStyleOptionGraphicsItem; class QGraphicsViewPrivate; -class Q_GUI_EXPORT QGraphicsView : public QAbstractScrollArea +class Q_WIDGETS_EXPORT QGraphicsView : public QAbstractScrollArea { Q_OBJECT Q_FLAGS(QPainter::RenderHints CacheMode OptimizationFlags) diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h similarity index 98% rename from src/gui/graphicsview/qgraphicsview_p.h rename to src/widgets/graphicsview/qgraphicsview_p.h index 021ab2df3c9..535679f1d80 100644 --- a/src/gui/graphicsview/qgraphicsview_p.h +++ b/src/widgets/graphicsview/qgraphicsview_p.h @@ -60,13 +60,13 @@ #include <QtGui/qevent.h> #include <QtCore/qcoreapplication.h> #include "qgraphicssceneevent.h" -#include <QtGui/qstyleoption.h> +#include <QtWidgets/qstyleoption.h> #include <private/qabstractscrollarea_p.h> #include <private/qapplication_p.h> QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate +class Q_WIDGETS_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate { Q_DECLARE_PUBLIC(QGraphicsView) public: diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp similarity index 99% rename from src/gui/graphicsview/qgraphicswidget.cpp rename to src/widgets/graphicsview/qgraphicswidget.cpp index 804394ad85c..813fe9f5054 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -59,11 +59,11 @@ #include <private/qshortcutmap_p.h> #endif #include <QtCore/qmutex.h> -#include <QtGui/qapplication.h> -#include <QtGui/qgraphicsview.h> -#include <QtGui/qgraphicsproxywidget.h> +#include <QtWidgets/qapplication.h> +#include <QtWidgets/qgraphicsview.h> +#include <QtWidgets/qgraphicsproxywidget.h> #include <QtGui/qpalette.h> -#include <QtGui/qstyleoption.h> +#include <QtWidgets/qstyleoption.h> #include <qdebug.h> diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/widgets/graphicsview/qgraphicswidget.h similarity index 98% rename from src/gui/graphicsview/qgraphicswidget.h rename to src/widgets/graphicsview/qgraphicswidget.h index 063be2d102d..8222886411a 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/widgets/graphicsview/qgraphicswidget.h @@ -43,8 +43,8 @@ #define QGRAPHICSWIDGET_H #include <QtGui/qfont.h> -#include <QtGui/qgraphicslayoutitem.h> -#include <QtGui/qgraphicsitem.h> +#include <QtWidgets/qgraphicslayoutitem.h> +#include <QtWidgets/qgraphicsitem.h> #include <QtGui/qpalette.h> QT_BEGIN_HEADER @@ -66,7 +66,7 @@ class QStyleOption; class QGraphicsWidgetPrivate; -class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLayoutItem +class Q_WIDGETS_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLayoutItem { Q_OBJECT Q_INTERFACES(QGraphicsItem QGraphicsLayoutItem) diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp similarity index 99% rename from src/gui/graphicsview/qgraphicswidget_p.cpp rename to src/widgets/graphicsview/qgraphicswidget_p.cpp index 8649dec29aa..fd5afaabf49 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp @@ -49,11 +49,11 @@ #include "qgraphicslayoutitem_p.h" #include "qgraphicslayout.h" #include "qgraphicsscene_p.h" -#include <QtGui/qapplication.h> -#include <QtGui/qgraphicsscene.h> -#include <QtGui/qstyleoption.h> -#include <QtGui/QStyleOptionTitleBar> -#include <QtGui/QGraphicsSceneMouseEvent> +#include <QtWidgets/qapplication.h> +#include <QtWidgets/qgraphicsscene.h> +#include <QtWidgets/qstyleoption.h> +#include <QtWidgets/QStyleOptionTitleBar> +#include <QtWidgets/QGraphicsSceneMouseEvent> #if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) # include <QMacStyle> #endif diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/widgets/graphicsview/qgraphicswidget_p.h similarity index 99% rename from src/gui/graphicsview/qgraphicswidget_p.h rename to src/widgets/graphicsview/qgraphicswidget_p.h index 398abc33ef2..16c53032356 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/widgets/graphicsview/qgraphicswidget_p.h @@ -58,8 +58,8 @@ #include "qgraphicswidget.h" #include <QtGui/qfont.h> #include <QtGui/qpalette.h> -#include <QtGui/qsizepolicy.h> -#include <QtGui/qstyle.h> +#include <QtWidgets/qsizepolicy.h> +#include <QtWidgets/qstyle.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/widgets/graphicsview/qgridlayoutengine.cpp similarity index 100% rename from src/gui/graphicsview/qgridlayoutengine.cpp rename to src/widgets/graphicsview/qgridlayoutengine.cpp diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/widgets/graphicsview/qgridlayoutengine_p.h similarity index 100% rename from src/gui/graphicsview/qgridlayoutengine_p.h rename to src/widgets/graphicsview/qgridlayoutengine_p.h diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/widgets/graphicsview/qsimplex_p.cpp similarity index 100% rename from src/gui/graphicsview/qsimplex_p.cpp rename to src/widgets/graphicsview/qsimplex_p.cpp diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/widgets/graphicsview/qsimplex_p.h similarity index 100% rename from src/gui/graphicsview/qsimplex_p.h rename to src/widgets/graphicsview/qsimplex_p.h diff --git a/src/gui/itemviews/itemviews.pri b/src/widgets/itemviews/itemviews.pri similarity index 94% rename from src/gui/itemviews/itemviews.pri rename to src/widgets/itemviews/itemviews.pri index 149bfd67b00..7ef704546e6 100644 --- a/src/gui/itemviews/itemviews.pri +++ b/src/widgets/itemviews/itemviews.pri @@ -13,14 +13,14 @@ HEADERS += \ itemviews/qtreeview.h \ itemviews/qtreeview_p.h \ itemviews/qabstractitemdelegate.h \ - itemviews/qitemdelegate.h \ + itemviews/qitemdelegate.h \ itemviews/qitemselectionmodel.h \ itemviews/qitemselectionmodel_p.h \ itemviews/qdirmodel.h \ itemviews/qlistwidget.h \ itemviews/qlistwidget_p.h \ itemviews/qtablewidget.h \ - itemviews/qtablewidget_p.h \ + itemviews/qtablewidget_p.h \ itemviews/qtreewidget.h \ itemviews/qtreewidget_p.h \ itemviews/qwidgetitemdata_p.h \ @@ -51,7 +51,7 @@ SOURCES += \ itemviews/qtableview.cpp \ itemviews/qtreeview.cpp \ itemviews/qabstractitemdelegate.cpp \ - itemviews/qitemdelegate.cpp \ + itemviews/qitemdelegate.cpp \ itemviews/qitemselectionmodel.cpp \ itemviews/qdirmodel.cpp \ itemviews/qlistwidget.cpp \ diff --git a/src/gui/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp similarity index 100% rename from src/gui/itemviews/qabstractitemdelegate.cpp rename to src/widgets/itemviews/qabstractitemdelegate.cpp diff --git a/src/gui/itemviews/qabstractitemdelegate.h b/src/widgets/itemviews/qabstractitemdelegate.h similarity index 97% rename from src/gui/itemviews/qabstractitemdelegate.h rename to src/widgets/itemviews/qabstractitemdelegate.h index 19d73b11b9f..f494f0b8c8e 100644 --- a/src/gui/itemviews/qabstractitemdelegate.h +++ b/src/widgets/itemviews/qabstractitemdelegate.h @@ -43,7 +43,7 @@ #define QABSTRACTITEMDELEGATE_H #include <QtCore/qobject.h> -#include <QtGui/qstyleoption.h> +#include <QtWidgets/qstyleoption.h> QT_BEGIN_HEADER @@ -59,7 +59,7 @@ class QAbstractItemModel; class QAbstractItemView; class QHelpEvent; -class Q_GUI_EXPORT QAbstractItemDelegate : public QObject +class Q_WIDGETS_EXPORT QAbstractItemDelegate : public QObject { Q_OBJECT diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp similarity index 99% rename from src/gui/itemviews/qabstractitemview.cpp rename to src/widgets/itemviews/qabstractitemview.cpp index d3875c89618..d6fbb7c9530 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -863,7 +863,7 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegate() const QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const { const QModelIndex current = currentIndex(); - if (!current.isValid() || query != Qt::ImMicroFocus) + if (!current.isValid() || query != Qt::ImCursorRectangle) return QAbstractScrollArea::inputMethodQuery(query); return visualRect(current); } @@ -1880,8 +1880,8 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event) || !d->isIndexEnabled(index) || (d->pressedIndex != index)) { QMouseEvent me(QEvent::MouseButtonPress, - event->pos(), event->button(), - event->buttons(), event->modifiers()); + event->localPos(), event->windowPos(), event->screenPos(), + event->button(), event->buttons(), event->modifiers()); mousePressEvent(&me); return; } diff --git a/src/gui/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h similarity index 98% rename from src/gui/itemviews/qabstractitemview.h rename to src/widgets/itemviews/qabstractitemview.h index e49ce0b6d00..8a2e1cb04e1 100644 --- a/src/gui/itemviews/qabstractitemview.h +++ b/src/widgets/itemviews/qabstractitemview.h @@ -42,10 +42,10 @@ #ifndef QABSTRACTITEMVIEW_H #define QABSTRACTITEMVIEW_H -#include <QtGui/qabstractscrollarea.h> +#include <QtWidgets/qabstractscrollarea.h> #include <QtCore/qabstractitemmodel.h> -#include <QtGui/qitemselectionmodel.h> -#include <QtGui/qabstractitemdelegate.h> +#include <QtWidgets/qitemselectionmodel.h> +#include <QtWidgets/qabstractitemdelegate.h> QT_BEGIN_HEADER @@ -60,7 +60,7 @@ class QDrag; class QEvent; class QAbstractItemViewPrivate; -class Q_GUI_EXPORT QAbstractItemView : public QAbstractScrollArea +class Q_WIDGETS_EXPORT QAbstractItemView : public QAbstractScrollArea { Q_OBJECT Q_ENUMS(SelectionMode SelectionBehavior ScrollHint ScrollMode DragDropMode) diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h similarity index 99% rename from src/gui/itemviews/qabstractitemview_p.h rename to src/widgets/itemviews/qabstractitemview_p.h index c1b4ca3e121..cd15694ffed 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/widgets/itemviews/qabstractitemview_p.h @@ -55,7 +55,7 @@ #include "private/qabstractscrollarea_p.h" #include "private/qabstractitemmodel_p.h" -#include "QtGui/qapplication.h" +#include "QtWidgets/qapplication.h" #include "QtGui/qevent.h" #include "QtGui/qmime.h" #include "QtGui/qpainter.h" diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/widgets/itemviews/qabstractproxymodel.cpp similarity index 100% rename from src/gui/itemviews/qabstractproxymodel.cpp rename to src/widgets/itemviews/qabstractproxymodel.cpp diff --git a/src/gui/itemviews/qabstractproxymodel.h b/src/widgets/itemviews/qabstractproxymodel.h similarity index 98% rename from src/gui/itemviews/qabstractproxymodel.h rename to src/widgets/itemviews/qabstractproxymodel.h index 1c2c8ea7227..a24755b5567 100644 --- a/src/gui/itemviews/qabstractproxymodel.h +++ b/src/widgets/itemviews/qabstractproxymodel.h @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QAbstractProxyModelPrivate; class QItemSelection; -class Q_GUI_EXPORT QAbstractProxyModel : public QAbstractItemModel +class Q_WIDGETS_EXPORT QAbstractProxyModel : public QAbstractItemModel { Q_OBJECT diff --git a/src/gui/itemviews/qabstractproxymodel_p.h b/src/widgets/itemviews/qabstractproxymodel_p.h similarity index 100% rename from src/gui/itemviews/qabstractproxymodel_p.h rename to src/widgets/itemviews/qabstractproxymodel_p.h diff --git a/src/gui/itemviews/qbsptree.cpp b/src/widgets/itemviews/qbsptree.cpp similarity index 100% rename from src/gui/itemviews/qbsptree.cpp rename to src/widgets/itemviews/qbsptree.cpp diff --git a/src/gui/itemviews/qbsptree_p.h b/src/widgets/itemviews/qbsptree_p.h similarity index 100% rename from src/gui/itemviews/qbsptree_p.h rename to src/widgets/itemviews/qbsptree_p.h diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp similarity index 100% rename from src/gui/itemviews/qcolumnview.cpp rename to src/widgets/itemviews/qcolumnview.cpp diff --git a/src/gui/itemviews/qcolumnview.h b/src/widgets/itemviews/qcolumnview.h similarity index 97% rename from src/gui/itemviews/qcolumnview.h rename to src/widgets/itemviews/qcolumnview.h index ec20c9d7ad4..b6d8687808f 100644 --- a/src/gui/itemviews/qcolumnview.h +++ b/src/widgets/itemviews/qcolumnview.h @@ -42,7 +42,7 @@ #ifndef QCOLUMNVIEW_H #define QCOLUMNVIEW_H -#include <QtGui/qabstractitemview.h> +#include <QtWidgets/qabstractitemview.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QColumnViewPrivate; -class Q_GUI_EXPORT QColumnView : public QAbstractItemView { +class Q_WIDGETS_EXPORT QColumnView : public QAbstractItemView { Q_OBJECT Q_PROPERTY(bool resizeGripsVisible READ resizeGripsVisible WRITE setResizeGripsVisible) diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/widgets/itemviews/qcolumnview_p.h similarity index 97% rename from src/gui/itemviews/qcolumnview_p.h rename to src/widgets/itemviews/qcolumnview_p.h index e7f8b9a3111..0da719e7563 100644 --- a/src/gui/itemviews/qcolumnview_p.h +++ b/src/widgets/itemviews/qcolumnview_p.h @@ -61,9 +61,9 @@ #include <QtCore/qabstractitemmodel.h> #include <QtCore/qpropertyanimation.h> -#include <QtGui/qabstractitemdelegate.h> -#include <QtGui/qabstractitemview.h> -#include <QtGui/qitemdelegate.h> +#include <QtWidgets/qabstractitemdelegate.h> +#include <QtWidgets/qabstractitemview.h> +#include <QtWidgets/qitemdelegate.h> #include <qlistview.h> #include <qevent.h> #include <qscrollbar.h> diff --git a/src/gui/itemviews/qcolumnviewgrip.cpp b/src/widgets/itemviews/qcolumnviewgrip.cpp similarity index 100% rename from src/gui/itemviews/qcolumnviewgrip.cpp rename to src/widgets/itemviews/qcolumnviewgrip.cpp diff --git a/src/gui/itemviews/qcolumnviewgrip_p.h b/src/widgets/itemviews/qcolumnviewgrip_p.h similarity index 100% rename from src/gui/itemviews/qcolumnviewgrip_p.h rename to src/widgets/itemviews/qcolumnviewgrip_p.h diff --git a/src/gui/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp similarity index 100% rename from src/gui/itemviews/qdatawidgetmapper.cpp rename to src/widgets/itemviews/qdatawidgetmapper.cpp diff --git a/src/gui/itemviews/qdatawidgetmapper.h b/src/widgets/itemviews/qdatawidgetmapper.h similarity index 98% rename from src/gui/itemviews/qdatawidgetmapper.h rename to src/widgets/itemviews/qdatawidgetmapper.h index c1d47d3fc2e..ebb180fa209 100644 --- a/src/gui/itemviews/qdatawidgetmapper.h +++ b/src/widgets/itemviews/qdatawidgetmapper.h @@ -57,7 +57,7 @@ class QAbstractItemModel; class QModelIndex; class QDataWidgetMapperPrivate; -class Q_GUI_EXPORT QDataWidgetMapper: public QObject +class Q_WIDGETS_EXPORT QDataWidgetMapper: public QObject { Q_OBJECT diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp similarity index 100% rename from src/gui/itemviews/qdirmodel.cpp rename to src/widgets/itemviews/qdirmodel.cpp diff --git a/src/gui/itemviews/qdirmodel.h b/src/widgets/itemviews/qdirmodel.h similarity index 98% rename from src/gui/itemviews/qdirmodel.h rename to src/widgets/itemviews/qdirmodel.h index 8ba0450b1d5..4ad89065f94 100644 --- a/src/gui/itemviews/qdirmodel.h +++ b/src/widgets/itemviews/qdirmodel.h @@ -44,7 +44,7 @@ #include <QtCore/qabstractitemmodel.h> #include <QtCore/qdir.h> -#include <QtGui/qfileiconprovider.h> +#include <QtWidgets/qfileiconprovider.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QDirModelPrivate; -class Q_GUI_EXPORT QDirModel : public QAbstractItemModel +class Q_WIDGETS_EXPORT QDirModel : public QAbstractItemModel { Q_OBJECT Q_PROPERTY(bool resolveSymlinks READ resolveSymlinks WRITE setResolveSymlinks) diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp similarity index 100% rename from src/gui/itemviews/qfileiconprovider.cpp rename to src/widgets/itemviews/qfileiconprovider.cpp diff --git a/src/gui/itemviews/qfileiconprovider.h b/src/widgets/itemviews/qfileiconprovider.h similarity index 97% rename from src/gui/itemviews/qfileiconprovider.h rename to src/widgets/itemviews/qfileiconprovider.h index 3fab0b142a5..fcaaa9f78e8 100644 --- a/src/gui/itemviews/qfileiconprovider.h +++ b/src/widgets/itemviews/qfileiconprovider.h @@ -44,7 +44,7 @@ #include <QtCore/qfileinfo.h> #include <QtCore/qscopedpointer.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qicon.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QFileIconProviderPrivate; -class Q_GUI_EXPORT QFileIconProvider +class Q_WIDGETS_EXPORT QFileIconProvider { public: QFileIconProvider(); diff --git a/src/gui/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp similarity index 100% rename from src/gui/itemviews/qheaderview.cpp rename to src/widgets/itemviews/qheaderview.cpp diff --git a/src/gui/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h similarity index 98% rename from src/gui/itemviews/qheaderview.h rename to src/widgets/itemviews/qheaderview.h index b2e684d20ec..c9793759a14 100644 --- a/src/gui/itemviews/qheaderview.h +++ b/src/widgets/itemviews/qheaderview.h @@ -42,7 +42,7 @@ #ifndef QHEADERVIEW_H #define QHEADERVIEW_H -#include <QtGui/qabstractitemview.h> +#include <QtWidgets/qabstractitemview.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QHeaderViewPrivate; class QStyleOptionHeader; -class Q_GUI_EXPORT QHeaderView : public QAbstractItemView +class Q_WIDGETS_EXPORT QHeaderView : public QAbstractItemView { Q_OBJECT Q_PROPERTY(bool showSortIndicator READ isSortIndicatorShown WRITE setSortIndicatorShown) diff --git a/src/gui/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h similarity index 99% rename from src/gui/itemviews/qheaderview_p.h rename to src/widgets/itemviews/qheaderview_p.h index 5a9e1854b94..b2b8d686b5f 100644 --- a/src/gui/itemviews/qheaderview_p.h +++ b/src/widgets/itemviews/qheaderview_p.h @@ -58,8 +58,8 @@ #ifndef QT_NO_ITEMVIEWS #include "QtCore/qbitarray.h" -#include "QtGui/qapplication.h" -#include "QtGui/qlabel.h" +#include "QtWidgets/qapplication.h" +#include "QtWidgets/qlabel.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/itemviews/qidentityproxymodel.cpp b/src/widgets/itemviews/qidentityproxymodel.cpp similarity index 100% rename from src/gui/itemviews/qidentityproxymodel.cpp rename to src/widgets/itemviews/qidentityproxymodel.cpp diff --git a/src/gui/itemviews/qidentityproxymodel.h b/src/widgets/itemviews/qidentityproxymodel.h similarity index 97% rename from src/gui/itemviews/qidentityproxymodel.h rename to src/widgets/itemviews/qidentityproxymodel.h index 40ad67358af..8a8422244f3 100644 --- a/src/gui/itemviews/qidentityproxymodel.h +++ b/src/widgets/itemviews/qidentityproxymodel.h @@ -43,7 +43,7 @@ #ifndef QIDENTITYPROXYMODEL_H #define QIDENTITYPROXYMODEL_H -#include <QtGui/qabstractproxymodel.h> +#include <QtWidgets/qabstractproxymodel.h> #ifndef QT_NO_IDENTITYPROXYMODEL @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QIdentityProxyModelPrivate; -class Q_GUI_EXPORT QIdentityProxyModel : public QAbstractProxyModel +class Q_WIDGETS_EXPORT QIdentityProxyModel : public QAbstractProxyModel { Q_OBJECT public: diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp similarity index 99% rename from src/gui/itemviews/qitemdelegate.cpp rename to src/widgets/itemviews/qitemdelegate.cpp index c1f957b6389..a2da62ac83e 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/widgets/itemviews/qitemdelegate.cpp @@ -1044,7 +1044,7 @@ static QString qPixmapSerial(quint64 i, bool enabled) */ QPixmap *QItemDelegate::selected(const QPixmap &pixmap, const QPalette &palette, bool enabled) const { - QString key = qPixmapSerial(qt_pixmap_id(pixmap), enabled); + QString key = qPixmapSerial(pixmap.cacheKey(), enabled); QPixmap *pm = QPixmapCache::find(key); if (!pm) { QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); diff --git a/src/gui/itemviews/qitemdelegate.h b/src/widgets/itemviews/qitemdelegate.h similarity index 97% rename from src/gui/itemviews/qitemdelegate.h rename to src/widgets/itemviews/qitemdelegate.h index 8562f32a600..97f3cc820e3 100644 --- a/src/gui/itemviews/qitemdelegate.h +++ b/src/widgets/itemviews/qitemdelegate.h @@ -42,7 +42,7 @@ #ifndef QITEMDELEGATE_H #define QITEMDELEGATE_H -#include <QtGui/qabstractitemdelegate.h> +#include <QtWidgets/qabstractitemdelegate.h> #include <QtCore/qstring.h> #include <QtGui/qpixmap.h> #include <QtCore/qvariant.h> @@ -58,7 +58,7 @@ QT_MODULE(Gui) class QItemDelegatePrivate; class QItemEditorFactory; -class Q_GUI_EXPORT QItemDelegate : public QAbstractItemDelegate +class Q_WIDGETS_EXPORT QItemDelegate : public QAbstractItemDelegate { Q_OBJECT Q_PROPERTY(bool clipping READ hasClipping WRITE setClipping) diff --git a/src/gui/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp similarity index 100% rename from src/gui/itemviews/qitemeditorfactory.cpp rename to src/widgets/itemviews/qitemeditorfactory.cpp diff --git a/src/gui/itemviews/qitemeditorfactory.h b/src/widgets/itemviews/qitemeditorfactory.h similarity index 97% rename from src/gui/itemviews/qitemeditorfactory.h rename to src/widgets/itemviews/qitemeditorfactory.h index 5b70e6ac8ba..b48cac224f1 100644 --- a/src/gui/itemviews/qitemeditorfactory.h +++ b/src/widgets/itemviews/qitemeditorfactory.h @@ -57,7 +57,7 @@ QT_MODULE(Gui) class QWidget; -class Q_GUI_EXPORT QItemEditorCreatorBase +class Q_WIDGETS_EXPORT QItemEditorCreatorBase { public: virtual ~QItemEditorCreatorBase() {} @@ -97,7 +97,7 @@ template <class T> Q_INLINE_TEMPLATE QItemEditorCreator<T>::QItemEditorCreator(const QByteArray &avaluePropertyName) : propertyName(avaluePropertyName) {} -class Q_GUI_EXPORT QItemEditorFactory +class Q_WIDGETS_EXPORT QItemEditorFactory { public: inline QItemEditorFactory() {} diff --git a/src/gui/itemviews/qitemeditorfactory_p.h b/src/widgets/itemviews/qitemeditorfactory_p.h similarity index 100% rename from src/gui/itemviews/qitemeditorfactory_p.h rename to src/widgets/itemviews/qitemeditorfactory_p.h diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/widgets/itemviews/qitemselectionmodel.cpp similarity index 100% rename from src/gui/itemviews/qitemselectionmodel.cpp rename to src/widgets/itemviews/qitemselectionmodel.cpp diff --git a/src/gui/itemviews/qitemselectionmodel.h b/src/widgets/itemviews/qitemselectionmodel.h similarity index 97% rename from src/gui/itemviews/qitemselectionmodel.h rename to src/widgets/itemviews/qitemselectionmodel.h index 3f4aa720086..5a117c8a1c4 100644 --- a/src/gui/itemviews/qitemselectionmodel.h +++ b/src/widgets/itemviews/qitemselectionmodel.h @@ -55,7 +55,7 @@ QT_MODULE(Gui) #ifndef QT_NO_ITEMVIEWS -class Q_GUI_EXPORT QItemSelectionRange +class Q_WIDGETS_EXPORT QItemSelectionRange { public: @@ -148,7 +148,7 @@ inline QItemSelectionRange::QItemSelectionRange(const QModelIndex &atopLeft, class QItemSelection; class QItemSelectionModelPrivate; -class Q_GUI_EXPORT QItemSelectionModel : public QObject +class Q_WIDGETS_EXPORT QItemSelectionModel : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QItemSelectionModel) @@ -228,7 +228,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags) // dummy implentation of qHash() necessary for instantiating QList<QItemSelectionRange>::toSet() with MSVC inline uint qHash(const QItemSelectionRange &) { return 0; } -class Q_GUI_EXPORT QItemSelection : public QList<QItemSelectionRange> +class Q_WIDGETS_EXPORT QItemSelection : public QList<QItemSelectionRange> { public: QItemSelection() {} @@ -243,7 +243,7 @@ public: }; #ifndef QT_NO_DEBUG_STREAM -Q_GUI_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QItemSelectionRange &); #endif #endif // QT_NO_ITEMVIEWS diff --git a/src/gui/itemviews/qitemselectionmodel_p.h b/src/widgets/itemviews/qitemselectionmodel_p.h similarity index 100% rename from src/gui/itemviews/qitemselectionmodel_p.h rename to src/widgets/itemviews/qitemselectionmodel_p.h diff --git a/src/gui/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp similarity index 99% rename from src/gui/itemviews/qlistview.cpp rename to src/widgets/itemviews/qlistview.cpp index a0955d256e0..d879e65c14e 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -46,6 +46,7 @@ #include <qapplication.h> #include <qpainter.h> #include <qbitmap.h> +#include <qdrag.h> #include <qvector.h> #include <qstyle.h> #include <qevent.h> diff --git a/src/gui/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h similarity index 98% rename from src/gui/itemviews/qlistview.h rename to src/widgets/itemviews/qlistview.h index d51d9e66da9..49d65832444 100644 --- a/src/gui/itemviews/qlistview.h +++ b/src/widgets/itemviews/qlistview.h @@ -42,7 +42,7 @@ #ifndef QLISTVIEW_H #define QLISTVIEW_H -#include <QtGui/qabstractitemview.h> +#include <QtWidgets/qabstractitemview.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QListViewPrivate; -class Q_GUI_EXPORT QListView : public QAbstractItemView +class Q_WIDGETS_EXPORT QListView : public QAbstractItemView { Q_OBJECT Q_ENUMS(Movement Flow ResizeMode LayoutMode ViewMode) diff --git a/src/gui/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h similarity index 100% rename from src/gui/itemviews/qlistview_p.h rename to src/widgets/itemviews/qlistview_p.h diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp similarity index 100% rename from src/gui/itemviews/qlistwidget.cpp rename to src/widgets/itemviews/qlistwidget.cpp diff --git a/src/gui/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h similarity index 97% rename from src/gui/itemviews/qlistwidget.h rename to src/widgets/itemviews/qlistwidget.h index f16f6744ba8..750b85b4c1c 100644 --- a/src/gui/itemviews/qlistwidget.h +++ b/src/widgets/itemviews/qlistwidget.h @@ -42,10 +42,10 @@ #ifndef QLISTWIDGET_H #define QLISTWIDGET_H -#include <QtGui/qlistview.h> +#include <QtWidgets/qlistview.h> #include <QtCore/qvariant.h> #include <QtCore/qvector.h> -#include <QtGui/qitemselectionmodel.h> +#include <QtWidgets/qitemselectionmodel.h> QT_BEGIN_HEADER @@ -60,7 +60,7 @@ class QListModel; class QWidgetItemData; class QListWidgetItemPrivate; -class Q_GUI_EXPORT QListWidgetItem +class Q_WIDGETS_EXPORT QListWidgetItem { friend class QListModel; friend class QListWidget; @@ -193,13 +193,13 @@ inline void QListWidgetItem::setFont(const QFont &afont) { setData(Qt::FontRole, afont); } #ifndef QT_NO_DATASTREAM -Q_GUI_EXPORT QDataStream &operator<<(QDataStream &out, const QListWidgetItem &item); -Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QListWidgetItem &item); +Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &out, const QListWidgetItem &item); +Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &in, QListWidgetItem &item); #endif class QListWidgetPrivate; -class Q_GUI_EXPORT QListWidget : public QListView +class Q_WIDGETS_EXPORT QListWidget : public QListView { Q_OBJECT Q_PROPERTY(int count READ count) diff --git a/src/gui/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h similarity index 98% rename from src/gui/itemviews/qlistwidget_p.h rename to src/widgets/itemviews/qlistwidget_p.h index c94e1510814..2e879cc5d73 100644 --- a/src/gui/itemviews/qlistwidget_p.h +++ b/src/widgets/itemviews/qlistwidget_p.h @@ -53,8 +53,8 @@ // #include <QtCore/qabstractitemmodel.h> -#include <QtGui/qabstractitemview.h> -#include <QtGui/qlistwidget.h> +#include <QtWidgets/qabstractitemview.h> +#include <QtWidgets/qlistwidget.h> #include <qitemdelegate.h> #include <private/qlistview_p.h> #include <private/qwidgetitemdata_p.h> diff --git a/src/gui/itemviews/qproxymodel.cpp b/src/widgets/itemviews/qproxymodel.cpp similarity index 100% rename from src/gui/itemviews/qproxymodel.cpp rename to src/widgets/itemviews/qproxymodel.cpp diff --git a/src/gui/itemviews/qproxymodel.h b/src/widgets/itemviews/qproxymodel.h similarity index 98% rename from src/gui/itemviews/qproxymodel.h rename to src/widgets/itemviews/qproxymodel.h index 49145bb1d79..948f9a07c9d 100644 --- a/src/gui/itemviews/qproxymodel.h +++ b/src/widgets/itemviews/qproxymodel.h @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QProxyModelPrivate; -class Q_GUI_EXPORT QProxyModel : public QAbstractItemModel +class Q_WIDGETS_EXPORT QProxyModel : public QAbstractItemModel { Q_OBJECT diff --git a/src/gui/itemviews/qproxymodel_p.h b/src/widgets/itemviews/qproxymodel_p.h similarity index 100% rename from src/gui/itemviews/qproxymodel_p.h rename to src/widgets/itemviews/qproxymodel_p.h diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/widgets/itemviews/qsortfilterproxymodel.cpp similarity index 100% rename from src/gui/itemviews/qsortfilterproxymodel.cpp rename to src/widgets/itemviews/qsortfilterproxymodel.cpp diff --git a/src/gui/itemviews/qsortfilterproxymodel.h b/src/widgets/itemviews/qsortfilterproxymodel.h similarity index 98% rename from src/gui/itemviews/qsortfilterproxymodel.h rename to src/widgets/itemviews/qsortfilterproxymodel.h index da132869b44..68d92be841c 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.h +++ b/src/widgets/itemviews/qsortfilterproxymodel.h @@ -42,7 +42,7 @@ #ifndef QSORTFILTERPROXYMODEL_H #define QSORTFILTERPROXYMODEL_H -#include <QtGui/qabstractproxymodel.h> +#include <QtWidgets/qabstractproxymodel.h> #ifndef QT_NO_SORTFILTERPROXYMODEL @@ -58,7 +58,7 @@ class QSortFilterProxyModelPrivate; class QSortFilterProxyModelLessThan; class QSortFilterProxyModelGreaterThan; -class Q_GUI_EXPORT QSortFilterProxyModel : public QAbstractProxyModel +class Q_WIDGETS_EXPORT QSortFilterProxyModel : public QAbstractProxyModel { friend class QSortFilterProxyModelLessThan; friend class QSortFilterProxyModelGreaterThan; diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/widgets/itemviews/qstandarditemmodel.cpp similarity index 100% rename from src/gui/itemviews/qstandarditemmodel.cpp rename to src/widgets/itemviews/qstandarditemmodel.cpp diff --git a/src/gui/itemviews/qstandarditemmodel.h b/src/widgets/itemviews/qstandarditemmodel.h similarity index 98% rename from src/gui/itemviews/qstandarditemmodel.h rename to src/widgets/itemviews/qstandarditemmodel.h index d3219df526a..b1e70fffadd 100644 --- a/src/gui/itemviews/qstandarditemmodel.h +++ b/src/widgets/itemviews/qstandarditemmodel.h @@ -45,7 +45,7 @@ #include <QtCore/qabstractitemmodel.h> #include <QtGui/qbrush.h> #include <QtGui/qfont.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qicon.h> #ifndef QT_NO_DATASTREAM #include <QtCore/qdatastream.h> #endif @@ -63,7 +63,7 @@ template <class T> class QList; class QStandardItemModel; class QStandardItemPrivate; -class Q_GUI_EXPORT QStandardItem +class Q_WIDGETS_EXPORT QStandardItem { public: QStandardItem(); @@ -315,7 +315,7 @@ inline void QStandardItem::appendRow(QStandardItem *aitem) class QStandardItemModelPrivate; -class Q_GUI_EXPORT QStandardItemModel : public QAbstractItemModel +class Q_WIDGETS_EXPORT QStandardItemModel : public QAbstractItemModel { Q_OBJECT Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole) @@ -443,8 +443,8 @@ inline bool QStandardItemModel::insertColumn(int acolumn, const QModelIndex &apa { return QAbstractItemModel::insertColumn(acolumn, aparent); } #ifndef QT_NO_DATASTREAM -Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QStandardItem &item); -Q_GUI_EXPORT QDataStream &operator<<(QDataStream &out, const QStandardItem &item); +Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &in, QStandardItem &item); +Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &out, const QStandardItem &item); #endif #endif // QT_NO_STANDARDITEMMODEL diff --git a/src/gui/itemviews/qstandarditemmodel_p.h b/src/widgets/itemviews/qstandarditemmodel_p.h similarity index 100% rename from src/gui/itemviews/qstandarditemmodel_p.h rename to src/widgets/itemviews/qstandarditemmodel_p.h diff --git a/src/gui/itemviews/qstringlistmodel.cpp b/src/widgets/itemviews/qstringlistmodel.cpp similarity index 100% rename from src/gui/itemviews/qstringlistmodel.cpp rename to src/widgets/itemviews/qstringlistmodel.cpp diff --git a/src/gui/itemviews/qstringlistmodel.h b/src/widgets/itemviews/qstringlistmodel.h similarity index 96% rename from src/gui/itemviews/qstringlistmodel.h rename to src/widgets/itemviews/qstringlistmodel.h index bdfe4d8d3b6..5efed8753eb 100644 --- a/src/gui/itemviews/qstringlistmodel.h +++ b/src/widgets/itemviews/qstringlistmodel.h @@ -43,7 +43,7 @@ #define QSTRINGLISTMODEL_H #include <QtCore/qstringlist.h> -#include <QtGui/qabstractitemview.h> +#include <QtWidgets/qabstractitemview.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) #ifndef QT_NO_STRINGLISTMODEL -class Q_GUI_EXPORT QStringListModel : public QAbstractListModel +class Q_WIDGETS_EXPORT QStringListModel : public QAbstractListModel { Q_OBJECT public: diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp similarity index 100% rename from src/gui/itemviews/qstyleditemdelegate.cpp rename to src/widgets/itemviews/qstyleditemdelegate.cpp diff --git a/src/gui/itemviews/qstyleditemdelegate.h b/src/widgets/itemviews/qstyleditemdelegate.h similarity index 96% rename from src/gui/itemviews/qstyleditemdelegate.h rename to src/widgets/itemviews/qstyleditemdelegate.h index 8b2bc14a811..6dda0041c9d 100644 --- a/src/gui/itemviews/qstyleditemdelegate.h +++ b/src/widgets/itemviews/qstyleditemdelegate.h @@ -42,7 +42,7 @@ #ifndef QSTYLEDITEMDELEGATE_H #define QSTYLEDITEMDELEGATE_H -#include <QtGui/qabstractitemdelegate.h> +#include <QtWidgets/qabstractitemdelegate.h> #include <QtCore/qstring.h> #include <QtGui/qpixmap.h> #include <QtCore/qvariant.h> @@ -58,7 +58,7 @@ QT_MODULE(Gui) class QStyledItemDelegatePrivate; class QItemEditorFactory; -class Q_GUI_EXPORT QStyledItemDelegate : public QAbstractItemDelegate +class Q_WIDGETS_EXPORT QStyledItemDelegate : public QAbstractItemDelegate { Q_OBJECT diff --git a/src/gui/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp similarity index 100% rename from src/gui/itemviews/qtableview.cpp rename to src/widgets/itemviews/qtableview.cpp diff --git a/src/gui/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h similarity index 98% rename from src/gui/itemviews/qtableview.h rename to src/widgets/itemviews/qtableview.h index 27b2dccf3f9..29f37938363 100644 --- a/src/gui/itemviews/qtableview.h +++ b/src/widgets/itemviews/qtableview.h @@ -42,7 +42,7 @@ #ifndef QTABLEVIEW_H #define QTABLEVIEW_H -#include <QtGui/qabstractitemview.h> +#include <QtWidgets/qabstractitemview.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QHeaderView; class QTableViewPrivate; -class Q_GUI_EXPORT QTableView : public QAbstractItemView +class Q_WIDGETS_EXPORT QTableView : public QAbstractItemView { Q_OBJECT Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid) diff --git a/src/gui/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h similarity index 100% rename from src/gui/itemviews/qtableview_p.h rename to src/widgets/itemviews/qtableview_p.h diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp similarity index 100% rename from src/gui/itemviews/qtablewidget.cpp rename to src/widgets/itemviews/qtablewidget.cpp diff --git a/src/gui/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h similarity index 97% rename from src/gui/itemviews/qtablewidget.h rename to src/widgets/itemviews/qtablewidget.h index 30b93485355..d7332542d2b 100644 --- a/src/gui/itemviews/qtablewidget.h +++ b/src/widgets/itemviews/qtablewidget.h @@ -42,10 +42,10 @@ #ifndef QTABLEWIDGET_H #define QTABLEWIDGET_H -#include <QtGui/qtableview.h> +#include <QtWidgets/qtableview.h> #include <QtCore/qvariant.h> #include <QtCore/qvector.h> -//#include <QtGui/qitemselectionmodel.h> +//#include <QtWidgets/qitemselectionmodel.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) #ifndef QT_NO_TABLEWIDGET -class Q_GUI_EXPORT QTableWidgetSelectionRange +class Q_WIDGETS_EXPORT QTableWidgetSelectionRange { public: QTableWidgetSelectionRange(); @@ -79,7 +79,7 @@ class QTableModel; class QWidgetItemData; class QTableWidgetItemPrivate; -class Q_GUI_EXPORT QTableWidgetItem +class Q_WIDGETS_EXPORT QTableWidgetItem { friend class QTableWidget; friend class QTableModel; @@ -211,13 +211,13 @@ inline void QTableWidgetItem::setFont(const QFont &afont) { setData(Qt::FontRole, afont); } #ifndef QT_NO_DATASTREAM -Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QTableWidgetItem &item); -Q_GUI_EXPORT QDataStream &operator<<(QDataStream &out, const QTableWidgetItem &item); +Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &in, QTableWidgetItem &item); +Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &out, const QTableWidgetItem &item); #endif class QTableWidgetPrivate; -class Q_GUI_EXPORT QTableWidget : public QTableView +class Q_WIDGETS_EXPORT QTableWidget : public QTableView { Q_OBJECT Q_PROPERTY(int rowCount READ rowCount WRITE setRowCount) diff --git a/src/gui/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h similarity index 100% rename from src/gui/itemviews/qtablewidget_p.h rename to src/widgets/itemviews/qtablewidget_p.h diff --git a/src/gui/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp similarity index 100% rename from src/gui/itemviews/qtreeview.cpp rename to src/widgets/itemviews/qtreeview.cpp diff --git a/src/gui/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h similarity index 98% rename from src/gui/itemviews/qtreeview.h rename to src/widgets/itemviews/qtreeview.h index b77da4e89af..47cac2faed9 100644 --- a/src/gui/itemviews/qtreeview.h +++ b/src/widgets/itemviews/qtreeview.h @@ -42,7 +42,7 @@ #ifndef QTREEVIEW_H #define QTREEVIEW_H -#include <QtGui/qabstractitemview.h> +#include <QtWidgets/qabstractitemview.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QTreeViewPrivate; class QHeaderView; -class Q_GUI_EXPORT QTreeView : public QAbstractItemView +class Q_WIDGETS_EXPORT QTreeView : public QAbstractItemView { Q_OBJECT Q_PROPERTY(int autoExpandDelay READ autoExpandDelay WRITE setAutoExpandDelay) diff --git a/src/gui/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h similarity index 99% rename from src/gui/itemviews/qtreeview_p.h rename to src/widgets/itemviews/qtreeview_p.h index a9dc4523982..5a90b15389e 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/widgets/itemviews/qtreeview_p.h @@ -78,7 +78,7 @@ struct QTreeViewItem Q_DECLARE_TYPEINFO(QTreeViewItem, Q_MOVABLE_TYPE); -class Q_GUI_EXPORT QTreeViewPrivate : public QAbstractItemViewPrivate +class Q_WIDGETS_EXPORT QTreeViewPrivate : public QAbstractItemViewPrivate { Q_DECLARE_PUBLIC(QTreeView) public: diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp similarity index 100% rename from src/gui/itemviews/qtreewidget.cpp rename to src/widgets/itemviews/qtreewidget.cpp diff --git a/src/gui/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h similarity index 97% rename from src/gui/itemviews/qtreewidget.h rename to src/widgets/itemviews/qtreewidget.h index 5561ba9948f..ec4b0d85857 100644 --- a/src/gui/itemviews/qtreewidget.h +++ b/src/widgets/itemviews/qtreewidget.h @@ -42,8 +42,8 @@ #ifndef QTREEWIDGET_H #define QTREEWIDGET_H -#include <QtGui/qtreeview.h> -#include <QtGui/qtreewidgetitemiterator.h> +#include <QtWidgets/qtreeview.h> +#include <QtWidgets/qtreewidgetitemiterator.h> #include <QtCore/qvariant.h> #include <QtCore/qvector.h> @@ -60,7 +60,7 @@ class QTreeModel; class QWidgetItemData; class QTreeWidgetItemPrivate; -class Q_GUI_EXPORT QTreeWidgetItem +class Q_WIDGETS_EXPORT QTreeWidgetItem { friend class QTreeModel; friend class QTreeWidget; @@ -251,13 +251,13 @@ inline int QTreeWidgetItem::indexOfChild(QTreeWidgetItem *achild) const { executePendingSort(); return children.indexOf(achild); } #ifndef QT_NO_DATASTREAM -Q_GUI_EXPORT QDataStream &operator<<(QDataStream &out, const QTreeWidgetItem &item); -Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QTreeWidgetItem &item); +Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &out, const QTreeWidgetItem &item); +Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &in, QTreeWidgetItem &item); #endif class QTreeWidgetPrivate; -class Q_GUI_EXPORT QTreeWidget : public QTreeView +class Q_WIDGETS_EXPORT QTreeWidget : public QTreeView { Q_OBJECT Q_PROPERTY(int columnCount READ columnCount WRITE setColumnCount) diff --git a/src/gui/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h similarity index 99% rename from src/gui/itemviews/qtreewidget_p.h rename to src/widgets/itemviews/qtreewidget_p.h index 8386f03f6ea..1ead6837c18 100644 --- a/src/gui/itemviews/qtreewidget_p.h +++ b/src/widgets/itemviews/qtreewidget_p.h @@ -56,9 +56,9 @@ #include <private/qabstractitemmodel_p.h> #include <QtCore/qpair.h> #include <QtCore/qbasictimer.h> -#include <QtGui/qtreewidget.h> +#include <QtWidgets/qtreewidget.h> #include <private/qtreeview_p.h> -#include <QtGui/qheaderview.h> +#include <QtWidgets/qheaderview.h> #ifndef QT_NO_TREEWIDGET diff --git a/src/gui/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp similarity index 100% rename from src/gui/itemviews/qtreewidgetitemiterator.cpp rename to src/widgets/itemviews/qtreewidgetitemiterator.cpp diff --git a/src/gui/itemviews/qtreewidgetitemiterator.h b/src/widgets/itemviews/qtreewidgetitemiterator.h similarity index 99% rename from src/gui/itemviews/qtreewidgetitemiterator.h rename to src/widgets/itemviews/qtreewidgetitemiterator.h index 396e18abe22..8d27afe2c3d 100644 --- a/src/gui/itemviews/qtreewidgetitemiterator.h +++ b/src/widgets/itemviews/qtreewidgetitemiterator.h @@ -58,7 +58,7 @@ class QTreeWidgetItem; class QTreeModel; class QTreeWidgetItemIteratorPrivate; -class Q_GUI_EXPORT QTreeWidgetItemIterator +class Q_WIDGETS_EXPORT QTreeWidgetItemIterator { friend class QTreeModel; diff --git a/src/gui/itemviews/qtreewidgetitemiterator_p.h b/src/widgets/itemviews/qtreewidgetitemiterator_p.h similarity index 100% rename from src/gui/itemviews/qtreewidgetitemiterator_p.h rename to src/widgets/itemviews/qtreewidgetitemiterator_p.h diff --git a/src/gui/itemviews/qwidgetitemdata_p.h b/src/widgets/itemviews/qwidgetitemdata_p.h similarity index 100% rename from src/gui/itemviews/qwidgetitemdata_p.h rename to src/widgets/itemviews/qwidgetitemdata_p.h diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri new file mode 100644 index 00000000000..8fbf9685813 --- /dev/null +++ b/src/widgets/kernel/kernel.pri @@ -0,0 +1,249 @@ +# Qt kernel module + +# Only used on platforms with CONFIG += precompile_header +PRECOMPILED_HEADER = kernel/qt_gui_pch.h + + +KERNEL_P= kernel +HEADERS += \ + kernel/qaction.h \ + kernel/qaction_p.h \ + kernel/qactiongroup.h \ + kernel/qapplication.h \ + kernel/qapplication_p.h \ + kernel/qwidgetbackingstore_p.h \ + kernel/qboxlayout.h \ + kernel/qdesktopwidget.h \ + kernel/qformlayout.h \ + kernel/qgridlayout.h \ + kernel/qicon.h \ + kernel/qicon_p.h \ + kernel/qiconloader_p.h \ + kernel/qiconengine.h \ + kernel/qiconengineplugin.h \ + kernel/qinputcontext.h \ + kernel/qlayout.h \ + kernel/qlayout_p.h \ + kernel/qlayoutengine_p.h \ + kernel/qlayoutitem.h \ + kernel/qsizepolicy.h \ + kernel/qstackedlayout.h \ + kernel/qtooltip.h \ + kernel/qwhatsthis.h \ + kernel/qwidget.h \ + kernel/qwidget_p.h \ + kernel/qwidgetaction.h \ + kernel/qwidgetaction_p.h \ + kernel/qgesture.h \ + kernel/qgesture_p.h \ + kernel/qstandardgestures_p.h \ + kernel/qgesturerecognizer.h \ + kernel/qgesturemanager_p.h \ + kernel/qsoftkeymanager_p.h \ + kernel/qsoftkeymanager_common_p.h \ + kernel/qguiplatformplugin_p.h + +SOURCES += \ + kernel/qaction.cpp \ + kernel/qactiongroup.cpp \ + kernel/qapplication.cpp \ + kernel/qwidgetbackingstore.cpp \ + kernel/qboxlayout.cpp \ + kernel/qformlayout.cpp \ + kernel/qgridlayout.cpp \ + kernel/qicon.cpp \ + kernel/qiconloader.cpp \ + kernel/qiconengine.cpp \ + kernel/qiconengineplugin.cpp \ + kernel/qinputcontext.cpp \ + kernel/qlayout.cpp \ + kernel/qlayoutengine.cpp \ + kernel/qlayoutitem.cpp \ + kernel/qstackedlayout.cpp \ + kernel/qtooltip.cpp \ + kernel/qwhatsthis.cpp \ + kernel/qwidget.cpp \ + kernel/qwidgetaction.cpp \ + kernel/qgesture.cpp \ + kernel/qstandardgestures.cpp \ + kernel/qgesturerecognizer.cpp \ + kernel/qgesturemanager.cpp \ + kernel/qsoftkeymanager.cpp \ + kernel/qdesktopwidget.cpp \ + kernel/qguiplatformplugin.cpp \ + kernel/qwidgetsvariant.cpp + +win32: DEFINES += QT_NO_DIRECTDRAW + +win32:!qpa { + HEADERS += \ + kernel/qwinnativepangesturerecognizer_win_p.h + + SOURCES += \ + kernel/qapplication_win.cpp \ + kernel/qclipboard_win.cpp \ + kernel/qcursor_win.cpp \ + kernel/qdesktopwidget_win.cpp \ + kernel/qdnd_win.cpp \ + kernel/qmime_win.cpp \ + kernel/qsound_win.cpp \ + kernel/qwidget_win.cpp \ + kernel/qole_win.cpp \ + kernel/qkeymapper_win.cpp \ + kernel/qwinnativepangesturerecognizer_win.cpp + + !contains(DEFINES, QT_NO_DIRECTDRAW):LIBS += ddraw.lib +} + +symbian { + exists($${EPOCROOT}epoc32/include/platform/mw/akntranseffect.h): DEFINES += QT_SYMBIAN_HAVE_AKNTRANSEFFECT_H + + SOURCES += \ + kernel/qapplication_s60.cpp \ + kernel/qeventdispatcher_s60.cpp \ + kernel/qwidget_s60.cpp \ + kernel/qcursor_s60.cpp \ + kernel/qdesktopwidget_s60.cpp \ + kernel/qkeymapper_s60.cpp\ + kernel/qclipboard_s60.cpp\ + kernel/qdnd_s60.cpp \ + kernel/qsound_s60.cpp + + HEADERS += \ + kernel/qt_s60_p.h \ + kernel/qeventdispatcher_s60_p.h + + LIBS += -lbafl -lestor + + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += ../3rdparty/s60 + + contains(QT_CONFIG, s60) { + SOURCES += kernel/qsoftkeymanager_s60.cpp + HEADERS += kernel/qsoftkeymanager_s60_p.h + } +} + + +unix:x11 { + INCLUDEPATH += ../3rdparty/xorg + HEADERS += \ + kernel/qx11embed_x11.h \ + kernel/qx11info_x11.h \ + kernel/qkde_p.h + + SOURCES += \ + kernel/qapplication_x11.cpp \ + kernel/qclipboard_x11.cpp \ + kernel/qcursor_x11.cpp \ + kernel/qdnd_x11.cpp \ + kernel/qdesktopwidget_x11.cpp \ + kernel/qmotifdnd_x11.cpp \ + kernel/qsound_x11.cpp \ + kernel/qwidget_x11.cpp \ + kernel/qwidgetcreate_x11.cpp \ + kernel/qx11embed_x11.cpp \ + kernel/qx11info_x11.cpp \ + kernel/qkeymapper_x11.cpp \ + kernel/qkde.cpp + + contains(QT_CONFIG, glib) { + SOURCES += \ + kernel/qguieventdispatcher_glib.cpp + HEADERS += \ + kernel/qguieventdispatcher_glib_p.h + QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB + LIBS_PRIVATE +=$$QT_LIBS_GLIB + } + SOURCES += \ + kernel/qeventdispatcher_x11.cpp + HEADERS += \ + kernel/qeventdispatcher_x11_p.h +} + +!qpa { + HEADERS += \ + kernel/qsound.h \ + kernel/qsound_p.h + + SOURCES += \ + kernel/qsound.cpp +} + +qpa { + HEADERS += \ + kernel/qdesktopwidget_qpa_p.h \ + kernel/qwidgetwindow_qpa_p.h \ + kernel/qplatformmenu_qpa.h \ + + SOURCES += \ + kernel/qapplication_qpa.cpp \ + kernel/qdesktopwidget_qpa.cpp \ + kernel/qwidget_qpa.cpp \ + kernel/qwidgetwindow_qpa.cpp \ + kernel/qplatformmenu_qpa.cpp \ +} + +!qpa:!x11:mac { + SOURCES += \ + kernel/qclipboard_mac.cpp \ + kernel/qmime_mac.cpp \ + kernel/qt_mac.cpp \ + kernel/qkeymapper_mac.cpp + + OBJECTIVE_HEADERS += \ + qcocoawindow_mac_p.h \ + qcocoapanel_mac_p.h \ + qcocoawindowdelegate_mac_p.h \ + qcocoaview_mac_p.h \ + qcocoaapplication_mac_p.h \ + qcocoaapplicationdelegate_mac_p.h \ + qmacgesturerecognizer_mac_p.h \ + qmultitouch_mac_p.h \ + qcocoasharedwindowmethods_mac_p.h \ + qcocoaintrospection_p.h + + OBJECTIVE_SOURCES += \ + kernel/qcursor_mac.mm \ + kernel/qdnd_mac.mm \ + kernel/qsound_mac.mm \ + kernel/qapplication_mac.mm \ + kernel/qwidget_mac.mm \ + kernel/qcocoapanel_mac.mm \ + kernel/qcocoaview_mac.mm \ + kernel/qcocoawindow_mac.mm \ + kernel/qcocoawindowdelegate_mac.mm \ + kernel/qcocoaapplication_mac.mm \ + kernel/qcocoaapplicationdelegate_mac.mm \ + kernel/qt_cocoa_helpers_mac.mm \ + kernel/qdesktopwidget_mac.mm \ + kernel/qeventdispatcher_mac.mm \ + kernel/qcocoawindowcustomthemeframe_mac.mm \ + kernel/qmacgesturerecognizer_mac.mm \ + kernel/qmultitouch_mac.mm \ + kernel/qcocoaintrospection_mac.mm + + HEADERS += \ + kernel/qt_cocoa_helpers_mac_p.h \ + kernel/qcocoaapplication_mac_p.h \ + kernel/qcocoaapplicationdelegate_mac_p.h \ + kernel/qeventdispatcher_mac_p.h + + MENU_NIB.files = mac/qt_menu.nib + MENU_NIB.path = Resources + MENU_NIB.version = Versions + QMAKE_BUNDLE_DATA += MENU_NIB + RESOURCES += mac/macresources.qrc + + LIBS_PRIVATE += -framework AppKit +} + +wince*: { + HEADERS += \ + ../corelib/kernel/qfunctions_wince.h \ + kernel/qguifunctions_wince.h + + SOURCES += \ + ../corelib/kernel/qfunctions_wince.cpp \ + kernel/qguifunctions_wince.cpp +} diff --git a/src/widgets/kernel/mac.pri b/src/widgets/kernel/mac.pri new file mode 100644 index 00000000000..5474a41f15e --- /dev/null +++ b/src/widgets/kernel/mac.pri @@ -0,0 +1,4 @@ +!x11::mac { + LIBS_PRIVATE += -framework Carbon -framework Cocoa -lz + *-mwerks:INCLUDEPATH += compat +} diff --git a/src/gui/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp similarity index 100% rename from src/gui/kernel/qaction.cpp rename to src/widgets/kernel/qaction.cpp diff --git a/src/gui/kernel/qaction.h b/src/widgets/kernel/qaction.h similarity index 98% rename from src/gui/kernel/qaction.h rename to src/widgets/kernel/qaction.h index e18257c6ab8..da8c24e1848 100644 --- a/src/gui/kernel/qaction.h +++ b/src/widgets/kernel/qaction.h @@ -44,9 +44,9 @@ #include <QtGui/qkeysequence.h> #include <QtCore/qstring.h> -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> #include <QtCore/qvariant.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qicon.h> QT_BEGIN_HEADER @@ -61,7 +61,7 @@ class QActionGroup; class QActionPrivate; class QGraphicsWidget; -class Q_GUI_EXPORT QAction : public QObject +class Q_WIDGETS_EXPORT QAction : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QAction) @@ -246,13 +246,13 @@ private: friend class QMenuBar; friend class QShortcutMap; friend class QToolButton; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC friend void qt_mac_clear_status_text(QAction *action); #endif }; QT_BEGIN_INCLUDE_NAMESPACE -#include <QtGui/qactiongroup.h> +#include <QtWidgets/qactiongroup.h> QT_END_INCLUDE_NAMESPACE #endif // QT_NO_ACTION diff --git a/src/gui/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h similarity index 98% rename from src/gui/kernel/qaction_p.h rename to src/widgets/kernel/qaction_p.h index e4738eacbd0..e916be47db1 100644 --- a/src/gui/kernel/qaction_p.h +++ b/src/widgets/kernel/qaction_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "QtGui/qaction.h" -#include "QtGui/qmenu.h" +#include "QtWidgets/qaction.h" +#include "QtWidgets/qmenu.h" #include "private/qgraphicswidget_p.h" #include "private/qobject_p.h" diff --git a/src/gui/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp similarity index 100% rename from src/gui/kernel/qactiongroup.cpp rename to src/widgets/kernel/qactiongroup.cpp diff --git a/src/gui/kernel/qactiongroup.h b/src/widgets/kernel/qactiongroup.h similarity index 97% rename from src/gui/kernel/qactiongroup.h rename to src/widgets/kernel/qactiongroup.h index 84945d47d07..deeed061cd6 100644 --- a/src/gui/kernel/qactiongroup.h +++ b/src/widgets/kernel/qactiongroup.h @@ -42,7 +42,7 @@ #ifndef QACTIONGROUP_H #define QACTIONGROUP_H -#include <QtGui/qaction.h> +#include <QtWidgets/qaction.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QActionGroupPrivate; -class Q_GUI_EXPORT QActionGroup : public QObject +class Q_WIDGETS_EXPORT QActionGroup : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QActionGroup) diff --git a/src/gui/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp similarity index 90% rename from src/gui/kernel/qapplication.cpp rename to src/widgets/kernel/qapplication.cpp index 593a3209a85..ff3fd89712b 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -61,22 +61,18 @@ #include "qtranslator.h" #include "qvariant.h" #include "qwidget.h" -#include "qdnd_p.h" +#include "private/qdnd_p.h" #include "qcolormap.h" #include "qdebug.h" -#include "private/qgraphicssystemfactory_p.h" -#include "private/qgraphicssystem_p.h" #include "private/qstylesheetstyle_p.h" #include "private/qstyle_p.h" #include "qmessagebox.h" -#include <QtGui/qgraphicsproxywidget.h> - -#ifdef QT_GRAPHICSSYSTEM_RUNTIME -#include "private/qgraphicssystem_runtime_p.h" -#endif +#include <QtWidgets/qgraphicsproxywidget.h> +#include <QtGui/qstylehints.h> +#include <QtGui/qinputpanel.h> #include "qinputcontext.h" -#include "qkeymapper_p.h" +#include "private/qkeymapper_p.h" #ifdef Q_WS_X11 #include <private/qt_x11_p.h> @@ -100,14 +96,15 @@ #endif #include "qapplication_p.h" -#include "qevent_p.h" +#include "private/qevent_p.h" #include "qwidget_p.h" #include "qapplication.h" #include "qgesture.h" #include "private/qgesturemanager_p.h" - +#include "private/qguiapplication_p.h" +#include "qplatformfontdatabase_qpa.h" #ifndef QT_NO_LIBRARY #include "qlibrary.h" #endif @@ -146,10 +143,6 @@ static void initResources() #endif Q_INIT_RESOURCE_EXTERN(qmessagebox) Q_INIT_RESOURCE(qmessagebox); -#if !defined(QT_NO_PRINTDIALOG) - Q_INIT_RESOURCE_EXTERN(qprintdialog) - Q_INIT_RESOURCE(qprintdialog); -#endif } @@ -172,7 +165,7 @@ bool QApplicationPrivate::autoSipEnabled = true; #endif QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type, int flags) - : QCoreApplicationPrivate(argc, argv, flags) + : QApplicationPrivateBase(argc, argv, flags) { application_type = type; qt_appType = type; @@ -449,19 +442,13 @@ QString QApplicationPrivate::styleSheet; // default application styles QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0; int QApplicationPrivate::app_cspec = QApplication::NormalColor; -QPalette *QApplicationPrivate::app_pal = 0; // default application palette 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_QPA) -QPlatformIntegration *QApplicationPrivate::platform_integration = 0; -#endif -QString QApplicationPrivate::graphics_system_name; // graphics system id - for delayed initialization -bool QApplicationPrivate::runtime_graphics_system = false; - +#ifndef Q_WS_QPA Q_GLOBAL_STATIC(QMutex, applicationFontMutex) QFont *QApplicationPrivate::app_font = 0; // default application font +#endif QFont *QApplicationPrivate::sys_font = 0; // default system font QFont *QApplicationPrivate::set_font = 0; // default font set by programmer @@ -471,27 +458,13 @@ QWidget *QApplicationPrivate::focus_widget = 0; // has keyboard input foc QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show() QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus bool QApplicationPrivate::obey_desktop_settings = true; // use winsys resources -int QApplicationPrivate::cursor_flash_time = 1000; // text caret flash time -int QApplicationPrivate::mouse_double_click_time = 400; // mouse dbl click limit -int QApplicationPrivate::keyboard_input_time = 400; // keyboard input interval #ifndef QT_NO_WHEELEVENT int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll #endif bool qt_is_gui_used; -bool Q_GUI_EXPORT qt_tab_all_widgets = true; +bool Q_WIDGETS_EXPORT qt_tab_all_widgets = true; bool qt_in_tab_key_event = false; int qt_antialiasing_threshold = -1; -static int drag_time = 500; -#ifndef QT_GUI_DRAG_DISTANCE -#define QT_GUI_DRAG_DISTANCE 4 -#endif -#ifdef Q_OS_SYMBIAN -// The screens are a bit too small to for your thumb when using only 4 pixels drag distance. -static int drag_distance = 12; //XXX move to qplatformdefs.h -#else -static int drag_distance = QT_GUI_DRAG_DISTANCE; -#endif -static Qt::LayoutDirection layout_direction = Qt::LeftToRight; QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strut bool QApplicationPrivate::animate_ui = true; bool QApplicationPrivate::animate_menu = false; @@ -502,7 +475,6 @@ bool QApplicationPrivate::fade_tooltip = false; bool QApplicationPrivate::animate_toolbox = false; bool QApplicationPrivate::widgetCount = false; bool QApplicationPrivate::load_testability = false; -QString QApplicationPrivate::qmljs_debug_arguments; #ifdef QT_KEYPAD_NAVIGATION # ifdef Q_OS_SYMBIAN Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional; @@ -513,21 +485,10 @@ QWidget *QApplicationPrivate::oldEditFocus = 0; #endif bool qt_tabletChokeMouse = false; -static bool force_reverse = false; inline bool QApplicationPrivate::isAlien(QWidget *widget) { - if (!widget) - return false; -#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) -# endif - ; -#else - return !widget->internalWinId(); -#endif + return widget && !widget->isWindow(); } // ######## move to QApplicationPrivate @@ -538,7 +499,7 @@ PaletteHash *qt_app_palettes_hash() return app_palettes(); } -Q_GLOBAL_STATIC(FontHash, app_fonts) +Q_GLOBAL_STATIC_WITH_INITIALIZER(FontHash, app_fonts, { *x = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFonts(); } ) FontHash *qt_app_fonts_hash() { return app_fonts(); @@ -547,10 +508,11 @@ FontHash *qt_app_fonts_hash() QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus QDesktopWidget *qt_desktopWidget = 0; // root window widgets -#ifndef QT_NO_CLIPBOARD +#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD) QClipboard *qt_clipboard = 0; // global clipboard object #endif -QWidgetList * qt_modal_stack=0; // stack of modal widgets +QWidgetList * qt_modal_stack = 0; // stack of modal widgets +bool app_do_modal = false; /*! \internal @@ -601,15 +563,10 @@ void QApplicationPrivate::process_cmdline() styleSheet = QLatin1String("file:///"); styleSheet.append(QString::fromLocal8Bit(arg.right(arg.length() - 12))); #endif - } else if (qstrcmp(arg, "-reverse") == 0) { - force_reverse = true; - QApplication::setLayoutDirection(Qt::RightToLeft); } else if (qstrcmp(arg, "-widgetcount") == 0) { widgetCount = true; } else if (qstrcmp(arg, "-testability") == 0) { load_testability = true; - } else if (arg == "-graphicssystem" && i < argc-1) { - graphics_system_name = QString::fromLocal8Bit(argv[++i]); } else { argv[j++] = argv[i]; } @@ -679,8 +636,6 @@ void QApplicationPrivate::process_cmdline() the same time \o -reverse, sets the application's layout direction to 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. @@ -729,11 +684,11 @@ void QApplicationPrivate::process_cmdline() */ QApplication::QApplication(int &argc, char **argv) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000)) + : QApplicationBase(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000)) { Q_D(QApplication); d->construct(); } QApplication::QApplication(int &argc, char **argv, int _internal) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, _internal)) + : QApplicationBase(*new QApplicationPrivate(argc, argv, GuiClient, _internal)) { Q_D(QApplication); d->construct(); } @@ -763,11 +718,11 @@ QApplication::QApplication(int &argc, char **argv, int _internal) */ QApplication::QApplication(int &argc, char **argv, bool GUIenabled ) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, 0x040000)) + : QApplicationBase(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, 0x040000)) { Q_D(QApplication); d->construct(); } QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _internal) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, _internal)) + : QApplicationBase(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty, _internal)) { Q_D(QApplication); d->construct();} @@ -786,11 +741,11 @@ QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _intern \c -qws option). */ QApplication::QApplication(int &argc, char **argv, Type type) - : QCoreApplication(*new QApplicationPrivate(argc, argv, type, 0x040000)) + : QApplicationBase(*new QApplicationPrivate(argc, argv, type, 0x040000)) { Q_D(QApplication); d->construct(); } QApplication::QApplication(int &argc, char **argv, Type type , int _internal) - : QCoreApplication(*new QApplicationPrivate(argc, argv, type, _internal)) + : QApplicationBase(*new QApplicationPrivate(argc, argv, type, _internal)) { Q_D(QApplication); d->construct(); } #if defined(Q_WS_X11) && !defined(QT_NO_EGL) @@ -814,21 +769,6 @@ void QApplicationPrivate::construct( qt_is_gui_used = (qt_appType != QApplication::Tty); process_cmdline(); - // the environment variable has the lowest precedence of runtime graphicssystem switches - if (graphics_system_name.isEmpty()) - graphics_system_name = QString::fromLocal8Bit(qgetenv("QT_GRAPHICSSYSTEM")); - -#if defined(Q_WS_X11) && !defined(QT_NO_EGL) - if (graphics_system_name.isEmpty()) { - bool linksWithMeeGoTouch = dl_iterate_phdr(qt_matchLibraryName, const_cast<char *>("libmeegotouchcore")); - bool linksWithMeeGoGraphicsSystemHelper = dl_iterate_phdr(qt_matchLibraryName, const_cast<char *>("libQtMeeGoGraphicsSystemHelper")); - - if (linksWithMeeGoTouch && !linksWithMeeGoGraphicsSystemHelper) { - qWarning("Running non-meego graphics system enabled MeeGo touch, forcing native graphicssystem\n"); - graphics_system_name = QLatin1String("native"); - } - } -#endif // Must be called before initialize() qt_init(this, qt_appType @@ -897,7 +837,7 @@ static char *aargv[] = { (char*)"unknown", 0 }; This function is only available on X11. */ QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap) - : QCoreApplication(*new QApplicationPrivate(aargc, aargv, GuiClient, 0x040000)) + : QApplicationBase(*new QApplicationPrivate(aargc, aargv, GuiClient, 0x040000)) { if (! dpy) qWarning("QApplication: Invalid Display* argument"); @@ -906,7 +846,7 @@ QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap) } QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap, int _internal) - : QCoreApplication(*new QApplicationPrivate(aargc, aargv, GuiClient, _internal)) + : QApplicationBase(*new QApplicationPrivate(aargc, aargv, GuiClient, _internal)) { if (! dpy) qWarning("QApplication: Invalid Display* argument"); @@ -931,7 +871,7 @@ QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap, */ QApplication::QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE colormap) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000)) + : QApplicationBase(*new QApplicationPrivate(argc, argv, GuiClient, 0x040000)) { if (! dpy) qWarning("QApplication: Invalid Display* argument"); @@ -941,7 +881,7 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv, QApplication::QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE colormap, int _internal) - : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient, _internal)) + : QApplicationBase(*new QApplicationPrivate(argc, argv, GuiClient, _internal)) { if (! dpy) qWarning("QApplication: Invalid Display* argument"); @@ -952,10 +892,6 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv, #endif // Q_WS_X11 -extern void qInitDrawhelperAsm(); -extern void qInitImageConversions(); -extern int qRegisterGuiVariant(); -extern int qUnregisterGuiVariant(); #ifndef QT_NO_STATEMACHINE extern int qRegisterGuiStateMachine(); extern int qUnregisterGuiStateMachine(); @@ -971,18 +907,8 @@ void QApplicationPrivate::initialize() QWidgetPrivate::mapper = new QWidgetMapper; QWidgetPrivate::allWidgets = new QWidgetSet; -#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. - // We don't use graphics systems in Qt QPA - graphics_system = QGraphicsSystemFactory::create(graphics_system_name); -#endif - if (qt_appType != QApplication::Tty) (void) QApplication::style(); // trigger creation of application style - // trigger registering of QVariant's GUI types - qRegisterGuiVariant(); #ifndef QT_NO_STATEMACHINE // trigger registering of QStateMachine's GUI types qRegisterGuiStateMachine(); @@ -1010,11 +936,6 @@ void QApplicationPrivate::initialize() #endif //QT_AUTO_MAXIMIZE_THRESHOLD #endif //Q_WS_WINCE - // Set up which span functions should be used in raster engine... - qInitDrawhelperAsm(); - // and QImage conversion functions - qInitImageConversions(); - #ifndef QT_NO_WHEELEVENT QApplicationPrivate::wheel_scroll_lines = 3; #endif @@ -1087,7 +1008,7 @@ QApplication::~QApplication() { Q_D(QApplication); -#ifndef QT_NO_CLIPBOARD +#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD) // flush clipboard contents if (qt_clipboard) { QEvent event(QEvent::Clipboard); @@ -1102,8 +1023,10 @@ QApplication::~QApplication() d->toolTipWakeUp.stop(); d->toolTipFallAsleep.stop(); +#if !defined(Q_WS_QPA) d->eventDispatcher->closingDown(); d->eventDispatcher = 0; +#endif QApplicationPrivate::is_app_closing = true; QApplicationPrivate::is_app_running = false; @@ -1125,7 +1048,7 @@ QApplication::~QApplication() delete qt_desktopWidget; qt_desktopWidget = 0; -#ifndef QT_NO_CLIPBOARD +#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD) delete qt_clipboard; qt_clipboard = 0; #endif @@ -1147,11 +1070,14 @@ QApplication::~QApplication() QApplicationPrivate::set_pal = 0; app_palettes()->clear(); +#ifndef Q_WS_QPA { QMutexLocker locker(applicationFontMutex()); delete QApplicationPrivate::app_font; QApplicationPrivate::app_font = 0; } +#endif + delete QApplicationPrivate::sys_font; QApplicationPrivate::sys_font = 0; delete QApplicationPrivate::set_font; @@ -1162,11 +1088,6 @@ QApplication::~QApplication() QApplicationPrivate::app_style = 0; delete QApplicationPrivate::app_icon; QApplicationPrivate::app_icon = 0; - delete QApplicationPrivate::graphics_system; - QApplicationPrivate::graphics_system = 0; -#ifndef QT_NO_CURSOR - d->cursor_list.clear(); -#endif #ifndef QT_NO_DRAGANDDROP if (qt_is_gui_used) @@ -1185,13 +1106,7 @@ QApplication::~QApplication() #endif //QT_NO_SESSIONMANAGER QApplicationPrivate::obey_desktop_settings = true; - QApplicationPrivate::cursor_flash_time = 1000; - QApplicationPrivate::mouse_double_click_time = 400; - QApplicationPrivate::keyboard_input_time = 400; - drag_time = 500; - drag_distance = 4; - layout_direction = Qt::LeftToRight; QApplicationPrivate::app_strut = QSize(0, 0); QApplicationPrivate::animate_ui = true; QApplicationPrivate::animate_menu = false; @@ -1205,8 +1120,6 @@ QApplication::~QApplication() // trigger unregistering of QStateMachine's GUI types qUnregisterGuiStateMachine(); #endif - // trigger unregistering of QVariant's GUI types - qUnregisterGuiVariant(); } @@ -1316,7 +1229,7 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis } return false; } - return QCoreApplication::compressEvent(event, receiver, postedEvents); + return QApplicationBase::compressEvent(event, receiver, postedEvents); } /*! @@ -1623,46 +1536,6 @@ QStyle* QApplication::setStyle(const QString& style) return s; } -/*! - \since 4.5 - - Sets the default graphics backend to \a system, which will be used for - on-screen widgets and QPixmaps. The available systems are \c{"native"}, - \c{"raster"} and \c{"opengl"}. - - There are several ways to set the graphics backend, in order of decreasing - precedence: - \list - \o the application commandline \c{-graphicssystem} switch - \o QApplication::setGraphicsSystem() - \o the QT_GRAPHICSSYSTEM environment variable - \o the Qt configure \c{-graphicssystem} switch - \endlist - If the highest precedence switch sets an invalid name, the error will be - ignored and the default backend will be used. - - \warning This function is only effective before the QApplication constructor - is called. - - \note The \c{"opengl"} option is currently experimental. -*/ - -void QApplication::setGraphicsSystem(const QString &system) -{ -#ifdef Q_WS_QPA - Q_UNUSED(system); -#else -# ifdef QT_GRAPHICSSYSTEM_RUNTIME - if (QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) { - QRuntimeGraphicsSystem *r = - static_cast<QRuntimeGraphicsSystem *>(QApplicationPrivate::graphics_system); - r->setGraphicsSystem(system); - } else -# endif - QApplicationPrivate::graphics_system_name = system; -#endif -} - /*! Returns the color specification. @@ -1762,17 +1635,6 @@ void QApplication::setGlobalStrut(const QSize& strut) QApplicationPrivate::app_strut = strut; } -/*! - Returns the application palette. - - \sa setPalette(), QWidget::palette() -*/ -QPalette QApplication::palette() -{ - if (!QApplicationPrivate::app_pal) - QApplicationPrivate::app_pal = new QPalette(Qt::black); - return *QApplicationPrivate::app_pal; -} /*! \fn QPalette QApplication::palette(const QWidget* widget) @@ -1941,10 +1803,14 @@ void QApplicationPrivate::setSystemPalette(const QPalette &pal) */ QFont QApplication::font() { +#ifndef Q_WS_QPA QMutexLocker locker(applicationFontMutex()); if (!QApplicationPrivate::app_font) QApplicationPrivate::app_font = new QFont(QLatin1String("Helvetica")); return *QApplicationPrivate::app_font; +#else + return QGuiApplication::font(); +#endif } /*! @@ -2023,11 +1889,15 @@ void QApplication::setFont(const QFont &font, const char *className) bool all = false; FontHash *hash = app_fonts(); if (!className) { +#ifndef Q_WS_QPA QMutexLocker locker(applicationFontMutex()); if (!QApplicationPrivate::app_font) QApplicationPrivate::app_font = new QFont(font); else *QApplicationPrivate::app_font = font; +#else + QGuiApplication::setFont(font); +#endif if (hash && hash->size()) { all = true; hash->clear(); @@ -2227,16 +2097,6 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) ) prev->setEditFocus(false); } -#endif -#ifndef QT_NO_IM - if (focus) { - QInputContext *prevIc; - prevIc = prev->inputContext(); - if (prevIc && prevIc != focus->inputContext()) { - QEvent closeSIPEvent(QEvent::CloseSoftwareInputPanel); - QApplication::sendEvent(prev, &closeSIPEvent); - } - } #endif QFocusEvent out(QEvent::FocusOut, reason); QPointer<QWidget> that = prev; @@ -2391,50 +2251,6 @@ void QApplication::aboutQt() \sa QWidget::setFocus(), QWidget::clearFocus(), Qt::FocusReason */ -/*! - \since 4.5 - \fn void QApplication::fontDatabaseChanged() - - This signal is emitted when application fonts are loaded or removed. - - \sa QFontDatabase::addApplicationFont(), - QFontDatabase::addApplicationFontFromData(), - QFontDatabase::removeAllApplicationFonts(), - QFontDatabase::removeApplicationFont() -*/ - -#ifndef QT_NO_TRANSLATION -static bool qt_detectRTLLanguage() -{ - return force_reverse ^ - (QApplication::tr("QT_LAYOUT_DIRECTION", - "Translate this string to the string 'LTR' in left-to-right" - " languages or to 'RTL' in right-to-left languages (such as Hebrew" - " and Arabic) to get proper widget layout.") == QLatin1String("RTL")); -} -#if defined(Q_WS_MAC) -static const char *application_menu_strings[] = { - QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Services"), - QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide %1"), - QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide Others"), - QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Show All"), - QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Preferences..."), - QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Quit %1"), - QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","About %1") - }; -QString qt_mac_applicationmenu_string(int 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 - /*!\reimp */ @@ -2468,19 +2284,6 @@ bool QApplication::event(QEvent *e) qt_abortFullScreenEffect(); #endif } - } else if(e->type() == QEvent::LanguageChange) { -#ifndef QT_NO_TRANSLATION - setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight); -#endif -#if defined(QT_MAC_USE_COCOA) - qt_mac_post_retranslateAppMenu(); -#endif - QWidgetList list = topLevelWidgets(); - for (int i = 0; i < list.size(); ++i) { - QWidget *w = list.at(i); - if (!(w->windowType() == Qt::Desktop)) - postEvent(w, new QEvent(QEvent::LanguageChange)); - } #ifndef Q_OS_WIN } else if (e->type() == QEvent::LocaleChange) { // on Windows the event propagation is taken care by the @@ -2521,7 +2324,20 @@ bool QApplication::event(QEvent *e) d->toolTipFallAsleep.stop(); } } - return QCoreApplication::event(e); + return QApplicationBase::event(e); + + if(e->type() == QEvent::LanguageChange) { +#if defined(QT_MAC_USE_COCOA) + qt_mac_post_retranslateAppMenu(); +#endif + QWidgetList list = topLevelWidgets(); + for (int i = 0; i < list.size(); ++i) { + QWidget *w = list.at(i); + if (!(w->windowType() == Qt::Desktop)) + postEvent(w, new QEvent(QEvent::LanguageChange)); + } + } + } #if !defined(Q_WS_X11) @@ -2531,6 +2347,17 @@ void QApplication::syncX() {} // do nothing #endif +void QApplicationPrivate::notifyLayoutDirectionChange() +{ + Q_Q(QApplication); + QWidgetList list = q->topLevelWidgets(); + for (int i = 0; i < list.size(); ++i) { + QWidget *w = list.at(i); + QEvent ev(QEvent::ApplicationLayoutDirectionChange); + q->sendEvent(w, &ev); + } +} + /*! \fn Qt::WindowsVersion QApplication::winVersion() @@ -2884,7 +2711,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { } /* exported for the benefit of testing tools */ -Q_GUI_EXPORT bool qt_tryModalHelper(QWidget *widget, QWidget **rettop) +Q_WIDGETS_EXPORT bool qt_tryModalHelper(QWidget *widget, QWidget **rettop) { return QApplicationPrivate::tryModalHelper(widget, rettop); } @@ -3217,16 +3044,15 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) return; // Mouse cursor not inside the widget's top-level. const QPoint globalPos(QCursor::pos()); - QPoint pos = tlw->mapFromGlobal(globalPos); + QPoint windowPos = tlw->mapFromGlobal(globalPos); // Find the current widget under the mouse. If this function was called from // the widget's destructor, we have to make sure childAt() doesn't take into // account widgets that are about to be destructed. - QWidget *widgetUnderCursor = tlw->d_func()->childAt_helper(pos, widget->data->in_destructor); + QWidget *widgetUnderCursor = tlw->d_func()->childAt_helper(windowPos, widget->data->in_destructor); if (!widgetUnderCursor) widgetUnderCursor = tlw; - else - pos = widgetUnderCursor->mapFrom(tlw, pos); + QPoint pos = widgetUnderCursor->mapFrom(tlw, windowPos); if (widgetInShow && widgetUnderCursor != widget && !widget->isAncestorOf(widgetUnderCursor)) return; // Mouse cursor not inside the widget or any of its children. @@ -3235,7 +3061,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) qt_button_down = 0; // Send enter/leave events followed by a mouse move on the entered widget. - QMouseEvent e(QEvent::MouseMove, pos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); + QMouseEvent e(QEvent::MouseMove, pos, windowPos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); sendMouseEvent(widgetUnderCursor, &e, widgetUnderCursor, tlw, &qt_button_down, qt_last_mouse_receiver); #endif // QT_NO_CURSOR } @@ -3261,7 +3087,7 @@ QDesktopWidget *QApplication::desktop() return qt_desktopWidget; } -#ifndef QT_NO_CLIPBOARD +#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD) /*! Returns a pointer to the application global clipboard. @@ -3279,8 +3105,7 @@ QClipboard *QApplication::clipboard() } return qt_clipboard; } -#endif // QT_NO_CLIPBOARD - +#endif // Q_WS_QPA && QT_NO_CLIPBOARD /*! Sets whether Qt should use the system's standard colors, fonts, etc., to \a on. By default, this is true. @@ -3346,6 +3171,12 @@ Qt::KeyboardModifiers QApplication::keyboardModifiers() \since 4.8 */ +Qt::KeyboardModifiers QApplication::queryKeyboardModifiers() +{ + qWarning("queryKeyboardModifiers() doesn't have a QPA implementation"); + return QApplicationPrivate::modifier_buttons; +} + /*! Returns the current state of the buttons on the mouse. The current state is updated syncronously as the event queue is emptied of events that will @@ -3561,7 +3392,7 @@ void QApplication::saveState(QSessionManager &manager) void QApplication::setStartDragTime(int ms) { - drag_time = ms; + Q_UNUSED(ms) } /*! @@ -3583,7 +3414,7 @@ void QApplication::setStartDragTime(int ms) int QApplication::startDragTime() { - return drag_time; + return qApp->styleHints()->startDragTime(); } /* @@ -3594,7 +3425,7 @@ int QApplication::startDragTime() void QApplication::setStartDragDistance(int l) { - drag_distance = l; + Q_UNUSED(l); } /*! @@ -3620,7 +3451,7 @@ void QApplication::setStartDragDistance(int l) int QApplication::startDragDistance() { - return drag_distance; + return qApp->styleHints()->startDragTime(); } /*! @@ -3635,54 +3466,6 @@ int QApplication::startDragDistance() Use layoutDirection() instead. */ -/*! - \fn bool QApplication::isRightToLeft() - - Returns true if the application's layout direction is - Qt::RightToLeft; otherwise returns false. - - \sa layoutDirection(), isLeftToRight() -*/ - -/*! - \fn bool QApplication::isLeftToRight() - - Returns true if the application's layout direction is - Qt::LeftToRight; otherwise returns false. - - \sa layoutDirection(), isRightToLeft() -*/ - -/*! - \property QApplication::layoutDirection - \brief the default layout direction for this application - - On system start-up, the default layout direction depends on the - application's language. - - \sa QWidget::layoutDirection, isLeftToRight(), isRightToLeft() - */ - -void QApplication::setLayoutDirection(Qt::LayoutDirection direction) -{ - if (layout_direction == direction || direction == Qt::LayoutDirectionAuto) - return; - - layout_direction = direction; - - QWidgetList list = topLevelWidgets(); - for (int i = 0; i < list.size(); ++i) { - QWidget *w = list.at(i); - QEvent ev(QEvent::ApplicationLayoutDirectionChange); - sendEvent(w, &ev); - } -} - -Qt::LayoutDirection QApplication::layoutDirection() -{ - return layout_direction; -} - /*! \obsolete @@ -3695,51 +3478,10 @@ Qt::LayoutDirection QApplication::layoutDirection() #ifdef QT3_SUPPORT Qt::Alignment QApplication::horizontalAlignment(Qt::Alignment align) { - return QStyle::visualAlignment(layoutDirection(), align); + return QGuiApplicationPrivate::visualAlignment(layoutDirection(), align); } #endif - -/*! - \fn QCursor *QApplication::overrideCursor() - - Returns the active application override cursor. - - This function returns 0 if no application cursor has been defined (i.e. the - internal cursor stack is empty). - - \sa setOverrideCursor(), restoreOverrideCursor() -*/ -#ifndef QT_NO_CURSOR -QCursor *QApplication::overrideCursor() -{ - return qApp->d_func()->cursor_list.isEmpty() ? 0 : &qApp->d_func()->cursor_list.first(); -} - -/*! - Changes the currently active application override cursor to \a cursor. - - This function has no effect if setOverrideCursor() was not called. - - \sa setOverrideCursor(), overrideCursor(), restoreOverrideCursor(), - QWidget::setCursor() - */ -void QApplication::changeOverrideCursor(const QCursor &cursor) -{ - if (qApp->d_func()->cursor_list.isEmpty()) - return; - qApp->d_func()->cursor_list.removeFirst(); - setOverrideCursor(cursor); -} -#endif - -/*! - \fn void QApplication::setOverrideCursor(const QCursor &cursor, bool replace) - - Use changeOverrideCursor(\a cursor) (if \a replace is true) or - setOverrideCursor(\a cursor) (if \a replace is false). -*/ - /*! Enters the main event loop and waits until exit() is called, then returns the value that was set to exit() (which is 0 if exit() is called via @@ -3774,7 +3516,7 @@ int QApplication::exec() #ifndef QT_NO_ACCESSIBILITY QAccessible::setRootObject(qApp); #endif - return QCoreApplication::exec(); + return QApplicationBase::exec(); } /*! \reimp @@ -4002,13 +3744,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e) QPoint relpos = mouse->pos(); if (e->spontaneous()) { -#ifndef QT_NO_IM - QInputContext *ic = w->inputContext(); - if (ic - && w->testAttribute(Qt::WA_InputMethodEnabled) - && ic->filterEvent(mouse)) - return true; -#endif if (e->type() == QEvent::MouseButtonPress) { QApplicationPrivate::giveFocusAccordingToFocusPolicy(w, @@ -4035,9 +3770,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e) QPointer<QWidget> pw = w; while (w) { - QMouseEvent me(mouse->type(), relpos, mouse->globalPos(), mouse->button(), mouse->buttons(), + QMouseEvent me(mouse->type(), relpos, mouse->windowPos(), mouse->globalPos(), mouse->button(), mouse->buttons(), mouse->modifiers()); me.spont = mouse->spontaneous(); + me.setTimestamp(mouse->timestamp()); // throw away any mouse-tracking-only mouse events if (!w->hasMouseTracking() && mouse->type() == QEvent::MouseMove && mouse->buttons() == 0) { @@ -4272,7 +4008,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) bool isProxyWidget = extra && extra->proxyWidget; if (!isProxyWidget) #endif - w = QDragManager::self()->currentTarget(); + w = qobject_cast<QWidget *>(QDragManager::self()->currentTarget()); if (!w) { #ifdef Q_WS_MAC @@ -4364,17 +4100,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e) break; } case QEvent::RequestSoftwareInputPanel: + inputPanel()->show(); + break; case QEvent::CloseSoftwareInputPanel: -#ifndef QT_NO_IM - if (receiver->isWidgetType()) { - QWidget *w = static_cast<QWidget *>(receiver); - QInputContext *ic = w->inputContext(); - if (ic && ic->filterEvent(e)) { - break; - } - } -#endif - res = d->notify_helper(receiver, e); + inputPanel()->hide(); break; #ifndef QT_NO_GESTURES @@ -4972,6 +4701,13 @@ void QSessionManager::requestPhase2() #endif #endif // QT_NO_SESSIONMANAGER +/*! + \typedef QApplication::ColorMode + \compat + + Use ColorSpec instead. +*/ + /*! \fn Qt::MacintoshVersion QApplication::macVersion() @@ -5109,6 +4845,18 @@ void QApplicationPrivate::emitLastWindowClosed() } } +/*! \variable QApplication::NormalColors + \compat + + Use \l NormalColor instead. +*/ + +/*! \variable QApplication::CustomColors + \compat + + Use \l CustomColor instead. +*/ + #ifdef QT_KEYPAD_NAVIGATION /*! Sets the kind of focus navigation Qt should use to \a mode. @@ -5250,6 +4998,16 @@ bool QApplication::keypadNavigationEnabled() We recommend that widgets do not cache this value as it may change at any time if the user changes the global desktop settings. */ +void QApplication::setCursorFlashTime(int msecs) +{ + Q_UNUSED(msecs); +} + +int QApplication::cursorFlashTime() +{ + return qApp->styleHints()->cursorFlashTime(); +} + /*! \property QApplication::doubleClickInterval @@ -5257,9 +5015,19 @@ bool QApplication::keypadNavigationEnabled() from two consecutive mouse clicks The default value on X11 is 400 milliseconds. On Windows and Mac OS, the - operating system's value is used. However, on Windows and Symbian OS, - calling this function sets the double click interval for all applications. + operating system's value is used. + + Setting the interval is not supported anymore in Qt 5. */ +void QApplication::setDoubleClickInterval(int ms) +{ + Q_UNUSED(ms); +} + +int QApplication::doubleClickInterval() +{ + return qApp->styleHints()->mouseDoubleClickInterval(); +} /*! \property QApplication::keyboardInputInterval @@ -5270,6 +5038,15 @@ bool QApplication::keypadNavigationEnabled() The default value on X11 is 400 milliseconds. On Windows and Mac OS, the operating system's value is used. */ +void QApplication::setKeyboardInputInterval(int ms) +{ + Q_UNUSED(ms); +} + +int QApplication::keyboardInputInterval() +{ + return qApp->styleHints()->keyboardInputInterval(); +} /*! \property QApplication::wheelScrollLines @@ -5432,90 +5209,16 @@ void QApplication::setInputContext(QInputContext *inputContext) */ QInputContext *QApplication::inputContext() const { - Q_D(const QApplication); - Q_UNUSED(d);// only static members being used. - if (QApplicationPrivate::is_app_closing) - return d->inputContext; -#ifdef Q_WS_X11 - if (!X11) - return 0; - if (!d->inputContext) { - QApplication *that = const_cast<QApplication *>(this); - QInputContext *qic = QInputContextFactory::create(X11->default_im, that); - // fallback to default X Input Method. - if (!qic) - qic = QInputContextFactory::create(QLatin1String("xim"), that); - that->d_func()->inputContext = qic; - } -#elif defined(Q_OS_SYMBIAN) - if (!d->inputContext) { - QApplication *that = const_cast<QApplication *>(this); - const QStringList keys = QInputContextFactory::keys(); - // Try hbim and coefep first, then try others. - if (keys.contains(QLatin1String("hbim"))) { - that->d_func()->inputContext = QInputContextFactory::create(QLatin1String("hbim"), that); - } else if (keys.contains(QLatin1String("coefep"))) { - that->d_func()->inputContext = QInputContextFactory::create(QLatin1String("coefep"), that); - } else { - for (int c = 0; c < keys.size() && !d->inputContext; ++c) { - that->d_func()->inputContext = QInputContextFactory::create(keys[c], that); - } - } - } -#endif - return d->inputContext; + return QApplicationPrivate::inputContext; } #endif // QT_NO_IM -//Returns the current platform used by keyBindings -uint QApplicationPrivate::currentPlatform(){ - uint platform = KB_Win; -#ifdef Q_WS_MAC - platform = KB_Mac; -#elif defined Q_WS_X11 - platform = KB_X11; - if (X11->desktopEnvironment == DE_KDE) - platform |= KB_KDE; - if (X11->desktopEnvironment == DE_GNOME) - platform |= KB_Gnome; - if (X11->desktopEnvironment == DE_CDE) - platform |= KB_CDE; -#elif defined(Q_OS_SYMBIAN) - platform = KB_S60; -#endif - return platform; -} - bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event) { - return QCoreApplication::sendSpontaneousEvent(receiver, event); + return QApplicationBase::sendSpontaneousEvent(receiver, event); } -/*! - \since 4.2 - - Returns the current keyboard input locale. -*/ -QLocale QApplication::keyboardInputLocale() -{ - if (!QApplicationPrivate::checkInstance("keyboardInputLocale")) - return QLocale::c(); - return qt_keymapper_private()->keyboardInputLocale; -} - -/*! - \since 4.2 - - Returns the current keyboard input direction. -*/ -Qt::LayoutDirection QApplication::keyboardInputDirection() -{ - if (!QApplicationPrivate::checkInstance("keyboardInputDirection")) - return Qt::LeftToRight; - return qt_keymapper_private()->keyboardInputDirection; -} - void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, Qt::FocusPolicy focusPolicy, Qt::FocusReason focusReason) @@ -5886,7 +5589,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, } } -Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, +Q_WIDGETS_EXPORT void qt_translateRawTouchEvent(QWidget *window, QTouchEvent::DeviceType deviceType, const QList<QTouchEvent::TouchPoint> &touchPoints) { @@ -5905,237 +5608,6 @@ QGestureManager* QGestureManager::instance() } #endif // QT_NO_GESTURES -// These pixmaps approximate the images in the Windows User Interface Guidelines. - -// XPM - -static const char * const move_xpm[] = { -"11 20 3 1", -". c None", -#if defined(Q_WS_WIN) -"a c #000000", -"X c #FFFFFF", // Windows cursor is traditionally white -#else -"a c #FFFFFF", -"X c #000000", // X11 cursor is traditionally black -#endif -"aa.........", -"aXa........", -"aXXa.......", -"aXXXa......", -"aXXXXa.....", -"aXXXXXa....", -"aXXXXXXa...", -"aXXXXXXXa..", -"aXXXXXXXXa.", -"aXXXXXXXXXa", -"aXXXXXXaaaa", -"aXXXaXXa...", -"aXXaaXXa...", -"aXa..aXXa..", -"aa...aXXa..", -"a.....aXXa.", -"......aXXa.", -".......aXXa", -".......aXXa", -"........aa."}; - -#ifdef Q_WS_WIN -/* XPM */ -static const char * const ignore_xpm[] = { -"24 30 3 1", -". c None", -"a c #000000", -"X c #FFFFFF", -"aa......................", -"aXa.....................", -"aXXa....................", -"aXXXa...................", -"aXXXXa..................", -"aXXXXXa.................", -"aXXXXXXa................", -"aXXXXXXXa...............", -"aXXXXXXXXa..............", -"aXXXXXXXXXa.............", -"aXXXXXXaaaa.............", -"aXXXaXXa................", -"aXXaaXXa................", -"aXa..aXXa...............", -"aa...aXXa...............", -"a.....aXXa..............", -"......aXXa.....XXXX.....", -".......aXXa..XXaaaaXX...", -".......aXXa.XaaaaaaaaX..", -"........aa.XaaaXXXXaaaX.", -"...........XaaaaX..XaaX.", -"..........XaaXaaaX..XaaX", -"..........XaaXXaaaX.XaaX", -"..........XaaX.XaaaXXaaX", -"..........XaaX..XaaaXaaX", -"...........XaaX..XaaaaX.", -"...........XaaaXXXXaaaX.", -"............XaaaaaaaaX..", -".............XXaaaaXX...", -"...............XXXX....."}; -#endif - -/* XPM */ -static const char * const copy_xpm[] = { -"24 30 3 1", -". c None", -"a c #000000", -"X c #FFFFFF", -#if defined(Q_WS_WIN) // Windows cursor is traditionally white -"aa......................", -"aXa.....................", -"aXXa....................", -"aXXXa...................", -"aXXXXa..................", -"aXXXXXa.................", -"aXXXXXXa................", -"aXXXXXXXa...............", -"aXXXXXXXXa..............", -"aXXXXXXXXXa.............", -"aXXXXXXaaaa.............", -"aXXXaXXa................", -"aXXaaXXa................", -"aXa..aXXa...............", -"aa...aXXa...............", -"a.....aXXa..............", -"......aXXa..............", -".......aXXa.............", -".......aXXa.............", -"........aa...aaaaaaaaaaa", -#else -"XX......................", -"XaX.....................", -"XaaX....................", -"XaaaX...................", -"XaaaaX..................", -"XaaaaaX.................", -"XaaaaaaX................", -"XaaaaaaaX...............", -"XaaaaaaaaX..............", -"XaaaaaaaaaX.............", -"XaaaaaaXXXX.............", -"XaaaXaaX................", -"XaaXXaaX................", -"XaX..XaaX...............", -"XX...XaaX...............", -"X.....XaaX..............", -"......XaaX..............", -".......XaaX.............", -".......XaaX.............", -"........XX...aaaaaaaaaaa", -#endif -".............aXXXXXXXXXa", -".............aXXXXXXXXXa", -".............aXXXXaXXXXa", -".............aXXXXaXXXXa", -".............aXXaaaaaXXa", -".............aXXXXaXXXXa", -".............aXXXXaXXXXa", -".............aXXXXXXXXXa", -".............aXXXXXXXXXa", -".............aaaaaaaaaaa"}; - -/* XPM */ -static const char * const link_xpm[] = { -"24 30 3 1", -". c None", -"a c #000000", -"X c #FFFFFF", -#if defined(Q_WS_WIN) // Windows cursor is traditionally white -"aa......................", -"aXa.....................", -"aXXa....................", -"aXXXa...................", -"aXXXXa..................", -"aXXXXXa.................", -"aXXXXXXa................", -"aXXXXXXXa...............", -"aXXXXXXXXa..............", -"aXXXXXXXXXa.............", -"aXXXXXXaaaa.............", -"aXXXaXXa................", -"aXXaaXXa................", -"aXa..aXXa...............", -"aa...aXXa...............", -"a.....aXXa..............", -"......aXXa..............", -".......aXXa.............", -".......aXXa.............", -"........aa...aaaaaaaaaaa", -#else -"XX......................", -"XaX.....................", -"XaaX....................", -"XaaaX...................", -"XaaaaX..................", -"XaaaaaX.................", -"XaaaaaaX................", -"XaaaaaaaX...............", -"XaaaaaaaaX..............", -"XaaaaaaaaaX.............", -"XaaaaaaXXXX.............", -"XaaaXaaX................", -"XaaXXaaX................", -"XaX..XaaX...............", -"XX...XaaX...............", -"X.....XaaX..............", -"......XaaX..............", -".......XaaX.............", -".......XaaX.............", -"........XX...aaaaaaaaaaa", -#endif -".............aXXXXXXXXXa", -".............aXXXaaaaXXa", -".............aXXXXaaaXXa", -".............aXXXaaaaXXa", -".............aXXaaaXaXXa", -".............aXXaaXXXXXa", -".............aXXaXXXXXXa", -".............aXXXaXXXXXa", -".............aXXXXXXXXXa", -".............aaaaaaaaaaa"}; - -QPixmap QApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) -{ -#if defined(Q_WS_X11) || defined(Q_WS_WIN) - if (!move_cursor) { - move_cursor = new QPixmap((const char **)move_xpm); - copy_cursor = new QPixmap((const char **)copy_xpm); - link_cursor = new QPixmap((const char **)link_xpm); -#ifdef Q_WS_WIN - ignore_cursor = new QPixmap((const char **)ignore_xpm); -#endif - } - - switch (cshape) { - case Qt::DragMoveCursor: - return *move_cursor; - case Qt::DragCopyCursor: - return *copy_cursor; - case Qt::DragLinkCursor: - return *link_cursor; -#ifdef Q_WS_WIN - case Qt::ForbiddenCursor: - return *ignore_cursor; -#endif - default: - break; - } -#else - Q_UNUSED(cshape); -#endif - return QPixmap(); -} - -QString QApplicationPrivate::qmljsDebugArgumentsString() -{ - return qmljs_debug_arguments; -} - QT_END_NAMESPACE #include "moc_qapplication.cpp" diff --git a/src/gui/kernel/qapplication.h b/src/widgets/kernel/qapplication.h similarity index 93% rename from src/gui/kernel/qapplication.h rename to src/widgets/kernel/qapplication.h index 15488490d19..aec2c077636 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -48,16 +48,19 @@ #include <QtCore/qsize.h> #include <QtGui/qcursor.h> #ifdef QT_INCLUDE_COMPAT -# include <QtGui/qdesktopwidget.h> +# include <QtWidgets/qdesktopwidget.h> #endif #ifdef QT3_SUPPORT -# include <QtGui/qwidget.h> +# include <QtWidgets/qwidget.h> # include <QtGui/qpalette.h> #endif #ifdef Q_WS_QWS # include <QtGui/qrgb.h> # include <QtGui/qtransportauth_qws.h> #endif +#ifdef Q_WS_QPA +# include <QtGui/qguiapplication.h> +#endif QT_BEGIN_HEADER @@ -93,11 +96,15 @@ class QApplicationPrivate; #endif #define qApp (static_cast<QApplication *>(QCoreApplication::instance())) +#ifdef Q_WS_QPA +#define QApplicationBase QGuiApplication +#else +#define QApplicationBase QCoreApplication +#endif -class Q_GUI_EXPORT QApplication : public QCoreApplication +class Q_WIDGETS_EXPORT QApplication : public QApplicationBase { Q_OBJECT - Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection) Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon) Q_PROPERTY(int cursorFlashTime READ cursorFlashTime WRITE setCursorFlashTime) Q_PROPERTY(int doubleClickInterval READ doubleClickInterval WRITE setDoubleClickInterval) @@ -146,15 +153,10 @@ public: enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 }; static int colorSpec(); static void setColorSpec(int); - static void setGraphicsSystem(const QString &); + // ### Qt4 compatibility, remove? + static inline void setGraphicsSystem(const QString &) {} -#ifndef QT_NO_CURSOR - static QCursor *overrideCursor(); - static void setOverrideCursor(const QCursor &); - static void changeOverrideCursor(const QCursor &); - static void restoreOverrideCursor(); -#endif - static QPalette palette(); + using QGuiApplication::palette; static QPalette palette(const QWidget *); static QPalette palette(const char *className); static void setPalette(const QPalette &, const char* className = 0); @@ -180,7 +182,7 @@ public: static QWidget *activePopupWidget(); static QWidget *activeModalWidget(); -#ifndef QT_NO_CLIPBOARD +#if !defined(Q_WS_QPA) && !defined(QT_NO_CLIPBOARD) static QClipboard *clipboard(); #endif static QWidget *focusWidget(); @@ -225,12 +227,6 @@ public: static void setStartDragDistance(int l); static int startDragDistance(); - static void setLayoutDirection(Qt::LayoutDirection direction); - static Qt::LayoutDirection layoutDirection(); - - static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; } - static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; } - static bool isEffectEnabled(Qt::UIEffect); static void setEffectEnabled(Qt::UIEffect, bool enable = true); @@ -280,9 +276,6 @@ public: QInputContext *inputContext() const; #endif - static QLocale keyboardInputLocale(); - static Qt::LayoutDirection keyboardInputDirection(); - static int exec(); bool notify(QObject *, QEvent *); @@ -300,7 +293,6 @@ public: Q_SIGNALS: void lastWindowClosed(); void focusChanged(QWidget *old, QWidget *now); - void fontDatabaseChanged(); #ifndef QT_NO_SESSIONMANAGER void commitDataRequest(QSessionManager &sessionManager); void saveStateRequest(QSessionManager &sessionManager); @@ -391,6 +383,7 @@ private: friend class QGraphicsScenePrivate; friend class QWidget; friend class QWidgetPrivate; + friend class QWidgetWindow; friend class QETWidget; friend class Q3AccelManager; friend class QTranslator; @@ -398,10 +391,9 @@ private: #ifndef QT_NO_SHORTCUT friend class QShortcut; friend class QLineEdit; - friend class QTextControl; + friend class QWidgetTextControl; #endif friend class QAction; - friend class QFontDatabasePrivate; #if defined(Q_WS_QWS) friend class QInputContext; diff --git a/src/gui/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h similarity index 85% rename from src/gui/kernel/qapplication_p.h rename to src/widgets/kernel/qapplication_p.h index e1252a95896..6efee021958 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -54,39 +54,38 @@ // We mean it. // -#include "QtGui/qapplication.h" +#include "QtWidgets/qapplication.h" #include "QtGui/qevent.h" #include "QtGui/qfont.h" #include "QtGui/qcursor.h" #include "QtGui/qregion.h" +#include "QtGui/qwindow.h" +#include "qwidget.h" +#include "QtGui/qplatformnativeinterface_qpa.h" #include "QtCore/qmutex.h" #include "QtCore/qtranslator.h" #include "QtCore/qbasictimer.h" #include "QtCore/qhash.h" #include "QtCore/qpointer.h" #include "private/qcoreapplication_p.h" -#include "QtGui/private/qshortcutmap_p.h" +#include "private/qshortcutmap_p.h" #include <private/qthread_p.h> #include "QtCore/qpoint.h" #include <QTime> -#ifdef Q_WS_QWS -#include "QtGui/qscreen_qws.h" -#include <private/qgraphicssystem_qws_p.h> -#endif #ifdef Q_OS_SYMBIAN #include <w32std.h> #endif #ifdef Q_WS_QPA #include <QWindowSystemInterface> -#include "qwindowsysteminterface_qpa_p.h" +#include "private/qwindowsysteminterface_qpa_p.h" #include "QtGui/qplatformintegration_qpa.h" +#include "private/qguiapplication_p.h" #endif QT_BEGIN_NAMESPACE class QClipboard; class QGraphicsScene; -class QGraphicsSystem; class QInputContext; class QObject; class QWidget; @@ -294,13 +293,22 @@ FontHash *qt_app_fonts_hash(); typedef QHash<QByteArray, QPalette> PaletteHash; PaletteHash *qt_app_palettes_hash(); -class Q_GUI_EXPORT QApplicationPrivate : public QCoreApplicationPrivate +#ifdef Q_WS_QPA +#define QApplicationPrivateBase QGuiApplicationPrivate +#else +#define QApplicationPrivateBase QCoreApplicationPrivate +#endif + +class Q_WIDGETS_EXPORT QApplicationPrivate : public QApplicationPrivateBase { Q_DECLARE_PUBLIC(QApplication) public: QApplicationPrivate(int &argc, char **argv, QApplication::Type type, int flags); ~QApplicationPrivate(); + virtual void notifyLayoutDirectionChange(); + virtual void notifyActiveWindowChange(QWindow *); + #if defined(Q_WS_X11) #ifndef QT_NO_SETTINGS static bool x11_apply_settings(); @@ -318,20 +326,6 @@ public: static bool autoSipEnabled; static QString desktopStyleKey(); - static QGraphicsSystem *graphicsSystem() -#if defined(Q_WS_QWS) - { return QScreen::instance()->graphicsSystem(); } -#else - { return graphics_system; } -#endif - -#if defined(Q_WS_QPA) - static QPlatformIntegration *platformIntegration() - { return platform_integration; } - - static QAbstractEventDispatcher *qt_qpa_core_dispatcher() - { return QCoreApplication::instance()->d_func()->threadData->eventDispatcher; } -#endif void createEventDispatcher(); QString appName() const; @@ -364,18 +358,6 @@ public: static void x11_initialize_style(); #endif - enum KeyPlatform { - KB_Win = 1, - KB_Mac = 2, - KB_X11 = 4, - KB_KDE = 8, - KB_Gnome = 16, - KB_CDE = 32, - KB_S60 = 64, - KB_All = 0xffff - }; - - static uint currentPlatform(); bool inPopupMode() const; void closePopup(QWidget *popup); void openPopup(QWidget *popup); @@ -389,9 +371,6 @@ public: bool is_session_restored; #endif -#ifndef QT_NO_CURSOR - QList<QCursor> cursor_list; -#endif #ifndef QT_NO_GRAPHICSVIEW // Maintain a list of all scenes to ensure font and palette propagation to // all scenes. @@ -427,18 +406,13 @@ public: static QWidgetList *popupWidgets; static QStyle *app_style; static int app_cspec; - static QPalette *app_pal; static QPalette *sys_pal; static QPalette *set_pal; - static QGraphicsSystem *graphics_system; - static QString graphics_system_name; - static bool runtime_graphics_system; -#ifdef Q_WS_QPA - static QPlatformIntegration *platform_integration; -#endif private: +#ifndef Q_WS_QPA static QFont *app_font; // private for a reason! Always use QApplication::font() instead! +#endif public: static QFont *sys_font; static QFont *set_font; @@ -448,9 +422,6 @@ public: static QWidget *active_window; static QIcon *app_icon; static bool obey_desktop_settings; - static int cursor_flash_time; - static int mouse_double_click_time; - static int keyboard_input_time; #ifndef QT_NO_WHEELEVENT static int wheel_scroll_lines; #endif @@ -464,8 +435,6 @@ public: static bool animate_toolbox; static bool widgetCount; // Coupled with -widgetcount switch static bool load_testability; // Coupled with -testability switch - static QString qmljs_debug_arguments; // a string containing arguments for js/qml debugging. - static QString qmljsDebugArgumentsString(); // access string from other libraries #ifdef Q_WS_MAC static bool native_modal_dialog_active; @@ -493,32 +462,6 @@ public: static bool qt_mac_apply_settings(); #endif -#ifdef Q_WS_QPA - 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(QWindowSystemInterfacePrivate::CloseEvent *e); - - static void processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e); - - static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e); - static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e); - - static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *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 - #ifdef Q_WS_QWS QPointer<QWSManager> last_manager; QWSServerCleaner qwsServerCleaner; @@ -567,6 +510,13 @@ public: #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 +#ifdef Q_OS_WIN + static HWND getHWNDForWidget(QWidget *widget) + { + QWindow *window = widget->windowHandle(); + return static_cast<HWND> (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window)); + } +#endif #ifndef QT_NO_GESTURES QGestureManager *gestureManager; @@ -580,7 +530,6 @@ public: #if defined(Q_WS_WIN) QPixmap *ignore_cursor; #endif - QPixmap getPixmapCursor(Qt::CursorShape cshape); QMap<int, QWeakPointer<QWidget> > widgetForTouchPointId; QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints; @@ -663,7 +612,7 @@ private: static bool isAlien(QWidget *); }; -Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, +Q_WIDGETS_EXPORT void qt_translateRawTouchEvent(QWidget *window, QTouchEvent::DeviceType deviceType, const QList<QTouchEvent::TouchPoint> &touchPoints); @@ -674,8 +623,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_QPA) - extern void qt_qpa_set_cursor(QWidget *, bool); +#else + extern void qt_qpa_set_cursor(QWidget * w, bool force); #endif QT_END_NAMESPACE diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp new file mode 100644 index 00000000000..a7c274233d1 --- /dev/null +++ b/src/widgets/kernel/qapplication_qpa.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 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" +#ifndef QT_NO_CURSOR +#include "private/qcursor_p.h" +#endif +#include "qscreen.h" + +#include "private/qwidget_p.h" +#include "private/qevent_p.h" + +#include "qgenericpluginfactory_qpa.h" +#include "private/qplatformintegrationfactory_qpa_p.h" +#include <qdesktopwidget.h> + +#include <qinputcontext.h> +#include <QPlatformCursor> +#include <qdebug.h> +#include <QWindowSystemInterface> +#include "private/qwindowsysteminterface_qpa_p.h" +#include <QPlatformIntegration> + +#include "qdesktopwidget_qpa_p.h" +#include "qwidgetwindow_qpa_p.h" + +QT_BEGIN_NAMESPACE + +static QString appName; +static QString appFont; +static bool popupGrabOk; +extern bool app_do_modal; +extern QWidgetList *qt_modal_stack; +extern QWidget *qt_button_down; +extern QWidget *qt_popup_down; +extern bool qt_replay_popup_mouse_event; +int openPopupCount = 0; + +QString QApplicationPrivate::appName() const +{ + return QT_PREPEND_NAMESPACE(appName); +} + +void QApplicationPrivate::createEventDispatcher() +{ + QGuiApplicationPrivate::createEventDispatcher(); +} + +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<QWSFocusEvent*>(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; +} + +QWidget *qt_tlw_for_window(QWindow *wnd) +{ + if (wnd) + foreach (QWidget *tlw, qApp->topLevelWidgets()) + if (tlw->windowHandle() == wnd) + return tlw; + return 0; +} + +void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous) +{ + Q_UNUSED(previous); + Q_Q(QApplication); + QWindow *wnd = QGuiApplicationPrivate::active_window; + if (inPopupMode()) // some delayed focus event to ignore + return; + QWidget *tlw = qt_tlw_for_window(wnd); + q->setActiveWindow(tlw); +} + +static void ungrabKeyboardForPopup(QWidget *popup) +{ + if (QWidget::keyboardGrabber()) + qt_widget_private(QWidget::keyboardGrabber())->stealKeyboardGrab(true); + else + qt_widget_private(popup)->stealKeyboardGrab(false); +} + +static void ungrabMouseForPopup(QWidget *popup) +{ + if (QWidget::mouseGrabber()) + qt_widget_private(QWidget::mouseGrabber())->stealMouseGrab(true); + else + qt_widget_private(popup)->stealMouseGrab(false); +} + +static void grabForPopup(QWidget *popup) +{ + Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created)); + popupGrabOk = qt_widget_private(popup)->stealKeyboardGrab(true); + if (popupGrabOk) { + popupGrabOk = qt_widget_private(popup)->stealMouseGrab(true); + if (!popupGrabOk) { + // transfer grab back to the keyboard grabber if any + ungrabKeyboardForPopup(popup); + } + } +} + +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; + + if (popupGrabOk) { + popupGrabOk = false; + + if (popup->geometry().contains(QPoint(QGuiApplicationPrivate::mousePressX, + QGuiApplicationPrivate::mousePressY)) + || popup->testAttribute(Qt::WA_NoMouseReplay)) { + // mouse release event or inside + qt_replay_popup_mouse_event = false; + } else { // mouse press event + QGuiApplicationPrivate::mousePressTime -= 10000; // avoid double click + qt_replay_popup_mouse_event = true; + } + + // transfer grab back to mouse grabber if any, otherwise release the grab + ungrabMouseForPopup(popup); + + // transfer grab back to keyboard grabber if any, otherwise release the grab + ungrabKeyboardForPopup(popup); + } + + 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); + + if (QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard + grabForPopup(aw); + } + +} + +void QApplicationPrivate::openPopup(QWidget *popup) +{ + openPopupCount++; + if (!popupWidgets) // create list + popupWidgets = new QWidgetList; + popupWidgets->append(popup); // add to end of list + + if (QApplicationPrivate::popupWidgets->count() == 1) // grab mouse/keyboard + grabForPopup(popup); + + // 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() +{ +} + +#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; + } +} + +QWidget *QApplication::topLevelAt(const QPoint &pos) +{ + QList<QScreen *> screens = QGuiApplication::screens(); + QList<QScreen *>::const_iterator screen = screens.constBegin(); + QList<QScreen *>::const_iterator end = screens.constEnd(); + + while (screen != end) { + if ((*screen)->geometry().contains(pos)) { + QWidgetWindow *w = qobject_cast<QWidgetWindow *>((*screen)->handle()->topLevelAt(pos)); + return w ? w->widget() : 0; + } + ++screen; + } + return 0; +} + +void QApplication::beep() +{ +} + +void QApplication::alert(QWidget *, int) +{ +} + +QPlatformNativeInterface *QApplication::platformNativeInterface() +{ + QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration(); + return pi->nativeInterface(); +} + +void qt_init(QApplicationPrivate *, int type) +{ + Q_UNUSED(type); + + qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); + QColormap::initialize(); + + qApp->setObjectName(appName); + +#ifndef QT_NO_QWS_INPUTMETHODS + qApp->setInputContext(new QInputContext(qApp)); +#endif +} + +#ifdef Q_OS_WIN +static HDC displayDC = 0; // display device context + +Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display DC +{ + Q_ASSERT(qApp && qApp->thread() == QThread::currentThread()); + if (!displayDC) + displayDC = GetDC(0); + return displayDC; +} +#endif + +void qt_cleanup() +{ + QPixmapCache::clear(); + QColormap::cleanup(); + delete QApplicationPrivate::inputContext; + QApplicationPrivate::inputContext = 0; + + QApplicationPrivate::active_window = 0; //### this should not be necessary +#ifdef Q_OS_WIN + if (displayDC) { + ReleaseDC(0, displayDC); + displayDC = 0; + } +#endif +} + +#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 + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp similarity index 100% rename from src/gui/kernel/qboxlayout.cpp rename to src/widgets/kernel/qboxlayout.cpp diff --git a/src/gui/kernel/qboxlayout.h b/src/widgets/kernel/qboxlayout.h similarity index 95% rename from src/gui/kernel/qboxlayout.h rename to src/widgets/kernel/qboxlayout.h index d0de651387e..7c56a329799 100644 --- a/src/gui/kernel/qboxlayout.h +++ b/src/widgets/kernel/qboxlayout.h @@ -42,9 +42,9 @@ #ifndef QBOXLAYOUT_H #define QBOXLAYOUT_H -#include <QtGui/qlayout.h> +#include <QtWidgets/qlayout.h> #ifdef QT_INCLUDE_COMPAT -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> #endif #include <limits.h> @@ -57,7 +57,7 @@ QT_MODULE(Gui) class QBoxLayoutPrivate; -class Q_GUI_EXPORT QBoxLayout : public QLayout +class Q_WIDGETS_EXPORT QBoxLayout : public QLayout { Q_OBJECT Q_DECLARE_PRIVATE(QBoxLayout) @@ -126,7 +126,7 @@ private: Q_DISABLE_COPY(QBoxLayout) }; -class Q_GUI_EXPORT QHBoxLayout : public QBoxLayout +class Q_WIDGETS_EXPORT QHBoxLayout : public QBoxLayout { Q_OBJECT public: @@ -146,7 +146,7 @@ private: Q_DISABLE_COPY(QHBoxLayout) }; -class Q_GUI_EXPORT QVBoxLayout : public QBoxLayout +class Q_WIDGETS_EXPORT QVBoxLayout : public QBoxLayout { Q_OBJECT public: diff --git a/src/gui/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp similarity index 100% rename from src/gui/kernel/qdesktopwidget.cpp rename to src/widgets/kernel/qdesktopwidget.cpp diff --git a/src/gui/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h similarity index 97% rename from src/gui/kernel/qdesktopwidget.h rename to src/widgets/kernel/qdesktopwidget.h index 4cd0d53be64..e1ed8cfa078 100644 --- a/src/gui/kernel/qdesktopwidget.h +++ b/src/widgets/kernel/qdesktopwidget.h @@ -42,7 +42,7 @@ #ifndef QDESKTOPWIDGET_H #define QDESKTOPWIDGET_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) class QApplication; class QDesktopWidgetPrivate; -class Q_GUI_EXPORT QDesktopWidget : public QWidget +class Q_WIDGETS_EXPORT QDesktopWidget : public QWidget { Q_OBJECT Q_PROPERTY(bool virtualDesktop READ isVirtualDesktop) diff --git a/src/gui/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc similarity index 100% rename from src/gui/kernel/qdesktopwidget.qdoc rename to src/widgets/kernel/qdesktopwidget.qdoc diff --git a/src/gui/kernel/qdesktopwidget_qpa.cpp b/src/widgets/kernel/qdesktopwidget_qpa.cpp similarity index 83% rename from src/gui/kernel/qdesktopwidget_qpa.cpp rename to src/widgets/kernel/qdesktopwidget_qpa.cpp index b9d257789d9..380daee8c0f 100644 --- a/src/gui/kernel/qdesktopwidget_qpa.cpp +++ b/src/widgets/kernel/qdesktopwidget_qpa.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include "qdesktopwidget.h" +#include "qscreen.h" #include "private/qapplication_p.h" -#include "private/qgraphicssystem_p.h" #include <QWidget> #include "private/qwidget_p.h" #include "private/qdesktopwidget_qpa_p.h" @@ -52,8 +52,7 @@ QT_USE_NAMESPACE void QDesktopWidgetPrivate::updateScreenList() { Q_Q(QDesktopWidget); - - QList<QPlatformScreen *> screenList = QApplicationPrivate::platformIntegration()->screens(); + QList<QScreen *> screenList = QGuiApplication::screens(); int targetLength = screenList.length(); int currentLength = screens.length(); @@ -99,7 +98,7 @@ QDesktopWidget::~QDesktopWidget() bool QDesktopWidget::isVirtualDesktop() const { - return QApplicationPrivate::platformIntegration()->isVirtualDesktop(); + return QGuiApplication::primaryScreen()->virtualSiblings().size() > 1; } int QDesktopWidget::primaryScreen() const @@ -109,8 +108,7 @@ int QDesktopWidget::primaryScreen() const int QDesktopWidget::numScreens() const { - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - return qMax(pi->screens().size(), 1); + return qMax(QGuiApplication::screens().size(), 1); } QWidget *QDesktopWidget::screen(int screen) @@ -123,26 +121,24 @@ QWidget *QDesktopWidget::screen(int screen) const QRect QDesktopWidget::availableGeometry(int screenNo) const { - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList<QPlatformScreen *> screens = pi->screens(); + QList<QScreen *> screens = QGuiApplication::screens(); if (screenNo == -1) screenNo = 0; if (screenNo < 0 || screenNo >= screens.size()) return QRect(); else - return screens[screenNo]->availableGeometry(); + return screens.at(screenNo)->availableGeometry(); } const QRect QDesktopWidget::screenGeometry(int screenNo) const { - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList<QPlatformScreen *> screens = pi->screens(); + QList<QScreen *> screens = QGuiApplication::screens(); if (screenNo == -1) screenNo = 0; if (screenNo < 0 || screenNo >= screens.size()) return QRect(); else - return screens[screenNo]->geometry(); + return screens.at(screenNo)->geometry(); } int QDesktopWidget::screenNumber(const QWidget *w) const @@ -159,11 +155,10 @@ int QDesktopWidget::screenNumber(const QWidget *w) const int QDesktopWidget::screenNumber(const QPoint &p) const { - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList<QPlatformScreen *> screens = pi->screens(); + QList<QScreen *> screens = QGuiApplication::screens(); for (int i = 0; i < screens.size(); ++i) - if (screens[i]->geometry().contains(p)) + if (screens.at(i)->geometry().contains(p)) return i; return primaryScreen(); //even better would be closest screen diff --git a/src/gui/kernel/qdesktopwidget_qpa_p.h b/src/widgets/kernel/qdesktopwidget_qpa_p.h similarity index 100% rename from src/gui/kernel/qdesktopwidget_qpa_p.h rename to src/widgets/kernel/qdesktopwidget_qpa_p.h diff --git a/src/gui/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp similarity index 100% rename from src/gui/kernel/qformlayout.cpp rename to src/widgets/kernel/qformlayout.cpp diff --git a/src/gui/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h similarity index 98% rename from src/gui/kernel/qformlayout.h rename to src/widgets/kernel/qformlayout.h index bc096663945..05bb57d981f 100644 --- a/src/gui/kernel/qformlayout.h +++ b/src/widgets/kernel/qformlayout.h @@ -42,7 +42,7 @@ #ifndef QFORMLAYOUT_H #define QFORMLAYOUT_H -#include <QtGui/QLayout> +#include <QtWidgets/QLayout> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_MODULE(Gui) class QFormLayoutPrivate; -class Q_GUI_EXPORT QFormLayout : public QLayout +class Q_WIDGETS_EXPORT QFormLayout : public QLayout { Q_OBJECT Q_ENUMS(FormStyle FieldGrowthPolicy RowWrapPolicy ItemRole) diff --git a/src/gui/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp similarity index 70% rename from src/gui/kernel/qgesture.cpp rename to src/widgets/kernel/qgesture.cpp index a3ac42e08ae..92f4c9cfc6d 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/widgets/kernel/qgesture.cpp @@ -42,6 +42,7 @@ #include "qgesture.h" #include "private/qgesture_p.h" #include "private/qstandardgestures_p.h" +#include "qgraphicsview.h" #ifndef QT_NO_GESTURES @@ -800,6 +801,316 @@ int QTapAndHoldGesture::timeout() int QTapAndHoldGesturePrivate::Timeout = 700; // in ms + +/*! + \class QGestureEvent + \since 4.6 + \ingroup events + \ingroup gestures + + \brief The QGestureEvent class provides the description of triggered gestures. + + The QGestureEvent class contains a list of gestures, which can be obtained using the + gestures() function. + + The gestures are either active or canceled. A list of those that are currently being + executed can be obtained using the activeGestures() function. A list of those which + were previously active and have been canceled can be accessed using the + canceledGestures() function. A gesture might be canceled if the current window loses + focus, for example, or because of a timeout, or for other reasons. + + If the event handler does not accept the event by calling the generic + QEvent::accept() function, all individual QGesture object that were not + accepted and in the Qt::GestureStarted state will be propagated up the + parent widget chain until a widget accepts them individually, by calling + QGestureEvent::accept() for each of them, or an event filter consumes the + event. + + \section1 Further Reading + + For an overview of gesture handling in Qt and information on using gestures + in your applications, see the \l{Gestures Programming} document. + + \sa QGesture, QGestureRecognizer, + QWidget::grabGesture(), QGraphicsObject::grabGesture() +*/ + +/*! + Creates new QGestureEvent containing a list of \a gestures. +*/ +QGestureEvent::QGestureEvent(const QList<QGesture *> &gestures) + : QEvent(QEvent::Gesture) +{ + d = reinterpret_cast<QEventPrivate *>(new QGestureEventPrivate(gestures)); +} + +/*! + Destroys QGestureEvent. +*/ +QGestureEvent::~QGestureEvent() +{ + delete reinterpret_cast<QGestureEventPrivate *>(d); +} + +/*! + Returns all gestures that are delivered in the event. +*/ +QList<QGesture *> QGestureEvent::gestures() const +{ + return d_func()->gestures; +} + +/*! + Returns a gesture object by \a type. +*/ +QGesture *QGestureEvent::gesture(Qt::GestureType type) const +{ + const QGestureEventPrivate *d = d_func(); + for(int i = 0; i < d->gestures.size(); ++i) + if (d->gestures.at(i)->gestureType() == type) + return d->gestures.at(i); + return 0; +} + +/*! + Returns a list of active (not canceled) gestures. +*/ +QList<QGesture *> QGestureEvent::activeGestures() const +{ + QList<QGesture *> gestures; + foreach (QGesture *gesture, d_func()->gestures) { + if (gesture->state() != Qt::GestureCanceled) + gestures.append(gesture); + } + return gestures; +} + +/*! + Returns a list of canceled gestures. +*/ +QList<QGesture *> QGestureEvent::canceledGestures() const +{ + QList<QGesture *> gestures; + foreach (QGesture *gesture, d_func()->gestures) { + if (gesture->state() == Qt::GestureCanceled) + gestures.append(gesture); + } + return gestures; +} + +/*! + Sets the accept flag of the given \a gesture object to the specified \a value. + + Setting the accept flag indicates that the event receiver wants the \a gesture. + Unwanted gestures may be propagated to the parent widget. + + By default, gestures in events of type QEvent::Gesture are accepted, and + gestures in QEvent::GestureOverride events are ignored. + + For convenience, the accept flag can also be set with + \l{QGestureEvent::accept()}{accept(gesture)}, and cleared with + \l{QGestureEvent::ignore()}{ignore(gesture)}. +*/ +void QGestureEvent::setAccepted(QGesture *gesture, bool value) +{ + if (gesture) + setAccepted(gesture->gestureType(), value); +} + +/*! + Sets the accept flag of the given \a gesture object, the equivalent of calling + \l{QGestureEvent::setAccepted()}{setAccepted(gesture, true)}. + + Setting the accept flag indicates that the event receiver wants the + gesture. Unwanted gestures may be propagated to the parent widget. + + \sa QGestureEvent::ignore() +*/ +void QGestureEvent::accept(QGesture *gesture) +{ + if (gesture) + setAccepted(gesture->gestureType(), true); +} + +/*! + Clears the accept flag parameter of the given \a gesture object, the equivalent + of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}. + + Clearing the accept flag indicates that the event receiver does not + want the gesture. Unwanted gestures may be propagated to the parent widget. + + \sa QGestureEvent::accept() +*/ +void QGestureEvent::ignore(QGesture *gesture) +{ + if (gesture) + setAccepted(gesture->gestureType(), false); +} + +/*! + Returns true if the \a gesture is accepted; otherwise returns false. +*/ +bool QGestureEvent::isAccepted(QGesture *gesture) const +{ + return gesture ? isAccepted(gesture->gestureType()) : false; +} + +/*! + Sets the accept flag of the given \a gestureType object to the specified + \a value. + + Setting the accept flag indicates that the event receiver wants to receive + gestures of the specified type, \a gestureType. Unwanted gestures may be + propagated to the parent widget. + + By default, gestures in events of type QEvent::Gesture are accepted, and + gestures in QEvent::GestureOverride events are ignored. + + For convenience, the accept flag can also be set with + \l{QGestureEvent::accept()}{accept(gestureType)}, and cleared with + \l{QGestureEvent::ignore()}{ignore(gestureType)}. +*/ +void QGestureEvent::setAccepted(Qt::GestureType gestureType, bool value) +{ + setAccepted(false); + d_func()->accepted[gestureType] = value; +} + +/*! + Sets the accept flag of the given \a gestureType, the equivalent of calling + \l{QGestureEvent::setAccepted()}{setAccepted(gestureType, true)}. + + Setting the accept flag indicates that the event receiver wants the + gesture. Unwanted gestures may be propagated to the parent widget. + + \sa QGestureEvent::ignore() +*/ +void QGestureEvent::accept(Qt::GestureType gestureType) +{ + setAccepted(gestureType, true); +} + +/*! + Clears the accept flag parameter of the given \a gestureType, the equivalent + of calling \l{QGestureEvent::setAccepted()}{setAccepted(gesture, false)}. + + Clearing the accept flag indicates that the event receiver does not + want the gesture. Unwanted gestures may be propgated to the parent widget. + + \sa QGestureEvent::accept() +*/ +void QGestureEvent::ignore(Qt::GestureType gestureType) +{ + setAccepted(gestureType, false); +} + +/*! + Returns true if the gesture of type \a gestureType is accepted; otherwise + returns false. +*/ +bool QGestureEvent::isAccepted(Qt::GestureType gestureType) const +{ + return d_func()->accepted.value(gestureType, true); +} + +/*! + \internal + + Sets the widget for this event to the \a widget specified. +*/ +void QGestureEvent::setWidget(QWidget *widget) +{ + d_func()->widget = widget; +} + +/*! + Returns the widget on which the event occurred. +*/ +QWidget *QGestureEvent::widget() const +{ + return d_func()->widget; +} + +#ifndef QT_NO_GRAPHICSVIEW +/*! + Returns the scene-local coordinates if the \a gesturePoint is inside a + graphics view. + + This functional might be useful when the gesture event is delivered to a + QGraphicsObject to translate a point in screen coordinates to scene-local + coordinates. + + \sa QPointF::isNull(). +*/ +QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const +{ + QWidget *w = widget(); + if (w) // we get the viewport as widget, not the graphics view + w = w->parentWidget(); + QGraphicsView *view = qobject_cast<QGraphicsView*>(w); + if (view) { + return view->mapToScene(view->mapFromGlobal(gesturePoint.toPoint())); + } + return QPointF(); +} +#endif //QT_NO_GRAPHICSVIEW + +/*! + \internal +*/ +QGestureEventPrivate *QGestureEvent::d_func() +{ + return reinterpret_cast<QGestureEventPrivate *>(d); +} + +/*! + \internal +*/ +const QGestureEventPrivate *QGestureEvent::d_func() const +{ + return reinterpret_cast<const QGestureEventPrivate *>(d); +} + +#ifdef Q_NO_USING_KEYWORD +/*! + \fn void QGestureEvent::setAccepted(bool accepted) + + Sets or clears the event's internal flag that determines whether it should + be delivered to other objects. + + Calling this function with a value of true for \a accepted indicates that the + caller has accepted the event and that it should not be propagated further. + Calling this function with a value of false indicates that the caller has + ignored the event and that it should be delivered to other objects. + + For convenience, the accept flag can also be set with accept(), and cleared + with ignore(). + + \sa QEvent::accepted +*/ +/*! + \fn bool QGestureEvent::isAccepted() const + + Returns true is the event has been accepted; otherwise returns false. + + \sa QEvent::accepted +*/ +/*! + \fn void QGestureEvent::accept() + + Accepts the event, the equivalent of calling setAccepted(true). + + \sa QEvent::accept() +*/ +/*! + \fn void QGestureEvent::ignore() + + Ignores the event, the equivalent of calling setAccepted(false). + + \sa QEvent::ignore() +*/ +#endif + QT_END_NAMESPACE #include <moc_qgesture.cpp> diff --git a/src/gui/kernel/qgesture.h b/src/widgets/kernel/qgesture.h similarity index 82% rename from src/gui/kernel/qgesture.h rename to src/widgets/kernel/qgesture.h index 5e6f0261753..610ae2b9f6c 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/widgets/kernel/qgesture.h @@ -48,6 +48,7 @@ #include <QtCore/qpoint.h> #include <QtCore/qrect.h> #include <QtCore/qmetatype.h> +#include <QtGui/qevent.h> #ifndef QT_NO_GESTURES @@ -61,7 +62,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QGesturePrivate; -class Q_GUI_EXPORT QGesture : public QObject +class Q_WIDGETS_EXPORT QGesture : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QGesture) @@ -104,7 +105,7 @@ private: }; class QPanGesturePrivate; -class Q_GUI_EXPORT QPanGesture : public QGesture +class Q_WIDGETS_EXPORT QPanGesture : public QGesture { Q_OBJECT Q_DECLARE_PRIVATE(QPanGesture) @@ -133,7 +134,7 @@ public: }; class QPinchGesturePrivate; -class Q_GUI_EXPORT QPinchGesture : public QGesture +class Q_WIDGETS_EXPORT QPinchGesture : public QGesture { Q_OBJECT Q_DECLARE_PRIVATE(QPinchGesture) @@ -204,7 +205,7 @@ Q_DECLARE_METATYPE(QPinchGesture::ChangeFlags) QT_BEGIN_NAMESPACE class QSwipeGesturePrivate; -class Q_GUI_EXPORT QSwipeGesture : public QGesture +class Q_WIDGETS_EXPORT QSwipeGesture : public QGesture { Q_OBJECT Q_DECLARE_PRIVATE(QSwipeGesture) @@ -229,7 +230,7 @@ public: }; class QTapGesturePrivate; -class Q_GUI_EXPORT QTapGesture : public QGesture +class Q_WIDGETS_EXPORT QTapGesture : public QGesture { Q_OBJECT Q_DECLARE_PRIVATE(QTapGesture) @@ -246,7 +247,7 @@ public: }; class QTapAndHoldGesturePrivate; -class Q_GUI_EXPORT QTapAndHoldGesture : public QGesture +class Q_WIDGETS_EXPORT QTapAndHoldGesture : public QGesture { Q_OBJECT Q_DECLARE_PRIVATE(QTapAndHoldGesture) @@ -265,6 +266,58 @@ public: friend class QTapAndHoldGestureRecognizer; }; +class QGesture; +class QGestureEventPrivate; +class Q_WIDGETS_EXPORT QGestureEvent : public QEvent +{ +public: + QGestureEvent(const QList<QGesture *> &gestures); + ~QGestureEvent(); + + QList<QGesture *> gestures() const; + QGesture *gesture(Qt::GestureType type) const; + + QList<QGesture *> activeGestures() const; + QList<QGesture *> canceledGestures() const; + +#ifdef Q_NO_USING_KEYWORD + inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); } + inline bool isAccepted() const { return QEvent::isAccepted(); } + + inline void accept() { QEvent::accept(); } + inline void ignore() { QEvent::ignore(); } +#else + using QEvent::setAccepted; + using QEvent::isAccepted; + using QEvent::accept; + using QEvent::ignore; +#endif + + void setAccepted(QGesture *, bool); + void accept(QGesture *); + void ignore(QGesture *); + bool isAccepted(QGesture *) const; + + void setAccepted(Qt::GestureType, bool); + void accept(Qt::GestureType); + void ignore(Qt::GestureType); + bool isAccepted(Qt::GestureType) const; + + void setWidget(QWidget *widget); + QWidget *widget() const; + +#ifndef QT_NO_GRAPHICSVIEW + QPointF mapToGraphicsScene(const QPointF &gesturePoint) const; +#endif + +private: + QGestureEventPrivate *d_func(); + const QGestureEventPrivate *d_func() const; + + friend class QApplication; + friend class QGestureManager; +}; + QT_END_NAMESPACE Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy) diff --git a/src/gui/kernel/qgesture_p.h b/src/widgets/kernel/qgesture_p.h similarity index 85% rename from src/gui/kernel/qgesture_p.h rename to src/widgets/kernel/qgesture_p.h index 7a3e0726d7e..85d1c858841 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/widgets/kernel/qgesture_p.h @@ -190,6 +190,54 @@ public: static int Timeout; }; +#ifndef QT_NO_GESTURES +class QNativeGestureEvent : public QEvent +{ +public: + enum Type { + None, + GestureBegin, + GestureEnd, + Pan, + Zoom, + Rotate, + Swipe + }; + + QNativeGestureEvent() + : QEvent(QEvent::NativeGesture), gestureType(None), percentage(0) +#ifdef Q_WS_WIN + , sequenceId(0), argument(0) +#endif + { + } + + Type gestureType; + float percentage; + QPoint position; + float angle; +#ifdef Q_WS_WIN + ulong sequenceId; + quint64 argument; +#endif +}; + +class QGestureEventPrivate +{ +public: + inline QGestureEventPrivate(const QList<QGesture *> &list) + : gestures(list), widget(0) + { + } + + QList<QGesture *> gestures; + QWidget *widget; + QMap<Qt::GestureType, bool> accepted; + QMap<Qt::GestureType, QWidget *> targetWidgets; +}; +#endif // QT_NO_GESTURES + + QT_END_NAMESPACE #endif // QT_NO_GESTURES diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp similarity index 99% rename from src/gui/kernel/qgesturemanager.cpp rename to src/widgets/kernel/qgesturemanager.cpp index 868387d77fc..d3d34c2756c 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -53,7 +53,7 @@ #ifdef Q_WS_MAC #include "qmacgesturerecognizer_mac_p.h" #endif -#if defined(Q_OS_WIN) && !defined(QT_NO_NATIVE_GESTURES) +#if defined(Q_WS_WIN) && !defined(QT_NO_NATIVE_GESTURES) #include "qwinnativepangesturerecognizer_win_p.h" #endif @@ -87,7 +87,7 @@ QGestureManager::QGestureManager(QObject *parent) registerGestureRecognizer(new QSwipeGestureRecognizer); registerGestureRecognizer(new QTapGestureRecognizer); #endif -#if defined(Q_OS_WIN) +#if defined(Q_WS_WIN) #if !defined(QT_NO_NATIVE_GESTURES) if (QApplicationPrivate::HasTouchSupport) registerGestureRecognizer(new QWinNativePanGestureRecognizer); diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/widgets/kernel/qgesturemanager_p.h similarity index 100% rename from src/gui/kernel/qgesturemanager_p.h rename to src/widgets/kernel/qgesturemanager_p.h diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/widgets/kernel/qgesturerecognizer.cpp similarity index 100% rename from src/gui/kernel/qgesturerecognizer.cpp rename to src/widgets/kernel/qgesturerecognizer.cpp diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/widgets/kernel/qgesturerecognizer.h similarity index 98% rename from src/gui/kernel/qgesturerecognizer.h rename to src/widgets/kernel/qgesturerecognizer.h index d3574f7ad2d..019f856f09d 100644 --- a/src/gui/kernel/qgesturerecognizer.h +++ b/src/widgets/kernel/qgesturerecognizer.h @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QObject; class QEvent; class QGesture; -class Q_GUI_EXPORT QGestureRecognizer +class Q_WIDGETS_EXPORT QGestureRecognizer { public: enum ResultFlag diff --git a/src/gui/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp similarity index 100% rename from src/gui/kernel/qgridlayout.cpp rename to src/widgets/kernel/qgridlayout.cpp diff --git a/src/gui/kernel/qgridlayout.h b/src/widgets/kernel/qgridlayout.h similarity index 98% rename from src/gui/kernel/qgridlayout.h rename to src/widgets/kernel/qgridlayout.h index 41c9dd62376..3e579e3dfde 100644 --- a/src/gui/kernel/qgridlayout.h +++ b/src/widgets/kernel/qgridlayout.h @@ -42,9 +42,9 @@ #ifndef QGRIDLAYOUT_H #define QGRIDLAYOUT_H -#include <QtGui/qlayout.h> +#include <QtWidgets/qlayout.h> #ifdef QT_INCLUDE_COMPAT -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> #endif #include <limits.h> @@ -57,7 +57,7 @@ QT_MODULE(Gui) class QGridLayoutPrivate; -class Q_GUI_EXPORT QGridLayout : public QLayout +class Q_WIDGETS_EXPORT QGridLayout : public QLayout { Q_OBJECT Q_DECLARE_PRIVATE(QGridLayout) diff --git a/src/gui/kernel/qguieventdispatcher_glib.cpp b/src/widgets/kernel/qguieventdispatcher_glib.cpp similarity index 100% rename from src/gui/kernel/qguieventdispatcher_glib.cpp rename to src/widgets/kernel/qguieventdispatcher_glib.cpp diff --git a/src/gui/kernel/qguieventdispatcher_glib_p.h b/src/widgets/kernel/qguieventdispatcher_glib_p.h similarity index 100% rename from src/gui/kernel/qguieventdispatcher_glib_p.h rename to src/widgets/kernel/qguieventdispatcher_glib_p.h diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/widgets/kernel/qguiplatformplugin.cpp similarity index 100% rename from src/gui/kernel/qguiplatformplugin.cpp rename to src/widgets/kernel/qguiplatformplugin.cpp diff --git a/src/gui/kernel/qguiplatformplugin_p.h b/src/widgets/kernel/qguiplatformplugin_p.h similarity index 95% rename from src/gui/kernel/qguiplatformplugin_p.h rename to src/widgets/kernel/qguiplatformplugin_p.h index 907b9bd508f..3fae6a5cbe8 100644 --- a/src/gui/kernel/qguiplatformplugin_p.h +++ b/src/widgets/kernel/qguiplatformplugin_p.h @@ -55,7 +55,7 @@ #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> -#include <QtGui/qdialog.h> +#include <QtWidgets/qdialog.h> QT_BEGIN_HEADER @@ -70,7 +70,7 @@ class QFileDialog; class QColorDialog; class QFileInfo; -struct Q_GUI_EXPORT QGuiPlatformPluginInterface : public QFactoryInterface +struct Q_WIDGETS_EXPORT QGuiPlatformPluginInterface : public QFactoryInterface { }; @@ -78,7 +78,7 @@ struct Q_GUI_EXPORT QGuiPlatformPluginInterface : public QFactoryInterface Q_DECLARE_INTERFACE(QGuiPlatformPluginInterface, QGuiPlatformPluginInterface_iid) -class Q_GUI_EXPORT QGuiPlatformPlugin : public QObject, public QGuiPlatformPluginInterface +class Q_WIDGETS_EXPORT QGuiPlatformPlugin : public QObject, public QGuiPlatformPluginInterface { Q_OBJECT Q_INTERFACES(QGuiPlatformPluginInterface:QFactoryInterface) diff --git a/src/gui/image/qicon.cpp b/src/widgets/kernel/qicon.cpp similarity index 89% rename from src/gui/image/qicon.cpp rename to src/widgets/kernel/qicon.cpp index 724205f2fc4..ec8740b7ef7 100644 --- a/src/gui/image/qicon.cpp +++ b/src/widgets/kernel/qicon.cpp @@ -45,7 +45,6 @@ #include "qiconengineplugin.h" #include "private/qfactoryloader_p.h" #include "private/qiconloader_p.h" -#include "qapplication.h" #include "qstyleoption.h" #include "qpainter.h" #include "qfileinfo.h" @@ -55,6 +54,7 @@ #include "qcache.h" #include "qdebug.h" #include "private/qguiplatformplugin_p.h" +#include "qguiapplication.h" #ifdef Q_WS_MAC #include <private/qt_mac_p.h> @@ -66,7 +66,7 @@ #include "private/qkde_p.h" #endif -#include "private/qstylehelper_p.h" +#include "private/qhexstring_p.h" #ifndef QT_NO_ICON QT_BEGIN_NAMESPACE @@ -107,18 +107,8 @@ QT_BEGIN_NAMESPACE static QBasicAtomicInt serialNumCounter = Q_BASIC_ATOMIC_INITIALIZER(1); static void qt_cleanup_icon_cache(); -namespace { - class IconCache: public QCache<QString, QIcon> - { - public: - IconCache() - { - // ### FIXME: needs to be re-added if qApp is re-created - qAddPostRoutine(qt_cleanup_icon_cache); - } - }; -} -Q_GLOBAL_STATIC(IconCache, qtIconCache) +typedef QCache<QString, QIcon> IconCache; +Q_GLOBAL_STATIC_WITH_INITIALIZER(IconCache, qtIconCache, qAddPostRoutine(qt_cleanup_icon_cache)) static void qt_cleanup_icon_cache() { @@ -126,7 +116,7 @@ static void qt_cleanup_icon_cache() } QIconPrivate::QIconPrivate() - : engine(0), + : engine(0), ref(1), serialNum(serialNumCounter.fetchAndAddRelaxed(1)), detach_no(0), engine_version(2), @@ -273,37 +263,38 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) actualSize.scale(size, Qt::KeepAspectRatio); - QString key = QLatin1Literal("qt_") - % HexString<quint64>(pm.cacheKey()) - % HexString<uint>(pe->mode) - % HexString<quint64>(QApplication::palette().cacheKey()) - % HexString<uint>(actualSize.width()) - % HexString<uint>(actualSize.height()); + // #### Qt5 no idea what this really does, but we need to remove the QApp and style references +// QString key = QLatin1Literal("qt_") +// % HexString<quint64>(pm.cacheKey()) +// % HexString<uint>(pe->mode) +// % HexString<quint64>(QApplication::palette().cacheKey()) +// % HexString<uint>(actualSize.width()) +// % HexString<uint>(actualSize.height()); - if (mode == QIcon::Active) { - if (QPixmapCache::find(key % HexString<uint>(mode), pm)) - return pm; // horray - if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)) { - QStyleOption opt(0); - opt.palette = QApplication::palette(); - QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt); - if (pm.cacheKey() == active.cacheKey()) - return pm; - } - } +// if (mode == QIcon::Active) { +// if (QPixmapCache::find(key % HexString<uint>(mode), pm)) +// return pm; // horray +// if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)) { +// QStyleOption opt(0); +// opt.palette = QApplication::palette(); +// QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt); +// if (pm.cacheKey() == active.cacheKey()) +// return pm; +// } +// } - if (!QPixmapCache::find(key % HexString<uint>(mode), pm)) { +// if (!QPixmapCache::find(key % HexString<uint>(mode), pm)) { if (pm.size() != actualSize) pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - if (pe->mode != mode && mode != QIcon::Normal) { - QStyleOption opt(0); - opt.palette = QApplication::palette(); - QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt); - if (!generated.isNull()) - pm = generated; - } - QPixmapCache::insert(key % HexString<uint>(mode), pm); - } +// if (pe->mode != mode && mode != QIcon::Normal) { +// QStyleOption opt(0); +// opt.palette = QApplication::palette(); +// QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt); +// if (!generated.isNull()) +// pm = generated; +// } +// QPixmapCache::insert(key % HexString<uint>(mode), pm); +// } return pm; } @@ -546,7 +537,10 @@ QIcon::QIcon(const QPixmap &pixmap) */ QIcon::QIcon(const QIcon &other) :d(other.d) -{} +{ + if (d) + d->ref.ref(); +} /*! Constructs an icon from the file with the given \a fileName. The @@ -600,7 +594,10 @@ QIcon::QIcon(QIconEngineV2 *engine) Destroys the icon. */ QIcon::~QIcon() -{} +{ + if (d && !d->ref.deref()) + delete d; +} /*! Assigns the \a other icon to this icon and returns a reference to @@ -608,6 +605,10 @@ QIcon::~QIcon() */ QIcon &QIcon::operator=(const QIcon &other) { + if (other.d) + other.d->ref.ref(); + if (d && !d->ref.deref()) + delete d; d = other.d; return *this; } @@ -775,6 +776,8 @@ void QIcon::detach() x->v1RefCount->ref(); } x->engine_version = d->engine_version; + if (!d->ref.deref()) + delete d; d = x; } ++d->detach_no; @@ -1148,100 +1151,6 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon) #endif //QT_NO_DATASTREAM - -#ifdef QT3_SUPPORT - -static int widths[2] = { 22, 32 }; -static int heights[2] = { 22, 32 }; - -static QSize pixmapSizeHelper(QIcon::Size which) -{ - int i = 0; - if (which == QIcon::Large) - i = 1; - return QSize(widths[i], heights[i]); -} - -/*! - \enum QIcon::Size - \compat - - \value Small Use QStyle::pixelMetric(QStyle::PM_SmallIconSize) instead. - \value Large Use QStyle::pixelMetric(QStyle::PM_LargeIconSize) instead. - \value Automatic N/A. -*/ - -/*! - Use pixmap(QSize(...), \a mode, \a state), where the first - argument is an appropriate QSize instead of a \l Size value. - - \sa pixmapSize() -*/ -QPixmap QIcon::pixmap(Size size, Mode mode, State state) const -{ return pixmap(pixmapSizeHelper(size), mode, state); } - -/*! - Use pixmap(QSize(...), mode, \a state), where the first argument - is an appropriate QSize instead of a \l Size value, and the - second argument is QIcon::Normal or QIcon::Disabled, depending on - the value of \a enabled. - - \sa pixmapSize() -*/ -QPixmap QIcon::pixmap(Size size, bool enabled, State state) const -{ return pixmap(pixmapSizeHelper(size), enabled ? Normal : Disabled, state); } - -/*! - Use one of the other pixmap() overloads. -*/ -QPixmap QIcon::pixmap() const -{ return pixmap(pixmapSizeHelper(Small), Normal, Off); } - -/*! - The pixmap() function now takes a QSize instead of a QIcon::Size, - so there is no need for this function in new code. -*/ -void QIcon::setPixmapSize(Size which, const QSize &size) -{ - int i = 0; - if (which == Large) - i = 1; - widths[i] = size.width(); - heights[i] = size.height(); -} - -/*! - Use QStyle::pixelMetric() with QStyle::PM_SmallIconSize or - QStyle::PM_LargeIconSize as the first argument, depending on \a - which. -*/ -QSize QIcon::pixmapSize(Size which) -{ - return pixmapSizeHelper(which); -} - -/*! - \fn void QIcon::reset(const QPixmap &pixmap, Size size) - - Use the constructor that takes a QPixmap and operator=(). -*/ - -/*! - \fn void QIcon::setPixmap(const QPixmap &pixmap, Size size, Mode mode, State state) - - Use addPixmap(\a pixmap, \a mode, \a state) instead. The \a size - parameter is ignored. -*/ - -/*! - \fn void QIcon::setPixmap(const QString &fileName, Size size, Mode mode, State state) - - Use addFile(\a fileName, \a mode, \a state) instead. The \a size - parameter is ignored. -*/ - -#endif // QT3_SUPPORT - /*! \fn DataPtr &QIcon::data_ptr() \internal diff --git a/src/gui/image/qicon.h b/src/widgets/kernel/qicon.h similarity index 77% rename from src/gui/image/qicon.h rename to src/widgets/kernel/qicon.h index eb14384f787..3c527eb9741 100644 --- a/src/gui/image/qicon.h +++ b/src/widgets/kernel/qicon.h @@ -57,7 +57,7 @@ class QIconPrivate; class QIconEngine; class QIconEngineV2; -class Q_GUI_EXPORT QIcon +class Q_WIDGETS_EXPORT QIcon { public: enum Mode { Normal, Disabled, Active, Selected }; @@ -114,32 +114,17 @@ public: static QString themeName(); static void setThemeName(const QString &path); - -#ifdef QT3_SUPPORT - enum Size { Small, Large, Automatic = Small }; - static QT3_SUPPORT void setPixmapSize(Size which, const QSize &size); - static QT3_SUPPORT QSize pixmapSize(Size which); - inline QT3_SUPPORT void reset(const QPixmap &pixmap, Size /*size*/) { *this = QIcon(pixmap); } - inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap, Size, Mode mode = Normal, State state = Off) - { addPixmap(pixmap, mode, state); } - inline QT3_SUPPORT void setPixmap(const QString &fileName, Size, Mode mode = Normal, State state = Off) - { addPixmap(QPixmap(fileName), mode, state); } - QT3_SUPPORT QPixmap pixmap(Size size, Mode mode, State state = Off) const; - QT3_SUPPORT QPixmap pixmap(Size size, bool enabled, State state = Off) const; - QT3_SUPPORT QPixmap pixmap() const; -#endif - Q_DUMMY_COMPARISON_OPERATOR(QIcon) private: - QExplicitlySharedDataPointer<QIconPrivate> d; + QIconPrivate *d; #if !defined(QT_NO_DATASTREAM) - friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &); - friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &); + friend Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &); + friend Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QIcon &); #endif public: - typedef QExplicitlySharedDataPointer<QIconPrivate> DataPtr; + typedef QIconPrivate * DataPtr; inline DataPtr &data_ptr() { return d; } }; @@ -147,12 +132,8 @@ Q_DECLARE_SHARED(QIcon) Q_DECLARE_TYPEINFO(QIcon, Q_MOVABLE_TYPE); #if !defined(QT_NO_DATASTREAM) -Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &); -Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &); -#endif - -#ifdef QT3_SUPPORT -typedef QIcon QIconSet; +Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &); +Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QIcon &); #endif QT_END_NAMESPACE diff --git a/src/gui/image/qicon_p.h b/src/widgets/kernel/qicon_p.h similarity index 97% rename from src/gui/image/qicon_p.h rename to src/widgets/kernel/qicon_p.h index c5b4bb0ba71..7ba471b002b 100644 --- a/src/gui/image/qicon_p.h +++ b/src/widgets/kernel/qicon_p.h @@ -57,13 +57,13 @@ #include <QtCore/qsize.h> #include <QtCore/qlist.h> #include <QtGui/qpixmap.h> -#include <QtGui/qicon.h> -#include <QtGui/qiconengine.h> +#include <QtWidgets/qicon.h> +#include <QtWidgets/qiconengine.h> #ifndef QT_NO_ICON QT_BEGIN_NAMESPACE -class QIconPrivate : public QSharedData +class QIconPrivate { public: QIconPrivate(); @@ -81,6 +81,7 @@ public: QIconEngine *engine; + QAtomicInt ref; int serialNum; int detach_no; int engine_version; diff --git a/src/gui/image/qiconengine.cpp b/src/widgets/kernel/qiconengine.cpp similarity index 100% rename from src/gui/image/qiconengine.cpp rename to src/widgets/kernel/qiconengine.cpp diff --git a/src/gui/image/qiconengine.h b/src/widgets/kernel/qiconengine.h similarity index 96% rename from src/gui/image/qiconengine.h rename to src/widgets/kernel/qiconengine.h index bfdce557ff0..63cfcbff5ee 100644 --- a/src/gui/image/qiconengine.h +++ b/src/widgets/kernel/qiconengine.h @@ -44,7 +44,7 @@ #include <QtCore/qglobal.h> #include <QtCore/qlist.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qicon.h> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QIconEngine +class Q_WIDGETS_EXPORT QIconEngine { public: virtual ~QIconEngine(); @@ -70,7 +70,7 @@ public: }; // ### Qt 5: move the below into QIconEngine -class Q_GUI_EXPORT QIconEngineV2 : public QIconEngine +class Q_WIDGETS_EXPORT QIconEngineV2 : public QIconEngine { public: virtual QString key() const; diff --git a/src/gui/image/qiconengineplugin.cpp b/src/widgets/kernel/qiconengineplugin.cpp similarity index 100% rename from src/gui/image/qiconengineplugin.cpp rename to src/widgets/kernel/qiconengineplugin.cpp diff --git a/src/gui/image/qiconengineplugin.h b/src/widgets/kernel/qiconengineplugin.h similarity index 89% rename from src/gui/image/qiconengineplugin.h rename to src/widgets/kernel/qiconengineplugin.h index 8e744b4e9c7..c228e8666bd 100644 --- a/src/gui/image/qiconengineplugin.h +++ b/src/widgets/kernel/qiconengineplugin.h @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QIconEngine; class QIconEngineV2; -struct Q_GUI_EXPORT QIconEngineFactoryInterface : public QFactoryInterface +struct Q_WIDGETS_EXPORT QIconEngineFactoryInterface : public QFactoryInterface { virtual QIconEngine *create(const QString &filename) = 0; }; @@ -63,7 +63,7 @@ struct Q_GUI_EXPORT QIconEngineFactoryInterface : public QFactoryInterface "com.trolltech.Qt.QIconEngineFactoryInterface" Q_DECLARE_INTERFACE(QIconEngineFactoryInterface, QIconEngineFactoryInterface_iid) -class Q_GUI_EXPORT QIconEnginePlugin : public QObject, public QIconEngineFactoryInterface +class Q_WIDGETS_EXPORT QIconEnginePlugin : public QObject, public QIconEngineFactoryInterface { Q_OBJECT Q_INTERFACES(QIconEngineFactoryInterface:QFactoryInterface) @@ -76,7 +76,7 @@ public: }; // ### Qt 5: remove version 2 -struct Q_GUI_EXPORT QIconEngineFactoryInterfaceV2 : public QFactoryInterface +struct Q_WIDGETS_EXPORT QIconEngineFactoryInterfaceV2 : public QFactoryInterface { virtual QIconEngineV2 *create(const QString &filename = QString()) = 0; }; @@ -85,7 +85,7 @@ struct Q_GUI_EXPORT QIconEngineFactoryInterfaceV2 : public QFactoryInterface "com.trolltech.Qt.QIconEngineFactoryInterfaceV2" Q_DECLARE_INTERFACE(QIconEngineFactoryInterfaceV2, QIconEngineFactoryInterfaceV2_iid) -class Q_GUI_EXPORT QIconEnginePluginV2 : public QObject, public QIconEngineFactoryInterfaceV2 +class Q_WIDGETS_EXPORT QIconEnginePluginV2 : public QObject, public QIconEngineFactoryInterfaceV2 { Q_OBJECT Q_INTERFACES(QIconEngineFactoryInterfaceV2:QFactoryInterface) diff --git a/src/gui/image/qiconloader.cpp b/src/widgets/kernel/qiconloader.cpp similarity index 98% rename from src/gui/image/qiconloader.cpp rename to src/widgets/kernel/qiconloader.cpp index e63043bf09e..45959c03ef2 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/widgets/kernel/qiconloader.cpp @@ -41,14 +41,14 @@ #ifndef QT_NO_ICON #include <private/qiconloader_p.h> -#include <private/qapplication_p.h> +#include <private/qguiapplication_p.h> #include <private/qicon_p.h> #include <private/qguiplatformplugin_p.h> -#include <QtGui/QIconEnginePlugin> +#include <QtWidgets/QIconEnginePlugin> #include <QtGui/QPixmapCache> -#include <QtGui/QIconEngine> -#include <QtGui/QStyleOption> +#include <QtWidgets/QIconEngine> +#include <QtWidgets/QStyleOption> #include <QtCore/QList> #include <QtCore/QHash> #include <QtCore/QDir> @@ -63,7 +63,7 @@ #include <private/qt_x11_p.h> #endif -#include <private/qstylehelper_p.h> +#include <private/qhexstring_p.h> QT_BEGIN_NAMESPACE @@ -489,8 +489,8 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st if (basePixmap.isNull()) basePixmap.load(filename); +#if 0 // ### Qt5 int actualSize = qMin(size.width(), size.height()); - QString key = QLatin1Literal("$qt_theme_") % HexString<qint64>(basePixmap.cacheKey()) % HexString<int>(mode) @@ -507,6 +507,9 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st QPixmapCache::insert(key, cachedPixmap); } return cachedPixmap; +#else + return basePixmap; +#endif } QPixmap ScalableEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) diff --git a/src/gui/image/qiconloader_p.h b/src/widgets/kernel/qiconloader_p.h similarity index 98% rename from src/gui/image/qiconloader_p.h rename to src/widgets/kernel/qiconloader_p.h index caa01586285..1c6c0cb1a5e 100644 --- a/src/gui/image/qiconloader_p.h +++ b/src/widgets/kernel/qiconloader_p.h @@ -54,8 +54,8 @@ // We mean it. // -#include <QtGui/QIcon> -#include <QtGui/QIconEngine> +#include <QtWidgets/QIcon> +#include <QtWidgets/QIconEngine> #include <QtGui/QPixmapCache> #include <private/qicon_p.h> #include <private/qfactoryloader_p.h> diff --git a/src/gui/inputmethod/qinputcontext.cpp b/src/widgets/kernel/qinputcontext.cpp similarity index 73% rename from src/gui/inputmethod/qinputcontext.cpp rename to src/widgets/kernel/qinputcontext.cpp index e461df59af9..05ed9369f64 100644 --- a/src/gui/inputmethod/qinputcontext.cpp +++ b/src/widgets/kernel/qinputcontext.cpp @@ -56,7 +56,6 @@ //#define QT_NO_IM_PREEDIT_RELOCATION #include "qinputcontext.h" -#include "qinputcontext_p.h" #ifndef QT_NO_IM @@ -66,6 +65,8 @@ #include "qmenu.h" #include "qtextformat.h" #include "qpalette.h" +#include <QtGui/qinputpanel.h> +#include <QtGui/qevent.h> #include <stdlib.h> #include <limits.h> @@ -143,7 +144,7 @@ QT_BEGIN_NAMESPACE Constructs an input context with the given \a parent. */ QInputContext::QInputContext(QObject* parent) - : QObject(*new QInputContextPrivate, parent) + : QObject(parent) { } @@ -170,8 +171,7 @@ QInputContext::~QInputContext() */ QWidget *QInputContext::focusWidget() const { - Q_D(const QInputContext); - return d->focusWidget; + return qobject_cast<QWidget *>(qApp->inputPanel()->inputItem()); } @@ -185,13 +185,12 @@ QWidget *QInputContext::focusWidget() const */ void QInputContext::setFocusWidget(QWidget *widget) { - Q_ASSERT(!widget || widget->testAttribute(Qt::WA_InputMethodEnabled)); - Q_D(QInputContext); - d->focusWidget = widget; + qApp->inputPanel()->setInputItem(widget); } /*! \fn bool QInputContext::isComposing() const + \obsolete This function indicates whether InputMethodStart event had been sent to the current focus widget. It is ensured that an input @@ -203,50 +202,6 @@ void QInputContext::setFocusWidget(QWidget *widget) \sa sendEvent() */ -/*! - This function can be reimplemented in a subclass to filter input - events. - - Return true if the \a event has been consumed. Otherwise, the - unfiltered \a event will be forwarded to widgets as ordinary - way. Although the input events have accept() and ignore() - methods, leave it untouched. - - \a event is currently restricted to events of these types: - - \list - \i CloseSoftwareInputPanel - \i KeyPress - \i KeyRelease - \i MouseButtonDblClick - \i MouseButtonPress - \i MouseButtonRelease - \i MouseMove - \i RequestSoftwareInputPanel - \endlist - - But some input method related events such as QWheelEvent or - QTabletEvent may be added in future. - - The filtering opportunity is always given to the input context as - soon as possible. It has to be taken place before any other key - event consumers such as eventfilters and accelerators because some - input methods require quite various key combination and - sequences. It often conflicts with accelerators and so on, so we - must give the input context the filtering opportunity first to - ensure all input methods work properly regardless of application - design. - - Ordinary input methods require discrete key events to work - properly, so Qt's key compression is always disabled for any input - contexts. - - \sa QKeyEvent, x11FilterEvent() -*/ -bool QInputContext::filterEvent(const QEvent * /*event*/) -{ - return false; -} /*! Sends an input method event specified by \a event to the current focus @@ -265,14 +220,8 @@ bool QInputContext::filterEvent(const QEvent * /*event*/) */ void QInputContext::sendEvent(const QInputMethodEvent &event) { - // route events over input context parents to make chaining possible. - QInputContext *p = qobject_cast<QInputContext *>(parent()); - if (p) { - p->sendEvent(event); - return; - } - QWidget *focus = focusWidget(); + QObject *focus = qApp->inputPanel()->inputItem(); if (!focus) return; @@ -298,12 +247,10 @@ void QInputContext::sendEvent(const QInputMethodEvent &event) QEvent::MouseMove. The event's button and state indicate the kind of operation that was performed. */ -void QInputContext::mouseHandler(int /*x*/, QMouseEvent *event) +void QInputContext::mouseHandler(int x, QMouseEvent *event) { - // Default behavior for simple ephemeral input contexts. Some - // complex input contexts should not be reset here. - if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick) - reset(); + if (event->type() == QEvent::MouseButtonRelease) + qApp->inputPanel()->invokeAction(QInputPanel::Click, x); } @@ -312,11 +259,11 @@ void QInputContext::mouseHandler(int /*x*/, QMouseEvent *event) */ QFont QInputContext::font() const { - Q_D(const QInputContext); - if (!d->focusWidget) + QWidget *focus = focusWidget(); + if (!focus) return QApplication::font(); - return qvariant_cast<QFont>(d->focusWidget->inputMethodQuery(Qt::ImFont)); + return qvariant_cast<QFont>(focus->inputMethodQuery(Qt::ImFont)); } /*! @@ -326,6 +273,7 @@ QFont QInputContext::font() const */ void QInputContext::update() { + qApp->inputPanel()->update(Qt::ImQueryAll); } /*! @@ -335,9 +283,7 @@ void QInputContext::update() */ void QInputContext::widgetDestroyed(QWidget *widget) { - Q_D(QInputContext); - if (widget == d->focusWidget) - setFocusWidget(0); + // nothing to be done here, as we use a weak pointer in the input panel } /*! @@ -360,6 +306,10 @@ void QInputContext::widgetDestroyed(QWidget *widget) string and attributes; otherwise, you risk breaking input state consistency. */ +void QInputContext::reset() +{ + qApp->inputPanel()->reset(); +} /*! @@ -380,6 +330,10 @@ void QInputContext::widgetDestroyed(QWidget *widget) \sa QInputContextPlugin::keys(), QInputContextPlugin::displayName() */ +QString QInputContext::identifierName() +{ + return QLatin1String("qpa"); +} /*! @@ -398,6 +352,10 @@ void QInputContext::widgetDestroyed(QWidget *widget) (that automatically modifies fonts in CJK-mixed text) and XML editor (that automatically inserts lang attr). */ +QString QInputContext::language() +{ + return QString(); +} /*! @@ -443,58 +401,6 @@ QTextFormat QInputContext::standardFormat(StandardFormat s) const return fmt; } -#ifdef Q_WS_X11 -/*! - This function may be overridden only if input method is depending - on X11 and you need raw XEvent. Otherwise, this function must not. - - This function is designed to filter raw key events for XIM, but - other input methods may use this to implement some special - features such as distinguishing Shift_L and Shift_R. - - Return true if the \a event has been consumed. Otherwise, the - unfiltered \a event will be translated into QEvent and forwarded - to filterEvent(). Filtering at both x11FilterEvent() and - filterEvent() in single input method is allowed. - - \a keywidget is a client widget into which a text is inputted. \a - event is inputted XEvent. - - \sa filterEvent() -*/ -bool QInputContext::x11FilterEvent(QWidget * /*keywidget*/, XEvent * /*event*/) -{ - return false; -} -#endif // Q_WS_X11 - -#ifdef Q_OS_SYMBIAN -/*! - \since 4.6 - - This function may be overridden only if input method is depending - on Symbian and you need raw Symbian events. Otherwise, this function must not. - - This function is designed to filter raw key events on Symbian, but - other input methods may use this to implement some special - features. - - Return true if the \a event has been consumed. Otherwise, the - unfiltered \a event will be translated into QEvent and forwarded - to filterEvent(). Filtering at both symbianFilterEvent() and - filterEvent() in single input method is allowed. - - \a keywidget is a client widget into which a text is inputted. \a - event is inputted QSymbianEvent. - - \sa filterEvent() -*/ -bool QInputContext::symbianFilterEvent(QWidget * /*keywidget*/, const QSymbianEvent * /*event*/) -{ - return false; -} -#endif // Q_OS_SYMBIAN - QT_END_NAMESPACE #endif //Q_NO_IM diff --git a/src/gui/inputmethod/qinputcontext.h b/src/widgets/kernel/qinputcontext.h similarity index 86% rename from src/gui/inputmethod/qinputcontext.h rename to src/widgets/kernel/qinputcontext.h index 04f1baf3c54..4864c5aea6d 100644 --- a/src/gui/inputmethod/qinputcontext.h +++ b/src/widgets/kernel/qinputcontext.h @@ -61,7 +61,7 @@ #include <QtGui/qevent.h> #include <QtCore/qstring.h> #include <QtCore/qlist.h> -#include <QtGui/qaction.h> +#include <QtWidgets/qaction.h> #ifndef QT_NO_IM @@ -79,23 +79,21 @@ class QInputContextPrivate; class QSymbianEvent; #endif -class Q_GUI_EXPORT QInputContext : public QObject +class Q_WIDGETS_EXPORT QInputContext : public QObject { Q_OBJECT - Q_DECLARE_PRIVATE(QInputContext) public: explicit QInputContext(QObject* parent = 0); virtual ~QInputContext(); - virtual QString identifierName() = 0; - virtual QString language() = 0; + virtual QString identifierName(); + virtual QString language(); - virtual void reset() = 0; + virtual void reset(); virtual void update(); virtual void mouseHandler( int x, QMouseEvent *event); virtual QFont font() const; - virtual bool isComposing() const = 0; QWidget *focusWidget() const; virtual void setFocusWidget( QWidget *w ); @@ -104,16 +102,10 @@ public: virtual QList<QAction *> actions(); -#if defined(Q_WS_X11) - virtual bool x11FilterEvent( QWidget *keywidget, XEvent *event ); -#endif // Q_WS_X11 -#if defined(Q_OS_SYMBIAN) - virtual bool symbianFilterEvent( QWidget *keywidget, const QSymbianEvent *event ); -#endif // Q_OS_SYMBIAN - virtual bool filterEvent( const QEvent *event ); - void sendEvent(const QInputMethodEvent &event); + virtual bool isComposing() const { return false; } + enum StandardFormat { PreeditFormat, SelectionFormat diff --git a/src/gui/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp similarity index 100% rename from src/gui/kernel/qlayout.cpp rename to src/widgets/kernel/qlayout.cpp diff --git a/src/gui/kernel/qlayout.h b/src/widgets/kernel/qlayout.h similarity index 96% rename from src/gui/kernel/qlayout.h rename to src/widgets/kernel/qlayout.h index 1a98606d35c..d9f732bd140 100644 --- a/src/gui/kernel/qlayout.h +++ b/src/widgets/kernel/qlayout.h @@ -43,8 +43,8 @@ #define QLAYOUT_H #include <QtCore/qobject.h> -#include <QtGui/qlayoutitem.h> -#include <QtGui/qsizepolicy.h> +#include <QtWidgets/qlayoutitem.h> +#include <QtWidgets/qsizepolicy.h> #include <QtCore/qrect.h> #include <QtCore/qmargins.h> @@ -60,7 +60,7 @@ class QLayout; class QSize; #ifdef QT3_SUPPORT -class Q_GUI_EXPORT QLayoutIterator +class Q_WIDGETS_EXPORT QLayoutIterator { public: inline QT3_SUPPORT_CONSTRUCTOR QLayoutIterator(QLayout *i) : layout(i), index(0) {} @@ -87,7 +87,7 @@ private: class QLayoutPrivate; -class Q_GUI_EXPORT QLayout : public QObject, public QLayoutItem +class Q_WIDGETS_EXPORT QLayout : public QObject, public QLayoutItem { Q_OBJECT Q_DECLARE_PRIVATE(QLayout) @@ -233,8 +233,8 @@ inline void QLayoutIterator::deleteCurrent() { delete layout->takeAt(index); } //### support old includes #if 1 //def QT3_SUPPORT QT_BEGIN_INCLUDE_NAMESPACE -#include <QtGui/qboxlayout.h> -#include <QtGui/qgridlayout.h> +#include <QtWidgets/qboxlayout.h> +#include <QtWidgets/qgridlayout.h> QT_END_INCLUDE_NAMESPACE #endif diff --git a/src/gui/kernel/qlayout_p.h b/src/widgets/kernel/qlayout_p.h similarity index 98% rename from src/gui/kernel/qlayout_p.h rename to src/widgets/kernel/qlayout_p.h index 9e8d9cd3551..e282360418f 100644 --- a/src/gui/kernel/qlayout_p.h +++ b/src/widgets/kernel/qlayout_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QWidgetItem; class QSpacerItem; -class Q_GUI_EXPORT QLayoutPrivate : public QObjectPrivate +class Q_WIDGETS_EXPORT QLayoutPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QLayout) diff --git a/src/gui/kernel/qlayoutengine.cpp b/src/widgets/kernel/qlayoutengine.cpp similarity index 96% rename from src/gui/kernel/qlayoutengine.cpp rename to src/widgets/kernel/qlayoutengine.cpp index a93661737d6..a7470aabaa8 100644 --- a/src/gui/kernel/qlayoutengine.cpp +++ b/src/widgets/kernel/qlayoutengine.cpp @@ -338,7 +338,7 @@ void qGeomCalc(QVector<QLayoutStruct> &chain, int start, int count, #endif } -Q_GUI_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, +Q_WIDGETS_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy) { @@ -368,7 +368,7 @@ Q_GUI_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint return s.expandedTo(QSize(0,0)); } -Q_GUI_EXPORT QSize qSmartMinSize(const QWidgetItem *i) +Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidgetItem *i) { QWidget *w = ((QWidgetItem *)i)->widget(); return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), @@ -376,14 +376,14 @@ Q_GUI_EXPORT QSize qSmartMinSize(const QWidgetItem *i) w->sizePolicy()); } -Q_GUI_EXPORT QSize qSmartMinSize(const QWidget *w) +Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidget *w) { return qSmartMinSize(w->sizeHint(), w->minimumSizeHint(), w->minimumSize(), w->maximumSize(), w->sizePolicy()); } -Q_GUI_EXPORT QSize qSmartMaxSize(const QSize &sizeHint, +Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QSize &sizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy, Qt::Alignment align) { @@ -406,7 +406,7 @@ Q_GUI_EXPORT QSize qSmartMaxSize(const QSize &sizeHint, return s; } -Q_GUI_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align) +Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align) { QWidget *w = ((QWidgetItem*)i)->widget(); @@ -414,13 +414,13 @@ Q_GUI_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align) w->sizePolicy(), align); } -Q_GUI_EXPORT QSize qSmartMaxSize(const QWidget *w, Qt::Alignment align) +Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidget *w, Qt::Alignment align) { return qSmartMaxSize(w->sizeHint().expandedTo(w->minimumSizeHint()), w->minimumSize(), w->maximumSize(), w->sizePolicy(), align); } -Q_GUI_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm) +Q_WIDGETS_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm) { QObject *parent = layout->parent(); if (!parent) { diff --git a/src/gui/kernel/qlayoutengine_p.h b/src/widgets/kernel/qlayoutengine_p.h similarity index 85% rename from src/gui/kernel/qlayoutengine_p.h rename to src/widgets/kernel/qlayoutengine_p.h index 8a2ea110e9b..9be9ecd3215 100644 --- a/src/gui/kernel/qlayoutengine_p.h +++ b/src/widgets/kernel/qlayoutengine_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "QtGui/qlayoutitem.h" -#include "QtGui/qstyle.h" +#include "QtWidgets/qlayoutitem.h" +#include "QtWidgets/qstyle.h" QT_BEGIN_NAMESPACE @@ -97,20 +97,20 @@ struct QLayoutStruct }; -Q_GUI_EXPORT void qGeomCalc(QVector<QLayoutStruct> &chain, int start, int count, +Q_WIDGETS_EXPORT void qGeomCalc(QVector<QLayoutStruct> &chain, int start, int count, int pos, int space, int spacer = -1); -Q_GUI_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, +Q_WIDGETS_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy); -Q_GUI_EXPORT QSize qSmartMinSize(const QWidgetItem *i); -Q_GUI_EXPORT QSize qSmartMinSize(const QWidget *w); -Q_GUI_EXPORT QSize qSmartMaxSize(const QSize &sizeHint, +Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidgetItem *i); +Q_WIDGETS_EXPORT QSize qSmartMinSize(const QWidget *w); +Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QSize &sizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy, Qt::Alignment align = 0); -Q_GUI_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align = 0); -Q_GUI_EXPORT QSize qSmartMaxSize(const QWidget *w, Qt::Alignment align = 0); +Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidgetItem *i, Qt::Alignment align = 0); +Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QWidget *w, Qt::Alignment align = 0); -Q_GUI_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm); +Q_WIDGETS_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm); /* Modify total maximum (max), total expansion (exp), and total empty diff --git a/src/gui/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp similarity index 100% rename from src/gui/kernel/qlayoutitem.cpp rename to src/widgets/kernel/qlayoutitem.cpp diff --git a/src/gui/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h similarity index 95% rename from src/gui/kernel/qlayoutitem.h rename to src/widgets/kernel/qlayoutitem.h index eff87e50044..d03f77654be 100644 --- a/src/gui/kernel/qlayoutitem.h +++ b/src/widgets/kernel/qlayoutitem.h @@ -42,7 +42,7 @@ #ifndef QLAYOUTITEM_H #define QLAYOUTITEM_H -#include <QtGui/qsizepolicy.h> +#include <QtWidgets/qsizepolicy.h> #include <QtCore/qrect.h> #include <limits.h> @@ -61,7 +61,7 @@ class QSpacerItem; class QWidget; class QSize; -class Q_GUI_EXPORT QLayoutItem +class Q_WIDGETS_EXPORT QLayoutItem { public: inline explicit QLayoutItem(Qt::Alignment alignment = 0); @@ -93,7 +93,7 @@ protected: inline QLayoutItem::QLayoutItem(Qt::Alignment aalignment) : align(aalignment) { } -class Q_GUI_EXPORT QSpacerItem : public QLayoutItem +class Q_WIDGETS_EXPORT QSpacerItem : public QLayoutItem { public: QSpacerItem(int w, int h, @@ -119,7 +119,7 @@ private: QRect rect; }; -class Q_GUI_EXPORT QWidgetItem : public QLayoutItem +class Q_WIDGETS_EXPORT QWidgetItem : public QLayoutItem { Q_DISABLE_COPY(QWidgetItem) @@ -141,7 +141,7 @@ protected: QWidget *wid; }; -class Q_GUI_EXPORT QWidgetItemV2 : public QWidgetItem +class Q_WIDGETS_EXPORT QWidgetItemV2 : public QWidgetItem { public: explicit QWidgetItemV2(QWidget *widget); diff --git a/src/widgets/kernel/qplatformmenu_qpa.cpp b/src/widgets/kernel/qplatformmenu_qpa.cpp new file mode 100644 index 00000000000..57c2613079e --- /dev/null +++ b/src/widgets/kernel/qplatformmenu_qpa.cpp @@ -0,0 +1,51 @@ +#include "qplatformmenu_qpa.h" + +// +// QPlatformMenuAction +// + +QPlatformMenuAction::~QPlatformMenuAction() +{ + +} + +// +// QPlatformMenu +// +QPlatformMenu::QPlatformMenu() +{ +} + +QPlatformMenu::~QPlatformMenu() +{ + +} + +void QPlatformMenu::setMenuEnabled(bool enable) +{ + Q_UNUSED(enable); +} + +void QPlatformMenu::syncSeparatorsCollapsible(bool enable) +{ + Q_UNUSED(enable); +} + +// +// QPlatformMenuBar +// +QPlatformMenuBar::QPlatformMenuBar() +{ + +} + +QPlatformMenuBar::~QPlatformMenuBar() +{ + +} + +void QPlatformMenuBar::handleReparent(QWidget *newParent) +{ + Q_UNUSED(newParent); +} + diff --git a/src/widgets/kernel/qplatformmenu_qpa.h b/src/widgets/kernel/qplatformmenu_qpa.h new file mode 100644 index 00000000000..e3b816c9fe4 --- /dev/null +++ b/src/widgets/kernel/qplatformmenu_qpa.h @@ -0,0 +1,88 @@ +/**************************************************************************** + ** + ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (qt-info@nokia.com) + ** + ** This file is part of the QtGui module of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** GNU Lesser General Public License Usage + ** This file may be used under the terms of the GNU Lesser General Public + ** License version 2.1 as published by the Free Software Foundation and + ** appearing in the file LICENSE.LGPL included in the packaging of this + ** file. Please review the following information to ensure the GNU Lesser + ** General Public License version 2.1 requirements will be met: + ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Nokia gives you certain additional + ** rights. These rights are described in the Nokia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** GNU General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU General + ** Public License version 3.0 as published by the Free Software Foundation + ** and appearing in the file LICENSE.GPL included in the packaging of this + ** file. Please review the following information to ensure the GNU General + ** Public License version 3.0 requirements will be met: + ** http://www.gnu.org/copyleft/gpl.html. + ** + ** Other Usage + ** Alternatively, this file may be used in accordance with the terms and + ** conditions contained in a signed written agreement between you and Nokia. + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#ifndef QPLATFORMMENU_H +#define QPLATFORMMENU_H + +#include <qglobal.h> +#include <qpointer.h> +#include <QtWidgets/qaction.h> + +QT_BEGIN_NAMESPACE + +class QMenuPrivate; +class Q_WIDGETS_EXPORT QPlatformMenuAction +{ +public: + virtual ~QPlatformMenuAction(); + QPointer<QAction> action; +}; + +class Q_WIDGETS_EXPORT QPlatformMenu { +public: + QPlatformMenu(); + virtual ~QPlatformMenu(); + + virtual bool merged(const QAction *action) const = 0; + + virtual void addAction(QAction *action, QAction *before) = 0; + virtual void removeAction(QAction *action) = 0; + virtual void syncAction(QAction *action) = 0; + + virtual void setMenuEnabled(bool enable); + virtual void syncSeparatorsCollapsible(bool enable); +}; + +struct Q_WIDGETS_EXPORT QPlatformMenuBar { + QPlatformMenuBar(); + virtual ~QPlatformMenuBar(); + + virtual void addAction(QAction *action, QAction *before = 0) = 0; + virtual void syncAction(QAction *action) = 0; + virtual void removeAction(QAction *action) = 0; + + virtual void handleReparent(QWidget *newParent); +}; + +QT_END_NAMESPACE + +#endif + diff --git a/src/gui/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h similarity index 95% rename from src/gui/kernel/qsizepolicy.h rename to src/widgets/kernel/qsizepolicy.h index bd92a91d58c..76067604f93 100644 --- a/src/gui/kernel/qsizepolicy.h +++ b/src/widgets/kernel/qsizepolicy.h @@ -52,7 +52,7 @@ QT_MODULE(Gui) class QVariant; -class Q_GUI_EXPORT QSizePolicy +class Q_WIDGETS_EXPORT QSizePolicy { Q_GADGET Q_ENUMS(Policy) @@ -196,8 +196,8 @@ public: private: #ifndef QT_NO_DATASTREAM - friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &); - friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &); + friend Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &); + friend Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &); #endif QSizePolicy(int i) : data(i) { } @@ -222,8 +222,8 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes) #ifndef QT_NO_DATASTREAM // implemented in qlayout.cpp -Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &); -Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &); +Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &); +Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &); #endif inline void QSizePolicy::transpose() { diff --git a/src/gui/kernel/qsizepolicy.qdoc b/src/widgets/kernel/qsizepolicy.qdoc similarity index 100% rename from src/gui/kernel/qsizepolicy.qdoc rename to src/widgets/kernel/qsizepolicy.qdoc diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/widgets/kernel/qsoftkeymanager.cpp similarity index 100% rename from src/gui/kernel/qsoftkeymanager.cpp rename to src/widgets/kernel/qsoftkeymanager.cpp diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/widgets/kernel/qsoftkeymanager_common_p.h similarity index 100% rename from src/gui/kernel/qsoftkeymanager_common_p.h rename to src/widgets/kernel/qsoftkeymanager_common_p.h diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/widgets/kernel/qsoftkeymanager_p.h similarity index 99% rename from src/gui/kernel/qsoftkeymanager_p.h rename to src/widgets/kernel/qsoftkeymanager_p.h index 15c27e8fc76..d58b546d74f 100644 --- a/src/gui/kernel/qsoftkeymanager_p.h +++ b/src/widgets/kernel/qsoftkeymanager_p.h @@ -54,7 +54,7 @@ // #include <QtCore/qobject.h> -#include "QtGui/qaction.h" +#include "QtWidgets/qaction.h" QT_BEGIN_HEADER diff --git a/src/gui/kernel/qsound.cpp b/src/widgets/kernel/qsound.cpp similarity index 93% rename from src/gui/kernel/qsound.cpp rename to src/widgets/kernel/qsound.cpp index 7958f68c665..255ff5d86db 100644 --- a/src/gui/kernel/qsound.cpp +++ b/src/widgets/kernel/qsound.cpp @@ -189,29 +189,6 @@ QSound::QSound(const QString& filename, QObject* parent) server().init(this); } -#ifdef QT3_SUPPORT -/*! - \obsolete - - Constructs a QSound object from the file specified by the given \a - filename and with the given \a parent and \a name. Use the - QSound() construcor and QObject::setObjectName() instead. - - \oldcode - QSound *mySound = new QSound(filename, parent, name); - \newcode - QSounc *mySound = new QSound(filename, parent); - mySound->setObjectName(name); - \endcode -*/ -QSound::QSound(const QString& filename, QObject* parent, const char* name) - : QObject(*new QSoundPrivate(filename), parent) -{ - setObjectName(QString::fromAscii(name)); - server().init(this); -} -#endif - /*! Destroys this sound object. If the sound is not finished playing, the stop() function is called before the sound object is diff --git a/src/gui/kernel/qsound.h b/src/widgets/kernel/qsound.h similarity index 90% rename from src/gui/kernel/qsound.h rename to src/widgets/kernel/qsound.h index 368387c2aee..79fd241948d 100644 --- a/src/gui/kernel/qsound.h +++ b/src/widgets/kernel/qsound.h @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QSoundPrivate; -class Q_GUI_EXPORT QSound : public QObject +class Q_WIDGETS_EXPORT QSound : public QObject { Q_OBJECT @@ -76,11 +76,6 @@ public Q_SLOTS: void play(); void stop(); -public: -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QSound(const QString& filename, QObject* parent, const char* name); - static inline QT3_SUPPORT bool available() { return isAvailable(); } -#endif private: Q_DECLARE_PRIVATE(QSound) friend class QAuServer; diff --git a/src/gui/kernel/qsound_p.h b/src/widgets/kernel/qsound_p.h similarity index 100% rename from src/gui/kernel/qsound_p.h rename to src/widgets/kernel/qsound_p.h diff --git a/src/gui/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp similarity index 100% rename from src/gui/kernel/qstackedlayout.cpp rename to src/widgets/kernel/qstackedlayout.cpp diff --git a/src/gui/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h similarity index 97% rename from src/gui/kernel/qstackedlayout.h rename to src/widgets/kernel/qstackedlayout.h index 89bf26456dc..d895d139aba 100644 --- a/src/gui/kernel/qstackedlayout.h +++ b/src/widgets/kernel/qstackedlayout.h @@ -42,7 +42,7 @@ #ifndef QSTACKEDLAYOUT_H #define QSTACKEDLAYOUT_H -#include <QtGui/qlayout.h> +#include <QtWidgets/qlayout.h> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_MODULE(Gui) class QStackedLayoutPrivate; -class Q_GUI_EXPORT QStackedLayout : public QLayout +class Q_WIDGETS_EXPORT QStackedLayout : public QLayout { Q_OBJECT Q_DECLARE_PRIVATE(QStackedLayout) diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp similarity index 100% rename from src/gui/kernel/qstandardgestures.cpp rename to src/widgets/kernel/qstandardgestures.cpp diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/widgets/kernel/qstandardgestures_p.h similarity index 100% rename from src/gui/kernel/qstandardgestures_p.h rename to src/widgets/kernel/qstandardgestures_p.h diff --git a/src/gui/painting/qwindowsurface_mac_p.h b/src/widgets/kernel/qt_gui_pch.h similarity index 64% rename from src/gui/painting/qwindowsurface_mac_p.h rename to src/widgets/kernel/qt_gui_pch.h index 05571646ebc..012d92ce8c3 100644 --- a/src/gui/painting/qwindowsurface_mac_p.h +++ b/src/widgets/kernel/qt_gui_pch.h @@ -39,46 +39,47 @@ ** ****************************************************************************/ -#ifndef QWINDOWSURFACE_MAC_P_H -#define QWINDOWSURFACE_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. -// +/* + * This is a precompiled header file for use in Xcode / Mac GCC / + * GCC >= 3.4 / VC to greatly speed the building of Qt. It may also be + * of use to people developing their own project, but it is probably + * better to define your own header. Use of this header is currently + * UNSUPPORTED. + */ +// from corelib/global/qt_pch.h +#if defined __cplusplus #include <qglobal.h> -#include "private/qwindowsurface_p.h" -QT_BEGIN_NAMESPACE -class QPaintDevice; -class QPoint; -class QRegion; -class QWidget; -struct QMacWindowSurfacePrivate; +#ifdef Q_WS_WIN +# define _POSIX_ +# include <limits.h> +# undef _POSIX_ +#endif -class QMacWindowSurface : public QWindowSurface -{ -public: - QMacWindowSurface(QWidget *widget); - ~QMacWindowSurface(); +#include <qcoreapplication.h> +#include <qlist.h> +#include <qvariant.h> // All moc genereated code has this include +#include <qobject.h> +#include <qregexp.h> +#include <qstring.h> +#include <qstringlist.h> +#include <qtextcodec.h> - 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); +#include <qapplication.h> +#include <qbitmap.h> +#include <qcursor.h> +#include <qdesktopwidget.h> +#include <qevent.h> +#include <qimage.h> +#include <qlayout.h> +#include <qpainter.h> +#include <qpixmap.h> +#include <qstyle.h> +#include <qtimer.h> +#include <qwidget.h> -private: - QMacWindowSurfacePrivate *d_ptr; -}; +#include <stdlib.h> -QT_END_NAMESPACE - -#endif // QWINDOWSURFACE_MAC_P_H +#endif diff --git a/src/gui/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp similarity index 100% rename from src/gui/kernel/qtooltip.cpp rename to src/widgets/kernel/qtooltip.cpp diff --git a/src/gui/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h similarity index 97% rename from src/gui/kernel/qtooltip.h rename to src/widgets/kernel/qtooltip.h index 7c49711a1ce..52fb962edbc 100644 --- a/src/gui/kernel/qtooltip.h +++ b/src/widgets/kernel/qtooltip.h @@ -42,7 +42,7 @@ #ifndef QTOOLTIP_H #define QTOOLTIP_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_MODULE(Gui) #ifndef QT_NO_TOOLTIP -class Q_GUI_EXPORT QToolTip +class Q_WIDGETS_EXPORT QToolTip { QToolTip(); public: diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp similarity index 99% rename from src/gui/kernel/qwhatsthis.cpp rename to src/widgets/kernel/qwhatsthis.cpp index 5328cb1fd16..204a11a3eb4 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -53,7 +53,7 @@ #include "qcursor.h" #include "qbitmap.h" #include "qtextdocument.h" -#include "../text/qtextdocumentlayout_p.h" +#include "private/qtextdocumentlayout_p.h" #include "qtoolbutton.h" #include "qdebug.h" #ifndef QT_NO_ACCESSIBILITY diff --git a/src/gui/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h similarity index 98% rename from src/gui/kernel/qwhatsthis.h rename to src/widgets/kernel/qwhatsthis.h index 0028a32545b..b975b78e3e9 100644 --- a/src/gui/kernel/qwhatsthis.h +++ b/src/widgets/kernel/qwhatsthis.h @@ -58,7 +58,7 @@ class QAction; class QToolButton; #endif -class Q_GUI_EXPORT QWhatsThis +class Q_WIDGETS_EXPORT QWhatsThis { QWhatsThis(); diff --git a/src/gui/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp similarity index 97% rename from src/gui/kernel/qwidget.cpp rename to src/widgets/kernel/qwidget.cpp index 72ff5e9df2c..76544d2524a 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -70,14 +70,9 @@ # include "qtoolbar.h" # include <private/qmainwindowlayout_p.h> #endif -#if defined(Q_WS_QWS) -# include "qwsdisplay_qws.h" -# include "qwsmanager_qws.h" -# include "qpaintengine.h" // for PorterDuff -# include "private/qwindowsurface_qws_p.h" -#endif #if defined(Q_WS_QPA) #include "qplatformwindow_qpa.h" +#include "private/qwidgetwindow_qpa_p.h" #endif #include "qpainter.h" #include "qtooltip.h" @@ -85,22 +80,14 @@ #include "qdebug.h" #include "private/qstylesheetstyle_p.h" #include "private/qstyle_p.h" -#include "private/qinputcontext_p.h" +#include "qinputcontext.h" #include "qfileinfo.h" #include "private/qsoftkeymanager_p.h" - -#if defined (Q_WS_WIN) -# include <private/qwininputcontext_p.h> -#endif - -#if defined(Q_WS_X11) -# include <private/qpaintengine_x11_p.h> -# include "qx11info_x11.h" -#endif +#include <QtGui/qinputpanel.h> #include <private/qgraphicseffect_p.h> -#include <private/qwindowsurface_p.h> -#include <private/qbackingstore_p.h> +#include <qbackingstore.h> +#include <private/qwidgetbackingstore_p.h> #ifdef Q_WS_MAC # include <private/qpaintengine_mac_p.h> #endif @@ -113,14 +100,13 @@ #include "qwidget_p.h" #include "qaction_p.h" #include "qlayout_p.h" -#include "QtGui/qgraphicsproxywidget.h" -#include "QtGui/qgraphicsscene.h" +#include "QtWidgets/qgraphicsproxywidget.h" +#include "QtWidgets/qgraphicsscene.h" #include "private/qgraphicsproxywidget_p.h" -#include "QtGui/qabstractscrollarea.h" +#include "QtWidgets/qabstractscrollarea.h" #include "private/qabstractscrollarea_p.h" #include "private/qevent_p.h" -#include "private/qgraphicssystem_p.h" #include "private/qgesturemanager_p.h" #ifdef QT_KEYPAD_NAVIGATION @@ -137,12 +123,10 @@ QT_BEGIN_NAMESPACE -#if !defined(Q_WS_QWS) static bool qt_enable_backingstore = true; -#endif #ifdef Q_WS_X11 // for compatibility with Qt 4.0 -Q_GUI_EXPORT void qt_x11_set_global_double_buffer(bool enable) +Q_WIDGETS_EXPORT void qt_x11_set_global_double_buffer(bool enable) { qt_enable_backingstore = enable; } @@ -160,11 +144,7 @@ static inline bool qRectIntersects(const QRect &r1, const QRect &r2) static inline bool hasBackingStoreSupport() { -#ifdef Q_WS_MAC - return QApplicationPrivate::graphicsSystem() != 0; -#else return true; -#endif } #ifdef Q_WS_MAC @@ -356,34 +336,6 @@ QWidgetPrivate::~QWidgetPrivate() #endif //QT_NO_GRAPHICSEFFECT } -class QDummyWindowSurface : public QWindowSurface -{ -public: - QDummyWindowSurface(QWidget *window) : QWindowSurface(window) {} - QPaintDevice *paintDevice() { return window(); } - void flush(QWidget *, const QRegion &, const QPoint &) {} -}; - -QWindowSurface *QWidgetPrivate::createDefaultWindowSurface() -{ - Q_Q(QWidget); - - QWindowSurface *surface; -#ifndef QT_NO_PROPERTIES - if (q->property("_q_DummyWindowSurface").toBool()) { - surface = new QDummyWindowSurface(q); - } else -#endif - { - if (QApplicationPrivate::graphicsSystem()) - surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q); - else - surface = createDefaultWindowSurface_sys(); - } - - return surface; -} - /*! \internal */ @@ -399,10 +351,8 @@ void QWidgetPrivate::scrollChildren(int dx, int dy) QPoint oldp = w->pos(); QRect r(w->pos() + pd, w->size()); w->data->crect = r; -#ifndef Q_WS_QWS if (w->testAttribute(Qt::WA_WState_Created)) w->d_func()->setWSGeometry(); -#endif w->d_func()->setDirtyOpaqueRegion(); QMoveEvent e(r.topLeft(), oldp); QApplication::sendEvent(w, &e); @@ -411,6 +361,17 @@ void QWidgetPrivate::scrollChildren(int dx, int dy) } } +void QWidgetPrivate::updateWidgetTransform() +{ + Q_Q(QWidget); + if (q == qApp->inputPanel()->inputItem()) { + QTransform t; + QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0)); + t.translate(p.x(), p.y()); + qApp->inputPanel()->setInputItemTransform(t); + } +} + QInputContext *QWidgetPrivate::assignedInputContext() const { #ifndef QT_NO_IM @@ -1308,8 +1269,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) #elif defined(Q_WS_QPA) if (desktopWidget) { int screen = desktopWidget->d_func()->topData()->screenIndex; - QPlatformIntegration *platform = QApplicationPrivate::platformIntegration(); - platform->moveToScreen(q, screen); + q->windowHandle()->setScreen(QGuiApplication::screens().value(screen, 0)); } #else Q_UNUSED(desktopWidget); @@ -1452,7 +1412,6 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) flags |= Qt::Window; } -#ifndef Q_WS_QPA if (QWidget *parent = parentWidget()) { if (type & Qt::Window) { if (!parent->testAttribute(Qt::WA_WState_Created)) @@ -1469,7 +1428,6 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) return; } } -#endif //Q_WS_QPA #ifdef QT3_SUPPORT if (flags & Qt::WStaticContents) @@ -1516,9 +1474,9 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) // a real toplevel window needs a backing store if (isWindow() && windowType() != Qt::Desktop) { - d->topData()->backingStore.destroy(); + d->topData()->backingStoreTracker.destroy(); if (hasBackingStoreSupport()) - d->topData()->backingStore.create(this); + d->topData()->backingStoreTracker.create(this); } d->setModal_sys(); @@ -1633,7 +1591,7 @@ QWidget::~QWidget() else if (!internalWinId() && isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); } -#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) +#elif defined(Q_WS_QPA) else if (isVisible()) { qApp->d_func()->sendSyntheticEnterLeave(this); } @@ -1680,10 +1638,6 @@ QWidget::~QWidget() if (!d->children.isEmpty()) d->deleteChildren(); -#ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(this, 0, QAccessible::ObjectDestroyed); -#endif - QApplication::removePostedEvents(this); QT_TRY { @@ -1744,7 +1698,7 @@ void QWidgetPrivate::createTLExtra() QTLWExtra* x = extra->topextra = new QTLWExtra; x->icon = 0; x->iconPixmap = 0; - x->windowSurface = 0; + x->backingStore = 0; x->sharedPainter = 0; x->incw = x->inch = 0; x->basew = x->baseh = 0; @@ -1766,11 +1720,6 @@ void QWidgetPrivate::createTLExtra() #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; qDebug() << "tlextra" << ++count; -#endif -#if defined(Q_WS_QPA) - x->platformWindow = 0; - x->platformWindowFormat = QPlatformWindowFormat::defaultFormat(); - x->screenIndex = 0; #endif } } @@ -1832,13 +1781,10 @@ void QWidgetPrivate::deleteExtra() #endif if (extra->topextra) { deleteTLSysExtra(); - extra->topextra->backingStore.destroy(); + extra->topextra->backingStoreTracker.destroy(); delete extra->topextra->icon; delete extra->topextra->iconPixmap; -#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER) - delete extra->topextra->qwsManager; -#endif - delete extra->topextra->windowSurface; + delete extra->topextra->backingStore; delete extra->topextra; } delete extra; @@ -2229,9 +2175,7 @@ void QWidgetPrivate::clipToEffectiveMask(QRegion ®ion) const bool QWidgetPrivate::paintOnScreen() const { -#if defined(Q_WS_QWS) - return false; -#elif defined(QT_NO_BACKINGSTORE) +#if defined(QT_NO_BACKINGSTORE) return true; #else Q_Q(const QWidget); @@ -2333,26 +2277,6 @@ void QWidgetPrivate::updateIsTranslucent() #endif } -/*! - \fn void QPixmap::fill(const QWidget *widget, const QPoint &offset) - - Fills the pixmap with the \a widget's background color or pixmap - according to the given offset. - - The QPoint \a offset defines a point in widget coordinates to - which the pixmap's top-left pixel will be mapped to. This is only - significant if the widget has a background pixmap; otherwise the - pixmap will simply be filled with the background color of the - widget. -*/ - -void QPixmap::fill( const QWidget *widget, const QPoint &off ) -{ - QPainter p(this); - p.translate(-off); - widget->d_func()->paintBackground(&p, QRect(off, size())); -} - static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrush &brush) { Q_ASSERT(painter); @@ -2413,10 +2337,6 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int if ((flags & DrawAsRoot) && !(q->autoFillBackground() && autoFillBrush.isOpaque())) { const QBrush bg = q->palette().brush(QPalette::Window); -#ifdef Q_WS_QWS - if (!(flags & DontSetCompositionMode) && painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) - painter->setCompositionMode(QPainter::CompositionMode_Source); //copy alpha straight in -#endif fillRegion(painter, rgn, bg); } @@ -2511,9 +2431,7 @@ WId QWidget::winId() const qDebug() << "QWidget::winId: creating native window for" << this; #endif QWidget *that = const_cast<QWidget*>(this); -#ifndef Q_WS_QPA that->setAttribute(Qt::WA_NativeWindow); -#endif that->d_func()->createWinId(); return that->data->winid; } @@ -2530,7 +2448,6 @@ 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_QPA if (!q->isWindow()) { QWidget *parent = q->parentWidget(); QWidgetPrivate *pd = parent->d_func(); @@ -2558,11 +2475,6 @@ void QWidgetPrivate::createWinId(WId winid) } else { q->create(); } -#else - Q_UNUSED(winid); - q->create(); -#endif //Q_WS_QPA - } } @@ -3393,6 +3305,12 @@ void QWidgetPrivate::setEnabled_helper(bool enable) // disabled widgets qt_x11_enforce_cursor(q); } +#elif defined(Q_WS_QPA) + if (q->testAttribute(Qt::WA_SetCursor) || q->isWindow()) { + // enforce the windows behavior of clearing the cursor on + // disabled widgets + qt_qpa_set_cursor(q, false); + } #endif #if defined(Q_WS_MAC) setEnabled_helper_sys(enable); @@ -3930,19 +3848,6 @@ bool QWidgetPrivate::setMinimumSize_helper(int &minw, int &minh) { Q_Q(QWidget); -#ifdef Q_WS_QWS - if (q->isWindow()) { - const QRect maxWindowRect = QApplication::desktop()->availableGeometry(QApplication::desktop()->screenNumber(q)); - if (!maxWindowRect.isEmpty()) { - // ### This is really just a work-around. Layout shouldn't be - // asking for minimum sizes bigger than the screen. - if (minw > maxWindowRect.width()) - minw = maxWindowRect.width(); - if (minh > maxWindowRect.height()) - minh = maxWindowRect.height(); - } - } -#endif int mw = minw, mh = minh; if (mw == QWIDGETSIZE_MAX) mw = 0; @@ -4133,15 +4038,7 @@ void QWidget::setFixedSize(const QSize & s) void QWidget::setFixedSize(int w, int h) { Q_D(QWidget); -#ifdef Q_WS_QWS - // temporary fix for 4.3.x. - // Should move the embedded spesific contraints in setMinimumSize_helper into QLayout - int tmpW = w; - int tmpH = h; - bool minSizeSet = d->setMinimumSize_helper(tmpW, tmpH); -#else bool minSizeSet = d->setMinimumSize_helper(w, h); -#endif bool maxSizeSet = d->setMaximumSize_helper(w, h); if (!minSizeSet && !maxSizeSet) return; @@ -5089,7 +4986,7 @@ void QWidget::setCursor(const QCursor &cursor) { Q_D(QWidget); // On Mac we must set the cursor even if it is the ArrowCursor. -#if !defined(Q_WS_MAC) && !defined(Q_WS_QWS) +#if !defined(Q_WS_MAC) if (cursor.shape() != Qt::ArrowCursor || (d->extra && d->extra->curs)) #endif @@ -5256,6 +5153,58 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, d->extra->inRenderWithPainter = false; } +static void sendResizeEvents(QWidget *target) +{ + QResizeEvent e(target->size(), QSize()); + QApplication::sendEvent(target, &e); + + const QObjectList children = target->children(); + for (int i = 0; i < children.size(); ++i) { + QWidget *child = static_cast<QWidget*>(children.at(i)); + if (child->isWidgetType() && !child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent)) + sendResizeEvents(child); + } +} + +/*! + \since 5.0 + + Renders the widget into a pixmap restricted by the + given \a rectangle. If the \a widget has any children, then + they are also painted in the appropriate positions. + + If no rectangle is specified (the default) the entire widget is + painted. + + Replacement for Qt 4's QPixmap::grabWidget(). + + \sa render(), QPixmap +*/ + +/* INVOKABLE since used by QPixmap::grabWidget(). */ +QPixmap QWidget::grab(const QRect &rectangle) +{ + Q_D(const QWidget); + if (testAttribute(Qt::WA_PendingResizeEvent) || !testAttribute(Qt::WA_WState_Created)) + sendResizeEvents(this); + + QRect r(rectangle); + if (r.width() < 0) + r.setWidth(width() - rectangle.x()); + if (r.height() < 0) + r.setHeight(height() - rectangle.y()); + + if (!r.intersects(rect())) + return QPixmap(); + + QPixmap res(r.size()); + if (!d->isOpaque) + res.fill(Qt::transparent); + render(&res, QPoint(), QRegion(r), QWidget::DrawWindowBackground + | QWidget::DrawChildren | QWidget::IgnoreMask); + return res; +} + /*! \brief The graphicsEffect function returns a pointer to the widget's graphics effect. @@ -5577,7 +5526,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_QWS) && !defined(Q_WS_QPA) +#if !defined(Q_WS_QPA) if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) backingStore->markDirtyOnScreen(toBePainted, q, offset); #endif @@ -5592,7 +5541,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP if (!sharedPainter) paintEngine->d_func()->systemRect = QRect(); else - paintEngine->d_func()->currentClipWidget = 0; + paintEngine->d_func()->currentClipDevice = 0; paintEngine->d_func()->systemClip = QRegion(); } q->setAttribute(Qt::WA_WState_InPaintEvent, false); @@ -5626,9 +5575,6 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP if (recursive && !children.isEmpty()) { paintSiblingsRecursive(pdev, children, children.size() - 1, rgn, offset, flags & ~DrawAsRoot -#ifdef Q_BACKINGSTORE_SUBSURFACES - , q->windowSurface() -#endif , sharedPainter, backingStore); } } @@ -5700,10 +5646,6 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset, else flags |= DontSubtractOpaqueChildren; -#ifdef Q_WS_QWS - flags |= DontSetCompositionMode; -#endif - if (target->devType() == QInternal::Printer) { QPainter p(target); render_helper(&p, targetOffset, paintRegion, renderFlags); @@ -5725,9 +5667,6 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset, void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& siblings, int index, const QRegion &rgn, const QPoint &offset, int flags -#ifdef Q_BACKINGSTORE_SUBSURFACES - , const QWindowSurface *currentSurface -#endif , QPainter *sharedPainter, QWidgetBackingStore *backingStore) { QWidget *w = 0; @@ -5746,13 +5685,8 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis } if (qRectIntersects(boundingRect, x->d_func()->effectiveRectFor(x->data->crect))) { -#ifdef Q_BACKINGSTORE_SUBSURFACES - if (x->windowSurface() == currentSurface) -#endif - { - w = x; - break; - } + w = x; + break; } } --index; @@ -5769,9 +5703,6 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis if (wd->isOpaque) wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect; paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags -#ifdef Q_BACKINGSTORE_SUBSURFACES - , currentSurface -#endif , sharedPainter, backingStore); } @@ -7625,7 +7556,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_QPA) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QPA) qApp->d_func()->sendSyntheticEnterLeave(q); #endif @@ -7696,9 +7627,6 @@ void QWidget::setVisible(bool visible) #if defined(Q_WS_X11) if (windowType() == Qt::Window) QApplicationPrivate::applyX11SpecificCommandLineArguments(this); -#elif defined(Q_WS_QWS) - if (windowType() == Qt::Window) - QApplicationPrivate::applyQWSSpecificCommandLineArguments(this); #endif bool wasResized = testAttribute(Qt::WA_Resized); @@ -7757,7 +7685,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_QPA) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QPA) qApp->d_func()->sendSyntheticEnterLeave(this); #endif } @@ -7889,7 +7817,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_QPA) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QPA) qApp->d_func()->sendSyntheticEnterLeave(widget); #endif #ifndef QT_NO_ACCESSIBILITY @@ -8092,13 +8020,6 @@ QRegion QWidget::visibleRegion() const QRegion r(clipRect); d->subtractOpaqueChildren(r, clipRect); d->subtractOpaqueSiblings(r); -#ifdef Q_WS_QWS - const QWSWindowSurface *surface = static_cast<const QWSWindowSurface*>(windowSurface()); - if (surface) { - const QPoint offset = mapTo(surface->window(), QPoint()); - r &= surface->clipRegion().translated(-offset); - } -#endif return r; } @@ -8417,7 +8338,7 @@ bool QWidget::event(QEvent *event) if (!k->isAccepted() && k->modifiers() & Qt::ShiftModifier && k->key() == Qt::Key_F1 && d->whatsThis.size()) { - QWhatsThis::showText(mapToGlobal(inputMethodQuery(Qt::ImMicroFocus).toRect().center()), d->whatsThis, this); + QWhatsThis::showText(mapToGlobal(inputMethodQuery(Qt::ImCursorRectangle).toRect().center()), d->whatsThis, this); k->accept(); } #endif @@ -8434,6 +8355,21 @@ bool QWidget::event(QEvent *event) inputMethodEvent((QInputMethodEvent *) event); break; + case QEvent::InputMethodQuery: + if (testAttribute(Qt::WA_InputMethodEnabled)) { + QInputMethodQueryEvent *query = static_cast<QInputMethodQueryEvent *>(event); + Qt::InputMethodQueries queries = query->queries(); + for (uint i = 0; i < 32; ++i) { + Qt::InputMethodQuery q = (Qt::InputMethodQuery)(int)(queries & (1<<i)); + if (q) { + QVariant v = inputMethodQuery(q); + query->setValue(q, v); + } + } + query->accept(); + break; + } + case QEvent::PolishRequest: ensurePolished(); break; @@ -8463,6 +8399,7 @@ bool QWidget::event(QEvent *event) QSoftKeyManager::updateSoftKeys(); #endif focusInEvent((QFocusEvent*)event); + d->updateWidgetTransform(); break; case QEvent::FocusOut: @@ -8504,10 +8441,12 @@ bool QWidget::event(QEvent *event) case QEvent::Move: moveEvent((QMoveEvent*)event); + d->updateWidgetTransform(); break; case QEvent::Resize: resizeEvent((QResizeEvent*)event); + d->updateWidgetTransform(); break; case QEvent::Close: @@ -8780,8 +8719,9 @@ bool QWidget::event(QEvent *event) break; QMouseEvent mouseEvent(eventType, - touchPoint.pos().toPoint(), - touchPoint.screenPos().toPoint(), + touchPoint.pos(), + touchPoint.scenePos(), + touchPoint.screenPos(), Qt::LeftButton, Qt::LeftButton, touchEvent->modifiers()); @@ -8850,10 +8790,6 @@ void QWidget::changeEvent(QEvent * event) updateGeometry(); if (d->layout) d->layout->invalidate(); -#ifdef Q_WS_QWS - if (isWindow()) - d->data.fstrut_dirty = true; -#endif break; } @@ -9349,13 +9285,15 @@ void QWidget::inputMethodEvent(QInputMethodEvent *event) QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const { switch(query) { - case Qt::ImMicroFocus: + case Qt::ImCursorRectangle: return QRect(width()/2, 0, 1, height()); case Qt::ImFont: return font(); case Qt::ImAnchorPosition: // Fallback. return inputMethodQuery(Qt::ImCursorPosition); + case Qt::ImHints: + return (int)inputMethodHints(); default: return QVariant(); } @@ -9631,31 +9569,6 @@ bool QWidget::x11Event(XEvent *) } #endif -#if defined(Q_WS_QWS) - -/*! - \fn bool QWidget::qwsEvent(QWSEvent *event) - - This special event handler can be reimplemented in a subclass to - receive native Qt for Embedded Linux events which are passed in the - \a event parameter. - - In your reimplementation of this function, if you want to stop the - event being handled by Qt, return true. If you return false, this - native event is passed back to Qt, which translates the event into - a Qt event and sends it to the widget. - - \warning This function is not portable. - - \sa QApplication::qwsEventFilter() -*/ -bool QWidget::qwsEvent(QWSEvent *) -{ - return false; -} - -#endif - /*! Ensures that the widget has been polished by QStyle (i.e., has a @@ -9706,6 +9619,18 @@ void QWidget::ensurePolished() const QChildEvent e(QEvent::ChildPolished, const_cast<QWidget *>(this)); QCoreApplication::sendEvent(d->parent, &e); } +#ifdef Q_WS_QPA + if (d->extra && d->extra->topextra && d->extra->topextra->window + && d->extra->topextra->window->objectName().isEmpty()) { + QString on = objectName(); + if (on.isEmpty()) { + on = QString::fromUtf8(metaObject()->className()); + on += QLatin1String("Class"); + } + on += QLatin1String("Window"); + d->extra->topextra->window->setObjectName(on); + } +#endif } /*! @@ -10175,34 +10100,18 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) focusWidget()->clearFocus(); QTLWExtra *oldTopExtra = window()->d_func()->maybeTopData(); - QWidgetBackingStoreTracker *oldBsTracker = oldTopExtra ? &oldTopExtra->backingStore : 0; + QWidgetBackingStoreTracker *oldBsTracker = oldTopExtra ? &oldTopExtra->backingStoreTracker : 0; d->setParent_sys(parent, f); QTLWExtra *topExtra = window()->d_func()->maybeTopData(); - QWidgetBackingStoreTracker *bsTracker = topExtra ? &topExtra->backingStore : 0; + QWidgetBackingStoreTracker *bsTracker = topExtra ? &topExtra->backingStoreTracker : 0; if (oldBsTracker && oldBsTracker != bsTracker) oldBsTracker->unregisterWidgetSubtree(this); if (desktopWidget) parent = 0; -#ifdef Q_BACKINGSTORE_SUBSURFACES - QTLWExtra *extra = d->maybeTopData(); - QWindowSurface *windowSurface = (extra ? extra->windowSurface : 0); - if (newParent && windowSurface) { - QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore(); - if (oldBs) - oldBs->subSurfaces.removeAll(windowSurface); - - if (parent) { - QWidgetBackingStore *newBs = parent->d_func()->maybeBackingStore(); - if (newBs) - newBs->subSurfaces.append(windowSurface); - } - } -#endif - if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) { if (newParent) oldBs->removeDirtyWidget(this); @@ -10448,7 +10357,7 @@ void QWidget::repaint(const QRect &rect) QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { tlwExtra->inRepaint = true; - tlwExtra->backingStore->markDirty(rect, this, true); + tlwExtra->backingStoreTracker->markDirty(rect, this, true); tlwExtra->inRepaint = false; } } else { @@ -10483,7 +10392,7 @@ void QWidget::repaint(const QRegion &rgn) QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { tlwExtra->inRepaint = true; - tlwExtra->backingStore->markDirty(rgn, this, true); + tlwExtra->backingStoreTracker->markDirty(rgn, this, true); tlwExtra->inRepaint = false; } } else { @@ -10545,7 +10454,7 @@ void QWidget::update(const QRect &rect) #endif // QT_MAC_USE_COCOA QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) - tlwExtra->backingStore->markDirty(rect, this); + tlwExtra->backingStoreTracker->markDirty(rect, this); } else { d_func()->repaint_sys(rect); } @@ -10575,7 +10484,7 @@ void QWidget::update(const QRegion &rgn) #endif // QT_MAC_USE_COCOA QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) - tlwExtra->backingStore->markDirty(rgn, this); + tlwExtra->backingStoreTracker->markDirty(rgn, this); } else { d_func()->repaint_sys(rgn); } @@ -10816,6 +10725,9 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) QApplication::sendEvent(this, &e); break; } case Qt::WA_NativeWindow: { +#if defined(Q_WS_QPA) + d->createTLExtra(); +#endif #ifndef QT_NO_IM QWidget *focusWidget = d->effectiveFocusWidget(); QInputContext *ic = 0; @@ -10913,14 +10825,6 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) // from the desktop. show_sys will only update platform specific // attributes at this point. d->hide_sys(); -#ifdef Q_WS_QWS - // Release the region for this window from qws if the widget has - // been shown before the attribute was set. - if (QWSWindowSurface *surface = static_cast<QWSWindowSurface *>(windowSurface())) { - QWidget::qwsDisplay()->requestRegion(surface->winId(), surface->key(), - surface->permanentState(), QRegion()); - } -#endif d->show_sys(); } break; @@ -11069,10 +10973,8 @@ void QWidget::setWindowOpacity(qreal opacity) extra->opacity = uint(opacity * 255); setAttribute(Qt::WA_WState_WindowOpacitySet); -#ifndef Q_WS_QWS if (!testAttribute(Qt::WA_WState_Created)) return; -#endif #ifndef QT_NO_GRAPHICSVIEW if (QGraphicsProxyWidget *proxy = graphicsProxyWidget()) { @@ -11362,7 +11264,6 @@ void QWidget::setShortcutAutoRepeat(int id, bool enable) */ void QWidget::updateMicroFocus() { -#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) Q_D(QWidget); // and optimization to update input context only it has already been created. if (d->assignedInputContext() || qApp->d_func()->inputContext) { @@ -11370,7 +11271,6 @@ void QWidget::updateMicroFocus() if (ic) ic->update(); } -#endif #ifndef QT_NO_ACCESSIBILITY if (isVisible()) { // ##### is this correct @@ -11548,6 +11448,18 @@ void QWidget::windowActivationChange(bool) { } // compat void QWidget::languageChange() { } // compat +/*! + \enum QWidget::BackgroundOrigin + + \compat + + \value WidgetOrigin + \value ParentOrigin + \value WindowOrigin + \value AncestorOrigin + +*/ + /*! \fn bool QWidget::isVisibleToTLW() const @@ -11721,11 +11633,6 @@ void QWidget::languageChange() { } // compat \endcode */ -/*! - \fn QColorGroup QWidget::colorGroup() const - - Use QColorGroup(palette()) instead. -*/ /*! \fn QWidget *QWidget::parentWidget(bool sameWindow) const @@ -11954,6 +11861,20 @@ void QWidget::languageChange() { } // compat \endcode */ +/*! + \fn void QWidget::setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw) + \compat + + Use the \l sizePolicy property and heightForWidth() function instead. +*/ + +/*! + \fn bool QWidget::isUpdatesEnabled() const + \compat + + Use the \l updatesEnabled property instead. +*/ + /*! \macro QWIDGETSIZE_MAX \relates QWidget @@ -12121,83 +12042,55 @@ bool QWidgetPrivate::inTabWidget(QWidget *widget) #endif /*! - \preliminary - \since 4.2 - \obsolete + \since 5.0 + \internal - Sets the window surface to be the \a surface specified. - The QWidget takes will ownership of the \a surface. - widget itself is deleted. + Sets the backing store to be the \a store specified. + The QWidget will take ownership of the \a store. */ -void QWidget::setWindowSurface(QWindowSurface *surface) +void QWidget::setBackingStore(QBackingStore *store) { // ### createWinId() ?? -#ifndef Q_BACKINGSTORE_SUBSURFACES if (!isTopLevel()) return; -#endif Q_D(QWidget); QTLWExtra *topData = d->topData(); - if (topData->windowSurface == surface) + if (topData->backingStore == store) return; - QWindowSurface *oldSurface = topData->windowSurface; - delete topData->windowSurface; - topData->windowSurface = surface; + QBackingStore *oldStore = topData->backingStore; + delete topData->backingStore; + topData->backingStore = store; QWidgetBackingStore *bs = d->maybeBackingStore(); if (!bs) return; if (isTopLevel()) { - if (bs->windowSurface != oldSurface && bs->windowSurface != surface) - delete bs->windowSurface; - bs->windowSurface = surface; + if (bs->store != oldStore && bs->store != store) + delete bs->store; + bs->store = store; } -#ifdef Q_BACKINGSTORE_SUBSURFACES - else { - bs->subSurfaces.append(surface); - } - bs->subSurfaces.removeOne(oldSurface); -#endif } /*! - \preliminary - \since 4.2 + \since 5.0 - Returns the QWindowSurface this widget will be drawn into. + Returns the QBackingStore this widget will be drawn into. */ -QWindowSurface *QWidget::windowSurface() const +QBackingStore *QWidget::backingStore() const { Q_D(const QWidget); QTLWExtra *extra = d->maybeTopData(); - if (extra && extra->windowSurface) - return extra->windowSurface; + if (extra && extra->backingStore) + return extra->backingStore; QWidgetBackingStore *bs = d->maybeBackingStore(); -#ifdef Q_BACKINGSTORE_SUBSURFACES - if (bs && bs->subSurfaces.isEmpty()) - return bs->windowSurface; - - if (!isTopLevel()) { - const QWidget *w = parentWidget(); - while (w) { - QTLWExtra *extra = w->d_func()->maybeTopData(); - if (extra && extra->windowSurface) - return extra->windowSurface; - if (w->isTopLevel()) - break; - w = w->parentWidget(); - } - } -#endif // Q_BACKINGSTORE_SUBSURFACES - - return bs ? bs->windowSurface : 0; + return bs ? bs->store : 0; } void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const @@ -12267,12 +12160,12 @@ void QWidgetPrivate::adjustQuitOnCloseAttribute() -Q_GUI_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget) +Q_WIDGETS_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget) { return widget->data; } -Q_GUI_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget) +Q_WIDGETS_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget) { return widget->d_func(); } @@ -12526,6 +12419,37 @@ void QWidget::ungrabGesture(Qt::GestureType gesture) \a m is the metric to get. */ +void QWidget::init(QPainter *painter) const +{ + const QPalette &pal = palette(); + painter->d_func()->state->pen = QPen(pal.brush(foregroundRole()), 0); + painter->d_func()->state->bgBrush = pal.brush(backgroundRole()); + QFont f(font(), const_cast<QWidget *>(this)); + painter->d_func()->state->deviceFont = f; + painter->d_func()->state->font = f; +} + +QPaintDevice *QWidget::redirected(QPoint *offset) const +{ + return d_func()->redirected(offset); +} + +QPainter *QWidget::sharedPainter() const +{ + // Someone sent a paint event directly to the widget + if (!d_func()->redirectDev) + return 0; + + QPainter *sp = d_func()->sharedPainter(); + if (!sp || !sp->isActive()) + return 0; + + if (sp->paintEngine()->paintDevice() != d_func()->redirectDev) + return 0; + + return sp; +} + /*! \fn void QWidget::setMask(const QRegion ®ion) \overload diff --git a/src/gui/kernel/qwidget.h b/src/widgets/kernel/qwidget.h similarity index 97% rename from src/gui/kernel/qwidget.h rename to src/widgets/kernel/qwidget.h index 1a9987d1718..65d5f4701cf 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -50,14 +50,14 @@ #include <QtGui/qfont.h> #include <QtGui/qfontmetrics.h> #include <QtGui/qfontinfo.h> -#include <QtGui/qsizepolicy.h> +#include <QtWidgets/qsizepolicy.h> #include <QtGui/qregion.h> #include <QtGui/qbrush.h> #include <QtGui/qcursor.h> #include <QtGui/qkeysequence.h> #ifdef Q_WS_QPA //should this go somewhere else? -#include <QtGui/qplatformwindowformat_qpa.h> +#include <QtGui/qwindow.h> #endif #ifdef QT_INCLUDE_COMPAT @@ -97,13 +97,14 @@ class QShowEvent; class QHideEvent; class QInputContext; class QIcon; -class QWindowSurface; +class QBackingStore; class QPlatformWindow; class QLocale; class QGraphicsProxyWidget; class QGraphicsEffect; class QRasterWindowSurface; class QUnifiedToolbarSurface; +class QPixmap; #if defined(Q_WS_X11) class QX11Info; #endif @@ -144,7 +145,7 @@ public: class QWidgetPrivate; -class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice +class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice { Q_OBJECT Q_DECLARE_PRIVATE(QWidget) @@ -362,6 +363,8 @@ public: const QRegion &sourceRegion = QRegion(), RenderFlags renderFlags = RenderFlags(DrawWindowBackground | DrawChildren)); + Q_INVOKABLE QPixmap grab(const QRect &rectangle); + #ifndef QT_NO_GRAPHICSEFFECT QGraphicsEffect *graphicsEffect() const; void setGraphicsEffect(QGraphicsEffect *effect); @@ -631,15 +634,11 @@ public: bool autoFillBackground() const; void setAutoFillBackground(bool enabled); - void setWindowSurface(QWindowSurface *surface); - QWindowSurface *windowSurface() const; + QBackingStore *backingStore() const; #if defined(Q_WS_QPA) - void setPlatformWindow(QPlatformWindow *window); - QPlatformWindow *platformWindow() const; - - void setPlatformWindowFormat(const QPlatformWindowFormat &format); - QPlatformWindowFormat platformWindowFormat() const; + void setWindowHandle(QWindow *window); + QWindow *windowHandle() const; friend class QDesktopScreenWidget; #endif @@ -704,6 +703,9 @@ protected: virtual void changeEvent(QEvent *); int metric(PaintDeviceMetric) const; + void init(QPainter *painter) const; + QPaintDevice *redirected(QPoint *offset) const; + QPainter *sharedPainter() const; virtual void inputMethodEvent(QInputMethodEvent *); public: @@ -730,6 +732,7 @@ protected: protected: QWidget(QWidgetPrivate &d, QWidget* parent, Qt::WindowFlags f); private: + void setBackingStore(QBackingStore *store); bool testAttribute_helper(Qt::WidgetAttribute) const; @@ -739,6 +742,8 @@ private: friend class QWidgetBackingStore; friend class QApplication; friend class QApplicationPrivate; + friend class QGuiApplication; + friend class QGuiApplicationPrivate; friend class QBaseApplication; friend class QPainter; friend class QPainterPrivate; @@ -761,6 +766,7 @@ private: friend class QGraphicsProxyWidgetPrivate; friend class QStyleSheetStyle; friend struct QWidgetExceptionCleaner; + friend class QWidgetWindow; #ifndef QT_NO_GESTURES friend class QGestureManager; friend class QWinNativePanGestureRecognizer; @@ -799,8 +805,8 @@ private: friend void qt_set_winid_on_widget(QWidget*, Qt::HANDLE); #endif - friend Q_GUI_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget); - friend Q_GUI_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget); + friend Q_WIDGETS_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget); + friend Q_WIDGETS_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget); private: Q_DISABLE_COPY(QWidget) @@ -854,7 +860,6 @@ public: const QT3_SUPPORT QPixmap *backgroundPixmap() const; void QT3_SUPPORT setBackgroundPixmap(const QPixmap &); QT3_SUPPORT void setBackgroundColor(const QColor &); - QT3_SUPPORT QColorGroup colorGroup() const; QT3_SUPPORT QWidget *parentWidget(bool sameWindow) const; inline QT3_SUPPORT void setKeyCompression(bool b) { setAttribute(Qt::WA_KeyCompression, b); } inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); } @@ -1051,8 +1056,6 @@ inline QWidget *QWidget::parentWidget(bool sameWindow) const return 0; return static_cast<QWidget *>(QObject::parent()); } -inline QColorGroup QWidget::colorGroup() const -{ return QColorGroup(palette()); } inline void QWidget::setPaletteForegroundColor(const QColor &c) { QPalette p = palette(); p.setColor(foregroundRole(), c); setPalette(p); } inline const QBrush& QWidget::backgroundBrush() const { return palette().brush(backgroundRole()); } diff --git a/src/gui/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h similarity index 95% rename from src/gui/kernel/qwidget_p.h rename to src/widgets/kernel/qwidget_p.h index 5252397f614..6e1568e0fa4 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -53,19 +53,20 @@ // We mean it. // -#include "QtGui/qwidget.h" +#include "QtWidgets/qwidget.h" #include "private/qobject_p.h" #include "QtCore/qrect.h" #include "QtCore/qlocale.h" #include "QtCore/qset.h" #include "QtGui/qregion.h" -#include "QtGui/qsizepolicy.h" -#include "QtGui/qstyle.h" -#include "QtGui/qapplication.h" +#include "QtGui/qinputpanel.h" +#include "QtWidgets/qsizepolicy.h" +#include "QtWidgets/qstyle.h" +#include "QtWidgets/qapplication.h" #include <private/qgraphicseffect_p.h> -#include "QtGui/qgraphicsproxywidget.h" -#include "QtGui/qgraphicsscene.h" -#include "QtGui/qgraphicsview.h" +#include "QtWidgets/qgraphicsproxywidget.h" +#include "QtWidgets/qgraphicsscene.h" +#include "QtWidgets/qgraphicsview.h" #include <private/qgesture_p.h> #ifdef Q_WS_WIN @@ -82,7 +83,7 @@ #endif #if defined(Q_WS_QWS) -#include "QtGui/qinputcontext.h" +#include "QtWidgets/qinputcontext.h" #include "QtGui/qscreen_qws.h" #endif @@ -103,7 +104,7 @@ class QWSManager; class QCoreGraphicsPaintEnginePrivate; #endif #if defined(Q_WS_QPA) -class QPlatformWindow; +class QWidgetWindow; #endif class QPaintEngine; class QPixmap; @@ -163,8 +164,8 @@ struct QTLWExtra { // Regular pointers (keep them together to avoid gaps on 64 bits architectures). QIcon *icon; // widget icon QPixmap *iconPixmap; - QWidgetBackingStoreTracker backingStore; - QWindowSurface *windowSurface; + QWidgetBackingStoreTracker backingStoreTracker; + QBackingStore *backingStore; QPainter *sharedPainter; // Implicit pointers (shared_null). @@ -233,8 +234,7 @@ struct QTLWExtra { uint inExpose : 1; // Prevents drawing recursion uint nativeWindowTransparencyEnabled : 1; // Tracks native window transparency #elif defined(Q_WS_QPA) - QPlatformWindow *platformWindow; - QPlatformWindowFormat platformWindowFormat; + QWidgetWindow *window; quint32 screenIndex; // index in qplatformscreenlist #endif }; @@ -355,7 +355,7 @@ static inline bool bypassGraphicsProxyWidget(const QWidget *p) return false; } -class Q_GUI_EXPORT QWidgetPrivate : public QObjectPrivate +class Q_WIDGETS_EXPORT QWidgetPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QWidget) @@ -459,11 +459,8 @@ public: void paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& children, int index, - const QRegion &rgn, const QPoint &offset, int flags -#ifdef Q_BACKINGSTORE_SUBSURFACES - , const QWindowSurface *currentSurface -#endif - , QPainter *sharedPainter, QWidgetBackingStore *backingStore); + const QRegion &rgn, const QPoint &offset, int flags, + QPainter *sharedPainter, QWidgetBackingStore *backingStore); QPainter *beginSharedPainter(); @@ -471,8 +468,6 @@ public: #ifndef QT_NO_GRAPHICSVIEW static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin); #endif - QWindowSurface *createDefaultWindowSurface(); - QWindowSurface *createDefaultWindowSurface_sys(); void repaint_sys(const QRegion &rgn); QRect clipRect() const; @@ -510,6 +505,9 @@ public: void syncBackingStore(); void syncBackingStore(const QRegion ®ion); + // tells the input panel about the widgets transform + void updateWidgetTransform(); + void reparentFocusWidgets(QWidget *oldtlw); static int pointToRect(const QPoint &p, const QRect &r); @@ -666,8 +664,7 @@ public: QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) { - QEvent event(QEvent::RequestSoftwareInputPanel); - QApplication::sendEvent(q, &event); + qApp->inputPanel()->show(); } } } @@ -885,26 +882,11 @@ public: static OSStatus qt_widget_event(EventHandlerCallRef er, EventRef event, void *); static bool qt_widget_rgn(QWidget *, short, RgnHandle, bool); void registerTouchWindow(bool enable = true); -#elif defined(Q_WS_QWS) // <--------------------------------------------------------- QWS - void setMaxWindowState_helper(); - void setFullScreenSize_helper(); - void moveSurface(QWindowSurface *surface, const QPoint &offset); - QRegion localRequestedRegion() const; - QRegion localAllocatedRegion() const; - - friend class QWSManager; - friend class QWSManagerPrivate; - friend class QDecoration; -#ifndef QT_NO_CURSOR - void updateCursor() const; -#endif - QScreen* getScreen() const; #elif defined(Q_WS_QPA) // <--------------------------------------------------------- QPA void setMaxWindowState_helper(); void setFullScreenSize_helper(); -#ifndef QT_NO_CURSOR - void updateCursor() const; -#endif + bool stealKeyboardGrab(bool grab); + bool stealMouseGrab(bool grab); #elif defined(Q_OS_SYMBIAN) // <--------------------------------------------------------- SYMBIAN static QWidget *mouseGrabber; static QWidget *keyboardGrabber; @@ -1028,7 +1010,7 @@ inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const { Q_Q(const QWidget); QTLWExtra *x = q->window()->d_func()->maybeTopData(); - return x ? x->backingStore.data() : 0; + return x ? x->backingStoreTracker.data() : 0; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp similarity index 58% rename from src/gui/kernel/qwidget_qpa.cpp rename to src/widgets/kernel/qwidget_qpa.cpp index 661120c8b29..39f8aa944d6 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -39,22 +39,26 @@ ** ****************************************************************************/ -#include "QtGui/qwidget.h" +#include "QtWidgets/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 "QtWidgets/qapplication.h" +#include "private/qwidgetbackingstore_p.h" +#include "private/qwidget_p.h" +#include "private/qwidgetwindow_qpa_p.h" +#include "private/qapplication_p.h" +#include "QtWidgets/qdesktopwidget.h" #include "QtGui/qplatformwindow_qpa.h" -#include "QtGui/qplatformglcontext_qpa.h" +#include "QtGui/qsurfaceformat.h" +#include "QtGui/qplatformopenglcontext_qpa.h" +#include "QtGui/private/qwindow_p.h" #include <QtGui/QPlatformCursor> +#include <QtGui/QGuiApplication> +#include <QtGui/QScreen> QT_BEGIN_NAMESPACE -void q_createNativeChildrenAndSetParent(QPlatformWindow *parentWindow, const QWidget *parentWidget) +void q_createNativeChildrenAndSetParent(QWindow *parentWindow, const QWidget *parentWidget) { QObjectList children = parentWidget->children(); for (int i = 0; i < children.size(); i++) { @@ -62,11 +66,14 @@ void q_createNativeChildrenAndSetParent(QPlatformWindow *parentWindow, const QWi const QWidget *childWidget = qobject_cast<const QWidget *>(children.at(i)); if (childWidget) { // should not be necessary if (childWidget->testAttribute(Qt::WA_NativeWindow)) { - if (!childWidget->platformWindow()) + if (!childWidget->windowHandle()) childWidget->winId(); - } - if (childWidget->platformWindow()) { - childWidget->platformWindow()->setParent(parentWindow); + if (childWidget->windowHandle()) { + if (childWidget->isTopLevel()) + childWidget->windowHandle()->setTransientParent(parentWindow); + else + childWidget->windowHandle()->setParent(parentWindow); + } } else { q_createNativeChildrenAndSetParent(parentWindow,childWidget); } @@ -86,42 +93,57 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO Qt::WindowFlags flags = data.window_flags; - if ((!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow()) || q->windowType() == Qt::Desktop ) + if (!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow()) 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 ) { - if (platformWindow && q->platformWindowFormat().hasWindowSurface()) { - surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId()); - } else { - q->setAttribute(Qt::WA_PaintOnScreen,true); - } + QWindow *win = topData()->window; + // topData() ensures the extra is created but does not ensure 'window' is non-null + // in case the extra was already valid. + if (!win) { + createTLSysExtra(); + win = topData()->window; } - data.window_flags = q->platformWindow()->setWindowFlags(data.window_flags); + win->setWindowFlags(data.window_flags); + win->setGeometry(q->geometry()); + win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0)); - setWinId(q->platformWindow()->winId()); + if (q->testAttribute(Qt::WA_TranslucentBackground)) { + QSurfaceFormat format; + format.setAlphaBufferSize(8); + win->setFormat(format); + } - //first check children. and create them if necessary - q_createNativeChildrenAndSetParent(q->platformWindow(),q); - - //if we we have a parent, then set correct parent; - if (!q->isWindow()) { - if (QWidget *nativeParent = q->nativeParentWidget()) { - if (nativeParent->platformWindow()) { - platformWindow->setParent(nativeParent->platformWindow()); + if (QWidget *nativeParent = q->nativeParentWidget()) { + if (nativeParent->windowHandle()) { + if (flags & Qt::Window) { + win->setTransientParent(nativeParent->windowHandle()); + win->setParent(0); + } else { + win->setTransientParent(0); + win->setParent(nativeParent->windowHandle()); } } } - QApplicationPrivate::platformIntegration()->moveToScreen(q, topData()->screenIndex); + win->create(); + + data.window_flags = win->windowFlags(); + + QBackingStore *store = q->backingStore(); + + if (!store) { + if (win) + q->setBackingStore(new QBackingStore(win)); + else + q->setAttribute(Qt::WA_PaintOnScreen, true); + } + + setWinId(win->winId()); + +// first check children. and create them if necessary +// q_createNativeChildrenAndSetParent(q->windowHandle(),q); + // qDebug() << "create_sys" << q << q->internalWinId(); } @@ -129,20 +151,26 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); + d->aboutToDestroy(); + if (!isWindow() && parentWidget()) + parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry())); + d->deactivateWidgetCleanup(); + 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); + setAttribute(Qt::WA_WState_Created, false); + if (windowType() != Qt::Desktop) { if (destroySubWindows) { QObjectList childList(children()); for (int i = 0; i < childList.size(); i++) { QWidget *widget = qobject_cast<QWidget *>(childList.at(i)); if (widget && widget->testAttribute(Qt::WA_NativeWindow)) { - if (widget->platformWindow()) { + if (widget->windowHandle()) { widget->destroy(); } } @@ -155,6 +183,8 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) d->hide_sys(); } } + + d->setWinId(0); } } @@ -163,6 +193,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) Q_Q(QWidget); Qt::WindowFlags oldFlags = data.window_flags; + bool wasCreated = q->testAttribute(Qt::WA_WState_Created); int targetScreen = -1; // Handle a request to move the widget to a particular screen @@ -175,15 +206,27 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) newparent = 0; } + setWinId(0); + if (parent != newparent) { QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function??? - if (q->platformWindow() && newparent) { - QWidget * parentWithWindow = newparent->platformWindow()? newparent : newparent->nativeParentWidget(); - if (parentWithWindow && parentWithWindow->platformWindow()) { - q->platformWindow()->setParent(parentWithWindow->platformWindow()); + if (q->windowHandle()) { + q->windowHandle()->setWindowFlags(f); + QWidget *parentWithWindow = + newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : 0; + if (parentWithWindow) { + if (f & Qt::Window) { + q->windowHandle()->setTransientParent(parentWithWindow->windowHandle()); + q->windowHandle()->setParent(0); + } else { + q->windowHandle()->setTransientParent(0); + q->windowHandle()->setParent(parentWithWindow->windowHandle()); + } + } else { + q->windowHandle()->setTransientParent(0); + q->windowHandle()->setParent(0); } } - } if (!newparent) { @@ -195,24 +238,21 @@ 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 + + // Reparenting toplevel to child if (!(f&Qt::Window) && (oldFlags&Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) { //qDebug() << "setParent_sys() change from toplevel"; q->destroy(); + } else if (newparent && wasCreated) { + q->createWinId(); } + adjustFlags(f, q); 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); - } - if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden) q->setAttribute(Qt::WA_WState_Hidden); q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); @@ -223,16 +263,15 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) maybeTopData()->screenIndex = targetScreen; // only if it is already created if (q->testAttribute(Qt::WA_WState_Created)) { - QPlatformIntegration *platform = QApplicationPrivate::platformIntegration(); - platform->moveToScreen(q, targetScreen); + q->windowHandle()->setScreen(QGuiApplication::screens().value(targetScreen, 0)); } } } QPoint QWidget::mapToGlobal(const QPoint &pos) const { - int x=pos.x(), y=pos.y(); - const QWidget* w = this; + int x = pos.x(), y = pos.y(); + const QWidget *w = this; while (w) { x += w->data->crect.x(); y += w->data->crect.y(); @@ -243,8 +282,8 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const QPoint QWidget::mapFromGlobal(const QPoint &pos) const { - int x=pos.x(), y=pos.y(); - const QWidget* w = this; + int x = pos.x(), y = pos.y(); + const QWidget *w = this; while (w) { x -= w->data->crect.x(); y -= w->data->crect.y(); @@ -260,20 +299,13 @@ void QWidgetPrivate::setCursor_sys(const QCursor &cursor) { Q_UNUSED(cursor); Q_Q(QWidget); - if (q->isVisible()) - qt_qpa_set_cursor(q, false); + qt_qpa_set_cursor(q, false); } void QWidgetPrivate::unsetCursor_sys() { Q_Q(QWidget); - if (q->isVisible()) - qt_qpa_set_cursor(q, false); -} - -void QWidgetPrivate::updateCursor() const -{ - // XXX + qt_qpa_set_cursor(q, false); } #endif //QT_NO_CURSOR @@ -284,7 +316,7 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) if (!q->isWindow()) return; - if (QPlatformWindow *window = q->platformWindow()) + if (QWindow *window = q->windowHandle()) window->setWindowTitle(caption); } @@ -307,8 +339,8 @@ void QWidget::grabMouse() if (qt_mouseGrb) qt_mouseGrb->releaseMouse(); - // XXX - //qwsDisplay()->grabMouse(this,true); + if (windowHandle()) + windowHandle()->setMouseGrabEnabled(true); qt_mouseGrb = this; qt_pressGrab = 0; @@ -322,19 +354,27 @@ void QWidget::grabMouse(const QCursor &cursor) if (qt_mouseGrb) qt_mouseGrb->releaseMouse(); - // XXX - //qwsDisplay()->grabMouse(this,true); - //qwsDisplay()->selectCursor(this, cursor.handle()); + if (windowHandle()) + windowHandle()->setMouseGrabEnabled(true); + qt_mouseGrb = this; qt_pressGrab = 0; } #endif +bool QWidgetPrivate::stealMouseGrab(bool grab) +{ + // This is like a combination of grab/releaseMouse() but with error checking + // and it has no effect on the result of mouseGrabber(). + Q_Q(QWidget); + return q->windowHandle() ? q->windowHandle()->setMouseGrabEnabled(grab) : false; +} + void QWidget::releaseMouse() { if (qt_mouseGrb == this) { - // XXX - //qwsDisplay()->grabMouse(this,false); + if (windowHandle()) + windowHandle()->setMouseGrabEnabled(false); qt_mouseGrb = 0; } } @@ -343,16 +383,24 @@ void QWidget::grabKeyboard() { if (keyboardGrb) keyboardGrb->releaseKeyboard(); - // XXX - //qwsDisplay()->grabKeyboard(this, true); + if (windowHandle()) + windowHandle()->setKeyboardGrabEnabled(true); keyboardGrb = this; } +bool QWidgetPrivate::stealKeyboardGrab(bool grab) +{ + // This is like a combination of grab/releaseKeyboard() but with error + // checking and it has no effect on the result of keyboardGrabber(). + Q_Q(QWidget); + return q->windowHandle() ? q->windowHandle()->setKeyboardGrabEnabled(grab) : false; +} + void QWidget::releaseKeyboard() { if (keyboardGrb == this) { - // XXX - //qwsDisplay()->grabKeyboard(this, false); + if (windowHandle()) + windowHandle()->setKeyboardGrabEnabled(false); keyboardGrb = 0; } } @@ -371,8 +419,8 @@ QWidget *QWidget::keyboardGrabber() void QWidget::activateWindow() { - if (platformWindow()) - platformWindow()->requestActivateWindow(); + if (windowHandle()) + windowHandle()->requestActivateWindow(); } void QWidgetPrivate::show_sys() @@ -386,7 +434,10 @@ void QWidgetPrivate::show_sys() QApplication::postEvent(q, new QUpdateLaterEvent(q->rect())); - QPlatformWindow *window = q->platformWindow(); + if (!q->isWindow() && !q->testAttribute(Qt::WA_NativeWindow)) + return; + + QWindow *window = q->windowHandle(); if (window) { QRect geomRect = q->geometry(); if (!q->isWindow()) { @@ -397,11 +448,15 @@ void QWidgetPrivate::show_sys() if (windowRect != geomRect) { window->setGeometry(geomRect); } - if (QWindowSurface *surface = q->windowSurface()) { - if (windowRect.size() != geomRect.size()) { - surface->resize(geomRect.size()); + + if (QBackingStore *store = q->backingStore()) { + if (store->size() != geomRect.size()) { + store->resize(geomRect.size()); } } + + invalidateBuffer(q->rect()); + if (window) window->setVisible(true); } @@ -412,6 +467,7 @@ void QWidgetPrivate::hide_sys() { Q_Q(QWidget); q->setAttribute(Qt::WA_Mapped, false); + deactivateWidgetCleanup(); if (!q->isWindow()) { QWidget *p = q->parentWidget(); if (p &&p->isVisible()) { @@ -419,14 +475,9 @@ void QWidgetPrivate::hide_sys() } return; } - if (QPlatformWindow *window = q->platformWindow()) { + if (QWindow *window = q->windowHandle()) { window->setVisible(false); - } - - //### we don't yet have proper focus event handling - if (q == QApplicationPrivate::active_window) - QApplication::setActiveWindow(0); - + } } void QWidgetPrivate::setMaxWindowState_helper() @@ -448,7 +499,7 @@ void QWidgetPrivate::setFullScreenSize_helper() data.in_set_window_state = old_state; } -static Qt::WindowStates effectiveState(Qt::WindowStates state) +static Qt::WindowState effectiveState(Qt::WindowStates state) { if (state & Qt::WindowMinimized) return Qt::WindowMinimized; @@ -471,8 +522,8 @@ void QWidget::setWindowState(Qt::WindowStates newstate) data->window_state = newstate; data->in_set_window_state = 1; bool needShow = false; - Qt::WindowStates newEffectiveState = effectiveState(newstate); - Qt::WindowStates oldEffectiveState = effectiveState(oldstate); + Qt::WindowState newEffectiveState = effectiveState(newstate); + Qt::WindowState oldEffectiveState = effectiveState(oldstate); if (isWindow() && newEffectiveState != oldEffectiveState) { d->createTLExtra(); if (oldEffectiveState == Qt::WindowNoState) { //normal @@ -484,24 +535,32 @@ void QWidget::setWindowState(Qt::WindowStates newstate) 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); + Q_ASSERT(windowHandle()); + windowHandle()->setWindowState(newEffectiveState); + bool supported = windowHandle()->windowState() == newEffectiveState; + + if (!supported) { + // emulate the window state + 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 if (newEffectiveState == Qt::WindowNoState) { + // reset old geometry + QRect r = d->topData()->normalGeometry; + if (r.width() >= 0) { + d->topData()->normalGeometry = QRect(0,0,-1,-1); + setGeometry(r); + } } } } @@ -526,7 +585,7 @@ void QWidgetPrivate::raise_sys() { Q_Q(QWidget); if (q->isWindow()) { - q->platformWindow()->raise(); + q->windowHandle()->raise(); } } @@ -535,7 +594,7 @@ void QWidgetPrivate::lower_sys() Q_Q(QWidget); if (q->isWindow()) { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - q->platformWindow()->lower(); + q->windowHandle()->lower(); } else if (QWidget *p = q->parentWidget()) { setDirtyOpaqueRegion(); p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); @@ -584,24 +643,41 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) QPoint oldPos = q->pos(); data.crect = r; + bool needsShow = false; + + if (w == 0 || h == 0) { + q->setAttribute(Qt::WA_OutsideWSRange, true); + if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) + hide_sys(); + data.crect = QRect(x, y, w, h); + } else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) { + q->setAttribute(Qt::WA_OutsideWSRange, false); + needsShow = true; + } + if (q->isVisible()) { - if (q->platformWindow()) { - if (q->isWindow()) { - q->platformWindow()->setGeometry(q->geometry()); + if (!q->testAttribute(Qt::WA_DontShowOnScreen) && !q->testAttribute(Qt::WA_OutsideWSRange)) { + if (q->windowHandle()) { + if (q->isWindow()) { + q->windowHandle()->setGeometry(q->geometry()); + } else { + QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint()); + q->windowHandle()->setGeometry(QRect(posInNativeParent,r.size())); + } + const QWidgetBackingStore *bs = maybeBackingStore(); + if (bs->store) { + if (isResize) + bs->store->resize(r.size()); + } + + if (needsShow) + show_sys(); } else { - QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint()); - q->platformWindow()->setGeometry(QRect(posInNativeParent,r.size())); + if (isMove && !isResize) + moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y()); + else + invalidateBuffer_resizeHelper(oldPos, olds); } - 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) { @@ -611,7 +687,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->platformWindow()) + if (q->windowHandle()) q->update(); } } else { // not visible @@ -625,6 +701,22 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) void QWidgetPrivate::setConstraints_sys() { + Q_Q(QWidget); + if (extra && q->windowHandle()) { + QWindow *win = q->windowHandle(); + QWindowPrivate *winp = qt_window_private(win); + + winp->minimumSize = QSize(extra->minw, extra->minh); + winp->maximumSize = QSize(extra->maxw, extra->maxh); + + if (extra->topextra) { + winp->baseSize = QSize(extra->topextra->basew, extra->topextra->baseh); + winp->sizeIncrement = QSize(extra->topextra->incw, extra->topextra->inch); + } + + if (winp->platformWindow) + winp->platformWindow->propagateSizeHints(); + } } void QWidgetPrivate::scroll_sys(int dx, int dy) @@ -643,7 +735,13 @@ int QWidget::metric(PaintDeviceMetric m) const { Q_D(const QWidget); - QPlatformScreen *screen = QPlatformScreen::platformScreenForWidget(this); + QPlatformScreen *screen = 0; + if (QWidget *topLevel = window()) + if (QWindow *topLevelWindow = topLevel->windowHandle()) + screen = QPlatformScreen::platformScreenForWindow(topLevelWindow); + if (!screen && QGuiApplication::primaryScreen()) + screen = QGuiApplication::primaryScreen()->handle(); + if (!screen) { if (m == PdmDpiX || m == PdmDpiY) return 72; @@ -678,82 +776,21 @@ int QWidget::metric(PaintDeviceMetric m) const return val; } -/*! - \preliminary - - Sets the window to be the platform \a window specified. - - The widget takes ownership of the \a window. Any platform window - previously set on the widget will be destroyed. -*/ -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 +QWindow *QWidget::windowHandle() const { Q_D(const QWidget); QTLWExtra *extra = d->maybeTopData(); - if (extra && extra->platformWindow) - return extra->platformWindow; + if (extra) + return extra->window; return 0; } -/*! - Sets the platform window format for the widget to the \a format specified. -*/ -void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &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); - } - } -} - -/*! - Returns the platform window format for the widget. -*/ -QPlatformWindowFormat QWidget::platformWindowFormat() const -{ - Q_D(const QWidget); - - QPlatformWindowFormat format; - - QTLWExtra *extra = d->maybeTopData(); - if (extra){ - format = extra->platformWindowFormat; - } else { - format = QPlatformWindowFormat::defaultFormat(); - } - - if (testAttribute(Qt::WA_TranslucentBackground)) - format.setAlpha(true); - - return format; -} - void QWidgetPrivate::createSysExtra() { } @@ -765,23 +802,27 @@ void QWidgetPrivate::deleteSysExtra() void QWidgetPrivate::createTLSysExtra() { + Q_Q(QWidget); + extra->topextra->screenIndex = 0; + extra->topextra->window = 0; + if (q->testAttribute(Qt::WA_NativeWindow) || q->isWindow()) + extra->topextra->window = new QWidgetWindow(q); } void QWidgetPrivate::deleteTLSysExtra() { if (extra && extra->topextra) { //the toplevel might have a context with a "qglcontext associated with it. We need to - //delete the qglcontext before we delete the qplatformglcontext. + //delete the qglcontext before we delete the qplatformopenglcontext. //One unfortunate thing about this is that we potentially create a glContext just to //delete it straight afterwards. - if (extra->topextra->platformWindow) { - if (QPlatformGLContext *context = extra->topextra->platformWindow->glContext()) { - context->deleteQGLContext(); - } + if (extra->topextra->window) { + extra->topextra->window->destroy(); } setWinId(0); - delete extra->topextra->platformWindow; - extra->topextra->platformWindow = 0; + //hmmm. should we delete window.. + delete extra->topextra->window; + extra->topextra->window = 0; } } @@ -804,7 +845,8 @@ void QWidgetPrivate::updateFrameStrut() void QWidgetPrivate::setWindowOpacity_sys(qreal level) { Q_Q(QWidget); - q->platformWindow()->setOpacity(level); + if (q->windowHandle()) + q->windowHandle()->setOpacity(level); } void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) @@ -820,70 +862,63 @@ QPaintEngine *QWidget::paintEngine() const return 0; //##### @@@ } -QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() -{ - Q_Q(QWidget); - if (q->platformWindowFormat().hasWindowSurface()) - return QApplicationPrivate::platformIntegration()->createWindowSurface(q,0); - else - return 0; -} - void QWidgetPrivate::setModal_sys() { + Q_Q(QWidget); + if (q->windowHandle()) + q->windowHandle()->setWindowModality(q->windowModality()); } #ifndef QT_NO_CURSOR -void qt_qpa_set_cursor(QWidget * w, bool force) +static void applyCursor(QWidget *w, const QCursor &c) { - static QCursor arrowCursor(Qt::ArrowCursor); - static QPointer<QWidget> lastUnderMouse = 0; + QCursor cc = c; + QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances(); + int cursorCount = cursors.count(); + for (int i = 0; i < cursorCount; ++i) { + const QWeakPointer<QPlatformCursor> &cursor(cursors.at(i)); + if (cursor) + cursor.data()->changeCursor(&cc, w->window()->windowHandle()); + } +} - QCursor * override = QApplication::overrideCursor(); - - if (override && w != 0) +void qt_qpa_set_cursor(QWidget *w, bool force) +{ + if (!w->testAttribute(Qt::WA_WState_Created)) return; - QWidget *cursorWidget; - QCursor cursorCursor; + static QPointer<QWidget> lastUnderMouse = 0; + if (force) { + lastUnderMouse = w; + } else if (lastUnderMouse && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) { + w = lastUnderMouse; + } else if (!w->internalWinId()) { + return; // The mouse is not under this widget, and it's not native, so don't change it. + } - 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; - } + while (!w->internalWinId() && w->parentWidget() && !w->isWindow() + && !w->testAttribute(Qt::WA_SetCursor)) + w = w->parentWidget(); - QWidget * curWin = QApplication::activeWindow(); - if (!curWin && w && w->internalWinId()) - return; - QWidget* cW = w && !w->internalWinId() ? w : curWin; + QWidget *nativeParent = w; + if (!w->internalWinId()) + nativeParent = w->nativeParentWidget(); + if (!nativeParent || !nativeParent->internalWinId()) + return; - if (!cW || cW->window() != w->window() || - !cW->isVisible() || !cW->underMouse() || override) - return; - - cursorCursor = w->cursor(); - cursorWidget = w; - } while (0); - foreach (QWeakPointer<QPlatformCursor> cursor, QPlatformCursorPrivate::getInstances()) - if (cursor) - cursor.data()->changeCursor(&cursorCursor, cursorWidget); + if (w->isWindow() || w->testAttribute(Qt::WA_SetCursor)) { + QCursor *oc = QApplication::overrideCursor(); + if (oc) + applyCursor(nativeParent, *oc); + else if (w->isEnabled()) + applyCursor(nativeParent, w->cursor()); + else + // Enforce the windows behavior of clearing the cursor on + // disabled widgets. + applyCursor(nativeParent, Qt::ArrowCursor); + } else { + applyCursor(nativeParent, Qt::ArrowCursor); + } } #endif //QT_NO_CURSOR diff --git a/src/gui/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp similarity index 100% rename from src/gui/kernel/qwidgetaction.cpp rename to src/widgets/kernel/qwidgetaction.cpp diff --git a/src/gui/kernel/qwidgetaction.h b/src/widgets/kernel/qwidgetaction.h similarity index 96% rename from src/gui/kernel/qwidgetaction.h rename to src/widgets/kernel/qwidgetaction.h index 94a681791b3..31d58a819a2 100644 --- a/src/gui/kernel/qwidgetaction.h +++ b/src/widgets/kernel/qwidgetaction.h @@ -42,7 +42,7 @@ #ifndef QWIDGETACTION_H #define QWIDGETACTION_H -#include <QtGui/qaction.h> +#include <QtWidgets/qaction.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QWidgetActionPrivate; -class Q_GUI_EXPORT QWidgetAction : public QAction +class Q_WIDGETS_EXPORT QWidgetAction : public QAction { Q_OBJECT Q_DECLARE_PRIVATE(QWidgetAction) diff --git a/src/gui/kernel/qwidgetaction_p.h b/src/widgets/kernel/qwidgetaction_p.h similarity index 100% rename from src/gui/kernel/qwidgetaction_p.h rename to src/widgets/kernel/qwidgetaction_p.h diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp new file mode 100644 index 00000000000..d151d5e9e1f --- /dev/null +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -0,0 +1,1393 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "qplatformdefs.h" + +#include "qwidgetbackingstore_p.h" + +#include <QtCore/qglobal.h> +#include <QtCore/qdebug.h> +#include <QtCore/qvarlengtharray.h> +#include <QtGui/qevent.h> +#include <QtWidgets/qapplication.h> +#include <QtGui/qpaintengine.h> +#include <QtWidgets/qgraphicsproxywidget.h> + +#include <private/qwidget_p.h> +#include <private/qapplication_p.h> +#include <private/qpaintengine_raster_p.h> +#include <private/qgraphicseffect_p.h> + +#ifdef Q_WS_QWS +#include <QtGui/qwsmanager_qws.h> +#include <private/qwsmanager_p.h> +#endif + +QT_BEGIN_NAMESPACE + +extern QRegion qt_dirtyRegion(QWidget *); + +/* + A version of QRect::intersects() that does not normalize the rects. +*/ +static inline bool qRectIntersects(const QRect &r1, const QRect &r2) +{ + return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) + && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom())); +} + +/** + * Flushes the contents of the \a backingStore into the screen area of \a widget. + * \a tlwOffset is the position of the top level widget relative to the window surface. + * \a region is the region to be updated in \a widget coordinates. + */ +static inline void qt_flush(QWidget *widget, const QRegion ®ion, QBackingStore *backingStore, + QWidget *tlw, const QPoint &tlwOffset) +{ + Q_ASSERT(widget); + Q_ASSERT(!region.isEmpty()); + Q_ASSERT(backingStore); + Q_ASSERT(tlw); + +#if !defined(QT_NO_PAINT_DEBUG) + static int flushUpdate = qgetenv("QT_FLUSH_UPDATE").toInt(); + if (flushUpdate > 0) + 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) + backingStore->flush(region, widget->windowHandle(), tlwOffset + widget->mapTo(tlw, QPoint())); + else + backingStore->flush(region, widget->windowHandle(), tlwOffset); +} + +#ifndef QT_NO_PAINT_DEBUG +#ifdef Q_WS_WIN +static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec) +{ + HBRUSH brush; + static int i = 0; + switch (i) { + case 0: + brush = CreateSolidBrush(RGB(255, 255, 0)); + break; + case 1: + brush = CreateSolidBrush(RGB(255, 200, 55)); + break; + case 2: + brush = CreateSolidBrush(RGB(200, 255, 55)); + break; + case 3: + brush = CreateSolidBrush(RGB(200, 200, 0)); + break; + } + i = (i + 1) & 3; + + HDC hdc = widget->getDC(); + + const QVector<QRect> &rects = region.rects(); + foreach (QRect rect, rects) { + RECT winRect; + SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom()); + FillRect(hdc, &winRect, brush); + } + + widget->releaseDC(hdc); + ::Sleep(msec); +} +#endif + +void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped) +{ +#ifdef Q_WS_QWS + Q_UNUSED(widget); + Q_UNUSED(unclipped); + static QWSYellowSurface surface(true); + surface.setDelay(msec); + surface.flush(widget, toBePainted, QPoint()); +#else + QRegion paintRegion = toBePainted; + QRect widgetRect = widget->rect(); + + if (!widget->internalWinId()) { + QWidget *nativeParent = widget->nativeParentWidget(); + const QPoint offset = widget->mapTo(nativeParent, QPoint(0, 0)); + paintRegion.translate(offset); + widgetRect.translate(offset); + widget = nativeParent; + } + +#ifdef Q_WS_WIN + Q_UNUSED(unclipped); + showYellowThing_win(widget, paintRegion, msec); +#else + //flags to fool painter + bool paintUnclipped = widget->testAttribute(Qt::WA_PaintUnclipped); + if (unclipped && !widget->d_func()->paintOnScreen()) + widget->setAttribute(Qt::WA_PaintUnclipped); + + const bool setFlag = !widget->testAttribute(Qt::WA_WState_InPaintEvent); + if (setFlag) + widget->setAttribute(Qt::WA_WState_InPaintEvent); + + //setup the engine + QPaintEngine *pe = widget->paintEngine(); + if (pe) { + pe->setSystemClip(paintRegion); + { + QPainter p(widget); + p.setClipRegion(paintRegion); + static int i = 0; + switch (i) { + case 0: + p.fillRect(widgetRect, QColor(255,255,0)); + break; + case 1: + p.fillRect(widgetRect, QColor(255,200,55)); + break; + case 2: + p.fillRect(widgetRect, QColor(200,255,55)); + break; + case 3: + p.fillRect(widgetRect, QColor(200,200,0)); + break; + } + i = (i+1) & 3; + p.end(); + } + } + + if (setFlag) + widget->setAttribute(Qt::WA_WState_InPaintEvent, false); + + //restore + widget->setAttribute(Qt::WA_PaintUnclipped, paintUnclipped); + + if (pe) + pe->setSystemClip(QRegion()); + + QApplication::syncX(); + +#if defined(Q_OS_UNIX) + ::usleep(1000 * msec); +#endif +#endif // Q_WS_WIN +#endif // Q_WS_QWS +} + +bool QWidgetBackingStore::flushPaint(QWidget *widget, const QRegion &rgn) +{ + if (!widget) + return false; + + int delay = 0; + if (widget->testAttribute(Qt::WA_WState_InPaintEvent)) { + static int flushPaintEvent = qgetenv("QT_FLUSH_PAINT_EVENT").toInt(); + if (!flushPaintEvent) + return false; + delay = flushPaintEvent; + } else { + static int flushPaint = qgetenv("QT_FLUSH_PAINT").toInt(); + if (!flushPaint) + return false; + delay = flushPaint; + } + + QWidgetBackingStore::showYellowThing(widget, rgn, delay * 10, true); + return true; +} + +void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn) +{ + if (widget->d_func()->paintOnScreen() || rgn.isEmpty()) + return; + + QWidget *tlw = widget->window(); + QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); + if (!tlwExtra) + return; + + const QPoint offset = widget->mapTo(tlw, QPoint()); + qt_flush(widget, rgn, tlwExtra->backingStoreTracker->store, tlw, offset); +} +#endif // QT_NO_PAINT_DEBUG + +/* + Moves the whole rect by (dx, dy) in widget's coordinate system. + Doesn't generate any updates. +*/ +bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *widget) +{ + const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft())); + const QRect tlwRect(QRect(pos, rect.size())); + if (fullUpdatePending || dirty.intersects(tlwRect)) + return false; // We don't want to scroll junk. + return store->scroll(tlwRect, dx, dy); +} + +void QWidgetBackingStore::releaseBuffer() +{ + if (store) + store->resize(QSize()); +} + +/*! + Prepares the window surface to paint a\ toClean region of the \a widget and + updates the BeginPaintInfo struct accordingly. + + The \a toClean region might be clipped by the window surface. +*/ +void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QBackingStore *backingStore, + BeginPaintInfo *returnInfo, bool toCleanIsInTopLevelCoordinates) +{ + Q_UNUSED(widget); + Q_UNUSED(toCleanIsInTopLevelCoordinates); + + // Always flush repainted areas. + dirtyOnScreen += toClean; + +#ifdef QT_NO_PAINT_DEBUG + backingStore->beginPaint(toClean); +#else + returnInfo->wasFlushed = QWidgetBackingStore::flushPaint(tlw, toClean); + // Avoid deadlock with QT_FLUSH_PAINT: the server will wait for + // the BackingStore lock, so if we hold that, the server will + // never release the Communication lock that we are waiting for in + // sendSynchronousCommand + if (!returnInfo->wasFlushed) + backingStore->beginPaint(toClean); +#endif + + Q_UNUSED(returnInfo); +} + +void QWidgetBackingStore::endPaint(const QRegion &cleaned, QBackingStore *backingStore, + BeginPaintInfo *beginPaintInfo) +{ +#ifndef QT_NO_PAINT_DEBUG + if (!beginPaintInfo->wasFlushed) + backingStore->endPaint(); + else + QWidgetBackingStore::unflushPaint(tlw, cleaned); +#else + Q_UNUSED(beginPaintInfo); + Q_UNUSED(cleaned); + backingStore->endPaint(); +#endif + + flush(); +} + +/*! + Returns the region (in top-level coordinates) that needs repaint and/or flush. + + If the widget is non-zero, only the dirty region for the widget is returned + and the region will be in widget coordinates. +*/ +QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const +{ + const bool widgetDirty = widget && widget != tlw; + const QRect tlwRect(topLevelRect()); + const QRect surfaceGeometry(tlwRect.topLeft(), store->size()); + if (fullUpdatePending || (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size())) { + if (widgetDirty) { + const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size()); + const QPoint offset(widget->mapTo(tlw, QPoint())); + const QRect dirtyWidgetRect(dirtyTlwRect & widget->rect().translated(offset)); + return dirtyWidgetRect.translated(-offset); + } + return QRect(QPoint(), tlwRect.size()); + } + + // Calculate the region that needs repaint. + QRegion r(dirty); + for (int i = 0; i < dirtyWidgets.size(); ++i) { + QWidget *w = dirtyWidgets.at(i); + if (widgetDirty && w != widget && !widget->isAncestorOf(w)) + continue; + r += w->d_func()->dirty.translated(w->mapTo(tlw, QPoint())); + } + + // Append the region that needs flush. + r += dirtyOnScreen; + + if (dirtyOnScreenWidgets) { // Only in use with native child widgets. + for (int i = 0; i < dirtyOnScreenWidgets->size(); ++i) { + QWidget *w = dirtyOnScreenWidgets->at(i); + if (widgetDirty && w != widget && !widget->isAncestorOf(w)) + continue; + QWidgetPrivate *wd = w->d_func(); + Q_ASSERT(wd->needsFlush); + r += wd->needsFlush->translated(w->mapTo(tlw, QPoint())); + } + } + + if (widgetDirty) { + // Intersect with the widget geometry and translate to its coordinates. + const QPoint offset(widget->mapTo(tlw, QPoint())); + r &= widget->rect().translated(offset); + r.translate(-offset); + } + return r; +} + +/*! + Returns the static content inside the \a parent if non-zero; otherwise the static content + for the entire backing store is returned. The content will be clipped to \a withinClipRect + if non-empty. +*/ +QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &withinClipRect) const +{ + if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) { + const QSize surfaceGeometry(store->size()); + QRect surfaceRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); + if (!withinClipRect.isEmpty()) + surfaceRect &= withinClipRect; + return QRegion(surfaceRect); + } + + QRegion region; + if (parent && parent->d_func()->children.isEmpty()) + return region; + + const bool clipToRect = !withinClipRect.isEmpty(); + const int count = staticWidgets.count(); + for (int i = 0; i < count; ++i) { + QWidget *w = staticWidgets.at(i); + QWidgetPrivate *wd = w->d_func(); + if (!wd->isOpaque || !wd->extra || wd->extra->staticContentsSize.isEmpty() + || !w->isVisible() || (parent && !parent->isAncestorOf(w))) { + continue; + } + + QRect rect(0, 0, wd->extra->staticContentsSize.width(), wd->extra->staticContentsSize.height()); + const QPoint offset = w->mapTo(parent ? parent : tlw, QPoint()); + if (clipToRect) + rect &= withinClipRect.translated(-offset); + if (rect.isEmpty()) + continue; + + rect &= wd->clipRect(); + if (rect.isEmpty()) + continue; + + QRegion visible(rect); + wd->clipToEffectiveMask(visible); + if (visible.isEmpty()) + continue; + wd->subtractOpaqueSiblings(visible, 0, /*alsoNonOpaque=*/true); + + visible.translate(offset); + region += visible; + } + + return region; +} + +static inline void sendUpdateRequest(QWidget *widget, bool updateImmediately) +{ + if (!widget) + return; + + if (updateImmediately) { + QEvent event(QEvent::UpdateRequest); + QApplication::sendEvent(widget, &event); + } else { + QApplication::postEvent(widget, new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority); + } +} + +/*! + Marks the region of the widget as dirty (if not already marked as dirty) and + posts an UpdateRequest event to the top-level widget (if not already posted). + + If updateImmediately is true, the event is sent immediately instead of posted. + + If invalidateBuffer is true, all widgets intersecting with the region will be dirty. + + If the widget paints directly on screen, the event is sent to the widget + instead of the top-level widget, and invalidateBuffer is completely ignored. + + ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). +*/ +void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately, + bool invalidateBuffer) +{ + Q_ASSERT(tlw->d_func()->extra); + Q_ASSERT(tlw->d_func()->extra->topextra); + Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize); + Q_ASSERT(widget->isVisible() && widget->updatesEnabled()); + Q_ASSERT(widget->window() == tlw); + Q_ASSERT(!rgn.isEmpty()); + +#ifndef QT_NO_GRAPHICSEFFECT + widget->d_func()->invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT + + if (widget->d_func()->paintOnScreen()) { + if (widget->d_func()->dirty.isEmpty()) { + widget->d_func()->dirty = rgn; + sendUpdateRequest(widget, updateImmediately); + return; + } else if (qt_region_strictContains(widget->d_func()->dirty, widget->rect())) { + if (updateImmediately) + sendUpdateRequest(widget, updateImmediately); + return; // Already dirty. + } + + const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty(); + widget->d_func()->dirty += rgn; + if (!eventAlreadyPosted || updateImmediately) + sendUpdateRequest(widget, updateImmediately); + return; + } + + if (fullUpdatePending) { + if (updateImmediately) + sendUpdateRequest(tlw, updateImmediately); + return; + } + + const QPoint offset = widget->mapTo(tlw, QPoint()); + const QRect widgetRect = widget->d_func()->effectiveRectFor(widget->rect()); + if (qt_region_strictContains(dirty, widgetRect.translated(offset))) { + if (updateImmediately) + sendUpdateRequest(tlw, updateImmediately); + return; // Already dirty. + } + + if (invalidateBuffer) { + const bool eventAlreadyPosted = !dirty.isEmpty(); +#ifndef QT_NO_GRAPHICSEFFECT + if (widget->d_func()->graphicsEffect) + dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset); + else +#endif //QT_NO_GRAPHICSEFFECT + dirty += rgn.translated(offset); + if (!eventAlreadyPosted || updateImmediately) + sendUpdateRequest(tlw, updateImmediately); + return; + } + + if (dirtyWidgets.isEmpty()) { + addDirtyWidget(widget, rgn); + sendUpdateRequest(tlw, updateImmediately); + return; + } + + if (widget->d_func()->inDirtyList) { + if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) { +#ifndef QT_NO_GRAPHICSEFFECT + if (widget->d_func()->graphicsEffect) + widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()); + else +#endif //QT_NO_GRAPHICSEFFECT + widget->d_func()->dirty += rgn; + } + } else { + addDirtyWidget(widget, rgn); + } + + if (updateImmediately) + sendUpdateRequest(tlw, updateImmediately); +} + +/*! + This function is equivalent to calling markDirty(QRegion(rect), ...), but + is more efficient as it eliminates QRegion operations/allocations and can + use the rect more precisely for additional cut-offs. + + ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). +*/ +void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool updateImmediately, + bool invalidateBuffer) +{ + Q_ASSERT(tlw->d_func()->extra); + Q_ASSERT(tlw->d_func()->extra->topextra); + Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize); + Q_ASSERT(widget->isVisible() && widget->updatesEnabled()); + Q_ASSERT(widget->window() == tlw); + Q_ASSERT(!rect.isEmpty()); + +#ifndef QT_NO_GRAPHICSEFFECT + widget->d_func()->invalidateGraphicsEffectsRecursively(); +#endif //QT_NO_GRAPHICSEFFECT + + if (widget->d_func()->paintOnScreen()) { + if (widget->d_func()->dirty.isEmpty()) { + widget->d_func()->dirty = QRegion(rect); + sendUpdateRequest(widget, updateImmediately); + return; + } else if (qt_region_strictContains(widget->d_func()->dirty, rect)) { + if (updateImmediately) + sendUpdateRequest(widget, updateImmediately); + return; // Already dirty. + } + + const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty(); + widget->d_func()->dirty += rect; + if (!eventAlreadyPosted || updateImmediately) + sendUpdateRequest(widget, updateImmediately); + return; + } + + if (fullUpdatePending) { + if (updateImmediately) + sendUpdateRequest(tlw, updateImmediately); + return; + } + + const QRect widgetRect = widget->d_func()->effectiveRectFor(rect); + const QRect translatedRect(widgetRect.translated(widget->mapTo(tlw, QPoint()))); + if (qt_region_strictContains(dirty, translatedRect)) { + if (updateImmediately) + sendUpdateRequest(tlw, updateImmediately); + return; // Already dirty + } + + if (invalidateBuffer) { + const bool eventAlreadyPosted = !dirty.isEmpty(); + dirty += translatedRect; + if (!eventAlreadyPosted || updateImmediately) + sendUpdateRequest(tlw, updateImmediately); + return; + } + + if (dirtyWidgets.isEmpty()) { + addDirtyWidget(widget, rect); + sendUpdateRequest(tlw, updateImmediately); + return; + } + + if (widget->d_func()->inDirtyList) { + if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) + widget->d_func()->dirty += widgetRect; + } else { + addDirtyWidget(widget, rect); + } + + if (updateImmediately) + sendUpdateRequest(tlw, updateImmediately); +} + +/*! + Marks the \a region of the \a widget as dirty on screen. The \a region will be copied from + the backing store to the \a widget's native parent next time flush() is called. + + Paint on screen widgets are ignored. +*/ +void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widget, const QPoint &topLevelOffset) +{ + if (!widget || widget->d_func()->paintOnScreen() || region.isEmpty()) + return; + +#if defined(Q_WS_QWS) || defined(Q_WS_MAC) + if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) + dirtyOnScreen += region.translated(topLevelOffset); + return; +#endif + + // Top-level. + if (widget == tlw) { + if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) + dirtyOnScreen += region; + return; + } + + // Alien widgets. + if (!widget->internalWinId() && !widget->isWindow()) { + QWidget *nativeParent = widget->nativeParentWidget(); // Alien widgets with the top-level as the native parent (common case). + if (nativeParent == tlw) { + if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) + dirtyOnScreen += region.translated(topLevelOffset); + return; + } + + // Alien widgets with native parent != tlw. + QWidgetPrivate *nativeParentPrivate = nativeParent->d_func(); + if (!nativeParentPrivate->needsFlush) + nativeParentPrivate->needsFlush = new QRegion; + const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint()); + *nativeParentPrivate->needsFlush += region.translated(nativeParentOffset); + appendDirtyOnScreenWidget(nativeParent); + return; + } + + // Native child widgets. + QWidgetPrivate *widgetPrivate = widget->d_func(); + if (!widgetPrivate->needsFlush) + widgetPrivate->needsFlush = new QRegion; + *widgetPrivate->needsFlush += region; + appendDirtyOnScreenWidget(widget); +} + +void QWidgetBackingStore::removeDirtyWidget(QWidget *w) +{ + if (!w) + return; + + dirtyWidgetsRemoveAll(w); + dirtyOnScreenWidgetsRemoveAll(w); + resetWidget(w); + + QWidgetPrivate *wd = w->d_func(); + const int n = wd->children.count(); + for (int i = 0; i < n; ++i) { + if (QWidget *child = qobject_cast<QWidget*>(wd->children.at(i))) + removeDirtyWidget(child); + } +} + +void QWidgetBackingStore::updateLists(QWidget *cur) +{ + if (!cur) + return; + + QList<QObject*> children = cur->children(); + for (int i = 0; i < children.size(); ++i) { + QWidget *child = qobject_cast<QWidget*>(children.at(i)); + if (!child) + continue; + + updateLists(child); + } + + if (cur->testAttribute(Qt::WA_StaticContents)) + addStaticWidget(cur); +} + +QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel) + : tlw(topLevel), dirtyOnScreenWidgets(0), hasDirtyFromPreviousSync(false) + , fullUpdatePending(0) +{ + store = tlw->backingStore(); + Q_ASSERT(store); + + // Ensure all existing subsurfaces and static widgets are added to their respective lists. + updateLists(topLevel); +} + +QWidgetBackingStore::~QWidgetBackingStore() +{ + for (int c = 0; c < dirtyWidgets.size(); ++c) { + resetWidget(dirtyWidgets.at(c)); + } + + delete dirtyOnScreenWidgets; + dirtyOnScreenWidgets = 0; +} + +//parent's coordinates; move whole rect; update parent and widget +//assume the screen blt has already been done, so we don't need to refresh that part +void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) +{ + Q_Q(QWidget); + if (!q->isVisible() || (dx == 0 && dy == 0)) + return; + + QWidget *tlw = q->window(); + QTLWExtra* x = tlw->d_func()->topData(); + if (x->inTopLevelResize) + return; + + static int accelEnv = -1; + if (accelEnv == -1) { + accelEnv = qgetenv("QT_NO_FAST_MOVE").toInt() == 0; + } + + QWidget *pw = q->parentWidget(); + QPoint toplevelOffset = pw->mapTo(tlw, QPoint()); + QWidgetPrivate *pd = pw->d_func(); + QRect clipR(pd->clipRect()); +#ifdef Q_WS_QWS + QWidgetBackingStore *wbs = x->backingStore.data(); + QWSWindowSurface *surface = static_cast<QWSWindowSurface*>(wbs->windowSurface); + clipR = clipR.intersected(surface->clipRegion().translated(-toplevelOffset).boundingRect()); +#endif + const QRect newRect(rect.translated(dx, dy)); + QRect destRect = rect.intersected(clipR); + if (destRect.isValid()) + destRect = destRect.translated(dx, dy).intersected(clipR); + const QRect sourceRect(destRect.translated(-dx, -dy)); + const QRect parentRect(rect & clipR); + + bool accelerateMove = accelEnv && isOpaque +#ifndef QT_NO_GRAPHICSVIEW + // No accelerate move for proxy widgets. + && !tlw->d_func()->extra->proxyWidget +#endif + && !isOverlapped(sourceRect) && !isOverlapped(destRect); + + if (!accelerateMove) { + QRegion parentR(effectiveRectFor(parentRect)); + if (!extra || !extra->hasMask) { + parentR -= newRect; + } else { + // invalidateBuffer() excludes anything outside the mask + parentR += newRect & clipR; + } + pd->invalidateBuffer(parentR); + invalidateBuffer((newRect & clipR).translated(-data.crect.topLeft())); + } else { + + QWidgetBackingStore *wbs = x->backingStoreTracker.data(); + QRegion childExpose(newRect & clipR); + + if (sourceRect.isValid() && wbs->bltRect(sourceRect, dx, dy, pw)) + childExpose -= destRect; + + if (!pw->updatesEnabled()) + return; + + const bool childUpdatesEnabled = q->updatesEnabled(); + if (childUpdatesEnabled && !childExpose.isEmpty()) { + childExpose.translate(-data.crect.topLeft()); + wbs->markDirty(childExpose, q); + isMoved = true; + } + + QRegion parentExpose(parentRect); + parentExpose -= newRect; + if (extra && extra->hasMask) + parentExpose += QRegion(newRect) - extra->mask.translated(data.crect.topLeft()); + + if (!parentExpose.isEmpty()) { + wbs->markDirty(parentExpose, pw); + pd->isMoved = true; + } + + if (childUpdatesEnabled) { + QRegion needsFlush(sourceRect); + needsFlush += destRect; + wbs->markDirtyOnScreen(needsFlush, pw, toplevelOffset); + } + } +} + +//widget's coordinates; scroll within rect; only update widget +void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) +{ + Q_Q(QWidget); + QWidget *tlw = q->window(); + QTLWExtra* x = tlw->d_func()->topData(); + if (x->inTopLevelResize) + return; + + QWidgetBackingStore *wbs = x->backingStoreTracker.data(); + if (!wbs) + return; + + static int accelEnv = -1; + if (accelEnv == -1) { + accelEnv = qgetenv("QT_NO_FAST_SCROLL").toInt() == 0; + } + + QRect scrollRect = rect & clipRect(); + bool overlapped = false; + bool accelerateScroll = accelEnv && isOpaque + && !(overlapped = isOverlapped(scrollRect.translated(data.crect.topLeft()))); + +#if defined(Q_WS_QWS) + QWSWindowSurface *surface; + surface = static_cast<QWSWindowSurface*>(wbs->windowSurface); + + if (accelerateScroll && !surface->isBuffered()) { + const QRegion surfaceClip = surface->clipRegion(); + const QRegion outsideClip = QRegion(rect) - surfaceClip; + if (!outsideClip.isEmpty()) { + const QVector<QRect> clipped = (surfaceClip & rect).rects(); + if (clipped.size() < 8) { + for (int i = 0; i < clipped.size(); ++i) + this->scrollRect(clipped.at(i), dx, dy); + return; + } else { + accelerateScroll = false; + } + } + } +#endif // Q_WS_QWS + + if (!accelerateScroll) { + if (overlapped) { + QRegion region(scrollRect); + subtractOpaqueSiblings(region); + invalidateBuffer(region); + }else { + invalidateBuffer(scrollRect); + } + } else { + const QPoint toplevelOffset = q->mapTo(tlw, QPoint()); +#ifdef Q_WS_QWS + QWSWindowSurface *surface = static_cast<QWSWindowSurface*>(wbs->windowSurface); + const QRegion clip = surface->clipRegion().translated(-toplevelOffset) & scrollRect; + const QRect clipBoundingRect = clip.boundingRect(); + scrollRect &= clipBoundingRect; +#endif + const QRect destRect = scrollRect.translated(dx, dy) & scrollRect; + const QRect sourceRect = destRect.translated(-dx, -dy); + + QRegion childExpose(scrollRect); + if (sourceRect.isValid()) { + if (wbs->bltRect(sourceRect, dx, dy, q)) + childExpose -= destRect; + } + + if (inDirtyList) { + if (rect == q->rect()) { + dirty.translate(dx, dy); + } else { + QRegion dirtyScrollRegion = dirty.intersected(scrollRect); + if (!dirtyScrollRegion.isEmpty()) { + dirty -= dirtyScrollRegion; + dirtyScrollRegion.translate(dx, dy); + dirty += dirtyScrollRegion; + } + } + } + + if (!q->updatesEnabled()) + return; + + if (!childExpose.isEmpty()) { + wbs->markDirty(childExpose, q); + isScrolled = true; + } + + // Instead of using native scroll-on-screen, we copy from + // backingstore, giving only one screen update for each + // scroll, and a solid appearance + wbs->markDirtyOnScreen(destRect, q, toplevelOffset); + } +} + +static inline bool discardSyncRequest(QWidget *tlw, QTLWExtra *tlwExtra) +{ + if (!tlw || !tlwExtra) + return true; + +#ifdef Q_WS_X11 + // Delay the sync until we get an Expose event from X11 (initial show). + // Qt::WA_Mapped is set to true, but the actual mapping has not yet occurred. + // However, we must repaint immediately regardless of the state if someone calls repaint(). + if (tlwExtra->waitingForMapNotify && !tlwExtra->inRepaint) + return true; +#endif + + if (!tlw->testAttribute(Qt::WA_Mapped)) + return true; + + if (!tlw->isVisible() +#ifndef Q_WS_X11 + // If we're minimized on X11, WA_Mapped will be false and we + // will return in the case above. Some window managers on X11 + // sends us the PropertyNotify to change the minimized state + // *AFTER* we've received the expose event, which is baaad. + || tlw->isMinimized() +#endif + ) + return true; + + return false; +} + +/*! + Synchronizes the \a exposedRegion of the \a exposedWidget with the backing store. + + If there's nothing to repaint, the area is flushed and painting does not occur; + otherwise the area is marked as dirty on screen and will be flushed right after + we are done with all painting. +*/ +void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedRegion) +{ + QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); + if (discardSyncRequest(tlw, tlwExtra) || tlwExtra->inTopLevelResize) + return; + + if (!exposedWidget || !exposedWidget->internalWinId() || !exposedWidget->isVisible() + || !exposedWidget->updatesEnabled() || exposedRegion.isEmpty()) { + return; + } + + // Nothing to repaint. + if (!isDirty()) { + qt_flush(exposedWidget, exposedRegion, store, tlw, tlwOffset); + return; + } + + if (exposedWidget != tlw) + markDirtyOnScreen(exposedRegion, exposedWidget, exposedWidget->mapTo(tlw, QPoint())); + else + markDirtyOnScreen(exposedRegion, exposedWidget, QPoint()); + sync(); +} + +/*! + Synchronizes the backing store, i.e. dirty areas are repainted and flushed. +*/ +void QWidgetBackingStore::sync() +{ + QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); + if (discardSyncRequest(tlw, tlwExtra)) { + // If the top-level is minimized, it's not visible on the screen so we can delay the + // update until it's shown again. In order to do that we must keep the dirty states. + // These will be cleared when we receive the first expose after showNormal(). + // However, if the widget is not visible (isVisible() returns false), everything will + // be invalidated once the widget is shown again, so clear all dirty states. + if (!tlw->isVisible()) { + dirty = QRegion(); + for (int i = 0; i < dirtyWidgets.size(); ++i) + resetWidget(dirtyWidgets.at(i)); + dirtyWidgets.clear(); + fullUpdatePending = false; + } + return; + } + + const bool updatesDisabled = !tlw->updatesEnabled(); + bool repaintAllWidgets = false; + + const bool inTopLevelResize = tlwExtra->inTopLevelResize; + const QRect tlwRect(topLevelRect()); + const QRect surfaceGeometry(tlwRect.topLeft(), store->size()); + if ((fullUpdatePending || inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) { + if (hasStaticContents()) { + // Repaint existing dirty area and newly visible area. + const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); + const QRegion staticRegion(staticContents(0, clipRect)); + QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height()); + newVisible -= staticRegion; + dirty += newVisible; + store->setStaticContents(staticRegion); + } else { + // Repaint everything. + dirty = QRegion(0, 0, tlwRect.width(), tlwRect.height()); + for (int i = 0; i < dirtyWidgets.size(); ++i) + resetWidget(dirtyWidgets.at(i)); + dirtyWidgets.clear(); + repaintAllWidgets = true; + } + } + + if (inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) + store->resize(tlwRect.size()); + + if (updatesDisabled) + return; + + if (hasDirtyFromPreviousSync) + dirty += dirtyFromPreviousSync; + + // Contains everything that needs repaint. + QRegion toClean(dirty); + + // Loop through all update() widgets and remove them from the list before they are + // painted (in case someone calls update() in paintEvent). If the widget is opaque + // and does not have transparent overlapping siblings, append it to the + // opaqueNonOverlappedWidgets list and paint it directly without composition. + QVarLengthArray<QWidget *, 32> opaqueNonOverlappedWidgets; + for (int i = 0; i < dirtyWidgets.size(); ++i) { + QWidget *w = dirtyWidgets.at(i); + QWidgetPrivate *wd = w->d_func(); + if (wd->data.in_destructor) + continue; + + // Clip with mask() and clipRect(). + wd->dirty &= wd->clipRect(); + wd->clipToEffectiveMask(wd->dirty); + + // Subtract opaque siblings and children. + bool hasDirtySiblingsAbove = false; + // We know for sure that the widget isn't overlapped if 'isMoved' is true. + if (!wd->isMoved) + wd->subtractOpaqueSiblings(wd->dirty, &hasDirtySiblingsAbove); + // Scrolled and moved widgets must draw all children. + if (!wd->isScrolled && !wd->isMoved) + wd->subtractOpaqueChildren(wd->dirty, w->rect()); + + if (wd->dirty.isEmpty()) { + resetWidget(w); + continue; + } + + const QRegion widgetDirty(w != tlw ? wd->dirty.translated(w->mapTo(tlw, QPoint())) + : wd->dirty); + toClean += widgetDirty; + +#ifndef QT_NO_GRAPHICSVIEW + if (tlw->d_func()->extra->proxyWidget) { + resetWidget(w); + continue; + } +#endif + + if (!hasDirtySiblingsAbove && wd->isOpaque && !dirty.intersects(widgetDirty.boundingRect())) { + opaqueNonOverlappedWidgets.append(w); + } else { + resetWidget(w); + dirty += widgetDirty; + } + } + dirtyWidgets.clear(); + + fullUpdatePending = false; + + if (toClean.isEmpty()) { + // Nothing to repaint. However, we might have newly exposed areas on the + // screen if this function was called from sync(QWidget *, QRegion)), so + // we have to make sure those are flushed. + flush(); + return; + } + +#ifndef QT_NO_GRAPHICSVIEW + if (tlw->d_func()->extra->proxyWidget) { + updateStaticContentsSize(); + dirty = QRegion(); + const QVector<QRect> rects(toClean.rects()); + for (int i = 0; i < rects.size(); ++i) + tlw->d_func()->extra->proxyWidget->update(rects.at(i)); + return; + } +#endif + + BeginPaintInfo beginPaintInfo; + beginPaint(toClean, tlw, store, &beginPaintInfo); + if (beginPaintInfo.nothingToPaint) { + for (int i = 0; i < opaqueNonOverlappedWidgets.size(); ++i) + resetWidget(opaqueNonOverlappedWidgets[i]); + dirty = QRegion(); + return; + } + + // Must do this before sending any paint events because + // the size may change in the paint event. + updateStaticContentsSize(); + const QRegion dirtyCopy(dirty); + dirty = QRegion(); + + // Paint opaque non overlapped widgets. + for (int i = 0; i < opaqueNonOverlappedWidgets.size(); ++i) { + QWidget *w = opaqueNonOverlappedWidgets[i]; + QWidgetPrivate *wd = w->d_func(); + + int flags = QWidgetPrivate::DrawRecursive; + // Scrolled and moved widgets must draw all children. + if (!wd->isScrolled && !wd->isMoved) + flags |= QWidgetPrivate::DontDrawOpaqueChildren; + if (w == tlw) + flags |= QWidgetPrivate::DrawAsRoot; + + QRegion toBePainted(wd->dirty); + resetWidget(w); + + QPoint offset(tlwOffset); + if (w != tlw) + offset += w->mapTo(tlw, QPoint()); + wd->drawWidget(store->paintDevice(), toBePainted, offset, flags, 0, this); + } + + // Paint the rest with composition. + if (repaintAllWidgets || !dirtyCopy.isEmpty()) { + const int flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive; + tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, tlwOffset, flags, 0, this); + } + + endPaint(toClean, store, &beginPaintInfo); +} + +/*! + Flushes the contents of the backing store into the top-level widget. + If the \a widget is non-zero, the content is flushed to the \a widget. + If the \a surface is non-zero, the content of the \a surface is flushed. +*/ +void QWidgetBackingStore::flush(QWidget *widget, QBackingStore *backingStore) +{ + if (!dirtyOnScreen.isEmpty()) { + QWidget *target = widget ? widget : tlw; + QBackingStore *source = store ? store : backingStore; + qt_flush(target, dirtyOnScreen, source, tlw, tlwOffset); + dirtyOnScreen = QRegion(); + } + + if (!dirtyOnScreenWidgets || dirtyOnScreenWidgets->isEmpty()) + return; + + for (int i = 0; i < dirtyOnScreenWidgets->size(); ++i) { + QWidget *w = dirtyOnScreenWidgets->at(i); + QWidgetPrivate *wd = w->d_func(); + Q_ASSERT(wd->needsFlush); + qt_flush(w, *wd->needsFlush, backingStore, tlw, tlwOffset); + *wd->needsFlush = QRegion(); + } + dirtyOnScreenWidgets->clear(); +} + +static inline bool discardInvalidateBufferRequest(QWidget *widget, QTLWExtra *tlwExtra) +{ + Q_ASSERT(widget); + if (QApplication::closingDown()) + return true; + + if (!tlwExtra || tlwExtra->inTopLevelResize || !tlwExtra->backingStore) + return true; + + if (!widget->isVisible() || !widget->updatesEnabled()) + return true; + + return false; +} + +/*! + Invalidates the buffer when the widget is resized. + Static areas are never invalidated unless absolutely needed. +*/ +void QWidgetPrivate::invalidateBuffer_resizeHelper(const QPoint &oldPos, const QSize &oldSize) +{ + Q_Q(QWidget); + Q_ASSERT(!q->isWindow()); + Q_ASSERT(q->parentWidget()); + + const bool staticContents = q->testAttribute(Qt::WA_StaticContents); + const bool sizeDecreased = (data.crect.width() < oldSize.width()) + || (data.crect.height() < oldSize.height()); + + const QPoint offset(data.crect.x() - oldPos.x(), data.crect.y() - oldPos.y()); + const bool parentAreaExposed = !offset.isNull() || sizeDecreased; + const QRect newWidgetRect(q->rect()); + const QRect oldWidgetRect(0, 0, oldSize.width(), oldSize.height()); + + if (!staticContents || graphicsEffect) { + QRegion staticChildren; + QWidgetBackingStore *bs = 0; + if (offset.isNull() && (bs = maybeBackingStore())) + staticChildren = bs->staticContents(q, oldWidgetRect); + const bool hasStaticChildren = !staticChildren.isEmpty(); + + if (hasStaticChildren) { + QRegion dirty(newWidgetRect); + dirty -= staticChildren; + invalidateBuffer(dirty); + } else { + // Entire widget needs repaint. + invalidateBuffer(newWidgetRect); + } + + if (!parentAreaExposed) + return; + + // Invalidate newly exposed area of the parent. + if (!graphicsEffect && extra && extra->hasMask) { + QRegion parentExpose(extra->mask.translated(oldPos)); + parentExpose &= QRect(oldPos, oldSize); + if (hasStaticChildren) + parentExpose -= data.crect; // Offset is unchanged, safe to do this. + q->parentWidget()->d_func()->invalidateBuffer(parentExpose); + } else { + if (hasStaticChildren && !graphicsEffect) { + QRegion parentExpose(QRect(oldPos, oldSize)); + parentExpose -= data.crect; // Offset is unchanged, safe to do this. + q->parentWidget()->d_func()->invalidateBuffer(parentExpose); + } else { + q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(QRect(oldPos, oldSize))); + } + } + return; + } + + // Move static content to its new position. + if (!offset.isNull()) { + if (sizeDecreased) { + const QSize minSize(qMin(oldSize.width(), data.crect.width()), + qMin(oldSize.height(), data.crect.height())); + moveRect(QRect(oldPos, minSize), offset.x(), offset.y()); + } else { + moveRect(QRect(oldPos, oldSize), offset.x(), offset.y()); + } + } + + // Invalidate newly visible area of the widget. + if (!sizeDecreased || !oldWidgetRect.contains(newWidgetRect)) { + QRegion newVisible(newWidgetRect); + newVisible -= oldWidgetRect; + invalidateBuffer(newVisible); + } + + if (!parentAreaExposed) + return; + + // Invalidate newly exposed area of the parent. + const QRect oldRect(oldPos, oldSize); + if (extra && extra->hasMask) { + QRegion parentExpose(oldRect); + parentExpose &= extra->mask.translated(oldPos); + parentExpose -= (extra->mask.translated(data.crect.topLeft()) & data.crect); + q->parentWidget()->d_func()->invalidateBuffer(parentExpose); + } else { + QRegion parentExpose(oldRect); + parentExpose -= data.crect; + q->parentWidget()->d_func()->invalidateBuffer(parentExpose); + } +} + +/*! + Invalidates the \a rgn (in widget's coordinates) of the backing store, i.e. + all widgets intersecting with the region will be repainted when the backing store + is synced. + + ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). +*/ +void QWidgetPrivate::invalidateBuffer(const QRegion &rgn) +{ + Q_Q(QWidget); + + QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); + if (discardInvalidateBufferRequest(q, tlwExtra) || rgn.isEmpty()) + return; + + QRegion wrgn(rgn); + wrgn &= clipRect(); + if (!graphicsEffect && extra && extra->hasMask) + wrgn &= extra->mask; + if (wrgn.isEmpty()) + return; + + tlwExtra->backingStoreTracker->markDirty(wrgn, q, false, true); +} + +/*! + This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but + is more efficient as it eliminates QRegion operations/allocations and can + use the rect more precisely for additional cut-offs. + + ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). +*/ +void QWidgetPrivate::invalidateBuffer(const QRect &rect) +{ + Q_Q(QWidget); + + QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); + if (discardInvalidateBufferRequest(q, tlwExtra) || rect.isEmpty()) + return; + + QRect wRect(rect); + wRect &= clipRect(); + if (wRect.isEmpty()) + return; + + if (graphicsEffect || !extra || !extra->hasMask) { + tlwExtra->backingStoreTracker->markDirty(wRect, q, false, true); + return; + } + + QRegion wRgn(extra->mask); + wRgn &= wRect; + if (wRgn.isEmpty()) + return; + + tlwExtra->backingStoreTracker->markDirty(wRgn, q, false, true); +} + +void QWidgetPrivate::repaint_sys(const QRegion &rgn) +{ + if (data.in_destructor) + return; + + Q_Q(QWidget); + if (q->testAttribute(Qt::WA_StaticContents)) { + if (!extra) + createExtra(); + extra->staticContentsSize = data.crect.size(); + } + + QPaintEngine *engine = q->paintEngine(); + + // QGLWidget does not support partial updates if: + // 1) The context is double buffered + // 2) The context is single buffered and auto-fill background is enabled. + const bool noPartialUpdateSupport = (engine && (engine->type() == QPaintEngine::OpenGL + || engine->type() == QPaintEngine::OpenGL2)) + && (usesDoubleBufferedGLContext || q->autoFillBackground()); + QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn); + +#ifdef Q_WS_MAC + // No difference between update() and repaint() on the Mac. + update_sys(toBePainted); + return; +#endif + + toBePainted &= clipRect(); + clipToEffectiveMask(toBePainted); + if (toBePainted.isEmpty()) + return; // Nothing to repaint. + +#ifndef QT_NO_PAINT_DEBUG + bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted); +#endif + + drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, 0); + +#ifndef QT_NO_PAINT_DEBUG + if (flushed) + QWidgetBackingStore::unflushPaint(q, toBePainted); +#endif + + if (!q->testAttribute(Qt::WA_PaintOutsidePaintEvent) && q->paintingActive()) + qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent"); +} + + +QT_END_NAMESPACE diff --git a/src/gui/painting/qbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h similarity index 89% rename from src/gui/painting/qbackingstore_p.h rename to src/widgets/kernel/qwidgetbackingstore_p.h index 1ef2e4e1b08..4d43a903220 100644 --- a/src/gui/painting/qbackingstore_p.h +++ b/src/widgets/kernel/qwidgetbackingstore_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QBACKINGSTORE_P_H -#define QBACKINGSTORE_P_H +#ifndef QWIDGETBACKINGSTORE_P_H +#define QWIDGETBACKINGSTORE_P_H // // W A R N I N G @@ -54,22 +54,17 @@ // #include <QDebug> -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> #include <private/qwidget_p.h> -#include <private/qwindowsurface_p.h> -#ifdef Q_WS_QWS -#include <private/qwindowsurface_qws_p.h> -#endif +#include <QtGui/qbackingstore.h> QT_BEGIN_NAMESPACE -class QWindowSurface; - struct BeginPaintInfo { - inline BeginPaintInfo() : wasFlushed(0), nothingToPaint(0), windowSurfaceRecreated(0) {} + inline BeginPaintInfo() : wasFlushed(0), nothingToPaint(0), backingStoreRecreated(0) {} uint wasFlushed : 1; uint nothingToPaint : 1; - uint windowSurfaceRecreated : 1; + uint backingStoreRecreated : 1; }; class Q_AUTOTEST_EXPORT QWidgetBackingStore @@ -82,11 +77,11 @@ public: void sync(QWidget *exposedWidget, const QRegion &exposedRegion); void sync(); - void flush(QWidget *widget = 0, QWindowSurface *surface = 0); + void flush(QWidget *widget = 0, QBackingStore *store = 0); inline QPoint topLevelOffset() const { return tlwOffset; } - QWindowSurface *surface() const { return windowSurface; } + QBackingStore *backingStore() const { return store; } inline bool isDirty() const { @@ -112,10 +107,7 @@ private: QVector<QWidget *> dirtyWidgets; QVector<QWidget *> *dirtyOnScreenWidgets; QList<QWidget *> staticWidgets; - QWindowSurface *windowSurface; -#ifdef Q_BACKINGSTORE_SUBSURFACES - QList<QWindowSurface*> subSurfaces; -#endif + QBackingStore *store; uint hasDirtyFromPreviousSync : 1; uint fullUpdatePending : 1; @@ -127,9 +119,9 @@ private: bool bltRect(const QRect &rect, int dx, int dy, QWidget *widget); void releaseBuffer(); - void beginPaint(QRegion &toClean, QWidget *widget, QWindowSurface *windowSurface, + void beginPaint(QRegion &toClean, QWidget *widget, QBackingStore *backingStore, BeginPaintInfo *returnInfo, bool toCleanIsInTopLevelCoordinates = true); - void endPaint(const QRegion &cleaned, QWindowSurface *windowSurface, BeginPaintInfo *beginPaintInfo); + void endPaint(const QRegion &cleaned, QBackingStore *backingStore, BeginPaintInfo *beginPaintInfo); QRegion dirtyRegion(QWidget *widget = 0) const; QRegion staticContents(QWidget *widget = 0, const QRect &withinClipRect = QRect()) const; @@ -262,15 +254,13 @@ private: } inline bool hasStaticContents() const - { return !staticWidgets.isEmpty() && windowSurface->hasFeature(QWindowSurface::StaticContents); } + { return !staticWidgets.isEmpty(); } friend QRegion qt_dirtyRegion(QWidget *); friend class QWidgetPrivate; friend class QWidget; - friend class QWSManagerPrivate; friend class QETWidget; - friend class QWindowSurface; - friend class QWSWindowSurface; + friend class QBackingStore; }; QT_END_NAMESPACE diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp new file mode 100644 index 00000000000..e4a9e0f067b --- /dev/null +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -0,0 +1,213 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qvariant.h" + +#include "qicon.h" +#include "qsizepolicy.h" + +#include "private/qvariant_p.h" + +QT_BEGIN_NAMESPACE + + +static void construct(QVariant::Private *x, const void *copy) +{ + switch (x->type) { +#ifndef QT_NO_ICON + case QVariant::Icon: + v_construct<QIcon>(x, copy); + break; +#endif + case QVariant::SizePolicy: + v_construct<QSizePolicy>(x, copy); + break; + default: + Q_ASSERT(false); + return; + } + x->is_null = !copy; +} + +static void clear(QVariant::Private *d) +{ + switch (d->type) { +#ifndef QT_NO_ICON + case QVariant::Icon: + v_clear<QIcon>(d); + break; +#endif + case QVariant::SizePolicy: + v_clear<QSizePolicy>(d); + break; + default: + Q_ASSERT(false); + return; + } + + d->type = QVariant::Invalid; + d->is_null = true; + d->is_shared = false; +} + + +static bool isNull(const QVariant::Private *d) +{ + switch(d->type) { +#ifndef QT_NO_ICON + case QVariant::Icon: + return v_cast<QIcon>(d)->isNull(); +#endif + default: + Q_ASSERT(false); + } + return true; +} + +static bool compare(const QVariant::Private *a, const QVariant::Private *b) +{ + Q_ASSERT(a->type == b->type); + switch(a->type) { + case QVariant::SizePolicy: + return *v_cast<QSizePolicy>(a) == *v_cast<QSizePolicy>(b); + default: + Q_ASSERT(false); + } + return false; +} + + +static const QVariant::Handler widgets_handler = { + construct, + clear, + isNull, +#ifndef QT_NO_DATASTREAM + 0, + 0, +#endif + compare, + 0, + 0, +#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM) + 0 +#else + 0 +#endif +}; + +struct QMetaTypeGuiHelper +{ + QMetaType::Constructor constr; + QMetaType::Destructor destr; +#ifndef QT_NO_DATASTREAM + QMetaType::SaveOperator saveOp; + QMetaType::LoadOperator loadOp; +#endif +}; + +extern Q_CORE_EXPORT const QMetaTypeGuiHelper *qMetaTypeWidgetsHelper; + + +#ifdef QT_NO_DATASTREAM +# define Q_DECL_METATYPE_HELPER(TYPE) \ + typedef void *(*QConstruct##TYPE)(const TYPE *); \ + static const QConstruct##TYPE qConstruct##TYPE = qMetaTypeConstructHelper<TYPE>; \ + typedef void (*QDestruct##TYPE)(TYPE *); \ + static const QDestruct##TYPE qDestruct##TYPE = qMetaTypeDeleteHelper<TYPE>; +#else +# define Q_DECL_METATYPE_HELPER(TYPE) \ + typedef void *(*QConstruct##TYPE)(const TYPE *); \ + static const QConstruct##TYPE qConstruct##TYPE = qMetaTypeConstructHelper<TYPE>; \ + typedef void (*QDestruct##TYPE)(TYPE *); \ + static const QDestruct##TYPE qDestruct##TYPE = qMetaTypeDeleteHelper<TYPE>; \ + typedef void (*QSave##TYPE)(QDataStream &, const TYPE *); \ + static const QSave##TYPE qSave##TYPE = qMetaTypeSaveHelper<TYPE>; \ + typedef void (*QLoad##TYPE)(QDataStream &, TYPE *); \ + static const QLoad##TYPE qLoad##TYPE = qMetaTypeLoadHelper<TYPE>; +#endif + +#ifndef QT_NO_ICON +Q_DECL_METATYPE_HELPER(QIcon) +#endif +Q_DECL_METATYPE_HELPER(QSizePolicy) + +#ifdef QT_NO_DATASTREAM +# define Q_IMPL_METATYPE_HELPER(TYPE) \ + { reinterpret_cast<QMetaType::Constructor>(qConstruct##TYPE), \ + reinterpret_cast<QMetaType::Destructor>(qDestruct##TYPE) } +#else +# define Q_IMPL_METATYPE_HELPER(TYPE) \ + { reinterpret_cast<QMetaType::Constructor>(qConstruct##TYPE), \ + reinterpret_cast<QMetaType::Destructor>(qDestruct##TYPE), \ + reinterpret_cast<QMetaType::SaveOperator>(qSave##TYPE), \ + reinterpret_cast<QMetaType::LoadOperator>(qLoad##TYPE) \ + } +#endif + +static const QMetaTypeGuiHelper qVariantWidgetsHelper[] = { +#ifdef QT_NO_ICON + {0, 0, 0, 0}, +#else + Q_IMPL_METATYPE_HELPER(QIcon), +#endif + Q_IMPL_METATYPE_HELPER(QSizePolicy), +}; + +Q_WIDGETS_EXPORT const QVariant::Handler *qt_widgets_variant_handler; + +int qRegisterWidgetsVariant() +{ + qt_widgets_variant_handler = &widgets_handler; + qMetaTypeWidgetsHelper = qVariantWidgetsHelper; + return 1; +} +Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant) + +int qUnregisterWidgetsVariant() +{ + qt_widgets_variant_handler = 0; + qMetaTypeWidgetsHelper = 0; + return 1; +} +Q_DESTRUCTOR_FUNCTION(qUnregisterWidgetsVariant) + + +QT_END_NAMESPACE diff --git a/src/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp new file mode 100644 index 00000000000..42ecfd4e3d3 --- /dev/null +++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp @@ -0,0 +1,415 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwidgetwindow_qpa_p.h" + +#include "private/qwidget_p.h" +#include "private/qapplication_p.h" + +QT_BEGIN_NAMESPACE + +QWidget *qt_button_down = 0; // widget got last button-down + +// popup control +QWidget *qt_popup_down = 0; // popup that contains the pressed widget +extern int openPopupCount; +bool qt_replay_popup_mouse_event = false; +extern bool qt_try_modal(QWidget *widget, QEvent::Type type); + +QWidgetWindow::QWidgetWindow(QWidget *widget) + : m_widget(widget) +{ +} + +bool QWidgetWindow::event(QEvent *event) +{ + switch (event->type()) { + case QEvent::Close: + handleCloseEvent(static_cast<QCloseEvent *>(event)); + return true; + + case QEvent::Enter: + case QEvent::Leave: + handleEnterLeaveEvent(event); + return true; + + case QEvent::KeyPress: + case QEvent::KeyRelease: + handleKeyEvent(static_cast<QKeyEvent *>(event)); + return true; + + case QEvent::MouseMove: + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: + handleMouseEvent(static_cast<QMouseEvent *>(event)); + return true; + + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + handleTouchEvent(static_cast<QTouchEvent *>(event)); + return true; + + case QEvent::Move: + handleMoveEvent(static_cast<QMoveEvent *>(event)); + return true; + + case QEvent::Resize: + handleResizeEvent(static_cast<QResizeEvent *>(event)); + return true; + + case QEvent::Wheel: + handleWheelEvent(static_cast<QWheelEvent *>(event)); + return true; + + case QEvent::DragEnter: + case QEvent::DragLeave: + case QEvent::DragMove: + case QEvent::Drop: + handleDragEvent(event); + break; + + case QEvent::Map: + m_widget->setAttribute(Qt::WA_Mapped); + return true; + + case QEvent::Unmap: + m_widget->setAttribute(Qt::WA_Mapped, false); + return true; + + case QEvent::Expose: + handleExposeEvent(static_cast<QExposeEvent *>(event)); + return true; + + case QEvent::WindowStateChange: + handleWindowStateChangedEvent(static_cast<QWindowStateChangeEvent *>(event)); + return true; + + default: + break; + } + + return m_widget->event(event) || QWindow::event(event); +} + +QPointer<QWidget> qt_last_mouse_receiver = 0; + +void QWidgetWindow::handleEnterLeaveEvent(QEvent *event) +{ + if (event->type() == QEvent::Leave) { + QWidget *leave = qt_last_mouse_receiver ? qt_last_mouse_receiver.data() : m_widget; + QApplicationPrivate::dispatchEnterLeave(0, leave); + qt_last_mouse_receiver = 0; + } else { + QApplicationPrivate::dispatchEnterLeave(m_widget, 0); + qt_last_mouse_receiver = m_widget; + } +} + +void QWidgetWindow::handleMouseEvent(QMouseEvent *event) +{ + if (qApp->d_func()->inPopupMode()) { + QWidget *activePopupWidget = qApp->activePopupWidget(); + QWidget *popup = activePopupWidget; + QPoint mapped = event->pos(); + if (popup != m_widget) + mapped = popup->mapFromGlobal(event->globalPos()); + bool releaseAfter = false; + QWidget *popupChild = popup->childAt(mapped); + + if (popup != qt_popup_down) { + qt_button_down = 0; + qt_popup_down = 0; + } + + switch (event->type()) { + case QEvent::MouseButtonPress: + case QEvent::MouseButtonDblClick: + qt_button_down = popupChild; + qt_popup_down = popup; + break; + case QEvent::MouseButtonRelease: + releaseAfter = true; + break; + default: + break; // nothing for mouse move + } + + int oldOpenPopupCount = openPopupCount; + + if (popup->isEnabled()) { + // deliver event + qt_replay_popup_mouse_event = false; + QWidget *receiver = popup; + QPoint widgetPos = mapped; + if (qt_button_down) + receiver = qt_button_down; + else if (popupChild) + receiver = popupChild; + if (receiver != popup) + widgetPos = receiver->mapFromGlobal(event->globalPos()); + QWidget *alien = m_widget->childAt(m_widget->mapFromGlobal(event->globalPos())); + QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); + e.setTimestamp(event->timestamp()); + QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver); + } else { + // close disabled popups when a mouse button is pressed or released + switch (event->type()) { + case QEvent::MouseButtonPress: + case QEvent::MouseButtonDblClick: + case QEvent::MouseButtonRelease: + popup->close(); + break; + default: + break; + } + } + + if (qApp->activePopupWidget() != activePopupWidget + && qt_replay_popup_mouse_event) { + if (m_widget->windowType() != Qt::Popup) + qt_button_down = 0; + qt_replay_popup_mouse_event = false; + } else if (event->type() == QEvent::MouseButtonPress + && event->button() == Qt::RightButton + && (openPopupCount == oldOpenPopupCount)) { + QWidget *popupEvent = popup; + if (qt_button_down) + popupEvent = qt_button_down; + else if(popupChild) + popupEvent = popupChild; + QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); + QApplication::sendSpontaneousEvent(popupEvent, &e); + } + + if (releaseAfter) { + qt_button_down = 0; + qt_popup_down = 0; + } + return; + } + + // modal event handling + if (QApplicationPrivate::instance()->modalState() && !qt_try_modal(m_widget, event->type())) + return; + + // which child should have it? + QWidget *widget = m_widget->childAt(event->pos()); + QPoint mapped = event->pos(); + + if (widget) { + mapped = widget->mapFrom(m_widget, event->pos()); + } else { + widget = m_widget; + } + + if (event->type() == QEvent::MouseButtonPress && !qt_button_down) + qt_button_down = widget; + + QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->globalPos(), mapped, event->type(), event->buttons(), + qt_button_down, widget); + + if (!receiver) { + if (event->type() == QEvent::MouseButtonRelease) + QApplicationPrivate::mouse_buttons &= ~event->button(); + return; + } + + QMouseEvent translated(event->type(), mapped, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); + translated.setTimestamp(event->timestamp()); + QApplicationPrivate::sendMouseEvent(receiver, &translated, widget, m_widget, &qt_button_down, + qt_last_mouse_receiver); + + if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::RightButton) { + QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); + QGuiApplication::sendSpontaneousEvent(receiver, &e); + } +} + +void QWidgetWindow::handleTouchEvent(QTouchEvent *event) +{ + QApplicationPrivate::translateRawTouchEvent(m_widget, event->deviceType(), event->touchPoints()); +} + +void QWidgetWindow::handleKeyEvent(QKeyEvent *event) +{ + if (QApplicationPrivate::instance()->modalState() && !qt_try_modal(m_widget, event->type())) + return; + + QWidget *widget = m_widget->focusWidget(); + + if (!widget) + widget = m_widget; + + QGuiApplication::sendSpontaneousEvent(widget, event); +} + +void QWidgetWindow::updateGeometry() +{ + if (m_widget->testAttribute(Qt::WA_OutsideWSRange)) + return; + + QMargins margins = frameMargins(); + + m_widget->data->crect = geometry(); + m_widget->d_func()->topData()->frameStrut.setCoords(margins.left(), margins.top(), margins.right(), margins.bottom()); +} + +void QWidgetWindow::handleMoveEvent(QMoveEvent *event) +{ + updateGeometry(); + QGuiApplication::sendSpontaneousEvent(m_widget, event); +} + +void QWidgetWindow::handleResizeEvent(QResizeEvent *event) +{ + QSize oldSize = m_widget->data->crect.size(); + + updateGeometry(); + QGuiApplication::sendSpontaneousEvent(m_widget, event); + + if (m_widget->d_func()->paintOnScreen()) { + QRegion updateRegion(geometry()); + if (m_widget->testAttribute(Qt::WA_StaticContents)) + updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height()); + m_widget->d_func()->syncBackingStore(updateRegion); + } else { + m_widget->d_func()->syncBackingStore(); + } +} + +void QWidgetWindow::handleCloseEvent(QCloseEvent *) +{ + m_widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); +} + +void QWidgetWindow::handleWheelEvent(QWheelEvent *event) +{ + if (QApplicationPrivate::instance()->modalState() && !qt_try_modal(m_widget, event->type())) + return; + + // which child should have it? + QWidget *widget = m_widget->childAt(event->pos()); + + if (!widget) + widget = m_widget; + + QPoint mapped = widget->mapFrom(m_widget, event->pos()); + + QWheelEvent translated(mapped, event->globalPos(), event->delta(), event->buttons(), event->modifiers(), event->orientation()); + QGuiApplication::sendSpontaneousEvent(widget, &translated); +} + +void QWidgetWindow::handleDragEvent(QEvent *event) +{ + switch (event->type()) { + case QEvent::DragEnter: + Q_ASSERT(!m_dragTarget); + // fall through + case QEvent::DragMove: + { + QDragMoveEvent *de = static_cast<QDragMoveEvent *>(event); + QWidget *widget = m_widget->childAt(de->pos()); + if (!widget) + widget = m_widget; + + if (widget != m_dragTarget.data()) { + if (m_dragTarget.data()) { + QDragLeaveEvent le; + QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &le); + } + m_dragTarget = widget; + QPoint mapped = widget->mapFrom(m_widget, de->pos()); + QDragEnterEvent translated(mapped, de->possibleActions(), de->mimeData(), de->mouseButtons(), de->keyboardModifiers()); + QGuiApplication::sendSpontaneousEvent(widget, &translated); + if (translated.isAccepted()) + event->accept(); + de->setDropAction(translated.dropAction()); + } else { + Q_ASSERT(event->type() == QEvent::DragMove); + QPoint mapped = widget->mapFrom(m_widget, de->pos()); + QDragMoveEvent translated(mapped, de->possibleActions(), de->mimeData(), de->mouseButtons(), de->keyboardModifiers()); + translated.setDropAction(de->dropAction()); + QGuiApplication::sendSpontaneousEvent(widget, &translated); + if (translated.isAccepted()) + event->accept(); + de->setDropAction(translated.dropAction()); + } + break; + } + case QEvent::DragLeave: + if (m_dragTarget) + QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), event); + m_dragTarget = (QWidget *)0; + break; + case QEvent::Drop: + { + QDropEvent *de = static_cast<QDropEvent *>(event); + QPoint mapped = m_dragTarget.data()->mapFrom(m_widget, de->pos()); + QDropEvent translated(mapped, de->possibleActions(), de->mimeData(), de->mouseButtons(), de->keyboardModifiers()); + QGuiApplication::sendSpontaneousEvent(m_dragTarget.data(), &translated); + if (translated.isAccepted()) + event->accept(); + de->setDropAction(translated.dropAction()); + m_dragTarget = (QWidget *)0; + } + default: + break; + } +} + +void QWidgetWindow::handleExposeEvent(QExposeEvent *event) +{ + m_widget->d_func()->syncBackingStore(event->region()); +} + +void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event) +{ + // QWindow does currently not know 'active'. + Qt::WindowStates eventState = event->oldState(); + if (m_widget->windowState() & Qt::WindowActive) + eventState |= Qt::WindowActive; + QWindowStateChangeEvent widgetEvent(eventState); + QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent); +} + +QT_END_NAMESPACE diff --git a/src/gui/embedded/qwsembedwidget.h b/src/widgets/kernel/qwidgetwindow_qpa_p.h similarity index 64% rename from src/gui/embedded/qwsembedwidget.h rename to src/widgets/kernel/qwidgetwindow_qpa_p.h index d1aa0ee6f47..86290c693a3 100644 --- a/src/gui/embedded/qwsembedwidget.h +++ b/src/widgets/kernel/qwidgetwindow_qpa_p.h @@ -39,12 +39,13 @@ ** ****************************************************************************/ -#ifndef QWSEMBEDWIDGET_H -#define QWSEMBEDWIDGET_H +#ifndef QWIDGETWINDOW_QPA_P_H +#define QWIDGETWINDOW_QPA_P_H -#include <QtGui/qwidget.h> +#include <QtGui/qwindow.h> -#ifndef QT_NO_QWSEMBEDWIDGET +#include <QtCore/private/qobject_p.h> +#include <QtGui/private/qevent_p.h> QT_BEGIN_HEADER @@ -52,31 +53,42 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class QWSEmbedWidgetPrivate; +class QCloseEvent; +class QMoveEvent; -class Q_GUI_EXPORT QWSEmbedWidget : public QWidget +class QWidgetWindow : public QWindow { Q_OBJECT - public: - QWSEmbedWidget(WId winId, QWidget *parent = 0); - ~QWSEmbedWidget(); + QWidgetWindow(QWidget *widget); + + QWidget *widget() const { return m_widget; } protected: - bool eventFilter(QObject *object, QEvent *event); - void changeEvent(QEvent *event); - void resizeEvent(QResizeEvent *event); - void moveEvent(QMoveEvent *event); - void hideEvent(QHideEvent *event); - void showEvent(QShowEvent *event); + bool event(QEvent *); + + void handleCloseEvent(QCloseEvent *); + void handleEnterLeaveEvent(QEvent *); + void handleKeyEvent(QKeyEvent *); + void handleMouseEvent(QMouseEvent *); + void handleTouchEvent(QTouchEvent *); + void handleMoveEvent(QMoveEvent *); + void handleResizeEvent(QResizeEvent *); + void handleWheelEvent(QWheelEvent *); + void handleDragEvent(QEvent *); + void handleExposeEvent(QExposeEvent *); + void handleWindowStateChangedEvent(QWindowStateChangeEvent *event); private: - Q_DECLARE_PRIVATE(QWSEmbedWidget) + void updateGeometry(); + + QWidget *m_widget; + QWeakPointer<QWidget> m_implicit_mouse_grabber; + QWeakPointer<QWidget> m_dragTarget; }; QT_END_NAMESPACE QT_END_HEADER -#endif // QT_NO_QWSEMBEDWIDGET -#endif // QWSEMBEDWIDGET_H +#endif // QWIDGETWINDOW_QPA_P_H diff --git a/src/gui/kernel/symbian.pri b/src/widgets/kernel/symbian.pri similarity index 100% rename from src/gui/kernel/symbian.pri rename to src/widgets/kernel/symbian.pri diff --git a/src/gui/kernel/win.pri b/src/widgets/kernel/win.pri similarity index 100% rename from src/gui/kernel/win.pri rename to src/widgets/kernel/win.pri diff --git a/src/gui/kernel/x11.pri b/src/widgets/kernel/x11.pri similarity index 100% rename from src/gui/kernel/x11.pri rename to src/widgets/kernel/x11.pri diff --git a/src/gui/kernel/qapplication_mac.mm b/src/widgets/platforms/mac/qapplication_mac.mm similarity index 99% rename from src/gui/kernel/qapplication_mac.mm rename to src/widgets/platforms/mac/qapplication_mac.mm index e06756c86a8..58688498364 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/widgets/platforms/mac/qapplication_mac.mm @@ -181,7 +181,6 @@ static struct { static bool app_do_modal = false; // modal mode extern QWidgetList *qt_modal_stack; // stack of modal widgets extern bool qt_tab_all_widgets; // from qapplication.cpp -bool qt_mac_app_fullscreen = false; bool qt_scrollbar_jump_to_pos = false; static bool qt_mac_collapse_on_dblclick = true; extern int qt_antialiasing_threshold; // from qapplication.cpp @@ -1395,11 +1394,6 @@ void QApplication::restoreOverrideCursor() } #endif // QT_NO_CURSOR -Qt::KeyboardModifiers QApplication::queryKeyboardModifiers() -{ - return qt_mac_get_modifiers(GetCurrentEventKeyModifiers()); -} - QWidget *QApplication::topLevelAt(const QPoint &p) { #ifndef QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qclipboard_mac.cpp b/src/widgets/platforms/mac/qclipboard_mac.cpp similarity index 100% rename from src/gui/kernel/qclipboard_mac.cpp rename to src/widgets/platforms/mac/qclipboard_mac.cpp diff --git a/src/gui/kernel/qcocoaintrospection_mac.mm b/src/widgets/platforms/mac/qcocoaintrospection_mac.mm similarity index 100% rename from src/gui/kernel/qcocoaintrospection_mac.mm rename to src/widgets/platforms/mac/qcocoaintrospection_mac.mm diff --git a/src/gui/kernel/qcocoaintrospection_p.h b/src/widgets/platforms/mac/qcocoaintrospection_p.h similarity index 100% rename from src/gui/kernel/qcocoaintrospection_p.h rename to src/widgets/platforms/mac/qcocoaintrospection_p.h diff --git a/src/gui/kernel/qcocoapanel_mac.mm b/src/widgets/platforms/mac/qcocoapanel_mac.mm similarity index 100% rename from src/gui/kernel/qcocoapanel_mac.mm rename to src/widgets/platforms/mac/qcocoapanel_mac.mm diff --git a/src/gui/kernel/qcocoapanel_mac_p.h b/src/widgets/platforms/mac/qcocoapanel_mac_p.h similarity index 100% rename from src/gui/kernel/qcocoapanel_mac_p.h rename to src/widgets/platforms/mac/qcocoapanel_mac_p.h diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h similarity index 100% rename from src/gui/kernel/qcocoasharedwindowmethods_mac_p.h rename to src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/widgets/platforms/mac/qcocoaview_mac.mm similarity index 100% rename from src/gui/kernel/qcocoaview_mac.mm rename to src/widgets/platforms/mac/qcocoaview_mac.mm diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/widgets/platforms/mac/qcocoaview_mac_p.h similarity index 99% rename from src/gui/kernel/qcocoaview_mac_p.h rename to src/widgets/platforms/mac/qcocoaview_mac_p.h index e5e977bedd0..963cbe06bff 100644 --- a/src/gui/kernel/qcocoaview_mac_p.h +++ b/src/widgets/platforms/mac/qcocoaview_mac_p.h @@ -61,7 +61,7 @@ QT_FORWARD_DECLARE_CLASS(QEvent); QT_FORWARD_DECLARE_CLASS(QString); QT_FORWARD_DECLARE_CLASS(QStringList); -Q_GUI_EXPORT +Q_WIDGETS_EXPORT @interface QT_MANGLE_NAMESPACE(QCocoaView) : NSControl <NSTextInput> { QWidget *qwidget; QWidgetPrivate *qwidgetprivate; diff --git a/src/gui/kernel/qcocoawindow_mac.mm b/src/widgets/platforms/mac/qcocoawindow_mac.mm similarity index 100% rename from src/gui/kernel/qcocoawindow_mac.mm rename to src/widgets/platforms/mac/qcocoawindow_mac.mm diff --git a/src/gui/kernel/qcocoawindow_mac_p.h b/src/widgets/platforms/mac/qcocoawindow_mac_p.h similarity index 100% rename from src/gui/kernel/qcocoawindow_mac_p.h rename to src/widgets/platforms/mac/qcocoawindow_mac_p.h diff --git a/src/gui/kernel/qcocoawindowcustomthemeframe_mac.mm b/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm similarity index 100% rename from src/gui/kernel/qcocoawindowcustomthemeframe_mac.mm rename to src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm diff --git a/src/gui/kernel/qcocoawindowcustomthemeframe_mac_p.h b/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h similarity index 100% rename from src/gui/kernel/qcocoawindowcustomthemeframe_mac_p.h rename to src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm similarity index 100% rename from src/gui/kernel/qcocoawindowdelegate_mac.mm rename to src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm diff --git a/src/gui/kernel/qcocoawindowdelegate_mac_p.h b/src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h similarity index 100% rename from src/gui/kernel/qcocoawindowdelegate_mac_p.h rename to src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h diff --git a/src/gui/painting/qcolormap_mac.cpp b/src/widgets/platforms/mac/qcolormap_mac.cpp similarity index 100% rename from src/gui/painting/qcolormap_mac.cpp rename to src/widgets/platforms/mac/qcolormap_mac.cpp diff --git a/src/gui/kernel/qcursor_mac.mm b/src/widgets/platforms/mac/qcursor_mac.mm similarity index 100% rename from src/gui/kernel/qcursor_mac.mm rename to src/widgets/platforms/mac/qcursor_mac.mm diff --git a/src/gui/kernel/qdesktopwidget_mac.mm b/src/widgets/platforms/mac/qdesktopwidget_mac.mm similarity index 100% rename from src/gui/kernel/qdesktopwidget_mac.mm rename to src/widgets/platforms/mac/qdesktopwidget_mac.mm diff --git a/src/gui/kernel/qdesktopwidget_mac_p.h b/src/widgets/platforms/mac/qdesktopwidget_mac_p.h similarity index 100% rename from src/gui/kernel/qdesktopwidget_mac_p.h rename to src/widgets/platforms/mac/qdesktopwidget_mac_p.h diff --git a/src/gui/kernel/qdnd_mac.mm b/src/widgets/platforms/mac/qdnd_mac.mm similarity index 100% rename from src/gui/kernel/qdnd_mac.mm rename to src/widgets/platforms/mac/qdnd_mac.mm diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/widgets/platforms/mac/qeventdispatcher_mac.mm similarity index 100% rename from src/gui/kernel/qeventdispatcher_mac.mm rename to src/widgets/platforms/mac/qeventdispatcher_mac.mm diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/widgets/platforms/mac/qeventdispatcher_mac_p.h similarity index 100% rename from src/gui/kernel/qeventdispatcher_mac_p.h rename to src/widgets/platforms/mac/qeventdispatcher_mac_p.h diff --git a/src/gui/text/qfont_mac.cpp b/src/widgets/platforms/mac/qfont_mac.cpp similarity index 100% rename from src/gui/text/qfont_mac.cpp rename to src/widgets/platforms/mac/qfont_mac.cpp diff --git a/src/gui/text/qfontdatabase_mac.cpp b/src/widgets/platforms/mac/qfontdatabase_mac.cpp similarity index 100% rename from src/gui/text/qfontdatabase_mac.cpp rename to src/widgets/platforms/mac/qfontdatabase_mac.cpp diff --git a/src/gui/text/qfontengine_coretext.mm b/src/widgets/platforms/mac/qfontengine_coretext.mm similarity index 100% rename from src/gui/text/qfontengine_coretext.mm rename to src/widgets/platforms/mac/qfontengine_coretext.mm diff --git a/src/gui/text/qfontengine_coretext_p.h b/src/widgets/platforms/mac/qfontengine_coretext_p.h similarity index 100% rename from src/gui/text/qfontengine_coretext_p.h rename to src/widgets/platforms/mac/qfontengine_coretext_p.h diff --git a/src/gui/text/qfontengine_mac.mm b/src/widgets/platforms/mac/qfontengine_mac.mm similarity index 100% rename from src/gui/text/qfontengine_mac.mm rename to src/widgets/platforms/mac/qfontengine_mac.mm diff --git a/src/gui/text/qfontengine_mac_p.h b/src/widgets/platforms/mac/qfontengine_mac_p.h similarity index 100% rename from src/gui/text/qfontengine_mac_p.h rename to src/widgets/platforms/mac/qfontengine_mac_p.h diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/widgets/platforms/mac/qkeymapper_mac.cpp similarity index 99% rename from src/gui/kernel/qkeymapper_mac.cpp rename to src/widgets/platforms/mac/qkeymapper_mac.cpp index b5b3c4b5b95..e96caf1b9da 100644 --- a/src/gui/kernel/qkeymapper_mac.cpp +++ b/src/widgets/platforms/mac/qkeymapper_mac.cpp @@ -67,7 +67,7 @@ QT_USE_NAMESPACE bool qt_mac_eat_unicode_key = false; extern bool qt_sendSpontaneousEvent(QObject *obj, QEvent *event); //qapplication_mac.cpp -Q_GUI_EXPORT void qt_mac_secure_keyboard(bool b) +Q_WIDGETS_EXPORT void qt_mac_secure_keyboard(bool b) { static bool secure = false; if (b != secure){ diff --git a/src/gui/kernel/qmacdefines_mac.h b/src/widgets/platforms/mac/qmacdefines_mac.h similarity index 85% rename from src/gui/kernel/qmacdefines_mac.h rename to src/widgets/platforms/mac/qmacdefines_mac.h index 02360873e4d..d0accf872fd 100644 --- a/src/gui/kernel/qmacdefines_mac.h +++ b/src/widgets/platforms/mac/qmacdefines_mac.h @@ -117,7 +117,6 @@ typedef signed long OSStatus; # undef old_slots # endif #endif -#ifdef QT_MAC_USE_COCOA typedef struct OpaqueEventHandlerCallRef * EventHandlerCallRef; typedef struct OpaqueEventRef * EventRef; typedef struct OpaqueMenuRef * MenuRef; @@ -142,27 +141,6 @@ typedef signed long OSStatus; typedef void *OSMenuRef; typedef void *OSEventRef; # endif -#else // Carbon - typedef struct OpaqueEventHandlerCallRef * EventHandlerCallRef; - typedef struct OpaqueEventRef * EventRef; - typedef struct OpaqueMenuRef * MenuRef; - typedef struct OpaquePasteboardRef* PasteboardRef; - typedef struct OpaqueRgnHandle * RgnHandle; - typedef const struct __HIShape *HIShapeRef; - typedef struct __HIShape *HIMutableShapeRef; - typedef struct CGRect CGRect; - typedef struct CGImage *CGImageRef; - typedef struct CGContext *CGContextRef; - typedef struct GDevice * GDPtr; - typedef GDPtr * GDHandle; - typedef struct OpaqueIconRef * IconRef; - typedef struct OpaqueWindowPtr * WindowRef; - typedef struct OpaqueControlRef * HIViewRef; - typedef WindowRef OSWindowRef; - typedef HIViewRef OSViewRef; - typedef MenuRef OSMenuRef; - typedef EventRef OSEventRef; -#endif // QT_MAC_USE_COCOA typedef PasteboardRef OSPasteboardRef; typedef struct AEDesc AEDescList; diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm similarity index 100% rename from src/gui/kernel/qmacgesturerecognizer_mac.mm rename to src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm diff --git a/src/gui/kernel/qmacgesturerecognizer_mac_p.h b/src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h similarity index 100% rename from src/gui/kernel/qmacgesturerecognizer_mac_p.h rename to src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h diff --git a/src/gui/inputmethod/qmacinputcontext_mac.cpp b/src/widgets/platforms/mac/qmacinputcontext_mac.cpp similarity index 100% rename from src/gui/inputmethod/qmacinputcontext_mac.cpp rename to src/widgets/platforms/mac/qmacinputcontext_mac.cpp diff --git a/src/gui/inputmethod/qmacinputcontext_p.h b/src/widgets/platforms/mac/qmacinputcontext_p.h similarity index 96% rename from src/gui/inputmethod/qmacinputcontext_p.h rename to src/widgets/platforms/mac/qmacinputcontext_p.h index 15d2f77b9c5..4fb3eb57b65 100644 --- a/src/gui/inputmethod/qmacinputcontext_p.h +++ b/src/widgets/platforms/mac/qmacinputcontext_p.h @@ -53,12 +53,12 @@ // We mean it. // -#include "QtGui/qinputcontext.h" +#include "QtWidgets/qinputcontext.h" #include "private/qt_mac_p.h" QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QMacInputContext : public QInputContext +class Q_WIDGETS_EXPORT QMacInputContext : public QInputContext { Q_OBJECT //Q_DECLARE_PRIVATE(QMacInputContext) diff --git a/src/gui/kernel/qmime_mac.cpp b/src/widgets/platforms/mac/qmime_mac.cpp similarity index 99% rename from src/gui/kernel/qmime_mac.cpp rename to src/widgets/platforms/mac/qmime_mac.cpp index a1df34eb1f5..0eaaaa8f2a1 100644 --- a/src/gui/kernel/qmime_mac.cpp +++ b/src/widgets/platforms/mac/qmime_mac.cpp @@ -103,7 +103,7 @@ Q_GLOBAL_STATIC(QStringList, globalDraggedTypesList) \sa QMacPasteboardMime */ -Q_GUI_EXPORT void qRegisterDraggedTypes(const QStringList &types) +Q_WIDGETS_EXPORT void qRegisterDraggedTypes(const QStringList &types) { (*globalDraggedTypesList()) += types; } diff --git a/src/gui/kernel/qmultitouch_mac.mm b/src/widgets/platforms/mac/qmultitouch_mac.mm similarity index 100% rename from src/gui/kernel/qmultitouch_mac.mm rename to src/widgets/platforms/mac/qmultitouch_mac.mm diff --git a/src/gui/kernel/qmultitouch_mac_p.h b/src/widgets/platforms/mac/qmultitouch_mac_p.h similarity index 100% rename from src/gui/kernel/qmultitouch_mac_p.h rename to src/widgets/platforms/mac/qmultitouch_mac_p.h diff --git a/src/gui/kernel/qnsframeview_mac_p.h b/src/widgets/platforms/mac/qnsframeview_mac_p.h similarity index 100% rename from src/gui/kernel/qnsframeview_mac_p.h rename to src/widgets/platforms/mac/qnsframeview_mac_p.h diff --git a/src/gui/kernel/qnsthemeframe_mac_p.h b/src/widgets/platforms/mac/qnsthemeframe_mac_p.h similarity index 100% rename from src/gui/kernel/qnsthemeframe_mac_p.h rename to src/widgets/platforms/mac/qnsthemeframe_mac_p.h diff --git a/src/gui/kernel/qnstitledframe_mac_p.h b/src/widgets/platforms/mac/qnstitledframe_mac_p.h similarity index 100% rename from src/gui/kernel/qnstitledframe_mac_p.h rename to src/widgets/platforms/mac/qnstitledframe_mac_p.h diff --git a/src/gui/painting/qpaintdevice_mac.cpp b/src/widgets/platforms/mac/qpaintdevice_mac.cpp similarity index 92% rename from src/gui/painting/qpaintdevice_mac.cpp rename to src/widgets/platforms/mac/qpaintdevice_mac.cpp index 56cf8dc5a89..50bd4b84904 100644 --- a/src/gui/painting/qpaintdevice_mac.cpp +++ b/src/widgets/platforms/mac/qpaintdevice_mac.cpp @@ -85,7 +85,7 @@ float qt_mac_defaultDpi_y() \warning This function is only available on Mac OS X. */ -Q_GUI_EXPORT GrafPtr qt_mac_qd_context(const QPaintDevice *device) +Q_WIDGETS_EXPORT GrafPtr qt_mac_qd_context(const QPaintDevice *device) { if (device->devType() == QInternal::Pixmap) { return static_cast<GrafPtr>(static_cast<const QPixmap *>(device)->macQDHandle()); @@ -109,7 +109,7 @@ extern CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *pdev); \warning This function is only available on Mac OS X. */ -Q_GUI_EXPORT CGContextRef qt_mac_cg_context(const QPaintDevice *pdev) +Q_WIDGETS_EXPORT CGContextRef qt_mac_cg_context(const QPaintDevice *pdev) { if (pdev->devType() == QInternal::Pixmap) { const QPixmap *pm = static_cast<const QPixmap*>(pdev); @@ -121,16 +121,16 @@ Q_GUI_EXPORT CGContextRef qt_mac_cg_context(const QPaintDevice *pdev) CGContextRef ret = 0; // It would make sense to put this into a mac #ifdef'ed - // virtual function in the QPixmapData at some point - if (pm->data->classId() == QPixmapData::MacClass) { - const QMacPixmapData *pmData = static_cast<const QMacPixmapData*>(pm->data.data()); + // virtual function in the QPlatformPixmap at some point + if (pm->data->classId() == QPlatformPixmap::MacClass) { + const QMacPlatformPixmap *pmData = static_cast<const QMacPlatformPixmap*>(pm->data.data()); ret = CGBitmapContextCreate(pmData->pixels, pmData->w, pmData->h, 8, pmData->bytesPerRow, colorspace, flags); if(!ret) qWarning("QPaintDevice: Unable to create context for pixmap (%d/%d/%d)", pmData->w, pmData->h, (pmData->bytesPerRow * pmData->h)); - } else if (pm->data->classId() == QPixmapData::RasterClass) { + } else if (pm->data->classId() == QPlatformPixmap::RasterClass) { QImage *image = pm->data->buffer(); ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(), 8, image->bytesPerLine(), colorspace, flags); diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/widgets/platforms/mac/qpaintengine_mac.cpp similarity index 94% rename from src/gui/painting/qpaintengine_mac.cpp rename to src/widgets/platforms/mac/qpaintengine_mac.cpp index 0d459a5d89d..3def016b56a 100644 --- a/src/gui/painting/qpaintengine_mac.cpp +++ b/src/widgets/platforms/mac/qpaintengine_mac.cpp @@ -317,64 +317,6 @@ CGColorSpaceRef QCoreGraphicsPaintEngine::macGenericColorSpace() return macDisplayColorSpace(); #endif } - -/* - Ideally, we should pass the widget in here, and use CGGetDisplaysWithRect() etc. - to support multiple displays correctly. -*/ -CGColorSpaceRef QCoreGraphicsPaintEngine::macDisplayColorSpace(const QWidget *widget) -{ - CGColorSpaceRef colorSpace; - - CGDirectDisplayID displayID; - CMProfileRef displayProfile = 0; - if (widget == 0) { - displayID = CGMainDisplayID(); - } else { - const QRect &qrect = widget->window()->geometry(); - CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height()); - CGDisplayCount throwAway; - CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway); - if (dErr != kCGErrorSuccess) - return macDisplayColorSpace(0); // fall back on main display - } - if ((colorSpace = m_displayColorSpaceHash.value(displayID))) - return colorSpace; - - CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile); - if (err == noErr) { - colorSpace = CGColorSpaceCreateWithPlatformColorSpace(displayProfile); - } else if (widget) { - return macDisplayColorSpace(0); // fall back on main display - } - - if (colorSpace == 0) - colorSpace = CGColorSpaceCreateDeviceRGB(); - - m_displayColorSpaceHash.insert(displayID, colorSpace); - CMCloseProfile(displayProfile); - if (!m_postRoutineRegistered) { - m_postRoutineRegistered = true; - qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces); - } - return colorSpace; -} - -void QCoreGraphicsPaintEngine::cleanUpMacColorSpaces() -{ - if (m_genericColorSpace) { - CFRelease(m_genericColorSpace); - m_genericColorSpace = 0; - } - QHash<CGDirectDisplayID, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin(); - while (it != m_displayColorSpaceHash.constEnd()) { - if (it.value()) - CFRelease(it.value()); - ++it; - } - m_displayColorSpaceHash.clear(); -} - void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform) { CGAffineTransform old_xform = CGAffineTransformIdentity; @@ -990,48 +932,6 @@ void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, co d->restoreGraphicsState(); } -static void drawImageReleaseData (void *info, const void *, size_t) -{ - delete static_cast<QImage *>(info); -} - -CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imagePtr = 0) -{ - QImage *image; - if (img.depth() != 32) - image = new QImage(img.convertToFormat(QImage::Format_ARGB32_Premultiplied)); - else - image = new QImage(img); - - uint cgflags = kCGImageAlphaNone; - switch (image->format()) { - case QImage::Format_ARGB32_Premultiplied: - cgflags = kCGImageAlphaPremultipliedFirst; - break; - case QImage::Format_ARGB32: - cgflags = kCGImageAlphaFirst; - break; - case QImage::Format_RGB32: - cgflags = kCGImageAlphaNoneSkipFirst; - default: - break; - } -#if defined(kCGBitmapByteOrder32Host) //only needed because CGImage.h added symbols in the minor version - cgflags |= kCGBitmapByteOrder32Host; -#endif - QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(image, - static_cast<const QImage *>(image)->bits(), - image->byteCount(), - drawImageReleaseData); - if (imagePtr) - *imagePtr = image; - return CGImageCreate(image->width(), image->height(), 8, 32, - image->bytesPerLine(), - QCoreGraphicsPaintEngine::macGenericColorSpace(), - cgflags, dataProvider, 0, false, kCGRenderingIntentDefault); - -} - void QCoreGraphicsPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRectF &sr, Qt::ImageConversionFlags flags) { diff --git a/src/gui/painting/qpaintengine_mac_p.h b/src/widgets/platforms/mac/qpaintengine_mac_p.h similarity index 100% rename from src/gui/painting/qpaintengine_mac_p.h rename to src/widgets/platforms/mac/qpaintengine_mac_p.h diff --git a/src/gui/image/qpixmap_mac.cpp b/src/widgets/platforms/mac/qpixmap_mac.cpp similarity index 86% rename from src/gui/image/qpixmap_mac.cpp rename to src/widgets/platforms/mac/qpixmap_mac.cpp index 47b6eef761f..a375eda6a22 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/widgets/platforms/mac/qpixmap_mac.cpp @@ -72,29 +72,29 @@ extern QRegion qt_mac_convert_mac_region(RgnHandle rgn); //qregion_mac.cpp static int qt_pixmap_serial = 0; -Q_GUI_EXPORT quint32 *qt_mac_pixmap_get_base(const QPixmap *pix) +Q_WIDGETS_EXPORT quint32 *qt_mac_pixmap_get_base(const QPixmap *pix) { if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) - return reinterpret_cast<quint32 *>(static_cast<QRasterPixmapData*>(pix->data.data())->buffer()->bits()); + return reinterpret_cast<quint32 *>(static_cast<QRasterPlatformPixmap*>(pix->data.data())->buffer()->bits()); else - return static_cast<QMacPixmapData*>(pix->data.data())->pixels; + return static_cast<QMacPlatformPixmap*>(pix->data.data())->pixels; } -Q_GUI_EXPORT int qt_mac_pixmap_get_bytes_per_line(const QPixmap *pix) +Q_WIDGETS_EXPORT int qt_mac_pixmap_get_bytes_per_line(const QPixmap *pix) { if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) - return static_cast<QRasterPixmapData*>(pix->data.data())->buffer()->bytesPerLine(); + return static_cast<QRasterPlatformPixmap*>(pix->data.data())->buffer()->bytesPerLine(); else - return static_cast<QMacPixmapData*>(pix->data.data())->bytesPerRow; + return static_cast<QMacPlatformPixmap*>(pix->data.data())->bytesPerRow; } void qt_mac_cgimage_data_free(void *info, const void *memoryToFree, size_t) { - QMacPixmapData *pmdata = static_cast<QMacPixmapData *>(info); + QMacPlatformPixmap *pmdata = static_cast<QMacPlatformPixmap *>(info); if (!pmdata) { free(const_cast<void *>(memoryToFree)); } else { - if (QMacPixmapData::validDataPointers.contains(pmdata) == false) { + if (QMacPlatformPixmap::validDataPointers.contains(pmdata) == false) { free(const_cast<void *>(memoryToFree)); return; } @@ -110,34 +110,6 @@ void qt_mac_cgimage_data_free(void *info, const void *memoryToFree, size_t) } } -CGImageRef qt_mac_image_to_cgimage(const QImage &image) -{ - int bitsPerColor = 8; - int bitsPerPixel = 32; - if (image.depth() == 1) { - bitsPerColor = 1; - bitsPerPixel = 1; - } - QCFType<CGDataProviderRef> provider = - CGDataProviderCreateWithData(0, image.bits(), image.bytesPerLine() * image.height(), - 0); - - uint cgflags = kCGImageAlphaPremultipliedFirst; -#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version - cgflags |= kCGBitmapByteOrder32Host; -#endif - - CGImageRef cgImage = CGImageCreate(image.width(), image.height(), bitsPerColor, bitsPerPixel, - image.bytesPerLine(), - QCoreGraphicsPaintEngine::macGenericColorSpace(), - cgflags, provider, - 0, - 0, - kCGRenderingIntentDefault); - - return cgImage; -} - /***************************************************************************** QPixmap member functions *****************************************************************************/ @@ -163,26 +135,26 @@ static inline QRgb qt_conv16ToRgb(ushort c) { return qRgb(tr,tg,tb); } -QSet<QMacPixmapData*> QMacPixmapData::validDataPointers; +QSet<QMacPlatformPixmap*> QMacPlatformPixmap::validDataPointers; -QMacPixmapData::QMacPixmapData(PixelType type) - : QPixmapData(type, MacClass), has_alpha(0), has_mask(0), +QMacPlatformPixmap::QMacPlatformPixmap(PixelType type) + : QPlatformPixmap(type, MacClass), has_alpha(0), has_mask(0), uninit(true), pixels(0), pixelsSize(0), pixelsToFree(0), bytesPerRow(0), cg_data(0), cg_dataBeingReleased(0), cg_mask(0), pengine(0) { } -QPixmapData *QMacPixmapData::createCompatiblePixmapData() const +QPlatformPixmap *QMacPlatformPixmap::createCompatiblePlatformPixmap() const { - return new QMacPixmapData(pixelType()); + return new QMacPlatformPixmap(pixelType()); } #define BEST_BYTE_ALIGNMENT 16 #define COMPTUE_BEST_BYTES_PER_ROW(bpr) \ (((bpr) + (BEST_BYTE_ALIGNMENT - 1)) & ~(BEST_BYTE_ALIGNMENT - 1)) -void QMacPixmapData::resize(int width, int height) +void QMacPlatformPixmap::resize(int width, int height) { setSerialNumber(++qt_pixmap_serial); @@ -214,7 +186,7 @@ void QMacPixmapData::resize(int width, int height) #undef COMPUTE_BEST_BYTES_PER_ROW -void QMacPixmapData::fromImage(const QImage &img, +void QMacPlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { setSerialNumber(++qt_pixmap_serial); @@ -371,7 +343,7 @@ int get_index(QImage * qi,QRgb mycol) return qi->colorCount(); } -QImage QMacPixmapData::toImage() const +QImage QMacPlatformPixmap::toImage() const { QImage::Format format = QImage::Format_MonoLSB; if (d != 1) //Doesn't support index color modes @@ -405,7 +377,7 @@ QImage QMacPixmapData::toImage() const return image; } -void QMacPixmapData::fill(const QColor &fillColor) +void QMacPlatformPixmap::fill(const QColor &fillColor) { { //we don't know what backend to use so we cannot paint here @@ -427,39 +399,39 @@ void QMacPixmapData::fill(const QColor &fillColor) macSetHasAlpha(true); } -QPixmap QMacPixmapData::alphaChannel() const +QPixmap QMacPlatformPixmap::alphaChannel() const { if (!has_alpha) return QPixmap(); - QMacPixmapData *alpha = new QMacPixmapData(PixmapType); + QMacPlatformPixmap *alpha = new QMacPlatformPixmap(PixmapType); alpha->resize(w, h); macGetAlphaChannel(alpha, false); return QPixmap(alpha); } -void QMacPixmapData::setAlphaChannel(const QPixmap &alpha) +void QMacPlatformPixmap::setAlphaChannel(const QPixmap &alpha) { has_mask = true; - QMacPixmapData *alphaData = static_cast<QMacPixmapData*>(alpha.data.data()); + QMacPlatformPixmap *alphaData = static_cast<QMacPlatformPixmap*>(alpha.data.data()); macSetAlphaChannel(alphaData, false); } -QBitmap QMacPixmapData::mask() const +QBitmap QMacPlatformPixmap::mask() const { if (!has_mask && !has_alpha) return QBitmap(); - QMacPixmapData *mask = new QMacPixmapData(BitmapType); + QMacPlatformPixmap *mask = new QMacPlatformPixmap(BitmapType); mask->resize(w, h); macGetAlphaChannel(mask, true); return QPixmap(mask); } -void QMacPixmapData::setMask(const QBitmap &mask) +void QMacPlatformPixmap::setMask(const QBitmap &mask) { if (mask.isNull()) { - QMacPixmapData opaque(PixmapType); + QMacPlatformPixmap opaque(PixmapType); opaque.resize(w, h); opaque.fill(QColor(255, 255, 255, 255)); macSetAlphaChannel(&opaque, true); @@ -469,11 +441,11 @@ void QMacPixmapData::setMask(const QBitmap &mask) has_alpha = false; has_mask = true; - QMacPixmapData *maskData = static_cast<QMacPixmapData*>(mask.data.data()); + QMacPlatformPixmap *maskData = static_cast<QMacPlatformPixmap*>(mask.data.data()); macSetAlphaChannel(maskData, true); } -int QMacPixmapData::metric(QPaintDevice::PaintDeviceMetric theMetric) const +int QMacPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric theMetric) const { switch (theMetric) { case QPaintDevice::PdmWidth: @@ -504,7 +476,7 @@ int QMacPixmapData::metric(QPaintDevice::PaintDeviceMetric theMetric) const return 0; } -QMacPixmapData::~QMacPixmapData() +QMacPlatformPixmap::~QMacPlatformPixmap() { validDataPointers.remove(this); if (cg_mask) { @@ -521,7 +493,7 @@ QMacPixmapData::~QMacPixmapData() free(pixelsToFree); } -void QMacPixmapData::macSetAlphaChannel(const QMacPixmapData *pix, bool asMask) +void QMacPlatformPixmap::macSetAlphaChannel(const QMacPlatformPixmap *pix, bool asMask) { if (!pixels || !h || !w || pix->w != w || pix->h != h) return; @@ -567,7 +539,7 @@ void QMacPixmapData::macSetAlphaChannel(const QMacPixmapData *pix, bool asMask) macSetHasAlpha(true); } -void QMacPixmapData::macGetAlphaChannel(QMacPixmapData *pix, bool asMask) const +void QMacPlatformPixmap::macGetAlphaChannel(QMacPlatformPixmap *pix, bool asMask) const { quint32 *dptr = pix->pixels, *drow; const uint dbpr = pix->bytesPerRow; @@ -592,13 +564,13 @@ void QMacPixmapData::macGetAlphaChannel(QMacPixmapData *pix, bool asMask) const } } -void QMacPixmapData::macSetHasAlpha(bool b) +void QMacPlatformPixmap::macSetHasAlpha(bool b) { has_alpha = b; macReleaseCGImageRef(); } -void QMacPixmapData::macCreateCGImageRef() +void QMacPlatformPixmap::macCreateCGImageRef() { Q_ASSERT(cg_data == 0); //create the cg data @@ -615,7 +587,7 @@ void QMacPixmapData::macCreateCGImageRef() cgflags, provider, 0, 0, kCGRenderingIntentDefault); } -void QMacPixmapData::macReleaseCGImageRef() +void QMacPlatformPixmap::macReleaseCGImageRef() { if (!cg_data) return; // There's nothing we need to do @@ -634,7 +606,7 @@ void QMacPixmapData::macReleaseCGImageRef() // We create our space in memory to paint on here. If we already have existing pixels // copy them over. This is to preserve the fact that CGImageRef's are immutable. -void QMacPixmapData::macCreatePixels() +void QMacPlatformPixmap::macCreatePixels() { const int numBytes = bytesPerRow * h; quint32 *base_pixels; @@ -648,13 +620,13 @@ void QMacPixmapData::macCreatePixels() } if (pixels) - memcpy(base_pixels, pixels, qMin(pixelsSize, (uint) numBytes)); + memcpy(base_pixels, pixels, pixelsSize); pixels = base_pixels; pixelsSize = numBytes; } #if 0 -QPixmap QMacPixmapData::transformed(const QTransform &transform, +QPixmap QMacPlatformPixmap::transformed(const QTransform &transform, Qt::TransformationMode mode) const { int w, h; // size of target pixmap @@ -682,15 +654,15 @@ QPixmap QMacPixmapData::transformed(const QTransform &transform, return QPixmap(); // create destination - QMacPixmapData *pm = new QMacPixmapData(pixelType(), w, h); + QMacPlatformPixmap *pm = new QMacPlatformPixmap(pixelType(), w, h); const quint32 *sptr = pixels; quint32 *dptr = pm->pixels; memset(dptr, 0, (pm->bytesPerRow * pm->h)); // do the transform if (mode == Qt::SmoothTransformation) { -#warning QMacPixmapData::transformed not properly implemented - qWarning("QMacPixmapData::transformed not properly implemented"); +#warning QMacPlatformPixmap::transformed not properly implemented + qWarning("QMacPlatformPixmap::transformed not properly implemented"); #if 0 QPainter p(&pm); p.setRenderHint(QPainter::Antialiasing); @@ -709,7 +681,7 @@ QPixmap QMacPixmapData::transformed(const QTransform &transform, if (!qt_xForm_helper(mat, 0, QT_XFORM_TYPE_MSBFIRST, bpp, (uchar*)dptr, xbpl, (pm->bytesPerRow) - xbpl, h, (uchar*)sptr, (bytesPerRow), ws, hs)) { - qWarning("QMacPixmapData::transform(): failure"); + qWarning("QMacPlatformPixmap::transform(): failure"); return QPixmap(); } } @@ -851,33 +823,7 @@ static void qt_mac_grabDisplayRect(CGDirectDisplayID display, const QRect &displ ptrCGLDestroyContext(glContextObj); // and destroy the context } -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) // Returns a pixmap containing the screen contents at rect. -static QPixmap qt_mac_grabScreenRect_10_6(const QRect &rect) -{ - const int maxDisplays = 128; // 128 displays should be enough for everyone. - CGDirectDisplayID displays[maxDisplays]; - CGDisplayCount displayCount; - const CGRect cgRect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); - const CGDisplayErr err = CGGetDisplaysWithRect(cgRect, maxDisplays, displays, &displayCount); - - if (err && displayCount == 0) - return QPixmap(); - QPixmap windowPixmap(rect.size()); - for (uint i = 0; i < displayCount; ++i) { - const CGRect bounds = CGDisplayBounds(displays[i]); - // Translate to display-local coordinates - QRect displayRect = rect.translated(qRound(-bounds.origin.x), qRound(-bounds.origin.y)); - QCFType<CGImageRef> image = CGDisplayCreateImageForRect(displays[i], - CGRectMake(displayRect.x(), displayRect.y(), displayRect.width(), displayRect.height())); - QPixmap pix = QPixmap::fromMacCGImageRef(image); - QPainter painter(&windowPixmap); - painter.drawPixmap(-bounds.origin.x, -bounds.origin.y, pix); - } - return windowPixmap; -} -#endif - static QPixmap qt_mac_grabScreenRect(const QRect &rect) { if (!resolveOpenGLSymbols()) @@ -953,12 +899,7 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) QRect rect(globalCoord.x() + x, globalCoord.y() + y, w, h); #ifdef QT_MAC_USE_COCOA -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) - return qt_mac_grabScreenRect_10_6(rect); - else -#endif - return qt_mac_grabScreenRect(rect); + return qt_mac_grabScreenRect(rect); #else #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { @@ -1015,27 +956,27 @@ Qt::HANDLE QPixmap::macCGHandle() const if (isNull()) return 0; - if (data->classId() == QPixmapData::MacClass) { - QMacPixmapData *d = static_cast<QMacPixmapData *>(data.data()); + if (data->classId() == QPlatformPixmap::MacClass) { + QMacPlatformPixmap *d = static_cast<QMacPlatformPixmap *>(data.data()); if (!d->cg_data) d->macCreateCGImageRef(); CGImageRef ret = d->cg_data; CGImageRetain(ret); return ret; - } else if (data->classId() == QPixmapData::RasterClass) { - return qt_mac_image_to_cgimage(static_cast<QRasterPixmapData *>(data.data())->image); + } else if (data->classId() == QPlatformPixmap::RasterClass) { + return qt_mac_image_to_cgimage(static_cast<QRasterPlatformPixmap *>(data.data())->image); } return 0; } -bool QMacPixmapData::hasAlphaChannel() const +bool QMacPlatformPixmap::hasAlphaChannel() const { return has_alpha; } CGImageRef qt_mac_create_imagemask(const QPixmap &pixmap, const QRectF &sr) { - QMacPixmapData *px = static_cast<QMacPixmapData*>(pixmap.data.data()); + QMacPlatformPixmap *px = static_cast<QMacPlatformPixmap*>(pixmap.data.data()); if (px->cg_mask) { if (px->cg_mask_rect == sr) { CGImageRetain(px->cg_mask); //reference for the caller @@ -1145,23 +1086,23 @@ IconRef qt_mac_create_iconref(const QPixmap &px) #endif /*! \internal */ -QPaintEngine* QMacPixmapData::paintEngine() const +QPaintEngine* QMacPlatformPixmap::paintEngine() const { if (!pengine) { - QMacPixmapData *that = const_cast<QMacPixmapData*>(this); + QMacPlatformPixmap *that = const_cast<QMacPlatformPixmap*>(this); that->pengine = new QCoreGraphicsPaintEngine(); } return pengine; } -void QMacPixmapData::copy(const QPixmapData *data, const QRect &rect) +void QMacPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) { if (data->pixelType() == BitmapType) { QBitmap::fromImage(toImage().copy(rect)); return; } - const QMacPixmapData *macData = static_cast<const QMacPixmapData*>(data); + const QMacPlatformPixmap *macData = static_cast<const QMacPlatformPixmap*>(data); resize(rect.width(), rect.height()); @@ -1183,7 +1124,7 @@ void QMacPixmapData::copy(const QPixmapData *data, const QRect &rect) has_mask = macData->has_mask; } -bool QMacPixmapData::scroll(int dx, int dy, const QRect &rect) +bool QMacPlatformPixmap::scroll(int dx, int dy, const QRect &rect) { Q_UNUSED(dx); Q_UNUSED(dy); diff --git a/src/gui/image/qpixmap_mac_p.h b/src/widgets/platforms/mac/qpixmap_mac_p.h similarity index 89% rename from src/gui/image/qpixmap_mac_p.h rename to src/widgets/platforms/mac/qpixmap_mac_p.h index 3a5d97dc4a4..4f53160074a 100644 --- a/src/gui/image/qpixmap_mac_p.h +++ b/src/widgets/platforms/mac/qpixmap_mac_p.h @@ -53,23 +53,23 @@ // We mean it. // -#include <QtGui/private/qpixmapdata_p.h> -#include <QtGui/private/qpixmapdatafactory_p.h> +#include <QtGui/qplatformpixmap_qpa.h> +#include <QtGui/qplatformpixmapfactory_p.h> #include <QtGui/private/qt_mac_p.h> QT_BEGIN_NAMESPACE -class QMacPixmapData : public QPixmapData +class QMacPlatformPixmap : public QPlatformPixmap { public: - QMacPixmapData(PixelType type); - ~QMacPixmapData(); + QMacPlatformPixmap(PixelType type); + ~QMacPlatformPixmap(); - QPixmapData *createCompatiblePixmapData() const; + QPlatformPixmap *createCompatiblePlatformPixmap() const; void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); - void copy(const QPixmapData *data, const QRect &rect); + void copy(const QPlatformPixmap *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); int metric(QPaintDevice::PaintDeviceMetric metric) const; @@ -89,8 +89,8 @@ private: uint has_alpha : 1, has_mask : 1, uninit : 1; void macSetHasAlpha(bool b); - void macGetAlphaChannel(QMacPixmapData *, bool asMask) const; - void macSetAlphaChannel(const QMacPixmapData *, bool asMask); + void macGetAlphaChannel(QMacPlatformPixmap *, bool asMask) const; + void macSetAlphaChannel(const QMacPlatformPixmap *, bool asMask); void macCreateCGImageRef(); void macCreatePixels(); void macReleaseCGImageRef(); @@ -112,7 +112,7 @@ private: uint bytesPerRow; QRectF cg_mask_rect; CGImageRef cg_data, cg_dataBeingReleased, cg_mask; - static QSet<QMacPixmapData*> validDataPointers; + static QSet<QMacPlatformPixmap*> validDataPointers; QPaintEngine *pengine; diff --git a/src/gui/painting/qprintengine_mac.mm b/src/widgets/platforms/mac/qprintengine_mac.mm similarity index 100% rename from src/gui/painting/qprintengine_mac.mm rename to src/widgets/platforms/mac/qprintengine_mac.mm diff --git a/src/gui/painting/qprintengine_mac_p.h b/src/widgets/platforms/mac/qprintengine_mac_p.h similarity index 100% rename from src/gui/painting/qprintengine_mac_p.h rename to src/widgets/platforms/mac/qprintengine_mac_p.h diff --git a/src/gui/painting/qprinterinfo_mac.cpp b/src/widgets/platforms/mac/qprinterinfo_mac.cpp similarity index 100% rename from src/gui/painting/qprinterinfo_mac.cpp rename to src/widgets/platforms/mac/qprinterinfo_mac.cpp diff --git a/src/gui/text/qrawfont_mac.cpp b/src/widgets/platforms/mac/qrawfont_mac.cpp similarity index 100% rename from src/gui/text/qrawfont_mac.cpp rename to src/widgets/platforms/mac/qrawfont_mac.cpp diff --git a/src/gui/painting/qregion_mac.cpp b/src/widgets/platforms/mac/qregion_mac.cpp similarity index 98% rename from src/gui/painting/qregion_mac.cpp rename to src/widgets/platforms/mac/qregion_mac.cpp index 3a0346abc4a..94805a7f803 100644 --- a/src/gui/painting/qregion_mac.cpp +++ b/src/widgets/platforms/mac/qregion_mac.cpp @@ -66,7 +66,7 @@ static void qt_mac_cleanup_rgncache() } #endif -Q_GUI_EXPORT RgnHandle qt_mac_get_rgn() +Q_WIDGETS_EXPORT RgnHandle qt_mac_get_rgn() { #ifdef RGN_CACHE_SIZE if(!rgncache_init) { @@ -90,7 +90,7 @@ Q_GUI_EXPORT RgnHandle qt_mac_get_rgn() return NewRgn(); } -Q_GUI_EXPORT void qt_mac_dispose_rgn(RgnHandle r) +Q_WIDGETS_EXPORT void qt_mac_dispose_rgn(RgnHandle r) { #ifdef RGN_CACHE_SIZE if(rgncache_init && rgncache_used < RGN_CACHE_SIZE) { @@ -116,7 +116,7 @@ static OSStatus qt_mac_get_rgn_rect(UInt16 msg, RgnHandle, const Rect *rect, voi return noErr; } -Q_GUI_EXPORT QRegion qt_mac_convert_mac_region(RgnHandle rgn) +Q_WIDGETS_EXPORT QRegion qt_mac_convert_mac_region(RgnHandle rgn) { return QRegion::fromQDRgn(rgn); } diff --git a/src/gui/kernel/qsound_mac.mm b/src/widgets/platforms/mac/qsound_mac.mm similarity index 100% rename from src/gui/kernel/qsound_mac.mm rename to src/widgets/platforms/mac/qsound_mac.mm diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm similarity index 86% rename from src/gui/kernel/qt_cocoa_helpers_mac.mm rename to src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm index 97ed7f7e39b..d1620b14898 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm @@ -319,24 +319,6 @@ void macWindowFlush(void * /*OSWindowRef*/ window) #endif } -void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm) -{ - QMacCocoaAutoReleasePool pool; - if(QCFType<CGImageRef> image = pm.toMacCGImageRef()) { - NSImage *newImage = 0; - NSRect imageRect = NSMakeRect(0.0, 0.0, CGImageGetWidth(image), CGImageGetHeight(image)); - newImage = [[NSImage alloc] initWithSize:imageRect.size]; - [newImage lockFocus]; - { - CGContextRef imageContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; - CGContextDrawImage(imageContext, *(CGRect*)&imageRect, image); - } - [newImage unlockFocus]; - return newImage; - } - return 0; -} - void qt_mac_update_mouseTracking(QWidget *widget) { #ifdef QT_MAC_USE_COCOA @@ -545,139 +527,7 @@ void qt_dispatchTabletProximityEvent(const ::TabletProximityRec &proxRec) qt_sendSpontaneousEvent(qApp, &qtabletProximity); } -// Use this method to keep all the information in the TextSegment. As long as it is ordered -// we are in OK shape, and we can influence that ourselves. -struct KeyPair -{ - QChar cocoaKey; - Qt::Key qtKey; -}; - -bool operator==(const KeyPair &entry, QChar qchar) -{ - return entry.cocoaKey == qchar; -} - -bool operator<(const KeyPair &entry, QChar qchar) -{ - return entry.cocoaKey < qchar; -} - -bool operator<(QChar qchar, const KeyPair &entry) -{ - return qchar < entry.cocoaKey; -} - -bool operator<(const Qt::Key &key, const KeyPair &entry) -{ - return key < entry.qtKey; -} - -bool operator<(const KeyPair &entry, const Qt::Key &key) -{ - return entry.qtKey < key; -} - -static bool qtKey2CocoaKeySortLessThan(const KeyPair &entry1, const KeyPair &entry2) -{ - return entry1.qtKey < entry2.qtKey; -} - -static const int NumEntries = 59; -static const KeyPair entries[NumEntries] = { - { NSEnterCharacter, Qt::Key_Enter }, - { NSBackspaceCharacter, Qt::Key_Backspace }, - { NSTabCharacter, Qt::Key_Tab }, - { NSNewlineCharacter, Qt::Key_Return }, - { NSCarriageReturnCharacter, Qt::Key_Return }, - { NSBackTabCharacter, Qt::Key_Backtab }, - { kEscapeCharCode, Qt::Key_Escape }, - // Cocoa sends us delete when pressing backspace! - // (NB when we reverse this list in qtKey2CocoaKey, there - // will be two indices of Qt::Key_Backspace. But is seems to work - // ok for menu shortcuts (which uses that function): - { NSDeleteCharacter, Qt::Key_Backspace }, - { NSUpArrowFunctionKey, Qt::Key_Up }, - { NSDownArrowFunctionKey, Qt::Key_Down }, - { NSLeftArrowFunctionKey, Qt::Key_Left }, - { NSRightArrowFunctionKey, Qt::Key_Right }, - { NSF1FunctionKey, Qt::Key_F1 }, - { NSF2FunctionKey, Qt::Key_F2 }, - { NSF3FunctionKey, Qt::Key_F3 }, - { NSF4FunctionKey, Qt::Key_F4 }, - { NSF5FunctionKey, Qt::Key_F5 }, - { NSF6FunctionKey, Qt::Key_F6 }, - { NSF7FunctionKey, Qt::Key_F7 }, - { NSF8FunctionKey, Qt::Key_F8 }, - { NSF9FunctionKey, Qt::Key_F8 }, - { NSF10FunctionKey, Qt::Key_F10 }, - { NSF11FunctionKey, Qt::Key_F11 }, - { NSF12FunctionKey, Qt::Key_F12 }, - { NSF13FunctionKey, Qt::Key_F13 }, - { NSF14FunctionKey, Qt::Key_F14 }, - { NSF15FunctionKey, Qt::Key_F15 }, - { NSF16FunctionKey, Qt::Key_F16 }, - { NSF17FunctionKey, Qt::Key_F17 }, - { NSF18FunctionKey, Qt::Key_F18 }, - { NSF19FunctionKey, Qt::Key_F19 }, - { NSF20FunctionKey, Qt::Key_F20 }, - { NSF21FunctionKey, Qt::Key_F21 }, - { NSF22FunctionKey, Qt::Key_F22 }, - { NSF23FunctionKey, Qt::Key_F23 }, - { NSF24FunctionKey, Qt::Key_F24 }, - { NSF25FunctionKey, Qt::Key_F25 }, - { NSF26FunctionKey, Qt::Key_F26 }, - { NSF27FunctionKey, Qt::Key_F27 }, - { NSF28FunctionKey, Qt::Key_F28 }, - { NSF29FunctionKey, Qt::Key_F29 }, - { NSF30FunctionKey, Qt::Key_F30 }, - { NSF31FunctionKey, Qt::Key_F31 }, - { NSF32FunctionKey, Qt::Key_F32 }, - { NSF33FunctionKey, Qt::Key_F33 }, - { NSF34FunctionKey, Qt::Key_F34 }, - { NSF35FunctionKey, Qt::Key_F35 }, - { NSInsertFunctionKey, Qt::Key_Insert }, - { NSDeleteFunctionKey, Qt::Key_Delete }, - { NSHomeFunctionKey, Qt::Key_Home }, - { NSEndFunctionKey, Qt::Key_End }, - { NSPageUpFunctionKey, Qt::Key_PageUp }, - { NSPageDownFunctionKey, Qt::Key_PageDown }, - { NSPrintScreenFunctionKey, Qt::Key_Print }, - { NSScrollLockFunctionKey, Qt::Key_ScrollLock }, - { NSPauseFunctionKey, Qt::Key_Pause }, - { NSSysReqFunctionKey, Qt::Key_SysReq }, - { NSMenuFunctionKey, Qt::Key_Menu }, - { NSHelpFunctionKey, Qt::Key_Help }, -}; -static const KeyPair * const end = entries + NumEntries; - -QChar qtKey2CocoaKey(Qt::Key key) -{ - // The first time this function is called, create a reverse - // looup table sorted on Qt Key rather than Cocoa key: - static QVector<KeyPair> rev_entries(NumEntries); - static bool mustInit = true; - if (mustInit){ - mustInit = false; - for (int i=0; i<NumEntries; ++i) - rev_entries[i] = entries[i]; - qSort(rev_entries.begin(), rev_entries.end(), qtKey2CocoaKeySortLessThan); - } - const QVector<KeyPair>::iterator i - = qBinaryFind(rev_entries.begin(), rev_entries.end(), key); - if (i == rev_entries.end()) - return QChar(); - return i->cocoaKey; -} - #ifdef QT_MAC_USE_COCOA -static Qt::Key cocoaKey2QtKey(QChar keyCode) -{ - const KeyPair *i = qBinaryFind(entries, end, keyCode); - if (i == end) - return Qt::Key(keyCode.unicode()); - return i->qtKey; -} Qt::KeyboardModifiers qt_cocoaModifiers2QtModifiers(ulong modifierFlags) { @@ -695,27 +545,6 @@ Qt::KeyboardModifiers qt_cocoaModifiers2QtModifiers(ulong modifierFlags) return qtMods; } -NSString *qt_mac_removePrivateUnicode(NSString* string) -{ - int len = [string length]; - if (len) { - QVarLengthArray <unichar, 10> characters(len); - bool changed = false; - for (int i = 0; i<len; i++) { - characters[i] = [string characterAtIndex:i]; - // check if they belong to key codes in private unicode range - // currently we need to handle only the NSDeleteFunctionKey - if (characters[i] == NSDeleteFunctionKey) { - characters[i] = NSDeleteCharacter; - changed = true; - } - } - if (changed) - return [NSString stringWithCharacters:characters.data() length:len]; - } - return string; -} - Qt::KeyboardModifiers qt_cocoaDragOperation2QtModifiers(uint dragOperations) { Qt::KeyboardModifiers qtMods =Qt::NoModifier; @@ -1624,96 +1453,6 @@ void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayI } } -#ifdef QT_MAC_USE_COCOA -void qt_mac_menu_collapseSeparators(void */*NSMenu **/ theMenu, bool collapse) -{ - QMacCocoaAutoReleasePool pool; - OSMenuRef menu = static_cast<OSMenuRef>(theMenu); - if (collapse) { - bool previousIsSeparator = true; // setting to true kills all the separators placed at the top. - NSMenuItem *previousItem = nil; - - NSArray *itemArray = [menu itemArray]; - for (unsigned int i = 0; i < [itemArray count]; ++i) { - NSMenuItem *item = reinterpret_cast<NSMenuItem *>([itemArray objectAtIndex:i]); - if ([item isSeparatorItem]) { - [item setHidden:previousIsSeparator]; - } - - if (![item isHidden]) { - previousItem = item; - previousIsSeparator = ([previousItem isSeparatorItem]); - } - } - - // We now need to check the final item since we don't want any separators at the end of the list. - if (previousItem && previousIsSeparator) - [previousItem setHidden:YES]; - } else { - NSArray *itemArray = [menu itemArray]; - for (unsigned int i = 0; i < [itemArray count]; ++i) { - NSMenuItem *item = reinterpret_cast<NSMenuItem *>([itemArray objectAtIndex:i]); - if (QAction *action = reinterpret_cast<QAction *>([item tag])) - [item setHidden:!action->isVisible()]; - } - } -} - -class CocoaPostMessageAfterEventLoopExitHelp : public QObject -{ - id target; - SEL selector; - int argCount; - id arg1; - id arg2; -public: - CocoaPostMessageAfterEventLoopExitHelp(id target, SEL selector, int argCount, id arg1, id arg2) - : target(target), selector(selector), argCount(argCount), arg1(arg1), arg2(arg2){ - deleteLater(); - } - - ~CocoaPostMessageAfterEventLoopExitHelp() - { - qt_cocoaPostMessage(target, selector, argCount, arg1, arg2); - } -}; - -void qt_cocoaPostMessage(id target, SEL selector, int argCount, id arg1, id arg2) -{ - // WARNING: data1 and data2 is truncated to from 64-bit to 32-bit on OS 10.5! - // That is why we need to split the address in two parts: - QCocoaPostMessageArgs *args = new QCocoaPostMessageArgs(target, selector, argCount, arg1, arg2); - quint32 lower = quintptr(args); - quint32 upper = quintptr(args) >> 32; - NSEvent *e = [NSEvent otherEventWithType:NSApplicationDefined - location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0 - context:nil subtype:QtCocoaEventSubTypePostMessage data1:lower data2:upper]; - [NSApp postEvent:e atStart:NO]; -} - -void qt_cocoaPostMessageAfterEventLoopExit(id target, SEL selector, int argCount, id arg1, id arg2) -{ - if (QApplicationPrivate::instance()->threadData->eventLoops.size() <= 1) - qt_cocoaPostMessage(target, selector, argCount, arg1, arg2); - else - new CocoaPostMessageAfterEventLoopExitHelp(target, selector, argCount, arg1, arg2); -} - -#endif - -QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool() -{ -#ifndef QT_MAC_USE_COCOA - NSApplicationLoad(); -#endif - pool = (void*)[[NSAutoreleasePool alloc] init]; -} - -QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool() -{ - [(NSAutoreleasePool*)pool release]; -} - void qt_mac_post_retranslateAppMenu() { #ifdef QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h similarity index 90% rename from src/gui/kernel/qt_cocoa_helpers_mac_p.h rename to src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h index 14be29e61c6..b46946c1210 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h @@ -111,19 +111,21 @@ struct HIContentBorderMetrics; -#ifdef Q_WS_MAC32 -typedef struct _NSPoint NSPoint; // Just redefine here so I don't have to pull in all of Cocoa. +#ifdef __OBJC__ + // If the source file including this file also includes e.g. Cocoa/Cocoa.h, typedef-ing NSPoint will + // fail since NSPoint will already be a type. So we try to detect this. If the build fails, ensure + // that the inclusion of cocoa headers happends before the inclusion of this file. + #include <Foundation/NSGeometry.h> #else -typedef struct CGPoint NSPoint; + #ifdef Q_WS_MAC32 + typedef struct _NSPoint NSPoint; // Just redefine here so I don't have to pull in all of Cocoa. + #else + typedef struct CGPoint NSPoint; + #endif #endif QT_BEGIN_NAMESPACE -enum { - QtCocoaEventSubTypeWakeup = SHRT_MAX, - QtCocoaEventSubTypePostMessage = SHRT_MAX-1 -}; - Qt::MouseButtons qt_mac_get_buttons(int buttons); Qt::MouseButton qt_mac_get_button(EventMouseButton button); void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds = 0.15); @@ -143,14 +145,11 @@ void qt_mac_update_mouseTracking(QWidget *widget); OSStatus qt_mac_drawCGImage(CGContextRef cg, const CGRect *inbounds, CGImageRef); bool qt_mac_checkForNativeSizeGrip(const QWidget *widget); void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent); -#ifdef QT_MAC_USE_COCOA bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent); // These methods exists only for supporting unified mode. void macDrawRectOnTop(void * /*OSWindowRef */ window); void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window); void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *widget); -void qt_mac_menu_collapseSeparators(void * /*NSMenu */ menu, bool collapse); -#endif bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent); void qt_dispatchModifiersChanged(void * /*NSEvent * */flagsChangedEvent, QWidget *widgetToGetEvent); bool qt_mac_handleTabletEvent(void * /*QCocoaView * */view, void * /*NSEvent * */event); @@ -163,7 +162,7 @@ QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height); void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayIcon, QIcon *retIcon, QStyle::StandardPixmap standardIcon = QStyle::SP_CustomBase); -#if QT_MAC_USE_COCOA && __OBJC__ +#ifdef __OBJC__ struct DnDParams { NSView *view; @@ -217,33 +216,6 @@ inline QString qt_mac_NSStringToQString(const NSString *nsstr) inline NSString *qt_mac_QStringToNSString(const QString &qstr) { return [reinterpret_cast<const NSString *>(QCFString::toCFStringRef(qstr)) autorelease]; } -#ifdef QT_MAC_USE_COCOA -class QCocoaPostMessageArgs { -public: - id target; - SEL selector; - int argCount; - id arg1; - id arg2; - QCocoaPostMessageArgs(id target, SEL selector, int argCount=0, id arg1=0, id arg2=0) - : target(target), selector(selector), argCount(argCount), arg1(arg1), arg2(arg2) - { - [target retain]; - [arg1 retain]; - [arg2 retain]; - } - - ~QCocoaPostMessageArgs() - { - [arg2 release]; - [arg1 release]; - [target release]; - } -}; -void qt_cocoaPostMessage(id target, SEL selector, int argCount=0, id arg1=0, id arg2=0); -void qt_cocoaPostMessageAfterEventLoopExit(id target, SEL selector, int argCount=0, id arg1=0, id arg2=0); -#endif - #endif class QMacScrollOptimization { @@ -301,11 +273,9 @@ public: void qt_mac_post_retranslateAppMenu(); -#ifdef QT_MAC_USE_COCOA void qt_mac_display(QWidget *widget); void qt_mac_setNeedsDisplay(QWidget *widget); void qt_mac_setNeedsDisplayInRect(QWidget *widget, QRegion region); -#endif // QT_MAC_USE_COCOA // Utility functions to ease the use of Core Graphics contexts. diff --git a/src/gui/kernel/qt_mac.cpp b/src/widgets/platforms/mac/qt_mac.cpp similarity index 100% rename from src/gui/kernel/qt_mac.cpp rename to src/widgets/platforms/mac/qt_mac.cpp diff --git a/src/gui/kernel/qt_mac_p.h b/src/widgets/platforms/mac/qt_mac_p.h similarity index 98% rename from src/gui/kernel/qt_mac_p.h rename to src/widgets/platforms/mac/qt_mac_p.h index 46259820629..80328c34975 100644 --- a/src/gui/kernel/qt_mac_p.h +++ b/src/widgets/platforms/mac/qt_mac_p.h @@ -138,7 +138,7 @@ public: void performFade(); }; -class Q_GUI_EXPORT QMacCocoaAutoReleasePool +class Q_WIDGETS_EXPORT QMacCocoaAutoReleasePool { private: void *pool; @@ -151,7 +151,7 @@ public: QString qt_mac_removeMnemonics(const QString &original); //implemented in qmacstyle_mac.cpp -class Q_GUI_EXPORT QMacWindowChangeEvent +class Q_WIDGETS_EXPORT QMacWindowChangeEvent { private: static QList<QMacWindowChangeEvent*> *change_events; diff --git a/src/gui/text/qtextengine_mac.cpp b/src/widgets/platforms/mac/qtextengine_mac.cpp similarity index 100% rename from src/gui/text/qtextengine_mac.cpp rename to src/widgets/platforms/mac/qtextengine_mac.cpp diff --git a/src/gui/kernel/qwidget_mac.mm b/src/widgets/platforms/mac/qwidget_mac.mm similarity index 100% rename from src/gui/kernel/qwidget_mac.mm rename to src/widgets/platforms/mac/qwidget_mac.mm diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/widgets/platforms/s60/qapplication_s60.cpp similarity index 99% rename from src/gui/kernel/qapplication_s60.cpp rename to src/widgets/platforms/s60/qapplication_s60.cpp index e277765effb..69d321dd652 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/widgets/platforms/s60/qapplication_s60.cpp @@ -114,8 +114,6 @@ QWidget *qt_button_down = 0; // widget got last button-down QSymbianControl *QSymbianControl::lastFocusedControl = 0; -static Qt::KeyboardModifiers app_keyboardModifiers = Qt::NoModifier; - QS60Data* qGlobalS60Data() { return qt_s60Data(); @@ -714,7 +712,6 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) Qt::MouseButton button; mapS60MouseEventTypeToQt(&type, &button, &pEvent); Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers); - app_keyboardModifiers = modifiers; QPoint widgetPos = translatePointForFixedNativeOrientation(pEvent.iPosition); TPoint controlScreenPos = PositionRelativeToScreen(); @@ -1908,7 +1905,7 @@ void qt_cleanup() qt_S60Beep = 0; } QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles - QPixmapCache::clear(); // Has to happen now, since QS60PixmapData has FBS handles + QPixmapCache::clear(); // Has to happen now, since QS60PlatformPixmap has FBS handles #ifdef QT_NO_FREETYPE qt_cleanup_symbianFontDatabase(); @@ -2544,11 +2541,6 @@ void QApplication::setEffectEnabled(Qt::UIEffect /* effect */, bool /* enable */ // TODO: Implement QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) } -Qt::KeyboardModifiers QApplication::queryKeyboardModifiers() -{ - return app_keyboardModifiers; -} - TUint QApplicationPrivate::resolveS60ScanCode(TInt scanCode, TUint keysym) { if (!scanCode) diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/widgets/platforms/s60/qclipboard_s60.cpp similarity index 100% rename from src/gui/kernel/qclipboard_s60.cpp rename to src/widgets/platforms/s60/qclipboard_s60.cpp diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/widgets/platforms/s60/qcoefepinputcontext_p.h similarity index 98% rename from src/gui/inputmethod/qcoefepinputcontext_p.h rename to src/widgets/platforms/s60/qcoefepinputcontext_p.h index 913d19887c3..148f092ac54 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/widgets/platforms/s60/qcoefepinputcontext_p.h @@ -167,7 +167,7 @@ private: friend class tst_QInputContext; }; -Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable); +Q_WIDGETS_EXPORT void qt_s60_setPartialScreenInputMode(bool enable); QT_END_NAMESPACE diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/widgets/platforms/s60/qcoefepinputcontext_s60.cpp similarity index 99% rename from src/gui/inputmethod/qcoefepinputcontext_s60.cpp rename to src/widgets/platforms/s60/qcoefepinputcontext_s60.cpp index a00aa50bd3f..8c215360d88 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/widgets/platforms/s60/qcoefepinputcontext_s60.cpp @@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE -Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable) +Q_WIDGETS_EXPORT void qt_s60_setPartialScreenInputMode(bool enable) { S60->partial_keyboard = enable; diff --git a/src/gui/painting/qcolormap_s60.cpp b/src/widgets/platforms/s60/qcolormap_s60.cpp similarity index 100% rename from src/gui/painting/qcolormap_s60.cpp rename to src/widgets/platforms/s60/qcolormap_s60.cpp diff --git a/src/gui/kernel/qcursor_s60.cpp b/src/widgets/platforms/s60/qcursor_s60.cpp similarity index 100% rename from src/gui/kernel/qcursor_s60.cpp rename to src/widgets/platforms/s60/qcursor_s60.cpp diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/widgets/platforms/s60/qdesktopwidget_s60.cpp similarity index 100% rename from src/gui/kernel/qdesktopwidget_s60.cpp rename to src/widgets/platforms/s60/qdesktopwidget_s60.cpp diff --git a/src/gui/kernel/qdnd_s60.cpp b/src/widgets/platforms/s60/qdnd_s60.cpp similarity index 100% rename from src/gui/kernel/qdnd_s60.cpp rename to src/widgets/platforms/s60/qdnd_s60.cpp diff --git a/src/gui/kernel/qeventdispatcher_s60.cpp b/src/widgets/platforms/s60/qeventdispatcher_s60.cpp similarity index 100% rename from src/gui/kernel/qeventdispatcher_s60.cpp rename to src/widgets/platforms/s60/qeventdispatcher_s60.cpp diff --git a/src/gui/kernel/qeventdispatcher_s60_p.h b/src/widgets/platforms/s60/qeventdispatcher_s60_p.h similarity index 97% rename from src/gui/kernel/qeventdispatcher_s60_p.h rename to src/widgets/platforms/s60/qeventdispatcher_s60_p.h index 49ec5680976..8e644a2d064 100644 --- a/src/gui/kernel/qeventdispatcher_s60_p.h +++ b/src/widgets/platforms/s60/qeventdispatcher_s60_p.h @@ -87,7 +87,7 @@ private: bool m_hasAlreadyRun; }; -class Q_GUI_EXPORT QEventDispatcherS60 : public QEventDispatcherSymbian +class Q_WIDGETS_EXPORT QEventDispatcherS60 : public QEventDispatcherSymbian { Q_OBJECT diff --git a/src/gui/text/qfont_s60.cpp b/src/widgets/platforms/s60/qfont_s60.cpp similarity index 100% rename from src/gui/text/qfont_s60.cpp rename to src/widgets/platforms/s60/qfont_s60.cpp diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/widgets/platforms/s60/qfontdatabase_s60.cpp similarity index 100% rename from src/gui/text/qfontdatabase_s60.cpp rename to src/widgets/platforms/s60/qfontdatabase_s60.cpp diff --git a/src/gui/text/qfontengine_s60.cpp b/src/widgets/platforms/s60/qfontengine_s60.cpp similarity index 100% rename from src/gui/text/qfontengine_s60.cpp rename to src/widgets/platforms/s60/qfontengine_s60.cpp diff --git a/src/gui/text/qfontengine_s60_p.h b/src/widgets/platforms/s60/qfontengine_s60_p.h similarity index 100% rename from src/gui/text/qfontengine_s60_p.h rename to src/widgets/platforms/s60/qfontengine_s60_p.h diff --git a/src/gui/kernel/qkeymapper_s60.cpp b/src/widgets/platforms/s60/qkeymapper_s60.cpp similarity index 100% rename from src/gui/kernel/qkeymapper_s60.cpp rename to src/widgets/platforms/s60/qkeymapper_s60.cpp diff --git a/src/gui/painting/qpaintengine_s60.cpp b/src/widgets/platforms/s60/qpaintengine_s60.cpp similarity index 81% rename from src/gui/painting/qpaintengine_s60.cpp rename to src/widgets/platforms/s60/qpaintengine_s60.cpp index 091e2e65a48..67984008cad 100644 --- a/src/gui/painting/qpaintengine_s60.cpp +++ b/src/widgets/platforms/s60/qpaintengine_s60.cpp @@ -51,8 +51,8 @@ public: QS60PaintEnginePrivate() {} }; -QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PixmapData *data) - : QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), pixmapData(data) +QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PlatformPixmap *data) + : QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), handle(data) { } @@ -60,11 +60,11 @@ bool QS60PaintEngine::begin(QPaintDevice *device) { Q_D(QS60PaintEngine); - if (pixmapData->classId() == QPixmapData::RasterClass) { - pixmapData->beginDataAccess(); + if (handle->classId() == QPlatformPixmap::RasterClass) { + handle->beginDataAccess(); bool ret = QRasterPaintEngine::begin(device); // Make sure QPaintEngine::paintDevice() returns the proper device. - // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPixmapData + // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPlatformPixmap // which is incorrect in Symbian. d->pdev = device; return ret; @@ -75,9 +75,9 @@ bool QS60PaintEngine::begin(QPaintDevice *device) bool QS60PaintEngine::end() { - if (pixmapData->classId() == QPixmapData::RasterClass) { + if (handle->classId() == QPlatformPixmap::RasterClass) { bool ret = QRasterPaintEngine::end(); - pixmapData->endDataAccess(); + handle->endDataAccess(); return ret; } return QRasterPaintEngine::end(); @@ -85,13 +85,13 @@ bool QS60PaintEngine::end() void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) { - if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + if (pm.handle()->classId() == QPlatformPixmap::RasterClass) { + QS60PlatformPixmap *srcData = static_cast<QS60PlatformPixmap *>(pm.handle()); srcData->beginDataAccess(); QRasterPaintEngine::drawPixmap(p, pm); srcData->endDataAccess(); } else { - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); + void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage); if (nativeData) { QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); img->beginDataAccess(); @@ -105,13 +105,13 @@ void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { - if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + if (pm.handle()->classId() == QPlatformPixmap::RasterClass) { + QS60PlatformPixmap *srcData = static_cast<QS60PlatformPixmap *>(pm.handle()); srcData->beginDataAccess(); QRasterPaintEngine::drawPixmap(r, pm, sr); srcData->endDataAccess(); } else { - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); + void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage); if (nativeData) { QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); img->beginDataAccess(); @@ -125,8 +125,8 @@ void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRect void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) { - if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + if (pm.handle()->classId() == QPlatformPixmap::RasterClass) { + QS60PlatformPixmap *srcData = static_cast<QS60PlatformPixmap *>(pm.handle()); srcData->beginDataAccess(); QRasterPaintEngine::drawTiledPixmap(r, pm, sr); srcData->endDataAccess(); diff --git a/src/gui/painting/qpaintengine_s60_p.h b/src/widgets/platforms/s60/qpaintengine_s60_p.h similarity index 95% rename from src/gui/painting/qpaintengine_s60_p.h rename to src/widgets/platforms/s60/qpaintengine_s60_p.h index 2a3b443db30..4cea87954fb 100644 --- a/src/gui/painting/qpaintengine_s60_p.h +++ b/src/widgets/platforms/s60/qpaintengine_s60_p.h @@ -58,14 +58,14 @@ QT_BEGIN_NAMESPACE class QS60PaintEnginePrivate; -class QS60PixmapData; +class QS60PlatformPixmap; class QS60PaintEngine : public QRasterPaintEngine { Q_DECLARE_PRIVATE(QS60PaintEngine) public: - QS60PaintEngine(QPaintDevice *device, QS60PixmapData* data); + QS60PaintEngine(QPaintDevice *device, QS60PlatformPixmap* data); bool begin(QPaintDevice *device); bool end(); @@ -76,7 +76,7 @@ public: void prepare(QImage* image); private: - QS60PixmapData *pixmapData; + QS60PlatformPixmap *handle; }; QT_END_NAMESPACE diff --git a/src/gui/image/qpixmap_s60.cpp b/src/widgets/platforms/s60/qpixmap_s60.cpp similarity index 89% rename from src/gui/image/qpixmap_s60.cpp rename to src/widgets/platforms/s60/qpixmap_s60.cpp index ac29f5dea45..5e1474546e7 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/widgets/platforms/s60/qpixmap_s60.cpp @@ -65,10 +65,10 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; static bool cleanup_function_registered = false; -static QS60PixmapData *firstPixmap = 0; +static QS60PlatformPixmap *firstPixmap = 0; // static -void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd) +void QS60PlatformPixmap::qt_symbian_register_pixmap(QS60PlatformPixmap *pd) { if (!cleanup_function_registered) { qAddPostRoutine(qt_symbian_release_pixmaps); @@ -83,7 +83,7 @@ void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd) } // static -void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd) +void QS60PlatformPixmap::qt_symbian_unregister_pixmap(QS60PlatformPixmap *pd) { if (pd->next) pd->next->prev = pd->prev; @@ -94,10 +94,10 @@ void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd) } // static -void QS60PixmapData::qt_symbian_release_pixmaps() +void QS60PlatformPixmap::qt_symbian_release_pixmaps() { - // Scan all QS60PixmapData objects in the system and destroy them. - QS60PixmapData *pd = firstPixmap; + // Scan all QS60PlatformPixmap objects in the system and destroy them. + QS60PlatformPixmap *pd = firstPixmap; while (pd != 0) { pd->release(); pd = pd->next; @@ -358,11 +358,11 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h) */ CFbsBitmap *QPixmap::toSymbianCFbsBitmap() const { - QPixmapData *data = pixmapData(); + QPlatformPixmap *data = handle(); if (!data || data->isNull()) return 0; - return reinterpret_cast<CFbsBitmap*>(data->toNativeType(QPixmapData::FbsBitmap)); + return reinterpret_cast<CFbsBitmap*>(data->toNativeType(QPlatformPixmap::FbsBitmap)); } /*! @@ -387,13 +387,13 @@ QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) if (!bitmap) return QPixmap(); - QScopedPointer<QPixmapData> data(QPixmapData::create(0,0, QPixmapData::PixmapType)); - data->fromNativeType(reinterpret_cast<void*>(bitmap), QPixmapData::FbsBitmap); + QScopedPointer<QPlatformPixmap> data(QPlatformPixmap::create(0,0, QPlatformPixmap::PixmapType)); + data->fromNativeType(reinterpret_cast<void*>(bitmap), QPlatformPixmap::FbsBitmap); QPixmap pixmap(data.take()); return pixmap; } -QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), +QS60PlatformPixmap::QS60PlatformPixmap(PixelType type) : QRasterPlatformPixmap(type), symbianBitmapDataAccess(new QSymbianBitmapDataAccess), cfbsBitmap(0), pengine(0), @@ -405,14 +405,14 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), qt_symbian_register_pixmap(this); } -QS60PixmapData::~QS60PixmapData() +QS60PlatformPixmap::~QS60PlatformPixmap() { release(); delete symbianBitmapDataAccess; qt_symbian_unregister_pixmap(this); } -void QS60PixmapData::resize(int width, int height) +void QS60PlatformPixmap::resize(int width, int height) { if (width <= 0 || height <= 0) { w = width; @@ -446,7 +446,7 @@ void QS60PixmapData::resize(int width, int height) } } -void QS60PixmapData::release() +void QS60PlatformPixmap::release() { if (cfbsBitmap) { QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); @@ -464,7 +464,7 @@ void QS60PixmapData::release() /*! * Takes ownership of bitmap. Used by window surface */ -void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat) +void QS60PlatformPixmap::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat) { Q_ASSERT(bitmap); @@ -496,9 +496,9 @@ void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap, bool lockFormat) } } -QImage QS60PixmapData::toImage(const QRect &r) const +QImage QS60PlatformPixmap::toImage(const QRect &r) const { - QS60PixmapData *that = const_cast<QS60PixmapData*>(this); + QS60PlatformPixmap *that = const_cast<QS60PlatformPixmap*>(this); that->beginDataAccess(); QImage copy = that->image.copy(r); that->endDataAccess(); @@ -506,7 +506,7 @@ QImage QS60PixmapData::toImage(const QRect &r) const return copy; } -void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) +void QS60PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { release(); @@ -588,21 +588,21 @@ void QS60PixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags } } -void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect) +void QS60PlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) { - const QS60PixmapData *s60Data = static_cast<const QS60PixmapData*>(data); + const QS60PlatformPixmap *s60Data = static_cast<const QS60PlatformPixmap*>(data); fromImage(s60Data->toImage(rect), Qt::AutoColor | Qt::OrderedAlphaDither); } -bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) +bool QS60PlatformPixmap::scroll(int dx, int dy, const QRect &rect) { beginDataAccess(); - bool res = QRasterPixmapData::scroll(dx, dy, rect); + bool res = QRasterPlatformPixmap::scroll(dx, dy, rect); endDataAccess(); return res; } -int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +int QS60PlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const { if (!cfbsBitmap) return 0; @@ -633,7 +633,7 @@ int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const } -void QS60PixmapData::fill(const QColor &color) +void QS60PlatformPixmap::fill(const QColor &color) { if (color.alpha() != 255) { QImage im(width(), height(), QImage::Format_ARGB32_Premultiplied); @@ -642,12 +642,12 @@ void QS60PixmapData::fill(const QColor &color) fromImage(im, Qt::AutoColor | Qt::OrderedAlphaDither); } else { beginDataAccess(); - QRasterPixmapData::fill(color); + QRasterPlatformPixmap::fill(color); endDataAccess(); } } -void QS60PixmapData::setMask(const QBitmap &mask) +void QS60PlatformPixmap::setMask(const QBitmap &mask) { if (mask.size().isEmpty()) { if (image.depth() != 1) { @@ -657,7 +657,7 @@ void QS60PixmapData::setMask(const QBitmap &mask) } } else if (image.depth() == 1) { beginDataAccess(); - QRasterPixmapData::setMask(mask); + QRasterPlatformPixmap::setMask(mask); endDataAccess(); } else { const int w = image.width(); @@ -678,7 +678,7 @@ void QS60PixmapData::setMask(const QBitmap &mask) } } -void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel) +void QS60PlatformPixmap::setAlphaChannel(const QPixmap &alphaChannel) { QImage img(toImage()); img.setAlphaChannel(alphaChannel.toImage()); @@ -686,21 +686,21 @@ void QS60PixmapData::setAlphaChannel(const QPixmap &alphaChannel) fromImage(img, Qt::OrderedDither | Qt::OrderedAlphaDither); } -QImage QS60PixmapData::toImage() const +QImage QS60PlatformPixmap::toImage() const { return toImage(QRect()); } -QPaintEngine* QS60PixmapData::paintEngine() const +QPaintEngine* QS60PlatformPixmap::paintEngine() const { if (!pengine) { - QS60PixmapData *that = const_cast<QS60PixmapData*>(this); + QS60PlatformPixmap *that = const_cast<QS60PlatformPixmap*>(this); that->pengine = new QS60PaintEngine(&that->image, that); } return pengine; } -void QS60PixmapData::beginDataAccess() +void QS60PlatformPixmap::beginDataAccess() { if(!cfbsBitmap) return; @@ -745,7 +745,7 @@ void QS60PixmapData::beginDataAccess() } } -void QS60PixmapData::endDataAccess(bool readOnly) const +void QS60PlatformPixmap::endDataAccess(bool readOnly) const { Q_UNUSED(readOnly); @@ -778,8 +778,8 @@ QPixmap QPixmap::fromSymbianRSgImage(RSgImage *sgImage) if (!sgImage) return QPixmap(); - QScopedPointer<QPixmapData> data(QPixmapData::create(0,0, QPixmapData::PixmapType)); - data->fromNativeType(reinterpret_cast<void*>(sgImage), QPixmapData::SgImage); + QScopedPointer<QPlatformPixmap> data(QPlatformPixmap::create(0,0, QPlatformPixmap::PixmapType)); + data->fromNativeType(reinterpret_cast<void*>(sgImage), QPlatformPixmap::SgImage); QPixmap pixmap(data.take()); return pixmap; } @@ -807,16 +807,16 @@ RSgImage *QPixmap::toSymbianRSgImage() const if (isNull()) return 0; - RSgImage *sgImage = reinterpret_cast<RSgImage*>(pixmapData()->toNativeType(QPixmapData::SgImage)); + RSgImage *sgImage = reinterpret_cast<RSgImage*>(handle()->toNativeType(QPlatformPixmap::SgImage)); return sgImage; } -void* QS60PixmapData::toNativeType(NativeType type) +void* QS60PlatformPixmap::toNativeType(NativeType type) { - if (type == QPixmapData::SgImage) { + if (type == QPlatformPixmap::SgImage) { return 0; - } else if (type == QPixmapData::FbsBitmap) { + } else if (type == QPlatformPixmap::FbsBitmap) { if (isNull() || !cfbsBitmap) return 0; @@ -895,11 +895,11 @@ void* QS60PixmapData::toNativeType(NativeType type) return 0; } -void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) +void QS60PlatformPixmap::fromNativeType(void* pixmap, NativeType nativeType) { - if (nativeType == QPixmapData::SgImage) { + if (nativeType == QPlatformPixmap::SgImage) { return; - } else if (nativeType == QPixmapData::FbsBitmap && pixmap) { + } else if (nativeType == QPlatformPixmap::FbsBitmap && pixmap) { CFbsBitmap *bitmap = reinterpret_cast<CFbsBitmap*>(pixmap); @@ -955,8 +955,8 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) type = (format != QImage::Format_MonoLSB) - ? QPixmapData::PixmapType - : QPixmapData::BitmapType; + ? QPlatformPixmap::PixmapType + : QPlatformPixmap::BitmapType; if (needsCopy) { @@ -1005,7 +1005,7 @@ void QS60PixmapData::fromNativeType(void* pixmap, NativeType nativeType) } } -void QS60PixmapData::convertToDisplayMode(int mode) +void QS60PlatformPixmap::convertToDisplayMode(int mode) { const TDisplayMode displayMode = static_cast<TDisplayMode>(mode); if (!cfbsBitmap || cfbsBitmap->DisplayMode() == displayMode) @@ -1032,9 +1032,9 @@ void QS60PixmapData::convertToDisplayMode(int mode) UPDATE_BUFFER(); } -QPixmapData *QS60PixmapData::createCompatiblePixmapData() const +QPlatformPixmap *QS60PlatformPixmap::createCompatiblePlatformPixmap() const { - return new QS60PixmapData(pixelType()); + return new QS60PlatformPixmap(pixelType()); } QT_END_NAMESPACE diff --git a/src/gui/image/qpixmap_s60_p.h b/src/widgets/platforms/s60/qpixmap_s60_p.h similarity index 88% rename from src/gui/image/qpixmap_s60_p.h rename to src/widgets/platforms/s60/qpixmap_s60_p.h index e48154963b8..2f282e94983 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/widgets/platforms/s60/qpixmap_s60_p.h @@ -81,17 +81,17 @@ private: bool wasLocked; }; -class QS60PixmapData : public QRasterPixmapData +class QS60PlatformPixmap : public QRasterPlatformPixmap { public: - QS60PixmapData(PixelType type); - ~QS60PixmapData(); + QS60PlatformPixmap(PixelType type); + ~QS60PlatformPixmap(); - QPixmapData *createCompatiblePixmapData() const; + QPlatformPixmap *createCompatiblePlatformPixmap() const; void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); - void copy(const QPixmapData *data, const QRect &rect); + void copy(const QPlatformPixmap *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); int metric(QPaintDevice::PaintDeviceMetric metric) const; @@ -122,11 +122,11 @@ private: bool formatLocked; - QS60PixmapData *next; - QS60PixmapData *prev; + QS60PlatformPixmap *next; + QS60PlatformPixmap *prev; - static void qt_symbian_register_pixmap(QS60PixmapData *pd); - static void qt_symbian_unregister_pixmap(QS60PixmapData *pd); + static void qt_symbian_register_pixmap(QS60PlatformPixmap *pd); + static void qt_symbian_unregister_pixmap(QS60PlatformPixmap *pd); static void qt_symbian_release_pixmaps(); friend class QPixmap; diff --git a/src/gui/painting/qregion_s60.cpp b/src/widgets/platforms/s60/qregion_s60.cpp similarity index 100% rename from src/gui/painting/qregion_s60.cpp rename to src/widgets/platforms/s60/qregion_s60.cpp diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/widgets/platforms/s60/qsoftkeymanager_s60.cpp similarity index 100% rename from src/gui/kernel/qsoftkeymanager_s60.cpp rename to src/widgets/platforms/s60/qsoftkeymanager_s60.cpp diff --git a/src/gui/kernel/qsoftkeymanager_s60_p.h b/src/widgets/platforms/s60/qsoftkeymanager_s60_p.h similarity index 100% rename from src/gui/kernel/qsoftkeymanager_s60_p.h rename to src/widgets/platforms/s60/qsoftkeymanager_s60_p.h diff --git a/src/gui/kernel/qsound_s60.cpp b/src/widgets/platforms/s60/qsound_s60.cpp similarity index 100% rename from src/gui/kernel/qsound_s60.cpp rename to src/widgets/platforms/s60/qsound_s60.cpp diff --git a/src/gui/kernel/qt_s60_p.h b/src/widgets/platforms/s60/qt_s60_p.h similarity index 100% rename from src/gui/kernel/qt_s60_p.h rename to src/widgets/platforms/s60/qt_s60_p.h diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/widgets/platforms/s60/qwidget_s60.cpp similarity index 100% rename from src/gui/kernel/qwidget_s60.cpp rename to src/widgets/platforms/s60/qwidget_s60.cpp diff --git a/src/gui/kernel/qapplication_win.cpp b/src/widgets/platforms/win/qapplication_win.cpp similarity index 99% rename from src/gui/kernel/qapplication_win.cpp rename to src/widgets/platforms/win/qapplication_win.cpp index 756cb56b582..72b8870fe1d 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/widgets/platforms/win/qapplication_win.cpp @@ -237,9 +237,9 @@ static void resolveAygLibs() # define FE_FONTSMOOTHINGCLEARTYPE 0x0002 #endif -Q_GUI_EXPORT qreal qt_fontsmoothing_gamma; -Q_GUI_EXPORT bool qt_cleartype_enabled; -Q_GUI_EXPORT bool qt_win_owndc_required; // CS_OWNDC is required if we use the GL graphicssystem as default +Q_WIDGETS_EXPORT qreal qt_fontsmoothing_gamma; +Q_WIDGETS_EXPORT bool qt_cleartype_enabled; +Q_WIDGETS_EXPORT bool qt_win_owndc_required; // CS_OWNDC is required if we use the GL graphicssystem as default typedef HCTX (API *PtrWTOpen)(HWND, LPLOGCONTEXT, BOOL); typedef BOOL (API *PtrWTClose)(HCTX); @@ -427,7 +427,7 @@ static bool sm_cancel; static bool replayPopupMouseEvent = false; // replay handling when popups close // ignore the next release event if return from a modal widget -Q_GUI_EXPORT bool qt_win_ignoreNextMouseReleaseEvent = false; +Q_WIDGETS_EXPORT bool qt_win_ignoreNextMouseReleaseEvent = false; #if defined(QT_DEBUG) @@ -946,7 +946,7 @@ void qt_cleanup() Platform specific global and internal functions *****************************************************************************/ -Q_GUI_EXPORT HDC qt_win_display_dc() // get display DC +Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display DC { Q_ASSERT(qApp && qApp->thread() == QThread::currentThread()); if (!displayDC) @@ -1122,7 +1122,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class return cname; } -Q_GUI_EXPORT const QString qt_getRegisteredWndClass() +Q_WIDGETS_EXPORT const QString qt_getRegisteredWndClass() { return qt_reg_winclass(0); } @@ -1319,11 +1319,6 @@ Qt::KeyboardModifiers qt_win_getKeyboardModifiers() return modifiers; } -Qt::KeyboardModifiers QApplication::queryKeyboardModifiers() -{ - return qt_win_getKeyboardModifiers(); -} - /***************************************************************************** Routines to find a Qt widget from a screen position *****************************************************************************/ diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/widgets/platforms/win/qclipboard_win.cpp similarity index 100% rename from src/gui/kernel/qclipboard_win.cpp rename to src/widgets/platforms/win/qclipboard_win.cpp diff --git a/src/gui/painting/qcolormap_win.cpp b/src/widgets/platforms/win/qcolormap_win.cpp similarity index 100% rename from src/gui/painting/qcolormap_win.cpp rename to src/widgets/platforms/win/qcolormap_win.cpp diff --git a/src/gui/kernel/qcursor_win.cpp b/src/widgets/platforms/win/qcursor_win.cpp similarity index 100% rename from src/gui/kernel/qcursor_win.cpp rename to src/widgets/platforms/win/qcursor_win.cpp diff --git a/src/gui/kernel/qdesktopwidget_win.cpp b/src/widgets/platforms/win/qdesktopwidget_win.cpp similarity index 100% rename from src/gui/kernel/qdesktopwidget_win.cpp rename to src/widgets/platforms/win/qdesktopwidget_win.cpp diff --git a/src/gui/kernel/qdnd_win.cpp b/src/widgets/platforms/win/qdnd_win.cpp similarity index 100% rename from src/gui/kernel/qdnd_win.cpp rename to src/widgets/platforms/win/qdnd_win.cpp diff --git a/src/gui/text/qfont_win.cpp b/src/widgets/platforms/win/qfont_win.cpp similarity index 100% rename from src/gui/text/qfont_win.cpp rename to src/widgets/platforms/win/qfont_win.cpp diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/widgets/platforms/win/qfontdatabase_win.cpp similarity index 100% rename from src/gui/text/qfontdatabase_win.cpp rename to src/widgets/platforms/win/qfontdatabase_win.cpp diff --git a/src/gui/text/qfontengine_win.cpp b/src/widgets/platforms/win/qfontengine_win.cpp similarity index 100% rename from src/gui/text/qfontengine_win.cpp rename to src/widgets/platforms/win/qfontengine_win.cpp diff --git a/src/gui/text/qfontengine_win_p.h b/src/widgets/platforms/win/qfontengine_win_p.h similarity index 100% rename from src/gui/text/qfontengine_win_p.h rename to src/widgets/platforms/win/qfontengine_win_p.h diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/widgets/platforms/win/qguifunctions_wince.cpp similarity index 100% rename from src/gui/kernel/qguifunctions_wince.cpp rename to src/widgets/platforms/win/qguifunctions_wince.cpp diff --git a/src/gui/kernel/qguifunctions_wince.h b/src/widgets/platforms/win/qguifunctions_wince.h similarity index 100% rename from src/gui/kernel/qguifunctions_wince.h rename to src/widgets/platforms/win/qguifunctions_wince.h diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/widgets/platforms/win/qkeymapper_win.cpp similarity index 99% rename from src/gui/kernel/qkeymapper_win.cpp rename to src/widgets/platforms/win/qkeymapper_win.cpp index b981066434d..78389c1160e 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/widgets/platforms/win/qkeymapper_win.cpp @@ -497,7 +497,7 @@ static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer, return code == Qt::Key_unknown ? 0 : code; } -Q_GUI_EXPORT int qt_translateKeyCode(int vk) +Q_WIDGETS_EXPORT int qt_translateKeyCode(int vk) { int code = winceKeyBend((vk < 0 || vk > 255) ? 0 : vk); return code == Qt::Key_unknown ? 0 : code; diff --git a/src/gui/kernel/qmime_win.cpp b/src/widgets/platforms/win/qmime_win.cpp similarity index 100% rename from src/gui/kernel/qmime_win.cpp rename to src/widgets/platforms/win/qmime_win.cpp diff --git a/src/gui/kernel/qole_win.cpp b/src/widgets/platforms/win/qole_win.cpp similarity index 100% rename from src/gui/kernel/qole_win.cpp rename to src/widgets/platforms/win/qole_win.cpp diff --git a/src/gui/painting/qpaintdevice_win.cpp b/src/widgets/platforms/win/qpaintdevice_win.cpp similarity index 100% rename from src/gui/painting/qpaintdevice_win.cpp rename to src/widgets/platforms/win/qpaintdevice_win.cpp diff --git a/src/gui/image/qpixmap_win.cpp b/src/widgets/platforms/win/qpixmap_win.cpp similarity index 97% rename from src/gui/image/qpixmap_win.cpp rename to src/widgets/platforms/win/qpixmap_win.cpp index 0aaf30b8fd7..c5adb48f5d6 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/widgets/platforms/win/qpixmap_win.cpp @@ -125,8 +125,8 @@ HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const return 0; HBITMAP bitmap = 0; - if (data->classId() == QPixmapData::RasterClass) { - QRasterPixmapData* d = static_cast<QRasterPixmapData*>(data.data()); + if (data->classId() == QPlatformPixmap::RasterClass) { + QRasterPlatformPixmap* d = static_cast<QRasterPlatformPixmap*>(data.data()); int w = d->image.width(); int h = d->image.height(); @@ -168,8 +168,8 @@ HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const memcpy(pixels + y * bytes_per_line, image.scanLine(y), bytes_per_line); } else { - QPixmapData *data = new QRasterPixmapData(depth() == 1 ? - QPixmapData::BitmapType : QPixmapData::PixmapType); + QPlatformPixmap *data = new QRasterPlatformPixmap(depth() == 1 ? + QPlatformPixmap::BitmapType : QPlatformPixmap::PixmapType); data->fromImage(toImage(), Qt::AutoColor); return QPixmap(data).toWinHBITMAP(format); } diff --git a/src/gui/painting/qprintengine_win.cpp b/src/widgets/platforms/win/qprintengine_win.cpp similarity index 100% rename from src/gui/painting/qprintengine_win.cpp rename to src/widgets/platforms/win/qprintengine_win.cpp diff --git a/src/gui/painting/qprintengine_win_p.h b/src/widgets/platforms/win/qprintengine_win_p.h similarity index 100% rename from src/gui/painting/qprintengine_win_p.h rename to src/widgets/platforms/win/qprintengine_win_p.h diff --git a/src/gui/painting/qprinterinfo_win.cpp b/src/widgets/platforms/win/qprinterinfo_win.cpp similarity index 100% rename from src/gui/painting/qprinterinfo_win.cpp rename to src/widgets/platforms/win/qprinterinfo_win.cpp diff --git a/src/gui/text/qrawfont_win.cpp b/src/widgets/platforms/win/qrawfont_win.cpp similarity index 100% rename from src/gui/text/qrawfont_win.cpp rename to src/widgets/platforms/win/qrawfont_win.cpp diff --git a/src/gui/painting/qregion_win.cpp b/src/widgets/platforms/win/qregion_win.cpp similarity index 100% rename from src/gui/painting/qregion_win.cpp rename to src/widgets/platforms/win/qregion_win.cpp diff --git a/src/gui/kernel/qsound_win.cpp b/src/widgets/platforms/win/qsound_win.cpp similarity index 100% rename from src/gui/kernel/qsound_win.cpp rename to src/widgets/platforms/win/qsound_win.cpp diff --git a/src/gui/kernel/qwidget_win.cpp b/src/widgets/platforms/win/qwidget_win.cpp similarity index 100% rename from src/gui/kernel/qwidget_win.cpp rename to src/widgets/platforms/win/qwidget_win.cpp diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/widgets/platforms/win/qwidget_wince.cpp similarity index 100% rename from src/gui/kernel/qwidget_wince.cpp rename to src/widgets/platforms/win/qwidget_wince.cpp diff --git a/src/gui/inputmethod/qwininputcontext_p.h b/src/widgets/platforms/win/qwininputcontext_p.h similarity index 98% rename from src/gui/inputmethod/qwininputcontext_p.h rename to src/widgets/platforms/win/qwininputcontext_p.h index a3a7290a169..c0a6ac6b6f7 100644 --- a/src/gui/inputmethod/qwininputcontext_p.h +++ b/src/widgets/platforms/win/qwininputcontext_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include "QtGui/qinputcontext.h" +#include "QtWidgets/qinputcontext.h" #include "QtCore/qt_windows.h" #if !defined(IMR_RECONVERTSTRING) diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/widgets/platforms/win/qwininputcontext_win.cpp similarity index 100% rename from src/gui/inputmethod/qwininputcontext_win.cpp rename to src/widgets/platforms/win/qwininputcontext_win.cpp diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/widgets/platforms/win/qwinnativepangesturerecognizer_win.cpp similarity index 100% rename from src/gui/kernel/qwinnativepangesturerecognizer_win.cpp rename to src/widgets/platforms/win/qwinnativepangesturerecognizer_win.cpp diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/widgets/platforms/win/qwinnativepangesturerecognizer_win_p.h similarity index 100% rename from src/gui/kernel/qwinnativepangesturerecognizer_win_p.h rename to src/widgets/platforms/win/qwinnativepangesturerecognizer_win_p.h diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/widgets/platforms/x11/qapplication_x11.cpp similarity index 99% rename from src/gui/kernel/qapplication_x11.cpp rename to src/widgets/platforms/x11/qapplication_x11.cpp index 311b147976d..4a392d2a198 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/widgets/platforms/x11/qapplication_x11.cpp @@ -328,7 +328,7 @@ static const char * x11_atomnames = { "ERASER\0" }; -Q_GUI_EXPORT QX11Data *qt_x11Data = 0; +Q_WIDGETS_EXPORT QX11Data *qt_x11Data = 0; /***************************************************************************** Internal variables and functions @@ -387,7 +387,7 @@ static bool popupGrabOk; bool qt_sm_blockUserInput = false; // session management -Q_GUI_EXPORT int qt_xfocusout_grab_counter = 0; +Q_WIDGETS_EXPORT int qt_xfocusout_grab_counter = 0; #if !defined (QT_NO_TABLET) Q_GLOBAL_STATIC(QTabletDeviceDataList, tablet_devices) @@ -403,7 +403,7 @@ typedef bool(*QX11FilterFunction)(XEvent *event); Q_GLOBAL_STATIC(QList<QX11FilterFunction>, x11Filters) -Q_GUI_EXPORT void qt_installX11EventFilter(QX11FilterFunction func) +Q_WIDGETS_EXPORT void qt_installX11EventFilter(QX11FilterFunction func) { Q_ASSERT(func); @@ -411,7 +411,7 @@ Q_GUI_EXPORT void qt_installX11EventFilter(QX11FilterFunction func) list->append(func); } -Q_GUI_EXPORT void qt_removeX11EventFilter(QX11FilterFunction func) +Q_WIDGETS_EXPORT void qt_removeX11EventFilter(QX11FilterFunction func) { Q_ASSERT(func); @@ -447,7 +447,7 @@ extern bool qt_xfixes_clipboard_changed(Window clipboardOwner, Time timestamp); extern bool qt_xfixes_selection_changed(Window selectionOwner, Time timestamp); //def in qclipboard_x11.cpp static void qt_save_rootinfo(); -Q_GUI_EXPORT bool qt_try_modal(QWidget *, XEvent *); +Q_WIDGETS_EXPORT bool qt_try_modal(QWidget *, XEvent *); QWidget *qt_button_down = 0; // last widget to be pressed with the mouse QPointer<QWidget> qt_last_mouse_receiver = 0; @@ -467,8 +467,8 @@ extern bool qt_is_gui_used; \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes version. */ -static QFunctionPointer qt_load_library_runtime(const char *library, int vernum, - int highestVernum, const char *symbol) +static void* qt_load_library_runtime(const char *library, int vernum, + int highestVernum, const char *symbol) { QList<int> versions; // we try to load in the following order: @@ -483,7 +483,7 @@ static QFunctionPointer qt_load_library_runtime(const char *library, int vernum, Q_FOREACH(int version, versions) { QLatin1String libName(library); QLibrary xfixesLib(libName, version); - QFunctionPointer ptr = xfixesLib.resolve(symbol); + void *ptr = xfixesLib.resolve(symbol); if (ptr) return ptr; } @@ -844,7 +844,7 @@ static void qt_x11_create_intern_atoms() #endif } -Q_GUI_EXPORT void qt_x11_apply_settings_in_all_apps() +Q_WIDGETS_EXPORT void qt_x11_apply_settings_in_all_apps() { QByteArray stamp; QDataStream s(&stamp, QIODevice::WriteOnly); @@ -3061,21 +3061,6 @@ void QApplicationPrivate::_q_alertTimeOut() } } -Qt::KeyboardModifiers QApplication::queryKeyboardModifiers() -{ - Window root; - Window child; - int root_x, root_y, win_x, win_y; - uint keybstate; - for (int i = 0; i < ScreenCount(X11->display); ++i) { - if (XQueryPointer(X11->display, QX11Info::appRootWindow(i), &root, &child, - &root_x, &root_y, &win_x, &win_y, &keybstate)) - return X11->translateModifiers(keybstate & 0x00ff); - } - return 0; - -} - /***************************************************************************** Special lookup functions for windows that have been reparented recently *****************************************************************************/ diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/widgets/platforms/x11/qclipboard_x11.cpp similarity index 100% rename from src/gui/kernel/qclipboard_x11.cpp rename to src/widgets/platforms/x11/qclipboard_x11.cpp diff --git a/src/gui/painting/qcolormap_x11.cpp b/src/widgets/platforms/x11/qcolormap_x11.cpp similarity index 100% rename from src/gui/painting/qcolormap_x11.cpp rename to src/widgets/platforms/x11/qcolormap_x11.cpp diff --git a/src/gui/kernel/qcursor_x11.cpp b/src/widgets/platforms/x11/qcursor_x11.cpp similarity index 99% rename from src/gui/kernel/qcursor_x11.cpp rename to src/widgets/platforms/x11/qcursor_x11.cpp index 167e8f85172..1132d3737d7 100644 --- a/src/gui/kernel/qcursor_x11.cpp +++ b/src/widgets/platforms/x11/qcursor_x11.cpp @@ -539,8 +539,8 @@ void QCursorData::update() fg.green = 0; fg.blue = 0; QImage image = QApplicationPrivate::instance()->getPixmapCursor(cshape).toImage(); - pm = QX11PixmapData::createBitmapFromImage(image); - pmm = QX11PixmapData::createBitmapFromImage(image.createAlphaMask().convertToFormat(QImage::Format_MonoLSB)); + pm = QX11PlatformPixmap::createBitmapFromImage(image); + pmm = QX11PlatformPixmap::createBitmapFromImage(image.createAlphaMask().convertToFormat(QImage::Format_MonoLSB)); hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 8, 8); } diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/widgets/platforms/x11/qdesktopwidget_x11.cpp similarity index 100% rename from src/gui/kernel/qdesktopwidget_x11.cpp rename to src/widgets/platforms/x11/qdesktopwidget_x11.cpp diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/widgets/platforms/x11/qdnd_x11.cpp similarity index 99% rename from src/gui/kernel/qdnd_x11.cpp rename to src/widgets/platforms/x11/qdnd_x11.cpp index 11e87e96f32..2718853920c 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/widgets/platforms/x11/qdnd_x11.cpp @@ -1112,6 +1112,21 @@ void qt_xdnd_send_leave() waiting_for_status = false; } +// TODO: remove and use QApplication::currentKeyboardModifiers() in Qt 4.8. +static Qt::KeyboardModifiers currentKeyboardModifiers() +{ + Window root; + Window child; + int root_x, root_y, win_x, win_y; + uint keybstate; + for (int i = 0; i < ScreenCount(X11->display); ++i) { + if (XQueryPointer(X11->display, QX11Info::appRootWindow(i), &root, &child, + &root_x, &root_y, &win_x, &win_y, &keybstate)) + return X11->translateModifiers(keybstate & 0x00ff); + } + return 0; +} + void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive) { DEBUG("xdndHandleDrop"); @@ -1160,7 +1175,7 @@ void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive) // Drop coming from another app? Update keyboard modifiers. if (!qt_xdnd_dragging) { - QApplicationPrivate::modifier_buttons = QApplication::queryKeyboardModifiers(); + QApplicationPrivate::modifier_buttons = currentKeyboardModifiers(); } QDropEvent de(qt_xdnd_current_position, possible_actions, dropData, @@ -1335,10 +1350,6 @@ bool QDragManager::eventFilter(QObject * o, QEvent * e) case QEvent::KeyRelease: case QEvent::Wheel: case QEvent::ShortcutOverride: -#ifdef QT3_SUPPORT - case QEvent::Accel: - case QEvent::AccelAvailable: -#endif return true; default: return false; diff --git a/src/gui/kernel/qeventdispatcher_x11.cpp b/src/widgets/platforms/x11/qeventdispatcher_x11.cpp similarity index 100% rename from src/gui/kernel/qeventdispatcher_x11.cpp rename to src/widgets/platforms/x11/qeventdispatcher_x11.cpp diff --git a/src/gui/kernel/qeventdispatcher_x11_p.h b/src/widgets/platforms/x11/qeventdispatcher_x11_p.h similarity index 100% rename from src/gui/kernel/qeventdispatcher_x11_p.h rename to src/widgets/platforms/x11/qeventdispatcher_x11_p.h diff --git a/src/gui/text/qfont_x11.cpp b/src/widgets/platforms/x11/qfont_x11.cpp similarity index 99% rename from src/gui/text/qfont_x11.cpp rename to src/widgets/platforms/x11/qfont_x11.cpp index e89e0d9dc22..ba69871855c 100644 --- a/src/gui/text/qfont_x11.cpp +++ b/src/widgets/platforms/x11/qfont_x11.cpp @@ -118,7 +118,7 @@ QString qt_fallback_font_family(int script) } // Sets the fallback family for the specified script. -Q_GUI_EXPORT void qt_x11_set_fallback_font_family(int script, const QString &family) +Q_WIDGETS_EXPORT void qt_x11_set_fallback_font_family(int script, const QString &family) { FallBackHash *hash = fallBackHash(); if (!family.isEmpty()) diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/widgets/platforms/x11/qfontdatabase_x11.cpp similarity index 100% rename from src/gui/text/qfontdatabase_x11.cpp rename to src/widgets/platforms/x11/qfontdatabase_x11.cpp diff --git a/src/gui/text/qfontengine_x11.cpp b/src/widgets/platforms/x11/qfontengine_x11.cpp similarity index 99% rename from src/gui/text/qfontengine_x11.cpp rename to src/widgets/platforms/x11/qfontengine_x11.cpp index 6e87f4c2f68..be421976fa5 100644 --- a/src/gui/text/qfontengine_x11.cpp +++ b/src/widgets/platforms/x11/qfontengine_x11.cpp @@ -358,7 +358,9 @@ bool QFontEngineXLFD::stringToCMap(const QChar *s, int len, QGlyphLayout *glyphs QVarLengthArray<ushort> _s(len); QChar *str = (QChar *)_s.data(); for (int i = 0; i < len; ++i) { - if (s[i].isHighSurrogate() && i < len-1 && s[i+1].isLowSurrogate()) { + if (i < len - 1 + && s[i].unicode() >= 0xd800 && s[i].unicode() < 0xdc00 + && s[i+1].unicode() >= 0xdc00 && s[i].unicode() < 0xe000) { *str = QChar(); ++i; } else { @@ -639,7 +641,7 @@ QBitmap QFontEngineXLFD::bitmapForGlyphs(const QGlyphLayout &glyphs, const glyph if (w <= 0 || h <= 0) return QBitmap(); - QPixmapData *data = new QX11PixmapData(QPixmapData::BitmapType); + QPlatformPixmap *data = new QX11PlatformPixmap(QPlatformPixmap::BitmapType); data->resize(w, h); QPixmap bm(data); QPainter p(&bm); @@ -955,7 +957,7 @@ void QFontEngineMultiFT::loadEngine(int at) -Q_GUI_EXPORT void qt_x11ft_convert_pattern(FcPattern *pattern, QByteArray *file_name, int *index, bool *antialias) +Q_WIDGETS_EXPORT void qt_x11ft_convert_pattern(FcPattern *pattern, QByteArray *file_name, int *index, bool *antialias) { FcChar8 *fileName; FcPatternGetString(pattern, FC_FILE, 0, &fileName); diff --git a/src/gui/text/qfontengine_x11_p.h b/src/widgets/platforms/x11/qfontengine_x11_p.h similarity index 97% rename from src/gui/text/qfontengine_x11_p.h rename to src/widgets/platforms/x11/qfontengine_x11_p.h index 1c0bcada118..b12fbc28d48 100644 --- a/src/gui/text/qfontengine_x11_p.h +++ b/src/widgets/platforms/x11/qfontengine_x11_p.h @@ -137,7 +137,7 @@ private: #ifndef QT_NO_FONTCONFIG -class Q_GUI_EXPORT QFontEngineMultiFT : public QFontEngineMulti +class Q_WIDGETS_EXPORT QFontEngineMultiFT : public QFontEngineMulti { public: QFontEngineMultiFT(QFontEngine *fe, FcPattern *firstEnginePattern, FcPattern *p, int s, const QFontDef &request); @@ -154,7 +154,7 @@ private: int firstFontIndex; // first font in fontset }; -class Q_GUI_EXPORT QFontEngineX11FT : public QFontEngineFT +class Q_WIDGETS_EXPORT QFontEngineX11FT : public QFontEngineFT { public: explicit QFontEngineX11FT(const QFontDef &fontDef) : QFontEngineFT(fontDef) {} diff --git a/src/gui/kernel/qkde.cpp b/src/widgets/platforms/x11/qkde.cpp similarity index 100% rename from src/gui/kernel/qkde.cpp rename to src/widgets/platforms/x11/qkde.cpp diff --git a/src/gui/kernel/qkde_p.h b/src/widgets/platforms/x11/qkde_p.h similarity index 98% rename from src/gui/kernel/qkde_p.h rename to src/widgets/platforms/x11/qkde_p.h index 23587db3608..5abe824a727 100644 --- a/src/gui/kernel/qkde_p.h +++ b/src/widgets/platforms/x11/qkde_p.h @@ -44,7 +44,7 @@ #include <QtCore/qglobal.h> #include <QtGui/QPalette> -#include <QtGui/QIcon> +#include <QtWidgets/QIcon> // // W A R N I N G diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/widgets/platforms/x11/qkeymapper_x11.cpp similarity index 100% rename from src/gui/kernel/qkeymapper_x11.cpp rename to src/widgets/platforms/x11/qkeymapper_x11.cpp diff --git a/src/gui/kernel/qkeymapper_x11_p.cpp b/src/widgets/platforms/x11/qkeymapper_x11_p.cpp similarity index 100% rename from src/gui/kernel/qkeymapper_x11_p.cpp rename to src/widgets/platforms/x11/qkeymapper_x11_p.cpp diff --git a/src/gui/kernel/qmotifdnd_x11.cpp b/src/widgets/platforms/x11/qmotifdnd_x11.cpp similarity index 100% rename from src/gui/kernel/qmotifdnd_x11.cpp rename to src/widgets/platforms/x11/qmotifdnd_x11.cpp diff --git a/src/gui/embedded/qwsutils_qws.h b/src/widgets/platforms/x11/qpaintdevice_x11.cpp similarity index 62% rename from src/gui/embedded/qwsutils_qws.h rename to src/widgets/platforms/x11/qpaintdevice_x11.cpp index 013b2e5304f..d7ecb06885a 100644 --- a/src/gui/embedded/qwsutils_qws.h +++ b/src/widgets/platforms/x11/qpaintdevice_x11.cpp @@ -39,60 +39,46 @@ ** ****************************************************************************/ -#ifndef QWSUTILS_QWS_H -#define QWSUTILS_QWS_H - -#include <QtCore/QIODevice> - -QT_BEGIN_HEADER +#include "qpaintdevice.h" +#include "qpainter.h" +#include "qwidget.h" +#include "qbitmap.h" +#include "qapplication.h" +#include <private/qt_x11_p.h> +#include "qx11info_x11.h" QT_BEGIN_NAMESPACE -QT_MODULE(Gui) +/*! \internal -#ifndef QT_NO_SXE -#define QWS_SOCK_BASE QUnixSocket -#define QWS_SOCK_SERVER_BASE QUnixSocketServer -class QUnixSocket; -class QUnixSocketServer; -#else -#define QWS_SOCK_BASE QTcpSocket -#define QWS_SOCK_SERVER_BASE QTcpServer -class QTcpSocket; -class QTcpServer; -#endif -class QWSSocket; -class QWSServerSocket; + Returns the X11 Drawable of the paint device. 0 is returned if it + can't be obtained. +*/ -/******************************************************************** - * - * Convenient socket functions - * - ********************************************************************/ -#ifndef QT_NO_QWS_MULTIPROCESS -inline int qws_read_uint(QIODevice *socket) +Drawable Q_WIDGETS_EXPORT qt_x11Handle(const QPaintDevice *pd) { - if (!socket || socket->bytesAvailable() < (int)sizeof(int)) - return -1; - - int i; - socket->read(reinterpret_cast<char*>(&i), sizeof(i)); - - return i; + if (!pd) return 0; + if (pd->devType() == QInternal::Widget) + return static_cast<const QWidget *>(pd)->handle(); + else if (pd->devType() == QInternal::Pixmap) + return static_cast<const QPixmap *>(pd)->handle(); + return 0; } -inline void qws_write_uint(QIODevice *socket, int i) +/*! + \relates QPaintDevice + + Returns the QX11Info structure for the \a pd paint device. 0 is + returned if it can't be obtained. +*/ +const Q_WIDGETS_EXPORT QX11Info *qt_x11Info(const QPaintDevice *pd) { - if (!socket) - return; - - socket->write(reinterpret_cast<char*>(&i), sizeof(i)); + if (!pd) return 0; + if (pd->devType() == QInternal::Widget) + return &static_cast<const QWidget *>(pd)->x11Info(); + else if (pd->devType() == QInternal::Pixmap) + return &static_cast<const QPixmap *>(pd)->x11Info(); + return 0; } -#endif // QT_NO_QWS_MULTIPROCESS - QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QWSUTILS_QWS_H diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/widgets/platforms/x11/qpaintengine_x11.cpp similarity index 98% rename from src/gui/painting/qpaintengine_x11.cpp rename to src/widgets/platforms/x11/qpaintengine_x11.cpp index 62c1dacf05b..3cb3e3caf71 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/widgets/platforms/x11/qpaintengine_x11.cpp @@ -79,7 +79,7 @@ #include <private/qtessellator_p.h> #endif -#include <private/qstylehelper_p.h> +#include <private/qhexstring_p.h> QT_BEGIN_NAMESPACE @@ -97,7 +97,7 @@ static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; QPainter::begin() must be called before this function returns a valid GC. */ -Q_GUI_EXPORT GC qt_x11_get_pen_gc(QPainter *p) +Q_WIDGETS_EXPORT GC qt_x11_get_pen_gc(QPainter *p) { if (p && p->paintEngine() && p->paintEngine()->isActive() @@ -112,7 +112,7 @@ Q_GUI_EXPORT GC qt_x11_get_pen_gc(QPainter *p) QPainter::begin() must be called before this function returns a valid GC. */ -Q_GUI_EXPORT GC qt_x11_get_brush_gc(QPainter *p) +Q_WIDGETS_EXPORT GC qt_x11_get_brush_gc(QPainter *p) { if (p && p->paintEngine() && p->paintEngine()->isActive() @@ -148,7 +148,7 @@ static inline int qpainterOpToXrender(QPainter::CompositionMode mode) // hack, so we don't have to make QRegion::clipRectangles() public or include // X11 headers in qregion.h -Q_GUI_EXPORT void *qt_getClipRects(const QRegion &r, int &num) +Q_WIDGETS_EXPORT void *qt_getClipRects(const QRegion &r, int &num) { return r.clipRectangles(num); } @@ -487,7 +487,7 @@ bool QX11PaintEngine::begin(QPaintDevice *pdev) d->picture = (::Picture)w->x11PictureHandle(); } else if (pdev->devType() == QInternal::Pixmap) { const QPixmap *pm = static_cast<const QPixmap *>(pdev); - QX11PixmapData *data = static_cast<QX11PixmapData*>(pm->data.data()); + QX11PlatformPixmap *data = static_cast<QX11PlatformPixmap*>(pm->data.data()); if (X11->use_xrender && data->depth() != 32 && data->x11_mask) data->convertToARGB32(); d->picture = (::Picture)static_cast<const QPixmap *>(pdev)->x11PictureHandle(); @@ -1370,7 +1370,7 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) XRenderPictureAttributes attrs; attrs.repeat = true; XRenderChangePicture(d->dpy, d->brush_pm.x11PictureHandle(), CPRepeat, &attrs); - QX11PixmapData *data = static_cast<QX11PixmapData*>(d->brush_pm.data.data()); + QX11PlatformPixmap *data = static_cast<QX11PlatformPixmap*>(d->brush_pm.data.data()); if (data->mask_picture) XRenderChangePicture(d->dpy, data->mask_picture, CPRepeat, &attrs); } @@ -1408,13 +1408,13 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) #ifndef QT_NO_XRENDER if (d->pdev_depth == 32 && d->brush_pm.depth() != 32) { d->brush_pm.detach(); - QX11PixmapData *brushData = static_cast<QX11PixmapData*>(d->brush_pm.data.data()); + QX11PlatformPixmap *brushData = static_cast<QX11PlatformPixmap*>(d->brush_pm.data.data()); brushData->convertToARGB32(); } #endif vals.tile = (d->brush_pm.depth() == d->pdev_depth ? d->brush_pm.handle() - : static_cast<QX11PixmapData*>(d->brush_pm.data.data())->x11ConvertToDefaultDepth()); + : static_cast<QX11PlatformPixmap*>(d->brush_pm.data.data())->x11ConvertToDefaultDepth()); s = FillTiled; #if !defined(QT_NO_XRENDER) d->current_brush = d->cbrush.texture().x11PictureHandle(); @@ -1819,7 +1819,7 @@ void QX11PaintEngine::drawPath(const QPainterPath &path) } } -Q_GUI_EXPORT void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, +Q_WIDGETS_EXPORT void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth) { Q_ASSERT(image.format() == QImage::Format_RGB32); @@ -1925,7 +1925,7 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect QPixmap::x11SetDefaultScreen(pixmap.x11Info().screen()); #ifndef QT_NO_XRENDER - ::Picture src_pict = static_cast<QX11PixmapData*>(pixmap.data.data())->picture; + ::Picture src_pict = static_cast<QX11PlatformPixmap*>(pixmap.data.data())->picture; if (src_pict && d->picture) { const int pDepth = pixmap.depth(); if (pDepth == 1 && (d->has_alpha_pen)) { @@ -1944,7 +1944,7 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect bool mono_dst = d->pdev_depth == 1; bool restore_clip = false; - if (static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask) { // pixmap has a mask + if (static_cast<QX11PlatformPixmap*>(pixmap.data.data())->x11_mask) { // pixmap has a mask QBitmap comb(sw, sh); GC cgc = XCreateGC(d->dpy, comb.handle(), 0, 0); XSetForeground(d->dpy, cgc, 0); @@ -1961,7 +1961,7 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect XSetFillStyle(d->dpy, cgc, FillOpaqueStippled); XSetTSOrigin(d->dpy, cgc, -sx, -sy); XSetStipple(d->dpy, cgc, - static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask); + static_cast<QX11PlatformPixmap*>(pixmap.data.data())->x11_mask); XFillRectangle(d->dpy, comb.handle(), cgc, 0, 0, sw, sh); XFreeGC(d->dpy, cgc); @@ -2007,8 +2007,8 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect if (d->pdev->devType() == QInternal::Pixmap) { const QPixmap *px = static_cast<const QPixmap*>(d->pdev); - Pixmap src_mask = static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask; - Pixmap dst_mask = static_cast<QX11PixmapData*>(px->data.data())->x11_mask; + Pixmap src_mask = static_cast<QX11PlatformPixmap*>(pixmap.data.data())->x11_mask; + Pixmap dst_mask = static_cast<QX11PlatformPixmap*>(px->data.data())->x11_mask; if (dst_mask) { GC cgc = XCreateGC(d->dpy, dst_mask, 0, 0); if (src_mask) { // copy src mask into dst mask @@ -2222,7 +2222,7 @@ void QX11PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, co #endif } else #endif // !QT_NO_XRENDER - if (pixmap.depth() > 1 && !static_cast<QX11PixmapData*>(pixmap.data.data())->x11_mask) { + if (pixmap.depth() > 1 && !static_cast<QX11PlatformPixmap*>(pixmap.data.data())->x11_mask) { XSetTile(d->dpy, d->gc, pixmap.handle()); XSetFillStyle(d->dpy, d->gc, FillTiled); XSetTSOrigin(d->dpy, d->gc, x-sx, y-sy); @@ -2326,7 +2326,7 @@ static QPainterPath path_for_glyphs(const QVarLengthArray<glyph_t> &glyphs, bool set = src[x >> 3] & (0x80 >> (x & 7)); if (set) { QRect r(xp + x, yp - h, 1, 1); - while (x+1 < glyph->width && src[(x+1) >> 3] & (0x80 >> ((x+1) & 7))) { + while (x < glyph->width-1 && src[(x+1) >> 3] & (0x80 >> ((x+1) & 7))) { ++x; r.setRight(r.right()+1); } @@ -2358,7 +2358,7 @@ void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti) const bool xrenderPath = (X11->use_xrender && !(d->pdev->devType() == QInternal::Pixmap - && static_cast<const QPixmap *>(d->pdev)->data->pixelType() == QPixmapData::BitmapType)); + && static_cast<const QPixmap *>(d->pdev)->data->pixelType() == QPlatformPixmap::BitmapType)); QVarLengthArray<QFixedPoint> positions; QVarLengthArray<glyph_t> glyphs; diff --git a/src/gui/painting/qpaintengine_x11_p.h b/src/widgets/platforms/x11/qpaintengine_x11_p.h similarity index 98% rename from src/gui/painting/qpaintengine_x11_p.h rename to src/widgets/platforms/x11/qpaintengine_x11_p.h index d8d8817993e..2ff339bbe1e 100644 --- a/src/gui/painting/qpaintengine_x11_p.h +++ b/src/widgets/platforms/x11/qpaintengine_x11_p.h @@ -131,8 +131,8 @@ protected: friend class QPixmap; friend class QFontEngineBox; - friend Q_GUI_EXPORT GC qt_x11_get_pen_gc(QPainter *); - friend Q_GUI_EXPORT GC qt_x11_get_brush_gc(QPainter *); + friend Q_WIDGETS_EXPORT GC qt_x11_get_pen_gc(QPainter *); + friend Q_WIDGETS_EXPORT GC qt_x11_get_brush_gc(QPainter *); private: Q_DISABLE_COPY(QX11PaintEngine) diff --git a/src/gui/image/qpixmap_x11.cpp b/src/widgets/platforms/x11/qpixmap_x11.cpp similarity index 95% rename from src/gui/image/qpixmap_x11.cpp rename to src/widgets/platforms/x11/qpixmap_x11.cpp index 77c2a2a9d93..500d1e3ddfa 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/widgets/platforms/x11/qpixmap_x11.cpp @@ -80,10 +80,10 @@ QT_BEGIN_NAMESPACE QPixmap qt_toX11Pixmap(const QImage &image) { - QPixmapData *data = - new QX11PixmapData(image.depth() == 1 - ? QPixmapData::BitmapType - : QPixmapData::PixmapType); + QPlatformPixmap *data = + new QX11PlatformPixmap(image.depth() == 1 + ? QPlatformPixmap::BitmapType + : QPlatformPixmap::PixmapType); data->fromImage(image, Qt::AutoColor); @@ -95,7 +95,7 @@ QPixmap qt_toX11Pixmap(const QPixmap &pixmap) if (pixmap.isNull()) return QPixmap(); - if (QPixmap(pixmap).data_ptr()->classId() == QPixmapData::X11Class) + if (QPixmap(pixmap).data_ptr()->classId() == QPlatformPixmap::X11Class) return pixmap; return qt_toX11Pixmap(pixmap.toImage()); @@ -113,7 +113,7 @@ inline static void qSafeXDestroyImage(XImage *x) XDestroyImage(x); } -QBitmap QX11PixmapData::mask_to_bitmap(int screen) const +QBitmap QX11PlatformPixmap::mask_to_bitmap(int screen) const { if (!x11_mask) return QBitmap(); @@ -126,7 +126,7 @@ QBitmap QX11PixmapData::mask_to_bitmap(int screen) const return bm; } -Qt::HANDLE QX11PixmapData::bitmap_to_mask(const QBitmap &bitmap, int screen) +Qt::HANDLE QX11PlatformPixmap::bitmap_to_mask(const QBitmap &bitmap, int screen) { if (bitmap.isNull()) return 0; @@ -311,21 +311,21 @@ static int defaultScreen = -1; *****************************************************************************/ QBasicAtomicInt qt_pixmap_serial = Q_BASIC_ATOMIC_INITIALIZER(0); -int Q_GUI_EXPORT qt_x11_preferred_pixmap_depth = 0; +int Q_WIDGETS_EXPORT qt_x11_preferred_pixmap_depth = 0; -QX11PixmapData::QX11PixmapData(PixelType type) - : QPixmapData(type, X11Class), gl_surface(0), hd(0), +QX11PlatformPixmap::QX11PlatformPixmap(PixelType type) + : QPlatformPixmap(type, X11Class), gl_surface(0), hd(0), flags(Uninitialized), x11_mask(0), picture(0), mask_picture(0), hd2(0), share_mode(QPixmap::ImplicitlyShared), pengine(0) { } -QPixmapData *QX11PixmapData::createCompatiblePixmapData() const +QPlatformPixmap *QX11PlatformPixmap::createCompatiblePlatformPixmap() const { - return new QX11PixmapData(pixelType()); + return new QX11PlatformPixmap(pixelType()); } -void QX11PixmapData::resize(int width, int height) +void QX11PlatformPixmap::resize(int width, int height) { setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); @@ -407,7 +407,7 @@ struct QX11AlphaDetector mutable bool has; }; -void QX11PixmapData::fromImage(const QImage &img, +void QX11PlatformPixmap::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); @@ -1142,7 +1142,7 @@ void QX11PixmapData::fromImage(const QImage &img, } } -Qt::HANDLE QX11PixmapData::createBitmapFromImage(const QImage &image) +Qt::HANDLE QX11PlatformPixmap::createBitmapFromImage(const QImage &image) { QImage img = image.convertToFormat(QImage::Format_MonoLSB); const QRgb c0 = QColor(Qt::black).rgb(); @@ -1183,7 +1183,7 @@ Qt::HANDLE QX11PixmapData::createBitmapFromImage(const QImage &image) return hd; } -void QX11PixmapData::bitmapFromImage(const QImage &image) +void QX11PlatformPixmap::bitmapFromImage(const QImage &image) { w = image.width(); h = image.height(); @@ -1197,7 +1197,7 @@ void QX11PixmapData::bitmapFromImage(const QImage &image) #endif // QT_NO_XRENDER } -void QX11PixmapData::fill(const QColor &fillColor) +void QX11PlatformPixmap::fill(const QColor &fillColor) { if (fillColor.alpha() != 255) { #ifndef QT_NO_XRENDER @@ -1233,18 +1233,18 @@ void QX11PixmapData::fill(const QColor &fillColor) XFreeGC(X11->display, gc); } -QX11PixmapData::~QX11PixmapData() +QX11PlatformPixmap::~QX11PlatformPixmap() { // Cleanup hooks have to be called before the handles are freed if (is_cached) { - QImagePixmapCleanupHooks::executePixmapDataDestructionHooks(this); + QImagePixmapCleanupHooks::executePlatformPixmapDestructionHooks(this); is_cached = false; } release(); } -void QX11PixmapData::release() +void QX11PlatformPixmap::release() { delete pengine; pengine = 0; @@ -1283,7 +1283,7 @@ void QX11PixmapData::release() } } -QPixmap QX11PixmapData::alphaChannel() const +QPixmap QX11PlatformPixmap::alphaChannel() const { if (!hasAlphaChannel()) { QPixmap pm(w, h); @@ -1294,7 +1294,7 @@ QPixmap QX11PixmapData::alphaChannel() const return QPixmap::fromImage(im.alphaChannel(), Qt::OrderedDither); } -void QX11PixmapData::setAlphaChannel(const QPixmap &alpha) +void QX11PlatformPixmap::setAlphaChannel(const QPixmap &alpha) { QImage image(toImage()); image.setAlphaChannel(alpha.toImage()); @@ -1303,7 +1303,7 @@ void QX11PixmapData::setAlphaChannel(const QPixmap &alpha) } -QBitmap QX11PixmapData::mask() const +QBitmap QX11PlatformPixmap::mask() const { QBitmap mask; #ifndef QT_NO_XRENDER @@ -1313,7 +1313,7 @@ QBitmap QX11PixmapData::mask() const } else #endif if (d == 1) { - QX11PixmapData *that = const_cast<QX11PixmapData*>(this); + QX11PlatformPixmap *that = const_cast<QX11PlatformPixmap*>(this); mask = QPixmap(that); } else { mask = mask_to_bitmap(xinfo.screen()); @@ -1342,12 +1342,12 @@ QBitmap QX11PixmapData::mask() const \sa mask(), {QPixmap#Pixmap Transformations}{Pixmap Transformations}, QBitmap */ -void QX11PixmapData::setMask(const QBitmap &newmask) +void QX11PlatformPixmap::setMask(const QBitmap &newmask) { if (newmask.isNull()) { // clear mask #ifndef QT_NO_XRENDER if (picture && d == 32) { - QX11PixmapData newData(pixelType()); + QX11PlatformPixmap newData(pixelType()); newData.resize(w, h); newData.fill(Qt::black); XRenderComposite(X11->display, PictOpOver, @@ -1355,11 +1355,11 @@ void QX11PixmapData::setMask(const QBitmap &newmask) 0, 0, 0, 0, 0, 0, w, h); release(); *this = newData; - // the new QX11PixmapData object isn't referenced yet, so + // the new QX11PlatformPixmap object isn't referenced yet, so // ref it ref.ref(); - // the below is to make sure the QX11PixmapData destructor + // the below is to make sure the QX11PlatformPixmap destructor // doesn't delete our newly created render picture newData.hd = 0; newData.x11_mask = 0; @@ -1409,7 +1409,7 @@ void QX11PixmapData::setMask(const QBitmap &newmask) XRenderFreePicture(X11->display, mask_picture); #endif } - x11_mask = QX11PixmapData::bitmap_to_mask(newmask, xinfo.screen()); + x11_mask = QX11PlatformPixmap::bitmap_to_mask(newmask, xinfo.screen()); #ifndef QT_NO_XRENDER if (picture) { mask_picture = XRenderCreatePicture(X11->display, x11_mask, @@ -1422,7 +1422,7 @@ void QX11PixmapData::setMask(const QBitmap &newmask) } } -int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const +int QX11PlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const { switch (metric) { case QPaintDevice::PdmWidth: @@ -1452,7 +1452,7 @@ int QX11PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmPhysicalDpiY: return QX11Info::appDpiY(xinfo.screen()); default: - qWarning("QX11PixmapData::metric(): Invalid metric"); + qWarning("QX11PlatformPixmap::metric(): Invalid metric"); return 0; } } @@ -1462,7 +1462,7 @@ struct QXImageWrapper XImage *xi; }; -bool QX11PixmapData::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) const +bool QX11PlatformPixmap::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) const { XImage *xi = xiWrapper.xi; @@ -1485,7 +1485,7 @@ bool QX11PixmapData::canTakeQImageFromXImage(const QXImageWrapper &xiWrapper) co return false; } -QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) const +QImage QX11PlatformPixmap::takeQImageFromXImage(const QXImageWrapper &xiWrapper) const { XImage *xi = xiWrapper.xi; @@ -1538,7 +1538,7 @@ QImage QX11PixmapData::takeQImageFromXImage(const QXImageWrapper &xiWrapper) con return image; } -QImage QX11PixmapData::toImage(const QRect &rect) const +QImage QX11PlatformPixmap::toImage(const QRect &rect) const { QXImageWrapper xiWrapper; xiWrapper.xi = XGetImage(X11->display, hd, rect.x(), rect.y(), rect.width(), rect.height(), @@ -1571,12 +1571,12 @@ QImage QX11PixmapData::toImage(const QRect &rect) const \sa fromImage(), {QImage#Image Formats}{Image Formats} */ -QImage QX11PixmapData::toImage() const +QImage QX11PlatformPixmap::toImage() const { return toImage(QRect(0, 0, w, h)); } -QImage QX11PixmapData::toImage(const QXImageWrapper &xiWrapper, const QRect &rect) const +QImage QX11PlatformPixmap::toImage(const QXImageWrapper &xiWrapper, const QRect &rect) const { XImage *xi = xiWrapper.xi; @@ -1852,7 +1852,7 @@ QImage QX11PixmapData::toImage(const QXImageWrapper &xiWrapper, const QRect &rec \sa trueMatrix(), {QPixmap#Pixmap Transformations}{Pixmap Transformations} */ -QPixmap QX11PixmapData::transformed(const QTransform &transform, +QPixmap QX11PlatformPixmap::transformed(const QTransform &transform, Qt::TransformationMode mode ) const { if (mode == Qt::SmoothTransformation || transform.type() >= QTransform::TxProject) { @@ -2002,9 +2002,9 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform, free(dptr); return bm; } else { // color pixmap - QX11PixmapData *x11Data = new QX11PixmapData(QPixmapData::PixmapType); + QX11PlatformPixmap *x11Data = new QX11PlatformPixmap(QPlatformPixmap::PixmapType); QPixmap pm(x11Data); - x11Data->flags &= ~QX11PixmapData::Uninitialized; + x11Data->flags &= ~QX11PlatformPixmap::Uninitialized; x11Data->xinfo = xinfo; x11Data->d = d; x11Data->w = w; @@ -2067,13 +2067,13 @@ void QPixmap::x11SetScreen(int screen) if (isNull()) return; - if (data->classId() != QPixmapData::X11Class) + if (data->classId() != QPlatformPixmap::X11Class) return; if (screen < 0) screen = QX11Info::appScreen(); - QX11PixmapData *x11Data = static_cast<QX11PixmapData*>(data.data()); + QX11PlatformPixmap *x11Data = static_cast<QX11PlatformPixmap*>(data.data()); if (screen == x11Data->xinfo.screen()) return; // nothing to do @@ -2142,7 +2142,7 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) window_attr = root_attr; } - QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); + QX11PlatformPixmap *data = new QX11PlatformPixmap(QPlatformPixmap::PixmapType); void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const XWindowAttributes &a); qt_x11_getX11InfoForWindow(&data->xinfo,window_attr); @@ -2151,7 +2151,7 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) QPixmap pm(data); - data->flags &= ~QX11PixmapData::Uninitialized; + data->flags &= ~QX11PlatformPixmap::Uninitialized; pm.x11SetScreen(scr); GC gc = XCreateGC(dpy, pm.handle(), 0, 0); @@ -2162,15 +2162,15 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) return pm; } -bool QX11PixmapData::hasAlphaChannel() const +bool QX11PlatformPixmap::hasAlphaChannel() const { return d == 32; } const QX11Info &QPixmap::x11Info() const { - if (data && data->classId() == QPixmapData::X11Class) - return static_cast<QX11PixmapData*>(data.data())->xinfo; + if (data && data->classId() == QPlatformPixmap::X11Class) + return static_cast<QX11PlatformPixmap*>(data.data())->xinfo; else { static QX11Info nullX11Info; return nullX11Info; @@ -2189,9 +2189,9 @@ static XRenderPictFormat *qt_renderformat_for_depth(const QX11Info &xinfo, int d } #endif -QPaintEngine* QX11PixmapData::paintEngine() const +QPaintEngine* QX11PlatformPixmap::paintEngine() const { - QX11PixmapData *that = const_cast<QX11PixmapData*>(this); + QX11PlatformPixmap *that = const_cast<QX11PlatformPixmap*>(this); if ((flags & Readonly) && share_mode == QPixmap::ImplicitlyShared) { // if someone wants to draw onto us, copy the shared contents @@ -2215,7 +2215,7 @@ QPaintEngine* QX11PixmapData::paintEngine() const XFreeGC(X11->display, gc); } that->hd = hd_copy; - that->flags &= ~QX11PixmapData::Readonly; + that->flags &= ~QX11PlatformPixmap::Readonly; } if (!that->pengine) @@ -2226,8 +2226,8 @@ QPaintEngine* QX11PixmapData::paintEngine() const Qt::HANDLE QPixmap::x11PictureHandle() const { #ifndef QT_NO_XRENDER - if (data && data->classId() == QPixmapData::X11Class) - return static_cast<const QX11PixmapData*>(data.data())->picture; + if (data && data->classId() == QPlatformPixmap::X11Class) + return static_cast<const QX11PlatformPixmap*>(data.data())->picture; else return 0; #else @@ -2235,7 +2235,7 @@ Qt::HANDLE QPixmap::x11PictureHandle() const #endif // QT_NO_XRENDER } -Qt::HANDLE QX11PixmapData::x11ConvertToDefaultDepth() +Qt::HANDLE QX11PlatformPixmap::x11ConvertToDefaultDepth() { #ifndef QT_NO_XRENDER if (d == QX11Info::appDepth() || !X11->use_xrender) @@ -2255,14 +2255,14 @@ Qt::HANDLE QX11PixmapData::x11ConvertToDefaultDepth() #endif } -void QX11PixmapData::copy(const QPixmapData *data, const QRect &rect) +void QX11PlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect) { if (data->pixelType() == BitmapType) { fromImage(data->toImage().copy(rect), Qt::AutoColor); return; } - const QX11PixmapData *x11Data = static_cast<const QX11PixmapData*>(data); + const QX11PlatformPixmap *x11Data = static_cast<const QX11PlatformPixmap*>(data); setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); @@ -2317,7 +2317,7 @@ void QX11PixmapData::copy(const QPixmapData *data, const QRect &rect) } } -bool QX11PixmapData::scroll(int dx, int dy, const QRect &rect) +bool QX11PlatformPixmap::scroll(int dx, int dy, const QRect &rect) { GC gc = XCreateGC(X11->display, hd, 0, 0); XCopyArea(X11->display, hd, hd, gc, @@ -2328,7 +2328,7 @@ bool QX11PixmapData::scroll(int dx, int dy, const QRect &rect) } #if !defined(QT_NO_XRENDER) -void QX11PixmapData::convertToARGB32(bool preserveContents) +void QX11PlatformPixmap::convertToARGB32(bool preserveContents) { if (!X11->use_xrender) return; @@ -2383,9 +2383,9 @@ QPixmap QPixmap::fromX11Pixmap(Qt::HANDLE pixmap, QPixmap::ShareMode mode) break; } - QX11PixmapData *data = new QX11PixmapData(depth == 1 ? QPixmapData::BitmapType : QPixmapData::PixmapType); + QX11PlatformPixmap *data = new QX11PlatformPixmap(depth == 1 ? QPlatformPixmap::BitmapType : QPlatformPixmap::PixmapType); data->setSerialNumber(qt_pixmap_serial.fetchAndAddRelaxed(1)); - data->flags = QX11PixmapData::Readonly; + data->flags = QX11PlatformPixmap::Readonly; data->share_mode = mode; data->w = width; data->h = height; diff --git a/src/gui/image/qpixmap_x11_p.h b/src/widgets/platforms/x11/qpixmap_x11_p.h similarity index 86% rename from src/gui/image/qpixmap_x11_p.h rename to src/widgets/platforms/x11/qpixmap_x11_p.h index 7cd80e62f9e..fce32cbe3e1 100644 --- a/src/gui/image/qpixmap_x11_p.h +++ b/src/widgets/platforms/x11/qpixmap_x11_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include <QtGui/private/qpixmapdata_p.h> -#include <QtGui/private/qpixmapdatafactory_p.h> +#include <QtGui/qplatformpixmap_qpa.h> +#include <QtGui/qplatformpixmapfactory_p.h> #include "QtGui/qx11info_x11.h" @@ -64,20 +64,20 @@ class QX11PaintEngine; struct QXImageWrapper; -class Q_GUI_EXPORT QX11PixmapData : public QPixmapData +class Q_WIDGETS_EXPORT QX11PlatformPixmap : public QPlatformPixmap { public: - QX11PixmapData(PixelType type); -// QX11PixmapData(PixelType type, int width, int height); -// QX11PixmapData(PixelType type, const QImage &image, + QX11PlatformPixmap(PixelType type); +// QX11PlatformPixmap(PixelType type, int width, int height); +// QX11PlatformPixmap(PixelType type, const QImage &image, // Qt::ImageConversionFlags flags); - ~QX11PixmapData(); + ~QX11PlatformPixmap(); - QPixmapData *createCompatiblePixmapData() const; + QPlatformPixmap *createCompatiblePlatformPixmap() const; void resize(int width, int height); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); - void copy(const QPixmapData *data, const QRect &rect); + void copy(const QPlatformPixmap *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); void fill(const QColor &color); @@ -114,9 +114,9 @@ private: friend class QGLContextPrivate; // Needs to access xinfo, gl_surface & flags friend class QEglContext; // Needs gl_surface friend class QGLContext; // Needs gl_surface - friend class QX11GLPixmapData; // Needs gl_surface - friend class QMeeGoLivePixmapData; // Needs gl_surface and flags - friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs gl_surface + friend class QX11GLPlatformPixmap; // Needs gl_surface + friend class QMeeGoLivePlatformPixmap; // Needs gl_surface and flags + friend bool qt_createEGLSurfaceForPixmap(QPlatformPixmap*, bool); // Needs gl_surface void release(); diff --git a/src/gui/painting/qregion_x11.cpp b/src/widgets/platforms/x11/qregion_x11.cpp similarity index 100% rename from src/gui/painting/qregion_x11.cpp rename to src/widgets/platforms/x11/qregion_x11.cpp diff --git a/src/gui/kernel/qsound_x11.cpp b/src/widgets/platforms/x11/qsound_x11.cpp similarity index 100% rename from src/gui/kernel/qsound_x11.cpp rename to src/widgets/platforms/x11/qsound_x11.cpp diff --git a/src/gui/kernel/qt_x11_p.h b/src/widgets/platforms/x11/qt_x11_p.h similarity index 99% rename from src/gui/kernel/qt_x11_p.h rename to src/widgets/platforms/x11/qt_x11_p.h index 1a9830d42bd..ea808fb8a29 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/widgets/platforms/x11/qt_x11_p.h @@ -332,7 +332,7 @@ struct QXdndDropTransaction class QMimeData; struct QX11Data; -extern Q_GUI_EXPORT QX11Data *qt_x11Data; +extern Q_WIDGETS_EXPORT QX11Data *qt_x11Data; enum DesktopEnvironment { DE_UNKNOWN, diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/widgets/platforms/x11/qwidget_x11.cpp similarity index 99% rename from src/gui/kernel/qwidget_x11.cpp rename to src/widgets/platforms/x11/qwidget_x11.cpp index eaa9405c364..5bb59b26c97 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/widgets/platforms/x11/qwidget_x11.cpp @@ -134,7 +134,7 @@ enum { }; -static QtMWMHints GetMWMHints(Display *display, Window window) +static QtMWMHints getMWMHints(Display *display, Window window) { QtMWMHints mwmhints; @@ -341,7 +341,7 @@ void qt_x11_enforce_cursor(QWidget * w, bool force) } } -Q_GUI_EXPORT void qt_x11_enforce_cursor(QWidget * w) +Q_WIDGETS_EXPORT void qt_x11_enforce_cursor(QWidget * w) { qt_x11_enforce_cursor(w, false); } @@ -397,7 +397,7 @@ void qt_x11_wait_for_window_manager(QWidget *w, bool sendPostedEvents) } while(1); } -Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget *w) +Q_WIDGETS_EXPORT void qt_x11_wait_for_window_manager(QWidget *w) { qt_x11_wait_for_window_manager(w, true); } @@ -1400,7 +1400,7 @@ void QWidgetPrivate::updateSystemBackground() else if (brush.style() == Qt::TexturePattern) { extern QPixmap qt_toX11Pixmap(const QPixmap &pixmap); // qpixmap_x11.cpp XSetWindowBackgroundPixmap(X11->display, q->internalWinId(), - static_cast<QX11PixmapData*>(qt_toX11Pixmap(brush.texture()).data.data())->x11ConvertToDefaultDepth()); + static_cast<QX11PlatformPixmap*>(qt_toX11Pixmap(brush.texture()).data.data())->x11ConvertToDefaultDepth()); } else XSetWindowBackground(X11->display, q->internalWinId(), QColormap::instance(xinfo.screen()).pixel(brush.color())); @@ -1546,7 +1546,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) // violates the ICCCM), since this works on all DEs known to Qt if (!forceReset || !topData->iconPixmap) topData->iconPixmap = new QPixmap(qt_toX11Pixmap(icon.pixmap(QSize(64,64)))); - pixmap_handle = static_cast<QX11PixmapData*>(topData->iconPixmap->data.data())->x11ConvertToDefaultDepth(); + pixmap_handle = static_cast<QX11PlatformPixmap*>(topData->iconPixmap->data.data())->x11ConvertToDefaultDepth(); } } } diff --git a/src/gui/kernel/qwidgetcreate_x11.cpp b/src/widgets/platforms/x11/qwidgetcreate_x11.cpp similarity index 100% rename from src/gui/kernel/qwidgetcreate_x11.cpp rename to src/widgets/platforms/x11/qwidgetcreate_x11.cpp diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/widgets/platforms/x11/qx11embed_x11.cpp similarity index 100% rename from src/gui/kernel/qx11embed_x11.cpp rename to src/widgets/platforms/x11/qx11embed_x11.cpp diff --git a/src/gui/kernel/qx11embed_x11.h b/src/widgets/platforms/x11/qx11embed_x11.h similarity index 95% rename from src/gui/kernel/qx11embed_x11.h rename to src/widgets/platforms/x11/qx11embed_x11.h index ada7a29ed35..fcf94b60a27 100644 --- a/src/gui/kernel/qx11embed_x11.h +++ b/src/widgets/platforms/x11/qx11embed_x11.h @@ -42,7 +42,7 @@ #ifndef QX11EMBED_X11_H #define QX11EMBED_X11_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QX11EmbedWidgetPrivate; -class Q_GUI_EXPORT QX11EmbedWidget : public QWidget +class Q_WIDGETS_EXPORT QX11EmbedWidget : public QWidget { Q_OBJECT public: @@ -85,7 +85,7 @@ private: }; class QX11EmbedContainerPrivate; -class Q_GUI_EXPORT QX11EmbedContainer : public QWidget +class Q_WIDGETS_EXPORT QX11EmbedContainer : public QWidget { Q_OBJECT public: diff --git a/src/gui/kernel/qx11info_x11.cpp b/src/widgets/platforms/x11/qx11info_x11.cpp similarity index 100% rename from src/gui/kernel/qx11info_x11.cpp rename to src/widgets/platforms/x11/qx11info_x11.cpp diff --git a/src/gui/kernel/qx11info_x11.h b/src/widgets/platforms/x11/qx11info_x11.h similarity index 98% rename from src/gui/kernel/qx11info_x11.h rename to src/widgets/platforms/x11/qx11info_x11.h index 2d81c6be76d..60cd0e9e921 100644 --- a/src/gui/kernel/qx11info_x11.h +++ b/src/widgets/platforms/x11/qx11info_x11.h @@ -60,7 +60,7 @@ class QX11InfoPrivate; struct QX11WindowAttributes; void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const QX11WindowAttributes &a); -class Q_GUI_EXPORT QX11Info +class Q_WIDGETS_EXPORT QX11Info { public: QX11Info(); @@ -106,7 +106,7 @@ protected: friend class QX11PaintEngine; friend class QPixmap; - friend class QX11PixmapData; + friend class QX11PlatformPixmap; friend class QWidget; friend class QWidgetPrivate; friend class QGLWidget; diff --git a/src/gui/inputmethod/qximinputcontext_p.h b/src/widgets/platforms/x11/qximinputcontext_p.h similarity index 99% rename from src/gui/inputmethod/qximinputcontext_p.h rename to src/widgets/platforms/x11/qximinputcontext_p.h index 1f89a087459..47c6f78ff9d 100644 --- a/src/gui/inputmethod/qximinputcontext_p.h +++ b/src/widgets/platforms/x11/qximinputcontext_p.h @@ -70,7 +70,7 @@ #if !defined(Q_NO_IM) #include "QtCore/qglobal.h" -#include "QtGui/qinputcontext.h" +#include "QtWidgets/qinputcontext.h" #include "QtGui/qfont.h" #include "QtCore/qhash.h" #ifdef Q_WS_X11 diff --git a/src/gui/inputmethod/qximinputcontext_x11.cpp b/src/widgets/platforms/x11/qximinputcontext_x11.cpp similarity index 100% rename from src/gui/inputmethod/qximinputcontext_x11.cpp rename to src/widgets/platforms/x11/qximinputcontext_x11.cpp diff --git a/src/gui/s60framework/qs60mainapplication.cpp b/src/widgets/s60framework/qs60mainapplication.cpp similarity index 100% rename from src/gui/s60framework/qs60mainapplication.cpp rename to src/widgets/s60framework/qs60mainapplication.cpp diff --git a/src/gui/s60framework/qs60mainapplication.h b/src/widgets/s60framework/qs60mainapplication.h similarity index 97% rename from src/gui/s60framework/qs60mainapplication.h rename to src/widgets/s60framework/qs60mainapplication.h index 74e37061559..2e06181b86b 100644 --- a/src/gui/s60framework/qs60mainapplication.h +++ b/src/widgets/s60framework/qs60mainapplication.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QS60MainApplication : public QS60MainApplicationBase +class Q_WIDGETS_EXPORT QS60MainApplication : public QS60MainApplicationBase { public: QS60MainApplication(); diff --git a/src/gui/s60framework/qs60mainapplication_p.h b/src/widgets/s60framework/qs60mainapplication_p.h similarity index 100% rename from src/gui/s60framework/qs60mainapplication_p.h rename to src/widgets/s60framework/qs60mainapplication_p.h diff --git a/src/gui/s60framework/qs60mainappui.cpp b/src/widgets/s60framework/qs60mainappui.cpp similarity index 99% rename from src/gui/s60framework/qs60mainappui.cpp rename to src/widgets/s60framework/qs60mainappui.cpp index bfd18256e14..05e538e65ae 100644 --- a/src/gui/s60framework/qs60mainappui.cpp +++ b/src/widgets/s60framework/qs60mainappui.cpp @@ -53,9 +53,9 @@ #include <qconfig.h> #include "qs60mainappui.h" -#include <QtGui/qapplication.h> -#include <QtGui/qsymbianevent.h> -#include <QtGui/qmenu.h> +#include <QtWidgets/qapplication.h> +#include <QtWidgets/qsymbianevent.h> +#include <QtWidgets/qmenu.h> #include <private/qmenu_p.h> #include <private/qt_s60_p.h> #include <qdebug.h> diff --git a/src/gui/s60framework/qs60mainappui.h b/src/widgets/s60framework/qs60mainappui.h similarity index 98% rename from src/gui/s60framework/qs60mainappui.h rename to src/widgets/s60framework/qs60mainappui.h index 374bc4428fb..7d5a265a2ab 100644 --- a/src/gui/s60framework/qs60mainappui.h +++ b/src/widgets/s60framework/qs60mainappui.h @@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QS60MainAppUi : public QS60MainAppUiBase +class Q_WIDGETS_EXPORT QS60MainAppUi : public QS60MainAppUiBase { public: QS60MainAppUi(); diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/widgets/s60framework/qs60maindocument.cpp similarity index 100% rename from src/gui/s60framework/qs60maindocument.cpp rename to src/widgets/s60framework/qs60maindocument.cpp diff --git a/src/gui/s60framework/qs60maindocument.h b/src/widgets/s60framework/qs60maindocument.h similarity index 97% rename from src/gui/s60framework/qs60maindocument.h rename to src/widgets/s60framework/qs60maindocument.h index 6ede66a9bba..6a8e9a52f78 100644 --- a/src/gui/s60framework/qs60maindocument.h +++ b/src/widgets/s60framework/qs60maindocument.h @@ -64,7 +64,7 @@ QT_MODULE(Gui) class QS60MainAppUi; -class Q_GUI_EXPORT QS60MainDocument : public QS60MainDocumentBase +class Q_WIDGETS_EXPORT QS60MainDocument : public QS60MainDocumentBase { public: diff --git a/src/gui/s60framework/s60framework.pri b/src/widgets/s60framework/s60framework.pri similarity index 100% rename from src/gui/s60framework/s60framework.pri rename to src/widgets/s60framework/s60framework.pri diff --git a/src/gui/s60framework/s60main.rss b/src/widgets/s60framework/s60main.rss similarity index 100% rename from src/gui/s60framework/s60main.rss rename to src/widgets/s60framework/s60main.rss diff --git a/src/gui/statemachine/qbasickeyeventtransition.cpp b/src/widgets/statemachine/qbasickeyeventtransition.cpp similarity index 100% rename from src/gui/statemachine/qbasickeyeventtransition.cpp rename to src/widgets/statemachine/qbasickeyeventtransition.cpp diff --git a/src/gui/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h similarity index 100% rename from src/gui/statemachine/qbasickeyeventtransition_p.h rename to src/widgets/statemachine/qbasickeyeventtransition_p.h diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/widgets/statemachine/qbasicmouseeventtransition.cpp similarity index 100% rename from src/gui/statemachine/qbasicmouseeventtransition.cpp rename to src/widgets/statemachine/qbasicmouseeventtransition.cpp diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h similarity index 100% rename from src/gui/statemachine/qbasicmouseeventtransition_p.h rename to src/widgets/statemachine/qbasicmouseeventtransition_p.h diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp similarity index 94% rename from src/gui/statemachine/qguistatemachine.cpp rename to src/widgets/statemachine/qguistatemachine.cpp index 45bea5ae24f..7a498eb77f8 100644 --- a/src/gui/statemachine/qguistatemachine.cpp +++ b/src/widgets/statemachine/qguistatemachine.cpp @@ -45,7 +45,7 @@ #include <private/qstatemachine_p.h> #include <QtGui/qevent.h> -#include <QtGui/qgraphicssceneevent.h> +#include <QtWidgets/qgraphicssceneevent.h> QT_BEGIN_NAMESPACE @@ -148,22 +148,11 @@ static QEvent *cloneEvent(QEvent *e) return new QDragLeaveEvent(*static_cast<QDragLeaveEvent*>(e)); case QEvent::Drop: return new QDropEvent(*static_cast<QDragMoveEvent*>(e)); - case QEvent::DragResponse: - return new QDragResponseEvent(*static_cast<QDragResponseEvent*>(e)); #endif case QEvent::ChildAdded: return new QChildEvent(*static_cast<QChildEvent*>(e)); case QEvent::ChildPolished: return new QChildEvent(*static_cast<QChildEvent*>(e)); -#ifdef QT3_SUPPORT - case QEvent::ChildInsertedRequest: - return new QEvent(*e); - case QEvent::ChildInserted: - return new QChildEvent(*static_cast<QChildEvent*>(e)); - case QEvent::LayoutHint: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; -#endif case QEvent::ChildRemoved: return new QChildEvent(*static_cast<QChildEvent*>(e)); case QEvent::ShowWindowRequest: @@ -266,15 +255,6 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::ShortcutOverride: return new QKeyEvent(*static_cast<QKeyEvent*>(e)); -#ifdef QT3_SUPPORT - case QEvent::Accel: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; - case QEvent::AccelAvailable: - Q_ASSERT_X(false, "cloneEvent()", "not implemented"); - break; -#endif - #ifndef QT_NO_WHATSTHIS case QEvent::WhatsThisClicked: return new QWhatsThisClickedEvent(*static_cast<QWhatsThisClickedEvent*>(e)); @@ -321,11 +301,6 @@ static QEvent *cloneEvent(QEvent *e) case QEvent::AcceptDropsChange: return new QEvent(*e); -#ifdef QT3_SUPPORT - case QEvent::MenubarUpdated: - return new QMenubarUpdatedEvent(*static_cast<QMenubarUpdatedEvent*>(e)); -#endif - case QEvent::ZeroTimerEvent: Q_ASSERT_X(false, "cloneEvent()", "not implemented"); break; @@ -481,10 +456,6 @@ static QEvent *cloneEvent(QEvent *e) break; #endif - case QEvent::RequestSoftwareInputPanel: - case QEvent::CloseSoftwareInputPanel: - return new QEvent(*e); - case QEvent::UpdateSoftKeys: return new QEvent(*e); diff --git a/src/gui/statemachine/qkeyeventtransition.cpp b/src/widgets/statemachine/qkeyeventtransition.cpp similarity index 100% rename from src/gui/statemachine/qkeyeventtransition.cpp rename to src/widgets/statemachine/qkeyeventtransition.cpp diff --git a/src/gui/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h similarity index 97% rename from src/gui/statemachine/qkeyeventtransition.h rename to src/widgets/statemachine/qkeyeventtransition.h index caa540a5d90..7862bd41d77 100644 --- a/src/gui/statemachine/qkeyeventtransition.h +++ b/src/widgets/statemachine/qkeyeventtransition.h @@ -53,7 +53,7 @@ QT_MODULE(Gui) #ifndef QT_NO_STATEMACHINE class QKeyEventTransitionPrivate; -class Q_GUI_EXPORT QKeyEventTransition : public QEventTransition +class Q_WIDGETS_EXPORT QKeyEventTransition : public QEventTransition { Q_OBJECT Q_PROPERTY(int key READ key WRITE setKey) diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/widgets/statemachine/qmouseeventtransition.cpp similarity index 100% rename from src/gui/statemachine/qmouseeventtransition.cpp rename to src/widgets/statemachine/qmouseeventtransition.cpp diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h similarity index 97% rename from src/gui/statemachine/qmouseeventtransition.h rename to src/widgets/statemachine/qmouseeventtransition.h index 1304b43b0e2..7255a968ace 100644 --- a/src/gui/statemachine/qmouseeventtransition.h +++ b/src/widgets/statemachine/qmouseeventtransition.h @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QMouseEventTransitionPrivate; class QPainterPath; -class Q_GUI_EXPORT QMouseEventTransition : public QEventTransition +class Q_WIDGETS_EXPORT QMouseEventTransition : public QEventTransition { Q_OBJECT Q_PROPERTY(Qt::MouseButton button READ button WRITE setButton) diff --git a/src/gui/statemachine/statemachine.pri b/src/widgets/statemachine/statemachine.pri similarity index 100% rename from src/gui/statemachine/statemachine.pri rename to src/widgets/statemachine/statemachine.pri diff --git a/src/gui/styles/images/cdr-128.png b/src/widgets/styles/images/cdr-128.png similarity index 100% rename from src/gui/styles/images/cdr-128.png rename to src/widgets/styles/images/cdr-128.png diff --git a/src/gui/styles/images/cdr-16.png b/src/widgets/styles/images/cdr-16.png similarity index 100% rename from src/gui/styles/images/cdr-16.png rename to src/widgets/styles/images/cdr-16.png diff --git a/src/gui/styles/images/cdr-32.png b/src/widgets/styles/images/cdr-32.png similarity index 100% rename from src/gui/styles/images/cdr-32.png rename to src/widgets/styles/images/cdr-32.png diff --git a/src/gui/styles/images/closedock-16.png b/src/widgets/styles/images/closedock-16.png similarity index 100% rename from src/gui/styles/images/closedock-16.png rename to src/widgets/styles/images/closedock-16.png diff --git a/src/gui/styles/images/closedock-down-16.png b/src/widgets/styles/images/closedock-down-16.png similarity index 100% rename from src/gui/styles/images/closedock-down-16.png rename to src/widgets/styles/images/closedock-down-16.png diff --git a/src/gui/styles/images/computer-16.png b/src/widgets/styles/images/computer-16.png similarity index 100% rename from src/gui/styles/images/computer-16.png rename to src/widgets/styles/images/computer-16.png diff --git a/src/gui/styles/images/computer-32.png b/src/widgets/styles/images/computer-32.png similarity index 100% rename from src/gui/styles/images/computer-32.png rename to src/widgets/styles/images/computer-32.png diff --git a/src/gui/styles/images/defaults60theme.blob b/src/widgets/styles/images/defaults60theme.blob similarity index 100% rename from src/gui/styles/images/defaults60theme.blob rename to src/widgets/styles/images/defaults60theme.blob diff --git a/src/gui/styles/images/desktop-16.png b/src/widgets/styles/images/desktop-16.png similarity index 100% rename from src/gui/styles/images/desktop-16.png rename to src/widgets/styles/images/desktop-16.png diff --git a/src/gui/styles/images/desktop-32.png b/src/widgets/styles/images/desktop-32.png similarity index 100% rename from src/gui/styles/images/desktop-32.png rename to src/widgets/styles/images/desktop-32.png diff --git a/src/gui/styles/images/dirclosed-128.png b/src/widgets/styles/images/dirclosed-128.png similarity index 100% rename from src/gui/styles/images/dirclosed-128.png rename to src/widgets/styles/images/dirclosed-128.png diff --git a/src/gui/styles/images/dirclosed-16.png b/src/widgets/styles/images/dirclosed-16.png similarity index 100% rename from src/gui/styles/images/dirclosed-16.png rename to src/widgets/styles/images/dirclosed-16.png diff --git a/src/gui/styles/images/dirclosed-32.png b/src/widgets/styles/images/dirclosed-32.png similarity index 100% rename from src/gui/styles/images/dirclosed-32.png rename to src/widgets/styles/images/dirclosed-32.png diff --git a/src/gui/styles/images/dirlink-128.png b/src/widgets/styles/images/dirlink-128.png similarity index 100% rename from src/gui/styles/images/dirlink-128.png rename to src/widgets/styles/images/dirlink-128.png diff --git a/src/gui/styles/images/dirlink-16.png b/src/widgets/styles/images/dirlink-16.png similarity index 100% rename from src/gui/styles/images/dirlink-16.png rename to src/widgets/styles/images/dirlink-16.png diff --git a/src/gui/styles/images/dirlink-32.png b/src/widgets/styles/images/dirlink-32.png similarity index 100% rename from src/gui/styles/images/dirlink-32.png rename to src/widgets/styles/images/dirlink-32.png diff --git a/src/gui/styles/images/diropen-128.png b/src/widgets/styles/images/diropen-128.png similarity index 100% rename from src/gui/styles/images/diropen-128.png rename to src/widgets/styles/images/diropen-128.png diff --git a/src/gui/styles/images/diropen-16.png b/src/widgets/styles/images/diropen-16.png similarity index 100% rename from src/gui/styles/images/diropen-16.png rename to src/widgets/styles/images/diropen-16.png diff --git a/src/gui/styles/images/diropen-32.png b/src/widgets/styles/images/diropen-32.png similarity index 100% rename from src/gui/styles/images/diropen-32.png rename to src/widgets/styles/images/diropen-32.png diff --git a/src/gui/styles/images/dockdock-16.png b/src/widgets/styles/images/dockdock-16.png similarity index 100% rename from src/gui/styles/images/dockdock-16.png rename to src/widgets/styles/images/dockdock-16.png diff --git a/src/gui/styles/images/dockdock-down-16.png b/src/widgets/styles/images/dockdock-down-16.png similarity index 100% rename from src/gui/styles/images/dockdock-down-16.png rename to src/widgets/styles/images/dockdock-down-16.png diff --git a/src/gui/styles/images/down-128.png b/src/widgets/styles/images/down-128.png similarity index 100% rename from src/gui/styles/images/down-128.png rename to src/widgets/styles/images/down-128.png diff --git a/src/gui/styles/images/down-16.png b/src/widgets/styles/images/down-16.png similarity index 100% rename from src/gui/styles/images/down-16.png rename to src/widgets/styles/images/down-16.png diff --git a/src/gui/styles/images/down-32.png b/src/widgets/styles/images/down-32.png similarity index 100% rename from src/gui/styles/images/down-32.png rename to src/widgets/styles/images/down-32.png diff --git a/src/gui/styles/images/dvd-128.png b/src/widgets/styles/images/dvd-128.png similarity index 100% rename from src/gui/styles/images/dvd-128.png rename to src/widgets/styles/images/dvd-128.png diff --git a/src/gui/styles/images/dvd-16.png b/src/widgets/styles/images/dvd-16.png similarity index 100% rename from src/gui/styles/images/dvd-16.png rename to src/widgets/styles/images/dvd-16.png diff --git a/src/gui/styles/images/dvd-32.png b/src/widgets/styles/images/dvd-32.png similarity index 100% rename from src/gui/styles/images/dvd-32.png rename to src/widgets/styles/images/dvd-32.png diff --git a/src/gui/styles/images/file-128.png b/src/widgets/styles/images/file-128.png similarity index 100% rename from src/gui/styles/images/file-128.png rename to src/widgets/styles/images/file-128.png diff --git a/src/gui/styles/images/file-16.png b/src/widgets/styles/images/file-16.png similarity index 100% rename from src/gui/styles/images/file-16.png rename to src/widgets/styles/images/file-16.png diff --git a/src/gui/styles/images/file-32.png b/src/widgets/styles/images/file-32.png similarity index 100% rename from src/gui/styles/images/file-32.png rename to src/widgets/styles/images/file-32.png diff --git a/src/gui/styles/images/filecontents-128.png b/src/widgets/styles/images/filecontents-128.png similarity index 100% rename from src/gui/styles/images/filecontents-128.png rename to src/widgets/styles/images/filecontents-128.png diff --git a/src/gui/styles/images/filecontents-16.png b/src/widgets/styles/images/filecontents-16.png similarity index 100% rename from src/gui/styles/images/filecontents-16.png rename to src/widgets/styles/images/filecontents-16.png diff --git a/src/gui/styles/images/filecontents-32.png b/src/widgets/styles/images/filecontents-32.png similarity index 100% rename from src/gui/styles/images/filecontents-32.png rename to src/widgets/styles/images/filecontents-32.png diff --git a/src/gui/styles/images/fileinfo-128.png b/src/widgets/styles/images/fileinfo-128.png similarity index 100% rename from src/gui/styles/images/fileinfo-128.png rename to src/widgets/styles/images/fileinfo-128.png diff --git a/src/gui/styles/images/fileinfo-16.png b/src/widgets/styles/images/fileinfo-16.png similarity index 100% rename from src/gui/styles/images/fileinfo-16.png rename to src/widgets/styles/images/fileinfo-16.png diff --git a/src/gui/styles/images/fileinfo-32.png b/src/widgets/styles/images/fileinfo-32.png similarity index 100% rename from src/gui/styles/images/fileinfo-32.png rename to src/widgets/styles/images/fileinfo-32.png diff --git a/src/gui/styles/images/filelink-128.png b/src/widgets/styles/images/filelink-128.png similarity index 100% rename from src/gui/styles/images/filelink-128.png rename to src/widgets/styles/images/filelink-128.png diff --git a/src/gui/styles/images/filelink-16.png b/src/widgets/styles/images/filelink-16.png similarity index 100% rename from src/gui/styles/images/filelink-16.png rename to src/widgets/styles/images/filelink-16.png diff --git a/src/gui/styles/images/filelink-32.png b/src/widgets/styles/images/filelink-32.png similarity index 100% rename from src/gui/styles/images/filelink-32.png rename to src/widgets/styles/images/filelink-32.png diff --git a/src/gui/styles/images/floppy-128.png b/src/widgets/styles/images/floppy-128.png similarity index 100% rename from src/gui/styles/images/floppy-128.png rename to src/widgets/styles/images/floppy-128.png diff --git a/src/gui/styles/images/floppy-16.png b/src/widgets/styles/images/floppy-16.png similarity index 100% rename from src/gui/styles/images/floppy-16.png rename to src/widgets/styles/images/floppy-16.png diff --git a/src/gui/styles/images/floppy-32.png b/src/widgets/styles/images/floppy-32.png similarity index 100% rename from src/gui/styles/images/floppy-32.png rename to src/widgets/styles/images/floppy-32.png diff --git a/src/gui/styles/images/fontbitmap-16.png b/src/widgets/styles/images/fontbitmap-16.png similarity index 100% rename from src/gui/styles/images/fontbitmap-16.png rename to src/widgets/styles/images/fontbitmap-16.png diff --git a/src/gui/styles/images/fonttruetype-16.png b/src/widgets/styles/images/fonttruetype-16.png similarity index 100% rename from src/gui/styles/images/fonttruetype-16.png rename to src/widgets/styles/images/fonttruetype-16.png diff --git a/src/gui/styles/images/harddrive-128.png b/src/widgets/styles/images/harddrive-128.png similarity index 100% rename from src/gui/styles/images/harddrive-128.png rename to src/widgets/styles/images/harddrive-128.png diff --git a/src/gui/styles/images/harddrive-16.png b/src/widgets/styles/images/harddrive-16.png similarity index 100% rename from src/gui/styles/images/harddrive-16.png rename to src/widgets/styles/images/harddrive-16.png diff --git a/src/gui/styles/images/harddrive-32.png b/src/widgets/styles/images/harddrive-32.png similarity index 100% rename from src/gui/styles/images/harddrive-32.png rename to src/widgets/styles/images/harddrive-32.png diff --git a/src/gui/styles/images/left-128.png b/src/widgets/styles/images/left-128.png similarity index 100% rename from src/gui/styles/images/left-128.png rename to src/widgets/styles/images/left-128.png diff --git a/src/gui/styles/images/left-16.png b/src/widgets/styles/images/left-16.png similarity index 100% rename from src/gui/styles/images/left-16.png rename to src/widgets/styles/images/left-16.png diff --git a/src/gui/styles/images/left-32.png b/src/widgets/styles/images/left-32.png similarity index 100% rename from src/gui/styles/images/left-32.png rename to src/widgets/styles/images/left-32.png diff --git a/src/gui/styles/images/media-pause-16.png b/src/widgets/styles/images/media-pause-16.png similarity index 100% rename from src/gui/styles/images/media-pause-16.png rename to src/widgets/styles/images/media-pause-16.png diff --git a/src/gui/styles/images/media-pause-32.png b/src/widgets/styles/images/media-pause-32.png similarity index 100% rename from src/gui/styles/images/media-pause-32.png rename to src/widgets/styles/images/media-pause-32.png diff --git a/src/gui/styles/images/media-play-16.png b/src/widgets/styles/images/media-play-16.png similarity index 100% rename from src/gui/styles/images/media-play-16.png rename to src/widgets/styles/images/media-play-16.png diff --git a/src/gui/styles/images/media-play-32.png b/src/widgets/styles/images/media-play-32.png similarity index 100% rename from src/gui/styles/images/media-play-32.png rename to src/widgets/styles/images/media-play-32.png diff --git a/src/gui/styles/images/media-seek-backward-16.png b/src/widgets/styles/images/media-seek-backward-16.png similarity index 100% rename from src/gui/styles/images/media-seek-backward-16.png rename to src/widgets/styles/images/media-seek-backward-16.png diff --git a/src/gui/styles/images/media-seek-backward-32.png b/src/widgets/styles/images/media-seek-backward-32.png similarity index 100% rename from src/gui/styles/images/media-seek-backward-32.png rename to src/widgets/styles/images/media-seek-backward-32.png diff --git a/src/gui/styles/images/media-seek-forward-16.png b/src/widgets/styles/images/media-seek-forward-16.png similarity index 100% rename from src/gui/styles/images/media-seek-forward-16.png rename to src/widgets/styles/images/media-seek-forward-16.png diff --git a/src/gui/styles/images/media-seek-forward-32.png b/src/widgets/styles/images/media-seek-forward-32.png similarity index 100% rename from src/gui/styles/images/media-seek-forward-32.png rename to src/widgets/styles/images/media-seek-forward-32.png diff --git a/src/gui/styles/images/media-skip-backward-16.png b/src/widgets/styles/images/media-skip-backward-16.png similarity index 100% rename from src/gui/styles/images/media-skip-backward-16.png rename to src/widgets/styles/images/media-skip-backward-16.png diff --git a/src/gui/styles/images/media-skip-backward-32.png b/src/widgets/styles/images/media-skip-backward-32.png similarity index 100% rename from src/gui/styles/images/media-skip-backward-32.png rename to src/widgets/styles/images/media-skip-backward-32.png diff --git a/src/gui/styles/images/media-skip-forward-16.png b/src/widgets/styles/images/media-skip-forward-16.png similarity index 100% rename from src/gui/styles/images/media-skip-forward-16.png rename to src/widgets/styles/images/media-skip-forward-16.png diff --git a/src/gui/styles/images/media-skip-forward-32.png b/src/widgets/styles/images/media-skip-forward-32.png similarity index 100% rename from src/gui/styles/images/media-skip-forward-32.png rename to src/widgets/styles/images/media-skip-forward-32.png diff --git a/src/gui/styles/images/media-stop-16.png b/src/widgets/styles/images/media-stop-16.png similarity index 100% rename from src/gui/styles/images/media-stop-16.png rename to src/widgets/styles/images/media-stop-16.png diff --git a/src/gui/styles/images/media-stop-32.png b/src/widgets/styles/images/media-stop-32.png similarity index 100% rename from src/gui/styles/images/media-stop-32.png rename to src/widgets/styles/images/media-stop-32.png diff --git a/src/gui/styles/images/media-volume-16.png b/src/widgets/styles/images/media-volume-16.png similarity index 100% rename from src/gui/styles/images/media-volume-16.png rename to src/widgets/styles/images/media-volume-16.png diff --git a/src/gui/styles/images/media-volume-muted-16.png b/src/widgets/styles/images/media-volume-muted-16.png similarity index 100% rename from src/gui/styles/images/media-volume-muted-16.png rename to src/widgets/styles/images/media-volume-muted-16.png diff --git a/src/gui/styles/images/networkdrive-128.png b/src/widgets/styles/images/networkdrive-128.png similarity index 100% rename from src/gui/styles/images/networkdrive-128.png rename to src/widgets/styles/images/networkdrive-128.png diff --git a/src/gui/styles/images/networkdrive-16.png b/src/widgets/styles/images/networkdrive-16.png similarity index 100% rename from src/gui/styles/images/networkdrive-16.png rename to src/widgets/styles/images/networkdrive-16.png diff --git a/src/gui/styles/images/networkdrive-32.png b/src/widgets/styles/images/networkdrive-32.png similarity index 100% rename from src/gui/styles/images/networkdrive-32.png rename to src/widgets/styles/images/networkdrive-32.png diff --git a/src/gui/styles/images/newdirectory-128.png b/src/widgets/styles/images/newdirectory-128.png similarity index 100% rename from src/gui/styles/images/newdirectory-128.png rename to src/widgets/styles/images/newdirectory-128.png diff --git a/src/gui/styles/images/newdirectory-16.png b/src/widgets/styles/images/newdirectory-16.png similarity index 100% rename from src/gui/styles/images/newdirectory-16.png rename to src/widgets/styles/images/newdirectory-16.png diff --git a/src/gui/styles/images/newdirectory-32.png b/src/widgets/styles/images/newdirectory-32.png similarity index 100% rename from src/gui/styles/images/newdirectory-32.png rename to src/widgets/styles/images/newdirectory-32.png diff --git a/src/gui/styles/images/parentdir-128.png b/src/widgets/styles/images/parentdir-128.png similarity index 100% rename from src/gui/styles/images/parentdir-128.png rename to src/widgets/styles/images/parentdir-128.png diff --git a/src/gui/styles/images/parentdir-16.png b/src/widgets/styles/images/parentdir-16.png similarity index 100% rename from src/gui/styles/images/parentdir-16.png rename to src/widgets/styles/images/parentdir-16.png diff --git a/src/gui/styles/images/parentdir-32.png b/src/widgets/styles/images/parentdir-32.png similarity index 100% rename from src/gui/styles/images/parentdir-32.png rename to src/widgets/styles/images/parentdir-32.png diff --git a/src/gui/styles/images/refresh-24.png b/src/widgets/styles/images/refresh-24.png similarity index 100% rename from src/gui/styles/images/refresh-24.png rename to src/widgets/styles/images/refresh-24.png diff --git a/src/gui/styles/images/refresh-32.png b/src/widgets/styles/images/refresh-32.png similarity index 100% rename from src/gui/styles/images/refresh-32.png rename to src/widgets/styles/images/refresh-32.png diff --git a/src/gui/styles/images/right-128.png b/src/widgets/styles/images/right-128.png similarity index 100% rename from src/gui/styles/images/right-128.png rename to src/widgets/styles/images/right-128.png diff --git a/src/gui/styles/images/right-16.png b/src/widgets/styles/images/right-16.png similarity index 100% rename from src/gui/styles/images/right-16.png rename to src/widgets/styles/images/right-16.png diff --git a/src/gui/styles/images/right-32.png b/src/widgets/styles/images/right-32.png similarity index 100% rename from src/gui/styles/images/right-32.png rename to src/widgets/styles/images/right-32.png diff --git a/src/gui/styles/images/standardbutton-apply-128.png b/src/widgets/styles/images/standardbutton-apply-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-apply-128.png rename to src/widgets/styles/images/standardbutton-apply-128.png diff --git a/src/gui/styles/images/standardbutton-apply-16.png b/src/widgets/styles/images/standardbutton-apply-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-apply-16.png rename to src/widgets/styles/images/standardbutton-apply-16.png diff --git a/src/gui/styles/images/standardbutton-apply-32.png b/src/widgets/styles/images/standardbutton-apply-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-apply-32.png rename to src/widgets/styles/images/standardbutton-apply-32.png diff --git a/src/gui/styles/images/standardbutton-cancel-128.png b/src/widgets/styles/images/standardbutton-cancel-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-cancel-128.png rename to src/widgets/styles/images/standardbutton-cancel-128.png diff --git a/src/gui/styles/images/standardbutton-cancel-16.png b/src/widgets/styles/images/standardbutton-cancel-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-cancel-16.png rename to src/widgets/styles/images/standardbutton-cancel-16.png diff --git a/src/gui/styles/images/standardbutton-cancel-32.png b/src/widgets/styles/images/standardbutton-cancel-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-cancel-32.png rename to src/widgets/styles/images/standardbutton-cancel-32.png diff --git a/src/gui/styles/images/standardbutton-clear-128.png b/src/widgets/styles/images/standardbutton-clear-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-clear-128.png rename to src/widgets/styles/images/standardbutton-clear-128.png diff --git a/src/gui/styles/images/standardbutton-clear-16.png b/src/widgets/styles/images/standardbutton-clear-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-clear-16.png rename to src/widgets/styles/images/standardbutton-clear-16.png diff --git a/src/gui/styles/images/standardbutton-clear-32.png b/src/widgets/styles/images/standardbutton-clear-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-clear-32.png rename to src/widgets/styles/images/standardbutton-clear-32.png diff --git a/src/gui/styles/images/standardbutton-close-128.png b/src/widgets/styles/images/standardbutton-close-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-close-128.png rename to src/widgets/styles/images/standardbutton-close-128.png diff --git a/src/gui/styles/images/standardbutton-close-16.png b/src/widgets/styles/images/standardbutton-close-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-close-16.png rename to src/widgets/styles/images/standardbutton-close-16.png diff --git a/src/gui/styles/images/standardbutton-close-32.png b/src/widgets/styles/images/standardbutton-close-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-close-32.png rename to src/widgets/styles/images/standardbutton-close-32.png diff --git a/src/gui/styles/images/standardbutton-closetab-16.png b/src/widgets/styles/images/standardbutton-closetab-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-closetab-16.png rename to src/widgets/styles/images/standardbutton-closetab-16.png diff --git a/src/gui/styles/images/standardbutton-closetab-down-16.png b/src/widgets/styles/images/standardbutton-closetab-down-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-closetab-down-16.png rename to src/widgets/styles/images/standardbutton-closetab-down-16.png diff --git a/src/gui/styles/images/standardbutton-closetab-hover-16.png b/src/widgets/styles/images/standardbutton-closetab-hover-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-closetab-hover-16.png rename to src/widgets/styles/images/standardbutton-closetab-hover-16.png diff --git a/src/gui/styles/images/standardbutton-delete-128.png b/src/widgets/styles/images/standardbutton-delete-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-delete-128.png rename to src/widgets/styles/images/standardbutton-delete-128.png diff --git a/src/gui/styles/images/standardbutton-delete-16.png b/src/widgets/styles/images/standardbutton-delete-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-delete-16.png rename to src/widgets/styles/images/standardbutton-delete-16.png diff --git a/src/gui/styles/images/standardbutton-delete-32.png b/src/widgets/styles/images/standardbutton-delete-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-delete-32.png rename to src/widgets/styles/images/standardbutton-delete-32.png diff --git a/src/gui/styles/images/standardbutton-help-128.png b/src/widgets/styles/images/standardbutton-help-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-help-128.png rename to src/widgets/styles/images/standardbutton-help-128.png diff --git a/src/gui/styles/images/standardbutton-help-16.png b/src/widgets/styles/images/standardbutton-help-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-help-16.png rename to src/widgets/styles/images/standardbutton-help-16.png diff --git a/src/gui/styles/images/standardbutton-help-32.png b/src/widgets/styles/images/standardbutton-help-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-help-32.png rename to src/widgets/styles/images/standardbutton-help-32.png diff --git a/src/gui/styles/images/standardbutton-no-128.png b/src/widgets/styles/images/standardbutton-no-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-no-128.png rename to src/widgets/styles/images/standardbutton-no-128.png diff --git a/src/gui/styles/images/standardbutton-no-16.png b/src/widgets/styles/images/standardbutton-no-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-no-16.png rename to src/widgets/styles/images/standardbutton-no-16.png diff --git a/src/gui/styles/images/standardbutton-no-32.png b/src/widgets/styles/images/standardbutton-no-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-no-32.png rename to src/widgets/styles/images/standardbutton-no-32.png diff --git a/src/gui/styles/images/standardbutton-ok-128.png b/src/widgets/styles/images/standardbutton-ok-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-ok-128.png rename to src/widgets/styles/images/standardbutton-ok-128.png diff --git a/src/gui/styles/images/standardbutton-ok-16.png b/src/widgets/styles/images/standardbutton-ok-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-ok-16.png rename to src/widgets/styles/images/standardbutton-ok-16.png diff --git a/src/gui/styles/images/standardbutton-ok-32.png b/src/widgets/styles/images/standardbutton-ok-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-ok-32.png rename to src/widgets/styles/images/standardbutton-ok-32.png diff --git a/src/gui/styles/images/standardbutton-open-128.png b/src/widgets/styles/images/standardbutton-open-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-open-128.png rename to src/widgets/styles/images/standardbutton-open-128.png diff --git a/src/gui/styles/images/standardbutton-open-16.png b/src/widgets/styles/images/standardbutton-open-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-open-16.png rename to src/widgets/styles/images/standardbutton-open-16.png diff --git a/src/gui/styles/images/standardbutton-open-32.png b/src/widgets/styles/images/standardbutton-open-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-open-32.png rename to src/widgets/styles/images/standardbutton-open-32.png diff --git a/src/gui/styles/images/standardbutton-save-128.png b/src/widgets/styles/images/standardbutton-save-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-save-128.png rename to src/widgets/styles/images/standardbutton-save-128.png diff --git a/src/gui/styles/images/standardbutton-save-16.png b/src/widgets/styles/images/standardbutton-save-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-save-16.png rename to src/widgets/styles/images/standardbutton-save-16.png diff --git a/src/gui/styles/images/standardbutton-save-32.png b/src/widgets/styles/images/standardbutton-save-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-save-32.png rename to src/widgets/styles/images/standardbutton-save-32.png diff --git a/src/gui/styles/images/standardbutton-yes-128.png b/src/widgets/styles/images/standardbutton-yes-128.png similarity index 100% rename from src/gui/styles/images/standardbutton-yes-128.png rename to src/widgets/styles/images/standardbutton-yes-128.png diff --git a/src/gui/styles/images/standardbutton-yes-16.png b/src/widgets/styles/images/standardbutton-yes-16.png similarity index 100% rename from src/gui/styles/images/standardbutton-yes-16.png rename to src/widgets/styles/images/standardbutton-yes-16.png diff --git a/src/gui/styles/images/standardbutton-yes-32.png b/src/widgets/styles/images/standardbutton-yes-32.png similarity index 100% rename from src/gui/styles/images/standardbutton-yes-32.png rename to src/widgets/styles/images/standardbutton-yes-32.png diff --git a/src/gui/styles/images/stop-24.png b/src/widgets/styles/images/stop-24.png similarity index 100% rename from src/gui/styles/images/stop-24.png rename to src/widgets/styles/images/stop-24.png diff --git a/src/gui/styles/images/stop-32.png b/src/widgets/styles/images/stop-32.png similarity index 100% rename from src/gui/styles/images/stop-32.png rename to src/widgets/styles/images/stop-32.png diff --git a/src/gui/styles/images/trash-128.png b/src/widgets/styles/images/trash-128.png similarity index 100% rename from src/gui/styles/images/trash-128.png rename to src/widgets/styles/images/trash-128.png diff --git a/src/gui/styles/images/trash-16.png b/src/widgets/styles/images/trash-16.png similarity index 100% rename from src/gui/styles/images/trash-16.png rename to src/widgets/styles/images/trash-16.png diff --git a/src/gui/styles/images/trash-32.png b/src/widgets/styles/images/trash-32.png similarity index 100% rename from src/gui/styles/images/trash-32.png rename to src/widgets/styles/images/trash-32.png diff --git a/src/gui/styles/images/up-128.png b/src/widgets/styles/images/up-128.png similarity index 100% rename from src/gui/styles/images/up-128.png rename to src/widgets/styles/images/up-128.png diff --git a/src/gui/styles/images/up-16.png b/src/widgets/styles/images/up-16.png similarity index 100% rename from src/gui/styles/images/up-16.png rename to src/widgets/styles/images/up-16.png diff --git a/src/gui/styles/images/up-32.png b/src/widgets/styles/images/up-32.png similarity index 100% rename from src/gui/styles/images/up-32.png rename to src/widgets/styles/images/up-32.png diff --git a/src/gui/styles/images/viewdetailed-128.png b/src/widgets/styles/images/viewdetailed-128.png similarity index 100% rename from src/gui/styles/images/viewdetailed-128.png rename to src/widgets/styles/images/viewdetailed-128.png diff --git a/src/gui/styles/images/viewdetailed-16.png b/src/widgets/styles/images/viewdetailed-16.png similarity index 100% rename from src/gui/styles/images/viewdetailed-16.png rename to src/widgets/styles/images/viewdetailed-16.png diff --git a/src/gui/styles/images/viewdetailed-32.png b/src/widgets/styles/images/viewdetailed-32.png similarity index 100% rename from src/gui/styles/images/viewdetailed-32.png rename to src/widgets/styles/images/viewdetailed-32.png diff --git a/src/gui/styles/images/viewlist-128.png b/src/widgets/styles/images/viewlist-128.png similarity index 100% rename from src/gui/styles/images/viewlist-128.png rename to src/widgets/styles/images/viewlist-128.png diff --git a/src/gui/styles/images/viewlist-16.png b/src/widgets/styles/images/viewlist-16.png similarity index 100% rename from src/gui/styles/images/viewlist-16.png rename to src/widgets/styles/images/viewlist-16.png diff --git a/src/gui/styles/images/viewlist-32.png b/src/widgets/styles/images/viewlist-32.png similarity index 100% rename from src/gui/styles/images/viewlist-32.png rename to src/widgets/styles/images/viewlist-32.png diff --git a/src/gui/styles/qcdestyle.cpp b/src/widgets/styles/qcdestyle.cpp similarity index 100% rename from src/gui/styles/qcdestyle.cpp rename to src/widgets/styles/qcdestyle.cpp diff --git a/src/gui/styles/qcdestyle.h b/src/widgets/styles/qcdestyle.h similarity index 96% rename from src/gui/styles/qcdestyle.h rename to src/widgets/styles/qcdestyle.h index 259ac26b6c0..854bfc6c690 100644 --- a/src/gui/styles/qcdestyle.h +++ b/src/widgets/styles/qcdestyle.h @@ -43,7 +43,7 @@ #ifndef QCDESTYLE_H #define QCDESTYLE_H -#include <QtGui/qmotifstyle.h> +#include <QtWidgets/qmotifstyle.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) #if !defined(QT_NO_STYLE_CDE) -class Q_GUI_EXPORT QCDEStyle : public QMotifStyle +class Q_WIDGETS_EXPORT QCDEStyle : public QMotifStyle { Q_OBJECT public: diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/widgets/styles/qcleanlooksstyle.cpp similarity index 100% rename from src/gui/styles/qcleanlooksstyle.cpp rename to src/widgets/styles/qcleanlooksstyle.cpp diff --git a/src/gui/styles/qcleanlooksstyle.h b/src/widgets/styles/qcleanlooksstyle.h similarity index 97% rename from src/gui/styles/qcleanlooksstyle.h rename to src/widgets/styles/qcleanlooksstyle.h index 690b764c0c3..1b35aa7969d 100644 --- a/src/gui/styles/qcleanlooksstyle.h +++ b/src/widgets/styles/qcleanlooksstyle.h @@ -42,7 +42,7 @@ #ifndef QCLEANLOOKSSTYLE_H #define QCLEANLOOKSSTYLE_H -#include <QtGui/qwindowsstyle.h> +#include <QtWidgets/qwindowsstyle.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) #if !defined(QT_NO_STYLE_CLEANLOOKS) class QCleanlooksStylePrivate; -class Q_GUI_EXPORT QCleanlooksStyle : public QWindowsStyle +class Q_WIDGETS_EXPORT QCleanlooksStyle : public QWindowsStyle { Q_OBJECT Q_DECLARE_PRIVATE(QCleanlooksStyle) diff --git a/src/gui/styles/qcleanlooksstyle_p.h b/src/widgets/styles/qcleanlooksstyle_p.h similarity index 100% rename from src/gui/styles/qcleanlooksstyle_p.h rename to src/widgets/styles/qcleanlooksstyle_p.h diff --git a/src/gui/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp similarity index 100% rename from src/gui/styles/qcommonstyle.cpp rename to src/widgets/styles/qcommonstyle.cpp diff --git a/src/gui/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h similarity index 98% rename from src/gui/styles/qcommonstyle.h rename to src/widgets/styles/qcommonstyle.h index e879f0d4a31..a4a7ac11c51 100644 --- a/src/gui/styles/qcommonstyle.h +++ b/src/widgets/styles/qcommonstyle.h @@ -42,7 +42,7 @@ #ifndef QCOMMONSTYLE_H #define QCOMMONSTYLE_H -#include <QtGui/qstyle.h> +#include <QtWidgets/qstyle.h> QT_BEGIN_HEADER @@ -51,7 +51,7 @@ QT_MODULE(Gui) class QCommonStylePrivate; -class Q_GUI_EXPORT QCommonStyle: public QStyle +class Q_WIDGETS_EXPORT QCommonStyle: public QStyle { Q_OBJECT diff --git a/src/gui/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h similarity index 100% rename from src/gui/styles/qcommonstyle_p.h rename to src/widgets/styles/qcommonstyle_p.h diff --git a/src/gui/styles/qcommonstylepixmaps_p.h b/src/widgets/styles/qcommonstylepixmaps_p.h similarity index 100% rename from src/gui/styles/qcommonstylepixmaps_p.h rename to src/widgets/styles/qcommonstylepixmaps_p.h diff --git a/src/gui/painting/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp similarity index 79% rename from src/gui/painting/qdrawutil.cpp rename to src/widgets/styles/qdrawutil.cpp index 98294cb62d4..94cec208d01 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/widgets/styles/qdrawutil.cpp @@ -42,13 +42,12 @@ #include "qdrawutil.h" #include "qbitmap.h" #include "qpixmapcache.h" -#include "qapplication.h" #include "qpainter.h" #include "qpalette.h" #include <private/qpaintengineex_p.h> #include <qvarlengtharray.h> #include <qmath.h> -#include <private/qstylehelper_p.h> +#include <private/qhexstring_p.h> QT_BEGIN_NAMESPACE @@ -743,312 +742,6 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c, lineWidth, fill); } -#ifdef QT3_SUPPORT -static void qDrawWinArrow(QPainter *p, Qt::ArrowType type, bool down, - int x, int y, int w, int h, - const QPalette &pal, bool enabled) -{ - QPolygon a; // arrow polygon - switch (type) { - case Qt::UpArrow: - a.setPoints(7, -3,1, 3,1, -2,0, 2,0, -1,-1, 1,-1, 0,-2); - break; - case Qt::DownArrow: - a.setPoints(7, -3,-1, 3,-1, -2,0, 2,0, -1,1, 1,1, 0,2); - break; - case Qt::LeftArrow: - a.setPoints(7, 1,-3, 1,3, 0,-2, 0,2, -1,-1, -1,1, -2,0); - break; - case Qt::RightArrow: - a.setPoints(7, -1,-3, -1,3, 0,-2, 0,2, 1,-1, 1,1, 2,0); - break; - default: - break; - } - if (a.isEmpty()) - return; - - if (down) { - x++; - y++; - } - - QPen savePen = p->pen(); // save current pen - if (down) - p->setBrushOrigin(p->brushOrigin() + QPoint(1,1)); - p->fillRect(x, y, w, h, pal.brush(QPalette::Button)); - if (down) - p->setBrushOrigin(p->brushOrigin() - QPoint(1,1)); - if (enabled) { - a.translate(x+w/2, y+h/2); - p->setPen(pal.foreground().color()); - p->drawLine(a.at(0), a.at(1)); - p->drawLine(a.at(2), a.at(2)); - p->drawPoint(a[6]); - } else { - a.translate(x+w/2+1, y+h/2+1); - p->setPen(pal.light().color()); - p->drawLine(a.at(0), a.at(1)); - p->drawLine(a.at(2), a.at(2)); - p->drawPoint(a[6]); - a.translate(-1, -1); - p->setPen(pal.mid().color()); - p->drawLine(a.at(0), a.at(1)); - p->drawLine(a.at(2), a.at(2)); - p->drawPoint(a[6]); - } - p->setPen(savePen); // restore pen -} -#endif // QT3_SUPPORT - -#if defined(Q_CC_MSVC) -#pragma warning(disable: 4244) -#endif - -#ifdef QT3_SUPPORT -#ifndef QT_NO_STYLE_MOTIF -// motif arrows look the same whether they are used or not -// is this correct? -static void qDrawMotifArrow(QPainter *p, Qt::ArrowType type, bool down, - int x, int y, int w, int h, - const QPalette &pal, bool) -{ - QPolygon bFill; // fill polygon - QPolygon bTop; // top shadow. - QPolygon bBot; // bottom shadow. - QPolygon bLeft; // left shadow. - QTransform matrix; // xform matrix - bool vertical = type == Qt::UpArrow || type == Qt::DownArrow; - bool horizontal = !vertical; - int dim = w < h ? w : h; - int colspec = 0x0000; // color specification array - - if (dim < 2) // too small arrow - return; - - if (dim > 3) { - if (dim > 6) - bFill.resize(dim & 1 ? 3 : 4); - bTop.resize((dim/2)*2); - bBot.resize(dim & 1 ? dim + 1 : dim); - bLeft.resize(dim > 4 ? 4 : 2); - bLeft.putPoints(0, 2, 0,0, 0,dim-1); - if (dim > 4) - bLeft.putPoints(2, 2, 1,2, 1,dim-3); - bTop.putPoints(0, 4, 1,0, 1,1, 2,1, 3,1); - bBot.putPoints(0, 4, 1,dim-1, 1,dim-2, 2,dim-2, 3,dim-2); - - for(int i=0; i<dim/2-2 ; i++) { - bTop.putPoints(i*2+4, 2, 2+i*2,2+i, 5+i*2, 2+i); - bBot.putPoints(i*2+4, 2, 2+i*2,dim-3-i, 5+i*2,dim-3-i); - } - if (dim & 1) // odd number size: extra line - bBot.putPoints(dim-1, 2, dim-3,dim/2, dim-1,dim/2); - if (dim > 6) { // dim>6: must fill interior - bFill.putPoints(0, 2, 1,dim-3, 1,2); - if (dim & 1) // if size is an odd number - bFill.setPoint(2, dim - 3, dim / 2); - else - bFill.putPoints(2, 2, dim-4,dim/2-1, dim-4,dim/2); - } - } - else { - if (dim == 3) { // 3x3 arrow pattern - bLeft.setPoints(4, 0,0, 0,2, 1,1, 1,1); - bTop .setPoints(2, 1,0, 1,0); - bBot .setPoints(2, 1,2, 2,1); - } - else { // 2x2 arrow pattern - bLeft.setPoints(2, 0,0, 0,1); - bTop .setPoints(2, 1,0, 1,0); - bBot .setPoints(2, 1,1, 1,1); - } - } - - if (type == Qt::UpArrow || type == Qt::LeftArrow) { - matrix.translate(x, y); - if (vertical) { - matrix.translate(0, h - 1); - matrix.rotate(-90); - } else { - matrix.translate(w - 1, h - 1); - matrix.rotate(180); - } - if (down) - colspec = horizontal ? 0x2334 : 0x2343; - else - colspec = horizontal ? 0x1443 : 0x1434; - } - else if (type == Qt::DownArrow || type == Qt::RightArrow) { - matrix.translate(x, y); - if (vertical) { - matrix.translate(w-1, 0); - matrix.rotate(90); - } - if (down) - colspec = horizontal ? 0x2443 : 0x2434; - else - colspec = horizontal ? 0x1334 : 0x1343; - } - - const QColor *cols[5]; - cols[0] = 0; - cols[1] = &pal.button().color(); - cols[2] = &pal.mid().color(); - cols[3] = &pal.light().color(); - cols[4] = &pal.dark().color(); -#define CMID *cols[(colspec>>12) & 0xf] -#define CLEFT *cols[(colspec>>8) & 0xf] -#define CTOP *cols[(colspec>>4) & 0xf] -#define CBOT *cols[colspec & 0xf] - - QPen savePen = p->pen(); // save current pen - QBrush saveBrush = p->brush(); // save current brush - QTransform wxm = p->transform(); - QPen pen(Qt::NoPen); - const QBrush &brush = pal.brush(QPalette::Button); - - p->setPen(pen); - p->setBrush(brush); - p->setTransform(matrix, true); // set transformation matrix - p->drawPolygon(bFill); // fill arrow - p->setBrush(Qt::NoBrush); // don't fill - - p->setPen(CLEFT); - p->drawLines(bLeft); - p->setPen(CTOP); - p->drawLines(bTop); - p->setPen(CBOT); - p->drawLines(bBot); - - p->setTransform(wxm); - p->setBrush(saveBrush); // restore brush - p->setPen(savePen); // restore pen - -#undef CMID -#undef CLEFT -#undef CTOP -#undef CBOT -} -#endif // QT_NO_STYLE_MOTIF - -QRect qItemRect(QPainter *p, Qt::GUIStyle gs, - int x, int y, int w, int h, - int flags, - bool enabled, - const QPixmap *pixmap, - const QString& text, int len) -{ - QRect result; - - if (pixmap) { - if ((flags & Qt::AlignVCenter) == Qt::AlignVCenter) - y += h/2 - pixmap->height()/2; - else if ((flags & Qt::AlignBottom) == Qt::AlignBottom) - y += h - pixmap->height(); - if ((flags & Qt::AlignRight) == Qt::AlignRight) - x += w - pixmap->width(); - else if ((flags & Qt::AlignHCenter) == Qt::AlignHCenter) - x += w/2 - pixmap->width()/2; - else if ((flags & Qt::AlignLeft) != Qt::AlignLeft && QApplication::isRightToLeft()) - x += w - pixmap->width(); - result = QRect(x, y, pixmap->width(), pixmap->height()); - } else if (!text.isNull() && p) { - result = p->boundingRect(QRect(x, y, w, h), flags, text.left(len)); - if (gs == Qt::WindowsStyle && !enabled) { - result.setWidth(result.width()+1); - result.setHeight(result.height()+1); - } - } else { - result = QRect(x, y, w, h); - } - - return result; -} - -void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GUIStyle style, bool down, - int x, int y, int w, int h, - const QPalette &pal, bool enabled) -{ - switch (style) { - case Qt::WindowsStyle: - qDrawWinArrow(p, type, down, x, y, w, h, pal, enabled); - break; -#ifndef QT_NO_STYLE_MOTIF - case Qt::MotifStyle: - qDrawMotifArrow(p, type, down, x, y, w, h, pal, enabled); - break; -#endif - default: - qWarning("qDrawArrow: Requested unsupported GUI style"); - } -} - -void qDrawItem(QPainter *p, Qt::GUIStyle gs, - int x, int y, int w, int h, - int flags, - const QPalette &pal, bool enabled, - const QPixmap *pixmap, - const QString& text, int len , const QColor* penColor) -{ - p->setPen(penColor?*penColor:pal.foreground().color()); - if (pixmap) { - QPixmap pm(*pixmap); - bool clip = (flags & Qt::TextDontClip) == 0; - if (clip) { - if (pm.width() < w && pm.height() < h) - clip = false; - else - p->setClipRect(x, y, w, h); - } - if ((flags & Qt::AlignVCenter) == Qt::AlignVCenter) - y += h/2 - pm.height()/2; - else if ((flags & Qt::AlignBottom) == Qt::AlignBottom) - y += h - pm.height(); - if ((flags & Qt::AlignRight) == Qt::AlignRight) - x += w - pm.width(); - else if ((flags & Qt::AlignHCenter) == Qt::AlignHCenter) - x += w/2 - pm.width()/2; - else if (((flags & Qt::AlignLeft) != Qt::AlignLeft) && QApplication::isRightToLeft()) // Qt::AlignAuto && rightToLeft - x += w - pm.width(); - - if (!enabled) { - if (pm.hasAlphaChannel()) { // pixmap with a mask - pm = pm.mask(); - } else if (pm.depth() == 1) { // monochrome pixmap, no mask - ; -#ifndef QT_NO_IMAGE_HEURISTIC_MASK - } else { // color pixmap, no mask - QString k = QLatin1Literal("$qt-drawitem") - % HexString<qint64>(pm.cacheKey()); - - if (!QPixmapCache::find(k, pm)) { - pm = pm.createHeuristicMask(); - pm.setMask((QBitmap&)pm); - QPixmapCache::insert(k, pm); - } -#endif - } - if (gs == Qt::WindowsStyle) { - p->setPen(pal.light().color()); - p->drawPixmap(x+1, y+1, pm); - p->setPen(pal.text().color()); - } - } - p->drawPixmap(x, y, pm); - if (clip) - p->setClipping(false); - } else if (!text.isNull()) { - if (gs == Qt::WindowsStyle && !enabled) { - p->setPen(pal.light().color()); - p->drawText(x+1, y+1, w, h, flags, text.left(len)); - p->setPen(pal.text().color()); - } - p->drawText(x, y, w, h, flags, text.left(len)); - } -} - -#endif /*! \class QTileRules diff --git a/src/gui/painting/qdrawutil.h b/src/widgets/styles/qdrawutil.h similarity index 75% rename from src/gui/painting/qdrawutil.h rename to src/widgets/styles/qdrawutil.h index 0f383578413..2f35d236b70 100644 --- a/src/gui/painting/qdrawutil.h +++ b/src/widgets/styles/qdrawutil.h @@ -53,9 +53,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QPainter; -#ifndef QT3_SUPPORT -class QColorGroup; -#endif class QPalette; class QPoint; class QColor; @@ -66,72 +63,55 @@ class QRect; // Standard shade drawing // -Q_GUI_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, +Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, const QPalette &pal, bool sunken = true, int lineWidth = 1, int midLineWidth = 0); -Q_GUI_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2, +Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2, const QPalette &pal, bool sunken = true, int lineWidth = 1, int midLineWidth = 0); -Q_GUI_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, +Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken = false, int lineWidth = 1, int midLineWidth = 0, const QBrush *fill = 0); -Q_GUI_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r, +Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r, const QPalette &pal, bool sunken = false, int lineWidth = 1, int midLineWidth = 0, const QBrush *fill = 0); -Q_GUI_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, +Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken = false, int lineWidth = 1, const QBrush *fill = 0); -Q_GUI_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r, +Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r, const QPalette &pal, bool sunken = false, int lineWidth = 1, const QBrush *fill = 0); -Q_GUI_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h, +Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken = false, const QBrush *fill = 0); -Q_GUI_EXPORT void qDrawWinButton(QPainter *p, const QRect &r, +Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, const QRect &r, const QPalette &pal, bool sunken = false, const QBrush *fill = 0); -Q_GUI_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, +Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken = false, const QBrush *fill = 0); -Q_GUI_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r, +Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r, const QPalette &pal, bool sunken = false, const QBrush *fill = 0); -Q_GUI_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &, +Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &, int lineWidth = 1, const QBrush *fill = 0); -Q_GUI_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &, +Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &, int lineWidth = 1, const QBrush *fill = 0); -#ifdef QT3_SUPPORT -// -// Use QStyle::itemRect(), QStyle::drawItem() and QStyle::drawArrow() instead. -// -Q_GUI_EXPORT QT3_SUPPORT QRect qItemRect(QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h, - int flags, bool enabled, - const QPixmap *pixmap, const QString& text, int len=-1); - -Q_GUI_EXPORT QT3_SUPPORT void qDrawItem(QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h, - int flags, const QPalette &pal, bool enabled, - const QPixmap *pixmap, const QString& text, - int len=-1, const QColor* penColor = 0); - -Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GUIStyle style, bool down, - int x, int y, int w, int h, - const QPalette &pal, bool enabled); -#endif struct QTileRules { @@ -168,7 +148,7 @@ namespace QDrawBorderPixmap } #endif -Q_GUI_EXPORT void qDrawBorderPixmap(QPainter *painter, +Q_WIDGETS_EXPORT void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargins &targetMargins, const QPixmap &pixmap, diff --git a/src/gui/styles/qgtkpainter.cpp b/src/widgets/styles/qgtkpainter.cpp similarity index 99% rename from src/gui/styles/qgtkpainter.cpp rename to src/widgets/styles/qgtkpainter.cpp index 0b1c3d33284..373732f9244 100644 --- a/src/gui/styles/qgtkpainter.cpp +++ b/src/widgets/styles/qgtkpainter.cpp @@ -48,8 +48,8 @@ // and takes care of converting all such calls into cached Qt pixmaps. #include <private/qstylehelper_p.h> -#include <QtGui/QWidget> -#include <QtGui/QStyleOption> +#include <QtWidgets/QWidget> +#include <QtWidgets/QStyleOption> #include <QtGui/QPixmapCache> QT_BEGIN_NAMESPACE diff --git a/src/gui/styles/qgtkpainter_p.h b/src/widgets/styles/qgtkpainter_p.h similarity index 99% rename from src/gui/styles/qgtkpainter_p.h rename to src/widgets/styles/qgtkpainter_p.h index e2f04c48668..a9d4dc0dcd2 100644 --- a/src/gui/styles/qgtkpainter_p.h +++ b/src/widgets/styles/qgtkpainter_p.h @@ -56,7 +56,7 @@ #include <QtCore/qglobal.h> #if !defined(QT_NO_STYLE_GTK) -#include <QtGui/QCleanlooksStyle> +#include <QtWidgets/QCleanlooksStyle> #include <QtGui/QPainter> #include <QtGui/QPalette> #include <QtGui/QFont> diff --git a/src/gui/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp similarity index 99% rename from src/gui/styles/qgtkstyle.cpp rename to src/widgets/styles/qgtkstyle.cpp index 513a546c834..32e04928da2 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/widgets/styles/qgtkstyle.cpp @@ -45,29 +45,29 @@ #include <private/qapplication_p.h> #include <QtCore/QLibrary> #include <QtCore/QSettings> -#include <QtGui/QDialogButtonBox> -#include <QtGui/QStatusBar> -#include <QtGui/QLineEdit> -#include <QtGui/QWidget> -#include <QtGui/QListView> -#include <QtGui/QApplication> -#include <QtGui/QStyleOption> -#include <QtGui/QPushButton> +#include <QtWidgets/QDialogButtonBox> +#include <QtWidgets/QStatusBar> +#include <QtWidgets/QLineEdit> +#include <QtWidgets/QWidget> +#include <QtWidgets/QListView> +#include <QtWidgets/QApplication> +#include <QtWidgets/QStyleOption> +#include <QtWidgets/QPushButton> #include <QtGui/QPainter> -#include <QtGui/QMainWindow> -#include <QtGui/QToolBar> -#include <QtGui/QHeaderView> -#include <QtGui/QMenuBar> -#include <QtGui/QComboBox> -#include <QtGui/QSpinBox> -#include <QtGui/QScrollBar> -#include <QtGui/QAbstractButton> -#include <QtGui/QToolButton> -#include <QtGui/QGroupBox> -#include <QtGui/QRadioButton> -#include <QtGui/QCheckBox> -#include <QtGui/QTreeView> -#include <QtGui/QStyledItemDelegate> +#include <QtWidgets/QMainWindow> +#include <QtWidgets/QToolBar> +#include <QtWidgets/QHeaderView> +#include <QtWidgets/QMenuBar> +#include <QtWidgets/QComboBox> +#include <QtWidgets/QSpinBox> +#include <QtWidgets/QScrollBar> +#include <QtWidgets/QAbstractButton> +#include <QtWidgets/QToolButton> +#include <QtWidgets/QGroupBox> +#include <QtWidgets/QRadioButton> +#include <QtWidgets/QCheckBox> +#include <QtWidgets/QTreeView> +#include <QtWidgets/QStyledItemDelegate> #include <qpixmapcache.h> #undef signals // Collides with GTK stymbols #include <private/qgtkpainter_p.h> diff --git a/src/gui/styles/qgtkstyle.h b/src/widgets/styles/qgtkstyle.h similarity index 97% rename from src/gui/styles/qgtkstyle.h rename to src/widgets/styles/qgtkstyle.h index 355c1b473a6..1ca6e3cc852 100644 --- a/src/gui/styles/qgtkstyle.h +++ b/src/widgets/styles/qgtkstyle.h @@ -42,10 +42,10 @@ #ifndef QGTKSTYLE_H #define QGTKSTYLE_H -#include <QtGui/QCleanlooksStyle> +#include <QtWidgets/QCleanlooksStyle> #include <QtGui/QPalette> #include <QtGui/QFont> -#include <QtGui/QFileDialog> +#include <QtWidgets/QFileDialog> QT_BEGIN_HEADER @@ -58,7 +58,7 @@ QT_MODULE(Gui) class QPainterPath; class QGtkStylePrivate; -class Q_GUI_EXPORT QGtkStyle : public QCleanlooksStyle +class Q_WIDGETS_EXPORT QGtkStyle : public QCleanlooksStyle { Q_OBJECT Q_DECLARE_PRIVATE(QGtkStyle) diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp similarity index 99% rename from src/gui/styles/qgtkstyle_p.cpp rename to src/widgets/styles/qgtkstyle_p.cpp index ae2b9180956..35f022bac45 100644 --- a/src/gui/styles/qgtkstyle_p.cpp +++ b/src/widgets/styles/qgtkstyle_p.cpp @@ -65,15 +65,15 @@ #include <private/qapplication_p.h> #include <private/qiconloader_p.h> -#include <QtGui/QMenu> -#include <QtGui/QStyle> -#include <QtGui/QApplication> +#include <QtWidgets/QMenu> +#include <QtWidgets/QStyle> +#include <QtWidgets/QApplication> #include <QtGui/QPixmapCache> -#include <QtGui/QStatusBar> -#include <QtGui/QMenuBar> -#include <QtGui/QToolBar> -#include <QtGui/QToolButton> -#include <QtGui/QX11Info> +#include <QtWidgets/QStatusBar> +#include <QtWidgets/QMenuBar> +#include <QtWidgets/QToolBar> +#include <QtWidgets/QToolButton> +#include <QtWidgets/QX11Info> #include <private/qt_x11_p.h> diff --git a/src/gui/styles/qgtkstyle_p.h b/src/widgets/styles/qgtkstyle_p.h similarity index 98% rename from src/gui/styles/qgtkstyle_p.h rename to src/widgets/styles/qgtkstyle_p.h index e70ddef20d0..55089268b37 100644 --- a/src/gui/styles/qgtkstyle_p.h +++ b/src/widgets/styles/qgtkstyle_p.h @@ -60,9 +60,9 @@ #include <QtCore/qstringbuilder.h> #include <QtCore/qcoreapplication.h> -#include <QtGui/QFileDialog> +#include <QtWidgets/QFileDialog> -#include <QtGui/QGtkStyle> +#include <QtWidgets/QGtkStyle> #include <private/qcleanlooksstyle_p.h> #undef signals // Collides with GTK stymbols @@ -271,10 +271,10 @@ typedef QString (*_qt_filedialog_save_filename_hook) (QWidget * parent, cons typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options); -extern Q_GUI_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook; -extern Q_GUI_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook; -extern Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook; -extern Q_GUI_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook; +extern Q_WIDGETS_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook; +extern Q_WIDGETS_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook; +extern Q_WIDGETS_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook; +extern Q_WIDGETS_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook; class QGtkStylePrivate; diff --git a/src/gui/styles/qmacstyle.qdoc b/src/widgets/styles/qmacstyle.qdoc similarity index 100% rename from src/gui/styles/qmacstyle.qdoc rename to src/widgets/styles/qmacstyle.qdoc diff --git a/src/gui/styles/qmacstyle_mac.h b/src/widgets/styles/qmacstyle_mac.h similarity index 96% rename from src/gui/styles/qmacstyle_mac.h rename to src/widgets/styles/qmacstyle_mac.h index c51efb9e67d..44940bd2b76 100644 --- a/src/gui/styles/qmacstyle_mac.h +++ b/src/widgets/styles/qmacstyle_mac.h @@ -42,7 +42,7 @@ #ifndef QMACSTYLE_MAC_H #define QMACSTYLE_MAC_H -#include <QtGui/qwindowsstyle.h> +#include <QtWidgets/qwindowsstyle.h> QT_BEGIN_HEADER @@ -55,15 +55,15 @@ QT_MODULE(Gui) class QPalette; #if defined(QT_PLUGIN) -#define Q_GUI_EXPORT_STYLE_MAC +#define Q_WIDGETS_EXPORT_STYLE_MAC #else -#define Q_GUI_EXPORT_STYLE_MAC Q_GUI_EXPORT +#define Q_WIDGETS_EXPORT_STYLE_MAC Q_WIDGETS_EXPORT #endif class QPushButton; class QStyleOptionButton; class QMacStylePrivate; -class Q_GUI_EXPORT_STYLE_MAC QMacStyle : public QWindowsStyle +class Q_WIDGETS_EXPORT_STYLE_MAC QMacStyle : public QWindowsStyle { Q_OBJECT public: diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm similarity index 99% rename from src/gui/styles/qmacstyle_mac.mm rename to src/widgets/styles/qmacstyle_mac.mm index 74e3440a54e..86b30cf7e03 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -395,29 +395,6 @@ static inline bool isTreeView(const QWidget *widget) )); } -QString qt_mac_removeMnemonics(const QString &original) -{ - QString returnText(original.size(), 0); - int finalDest = 0; - int currPos = 0; - int l = original.length(); - while (l) { - if (original.at(currPos) == QLatin1Char('&') - && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) { - ++currPos; - --l; - if (l == 0) - break; - } - returnText[finalDest] = original.at(currPos); - ++currPos; - ++finalDest; - --l; - } - returnText.truncate(finalDest); - return returnText; -} - static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape) { ThemeTabDirection ttd; @@ -1195,15 +1172,15 @@ QRect QMacStylePrivate::comboboxEditBounds(const QRect &outerBounds, const HIThe QRect ret = outerBounds; switch (bdi.kind){ case kThemeComboBox: - ret.adjust(5, 8, -22, -4); + ret.adjust(5, 8, -21, -4); break; case kThemeComboBoxSmall: - ret.adjust(4, 6, -20, 0); - ret.setHeight(14); + ret.adjust(4, 5, -18, 0); + ret.setHeight(16); break; case kThemeComboBoxMini: - ret.adjust(4, 5, -18, -1); - ret.setHeight(12); + ret.adjust(4, 5, -16, 0); + ret.setHeight(13); break; case kThemePopupButton: ret.adjust(10, 3, -23, -3); diff --git a/src/gui/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h similarity index 99% rename from src/gui/styles/qmacstyle_mac_p.h rename to src/widgets/styles/qmacstyle_mac_p.h index d1528593fb6..747779249c7 100644 --- a/src/gui/styles/qmacstyle_mac_p.h +++ b/src/widgets/styles/qmacstyle_mac_p.h @@ -92,8 +92,8 @@ #include <qlibrary.h> #include <qdatetimeedit.h> #include <qmath.h> -#include <QtGui/qgraphicsproxywidget.h> -#include <QtGui/qgraphicsview.h> +#include <QtWidgets/qgraphicsproxywidget.h> +#include <QtWidgets/qgraphicsview.h> #include <private/qt_cocoa_helpers_mac_p.h> // diff --git a/src/gui/styles/qmacstylepixmaps_mac_p.h b/src/widgets/styles/qmacstylepixmaps_mac_p.h similarity index 100% rename from src/gui/styles/qmacstylepixmaps_mac_p.h rename to src/widgets/styles/qmacstylepixmaps_mac_p.h diff --git a/src/gui/styles/qmotifstyle.cpp b/src/widgets/styles/qmotifstyle.cpp similarity index 99% rename from src/gui/styles/qmotifstyle.cpp rename to src/widgets/styles/qmotifstyle.cpp index c41b92ad6a3..d9be3f3643d 100644 --- a/src/gui/styles/qmotifstyle.cpp +++ b/src/widgets/styles/qmotifstyle.cpp @@ -69,8 +69,8 @@ #include "qdialogbuttonbox.h" #include "qformlayout.h" #include <limits.h> -#include <QtGui/qgraphicsproxywidget.h> -#include <QtGui/qgraphicsview.h> +#include <QtWidgets/qgraphicsproxywidget.h> +#include <QtWidgets/qgraphicsview.h> #ifdef Q_WS_X11 #include "qx11info_x11.h" diff --git a/src/gui/styles/qmotifstyle.h b/src/widgets/styles/qmotifstyle.h similarity index 97% rename from src/gui/styles/qmotifstyle.h rename to src/widgets/styles/qmotifstyle.h index 3cb3baf5b2a..35b3448289f 100644 --- a/src/gui/styles/qmotifstyle.h +++ b/src/widgets/styles/qmotifstyle.h @@ -42,7 +42,7 @@ #ifndef QMOTIFSTYLE_H #define QMOTIFSTYLE_H -#include <QtGui/qcommonstyle.h> +#include <QtWidgets/qcommonstyle.h> #include <QtCore/qpointer.h> QT_BEGIN_HEADER @@ -57,7 +57,7 @@ class QPalette; class QFocusFrame; class QMotifStylePrivate; -class Q_GUI_EXPORT QMotifStyle : public QCommonStyle +class Q_WIDGETS_EXPORT QMotifStyle : public QCommonStyle { Q_OBJECT public: diff --git a/src/gui/styles/qmotifstyle_p.h b/src/widgets/styles/qmotifstyle_p.h similarity index 100% rename from src/gui/styles/qmotifstyle_p.h rename to src/widgets/styles/qmotifstyle_p.h diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/widgets/styles/qplastiquestyle.cpp similarity index 100% rename from src/gui/styles/qplastiquestyle.cpp rename to src/widgets/styles/qplastiquestyle.cpp diff --git a/src/gui/styles/qplastiquestyle.h b/src/widgets/styles/qplastiquestyle.h similarity index 97% rename from src/gui/styles/qplastiquestyle.h rename to src/widgets/styles/qplastiquestyle.h index aab7cce839a..d0afce6cf02 100644 --- a/src/gui/styles/qplastiquestyle.h +++ b/src/widgets/styles/qplastiquestyle.h @@ -42,7 +42,7 @@ #ifndef QPLASTIQUESTYLE_H #define QPLASTIQUESTYLE_H -#include <QtGui/qwindowsstyle.h> +#include <QtWidgets/qwindowsstyle.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) #if !defined(QT_NO_STYLE_PLASTIQUE) class QPlastiqueStylePrivate; -class Q_GUI_EXPORT QPlastiqueStyle : public QWindowsStyle +class Q_WIDGETS_EXPORT QPlastiqueStyle : public QWindowsStyle { Q_OBJECT Q_DECLARE_PRIVATE(QPlastiqueStyle) diff --git a/src/gui/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp similarity index 100% rename from src/gui/styles/qproxystyle.cpp rename to src/widgets/styles/qproxystyle.cpp diff --git a/src/gui/styles/qproxystyle.h b/src/widgets/styles/qproxystyle.h similarity index 98% rename from src/gui/styles/qproxystyle.h rename to src/widgets/styles/qproxystyle.h index a63865597a7..96c5c34f189 100644 --- a/src/gui/styles/qproxystyle.h +++ b/src/widgets/styles/qproxystyle.h @@ -42,7 +42,7 @@ #ifndef QPROXYSTYLE_H #define QPROXYSTYLE_H -#include <QtGui/QCommonStyle> +#include <QtWidgets/QCommonStyle> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) #if !defined(QT_NO_STYLE_PROXY) class QProxyStylePrivate; -class Q_GUI_EXPORT QProxyStyle : public QCommonStyle +class Q_WIDGETS_EXPORT QProxyStyle : public QCommonStyle { Q_OBJECT diff --git a/src/gui/styles/qproxystyle_p.h b/src/widgets/styles/qproxystyle_p.h similarity index 100% rename from src/gui/styles/qproxystyle_p.h rename to src/widgets/styles/qproxystyle_p.h diff --git a/src/gui/styles/qs60style.cpp b/src/widgets/styles/qs60style.cpp similarity index 100% rename from src/gui/styles/qs60style.cpp rename to src/widgets/styles/qs60style.cpp diff --git a/src/gui/styles/qs60style.h b/src/widgets/styles/qs60style.h similarity index 97% rename from src/gui/styles/qs60style.h rename to src/widgets/styles/qs60style.h index 6993bf4aab6..4520d19fd32 100644 --- a/src/gui/styles/qs60style.h +++ b/src/widgets/styles/qs60style.h @@ -42,7 +42,7 @@ #ifndef QS60STYLE_H #define QS60STYLE_H -#include <QtGui/qcommonstyle.h> +#include <QtWidgets/qcommonstyle.h> QT_BEGIN_HEADER @@ -62,7 +62,7 @@ enum { class QS60StylePrivate; -class Q_GUI_EXPORT QS60Style : public QCommonStyle +class Q_WIDGETS_EXPORT QS60Style : public QCommonStyle { Q_OBJECT Q_DECLARE_PRIVATE(QS60Style) diff --git a/src/gui/styles/qs60style_p.h b/src/widgets/styles/qs60style_p.h similarity index 100% rename from src/gui/styles/qs60style_p.h rename to src/widgets/styles/qs60style_p.h diff --git a/src/gui/styles/qs60style_s60.cpp b/src/widgets/styles/qs60style_s60.cpp similarity index 99% rename from src/gui/styles/qs60style_s60.cpp rename to src/widgets/styles/qs60style_s60.cpp index f272ff4a902..f7ced9e8f82 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/widgets/styles/qs60style_s60.cpp @@ -647,17 +647,17 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask return QPixmap(); QPixmap pixmap; - QScopedPointer<QPixmapData> pd(QPixmapData::create(0, 0, QPixmapData::PixmapType)); + QScopedPointer<QPlatformPixmap> pd(QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType)); if (mask) { // Try the efficient path with less copying and conversion. QVolatileImage img(icon, mask); - pd->fromNativeType(&img, QPixmapData::VolatileImage); + pd->fromNativeType(&img, QPlatformPixmap::VolatileImage); if (!pd->isNull()) pixmap = QPixmap(pd.take()); } if (pixmap.isNull()) { // Potentially more expensive path. - pd->fromNativeType(icon, QPixmapData::FbsBitmap); + pd->fromNativeType(icon, QPlatformPixmap::FbsBitmap); pixmap = QPixmap(pd.take()); if (mask) { pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask)); diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/widgets/styles/qs60style_simulated.cpp similarity index 100% rename from src/gui/styles/qs60style_simulated.cpp rename to src/widgets/styles/qs60style_simulated.cpp diff --git a/src/gui/styles/qs60style_stub.cpp b/src/widgets/styles/qs60style_stub.cpp similarity index 100% rename from src/gui/styles/qs60style_stub.cpp rename to src/widgets/styles/qs60style_stub.cpp diff --git a/src/gui/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp similarity index 98% rename from src/gui/styles/qstyle.cpp rename to src/widgets/styles/qstyle.cpp index c5eb3306501..c6e4b488c1f 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -47,6 +47,7 @@ #include "qpixmapcache.h" #include "qstyleoption.h" #include "private/qstyle_p.h" +#include "private/qguiapplication_p.h" #ifndef QT_NO_DEBUG #include "qdebug.h" #endif @@ -2096,14 +2097,7 @@ QRect QStyle::alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment */ Qt::Alignment QStyle::visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment) { - if (!(alignment & Qt::AlignHorizontal_Mask)) - alignment |= Qt::AlignLeft; - if ((alignment & Qt::AlignAbsolute) == 0 && (alignment & (Qt::AlignLeft | Qt::AlignRight))) { - if (direction == Qt::RightToLeft) - alignment ^= (Qt::AlignLeft | Qt::AlignRight); - alignment |= Qt::AlignAbsolute; - } - return alignment; + return QGuiApplicationPrivate::visualAlignment(direction, alignment); } /*! @@ -2187,34 +2181,6 @@ int QStyle::sliderValueFromPosition(int min, int max, int pos, int span, bool up // pos <= span < sqrt(INT_MAX+0.0625)+0.25 ~ sqrt(INT_MAX) } -/*### \fn void QStyle::drawItem(QPainter *p, const QRect &r, - int flags, const QColorGroup &colorgroup, bool enabled, - const QString &text, int len = -1, - const QColor *penColor = 0) const - - Use one of the drawItem() overloads that takes a QPalette instead - of a QColorGroup. -*/ - -/*### \fn void QStyle::drawItem(QPainter *p, const QRect &r, - int flags, const QColorGroup colorgroup, bool enabled, - const QPixmap &pixmap, - const QColor *penColor = 0) const - - Use one of the drawItem() overloads that takes a QPalette instead - of a QColorGroup. -*/ - -/*### \fn void QStyle::drawItem(QPainter *p, const QRect &r, - int flags, const QColorGroup colorgroup, bool enabled, - const QPixmap *pixmap, - const QString &text, int len = -1, - const QColor *penColor = 0) const - - Use one of the drawItem() overloads that takes a QPalette instead - of a QColorGroup. -*/ - /*! Returns the style's standard palette. diff --git a/src/gui/styles/qstyle.h b/src/widgets/styles/qstyle.h similarity index 99% rename from src/gui/styles/qstyle.h rename to src/widgets/styles/qstyle.h index 452d7502117..1896f129e1f 100644 --- a/src/gui/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -45,10 +45,10 @@ #include <QtCore/qobject.h> #include <QtCore/qrect.h> #include <QtCore/qsize.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qicon.h> #include <QtGui/qpixmap.h> #include <QtGui/qpalette.h> -#include <QtGui/qsizepolicy.h> +#include <QtWidgets/qsizepolicy.h> QT_BEGIN_HEADER @@ -65,7 +65,7 @@ class QStyleOption; class QStyleOptionComplex; class QStylePrivate; -class Q_GUI_EXPORT QStyle : public QObject +class Q_WIDGETS_EXPORT QStyle : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QStyle) @@ -879,7 +879,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State) Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls) #if !defined(QT_NO_DEBUG_STREAM) -Q_GUI_EXPORT QDebug operator<<(QDebug debug, QStyle::State state); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QStyle::State state); #endif QT_END_NAMESPACE diff --git a/src/gui/styles/qstyle.qrc b/src/widgets/styles/qstyle.qrc similarity index 100% rename from src/gui/styles/qstyle.qrc rename to src/widgets/styles/qstyle.qrc diff --git a/src/gui/styles/qstyle_p.h b/src/widgets/styles/qstyle_p.h similarity index 99% rename from src/gui/styles/qstyle_p.h rename to src/widgets/styles/qstyle_p.h index 09d79f255ad..dfb0e957310 100644 --- a/src/gui/styles/qstyle_p.h +++ b/src/widgets/styles/qstyle_p.h @@ -43,7 +43,7 @@ #define QSTYLE_P_H #include "private/qobject_p.h" -#include <QtGui/qstyle.h> +#include <QtWidgets/qstyle.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/styles/qstyle_s60.qrc b/src/widgets/styles/qstyle_s60.qrc similarity index 100% rename from src/gui/styles/qstyle_s60.qrc rename to src/widgets/styles/qstyle_s60.qrc diff --git a/src/gui/styles/qstyle_s60_simulated.qrc b/src/widgets/styles/qstyle_s60_simulated.qrc similarity index 100% rename from src/gui/styles/qstyle_s60_simulated.qrc rename to src/widgets/styles/qstyle_s60_simulated.qrc diff --git a/src/gui/styles/qstyle_wince.qrc b/src/widgets/styles/qstyle_wince.qrc similarity index 100% rename from src/gui/styles/qstyle_wince.qrc rename to src/widgets/styles/qstyle_wince.qrc diff --git a/src/gui/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp similarity index 100% rename from src/gui/styles/qstylefactory.cpp rename to src/widgets/styles/qstylefactory.cpp diff --git a/src/gui/styles/qstylefactory.h b/src/widgets/styles/qstylefactory.h similarity index 98% rename from src/gui/styles/qstylefactory.h rename to src/widgets/styles/qstylefactory.h index 92bd24fddbb..b972c8e0e6d 100644 --- a/src/gui/styles/qstylefactory.h +++ b/src/widgets/styles/qstylefactory.h @@ -52,7 +52,7 @@ QT_MODULE(Gui) class QStyle; -class Q_GUI_EXPORT QStyleFactory +class Q_WIDGETS_EXPORT QStyleFactory { public: static QStringList keys(); diff --git a/src/gui/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp similarity index 100% rename from src/gui/styles/qstylehelper.cpp rename to src/widgets/styles/qstylehelper.cpp diff --git a/src/gui/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h similarity index 74% rename from src/gui/styles/qstylehelper_p.h rename to src/widgets/styles/qstylehelper_p.h index a5959e7afc6..f2bb81929ca 100644 --- a/src/gui/styles/qstylehelper_p.h +++ b/src/widgets/styles/qstylehelper_p.h @@ -59,6 +59,8 @@ // We mean it. // +#include <private/qhexstring_p.h> + QT_BEGIN_NAMESPACE class QPainter; @@ -81,37 +83,6 @@ namespace QStyleHelper int bottom = 0); } -// internal helper. Converts an integer value to an unique string token -template <typename T> - struct HexString -{ - inline HexString(const T t) - : val(t) - {} - - inline void write(QChar *&dest) const - { - const ushort hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - const char *c = reinterpret_cast<const char *>(&val); - for (uint i = 0; i < sizeof(T); ++i) { - *dest++ = hexChars[*c & 0xf]; - *dest++ = hexChars[(*c & 0xf0) >> 4]; - ++c; - } - } - const T val; -}; - -// specialization to enable fast concatenating of our string tokens to a string -template <typename T> - struct QConcatenable<HexString<T> > -{ - typedef HexString<T> type; - enum { ExactSize = true }; - static int size(const HexString<T> &) { return sizeof(T) * 2; } - static inline void appendTo(const HexString<T> &str, QChar *&out) { str.write(out); } - typedef QString ConvertTo; -}; QT_END_NAMESPACE diff --git a/src/gui/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp similarity index 100% rename from src/gui/styles/qstyleoption.cpp rename to src/widgets/styles/qstyleoption.cpp diff --git a/src/gui/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h similarity index 88% rename from src/gui/styles/qstyleoption.h rename to src/widgets/styles/qstyleoption.h index 1e5dec2ac1c..0640eef606f 100644 --- a/src/gui/styles/qstyleoption.h +++ b/src/widgets/styles/qstyleoption.h @@ -43,15 +43,15 @@ #define QSTYLEOPTION_H #include <QtCore/qvariant.h> -#include <QtGui/qabstractspinbox.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qabstractspinbox.h> +#include <QtWidgets/qicon.h> #include <QtGui/qmatrix.h> -#include <QtGui/qslider.h> -#include <QtGui/qstyle.h> -#include <QtGui/qtabbar.h> -#include <QtGui/qtabwidget.h> -#include <QtGui/qrubberband.h> -#include <QtGui/qframe.h> +#include <QtWidgets/qslider.h> +#include <QtWidgets/qstyle.h> +#include <QtWidgets/qtabbar.h> +#include <QtWidgets/qtabwidget.h> +#include <QtWidgets/qrubberband.h> +#include <QtWidgets/qframe.h> #ifndef QT_NO_ITEMVIEWS # include <QtCore/qabstractitemmodel.h> #endif @@ -64,7 +64,7 @@ QT_MODULE(Gui) class QDebug; -class Q_GUI_EXPORT QStyleOption +class Q_WIDGETS_EXPORT QStyleOption { public: enum OptionType { @@ -100,7 +100,7 @@ public: QStyleOption &operator=(const QStyleOption &other); }; -class Q_GUI_EXPORT QStyleOptionFocusRect : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionFocusRect : public QStyleOption { public: enum StyleOptionType { Type = SO_FocusRect }; @@ -115,7 +115,7 @@ protected: QStyleOptionFocusRect(int version); }; -class Q_GUI_EXPORT QStyleOptionFrame : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionFrame : public QStyleOption { public: enum StyleOptionType { Type = SO_Frame }; @@ -131,7 +131,7 @@ protected: QStyleOptionFrame(int version); }; -class Q_GUI_EXPORT QStyleOptionFrameV2 : public QStyleOptionFrame +class Q_WIDGETS_EXPORT QStyleOptionFrameV2 : public QStyleOptionFrame { public: enum StyleOptionVersion { Version = 2 }; @@ -154,7 +154,7 @@ protected: Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionFrameV2::FrameFeatures) -class Q_GUI_EXPORT QStyleOptionFrameV3 : public QStyleOptionFrameV2 +class Q_WIDGETS_EXPORT QStyleOptionFrameV3 : public QStyleOptionFrameV2 { public: enum StyleOptionVersion { Version = 3 }; @@ -172,7 +172,7 @@ protected: #ifndef QT_NO_TABWIDGET -class Q_GUI_EXPORT QStyleOptionTabWidgetFrame : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionTabWidgetFrame : public QStyleOption { public: enum StyleOptionType { Type = SO_TabWidgetFrame }; @@ -193,7 +193,7 @@ protected: QStyleOptionTabWidgetFrame(int version); }; -class Q_GUI_EXPORT QStyleOptionTabWidgetFrameV2 : public QStyleOptionTabWidgetFrame +class Q_WIDGETS_EXPORT QStyleOptionTabWidgetFrameV2 : public QStyleOptionTabWidgetFrame { public: enum StyleOptionVersion { Version = 2 }; @@ -215,7 +215,7 @@ protected: #ifndef QT_NO_TABBAR -class Q_GUI_EXPORT QStyleOptionTabBarBase : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionTabBarBase : public QStyleOption { public: enum StyleOptionType { Type = SO_TabBarBase }; @@ -232,7 +232,7 @@ protected: QStyleOptionTabBarBase(int version); }; -class Q_GUI_EXPORT QStyleOptionTabBarBaseV2 : public QStyleOptionTabBarBase +class Q_WIDGETS_EXPORT QStyleOptionTabBarBaseV2 : public QStyleOptionTabBarBase { public: enum StyleOptionVersion { Version = 2 }; @@ -248,7 +248,7 @@ protected: #endif -class Q_GUI_EXPORT QStyleOptionHeader : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionHeader : public QStyleOption { public: enum StyleOptionType { Type = SO_Header }; @@ -276,7 +276,7 @@ protected: QStyleOptionHeader(int version); }; -class Q_GUI_EXPORT QStyleOptionButton : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionButton : public QStyleOption { public: enum StyleOptionType { Type = SO_Button }; @@ -301,7 +301,7 @@ protected: Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionButton::ButtonFeatures) #ifndef QT_NO_TABBAR -class Q_GUI_EXPORT QStyleOptionTab : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionTab : public QStyleOption { public: enum StyleOptionType { Type = SO_Tab }; @@ -330,7 +330,7 @@ protected: Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets) -class Q_GUI_EXPORT QStyleOptionTabV2 : public QStyleOptionTab +class Q_WIDGETS_EXPORT QStyleOptionTabV2 : public QStyleOptionTab { public: enum StyleOptionVersion { Version = 2 }; @@ -344,7 +344,7 @@ protected: QStyleOptionTabV2(int version); }; -class Q_GUI_EXPORT QStyleOptionTabV3 : public QStyleOptionTabV2 +class Q_WIDGETS_EXPORT QStyleOptionTabV3 : public QStyleOptionTabV2 { public: enum StyleOptionVersion { Version = 3 }; @@ -366,7 +366,7 @@ protected: #ifndef QT_NO_TOOLBAR -class Q_GUI_EXPORT QStyleOptionToolBar : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionToolBar : public QStyleOption { public: enum StyleOptionType { Type = SO_ToolBar }; @@ -393,7 +393,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolBar::ToolBarFeatures) -class Q_GUI_EXPORT QStyleOptionProgressBar : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionProgressBar : public QStyleOption { public: enum StyleOptionType { Type = SO_ProgressBar }; @@ -414,7 +414,7 @@ protected: }; // Adds style info for vertical progress bars -class Q_GUI_EXPORT QStyleOptionProgressBarV2 : public QStyleOptionProgressBar +class Q_WIDGETS_EXPORT QStyleOptionProgressBarV2 : public QStyleOptionProgressBar { public: enum StyleOptionType { Type = SO_ProgressBar }; @@ -432,7 +432,7 @@ protected: QStyleOptionProgressBarV2(int version); }; -class Q_GUI_EXPORT QStyleOptionMenuItem : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionMenuItem : public QStyleOption { public: enum StyleOptionType { Type = SO_MenuItem }; @@ -460,7 +460,7 @@ protected: QStyleOptionMenuItem(int version); }; -class Q_GUI_EXPORT QStyleOptionQ3ListViewItem : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionQ3ListViewItem : public QStyleOption { public: enum StyleOptionType { Type = SO_Q3ListViewItem }; @@ -485,7 +485,7 @@ protected: Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionQ3ListViewItem::Q3ListViewItemFeatures) -class Q_GUI_EXPORT QStyleOptionQ3DockWindow : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionQ3DockWindow : public QStyleOption { public: enum StyleOptionType { Type = SO_Q3DockWindow }; @@ -501,7 +501,7 @@ protected: QStyleOptionQ3DockWindow(int version); }; -class Q_GUI_EXPORT QStyleOptionDockWidget : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionDockWidget : public QStyleOption { public: enum StyleOptionType { Type = SO_DockWidget }; @@ -519,7 +519,7 @@ protected: QStyleOptionDockWidget(int version); }; -class Q_GUI_EXPORT QStyleOptionDockWidgetV2 : public QStyleOptionDockWidget +class Q_WIDGETS_EXPORT QStyleOptionDockWidgetV2 : public QStyleOptionDockWidget { public: enum StyleOptionVersion { Version = 2 }; @@ -536,7 +536,7 @@ protected: QStyleOptionDockWidgetV2(int version); }; -class Q_GUI_EXPORT QStyleOptionViewItem : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionViewItem : public QStyleOption { public: enum StyleOptionType { Type = SO_ViewItem }; @@ -559,7 +559,7 @@ protected: QStyleOptionViewItem(int version); }; -class Q_GUI_EXPORT QStyleOptionViewItemV2 : public QStyleOptionViewItem +class Q_WIDGETS_EXPORT QStyleOptionViewItemV2 : public QStyleOptionViewItem { public: enum StyleOptionVersion { Version = 2 }; @@ -587,7 +587,7 @@ protected: Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionViewItemV2::ViewItemFeatures) -class Q_GUI_EXPORT QStyleOptionViewItemV3 : public QStyleOptionViewItemV2 +class Q_WIDGETS_EXPORT QStyleOptionViewItemV3 : public QStyleOptionViewItemV2 { public: enum StyleOptionVersion { Version = 3 }; @@ -606,7 +606,7 @@ protected: }; #ifndef QT_NO_ITEMVIEWS -class Q_GUI_EXPORT QStyleOptionViewItemV4 : public QStyleOptionViewItemV3 +class Q_WIDGETS_EXPORT QStyleOptionViewItemV4 : public QStyleOptionViewItemV3 { public: enum StyleOptionVersion { Version = 4 }; @@ -630,7 +630,7 @@ protected: }; #endif -class Q_GUI_EXPORT QStyleOptionToolBox : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionToolBox : public QStyleOption { public: enum StyleOptionType { Type = SO_ToolBox }; @@ -646,7 +646,7 @@ protected: QStyleOptionToolBox(int version); }; -class Q_GUI_EXPORT QStyleOptionToolBoxV2 : public QStyleOptionToolBox +class Q_WIDGETS_EXPORT QStyleOptionToolBoxV2 : public QStyleOptionToolBox { public: enum StyleOptionVersion { Version = 2 }; @@ -666,7 +666,7 @@ protected: }; #ifndef QT_NO_RUBBERBAND -class Q_GUI_EXPORT QStyleOptionRubberBand : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionRubberBand : public QStyleOption { public: enum StyleOptionType { Type = SO_RubberBand }; @@ -684,7 +684,7 @@ protected: #endif // QT_NO_RUBBERBAND // -------------------------- Complex style options ------------------------------- -class Q_GUI_EXPORT QStyleOptionComplex : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionComplex : public QStyleOption { public: enum StyleOptionType { Type = SO_Complex }; @@ -698,7 +698,7 @@ public: }; #ifndef QT_NO_SLIDER -class Q_GUI_EXPORT QStyleOptionSlider : public QStyleOptionComplex +class Q_WIDGETS_EXPORT QStyleOptionSlider : public QStyleOptionComplex { public: enum StyleOptionType { Type = SO_Slider }; @@ -726,7 +726,7 @@ protected: #endif // QT_NO_SLIDER #ifndef QT_NO_SPINBOX -class Q_GUI_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex +class Q_WIDGETS_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex { public: enum StyleOptionType { Type = SO_SpinBox }; @@ -744,7 +744,7 @@ protected: }; #endif // QT_NO_SPINBOX -class Q_GUI_EXPORT QStyleOptionQ3ListView : public QStyleOptionComplex +class Q_WIDGETS_EXPORT QStyleOptionQ3ListView : public QStyleOptionComplex { public: enum StyleOptionType { Type = SO_Q3ListView }; @@ -765,7 +765,7 @@ protected: QStyleOptionQ3ListView(int version); }; -class Q_GUI_EXPORT QStyleOptionToolButton : public QStyleOptionComplex +class Q_WIDGETS_EXPORT QStyleOptionToolButton : public QStyleOptionComplex { public: enum StyleOptionType { Type = SO_ToolButton }; @@ -793,7 +793,7 @@ protected: Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolButton::ToolButtonFeatures) -class Q_GUI_EXPORT QStyleOptionComboBox : public QStyleOptionComplex +class Q_WIDGETS_EXPORT QStyleOptionComboBox : public QStyleOptionComplex { public: enum StyleOptionType { Type = SO_ComboBox }; @@ -813,7 +813,7 @@ protected: QStyleOptionComboBox(int version); }; -class Q_GUI_EXPORT QStyleOptionTitleBar : public QStyleOptionComplex +class Q_WIDGETS_EXPORT QStyleOptionTitleBar : public QStyleOptionComplex { public: enum StyleOptionType { Type = SO_TitleBar }; @@ -831,7 +831,7 @@ protected: QStyleOptionTitleBar(int version); }; -class Q_GUI_EXPORT QStyleOptionGroupBox : public QStyleOptionComplex +class Q_WIDGETS_EXPORT QStyleOptionGroupBox : public QStyleOptionComplex { public: enum StyleOptionType { Type = SO_GroupBox }; @@ -850,7 +850,7 @@ protected: QStyleOptionGroupBox(int version); }; -class Q_GUI_EXPORT QStyleOptionSizeGrip : public QStyleOptionComplex +class Q_WIDGETS_EXPORT QStyleOptionSizeGrip : public QStyleOptionComplex { public: enum StyleOptionType { Type = SO_SizeGrip }; @@ -864,7 +864,7 @@ protected: QStyleOptionSizeGrip(int version); }; -class Q_GUI_EXPORT QStyleOptionGraphicsItem : public QStyleOption +class Q_WIDGETS_EXPORT QStyleOptionGraphicsItem : public QStyleOption { public: enum StyleOptionType { Type = SO_GraphicsItem }; @@ -904,7 +904,7 @@ T qstyleoption_cast(QStyleOption *opt) } // -------------------------- QStyleHintReturn ------------------------------- -class Q_GUI_EXPORT QStyleHintReturn { +class Q_WIDGETS_EXPORT QStyleHintReturn { public: enum HintReturnType { SH_Default=0xf000, SH_Mask, SH_Variant @@ -920,7 +920,7 @@ public: int type; }; -class Q_GUI_EXPORT QStyleHintReturnMask : public QStyleHintReturn { +class Q_WIDGETS_EXPORT QStyleHintReturnMask : public QStyleHintReturn { public: enum StyleOptionType { Type = SH_Mask }; enum StyleOptionVersion { Version = 1 }; @@ -930,7 +930,7 @@ public: QRegion region; }; -class Q_GUI_EXPORT QStyleHintReturnVariant : public QStyleHintReturn { +class Q_WIDGETS_EXPORT QStyleHintReturnVariant : public QStyleHintReturn { public: enum StyleOptionType { Type = SH_Variant }; enum StyleOptionVersion { Version = 1 }; @@ -959,8 +959,8 @@ T qstyleoption_cast(QStyleHintReturn *hint) } #if !defined(QT_NO_DEBUG_STREAM) -Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType); -Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option); #endif QT_END_NAMESPACE diff --git a/src/gui/painting/qstylepainter.cpp b/src/widgets/styles/qstylepainter.cpp similarity index 100% rename from src/gui/painting/qstylepainter.cpp rename to src/widgets/styles/qstylepainter.cpp diff --git a/src/gui/painting/qstylepainter.h b/src/widgets/styles/qstylepainter.h similarity index 98% rename from src/gui/painting/qstylepainter.h rename to src/widgets/styles/qstylepainter.h index be0ce991cbb..ccb591c0f9c 100644 --- a/src/gui/painting/qstylepainter.h +++ b/src/widgets/styles/qstylepainter.h @@ -43,8 +43,8 @@ #define QSTYLEPAINTER_H #include <QtGui/qpainter.h> -#include <QtGui/qstyle.h> -#include <QtGui/qwidget.h> +#include <QtWidgets/qstyle.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER diff --git a/src/gui/styles/qstyleplugin.cpp b/src/widgets/styles/qstyleplugin.cpp similarity index 100% rename from src/gui/styles/qstyleplugin.cpp rename to src/widgets/styles/qstyleplugin.cpp diff --git a/src/gui/styles/qstyleplugin.h b/src/widgets/styles/qstyleplugin.h similarity index 93% rename from src/gui/styles/qstyleplugin.h rename to src/widgets/styles/qstyleplugin.h index 2dd8ccfcfdf..ab55cdf54cb 100644 --- a/src/gui/styles/qstyleplugin.h +++ b/src/widgets/styles/qstyleplugin.h @@ -53,7 +53,7 @@ QT_MODULE(Gui) class QStyle; -struct Q_GUI_EXPORT QStyleFactoryInterface : public QFactoryInterface +struct Q_WIDGETS_EXPORT QStyleFactoryInterface : public QFactoryInterface { virtual QStyle *create(const QString &key) = 0; }; @@ -62,7 +62,7 @@ struct Q_GUI_EXPORT QStyleFactoryInterface : public QFactoryInterface Q_DECLARE_INTERFACE(QStyleFactoryInterface, QStyleFactoryInterface_iid) -class Q_GUI_EXPORT QStylePlugin : public QObject, public QStyleFactoryInterface +class Q_WIDGETS_EXPORT QStylePlugin : public QObject, public QStyleFactoryInterface { Q_OBJECT Q_INTERFACES(QStyleFactoryInterface:QFactoryInterface) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp similarity index 99% rename from src/gui/styles/qstylesheetstyle.cpp rename to src/widgets/styles/qstylesheetstyle.cpp index 7d2ed2af8ca..357b43c2b4f 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -84,7 +84,7 @@ #include "qdrawutil.h" #include <limits.h> -#include <QtGui/qtoolbar.h> +#include <QtWidgets/qtoolbar.h> QT_BEGIN_NAMESPACE @@ -978,8 +978,9 @@ QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QWidget hintValue = (int) decl.colorValue().rgba(); } else if (hintName.endsWith(QLatin1String("size"))) { hintValue = decl.sizeValue(); - } else if (hintName.endsWith(QLatin1String("icon"))) { - hintValue = decl.iconValue(); + // ### Qt5 +// } else if (hintName.endsWith(QLatin1String("icon"))) { +// hintValue = decl.iconValue(); } else if (hintName == QLatin1String("button-layout") && decl.d->values.count() != 0 && decl.d->values.at(0).type == Value::String) { hintValue = subControlLayout(decl.d->values.at(0).variant.toString()); @@ -2508,7 +2509,8 @@ void QStyleSheetStyle::setProperties(QWidget *w) } QVariant v; switch (value.type()) { - case QVariant::Icon: v = decl.iconValue(); break; + // ### Qt 5 +// case QVariant::Icon: v = decl.iconValue(); break; case QVariant::Image: v = QImage(decl.uriValue()); break; case QVariant::Pixmap: v = QPixmap(decl.uriValue()); break; case QVariant::Rect: v = decl.rectValue(); break; diff --git a/src/gui/styles/qstylesheetstyle_default.cpp b/src/widgets/styles/qstylesheetstyle_default.cpp similarity index 100% rename from src/gui/styles/qstylesheetstyle_default.cpp rename to src/widgets/styles/qstylesheetstyle_default.cpp diff --git a/src/gui/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h similarity index 98% rename from src/gui/styles/qstylesheetstyle_p.h rename to src/widgets/styles/qstylesheetstyle_p.h index e597ba1639a..1d38627edf3 100644 --- a/src/gui/styles/qstylesheetstyle_p.h +++ b/src/widgets/styles/qstylesheetstyle_p.h @@ -42,15 +42,15 @@ #ifndef QSTYLESHEETSTYLE_P_H #define QSTYLESHEETSTYLE_P_H -#include "QtGui/qwindowsstyle.h" +#include "QtWidgets/qwindowsstyle.h" #ifndef QT_NO_STYLE_STYLESHEET -#include "QtGui/qstyleoption.h" +#include "QtWidgets/qstyleoption.h" #include "QtCore/qhash.h" #include "QtGui/qevent.h" #include "QtCore/qvector.h" -#include "QtGui/qapplication.h" +#include "QtWidgets/qapplication.h" #include "private/qcssparser_p.h" #include "QtGui/qbrush.h" diff --git a/src/gui/styles/qwindowscestyle.cpp b/src/widgets/styles/qwindowscestyle.cpp similarity index 100% rename from src/gui/styles/qwindowscestyle.cpp rename to src/widgets/styles/qwindowscestyle.cpp diff --git a/src/gui/styles/qwindowscestyle.h b/src/widgets/styles/qwindowscestyle.h similarity index 97% rename from src/gui/styles/qwindowscestyle.h rename to src/widgets/styles/qwindowscestyle.h index e5f26be79b5..3db9be58e27 100644 --- a/src/gui/styles/qwindowscestyle.h +++ b/src/widgets/styles/qwindowscestyle.h @@ -42,7 +42,7 @@ #ifndef QWINDOWSCESTYLE_H #define QWINDOWSCESTYLE_H -#include <QtGui/qwindowsstyle.h> +#include <QtWidgets/qwindowsstyle.h> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_MODULE(Gui) #if !defined(QT_NO_STYLE_WINDOWSCE) -class Q_GUI_EXPORT QWindowsCEStyle : public QWindowsStyle +class Q_WIDGETS_EXPORT QWindowsCEStyle : public QWindowsStyle { Q_OBJECT public: diff --git a/src/gui/styles/qwindowscestyle_p.h b/src/widgets/styles/qwindowscestyle_p.h similarity index 100% rename from src/gui/styles/qwindowscestyle_p.h rename to src/widgets/styles/qwindowscestyle_p.h diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/widgets/styles/qwindowsmobilestyle.cpp similarity index 100% rename from src/gui/styles/qwindowsmobilestyle.cpp rename to src/widgets/styles/qwindowsmobilestyle.cpp diff --git a/src/gui/styles/qwindowsmobilestyle.h b/src/widgets/styles/qwindowsmobilestyle.h similarity index 97% rename from src/gui/styles/qwindowsmobilestyle.h rename to src/widgets/styles/qwindowsmobilestyle.h index 74e4733126a..050f6418882 100644 --- a/src/gui/styles/qwindowsmobilestyle.h +++ b/src/widgets/styles/qwindowsmobilestyle.h @@ -42,7 +42,7 @@ #ifndef QWINDOWSMOBILESTYLE_H #define QWINDOWSMOBILESTYLE_H -#include <QtGui/qwindowsstyle.h> +#include <QtWidgets/qwindowsstyle.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QWindowsMobileStylePrivate; -class Q_GUI_EXPORT QWindowsMobileStyle : public QWindowsStyle +class Q_WIDGETS_EXPORT QWindowsMobileStyle : public QWindowsStyle { Q_OBJECT public: diff --git a/src/gui/styles/qwindowsmobilestyle_p.h b/src/widgets/styles/qwindowsmobilestyle_p.h similarity index 100% rename from src/gui/styles/qwindowsmobilestyle_p.h rename to src/widgets/styles/qwindowsmobilestyle_p.h diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp similarity index 99% rename from src/gui/styles/qwindowsstyle.cpp rename to src/widgets/styles/qwindowsstyle.cpp index c0992733f81..d1d3865868c 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -918,7 +918,7 @@ static const char *const question_xpm[] = { #endif //QT_NO_IMAGEFORMAT_XPM -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN static QPixmap loadIconFromShell32( int resourceId, int size ) { #ifdef Q_OS_WINCE @@ -3256,7 +3256,7 @@ QIcon QWindowsStyle::standardIconImplementation(StandardPixmap standardIcon, con { QIcon icon; QPixmap pixmap; -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN switch (standardIcon) { case SP_FileDialogNewFolder: { diff --git a/src/gui/styles/qwindowsstyle.h b/src/widgets/styles/qwindowsstyle.h similarity index 97% rename from src/gui/styles/qwindowsstyle.h rename to src/widgets/styles/qwindowsstyle.h index ecc6e2f2fbd..acecfa91404 100644 --- a/src/gui/styles/qwindowsstyle.h +++ b/src/widgets/styles/qwindowsstyle.h @@ -42,7 +42,7 @@ #ifndef QWINDOWSSTYLE_H #define QWINDOWSSTYLE_H -#include <QtGui/qcommonstyle.h> +#include <QtWidgets/qcommonstyle.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QWindowsStylePrivate; -class Q_GUI_EXPORT QWindowsStyle : public QCommonStyle +class Q_WIDGETS_EXPORT QWindowsStyle : public QCommonStyle { Q_OBJECT public: diff --git a/src/gui/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h similarity index 100% rename from src/gui/styles/qwindowsstyle_p.h rename to src/widgets/styles/qwindowsstyle_p.h diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp similarity index 99% rename from src/gui/styles/qwindowsvistastyle.cpp rename to src/widgets/styles/qwindowsvistastyle.cpp index da484bafe1e..55e83f79fa1 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -43,6 +43,8 @@ #include "qwindowsvistastyle_p.h" #include <private/qstylehelper_p.h> #include <private/qsystemlibrary_p.h> +#include <private/qapplication_p.h> +#include <qplatformnativeinterface_qpa.h> #if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN) @@ -2606,7 +2608,8 @@ QWidget *QWindowsVistaStylePrivate::treeViewHelper() { if (!m_treeViewHelper) { m_treeViewHelper = new QWidget(0); - pSetWindowTheme(m_treeViewHelper->winId(), L"explorer", NULL); + HWND handle = QApplicationPrivate::getHWNDForWidget(m_treeViewHelper); + pSetWindowTheme(handle, L"explorer", NULL); } return m_treeViewHelper; } diff --git a/src/gui/styles/qwindowsvistastyle.h b/src/widgets/styles/qwindowsvistastyle.h similarity index 97% rename from src/gui/styles/qwindowsvistastyle.h rename to src/widgets/styles/qwindowsvistastyle.h index c0170809d38..68b489107e8 100644 --- a/src/gui/styles/qwindowsvistastyle.h +++ b/src/widgets/styles/qwindowsvistastyle.h @@ -42,7 +42,7 @@ #ifndef QWINDOWSVISTASTYLE_H #define QWINDOWSVISTASTYLE_H -#include <QtGui/qwindowsxpstyle.h> +#include <QtWidgets/qwindowsxpstyle.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) #if !defined(QT_NO_STYLE_WINDOWSVISTA) class QWindowsVistaStylePrivate; -class Q_GUI_EXPORT QWindowsVistaStyle : public QWindowsXPStyle +class Q_WIDGETS_EXPORT QWindowsVistaStyle : public QWindowsXPStyle { Q_OBJECT public: diff --git a/src/gui/styles/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h similarity index 100% rename from src/gui/styles/qwindowsvistastyle_p.h rename to src/widgets/styles/qwindowsvistastyle_p.h diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp similarity index 98% rename from src/gui/styles/qwindowsxpstyle.cpp rename to src/widgets/styles/qwindowsxpstyle.cpp index 3c33df3d11e..cbaf16989a9 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -46,6 +46,7 @@ #include <private/qobject_p.h> #include <private/qpaintengine_raster_p.h> #include <private/qapplication_p.h> +#include <qplatformnativeinterface_qpa.h> #include <private/qstylehelper_p.h> #include <private/qwidget_p.h> #include <private/qsystemlibrary_p.h> @@ -132,7 +133,7 @@ static const int windowsArrowHMargin = 6; // arrow horizontal margin static const int windowsRightBorder = 12; // right border on windows // External function calls -extern Q_GUI_EXPORT HDC qt_win_display_dc(); +extern Q_WIDGETS_EXPORT HDC qt_win_display_dc(); extern QRegion qt_region_from_HRGN(HRGN rgn); @@ -189,17 +190,20 @@ RECT XPThemeData::toRECT(const QRect &qr) Returns the native region of a part, if the part is considered transparent. The region is scaled to the parts size (rect). */ -HRGN XPThemeData::mask() +HRGN XPThemeData::mask(QWidget *widget) { if (!pIsThemeBackgroundPartiallyTransparent(handle(), partId, stateId)) return 0; HRGN hrgn; - HDC dc = painter == 0 ? 0 : painter->paintEngine()->getDC(); + HDC dc = 0; + if (widget) { + QBackingStore *backingStore = widget->backingStore(); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + dc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore)); + } RECT nativeRect = toRECT(rect); pGetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn); - if (dc) - painter->paintEngine()->releaseDC(dc); return hrgn; } @@ -211,6 +215,32 @@ QMap<QString,HTHEME> *QWindowsXPStylePrivate::handleMap = 0; bool QWindowsXPStylePrivate::use_xp = false; QBasicAtomicInt QWindowsXPStylePrivate::ref = Q_BASIC_ATOMIC_INITIALIZER(-1); // -1 based refcounting +static void qt_add_rect(HRGN &winRegion, QRect r) +{ + HRGN rgn = CreateRectRgn(r.left(), r.top(), r.x() + r.width(), r.y() + r.height()); + if (rgn) { + HRGN dest = CreateRectRgn(0,0,0,0); + int result = CombineRgn(dest, winRegion, rgn, RGN_OR); + if (result) { + DeleteObject(winRegion); + winRegion = dest; + } + DeleteObject(rgn); + } +} + +static HRGN qt_hrgn_from_qregion(const QRegion ®ion) +{ + HRGN hRegion = CreateRectRgn(0,0,0,0); + if (region.rectCount() == 1) { + qt_add_rect(hRegion, region.boundingRect()); + return hRegion; + } + foreach (const QRect &rect, region.rects()) + qt_add_rect(hRegion, rect); + return hRegion; +} + /* \internal Checks if the theme engine can/should be used, or if we should fall back to Windows style. @@ -295,9 +325,10 @@ void QWindowsXPStylePrivate::cleanupHandleMap() */ HWND QWindowsXPStylePrivate::winId(const QWidget *widget) { - if (widget && widget->internalWinId()) - return widget->internalWinId(); - + if (widget && widget->internalWinId()) { + QWidget *w = const_cast<QWidget *>(widget); + return QApplicationPrivate::getHWNDForWidget(w); + } if (!limboWidget) { limboWidget = new QWidget(0); limboWidget->createWinId(); @@ -307,7 +338,7 @@ HWND QWindowsXPStylePrivate::winId(const QWidget *widget) QWidgetPrivate::allWidgets->remove(limboWidget); } - return limboWidget->winId(); + return QApplicationPrivate::getHWNDForWidget(limboWidget); } /*! \internal @@ -466,8 +497,31 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData) QRegion region; - if (success) - region = qt_region_from_HRGN(dest); + if (success) { + int numBytes = GetRegionData(dest, 0, 0); + if (numBytes == 0) + return QRegion(); + + char *buf = new char[numBytes]; + if (buf == 0) + return QRegion(); + + RGNDATA *rd = reinterpret_cast<RGNDATA*>(buf); + if (GetRegionData(dest, numBytes, rd) == 0) { + delete [] buf; + return QRegion(); + } + + RECT *r = reinterpret_cast<RECT*>(rd->Buffer); + for (uint i = 0; i < rd->rdh.nCount; ++i) { + QRect rect; + rect.setCoords(r->left, r->top, r->right - 1, r->bottom - 1); + ++r; + region |= rect; + } + + delete [] buf; + } DeleteObject(hRgn); DeleteObject(dest); @@ -480,7 +534,7 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData) */ void QWindowsXPStylePrivate::setTransparency(QWidget *widget, XPThemeData &themeData) { - HRGN hrgn = themeData.mask(); + HRGN hrgn = themeData.mask(widget); if (hrgn && widget) SetWindowRgn(winId(widget), hrgn, true); } @@ -632,7 +686,14 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) translucentToplevel = win->testAttribute(Qt::WA_TranslucentBackground); } - bool useFallback = painter->paintEngine()->getDC() == 0 + HDC dc = 0; + if (themeData.widget) { + QBackingStore *backingStore = themeData.widget->backingStore(); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + dc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore )); + } + + bool useFallback = dc == 0 || painter->opacity() != 1.0 || themeData.rotate || complexXForm @@ -656,7 +717,12 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) { QPainter *painter = themeData.painter; - HDC dc = painter->paintEngine()->getDC(); + HDC dc = 0; + if (themeData.widget) { + QBackingStore *backingStore = themeData.widget->backingStore(); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + dc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore)); + } QPoint redirectionDelta(int(painter->deviceMatrix().dx()), int(painter->deviceMatrix().dy())); @@ -669,7 +735,8 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) sysRgn &= area; if (painter->hasClipping()) sysRgn &= painter->clipRegion().translated(redirectionDelta); - SelectClipRgn(dc, sysRgn.handle()); + HRGN hrgn = qt_hrgn_from_qregion(sysRgn); + SelectClipRgn(dc, hrgn); #ifdef DEBUG_XP_STYLE printf("---[ DIRECT PAINTING ]------------------> Name(%-10s) Part(%d) State(%d)\n", @@ -714,13 +781,17 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) } // Set the clip region, if used.. - if (themeData.noBorder || themeData.noContent) - SelectClipRgn(dc, extraClip.handle()); + if (themeData.noBorder || themeData.noContent) { + DeleteObject(hrgn); + hrgn = qt_hrgn_from_qregion(extraClip); + SelectClipRgn(dc, hrgn); + } } pDrawThemeBackground(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &(drawOptions.rcClip)); } SelectClipRgn(dc, 0); + DeleteObject(hrgn); } /*! \internal @@ -886,9 +957,11 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa } else { // Set the clip region, if used.. if (addBorderContentClipping) { - SelectClipRgn(dc, extraClip.handle()); + HRGN hrgn = qt_hrgn_from_qregion(extraClip); + SelectClipRgn(dc, hrgn); // Compensate for the noBorder area difference (noContent has the same area) drawOptions.rcClip = themeData.toRECT(rect.adjusted(dx, dy, dr, db)); + DeleteObject(hrgn); } pDrawThemeBackground(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawOptions.rcClip), 0); diff --git a/src/gui/styles/qwindowsxpstyle.h b/src/widgets/styles/qwindowsxpstyle.h similarity index 97% rename from src/gui/styles/qwindowsxpstyle.h rename to src/widgets/styles/qwindowsxpstyle.h index 71a2e1233d4..1cfd16479b1 100644 --- a/src/gui/styles/qwindowsxpstyle.h +++ b/src/widgets/styles/qwindowsxpstyle.h @@ -42,7 +42,7 @@ #ifndef QWINDOWSXPSTYLE_H #define QWINDOWSXPSTYLE_H -#include <QtGui/qwindowsstyle.h> +#include <QtWidgets/qwindowsstyle.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) #if !defined(QT_NO_STYLE_WINDOWSXP) class QWindowsXPStylePrivate; -class Q_GUI_EXPORT QWindowsXPStyle : public QWindowsStyle +class Q_WIDGETS_EXPORT QWindowsXPStyle : public QWindowsStyle { Q_OBJECT public: diff --git a/src/gui/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h similarity index 99% rename from src/gui/styles/qwindowsxpstyle_p.h rename to src/widgets/styles/qwindowsxpstyle_p.h index 73803607a1d..05ab2ec2e40 100644 --- a/src/gui/styles/qwindowsxpstyle_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p.h @@ -216,7 +216,7 @@ public: noContent(false), rotate(0), rect(r) {} - HRGN mask(); + HRGN mask(QWidget *widget); HTHEME handle(); RECT toRECT(const QRect &qr); diff --git a/src/gui/styles/styles.pri b/src/widgets/styles/styles.pri similarity index 94% rename from src/gui/styles/styles.pri rename to src/widgets/styles/styles.pri index b6eeec9af89..b20caf726e9 100644 --- a/src/gui/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -1,7 +1,8 @@ # Qt styles module HEADERS += \ - styles/qstyle.h \ + styles/qdrawutil.h \ + styles/qstyle.h \ styles/qstylefactory.h \ styles/qstyleoption.h \ styles/qstyleplugin.h \ @@ -10,16 +11,19 @@ HEADERS += \ styles/qstylehelper_p.h \ styles/qproxystyle.h \ styles/qproxystyle_p.h \ - styles/qstylesheetstyle_p.h + styles/qstylepainter.h \ + styles/qstylesheetstyle_p.h SOURCES += \ - styles/qstyle.cpp \ + styles/qdrawutil.cpp \ + styles/qstyle.cpp \ styles/qstylefactory.cpp \ styles/qstyleoption.cpp \ styles/qstyleplugin.cpp \ styles/qstylehelper.cpp \ styles/qcommonstyle.cpp \ styles/qproxystyle.cpp \ + styles/qstylepainter.cpp \ styles/qstylesheetstyle.cpp \ styles/qstylesheetstyle_default.cpp @@ -35,7 +39,7 @@ contains( styles, all ) { styles = mac windows windowsxp windowsvista } -x11|embedded|qpa|!macx-*:styles -= mac +x11|qpa|!macx-*:styles -= mac x11{ QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE diff --git a/src/gui/symbian/images/blank.png b/src/widgets/symbian/images/blank.png similarity index 100% rename from src/gui/symbian/images/blank.png rename to src/widgets/symbian/images/blank.png diff --git a/src/gui/symbian/images/busy12.png b/src/widgets/symbian/images/busy12.png similarity index 100% rename from src/gui/symbian/images/busy12.png rename to src/widgets/symbian/images/busy12.png diff --git a/src/gui/symbian/images/busy3.png b/src/widgets/symbian/images/busy3.png similarity index 100% rename from src/gui/symbian/images/busy3.png rename to src/widgets/symbian/images/busy3.png diff --git a/src/gui/symbian/images/busy6.png b/src/widgets/symbian/images/busy6.png similarity index 100% rename from src/gui/symbian/images/busy6.png rename to src/widgets/symbian/images/busy6.png diff --git a/src/gui/symbian/images/busy9.png b/src/widgets/symbian/images/busy9.png similarity index 100% rename from src/gui/symbian/images/busy9.png rename to src/widgets/symbian/images/busy9.png diff --git a/src/gui/symbian/images/closehand.png b/src/widgets/symbian/images/closehand.png similarity index 100% rename from src/gui/symbian/images/closehand.png rename to src/widgets/symbian/images/closehand.png diff --git a/src/gui/symbian/images/cross.png b/src/widgets/symbian/images/cross.png similarity index 100% rename from src/gui/symbian/images/cross.png rename to src/widgets/symbian/images/cross.png diff --git a/src/gui/symbian/images/forbidden.png b/src/widgets/symbian/images/forbidden.png similarity index 100% rename from src/gui/symbian/images/forbidden.png rename to src/widgets/symbian/images/forbidden.png diff --git a/src/gui/symbian/images/handpoint.png b/src/widgets/symbian/images/handpoint.png similarity index 100% rename from src/gui/symbian/images/handpoint.png rename to src/widgets/symbian/images/handpoint.png diff --git a/src/gui/symbian/images/ibeam.png b/src/widgets/symbian/images/ibeam.png similarity index 100% rename from src/gui/symbian/images/ibeam.png rename to src/widgets/symbian/images/ibeam.png diff --git a/src/gui/symbian/images/openhand.png b/src/widgets/symbian/images/openhand.png similarity index 100% rename from src/gui/symbian/images/openhand.png rename to src/widgets/symbian/images/openhand.png diff --git a/src/gui/symbian/images/pointer.png b/src/widgets/symbian/images/pointer.png similarity index 100% rename from src/gui/symbian/images/pointer.png rename to src/widgets/symbian/images/pointer.png diff --git a/src/gui/symbian/images/sizeall.png b/src/widgets/symbian/images/sizeall.png similarity index 100% rename from src/gui/symbian/images/sizeall.png rename to src/widgets/symbian/images/sizeall.png diff --git a/src/gui/symbian/images/sizebdiag.png b/src/widgets/symbian/images/sizebdiag.png similarity index 100% rename from src/gui/symbian/images/sizebdiag.png rename to src/widgets/symbian/images/sizebdiag.png diff --git a/src/gui/symbian/images/sizefdiag.png b/src/widgets/symbian/images/sizefdiag.png similarity index 100% rename from src/gui/symbian/images/sizefdiag.png rename to src/widgets/symbian/images/sizefdiag.png diff --git a/src/gui/symbian/images/sizehor.png b/src/widgets/symbian/images/sizehor.png similarity index 100% rename from src/gui/symbian/images/sizehor.png rename to src/widgets/symbian/images/sizehor.png diff --git a/src/gui/symbian/images/sizever.png b/src/widgets/symbian/images/sizever.png similarity index 100% rename from src/gui/symbian/images/sizever.png rename to src/widgets/symbian/images/sizever.png diff --git a/src/gui/symbian/images/splith.png b/src/widgets/symbian/images/splith.png similarity index 100% rename from src/gui/symbian/images/splith.png rename to src/widgets/symbian/images/splith.png diff --git a/src/gui/symbian/images/splitv.png b/src/widgets/symbian/images/splitv.png similarity index 100% rename from src/gui/symbian/images/splitv.png rename to src/widgets/symbian/images/splitv.png diff --git a/src/gui/symbian/images/uparrow.png b/src/widgets/symbian/images/uparrow.png similarity index 100% rename from src/gui/symbian/images/uparrow.png rename to src/widgets/symbian/images/uparrow.png diff --git a/src/gui/symbian/images/wait1.png b/src/widgets/symbian/images/wait1.png similarity index 100% rename from src/gui/symbian/images/wait1.png rename to src/widgets/symbian/images/wait1.png diff --git a/src/gui/symbian/images/wait10.png b/src/widgets/symbian/images/wait10.png similarity index 100% rename from src/gui/symbian/images/wait10.png rename to src/widgets/symbian/images/wait10.png diff --git a/src/gui/symbian/images/wait11.png b/src/widgets/symbian/images/wait11.png similarity index 100% rename from src/gui/symbian/images/wait11.png rename to src/widgets/symbian/images/wait11.png diff --git a/src/gui/symbian/images/wait12.png b/src/widgets/symbian/images/wait12.png similarity index 100% rename from src/gui/symbian/images/wait12.png rename to src/widgets/symbian/images/wait12.png diff --git a/src/gui/symbian/images/wait2.png b/src/widgets/symbian/images/wait2.png similarity index 100% rename from src/gui/symbian/images/wait2.png rename to src/widgets/symbian/images/wait2.png diff --git a/src/gui/symbian/images/wait3.png b/src/widgets/symbian/images/wait3.png similarity index 100% rename from src/gui/symbian/images/wait3.png rename to src/widgets/symbian/images/wait3.png diff --git a/src/gui/symbian/images/wait4.png b/src/widgets/symbian/images/wait4.png similarity index 100% rename from src/gui/symbian/images/wait4.png rename to src/widgets/symbian/images/wait4.png diff --git a/src/gui/symbian/images/wait5.png b/src/widgets/symbian/images/wait5.png similarity index 100% rename from src/gui/symbian/images/wait5.png rename to src/widgets/symbian/images/wait5.png diff --git a/src/gui/symbian/images/wait6.png b/src/widgets/symbian/images/wait6.png similarity index 100% rename from src/gui/symbian/images/wait6.png rename to src/widgets/symbian/images/wait6.png diff --git a/src/gui/symbian/images/wait7.png b/src/widgets/symbian/images/wait7.png similarity index 100% rename from src/gui/symbian/images/wait7.png rename to src/widgets/symbian/images/wait7.png diff --git a/src/gui/symbian/images/wait8.png b/src/widgets/symbian/images/wait8.png similarity index 100% rename from src/gui/symbian/images/wait8.png rename to src/widgets/symbian/images/wait8.png diff --git a/src/gui/symbian/images/wait9.png b/src/widgets/symbian/images/wait9.png similarity index 100% rename from src/gui/symbian/images/wait9.png rename to src/widgets/symbian/images/wait9.png diff --git a/src/gui/symbian/images/whatsthis.png b/src/widgets/symbian/images/whatsthis.png similarity index 100% rename from src/gui/symbian/images/whatsthis.png rename to src/widgets/symbian/images/whatsthis.png diff --git a/src/gui/symbian/qsymbianevent.cpp b/src/widgets/symbian/qsymbianevent.cpp similarity index 100% rename from src/gui/symbian/qsymbianevent.cpp rename to src/widgets/symbian/qsymbianevent.cpp diff --git a/src/gui/symbian/qsymbianevent.h b/src/widgets/symbian/qsymbianevent.h similarity index 96% rename from src/gui/symbian/qsymbianevent.h rename to src/widgets/symbian/qsymbianevent.h index 6a7984ed0bd..2ecc846a8ec 100644 --- a/src/gui/symbian/qsymbianevent.h +++ b/src/widgets/symbian/qsymbianevent.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -class Q_GUI_EXPORT QSymbianEvent +class Q_WIDGETS_EXPORT QSymbianEvent { public: enum Type { @@ -96,7 +96,7 @@ inline bool QSymbianEvent::isValid() const } #ifndef QT_NO_DEBUG_STREAM -Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QSymbianEvent *o); +Q_WIDGETS_EXPORT QDebug operator<<(QDebug dbg, const QSymbianEvent *o); #endif QT_END_NAMESPACE diff --git a/src/gui/symbian/symbianresources.qrc b/src/widgets/symbian/symbianresources.qrc similarity index 100% rename from src/gui/symbian/symbianresources.qrc rename to src/widgets/symbian/symbianresources.qrc diff --git a/src/gui/kernel/qshortcut.cpp b/src/widgets/to_be_moved/qshortcut.cpp similarity index 100% rename from src/gui/kernel/qshortcut.cpp rename to src/widgets/to_be_moved/qshortcut.cpp diff --git a/src/gui/kernel/qshortcut.h b/src/widgets/to_be_moved/qshortcut.h similarity index 97% rename from src/gui/kernel/qshortcut.h rename to src/widgets/to_be_moved/qshortcut.h index 5567b50a98d..6e3c6478528 100644 --- a/src/gui/kernel/qshortcut.h +++ b/src/widgets/to_be_moved/qshortcut.h @@ -42,7 +42,7 @@ #ifndef QSHORTCUT_H #define QSHORTCUT_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> #include <QtGui/qkeysequence.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) #ifndef QT_NO_SHORTCUT class QShortcutPrivate; -class Q_GUI_EXPORT QShortcut : public QObject +class Q_WIDGETS_EXPORT QShortcut : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QShortcut) diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/widgets/to_be_moved/qshortcutmap.cpp similarity index 99% rename from src/gui/kernel/qshortcutmap.cpp rename to src/widgets/to_be_moved/qshortcutmap.cpp index b60578d8e3b..394c730d826 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/widgets/to_be_moved/qshortcutmap.cpp @@ -52,7 +52,7 @@ #include "qmenu.h" #include "qmenubar.h" #include "qshortcut.h" -#include "qapplication_p.h" +#include "private/qapplication_p.h" #include <private/qaction_p.h> #include <private/qkeymapper_p.h> #include <private/qwidget_p.h> @@ -337,7 +337,7 @@ bool QShortcutMap::tryShortcutEvent(QObject *o, QKeyEvent *e) ushort orgType = e->t; e->t = QEvent::ShortcutOverride; e->ignore(); - QApplication::sendEvent(o, e); + QCoreApplication::sendEvent(o, e); e->t = orgType; e->spont = wasSpontaneous; if (e->isAccepted()) { @@ -876,7 +876,7 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e) << (bool)(enabledShortcuts>1) << ") to object(" << next->owner << ')'; #endif QShortcutEvent se(next->keyseq, next->id, enabledShortcuts>1); - QApplication::sendEvent(const_cast<QObject *>(next->owner), &se); + QCoreApplication::sendEvent(const_cast<QObject *>(next->owner), &se); } /* \internal diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/widgets/to_be_moved/qshortcutmap_p.h similarity index 100% rename from src/gui/kernel/qshortcutmap_p.h rename to src/widgets/to_be_moved/qshortcutmap_p.h diff --git a/src/widgets/to_be_moved/to_be_moved.pri b/src/widgets/to_be_moved/to_be_moved.pri new file mode 100644 index 00000000000..fc570ce2d9b --- /dev/null +++ b/src/widgets/to_be_moved/to_be_moved.pri @@ -0,0 +1,7 @@ +HEADERS += \ + to_be_moved/qshortcut.h \ + to_be_moved/qshortcutmap_p.h \ + +SOURCES += \ + to_be_moved/qshortcut.cpp \ + to_be_moved/qshortcutmap.cpp \ diff --git a/src/gui/painting/qcolormap.h b/src/widgets/util/qcolormap.h similarity index 98% rename from src/gui/painting/qcolormap.h rename to src/widgets/util/qcolormap.h index 7ac818fc2e6..ebb51427685 100644 --- a/src/gui/painting/qcolormap.h +++ b/src/widgets/util/qcolormap.h @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QColor; class QColormapPrivate; -class Q_GUI_EXPORT QColormap +class Q_WIDGETS_EXPORT QColormap { public: enum Mode { Direct, Indexed, Gray }; diff --git a/src/gui/painting/qcolormap.qdoc b/src/widgets/util/qcolormap.qdoc similarity index 100% rename from src/gui/painting/qcolormap.qdoc rename to src/widgets/util/qcolormap.qdoc diff --git a/src/gui/painting/qcolormap_qpa.cpp b/src/widgets/util/qcolormap_qpa.cpp similarity index 96% rename from src/gui/painting/qcolormap_qpa.cpp rename to src/widgets/util/qcolormap_qpa.cpp index 40bf364c5ae..6ad3abb3aa4 100644 --- a/src/gui/painting/qcolormap_qpa.cpp +++ b/src/widgets/util/qcolormap_qpa.cpp @@ -42,8 +42,8 @@ #include "qcolormap.h" #include "qcolor.h" #include "qpaintdevice.h" -#include "private/qapplication_p.h" -#include "private/qgraphicssystem_p.h" +#include "qscreen.h" +#include "qguiapplication.h" QT_BEGIN_NAMESPACE @@ -67,10 +67,7 @@ void QColormap::initialize() { screenMap = new QColormapPrivate; - QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); - QList<QPlatformScreen*> screens = pi->screens(); - - screenMap->depth = screens.at(0)->depth(); + screenMap->depth = QGuiApplication::primaryScreen()->depth(); if (screenMap->depth < 8) { screenMap->mode = QColormap::Indexed; screenMap->numcolors = 256; diff --git a/src/gui/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp similarity index 99% rename from src/gui/util/qcompleter.cpp rename to src/widgets/util/qcompleter.cpp index 07bfac729da..d1ec03f1e43 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -144,17 +144,17 @@ #ifndef QT_NO_COMPLETER -#include "QtGui/qscrollbar.h" -#include "QtGui/qstringlistmodel.h" -#include "QtGui/qdirmodel.h" -#include "QtGui/qfilesystemmodel.h" -#include "QtGui/qheaderview.h" -#include "QtGui/qlistview.h" -#include "QtGui/qapplication.h" +#include "QtWidgets/qscrollbar.h" +#include "QtWidgets/qstringlistmodel.h" +#include "QtWidgets/qdirmodel.h" +#include "QtWidgets/qfilesystemmodel.h" +#include "QtWidgets/qheaderview.h" +#include "QtWidgets/qlistview.h" +#include "QtWidgets/qapplication.h" #include "QtGui/qevent.h" -#include "QtGui/qheaderview.h" -#include "QtGui/qdesktopwidget.h" -#include "QtGui/qlineedit.h" +#include "QtWidgets/qheaderview.h" +#include "QtWidgets/qdesktopwidget.h" +#include "QtWidgets/qlineedit.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/util/qcompleter.h b/src/widgets/util/qcompleter.h similarity index 99% rename from src/gui/util/qcompleter.h rename to src/widgets/util/qcompleter.h index 61797ee645f..c7e1b6e945b 100644 --- a/src/gui/util/qcompleter.h +++ b/src/widgets/util/qcompleter.h @@ -61,7 +61,7 @@ class QAbstractItemView; class QAbstractProxyModel; class QWidget; -class Q_GUI_EXPORT QCompleter : public QObject +class Q_WIDGETS_EXPORT QCompleter : public QObject { Q_OBJECT Q_PROPERTY(QString completionPrefix READ completionPrefix WRITE setCompletionPrefix) diff --git a/src/gui/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h similarity index 98% rename from src/gui/util/qcompleter_p.h rename to src/widgets/util/qcompleter_p.h index e06440cb079..639c8755685 100644 --- a/src/gui/util/qcompleter_p.h +++ b/src/widgets/util/qcompleter_p.h @@ -58,10 +58,10 @@ #ifndef QT_NO_COMPLETER -#include "QtGui/qtreeview.h" -#include "QtGui/qabstractproxymodel.h" +#include "QtWidgets/qtreeview.h" +#include "QtWidgets/qabstractproxymodel.h" #include "qcompleter.h" -#include "QtGui/qitemdelegate.h" +#include "QtWidgets/qitemdelegate.h" #include "QtGui/qpainter.h" #include "private/qabstractproxymodel_p.h" diff --git a/src/gui/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp similarity index 97% rename from src/gui/util/qflickgesture.cpp rename to src/widgets/util/qflickgesture.cpp index 07eca6c53ba..c92fb94be70 100644 --- a/src/gui/util/qflickgesture.cpp +++ b/src/widgets/util/qflickgesture.cpp @@ -73,7 +73,7 @@ static QMouseEvent *copyMouseEvent(QEvent *e) case QEvent::MouseButtonRelease: case QEvent::MouseMove: { QMouseEvent *me = static_cast<QMouseEvent *>(e); - return new QMouseEvent(me->type(), QPoint(0, 0), me->globalPos(), me->button(), me->buttons(), me->modifiers()); + return new QMouseEvent(me->type(), QPoint(0, 0), me->windowPos(), me->screenPos(), me->button(), me->buttons(), me->modifiers()); } #ifndef QT_NO_GRAPHICSVIEW case QEvent::GraphicsSceneMousePress: @@ -83,7 +83,7 @@ static QMouseEvent *copyMouseEvent(QEvent *e) #if 1 QEvent::Type met = me->type() == QEvent::GraphicsSceneMousePress ? QEvent::MouseButtonPress : (me->type() == QEvent::GraphicsSceneMouseRelease ? QEvent::MouseButtonRelease : QEvent::MouseMove); - return new QMouseEvent(met, QPoint(0, 0), me->screenPos(), me->button(), me->buttons(), me->modifiers()); + return new QMouseEvent(met, QPoint(0, 0), QPoint(0, 0), me->screenPos(), me->button(), me->buttons(), me->modifiers()); #else QGraphicsSceneMouseEvent *copy = new QGraphicsSceneMouseEvent(me->type()); copy->setPos(me->pos()); @@ -237,7 +237,7 @@ public: QPoint farFarAway(-QWIDGETSIZE_MAX, -QWIDGETSIZE_MAX); qFGDebug() << "QFG: sending a fake mouse release at far-far-away to " << mouseTarget; - QMouseEvent re(QEvent::MouseButtonRelease, QPoint(), farFarAway, + QMouseEvent re(QEvent::MouseButtonRelease, QPoint(), farFarAway, farFarAway, mouseButton, QApplication::mouseButtons() & ~mouseButton, QApplication::keyboardModifiers()); sendMouseEvent(&re, RegrabMouseAfterwards); @@ -287,7 +287,9 @@ protected: #endif // QT_NO_GRAPHICSVIEW if (me) { - QMouseEvent copy(me->type(), mouseTarget->mapFromGlobal(me->globalPos()), me->globalPos(), me->button(), me->buttons(), me->modifiers()); + QMouseEvent copy(me->type(), mouseTarget->mapFromGlobal(me->globalPos()), + mouseTarget->topLevelWidget()->mapFromGlobal(me->globalPos()), me->screenPos(), + me->button(), me->buttons(), me->modifiers()); qt_sendSpontaneousEvent(mouseTarget, ©); } diff --git a/src/gui/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h similarity index 98% rename from src/gui/util/qflickgesture_p.h rename to src/widgets/util/qflickgesture_p.h index e095cf5eaba..23c8b6e7886 100644 --- a/src/gui/util/qflickgesture_p.h +++ b/src/widgets/util/qflickgesture_p.h @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE class QFlickGesturePrivate; class QGraphicsItem; -class Q_GUI_EXPORT QFlickGesture : public QGesture +class Q_WIDGETS_EXPORT QFlickGesture : public QGesture { Q_OBJECT Q_DECLARE_PRIVATE(QFlickGesture) diff --git a/src/gui/util/qscroller.cpp b/src/widgets/util/qscroller.cpp similarity index 100% rename from src/gui/util/qscroller.cpp rename to src/widgets/util/qscroller.cpp diff --git a/src/gui/util/qscroller.h b/src/widgets/util/qscroller.h similarity index 97% rename from src/gui/util/qscroller.h rename to src/widgets/util/qscroller.h index 16a7f2e421b..3484139cbbd 100644 --- a/src/gui/util/qscroller.h +++ b/src/widgets/util/qscroller.h @@ -44,7 +44,7 @@ #include <QtCore/QObject> #include <QtCore/QPointF> -#include <QtGui/QScrollerProperties> +#include <QtWidgets/QScrollerProperties> QT_BEGIN_HEADER @@ -60,7 +60,7 @@ class QFlickGestureRecognizer; class QMouseFlickGestureRecognizer; #endif -class Q_GUI_EXPORT QScroller : public QObject +class Q_WIDGETS_EXPORT QScroller : public QObject { Q_OBJECT Q_PROPERTY(State state READ state NOTIFY stateChanged) diff --git a/src/gui/util/qscroller_mac.mm b/src/widgets/util/qscroller_mac.mm similarity index 100% rename from src/gui/util/qscroller_mac.mm rename to src/widgets/util/qscroller_mac.mm diff --git a/src/gui/util/qscroller_p.h b/src/widgets/util/qscroller_p.h similarity index 100% rename from src/gui/util/qscroller_p.h rename to src/widgets/util/qscroller_p.h diff --git a/src/gui/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp similarity index 100% rename from src/gui/util/qscrollerproperties.cpp rename to src/widgets/util/qscrollerproperties.cpp diff --git a/src/gui/util/qscrollerproperties.h b/src/widgets/util/qscrollerproperties.h similarity index 99% rename from src/gui/util/qscrollerproperties.h rename to src/widgets/util/qscrollerproperties.h index 46d1c2f44ac..73c1125fe0c 100644 --- a/src/gui/util/qscrollerproperties.h +++ b/src/widgets/util/qscrollerproperties.h @@ -56,7 +56,7 @@ class QScroller; class QScrollerPrivate; class QScrollerPropertiesPrivate; -class Q_GUI_EXPORT QScrollerProperties +class Q_WIDGETS_EXPORT QScrollerProperties { public: QScrollerProperties(); diff --git a/src/gui/util/qscrollerproperties_p.h b/src/widgets/util/qscrollerproperties_p.h similarity index 100% rename from src/gui/util/qscrollerproperties_p.h rename to src/widgets/util/qscrollerproperties_p.h diff --git a/src/gui/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp similarity index 99% rename from src/gui/util/qsystemtrayicon.cpp rename to src/widgets/util/qsystemtrayicon.cpp index 28d493248fd..f6eeaa02b2c 100644 --- a/src/gui/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -474,7 +474,7 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title msgLabel->setWordWrap(true); if (msgLabel->sizeHint().width() > limit) { msgLabel->d_func()->ensureTextControl(); - if (QTextControl *control = msgLabel->d_func()->control) { + if (QWidgetTextControl *control = msgLabel->d_func()->control) { QTextOption opt = control->document()->defaultTextOption(); opt.setWrapMode(QTextOption::WrapAnywhere); control->document()->setDefaultTextOption(opt); diff --git a/src/gui/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h similarity index 97% rename from src/gui/util/qsystemtrayicon.h rename to src/widgets/util/qsystemtrayicon.h index 879a0d293f0..3327ce42231 100644 --- a/src/gui/util/qsystemtrayicon.h +++ b/src/widgets/util/qsystemtrayicon.h @@ -46,7 +46,7 @@ #ifndef QT_NO_SYSTEMTRAYICON -#include <QtGui/qicon.h> +#include <QtWidgets/qicon.h> QT_BEGIN_HEADER @@ -62,7 +62,7 @@ class QWheelEvent; class QMouseEvent; class QPoint; -class Q_GUI_EXPORT QSystemTrayIcon : public QObject +class Q_WIDGETS_EXPORT QSystemTrayIcon : public QObject { Q_OBJECT Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip) diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/widgets/util/qsystemtrayicon_mac.mm similarity index 100% rename from src/gui/util/qsystemtrayicon_mac.mm rename to src/widgets/util/qsystemtrayicon_mac.mm diff --git a/src/gui/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h similarity index 99% rename from src/gui/util/qsystemtrayicon_p.h rename to src/widgets/util/qsystemtrayicon_p.h index 14495eee59a..ce2404ae8bd 100644 --- a/src/gui/util/qsystemtrayicon_p.h +++ b/src/widgets/util/qsystemtrayicon_p.h @@ -58,7 +58,7 @@ #ifndef QT_NO_SYSTEMTRAYICON -#include "QtGui/qmenu.h" +#include "QtWidgets/qmenu.h" #include "QtGui/qpixmap.h" #include "QtCore/qstring.h" #include "QtCore/qpointer.h" diff --git a/src/gui/util/qsystemtrayicon_qws.cpp b/src/widgets/util/qsystemtrayicon_qpa.cpp similarity index 100% rename from src/gui/util/qsystemtrayicon_qws.cpp rename to src/widgets/util/qsystemtrayicon_qpa.cpp diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp similarity index 100% rename from src/gui/util/qsystemtrayicon_win.cpp rename to src/widgets/util/qsystemtrayicon_win.cpp diff --git a/src/gui/util/qsystemtrayicon_wince.cpp b/src/widgets/util/qsystemtrayicon_wince.cpp similarity index 100% rename from src/gui/util/qsystemtrayicon_wince.cpp rename to src/widgets/util/qsystemtrayicon_wince.cpp diff --git a/src/gui/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp similarity index 100% rename from src/gui/util/qsystemtrayicon_x11.cpp rename to src/widgets/util/qsystemtrayicon_x11.cpp diff --git a/src/gui/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp similarity index 100% rename from src/gui/util/qundogroup.cpp rename to src/widgets/util/qundogroup.cpp diff --git a/src/gui/util/qundogroup.h b/src/widgets/util/qundogroup.h similarity index 98% rename from src/gui/util/qundogroup.h rename to src/widgets/util/qundogroup.h index 99026fc077f..ce2dac25037 100644 --- a/src/gui/util/qundogroup.h +++ b/src/widgets/util/qundogroup.h @@ -57,7 +57,7 @@ QT_MODULE(Gui) #ifndef QT_NO_UNDOGROUP -class Q_GUI_EXPORT QUndoGroup : public QObject +class Q_WIDGETS_EXPORT QUndoGroup : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QUndoGroup) diff --git a/src/gui/util/qundostack.cpp b/src/widgets/util/qundostack.cpp similarity index 100% rename from src/gui/util/qundostack.cpp rename to src/widgets/util/qundostack.cpp diff --git a/src/gui/util/qundostack.h b/src/widgets/util/qundostack.h similarity index 97% rename from src/gui/util/qundostack.h rename to src/widgets/util/qundostack.h index 2cbbc0ad4a3..493d11fdb7e 100644 --- a/src/gui/util/qundostack.h +++ b/src/widgets/util/qundostack.h @@ -57,7 +57,7 @@ class QUndoStackPrivate; #ifndef QT_NO_UNDOCOMMAND -class Q_GUI_EXPORT QUndoCommand +class Q_WIDGETS_EXPORT QUndoCommand { QUndoCommandPrivate *d; @@ -88,7 +88,7 @@ private: #ifndef QT_NO_UNDOSTACK -class Q_GUI_EXPORT QUndoStack : public QObject +class Q_WIDGETS_EXPORT QUndoStack : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QUndoStack) diff --git a/src/gui/util/qundostack_p.h b/src/widgets/util/qundostack_p.h similarity index 99% rename from src/gui/util/qundostack_p.h rename to src/widgets/util/qundostack_p.h index 7162e198428..1e5f99bc6ca 100644 --- a/src/gui/util/qundostack_p.h +++ b/src/widgets/util/qundostack_p.h @@ -45,7 +45,7 @@ #include <private/qobject_p.h> #include <QtCore/qlist.h> #include <QtCore/qstring.h> -#include <QtGui/qaction.h> +#include <QtWidgets/qaction.h> #include "qundostack.h" diff --git a/src/gui/util/qundoview.cpp b/src/widgets/util/qundoview.cpp similarity index 99% rename from src/gui/util/qundoview.cpp rename to src/widgets/util/qundoview.cpp index d0f411105bc..820fcaf2de1 100644 --- a/src/gui/util/qundoview.cpp +++ b/src/widgets/util/qundoview.cpp @@ -47,7 +47,7 @@ #include "qundogroup.h" #include <QtCore/qabstractitemmodel.h> #include <QtCore/qpointer.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qicon.h> #include <private/qlistview_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/util/qundoview.h b/src/widgets/util/qundoview.h similarity index 97% rename from src/gui/util/qundoview.h rename to src/widgets/util/qundoview.h index 5c3801ddeaa..9df2995f9d6 100644 --- a/src/gui/util/qundoview.h +++ b/src/widgets/util/qundoview.h @@ -42,7 +42,7 @@ #ifndef QUNDOVIEW_H #define QUNDOVIEW_H -#include <QtGui/qlistview.h> +#include <QtWidgets/qlistview.h> #include <QtCore/qstring.h> #ifndef QT_NO_UNDOVIEW @@ -58,7 +58,7 @@ class QIcon; QT_MODULE(Gui) -class Q_GUI_EXPORT QUndoView : public QListView +class Q_WIDGETS_EXPORT QUndoView : public QListView { Q_OBJECT Q_DECLARE_PRIVATE(QUndoView) diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri new file mode 100644 index 00000000000..2eec9463386 --- /dev/null +++ b/src/widgets/util/util.pri @@ -0,0 +1,71 @@ +# Qt util module + +HEADERS += \ + util/qsystemtrayicon.h \ + util/qcolormap.h \ + util/qcompleter.h \ + util/qcompleter_p.h \ + util/qsystemtrayicon_p.h \ + util/qscroller.h \ + util/qscroller_p.h \ + util/qscrollerproperties.h \ + util/qscrollerproperties_p.h \ + util/qflickgesture_p.h \ + util/qundogroup.h \ + util/qundostack.h \ + util/qundostack_p.h \ + util/qundoview.h + +SOURCES += \ + util/qsystemtrayicon.cpp \ + util/qcolormap_qpa.cpp \ + util/qcompleter.cpp \ + util/qscroller.cpp \ + util/qscrollerproperties.cpp \ + util/qflickgesture.cpp \ + util/qundogroup.cpp \ + util/qundostack.cpp \ + util/qundoview.cpp + + +wince* { + SOURCES += \ + util/qsystemtrayicon_wince.cpp +} else:win32:!qpa { + SOURCES += \ + util/qsystemtrayicon_win.cpp +} + +unix:x11 { + SOURCES += \ + util/qsystemtrayicon_x11.cpp +} + +qpa { + SOURCES += \ + util/qsystemtrayicon_qpa.cpp +} + +!qpa:!x11:mac { + OBJECTIVE_SOURCES += util/qsystemtrayicon_mac.mm +} + +symbian { + LIBS += -letext -lplatformenv + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + LIBS += -lsendas2 -lapmime + contains(QT_CONFIG, s60) { + contains(CONFIG, is_using_gnupoc) { + LIBS += -lcommonui + } else { + LIBS += -lCommonUI + } + } + } else { + DEFINES += USE_SCHEMEHANDLER + } +} + +macx { + OBJECTIVE_SOURCES += util/qscroller_mac.mm +} diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro new file mode 100644 index 00000000000..bff487bf3f0 --- /dev/null +++ b/src/widgets/widgets.pro @@ -0,0 +1,227 @@ +load(qt_module) + +TARGET = QtWidgets +QPRO_PWD = $$PWD +QT = core core-private gui gui-private + +CONFIG += module +MODULE_PRI = ../modules/qt_widgets.pri + +DEFINES += QT_BUILD_WIDGETS_LIB QT_NO_USING_NAMESPACE +win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000 +irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused + +!win32:!qpa:!mac:!symbian:CONFIG += x11 + +unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore + +HEADERS += $$QT_SOURCE_TREE/src/widgets/qtwidgetsversion.h + +include(../qbase.pri) + +contains(QT_CONFIG, x11sm):CONFIG += x11sm + +#platforms +x11:include(kernel/x11.pri) +mac:include(kernel/mac.pri) +win32:include(kernel/win.pri) +symbian { + include(kernel/symbian.pri) + include(s60framework/s60framework.pri) +} + +# to be moved into QtGui +include(to_be_moved/to_be_moved.pri) + +#modules +include(animation/animation.pri) +include(kernel/kernel.pri) +include(styles/styles.pri) +include(widgets/widgets.pri) +include(dialogs/dialogs.pri) +include(accessible/accessible.pri) +include(itemviews/itemviews.pri) +include(graphicsview/graphicsview.pri) +include(util/util.pri) +include(statemachine/statemachine.pri) +include(effects/effects.pri) + + +QMAKE_LIBS += $$QMAKE_LIBS_GUI + +contains(DEFINES,QT_EVAL):include($$QT_SOURCE_TREE/src/corelib/eval.pri) + +QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist + +DEFINES += Q_INTERNAL_QAPP_SRC +symbian { + TARGET.UID3=0x2001B2DD + + # ro-section in gui can exceed default allocated space, so move rw-section a little further + QMAKE_LFLAGS.ARMCC += --rw-base 0x800000 + QMAKE_LFLAGS.GCCE += -Tdata 0x800000 +} + +neon:*-g++* { + DEFINES += QT_HAVE_NEON + HEADERS += $$NEON_HEADERS + + DRAWHELPER_NEON_ASM_FILES = $$NEON_ASM + + neon_compiler.commands = $$QMAKE_CXX -c + neon_compiler.commands += $(CXXFLAGS) -mfpu=neon $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + neon_compiler.dependency_type = TYPE_C + neon_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + neon_compiler.input = DRAWHELPER_NEON_ASM_FILES NEON_SOURCES + neon_compiler.variable_out = OBJECTS + neon_compiler.name = compiling[neon] ${QMAKE_FILE_IN} + silent:neon_compiler.commands = @echo compiling[neon] ${QMAKE_FILE_IN} && $$neon_compiler.commands + QMAKE_EXTRA_COMPILERS += neon_compiler +} + +INCLUDEPATH += ../3rdparty/harfbuzz/src + +win32:!contains(QT_CONFIG, directwrite) { + DEFINES += QT_NO_DIRECTWRITE +} + +contains(QMAKE_MAC_XARCH, no) { + DEFINES += QT_NO_MAC_XARCH +} else { + win32-g++*|!win32:!win32-icc*:!macx-icc* { + mmx { + mmx_compiler.commands = $$QMAKE_CXX -c -Winline + + mac { + mmx_compiler.commands += -Xarch_i386 -mmmx + mmx_compiler.commands += -Xarch_x86_64 -mmmx + } else { + mmx_compiler.commands += -mmmx + } + + mmx_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + mmx_compiler.dependency_type = TYPE_C + mmx_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + mmx_compiler.input = MMX_SOURCES + mmx_compiler.variable_out = OBJECTS + mmx_compiler.name = compiling[mmx] ${QMAKE_FILE_IN} + silent:mmx_compiler.commands = @echo compiling[mmx] ${QMAKE_FILE_IN} && $$mmx_compiler.commands + QMAKE_EXTRA_COMPILERS += mmx_compiler + } + 3dnow { + mmx3dnow_compiler.commands = $$QMAKE_CXX -c -Winline + + mac { + mmx3dnow_compiler.commands += -Xarch_i386 -m3dnow -Xarch_i386 -mmmx + mmx3dnow_compiler.commands += -Xarch_x86_64 -m3dnow -Xarch_x86_64 -mmmx + } else { + mmx3dnow_compiler.commands += -m3dnow -mmmx + } + + mmx3dnow_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + mmx3dnow_compiler.dependency_type = TYPE_C + mmx3dnow_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + mmx3dnow_compiler.input = MMX3DNOW_SOURCES + mmx3dnow_compiler.variable_out = OBJECTS + mmx3dnow_compiler.name = compiling[mmx3dnow] ${QMAKE_FILE_IN} + silent:mmx3dnow_compiler.commands = @echo compiling[mmx3dnow] ${QMAKE_FILE_IN} && $$mmx3dnow_compiler.commands + QMAKE_EXTRA_COMPILERS += mmx3dnow_compiler + sse { + sse3dnow_compiler.commands = $$QMAKE_CXX -c -Winline + + mac { + sse3dnow_compiler.commands += -Xarch_i386 -m3dnow -Xarch_i386 -msse + sse3dnow_compiler.commands += -Xarch_x86_64 -m3dnow -Xarch_x86_64 -msse + } else { + sse3dnow_compiler.commands += -m3dnow -msse + } + + sse3dnow_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + sse3dnow_compiler.dependency_type = TYPE_C + sse3dnow_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + sse3dnow_compiler.input = SSE3DNOW_SOURCES + sse3dnow_compiler.variable_out = OBJECTS + sse3dnow_compiler.name = compiling[sse3dnow] ${QMAKE_FILE_IN} + silent:sse3dnow_compiler.commands = @echo compiling[sse3dnow] ${QMAKE_FILE_IN} && $$sse3dnow_compiler.commands + QMAKE_EXTRA_COMPILERS += sse3dnow_compiler + } + } + sse { + sse_compiler.commands = $$QMAKE_CXX -c -Winline + + mac { + sse_compiler.commands += -Xarch_i386 -msse + sse_compiler.commands += -Xarch_x86_64 -msse + } else { + sse_compiler.commands += -msse + } + + sse_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + sse_compiler.dependency_type = TYPE_C + sse_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + sse_compiler.input = SSE_SOURCES + sse_compiler.variable_out = OBJECTS + sse_compiler.name = compiling[sse] ${QMAKE_FILE_IN} + silent:sse_compiler.commands = @echo compiling[sse] ${QMAKE_FILE_IN} && $$sse_compiler.commands + QMAKE_EXTRA_COMPILERS += sse_compiler + } + sse2 { + sse2_compiler.commands = $$QMAKE_CXX -c -Winline + + mac { + sse2_compiler.commands += -Xarch_i386 -msse2 + sse2_compiler.commands += -Xarch_x86_64 -msse2 + } else { + sse2_compiler.commands += -msse2 + } + + sse2_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + sse2_compiler.dependency_type = TYPE_C + sse2_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + sse2_compiler.input = SSE2_SOURCES + sse2_compiler.variable_out = OBJECTS + sse2_compiler.name = compiling[sse2] ${QMAKE_FILE_IN} + silent:sse2_compiler.commands = @echo compiling[sse2] ${QMAKE_FILE_IN} && $$sse2_compiler.commands + QMAKE_EXTRA_COMPILERS += sse2_compiler + } + ssse3 { + ssse3_compiler.commands = $$QMAKE_CXX -c -Winline + + mac { + ssse3_compiler.commands += -Xarch_i386 -mssse3 + ssse3_compiler.commands += -Xarch_x86_64 -mssse3 + } else { + ssse3_compiler.commands += -mssse3 + } + + ssse3_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + ssse3_compiler.dependency_type = TYPE_C + ssse3_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + ssse3_compiler.input = SSSE3_SOURCES + ssse3_compiler.variable_out = OBJECTS + ssse3_compiler.name = compiling[ssse3] ${QMAKE_FILE_IN} + silent:ssse3_compiler.commands = @echo compiling[ssse3] ${QMAKE_FILE_IN} && $$ssse3_compiler.commands + QMAKE_EXTRA_COMPILERS += ssse3_compiler + } + iwmmxt { + iwmmxt_compiler.commands = $$QMAKE_CXX -c -Winline + iwmmxt_compiler.commands += -mcpu=iwmmxt + iwmmxt_compiler.commands += $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} + iwmmxt_compiler.dependency_type = TYPE_C + iwmmxt_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + iwmmxt_compiler.input = IWMMXT_SOURCES + iwmmxt_compiler.variable_out = OBJECTS + iwmmxt_compiler.name = compiling[iwmmxt] ${QMAKE_FILE_IN} + silent:iwmmxt_compiler.commands = @echo compiling[iwmmxt] ${QMAKE_FILE_IN} && $$iwmmxt_compiler.commands + QMAKE_EXTRA_COMPILERS += iwmmxt_compiler + } + } else { + mmx: SOURCES += $$MMX_SOURCES + 3dnow: SOURCES += $$MMX3DNOW_SOURCES + 3dnow:sse: SOURCES += $$SSE3DNOW_SOURCES + sse: SOURCES += $$SSE_SOURCES + sse2: SOURCES += $$SSE2_SOURCES + ssse3: SOURCES += $$SSSE3_SOURCES + iwmmxt: SOURCES += $$IWMMXT_SOURCES + } +} diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp similarity index 99% rename from src/gui/widgets/qabstractbutton.cpp rename to src/widgets/widgets/qabstractbutton.cpp index 57e517ab258..d777cc7567c 100644 --- a/src/gui/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE #define AUTO_REPEAT_DELAY 300 #define AUTO_REPEAT_INTERVAL 100 -Q_GUI_EXPORT extern bool qt_tab_all_widgets; +Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets; /*! \class QAbstractButton diff --git a/src/gui/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h similarity index 97% rename from src/gui/widgets/qabstractbutton.h rename to src/widgets/widgets/qabstractbutton.h index 89243466965..9edfa1b267d 100644 --- a/src/gui/widgets/qabstractbutton.h +++ b/src/widgets/widgets/qabstractbutton.h @@ -42,9 +42,9 @@ #ifndef QABSTRACTBUTTON_H #define QABSTRACTBUTTON_H -#include <QtGui/qicon.h> +#include <QtWidgets/qicon.h> #include <QtGui/qkeysequence.h> -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QButtonGroup; class QAbstractButtonPrivate; -class Q_GUI_EXPORT QAbstractButton : public QWidget +class Q_WIDGETS_EXPORT QAbstractButton : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h similarity index 100% rename from src/gui/widgets/qabstractbutton_p.h rename to src/widgets/widgets/qabstractbutton_p.h diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp similarity index 100% rename from src/gui/widgets/qabstractscrollarea.cpp rename to src/widgets/widgets/qabstractscrollarea.cpp diff --git a/src/gui/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h similarity index 98% rename from src/gui/widgets/qabstractscrollarea.h rename to src/widgets/widgets/qabstractscrollarea.h index e95b30435ad..3f2a2732971 100644 --- a/src/gui/widgets/qabstractscrollarea.h +++ b/src/widgets/widgets/qabstractscrollarea.h @@ -42,7 +42,7 @@ #ifndef QABSTRACTSCROLLAREA_H #define QABSTRACTSCROLLAREA_H -#include <QtGui/qframe.h> +#include <QtWidgets/qframe.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ class QMargins; class QScrollBar; class QAbstractScrollAreaPrivate; -class Q_GUI_EXPORT QAbstractScrollArea : public QFrame +class Q_WIDGETS_EXPORT QAbstractScrollArea : public QFrame { Q_OBJECT Q_PROPERTY(Qt::ScrollBarPolicy verticalScrollBarPolicy READ verticalScrollBarPolicy WRITE setVerticalScrollBarPolicy) diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h similarity index 98% rename from src/gui/widgets/qabstractscrollarea_p.h rename to src/widgets/widgets/qabstractscrollarea_p.h index 27ee19f5793..5511d08f4e5 100644 --- a/src/gui/widgets/qabstractscrollarea_p.h +++ b/src/widgets/widgets/qabstractscrollarea_p.h @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QScrollBar; class QAbstractScrollAreaScrollBarContainer; -class Q_GUI_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate +class Q_WIDGETS_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate { Q_DECLARE_PUBLIC(QAbstractScrollArea) diff --git a/src/gui/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp similarity index 100% rename from src/gui/widgets/qabstractslider.cpp rename to src/widgets/widgets/qabstractslider.cpp diff --git a/src/gui/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h similarity index 98% rename from src/gui/widgets/qabstractslider.h rename to src/widgets/widgets/qabstractslider.h index 2f548a730ee..109798154ef 100644 --- a/src/gui/widgets/qabstractslider.h +++ b/src/widgets/widgets/qabstractslider.h @@ -42,7 +42,7 @@ #ifndef QABSTRACTSLIDER_H #define QABSTRACTSLIDER_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_MODULE(Gui) class QAbstractSliderPrivate; -class Q_GUI_EXPORT QAbstractSlider : public QWidget +class Q_WIDGETS_EXPORT QAbstractSlider : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qabstractslider_p.h b/src/widgets/widgets/qabstractslider_p.h similarity index 100% rename from src/gui/widgets/qabstractslider_p.h rename to src/widgets/widgets/qabstractslider_p.h diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp similarity index 100% rename from src/gui/widgets/qabstractspinbox.cpp rename to src/widgets/widgets/qabstractspinbox.cpp diff --git a/src/gui/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h similarity index 98% rename from src/gui/widgets/qabstractspinbox.h rename to src/widgets/widgets/qabstractspinbox.h index 92259f9e279..fb3ae2f5ee5 100644 --- a/src/gui/widgets/qabstractspinbox.h +++ b/src/widgets/widgets/qabstractspinbox.h @@ -42,7 +42,7 @@ #ifndef QABSTRACTSPINBOX_H #define QABSTRACTSPINBOX_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> #include <QtGui/qvalidator.h> QT_BEGIN_HEADER @@ -58,7 +58,7 @@ class QLineEdit; class QAbstractSpinBoxPrivate; class QStyleOptionSpinBox; -class Q_GUI_EXPORT QAbstractSpinBox : public QWidget +class Q_WIDGETS_EXPORT QAbstractSpinBox : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h similarity index 98% rename from src/gui/widgets/qabstractspinbox_p.h rename to src/widgets/widgets/qabstractspinbox_p.h index b25fe258965..33d4e328758 100644 --- a/src/gui/widgets/qabstractspinbox_p.h +++ b/src/widgets/widgets/qabstractspinbox_p.h @@ -53,12 +53,12 @@ // We mean it. // -#include "QtGui/qabstractspinbox.h" +#include "QtWidgets/qabstractspinbox.h" #ifndef QT_NO_SPINBOX -#include "QtGui/qlineedit.h" -#include "QtGui/qstyleoption.h" +#include "QtWidgets/qlineedit.h" +#include "QtWidgets/qstyleoption.h" #include "QtGui/qvalidator.h" #include "QtCore/qdatetime.h" #include "QtCore/qvariant.h" diff --git a/src/gui/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp similarity index 100% rename from src/gui/widgets/qbuttongroup.cpp rename to src/widgets/widgets/qbuttongroup.cpp diff --git a/src/gui/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h similarity index 98% rename from src/gui/widgets/qbuttongroup.h rename to src/widgets/widgets/qbuttongroup.h index a0472fd2db0..e3ef34644ea 100644 --- a/src/gui/widgets/qbuttongroup.h +++ b/src/widgets/widgets/qbuttongroup.h @@ -56,7 +56,7 @@ class QAbstractButton; class QAbstractButtonPrivate; class QButtonGroupPrivate; -class Q_GUI_EXPORT QButtonGroup : public QObject +class Q_WIDGETS_EXPORT QButtonGroup : public QObject { Q_OBJECT diff --git a/src/gui/widgets/qcalendartextnavigator_p.h b/src/widgets/widgets/qcalendartextnavigator_p.h similarity index 100% rename from src/gui/widgets/qcalendartextnavigator_p.h rename to src/widgets/widgets/qcalendartextnavigator_p.h diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp similarity index 100% rename from src/gui/widgets/qcalendarwidget.cpp rename to src/widgets/widgets/qcalendarwidget.cpp diff --git a/src/gui/widgets/qcalendarwidget.h b/src/widgets/widgets/qcalendarwidget.h similarity index 98% rename from src/gui/widgets/qcalendarwidget.h rename to src/widgets/widgets/qcalendarwidget.h index d6bf8b20dac..a80bae2f49d 100644 --- a/src/gui/widgets/qcalendarwidget.h +++ b/src/widgets/widgets/qcalendarwidget.h @@ -42,7 +42,7 @@ #ifndef QCALENDARWIDGET_H #define QCALENDARWIDGET_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> #include <QtCore/qdatetime.h> QT_BEGIN_HEADER @@ -57,7 +57,7 @@ class QDate; class QTextCharFormat; class QCalendarWidgetPrivate; -class Q_GUI_EXPORT QCalendarWidget : public QWidget +class Q_WIDGETS_EXPORT QCalendarWidget : public QWidget { Q_OBJECT Q_ENUMS(Qt::DayOfWeek) diff --git a/src/gui/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp similarity index 100% rename from src/gui/widgets/qcheckbox.cpp rename to src/widgets/widgets/qcheckbox.cpp diff --git a/src/gui/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h similarity index 97% rename from src/gui/widgets/qcheckbox.h rename to src/widgets/widgets/qcheckbox.h index 263fa4a1529..b040b13be11 100644 --- a/src/gui/widgets/qcheckbox.h +++ b/src/widgets/widgets/qcheckbox.h @@ -42,7 +42,7 @@ #ifndef QCHECKBOX_H #define QCHECKBOX_H -#include <QtGui/qabstractbutton.h> +#include <QtWidgets/qabstractbutton.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) class QCheckBoxPrivate; class QStyleOptionButton; -class Q_GUI_EXPORT QCheckBox : public QAbstractButton +class Q_WIDGETS_EXPORT QCheckBox : public QAbstractButton { Q_OBJECT diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac.mm b/src/widgets/widgets/qcocoatoolbardelegate_mac.mm similarity index 100% rename from src/gui/widgets/qcocoatoolbardelegate_mac.mm rename to src/widgets/widgets/qcocoatoolbardelegate_mac.mm diff --git a/src/gui/widgets/qcocoatoolbardelegate_mac_p.h b/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h similarity index 100% rename from src/gui/widgets/qcocoatoolbardelegate_mac_p.h rename to src/widgets/widgets/qcocoatoolbardelegate_mac_p.h diff --git a/src/gui/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp similarity index 100% rename from src/gui/widgets/qcombobox.cpp rename to src/widgets/widgets/qcombobox.cpp diff --git a/src/gui/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h similarity index 99% rename from src/gui/widgets/qcombobox.h rename to src/widgets/widgets/qcombobox.h index 9cbf48330b2..ed766cc0049 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -42,8 +42,8 @@ #ifndef QCOMBOBOX_H #define QCOMBOBOX_H -#include <QtGui/qwidget.h> -#include <QtGui/qabstractitemdelegate.h> +#include <QtWidgets/qwidget.h> +#include <QtWidgets/qabstractitemdelegate.h> #include <QtCore/qabstractitemmodel.h> #include <QtCore/qvariant.h> @@ -59,7 +59,7 @@ class QLineEdit; class QComboBoxPrivate; class QCompleter; -class Q_GUI_EXPORT QComboBox : public QWidget +class Q_WIDGETS_EXPORT QComboBox : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h similarity index 97% rename from src/gui/widgets/qcombobox_p.h rename to src/widgets/widgets/qcombobox_p.h index a17f9d95745..2d3f261d6ef 100644 --- a/src/gui/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -53,24 +53,24 @@ // We mean it. // -#include "QtGui/qcombobox.h" +#include "QtWidgets/qcombobox.h" #ifndef QT_NO_COMBOBOX -#include "QtGui/qabstractslider.h" -#include "QtGui/qapplication.h" -#include "QtGui/qitemdelegate.h" -#include "QtGui/qstandarditemmodel.h" -#include "QtGui/qlineedit.h" -#include "QtGui/qlistview.h" +#include "QtWidgets/qabstractslider.h" +#include "QtWidgets/qapplication.h" +#include "QtWidgets/qitemdelegate.h" +#include "QtWidgets/qstandarditemmodel.h" +#include "QtWidgets/qlineedit.h" +#include "QtWidgets/qlistview.h" #include "QtGui/qpainter.h" -#include "QtGui/qstyle.h" -#include "QtGui/qstyleoption.h" +#include "QtWidgets/qstyle.h" +#include "QtWidgets/qstyleoption.h" #include "QtCore/qhash.h" #include "QtCore/qpair.h" #include "QtCore/qtimer.h" #include "private/qwidget_p.h" #include "QtCore/qpointer.h" -#include "QtGui/qcompleter.h" +#include "QtWidgets/qcompleter.h" #include "QtGui/qevent.h" #include "QtCore/qdebug.h" diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/widgets/widgets/qcommandlinkbutton.cpp similarity index 100% rename from src/gui/widgets/qcommandlinkbutton.cpp rename to src/widgets/widgets/qcommandlinkbutton.cpp diff --git a/src/gui/widgets/qcommandlinkbutton.h b/src/widgets/widgets/qcommandlinkbutton.h similarity index 96% rename from src/gui/widgets/qcommandlinkbutton.h rename to src/widgets/widgets/qcommandlinkbutton.h index c502d96da0c..9d01e37b1bc 100644 --- a/src/gui/widgets/qcommandlinkbutton.h +++ b/src/widgets/widgets/qcommandlinkbutton.h @@ -42,7 +42,7 @@ #ifndef QCOMMANDLINKBUTTON_H #define QCOMMANDLINKBUTTON_H -#include <QtGui/qpushbutton.h> +#include <QtWidgets/qpushbutton.h> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_MODULE(Gui) class QCommandLinkButtonPrivate; -class Q_GUI_EXPORT QCommandLinkButton: public QPushButton +class Q_WIDGETS_EXPORT QCommandLinkButton: public QPushButton { Q_OBJECT diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp similarity index 100% rename from src/gui/widgets/qdatetimeedit.cpp rename to src/widgets/widgets/qdatetimeedit.cpp diff --git a/src/gui/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h similarity index 97% rename from src/gui/widgets/qdatetimeedit.h rename to src/widgets/widgets/qdatetimeedit.h index cd88dbfd128..a57a5f29e90 100644 --- a/src/gui/widgets/qdatetimeedit.h +++ b/src/widgets/widgets/qdatetimeedit.h @@ -44,7 +44,7 @@ #include <QtCore/qdatetime.h> #include <QtCore/qvariant.h> -#include <QtGui/qabstractspinbox.h> +#include <QtWidgets/qabstractspinbox.h> QT_BEGIN_HEADER @@ -58,7 +58,7 @@ class QDateTimeEditPrivate; class QStyleOptionSpinBox; class QCalendarWidget; -class Q_GUI_EXPORT QDateTimeEdit : public QAbstractSpinBox +class Q_WIDGETS_EXPORT QDateTimeEdit : public QAbstractSpinBox { Q_OBJECT @@ -203,7 +203,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_resetButton()) }; -class Q_GUI_EXPORT QTimeEdit : public QDateTimeEdit +class Q_WIDGETS_EXPORT QTimeEdit : public QDateTimeEdit { Q_OBJECT public: @@ -211,7 +211,7 @@ public: QTimeEdit(const QTime &time, QWidget *parent = 0); }; -class Q_GUI_EXPORT QDateEdit : public QDateTimeEdit +class Q_WIDGETS_EXPORT QDateEdit : public QDateTimeEdit { Q_OBJECT public: diff --git a/src/gui/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h similarity index 95% rename from src/gui/widgets/qdatetimeedit_p.h rename to src/widgets/widgets/qdatetimeedit_p.h index 3c6ca962abb..57799d5bc09 100644 --- a/src/gui/widgets/qdatetimeedit_p.h +++ b/src/widgets/widgets/qdatetimeedit_p.h @@ -53,15 +53,15 @@ // We mean it. // -#include "QtGui/qcombobox.h" -#include "QtGui/qcalendarwidget.h" -#include "QtGui/qspinbox.h" -#include "QtGui/qtoolbutton.h" -#include "QtGui/qmenu.h" -#include "QtGui/qlabel.h" -#include "QtGui/qdatetimeedit.h" -#include "QtGui/private/qabstractspinbox_p.h" -#include "QtCore/private/qdatetime_p.h" +#include "QtWidgets/qcombobox.h" +#include "QtWidgets/qcalendarwidget.h" +#include "QtWidgets/qspinbox.h" +#include "QtWidgets/qtoolbutton.h" +#include "QtWidgets/qmenu.h" +#include "QtWidgets/qlabel.h" +#include "QtWidgets/qdatetimeedit.h" +#include "private/qabstractspinbox_p.h" +#include "private/qdatetime_p.h" #include "qdebug.h" diff --git a/src/gui/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp similarity index 100% rename from src/gui/widgets/qdial.cpp rename to src/widgets/widgets/qdial.cpp diff --git a/src/gui/widgets/qdial.h b/src/widgets/widgets/qdial.h similarity index 97% rename from src/gui/widgets/qdial.h rename to src/widgets/widgets/qdial.h index 89de72467bf..7687b7e7a15 100644 --- a/src/gui/widgets/qdial.h +++ b/src/widgets/widgets/qdial.h @@ -43,7 +43,7 @@ #ifndef QDIAL_H #define QDIAL_H -#include <QtGui/qabstractslider.h> +#include <QtWidgets/qabstractslider.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QDialPrivate; class QStyleOptionSlider; -class Q_GUI_EXPORT QDial: public QAbstractSlider +class Q_WIDGETS_EXPORT QDial: public QAbstractSlider { Q_OBJECT diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp similarity index 99% rename from src/gui/widgets/qdialogbuttonbox.cpp rename to src/widgets/widgets/qdialogbuttonbox.cpp index 6c29141d664..64fd3caa1e1 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -40,18 +40,18 @@ ****************************************************************************/ #include <QtCore/qhash.h> -#include <QtGui/qpushbutton.h> -#include <QtGui/qstyle.h> -#include <QtGui/qlayout.h> -#include <QtGui/qdialog.h> -#include <QtGui/qapplication.h> -#include <QtGui/private/qwidget_p.h> -#include <QtGui/qaction.h> +#include <QtWidgets/qpushbutton.h> +#include <QtWidgets/qstyle.h> +#include <QtWidgets/qlayout.h> +#include <QtWidgets/qdialog.h> +#include <QtWidgets/qapplication.h> +#include <private/qwidget_p.h> +#include <QtWidgets/qaction.h> #include "qdialogbuttonbox.h" #ifdef QT_SOFTKEYS_ENABLED -#include <QtGui/qaction.h> +#include <QtWidgets/qaction.h> #endif diff --git a/src/gui/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h similarity index 98% rename from src/gui/widgets/qdialogbuttonbox.h rename to src/widgets/widgets/qdialogbuttonbox.h index 3b022e92ee3..0a6e231e3f1 100644 --- a/src/gui/widgets/qdialogbuttonbox.h +++ b/src/widgets/widgets/qdialogbuttonbox.h @@ -42,7 +42,7 @@ #ifndef QDIALOGBUTTONBOX_H #define QDIALOGBUTTONBOX_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ class QAbstractButton; class QPushButton; class QDialogButtonBoxPrivate; -class Q_GUI_EXPORT QDialogButtonBox : public QWidget +class Q_WIDGETS_EXPORT QDialogButtonBox : public QWidget { Q_OBJECT Q_FLAGS(StandardButtons) diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp similarity index 99% rename from src/gui/widgets/qdockarealayout.cpp rename to src/widgets/widgets/qdockarealayout.cpp index 83506e50124..aa627ef4f86 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "QtGui/qapplication.h" -#include "QtGui/qwidget.h" -#include "QtGui/qtabbar.h" -#include "QtGui/qstyle.h" -#include "QtGui/qdesktopwidget.h" +#include "QtWidgets/qapplication.h" +#include "QtWidgets/qwidget.h" +#include "QtWidgets/qtabbar.h" +#include "QtWidgets/qstyle.h" +#include "QtWidgets/qdesktopwidget.h" #include "QtCore/qvariant.h" #include "qdockarealayout_p.h" #include "qdockwidget.h" diff --git a/src/gui/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h similarity index 99% rename from src/gui/widgets/qdockarealayout_p.h rename to src/widgets/widgets/qdockarealayout_p.h index e253eb60cef..a341ad487b1 100644 --- a/src/gui/widgets/qdockarealayout_p.h +++ b/src/widgets/widgets/qdockarealayout_p.h @@ -57,7 +57,7 @@ #include "QtCore/qpair.h" #include "QtCore/qlist.h" #include "QtCore/qvector.h" -#include "QtGui/qlayout.h" +#include "QtWidgets/qlayout.h" #ifndef QT_NO_DOCKWIDGET diff --git a/src/gui/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp similarity index 99% rename from src/gui/widgets/qdockwidget.cpp rename to src/widgets/widgets/qdockwidget.cpp index 6e376830200..53e007aea50 100644 --- a/src/gui/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -854,7 +854,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event) && (event->pos() - state->pressPos).manhattanLength() > QApplication::startDragDistance()) { startDrag(); -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN grabMouseWhileInWindow(); #else q->grabMouse(); @@ -925,7 +925,7 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event) initDrag(event->pos(), true); if (state == 0) break; -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN // On Windows, NCA mouse events don't contain modifier info state->ctrlDrag = GetKeyState(VK_CONTROL) & 0x8000; #else @@ -1433,7 +1433,7 @@ bool QDockWidget::event(QEvent *event) if (d->mouseMoveEvent(static_cast<QMouseEvent *>(event))) return true; break; -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN case QEvent::Leave: if (d->state != 0 && d->state->dragging && !d->state->nca) { // This is a workaround for loosing the mouse on Vista. diff --git a/src/gui/widgets/qdockwidget.h b/src/widgets/widgets/qdockwidget.h similarity index 98% rename from src/gui/widgets/qdockwidget.h rename to src/widgets/widgets/qdockwidget.h index 58b9f1968b6..cc81db2fc21 100644 --- a/src/gui/widgets/qdockwidget.h +++ b/src/widgets/widgets/qdockwidget.h @@ -42,7 +42,7 @@ #ifndef QDYNAMICDOCKWIDGET_H #define QDYNAMICDOCKWIDGET_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -57,7 +57,7 @@ class QDockWidgetPrivate; class QMainWindow; class QStyleOptionDockWidget; -class Q_GUI_EXPORT QDockWidget : public QWidget +class Q_WIDGETS_EXPORT QDockWidget : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h similarity index 97% rename from src/gui/widgets/qdockwidget_p.h rename to src/widgets/widgets/qdockwidget_p.h index 699c7dd2ebe..4d3c4f4d70d 100644 --- a/src/gui/widgets/qdockwidget_p.h +++ b/src/widgets/widgets/qdockwidget_p.h @@ -53,10 +53,10 @@ // We mean it. // -#include "QtGui/qstyleoption.h" +#include "QtWidgets/qstyleoption.h" #include "private/qwidget_p.h" -#include "QtGui/qboxlayout.h" -#include "QtGui/qdockwidget.h" +#include "QtWidgets/qboxlayout.h" +#include "QtWidgets/qdockwidget.h" #ifndef QT_NO_DOCKWIDGET @@ -128,7 +128,7 @@ public: bool isAnimating() const; }; -class Q_GUI_EXPORT QDockWidgetLayout : public QLayout +class Q_WIDGETS_EXPORT QDockWidgetLayout : public QLayout { Q_OBJECT public: diff --git a/src/gui/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp similarity index 100% rename from src/gui/widgets/qeffects.cpp rename to src/widgets/widgets/qeffects.cpp diff --git a/src/gui/widgets/qeffects_p.h b/src/widgets/widgets/qeffects_p.h similarity index 92% rename from src/gui/widgets/qeffects_p.h rename to src/widgets/widgets/qeffects_p.h index 4290fd16ad6..bae2bbf54a3 100644 --- a/src/gui/widgets/qeffects_p.h +++ b/src/widgets/widgets/qeffects_p.h @@ -74,8 +74,8 @@ struct QEffects typedef uint DirFlags; }; -extern void Q_GUI_EXPORT qScrollEffect(QWidget*, QEffects::DirFlags dir = QEffects::DownScroll, int time = -1); -extern void Q_GUI_EXPORT qFadeEffect(QWidget*, int time = -1); +extern void Q_WIDGETS_EXPORT qScrollEffect(QWidget*, QEffects::DirFlags dir = QEffects::DownScroll, int time = -1); +extern void Q_WIDGETS_EXPORT qFadeEffect(QWidget*, int time = -1); QT_END_NAMESPACE diff --git a/src/gui/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp similarity index 100% rename from src/gui/widgets/qfocusframe.cpp rename to src/widgets/widgets/qfocusframe.cpp diff --git a/src/gui/widgets/qfocusframe.h b/src/widgets/widgets/qfocusframe.h similarity index 96% rename from src/gui/widgets/qfocusframe.h rename to src/widgets/widgets/qfocusframe.h index 23ea79fe5d0..f4f1d1c854a 100644 --- a/src/gui/widgets/qfocusframe.h +++ b/src/widgets/widgets/qfocusframe.h @@ -42,7 +42,7 @@ #ifndef QFOCUSFRAME_H #define QFOCUSFRAME_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) class QFocusFramePrivate; class QStyleOption; -class Q_GUI_EXPORT QFocusFrame : public QWidget +class Q_WIDGETS_EXPORT QFocusFrame : public QWidget { Q_OBJECT public: diff --git a/src/gui/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp similarity index 100% rename from src/gui/widgets/qfontcombobox.cpp rename to src/widgets/widgets/qfontcombobox.cpp diff --git a/src/gui/widgets/qfontcombobox.h b/src/widgets/widgets/qfontcombobox.h similarity index 97% rename from src/gui/widgets/qfontcombobox.h rename to src/widgets/widgets/qfontcombobox.h index e554c7f13ea..b0007207da1 100644 --- a/src/gui/widgets/qfontcombobox.h +++ b/src/widgets/widgets/qfontcombobox.h @@ -42,7 +42,7 @@ #ifndef QFONTCOMBOBOX_H #define QFONTCOMBOBOX_H -#include <QtGui/qcombobox.h> +#include <QtWidgets/qcombobox.h> #include <QtGui/qfontdatabase.h> #ifndef QT_NO_FONTCOMBOBOX @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QFontComboBoxPrivate; -class Q_GUI_EXPORT QFontComboBox : public QComboBox +class Q_WIDGETS_EXPORT QFontComboBox : public QComboBox { Q_OBJECT Q_FLAGS(FontFilters) diff --git a/src/gui/widgets/qframe.cpp b/src/widgets/widgets/qframe.cpp similarity index 100% rename from src/gui/widgets/qframe.cpp rename to src/widgets/widgets/qframe.cpp diff --git a/src/gui/widgets/qframe.h b/src/widgets/widgets/qframe.h similarity index 98% rename from src/gui/widgets/qframe.h rename to src/widgets/widgets/qframe.h index e35cbce0d37..80d41365cda 100644 --- a/src/gui/widgets/qframe.h +++ b/src/widgets/widgets/qframe.h @@ -42,7 +42,7 @@ #ifndef QFRAME_H #define QFRAME_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_MODULE(Gui) class QFramePrivate; -class Q_GUI_EXPORT QFrame : public QWidget +class Q_WIDGETS_EXPORT QFrame : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qframe_p.h b/src/widgets/widgets/qframe_p.h similarity index 100% rename from src/gui/widgets/qframe_p.h rename to src/widgets/widgets/qframe_p.h diff --git a/src/gui/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp similarity index 100% rename from src/gui/widgets/qgroupbox.cpp rename to src/widgets/widgets/qgroupbox.cpp diff --git a/src/gui/widgets/qgroupbox.h b/src/widgets/widgets/qgroupbox.h similarity index 97% rename from src/gui/widgets/qgroupbox.h rename to src/widgets/widgets/qgroupbox.h index 311f233cc5a..fba094d303c 100644 --- a/src/gui/widgets/qgroupbox.h +++ b/src/widgets/widgets/qgroupbox.h @@ -42,7 +42,7 @@ #ifndef QGROUPBOX_H #define QGROUPBOX_H -#include <QtGui/qframe.h> +#include <QtWidgets/qframe.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QGroupBoxPrivate; class QStyleOptionGroupBox; -class Q_GUI_EXPORT QGroupBox : public QWidget +class Q_WIDGETS_EXPORT QGroupBox : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp similarity index 99% rename from src/gui/widgets/qlabel.cpp rename to src/widgets/widgets/qlabel.cpp index ab88f38bbb9..b122632e440 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -350,7 +350,7 @@ void QLabel::setText(const QString &text) if (d->text == text) return; - QTextControl *oldControl = d->control; + QWidgetTextControl *oldControl = d->control; d->control = 0; d->clearContents(); @@ -1615,7 +1615,7 @@ void QLabelPrivate::ensureTextControl() const if (!isTextLabel) return; if (!control) { - control = new QTextControl(const_cast<QLabel *>(q)); + control = new QWidgetTextControl(const_cast<QLabel *>(q)); control->document()->setUndoRedoEnabled(false); control->document()->setDefaultFont(q->font()); control->setTextInteractionFlags(textInteractionFlags); diff --git a/src/gui/widgets/qlabel.h b/src/widgets/widgets/qlabel.h similarity index 98% rename from src/gui/widgets/qlabel.h rename to src/widgets/widgets/qlabel.h index f1971eb3fe2..d8fc2972999 100644 --- a/src/gui/widgets/qlabel.h +++ b/src/widgets/widgets/qlabel.h @@ -42,7 +42,7 @@ #ifndef QLABEL_H #define QLABEL_H -#include <QtGui/qframe.h> +#include <QtWidgets/qframe.h> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_MODULE(Gui) class QLabelPrivate; -class Q_GUI_EXPORT QLabel : public QFrame +class Q_WIDGETS_EXPORT QLabel : public QFrame { Q_OBJECT Q_PROPERTY(QString text READ text WRITE setText) diff --git a/src/gui/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h similarity index 98% rename from src/gui/widgets/qlabel_p.h rename to src/widgets/widgets/qlabel_p.h index 000fcd2fece..b6f2db6a25b 100644 --- a/src/gui/widgets/qlabel_p.h +++ b/src/widgets/widgets/qlabel_p.h @@ -56,7 +56,7 @@ #include "qlabel.h" #include "private/qtextdocumentlayout_p.h" -#include "private/qtextcontrol_p.h" +#include "private/qwidgettextcontrol_p.h" #include "qtextdocumentfragment.h" #include "qframe_p.h" #include "qtextdocument.h" @@ -112,7 +112,7 @@ public: mutable uint isTextLabel : 1; mutable uint hasShortcut : 1; Qt::TextFormat textformat; - mutable QTextControl *control; + mutable QWidgetTextControl *control; mutable QTextCursor shortcutCursor; Qt::TextInteractionFlags textInteractionFlags; diff --git a/src/gui/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp similarity index 100% rename from src/gui/widgets/qlcdnumber.cpp rename to src/widgets/widgets/qlcdnumber.cpp diff --git a/src/gui/widgets/qlcdnumber.h b/src/widgets/widgets/qlcdnumber.h similarity index 97% rename from src/gui/widgets/qlcdnumber.h rename to src/widgets/widgets/qlcdnumber.h index 9d530943c2a..7b104cbfcfa 100644 --- a/src/gui/widgets/qlcdnumber.h +++ b/src/widgets/widgets/qlcdnumber.h @@ -42,7 +42,7 @@ #ifndef QLCDNUMBER_H #define QLCDNUMBER_H -#include <QtGui/qframe.h> +#include <QtWidgets/qframe.h> #include <QtCore/qbitarray.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) #ifndef QT_NO_LCDNUMBER class QLCDNumberPrivate; -class Q_GUI_EXPORT QLCDNumber : public QFrame // LCD number widget +class Q_WIDGETS_EXPORT QLCDNumber : public QFrame // LCD number widget { Q_OBJECT Q_ENUMS(Mode SegmentStyle) diff --git a/src/gui/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp similarity index 99% rename from src/gui/widgets/qlineedit.cpp rename to src/widgets/widgets/qlineedit.cpp index 8a93c286acd..aca15f30ed5 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -85,6 +85,9 @@ #endif #include <limits.h> +#ifdef DrawText +#undef DrawText +#endif QT_BEGIN_NAMESPACE @@ -1754,7 +1757,7 @@ QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const { Q_D(const QLineEdit); switch(property) { - case Qt::ImMicroFocus: + case Qt::ImCursorRectangle: return d->cursorRect(); case Qt::ImFont: return font(); @@ -1976,13 +1979,13 @@ void QLineEdit::paintEvent(QPaintEvent *) #endif p.setPen(pal.text().color()); - int flags = QLineControl::DrawText; + int flags = QWidgetLineControl::DrawText; #ifdef QT_KEYPAD_NAVIGATION if (!QApplication::keypadNavigationEnabled() || hasEditFocus()) #endif if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())){ - flags |= QLineControl::DrawSelections; + flags |= QWidgetLineControl::DrawSelections; // Palette only used for selections/mask and may not be in sync if (d->control->palette() != pal || d->control->palette().currentColorGroup() != pal.currentColorGroup()) @@ -1993,7 +1996,7 @@ void QLineEdit::paintEvent(QPaintEvent *) // selection phase of input method, so the ordinary cursor should be // invisible if we have a preedit string. if (d->cursorVisible && !d->control->isReadOnly()) - flags |= QLineControl::DrawCursor; + flags |= QWidgetLineControl::DrawCursor; d->control->setCursorWidth(style()->pixelMetric(QStyle::PM_TextCursorWidth)); d->control->draw(&p, topLeft, r, flags); diff --git a/src/gui/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h similarity index 99% rename from src/gui/widgets/qlineedit.h rename to src/widgets/widgets/qlineedit.h index 73d228907f2..b0971db968c 100644 --- a/src/gui/widgets/qlineedit.h +++ b/src/widgets/widgets/qlineedit.h @@ -42,7 +42,7 @@ #ifndef QLINEEDIT_H #define QLINEEDIT_H -#include <QtGui/qframe.h> +#include <QtWidgets/qframe.h> #include <QtGui/qtextcursor.h> #include <QtCore/qstring.h> #include <QtCore/qmargins.h> @@ -63,7 +63,7 @@ class QStyleOptionFrame; class QAbstractSpinBox; class QDateTimeEdit; -class Q_GUI_EXPORT QLineEdit : public QWidget +class Q_WIDGETS_EXPORT QLineEdit : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp similarity index 99% rename from src/gui/widgets/qlineedit_p.cpp rename to src/widgets/widgets/qlineedit_p.cpp index 090c0b6641f..8511d0c9e55 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -45,6 +45,7 @@ #ifndef QT_NO_LINEEDIT #include "qabstractitemview.h" +#include "qdrag.h" #include "qclipboard.h" #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" @@ -152,7 +153,7 @@ void QLineEditPrivate::_q_updateNeeded(const QRect &rect) void QLineEditPrivate::init(const QString& txt) { Q_Q(QLineEdit); - control = new QLineControl(txt); + control = new QWidgetLineControl(txt); control->setParent(q); control->setFont(q->font()); QObject::connect(control, SIGNAL(textChanged(QString)), diff --git a/src/gui/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h similarity index 95% rename from src/gui/widgets/qlineedit_p.h rename to src/widgets/widgets/qlineedit_p.h index f396af69a7a..74717fd2fa1 100644 --- a/src/gui/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -57,15 +57,15 @@ #ifndef QT_NO_LINEEDIT #include "private/qwidget_p.h" -#include "QtGui/qlineedit.h" +#include "QtWidgets/qlineedit.h" #include "QtGui/qtextlayout.h" -#include "QtGui/qstyleoption.h" +#include "QtWidgets/qstyleoption.h" #include "QtCore/qbasictimer.h" -#include "QtGui/qcompleter.h" +#include "QtWidgets/qcompleter.h" #include "QtCore/qpointer.h" -#include "QtGui/qlineedit.h" +#include "QtWidgets/qlineedit.h" -#include "private/qlinecontrol_p.h" +#include "private/qwidgetlinecontrol_p.h" QT_BEGIN_NAMESPACE @@ -86,7 +86,7 @@ public: { } - QLineControl *control; + QWidgetLineControl *control; #ifndef QT_NO_CONTEXTMENU QPointer<QAction> selectAllAction; diff --git a/src/gui/widgets/qmaccocoaviewcontainer_mac.h b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h similarity index 95% rename from src/gui/widgets/qmaccocoaviewcontainer_mac.h rename to src/widgets/widgets/qmaccocoaviewcontainer_mac.h index b56dda46c67..48eac4f490d 100644 --- a/src/gui/widgets/qmaccocoaviewcontainer_mac.h +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h @@ -42,7 +42,7 @@ #ifndef QCOCOAVIEWCONTAINER_H #define QCOCOAVIEWCONTAINER_H -#include <QtGui/QWidget> +#include <QtWidgets/QWidget> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_MODULE(Gui) class QMacCocoaViewContainerPrivate; -class Q_GUI_EXPORT QMacCocoaViewContainer : public QWidget +class Q_WIDGETS_EXPORT QMacCocoaViewContainer : public QWidget { Q_OBJECT public: diff --git a/src/gui/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm similarity index 100% rename from src/gui/widgets/qmaccocoaviewcontainer_mac.mm rename to src/widgets/widgets/qmaccocoaviewcontainer_mac.mm diff --git a/src/gui/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h similarity index 96% rename from src/gui/widgets/qmacnativewidget_mac.h rename to src/widgets/widgets/qmacnativewidget_mac.h index 884ee19e326..935feac58ec 100644 --- a/src/gui/widgets/qmacnativewidget_mac.h +++ b/src/widgets/widgets/qmacnativewidget_mac.h @@ -42,7 +42,7 @@ #ifndef QMACNATIVEWIDGET_H #define QMACNATIVEWIDGET_H -#include <QtGui/QWidget> +#include <QtWidgets/QWidget> QT_BEGIN_HEADER @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QMacNativeWidgetPrivate; -class Q_GUI_EXPORT QMacNativeWidget : public QWidget +class Q_WIDGETS_EXPORT QMacNativeWidget : public QWidget { Q_OBJECT public: diff --git a/src/gui/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm similarity index 100% rename from src/gui/widgets/qmacnativewidget_mac.mm rename to src/widgets/widgets/qmacnativewidget_mac.mm diff --git a/src/gui/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp similarity index 99% rename from src/gui/widgets/qmainwindow.cpp rename to src/widgets/widgets/qmainwindow.cpp index f214bcb1a5b..b3bd9724978 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -116,7 +116,7 @@ QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *mainWindow) } #ifdef QT_EXPERIMENTAL_CLIENT_DECORATIONS -Q_GUI_EXPORT void qt_setMainWindowTitleWidget(QMainWindow *mainWindow, Qt::DockWidgetArea area, QWidget *widget) +Q_WIDGETS_EXPORT void qt_setMainWindowTitleWidget(QMainWindow *mainWindow, Qt::DockWidgetArea area, QWidget *widget) { QGridLayout *topLayout = qobject_cast<QGridLayout *>(mainWindow->layout()); Q_ASSERT(topLayout); diff --git a/src/gui/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h similarity index 98% rename from src/gui/widgets/qmainwindow.h rename to src/widgets/widgets/qmainwindow.h index 11fb57e3f7c..f060d3f460e 100644 --- a/src/gui/widgets/qmainwindow.h +++ b/src/widgets/widgets/qmainwindow.h @@ -42,8 +42,8 @@ #ifndef QDYNAMICMAINWINDOW_H #define QDYNAMICMAINWINDOW_H -#include <QtGui/qwidget.h> -#include <QtGui/qtabwidget.h> +#include <QtWidgets/qwidget.h> +#include <QtWidgets/qtabwidget.h> QT_BEGIN_HEADER @@ -60,7 +60,7 @@ class QStatusBar; class QToolBar; class QMenu; -class Q_GUI_EXPORT QMainWindow : public QWidget +class Q_WIDGETS_EXPORT QMainWindow : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp similarity index 100% rename from src/gui/widgets/qmainwindowlayout.cpp rename to src/widgets/widgets/qmainwindowlayout.cpp diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/widgets/widgets/qmainwindowlayout_mac.mm similarity index 100% rename from src/gui/widgets/qmainwindowlayout_mac.mm rename to src/widgets/widgets/qmainwindowlayout_mac.mm diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h similarity index 98% rename from src/gui/widgets/qmainwindowlayout_p.h rename to src/widgets/widgets/qmainwindowlayout_p.h index 439d87d6cea..f8116096c7b 100644 --- a/src/gui/widgets/qmainwindowlayout_p.h +++ b/src/widgets/widgets/qmainwindowlayout_p.h @@ -57,8 +57,8 @@ #ifndef QT_NO_MAINWINDOW -#include "QtGui/qlayout.h" -#include "QtGui/qtabbar.h" +#include "QtWidgets/qlayout.h" +#include "QtWidgets/qtabbar.h" #include "QtCore/qvector.h" #include "QtCore/qset.h" #include "QtCore/qbasictimer.h" @@ -73,7 +73,7 @@ #if defined(Q_DEBUG_MAINWINDOW_LAYOUT) && !defined(QT_NO_DOCKWIDGET) QT_BEGIN_NAMESPACE class QTextStream; -Q_GUI_EXPORT void qt_dumpLayout(QTextStream &qout, QMainWindow *window); +Q_WIDGETS_EXPORT void qt_dumpLayout(QTextStream &qout, QMainWindow *window); QT_END_NAMESPACE #endif // Q_DEBUG_MAINWINDOW_LAYOUT && !QT_NO_DOCKWIDGET diff --git a/src/gui/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp similarity index 100% rename from src/gui/widgets/qmdiarea.cpp rename to src/widgets/widgets/qmdiarea.cpp diff --git a/src/gui/widgets/qmdiarea.h b/src/widgets/widgets/qmdiarea.h similarity index 97% rename from src/gui/widgets/qmdiarea.h rename to src/widgets/widgets/qmdiarea.h index 48c1c7ba34c..f1ffb29e535 100644 --- a/src/gui/widgets/qmdiarea.h +++ b/src/widgets/widgets/qmdiarea.h @@ -42,8 +42,8 @@ #ifndef QMDIAREA_H #define QMDIAREA_H -#include <QtGui/qabstractscrollarea.h> -#include <QtGui/qtabwidget.h> +#include <QtWidgets/qabstractscrollarea.h> +#include <QtWidgets/qtabwidget.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QMdiSubWindow; class QMdiAreaPrivate; -class Q_GUI_EXPORT QMdiArea : public QAbstractScrollArea +class Q_WIDGETS_EXPORT QMdiArea : public QAbstractScrollArea { Q_OBJECT Q_ENUMS(ViewMode) diff --git a/src/gui/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h similarity index 99% rename from src/gui/widgets/qmdiarea_p.h rename to src/widgets/widgets/qmdiarea_p.h index fe368f2b370..18a022d7dd0 100644 --- a/src/gui/widgets/qmdiarea_p.h +++ b/src/widgets/widgets/qmdiarea_p.h @@ -61,7 +61,7 @@ #include <QList> #include <QRect> #include <QPoint> -#include <QtGui/qapplication.h> +#include <QtWidgets/qapplication.h> #include <private/qmdisubwindow_p.h> #include <private/qabstractscrollarea_p.h> diff --git a/src/gui/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp similarity index 100% rename from src/gui/widgets/qmdisubwindow.cpp rename to src/widgets/widgets/qmdisubwindow.cpp diff --git a/src/gui/widgets/qmdisubwindow.h b/src/widgets/widgets/qmdisubwindow.h similarity index 98% rename from src/gui/widgets/qmdisubwindow.h rename to src/widgets/widgets/qmdisubwindow.h index 530ca4b740d..88074c7ca59 100644 --- a/src/gui/widgets/qmdisubwindow.h +++ b/src/widgets/widgets/qmdisubwindow.h @@ -42,7 +42,7 @@ #ifndef QMDISUBWINDOW_H #define QMDISUBWINDOW_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -57,7 +57,7 @@ class QMdiArea; namespace QMdi { class ControlContainer; } class QMdiSubWindowPrivate; -class Q_GUI_EXPORT QMdiSubWindow : public QWidget +class Q_WIDGETS_EXPORT QMdiSubWindow : public QWidget { Q_OBJECT Q_PROPERTY(int keyboardSingleStep READ keyboardSingleStep WRITE setKeyboardSingleStep) diff --git a/src/gui/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h similarity index 100% rename from src/gui/widgets/qmdisubwindow_p.h rename to src/widgets/widgets/qmdisubwindow_p.h diff --git a/src/gui/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp similarity index 90% rename from src/gui/widgets/qmenu.cpp rename to src/widgets/widgets/qmenu.cpp index 932b14f6e7b..67dbd7e2658 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -69,15 +69,12 @@ #include <private/qpushbutton_p.h> #include <private/qaction_p.h> #include <private/qsoftkeymanager_p.h> -#ifdef QT3_SUPPORT -#include <qmenudata.h> -#endif // QT3_SUPPORT #ifdef Q_WS_X11 # include <private/qt_x11_p.h> #endif -#if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) +#if defined(Q_OS_MAC) && !defined(QT_NO_EFFECTS) # include <private/qcore_mac_p.h> # include <private/qt_cocoa_helpers_mac_p.h> #endif @@ -164,6 +161,8 @@ void QMenuPrivate::init() scroll->scrollFlags = QMenuPrivate::QMenuScroller::ScrollNone; } + platformMenu = QGuiApplicationPrivate::platformIntegration()->createPlatformMenu(q); + #ifdef QT_SOFTKEYS_ENABLED selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, q); cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Back, q); @@ -417,7 +416,7 @@ QRect QMenuPrivate::actionRect(QAction *act) const return actionRects.at(index); } -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) static const qreal MenuFadeTimeInSec = 0.150; #endif @@ -576,9 +575,6 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason #ifndef QT_NO_STATUSTIP QAction *previousAction = currentAction; #endif -#ifdef QT3_SUPPORT - emitHighlighted = action; -#endif currentAction = action; if (action) { @@ -994,7 +990,8 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) } if (passOnEvent) { if(e->type() != QEvent::MouseButtonRelease || mouseDown == caused) { - QMouseEvent new_e(e->type(), cpos, e->button(), e->buttons(), e->modifiers()); + QMouseEvent new_e(e->type(), cpos, caused->mapTo(caused->topLevelWidget(), cpos), e->screenPos(), + e->button(), e->buttons(), e->modifiers()); QApplication::sendEvent(caused, &new_e); return true; } @@ -1009,9 +1006,6 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) void QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget> > &causedStack, QAction *action, QAction::ActionEvent action_e, bool self) { QBoolBlocker guard(activationRecursionGuard); -#ifdef QT3_SUPPORT - const int actionId = q_func()->findIdForAction(action); -#endif if(self) action->activate(action_e); @@ -1026,28 +1020,13 @@ void QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget> > &causedSt emit qmenu->triggered(action); } else if (action_e == QAction::Hover) { emit qmenu->hovered(action); -#ifdef QT3_SUPPORT - if (emitHighlighted) { - emit qmenu->highlighted(actionId); - emitHighlighted = false; - } -#endif } #ifndef QT_NO_MENUBAR } else if (QMenuBar *qmenubar = qobject_cast<QMenuBar*>(widget)) { if (action_e == QAction::Trigger) { emit qmenubar->triggered(action); -#ifdef QT3_SUPPORT - emit qmenubar->activated(actionId); -#endif } else if (action_e == QAction::Hover) { emit qmenubar->hovered(action); -#ifdef QT3_SUPPORT - if (emitHighlighted) { - emit qmenubar->highlighted(actionId); - emitHighlighted = false; - } -#endif } break; //nothing more.. #endif @@ -1127,15 +1106,7 @@ void QMenuPrivate::_q_actionTriggered() Q_Q(QMenu); if (QAction *action = qobject_cast<QAction *>(q->sender())) { QWeakPointer<QAction> actionGuard = action; -#ifdef QT3_SUPPORT - //we store it here because the action might be deleted/changed by connected slots - const int id = q->findIdForAction(action); -#endif emit q->triggered(action); -#ifdef QT3_SUPPORT - emit q->activated(id); -#endif - if (!activationRecursionGuard && actionGuard) { //in case the action has not been activated by the mouse //we check the parent hierarchy @@ -1161,17 +1132,7 @@ void QMenuPrivate::_q_actionHovered() { Q_Q(QMenu); if (QAction * action = qobject_cast<QAction *>(q->sender())) { -#ifdef QT3_SUPPORT - //we store it here because the action might be deleted/changed by connected slots - const int id = q->findIdForAction(action); -#endif emit q->hovered(action); -#ifdef QT3_SUPPORT - if (emitHighlighted) { - emit q->highlighted(id); - emitHighlighted = false; - } -#endif } } @@ -2366,10 +2327,8 @@ void QMenu::changeEvent(QEvent *e) if (d->tornPopup) // torn-off menu d->tornPopup->setEnabled(isEnabled()); d->menuAction->setEnabled(isEnabled()); -#ifdef Q_WS_MAC - if (d->mac_menu) - d->setMacMenuEnabled(isEnabled()); -#endif + if (d->platformMenu) + d->platformMenu->setMenuEnabled(isEnabled()); } QWidget::changeEvent(e); } @@ -2473,7 +2432,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) else if (key == Qt::Key_Right) key = Qt::Key_Left; } -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC if (key == Qt::Key_Tab) //means down key = Qt::Key_Down; if (key == Qt::Key_Backtab) //means up @@ -2922,16 +2881,14 @@ void QMenu::actionEvent(QActionEvent *e) d->widgetItems.remove(e->action()); } -#ifdef Q_WS_MAC - if (d->mac_menu) { + if (d->platformMenu) { if (e->type() == QEvent::ActionAdded) - d->mac_menu->addAction(e->action(), d->mac_menu->findAction(e->before()), d); + d->platformMenu->addAction(e->action(), e->before()); else if (e->type() == QEvent::ActionRemoved) - d->mac_menu->removeAction(e->action()); + d->platformMenu->removeAction(e->action()); else if (e->type() == QEvent::ActionChanged) - d->mac_menu->syncAction(e->action()); + d->platformMenu->syncAction(e->action()); } -#endif #if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR) if (!d->wce_menu) @@ -3092,6 +3049,14 @@ void QMenu::setNoReplayFor(QWidget *noReplayFor) #endif } +/*!\internal +*/ +QPlatformMenu *QMenu::platformMenu() +{ + + return d_func()->platformMenu; +} + /*! \property QMenu::separatorsCollapsible \since 4.2 @@ -3122,435 +3087,10 @@ void QMenu::setSeparatorsCollapsible(bool collapse) d->updateActionRects(); update(); } -#ifdef Q_WS_MAC - if (d->mac_menu) - d->syncSeparatorsCollapsible(collapse); -#endif + if (d->platformMenu) + d->platformMenu->syncSeparatorsCollapsible(collapse); } -#ifdef QT3_SUPPORT - -int QMenu::insertAny(const QIcon *icon, const QString *text, const QObject *receiver, const char *member, - const QKeySequence *shortcut, const QMenu *popup, int id, int index) -{ - QAction *act = popup ? popup->menuAction() : new QAction(this); - if (id != -1) - static_cast<QMenuItem*>(act)->setId(id); - if (icon) - act->setIcon(*icon); - if (text) - act->setText(*text); - if (shortcut) - act->setShortcut(*shortcut); - if (receiver && member) - QObject::connect(act, SIGNAL(activated(int)), receiver, member); - if (index == -1 || index >= actions().count()) - addAction(act); - else - insertAction(actions().value(index), act); - return findIdForAction(act); -} - -/*! - Use insertAction() or one of the addAction() overloads instead. -*/ -int QMenu::insertItem(QMenuItem *item, int id, int index) -{ - if (index == -1 || index >= actions().count()) - addAction(item); - else - insertAction(actions().value(index), item); - if (id > -1) - item->d_func()->id = id; - return findIdForAction(item); -} - -/*! - Use the insertSeparator() overload that takes a QAction * - parameter instead. -*/ -int QMenu::insertSeparator(int index) -{ - QAction *act = new QAction(this); - act->setSeparator(true); - if (index == -1 || index >= actions().count()) - addAction(act); - else - insertAction(actions().value(index), act); - return findIdForAction(act); -} - -QAction *QMenu::findActionForId(int id) const -{ - Q_D(const QMenu); - for (int i = 0; i < d->actions.size(); ++i) { - QAction *act = d->actions.at(i); - if (findIdForAction(act)== id) - return act; - } - return 0; -} - -/*! - Use QAction and actions() instead. -*/ -QMenuItem *QMenu::findPopup( QMenu *popup, int *index ) -{ - QList<QAction *> list = actions(); - for (int i = 0; i < list.size(); ++i) { - QAction *act = list.at(i); - if (act->menu() == popup) { - QMenuItem *item = static_cast<QMenuItem *>(act); - if (index) - *index = act->d_func()->id; - return item; - } - } - return 0; -} - - -/*! - Use QAction::setData() instead. -*/ -bool QMenu::setItemParameter(int id, int param) -{ - if (QAction *act = findActionForId(id)) { - act->d_func()->param = param; - return true; - } - return false; -} - -/*! - Use QAction::data() instead. -*/ -int QMenu::itemParameter(int id) const -{ - if (QAction *act = findActionForId(id)) - return act->d_func()->param; - return id; -} - -/*! - Use actions instead. -*/ -void QMenu::setId(int index, int id) -{ - if(QAction *act = actions().value(index)) - act->d_func()->id = id; -} - -/*! - Use style()->pixelMetric(QStyle::PM_MenuPanelWidth, this) instead. -*/ -int QMenu::frameWidth() const -{ - return style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this); -} - -int QMenu::findIdForAction(QAction *act) const -{ - if (!act) - return -1; - return act->d_func()->id; -} -#endif // QT3_SUPPORT - -/*! - \fn uint QMenu::count() const - - Use actions().count() instead. -*/ - -/*! - \fn int QMenu::insertItem(const QString &text, const QObject *receiver, const char* member, const QKeySequence& shortcut, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QIcon& icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence& shortcut, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QPixmap &pixmap, const QObject *receiver, const char* member, const QKeySequence& shortcut, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QString &text, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QIcon& icon, const QString &text, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QString &text, QMenu *popup, int id, int index) - - Use insertMenu() or one of the addMenu() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QIcon& icon, const QString &text, QMenu *popup, int id, int index) - - Use insertMenu() or one of the addMenu() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QPixmap &pixmap, int id, int index) - - Use insertAction() or one of the addAction() overloads instead. -*/ - -/*! - \fn int QMenu::insertItem(const QPixmap &pixmap, QMenu *popup, int id, int index) - - Use insertMenu() or one of the addMenu() overloads instead. -*/ - -/*! - \fn void QMenu::removeItem(int id) - - Use removeAction() instead. -*/ - -/*! - \fn void QMenu::removeItemAt(int index) - - Use removeAction() instead. -*/ - -/*! - \fn QKeySequence QMenu::accel(int id) const - - Use shortcut() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setAccel(const QKeySequence& key, int id) - - Use setShortcut() on the relevant QAction instead. -*/ - -/*! - \fn QIcon QMenu::iconSet(int id) const - - Use icon() on the relevant QAction instead. -*/ - -/*! - \fn QString QMenu::text(int id) const - - Use text() on the relevant QAction instead. -*/ - -/*! - \fn QPixmap QMenu::pixmap(int id) const - - Use QPixmap(icon()) on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setWhatsThis(int id, const QString &w) - - Use setWhatsThis() on the relevant QAction instead. -*/ - -/*! - \fn QString QMenu::whatsThis(int id) const - - Use whatsThis() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::changeItem(int id, const QString &text) - - Use setText() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::changeItem(int id, const QPixmap &pixmap) - - Use setText() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::changeItem(int id, const QIcon &icon, const QString &text) - - Use setIcon() and setText() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenu::isItemActive(int id) const - - Use activeAction() instead. -*/ - -/*! - \fn bool QMenu::isItemEnabled(int id) const - - Use isEnabled() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setItemEnabled(int id, bool enable) - - Use setEnabled() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenu::isItemChecked(int id) const - - Use isChecked() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setItemChecked(int id, bool check) - - Use setChecked() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenu::isItemVisible(int id) const - - Use isVisible() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setItemVisible(int id, bool visible) - - Use setVisible() on the relevant QAction instead. -*/ - -/*! - \fn QRect QMenu::itemGeometry(int index) - - Use actionGeometry() on the relevant QAction instead. -*/ - -/*! - \fn QFont QMenu::itemFont(int id) const - - Use font() on the relevant QAction instead. -*/ - -/*! - \fn void QMenu::setItemFont(int id, const QFont &font) - - Use setFont() on the relevant QAction instead. -*/ - -/*! - \fn int QMenu::indexOf(int id) const - - Use actions().indexOf(action) on the relevant QAction instead. -*/ - -/*! - \fn int QMenu::idAt(int index) const - - Use actions instead. -*/ - -/*! - \fn void QMenu::activateItemAt(int index) - - Use activate() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenu::connectItem(int id, const QObject *receiver, const char* member) - - Use connect() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenu::disconnectItem(int id,const QObject *receiver, const char* member) - Use disconnect() on the relevant QAction instead. - -*/ - -/*! - \fn QMenuItem *QMenu::findItem(int id) const - - Use actions instead. -*/ - -/*! - \fn void QMenu::popup(const QPoint & pos, int indexAtPoint) - - Use popup() on the relevant QAction instead. -*/ - -/*! - \fn int QMenu::insertTearOffHandle(int a, int b) - - Use setTearOffEnabled() instead. -*/ - -/*! - \fn int QMenu::itemAtPos(const QPoint &p, bool ignoreSeparator) - - Use actions instead. -*/ - -/*! - \fn int QMenu::columns() const - - Use columnCount() instead. -*/ - -/*! - \fn int QMenu::itemHeight(int index) - - Use actionGeometry(actions().value(index)).height() instead. -*/ - -/*! - \fn int QMenu::itemHeight(QMenuItem *mi) - - Use actionGeometry() instead. -*/ - -/*! - \fn void QMenu::activated(int itemId); - - Use triggered() instead. -*/ - -/*! - \fn void QMenu::highlighted(int itemId); - - Use hovered() instead. -*/ - -/*! - \fn void QMenu::setCheckable(bool checkable) - - Not necessary anymore. The \a checkable parameter is ignored. -*/ - -/*! - \fn bool QMenu::isCheckable() const - - Not necessary anymore. Always returns true. -*/ - -/*! - \fn void QMenu::setActiveItem(int id) - - Use setActiveAction() instead. -*/ - QT_END_NAMESPACE // for private slots diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h new file mode 100644 index 00000000000..49bf8295ec6 --- /dev/null +++ b/src/widgets/widgets/qmenu.h @@ -0,0 +1,210 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMENU_H +#define QMENU_H + +#include <QtWidgets/qwidget.h> +#include <QtCore/qstring.h> +#include <QtWidgets/qicon.h> +#include <QtWidgets/qaction.h> +#include <QtWidgets/qplatformmenu_qpa.h> + +#ifdef Q_WS_WINCE +#include <windef.h> // for HMENU +#endif + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_MENU + +class QMenuPrivate; +class QStyleOptionMenuItem; + +class Q_WIDGETS_EXPORT QMenu : public QWidget +{ +private: + Q_OBJECT + Q_DECLARE_PRIVATE(QMenu) + + Q_PROPERTY(bool tearOffEnabled READ isTearOffEnabled WRITE setTearOffEnabled) + Q_PROPERTY(QString title READ title WRITE setTitle) + Q_PROPERTY(QIcon icon READ icon WRITE setIcon) + Q_PROPERTY(bool separatorsCollapsible READ separatorsCollapsible WRITE setSeparatorsCollapsible) + +public: + explicit QMenu(QWidget *parent = 0); + explicit QMenu(const QString &title, QWidget *parent = 0); + ~QMenu(); + +#ifdef Q_NO_USING_KEYWORD + inline void addAction(QAction *action) { QWidget::addAction(action); } +#else + using QWidget::addAction; +#endif + QAction *addAction(const QString &text); + QAction *addAction(const QIcon &icon, const QString &text); + QAction *addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); + QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); + + QAction *addMenu(QMenu *menu); + QMenu *addMenu(const QString &title); + QMenu *addMenu(const QIcon &icon, const QString &title); + + QAction *addSeparator(); + + QAction *insertMenu(QAction *before, QMenu *menu); + QAction *insertSeparator(QAction *before); + + bool isEmpty() const; + void clear(); + + void setTearOffEnabled(bool); + bool isTearOffEnabled() const; + + bool isTearOffMenuVisible() const; + void hideTearOffMenu(); + + void setDefaultAction(QAction *); + QAction *defaultAction() const; + + void setActiveAction(QAction *act); + QAction *activeAction() const; + + void popup(const QPoint &pos, QAction *at=0); + QAction *exec(); + QAction *exec(const QPoint &pos, QAction *at=0); + + // ### Qt 5: merge + static QAction *exec(QList<QAction*> actions, const QPoint &pos, QAction *at=0); + static QAction *exec(QList<QAction*> actions, const QPoint &pos, QAction *at, QWidget *parent); + + QSize sizeHint() const; + + QRect actionGeometry(QAction *) const; + QAction *actionAt(const QPoint &) const; + + QAction *menuAction() const; + + QString title() const; + void setTitle(const QString &title); + + QIcon icon() const; + void setIcon(const QIcon &icon); + + void setNoReplayFor(QWidget *widget); + QPlatformMenu *platformMenu(); + +#ifdef Q_WS_WINCE + HMENU wceMenu(); +#endif + + bool separatorsCollapsible() const; + void setSeparatorsCollapsible(bool collapse); + +Q_SIGNALS: + void aboutToShow(); + void aboutToHide(); + void triggered(QAction *action); + void hovered(QAction *action); + +protected: + int columnCount() const; + + void changeEvent(QEvent *); + void keyPressEvent(QKeyEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); +#ifndef QT_NO_WHEELEVENT + void wheelEvent(QWheelEvent *); +#endif + void enterEvent(QEvent *); + void leaveEvent(QEvent *); + void hideEvent(QHideEvent *); + void paintEvent(QPaintEvent *); + void actionEvent(QActionEvent *); + void timerEvent(QTimerEvent *); + bool event(QEvent *); + bool focusNextPrevChild(bool next); + void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; + +#ifdef Q_WS_WINCE + QAction* wceCommands(uint command); +#endif + +private Q_SLOTS: + void internalSetSloppyAction(); + void internalDelayedPopup(); + +private: + Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered()) + Q_PRIVATE_SLOT(d_func(), void _q_actionHovered()) + Q_PRIVATE_SLOT(d_func(), void _q_overrideMenuActionDestroyed()) + +protected: + QMenu(QMenuPrivate &dd, QWidget* parent = 0); + +private: + Q_DISABLE_COPY(QMenu) + + friend class QMenuBar; + friend class QMenuBarPrivate; + friend class QTornOffMenu; + friend class Q3PopupMenu; + friend class QComboBox; + friend class QAction; + friend class QToolButtonPrivate; + friend void qt_mac_emit_menuSignals(QMenu *menu, bool show); + friend void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action); +}; + +#endif // QT_NO_MENU + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMENU_H diff --git a/src/gui/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h similarity index 80% rename from src/gui/widgets/qmenu_p.h rename to src/widgets/widgets/qmenu_p.h index 82bd932be7d..df15512b3e8 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -53,14 +53,18 @@ // We mean it. // -#include "QtGui/qmenubar.h" -#include "QtGui/qstyleoption.h" +#include "QtWidgets/qmenubar.h" +#include "QtWidgets/qstyleoption.h" +#ifdef Q_OS_MAC +#include "QtWidgets/qmacdefines_mac.h" +#endif #include "QtCore/qdatetime.h" #include "QtCore/qmap.h" #include "QtCore/qhash.h" #include "QtCore/qbasictimer.h" #include "private/qwidget_p.h" + #ifdef Q_WS_S60 class CEikMenuPane; #define QT_SYMBIAN_FIRST_MENU_ITEM 32000 @@ -79,50 +83,6 @@ void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id); class QTornOffMenu; class QEventLoop; -#ifdef Q_WS_MAC -# ifdef __OBJC__ -QT_END_NAMESPACE -@class NSMenuItem; -QT_BEGIN_NAMESPACE -# else -typedef void NSMenuItem; -# endif //__OBJC__ -struct QMacMenuAction { - QMacMenuAction() -#ifndef QT_MAC_USE_COCOA - : command(0) -#else - : menuItem(0) -#endif - , ignore_accel(0), merged(0), menu(0) - { - } - ~QMacMenuAction(); -#ifndef QT_MAC_USE_COCOA - uint command; -#else - NSMenuItem *menuItem; -#endif - uchar ignore_accel : 1; - uchar merged : 1; - QPointer<QAction> action; - OSMenuRef menu; -}; - -struct QMenuMergeItem -{ -#ifndef QT_MAC_USE_COCOA - inline QMenuMergeItem(MenuCommand c, QMacMenuAction *a) : command(c), action(a) { } - MenuCommand command; -#else - inline QMenuMergeItem(NSMenuItem *c, QMacMenuAction *a) : menuItem(c), action(a) { } - NSMenuItem *menuItem; -#endif - QMacMenuAction *action; -}; -typedef QList<QMenuMergeItem> QMenuMergeList; -#endif - #ifdef Q_WS_WINCE struct QWceMenuAction { uint command; @@ -153,13 +113,8 @@ public: cancelAction(0), #endif scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0), - hasCheckableItems(0), sloppyAction(0), doChildEffects(false) -#ifdef QT3_SUPPORT - ,emitHighlighted(false) -#endif -#ifdef Q_WS_MAC - ,mac_menu(0) -#endif + hasCheckableItems(0), sloppyAction(0), doChildEffects(false), platformMenu(0) + #if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR) ,wce_menu(0) #endif @@ -170,9 +125,7 @@ public: ~QMenuPrivate() { delete scroll; -#ifdef Q_WS_MAC - delete mac_menu; -#endif + delete platformMenu; #if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR) delete wce_menu; #endif @@ -302,41 +255,9 @@ public: //menu fading/scrolling effects bool doChildEffects; -#ifdef Q_WS_MAC - //mac menu binding - struct QMacMenuPrivate { - QList<QMacMenuAction*> actionItems; - OSMenuRef menu; - QMacMenuPrivate(); - ~QMacMenuPrivate(); - - bool merged(const QAction *action) const; - void addAction(QAction *, QMacMenuAction* =0, QMenuPrivate *qmenu = 0); - void addAction(QMacMenuAction *, QMacMenuAction* =0, QMenuPrivate *qmenu = 0); - void syncAction(QMacMenuAction *); - inline void syncAction(QAction *a) { syncAction(findAction(a)); } - void removeAction(QMacMenuAction *); - inline void removeAction(QAction *a) { removeAction(findAction(a)); } - inline QMacMenuAction *findAction(QAction *a) { - for(int i = 0; i < actionItems.size(); i++) { - QMacMenuAction *act = actionItems[i]; - if(a == act->action) - return act; - } - return 0; - } - } *mac_menu; - OSMenuRef macMenu(OSMenuRef merge); - void setMacMenuEnabled(bool enable = true); - void syncSeparatorsCollapsible(bool collapsible); - static QHash<OSMenuRef, OSMenuRef> mergeMenuHash; - static QHash<OSMenuRef, QMenuMergeList*> mergeMenuItemsHash; -#endif + QPlatformMenu *platformMenu; QPointer<QAction> actionAboutToTrigger; -#ifdef QT3_SUPPORT - bool emitHighlighted; -#endif #if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR) struct QWceMenuPrivate { diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/widgets/widgets/qmenu_symbian.cpp similarity index 100% rename from src/gui/widgets/qmenu_symbian.cpp rename to src/widgets/widgets/qmenu_symbian.cpp diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/widgets/widgets/qmenu_wince.cpp similarity index 100% rename from src/gui/widgets/qmenu_wince.cpp rename to src/widgets/widgets/qmenu_wince.cpp diff --git a/src/gui/widgets/qmenu_wince.rc b/src/widgets/widgets/qmenu_wince.rc similarity index 100% rename from src/gui/widgets/qmenu_wince.rc rename to src/widgets/widgets/qmenu_wince.rc diff --git a/src/gui/widgets/qmenu_wince_resource_p.h b/src/widgets/widgets/qmenu_wince_resource_p.h similarity index 100% rename from src/gui/widgets/qmenu_wince_resource_p.h rename to src/widgets/widgets/qmenu_wince_resource_p.h diff --git a/src/gui/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp similarity index 80% rename from src/gui/widgets/qmenubar.cpp rename to src/widgets/widgets/qmenubar.cpp index 018d9f06a31..385df52adfe 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -55,9 +55,7 @@ #include <qtoolbar.h> #include <qtoolbutton.h> #include <qwhatsthis.h> -#ifdef Q_WS_X11 -#include <qpluginloader.h> -#endif +#include "private/qguiapplication_p.h" #ifndef QT_NO_MENUBAR @@ -69,9 +67,6 @@ #include "qmenu_p.h" #include "qmenubar_p.h" #include "qdebug.h" -#ifdef Q_WS_X11 -#include "qmenubar_x11_p.h" -#endif #ifdef Q_WS_WINCE extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp @@ -179,11 +174,7 @@ void QMenuBarPrivate::updateGeometries() return; int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q)*2); int q_start = -1; - if( -#ifdef Q_WS_X11 - platformMenuBar->allowCornerWidgets() && -#endif - (leftWidget || rightWidget)) { + if(leftWidget || rightWidget) { int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, 0, q) + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, q); int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, 0, q) @@ -205,7 +196,7 @@ void QMenuBarPrivate::updateGeometries() } } -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC if(q->isNativeMenuBar()) {//nothing to see here folks, move along.. itemsDirty = false; return; @@ -214,23 +205,13 @@ void QMenuBarPrivate::updateGeometries() calcActionRects(q_width, q_start); currentAction = 0; #ifndef QT_NO_SHORTCUT - if( -#ifdef Q_WS_X11 - !platformMenuBar->shortcutsHandledByNativeMenuBar() && -#endif - itemsDirty) { + if(itemsDirty) { for(int j = 0; j < shortcutIndexMap.size(); ++j) q->releaseShortcut(shortcutIndexMap.value(j)); shortcutIndexMap.resize(0); // faster than clear for(int i = 0; i < actions.count(); i++) shortcutIndexMap.append(q->grabShortcut(QKeySequence::mnemonic(actions.at(i)->text()))); } -#endif -#ifdef Q_WS_X11 - if(q->isNativeMenuBar()) {//nothing to see here folks, move along.. - itemsDirty = false; - return; - } #endif itemsDirty = false; @@ -567,9 +548,6 @@ void QMenuBarPrivate::_q_actionHovered() QAccessible::updateAccessibility(q, actionIndex, QAccessible::Selection); } #endif //QT_NO_ACCESSIBILITY -#ifdef QT3_SUPPORT - emit q->highlighted(q->findIdForAction(action)); -#endif } } @@ -748,11 +726,11 @@ void QMenuBarPrivate::init() Q_Q(QMenuBar); q->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); q->setAttribute(Qt::WA_CustomWhatsThis); -#ifdef Q_WS_MAC - macCreateMenuBar(q->parentWidget()); - if(mac_menubar) + + platformMenuBar = QGuiApplicationPrivate::platformIntegration()->createPlatformMenuBar(q); + + if (platformMenuBar) q->hide(); -#endif #ifdef Q_WS_WINCE if (qt_wince_is_mobile()) { wceCreateMenuBar(q->parentWidget()); @@ -763,22 +741,10 @@ void QMenuBarPrivate::init() QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); } #endif -#ifdef Q_WS_X11 - platformMenuBar = qt_guiPlatformMenuBarFactory()->create(); - platformMenuBar->init(q); -#endif - q->setBackgroundRole(QPalette::Button); oldWindow = oldParent = 0; -#ifdef QT3_SUPPORT - doAutoResize = false; -#endif #ifdef QT_SOFTKEYS_ENABLED menuBarAction = 0; -#endif -#ifdef Q_WS_X11 - cornerWidgetToolBar = 0; - cornerWidgetContainer = 0; #endif handleReparent(); q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q)); @@ -819,28 +785,16 @@ QMenuBar::QMenuBar(QWidget *parent) : QWidget(*new QMenuBarPrivate, parent, 0) d->init(); } -#ifdef QT3_SUPPORT -/*! - Use one of the constructors that doesn't take the \a name - argument and then use setObjectName() instead. -*/ -QMenuBar::QMenuBar(QWidget *parent, const char *name) : QWidget(*new QMenuBarPrivate, parent, 0) -{ - Q_D(QMenuBar); - d->init(); - setObjectName(QString::fromAscii(name)); -} -#endif /*! Destroys the menu bar. */ QMenuBar::~QMenuBar() { -#ifdef Q_WS_MAC Q_D(QMenuBar); - d->macDestroyMenuBar(); -#endif + delete d->platformMenuBar; + d->platformMenuBar = 0; + #ifdef Q_WS_WINCE Q_D(QMenuBar); if (qt_wince_is_mobile()) @@ -850,10 +804,6 @@ QMenuBar::~QMenuBar() Q_D(QMenuBar); d->symbianDestroyMenuBar(); #endif -#ifdef Q_WS_X11 - Q_D(QMenuBar); - delete d->cornerWidgetToolBar; -#endif } /*! @@ -1105,11 +1055,7 @@ void QMenuBar::paintEvent(QPaintEvent *e) */ void QMenuBar::setVisible(bool visible) { -#ifdef Q_WS_X11 - Q_D(QMenuBar); - d->platformMenuBar->setVisible(visible); -#else -#if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) +#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) if (isNativeMenuBar()) { if (!visible) QWidget::setVisible(false); @@ -1117,7 +1063,6 @@ void QMenuBar::setVisible(bool visible) } #endif QWidget::setVisible(visible); -#endif // Q_WS_X11 } /*! @@ -1313,16 +1258,12 @@ void QMenuBar::actionEvent(QActionEvent *e) { Q_D(QMenuBar); d->itemsDirty = true; -#ifdef Q_WS_X11 - d->platformMenuBar->actionEvent(e); -#endif -#if defined (Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) - if (isNativeMenuBar()) { -#ifdef Q_WS_MAC - QMenuBarPrivate::QMacMenuBarPrivate *nativeMenuBar = d->mac_menubar; -#elif defined(Q_WS_S60) + + if (d->platformMenuBar) { + QPlatformMenuBar *nativeMenuBar = d->platformMenuBar; +#if defined(Q_WS_S60) QMenuBarPrivate::QSymbianMenuBarPrivate *nativeMenuBar = d->symbian_menubar; -#else +#elif defined(Q_WS_WINCE) QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar; #endif if (!nativeMenuBar) @@ -1334,7 +1275,6 @@ void QMenuBar::actionEvent(QActionEvent *e) else if(e->type() == QEvent::ActionChanged) nativeMenuBar->syncAction(e->action()); } -#endif if(e->type() == QEvent::ActionAdded) { connect(e->action(), SIGNAL(triggered()), this, SLOT(_q_actionTriggered())); @@ -1410,22 +1350,11 @@ void QMenuBarPrivate::handleReparent() newWindow->installEventFilter(q); } -#ifdef Q_WS_X11 - platformMenuBar->handleReparent(oldParent, newParent, oldWindow, newWindow); -#endif - oldParent = newParent; oldWindow = newWindow; -#ifdef Q_WS_MAC - if (q->isNativeMenuBar() && !macWidgetHasNativeMenubar(newParent)) { - // If the new parent got a native menubar from before, keep that - // menubar rather than replace it with this one (because a parents - // menubar has precedence over children menubars). - macDestroyMenuBar(); - macCreateMenuBar(newParent); - } -#endif + if (platformMenuBar) + platformMenuBar->handleReparent(newParent); #ifdef Q_WS_WINCE if (qt_wince_is_mobile() && wce_menubar) @@ -1465,38 +1394,6 @@ void QMenuBarPrivate::handleReparent() #endif // Q_WS_S60 } -#ifdef QT3_SUPPORT -/*! - Sets whether the menu bar should automatically resize itself - when its parent widget is resized. - - This feature is provided to help porting to Qt 4. We recommend - against using it in new code. - - \sa autoGeometry() -*/ -void QMenuBar::setAutoGeometry(bool b) -{ - Q_D(QMenuBar); - d->doAutoResize = b; -} - -/*! - Returns true if the menu bar automatically resizes itself - when its parent widget is resized; otherwise returns false. - - This feature is provided to help porting to Qt 4. We recommend - against using it in new code. - - \sa setAutoGeometry() -*/ -bool QMenuBar::autoGeometry() const -{ - Q_D(const QMenuBar); - return d->doAutoResize; -} -#endif - /*! \reimp */ @@ -1557,15 +1454,6 @@ bool QMenuBar::event(QEvent *e) } break; #endif case QEvent::Show: -#ifdef QT3_SUPPORT - if(QWidget *p = parentWidget()) { - // If itemsDirty == true, updateGeometries sends the MenubarUpdated event. - if (!d->itemsDirty) { - QMenubarUpdatedEvent menubarUpdated(this); - QApplication::sendEvent(p, &menubarUpdated); - } - } -#endif d->_q_updateLayout(); break; case QEvent::ShortcutOverride: { @@ -1578,14 +1466,6 @@ bool QMenuBar::event(QEvent *e) } break; -#ifdef QT3_SUPPORT - case QEvent::Hide: { - if(QWidget *p = parentWidget()) { - QMenubarUpdatedEvent menubarUpdated(this); - QApplication::sendEvent(p, &menubarUpdated); - } - } break; -#endif #ifndef QT_NO_WHATSTHIS case QEvent::QueryWhatsThis: @@ -1611,20 +1491,7 @@ bool QMenuBar::event(QEvent *e) bool QMenuBar::eventFilter(QObject *object, QEvent *event) { Q_D(QMenuBar); -#ifdef Q_WS_X11 - if (d->platformMenuBar->menuBarEventFilter(object, event)) { - return true; - } -#endif if (object == parent() && object) { -#ifdef QT3_SUPPORT - if (d->doAutoResize && event->type() == QEvent::Resize) { - QResizeEvent *e = (QResizeEvent *)event; - int w = e->size().width(); - setGeometry(0, y(), w, heightForWidth(w)); - return false; - } -#endif if (event->type() == QEvent::ParentChange) //GrandparentChange d->handleReparent(); } @@ -1709,7 +1576,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const QSize QMenuBar::minimumSizeHint() const { Q_D(const QMenuBar); -#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) +#if defined(Q_OS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1732,9 +1599,6 @@ QSize QMenuBar::minimumSizeHint() const ret += QSize(2*fw + hmargin, 2*fw + vmargin); } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; -#ifdef Q_WS_X11 - if (d->platformMenuBar->allowCornerWidgets()) { -#endif if(d->leftWidget) { QSize sz = d->leftWidget->minimumSizeHint(); ret.setWidth(ret.width() + sz.width()); @@ -1747,9 +1611,6 @@ QSize QMenuBar::minimumSizeHint() const if(sz.height() + margin > ret.height()) ret.setHeight(sz.height() + margin); } -#ifdef Q_WS_X11 - } -#endif if(as_gui_menubar) { QStyleOptionMenuItem opt; opt.rect = rect(); @@ -1771,7 +1632,7 @@ QSize QMenuBar::minimumSizeHint() const QSize QMenuBar::sizeHint() const { Q_D(const QMenuBar); -#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) +#if defined(Q_OS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1797,9 +1658,6 @@ QSize QMenuBar::sizeHint() const ret += QSize(fw + hmargin, fw + vmargin); } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; -#ifdef Q_WS_X11 - if(d->platformMenuBar->allowCornerWidgets()) { -#endif if(d->leftWidget) { QSize sz = d->leftWidget->sizeHint(); ret.setWidth(ret.width() + sz.width()); @@ -1812,9 +1670,6 @@ QSize QMenuBar::sizeHint() const if(sz.height() + margin > ret.height()) ret.setHeight(sz.height() + margin); } -#ifdef Q_WS_X11 - } -#endif if(as_gui_menubar) { QStyleOptionMenuItem opt; opt.rect = rect(); @@ -1836,7 +1691,7 @@ QSize QMenuBar::sizeHint() const int QMenuBar::heightForWidth(int) const { Q_D(const QMenuBar); -#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11) +#if defined(Q_OS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) const bool as_gui_menubar = !isNativeMenuBar(); #else const bool as_gui_menubar = true; @@ -1856,16 +1711,10 @@ int QMenuBar::heightForWidth(int) const height += 2*vmargin; } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; -#ifdef Q_WS_X11 - if(d->platformMenuBar->allowCornerWidgets()) { -#endif if(d->leftWidget) height = qMax(d->leftWidget->sizeHint().height() + margin, height); if(d->rightWidget) height = qMax(d->rightWidget->sizeHint().height() + margin, height); -#ifdef Q_WS_X11 - } -#endif if(as_gui_menubar) { QStyleOptionMenuItem opt; opt.init(this); @@ -1885,15 +1734,7 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id) { Q_Q(QMenuBar); QAction *act = actions.at(id); -#ifdef Q_WS_X11 - if (q->isNativeMenuBar()) { - platformMenuBar->popupAction(act); - } else { -#endif - setCurrentAction(act, true, true); -#ifdef Q_WS_X11 - } -#endif + setCurrentAction(act, true, true); if (act && !act->menu()) { activateAction(act, QAction::Trigger); //100 is the same as the default value in QPushButton::animateClick @@ -1914,39 +1755,6 @@ void QMenuBarPrivate::_q_updateLayout() } } -#ifdef Q_WS_X11 -void QMenuBarPrivate::updateCornerWidgetToolBar() -{ - Q_Q(QMenuBar); - if (!cornerWidgetToolBar) { - QMainWindow *window = qobject_cast<QMainWindow *>(q->window()); - if (!window) { - qWarning() << "Menubar parent is not a QMainWindow, not showing corner widgets"; - return; - } - cornerWidgetToolBar = window->addToolBar(QApplication::translate("QMenuBar", "Corner Toolbar")); - cornerWidgetToolBar->setObjectName(QLatin1String("CornerToolBar")); - cornerWidgetContainer = new QWidget; - cornerWidgetToolBar->addWidget(cornerWidgetContainer); - new QHBoxLayout(cornerWidgetContainer); - } else { - QLayout *layout = cornerWidgetContainer->layout(); - while (layout->count() > 0) { - layout->takeAt(0); - } - } - if (leftWidget) { - leftWidget->setParent(cornerWidgetContainer); - cornerWidgetContainer->layout()->addWidget(leftWidget); - } - if (rightWidget) { - rightWidget->setParent(cornerWidgetContainer); - cornerWidgetContainer->layout()->addWidget(rightWidget); - } -} -#endif - - /*! \fn void QMenuBar::setCornerWidget(QWidget *widget, Qt::Corner corner) @@ -1979,18 +1787,10 @@ void QMenuBar::setCornerWidget(QWidget *w, Qt::Corner corner) return; } -#ifdef Q_WS_X11 - if(!d->platformMenuBar->allowCornerWidgets()) { - d->updateCornerWidgetToolBar(); - } else { -#endif if (w) { w->setParent(this); w->installEventFilter(this); } -#ifdef Q_WS_X11 - } -#endif d->_q_updateLayout(); } @@ -2040,47 +1840,36 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const void QMenuBar::setNativeMenuBar(bool nativeMenuBar) { Q_D(QMenuBar); -#ifdef Q_WS_X11 - d->platformMenuBar->setNativeMenuBar(nativeMenuBar); -#else if (d->nativeMenuBar == -1 || (nativeMenuBar != bool(d->nativeMenuBar))) { d->nativeMenuBar = nativeMenuBar; -#ifdef Q_WS_MAC + if (!d->nativeMenuBar) { - extern void qt_mac_clear_menubar(); - qt_mac_clear_menubar(); - d->macDestroyMenuBar(); - const QList<QAction *> &menubarActions = actions(); - for (int i = 0; i < menubarActions.size(); ++i) { - const QAction *action = menubarActions.at(i); - if (QMenu *menu = action->menu()) { - delete menu->d_func()->mac_menu; - menu->d_func()->mac_menu = 0; - } - } + delete d->platformMenuBar; + d->platformMenuBar = 0; } else { - d->macCreateMenuBar(parentWidget()); + if (!d->platformMenuBar) + d->platformMenuBar = QGuiApplicationPrivate::platformIntegration()->createPlatformMenuBar(this); } - macUpdateMenuBar(); + updateGeometry(); if (!d->nativeMenuBar && parentWidget()) setVisible(true); -#endif } -#endif // Q_WS_X11 } bool QMenuBar::isNativeMenuBar() const { Q_D(const QMenuBar); -#ifdef Q_WS_X11 - return d->platformMenuBar->isNativeMenuBar(); -#else if (d->nativeMenuBar == -1) { return !QApplication::instance()->testAttribute(Qt::AA_DontUseNativeMenuBar); } return d->nativeMenuBar; -#endif +} + +QPlatformMenuBar *QMenuBar::platformMenuBar() +{ + Q_D(const QMenuBar); + return d->platformMenuBar; } /*! @@ -2162,99 +1951,15 @@ QAction *QMenuBar::defaultAction() const \sa triggered(), QAction::hovered() */ - -#ifdef QT3_SUPPORT /*! - Use style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, this) - instead. + \enum QMenuBar::Separator + + \compat + + \value Never + \value InWindowsStyle + */ -int QMenuBar::frameWidth() const -{ - return style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, this); -} - -int QMenuBar::insertAny(const QIcon *icon, const QString *text, const QObject *receiver, const char *member, - const QKeySequence *shortcut, const QMenu *popup, int id, int index) -{ - QAction *act = popup ? popup->menuAction() : new QAction(this); - if(id != -1) - static_cast<QMenuItem*>(act)->setId(id); - if(icon) - act->setIcon(*icon); - if(text) - act->setText(*text); - if(shortcut) - act->setShortcut(*shortcut); - if(receiver && member) - QObject::connect(act, SIGNAL(triggered(bool)), receiver, member); - if(index == -1 || index >= actions().count()) - addAction(act); - else - insertAction(actions().value(index), act); - return findIdForAction(act); -} - -/*! - \since 4.2 - - Use addSeparator() or insertAction() instead. - - \oldcode - menuBar->insertSeparator(); - \newcode - menuBar->addSeparator(); - \endcode -*/ -int QMenuBar::insertSeparator(int index) -{ - QAction *act = new QAction(this); - act->setSeparator(true); - if(index == -1 || index >= actions().count()) - addAction(act); - else - insertAction(actions().value(index), act); - return findIdForAction(act); -} - -/*! - Use QAction::setData() instead. -*/ -bool QMenuBar::setItemParameter(int id, int param) -{ - if(QAction *act = findActionForId(id)) { - act->d_func()->param = param; - return true; - } - return false; -} - -/*! - Use QAction::data() instead. -*/ -int QMenuBar::itemParameter(int id) const -{ - if(QAction *act = findActionForId(id)) - return act->d_func()->param; - return id; -} - -QAction *QMenuBar::findActionForId(int id) const -{ - QList<QAction *> list = actions(); - for (int i = 0; i < list.size(); ++i) { - QAction *act = list.at(i); - if (findIdForAction(act) == id) - return act; - } - return 0; -} - -int QMenuBar::findIdForAction(QAction *act) const -{ - Q_ASSERT(act); - return act->d_func()->id; -} -#endif /*! \fn void QMenuBar::addAction(QAction *action) @@ -2265,255 +1970,6 @@ int QMenuBar::findIdForAction(QAction *act) const \sa QMenu::addAction(), QWidget::addAction(), QWidget::actions() */ -/*! - \fn uint QMenuBar::count() const - - Use actions().count() instead. -*/ - -/*! - \fn int QMenuBar::insertItem(const QString &text, const QObject *receiver, const char* member, const QKeySequence& shortcut, int id, int index) - - Use one of the insertAction() or addAction() overloads instead. -*/ - -/*! - \fn int QMenuBar::insertItem(const QIcon& icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence& shortcut, int id, int index) - - Use one of the insertAction() or addAction() overloads instead. -*/ - -/*! - \fn int QMenuBar::insertItem(const QPixmap &pixmap, const QObject *receiver, const char* member, const QKeySequence& shortcut, int id, int index) - - Use one of the insertAction(), addAction(), insertMenu(), or - addMenu() overloads instead. -*/ - -/*! - \fn int QMenuBar::insertItem(const QString &text, int id, int index) - - Use one of the insertAction() or addAction() overloads instead. -*/ - -/*! - \fn int QMenuBar::insertItem(const QIcon& icon, const QString &text, int id, int index) - - Use one of the insertAction(), addAction(), insertMenu(), or - addMenu() overloads instead. -*/ - -/*! - \fn int QMenuBar::insertItem(const QString &text, QMenu *popup, int id, int index) - - Use one of the insertMenu(), or addMenu() overloads instead. -*/ - -/*! - \fn int QMenuBar::insertItem(const QIcon& icon, const QString &text, QMenu *popup, int id, int index) - - Use one of the insertMenu(), or addMenu() overloads instead. -*/ - -/*! - \fn int QMenuBar::insertItem(const QPixmap &pixmap, int id, int index) - - Use one of the insertAction(), addAction(), insertMenu(), or - addMenu() overloads instead. -*/ - -/*! - \fn int QMenuBar::insertItem(const QPixmap &pixmap, QMenu *popup, int id, int index) - - Use one of the insertMenu(), or addMenu() overloads instead. -*/ - -/*! - \fn void QMenuBar::removeItem(int id) - - Use removeAction() instead. -*/ - -/*! - \fn void QMenuBar::removeItemAt(int index) - - Use removeAction() instead. -*/ - -/*! - \fn QKeySequence QMenuBar::accel(int id) const - - Use shortcut() on the relevant QAction instead. -*/ - -/*! - \fn void QMenuBar::setAccel(const QKeySequence& key, int id) - - Use setShortcut() on the relevant QAction instead. -*/ - -/*! - \fn QIcon QMenuBar::iconSet(int id) const - - Use icon() on the relevant QAction instead. -*/ - -/*! - \fn QString QMenuBar::text(int id) const - - Use text() on the relevant QAction instead. -*/ - -/*! - \fn QPixmap QMenuBar::pixmap(int id) const - - Use QPixmap(icon()) on the relevant QAction instead. -*/ - -/*! - \fn void QMenuBar::setWhatsThis(int id, const QString &w) - - Use setWhatsThis() on the relevant QAction instead. -*/ - -/*! - \fn QString QMenuBar::whatsThis(int id) const - - Use whatsThis() on the relevant QAction instead. -*/ - -/*! - \fn void QMenuBar::changeItem(int id, const QString &text) - - Use setText() on the relevant QAction instead. -*/ - -/*! - \fn void QMenuBar::changeItem(int id, const QPixmap &pixmap) - - Use setText() on the relevant QAction instead. -*/ - -/*! - \fn void QMenuBar::changeItem(int id, const QIcon &icon, const QString &text) - - Use setIcon() and setText() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenuBar::isItemActive(int id) const - - Use activeAction() instead. -*/ - -/*! - \fn bool QMenuBar::isItemEnabled(int id) const - - Use isEnabled() on the relevant QAction instead. -*/ - -/*! - \fn void QMenuBar::setItemEnabled(int id, bool enable) - - Use setEnabled() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenuBar::isItemChecked(int id) const - - Use isChecked() on the relevant QAction instead. -*/ - -/*! - \fn void QMenuBar::setItemChecked(int id, bool check) - - Use setChecked() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenuBar::isItemVisible(int id) const - - Use isVisible() on the relevant QAction instead. -*/ - -/*! - \fn void QMenuBar::setItemVisible(int id, bool visible) - - Use setVisible() on the relevant QAction instead. -*/ - -/*! - \fn int QMenuBar::indexOf(int id) const - - Use actions().indexOf(action) on the relevant QAction instead. -*/ - -/*! - \fn int QMenuBar::idAt(int index) const - - Use actions instead. -*/ - -/*! - \fn void QMenuBar::activateItemAt(int index) - - Use activate() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenuBar::connectItem(int id, const QObject *receiver, const char* member) - - Use connect() on the relevant QAction instead. -*/ - -/*! - \fn bool QMenuBar::disconnectItem(int id,const QObject *receiver, const char* member) - - Use disconnect() on the relevant QAction instead. -*/ - -/*! - \fn QMenuItem *QMenuBar::findItem(int id) const - - Use actions instead. -*/ - -/*! - \fn Separator QMenuBar::separator() const - - This function is provided only to make old code compile. -*/ - -/*! - \fn void QMenuBar::setSeparator(Separator sep) - - This function is provided only to make old code compile. -*/ - -/*! - \fn QRect QMenuBar::itemRect(int index) - - Use actionGeometry() on the relevant QAction instead. -*/ - -/*! - \fn int QMenuBar::itemAtPos(const QPoint &p) - - There is no equivalent way to achieve this in Qt 4. -*/ - -/*! - \fn void QMenuBar::activated(int itemId); - - Use triggered() instead. -*/ - -/*! - \fn void QMenuBar::highlighted(int itemId); - - Use hovered() instead. -*/ - /*! \fn void QMenuBar::setFrameRect(QRect) \internal @@ -2587,22 +2043,6 @@ int QMenuBar::findIdForAction(QAction *act) const \internal */ -/*! - \fn void QMenuBar::setMargin(int margin) - Sets the width of the margin around the contents of the widget to \a margin. - - Use QWidget::setContentsMargins() instead. - \sa margin(), QWidget::setContentsMargins() -*/ - -/*! - \fn int QMenuBar::margin() const - Returns the width of the margin around the contents of the widget. - - Use QWidget::getContentsMargins() instead. - \sa setMargin(), QWidget::getContentsMargins() -*/ - /*! \fn void QMenuBar::setMidLineWidth(int) \internal diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h new file mode 100644 index 00000000000..b165ec78f31 --- /dev/null +++ b/src/widgets/widgets/qmenubar.h @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMENUBAR_H +#define QMENUBAR_H + +#include <QtWidgets/qmenu.h> +#ifdef Q_OS_MAC +#include "QtWidgets/qmacdefines_mac.h" +#endif + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +#ifndef QT_NO_MENUBAR + +class QMenuBarPrivate; +class QStyleOptionMenuItem; +class QWindowsStyle; +#ifdef QT3_SUPPORT +class QMenuItem; +#endif + +class Q_WIDGETS_EXPORT QMenuBar : public QWidget +{ + Q_OBJECT + + Q_PROPERTY(bool defaultUp READ isDefaultUp WRITE setDefaultUp) + Q_PROPERTY(bool nativeMenuBar READ isNativeMenuBar WRITE setNativeMenuBar) + +public: + explicit QMenuBar(QWidget *parent = 0); + ~QMenuBar(); + +#ifdef Q_NO_USING_KEYWORD + void addAction(QAction *action) { QWidget::addAction(action); } +#else + using QWidget::addAction; +#endif + QAction *addAction(const QString &text); + QAction *addAction(const QString &text, const QObject *receiver, const char* member); + + QAction *addMenu(QMenu *menu); + QMenu *addMenu(const QString &title); + QMenu *addMenu(const QIcon &icon, const QString &title); + + + QAction *addSeparator(); + QAction *insertSeparator(QAction *before); + + QAction *insertMenu(QAction *before, QMenu *menu); + + void clear(); + + QAction *activeAction() const; + void setActiveAction(QAction *action); + + void setDefaultUp(bool); + bool isDefaultUp() const; + + QSize sizeHint() const; + QSize minimumSizeHint() const; + int heightForWidth(int) const; + + QRect actionGeometry(QAction *) const; + QAction *actionAt(const QPoint &) const; + + void setCornerWidget(QWidget *w, Qt::Corner corner = Qt::TopRightCorner); + QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const; + +#ifdef Q_WS_WINCE + void setDefaultAction(QAction *); + QAction *defaultAction() const; + + static void wceCommands(uint command); + static void wceRefresh(); +#endif + + bool isNativeMenuBar() const; + void setNativeMenuBar(bool nativeMenuBar); + QPlatformMenuBar *platformMenuBar(); +public Q_SLOTS: + virtual void setVisible(bool visible); + +Q_SIGNALS: + void triggered(QAction *action); + void hovered(QAction *action); + +protected: + void changeEvent(QEvent *); + void keyPressEvent(QKeyEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void leaveEvent(QEvent *); + void paintEvent(QPaintEvent *); + void resizeEvent(QResizeEvent *); + void actionEvent(QActionEvent *); + void focusOutEvent(QFocusEvent *); + void focusInEvent(QFocusEvent *); + void timerEvent(QTimerEvent *); + bool eventFilter(QObject *, QEvent *); + bool event(QEvent *); + void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; + +private: + Q_DECLARE_PRIVATE(QMenuBar) + Q_DISABLE_COPY(QMenuBar) + Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered()) + Q_PRIVATE_SLOT(d_func(), void _q_actionHovered()) + Q_PRIVATE_SLOT(d_func(), void _q_internalShortcutActivated(int)) + Q_PRIVATE_SLOT(d_func(), void _q_updateLayout()) + +#ifdef Q_WS_WINCE + Q_PRIVATE_SLOT(d_func(), void _q_updateDefaultAction()) +#endif + + friend class QMenu; + friend class QMenuPrivate; + friend class QWindowsStyle; + +#ifdef Q_OS_MAC + friend class QApplicationPrivate; + friend class QWidgetPrivate; + friend bool qt_mac_activate_action(MenuRef, uint, QAction::ActionEvent, bool); +#endif +}; + +#endif // QT_NO_MENUBAR + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMENUBAR_H diff --git a/src/gui/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h similarity index 78% rename from src/gui/widgets/qmenubar_p.h rename to src/widgets/widgets/qmenubar_p.h index 9a1f75884a6..5f482c228e3 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/widgets/widgets/qmenubar_p.h @@ -47,24 +47,20 @@ // ------------- // // This file is not part of the Qt API. It exists purely as an -// platformMenuBarementation detail. This header file may change from version to +// implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #ifndef QMAC_Q3MENUBAR_CPP_FILE -#include "QtGui/qstyleoption.h" +#include "QtWidgets/qstyleoption.h" #include <private/qmenu_p.h> // Mac needs what in this file! #ifdef Q_WS_WINCE #include "qguifunctions_wince.h" #endif -#ifdef Q_WS_X11 -#include "qabstractplatformmenubar_p.h" -#endif - #ifndef QT_NO_MENUBAR #ifdef Q_WS_S60 class CCoeControl; @@ -75,27 +71,18 @@ class CEikMenuBar; QT_BEGIN_NAMESPACE #ifndef QT_NO_MENUBAR -class QToolBar; class QMenuBarExtension; class QMenuBarPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QMenuBar) public: QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0), - closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0) -#ifndef Q_WS_X11 - , nativeMenuBar(-1) -#endif - , doChildEffects(false) + closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0), + nativeMenuBar(-1), doChildEffects(false), platformMenuBar(0) #ifdef QT3_SUPPORT , doAutoResize(false) #endif -#ifdef Q_WS_MAC - , mac_menubar(0) -#endif -#ifdef Q_WS_X11 - , platformMenuBar(0) -#endif + #ifdef Q_WS_WINCE , wce_menubar(0), wceClassicMenu(false) #endif @@ -106,12 +93,7 @@ public: { } ~QMenuBarPrivate() { -#ifdef Q_WS_X11 delete platformMenuBar; -#endif -#ifdef Q_WS_MAC - delete mac_menubar; -#endif #ifdef Q_WS_WINCE delete wce_menubar; #endif @@ -149,9 +131,8 @@ public: uint keyboardState : 1, altPressed : 1; QPointer<QWidget> keyboardFocusWidget; -#ifndef Q_WS_X11 + int nativeMenuBar : 3; // Only has values -1, 0, and 1 -#endif //firing of events void activateAction(QAction *, QAction::ActionEvent); @@ -187,38 +168,8 @@ public: #ifdef QT3_SUPPORT bool doAutoResize; #endif -#ifdef Q_WS_X11 - QAbstractPlatformMenuBar *platformMenuBar; -#endif -#ifdef Q_WS_MAC - //mac menubar binding - struct QMacMenuBarPrivate { - QList<QMacMenuAction*> actionItems; - OSMenuRef menu, apple_menu; - QMacMenuBarPrivate(); - ~QMacMenuBarPrivate(); + QPlatformMenuBar *platformMenuBar; - void addAction(QAction *, QAction* =0); - void addAction(QMacMenuAction *, QMacMenuAction* =0); - void syncAction(QMacMenuAction *); - inline void syncAction(QAction *a) { syncAction(findAction(a)); } - void removeAction(QMacMenuAction *); - inline void removeAction(QAction *a) { removeAction(findAction(a)); } - inline QMacMenuAction *findAction(QAction *a) { - for(int i = 0; i < actionItems.size(); i++) { - QMacMenuAction *act = actionItems[i]; - if(a == act->action) - return act; - } - return 0; - } - } *mac_menubar; - static bool macUpdateMenuBarImmediatly(); - bool macWidgetHasNativeMenubar(QWidget *widget); - void macCreateMenuBar(QWidget *); - void macDestroyMenuBar(); - OSMenuRef macMenu(); -#endif #ifdef Q_WS_WINCE void wceCreateMenuBar(QWidget *); void wceDestroyMenuBar(); @@ -237,7 +188,7 @@ public: QWceMenuBarPrivate(QMenuBarPrivate *menubar); ~QWceMenuBarPrivate(); - void addAction(QAction *, QAction* =0); + void addAction(QAction *, QWceMenuAction* =0); void addAction(QWceMenuAction *, QWceMenuAction* =0); void syncAction(QWceMenuAction *); inline void syncAction(QAction *a) { syncAction(findAction(a)); } @@ -267,7 +218,7 @@ public: QMenuBarPrivate *d; QSymbianMenuBarPrivate(QMenuBarPrivate *menubar); ~QSymbianMenuBarPrivate(); - void addAction(QAction *, QAction* =0); + void addAction(QAction *, QSymbianMenuAction* =0); void addAction(QSymbianMenuAction *, QSymbianMenuAction* =0); void syncAction(QSymbianMenuAction *); inline void syncAction(QAction *a) { syncAction(findAction(a)); } @@ -290,12 +241,6 @@ public: #ifdef QT_SOFTKEYS_ENABLED QAction *menuBarAction; #endif - -#ifdef Q_WS_X11 - void updateCornerWidgetToolBar(); - QToolBar *cornerWidgetToolBar; - QWidget *cornerWidgetContainer; -#endif }; #endif diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp similarity index 99% rename from src/gui/widgets/qplaintextedit.cpp rename to src/widgets/widgets/qplaintextedit.cpp index f2fca8fbdf1..e408a6e7aab 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -57,7 +57,6 @@ #include "qtextdocument.h" #include "private/qtextdocument_p.h" #include "qtextlist.h" -#include "private/qtextcontrol_p.h" #include <qtextformat.h> #include <qdatetime.h> @@ -434,7 +433,7 @@ qreal QPlainTextDocumentLayout::blockWidth(const QTextBlock &block) QPlainTextEditControl::QPlainTextEditControl(QPlainTextEdit *parent) - : QTextControl(parent), textEdit(parent), + : QWidgetTextControl(parent), textEdit(parent), topBlock(0) { setAcceptRichText(false); @@ -456,19 +455,19 @@ void QPlainTextEditPrivate::_q_verticalScrollbarActionTriggered(int action) { QMimeData *QPlainTextEditControl::createMimeDataFromSelection() const { QPlainTextEdit *ed = qobject_cast<QPlainTextEdit *>(parent()); if (!ed) - return QTextControl::createMimeDataFromSelection(); + return QWidgetTextControl::createMimeDataFromSelection(); return ed->createMimeDataFromSelection(); } bool QPlainTextEditControl::canInsertFromMimeData(const QMimeData *source) const { QPlainTextEdit *ed = qobject_cast<QPlainTextEdit *>(parent()); if (!ed) - return QTextControl::canInsertFromMimeData(source); + return QWidgetTextControl::canInsertFromMimeData(source); return ed->canInsertFromMimeData(source); } void QPlainTextEditControl::insertFromMimeData(const QMimeData *source) { QPlainTextEdit *ed = qobject_cast<QPlainTextEdit *>(parent()); if (!ed) - QTextControl::insertFromMimeData(source); + QWidgetTextControl::insertFromMimeData(source); else ed->insertFromMimeData(source); } @@ -1526,7 +1525,8 @@ void QPlainTextEdit::timerEvent(QTimerEvent *e) } else { const QPoint globalPos = QCursor::pos(); pos = d->viewport->mapFromGlobal(globalPos); - QMouseEvent ev(QEvent::MouseMove, pos, globalPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QMouseEvent ev(QEvent::MouseMove, pos, d->viewport->mapTo(d->viewport->topLevelWidget(), pos), globalPos, + Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); mouseMoveEvent(&ev); } int deltaY = qMax(pos.y() - visible.top(), visible.bottom() - pos.y()) - visible.height(); @@ -2356,7 +2356,7 @@ QList<QTextEdit::ExtraSelection> QPlainTextEdit::extraSelections() const QMimeData *QPlainTextEdit::createMimeDataFromSelection() const { Q_D(const QPlainTextEdit); - return d->control->QTextControl::createMimeDataFromSelection(); + return d->control->QWidgetTextControl::createMimeDataFromSelection(); } /*! @@ -2368,7 +2368,7 @@ QMimeData *QPlainTextEdit::createMimeDataFromSelection() const bool QPlainTextEdit::canInsertFromMimeData(const QMimeData *source) const { Q_D(const QPlainTextEdit); - return d->control->QTextControl::canInsertFromMimeData(source); + return d->control->QWidgetTextControl::canInsertFromMimeData(source); } /*! @@ -2381,7 +2381,7 @@ bool QPlainTextEdit::canInsertFromMimeData(const QMimeData *source) const void QPlainTextEdit::insertFromMimeData(const QMimeData *source) { Q_D(QPlainTextEdit); - d->control->QTextControl::insertFromMimeData(source); + d->control->QWidgetTextControl::insertFromMimeData(source); } /*! @@ -2513,7 +2513,6 @@ bool QPlainTextEdit::canPaste() const return d->control->canPaste(); } -#ifndef QT_NO_PRINTER /*! Convenience function to print the text edit's document to the given \a printer. This is equivalent to calling the print method on the document directly except that this @@ -2521,12 +2520,11 @@ bool QPlainTextEdit::canPaste() const \sa QTextDocument::print() */ -void QPlainTextEdit::print(QPrinter *printer) const +void QPlainTextEdit::print(QPagedPaintDevice *printer) const { Q_D(const QPlainTextEdit); d->control->print(printer); } -#endif // QT _NO_PRINTER /*! \property QPlainTextEdit::tabChangesFocus \brief whether \gui Tab changes focus or is accepted as input diff --git a/src/gui/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h similarity index 97% rename from src/gui/widgets/qplaintextedit.h rename to src/widgets/widgets/qplaintextedit.h index 75173c1f77e..d5fa71bbb73 100644 --- a/src/gui/widgets/qplaintextedit.h +++ b/src/widgets/widgets/qplaintextedit.h @@ -42,9 +42,9 @@ #ifndef QPLAINTEXTEDIT_H #define QPLAINTEXTEDIT_H -#include <QtGui/qtextedit.h> +#include <QtWidgets/qtextedit.h> -#include <QtGui/qabstractscrollarea.h> +#include <QtWidgets/qabstractscrollarea.h> #include <QtGui/qtextdocument.h> #include <QtGui/qtextoption.h> #include <QtGui/qtextcursor.h> @@ -64,9 +64,9 @@ class QTextDocument; class QMenu; class QPlainTextEditPrivate; class QMimeData; +class QPagedPaintDevice; - -class Q_GUI_EXPORT QPlainTextEdit : public QAbstractScrollArea +class Q_WIDGETS_EXPORT QPlainTextEdit : public QAbstractScrollArea { Q_OBJECT Q_DECLARE_PRIVATE(QPlainTextEdit) @@ -177,9 +177,7 @@ public: bool canPaste() const; -#ifndef QT_NO_PRINTER - void print(QPrinter *printer) const; -#endif + void print(QPagedPaintDevice *printer) const; int blockCount() const; @@ -277,7 +275,7 @@ private: class QPlainTextDocumentLayoutPrivate; -class Q_GUI_EXPORT QPlainTextDocumentLayout : public QAbstractTextDocumentLayout +class Q_WIDGETS_EXPORT QPlainTextDocumentLayout : public QAbstractTextDocumentLayout { Q_OBJECT Q_DECLARE_PRIVATE(QPlainTextDocumentLayout) diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h similarity index 96% rename from src/gui/widgets/qplaintextedit_p.h rename to src/widgets/widgets/qplaintextedit_p.h index 90a589193db..190156a684e 100644 --- a/src/gui/widgets/qplaintextedit_p.h +++ b/src/widgets/widgets/qplaintextedit_p.h @@ -55,13 +55,13 @@ #include "private/qabstractscrollarea_p.h" #include "QtGui/qtextdocumentfragment.h" -#include "QtGui/qscrollbar.h" +#include "QtWidgets/qscrollbar.h" #include "QtGui/qtextcursor.h" #include "QtGui/qtextformat.h" -#include "QtGui/qmenu.h" +#include "QtWidgets/qmenu.h" #include "QtGui/qabstracttextdocumentlayout.h" #include "QtCore/qbasictimer.h" -#include "private/qtextcontrol_p.h" +#include "private/qwidgettextcontrol_p.h" #include "qplaintextedit.h" #ifndef QT_NO_TEXTEDIT @@ -73,7 +73,7 @@ class QMimeData; class QPlainTextEdit; class ExtraArea; -class QPlainTextEditControl : public QTextControl +class QPlainTextEditControl : public QWidgetTextControl { Q_OBJECT public: @@ -86,7 +86,7 @@ public: int hitTest(const QPointF &point, Qt::HitTestAccuracy = Qt::FuzzyHit) const; QRectF blockBoundingRect(const QTextBlock &block) const; inline QRectF cursorRect(const QTextCursor &cursor) const { - QRectF r = QTextControl::cursorRect(cursor); + QRectF r = QWidgetTextControl::cursorRect(cursor); r.setLeft(qMax(r.left(), (qreal) 0.)); return r; } diff --git a/src/gui/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp similarity index 100% rename from src/gui/widgets/qprogressbar.cpp rename to src/widgets/widgets/qprogressbar.cpp diff --git a/src/gui/widgets/qprogressbar.h b/src/widgets/widgets/qprogressbar.h similarity index 98% rename from src/gui/widgets/qprogressbar.h rename to src/widgets/widgets/qprogressbar.h index 6547f79ff10..ac34f64a2e6 100644 --- a/src/gui/widgets/qprogressbar.h +++ b/src/widgets/widgets/qprogressbar.h @@ -42,7 +42,7 @@ #ifndef QPROGRESSBAR_H #define QPROGRESSBAR_H -#include <QtGui/qframe.h> +#include <QtWidgets/qframe.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QProgressBarPrivate; class QStyleOptionProgressBar; -class Q_GUI_EXPORT QProgressBar : public QWidget +class Q_WIDGETS_EXPORT QProgressBar : public QWidget { Q_OBJECT Q_ENUMS(Direction) diff --git a/src/gui/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp similarity index 100% rename from src/gui/widgets/qpushbutton.cpp rename to src/widgets/widgets/qpushbutton.cpp diff --git a/src/gui/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h similarity index 97% rename from src/gui/widgets/qpushbutton.h rename to src/widgets/widgets/qpushbutton.h index 04673d58a1f..4f1f85dea40 100644 --- a/src/gui/widgets/qpushbutton.h +++ b/src/widgets/widgets/qpushbutton.h @@ -42,7 +42,7 @@ #ifndef QPUSHBUTTON_H #define QPUSHBUTTON_H -#include <QtGui/qabstractbutton.h> +#include <QtWidgets/qabstractbutton.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ class QPushButtonPrivate; class QMenu; class QStyleOptionButton; -class Q_GUI_EXPORT QPushButton : public QAbstractButton +class Q_WIDGETS_EXPORT QPushButton : public QAbstractButton { Q_OBJECT diff --git a/src/gui/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h similarity index 100% rename from src/gui/widgets/qpushbutton_p.h rename to src/widgets/widgets/qpushbutton_p.h diff --git a/src/gui/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp similarity index 100% rename from src/gui/widgets/qradiobutton.cpp rename to src/widgets/widgets/qradiobutton.cpp diff --git a/src/gui/widgets/qradiobutton.h b/src/widgets/widgets/qradiobutton.h similarity index 96% rename from src/gui/widgets/qradiobutton.h rename to src/widgets/widgets/qradiobutton.h index 2e29876cf52..e3837253c83 100644 --- a/src/gui/widgets/qradiobutton.h +++ b/src/widgets/widgets/qradiobutton.h @@ -42,7 +42,7 @@ #ifndef QRADIOBUTTON_H #define QRADIOBUTTON_H -#include <QtGui/qabstractbutton.h> +#include <QtWidgets/qabstractbutton.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) class QRadioButtonPrivate; class QStyleOptionButton; -class Q_GUI_EXPORT QRadioButton : public QAbstractButton +class Q_WIDGETS_EXPORT QRadioButton : public QAbstractButton { Q_OBJECT diff --git a/src/gui/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp similarity index 100% rename from src/gui/widgets/qrubberband.cpp rename to src/widgets/widgets/qrubberband.cpp diff --git a/src/gui/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h similarity index 97% rename from src/gui/widgets/qrubberband.h rename to src/widgets/widgets/qrubberband.h index 7b94996d418..3d300047707 100644 --- a/src/gui/widgets/qrubberband.h +++ b/src/widgets/widgets/qrubberband.h @@ -42,7 +42,7 @@ #ifndef QRUBBERBAND_H #define QRUBBERBAND_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QRubberBandPrivate; class QStyleOptionRubberBand; -class Q_GUI_EXPORT QRubberBand : public QWidget +class Q_WIDGETS_EXPORT QRubberBand : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp similarity index 99% rename from src/gui/widgets/qscrollarea.cpp rename to src/widgets/widgets/qscrollarea.cpp index 314f4fe9d21..5d03c07472d 100644 --- a/src/gui/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -465,9 +465,9 @@ void QScrollArea::ensureWidgetVisible(QWidget *childWidget, int xmargin, int yma if (!d->widget->isAncestorOf(childWidget)) return; - const QRect microFocus = childWidget->inputMethodQuery(Qt::ImMicroFocus).toRect(); + const QRect microFocus = childWidget->inputMethodQuery(Qt::ImCursorRectangle).toRect(); const QRect defaultMicroFocus = - childWidget->QWidget::inputMethodQuery(Qt::ImMicroFocus).toRect(); + childWidget->QWidget::inputMethodQuery(Qt::ImCursorRectangle).toRect(); QRect focusRect = (microFocus != defaultMicroFocus) ? QRect(childWidget->mapTo(d->widget, microFocus.topLeft()), microFocus.size()) : QRect(childWidget->mapTo(d->widget, QPoint(0,0)), childWidget->size()); diff --git a/src/gui/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h similarity index 96% rename from src/gui/widgets/qscrollarea.h rename to src/widgets/widgets/qscrollarea.h index 4f824d8438f..2d62cc1bc47 100644 --- a/src/gui/widgets/qscrollarea.h +++ b/src/widgets/widgets/qscrollarea.h @@ -42,7 +42,7 @@ #ifndef QSCROLLAREA_H #define QSCROLLAREA_H -#include <QtGui/qabstractscrollarea.h> +#include <QtWidgets/qabstractscrollarea.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QScrollAreaPrivate; -class Q_GUI_EXPORT QScrollArea : public QAbstractScrollArea +class Q_WIDGETS_EXPORT QScrollArea : public QAbstractScrollArea { Q_OBJECT Q_PROPERTY(bool widgetResizable READ widgetResizable WRITE setWidgetResizable) diff --git a/src/gui/widgets/qscrollarea_p.h b/src/widgets/widgets/qscrollarea_p.h similarity index 98% rename from src/gui/widgets/qscrollarea_p.h rename to src/widgets/widgets/qscrollarea_p.h index a7eab6cdfae..0e5e21b7c01 100644 --- a/src/gui/widgets/qscrollarea_p.h +++ b/src/widgets/widgets/qscrollarea_p.h @@ -56,7 +56,7 @@ #ifndef QT_NO_SCROLLAREA #include "private/qabstractscrollarea_p.h" -#include <QtGui/qscrollbar.h> +#include <QtWidgets/qscrollbar.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp similarity index 99% rename from src/gui/widgets/qscrollbar.cpp rename to src/widgets/widgets/qscrollbar.cpp index 72f461fe635..534ff6e619e 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -752,7 +752,7 @@ void QScrollBar::hideEvent(QHideEvent *) /*! \internal Returns the style option for scroll bar. */ -Q_GUI_EXPORT QStyleOptionSlider qt_qscrollbarStyleOption(QScrollBar *scrollbar) +Q_WIDGETS_EXPORT QStyleOptionSlider qt_qscrollbarStyleOption(QScrollBar *scrollbar) { QStyleOptionSlider opt; scrollbar->initStyleOption(&opt); diff --git a/src/gui/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h similarity index 93% rename from src/gui/widgets/qscrollbar.h rename to src/widgets/widgets/qscrollbar.h index eb01b669b4d..2fd00de5227 100644 --- a/src/gui/widgets/qscrollbar.h +++ b/src/widgets/widgets/qscrollbar.h @@ -42,8 +42,8 @@ #ifndef QSCROLLBAR_H #define QSCROLLBAR_H -#include <QtGui/qwidget.h> -#include <QtGui/qabstractslider.h> +#include <QtWidgets/qwidget.h> +#include <QtWidgets/qabstractslider.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ QT_MODULE(Gui) class QScrollBarPrivate; class QStyleOptionSlider; -class Q_GUI_EXPORT QScrollBar : public QAbstractSlider +class Q_WIDGETS_EXPORT QScrollBar : public QAbstractSlider { Q_OBJECT public: @@ -89,7 +89,7 @@ public: #endif private: - friend Q_GUI_EXPORT QStyleOptionSlider qt_qscrollbarStyleOption(QScrollBar *scrollBar); + friend Q_WIDGETS_EXPORT QStyleOptionSlider qt_qscrollbarStyleOption(QScrollBar *scrollBar); Q_DISABLE_COPY(QScrollBar) Q_DECLARE_PRIVATE(QScrollBar) diff --git a/src/gui/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp similarity index 99% rename from src/gui/widgets/qsizegrip.cpp rename to src/widgets/widgets/qsizegrip.cpp index dd77a2fa1c5..10e99ba1351 100644 --- a/src/gui/widgets/qsizegrip.cpp +++ b/src/widgets/widgets/qsizegrip.cpp @@ -62,7 +62,7 @@ #endif #include <private/qwidget_p.h> -#include <QtGui/qabstractscrollarea.h> +#include <QtWidgets/qabstractscrollarea.h> #define SZ_SIZEBOTTOMRIGHT 0xf008 #define SZ_SIZEBOTTOMLEFT 0xf007 diff --git a/src/gui/widgets/qsizegrip.h b/src/widgets/widgets/qsizegrip.h similarity index 97% rename from src/gui/widgets/qsizegrip.h rename to src/widgets/widgets/qsizegrip.h index 3d2dcce60eb..9e75f384579 100644 --- a/src/gui/widgets/qsizegrip.h +++ b/src/widgets/widgets/qsizegrip.h @@ -42,7 +42,7 @@ #ifndef QSIZEGRIP_H #define QSIZEGRIP_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -52,7 +52,7 @@ QT_MODULE(Gui) #ifndef QT_NO_SIZEGRIP class QSizeGripPrivate; -class Q_GUI_EXPORT QSizeGrip : public QWidget +class Q_WIDGETS_EXPORT QSizeGrip : public QWidget { Q_OBJECT public: diff --git a/src/gui/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp similarity index 98% rename from src/gui/widgets/qslider.cpp rename to src/widgets/widgets/qslider.cpp index 026926a8a3b..2858b987819 100644 --- a/src/gui/widgets/qslider.cpp +++ b/src/widgets/widgets/qslider.cpp @@ -602,6 +602,20 @@ QSlider::TickPosition QSlider::tickPosition() const return d_func()->tickPosition; } +/*! + \fn TickPosition QSlider::tickmarks() const + \compat + + Use tickPosition() instead. +*/ + +/*! + \fn QSlider::setTickmarks(TickPosition position) + \compat + + Use setTickPosition() instead. +*/ + /*! \property QSlider::tickInterval \brief the interval between tickmarks @@ -640,7 +654,7 @@ int QSlider::tickInterval() const /*! \internal Returns the style option for slider. */ -Q_GUI_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider) +Q_WIDGETS_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider) { QStyleOptionSlider sliderOption; slider->initStyleOption(&sliderOption); diff --git a/src/gui/widgets/qslider.h b/src/widgets/widgets/qslider.h similarity index 95% rename from src/gui/widgets/qslider.h rename to src/widgets/widgets/qslider.h index 4e746ea0dd6..907548fcb25 100644 --- a/src/gui/widgets/qslider.h +++ b/src/widgets/widgets/qslider.h @@ -42,7 +42,7 @@ #ifndef QSLIDER_H #define QSLIDER_H -#include <QtGui/qabstractslider.h> +#include <QtWidgets/qabstractslider.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QSliderPrivate; class QStyleOptionSlider; -class Q_GUI_EXPORT QSlider : public QAbstractSlider +class Q_WIDGETS_EXPORT QSlider : public QAbstractSlider { Q_OBJECT @@ -119,7 +119,7 @@ public Q_SLOTS: #endif private: - friend Q_GUI_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider); + friend Q_WIDGETS_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider); Q_DISABLE_COPY(QSlider) Q_DECLARE_PRIVATE(QSlider) diff --git a/src/gui/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp similarity index 100% rename from src/gui/widgets/qspinbox.cpp rename to src/widgets/widgets/qspinbox.cpp diff --git a/src/gui/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h similarity index 97% rename from src/gui/widgets/qspinbox.h rename to src/widgets/widgets/qspinbox.h index 9f054da224e..1421b1d6d2a 100644 --- a/src/gui/widgets/qspinbox.h +++ b/src/widgets/widgets/qspinbox.h @@ -42,7 +42,7 @@ #ifndef QSPINBOX_H #define QSPINBOX_H -#include <QtGui/qabstractspinbox.h> +#include <QtWidgets/qabstractspinbox.h> QT_BEGIN_HEADER @@ -53,7 +53,7 @@ QT_MODULE(Gui) #ifndef QT_NO_SPINBOX class QSpinBoxPrivate; -class Q_GUI_EXPORT QSpinBox : public QAbstractSpinBox +class Q_WIDGETS_EXPORT QSpinBox : public QAbstractSpinBox { Q_OBJECT @@ -123,7 +123,7 @@ private: }; class QDoubleSpinBoxPrivate; -class Q_GUI_EXPORT QDoubleSpinBox : public QAbstractSpinBox +class Q_WIDGETS_EXPORT QDoubleSpinBox : public QAbstractSpinBox { Q_OBJECT diff --git a/src/gui/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp similarity index 100% rename from src/gui/widgets/qsplashscreen.cpp rename to src/widgets/widgets/qsplashscreen.cpp diff --git a/src/gui/widgets/qsplashscreen.h b/src/widgets/widgets/qsplashscreen.h similarity index 97% rename from src/gui/widgets/qsplashscreen.h rename to src/widgets/widgets/qsplashscreen.h index 31b24859bf1..0faaa628c88 100644 --- a/src/gui/widgets/qsplashscreen.h +++ b/src/widgets/widgets/qsplashscreen.h @@ -43,7 +43,7 @@ #define QSPLASHSCREEN_H #include <QtGui/qpixmap.h> -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) #ifndef QT_NO_SPLASHSCREEN class QSplashScreenPrivate; -class Q_GUI_EXPORT QSplashScreen : public QWidget +class Q_WIDGETS_EXPORT QSplashScreen : public QWidget { Q_OBJECT public: diff --git a/src/gui/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp similarity index 100% rename from src/gui/widgets/qsplitter.cpp rename to src/widgets/widgets/qsplitter.cpp diff --git a/src/gui/widgets/qsplitter.h b/src/widgets/widgets/qsplitter.h similarity index 94% rename from src/gui/widgets/qsplitter.h rename to src/widgets/widgets/qsplitter.h index df748cc5fab..09d7d3589d6 100644 --- a/src/gui/widgets/qsplitter.h +++ b/src/widgets/widgets/qsplitter.h @@ -42,8 +42,8 @@ #ifndef QSPLITTER_H #define QSPLITTER_H -#include <QtGui/qframe.h> -#include <QtGui/qsizepolicy.h> +#include <QtWidgets/qframe.h> +#include <QtWidgets/qsizepolicy.h> QT_BEGIN_HEADER @@ -59,7 +59,7 @@ template <typename T> class QList; class QSplitterHandle; -class Q_GUI_EXPORT QSplitter : public QFrame +class Q_WIDGETS_EXPORT QSplitter : public QFrame { Q_OBJECT @@ -149,13 +149,13 @@ private: //#ifdef QT3_SUPPORT #ifndef QT_NO_TEXTSTREAM -Q_GUI_EXPORT QTextStream& operator<<(QTextStream&, const QSplitter&); -Q_GUI_EXPORT QTextStream& operator>>(QTextStream&, QSplitter&); +Q_WIDGETS_EXPORT QTextStream& operator<<(QTextStream&, const QSplitter&); +Q_WIDGETS_EXPORT QTextStream& operator>>(QTextStream&, QSplitter&); #endif //#endif class QSplitterHandlePrivate; -class Q_GUI_EXPORT QSplitterHandle : public QWidget +class Q_WIDGETS_EXPORT QSplitterHandle : public QWidget { Q_OBJECT public: diff --git a/src/gui/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h similarity index 100% rename from src/gui/widgets/qsplitter_p.h rename to src/widgets/widgets/qsplitter_p.h diff --git a/src/gui/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp similarity index 100% rename from src/gui/widgets/qstackedwidget.cpp rename to src/widgets/widgets/qstackedwidget.cpp diff --git a/src/gui/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h similarity index 97% rename from src/gui/widgets/qstackedwidget.h rename to src/widgets/widgets/qstackedwidget.h index 63aabcc416a..e0275fe27f2 100644 --- a/src/gui/widgets/qstackedwidget.h +++ b/src/widgets/widgets/qstackedwidget.h @@ -42,7 +42,7 @@ #ifndef QSTACKEDWIDGET_H #define QSTACKEDWIDGET_H -#include <QtGui/qframe.h> +#include <QtWidgets/qframe.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QStackedWidgetPrivate; -class Q_GUI_EXPORT QStackedWidget : public QFrame +class Q_WIDGETS_EXPORT QStackedWidget : public QFrame { Q_OBJECT diff --git a/src/gui/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp similarity index 100% rename from src/gui/widgets/qstatusbar.cpp rename to src/widgets/widgets/qstatusbar.cpp diff --git a/src/gui/widgets/qstatusbar.h b/src/widgets/widgets/qstatusbar.h similarity index 97% rename from src/gui/widgets/qstatusbar.h rename to src/widgets/widgets/qstatusbar.h index ad5473ddaa0..32dfed8f7ba 100644 --- a/src/gui/widgets/qstatusbar.h +++ b/src/widgets/widgets/qstatusbar.h @@ -42,7 +42,7 @@ #ifndef QSTATUSBAR_H #define QSTATUSBAR_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -54,7 +54,7 @@ QT_MODULE(Gui) class QStatusBarPrivate; -class Q_GUI_EXPORT QStatusBar: public QWidget +class Q_WIDGETS_EXPORT QStatusBar: public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp similarity index 100% rename from src/gui/widgets/qtabbar.cpp rename to src/widgets/widgets/qtabbar.cpp diff --git a/src/gui/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h similarity index 98% rename from src/gui/widgets/qtabbar.h rename to src/widgets/widgets/qtabbar.h index fd69d625d8d..3e2ff3e9d08 100644 --- a/src/gui/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -42,7 +42,7 @@ #ifndef QTABBAR_H #define QTABBAR_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ class QIcon; class QTabBarPrivate; class QStyleOptionTab; -class Q_GUI_EXPORT QTabBar: public QWidget +class Q_WIDGETS_EXPORT QTabBar: public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h similarity index 100% rename from src/gui/widgets/qtabbar_p.h rename to src/widgets/widgets/qtabbar_p.h diff --git a/src/gui/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp similarity index 100% rename from src/gui/widgets/qtabwidget.cpp rename to src/widgets/widgets/qtabwidget.cpp diff --git a/src/gui/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h similarity index 98% rename from src/gui/widgets/qtabwidget.h rename to src/widgets/widgets/qtabwidget.h index 524767ecbb5..899b7a5dba9 100644 --- a/src/gui/widgets/qtabwidget.h +++ b/src/widgets/widgets/qtabwidget.h @@ -42,8 +42,8 @@ #ifndef QTABWIDGET_H #define QTABWIDGET_H -#include <QtGui/qwidget.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qwidget.h> +#include <QtWidgets/qicon.h> QT_BEGIN_HEADER @@ -57,7 +57,7 @@ class QTabBar; class QTabWidgetPrivate; class QStyleOptionTabWidgetFrame; -class Q_GUI_EXPORT QTabWidget : public QWidget +class Q_WIDGETS_EXPORT QTabWidget : public QWidget { Q_OBJECT Q_ENUMS(TabPosition TabShape) diff --git a/src/gui/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp similarity index 100% rename from src/gui/widgets/qtextbrowser.cpp rename to src/widgets/widgets/qtextbrowser.cpp diff --git a/src/gui/widgets/qtextbrowser.h b/src/widgets/widgets/qtextbrowser.h similarity index 98% rename from src/gui/widgets/qtextbrowser.h rename to src/widgets/widgets/qtextbrowser.h index 46c471bb7e2..3f488975ec1 100644 --- a/src/gui/widgets/qtextbrowser.h +++ b/src/widgets/widgets/qtextbrowser.h @@ -42,7 +42,7 @@ #ifndef QTEXTBROWSER_H #define QTEXTBROWSER_H -#include <QtGui/qtextedit.h> +#include <QtWidgets/qtextedit.h> #include <QtCore/qurl.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QTextBrowserPrivate; -class Q_GUI_EXPORT QTextBrowser : public QTextEdit +class Q_WIDGETS_EXPORT QTextBrowser : public QTextEdit { Q_OBJECT diff --git a/src/gui/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp similarity index 98% rename from src/gui/widgets/qtextedit.cpp rename to src/widgets/widgets/qtextedit.cpp index 26700891339..67be9dbed31 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -58,7 +58,7 @@ #include "qtextdocument.h" #include "private/qtextdocument_p.h" #include "qtextlist.h" -#include "private/qtextcontrol_p.h" +#include "private/qwidgettextcontrol_p.h" #include <qtextformat.h> #include <qdatetime.h> @@ -79,27 +79,27 @@ static inline bool shouldEnableInputMethod(QTextEdit *textedit) return !textedit->isReadOnly(); } -class QTextEditControl : public QTextControl +class QTextEditControl : public QWidgetTextControl { public: - inline QTextEditControl(QObject *parent) : QTextControl(parent) {} + inline QTextEditControl(QObject *parent) : QWidgetTextControl(parent) {} virtual QMimeData *createMimeDataFromSelection() const { QTextEdit *ed = qobject_cast<QTextEdit *>(parent()); if (!ed) - return QTextControl::createMimeDataFromSelection(); + return QWidgetTextControl::createMimeDataFromSelection(); return ed->createMimeDataFromSelection(); } virtual bool canInsertFromMimeData(const QMimeData *source) const { QTextEdit *ed = qobject_cast<QTextEdit *>(parent()); if (!ed) - return QTextControl::canInsertFromMimeData(source); + return QWidgetTextControl::canInsertFromMimeData(source); return ed->canInsertFromMimeData(source); } virtual void insertFromMimeData(const QMimeData *source) { QTextEdit *ed = qobject_cast<QTextEdit *>(parent()); if (!ed) - QTextControl::insertFromMimeData(source); + QWidgetTextControl::insertFromMimeData(source); else ed->insertFromMimeData(source); } @@ -181,6 +181,7 @@ void QTextEditPrivate::init(const QString &html) q->setFocusPolicy(Qt::WheelFocus); q->setAttribute(Qt::WA_KeyCompression); q->setAttribute(Qt::WA_InputMethodEnabled); + q->setInputMethodHints(Qt::ImhMultiLine); #ifndef QT_NO_CURSOR viewport->setCursor(Qt::IBeamCursor); @@ -235,7 +236,7 @@ void QTextEditPrivate::pageUpDown(QTextCursor::MoveOperation op, QTextCursor::Mo } #ifndef QT_NO_SCROLLBAR -static QSize documentSize(QTextControl *control) +static QSize documentSize(QWidgetTextControl *control) { QTextDocument *doc = control->document(); QAbstractTextDocumentLayout *layout = doc->documentLayout(); @@ -1086,7 +1087,7 @@ void QTextEdit::timerEvent(QTimerEvent *e) } else { const QPoint globalPos = QCursor::pos(); pos = d->viewport->mapFromGlobal(globalPos); - QMouseEvent ev(QEvent::MouseMove, pos, globalPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); + QMouseEvent ev(QEvent::MouseMove, pos, mapTo(topLevelWidget(), pos), globalPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); mouseMoveEvent(&ev); } int deltaY = qMax(pos.y() - visible.top(), visible.bottom() - pos.y()) - visible.height(); @@ -2019,7 +2020,7 @@ QList<QTextEdit::ExtraSelection> QTextEdit::extraSelections() const QMimeData *QTextEdit::createMimeDataFromSelection() const { Q_D(const QTextEdit); - return d->control->QTextControl::createMimeDataFromSelection(); + return d->control->QWidgetTextControl::createMimeDataFromSelection(); } /*! @@ -2034,7 +2035,7 @@ QMimeData *QTextEdit::createMimeDataFromSelection() const bool QTextEdit::canInsertFromMimeData(const QMimeData *source) const { Q_D(const QTextEdit); - return d->control->QTextControl::canInsertFromMimeData(source); + return d->control->QWidgetTextControl::canInsertFromMimeData(source); } /*! @@ -2049,7 +2050,7 @@ bool QTextEdit::canInsertFromMimeData(const QMimeData *source) const void QTextEdit::insertFromMimeData(const QMimeData *source) { Q_D(QTextEdit); - d->control->QTextControl::insertFromMimeData(source); + d->control->QWidgetTextControl::insertFromMimeData(source); } /*! @@ -2285,7 +2286,6 @@ bool QTextEdit::canPaste() const return d->control->canPaste(); } -#ifndef QT_NO_PRINTER /*! \since 4.3 Convenience function to print the text edit's document to the given \a printer. This @@ -2294,12 +2294,11 @@ bool QTextEdit::canPaste() const \sa QTextDocument::print() */ -void QTextEdit::print(QPrinter *printer) const +void QTextEdit::print(QPagedPaintDevice *printer) const { Q_D(const QTextEdit); d->control->print(printer); } -#endif // QT _NO_PRINTER /*! \property QTextEdit::tabChangesFocus \brief whether \gui Tab changes focus or is accepted as input diff --git a/src/gui/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h similarity index 98% rename from src/gui/widgets/qtextedit.h rename to src/widgets/widgets/qtextedit.h index 3c56ef1cd39..69f5ac23d51 100644 --- a/src/gui/widgets/qtextedit.h +++ b/src/widgets/widgets/qtextedit.h @@ -42,7 +42,7 @@ #ifndef QTEXTEDIT_H #define QTEXTEDIT_H -#include <QtGui/qabstractscrollarea.h> +#include <QtWidgets/qabstractscrollarea.h> #include <QtGui/qtextdocument.h> #include <QtGui/qtextoption.h> #include <QtGui/qtextcursor.h> @@ -66,8 +66,9 @@ class QTextDocument; class QMenu; class QTextEditPrivate; class QMimeData; +class QPagedPaintDevice; -class Q_GUI_EXPORT QTextEdit : public QAbstractScrollArea +class Q_WIDGETS_EXPORT QTextEdit : public QAbstractScrollArea { Q_OBJECT Q_DECLARE_PRIVATE(QTextEdit) @@ -90,6 +91,7 @@ class Q_GUI_EXPORT QTextEdit : public QAbstractScrollArea Q_PROPERTY(bool acceptRichText READ acceptRichText WRITE setAcceptRichText) Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) + Q_PROPERTY(QObject *document READ document) public: enum LineWrapMode { NoWrap, @@ -231,9 +233,7 @@ public: bool canPaste() const; -#ifndef QT_NO_PRINTER - void print(QPrinter *printer) const; -#endif + void print(QPagedPaintDevice *printer) const; public Q_SLOTS: void setFontPointSize(qreal s); @@ -416,7 +416,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_ensureVisible(const QRectF &)) friend class QTextEditControl; friend class QTextDocument; - friend class QTextControl; + friend class QWidgetTextControl; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QTextEdit::AutoFormatting) diff --git a/src/gui/widgets/qtextedit_p.h b/src/widgets/widgets/qtextedit_p.h similarity index 96% rename from src/gui/widgets/qtextedit_p.h rename to src/widgets/widgets/qtextedit_p.h index 98431f87bab..3512c80ac4e 100644 --- a/src/gui/widgets/qtextedit_p.h +++ b/src/widgets/widgets/qtextedit_p.h @@ -55,14 +55,14 @@ #include "private/qabstractscrollarea_p.h" #include "QtGui/qtextdocumentfragment.h" -#include "QtGui/qscrollbar.h" +#include "QtWidgets/qscrollbar.h" #include "QtGui/qtextcursor.h" #include "QtGui/qtextformat.h" -#include "QtGui/qmenu.h" +#include "QtWidgets/qmenu.h" #include "QtGui/qabstracttextdocumentlayout.h" #include "QtCore/qbasictimer.h" #include "QtCore/qurl.h" -#include "private/qtextcontrol_p.h" +#include "private/qwidgettextcontrol_p.h" #include "qtextedit.h" QT_BEGIN_NAMESPACE @@ -106,7 +106,7 @@ public: virtual QUrl resolveUrl(const QUrl &url) const { return url; } - QTextControl *control; + QWidgetTextControl *control; QTextEdit::AutoFormatting autoFormatting; bool tabChangesFocus; diff --git a/src/gui/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp similarity index 99% rename from src/gui/widgets/qtoolbar.cpp rename to src/widgets/widgets/qtoolbar.cpp index e0e8ce603a8..7527baa518f 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -354,7 +354,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) startDrag(moving); if (!moving && !wasDragging) { -#ifdef Q_OS_WIN +#ifdef Q_WS_WIN grabMouseWhileInWindow(); #else q->grabMouse(); diff --git a/src/gui/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h similarity index 98% rename from src/gui/widgets/qtoolbar.h rename to src/widgets/widgets/qtoolbar.h index a39ff3c1212..98c44f059a1 100644 --- a/src/gui/widgets/qtoolbar.h +++ b/src/widgets/widgets/qtoolbar.h @@ -42,7 +42,7 @@ #ifndef QDYNAMICTOOLBAR_H #define QDYNAMICTOOLBAR_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -59,7 +59,7 @@ class QIcon; class QMainWindow; class QStyleOptionToolBar; -class Q_GUI_EXPORT QToolBar : public QWidget +class Q_WIDGETS_EXPORT QToolBar : public QWidget { Q_OBJECT diff --git a/src/gui/widgets/qtoolbar_p.h b/src/widgets/widgets/qtoolbar_p.h similarity index 99% rename from src/gui/widgets/qtoolbar_p.h rename to src/widgets/widgets/qtoolbar_p.h index cd278cfea09..70f1b6dca14 100644 --- a/src/gui/widgets/qtoolbar_p.h +++ b/src/widgets/widgets/qtoolbar_p.h @@ -54,7 +54,7 @@ // #include "qtoolbar.h" -#include "QtGui/qaction.h" +#include "QtWidgets/qaction.h" #include "private/qwidget_p.h" #include <QtCore/qbasictimer.h> diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp similarity index 100% rename from src/gui/widgets/qtoolbararealayout.cpp rename to src/widgets/widgets/qtoolbararealayout.cpp diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/widgets/widgets/qtoolbararealayout_p.h similarity index 100% rename from src/gui/widgets/qtoolbararealayout_p.h rename to src/widgets/widgets/qtoolbararealayout_p.h diff --git a/src/gui/widgets/qtoolbarextension.cpp b/src/widgets/widgets/qtoolbarextension.cpp similarity index 100% rename from src/gui/widgets/qtoolbarextension.cpp rename to src/widgets/widgets/qtoolbarextension.cpp diff --git a/src/gui/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h similarity index 98% rename from src/gui/widgets/qtoolbarextension_p.h rename to src/widgets/widgets/qtoolbarextension_p.h index b986d36efd7..d7f28bf0f3f 100644 --- a/src/gui/widgets/qtoolbarextension_p.h +++ b/src/widgets/widgets/qtoolbarextension_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include "QtGui/qtoolbutton.h" +#include "QtWidgets/qtoolbutton.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp similarity index 100% rename from src/gui/widgets/qtoolbarlayout.cpp rename to src/widgets/widgets/qtoolbarlayout.cpp diff --git a/src/gui/widgets/qtoolbarlayout_p.h b/src/widgets/widgets/qtoolbarlayout_p.h similarity index 99% rename from src/gui/widgets/qtoolbarlayout_p.h rename to src/widgets/widgets/qtoolbarlayout_p.h index e6e46706105..4e4a8eab844 100644 --- a/src/gui/widgets/qtoolbarlayout_p.h +++ b/src/widgets/widgets/qtoolbarlayout_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include <QtGui/qlayout.h> +#include <QtWidgets/qlayout.h> #include <private/qlayoutengine_p.h> #include <QVector> diff --git a/src/gui/widgets/qtoolbarseparator.cpp b/src/widgets/widgets/qtoolbarseparator.cpp similarity index 100% rename from src/gui/widgets/qtoolbarseparator.cpp rename to src/widgets/widgets/qtoolbarseparator.cpp diff --git a/src/gui/widgets/qtoolbarseparator_p.h b/src/widgets/widgets/qtoolbarseparator_p.h similarity index 98% rename from src/gui/widgets/qtoolbarseparator_p.h rename to src/widgets/widgets/qtoolbarseparator_p.h index a14f6a2104b..0f1eb05abcf 100644 --- a/src/gui/widgets/qtoolbarseparator_p.h +++ b/src/widgets/widgets/qtoolbarseparator_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include "QtGui/qwidget.h" +#include "QtWidgets/qwidget.h" QT_BEGIN_NAMESPACE diff --git a/src/gui/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp similarity index 100% rename from src/gui/widgets/qtoolbox.cpp rename to src/widgets/widgets/qtoolbox.cpp diff --git a/src/gui/widgets/qtoolbox.h b/src/widgets/widgets/qtoolbox.h similarity index 97% rename from src/gui/widgets/qtoolbox.h rename to src/widgets/widgets/qtoolbox.h index f451793a958..b08d37e4247 100644 --- a/src/gui/widgets/qtoolbox.h +++ b/src/widgets/widgets/qtoolbox.h @@ -42,8 +42,8 @@ #ifndef QTOOLBOX_H #define QTOOLBOX_H -#include <QtGui/qframe.h> -#include <QtGui/qicon.h> +#include <QtWidgets/qframe.h> +#include <QtWidgets/qicon.h> QT_BEGIN_HEADER @@ -55,7 +55,7 @@ QT_MODULE(Gui) class QToolBoxPrivate; -class Q_GUI_EXPORT QToolBox : public QFrame +class Q_WIDGETS_EXPORT QToolBox : public QFrame { Q_OBJECT Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) diff --git a/src/gui/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp similarity index 100% rename from src/gui/widgets/qtoolbutton.cpp rename to src/widgets/widgets/qtoolbutton.cpp diff --git a/src/gui/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h similarity index 98% rename from src/gui/widgets/qtoolbutton.h rename to src/widgets/widgets/qtoolbutton.h index f6ac37069d8..7d1ff13409f 100644 --- a/src/gui/widgets/qtoolbutton.h +++ b/src/widgets/widgets/qtoolbutton.h @@ -42,7 +42,7 @@ #ifndef QTOOLBUTTON_H #define QTOOLBUTTON_H -#include <QtGui/qabstractbutton.h> +#include <QtWidgets/qabstractbutton.h> QT_BEGIN_HEADER @@ -56,7 +56,7 @@ class QToolButtonPrivate; class QMenu; class QStyleOptionToolButton; -class Q_GUI_EXPORT QToolButton : public QAbstractButton +class Q_WIDGETS_EXPORT QToolButton : public QAbstractButton { Q_OBJECT Q_ENUMS(Qt::ToolButtonStyle Qt::ArrowType ToolButtonPopupMode) diff --git a/src/gui/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp similarity index 98% rename from src/gui/widgets/qwidgetanimator.cpp rename to src/widgets/widgets/qwidgetanimator.cpp index 56e8a1ede84..9df7dfc0eb1 100644 --- a/src/gui/widgets/qwidgetanimator.cpp +++ b/src/widgets/widgets/qwidgetanimator.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include <QtCore/qpropertyanimation.h> -#include <QtGui/qwidget.h> -#include <QtGui/private/qmainwindowlayout_p.h> +#include <QtWidgets/qwidget.h> +#include <private/qmainwindowlayout_p.h> #include "qwidgetanimator_p.h" diff --git a/src/gui/widgets/qwidgetanimator_p.h b/src/widgets/widgets/qwidgetanimator_p.h similarity index 100% rename from src/gui/widgets/qwidgetanimator_p.h rename to src/widgets/widgets/qwidgetanimator_p.h diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp new file mode 100644 index 00000000000..790ed73f998 --- /dev/null +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -0,0 +1,1862 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwidgetlinecontrol_p.h" + +#ifndef QT_NO_LINEEDIT + +#include "qabstractitemview.h" +#include "qclipboard.h" +#ifndef QT_NO_ACCESSIBILITY +#include "qaccessible.h" +#endif +#ifndef QT_NO_IM +#include "qinputcontext.h" +#include "qlist.h" +#endif +#include "qapplication.h" +#ifndef QT_NO_GRAPHICSVIEW +#include "qgraphicssceneevent.h" +#endif + +QT_BEGIN_NAMESPACE + +/*! + \internal + + Updates the internal text layout. Returns the ascent of the + created QTextLine. +*/ +int QWidgetLineControl::redoTextLayout() const +{ + m_textLayout.clearLayout(); + + m_textLayout.beginLayout(); + QTextLine l = m_textLayout.createLine(); + m_textLayout.endLayout(); + +#if defined(Q_WS_MAC) + if (m_threadChecks) + m_textLayoutThread = QThread::currentThread(); +#endif + + return qRound(l.ascent()); +} + +/*! + \internal + + Updates the display text based of the current edit text + If the text has changed will emit displayTextChanged() +*/ +void QWidgetLineControl::updateDisplayText(bool forceUpdate) +{ + QString orig = m_textLayout.text(); + QString str; + if (m_echoMode == QLineEdit::NoEcho) + str = QString::fromLatin1(""); + else + str = m_text; + + if (m_echoMode == QLineEdit::Password || (m_echoMode == QLineEdit::PasswordEchoOnEdit + && !m_passwordEchoEditing)) + str.fill(m_passwordCharacter); + + // replace certain non-printable characters with spaces (to avoid + // drawing boxes when using fonts that don't have glyphs for such + // characters) + QChar* uc = str.data(); + for (int i = 0; i < (int)str.length(); ++i) { + if ((uc[i] < 0x20 && uc[i] != 0x09) + || uc[i] == QChar::LineSeparator + || uc[i] == QChar::ParagraphSeparator + || uc[i] == QChar::ObjectReplacementCharacter) + uc[i] = QChar(0x0020); + } + + m_textLayout.setText(str); + + QTextOption option = m_textLayout.textOption(); + option.setTextDirection(m_layoutDirection); + option.setFlags(QTextOption::IncludeTrailingSpaces); + m_textLayout.setTextOption(option); + + m_ascent = redoTextLayout(); + + if (str != orig || forceUpdate) + emit displayTextChanged(str); +} + +#ifndef QT_NO_CLIPBOARD +/*! + \internal + + 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. +*/ +void QWidgetLineControl::copy(QClipboard::Mode mode) const +{ + QString t = selectedText(); + if (!t.isEmpty() && m_echoMode == QLineEdit::Normal) { + disconnect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, 0); + QApplication::clipboard()->setText(t, mode); + connect(QApplication::clipboard(), SIGNAL(selectionChanged()), + this, SLOT(_q_clipboardChanged())); + } +} + +/*! + \internal + + Inserts the text stored in the application clipboard into the line + control. + + \sa insert() +*/ +void QWidgetLineControl::paste(QClipboard::Mode clipboardMode) +{ + QString clip = QApplication::clipboard()->text(clipboardMode); + if (!clip.isEmpty() || hasSelectedText()) { + separate(); //make it a separate undo/redo command + insert(clip); + separate(); + } +} + +#endif // !QT_NO_CLIPBOARD + +/*! + \internal + + Handles the behavior for the backspace key or function. + Removes the current selection if there is a selection, otherwise + removes the character prior to the cursor position. + + \sa del() +*/ +void QWidgetLineControl::backspace() +{ + int priorState = m_undoState; + if (hasSelectedText()) { + removeSelectedText(); + } else if (m_cursor) { + --m_cursor; + if (m_maskData) + m_cursor = prevMaskBlank(m_cursor); + QChar uc = m_text.at(m_cursor); + if (m_cursor > 0 && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) { + // second half of a surrogate, check if we have the first half as well, + // if yes delete both at once + uc = m_text.at(m_cursor - 1); + if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00) { + internalDelete(true); + --m_cursor; + } + } + internalDelete(true); + } + finishChange(priorState); +} + +/*! + \internal + + Handles the behavior for the delete key or function. + Removes the current selection if there is a selection, otherwise + removes the character after the cursor position. + + \sa del() +*/ +void QWidgetLineControl::del() +{ + int priorState = m_undoState; + if (hasSelectedText()) { + removeSelectedText(); + } else { + int n = textLayout()->nextCursorPosition(m_cursor) - m_cursor; + while (n--) + internalDelete(); + } + finishChange(priorState); +} + +/*! + \internal + + Inserts the given \a newText at the current cursor position. + If there is any selected text it is removed prior to insertion of + the new text. +*/ +void QWidgetLineControl::insert(const QString &newText) +{ + int priorState = m_undoState; + removeSelectedText(); + internalInsert(newText); + finishChange(priorState); +} + +/*! + \internal + + Clears the line control text. +*/ +void QWidgetLineControl::clear() +{ + int priorState = m_undoState; + m_selstart = 0; + m_selend = m_text.length(); + removeSelectedText(); + separate(); + finishChange(priorState, /*update*/false, /*edited*/false); +} + +/*! + \internal + + Sets \a length characters from the given \a start position as selected. + The given \a start position must be within the current text for + the line control. If \a length characters cannot be selected, then + the selection will extend to the end of the current text. +*/ +void QWidgetLineControl::setSelection(int start, int length) +{ + if(start < 0 || start > (int)m_text.length()){ + qWarning("QWidgetLineControl::setSelection: Invalid start position"); + return; + } + + if (length > 0) { + if (start == m_selstart && start + length == m_selend) + return; + m_selstart = start; + m_selend = qMin(start + length, (int)m_text.length()); + m_cursor = m_selend; + } else if (length < 0){ + if (start == m_selend && start + length == m_selstart) + return; + m_selstart = qMax(start + length, 0); + m_selend = start; + m_cursor = m_selstart; + } else if (m_selstart != m_selend) { + m_selstart = 0; + m_selend = 0; + m_cursor = start; + } else { + m_cursor = start; + emitCursorPositionChanged(); + return; + } + emit selectionChanged(); + emitCursorPositionChanged(); +} + +void QWidgetLineControl::_q_clipboardChanged() +{ +} + +void QWidgetLineControl::_q_deleteSelected() +{ + if (!hasSelectedText()) + return; + + int priorState = m_undoState; + emit resetInputContext(); + removeSelectedText(); + separate(); + finishChange(priorState); +} + +/*! + \internal + + Initializes the line control with a starting text value of \a txt. +*/ +void QWidgetLineControl::init(const QString &txt) +{ + m_text = txt; + updateDisplayText(); + m_cursor = m_text.length(); +} + +/*! + \internal + + Sets the password echo editing to \a editing. If password echo editing + is true, then the text of the password is displayed even if the echo + mode is set to QLineEdit::PasswordEchoOnEdit. Password echoing editing + does not affect other echo modes. +*/ +void QWidgetLineControl::updatePasswordEchoEditing(bool editing) +{ + m_passwordEchoEditing = editing; + updateDisplayText(); +} + +/*! + \internal + + Returns the cursor position of the given \a x pixel value in relation + to the displayed text. The given \a betweenOrOn specified what kind + of cursor position is requested. +*/ +int QWidgetLineControl::xToPos(int x, QTextLine::CursorPosition betweenOrOn) const +{ + return textLayout()->lineAt(0).xToCursor(x, betweenOrOn); +} + +/*! + \internal + + Returns the bounds of the current cursor, as defined as a + between characters cursor. +*/ +QRect QWidgetLineControl::cursorRect() const +{ + QTextLine l = textLayout()->lineAt(0); + int c = m_cursor; + if (m_preeditCursor != -1) + c += m_preeditCursor; + int cix = qRound(l.cursorToX(c)); + int w = m_cursorWidth; + int ch = l.height() + 1; + + return QRect(cix-5, 0, w+9, ch); +} + +/*! + \internal + + Fixes the current text so that it is valid given any set validators. + + Returns true if the text was changed. Otherwise returns false. +*/ +bool QWidgetLineControl::fixup() // this function assumes that validate currently returns != Acceptable +{ +#ifndef QT_NO_VALIDATOR + if (m_validator) { + QString textCopy = m_text; + int cursorCopy = m_cursor; + m_validator->fixup(textCopy); + if (m_validator->validate(textCopy, cursorCopy) == QValidator::Acceptable) { + if (textCopy != m_text || cursorCopy != m_cursor) + internalSetText(textCopy, cursorCopy); + return true; + } + } +#endif + return false; +} + +/*! + \internal + + Moves the cursor to the given position \a pos. If \a mark is true will + adjust the currently selected text. +*/ +void QWidgetLineControl::moveCursor(int pos, bool mark) +{ + if (pos != m_cursor) { + separate(); + if (m_maskData) + pos = pos > m_cursor ? nextMaskBlank(pos) : prevMaskBlank(pos); + } + if (mark) { + int anchor; + if (m_selend > m_selstart && m_cursor == m_selstart) + anchor = m_selend; + else if (m_selend > m_selstart && m_cursor == m_selend) + anchor = m_selstart; + else + anchor = m_cursor; + m_selstart = qMin(anchor, pos); + m_selend = qMax(anchor, pos); + updateDisplayText(); + } else { + internalDeselect(); + } + m_cursor = pos; + if (mark || m_selDirty) { + m_selDirty = false; + emit selectionChanged(); + } + emitCursorPositionChanged(); +} + +/*! + \internal + + Applies the given input method event \a event to the text of the line + control +*/ +void QWidgetLineControl::processInputMethodEvent(QInputMethodEvent *event) +{ + int priorState = 0; + bool isGettingInput = !event->commitString().isEmpty() + || event->preeditString() != preeditAreaText() + || event->replacementLength() > 0; + bool cursorPositionChanged = false; + + if (isGettingInput) { + // If any text is being input, remove selected text. + priorState = m_undoState; + if (echoMode() == QLineEdit::PasswordEchoOnEdit && !passwordEchoEditing()) { + updatePasswordEchoEditing(true); + m_selstart = 0; + m_selend = m_text.length(); + } + removeSelectedText(); + } + + int c = m_cursor; // cursor position after insertion of commit string + if (event->replacementStart() <= 0) + c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength()); + + m_cursor += event->replacementStart(); + if (m_cursor < 0) + m_cursor = 0; + + // insert commit string + if (event->replacementLength()) { + m_selstart = m_cursor; + m_selend = m_selstart + event->replacementLength(); + removeSelectedText(); + } + if (!event->commitString().isEmpty()) { + internalInsert(event->commitString()); + cursorPositionChanged = true; + } + + m_cursor = qBound(0, c, m_text.length()); + + for (int i = 0; i < event->attributes().size(); ++i) { + const QInputMethodEvent::Attribute &a = event->attributes().at(i); + if (a.type == QInputMethodEvent::Selection) { + m_cursor = qBound(0, a.start + a.length, m_text.length()); + if (a.length) { + m_selstart = qMax(0, qMin(a.start, m_text.length())); + m_selend = m_cursor; + if (m_selend < m_selstart) { + qSwap(m_selstart, m_selend); + } + } else { + m_selstart = m_selend = 0; + } + cursorPositionChanged = true; + } + } +#ifndef QT_NO_IM + setPreeditArea(m_cursor, event->preeditString()); +#endif //QT_NO_IM + const int oldPreeditCursor = m_preeditCursor; + m_preeditCursor = event->preeditString().length(); + m_hideCursor = false; + QList<QTextLayout::FormatRange> formats; + for (int i = 0; i < event->attributes().size(); ++i) { + const QInputMethodEvent::Attribute &a = event->attributes().at(i); + if (a.type == QInputMethodEvent::Cursor) { + m_preeditCursor = a.start; + m_hideCursor = !a.length; + } else if (a.type == QInputMethodEvent::TextFormat) { + QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat(); + if (f.isValid()) { + QTextLayout::FormatRange o; + o.start = a.start + m_cursor; + o.length = a.length; + o.format = f; + formats.append(o); + } + } + } + m_textLayout.setAdditionalFormats(formats); + updateDisplayText(/*force*/ true); + if (cursorPositionChanged) + emitCursorPositionChanged(); + else if (m_preeditCursor != oldPreeditCursor) + emit updateMicroFocus(); + if (isGettingInput) + finishChange(priorState); +} + +/*! + \internal + + 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. + + If the flags contain DrawSelections, then the selection or input mask + backgrounds and foregrounds will be applied before drawing the text. + + If the flags contain DrawCursor a cursor of the current cursorWidth() + will be drawn after drawing the text. + + The display text will only be drawn if the flags contain DrawText +*/ +void QWidgetLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &clip, int flags) +{ + QVector<QTextLayout::FormatRange> selections; + if (flags & DrawSelections) { + QTextLayout::FormatRange o; + if (m_selstart < m_selend) { + o.start = m_selstart; + o.length = m_selend - m_selstart; + o.format.setBackground(m_palette.brush(QPalette::Highlight)); + o.format.setForeground(m_palette.brush(QPalette::HighlightedText)); + } else { + // mask selection + if(!m_blinkPeriod || m_blinkStatus){ + o.start = m_cursor; + o.length = 1; + o.format.setBackground(m_palette.brush(QPalette::Text)); + o.format.setForeground(m_palette.brush(QPalette::Window)); + } + } + selections.append(o); + } + + if (flags & DrawText) + textLayout()->draw(painter, offset, selections, clip); + + if (flags & DrawCursor){ + int cursor = m_cursor; + if (m_preeditCursor != -1) + cursor += m_preeditCursor; + if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus)) + textLayout()->drawCursor(painter, offset, cursor, m_cursorWidth); + } +} + +/*! + \internal + + Sets the selection to cover the word at the given cursor position. + The word boundaries are defined by the behavior of QTextLayout::SkipWords + cursor mode. +*/ +void QWidgetLineControl::selectWordAtPos(int cursor) +{ + int next = cursor + 1; + if(next > end()) + --next; + int c = textLayout()->previousCursorPosition(next, QTextLayout::SkipWords); + moveCursor(c, false); + // ## text layout should support end of words. + int end = textLayout()->nextCursorPosition(c, QTextLayout::SkipWords); + while (end > cursor && m_text[end-1].isSpace()) + --end; + moveCursor(end, true); +} + +/*! + \internal + + Completes a change to the line control text. If the change is not valid + will undo the line control state back to the given \a validateFromState. + + If \a edited is true and the change is valid, will emit textEdited() in + addition to textChanged(). Otherwise only emits textChanged() on a valid + change. + + The \a update value is currently unused. +*/ +bool QWidgetLineControl::finishChange(int validateFromState, bool update, bool edited) +{ + Q_UNUSED(update) + bool lineDirty = m_selDirty; + if (m_textDirty) { + // do validation + bool wasValidInput = m_validInput; + m_validInput = true; +#ifndef QT_NO_VALIDATOR + if (m_validator) { + m_validInput = false; + QString textCopy = m_text; + int cursorCopy = m_cursor; + m_validInput = (m_validator->validate(textCopy, cursorCopy) != QValidator::Invalid); + if (m_validInput) { + if (m_text != textCopy) { + internalSetText(textCopy, cursorCopy); + return true; + } + m_cursor = cursorCopy; + } + } +#endif + if (validateFromState >= 0 && wasValidInput && !m_validInput) { + if (m_transactions.count()) + return false; + internalUndo(validateFromState); + m_history.resize(m_undoState); + if (m_modifiedState > m_undoState) + m_modifiedState = -1; + m_validInput = true; + m_textDirty = false; + } + updateDisplayText(); + lineDirty |= m_textDirty; + if (m_textDirty) { + m_textDirty = false; + QString actualText = text(); + if (edited) + emit textEdited(actualText); + emit textChanged(actualText); + } + } + if (m_selDirty) { + m_selDirty = false; + emit selectionChanged(); + } + emitCursorPositionChanged(); + return true; +} + +/*! + \internal + + An internal function for setting the text of the line control. +*/ +void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edited) +{ + internalDeselect(); + emit resetInputContext(); + QString oldText = m_text; + if (m_maskData) { + m_text = maskString(0, txt, true); + m_text += clearString(m_text.length(), m_maxLength - m_text.length()); + } else { + m_text = txt.isEmpty() ? txt : txt.left(m_maxLength); + } + m_history.clear(); + m_modifiedState = m_undoState = 0; + m_cursor = (pos < 0 || pos > m_text.length()) ? m_text.length() : pos; + m_textDirty = (oldText != m_text); + bool changed = finishChange(-1, true, edited); + +#ifndef QT_NO_ACCESSIBILITY + if (changed) + QAccessible::updateAccessibility(parent(), 0, QAccessible::TextUpdated); +#endif +} + + +/*! + \internal + + Adds the given \a command to the undo history + of the line control. Does not apply the command. +*/ +void QWidgetLineControl::addCommand(const Command &cmd) +{ + if (m_separator && m_undoState && m_history[m_undoState - 1].type != Separator) { + m_history.resize(m_undoState + 2); + m_history[m_undoState++] = Command(Separator, m_cursor, 0, m_selstart, m_selend); + } else { + m_history.resize(m_undoState + 1); + } + m_separator = false; + m_history[m_undoState++] = cmd; +} + +/*! + \internal + + Inserts the given string \a s into the line + control. + + Also adds the appropriate commands into the undo history. + This function does not call finishChange(), and may leave the text + in an invalid state. +*/ +void QWidgetLineControl::internalInsert(const QString &s) +{ + if (hasSelectedText()) + addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); + if (m_maskData) { + QString ms = maskString(m_cursor, s); + for (int i = 0; i < (int) ms.length(); ++i) { + addCommand (Command(DeleteSelection, m_cursor + i, m_text.at(m_cursor + i), -1, -1)); + addCommand(Command(Insert, m_cursor + i, ms.at(i), -1, -1)); + } + m_text.replace(m_cursor, ms.length(), ms); + m_cursor += ms.length(); + m_cursor = nextMaskBlank(m_cursor); + m_textDirty = true; + } else { + int remaining = m_maxLength - m_text.length(); + if (remaining != 0) { + m_text.insert(m_cursor, s.left(remaining)); + for (int i = 0; i < (int) s.left(remaining).length(); ++i) + addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1)); + m_textDirty = true; + } + } +} + +/*! + \internal + + deletes a single character from the current text. If \a wasBackspace, + the character prior to the cursor is removed. Otherwise the character + after the cursor is removed. + + Also adds the appropriate commands into the undo history. + This function does not call finishChange(), and may leave the text + in an invalid state. +*/ +void QWidgetLineControl::internalDelete(bool wasBackspace) +{ + if (m_cursor < (int) m_text.length()) { + if (hasSelectedText()) + addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); + addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)), + m_cursor, m_text.at(m_cursor), -1, -1)); + if (m_maskData) { + m_text.replace(m_cursor, 1, clearString(m_cursor, 1)); + addCommand(Command(Insert, m_cursor, m_text.at(m_cursor), -1, -1)); + } else { + m_text.remove(m_cursor, 1); + } + m_textDirty = true; + } +} + +/*! + \internal + + removes the currently selected text from the line control. + + Also adds the appropriate commands into the undo history. + This function does not call finishChange(), and may leave the text + in an invalid state. +*/ +void QWidgetLineControl::removeSelectedText() +{ + if (m_selstart < m_selend && m_selend <= (int) m_text.length()) { + separate(); + int i ; + addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); + if (m_selstart <= m_cursor && m_cursor < m_selend) { + // cursor is within the selection. Split up the commands + // to be able to restore the correct cursor position + for (i = m_cursor; i >= m_selstart; --i) + addCommand (Command(DeleteSelection, i, m_text.at(i), -1, 1)); + for (i = m_selend - 1; i > m_cursor; --i) + addCommand (Command(DeleteSelection, i - m_cursor + m_selstart - 1, m_text.at(i), -1, -1)); + } else { + for (i = m_selend-1; i >= m_selstart; --i) + addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1)); + } + if (m_maskData) { + m_text.replace(m_selstart, m_selend - m_selstart, clearString(m_selstart, m_selend - m_selstart)); + for (int i = 0; i < m_selend - m_selstart; ++i) + addCommand(Command(Insert, m_selstart + i, m_text.at(m_selstart + i), -1, -1)); + } else { + m_text.remove(m_selstart, m_selend - m_selstart); + } + if (m_cursor > m_selstart) + m_cursor -= qMin(m_cursor, m_selend) - m_selstart; + internalDeselect(); + m_textDirty = true; + } +} + +/*! + \internal + + Parses the input mask specified by \a maskFields to generate + the mask data used to handle input masks. +*/ +void QWidgetLineControl::parseInputMask(const QString &maskFields) +{ + int delimiter = maskFields.indexOf(QLatin1Char(';')); + if (maskFields.isEmpty() || delimiter == 0) { + if (m_maskData) { + delete [] m_maskData; + m_maskData = 0; + m_maxLength = 32767; + internalSetText(QString()); + } + return; + } + + if (delimiter == -1) { + m_blank = QLatin1Char(' '); + m_inputMask = maskFields; + } else { + m_inputMask = maskFields.left(delimiter); + m_blank = (delimiter + 1 < maskFields.length()) ? maskFields[delimiter + 1] : QLatin1Char(' '); + } + + // calculate m_maxLength / m_maskData length + m_maxLength = 0; + QChar c = 0; + for (int i=0; i<m_inputMask.length(); i++) { + c = m_inputMask.at(i); + if (i > 0 && m_inputMask.at(i-1) == QLatin1Char('\\')) { + m_maxLength++; + continue; + } + if (c != QLatin1Char('\\') && c != QLatin1Char('!') && + c != QLatin1Char('<') && c != QLatin1Char('>') && + c != QLatin1Char('{') && c != QLatin1Char('}') && + c != QLatin1Char('[') && c != QLatin1Char(']')) + m_maxLength++; + } + + delete [] m_maskData; + m_maskData = new MaskInputData[m_maxLength]; + + MaskInputData::Casemode m = MaskInputData::NoCaseMode; + c = 0; + bool s; + bool escape = false; + int index = 0; + for (int i = 0; i < m_inputMask.length(); i++) { + c = m_inputMask.at(i); + if (escape) { + s = true; + m_maskData[index].maskChar = c; + m_maskData[index].separator = s; + m_maskData[index].caseMode = m; + index++; + escape = false; + } else if (c == QLatin1Char('<')) { + m = MaskInputData::Lower; + } else if (c == QLatin1Char('>')) { + m = MaskInputData::Upper; + } else if (c == QLatin1Char('!')) { + m = MaskInputData::NoCaseMode; + } else if (c != QLatin1Char('{') && c != QLatin1Char('}') && c != QLatin1Char('[') && c != QLatin1Char(']')) { + switch (c.unicode()) { + case 'A': + case 'a': + case 'N': + case 'n': + case 'X': + case 'x': + case '9': + case '0': + case 'D': + case 'd': + case '#': + case 'H': + case 'h': + case 'B': + case 'b': + s = false; + break; + case '\\': + escape = true; + default: + s = true; + break; + } + + if (!escape) { + m_maskData[index].maskChar = c; + m_maskData[index].separator = s; + m_maskData[index].caseMode = m; + index++; + } + } + } + internalSetText(m_text); +} + + +/*! + \internal + + checks if the key is valid compared to the inputMask +*/ +bool QWidgetLineControl::isValidInput(QChar key, QChar mask) const +{ + switch (mask.unicode()) { + case 'A': + if (key.isLetter()) + return true; + break; + case 'a': + if (key.isLetter() || key == m_blank) + return true; + break; + case 'N': + if (key.isLetterOrNumber()) + return true; + break; + case 'n': + if (key.isLetterOrNumber() || key == m_blank) + return true; + break; + case 'X': + if (key.isPrint()) + return true; + break; + case 'x': + if (key.isPrint() || key == m_blank) + return true; + break; + case '9': + if (key.isNumber()) + return true; + break; + case '0': + if (key.isNumber() || key == m_blank) + return true; + break; + case 'D': + if (key.isNumber() && key.digitValue() > 0) + return true; + break; + case 'd': + if ((key.isNumber() && key.digitValue() > 0) || key == m_blank) + return true; + break; + case '#': + if (key.isNumber() || key == QLatin1Char('+') || key == QLatin1Char('-') || key == m_blank) + return true; + break; + case 'B': + if (key == QLatin1Char('0') || key == QLatin1Char('1')) + return true; + break; + case 'b': + if (key == QLatin1Char('0') || key == QLatin1Char('1') || key == m_blank) + return true; + break; + case 'H': + if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F'))) + return true; + break; + case 'h': + if (key.isNumber() || (key >= QLatin1Char('a') && key <= QLatin1Char('f')) || (key >= QLatin1Char('A') && key <= QLatin1Char('F')) || key == m_blank) + return true; + break; + default: + break; + } + return false; +} + +/*! + \internal + + Returns true if the given text \a str is valid for any + validator or input mask set for the line control. + + Otherwise returns false +*/ +bool QWidgetLineControl::hasAcceptableInput(const QString &str) const +{ +#ifndef QT_NO_VALIDATOR + QString textCopy = str; + int cursorCopy = m_cursor; + if (m_validator && m_validator->validate(textCopy, cursorCopy) + != QValidator::Acceptable) + return false; +#endif + + if (!m_maskData) + return true; + + if (str.length() != m_maxLength) + return false; + + for (int i=0; i < m_maxLength; ++i) { + if (m_maskData[i].separator) { + if (str.at(i) != m_maskData[i].maskChar) + return false; + } else { + if (!isValidInput(str.at(i), m_maskData[i].maskChar)) + return false; + } + } + return true; +} + +/*! + \internal + + Applies the inputMask on \a str starting from position \a pos in the mask. \a clear + specifies from where characters should be gotten when a separator is met in \a str - true means + that blanks will be used, false that previous input is used. + Calling this when no inputMask is set is undefined. +*/ +QString QWidgetLineControl::maskString(uint pos, const QString &str, bool clear) const +{ + if (pos >= (uint)m_maxLength) + return QString::fromLatin1(""); + + QString fill; + fill = clear ? clearString(0, m_maxLength) : m_text; + + int strIndex = 0; + QString s = QString::fromLatin1(""); + int i = pos; + while (i < m_maxLength) { + if (strIndex < str.length()) { + if (m_maskData[i].separator) { + s += m_maskData[i].maskChar; + if (str[(int)strIndex] == m_maskData[i].maskChar) + strIndex++; + ++i; + } else { + if (isValidInput(str[(int)strIndex], m_maskData[i].maskChar)) { + switch (m_maskData[i].caseMode) { + case MaskInputData::Upper: + s += str[(int)strIndex].toUpper(); + break; + case MaskInputData::Lower: + s += str[(int)strIndex].toLower(); + break; + default: + s += str[(int)strIndex]; + } + ++i; + } else { + // search for separator first + int n = findInMask(i, true, true, str[(int)strIndex]); + if (n != -1) { + if (str.length() != 1 || i == 0 || (i > 0 && (!m_maskData[i-1].separator || m_maskData[i-1].maskChar != str[(int)strIndex]))) { + s += fill.mid(i, n-i+1); + i = n + 1; // update i to find + 1 + } + } else { + // search for valid m_blank if not + n = findInMask(i, true, false, str[(int)strIndex]); + if (n != -1) { + s += fill.mid(i, n-i); + switch (m_maskData[n].caseMode) { + case MaskInputData::Upper: + s += str[(int)strIndex].toUpper(); + break; + case MaskInputData::Lower: + s += str[(int)strIndex].toLower(); + break; + default: + s += str[(int)strIndex]; + } + i = n + 1; // updates i to find + 1 + } + } + } + ++strIndex; + } + } else + break; + } + + return s; +} + + + +/*! + \internal + + Returns a "cleared" string with only separators and blank chars. + Calling this when no inputMask is set is undefined. +*/ +QString QWidgetLineControl::clearString(uint pos, uint len) const +{ + if (pos >= (uint)m_maxLength) + return QString(); + + QString s; + int end = qMin((uint)m_maxLength, pos + len); + for (int i = pos; i < end; ++i) + if (m_maskData[i].separator) + s += m_maskData[i].maskChar; + else + s += m_blank; + + return s; +} + +/*! + \internal + + Strips blank parts of the input in a QWidgetLineControl when an inputMask is set, + separators are still included. Typically "127.0__.0__.1__" becomes "127.0.0.1". +*/ +QString QWidgetLineControl::stripString(const QString &str) const +{ + if (!m_maskData) + return str; + + QString s; + int end = qMin(m_maxLength, (int)str.length()); + for (int i = 0; i < end; ++i) + if (m_maskData[i].separator) + s += m_maskData[i].maskChar; + else + if (str[i] != m_blank) + s += str[i]; + + return s; +} + +/*! + \internal + searches forward/backward in m_maskData for either a separator or a m_blank +*/ +int QWidgetLineControl::findInMask(int pos, bool forward, bool findSeparator, QChar searchChar) const +{ + if (pos >= m_maxLength || pos < 0) + return -1; + + int end = forward ? m_maxLength : -1; + int step = forward ? 1 : -1; + int i = pos; + + while (i != end) { + if (findSeparator) { + if (m_maskData[i].separator && m_maskData[i].maskChar == searchChar) + return i; + } else { + if (!m_maskData[i].separator) { + if (searchChar.isNull()) + return i; + else if (isValidInput(searchChar, m_maskData[i].maskChar)) + return i; + } + } + i += step; + } + return -1; +} + +void QWidgetLineControl::internalUndo(int until) +{ + if (!isUndoAvailable()) + return; + internalDeselect(); + while (m_undoState && m_undoState > until) { + Command& cmd = m_history[--m_undoState]; + switch (cmd.type) { + case Insert: + m_text.remove(cmd.pos, 1); + m_cursor = cmd.pos; + break; + case SetSelection: + m_selstart = cmd.selStart; + m_selend = cmd.selEnd; + m_cursor = cmd.pos; + break; + case Remove: + case RemoveSelection: + m_text.insert(cmd.pos, cmd.uc); + m_cursor = cmd.pos + 1; + break; + case Delete: + case DeleteSelection: + m_text.insert(cmd.pos, cmd.uc); + m_cursor = cmd.pos; + break; + case Separator: + continue; + } + if (until < 0 && m_undoState) { + Command& next = m_history[m_undoState-1]; + if (next.type != cmd.type && next.type < RemoveSelection + && (cmd.type < RemoveSelection || next.type == Separator)) + break; + } + } + m_textDirty = true; + emitCursorPositionChanged(); +} + +void QWidgetLineControl::internalRedo() +{ + if (!isRedoAvailable()) + return; + internalDeselect(); + while (m_undoState < (int)m_history.size()) { + Command& cmd = m_history[m_undoState++]; + switch (cmd.type) { + case Insert: + m_text.insert(cmd.pos, cmd.uc); + m_cursor = cmd.pos + 1; + break; + case SetSelection: + m_selstart = cmd.selStart; + m_selend = cmd.selEnd; + m_cursor = cmd.pos; + break; + case Remove: + case Delete: + case RemoveSelection: + case DeleteSelection: + m_text.remove(cmd.pos, 1); + m_selstart = cmd.selStart; + m_selend = cmd.selEnd; + m_cursor = cmd.pos; + break; + case Separator: + m_selstart = cmd.selStart; + m_selend = cmd.selEnd; + m_cursor = cmd.pos; + break; + } + if (m_undoState < (int)m_history.size()) { + Command& next = m_history[m_undoState]; + if (next.type != cmd.type && cmd.type < RemoveSelection && next.type != Separator + && (next.type < RemoveSelection || cmd.type == Separator)) + break; + } + } + m_textDirty = true; + emitCursorPositionChanged(); +} + +/*! + \internal + + If the current cursor position differs from the last emitted cursor + position, emits cursorPositionChanged(). +*/ +void QWidgetLineControl::emitCursorPositionChanged() +{ + if (m_cursor != m_lastCursorPos) { + const int oldLast = m_lastCursorPos; + m_lastCursorPos = m_cursor; + cursorPositionChanged(oldLast, m_cursor); +#ifndef QT_NO_ACCESSIBILITY + QAccessible::updateAccessibility(parent(), 0, QAccessible::TextCaretMoved); +#endif + } +} + +#ifndef QT_NO_COMPLETER +// iterating forward(dir=1)/backward(dir=-1) from the +// current row based. dir=0 indicates a new completion prefix was set. +bool QWidgetLineControl::advanceToEnabledItem(int dir) +{ + int start = m_completer->currentRow(); + if (start == -1) + return false; + int i = start + dir; + if (dir == 0) dir = 1; + do { + if (!m_completer->setCurrentRow(i)) { + if (!m_completer->wrapAround()) + break; + i = i > 0 ? 0 : m_completer->completionCount() - 1; + } else { + QModelIndex currentIndex = m_completer->currentIndex(); + if (m_completer->completionModel()->flags(currentIndex) & Qt::ItemIsEnabled) + return true; + i += dir; + } + } while (i != start); + + m_completer->setCurrentRow(start); // restore + return false; +} + +void QWidgetLineControl::complete(int key) +{ + if (!m_completer || isReadOnly() || echoMode() != QLineEdit::Normal) + return; + + QString text = this->text(); + if (m_completer->completionMode() == QCompleter::InlineCompletion) { + if (key == Qt::Key_Backspace) + return; + int n = 0; + if (key == Qt::Key_Up || key == Qt::Key_Down) { + if (textAfterSelection().length()) + return; + QString prefix = hasSelectedText() ? textBeforeSelection() + : text; + if (text.compare(m_completer->currentCompletion(), m_completer->caseSensitivity()) != 0 + || prefix.compare(m_completer->completionPrefix(), m_completer->caseSensitivity()) != 0) { + m_completer->setCompletionPrefix(prefix); + } else { + n = (key == Qt::Key_Up) ? -1 : +1; + } + } else { + m_completer->setCompletionPrefix(text); + } + if (!advanceToEnabledItem(n)) + return; + } else { +#ifndef QT_KEYPAD_NAVIGATION + if (text.isEmpty()) { + m_completer->popup()->hide(); + return; + } +#endif + m_completer->setCompletionPrefix(text); + } + + m_completer->complete(); +} +#endif + +void QWidgetLineControl::setCursorBlinkPeriod(int msec) +{ + if (msec == m_blinkPeriod) + return; + if (m_blinkTimer) { + killTimer(m_blinkTimer); + } + if (msec) { + m_blinkTimer = startTimer(msec / 2); + m_blinkStatus = 1; + } else { + m_blinkTimer = 0; + if (m_blinkStatus == 1) + emit updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect()); + } + m_blinkPeriod = msec; +} + +void QWidgetLineControl::resetCursorBlinkTimer() +{ + if (m_blinkPeriod == 0 || m_blinkTimer == 0) + return; + killTimer(m_blinkTimer); + m_blinkTimer = startTimer(m_blinkPeriod / 2); + m_blinkStatus = 1; +} + +void QWidgetLineControl::timerEvent(QTimerEvent *event) +{ + if (event->timerId() == m_blinkTimer) { + m_blinkStatus = !m_blinkStatus; + emit updateNeeded(inputMask().isEmpty() ? cursorRect() : QRect()); + } else if (event->timerId() == m_deleteAllTimer) { + killTimer(m_deleteAllTimer); + m_deleteAllTimer = 0; + clear(); + } else if (event->timerId() == m_tripleClickTimer) { + killTimer(m_tripleClickTimer); + m_tripleClickTimer = 0; + } +} + +bool QWidgetLineControl::processEvent(QEvent* ev) +{ +#ifdef QT_KEYPAD_NAVIGATION + if (QApplication::keypadNavigationEnabled()) { + if ((ev->type() == QEvent::KeyPress) || (ev->type() == QEvent::KeyRelease)) { + QKeyEvent *ke = (QKeyEvent *)ev; + if (ke->key() == Qt::Key_Back) { + if (ke->isAutoRepeat()) { + // Swallow it. We don't want back keys running amok. + ke->accept(); + return true; + } + if ((ev->type() == QEvent::KeyRelease) + && !isReadOnly() + && m_deleteAllTimer) { + killTimer(m_deleteAllTimer); + m_deleteAllTimer = 0; + backspace(); + ke->accept(); + return true; + } + } + } + } +#endif + switch(ev->type()){ +#ifndef QT_NO_GRAPHICSVIEW + case QEvent::GraphicsSceneMouseDoubleClick: + case QEvent::GraphicsSceneMouseMove: + case QEvent::GraphicsSceneMouseRelease: + case QEvent::GraphicsSceneMousePress:{ + QGraphicsSceneMouseEvent *gvEv = static_cast<QGraphicsSceneMouseEvent*>(ev); + QMouseEvent mouse(ev->type(), + gvEv->pos(), gvEv->pos(), gvEv->screenPos(), gvEv->button(), gvEv->buttons(), gvEv->modifiers()); + processMouseEvent(&mouse); break; + } +#endif + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: + case QEvent::MouseMove: + processMouseEvent(static_cast<QMouseEvent*>(ev)); break; + case QEvent::KeyPress: + case QEvent::KeyRelease: + processKeyEvent(static_cast<QKeyEvent*>(ev)); break; + case QEvent::InputMethod: + processInputMethodEvent(static_cast<QInputMethodEvent*>(ev)); break; +#ifndef QT_NO_SHORTCUT + case QEvent::ShortcutOverride:{ + if (isReadOnly()) + return false; + QKeyEvent* ke = static_cast<QKeyEvent*>(ev); + if (ke == QKeySequence::Copy + || ke == QKeySequence::Paste + || ke == QKeySequence::Cut + || ke == QKeySequence::Redo + || ke == QKeySequence::Undo + || ke == QKeySequence::MoveToNextWord + || ke == QKeySequence::MoveToPreviousWord + || ke == QKeySequence::MoveToStartOfDocument + || ke == QKeySequence::MoveToEndOfDocument + || ke == QKeySequence::SelectNextWord + || ke == QKeySequence::SelectPreviousWord + || ke == QKeySequence::SelectStartOfLine + || ke == QKeySequence::SelectEndOfLine + || ke == QKeySequence::SelectStartOfBlock + || ke == QKeySequence::SelectEndOfBlock + || ke == QKeySequence::SelectStartOfDocument + || ke == QKeySequence::SelectAll + || ke == QKeySequence::SelectEndOfDocument) { + ke->accept(); + } else if (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::ShiftModifier + || ke->modifiers() == Qt::KeypadModifier) { + if (ke->key() < Qt::Key_Escape) { + ke->accept(); + } else { + switch (ke->key()) { + case Qt::Key_Delete: + case Qt::Key_Home: + case Qt::Key_End: + case Qt::Key_Backspace: + case Qt::Key_Left: + case Qt::Key_Right: + ke->accept(); + default: + break; + } + } + } + } +#endif + default: + return false; + } + return true; +} + +void QWidgetLineControl::processMouseEvent(QMouseEvent* ev) +{ + + switch (ev->type()) { + case QEvent::GraphicsSceneMousePress: + case QEvent::MouseButtonPress:{ + if (m_tripleClickTimer + && (ev->pos() - m_tripleClick).manhattanLength() + < QApplication::startDragDistance()) { + selectAll(); + return; + } + if (ev->button() == Qt::RightButton) + return; + + bool mark = ev->modifiers() & Qt::ShiftModifier; + int cursor = xToPos(ev->pos().x()); + moveCursor(cursor, mark); + break; + } + case QEvent::GraphicsSceneMouseDoubleClick: + case QEvent::MouseButtonDblClick: + if (ev->button() == Qt::LeftButton) { + selectWordAtPos(xToPos(ev->pos().x())); + if (m_tripleClickTimer) + killTimer(m_tripleClickTimer); + m_tripleClickTimer = startTimer(QApplication::doubleClickInterval()); + m_tripleClick = ev->pos(); + } + break; + case QEvent::GraphicsSceneMouseRelease: + case QEvent::MouseButtonRelease: +#ifndef QT_NO_CLIPBOARD + if (QApplication::clipboard()->supportsSelection()) { + if (ev->button() == Qt::LeftButton) { + copy(QClipboard::Selection); + } else if (!isReadOnly() && ev->button() == Qt::MidButton) { + deselect(); + insert(QApplication::clipboard()->text(QClipboard::Selection)); + } + } +#endif + break; + case QEvent::GraphicsSceneMouseMove: + case QEvent::MouseMove: + if (ev->buttons() & Qt::LeftButton) { + moveCursor(xToPos(ev->pos().x()), true); + } + break; + default: + break; + } +} + +void QWidgetLineControl::processKeyEvent(QKeyEvent* event) +{ + bool inlineCompletionAccepted = false; + +#ifndef QT_NO_COMPLETER + if (m_completer) { + QCompleter::CompletionMode completionMode = m_completer->completionMode(); + if ((completionMode == QCompleter::PopupCompletion + || completionMode == QCompleter::UnfilteredPopupCompletion) + && m_completer->popup() + && m_completer->popup()->isVisible()) { + // The following keys are forwarded by the completer to the widget + // Ignoring the events lets the completer provide suitable default behavior + switch (event->key()) { + case Qt::Key_Escape: + event->ignore(); + return; + case Qt::Key_Enter: + case Qt::Key_Return: + case Qt::Key_F4: +#ifdef QT_KEYPAD_NAVIGATION + case Qt::Key_Select: + if (!QApplication::keypadNavigationEnabled()) + break; +#endif + m_completer->popup()->hide(); // just hide. will end up propagating to parent + default: + break; // normal key processing + } + } else if (completionMode == QCompleter::InlineCompletion) { + switch (event->key()) { + case Qt::Key_Enter: + case Qt::Key_Return: + case Qt::Key_F4: +#ifdef QT_KEYPAD_NAVIGATION + case Qt::Key_Select: + if (!QApplication::keypadNavigationEnabled()) + break; +#endif + if (!m_completer->currentCompletion().isEmpty() && hasSelectedText() + && textAfterSelection().isEmpty()) { + setText(m_completer->currentCompletion()); + inlineCompletionAccepted = true; + } + default: + break; // normal key processing + } + } + } +#endif // QT_NO_COMPLETER + + if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { + if (hasAcceptableInput() || fixup()) { + emit accepted(); + emit editingFinished(); + } + if (inlineCompletionAccepted) + event->accept(); + else + event->ignore(); + return; + } + + if (echoMode() == QLineEdit::PasswordEchoOnEdit + && !passwordEchoEditing() + && !isReadOnly() + && !event->text().isEmpty() +#ifdef QT_KEYPAD_NAVIGATION + && event->key() != Qt::Key_Select + && event->key() != Qt::Key_Up + && event->key() != Qt::Key_Down + && event->key() != Qt::Key_Back +#endif + && !(event->modifiers() & Qt::ControlModifier)) { + // Clear the edit and reset to normal echo mode while editing; the + // echo mode switches back when the edit loses focus + // ### resets current content. dubious code; you can + // navigate with keys up, down, back, and select(?), but if you press + // "left" or "right" it clears? + updatePasswordEchoEditing(true); + clear(); + } + + bool unknown = false; + bool visual = cursorMoveStyle() == Qt::VisualMoveStyle; + + if (false) { + } +#ifndef QT_NO_SHORTCUT + else if (event == QKeySequence::Undo) { + if (!isReadOnly()) + undo(); + } + else if (event == QKeySequence::Redo) { + if (!isReadOnly()) + redo(); + } + else if (event == QKeySequence::SelectAll) { + selectAll(); + } +#ifndef QT_NO_CLIPBOARD + else if (event == QKeySequence::Copy) { + copy(); + } + else if (event == QKeySequence::Paste) { + if (!isReadOnly()) { + QClipboard::Mode mode = QClipboard::Clipboard; +#ifdef Q_WS_X11 + if (event->modifiers() == (Qt::CTRL | Qt::SHIFT) && event->key() == Qt::Key_Insert) + mode = QClipboard::Selection; +#endif + paste(mode); + } + } + else if (event == QKeySequence::Cut) { + if (!isReadOnly()) { + copy(); + del(); + } + } + else if (event == QKeySequence::DeleteEndOfLine) { + if (!isReadOnly()) { + setSelection(cursor(), end()); + copy(); + del(); + } + } +#endif //QT_NO_CLIPBOARD + else if (event == QKeySequence::MoveToStartOfLine || event == QKeySequence::MoveToStartOfBlock) { + home(0); + } + else if (event == QKeySequence::MoveToEndOfLine || event == QKeySequence::MoveToEndOfBlock) { + end(0); + } + else if (event == QKeySequence::SelectStartOfLine || event == QKeySequence::SelectStartOfBlock) { + home(1); + } + else if (event == QKeySequence::SelectEndOfLine || event == QKeySequence::SelectEndOfBlock) { + end(1); + } + else if (event == QKeySequence::MoveToNextChar) { +#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) + if (hasSelectedText()) { +#else + if (hasSelectedText() && m_completer + && m_completer->completionMode() == QCompleter::InlineCompletion) { +#endif + moveCursor(selectionEnd(), false); + } else { + cursorForward(0, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); + } + } + else if (event == QKeySequence::SelectNextChar) { + cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1)); + } + else if (event == QKeySequence::MoveToPreviousChar) { +#if !defined(Q_WS_WIN) || defined(QT_NO_COMPLETER) + if (hasSelectedText()) { +#else + if (hasSelectedText() && m_completer + && m_completer->completionMode() == QCompleter::InlineCompletion) { +#endif + moveCursor(selectionStart(), false); + } else { + cursorForward(0, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1)); + } + } + else if (event == QKeySequence::SelectPreviousChar) { + cursorForward(1, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1)); + } + else if (event == QKeySequence::MoveToNextWord) { + if (echoMode() == QLineEdit::Normal) + layoutDirection() == Qt::LeftToRight ? cursorWordForward(0) : cursorWordBackward(0); + else + layoutDirection() == Qt::LeftToRight ? end(0) : home(0); + } + else if (event == QKeySequence::MoveToPreviousWord) { + if (echoMode() == QLineEdit::Normal) + layoutDirection() == Qt::LeftToRight ? cursorWordBackward(0) : cursorWordForward(0); + else if (!isReadOnly()) { + layoutDirection() == Qt::LeftToRight ? home(0) : end(0); + } + } + else if (event == QKeySequence::SelectNextWord) { + if (echoMode() == QLineEdit::Normal) + layoutDirection() == Qt::LeftToRight ? cursorWordForward(1) : cursorWordBackward(1); + else + layoutDirection() == Qt::LeftToRight ? end(1) : home(1); + } + else if (event == QKeySequence::SelectPreviousWord) { + if (echoMode() == QLineEdit::Normal) + layoutDirection() == Qt::LeftToRight ? cursorWordBackward(1) : cursorWordForward(1); + else + layoutDirection() == Qt::LeftToRight ? home(1) : end(1); + } + else if (event == QKeySequence::Delete) { + if (!isReadOnly()) + del(); + } + else if (event == QKeySequence::DeleteEndOfWord) { + if (!isReadOnly()) { + cursorWordForward(true); + del(); + } + } + else if (event == QKeySequence::DeleteStartOfWord) { + if (!isReadOnly()) { + cursorWordBackward(true); + del(); + } + } +#endif // QT_NO_SHORTCUT + else { + bool handled = false; +#ifdef Q_WS_MAC + if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) { + Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier); + if (myModifiers & Qt::ShiftModifier) { + if (myModifiers == (Qt::ControlModifier|Qt::ShiftModifier) + || myModifiers == (Qt::AltModifier|Qt::ShiftModifier) + || myModifiers == Qt::ShiftModifier) { + + event->key() == Qt::Key_Up ? home(1) : end(1); + } + } else { + if ((myModifiers == Qt::ControlModifier + || myModifiers == Qt::AltModifier + || myModifiers == Qt::NoModifier)) { + event->key() == Qt::Key_Up ? home(0) : end(0); + } + } + handled = true; + } +#endif + if (event->modifiers() & Qt::ControlModifier) { + switch (event->key()) { + case Qt::Key_Backspace: + if (!isReadOnly()) { + cursorWordBackward(true); + del(); + } + break; +#ifndef QT_NO_COMPLETER + case Qt::Key_Up: + case Qt::Key_Down: + complete(event->key()); + break; +#endif +#if defined(Q_WS_X11) + case Qt::Key_E: + end(0); + break; + + case Qt::Key_U: + if (!isReadOnly()) { + setSelection(0, text().size()); +#ifndef QT_NO_CLIPBOARD + copy(); +#endif + del(); + } + break; +#endif + default: + if (!handled) + unknown = true; + } + } else { // ### check for *no* modifier + switch (event->key()) { + case Qt::Key_Backspace: + if (!isReadOnly()) { + backspace(); +#ifndef QT_NO_COMPLETER + complete(Qt::Key_Backspace); +#endif + } + break; +#ifdef QT_KEYPAD_NAVIGATION + case Qt::Key_Back: + if (QApplication::keypadNavigationEnabled() && !event->isAutoRepeat() + && !isReadOnly()) { + if (text().length() == 0) { + setText(m_cancelText); + + if (passwordEchoEditing()) + updatePasswordEchoEditing(false); + + emit editFocusChange(false); + } else if (!m_deleteAllTimer) { + m_deleteAllTimer = startTimer(750); + } + } else { + unknown = true; + } + break; +#endif + default: + if (!handled) + unknown = true; + } + } + } + + if (event->key() == Qt::Key_Direction_L || event->key() == Qt::Key_Direction_R) { + setLayoutDirection((event->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft); + unknown = false; + } + + if (unknown && !isReadOnly()) { + QString t = event->text(); + if (!t.isEmpty() && t.at(0).isPrint()) { + insert(t); +#ifndef QT_NO_COMPLETER + complete(event->key()); +#endif + event->accept(); + return; + } + } + + if (unknown) + event->ignore(); + else + event->accept(); +} + + +QT_END_NAMESPACE + +#endif diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h new file mode 100644 index 00000000000..4169d2de291 --- /dev/null +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -0,0 +1,499 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWidgetLineControl_P_H +#define QWidgetLineControl_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 "QtCore/qglobal.h" + +#ifndef QT_NO_LINEEDIT +#include "private/qwidget_p.h" +#include "QtWidgets/qlineedit.h" +#include "QtGui/qtextlayout.h" +#include "QtWidgets/qstyleoption.h" +#include "QtCore/qpointer.h" +#include "QtGui/qclipboard.h" +#include "QtCore/qpoint.h" +#include "QtWidgets/qcompleter.h" +#include "QtWidgets/qaccessible.h" +#include "QtCore/qthread.h" + +#include "qplatformdefs.h" + +QT_BEGIN_HEADER + +#ifdef DrawText +# undef DrawText +#endif + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class Q_WIDGETS_EXPORT QWidgetLineControl : public QObject +{ + Q_OBJECT + +public: + QWidgetLineControl(const QString &txt = QString()) + : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto), + m_hideCursor(false), m_separator(0), m_readOnly(0), + m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0), + m_validInput(1), m_blinkStatus(0), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0), + m_ascent(0), m_maxLength(32767), m_lastCursorPos(-1), + m_tripleClickTimer(0), m_maskData(0), m_modifiedState(0), m_undoState(0), + m_selstart(0), m_selend(0), m_passwordEchoEditing(false) +#ifdef QT_GUI_PASSWORD_ECHO_DELAY + , m_passwordEchoTimer(0) +#endif +#if defined(Q_WS_MAC) + , m_threadChecks(false) + , m_textLayoutThread(0) + #endif + { + init(txt); + } + + ~QWidgetLineControl() + { + delete [] m_maskData; + } + + int nextMaskBlank(int pos) + { + int c = findInMask(pos, true, false); + m_separator |= (c != pos); + return (c != -1 ? c : m_maxLength); + } + + int prevMaskBlank(int pos) + { + int c = findInMask(pos, false, false); + m_separator |= (c != pos); + return (c != -1 ? c : 0); + } + + bool isUndoAvailable() const { return !m_readOnly && m_undoState; } + bool isRedoAvailable() const { return !m_readOnly && m_undoState < (int)m_history.size(); } + void clearUndo() { m_history.clear(); m_modifiedState = m_undoState = 0; } + + bool isModified() const { return m_modifiedState != m_undoState; } + void setModified(bool modified) { m_modifiedState = modified ? -1 : m_undoState; } + + bool allSelected() const { return !m_text.isEmpty() && m_selstart == 0 && m_selend == (int)m_text.length(); } + bool hasSelectedText() const { return !m_text.isEmpty() && m_selend > m_selstart; } + + int width() const { return qRound(m_textLayout.lineAt(0).width()) + 1; } + int height() const { return qRound(m_textLayout.lineAt(0).height()) + 1; } + int ascent() const { return m_ascent; } + qreal naturalTextWidth() const { return m_textLayout.lineAt(0).naturalTextWidth(); } + + void setSelection(int start, int length); + + inline QString selectedText() const { return hasSelectedText() ? m_text.mid(m_selstart, m_selend - m_selstart) : QString(); } + QString textBeforeSelection() const { return hasSelectedText() ? m_text.left(m_selstart) : QString(); } + QString textAfterSelection() const { return hasSelectedText() ? m_text.mid(m_selend) : QString(); } + + int selectionStart() const { return hasSelectedText() ? m_selstart : -1; } + int selectionEnd() const { return hasSelectedText() ? m_selend : -1; } + bool inSelection(int x) const + { + if (m_selstart >= m_selend) + return false; + int pos = xToPos(x, QTextLine::CursorOnCharacter); + return pos >= m_selstart && pos < m_selend; + } + + void removeSelection() + { + int priorState = m_undoState; + removeSelectedText(); + finishChange(priorState); + } + + int start() const { return 0; } + int end() const { return m_text.length(); } + +#ifndef QT_NO_CLIPBOARD + void copy(QClipboard::Mode mode = QClipboard::Clipboard) const; + void paste(QClipboard::Mode mode = QClipboard::Clipboard); +#endif + + int cursor() const{ return m_cursor; } + int preeditCursor() const { return m_preeditCursor; } + + int cursorWidth() const { return m_cursorWidth; } + void setCursorWidth(int value) { m_cursorWidth = value; } + + Qt::CursorMoveStyle cursorMoveStyle() const { return m_textLayout.cursorMoveStyle(); } + void setCursorMoveStyle(Qt::CursorMoveStyle style) { m_textLayout.setCursorMoveStyle(style); } + + void moveCursor(int pos, bool mark = false); + void cursorForward(bool mark, int steps) + { + int c = m_cursor; + if (steps > 0) { + while (steps--) + c = cursorMoveStyle() == Qt::VisualMoveStyle ? m_textLayout.rightCursorPosition(c) + : m_textLayout.nextCursorPosition(c); + } else if (steps < 0) { + while (steps++) + c = cursorMoveStyle() == Qt::VisualMoveStyle ? m_textLayout.leftCursorPosition(c) + : m_textLayout.previousCursorPosition(c); + } + moveCursor(c, mark); + } + + void cursorWordForward(bool mark) { moveCursor(m_textLayout.nextCursorPosition(m_cursor, QTextLayout::SkipWords), mark); } + void cursorWordBackward(bool mark) { moveCursor(m_textLayout.previousCursorPosition(m_cursor, QTextLayout::SkipWords), mark); } + + void home(bool mark) { moveCursor(0, mark); } + void end(bool mark) { moveCursor(text().length(), mark); } + + int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const; + QRect cursorRect() const; + + qreal cursorToX(int cursor) const { return m_textLayout.lineAt(0).cursorToX(cursor); } + qreal cursorToX() const + { + int cursor = m_cursor; + if (m_preeditCursor != -1) + cursor += m_preeditCursor; + return cursorToX(cursor); + } + + bool isReadOnly() const { return m_readOnly; } + void setReadOnly(bool enable) { m_readOnly = enable; } + + QString text() const + { + QString res = m_maskData ? stripString(m_text) : m_text; + return (res.isNull() ? QString::fromLatin1("") : res); + } + void setText(const QString &txt) { internalSetText(txt, -1, false); } + QString displayText() const { return m_textLayout.text(); } + + void backspace(); + void del(); + void deselect() { internalDeselect(); finishChange(); } + void selectAll() { m_selstart = m_selend = m_cursor = 0; moveCursor(m_text.length(), true); } + + void insert(const QString &); + void clear(); + void undo() { internalUndo(); finishChange(-1, true); } + void redo() { internalRedo(); finishChange(); } + void selectWordAtPos(int); + + uint echoMode() const { return m_echoMode; } + void setEchoMode(uint mode) + { + m_echoMode = mode; + m_passwordEchoEditing = false; + updateDisplayText(); + } + + int maxLength() const { return m_maxLength; } + void setMaxLength(int maxLength) + { + if (m_maskData) + return; + m_maxLength = maxLength; + setText(m_text); + } + +#ifndef QT_NO_VALIDATOR + const QValidator *validator() const { return m_validator; } + void setValidator(const QValidator *v) { m_validator = const_cast<QValidator*>(v); } +#endif + +#ifndef QT_NO_COMPLETER + QCompleter *completer() const { return m_completer; } + /* Note that you must set the widget for the completer separately */ + void setCompleter(const QCompleter *c) { m_completer = const_cast<QCompleter*>(c); } + void complete(int key); +#endif + + int cursorPosition() const { return m_cursor; } + void setCursorPosition(int pos) { if (pos <= m_text.length()) moveCursor(qMax(0, pos)); } + + bool hasAcceptableInput() const { return hasAcceptableInput(m_text); } + bool fixup(); + + QString inputMask() const { return m_maskData ? m_inputMask + QLatin1Char(';') + m_blank : QString(); } + void setInputMask(const QString &mask) + { + parseInputMask(mask); + if (m_maskData) + moveCursor(nextMaskBlank(0)); + } + + // input methods +#ifndef QT_NO_IM + bool composeMode() const { return !m_textLayout.preeditAreaText().isEmpty(); } + void setPreeditArea(int cursor, const QString &text) { m_textLayout.setPreeditArea(cursor, text); } +#endif + + QString preeditAreaText() const { return m_textLayout.preeditAreaText(); } + + void updatePasswordEchoEditing(bool editing); + bool passwordEchoEditing() const { return m_passwordEchoEditing; } + + QChar passwordCharacter() const { return m_passwordCharacter; } + void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); } + + Qt::LayoutDirection layoutDirection() const { + if (m_layoutDirection == Qt::LayoutDirectionAuto) { + if (m_text.isEmpty()) + return QApplication::keyboardInputDirection(); + return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; + } + return m_layoutDirection; + } + void setLayoutDirection(Qt::LayoutDirection direction) + { + if (direction != m_layoutDirection) { + m_layoutDirection = direction; + updateDisplayText(); + } + } + + void setFont(const QFont &font) { m_textLayout.setFont(font); updateDisplayText(); } + + void processInputMethodEvent(QInputMethodEvent *event); + void processMouseEvent(QMouseEvent* ev); + void processKeyEvent(QKeyEvent* ev); + + int cursorBlinkPeriod() const { return m_blinkPeriod; } + void setCursorBlinkPeriod(int msec); + void resetCursorBlinkTimer(); + + bool cursorBlinkStatus() const { return m_blinkStatus; } + + QString cancelText() const { return m_cancelText; } + void setCancelText(const QString &text) { m_cancelText = text; } + + const QPalette &palette() const { return m_palette; } + void setPalette(const QPalette &p) { m_palette = p; } + + enum DrawFlags { + DrawText = 0x01, + DrawSelections = 0x02, + DrawCursor = 0x04, + DrawAll = DrawText | DrawSelections | DrawCursor + }; + void draw(QPainter *, const QPoint &, const QRect &, int flags = DrawAll); + + bool processEvent(QEvent *ev); + + QTextLayout *textLayout() const + { +#if defined(Q_WS_MAC) + if (m_threadChecks && QThread::currentThread() != m_textLayoutThread) + redoTextLayout(); +#endif + return &m_textLayout; + } + +#if defined(Q_WS_MAC) + void setThreadChecks(bool threadChecks) + { + m_threadChecks = threadChecks; + } + + bool threadChecks() const + { + return m_threadChecks; + } +#endif + +private: + void init(const QString &txt); + void removeSelectedText(); + void internalSetText(const QString &txt, int pos = -1, bool edited = true); + void updateDisplayText(bool forceUpdate = false); + + void internalInsert(const QString &s); + void internalDelete(bool wasBackspace = false); + void internalRemove(int pos); + + inline void internalDeselect() + { + m_selDirty |= (m_selend > m_selstart); + m_selstart = m_selend = 0; + } + + void internalUndo(int until = -1); + void internalRedo(); + + QString m_text; + QPalette m_palette; + int m_cursor; + int m_preeditCursor; + int m_cursorWidth; + Qt::LayoutDirection m_layoutDirection; + uint m_hideCursor : 1; // used to hide the m_cursor inside preedit areas + uint m_separator : 1; + uint m_readOnly : 1; + uint m_dragEnabled : 1; + uint m_echoMode : 2; + uint m_textDirty : 1; + uint m_selDirty : 1; + uint m_validInput : 1; + uint m_blinkStatus : 1; + int m_blinkPeriod; // 0 for non-blinking cursor + int m_blinkTimer; + int m_deleteAllTimer; + int m_ascent; + int m_maxLength; + int m_lastCursorPos; + QList<int> m_transactions; + QPoint m_tripleClick; + int m_tripleClickTimer; + QString m_cancelText; + + void emitCursorPositionChanged(); + + bool finishChange(int validateFromState = -1, bool update = false, bool edited = true); + +#ifndef QT_NO_VALIDATOR + QPointer<QValidator> m_validator; +#endif + QPointer<QCompleter> m_completer; +#ifndef QT_NO_COMPLETER + bool advanceToEnabledItem(int dir); +#endif + + struct MaskInputData { + enum Casemode { NoCaseMode, Upper, Lower }; + QChar maskChar; // either the separator char or the inputmask + bool separator; + Casemode caseMode; + }; + QString m_inputMask; + QChar m_blank; + MaskInputData *m_maskData; + + // undo/redo handling + enum CommandType { Separator, Insert, Remove, Delete, RemoveSelection, DeleteSelection, SetSelection }; + struct Command { + inline Command() {} + inline Command(CommandType t, int p, QChar c, int ss, int se) : type(t),uc(c),pos(p),selStart(ss),selEnd(se) {} + uint type : 4; + QChar uc; + int pos, selStart, selEnd; + }; + int m_modifiedState; + int m_undoState; + QVector<Command> m_history; + void addCommand(const Command& cmd); + + inline void separate() { m_separator = true; } + + // selection + int m_selstart; + int m_selend; + + // masking + void parseInputMask(const QString &maskFields); + bool isValidInput(QChar key, QChar mask) const; + bool hasAcceptableInput(const QString &text) const; + QString maskString(uint pos, const QString &str, bool clear = false) const; + QString clearString(uint pos, uint len) const; + QString stripString(const QString &str) const; + int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar = QChar()) const; + + // complex text layout (must be mutable so it can be reshaped at will) + mutable QTextLayout m_textLayout; + + bool m_passwordEchoEditing; + QChar m_passwordCharacter; + + int redoTextLayout() const; +#if defined(Q_WS_MAC) + bool m_threadChecks; + mutable QThread *m_textLayoutThread; +#endif + +Q_SIGNALS: + void cursorPositionChanged(int, int); + void selectionChanged(); + + void displayTextChanged(const QString &); + void textChanged(const QString &); + void textEdited(const QString &); + + void resetInputContext(); + void updateMicroFocus(); + + void accepted(); + void editingFinished(); + void updateNeeded(const QRect &); + +#ifdef QT_KEYPAD_NAVIGATION + void editFocusChange(bool); +#endif +protected: + virtual void timerEvent(QTimerEvent *event); + +private Q_SLOTS: + void _q_clipboardChanged(); + void _q_deleteSelected(); + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QT_NO_LINEEDIT + +#endif // QWidgetLineControl_P_H diff --git a/src/gui/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp similarity index 100% rename from src/gui/widgets/qwidgetresizehandler.cpp rename to src/widgets/widgets/qwidgetresizehandler.cpp diff --git a/src/gui/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h similarity index 98% rename from src/gui/widgets/qwidgetresizehandler_p.h rename to src/widgets/widgets/qwidgetresizehandler_p.h index 6d635720589..9d09d63967f 100644 --- a/src/gui/widgets/qwidgetresizehandler_p.h +++ b/src/widgets/widgets/qwidgetresizehandler_p.h @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE class QMouseEvent; class QKeyEvent; -class Q_GUI_EXPORT QWidgetResizeHandler : public QObject +class Q_WIDGETS_EXPORT QWidgetResizeHandler : public QObject { Q_OBJECT diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp new file mode 100644 index 00000000000..43ebb6b0783 --- /dev/null +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -0,0 +1,3148 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwidgettextcontrol_p.h" +#include "qwidgettextcontrol_p_p.h" + +#ifndef QT_NO_TEXTCONTROL + +#include <qfont.h> +#include <qpainter.h> +#include <qevent.h> +#include <qdebug.h> +#include <qmime.h> +#include <qdrag.h> +#include <qclipboard.h> +#include <qmenu.h> +#include <qstyle.h> +#include <qtimer.h> +#include "private/qtextdocumentlayout_p.h" +#include "private/qabstracttextdocumentlayout_p.h" +#include "private/qtextedit_p.h" +#include "qtextdocument.h" +#include "private/qtextdocument_p.h" +#include "qtextlist.h" +#include "private/qwidgettextcontrol_p.h" +#include "qgraphicssceneevent.h" +#include "qpagedpaintdevice.h" +#include "private/qpagedpaintdevice_p.h" +#include "qtextdocumentwriter.h" +#include "private/qtextcursor_p.h" + +#include <qtextformat.h> +#include <qdatetime.h> +#include <qbuffer.h> +#include <qapplication.h> +#include <limits.h> +#include <qtexttable.h> +#include <qvariant.h> +#include <qurl.h> +#include <qdesktopservices.h> +#include <qinputcontext.h> +#include <qtooltip.h> +#include <qstyleoption.h> +#include <QtWidgets/qlineedit.h> + +#ifndef QT_NO_SHORTCUT +#include "private/qapplication_p.h" +#include "private/qshortcutmap_p.h" +#include <qkeysequence.h> +#define ACCEL_KEY(k) (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString()) +#else +#define ACCEL_KEY(k) QString() +#endif + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_CONTEXTMENU +#if defined(Q_WS_WIN) || defined(Q_WS_X11) +extern bool qt_use_rtl_extensions; +#endif +#endif + +// could go into QTextCursor... +static QTextLine currentTextLine(const QTextCursor &cursor) +{ + const QTextBlock block = cursor.block(); + if (!block.isValid()) + return QTextLine(); + + const QTextLayout *layout = block.layout(); + if (!layout) + return QTextLine(); + + const int relativePos = cursor.position() - block.position(); + return layout->lineForTextPosition(relativePos); +} + +QWidgetTextControlPrivate::QWidgetTextControlPrivate() + : doc(0), cursorOn(false), cursorIsFocusIndicator(false), + interactionFlags(Qt::TextEditorInteraction), + dragEnabled(true), +#ifndef QT_NO_DRAGANDDROP + mousePressed(false), mightStartDrag(false), +#endif + lastSelectionState(false), ignoreAutomaticScrollbarAdjustement(false), + overwriteMode(false), + acceptRichText(true), + preeditCursor(0), hideCursor(false), + hasFocus(false), +#ifdef QT_KEYPAD_NAVIGATION + hasEditFocus(false), +#endif + isEnabled(true), + hadSelectionOnMousePress(false), + ignoreUnusedNavigationEvents(false), + openExternalLinks(false), + wordSelectionEnabled(false) +{} + +bool QWidgetTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) +{ +#ifdef QT_NO_SHORTCUT + Q_UNUSED(e); +#endif + + Q_Q(QWidgetTextControl); + if (cursor.isNull()) + return false; + + const QTextCursor oldSelection = cursor; + const int oldCursorPos = cursor.position(); + + QTextCursor::MoveMode mode = QTextCursor::MoveAnchor; + QTextCursor::MoveOperation op = QTextCursor::NoMove; + + if (false) { + } +#ifndef QT_NO_SHORTCUT + if (e == QKeySequence::MoveToNextChar) { + op = QTextCursor::Right; + } + else if (e == QKeySequence::MoveToPreviousChar) { + op = QTextCursor::Left; + } + else if (e == QKeySequence::SelectNextChar) { + op = QTextCursor::Right; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectPreviousChar) { + op = QTextCursor::Left; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectNextWord) { + op = QTextCursor::WordRight; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectPreviousWord) { + op = QTextCursor::WordLeft; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectStartOfLine) { + op = QTextCursor::StartOfLine; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectEndOfLine) { + op = QTextCursor::EndOfLine; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectStartOfBlock) { + op = QTextCursor::StartOfBlock; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectEndOfBlock) { + op = QTextCursor::EndOfBlock; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectStartOfDocument) { + op = QTextCursor::Start; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectEndOfDocument) { + op = QTextCursor::End; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectPreviousLine) { + op = QTextCursor::Up; + mode = QTextCursor::KeepAnchor; + } + else if (e == QKeySequence::SelectNextLine) { + op = QTextCursor::Down; + mode = QTextCursor::KeepAnchor; + { + QTextBlock block = cursor.block(); + QTextLine line = currentTextLine(cursor); + if (!block.next().isValid() + && line.isValid() + && line.lineNumber() == block.layout()->lineCount() - 1) + op = QTextCursor::End; + } + } + else if (e == QKeySequence::MoveToNextWord) { + op = QTextCursor::WordRight; + } + else if (e == QKeySequence::MoveToPreviousWord) { + op = QTextCursor::WordLeft; + } + else if (e == QKeySequence::MoveToEndOfBlock) { + op = QTextCursor::EndOfBlock; + } + else if (e == QKeySequence::MoveToStartOfBlock) { + op = QTextCursor::StartOfBlock; + } + else if (e == QKeySequence::MoveToNextLine) { + op = QTextCursor::Down; + } + else if (e == QKeySequence::MoveToPreviousLine) { + op = QTextCursor::Up; + } + else if (e == QKeySequence::MoveToPreviousLine) { + op = QTextCursor::Up; + } + else if (e == QKeySequence::MoveToStartOfLine) { + op = QTextCursor::StartOfLine; + } + else if (e == QKeySequence::MoveToEndOfLine) { + op = QTextCursor::EndOfLine; + } + else if (e == QKeySequence::MoveToStartOfDocument) { + op = QTextCursor::Start; + } + else if (e == QKeySequence::MoveToEndOfDocument) { + op = QTextCursor::End; + } +#endif // QT_NO_SHORTCUT + else { + return false; + } + +// Except for pageup and pagedown, Mac OS X has very different behavior, we don't do it all, but +// here's the breakdown: +// Shift still works as an anchor, but only one of the other keys can be down Ctrl (Command), +// Alt (Option), or Meta (Control). +// Command/Control + Left/Right -- Move to left or right of the line +// + Up/Down -- Move to top bottom of the file. (Control doesn't move the cursor) +// Option + Left/Right -- Move one word Left/right. +// + Up/Down -- Begin/End of Paragraph. +// Home/End Top/Bottom of file. (usually don't move the cursor, but will select) + + bool visualNavigation = cursor.visualNavigation(); + cursor.setVisualNavigation(true); + const bool moved = cursor.movePosition(op, mode); + cursor.setVisualNavigation(visualNavigation); + q->ensureCursorVisible(); + + bool ignoreNavigationEvents = ignoreUnusedNavigationEvents; + bool isNavigationEvent = e->key() == Qt::Key_Up || e->key() == Qt::Key_Down; + +#ifdef QT_KEYPAD_NAVIGATION + ignoreNavigationEvents = ignoreNavigationEvents || QApplication::keypadNavigationEnabled(); + isNavigationEvent = isNavigationEvent || + (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional + && (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right)); +#else + isNavigationEvent = isNavigationEvent || e->key() == Qt::Key_Left || e->key() == Qt::Key_Right; +#endif + + if (moved) { + if (cursor.position() != oldCursorPos) + emit q->cursorPositionChanged(); + emit q->microFocusChanged(); + } else if (ignoreNavigationEvents && isNavigationEvent && oldSelection.anchor() == cursor.anchor()) { + return false; + } + + selectionChanged(/*forceEmitSelectionChanged =*/(mode == QTextCursor::KeepAnchor)); + + repaintOldAndNewSelection(oldSelection); + + return true; +} + +void QWidgetTextControlPrivate::updateCurrentCharFormat() +{ + Q_Q(QWidgetTextControl); + + QTextCharFormat fmt = cursor.charFormat(); + if (fmt == lastCharFormat) + return; + lastCharFormat = fmt; + + emit q->currentCharFormatChanged(fmt); + emit q->microFocusChanged(); +} + +void QWidgetTextControlPrivate::indent() +{ + QTextBlockFormat blockFmt = cursor.blockFormat(); + + QTextList *list = cursor.currentList(); + if (!list) { + QTextBlockFormat modifier; + modifier.setIndent(blockFmt.indent() + 1); + cursor.mergeBlockFormat(modifier); + } else { + QTextListFormat format = list->format(); + format.setIndent(format.indent() + 1); + + if (list->itemNumber(cursor.block()) == 1) + list->setFormat(format); + else + cursor.createList(format); + } +} + +void QWidgetTextControlPrivate::outdent() +{ + QTextBlockFormat blockFmt = cursor.blockFormat(); + + QTextList *list = cursor.currentList(); + + if (!list) { + QTextBlockFormat modifier; + modifier.setIndent(blockFmt.indent() - 1); + cursor.mergeBlockFormat(modifier); + } else { + QTextListFormat listFmt = list->format(); + listFmt.setIndent(listFmt.indent() - 1); + list->setFormat(listFmt); + } +} + +void QWidgetTextControlPrivate::gotoNextTableCell() +{ + QTextTable *table = cursor.currentTable(); + QTextTableCell cell = table->cellAt(cursor); + + int newColumn = cell.column() + cell.columnSpan(); + int newRow = cell.row(); + + if (newColumn >= table->columns()) { + newColumn = 0; + ++newRow; + if (newRow >= table->rows()) + table->insertRows(table->rows(), 1); + } + + cell = table->cellAt(newRow, newColumn); + cursor = cell.firstCursorPosition(); +} + +void QWidgetTextControlPrivate::gotoPreviousTableCell() +{ + QTextTable *table = cursor.currentTable(); + QTextTableCell cell = table->cellAt(cursor); + + int newColumn = cell.column() - 1; + int newRow = cell.row(); + + if (newColumn < 0) { + newColumn = table->columns() - 1; + --newRow; + if (newRow < 0) + return; + } + + cell = table->cellAt(newRow, newColumn); + cursor = cell.firstCursorPosition(); +} + +void QWidgetTextControlPrivate::createAutoBulletList() +{ + cursor.beginEditBlock(); + + QTextBlockFormat blockFmt = cursor.blockFormat(); + + QTextListFormat listFmt; + listFmt.setStyle(QTextListFormat::ListDisc); + listFmt.setIndent(blockFmt.indent() + 1); + + blockFmt.setIndent(0); + cursor.setBlockFormat(blockFmt); + + cursor.createList(listFmt); + + cursor.endEditBlock(); +} + +void QWidgetTextControlPrivate::init(Qt::TextFormat format, const QString &text, QTextDocument *document) +{ + Q_Q(QWidgetTextControl); + setContent(format, text, document); + + doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable); + q->setCursorWidth(-1); +} + +void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, QTextDocument *document) +{ + Q_Q(QWidgetTextControl); + + // for use when called from setPlainText. we may want to re-use the currently + // set char format then. + const QTextCharFormat charFormatForInsertion = cursor.charFormat(); + + bool clearDocument = true; + if (!doc) { + if (document) { + doc = document; + clearDocument = false; + } else { + palette = QApplication::palette("QWidgetTextControl"); + doc = new QTextDocument(q); + } + _q_documentLayoutChanged(); + cursor = QTextCursor(doc); + +// #### doc->documentLayout()->setPaintDevice(viewport); + + QObject::connect(doc, SIGNAL(contentsChanged()), q, SLOT(_q_updateCurrentCharFormatAndSelection())); + QObject::connect(doc, SIGNAL(cursorPositionChanged(QTextCursor)), q, SLOT(_q_emitCursorPosChanged(QTextCursor))); + QObject::connect(doc, SIGNAL(documentLayoutChanged()), q, SLOT(_q_documentLayoutChanged())); + + // convenience signal forwards + QObject::connect(doc, SIGNAL(undoAvailable(bool)), q, SIGNAL(undoAvailable(bool))); + QObject::connect(doc, SIGNAL(redoAvailable(bool)), q, SIGNAL(redoAvailable(bool))); + QObject::connect(doc, SIGNAL(modificationChanged(bool)), q, SIGNAL(modificationChanged(bool))); + QObject::connect(doc, SIGNAL(blockCountChanged(int)), q, SIGNAL(blockCountChanged(int))); + } + + bool previousUndoRedoState = doc->isUndoRedoEnabled(); + if (!document) + doc->setUndoRedoEnabled(false); + + //Saving the index save some time. + static int contentsChangedIndex = QTextDocument::staticMetaObject.indexOfSignal("contentsChanged()"); + static int textChangedIndex = QWidgetTextControl::staticMetaObject.indexOfSignal("textChanged()"); + // avoid multiple textChanged() signals being emitted + QMetaObject::disconnect(doc, contentsChangedIndex, q, textChangedIndex); + + if (!text.isEmpty()) { + // clear 'our' cursor for insertion to prevent + // the emission of the cursorPositionChanged() signal. + // instead we emit it only once at the end instead of + // at the end of the document after loading and when + // positioning the cursor again to the start of the + // document. + cursor = QTextCursor(); + if (format == Qt::PlainText) { + QTextCursor formatCursor(doc); + // put the setPlainText and the setCharFormat into one edit block, + // so that the syntax highlight triggers only /once/ for the entire + // document, not twice. + formatCursor.beginEditBlock(); + doc->setPlainText(text); + doc->setUndoRedoEnabled(false); + formatCursor.select(QTextCursor::Document); + formatCursor.setCharFormat(charFormatForInsertion); + formatCursor.endEditBlock(); + } else { +#ifndef QT_NO_TEXTHTMLPARSER + doc->setHtml(text); +#else + doc->setPlainText(text); +#endif + doc->setUndoRedoEnabled(false); + } + cursor = QTextCursor(doc); + } else if (clearDocument) { + doc->clear(); + } + cursor.setCharFormat(charFormatForInsertion); + + QMetaObject::connect(doc, contentsChangedIndex, q, textChangedIndex); + emit q->textChanged(); + if (!document) + doc->setUndoRedoEnabled(previousUndoRedoState); + _q_updateCurrentCharFormatAndSelection(); + if (!document) + doc->setModified(false); + + q->ensureCursorVisible(); + emit q->cursorPositionChanged(); +} + +void QWidgetTextControlPrivate::startDrag() +{ +#ifndef QT_NO_DRAGANDDROP + Q_Q(QWidgetTextControl); + mousePressed = false; + if (!contextWidget) + return; + QMimeData *data = q->createMimeDataFromSelection(); + + QDrag *drag = new QDrag(contextWidget); + drag->setMimeData(data); + + Qt::DropActions actions = Qt::CopyAction; + Qt::DropAction action; + if (interactionFlags & Qt::TextEditable) { + actions |= Qt::MoveAction; + action = drag->exec(actions, Qt::MoveAction); + } else { + action = drag->exec(actions, Qt::CopyAction); + } + + if (action == Qt::MoveAction && drag->target() != contextWidget) + cursor.removeSelectedText(); +#endif +} + +void QWidgetTextControlPrivate::setCursorPosition(const QPointF &pos) +{ + Q_Q(QWidgetTextControl); + const int cursorPos = q->hitTest(pos, Qt::FuzzyHit); + if (cursorPos == -1) + return; + cursor.setPosition(cursorPos); +} + +void QWidgetTextControlPrivate::setCursorPosition(int pos, QTextCursor::MoveMode mode) +{ + cursor.setPosition(pos, mode); + + if (mode != QTextCursor::KeepAnchor) { + selectedWordOnDoubleClick = QTextCursor(); + selectedBlockOnTrippleClick = QTextCursor(); + } +} + +void QWidgetTextControlPrivate::repaintCursor() +{ + Q_Q(QWidgetTextControl); + emit q->updateRequest(cursorRectPlusUnicodeDirectionMarkers(cursor)); +} + +void QWidgetTextControlPrivate::repaintOldAndNewSelection(const QTextCursor &oldSelection) +{ + Q_Q(QWidgetTextControl); + if (cursor.hasSelection() + && oldSelection.hasSelection() + && cursor.currentFrame() == oldSelection.currentFrame() + && !cursor.hasComplexSelection() + && !oldSelection.hasComplexSelection() + && cursor.anchor() == oldSelection.anchor() + ) { + QTextCursor differenceSelection(doc); + differenceSelection.setPosition(oldSelection.position()); + differenceSelection.setPosition(cursor.position(), QTextCursor::KeepAnchor); + emit q->updateRequest(q->selectionRect(differenceSelection)); + } else { + if (!oldSelection.isNull()) + emit q->updateRequest(q->selectionRect(oldSelection) | cursorRectPlusUnicodeDirectionMarkers(oldSelection)); + emit q->updateRequest(q->selectionRect() | cursorRectPlusUnicodeDirectionMarkers(cursor)); + } +} + +void QWidgetTextControlPrivate::selectionChanged(bool forceEmitSelectionChanged /*=false*/) +{ + Q_Q(QWidgetTextControl); + if (forceEmitSelectionChanged) + emit q->selectionChanged(); + + bool current = cursor.hasSelection(); + if (current == lastSelectionState) + return; + + lastSelectionState = current; + emit q->copyAvailable(current); + if (!forceEmitSelectionChanged) + emit q->selectionChanged(); + emit q->microFocusChanged(); +} + +void QWidgetTextControlPrivate::_q_updateCurrentCharFormatAndSelection() +{ + updateCurrentCharFormat(); + selectionChanged(); +} + +#ifndef QT_NO_CLIPBOARD +void QWidgetTextControlPrivate::setClipboardSelection() +{ + QClipboard *clipboard = QApplication::clipboard(); + if (!cursor.hasSelection() || !clipboard->supportsSelection()) + return; + Q_Q(QWidgetTextControl); + QMimeData *data = q->createMimeDataFromSelection(); + clipboard->setMimeData(data, QClipboard::Selection); +} +#endif + +void QWidgetTextControlPrivate::_q_emitCursorPosChanged(const QTextCursor &someCursor) +{ + Q_Q(QWidgetTextControl); + if (someCursor.isCopyOf(cursor)) { + emit q->cursorPositionChanged(); + emit q->microFocusChanged(); + } +} + +void QWidgetTextControlPrivate::_q_documentLayoutChanged() +{ + Q_Q(QWidgetTextControl); + QAbstractTextDocumentLayout *layout = doc->documentLayout(); + QObject::connect(layout, SIGNAL(update(QRectF)), q, SIGNAL(updateRequest(QRectF))); + QObject::connect(layout, SIGNAL(updateBlock(QTextBlock)), q, SLOT(_q_updateBlock(QTextBlock))); + QObject::connect(layout, SIGNAL(documentSizeChanged(QSizeF)), q, SIGNAL(documentSizeChanged(QSizeF))); + +} + +void QWidgetTextControlPrivate::setBlinkingCursorEnabled(bool enable) +{ + Q_Q(QWidgetTextControl); + + if (enable && QApplication::cursorFlashTime() > 0) + cursorBlinkTimer.start(QApplication::cursorFlashTime() / 2, q); + else + cursorBlinkTimer.stop(); + + cursorOn = enable; + + repaintCursor(); +} + +void QWidgetTextControlPrivate::extendWordwiseSelection(int suggestedNewPosition, qreal mouseXPosition) +{ + Q_Q(QWidgetTextControl); + + // if inside the initial selected word keep that + if (suggestedNewPosition >= selectedWordOnDoubleClick.selectionStart() + && suggestedNewPosition <= selectedWordOnDoubleClick.selectionEnd()) { + q->setTextCursor(selectedWordOnDoubleClick); + return; + } + + QTextCursor curs = selectedWordOnDoubleClick; + curs.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor); + + if (!curs.movePosition(QTextCursor::StartOfWord)) + return; + const int wordStartPos = curs.position(); + + const int blockPos = curs.block().position(); + const QPointF blockCoordinates = q->blockBoundingRect(curs.block()).topLeft(); + + QTextLine line = currentTextLine(curs); + if (!line.isValid()) + return; + + const qreal wordStartX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x(); + + if (!curs.movePosition(QTextCursor::EndOfWord)) + return; + const int wordEndPos = curs.position(); + + const QTextLine otherLine = currentTextLine(curs); + if (otherLine.textStart() != line.textStart() + || wordEndPos == wordStartPos) + return; + + const qreal wordEndX = line.cursorToX(curs.position() - blockPos) + blockCoordinates.x(); + + if (!wordSelectionEnabled && (mouseXPosition < wordStartX || mouseXPosition > wordEndX)) + return; + + // keep the already selected word even when moving to the left + // (#39164) + if (suggestedNewPosition < selectedWordOnDoubleClick.position()) + cursor.setPosition(selectedWordOnDoubleClick.selectionEnd()); + else + cursor.setPosition(selectedWordOnDoubleClick.selectionStart()); + + const qreal differenceToStart = mouseXPosition - wordStartX; + const qreal differenceToEnd = wordEndX - mouseXPosition; + + if (differenceToStart < differenceToEnd) + setCursorPosition(wordStartPos, QTextCursor::KeepAnchor); + else + setCursorPosition(wordEndPos, QTextCursor::KeepAnchor); + + if (interactionFlags & Qt::TextSelectableByMouse) { +#ifndef QT_NO_CLIPBOARD + setClipboardSelection(); +#endif + selectionChanged(true); + } +} + +void QWidgetTextControlPrivate::extendBlockwiseSelection(int suggestedNewPosition) +{ + Q_Q(QWidgetTextControl); + + // if inside the initial selected line keep that + if (suggestedNewPosition >= selectedBlockOnTrippleClick.selectionStart() + && suggestedNewPosition <= selectedBlockOnTrippleClick.selectionEnd()) { + q->setTextCursor(selectedBlockOnTrippleClick); + return; + } + + if (suggestedNewPosition < selectedBlockOnTrippleClick.position()) { + cursor.setPosition(selectedBlockOnTrippleClick.selectionEnd()); + cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor); + } else { + cursor.setPosition(selectedBlockOnTrippleClick.selectionStart()); + cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); + } + + if (interactionFlags & Qt::TextSelectableByMouse) { +#ifndef QT_NO_CLIPBOARD + setClipboardSelection(); +#endif + selectionChanged(true); + } +} + +void QWidgetTextControlPrivate::_q_deleteSelected() +{ + if (!(interactionFlags & Qt::TextEditable) || !cursor.hasSelection()) + return; + cursor.removeSelectedText(); +} + +void QWidgetTextControl::undo() +{ + Q_D(QWidgetTextControl); + d->repaintSelection(); + const int oldCursorPos = d->cursor.position(); + d->doc->undo(&d->cursor); + if (d->cursor.position() != oldCursorPos) + emit cursorPositionChanged(); + emit microFocusChanged(); + ensureCursorVisible(); +} + +void QWidgetTextControl::redo() +{ + Q_D(QWidgetTextControl); + d->repaintSelection(); + const int oldCursorPos = d->cursor.position(); + d->doc->redo(&d->cursor); + if (d->cursor.position() != oldCursorPos) + emit cursorPositionChanged(); + emit microFocusChanged(); + ensureCursorVisible(); +} + +QWidgetTextControl::QWidgetTextControl(QObject *parent) + : QObject(*new QWidgetTextControlPrivate, parent) +{ + Q_D(QWidgetTextControl); + d->init(); +} + +QWidgetTextControl::QWidgetTextControl(const QString &text, QObject *parent) + : QObject(*new QWidgetTextControlPrivate, parent) +{ + Q_D(QWidgetTextControl); + d->init(Qt::RichText, text); +} + +QWidgetTextControl::QWidgetTextControl(QTextDocument *doc, QObject *parent) + : QObject(*new QWidgetTextControlPrivate, parent) +{ + Q_D(QWidgetTextControl); + d->init(Qt::RichText, QString(), doc); +} + +QWidgetTextControl::~QWidgetTextControl() +{ +} + +void QWidgetTextControl::setDocument(QTextDocument *document) +{ + Q_D(QWidgetTextControl); + if (d->doc == document) + return; + + d->doc->disconnect(this); + d->doc->documentLayout()->disconnect(this); + d->doc->documentLayout()->setPaintDevice(0); + + if (d->doc->parent() == this) + delete d->doc; + + d->doc = 0; + d->setContent(Qt::RichText, QString(), document); +} + +QTextDocument *QWidgetTextControl::document() const +{ + Q_D(const QWidgetTextControl); + return d->doc; +} + +void QWidgetTextControl::setTextCursor(const QTextCursor &cursor) +{ + Q_D(QWidgetTextControl); + d->cursorIsFocusIndicator = false; + const bool posChanged = cursor.position() != d->cursor.position(); + const QTextCursor oldSelection = d->cursor; + d->cursor = cursor; + d->cursorOn = d->hasFocus && (d->interactionFlags & Qt::TextEditable); + d->_q_updateCurrentCharFormatAndSelection(); + ensureCursorVisible(); + d->repaintOldAndNewSelection(oldSelection); + if (posChanged) + emit cursorPositionChanged(); +} + +QTextCursor QWidgetTextControl::textCursor() const +{ + Q_D(const QWidgetTextControl); + return d->cursor; +} + +#ifndef QT_NO_CLIPBOARD + +void QWidgetTextControl::cut() +{ + Q_D(QWidgetTextControl); + if (!(d->interactionFlags & Qt::TextEditable) || !d->cursor.hasSelection()) + return; + copy(); + d->cursor.removeSelectedText(); +} + +void QWidgetTextControl::copy() +{ + Q_D(QWidgetTextControl); + if (!d->cursor.hasSelection()) + return; + QMimeData *data = createMimeDataFromSelection(); + QApplication::clipboard()->setMimeData(data); +} + +void QWidgetTextControl::paste(QClipboard::Mode mode) +{ + const QMimeData *md = QApplication::clipboard()->mimeData(mode); + if (md) + insertFromMimeData(md); +} +#endif + +void QWidgetTextControl::clear() +{ + Q_D(QWidgetTextControl); + // clears and sets empty content + d->extraSelections.clear(); + d->setContent(); +} + + +void QWidgetTextControl::selectAll() +{ + Q_D(QWidgetTextControl); + const int selectionLength = qAbs(d->cursor.position() - d->cursor.anchor()); + d->cursor.select(QTextCursor::Document); + d->selectionChanged(selectionLength != qAbs(d->cursor.position() - d->cursor.anchor())); + d->cursorIsFocusIndicator = false; + emit updateRequest(); +} + +void QWidgetTextControl::processEvent(QEvent *e, const QPointF &coordinateOffset, QWidget *contextWidget) +{ + QMatrix m; + m.translate(coordinateOffset.x(), coordinateOffset.y()); + processEvent(e, m, contextWidget); +} + +void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget) +{ + Q_D(QWidgetTextControl); + if (d->interactionFlags == Qt::NoTextInteraction) { + e->ignore(); + return; + } + + d->contextWidget = contextWidget; + + if (!d->contextWidget) { + switch (e->type()) { +#ifndef QT_NO_GRAPHICSVIEW + case QEvent::GraphicsSceneMouseMove: + case QEvent::GraphicsSceneMousePress: + case QEvent::GraphicsSceneMouseRelease: + case QEvent::GraphicsSceneMouseDoubleClick: + case QEvent::GraphicsSceneContextMenu: + case QEvent::GraphicsSceneHoverEnter: + case QEvent::GraphicsSceneHoverMove: + case QEvent::GraphicsSceneHoverLeave: + case QEvent::GraphicsSceneHelp: + case QEvent::GraphicsSceneDragEnter: + case QEvent::GraphicsSceneDragMove: + case QEvent::GraphicsSceneDragLeave: + case QEvent::GraphicsSceneDrop: { + QGraphicsSceneEvent *ev = static_cast<QGraphicsSceneEvent *>(e); + d->contextWidget = ev->widget(); + break; + } +#endif // QT_NO_GRAPHICSVIEW + default: break; + }; + } + + switch (e->type()) { + case QEvent::KeyPress: + d->keyPressEvent(static_cast<QKeyEvent *>(e)); + break; + case QEvent::MouseButtonPress: { + QMouseEvent *ev = static_cast<QMouseEvent *>(e); + d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + ev->buttons(), ev->globalPos()); + break; } + case QEvent::MouseMove: { + QMouseEvent *ev = static_cast<QMouseEvent *>(e); + d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + ev->buttons(), ev->globalPos()); + break; } + case QEvent::MouseButtonRelease: { + QMouseEvent *ev = static_cast<QMouseEvent *>(e); + d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + ev->buttons(), ev->globalPos()); + break; } + case QEvent::MouseButtonDblClick: { + QMouseEvent *ev = static_cast<QMouseEvent *>(e); + d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), + ev->buttons(), ev->globalPos()); + break; } + case QEvent::InputMethod: + d->inputMethodEvent(static_cast<QInputMethodEvent *>(e)); + break; +#ifndef QT_NO_CONTEXTMENU + case QEvent::ContextMenu: { + QContextMenuEvent *ev = static_cast<QContextMenuEvent *>(e); + d->contextMenuEvent(ev->globalPos(), matrix.map(ev->pos()), contextWidget); + break; } +#endif // QT_NO_CONTEXTMENU + case QEvent::FocusIn: + case QEvent::FocusOut: + d->focusEvent(static_cast<QFocusEvent *>(e)); + break; + + case QEvent::EnabledChange: + d->isEnabled = e->isAccepted(); + break; + +#ifndef QT_NO_TOOLTIP + case QEvent::ToolTip: { + QHelpEvent *ev = static_cast<QHelpEvent *>(e); + d->showToolTip(ev->globalPos(), matrix.map(ev->pos()), contextWidget); + break; + } +#endif // QT_NO_TOOLTIP + +#ifndef QT_NO_DRAGANDDROP + case QEvent::DragEnter: { + QDragEnterEvent *ev = static_cast<QDragEnterEvent *>(e); + if (d->dragEnterEvent(e, ev->mimeData())) + ev->acceptProposedAction(); + break; + } + case QEvent::DragLeave: + d->dragLeaveEvent(); + break; + case QEvent::DragMove: { + QDragMoveEvent *ev = static_cast<QDragMoveEvent *>(e); + if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))) + ev->acceptProposedAction(); + break; + } + case QEvent::Drop: { + QDropEvent *ev = static_cast<QDropEvent *>(e); + if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())) + ev->acceptProposedAction(); + break; + } +#endif + +#ifndef QT_NO_GRAPHICSVIEW + case QEvent::GraphicsSceneMousePress: { + QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); + d->mousePressEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + ev->screenPos()); + break; } + case QEvent::GraphicsSceneMouseMove: { + QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); + d->mouseMoveEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + ev->screenPos()); + break; } + case QEvent::GraphicsSceneMouseRelease: { + QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); + d->mouseReleaseEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + ev->screenPos()); + break; } + case QEvent::GraphicsSceneMouseDoubleClick: { + QGraphicsSceneMouseEvent *ev = static_cast<QGraphicsSceneMouseEvent *>(e); + d->mouseDoubleClickEvent(ev, ev->button(), matrix.map(ev->pos()), ev->modifiers(), ev->buttons(), + ev->screenPos()); + break; } + case QEvent::GraphicsSceneContextMenu: { + QGraphicsSceneContextMenuEvent *ev = static_cast<QGraphicsSceneContextMenuEvent *>(e); + d->contextMenuEvent(ev->screenPos(), matrix.map(ev->pos()), contextWidget); + break; } + + case QEvent::GraphicsSceneHoverMove: { + QGraphicsSceneHoverEvent *ev = static_cast<QGraphicsSceneHoverEvent *>(e); + d->mouseMoveEvent(ev, Qt::NoButton, matrix.map(ev->pos()), ev->modifiers(),Qt::NoButton, + ev->screenPos()); + break; } + + case QEvent::GraphicsSceneDragEnter: { + QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e); + if (d->dragEnterEvent(e, ev->mimeData())) + ev->acceptProposedAction(); + break; } + case QEvent::GraphicsSceneDragLeave: + d->dragLeaveEvent(); + break; + case QEvent::GraphicsSceneDragMove: { + QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e); + if (d->dragMoveEvent(e, ev->mimeData(), matrix.map(ev->pos()))) + ev->acceptProposedAction(); + break; } + case QEvent::GraphicsSceneDrop: { + QGraphicsSceneDragDropEvent *ev = static_cast<QGraphicsSceneDragDropEvent *>(e); + if (d->dropEvent(ev->mimeData(), matrix.map(ev->pos()), ev->dropAction(), ev->source())) + ev->accept(); + break; } +#endif // QT_NO_GRAPHICSVIEW +#ifdef QT_KEYPAD_NAVIGATION + case QEvent::EnterEditFocus: + case QEvent::LeaveEditFocus: + if (QApplication::keypadNavigationEnabled()) + d->editFocusEvent(e); + break; +#endif + case QEvent::ShortcutOverride: + if (d->interactionFlags & Qt::TextEditable) { + QKeyEvent* ke = static_cast<QKeyEvent *>(e); + if (ke->modifiers() == Qt::NoModifier + || ke->modifiers() == Qt::ShiftModifier + || ke->modifiers() == Qt::KeypadModifier) { + if (ke->key() < Qt::Key_Escape) { + ke->accept(); + } else { + switch (ke->key()) { + case Qt::Key_Return: + case Qt::Key_Enter: + case Qt::Key_Delete: + case Qt::Key_Home: + case Qt::Key_End: + case Qt::Key_Backspace: + case Qt::Key_Left: + case Qt::Key_Right: + case Qt::Key_Up: + case Qt::Key_Down: + case Qt::Key_Tab: + ke->accept(); + default: + break; + } + } +#ifndef QT_NO_SHORTCUT + } else if (ke == QKeySequence::Copy + || ke == QKeySequence::Paste + || ke == QKeySequence::Cut + || ke == QKeySequence::Redo + || ke == QKeySequence::Undo + || ke == QKeySequence::MoveToNextWord + || ke == QKeySequence::MoveToPreviousWord + || ke == QKeySequence::MoveToStartOfDocument + || ke == QKeySequence::MoveToEndOfDocument + || ke == QKeySequence::SelectNextWord + || ke == QKeySequence::SelectPreviousWord + || ke == QKeySequence::SelectStartOfLine + || ke == QKeySequence::SelectEndOfLine + || ke == QKeySequence::SelectStartOfBlock + || ke == QKeySequence::SelectEndOfBlock + || ke == QKeySequence::SelectStartOfDocument + || ke == QKeySequence::SelectEndOfDocument + || ke == QKeySequence::SelectAll + ) { + ke->accept(); +#endif + } + } + break; + default: + break; + } +} + +bool QWidgetTextControl::event(QEvent *e) +{ + return QObject::event(e); +} + +void QWidgetTextControl::timerEvent(QTimerEvent *e) +{ + Q_D(QWidgetTextControl); + if (e->timerId() == d->cursorBlinkTimer.timerId()) { + d->cursorOn = !d->cursorOn; + + if (d->cursor.hasSelection()) + d->cursorOn &= (QApplication::style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected) + != 0); + + d->repaintCursor(); + } else if (e->timerId() == d->trippleClickTimer.timerId()) { + d->trippleClickTimer.stop(); + } +} + +void QWidgetTextControl::setPlainText(const QString &text) +{ + Q_D(QWidgetTextControl); + d->setContent(Qt::PlainText, text); +} + +void QWidgetTextControl::setHtml(const QString &text) +{ + Q_D(QWidgetTextControl); + d->setContent(Qt::RichText, text); +} + +void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e) +{ + Q_Q(QWidgetTextControl); +#ifndef QT_NO_SHORTCUT + if (e == QKeySequence::SelectAll) { + e->accept(); + q->selectAll(); + return; + } +#ifndef QT_NO_CLIPBOARD + else if (e == QKeySequence::Copy) { + e->accept(); + q->copy(); + return; + } +#endif +#endif // QT_NO_SHORTCUT + + if (interactionFlags & Qt::TextSelectableByKeyboard + && cursorMoveKeyEvent(e)) + goto accept; + + if (interactionFlags & Qt::LinksAccessibleByKeyboard) { + if ((e->key() == Qt::Key_Return + || e->key() == Qt::Key_Enter +#ifdef QT_KEYPAD_NAVIGATION + || e->key() == Qt::Key_Select +#endif + ) + && cursor.hasSelection()) { + + e->accept(); + activateLinkUnderCursor(); + return; + } + } + + if (!(interactionFlags & Qt::TextEditable)) { + e->ignore(); + return; + } + + if (e->key() == Qt::Key_Direction_L || e->key() == Qt::Key_Direction_R) { + QTextBlockFormat fmt; + fmt.setLayoutDirection((e->key() == Qt::Key_Direction_L) ? Qt::LeftToRight : Qt::RightToLeft); + cursor.mergeBlockFormat(fmt); + goto accept; + } + + // schedule a repaint of the region of the cursor, as when we move it we + // want to make sure the old cursor disappears (not noticeable when moving + // only a few pixels but noticeable when jumping between cells in tables for + // example) + repaintSelection(); + + if (e->key() == Qt::Key_Backspace && !(e->modifiers() & ~Qt::ShiftModifier)) { + QTextBlockFormat blockFmt = cursor.blockFormat(); + QTextList *list = cursor.currentList(); + if (list && cursor.atBlockStart() && !cursor.hasSelection()) { + list->remove(cursor.block()); + } else if (cursor.atBlockStart() && blockFmt.indent() > 0) { + blockFmt.setIndent(blockFmt.indent() - 1); + cursor.setBlockFormat(blockFmt); + } else { + QTextCursor localCursor = cursor; + localCursor.deletePreviousChar(); + } + goto accept; + } +#ifndef QT_NO_SHORTCUT + else if (e == QKeySequence::InsertParagraphSeparator) { + cursor.insertBlock(); + e->accept(); + goto accept; + } else if (e == QKeySequence::InsertLineSeparator) { + cursor.insertText(QString(QChar::LineSeparator)); + e->accept(); + goto accept; + } +#endif + if (false) { + } +#ifndef QT_NO_SHORTCUT + else if (e == QKeySequence::Undo) { + q->undo(); + } + else if (e == QKeySequence::Redo) { + q->redo(); + } +#ifndef QT_NO_CLIPBOARD + else if (e == QKeySequence::Cut) { + q->cut(); + } + else if (e == QKeySequence::Paste) { + QClipboard::Mode mode = QClipboard::Clipboard; +#ifdef Q_WS_X11 + if (e->modifiers() == (Qt::CTRL | Qt::SHIFT) && e->key() == Qt::Key_Insert) + mode = QClipboard::Selection; +#endif + q->paste(mode); + } +#endif + else if (e == QKeySequence::Delete) { + QTextCursor localCursor = cursor; + localCursor.deleteChar(); + } + else if (e == QKeySequence::DeleteEndOfWord) { + if (!cursor.hasSelection()) + cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor); + cursor.removeSelectedText(); + } + else if (e == QKeySequence::DeleteStartOfWord) { + if (!cursor.hasSelection()) + cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor); + cursor.removeSelectedText(); + } + else if (e == QKeySequence::DeleteEndOfLine) { + QTextBlock block = cursor.block(); + if (cursor.position() == block.position() + block.length() - 2) + cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor); + else + cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); + cursor.removeSelectedText(); + } +#endif // QT_NO_SHORTCUT + else { + goto process; + } + goto accept; + +process: + { + QString text = e->text(); + if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) { + if (overwriteMode + // no need to call deleteChar() if we have a selection, insertText + // does it already + && !cursor.hasSelection() + && !cursor.atBlockEnd()) + cursor.deleteChar(); + + cursor.insertText(text); + selectionChanged(); + } else { + e->ignore(); + return; + } + } + + accept: + + e->accept(); + cursorOn = true; + + q->ensureCursorVisible(); + + updateCurrentCharFormat(); +} + +QVariant QWidgetTextControl::loadResource(int type, const QUrl &name) +{ +#ifdef QT_NO_TEXTEDIT + Q_UNUSED(type); + Q_UNUSED(name); +#else + if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(parent())) { + QUrl resolvedName = textEdit->d_func()->resolveUrl(name); + return textEdit->loadResource(type, resolvedName); + } +#endif + return QVariant(); +} + +void QWidgetTextControlPrivate::_q_updateBlock(const QTextBlock &block) +{ + Q_Q(QWidgetTextControl); + QRectF br = q->blockBoundingRect(block); + br.setRight(qreal(INT_MAX)); // the block might have shrunk + emit q->updateRequest(br); +} + +QRectF QWidgetTextControlPrivate::rectForPosition(int position) const +{ + Q_Q(const QWidgetTextControl); + const QTextBlock block = doc->findBlock(position); + if (!block.isValid()) + return QRectF(); + const QAbstractTextDocumentLayout *docLayout = doc->documentLayout(); + const QTextLayout *layout = block.layout(); + const QPointF layoutPos = q->blockBoundingRect(block).topLeft(); + int relativePos = position - block.position(); + if (preeditCursor != 0) { + int preeditPos = layout->preeditAreaPosition(); + if (relativePos == preeditPos) + relativePos += preeditCursor; + else if (relativePos > preeditPos) + relativePos += layout->preeditAreaText().length(); + } + QTextLine line = layout->lineForTextPosition(relativePos); + + int cursorWidth; + { + bool ok = false; +#ifndef QT_NO_PROPERTIES + cursorWidth = docLayout->property("cursorWidth").toInt(&ok); +#endif + if (!ok) + cursorWidth = 1; + } + + QRectF r; + + if (line.isValid()) { + qreal x = line.cursorToX(relativePos); + qreal w = 0; + if (overwriteMode) { + if (relativePos < line.textLength() - line.textStart()) + w = line.cursorToX(relativePos + 1) - x; + else + w = QFontMetrics(block.layout()->font()).width(QLatin1Char(' ')); // in sync with QTextLine::draw() + } + r = QRectF(layoutPos.x() + x, layoutPos.y() + line.y(), + cursorWidth + w, line.height()); + } else { + r = QRectF(layoutPos.x(), layoutPos.y(), cursorWidth, 10); // #### correct height + } + + return r; +} + +static inline bool firstFramePosLessThanCursorPos(QTextFrame *frame, int position) +{ + return frame->firstPosition() < position; +} + +static inline bool cursorPosLessThanLastFramePos(int position, QTextFrame *frame) +{ + return position < frame->lastPosition(); +} + +static QRectF boundingRectOfFloatsInSelection(const QTextCursor &cursor) +{ + QRectF r; + QTextFrame *frame = cursor.currentFrame(); + const QList<QTextFrame *> children = frame->childFrames(); + + const QList<QTextFrame *>::ConstIterator firstFrame = qLowerBound(children.constBegin(), children.constEnd(), + cursor.selectionStart(), firstFramePosLessThanCursorPos); + const QList<QTextFrame *>::ConstIterator lastFrame = qUpperBound(children.constBegin(), children.constEnd(), + cursor.selectionEnd(), cursorPosLessThanLastFramePos); + for (QList<QTextFrame *>::ConstIterator it = firstFrame; it != lastFrame; ++it) { + if ((*it)->frameFormat().position() != QTextFrameFormat::InFlow) + r |= frame->document()->documentLayout()->frameBoundingRect(*it); + } + return r; +} + +QRectF QWidgetTextControl::selectionRect(const QTextCursor &cursor) const +{ + Q_D(const QWidgetTextControl); + + QRectF r = d->rectForPosition(cursor.selectionStart()); + + if (cursor.hasComplexSelection() && cursor.currentTable()) { + QTextTable *table = cursor.currentTable(); + + r = d->doc->documentLayout()->frameBoundingRect(table); + /* + int firstRow, numRows, firstColumn, numColumns; + cursor.selectedTableCells(&firstRow, &numRows, &firstColumn, &numColumns); + + const QTextTableCell firstCell = table->cellAt(firstRow, firstColumn); + const QTextTableCell lastCell = table->cellAt(firstRow + numRows - 1, firstColumn + numColumns - 1); + + const QAbstractTextDocumentLayout * const layout = doc->documentLayout(); + + QRectF tableSelRect = layout->blockBoundingRect(firstCell.firstCursorPosition().block()); + + for (int col = firstColumn; col < firstColumn + numColumns; ++col) { + const QTextTableCell cell = table->cellAt(firstRow, col); + const qreal y = layout->blockBoundingRect(cell.firstCursorPosition().block()).top(); + + tableSelRect.setTop(qMin(tableSelRect.top(), y)); + } + + for (int row = firstRow; row < firstRow + numRows; ++row) { + const QTextTableCell cell = table->cellAt(row, firstColumn); + const qreal x = layout->blockBoundingRect(cell.firstCursorPosition().block()).left(); + + tableSelRect.setLeft(qMin(tableSelRect.left(), x)); + } + + for (int col = firstColumn; col < firstColumn + numColumns; ++col) { + const QTextTableCell cell = table->cellAt(firstRow + numRows - 1, col); + const qreal y = layout->blockBoundingRect(cell.lastCursorPosition().block()).bottom(); + + tableSelRect.setBottom(qMax(tableSelRect.bottom(), y)); + } + + for (int row = firstRow; row < firstRow + numRows; ++row) { + const QTextTableCell cell = table->cellAt(row, firstColumn + numColumns - 1); + const qreal x = layout->blockBoundingRect(cell.lastCursorPosition().block()).right(); + + tableSelRect.setRight(qMax(tableSelRect.right(), x)); + } + + r = tableSelRect.toRect(); + */ + } else if (cursor.hasSelection()) { + const int position = cursor.selectionStart(); + const int anchor = cursor.selectionEnd(); + const QTextBlock posBlock = d->doc->findBlock(position); + const QTextBlock anchorBlock = d->doc->findBlock(anchor); + if (posBlock == anchorBlock && posBlock.isValid() && posBlock.layout()->lineCount()) { + const QTextLine posLine = posBlock.layout()->lineForTextPosition(position - posBlock.position()); + const QTextLine anchorLine = anchorBlock.layout()->lineForTextPosition(anchor - anchorBlock.position()); + + const int firstLine = qMin(posLine.lineNumber(), anchorLine.lineNumber()); + const int lastLine = qMax(posLine.lineNumber(), anchorLine.lineNumber()); + const QTextLayout *layout = posBlock.layout(); + r = QRectF(); + for (int i = firstLine; i <= lastLine; ++i) { + r |= layout->lineAt(i).rect(); + r |= layout->lineAt(i).naturalTextRect(); // might be bigger in the case of wrap not enabled + } + r.translate(blockBoundingRect(posBlock).topLeft()); + } else { + QRectF anchorRect = d->rectForPosition(cursor.selectionEnd()); + r |= anchorRect; + r |= boundingRectOfFloatsInSelection(cursor); + QRectF frameRect(d->doc->documentLayout()->frameBoundingRect(cursor.currentFrame())); + r.setLeft(frameRect.left()); + r.setRight(frameRect.right()); + } + if (r.isValid()) + r.adjust(-1, -1, 1, 1); + } + + return r; +} + +QRectF QWidgetTextControl::selectionRect() const +{ + Q_D(const QWidgetTextControl); + return selectionRect(d->cursor); +} + +void QWidgetTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, Qt::KeyboardModifiers modifiers, + Qt::MouseButtons buttons, const QPoint &globalPos) +{ + Q_Q(QWidgetTextControl); + + if (sendMouseEventToInputContext( + e, QEvent::MouseButtonPress, button, pos, modifiers, buttons, globalPos)) { + return; + } + + if (interactionFlags & Qt::LinksAccessibleByMouse) { + anchorOnMousePress = q->anchorAt(pos); + + if (cursorIsFocusIndicator) { + cursorIsFocusIndicator = false; + repaintSelection(); + cursor.clearSelection(); + } + } + if (!(button & Qt::LeftButton) || + !((interactionFlags & Qt::TextSelectableByMouse) || (interactionFlags & Qt::TextEditable))) { + e->ignore(); + return; + } + + cursorIsFocusIndicator = false; + const QTextCursor oldSelection = cursor; + const int oldCursorPos = cursor.position(); + + mousePressed = (interactionFlags & Qt::TextSelectableByMouse); +#ifndef QT_NO_DRAGANDDROP + mightStartDrag = false; +#endif + + if (trippleClickTimer.isActive() + && ((pos - trippleClickPoint).toPoint().manhattanLength() < QApplication::startDragDistance())) { + + cursor.movePosition(QTextCursor::StartOfBlock); + cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); + cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); + selectedBlockOnTrippleClick = cursor; + + anchorOnMousePress = QString(); + + trippleClickTimer.stop(); + } else { + int cursorPos = q->hitTest(pos, Qt::FuzzyHit); + if (cursorPos == -1) { + e->ignore(); + return; + } + + if (modifiers == Qt::ShiftModifier && (interactionFlags & Qt::TextSelectableByMouse)) { + if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) { + selectedWordOnDoubleClick = cursor; + selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor); + } + + if (selectedBlockOnTrippleClick.hasSelection()) + extendBlockwiseSelection(cursorPos); + else if (selectedWordOnDoubleClick.hasSelection()) + extendWordwiseSelection(cursorPos, pos.x()); + else if (!wordSelectionEnabled) + setCursorPosition(cursorPos, QTextCursor::KeepAnchor); + } else { + + if (dragEnabled + && cursor.hasSelection() + && !cursorIsFocusIndicator + && cursorPos >= cursor.selectionStart() + && cursorPos <= cursor.selectionEnd() + && q->hitTest(pos, Qt::ExactHit) != -1) { +#ifndef QT_NO_DRAGANDDROP + mightStartDrag = true; + dragStartPos = pos.toPoint(); +#endif + return; + } + + setCursorPosition(cursorPos); + } + } + + if (interactionFlags & Qt::TextEditable) { + q->ensureCursorVisible(); + if (cursor.position() != oldCursorPos) + emit q->cursorPositionChanged(); + _q_updateCurrentCharFormatAndSelection(); + } else { + if (cursor.position() != oldCursorPos) { + emit q->cursorPositionChanged(); + emit q->microFocusChanged(); + } + selectionChanged(); + } + repaintOldAndNewSelection(oldSelection); + hadSelectionOnMousePress = cursor.hasSelection(); +} + +void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button, const QPointF &mousePos, Qt::KeyboardModifiers modifiers, + Qt::MouseButtons buttons, const QPoint &globalPos) +{ + Q_Q(QWidgetTextControl); + + if (sendMouseEventToInputContext( + e, QEvent::MouseMove, button, mousePos, modifiers, buttons, globalPos)) { + return; + } + + if (interactionFlags & Qt::LinksAccessibleByMouse) { + QString anchor = q->anchorAt(mousePos); + if (anchor != highlightedAnchor) { + highlightedAnchor = anchor; + emit q->linkHovered(anchor); + } + } + + if (!(buttons & Qt::LeftButton)) + return; + + const bool editable = interactionFlags & Qt::TextEditable; + + if (!(mousePressed + || editable + || mightStartDrag + || selectedWordOnDoubleClick.hasSelection() + || selectedBlockOnTrippleClick.hasSelection())) + return; + + const QTextCursor oldSelection = cursor; + const int oldCursorPos = cursor.position(); + + if (mightStartDrag) { + if ((mousePos.toPoint() - dragStartPos).manhattanLength() > QApplication::startDragDistance()) + startDrag(); + return; + } + + if (!mousePressed) + return; + + const qreal mouseX = qreal(mousePos.x()); + + int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit); + if (newCursorPos == -1) + return; + + if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) { + selectedWordOnDoubleClick = cursor; + selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor); + } + + if (selectedBlockOnTrippleClick.hasSelection()) + extendBlockwiseSelection(newCursorPos); + else if (selectedWordOnDoubleClick.hasSelection()) + extendWordwiseSelection(newCursorPos, mouseX); + else + setCursorPosition(newCursorPos, QTextCursor::KeepAnchor); + + if (interactionFlags & Qt::TextEditable) { + // don't call ensureVisible for the visible cursor to avoid jumping + // scrollbars. the autoscrolling ensures smooth scrolling if necessary. + //q->ensureCursorVisible(); + if (cursor.position() != oldCursorPos) + emit q->cursorPositionChanged(); + _q_updateCurrentCharFormatAndSelection(); +#ifndef QT_NO_IM + if (contextWidget) { + if (QInputContext *ic = inputContext()) { + ic->update(); + } + } +#endif //QT_NO_IM + } else { + //emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1))); + if (cursor.position() != oldCursorPos) + emit q->cursorPositionChanged(); + } + selectionChanged(true); + repaintOldAndNewSelection(oldSelection); +} + +void QWidgetTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, Qt::KeyboardModifiers modifiers, + Qt::MouseButtons buttons, const QPoint &globalPos) +{ + Q_Q(QWidgetTextControl); + + if (sendMouseEventToInputContext( + e, QEvent::MouseButtonRelease, button, pos, modifiers, buttons, globalPos)) { + return; + } + + const QTextCursor oldSelection = cursor; + const int oldCursorPos = cursor.position(); + +#ifndef QT_NO_DRAGANDDROP + if (mightStartDrag && (button & Qt::LeftButton)) { + mousePressed = false; + setCursorPosition(pos); + cursor.clearSelection(); + selectionChanged(); + } +#endif + if (mousePressed) { + mousePressed = false; +#ifndef QT_NO_CLIPBOARD + setClipboardSelection(); + selectionChanged(true); + } else if (button == Qt::MidButton + && (interactionFlags & Qt::TextEditable) + && QApplication::clipboard()->supportsSelection()) { + setCursorPosition(pos); + const QMimeData *md = QApplication::clipboard()->mimeData(QClipboard::Selection); + if (md) + q->insertFromMimeData(md); +#endif + } + + repaintOldAndNewSelection(oldSelection); + + if (cursor.position() != oldCursorPos) + emit q->cursorPositionChanged(); + + if (interactionFlags & Qt::LinksAccessibleByMouse) { + if (!(button & Qt::LeftButton)) + return; + + const QString anchor = q->anchorAt(pos); + + if (anchor.isEmpty()) + return; + + if (!cursor.hasSelection() + || (anchor == anchorOnMousePress && hadSelectionOnMousePress)) { + + const int anchorPos = q->hitTest(pos, Qt::ExactHit); + if (anchorPos != -1) { + cursor.setPosition(anchorPos); + + QString anchor = anchorOnMousePress; + anchorOnMousePress = QString(); + activateLinkUnderCursor(anchor); + } + } + } +} + +void QWidgetTextControlPrivate::mouseDoubleClickEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, Qt::KeyboardModifiers modifiers, + Qt::MouseButtons buttons, const QPoint &globalPos) +{ + Q_Q(QWidgetTextControl); + + if (sendMouseEventToInputContext( + e, QEvent::MouseButtonDblClick, button, pos, modifiers, buttons, globalPos)) { + return; + } + + if (button != Qt::LeftButton + || !(interactionFlags & Qt::TextSelectableByMouse)) { + e->ignore(); + return; + } + +#ifndef QT_NO_DRAGANDDROP + mightStartDrag = false; +#endif + const QTextCursor oldSelection = cursor; + setCursorPosition(pos); + QTextLine line = currentTextLine(cursor); + bool doEmit = false; + if (line.isValid() && line.textLength()) { + cursor.select(QTextCursor::WordUnderCursor); + doEmit = true; + } + repaintOldAndNewSelection(oldSelection); + + cursorIsFocusIndicator = false; + selectedWordOnDoubleClick = cursor; + + trippleClickPoint = pos; + trippleClickTimer.start(QApplication::doubleClickInterval(), q); + if (doEmit) { + selectionChanged(); +#ifndef QT_NO_CLIPBOARD + setClipboardSelection(); +#endif + emit q->cursorPositionChanged(); + } +} + +bool QWidgetTextControlPrivate::sendMouseEventToInputContext( + QEvent *e, QEvent::Type eventType, Qt::MouseButton button, const QPointF &pos, + Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint &globalPos) +{ +#if !defined(QT_NO_IM) + Q_Q(QWidgetTextControl); + + QTextLayout *layout = cursor.block().layout(); + if (contextWidget && layout && !layout->preeditAreaText().isEmpty()) { + QInputContext *ctx = inputContext(); + int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position(); + + if (cursorPos < 0 || cursorPos > layout->preeditAreaText().length()) { + cursorPos = -1; + // don't send move events outside the preedit area + if (eventType == QEvent::MouseMove) + return true; + } + if (ctx) { + QMouseEvent ev(eventType, contextWidget->mapFromGlobal(globalPos), + contextWidget->topLevelWidget()->mapFromGlobal(globalPos), globalPos, + button, buttons, modifiers); + ctx->mouseHandler(cursorPos, &ev); + e->setAccepted(ev.isAccepted()); + } + if (!layout->preeditAreaText().isEmpty()) + return true; + } +#else + Q_UNUSED(e); + Q_UNUSED(eventType); + Q_UNUSED(button); + Q_UNUSED(pos); + Q_UNUSED(modifiers); + Q_UNUSED(buttons); + Q_UNUSED(globalPos); +#endif + return false; +} + +void QWidgetTextControlPrivate::contextMenuEvent(const QPoint &screenPos, const QPointF &docPos, QWidget *contextWidget) +{ +#ifdef QT_NO_CONTEXTMENU + Q_UNUSED(screenPos); + Q_UNUSED(docPos); + Q_UNUSED(contextWidget); +#else + Q_Q(QWidgetTextControl); + if (!hasFocus) + return; + QMenu *menu = q->createStandardContextMenu(docPos, contextWidget); + if (!menu) + return; + menu->setAttribute(Qt::WA_DeleteOnClose); + menu->popup(screenPos); +#endif +} + +bool QWidgetTextControlPrivate::dragEnterEvent(QEvent *e, const QMimeData *mimeData) +{ + Q_Q(QWidgetTextControl); + if (!(interactionFlags & Qt::TextEditable) || !q->canInsertFromMimeData(mimeData)) { + e->ignore(); + return false; + } + + dndFeedbackCursor = QTextCursor(); + + return true; // accept proposed action +} + +void QWidgetTextControlPrivate::dragLeaveEvent() +{ + Q_Q(QWidgetTextControl); + + const QRectF crect = q->cursorRect(dndFeedbackCursor); + dndFeedbackCursor = QTextCursor(); + + if (crect.isValid()) + emit q->updateRequest(crect); +} + +bool QWidgetTextControlPrivate::dragMoveEvent(QEvent *e, const QMimeData *mimeData, const QPointF &pos) +{ + Q_Q(QWidgetTextControl); + if (!(interactionFlags & Qt::TextEditable) || !q->canInsertFromMimeData(mimeData)) { + e->ignore(); + return false; + } + + const int cursorPos = q->hitTest(pos, Qt::FuzzyHit); + if (cursorPos != -1) { + QRectF crect = q->cursorRect(dndFeedbackCursor); + if (crect.isValid()) + emit q->updateRequest(crect); + + dndFeedbackCursor = cursor; + dndFeedbackCursor.setPosition(cursorPos); + + crect = q->cursorRect(dndFeedbackCursor); + emit q->updateRequest(crect); + } + + return true; // accept proposed action +} + +bool QWidgetTextControlPrivate::dropEvent(const QMimeData *mimeData, const QPointF &pos, Qt::DropAction dropAction, QObject *source) +{ + Q_Q(QWidgetTextControl); + dndFeedbackCursor = QTextCursor(); + + if (!(interactionFlags & Qt::TextEditable) || !q->canInsertFromMimeData(mimeData)) + return false; + + repaintSelection(); + + QTextCursor insertionCursor = q->cursorForPosition(pos); + insertionCursor.beginEditBlock(); + + if (dropAction == Qt::MoveAction && source == contextWidget) + cursor.removeSelectedText(); + + cursor = insertionCursor; + q->insertFromMimeData(mimeData); + insertionCursor.endEditBlock(); + q->ensureCursorVisible(); + return true; // accept proposed action +} + +void QWidgetTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) +{ + Q_Q(QWidgetTextControl); + if (!(interactionFlags & Qt::TextEditable) || cursor.isNull()) { + e->ignore(); + return; + } + bool isGettingInput = !e->commitString().isEmpty() + || e->preeditString() != cursor.block().layout()->preeditAreaText() + || e->replacementLength() > 0; + + cursor.beginEditBlock(); + if (isGettingInput) { + cursor.removeSelectedText(); + } + + // insert commit string + if (!e->commitString().isEmpty() || e->replacementLength()) { + QTextCursor c = cursor; + c.setPosition(c.position() + e->replacementStart()); + c.setPosition(c.position() + e->replacementLength(), QTextCursor::KeepAnchor); + c.insertText(e->commitString()); + } + + for (int i = 0; i < e->attributes().size(); ++i) { + const QInputMethodEvent::Attribute &a = e->attributes().at(i); + if (a.type == QInputMethodEvent::Selection) { + QTextCursor oldCursor = cursor; + int blockStart = a.start + cursor.block().position(); + cursor.setPosition(blockStart, QTextCursor::MoveAnchor); + cursor.setPosition(blockStart + a.length, QTextCursor::KeepAnchor); + q->ensureCursorVisible(); + repaintOldAndNewSelection(oldCursor); + } + } + + QTextBlock block = cursor.block(); + QTextLayout *layout = block.layout(); + if (isGettingInput) + layout->setPreeditArea(cursor.position() - block.position(), e->preeditString()); + QList<QTextLayout::FormatRange> overrides; + const int oldPreeditCursor = preeditCursor; + preeditCursor = e->preeditString().length(); + hideCursor = false; + for (int i = 0; i < e->attributes().size(); ++i) { + const QInputMethodEvent::Attribute &a = e->attributes().at(i); + if (a.type == QInputMethodEvent::Cursor) { + preeditCursor = a.start; + hideCursor = !a.length; + } else if (a.type == QInputMethodEvent::TextFormat) { + QTextCharFormat f = qvariant_cast<QTextFormat>(a.value).toCharFormat(); + if (f.isValid()) { + QTextLayout::FormatRange o; + o.start = a.start + cursor.position() - block.position(); + o.length = a.length; + o.format = f; + overrides.append(o); + } + } + } + layout->setAdditionalFormats(overrides); + cursor.endEditBlock(); + if (cursor.d) + cursor.d->setX(); + if (oldPreeditCursor != preeditCursor) + emit q->microFocusChanged(); +} + +QVariant QWidgetTextControl::inputMethodQuery(Qt::InputMethodQuery property) const +{ + Q_D(const QWidgetTextControl); + QTextBlock block = d->cursor.block(); + switch(property) { + case Qt::ImCursorRectangle: + return cursorRect(); + case Qt::ImFont: + return QVariant(d->cursor.charFormat().font()); + case Qt::ImCursorPosition: + return QVariant(d->cursor.position() - block.position()); + case Qt::ImSurroundingText: + return QVariant(block.text()); + case Qt::ImCurrentSelection: + return QVariant(d->cursor.selectedText()); + case Qt::ImMaximumTextLength: + return QVariant(); // No limit. + case Qt::ImAnchorPosition: + return QVariant(qBound(0, d->cursor.anchor() - block.position(), block.length())); + default: + return QVariant(); + } +} + +void QWidgetTextControl::setFocus(bool focus, Qt::FocusReason reason) +{ + QFocusEvent ev(focus ? QEvent::FocusIn : QEvent::FocusOut, + reason); + processEvent(&ev); +} + +void QWidgetTextControlPrivate::focusEvent(QFocusEvent *e) +{ + Q_Q(QWidgetTextControl); + emit q->updateRequest(q->selectionRect()); + if (e->gotFocus()) { +#ifdef QT_KEYPAD_NAVIGATION + if (!QApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason +#ifdef Q_OS_SYMBIAN + || e->reason() == Qt::ActiveWindowFocusReason +#endif + ))) { +#endif + cursorOn = (interactionFlags & Qt::TextSelectableByKeyboard); + if (interactionFlags & Qt::TextEditable) { + setBlinkingCursorEnabled(true); + } +#ifdef QT_KEYPAD_NAVIGATION + } +#endif + } else { + setBlinkingCursorEnabled(false); + + if (cursorIsFocusIndicator + && e->reason() != Qt::ActiveWindowFocusReason + && e->reason() != Qt::PopupFocusReason + && cursor.hasSelection()) { + cursor.clearSelection(); + } + } + hasFocus = e->gotFocus(); +} + +QString QWidgetTextControlPrivate::anchorForCursor(const QTextCursor &anchorCursor) const +{ + if (anchorCursor.hasSelection()) { + QTextCursor cursor = anchorCursor; + if (cursor.selectionStart() != cursor.position()) + cursor.setPosition(cursor.selectionStart()); + cursor.movePosition(QTextCursor::NextCharacter); + QTextCharFormat fmt = cursor.charFormat(); + if (fmt.isAnchor() && fmt.hasProperty(QTextFormat::AnchorHref)) + return fmt.stringProperty(QTextFormat::AnchorHref); + } + return QString(); +} + +#ifdef QT_KEYPAD_NAVIGATION +void QWidgetTextControlPrivate::editFocusEvent(QEvent *e) +{ + Q_Q(QWidgetTextControl); + + if (QApplication::keypadNavigationEnabled()) { + if (e->type() == QEvent::EnterEditFocus && interactionFlags & Qt::TextEditable) { + const QTextCursor oldSelection = cursor; + const int oldCursorPos = cursor.position(); + const bool moved = cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor); + q->ensureCursorVisible(); + if (moved) { + if (cursor.position() != oldCursorPos) + emit q->cursorPositionChanged(); + emit q->microFocusChanged(); + } + selectionChanged(); + repaintOldAndNewSelection(oldSelection); + + setBlinkingCursorEnabled(true); + } else + setBlinkingCursorEnabled(false); + } + + hasEditFocus = e->type() == QEvent::EnterEditFocus ? true : false; +} +#endif + +#ifndef QT_NO_CONTEXTMENU +QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget *parent) +{ + Q_D(QWidgetTextControl); + + const bool showTextSelectionActions = d->interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse); + + d->linkToCopy = QString(); + if (!pos.isNull()) + d->linkToCopy = anchorAt(pos); + + if (d->linkToCopy.isEmpty() && !showTextSelectionActions) + return 0; + + QMenu *menu = new QMenu(parent); + QAction *a; + + if (d->interactionFlags & Qt::TextEditable) { + a = menu->addAction(tr("&Undo") + ACCEL_KEY(QKeySequence::Undo), this, SLOT(undo())); + a->setEnabled(d->doc->isUndoAvailable()); + a = menu->addAction(tr("&Redo") + ACCEL_KEY(QKeySequence::Redo), this, SLOT(redo())); + a->setEnabled(d->doc->isRedoAvailable()); + menu->addSeparator(); + + a = menu->addAction(tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut), this, SLOT(cut())); + a->setEnabled(d->cursor.hasSelection()); + } + + if (showTextSelectionActions) { + a = menu->addAction(tr("&Copy") + ACCEL_KEY(QKeySequence::Copy), this, SLOT(copy())); + a->setEnabled(d->cursor.hasSelection()); + } + + if ((d->interactionFlags & Qt::LinksAccessibleByKeyboard) + || (d->interactionFlags & Qt::LinksAccessibleByMouse)) { + + a = menu->addAction(tr("Copy &Link Location"), this, SLOT(_q_copyLink())); + a->setEnabled(!d->linkToCopy.isEmpty()); + } + + if (d->interactionFlags & Qt::TextEditable) { +#if !defined(QT_NO_CLIPBOARD) + a = menu->addAction(tr("&Paste") + ACCEL_KEY(QKeySequence::Paste), this, SLOT(paste())); + a->setEnabled(canPaste()); +#endif + a = menu->addAction(tr("Delete"), this, SLOT(_q_deleteSelected())); + a->setEnabled(d->cursor.hasSelection()); + } + + + if (showTextSelectionActions) { + menu->addSeparator(); + a = menu->addAction(tr("Select All") + ACCEL_KEY(QKeySequence::SelectAll), this, SLOT(selectAll())); + a->setEnabled(!d->doc->isEmpty()); + } + +#if !defined(QT_NO_IM) + if (d->contextWidget) { + QInputContext *qic = d->inputContext(); + if (qic) { + QList<QAction *> imActions = qic->actions(); + for (int i = 0; i < imActions.size(); ++i) + menu->addAction(imActions.at(i)); + } + } +#endif + +#if defined(Q_WS_WIN) || defined(Q_WS_X11) + if ((d->interactionFlags & Qt::TextEditable) && qt_use_rtl_extensions) { +#else + if (d->interactionFlags & Qt::TextEditable) { +#endif + menu->addSeparator(); + QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, menu); + menu->addMenu(ctrlCharacterMenu); + } + + return menu; +} +#endif // QT_NO_CONTEXTMENU + +QTextCursor QWidgetTextControl::cursorForPosition(const QPointF &pos) const +{ + Q_D(const QWidgetTextControl); + int cursorPos = hitTest(pos, Qt::FuzzyHit); + if (cursorPos == -1) + cursorPos = 0; + QTextCursor c(d->doc); + c.setPosition(cursorPos); + return c; +} + +QRectF QWidgetTextControl::cursorRect(const QTextCursor &cursor) const +{ + Q_D(const QWidgetTextControl); + if (cursor.isNull()) + return QRectF(); + + return d->rectForPosition(cursor.position()); +} + +QRectF QWidgetTextControl::cursorRect() const +{ + Q_D(const QWidgetTextControl); + return cursorRect(d->cursor); +} + +QRectF QWidgetTextControlPrivate::cursorRectPlusUnicodeDirectionMarkers(const QTextCursor &cursor) const +{ + if (cursor.isNull()) + return QRectF(); + + return rectForPosition(cursor.position()).adjusted(-4, 0, 4, 0); +} + +QString QWidgetTextControl::anchorAt(const QPointF &pos) const +{ + Q_D(const QWidgetTextControl); + return d->doc->documentLayout()->anchorAt(pos); +} + +QString QWidgetTextControl::anchorAtCursor() const +{ + Q_D(const QWidgetTextControl); + + return d->anchorForCursor(d->cursor); +} + +bool QWidgetTextControl::overwriteMode() const +{ + Q_D(const QWidgetTextControl); + return d->overwriteMode; +} + +void QWidgetTextControl::setOverwriteMode(bool overwrite) +{ + Q_D(QWidgetTextControl); + d->overwriteMode = overwrite; +} + +int QWidgetTextControl::cursorWidth() const +{ +#ifndef QT_NO_PROPERTIES + Q_D(const QWidgetTextControl); + return d->doc->documentLayout()->property("cursorWidth").toInt(); +#else + return 1; +#endif +} + +void QWidgetTextControl::setCursorWidth(int width) +{ + Q_D(QWidgetTextControl); +#ifdef QT_NO_PROPERTIES + Q_UNUSED(width); +#else + if (width == -1) + width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth); + d->doc->documentLayout()->setProperty("cursorWidth", width); +#endif + d->repaintCursor(); +} + +bool QWidgetTextControl::acceptRichText() const +{ + Q_D(const QWidgetTextControl); + return d->acceptRichText; +} + +void QWidgetTextControl::setAcceptRichText(bool accept) +{ + Q_D(QWidgetTextControl); + d->acceptRichText = accept; +} + +#ifndef QT_NO_TEXTEDIT + +void QWidgetTextControl::setExtraSelections(const QList<QTextEdit::ExtraSelection> &selections) +{ + Q_D(QWidgetTextControl); + + QHash<int, int> hash; + for (int i = 0; i < d->extraSelections.count(); ++i) { + const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(i); + hash.insertMulti(esel.cursor.anchor(), i); + } + + for (int i = 0; i < selections.count(); ++i) { + const QTextEdit::ExtraSelection &sel = selections.at(i); + QHash<int, int>::iterator it = hash.find(sel.cursor.anchor()); + if (it != hash.end()) { + const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(it.value()); + if (esel.cursor.position() == sel.cursor.position() + && esel.format == sel.format) { + hash.erase(it); + continue; + } + } + QRectF r = selectionRect(sel.cursor); + if (sel.format.boolProperty(QTextFormat::FullWidthSelection)) { + r.setLeft(0); + r.setWidth(qreal(INT_MAX)); + } + emit updateRequest(r); + } + + for (QHash<int, int>::iterator it = hash.begin(); it != hash.end(); ++it) { + const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(it.value()); + QRectF r = selectionRect(esel.cursor); + if (esel.format.boolProperty(QTextFormat::FullWidthSelection)) { + r.setLeft(0); + r.setWidth(qreal(INT_MAX)); + } + emit updateRequest(r); + } + + d->extraSelections.resize(selections.count()); + for (int i = 0; i < selections.count(); ++i) { + d->extraSelections[i].cursor = selections.at(i).cursor; + d->extraSelections[i].format = selections.at(i).format; + } +} + +QList<QTextEdit::ExtraSelection> QWidgetTextControl::extraSelections() const +{ + Q_D(const QWidgetTextControl); + QList<QTextEdit::ExtraSelection> selections; + for (int i = 0; i < d->extraSelections.count(); ++i) { + QTextEdit::ExtraSelection sel; + sel.cursor = d->extraSelections.at(i).cursor; + sel.format = d->extraSelections.at(i).format; + selections.append(sel); + } + return selections; +} + +#endif // QT_NO_TEXTEDIT + +void QWidgetTextControl::setTextWidth(qreal width) +{ + Q_D(QWidgetTextControl); + d->doc->setTextWidth(width); +} + +qreal QWidgetTextControl::textWidth() const +{ + Q_D(const QWidgetTextControl); + return d->doc->textWidth(); +} + +QSizeF QWidgetTextControl::size() const +{ + Q_D(const QWidgetTextControl); + return d->doc->size(); +} + +void QWidgetTextControl::setOpenExternalLinks(bool open) +{ + Q_D(QWidgetTextControl); + d->openExternalLinks = open; +} + +bool QWidgetTextControl::openExternalLinks() const +{ + Q_D(const QWidgetTextControl); + return d->openExternalLinks; +} + +bool QWidgetTextControl::ignoreUnusedNavigationEvents() const +{ + Q_D(const QWidgetTextControl); + return d->ignoreUnusedNavigationEvents; +} + +void QWidgetTextControl::setIgnoreUnusedNavigationEvents(bool ignore) +{ + Q_D(QWidgetTextControl); + d->ignoreUnusedNavigationEvents = ignore; +} + +void QWidgetTextControl::moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode) +{ + Q_D(QWidgetTextControl); + const QTextCursor oldSelection = d->cursor; + const bool moved = d->cursor.movePosition(op, mode); + d->_q_updateCurrentCharFormatAndSelection(); + ensureCursorVisible(); + d->repaintOldAndNewSelection(oldSelection); + if (moved) + emit cursorPositionChanged(); +} + +bool QWidgetTextControl::canPaste() const +{ +#ifndef QT_NO_CLIPBOARD + Q_D(const QWidgetTextControl); + if (d->interactionFlags & Qt::TextEditable) { + const QMimeData *md = QApplication::clipboard()->mimeData(); + return md && canInsertFromMimeData(md); + } +#endif + return false; +} + +void QWidgetTextControl::setCursorIsFocusIndicator(bool b) +{ + Q_D(QWidgetTextControl); + d->cursorIsFocusIndicator = b; + d->repaintCursor(); +} + +bool QWidgetTextControl::cursorIsFocusIndicator() const +{ + Q_D(const QWidgetTextControl); + return d->cursorIsFocusIndicator; +} + + +void QWidgetTextControl::setDragEnabled(bool enabled) +{ + Q_D(QWidgetTextControl); + d->dragEnabled = enabled; +} + +bool QWidgetTextControl::isDragEnabled() const +{ + Q_D(const QWidgetTextControl); + return d->dragEnabled; +} + +void QWidgetTextControl::setWordSelectionEnabled(bool enabled) +{ + Q_D(QWidgetTextControl); + d->wordSelectionEnabled = enabled; +} + +bool QWidgetTextControl::isWordSelectionEnabled() const +{ + Q_D(const QWidgetTextControl); + return d->wordSelectionEnabled; +} + +void QWidgetTextControl::print(QPagedPaintDevice *printer) const +{ + Q_D(const QWidgetTextControl); + if (!printer) + return; + QTextDocument *tempDoc = 0; + const QTextDocument *doc = d->doc; + if (QPagedPaintDevicePrivate::get(printer)->printSelectionOnly) { + if (!d->cursor.hasSelection()) + return; + tempDoc = new QTextDocument(const_cast<QTextDocument *>(doc)); + tempDoc->setMetaInformation(QTextDocument::DocumentTitle, doc->metaInformation(QTextDocument::DocumentTitle)); + tempDoc->setPageSize(doc->pageSize()); + tempDoc->setDefaultFont(doc->defaultFont()); + tempDoc->setUseDesignMetrics(doc->useDesignMetrics()); + QTextCursor(tempDoc).insertFragment(d->cursor.selection()); + doc = tempDoc; + + // copy the custom object handlers + doc->documentLayout()->d_func()->handlers = d->doc->documentLayout()->d_func()->handlers; + } + doc->print(printer); + delete tempDoc; +} + +QMimeData *QWidgetTextControl::createMimeDataFromSelection() const +{ + Q_D(const QWidgetTextControl); + const QTextDocumentFragment fragment(d->cursor); + return new QTextEditMimeData(fragment); +} + +bool QWidgetTextControl::canInsertFromMimeData(const QMimeData *source) const +{ + Q_D(const QWidgetTextControl); + if (d->acceptRichText) + return (source->hasText() && !source->text().isEmpty()) + || source->hasHtml() + || source->hasFormat(QLatin1String("application/x-qrichtext")) + || source->hasFormat(QLatin1String("application/x-qt-richtext")); + else + return source->hasText() && !source->text().isEmpty(); +} + +void QWidgetTextControl::insertFromMimeData(const QMimeData *source) +{ + Q_D(QWidgetTextControl); + if (!(d->interactionFlags & Qt::TextEditable) || !source) + return; + + bool hasData = false; + QTextDocumentFragment fragment; +#ifndef QT_NO_TEXTHTMLPARSER + if (source->hasFormat(QLatin1String("application/x-qrichtext")) && d->acceptRichText) { + // x-qrichtext is always UTF-8 (taken from Qt3 since we don't use it anymore). + QString richtext = QString::fromUtf8(source->data(QLatin1String("application/x-qrichtext"))); + richtext.prepend(QLatin1String("<meta name=\"qrichtext\" content=\"1\" />")); + fragment = QTextDocumentFragment::fromHtml(richtext, d->doc); + hasData = true; + } else if (source->hasHtml() && d->acceptRichText) { + fragment = QTextDocumentFragment::fromHtml(source->html(), d->doc); + hasData = true; + } else { + QString text = source->text(); + if (!text.isNull()) { + fragment = QTextDocumentFragment::fromPlainText(text); + hasData = true; + } + } +#else + fragment = QTextDocumentFragment::fromPlainText(source->text()); +#endif // QT_NO_TEXTHTMLPARSER + + if (hasData) + d->cursor.insertFragment(fragment); + ensureCursorVisible(); +} + +bool QWidgetTextControl::findNextPrevAnchor(const QTextCursor &startCursor, bool next, QTextCursor &newAnchor) +{ + Q_D(QWidgetTextControl); + + int anchorStart = -1; + QString anchorHref; + int anchorEnd = -1; + + if (next) { + const int startPos = startCursor.selectionEnd(); + + QTextBlock block = d->doc->findBlock(startPos); + QTextBlock::Iterator it = block.begin(); + + while (!it.atEnd() && it.fragment().position() < startPos) + ++it; + + while (block.isValid()) { + anchorStart = -1; + + // find next anchor + for (; !it.atEnd(); ++it) { + const QTextFragment fragment = it.fragment(); + const QTextCharFormat fmt = fragment.charFormat(); + + if (fmt.isAnchor() && fmt.hasProperty(QTextFormat::AnchorHref)) { + anchorStart = fragment.position(); + anchorHref = fmt.anchorHref(); + break; + } + } + + if (anchorStart != -1) { + anchorEnd = -1; + + // find next non-anchor fragment + for (; !it.atEnd(); ++it) { + const QTextFragment fragment = it.fragment(); + const QTextCharFormat fmt = fragment.charFormat(); + + if (!fmt.isAnchor() || fmt.anchorHref() != anchorHref) { + anchorEnd = fragment.position(); + break; + } + } + + if (anchorEnd == -1) + anchorEnd = block.position() + block.length() - 1; + + // make found selection + break; + } + + block = block.next(); + it = block.begin(); + } + } else { + int startPos = startCursor.selectionStart(); + if (startPos > 0) + --startPos; + + QTextBlock block = d->doc->findBlock(startPos); + QTextBlock::Iterator blockStart = block.begin(); + QTextBlock::Iterator it = block.end(); + + if (startPos == block.position()) { + it = block.begin(); + } else { + do { + if (it == blockStart) { + it = QTextBlock::Iterator(); + block = QTextBlock(); + } else { + --it; + } + } while (!it.atEnd() && it.fragment().position() + it.fragment().length() - 1 > startPos); + } + + while (block.isValid()) { + anchorStart = -1; + + if (!it.atEnd()) { + do { + const QTextFragment fragment = it.fragment(); + const QTextCharFormat fmt = fragment.charFormat(); + + if (fmt.isAnchor() && fmt.hasProperty(QTextFormat::AnchorHref)) { + anchorStart = fragment.position() + fragment.length(); + anchorHref = fmt.anchorHref(); + break; + } + + if (it == blockStart) + it = QTextBlock::Iterator(); + else + --it; + } while (!it.atEnd()); + } + + if (anchorStart != -1 && !it.atEnd()) { + anchorEnd = -1; + + do { + const QTextFragment fragment = it.fragment(); + const QTextCharFormat fmt = fragment.charFormat(); + + if (!fmt.isAnchor() || fmt.anchorHref() != anchorHref) { + anchorEnd = fragment.position() + fragment.length(); + break; + } + + if (it == blockStart) + it = QTextBlock::Iterator(); + else + --it; + } while (!it.atEnd()); + + if (anchorEnd == -1) + anchorEnd = qMax(0, block.position()); + + break; + } + + block = block.previous(); + it = block.end(); + if (it != block.begin()) + --it; + blockStart = block.begin(); + } + + } + + if (anchorStart != -1 && anchorEnd != -1) { + newAnchor = d->cursor; + newAnchor.setPosition(anchorStart); + newAnchor.setPosition(anchorEnd, QTextCursor::KeepAnchor); + return true; + } + + return false; +} + +void QWidgetTextControlPrivate::activateLinkUnderCursor(QString href) +{ + QTextCursor oldCursor = cursor; + + if (href.isEmpty()) { + QTextCursor tmp = cursor; + if (tmp.selectionStart() != tmp.position()) + tmp.setPosition(tmp.selectionStart()); + tmp.movePosition(QTextCursor::NextCharacter); + href = tmp.charFormat().anchorHref(); + } + if (href.isEmpty()) + return; + + if (!cursor.hasSelection()) { + QTextBlock block = cursor.block(); + const int cursorPos = cursor.position(); + + QTextBlock::Iterator it = block.begin(); + QTextBlock::Iterator linkFragment; + + for (; !it.atEnd(); ++it) { + QTextFragment fragment = it.fragment(); + const int fragmentPos = fragment.position(); + if (fragmentPos <= cursorPos && + fragmentPos + fragment.length() > cursorPos) { + linkFragment = it; + break; + } + } + + if (!linkFragment.atEnd()) { + it = linkFragment; + cursor.setPosition(it.fragment().position()); + if (it != block.begin()) { + do { + --it; + QTextFragment fragment = it.fragment(); + if (fragment.charFormat().anchorHref() != href) + break; + cursor.setPosition(fragment.position()); + } while (it != block.begin()); + } + + for (it = linkFragment; !it.atEnd(); ++it) { + QTextFragment fragment = it.fragment(); + if (fragment.charFormat().anchorHref() != href) + break; + cursor.setPosition(fragment.position() + fragment.length(), QTextCursor::KeepAnchor); + } + } + } + + if (hasFocus) { + cursorIsFocusIndicator = true; + } else { + cursorIsFocusIndicator = false; + cursor.clearSelection(); + } + repaintOldAndNewSelection(oldCursor); + +#ifndef QT_NO_DESKTOPSERVICES + if (openExternalLinks) + QDesktopServices::openUrl(href); + else +#endif + emit q_func()->linkActivated(href); +} + +#ifndef QT_NO_TOOLTIP +void QWidgetTextControlPrivate::showToolTip(const QPoint &globalPos, const QPointF &pos, QWidget *contextWidget) +{ + const QString toolTip = q_func()->cursorForPosition(pos).charFormat().toolTip(); + if (toolTip.isEmpty()) + return; + QToolTip::showText(globalPos, toolTip, contextWidget); +} +#endif // QT_NO_TOOLTIP + +bool QWidgetTextControl::setFocusToNextOrPreviousAnchor(bool next) +{ + Q_D(QWidgetTextControl); + + if (!(d->interactionFlags & Qt::LinksAccessibleByKeyboard)) + return false; + + QRectF crect = selectionRect(); + emit updateRequest(crect); + + // If we don't have a current anchor, we start from the start/end + if (!d->cursor.hasSelection()) { + d->cursor = QTextCursor(d->doc); + if (next) + d->cursor.movePosition(QTextCursor::Start); + else + d->cursor.movePosition(QTextCursor::End); + } + + QTextCursor newAnchor; + if (findNextPrevAnchor(d->cursor, next, newAnchor)) { + d->cursor = newAnchor; + d->cursorIsFocusIndicator = true; + } else { + d->cursor.clearSelection(); + } + + if (d->cursor.hasSelection()) { + crect = selectionRect(); + emit updateRequest(crect); + emit visibilityRequest(crect); + return true; + } else { + return false; + } +} + +bool QWidgetTextControl::setFocusToAnchor(const QTextCursor &newCursor) +{ + Q_D(QWidgetTextControl); + + if (!(d->interactionFlags & Qt::LinksAccessibleByKeyboard)) + return false; + + // Verify that this is an anchor. + const QString anchorHref = d->anchorForCursor(newCursor); + if (anchorHref.isEmpty()) + return false; + + // and process it + QRectF crect = selectionRect(); + emit updateRequest(crect); + + d->cursor.setPosition(newCursor.selectionStart()); + d->cursor.setPosition(newCursor.selectionEnd(), QTextCursor::KeepAnchor); + d->cursorIsFocusIndicator = true; + + crect = selectionRect(); + emit updateRequest(crect); + emit visibilityRequest(crect); + return true; +} + +void QWidgetTextControl::setTextInteractionFlags(Qt::TextInteractionFlags flags) +{ + Q_D(QWidgetTextControl); + if (flags == d->interactionFlags) + return; + d->interactionFlags = flags; + + if (d->hasFocus) + d->setBlinkingCursorEnabled(flags & Qt::TextEditable); +} + +Qt::TextInteractionFlags QWidgetTextControl::textInteractionFlags() const +{ + Q_D(const QWidgetTextControl); + return d->interactionFlags; +} + +void QWidgetTextControl::mergeCurrentCharFormat(const QTextCharFormat &modifier) +{ + Q_D(QWidgetTextControl); + d->cursor.mergeCharFormat(modifier); + d->updateCurrentCharFormat(); +} + +void QWidgetTextControl::setCurrentCharFormat(const QTextCharFormat &format) +{ + Q_D(QWidgetTextControl); + d->cursor.setCharFormat(format); + d->updateCurrentCharFormat(); +} + +QTextCharFormat QWidgetTextControl::currentCharFormat() const +{ + Q_D(const QWidgetTextControl); + return d->cursor.charFormat(); +} + +void QWidgetTextControl::insertPlainText(const QString &text) +{ + Q_D(QWidgetTextControl); + d->cursor.insertText(text); +} + +#ifndef QT_NO_TEXTHTMLPARSER +void QWidgetTextControl::insertHtml(const QString &text) +{ + Q_D(QWidgetTextControl); + d->cursor.insertHtml(text); +} +#endif // QT_NO_TEXTHTMLPARSER + +QPointF QWidgetTextControl::anchorPosition(const QString &name) const +{ + Q_D(const QWidgetTextControl); + if (name.isEmpty()) + return QPointF(); + + QRectF r; + for (QTextBlock block = d->doc->begin(); block.isValid(); block = block.next()) { + QTextCharFormat format = block.charFormat(); + if (format.isAnchor() && format.anchorNames().contains(name)) { + r = d->rectForPosition(block.position()); + break; + } + + for (QTextBlock::Iterator it = block.begin(); !it.atEnd(); ++it) { + QTextFragment fragment = it.fragment(); + format = fragment.charFormat(); + if (format.isAnchor() && format.anchorNames().contains(name)) { + r = d->rectForPosition(fragment.position()); + block = QTextBlock(); + break; + } + } + } + if (!r.isValid()) + return QPointF(); + return QPointF(0, r.top()); +} + +void QWidgetTextControl::adjustSize() +{ + Q_D(QWidgetTextControl); + d->doc->adjustSize(); +} + +bool QWidgetTextControl::find(const QString &exp, QTextDocument::FindFlags options) +{ + Q_D(QWidgetTextControl); + QTextCursor search = d->doc->find(exp, d->cursor, options); + if (search.isNull()) + return false; + + setTextCursor(search); + return true; +} + + + +void QWidgetTextControlPrivate::append(const QString &text, Qt::TextFormat format) +{ + QTextCursor tmp(doc); + tmp.beginEditBlock(); + tmp.movePosition(QTextCursor::End); + + if (!doc->isEmpty()) + tmp.insertBlock(cursor.blockFormat(), cursor.charFormat()); + else + tmp.setCharFormat(cursor.charFormat()); + + // preserve the char format + QTextCharFormat oldCharFormat = cursor.charFormat(); + +#ifndef QT_NO_TEXTHTMLPARSER + if (format == Qt::RichText || (format == Qt::AutoText && Qt::mightBeRichText(text))) { + tmp.insertHtml(text); + } else { + tmp.insertText(text); + } +#else + tmp.insertText(text); +#endif // QT_NO_TEXTHTMLPARSER + if (!cursor.hasSelection()) + cursor.setCharFormat(oldCharFormat); + + tmp.endEditBlock(); +} + +void QWidgetTextControl::append(const QString &text) +{ + Q_D(QWidgetTextControl); + d->append(text, Qt::AutoText); +} + +void QWidgetTextControl::appendHtml(const QString &html) +{ + Q_D(QWidgetTextControl); + d->append(html, Qt::RichText); +} + +void QWidgetTextControl::appendPlainText(const QString &text) +{ + Q_D(QWidgetTextControl); + d->append(text, Qt::PlainText); +} + + +void QWidgetTextControl::ensureCursorVisible() +{ + Q_D(QWidgetTextControl); + QRectF crect = d->rectForPosition(d->cursor.position()).adjusted(-5, 0, 5, 0); + emit visibilityRequest(crect); + emit microFocusChanged(); +} + +QPalette QWidgetTextControl::palette() const +{ + Q_D(const QWidgetTextControl); + return d->palette; +} + +void QWidgetTextControl::setPalette(const QPalette &pal) +{ + Q_D(QWidgetTextControl); + d->palette = pal; +} + +QAbstractTextDocumentLayout::PaintContext QWidgetTextControl::getPaintContext(QWidget *widget) const +{ + Q_D(const QWidgetTextControl); + + QAbstractTextDocumentLayout::PaintContext ctx; + + ctx.selections = d->extraSelections; + ctx.palette = d->palette; + if (d->cursorOn && d->isEnabled) { + if (d->hideCursor) + ctx.cursorPosition = -1; + else if (d->preeditCursor != 0) + ctx.cursorPosition = - (d->preeditCursor + 2); + else + ctx.cursorPosition = d->cursor.position(); + } + + if (!d->dndFeedbackCursor.isNull()) + ctx.cursorPosition = d->dndFeedbackCursor.position(); +#ifdef QT_KEYPAD_NAVIGATION + if (!QApplication::keypadNavigationEnabled() || d->hasEditFocus) +#endif + if (d->cursor.hasSelection()) { + QAbstractTextDocumentLayout::Selection selection; + selection.cursor = d->cursor; + if (d->cursorIsFocusIndicator) { + QStyleOption opt; + opt.palette = ctx.palette; + QStyleHintReturnVariant ret; + QStyle *style = QApplication::style(); + if (widget) + style = widget->style(); + style->styleHint(QStyle::SH_TextControl_FocusIndicatorTextCharFormat, &opt, widget, &ret); + selection.format = qvariant_cast<QTextFormat>(ret.variant).toCharFormat(); + } else { + QPalette::ColorGroup cg = d->hasFocus ? QPalette::Active : QPalette::Inactive; + selection.format.setBackground(ctx.palette.brush(cg, QPalette::Highlight)); + selection.format.setForeground(ctx.palette.brush(cg, QPalette::HighlightedText)); + QStyleOption opt; + QStyle *style = QApplication::style(); + if (widget) { + opt.initFrom(widget); + style = widget->style(); + } + if (style->styleHint(QStyle::SH_RichText_FullWidthSelection, &opt, widget)) + selection.format.setProperty(QTextFormat::FullWidthSelection, true); + } + ctx.selections.append(selection); + } + + return ctx; +} + +void QWidgetTextControl::drawContents(QPainter *p, const QRectF &rect, QWidget *widget) +{ + Q_D(QWidgetTextControl); + p->save(); + QAbstractTextDocumentLayout::PaintContext ctx = getPaintContext(widget); + if (rect.isValid()) + p->setClipRect(rect, Qt::IntersectClip); + ctx.clip = rect; + + d->doc->documentLayout()->draw(p, ctx); + p->restore(); +} + +void QWidgetTextControlPrivate::_q_copyLink() +{ +#ifndef QT_NO_CLIPBOARD + QMimeData *md = new QMimeData; + md->setText(linkToCopy); + QApplication::clipboard()->setMimeData(md); +#endif +} + +QInputContext *QWidgetTextControlPrivate::inputContext() +{ + QInputContext *ctx = contextWidget->inputContext(); + if (!ctx && contextWidget->parentWidget()) + ctx = contextWidget->parentWidget()->inputContext(); + return ctx; +} + +int QWidgetTextControl::hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const +{ + Q_D(const QWidgetTextControl); + return d->doc->documentLayout()->hitTest(point, accuracy); +} + +QRectF QWidgetTextControl::blockBoundingRect(const QTextBlock &block) const +{ + Q_D(const QWidgetTextControl); + return d->doc->documentLayout()->blockBoundingRect(block); +} + +#ifndef QT_NO_CONTEXTMENU +#define NUM_CONTROL_CHARACTERS 10 +const struct QUnicodeControlCharacter { + const char *text; + ushort character; +} qt_controlCharacters[NUM_CONTROL_CHARACTERS] = { + { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRM Left-to-right mark"), 0x200e }, + { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLM Right-to-left mark"), 0x200f }, + { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWJ Zero width joiner"), 0x200d }, + { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWNJ Zero width non-joiner"), 0x200c }, + { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWSP Zero width space"), 0x200b }, + { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRE Start of left-to-right embedding"), 0x202a }, + { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLE Start of right-to-left embedding"), 0x202b }, + { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRO Start of left-to-right override"), 0x202d }, + { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLO Start of right-to-left override"), 0x202e }, + { QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "PDF Pop directional formatting"), 0x202c }, +}; + +QUnicodeControlCharacterMenu::QUnicodeControlCharacterMenu(QObject *_editWidget, QWidget *parent) + : QMenu(parent), editWidget(_editWidget) +{ + setTitle(tr("Insert Unicode control character")); + for (int i = 0; i < NUM_CONTROL_CHARACTERS; ++i) { + addAction(tr(qt_controlCharacters[i].text), this, SLOT(menuActionTriggered())); + } +} + +void QUnicodeControlCharacterMenu::menuActionTriggered() +{ + QAction *a = qobject_cast<QAction *>(sender()); + int idx = actions().indexOf(a); + if (idx < 0 || idx >= NUM_CONTROL_CHARACTERS) + return; + QChar c(qt_controlCharacters[idx].character); + QString str(c); + +#ifndef QT_NO_TEXTEDIT + if (QTextEdit *edit = qobject_cast<QTextEdit *>(editWidget)) { + edit->insertPlainText(str); + return; + } +#endif + if (QWidgetTextControl *control = qobject_cast<QWidgetTextControl *>(editWidget)) { + control->insertPlainText(str); + } +#ifndef QT_NO_LINEEDIT + if (QLineEdit *edit = qobject_cast<QLineEdit *>(editWidget)) { + edit->insert(str); + return; + } +#endif +} +#endif // QT_NO_CONTEXTMENU + +QStringList QTextEditMimeData::formats() const +{ + if (!fragment.isEmpty()) + return QStringList() << QString::fromLatin1("text/plain") << QString::fromLatin1("text/html") +#ifndef QT_NO_TEXTODFWRITER + << QString::fromLatin1("application/vnd.oasis.opendocument.text") +#endif + ; + else + return QMimeData::formats(); +} + +QVariant QTextEditMimeData::retrieveData(const QString &mimeType, QVariant::Type type) const +{ + if (!fragment.isEmpty()) + setup(); + return QMimeData::retrieveData(mimeType, type); +} + +void QTextEditMimeData::setup() const +{ + QTextEditMimeData *that = const_cast<QTextEditMimeData *>(this); +#ifndef QT_NO_TEXTHTMLPARSER + that->setData(QLatin1String("text/html"), fragment.toHtml("utf-8").toUtf8()); +#endif +#ifndef QT_NO_TEXTODFWRITER + { + QBuffer buffer; + QTextDocumentWriter writer(&buffer, "ODF"); + writer.write(fragment); + buffer.close(); + that->setData(QLatin1String("application/vnd.oasis.opendocument.text"), buffer.data()); + } +#endif + that->setText(fragment.toPlainText()); + fragment = QTextDocumentFragment(); +} + +QT_END_NAMESPACE + +#include "moc_qwidgettextcontrol_p.cpp" + +#endif // QT_NO_TEXTCONTROL diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h new file mode 100644 index 00000000000..67ae0596b3d --- /dev/null +++ b/src/widgets/widgets/qwidgettextcontrol_p.h @@ -0,0 +1,305 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWIDGETTEXTCONTROL_P_H +#define QWIDGETTEXTCONTROL_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 <QtGui/qtextdocument.h> +#include <QtGui/qtextoption.h> +#include <QtGui/qtextcursor.h> +#include <QtGui/qtextformat.h> +#include <QtWidgets/qtextedit.h> +#include <QtWidgets/qmenu.h> +#include <QtCore/qrect.h> +#include <QtGui/qabstracttextdocumentlayout.h> +#include <QtGui/qtextdocumentfragment.h> +#include <QtGui/qclipboard.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStyleSheet; +class QTextDocument; +class QMenu; +class QWidgetTextControlPrivate; +class QMimeData; +class QAbstractScrollArea; +class QEvent; +class QTimerEvent; + +class Q_WIDGETS_EXPORT QWidgetTextControl : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWidgetTextControl) +#ifndef QT_NO_TEXTHTMLPARSER + Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged USER true) +#endif + Q_PROPERTY(bool overwriteMode READ overwriteMode WRITE setOverwriteMode) + Q_PROPERTY(bool acceptRichText READ acceptRichText WRITE setAcceptRichText) + Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) + Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) + Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) + Q_PROPERTY(bool ignoreUnusedNavigationEvents READ ignoreUnusedNavigationEvents WRITE setIgnoreUnusedNavigationEvents) +public: + explicit QWidgetTextControl(QObject *parent = 0); + explicit QWidgetTextControl(const QString &text, QObject *parent = 0); + explicit QWidgetTextControl(QTextDocument *doc, QObject *parent = 0); + virtual ~QWidgetTextControl(); + + void setDocument(QTextDocument *document); + QTextDocument *document() const; + + void setTextCursor(const QTextCursor &cursor); + QTextCursor textCursor() const; + + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + + void mergeCurrentCharFormat(const QTextCharFormat &modifier); + + void setCurrentCharFormat(const QTextCharFormat &format); + QTextCharFormat currentCharFormat() const; + + bool find(const QString &exp, QTextDocument::FindFlags options = 0); + + inline QString toPlainText() const + { return document()->toPlainText(); } +#ifndef QT_NO_TEXTHTMLPARSER + inline QString toHtml() const + { return document()->toHtml(); } +#endif + + virtual void ensureCursorVisible(); + + virtual QVariant loadResource(int type, const QUrl &name); +#ifndef QT_NO_CONTEXTMENU + QMenu *createStandardContextMenu(const QPointF &pos, QWidget *parent); +#endif + + QTextCursor cursorForPosition(const QPointF &pos) const; + QRectF cursorRect(const QTextCursor &cursor) const; + QRectF cursorRect() const; + QRectF selectionRect(const QTextCursor &cursor) const; + QRectF selectionRect() const; + + QString anchorAt(const QPointF &pos) const; + QPointF anchorPosition(const QString &name) const; + + QString anchorAtCursor() const; + + bool overwriteMode() const; + void setOverwriteMode(bool overwrite); + + int cursorWidth() const; + void setCursorWidth(int width); + + bool acceptRichText() const; + void setAcceptRichText(bool accept); + +#ifndef QT_NO_TEXTEDIT + void setExtraSelections(const QList<QTextEdit::ExtraSelection> &selections); + QList<QTextEdit::ExtraSelection> extraSelections() const; +#endif + + void setTextWidth(qreal width); + qreal textWidth() const; + QSizeF size() const; + + void setOpenExternalLinks(bool open); + bool openExternalLinks() const; + + void setIgnoreUnusedNavigationEvents(bool ignore); + bool ignoreUnusedNavigationEvents() const; + + void moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); + + bool canPaste() const; + + void setCursorIsFocusIndicator(bool b); + bool cursorIsFocusIndicator() const; + + void setDragEnabled(bool enabled); + bool isDragEnabled() const; + + bool isWordSelectionEnabled() const; + void setWordSelectionEnabled(bool enabled); + + void print(QPagedPaintDevice *printer) const; + + virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const; + virtual QRectF blockBoundingRect(const QTextBlock &block) const; + QAbstractTextDocumentLayout::PaintContext getPaintContext(QWidget *widget) const; + +public Q_SLOTS: + void setPlainText(const QString &text); + void setHtml(const QString &text); + +#ifndef QT_NO_CLIPBOARD + void cut(); + void copy(); + void paste(QClipboard::Mode mode = QClipboard::Clipboard); +#endif + + void undo(); + void redo(); + + void clear(); + void selectAll(); + + void insertPlainText(const QString &text); +#ifndef QT_NO_TEXTHTMLPARSER + void insertHtml(const QString &text); +#endif + + void append(const QString &text); + void appendHtml(const QString &html); + void appendPlainText(const QString &text); + + void adjustSize(); + +Q_SIGNALS: + void textChanged(); + void undoAvailable(bool b); + void redoAvailable(bool b); + void currentCharFormatChanged(const QTextCharFormat &format); + void copyAvailable(bool b); + void selectionChanged(); + void cursorPositionChanged(); + + // control signals + void updateRequest(const QRectF &rect = QRectF()); + void documentSizeChanged(const QSizeF &); + void blockCountChanged(int newBlockCount); + void visibilityRequest(const QRectF &rect); + void microFocusChanged(); + void linkActivated(const QString &link); + void linkHovered(const QString &); + void modificationChanged(bool m); + +public: + // control properties + QPalette palette() const; + void setPalette(const QPalette &pal); + + virtual void processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget = 0); + void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF(), QWidget *contextWidget = 0); + + // control methods + void drawContents(QPainter *painter, const QRectF &rect = QRectF(), QWidget *widget = 0); + + void setFocus(bool focus, Qt::FocusReason = Qt::OtherFocusReason); + + virtual QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + + virtual QMimeData *createMimeDataFromSelection() const; + virtual bool canInsertFromMimeData(const QMimeData *source) const; + virtual void insertFromMimeData(const QMimeData *source); + + bool setFocusToAnchor(const QTextCursor &newCursor); + bool setFocusToNextOrPreviousAnchor(bool next); + bool findNextPrevAnchor(const QTextCursor& from, bool next, QTextCursor& newAnchor); + +protected: + virtual void timerEvent(QTimerEvent *e); + + virtual bool event(QEvent *e); + +private: + Q_DISABLE_COPY(QWidgetTextControl) + Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentCharFormatAndSelection()) + Q_PRIVATE_SLOT(d_func(), void _q_emitCursorPosChanged(const QTextCursor &)) + Q_PRIVATE_SLOT(d_func(), void _q_deleteSelected()) + Q_PRIVATE_SLOT(d_func(), void _q_copyLink()) + Q_PRIVATE_SLOT(d_func(), void _q_updateBlock(const QTextBlock &)) + Q_PRIVATE_SLOT(d_func(), void _q_documentLayoutChanged()) +}; + + +#ifndef QT_NO_CONTEXTMENU +class QUnicodeControlCharacterMenu : public QMenu +{ + Q_OBJECT +public: + QUnicodeControlCharacterMenu(QObject *editWidget, QWidget *parent); + +private Q_SLOTS: + void menuActionTriggered(); + +private: + QObject *editWidget; +}; +#endif // QT_NO_CONTEXTMENU + + +// also used by QLabel +class QTextEditMimeData : public QMimeData +{ +public: + inline QTextEditMimeData(const QTextDocumentFragment &aFragment) : fragment(aFragment) {} + + virtual QStringList formats() const; +protected: + virtual QVariant retrieveData(const QString &mimeType, QVariant::Type type) const; +private: + void setup() const; + + mutable QTextDocumentFragment fragment; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWidgetTextControl_H diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h new file mode 100644 index 00000000000..7cc3026decc --- /dev/null +++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h @@ -0,0 +1,238 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWIDGETTEXTCONTROL_P_P_H +#define QWIDGETTEXTCONTROL_P_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 "QtGui/qtextdocumentfragment.h" +#include "QtWidgets/qscrollbar.h" +#include "QtGui/qtextcursor.h" +#include "QtGui/qtextformat.h" +#include "QtWidgets/qmenu.h" +#include "QtGui/qabstracttextdocumentlayout.h" +#include "QtCore/qbasictimer.h" +#include "QtCore/qpointer.h" +#include "private/qobject_p.h" + +QT_BEGIN_NAMESPACE + +class QMimeData; +class QAbstractScrollArea; +class QInputContext; + +class QWidgetTextControlPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QWidgetTextControl) +public: + QWidgetTextControlPrivate(); + + bool cursorMoveKeyEvent(QKeyEvent *e); + + void updateCurrentCharFormat(); + + void indent(); + void outdent(); + + void gotoNextTableCell(); + void gotoPreviousTableCell(); + + void createAutoBulletList(); + + void init(Qt::TextFormat format = Qt::RichText, const QString &text = QString(), + QTextDocument *document = 0); + void setContent(Qt::TextFormat format = Qt::RichText, const QString &text = QString(), + QTextDocument *document = 0); + void startDrag(); + + void paste(const QMimeData *source); + + void setCursorPosition(const QPointF &pos); + void setCursorPosition(int pos, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); + + void repaintCursor(); + inline void repaintSelection() + { repaintOldAndNewSelection(QTextCursor()); } + void repaintOldAndNewSelection(const QTextCursor &oldSelection); + + void selectionChanged(bool forceEmitSelectionChanged = false); + + void _q_updateCurrentCharFormatAndSelection(); + +#ifndef QT_NO_CLIPBOARD + void setClipboardSelection(); +#endif + + void _q_emitCursorPosChanged(const QTextCursor &someCursor); + + void setBlinkingCursorEnabled(bool enable); + + void extendWordwiseSelection(int suggestedNewPosition, qreal mouseXPosition); + void extendBlockwiseSelection(int suggestedNewPosition); + + void _q_deleteSelected(); + + void _q_setCursorAfterUndoRedo(int undoPosition, int charsAdded, int charsRemoved); + + QRectF cursorRectPlusUnicodeDirectionMarkers(const QTextCursor &cursor) const; + QRectF rectForPosition(int position) const; + QRectF selectionRect(const QTextCursor &cursor) const; + inline QRectF selectionRect() const + { return selectionRect(this->cursor); } + + QString anchorForCursor(const QTextCursor &anchor) const; + + void keyPressEvent(QKeyEvent *e); + void mousePressEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, + Qt::KeyboardModifiers modifiers, + Qt::MouseButtons buttons, + const QPoint &globalPos); + void mouseMoveEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, + Qt::KeyboardModifiers modifiers, + Qt::MouseButtons buttons, + const QPoint &globalPos); + void mouseReleaseEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, + Qt::KeyboardModifiers modifiers, + Qt::MouseButtons buttons, + const QPoint &globalPos); + void mouseDoubleClickEvent(QEvent *e, Qt::MouseButton button, const QPointF &pos, + Qt::KeyboardModifiers modifiers, + Qt::MouseButtons buttons, + const QPoint &globalPos); + bool sendMouseEventToInputContext(QEvent *e, QEvent::Type eventType, Qt::MouseButton button, + const QPointF &pos, + Qt::KeyboardModifiers modifiers, + Qt::MouseButtons buttons, + const QPoint &globalPos); + void contextMenuEvent(const QPoint &screenPos, const QPointF &docPos, QWidget *contextWidget); + void focusEvent(QFocusEvent *e); +#ifdef QT_KEYPAD_NAVIGATION + void editFocusEvent(QEvent *e); +#endif + bool dragEnterEvent(QEvent *e, const QMimeData *mimeData); + void dragLeaveEvent(); + bool dragMoveEvent(QEvent *e, const QMimeData *mimeData, const QPointF &pos); + bool dropEvent(const QMimeData *mimeData, const QPointF &pos, Qt::DropAction dropAction, QObject *source); + + void inputMethodEvent(QInputMethodEvent *); + + void activateLinkUnderCursor(QString href = QString()); + +#ifndef QT_NO_TOOLTIP + void showToolTip(const QPoint &globalPos, const QPointF &pos, QWidget *contextWidget); +#endif + + void append(const QString &text, Qt::TextFormat format = Qt::AutoText); + + QInputContext *inputContext(); + + QTextDocument *doc; + bool cursorOn; + QTextCursor cursor; + bool cursorIsFocusIndicator; + QTextCharFormat lastCharFormat; + + QTextCursor dndFeedbackCursor; + + Qt::TextInteractionFlags interactionFlags; + + QBasicTimer cursorBlinkTimer; + QBasicTimer trippleClickTimer; + QPointF trippleClickPoint; + + bool dragEnabled; + + bool mousePressed; + + bool mightStartDrag; + QPoint dragStartPos; + QPointer<QWidget> contextWidget; + + bool lastSelectionState; + + bool ignoreAutomaticScrollbarAdjustement; + + QTextCursor selectedWordOnDoubleClick; + QTextCursor selectedBlockOnTrippleClick; + + bool overwriteMode; + bool acceptRichText; + + int preeditCursor; + bool hideCursor; // used to hide the cursor in the preedit area + + QVector<QAbstractTextDocumentLayout::Selection> extraSelections; + + QPalette palette; + bool hasFocus; +#ifdef QT_KEYPAD_NAVIGATION + bool hasEditFocus; +#endif + bool isEnabled; + + QString highlightedAnchor; // Anchor below cursor + QString anchorOnMousePress; + bool hadSelectionOnMousePress; + + bool ignoreUnusedNavigationEvents; + bool openExternalLinks; + + bool wordSelectionEnabled; + + QString linkToCopy; + void _q_copyLink(); + void _q_updateBlock(const QTextBlock &); + void _q_documentLayoutChanged(); +}; + +QT_END_NAMESPACE + +#endif // QWidgetTextControl_P_H diff --git a/src/gui/widgets/qworkspace.cpp b/src/widgets/widgets/qworkspace.cpp similarity index 100% rename from src/gui/widgets/qworkspace.cpp rename to src/widgets/widgets/qworkspace.cpp diff --git a/src/gui/widgets/qworkspace.h b/src/widgets/widgets/qworkspace.h similarity index 98% rename from src/gui/widgets/qworkspace.h rename to src/widgets/widgets/qworkspace.h index 6f6f8c7ceee..a2512425425 100644 --- a/src/gui/widgets/qworkspace.h +++ b/src/widgets/widgets/qworkspace.h @@ -42,7 +42,7 @@ #ifndef QWORKSPACE_H #define QWORKSPACE_H -#include <QtGui/qwidget.h> +#include <QtWidgets/qwidget.h> QT_BEGIN_HEADER @@ -57,7 +57,7 @@ class QWorkspaceChild; class QShowEvent; class QWorkspacePrivate; -class Q_GUI_EXPORT QWorkspace : public QWidget +class Q_WIDGETS_EXPORT QWorkspace : public QWidget { Q_OBJECT Q_PROPERTY(bool scrollBarsEnabled READ scrollBarsEnabled WRITE setScrollBarsEnabled) diff --git a/src/gui/widgets/widgets.pri b/src/widgets/widgets/widgets.pri similarity index 88% rename from src/gui/widgets/widgets.pri rename to src/widgets/widgets/widgets.pri index 6b3d6a984aa..986e5e79a02 100644 --- a/src/gui/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -30,7 +30,6 @@ HEADERS += \ widgets/qlcdnumber.h \ widgets/qlineedit.h \ widgets/qlineedit_p.h \ - widgets/qlinecontrol_p.h \ widgets/qmainwindow.h \ widgets/qmainwindowlayout_p.h \ widgets/qmdiarea.h \ @@ -41,7 +40,6 @@ HEADERS += \ widgets/qmenu_p.h \ widgets/qmenubar.h \ widgets/qmenubar_p.h \ - widgets/qmenudata.h \ widgets/qprogressbar.h \ widgets/qpushbutton.h \ widgets/qpushbutton_p.h \ @@ -70,7 +68,6 @@ HEADERS += \ widgets/qtoolbarseparator_p.h \ widgets/qtoolbox.h \ widgets/qtoolbutton.h \ - widgets/qvalidator.h \ widgets/qabstractscrollarea.h \ widgets/qabstractscrollarea_p.h \ widgets/qwidgetresizehandler_p.h \ @@ -78,10 +75,13 @@ HEADERS += \ widgets/qscrollarea.h \ widgets/qworkspace.h \ widgets/qwidgetanimator_p.h \ + widgets/qwidgettextcontrol_p.h \ + widgets/qwidgettextcontrol_p_p.h \ + widgets/qwidgetlinecontrol_p.h \ widgets/qtoolbararealayout_p.h \ widgets/qplaintextedit.h \ - widgets/qplaintextedit_p.h \ - widgets/qprintpreviewwidget.h + widgets/qplaintextedit_p.h + SOURCES += \ widgets/qabstractbutton.cpp \ widgets/qabstractslider.cpp \ @@ -103,14 +103,12 @@ SOURCES += \ widgets/qlcdnumber.cpp \ widgets/qlineedit_p.cpp \ widgets/qlineedit.cpp \ - widgets/qlinecontrol.cpp \ widgets/qmainwindow.cpp \ widgets/qmainwindowlayout.cpp \ widgets/qmdiarea.cpp \ widgets/qmdisubwindow.cpp \ widgets/qmenu.cpp \ widgets/qmenubar.cpp \ - widgets/qmenudata.cpp \ widgets/qprogressbar.cpp \ widgets/qpushbutton.cpp \ widgets/qradiobutton.cpp \ @@ -133,36 +131,26 @@ SOURCES += \ widgets/qtoolbarseparator.cpp \ widgets/qtoolbox.cpp \ widgets/qtoolbutton.cpp \ - widgets/qvalidator.cpp \ widgets/qabstractscrollarea.cpp \ widgets/qwidgetresizehandler.cpp \ widgets/qfocusframe.cpp \ widgets/qscrollarea.cpp \ widgets/qworkspace.cpp \ widgets/qwidgetanimator.cpp \ + widgets/qwidgettextcontrol.cpp \ + widgets/qwidgetlinecontrol.cpp \ widgets/qtoolbararealayout.cpp \ - widgets/qplaintextedit.cpp \ - widgets/qprintpreviewwidget.cpp + widgets/qplaintextedit.cpp -x11: { - HEADERS += \ - widgets/qabstractplatformmenubar_p.h - - SOURCES += \ - widgets/qmenubar_x11.cpp -} - -!embedded:!qpa:mac { +!qpa:mac { HEADERS += widgets/qmacnativewidget_mac.h \ widgets/qmaccocoaviewcontainer_mac.h OBJECTIVE_HEADERS += widgets/qcocoatoolbardelegate_mac_p.h \ widgets/qcocoamenu_mac_p.h - OBJECTIVE_SOURCES += widgets/qmenu_mac.mm \ - widgets/qmaccocoaviewcontainer_mac.mm \ + OBJECTIVE_SOURCES += widgets/qmaccocoaviewcontainer_mac.mm \ widgets/qcocoatoolbardelegate_mac.mm \ widgets/qmainwindowlayout_mac.mm \ widgets/qmacnativewidget_mac.mm \ - widgets/qcocoamenu_mac.mm } wince*: { diff --git a/sync.profile b/sync.profile index 3e60295dda1..e0d23ac3bfa 100644 --- a/sync.profile +++ b/sync.profile @@ -1,7 +1,8 @@ %modules = ( # path to module name map "QtGui" => "$basedir/src/gui", + "QtWidgets" => "$basedir/src/widgets", + "QtPrintSupport" => "$basedir/src/printsupport", "QtOpenGL" => "$basedir/src/opengl", - "QtOpenVG" => "$basedir/src/openvg", "QtCore" => "$basedir/src/corelib", "QtV8" => "$basedir/src/v8", "QtXml" => "$basedir/src/xml", @@ -11,6 +12,7 @@ "QtDBus" => "$basedir/src/dbus", "QtUiTools" => "$basedir/src/uitools", "QtDesigner" => "$basedir/tools/uilib", + "QtPlatformSupport" => "$basedir/src/platformsupport", ); %moduleheaders = ( # restrict the module headers to those found in relative path "QtV8" => "../3rdparty/v8/include", @@ -47,9 +49,10 @@ %mastercontent = ( "core" => "#include <QtCore/QtCore>\n", "gui" => "#include <QtGui/QtGui>\n", + "printsupport" => "#include <QtPrintSupport/QtPrintSupport>\n", + "widgets" => "#include <QtWidgets/QtWidgets>\n", "network" => "#include <QtNetwork/QtNetwork>\n", "opengl" => "#include <QtOpenGL/QtOpenGL>\n", - "openvg" => "#include <QtOpenVG/QtOpenVG>\n", "xml" => "#include <QtXml/QtXml>\n", "uitools" => "#include <QtUiTools/QtUiTools>\n", "designer" => "#include <QtDesigner/QtDesigner>\n", @@ -58,15 +61,17 @@ "QtCore" => "$basedir/src/modules/qt_core.pri", "QtDBus" => "$basedir/src/modules/qt_dbus.pri", "QtGui" => "$basedir/src/modules/qt_gui.pri", + "QtPrintSupport" => "$basedir/src/modules/qt_printsupport.pri", + "QtWidgets" => "$basedir/src/modules/qt_widgets.pri", "QtNetwork" => "$basedir/src/modules/qt_network.pri", "QtOpenGL" => "$basedir/src/modules/qt_opengl.pri", - "QtOpenVG" => "$basedir/src/modules/qt_openvg.pri", "QtSql" => "$basedir/src/modules/qt_sql.pri", "QtTest" => "$basedir/src/modules/qt_testlib.pri", "QtV8" => "$basedir/src/modules/qt_v8.pri", "QtXml" => "$basedir/src/modules/qt_xml.pri", "QtUiTools" => "$basedir/src/modules/qt_uitools.pri", "QtDesigner" => "$basedir/src/modules/qt_uilib.pri", + "QtPlatformSupport" => "$basedir/src/modules/qt_platformsupport.pri", ); @ignore_for_master_contents = ( "qt.h", "qpaintdevicedefs.h" ); diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index fc51280c356..5eda1236b72 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -4,11 +4,13 @@ SUBDIRS += \ corelib.pro \ gui.pro \ network.pro \ - sql.pro \ - xml.pro \ - other.pro + sql \ + xml \ + testlib \ + other.pro \ !cross_compile: SUBDIRS += host.pro -contains(QT_CONFIG, opengl): SUBDIRS += opengl.pro -unix:!embedded:contains(QT_CONFIG, dbus): SUBDIRS += dbus.pro +!cross_compile: SUBDIRS += tools +contains(QT_CONFIG, opengl): SUBDIRS += opengl +unix:!embedded:contains(QT_CONFIG, dbus): SUBDIRS += dbus contains(QT_CONFIG, v8): SUBDIRS += v8.pro diff --git a/tests/auto/corelib.pro b/tests/auto/corelib.pro index 7a655d62083..7269f890a76 100644 --- a/tests/auto/corelib.pro +++ b/tests/auto/corelib.pro @@ -1,118 +1,7 @@ -# The tests in this .pro file _MUST_ use QtCore only (i.e. QT=core). -# The test system is allowed to run these tests before the test of Qt has -# been compiled. - TEMPLATE=subdirs SUBDIRS=\ + corelib \ collections \ exceptionsafety \ - q_func_info \ - qanimationgroup \ - qatomicint \ - qatomicpointer \ - qbitarray \ - qbuffer \ - qbytearray \ - qbytearraymatcher \ - qcache \ - qchar \ - qcontiguouscache \ - qcoreapplication \ - qcryptographichash \ - qdate \ - qdatetime \ - qdebug \ - qdiriterator \ - qeasingcurve \ - qelapsedtimer \ - qevent \ - qexplicitlyshareddatapointer \ - qfileinfo \ - qfilesystemwatcher \ - qflags \ - qfreelist \ - qfuture \ - qfuturewatcher \ - qgetputenv \ - qglobal \ - qhash \ - qlibrary \ - qline \ - qmap \ - qmargins \ - qmath \ - qmetatype \ - qmutex \ - qmutexlocker \ - qnumeric \ - qobject \ qobjectrace \ - qplugin \ - qpluginloader \ - qpoint \ - qprocessenvironment \ - qqueue \ - qrand \ - qreadlocker \ - qreadwritelock \ - qrect \ - qregexp \ - qresourceengine \ - qringbuffer \ - qscopedpointer \ - qscopedvaluerollback \ - qsemaphore \ - qsequentialanimationgroup \ - qset \ - qsharedpointer \ - qsignalspy \ - qsize \ - qsizef \ - qstate \ - qstl \ - qstring \ - qstringbuilder1 \ - qstringbuilder2 \ - qstringbuilder3 \ - qstringbuilder4 \ - qstringlist \ - qstringmatcher \ - qstringref \ - qtconcurrentfilter \ - qtconcurrentiteratekernel \ - qtconcurrentmap \ - qtconcurrentrun \ - qtconcurrentthreadengine \ - qtemporaryfile \ - qtextboundaryfinder \ - qthread \ - qthreadonce \ - qthreadpool \ - qthreadstorage \ - qtime \ - qtimeline \ - qtimer \ - qtmd5 \ - qtokenautomaton \ - qurl \ - quuid \ - qvarlengtharray \ - qvector \ - qwaitcondition \ - qwineventnotifier \ - qwritelocker \ - selftests \ - utf8 \ - qfilesystementry \ - qabstractfileengine - -symbian:SUBDIRS -= \ - qtconcurrentfilter \ - qtconcurrentiteratekernel \ - qtconcurrentmap \ - qtconcurrentrun \ - qtconcurrentthreadengine \ - -!contains(QT_CONFIG, private_tests): SUBDIRS -= \ - qfileinfo \ - + utf8 diff --git a/tests/auto/corelib/animation/animation.pro b/tests/auto/corelib/animation/animation.pro new file mode 100644 index 00000000000..0d852acc606 --- /dev/null +++ b/tests/auto/corelib/animation/animation.pro @@ -0,0 +1,9 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qabstractanimation \ + qanimationgroup \ + qparallelanimationgroup \ + qpauseanimation \ + qpropertyanimation \ + qsequentialanimationgroup \ + qvariantanimation diff --git a/tests/auto/corelib/animation/qabstractanimation/qabstractanimation.pro b/tests/auto/corelib/animation/qabstractanimation/qabstractanimation.pro new file mode 100644 index 00000000000..f518423765e --- /dev/null +++ b/tests/auto/corelib/animation/qabstractanimation/qabstractanimation.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +QT = core +SOURCES += tst_qabstractanimation.cpp \ + + +CONFIG += parallel_test diff --git a/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp b/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp new file mode 100644 index 00000000000..f9dad9154a3 --- /dev/null +++ b/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtCore/qabstractanimation.h> +#include <QtCore/qanimationgroup.h> +#include <QtTest> + +class tst_QAbstractAnimation : public QObject +{ + Q_OBJECT +public: + tst_QAbstractAnimation() {}; + virtual ~tst_QAbstractAnimation() {}; + +public Q_SLOTS: + void init(); + void cleanup(); + +private slots: + void construction(); + void destruction(); + void currentLoop(); + void currentLoopTime(); + void currentTime(); + void direction(); + void group(); + void loopCount(); + void state(); + void totalDuration(); +}; + +class TestableQAbstractAnimation : public QAbstractAnimation +{ + Q_OBJECT + +public: + virtual ~TestableQAbstractAnimation() {}; + + int duration() const { return 10; } + virtual void updateCurrentTime(int) {} +}; + +class DummyQAnimationGroup : public QAnimationGroup +{ + Q_OBJECT +public: + int duration() const { return 10; } + virtual void updateCurrentTime(int) {} +}; + +void tst_QAbstractAnimation::init() +{ +} + +void tst_QAbstractAnimation::cleanup() +{ +} + +void tst_QAbstractAnimation::construction() +{ + TestableQAbstractAnimation anim; +} + +void tst_QAbstractAnimation::destruction() +{ + TestableQAbstractAnimation *anim = new TestableQAbstractAnimation; + delete anim; +} + +void tst_QAbstractAnimation::currentLoop() +{ + TestableQAbstractAnimation anim; + QCOMPARE(anim.currentLoop(), 0); +} + +void tst_QAbstractAnimation::currentLoopTime() +{ + TestableQAbstractAnimation anim; + QCOMPARE(anim.currentLoopTime(), 0); +} + +void tst_QAbstractAnimation::currentTime() +{ + TestableQAbstractAnimation anim; + QCOMPARE(anim.currentTime(), 0); + anim.setCurrentTime(10); + QCOMPARE(anim.currentTime(), 10); +} + +void tst_QAbstractAnimation::direction() +{ + TestableQAbstractAnimation anim; + QCOMPARE(anim.direction(), QAbstractAnimation::Forward); + anim.setDirection(QAbstractAnimation::Backward); + QCOMPARE(anim.direction(), QAbstractAnimation::Backward); + anim.setDirection(QAbstractAnimation::Forward); + QCOMPARE(anim.direction(), QAbstractAnimation::Forward); +} + +void tst_QAbstractAnimation::group() +{ + TestableQAbstractAnimation *anim = new TestableQAbstractAnimation; + DummyQAnimationGroup group; + group.addAnimation(anim); + QCOMPARE(anim->group(), &group); +} + +void tst_QAbstractAnimation::loopCount() +{ + TestableQAbstractAnimation anim; + QCOMPARE(anim.loopCount(), 1); + anim.setLoopCount(10); + QCOMPARE(anim.loopCount(), 10); +} + +void tst_QAbstractAnimation::state() +{ + TestableQAbstractAnimation anim; + QCOMPARE(anim.state(), QAbstractAnimation::Stopped); +} + +void tst_QAbstractAnimation::totalDuration() +{ + TestableQAbstractAnimation anim; + QCOMPARE(anim.duration(), 10); + anim.setLoopCount(5); + QCOMPARE(anim.totalDuration(), 50); +} + +QTEST_MAIN(tst_QAbstractAnimation) + +#include "tst_qabstractanimation.moc" diff --git a/tests/auto/qanimationgroup/qanimationgroup.pro b/tests/auto/corelib/animation/qanimationgroup/qanimationgroup.pro similarity index 100% rename from tests/auto/qanimationgroup/qanimationgroup.pro rename to tests/auto/corelib/animation/qanimationgroup/qanimationgroup.pro diff --git a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp similarity index 100% rename from tests/auto/qanimationgroup/tst_qanimationgroup.cpp rename to tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp diff --git a/tests/auto/qparallelanimationgroup/qparallelanimationgroup.pro b/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro similarity index 100% rename from tests/auto/qparallelanimationgroup/qparallelanimationgroup.pro rename to tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp similarity index 100% rename from tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp rename to tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp diff --git a/tests/auto/qpauseanimation/qpauseanimation.pro b/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro similarity index 100% rename from tests/auto/qpauseanimation/qpauseanimation.pro rename to tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro diff --git a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp similarity index 100% rename from tests/auto/qpauseanimation/tst_qpauseanimation.cpp rename to tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp diff --git a/tests/auto/qpropertyanimation/qpropertyanimation.pro b/tests/auto/corelib/animation/qpropertyanimation/qpropertyanimation.pro similarity index 72% rename from tests/auto/qpropertyanimation/qpropertyanimation.pro rename to tests/auto/corelib/animation/qpropertyanimation/qpropertyanimation.pro index 6d6ddbf65bd..4dfd558610d 100644 --- a/tests/auto/qpropertyanimation/qpropertyanimation.pro +++ b/tests/auto/corelib/animation/qpropertyanimation/qpropertyanimation.pro @@ -1,5 +1,5 @@ load(qttest_p4) -QT = core gui +QT = core gui widgets SOURCES += tst_qpropertyanimation.cpp diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp similarity index 99% rename from tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp rename to tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp index f08879e1ce1..e5feab4aa6f 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp @@ -40,12 +40,12 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include "../../shared/util.h" +#include "../../../../shared/util.h" #include <QtCore/qpropertyanimation.h> #include <QtCore/qvariantanimation.h> -#include <QtGui/qwidget.h> -#include "../../shared/util.h" +#include <QtWidgets/qwidget.h> +#include "../../../../shared/util.h" //TESTED_CLASS=QPropertyAnimation //TESTED_FILES= diff --git a/tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro b/tests/auto/corelib/animation/qsequentialanimationgroup/qsequentialanimationgroup.pro similarity index 100% rename from tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro rename to tests/auto/corelib/animation/qsequentialanimationgroup/qsequentialanimationgroup.pro diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp similarity index 99% rename from tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp rename to tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index eaebe3e14e7..00c038b948b 100644 --- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include "../../shared/util.h" +#include "../../../../shared/util.h" #include <QtCore/qanimationgroup.h> #include <QtCore/qsequentialanimationgroup.h> diff --git a/tests/auto/corelib/animation/qvariantanimation/qvariantanimation.pro b/tests/auto/corelib/animation/qvariantanimation/qvariantanimation.pro new file mode 100644 index 00000000000..6c463051e85 --- /dev/null +++ b/tests/auto/corelib/animation/qvariantanimation/qvariantanimation.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +QT = core +SOURCES += tst_qvariantanimation.cpp \ + + +CONFIG += parallel_test diff --git a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp new file mode 100644 index 00000000000..7dcfd1d4f5a --- /dev/null +++ b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtCore/qvariantanimation.h> +#include <QtTest> + +class tst_QVariantAnimation : public QObject +{ + Q_OBJECT + +public: + tst_QVariantAnimation() {} + virtual ~tst_QVariantAnimation() {} + +public slots: + void init(); + void cleanup(); + +private slots: + void construction(); + void destruction(); + void currentValue(); + void easingCurve(); + void startValue(); + void endValue(); + void keyValueAt(); + void keyValues(); + void duration(); +}; + +class TestableQVariantAnimation : public QVariantAnimation +{ + Q_OBJECT +public: + void updateCurrentValue(const QVariant&) {} +}; + +void tst_QVariantAnimation::init() +{ +} + +void tst_QVariantAnimation::cleanup() +{ +} + +void tst_QVariantAnimation::construction() +{ + TestableQVariantAnimation anim; +} + +void tst_QVariantAnimation::destruction() +{ + TestableQVariantAnimation *anim = new TestableQVariantAnimation; + delete anim; +} + +void tst_QVariantAnimation::currentValue() +{ + TestableQVariantAnimation anim; + QVERIFY(!anim.currentValue().isValid()); +} + +void tst_QVariantAnimation::easingCurve() +{ + TestableQVariantAnimation anim; + QVERIFY(anim.easingCurve() == QEasingCurve::Linear); + anim.setEasingCurve(QEasingCurve::InQuad); + QVERIFY(anim.easingCurve() == QEasingCurve::InQuad); +} + +void tst_QVariantAnimation::endValue() +{ + TestableQVariantAnimation anim; + anim.setEndValue(QVariant(1)); + QCOMPARE(anim.endValue().toInt(), 1); +} + +void tst_QVariantAnimation::startValue() +{ + TestableQVariantAnimation anim; + anim.setStartValue(QVariant(1)); + QCOMPARE(anim.startValue().toInt(), 1); + anim.setStartValue(QVariant(-1)); + QCOMPARE(anim.startValue().toInt(), -1); +} + +void tst_QVariantAnimation::keyValueAt() +{ + TestableQVariantAnimation anim; + + int i=0; + for (qreal r=0.0; r<1.0; r+=0.1) { + anim.setKeyValueAt(0.1, ++i); + QCOMPARE(anim.keyValueAt(0.1).toInt(), i); + } +} + +void tst_QVariantAnimation::keyValues() +{ + TestableQVariantAnimation anim; + + QVariantAnimation::KeyValues values; + int i=0; + for (qreal r=0.0; r<1.0; r+=0.1) { + values.append(QVariantAnimation::KeyValue(r, i)); + } + + anim.setKeyValues(values); + QCOMPARE(anim.keyValues(), values); +} + +void tst_QVariantAnimation::duration() +{ + TestableQVariantAnimation anim; + QCOMPARE(anim.duration(), 250); + anim.setDuration(500); + QCOMPARE(anim.duration(), 500); + QTest::ignoreMessage(QtWarningMsg, "QVariantAnimation::setDuration: cannot set a negative duration"); + anim.setDuration(-1); + QCOMPARE(anim.duration(), 500); +} + +QTEST_MAIN(tst_QVariantAnimation) + +#include "tst_qvariantanimation.moc" diff --git a/tests/auto/corelib/codecs/codecs.pro b/tests/auto/corelib/codecs/codecs.pro new file mode 100644 index 00000000000..41c5d8e46d3 --- /dev/null +++ b/tests/auto/corelib/codecs/codecs.pro @@ -0,0 +1,3 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qtextcodec diff --git a/tests/auto/qtextcodec/.gitattributes b/tests/auto/corelib/codecs/qtextcodec/.gitattributes similarity index 100% rename from tests/auto/qtextcodec/.gitattributes rename to tests/auto/corelib/codecs/qtextcodec/.gitattributes diff --git a/tests/auto/qtextcodec/.gitignore b/tests/auto/corelib/codecs/qtextcodec/.gitignore similarity index 100% rename from tests/auto/qtextcodec/.gitignore rename to tests/auto/corelib/codecs/qtextcodec/.gitignore diff --git a/tests/auto/qtextcodec/QT4-crashtest.txt b/tests/auto/corelib/codecs/qtextcodec/QT4-crashtest.txt similarity index 100% rename from tests/auto/qtextcodec/QT4-crashtest.txt rename to tests/auto/corelib/codecs/qtextcodec/QT4-crashtest.txt diff --git a/tests/auto/qtextcodec/echo/echo.pro b/tests/auto/corelib/codecs/qtextcodec/echo/echo.pro similarity index 100% rename from tests/auto/qtextcodec/echo/echo.pro rename to tests/auto/corelib/codecs/qtextcodec/echo/echo.pro diff --git a/tests/auto/qtextcodec/echo/main.cpp b/tests/auto/corelib/codecs/qtextcodec/echo/main.cpp similarity index 100% rename from tests/auto/qtextcodec/echo/main.cpp rename to tests/auto/corelib/codecs/qtextcodec/echo/main.cpp diff --git a/tests/auto/qtextcodec/korean.txt b/tests/auto/corelib/codecs/qtextcodec/korean.txt similarity index 100% rename from tests/auto/qtextcodec/korean.txt rename to tests/auto/corelib/codecs/qtextcodec/korean.txt diff --git a/tests/auto/qtextcodec/qtextcodec.pro b/tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro similarity index 100% rename from tests/auto/qtextcodec/qtextcodec.pro rename to tests/auto/corelib/codecs/qtextcodec/qtextcodec.pro diff --git a/tests/auto/qtextcodec/test/test.pro b/tests/auto/corelib/codecs/qtextcodec/test/test.pro similarity index 100% rename from tests/auto/qtextcodec/test/test.pro rename to tests/auto/corelib/codecs/qtextcodec/test/test.pro diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp similarity index 100% rename from tests/auto/qtextcodec/tst_qtextcodec.cpp rename to tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp diff --git a/tests/auto/qtextcodec/utf8.txt b/tests/auto/corelib/codecs/qtextcodec/utf8.txt similarity index 100% rename from tests/auto/qtextcodec/utf8.txt rename to tests/auto/corelib/codecs/qtextcodec/utf8.txt diff --git a/tests/auto/corelib/concurrent/concurrent.pro b/tests/auto/corelib/concurrent/concurrent.pro new file mode 100644 index 00000000000..6d7850b18f1 --- /dev/null +++ b/tests/auto/corelib/concurrent/concurrent.pro @@ -0,0 +1,19 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qfuture \ + qfuturesynchronizer \ + qfuturewatcher \ + qtconcurrentfilter \ + qtconcurrentiteratekernel \ + qtconcurrentmap \ + qtconcurrentresultstore \ + qtconcurrentrun \ + qtconcurrentthreadengine \ + qthreadpool + +symbian:SUBDIRS -= \ + qtconcurrentfilter \ + qtconcurrentiteratekernel \ + qtconcurrentmap \ + qtconcurrentrun \ + qtconcurrentthreadengine \ diff --git a/tests/auto/qfuture/.gitignore b/tests/auto/corelib/concurrent/qfuture/.gitignore similarity index 100% rename from tests/auto/qfuture/.gitignore rename to tests/auto/corelib/concurrent/qfuture/.gitignore diff --git a/tests/auto/qfuture/qfuture.pro b/tests/auto/corelib/concurrent/qfuture/qfuture.pro similarity index 100% rename from tests/auto/qfuture/qfuture.pro rename to tests/auto/corelib/concurrent/qfuture/qfuture.pro diff --git a/tests/auto/qfuture/tst_qfuture.cpp b/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp similarity index 99% rename from tests/auto/qfuture/tst_qfuture.cpp rename to tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp index 2178489bd98..d81df0d8637 100644 --- a/tests/auto/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp @@ -55,6 +55,11 @@ using namespace QtConcurrent; +// COM interface macro. +#if defined(Q_OS_WIN) && defined(interface) +# undef interface +#endif + //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qfuture/versioncheck.h b/tests/auto/corelib/concurrent/qfuture/versioncheck.h similarity index 100% rename from tests/auto/qfuture/versioncheck.h rename to tests/auto/corelib/concurrent/qfuture/versioncheck.h diff --git a/tests/auto/corelib/concurrent/qfuturesynchronizer/qfuturesynchronizer.pro b/tests/auto/corelib/concurrent/qfuturesynchronizer/qfuturesynchronizer.pro new file mode 100644 index 00000000000..11012cce240 --- /dev/null +++ b/tests/auto/corelib/concurrent/qfuturesynchronizer/qfuturesynchronizer.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +QT = core +SOURCES += tst_qfuturesynchronizer.cpp \ + +CONFIG += parallel_test diff --git a/tests/auto/corelib/concurrent/qfuturesynchronizer/tst_qfuturesynchronizer.cpp b/tests/auto/corelib/concurrent/qfuturesynchronizer/tst_qfuturesynchronizer.cpp new file mode 100644 index 00000000000..5aced3f8c1c --- /dev/null +++ b/tests/auto/corelib/concurrent/qfuturesynchronizer/tst_qfuturesynchronizer.cpp @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest> + +#include <QtCore/qfuturesynchronizer.h> +#include <QtCore/qfuture.h> + +class tst_QFutureSynchronizer : public QObject +{ + Q_OBJECT + + +private Q_SLOTS: + void construction(); + void addFuture(); + void cancelOnWait(); + void clearFutures(); + void futures(); + void setFuture(); + void waitForFinished(); +}; + + +void tst_QFutureSynchronizer::construction() +{ + + QFuture<void> future; + QFutureSynchronizer<void> synchronizer; + QFutureSynchronizer<void> synchronizerWithFuture(future); + + QCOMPARE(synchronizer.futures().size(), 0); + QCOMPARE(synchronizerWithFuture.futures().size(), 1); +} + +void tst_QFutureSynchronizer::addFuture() +{ + QFutureSynchronizer<void> synchronizer; + + synchronizer.addFuture(QFuture<void>()); + QFuture<void> future; + synchronizer.addFuture(future); + synchronizer.addFuture(future); + + QCOMPARE(synchronizer.futures().size(), 3); +} + +void tst_QFutureSynchronizer::cancelOnWait() +{ + QFutureSynchronizer<void> synchronizer; + QVERIFY(!synchronizer.cancelOnWait()); + synchronizer.setCancelOnWait(true); + QVERIFY(synchronizer.cancelOnWait()); + synchronizer.setCancelOnWait(false); + QVERIFY(!synchronizer.cancelOnWait()); + synchronizer.setCancelOnWait(true); + QVERIFY(synchronizer.cancelOnWait()); +} + +void tst_QFutureSynchronizer::clearFutures() +{ + QFutureSynchronizer<void> synchronizer; + synchronizer.clearFutures(); + QVERIFY(synchronizer.futures().isEmpty()); + + synchronizer.addFuture(QFuture<void>()); + QFuture<void> future; + synchronizer.addFuture(future); + synchronizer.addFuture(future); + synchronizer.clearFutures(); + QVERIFY(synchronizer.futures().isEmpty()); +} + +void tst_QFutureSynchronizer::futures() +{ + QFutureSynchronizer<void> synchronizer; + + QList<QFuture<void> > futures; + for (int i=0; i<100; i++) { + QFuture<void> future; + futures.append(future); + synchronizer.addFuture(future); + } + + QCOMPARE(futures, synchronizer.futures()); +} + +void tst_QFutureSynchronizer::setFuture() +{ + QFutureSynchronizer<void> synchronizer; + + for (int i=0; i<100; i++) { + synchronizer.addFuture(QFuture<void>()); + } + QCOMPARE(synchronizer.futures().size(), 100); + + QFuture<void> future; + synchronizer.setFuture(future); + QCOMPARE(synchronizer.futures().size(), 1); + QCOMPARE(synchronizer.futures().first(), future); +} + +void tst_QFutureSynchronizer::waitForFinished() +{ + QFutureSynchronizer<void> synchronizer; + + for (int i=0; i<100; i++) { + synchronizer.addFuture(QFuture<void>()); + } + synchronizer.waitForFinished(); + const QList<QFuture<void> > futures = synchronizer.futures(); + + for (int i=0; i<100; i++) { + QVERIFY(futures.at(i).isFinished()); + } +} + +QTEST_MAIN(tst_QFutureSynchronizer) + +#include "tst_qfuturesynchronizer.moc" diff --git a/tests/auto/qfuturewatcher/.gitignore b/tests/auto/corelib/concurrent/qfuturewatcher/.gitignore similarity index 100% rename from tests/auto/qfuturewatcher/.gitignore rename to tests/auto/corelib/concurrent/qfuturewatcher/.gitignore diff --git a/tests/auto/qfuturewatcher/qfuturewatcher.pro b/tests/auto/corelib/concurrent/qfuturewatcher/qfuturewatcher.pro similarity index 100% rename from tests/auto/qfuturewatcher/qfuturewatcher.pro rename to tests/auto/corelib/concurrent/qfuturewatcher/qfuturewatcher.pro diff --git a/tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/corelib/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp similarity index 99% rename from tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp rename to tests/auto/corelib/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp index f45bd9f989b..d8fa2230f34 100644 --- a/tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp +++ b/tests/auto/corelib/concurrent/qfuturewatcher/tst_qfuturewatcher.cpp @@ -47,7 +47,7 @@ #include <qfuturewatcher.h> #include <qtconcurrentrun.h> #include <qtconcurrentmap.h> -#include "../../shared/util.h" +#include "../../../../shared/util.h" #ifndef QT_NO_CONCURRENT_TEST #include <private/qfutureinterface_p.h> diff --git a/tests/auto/qtconcurrentfilter/.gitignore b/tests/auto/corelib/concurrent/qtconcurrentfilter/.gitignore similarity index 100% rename from tests/auto/qtconcurrentfilter/.gitignore rename to tests/auto/corelib/concurrent/qtconcurrentfilter/.gitignore diff --git a/tests/auto/qtconcurrentfilter/qtconcurrentfilter.pro b/tests/auto/corelib/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro similarity index 100% rename from tests/auto/qtconcurrentfilter/qtconcurrentfilter.pro rename to tests/auto/corelib/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro diff --git a/tests/auto/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/corelib/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp similarity index 99% rename from tests/auto/qtconcurrentfilter/tst_qtconcurrentfilter.cpp rename to tests/auto/corelib/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp index 33611d7331b..970784c5d3b 100644 --- a/tests/auto/qtconcurrentfilter/tst_qtconcurrentfilter.cpp +++ b/tests/auto/corelib/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp @@ -1499,8 +1499,10 @@ void tst_QtConcurrentFilter::noDetatch() void tst_QtConcurrentFilter::stlContainers() { -#ifdef QT_NO_STL +#if defined(QT_NO_STL) QSKIP("Qt compiled without STL support", SkipAll); +#elif defined(_MSC_VER) && _MSC_VER >= 1600 + QSKIP("Test does not compile with MSVC 2010 (see QTBUG-18996)", SkipAll); #else std::vector<int> vector; vector.push_back(1); diff --git a/tests/auto/qtconcurrentiteratekernel/.gitignore b/tests/auto/corelib/concurrent/qtconcurrentiteratekernel/.gitignore similarity index 100% rename from tests/auto/qtconcurrentiteratekernel/.gitignore rename to tests/auto/corelib/concurrent/qtconcurrentiteratekernel/.gitignore diff --git a/tests/auto/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro b/tests/auto/corelib/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro similarity index 100% rename from tests/auto/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro rename to tests/auto/corelib/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro diff --git a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/corelib/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp similarity index 100% rename from tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp rename to tests/auto/corelib/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp diff --git a/tests/auto/qtconcurrentmap/.gitignore b/tests/auto/corelib/concurrent/qtconcurrentmap/.gitignore similarity index 100% rename from tests/auto/qtconcurrentmap/.gitignore rename to tests/auto/corelib/concurrent/qtconcurrentmap/.gitignore diff --git a/tests/auto/qtconcurrentmap/functions.h b/tests/auto/corelib/concurrent/qtconcurrentmap/functions.h similarity index 100% rename from tests/auto/qtconcurrentmap/functions.h rename to tests/auto/corelib/concurrent/qtconcurrentmap/functions.h diff --git a/tests/auto/qtconcurrentmap/qtconcurrentmap.pro b/tests/auto/corelib/concurrent/qtconcurrentmap/qtconcurrentmap.pro similarity index 100% rename from tests/auto/qtconcurrentmap/qtconcurrentmap.pro rename to tests/auto/corelib/concurrent/qtconcurrentmap/qtconcurrentmap.pro diff --git a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/corelib/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp similarity index 99% rename from tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp rename to tests/auto/corelib/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp index 74a254cbf4a..8ec49accdfb 100644 --- a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/corelib/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -2231,7 +2231,7 @@ void tst_QtConcurrentMap::exceptions() try { QList<int> list = QList<int>() << 1 << 2 << 3; QtConcurrent::map(list, throwMapper).waitForFinished(); - } catch (Exception &e) { + } catch (const Exception &) { caught = true; } if (!caught) diff --git a/tests/auto/corelib/concurrent/qtconcurrentresultstore/qtconcurrentresultstore.pro b/tests/auto/corelib/concurrent/qtconcurrentresultstore/qtconcurrentresultstore.pro new file mode 100644 index 00000000000..8bc20c3f13c --- /dev/null +++ b/tests/auto/corelib/concurrent/qtconcurrentresultstore/qtconcurrentresultstore.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +DEFINES += QT_STRICT_ITERATORS +SOURCES += tst_qtconcurrentresultstore.cpp +QT = core core-private +CONFIG += parallel_test diff --git a/tests/auto/corelib/concurrent/qtconcurrentresultstore/tst_qtconcurrentresultstore.cpp b/tests/auto/corelib/concurrent/qtconcurrentresultstore/tst_qtconcurrentresultstore.cpp new file mode 100644 index 00000000000..1728be68fe3 --- /dev/null +++ b/tests/auto/corelib/concurrent/qtconcurrentresultstore/tst_qtconcurrentresultstore.cpp @@ -0,0 +1,491 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtTest/QtTest> + +#include <qtconcurrentresultstore.h> + +using namespace QtConcurrent; + +class tst_QtConcurrentResultStore : public QObject +{ + Q_OBJECT +public slots: + void init(); +private slots: + void construction(); + void iterators(); + void addResult(); + void addResults(); + void resultIndex(); + void resultAt(); + void contains(); + void filterMode(); + void addCanceledResult(); + void count(); +private: + int int0; + int int1; + int int2; + QVector<int> vec0; + QVector<int> vec1; +}; + +void tst_QtConcurrentResultStore::init() +{ + int0 = 0; + int1 = 1; + int2 = 2; + vec0 = QVector<int>() << 2 << 3; + vec1 = QVector<int>() << 4 << 5; +} + +void tst_QtConcurrentResultStore::construction() +{ + ResultStore<int> store; + QCOMPARE(store.count(), 0); +} + +void tst_QtConcurrentResultStore::iterators() +{ + { + ResultStore<int> store; + ResultIteratorBase it = store.begin(); + QVERIFY(store.begin() == store.end()); + QVERIFY(store.resultAt(0) == store.end()); + QVERIFY(store.resultAt(1) == store.end()); + } + { + ResultStoreBase storebase; + storebase.addResult(-1, &int0); // note to self: adding a pointer to the stack here is ok since + storebase.addResult(1, &int1); // ResultStoreBase does not take ownership, only ResultStore<> does. + ResultIteratorBase it = storebase.begin(); + QCOMPARE(it.resultIndex(), 0); + QVERIFY(it == storebase.begin()); + QVERIFY(it != storebase.end()); + + ++it; + QCOMPARE(it.resultIndex(), 1); + QVERIFY(it != storebase.begin()); + QVERIFY(it != storebase.end()); + + ++it; + QVERIFY(it != storebase.begin()); + QVERIFY(it == storebase.end()); + } +} + +void tst_QtConcurrentResultStore::addResult() +{ + { + // test addResult return value + ResultStore<int> store; + store.setFilterMode(true); + + QCOMPARE(store.addResult(0, &int0), 0); + QCOMPARE(store.count(), 1); // result 0 becomes available + QCOMPARE(store.contains(0), true); + + QCOMPARE(store.addResult(2, &int0), 2); + QCOMPARE(store.count(), 1); + QCOMPARE(store.contains(2), false); + + QCOMPARE(store.addCanceledResult(1), 1); + QCOMPARE(store.count(), 2); // result 2 is renamed to 1 and becomes available + + QCOMPARE(store.contains(0), true); + QCOMPARE(store.contains(1), true); + QCOMPARE(store.contains(2), false); + + QCOMPARE(store.addResult(3, &int0), 3); + QCOMPARE(store.count(), 3); + QCOMPARE(store.contains(2), true); + + QCOMPARE(store.addResult(6, &int0), 6); + QCOMPARE(store.count(), 3); + QCOMPARE(store.addResult(7, &int0), 7); + QCOMPARE(store.count(), 3); + QCOMPARE(store.contains(3), false); + + QCOMPARE(store.addCanceledResult(4), 4); + QCOMPARE(store.addCanceledResult(5), 5); + QCOMPARE(store.count(), 5); // 6 and 7 is renamed to 3 and 4 and becomes available + + QCOMPARE(store.contains(3), true); + QCOMPARE(store.contains(4), true); + + QCOMPARE(store.addResult(8, &int0), 8); + QCOMPARE(store.contains(5), true); + QCOMPARE(store.count(), 6); + + QCOMPARE(store.contains(6), false); + QCOMPARE(store.contains(7), false); + } +} + +void tst_QtConcurrentResultStore::addResults() +{ + + ResultStoreBase store; + store.addResults(-1, &vec0, 2, 2); + store.addResults(-1, &vec1, 2, 2); + ResultIteratorBase it = store.begin(); + QCOMPARE(it.resultIndex(), 0); + QVERIFY(it == store.begin()); + QVERIFY(it != store.end()); + + ++it; + QCOMPARE(it.resultIndex(), 1); + QVERIFY(it != store.begin()); + QVERIFY(it != store.end()); + + ++it; + QCOMPARE(it.resultIndex(), 2); + + ++it; + QCOMPARE(it.resultIndex(), 3); + + ++it; + QVERIFY(it == store.end()); +} + +void tst_QtConcurrentResultStore::resultIndex() +{ + ResultStore<int> store; + store.addResult(-1, &int0); + store.addResults(-1, &vec0); + store.addResult(-1, &int1); + + ResultIteratorBase it = store.begin(); + QCOMPARE(it.resultIndex(), 0); + QVERIFY(it == store.begin()); + QVERIFY(it != store.end()); + + ++it; + QCOMPARE(it.resultIndex(), 1); + QVERIFY(it != store.begin()); + QVERIFY(it != store.end()); + + ++it; + QCOMPARE(it.resultIndex(), 2); + QVERIFY(it != store.end()); + ++it; + QCOMPARE(it.resultIndex(), 3); + QVERIFY(it != store.end()); + ++it; + QVERIFY(it == store.end()); + + QCOMPARE(store.resultAt(0).value(), int0); + QCOMPARE(store.resultAt(1).value(), vec0[0]); + QCOMPARE(store.resultAt(2).value(), vec0[1]); + QCOMPARE(store.resultAt(3).value(), int1); +} + +void tst_QtConcurrentResultStore::resultAt() +{ + { + ResultStore<int> store; + store.addResult(-1, &int0); + store.addResults(-1, &vec0); + store.addResult(200, &int1); + + QCOMPARE(store.resultAt(0).value(), int0); + QCOMPARE(store.resultAt(1).value(), vec0[0]); + QCOMPARE(store.resultAt(2).value(), vec0[1]); + QCOMPARE(store.resultAt(200).value(), int1); + } + { + ResultStore<int> store; + store.addResult(1, &int1); + store.addResult(0, &int0); + store.addResult(-1, &int2); + + QCOMPARE(store.resultAt(0).value(), int0); + QCOMPARE(store.resultAt(1).value(), int1); + QCOMPARE(store.resultAt(2).value(), int2); + } +} + +void tst_QtConcurrentResultStore::contains() +{ + { + ResultStore<int> store; + QCOMPARE(store.contains(0), false); + QCOMPARE(store.contains(1), false); + QCOMPARE(store.contains(INT_MAX), false); + store.addResult(1, &int1); + QVERIFY(store.contains(int1)); + store.addResult(0, &int0); + QVERIFY(store.contains(int0)); + store.addResult(-1, &int2); + QVERIFY(store.contains(int2)); + } + { + ResultStore<int> store; + store.addResult(1, &int0); + store.addResult(3, &int0); + store.addResults(6, &vec0); + QCOMPARE(store.contains(0), false); + QCOMPARE(store.contains(1), true); + QCOMPARE(store.contains(2), false); + QCOMPARE(store.contains(3), true); + QCOMPARE(store.contains(4), false); + QCOMPARE(store.contains(5), false); + QCOMPARE(store.contains(6), true); + QCOMPARE(store.contains(7), true); + } + + { + ResultStore<int> store; + store.setFilterMode(true); + store.addResult(1, &int0); + store.addResult(3, &int0); + store.addResults(6, &vec0); + QCOMPARE(store.contains(0), false); + QCOMPARE(store.contains(1), false); + QCOMPARE(store.contains(2), false); + QCOMPARE(store.contains(3), false); + QCOMPARE(store.contains(4), false); + QCOMPARE(store.contains(5), false); + QCOMPARE(store.contains(6), false); + QCOMPARE(store.contains(7), false); + + store.addCanceledResult(0); + store.addCanceledResult(2); + store.addCanceledResults(4, 2); + + QCOMPARE(store.contains(0), true); + QCOMPARE(store.contains(1), true); + QCOMPARE(store.contains(2), true); + QCOMPARE(store.contains(3), true); + QCOMPARE(store.contains(4), false); + QCOMPARE(store.contains(5), false); + QCOMPARE(store.contains(6), false); + QCOMPARE(store.contains(7), false); + } + { + ResultStore<int> store; + store.setFilterMode(true); + store.addCanceledResult(0); + QCOMPARE(store.contains(0), false); + + store.addResult(1, &int0); + QCOMPARE(store.contains(0), true); + QCOMPARE(store.contains(1), false); + } +} + +void tst_QtConcurrentResultStore::filterMode() +{ + // Test filter mode, where "gaps" in the result array aren't allowed. + ResultStore<int> store; + QCOMPARE(store.filterMode(), false); + store.setFilterMode(true); + QVERIFY(store.filterMode()); + + store.addResult(0, &int0); + QCOMPARE(store.contains(0), true); + + store.addResult(2, &int2); // add result at index 2 + QCOMPARE(store.contains(2), false); // but 1 is missing, so this 2 won't be reported yet. + + store.addResult(1, &int1); + QCOMPARE(store.contains(1), true); + QCOMPARE(store.contains(2), true); // 2 should be visible now. + + store.addResult(4, &int0); + store.addResult(5, &int0); + store.addResult(7, &int0); + QCOMPARE(store.contains(4), false); + QCOMPARE(store.contains(5), false); + QCOMPARE(store.contains(7), false); + + store.addResult(3, &int0); // adding 3 makes 4 and 5 visible + QCOMPARE(store.contains(4), true); + QCOMPARE(store.contains(5), true); + QCOMPARE(store.contains(7), false); + + store.addResult(6, &int0); // adding 6 makes 7 visible + + QCOMPARE(store.contains(6), true); + QCOMPARE(store.contains(7), true); + QCOMPARE(store.contains(8), false); +} + +void tst_QtConcurrentResultStore::addCanceledResult() +{ + // test canceled results + ResultStore<int> store; + store.setFilterMode(true); + + store.addResult(0, &int0); + QCOMPARE(store.contains(0), true); + + store.addResult(2, &int0); + QCOMPARE(store.contains(2), false); + + store.addCanceledResult(1); // report no result at 1 + + QCOMPARE(store.contains(0), true); + QCOMPARE(store.contains(1), true); // 2 gets renamed to 1 + QCOMPARE(store.contains(2), false); + + store.addResult(3, &int0); + QCOMPARE(store.contains(2), true); //3 gets renamed to 2 + + store.addResult(6, &int0); + store.addResult(7, &int0); + QCOMPARE(store.contains(3), false); + + store.addCanceledResult(4); + store.addCanceledResult(5); + + QCOMPARE(store.contains(3), true); //6 gets renamed to 3 + QCOMPARE(store.contains(4), true); //7 gets renamed to 4 + + store.addResult(8, &int0); + QCOMPARE(store.contains(5), true); //8 gets renamed to 4 + + QCOMPARE(store.contains(6), false); + QCOMPARE(store.contains(7), false); +} + +void tst_QtConcurrentResultStore::count() +{ + { + // test resultCount in non-filtered mode. It should always be possible + // to iterate through the results 0 to resultCount. + ResultStore<int> store; + store.addResult(0, &int0); + + QCOMPARE(store.count(), 1); + + store.addResult(2, &int0); + + QCOMPARE(store.count(), 1); + + store.addResult(1, &int0); + QCOMPARE(store.count(), 3); + } + + { + ResultStore<int> store; + store.addResult(2, &int0); + QCOMPARE(store.count(), 0); + + store.addResult(1, &int0); + QCOMPARE(store.count(), 0); + + store.addResult(0, &int0); + QCOMPARE(store.count(), 3); + } + + { + ResultStore<int> store; + store.addResults(2, &vec1); + QCOMPARE(store.count(), 0); + + store.addResult(1, &int0); + QCOMPARE(store.count(), 0); + + store.addResult(0, &int0); + QCOMPARE(store.count(), 4); + } + + { + ResultStore<int> store; + store.addResults(2, &vec1); + QCOMPARE(store.count(), 0); + + store.addResults(0, &vec0); + QCOMPARE(store.count(), 4); + } + { + ResultStore<int> store; + store.addResults(3, &vec1); + QCOMPARE(store.count(), 0); + + store.addResults(0, &vec0); + QCOMPARE(store.count(), 2); + + store.addResult(2, &int0); + QCOMPARE(store.count(), 5); + } + + { + ResultStore<int> store; + store.setFilterMode(true); + store.addResults(3, &vec1); + QCOMPARE(store.count(), 0); + + store.addResults(0, &vec0); + QCOMPARE(store.count(), 2); + + store.addCanceledResult(2); + QCOMPARE(store.count(), 4); + } + + { + ResultStore<int> store; + store.setFilterMode(true); + store.addResults(3, &vec1); + QCOMPARE(store.count(), 0); + + store.addCanceledResults(0, 3); + QCOMPARE(store.count(), 2); + } + + { + ResultStore<int> store; + store.setFilterMode(true); + store.addResults(3, &vec1); + QCOMPARE(store.count(), 0); + + store.addCanceledResults(0, 3); + QCOMPARE(store.count(), 2); // results at 3 and 4 become available at index 0, 1 + + store.addResult(5, &int0); + QCOMPARE(store.count(), 3);// result 5 becomes available at index 2 + } +} + +QTEST_MAIN(tst_QtConcurrentResultStore) +#include "tst_qtconcurrentresultstore.moc" diff --git a/tests/auto/qtconcurrentrun/.gitignore b/tests/auto/corelib/concurrent/qtconcurrentrun/.gitignore similarity index 100% rename from tests/auto/qtconcurrentrun/.gitignore rename to tests/auto/corelib/concurrent/qtconcurrentrun/.gitignore diff --git a/tests/auto/qtconcurrentrun/qtconcurrentrun.pro b/tests/auto/corelib/concurrent/qtconcurrentrun/qtconcurrentrun.pro similarity index 100% rename from tests/auto/qtconcurrentrun/qtconcurrentrun.pro rename to tests/auto/corelib/concurrent/qtconcurrentrun/qtconcurrentrun.pro diff --git a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp similarity index 100% rename from tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp rename to tests/auto/corelib/concurrent/qtconcurrentrun/tst_qtconcurrentrun.cpp diff --git a/tests/auto/qtconcurrentthreadengine/.gitignore b/tests/auto/corelib/concurrent/qtconcurrentthreadengine/.gitignore similarity index 100% rename from tests/auto/qtconcurrentthreadengine/.gitignore rename to tests/auto/corelib/concurrent/qtconcurrentthreadengine/.gitignore diff --git a/tests/auto/qtconcurrentthreadengine/qtconcurrentthreadengine.pro b/tests/auto/corelib/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro similarity index 100% rename from tests/auto/qtconcurrentthreadengine/qtconcurrentthreadengine.pro rename to tests/auto/corelib/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro diff --git a/tests/auto/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp b/tests/auto/corelib/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp similarity index 97% rename from tests/auto/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp rename to tests/auto/corelib/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp index 772c749711e..f22a2ed64bd 100644 --- a/tests/auto/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp +++ b/tests/auto/corelib/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp @@ -445,7 +445,7 @@ void tst_QtConcurrentThreadEngine::exceptions() QtConcurrentExceptionThrower *e = new QtConcurrentExceptionThrower(); QFuture<void> f = e->startAsynchronously(); f.waitForFinished(); - } catch (Exception &e) { + } catch (const Exception &) { caught = true; } if (!caught) @@ -459,7 +459,7 @@ void tst_QtConcurrentThreadEngine::exceptions() try { QtConcurrentExceptionThrower e(QThread::currentThread()); e.startBlocking(); - } catch (Exception &e) { + } catch (const Exception &) { caught = true; } @@ -473,7 +473,7 @@ void tst_QtConcurrentThreadEngine::exceptions() try { QtConcurrentExceptionThrower e(0); e.startBlocking(); - } catch (Exception &e) { + } catch (const Exception &) { caught = true; } @@ -488,7 +488,7 @@ void tst_QtConcurrentThreadEngine::exceptions() UnrelatedExceptionThrower *e = new UnrelatedExceptionThrower(); QFuture<void> f = e->startAsynchronously(); f.waitForFinished(); - } catch (QtConcurrent::UnhandledException &e) { + } catch (const QtConcurrent::UnhandledException &) { caught = true; } if (!caught) @@ -502,7 +502,7 @@ void tst_QtConcurrentThreadEngine::exceptions() try { UnrelatedExceptionThrower e(QThread::currentThread()); e.startBlocking(); - } catch (QtConcurrent::UnhandledException &e) { + } catch (const QtConcurrent::UnhandledException &) { caught = true; } @@ -516,7 +516,7 @@ void tst_QtConcurrentThreadEngine::exceptions() try { UnrelatedExceptionThrower e(0); e.startBlocking(); - } catch (QtConcurrent::UnhandledException &e) { + } catch (const QtConcurrent::UnhandledException &) { caught = true; } diff --git a/tests/auto/qthreadpool/.gitignore b/tests/auto/corelib/concurrent/qthreadpool/.gitignore similarity index 100% rename from tests/auto/qthreadpool/.gitignore rename to tests/auto/corelib/concurrent/qthreadpool/.gitignore diff --git a/tests/auto/qthreadpool/qthreadpool.pro b/tests/auto/corelib/concurrent/qthreadpool/qthreadpool.pro similarity index 100% rename from tests/auto/qthreadpool/qthreadpool.pro rename to tests/auto/corelib/concurrent/qthreadpool/qthreadpool.pro diff --git a/tests/auto/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/concurrent/qthreadpool/tst_qthreadpool.cpp similarity index 100% rename from tests/auto/qthreadpool/tst_qthreadpool.cpp rename to tests/auto/corelib/concurrent/qthreadpool/tst_qthreadpool.cpp diff --git a/tests/auto/corelib/corelib.pro b/tests/auto/corelib/corelib.pro new file mode 100644 index 00000000000..b9063e53061 --- /dev/null +++ b/tests/auto/corelib/corelib.pro @@ -0,0 +1,13 @@ +TEMPLATE=subdirs +SUBDIRS=\ + animation \ + codecs \ + concurrent \ + global \ + io \ + kernel \ + plugin \ + statemachine \ + thread \ + tools \ + xml diff --git a/tests/auto/corelib/global/global.pro b/tests/auto/corelib/global/global.pro new file mode 100644 index 00000000000..e9b547be681 --- /dev/null +++ b/tests/auto/corelib/global/global.pro @@ -0,0 +1,8 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qflags \ + q_func_info \ + qgetputenv \ + qglobal \ + qnumeric \ + qrand diff --git a/tests/auto/q_func_info/.gitignore b/tests/auto/corelib/global/q_func_info/.gitignore similarity index 100% rename from tests/auto/q_func_info/.gitignore rename to tests/auto/corelib/global/q_func_info/.gitignore diff --git a/tests/auto/q_func_info/q_func_info.pro b/tests/auto/corelib/global/q_func_info/q_func_info.pro similarity index 100% rename from tests/auto/q_func_info/q_func_info.pro rename to tests/auto/corelib/global/q_func_info/q_func_info.pro diff --git a/tests/auto/q_func_info/tst_q_func_info.cpp b/tests/auto/corelib/global/q_func_info/tst_q_func_info.cpp similarity index 100% rename from tests/auto/q_func_info/tst_q_func_info.cpp rename to tests/auto/corelib/global/q_func_info/tst_q_func_info.cpp diff --git a/tests/auto/qflags/.gitignore b/tests/auto/corelib/global/qflags/.gitignore similarity index 100% rename from tests/auto/qflags/.gitignore rename to tests/auto/corelib/global/qflags/.gitignore diff --git a/tests/auto/qflags/qflags.pro b/tests/auto/corelib/global/qflags/qflags.pro similarity index 100% rename from tests/auto/qflags/qflags.pro rename to tests/auto/corelib/global/qflags/qflags.pro diff --git a/tests/auto/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp similarity index 100% rename from tests/auto/qflags/tst_qflags.cpp rename to tests/auto/corelib/global/qflags/tst_qflags.cpp diff --git a/tests/auto/qgetputenv/.gitignore b/tests/auto/corelib/global/qgetputenv/.gitignore similarity index 100% rename from tests/auto/qgetputenv/.gitignore rename to tests/auto/corelib/global/qgetputenv/.gitignore diff --git a/tests/auto/qgetputenv/qgetputenv.pro b/tests/auto/corelib/global/qgetputenv/qgetputenv.pro similarity index 100% rename from tests/auto/qgetputenv/qgetputenv.pro rename to tests/auto/corelib/global/qgetputenv/qgetputenv.pro diff --git a/tests/auto/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp similarity index 100% rename from tests/auto/qgetputenv/tst_qgetputenv.cpp rename to tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp diff --git a/tests/auto/qglobal/.gitignore b/tests/auto/corelib/global/qglobal/.gitignore similarity index 100% rename from tests/auto/qglobal/.gitignore rename to tests/auto/corelib/global/qglobal/.gitignore diff --git a/tests/auto/qglobal/qglobal.pro b/tests/auto/corelib/global/qglobal/qglobal.pro similarity index 100% rename from tests/auto/qglobal/qglobal.pro rename to tests/auto/corelib/global/qglobal/qglobal.pro diff --git a/tests/auto/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp similarity index 100% rename from tests/auto/qglobal/tst_qglobal.cpp rename to tests/auto/corelib/global/qglobal/tst_qglobal.cpp diff --git a/tests/auto/qnumeric/.gitignore b/tests/auto/corelib/global/qnumeric/.gitignore similarity index 100% rename from tests/auto/qnumeric/.gitignore rename to tests/auto/corelib/global/qnumeric/.gitignore diff --git a/tests/auto/qnumeric/qnumeric.pro b/tests/auto/corelib/global/qnumeric/qnumeric.pro similarity index 100% rename from tests/auto/qnumeric/qnumeric.pro rename to tests/auto/corelib/global/qnumeric/qnumeric.pro diff --git a/tests/auto/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp similarity index 100% rename from tests/auto/qnumeric/tst_qnumeric.cpp rename to tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp diff --git a/tests/auto/qrand/.gitignore b/tests/auto/corelib/global/qrand/.gitignore similarity index 100% rename from tests/auto/qrand/.gitignore rename to tests/auto/corelib/global/qrand/.gitignore diff --git a/tests/auto/qrand/qrand.pro b/tests/auto/corelib/global/qrand/qrand.pro similarity index 100% rename from tests/auto/qrand/qrand.pro rename to tests/auto/corelib/global/qrand/qrand.pro diff --git a/tests/auto/qrand/tst_qrand.cpp b/tests/auto/corelib/global/qrand/tst_qrand.cpp similarity index 100% rename from tests/auto/qrand/tst_qrand.cpp rename to tests/auto/corelib/global/qrand/tst_qrand.cpp diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro new file mode 100644 index 00000000000..cbe2b609b90 --- /dev/null +++ b/tests/auto/corelib/io/io.pro @@ -0,0 +1,23 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qabstractfileengine \ + qbuffer \ + qdatastream \ + qdebug \ + qdir \ + qdiriterator \ + qfile \ + qfileinfo \ + qfilesystementry \ + qfilesystemwatcher \ + qiodevice \ + qprocess \ + qprocessenvironment \ + qresourceengine \ + qsettings \ + qtemporaryfile \ + qtextstream \ + qurl \ + +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qfileinfo diff --git a/tests/auto/qabstractfileengine/qabstractfileengine.pro b/tests/auto/corelib/io/qabstractfileengine/qabstractfileengine.pro similarity index 100% rename from tests/auto/qabstractfileengine/qabstractfileengine.pro rename to tests/auto/corelib/io/qabstractfileengine/qabstractfileengine.pro diff --git a/tests/auto/qabstractfileengine/qabstractfileengine.qrc b/tests/auto/corelib/io/qabstractfileengine/qabstractfileengine.qrc similarity index 100% rename from tests/auto/qabstractfileengine/qabstractfileengine.qrc rename to tests/auto/corelib/io/qabstractfileengine/qabstractfileengine.qrc diff --git a/tests/auto/qabstractfileengine/resources/file.txt b/tests/auto/corelib/io/qabstractfileengine/resources/file.txt similarity index 100% rename from tests/auto/qabstractfileengine/resources/file.txt rename to tests/auto/corelib/io/qabstractfileengine/resources/file.txt diff --git a/tests/auto/qabstractfileengine/tst_qabstractfileengine.cpp b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp similarity index 100% rename from tests/auto/qabstractfileengine/tst_qabstractfileengine.cpp rename to tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp diff --git a/tests/auto/qbuffer/.gitignore b/tests/auto/corelib/io/qbuffer/.gitignore similarity index 100% rename from tests/auto/qbuffer/.gitignore rename to tests/auto/corelib/io/qbuffer/.gitignore diff --git a/tests/auto/qbuffer/qbuffer.pro b/tests/auto/corelib/io/qbuffer/qbuffer.pro similarity index 100% rename from tests/auto/qbuffer/qbuffer.pro rename to tests/auto/corelib/io/qbuffer/qbuffer.pro diff --git a/tests/auto/qbuffer/tst_qbuffer.cpp b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp similarity index 100% rename from tests/auto/qbuffer/tst_qbuffer.cpp rename to tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp diff --git a/tests/auto/qdatastream/.gitignore b/tests/auto/corelib/io/qdatastream/.gitignore similarity index 100% rename from tests/auto/qdatastream/.gitignore rename to tests/auto/corelib/io/qdatastream/.gitignore diff --git a/tests/auto/qdatastream/datastream.q42 b/tests/auto/corelib/io/qdatastream/datastream.q42 similarity index 100% rename from tests/auto/qdatastream/datastream.q42 rename to tests/auto/corelib/io/qdatastream/datastream.q42 diff --git a/tests/auto/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro similarity index 96% rename from tests/auto/qdatastream/qdatastream.pro rename to tests/auto/corelib/io/qdatastream/qdatastream.pro index 5e503aea781..51c342c3500 100644 --- a/tests/auto/qdatastream/qdatastream.pro +++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro @@ -1,6 +1,6 @@ load(qttest_p4) SOURCES += tst_qdatastream.cpp - +QT += gui widgets wince*: { addFiles.files = datastream.q42 addFiles.path = . diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp similarity index 100% rename from tests/auto/qdatastream/tst_qdatastream.cpp rename to tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp diff --git a/tests/auto/qdebug/.gitignore b/tests/auto/corelib/io/qdebug/.gitignore similarity index 100% rename from tests/auto/qdebug/.gitignore rename to tests/auto/corelib/io/qdebug/.gitignore diff --git a/tests/auto/qdebug/qdebug.pro b/tests/auto/corelib/io/qdebug/qdebug.pro similarity index 100% rename from tests/auto/qdebug/qdebug.pro rename to tests/auto/corelib/io/qdebug/qdebug.pro diff --git a/tests/auto/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp similarity index 100% rename from tests/auto/qdebug/tst_qdebug.cpp rename to tests/auto/corelib/io/qdebug/tst_qdebug.cpp diff --git a/tests/auto/qdir/.gitignore b/tests/auto/corelib/io/qdir/.gitignore similarity index 100% rename from tests/auto/qdir/.gitignore rename to tests/auto/corelib/io/qdir/.gitignore diff --git a/tests/auto/moc/task71021/dummy b/tests/auto/corelib/io/qdir/entrylist/directory/dummy similarity index 100% rename from tests/auto/moc/task71021/dummy rename to tests/auto/corelib/io/qdir/entrylist/directory/dummy diff --git a/tests/auto/qdir/entrylist/file b/tests/auto/corelib/io/qdir/entrylist/file similarity index 100% rename from tests/auto/qdir/entrylist/file rename to tests/auto/corelib/io/qdir/entrylist/file diff --git a/tests/auto/qdir/qdir.pro b/tests/auto/corelib/io/qdir/qdir.pro similarity index 100% rename from tests/auto/qdir/qdir.pro rename to tests/auto/corelib/io/qdir/qdir.pro diff --git a/tests/auto/qdir/qdir.qrc b/tests/auto/corelib/io/qdir/qdir.qrc similarity index 100% rename from tests/auto/qdir/qdir.qrc rename to tests/auto/corelib/io/qdir/qdir.qrc diff --git a/tests/auto/qdir/resources/entryList/file1.data b/tests/auto/corelib/io/qdir/resources/entryList/file1.data similarity index 100% rename from tests/auto/qdir/resources/entryList/file1.data rename to tests/auto/corelib/io/qdir/resources/entryList/file1.data diff --git a/tests/auto/qdir/resources/entryList/file2.data b/tests/auto/corelib/io/qdir/resources/entryList/file2.data similarity index 100% rename from tests/auto/qdir/resources/entryList/file2.data rename to tests/auto/corelib/io/qdir/resources/entryList/file2.data diff --git a/tests/auto/qdir/resources/entryList/file3.data b/tests/auto/corelib/io/qdir/resources/entryList/file3.data similarity index 100% rename from tests/auto/qdir/resources/entryList/file3.data rename to tests/auto/corelib/io/qdir/resources/entryList/file3.data diff --git a/tests/auto/qdir/resources/entryList/file4.nothing b/tests/auto/corelib/io/qdir/resources/entryList/file4.nothing similarity index 100% rename from tests/auto/qdir/resources/entryList/file4.nothing rename to tests/auto/corelib/io/qdir/resources/entryList/file4.nothing diff --git a/tests/auto/qdir/searchdir/subdir1/picker.png b/tests/auto/corelib/io/qdir/searchdir/subdir1/picker.png similarity index 100% rename from tests/auto/qdir/searchdir/subdir1/picker.png rename to tests/auto/corelib/io/qdir/searchdir/subdir1/picker.png diff --git a/tests/auto/qdir/searchdir/subdir2/picker.png b/tests/auto/corelib/io/qdir/searchdir/subdir2/picker.png similarity index 100% rename from tests/auto/qdir/searchdir/subdir2/picker.png rename to tests/auto/corelib/io/qdir/searchdir/subdir2/picker.png diff --git a/tests/auto/qdir/testData/empty b/tests/auto/corelib/io/qdir/testData/empty similarity index 100% rename from tests/auto/qdir/testData/empty rename to tests/auto/corelib/io/qdir/testData/empty diff --git a/tests/auto/qdir/testdir/dir/qdir.pro b/tests/auto/corelib/io/qdir/testdir/dir/qdir.pro similarity index 100% rename from tests/auto/qdir/testdir/dir/qdir.pro rename to tests/auto/corelib/io/qdir/testdir/dir/qdir.pro diff --git a/tests/auto/qdir/testdir/dir/qrc_qdir.cpp b/tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp similarity index 100% rename from tests/auto/qdir/testdir/dir/qrc_qdir.cpp rename to tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp diff --git a/tests/auto/qdir/testdir/dir/tmp/empty b/tests/auto/corelib/io/qdir/testdir/dir/tmp/empty similarity index 100% rename from tests/auto/qdir/testdir/dir/tmp/empty rename to tests/auto/corelib/io/qdir/testdir/dir/tmp/empty diff --git a/tests/auto/qdir/testdir/dir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp similarity index 100% rename from tests/auto/qdir/testdir/dir/tst_qdir.cpp rename to tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp diff --git a/tests/auto/qdir/testdir/spaces/foo. bar b/tests/auto/corelib/io/qdir/testdir/spaces/foo. bar similarity index 100% rename from tests/auto/qdir/testdir/spaces/foo. bar rename to tests/auto/corelib/io/qdir/testdir/spaces/foo. bar diff --git a/tests/auto/qdir/testdir/spaces/foo.bar b/tests/auto/corelib/io/qdir/testdir/spaces/foo.bar similarity index 100% rename from tests/auto/qdir/testdir/spaces/foo.bar rename to tests/auto/corelib/io/qdir/testdir/spaces/foo.bar diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp similarity index 99% rename from tests/auto/qdir/tst_qdir.cpp rename to tests/auto/corelib/io/qdir/tst_qdir.cpp index fd1ecd5793b..b3179915707 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -48,13 +48,13 @@ #include <qfileinfo.h> #include <qregexp.h> #include <qstringlist.h> -#include "../network-settings.h" +#include "../../../network-settings.h" #if defined(Q_OS_WIN) #define _WIN32_WINNT 0x500 #endif -#include "../../shared/filesystem.h" +#include "../../../../shared/filesystem.h" #if defined(Q_OS_SYMBIAN) # include <f32file.h> diff --git a/tests/auto/qdir/types/a b/tests/auto/corelib/io/qdir/types/a similarity index 100% rename from tests/auto/qdir/types/a rename to tests/auto/corelib/io/qdir/types/a diff --git a/tests/auto/qdir/types/a.a b/tests/auto/corelib/io/qdir/types/a.a similarity index 100% rename from tests/auto/qdir/types/a.a rename to tests/auto/corelib/io/qdir/types/a.a diff --git a/tests/auto/qdir/types/a.b b/tests/auto/corelib/io/qdir/types/a.b similarity index 100% rename from tests/auto/qdir/types/a.b rename to tests/auto/corelib/io/qdir/types/a.b diff --git a/tests/auto/qdir/types/a.c b/tests/auto/corelib/io/qdir/types/a.c similarity index 100% rename from tests/auto/qdir/types/a.c rename to tests/auto/corelib/io/qdir/types/a.c diff --git a/tests/auto/qdir/types/b b/tests/auto/corelib/io/qdir/types/b similarity index 100% rename from tests/auto/qdir/types/b rename to tests/auto/corelib/io/qdir/types/b diff --git a/tests/auto/qdir/types/b.a b/tests/auto/corelib/io/qdir/types/b.a similarity index 100% rename from tests/auto/qdir/types/b.a rename to tests/auto/corelib/io/qdir/types/b.a diff --git a/tests/auto/qdir/types/b.b b/tests/auto/corelib/io/qdir/types/b.b similarity index 100% rename from tests/auto/qdir/types/b.b rename to tests/auto/corelib/io/qdir/types/b.b diff --git a/tests/auto/qdir/types/b.c b/tests/auto/corelib/io/qdir/types/b.c similarity index 100% rename from tests/auto/qdir/types/b.c rename to tests/auto/corelib/io/qdir/types/b.c diff --git a/tests/auto/qdir/types/c b/tests/auto/corelib/io/qdir/types/c similarity index 100% rename from tests/auto/qdir/types/c rename to tests/auto/corelib/io/qdir/types/c diff --git a/tests/auto/qdir/types/c.a b/tests/auto/corelib/io/qdir/types/c.a similarity index 100% rename from tests/auto/qdir/types/c.a rename to tests/auto/corelib/io/qdir/types/c.a diff --git a/tests/auto/qdir/types/c.b b/tests/auto/corelib/io/qdir/types/c.b similarity index 100% rename from tests/auto/qdir/types/c.b rename to tests/auto/corelib/io/qdir/types/c.b diff --git a/tests/auto/qdir/types/c.c b/tests/auto/corelib/io/qdir/types/c.c similarity index 100% rename from tests/auto/qdir/types/c.c rename to tests/auto/corelib/io/qdir/types/c.c diff --git a/tests/auto/qdir/entrylist/directory/dummy b/tests/auto/corelib/io/qdir/types/d.a/dummy similarity index 100% rename from tests/auto/qdir/entrylist/directory/dummy rename to tests/auto/corelib/io/qdir/types/d.a/dummy diff --git a/tests/auto/qdir/types/d.a/dummy b/tests/auto/corelib/io/qdir/types/d.b/dummy similarity index 100% rename from tests/auto/qdir/types/d.a/dummy rename to tests/auto/corelib/io/qdir/types/d.b/dummy diff --git a/tests/auto/qdir/types/d.b/dummy b/tests/auto/corelib/io/qdir/types/d.c/dummy similarity index 100% rename from tests/auto/qdir/types/d.b/dummy rename to tests/auto/corelib/io/qdir/types/d.c/dummy diff --git a/tests/auto/qdir/types/d.c/dummy b/tests/auto/corelib/io/qdir/types/d/dummy similarity index 100% rename from tests/auto/qdir/types/d.c/dummy rename to tests/auto/corelib/io/qdir/types/d/dummy diff --git a/tests/auto/qdir/types/d/dummy b/tests/auto/corelib/io/qdir/types/e.a/dummy similarity index 100% rename from tests/auto/qdir/types/d/dummy rename to tests/auto/corelib/io/qdir/types/e.a/dummy diff --git a/tests/auto/qdir/types/e.a/dummy b/tests/auto/corelib/io/qdir/types/e.b/dummy similarity index 100% rename from tests/auto/qdir/types/e.a/dummy rename to tests/auto/corelib/io/qdir/types/e.b/dummy diff --git a/tests/auto/qdir/types/e.b/dummy b/tests/auto/corelib/io/qdir/types/e.c/dummy similarity index 100% rename from tests/auto/qdir/types/e.b/dummy rename to tests/auto/corelib/io/qdir/types/e.c/dummy diff --git a/tests/auto/qdir/types/e.c/dummy b/tests/auto/corelib/io/qdir/types/e/dummy similarity index 100% rename from tests/auto/qdir/types/e.c/dummy rename to tests/auto/corelib/io/qdir/types/e/dummy diff --git a/tests/auto/qdir/types/e/dummy b/tests/auto/corelib/io/qdir/types/f.a/dummy similarity index 100% rename from tests/auto/qdir/types/e/dummy rename to tests/auto/corelib/io/qdir/types/f.a/dummy diff --git a/tests/auto/qdir/types/f.a/dummy b/tests/auto/corelib/io/qdir/types/f.b/dummy similarity index 100% rename from tests/auto/qdir/types/f.a/dummy rename to tests/auto/corelib/io/qdir/types/f.b/dummy diff --git a/tests/auto/qdir/types/f.b/dummy b/tests/auto/corelib/io/qdir/types/f.c/dummy similarity index 100% rename from tests/auto/qdir/types/f.b/dummy rename to tests/auto/corelib/io/qdir/types/f.c/dummy diff --git a/tests/auto/qdir/types/f.c/dummy b/tests/auto/corelib/io/qdir/types/f/dummy similarity index 100% rename from tests/auto/qdir/types/f.c/dummy rename to tests/auto/corelib/io/qdir/types/f/dummy diff --git a/tests/auto/qdiriterator/.gitignore b/tests/auto/corelib/io/qdiriterator/.gitignore similarity index 100% rename from tests/auto/qdiriterator/.gitignore rename to tests/auto/corelib/io/qdiriterator/.gitignore diff --git a/tests/auto/qdir/types/f/dummy b/tests/auto/corelib/io/qdiriterator/entrylist/directory/dummy similarity index 100% rename from tests/auto/qdir/types/f/dummy rename to tests/auto/corelib/io/qdiriterator/entrylist/directory/dummy diff --git a/tests/auto/qdiriterator/entrylist/file b/tests/auto/corelib/io/qdiriterator/entrylist/file similarity index 100% rename from tests/auto/qdiriterator/entrylist/file rename to tests/auto/corelib/io/qdiriterator/entrylist/file diff --git a/tests/auto/qdiriterator/qdiriterator.pro b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro similarity index 81% rename from tests/auto/qdiriterator/qdiriterator.pro rename to tests/auto/corelib/io/qdiriterator/qdiriterator.pro index 0807a18f8fb..f9f5c8d664b 100644 --- a/tests/auto/qdiriterator/qdiriterator.pro +++ b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro @@ -6,3 +6,4 @@ QT = core wince*mips*|wincewm50smart-msvc200*: DEFINES += WINCE_BROKEN_ITERATE=1 CONFIG += parallel_test +CONFIG += insignificant_test # QTBUG-21160 diff --git a/tests/auto/qdiriterator/qdiriterator.qrc b/tests/auto/corelib/io/qdiriterator/qdiriterator.qrc similarity index 100% rename from tests/auto/qdiriterator/qdiriterator.qrc rename to tests/auto/corelib/io/qdiriterator/qdiriterator.qrc diff --git a/tests/auto/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp similarity index 99% rename from tests/auto/qdiriterator/tst_qdiriterator.cpp rename to tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index 42ac065645d..9014da90332 100644 --- a/tests/auto/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -58,7 +58,7 @@ #endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -#include "../network-settings.h" +# include "../../../network-settings.h" #endif Q_DECLARE_METATYPE(QDirIterator::IteratorFlags) diff --git a/tests/auto/qfile/.gitattributes b/tests/auto/corelib/io/qfile/.gitattributes similarity index 100% rename from tests/auto/qfile/.gitattributes rename to tests/auto/corelib/io/qfile/.gitattributes diff --git a/tests/auto/qfile/.gitignore b/tests/auto/corelib/io/qfile/.gitignore similarity index 100% rename from tests/auto/qfile/.gitignore rename to tests/auto/corelib/io/qfile/.gitignore diff --git a/tests/auto/qfile/copy-fallback.qrc b/tests/auto/corelib/io/qfile/copy-fallback.qrc similarity index 100% rename from tests/auto/qfile/copy-fallback.qrc rename to tests/auto/corelib/io/qfile/copy-fallback.qrc diff --git a/tests/auto/qfile/dosfile.txt b/tests/auto/corelib/io/qfile/dosfile.txt similarity index 100% rename from tests/auto/qfile/dosfile.txt rename to tests/auto/corelib/io/qfile/dosfile.txt diff --git a/tests/auto/qfile/forCopying.txt b/tests/auto/corelib/io/qfile/forCopying.txt similarity index 100% rename from tests/auto/qfile/forCopying.txt rename to tests/auto/corelib/io/qfile/forCopying.txt diff --git a/tests/auto/qfile/forRenaming.txt b/tests/auto/corelib/io/qfile/forRenaming.txt similarity index 100% rename from tests/auto/qfile/forRenaming.txt rename to tests/auto/corelib/io/qfile/forRenaming.txt diff --git a/tests/auto/qfile/largefile/largefile.pro b/tests/auto/corelib/io/qfile/largefile/largefile.pro similarity index 78% rename from tests/auto/qfile/largefile/largefile.pro rename to tests/auto/corelib/io/qfile/largefile/largefile.pro index 6407cb6b3ef..7786bdb8924 100644 --- a/tests/auto/qfile/largefile/largefile.pro +++ b/tests/auto/corelib/io/qfile/largefile/largefile.pro @@ -6,3 +6,4 @@ SOURCES += tst_largefile.cpp wince*: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp CONFIG += parallel_test +CONFIG += insignificant_test # QTBUG-21175 diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp similarity index 100% rename from tests/auto/qfile/largefile/tst_largefile.cpp rename to tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp diff --git a/tests/auto/qfile/noendofline.txt b/tests/auto/corelib/io/qfile/noendofline.txt similarity index 100% rename from tests/auto/qfile/noendofline.txt rename to tests/auto/corelib/io/qfile/noendofline.txt diff --git a/tests/auto/qfile/qfile.pro b/tests/auto/corelib/io/qfile/qfile.pro similarity index 100% rename from tests/auto/qfile/qfile.pro rename to tests/auto/corelib/io/qfile/qfile.pro diff --git a/tests/auto/qfile/qfile.qrc b/tests/auto/corelib/io/qfile/qfile.qrc similarity index 100% rename from tests/auto/qfile/qfile.qrc rename to tests/auto/corelib/io/qfile/qfile.qrc diff --git a/tests/auto/qfile/rename-fallback.qrc b/tests/auto/corelib/io/qfile/rename-fallback.qrc similarity index 100% rename from tests/auto/qfile/rename-fallback.qrc rename to tests/auto/corelib/io/qfile/rename-fallback.qrc diff --git a/tests/auto/qfile/resources/file1.ext1 b/tests/auto/corelib/io/qfile/resources/file1.ext1 similarity index 100% rename from tests/auto/qfile/resources/file1.ext1 rename to tests/auto/corelib/io/qfile/resources/file1.ext1 diff --git a/tests/auto/qfile/stdinprocess/main.cpp b/tests/auto/corelib/io/qfile/stdinprocess/main.cpp similarity index 100% rename from tests/auto/qfile/stdinprocess/main.cpp rename to tests/auto/corelib/io/qfile/stdinprocess/main.cpp diff --git a/tests/auto/qfile/stdinprocess/stdinprocess.pro b/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro similarity index 100% rename from tests/auto/qfile/stdinprocess/stdinprocess.pro rename to tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro similarity index 96% rename from tests/auto/qfile/test/test.pro rename to tests/auto/corelib/io/qfile/test/test.pro index f4ec12f8740..4117d3f6900 100644 --- a/tests/auto/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -42,3 +42,4 @@ symbian { } mac*:CONFIG+=insignificant_test +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qfile/testfile.txt b/tests/auto/corelib/io/qfile/testfile.txt similarity index 100% rename from tests/auto/qfile/testfile.txt rename to tests/auto/corelib/io/qfile/testfile.txt diff --git a/tests/auto/qfile/testlog.txt b/tests/auto/corelib/io/qfile/testlog.txt similarity index 100% rename from tests/auto/qfile/testlog.txt rename to tests/auto/corelib/io/qfile/testlog.txt diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp similarity index 99% rename from tests/auto/qfile/tst_qfile.cpp rename to tests/auto/corelib/io/qfile/tst_qfile.cpp index aafe79484e6..f2031497ed4 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -76,7 +76,7 @@ #include <stdio.h> #include <errno.h> -#include "../network-settings.h" +#include "../../../network-settings.h" #if defined(Q_OS_SYMBIAN) # define SRCDIR "" diff --git a/tests/auto/qfile/two.dots.file b/tests/auto/corelib/io/qfile/two.dots.file similarity index 100% rename from tests/auto/qfile/two.dots.file rename to tests/auto/corelib/io/qfile/two.dots.file diff --git a/tests/auto/qfileinfo/.gitignore b/tests/auto/corelib/io/qfileinfo/.gitignore similarity index 100% rename from tests/auto/qfileinfo/.gitignore rename to tests/auto/corelib/io/qfileinfo/.gitignore diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro similarity index 100% rename from tests/auto/qfileinfo/qfileinfo.pro rename to tests/auto/corelib/io/qfileinfo/qfileinfo.pro diff --git a/tests/auto/qfileinfo/qfileinfo.qrc b/tests/auto/corelib/io/qfileinfo/qfileinfo.qrc similarity index 100% rename from tests/auto/qfileinfo/qfileinfo.qrc rename to tests/auto/corelib/io/qfileinfo/qfileinfo.qrc diff --git a/tests/auto/qfileinfo/resources/file1 b/tests/auto/corelib/io/qfileinfo/resources/file1 similarity index 100% rename from tests/auto/qfileinfo/resources/file1 rename to tests/auto/corelib/io/qfileinfo/resources/file1 diff --git a/tests/auto/qfileinfo/resources/file1.ext1 b/tests/auto/corelib/io/qfileinfo/resources/file1.ext1 similarity index 100% rename from tests/auto/qfileinfo/resources/file1.ext1 rename to tests/auto/corelib/io/qfileinfo/resources/file1.ext1 diff --git a/tests/auto/qfileinfo/resources/file1.ext1.ext2 b/tests/auto/corelib/io/qfileinfo/resources/file1.ext1.ext2 similarity index 100% rename from tests/auto/qfileinfo/resources/file1.ext1.ext2 rename to tests/auto/corelib/io/qfileinfo/resources/file1.ext1.ext2 diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp similarity index 99% rename from tests/auto/qfileinfo/tst_qfileinfo.cpp rename to tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 878493b8e32..1eb59ac96ad 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -68,9 +68,9 @@ #include <f32file.h> #include <private/qcore_symbian_p.h> #endif -#include "../network-settings.h" +#include "../../../network-settings.h" #include <private/qfileinfo_p.h> -#include "../../shared/filesystem.h" +#include "../../../../shared/filesystem.h" #if defined(Q_OS_SYMBIAN) # define SRCDIR "" @@ -1396,7 +1396,7 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data() wchar_t errstr[0x100]; DWORD count = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, errstr, 0x100, 0); - QString error(QString::fromWCharArray (errstr, count)); + QString error(QString::fromWCharArray(errstr, count)); qWarning() << error; //we need at least one data set for the test not to assert fail when skipping _data function QDir target("target"); diff --git a/tests/auto/qfilesystementry/qfilesystementry.pro b/tests/auto/corelib/io/qfilesystementry/qfilesystementry.pro similarity index 50% rename from tests/auto/qfilesystementry/qfilesystementry.pro rename to tests/auto/corelib/io/qfilesystementry/qfilesystementry.pro index 31f0064bd1d..992c90cfcc8 100644 --- a/tests/auto/qfilesystementry/qfilesystementry.pro +++ b/tests/auto/corelib/io/qfilesystementry/qfilesystementry.pro @@ -1,8 +1,8 @@ load(qttest_p4) SOURCES += tst_qfilesystementry.cpp \ - ../../../src/corelib/io/qfilesystementry.cpp -HEADERS += ../../../src/corelib/io/qfilesystementry_p.h + $${QT.core.sources}/io/qfilesystementry.cpp +HEADERS += $${QT.core.sources}/io/qfilesystementry_p.h QT = core core-private CONFIG += parallel_test diff --git a/tests/auto/qfilesystementry/tst_qfilesystementry.cpp b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp similarity index 100% rename from tests/auto/qfilesystementry/tst_qfilesystementry.cpp rename to tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp diff --git a/tests/auto/qfilesystemwatcher/.gitignore b/tests/auto/corelib/io/qfilesystemwatcher/.gitignore similarity index 100% rename from tests/auto/qfilesystemwatcher/.gitignore rename to tests/auto/corelib/io/qfilesystemwatcher/.gitignore diff --git a/tests/auto/qfilesystemwatcher/qfilesystemwatcher.pro b/tests/auto/corelib/io/qfilesystemwatcher/qfilesystemwatcher.pro similarity index 100% rename from tests/auto/qfilesystemwatcher/qfilesystemwatcher.pro rename to tests/auto/corelib/io/qfilesystemwatcher/qfilesystemwatcher.pro diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp similarity index 100% rename from tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp rename to tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp diff --git a/tests/auto/qiodevice/.gitignore b/tests/auto/corelib/io/qiodevice/.gitignore similarity index 100% rename from tests/auto/qiodevice/.gitignore rename to tests/auto/corelib/io/qiodevice/.gitignore diff --git a/tests/auto/qiodevice/qiodevice.pro b/tests/auto/corelib/io/qiodevice/qiodevice.pro similarity index 100% rename from tests/auto/qiodevice/qiodevice.pro rename to tests/auto/corelib/io/qiodevice/qiodevice.pro diff --git a/tests/auto/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp similarity index 99% rename from tests/auto/qiodevice/tst_qiodevice.cpp rename to tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index a0f57f9d8dd..425b3b6bd12 100644 --- a/tests/auto/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -44,7 +44,7 @@ #include <QtNetwork/QtNetwork> #include <QtTest/QtTest> -#include "../network-settings.h" +#include "../../../network-settings.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qprocess/.gitignore b/tests/auto/corelib/io/qprocess/.gitignore similarity index 100% rename from tests/auto/qprocess/.gitignore rename to tests/auto/corelib/io/qprocess/.gitignore diff --git a/tests/auto/qprocess/fileWriterProcess/fileWriterProcess.pro b/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro similarity index 100% rename from tests/auto/qprocess/fileWriterProcess/fileWriterProcess.pro rename to tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro diff --git a/tests/auto/qprocess/fileWriterProcess/main.cpp b/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp similarity index 100% rename from tests/auto/qprocess/fileWriterProcess/main.cpp rename to tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp diff --git a/tests/auto/qprocess/qprocess.pro b/tests/auto/corelib/io/qprocess/qprocess.pro similarity index 100% rename from tests/auto/qprocess/qprocess.pro rename to tests/auto/corelib/io/qprocess/qprocess.pro diff --git a/tests/auto/qprocess/test/test.pro b/tests/auto/corelib/io/qprocess/test/test.pro similarity index 100% rename from tests/auto/qprocess/test/test.pro rename to tests/auto/corelib/io/qprocess/test/test.pro diff --git a/tests/auto/qprocess/testBatFiles/simple.bat b/tests/auto/corelib/io/qprocess/testBatFiles/simple.bat similarity index 100% rename from tests/auto/qprocess/testBatFiles/simple.bat rename to tests/auto/corelib/io/qprocess/testBatFiles/simple.bat diff --git a/tests/auto/qprocess/testBatFiles/with space.bat b/tests/auto/corelib/io/qprocess/testBatFiles/with space.bat similarity index 100% rename from tests/auto/qprocess/testBatFiles/with space.bat rename to tests/auto/corelib/io/qprocess/testBatFiles/with space.bat diff --git a/tests/auto/qprocess/testDetached/main.cpp b/tests/auto/corelib/io/qprocess/testDetached/main.cpp similarity index 100% rename from tests/auto/qprocess/testDetached/main.cpp rename to tests/auto/corelib/io/qprocess/testDetached/main.cpp diff --git a/tests/auto/qprocess/testDetached/testDetached.pro b/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro similarity index 100% rename from tests/auto/qprocess/testDetached/testDetached.pro rename to tests/auto/corelib/io/qprocess/testDetached/testDetached.pro diff --git a/tests/auto/qprocess/testExitCodes/main.cpp b/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp similarity index 100% rename from tests/auto/qprocess/testExitCodes/main.cpp rename to tests/auto/corelib/io/qprocess/testExitCodes/main.cpp diff --git a/tests/auto/qprocess/testExitCodes/testExitCodes.pro b/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro similarity index 100% rename from tests/auto/qprocess/testExitCodes/testExitCodes.pro rename to tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro diff --git a/tests/auto/qprocess/testGuiProcess/main.cpp b/tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp similarity index 96% rename from tests/auto/qprocess/testGuiProcess/main.cpp rename to tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp index 2c8f5f0e557..90d4d4a962b 100644 --- a/tests/auto/qprocess/testGuiProcess/main.cpp +++ b/tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp @@ -38,7 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <QtGui> +#include <QtWidgets/QApplication> +#include <QtWidgets/QLabel> #include <stdio.h> int main(int argc, char **argv) diff --git a/tests/auto/qprocess/testGuiProcess/testGuiProcess.pro b/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro similarity index 78% rename from tests/auto/qprocess/testGuiProcess/testGuiProcess.pro rename to tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro index 15a9e8e4e47..b26a583deef 100644 --- a/tests/auto/qprocess/testGuiProcess/testGuiProcess.pro +++ b/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro @@ -1,4 +1,5 @@ SOURCES += main.cpp +QT += widgets CONFIG += console DESTDIR = ./ diff --git a/tests/auto/qprocess/testProcessCrash/main.cpp b/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessCrash/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp diff --git a/tests/auto/qprocess/testProcessCrash/testProcessCrash.pro b/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro similarity index 100% rename from tests/auto/qprocess/testProcessCrash/testProcessCrash.pro rename to tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro diff --git a/tests/auto/qprocess/testProcessDeadWhileReading/main.cpp b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessDeadWhileReading/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp diff --git a/tests/auto/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro similarity index 100% rename from tests/auto/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro rename to tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro diff --git a/tests/auto/qprocess/testProcessEOF/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessEOF/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp diff --git a/tests/auto/qprocess/testProcessEOF/testProcessEOF.pro b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro similarity index 100% rename from tests/auto/qprocess/testProcessEOF/testProcessEOF.pro rename to tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro diff --git a/tests/auto/qprocess/testProcessEcho/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessEcho/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp diff --git a/tests/auto/qprocess/testProcessEcho/testProcessEcho.pro b/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro similarity index 100% rename from tests/auto/qprocess/testProcessEcho/testProcessEcho.pro rename to tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro diff --git a/tests/auto/qprocess/testProcessEcho2/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessEcho2/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp diff --git a/tests/auto/qprocess/testProcessEcho2/testProcessEcho2.pro b/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro similarity index 100% rename from tests/auto/qprocess/testProcessEcho2/testProcessEcho2.pro rename to tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro diff --git a/tests/auto/qprocess/testProcessEcho3/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessEcho3/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp diff --git a/tests/auto/qprocess/testProcessEcho3/testProcessEcho3.pro b/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro similarity index 100% rename from tests/auto/qprocess/testProcessEcho3/testProcessEcho3.pro rename to tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro diff --git a/tests/auto/qprocess/testProcessEchoGui/main_win.cpp b/tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp similarity index 100% rename from tests/auto/qprocess/testProcessEchoGui/main_win.cpp rename to tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp diff --git a/tests/auto/qprocess/testProcessEchoGui/testProcessEchoGui.pro b/tests/auto/corelib/io/qprocess/testProcessEchoGui/testProcessEchoGui.pro similarity index 100% rename from tests/auto/qprocess/testProcessEchoGui/testProcessEchoGui.pro rename to tests/auto/corelib/io/qprocess/testProcessEchoGui/testProcessEchoGui.pro diff --git a/tests/auto/qprocess/testProcessEnvironment/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessEnvironment/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp diff --git a/tests/auto/qprocess/testProcessEnvironment/testProcessEnvironment.pro b/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro similarity index 100% rename from tests/auto/qprocess/testProcessEnvironment/testProcessEnvironment.pro rename to tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro diff --git a/tests/auto/qprocess/testProcessLoopback/main.cpp b/tests/auto/corelib/io/qprocess/testProcessLoopback/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessLoopback/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessLoopback/main.cpp diff --git a/tests/auto/qprocess/testProcessLoopback/testProcessLoopback.pro b/tests/auto/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro similarity index 100% rename from tests/auto/qprocess/testProcessLoopback/testProcessLoopback.pro rename to tests/auto/corelib/io/qprocess/testProcessLoopback/testProcessLoopback.pro diff --git a/tests/auto/qprocess/testProcessNormal/main.cpp b/tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessNormal/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp diff --git a/tests/auto/qprocess/testProcessNormal/testProcessNormal.pro b/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro similarity index 100% rename from tests/auto/qprocess/testProcessNormal/testProcessNormal.pro rename to tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro diff --git a/tests/auto/qprocess/testProcessOutput/main.cpp b/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessOutput/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp diff --git a/tests/auto/qprocess/testProcessOutput/testProcessOutput.pro b/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro similarity index 100% rename from tests/auto/qprocess/testProcessOutput/testProcessOutput.pro rename to tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro diff --git a/tests/auto/qprocess/testProcessSpacesArgs/main.cpp b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp similarity index 100% rename from tests/auto/qprocess/testProcessSpacesArgs/main.cpp rename to tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp diff --git a/tests/auto/qprocess/testProcessSpacesArgs/nospace.pro b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro similarity index 100% rename from tests/auto/qprocess/testProcessSpacesArgs/nospace.pro rename to tests/auto/corelib/io/qprocess/testProcessSpacesArgs/nospace.pro diff --git a/tests/auto/qprocess/testProcessSpacesArgs/onespace.pro b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro similarity index 100% rename from tests/auto/qprocess/testProcessSpacesArgs/onespace.pro rename to tests/auto/corelib/io/qprocess/testProcessSpacesArgs/onespace.pro diff --git a/tests/auto/qprocess/testProcessSpacesArgs/twospaces.pro b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro similarity index 100% rename from tests/auto/qprocess/testProcessSpacesArgs/twospaces.pro rename to tests/auto/corelib/io/qprocess/testProcessSpacesArgs/twospaces.pro diff --git a/tests/auto/qprocess/testSetWorkingDirectory/main.cpp b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp similarity index 100% rename from tests/auto/qprocess/testSetWorkingDirectory/main.cpp rename to tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp diff --git a/tests/auto/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro similarity index 100% rename from tests/auto/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro rename to tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro diff --git a/tests/auto/qprocess/testSoftExit/main_unix.cpp b/tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp similarity index 100% rename from tests/auto/qprocess/testSoftExit/main_unix.cpp rename to tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp diff --git a/tests/auto/qprocess/testSoftExit/main_win.cpp b/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp similarity index 98% rename from tests/auto/qprocess/testSoftExit/main_win.cpp rename to tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp index 29dbc46bcf9..7bdf796926a 100644 --- a/tests/auto/qprocess/testSoftExit/main_win.cpp +++ b/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp @@ -54,5 +54,5 @@ int main() PostQuitMessage(0); } - return msg.wParam; + return int(msg.wParam); } diff --git a/tests/auto/qprocess/testSoftExit/testSoftExit.pro b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro similarity index 100% rename from tests/auto/qprocess/testSoftExit/testSoftExit.pro rename to tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro diff --git a/tests/auto/qprocess/testSpaceInName/main.cpp b/tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp similarity index 100% rename from tests/auto/qprocess/testSpaceInName/main.cpp rename to tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp diff --git a/tests/auto/qprocess/testSpaceInName/testSpaceInName.pro b/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro similarity index 100% rename from tests/auto/qprocess/testSpaceInName/testSpaceInName.pro rename to tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp similarity index 100% rename from tests/auto/qprocess/tst_qprocess.cpp rename to tests/auto/corelib/io/qprocess/tst_qprocess.cpp diff --git a/tests/auto/qprocessenvironment/qprocessenvironment.pro b/tests/auto/corelib/io/qprocessenvironment/qprocessenvironment.pro similarity index 100% rename from tests/auto/qprocessenvironment/qprocessenvironment.pro rename to tests/auto/corelib/io/qprocessenvironment/qprocessenvironment.pro diff --git a/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp similarity index 100% rename from tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp rename to tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp diff --git a/tests/auto/qresourceengine/.gitattributes b/tests/auto/corelib/io/qresourceengine/.gitattributes similarity index 100% rename from tests/auto/qresourceengine/.gitattributes rename to tests/auto/corelib/io/qresourceengine/.gitattributes diff --git a/tests/auto/qresourceengine/.gitignore b/tests/auto/corelib/io/qresourceengine/.gitignore similarity index 100% rename from tests/auto/qresourceengine/.gitignore rename to tests/auto/corelib/io/qresourceengine/.gitignore diff --git a/tests/auto/qresourceengine/parentdir.txt b/tests/auto/corelib/io/qresourceengine/parentdir.txt similarity index 100% rename from tests/auto/qresourceengine/parentdir.txt rename to tests/auto/corelib/io/qresourceengine/parentdir.txt diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro similarity index 97% rename from tests/auto/qresourceengine/qresourceengine.pro rename to tests/auto/corelib/io/qresourceengine/qresourceengine.pro index 9ca6994716f..abbf39bd838 100644 --- a/tests/auto/qresourceengine/qresourceengine.pro +++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro @@ -44,3 +44,4 @@ wince*|symbian:{ DEFINES += SRCDIR=\\\"$$PWD/\\\" } CONFIG += parallel_test +CONFIG += insignificant_test # QTBUG-21159 diff --git a/tests/auto/qresourceengine/testqrc/aliasdir/aliasdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/aliasdir.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/aliasdir/aliasdir.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/aliasdir.txt diff --git a/tests/auto/qresourceengine/testqrc/aliasdir/compressme.txt b/tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/compressme.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/aliasdir/compressme.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/aliasdir/compressme.txt diff --git a/tests/auto/qresourceengine/testqrc/blahblah.txt b/tests/auto/corelib/io/qresourceengine/testqrc/blahblah.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/blahblah.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/blahblah.txt diff --git a/tests/auto/qresourceengine/testqrc/currentdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/currentdir.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/currentdir.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/currentdir.txt diff --git a/tests/auto/qresourceengine/testqrc/currentdir2.txt b/tests/auto/corelib/io/qresourceengine/testqrc/currentdir2.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/currentdir2.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/currentdir2.txt diff --git a/tests/auto/qresourceengine/testqrc/otherdir/otherdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/otherdir/otherdir.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/otherdir/otherdir.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/otherdir/otherdir.txt diff --git a/tests/auto/qresourceengine/testqrc/search_file.txt b/tests/auto/corelib/io/qresourceengine/testqrc/search_file.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/search_file.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/search_file.txt diff --git a/tests/auto/qresourceengine/testqrc/searchpath1/search_file.txt b/tests/auto/corelib/io/qresourceengine/testqrc/searchpath1/search_file.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/searchpath1/search_file.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/searchpath1/search_file.txt diff --git a/tests/auto/qresourceengine/testqrc/searchpath2/search_file.txt b/tests/auto/corelib/io/qresourceengine/testqrc/searchpath2/search_file.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/searchpath2/search_file.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/searchpath2/search_file.txt diff --git a/tests/auto/qresourceengine/testqrc/subdir/subdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/subdir/subdir.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/subdir/subdir.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/subdir/subdir.txt diff --git a/tests/auto/qresourceengine/testqrc/test.qrc b/tests/auto/corelib/io/qresourceengine/testqrc/test.qrc similarity index 100% rename from tests/auto/qresourceengine/testqrc/test.qrc rename to tests/auto/corelib/io/qresourceengine/testqrc/test.qrc diff --git a/tests/auto/qresourceengine/testqrc/test/german.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/german.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/test/german.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/test/german.txt diff --git a/tests/auto/qresourceengine/testqrc/test/test/test1.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test1.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/test/test/test1.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/test/test/test1.txt diff --git a/tests/auto/qresourceengine/testqrc/test/test/test2.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/test/test2.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/test/test/test2.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/test/test/test2.txt diff --git a/tests/auto/qresourceengine/testqrc/test/testdir.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/test/testdir.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/test/testdir.txt diff --git a/tests/auto/qresourceengine/testqrc/test/testdir2.txt b/tests/auto/corelib/io/qresourceengine/testqrc/test/testdir2.txt similarity index 100% rename from tests/auto/qresourceengine/testqrc/test/testdir2.txt rename to tests/auto/corelib/io/qresourceengine/testqrc/test/testdir2.txt diff --git a/tests/auto/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp similarity index 100% rename from tests/auto/qresourceengine/tst_qresourceengine.cpp rename to tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp diff --git a/tests/auto/qsettings/.gitattributes b/tests/auto/corelib/io/qsettings/.gitattributes similarity index 100% rename from tests/auto/qsettings/.gitattributes rename to tests/auto/corelib/io/qsettings/.gitattributes diff --git a/tests/auto/qsettings/.gitignore b/tests/auto/corelib/io/qsettings/.gitignore similarity index 100% rename from tests/auto/qsettings/.gitignore rename to tests/auto/corelib/io/qsettings/.gitignore diff --git a/tests/auto/qsettings/qsettings.pro b/tests/auto/corelib/io/qsettings/qsettings.pro similarity index 100% rename from tests/auto/qsettings/qsettings.pro rename to tests/auto/corelib/io/qsettings/qsettings.pro diff --git a/tests/auto/qsettings/qsettings.qrc b/tests/auto/corelib/io/qsettings/qsettings.qrc similarity index 100% rename from tests/auto/qsettings/qsettings.qrc rename to tests/auto/corelib/io/qsettings/qsettings.qrc diff --git a/tests/auto/qsettings/resourcefile.ini b/tests/auto/corelib/io/qsettings/resourcefile.ini similarity index 100% rename from tests/auto/qsettings/resourcefile.ini rename to tests/auto/corelib/io/qsettings/resourcefile.ini diff --git a/tests/auto/qsettings/resourcefile2.ini b/tests/auto/corelib/io/qsettings/resourcefile2.ini similarity index 100% rename from tests/auto/qsettings/resourcefile2.ini rename to tests/auto/corelib/io/qsettings/resourcefile2.ini diff --git a/tests/auto/qsettings/resourcefile3.ini b/tests/auto/corelib/io/qsettings/resourcefile3.ini similarity index 100% rename from tests/auto/qsettings/resourcefile3.ini rename to tests/auto/corelib/io/qsettings/resourcefile3.ini diff --git a/tests/auto/qsettings/resourcefile4.ini b/tests/auto/corelib/io/qsettings/resourcefile4.ini similarity index 100% rename from tests/auto/qsettings/resourcefile4.ini rename to tests/auto/corelib/io/qsettings/resourcefile4.ini diff --git a/tests/auto/qsettings/resourcefile5.ini b/tests/auto/corelib/io/qsettings/resourcefile5.ini similarity index 100% rename from tests/auto/qsettings/resourcefile5.ini rename to tests/auto/corelib/io/qsettings/resourcefile5.ini diff --git a/tests/auto/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp similarity index 99% rename from tests/auto/qsettings/tst_qsettings.cpp rename to tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 1887aff846c..7436edcd8c3 100644 --- a/tests/auto/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -51,7 +51,7 @@ #include <QtCore/QMetaType> #include <QtCore/QtDebug> #include <QtCore/QString> -#include "../../shared/util.h" +#include "../../../../shared/util.h" #if !defined(Q_OS_SYMBIAN) # include <cctype> diff --git a/tests/auto/qtemporaryfile/.gitignore b/tests/auto/corelib/io/qtemporaryfile/.gitignore similarity index 100% rename from tests/auto/qtemporaryfile/.gitignore rename to tests/auto/corelib/io/qtemporaryfile/.gitignore diff --git a/tests/auto/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro similarity index 100% rename from tests/auto/qtemporaryfile/qtemporaryfile.pro rename to tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp similarity index 100% rename from tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp rename to tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp diff --git a/tests/auto/qtextstream/.gitattributes b/tests/auto/corelib/io/qtextstream/.gitattributes similarity index 100% rename from tests/auto/qtextstream/.gitattributes rename to tests/auto/corelib/io/qtextstream/.gitattributes diff --git a/tests/auto/qtextstream/.gitignore b/tests/auto/corelib/io/qtextstream/.gitignore similarity index 100% rename from tests/auto/qtextstream/.gitignore rename to tests/auto/corelib/io/qtextstream/.gitignore diff --git a/tests/auto/qtextstream/qtextstream.pro b/tests/auto/corelib/io/qtextstream/qtextstream.pro similarity index 100% rename from tests/auto/qtextstream/qtextstream.pro rename to tests/auto/corelib/io/qtextstream/qtextstream.pro diff --git a/tests/auto/qtextstream/qtextstream.qrc b/tests/auto/corelib/io/qtextstream/qtextstream.qrc similarity index 100% rename from tests/auto/qtextstream/qtextstream.qrc rename to tests/auto/corelib/io/qtextstream/qtextstream.qrc diff --git a/tests/auto/qtextstream/readAllStdinProcess/main.cpp b/tests/auto/corelib/io/qtextstream/readAllStdinProcess/main.cpp similarity index 100% rename from tests/auto/qtextstream/readAllStdinProcess/main.cpp rename to tests/auto/corelib/io/qtextstream/readAllStdinProcess/main.cpp diff --git a/tests/auto/qtextstream/readAllStdinProcess/readAllStdinProcess.pro b/tests/auto/corelib/io/qtextstream/readAllStdinProcess/readAllStdinProcess.pro similarity index 100% rename from tests/auto/qtextstream/readAllStdinProcess/readAllStdinProcess.pro rename to tests/auto/corelib/io/qtextstream/readAllStdinProcess/readAllStdinProcess.pro diff --git a/tests/auto/qtextstream/readLineStdinProcess/main.cpp b/tests/auto/corelib/io/qtextstream/readLineStdinProcess/main.cpp similarity index 100% rename from tests/auto/qtextstream/readLineStdinProcess/main.cpp rename to tests/auto/corelib/io/qtextstream/readLineStdinProcess/main.cpp diff --git a/tests/auto/qtextstream/readLineStdinProcess/readLineStdinProcess.pro b/tests/auto/corelib/io/qtextstream/readLineStdinProcess/readLineStdinProcess.pro similarity index 100% rename from tests/auto/qtextstream/readLineStdinProcess/readLineStdinProcess.pro rename to tests/auto/corelib/io/qtextstream/readLineStdinProcess/readLineStdinProcess.pro diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QByteArray_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QChar_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_QString_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_char_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Latin1_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Locale_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_RawUnicode_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeNetworkOrder_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeReverse_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_UnicodeUTF8_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_double_resource_Unicode_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_float_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Latin1_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Locale_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_RawUnicode_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeNetworkOrder_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeReverse_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_UnicodeUTF8_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_int_resource_Unicode_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Latin1_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Locale_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_RawUnicode_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeNetworkOrder_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeReverse_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_UnicodeUTF8_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_long_resource_Unicode_8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_short_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_uint_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ulong_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shift_ushort_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource0.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource0.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource0.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource0.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource1.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource1.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource1.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource1.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource10.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource10.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource10.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource10.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource11.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource11.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource11.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource11.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource12.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource12.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource12.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource12.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource2.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource2.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource2.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource2.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource20.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource20.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource20.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource20.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource21.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource21.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource21.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource21.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource3.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource3.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource3.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource3.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource4.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource4.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource4.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource4.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource5.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource5.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource5.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource5.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource6.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource6.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource6.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource6.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource7.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource7.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource7.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource7.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource8.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource8.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource8.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource8.data diff --git a/tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource9.data b/tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource9.data similarity index 100% rename from tests/auto/qtextstream/resources/big_endian/operator_shiftright_resource9.data rename to tests/auto/corelib/io/qtextstream/resources/big_endian/operator_shiftright_resource9.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QByteArray_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QChar_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_QString_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_char_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Latin1_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Locale_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_RawUnicode_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeNetworkOrder_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeReverse_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_UnicodeUTF8_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_double_resource_Unicode_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_float_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Latin1_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Locale_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_RawUnicode_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeNetworkOrder_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeReverse_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_UnicodeUTF8_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_int_resource_Unicode_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Latin1_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Locale_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_RawUnicode_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeNetworkOrder_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeReverse_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_UnicodeUTF8_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_long_resource_Unicode_8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_short_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_uint_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ulong_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Latin1_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Locale_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_RawUnicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeNetworkOrder_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeReverse_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_UnicodeUTF8_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shift_ushort_resource_Unicode_4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource0.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource0.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource0.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource0.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource1.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource1.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource1.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource1.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource10.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource10.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource10.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource10.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource11.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource11.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource11.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource11.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource12.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource12.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource12.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource12.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource2.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource2.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource2.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource2.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource20.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource20.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource20.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource20.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource21.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource21.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource21.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource21.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource3.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource3.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource3.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource3.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource4.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource4.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource4.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource4.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource5.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource5.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource5.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource5.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource6.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource6.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource6.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource6.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource7.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource7.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource7.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource7.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource8.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource8.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource8.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource8.data diff --git a/tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource9.data b/tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource9.data similarity index 100% rename from tests/auto/qtextstream/resources/little_endian/operator_shiftright_resource9.data rename to tests/auto/corelib/io/qtextstream/resources/little_endian/operator_shiftright_resource9.data diff --git a/tests/auto/qtextstream/rfc3261.txt b/tests/auto/corelib/io/qtextstream/rfc3261.txt similarity index 100% rename from tests/auto/qtextstream/rfc3261.txt rename to tests/auto/corelib/io/qtextstream/rfc3261.txt diff --git a/tests/auto/qtextstream/shift-jis.txt b/tests/auto/corelib/io/qtextstream/shift-jis.txt similarity index 100% rename from tests/auto/qtextstream/shift-jis.txt rename to tests/auto/corelib/io/qtextstream/shift-jis.txt diff --git a/tests/auto/qtextstream/stdinProcess/main.cpp b/tests/auto/corelib/io/qtextstream/stdinProcess/main.cpp similarity index 100% rename from tests/auto/qtextstream/stdinProcess/main.cpp rename to tests/auto/corelib/io/qtextstream/stdinProcess/main.cpp diff --git a/tests/auto/qtextstream/stdinProcess/stdinProcess.pro b/tests/auto/corelib/io/qtextstream/stdinProcess/stdinProcess.pro similarity index 100% rename from tests/auto/qtextstream/stdinProcess/stdinProcess.pro rename to tests/auto/corelib/io/qtextstream/stdinProcess/stdinProcess.pro diff --git a/tests/auto/qtextstream/task113817.txt b/tests/auto/corelib/io/qtextstream/task113817.txt similarity index 100% rename from tests/auto/qtextstream/task113817.txt rename to tests/auto/corelib/io/qtextstream/task113817.txt diff --git a/tests/auto/qtextstream/test/test.pro b/tests/auto/corelib/io/qtextstream/test/test.pro similarity index 100% rename from tests/auto/qtextstream/test/test.pro rename to tests/auto/corelib/io/qtextstream/test/test.pro diff --git a/tests/auto/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp similarity index 99% rename from tests/auto/qtextstream/tst_qtextstream.cpp rename to tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index ae7fa0b5ddb..848f813d1e5 100644 --- a/tests/auto/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -60,7 +60,7 @@ #include <QTextCodec> #include <QProcess> -#include "../network-settings.h" +#include "../../../network-settings.h" static const char *TestFileName = "testfile"; diff --git a/tests/auto/qurl/.gitignore b/tests/auto/corelib/io/qurl/.gitignore similarity index 100% rename from tests/auto/qurl/.gitignore rename to tests/auto/corelib/io/qurl/.gitignore diff --git a/tests/auto/qurl/idna-test.c b/tests/auto/corelib/io/qurl/idna-test.c similarity index 100% rename from tests/auto/qurl/idna-test.c rename to tests/auto/corelib/io/qurl/idna-test.c diff --git a/tests/auto/qurl/qurl.pro b/tests/auto/corelib/io/qurl/qurl.pro similarity index 100% rename from tests/auto/qurl/qurl.pro rename to tests/auto/corelib/io/qurl/qurl.pro diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp similarity index 100% rename from tests/auto/qurl/tst_qurl.cpp rename to tests/auto/corelib/io/qurl/tst_qurl.cpp diff --git a/tests/auto/corelib/kernel/kernel.pro b/tests/auto/corelib/kernel/kernel.pro new file mode 100644 index 00000000000..9fb8868391b --- /dev/null +++ b/tests/auto/corelib/kernel/kernel.pro @@ -0,0 +1,22 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qabstractitemmodel \ + qcoreapplication \ + qeventloop \ + qitemmodel \ + qmath \ + qmetaobject \ + qmetatype \ + qmimedata \ + qobject \ + qpointer \ + qsignalmapper \ + qsocketnotifier \ + qtimer \ + # qtipc \ # needs to be moved to qtscript + qtranslator \ + qvariant \ + qwineventnotifier + +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qsocketnotifier diff --git a/tests/auto/qabstractitemmodel/.gitignore b/tests/auto/corelib/kernel/qabstractitemmodel/.gitignore similarity index 100% rename from tests/auto/qabstractitemmodel/.gitignore rename to tests/auto/corelib/kernel/qabstractitemmodel/.gitignore diff --git a/tests/auto/corelib/kernel/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/corelib/kernel/qabstractitemmodel/qabstractitemmodel.pro new file mode 100644 index 00000000000..50730b371f1 --- /dev/null +++ b/tests/auto/corelib/kernel/qabstractitemmodel/qabstractitemmodel.pro @@ -0,0 +1,9 @@ +load(qttest_p4) + +INCLUDEPATH += $$PWD/../../../modeltest +QT += widgets +SOURCES += tst_qabstractitemmodel.cpp ../../../modeltest/dynamictreemodel.cpp ../../../modeltest/modeltest.cpp +HEADERS += ../../../modeltest/dynamictreemodel.h ../../../modeltest/modeltest.h + + + diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/kernel/qabstractitemmodel/tst_qabstractitemmodel.cpp similarity index 99% rename from tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp rename to tests/auto/corelib/kernel/qabstractitemmodel/tst_qabstractitemmodel.cpp index cf4cfd76ece..6a7a16eae8e 100644 --- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/kernel/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -43,7 +43,7 @@ #include <QtTest/QtTest> #include <QtCore/QtCore> -#include <QtGui/QSortFilterProxyModel> +#include <QtWidgets/QSortFilterProxyModel> //TESTED_CLASS=QAbstractListModel QAbstractTableModel //TESTED_FILES= diff --git a/tests/auto/qcoreapplication/.gitignore b/tests/auto/corelib/kernel/qcoreapplication/.gitignore similarity index 100% rename from tests/auto/qcoreapplication/.gitignore rename to tests/auto/corelib/kernel/qcoreapplication/.gitignore diff --git a/tests/auto/qcoreapplication/qcoreapplication.pro b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro similarity index 100% rename from tests/auto/qcoreapplication/qcoreapplication.pro rename to tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro diff --git a/tests/auto/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp similarity index 100% rename from tests/auto/qcoreapplication/tst_qcoreapplication.cpp rename to tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp diff --git a/tests/auto/qeventloop/.gitignore b/tests/auto/corelib/kernel/qeventloop/.gitignore similarity index 100% rename from tests/auto/qeventloop/.gitignore rename to tests/auto/corelib/kernel/qeventloop/.gitignore diff --git a/tests/auto/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro similarity index 100% rename from tests/auto/qeventloop/qeventloop.pro rename to tests/auto/corelib/kernel/qeventloop/qeventloop.pro diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp similarity index 99% rename from tests/auto/qeventloop/tst_qeventloop.cpp rename to tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index a702908549b..6f8a75ed3df 100644 --- a/tests/auto/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -59,7 +59,7 @@ #include <unistd.h> #endif -#include "../../shared/util.h" +#include "../../../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qitemmodel/.gitignore b/tests/auto/corelib/kernel/qitemmodel/.gitignore similarity index 100% rename from tests/auto/qitemmodel/.gitignore rename to tests/auto/corelib/kernel/qitemmodel/.gitignore diff --git a/tests/auto/qitemmodel/README b/tests/auto/corelib/kernel/qitemmodel/README similarity index 100% rename from tests/auto/qitemmodel/README rename to tests/auto/corelib/kernel/qitemmodel/README diff --git a/tests/auto/qitemmodel/modelstotest.cpp b/tests/auto/corelib/kernel/qitemmodel/modelstotest.cpp similarity index 99% rename from tests/auto/qitemmodel/modelstotest.cpp rename to tests/auto/corelib/kernel/qitemmodel/modelstotest.cpp index 772f72b9731..82c28b53038 100644 --- a/tests/auto/qitemmodel/modelstotest.cpp +++ b/tests/auto/corelib/kernel/qitemmodel/modelstotest.cpp @@ -43,7 +43,6 @@ #include <QtTest/QtTest> #include <QtCore/QtCore> #include <QtSql/QtSql> -#include <QtGui/QtGui> #include <QSortFilterProxyModel> /* diff --git a/tests/auto/qitemmodel/qitemmodel.pro b/tests/auto/corelib/kernel/qitemmodel/qitemmodel.pro similarity index 97% rename from tests/auto/qitemmodel/qitemmodel.pro rename to tests/auto/corelib/kernel/qitemmodel/qitemmodel.pro index b348a183f8b..97d55fcd4d6 100644 --- a/tests/auto/qitemmodel/qitemmodel.pro +++ b/tests/auto/corelib/kernel/qitemmodel/qitemmodel.pro @@ -1,7 +1,7 @@ load(qttest_p4) SOURCES += tst_qitemmodel.cpp -QT += sql +QT += widgets sql # NOTE: The deployment of the sqldrivers is disabled on purpose. # If we deploy the plugins, they are loaded twice when running diff --git a/tests/auto/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/kernel/qitemmodel/tst_qitemmodel.cpp similarity index 100% rename from tests/auto/qitemmodel/tst_qitemmodel.cpp rename to tests/auto/corelib/kernel/qitemmodel/tst_qitemmodel.cpp diff --git a/tests/auto/qmath/qmath.pro b/tests/auto/corelib/kernel/qmath/qmath.pro similarity index 100% rename from tests/auto/qmath/qmath.pro rename to tests/auto/corelib/kernel/qmath/qmath.pro diff --git a/tests/auto/qmath/tst_qmath.cpp b/tests/auto/corelib/kernel/qmath/tst_qmath.cpp similarity index 100% rename from tests/auto/qmath/tst_qmath.cpp rename to tests/auto/corelib/kernel/qmath/tst_qmath.cpp diff --git a/tests/auto/qmetaobject/.gitignore b/tests/auto/corelib/kernel/qmetaobject/.gitignore similarity index 100% rename from tests/auto/qmetaobject/.gitignore rename to tests/auto/corelib/kernel/qmetaobject/.gitignore diff --git a/tests/auto/qmetaobject/qmetaobject.pro b/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro similarity index 70% rename from tests/auto/qmetaobject/qmetaobject.pro rename to tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro index 1df54f73bf2..7a4cf94e470 100644 --- a/tests/auto/qmetaobject/qmetaobject.pro +++ b/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro @@ -1,6 +1,6 @@ load(qttest_p4) -QT = core gui +QT = core gui widgets SOURCES += tst_qmetaobject.cpp diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp similarity index 100% rename from tests/auto/qmetaobject/tst_qmetaobject.cpp rename to tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp diff --git a/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro b/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro new file mode 100644 index 00000000000..4369f33b4cc --- /dev/null +++ b/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro @@ -0,0 +1,4 @@ +load(qttest_p4) +QT = core gui +SOURCES += tst_qmetaproperty.cpp + diff --git a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp new file mode 100644 index 00000000000..7a457b05fa3 --- /dev/null +++ b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtTest/QtTest> + +#include <qobject.h> +#include <qmetaobject.h> + +class tst_QMetaProperty : public QObject +{ + Q_OBJECT + Q_PROPERTY(EnumType value WRITE setValue READ getValue) + Q_PROPERTY(EnumType value2 WRITE set_value READ get_value) + Q_PROPERTY(int value8 READ value8) + Q_PROPERTY(int value9 READ value9 CONSTANT) + Q_PROPERTY(int value10 READ value10 FINAL) + +private slots: + void hasStdCppSet(); + void isConstant(); + void isFinal(); + +public: + enum EnumType { EnumType1 }; + + void setValue(EnumType) {} + EnumType getValue() const { return EnumType1; } + void set_value(EnumType) {} + EnumType get_value() const { return EnumType1; } + + int value8() const { return 1; } + int value9() const { return 1; } + int value10() const { return 1; } +}; + +void tst_QMetaProperty::hasStdCppSet() +{ + const QMetaObject *mo = metaObject(); + + QMetaProperty prop = mo->property(mo->indexOfProperty("value")); + QVERIFY(prop.isValid()); + QVERIFY(prop.hasStdCppSet()); + + prop = mo->property(mo->indexOfProperty("value2")); + QVERIFY(prop.isValid()); + QVERIFY(!prop.hasStdCppSet()); +} + +void tst_QMetaProperty::isConstant() +{ + const QMetaObject *mo = metaObject(); + + QMetaProperty prop = mo->property(mo->indexOfProperty("value8")); + QVERIFY(prop.isValid()); + QVERIFY(!prop.isConstant()); + + prop = mo->property(mo->indexOfProperty("value9")); + QVERIFY(prop.isValid()); + QVERIFY(prop.isConstant()); +} + +void tst_QMetaProperty::isFinal() +{ + const QMetaObject *mo = metaObject(); + + QMetaProperty prop = mo->property(mo->indexOfProperty("value10")); + QVERIFY(prop.isValid()); + QVERIFY(prop.isFinal()); + + prop = mo->property(mo->indexOfProperty("value9")); + QVERIFY(prop.isValid()); + QVERIFY(!prop.isFinal()); +} + +QTEST_MAIN(tst_QMetaProperty) +#include "tst_qmetaproperty.moc" diff --git a/tests/auto/qmetatype/.gitignore b/tests/auto/corelib/kernel/qmetatype/.gitignore similarity index 100% rename from tests/auto/qmetatype/.gitignore rename to tests/auto/corelib/kernel/qmetatype/.gitignore diff --git a/tests/auto/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro similarity index 100% rename from tests/auto/qmetatype/qmetatype.pro rename to tests/auto/corelib/kernel/qmetatype/qmetatype.pro diff --git a/tests/auto/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp similarity index 99% rename from tests/auto/qmetatype/tst_qmetatype.cpp rename to tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 897664ea9af..3fb60acf57c 100644 --- a/tests/auto/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -255,7 +255,6 @@ void tst_QMetaType::typeName_data() QTest::newRow("double") << QMetaType::Double << "double"; QTest::newRow("qlonglong") << QMetaType::LongLong << "qlonglong"; QTest::newRow("QRegExp") << QMetaType::QRegExp << "QRegExp"; - QTest::newRow("QColorGroup") << QMetaType::Type(63) << "QColorGroup"; QTest::newRow("void*") << QMetaType::VoidStar << "void*"; QTest::newRow("ulong") << QMetaType::ULong << "ulong"; QTest::newRow("QWidget*") << QMetaType::QWidgetStar << "QWidget*"; diff --git a/tests/auto/qmimedata/qmimedata.pro b/tests/auto/corelib/kernel/qmimedata/qmimedata.pro similarity index 100% rename from tests/auto/qmimedata/qmimedata.pro rename to tests/auto/corelib/kernel/qmimedata/qmimedata.pro diff --git a/tests/auto/qmimedata/tst_qmimedata.cpp b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp similarity index 100% rename from tests/auto/qmimedata/tst_qmimedata.cpp rename to tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp diff --git a/tests/auto/qobject/.gitignore b/tests/auto/corelib/kernel/qobject/.gitignore similarity index 100% rename from tests/auto/qobject/.gitignore rename to tests/auto/corelib/kernel/qobject/.gitignore diff --git a/tests/auto/qobject/moc_oldnormalizeobject.cpp b/tests/auto/corelib/kernel/qobject/moc_oldnormalizeobject.cpp similarity index 100% rename from tests/auto/qobject/moc_oldnormalizeobject.cpp rename to tests/auto/corelib/kernel/qobject/moc_oldnormalizeobject.cpp diff --git a/tests/auto/qobject/oldnormalizeobject.h b/tests/auto/corelib/kernel/qobject/oldnormalizeobject.h similarity index 100% rename from tests/auto/qobject/oldnormalizeobject.h rename to tests/auto/corelib/kernel/qobject/oldnormalizeobject.h diff --git a/tests/auto/qobject/qobject.pro b/tests/auto/corelib/kernel/qobject/qobject.pro similarity index 100% rename from tests/auto/qobject/qobject.pro rename to tests/auto/corelib/kernel/qobject/qobject.pro diff --git a/tests/auto/qobject/signalbug.cpp b/tests/auto/corelib/kernel/qobject/signalbug.cpp similarity index 100% rename from tests/auto/qobject/signalbug.cpp rename to tests/auto/corelib/kernel/qobject/signalbug.cpp diff --git a/tests/auto/qobject/signalbug.h b/tests/auto/corelib/kernel/qobject/signalbug.h similarity index 100% rename from tests/auto/qobject/signalbug.h rename to tests/auto/corelib/kernel/qobject/signalbug.h diff --git a/tests/auto/qobject/signalbug.pro b/tests/auto/corelib/kernel/qobject/signalbug.pro similarity index 100% rename from tests/auto/qobject/signalbug.pro rename to tests/auto/corelib/kernel/qobject/signalbug.pro diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp similarity index 99% rename from tests/auto/qobject/tst_qobject.cpp rename to tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 3cd4376d80f..faab1f55324 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -3017,6 +3017,7 @@ signals: void work(); }; +namespace QObjectTest { // Do not clash with WinAPI 'DeleteObject' class DeleteObject : public QObject { Q_OBJECT @@ -3036,12 +3037,13 @@ public slots: signals: void relayedSignal(); }; +} // namespace QObjectTest void tst_QObject::deleteSelfInSlot() { { SenderObject sender; - DeleteObject *receiver = new DeleteObject(); + QObjectTest::DeleteObject *receiver = new QObjectTest::DeleteObject(); receiver->connect(&sender, SIGNAL(signal1()), SLOT(deleteSelf()), @@ -3052,7 +3054,7 @@ void tst_QObject::deleteSelfInSlot() thread.connect(receiver, SIGNAL(destroyed()), SLOT(quit()), Qt::DirectConnection); thread.start(); - QPointer<DeleteObject> p = receiver; + QPointer<QObjectTest::DeleteObject> p = receiver; sender.emitSignal1(); QVERIFY(p.isNull()); @@ -3061,7 +3063,7 @@ void tst_QObject::deleteSelfInSlot() { SenderObject sender; - DeleteObject *receiver = new DeleteObject(); + QObjectTest::DeleteObject *receiver = new QObjectTest::DeleteObject(); receiver->connect(&sender, SIGNAL(signal1()), SLOT(relaySignalAndProcessEvents()), @@ -3076,7 +3078,7 @@ void tst_QObject::deleteSelfInSlot() thread.connect(receiver, SIGNAL(destroyed()), SLOT(quit()), Qt::DirectConnection); thread.start(); - QPointer<DeleteObject> p = receiver; + QPointer<QObjectTest::DeleteObject> p = receiver; sender.emitSignal1(); QVERIFY(p.isNull()); @@ -3085,9 +3087,9 @@ void tst_QObject::deleteSelfInSlot() { EmitThread sender; - DeleteObject *receiver = new DeleteObject(); + QObjectTest::DeleteObject *receiver = new QObjectTest::DeleteObject(); connect(&sender, SIGNAL(work()), receiver, SLOT(deleteSelf()), Qt::DirectConnection); - QPointer<DeleteObject> p = receiver; + QPointer<QObjectTest::DeleteObject> p = receiver; sender.start(); QVERIFY(sender.wait(10000)); QVERIFY(p.isNull()); diff --git a/tests/auto/qobject/tst_qobject.pro b/tests/auto/corelib/kernel/qobject/tst_qobject.pro similarity index 100% rename from tests/auto/qobject/tst_qobject.pro rename to tests/auto/corelib/kernel/qobject/tst_qobject.pro diff --git a/tests/auto/qpointer/.gitignore b/tests/auto/corelib/kernel/qpointer/.gitignore similarity index 100% rename from tests/auto/qpointer/.gitignore rename to tests/auto/corelib/kernel/qpointer/.gitignore diff --git a/tests/auto/qpointer/qpointer.pro b/tests/auto/corelib/kernel/qpointer/qpointer.pro similarity index 76% rename from tests/auto/qpointer/qpointer.pro rename to tests/auto/corelib/kernel/qpointer/qpointer.pro index a30a6fa42b7..5728b7bb4f1 100644 --- a/tests/auto/qpointer/qpointer.pro +++ b/tests/auto/corelib/kernel/qpointer/qpointer.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qpointer.cpp diff --git a/tests/auto/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp similarity index 100% rename from tests/auto/qpointer/tst_qpointer.cpp rename to tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp diff --git a/tests/auto/qsignalmapper/.gitignore b/tests/auto/corelib/kernel/qsignalmapper/.gitignore similarity index 100% rename from tests/auto/qsignalmapper/.gitignore rename to tests/auto/corelib/kernel/qsignalmapper/.gitignore diff --git a/tests/auto/qsignalmapper/qsignalmapper.pro b/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro similarity index 79% rename from tests/auto/qsignalmapper/qsignalmapper.pro rename to tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro index 3215a5943d7..5af4b70c634 100644 --- a/tests/auto/qsignalmapper/qsignalmapper.pro +++ b/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qsignalmapper.cpp diff --git a/tests/auto/qsignalmapper/tst_qsignalmapper.cpp b/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp similarity index 100% rename from tests/auto/qsignalmapper/tst_qsignalmapper.cpp rename to tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp diff --git a/tests/auto/qsocketnotifier/.gitignore b/tests/auto/corelib/kernel/qsocketnotifier/.gitignore similarity index 100% rename from tests/auto/qsocketnotifier/.gitignore rename to tests/auto/corelib/kernel/qsocketnotifier/.gitignore diff --git a/tests/auto/qsocketnotifier/qsocketnotifier.pro b/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro similarity index 84% rename from tests/auto/qsocketnotifier/qsocketnotifier.pro rename to tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro index c0fdc6a9b3d..0768c69caa4 100644 --- a/tests/auto/qsocketnotifier/qsocketnotifier.pro +++ b/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro @@ -8,4 +8,4 @@ include(../platformsocketengine/platformsocketengine.pri) symbian: TARGET.CAPABILITY = NetworkServices - +CONFIG += insignificant_test # QTBUG-21204 diff --git a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp similarity index 98% rename from tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp rename to tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp index 77836b46717..2c3a6c52bf6 100644 --- a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp @@ -40,9 +40,12 @@ ****************************************************************************/ -#include <QtTest/QtTest> +#include <QtTest/QTest> +#include <QtTest/QSignalSpy> +#include <QtTest/QTestEventLoop> #include <QtCore/QCoreApplication> +#include <QtCore/QTimer> #include <QtCore/QSocketNotifier> #include <QtNetwork/QTcpServer> #include <QtNetwork/QTcpSocket> @@ -55,9 +58,14 @@ #endif #ifdef Q_OS_UNIX #include <private/qnet_unix_p.h> +#include <sys/select.h> #endif #include <limits> -#include <sys/select.h> + +#if defined (Q_CC_MSVC) && defined(max) +# undef max +# undef min +#endif // Q_CC_MSVC class tst_QSocketNotifier : public QObject { diff --git a/tests/auto/qtimer/.gitignore b/tests/auto/corelib/kernel/qtimer/.gitignore similarity index 100% rename from tests/auto/qtimer/.gitignore rename to tests/auto/corelib/kernel/qtimer/.gitignore diff --git a/tests/auto/qtimer/qtimer.pro b/tests/auto/corelib/kernel/qtimer/qtimer.pro similarity index 100% rename from tests/auto/qtimer/qtimer.pro rename to tests/auto/corelib/kernel/qtimer/qtimer.pro diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp similarity index 99% rename from tests/auto/qtimer/tst_qtimer.cpp rename to tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index e08c903e7c1..a8ac799d733 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -50,7 +50,7 @@ #include <unistd.h> #endif -#include "../../shared/util.h" +#include "../../../../shared/util.h" //TESTED_CLASS= diff --git a/tests/auto/qtipc/lackey/lackey.pro b/tests/auto/corelib/kernel/qtipc/lackey/lackey.pro similarity index 100% rename from tests/auto/qtipc/lackey/lackey.pro rename to tests/auto/corelib/kernel/qtipc/lackey/lackey.pro diff --git a/tests/auto/qtipc/lackey/main.cpp b/tests/auto/corelib/kernel/qtipc/lackey/main.cpp similarity index 100% rename from tests/auto/qtipc/lackey/main.cpp rename to tests/auto/corelib/kernel/qtipc/lackey/main.cpp diff --git a/tests/auto/qtipc/lackey/scripts/consumer.js b/tests/auto/corelib/kernel/qtipc/lackey/scripts/consumer.js similarity index 100% rename from tests/auto/qtipc/lackey/scripts/consumer.js rename to tests/auto/corelib/kernel/qtipc/lackey/scripts/consumer.js diff --git a/tests/auto/qtipc/lackey/scripts/producer.js b/tests/auto/corelib/kernel/qtipc/lackey/scripts/producer.js similarity index 100% rename from tests/auto/qtipc/lackey/scripts/producer.js rename to tests/auto/corelib/kernel/qtipc/lackey/scripts/producer.js diff --git a/tests/auto/qtipc/lackey/scripts/readonly_segfault.js b/tests/auto/corelib/kernel/qtipc/lackey/scripts/readonly_segfault.js similarity index 100% rename from tests/auto/qtipc/lackey/scripts/readonly_segfault.js rename to tests/auto/corelib/kernel/qtipc/lackey/scripts/readonly_segfault.js diff --git a/tests/auto/qtipc/lackey/scripts/systemlock_read.js b/tests/auto/corelib/kernel/qtipc/lackey/scripts/systemlock_read.js similarity index 100% rename from tests/auto/qtipc/lackey/scripts/systemlock_read.js rename to tests/auto/corelib/kernel/qtipc/lackey/scripts/systemlock_read.js diff --git a/tests/auto/qtipc/lackey/scripts/systemlock_readwrite.js b/tests/auto/corelib/kernel/qtipc/lackey/scripts/systemlock_readwrite.js similarity index 100% rename from tests/auto/qtipc/lackey/scripts/systemlock_readwrite.js rename to tests/auto/corelib/kernel/qtipc/lackey/scripts/systemlock_readwrite.js diff --git a/tests/auto/qtipc/lackey/scripts/systemsemaphore_acquire.js b/tests/auto/corelib/kernel/qtipc/lackey/scripts/systemsemaphore_acquire.js similarity index 100% rename from tests/auto/qtipc/lackey/scripts/systemsemaphore_acquire.js rename to tests/auto/corelib/kernel/qtipc/lackey/scripts/systemsemaphore_acquire.js diff --git a/tests/auto/qtipc/lackey/scripts/systemsemaphore_acquirerelease.js b/tests/auto/corelib/kernel/qtipc/lackey/scripts/systemsemaphore_acquirerelease.js similarity index 100% rename from tests/auto/qtipc/lackey/scripts/systemsemaphore_acquirerelease.js rename to tests/auto/corelib/kernel/qtipc/lackey/scripts/systemsemaphore_acquirerelease.js diff --git a/tests/auto/qtipc/lackey/scripts/systemsemaphore_release.js b/tests/auto/corelib/kernel/qtipc/lackey/scripts/systemsemaphore_release.js similarity index 100% rename from tests/auto/qtipc/lackey/scripts/systemsemaphore_release.js rename to tests/auto/corelib/kernel/qtipc/lackey/scripts/systemsemaphore_release.js diff --git a/tests/auto/qtipc/qsharedmemory/.gitignore b/tests/auto/corelib/kernel/qtipc/qsharedmemory/.gitignore similarity index 100% rename from tests/auto/qtipc/qsharedmemory/.gitignore rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/.gitignore diff --git a/tests/auto/qtipc/qsharedmemory/qsharedmemory.pro b/tests/auto/corelib/kernel/qtipc/qsharedmemory/qsharedmemory.pro similarity index 100% rename from tests/auto/qtipc/qsharedmemory/qsharedmemory.pro rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/qsharedmemory.pro diff --git a/tests/auto/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro b/tests/auto/corelib/kernel/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro similarity index 100% rename from tests/auto/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/qsystemlock/qsystemlock.pro diff --git a/tests/auto/qtipc/qsharedmemory/qsystemlock/tst_qsystemlock.cpp b/tests/auto/corelib/kernel/qtipc/qsharedmemory/qsystemlock/tst_qsystemlock.cpp similarity index 100% rename from tests/auto/qtipc/qsharedmemory/qsystemlock/tst_qsystemlock.cpp rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/qsystemlock/tst_qsystemlock.cpp diff --git a/tests/auto/qtipc/qsharedmemory/src/qsystemlock.cpp b/tests/auto/corelib/kernel/qtipc/qsharedmemory/src/qsystemlock.cpp similarity index 100% rename from tests/auto/qtipc/qsharedmemory/src/qsystemlock.cpp rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/src/qsystemlock.cpp diff --git a/tests/auto/qtipc/qsharedmemory/src/qsystemlock.h b/tests/auto/corelib/kernel/qtipc/qsharedmemory/src/qsystemlock.h similarity index 100% rename from tests/auto/qtipc/qsharedmemory/src/qsystemlock.h rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/src/qsystemlock.h diff --git a/tests/auto/qtipc/qsharedmemory/src/qsystemlock_p.h b/tests/auto/corelib/kernel/qtipc/qsharedmemory/src/qsystemlock_p.h similarity index 100% rename from tests/auto/qtipc/qsharedmemory/src/qsystemlock_p.h rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/src/qsystemlock_p.h diff --git a/tests/auto/qtipc/qsharedmemory/src/qsystemlock_unix.cpp b/tests/auto/corelib/kernel/qtipc/qsharedmemory/src/qsystemlock_unix.cpp similarity index 100% rename from tests/auto/qtipc/qsharedmemory/src/qsystemlock_unix.cpp rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/src/qsystemlock_unix.cpp diff --git a/tests/auto/qtipc/qsharedmemory/src/qsystemlock_win.cpp b/tests/auto/corelib/kernel/qtipc/qsharedmemory/src/qsystemlock_win.cpp similarity index 100% rename from tests/auto/qtipc/qsharedmemory/src/qsystemlock_win.cpp rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/src/qsystemlock_win.cpp diff --git a/tests/auto/qtipc/qsharedmemory/src/src.pri b/tests/auto/corelib/kernel/qtipc/qsharedmemory/src/src.pri similarity index 100% rename from tests/auto/qtipc/qsharedmemory/src/src.pri rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/src/src.pri diff --git a/tests/auto/qtipc/qsharedmemory/test/test.pro b/tests/auto/corelib/kernel/qtipc/qsharedmemory/test/test.pro similarity index 100% rename from tests/auto/qtipc/qsharedmemory/test/test.pro rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/test/test.pro diff --git a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qtipc/qsharedmemory/tst_qsharedmemory.cpp similarity index 100% rename from tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp rename to tests/auto/corelib/kernel/qtipc/qsharedmemory/tst_qsharedmemory.cpp diff --git a/tests/auto/qtipc/qsystemsemaphore/.gitignore b/tests/auto/corelib/kernel/qtipc/qsystemsemaphore/.gitignore similarity index 100% rename from tests/auto/qtipc/qsystemsemaphore/.gitignore rename to tests/auto/corelib/kernel/qtipc/qsystemsemaphore/.gitignore diff --git a/tests/auto/qtipc/qsystemsemaphore/files.qrc b/tests/auto/corelib/kernel/qtipc/qsystemsemaphore/files.qrc similarity index 100% rename from tests/auto/qtipc/qsystemsemaphore/files.qrc rename to tests/auto/corelib/kernel/qtipc/qsystemsemaphore/files.qrc diff --git a/tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro b/tests/auto/corelib/kernel/qtipc/qsystemsemaphore/qsystemsemaphore.pro similarity index 100% rename from tests/auto/qtipc/qsystemsemaphore/qsystemsemaphore.pro rename to tests/auto/corelib/kernel/qtipc/qsystemsemaphore/qsystemsemaphore.pro diff --git a/tests/auto/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp similarity index 100% rename from tests/auto/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp rename to tests/auto/corelib/kernel/qtipc/qsystemsemaphore/tst_qsystemsemaphore.cpp diff --git a/tests/auto/qtipc/qtipc.pro b/tests/auto/corelib/kernel/qtipc/qtipc.pro similarity index 100% rename from tests/auto/qtipc/qtipc.pro rename to tests/auto/corelib/kernel/qtipc/qtipc.pro diff --git a/tests/auto/qtranslator/.gitignore b/tests/auto/corelib/kernel/qtranslator/.gitignore similarity index 100% rename from tests/auto/qtranslator/.gitignore rename to tests/auto/corelib/kernel/qtranslator/.gitignore diff --git a/tests/auto/qtranslator/hellotr_la.qm b/tests/auto/corelib/kernel/qtranslator/hellotr_la.qm similarity index 100% rename from tests/auto/qtranslator/hellotr_la.qm rename to tests/auto/corelib/kernel/qtranslator/hellotr_la.qm diff --git a/tests/auto/qtranslator/hellotr_la.ts b/tests/auto/corelib/kernel/qtranslator/hellotr_la.ts similarity index 100% rename from tests/auto/qtranslator/hellotr_la.ts rename to tests/auto/corelib/kernel/qtranslator/hellotr_la.ts diff --git a/tests/auto/qtranslator/msgfmt_from_po.qm b/tests/auto/corelib/kernel/qtranslator/msgfmt_from_po.qm similarity index 100% rename from tests/auto/qtranslator/msgfmt_from_po.qm rename to tests/auto/corelib/kernel/qtranslator/msgfmt_from_po.qm diff --git a/tests/auto/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro similarity index 77% rename from tests/auto/qtranslator/qtranslator.pro rename to tests/auto/corelib/kernel/qtranslator/qtranslator.pro index 0001d1c329a..171216afb4c 100644 --- a/tests/auto/qtranslator/qtranslator.pro +++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtranslator.cpp RESOURCES += qtranslator.qrc @@ -8,4 +9,4 @@ wince*|symbian: { DEPLOYMENT += addFiles } - +CONFIG += insignificant_test # QTBUG-21125 diff --git a/tests/auto/qtranslator/qtranslator.qrc b/tests/auto/corelib/kernel/qtranslator/qtranslator.qrc similarity index 100% rename from tests/auto/qtranslator/qtranslator.qrc rename to tests/auto/corelib/kernel/qtranslator/qtranslator.qrc diff --git a/tests/auto/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp similarity index 100% rename from tests/auto/qtranslator/tst_qtranslator.cpp rename to tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp diff --git a/tests/auto/qvariant/.gitignore b/tests/auto/corelib/kernel/qvariant/.gitignore similarity index 100% rename from tests/auto/qvariant/.gitignore rename to tests/auto/corelib/kernel/qvariant/.gitignore diff --git a/tests/auto/qvariant/qvariant.pro b/tests/auto/corelib/kernel/qvariant/qvariant.pro similarity index 76% rename from tests/auto/qvariant/qvariant.pro rename to tests/auto/corelib/kernel/qvariant/qvariant.pro index 468b7724c25..52af24ea857 100644 --- a/tests/auto/qvariant/qvariant.pro +++ b/tests/auto/corelib/kernel/qvariant/qvariant.pro @@ -1,5 +1,5 @@ load(qttest_p4) SOURCES += tst_qvariant.cpp -QT += network +QT += widgets network CONFIG+=insignificant_test diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp similarity index 100% rename from tests/auto/qvariant/tst_qvariant.cpp rename to tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp diff --git a/tests/auto/qwineventnotifier/.gitignore b/tests/auto/corelib/kernel/qwineventnotifier/.gitignore similarity index 100% rename from tests/auto/qwineventnotifier/.gitignore rename to tests/auto/corelib/kernel/qwineventnotifier/.gitignore diff --git a/tests/auto/qwineventnotifier/qwineventnotifier.pro b/tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro similarity index 77% rename from tests/auto/qwineventnotifier/qwineventnotifier.pro rename to tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro index 62da3a33ea9..4a5ea78ed18 100644 --- a/tests/auto/qwineventnotifier/qwineventnotifier.pro +++ b/tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro @@ -1,4 +1,4 @@ load(qttest_p4) SOURCES += tst_qwineventnotifier.cpp -QT = core +QT = core core-private CONFIG += parallel_test diff --git a/tests/auto/qwineventnotifier/tst_qwineventnotifier.cpp b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp similarity index 100% rename from tests/auto/qwineventnotifier/tst_qwineventnotifier.cpp rename to tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp diff --git a/tests/auto/corelib/plugin/plugin.pro b/tests/auto/corelib/plugin/plugin.pro new file mode 100644 index 00000000000..24de36e4ecc --- /dev/null +++ b/tests/auto/corelib/plugin/plugin.pro @@ -0,0 +1,6 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qlibrary \ + qplugin \ + qpluginloader \ + quuid diff --git a/tests/auto/qlibrary/.gitignore b/tests/auto/corelib/plugin/qlibrary/.gitignore similarity index 100% rename from tests/auto/qlibrary/.gitignore rename to tests/auto/corelib/plugin/qlibrary/.gitignore diff --git a/tests/auto/qlibrary/lib/lib.pro b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro similarity index 100% rename from tests/auto/qlibrary/lib/lib.pro rename to tests/auto/corelib/plugin/qlibrary/lib/lib.pro diff --git a/tests/auto/qlibrary/lib/mylib.c b/tests/auto/corelib/plugin/qlibrary/lib/mylib.c similarity index 100% rename from tests/auto/qlibrary/lib/mylib.c rename to tests/auto/corelib/plugin/qlibrary/lib/mylib.c diff --git a/tests/auto/qlibrary/lib2/lib2.pro b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro similarity index 100% rename from tests/auto/qlibrary/lib2/lib2.pro rename to tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro diff --git a/tests/auto/qlibrary/lib2/mylib.c b/tests/auto/corelib/plugin/qlibrary/lib2/mylib.c similarity index 100% rename from tests/auto/qlibrary/lib2/mylib.c rename to tests/auto/corelib/plugin/qlibrary/lib2/mylib.c diff --git a/tests/auto/qlibrary/library_path/invalid.so b/tests/auto/corelib/plugin/qlibrary/library_path/invalid.so similarity index 100% rename from tests/auto/qlibrary/library_path/invalid.so rename to tests/auto/corelib/plugin/qlibrary/library_path/invalid.so diff --git a/tests/auto/qlibrary/qlibrary.pro b/tests/auto/corelib/plugin/qlibrary/qlibrary.pro similarity index 100% rename from tests/auto/qlibrary/qlibrary.pro rename to tests/auto/corelib/plugin/qlibrary/qlibrary.pro diff --git a/tests/auto/qlibrary/tst/tst.pro b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro similarity index 100% rename from tests/auto/qlibrary/tst/tst.pro rename to tests/auto/corelib/plugin/qlibrary/tst/tst.pro diff --git a/tests/auto/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp similarity index 100% rename from tests/auto/qlibrary/tst_qlibrary.cpp rename to tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp diff --git a/tests/auto/qplugin/.gitignore b/tests/auto/corelib/plugin/qplugin/.gitignore similarity index 100% rename from tests/auto/qplugin/.gitignore rename to tests/auto/corelib/plugin/qplugin/.gitignore diff --git a/tests/auto/qplugin/debugplugin/debugplugin.pro b/tests/auto/corelib/plugin/qplugin/debugplugin/debugplugin.pro similarity index 100% rename from tests/auto/qplugin/debugplugin/debugplugin.pro rename to tests/auto/corelib/plugin/qplugin/debugplugin/debugplugin.pro diff --git a/tests/auto/qplugin/debugplugin/main.cpp b/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp similarity index 100% rename from tests/auto/qplugin/debugplugin/main.cpp rename to tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp diff --git a/tests/auto/qplugin/qplugin.pro b/tests/auto/corelib/plugin/qplugin/qplugin.pro similarity index 100% rename from tests/auto/qplugin/qplugin.pro rename to tests/auto/corelib/plugin/qplugin/qplugin.pro diff --git a/tests/auto/qplugin/releaseplugin/main.cpp b/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp similarity index 100% rename from tests/auto/qplugin/releaseplugin/main.cpp rename to tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp diff --git a/tests/auto/qplugin/releaseplugin/releaseplugin.pro b/tests/auto/corelib/plugin/qplugin/releaseplugin/releaseplugin.pro similarity index 100% rename from tests/auto/qplugin/releaseplugin/releaseplugin.pro rename to tests/auto/corelib/plugin/qplugin/releaseplugin/releaseplugin.pro diff --git a/tests/auto/qplugin/tst_qplugin.cpp b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp similarity index 100% rename from tests/auto/qplugin/tst_qplugin.cpp rename to tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp diff --git a/tests/auto/qplugin/tst_qplugin.pro b/tests/auto/corelib/plugin/qplugin/tst_qplugin.pro similarity index 100% rename from tests/auto/qplugin/tst_qplugin.pro rename to tests/auto/corelib/plugin/qplugin/tst_qplugin.pro diff --git a/tests/auto/qpluginloader/.gitignore b/tests/auto/corelib/plugin/qpluginloader/.gitignore similarity index 100% rename from tests/auto/qpluginloader/.gitignore rename to tests/auto/corelib/plugin/qpluginloader/.gitignore diff --git a/tests/auto/qpluginloader/almostplugin/almostplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp similarity index 100% rename from tests/auto/qpluginloader/almostplugin/almostplugin.cpp rename to tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp diff --git a/tests/auto/qpluginloader/almostplugin/almostplugin.h b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h similarity index 100% rename from tests/auto/qpluginloader/almostplugin/almostplugin.h rename to tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h diff --git a/tests/auto/qpluginloader/almostplugin/almostplugin.pro b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro similarity index 100% rename from tests/auto/qpluginloader/almostplugin/almostplugin.pro rename to tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro diff --git a/tests/auto/qpluginloader/elftest/.gitattributes b/tests/auto/corelib/plugin/qpluginloader/elftest/.gitattributes similarity index 100% rename from tests/auto/qpluginloader/elftest/.gitattributes rename to tests/auto/corelib/plugin/qpluginloader/elftest/.gitattributes diff --git a/tests/auto/qpluginloader/elftest/corrupt1.elf64.so b/tests/auto/corelib/plugin/qpluginloader/elftest/corrupt1.elf64.so similarity index 100% rename from tests/auto/qpluginloader/elftest/corrupt1.elf64.so rename to tests/auto/corelib/plugin/qpluginloader/elftest/corrupt1.elf64.so diff --git a/tests/auto/qpluginloader/elftest/corrupt2.elf64.so b/tests/auto/corelib/plugin/qpluginloader/elftest/corrupt2.elf64.so similarity index 100% rename from tests/auto/qpluginloader/elftest/corrupt2.elf64.so rename to tests/auto/corelib/plugin/qpluginloader/elftest/corrupt2.elf64.so diff --git a/tests/auto/qpluginloader/elftest/corrupt3.elf64.so b/tests/auto/corelib/plugin/qpluginloader/elftest/corrupt3.elf64.so similarity index 100% rename from tests/auto/qpluginloader/elftest/corrupt3.elf64.so rename to tests/auto/corelib/plugin/qpluginloader/elftest/corrupt3.elf64.so diff --git a/tests/auto/qpluginloader/elftest/debugobj.so b/tests/auto/corelib/plugin/qpluginloader/elftest/debugobj.so similarity index 100% rename from tests/auto/qpluginloader/elftest/debugobj.so rename to tests/auto/corelib/plugin/qpluginloader/elftest/debugobj.so diff --git a/tests/auto/qpluginloader/elftest/garbage1.so b/tests/auto/corelib/plugin/qpluginloader/elftest/garbage1.so similarity index 100% rename from tests/auto/qpluginloader/elftest/garbage1.so rename to tests/auto/corelib/plugin/qpluginloader/elftest/garbage1.so diff --git a/tests/auto/qpluginloader/elftest/garbage2.so b/tests/auto/corelib/plugin/qpluginloader/elftest/garbage2.so similarity index 100% rename from tests/auto/qpluginloader/elftest/garbage2.so rename to tests/auto/corelib/plugin/qpluginloader/elftest/garbage2.so diff --git a/tests/auto/qpluginloader/elftest/garbage3.so b/tests/auto/corelib/plugin/qpluginloader/elftest/garbage3.so similarity index 100% rename from tests/auto/qpluginloader/elftest/garbage3.so rename to tests/auto/corelib/plugin/qpluginloader/elftest/garbage3.so diff --git a/tests/auto/qpluginloader/elftest/garbage4.so b/tests/auto/corelib/plugin/qpluginloader/elftest/garbage4.so similarity index 100% rename from tests/auto/qpluginloader/elftest/garbage4.so rename to tests/auto/corelib/plugin/qpluginloader/elftest/garbage4.so diff --git a/tests/auto/qpluginloader/elftest/garbage5.so b/tests/auto/corelib/plugin/qpluginloader/elftest/garbage5.so similarity index 100% rename from tests/auto/qpluginloader/elftest/garbage5.so rename to tests/auto/corelib/plugin/qpluginloader/elftest/garbage5.so diff --git a/tests/auto/qpluginloader/lib/lib.pro b/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro similarity index 100% rename from tests/auto/qpluginloader/lib/lib.pro rename to tests/auto/corelib/plugin/qpluginloader/lib/lib.pro diff --git a/tests/auto/qpluginloader/lib/mylib.c b/tests/auto/corelib/plugin/qpluginloader/lib/mylib.c similarity index 100% rename from tests/auto/qpluginloader/lib/mylib.c rename to tests/auto/corelib/plugin/qpluginloader/lib/mylib.c diff --git a/tests/auto/qpluginloader/qpluginloader.pro b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro similarity index 100% rename from tests/auto/qpluginloader/qpluginloader.pro rename to tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro diff --git a/tests/auto/qpluginloader/theplugin/plugininterface.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h similarity index 100% rename from tests/auto/qpluginloader/theplugin/plugininterface.h rename to tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h diff --git a/tests/auto/qpluginloader/theplugin/theplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp similarity index 100% rename from tests/auto/qpluginloader/theplugin/theplugin.cpp rename to tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp diff --git a/tests/auto/qpluginloader/theplugin/theplugin.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h similarity index 100% rename from tests/auto/qpluginloader/theplugin/theplugin.h rename to tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h diff --git a/tests/auto/qpluginloader/theplugin/theplugin.pro b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro similarity index 100% rename from tests/auto/qpluginloader/theplugin/theplugin.pro rename to tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro diff --git a/tests/auto/qpluginloader/tst/tst.pro b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro similarity index 93% rename from tests/auto/qpluginloader/tst/tst.pro rename to tests/auto/corelib/plugin/qpluginloader/tst/tst.pro index 7ae6d891437..98de004263c 100644 --- a/tests/auto/qpluginloader/tst/tst.pro +++ b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro @@ -30,3 +30,5 @@ symbian: { DEFINES += SRCDIR=\\\"$$PWD/../\\\" mac*:CONFIG+=insignificant_test + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp similarity index 100% rename from tests/auto/qpluginloader/tst_qpluginloader.cpp rename to tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp diff --git a/tests/auto/quuid/.gitignore b/tests/auto/corelib/plugin/quuid/.gitignore similarity index 100% rename from tests/auto/quuid/.gitignore rename to tests/auto/corelib/plugin/quuid/.gitignore diff --git a/tests/auto/quuid/quuid.pro b/tests/auto/corelib/plugin/quuid/quuid.pro similarity index 100% rename from tests/auto/quuid/quuid.pro rename to tests/auto/corelib/plugin/quuid/quuid.pro diff --git a/tests/auto/quuid/test/test.pro b/tests/auto/corelib/plugin/quuid/test/test.pro similarity index 100% rename from tests/auto/quuid/test/test.pro rename to tests/auto/corelib/plugin/quuid/test/test.pro diff --git a/tests/auto/quuid/testProcessUniqueness/main.cpp b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp similarity index 100% rename from tests/auto/quuid/testProcessUniqueness/main.cpp rename to tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp diff --git a/tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro similarity index 100% rename from tests/auto/quuid/testProcessUniqueness/testProcessUniqueness.pro rename to tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp similarity index 100% rename from tests/auto/quuid/tst_quuid.cpp rename to tests/auto/corelib/plugin/quuid/tst_quuid.cpp diff --git a/tests/auto/qstate/qstate.pro b/tests/auto/corelib/statemachine/qstate/qstate.pro similarity index 100% rename from tests/auto/qstate/qstate.pro rename to tests/auto/corelib/statemachine/qstate/qstate.pro diff --git a/tests/auto/qstate/tst_qstate.cpp b/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp similarity index 100% rename from tests/auto/qstate/tst_qstate.cpp rename to tests/auto/corelib/statemachine/qstate/tst_qstate.cpp diff --git a/tests/auto/qstatemachine/qstatemachine.pro b/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro similarity index 50% rename from tests/auto/qstatemachine/qstatemachine.pro rename to tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro index ab71202f180..9d057eb05fe 100644 --- a/tests/auto/qstatemachine/qstatemachine.pro +++ b/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro @@ -1,4 +1,5 @@ load(qttest_p4) -QT = core core-private gui +QT += widgets +QT += core core-private gui widgets SOURCES += tst_qstatemachine.cpp diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp similarity index 99% rename from tests/auto/qstatemachine/tst_qstatemachine.cpp rename to tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index 854e81fb813..08181c17deb 100644 --- a/tests/auto/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -41,10 +41,10 @@ #include <QtTest/QtTest> #include <QtCore/QCoreApplication> -#include <QtGui/QPushButton> -#include <QtGui/QGraphicsScene> -#include <QtGui/QGraphicsSceneEvent> -#include <QtGui/QGraphicsTextItem> +#include <QtWidgets/QPushButton> +#include <QtWidgets/QGraphicsScene> +#include <QtWidgets/QGraphicsSceneEvent> +#include <QtWidgets/QGraphicsTextItem> #include "qstatemachine.h" #include "qstate.h" diff --git a/tests/auto/corelib/statemachine/statemachine.pro b/tests/auto/corelib/statemachine/statemachine.pro new file mode 100644 index 00000000000..aa645ac9f4d --- /dev/null +++ b/tests/auto/corelib/statemachine/statemachine.pro @@ -0,0 +1,4 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qstate \ + qstatemachine diff --git a/tests/auto/qatomicint/.gitignore b/tests/auto/corelib/thread/qatomicint/.gitignore similarity index 100% rename from tests/auto/qatomicint/.gitignore rename to tests/auto/corelib/thread/qatomicint/.gitignore diff --git a/tests/auto/qatomicint/qatomicint.pro b/tests/auto/corelib/thread/qatomicint/qatomicint.pro similarity index 100% rename from tests/auto/qatomicint/qatomicint.pro rename to tests/auto/corelib/thread/qatomicint/qatomicint.pro diff --git a/tests/auto/qatomicint/tst_qatomicint.cpp b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp similarity index 100% rename from tests/auto/qatomicint/tst_qatomicint.cpp rename to tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp diff --git a/tests/auto/qatomicpointer/.gitignore b/tests/auto/corelib/thread/qatomicpointer/.gitignore similarity index 100% rename from tests/auto/qatomicpointer/.gitignore rename to tests/auto/corelib/thread/qatomicpointer/.gitignore diff --git a/tests/auto/qatomicpointer/qatomicpointer.pro b/tests/auto/corelib/thread/qatomicpointer/qatomicpointer.pro similarity index 100% rename from tests/auto/qatomicpointer/qatomicpointer.pro rename to tests/auto/corelib/thread/qatomicpointer/qatomicpointer.pro diff --git a/tests/auto/qatomicpointer/tst_qatomicpointer.cpp b/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp similarity index 100% rename from tests/auto/qatomicpointer/tst_qatomicpointer.cpp rename to tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp diff --git a/tests/auto/qmutex/.gitignore b/tests/auto/corelib/thread/qmutex/.gitignore similarity index 100% rename from tests/auto/qmutex/.gitignore rename to tests/auto/corelib/thread/qmutex/.gitignore diff --git a/tests/auto/qmutex/qmutex.pro b/tests/auto/corelib/thread/qmutex/qmutex.pro similarity index 100% rename from tests/auto/qmutex/qmutex.pro rename to tests/auto/corelib/thread/qmutex/qmutex.pro diff --git a/tests/auto/qmutex/tst_qmutex.cpp b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp similarity index 100% rename from tests/auto/qmutex/tst_qmutex.cpp rename to tests/auto/corelib/thread/qmutex/tst_qmutex.cpp diff --git a/tests/auto/qmutexlocker/.gitignore b/tests/auto/corelib/thread/qmutexlocker/.gitignore similarity index 100% rename from tests/auto/qmutexlocker/.gitignore rename to tests/auto/corelib/thread/qmutexlocker/.gitignore diff --git a/tests/auto/qmutexlocker/qmutexlocker.pro b/tests/auto/corelib/thread/qmutexlocker/qmutexlocker.pro similarity index 100% rename from tests/auto/qmutexlocker/qmutexlocker.pro rename to tests/auto/corelib/thread/qmutexlocker/qmutexlocker.pro diff --git a/tests/auto/qmutexlocker/tst_qmutexlocker.cpp b/tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp similarity index 100% rename from tests/auto/qmutexlocker/tst_qmutexlocker.cpp rename to tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp diff --git a/tests/auto/qreadlocker/.gitignore b/tests/auto/corelib/thread/qreadlocker/.gitignore similarity index 100% rename from tests/auto/qreadlocker/.gitignore rename to tests/auto/corelib/thread/qreadlocker/.gitignore diff --git a/tests/auto/qreadlocker/qreadlocker.pro b/tests/auto/corelib/thread/qreadlocker/qreadlocker.pro similarity index 100% rename from tests/auto/qreadlocker/qreadlocker.pro rename to tests/auto/corelib/thread/qreadlocker/qreadlocker.pro diff --git a/tests/auto/qreadlocker/tst_qreadlocker.cpp b/tests/auto/corelib/thread/qreadlocker/tst_qreadlocker.cpp similarity index 100% rename from tests/auto/qreadlocker/tst_qreadlocker.cpp rename to tests/auto/corelib/thread/qreadlocker/tst_qreadlocker.cpp diff --git a/tests/auto/qreadwritelock/.gitignore b/tests/auto/corelib/thread/qreadwritelock/.gitignore similarity index 100% rename from tests/auto/qreadwritelock/.gitignore rename to tests/auto/corelib/thread/qreadwritelock/.gitignore diff --git a/tests/auto/qreadwritelock/qreadwritelock.pro b/tests/auto/corelib/thread/qreadwritelock/qreadwritelock.pro similarity index 100% rename from tests/auto/qreadwritelock/qreadwritelock.pro rename to tests/auto/corelib/thread/qreadwritelock/qreadwritelock.pro diff --git a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp similarity index 100% rename from tests/auto/qreadwritelock/tst_qreadwritelock.cpp rename to tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp diff --git a/tests/auto/qsemaphore/.gitignore b/tests/auto/corelib/thread/qsemaphore/.gitignore similarity index 100% rename from tests/auto/qsemaphore/.gitignore rename to tests/auto/corelib/thread/qsemaphore/.gitignore diff --git a/tests/auto/qsemaphore/qsemaphore.pro b/tests/auto/corelib/thread/qsemaphore/qsemaphore.pro similarity index 100% rename from tests/auto/qsemaphore/qsemaphore.pro rename to tests/auto/corelib/thread/qsemaphore/qsemaphore.pro diff --git a/tests/auto/qsemaphore/tst_qsemaphore.cpp b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp similarity index 100% rename from tests/auto/qsemaphore/tst_qsemaphore.cpp rename to tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp diff --git a/tests/auto/qthread/.gitignore b/tests/auto/corelib/thread/qthread/.gitignore similarity index 100% rename from tests/auto/qthread/.gitignore rename to tests/auto/corelib/thread/qthread/.gitignore diff --git a/tests/auto/qthread/qthread.pro b/tests/auto/corelib/thread/qthread/qthread.pro similarity index 100% rename from tests/auto/qthread/qthread.pro rename to tests/auto/corelib/thread/qthread/qthread.pro diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp similarity index 100% rename from tests/auto/qthread/tst_qthread.cpp rename to tests/auto/corelib/thread/qthread/tst_qthread.cpp diff --git a/tests/auto/qthreadonce/.gitignore b/tests/auto/corelib/thread/qthreadonce/.gitignore similarity index 100% rename from tests/auto/qthreadonce/.gitignore rename to tests/auto/corelib/thread/qthreadonce/.gitignore diff --git a/tests/auto/qthreadonce/qthreadonce.cpp b/tests/auto/corelib/thread/qthreadonce/qthreadonce.cpp similarity index 100% rename from tests/auto/qthreadonce/qthreadonce.cpp rename to tests/auto/corelib/thread/qthreadonce/qthreadonce.cpp diff --git a/tests/auto/qthreadonce/qthreadonce.h b/tests/auto/corelib/thread/qthreadonce/qthreadonce.h similarity index 100% rename from tests/auto/qthreadonce/qthreadonce.h rename to tests/auto/corelib/thread/qthreadonce/qthreadonce.h diff --git a/tests/auto/qthreadonce/qthreadonce.pro b/tests/auto/corelib/thread/qthreadonce/qthreadonce.pro similarity index 100% rename from tests/auto/qthreadonce/qthreadonce.pro rename to tests/auto/corelib/thread/qthreadonce/qthreadonce.pro diff --git a/tests/auto/qthreadonce/tst_qthreadonce.cpp b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp similarity index 100% rename from tests/auto/qthreadonce/tst_qthreadonce.cpp rename to tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp diff --git a/tests/auto/qthreadstorage/.gitignore b/tests/auto/corelib/thread/qthreadstorage/.gitignore similarity index 100% rename from tests/auto/qthreadstorage/.gitignore rename to tests/auto/corelib/thread/qthreadstorage/.gitignore diff --git a/tests/auto/qthreadstorage/crashOnExit.cpp b/tests/auto/corelib/thread/qthreadstorage/crashOnExit.cpp similarity index 100% rename from tests/auto/qthreadstorage/crashOnExit.cpp rename to tests/auto/corelib/thread/qthreadstorage/crashOnExit.cpp diff --git a/tests/auto/qthreadstorage/crashOnExit.pro b/tests/auto/corelib/thread/qthreadstorage/crashOnExit.pro similarity index 100% rename from tests/auto/qthreadstorage/crashOnExit.pro rename to tests/auto/corelib/thread/qthreadstorage/crashOnExit.pro diff --git a/tests/auto/qthreadstorage/qthreadstorage.pro b/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro similarity index 100% rename from tests/auto/qthreadstorage/qthreadstorage.pro rename to tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro diff --git a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp similarity index 100% rename from tests/auto/qthreadstorage/tst_qthreadstorage.cpp rename to tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp diff --git a/tests/auto/qthreadstorage/tst_qthreadstorage.pro b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.pro similarity index 100% rename from tests/auto/qthreadstorage/tst_qthreadstorage.pro rename to tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.pro diff --git a/tests/auto/qwaitcondition/.gitignore b/tests/auto/corelib/thread/qwaitcondition/.gitignore similarity index 100% rename from tests/auto/qwaitcondition/.gitignore rename to tests/auto/corelib/thread/qwaitcondition/.gitignore diff --git a/tests/auto/qwaitcondition/qwaitcondition.pro b/tests/auto/corelib/thread/qwaitcondition/qwaitcondition.pro similarity index 100% rename from tests/auto/qwaitcondition/qwaitcondition.pro rename to tests/auto/corelib/thread/qwaitcondition/qwaitcondition.pro diff --git a/tests/auto/qwaitcondition/tst_qwaitcondition.cpp b/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp similarity index 100% rename from tests/auto/qwaitcondition/tst_qwaitcondition.cpp rename to tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp diff --git a/tests/auto/qwritelocker/.gitignore b/tests/auto/corelib/thread/qwritelocker/.gitignore similarity index 100% rename from tests/auto/qwritelocker/.gitignore rename to tests/auto/corelib/thread/qwritelocker/.gitignore diff --git a/tests/auto/qwritelocker/qwritelocker.pro b/tests/auto/corelib/thread/qwritelocker/qwritelocker.pro similarity index 100% rename from tests/auto/qwritelocker/qwritelocker.pro rename to tests/auto/corelib/thread/qwritelocker/qwritelocker.pro diff --git a/tests/auto/qwritelocker/tst_qwritelocker.cpp b/tests/auto/corelib/thread/qwritelocker/tst_qwritelocker.cpp similarity index 100% rename from tests/auto/qwritelocker/tst_qwritelocker.cpp rename to tests/auto/corelib/thread/qwritelocker/tst_qwritelocker.cpp diff --git a/tests/auto/corelib/thread/thread.pro b/tests/auto/corelib/thread/thread.pro new file mode 100644 index 00000000000..a137748b75a --- /dev/null +++ b/tests/auto/corelib/thread/thread.pro @@ -0,0 +1,14 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qatomicint \ + qatomicpointer \ + qmutex \ + qmutexlocker \ + qreadlocker \ + qreadwritelock \ + qsemaphore \ + qthread \ + qthreadonce \ + qthreadstorage \ + qwaitcondition \ + qwritelocker diff --git a/tests/auto/qalgorithms/.gitignore b/tests/auto/corelib/tools/qalgorithms/.gitignore similarity index 100% rename from tests/auto/qalgorithms/.gitignore rename to tests/auto/corelib/tools/qalgorithms/.gitignore diff --git a/tests/auto/qalgorithms/qalgorithms.pro b/tests/auto/corelib/tools/qalgorithms/qalgorithms.pro similarity index 100% rename from tests/auto/qalgorithms/qalgorithms.pro rename to tests/auto/corelib/tools/qalgorithms/qalgorithms.pro diff --git a/tests/auto/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp similarity index 100% rename from tests/auto/qalgorithms/tst_qalgorithms.cpp rename to tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp diff --git a/tests/auto/qbitarray/.gitignore b/tests/auto/corelib/tools/qbitarray/.gitignore similarity index 100% rename from tests/auto/qbitarray/.gitignore rename to tests/auto/corelib/tools/qbitarray/.gitignore diff --git a/tests/auto/qbitarray/qbitarray.pro b/tests/auto/corelib/tools/qbitarray/qbitarray.pro similarity index 100% rename from tests/auto/qbitarray/qbitarray.pro rename to tests/auto/corelib/tools/qbitarray/qbitarray.pro diff --git a/tests/auto/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp similarity index 100% rename from tests/auto/qbitarray/tst_qbitarray.cpp rename to tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp diff --git a/tests/auto/qbytearray/.gitattributes b/tests/auto/corelib/tools/qbytearray/.gitattributes similarity index 100% rename from tests/auto/qbytearray/.gitattributes rename to tests/auto/corelib/tools/qbytearray/.gitattributes diff --git a/tests/auto/qbytearray/.gitignore b/tests/auto/corelib/tools/qbytearray/.gitignore similarity index 100% rename from tests/auto/qbytearray/.gitignore rename to tests/auto/corelib/tools/qbytearray/.gitignore diff --git a/tests/auto/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro similarity index 100% rename from tests/auto/qbytearray/qbytearray.pro rename to tests/auto/corelib/tools/qbytearray/qbytearray.pro diff --git a/tests/auto/qbytearray/rfc3252.txt b/tests/auto/corelib/tools/qbytearray/rfc3252.txt similarity index 100% rename from tests/auto/qbytearray/rfc3252.txt rename to tests/auto/corelib/tools/qbytearray/rfc3252.txt diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp similarity index 99% rename from tests/auto/qbytearray/tst_qbytearray.cpp rename to tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 78b655419e5..5f036f37fe6 100644 --- a/tests/auto/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -251,6 +251,8 @@ void tst_QByteArray::qUncompress() QSKIP("Corrupt data causes this tests to lock up on Solaris", SkipAll); #elif defined Q_OS_QNX QSKIP("Corrupt data causes this test to lock up on QNX", SkipAll); +#elif defined Q_OS_WIN + QSKIP("Corrupt data causes this test to lock up on Windows", SkipAll); #endif QByteArray res; diff --git a/tests/auto/qbytearraymatcher/qbytearraymatcher.pro b/tests/auto/corelib/tools/qbytearraymatcher/qbytearraymatcher.pro similarity index 100% rename from tests/auto/qbytearraymatcher/qbytearraymatcher.pro rename to tests/auto/corelib/tools/qbytearraymatcher/qbytearraymatcher.pro diff --git a/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp b/tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp similarity index 97% rename from tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp rename to tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp index ff6de8e9f4c..09a3dfdf7d4 100644 --- a/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp +++ b/tests/auto/corelib/tools/qbytearraymatcher/tst_qbytearraymatcher.cpp @@ -44,6 +44,11 @@ #include <qbytearraymatcher.h> +// COM interface +#if defined(Q_OS_WIN) && defined(interface) +# undef interface +#endif + class tst_QByteArrayMatcher : public QObject { Q_OBJECT diff --git a/tests/auto/qcache/.gitignore b/tests/auto/corelib/tools/qcache/.gitignore similarity index 100% rename from tests/auto/qcache/.gitignore rename to tests/auto/corelib/tools/qcache/.gitignore diff --git a/tests/auto/qcache/qcache.pro b/tests/auto/corelib/tools/qcache/qcache.pro similarity index 100% rename from tests/auto/qcache/qcache.pro rename to tests/auto/corelib/tools/qcache/qcache.pro diff --git a/tests/auto/qcache/tst_qcache.cpp b/tests/auto/corelib/tools/qcache/tst_qcache.cpp similarity index 100% rename from tests/auto/qcache/tst_qcache.cpp rename to tests/auto/corelib/tools/qcache/tst_qcache.cpp diff --git a/tests/auto/qchar/.gitignore b/tests/auto/corelib/tools/qchar/.gitignore similarity index 100% rename from tests/auto/qchar/.gitignore rename to tests/auto/corelib/tools/qchar/.gitignore diff --git a/tests/auto/qchar/NormalizationTest.txt b/tests/auto/corelib/tools/qchar/NormalizationTest.txt similarity index 100% rename from tests/auto/qchar/NormalizationTest.txt rename to tests/auto/corelib/tools/qchar/NormalizationTest.txt diff --git a/tests/auto/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro similarity index 100% rename from tests/auto/qchar/qchar.pro rename to tests/auto/corelib/tools/qchar/qchar.pro diff --git a/tests/auto/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp similarity index 100% rename from tests/auto/qchar/tst_qchar.cpp rename to tests/auto/corelib/tools/qchar/tst_qchar.cpp diff --git a/tests/auto/qcontiguouscache/qcontiguouscache.pro b/tests/auto/corelib/tools/qcontiguouscache/qcontiguouscache.pro similarity index 100% rename from tests/auto/qcontiguouscache/qcontiguouscache.pro rename to tests/auto/corelib/tools/qcontiguouscache/qcontiguouscache.pro diff --git a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp similarity index 100% rename from tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp rename to tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp diff --git a/tests/auto/qcryptographichash/.gitignore b/tests/auto/corelib/tools/qcryptographichash/.gitignore similarity index 100% rename from tests/auto/qcryptographichash/.gitignore rename to tests/auto/corelib/tools/qcryptographichash/.gitignore diff --git a/tests/auto/qcryptographichash/qcryptographichash.pro b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro similarity index 100% rename from tests/auto/qcryptographichash/qcryptographichash.pro rename to tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro diff --git a/tests/auto/qcryptographichash/tst_qcryptographichash.cpp b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp similarity index 100% rename from tests/auto/qcryptographichash/tst_qcryptographichash.cpp rename to tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp diff --git a/tests/auto/qdate/.gitignore b/tests/auto/corelib/tools/qdate/.gitignore similarity index 100% rename from tests/auto/qdate/.gitignore rename to tests/auto/corelib/tools/qdate/.gitignore diff --git a/tests/auto/qdate/qdate.pro b/tests/auto/corelib/tools/qdate/qdate.pro similarity index 100% rename from tests/auto/qdate/qdate.pro rename to tests/auto/corelib/tools/qdate/qdate.pro diff --git a/tests/auto/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp similarity index 100% rename from tests/auto/qdate/tst_qdate.cpp rename to tests/auto/corelib/tools/qdate/tst_qdate.cpp diff --git a/tests/auto/qdatetime/.gitignore b/tests/auto/corelib/tools/qdatetime/.gitignore similarity index 100% rename from tests/auto/qdatetime/.gitignore rename to tests/auto/corelib/tools/qdatetime/.gitignore diff --git a/tests/auto/qdatetime/qdatetime.pro b/tests/auto/corelib/tools/qdatetime/qdatetime.pro similarity index 100% rename from tests/auto/qdatetime/qdatetime.pro rename to tests/auto/corelib/tools/qdatetime/qdatetime.pro diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp similarity index 100% rename from tests/auto/qdatetime/tst_qdatetime.cpp rename to tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp diff --git a/tests/auto/qeasingcurve/qeasingcurve.pro b/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro similarity index 100% rename from tests/auto/qeasingcurve/qeasingcurve.pro rename to tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp similarity index 100% rename from tests/auto/qeasingcurve/tst_qeasingcurve.cpp rename to tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp diff --git a/tests/auto/qelapsedtimer/qelapsedtimer.pro b/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro similarity index 100% rename from tests/auto/qelapsedtimer/qelapsedtimer.pro rename to tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp similarity index 100% rename from tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp rename to tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp diff --git a/tests/auto/qexplicitlyshareddatapointer/.gitignore b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/.gitignore similarity index 100% rename from tests/auto/qexplicitlyshareddatapointer/.gitignore rename to tests/auto/corelib/tools/qexplicitlyshareddatapointer/.gitignore diff --git a/tests/auto/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro similarity index 100% rename from tests/auto/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro rename to tests/auto/corelib/tools/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro diff --git a/tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp similarity index 100% rename from tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp rename to tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp diff --git a/tests/auto/corelib/tools/qfreelist/qfreelist.pro b/tests/auto/corelib/tools/qfreelist/qfreelist.pro new file mode 100644 index 00000000000..0afa12b8a8b --- /dev/null +++ b/tests/auto/corelib/tools/qfreelist/qfreelist.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +SOURCES += tst_qfreelist.cpp +QT += core-private +QT -= gui +!contains(QT_CONFIG,private_tests): SOURCES += $$QT.core.sources/tools/qfreelist.cpp diff --git a/tests/auto/qfreelist/tst_qfreelist.cpp b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp similarity index 100% rename from tests/auto/qfreelist/tst_qfreelist.cpp rename to tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp diff --git a/tests/auto/qhash/.gitignore b/tests/auto/corelib/tools/qhash/.gitignore similarity index 100% rename from tests/auto/qhash/.gitignore rename to tests/auto/corelib/tools/qhash/.gitignore diff --git a/tests/auto/qhash/qhash.pro b/tests/auto/corelib/tools/qhash/qhash.pro similarity index 100% rename from tests/auto/qhash/qhash.pro rename to tests/auto/corelib/tools/qhash/qhash.pro diff --git a/tests/auto/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp similarity index 100% rename from tests/auto/qhash/tst_qhash.cpp rename to tests/auto/corelib/tools/qhash/tst_qhash.cpp diff --git a/tests/auto/qline/.gitignore b/tests/auto/corelib/tools/qline/.gitignore similarity index 100% rename from tests/auto/qline/.gitignore rename to tests/auto/corelib/tools/qline/.gitignore diff --git a/tests/auto/qline/qline.pro b/tests/auto/corelib/tools/qline/qline.pro similarity index 100% rename from tests/auto/qline/qline.pro rename to tests/auto/corelib/tools/qline/qline.pro diff --git a/tests/auto/qline/tst_qline.cpp b/tests/auto/corelib/tools/qline/tst_qline.cpp similarity index 100% rename from tests/auto/qline/tst_qline.cpp rename to tests/auto/corelib/tools/qline/tst_qline.cpp diff --git a/tests/auto/qlist/.gitignore b/tests/auto/corelib/tools/qlist/.gitignore similarity index 100% rename from tests/auto/qlist/.gitignore rename to tests/auto/corelib/tools/qlist/.gitignore diff --git a/tests/auto/qlist/qlist.pro b/tests/auto/corelib/tools/qlist/qlist.pro similarity index 100% rename from tests/auto/qlist/qlist.pro rename to tests/auto/corelib/tools/qlist/qlist.pro diff --git a/tests/auto/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp similarity index 100% rename from tests/auto/qlist/tst_qlist.cpp rename to tests/auto/corelib/tools/qlist/tst_qlist.cpp diff --git a/tests/auto/qlocale/.gitignore b/tests/auto/corelib/tools/qlocale/.gitignore similarity index 100% rename from tests/auto/qlocale/.gitignore rename to tests/auto/corelib/tools/qlocale/.gitignore diff --git a/tests/auto/qlocale/qlocale.pro b/tests/auto/corelib/tools/qlocale/qlocale.pro similarity index 100% rename from tests/auto/qlocale/qlocale.pro rename to tests/auto/corelib/tools/qlocale/qlocale.pro diff --git a/tests/auto/qlocale/syslocaleapp/syslocaleapp.cpp b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.cpp similarity index 100% rename from tests/auto/qlocale/syslocaleapp/syslocaleapp.cpp rename to tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.cpp diff --git a/tests/auto/qlocale/syslocaleapp/syslocaleapp.pro b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro similarity index 100% rename from tests/auto/qlocale/syslocaleapp/syslocaleapp.pro rename to tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro diff --git a/tests/auto/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro similarity index 100% rename from tests/auto/qlocale/test/test.pro rename to tests/auto/corelib/tools/qlocale/test/test.pro diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp similarity index 100% rename from tests/auto/qlocale/tst_qlocale.cpp rename to tests/auto/corelib/tools/qlocale/tst_qlocale.cpp diff --git a/tests/auto/qmap/.gitignore b/tests/auto/corelib/tools/qmap/.gitignore similarity index 100% rename from tests/auto/qmap/.gitignore rename to tests/auto/corelib/tools/qmap/.gitignore diff --git a/tests/auto/qmap/qmap.pro b/tests/auto/corelib/tools/qmap/qmap.pro similarity index 100% rename from tests/auto/qmap/qmap.pro rename to tests/auto/corelib/tools/qmap/qmap.pro diff --git a/tests/auto/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp similarity index 100% rename from tests/auto/qmap/tst_qmap.cpp rename to tests/auto/corelib/tools/qmap/tst_qmap.cpp diff --git a/tests/auto/qmargins/qmargins.pro b/tests/auto/corelib/tools/qmargins/qmargins.pro similarity index 100% rename from tests/auto/qmargins/qmargins.pro rename to tests/auto/corelib/tools/qmargins/qmargins.pro diff --git a/tests/auto/qmargins/tst_qmargins.cpp b/tests/auto/corelib/tools/qmargins/tst_qmargins.cpp similarity index 100% rename from tests/auto/qmargins/tst_qmargins.cpp rename to tests/auto/corelib/tools/qmargins/tst_qmargins.cpp diff --git a/tests/auto/qpoint/.gitignore b/tests/auto/corelib/tools/qpoint/.gitignore similarity index 100% rename from tests/auto/qpoint/.gitignore rename to tests/auto/corelib/tools/qpoint/.gitignore diff --git a/tests/auto/qpoint/qpoint.pro b/tests/auto/corelib/tools/qpoint/qpoint.pro similarity index 100% rename from tests/auto/qpoint/qpoint.pro rename to tests/auto/corelib/tools/qpoint/qpoint.pro diff --git a/tests/auto/qpoint/tst_qpoint.cpp b/tests/auto/corelib/tools/qpoint/tst_qpoint.cpp similarity index 100% rename from tests/auto/qpoint/tst_qpoint.cpp rename to tests/auto/corelib/tools/qpoint/tst_qpoint.cpp diff --git a/tests/auto/qqueue/.gitignore b/tests/auto/corelib/tools/qqueue/.gitignore similarity index 100% rename from tests/auto/qqueue/.gitignore rename to tests/auto/corelib/tools/qqueue/.gitignore diff --git a/tests/auto/qqueue/qqueue.pro b/tests/auto/corelib/tools/qqueue/qqueue.pro similarity index 100% rename from tests/auto/qqueue/qqueue.pro rename to tests/auto/corelib/tools/qqueue/qqueue.pro diff --git a/tests/auto/qqueue/tst_qqueue.cpp b/tests/auto/corelib/tools/qqueue/tst_qqueue.cpp similarity index 100% rename from tests/auto/qqueue/tst_qqueue.cpp rename to tests/auto/corelib/tools/qqueue/tst_qqueue.cpp diff --git a/tests/auto/qrect/.gitignore b/tests/auto/corelib/tools/qrect/.gitignore similarity index 100% rename from tests/auto/qrect/.gitignore rename to tests/auto/corelib/tools/qrect/.gitignore diff --git a/tests/auto/qrect/qrect.pro b/tests/auto/corelib/tools/qrect/qrect.pro similarity index 100% rename from tests/auto/qrect/qrect.pro rename to tests/auto/corelib/tools/qrect/qrect.pro diff --git a/tests/auto/qrect/tst_qrect.cpp b/tests/auto/corelib/tools/qrect/tst_qrect.cpp similarity index 100% rename from tests/auto/qrect/tst_qrect.cpp rename to tests/auto/corelib/tools/qrect/tst_qrect.cpp diff --git a/tests/auto/qregexp/.gitignore b/tests/auto/corelib/tools/qregexp/.gitignore similarity index 100% rename from tests/auto/qregexp/.gitignore rename to tests/auto/corelib/tools/qregexp/.gitignore diff --git a/tests/auto/qregexp/qregexp.pro b/tests/auto/corelib/tools/qregexp/qregexp.pro similarity index 100% rename from tests/auto/qregexp/qregexp.pro rename to tests/auto/corelib/tools/qregexp/qregexp.pro diff --git a/tests/auto/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp similarity index 100% rename from tests/auto/qregexp/tst_qregexp.cpp rename to tests/auto/corelib/tools/qregexp/tst_qregexp.cpp diff --git a/tests/auto/qringbuffer/qringbuffer.pro b/tests/auto/corelib/tools/qringbuffer/qringbuffer.pro similarity index 100% rename from tests/auto/qringbuffer/qringbuffer.pro rename to tests/auto/corelib/tools/qringbuffer/qringbuffer.pro diff --git a/tests/auto/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp similarity index 100% rename from tests/auto/qringbuffer/tst_qringbuffer.cpp rename to tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp diff --git a/tests/auto/qscopedpointer/.gitignore b/tests/auto/corelib/tools/qscopedpointer/.gitignore similarity index 100% rename from tests/auto/qscopedpointer/.gitignore rename to tests/auto/corelib/tools/qscopedpointer/.gitignore diff --git a/tests/auto/qscopedpointer/qscopedpointer.pro b/tests/auto/corelib/tools/qscopedpointer/qscopedpointer.pro similarity index 100% rename from tests/auto/qscopedpointer/qscopedpointer.pro rename to tests/auto/corelib/tools/qscopedpointer/qscopedpointer.pro diff --git a/tests/auto/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp similarity index 100% rename from tests/auto/qscopedpointer/tst_qscopedpointer.cpp rename to tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp diff --git a/tests/auto/qscopedvaluerollback/qscopedvaluerollback.pro b/tests/auto/corelib/tools/qscopedvaluerollback/qscopedvaluerollback.pro similarity index 100% rename from tests/auto/qscopedvaluerollback/qscopedvaluerollback.pro rename to tests/auto/corelib/tools/qscopedvaluerollback/qscopedvaluerollback.pro diff --git a/tests/auto/qscopedvaluerollback/tst_qscopedvaluerollback.cpp b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp similarity index 100% rename from tests/auto/qscopedvaluerollback/tst_qscopedvaluerollback.cpp rename to tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp diff --git a/tests/auto/qset/.gitignore b/tests/auto/corelib/tools/qset/.gitignore similarity index 100% rename from tests/auto/qset/.gitignore rename to tests/auto/corelib/tools/qset/.gitignore diff --git a/tests/auto/qset/qset.pro b/tests/auto/corelib/tools/qset/qset.pro similarity index 100% rename from tests/auto/qset/qset.pro rename to tests/auto/corelib/tools/qset/qset.pro diff --git a/tests/auto/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp similarity index 100% rename from tests/auto/qset/tst_qset.cpp rename to tests/auto/corelib/tools/qset/tst_qset.cpp diff --git a/tests/auto/qsharedpointer/.gitignore b/tests/auto/corelib/tools/qsharedpointer/.gitignore similarity index 100% rename from tests/auto/qsharedpointer/.gitignore rename to tests/auto/corelib/tools/qsharedpointer/.gitignore diff --git a/tests/auto/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp similarity index 100% rename from tests/auto/qsharedpointer/externaltests.cpp rename to tests/auto/corelib/tools/qsharedpointer/externaltests.cpp diff --git a/tests/auto/qsharedpointer/externaltests.h b/tests/auto/corelib/tools/qsharedpointer/externaltests.h similarity index 100% rename from tests/auto/qsharedpointer/externaltests.h rename to tests/auto/corelib/tools/qsharedpointer/externaltests.h diff --git a/tests/auto/qsharedpointer/externaltests.pri b/tests/auto/corelib/tools/qsharedpointer/externaltests.pri similarity index 100% rename from tests/auto/qsharedpointer/externaltests.pri rename to tests/auto/corelib/tools/qsharedpointer/externaltests.pri diff --git a/tests/auto/qsharedpointer/forwarddeclaration.cpp b/tests/auto/corelib/tools/qsharedpointer/forwarddeclaration.cpp similarity index 100% rename from tests/auto/qsharedpointer/forwarddeclaration.cpp rename to tests/auto/corelib/tools/qsharedpointer/forwarddeclaration.cpp diff --git a/tests/auto/qsharedpointer/forwarddeclared.cpp b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp similarity index 100% rename from tests/auto/qsharedpointer/forwarddeclared.cpp rename to tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp diff --git a/tests/auto/qsharedpointer/forwarddeclared.h b/tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h similarity index 100% rename from tests/auto/qsharedpointer/forwarddeclared.h rename to tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h diff --git a/tests/auto/qsharedpointer/qsharedpointer.pro b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro similarity index 86% rename from tests/auto/qsharedpointer/qsharedpointer.pro rename to tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro index 014006e7828..fc791f485c4 100644 --- a/tests/auto/qsharedpointer/qsharedpointer.pro +++ b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro @@ -13,3 +13,5 @@ QT = core include(externaltests.pri) CONFIG += parallel_test + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp similarity index 100% rename from tests/auto/qsharedpointer/tst_qsharedpointer.cpp rename to tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp diff --git a/tests/auto/qsharedpointer/wrapper.cpp b/tests/auto/corelib/tools/qsharedpointer/wrapper.cpp similarity index 100% rename from tests/auto/qsharedpointer/wrapper.cpp rename to tests/auto/corelib/tools/qsharedpointer/wrapper.cpp diff --git a/tests/auto/qsharedpointer/wrapper.h b/tests/auto/corelib/tools/qsharedpointer/wrapper.h similarity index 100% rename from tests/auto/qsharedpointer/wrapper.h rename to tests/auto/corelib/tools/qsharedpointer/wrapper.h diff --git a/tests/auto/qsize/.gitignore b/tests/auto/corelib/tools/qsize/.gitignore similarity index 100% rename from tests/auto/qsize/.gitignore rename to tests/auto/corelib/tools/qsize/.gitignore diff --git a/tests/auto/qsize/qsize.pro b/tests/auto/corelib/tools/qsize/qsize.pro similarity index 100% rename from tests/auto/qsize/qsize.pro rename to tests/auto/corelib/tools/qsize/qsize.pro diff --git a/tests/auto/qsize/tst_qsize.cpp b/tests/auto/corelib/tools/qsize/tst_qsize.cpp similarity index 100% rename from tests/auto/qsize/tst_qsize.cpp rename to tests/auto/corelib/tools/qsize/tst_qsize.cpp diff --git a/tests/auto/qsizef/.gitignore b/tests/auto/corelib/tools/qsizef/.gitignore similarity index 100% rename from tests/auto/qsizef/.gitignore rename to tests/auto/corelib/tools/qsizef/.gitignore diff --git a/tests/auto/qsizef/qsizef.pro b/tests/auto/corelib/tools/qsizef/qsizef.pro similarity index 100% rename from tests/auto/qsizef/qsizef.pro rename to tests/auto/corelib/tools/qsizef/qsizef.pro diff --git a/tests/auto/qsizef/tst_qsizef.cpp b/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp similarity index 100% rename from tests/auto/qsizef/tst_qsizef.cpp rename to tests/auto/corelib/tools/qsizef/tst_qsizef.cpp diff --git a/tests/auto/qstl/.gitignore b/tests/auto/corelib/tools/qstl/.gitignore similarity index 100% rename from tests/auto/qstl/.gitignore rename to tests/auto/corelib/tools/qstl/.gitignore diff --git a/tests/auto/qstl/qstl.pro b/tests/auto/corelib/tools/qstl/qstl.pro similarity index 100% rename from tests/auto/qstl/qstl.pro rename to tests/auto/corelib/tools/qstl/qstl.pro diff --git a/tests/auto/qstl/tst_qstl.cpp b/tests/auto/corelib/tools/qstl/tst_qstl.cpp similarity index 100% rename from tests/auto/qstl/tst_qstl.cpp rename to tests/auto/corelib/tools/qstl/tst_qstl.cpp diff --git a/tests/auto/qstring/.gitignore b/tests/auto/corelib/tools/qstring/.gitignore similarity index 100% rename from tests/auto/qstring/.gitignore rename to tests/auto/corelib/tools/qstring/.gitignore diff --git a/tests/auto/qstring/double_data.h b/tests/auto/corelib/tools/qstring/double_data.h similarity index 100% rename from tests/auto/qstring/double_data.h rename to tests/auto/corelib/tools/qstring/double_data.h diff --git a/tests/auto/qstring/qstring.pro b/tests/auto/corelib/tools/qstring/qstring.pro similarity index 100% rename from tests/auto/qstring/qstring.pro rename to tests/auto/corelib/tools/qstring/qstring.pro diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp similarity index 99% rename from tests/auto/qstring/tst_qstring.cpp rename to tests/auto/corelib/tools/qstring/tst_qstring.cpp index 844624ab455..5ef8d70ef69 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -235,7 +235,7 @@ Q_DECLARE_METATYPE(IntList) #include <float.h> #include <limits.h> #include <math.h> -#if defined (Q_WS_WIN) +#if defined (Q_OS_WIN) # include <windows.h> // mingw defines NAN and INFINITY to 0/0 and x/0 # if defined(Q_CC_GNU) @@ -3462,10 +3462,6 @@ void tst_QString::toLatin1Roundtrip_data() static const ushort unicode6[] = { 0x180, 0x1ff, 0x8001, 0x8080, 0xfffc }; QTest::newRow("non-latin1b") << QByteArray("?????") << QString::fromUtf16(unicode6, 5) << questionmarks; - - static const ushort unicode7[] = { 'H', 'e', 'l', 'l', 'o', 0x100, 0x17f, 0x180, 0x8080, 0xfffc }; - static const ushort unicode7q[] = { 'H', 'e', 'l', 'l', 'o', '?', '?', '?', '?', '?' }; - QTest::newRow("mixed") << QByteArray("Hello?????") << QString::fromUtf16(unicode7, 10) << QString::fromUtf16(unicode7q, 10); } void tst_QString::toLatin1Roundtrip() diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder.pro new file mode 100644 index 00000000000..d73d541502f --- /dev/null +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder.pro @@ -0,0 +1,6 @@ +TEMPLATE=subdirs +SUBDIRS= \ + qstringbuilder1 \ + qstringbuilder2 \ + qstringbuilder3 \ + qstringbuilder4 diff --git a/tests/auto/qstringbuilder1/qstringbuilder1.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/qstringbuilder1.pro similarity index 100% rename from tests/auto/qstringbuilder1/qstringbuilder1.pro rename to tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/qstringbuilder1.pro diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp similarity index 100% rename from tests/auto/qstringbuilder1/stringbuilder.cpp rename to tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp diff --git a/tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp similarity index 100% rename from tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp rename to tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp diff --git a/tests/auto/qstringbuilder2/qstringbuilder2.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/qstringbuilder2.pro similarity index 100% rename from tests/auto/qstringbuilder2/qstringbuilder2.pro rename to tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/qstringbuilder2.pro diff --git a/tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp similarity index 100% rename from tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp rename to tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp diff --git a/tests/auto/qstringbuilder3/qstringbuilder3.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/qstringbuilder3.pro similarity index 100% rename from tests/auto/qstringbuilder3/qstringbuilder3.pro rename to tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/qstringbuilder3.pro diff --git a/tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp similarity index 100% rename from tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp rename to tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp diff --git a/tests/auto/qstringbuilder4/qstringbuilder4.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/qstringbuilder4.pro similarity index 100% rename from tests/auto/qstringbuilder4/qstringbuilder4.pro rename to tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/qstringbuilder4.pro diff --git a/tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp similarity index 100% rename from tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp rename to tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp diff --git a/tests/auto/qstringlist/.gitignore b/tests/auto/corelib/tools/qstringlist/.gitignore similarity index 100% rename from tests/auto/qstringlist/.gitignore rename to tests/auto/corelib/tools/qstringlist/.gitignore diff --git a/tests/auto/qstringlist/qstringlist.pro b/tests/auto/corelib/tools/qstringlist/qstringlist.pro similarity index 100% rename from tests/auto/qstringlist/qstringlist.pro rename to tests/auto/corelib/tools/qstringlist/qstringlist.pro diff --git a/tests/auto/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp similarity index 100% rename from tests/auto/qstringlist/tst_qstringlist.cpp rename to tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp diff --git a/tests/auto/qstringmatcher/.gitignore b/tests/auto/corelib/tools/qstringmatcher/.gitignore similarity index 100% rename from tests/auto/qstringmatcher/.gitignore rename to tests/auto/corelib/tools/qstringmatcher/.gitignore diff --git a/tests/auto/qstringmatcher/qstringmatcher.pro b/tests/auto/corelib/tools/qstringmatcher/qstringmatcher.pro similarity index 100% rename from tests/auto/qstringmatcher/qstringmatcher.pro rename to tests/auto/corelib/tools/qstringmatcher/qstringmatcher.pro diff --git a/tests/auto/qstringmatcher/tst_qstringmatcher.cpp b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp similarity index 100% rename from tests/auto/qstringmatcher/tst_qstringmatcher.cpp rename to tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp diff --git a/tests/auto/qstringref/qstringref.pro b/tests/auto/corelib/tools/qstringref/qstringref.pro similarity index 100% rename from tests/auto/qstringref/qstringref.pro rename to tests/auto/corelib/tools/qstringref/qstringref.pro diff --git a/tests/auto/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp similarity index 100% rename from tests/auto/qstringref/tst_qstringref.cpp rename to tests/auto/corelib/tools/qstringref/tst_qstringref.cpp diff --git a/tests/auto/qtextboundaryfinder/.gitignore b/tests/auto/corelib/tools/qtextboundaryfinder/.gitignore similarity index 100% rename from tests/auto/qtextboundaryfinder/.gitignore rename to tests/auto/corelib/tools/qtextboundaryfinder/.gitignore diff --git a/tests/auto/qtextboundaryfinder/data/GraphemeBreakTest.txt b/tests/auto/corelib/tools/qtextboundaryfinder/data/GraphemeBreakTest.txt similarity index 100% rename from tests/auto/qtextboundaryfinder/data/GraphemeBreakTest.txt rename to tests/auto/corelib/tools/qtextboundaryfinder/data/GraphemeBreakTest.txt diff --git a/tests/auto/qtextboundaryfinder/data/SentenceBreakTest.txt b/tests/auto/corelib/tools/qtextboundaryfinder/data/SentenceBreakTest.txt similarity index 100% rename from tests/auto/qtextboundaryfinder/data/SentenceBreakTest.txt rename to tests/auto/corelib/tools/qtextboundaryfinder/data/SentenceBreakTest.txt diff --git a/tests/auto/qtextboundaryfinder/data/WordBreakTest.txt b/tests/auto/corelib/tools/qtextboundaryfinder/data/WordBreakTest.txt similarity index 100% rename from tests/auto/qtextboundaryfinder/data/WordBreakTest.txt rename to tests/auto/corelib/tools/qtextboundaryfinder/data/WordBreakTest.txt diff --git a/tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro similarity index 100% rename from tests/auto/qtextboundaryfinder/qtextboundaryfinder.pro rename to tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro diff --git a/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp similarity index 100% rename from tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp rename to tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp diff --git a/tests/auto/qtime/.gitignore b/tests/auto/corelib/tools/qtime/.gitignore similarity index 100% rename from tests/auto/qtime/.gitignore rename to tests/auto/corelib/tools/qtime/.gitignore diff --git a/tests/auto/qtime/qtime.pro b/tests/auto/corelib/tools/qtime/qtime.pro similarity index 100% rename from tests/auto/qtime/qtime.pro rename to tests/auto/corelib/tools/qtime/qtime.pro diff --git a/tests/auto/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp similarity index 100% rename from tests/auto/qtime/tst_qtime.cpp rename to tests/auto/corelib/tools/qtime/tst_qtime.cpp diff --git a/tests/auto/qtimeline/.gitignore b/tests/auto/corelib/tools/qtimeline/.gitignore similarity index 100% rename from tests/auto/qtimeline/.gitignore rename to tests/auto/corelib/tools/qtimeline/.gitignore diff --git a/tests/auto/qtimeline/qtimeline.pro b/tests/auto/corelib/tools/qtimeline/qtimeline.pro similarity index 100% rename from tests/auto/qtimeline/qtimeline.pro rename to tests/auto/corelib/tools/qtimeline/qtimeline.pro diff --git a/tests/auto/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp similarity index 100% rename from tests/auto/qtimeline/tst_qtimeline.cpp rename to tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp diff --git a/tests/auto/qvarlengtharray/.gitignore b/tests/auto/corelib/tools/qvarlengtharray/.gitignore similarity index 100% rename from tests/auto/qvarlengtharray/.gitignore rename to tests/auto/corelib/tools/qvarlengtharray/.gitignore diff --git a/tests/auto/qvarlengtharray/qvarlengtharray.pro b/tests/auto/corelib/tools/qvarlengtharray/qvarlengtharray.pro similarity index 100% rename from tests/auto/qvarlengtharray/qvarlengtharray.pro rename to tests/auto/corelib/tools/qvarlengtharray/qvarlengtharray.pro diff --git a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp similarity index 100% rename from tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp rename to tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp diff --git a/tests/auto/qvector/.gitignore b/tests/auto/corelib/tools/qvector/.gitignore similarity index 100% rename from tests/auto/qvector/.gitignore rename to tests/auto/corelib/tools/qvector/.gitignore diff --git a/tests/auto/qvector/qvector.pro b/tests/auto/corelib/tools/qvector/qvector.pro similarity index 100% rename from tests/auto/qvector/qvector.pro rename to tests/auto/corelib/tools/qvector/qvector.pro diff --git a/tests/auto/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp similarity index 100% rename from tests/auto/qvector/tst_qvector.cpp rename to tests/auto/corelib/tools/qvector/tst_qvector.cpp diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro new file mode 100644 index 00000000000..930799e3b33 --- /dev/null +++ b/tests/auto/corelib/tools/tools.pro @@ -0,0 +1,44 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qalgorithms \ + qbitarray \ + qbytearray \ + qbytearraymatcher \ + qcache \ + qchar \ + qcontiguouscache \ + qcryptographichash \ + qdate \ + qdatetime \ + qeasingcurve \ + qelapsedtimer \ + qexplicitlyshareddatapointer \ + qfreelist \ + qhash \ + qline \ + qlist \ + qlocale \ + qmap \ + qmargins \ + qpoint \ + qqueue \ + qrect \ + qregexp \ + qringbuffer \ + qscopedpointer \ + qscopedvaluerollback \ + qset \ + qsharedpointer \ + qsize \ + qsizef \ + qstl \ + qstring \ + qstringbuilder \ + qstringlist \ + qstringmatcher \ + qstringref \ + qtextboundaryfinder \ + qtime \ + qtimeline \ + qvarlengtharray \ + qvector diff --git a/tests/auto/qxmlstream/.gitattributes b/tests/auto/corelib/xml/qxmlstream/.gitattributes similarity index 100% rename from tests/auto/qxmlstream/.gitattributes rename to tests/auto/corelib/xml/qxmlstream/.gitattributes diff --git a/tests/auto/qxmlstream/.gitignore b/tests/auto/corelib/xml/qxmlstream/.gitignore similarity index 100% rename from tests/auto/qxmlstream/.gitignore rename to tests/auto/corelib/xml/qxmlstream/.gitignore diff --git a/tests/auto/qxmlstream/XML-Test-Suite-LICENSE.txt b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite-LICENSE.txt similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite-LICENSE.txt rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite-LICENSE.txt diff --git a/tests/auto/qxmlstream/XML-Test-Suite/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/matrix.html b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/matrix.html similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/matrix.html rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/matrix.html diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/changes.html b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/changes.html similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/changes.html rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/changes.html diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E14.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E14.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E14.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E14.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15a.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15a.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15a.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15a.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15b.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15b.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15b.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15b.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15c.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15c.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15c.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15c.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15d.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15d.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15d.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15d.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15e.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15e.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15e.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15e.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15f.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15f.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15f.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15f.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15g.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15g.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15g.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15g.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15h.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15h.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15h.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15h.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15i.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15i.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15i.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15i.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15j.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15j.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15j.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15j.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15k.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15k.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15k.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15k.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15l.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15l.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15l.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E15l.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E18-ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E18-ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E18-ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E18-ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E19.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E19.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E19.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E19.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E27.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E27.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E27.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E27.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E29.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E29.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E29.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E29.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E2a.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E2a.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E2a.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E2a.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E2b.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E2b.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E2b.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E2b.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E34.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E34.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E34.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E34.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E36.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E36.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E36.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E36.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E36.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E36.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E36.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E36.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E38.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E38.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E38.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E38.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E38.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E38.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E38.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E38.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E41.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E41.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E41.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E41.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E48.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E48.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E48.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E48.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E50.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E50.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E50.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E50.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E55.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E55.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E55.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E55.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E57.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E57.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E57.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E57.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E60.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E60.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E60.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E60.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E60.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E60.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E60.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E60.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E61.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E61.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E61.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E61.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E9a.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E9a.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E9a.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E9a.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E9b.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E9b.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E9b.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/E9b.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/errata2e.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/errata2e.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/errata2e.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/errata2e.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/out/E24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/E18-ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/E18-ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/E18-ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/E18-ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/E18-pe b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/E18-pe similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/E18-pe rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir1/E18-pe diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/E18-ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/E18-ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/E18-ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/E18-ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/E18-extpe b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/E18-extpe similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/E18-extpe rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/subdir2/E18-extpe diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/testcases.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/testcases.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/testcases.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/testcases.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/xmlconf.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/xmlconf.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/xmlconf.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-2e/xmlconf.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E05a.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E05a.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E05a.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E05a.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E05b.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E05b.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E05b.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E05b.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06a.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06a.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06a.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06a.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06b.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06b.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06b.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06b.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06c.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06c.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06c.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06c.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06d.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06d.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06d.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06d.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06e.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06e.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06e.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06e.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06f.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06f.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06f.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06f.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06g.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06g.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06g.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06g.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06h.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06h.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06h.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06h.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06i.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06i.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06i.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E06i.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/E13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/errata3e.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/errata3e.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/errata3e.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/errata3e.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/testcases.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/testcases.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/testcases.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/testcases.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/xmlconf.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/xmlconf.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/xmlconf.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/errata-3e/xmlconf.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/001.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/002.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/003.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/004.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/005.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/006.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/007.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/008.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/008.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/008.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/008.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/009.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/009.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/009.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/009.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/010.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/011.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/011.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/011.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/011.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/012.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/012.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/012.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/012.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/013.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/013.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/013.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/013.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/014.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/014.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/014.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/014.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/015.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/015.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/015.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/015.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/016.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/016.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/016.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/016.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/017.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/017.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/017.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/017.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/018.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/018.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/018.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/018.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/019.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/019.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/019.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/019.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/020.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/020.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/020.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/020.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/021.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/021.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/021.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/021.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/022.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/022.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/022.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/022.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/023.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/023.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/023.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/023.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/024.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/024.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/024.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/024.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/025.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/025.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/025.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/025.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/026.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/026.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/026.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/026.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/027.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/027.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/027.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/027.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/028.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/028.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/028.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/028.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/029.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/029.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/029.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/029.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/030.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/030.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/030.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/030.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/031.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/031.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/031.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/031.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/032.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/032.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/032.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/032.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/033.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/033.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/033.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/033.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/034.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/034.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/034.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/034.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/035.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/035.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/035.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/035.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/036.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/036.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/036.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/036.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/037.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/037.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/037.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/037.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/038.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/038.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/038.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/038.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/039.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/039.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/039.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/039.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/040.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/040.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/040.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/040.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/041.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/041.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/041.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/041.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/042.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/042.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/042.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/042.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/043.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/043.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/043.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/043.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/044.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/044.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/044.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/044.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/045.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/045.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/045.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/045.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/046.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/046.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/046.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/046.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/rmt-ns10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/rmt-ns10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/rmt-ns10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.0/rmt-ns10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/001.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/002.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/003.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/004.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/005.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/006.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/rmt-ns11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/rmt-ns11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/rmt-ns11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/1.1/rmt-ns11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Entries.Log b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Entries.Log similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Entries.Log rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Entries.Log diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13a.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13a.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13a.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13a.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13b.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13b.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13b.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13b.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13c.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13c.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13c.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/NE13c.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/errata1e.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/errata1e.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/errata1e.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/errata1e.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/testcases.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/testcases.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/testcases.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/testcases.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/xmlconf.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/xmlconf.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/xmlconf.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/errata-1e/xmlconf.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/testcases.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/testcases.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/testcases.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/testcases.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/xmlconf.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/xmlconf.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/xmlconf.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/namespaces/xmlconf.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/001.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/001.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/001.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/001.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/001.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/002.pe b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/002.pe similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/002.pe rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/002.pe diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/002.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/003.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/003.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/003.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/003.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/003.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/004.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/004.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/004.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/004.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/004.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005_1.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005_1.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005_1.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005_1.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005_2.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005_2.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005_2.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/005_2.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006_1.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006_1.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006_1.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006_1.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006_2.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006_2.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006_2.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/006_2.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/007.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/008.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/008.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/008.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/008.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/009.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/009.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/009.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/009.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/009.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/009.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/009.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/009.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/010.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/011.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/011.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/011.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/011.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/012.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/012.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/012.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/012.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/013.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/013.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/013.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/013.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/014.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/014.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/014.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/014.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/015.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/015.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/015.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/015.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/016.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/016.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/016.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/016.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/017.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/017.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/017.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/017.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/018.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/018.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/018.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/018.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/019.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/019.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/019.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/019.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/020.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/020.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/020.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/020.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/021.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/021.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/021.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/021.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/022.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/022.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/022.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/022.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/023.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/023.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/023.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/023.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/024.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/024.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/024.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/024.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/025.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/025.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/025.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/025.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/026.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/026.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/026.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/026.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/027.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/027.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/027.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/027.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/028.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/028.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/028.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/028.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/029.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/029.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/029.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/029.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/030.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/030.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/030.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/030.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/031.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/031.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/031.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/031.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/032.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/032.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/032.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/032.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/033.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/033.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/033.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/033.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/034.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/034.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/034.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/034.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/035.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/035.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/035.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/035.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/036.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/036.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/036.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/036.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/037.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/037.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/037.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/037.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/038.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/038.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/038.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/038.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/039.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/039.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/039.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/039.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/040.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/040.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/040.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/040.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/041.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/041.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/041.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/041.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/042.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/042.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/042.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/042.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/043.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/043.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/043.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/043.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/044.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/044.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/044.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/044.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/045.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/045.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/045.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/045.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/046.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/046.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/046.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/046.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/047.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/047.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/047.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/047.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/048.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/048.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/048.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/048.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/049.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/049.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/049.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/049.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/050.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/050.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/050.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/050.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/051.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/051.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/051.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/051.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/052.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/052.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/052.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/052.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/053.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/053.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/053.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/053.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/054.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/054.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/054.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/054.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/055.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/055.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/055.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/055.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/056.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/056.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/056.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/056.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/057.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/057.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/057.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/057.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/006.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/007.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/010.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/012.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/012.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/012.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/012.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/015.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/015.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/015.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/015.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/017.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/017.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/017.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/017.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/018.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/018.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/018.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/018.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/022.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/022.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/022.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/022.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/023.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/023.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/023.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/023.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/024.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/024.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/024.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/024.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/025.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/025.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/025.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/025.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/026.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/026.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/026.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/026.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/027.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/027.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/027.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/027.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/028.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/028.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/028.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/028.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/029.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/029.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/029.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/029.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/030.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/030.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/030.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/030.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/031.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/031.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/031.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/031.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/032.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/032.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/032.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/032.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/033.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/033.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/033.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/033.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/034.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/034.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/034.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/034.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/035.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/035.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/035.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/035.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/036.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/036.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/036.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/036.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/037.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/037.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/037.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/037.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/040.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/040.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/040.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/040.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/043.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/043.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/043.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/043.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/044.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/044.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/044.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/044.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/045.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/045.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/045.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/045.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/046.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/046.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/046.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/046.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/047.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/047.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/047.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/047.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/048.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/048.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/048.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/048.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/049.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/049.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/049.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/049.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/050.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/050.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/050.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/050.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/051.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/051.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/051.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/051.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/052.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/052.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/052.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/052.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/053.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/053.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/053.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/053.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/054.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/054.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/054.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/054.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/testcases.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/testcases.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/testcases.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/testcases.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/xml11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/xml11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/xml11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/xml11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/xmlconf.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/xmlconf.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/xmlconf.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/eduni/xml-1.1/xmlconf.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/a_oasis-logo.gif b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/a_oasis-logo.gif similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/a_oasis-logo.gif rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/a_oasis-logo.gif diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/committee.css b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/committee.css similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/committee.css rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/committee.css diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/top3.jpe b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/top3.jpe similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/files/top3.jpe rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/files/top3.jpe diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/finalCatalog.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/finalCatalog.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/finalCatalog.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/finalCatalog.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_invalid.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_invalid.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_invalid.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_invalid.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_not-wf.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_not-wf.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_not-wf.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_not-wf.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_readme.txt b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_readme.txt similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_readme.txt rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_readme.txt diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_valid.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_valid.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_valid.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/ibm_oasis_valid.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/ibm28i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/ibm28i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/ibm28i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/ibm28i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/ibm28i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/ibm28i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/ibm28i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P28/out/ibm28i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i04.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i04.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i04.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i04.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/ibm32i04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P32/out/ibm32i04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/ibm39i04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P39/out/ibm39i04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/ibm41i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/ibm41i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/ibm41i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/ibm41i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/ibm41i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/ibm41i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/ibm41i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/ibm41i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/ibm41i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/ibm41i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/ibm41i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/ibm41i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/ibm41i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/ibm41i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/ibm41i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P41/out/ibm41i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/ibm45i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/ibm45i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/ibm45i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/ibm45i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/ibm45i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/ibm45i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/ibm45i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P45/out/ibm45i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/ibm49i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/ibm49i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/ibm49i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/ibm49i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/ibm49i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/ibm49i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/ibm49i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/ibm49i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P49/out/ibm49i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/ibm50i01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/ibm50i01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/ibm50i01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/ibm50i01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/ibm50i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/ibm50i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/ibm50i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/ibm50i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/ibm50i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/ibm50i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/ibm50i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P50/out/ibm50i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/ibm51i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P51/out/ibm51i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/ibm56i18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P56/out/ibm56i18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/ibm58i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/ibm58i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/ibm58i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/ibm58i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/ibm58i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/ibm58i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/ibm58i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/ibm58i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/ibm58i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/ibm58i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/ibm58i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/ibm58i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/ibm58i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/ibm58i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/ibm58i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P58/out/ibm58i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/ibm59i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/ibm59i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/ibm59i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/ibm59i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/ibm59i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/ibm59i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/ibm59i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P59/out/ibm59i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/ibm60i04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P60/out/ibm60i04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i03.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i03.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i03.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i03.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i04.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i04.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i04.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i04.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/ibm68i04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P68/out/ibm68i04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i03.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i03.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i03.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i03.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i04.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i04.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i04.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i04.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/ibm69i04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P69/out/ibm69i04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/ibm76i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/ibm76i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/ibm76i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/ibm76i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/ibm76i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/ibm76i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/ibm76i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/invalid/P76/out/ibm76i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P01/ibm01n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n23.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n23.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n23.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n23.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n25.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n25.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n25.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n25.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n26.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n26.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n26.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n26.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n27.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n27.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n27.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n27.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n28.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n28.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n28.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n28.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n29.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n29.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n29.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n29.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n30.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n30.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n30.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n30.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n31.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n31.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n31.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n31.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n32.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n32.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n32.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n32.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n33.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n33.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n33.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P02/ibm02n33.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/ibm03n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/ibm03n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/ibm03n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P03/ibm03n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P04/ibm04n18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P05/ibm05n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P09/ibm09n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P10/ibm10n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P11/ibm11n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P12/ibm12n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/ibm13n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/student.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/student.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/student.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P13/student.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P14/ibm14n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P15/ibm15n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P16/ibm16n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P17/ibm17n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/ibm18n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/ibm18n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/ibm18n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/ibm18n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/ibm18n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/ibm18n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/ibm18n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P18/ibm18n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P19/ibm19n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/ibm20n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/ibm20n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/ibm20n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P20/ibm20n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P21/ibm21n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P22/ibm22n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P23/ibm23n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P24/ibm24n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/ibm25n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/ibm25n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/ibm25n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/ibm25n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/ibm25n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/ibm25n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/ibm25n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P25/ibm25n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/ibm26n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/ibm26n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/ibm26n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P26/ibm26n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/ibm27n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/ibm27n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/ibm27n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P27/ibm27n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P28/ibm28n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/cat.txt b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/cat.txt similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/cat.txt rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/cat.txt diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P29/ibm29n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/ibm30n01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/ibm30n01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/ibm30n01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/ibm30n01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/ibm30n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/ibm30n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/ibm30n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P30/ibm30n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/ibm31n01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/ibm31n01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/ibm31n01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/ibm31n01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/ibm31n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/ibm31n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/ibm31n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P31/ibm31n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n06.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n06.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n06.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n06.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n09.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n09.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n09.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n09.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P32/ibm32n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P39/ibm39n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P40/ibm40n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n10.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n10.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n10.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n10.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n11.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n11.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n11.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n11.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P41/ibm41n14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P42/ibm42n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P43/ibm43n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P44/ibm44n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P45/ibm45n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P46/ibm46n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P47/ibm47n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P48/ibm48n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P49/ibm49n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P50/ibm50n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P51/ibm51n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P52/ibm52n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P53/ibm53n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/ibm54n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/ibm54n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/ibm54n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/ibm54n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/ibm54n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/ibm54n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/ibm54n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P54/ibm54n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P55/ibm55n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P56/ibm56n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/ibm57n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/ibm57n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/ibm57n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P57/ibm57n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P58/ibm58n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P59/ibm59n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P60/ibm60n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/ibm61n01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/ibm61n01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/ibm61n01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/ibm61n01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/ibm61n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/ibm61n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/ibm61n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P61/ibm61n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n04.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n04.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n04.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n04.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n05.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n05.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n05.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n05.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n06.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n06.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n06.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n06.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n07.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n07.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n07.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n07.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n08.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n08.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n08.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n08.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P62/ibm62n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n04.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n04.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n04.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n04.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n05.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n05.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n05.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n05.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n06.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n06.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n06.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n06.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n07.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n07.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n07.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n07.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P63/ibm63n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P64/ibm64n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P65/ibm65n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P66/ibm66n15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n06.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n06.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n06.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n06.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P68/ibm68n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P69/ibm69n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm70n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm70n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm70n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm70n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P71/ibm71n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P72/ibm72n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/ibm73n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/ibm73n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/ibm73n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/ibm73n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/ibm73n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/ibm73n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/ibm73n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P73/ibm73n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/ibm74n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/ibm74n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/ibm74n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P74/ibm74n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/empty.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/empty.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/empty.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/empty.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P75/ibm75n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P76/ibm76n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n01.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n01.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n01.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n01.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n02.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n02.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n02.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n02.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n03.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n03.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n03.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n03.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n04.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n04.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n04.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n04.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P77/ibm77n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n01.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n01.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n01.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n01.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n02.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n02.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n02.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n02.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P78/ibm78n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n01.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n01.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n01.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n01.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n02.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n02.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n02.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n02.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P79/ibm79n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P80/ibm80n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P81/ibm81n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P82/ibm82n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P83/ibm83n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n100.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n100.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n100.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n100.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n101.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n101.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n101.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n101.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n102.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n102.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n102.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n102.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n103.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n103.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n103.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n103.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n104.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n104.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n104.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n104.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n105.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n105.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n105.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n105.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n106.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n106.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n106.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n106.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n107.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n107.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n107.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n107.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n108.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n108.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n108.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n108.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n109.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n109.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n109.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n109.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n110.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n110.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n110.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n110.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n111.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n111.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n111.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n111.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n112.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n112.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n112.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n112.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n113.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n113.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n113.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n113.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n114.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n114.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n114.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n114.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n115.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n115.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n115.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n115.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n116.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n116.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n116.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n116.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n117.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n117.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n117.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n117.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n118.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n118.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n118.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n118.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n119.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n119.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n119.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n119.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n120.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n120.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n120.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n120.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n121.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n121.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n121.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n121.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n122.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n122.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n122.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n122.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n123.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n123.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n123.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n123.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n124.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n124.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n124.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n124.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n125.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n125.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n125.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n125.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n126.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n126.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n126.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n126.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n127.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n127.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n127.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n127.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n128.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n128.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n128.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n128.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n129.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n129.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n129.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n129.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n130.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n130.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n130.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n130.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n131.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n131.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n131.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n131.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n132.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n132.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n132.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n132.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n133.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n133.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n133.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n133.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n134.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n134.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n134.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n134.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n135.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n135.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n135.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n135.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n136.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n136.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n136.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n136.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n137.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n137.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n137.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n137.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n138.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n138.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n138.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n138.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n139.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n139.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n139.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n139.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n140.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n140.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n140.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n140.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n141.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n141.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n141.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n141.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n142.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n142.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n142.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n142.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n143.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n143.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n143.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n143.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n144.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n144.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n144.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n144.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n145.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n145.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n145.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n145.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n146.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n146.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n146.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n146.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n147.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n147.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n147.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n147.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n148.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n148.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n148.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n148.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n149.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n149.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n149.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n149.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n150.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n150.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n150.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n150.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n151.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n151.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n151.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n151.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n152.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n152.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n152.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n152.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n153.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n153.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n153.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n153.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n154.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n154.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n154.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n154.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n155.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n155.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n155.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n155.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n156.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n156.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n156.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n156.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n157.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n157.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n157.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n157.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n158.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n158.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n158.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n158.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n159.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n159.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n159.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n159.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n160.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n160.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n160.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n160.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n161.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n161.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n161.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n161.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n162.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n162.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n162.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n162.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n163.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n163.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n163.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n163.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n164.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n164.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n164.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n164.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n165.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n165.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n165.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n165.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n166.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n166.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n166.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n166.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n167.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n167.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n167.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n167.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n168.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n168.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n168.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n168.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n169.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n169.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n169.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n169.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n170.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n170.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n170.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n170.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n171.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n171.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n171.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n171.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n172.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n172.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n172.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n172.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n173.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n173.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n173.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n173.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n174.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n174.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n174.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n174.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n175.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n175.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n175.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n175.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n176.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n176.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n176.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n176.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n177.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n177.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n177.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n177.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n178.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n178.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n178.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n178.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n179.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n179.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n179.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n179.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n180.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n180.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n180.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n180.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n181.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n181.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n181.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n181.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n182.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n182.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n182.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n182.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n183.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n183.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n183.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n183.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n184.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n184.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n184.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n184.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n185.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n185.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n185.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n185.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n186.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n186.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n186.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n186.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n187.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n187.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n187.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n187.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n188.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n188.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n188.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n188.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n189.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n189.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n189.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n189.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n190.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n190.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n190.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n190.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n191.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n191.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n191.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n191.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n192.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n192.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n192.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n192.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n193.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n193.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n193.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n193.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n194.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n194.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n194.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n194.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n195.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n195.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n195.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n195.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n196.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n196.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n196.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n196.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n197.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n197.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n197.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n197.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n198.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n198.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n198.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n198.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n23.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n23.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n23.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n23.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n25.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n25.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n25.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n25.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n26.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n26.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n26.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n26.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n27.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n27.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n27.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n27.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n28.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n28.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n28.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n28.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n29.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n29.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n29.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n29.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n30.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n30.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n30.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n30.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n31.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n31.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n31.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n31.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n32.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n32.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n32.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n32.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n33.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n33.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n33.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n33.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n34.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n34.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n34.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n34.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n35.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n35.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n35.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n35.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n36.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n36.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n36.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n36.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n37.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n37.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n37.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n37.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n38.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n38.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n38.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n38.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n39.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n39.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n39.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n39.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n40.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n40.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n40.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n40.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n41.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n41.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n41.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n41.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n42.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n42.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n42.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n42.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n43.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n43.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n43.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n43.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n44.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n44.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n44.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n44.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n45.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n45.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n45.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n45.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n46.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n46.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n46.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n46.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n47.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n47.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n47.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n47.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n48.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n48.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n48.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n48.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n49.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n49.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n49.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n49.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n50.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n50.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n50.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n50.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n51.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n51.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n51.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n51.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n52.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n52.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n52.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n52.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n53.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n53.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n53.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n53.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n54.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n54.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n54.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n54.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n55.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n55.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n55.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n55.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n56.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n56.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n56.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n56.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n57.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n57.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n57.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n57.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n58.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n58.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n58.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n58.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n59.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n59.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n59.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n59.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n60.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n60.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n60.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n60.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n61.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n61.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n61.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n61.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n62.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n62.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n62.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n62.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n63.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n63.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n63.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n63.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n64.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n64.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n64.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n64.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n65.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n65.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n65.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n65.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n66.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n66.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n66.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n66.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n67.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n67.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n67.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n67.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n68.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n68.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n68.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n68.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n69.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n69.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n69.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n69.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n70.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n70.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n70.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n70.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n71.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n71.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n71.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n71.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n72.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n72.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n72.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n72.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n73.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n73.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n73.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n73.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n74.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n74.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n74.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n74.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n75.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n75.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n75.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n75.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n76.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n76.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n76.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n76.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n77.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n77.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n77.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n77.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n78.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n78.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n78.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n78.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n79.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n79.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n79.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n79.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n80.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n80.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n80.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n80.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n81.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n81.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n81.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n81.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n82.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n82.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n82.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n82.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n83.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n83.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n83.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n83.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n84.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n84.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n84.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n84.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n85.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n85.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n85.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n85.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n86.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n86.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n86.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n86.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n87.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n87.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n87.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n87.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n88.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n88.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n88.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n88.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n89.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n89.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n89.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n89.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n90.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n90.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n90.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n90.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n91.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n91.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n91.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n91.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n92.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n92.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n92.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n92.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n93.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n93.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n93.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n93.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n94.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n94.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n94.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n94.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n95.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n95.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n95.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n95.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n96.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n96.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n96.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n96.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n97.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n97.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n97.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n97.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n98.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n98.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n98.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n98.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n99.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n99.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n99.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P85/ibm85n99.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P86/ibm86n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n23.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n23.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n23.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n23.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n25.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n25.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n25.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n25.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n26.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n26.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n26.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n26.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n27.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n27.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n27.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n27.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n28.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n28.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n28.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n28.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n29.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n29.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n29.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n29.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n30.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n30.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n30.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n30.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n31.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n31.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n31.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n31.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n32.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n32.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n32.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n32.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n33.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n33.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n33.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n33.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n34.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n34.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n34.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n34.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n35.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n35.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n35.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n35.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n36.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n36.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n36.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n36.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n37.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n37.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n37.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n37.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n38.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n38.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n38.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n38.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n39.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n39.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n39.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n39.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n40.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n40.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n40.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n40.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n41.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n41.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n41.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n41.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n42.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n42.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n42.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n42.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n43.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n43.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n43.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n43.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n44.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n44.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n44.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n44.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n45.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n45.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n45.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n45.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n46.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n46.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n46.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n46.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n47.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n47.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n47.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n47.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n48.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n48.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n48.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n48.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n49.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n49.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n49.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n49.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n50.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n50.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n50.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n50.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n51.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n51.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n51.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n51.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n52.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n52.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n52.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n52.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n53.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n53.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n53.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n53.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n54.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n54.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n54.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n54.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n55.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n55.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n55.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n55.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n56.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n56.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n56.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n56.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n57.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n57.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n57.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n57.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n58.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n58.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n58.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n58.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n59.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n59.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n59.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n59.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n60.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n60.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n60.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n60.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n61.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n61.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n61.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n61.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n62.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n62.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n62.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n62.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n63.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n63.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n63.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n63.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n64.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n64.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n64.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n64.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n66.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n66.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n66.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n66.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n67.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n67.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n67.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n67.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n68.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n68.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n68.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n68.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n69.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n69.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n69.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n69.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n70.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n70.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n70.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n70.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n71.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n71.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n71.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n71.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n72.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n72.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n72.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n72.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n73.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n73.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n73.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n73.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n74.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n74.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n74.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n74.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n75.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n75.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n75.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n75.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n76.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n76.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n76.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n76.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n77.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n77.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n77.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n77.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n78.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n78.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n78.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n78.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n79.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n79.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n79.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n79.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n80.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n80.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n80.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n80.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n81.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n81.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n81.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n81.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n82.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n82.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n82.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n82.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n83.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n83.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n83.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n83.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n84.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n84.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n84.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n84.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n85.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n85.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n85.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P87/ibm87n85.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P88/ibm88n16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/P89/ibm89n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/432gewf.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/432gewf.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/432gewf.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/432gewf.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/ltinentval.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/ltinentval.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/ltinentval.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/ltinentval.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/simpleltinentval.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/simpleltinentval.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/simpleltinentval.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/misc/simpleltinentval.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/ibm28an01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/ibm28an01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/ibm28an01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/ibm28an01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/ibm28an01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/ibm28an01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/ibm28an01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/not-wf/p28a/ibm28an01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/ibm01v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/ibm01v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/ibm01v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/ibm01v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/ibm01v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/ibm01v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/ibm01v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P01/out/ibm01v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/ibm02v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/ibm02v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/ibm02v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/ibm02v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/ibm02v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/ibm02v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/ibm02v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P02/out/ibm02v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/ibm03v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/ibm03v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/ibm03v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/ibm03v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/ibm03v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/ibm03v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/ibm03v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P03/out/ibm03v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/ibm09v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/out/ibm09v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/student.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/student.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/student.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P09/student.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/ibm10v08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P10/out/ibm10v08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/ibm11v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/out/ibm11v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/student.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/student.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/student.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P11/student.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/ibm12v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/out/ibm12v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/student.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/student.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/student.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P12/student.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/ibm13v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/ibm13v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/ibm13v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/ibm13v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/ibm13v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/ibm13v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/ibm13v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/out/ibm13v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/student.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/student.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/student.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P13/student.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/ibm14v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P14/out/ibm14v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/ibm15v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P15/out/ibm15v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/ibm16v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P16/out/ibm16v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/ibm17v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/ibm17v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/ibm17v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/ibm17v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/ibm17v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/ibm17v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/ibm17v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P17/out/ibm17v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/ibm18v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/ibm18v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/ibm18v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/ibm18v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/ibm18v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/ibm18v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/ibm18v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P18/out/ibm18v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/ibm19v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/ibm19v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/ibm19v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/ibm19v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/ibm19v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/ibm19v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/ibm19v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P19/out/ibm19v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/ibm20v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/ibm20v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/ibm20v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/ibm20v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/ibm20v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/ibm20v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/ibm20v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/ibm20v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/ibm20v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/ibm20v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/ibm20v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/ibm20v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/ibm20v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/ibm20v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/ibm20v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P20/out/ibm20v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/ibm21v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/ibm21v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/ibm21v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/ibm21v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/ibm21v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/ibm21v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/ibm21v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P21/out/ibm21v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/ibm22v07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P22/out/ibm22v07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/ibm23v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P23/out/ibm23v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/ibm24v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/ibm24v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/ibm24v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/ibm24v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/ibm24v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/ibm24v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/ibm24v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/ibm24v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/ibm24v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/ibm24v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/ibm24v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/ibm24v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/ibm24v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/ibm24v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/ibm24v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P24/out/ibm24v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/ibm25v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P25/out/ibm25v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/ibm26v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/ibm26v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/ibm26v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/ibm26v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/ibm26v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/ibm26v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/ibm26v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P26/out/ibm26v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/ibm27v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P27/out/ibm27v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.txt b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.txt similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.txt rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.txt diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/ibm28v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/ibm28v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/ibm28v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/ibm28v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/ibm28v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/ibm28v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/ibm28v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/ibm28v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P28/out/ibm28v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v01.txt b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v01.txt similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v01.txt rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v01.txt diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/ibm29v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/ibm29v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/ibm29v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/ibm29v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/ibm29v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/ibm29v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/ibm29v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/ibm29v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P29/out/ibm29v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/ibm30v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/ibm30v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/ibm30v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/ibm30v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/ibm30v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/ibm30v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/ibm30v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/ibm30v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P30/out/ibm30v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/ibm31v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/ibm31v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/ibm31v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/ibm31v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/ibm31v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/ibm31v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/ibm31v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/ibm31v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/ibm31v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/ibm31v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/ibm31v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P31/out/ibm31v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v04.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v04.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v04.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v04.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/ibm32v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P32/out/ibm32v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/ibm33v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/ibm33v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/ibm33v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/ibm33v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/ibm33v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/ibm33v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/ibm33v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P33/out/ibm33v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/ibm34v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/ibm34v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/ibm34v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/ibm34v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/ibm34v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/ibm34v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/ibm34v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P34/out/ibm34v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/ibm35v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/ibm35v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/ibm35v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/ibm35v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/ibm35v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/ibm35v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/ibm35v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P35/out/ibm35v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/ibm36v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/ibm36v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/ibm36v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/ibm36v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/ibm36v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/ibm36v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/ibm36v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P36/out/ibm36v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/ibm37v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/ibm37v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/ibm37v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/ibm37v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/ibm37v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/ibm37v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/ibm37v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P37/out/ibm37v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/ibm38v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/ibm38v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/ibm38v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/ibm38v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/ibm38v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/ibm38v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/ibm38v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P38/out/ibm38v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/ibm39v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/ibm39v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/ibm39v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/ibm39v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/ibm39v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/ibm39v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/ibm39v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P39/out/ibm39v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/ibm40v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/ibm40v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/ibm40v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/ibm40v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/ibm40v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/ibm40v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/ibm40v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P40/out/ibm40v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/ibm41v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/ibm41v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/ibm41v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/ibm41v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/ibm41v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/ibm41v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/ibm41v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P41/out/ibm41v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/ibm42v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/ibm42v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/ibm42v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/ibm42v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/ibm42v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/ibm42v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/ibm42v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P42/out/ibm42v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/ibm43v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/ibm43v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/ibm43v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/ibm43v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/ibm43v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/ibm43v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/ibm43v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P43/out/ibm43v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/ibm44v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/ibm44v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/ibm44v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/ibm44v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/ibm44v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/ibm44v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/ibm44v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P44/out/ibm44v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/ibm45v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/ibm45v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/ibm45v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/ibm45v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/ibm45v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/ibm45v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/ibm45v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P45/out/ibm45v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/ibm47v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/ibm47v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/ibm47v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/ibm47v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/ibm47v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/ibm47v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/ibm47v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P47/out/ibm47v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/ibm49v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/ibm49v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/ibm49v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/ibm49v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/ibm49v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/ibm49v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/ibm49v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/ibm49v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/ibm49v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/ibm49v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/ibm49v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P49/out/ibm49v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/ibm50v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/ibm50v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/ibm50v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/ibm50v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/ibm50v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/ibm50v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/ibm50v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/ibm50v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/ibm50v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/ibm50v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/ibm50v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P50/out/ibm50v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/ibm51v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/ibm51v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/ibm51v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/ibm51v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/ibm51v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/ibm51v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/ibm51v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/ibm51v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P51/out/ibm51v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/ibm52v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/ibm52v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/ibm52v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/ibm52v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/ibm52v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/ibm52v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/ibm52v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P52/out/ibm52v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibm54v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibmlogo.gif b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibmlogo.gif similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibmlogo.gif rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/ibmlogo.gif diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/out/ibm54v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/xmltech.gif b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/xmltech.gif similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/xmltech.gif rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P54/xmltech.gif diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/ibm55v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/ibm55v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/ibm55v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/ibm55v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/ibm55v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/ibm55v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/ibm55v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P55/out/ibm55v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/ibm56v10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P56/out/ibm56v10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/ibm57v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/ibm57v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/ibm57v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/ibm57v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/ibm57v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/ibm57v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/ibm57v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P57/out/ibm57v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/ibm58v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/ibm58v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/ibm58v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/ibm58v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/ibm58v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/ibm58v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/ibm58v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/ibm58v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/ibm58v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/ibm58v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/ibm58v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/ibm58v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/ibm58v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/ibm58v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/ibm58v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P58/out/ibm58v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/ibm59v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/ibm59v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/ibm59v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/ibm59v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/ibm59v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/ibm59v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/ibm59v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/ibm59v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/ibm59v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/ibm59v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/ibm59v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/ibm59v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/ibm59v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/ibm59v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/ibm59v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P59/out/ibm59v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/ibm60v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P60/out/ibm60v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/ibm61v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/ibm61v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/ibm61v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/ibm61v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/ibm61v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/ibm61v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/ibm61v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/ibm61v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P61/out/ibm61v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v04.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v04.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v04.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v04.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v05.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v05.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v05.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v05.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/ibm62v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P62/out/ibm62v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v04.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v04.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v04.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v04.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v05.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v05.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v05.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v05.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/ibm63v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P63/out/ibm63v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/ibm64v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P64/out/ibm64v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/ibm65v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/ibm65v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/ibm65v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/ibm65v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/ibm65v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/ibm65v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/ibm65v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/ibm65v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P65/out/ibm65v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/ibm66v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/ibm66v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/ibm66v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/ibm66v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/ibm66v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/ibm66v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/ibm66v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P66/out/ibm66v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/ibm67v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/ibm67v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/ibm67v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/ibm67v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/ibm67v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/ibm67v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/ibm67v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P67/out/ibm67v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v02.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v02.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v02.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v02.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/ibm68v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/ibm68v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/ibm68v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/ibm68v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/ibm68v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/ibm68v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/ibm68v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/ibm68v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P68/out/ibm68v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v02.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v02.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v02.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v02.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/ibm69v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/ibm69v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/ibm69v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/ibm69v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/ibm69v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/ibm69v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/ibm69v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/ibm69v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P69/out/ibm69v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/ibm70v01.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/ibm70v01.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/ibm70v01.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/ibm70v01.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/ibm70v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/ibm70v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/ibm70v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/ibm70v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/ibm70v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/ibm70v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/ibm70v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P70/out/ibm70v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v01.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v01.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v01.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v01.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v02.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v02.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v02.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v02.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v03.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v03.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v03.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/ibm78v03.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/ibm78v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/ibm78v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/ibm78v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P78/out/ibm78v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/ibm79v01.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/ibm79v01.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/ibm79v01.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/ibm79v01.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/ibm79v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/ibm79v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/ibm79v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/ibm79v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/ibm79v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/ibm79v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/ibm79v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P79/out/ibm79v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/ibm82v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/ibm82v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/ibm82v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/ibm82v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/ibm82v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/ibm82v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/ibm82v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P82/out/ibm82v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/ibm85v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/ibm85v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/ibm85v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/ibm85v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/ibm85v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/ibm85v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/ibm85v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P85/out/ibm85v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/ibm86v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/ibm86v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/ibm86v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/ibm86v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/ibm86v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/ibm86v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/ibm86v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P86/out/ibm86v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/ibm87v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/ibm87v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/ibm87v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/ibm87v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/ibm87v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/ibm87v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/ibm87v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P87/out/ibm87v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/ibm88v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/ibm88v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/ibm88v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/ibm88v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/ibm88v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/ibm88v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/ibm88v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P88/out/ibm88v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/ibm89v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/ibm89v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/ibm89v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/ibm89v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/ibm89v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/ibm89v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/ibm89v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/valid/P89/out/ibm89v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_invalid.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_invalid.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_invalid.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_invalid.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_not-wf.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_not-wf.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_not-wf.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_not-wf.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_valid.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_valid.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_valid.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/ibm_valid.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/ibm46i01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/ibm46i01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/ibm46i01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/ibm46i01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/ibm46i02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/ibm46i02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/ibm46i02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/invalid/P46/ibm46i02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n23.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n23.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n23.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n23.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n25.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n25.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n25.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n25.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n26.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n26.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n26.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n26.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n27.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n27.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n27.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n27.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n28.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n28.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n28.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n28.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n29.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n29.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n29.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n29.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n30.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n30.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n30.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n30.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n31.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n31.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n31.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n31.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n32.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n32.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n32.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n32.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n33.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n33.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n33.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n33.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n34.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n34.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n34.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n34.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n35.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n35.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n35.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n35.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n36.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n36.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n36.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n36.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n37.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n37.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n37.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n37.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n38.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n38.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n38.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n38.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n39.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n39.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n39.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n39.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n40.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n40.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n40.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n40.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n41.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n41.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n41.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n41.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n42.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n42.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n42.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n42.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n43.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n43.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n43.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n43.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n44.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n44.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n44.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n44.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n45.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n45.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n45.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n45.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n46.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n46.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n46.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n46.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n47.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n47.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n47.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n47.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n48.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n48.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n48.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n48.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n49.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n49.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n49.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n49.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n50.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n50.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n50.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n50.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n51.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n51.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n51.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n51.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n52.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n52.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n52.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n52.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n53.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n53.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n53.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n53.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n54.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n54.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n54.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n54.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n55.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n55.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n55.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n55.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n56.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n56.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n56.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n56.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n57.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n57.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n57.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n57.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n58.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n58.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n58.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n58.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n59.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n59.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n59.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n59.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n60.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n60.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n60.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n60.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n61.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n61.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n61.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n61.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n62.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n62.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n62.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n62.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n63.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n63.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n63.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n63.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n64.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n64.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n64.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n64.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n64.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n64.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n64.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n64.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n65.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n65.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n65.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n65.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n65.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n65.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n65.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n65.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n66.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n66.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n66.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n66.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n66.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n66.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n66.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n66.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n67.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n67.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n67.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n67.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n68.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n68.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n68.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n68.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n69.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n69.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n69.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n69.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n70.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n70.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n70.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n70.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n71.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n71.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n71.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P02/ibm02n71.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n23.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n23.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n23.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n23.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n25.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n25.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n25.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n25.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n26.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n26.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n26.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n26.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n27.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n27.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n27.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n27.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n28.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n28.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n28.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04/ibm04n28.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an23.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an23.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an23.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an23.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an25.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an25.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an25.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an25.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an26.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an26.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an26.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an26.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an27.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an27.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an27.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an27.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an28.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an28.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an28.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P04a/ibm04an28.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P05/ibm05n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n04.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n04.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n04.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n04.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n05.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n05.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n05.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n05.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n06.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n06.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n06.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n06.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n07.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n07.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n07.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n07.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n08.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n08.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n08.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n08.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n09.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n09.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n09.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n09.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n10.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n10.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n10.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n10.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n11.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n11.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n11.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n11.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n12.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n12.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n12.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n12.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n14.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n14.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n14.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n14.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n16.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n16.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n16.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n16.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n17.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n17.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n17.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n17.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n18.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n18.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n18.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n18.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/not-wf/P77/ibm77n21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v06.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v06.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v06.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v06.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P02/ibm02v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v01.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v01.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v01.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v01.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v02.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v02.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v02.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v02.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v03.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v03.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v03.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v03.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v04.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v04.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v04.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v04.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v09.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v09.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v09.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v09.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/ibm03v09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P03/out/ibm03v09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/ibm04v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/ibm04v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/ibm04v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04/ibm04v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/ibm04av01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/ibm04av01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/ibm04av01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P04a/ibm04av01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P05/ibm05v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/ibm07v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/ibm07v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/ibm07v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P07/ibm07v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v02.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v02.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v02.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v02.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v03.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v03.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v03.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v03.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v04.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v04.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v04.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v04.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v05.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v05.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v05.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v05.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v06.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v06.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v06.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v06.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v07.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v07.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v07.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v07.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v08.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v08.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v08.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v08.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v09.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v09.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v09.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v09.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v10.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v10.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v10.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v10.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v11.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v11.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v11.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v11.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v12.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v12.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v12.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v12.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v13.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v13.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v13.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v13.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v14.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v14.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v14.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v14.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v15.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v15.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v15.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v15.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v16.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v16.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v16.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v16.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v17.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v17.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v17.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v17.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v18.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v18.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v18.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v18.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v19.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v19.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v19.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v19.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v20.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v20.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v20.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v20.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v21.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v21.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v21.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v21.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v22.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v22.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v22.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v22.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v23.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v23.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v23.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v23.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v23.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v23.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v23.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v23.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v24.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v24.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v24.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v24.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v25.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v25.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v25.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v25.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v25.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v25.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v25.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v25.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v26.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v26.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v26.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v26.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v26.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v26.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v26.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v26.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v27.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v27.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v27.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v27.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v27.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v27.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v27.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v27.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v28.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v28.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v28.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v28.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v28.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v28.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v28.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v28.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v29.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v29.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v29.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v29.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v29.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v29.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v29.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v29.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v30.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v30.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v30.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v30.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v30.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v30.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v30.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/ibm/xml-1.1/valid/P77/ibm77v30.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/japanese.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/japanese.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/japanese.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/japanese.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-euc-jp.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-euc-jp.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-euc-jp.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-euc-jp.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-iso-2022-jp.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-iso-2022-jp.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-iso-2022-jp.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-iso-2022-jp.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-little-endian.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-little-endian.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-little-endian.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-little-endian.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-shift_jis.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-shift_jis.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-shift_jis.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-shift_jis.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-utf-16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-utf-16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-utf-16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-utf-16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-utf-8.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-utf-8.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-utf-8.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/pr-xml-utf-8.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/spec.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/spec.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/spec.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/spec.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-euc-jp.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-euc-jp.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-euc-jp.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-euc-jp.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-euc-jp.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-euc-jp.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-euc-jp.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-euc-jp.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-iso-2022-jp.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-iso-2022-jp.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-iso-2022-jp.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-iso-2022-jp.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-iso-2022-jp.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-iso-2022-jp.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-iso-2022-jp.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-iso-2022-jp.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-little-endian.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-little-endian.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-little-endian.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-little-endian.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-shift_jis.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-shift_jis.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-shift_jis.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-shift_jis.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-shift_jis.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-shift_jis.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-shift_jis.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-shift_jis.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-16.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-16.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-16.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-16.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-8.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-8.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-8.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-8.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-8.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-8.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-8.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/japanese/weekly-utf-8.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/e2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/e2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/e2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/e2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/oasis.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/oasis.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/oasis.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/oasis.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p01pass3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail23.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail23.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail23.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail23.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail25.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail25.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail25.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail25.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail26.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail26.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail26.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail26.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail27.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail27.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail27.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail27.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail28.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail28.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail28.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail28.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail29.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail29.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail29.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail29.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail30.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail30.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail30.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail30.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail31.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail31.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail31.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail31.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail6.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail6.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail6.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail6.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail7.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail7.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail7.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail7.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail8.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail8.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail8.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail8.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail9.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail9.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail9.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p02fail9.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail17.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail17.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail17.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail17.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail18.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail18.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail18.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail18.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail19.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail19.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail19.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail19.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail23.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail23.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail23.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail23.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail25.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail25.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail25.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail25.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail26.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail26.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail26.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail26.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail27.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail27.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail27.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail27.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail28.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail28.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail28.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail28.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail29.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail29.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail29.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail29.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail7.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail7.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail7.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail7.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail8.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail8.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail8.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail8.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail9.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail9.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail9.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03fail9.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p03pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p04pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p05pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p06fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p06fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p06fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p06fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p06pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p06pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p06pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p06pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p07pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p07pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p07pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p07pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p08pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail2.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail2.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail2.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail2.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09pass1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09pass1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09pass1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09pass1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p09pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p10pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p11pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail6.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail6.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail6.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail6.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail7.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail7.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail7.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12fail7.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p12pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p14pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p15pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p16pass3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p18pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass6.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass6.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass6.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p22pass6.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p23pass4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p24pass4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p25pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p26pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p27pass4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass4.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass4.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass4.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass4.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass5.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass5.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass5.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass5.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p28pass5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p29fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p29fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p29fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p29fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p29pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p29pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p29pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p29pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30fail1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30fail1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30fail1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30fail1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass2.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass2.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass2.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass2.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p30pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31fail1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31fail1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31fail1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31fail1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass2.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass2.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass2.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass2.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p31pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p32pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p39pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p40pass4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p41pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p42pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p43pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p44pass5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p45pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail6.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail6.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail6.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46fail6.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p46pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p47pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p48pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p49fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p49fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p49fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p49fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p49pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p49pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p49pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p49pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p50fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p50fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p50fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p50fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p50pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p50pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p50pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p50pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail6.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail6.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail6.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail6.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail7.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail7.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail7.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51fail7.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p51pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p52pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p53pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p54fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p54fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p54fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p54fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p54pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p54pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p54pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p54pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p55fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p55fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p55fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p55fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p55pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p55pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p55pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p55pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p56pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p57fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p57fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p57fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p57fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p57pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p57pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p57pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p57pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail6.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail6.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail6.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail6.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail7.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail7.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail7.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail7.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail8.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail8.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail8.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58fail8.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p58pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p59pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p60pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61fail1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61fail1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61fail1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61fail1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61pass1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61pass1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61pass1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61pass1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p61pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail2.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail2.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail2.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail2.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62pass1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62pass1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62pass1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62pass1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p62pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail2.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail2.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail2.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail2.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63pass1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63pass1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63pass1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63pass1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p63pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail2.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail2.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail2.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail2.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64pass1.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64pass1.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64pass1.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64pass1.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p64pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail6.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail6.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail6.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66fail6.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p66pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p68pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p69pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p70fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p70fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p70fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p70fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p70pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p70pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p70pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p70pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p71pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p72pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p73pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p74pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail5.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail5.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail5.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail5.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail6.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail6.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail6.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75fail6.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p75pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail2.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail2.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail2.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail2.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail3.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail3.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail3.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail3.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail4.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail4.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail4.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76fail4.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76pass1.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76pass1.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76pass1.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/oasis/p76pass1.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/readme.html b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/readme.html similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/readme.html rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/readme.html diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/cxml.html b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/cxml.html similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/cxml.html rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/cxml.html diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr15.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr15.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr15.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr15.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr16.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr16.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr16.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/attr16.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/dtd06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/el06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/empty.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/empty.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/empty.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/empty.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/id09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/not-sa14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional14.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional14.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional14.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional14.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional20.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional20.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional20.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional20.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional21.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional21.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional21.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional21.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional22.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional22.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional22.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional22.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional23.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional23.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional23.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional23.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional24.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional24.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional24.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional24.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional25.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional25.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional25.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/optional25.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required00.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required00.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required00.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required00.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/required02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/root.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/root.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/root.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/root.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/utf16b.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/utf16b.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/utf16b.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/utf16b.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/utf16l.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/utf16l.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/utf16l.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/invalid/utf16l.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/attlist11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/cond02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/content03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/decl01.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/decl01.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/decl01.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/decl01.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/decl01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/decl01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/decl01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/decl01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd00.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd00.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd00.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd00.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd07.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd07.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd07.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd07.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/dtd07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element00.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element00.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element00.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element00.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/element04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/encoding07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/not-sa03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/not-sa03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/not-sa03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/not-sa03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pi.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pi.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pi.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pi.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/pubid05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml07.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml07.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml07.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml07.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml08.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml08.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml08.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml08.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml09.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml09.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml09.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml09.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml10.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml10.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml10.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml10.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml11.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml11.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml11.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml11.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml12.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml12.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml12.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml12.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml13.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml13.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml13.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/sgml13.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/uri01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/uri01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/uri01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/not-wf/uri01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-error.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-error.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-error.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-error.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-invalid.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-invalid.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-invalid.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-invalid.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-not-wf.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-not-wf.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-not-wf.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-not-wf.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-valid.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-valid.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-valid.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/sun-valid.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtd00.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtd00.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtd00.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtd00.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtd01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtd01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtd01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtd01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtdtest.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtdtest.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtdtest.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/dtdtest.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/element.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/element.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/element.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/element.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext01.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext01.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext01.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext01.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/ext02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/not-sa04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/notation01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/notation01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/notation01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/notation01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/notation01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/notation01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/notation01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/notation01.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/null.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/null.ent similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/null.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/null.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/optional.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/optional.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/optional.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/optional.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/dtd00.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/dtd00.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/dtd00.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/dtd00.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/dtd01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/dtd01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/dtd01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/dtd01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/element.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/element.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/element.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/element.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/ext01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/ext01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/ext01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/ext01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/ext02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/ext02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/ext02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/ext02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/not-sa04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/notation01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/notation01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/notation01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/notation01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/optional.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/optional.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/optional.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/optional.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe00.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe00.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe00.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe00.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/pe03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/required00.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/required00.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/required00.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/required00.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sa05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sgml01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sgml01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sgml01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/sgml01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/out/v-lang06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe00.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe00.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe00.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe00.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe00.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe00.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe00.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe00.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/pe03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/required00.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/required00.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/required00.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/required00.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sa05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sgml01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sgml01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sgml01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/sgml01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang01.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang01.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang01.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang01.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang02.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang02.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang02.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang02.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang03.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang03.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang03.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang03.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang04.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang04.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang04.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang04.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang05.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang05.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang05.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang05.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang06.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang06.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang06.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/v-lang06.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/testcases.dtd b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/testcases.dtd similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/testcases.dtd rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/testcases.dtd diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20010315.htm b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20010315.htm similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20010315.htm rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20010315.htm diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20010315.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20010315.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20010315.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20010315.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20020521.htm b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20020521.htm similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20020521.htm rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20020521.htm diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20031030.htm b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20031030.htm similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20031030.htm rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconf-20031030.htm diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconf.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconf.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconf.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconf.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconformance.msxsl b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconformance.msxsl similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconformance.msxsl rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconformance.msxsl diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconformance.xsl b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconformance.xsl similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmlconformance.xsl rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmlconformance.xsl diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/canonxml.html b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/canonxml.html similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/canonxml.html rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/canonxml.html diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/002.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/002.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/002.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/002.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/002.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/005.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/005.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/005.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/005.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/005.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/006.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/006.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/006.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/006.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/006.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/CVS/Root diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/022.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/022.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/022.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/022.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/022.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/022.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/022.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/022.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/022.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/022.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/022.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/022.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Entries.Log b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Entries.Log similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Entries.Log rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Entries.Log diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/001.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/001.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/001.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/001.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/001.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/002.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/002.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/002.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/002.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/002.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/002.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/003.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/003.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/003.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/003.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/003.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/003.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/001.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/001.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/001.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/001.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/001.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/002.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/003.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/003.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/003.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/003.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/003.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/004.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/004.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/004.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/004.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/004.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/005.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/005.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/005.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/005.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/005.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/006.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/006.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/006.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/006.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/006.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/007.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/007.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/007.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/007.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/007.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/007.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/008.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/008.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/008.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/008.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/008.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/008.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/008.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/008.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/009.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/009.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/009.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/009.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/009.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/009.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/009.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/009.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/010.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/010.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/010.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/010.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/010.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/011.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/011.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/011.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/011.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/011.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/011.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/011.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/011.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/CVS/Root diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/001.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/001.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/002.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/002.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/003.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/003.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/004.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/004.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/005.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/005.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/006.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/006.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/007.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/007.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/008.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/008.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/008.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/008.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/009.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/009.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/009.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/009.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/010.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/010.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/011.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/011.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/011.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/011.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/012.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/012.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/012.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/012.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/013.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/013.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/013.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/013.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/014.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/014.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/014.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/014.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/015.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/015.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/015.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/015.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/016.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/016.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/016.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/016.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/017.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/017.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/017.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/017.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/018.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/018.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/018.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/018.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/019.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/019.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/019.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/019.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/020.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/020.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/020.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/020.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/021.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/021.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/021.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/021.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/022.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/022.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/022.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/022.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/023.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/023.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/023.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/023.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/024.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/024.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/024.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/024.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/025.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/025.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/025.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/025.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/026.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/026.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/026.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/026.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/027.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/027.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/027.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/027.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/028.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/028.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/028.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/028.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/029.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/029.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/029.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/029.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/030.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/030.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/030.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/030.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/031.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/031.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/031.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/031.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/032.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/032.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/032.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/032.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/033.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/033.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/033.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/033.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/034.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/034.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/034.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/034.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/035.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/035.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/035.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/035.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/036.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/036.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/036.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/036.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/037.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/037.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/037.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/037.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/038.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/038.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/038.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/038.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/039.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/039.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/039.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/039.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/040.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/040.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/040.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/040.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/041.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/041.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/041.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/041.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/042.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/042.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/042.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/042.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/043.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/043.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/043.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/043.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/044.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/044.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/044.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/044.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/045.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/045.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/045.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/045.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/046.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/046.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/046.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/046.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/047.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/047.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/047.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/047.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/048.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/048.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/048.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/048.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/049.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/049.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/049.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/049.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/050.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/050.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/050.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/050.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/051.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/051.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/051.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/051.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/052.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/052.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/052.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/052.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/053.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/053.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/053.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/053.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/054.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/054.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/054.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/054.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/055.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/055.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/055.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/055.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/056.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/056.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/056.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/056.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/057.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/057.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/057.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/057.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/058.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/058.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/058.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/058.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/059.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/059.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/059.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/059.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/060.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/060.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/060.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/060.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/061.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/061.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/061.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/061.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/062.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/062.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/062.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/062.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/063.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/063.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/063.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/063.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/064.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/064.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/064.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/064.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/065.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/065.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/065.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/065.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/066.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/066.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/066.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/066.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/067.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/067.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/067.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/067.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/068.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/068.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/068.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/068.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/069.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/069.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/069.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/069.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/070.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/070.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/070.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/070.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/071.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/071.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/071.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/071.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/072.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/072.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/072.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/072.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/073.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/073.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/073.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/073.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/074.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/074.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/074.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/074.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/075.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/075.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/075.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/075.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/076.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/076.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/076.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/076.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/077.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/077.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/077.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/077.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/078.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/078.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/078.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/078.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/079.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/079.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/079.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/079.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/080.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/080.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/080.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/080.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/081.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/081.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/081.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/081.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/082.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/082.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/082.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/082.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/083.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/083.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/083.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/083.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/084.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/084.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/084.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/084.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/085.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/085.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/085.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/085.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/086.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/086.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/086.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/086.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/087.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/087.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/087.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/087.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/088.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/088.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/088.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/088.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/089.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/089.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/089.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/089.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/090.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/090.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/090.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/090.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/091.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/091.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/091.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/091.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/092.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/092.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/092.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/092.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/093.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/093.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/093.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/093.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/094.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/094.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/094.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/094.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/095.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/095.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/095.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/095.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/096.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/096.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/096.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/096.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/097.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/097.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/097.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/097.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/098.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/098.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/098.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/098.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/099.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/099.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/099.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/099.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/100.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/100.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/100.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/100.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/101.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/101.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/101.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/101.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/102.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/102.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/102.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/102.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/103.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/103.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/103.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/103.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/104.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/104.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/104.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/104.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/105.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/105.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/105.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/105.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/106.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/106.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/106.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/106.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/107.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/107.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/107.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/107.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/108.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/108.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/108.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/108.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/109.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/109.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/109.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/109.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/110.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/110.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/110.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/110.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/111.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/111.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/111.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/111.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/112.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/112.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/112.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/112.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/113.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/113.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/113.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/113.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/114.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/114.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/114.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/114.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/115.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/115.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/115.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/115.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/116.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/116.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/116.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/116.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/117.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/117.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/117.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/117.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/118.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/118.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/118.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/118.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/119.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/119.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/119.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/119.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/120.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/120.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/120.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/120.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/121.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/121.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/121.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/121.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/122.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/122.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/122.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/122.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/123.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/123.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/123.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/123.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/124.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/124.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/124.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/124.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/125.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/125.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/125.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/125.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/126.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/126.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/126.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/126.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/127.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/127.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/127.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/127.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/128.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/128.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/128.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/128.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/129.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/129.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/129.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/129.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/130.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/130.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/130.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/130.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/131.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/131.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/131.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/131.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/132.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/132.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/132.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/132.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/133.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/133.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/133.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/133.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/134.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/134.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/134.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/134.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/135.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/135.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/135.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/135.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/136.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/136.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/136.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/136.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/137.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/137.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/137.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/137.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/138.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/138.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/138.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/138.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/139.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/139.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/139.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/139.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/140.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/140.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/140.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/140.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/141.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/141.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/141.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/141.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/142.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/142.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/142.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/142.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/143.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/143.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/143.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/143.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/144.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/144.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/144.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/144.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/145.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/145.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/145.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/145.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/146.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/146.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/146.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/146.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/147.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/147.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/147.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/147.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/148.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/148.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/148.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/148.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/149.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/149.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/149.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/149.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/150.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/150.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/150.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/150.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/151.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/151.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/151.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/151.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/152.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/152.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/152.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/152.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/153.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/153.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/153.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/153.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/154.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/154.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/154.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/154.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/155.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/155.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/155.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/155.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/156.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/156.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/156.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/156.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/157.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/157.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/157.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/157.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/158.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/158.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/158.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/158.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/159.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/159.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/159.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/159.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/160.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/160.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/160.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/160.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/161.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/161.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/161.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/161.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/162.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/162.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/162.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/162.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/163.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/163.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/163.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/163.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/164.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/164.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/164.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/164.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/165.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/165.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/165.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/165.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/166.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/166.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/166.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/166.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/167.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/167.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/167.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/167.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/168.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/168.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/168.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/168.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/169.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/169.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/169.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/169.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/170.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/170.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/170.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/170.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/171.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/171.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/171.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/171.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/172.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/172.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/172.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/172.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/173.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/173.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/173.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/173.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/174.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/174.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/174.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/174.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/175.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/175.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/175.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/175.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/176.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/176.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/176.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/176.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/177.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/177.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/177.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/177.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/178.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/178.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/178.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/178.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/179.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/179.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/179.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/179.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/180.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/180.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/180.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/180.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/181.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/181.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/181.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/181.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/182.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/182.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/182.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/182.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/183.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/183.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/183.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/183.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/184.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/184.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/184.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/184.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/185.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/185.ent similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/185.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/185.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/185.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/185.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/185.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/185.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/186.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/186.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/186.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/186.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/null.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/null.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/sun/valid/null.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/null.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/readme.html b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/readme.html similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/readme.html rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/readme.html diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Entries.Log b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Entries.Log similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Entries.Log rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Entries.Log diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/CVS/Root diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/001.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/001.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/001.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/001.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/001.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/001.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/002.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/002.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/002.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/002.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/002.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/003.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/003.ent similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/003.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/003.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/ext-sa/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/003.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/004.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/004.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/004.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/004.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/004.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/004.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/005.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/005.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/005.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/005.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/005.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/005.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/006.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/006.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/006.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/006.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/006.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/006.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/007.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/007.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/007.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/007.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/007.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/007.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/008.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/008.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/008.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/008.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/008.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/008.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/008.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/008.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/009.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/009.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/009.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/009.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/009.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/009.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/009.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/009.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/010.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/010.ent similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/010.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/010.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/010.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/010.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/011.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/011.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/011.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/011.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/011.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/011.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/011.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/011.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/012.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/012.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/012.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/012.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/012.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/012.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/012.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/012.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/013.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/013.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/013.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/013.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/013.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/013.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/013.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/013.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/014.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/014.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/014.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/014.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/014.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/014.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/014.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/014.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/001.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/002.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/003.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/004.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/005.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/006.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/007.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/008.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/008.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/008.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/008.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/009.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/009.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/009.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/009.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/010.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/011.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/011.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/011.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/011.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/012.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/012.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/012.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/012.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/013.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/013.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/013.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/013.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/014.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/014.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/014.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/014.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/out/CVS/Root diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/001.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/001.ent similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/001.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/001.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/001.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/001.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/002.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/002.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/002.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/002.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/002.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/002.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/003-1.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003-1.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/003-1.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003-1.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/003-2.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003-2.ent similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/003-2.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003-2.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/004-1.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004-1.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/004-1.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004-1.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/004-2.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004-2.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/004-2.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004-2.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/005-1.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005-1.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/005-1.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005-1.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/005-2.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005-2.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/005-2.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005-2.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/006.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/006.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/006.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/006.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/006.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/006.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/007.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/007.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/007.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/007.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/not-sa/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/007.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/008.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/008.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/008.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/008.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/008.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/008.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/008.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/008.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/009.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/009.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/009.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/009.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/009.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/009.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/009.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/009.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/010.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/010.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/010.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/010.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/010.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/010.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/011.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/011.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/011.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/011.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/011.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/011.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/011.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/011.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/012.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/012.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/012.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/012.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/012.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/012.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/012.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/012.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/013.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/013.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/013.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/013.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/013.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/013.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/013.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/013.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/014.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/014.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/014.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/014.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/014.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/014.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/014.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/014.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/015.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/015.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/015.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/015.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/015.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/015.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/015.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/015.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/016.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/016.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/016.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/016.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/016.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/016.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/016.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/016.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/017.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/017.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/017.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/017.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/017.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/017.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/017.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/017.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/018.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/018.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/018.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/018.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/018.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/018.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/018.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/018.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/019.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/019.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/019.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/019.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/019.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/019.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/019.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/019.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/020.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/020.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/020.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/020.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/020.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/020.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/020.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/020.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/021.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/021.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/021.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/021.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/021.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/021.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/021.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/021.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/023.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/023.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/023.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/023.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/023.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/023.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/023.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/023.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/024.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/024.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/024.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/024.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/024.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/024.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/024.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/024.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/025.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/025.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/025.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/025.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/025.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/025.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/025.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/025.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/026.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/026.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/026.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/026.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/026.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/026.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/026.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/026.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/027.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/027.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/027.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/027.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/027.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/027.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/027.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/027.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/028.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/028.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/028.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/028.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/028.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/028.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/028.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/028.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/029.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/029.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/029.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/029.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/029.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/029.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/029.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/029.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/030.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/030.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/030.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/030.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/030.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/030.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/030.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/030.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/031-1.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031-1.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/031-1.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031-1.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/031-2.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031-2.ent old mode 100755 new mode 100644 similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/031-2.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031-2.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/031.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/031.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/001.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/002.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/003.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/004.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/005.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/006.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/007.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/008.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/008.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/008.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/008.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/009.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/009.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/009.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/009.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/010.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/011.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/011.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/011.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/011.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/012.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/012.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/012.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/012.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/013.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/013.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/013.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/013.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/014.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/014.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/014.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/014.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/015.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/015.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/015.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/015.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/016.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/016.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/016.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/016.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/017.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/017.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/017.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/017.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/018.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/018.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/018.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/018.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/019.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/019.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/019.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/019.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/020.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/020.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/020.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/020.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/021.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/021.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/021.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/021.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/022.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/022.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/022.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/022.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/023.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/023.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/023.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/023.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/024.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/024.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/024.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/024.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/025.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/025.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/025.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/025.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/026.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/026.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/026.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/026.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/027.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/027.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/027.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/027.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/028.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/028.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/028.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/028.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/029.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/029.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/029.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/029.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/030.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/030.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/030.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/030.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/031.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/031.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/031.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/031.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/out/CVS/Root diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/001.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/001.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/002.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/002.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/003.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/003.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/004.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/004.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/005.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/005.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/006.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/006.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/007.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/007.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/008.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/008.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/008.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/008.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/009.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/009.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/009.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/009.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/010.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/010.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/011.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/011.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/011.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/011.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/012.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/012.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/012.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/012.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/013.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/013.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/013.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/013.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/014.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/014.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/014.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/014.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/015.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/015.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/015.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/015.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/016.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/016.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/016.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/016.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/017.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/017.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/017.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/017.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/018.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/018.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/018.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/018.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/019.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/019.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/019.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/019.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/020.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/020.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/020.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/020.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/021.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/021.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/021.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/021.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/022.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/022.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/022.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/022.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/023.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/023.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/023.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/023.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/024.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/024.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/024.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/024.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/025.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/025.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/025.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/025.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/026.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/026.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/026.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/026.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/027.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/027.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/027.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/027.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/028.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/028.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/028.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/028.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/029.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/029.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/029.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/029.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/030.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/030.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/030.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/030.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/031.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/031.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/031.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/031.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/032.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/032.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/032.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/032.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/033.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/033.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/033.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/033.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/034.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/034.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/034.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/034.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/035.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/035.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/035.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/035.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/036.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/036.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/036.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/036.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/037.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/037.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/037.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/037.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/038.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/038.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/038.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/038.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/039.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/039.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/039.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/039.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/040.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/040.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/040.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/040.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/041.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/041.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/041.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/041.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/042.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/042.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/042.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/042.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/043.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/043.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/043.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/043.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/044.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/044.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/044.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/044.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/045.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/045.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/045.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/045.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/046.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/046.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/046.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/046.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/047.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/047.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/047.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/047.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/048.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/048.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/048.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/048.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/049.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/049.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/049.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/049.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/050.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/050.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/050.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/050.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/051.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/051.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/051.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/051.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/052.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/052.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/052.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/052.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/053.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/053.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/053.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/053.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/054.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/054.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/054.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/054.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/055.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/055.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/055.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/055.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/056.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/056.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/056.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/056.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/057.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/057.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/057.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/057.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/058.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/058.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/058.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/058.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/059.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/059.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/059.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/059.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/060.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/060.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/060.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/060.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/061.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/061.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/061.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/061.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/062.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/062.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/062.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/062.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/063.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/063.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/063.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/063.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/064.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/064.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/064.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/064.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/065.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/065.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/065.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/065.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/066.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/066.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/066.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/066.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/067.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/067.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/067.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/067.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/068.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/068.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/068.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/068.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/069.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/069.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/069.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/069.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/070.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/070.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/070.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/070.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/071.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/071.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/071.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/071.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/072.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/072.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/072.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/072.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/073.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/073.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/073.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/073.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/074.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/074.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/074.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/074.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/075.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/075.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/075.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/075.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/076.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/076.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/076.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/076.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/077.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/077.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/077.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/077.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/078.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/078.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/078.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/078.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/079.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/079.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/079.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/079.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/080.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/080.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/080.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/080.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/081.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/081.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/081.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/081.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/082.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/082.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/082.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/082.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/083.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/083.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/083.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/083.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/084.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/084.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/084.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/084.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/085.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/085.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/085.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/085.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/086.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/086.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/086.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/086.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/087.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/087.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/087.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/087.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/088.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/088.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/088.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/088.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/089.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/089.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/089.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/089.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/090.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/090.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/090.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/090.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/091.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/091.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/091.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/091.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/092.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/092.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/092.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/092.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/093.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/093.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/093.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/093.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/094.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/094.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/094.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/094.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/095.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/095.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/095.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/095.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/096.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/096.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/096.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/096.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/097.ent b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/097.ent similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/097.ent rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/097.ent diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/097.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/097.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/097.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/097.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/098.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/098.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/098.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/098.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/099.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/099.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/099.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/099.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/100.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/100.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/100.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/100.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/101.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/101.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/101.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/101.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/102.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/102.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/102.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/102.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/103.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/103.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/103.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/103.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/104.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/104.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/104.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/104.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/105.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/105.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/105.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/105.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/106.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/106.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/106.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/106.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/107.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/107.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/107.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/107.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/108.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/108.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/108.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/108.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/109.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/109.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/109.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/109.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/110.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/110.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/110.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/110.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/111.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/111.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/111.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/111.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/112.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/112.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/112.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/112.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/113.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/113.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/113.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/113.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/114.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/114.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/114.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/114.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/115.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/115.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/115.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/115.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/116.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/116.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/116.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/116.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/117.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/117.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/117.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/117.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/118.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/118.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/118.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/118.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/119.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/119.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/119.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/119.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/001.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/001.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/001.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/002.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/002.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/002.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/003.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/003.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/003.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/004.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/004.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/004.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/005.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/005.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/005.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/006.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/006.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/006.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/007.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/007.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/007.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/008.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/008.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/008.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/008.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/009.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/009.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/009.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/009.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/010.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/010.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/010.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/011.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/011.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/011.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/011.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/012.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/012.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/012.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/012.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/013.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/013.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/013.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/013.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/014.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/014.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/014.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/014.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/015.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/015.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/015.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/015.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/016.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/016.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/016.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/016.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/017.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/017.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/017.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/017.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/018.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/018.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/018.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/018.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/019.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/019.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/019.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/019.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/020.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/020.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/020.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/020.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/021.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/021.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/021.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/021.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/022.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/022.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/022.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/022.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/023.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/023.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/023.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/023.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/024.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/024.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/024.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/024.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/025.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/025.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/025.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/025.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/026.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/026.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/026.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/026.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/027.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/027.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/027.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/027.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/028.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/028.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/028.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/028.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/029.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/029.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/029.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/029.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/030.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/030.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/030.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/030.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/031.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/031.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/031.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/031.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/032.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/032.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/032.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/032.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/033.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/033.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/033.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/033.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/034.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/034.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/034.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/034.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/035.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/035.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/035.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/035.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/036.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/036.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/036.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/036.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/037.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/037.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/037.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/037.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/038.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/038.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/038.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/038.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/039.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/039.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/039.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/039.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/040.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/040.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/040.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/040.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/041.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/041.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/041.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/041.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/042.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/042.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/042.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/042.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/043.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/043.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/043.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/043.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/044.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/044.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/044.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/044.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/045.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/045.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/045.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/045.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/046.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/046.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/046.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/046.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/047.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/047.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/047.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/047.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/048.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/048.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/048.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/048.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/049.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/049.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/049.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/049.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/050.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/050.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/050.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/050.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/051.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/051.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/051.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/051.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/052.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/052.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/052.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/052.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/053.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/053.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/053.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/053.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/054.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/054.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/054.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/054.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/055.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/055.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/055.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/055.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/056.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/056.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/056.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/056.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/057.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/057.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/057.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/057.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/058.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/058.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/058.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/058.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/059.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/059.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/059.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/059.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/060.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/060.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/060.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/060.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/061.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/061.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/061.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/061.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/062.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/062.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/062.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/062.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/063.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/063.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/063.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/063.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/064.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/064.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/064.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/064.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/065.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/065.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/065.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/065.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/066.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/066.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/066.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/066.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/067.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/067.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/067.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/067.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/068.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/068.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/068.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/068.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/069.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/069.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/069.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/069.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/070.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/070.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/070.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/070.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/071.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/071.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/071.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/071.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/072.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/072.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/072.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/072.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/073.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/073.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/073.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/073.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/074.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/074.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/074.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/074.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/075.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/075.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/075.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/075.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/076.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/076.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/076.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/076.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/077.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/077.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/077.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/077.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/078.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/078.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/078.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/078.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/079.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/079.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/079.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/079.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/080.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/080.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/080.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/080.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/081.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/081.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/081.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/081.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/082.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/082.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/082.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/082.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/083.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/083.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/083.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/083.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/084.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/084.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/084.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/084.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/085.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/085.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/085.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/085.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/086.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/086.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/086.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/086.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/087.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/087.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/087.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/087.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/088.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/088.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/088.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/088.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/089.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/089.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/089.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/089.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/090.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/090.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/090.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/090.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/091.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/091.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/091.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/091.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/092.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/092.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/092.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/092.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/093.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/093.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/093.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/093.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/094.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/094.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/094.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/094.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/095.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/095.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/095.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/095.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/096.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/096.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/096.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/096.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/097.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/097.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/097.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/097.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/098.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/098.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/098.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/098.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/099.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/099.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/099.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/099.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/100.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/100.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/100.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/100.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/101.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/101.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/101.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/101.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/102.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/102.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/102.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/102.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/103.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/103.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/103.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/103.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/104.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/104.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/104.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/104.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/105.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/105.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/105.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/105.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/106.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/106.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/106.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/106.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/107.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/107.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/107.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/107.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/108.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/108.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/108.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/108.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/109.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/109.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/109.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/109.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/110.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/110.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/110.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/110.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/111.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/111.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/111.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/111.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/112.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/112.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/112.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/112.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/113.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/113.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/113.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/113.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/114.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/114.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/114.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/114.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/115.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/115.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/115.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/115.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/116.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/116.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/116.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/116.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/117.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/117.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/117.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/117.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/118.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/118.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/118.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/118.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/119.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/119.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/119.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/119.xml diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Entries b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Entries similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Entries rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Entries diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Repository b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Repository similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Repository rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Repository diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Root b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Root similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Root rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/out/CVS/Root diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/xmltest.xml b/tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/xmltest.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/xmltest.xml rename to tests/auto/corelib/xml/qxmlstream/XML-Test-Suite/xmlconf/xmltest/xmltest.xml diff --git a/tests/auto/qxmlstream/data/001.ref b/tests/auto/corelib/xml/qxmlstream/data/001.ref similarity index 100% rename from tests/auto/qxmlstream/data/001.ref rename to tests/auto/corelib/xml/qxmlstream/data/001.ref diff --git a/tests/auto/qxmlstream/data/001.xml b/tests/auto/corelib/xml/qxmlstream/data/001.xml similarity index 100% rename from tests/auto/qxmlstream/data/001.xml rename to tests/auto/corelib/xml/qxmlstream/data/001.xml diff --git a/tests/auto/qxmlstream/data/002.ref b/tests/auto/corelib/xml/qxmlstream/data/002.ref similarity index 100% rename from tests/auto/qxmlstream/data/002.ref rename to tests/auto/corelib/xml/qxmlstream/data/002.ref diff --git a/tests/auto/qxmlstream/data/002.xml b/tests/auto/corelib/xml/qxmlstream/data/002.xml similarity index 100% rename from tests/auto/qxmlstream/data/002.xml rename to tests/auto/corelib/xml/qxmlstream/data/002.xml diff --git a/tests/auto/qxmlstream/data/003.ref b/tests/auto/corelib/xml/qxmlstream/data/003.ref similarity index 100% rename from tests/auto/qxmlstream/data/003.ref rename to tests/auto/corelib/xml/qxmlstream/data/003.ref diff --git a/tests/auto/qxmlstream/data/003.xml b/tests/auto/corelib/xml/qxmlstream/data/003.xml similarity index 100% rename from tests/auto/qxmlstream/data/003.xml rename to tests/auto/corelib/xml/qxmlstream/data/003.xml diff --git a/tests/auto/qxmlstream/data/004.ref b/tests/auto/corelib/xml/qxmlstream/data/004.ref similarity index 100% rename from tests/auto/qxmlstream/data/004.ref rename to tests/auto/corelib/xml/qxmlstream/data/004.ref diff --git a/tests/auto/qxmlstream/data/004.xml b/tests/auto/corelib/xml/qxmlstream/data/004.xml similarity index 100% rename from tests/auto/qxmlstream/data/004.xml rename to tests/auto/corelib/xml/qxmlstream/data/004.xml diff --git a/tests/auto/qxmlstream/data/005.ref b/tests/auto/corelib/xml/qxmlstream/data/005.ref similarity index 100% rename from tests/auto/qxmlstream/data/005.ref rename to tests/auto/corelib/xml/qxmlstream/data/005.ref diff --git a/tests/auto/qxmlstream/data/005.xml b/tests/auto/corelib/xml/qxmlstream/data/005.xml similarity index 100% rename from tests/auto/qxmlstream/data/005.xml rename to tests/auto/corelib/xml/qxmlstream/data/005.xml diff --git a/tests/auto/qxmlstream/data/006.ref b/tests/auto/corelib/xml/qxmlstream/data/006.ref similarity index 100% rename from tests/auto/qxmlstream/data/006.ref rename to tests/auto/corelib/xml/qxmlstream/data/006.ref diff --git a/tests/auto/qxmlstream/data/006.xml b/tests/auto/corelib/xml/qxmlstream/data/006.xml similarity index 100% rename from tests/auto/qxmlstream/data/006.xml rename to tests/auto/corelib/xml/qxmlstream/data/006.xml diff --git a/tests/auto/qxmlstream/data/007.ref b/tests/auto/corelib/xml/qxmlstream/data/007.ref similarity index 100% rename from tests/auto/qxmlstream/data/007.ref rename to tests/auto/corelib/xml/qxmlstream/data/007.ref diff --git a/tests/auto/qxmlstream/data/007.xml b/tests/auto/corelib/xml/qxmlstream/data/007.xml similarity index 100% rename from tests/auto/qxmlstream/data/007.xml rename to tests/auto/corelib/xml/qxmlstream/data/007.xml diff --git a/tests/auto/qxmlstream/data/008.ref b/tests/auto/corelib/xml/qxmlstream/data/008.ref similarity index 100% rename from tests/auto/qxmlstream/data/008.ref rename to tests/auto/corelib/xml/qxmlstream/data/008.ref diff --git a/tests/auto/qxmlstream/data/008.xml b/tests/auto/corelib/xml/qxmlstream/data/008.xml similarity index 100% rename from tests/auto/qxmlstream/data/008.xml rename to tests/auto/corelib/xml/qxmlstream/data/008.xml diff --git a/tests/auto/qxmlstream/data/009.ref b/tests/auto/corelib/xml/qxmlstream/data/009.ref similarity index 100% rename from tests/auto/qxmlstream/data/009.ref rename to tests/auto/corelib/xml/qxmlstream/data/009.ref diff --git a/tests/auto/qxmlstream/data/009.xml b/tests/auto/corelib/xml/qxmlstream/data/009.xml similarity index 100% rename from tests/auto/qxmlstream/data/009.xml rename to tests/auto/corelib/xml/qxmlstream/data/009.xml diff --git a/tests/auto/qxmlstream/data/010.ref b/tests/auto/corelib/xml/qxmlstream/data/010.ref similarity index 100% rename from tests/auto/qxmlstream/data/010.ref rename to tests/auto/corelib/xml/qxmlstream/data/010.ref diff --git a/tests/auto/qxmlstream/data/010.xml b/tests/auto/corelib/xml/qxmlstream/data/010.xml similarity index 100% rename from tests/auto/qxmlstream/data/010.xml rename to tests/auto/corelib/xml/qxmlstream/data/010.xml diff --git a/tests/auto/qxmlstream/data/011.ref b/tests/auto/corelib/xml/qxmlstream/data/011.ref similarity index 100% rename from tests/auto/qxmlstream/data/011.ref rename to tests/auto/corelib/xml/qxmlstream/data/011.ref diff --git a/tests/auto/qxmlstream/data/011.xml b/tests/auto/corelib/xml/qxmlstream/data/011.xml similarity index 100% rename from tests/auto/qxmlstream/data/011.xml rename to tests/auto/corelib/xml/qxmlstream/data/011.xml diff --git a/tests/auto/qxmlstream/data/012.ref b/tests/auto/corelib/xml/qxmlstream/data/012.ref similarity index 100% rename from tests/auto/qxmlstream/data/012.ref rename to tests/auto/corelib/xml/qxmlstream/data/012.ref diff --git a/tests/auto/qxmlstream/data/012.xml b/tests/auto/corelib/xml/qxmlstream/data/012.xml similarity index 100% rename from tests/auto/qxmlstream/data/012.xml rename to tests/auto/corelib/xml/qxmlstream/data/012.xml diff --git a/tests/auto/qxmlstream/data/013.ref b/tests/auto/corelib/xml/qxmlstream/data/013.ref similarity index 100% rename from tests/auto/qxmlstream/data/013.ref rename to tests/auto/corelib/xml/qxmlstream/data/013.ref diff --git a/tests/auto/qxmlstream/data/013.xml b/tests/auto/corelib/xml/qxmlstream/data/013.xml similarity index 100% rename from tests/auto/qxmlstream/data/013.xml rename to tests/auto/corelib/xml/qxmlstream/data/013.xml diff --git a/tests/auto/qxmlstream/data/014.ref b/tests/auto/corelib/xml/qxmlstream/data/014.ref similarity index 100% rename from tests/auto/qxmlstream/data/014.ref rename to tests/auto/corelib/xml/qxmlstream/data/014.ref diff --git a/tests/auto/qxmlstream/data/014.xml b/tests/auto/corelib/xml/qxmlstream/data/014.xml similarity index 100% rename from tests/auto/qxmlstream/data/014.xml rename to tests/auto/corelib/xml/qxmlstream/data/014.xml diff --git a/tests/auto/qxmlstream/data/015.ref b/tests/auto/corelib/xml/qxmlstream/data/015.ref similarity index 100% rename from tests/auto/qxmlstream/data/015.ref rename to tests/auto/corelib/xml/qxmlstream/data/015.ref diff --git a/tests/auto/qxmlstream/data/015.xml b/tests/auto/corelib/xml/qxmlstream/data/015.xml similarity index 100% rename from tests/auto/qxmlstream/data/015.xml rename to tests/auto/corelib/xml/qxmlstream/data/015.xml diff --git a/tests/auto/qxmlstream/data/016.ref b/tests/auto/corelib/xml/qxmlstream/data/016.ref similarity index 100% rename from tests/auto/qxmlstream/data/016.ref rename to tests/auto/corelib/xml/qxmlstream/data/016.ref diff --git a/tests/auto/qxmlstream/data/016.xml b/tests/auto/corelib/xml/qxmlstream/data/016.xml similarity index 100% rename from tests/auto/qxmlstream/data/016.xml rename to tests/auto/corelib/xml/qxmlstream/data/016.xml diff --git a/tests/auto/qxmlstream/data/017.ref b/tests/auto/corelib/xml/qxmlstream/data/017.ref similarity index 100% rename from tests/auto/qxmlstream/data/017.ref rename to tests/auto/corelib/xml/qxmlstream/data/017.ref diff --git a/tests/auto/qxmlstream/data/017.xml b/tests/auto/corelib/xml/qxmlstream/data/017.xml similarity index 100% rename from tests/auto/qxmlstream/data/017.xml rename to tests/auto/corelib/xml/qxmlstream/data/017.xml diff --git a/tests/auto/qxmlstream/data/018.ref b/tests/auto/corelib/xml/qxmlstream/data/018.ref similarity index 100% rename from tests/auto/qxmlstream/data/018.ref rename to tests/auto/corelib/xml/qxmlstream/data/018.ref diff --git a/tests/auto/qxmlstream/data/018.xml b/tests/auto/corelib/xml/qxmlstream/data/018.xml similarity index 100% rename from tests/auto/qxmlstream/data/018.xml rename to tests/auto/corelib/xml/qxmlstream/data/018.xml diff --git a/tests/auto/qxmlstream/data/019.ref b/tests/auto/corelib/xml/qxmlstream/data/019.ref similarity index 100% rename from tests/auto/qxmlstream/data/019.ref rename to tests/auto/corelib/xml/qxmlstream/data/019.ref diff --git a/tests/auto/qxmlstream/data/019.xml b/tests/auto/corelib/xml/qxmlstream/data/019.xml similarity index 100% rename from tests/auto/qxmlstream/data/019.xml rename to tests/auto/corelib/xml/qxmlstream/data/019.xml diff --git a/tests/auto/qxmlstream/data/020.ref b/tests/auto/corelib/xml/qxmlstream/data/020.ref similarity index 100% rename from tests/auto/qxmlstream/data/020.ref rename to tests/auto/corelib/xml/qxmlstream/data/020.ref diff --git a/tests/auto/qxmlstream/data/020.xml b/tests/auto/corelib/xml/qxmlstream/data/020.xml similarity index 100% rename from tests/auto/qxmlstream/data/020.xml rename to tests/auto/corelib/xml/qxmlstream/data/020.xml diff --git a/tests/auto/qxmlstream/data/021.ref b/tests/auto/corelib/xml/qxmlstream/data/021.ref similarity index 100% rename from tests/auto/qxmlstream/data/021.ref rename to tests/auto/corelib/xml/qxmlstream/data/021.ref diff --git a/tests/auto/qxmlstream/data/021.xml b/tests/auto/corelib/xml/qxmlstream/data/021.xml similarity index 100% rename from tests/auto/qxmlstream/data/021.xml rename to tests/auto/corelib/xml/qxmlstream/data/021.xml diff --git a/tests/auto/qxmlstream/data/022.ref b/tests/auto/corelib/xml/qxmlstream/data/022.ref similarity index 100% rename from tests/auto/qxmlstream/data/022.ref rename to tests/auto/corelib/xml/qxmlstream/data/022.ref diff --git a/tests/auto/qxmlstream/data/022.xml b/tests/auto/corelib/xml/qxmlstream/data/022.xml similarity index 100% rename from tests/auto/qxmlstream/data/022.xml rename to tests/auto/corelib/xml/qxmlstream/data/022.xml diff --git a/tests/auto/qxmlstream/data/023.ref b/tests/auto/corelib/xml/qxmlstream/data/023.ref similarity index 100% rename from tests/auto/qxmlstream/data/023.ref rename to tests/auto/corelib/xml/qxmlstream/data/023.ref diff --git a/tests/auto/qxmlstream/data/023.xml b/tests/auto/corelib/xml/qxmlstream/data/023.xml similarity index 100% rename from tests/auto/qxmlstream/data/023.xml rename to tests/auto/corelib/xml/qxmlstream/data/023.xml diff --git a/tests/auto/qxmlstream/data/024.ref b/tests/auto/corelib/xml/qxmlstream/data/024.ref similarity index 100% rename from tests/auto/qxmlstream/data/024.ref rename to tests/auto/corelib/xml/qxmlstream/data/024.ref diff --git a/tests/auto/qxmlstream/data/024.xml b/tests/auto/corelib/xml/qxmlstream/data/024.xml similarity index 100% rename from tests/auto/qxmlstream/data/024.xml rename to tests/auto/corelib/xml/qxmlstream/data/024.xml diff --git a/tests/auto/qxmlstream/data/025.ref b/tests/auto/corelib/xml/qxmlstream/data/025.ref similarity index 100% rename from tests/auto/qxmlstream/data/025.ref rename to tests/auto/corelib/xml/qxmlstream/data/025.ref diff --git a/tests/auto/qxmlstream/data/025.xml b/tests/auto/corelib/xml/qxmlstream/data/025.xml similarity index 100% rename from tests/auto/qxmlstream/data/025.xml rename to tests/auto/corelib/xml/qxmlstream/data/025.xml diff --git a/tests/auto/qxmlstream/data/026.ref b/tests/auto/corelib/xml/qxmlstream/data/026.ref similarity index 100% rename from tests/auto/qxmlstream/data/026.ref rename to tests/auto/corelib/xml/qxmlstream/data/026.ref diff --git a/tests/auto/qxmlstream/data/026.xml b/tests/auto/corelib/xml/qxmlstream/data/026.xml similarity index 100% rename from tests/auto/qxmlstream/data/026.xml rename to tests/auto/corelib/xml/qxmlstream/data/026.xml diff --git a/tests/auto/qxmlstream/data/027.ref b/tests/auto/corelib/xml/qxmlstream/data/027.ref similarity index 100% rename from tests/auto/qxmlstream/data/027.ref rename to tests/auto/corelib/xml/qxmlstream/data/027.ref diff --git a/tests/auto/qxmlstream/data/027.xml b/tests/auto/corelib/xml/qxmlstream/data/027.xml similarity index 100% rename from tests/auto/qxmlstream/data/027.xml rename to tests/auto/corelib/xml/qxmlstream/data/027.xml diff --git a/tests/auto/qxmlstream/data/028.ref b/tests/auto/corelib/xml/qxmlstream/data/028.ref similarity index 100% rename from tests/auto/qxmlstream/data/028.ref rename to tests/auto/corelib/xml/qxmlstream/data/028.ref diff --git a/tests/auto/qxmlstream/data/028.xml b/tests/auto/corelib/xml/qxmlstream/data/028.xml similarity index 100% rename from tests/auto/qxmlstream/data/028.xml rename to tests/auto/corelib/xml/qxmlstream/data/028.xml diff --git a/tests/auto/qxmlstream/data/029.ref b/tests/auto/corelib/xml/qxmlstream/data/029.ref similarity index 100% rename from tests/auto/qxmlstream/data/029.ref rename to tests/auto/corelib/xml/qxmlstream/data/029.ref diff --git a/tests/auto/qxmlstream/data/029.xml b/tests/auto/corelib/xml/qxmlstream/data/029.xml similarity index 100% rename from tests/auto/qxmlstream/data/029.xml rename to tests/auto/corelib/xml/qxmlstream/data/029.xml diff --git a/tests/auto/qxmlstream/data/030.ref b/tests/auto/corelib/xml/qxmlstream/data/030.ref similarity index 100% rename from tests/auto/qxmlstream/data/030.ref rename to tests/auto/corelib/xml/qxmlstream/data/030.ref diff --git a/tests/auto/qxmlstream/data/030.xml b/tests/auto/corelib/xml/qxmlstream/data/030.xml similarity index 100% rename from tests/auto/qxmlstream/data/030.xml rename to tests/auto/corelib/xml/qxmlstream/data/030.xml diff --git a/tests/auto/qxmlstream/data/031.ref b/tests/auto/corelib/xml/qxmlstream/data/031.ref similarity index 100% rename from tests/auto/qxmlstream/data/031.ref rename to tests/auto/corelib/xml/qxmlstream/data/031.ref diff --git a/tests/auto/qxmlstream/data/031.xml b/tests/auto/corelib/xml/qxmlstream/data/031.xml similarity index 100% rename from tests/auto/qxmlstream/data/031.xml rename to tests/auto/corelib/xml/qxmlstream/data/031.xml diff --git a/tests/auto/qxmlstream/data/032.ref b/tests/auto/corelib/xml/qxmlstream/data/032.ref similarity index 100% rename from tests/auto/qxmlstream/data/032.ref rename to tests/auto/corelib/xml/qxmlstream/data/032.ref diff --git a/tests/auto/qxmlstream/data/032.xml b/tests/auto/corelib/xml/qxmlstream/data/032.xml similarity index 100% rename from tests/auto/qxmlstream/data/032.xml rename to tests/auto/corelib/xml/qxmlstream/data/032.xml diff --git a/tests/auto/qxmlstream/data/033.ref b/tests/auto/corelib/xml/qxmlstream/data/033.ref similarity index 100% rename from tests/auto/qxmlstream/data/033.ref rename to tests/auto/corelib/xml/qxmlstream/data/033.ref diff --git a/tests/auto/qxmlstream/data/033.xml b/tests/auto/corelib/xml/qxmlstream/data/033.xml similarity index 100% rename from tests/auto/qxmlstream/data/033.xml rename to tests/auto/corelib/xml/qxmlstream/data/033.xml diff --git a/tests/auto/qxmlstream/data/034.ref b/tests/auto/corelib/xml/qxmlstream/data/034.ref similarity index 100% rename from tests/auto/qxmlstream/data/034.ref rename to tests/auto/corelib/xml/qxmlstream/data/034.ref diff --git a/tests/auto/qxmlstream/data/034.xml b/tests/auto/corelib/xml/qxmlstream/data/034.xml similarity index 100% rename from tests/auto/qxmlstream/data/034.xml rename to tests/auto/corelib/xml/qxmlstream/data/034.xml diff --git a/tests/auto/qxmlstream/data/035.ref b/tests/auto/corelib/xml/qxmlstream/data/035.ref similarity index 100% rename from tests/auto/qxmlstream/data/035.ref rename to tests/auto/corelib/xml/qxmlstream/data/035.ref diff --git a/tests/auto/qxmlstream/data/035.xml b/tests/auto/corelib/xml/qxmlstream/data/035.xml similarity index 100% rename from tests/auto/qxmlstream/data/035.xml rename to tests/auto/corelib/xml/qxmlstream/data/035.xml diff --git a/tests/auto/qxmlstream/data/036.ref b/tests/auto/corelib/xml/qxmlstream/data/036.ref similarity index 100% rename from tests/auto/qxmlstream/data/036.ref rename to tests/auto/corelib/xml/qxmlstream/data/036.ref diff --git a/tests/auto/qxmlstream/data/036.xml b/tests/auto/corelib/xml/qxmlstream/data/036.xml similarity index 100% rename from tests/auto/qxmlstream/data/036.xml rename to tests/auto/corelib/xml/qxmlstream/data/036.xml diff --git a/tests/auto/qxmlstream/data/037.ref b/tests/auto/corelib/xml/qxmlstream/data/037.ref similarity index 100% rename from tests/auto/qxmlstream/data/037.ref rename to tests/auto/corelib/xml/qxmlstream/data/037.ref diff --git a/tests/auto/qxmlstream/data/037.xml b/tests/auto/corelib/xml/qxmlstream/data/037.xml similarity index 100% rename from tests/auto/qxmlstream/data/037.xml rename to tests/auto/corelib/xml/qxmlstream/data/037.xml diff --git a/tests/auto/qxmlstream/data/038.ref b/tests/auto/corelib/xml/qxmlstream/data/038.ref similarity index 100% rename from tests/auto/qxmlstream/data/038.ref rename to tests/auto/corelib/xml/qxmlstream/data/038.ref diff --git a/tests/auto/qxmlstream/data/038.xml b/tests/auto/corelib/xml/qxmlstream/data/038.xml similarity index 100% rename from tests/auto/qxmlstream/data/038.xml rename to tests/auto/corelib/xml/qxmlstream/data/038.xml diff --git a/tests/auto/qxmlstream/data/039.ref b/tests/auto/corelib/xml/qxmlstream/data/039.ref similarity index 100% rename from tests/auto/qxmlstream/data/039.ref rename to tests/auto/corelib/xml/qxmlstream/data/039.ref diff --git a/tests/auto/qxmlstream/data/039.xml b/tests/auto/corelib/xml/qxmlstream/data/039.xml similarity index 100% rename from tests/auto/qxmlstream/data/039.xml rename to tests/auto/corelib/xml/qxmlstream/data/039.xml diff --git a/tests/auto/qxmlstream/data/040.ref b/tests/auto/corelib/xml/qxmlstream/data/040.ref similarity index 100% rename from tests/auto/qxmlstream/data/040.ref rename to tests/auto/corelib/xml/qxmlstream/data/040.ref diff --git a/tests/auto/qxmlstream/data/040.xml b/tests/auto/corelib/xml/qxmlstream/data/040.xml similarity index 100% rename from tests/auto/qxmlstream/data/040.xml rename to tests/auto/corelib/xml/qxmlstream/data/040.xml diff --git a/tests/auto/qxmlstream/data/041.ref b/tests/auto/corelib/xml/qxmlstream/data/041.ref similarity index 100% rename from tests/auto/qxmlstream/data/041.ref rename to tests/auto/corelib/xml/qxmlstream/data/041.ref diff --git a/tests/auto/qxmlstream/data/041.xml b/tests/auto/corelib/xml/qxmlstream/data/041.xml similarity index 100% rename from tests/auto/qxmlstream/data/041.xml rename to tests/auto/corelib/xml/qxmlstream/data/041.xml diff --git a/tests/auto/qxmlstream/data/042.ref b/tests/auto/corelib/xml/qxmlstream/data/042.ref similarity index 100% rename from tests/auto/qxmlstream/data/042.ref rename to tests/auto/corelib/xml/qxmlstream/data/042.ref diff --git a/tests/auto/qxmlstream/data/042.xml b/tests/auto/corelib/xml/qxmlstream/data/042.xml similarity index 100% rename from tests/auto/qxmlstream/data/042.xml rename to tests/auto/corelib/xml/qxmlstream/data/042.xml diff --git a/tests/auto/qxmlstream/data/043.ref b/tests/auto/corelib/xml/qxmlstream/data/043.ref similarity index 100% rename from tests/auto/qxmlstream/data/043.ref rename to tests/auto/corelib/xml/qxmlstream/data/043.ref diff --git a/tests/auto/qxmlstream/data/043.xml b/tests/auto/corelib/xml/qxmlstream/data/043.xml similarity index 100% rename from tests/auto/qxmlstream/data/043.xml rename to tests/auto/corelib/xml/qxmlstream/data/043.xml diff --git a/tests/auto/qxmlstream/data/044.ref b/tests/auto/corelib/xml/qxmlstream/data/044.ref similarity index 100% rename from tests/auto/qxmlstream/data/044.ref rename to tests/auto/corelib/xml/qxmlstream/data/044.ref diff --git a/tests/auto/qxmlstream/data/044.xml b/tests/auto/corelib/xml/qxmlstream/data/044.xml similarity index 100% rename from tests/auto/qxmlstream/data/044.xml rename to tests/auto/corelib/xml/qxmlstream/data/044.xml diff --git a/tests/auto/qxmlstream/data/045.ref b/tests/auto/corelib/xml/qxmlstream/data/045.ref similarity index 100% rename from tests/auto/qxmlstream/data/045.ref rename to tests/auto/corelib/xml/qxmlstream/data/045.ref diff --git a/tests/auto/qxmlstream/data/045.xml b/tests/auto/corelib/xml/qxmlstream/data/045.xml similarity index 100% rename from tests/auto/qxmlstream/data/045.xml rename to tests/auto/corelib/xml/qxmlstream/data/045.xml diff --git a/tests/auto/qxmlstream/data/046.ref b/tests/auto/corelib/xml/qxmlstream/data/046.ref similarity index 100% rename from tests/auto/qxmlstream/data/046.ref rename to tests/auto/corelib/xml/qxmlstream/data/046.ref diff --git a/tests/auto/qxmlstream/data/046.xml b/tests/auto/corelib/xml/qxmlstream/data/046.xml similarity index 100% rename from tests/auto/qxmlstream/data/046.xml rename to tests/auto/corelib/xml/qxmlstream/data/046.xml diff --git a/tests/auto/qxmlstream/data/047.ref b/tests/auto/corelib/xml/qxmlstream/data/047.ref similarity index 100% rename from tests/auto/qxmlstream/data/047.ref rename to tests/auto/corelib/xml/qxmlstream/data/047.ref diff --git a/tests/auto/qxmlstream/data/047.xml b/tests/auto/corelib/xml/qxmlstream/data/047.xml similarity index 100% rename from tests/auto/qxmlstream/data/047.xml rename to tests/auto/corelib/xml/qxmlstream/data/047.xml diff --git a/tests/auto/qxmlstream/data/048.ref b/tests/auto/corelib/xml/qxmlstream/data/048.ref similarity index 100% rename from tests/auto/qxmlstream/data/048.ref rename to tests/auto/corelib/xml/qxmlstream/data/048.ref diff --git a/tests/auto/qxmlstream/data/048.xml b/tests/auto/corelib/xml/qxmlstream/data/048.xml similarity index 100% rename from tests/auto/qxmlstream/data/048.xml rename to tests/auto/corelib/xml/qxmlstream/data/048.xml diff --git a/tests/auto/qxmlstream/data/051reduced.ref b/tests/auto/corelib/xml/qxmlstream/data/051reduced.ref similarity index 100% rename from tests/auto/qxmlstream/data/051reduced.ref rename to tests/auto/corelib/xml/qxmlstream/data/051reduced.ref diff --git a/tests/auto/qxmlstream/data/051reduced.xml b/tests/auto/corelib/xml/qxmlstream/data/051reduced.xml similarity index 100% rename from tests/auto/qxmlstream/data/051reduced.xml rename to tests/auto/corelib/xml/qxmlstream/data/051reduced.xml diff --git a/tests/auto/qxmlstream/data/1.ref b/tests/auto/corelib/xml/qxmlstream/data/1.ref similarity index 100% rename from tests/auto/qxmlstream/data/1.ref rename to tests/auto/corelib/xml/qxmlstream/data/1.ref diff --git a/tests/auto/qxmlstream/data/1.xml b/tests/auto/corelib/xml/qxmlstream/data/1.xml similarity index 100% rename from tests/auto/qxmlstream/data/1.xml rename to tests/auto/corelib/xml/qxmlstream/data/1.xml diff --git a/tests/auto/qxmlstream/data/10.ref b/tests/auto/corelib/xml/qxmlstream/data/10.ref similarity index 100% rename from tests/auto/qxmlstream/data/10.ref rename to tests/auto/corelib/xml/qxmlstream/data/10.ref diff --git a/tests/auto/qxmlstream/data/10.xml b/tests/auto/corelib/xml/qxmlstream/data/10.xml similarity index 100% rename from tests/auto/qxmlstream/data/10.xml rename to tests/auto/corelib/xml/qxmlstream/data/10.xml diff --git a/tests/auto/qxmlstream/data/11.ref b/tests/auto/corelib/xml/qxmlstream/data/11.ref similarity index 100% rename from tests/auto/qxmlstream/data/11.ref rename to tests/auto/corelib/xml/qxmlstream/data/11.ref diff --git a/tests/auto/qxmlstream/data/11.xml b/tests/auto/corelib/xml/qxmlstream/data/11.xml similarity index 100% rename from tests/auto/qxmlstream/data/11.xml rename to tests/auto/corelib/xml/qxmlstream/data/11.xml diff --git a/tests/auto/qxmlstream/data/12.ref b/tests/auto/corelib/xml/qxmlstream/data/12.ref similarity index 100% rename from tests/auto/qxmlstream/data/12.ref rename to tests/auto/corelib/xml/qxmlstream/data/12.ref diff --git a/tests/auto/qxmlstream/data/12.xml b/tests/auto/corelib/xml/qxmlstream/data/12.xml similarity index 100% rename from tests/auto/qxmlstream/data/12.xml rename to tests/auto/corelib/xml/qxmlstream/data/12.xml diff --git a/tests/auto/qxmlstream/data/13.ref b/tests/auto/corelib/xml/qxmlstream/data/13.ref similarity index 100% rename from tests/auto/qxmlstream/data/13.ref rename to tests/auto/corelib/xml/qxmlstream/data/13.ref diff --git a/tests/auto/qxmlstream/data/13.xml b/tests/auto/corelib/xml/qxmlstream/data/13.xml similarity index 100% rename from tests/auto/qxmlstream/data/13.xml rename to tests/auto/corelib/xml/qxmlstream/data/13.xml diff --git a/tests/auto/qxmlstream/data/14.ref b/tests/auto/corelib/xml/qxmlstream/data/14.ref similarity index 100% rename from tests/auto/qxmlstream/data/14.ref rename to tests/auto/corelib/xml/qxmlstream/data/14.ref diff --git a/tests/auto/qxmlstream/data/14.xml b/tests/auto/corelib/xml/qxmlstream/data/14.xml similarity index 100% rename from tests/auto/qxmlstream/data/14.xml rename to tests/auto/corelib/xml/qxmlstream/data/14.xml diff --git a/tests/auto/qxmlstream/data/15.ref b/tests/auto/corelib/xml/qxmlstream/data/15.ref similarity index 100% rename from tests/auto/qxmlstream/data/15.ref rename to tests/auto/corelib/xml/qxmlstream/data/15.ref diff --git a/tests/auto/qxmlstream/data/15.xml b/tests/auto/corelib/xml/qxmlstream/data/15.xml similarity index 100% rename from tests/auto/qxmlstream/data/15.xml rename to tests/auto/corelib/xml/qxmlstream/data/15.xml diff --git a/tests/auto/qxmlstream/data/16.ref b/tests/auto/corelib/xml/qxmlstream/data/16.ref similarity index 100% rename from tests/auto/qxmlstream/data/16.ref rename to tests/auto/corelib/xml/qxmlstream/data/16.ref diff --git a/tests/auto/qxmlstream/data/16.xml b/tests/auto/corelib/xml/qxmlstream/data/16.xml similarity index 100% rename from tests/auto/qxmlstream/data/16.xml rename to tests/auto/corelib/xml/qxmlstream/data/16.xml diff --git a/tests/auto/qxmlstream/data/2.ref b/tests/auto/corelib/xml/qxmlstream/data/2.ref similarity index 100% rename from tests/auto/qxmlstream/data/2.ref rename to tests/auto/corelib/xml/qxmlstream/data/2.ref diff --git a/tests/auto/qxmlstream/data/2.xml b/tests/auto/corelib/xml/qxmlstream/data/2.xml similarity index 100% rename from tests/auto/qxmlstream/data/2.xml rename to tests/auto/corelib/xml/qxmlstream/data/2.xml diff --git a/tests/auto/qxmlstream/data/20.ref b/tests/auto/corelib/xml/qxmlstream/data/20.ref similarity index 100% rename from tests/auto/qxmlstream/data/20.ref rename to tests/auto/corelib/xml/qxmlstream/data/20.ref diff --git a/tests/auto/qxmlstream/data/20.xml b/tests/auto/corelib/xml/qxmlstream/data/20.xml similarity index 100% rename from tests/auto/qxmlstream/data/20.xml rename to tests/auto/corelib/xml/qxmlstream/data/20.xml diff --git a/tests/auto/qxmlstream/data/21.ref b/tests/auto/corelib/xml/qxmlstream/data/21.ref similarity index 100% rename from tests/auto/qxmlstream/data/21.ref rename to tests/auto/corelib/xml/qxmlstream/data/21.ref diff --git a/tests/auto/qxmlstream/data/21.xml b/tests/auto/corelib/xml/qxmlstream/data/21.xml similarity index 100% rename from tests/auto/qxmlstream/data/21.xml rename to tests/auto/corelib/xml/qxmlstream/data/21.xml diff --git a/tests/auto/qxmlstream/data/22.ref b/tests/auto/corelib/xml/qxmlstream/data/22.ref similarity index 100% rename from tests/auto/qxmlstream/data/22.ref rename to tests/auto/corelib/xml/qxmlstream/data/22.ref diff --git a/tests/auto/qxmlstream/data/22.xml b/tests/auto/corelib/xml/qxmlstream/data/22.xml similarity index 100% rename from tests/auto/qxmlstream/data/22.xml rename to tests/auto/corelib/xml/qxmlstream/data/22.xml diff --git a/tests/auto/qxmlstream/data/3.ref b/tests/auto/corelib/xml/qxmlstream/data/3.ref similarity index 100% rename from tests/auto/qxmlstream/data/3.ref rename to tests/auto/corelib/xml/qxmlstream/data/3.ref diff --git a/tests/auto/qxmlstream/data/3.xml b/tests/auto/corelib/xml/qxmlstream/data/3.xml similarity index 100% rename from tests/auto/qxmlstream/data/3.xml rename to tests/auto/corelib/xml/qxmlstream/data/3.xml diff --git a/tests/auto/qxmlstream/data/4.ref b/tests/auto/corelib/xml/qxmlstream/data/4.ref similarity index 100% rename from tests/auto/qxmlstream/data/4.ref rename to tests/auto/corelib/xml/qxmlstream/data/4.ref diff --git a/tests/auto/qxmlstream/data/4.xml b/tests/auto/corelib/xml/qxmlstream/data/4.xml similarity index 100% rename from tests/auto/qxmlstream/data/4.xml rename to tests/auto/corelib/xml/qxmlstream/data/4.xml diff --git a/tests/auto/qxmlstream/data/5.ref b/tests/auto/corelib/xml/qxmlstream/data/5.ref similarity index 100% rename from tests/auto/qxmlstream/data/5.ref rename to tests/auto/corelib/xml/qxmlstream/data/5.ref diff --git a/tests/auto/qxmlstream/data/5.xml b/tests/auto/corelib/xml/qxmlstream/data/5.xml similarity index 100% rename from tests/auto/qxmlstream/data/5.xml rename to tests/auto/corelib/xml/qxmlstream/data/5.xml diff --git a/tests/auto/qxmlstream/data/6.ref b/tests/auto/corelib/xml/qxmlstream/data/6.ref similarity index 100% rename from tests/auto/qxmlstream/data/6.ref rename to tests/auto/corelib/xml/qxmlstream/data/6.ref diff --git a/tests/auto/qxmlstream/data/6.xml b/tests/auto/corelib/xml/qxmlstream/data/6.xml similarity index 100% rename from tests/auto/qxmlstream/data/6.xml rename to tests/auto/corelib/xml/qxmlstream/data/6.xml diff --git a/tests/auto/qxmlstream/data/7.ref b/tests/auto/corelib/xml/qxmlstream/data/7.ref similarity index 100% rename from tests/auto/qxmlstream/data/7.ref rename to tests/auto/corelib/xml/qxmlstream/data/7.ref diff --git a/tests/auto/qxmlstream/data/7.xml b/tests/auto/corelib/xml/qxmlstream/data/7.xml similarity index 100% rename from tests/auto/qxmlstream/data/7.xml rename to tests/auto/corelib/xml/qxmlstream/data/7.xml diff --git a/tests/auto/qxmlstream/data/8.ref b/tests/auto/corelib/xml/qxmlstream/data/8.ref similarity index 100% rename from tests/auto/qxmlstream/data/8.ref rename to tests/auto/corelib/xml/qxmlstream/data/8.ref diff --git a/tests/auto/qxmlstream/data/8.xml b/tests/auto/corelib/xml/qxmlstream/data/8.xml similarity index 100% rename from tests/auto/qxmlstream/data/8.xml rename to tests/auto/corelib/xml/qxmlstream/data/8.xml diff --git a/tests/auto/qxmlstream/data/9.ref b/tests/auto/corelib/xml/qxmlstream/data/9.ref similarity index 100% rename from tests/auto/qxmlstream/data/9.ref rename to tests/auto/corelib/xml/qxmlstream/data/9.ref diff --git a/tests/auto/qxmlstream/data/9.xml b/tests/auto/corelib/xml/qxmlstream/data/9.xml similarity index 100% rename from tests/auto/qxmlstream/data/9.xml rename to tests/auto/corelib/xml/qxmlstream/data/9.xml diff --git a/tests/auto/qxmlstream/data/books.ref b/tests/auto/corelib/xml/qxmlstream/data/books.ref similarity index 100% rename from tests/auto/qxmlstream/data/books.ref rename to tests/auto/corelib/xml/qxmlstream/data/books.ref diff --git a/tests/auto/qxmlstream/data/books.xml b/tests/auto/corelib/xml/qxmlstream/data/books.xml similarity index 100% rename from tests/auto/qxmlstream/data/books.xml rename to tests/auto/corelib/xml/qxmlstream/data/books.xml diff --git a/tests/auto/qxmlstream/data/colonInPI.ref b/tests/auto/corelib/xml/qxmlstream/data/colonInPI.ref similarity index 100% rename from tests/auto/qxmlstream/data/colonInPI.ref rename to tests/auto/corelib/xml/qxmlstream/data/colonInPI.ref diff --git a/tests/auto/qxmlstream/data/colonInPI.xml b/tests/auto/corelib/xml/qxmlstream/data/colonInPI.xml similarity index 100% rename from tests/auto/qxmlstream/data/colonInPI.xml rename to tests/auto/corelib/xml/qxmlstream/data/colonInPI.xml diff --git a/tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.ref b/tests/auto/corelib/xml/qxmlstream/data/doctypeEmptyMarkupDecl.ref similarity index 100% rename from tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.ref rename to tests/auto/corelib/xml/qxmlstream/data/doctypeEmptyMarkupDecl.ref diff --git a/tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.xml b/tests/auto/corelib/xml/qxmlstream/data/doctypeEmptyMarkupDecl.xml similarity index 100% rename from tests/auto/qxmlstream/data/doctypeEmptyMarkupDecl.xml rename to tests/auto/corelib/xml/qxmlstream/data/doctypeEmptyMarkupDecl.xml diff --git a/tests/auto/qxmlstream/data/mixedContent.ref b/tests/auto/corelib/xml/qxmlstream/data/mixedContent.ref similarity index 100% rename from tests/auto/qxmlstream/data/mixedContent.ref rename to tests/auto/corelib/xml/qxmlstream/data/mixedContent.ref diff --git a/tests/auto/qxmlstream/data/mixedContent.xml b/tests/auto/corelib/xml/qxmlstream/data/mixedContent.xml similarity index 100% rename from tests/auto/qxmlstream/data/mixedContent.xml rename to tests/auto/corelib/xml/qxmlstream/data/mixedContent.xml diff --git a/tests/auto/qxmlstream/data/namespaceCDATA.ref b/tests/auto/corelib/xml/qxmlstream/data/namespaceCDATA.ref similarity index 100% rename from tests/auto/qxmlstream/data/namespaceCDATA.ref rename to tests/auto/corelib/xml/qxmlstream/data/namespaceCDATA.ref diff --git a/tests/auto/qxmlstream/data/namespaceCDATA.xml b/tests/auto/corelib/xml/qxmlstream/data/namespaceCDATA.xml similarity index 100% rename from tests/auto/qxmlstream/data/namespaceCDATA.xml rename to tests/auto/corelib/xml/qxmlstream/data/namespaceCDATA.xml diff --git a/tests/auto/qxmlstream/data/namespaces b/tests/auto/corelib/xml/qxmlstream/data/namespaces similarity index 100% rename from tests/auto/qxmlstream/data/namespaces rename to tests/auto/corelib/xml/qxmlstream/data/namespaces diff --git a/tests/auto/qxmlstream/data/org_module.ref b/tests/auto/corelib/xml/qxmlstream/data/org_module.ref similarity index 100% rename from tests/auto/qxmlstream/data/org_module.ref rename to tests/auto/corelib/xml/qxmlstream/data/org_module.ref diff --git a/tests/auto/qxmlstream/data/org_module.xml b/tests/auto/corelib/xml/qxmlstream/data/org_module.xml similarity index 100% rename from tests/auto/qxmlstream/data/org_module.xml rename to tests/auto/corelib/xml/qxmlstream/data/org_module.xml diff --git a/tests/auto/qxmlstream/data/spaceBracket.ref b/tests/auto/corelib/xml/qxmlstream/data/spaceBracket.ref similarity index 100% rename from tests/auto/qxmlstream/data/spaceBracket.ref rename to tests/auto/corelib/xml/qxmlstream/data/spaceBracket.ref diff --git a/tests/auto/qxmlstream/data/spaceBracket.xml b/tests/auto/corelib/xml/qxmlstream/data/spaceBracket.xml similarity index 100% rename from tests/auto/qxmlstream/data/spaceBracket.xml rename to tests/auto/corelib/xml/qxmlstream/data/spaceBracket.xml diff --git a/tests/auto/qxmlstream/qc14n.h b/tests/auto/corelib/xml/qxmlstream/qc14n.h similarity index 100% rename from tests/auto/qxmlstream/qc14n.h rename to tests/auto/corelib/xml/qxmlstream/qc14n.h diff --git a/tests/auto/qxmlstream/qxmlstream.pro b/tests/auto/corelib/xml/qxmlstream/qxmlstream.pro similarity index 100% rename from tests/auto/qxmlstream/qxmlstream.pro rename to tests/auto/corelib/xml/qxmlstream/qxmlstream.pro diff --git a/tests/auto/qxmlstream/setupSuite.sh b/tests/auto/corelib/xml/qxmlstream/setupSuite.sh similarity index 100% rename from tests/auto/qxmlstream/setupSuite.sh rename to tests/auto/corelib/xml/qxmlstream/setupSuite.sh diff --git a/tests/auto/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp similarity index 100% rename from tests/auto/qxmlstream/tst_qxmlstream.cpp rename to tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp diff --git a/tests/auto/corelib/xml/xml.pro b/tests/auto/corelib/xml/xml.pro new file mode 100644 index 00000000000..53836cb7f03 --- /dev/null +++ b/tests/auto/corelib/xml/xml.pro @@ -0,0 +1,3 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qxmlstream diff --git a/tests/auto/dbus.pro b/tests/auto/dbus/dbus.pro similarity index 100% rename from tests/auto/dbus.pro rename to tests/auto/dbus/dbus.pro diff --git a/tests/auto/qdbusabstractadaptor/.gitignore b/tests/auto/dbus/qdbusabstractadaptor/.gitignore similarity index 100% rename from tests/auto/qdbusabstractadaptor/.gitignore rename to tests/auto/dbus/qdbusabstractadaptor/.gitignore diff --git a/tests/auto/qdbusabstractadaptor/myobject.h b/tests/auto/dbus/qdbusabstractadaptor/myobject.h similarity index 100% rename from tests/auto/qdbusabstractadaptor/myobject.h rename to tests/auto/dbus/qdbusabstractadaptor/myobject.h diff --git a/tests/auto/qdbusabstractadaptor/qdbusabstractadaptor.pro b/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor.pro similarity index 100% rename from tests/auto/qdbusabstractadaptor/qdbusabstractadaptor.pro rename to tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor.pro diff --git a/tests/auto/qdbusabstractadaptor/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp similarity index 100% rename from tests/auto/qdbusabstractadaptor/qmyserver/qmyserver.cpp rename to tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.cpp diff --git a/tests/auto/qdbusabstractadaptor/qmyserver/qmyserver.pro b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.pro similarity index 100% rename from tests/auto/qdbusabstractadaptor/qmyserver/qmyserver.pro rename to tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.pro diff --git a/tests/auto/qdbusabstractadaptor/test/test.pro b/tests/auto/dbus/qdbusabstractadaptor/test/test.pro similarity index 100% rename from tests/auto/qdbusabstractadaptor/test/test.pro rename to tests/auto/dbus/qdbusabstractadaptor/test/test.pro diff --git a/tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp similarity index 100% rename from tests/auto/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp rename to tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp diff --git a/tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml b/tests/auto/dbus/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml similarity index 100% rename from tests/auto/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml rename to tests/auto/dbus/qdbusabstractinterface/com.trolltech.QtDBus.Pinger.xml diff --git a/tests/auto/qdbusabstractinterface/interface.cpp b/tests/auto/dbus/qdbusabstractinterface/interface.cpp similarity index 100% rename from tests/auto/qdbusabstractinterface/interface.cpp rename to tests/auto/dbus/qdbusabstractinterface/interface.cpp diff --git a/tests/auto/qdbusabstractinterface/interface.h b/tests/auto/dbus/qdbusabstractinterface/interface.h similarity index 100% rename from tests/auto/qdbusabstractinterface/interface.h rename to tests/auto/dbus/qdbusabstractinterface/interface.h diff --git a/tests/auto/qdbusabstractinterface/pinger.cpp b/tests/auto/dbus/qdbusabstractinterface/pinger.cpp similarity index 100% rename from tests/auto/qdbusabstractinterface/pinger.cpp rename to tests/auto/dbus/qdbusabstractinterface/pinger.cpp diff --git a/tests/auto/qdbusabstractinterface/pinger.h b/tests/auto/dbus/qdbusabstractinterface/pinger.h similarity index 100% rename from tests/auto/qdbusabstractinterface/pinger.h rename to tests/auto/dbus/qdbusabstractinterface/pinger.h diff --git a/tests/auto/qdbusabstractinterface/qdbusabstractinterface.pro b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface.pro similarity index 100% rename from tests/auto/qdbusabstractinterface/qdbusabstractinterface.pro rename to tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface.pro diff --git a/tests/auto/qdbusabstractinterface/qpinger/qpinger.cpp b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp similarity index 100% rename from tests/auto/qdbusabstractinterface/qpinger/qpinger.cpp rename to tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.cpp diff --git a/tests/auto/qdbusabstractinterface/qpinger/qpinger.pro b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro similarity index 100% rename from tests/auto/qdbusabstractinterface/qpinger/qpinger.pro rename to tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro diff --git a/tests/auto/qdbusabstractinterface/test/test.pro b/tests/auto/dbus/qdbusabstractinterface/test/test.pro similarity index 100% rename from tests/auto/qdbusabstractinterface/test/test.pro rename to tests/auto/dbus/qdbusabstractinterface/test/test.pro diff --git a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp similarity index 100% rename from tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp rename to tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp diff --git a/tests/auto/qdbusconnection/.gitignore b/tests/auto/dbus/qdbusconnection/.gitignore similarity index 100% rename from tests/auto/qdbusconnection/.gitignore rename to tests/auto/dbus/qdbusconnection/.gitignore diff --git a/tests/auto/qdbusconnection/qdbusconnection.pro b/tests/auto/dbus/qdbusconnection/qdbusconnection.pro similarity index 100% rename from tests/auto/qdbusconnection/qdbusconnection.pro rename to tests/auto/dbus/qdbusconnection/qdbusconnection.pro diff --git a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp similarity index 100% rename from tests/auto/qdbusconnection/tst_qdbusconnection.cpp rename to tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp diff --git a/tests/auto/qdbusconnection_no_bus/qdbusconnection_no_bus.pro b/tests/auto/dbus/qdbusconnection_no_bus/qdbusconnection_no_bus.pro similarity index 100% rename from tests/auto/qdbusconnection_no_bus/qdbusconnection_no_bus.pro rename to tests/auto/dbus/qdbusconnection_no_bus/qdbusconnection_no_bus.pro diff --git a/tests/auto/qdbusconnection_no_bus/tst_qdbusconnection_no_bus.cpp b/tests/auto/dbus/qdbusconnection_no_bus/tst_qdbusconnection_no_bus.cpp similarity index 100% rename from tests/auto/qdbusconnection_no_bus/tst_qdbusconnection_no_bus.cpp rename to tests/auto/dbus/qdbusconnection_no_bus/tst_qdbusconnection_no_bus.cpp diff --git a/tests/auto/qdbuscontext/.gitignore b/tests/auto/dbus/qdbuscontext/.gitignore similarity index 100% rename from tests/auto/qdbuscontext/.gitignore rename to tests/auto/dbus/qdbuscontext/.gitignore diff --git a/tests/auto/qdbuscontext/qdbuscontext.pro b/tests/auto/dbus/qdbuscontext/qdbuscontext.pro similarity index 100% rename from tests/auto/qdbuscontext/qdbuscontext.pro rename to tests/auto/dbus/qdbuscontext/qdbuscontext.pro diff --git a/tests/auto/qdbuscontext/tst_qdbuscontext.cpp b/tests/auto/dbus/qdbuscontext/tst_qdbuscontext.cpp similarity index 100% rename from tests/auto/qdbuscontext/tst_qdbuscontext.cpp rename to tests/auto/dbus/qdbuscontext/tst_qdbuscontext.cpp diff --git a/tests/auto/qdbusinterface/.gitignore b/tests/auto/dbus/qdbusinterface/.gitignore similarity index 100% rename from tests/auto/qdbusinterface/.gitignore rename to tests/auto/dbus/qdbusinterface/.gitignore diff --git a/tests/auto/qdbusinterface/myobject.h b/tests/auto/dbus/qdbusinterface/myobject.h similarity index 100% rename from tests/auto/qdbusinterface/myobject.h rename to tests/auto/dbus/qdbusinterface/myobject.h diff --git a/tests/auto/qdbusinterface/qdbusinterface.pro b/tests/auto/dbus/qdbusinterface/qdbusinterface.pro similarity index 100% rename from tests/auto/qdbusinterface/qdbusinterface.pro rename to tests/auto/dbus/qdbusinterface/qdbusinterface.pro diff --git a/tests/auto/qdbusinterface/qmyserver/qmyserver.cpp b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp similarity index 100% rename from tests/auto/qdbusinterface/qmyserver/qmyserver.cpp rename to tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.cpp diff --git a/tests/auto/qdbusinterface/qmyserver/qmyserver.pro b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.pro similarity index 100% rename from tests/auto/qdbusinterface/qmyserver/qmyserver.pro rename to tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.pro diff --git a/tests/auto/qdbusinterface/test/test.pro b/tests/auto/dbus/qdbusinterface/test/test.pro similarity index 100% rename from tests/auto/qdbusinterface/test/test.pro rename to tests/auto/dbus/qdbusinterface/test/test.pro diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp similarity index 100% rename from tests/auto/qdbusinterface/tst_qdbusinterface.cpp rename to tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp diff --git a/tests/auto/qdbuslocalcalls/.gitignore b/tests/auto/dbus/qdbuslocalcalls/.gitignore similarity index 100% rename from tests/auto/qdbuslocalcalls/.gitignore rename to tests/auto/dbus/qdbuslocalcalls/.gitignore diff --git a/tests/auto/qdbuslocalcalls/qdbuslocalcalls.pro b/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro similarity index 100% rename from tests/auto/qdbuslocalcalls/qdbuslocalcalls.pro rename to tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro diff --git a/tests/auto/qdbuslocalcalls/tst_qdbuslocalcalls.cpp b/tests/auto/dbus/qdbuslocalcalls/tst_qdbuslocalcalls.cpp similarity index 100% rename from tests/auto/qdbuslocalcalls/tst_qdbuslocalcalls.cpp rename to tests/auto/dbus/qdbuslocalcalls/tst_qdbuslocalcalls.cpp diff --git a/tests/auto/qdbusmarshall/.gitignore b/tests/auto/dbus/qdbusmarshall/.gitignore similarity index 100% rename from tests/auto/qdbusmarshall/.gitignore rename to tests/auto/dbus/qdbusmarshall/.gitignore diff --git a/tests/auto/qdbusmarshall/common.h b/tests/auto/dbus/qdbusmarshall/common.h similarity index 100% rename from tests/auto/qdbusmarshall/common.h rename to tests/auto/dbus/qdbusmarshall/common.h diff --git a/tests/auto/qdbusmarshall/dummy.cpp b/tests/auto/dbus/qdbusmarshall/dummy.cpp similarity index 100% rename from tests/auto/qdbusmarshall/dummy.cpp rename to tests/auto/dbus/qdbusmarshall/dummy.cpp diff --git a/tests/auto/qdbusmarshall/qdbusmarshall.pro b/tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro similarity index 100% rename from tests/auto/qdbusmarshall/qdbusmarshall.pro rename to tests/auto/dbus/qdbusmarshall/qdbusmarshall.pro diff --git a/tests/auto/qdbusmarshall/qpong/qpong.cpp b/tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp similarity index 100% rename from tests/auto/qdbusmarshall/qpong/qpong.cpp rename to tests/auto/dbus/qdbusmarshall/qpong/qpong.cpp diff --git a/tests/auto/qdbusmarshall/qpong/qpong.pro b/tests/auto/dbus/qdbusmarshall/qpong/qpong.pro similarity index 100% rename from tests/auto/qdbusmarshall/qpong/qpong.pro rename to tests/auto/dbus/qdbusmarshall/qpong/qpong.pro diff --git a/tests/auto/qdbusmarshall/test/test.pro b/tests/auto/dbus/qdbusmarshall/test/test.pro similarity index 100% rename from tests/auto/qdbusmarshall/test/test.pro rename to tests/auto/dbus/qdbusmarshall/test/test.pro diff --git a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp similarity index 100% rename from tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp rename to tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp diff --git a/tests/auto/qdbusmetaobject/.gitignore b/tests/auto/dbus/qdbusmetaobject/.gitignore similarity index 100% rename from tests/auto/qdbusmetaobject/.gitignore rename to tests/auto/dbus/qdbusmetaobject/.gitignore diff --git a/tests/auto/qdbusmetaobject/qdbusmetaobject.pro b/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro similarity index 100% rename from tests/auto/qdbusmetaobject/qdbusmetaobject.pro rename to tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro diff --git a/tests/auto/qdbusmetaobject/tst_qdbusmetaobject.cpp b/tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp similarity index 100% rename from tests/auto/qdbusmetaobject/tst_qdbusmetaobject.cpp rename to tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp diff --git a/tests/auto/qdbusmetatype/.gitignore b/tests/auto/dbus/qdbusmetatype/.gitignore similarity index 100% rename from tests/auto/qdbusmetatype/.gitignore rename to tests/auto/dbus/qdbusmetatype/.gitignore diff --git a/tests/auto/qdbusmetatype/qdbusmetatype.pro b/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro similarity index 100% rename from tests/auto/qdbusmetatype/qdbusmetatype.pro rename to tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro diff --git a/tests/auto/qdbusmetatype/tst_qdbusmetatype.cpp b/tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp similarity index 100% rename from tests/auto/qdbusmetatype/tst_qdbusmetatype.cpp rename to tests/auto/dbus/qdbusmetatype/tst_qdbusmetatype.cpp diff --git a/tests/auto/qdbuspendingcall/.gitignore b/tests/auto/dbus/qdbuspendingcall/.gitignore similarity index 100% rename from tests/auto/qdbuspendingcall/.gitignore rename to tests/auto/dbus/qdbuspendingcall/.gitignore diff --git a/tests/auto/qdbuspendingcall/qdbuspendingcall.pro b/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro similarity index 100% rename from tests/auto/qdbuspendingcall/qdbuspendingcall.pro rename to tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro diff --git a/tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp similarity index 100% rename from tests/auto/qdbuspendingcall/tst_qdbuspendingcall.cpp rename to tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp diff --git a/tests/auto/qdbuspendingreply/.gitignore b/tests/auto/dbus/qdbuspendingreply/.gitignore similarity index 100% rename from tests/auto/qdbuspendingreply/.gitignore rename to tests/auto/dbus/qdbuspendingreply/.gitignore diff --git a/tests/auto/qdbuspendingreply/qdbuspendingreply.pro b/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro similarity index 100% rename from tests/auto/qdbuspendingreply/qdbuspendingreply.pro rename to tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro diff --git a/tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp b/tests/auto/dbus/qdbuspendingreply/tst_qdbuspendingreply.cpp similarity index 100% rename from tests/auto/qdbuspendingreply/tst_qdbuspendingreply.cpp rename to tests/auto/dbus/qdbuspendingreply/tst_qdbuspendingreply.cpp diff --git a/tests/auto/qdbusreply/.gitignore b/tests/auto/dbus/qdbusreply/.gitignore similarity index 100% rename from tests/auto/qdbusreply/.gitignore rename to tests/auto/dbus/qdbusreply/.gitignore diff --git a/tests/auto/qdbusreply/qdbusreply.pro b/tests/auto/dbus/qdbusreply/qdbusreply.pro similarity index 100% rename from tests/auto/qdbusreply/qdbusreply.pro rename to tests/auto/dbus/qdbusreply/qdbusreply.pro diff --git a/tests/auto/qdbusreply/tst_qdbusreply.cpp b/tests/auto/dbus/qdbusreply/tst_qdbusreply.cpp similarity index 100% rename from tests/auto/qdbusreply/tst_qdbusreply.cpp rename to tests/auto/dbus/qdbusreply/tst_qdbusreply.cpp diff --git a/tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro b/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro similarity index 100% rename from tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro rename to tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro diff --git a/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp b/tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp similarity index 100% rename from tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp rename to tests/auto/dbus/qdbusservicewatcher/tst_qdbusservicewatcher.cpp diff --git a/tests/auto/qdbusthreading/.gitignore b/tests/auto/dbus/qdbusthreading/.gitignore similarity index 100% rename from tests/auto/qdbusthreading/.gitignore rename to tests/auto/dbus/qdbusthreading/.gitignore diff --git a/tests/auto/qdbusthreading/qdbusthreading.pro b/tests/auto/dbus/qdbusthreading/qdbusthreading.pro similarity index 100% rename from tests/auto/qdbusthreading/qdbusthreading.pro rename to tests/auto/dbus/qdbusthreading/qdbusthreading.pro diff --git a/tests/auto/qdbusthreading/tst_qdbusthreading.cpp b/tests/auto/dbus/qdbusthreading/tst_qdbusthreading.cpp similarity index 100% rename from tests/auto/qdbusthreading/tst_qdbusthreading.cpp rename to tests/auto/dbus/qdbusthreading/tst_qdbusthreading.cpp diff --git a/tests/auto/qdbustype/qdbustype.pro b/tests/auto/dbus/qdbustype/qdbustype.pro similarity index 100% rename from tests/auto/qdbustype/qdbustype.pro rename to tests/auto/dbus/qdbustype/qdbustype.pro diff --git a/tests/auto/qdbustype/tst_qdbustype.cpp b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp similarity index 100% rename from tests/auto/qdbustype/tst_qdbustype.cpp rename to tests/auto/dbus/qdbustype/tst_qdbustype.cpp diff --git a/tests/auto/qdbusxmlparser/.gitignore b/tests/auto/dbus/qdbusxmlparser/.gitignore similarity index 100% rename from tests/auto/qdbusxmlparser/.gitignore rename to tests/auto/dbus/qdbusxmlparser/.gitignore diff --git a/tests/auto/qdbusxmlparser/qdbusxmlparser.pro b/tests/auto/dbus/qdbusxmlparser/qdbusxmlparser.pro similarity index 100% rename from tests/auto/qdbusxmlparser/qdbusxmlparser.pro rename to tests/auto/dbus/qdbusxmlparser/qdbusxmlparser.pro diff --git a/tests/auto/qdbusxmlparser/tst_qdbusxmlparser.cpp b/tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp similarity index 100% rename from tests/auto/qdbusxmlparser/tst_qdbusxmlparser.cpp rename to tests/auto/dbus/qdbusxmlparser/tst_qdbusxmlparser.cpp diff --git a/tests/auto/exceptionsafety_objects/exceptionsafety_objects.pro b/tests/auto/exceptionsafety_objects/exceptionsafety_objects.pro index 3f773c76f8f..d09c349215d 100644 --- a/tests/auto/exceptionsafety_objects/exceptionsafety_objects.pro +++ b/tests/auto/exceptionsafety_objects/exceptionsafety_objects.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets HEADERS += oomsimulator.h 3rdparty/valgrind.h 3rdparty/memcheck.h SOURCES += tst_exceptionsafety_objects.cpp diff --git a/tests/auto/gestures/gestures.pro b/tests/auto/gestures/gestures.pro index da5610f2f60..43ae4a3fa1a 100644 --- a/tests/auto/gestures/gestures.pro +++ b/tests/auto/gestures/gestures.pro @@ -1,5 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_gestures.cpp - - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro index 765d522f1c5..aad48cddef6 100644 --- a/tests/auto/gui.pro +++ b/tests/auto/gui.pro @@ -5,28 +5,24 @@ # TEMPLATE=subdirs SUBDIRS=\ + gui \ gestures \ languagechange \ modeltest \ qabstractbutton \ - qabstractitemmodel \ qabstractitemview \ qabstractprintdialog \ qabstractproxymodel \ qabstractscrollarea \ qabstractslider \ qabstractspinbox \ - qabstracttextdocumentlayout \ qaction \ qactiongroup \ qapplication \ qboxlayout \ - qbrush \ qbuttongroup \ qcalendarwidget \ qcheckbox \ - qclipboard \ - qcolor \ qcolordialog \ qcolumnview \ qcommandlinkbutton \ @@ -34,7 +30,6 @@ SUBDIRS=\ qcomplextext \ qdatawidgetmapper \ qdatetimeedit \ - qdesktopservices \ qdesktopwidget \ qdial \ qdialog \ @@ -43,22 +38,15 @@ SUBDIRS=\ qdockwidget \ qdoublespinbox \ qdoublevalidator \ - qdrag \ qerrormessage \ - qfile \ qfiledialog \ qfiledialog2 \ qfileiconprovider \ - qfileopenevent \ qfilesystemmodel \ qfocusframe \ - qfont \ qfontcombobox \ - qfontdatabase \ qfontdialog \ - qfontmetrics \ qformlayout \ - qglyphrun \ qgraphicsanchorlayout \ qgraphicsanchorlayout1 \ qgraphicseffect \ @@ -80,14 +68,8 @@ SUBDIRS=\ qgraphicswidget \ qgridlayout \ qgroupbox \ - qguivariant \ qheaderview \ - qicoimageformat \ - qicon \ qidentityproxymodel \ - qimageiohandler \ - qimagereader \ - qimagewriter \ qinputcontext \ qinputdialog \ qintvalidator \ @@ -95,58 +77,28 @@ SUBDIRS=\ qitemeditorfactory \ qitemselectionmodel \ qitemview \ - qkeysequence \ qlabel \ qlcdnumber \ qlineedit \ - qlist \ qlistview \ qlistwidget \ - qlocale \ - #qlocalsocket \ # FIXME: uses qtscript (QTBUG-19242) qmacstyle \ qmainwindow \ - qmatrixnxn \ qmdisubwindow \ qmessagebox \ - qmetaobject \ - qmimedata \ - qmouseevent_modal \ - qmovie \ - qvolatileimage \ qnetworkaccessmanager_and_qprogressdialog \ - qpaintengine \ - qpainterpath \ - qpainterpathstroker \ - qpalette \ - qparallelanimationgroup \ - qpathclipper \ - qpauseanimation \ - qpen \ - qpicture \ - qpixmapcache \ - qpixmapfilter \ + qopengl \ qplaintextedit \ - qpointer \ - qpolygon \ - qprinterinfo \ - qprocess \ qprogressbar \ qprogressdialog \ - qpropertyanimation \ qpushbutton \ - qquaternion \ qradiobutton \ - qrawfont \ qregexpvalidator \ - qregion \ qscrollarea \ qscrollbar \ qscroller \ qsharedpointer_and_qwidget \ - qshortcut \ qsidebar \ - qsignalmapper \ qsizegrip \ qslider \ qsortfilterproxymodel \ @@ -156,52 +108,28 @@ SUBDIRS=\ qstackedwidget \ qstandarditem \ qstandarditemmodel \ - qstatemachine \ - qstatictext \ qstatusbar \ qstringlistmodel \ qstyle \ qstyleoption \ qstylesheetstyle \ - qsyntaxhighlighter \ qsystemtrayicon \ qtabbar \ qtableview \ qtablewidget \ - qtcpsocket \ - qtessellator \ - qtextblock \ - qtextcodec \ - qtextcursor \ - qtextdocumentfragment \ - qtextdocumentlayout \ - qtextformat \ - qtextlayout \ - qtextlist \ - qtextobject \ - qtextpiecetable \ - qtextscriptengine \ - qtextstream \ - qtexttable \ - qtipc \ qtoolbar \ qtoolbox \ qtooltip \ - qtouchevent \ - qtransform \ qtransformedscreen \ - qtranslator \ qtreeview \ qtreewidget \ qtreewidgetitemiterator \ qundogroup \ qundostack \ - qvectornd \ qwidget_window \ qwidgetaction \ qwindowsurface \ qwizard \ - qwmatrix \ qwsembedwidget \ qwsinputmethod \ qwswindowsystem \ @@ -222,12 +150,10 @@ win32:SUBDIRS -= qtextpiecetable qpixmapcache \ qsidebar \ qstylesheetstyle \ - qtcpsocket \ qtextlayout \ qtextpiecetable \ qtipc \ qtoolbar \ - qstatictext \ symbian:SUBDIRS -= \ qsystemtrayicon \ diff --git a/tests/auto/gui/gui.pro b/tests/auto/gui/gui.pro new file mode 100644 index 00000000000..d54198467db --- /dev/null +++ b/tests/auto/gui/gui.pro @@ -0,0 +1,9 @@ +TEMPLATE=subdirs +SUBDIRS=\ + image \ + kernel \ + math3d \ + painting \ + text \ + util \ + diff --git a/tests/auto/gui/image/image.pro b/tests/auto/gui/image/image.pro new file mode 100644 index 00000000000..fe089f5e750 --- /dev/null +++ b/tests/auto/gui/image/image.pro @@ -0,0 +1,18 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qimagereader \ + qicoimageformat \ + qpixmap \ + qpixmapcache \ + qimage \ + qpixmapfilter \ + qimageiohandler \ + qimagewriter \ + qmovie \ + qvolatileimage \ + qicon \ + qpicture \ + +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qpixmapcache \ + diff --git a/tests/auto/qicoimageformat/.gitignore b/tests/auto/gui/image/qicoimageformat/.gitignore similarity index 100% rename from tests/auto/qicoimageformat/.gitignore rename to tests/auto/gui/image/qicoimageformat/.gitignore diff --git a/tests/auto/qicoimageformat/icons/invalid/35floppy.ico b/tests/auto/gui/image/qicoimageformat/icons/invalid/35floppy.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/invalid/35floppy.ico rename to tests/auto/gui/image/qicoimageformat/icons/invalid/35floppy.ico diff --git a/tests/auto/qicoimageformat/icons/valid/35FLOPPY.ICO b/tests/auto/gui/image/qicoimageformat/icons/valid/35FLOPPY.ICO similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/35FLOPPY.ICO rename to tests/auto/gui/image/qicoimageformat/icons/valid/35FLOPPY.ICO diff --git a/tests/auto/qicoimageformat/icons/valid/AddPerfMon.ico b/tests/auto/gui/image/qicoimageformat/icons/valid/AddPerfMon.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/AddPerfMon.ico rename to tests/auto/gui/image/qicoimageformat/icons/valid/AddPerfMon.ico diff --git a/tests/auto/qicoimageformat/icons/valid/App.ico b/tests/auto/gui/image/qicoimageformat/icons/valid/App.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/App.ico rename to tests/auto/gui/image/qicoimageformat/icons/valid/App.ico diff --git a/tests/auto/qicoimageformat/icons/valid/Obj_N2_Internal_Mem.ico b/tests/auto/gui/image/qicoimageformat/icons/valid/Obj_N2_Internal_Mem.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/Obj_N2_Internal_Mem.ico rename to tests/auto/gui/image/qicoimageformat/icons/valid/Obj_N2_Internal_Mem.ico diff --git a/tests/auto/qicoimageformat/icons/valid/Qt.ico b/tests/auto/gui/image/qicoimageformat/icons/valid/Qt.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/Qt.ico rename to tests/auto/gui/image/qicoimageformat/icons/valid/Qt.ico diff --git a/tests/auto/qicoimageformat/icons/valid/Status_Play.ico b/tests/auto/gui/image/qicoimageformat/icons/valid/Status_Play.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/Status_Play.ico rename to tests/auto/gui/image/qicoimageformat/icons/valid/Status_Play.ico diff --git a/tests/auto/qicoimageformat/icons/valid/TIMER01.ICO b/tests/auto/gui/image/qicoimageformat/icons/valid/TIMER01.ICO similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/TIMER01.ICO rename to tests/auto/gui/image/qicoimageformat/icons/valid/TIMER01.ICO diff --git a/tests/auto/qicoimageformat/icons/valid/WORLD.ico b/tests/auto/gui/image/qicoimageformat/icons/valid/WORLD.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/WORLD.ico rename to tests/auto/gui/image/qicoimageformat/icons/valid/WORLD.ico diff --git a/tests/auto/qicoimageformat/icons/valid/WORLDH.ico b/tests/auto/gui/image/qicoimageformat/icons/valid/WORLDH.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/WORLDH.ico rename to tests/auto/gui/image/qicoimageformat/icons/valid/WORLDH.ico diff --git a/tests/auto/qicoimageformat/icons/valid/abcardWindow.ico b/tests/auto/gui/image/qicoimageformat/icons/valid/abcardWindow.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/abcardWindow.ico rename to tests/auto/gui/image/qicoimageformat/icons/valid/abcardWindow.ico diff --git a/tests/auto/qicoimageformat/icons/valid/semitransparent.ico b/tests/auto/gui/image/qicoimageformat/icons/valid/semitransparent.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/semitransparent.ico rename to tests/auto/gui/image/qicoimageformat/icons/valid/semitransparent.ico diff --git a/tests/auto/qicoimageformat/icons/valid/trolltechlogo_tiny.ico b/tests/auto/gui/image/qicoimageformat/icons/valid/trolltechlogo_tiny.ico similarity index 100% rename from tests/auto/qicoimageformat/icons/valid/trolltechlogo_tiny.ico rename to tests/auto/gui/image/qicoimageformat/icons/valid/trolltechlogo_tiny.ico diff --git a/tests/auto/qicoimageformat/qicoimageformat.pro b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro similarity index 100% rename from tests/auto/qicoimageformat/qicoimageformat.pro rename to tests/auto/gui/image/qicoimageformat/qicoimageformat.pro diff --git a/tests/auto/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp similarity index 100% rename from tests/auto/qicoimageformat/tst_qicoimageformat.cpp rename to tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp diff --git a/tests/auto/qicon/.gitignore b/tests/auto/gui/image/qicon/.gitignore similarity index 100% rename from tests/auto/qicon/.gitignore rename to tests/auto/gui/image/qicon/.gitignore diff --git a/tests/auto/qicon/heart.svg b/tests/auto/gui/image/qicon/heart.svg similarity index 100% rename from tests/auto/qicon/heart.svg rename to tests/auto/gui/image/qicon/heart.svg diff --git a/tests/auto/qicon/heart.svgz b/tests/auto/gui/image/qicon/heart.svgz similarity index 100% rename from tests/auto/qicon/heart.svgz rename to tests/auto/gui/image/qicon/heart.svgz diff --git a/tests/auto/qicon/icons/testtheme/16x16/actions/appointment-new.png b/tests/auto/gui/image/qicon/icons/testtheme/16x16/actions/appointment-new.png similarity index 100% rename from tests/auto/qicon/icons/testtheme/16x16/actions/appointment-new.png rename to tests/auto/gui/image/qicon/icons/testtheme/16x16/actions/appointment-new.png diff --git a/tests/auto/qicon/icons/testtheme/22x22/actions/appointment-new.png b/tests/auto/gui/image/qicon/icons/testtheme/22x22/actions/appointment-new.png similarity index 100% rename from tests/auto/qicon/icons/testtheme/22x22/actions/appointment-new.png rename to tests/auto/gui/image/qicon/icons/testtheme/22x22/actions/appointment-new.png diff --git a/tests/auto/qicon/icons/testtheme/32x32/actions/appointment-new.png b/tests/auto/gui/image/qicon/icons/testtheme/32x32/actions/appointment-new.png similarity index 100% rename from tests/auto/qicon/icons/testtheme/32x32/actions/appointment-new.png rename to tests/auto/gui/image/qicon/icons/testtheme/32x32/actions/appointment-new.png diff --git a/tests/auto/qicon/icons/testtheme/index.theme b/tests/auto/gui/image/qicon/icons/testtheme/index.theme similarity index 100% rename from tests/auto/qicon/icons/testtheme/index.theme rename to tests/auto/gui/image/qicon/icons/testtheme/index.theme diff --git a/tests/auto/qicon/icons/testtheme/scalable/actions/svg-only.svg b/tests/auto/gui/image/qicon/icons/testtheme/scalable/actions/svg-only.svg similarity index 100% rename from tests/auto/qicon/icons/testtheme/scalable/actions/svg-only.svg rename to tests/auto/gui/image/qicon/icons/testtheme/scalable/actions/svg-only.svg diff --git a/tests/auto/qicon/icons/themeparent/16x16/actions/address-book-new.png b/tests/auto/gui/image/qicon/icons/themeparent/16x16/actions/address-book-new.png similarity index 100% rename from tests/auto/qicon/icons/themeparent/16x16/actions/address-book-new.png rename to tests/auto/gui/image/qicon/icons/themeparent/16x16/actions/address-book-new.png diff --git a/tests/auto/qicon/icons/themeparent/16x16/actions/appointment-new.png b/tests/auto/gui/image/qicon/icons/themeparent/16x16/actions/appointment-new.png similarity index 100% rename from tests/auto/qicon/icons/themeparent/16x16/actions/appointment-new.png rename to tests/auto/gui/image/qicon/icons/themeparent/16x16/actions/appointment-new.png diff --git a/tests/auto/qicon/icons/themeparent/22x22/actions/address-book-new.png b/tests/auto/gui/image/qicon/icons/themeparent/22x22/actions/address-book-new.png similarity index 100% rename from tests/auto/qicon/icons/themeparent/22x22/actions/address-book-new.png rename to tests/auto/gui/image/qicon/icons/themeparent/22x22/actions/address-book-new.png diff --git a/tests/auto/qicon/icons/themeparent/22x22/actions/appointment-new.png b/tests/auto/gui/image/qicon/icons/themeparent/22x22/actions/appointment-new.png similarity index 100% rename from tests/auto/qicon/icons/themeparent/22x22/actions/appointment-new.png rename to tests/auto/gui/image/qicon/icons/themeparent/22x22/actions/appointment-new.png diff --git a/tests/auto/qicon/icons/themeparent/32x32/actions/address-book-new.png b/tests/auto/gui/image/qicon/icons/themeparent/32x32/actions/address-book-new.png similarity index 100% rename from tests/auto/qicon/icons/themeparent/32x32/actions/address-book-new.png rename to tests/auto/gui/image/qicon/icons/themeparent/32x32/actions/address-book-new.png diff --git a/tests/auto/qicon/icons/themeparent/32x32/actions/appointment-new.png b/tests/auto/gui/image/qicon/icons/themeparent/32x32/actions/appointment-new.png similarity index 100% rename from tests/auto/qicon/icons/themeparent/32x32/actions/appointment-new.png rename to tests/auto/gui/image/qicon/icons/themeparent/32x32/actions/appointment-new.png diff --git a/tests/auto/qicon/icons/themeparent/index.theme b/tests/auto/gui/image/qicon/icons/themeparent/index.theme similarity index 100% rename from tests/auto/qicon/icons/themeparent/index.theme rename to tests/auto/gui/image/qicon/icons/themeparent/index.theme diff --git a/tests/auto/qicon/icons/themeparent/scalable/actions/address-book-new.svg b/tests/auto/gui/image/qicon/icons/themeparent/scalable/actions/address-book-new.svg similarity index 100% rename from tests/auto/qicon/icons/themeparent/scalable/actions/address-book-new.svg rename to tests/auto/gui/image/qicon/icons/themeparent/scalable/actions/address-book-new.svg diff --git a/tests/auto/qicon/icons/themeparent/scalable/actions/appointment-new.svg b/tests/auto/gui/image/qicon/icons/themeparent/scalable/actions/appointment-new.svg similarity index 100% rename from tests/auto/qicon/icons/themeparent/scalable/actions/appointment-new.svg rename to tests/auto/gui/image/qicon/icons/themeparent/scalable/actions/appointment-new.svg diff --git a/tests/auto/qicon/image.png b/tests/auto/gui/image/qicon/image.png similarity index 100% rename from tests/auto/qicon/image.png rename to tests/auto/gui/image/qicon/image.png diff --git a/tests/auto/qicon/qicon.pro b/tests/auto/gui/image/qicon/qicon.pro similarity index 92% rename from tests/auto/qicon/qicon.pro rename to tests/auto/gui/image/qicon/qicon.pro index 77a9b910323..5ce4fd4c2f6 100644 --- a/tests/auto/qicon/qicon.pro +++ b/tests/auto/gui/image/qicon/qicon.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qicon.cpp RESOURCES = tst_qicon.qrc @@ -27,3 +28,5 @@ wince* { } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qicon/rect.png b/tests/auto/gui/image/qicon/rect.png similarity index 100% rename from tests/auto/qicon/rect.png rename to tests/auto/gui/image/qicon/rect.png diff --git a/tests/auto/qicon/rect.svg b/tests/auto/gui/image/qicon/rect.svg similarity index 100% rename from tests/auto/qicon/rect.svg rename to tests/auto/gui/image/qicon/rect.svg diff --git a/tests/auto/qicon/trash.svg b/tests/auto/gui/image/qicon/trash.svg similarity index 100% rename from tests/auto/qicon/trash.svg rename to tests/auto/gui/image/qicon/trash.svg diff --git a/tests/auto/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp similarity index 100% rename from tests/auto/qicon/tst_qicon.cpp rename to tests/auto/gui/image/qicon/tst_qicon.cpp diff --git a/tests/auto/qicon/tst_qicon.qrc b/tests/auto/gui/image/qicon/tst_qicon.qrc similarity index 100% rename from tests/auto/qicon/tst_qicon.qrc rename to tests/auto/gui/image/qicon/tst_qicon.qrc diff --git a/tests/auto/qimage/.gitignore b/tests/auto/gui/image/qimage/.gitignore similarity index 100% rename from tests/auto/qimage/.gitignore rename to tests/auto/gui/image/qimage/.gitignore diff --git a/tests/auto/qimage/images/image.bmp b/tests/auto/gui/image/qimage/images/image.bmp similarity index 100% rename from tests/auto/qimage/images/image.bmp rename to tests/auto/gui/image/qimage/images/image.bmp diff --git a/tests/auto/qimage/images/image.gif b/tests/auto/gui/image/qimage/images/image.gif similarity index 100% rename from tests/auto/qimage/images/image.gif rename to tests/auto/gui/image/qimage/images/image.gif diff --git a/tests/auto/qimage/images/image.ico b/tests/auto/gui/image/qimage/images/image.ico similarity index 100% rename from tests/auto/qimage/images/image.ico rename to tests/auto/gui/image/qimage/images/image.ico diff --git a/tests/auto/qimage/images/image.jpg b/tests/auto/gui/image/qimage/images/image.jpg similarity index 100% rename from tests/auto/qimage/images/image.jpg rename to tests/auto/gui/image/qimage/images/image.jpg diff --git a/tests/auto/qimage/images/image.pbm b/tests/auto/gui/image/qimage/images/image.pbm similarity index 100% rename from tests/auto/qimage/images/image.pbm rename to tests/auto/gui/image/qimage/images/image.pbm diff --git a/tests/auto/qimage/images/image.pgm b/tests/auto/gui/image/qimage/images/image.pgm similarity index 100% rename from tests/auto/qimage/images/image.pgm rename to tests/auto/gui/image/qimage/images/image.pgm diff --git a/tests/auto/qimage/images/image.png b/tests/auto/gui/image/qimage/images/image.png similarity index 100% rename from tests/auto/qimage/images/image.png rename to tests/auto/gui/image/qimage/images/image.png diff --git a/tests/auto/qimage/images/image.ppm b/tests/auto/gui/image/qimage/images/image.ppm similarity index 100% rename from tests/auto/qimage/images/image.ppm rename to tests/auto/gui/image/qimage/images/image.ppm diff --git a/tests/auto/qimage/images/image.tif b/tests/auto/gui/image/qimage/images/image.tif similarity index 100% rename from tests/auto/qimage/images/image.tif rename to tests/auto/gui/image/qimage/images/image.tif diff --git a/tests/auto/qimage/images/image.xbm b/tests/auto/gui/image/qimage/images/image.xbm similarity index 100% rename from tests/auto/qimage/images/image.xbm rename to tests/auto/gui/image/qimage/images/image.xbm diff --git a/tests/auto/qimage/images/image.xpm b/tests/auto/gui/image/qimage/images/image.xpm similarity index 100% rename from tests/auto/qimage/images/image.xpm rename to tests/auto/gui/image/qimage/images/image.xpm diff --git a/tests/auto/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro similarity index 100% rename from tests/auto/qimage/qimage.pro rename to tests/auto/gui/image/qimage/qimage.pro diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp similarity index 99% rename from tests/auto/qimage/tst_qimage.cpp rename to tests/auto/gui/image/qimage/tst_qimage.cpp index 4336feba7a5..dce2957ae40 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -1986,7 +1986,7 @@ void tst_QImage::rgbSwapped() QCOMPARE(image, imageSwappedTwice); - QCOMPARE(memcmp(image.constBits(), imageSwappedTwice.constBits(), image.numBytes()), 0); + QCOMPARE(memcmp(image.constBits(), imageSwappedTwice.constBits(), image.byteCount()), 0); } void tst_QImage::deepCopyWhenPaintingActive() diff --git a/tests/auto/qimageiohandler/.gitignore b/tests/auto/gui/image/qimageiohandler/.gitignore similarity index 100% rename from tests/auto/qimageiohandler/.gitignore rename to tests/auto/gui/image/qimageiohandler/.gitignore diff --git a/tests/auto/qimageiohandler/qimageiohandler.pro b/tests/auto/gui/image/qimageiohandler/qimageiohandler.pro similarity index 100% rename from tests/auto/qimageiohandler/qimageiohandler.pro rename to tests/auto/gui/image/qimageiohandler/qimageiohandler.pro diff --git a/tests/auto/qimageiohandler/tst_qimageiohandler.cpp b/tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp similarity index 100% rename from tests/auto/qimageiohandler/tst_qimageiohandler.cpp rename to tests/auto/gui/image/qimageiohandler/tst_qimageiohandler.cpp diff --git a/tests/auto/qimagereader/.gitignore b/tests/auto/gui/image/qimagereader/.gitignore similarity index 100% rename from tests/auto/qimagereader/.gitignore rename to tests/auto/gui/image/qimagereader/.gitignore diff --git a/tests/auto/qimagereader/baseline/35floppy.png b/tests/auto/gui/image/qimagereader/baseline/35floppy.png similarity index 100% rename from tests/auto/qimagereader/baseline/35floppy.png rename to tests/auto/gui/image/qimagereader/baseline/35floppy.png diff --git a/tests/auto/qimagereader/baseline/connect.png b/tests/auto/gui/image/qimagereader/baseline/connect.png similarity index 100% rename from tests/auto/qimagereader/baseline/connect.png rename to tests/auto/gui/image/qimagereader/baseline/connect.png diff --git a/tests/auto/qimagereader/baseline/kde_favicon.png b/tests/auto/gui/image/qimagereader/baseline/kde_favicon.png similarity index 100% rename from tests/auto/qimagereader/baseline/kde_favicon.png rename to tests/auto/gui/image/qimagereader/baseline/kde_favicon.png diff --git a/tests/auto/qimagereader/baseline/semitransparent.png b/tests/auto/gui/image/qimagereader/baseline/semitransparent.png similarity index 100% rename from tests/auto/qimagereader/baseline/semitransparent.png rename to tests/auto/gui/image/qimagereader/baseline/semitransparent.png diff --git a/tests/auto/qimagereader/images/16bpp.bmp b/tests/auto/gui/image/qimagereader/images/16bpp.bmp similarity index 100% rename from tests/auto/qimagereader/images/16bpp.bmp rename to tests/auto/gui/image/qimagereader/images/16bpp.bmp diff --git a/tests/auto/qimagereader/images/4bpp-rle.bmp b/tests/auto/gui/image/qimagereader/images/4bpp-rle.bmp similarity index 100% rename from tests/auto/qimagereader/images/4bpp-rle.bmp rename to tests/auto/gui/image/qimagereader/images/4bpp-rle.bmp diff --git a/tests/auto/qimagereader/images/YCbCr_cmyk.jpg b/tests/auto/gui/image/qimagereader/images/YCbCr_cmyk.jpg similarity index 100% rename from tests/auto/qimagereader/images/YCbCr_cmyk.jpg rename to tests/auto/gui/image/qimagereader/images/YCbCr_cmyk.jpg diff --git a/tests/auto/qimagereader/images/YCbCr_cmyk.png b/tests/auto/gui/image/qimagereader/images/YCbCr_cmyk.png similarity index 100% rename from tests/auto/qimagereader/images/YCbCr_cmyk.png rename to tests/auto/gui/image/qimagereader/images/YCbCr_cmyk.png diff --git a/tests/auto/qimagereader/images/YCbCr_rgb.jpg b/tests/auto/gui/image/qimagereader/images/YCbCr_rgb.jpg similarity index 100% rename from tests/auto/qimagereader/images/YCbCr_rgb.jpg rename to tests/auto/gui/image/qimagereader/images/YCbCr_rgb.jpg diff --git a/tests/auto/qimagereader/images/away.png b/tests/auto/gui/image/qimagereader/images/away.png similarity index 100% rename from tests/auto/qimagereader/images/away.png rename to tests/auto/gui/image/qimagereader/images/away.png diff --git a/tests/auto/qimagereader/images/ball.mng b/tests/auto/gui/image/qimagereader/images/ball.mng similarity index 100% rename from tests/auto/qimagereader/images/ball.mng rename to tests/auto/gui/image/qimagereader/images/ball.mng diff --git a/tests/auto/qimagereader/images/bat1.gif b/tests/auto/gui/image/qimagereader/images/bat1.gif similarity index 100% rename from tests/auto/qimagereader/images/bat1.gif rename to tests/auto/gui/image/qimagereader/images/bat1.gif diff --git a/tests/auto/qimagereader/images/bat2.gif b/tests/auto/gui/image/qimagereader/images/bat2.gif similarity index 100% rename from tests/auto/qimagereader/images/bat2.gif rename to tests/auto/gui/image/qimagereader/images/bat2.gif diff --git a/tests/auto/qimagereader/images/beavis.jpg b/tests/auto/gui/image/qimagereader/images/beavis.jpg similarity index 100% rename from tests/auto/qimagereader/images/beavis.jpg rename to tests/auto/gui/image/qimagereader/images/beavis.jpg diff --git a/tests/auto/qimagereader/images/black.png b/tests/auto/gui/image/qimagereader/images/black.png similarity index 100% rename from tests/auto/qimagereader/images/black.png rename to tests/auto/gui/image/qimagereader/images/black.png diff --git a/tests/auto/qimagereader/images/black.xpm b/tests/auto/gui/image/qimagereader/images/black.xpm similarity index 100% rename from tests/auto/qimagereader/images/black.xpm rename to tests/auto/gui/image/qimagereader/images/black.xpm diff --git a/tests/auto/qimagereader/images/colorful.bmp b/tests/auto/gui/image/qimagereader/images/colorful.bmp similarity index 100% rename from tests/auto/qimagereader/images/colorful.bmp rename to tests/auto/gui/image/qimagereader/images/colorful.bmp diff --git a/tests/auto/qimagereader/images/corrupt-colors.xpm b/tests/auto/gui/image/qimagereader/images/corrupt-colors.xpm similarity index 100% rename from tests/auto/qimagereader/images/corrupt-colors.xpm rename to tests/auto/gui/image/qimagereader/images/corrupt-colors.xpm diff --git a/tests/auto/qimagereader/images/corrupt-data.tif b/tests/auto/gui/image/qimagereader/images/corrupt-data.tif similarity index 100% rename from tests/auto/qimagereader/images/corrupt-data.tif rename to tests/auto/gui/image/qimagereader/images/corrupt-data.tif diff --git a/tests/auto/qimagereader/images/corrupt-pixel-count.xpm b/tests/auto/gui/image/qimagereader/images/corrupt-pixel-count.xpm similarity index 100% rename from tests/auto/qimagereader/images/corrupt-pixel-count.xpm rename to tests/auto/gui/image/qimagereader/images/corrupt-pixel-count.xpm diff --git a/tests/auto/qimagereader/images/corrupt-pixels.xpm b/tests/auto/gui/image/qimagereader/images/corrupt-pixels.xpm similarity index 100% rename from tests/auto/qimagereader/images/corrupt-pixels.xpm rename to tests/auto/gui/image/qimagereader/images/corrupt-pixels.xpm diff --git a/tests/auto/qimagereader/images/corrupt.bmp b/tests/auto/gui/image/qimagereader/images/corrupt.bmp similarity index 100% rename from tests/auto/qimagereader/images/corrupt.bmp rename to tests/auto/gui/image/qimagereader/images/corrupt.bmp diff --git a/tests/auto/qimagereader/images/corrupt.gif b/tests/auto/gui/image/qimagereader/images/corrupt.gif similarity index 100% rename from tests/auto/qimagereader/images/corrupt.gif rename to tests/auto/gui/image/qimagereader/images/corrupt.gif diff --git a/tests/auto/qimagereader/images/corrupt.jpg b/tests/auto/gui/image/qimagereader/images/corrupt.jpg similarity index 100% rename from tests/auto/qimagereader/images/corrupt.jpg rename to tests/auto/gui/image/qimagereader/images/corrupt.jpg diff --git a/tests/auto/qimagereader/images/corrupt.mng b/tests/auto/gui/image/qimagereader/images/corrupt.mng similarity index 100% rename from tests/auto/qimagereader/images/corrupt.mng rename to tests/auto/gui/image/qimagereader/images/corrupt.mng diff --git a/tests/auto/qimagereader/images/corrupt.png b/tests/auto/gui/image/qimagereader/images/corrupt.png similarity index 100% rename from tests/auto/qimagereader/images/corrupt.png rename to tests/auto/gui/image/qimagereader/images/corrupt.png diff --git a/tests/auto/qimagereader/images/corrupt.svg b/tests/auto/gui/image/qimagereader/images/corrupt.svg similarity index 100% rename from tests/auto/qimagereader/images/corrupt.svg rename to tests/auto/gui/image/qimagereader/images/corrupt.svg diff --git a/tests/auto/qimagereader/images/corrupt.svgz b/tests/auto/gui/image/qimagereader/images/corrupt.svgz similarity index 100% rename from tests/auto/qimagereader/images/corrupt.svgz rename to tests/auto/gui/image/qimagereader/images/corrupt.svgz diff --git a/tests/auto/qimagereader/images/corrupt.xbm b/tests/auto/gui/image/qimagereader/images/corrupt.xbm similarity index 100% rename from tests/auto/qimagereader/images/corrupt.xbm rename to tests/auto/gui/image/qimagereader/images/corrupt.xbm diff --git a/tests/auto/qimagereader/images/crash-signed-char.bmp b/tests/auto/gui/image/qimagereader/images/crash-signed-char.bmp similarity index 100% rename from tests/auto/qimagereader/images/crash-signed-char.bmp rename to tests/auto/gui/image/qimagereader/images/crash-signed-char.bmp diff --git a/tests/auto/qimagereader/images/earth.gif b/tests/auto/gui/image/qimagereader/images/earth.gif similarity index 100% rename from tests/auto/qimagereader/images/earth.gif rename to tests/auto/gui/image/qimagereader/images/earth.gif diff --git a/tests/auto/qimagereader/images/endless-anim.gif b/tests/auto/gui/image/qimagereader/images/endless-anim.gif similarity index 100% rename from tests/auto/qimagereader/images/endless-anim.gif rename to tests/auto/gui/image/qimagereader/images/endless-anim.gif diff --git a/tests/auto/qimagereader/images/fire.mng b/tests/auto/gui/image/qimagereader/images/fire.mng similarity index 100% rename from tests/auto/qimagereader/images/fire.mng rename to tests/auto/gui/image/qimagereader/images/fire.mng diff --git a/tests/auto/qimagereader/images/font.bmp b/tests/auto/gui/image/qimagereader/images/font.bmp similarity index 100% rename from tests/auto/qimagereader/images/font.bmp rename to tests/auto/gui/image/qimagereader/images/font.bmp diff --git a/tests/auto/qimagereader/images/four-frames.gif b/tests/auto/gui/image/qimagereader/images/four-frames.gif similarity index 100% rename from tests/auto/qimagereader/images/four-frames.gif rename to tests/auto/gui/image/qimagereader/images/four-frames.gif diff --git a/tests/auto/qimagereader/images/gnus.xbm b/tests/auto/gui/image/qimagereader/images/gnus.xbm similarity index 100% rename from tests/auto/qimagereader/images/gnus.xbm rename to tests/auto/gui/image/qimagereader/images/gnus.xbm diff --git a/tests/auto/qimagereader/images/grayscale-ref.tif b/tests/auto/gui/image/qimagereader/images/grayscale-ref.tif similarity index 100% rename from tests/auto/qimagereader/images/grayscale-ref.tif rename to tests/auto/gui/image/qimagereader/images/grayscale-ref.tif diff --git a/tests/auto/qimagereader/images/grayscale.tif b/tests/auto/gui/image/qimagereader/images/grayscale.tif similarity index 100% rename from tests/auto/qimagereader/images/grayscale.tif rename to tests/auto/gui/image/qimagereader/images/grayscale.tif diff --git a/tests/auto/qimagereader/images/image.pbm b/tests/auto/gui/image/qimagereader/images/image.pbm similarity index 100% rename from tests/auto/qimagereader/images/image.pbm rename to tests/auto/gui/image/qimagereader/images/image.pbm diff --git a/tests/auto/qimagereader/images/image.pgm b/tests/auto/gui/image/qimagereader/images/image.pgm similarity index 100% rename from tests/auto/qimagereader/images/image.pgm rename to tests/auto/gui/image/qimagereader/images/image.pgm diff --git a/tests/auto/qimagereader/images/image.png b/tests/auto/gui/image/qimagereader/images/image.png similarity index 100% rename from tests/auto/qimagereader/images/image.png rename to tests/auto/gui/image/qimagereader/images/image.png diff --git a/tests/auto/qimagereader/images/image.ppm b/tests/auto/gui/image/qimagereader/images/image.ppm similarity index 100% rename from tests/auto/qimagereader/images/image.ppm rename to tests/auto/gui/image/qimagereader/images/image.ppm diff --git a/tests/auto/qimagereader/images/image_100dpi.tif b/tests/auto/gui/image/qimagereader/images/image_100dpi.tif similarity index 100% rename from tests/auto/qimagereader/images/image_100dpi.tif rename to tests/auto/gui/image/qimagereader/images/image_100dpi.tif diff --git a/tests/auto/qimagereader/images/kollada-noext b/tests/auto/gui/image/qimagereader/images/kollada-noext similarity index 100% rename from tests/auto/qimagereader/images/kollada-noext rename to tests/auto/gui/image/qimagereader/images/kollada-noext diff --git a/tests/auto/qimagereader/images/kollada.png b/tests/auto/gui/image/qimagereader/images/kollada.png similarity index 100% rename from tests/auto/qimagereader/images/kollada.png rename to tests/auto/gui/image/qimagereader/images/kollada.png diff --git a/tests/auto/qimagereader/images/marble.xpm b/tests/auto/gui/image/qimagereader/images/marble.xpm similarity index 100% rename from tests/auto/qimagereader/images/marble.xpm rename to tests/auto/gui/image/qimagereader/images/marble.xpm diff --git a/tests/auto/qimagereader/images/namedcolors.xpm b/tests/auto/gui/image/qimagereader/images/namedcolors.xpm similarity index 100% rename from tests/auto/qimagereader/images/namedcolors.xpm rename to tests/auto/gui/image/qimagereader/images/namedcolors.xpm diff --git a/tests/auto/qimagereader/images/negativeheight.bmp b/tests/auto/gui/image/qimagereader/images/negativeheight.bmp similarity index 100% rename from tests/auto/qimagereader/images/negativeheight.bmp rename to tests/auto/gui/image/qimagereader/images/negativeheight.bmp diff --git a/tests/auto/qimagereader/images/noclearcode.bmp b/tests/auto/gui/image/qimagereader/images/noclearcode.bmp similarity index 100% rename from tests/auto/qimagereader/images/noclearcode.bmp rename to tests/auto/gui/image/qimagereader/images/noclearcode.bmp diff --git a/tests/auto/qimagereader/images/noclearcode.gif b/tests/auto/gui/image/qimagereader/images/noclearcode.gif similarity index 100% rename from tests/auto/qimagereader/images/noclearcode.gif rename to tests/auto/gui/image/qimagereader/images/noclearcode.gif diff --git a/tests/auto/qimagereader/images/nontransparent.xpm b/tests/auto/gui/image/qimagereader/images/nontransparent.xpm similarity index 100% rename from tests/auto/qimagereader/images/nontransparent.xpm rename to tests/auto/gui/image/qimagereader/images/nontransparent.xpm diff --git a/tests/auto/qimagereader/images/qt-gif-anim.gif b/tests/auto/gui/image/qimagereader/images/qt-gif-anim.gif similarity index 100% rename from tests/auto/qimagereader/images/qt-gif-anim.gif rename to tests/auto/gui/image/qimagereader/images/qt-gif-anim.gif diff --git a/tests/auto/qimagereader/images/qt-gif-noanim.gif b/tests/auto/gui/image/qimagereader/images/qt-gif-noanim.gif similarity index 100% rename from tests/auto/qimagereader/images/qt-gif-noanim.gif rename to tests/auto/gui/image/qimagereader/images/qt-gif-noanim.gif diff --git a/tests/auto/qimagereader/images/qt.gif b/tests/auto/gui/image/qimagereader/images/qt.gif similarity index 100% rename from tests/auto/qimagereader/images/qt.gif rename to tests/auto/gui/image/qimagereader/images/qt.gif diff --git a/tests/auto/qimagereader/images/qt1.gif b/tests/auto/gui/image/qimagereader/images/qt1.gif similarity index 100% rename from tests/auto/qimagereader/images/qt1.gif rename to tests/auto/gui/image/qimagereader/images/qt1.gif diff --git a/tests/auto/qimagereader/images/qt2.gif b/tests/auto/gui/image/qimagereader/images/qt2.gif similarity index 100% rename from tests/auto/qimagereader/images/qt2.gif rename to tests/auto/gui/image/qimagereader/images/qt2.gif diff --git a/tests/auto/qimagereader/images/qt3.gif b/tests/auto/gui/image/qimagereader/images/qt3.gif similarity index 100% rename from tests/auto/qimagereader/images/qt3.gif rename to tests/auto/gui/image/qimagereader/images/qt3.gif diff --git a/tests/auto/qimagereader/images/qt4.gif b/tests/auto/gui/image/qimagereader/images/qt4.gif similarity index 100% rename from tests/auto/qimagereader/images/qt4.gif rename to tests/auto/gui/image/qimagereader/images/qt4.gif diff --git a/tests/auto/qimagereader/images/qt5.gif b/tests/auto/gui/image/qimagereader/images/qt5.gif similarity index 100% rename from tests/auto/qimagereader/images/qt5.gif rename to tests/auto/gui/image/qimagereader/images/qt5.gif diff --git a/tests/auto/qimagereader/images/qt6.gif b/tests/auto/gui/image/qimagereader/images/qt6.gif similarity index 100% rename from tests/auto/qimagereader/images/qt6.gif rename to tests/auto/gui/image/qimagereader/images/qt6.gif diff --git a/tests/auto/qimagereader/images/qt7.gif b/tests/auto/gui/image/qimagereader/images/qt7.gif similarity index 100% rename from tests/auto/qimagereader/images/qt7.gif rename to tests/auto/gui/image/qimagereader/images/qt7.gif diff --git a/tests/auto/qimagereader/images/qt8.gif b/tests/auto/gui/image/qimagereader/images/qt8.gif similarity index 100% rename from tests/auto/qimagereader/images/qt8.gif rename to tests/auto/gui/image/qimagereader/images/qt8.gif diff --git a/tests/auto/qimagereader/images/qtbug13653-no_eoi.jpg b/tests/auto/gui/image/qimagereader/images/qtbug13653-no_eoi.jpg similarity index 100% rename from tests/auto/qimagereader/images/qtbug13653-no_eoi.jpg rename to tests/auto/gui/image/qimagereader/images/qtbug13653-no_eoi.jpg diff --git a/tests/auto/qimagereader/images/rect.svg b/tests/auto/gui/image/qimagereader/images/rect.svg similarity index 100% rename from tests/auto/qimagereader/images/rect.svg rename to tests/auto/gui/image/qimagereader/images/rect.svg diff --git a/tests/auto/qimagereader/images/rect.svgz b/tests/auto/gui/image/qimagereader/images/rect.svgz similarity index 100% rename from tests/auto/qimagereader/images/rect.svgz rename to tests/auto/gui/image/qimagereader/images/rect.svgz diff --git a/tests/auto/qimagereader/images/rgba_adobedeflate_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif similarity index 100% rename from tests/auto/qimagereader/images/rgba_adobedeflate_littleendian.tif rename to tests/auto/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif diff --git a/tests/auto/qimagereader/images/rgba_lzw_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_lzw_littleendian.tif similarity index 100% rename from tests/auto/qimagereader/images/rgba_lzw_littleendian.tif rename to tests/auto/gui/image/qimagereader/images/rgba_lzw_littleendian.tif diff --git a/tests/auto/qimagereader/images/rgba_nocompression_bigendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif similarity index 100% rename from tests/auto/qimagereader/images/rgba_nocompression_bigendian.tif rename to tests/auto/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif diff --git a/tests/auto/qimagereader/images/rgba_nocompression_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif similarity index 100% rename from tests/auto/qimagereader/images/rgba_nocompression_littleendian.tif rename to tests/auto/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif diff --git a/tests/auto/qimagereader/images/rgba_packbits_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_packbits_littleendian.tif similarity index 100% rename from tests/auto/qimagereader/images/rgba_packbits_littleendian.tif rename to tests/auto/gui/image/qimagereader/images/rgba_packbits_littleendian.tif diff --git a/tests/auto/qimagereader/images/rgba_zipdeflate_littleendian.tif b/tests/auto/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif similarity index 100% rename from tests/auto/qimagereader/images/rgba_zipdeflate_littleendian.tif rename to tests/auto/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif diff --git a/tests/auto/qimagereader/images/runners.ppm b/tests/auto/gui/image/qimagereader/images/runners.ppm similarity index 100% rename from tests/auto/qimagereader/images/runners.ppm rename to tests/auto/gui/image/qimagereader/images/runners.ppm diff --git a/tests/auto/qimagereader/images/teapot.ppm b/tests/auto/gui/image/qimagereader/images/teapot.ppm similarity index 100% rename from tests/auto/qimagereader/images/teapot.ppm rename to tests/auto/gui/image/qimagereader/images/teapot.ppm diff --git a/tests/auto/qimagereader/images/test.ppm b/tests/auto/gui/image/qimagereader/images/test.ppm similarity index 100% rename from tests/auto/qimagereader/images/test.ppm rename to tests/auto/gui/image/qimagereader/images/test.ppm diff --git a/tests/auto/qimagereader/images/test.xpm b/tests/auto/gui/image/qimagereader/images/test.xpm similarity index 100% rename from tests/auto/qimagereader/images/test.xpm rename to tests/auto/gui/image/qimagereader/images/test.xpm diff --git a/tests/auto/qimagereader/images/test32bfv4.bmp b/tests/auto/gui/image/qimagereader/images/test32bfv4.bmp similarity index 100% rename from tests/auto/qimagereader/images/test32bfv4.bmp rename to tests/auto/gui/image/qimagereader/images/test32bfv4.bmp diff --git a/tests/auto/qimagereader/images/test32v5.bmp b/tests/auto/gui/image/qimagereader/images/test32v5.bmp similarity index 100% rename from tests/auto/qimagereader/images/test32v5.bmp rename to tests/auto/gui/image/qimagereader/images/test32v5.bmp diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_1.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_2.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_3.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_4.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_5.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_6.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_7.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/indexed_orientation_8.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_1.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_1.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/mono_orientation_1.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_1.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_2.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_2.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/mono_orientation_2.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_2.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_3.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_3.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/mono_orientation_3.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_3.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_4.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_4.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/mono_orientation_4.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_4.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_5.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_5.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/mono_orientation_5.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_5.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_6.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_6.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/mono_orientation_6.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_6.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_7.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_7.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/mono_orientation_7.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_7.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/mono_orientation_8.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_8.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/mono_orientation_8.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/mono_orientation_8.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/original_indexed.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_indexed.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/original_indexed.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/original_indexed.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/original_mono.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_mono.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/original_mono.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/original_mono.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/original_rgb.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/original_rgb.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/original_rgb.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/original_rgb.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_1.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_2.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_3.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_4.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_5.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_6.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_7.tiff diff --git a/tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff b/tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff similarity index 100% rename from tests/auto/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff rename to tests/auto/gui/image/qimagereader/images/tiff_oriented/rgb_orientation_8.tiff diff --git a/tests/auto/qimagereader/images/transparent.xpm b/tests/auto/gui/image/qimagereader/images/transparent.xpm similarity index 100% rename from tests/auto/qimagereader/images/transparent.xpm rename to tests/auto/gui/image/qimagereader/images/transparent.xpm diff --git a/tests/auto/qimagereader/images/trolltech.gif b/tests/auto/gui/image/qimagereader/images/trolltech.gif similarity index 100% rename from tests/auto/qimagereader/images/trolltech.gif rename to tests/auto/gui/image/qimagereader/images/trolltech.gif diff --git a/tests/auto/qimagereader/images/tst7.bmp b/tests/auto/gui/image/qimagereader/images/tst7.bmp similarity index 100% rename from tests/auto/qimagereader/images/tst7.bmp rename to tests/auto/gui/image/qimagereader/images/tst7.bmp diff --git a/tests/auto/qimagereader/images/tst7.png b/tests/auto/gui/image/qimagereader/images/tst7.png similarity index 100% rename from tests/auto/qimagereader/images/tst7.png rename to tests/auto/gui/image/qimagereader/images/tst7.png diff --git a/tests/auto/qimagereader/images/txts.png b/tests/auto/gui/image/qimagereader/images/txts.png similarity index 100% rename from tests/auto/qimagereader/images/txts.png rename to tests/auto/gui/image/qimagereader/images/txts.png diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro similarity index 92% rename from tests/auto/qimagereader/qimagereader.pro rename to tests/auto/gui/image/qimagereader/qimagereader.pro index 5c939b3a3c9..43d587ea487 100644 --- a/tests/auto/qimagereader/qimagereader.pro +++ b/tests/auto/gui/image/qimagereader/qimagereader.pro @@ -1,7 +1,7 @@ load(qttest_p4) SOURCES += tst_qimagereader.cpp MOC_DIR=tmp -QT += core-private gui-private network +QT += widgets widgets-private core-private gui-private network RESOURCES += qimagereader.qrc !symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/gui/image/qimagereader/qimagereader.qrc similarity index 100% rename from tests/auto/qimagereader/qimagereader.qrc rename to tests/auto/gui/image/qimagereader/qimagereader.qrc diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp similarity index 99% rename from tests/auto/qimagereader/tst_qimagereader.cpp rename to tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 63594685972..ffedc69a7f7 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -55,7 +55,7 @@ #include <QTcpServer> #include <QTimer> -#include "../platformquirks.h" +#include "../../../platformquirks.h" #if defined(Q_OS_SYMBIAN) # define SRCDIR "." diff --git a/tests/auto/qimagewriter/.gitignore b/tests/auto/gui/image/qimagewriter/.gitignore similarity index 100% rename from tests/auto/qimagewriter/.gitignore rename to tests/auto/gui/image/qimagewriter/.gitignore diff --git a/tests/auto/qimagewriter/images/YCbCr_cmyk.jpg b/tests/auto/gui/image/qimagewriter/images/YCbCr_cmyk.jpg similarity index 100% rename from tests/auto/qimagewriter/images/YCbCr_cmyk.jpg rename to tests/auto/gui/image/qimagewriter/images/YCbCr_cmyk.jpg diff --git a/tests/auto/qimagewriter/images/YCbCr_rgb.jpg b/tests/auto/gui/image/qimagewriter/images/YCbCr_rgb.jpg similarity index 100% rename from tests/auto/qimagewriter/images/YCbCr_rgb.jpg rename to tests/auto/gui/image/qimagewriter/images/YCbCr_rgb.jpg diff --git a/tests/auto/qimagewriter/images/beavis.jpg b/tests/auto/gui/image/qimagewriter/images/beavis.jpg similarity index 100% rename from tests/auto/qimagewriter/images/beavis.jpg rename to tests/auto/gui/image/qimagewriter/images/beavis.jpg diff --git a/tests/auto/qimagewriter/images/colorful.bmp b/tests/auto/gui/image/qimagewriter/images/colorful.bmp similarity index 100% rename from tests/auto/qimagewriter/images/colorful.bmp rename to tests/auto/gui/image/qimagewriter/images/colorful.bmp diff --git a/tests/auto/qimagewriter/images/earth.gif b/tests/auto/gui/image/qimagewriter/images/earth.gif similarity index 100% rename from tests/auto/qimagewriter/images/earth.gif rename to tests/auto/gui/image/qimagewriter/images/earth.gif diff --git a/tests/auto/qimagewriter/images/font.bmp b/tests/auto/gui/image/qimagewriter/images/font.bmp similarity index 100% rename from tests/auto/qimagewriter/images/font.bmp rename to tests/auto/gui/image/qimagewriter/images/font.bmp diff --git a/tests/auto/qimagewriter/images/gnus.xbm b/tests/auto/gui/image/qimagewriter/images/gnus.xbm similarity index 100% rename from tests/auto/qimagewriter/images/gnus.xbm rename to tests/auto/gui/image/qimagewriter/images/gnus.xbm diff --git a/tests/auto/qimagewriter/images/kollada.png b/tests/auto/gui/image/qimagewriter/images/kollada.png similarity index 100% rename from tests/auto/qimagewriter/images/kollada.png rename to tests/auto/gui/image/qimagewriter/images/kollada.png diff --git a/tests/auto/qimagewriter/images/marble.xpm b/tests/auto/gui/image/qimagewriter/images/marble.xpm similarity index 100% rename from tests/auto/qimagewriter/images/marble.xpm rename to tests/auto/gui/image/qimagewriter/images/marble.xpm diff --git a/tests/auto/qimagewriter/images/ship63.pbm b/tests/auto/gui/image/qimagewriter/images/ship63.pbm similarity index 100% rename from tests/auto/qimagewriter/images/ship63.pbm rename to tests/auto/gui/image/qimagewriter/images/ship63.pbm diff --git a/tests/auto/qimagewriter/images/teapot.ppm b/tests/auto/gui/image/qimagewriter/images/teapot.ppm similarity index 100% rename from tests/auto/qimagewriter/images/teapot.ppm rename to tests/auto/gui/image/qimagewriter/images/teapot.ppm diff --git a/tests/auto/qimagewriter/images/teapot.tiff b/tests/auto/gui/image/qimagewriter/images/teapot.tiff similarity index 100% rename from tests/auto/qimagewriter/images/teapot.tiff rename to tests/auto/gui/image/qimagewriter/images/teapot.tiff diff --git a/tests/auto/qimagewriter/images/trolltech.gif b/tests/auto/gui/image/qimagewriter/images/trolltech.gif similarity index 100% rename from tests/auto/qimagewriter/images/trolltech.gif rename to tests/auto/gui/image/qimagewriter/images/trolltech.gif diff --git a/tests/auto/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro similarity index 97% rename from tests/auto/qimagewriter/qimagewriter.pro rename to tests/auto/gui/image/qimagewriter/qimagewriter.pro index bab241977bf..0fc40d0f0a9 100644 --- a/tests/auto/qimagewriter/qimagewriter.pro +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qimagewriter.cpp MOC_DIR=tmp !contains(QT_CONFIG, no-tiff):DEFINES += QTEST_HAVE_TIFF diff --git a/tests/auto/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp similarity index 100% rename from tests/auto/qimagewriter/tst_qimagewriter.cpp rename to tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp diff --git a/tests/auto/qmovie/.gitignore b/tests/auto/gui/image/qmovie/.gitignore similarity index 100% rename from tests/auto/qmovie/.gitignore rename to tests/auto/gui/image/qmovie/.gitignore diff --git a/tests/auto/qmovie/animations/comicsecard.gif b/tests/auto/gui/image/qmovie/animations/comicsecard.gif similarity index 100% rename from tests/auto/qmovie/animations/comicsecard.gif rename to tests/auto/gui/image/qmovie/animations/comicsecard.gif diff --git a/tests/auto/qmovie/animations/corrupt.gif b/tests/auto/gui/image/qmovie/animations/corrupt.gif similarity index 100% rename from tests/auto/qmovie/animations/corrupt.gif rename to tests/auto/gui/image/qmovie/animations/corrupt.gif diff --git a/tests/auto/qmovie/animations/dutch.mng b/tests/auto/gui/image/qmovie/animations/dutch.mng similarity index 100% rename from tests/auto/qmovie/animations/dutch.mng rename to tests/auto/gui/image/qmovie/animations/dutch.mng diff --git a/tests/auto/qmovie/animations/trolltech.gif b/tests/auto/gui/image/qmovie/animations/trolltech.gif similarity index 100% rename from tests/auto/qmovie/animations/trolltech.gif rename to tests/auto/gui/image/qmovie/animations/trolltech.gif diff --git a/tests/auto/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro similarity index 97% rename from tests/auto/qmovie/qmovie.pro rename to tests/auto/gui/image/qmovie/qmovie.pro index 855eb9e17a6..3e085ceeaf0 100644 --- a/tests/auto/qmovie/qmovie.pro +++ b/tests/auto/gui/image/qmovie/qmovie.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qmovie.cpp MOC_DIR=tmp diff --git a/tests/auto/qmovie/resources.qrc b/tests/auto/gui/image/qmovie/resources.qrc similarity index 100% rename from tests/auto/qmovie/resources.qrc rename to tests/auto/gui/image/qmovie/resources.qrc diff --git a/tests/auto/qmovie/tst_qmovie.cpp b/tests/auto/gui/image/qmovie/tst_qmovie.cpp similarity index 100% rename from tests/auto/qmovie/tst_qmovie.cpp rename to tests/auto/gui/image/qmovie/tst_qmovie.cpp diff --git a/tests/auto/qpicture/.gitignore b/tests/auto/gui/image/qpicture/.gitignore similarity index 100% rename from tests/auto/qpicture/.gitignore rename to tests/auto/gui/image/qpicture/.gitignore diff --git a/tests/auto/qpicture/qpicture.pro b/tests/auto/gui/image/qpicture/qpicture.pro similarity index 77% rename from tests/auto/qpicture/qpicture.pro rename to tests/auto/gui/image/qpicture/qpicture.pro index 9979fe35592..eb96b73487b 100644 --- a/tests/auto/qpicture/qpicture.pro +++ b/tests/auto/gui/image/qpicture/qpicture.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qpicture.cpp diff --git a/tests/auto/qpicture/tst_qpicture.cpp b/tests/auto/gui/image/qpicture/tst_qpicture.cpp similarity index 100% rename from tests/auto/qpicture/tst_qpicture.cpp rename to tests/auto/gui/image/qpicture/tst_qpicture.cpp diff --git a/tests/auto/qpixmap/.gitignore b/tests/auto/gui/image/qpixmap/.gitignore similarity index 100% rename from tests/auto/qpixmap/.gitignore rename to tests/auto/gui/image/qpixmap/.gitignore diff --git a/tests/auto/qpixmap/convertFromImage/task31722_0/img1.png b/tests/auto/gui/image/qpixmap/convertFromImage/task31722_0/img1.png similarity index 100% rename from tests/auto/qpixmap/convertFromImage/task31722_0/img1.png rename to tests/auto/gui/image/qpixmap/convertFromImage/task31722_0/img1.png diff --git a/tests/auto/qpixmap/convertFromImage/task31722_0/img2.png b/tests/auto/gui/image/qpixmap/convertFromImage/task31722_0/img2.png similarity index 100% rename from tests/auto/qpixmap/convertFromImage/task31722_0/img2.png rename to tests/auto/gui/image/qpixmap/convertFromImage/task31722_0/img2.png diff --git a/tests/auto/qpixmap/convertFromImage/task31722_1/img1.png b/tests/auto/gui/image/qpixmap/convertFromImage/task31722_1/img1.png similarity index 100% rename from tests/auto/qpixmap/convertFromImage/task31722_1/img1.png rename to tests/auto/gui/image/qpixmap/convertFromImage/task31722_1/img1.png diff --git a/tests/auto/qpixmap/convertFromImage/task31722_1/img2.png b/tests/auto/gui/image/qpixmap/convertFromImage/task31722_1/img2.png similarity index 100% rename from tests/auto/qpixmap/convertFromImage/task31722_1/img2.png rename to tests/auto/gui/image/qpixmap/convertFromImage/task31722_1/img2.png diff --git a/tests/auto/qpixmap/convertFromToHICON/icon_32bpp.ico b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_32bpp.ico similarity index 100% rename from tests/auto/qpixmap/convertFromToHICON/icon_32bpp.ico rename to tests/auto/gui/image/qpixmap/convertFromToHICON/icon_32bpp.ico diff --git a/tests/auto/qpixmap/convertFromToHICON/icon_32bpp_16x16.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_32bpp_16x16.png similarity index 100% rename from tests/auto/qpixmap/convertFromToHICON/icon_32bpp_16x16.png rename to tests/auto/gui/image/qpixmap/convertFromToHICON/icon_32bpp_16x16.png diff --git a/tests/auto/qpixmap/convertFromToHICON/icon_32bpp_256x256.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_32bpp_256x256.png similarity index 100% rename from tests/auto/qpixmap/convertFromToHICON/icon_32bpp_256x256.png rename to tests/auto/gui/image/qpixmap/convertFromToHICON/icon_32bpp_256x256.png diff --git a/tests/auto/qpixmap/convertFromToHICON/icon_32bpp_32x32.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_32bpp_32x32.png similarity index 100% rename from tests/auto/qpixmap/convertFromToHICON/icon_32bpp_32x32.png rename to tests/auto/gui/image/qpixmap/convertFromToHICON/icon_32bpp_32x32.png diff --git a/tests/auto/qpixmap/convertFromToHICON/icon_32bpp_48x48.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_32bpp_48x48.png similarity index 100% rename from tests/auto/qpixmap/convertFromToHICON/icon_32bpp_48x48.png rename to tests/auto/gui/image/qpixmap/convertFromToHICON/icon_32bpp_48x48.png diff --git a/tests/auto/qpixmap/convertFromToHICON/icon_8bpp.ico b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp.ico similarity index 100% rename from tests/auto/qpixmap/convertFromToHICON/icon_8bpp.ico rename to tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp.ico diff --git a/tests/auto/qpixmap/convertFromToHICON/icon_8bpp_16x16.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_16x16.png similarity index 100% rename from tests/auto/qpixmap/convertFromToHICON/icon_8bpp_16x16.png rename to tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_16x16.png diff --git a/tests/auto/qpixmap/convertFromToHICON/icon_8bpp_32x32.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_32x32.png similarity index 100% rename from tests/auto/qpixmap/convertFromToHICON/icon_8bpp_32x32.png rename to tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_32x32.png diff --git a/tests/auto/qpixmap/convertFromToHICON/icon_8bpp_48x48.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_48x48.png similarity index 100% rename from tests/auto/qpixmap/convertFromToHICON/icon_8bpp_48x48.png rename to tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_48x48.png diff --git a/tests/auto/qpixmap/images/designer.png b/tests/auto/gui/image/qpixmap/images/designer.png similarity index 100% rename from tests/auto/qpixmap/images/designer.png rename to tests/auto/gui/image/qpixmap/images/designer.png diff --git a/tests/auto/qpixmap/images/dx_-10_dy_-10_50_50_100_100.png b/tests/auto/gui/image/qpixmap/images/dx_-10_dy_-10_50_50_100_100.png similarity index 100% rename from tests/auto/qpixmap/images/dx_-10_dy_-10_50_50_100_100.png rename to tests/auto/gui/image/qpixmap/images/dx_-10_dy_-10_50_50_100_100.png diff --git a/tests/auto/qpixmap/images/dx_-10_dy_-10_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_-10_dy_-10_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_-10_dy_-10_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_-10_dy_-10_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_-10_dy_0_50_50_100_100.png b/tests/auto/gui/image/qpixmap/images/dx_-10_dy_0_50_50_100_100.png similarity index 100% rename from tests/auto/qpixmap/images/dx_-10_dy_0_50_50_100_100.png rename to tests/auto/gui/image/qpixmap/images/dx_-10_dy_0_50_50_100_100.png diff --git a/tests/auto/qpixmap/images/dx_-10_dy_0_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_-10_dy_0_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_-10_dy_0_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_-10_dy_0_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_-128_dy_-128_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_-128_dy_-128_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_-128_dy_-128_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_-128_dy_-128_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_-128_dy_0_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_-128_dy_0_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_-128_dy_0_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_-128_dy_0_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_0_dy_-10_50_50_100_100.png b/tests/auto/gui/image/qpixmap/images/dx_0_dy_-10_50_50_100_100.png similarity index 100% rename from tests/auto/qpixmap/images/dx_0_dy_-10_50_50_100_100.png rename to tests/auto/gui/image/qpixmap/images/dx_0_dy_-10_50_50_100_100.png diff --git a/tests/auto/qpixmap/images/dx_0_dy_-10_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_0_dy_-10_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_0_dy_-10_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_0_dy_-10_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_0_dy_-128_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_0_dy_-128_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_0_dy_-128_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_0_dy_-128_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_0_dy_0_50_50_100_100.png b/tests/auto/gui/image/qpixmap/images/dx_0_dy_0_50_50_100_100.png similarity index 100% rename from tests/auto/qpixmap/images/dx_0_dy_0_50_50_100_100.png rename to tests/auto/gui/image/qpixmap/images/dx_0_dy_0_50_50_100_100.png diff --git a/tests/auto/qpixmap/images/dx_0_dy_0_null.png b/tests/auto/gui/image/qpixmap/images/dx_0_dy_0_null.png similarity index 100% rename from tests/auto/qpixmap/images/dx_0_dy_0_null.png rename to tests/auto/gui/image/qpixmap/images/dx_0_dy_0_null.png diff --git a/tests/auto/qpixmap/images/dx_0_dy_0_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_0_dy_0_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_0_dy_0_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_0_dy_0_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_0_dy_10_50_50_100_100.png b/tests/auto/gui/image/qpixmap/images/dx_0_dy_10_50_50_100_100.png similarity index 100% rename from tests/auto/qpixmap/images/dx_0_dy_10_50_50_100_100.png rename to tests/auto/gui/image/qpixmap/images/dx_0_dy_10_50_50_100_100.png diff --git a/tests/auto/qpixmap/images/dx_0_dy_10_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_0_dy_10_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_0_dy_10_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_0_dy_10_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_0_dy_128_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_0_dy_128_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_0_dy_128_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_0_dy_128_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_0_dy_1_null.png b/tests/auto/gui/image/qpixmap/images/dx_0_dy_1_null.png similarity index 100% rename from tests/auto/qpixmap/images/dx_0_dy_1_null.png rename to tests/auto/gui/image/qpixmap/images/dx_0_dy_1_null.png diff --git a/tests/auto/qpixmap/images/dx_10_dy_0_50_50_100_100.png b/tests/auto/gui/image/qpixmap/images/dx_10_dy_0_50_50_100_100.png similarity index 100% rename from tests/auto/qpixmap/images/dx_10_dy_0_50_50_100_100.png rename to tests/auto/gui/image/qpixmap/images/dx_10_dy_0_50_50_100_100.png diff --git a/tests/auto/qpixmap/images/dx_10_dy_0_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_10_dy_0_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_10_dy_0_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_10_dy_0_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_10_dy_10_50_50_100_100.png b/tests/auto/gui/image/qpixmap/images/dx_10_dy_10_50_50_100_100.png similarity index 100% rename from tests/auto/qpixmap/images/dx_10_dy_10_50_50_100_100.png rename to tests/auto/gui/image/qpixmap/images/dx_10_dy_10_50_50_100_100.png diff --git a/tests/auto/qpixmap/images/dx_10_dy_10_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_10_dy_10_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_10_dy_10_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_10_dy_10_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_128_dy_0_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_128_dy_0_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_128_dy_0_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_128_dy_0_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_128_dy_128_64_64_128_128.png b/tests/auto/gui/image/qpixmap/images/dx_128_dy_128_64_64_128_128.png similarity index 100% rename from tests/auto/qpixmap/images/dx_128_dy_128_64_64_128_128.png rename to tests/auto/gui/image/qpixmap/images/dx_128_dy_128_64_64_128_128.png diff --git a/tests/auto/qpixmap/images/dx_128_dy_128_x_y_w_h.png b/tests/auto/gui/image/qpixmap/images/dx_128_dy_128_x_y_w_h.png similarity index 100% rename from tests/auto/qpixmap/images/dx_128_dy_128_x_y_w_h.png rename to tests/auto/gui/image/qpixmap/images/dx_128_dy_128_x_y_w_h.png diff --git a/tests/auto/qpixmap/images/dx_1_dy_0_null.png b/tests/auto/gui/image/qpixmap/images/dx_1_dy_0_null.png similarity index 100% rename from tests/auto/qpixmap/images/dx_1_dy_0_null.png rename to tests/auto/gui/image/qpixmap/images/dx_1_dy_0_null.png diff --git a/tests/auto/qpixmap/loadFromData/designer_argb32.png b/tests/auto/gui/image/qpixmap/loadFromData/designer_argb32.png similarity index 100% rename from tests/auto/qpixmap/loadFromData/designer_argb32.png rename to tests/auto/gui/image/qpixmap/loadFromData/designer_argb32.png diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.gif similarity index 100% rename from tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif rename to tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.gif diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.png similarity index 100% rename from tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png rename to tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.png diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif similarity index 100% rename from tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif rename to tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha_animated.gif diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.gif similarity index 100% rename from tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif rename to tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.gif diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.png similarity index 100% rename from tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png rename to tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.png diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif similarity index 100% rename from tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif rename to tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha_animated.gif diff --git a/tests/auto/qpixmap/loadFromData/designer_rgb32.jpg b/tests/auto/gui/image/qpixmap/loadFromData/designer_rgb32.jpg similarity index 100% rename from tests/auto/qpixmap/loadFromData/designer_rgb32.jpg rename to tests/auto/gui/image/qpixmap/loadFromData/designer_rgb32.jpg diff --git a/tests/auto/qpixmap/loadFromData/designer_rgb32.png b/tests/auto/gui/image/qpixmap/loadFromData/designer_rgb32.png similarity index 100% rename from tests/auto/qpixmap/loadFromData/designer_rgb32.png rename to tests/auto/gui/image/qpixmap/loadFromData/designer_rgb32.png diff --git a/tests/auto/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro similarity index 85% rename from tests/auto/qpixmap/qpixmap.pro rename to tests/auto/gui/image/qpixmap/qpixmap.pro index f5df30cc1d3..bcd65897d20 100644 --- a/tests/auto/qpixmap/qpixmap.pro +++ b/tests/auto/gui/image/qpixmap/qpixmap.pro @@ -1,6 +1,6 @@ load(qttest_p4) -QT += core-private gui-private +QT += core-private gui-private widgets widgets-private SOURCES += tst_qpixmap.cpp wince*|symbian: { @@ -25,13 +25,11 @@ wince*: { DEPLOYMENT_PLUGIN += qico } else:symbian { LIBS += -lfbscli.dll -lbitgdi.dll -lgdi.dll - contains(QT_CONFIG, openvg) { - LIBS += $$QMAKE_LIBS_OPENVG - QT *= openvg - } } else { DEFINES += SRCDIR=\\\"$$PWD\\\" win32:LIBS += -lgdi32 -luser32 } RESOURCES += qpixmap.qrc + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qpixmap/qpixmap.qrc b/tests/auto/gui/image/qpixmap/qpixmap.qrc similarity index 100% rename from tests/auto/qpixmap/qpixmap.qrc rename to tests/auto/gui/image/qpixmap/qpixmap.qrc diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp similarity index 94% rename from tests/auto/qpixmap/tst_qpixmap.cpp rename to tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index e62708fc3d1..38858e55037 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -51,7 +51,7 @@ #include <qtreewidget.h> #include <qsplashscreen.h> -#include <private/qpixmapdata_p.h> +#include <qplatformpixmap_qpa.h> #include <private/qdrawhelper_p.h> #include <QSet> @@ -102,9 +102,6 @@ public slots: private slots: void swap(); - void setAlphaChannel_data(); - void setAlphaChannel(); - void fromImage_data(); void fromImage(); @@ -267,79 +264,6 @@ void tst_QPixmap::swap() QCOMPARE(p2.size(), QSize(16,16)); } -void tst_QPixmap::setAlphaChannel_data() -{ - QTest::addColumn<int>("red"); - QTest::addColumn<int>("green"); - QTest::addColumn<int>("blue"); - QTest::addColumn<int>("alpha"); - - QTest::newRow("red 0") << 255 << 0 << 0 << 0; - QTest::newRow("red 24") << 255 << 0 << 0 << 24; - QTest::newRow("red 124") << 255 << 0 << 0 << 124; - QTest::newRow("red 255") << 255 << 0 << 0 << 255; - - QTest::newRow("green 0") << 0 << 255 << 0 << 0; - QTest::newRow("green 24") << 0 << 255 << 0 << 24; - QTest::newRow("green 124") << 0 << 255 << 0 << 124; - QTest::newRow("green 255") << 0 << 255 << 0 << 255; - - QTest::newRow("blue 0") << 0 << 0 << 255 << 0; - QTest::newRow("blue 24") << 0 << 0 << 255 << 24; - QTest::newRow("blue 124") << 0 << 0 << 255 << 124; - QTest::newRow("blue 255") << 0 << 0 << 255 << 255; -} - -void tst_QPixmap::setAlphaChannel() -{ - QFETCH(int, red); - QFETCH(int, green); - QFETCH(int, blue); - QFETCH(int, alpha); - - int width = 100; - int height = 100; - - QPixmap pixmap(width, height); - pixmap.fill(QColor(red, green, blue)); - - QPixmap alphaChannel(width, height); - alphaChannel.fill(QColor(alpha, alpha, alpha)); - pixmap.setAlphaChannel(alphaChannel); - -#ifdef Q_WS_X11 - if (pixmap.pixmapData()->classId() == QPixmapData::X11Class && !pixmap.x11PictureHandle()) - QSKIP("Requires XRender support", SkipAll); -#endif - - QImage result; - bool ok = true; - - QPixmap outAlpha = pixmap.alphaChannel(); - QCOMPARE(outAlpha.size(), pixmap.size()); - - result = outAlpha.toImage().convertToFormat(QImage::Format_ARGB32);; - for (int y = 0; y < height; ++y) { - for (int x = 0; x < width; ++x) { - ok &= qGray(result.pixel(x, y)) == alpha; - } - } - QVERIFY(ok); - - result = pixmap.toImage().convertToFormat(QImage::Format_ARGB32); - QRgb expected = alpha == 0 ? 0 : qRgba(red, green, blue, alpha); - for (int y = 0; y < height; ++y) { - for (int x = 0; x < width; ++x) { - if (result.colorCount() > 0) { - ok &= result.pixelIndex(x, y) == expected; - } else { - ok &= result.pixel(x, y) == expected; - } - } - } - QVERIFY(ok); -} - void tst_QPixmap::fromImage_data() { bool is16bit = false; @@ -375,7 +299,7 @@ void tst_QPixmap::fromImage() const QPixmap pixmap = QPixmap::fromImage(image); #ifdef Q_WS_X11 - if (pixmap.pixmapData()->classId() == QPixmapData::X11Class && !pixmap.x11PictureHandle()) + if (pixmap.handle()->classId() == QPlatformPixmap::X11Class && !pixmap.x11PictureHandle()) QSKIP("Requires XRender support", SkipAll); #endif const QImage result = pixmap.toImage(); @@ -606,7 +530,7 @@ void tst_QPixmap::fill() pm = QPixmap(400, 400); #if defined(Q_WS_X11) - if (!bitmap && pm.pixmapData()->classId() == QPixmapData::X11Class && !pm.x11PictureHandle()) + if (!bitmap && pm.handle()->classId() == QPlatformPixmap::X11Class && !pm.x11PictureHandle()) QSKIP("Requires XRender support", SkipSingle); #endif @@ -636,7 +560,7 @@ void tst_QPixmap::fill_transparent() { QPixmap pixmap(10, 10); #ifdef Q_WS_X11 - if (pixmap.pixmapData()->classId() == QPixmapData::X11Class && !pixmap.x11PictureHandle()) + if (pixmap.handle()->classId() == QPlatformPixmap::X11Class && !pixmap.x11PictureHandle()) QSKIP("Requires XRender support", SkipAll); #endif pixmap.fill(Qt::transparent); @@ -940,7 +864,7 @@ void tst_QPixmap::isNull() void tst_QPixmap::convertFromImageNoDetach() { QPixmap randomPixmap(10, 10); - if (randomPixmap.pixmapData()->classId() != QPixmapData::RasterClass) + if (randomPixmap.handle()->classId() != QPlatformPixmap::RasterClass) QSKIP("Test only valid for raster pixmaps", SkipAll); //first get the screen format @@ -1513,7 +1437,7 @@ void tst_QPixmap::fromImage_crash() delete img; } -//This is testing QPixmapData::createCompatiblePixmapData - see QTBUG-5977 +//This is testing QPlatformPixmap::createCompatiblePlatformPixmap - see QTBUG-5977 void tst_QPixmap::splash_crash() { QPixmap pix; @@ -1755,10 +1679,10 @@ void tst_QPixmap::toImageDeepCopy() #if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) Q_OPENVG_EXPORT VGImage qPixmapToVGImage(const QPixmap& pixmap); -class FriendlyVGPixmapData : public QVGPixmapData +class FriendlyVGPlatformPixmap : public QVGPlatformPixmap { public: - FriendlyVGPixmapData(PixelType type) : QVGPixmapData(type) { } + FriendlyVGPlatformPixmap(PixelType type) : QVGPlatformPixmap(type) { } bool sourceIsNull() { return source.isNull(); } friend QPixmap pixmapFromVGImage(VGImage image); }; @@ -1767,7 +1691,7 @@ QPixmap pixmapFromVGImage(VGImage image) if (image != VG_INVALID_HANDLE) { int w = vgGetParameteri(image, VG_IMAGE_WIDTH); int h = vgGetParameteri(image, VG_IMAGE_HEIGHT); - FriendlyVGPixmapData *pd = new FriendlyVGPixmapData(QPixmapData::PixmapType); + FriendlyVGPlatformPixmap *pd = new FriendlyVGPlatformPixmap(QPlatformPixmap::PixmapType); pd->resize(w, h); pd->vgImage = image; pd->recreate = false; @@ -1796,12 +1720,12 @@ public: } else { // second phase: check if readback works painter.drawPixmap(0, 0, pm); // Drawing should not cause readback, this is important for performance; - noreadback_ok = static_cast<FriendlyVGPixmapData *>(pm.pixmapData())->sourceIsNull(); + noreadback_ok = static_cast<FriendlyVGPlatformPixmap *>(pm.handle())->sourceIsNull(); // However toImage() requires readback. QImage img = pm.toImage(); readback_ok = img.width() == pm.width(); readback_ok &= img.height() == pm.height(); - readback_ok &= !static_cast<FriendlyVGPixmapData *>(pm.pixmapData())->sourceIsNull(); + readback_ok &= !static_cast<FriendlyVGPlatformPixmap *>(pm.handle())->sourceIsNull(); uint pix = img.pixel(1, 1); content_ok = qRed(pix) == testPixel.red(); content_ok &= qGreen(pix) == testPixel.green(); @@ -1823,7 +1747,7 @@ public: void tst_QPixmap::vgImageReadBack() { QPixmap tmp(10, 20); - if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { + if (tmp.handle()->classId() == QPlatformPixmap::OpenVGClass) { Content c; c.w = 50; c.h = 60; @@ -1837,7 +1761,7 @@ void tst_QPixmap::vgImageReadBack() QCOMPARE(pm.width(), c.w); QCOMPARE(pm.height(), c.h); QVERIFY(qPixmapToVGImage(pm) == c.vgimage); - QVERIFY(static_cast<FriendlyVGPixmapData *>(pm.pixmapData())->sourceIsNull()); + QVERIFY(static_cast<FriendlyVGPlatformPixmap *>(pm.handle())->sourceIsNull()); c.pm = pm; // Make sure the second phase in paintEvent is executed too. c.hide(); diff --git a/tests/auto/qpixmapcache/.gitignore b/tests/auto/gui/image/qpixmapcache/.gitignore similarity index 100% rename from tests/auto/qpixmapcache/.gitignore rename to tests/auto/gui/image/qpixmapcache/.gitignore diff --git a/tests/auto/qpixmapcache/qpixmapcache.pro b/tests/auto/gui/image/qpixmapcache/qpixmapcache.pro similarity index 100% rename from tests/auto/qpixmapcache/qpixmapcache.pro rename to tests/auto/gui/image/qpixmapcache/qpixmapcache.pro diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp similarity index 100% rename from tests/auto/qpixmapcache/tst_qpixmapcache.cpp rename to tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp diff --git a/tests/auto/qpixmapfilter/noise.png b/tests/auto/gui/image/qpixmapfilter/noise.png similarity index 100% rename from tests/auto/qpixmapfilter/noise.png rename to tests/auto/gui/image/qpixmapfilter/noise.png diff --git a/tests/auto/qpixmapfilter/qpixmapfilter.pro b/tests/auto/gui/image/qpixmapfilter/qpixmapfilter.pro similarity index 84% rename from tests/auto/qpixmapfilter/qpixmapfilter.pro rename to tests/auto/gui/image/qpixmapfilter/qpixmapfilter.pro index d52a3c39a32..21e10b7ab90 100644 --- a/tests/auto/qpixmapfilter/qpixmapfilter.pro +++ b/tests/auto/gui/image/qpixmapfilter/qpixmapfilter.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += gui-private SOURCES += tst_qpixmapfilter.cpp diff --git a/tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp b/tests/auto/gui/image/qpixmapfilter/tst_qpixmapfilter.cpp similarity index 100% rename from tests/auto/qpixmapfilter/tst_qpixmapfilter.cpp rename to tests/auto/gui/image/qpixmapfilter/tst_qpixmapfilter.cpp diff --git a/tests/auto/qvolatileimage/qvolatileimage.pro b/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro similarity index 83% rename from tests/auto/qvolatileimage/qvolatileimage.pro rename to tests/auto/gui/image/qvolatileimage/qvolatileimage.pro index 4be93896c4c..45d80b85f2f 100644 --- a/tests/auto/qvolatileimage/qvolatileimage.pro +++ b/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro @@ -1,6 +1,6 @@ load(qttest_p4) -QT += gui-private +QT += gui-private widgets SOURCES += tst_qvolatileimage.cpp diff --git a/tests/auto/qvolatileimage/tst_qvolatileimage.cpp b/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp similarity index 100% rename from tests/auto/qvolatileimage/tst_qvolatileimage.cpp rename to tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro new file mode 100644 index 00000000000..880c3c86138 --- /dev/null +++ b/tests/auto/gui/kernel/kernel.pro @@ -0,0 +1,17 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qclipboard \ + qdrag \ + qevent \ + qfileopenevent \ + qguivariant \ + qkeysequence \ + qmouseevent \ + qmouseevent_modal \ + qpalette \ + qshortcut \ + qtouchevent \ + +symbian { + SUBDIRS += qsoftkeymanager +} diff --git a/tests/auto/qclipboard/.gitignore b/tests/auto/gui/kernel/qclipboard/.gitignore similarity index 100% rename from tests/auto/qclipboard/.gitignore rename to tests/auto/gui/kernel/qclipboard/.gitignore diff --git a/tests/auto/qclipboard/copier/copier.pro b/tests/auto/gui/kernel/qclipboard/copier/copier.pro similarity index 90% rename from tests/auto/qclipboard/copier/copier.pro rename to tests/auto/gui/kernel/qclipboard/copier/copier.pro index 1c188ca7ded..d345d33eb5b 100644 --- a/tests/auto/qclipboard/copier/copier.pro +++ b/tests/auto/gui/kernel/qclipboard/copier/copier.pro @@ -3,6 +3,7 @@ TARGET = DEPENDPATH += . INCLUDEPATH += . CONFIG -= app_bundle +QT += widgets win32: DESTDIR = ../copier # Input SOURCES += main.cpp diff --git a/tests/auto/qclipboard/copier/main.cpp b/tests/auto/gui/kernel/qclipboard/copier/main.cpp similarity index 100% rename from tests/auto/qclipboard/copier/main.cpp rename to tests/auto/gui/kernel/qclipboard/copier/main.cpp diff --git a/tests/auto/qclipboard/paster/main.cpp b/tests/auto/gui/kernel/qclipboard/paster/main.cpp similarity index 100% rename from tests/auto/qclipboard/paster/main.cpp rename to tests/auto/gui/kernel/qclipboard/paster/main.cpp diff --git a/tests/auto/qclipboard/paster/paster.pro b/tests/auto/gui/kernel/qclipboard/paster/paster.pro similarity index 90% rename from tests/auto/qclipboard/paster/paster.pro rename to tests/auto/gui/kernel/qclipboard/paster/paster.pro index 8580644b1e6..d214c9e90a8 100644 --- a/tests/auto/qclipboard/paster/paster.pro +++ b/tests/auto/gui/kernel/qclipboard/paster/paster.pro @@ -4,7 +4,7 @@ DEPENDPATH += . INCLUDEPATH += . win32: DESTDIR = ../paster CONFIG -= app_bundle - +QT += widgets # Input SOURCES += main.cpp diff --git a/tests/auto/qclipboard/qclipboard.pro b/tests/auto/gui/kernel/qclipboard/qclipboard.pro similarity index 100% rename from tests/auto/qclipboard/qclipboard.pro rename to tests/auto/gui/kernel/qclipboard/qclipboard.pro diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro similarity index 100% rename from tests/auto/qclipboard/test/test.pro rename to tests/auto/gui/kernel/qclipboard/test/test.pro diff --git a/tests/auto/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp similarity index 99% rename from tests/auto/qclipboard/tst_qclipboard.cpp rename to tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index 94981cf8e56..4d3bb29e13c 100644 --- a/tests/auto/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -42,7 +42,7 @@ #include <QtTest/QtTest> #include <QtCore/QDebug> -#include <QtGui/QApplication> +#include <QtWidgets/QApplication> #include <QtGui/QClipboard> #ifdef Q_WS_MAC #include <Carbon/Carbon.h> diff --git a/tests/auto/qdrag/.gitignore b/tests/auto/gui/kernel/qdrag/.gitignore similarity index 100% rename from tests/auto/qdrag/.gitignore rename to tests/auto/gui/kernel/qdrag/.gitignore diff --git a/tests/auto/qdrag/qdrag.pro b/tests/auto/gui/kernel/qdrag/qdrag.pro similarity index 93% rename from tests/auto/qdrag/qdrag.pro rename to tests/auto/gui/kernel/qdrag/qdrag.pro index ad36fa5adaa..d9d645559b1 100644 --- a/tests/auto/qdrag/qdrag.pro +++ b/tests/auto/gui/kernel/qdrag/qdrag.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qdrag.cpp diff --git a/tests/auto/qdrag/tst_qdrag.cpp b/tests/auto/gui/kernel/qdrag/tst_qdrag.cpp similarity index 100% rename from tests/auto/qdrag/tst_qdrag.cpp rename to tests/auto/gui/kernel/qdrag/tst_qdrag.cpp diff --git a/tests/auto/qevent/.gitignore b/tests/auto/gui/kernel/qevent/.gitignore similarity index 100% rename from tests/auto/qevent/.gitignore rename to tests/auto/gui/kernel/qevent/.gitignore diff --git a/tests/auto/qevent/qevent.pro b/tests/auto/gui/kernel/qevent/qevent.pro similarity index 100% rename from tests/auto/qevent/qevent.pro rename to tests/auto/gui/kernel/qevent/qevent.pro diff --git a/tests/auto/qevent/tst_qevent.cpp b/tests/auto/gui/kernel/qevent/tst_qevent.cpp similarity index 100% rename from tests/auto/qevent/tst_qevent.cpp rename to tests/auto/gui/kernel/qevent/tst_qevent.cpp diff --git a/tests/auto/qfileopenevent/qfileopenevent.pro b/tests/auto/gui/kernel/qfileopenevent/qfileopenevent.pro similarity index 80% rename from tests/auto/qfileopenevent/qfileopenevent.pro rename to tests/auto/gui/kernel/qfileopenevent/qfileopenevent.pro index 45978d7b7e4..73724828dbb 100644 --- a/tests/auto/qfileopenevent/qfileopenevent.pro +++ b/tests/auto/gui/kernel/qfileopenevent/qfileopenevent.pro @@ -1,2 +1,3 @@ TEMPLATE = subdirs +QT += widgets SUBDIRS = test qfileopeneventexternal diff --git a/tests/auto/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp similarity index 100% rename from tests/auto/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp rename to tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.cpp diff --git a/tests/auto/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro similarity index 93% rename from tests/auto/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro rename to tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro index b95ed45edda..cb61b82e381 100644 --- a/tests/auto/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro +++ b/tests/auto/gui/kernel/qfileopenevent/qfileopeneventexternal/qfileopeneventexternal.pro @@ -1,6 +1,6 @@ TEMPLATE = app TARGET = qfileopeneventexternal -QT += core gui +QT += core gui widgets SOURCES += qfileopeneventexternal.cpp symbian: { RSS_RULES += "embeddability=KAppEmbeddable;" diff --git a/tests/auto/qfileopenevent/test/test.pro b/tests/auto/gui/kernel/qfileopenevent/test/test.pro similarity index 100% rename from tests/auto/qfileopenevent/test/test.pro rename to tests/auto/gui/kernel/qfileopenevent/test/test.pro diff --git a/tests/auto/qfileopenevent/test/tst_qfileopenevent.cpp b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp similarity index 100% rename from tests/auto/qfileopenevent/test/tst_qfileopenevent.cpp rename to tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp diff --git a/tests/auto/qguivariant/.gitignore b/tests/auto/gui/kernel/qguivariant/.gitignore similarity index 100% rename from tests/auto/qguivariant/.gitignore rename to tests/auto/gui/kernel/qguivariant/.gitignore diff --git a/tests/auto/qguivariant/qguivariant.pro b/tests/auto/gui/kernel/qguivariant/qguivariant.pro similarity index 100% rename from tests/auto/qguivariant/qguivariant.pro rename to tests/auto/gui/kernel/qguivariant/qguivariant.pro diff --git a/tests/auto/qguivariant/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp similarity index 100% rename from tests/auto/qguivariant/tst_qguivariant.cpp rename to tests/auto/gui/kernel/qguivariant/tst_qguivariant.cpp diff --git a/tests/auto/qkeysequence/.gitignore b/tests/auto/gui/kernel/qkeysequence/.gitignore similarity index 100% rename from tests/auto/qkeysequence/.gitignore rename to tests/auto/gui/kernel/qkeysequence/.gitignore diff --git a/tests/auto/qkeysequence/keys_de.qm b/tests/auto/gui/kernel/qkeysequence/keys_de.qm similarity index 100% rename from tests/auto/qkeysequence/keys_de.qm rename to tests/auto/gui/kernel/qkeysequence/keys_de.qm diff --git a/tests/auto/qkeysequence/keys_de.ts b/tests/auto/gui/kernel/qkeysequence/keys_de.ts similarity index 100% rename from tests/auto/qkeysequence/keys_de.ts rename to tests/auto/gui/kernel/qkeysequence/keys_de.ts diff --git a/tests/auto/qkeysequence/qkeysequence.pro b/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro similarity index 79% rename from tests/auto/qkeysequence/qkeysequence.pro rename to tests/auto/gui/kernel/qkeysequence/qkeysequence.pro index 720c53d6278..6cfbe459ea3 100644 --- a/tests/auto/qkeysequence/qkeysequence.pro +++ b/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qkeysequence.cpp diff --git a/tests/auto/qkeysequence/qkeysequence.qrc b/tests/auto/gui/kernel/qkeysequence/qkeysequence.qrc similarity index 100% rename from tests/auto/qkeysequence/qkeysequence.qrc rename to tests/auto/gui/kernel/qkeysequence/qkeysequence.qrc diff --git a/tests/auto/qkeysequence/qt_de.qm b/tests/auto/gui/kernel/qkeysequence/qt_de.qm similarity index 100% rename from tests/auto/qkeysequence/qt_de.qm rename to tests/auto/gui/kernel/qkeysequence/qt_de.qm diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp similarity index 100% rename from tests/auto/qkeysequence/tst_qkeysequence.cpp rename to tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp diff --git a/tests/auto/qmouseevent/.gitignore b/tests/auto/gui/kernel/qmouseevent/.gitignore similarity index 100% rename from tests/auto/qmouseevent/.gitignore rename to tests/auto/gui/kernel/qmouseevent/.gitignore diff --git a/tests/auto/qmouseevent/qmouseevent.pro b/tests/auto/gui/kernel/qmouseevent/qmouseevent.pro similarity index 77% rename from tests/auto/qmouseevent/qmouseevent.pro rename to tests/auto/gui/kernel/qmouseevent/qmouseevent.pro index 0e5ddadc1f7..58cebd3d061 100644 --- a/tests/auto/qmouseevent/qmouseevent.pro +++ b/tests/auto/gui/kernel/qmouseevent/qmouseevent.pro @@ -1,2 +1,3 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qmouseevent.cpp diff --git a/tests/auto/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp similarity index 100% rename from tests/auto/qmouseevent/tst_qmouseevent.cpp rename to tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp diff --git a/tests/auto/qmouseevent_modal/.gitignore b/tests/auto/gui/kernel/qmouseevent_modal/.gitignore similarity index 100% rename from tests/auto/qmouseevent_modal/.gitignore rename to tests/auto/gui/kernel/qmouseevent_modal/.gitignore diff --git a/tests/auto/qmouseevent_modal/qmouseevent_modal.pro b/tests/auto/gui/kernel/qmouseevent_modal/qmouseevent_modal.pro similarity index 80% rename from tests/auto/qmouseevent_modal/qmouseevent_modal.pro rename to tests/auto/gui/kernel/qmouseevent_modal/qmouseevent_modal.pro index 33b8eb6954a..2f28de26755 100644 --- a/tests/auto/qmouseevent_modal/qmouseevent_modal.pro +++ b/tests/auto/gui/kernel/qmouseevent_modal/qmouseevent_modal.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qmouseevent_modal.cpp diff --git a/tests/auto/qmouseevent_modal/tst_qmouseevent_modal.cpp b/tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp similarity index 100% rename from tests/auto/qmouseevent_modal/tst_qmouseevent_modal.cpp rename to tests/auto/gui/kernel/qmouseevent_modal/tst_qmouseevent_modal.cpp diff --git a/tests/auto/qpalette/.gitignore b/tests/auto/gui/kernel/qpalette/.gitignore similarity index 100% rename from tests/auto/qpalette/.gitignore rename to tests/auto/gui/kernel/qpalette/.gitignore diff --git a/tests/auto/qpalette/qpalette.pro b/tests/auto/gui/kernel/qpalette/qpalette.pro similarity index 77% rename from tests/auto/qpalette/qpalette.pro rename to tests/auto/gui/kernel/qpalette/qpalette.pro index 4ec7876f6ae..4b240e5f9c2 100644 --- a/tests/auto/qpalette/qpalette.pro +++ b/tests/auto/gui/kernel/qpalette/qpalette.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qpalette.cpp diff --git a/tests/auto/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp similarity index 100% rename from tests/auto/qpalette/tst_qpalette.cpp rename to tests/auto/gui/kernel/qpalette/tst_qpalette.cpp diff --git a/tests/auto/qshortcut/.gitignore b/tests/auto/gui/kernel/qshortcut/.gitignore similarity index 100% rename from tests/auto/qshortcut/.gitignore rename to tests/auto/gui/kernel/qshortcut/.gitignore diff --git a/tests/auto/qshortcut/qshortcut.pro b/tests/auto/gui/kernel/qshortcut/qshortcut.pro similarity index 94% rename from tests/auto/qshortcut/qshortcut.pro rename to tests/auto/gui/kernel/qshortcut/qshortcut.pro index 61e24b570a9..3f68d2377e3 100644 --- a/tests/auto/qshortcut/qshortcut.pro +++ b/tests/auto/gui/kernel/qshortcut/qshortcut.pro @@ -4,6 +4,7 @@ load(qttest_p4) INCLUDEPATH += ../ # Normal Test Files -------------------------------------------------- +QT += widgets HEADERS += SOURCES += tst_qshortcut.cpp diff --git a/tests/auto/qshortcut/tst_qshortcut.cpp b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp similarity index 100% rename from tests/auto/qshortcut/tst_qshortcut.cpp rename to tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp diff --git a/tests/auto/qtouchevent/qtouchevent.pro b/tests/auto/gui/kernel/qtouchevent/qtouchevent.pro similarity index 69% rename from tests/auto/qtouchevent/qtouchevent.pro rename to tests/auto/gui/kernel/qtouchevent/qtouchevent.pro index 8f6aa8703fa..55f99b6cdd1 100644 --- a/tests/auto/qtouchevent/qtouchevent.pro +++ b/tests/auto/gui/kernel/qtouchevent/qtouchevent.pro @@ -1,3 +1,3 @@ SOURCES=tst_qtouchevent.cpp TARGET=tst_qtouchevent -QT+=testlib +QT += testlib widgets diff --git a/tests/auto/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp similarity index 99% rename from tests/auto/qtouchevent/tst_qtouchevent.cpp rename to tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index f0347e39fff..401f79cbc26 100644 --- a/tests/auto/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -1333,11 +1333,11 @@ void tst_QTouchEvent::crashInQGraphicsSceneAfterNotHandlingTouchBegin() QPoint centerPos = view.mapFromScene(rect->boundingRect().center()); // Touch the button - QTest::touchEvent(view.viewport()).press(0, centerPos); - QTest::touchEvent(view.viewport()).release(0, centerPos); + QTest::touchEvent(view.viewport()).press(0, centerPos, static_cast<QWindow *>(0)); + QTest::touchEvent(view.viewport()).release(0, centerPos, static_cast<QWindow *>(0)); // Touch outside of the button - QTest::touchEvent(view.viewport()).press(0, view.mapFromScene(QPoint(10, 10))); - QTest::touchEvent(view.viewport()).release(0, view.mapFromScene(QPoint(10, 10))); + QTest::touchEvent(view.viewport()).press(0, view.mapFromScene(QPoint(10, 10)), static_cast<QWindow *>(0)); + QTest::touchEvent(view.viewport()).release(0, view.mapFromScene(QPoint(10, 10)), static_cast<QWindow *>(0)); } void tst_QTouchEvent::touchBeginWithGraphicsWidget() @@ -1358,12 +1358,12 @@ void tst_QTouchEvent::touchBeginWithGraphicsWidget() QTest::qWaitForWindowShown(&view); view.fitInView(scene.sceneRect()); - QTest::touchEvent() + QTest::touchEvent(static_cast<QWindow *>(0)) .press(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport()); - QTest::touchEvent() + QTest::touchEvent(static_cast<QWindow *>(0)) .stationary(0) .press(1, view.mapFromScene(root->mapToScene(6,6)), view.viewport()); - QTest::touchEvent() + QTest::touchEvent(static_cast<QWindow *>(0)) .release(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport()) .release(1, view.mapFromScene(root->mapToScene(6,6)), view.viewport()); @@ -1375,12 +1375,12 @@ void tst_QTouchEvent::touchBeginWithGraphicsWidget() root->reset(); glassWidget->setWindowFlags(Qt::Window); // make the glassWidget a panel - QTest::touchEvent() + QTest::touchEvent(static_cast<QWindow *>(0)) .press(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport()); - QTest::touchEvent() + QTest::touchEvent(static_cast<QWindow *>(0)) .stationary(0) .press(1, view.mapFromScene(root->mapToScene(6,6)), view.viewport()); - QTest::touchEvent() + QTest::touchEvent(static_cast<QWindow *>(0)) .release(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport()) .release(1, view.mapFromScene(root->mapToScene(6,6)), view.viewport()); diff --git a/tests/auto/gui/math3d/math3d.pro b/tests/auto/gui/math3d/math3d.pro new file mode 100644 index 00000000000..d977afa6e06 --- /dev/null +++ b/tests/auto/gui/math3d/math3d.pro @@ -0,0 +1,6 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qquaternion \ + qvectornd \ + qmatrixnxn \ + diff --git a/tests/auto/qmatrixnxn/qmatrixnxn.pro b/tests/auto/gui/math3d/qmatrixnxn/qmatrixnxn.pro similarity index 100% rename from tests/auto/qmatrixnxn/qmatrixnxn.pro rename to tests/auto/gui/math3d/qmatrixnxn/qmatrixnxn.pro diff --git a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp similarity index 100% rename from tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp rename to tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp diff --git a/tests/auto/qquaternion/qquaternion.pro b/tests/auto/gui/math3d/qquaternion/qquaternion.pro similarity index 100% rename from tests/auto/qquaternion/qquaternion.pro rename to tests/auto/gui/math3d/qquaternion/qquaternion.pro diff --git a/tests/auto/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp similarity index 100% rename from tests/auto/qquaternion/tst_qquaternion.cpp rename to tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp diff --git a/tests/auto/qvectornd/qvectornd.pro b/tests/auto/gui/math3d/qvectornd/qvectornd.pro similarity index 100% rename from tests/auto/qvectornd/qvectornd.pro rename to tests/auto/gui/math3d/qvectornd/qvectornd.pro diff --git a/tests/auto/qvectornd/tst_qvectornd.cpp b/tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp similarity index 100% rename from tests/auto/qvectornd/tst_qvectornd.cpp rename to tests/auto/gui/math3d/qvectornd/tst_qvectornd.cpp diff --git a/tests/auto/gui/painting/painting.pro b/tests/auto/gui/painting/painting.pro new file mode 100644 index 00000000000..62230eeac7d --- /dev/null +++ b/tests/auto/gui/painting/painting.pro @@ -0,0 +1,21 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qpainterpath \ + qpainterpathstroker \ + qcolor \ + qbrush \ + qregion \ + qpainter \ + qpathclipper \ + qprinterinfo \ + qpen \ + qpaintengine \ + qtransform \ + qwmatrix \ + qprinter \ + qpolygon \ + +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qpathclipper \ + + diff --git a/tests/auto/qbrush/.gitignore b/tests/auto/gui/painting/qbrush/.gitignore similarity index 100% rename from tests/auto/qbrush/.gitignore rename to tests/auto/gui/painting/qbrush/.gitignore diff --git a/tests/auto/qbrush/qbrush.pro b/tests/auto/gui/painting/qbrush/qbrush.pro similarity index 75% rename from tests/auto/qbrush/qbrush.pro rename to tests/auto/gui/painting/qbrush/qbrush.pro index c17784cbec2..1c3efd46be0 100644 --- a/tests/auto/qbrush/qbrush.pro +++ b/tests/auto/gui/painting/qbrush/qbrush.pro @@ -1,5 +1,3 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qbrush.cpp - - - diff --git a/tests/auto/qbrush/tst_qbrush.cpp b/tests/auto/gui/painting/qbrush/tst_qbrush.cpp similarity index 100% rename from tests/auto/qbrush/tst_qbrush.cpp rename to tests/auto/gui/painting/qbrush/tst_qbrush.cpp diff --git a/tests/auto/qcolor/.gitignore b/tests/auto/gui/painting/qcolor/.gitignore similarity index 100% rename from tests/auto/qcolor/.gitignore rename to tests/auto/gui/painting/qcolor/.gitignore diff --git a/tests/auto/qcolor/qcolor.pro b/tests/auto/gui/painting/qcolor/qcolor.pro similarity index 100% rename from tests/auto/qcolor/qcolor.pro rename to tests/auto/gui/painting/qcolor/qcolor.pro diff --git a/tests/auto/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp similarity index 100% rename from tests/auto/qcolor/tst_qcolor.cpp rename to tests/auto/gui/painting/qcolor/tst_qcolor.cpp diff --git a/tests/auto/qpaintengine/.gitignore b/tests/auto/gui/painting/qpaintengine/.gitignore similarity index 100% rename from tests/auto/qpaintengine/.gitignore rename to tests/auto/gui/painting/qpaintengine/.gitignore diff --git a/tests/auto/qpaintengine/qpaintengine.pro b/tests/auto/gui/painting/qpaintengine/qpaintengine.pro similarity index 100% rename from tests/auto/qpaintengine/qpaintengine.pro rename to tests/auto/gui/painting/qpaintengine/qpaintengine.pro diff --git a/tests/auto/qpaintengine/tst_qpaintengine.cpp b/tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp similarity index 100% rename from tests/auto/qpaintengine/tst_qpaintengine.cpp rename to tests/auto/gui/painting/qpaintengine/tst_qpaintengine.cpp diff --git a/tests/auto/qpainter/.gitignore b/tests/auto/gui/painting/qpainter/.gitignore similarity index 100% rename from tests/auto/qpainter/.gitignore rename to tests/auto/gui/painting/qpainter/.gitignore diff --git a/tests/auto/qpainter/drawEllipse/10x10SizeAt0x0.png b/tests/auto/gui/painting/qpainter/drawEllipse/10x10SizeAt0x0.png similarity index 100% rename from tests/auto/qpainter/drawEllipse/10x10SizeAt0x0.png rename to tests/auto/gui/painting/qpainter/drawEllipse/10x10SizeAt0x0.png diff --git a/tests/auto/qpainter/drawEllipse/10x10SizeAt100x100.png b/tests/auto/gui/painting/qpainter/drawEllipse/10x10SizeAt100x100.png similarity index 100% rename from tests/auto/qpainter/drawEllipse/10x10SizeAt100x100.png rename to tests/auto/gui/painting/qpainter/drawEllipse/10x10SizeAt100x100.png diff --git a/tests/auto/qpainter/drawEllipse/10x10SizeAt200x200.png b/tests/auto/gui/painting/qpainter/drawEllipse/10x10SizeAt200x200.png similarity index 100% rename from tests/auto/qpainter/drawEllipse/10x10SizeAt200x200.png rename to tests/auto/gui/painting/qpainter/drawEllipse/10x10SizeAt200x200.png diff --git a/tests/auto/qpainter/drawEllipse/13x100SizeAt0x0.png b/tests/auto/gui/painting/qpainter/drawEllipse/13x100SizeAt0x0.png similarity index 100% rename from tests/auto/qpainter/drawEllipse/13x100SizeAt0x0.png rename to tests/auto/gui/painting/qpainter/drawEllipse/13x100SizeAt0x0.png diff --git a/tests/auto/qpainter/drawEllipse/13x100SizeAt100x100.png b/tests/auto/gui/painting/qpainter/drawEllipse/13x100SizeAt100x100.png similarity index 100% rename from tests/auto/qpainter/drawEllipse/13x100SizeAt100x100.png rename to tests/auto/gui/painting/qpainter/drawEllipse/13x100SizeAt100x100.png diff --git a/tests/auto/qpainter/drawEllipse/13x100SizeAt200x200.png b/tests/auto/gui/painting/qpainter/drawEllipse/13x100SizeAt200x200.png similarity index 100% rename from tests/auto/qpainter/drawEllipse/13x100SizeAt200x200.png rename to tests/auto/gui/painting/qpainter/drawEllipse/13x100SizeAt200x200.png diff --git a/tests/auto/qpainter/drawEllipse/200x200SizeAt0x0.png b/tests/auto/gui/painting/qpainter/drawEllipse/200x200SizeAt0x0.png similarity index 100% rename from tests/auto/qpainter/drawEllipse/200x200SizeAt0x0.png rename to tests/auto/gui/painting/qpainter/drawEllipse/200x200SizeAt0x0.png diff --git a/tests/auto/qpainter/drawEllipse/200x200SizeAt100x100.png b/tests/auto/gui/painting/qpainter/drawEllipse/200x200SizeAt100x100.png similarity index 100% rename from tests/auto/qpainter/drawEllipse/200x200SizeAt100x100.png rename to tests/auto/gui/painting/qpainter/drawEllipse/200x200SizeAt100x100.png diff --git a/tests/auto/qpainter/drawEllipse/200x200SizeAt200x200.png b/tests/auto/gui/painting/qpainter/drawEllipse/200x200SizeAt200x200.png similarity index 100% rename from tests/auto/qpainter/drawEllipse/200x200SizeAt200x200.png rename to tests/auto/gui/painting/qpainter/drawEllipse/200x200SizeAt200x200.png diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/dst.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/dst.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/dst.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/dst.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_AndNotROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_AndNotROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_AndNotROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_AndNotROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_AndROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_AndROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_AndROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_AndROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_ClearROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_ClearROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_ClearROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_ClearROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_CopyROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_CopyROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_CopyROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_CopyROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_NandROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NandROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_NandROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NandROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_NopROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NopROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_NopROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NopROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_NorROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NorROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_NorROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NorROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_NotAndROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NotAndROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_NotAndROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NotAndROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_NotCopyROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NotCopyROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_NotCopyROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NotCopyROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_NotOrROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NotOrROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_NotOrROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NotOrROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_NotROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NotROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_NotROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NotROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_NotXorROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NotXorROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_NotXorROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_NotXorROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_OrNotROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_OrNotROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_OrNotROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_OrNotROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_OrROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_OrROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_OrROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_OrROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_SetROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_SetROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_SetROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_SetROP.xbm diff --git a/tests/auto/qpainter/drawLine_rop_bitmap/res/res_XorROP.xbm b/tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_XorROP.xbm similarity index 100% rename from tests/auto/qpainter/drawLine_rop_bitmap/res/res_XorROP.xbm rename to tests/auto/gui/painting/qpainter/drawLine_rop_bitmap/res/res_XorROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop/dst1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/dst1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/dst1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/dst1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/dst2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/dst2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/dst2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/dst2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/dst3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/dst3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/dst3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/dst3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndNotROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndNotROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_AndROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_AndROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_AndROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_ClearROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_ClearROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_CopyROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_CopyROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NandROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NandROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NandROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NandROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NandROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NandROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NandROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NandROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NandROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NandROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NandROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NandROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NandROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NandROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NandROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NandROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NandROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NopROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NopROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NopROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NopROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NopROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NopROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NopROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NopROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NopROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NopROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NopROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NopROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NopROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NopROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NopROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NopROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NopROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NorROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NorROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NorROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NorROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NorROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NorROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NorROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NorROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NorROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NorROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NorROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NorROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NorROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NorROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NorROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NorROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NorROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotAndROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotAndROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotCopyROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotCopyROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotOrROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotOrROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_NotXorROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_NotXorROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrNotROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrNotROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_OrROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_OrROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_OrROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_SetROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_SetROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_SetROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_SetROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_SetROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_SetROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_SetROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_SetROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_SetROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_SetROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_SetROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_SetROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_SetROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_SetROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_SetROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_SetROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_SetROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_XorROP0.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP0.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_XorROP0.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP0.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_XorROP1.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP1.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_XorROP1.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP1.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_XorROP2.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP2.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_XorROP2.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP2.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_XorROP3.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP3.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_XorROP3.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP3.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_XorROP4.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP4.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_XorROP4.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP4.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_XorROP5.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP5.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_XorROP5.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP5.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_XorROP6.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP6.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_XorROP6.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP6.png diff --git a/tests/auto/qpainter/drawPixmap_rop/res/res_XorROP7.png b/tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP7.png similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/res/res_XorROP7.png rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/res/res_XorROP7.png diff --git a/tests/auto/qpainter/drawPixmap_rop/src1.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop/src1.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/src1.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/src1.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop/src2-mask.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop/src2-mask.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/src2-mask.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/src2-mask.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop/src2.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop/src2.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/src2.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/src2.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop/src3.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop/src3.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop/src3.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop/src3.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/dst.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/dst.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/dst.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/dst.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_AndNotROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_AndNotROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_AndNotROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_AndNotROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_AndROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_AndROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_AndROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_AndROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_ClearROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_ClearROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_ClearROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_ClearROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_CopyROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_CopyROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_CopyROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_CopyROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NandROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NandROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NandROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NandROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NopROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NopROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NopROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NopROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NorROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NorROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NorROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NorROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NotAndROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NotAndROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NotAndROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NotAndROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NotCopyROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NotCopyROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NotCopyROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NotCopyROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NotOrROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NotOrROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NotOrROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NotOrROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NotROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NotROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NotROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NotROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NotXorROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NotXorROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_NotXorROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_NotXorROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_OrNotROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_OrNotROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_OrNotROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_OrNotROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_OrROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_OrROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_OrROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_OrROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_SetROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_SetROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_SetROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_SetROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_XorROP.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_XorROP.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/res/res_XorROP.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/res/res_XorROP.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/src1-mask.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/src1-mask.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/src1-mask.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/src1-mask.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/src1.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/src1.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/src1.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/src1.xbm diff --git a/tests/auto/qpainter/drawPixmap_rop_bitmap/src2.xbm b/tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/src2.xbm similarity index 100% rename from tests/auto/qpainter/drawPixmap_rop_bitmap/src2.xbm rename to tests/auto/gui/painting/qpainter/drawPixmap_rop_bitmap/src2.xbm diff --git a/tests/auto/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro similarity index 91% rename from tests/auto/qpainter/qpainter.pro rename to tests/auto/gui/painting/qpainter/qpainter.pro index f29e39afecd..00307d3e587 100644 --- a/tests/auto/qpainter/qpainter.pro +++ b/tests/auto/gui/painting/qpainter/qpainter.pro @@ -1,6 +1,6 @@ load(qttest_p4) -QT += gui-private +QT += widgets widgets-private printsupport SOURCES += tst_qpainter.cpp wince*|symbian: { diff --git a/tests/auto/qpainter/task217400.png b/tests/auto/gui/painting/qpainter/task217400.png similarity index 100% rename from tests/auto/qpainter/task217400.png rename to tests/auto/gui/painting/qpainter/task217400.png diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp similarity index 99% rename from tests/auto/qpainter/tst_qpainter.cpp rename to tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 8898a4874d6..c2c90020232 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> -#include "../../shared/util.h" +#include "../../../../shared/util.h" #include <qpainter.h> #include <qapplication.h> @@ -564,7 +564,7 @@ void tst_QPainter::qt_format_text_boundingRect() QCOMPARE(pbr, br); } #endif -#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) +#if !defined(QT_NO_PRINTER) && !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) { QPrinter printer(QPrinter::HighResolution); if (printer.printerName().isEmpty()) { diff --git a/tests/auto/qpainter/utils/createImages/createImages.pro b/tests/auto/gui/painting/qpainter/utils/createImages/createImages.pro similarity index 100% rename from tests/auto/qpainter/utils/createImages/createImages.pro rename to tests/auto/gui/painting/qpainter/utils/createImages/createImages.pro diff --git a/tests/auto/qpainter/utils/createImages/main.cpp b/tests/auto/gui/painting/qpainter/utils/createImages/main.cpp similarity index 100% rename from tests/auto/qpainter/utils/createImages/main.cpp rename to tests/auto/gui/painting/qpainter/utils/createImages/main.cpp diff --git a/tests/auto/qpainterpath/.gitignore b/tests/auto/gui/painting/qpainterpath/.gitignore similarity index 100% rename from tests/auto/qpainterpath/.gitignore rename to tests/auto/gui/painting/qpainterpath/.gitignore diff --git a/tests/auto/qpainterpath/qpainterpath.pro b/tests/auto/gui/painting/qpainterpath/qpainterpath.pro similarity index 100% rename from tests/auto/qpainterpath/qpainterpath.pro rename to tests/auto/gui/painting/qpainterpath/qpainterpath.pro diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp similarity index 100% rename from tests/auto/qpainterpath/tst_qpainterpath.cpp rename to tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp diff --git a/tests/auto/qpainterpathstroker/.gitignore b/tests/auto/gui/painting/qpainterpathstroker/.gitignore similarity index 100% rename from tests/auto/qpainterpathstroker/.gitignore rename to tests/auto/gui/painting/qpainterpathstroker/.gitignore diff --git a/tests/auto/qpainterpathstroker/qpainterpathstroker.pro b/tests/auto/gui/painting/qpainterpathstroker/qpainterpathstroker.pro similarity index 100% rename from tests/auto/qpainterpathstroker/qpainterpathstroker.pro rename to tests/auto/gui/painting/qpainterpathstroker/qpainterpathstroker.pro diff --git a/tests/auto/qpainterpathstroker/tst_qpainterpathstroker.cpp b/tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp similarity index 100% rename from tests/auto/qpainterpathstroker/tst_qpainterpathstroker.cpp rename to tests/auto/gui/painting/qpainterpathstroker/tst_qpainterpathstroker.cpp diff --git a/tests/auto/qpathclipper/.gitignore b/tests/auto/gui/painting/qpathclipper/.gitignore similarity index 100% rename from tests/auto/qpathclipper/.gitignore rename to tests/auto/gui/painting/qpathclipper/.gitignore diff --git a/tests/auto/qpathclipper/pathcompare.h b/tests/auto/gui/painting/qpathclipper/pathcompare.h similarity index 100% rename from tests/auto/qpathclipper/pathcompare.h rename to tests/auto/gui/painting/qpathclipper/pathcompare.h diff --git a/tests/auto/qpathclipper/paths.cpp b/tests/auto/gui/painting/qpathclipper/paths.cpp similarity index 100% rename from tests/auto/qpathclipper/paths.cpp rename to tests/auto/gui/painting/qpathclipper/paths.cpp diff --git a/tests/auto/qpathclipper/paths.h b/tests/auto/gui/painting/qpathclipper/paths.h similarity index 100% rename from tests/auto/qpathclipper/paths.h rename to tests/auto/gui/painting/qpathclipper/paths.h diff --git a/tests/auto/qpathclipper/qpathclipper.pro b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro similarity index 81% rename from tests/auto/qpathclipper/qpathclipper.pro rename to tests/auto/gui/painting/qpathclipper/qpathclipper.pro index 2becd7dd039..85f4a58dcd2 100644 --- a/tests/auto/qpathclipper/qpathclipper.pro +++ b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro @@ -8,4 +8,4 @@ requires(contains(QT_CONFIG,private_tests)) unix:!mac:!symbian:LIBS+=-lm - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qpathclipper/tst_qpathclipper.cpp b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp similarity index 100% rename from tests/auto/qpathclipper/tst_qpathclipper.cpp rename to tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp diff --git a/tests/auto/qpen/.gitignore b/tests/auto/gui/painting/qpen/.gitignore similarity index 100% rename from tests/auto/qpen/.gitignore rename to tests/auto/gui/painting/qpen/.gitignore diff --git a/tests/auto/qpen/qpen.pro b/tests/auto/gui/painting/qpen/qpen.pro similarity index 100% rename from tests/auto/qpen/qpen.pro rename to tests/auto/gui/painting/qpen/qpen.pro diff --git a/tests/auto/qpen/tst_qpen.cpp b/tests/auto/gui/painting/qpen/tst_qpen.cpp similarity index 100% rename from tests/auto/qpen/tst_qpen.cpp rename to tests/auto/gui/painting/qpen/tst_qpen.cpp diff --git a/tests/auto/qpolygon/.gitignore b/tests/auto/gui/painting/qpolygon/.gitignore similarity index 100% rename from tests/auto/qpolygon/.gitignore rename to tests/auto/gui/painting/qpolygon/.gitignore diff --git a/tests/auto/qpolygon/qpolygon.pro b/tests/auto/gui/painting/qpolygon/qpolygon.pro similarity index 84% rename from tests/auto/qpolygon/qpolygon.pro rename to tests/auto/gui/painting/qpolygon/qpolygon.pro index e832666d7c1..186b704d17b 100644 --- a/tests/auto/qpolygon/qpolygon.pro +++ b/tests/auto/gui/painting/qpolygon/qpolygon.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qpolygon.cpp unix:!mac:!symbian:LIBS+=-lm diff --git a/tests/auto/qpolygon/tst_qpolygon.cpp b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp similarity index 100% rename from tests/auto/qpolygon/tst_qpolygon.cpp rename to tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp diff --git a/tests/auto/qprinter/.gitignore b/tests/auto/gui/painting/qprinter/.gitignore similarity index 100% rename from tests/auto/qprinter/.gitignore rename to tests/auto/gui/painting/qprinter/.gitignore diff --git a/tests/auto/qprinter/qprinter.pro b/tests/auto/gui/painting/qprinter/qprinter.pro similarity index 52% rename from tests/auto/qprinter/qprinter.pro rename to tests/auto/gui/painting/qprinter/qprinter.pro index b412688544a..da02bdd7d6a 100644 --- a/tests/auto/qprinter/qprinter.pro +++ b/tests/auto/gui/painting/qprinter/qprinter.pro @@ -1,4 +1,6 @@ load(qttest_p4) +QT += printsupport widgets SOURCES += tst_qprinter.cpp mac*:CONFIG+=insignificant_test +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp similarity index 99% rename from tests/auto/qprinter/tst_qprinter.cpp rename to tests/auto/gui/painting/qprinter/tst_qprinter.cpp index f67f8af3bd8..a6b68959810 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/gui/painting/qprinter/tst_qprinter.cpp @@ -533,11 +533,13 @@ void tst_QPrinter::testMulitpleSets() void tst_QPrinter::changingOutputFormat() { +#if QT_VERSION < 0x050000 QPrinter p; p.setOutputFormat(QPrinter::PostScriptFormat); p.setPageSize(QPrinter::A8); p.setOutputFormat(QPrinter::PdfFormat); QCOMPARE(p.pageSize(), QPrinter::A8); +#endif } void tst_QPrinter::outputFormatFromSuffix() @@ -546,8 +548,6 @@ void tst_QPrinter::outputFormatFromSuffix() QSKIP("No printers available.", SkipAll); QPrinter p; QVERIFY(p.outputFormat() == QPrinter::NativeFormat); - p.setOutputFileName("test.ps"); - QVERIFY(p.outputFormat() == QPrinter::PostScriptFormat); p.setOutputFileName("test.pdf"); QVERIFY(p.outputFormat() == QPrinter::PdfFormat); p.setOutputFileName(QString()); @@ -647,7 +647,7 @@ void tst_QPrinter::testPageMargins() void tst_QPrinter::valuePreservation() { QPrinter::OutputFormat oldFormat = QPrinter::PdfFormat; - QPrinter::OutputFormat newFormat = QPrinter::PostScriptFormat; + QPrinter::OutputFormat newFormat = QPrinter::NativeFormat; // TODO: Correct? { QPrinter printer; diff --git a/tests/auto/qprinterinfo/.gitignore b/tests/auto/gui/painting/qprinterinfo/.gitignore similarity index 100% rename from tests/auto/qprinterinfo/.gitignore rename to tests/auto/gui/painting/qprinterinfo/.gitignore diff --git a/tests/auto/qprinterinfo/qprinterinfo.pro b/tests/auto/gui/painting/qprinterinfo/qprinterinfo.pro similarity index 55% rename from tests/auto/qprinterinfo/qprinterinfo.pro rename to tests/auto/gui/painting/qprinterinfo/qprinterinfo.pro index ade217faf3d..8c96e2dcb73 100644 --- a/tests/auto/qprinterinfo/qprinterinfo.pro +++ b/tests/auto/gui/painting/qprinterinfo/qprinterinfo.pro @@ -1,7 +1,8 @@ load(qttest_p4) SOURCES += tst_qprinterinfo.cpp -QT += network +QT += printsupport network DEFINES += QT_USE_USING_NAMESPACE +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp similarity index 100% rename from tests/auto/qprinterinfo/tst_qprinterinfo.cpp rename to tests/auto/gui/painting/qprinterinfo/tst_qprinterinfo.cpp diff --git a/tests/auto/qregion/.gitignore b/tests/auto/gui/painting/qregion/.gitignore similarity index 100% rename from tests/auto/qregion/.gitignore rename to tests/auto/gui/painting/qregion/.gitignore diff --git a/tests/auto/qregion/qregion.pro b/tests/auto/gui/painting/qregion/qregion.pro similarity index 100% rename from tests/auto/qregion/qregion.pro rename to tests/auto/gui/painting/qregion/qregion.pro diff --git a/tests/auto/qregion/tst_qregion.cpp b/tests/auto/gui/painting/qregion/tst_qregion.cpp similarity index 99% rename from tests/auto/qregion/tst_qregion.cpp rename to tests/auto/gui/painting/qregion/tst_qregion.cpp index bbc09c9b57c..58d2034e414 100644 --- a/tests/auto/qregion/tst_qregion.cpp +++ b/tests/auto/gui/painting/qregion/tst_qregion.cpp @@ -94,9 +94,6 @@ private slots: void isEmpty_data(); void isEmpty(); -#ifdef Q_OS_WIN - void handle(); -#endif #if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL) void clipRectangles(); #endif @@ -865,16 +862,6 @@ void tst_QRegion::isEmpty() QVERIFY(region.rects().isEmpty()); } -#ifdef Q_OS_WIN -void tst_QRegion::handle() -{ - QRegion r; - HRGN hrgn = r.handle(); - QRegion r2(QRect(0,0,10,10)); - hrgn = r2.handle(); -} -#endif - #if defined(Q_WS_X11) && defined(QT_BUILD_INTERNAL) void tst_QRegion::clipRectangles() { diff --git a/tests/auto/qtransform/.gitignore b/tests/auto/gui/painting/qtransform/.gitignore similarity index 100% rename from tests/auto/qtransform/.gitignore rename to tests/auto/gui/painting/qtransform/.gitignore diff --git a/tests/auto/qtransform/qtransform.pro b/tests/auto/gui/painting/qtransform/qtransform.pro similarity index 100% rename from tests/auto/qtransform/qtransform.pro rename to tests/auto/gui/painting/qtransform/qtransform.pro diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp similarity index 99% rename from tests/auto/qtransform/tst_qtransform.cpp rename to tests/auto/gui/painting/qtransform/tst_qtransform.cpp index 7a0945da965..f8319c9e130 100644 --- a/tests/auto/qtransform/tst_qtransform.cpp +++ b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp @@ -112,7 +112,7 @@ void tst_QTransform::cleanup() // No cleanup is required. } -#ifdef Q_OS_WIN32 +#if defined(Q_OS_WIN) && !defined(M_PI) #define M_PI 3.14159265897932384626433832795f #endif @@ -740,10 +740,10 @@ void tst_QTransform::inverted_data() QTest::newRow("big") << big; - QTransform small; - small.scale(1/s, 1/s); + QTransform smallTransform; + smallTransform.scale(1/s, 1/s); - QTest::newRow("small") << small; + QTest::newRow("small") << smallTransform; } void tst_QTransform::inverted() diff --git a/tests/auto/qwmatrix/.gitignore b/tests/auto/gui/painting/qwmatrix/.gitignore similarity index 100% rename from tests/auto/qwmatrix/.gitignore rename to tests/auto/gui/painting/qwmatrix/.gitignore diff --git a/tests/auto/qwmatrix/qwmatrix.pro b/tests/auto/gui/painting/qwmatrix/qwmatrix.pro similarity index 100% rename from tests/auto/qwmatrix/qwmatrix.pro rename to tests/auto/gui/painting/qwmatrix/qwmatrix.pro diff --git a/tests/auto/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp similarity index 100% rename from tests/auto/qwmatrix/tst_qwmatrix.cpp rename to tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp diff --git a/tests/auto/qabstracttextdocumentlayout/.gitignore b/tests/auto/gui/text/qabstracttextdocumentlayout/.gitignore similarity index 100% rename from tests/auto/qabstracttextdocumentlayout/.gitignore rename to tests/auto/gui/text/qabstracttextdocumentlayout/.gitignore diff --git a/tests/auto/qabstracttextdocumentlayout/qabstracttextdocumentlayout.pro b/tests/auto/gui/text/qabstracttextdocumentlayout/qabstracttextdocumentlayout.pro similarity index 94% rename from tests/auto/qabstracttextdocumentlayout/qabstracttextdocumentlayout.pro rename to tests/auto/gui/text/qabstracttextdocumentlayout/qabstracttextdocumentlayout.pro index 701b24b5b3e..22b013e37e7 100644 --- a/tests/auto/qabstracttextdocumentlayout/qabstracttextdocumentlayout.pro +++ b/tests/auto/gui/text/qabstracttextdocumentlayout/qabstracttextdocumentlayout.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qabstracttextdocumentlayout.cpp diff --git a/tests/auto/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp similarity index 100% rename from tests/auto/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp rename to tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp diff --git a/tests/auto/qcssparser/.gitignore b/tests/auto/gui/text/qcssparser/.gitignore similarity index 100% rename from tests/auto/qcssparser/.gitignore rename to tests/auto/gui/text/qcssparser/.gitignore diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/gui/text/qcssparser/qcssparser.pro similarity index 100% rename from tests/auto/qcssparser/qcssparser.pro rename to tests/auto/gui/text/qcssparser/qcssparser.pro diff --git a/tests/auto/qcssparser/testdata/scanner/comments/input b/tests/auto/gui/text/qcssparser/testdata/scanner/comments/input similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/comments/input rename to tests/auto/gui/text/qcssparser/testdata/scanner/comments/input diff --git a/tests/auto/qcssparser/testdata/scanner/comments/output b/tests/auto/gui/text/qcssparser/testdata/scanner/comments/output similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/comments/output rename to tests/auto/gui/text/qcssparser/testdata/scanner/comments/output diff --git a/tests/auto/qcssparser/testdata/scanner/comments2/input b/tests/auto/gui/text/qcssparser/testdata/scanner/comments2/input similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/comments2/input rename to tests/auto/gui/text/qcssparser/testdata/scanner/comments2/input diff --git a/tests/auto/qcssparser/testdata/scanner/comments2/output b/tests/auto/gui/text/qcssparser/testdata/scanner/comments2/output similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/comments2/output rename to tests/auto/gui/text/qcssparser/testdata/scanner/comments2/output diff --git a/tests/auto/qcssparser/testdata/scanner/comments3/input b/tests/auto/gui/text/qcssparser/testdata/scanner/comments3/input similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/comments3/input rename to tests/auto/gui/text/qcssparser/testdata/scanner/comments3/input diff --git a/tests/auto/qcssparser/testdata/scanner/comments3/output b/tests/auto/gui/text/qcssparser/testdata/scanner/comments3/output similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/comments3/output rename to tests/auto/gui/text/qcssparser/testdata/scanner/comments3/output diff --git a/tests/auto/qcssparser/testdata/scanner/comments4/input b/tests/auto/gui/text/qcssparser/testdata/scanner/comments4/input similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/comments4/input rename to tests/auto/gui/text/qcssparser/testdata/scanner/comments4/input diff --git a/tests/auto/qcssparser/testdata/scanner/comments4/output b/tests/auto/gui/text/qcssparser/testdata/scanner/comments4/output similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/comments4/output rename to tests/auto/gui/text/qcssparser/testdata/scanner/comments4/output diff --git a/tests/auto/qcssparser/testdata/scanner/quotedstring/input b/tests/auto/gui/text/qcssparser/testdata/scanner/quotedstring/input similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/quotedstring/input rename to tests/auto/gui/text/qcssparser/testdata/scanner/quotedstring/input diff --git a/tests/auto/qcssparser/testdata/scanner/quotedstring/output b/tests/auto/gui/text/qcssparser/testdata/scanner/quotedstring/output similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/quotedstring/output rename to tests/auto/gui/text/qcssparser/testdata/scanner/quotedstring/output diff --git a/tests/auto/qcssparser/testdata/scanner/simple/input b/tests/auto/gui/text/qcssparser/testdata/scanner/simple/input similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/simple/input rename to tests/auto/gui/text/qcssparser/testdata/scanner/simple/input diff --git a/tests/auto/qcssparser/testdata/scanner/simple/output b/tests/auto/gui/text/qcssparser/testdata/scanner/simple/output similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/simple/output rename to tests/auto/gui/text/qcssparser/testdata/scanner/simple/output diff --git a/tests/auto/qcssparser/testdata/scanner/unicode/input b/tests/auto/gui/text/qcssparser/testdata/scanner/unicode/input similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/unicode/input rename to tests/auto/gui/text/qcssparser/testdata/scanner/unicode/input diff --git a/tests/auto/qcssparser/testdata/scanner/unicode/output b/tests/auto/gui/text/qcssparser/testdata/scanner/unicode/output similarity index 100% rename from tests/auto/qcssparser/testdata/scanner/unicode/output rename to tests/auto/gui/text/qcssparser/testdata/scanner/unicode/output diff --git a/tests/auto/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp similarity index 100% rename from tests/auto/qcssparser/tst_qcssparser.cpp rename to tests/auto/gui/text/qcssparser/tst_qcssparser.cpp diff --git a/tests/auto/qfont/.gitignore b/tests/auto/gui/text/qfont/.gitignore similarity index 100% rename from tests/auto/qfont/.gitignore rename to tests/auto/gui/text/qfont/.gitignore diff --git a/tests/auto/qfont/qfont.pro b/tests/auto/gui/text/qfont/qfont.pro similarity index 75% rename from tests/auto/qfont/qfont.pro rename to tests/auto/gui/text/qfont/qfont.pro index b071d88dce8..891cb0a093c 100644 --- a/tests/auto/qfont/qfont.pro +++ b/tests/auto/gui/text/qfont/qfont.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qfont.cpp diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp similarity index 100% rename from tests/auto/qfont/tst_qfont.cpp rename to tests/auto/gui/text/qfont/tst_qfont.cpp diff --git a/tests/auto/qfontdatabase/.gitignore b/tests/auto/gui/text/qfontdatabase/.gitignore similarity index 100% rename from tests/auto/qfontdatabase/.gitignore rename to tests/auto/gui/text/qfontdatabase/.gitignore diff --git a/tests/auto/qfontdatabase/FreeMono.ttf b/tests/auto/gui/text/qfontdatabase/FreeMono.ttf similarity index 100% rename from tests/auto/qfontdatabase/FreeMono.ttf rename to tests/auto/gui/text/qfontdatabase/FreeMono.ttf diff --git a/tests/auto/qfontdatabase/qfontdatabase.pro b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro similarity index 100% rename from tests/auto/qfontdatabase/qfontdatabase.pro rename to tests/auto/gui/text/qfontdatabase/qfontdatabase.pro diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp similarity index 100% rename from tests/auto/qfontdatabase/tst_qfontdatabase.cpp rename to tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp diff --git a/tests/auto/qfontmetrics/.gitignore b/tests/auto/gui/text/qfontmetrics/.gitignore similarity index 100% rename from tests/auto/qfontmetrics/.gitignore rename to tests/auto/gui/text/qfontmetrics/.gitignore diff --git a/tests/auto/qfontmetrics/qfontmetrics.pro b/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro similarity index 100% rename from tests/auto/qfontmetrics/qfontmetrics.pro rename to tests/auto/gui/text/qfontmetrics/qfontmetrics.pro diff --git a/tests/auto/qfontmetrics/testfont.qrc b/tests/auto/gui/text/qfontmetrics/testfont.qrc similarity index 100% rename from tests/auto/qfontmetrics/testfont.qrc rename to tests/auto/gui/text/qfontmetrics/testfont.qrc diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp similarity index 100% rename from tests/auto/qfontmetrics/tst_qfontmetrics.cpp rename to tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp diff --git a/tests/auto/qfontmetrics/ucs4font.ttf b/tests/auto/gui/text/qfontmetrics/ucs4font.ttf similarity index 100% rename from tests/auto/qfontmetrics/ucs4font.ttf rename to tests/auto/gui/text/qfontmetrics/ucs4font.ttf diff --git a/tests/auto/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro similarity index 100% rename from tests/auto/qglyphrun/qglyphrun.pro rename to tests/auto/gui/text/qglyphrun/qglyphrun.pro diff --git a/tests/auto/qglyphrun/test.ttf b/tests/auto/gui/text/qglyphrun/test.ttf similarity index 100% rename from tests/auto/qglyphrun/test.ttf rename to tests/auto/gui/text/qglyphrun/test.ttf diff --git a/tests/auto/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp similarity index 100% rename from tests/auto/qglyphrun/tst_qglyphrun.cpp rename to tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp diff --git a/tests/auto/qrawfont/qrawfont.pro b/tests/auto/gui/text/qrawfont/qrawfont.pro similarity index 84% rename from tests/auto/qrawfont/qrawfont.pro rename to tests/auto/gui/text/qrawfont/qrawfont.pro index 1f73055b009..1c08299699b 100644 --- a/tests/auto/qrawfont/qrawfont.pro +++ b/tests/auto/gui/text/qrawfont/qrawfont.pro @@ -12,3 +12,5 @@ wince*|symbian*: { } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qrawfont/testfont.ttf b/tests/auto/gui/text/qrawfont/testfont.ttf similarity index 100% rename from tests/auto/qrawfont/testfont.ttf rename to tests/auto/gui/text/qrawfont/testfont.ttf diff --git a/tests/auto/qrawfont/testfont_bold_italic.ttf b/tests/auto/gui/text/qrawfont/testfont_bold_italic.ttf similarity index 100% rename from tests/auto/qrawfont/testfont_bold_italic.ttf rename to tests/auto/gui/text/qrawfont/testfont_bold_italic.ttf diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp similarity index 100% rename from tests/auto/qrawfont/tst_qrawfont.cpp rename to tests/auto/gui/text/qrawfont/tst_qrawfont.cpp diff --git a/tests/auto/gui/text/qstatictext/qstatictext.pro b/tests/auto/gui/text/qstatictext/qstatictext.pro new file mode 100644 index 00000000000..a8398dccf9e --- /dev/null +++ b/tests/auto/gui/text/qstatictext/qstatictext.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +QT += widgets widgets-private +QT += core core-private gui gui-private +SOURCES += tst_qstatictext.cpp + +CONFIG += insignificant_test # QTBUG-21290 - crashes on qpa, xcb diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp similarity index 99% rename from tests/auto/qstatictext/tst_qstatictext.cpp rename to tests/auto/gui/text/qstatictext/tst_qstatictext.cpp index 5d5ed3c737a..79cbd692eaf 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include <QtGui/QApplication> +#include <QtWidgets/QApplication> #include <QtGui/QPainter> #include <QtGui/QImage> @@ -55,9 +55,8 @@ class tst_QStaticText: public QObject { Q_OBJECT - -private: - bool supportsTransformations() const; +public: + tst_QStaticText() {} private slots: void initTestCase(); @@ -103,6 +102,8 @@ private slots: void textDocumentColor(); private: + bool supportsTransformations() const; + QImage const m_whiteSquare; }; diff --git a/tests/auto/qsyntaxhighlighter/.gitignore b/tests/auto/gui/text/qsyntaxhighlighter/.gitignore similarity index 100% rename from tests/auto/qsyntaxhighlighter/.gitignore rename to tests/auto/gui/text/qsyntaxhighlighter/.gitignore diff --git a/tests/auto/qsyntaxhighlighter/qsyntaxhighlighter.pro b/tests/auto/gui/text/qsyntaxhighlighter/qsyntaxhighlighter.pro similarity index 100% rename from tests/auto/qsyntaxhighlighter/qsyntaxhighlighter.pro rename to tests/auto/gui/text/qsyntaxhighlighter/qsyntaxhighlighter.pro diff --git a/tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp similarity index 100% rename from tests/auto/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp rename to tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp diff --git a/tests/auto/qtextblock/.gitignore b/tests/auto/gui/text/qtextblock/.gitignore similarity index 100% rename from tests/auto/qtextblock/.gitignore rename to tests/auto/gui/text/qtextblock/.gitignore diff --git a/tests/auto/qtextblock/qtextblock.pro b/tests/auto/gui/text/qtextblock/qtextblock.pro similarity index 73% rename from tests/auto/qtextblock/qtextblock.pro rename to tests/auto/gui/text/qtextblock/qtextblock.pro index 5558a715064..d50ef5ca787 100644 --- a/tests/auto/qtextblock/qtextblock.pro +++ b/tests/auto/gui/text/qtextblock/qtextblock.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qtextblock.cpp diff --git a/tests/auto/qtextblock/tst_qtextblock.cpp b/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp similarity index 97% rename from tests/auto/qtextblock/tst_qtextblock.cpp rename to tests/auto/gui/text/qtextblock/tst_qtextblock.cpp index 6477c50758c..b04a6f55590 100644 --- a/tests/auto/qtextblock/tst_qtextblock.cpp +++ b/tests/auto/gui/text/qtextblock/tst_qtextblock.cpp @@ -43,8 +43,9 @@ #include <QtTest/QtTest> -#define private public +#define protected public #include <qtextdocument.h> +#undef protected #include <qdebug.h> #ifndef Q_WS_WIN #include <private/qtextdocument_p.h> @@ -118,9 +119,8 @@ void tst_QTextBlock::fragmentOverBlockBoundaries() // Block separators are always a fragment of their self. Thus: // |Hello|\b|World|\b| #if !defined(Q_WS_WIN) && !defined(Q_WS_S60) - QVERIFY(doc->d_func()->fragmentMap().numNodes() == 4); + QVERIFY(doc->docHandle()->fragmentMap().numNodes() == 4); #endif - QCOMPARE(cursor.block().text(), QString("Hello")); cursor.movePosition(QTextCursor::NextBlock); QCOMPARE(cursor.block().text(), QString("World")); diff --git a/tests/auto/qtextcursor/.gitignore b/tests/auto/gui/text/qtextcursor/.gitignore similarity index 100% rename from tests/auto/qtextcursor/.gitignore rename to tests/auto/gui/text/qtextcursor/.gitignore diff --git a/tests/auto/qtextcursor/qtextcursor.pro b/tests/auto/gui/text/qtextcursor/qtextcursor.pro similarity index 100% rename from tests/auto/qtextcursor/qtextcursor.pro rename to tests/auto/gui/text/qtextcursor/qtextcursor.pro diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp similarity index 100% rename from tests/auto/qtextcursor/tst_qtextcursor.cpp rename to tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp diff --git a/tests/auto/qtextdocument/.gitignore b/tests/auto/gui/text/qtextdocument/.gitignore similarity index 100% rename from tests/auto/qtextdocument/.gitignore rename to tests/auto/gui/text/qtextdocument/.gitignore diff --git a/tests/auto/qtextdocument/common.h b/tests/auto/gui/text/qtextdocument/common.h similarity index 100% rename from tests/auto/qtextdocument/common.h rename to tests/auto/gui/text/qtextdocument/common.h diff --git a/tests/auto/qtextdocument/qtextdocument.pro b/tests/auto/gui/text/qtextdocument/qtextdocument.pro similarity index 100% rename from tests/auto/qtextdocument/qtextdocument.pro rename to tests/auto/gui/text/qtextdocument/qtextdocument.pro diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp similarity index 100% rename from tests/auto/qtextdocument/tst_qtextdocument.cpp rename to tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp diff --git a/tests/auto/qtextdocumentfragment/.gitignore b/tests/auto/gui/text/qtextdocumentfragment/.gitignore similarity index 100% rename from tests/auto/qtextdocumentfragment/.gitignore rename to tests/auto/gui/text/qtextdocumentfragment/.gitignore diff --git a/tests/auto/qtextdocumentfragment/qtextdocumentfragment.pro b/tests/auto/gui/text/qtextdocumentfragment/qtextdocumentfragment.pro similarity index 100% rename from tests/auto/qtextdocumentfragment/qtextdocumentfragment.pro rename to tests/auto/gui/text/qtextdocumentfragment/qtextdocumentfragment.pro diff --git a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp similarity index 100% rename from tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp rename to tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp diff --git a/tests/auto/qtextdocumentlayout/.gitignore b/tests/auto/gui/text/qtextdocumentlayout/.gitignore similarity index 100% rename from tests/auto/qtextdocumentlayout/.gitignore rename to tests/auto/gui/text/qtextdocumentlayout/.gitignore diff --git a/tests/auto/qtextdocumentlayout/qtextdocumentlayout.pro b/tests/auto/gui/text/qtextdocumentlayout/qtextdocumentlayout.pro similarity index 80% rename from tests/auto/qtextdocumentlayout/qtextdocumentlayout.pro rename to tests/auto/gui/text/qtextdocumentlayout/qtextdocumentlayout.pro index b2dc6a1f689..32b05ce0614 100644 --- a/tests/auto/qtextdocumentlayout/qtextdocumentlayout.pro +++ b/tests/auto/gui/text/qtextdocumentlayout/qtextdocumentlayout.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtextdocumentlayout.cpp diff --git a/tests/auto/qtextdocumentlayout/tst_qtextdocumentlayout.cpp b/tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp similarity index 100% rename from tests/auto/qtextdocumentlayout/tst_qtextdocumentlayout.cpp rename to tests/auto/gui/text/qtextdocumentlayout/tst_qtextdocumentlayout.cpp diff --git a/tests/auto/qtextformat/.gitignore b/tests/auto/gui/text/qtextformat/.gitignore similarity index 100% rename from tests/auto/qtextformat/.gitignore rename to tests/auto/gui/text/qtextformat/.gitignore diff --git a/tests/auto/qtextformat/qtextformat.pro b/tests/auto/gui/text/qtextformat/qtextformat.pro similarity index 100% rename from tests/auto/qtextformat/qtextformat.pro rename to tests/auto/gui/text/qtextformat/qtextformat.pro diff --git a/tests/auto/qtextformat/tst_qtextformat.cpp b/tests/auto/gui/text/qtextformat/tst_qtextformat.cpp similarity index 100% rename from tests/auto/qtextformat/tst_qtextformat.cpp rename to tests/auto/gui/text/qtextformat/tst_qtextformat.cpp diff --git a/tests/auto/qtextlayout/.gitignore b/tests/auto/gui/text/qtextlayout/.gitignore similarity index 100% rename from tests/auto/qtextlayout/.gitignore rename to tests/auto/gui/text/qtextlayout/.gitignore diff --git a/tests/auto/qtextlayout/qtextlayout.pro b/tests/auto/gui/text/qtextlayout/qtextlayout.pro similarity index 100% rename from tests/auto/qtextlayout/qtextlayout.pro rename to tests/auto/gui/text/qtextlayout/qtextlayout.pro diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp similarity index 100% rename from tests/auto/qtextlayout/tst_qtextlayout.cpp rename to tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp diff --git a/tests/auto/qtextlist/.gitignore b/tests/auto/gui/text/qtextlist/.gitignore similarity index 100% rename from tests/auto/qtextlist/.gitignore rename to tests/auto/gui/text/qtextlist/.gitignore diff --git a/tests/auto/qtextlist/qtextlist.pro b/tests/auto/gui/text/qtextlist/qtextlist.pro similarity index 100% rename from tests/auto/qtextlist/qtextlist.pro rename to tests/auto/gui/text/qtextlist/qtextlist.pro diff --git a/tests/auto/qtextlist/tst_qtextlist.cpp b/tests/auto/gui/text/qtextlist/tst_qtextlist.cpp similarity index 100% rename from tests/auto/qtextlist/tst_qtextlist.cpp rename to tests/auto/gui/text/qtextlist/tst_qtextlist.cpp diff --git a/tests/auto/qtextobject/.gitignore b/tests/auto/gui/text/qtextobject/.gitignore similarity index 100% rename from tests/auto/qtextobject/.gitignore rename to tests/auto/gui/text/qtextobject/.gitignore diff --git a/tests/auto/qtextobject/qtextobject.pro b/tests/auto/gui/text/qtextobject/qtextobject.pro similarity index 94% rename from tests/auto/qtextobject/qtextobject.pro rename to tests/auto/gui/text/qtextobject/qtextobject.pro index 1715fa65a33..e87a364ab61 100644 --- a/tests/auto/qtextobject/qtextobject.pro +++ b/tests/auto/gui/text/qtextobject/qtextobject.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qtextobject.cpp diff --git a/tests/auto/qtextobject/tst_qtextobject.cpp b/tests/auto/gui/text/qtextobject/tst_qtextobject.cpp similarity index 100% rename from tests/auto/qtextobject/tst_qtextobject.cpp rename to tests/auto/gui/text/qtextobject/tst_qtextobject.cpp diff --git a/tests/auto/qtextodfwriter/.gitignore b/tests/auto/gui/text/qtextodfwriter/.gitignore similarity index 100% rename from tests/auto/qtextodfwriter/.gitignore rename to tests/auto/gui/text/qtextodfwriter/.gitignore diff --git a/tests/auto/qtextodfwriter/qtextodfwriter.pro b/tests/auto/gui/text/qtextodfwriter/qtextodfwriter.pro similarity index 83% rename from tests/auto/qtextodfwriter/qtextodfwriter.pro rename to tests/auto/gui/text/qtextodfwriter/qtextodfwriter.pro index f5e2c09fa06..25bb5a5ed0e 100644 --- a/tests/auto/qtextodfwriter/qtextodfwriter.pro +++ b/tests/auto/gui/text/qtextodfwriter/qtextodfwriter.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += core-private gui-private SOURCES += tst_qtextodfwriter.cpp !symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp similarity index 100% rename from tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp rename to tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp diff --git a/tests/auto/qtextpiecetable/.gitignore b/tests/auto/gui/text/qtextpiecetable/.gitignore similarity index 100% rename from tests/auto/qtextpiecetable/.gitignore rename to tests/auto/gui/text/qtextpiecetable/.gitignore diff --git a/tests/auto/qtextpiecetable/qtextpiecetable.pro b/tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro similarity index 85% rename from tests/auto/qtextpiecetable/qtextpiecetable.pro rename to tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro index edcb0a091c6..cfbbe2bca56 100644 --- a/tests/auto/qtextpiecetable/qtextpiecetable.pro +++ b/tests/auto/gui/text/qtextpiecetable/qtextpiecetable.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qtextpiecetable.cpp HEADERS += ../qtextdocument/common.h diff --git a/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp similarity index 99% rename from tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp rename to tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp index 1717c6bea6f..ddaf84134d0 100644 --- a/tests/auto/qtextpiecetable/tst_qtextpiecetable.cpp +++ b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp @@ -42,9 +42,10 @@ #include <QtTest/QtTest> -#define private public +#define protected public #include <qtextdocument.h> +#undef protected #include <private/qtextdocument_p.h> #include <qabstracttextdocumentlayout.h> #include <qtextobject.h> @@ -124,7 +125,7 @@ tst_QTextPieceTable::tst_QTextPieceTable() void tst_QTextPieceTable::init() { doc = new QTextDocument(0); - table = doc->d_func(); + table = doc->docHandle(); blockFormatIndex = table->formatCollection()->indexForFormat(QTextBlockFormat()); charFormatIndex = table->formatCollection()->indexForFormat(QTextCharFormat()); } diff --git a/tests/auto/qtextscriptengine/.gitignore b/tests/auto/gui/text/qtextscriptengine/.gitignore similarity index 100% rename from tests/auto/qtextscriptengine/.gitignore rename to tests/auto/gui/text/qtextscriptengine/.gitignore diff --git a/tests/auto/qtextscriptengine/generate/generate.pro b/tests/auto/gui/text/qtextscriptengine/generate/generate.pro similarity index 100% rename from tests/auto/qtextscriptengine/generate/generate.pro rename to tests/auto/gui/text/qtextscriptengine/generate/generate.pro diff --git a/tests/auto/qtextscriptengine/generate/main.cpp b/tests/auto/gui/text/qtextscriptengine/generate/main.cpp similarity index 100% rename from tests/auto/qtextscriptengine/generate/main.cpp rename to tests/auto/gui/text/qtextscriptengine/generate/main.cpp diff --git a/tests/auto/qtextscriptengine/qtextscriptengine.pro b/tests/auto/gui/text/qtextscriptengine/qtextscriptengine.pro similarity index 100% rename from tests/auto/qtextscriptengine/qtextscriptengine.pro rename to tests/auto/gui/text/qtextscriptengine/qtextscriptengine.pro diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp similarity index 100% rename from tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp rename to tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp diff --git a/tests/auto/qtexttable/.gitignore b/tests/auto/gui/text/qtexttable/.gitignore similarity index 100% rename from tests/auto/qtexttable/.gitignore rename to tests/auto/gui/text/qtexttable/.gitignore diff --git a/tests/auto/qtexttable/qtexttable.pro b/tests/auto/gui/text/qtexttable/qtexttable.pro similarity index 78% rename from tests/auto/qtexttable/qtexttable.pro rename to tests/auto/gui/text/qtexttable/qtexttable.pro index 6ab64bfa943..611b706fc4e 100644 --- a/tests/auto/qtexttable/qtexttable.pro +++ b/tests/auto/gui/text/qtexttable/qtexttable.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtexttable.cpp diff --git a/tests/auto/qtexttable/tst_qtexttable.cpp b/tests/auto/gui/text/qtexttable/tst_qtexttable.cpp similarity index 100% rename from tests/auto/qtexttable/tst_qtexttable.cpp rename to tests/auto/gui/text/qtexttable/tst_qtexttable.cpp diff --git a/tests/auto/qzip/.gitignore b/tests/auto/gui/text/qzip/.gitignore similarity index 100% rename from tests/auto/qzip/.gitignore rename to tests/auto/gui/text/qzip/.gitignore diff --git a/tests/auto/qzip/qzip.pro b/tests/auto/gui/text/qzip/qzip.pro similarity index 92% rename from tests/auto/qzip/qzip.pro rename to tests/auto/gui/text/qzip/qzip.pro index 683da62e373..7631a3e93ab 100644 --- a/tests/auto/qzip/qzip.pro +++ b/tests/auto/gui/text/qzip/qzip.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += gui-private SOURCES += tst_qzip.cpp wince*|symbian: { diff --git a/tests/auto/qzip/testdata/symlink.zip b/tests/auto/gui/text/qzip/testdata/symlink.zip similarity index 100% rename from tests/auto/qzip/testdata/symlink.zip rename to tests/auto/gui/text/qzip/testdata/symlink.zip diff --git a/tests/auto/qzip/testdata/test.zip b/tests/auto/gui/text/qzip/testdata/test.zip similarity index 100% rename from tests/auto/qzip/testdata/test.zip rename to tests/auto/gui/text/qzip/testdata/test.zip diff --git a/tests/auto/qzip/tst_qzip.cpp b/tests/auto/gui/text/qzip/tst_qzip.cpp similarity index 100% rename from tests/auto/qzip/tst_qzip.cpp rename to tests/auto/gui/text/qzip/tst_qzip.cpp diff --git a/tests/auto/gui/text/text.pro b/tests/auto/gui/text/text.pro new file mode 100644 index 00000000000..5055ab61a32 --- /dev/null +++ b/tests/auto/gui/text/text.pro @@ -0,0 +1,33 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qabstracttextdocumentlayout \ + qcssparser \ + qfont \ + qfontdatabase \ + qfontmetrics \ + qglyphrun \ + qrawfont \ + qstatictext \ + qsyntaxhighlighter \ + qtextblock \ + qtextcursor \ + qtextdocument \ + qtextdocumentfragment \ + qtextdocumentlayout \ + qtextformat \ + qtextlayout \ + qtextlist \ + qtextobject \ + qtextpiecetable \ + qtextscriptengine \ + qtexttable \ + +contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter + +win32:SUBDIRS -= qtextpiecetable + +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qcssparser \ + qstatictext \ + qtextlayout \ + qtextpiecetable \ diff --git a/tests/auto/qdesktopservices/.gitignore b/tests/auto/gui/util/qdesktopservices/.gitignore similarity index 100% rename from tests/auto/qdesktopservices/.gitignore rename to tests/auto/gui/util/qdesktopservices/.gitignore diff --git a/tests/auto/qdesktopservices/qdesktopservices.pro b/tests/auto/gui/util/qdesktopservices/qdesktopservices.pro similarity index 97% rename from tests/auto/qdesktopservices/qdesktopservices.pro rename to tests/auto/gui/util/qdesktopservices/qdesktopservices.pro index 43f6cba2676..0e51ed04598 100644 --- a/tests/auto/qdesktopservices/qdesktopservices.pro +++ b/tests/auto/gui/util/qdesktopservices/qdesktopservices.pro @@ -1,4 +1,5 @@ CONFIG += qttest_p4 +QT += widgets SOURCES += tst_qdesktopservices.cpp TARGET = tst_qdesktopservices diff --git a/tests/auto/qdesktopservices/tst_qdesktopservices.cpp b/tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp similarity index 100% rename from tests/auto/qdesktopservices/tst_qdesktopservices.cpp rename to tests/auto/gui/util/qdesktopservices/tst_qdesktopservices.cpp diff --git a/tests/auto/gui/util/util.pro b/tests/auto/gui/util/util.pro new file mode 100644 index 00000000000..91313ab85eb --- /dev/null +++ b/tests/auto/gui/util/util.pro @@ -0,0 +1,4 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qdesktopservices \ + diff --git a/tests/auto/host.pro b/tests/auto/host.pro index ebe9d5661d9..045490a3526 100644 --- a/tests/auto/host.pro +++ b/tests/auto/host.pro @@ -1,12 +1,4 @@ TEMPLATE=subdirs SUBDIRS=\ - compiler \ - headersclean \ - maketestselftest \ - moc \ - uic \ - qmake \ - rcc \ - #atwrapper \ # QTBUG-19452: This test needs to be reworked or discarded #uiloader \ # QTBUG-19453: this test has hardcoded machine names etc. diff --git a/tests/auto/lancelot/lancelot.pro b/tests/auto/lancelot/lancelot.pro index 67fff1b4115..8cb6ce04051 100644 --- a/tests/auto/lancelot/lancelot.pro +++ b/tests/auto/lancelot/lancelot.pro @@ -1,5 +1,5 @@ load(qttest_p4) -QT += xml +QT += xml widgets contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl SOURCES += tst_lancelot.cpp \ @@ -11,3 +11,5 @@ include($$PWD/../../baselineserver/shared/qbaselinetest.pri) !symbian:!wince*:DEFINES += SRCDIR=\\\"$$PWD\\\" linux-g++-maemo:DEFINES += USE_RUNTIME_DIR + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 256ff29889b..79a221fa0ef 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include <paintcommands.h> +#include "paintcommands.h" #include <QPainter> #include <QLibraryInfo> #include <baselineprotocol.h> diff --git a/tests/auto/languagechange/languagechange.pro b/tests/auto/languagechange/languagechange.pro index f161c508645..c51c42ebe16 100644 --- a/tests/auto/languagechange/languagechange.pro +++ b/tests/auto/languagechange/languagechange.pro @@ -1,4 +1,5 @@ load(qttest_p4) -QT += core-private +QT += widgets core-private SOURCES += tst_languagechange.cpp +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/languagechange/tst_languagechange.cpp b/tests/auto/languagechange/tst_languagechange.cpp index 3a93209ccd9..e1663a5830d 100644 --- a/tests/auto/languagechange/tst_languagechange.cpp +++ b/tests/auto/languagechange/tst_languagechange.cpp @@ -46,10 +46,10 @@ #include <QtCore/QSet> #include <QtCore/QTranslator> #include <private/qthread_p.h> -#include <QtGui/QInputDialog> -#include <QtGui/QColorDialog> -#include <QtGui/QFileDialog> -#include <QtGui/QDesktopWidget> +#include <QtWidgets/QInputDialog> +#include <QtWidgets/QColorDialog> +#include <QtWidgets/QFileDialog> +#include <QtWidgets/QDesktopWidget> //TESTED_CLASS= diff --git a/tests/auto/macgui/macgui.pro b/tests/auto/macgui/macgui.pro index 8a57a8c54bd..3fbe74f7c8c 100644 --- a/tests/auto/macgui/macgui.pro +++ b/tests/auto/macgui/macgui.pro @@ -7,7 +7,7 @@ INCLUDEPATH += . SOURCES += tst_macgui.cpp guitest.cpp HEADERS += guitest.h -QT = core-private gui-private +QT = core-private gui-private widgets requires(mac) diff --git a/tests/auto/macnativeevents/macnativeevents.pro b/tests/auto/macnativeevents/macnativeevents.pro index af34942b128..0a0f6c8743a 100644 --- a/tests/auto/macnativeevents/macnativeevents.pro +++ b/tests/auto/macnativeevents/macnativeevents.pro @@ -7,7 +7,7 @@ TEMPLATE = app DEPENDPATH += . INCLUDEPATH += . LIBS += -framework Carbon - +QT += widgets HEADERS += qnativeevents.h nativeeventlist.h expectedeventlist.h SOURCES += qnativeevents.cpp qnativeevents_mac.cpp SOURCES += expectedeventlist.cpp nativeeventlist.cpp diff --git a/tests/auto/modeltest/modeltest.pro b/tests/auto/modeltest/modeltest.pro index f157da0cee3..d4a8ba971d8 100644 --- a/tests/auto/modeltest/modeltest.pro +++ b/tests/auto/modeltest/modeltest.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_modeltest.cpp modeltest.cpp dynamictreemodel.cpp HEADERS += modeltest.h dynamictreemodel.h diff --git a/tests/auto/nativeimagehandleprovider/nativeimagehandleprovider.pro b/tests/auto/nativeimagehandleprovider/nativeimagehandleprovider.pro deleted file mode 100644 index 70ea53c3692..00000000000 --- a/tests/auto/nativeimagehandleprovider/nativeimagehandleprovider.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) - -QT += gui-private - -SOURCES += tst_nativeimagehandleprovider.cpp -symbian { - LIBS += -lfbscli -lbitgdi - contains(QT_CONFIG, openvg): QT *= openvg -} diff --git a/tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp b/tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp deleted file mode 100644 index 3d198c7b123..00000000000 --- a/tests/auto/nativeimagehandleprovider/tst_nativeimagehandleprovider.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include <QtTest/QtTest> -#include <QtGui/private/qpixmapdata_p.h> -#include <QtGui/private/qnativeimagehandleprovider_p.h> -#include <QScopedPointer> -#include <QPixmap> -#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) -#include <fbs.h> -#include <bitdev.h> -#include <QtOpenVG/private/qpixmapdata_vg_p.h> -#endif - -QPixmap pixmapFromNativeImageHandleProvider(QNativeImageHandleProvider *source) -{ -#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) - if (!source) - return QPixmap(); - QScopedPointer<QPixmapData> pd(QPixmapData::create(0, 0, QPixmapData::PixmapType)); - pd->fromNativeType(source, QPixmapData::NativeImageHandleProvider); - return QPixmap(pd.take()); -#else - Q_UNUSED(source); - return QPixmap(); -#endif -} - -class DummyProvider : public QNativeImageHandleProvider -{ -public: - void get(void **handle, QString *type); - void release(void *handle, const QString &type); -}; - -void DummyProvider::get(void **handle, QString *type) -{ - *handle = (void *) 0x12345678; - *type = "some dummy type"; -} - -void DummyProvider::release(void *handle, const QString &type) -{ - Q_UNUSED(handle); - Q_UNUSED(type); -} - -#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) -class BitmapProvider : public QNativeImageHandleProvider -{ -public: - BitmapProvider() : bmp(0), refCount(0), w(50), h(60) { } - void get(void **handle, QString *type); - void release(void *handle, const QString &type); - - CFbsBitmap *bmp; - int refCount, w, h; - void *returnedHandle; - QString returnedType; -}; - -void BitmapProvider::get(void **handle, QString *type) -{ - // There may not be a release() if the get() fails so don't bother with - // refcounting in such cases. - if (bmp) - ++refCount; - returnedType = QLatin1String("CFbsBitmap"); - returnedHandle = bmp; - *handle = returnedHandle; - *type = returnedType; -} - -void BitmapProvider::release(void *handle, const QString &type) -{ - if (handle == returnedHandle && type == returnedType && returnedHandle) { - --refCount; - } -} -#endif // symbian & openvg - -class tst_NativeImageHandleProvider : public QObject -{ - Q_OBJECT - -public: - tst_NativeImageHandleProvider() { } - -private slots: - void create(); - void bitmap(); - void hibernate(); -}; - -void tst_NativeImageHandleProvider::create() -{ - QPixmap pm = pixmapFromNativeImageHandleProvider(0); - QVERIFY(pm.isNull()); - QPixmap tmp(10, 20); - if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { - // Verify that null pixmap is properly returned when get() provides bogus results. - DummyProvider prov; - pm = pixmapFromNativeImageHandleProvider(&prov); - QVERIFY(pm.isNull()); - pm = QPixmap(); - } else { - QSKIP("Not openvg, skipping non-trivial tests", SkipSingle); - } -} - -void tst_NativeImageHandleProvider::bitmap() -{ -#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) - QPixmap tmp(10, 20); - if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { - BitmapProvider prov; - - // This should fail because of null ptr. - QPixmap pm = pixmapFromNativeImageHandleProvider(&prov); - QVERIFY(pm.isNull()); - pm = QPixmap(); - QCOMPARE(prov.refCount, 0); - - prov.bmp = new CFbsBitmap; - QCOMPARE(prov.bmp->Create(TSize(prov.w, prov.h), EColor16MAP), KErrNone); - CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(prov.bmp); - CBitmapContext *bitmapContext = 0; - QCOMPARE(bitmapDevice->CreateBitmapContext(bitmapContext), KErrNone); - TRgb symbianColor = TRgb(255, 200, 100); - bitmapContext->SetBrushColor(symbianColor); - bitmapContext->Clear(); - delete bitmapContext; - delete bitmapDevice; - - pm = pixmapFromNativeImageHandleProvider(&prov); - QVERIFY(!pm.isNull()); - QCOMPARE(pm.width(), prov.w); - QCOMPARE(pm.height(), prov.h); - QVERIFY(prov.refCount == 1); - QImage img = pm.toImage(); - QVERIFY(prov.refCount == 1); - QRgb pix = img.pixel(QPoint(1, 2)); - QCOMPARE(qRed(pix), symbianColor.Red()); - QCOMPARE(qGreen(pix), symbianColor.Green()); - QCOMPARE(qBlue(pix), symbianColor.Blue()); - - pm = QPixmap(); // should result in calling release - QCOMPARE(prov.refCount, 0); - delete prov.bmp; - } else { - QSKIP("Not openvg", SkipSingle); - } -#else - QSKIP("Not applicable", SkipSingle); -#endif -} - -void tst_NativeImageHandleProvider::hibernate() -{ -#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_OPENVG) - QPixmap tmp(10, 20); - if (tmp.pixmapData()->classId() == QPixmapData::OpenVGClass) { - BitmapProvider prov; - prov.bmp = new CFbsBitmap; - QCOMPARE(prov.bmp->Create(TSize(prov.w, prov.h), EColor16MAP), KErrNone); - - QPixmap pm = pixmapFromNativeImageHandleProvider(&prov); - QCOMPARE(prov.refCount, 1); - - QVGPixmapData *vgpd = static_cast<QVGPixmapData *>(pm.pixmapData()); - vgpd->hibernate(); - QCOMPARE(prov.refCount, 0); - - // Calling toVGImage() may cause some warnings as we don't have a gui initialized, - // but the only thing we care about here is get() being called. - vgpd->toVGImage(); - QCOMPARE(prov.refCount, 1); - - pm = QPixmap(); - QCOMPARE(prov.refCount, 0); - delete prov.bmp; - } else { - QSKIP("Not openvg", SkipSingle); - } -#else - QSKIP("Not applicable", SkipSingle); -#endif -} - -int main(int argc, char *argv[]) -{ - QApplication::setGraphicsSystem("openvg"); - QApplication app(argc, argv); - tst_NativeImageHandleProvider tc; - return QTest::qExec(&tc, argc, argv); -} - -#include "tst_nativeimagehandleprovider.moc" diff --git a/tests/auto/network.pro b/tests/auto/network.pro index f8dd4123df0..21388bc2811 100644 --- a/tests/auto/network.pro +++ b/tests/auto/network.pro @@ -4,57 +4,6 @@ # been compiled. TEMPLATE=subdirs SUBDIRS=\ + network \ networkselftest \ - qabstractnetworkcache \ - qabstractsocket \ - qauthenticator \ - qeventloop \ - qftp \ - qhostaddress \ - qhostinfo \ - qhttp \ - qhttpnetworkconnection \ - qhttpnetworkreply \ - qhttpsocketengine \ - platformsocketengine \ - qnetworkaccessmanager \ - qnetworkaddressentry \ - qnetworkcachemetadata \ - qnetworkconfiguration \ - qnetworkconfigurationmanager \ - qnetworkcookie \ - qnetworkcookiejar \ - qnetworkdiskcache \ - qnetworkinterface \ - qnetworkproxy \ - qnetworkreply \ - qnetworkrequest \ - qnetworksession \ - qobjectperformance \ - qsocketnotifier \ - qsocks5socketengine \ - qsslcertificate \ - qsslcipher \ - qsslerror \ - qsslkey \ - qsslsocket \ - qsslsocket_onDemandCertificates_member \ - qsslsocket_onDemandCertificates_static \ - qtcpserver \ - qudpsocket \ -# qnetworkproxyfactory \ # Uses a hardcoded proxy configuration - -!contains(QT_CONFIG, private_tests): SUBDIRS -= \ - platformsocketengine \ - qauthenticator \ - qhostinfo \ - qhttpnetworkconnection \ - qhttpnetworkreply \ - qhttpsocketengine \ - qnetworkreply \ - qsocketnotifier \ - qsocks5socketengine \ - qsslsocket \ - qsslsocket_onDemandCertificates_member \ - qsslsocket_onDemandCertificates_static \ - + qobjectperformance diff --git a/tests/auto/network/access/access.pro b/tests/auto/network/access/access.pro new file mode 100644 index 00000000000..53b16f07b82 --- /dev/null +++ b/tests/auto/network/access/access.pro @@ -0,0 +1,20 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qnetworkdiskcache \ + qnetworkcookiejar \ + qnetworkaccessmanager \ + qnetworkcookie \ + qnetworkrequest \ + qhttpnetworkconnection \ + qnetworkreply \ + qnetworkcachemetadata \ + qftp \ + qhttpnetworkreply \ + qhttp \ + qabstractnetworkcache \ + +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qhttpnetworkconnection \ + qhttpnetworkreply \ + + diff --git a/tests/auto/qabstractnetworkcache/.gitignore b/tests/auto/network/access/qabstractnetworkcache/.gitignore similarity index 100% rename from tests/auto/qabstractnetworkcache/.gitignore rename to tests/auto/network/access/qabstractnetworkcache/.gitignore diff --git a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro similarity index 100% rename from tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro rename to tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi b/tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi similarity index 100% rename from tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi rename to tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_cachecontrol-expire.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi b/tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi similarity index 100% rename from tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi rename to tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_cachecontrol.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi b/tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi similarity index 100% rename from tests/auto/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi rename to tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_cachecontrol200.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag200.cgi b/tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_etag200.cgi similarity index 100% rename from tests/auto/qabstractnetworkcache/tests/httpcachetest_etag200.cgi rename to tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_etag200.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_etag304.cgi b/tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_etag304.cgi similarity index 100% rename from tests/auto/qabstractnetworkcache/tests/httpcachetest_etag304.cgi rename to tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_etag304.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires200.cgi b/tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_expires200.cgi similarity index 100% rename from tests/auto/qabstractnetworkcache/tests/httpcachetest_expires200.cgi rename to tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_expires200.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires304.cgi b/tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_expires304.cgi similarity index 100% rename from tests/auto/qabstractnetworkcache/tests/httpcachetest_expires304.cgi rename to tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_expires304.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_expires500.cgi b/tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_expires500.cgi similarity index 100% rename from tests/auto/qabstractnetworkcache/tests/httpcachetest_expires500.cgi rename to tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_expires500.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi b/tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi similarity index 100% rename from tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi rename to tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_lastModified200.cgi diff --git a/tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi b/tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi similarity index 100% rename from tests/auto/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi rename to tests/auto/network/access/qabstractnetworkcache/tests/httpcachetest_lastModified304.cgi diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp similarity index 99% rename from tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp rename to tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index 3508ccf5c13..244c9b13b5c 100644 --- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -42,8 +42,8 @@ #include <QtTest/QtTest> #include <QtNetwork/QtNetwork> -#include "../../shared/util.h" -#include "../network-settings.h" +#include "../../../../shared/util.h" +#include "../../../network-settings.h" #ifndef QT_NO_BEARERMANAGEMENT #include <QtNetwork/qnetworkconfigmanager.h> diff --git a/tests/auto/qftp/.gitattributes b/tests/auto/network/access/qftp/.gitattributes similarity index 100% rename from tests/auto/qftp/.gitattributes rename to tests/auto/network/access/qftp/.gitattributes diff --git a/tests/auto/qftp/.gitignore b/tests/auto/network/access/qftp/.gitignore similarity index 100% rename from tests/auto/qftp/.gitignore rename to tests/auto/network/access/qftp/.gitignore diff --git a/tests/auto/qftp/qftp.pro b/tests/auto/network/access/qftp/qftp.pro similarity index 100% rename from tests/auto/qftp/qftp.pro rename to tests/auto/network/access/qftp/qftp.pro diff --git a/tests/auto/qftp/rfc3252.txt b/tests/auto/network/access/qftp/rfc3252.txt similarity index 100% rename from tests/auto/qftp/rfc3252.txt rename to tests/auto/network/access/qftp/rfc3252.txt diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp similarity index 99% rename from tests/auto/qftp/tst_qftp.cpp rename to tests/auto/network/access/qftp/tst_qftp.cpp index e31b5acda31..117ac92ed7f 100644 --- a/tests/auto/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -55,7 +55,7 @@ #include <QNetworkSession> #include <QtNetwork/private/qnetworksession_p.h> -#include "../network-settings.h" +#include "../../../network-settings.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qhttp/.gitattributes b/tests/auto/network/access/qhttp/.gitattributes similarity index 100% rename from tests/auto/qhttp/.gitattributes rename to tests/auto/network/access/qhttp/.gitattributes diff --git a/tests/auto/qhttp/.gitignore b/tests/auto/network/access/qhttp/.gitignore similarity index 100% rename from tests/auto/qhttp/.gitignore rename to tests/auto/network/access/qhttp/.gitignore diff --git a/tests/auto/qhttp/dummyserver.h b/tests/auto/network/access/qhttp/dummyserver.h similarity index 100% rename from tests/auto/qhttp/dummyserver.h rename to tests/auto/network/access/qhttp/dummyserver.h diff --git a/tests/auto/qhttp/qhttp.pro b/tests/auto/network/access/qhttp/qhttp.pro similarity index 100% rename from tests/auto/qhttp/qhttp.pro rename to tests/auto/network/access/qhttp/qhttp.pro diff --git a/tests/auto/qhttp/rfc3252.txt b/tests/auto/network/access/qhttp/rfc3252.txt similarity index 100% rename from tests/auto/qhttp/rfc3252.txt rename to tests/auto/network/access/qhttp/rfc3252.txt diff --git a/tests/auto/qhttp/trolltech b/tests/auto/network/access/qhttp/trolltech similarity index 100% rename from tests/auto/qhttp/trolltech rename to tests/auto/network/access/qhttp/trolltech diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/network/access/qhttp/tst_qhttp.cpp similarity index 99% rename from tests/auto/qhttp/tst_qhttp.cpp rename to tests/auto/network/access/qhttp/tst_qhttp.cpp index 2af81958d15..88752327144 100644 --- a/tests/auto/qhttp/tst_qhttp.cpp +++ b/tests/auto/network/access/qhttp/tst_qhttp.cpp @@ -57,7 +57,7 @@ # include <qsslsocket.h> #endif -#include "../network-settings.h" +#include "../../../network-settings.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qhttp/webserver/cgi-bin/retrieve_testfile.cgi b/tests/auto/network/access/qhttp/webserver/cgi-bin/retrieve_testfile.cgi similarity index 100% rename from tests/auto/qhttp/webserver/cgi-bin/retrieve_testfile.cgi rename to tests/auto/network/access/qhttp/webserver/cgi-bin/retrieve_testfile.cgi diff --git a/tests/auto/qhttp/webserver/cgi-bin/rfc.cgi b/tests/auto/network/access/qhttp/webserver/cgi-bin/rfc.cgi similarity index 100% rename from tests/auto/qhttp/webserver/cgi-bin/rfc.cgi rename to tests/auto/network/access/qhttp/webserver/cgi-bin/rfc.cgi diff --git a/tests/auto/qhttp/webserver/cgi-bin/store_testfile.cgi b/tests/auto/network/access/qhttp/webserver/cgi-bin/store_testfile.cgi similarity index 100% rename from tests/auto/qhttp/webserver/cgi-bin/store_testfile.cgi rename to tests/auto/network/access/qhttp/webserver/cgi-bin/store_testfile.cgi diff --git a/tests/auto/qhttp/webserver/index.html b/tests/auto/network/access/qhttp/webserver/index.html similarity index 100% rename from tests/auto/qhttp/webserver/index.html rename to tests/auto/network/access/qhttp/webserver/index.html diff --git a/tests/auto/qhttp/webserver/rfc3252 b/tests/auto/network/access/qhttp/webserver/rfc3252 similarity index 100% rename from tests/auto/qhttp/webserver/rfc3252 rename to tests/auto/network/access/qhttp/webserver/rfc3252 diff --git a/tests/auto/qhttp/webserver/rfc3252.txt b/tests/auto/network/access/qhttp/webserver/rfc3252.txt similarity index 100% rename from tests/auto/qhttp/webserver/rfc3252.txt rename to tests/auto/network/access/qhttp/webserver/rfc3252.txt diff --git a/tests/auto/qhttpnetworkconnection/.gitignore b/tests/auto/network/access/qhttpnetworkconnection/.gitignore similarity index 100% rename from tests/auto/qhttpnetworkconnection/.gitignore rename to tests/auto/network/access/qhttpnetworkconnection/.gitignore diff --git a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro similarity index 100% rename from tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro rename to tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp similarity index 99% rename from tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp rename to tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp index ceb0a074da1..2d30f6bca14 100644 --- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp +++ b/tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp @@ -45,7 +45,7 @@ #include "private/qnoncontiguousbytedevice_p.h" #include <QAuthenticator> -#include "../network-settings.h" +#include "../../../network-settings.h" class tst_QHttpNetworkConnection: public QObject { diff --git a/tests/auto/qhttpnetworkreply/.gitignore b/tests/auto/network/access/qhttpnetworkreply/.gitignore similarity index 100% rename from tests/auto/qhttpnetworkreply/.gitignore rename to tests/auto/network/access/qhttpnetworkreply/.gitignore diff --git a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro b/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro similarity index 100% rename from tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro rename to tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro diff --git a/tests/auto/qhttpnetworkreply/tst_qhttpnetworkreply.cpp b/tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp similarity index 100% rename from tests/auto/qhttpnetworkreply/tst_qhttpnetworkreply.cpp rename to tests/auto/network/access/qhttpnetworkreply/tst_qhttpnetworkreply.cpp diff --git a/tests/auto/qnetworkaccessmanager/qnetworkaccessmanager.pro b/tests/auto/network/access/qnetworkaccessmanager/qnetworkaccessmanager.pro similarity index 100% rename from tests/auto/qnetworkaccessmanager/qnetworkaccessmanager.pro rename to tests/auto/network/access/qnetworkaccessmanager/qnetworkaccessmanager.pro diff --git a/tests/auto/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp b/tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp similarity index 100% rename from tests/auto/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp rename to tests/auto/network/access/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp diff --git a/tests/auto/qnetworkcachemetadata/.gitignore b/tests/auto/network/access/qnetworkcachemetadata/.gitignore similarity index 100% rename from tests/auto/qnetworkcachemetadata/.gitignore rename to tests/auto/network/access/qnetworkcachemetadata/.gitignore diff --git a/tests/auto/qnetworkcachemetadata/qnetworkcachemetadata.pro b/tests/auto/network/access/qnetworkcachemetadata/qnetworkcachemetadata.pro similarity index 100% rename from tests/auto/qnetworkcachemetadata/qnetworkcachemetadata.pro rename to tests/auto/network/access/qnetworkcachemetadata/qnetworkcachemetadata.pro diff --git a/tests/auto/qnetworkcachemetadata/tst_qnetworkcachemetadata.cpp b/tests/auto/network/access/qnetworkcachemetadata/tst_qnetworkcachemetadata.cpp similarity index 100% rename from tests/auto/qnetworkcachemetadata/tst_qnetworkcachemetadata.cpp rename to tests/auto/network/access/qnetworkcachemetadata/tst_qnetworkcachemetadata.cpp diff --git a/tests/auto/qnetworkcookie/.gitignore b/tests/auto/network/access/qnetworkcookie/.gitignore similarity index 100% rename from tests/auto/qnetworkcookie/.gitignore rename to tests/auto/network/access/qnetworkcookie/.gitignore diff --git a/tests/auto/qnetworkcookie/qnetworkcookie.pro b/tests/auto/network/access/qnetworkcookie/qnetworkcookie.pro similarity index 100% rename from tests/auto/qnetworkcookie/qnetworkcookie.pro rename to tests/auto/network/access/qnetworkcookie/qnetworkcookie.pro diff --git a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp similarity index 100% rename from tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp rename to tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp diff --git a/tests/auto/qnetworkcookiejar/.gitignore b/tests/auto/network/access/qnetworkcookiejar/.gitignore similarity index 100% rename from tests/auto/qnetworkcookiejar/.gitignore rename to tests/auto/network/access/qnetworkcookiejar/.gitignore diff --git a/tests/auto/qnetworkcookiejar/qnetworkcookiejar.pro b/tests/auto/network/access/qnetworkcookiejar/qnetworkcookiejar.pro similarity index 100% rename from tests/auto/qnetworkcookiejar/qnetworkcookiejar.pro rename to tests/auto/network/access/qnetworkcookiejar/qnetworkcookiejar.pro diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp similarity index 100% rename from tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp rename to tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp diff --git a/tests/auto/qnetworkdiskcache/.gitignore b/tests/auto/network/access/qnetworkdiskcache/.gitignore similarity index 100% rename from tests/auto/qnetworkdiskcache/.gitignore rename to tests/auto/network/access/qnetworkdiskcache/.gitignore diff --git a/tests/auto/qnetworkdiskcache/qnetworkdiskcache.pro b/tests/auto/network/access/qnetworkdiskcache/qnetworkdiskcache.pro similarity index 100% rename from tests/auto/qnetworkdiskcache/qnetworkdiskcache.pro rename to tests/auto/network/access/qnetworkdiskcache/qnetworkdiskcache.pro diff --git a/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp similarity index 99% rename from tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp rename to tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index 224d1cbb597..030eae60a01 100644 --- a/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -43,7 +43,7 @@ #include <QtTest/QtTest> #include <QtNetwork/QtNetwork> #include <qnetworkdiskcache.h> -#include "../../shared/util.h" +#include "../../../../shared/util.h" #define EXAMPLE_URL "http://user:pass@www.example.com/#foo" //cached objects are organized into these many subdirs diff --git a/tests/auto/qnetworkreply/.gitattributes b/tests/auto/network/access/qnetworkreply/.gitattributes similarity index 100% rename from tests/auto/qnetworkreply/.gitattributes rename to tests/auto/network/access/qnetworkreply/.gitattributes diff --git a/tests/auto/qnetworkreply/.gitignore b/tests/auto/network/access/qnetworkreply/.gitignore similarity index 100% rename from tests/auto/qnetworkreply/.gitignore rename to tests/auto/network/access/qnetworkreply/.gitignore diff --git a/tests/auto/qnetworkreply/bigfile b/tests/auto/network/access/qnetworkreply/bigfile similarity index 100% rename from tests/auto/qnetworkreply/bigfile rename to tests/auto/network/access/qnetworkreply/bigfile diff --git a/tests/auto/qnetworkreply/certs/aspiriniks.ca.crt b/tests/auto/network/access/qnetworkreply/certs/aspiriniks.ca.crt similarity index 100% rename from tests/auto/qnetworkreply/certs/aspiriniks.ca.crt rename to tests/auto/network/access/qnetworkreply/certs/aspiriniks.ca.crt diff --git a/tests/auto/qnetworkreply/certs/fluke.cert b/tests/auto/network/access/qnetworkreply/certs/fluke.cert similarity index 100% rename from tests/auto/qnetworkreply/certs/fluke.cert rename to tests/auto/network/access/qnetworkreply/certs/fluke.cert diff --git a/tests/auto/qnetworkreply/certs/fluke.key b/tests/auto/network/access/qnetworkreply/certs/fluke.key similarity index 100% rename from tests/auto/qnetworkreply/certs/fluke.key rename to tests/auto/network/access/qnetworkreply/certs/fluke.key diff --git a/tests/auto/qnetworkreply/certs/qt-test-server-cacert.pem b/tests/auto/network/access/qnetworkreply/certs/qt-test-server-cacert.pem similarity index 100% rename from tests/auto/qnetworkreply/certs/qt-test-server-cacert.pem rename to tests/auto/network/access/qnetworkreply/certs/qt-test-server-cacert.pem diff --git a/tests/auto/qnetworkreply/certs/server.key b/tests/auto/network/access/qnetworkreply/certs/server.key similarity index 100% rename from tests/auto/qnetworkreply/certs/server.key rename to tests/auto/network/access/qnetworkreply/certs/server.key diff --git a/tests/auto/qnetworkreply/certs/server.pem b/tests/auto/network/access/qnetworkreply/certs/server.pem similarity index 100% rename from tests/auto/qnetworkreply/certs/server.pem rename to tests/auto/network/access/qnetworkreply/certs/server.pem diff --git a/tests/auto/qnetworkreply/echo/echo.pro b/tests/auto/network/access/qnetworkreply/echo/echo.pro similarity index 100% rename from tests/auto/qnetworkreply/echo/echo.pro rename to tests/auto/network/access/qnetworkreply/echo/echo.pro diff --git a/tests/auto/qnetworkreply/echo/main.cpp b/tests/auto/network/access/qnetworkreply/echo/main.cpp similarity index 100% rename from tests/auto/qnetworkreply/echo/main.cpp rename to tests/auto/network/access/qnetworkreply/echo/main.cpp diff --git a/tests/auto/qnetworkreply/empty b/tests/auto/network/access/qnetworkreply/empty similarity index 100% rename from tests/auto/qnetworkreply/empty rename to tests/auto/network/access/qnetworkreply/empty diff --git a/tests/auto/qnetworkreply/image1.jpg b/tests/auto/network/access/qnetworkreply/image1.jpg similarity index 100% rename from tests/auto/qnetworkreply/image1.jpg rename to tests/auto/network/access/qnetworkreply/image1.jpg diff --git a/tests/auto/qnetworkreply/image2.jpg b/tests/auto/network/access/qnetworkreply/image2.jpg similarity index 100% rename from tests/auto/qnetworkreply/image2.jpg rename to tests/auto/network/access/qnetworkreply/image2.jpg diff --git a/tests/auto/qnetworkreply/image3.jpg b/tests/auto/network/access/qnetworkreply/image3.jpg similarity index 100% rename from tests/auto/qnetworkreply/image3.jpg rename to tests/auto/network/access/qnetworkreply/image3.jpg diff --git a/tests/auto/qnetworkreply/qnetworkreply.pro b/tests/auto/network/access/qnetworkreply/qnetworkreply.pro similarity index 100% rename from tests/auto/qnetworkreply/qnetworkreply.pro rename to tests/auto/network/access/qnetworkreply/qnetworkreply.pro diff --git a/tests/auto/qnetworkreply/qnetworkreply.qrc b/tests/auto/network/access/qnetworkreply/qnetworkreply.qrc similarity index 100% rename from tests/auto/qnetworkreply/qnetworkreply.qrc rename to tests/auto/network/access/qnetworkreply/qnetworkreply.qrc diff --git a/tests/auto/qnetworkreply/resource b/tests/auto/network/access/qnetworkreply/resource similarity index 100% rename from tests/auto/qnetworkreply/resource rename to tests/auto/network/access/qnetworkreply/resource diff --git a/tests/auto/qnetworkreply/rfc3252.txt b/tests/auto/network/access/qnetworkreply/rfc3252.txt similarity index 100% rename from tests/auto/qnetworkreply/rfc3252.txt rename to tests/auto/network/access/qnetworkreply/rfc3252.txt diff --git a/tests/auto/qnetworkreply/smb-file.txt b/tests/auto/network/access/qnetworkreply/smb-file.txt similarity index 100% rename from tests/auto/qnetworkreply/smb-file.txt rename to tests/auto/network/access/qnetworkreply/smb-file.txt diff --git a/tests/auto/qnetworkreply/test/test.pro b/tests/auto/network/access/qnetworkreply/test/test.pro similarity index 100% rename from tests/auto/qnetworkreply/test/test.pro rename to tests/auto/network/access/qnetworkreply/test/test.pro diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp similarity index 99% rename from tests/auto/qnetworkreply/tst_qnetworkreply.cpp rename to tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 1ae76899df8..dd9fe8ee82c 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -81,7 +81,7 @@ #define SRCDIR "." #endif -#include "../network-settings.h" +#include "../../../network-settings.h" Q_DECLARE_METATYPE(QSharedPointer<char>) Q_DECLARE_METATYPE(QNetworkReply*) diff --git a/tests/auto/qnetworkrequest/.gitignore b/tests/auto/network/access/qnetworkrequest/.gitignore similarity index 100% rename from tests/auto/qnetworkrequest/.gitignore rename to tests/auto/network/access/qnetworkrequest/.gitignore diff --git a/tests/auto/qnetworkrequest/qnetworkrequest.pro b/tests/auto/network/access/qnetworkrequest/qnetworkrequest.pro similarity index 100% rename from tests/auto/qnetworkrequest/qnetworkrequest.pro rename to tests/auto/network/access/qnetworkrequest/qnetworkrequest.pro diff --git a/tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp b/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp similarity index 100% rename from tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp rename to tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp diff --git a/tests/auto/network/bearer/bearer.pro b/tests/auto/network/bearer/bearer.pro new file mode 100644 index 00000000000..872a818e4ca --- /dev/null +++ b/tests/auto/network/bearer/bearer.pro @@ -0,0 +1,6 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qnetworkconfiguration \ + qnetworkconfigurationmanager \ + qnetworksession \ + diff --git a/tests/auto/qbearertestcommon.h b/tests/auto/network/bearer/qbearertestcommon.h similarity index 100% rename from tests/auto/qbearertestcommon.h rename to tests/auto/network/bearer/qbearertestcommon.h diff --git a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro b/tests/auto/network/bearer/qnetworkconfiguration/qnetworkconfiguration.pro similarity index 100% rename from tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro rename to tests/auto/network/bearer/qnetworkconfiguration/qnetworkconfiguration.pro diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp similarity index 100% rename from tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp rename to tests/auto/network/bearer/qnetworkconfiguration/tst_qnetworkconfiguration.cpp diff --git a/tests/auto/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro b/tests/auto/network/bearer/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro similarity index 100% rename from tests/auto/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro rename to tests/auto/network/bearer/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro diff --git a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp similarity index 100% rename from tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp rename to tests/auto/network/bearer/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp diff --git a/tests/auto/qnetworksession/lackey/lackey.pro b/tests/auto/network/bearer/qnetworksession/lackey/lackey.pro similarity index 100% rename from tests/auto/qnetworksession/lackey/lackey.pro rename to tests/auto/network/bearer/qnetworksession/lackey/lackey.pro diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/network/bearer/qnetworksession/lackey/main.cpp similarity index 100% rename from tests/auto/qnetworksession/lackey/main.cpp rename to tests/auto/network/bearer/qnetworksession/lackey/main.cpp diff --git a/tests/auto/qnetworksession/qnetworksession.pro b/tests/auto/network/bearer/qnetworksession/qnetworksession.pro similarity index 100% rename from tests/auto/qnetworksession/qnetworksession.pro rename to tests/auto/network/bearer/qnetworksession/qnetworksession.pro diff --git a/tests/auto/qnetworksession/test/test.pro b/tests/auto/network/bearer/qnetworksession/test/test.pro similarity index 91% rename from tests/auto/qnetworksession/test/test.pro rename to tests/auto/network/bearer/qnetworksession/test/test.pro index bfffe907ec5..fff5770721c 100644 --- a/tests/auto/qnetworksession/test/test.pro +++ b/tests/auto/network/bearer/qnetworksession/test/test.pro @@ -24,3 +24,5 @@ maemo6|maemo5 { PKGCONFIG += conninet } + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp similarity index 100% rename from tests/auto/qnetworksession/test/tst_qnetworksession.cpp rename to tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp diff --git a/tests/auto/network/kernel/kernel.pro b/tests/auto/network/kernel/kernel.pro new file mode 100644 index 00000000000..d1c901d5293 --- /dev/null +++ b/tests/auto/network/kernel/kernel.pro @@ -0,0 +1,14 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qhostinfo \ +# qnetworkproxyfactory \ # Uses a hardcoded proxy configuration + qauthenticator \ + qnetworkproxy \ + qnetworkinterface \ + qnetworkaddressentry \ + qhostaddress \ + +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qauthenticator \ + qhostinfo \ + diff --git a/tests/auto/qauthenticator/qauthenticator.pro b/tests/auto/network/kernel/qauthenticator/qauthenticator.pro similarity index 100% rename from tests/auto/qauthenticator/qauthenticator.pro rename to tests/auto/network/kernel/qauthenticator/qauthenticator.pro diff --git a/tests/auto/qauthenticator/tst_qauthenticator.cpp b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp similarity index 100% rename from tests/auto/qauthenticator/tst_qauthenticator.cpp rename to tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp diff --git a/tests/auto/qhostaddress/.gitignore b/tests/auto/network/kernel/qhostaddress/.gitignore similarity index 100% rename from tests/auto/qhostaddress/.gitignore rename to tests/auto/network/kernel/qhostaddress/.gitignore diff --git a/tests/auto/qhostaddress/qhostaddress.pro b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro similarity index 100% rename from tests/auto/qhostaddress/qhostaddress.pro rename to tests/auto/network/kernel/qhostaddress/qhostaddress.pro diff --git a/tests/auto/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp similarity index 100% rename from tests/auto/qhostaddress/tst_qhostaddress.cpp rename to tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp diff --git a/tests/auto/qhostinfo/.gitignore b/tests/auto/network/kernel/qhostinfo/.gitignore similarity index 100% rename from tests/auto/qhostinfo/.gitignore rename to tests/auto/network/kernel/qhostinfo/.gitignore diff --git a/tests/auto/qhostinfo/qhostinfo.pro b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro similarity index 100% rename from tests/auto/qhostinfo/qhostinfo.pro rename to tests/auto/network/kernel/qhostinfo/qhostinfo.pro diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp similarity index 99% rename from tests/auto/qhostinfo/tst_qhostinfo.cpp rename to tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index 1c7df1bdae7..58b51bcb69e 100644 --- a/tests/auto/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -94,8 +94,8 @@ # endif #endif -#include "../network-settings.h" -#include "../../shared/util.h" +#include "../../../network-settings.h" +#include "../../../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qnetworkaddressentry/.gitignore b/tests/auto/network/kernel/qnetworkaddressentry/.gitignore similarity index 100% rename from tests/auto/qnetworkaddressentry/.gitignore rename to tests/auto/network/kernel/qnetworkaddressentry/.gitignore diff --git a/tests/auto/qnetworkaddressentry/qnetworkaddressentry.pro b/tests/auto/network/kernel/qnetworkaddressentry/qnetworkaddressentry.pro similarity index 100% rename from tests/auto/qnetworkaddressentry/qnetworkaddressentry.pro rename to tests/auto/network/kernel/qnetworkaddressentry/qnetworkaddressentry.pro diff --git a/tests/auto/qnetworkaddressentry/tst_qnetworkaddressentry.cpp b/tests/auto/network/kernel/qnetworkaddressentry/tst_qnetworkaddressentry.cpp similarity index 100% rename from tests/auto/qnetworkaddressentry/tst_qnetworkaddressentry.cpp rename to tests/auto/network/kernel/qnetworkaddressentry/tst_qnetworkaddressentry.cpp diff --git a/tests/auto/qnetworkinterface/.gitignore b/tests/auto/network/kernel/qnetworkinterface/.gitignore similarity index 100% rename from tests/auto/qnetworkinterface/.gitignore rename to tests/auto/network/kernel/qnetworkinterface/.gitignore diff --git a/tests/auto/qnetworkinterface/qnetworkinterface.pro b/tests/auto/network/kernel/qnetworkinterface/qnetworkinterface.pro similarity index 100% rename from tests/auto/qnetworkinterface/qnetworkinterface.pro rename to tests/auto/network/kernel/qnetworkinterface/qnetworkinterface.pro diff --git a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp similarity index 99% rename from tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp rename to tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp index ae3436d2f6c..7a2f0e578e4 100644 --- a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp +++ b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp @@ -47,7 +47,7 @@ #include <qtcpsocket.h> #include <QNetworkConfigurationManager> #include <QNetworkSession> -#include "../network-settings.h" +#include "../../../network-settings.h" //TESTED_FILES=qnetworkinterface.cpp qnetworkinterface.h qnetworkinterface_unix.cpp qnetworkinterface_win.cpp diff --git a/tests/auto/qnetworkproxy/.gitignore b/tests/auto/network/kernel/qnetworkproxy/.gitignore similarity index 100% rename from tests/auto/qnetworkproxy/.gitignore rename to tests/auto/network/kernel/qnetworkproxy/.gitignore diff --git a/tests/auto/qnetworkproxy/qnetworkproxy.pro b/tests/auto/network/kernel/qnetworkproxy/qnetworkproxy.pro similarity index 100% rename from tests/auto/qnetworkproxy/qnetworkproxy.pro rename to tests/auto/network/kernel/qnetworkproxy/qnetworkproxy.pro diff --git a/tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp b/tests/auto/network/kernel/qnetworkproxy/tst_qnetworkproxy.cpp similarity index 100% rename from tests/auto/qnetworkproxy/tst_qnetworkproxy.cpp rename to tests/auto/network/kernel/qnetworkproxy/tst_qnetworkproxy.cpp diff --git a/tests/auto/qnetworkproxyfactory/.gitignore b/tests/auto/network/kernel/qnetworkproxyfactory/.gitignore similarity index 100% rename from tests/auto/qnetworkproxyfactory/.gitignore rename to tests/auto/network/kernel/qnetworkproxyfactory/.gitignore diff --git a/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro b/tests/auto/network/kernel/qnetworkproxyfactory/qnetworkproxyfactory.pro similarity index 100% rename from tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro rename to tests/auto/network/kernel/qnetworkproxyfactory/qnetworkproxyfactory.pro diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp similarity index 100% rename from tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp rename to tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp diff --git a/tests/auto/network/network.pro b/tests/auto/network/network.pro new file mode 100644 index 00000000000..3eafd7df70b --- /dev/null +++ b/tests/auto/network/network.pro @@ -0,0 +1,8 @@ +TEMPLATE=subdirs +SUBDIRS=\ + access \ + bearer \ + kernel \ + ssl \ + socket \ + diff --git a/tests/auto/platformsocketengine/.gitignore b/tests/auto/network/socket/platformsocketengine/.gitignore similarity index 100% rename from tests/auto/platformsocketengine/.gitignore rename to tests/auto/network/socket/platformsocketengine/.gitignore diff --git a/tests/auto/platformsocketengine/platformsocketengine.pri b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pri similarity index 100% rename from tests/auto/platformsocketengine/platformsocketengine.pri rename to tests/auto/network/socket/platformsocketengine/platformsocketengine.pri diff --git a/tests/auto/platformsocketengine/platformsocketengine.pro b/tests/auto/network/socket/platformsocketengine/platformsocketengine.pro similarity index 100% rename from tests/auto/platformsocketengine/platformsocketengine.pro rename to tests/auto/network/socket/platformsocketengine/platformsocketengine.pro diff --git a/tests/auto/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp similarity index 99% rename from tests/auto/platformsocketengine/tst_platformsocketengine.cpp rename to tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index 257d412a5da..9e93108fc7b 100644 --- a/tests/auto/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ -#include <QtTest/QtTest> +#include <QtTest/QTest> #ifdef Q_OS_WIN #include <winsock2.h> @@ -79,7 +79,7 @@ #include <qstringlist.h> -#include "../network-settings.h" +#include "../../../network-settings.h" //TESTED_FILES=network/qnativesocketengine.cpp network/qnativesocketengine_p.h network/qnativesocketengine_unix.cpp diff --git a/tests/auto/qabstractsocket/.gitignore b/tests/auto/network/socket/qabstractsocket/.gitignore similarity index 100% rename from tests/auto/qabstractsocket/.gitignore rename to tests/auto/network/socket/qabstractsocket/.gitignore diff --git a/tests/auto/qabstractsocket/qabstractsocket.pro b/tests/auto/network/socket/qabstractsocket/qabstractsocket.pro similarity index 100% rename from tests/auto/qabstractsocket/qabstractsocket.pro rename to tests/auto/network/socket/qabstractsocket/qabstractsocket.pro diff --git a/tests/auto/qabstractsocket/tst_qabstractsocket.cpp b/tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp similarity index 100% rename from tests/auto/qabstractsocket/tst_qabstractsocket.cpp rename to tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp diff --git a/tests/auto/qhttpsocketengine/.gitignore b/tests/auto/network/socket/qhttpsocketengine/.gitignore similarity index 100% rename from tests/auto/qhttpsocketengine/.gitignore rename to tests/auto/network/socket/qhttpsocketengine/.gitignore diff --git a/tests/auto/qhttpsocketengine/qhttpsocketengine.pro b/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro similarity index 100% rename from tests/auto/qhttpsocketengine/qhttpsocketengine.pro rename to tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp similarity index 99% rename from tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp rename to tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp index ee914bd04e5..5a90abea0ec 100644 --- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -40,9 +40,11 @@ ****************************************************************************/ -#include <QtTest/QtTest> - -#include <qcoreapplication.h> +#include <QtTest/QTest> +#include <QtTest/QTestEventLoop> +#include <QtCore/QQueue> +#include <QtCore/QString> +#include <QtCore/QCoreApplication> #include <private/qhttpsocketengine_p.h> #include <qhostinfo.h> @@ -52,7 +54,7 @@ #include <qdebug.h> #include <qtcpserver.h> -#include "../network-settings.h" +#include "../../../network-settings.h" class tst_QHttpSocketEngine : public QObject { diff --git a/tests/auto/qlocalsocket/.gitignore b/tests/auto/network/socket/qlocalsocket/.gitignore similarity index 100% rename from tests/auto/qlocalsocket/.gitignore rename to tests/auto/network/socket/qlocalsocket/.gitignore diff --git a/tests/auto/qlocalsocket/example/client/client.pro b/tests/auto/network/socket/qlocalsocket/example/client/client.pro similarity index 100% rename from tests/auto/qlocalsocket/example/client/client.pro rename to tests/auto/network/socket/qlocalsocket/example/client/client.pro diff --git a/tests/auto/qlocalsocket/example/client/main.cpp b/tests/auto/network/socket/qlocalsocket/example/client/main.cpp similarity index 100% rename from tests/auto/qlocalsocket/example/client/main.cpp rename to tests/auto/network/socket/qlocalsocket/example/client/main.cpp diff --git a/tests/auto/qlocalsocket/example/example.pro b/tests/auto/network/socket/qlocalsocket/example/example.pro similarity index 100% rename from tests/auto/qlocalsocket/example/example.pro rename to tests/auto/network/socket/qlocalsocket/example/example.pro diff --git a/tests/auto/qlocalsocket/example/server/main.cpp b/tests/auto/network/socket/qlocalsocket/example/server/main.cpp similarity index 100% rename from tests/auto/qlocalsocket/example/server/main.cpp rename to tests/auto/network/socket/qlocalsocket/example/server/main.cpp diff --git a/tests/auto/qlocalsocket/example/server/server.pro b/tests/auto/network/socket/qlocalsocket/example/server/server.pro similarity index 100% rename from tests/auto/qlocalsocket/example/server/server.pro rename to tests/auto/network/socket/qlocalsocket/example/server/server.pro diff --git a/tests/auto/qlocalsocket/lackey/lackey.pro b/tests/auto/network/socket/qlocalsocket/lackey/lackey.pro similarity index 100% rename from tests/auto/qlocalsocket/lackey/lackey.pro rename to tests/auto/network/socket/qlocalsocket/lackey/lackey.pro diff --git a/tests/auto/qlocalsocket/lackey/main.cpp b/tests/auto/network/socket/qlocalsocket/lackey/main.cpp similarity index 100% rename from tests/auto/qlocalsocket/lackey/main.cpp rename to tests/auto/network/socket/qlocalsocket/lackey/main.cpp diff --git a/tests/auto/qlocalsocket/lackey/scripts/client.js b/tests/auto/network/socket/qlocalsocket/lackey/scripts/client.js similarity index 100% rename from tests/auto/qlocalsocket/lackey/scripts/client.js rename to tests/auto/network/socket/qlocalsocket/lackey/scripts/client.js diff --git a/tests/auto/qlocalsocket/lackey/scripts/server.js b/tests/auto/network/socket/qlocalsocket/lackey/scripts/server.js similarity index 100% rename from tests/auto/qlocalsocket/lackey/scripts/server.js rename to tests/auto/network/socket/qlocalsocket/lackey/scripts/server.js diff --git a/tests/auto/qlocalsocket/qlocalsocket.pro b/tests/auto/network/socket/qlocalsocket/qlocalsocket.pro similarity index 100% rename from tests/auto/qlocalsocket/qlocalsocket.pro rename to tests/auto/network/socket/qlocalsocket/qlocalsocket.pro diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/network/socket/qlocalsocket/test/test.pro similarity index 100% rename from tests/auto/qlocalsocket/test/test.pro rename to tests/auto/network/socket/qlocalsocket/test/test.pro diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp similarity index 99% rename from tests/auto/qlocalsocket/tst_qlocalsocket.cpp rename to tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 3dc5e7392f4..57daa92f827 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -45,7 +45,7 @@ #include <qtextstream.h> #include <QtNetwork/qlocalsocket.h> #include <QtNetwork/qlocalserver.h> -#include "../../shared/util.h" +#include "../../../../shared/util.h" #ifdef Q_OS_SYMBIAN #include <unistd.h> diff --git a/tests/auto/qsocks5socketengine/.gitignore b/tests/auto/network/socket/qsocks5socketengine/.gitignore similarity index 100% rename from tests/auto/qsocks5socketengine/.gitignore rename to tests/auto/network/socket/qsocks5socketengine/.gitignore diff --git a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro similarity index 100% rename from tests/auto/qsocks5socketengine/qsocks5socketengine.pro rename to tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp similarity index 99% rename from tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp rename to tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp index ef342ab8a96..26788164824 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -40,9 +40,13 @@ ****************************************************************************/ -#include <QtTest/QtTest> +#include <QtTest/QTest> +#include <QtTest/QTestEventLoop> -#include <qcoreapplication.h> +#include <QtCore/QQueue> +#include <QtCore/QString> +#include <QtCore/QCoreApplication> +#include <QtCore/QMetaType> #include <private/qsocks5socketengine_p.h> #include <qhostinfo.h> @@ -55,7 +59,7 @@ #include <qmetatype.h> #include <qdebug.h> -#include "../network-settings.h" +#include "../../../network-settings.h" Q_DECLARE_METATYPE(QQueue<QByteArray>) diff --git a/tests/auto/qtcpserver/.gitignore b/tests/auto/network/socket/qtcpserver/.gitignore similarity index 100% rename from tests/auto/qtcpserver/.gitignore rename to tests/auto/network/socket/qtcpserver/.gitignore diff --git a/tests/auto/qtcpserver/crashingServer/crashingServer.pro b/tests/auto/network/socket/qtcpserver/crashingServer/crashingServer.pro similarity index 100% rename from tests/auto/qtcpserver/crashingServer/crashingServer.pro rename to tests/auto/network/socket/qtcpserver/crashingServer/crashingServer.pro diff --git a/tests/auto/qtcpserver/crashingServer/main.cpp b/tests/auto/network/socket/qtcpserver/crashingServer/main.cpp similarity index 100% rename from tests/auto/qtcpserver/crashingServer/main.cpp rename to tests/auto/network/socket/qtcpserver/crashingServer/main.cpp diff --git a/tests/auto/qtcpserver/qtcpserver.pro b/tests/auto/network/socket/qtcpserver/qtcpserver.pro similarity index 100% rename from tests/auto/qtcpserver/qtcpserver.pro rename to tests/auto/network/socket/qtcpserver/qtcpserver.pro diff --git a/tests/auto/qtcpserver/test/test.pro b/tests/auto/network/socket/qtcpserver/test/test.pro similarity index 93% rename from tests/auto/qtcpserver/test/test.pro rename to tests/auto/network/socket/qtcpserver/test/test.pro index 65e1d826130..63e2d0a9813 100644 --- a/tests/auto/qtcpserver/test/test.pro +++ b/tests/auto/network/socket/qtcpserver/test/test.pro @@ -33,5 +33,4 @@ QT = core network MOC_DIR=tmp - - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp similarity index 99% rename from tests/auto/qtcpserver/tst_qtcpserver.cpp rename to tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index b72e61f3744..ca28a9c7c8c 100644 --- a/tests/auto/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -73,7 +73,7 @@ Q_DECLARE_METATYPE(QList<QNetworkProxy>) #include <QNetworkSession> #include <QNetworkConfiguration> #include <QNetworkConfigurationManager> -#include "../network-settings.h" +#include "../../../network-settings.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qtcpsocket/.gitignore b/tests/auto/network/socket/qtcpsocket/.gitignore similarity index 100% rename from tests/auto/qtcpsocket/.gitignore rename to tests/auto/network/socket/qtcpsocket/.gitignore diff --git a/tests/auto/qtcpsocket/qtcpsocket.pro b/tests/auto/network/socket/qtcpsocket/qtcpsocket.pro similarity index 100% rename from tests/auto/qtcpsocket/qtcpsocket.pro rename to tests/auto/network/socket/qtcpsocket/qtcpsocket.pro diff --git a/tests/auto/qtcpsocket/stressTest/Test.cpp b/tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp similarity index 100% rename from tests/auto/qtcpsocket/stressTest/Test.cpp rename to tests/auto/network/socket/qtcpsocket/stressTest/Test.cpp diff --git a/tests/auto/qtcpsocket/stressTest/Test.h b/tests/auto/network/socket/qtcpsocket/stressTest/Test.h similarity index 100% rename from tests/auto/qtcpsocket/stressTest/Test.h rename to tests/auto/network/socket/qtcpsocket/stressTest/Test.h diff --git a/tests/auto/qtcpsocket/stressTest/main.cpp b/tests/auto/network/socket/qtcpsocket/stressTest/main.cpp similarity index 100% rename from tests/auto/qtcpsocket/stressTest/main.cpp rename to tests/auto/network/socket/qtcpsocket/stressTest/main.cpp diff --git a/tests/auto/qtcpsocket/stressTest/stressTest.pro b/tests/auto/network/socket/qtcpsocket/stressTest/stressTest.pro similarity index 100% rename from tests/auto/qtcpsocket/stressTest/stressTest.pro rename to tests/auto/network/socket/qtcpsocket/stressTest/stressTest.pro diff --git a/tests/auto/qtcpsocket/test/test.pro b/tests/auto/network/socket/qtcpsocket/test/test.pro similarity index 97% rename from tests/auto/qtcpsocket/test/test.pro rename to tests/auto/network/socket/qtcpsocket/test/test.pro index 6ac2da653c3..61bfaad1a15 100644 --- a/tests/auto/qtcpsocket/test/test.pro +++ b/tests/auto/network/socket/qtcpsocket/test/test.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets QT += core-private network-private SOURCES += ../tst_qtcpsocket.cpp win32: { diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp similarity index 99% rename from tests/auto/qtcpsocket/tst_qtcpsocket.cpp rename to tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 39a64ab0dcf..bae3f7c2f57 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -94,8 +94,8 @@ #include "private/qhostinfo_p.h" -#include "../network-settings.h" -#include "../../shared/util.h" +#include "../../../network-settings.h" +#include "../../../../shared/util.h" Q_DECLARE_METATYPE(QAbstractSocket::SocketError) Q_DECLARE_METATYPE(QAbstractSocket::SocketState) diff --git a/tests/auto/qudpsocket/.gitignore b/tests/auto/network/socket/qudpsocket/.gitignore similarity index 100% rename from tests/auto/qudpsocket/.gitignore rename to tests/auto/network/socket/qudpsocket/.gitignore diff --git a/tests/auto/qudpsocket/clientserver/clientserver.pro b/tests/auto/network/socket/qudpsocket/clientserver/clientserver.pro similarity index 100% rename from tests/auto/qudpsocket/clientserver/clientserver.pro rename to tests/auto/network/socket/qudpsocket/clientserver/clientserver.pro diff --git a/tests/auto/qudpsocket/clientserver/main.cpp b/tests/auto/network/socket/qudpsocket/clientserver/main.cpp similarity index 100% rename from tests/auto/qudpsocket/clientserver/main.cpp rename to tests/auto/network/socket/qudpsocket/clientserver/main.cpp diff --git a/tests/auto/qudpsocket/qudpsocket.pro b/tests/auto/network/socket/qudpsocket/qudpsocket.pro similarity index 100% rename from tests/auto/qudpsocket/qudpsocket.pro rename to tests/auto/network/socket/qudpsocket/qudpsocket.pro diff --git a/tests/auto/qudpsocket/test/test.pro b/tests/auto/network/socket/qudpsocket/test/test.pro similarity index 100% rename from tests/auto/qudpsocket/test/test.pro rename to tests/auto/network/socket/qudpsocket/test/test.pro diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp similarity index 99% rename from tests/auto/qudpsocket/tst_qudpsocket.cpp rename to tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index ad7bfbb1161..83d30cc40a4 100644 --- a/tests/auto/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -53,7 +53,7 @@ #include <QNetworkInterface> #include <qstringlist.h> -#include "../network-settings.h" +#include "../../../network-settings.h" #ifndef QT_NO_BEARERMANAGEMENT #include <QtNetwork/qnetworkconfigmanager.h> diff --git a/tests/auto/qudpsocket/udpServer/main.cpp b/tests/auto/network/socket/qudpsocket/udpServer/main.cpp similarity index 100% rename from tests/auto/qudpsocket/udpServer/main.cpp rename to tests/auto/network/socket/qudpsocket/udpServer/main.cpp diff --git a/tests/auto/qudpsocket/udpServer/udpServer.pro b/tests/auto/network/socket/qudpsocket/udpServer/udpServer.pro similarity index 100% rename from tests/auto/qudpsocket/udpServer/udpServer.pro rename to tests/auto/network/socket/qudpsocket/udpServer/udpServer.pro diff --git a/tests/auto/network/socket/socket.pro b/tests/auto/network/socket/socket.pro new file mode 100644 index 00000000000..49fb52d1a50 --- /dev/null +++ b/tests/auto/network/socket/socket.pro @@ -0,0 +1,17 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qhttpsocketengine \ + qudpsocket \ + qtcpsocket \ + #qlocalsocket \ # FIXME: uses qtscript (QTBUG-19242) + qtcpserver \ + qsocks5socketengine \ + qabstractsocket \ + platformsocketengine \ + +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + platformsocketengine \ + qhttpsocketengine \ + qsocks5socketengine \ + + diff --git a/tests/auto/qsslcertificate/.gitignore b/tests/auto/network/ssl/qsslcertificate/.gitignore similarity index 100% rename from tests/auto/qsslcertificate/.gitignore rename to tests/auto/network/ssl/qsslcertificate/.gitignore diff --git a/tests/auto/qsslcertificate/certificates/ca-cert.pem b/tests/auto/network/ssl/qsslcertificate/certificates/ca-cert.pem similarity index 100% rename from tests/auto/qsslcertificate/certificates/ca-cert.pem rename to tests/auto/network/ssl/qsslcertificate/certificates/ca-cert.pem diff --git a/tests/auto/qsslcertificate/certificates/ca-cert.pem.digest-md5 b/tests/auto/network/ssl/qsslcertificate/certificates/ca-cert.pem.digest-md5 similarity index 100% rename from tests/auto/qsslcertificate/certificates/ca-cert.pem.digest-md5 rename to tests/auto/network/ssl/qsslcertificate/certificates/ca-cert.pem.digest-md5 diff --git a/tests/auto/qsslcertificate/certificates/ca-cert.pem.digest-sha1 b/tests/auto/network/ssl/qsslcertificate/certificates/ca-cert.pem.digest-sha1 similarity index 100% rename from tests/auto/qsslcertificate/certificates/ca-cert.pem.digest-sha1 rename to tests/auto/network/ssl/qsslcertificate/certificates/ca-cert.pem.digest-sha1 diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem b/tests/auto/network/ssl/qsslcertificate/certificates/cert-ss-san-utf8.pem similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem rename to tests/auto/network/ssl/qsslcertificate/certificates/cert-ss-san-utf8.pem diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san b/tests/auto/network/ssl/qsslcertificate/certificates/cert-ss-san-utf8.pem.san similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san rename to tests/auto/network/ssl/qsslcertificate/certificates/cert-ss-san-utf8.pem.san diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san.pem b/tests/auto/network/ssl/qsslcertificate/certificates/cert-ss-san.pem similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert-ss-san.pem rename to tests/auto/network/ssl/qsslcertificate/certificates/cert-ss-san.pem diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san.pem.san b/tests/auto/network/ssl/qsslcertificate/certificates/cert-ss-san.pem.san similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert-ss-san.pem.san rename to tests/auto/network/ssl/qsslcertificate/certificates/cert-ss-san.pem.san diff --git a/tests/auto/qsslcertificate/certificates/cert-ss.der b/tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.der similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert-ss.der rename to tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.der diff --git a/tests/auto/qsslcertificate/certificates/cert-ss.der.pubkey b/tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.der.pubkey similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert-ss.der.pubkey rename to tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.der.pubkey diff --git a/tests/auto/qsslcertificate/certificates/cert-ss.pem b/tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.pem similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert-ss.pem rename to tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.pem diff --git a/tests/auto/qsslcertificate/certificates/cert-ss.pem.digest-md5 b/tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.pem.digest-md5 similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert-ss.pem.digest-md5 rename to tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.pem.digest-md5 diff --git a/tests/auto/qsslcertificate/certificates/cert-ss.pem.digest-sha1 b/tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.pem.digest-sha1 similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert-ss.pem.digest-sha1 rename to tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.pem.digest-sha1 diff --git a/tests/auto/qsslcertificate/certificates/cert-ss.pem.pubkey b/tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.pem.pubkey similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert-ss.pem.pubkey rename to tests/auto/network/ssl/qsslcertificate/certificates/cert-ss.pem.pubkey diff --git a/tests/auto/qsslcertificate/certificates/cert.der b/tests/auto/network/ssl/qsslcertificate/certificates/cert.der similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert.der rename to tests/auto/network/ssl/qsslcertificate/certificates/cert.der diff --git a/tests/auto/qsslcertificate/certificates/cert.der.pubkey b/tests/auto/network/ssl/qsslcertificate/certificates/cert.der.pubkey similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert.der.pubkey rename to tests/auto/network/ssl/qsslcertificate/certificates/cert.der.pubkey diff --git a/tests/auto/qsslcertificate/certificates/cert.pem b/tests/auto/network/ssl/qsslcertificate/certificates/cert.pem similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert.pem rename to tests/auto/network/ssl/qsslcertificate/certificates/cert.pem diff --git a/tests/auto/qsslcertificate/certificates/cert.pem.digest-md5 b/tests/auto/network/ssl/qsslcertificate/certificates/cert.pem.digest-md5 similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert.pem.digest-md5 rename to tests/auto/network/ssl/qsslcertificate/certificates/cert.pem.digest-md5 diff --git a/tests/auto/qsslcertificate/certificates/cert.pem.digest-sha1 b/tests/auto/network/ssl/qsslcertificate/certificates/cert.pem.digest-sha1 similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert.pem.digest-sha1 rename to tests/auto/network/ssl/qsslcertificate/certificates/cert.pem.digest-sha1 diff --git a/tests/auto/qsslcertificate/certificates/cert.pem.pubkey b/tests/auto/network/ssl/qsslcertificate/certificates/cert.pem.pubkey similarity index 100% rename from tests/auto/qsslcertificate/certificates/cert.pem.pubkey rename to tests/auto/network/ssl/qsslcertificate/certificates/cert.pem.pubkey diff --git a/tests/auto/qsslcertificate/certificates/gencertificates.sh b/tests/auto/network/ssl/qsslcertificate/certificates/gencertificates.sh similarity index 100% rename from tests/auto/qsslcertificate/certificates/gencertificates.sh rename to tests/auto/network/ssl/qsslcertificate/certificates/gencertificates.sh diff --git a/tests/auto/qsslcertificate/certificates/san.cnf b/tests/auto/network/ssl/qsslcertificate/certificates/san.cnf similarity index 100% rename from tests/auto/qsslcertificate/certificates/san.cnf rename to tests/auto/network/ssl/qsslcertificate/certificates/san.cnf diff --git a/tests/auto/qsslcertificate/more-certificates/badguy-nul-cn.crt b/tests/auto/network/ssl/qsslcertificate/more-certificates/badguy-nul-cn.crt similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/badguy-nul-cn.crt rename to tests/auto/network/ssl/qsslcertificate/more-certificates/badguy-nul-cn.crt diff --git a/tests/auto/qsslcertificate/more-certificates/badguy-nul-san.crt b/tests/auto/network/ssl/qsslcertificate/more-certificates/badguy-nul-san.crt similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/badguy-nul-san.crt rename to tests/auto/network/ssl/qsslcertificate/more-certificates/badguy-nul-san.crt diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted-google.com-diginotar.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-google.com-diginotar.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/blacklisted-google.com-diginotar.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-google.com-diginotar.pem diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted1.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/blacklisted1.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted1.pem diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted2.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/blacklisted2.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted2.pem diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted3.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/blacklisted3.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted3.pem diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted4.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/blacklisted4.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted4.pem diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted5.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/blacklisted5.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted5.pem diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted6.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/blacklisted6.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted6.pem diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted7.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/blacklisted7.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted7.pem diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted8.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/blacklisted8.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted8.pem diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted9.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/blacklisted9.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted9.pem diff --git a/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.pem diff --git a/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.0.9.8 b/tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.txt.0.9.8 similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.0.9.8 rename to tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.txt.0.9.8 diff --git a/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.0 b/tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.0 similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.0 rename to tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.0 diff --git a/tests/auto/qsslcertificate/more-certificates/cert-large-serial-number.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-serial-number.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/cert-large-serial-number.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/cert-large-serial-number.pem diff --git a/tests/auto/qsslcertificate/more-certificates/malformed-just-begin-no-newline.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/malformed-just-begin-no-newline.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/malformed-just-begin-no-newline.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/malformed-just-begin-no-newline.pem diff --git a/tests/auto/qsslcertificate/more-certificates/malformed-just-begin.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/malformed-just-begin.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/malformed-just-begin.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/malformed-just-begin.pem diff --git a/tests/auto/qsslcertificate/more-certificates/natwest-banking.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/natwest-banking.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/natwest-banking.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/natwest-banking.pem diff --git a/tests/auto/qsslcertificate/more-certificates/no-ending-newline.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/no-ending-newline.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/no-ending-newline.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/no-ending-newline.pem diff --git a/tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/test-cn-two-cns-cert.pem diff --git a/tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/test-cn-with-drink-cert.pem diff --git a/tests/auto/qsslcertificate/more-certificates/trailing-whitespace.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/trailing-whitespace.pem similarity index 100% rename from tests/auto/qsslcertificate/more-certificates/trailing-whitespace.pem rename to tests/auto/network/ssl/qsslcertificate/more-certificates/trailing-whitespace.pem diff --git a/tests/auto/qsslcertificate/qsslcertificate.pro b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro similarity index 100% rename from tests/auto/qsslcertificate/qsslcertificate.pro rename to tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp similarity index 100% rename from tests/auto/qsslcertificate/tst_qsslcertificate.cpp rename to tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp diff --git a/tests/auto/qsslcertificate/verify-certs/README b/tests/auto/network/ssl/qsslcertificate/verify-certs/README similarity index 100% rename from tests/auto/qsslcertificate/verify-certs/README rename to tests/auto/network/ssl/qsslcertificate/verify-certs/README diff --git a/tests/auto/qsslcertificate/verify-certs/cacert.pem b/tests/auto/network/ssl/qsslcertificate/verify-certs/cacert.pem similarity index 100% rename from tests/auto/qsslcertificate/verify-certs/cacert.pem rename to tests/auto/network/ssl/qsslcertificate/verify-certs/cacert.pem diff --git a/tests/auto/qsslcertificate/verify-certs/test-addons-mozilla-org-cert.pem b/tests/auto/network/ssl/qsslcertificate/verify-certs/test-addons-mozilla-org-cert.pem similarity index 100% rename from tests/auto/qsslcertificate/verify-certs/test-addons-mozilla-org-cert.pem rename to tests/auto/network/ssl/qsslcertificate/verify-certs/test-addons-mozilla-org-cert.pem diff --git a/tests/auto/qsslcertificate/verify-certs/test-intermediate-ca-cert.pem b/tests/auto/network/ssl/qsslcertificate/verify-certs/test-intermediate-ca-cert.pem similarity index 100% rename from tests/auto/qsslcertificate/verify-certs/test-intermediate-ca-cert.pem rename to tests/auto/network/ssl/qsslcertificate/verify-certs/test-intermediate-ca-cert.pem diff --git a/tests/auto/qsslcertificate/verify-certs/test-intermediate-is-ca-cert.pem b/tests/auto/network/ssl/qsslcertificate/verify-certs/test-intermediate-is-ca-cert.pem similarity index 100% rename from tests/auto/qsslcertificate/verify-certs/test-intermediate-is-ca-cert.pem rename to tests/auto/network/ssl/qsslcertificate/verify-certs/test-intermediate-is-ca-cert.pem diff --git a/tests/auto/qsslcertificate/verify-certs/test-intermediate-not-ca-cert.pem b/tests/auto/network/ssl/qsslcertificate/verify-certs/test-intermediate-not-ca-cert.pem similarity index 100% rename from tests/auto/qsslcertificate/verify-certs/test-intermediate-not-ca-cert.pem rename to tests/auto/network/ssl/qsslcertificate/verify-certs/test-intermediate-not-ca-cert.pem diff --git a/tests/auto/qsslcertificate/verify-certs/test-ocsp-good-cert.pem b/tests/auto/network/ssl/qsslcertificate/verify-certs/test-ocsp-good-cert.pem similarity index 100% rename from tests/auto/qsslcertificate/verify-certs/test-ocsp-good-cert.pem rename to tests/auto/network/ssl/qsslcertificate/verify-certs/test-ocsp-good-cert.pem diff --git a/tests/auto/qsslcipher/.gitignore b/tests/auto/network/ssl/qsslcipher/.gitignore similarity index 100% rename from tests/auto/qsslcipher/.gitignore rename to tests/auto/network/ssl/qsslcipher/.gitignore diff --git a/tests/auto/qsslcipher/qsslcipher.pro b/tests/auto/network/ssl/qsslcipher/qsslcipher.pro similarity index 100% rename from tests/auto/qsslcipher/qsslcipher.pro rename to tests/auto/network/ssl/qsslcipher/qsslcipher.pro diff --git a/tests/auto/qsslcipher/tst_qsslcipher.cpp b/tests/auto/network/ssl/qsslcipher/tst_qsslcipher.cpp similarity index 100% rename from tests/auto/qsslcipher/tst_qsslcipher.cpp rename to tests/auto/network/ssl/qsslcipher/tst_qsslcipher.cpp diff --git a/tests/auto/qsslerror/.gitignore b/tests/auto/network/ssl/qsslerror/.gitignore similarity index 100% rename from tests/auto/qsslerror/.gitignore rename to tests/auto/network/ssl/qsslerror/.gitignore diff --git a/tests/auto/qsslerror/qsslerror.pro b/tests/auto/network/ssl/qsslerror/qsslerror.pro similarity index 100% rename from tests/auto/qsslerror/qsslerror.pro rename to tests/auto/network/ssl/qsslerror/qsslerror.pro diff --git a/tests/auto/qsslerror/tst_qsslerror.cpp b/tests/auto/network/ssl/qsslerror/tst_qsslerror.cpp similarity index 100% rename from tests/auto/qsslerror/tst_qsslerror.cpp rename to tests/auto/network/ssl/qsslerror/tst_qsslerror.cpp diff --git a/tests/auto/qsslkey/.gitignore b/tests/auto/network/ssl/qsslkey/.gitignore similarity index 100% rename from tests/auto/qsslkey/.gitignore rename to tests/auto/network/ssl/qsslkey/.gitignore diff --git a/tests/auto/qsslkey/keys/dsa-pri-1024.der b/tests/auto/network/ssl/qsslkey/keys/dsa-pri-1024.der similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pri-1024.der rename to tests/auto/network/ssl/qsslkey/keys/dsa-pri-1024.der diff --git a/tests/auto/qsslkey/keys/dsa-pri-1024.pem b/tests/auto/network/ssl/qsslkey/keys/dsa-pri-1024.pem similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pri-1024.pem rename to tests/auto/network/ssl/qsslkey/keys/dsa-pri-1024.pem diff --git a/tests/auto/qsslkey/keys/dsa-pri-512.der b/tests/auto/network/ssl/qsslkey/keys/dsa-pri-512.der similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pri-512.der rename to tests/auto/network/ssl/qsslkey/keys/dsa-pri-512.der diff --git a/tests/auto/qsslkey/keys/dsa-pri-512.pem b/tests/auto/network/ssl/qsslkey/keys/dsa-pri-512.pem similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pri-512.pem rename to tests/auto/network/ssl/qsslkey/keys/dsa-pri-512.pem diff --git a/tests/auto/qsslkey/keys/dsa-pri-576.der b/tests/auto/network/ssl/qsslkey/keys/dsa-pri-576.der similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pri-576.der rename to tests/auto/network/ssl/qsslkey/keys/dsa-pri-576.der diff --git a/tests/auto/qsslkey/keys/dsa-pri-576.pem b/tests/auto/network/ssl/qsslkey/keys/dsa-pri-576.pem similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pri-576.pem rename to tests/auto/network/ssl/qsslkey/keys/dsa-pri-576.pem diff --git a/tests/auto/qsslkey/keys/dsa-pri-960.der b/tests/auto/network/ssl/qsslkey/keys/dsa-pri-960.der similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pri-960.der rename to tests/auto/network/ssl/qsslkey/keys/dsa-pri-960.der diff --git a/tests/auto/qsslkey/keys/dsa-pri-960.pem b/tests/auto/network/ssl/qsslkey/keys/dsa-pri-960.pem similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pri-960.pem rename to tests/auto/network/ssl/qsslkey/keys/dsa-pri-960.pem diff --git a/tests/auto/qsslkey/keys/dsa-pub-1024.der b/tests/auto/network/ssl/qsslkey/keys/dsa-pub-1024.der similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pub-1024.der rename to tests/auto/network/ssl/qsslkey/keys/dsa-pub-1024.der diff --git a/tests/auto/qsslkey/keys/dsa-pub-1024.pem b/tests/auto/network/ssl/qsslkey/keys/dsa-pub-1024.pem similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pub-1024.pem rename to tests/auto/network/ssl/qsslkey/keys/dsa-pub-1024.pem diff --git a/tests/auto/qsslkey/keys/dsa-pub-512.der b/tests/auto/network/ssl/qsslkey/keys/dsa-pub-512.der similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pub-512.der rename to tests/auto/network/ssl/qsslkey/keys/dsa-pub-512.der diff --git a/tests/auto/qsslkey/keys/dsa-pub-512.pem b/tests/auto/network/ssl/qsslkey/keys/dsa-pub-512.pem similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pub-512.pem rename to tests/auto/network/ssl/qsslkey/keys/dsa-pub-512.pem diff --git a/tests/auto/qsslkey/keys/dsa-pub-576.der b/tests/auto/network/ssl/qsslkey/keys/dsa-pub-576.der similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pub-576.der rename to tests/auto/network/ssl/qsslkey/keys/dsa-pub-576.der diff --git a/tests/auto/qsslkey/keys/dsa-pub-576.pem b/tests/auto/network/ssl/qsslkey/keys/dsa-pub-576.pem similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pub-576.pem rename to tests/auto/network/ssl/qsslkey/keys/dsa-pub-576.pem diff --git a/tests/auto/qsslkey/keys/dsa-pub-960.der b/tests/auto/network/ssl/qsslkey/keys/dsa-pub-960.der similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pub-960.der rename to tests/auto/network/ssl/qsslkey/keys/dsa-pub-960.der diff --git a/tests/auto/qsslkey/keys/dsa-pub-960.pem b/tests/auto/network/ssl/qsslkey/keys/dsa-pub-960.pem similarity index 100% rename from tests/auto/qsslkey/keys/dsa-pub-960.pem rename to tests/auto/network/ssl/qsslkey/keys/dsa-pub-960.pem diff --git a/tests/auto/qsslkey/keys/genkeys.sh b/tests/auto/network/ssl/qsslkey/keys/genkeys.sh similarity index 100% rename from tests/auto/qsslkey/keys/genkeys.sh rename to tests/auto/network/ssl/qsslkey/keys/genkeys.sh diff --git a/tests/auto/qsslkey/keys/rsa-pri-1023.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-1023.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-1023.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-1023.der diff --git a/tests/auto/qsslkey/keys/rsa-pri-1023.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-1023.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-1023.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-1023.pem diff --git a/tests/auto/qsslkey/keys/rsa-pri-1024.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-1024.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-1024.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-1024.der diff --git a/tests/auto/qsslkey/keys/rsa-pri-1024.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-1024.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-1024.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-1024.pem diff --git a/tests/auto/qsslkey/keys/rsa-pri-2048.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-2048.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-2048.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-2048.der diff --git a/tests/auto/qsslkey/keys/rsa-pri-2048.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-2048.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-2048.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-2048.pem diff --git a/tests/auto/qsslkey/keys/rsa-pri-40.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-40.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-40.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-40.der diff --git a/tests/auto/qsslkey/keys/rsa-pri-40.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-40.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-40.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-40.pem diff --git a/tests/auto/qsslkey/keys/rsa-pri-511.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-511.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-511.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-511.der diff --git a/tests/auto/qsslkey/keys/rsa-pri-511.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-511.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-511.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-511.pem diff --git a/tests/auto/qsslkey/keys/rsa-pri-512.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-512.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-512.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-512.der diff --git a/tests/auto/qsslkey/keys/rsa-pri-512.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-512.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-512.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-512.pem diff --git a/tests/auto/qsslkey/keys/rsa-pri-999.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-999.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-999.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-999.der diff --git a/tests/auto/qsslkey/keys/rsa-pri-999.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pri-999.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pri-999.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pri-999.pem diff --git a/tests/auto/qsslkey/keys/rsa-pub-1023.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-1023.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-1023.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-1023.der diff --git a/tests/auto/qsslkey/keys/rsa-pub-1023.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-1023.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-1023.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-1023.pem diff --git a/tests/auto/qsslkey/keys/rsa-pub-1024.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-1024.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-1024.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-1024.der diff --git a/tests/auto/qsslkey/keys/rsa-pub-1024.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-1024.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-1024.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-1024.pem diff --git a/tests/auto/qsslkey/keys/rsa-pub-2048.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-2048.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-2048.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-2048.der diff --git a/tests/auto/qsslkey/keys/rsa-pub-2048.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-2048.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-2048.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-2048.pem diff --git a/tests/auto/qsslkey/keys/rsa-pub-40.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-40.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-40.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-40.der diff --git a/tests/auto/qsslkey/keys/rsa-pub-40.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-40.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-40.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-40.pem diff --git a/tests/auto/qsslkey/keys/rsa-pub-511.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-511.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-511.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-511.der diff --git a/tests/auto/qsslkey/keys/rsa-pub-511.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-511.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-511.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-511.pem diff --git a/tests/auto/qsslkey/keys/rsa-pub-512.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-512.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-512.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-512.der diff --git a/tests/auto/qsslkey/keys/rsa-pub-512.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-512.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-512.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-512.pem diff --git a/tests/auto/qsslkey/keys/rsa-pub-999.der b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-999.der similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-999.der rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-999.der diff --git a/tests/auto/qsslkey/keys/rsa-pub-999.pem b/tests/auto/network/ssl/qsslkey/keys/rsa-pub-999.pem similarity index 100% rename from tests/auto/qsslkey/keys/rsa-pub-999.pem rename to tests/auto/network/ssl/qsslkey/keys/rsa-pub-999.pem diff --git a/tests/auto/qsslkey/qsslkey.pro b/tests/auto/network/ssl/qsslkey/qsslkey.pro similarity index 100% rename from tests/auto/qsslkey/qsslkey.pro rename to tests/auto/network/ssl/qsslkey/qsslkey.pro diff --git a/tests/auto/qsslkey/rsa-with-passphrase.pem b/tests/auto/network/ssl/qsslkey/rsa-with-passphrase.pem similarity index 100% rename from tests/auto/qsslkey/rsa-with-passphrase.pem rename to tests/auto/network/ssl/qsslkey/rsa-with-passphrase.pem diff --git a/tests/auto/qsslkey/rsa-without-passphrase.pem b/tests/auto/network/ssl/qsslkey/rsa-without-passphrase.pem similarity index 100% rename from tests/auto/qsslkey/rsa-without-passphrase.pem rename to tests/auto/network/ssl/qsslkey/rsa-without-passphrase.pem diff --git a/tests/auto/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp similarity index 100% rename from tests/auto/qsslkey/tst_qsslkey.cpp rename to tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp diff --git a/tests/auto/qsslsocket/.gitignore b/tests/auto/network/ssl/qsslsocket/.gitignore similarity index 100% rename from tests/auto/qsslsocket/.gitignore rename to tests/auto/network/ssl/qsslsocket/.gitignore diff --git a/tests/auto/qsslsocket/certs/aspiriniks.ca.crt b/tests/auto/network/ssl/qsslsocket/certs/aspiriniks.ca.crt similarity index 100% rename from tests/auto/qsslsocket/certs/aspiriniks.ca.crt rename to tests/auto/network/ssl/qsslsocket/certs/aspiriniks.ca.crt diff --git a/tests/auto/qsslsocket/certs/fake-login.live.com.key b/tests/auto/network/ssl/qsslsocket/certs/fake-login.live.com.key similarity index 100% rename from tests/auto/qsslsocket/certs/fake-login.live.com.key rename to tests/auto/network/ssl/qsslsocket/certs/fake-login.live.com.key diff --git a/tests/auto/qsslsocket/certs/fake-login.live.com.pem b/tests/auto/network/ssl/qsslsocket/certs/fake-login.live.com.pem similarity index 100% rename from tests/auto/qsslsocket/certs/fake-login.live.com.pem rename to tests/auto/network/ssl/qsslsocket/certs/fake-login.live.com.pem diff --git a/tests/auto/qsslsocket/certs/fluke.cert b/tests/auto/network/ssl/qsslsocket/certs/fluke.cert similarity index 100% rename from tests/auto/qsslsocket/certs/fluke.cert rename to tests/auto/network/ssl/qsslsocket/certs/fluke.cert diff --git a/tests/auto/qsslsocket/certs/fluke.key b/tests/auto/network/ssl/qsslsocket/certs/fluke.key similarity index 100% rename from tests/auto/qsslsocket/certs/fluke.key rename to tests/auto/network/ssl/qsslsocket/certs/fluke.key diff --git a/tests/auto/qsslsocket/certs/qt-test-server-cacert.pem b/tests/auto/network/ssl/qsslsocket/certs/qt-test-server-cacert.pem similarity index 100% rename from tests/auto/qsslsocket/certs/qt-test-server-cacert.pem rename to tests/auto/network/ssl/qsslsocket/certs/qt-test-server-cacert.pem diff --git a/tests/auto/qsslsocket/qsslsocket.pro b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro similarity index 96% rename from tests/auto/qsslsocket/qsslsocket.pro rename to tests/auto/network/ssl/qsslsocket/qsslsocket.pro index 1f5c7f6aaf9..f19b724ef08 100644 --- a/tests/auto/qsslsocket/qsslsocket.pro +++ b/tests/auto/network/ssl/qsslsocket/qsslsocket.pro @@ -46,3 +46,5 @@ wince* { } requires(contains(QT_CONFIG,private_tests)) + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qsslsocket/ssl.tar.gz b/tests/auto/network/ssl/qsslsocket/ssl.tar.gz similarity index 100% rename from tests/auto/qsslsocket/ssl.tar.gz rename to tests/auto/network/ssl/qsslsocket/ssl.tar.gz diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp similarity index 99% rename from tests/auto/qsslsocket/tst_qsslsocket.cpp rename to tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index 4ffcba6e65b..6b7720308d7 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -55,10 +55,12 @@ #include <QAuthenticator> #include "private/qhostinfo_p.h" +#ifndef QT_NO_OPENSSL #include "private/qsslsocket_openssl_p.h" #include "private/qsslsocket_openssl_symbols_p.h" +#endif -#include "../network-settings.h" +#include "../../../network-settings.h" Q_DECLARE_METATYPE(QAbstractSocket::SocketState) Q_DECLARE_METATYPE(QAbstractSocket::SocketError) diff --git a/tests/auto/network/ssl/ssl.pro b/tests/auto/network/ssl/ssl.pro new file mode 100644 index 00000000000..fd57a1729b6 --- /dev/null +++ b/tests/auto/network/ssl/ssl.pro @@ -0,0 +1,8 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qsslcertificate \ + qsslcipher \ + qsslerror \ + qsslsocket \ + qsslkey \ + diff --git a/tests/auto/opengl.pro b/tests/auto/opengl/opengl.pro similarity index 100% rename from tests/auto/opengl.pro rename to tests/auto/opengl/opengl.pro diff --git a/tests/auto/qgl/.gitignore b/tests/auto/opengl/qgl/.gitignore similarity index 100% rename from tests/auto/qgl/.gitignore rename to tests/auto/opengl/qgl/.gitignore diff --git a/tests/auto/qgl/qgl.pro b/tests/auto/opengl/qgl/qgl.pro similarity index 84% rename from tests/auto/qgl/qgl.pro rename to tests/auto/opengl/qgl/qgl.pro index cec7f23f07b..c5e26451ed6 100644 --- a/tests/auto/qgl/qgl.pro +++ b/tests/auto/opengl/qgl/qgl.pro @@ -4,7 +4,7 @@ load(qttest_p4) requires(contains(QT_CONFIG,opengl)) -QT += opengl-private gui-private core-private +QT += widgets widgets-private opengl-private gui-private core-private contains(QT_CONFIG,egl):DEFINES += QGL_EGL win32:!wince*: DEFINES += QT_NO_EGL diff --git a/tests/auto/opengl/qgl/qgl.qrc b/tests/auto/opengl/qgl/qgl.qrc new file mode 100644 index 00000000000..70f425c1b94 --- /dev/null +++ b/tests/auto/opengl/qgl/qgl.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file alias="designer.png">../../gui/image/qpixmap/images/designer.png</file> +</qresource> +</RCC> diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp similarity index 99% rename from tests/auto/qgl/tst_qgl.cpp rename to tests/auto/opengl/qgl/tst_qgl.cpp index 7d46ada8203..e1c3462560d 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -55,8 +55,8 @@ #include <QVBoxLayout> #ifdef QT_BUILD_INTERNAL +#include <qplatformpixmap_qpa.h> #include <QtOpenGL/private/qgl_p.h> -#include <QtGui/private/qpixmapdata_p.h> #include <QtGui/private/qimage_p.h> #include <QtGui/private/qimagepixmapcleanuphooks_p.h> #endif @@ -919,9 +919,7 @@ void tst_QGL::partialGLWidgetUpdates() widget.setFixedSize(150, 150); widget.setAutoFillBackground(autoFillBackground); widget.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&widget); -#endif + QTest::qWait(200); if (widget.format().doubleBuffer() != doubleBufferedContext) @@ -929,10 +927,7 @@ void tst_QGL::partialGLWidgetUpdates() widget.paintEventRegion = QRegion(); widget.repaint(50, 50, 50, 50); -#ifdef Q_WS_MAC - // repaint() is not immediate on the Mac; it has to go through the event loop. - QTest::qWait(200); -#endif + if (supportsPartialUpdates) QCOMPARE(widget.paintEventRegion, QRegion(50, 50, 50, 50)); else @@ -1868,12 +1863,14 @@ public: int tst_QGLResource::deletions = 0; -Q_GLOBAL_STATIC(QGLContextGroupResource<tst_QGLResource>, qt_shared_test) - +#ifdef TODO +Q_GLOBAL_STATIC(QOpenGLContextGroupResource<tst_QGLResource>, qt_shared_test) +#endif //TODO #endif void tst_QGL::shareRegister() { +#ifdef TODO #ifdef QT_BUILD_INTERNAL // Create a context. QGLWidget *glw1 = new QGLWidget(); @@ -1883,15 +1880,15 @@ void tst_QGL::shareRegister() QVERIFY(!glw1->isSharing()); // Create a guard for the first context. - QGLSharedResourceGuard guard(glw1->context()); + QOpenGLSharedResourceGuard guard(glw1->context()->contextHandle()); QVERIFY(guard.id() == 0); guard.setId(3); QVERIFY(guard.id() == 3); // Request a tst_QGLResource object for the first context. - tst_QGLResource *res1 = qt_shared_test()->value(glw1->context()); + tst_QGLResource *res1 = qt_shared_test()->value(glw1->context()->contextHandle()); QVERIFY(res1); - QVERIFY(qt_shared_test()->value(glw1->context()) == res1); + QVERIFY(qt_shared_test()->value(glw1->context()->contextHandle()) == res1); // Create another context that shares with the first. QVERIFY(!glw1->isSharing()); @@ -1985,6 +1982,7 @@ void tst_QGL::shareRegister() QVERIFY(guard3.context() == 0); QVERIFY(guard3.id() == 0); #endif +#endif //TODO } // Tests QGLContext::bindTexture with default options diff --git a/tests/auto/qglbuffer/qglbuffer.pro b/tests/auto/opengl/qglbuffer/qglbuffer.pro similarity index 93% rename from tests/auto/qglbuffer/qglbuffer.pro rename to tests/auto/opengl/qglbuffer/qglbuffer.pro index 5627d2d6cb3..48bd9667970 100644 --- a/tests/auto/qglbuffer/qglbuffer.pro +++ b/tests/auto/opengl/qglbuffer/qglbuffer.pro @@ -4,7 +4,7 @@ load(qttest_p4) requires(contains(QT_CONFIG,opengl)) -QT += opengl +QT += opengl widgets win32:!wince*: DEFINES += QT_NO_EGL diff --git a/tests/auto/qglbuffer/tst_qglbuffer.cpp b/tests/auto/opengl/qglbuffer/tst_qglbuffer.cpp similarity index 100% rename from tests/auto/qglbuffer/tst_qglbuffer.cpp rename to tests/auto/opengl/qglbuffer/tst_qglbuffer.cpp diff --git a/tests/auto/qglfunctions/qglfunctions.pro b/tests/auto/opengl/qglfunctions/qglfunctions.pro similarity index 85% rename from tests/auto/qglfunctions/qglfunctions.pro rename to tests/auto/opengl/qglfunctions/qglfunctions.pro index aa81547de52..9fe8de2b23d 100644 --- a/tests/auto/qglfunctions/qglfunctions.pro +++ b/tests/auto/opengl/qglfunctions/qglfunctions.pro @@ -1,6 +1,6 @@ load(qttest_p4) requires(contains(QT_CONFIG,opengl)) -QT += opengl +QT += opengl widgets win32:!wince*: DEFINES += QT_NO_EGL diff --git a/tests/auto/qglfunctions/tst_qglfunctions.cpp b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp similarity index 100% rename from tests/auto/qglfunctions/tst_qglfunctions.cpp rename to tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp diff --git a/tests/auto/qglthreads/qglthreads.pro b/tests/auto/opengl/qglthreads/qglthreads.pro similarity index 91% rename from tests/auto/qglthreads/qglthreads.pro rename to tests/auto/opengl/qglthreads/qglthreads.pro index bd27ce8e68a..d2fd31411f6 100644 --- a/tests/auto/qglthreads/qglthreads.pro +++ b/tests/auto/opengl/qglthreads/qglthreads.pro @@ -1,6 +1,6 @@ load(qttest_p4) requires(contains(QT_CONFIG,opengl)) -QT += opengl +QT += opengl widgets win32:!wince*: DEFINES += QT_NO_EGL diff --git a/tests/auto/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp similarity index 99% rename from tests/auto/qglthreads/tst_qglthreads.cpp rename to tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 472379ab7a6..ee05e406c85 100644 --- a/tests/auto/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -42,6 +42,7 @@ #include <QtTest/QtTest> #include <QtCore/QtCore> #include <QtGui/QtGui> +#include <QtWidgets/QApplication> #include <QtOpenGL/QtOpenGL> #include "tst_qglthreads.h" diff --git a/tests/auto/qglthreads/tst_qglthreads.h b/tests/auto/opengl/qglthreads/tst_qglthreads.h similarity index 100% rename from tests/auto/qglthreads/tst_qglthreads.h rename to tests/auto/opengl/qglthreads/tst_qglthreads.h diff --git a/tests/auto/other.pro b/tests/auto/other.pro index c4ddc83cdfa..1911d013f17 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -3,41 +3,26 @@ TEMPLATE=subdirs SUBDIRS=\ + other \ # baselineexample \ Just an example demonstrating qbaselinetest usage lancelot \ - qalgorithms \ qcombobox \ - qcssparser \ - qdatastream \ - qdir \ qfocusevent \ - qimage \ - qiodevice \ - qitemmodel \ qlayout \ qmdiarea \ qmenu \ qmenubar \ - qmouseevent \ - qpainter \ - qpixmap \ - qprinter \ - qsettings \ qsplitter \ qtabwidget \ qtextbrowser \ - qtextdocument \ qtextedit \ qtoolbutton \ - qvariant \ qwidget \ qworkspace \ - windowsmobile \ - nativeimagehandleprovider + windowsmobile contains(QT_CONFIG, accessibility):SUBDIRS += qaccessibility -contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter mac:!qpa { SUBDIRS += macgui \ macnativeevents \ @@ -61,6 +46,4 @@ symbian { # Following tests depends on private API !contains(QT_CONFIG, private_tests): SUBDIRS -= \ qcombobox \ - qcssparser \ qtextedit \ - diff --git a/tests/auto/atwrapper/.gitignore b/tests/auto/other/atwrapper/.gitignore similarity index 100% rename from tests/auto/atwrapper/.gitignore rename to tests/auto/other/atwrapper/.gitignore diff --git a/tests/auto/atwrapper/TODO b/tests/auto/other/atwrapper/TODO similarity index 100% rename from tests/auto/atwrapper/TODO rename to tests/auto/other/atwrapper/TODO diff --git a/tests/auto/atwrapper/atWrapper.cpp b/tests/auto/other/atwrapper/atWrapper.cpp similarity index 100% rename from tests/auto/atwrapper/atWrapper.cpp rename to tests/auto/other/atwrapper/atWrapper.cpp diff --git a/tests/auto/atwrapper/atWrapper.h b/tests/auto/other/atwrapper/atWrapper.h similarity index 100% rename from tests/auto/atwrapper/atWrapper.h rename to tests/auto/other/atwrapper/atWrapper.h diff --git a/tests/auto/atwrapper/atWrapper.pro b/tests/auto/other/atwrapper/atWrapper.pro similarity index 100% rename from tests/auto/atwrapper/atWrapper.pro rename to tests/auto/other/atwrapper/atWrapper.pro diff --git a/tests/auto/atwrapper/atWrapperAutotest.cpp b/tests/auto/other/atwrapper/atWrapperAutotest.cpp similarity index 100% rename from tests/auto/atwrapper/atWrapperAutotest.cpp rename to tests/auto/other/atwrapper/atWrapperAutotest.cpp diff --git a/tests/auto/atwrapper/desert.ini b/tests/auto/other/atwrapper/desert.ini similarity index 100% rename from tests/auto/atwrapper/desert.ini rename to tests/auto/other/atwrapper/desert.ini diff --git a/tests/auto/atwrapper/ephron.ini b/tests/auto/other/atwrapper/ephron.ini similarity index 100% rename from tests/auto/atwrapper/ephron.ini rename to tests/auto/other/atwrapper/ephron.ini diff --git a/tests/auto/atwrapper/gullgubben.ini b/tests/auto/other/atwrapper/gullgubben.ini similarity index 100% rename from tests/auto/atwrapper/gullgubben.ini rename to tests/auto/other/atwrapper/gullgubben.ini diff --git a/tests/auto/atwrapper/honshu.ini b/tests/auto/other/atwrapper/honshu.ini similarity index 100% rename from tests/auto/atwrapper/honshu.ini rename to tests/auto/other/atwrapper/honshu.ini diff --git a/tests/auto/atwrapper/kramer.ini b/tests/auto/other/atwrapper/kramer.ini similarity index 100% rename from tests/auto/atwrapper/kramer.ini rename to tests/auto/other/atwrapper/kramer.ini diff --git a/tests/auto/atwrapper/scruffy.ini b/tests/auto/other/atwrapper/scruffy.ini similarity index 100% rename from tests/auto/atwrapper/scruffy.ini rename to tests/auto/other/atwrapper/scruffy.ini diff --git a/tests/auto/atwrapper/spareribs.ini b/tests/auto/other/atwrapper/spareribs.ini similarity index 100% rename from tests/auto/atwrapper/spareribs.ini rename to tests/auto/other/atwrapper/spareribs.ini diff --git a/tests/auto/atwrapper/titan.ini b/tests/auto/other/atwrapper/titan.ini similarity index 100% rename from tests/auto/atwrapper/titan.ini rename to tests/auto/other/atwrapper/titan.ini diff --git a/tests/auto/baselineexample/baselineexample.pro b/tests/auto/other/baselineexample/baselineexample.pro similarity index 77% rename from tests/auto/baselineexample/baselineexample.pro rename to tests/auto/other/baselineexample/baselineexample.pro index 3d3d42e8cc1..cc310aec3af 100644 --- a/tests/auto/baselineexample/baselineexample.pro +++ b/tests/auto/other/baselineexample/baselineexample.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += testlib +QT += testlib widgets TARGET = tst_baselineexample CONFIG += console @@ -15,4 +15,4 @@ TEMPLATE = app SOURCES += tst_baselineexample.cpp DEFINES += SRCDIR=\\\"$$PWD/\\\" -include($$PWD/../../baselineserver/shared/qbaselinetest.pri) +include($$PWD/../../../baselineserver/shared/qbaselinetest.pri) diff --git a/tests/auto/baselineexample/tst_baselineexample.cpp b/tests/auto/other/baselineexample/tst_baselineexample.cpp similarity index 100% rename from tests/auto/baselineexample/tst_baselineexample.cpp rename to tests/auto/other/baselineexample/tst_baselineexample.cpp diff --git a/tests/auto/compiler/.gitignore b/tests/auto/other/compiler/.gitignore similarity index 100% rename from tests/auto/compiler/.gitignore rename to tests/auto/other/compiler/.gitignore diff --git a/tests/auto/compiler/baseclass.cpp b/tests/auto/other/compiler/baseclass.cpp similarity index 100% rename from tests/auto/compiler/baseclass.cpp rename to tests/auto/other/compiler/baseclass.cpp diff --git a/tests/auto/compiler/baseclass.h b/tests/auto/other/compiler/baseclass.h similarity index 100% rename from tests/auto/compiler/baseclass.h rename to tests/auto/other/compiler/baseclass.h diff --git a/tests/auto/compiler/compiler.pro b/tests/auto/other/compiler/compiler.pro similarity index 100% rename from tests/auto/compiler/compiler.pro rename to tests/auto/other/compiler/compiler.pro diff --git a/tests/auto/compiler/derivedclass.cpp b/tests/auto/other/compiler/derivedclass.cpp similarity index 100% rename from tests/auto/compiler/derivedclass.cpp rename to tests/auto/other/compiler/derivedclass.cpp diff --git a/tests/auto/compiler/derivedclass.h b/tests/auto/other/compiler/derivedclass.h similarity index 100% rename from tests/auto/compiler/derivedclass.h rename to tests/auto/other/compiler/derivedclass.h diff --git a/tests/auto/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp similarity index 100% rename from tests/auto/compiler/tst_compiler.cpp rename to tests/auto/other/compiler/tst_compiler.cpp diff --git a/tests/auto/headersclean/headersclean.pro b/tests/auto/other/headersclean/headersclean.pro similarity index 80% rename from tests/auto/headersclean/headersclean.pro rename to tests/auto/other/headersclean/headersclean.pro index 0f976ffb959..d18dc1c0a2f 100644 --- a/tests/auto/headersclean/headersclean.pro +++ b/tests/auto/other/headersclean/headersclean.pro @@ -5,5 +5,3 @@ CONFIG += uitools contains(QT_CONFIG,dbus): QT += dbus contains(QT_CONFIG,opengl): QT += opengl -contains(QT_CONFIG,openvg): QT += openvg - diff --git a/tests/auto/headersclean/tst_headersclean.cpp b/tests/auto/other/headersclean/tst_headersclean.cpp similarity index 97% rename from tests/auto/headersclean/tst_headersclean.cpp rename to tests/auto/other/headersclean/tst_headersclean.cpp index 41537776a7f..831e7fe50ac 100644 --- a/tests/auto/headersclean/tst_headersclean.cpp +++ b/tests/auto/other/headersclean/tst_headersclean.cpp @@ -64,10 +64,6 @@ #include <QtDBus/QtDBus> #endif -#ifndef QT_NO_OPENVG -#include <QtOpenVG/QtOpenVG> -#endif - class tst_HeadersClean: public QObject { Q_OBJECT diff --git a/tests/auto/maketestselftest/checktest/checktest.pro b/tests/auto/other/maketestselftest/checktest/checktest.pro similarity index 100% rename from tests/auto/maketestselftest/checktest/checktest.pro rename to tests/auto/other/maketestselftest/checktest/checktest.pro diff --git a/tests/auto/maketestselftest/checktest/main.cpp b/tests/auto/other/maketestselftest/checktest/main.cpp similarity index 100% rename from tests/auto/maketestselftest/checktest/main.cpp rename to tests/auto/other/maketestselftest/checktest/main.cpp diff --git a/tests/auto/maketestselftest/features/dump_subdirs.prf b/tests/auto/other/maketestselftest/features/dump_subdirs.prf similarity index 100% rename from tests/auto/maketestselftest/features/dump_subdirs.prf rename to tests/auto/other/maketestselftest/features/dump_subdirs.prf diff --git a/tests/auto/maketestselftest/maketestselftest.pro b/tests/auto/other/maketestselftest/maketestselftest.pro similarity index 100% rename from tests/auto/maketestselftest/maketestselftest.pro rename to tests/auto/other/maketestselftest/maketestselftest.pro diff --git a/tests/auto/maketestselftest/test/test.pro b/tests/auto/other/maketestselftest/test/test.pro similarity index 87% rename from tests/auto/maketestselftest/test/test.pro rename to tests/auto/other/maketestselftest/test/test.pro index d9de51e1a30..cc0d582a540 100644 --- a/tests/auto/maketestselftest/test/test.pro +++ b/tests/auto/other/maketestselftest/test/test.pro @@ -16,3 +16,4 @@ win32 { } } +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/maketestselftest/tst_maketestselftest.cpp b/tests/auto/other/maketestselftest/tst_maketestselftest.cpp similarity index 94% rename from tests/auto/maketestselftest/tst_maketestselftest.cpp rename to tests/auto/other/maketestselftest/tst_maketestselftest.cpp index 07c68ac7ece..59dd43cb407 100644 --- a/tests/auto/maketestselftest/tst_maketestselftest.cpp +++ b/tests/auto/other/maketestselftest/tst_maketestselftest.cpp @@ -58,8 +58,6 @@ class tst_MakeTestSelfTest: public QObject Q_OBJECT private slots: - void tests_auto_pro(); - void tests_pro_files(); void tests_pro_files_data(); @@ -78,30 +76,6 @@ bool looks_like_testcase(QString const&,QString*); bool looks_like_subdirs(QString const&); QStringList find_test_class(QString const&); -/* - Verify that auto.pro only contains other .pro files (and not directories). - We enforce this so that we can process every .pro file other than auto.pro - independently and get all the tests. - If tests were allowed to appear directly in auto.pro, we'd have the problem - that we need to somehow run these tests from auto.pro while preventing - recursion into the other .pro files. -*/ -void tst_MakeTestSelfTest::tests_auto_pro() -{ - QStringList subdirsList = find_subdirs(SRCDIR "/../auto.pro", Flat); - if (QTest::currentTestFailed()) { - return; - } - - foreach (QString const& subdir, subdirsList) { - QVERIFY2(subdir.endsWith(".pro"), qPrintable(QString( - "auto.pro contains a subdir `%1'.\n" - "auto.pro must _only_ contain other .pro files, not actual subdirs.\n" - "Please move `%1' into some other .pro file referenced by auto.pro." - ).arg(subdir))); - } -} - /* Verify that all tests are listed somewhere in one of the autotest .pro files */ void tst_MakeTestSelfTest::tests_pro_files() { diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro new file mode 100644 index 00000000000..30d153156c1 --- /dev/null +++ b/tests/auto/other/other.pro @@ -0,0 +1,11 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qtmd5 \ + qtokenautomaton \ + baselineexample \ + +!cross_compile: SUBDIRS += \ + compiler \ + headersclean \ + maketestselftest \ + # atwrapper \ # QTBUG-19452 diff --git a/tests/auto/qtmd5/.gitignore b/tests/auto/other/qtmd5/.gitignore similarity index 100% rename from tests/auto/qtmd5/.gitignore rename to tests/auto/other/qtmd5/.gitignore diff --git a/tests/auto/qtmd5/qtmd5.pro b/tests/auto/other/qtmd5/qtmd5.pro similarity index 86% rename from tests/auto/qtmd5/qtmd5.pro rename to tests/auto/other/qtmd5/qtmd5.pro index 0afc6b1b148..6973c9e5be4 100644 --- a/tests/auto/qtmd5/qtmd5.pro +++ b/tests/auto/other/qtmd5/qtmd5.pro @@ -1,4 +1,4 @@ -include(../solutions.pri) +include(../../solutions.pri) !contains(DEFINES, QT_NO_SOLUTIONS) { include($${SOLUTIONBASEDIR}/utils/qtmd5/src/qtmd5.pri) diff --git a/tests/auto/qtmd5/tst_qtmd5.cpp b/tests/auto/other/qtmd5/tst_qtmd5.cpp similarity index 100% rename from tests/auto/qtmd5/tst_qtmd5.cpp rename to tests/auto/other/qtmd5/tst_qtmd5.cpp diff --git a/tests/auto/qtokenautomaton/.gitignore b/tests/auto/other/qtokenautomaton/.gitignore similarity index 100% rename from tests/auto/qtokenautomaton/.gitignore rename to tests/auto/other/qtokenautomaton/.gitignore diff --git a/tests/auto/qtokenautomaton/generateTokenizers.sh b/tests/auto/other/qtokenautomaton/generateTokenizers.sh similarity index 100% rename from tests/auto/qtokenautomaton/generateTokenizers.sh rename to tests/auto/other/qtokenautomaton/generateTokenizers.sh diff --git a/tests/auto/qtokenautomaton/qtokenautomaton.pro b/tests/auto/other/qtokenautomaton/qtokenautomaton.pro similarity index 100% rename from tests/auto/qtokenautomaton/qtokenautomaton.pro rename to tests/auto/other/qtokenautomaton/qtokenautomaton.pro diff --git a/tests/auto/qtokenautomaton/tokenizers/basic/basic.cpp b/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/basic/basic.cpp rename to tests/auto/other/qtokenautomaton/tokenizers/basic/basic.cpp diff --git a/tests/auto/qtokenautomaton/tokenizers/basic/basic.h b/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.h similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/basic/basic.h rename to tests/auto/other/qtokenautomaton/tokenizers/basic/basic.h diff --git a/tests/auto/qtokenautomaton/tokenizers/basic/basic.xml b/tests/auto/other/qtokenautomaton/tokenizers/basic/basic.xml similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/basic/basic.xml rename to tests/auto/other/qtokenautomaton/tokenizers/basic/basic.xml diff --git a/tests/auto/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp b/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp rename to tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.cpp diff --git a/tests/auto/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.h b/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.h similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.h rename to tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.h diff --git a/tests/auto/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.xml b/tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.xml similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.xml rename to tests/auto/other/qtokenautomaton/tokenizers/basicNamespace/basicNamespace.xml diff --git a/tests/auto/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp b/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp rename to tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.cpp diff --git a/tests/auto/qtokenautomaton/tokenizers/boilerplate/boilerplate.h b/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.h similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/boilerplate/boilerplate.h rename to tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.h diff --git a/tests/auto/qtokenautomaton/tokenizers/boilerplate/boilerplate.xml b/tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.xml similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/boilerplate/boilerplate.xml rename to tests/auto/other/qtokenautomaton/tokenizers/boilerplate/boilerplate.xml diff --git a/tests/auto/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp b/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp rename to tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.cpp diff --git a/tests/auto/qtokenautomaton/tokenizers/noNamespace/noNamespace.h b/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.h similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/noNamespace/noNamespace.h rename to tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.h diff --git a/tests/auto/qtokenautomaton/tokenizers/noNamespace/noNamespace.xml b/tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.xml similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/noNamespace/noNamespace.xml rename to tests/auto/other/qtokenautomaton/tokenizers/noNamespace/noNamespace.xml diff --git a/tests/auto/qtokenautomaton/tokenizers/noToString/noToString.cpp b/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/noToString/noToString.cpp rename to tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.cpp diff --git a/tests/auto/qtokenautomaton/tokenizers/noToString/noToString.h b/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.h similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/noToString/noToString.h rename to tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.h diff --git a/tests/auto/qtokenautomaton/tokenizers/noToString/noToString.xml b/tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.xml similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/noToString/noToString.xml rename to tests/auto/other/qtokenautomaton/tokenizers/noToString/noToString.xml diff --git a/tests/auto/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp b/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp rename to tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.cpp diff --git a/tests/auto/qtokenautomaton/tokenizers/withNamespace/withNamespace.h b/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.h similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/withNamespace/withNamespace.h rename to tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.h diff --git a/tests/auto/qtokenautomaton/tokenizers/withNamespace/withNamespace.xml b/tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.xml similarity index 100% rename from tests/auto/qtokenautomaton/tokenizers/withNamespace/withNamespace.xml rename to tests/auto/other/qtokenautomaton/tokenizers/withNamespace/withNamespace.xml diff --git a/tests/auto/qtokenautomaton/tst_qtokenautomaton.cpp b/tests/auto/other/qtokenautomaton/tst_qtokenautomaton.cpp similarity index 100% rename from tests/auto/qtokenautomaton/tst_qtokenautomaton.cpp rename to tests/auto/other/qtokenautomaton/tst_qtokenautomaton.cpp diff --git a/tests/auto/qabstractbutton/qabstractbutton.pro b/tests/auto/qabstractbutton/qabstractbutton.pro index 2e525857009..15d90ed4e14 100644 --- a/tests/auto/qabstractbutton/qabstractbutton.pro +++ b/tests/auto/qabstractbutton/qabstractbutton.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qabstractbutton.cpp diff --git a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/qabstractitemmodel/qabstractitemmodel.pro deleted file mode 100644 index 52c4e96f99e..00000000000 --- a/tests/auto/qabstractitemmodel/qabstractitemmodel.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) - -INCLUDEPATH += $$PWD/../modeltest - -SOURCES += tst_qabstractitemmodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp -HEADERS += ../modeltest/dynamictreemodel.h ../modeltest/modeltest.h - - - diff --git a/tests/auto/qabstractitemview/qabstractitemview.pro b/tests/auto/qabstractitemview/qabstractitemview.pro index 0d0d51c38ac..cae8ca086ec 100644 --- a/tests/auto/qabstractitemview/qabstractitemview.pro +++ b/tests/auto/qabstractitemview/qabstractitemview.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qabstractitemview.cpp - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qabstractprintdialog/qabstractprintdialog.pro b/tests/auto/qabstractprintdialog/qabstractprintdialog.pro index 8d9b1422902..fb72bbf7a97 100644 --- a/tests/auto/qabstractprintdialog/qabstractprintdialog.pro +++ b/tests/auto/qabstractprintdialog/qabstractprintdialog.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets printsupport SOURCES += tst_qabstractprintdialog.cpp - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qabstractproxymodel/qabstractproxymodel.pro b/tests/auto/qabstractproxymodel/qabstractproxymodel.pro index d1bff92543a..7a6a841796d 100644 --- a/tests/auto/qabstractproxymodel/qabstractproxymodel.pro +++ b/tests/auto/qabstractproxymodel/qabstractproxymodel.pro @@ -1,2 +1,3 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qabstractproxymodel.cpp diff --git a/tests/auto/qabstractscrollarea/qabstractscrollarea.pro b/tests/auto/qabstractscrollarea/qabstractscrollarea.pro index 9e7b6e0f95c..e4bc3f64951 100644 --- a/tests/auto/qabstractscrollarea/qabstractscrollarea.pro +++ b/tests/auto/qabstractscrollarea/qabstractscrollarea.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qabstractscrollarea.cpp diff --git a/tests/auto/qabstractslider/qabstractslider.pro b/tests/auto/qabstractslider/qabstractslider.pro index 13a2e873a97..4507859acea 100644 --- a/tests/auto/qabstractslider/qabstractslider.pro +++ b/tests/auto/qabstractslider/qabstractslider.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qabstractslider.cpp diff --git a/tests/auto/qabstractspinbox/qabstractspinbox.pro b/tests/auto/qabstractspinbox/qabstractspinbox.pro index 293eff3c0f4..e156b2493db 100644 --- a/tests/auto/qabstractspinbox/qabstractspinbox.pro +++ b/tests/auto/qabstractspinbox/qabstractspinbox.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qabstractspinbox.cpp diff --git a/tests/auto/qaccessibility/qaccessibility.pro b/tests/auto/qaccessibility/qaccessibility.pro index 75fd1e9793a..ae046cc3c31 100644 --- a/tests/auto/qaccessibility/qaccessibility.pro +++ b/tests/auto/qaccessibility/qaccessibility.pro @@ -1,5 +1,6 @@ load(qttest_p4) requires(contains(QT_CONFIG,accessibility)) +QT += widgets SOURCES += tst_qaccessibility.cpp unix:!mac:LIBS+=-lm diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index d8aa3825481..00999bd6b00 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -46,6 +46,10 @@ #include <QtGui> #include <math.h> +#if defined(Q_OS_WIN) && defined(interface) +# undef interface +#endif + #include "QtTest/qtestaccessible.h" diff --git a/tests/auto/qaccessibility_mac/qaccessibility_mac.pro b/tests/auto/qaccessibility_mac/qaccessibility_mac.pro index 47f72d1cdbe..21b6225865e 100644 --- a/tests/auto/qaccessibility_mac/qaccessibility_mac.pro +++ b/tests/auto/qaccessibility_mac/qaccessibility_mac.pro @@ -18,6 +18,6 @@ exists($$(QTDIR)/tools/designer/src/lib/uilib/uilib.pri) { } else { CONFIG += uitools } -QT += xml +QT += xml widgets LIBS += -framework ApplicationServices -framework Carbon diff --git a/tests/auto/qaction/qaction.pro b/tests/auto/qaction/qaction.pro index a129cd66acf..9c3648d52fa 100644 --- a/tests/auto/qaction/qaction.pro +++ b/tests/auto/qaction/qaction.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qaction.cpp diff --git a/tests/auto/qactiongroup/qactiongroup.pro b/tests/auto/qactiongroup/qactiongroup.pro index d4688156749..9b8636968b3 100644 --- a/tests/auto/qactiongroup/qactiongroup.pro +++ b/tests/auto/qactiongroup/qactiongroup.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qactiongroup.cpp diff --git a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro index 3193764709f..3e00e082950 100644 --- a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro +++ b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro @@ -11,6 +11,7 @@ wince*:TARGET = ../desktopsettingsaware symbian:TARGET = desktopsettingsaware # Input +QT += widgets SOURCES += main.cpp CONFIG += qt warn_on create_prl link_prl CONFIG -= app_bundle diff --git a/tests/auto/qapplication/modal/modal.pro b/tests/auto/qapplication/modal/modal.pro index 836f6ffab0e..9ed69769bb4 100644 --- a/tests/auto/qapplication/modal/modal.pro +++ b/tests/auto/qapplication/modal/modal.pro @@ -1,4 +1,5 @@ TEMPLATE = app +QT += widgets TARGET = DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/auto/qapplication/test/test.pro b/tests/auto/qapplication/test/test.pro index de11e886832..e97982dcfa5 100644 --- a/tests/auto/qapplication/test/test.pro +++ b/tests/auto/qapplication/test/test.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += ../tst_qapplication.cpp @@ -32,3 +33,5 @@ win32 { } mac*:CONFIG+=insignificant_test + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qapplication/wincmdline/wincmdline.pro b/tests/auto/qapplication/wincmdline/wincmdline.pro index 8a8ca3d6b34..3ba8f481673 100644 --- a/tests/auto/qapplication/wincmdline/wincmdline.pro +++ b/tests/auto/qapplication/wincmdline/wincmdline.pro @@ -2,6 +2,7 @@ TEMPLATE = app TARGET = DEPENDPATH += . INCLUDEPATH += . +QT += widgets SOURCES += main.cpp diff --git a/tests/auto/qboxlayout/qboxlayout.pro b/tests/auto/qboxlayout/qboxlayout.pro index 3195f4dc9ba..c37f12f74f9 100644 --- a/tests/auto/qboxlayout/qboxlayout.pro +++ b/tests/auto/qboxlayout/qboxlayout.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qboxlayout.cpp diff --git a/tests/auto/qbuttongroup/qbuttongroup.pro b/tests/auto/qbuttongroup/qbuttongroup.pro index 4f8b2113b10..6f506e8f06d 100644 --- a/tests/auto/qbuttongroup/qbuttongroup.pro +++ b/tests/auto/qbuttongroup/qbuttongroup.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qbuttongroup.cpp diff --git a/tests/auto/qcalendarwidget/qcalendarwidget.pro b/tests/auto/qcalendarwidget/qcalendarwidget.pro index 62b137b3475..d250b83537b 100644 --- a/tests/auto/qcalendarwidget/qcalendarwidget.pro +++ b/tests/auto/qcalendarwidget/qcalendarwidget.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qcalendarwidget.cpp diff --git a/tests/auto/qcheckbox/qcheckbox.pro b/tests/auto/qcheckbox/qcheckbox.pro index c2fee481337..aa1f35b3c99 100644 --- a/tests/auto/qcheckbox/qcheckbox.pro +++ b/tests/auto/qcheckbox/qcheckbox.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qcheckbox.cpp diff --git a/tests/auto/qcolordialog/qcolordialog.pro b/tests/auto/qcolordialog/qcolordialog.pro index 830f9fafe28..4f195dac2ba 100644 --- a/tests/auto/qcolordialog/qcolordialog.pro +++ b/tests/auto/qcolordialog/qcolordialog.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qcolordialog.cpp diff --git a/tests/auto/qcolumnview/qcolumnview.pro b/tests/auto/qcolumnview/qcolumnview.pro index e36df030c23..bca9e75ba5e 100644 --- a/tests/auto/qcolumnview/qcolumnview.pro +++ b/tests/auto/qcolumnview/qcolumnview.pro @@ -1,4 +1,5 @@ CONFIG += qttest_p4 +QT += widgets widgets-private QT += gui-private core-private SOURCES += tst_qcolumnview.cpp diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp index 7f6d43a45b6..493e9202621 100644 --- a/tests/auto/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/qcolumnview/tst_qcolumnview.cpp @@ -44,9 +44,9 @@ #include <qstandarditemmodel.h> #include <qitemdelegate.h> #include <qcolumnview.h> -#include "../../../src/gui/itemviews/qcolumnviewgrip_p.h" +#include "../../../src/widgets/itemviews/qcolumnviewgrip_p.h" #ifndef Q_OS_SYMBIAN -#include "../../../src/gui/dialogs/qfilesystemmodel_p.h" +#include "../../../src/widgets/dialogs/qfilesystemmodel_p.h" #endif #include <qdirmodel.h> #include <qstringlistmodel.h> diff --git a/tests/auto/qcombobox/qcombobox.pro b/tests/auto/qcombobox/qcombobox.pro index a8f0e6ad23c..18b28267106 100644 --- a/tests/auto/qcombobox/qcombobox.pro +++ b/tests/auto/qcombobox/qcombobox.pro @@ -1,4 +1,5 @@ load(qttest_p4) -QT += gui-private core-private +QT += widgets widgets-private gui-private core-private SOURCES += tst_qcombobox.cpp +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 137438b3ef9..0e6d4b5f94e 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2163,8 +2163,8 @@ void tst_QComboBox::task247863_keyBoardSelection() qApp->setEffectEnabled(Qt::UI_AnimateCombo, false); QTest::keyClick(&combo, Qt::Key_Space); qApp->setEffectEnabled(Qt::UI_AnimateCombo, true); - QTest::keyClick(0, Qt::Key_Down); - QTest::keyClick(0, Qt::Key_Enter); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Down); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Enter); QCOMPARE(combo.currentText(), QLatin1String("222")); QCOMPARE(spy.count(), 1); } @@ -2528,7 +2528,7 @@ void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated() cb.setFocus(); QApplication::processEvents(); QTRY_VERIFY(cb.hasFocus()); - QTest::keyClick(0, '1'); + QTest::keyClick(static_cast<QWindow *>(0), '1'); QCOMPARE(spy.count(), 0); edit.setFocus(); QTRY_VERIFY(edit.hasFocus()); diff --git a/tests/auto/qcommandlinkbutton/qcommandlinkbutton.pro b/tests/auto/qcommandlinkbutton/qcommandlinkbutton.pro index db3a336c364..497b8298a2e 100644 --- a/tests/auto/qcommandlinkbutton/qcommandlinkbutton.pro +++ b/tests/auto/qcommandlinkbutton/qcommandlinkbutton.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qcommandlinkbutton.cpp diff --git a/tests/auto/qcompleter/qcompleter.pro b/tests/auto/qcompleter/qcompleter.pro index bd352d819c8..cde64ec6728 100644 --- a/tests/auto/qcompleter/qcompleter.pro +++ b/tests/auto/qcompleter/qcompleter.pro @@ -1,6 +1,7 @@ load(qttest_p4) TEMPLATE = app TARGET = tst_qcompleter +QT += widgets DEPENDPATH += . INCLUDEPATH += . .. diff --git a/tests/auto/qcomplextext/qcomplextext.pro b/tests/auto/qcomplextext/qcomplextext.pro index bd85daa6b46..b3d83082421 100644 --- a/tests/auto/qcomplextext/qcomplextext.pro +++ b/tests/auto/qcomplextext/qcomplextext.pro @@ -1,6 +1,7 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qcomplextext.cpp INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qdatawidgetmapper/qdatawidgetmapper.pro b/tests/auto/qdatawidgetmapper/qdatawidgetmapper.pro index d8e0cd043c1..64e3b572913 100644 --- a/tests/auto/qdatawidgetmapper/qdatawidgetmapper.pro +++ b/tests/auto/qdatawidgetmapper/qdatawidgetmapper.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qdatawidgetmapper.cpp diff --git a/tests/auto/qdatetimeedit/qdatetimeedit.pro b/tests/auto/qdatetimeedit/qdatetimeedit.pro index 19e92d01551..47356d448c4 100644 --- a/tests/auto/qdatetimeedit/qdatetimeedit.pro +++ b/tests/auto/qdatetimeedit/qdatetimeedit.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qdatetimeedit.cpp wincewm50smart-msvc2005: DEFINES += WINCE_NO_MODIFIER_KEYS diff --git a/tests/auto/qdesktopwidget/qdesktopwidget.pro b/tests/auto/qdesktopwidget/qdesktopwidget.pro index bc287c09b0e..730b273c4f3 100644 --- a/tests/auto/qdesktopwidget/qdesktopwidget.pro +++ b/tests/auto/qdesktopwidget/qdesktopwidget.pro @@ -1,5 +1,3 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qdesktopwidget.cpp - - - diff --git a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp index e11fbf09c35..fc696443a1e 100644 --- a/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp +++ b/tests/auto/qdesktopwidget/tst_qdesktopwidget.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> -#include <QtGui/QDesktopWidget> +#include <QtWidgets/QDesktopWidget> #include <QDebug> //TESTED_CLASS= diff --git a/tests/auto/qdial/qdial.pro b/tests/auto/qdial/qdial.pro index 7cd245e6a90..acf66de4308 100644 --- a/tests/auto/qdial/qdial.pro +++ b/tests/auto/qdial/qdial.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qdial.cpp diff --git a/tests/auto/qdialog/qdialog.pro b/tests/auto/qdialog/qdialog.pro index 161a6b47f12..a3596b60f66 100644 --- a/tests/auto/qdialog/qdialog.pro +++ b/tests/auto/qdialog/qdialog.pro @@ -1,2 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qdialog.cpp + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qdialogbuttonbox/qdialogbuttonbox.pro b/tests/auto/qdialogbuttonbox/qdialogbuttonbox.pro index 70b65f644e8..efbeca0c1b5 100644 --- a/tests/auto/qdialogbuttonbox/qdialogbuttonbox.pro +++ b/tests/auto/qdialogbuttonbox/qdialogbuttonbox.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qdialogbuttonbox.cpp TARGET = tst_qdialogbuttonbox diff --git a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp index 13ecd90bd3b..def5e605492 100644 --- a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp +++ b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ #include <QtTest/QtTest> -#include <QtGui/QPushButton> -#include <QtGui/QStyle> -#include <QtGui/QLayout> -#include <QtGui/QDialog> -#include <QtGui/QAction> +#include <QtWidgets/QPushButton> +#include <QtWidgets/QStyle> +#include <QtWidgets/QLayout> +#include <QtWidgets/QDialog> +#include <QtWidgets/QAction> #include <qdialogbuttonbox.h> #include <limits.h> diff --git a/tests/auto/qdirectpainter/test/test.pro b/tests/auto/qdirectpainter/test/test.pro index 6d820b15855..3621e11fa97 100644 --- a/tests/auto/qdirectpainter/test/test.pro +++ b/tests/auto/qdirectpainter/test/test.pro @@ -1,5 +1,5 @@ load(qttest_p4) - +QT += widgets SOURCES += ../tst_qdirectpainter.cpp TARGET = ../tst_qdirectpainter diff --git a/tests/auto/qdirmodel/qdirmodel.pro b/tests/auto/qdirmodel/qdirmodel.pro index 7037a799340..7c0409334ca 100644 --- a/tests/auto/qdirmodel/qdirmodel.pro +++ b/tests/auto/qdirmodel/qdirmodel.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qdirmodel.cpp wince*|symbian { diff --git a/tests/auto/qdockwidget/qdockwidget.pro b/tests/auto/qdockwidget/qdockwidget.pro index 5f92e5db192..e59728207fd 100644 --- a/tests/auto/qdockwidget/qdockwidget.pro +++ b/tests/auto/qdockwidget/qdockwidget.pro @@ -1,8 +1,7 @@ load(qttest_p4) - +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qdockwidget.cpp - - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qdoublespinbox/qdoublespinbox.pro b/tests/auto/qdoublespinbox/qdoublespinbox.pro index 3aec0de68e3..ff0eb2edae8 100644 --- a/tests/auto/qdoublespinbox/qdoublespinbox.pro +++ b/tests/auto/qdoublespinbox/qdoublespinbox.pro @@ -1,5 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qdoublespinbox.cpp - - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index 355b22f224c..e0b6dc98a58 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -1080,7 +1080,7 @@ void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate() QTRY_COMPARE(static_cast<QWidget *>(&spinbox), QApplication::activeWindow()); QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); spinbox.lineEdit()->setCursorPosition(2); //just after the first thousand separator - QTest::keyClick(0, Qt::Key_0); // let's insert a 0 + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_0); // let's insert a 0 QCOMPARE(spinbox.value(), 10000.); spinbox.clearFocus(); //make sure the value is correctly formatted QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); diff --git a/tests/auto/qdoublevalidator/qdoublevalidator.pro b/tests/auto/qdoublevalidator/qdoublevalidator.pro index 1fe3f7b838e..7fbb72bb7f6 100644 --- a/tests/auto/qdoublevalidator/qdoublevalidator.pro +++ b/tests/auto/qdoublevalidator/qdoublevalidator.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qdoublevalidator.cpp diff --git a/tests/auto/qerrormessage/qerrormessage.pro b/tests/auto/qerrormessage/qerrormessage.pro index 1c24aa83cb7..363d085cbf5 100644 --- a/tests/auto/qerrormessage/qerrormessage.pro +++ b/tests/auto/qerrormessage/qerrormessage.pro @@ -4,5 +4,7 @@ TARGET = tst_qerrormessage DEPENDPATH += . INCLUDEPATH += . +QT += widgets + # Input SOURCES += tst_qerrormessage.cpp diff --git a/tests/auto/qfiledialog/qfiledialog.pro b/tests/auto/qfiledialog/qfiledialog.pro index ec93f12a951..2bf215bbba3 100644 --- a/tests/auto/qfiledialog/qfiledialog.pro +++ b/tests/auto/qfiledialog/qfiledialog.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qfiledialog.cpp diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 81da8a3f624..d9fd736e096 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -62,9 +62,9 @@ #include <qlayout.h> #include "../../shared/util.h" #if defined QT_BUILD_INTERNAL -#include "../../../src/gui/dialogs/qsidebar_p.h" -#include "../../../src/gui/dialogs/qfilesystemmodel_p.h" -#include "../../../src/gui/dialogs/qfiledialog_p.h" +#include "../../../src/widgets/dialogs/qsidebar_p.h" +#include "../../../src/widgets/dialogs/qfilesystemmodel_p.h" +#include "../../../src/widgets/dialogs/qfiledialog_p.h" #endif #include <QFileDialog> #include <QFileSystemModel> diff --git a/tests/auto/qfiledialog2/qfiledialog2.pro b/tests/auto/qfiledialog2/qfiledialog2.pro index 5d1d72195d9..14de040ec54 100644 --- a/tests/auto/qfiledialog2/qfiledialog2.pro +++ b/tests/auto/qfiledialog2/qfiledialog2.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qfiledialog2.cpp diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp index afa2e8f64aa..085bdbc80ea 100644 --- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp @@ -61,9 +61,9 @@ #include <qlineedit.h> #include <qlayout.h> #include "../../shared/util.h" -#include "../../../src/gui/dialogs/qsidebar_p.h" -#include "../../../src/gui/dialogs/qfilesystemmodel_p.h" -#include "../../../src/gui/dialogs/qfiledialog_p.h" +#include "../../../src/widgets/dialogs/qsidebar_p.h" +#include "../../../src/widgets/dialogs/qfilesystemmodel_p.h" +#include "../../../src/widgets/dialogs/qfiledialog_p.h" #include "../network-settings.h" diff --git a/tests/auto/qfileiconprovider/qfileiconprovider.pro b/tests/auto/qfileiconprovider/qfileiconprovider.pro index 3bf83ae5da7..1e3d26de00e 100644 --- a/tests/auto/qfileiconprovider/qfileiconprovider.pro +++ b/tests/auto/qfileiconprovider/qfileiconprovider.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qfileiconprovider.cpp diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro index ab121306e31..b0b6d7a18d1 100644 --- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro @@ -1,6 +1,7 @@ CONFIG += qttest_p4 -QT = core-private gui +QT += widgets widgets-private +QT += core-private gui SOURCES += tst_qfilesystemmodel.cpp TARGET = tst_qfilesystemmodel diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp index 5afcf408000..a9a4fc7fc3a 100644 --- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -42,7 +42,7 @@ #include <QtTest/QtTest> #ifdef QT_BUILD_INTERNAL -#include "../../../src/gui/dialogs/qfilesystemmodel_p.h" +#include "../../../src/widgets/dialogs/qfilesystemmodel_p.h" #endif #include <QFileSystemModel> #include <QFileIconProvider> diff --git a/tests/auto/qfocusevent/qfocusevent.pro b/tests/auto/qfocusevent/qfocusevent.pro index 851d6161735..e709a547ec5 100644 --- a/tests/auto/qfocusevent/qfocusevent.pro +++ b/tests/auto/qfocusevent/qfocusevent.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qfocusevent.cpp CONFIG+=insignificant_test diff --git a/tests/auto/qfocusframe/qfocusframe.pro b/tests/auto/qfocusframe/qfocusframe.pro index afb7206b000..0fcc9bf23d9 100644 --- a/tests/auto/qfocusframe/qfocusframe.pro +++ b/tests/auto/qfocusframe/qfocusframe.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qfocusframe.cpp diff --git a/tests/auto/qfontcombobox/qfontcombobox.pro b/tests/auto/qfontcombobox/qfontcombobox.pro index b7d32f54847..7faa0e36bdc 100644 --- a/tests/auto/qfontcombobox/qfontcombobox.pro +++ b/tests/auto/qfontcombobox/qfontcombobox.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qfontcombobox.cpp - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qfontdialog/qfontdialog.pro b/tests/auto/qfontdialog/qfontdialog.pro index 656c4d12f8f..e4ad2f1a413 100644 --- a/tests/auto/qfontdialog/qfontdialog.pro +++ b/tests/auto/qfontdialog/qfontdialog.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qfontdialog.cpp diff --git a/tests/auto/qformlayout/qformlayout.pro b/tests/auto/qformlayout/qformlayout.pro index baeb6741ca8..24c452af9ff 100644 --- a/tests/auto/qformlayout/qformlayout.pro +++ b/tests/auto/qformlayout/qformlayout.pro @@ -1,2 +1,3 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qformlayout.cpp diff --git a/tests/auto/qformlayout/tst_qformlayout.cpp b/tests/auto/qformlayout/tst_qformlayout.cpp index 8da79ef60a8..f35933d0dc8 100644 --- a/tests/auto/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/qformlayout/tst_qformlayout.cpp @@ -46,9 +46,8 @@ #include <qwidget.h> #include <qwindowsstyle.h> #include <qsizepolicy.h> -#include <QtGui> -#include <QtGui/QWindowsStyle> +#include <QtWidgets/QWindowsStyle> #include <QStyleFactory> #include <qformlayout.h> diff --git a/tests/auto/qfreelist/qfreelist.pro b/tests/auto/qfreelist/qfreelist.pro deleted file mode 100644 index b7f2b3d38f0..00000000000 --- a/tests/auto/qfreelist/qfreelist.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -SOURCES += tst_qfreelist.cpp -QT += core-private -QT -= gui - -!private_tests:SOURCES += $$QT_SOURCE_TREE/src/corelib/tools/qfreelist.cpp diff --git a/tests/auto/qgl/qgl.qrc b/tests/auto/qgl/qgl.qrc deleted file mode 100644 index 653794a166d..00000000000 --- a/tests/auto/qgl/qgl.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file alias="designer.png">../qpixmap/images/designer.png</file> -</qresource> -</RCC> diff --git a/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro index e1829b0b6b2..5aa2936e3e1 100644 --- a/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro +++ b/tests/auto/qgraphicsanchorlayout/qgraphicsanchorlayout.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgraphicsanchorlayout.cpp CONFIG += parallel_test diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 5987f4a8a37..5dbe501ea87 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -40,12 +40,13 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include <QtGui/qgraphicsanchorlayout.h> +#include <QtWidgets/qgraphicsanchorlayout.h> #include <private/qgraphicsanchorlayout_p.h> -#include <QtGui/qgraphicswidget.h> -#include <QtGui/qgraphicsproxywidget.h> -#include <QtGui/qgraphicsview.h> -#include <QtGui/qwindowsstyle.h> +#include <QtWidgets/qgraphicswidget.h> +#include <QtWidgets/qgraphicsproxywidget.h> +#include <QtWidgets/qgraphicsview.h> +#include <QtWidgets/qwindowsstyle.h> + class tst_QGraphicsAnchorLayout : public QObject { Q_OBJECT @@ -209,13 +210,13 @@ void tst_QGraphicsAnchorLayout::simple() void tst_QGraphicsAnchorLayout::simple_center() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(50, 10); - QSizeF max(100, 10); + QSizeF maxSize(100, 10); - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "c"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); @@ -257,14 +258,14 @@ void tst_QGraphicsAnchorLayout::simple_semifloat() // Useful for testing simplification between A_left and B_left. // Unfortunately the only way to really test that now is to manually inspect the // simplified graph. - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(50, 10); - QSizeF max(100, 10); + QSizeF maxSize(100, 10); - QGraphicsWidget *A = createItem(min, pref, max, "A"); - QGraphicsWidget *B = createItem(min, pref, max, "B"); - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); + QGraphicsWidget *A = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *B = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); @@ -303,13 +304,13 @@ void tst_QGraphicsAnchorLayout::simple_semifloat() void tst_QGraphicsAnchorLayout::layoutDirection() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(50, 10); - QSizeF max(100, 10); + QSizeF maxSize(100, 10); - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, QSizeF(100, 20), "c"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b"); + QGraphicsWidget *c = createItem(minSize, pref, QSizeF(100, 20), "c"); a->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); b->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); @@ -358,15 +359,15 @@ void tst_QGraphicsAnchorLayout::layoutDirection() void tst_QGraphicsAnchorLayout::diagonal() { - QSizeF min(10, 100); + QSizeF minSize(10, 100); QSizeF pref(70, 100); - QSizeF max(100, 100); + QSizeF maxSize(100, 100); - QGraphicsWidget *a = createItem(min, pref, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); - QGraphicsWidget *c = createItem(min, pref, max, "C"); - QGraphicsWidget *d = createItem(min, pref, max, "D"); - QGraphicsWidget *e = createItem(min, pref, max, "E"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C"); + QGraphicsWidget *d = createItem(minSize, pref, maxSize, "D"); + QGraphicsWidget *e = createItem(minSize, pref, maxSize, "E"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); @@ -902,12 +903,12 @@ void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections() void tst_QGraphicsAnchorLayout::proportionalPreferred() { - QSizeF min(0, 100); + QSizeF minSize(0, 100); - QGraphicsWidget *a = createItem(min, QSizeF(10, 100), QSizeF(20, 100), "A"); - QGraphicsWidget *b = createItem(min, QSizeF(20, 100), QSizeF(30, 100), "B"); - QGraphicsWidget *c = createItem(min, QSizeF(14, 100), QSizeF(20, 100), "C"); - QGraphicsWidget *d = createItem(min, QSizeF(10, 100), QSizeF(20, 100), "D"); + QGraphicsWidget *a = createItem(minSize, QSizeF(10, 100), QSizeF(20, 100), "A"); + QGraphicsWidget *b = createItem(minSize, QSizeF(20, 100), QSizeF(30, 100), "B"); + QGraphicsWidget *c = createItem(minSize, QSizeF(14, 100), QSizeF(20, 100), "C"); + QGraphicsWidget *d = createItem(minSize, QSizeF(10, 100), QSizeF(20, 100), "D"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); @@ -969,17 +970,17 @@ void tst_QGraphicsAnchorLayout::proportionalPreferred() void tst_QGraphicsAnchorLayout::example() { - QSizeF min(30, 100); + QSizeF minSize(30, 100); QSizeF pref(210, 100); - QSizeF max(300, 100); + QSizeF maxSize(300, 100); - QGraphicsWidget *a = createItem(min, pref, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); - QGraphicsWidget *c = createItem(min, pref, max, "C"); - QGraphicsWidget *d = createItem(min, pref, max, "D"); - QGraphicsWidget *e = createItem(min, pref, max, "E"); - QGraphicsWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), max, "F"); - QGraphicsWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), max, "G"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C"); + QGraphicsWidget *d = createItem(minSize, pref, maxSize, "D"); + QGraphicsWidget *e = createItem(minSize, pref, maxSize, "E"); + QGraphicsWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), maxSize, "F"); + QGraphicsWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), maxSize, "G"); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); @@ -1057,13 +1058,13 @@ void tst_QGraphicsAnchorLayout::example() void tst_QGraphicsAnchorLayout::setSpacing() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(20, 20); - QSizeF max(50, 50); + QSizeF maxSize(50, 50); - QGraphicsWidget *a = createItem(min, pref, max); - QGraphicsWidget *b = createItem(min, pref, max); - QGraphicsWidget *c = createItem(min, pref, max); + QGraphicsWidget *a = createItem(minSize, pref, maxSize); + QGraphicsWidget *b = createItem(minSize, pref, maxSize); + QGraphicsWidget *c = createItem(minSize, pref, maxSize); QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->addCornerAnchors(l, Qt::TopLeftCorner, a, Qt::TopLeftCorner); @@ -1199,9 +1200,9 @@ int CustomLayoutStyle::pixelMetric(PixelMetric metric, const QStyleOption * opti void tst_QGraphicsAnchorLayout::styleDefaults() { - QSizeF min (10, 10); + QSizeF minSize (10, 10); QSizeF pref(20, 20); - QSizeF max (50, 50); + QSizeF maxSize (50, 50); /* create this layout, where a,b have controlType QSizePolicy::RadioButton @@ -1214,20 +1215,20 @@ void tst_QGraphicsAnchorLayout::styleDefaults() +-------+ */ QGraphicsScene scene; - QGraphicsWidget *a = createItem(min, pref, max); + QGraphicsWidget *a = createItem(minSize, pref, maxSize); QSizePolicy spRadioButton = a->sizePolicy(); spRadioButton.setControlType(QSizePolicy::RadioButton); a->setSizePolicy(spRadioButton); - QGraphicsWidget *b = createItem(min, pref, max); + QGraphicsWidget *b = createItem(minSize, pref, maxSize); b->setSizePolicy(spRadioButton); - QGraphicsWidget *c = createItem(min, pref, max); + QGraphicsWidget *c = createItem(minSize, pref, maxSize); QSizePolicy spPushButton = c->sizePolicy(); spPushButton.setControlType(QSizePolicy::PushButton); c->setSizePolicy(spPushButton); - QGraphicsWidget *d = createItem(min, pref, max); + QGraphicsWidget *d = createItem(minSize, pref, maxSize); d->setSizePolicy(spPushButton); QGraphicsWidget *window = new QGraphicsWidget(0, Qt::Window); @@ -1301,17 +1302,17 @@ static QGraphicsAnchorLayout *createAmbiguousS60Layout() l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); - QSizeF min(0, 10); + QSizeF minSize(0, 10); QSizeF pref(50, 10); - QSizeF max(100, 10); + QSizeF maxSize(100, 10); - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); - QGraphicsWidget *d = createItem(min, pref, max, "d"); - QGraphicsWidget *e = createItem(min, pref, max, "e"); - QGraphicsWidget *f = createItem(min, pref, max, "f"); - QGraphicsWidget *g = createItem(min, pref, max, "g"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "c"); + QGraphicsWidget *d = createItem(minSize, pref, maxSize, "d"); + QGraphicsWidget *e = createItem(minSize, pref, maxSize, "e"); + QGraphicsWidget *f = createItem(minSize, pref, maxSize, "f"); + QGraphicsWidget *g = createItem(minSize, pref, maxSize, "g"); //<!-- Trunk --> setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 10); @@ -1681,15 +1682,15 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes() l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(50, 10); - QSizeF max(QWIDGETSIZE_MAX, 10); + QSizeF maxSize(QWIDGETSIZE_MAX, 10); - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); - QGraphicsWidget *d = createItem(min, pref, max, "d"); - QGraphicsWidget *e = createItem(min, pref, max, "e"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "a"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "b"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "c"); + QGraphicsWidget *d = createItem(minSize, pref, maxSize, "d"); + QGraphicsWidget *e = createItem(minSize, pref, maxSize, "e"); //<!-- Trunk --> setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); @@ -1781,13 +1782,13 @@ void tst_QGraphicsAnchorLayout::simplifiableUnfeasible() */ void tst_QGraphicsAnchorLayout::simplificationVsOrder() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(20, 10); - QSizeF max(50, 10); + QSizeF maxSize(50, 10); - QGraphicsWidget *a = createItem(min, pref, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); - QGraphicsWidget *c = createItem(min, pref, max, "C"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C"); QGraphicsWidget frame; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&frame); @@ -1822,12 +1823,12 @@ void tst_QGraphicsAnchorLayout::simplificationVsOrder() void tst_QGraphicsAnchorLayout::parallelSimplificationOfCenter() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(20, 10); - QSizeF max(50, 10); + QSizeF maxSize(50, 10); - QGraphicsWidget *a = createItem(min, pref, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); QGraphicsWidget parent; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&parent); @@ -1851,13 +1852,13 @@ void tst_QGraphicsAnchorLayout::parallelSimplificationOfCenter() */ void tst_QGraphicsAnchorLayout::simplificationVsRedundance() { - QSizeF min(10, 10); + QSizeF minSize(10, 10); QSizeF pref(20, 10); - QSizeF max(50, 30); + QSizeF maxSize(50, 30); - QGraphicsWidget *a = createItem(min, pref, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); - QGraphicsWidget *c = createItem(min, pref, max, "C"); + QGraphicsWidget *a = createItem(minSize, pref, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *c = createItem(minSize, pref, maxSize, "C"); QGraphicsWidget frame; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&frame); @@ -1916,13 +1917,13 @@ void tst_QGraphicsAnchorLayout::spacingPersistency() */ void tst_QGraphicsAnchorLayout::snakeParallelWithLayout() { - QSizeF min(10, 20); + QSizeF minSize(10, 20); QSizeF pref(50, 20); - QSizeF max(100, 20); + QSizeF maxSize(100, 20); - QGraphicsWidget *a = createItem(max, max, max, "A"); - QGraphicsWidget *b = createItem(min, pref, max, "B"); - QGraphicsWidget *c = createItem(max, max, max, "C"); + QGraphicsWidget *a = createItem(maxSize, maxSize, maxSize, "A"); + QGraphicsWidget *b = createItem(minSize, pref, maxSize, "B"); + QGraphicsWidget *c = createItem(maxSize, maxSize, maxSize, "C"); QGraphicsWidget parent; QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&parent); @@ -1944,9 +1945,9 @@ void tst_QGraphicsAnchorLayout::snakeParallelWithLayout() // Note that A and C are fixed in the maximum size QCOMPARE(l->geometry(), QRectF(QPointF(0, 0), QSizeF(150, 60))); - QCOMPARE(a->geometry(), QRectF(QPointF(0, 0), max)); + QCOMPARE(a->geometry(), QRectF(QPointF(0, 0), maxSize)); QCOMPARE(b->geometry(), QRectF(QPointF(50, 20), pref)); - QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), max)); + QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), maxSize)); // Then, we change the "snake" to be in parallel with half of the layout delete l->anchor(c, Qt::AnchorRight, l, Qt::AnchorRight); @@ -1955,9 +1956,9 @@ void tst_QGraphicsAnchorLayout::snakeParallelWithLayout() parent.resize(l->effectiveSizeHint(Qt::PreferredSize)); QCOMPARE(l->geometry(), QRectF(QPointF(0, 0), QSizeF(300, 60))); - QCOMPARE(a->geometry(), QRectF(QPointF(0, 0), max)); + QCOMPARE(a->geometry(), QRectF(QPointF(0, 0), maxSize)); QCOMPARE(b->geometry(), QRectF(QPointF(50, 20), pref)); - QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), max)); + QCOMPARE(c->geometry(), QRectF(QPointF(50, 40), maxSize)); } /* diff --git a/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro b/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro index 535de0c07e4..bcad43fc122 100644 --- a/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro +++ b/tests/auto/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgraphicsanchorlayout1.cpp CONFIG += parallel_test diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index 4329f1350b1..05f08e87194 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -43,7 +43,7 @@ #include <QtTest/QtTest> #include <QTest> #include <QMetaType> -#include <QtGui/qgraphicsanchorlayout.h> +#include <QtWidgets/qgraphicsanchorlayout.h> #include <private/qgraphicsanchorlayout_p.h> #define TEST_COMPLEX_CASES diff --git a/tests/auto/qgraphicseffect/qgraphicseffect.pro b/tests/auto/qgraphicseffect/qgraphicseffect.pro index db69e19cac5..d0d1f11d0c0 100644 --- a/tests/auto/qgraphicseffect/qgraphicseffect.pro +++ b/tests/auto/qgraphicseffect/qgraphicseffect.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgraphicseffect.cpp diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index 1f5563c6b7b..334406272e7 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -41,13 +41,13 @@ #include <QtTest/QtTest> -#include <QtGui/qdesktopwidget.h> -#include <QtGui/qgraphicseffect.h> -#include <QtGui/qgraphicsview.h> -#include <QtGui/qgraphicsscene.h> -#include <QtGui/qgraphicsitem.h> -#include <QtGui/qgraphicswidget.h> -#include <QtGui/qstyleoption.h> +#include <QtWidgets/qdesktopwidget.h> +#include <QtWidgets/qgraphicseffect.h> +#include <QtWidgets/qgraphicsview.h> +#include <QtWidgets/qgraphicsscene.h> +#include <QtWidgets/qgraphicsitem.h> +#include <QtWidgets/qgraphicswidget.h> +#include <QtWidgets/qstyleoption.h> #include "../../shared/util.h" #include <private/qgraphicseffect_p.h> @@ -533,8 +533,8 @@ public: void draw(QPainter *painter) { - QVERIFY(sourcePixmap(Qt::LogicalCoordinates).pixmapData() == pixmap.pixmapData()); - QVERIFY((painter->worldTransform().type() <= QTransform::TxTranslate) == (sourcePixmap(Qt::DeviceCoordinates).pixmapData() == pixmap.pixmapData())); + QVERIFY(sourcePixmap(Qt::LogicalCoordinates).handle() == pixmap.handle()); + QVERIFY((painter->worldTransform().type() <= QTransform::TxTranslate) == (sourcePixmap(Qt::DeviceCoordinates).handle() == pixmap.handle())); ++repaints; } @@ -688,18 +688,18 @@ void tst_QGraphicsEffect::childrenVisibilityShouldInvalidateCache() view.show(); QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(parent.nbPaint, 1); + QTRY_VERIFY(parent.nbPaint >= 1); //we set an effect on the parent parent.setGraphicsEffect(new QGraphicsDropShadowEffect(&parent)); //flush the events QApplication::processEvents(); //new effect applied->repaint - QCOMPARE(parent.nbPaint, 2); + QVERIFY(parent.nbPaint >= 2); child.setVisible(true); //flush the events QApplication::processEvents(); //a new child appears we need to redraw the effect. - QCOMPARE(parent.nbPaint, 3); + QVERIFY(parent.nbPaint >= 3); } void tst_QGraphicsEffect::prepareGeometryChangeInvalidateCache() @@ -716,7 +716,7 @@ void tst_QGraphicsEffect::prepareGeometryChangeInvalidateCache() else view.show(); QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(item->nbPaint, 1); + QTRY_VERIFY(item->nbPaint >= 1); item->nbPaint = 0; item->setGraphicsEffect(new QGraphicsDropShadowEffect); @@ -747,7 +747,7 @@ void tst_QGraphicsEffect::itemHasNoContents() QGraphicsView view(&scene); view.show(); QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(child->nbPaint, 1); + QTRY_VERIFY(child->nbPaint >= 1); CustomEffect *effect = new CustomEffect; parent->setGraphicsEffect(effect); diff --git a/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro b/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro index da437e959c2..44ec70eef34 100644 --- a/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro +++ b/tests/auto/qgraphicseffectsource/qgraphicseffectsource.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgraphicseffectsource.cpp diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index 5d684c5bebf..a5dcf738e72 100644 --- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp @@ -40,11 +40,11 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include <QtGui/qgraphicseffect.h> -#include <QtGui/qgraphicsview.h> -#include <QtGui/qgraphicsscene.h> -#include <QtGui/qgraphicsitem.h> -#include <QtGui/qstyleoption.h> +#include <QtWidgets/qgraphicseffect.h> +#include <QtWidgets/qgraphicsview.h> +#include <QtWidgets/qgraphicsscene.h> +#include <QtWidgets/qgraphicsitem.h> +#include <QtWidgets/qstyleoption.h> #include <private/qgraphicseffect_p.h> diff --git a/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro b/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro index bde005fcf6a..7db7c1ae6f6 100644 --- a/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro +++ b/tests/auto/qgraphicsgridlayout/qgraphicsgridlayout.pro @@ -1,4 +1,6 @@ load(qttest_p4) + +QT += widgets SOURCES += tst_qgraphicsgridlayout.cpp CONFIG += parallel_test contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb diff --git a/tests/auto/qgraphicsitem/qgraphicsitem.pro b/tests/auto/qgraphicsitem/qgraphicsitem.pro index 77fd00fe5da..51a44266807 100644 --- a/tests/auto/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/qgraphicsitem/qgraphicsitem.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgraphicsitem.cpp DEFINES += QT_NO_CAST_TO_ASCII diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index a8cc3b0e625..79dd2bdd7da 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -42,7 +42,6 @@ #include <QtTest/QtTest> -#include <private/qtextcontrol_p.h> #include <private/qgraphicsitem_p.h> #include <private/qgraphicsview_p.h> #include <private/qgraphicsscene_p.h> diff --git a/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro b/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro index 01875c7b507..5d723da32e4 100644 --- a/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro +++ b/tests/auto/qgraphicsitemanimation/qgraphicsitemanimation.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qgraphicsitemanimation.cpp DEFINES += QT_NO_CAST_TO_ASCII CONFIG += parallel_test diff --git a/tests/auto/qgraphicslayout/qgraphicslayout.pro b/tests/auto/qgraphicslayout/qgraphicslayout.pro index eafd21310a7..ea176c98fe6 100644 --- a/tests/auto/qgraphicslayout/qgraphicslayout.pro +++ b/tests/auto/qgraphicslayout/qgraphicslayout.pro @@ -3,6 +3,7 @@ ############################################################ load(qttest_p4) +QT += widgets SOURCES += tst_qgraphicslayout.cpp DEFINES += QT_USE_USING_NAMESPACE CONFIG += parallel_test diff --git a/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro b/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro index 816224bd8b9..ed9adf87fd8 100644 --- a/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro +++ b/tests/auto/qgraphicslayoutitem/qgraphicslayoutitem.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qgraphicslayoutitem.cpp CONFIG += parallel_test diff --git a/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro b/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro index df5a8277871..1f7ff0cc6ef 100644 --- a/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro +++ b/tests/auto/qgraphicslinearlayout/qgraphicslinearlayout.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qgraphicslinearlayout.cpp CONFIG += parallel_test diff --git a/tests/auto/qgraphicsobject/qgraphicsobject.pro b/tests/auto/qgraphicsobject/qgraphicsobject.pro index 648a81f6c67..5232ec83721 100644 --- a/tests/auto/qgraphicsobject/qgraphicsobject.pro +++ b/tests/auto/qgraphicsobject/qgraphicsobject.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets QT += core-private SOURCES += tst_qgraphicsobject.cpp diff --git a/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro b/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro index 6b4db95ebe3..6b1ad34057c 100644 --- a/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro +++ b/tests/auto/qgraphicspixmapitem/qgraphicspixmapitem.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qgraphicspixmapitem.cpp CONFIG += parallel_test diff --git a/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro b/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro index 4da949b71a7..2aa16751e62 100644 --- a/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro +++ b/tests/auto/qgraphicspolygonitem/qgraphicspolygonitem.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qgraphicspolygonitem.cpp CONFIG += parallel_test diff --git a/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro b/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro index 9f63a489982..a649ae1a3cf 100644 --- a/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro +++ b/tests/auto/qgraphicsproxywidget/qgraphicsproxywidget.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgraphicsproxywidget.cpp diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro index 7dfb30a2c6d..9f961a11b80 100644 --- a/tests/auto/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/qgraphicsscene/qgraphicsscene.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgraphicsscene.cpp RESOURCES += images.qrc diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index b8741fe3aa2..194e023d05c 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -50,7 +50,7 @@ #include <private/qgraphicssceneindex_p.h> #include <math.h> #include "../../shared/util.h" -#include "../qpathclipper/pathcompare.h" +#include "../gui/painting/qpathclipper/pathcompare.h" #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #include <windows.h> diff --git a/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro index 0d0fd0db1a4..5e61034d7c6 100644 --- a/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro +++ b/tests/auto/qgraphicssceneindex/qgraphicssceneindex.pro @@ -1,5 +1,6 @@ load(qttest_p4) requires(contains(QT_CONFIG,private_tests)) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgraphicssceneindex.cpp CONFIG += parallel_test diff --git a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 09b16d72000..0b223c62eb0 100644 --- a/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> -#include <QtGui/qgraphicsscene.h> +#include <QtWidgets/qgraphicsscene.h> #include <private/qgraphicsscenebsptreeindex_p.h> #include <private/qgraphicssceneindex_p.h> #include <private/qgraphicsscenelinearindex_p.h> diff --git a/tests/auto/qgraphicstransform/qgraphicstransform.pro b/tests/auto/qgraphicstransform/qgraphicstransform.pro index 3da3408d29f..de7f01f36fe 100644 --- a/tests/auto/qgraphicstransform/qgraphicstransform.pro +++ b/tests/auto/qgraphicstransform/qgraphicstransform.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qgraphicstransform.cpp CONFIG += parallel_test diff --git a/tests/auto/qgraphicsview/qgraphicsview.pro b/tests/auto/qgraphicsview/qgraphicsview.pro index 9e603af4f99..053093f9bd0 100644 --- a/tests/auto/qgraphicsview/qgraphicsview.pro +++ b/tests/auto/qgraphicsview/qgraphicsview.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index cdb87b57d75..d6bc8ff3e81 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -51,25 +51,25 @@ #include <math.h> -#include <QtGui/QLabel> +#include <QtWidgets/QLabel> #if !defined(QT_NO_STYLE_MOTIF) -#include <QtGui/QMotifStyle> +#include <QtWidgets/QMotifStyle> #endif #if !defined(QT_NO_STYLE_WINDOWS) -#include <QtGui/QWindowsStyle> +#include <QtWidgets/QWindowsStyle> #endif #if !defined(QT_NO_STYLE_PLASTIQUE) -#include <QtGui/QPlastiqueStyle> +#include <QtWidgets/QPlastiqueStyle> #endif #include <QtGui/QPainterPath> -#include <QtGui/QRubberBand> -#include <QtGui/QScrollBar> -#include <QtGui/QStyleOption> -#include <QtGui/QBoxLayout> -#include <QtGui/QStyle> -#include <QtGui/QPushButton> -#include <QtGui/QInputContext> -#include <QtGui/QDesktopWidget> +#include <QtWidgets/QRubberBand> +#include <QtWidgets/QScrollBar> +#include <QtWidgets/QStyleOption> +#include <QtWidgets/QBoxLayout> +#include <QtWidgets/QStyle> +#include <QtWidgets/QPushButton> +#include <QtWidgets/QInputContext> +#include <QtWidgets/QDesktopWidget> #include <private/qgraphicsview_p.h> #include "../../shared/util.h" #include "../platformquirks.h" diff --git a/tests/auto/qgraphicswidget/qgraphicswidget.pro b/tests/auto/qgraphicswidget/qgraphicswidget.pro index 64de1fc739e..330076eafcd 100644 --- a/tests/auto/qgraphicswidget/qgraphicswidget.pro +++ b/tests/auto/qgraphicswidget/qgraphicswidget.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgraphicswidget.cpp diff --git a/tests/auto/qgridlayout/qgridlayout.pro b/tests/auto/qgridlayout/qgridlayout.pro index d034f1d031d..6bd42fe4328 100644 --- a/tests/auto/qgridlayout/qgridlayout.pro +++ b/tests/auto/qgridlayout/qgridlayout.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qgridlayout.cpp diff --git a/tests/auto/qgridlayout/tst_qgridlayout.cpp b/tests/auto/qgridlayout/tst_qgridlayout.cpp index 921168da8e2..d52729a2732 100644 --- a/tests/auto/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/qgridlayout/tst_qgridlayout.cpp @@ -46,9 +46,9 @@ #include <qwidget.h> #include <qwindowsstyle.h> #include <qsizepolicy.h> -#include <QtGui> +//#include <QtGui> -#include <QtGui/QWindowsStyle> +#include <QtWidgets/QWindowsStyle> #include <QStyleFactory> #include "../../shared/util.h" diff --git a/tests/auto/qgroupbox/qgroupbox.pro b/tests/auto/qgroupbox/qgroupbox.pro index 5f5370f0cbc..f4181a33ed9 100644 --- a/tests/auto/qgroupbox/qgroupbox.pro +++ b/tests/auto/qgroupbox/qgroupbox.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qgroupbox.cpp diff --git a/tests/auto/qheaderview/qheaderview.pro b/tests/auto/qheaderview/qheaderview.pro index 9910e4e89dd..3b3afa7e49b 100644 --- a/tests/auto/qheaderview/qheaderview.pro +++ b/tests/auto/qheaderview/qheaderview.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qheaderview.cpp diff --git a/tests/auto/qidentityproxymodel/qidentityproxymodel.pro b/tests/auto/qidentityproxymodel/qidentityproxymodel.pro index f529e20c7f8..7df0e65d03e 100644 --- a/tests/auto/qidentityproxymodel/qidentityproxymodel.pro +++ b/tests/auto/qidentityproxymodel/qidentityproxymodel.pro @@ -2,5 +2,6 @@ load(qttest_p4) INCLUDEPATH += $$PWD/../modeltest +QT += widgets SOURCES += tst_qidentityproxymodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp HEADERS += ../modeltest/dynamictreemodel.h ../modeltest/modeltest.h diff --git a/tests/auto/qinputcontext/qinputcontext.pro b/tests/auto/qinputcontext/qinputcontext.pro index cd9fa0e423c..8dedc85cf07 100644 --- a/tests/auto/qinputcontext/qinputcontext.pro +++ b/tests/auto/qinputcontext/qinputcontext.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qinputcontext.cpp symbian { @@ -6,3 +7,5 @@ symbian { } mac*:CONFIG+=insignificant_test + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qinputdialog/qinputdialog.pro b/tests/auto/qinputdialog/qinputdialog.pro index 2f68a40d912..f7e56bd7834 100644 --- a/tests/auto/qinputdialog/qinputdialog.pro +++ b/tests/auto/qinputdialog/qinputdialog.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qinputdialog.cpp diff --git a/tests/auto/qitemdelegate/qitemdelegate.pro b/tests/auto/qitemdelegate/qitemdelegate.pro index 1206976868a..9a1a3b5e943 100644 --- a/tests/auto/qitemdelegate/qitemdelegate.pro +++ b/tests/auto/qitemdelegate/qitemdelegate.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qitemdelegate.cpp win32:!wince*: LIBS += -lUser32 diff --git a/tests/auto/qitemeditorfactory/qitemeditorfactory.pro b/tests/auto/qitemeditorfactory/qitemeditorfactory.pro index d589f4e01bb..89bc944c51f 100644 --- a/tests/auto/qitemeditorfactory/qitemeditorfactory.pro +++ b/tests/auto/qitemeditorfactory/qitemeditorfactory.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qitemeditorfactory.cpp diff --git a/tests/auto/qitemselectionmodel/qitemselectionmodel.pro b/tests/auto/qitemselectionmodel/qitemselectionmodel.pro index afc859e5ef8..c675a6eb9d0 100644 --- a/tests/auto/qitemselectionmodel/qitemselectionmodel.pro +++ b/tests/auto/qitemselectionmodel/qitemselectionmodel.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qitemselectionmodel.cpp diff --git a/tests/auto/qitemview/qitemview.pro b/tests/auto/qitemview/qitemview.pro index de2c3284938..dbdd4612d59 100644 --- a/tests/auto/qitemview/qitemview.pro +++ b/tests/auto/qitemview/qitemview.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qitemview.cpp diff --git a/tests/auto/qlabel/qlabel.pro b/tests/auto/qlabel/qlabel.pro index 4b510cca52b..c670a6f96b9 100644 --- a/tests/auto/qlabel/qlabel.pro +++ b/tests/auto/qlabel/qlabel.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qlabel.cpp @@ -11,3 +12,5 @@ wince*|symbian { addFiles.path = . DEPLOYMENT += addFiles } + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qlayout/qlayout.pro b/tests/auto/qlayout/qlayout.pro index 919eba20033..c4803ec2db3 100644 --- a/tests/auto/qlayout/qlayout.pro +++ b/tests/auto/qlayout/qlayout.pro @@ -1,6 +1,6 @@ load(qttest_p4) -QT += gui-private +QT += widgets widgets-private SOURCES += tst_qlayout.cpp wince*|symbian: { diff --git a/tests/auto/qlayout/tst_qlayout.cpp b/tests/auto/qlayout/tst_qlayout.cpp index 81b92cadec2..ea257005681 100644 --- a/tests/auto/qlayout/tst_qlayout.cpp +++ b/tests/auto/qlayout/tst_qlayout.cpp @@ -49,9 +49,9 @@ #include <qdialog.h> #include <qsizegrip.h> #include <qlabel.h> -#include <QtGui/QFrame> -#include <QtGui/QWindowsStyle> -#include <QtGui/QSizePolicy> +#include <QtWidgets/QFrame> +#include <QtWidgets/QWindowsStyle> +#include <QtWidgets/QSizePolicy> #include <QPushButton> #include <QRadioButton> #include <private/qlayoutengine_p.h> diff --git a/tests/auto/qlcdnumber/qlcdnumber.pro b/tests/auto/qlcdnumber/qlcdnumber.pro index 4f1b0091ba6..cd909de5be3 100644 --- a/tests/auto/qlcdnumber/qlcdnumber.pro +++ b/tests/auto/qlcdnumber/qlcdnumber.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qlcdnumber.cpp diff --git a/tests/auto/qlineedit/qlineedit.pro b/tests/auto/qlineedit/qlineedit.pro index bb6d95027b1..077b7c919ef 100644 --- a/tests/auto/qlineedit/qlineedit.pro +++ b/tests/auto/qlineedit/qlineedit.pro @@ -1,2 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qlineedit.cpp + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index fde77bca517..7c8a9751cd7 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -3704,7 +3704,7 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut() le.setFocus(); QTRY_VERIFY(le.hasFocus()); - QTest::keyClick(0, Qt::Key_P); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_P); QCOMPARE(spy.count(), 1); } diff --git a/tests/auto/qlistview/qlistview.pro b/tests/auto/qlistview/qlistview.pro index 21dfe57606f..07fabbce35a 100644 --- a/tests/auto/qlistview/qlistview.pro +++ b/tests/auto/qlistview/qlistview.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets gui-private SOURCES += tst_qlistview.cpp win32:!wince*: LIBS += -luser32 diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 3c4b05bc0f3..8962556965a 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -53,18 +53,28 @@ #include <cmath> #endif #include <math.h> -#include <QtGui/QScrollBar> -#include <QtGui/QDialog> -#include <QtGui/QStyledItemDelegate> +#include <QtWidgets/QScrollBar> +#include <QtWidgets/QDialog> +#include <QtWidgets/QStyledItemDelegate> #if defined(Q_OS_WIN) || defined(Q_OS_WINCE) -#include <windows.h> -#endif +# include <windows.h> +# include <QtGui/QGuiApplication> +# include <QtGui/QPlatformNativeInterface> +#endif // Q_OS_WIN #include "../../shared/util.h" //TESTED_CLASS= //TESTED_FILES= +#if defined(Q_OS_WIN) || defined(Q_OS_WINCE) +static inline HWND getHWNDForWidget(const QWidget *widget) +{ + QWindow *window = widget->windowHandle(); + return static_cast<HWND> (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window)); +} +#endif // Q_OS_WIN + class tst_QListView : public QObject { Q_OBJECT @@ -1467,7 +1477,8 @@ public: DWORD lParam = 0xFFFFFFFC/*OBJID_CLIENT*/; DWORD wParam = 0; - SendMessage(winId(), WM_GETOBJECT, wParam, lParam); + if (const HWND hwnd =getHWNDForWidget(this)) + SendMessage(hwnd, WM_GETOBJECT, wParam, lParam); #endif } diff --git a/tests/auto/qlistwidget/qlistwidget.pro b/tests/auto/qlistwidget/qlistwidget.pro index 30305e1c8dc..7343415e4c1 100644 --- a/tests/auto/qlistwidget/qlistwidget.pro +++ b/tests/auto/qlistwidget/qlistwidget.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qlistwidget.cpp diff --git a/tests/auto/qmacstyle/qmacstyle.pro b/tests/auto/qmacstyle/qmacstyle.pro index fb23a52c0f6..5aad7368c6d 100644 --- a/tests/auto/qmacstyle/qmacstyle.pro +++ b/tests/auto/qmacstyle/qmacstyle.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qmacstyle.cpp diff --git a/tests/auto/qmacstyle/tst_qmacstyle.cpp b/tests/auto/qmacstyle/tst_qmacstyle.cpp index 6e03afd5756..3c2f71184d1 100644 --- a/tests/auto/qmacstyle/tst_qmacstyle.cpp +++ b/tests/auto/qmacstyle/tst_qmacstyle.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> -#include <QtGui> +#include <QtWidgets> #include <qmacstyle_mac.h> diff --git a/tests/auto/qmainwindow/qmainwindow.pro b/tests/auto/qmainwindow/qmainwindow.pro index 038686e18cd..09633d0e323 100644 --- a/tests/auto/qmainwindow/qmainwindow.pro +++ b/tests/auto/qmainwindow/qmainwindow.pro @@ -1,6 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private SOURCES += tst_qmainwindow.cpp -QT += core-private gui-private # Symbian toolchain does not support correct include semantics symbian:INCPATH+=..\\..\\..\\include\\QtGui\\private diff --git a/tests/auto/qmdiarea/qmdiarea.pro b/tests/auto/qmdiarea/qmdiarea.pro index e16c679b3a1..6a12152fcc5 100644 --- a/tests/auto/qmdiarea/qmdiarea.pro +++ b/tests/auto/qmdiarea/qmdiarea.pro @@ -1,6 +1,6 @@ load(qttest_p4) -QT += gui-private +QT += gui-private widgets INCLUDEPATH += . SOURCES += tst_qmdiarea.cpp diff --git a/tests/auto/qmdisubwindow/qmdisubwindow.pro b/tests/auto/qmdisubwindow/qmdisubwindow.pro index 00a1e51fbec..5c5bd525dfe 100644 --- a/tests/auto/qmdisubwindow/qmdisubwindow.pro +++ b/tests/auto/qmdisubwindow/qmdisubwindow.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets INCLUDEPATH += . SOURCES += tst_qmdisubwindow.cpp DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp index 7296f3433b2..0aa4aa192f1 100644 --- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp @@ -77,7 +77,7 @@ QT_END_NAMESPACE static inline bool tabAllWidgets() { -#if !defined(Q_WS_WIN) +#if !defined(Q_OS_WIN) if (qApp->style()->inherits("QMacStyle")) return qt_tab_all_widgets; #endif diff --git a/tests/auto/qmenu/qmenu.pro b/tests/auto/qmenu/qmenu.pro index 63451a11b6e..1fc1a7ff9da 100644 --- a/tests/auto/qmenu/qmenu.pro +++ b/tests/auto/qmenu/qmenu.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qmenu.cpp qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-21100, unstably fails diff --git a/tests/auto/qmenubar/qmenubar.pro b/tests/auto/qmenubar/qmenubar.pro index ba2dea8eb77..73c25457101 100644 --- a/tests/auto/qmenubar/qmenubar.pro +++ b/tests/auto/qmenubar/qmenubar.pro @@ -1,2 +1,3 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qmenubar.cpp diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp index e1b7f1ff9b2..3c0501f6795 100644 --- a/tests/auto/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/qmenubar/tst_qmenubar.cpp @@ -347,8 +347,8 @@ void tst_QMenuBar::accel() // shortcuts won't work unless the window is active QTRY_VERIFY( QApplication::activeWindow() ); -// QTest::keyClick( 0, Qt::Key_A, AltKey ); - QTest::keyClick( 0, Qt::Key_A, Qt::ControlModifier ); +// QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_A, AltKey ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_A, Qt::ControlModifier ); QTest::qWait(300); QCOMPARE( last_accel_id, action ); @@ -362,7 +362,7 @@ void tst_QMenuBar::activatedCount() // create a popup menu with menu items set the accelerators later... initSimpleMenubar(); - QTest::keyClick( 0, Qt::Key_A, Qt::ControlModifier ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_A, Qt::ControlModifier ); //wait(5000); QCOMPARE( activated_count, 2 ); //1 from the popupmenu and 1 from the menubar } @@ -576,7 +576,7 @@ void tst_QMenuBar::check_accelKeys() initComplexMenubar(); // start with a bogus key that shouldn't trigger anything - QTest::keyClick(0, Qt::Key_I, Qt::ControlModifier); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_I, Qt::ControlModifier); QCOMPARE(menu1->selCount(), 0u); QCOMPARE(menu2->selCount(), 0u); QCOMPARE(menu3->selCount(), 0u); @@ -586,7 +586,7 @@ void tst_QMenuBar::check_accelKeys() QCOMPARE(item2_C->selCount(), 0u); QCOMPARE(item2_D->selCount(), 0u); - QTest::keyClick(0, Qt::Key_A, Qt::ControlModifier); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_A, Qt::ControlModifier); QCOMPARE(menu1->selCount(), 0u); QCOMPARE(menu2->selCount(), 0u); QCOMPARE(menu3->selCount(), 0u); @@ -596,7 +596,7 @@ void tst_QMenuBar::check_accelKeys() QCOMPARE(item2_C->selCount(), 0u); QCOMPARE(item2_D->selCount(), 0u); - QTest::keyClick(0, Qt::Key_C, Qt::ControlModifier); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_C, Qt::ControlModifier); QCOMPARE(menu1->selCount(), 0u); QCOMPARE(menu2->selCount(), 0u); QCOMPARE(menu3->selCount(), 0u); @@ -606,7 +606,7 @@ void tst_QMenuBar::check_accelKeys() QCOMPARE(item2_C->selCount(), 1u); QCOMPARE(item2_D->selCount(), 0u); - QTest::keyClick(0, Qt::Key_B, Qt::ControlModifier); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_B, Qt::ControlModifier); QCOMPARE(menu1->selCount(), 0u); QCOMPARE(menu2->selCount(), 0u); QCOMPARE(menu3->selCount(), 0u); @@ -616,7 +616,7 @@ void tst_QMenuBar::check_accelKeys() QCOMPARE(item2_C->selCount(), 1u); QCOMPARE(item2_D->selCount(), 0u); - QTest::keyClick(0, Qt::Key_D, Qt::ControlModifier); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_D, Qt::ControlModifier); QCOMPARE(menu1->selCount(), 0u); QCOMPARE(menu2->selCount(), 0u); QCOMPARE(menu3->selCount(), 0u); @@ -626,7 +626,7 @@ void tst_QMenuBar::check_accelKeys() QCOMPARE(item2_C->selCount(), 1u); QCOMPARE(item2_D->selCount(), 1u); - QTest::keyClick(0, Qt::Key_J, Qt::AltModifier); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_J, Qt::AltModifier); QCOMPARE(menu1->selCount(), 0u); QCOMPARE(menu2->selCount(), 0u); QCOMPARE(menu3->selCount(), 1u); @@ -646,7 +646,7 @@ void tst_QMenuBar::check_cursorKeys1() initComplexMenubar(); // start with a ALT + 1 that activates the first popupmenu - QTest::keyClick( 0, Qt::Key_1, Qt::AltModifier ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_1, Qt::AltModifier ); // the Popupmenu should be visible now QCOMPARE(menu3->selCount(), 0u); QCOMPARE(menu4->selCount(), 0u); @@ -656,9 +656,9 @@ void tst_QMenuBar::check_cursorKeys1() QCOMPARE(item2_D->selCount(), 0u); // Simulate a cursor key down click - QTest::keyClick( 0, Qt::Key_Down ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Down ); // and an Enter key - QTest::keyClick( 0, Qt::Key_Enter ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Enter ); // Let's see if the correct slot is called... QCOMPARE(menu3->selCount(), 0u); QCOMPARE(menu4->selCount(), 0u); @@ -677,15 +677,15 @@ void tst_QMenuBar::check_cursorKeys2() initComplexMenubar(); // select popupmenu2 - QTest::keyClick( 0, Qt::Key_2, Qt::AltModifier ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_2, Qt::AltModifier ); // Simulate some cursor keys - QTest::keyClick( 0, Qt::Key_Left ); - QTest::keyClick( 0, Qt::Key_Down ); - QTest::keyClick( 0, Qt::Key_Right ); - QTest::keyClick( 0, Qt::Key_Down ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Left ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Down ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Right ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Down ); // and an Enter key - QTest::keyClick( 0, Qt::Key_Enter ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Enter ); // Let's see if the correct slot is called... QCOMPARE(menu3->selCount(), 0u); QCOMPARE(menu4->selCount(), 0u); @@ -707,13 +707,13 @@ void tst_QMenuBar::check_cursorKeys3() initComplexMenubar(); // select Popupmenu 2 - QTest::keyClick( 0, Qt::Key_2, Qt::AltModifier ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_2, Qt::AltModifier ); // Simulate some keys - QTest::keyClick( 0, Qt::Key_Left ); - QTest::keyClick( 0, Qt::Key_Down ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Left ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Down ); // and press ENTER - QTest::keyClick( 0, Qt::Key_Enter ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Enter ); // Let's see if the correct slot is called... QCOMPARE(menu3->selCount(), 0u); QCOMPARE(menu4->selCount(), 0u); @@ -738,15 +738,15 @@ void tst_QMenuBar::check_homeKey() initComplexMenubar(); // select Popupmenu 2 - QTest::keyClick( 0, Qt::Key_2, Qt::AltModifier ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_2, Qt::AltModifier ); // Simulate some keys - QTest::keyClick( 0, Qt::Key_Down ); - QTest::keyClick( 0, Qt::Key_Down ); - QTest::keyClick( 0, Qt::Key_Down ); - QTest::keyClick( 0, Qt::Key_Home ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Down ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Down ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Down ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Home ); // and press ENTER - QTest::keyClick( 0, Qt::Key_Enter ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Enter ); // Let's see if the correct slot is called... // QVERIFY2( item2_C->selCount() == 1, "Popupmenu should respond to a Home key" ); QCOMPARE(item2_C->selCount(), 1u); @@ -776,12 +776,12 @@ void tst_QMenuBar::check_endKey() initComplexMenubar(); // select Popupmenu 2 - QTest::keyClick( 0, Qt::Key_2, Qt::AltModifier ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_2, Qt::AltModifier ); // Simulate some keys - QTest::keyClick( 0, Qt::Key_End ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_End ); // and press ENTER - QTest::keyClick( 0, Qt::Key_Enter ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Enter ); // Let's see if the correct slot is called... // QVERIFY2( item2_H->selCount() == 1, "Popupmenu should respond to an End key" ); QCOMPARE(item2_H->selCount(), 1u);//, "Popupmenu should respond to an End key"); @@ -814,12 +814,12 @@ void tst_QMenuBar::check_escKey() QVERIFY( !pm2->isActiveWindow() ); // select Popupmenu 2 - QTest::keyClick( 0, Qt::Key_2, Qt::AltModifier ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_2, Qt::AltModifier ); QVERIFY( !pm1->isActiveWindow() ); QVERIFY( pm2->isActiveWindow() ); // If we press ESC, the popup should disappear - QTest::keyClick( 0, Qt::Key_Escape ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Escape ); QVERIFY( !pm1->isActiveWindow() ); QVERIFY( !pm2->isActiveWindow() ); @@ -827,7 +827,7 @@ void tst_QMenuBar::check_escKey() return; // If we press Down the popupmenu should be active again - QTest::keyClick( 0, Qt::Key_Down ); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Down ); QVERIFY( !pm1->isActiveWindow() ); QVERIFY( pm2->isActiveWindow() ); @@ -1255,13 +1255,13 @@ void tst_QMenuBar::taskQTBUG4965_escapeEaten() menubar.setActiveAction(first); QTRY_VERIFY(menu.isVisible()); QCOMPARE(menubar.activeAction(), first); - QTest::keyClick(0, Qt::Key_Escape); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Escape); QVERIFY(!menu.isVisible()); QTRY_VERIFY(menubar.hasFocus()); QCOMPARE(menubar.activeAction(), first); - QTest::keyClick(0, Qt::Key_Escape); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Escape); QVERIFY(!menubar.activeAction()); - QTest::keyClick(0, Qt::Key_Escape); //now the action should be triggered + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Escape); //now the action should be triggered QTRY_VERIFY(!menubar.isVisible()); } @@ -1278,9 +1278,9 @@ void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions() QApplication::setActiveWindow(&menubar); menubar.setActiveAction(m); QCOMPARE(menubar.activeAction(), m); - QTest::keyClick(0, Qt::Key_Right); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Right); QCOMPARE(menubar.activeAction(), a); - QTest::keyClick(0, Qt::Key_Right); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Right); QCOMPARE(menubar.activeAction(), m); a->setVisible(false); @@ -1288,7 +1288,7 @@ void tst_QMenuBar::taskQTBUG11823_crashwithInvisibleActions() QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed //it used to crash here because the action is invisible - QTest::keyClick(0, Qt::Key_Right); + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_Right); QCOMPARE(menubar.activeAction(), m); //the active action shouldn't have changed } diff --git a/tests/auto/qmessagebox/qmessagebox.pro b/tests/auto/qmessagebox/qmessagebox.pro index 1893c42a64a..e3f6ddb1f62 100644 --- a/tests/auto/qmessagebox/qmessagebox.pro +++ b/tests/auto/qmessagebox/qmessagebox.pro @@ -1,6 +1,7 @@ load(qttest_p4) TEMPLATE = app TARGET = tst_qmessagebox +QT += widgets DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp index 6b737681b1c..12b6029a8f6 100644 --- a/tests/auto/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp @@ -525,8 +525,9 @@ void tst_QMessageBox::testSymbols() button = QMessageBox::Escape; button = QMessageBox::FlagMask; - mb1.setText("Foo"); - QCOMPARE(mb1.text(), "Foo"); + const QString text = QStringLiteral("Foo"); + mb1.setText(text); + QCOMPARE(mb1.text(), text); icon = mb1.icon(); QVERIFY(icon == QMessageBox::NoIcon); @@ -537,26 +538,28 @@ void tst_QMessageBox::testSymbols() mb1.setIconPixmap(iconPixmap); QVERIFY(mb1.icon() == QMessageBox::NoIcon); - QCOMPARE(mb1.buttonText(QMessageBox::Ok), "OK"); + QCOMPARE(mb1.buttonText(QMessageBox::Ok), QLatin1String("OK")); QCOMPARE(mb1.buttonText(QMessageBox::Cancel), QString()); QCOMPARE(mb1.buttonText(QMessageBox::Ok | QMessageBox::Default), QString()); - mb2.setButtonText(QMessageBox::Cancel, "Foo"); - mb2.setButtonText(QMessageBox::Ok, "Bar"); - mb2.setButtonText(QMessageBox::Ok | QMessageBox::Default, "Baz"); + const QString button1 = QStringLiteral("Bar"); + mb2.setButtonText(QMessageBox::Cancel, QStringLiteral("Foo")); + mb2.setButtonText(QMessageBox::Ok, button1); + mb2.setButtonText(QMessageBox::Ok | QMessageBox::Default, QStringLiteral("Baz")); QCOMPARE(mb2.buttonText(QMessageBox::Cancel), QString()); - QCOMPARE(mb2.buttonText(QMessageBox::Ok), "Bar"); + QCOMPARE(mb2.buttonText(QMessageBox::Ok), button1); QVERIFY(mb3b.buttonText(QMessageBox::Yes).endsWith("Yes")); QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString()); QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString()); - mb3b.setButtonText(QMessageBox::Yes, "Blah"); - mb3b.setButtonText(QMessageBox::YesAll, "Zoo"); - mb3b.setButtonText(QMessageBox::Ok, "Zoo"); + const QString button2 = QStringLiteral("Blah"); + mb3b.setButtonText(QMessageBox::Yes, button2); + mb3b.setButtonText(QMessageBox::YesAll, QStringLiteral("Zoo")); + mb3b.setButtonText(QMessageBox::Ok, QStringLiteral("Zoo")); - QCOMPARE(mb3b.buttonText(QMessageBox::Yes), "Blah"); + QCOMPARE(mb3b.buttonText(QMessageBox::Yes), button2); QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString()); QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString()); diff --git a/tests/auto/qmultiscreen/qmultiscreen.pro b/tests/auto/qmultiscreen/qmultiscreen.pro index 30666d72da8..c4a983c5bee 100644 --- a/tests/auto/qmultiscreen/qmultiscreen.pro +++ b/tests/auto/qmultiscreen/qmultiscreen.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qmultiscreen.cpp requires(embedded) diff --git a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro index 378deba11ef..e5afc353c80 100644 --- a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro +++ b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro @@ -1,6 +1,6 @@ load(qttest_p4) SOURCES += tst_qnetworkaccessmanager_and_qprogressdialog.cpp -QT += network +QT += network widgets symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qopengl/qopengl.pro b/tests/auto/qopengl/qopengl.pro new file mode 100644 index 00000000000..b049518f7aa --- /dev/null +++ b/tests/auto/qopengl/qopengl.pro @@ -0,0 +1,10 @@ +############################################################ +# Project file for autotest for gui/opengl functionality +############################################################ + +load(qttest_p4) +QT += gui gui-private core-private + +SOURCES += tst_qopengl.cpp + +CONFIG += insignificant_test diff --git a/tests/auto/qopengl/tst_qopengl.cpp b/tests/auto/qopengl/tst_qopengl.cpp new file mode 100644 index 00000000000..577fbafe4a3 --- /dev/null +++ b/tests/auto/qopengl/tst_qopengl.cpp @@ -0,0 +1,437 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtGui/private/qopenglcontext_p.h> +#include <QtGui/QWindow> + +#include <QtTest/QtTest> + +class tst_QOpenGL : public QObject +{ +Q_OBJECT + +private slots: + void sharedResourceCleanup(); + void fboSimpleRendering(); + void fboRendering(); + void fboHandleNulledAfterContextDestroyed(); + void openGLPaintDevice(); +}; + +struct SharedResourceTracker +{ + SharedResourceTracker() + { + reset(); + } + + void reset() + { + invalidateResourceCalls = 0; + freeResourceCalls = 0; + destructorCalls = 0; + } + + int invalidateResourceCalls; + int freeResourceCalls; + int destructorCalls; +}; + +struct SharedResource : public QOpenGLSharedResource +{ + SharedResource(SharedResourceTracker *t) + : QOpenGLSharedResource(QOpenGLContextGroup::currentContextGroup()) + , resource(1) + , tracker(t) + { + } + + ~SharedResource() + { + tracker->destructorCalls++; + } + + void invalidateResource() + { + resource = 0; + tracker->invalidateResourceCalls++; + } + + void freeResource(QOpenGLContext *context) + { + Q_ASSERT(context == QOpenGLContext::currentContext()); + resource = 0; + tracker->freeResourceCalls++; + } + + int resource; + SharedResourceTracker *tracker; +}; + +void tst_QOpenGL::sharedResourceCleanup() +{ + QWindow window; + window.setGeometry(0, 0, 10, 10); + window.create(); + + QOpenGLContext *ctx = new QOpenGLContext; + ctx->create(); + ctx->makeCurrent(&window); + + SharedResourceTracker tracker; + SharedResource *resource = new SharedResource(&tracker); + resource->free(); + + QCOMPARE(tracker.invalidateResourceCalls, 0); + QCOMPARE(tracker.freeResourceCalls, 1); + QCOMPARE(tracker.destructorCalls, 1); + + tracker.reset(); + + resource = new SharedResource(&tracker); + + QOpenGLContext *ctx2 = new QOpenGLContext; + ctx2->setShareContext(ctx); + ctx2->create(); + delete ctx; + + resource->free(); + + // no current context, freeResource() delayed + QCOMPARE(tracker.invalidateResourceCalls, 0); + QCOMPARE(tracker.freeResourceCalls, 0); + QCOMPARE(tracker.destructorCalls, 0); + + ctx2->makeCurrent(&window); + + // freeResource() should now have been called + QCOMPARE(tracker.invalidateResourceCalls, 0); + QCOMPARE(tracker.freeResourceCalls, 1); + QCOMPARE(tracker.destructorCalls, 1); + + tracker.reset(); + + resource = new SharedResource(&tracker); + + // this should cause invalidateResource() to be called + delete ctx2; + + QCOMPARE(tracker.invalidateResourceCalls, 1); + QCOMPARE(tracker.freeResourceCalls, 0); + QCOMPARE(tracker.destructorCalls, 0); + + // should have no effect other than destroying the resource, + // as it has already been invalidated + resource->free(); + + QCOMPARE(tracker.invalidateResourceCalls, 1); + QCOMPARE(tracker.freeResourceCalls, 0); + QCOMPARE(tracker.destructorCalls, 1); +} + +static bool fuzzyComparePixels(const QRgb testPixel, const QRgb refPixel, const char* file, int line, int x = -1, int y = -1) +{ + static int maxFuzz = 1; + static bool maxFuzzSet = false; + + // On 16 bpp systems, we need to allow for more fuzz: + if (!maxFuzzSet) { + maxFuzzSet = true; + if (QGuiApplication::primaryScreen()->depth() < 24) + maxFuzz = 32; + } + + int redFuzz = qAbs(qRed(testPixel) - qRed(refPixel)); + int greenFuzz = qAbs(qGreen(testPixel) - qGreen(refPixel)); + int blueFuzz = qAbs(qBlue(testPixel) - qBlue(refPixel)); + int alphaFuzz = qAbs(qAlpha(testPixel) - qAlpha(refPixel)); + + if (refPixel != 0 && testPixel == 0) { + QString msg; + if (x >= 0) { + msg = QString("Test pixel [%1, %2] is null (black) when it should be (%3,%4,%5,%6)") + .arg(x).arg(y) + .arg(qRed(refPixel)).arg(qGreen(refPixel)).arg(qBlue(refPixel)).arg(qAlpha(refPixel)); + } else { + msg = QString("Test pixel is null (black) when it should be (%2,%3,%4,%5)") + .arg(qRed(refPixel)).arg(qGreen(refPixel)).arg(qBlue(refPixel)).arg(qAlpha(refPixel)); + } + + QTest::qFail(msg.toLatin1(), file, line); + return false; + } + + if (redFuzz > maxFuzz || greenFuzz > maxFuzz || blueFuzz > maxFuzz || alphaFuzz > maxFuzz) { + QString msg; + + if (x >= 0) + msg = QString("Pixel [%1,%2]: ").arg(x).arg(y); + else + msg = QString("Pixel "); + + msg += QString("Max fuzz (%1) exceeded: (%2,%3,%4,%5) vs (%6,%7,%8,%9)") + .arg(maxFuzz) + .arg(qRed(testPixel)).arg(qGreen(testPixel)).arg(qBlue(testPixel)).arg(qAlpha(testPixel)) + .arg(qRed(refPixel)).arg(qGreen(refPixel)).arg(qBlue(refPixel)).arg(qAlpha(refPixel)); + QTest::qFail(msg.toLatin1(), file, line); + return false; + } + return true; +} + +static void fuzzyCompareImages(const QImage &testImage, const QImage &referenceImage, const char* file, int line) +{ + QCOMPARE(testImage.width(), referenceImage.width()); + QCOMPARE(testImage.height(), referenceImage.height()); + + for (int y = 0; y < testImage.height(); y++) { + for (int x = 0; x < testImage.width(); x++) { + if (!fuzzyComparePixels(testImage.pixel(x, y), referenceImage.pixel(x, y), file, line, x, y)) { + // Might as well save the images for easier debugging: + referenceImage.save("referenceImage.png"); + testImage.save("testImage.png"); + return; + } + } + } +} + +#define QFUZZY_COMPARE_IMAGES(A,B) \ + fuzzyCompareImages(A, B, __FILE__, __LINE__) + +#define QFUZZY_COMPARE_PIXELS(A,B) \ + fuzzyComparePixels(A, B, __FILE__, __LINE__) + +void qt_opengl_draw_test_pattern(QPainter* painter, int width, int height) +{ + QPainterPath intersectingPath; + intersectingPath.moveTo(0, 0); + intersectingPath.lineTo(100, 0); + intersectingPath.lineTo(0, 100); + intersectingPath.lineTo(100, 100); + intersectingPath.closeSubpath(); + + QPainterPath trianglePath; + trianglePath.moveTo(50, 0); + trianglePath.lineTo(100, 100); + trianglePath.lineTo(0, 100); + trianglePath.closeSubpath(); + + painter->setTransform(QTransform()); // reset xform + painter->fillRect(-1, -1, width+2, height+2, Qt::red); // Background + painter->translate(14, 14); + painter->fillPath(intersectingPath, Qt::blue); // Test stencil buffer works + painter->translate(128, 0); + painter->setClipPath(trianglePath); // Test depth buffer works + painter->setTransform(QTransform()); // reset xform ready for fill + painter->fillRect(-1, -1, width+2, height+2, Qt::green); +} + +void qt_opengl_check_test_pattern(const QImage& img) +{ + // As we're doing more than trivial painting, we can't just compare to + // an image rendered with raster. Instead, we sample at well-defined + // test-points: + QFUZZY_COMPARE_PIXELS(img.pixel(39, 64), QColor(Qt::red).rgb()); + QFUZZY_COMPARE_PIXELS(img.pixel(89, 64), QColor(Qt::red).rgb()); + QFUZZY_COMPARE_PIXELS(img.pixel(64, 39), QColor(Qt::blue).rgb()); + QFUZZY_COMPARE_PIXELS(img.pixel(64, 89), QColor(Qt::blue).rgb()); + + QFUZZY_COMPARE_PIXELS(img.pixel(167, 39), QColor(Qt::red).rgb()); + QFUZZY_COMPARE_PIXELS(img.pixel(217, 39), QColor(Qt::red).rgb()); + QFUZZY_COMPARE_PIXELS(img.pixel(192, 64), QColor(Qt::green).rgb()); +} + + +void tst_QOpenGL::fboSimpleRendering() +{ + QWindow window; + window.setGeometry(0, 0, 10, 10); + window.create(); + QOpenGLContext ctx; + ctx.create(); + + ctx.makeCurrent(&window); + + if (!QOpenGLFramebufferObject::hasOpenGLFramebufferObjects()) + QSKIP("QOpenGLFramebufferObject not supported on this platform", SkipSingle); + + // No multisample with combined depth/stencil attachment: + QOpenGLFramebufferObjectFormat fboFormat; + fboFormat.setAttachment(QOpenGLFramebufferObject::NoAttachment); + + QOpenGLFramebufferObject *fbo = new QOpenGLFramebufferObject(200, 100, fboFormat); + + fbo->bind(); + + glClearColor(1.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + glFinish(); + + QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32); + QImage reference(fb.size(), QImage::Format_RGB32); + reference.fill(0xffff0000); + + QFUZZY_COMPARE_IMAGES(fb, reference); + + delete fbo; +} + +// NOTE: This tests that CombinedDepthStencil attachment works by assuming the +// GL2 engine is being used and is implemented the same way as it was when +// this autotest was written. If this is not the case, there may be some +// false-positives: I.e. The test passes when either the depth or stencil +// buffer is actually missing. But that's probably ok anyway. +void tst_QOpenGL::fboRendering() +{ + QWindow window; + window.setGeometry(0, 0, 10, 10); + window.create(); + QOpenGLContext ctx; + ctx.create(); + + ctx.makeCurrent(&window); + + if (!QOpenGLFramebufferObject::hasOpenGLFramebufferObjects()) + QSKIP("QOpenGLFramebufferObject not supported on this platform", SkipSingle); + + // No multisample with combined depth/stencil attachment: + QOpenGLFramebufferObjectFormat fboFormat; + fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); + + // Uncomplicate things by using NPOT: + QOpenGLFramebufferObject fbo(256, 128, fboFormat); + + if (fbo.attachment() != QOpenGLFramebufferObject::CombinedDepthStencil) + QSKIP("FBOs missing combined depth~stencil support", SkipSingle); + + fbo.bind(); + + QPainter fboPainter; + QOpenGLPaintDevice device(fbo.width(), fbo.height()); + bool painterBegun = fboPainter.begin(&device); + QVERIFY(painterBegun); + + qt_opengl_draw_test_pattern(&fboPainter, fbo.width(), fbo.height()); + + fboPainter.end(); + + QImage fb = fbo.toImage().convertToFormat(QImage::Format_RGB32); + + qt_opengl_check_test_pattern(fb); +} + +void tst_QOpenGL::fboHandleNulledAfterContextDestroyed() +{ + QWindow window; + window.setGeometry(0, 0, 10, 10); + window.create(); + + QOpenGLFramebufferObject *fbo = 0; + + { + QOpenGLContext ctx; + ctx.create(); + + ctx.makeCurrent(&window); + + if (!QOpenGLFramebufferObject::hasOpenGLFramebufferObjects()) { + QSKIP("QOpenGLFramebufferObject not supported on this platform", SkipSingle); + } + + fbo = new QOpenGLFramebufferObject(128, 128); + + QVERIFY(fbo->handle() != 0); + } + + QCOMPARE(fbo->handle(), 0U); +} + +void tst_QOpenGL::openGLPaintDevice() +{ + QWindow window; + window.setGeometry(0, 0, 128, 128); + window.create(); + + QOpenGLContext ctx; + ctx.create(); + + ctx.makeCurrent(&window); + + QImage image(128, 128, QImage::Format_RGB32); + QPainter p(&image); + p.fillRect(0, 0, image.width() / 2, image.height() / 2, Qt::red); + p.fillRect(image.width() / 2, 0, image.width() / 2, image.height() / 2, Qt::green); + p.fillRect(image.width() / 2, image.height() / 2, image.width() / 2, image.height() / 2, Qt::blue); + p.fillRect(0, image.height() / 2, image.width() / 2, image.height() / 2, Qt::white); + p.end(); + + QOpenGLFramebufferObject fbo(128, 128); + fbo.bind(); + + QOpenGLPaintDevice device(128, 128); + p.begin(&device); + p.fillRect(0, 0, image.width() / 2, image.height() / 2, Qt::red); + p.fillRect(image.width() / 2, 0, image.width() / 2, image.height() / 2, Qt::green); + p.fillRect(image.width() / 2, image.height() / 2, image.width() / 2, image.height() / 2, Qt::blue); + p.fillRect(0, image.height() / 2, image.width() / 2, image.height() / 2, Qt::white); + p.end(); + + QCOMPARE(image, fbo.toImage().convertToFormat(QImage::Format_RGB32)); + + p.begin(&device); + p.fillRect(0, 0, image.width(), image.height(), Qt::black); + p.drawImage(0, 0, image); + p.end(); + + QCOMPARE(image, fbo.toImage().convertToFormat(QImage::Format_RGB32)); + + p.begin(&device); + p.fillRect(0, 0, image.width(), image.height(), Qt::black); + p.fillRect(0, 0, image.width(), image.height(), QBrush(image)); + p.end(); + + QCOMPARE(image, fbo.toImage().convertToFormat(QImage::Format_RGB32)); +} + +QTEST_MAIN(tst_QOpenGL) +#include "tst_qopengl.moc" diff --git a/tests/auto/qplaintextedit/qplaintextedit.pro b/tests/auto/qplaintextedit/qplaintextedit.pro index fef1ac83aa8..feac5e3f439 100644 --- a/tests/auto/qplaintextedit/qplaintextedit.pro +++ b/tests/auto/qplaintextedit/qplaintextedit.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += gui-private INCLUDEPATH += ../ diff --git a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp index 0802f517529..8a423dc933c 100644 --- a/tests/auto/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/qplaintextedit/tst_qplaintextedit.cpp @@ -50,7 +50,7 @@ #include <qapplication.h> #include <qclipboard.h> #include <qtextbrowser.h> -#include <private/qtextcontrol_p.h> +#include <private/qwidgettextcontrol_p.h> #include <qscrollbar.h> #include <qtextobject.h> @@ -1136,7 +1136,7 @@ void tst_QPlainTextEdit::mimeDataReimplementations() QCOMPARE(ed.insertCallCount, 0); #ifdef QT_BUILD_INTERNAL - QTextControl *control = qFindChild<QTextControl *>(&ed); + QWidgetTextControl *control = qFindChild<QWidgetTextControl *>(&ed); QVERIFY(control); control->canInsertFromMimeData(QApplication::clipboard()->mimeData()); diff --git a/tests/auto/qprogressbar/qprogressbar.pro b/tests/auto/qprogressbar/qprogressbar.pro index 6f0d7728fee..70d8c9111f5 100644 --- a/tests/auto/qprogressbar/qprogressbar.pro +++ b/tests/auto/qprogressbar/qprogressbar.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qprogressbar.cpp diff --git a/tests/auto/qprogressdialog/qprogressdialog.pro b/tests/auto/qprogressdialog/qprogressdialog.pro index 3a98d0b0171..f3861e4cd37 100644 --- a/tests/auto/qprogressdialog/qprogressdialog.pro +++ b/tests/auto/qprogressdialog/qprogressdialog.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qprogressdialog.cpp diff --git a/tests/auto/qpushbutton/qpushbutton.pro b/tests/auto/qpushbutton/qpushbutton.pro index 0d5f9418e1b..e2fd4559514 100644 --- a/tests/auto/qpushbutton/qpushbutton.pro +++ b/tests/auto/qpushbutton/qpushbutton.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qpushbutton.cpp diff --git a/tests/auto/qradiobutton/qradiobutton.pro b/tests/auto/qradiobutton/qradiobutton.pro index 90e23ab2e04..82b2ff20a86 100644 --- a/tests/auto/qradiobutton/qradiobutton.pro +++ b/tests/auto/qradiobutton/qradiobutton.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qradiobutton.cpp diff --git a/tests/auto/qscrollarea/qscrollarea.pro b/tests/auto/qscrollarea/qscrollarea.pro index bcb2ff347c4..5b2602bbdbc 100644 --- a/tests/auto/qscrollarea/qscrollarea.pro +++ b/tests/auto/qscrollarea/qscrollarea.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qscrollarea.cpp diff --git a/tests/auto/qscrollbar/qscrollbar.pro b/tests/auto/qscrollbar/qscrollbar.pro index 40ce0cf6b8e..262855452f1 100644 --- a/tests/auto/qscrollbar/qscrollbar.pro +++ b/tests/auto/qscrollbar/qscrollbar.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qscrollbar.cpp - mac*:CONFIG+=insignificant_test +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qscroller/qscroller.pro b/tests/auto/qscroller/qscroller.pro index 1c990dcb04c..6daf0b30d3d 100644 --- a/tests/auto/qscroller/qscroller.pro +++ b/tests/auto/qscroller/qscroller.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qscroller.cpp CONFIG += insignificant_test diff --git a/tests/auto/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro b/tests/auto/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro index db647a55c5f..c947e7a246d 100644 --- a/tests/auto/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro +++ b/tests/auto/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro @@ -1,3 +1,4 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qsharedpointer_and_qwidget.cpp DEFINES += SRCDIR=\\\"$$PWD/\\\" diff --git a/tests/auto/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp b/tests/auto/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp index 0bdf6c64cfc..90b71c517c8 100644 --- a/tests/auto/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp +++ b/tests/auto/qsharedpointer_and_qwidget/tst_qsharedpointer_and_qwidget.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include <QtGui/QWidget> -#include <QtGui/QPushButton> +#include <QtWidgets/QWidget> +#include <QtWidgets/QPushButton> #include <QtTest/QtTest> QT_BEGIN_NAMESPACE diff --git a/tests/auto/qsidebar/qsidebar.pro b/tests/auto/qsidebar/qsidebar.pro index 3ace4fe8a52..6487d201a4b 100644 --- a/tests/auto/qsidebar/qsidebar.pro +++ b/tests/auto/qsidebar/qsidebar.pro @@ -1,6 +1,7 @@ CONFIG += qttest_p4 QT += core-private +QT += widgets widgets-private SOURCES += tst_qsidebar.cpp TARGET = tst_qsidebar diff --git a/tests/auto/qsidebar/tst_qsidebar.cpp b/tests/auto/qsidebar/tst_qsidebar.cpp index 1104a176546..4a7123567da 100644 --- a/tests/auto/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/qsidebar/tst_qsidebar.cpp @@ -41,8 +41,8 @@ #include <QtTest/QtTest> -#include "../../../src/gui/dialogs/qsidebar_p.h" -#include "../../../src/gui/dialogs/qfilesystemmodel_p.h" +#include "../../../src/widgets/dialogs/qsidebar_p.h" +#include "../../../src/widgets/dialogs/qfilesystemmodel_p.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qsizegrip/qsizegrip.pro b/tests/auto/qsizegrip/qsizegrip.pro index 7bc43d52838..da6dd5af498 100644 --- a/tests/auto/qsizegrip/qsizegrip.pro +++ b/tests/auto/qsizegrip/qsizegrip.pro @@ -1,5 +1,6 @@ load(qttest_p4) INCLUDEPATH += . +QT += widgets SOURCES += tst_qsizegrip.cpp diff --git a/tests/auto/qslider/qslider.pro b/tests/auto/qslider/qslider.pro index 32fcc81941e..41f011649d6 100644 --- a/tests/auto/qslider/qslider.pro +++ b/tests/auto/qslider/qslider.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qslider.cpp diff --git a/tests/auto/qsoftkeymanager/qsoftkeymanager.pro b/tests/auto/qsoftkeymanager/qsoftkeymanager.pro index 61ed4dcc8b4..70329646298 100644 --- a/tests/auto/qsoftkeymanager/qsoftkeymanager.pro +++ b/tests/auto/qsoftkeymanager/qsoftkeymanager.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qsoftkeymanager.cpp requires(symbian) diff --git a/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro b/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro index 7edd4a53ccd..a60fbac9448 100644 --- a/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro +++ b/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro @@ -1,5 +1,7 @@ load(qttest_p4) +QT += gui widgets + INCLUDEPATH += $$PWD/../modeltest SOURCES += tst_qsortfilterproxymodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 33e86276801..093bcd2c864 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -48,6 +48,7 @@ #include <QtCore> #include <QtGui> +#include <QtWidgets/QSortFilterProxyModel> #include <qdebug.h> diff --git a/tests/auto/qspinbox/qspinbox.pro b/tests/auto/qspinbox/qspinbox.pro index a65554a0872..56a58dadce3 100644 --- a/tests/auto/qspinbox/qspinbox.pro +++ b/tests/auto/qspinbox/qspinbox.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qspinbox.cpp diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index 7f72afc7e75..6feef459e6d 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -1039,7 +1039,7 @@ void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate() QTRY_COMPARE(static_cast<QWidget *>(&spinbox), QApplication::activeWindow()); QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); spinbox.lineEdit()->setCursorPosition(2); //just after the first thousand separator - QTest::keyClick(0, Qt::Key_0); // let's insert a 0 + QTest::keyClick(static_cast<QWindow *>(0), Qt::Key_0); // let's insert a 0 QCOMPARE(spinbox.value(), 10000000); //it's been multiplied by 10 spinbox.clearFocus(); //make sure the value is correctly formatted QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); diff --git a/tests/auto/qsplitter/qsplitter.pro b/tests/auto/qsplitter/qsplitter.pro index bca4fc40fd4..a0e6878aa9b 100644 --- a/tests/auto/qsplitter/qsplitter.pro +++ b/tests/auto/qsplitter/qsplitter.pro @@ -1,7 +1,7 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qsplitter.cpp - wince*|symbian: { addFiles.files = extradata.txt setSizes3.dat addFiles.path = . diff --git a/tests/auto/qstackedlayout/qstackedlayout.pro b/tests/auto/qstackedlayout/qstackedlayout.pro index 1fbf5d33dbb..30f074d9b11 100644 --- a/tests/auto/qstackedlayout/qstackedlayout.pro +++ b/tests/auto/qstackedlayout/qstackedlayout.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qstackedlayout.cpp diff --git a/tests/auto/qstackedwidget/qstackedwidget.pro b/tests/auto/qstackedwidget/qstackedwidget.pro index b0ddc33077c..c9436c6a86b 100644 --- a/tests/auto/qstackedwidget/qstackedwidget.pro +++ b/tests/auto/qstackedwidget/qstackedwidget.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qstackedwidget.cpp diff --git a/tests/auto/qstandarditem/qstandarditem.pro b/tests/auto/qstandarditem/qstandarditem.pro index 9f22729a7d1..1d280fc2f59 100644 --- a/tests/auto/qstandarditem/qstandarditem.pro +++ b/tests/auto/qstandarditem/qstandarditem.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qstandarditem.cpp diff --git a/tests/auto/qstandarditemmodel/qstandarditemmodel.pro b/tests/auto/qstandarditemmodel/qstandarditemmodel.pro index 0fc47b36241..8c634b9630b 100644 --- a/tests/auto/qstandarditemmodel/qstandarditemmodel.pro +++ b/tests/auto/qstandarditemmodel/qstandarditemmodel.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private SOURCES += tst_qstandarditemmodel.cpp diff --git a/tests/auto/qstatictext/qstatictext.pro b/tests/auto/qstatictext/qstatictext.pro deleted file mode 100644 index 0c16c4c1496..00000000000 --- a/tests/auto/qstatictext/qstatictext.pro +++ /dev/null @@ -1,4 +0,0 @@ -load(qttest_p4) -QT = core core-private gui gui-private -SOURCES += tst_qstatictext.cpp - diff --git a/tests/auto/qstatusbar/qstatusbar.pro b/tests/auto/qstatusbar/qstatusbar.pro index 6c79001af11..51ec0e9cdb5 100644 --- a/tests/auto/qstatusbar/qstatusbar.pro +++ b/tests/auto/qstatusbar/qstatusbar.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qstatusbar.cpp diff --git a/tests/auto/qstringlistmodel/qstringlistmodel.pro b/tests/auto/qstringlistmodel/qstringlistmodel.pro index 9a71d9fc64c..fe70ed73456 100644 --- a/tests/auto/qstringlistmodel/qstringlistmodel.pro +++ b/tests/auto/qstringlistmodel/qstringlistmodel.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets HEADERS += qmodellistener.h SOURCES += tst_qstringlistmodel.cpp diff --git a/tests/auto/qstyle/qstyle.pro b/tests/auto/qstyle/qstyle.pro index eb198e28f52..5c949fa56ad 100644 --- a/tests/auto/qstyle/qstyle.pro +++ b/tests/auto/qstyle/qstyle.pro @@ -1,5 +1,6 @@ load(qttest_p4) TARGET.EPOCHEAPSIZE = 0x200000 0x800000 +QT += widgets SOURCES += tst_qstyle.cpp wince*|symbian: { diff --git a/tests/auto/qstyleoption/qstyleoption.pro b/tests/auto/qstyleoption/qstyleoption.pro index 523d9b39464..ccbb39d55bc 100644 --- a/tests/auto/qstyleoption/qstyleoption.pro +++ b/tests/auto/qstyleoption/qstyleoption.pro @@ -4,7 +4,7 @@ load(qttest_p4) TEMPLATE = app - +QT += widgets # Input SOURCES += tst_qstyleoption.cpp diff --git a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro index 1575616b19b..9dc296a51c7 100644 --- a/tests/auto/qstylesheetstyle/qstylesheetstyle.pro +++ b/tests/auto/qstylesheetstyle/qstylesheetstyle.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets widgets-private QT += gui-private # Input SOURCES += tst_qstylesheetstyle.cpp diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index 4f742c00eb0..e12b57bf722 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -542,7 +542,6 @@ void tst_QStyleSheetStyle::dynamicProperty() } #ifdef Q_OS_MAC -#include <QtGui/QMacStyle> void tst_QStyleSheetStyle::layoutSpacing() { qApp->setStyleSheet("* { color: red }"); diff --git a/tests/auto/qsystemtrayicon/qsystemtrayicon.pro b/tests/auto/qsystemtrayicon/qsystemtrayicon.pro index a77b4788a1a..8a6ea3d0a99 100644 --- a/tests/auto/qsystemtrayicon/qsystemtrayicon.pro +++ b/tests/auto/qsystemtrayicon/qsystemtrayicon.pro @@ -3,7 +3,7 @@ ############################################################ load(qttest_p4) - +QT += widgets SOURCES += tst_qsystemtrayicon.cpp diff --git a/tests/auto/qtabbar/qtabbar.pro b/tests/auto/qtabbar/qtabbar.pro index 15aa11d9fa8..befe5704ba0 100644 --- a/tests/auto/qtabbar/qtabbar.pro +++ b/tests/auto/qtabbar/qtabbar.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtabbar.cpp diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp index 2c5458edeac..79b0bda0edf 100644 --- a/tests/auto/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/qtabbar/tst_qtabbar.cpp @@ -172,14 +172,14 @@ void tst_QTabBar::setIconSize_data() QTest::addColumn<int>("sizeToSet"); QTest::addColumn<int>("expectedWidth"); - int iconDefault = qApp->style()->pixelMetric(QStyle::PM_TabBarIconSize); - int small = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize); - int large = qApp->style()->pixelMetric(QStyle::PM_LargeIconSize); + const int iconDefault = qApp->style()->pixelMetric(QStyle::PM_TabBarIconSize); + const int smallIconSize = qApp->style()->pixelMetric(QStyle::PM_SmallIconSize); + const int largeIconSize = qApp->style()->pixelMetric(QStyle::PM_LargeIconSize); QTest::newRow("default") << -1 << iconDefault; QTest::newRow("zero") << 0 << 0; QTest::newRow("same as default") << iconDefault << iconDefault; - QTest::newRow("large") << large << large; - QTest::newRow("small") << small << small; + QTest::newRow("large") << largeIconSize << largeIconSize; + QTest::newRow("small") << smallIconSize << smallIconSize; } void tst_QTabBar::setIconSize() diff --git a/tests/auto/qtableview/qtableview.pro b/tests/auto/qtableview/qtableview.pro index 0a2b5171ad2..f710fe37737 100644 --- a/tests/auto/qtableview/qtableview.pro +++ b/tests/auto/qtableview/qtableview.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += core-private gui-private TARGET.EPOCHEAPSIZE = 0x200000 0x800000 diff --git a/tests/auto/qtablewidget/qtablewidget.pro b/tests/auto/qtablewidget/qtablewidget.pro index d66d0ac67fa..0f09203fd1d 100644 --- a/tests/auto/qtablewidget/qtablewidget.pro +++ b/tests/auto/qtablewidget/qtablewidget.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtablewidget.cpp # This prevents the GCCE compile failure: "elf2e32: Error 1063: Fatal Error in diff --git a/tests/auto/qtabwidget/qtabwidget.pro b/tests/auto/qtabwidget/qtabwidget.pro index fb0960e3d7c..d551c66500f 100644 --- a/tests/auto/qtabwidget/qtabwidget.pro +++ b/tests/auto/qtabwidget/qtabwidget.pro @@ -1,6 +1,6 @@ load(qttest_p4) -QT += gui-private +QT += widgets widgets-private INCLUDEPATH += ../ diff --git a/tests/auto/qtabwidget/tst_qtabwidget.cpp b/tests/auto/qtabwidget/tst_qtabwidget.cpp index cf25bfadc80..3db105d3fec 100644 --- a/tests/auto/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/qtabwidget/tst_qtabwidget.cpp @@ -45,7 +45,7 @@ #include <qdebug.h> #include <qapplication.h> #include <qlabel.h> -#include <QtGui/qboxlayout.h> +#include <QtWidgets/qboxlayout.h> //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qtessellator/.gitignore b/tests/auto/qtessellator/.gitignore deleted file mode 100644 index 99f21607d8d..00000000000 --- a/tests/auto/qtessellator/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tst_qtessellator diff --git a/tests/auto/qtessellator/XrenderFake.h b/tests/auto/qtessellator/XrenderFake.h deleted file mode 100644 index adc6feb28bb..00000000000 --- a/tests/auto/qtessellator/XrenderFake.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -/** - These are just defines we need to compile this across platforms -**/ -/* - * - * Copyright © 2000 SuSE, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifndef _XRENDER_FAKE_H_ -#define _XRENDER_FAKE_H_ - -#ifndef _XRENDER_H_ -typedef double XDouble; - -typedef struct _XPointDouble { - XDouble x, y; -} XPointDouble; - -#define XDoubleToFixed(f) ((XFixed) ((f) * 65536)) -#define XFixedToDouble(f) (((XDouble) (f)) / 65536) - -typedef int XFixed; - -typedef struct _XPointFixed { - XFixed x, y; -} XPointFixed; - -typedef struct _XLineFixed { - XPointFixed p1, p2; -} XLineFixed; - -typedef struct _XTriangle { - XPointFixed p1, p2, p3; -} XTriangle; - -typedef struct _XTrapezoid { - XFixed top, bottom; - XLineFixed left, right; -} XTrapezoid; - -typedef struct _XSpanFix { - XFixed left, right, y; -} XSpanFix; - -typedef struct _XTrap { - XSpanFix top, bottom; -} XTrap; - -#endif - -#endif /* _XRENDER_H_ */ diff --git a/tests/auto/qtessellator/arc.data b/tests/auto/qtessellator/arc.data deleted file mode 100644 index f541372f102..00000000000 --- a/tests/auto/qtessellator/arc.data +++ /dev/null @@ -1,2 +0,0 @@ -330.399757,524.281800, 478.120912,550.329025, 477.831298,550.531815, 478.810211,541.885349, 478.599541,533.099490, 478.834287,533.328092, 330.341973,524.777589, 330.399757,524.281800, 330.370717,524.278415, 478.863031,532.828919, 479.097777,533.057521, 479.308667,541.907694, 478.323702,550.618639, 478.034088,550.821429, 330.312933,524.774204, 330.370717,524.278415, 330.399757,524.281800, 330.340478,524.278506, 475.092081,515.072484, 474.871052,515.401854, 472.271033,508.556408, 469.166670,501.975570, 465.531259,495.623207, 461.338095,489.463185, 456.560474,483.459373, 451.171691,477.575636, 438.453817,466.023860, 438.731065,466.049958, 330.475509,524.747774, 330.340478,524.278506, 330.399757,524.281800, 330.237181,524.308229, 438.492737,465.610413, 438.769984,465.636512, 451.529578,477.230250, 456.941391,483.142024, 461.742023,489.176805, 465.957079,495.369400, 469.612164,501.754612, 472.732885,508.367246, 475.344846,515.242105, 475.123817,515.571476, 330.372213,524.777498, 330.237181,524.308229, 330.399757,524.281800, 330.198654,524.334009, 419.097609,452.070769, 419.126347,452.478938, 406.609897,445.517586, 393.734425,439.489615, 380.499126,434.394819, 366.903191,430.232997, 352.945816,427.003943, 338.626193,424.707455, 323.943517,423.343328, 308.896980,422.911359, 309.141051,422.609824, 330.600976,524.476466, 330.198654,524.334009, 330.399757,524.281800, 330.111715,524.579537, 308.651790,422.712895, 308.895862,422.411361, 323.970137,422.844875, 338.685103,424.213480, 353.039954,426.516970, 367.033883,429.755143, 380.666084,433.927795, 393.935751,439.034722, 406.842076,445.075720, 419.384253,452.050587, 419.412991,452.458756, 330.514037,524.721995, 330.111715,524.579537, 330.399757,524.281800, 330.129715,524.633543, 283.437924,424.371616, 283.696186,424.514066, 274.149920,425.955307, 264.995958,427.789229, 256.246650,430.007574, 247.914348,432.602085, 240.011405,435.564508, 232.550171,438.886583, 225.542998,442.560055, 219.002238,446.576668, 212.940243,450.928163, 207.369363,455.606286, 202.301952,460.602778, 197.750359,465.909384, 193.726937,471.517846, 190.244038,477.419909, 187.314013,483.607314, 184.949214,490.071807, 184.768427,489.753472, 330.414019,524.284745, 330.129715,524.633543, 330.399757,524.281800, 330.298671,524.771258, 184.653079,490.239985, 184.472293,489.921650, 186.849209,483.425660, 189.795371,477.207106, 193.297958,471.274452, 197.344150,465.636164, 201.921125,460.300704, 207.016064,455.276537, 212.616146,450.572127, 218.708551,446.195939, 225.280457,442.156435, 232.319044,438.462081, 239.811492,435.121341, 247.744980,432.142678, 256.106687,429.534556, 264.883794,427.305441, 274.063479,425.463796, 283.632922,424.018084, 283.891183,424.160534, 330.582975,524.422461, 330.298671,524.771258, 330.399757,524.281800, 330.602547,524.571414, 313.237730,623.052184, 312.948116,623.254974, 297.919322,620.079380, 283.498874,615.993956, 269.752665,611.061508, 256.746589,605.344843, 244.546537,598.906766, 233.218404,591.810084, 222.828081,584.117603, 213.441462,575.892130, 205.124439,567.196470, 197.942906,558.093430, 191.962756,548.645817, 187.249880,538.916436, 183.870173,528.968094, 181.889527,518.863598, 181.373834,508.665752, 182.388989,498.437365, 182.678603,498.234575, 330.399757,524.281800, 330.602547,524.571414, 330.399757,524.281800, 473.399671,549.750400, 470.969436,559.210379, 467.157740,568.141238, 462.045076,576.508539, 455.711937,584.277845, 448.238814,591.414720, 439.706200,597.884727, 430.194588,603.653429, 419.784468,608.686389, 408.556335,612.949170, 396.590680,616.407336, 383.967995,619.026449, 370.768773,620.772073, 357.073506,621.609771, 342.962685,621.505106, 328.516805,620.423642, 313.816356,618.330940, 299.286707,615.269587, 285.342137,611.345049, 272.046506,606.617217, 259.463674,601.145981, 247.657501,594.991231, 236.691847,588.212857, 226.630571,580.870749, 217.537534,573.024797, 209.476596,564.734892, 202.511616,556.060922, 196.706454,547.062779, 192.124971,537.800351, 188.831026,528.333530, 186.888479,518.722205, 186.361190,509.026267, 187.313019,499.305604, 189.743255,489.845625, 193.554950,480.914766, 198.667614,472.547465, 205.000754,464.778159, 212.473876,457.641284, 221.006490,451.171277, 230.518103,445.402575, 240.928222,440.369615, 252.156355,436.106834, 264.122010,432.648668, 276.744695,430.029555, 289.943918,428.283931, 303.639185,427.446233, 317.750005,427.550898, 332.195885,428.632362, 346.896334,430.725063, 361.425983,433.786417, 375.370553,437.710955, 388.666184,442.438787, 401.249016,447.910023, 413.055189,454.064773, 424.020844,460.843147, 434.082119,468.185255, 443.175156,476.031206, 451.236095,484.321112, 458.201075,492.995082, 464.006236,501.993225, 468.587719,511.255653, 471.881665,520.722474, 473.824212,530.333799, 474.351500,540.029737, 473.399671,549.750400, 330.399757,524.281800, 472.907267,549.663576, 473.854306,539.992980, 473.329738,530.347191, 471.396677,520.785684, 468.118232,511.367936, 463.557515,502.153423, 457.777638,493.201621, 450.841711,484.572006, 442.812847,476.324055, 433.754155,468.517243, 423.728748,461.211047, 412.799737,454.464943, 401.030232,448.338407, 388.483346,442.890916, 375.222190,438.181944, 361.309874,434.270969, 346.809510,431.217467, 332.139266,429.127404, 317.728333,428.044226, 303.656359,427.933629, 290.002991,428.761309, 276.847876,430.492962, 264.270661,433.094284, 252.350994,436.530972, 241.168522,440.768720, 230.802891,445.773225, 221.333750,451.510184, 212.840745,457.945292, 205.403525,465.044245, 199.101735,472.772739, 194.015023,481.096470, 190.223037,489.981135, 187.805423,499.392428, 186.858385,509.063024, 187.382952,518.708813, 189.316014,528.270320, 192.594458,537.688068, 197.155175,546.902581, 202.935052,555.854383, 209.870979,564.483998, 217.899844,572.731949, 226.958535,580.538761, 236.983942,587.844957, 247.912954,594.591061, 259.682458,600.717597, 272.229344,606.165088, 285.490501,610.874060, 299.402817,614.785034, 313.903180,617.838537, 328.573424,619.928600, 342.984357,621.011778, 357.056331,621.122375, 370.709699,620.294695, 383.864814,618.563042, 396.442029,615.961720, 408.361696,612.525032, 419.544169,608.287284, 429.909799,603.282779, 439.378940,597.545820, 447.871945,591.110712, 455.309166,584.011759, 461.610956,576.283265, 466.697667,567.959534, 470.489654,559.074869, 472.907267,549.663576, 330.399757,524.281800, 330.454707,524.298165, 454.667822,577.456961, 454.762318,577.845876, 445.497902,587.443966, 440.285366,591.692799, 434.641502,595.603281, 421.926464,602.494557, 407.086134,608.288530, 406.823265,608.220270, 330.172154,524.697039, 330.454707,524.298165, 330.399757,524.281800, 330.540537,524.358965, 407.191648,607.882196, 406.928779,607.813936, 421.715525,602.044127, 434.366600,595.191446, 439.978360,591.303580, 445.160720,587.078457, 454.376603,577.527719, 454.471098,577.916634, 330.257983,524.757839, 330.540537,524.358965, 330.399757,524.281800, 330.568526,524.395792, 385.970533,613.309333, 385.803321,613.687465, 372.603353,615.647129, 359.376368,616.703732, 346.123165,616.857358, 332.844541,616.108092, 319.541292,614.456018, 306.214217,611.901220, 292.864113,608.443782, 279.491776,604.083789, 279.365802,603.713738, 330.145795,524.393211, 330.568526,524.395792, 330.399757,524.281800, 330.566895,524.662793, 279.786902,603.983321, 279.660927,603.613270, 293.007562,607.965618, 306.326866,611.416496, 319.619636,613.965989, 332.886669,615.614181, 346.128763,616.361156, 359.346715,616.206998, 372.541322,615.151791, 385.713383,613.195620, 385.546171,613.573752, 330.144165,524.660212, 330.566895,524.662793, 330.399757,524.281800, 330.312933,524.774204, 182.591778,498.726979, 182.881392,498.524189, 181.870979,508.702932, 182.383959,518.850950, 184.355179,528.905860, 187.719481,538.805277, 192.411711,548.486821, 198.366713,557.888107, 205.519330,566.946753, 213.804409,575.600375, 223.156792,583.786592, 233.511325,591.443019, 244.802851,598.507275, 256.966215,604.916975, 269.936262,610.609738, 283.647836,615.523180, 298.035780,619.594918, 313.034940,622.762570, 312.745326,622.965360, 330.110143,524.484590, 330.312933,524.774204, 330.399757,524.281800, - diff --git a/tests/auto/qtessellator/arc.h b/tests/auto/qtessellator/arc.h deleted file mode 100644 index 43492bbef6f..00000000000 --- a/tests/auto/qtessellator/arc.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef ARC_H -#define ARC_H - -#include "sample_data.h" - -FullData arcData(); - -#endif diff --git a/tests/auto/qtessellator/datafiles.qrc b/tests/auto/qtessellator/datafiles.qrc deleted file mode 100644 index bb0ed3766d9..00000000000 --- a/tests/auto/qtessellator/datafiles.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/"> - <file>simple.data</file> - <file>arc.data</file> -</qresource> -</RCC> diff --git a/tests/auto/qtessellator/dataparser.cpp b/tests/auto/qtessellator/dataparser.cpp deleted file mode 100644 index 8ad7ae881f2..00000000000 --- a/tests/auto/qtessellator/dataparser.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "dataparser.h" -#include <QString> -#include <QVector> -#include <QFile> -#include <QTextStream> - -#include <QtDebug> - -static QList<qreal> parseNumbersList(QByteArray::const_iterator &itr) -{ - QList<qreal> points; - QByteArray temp; - while ((*itr) == ' ') - ++itr; - while (((*itr) >= '0' && (*itr) <= '9') || - (*itr) == '-' || (*itr) == '+') { - temp = QByteArray(); - - if ((*itr) == '-') - temp += *itr++; - else if ((*itr) == '+') - temp += *itr++; - while ((*itr) >= '0' && (*itr) <= '9') - temp += *itr++; - if ((*itr) == '.') - temp += *itr++; - while ((*itr) >= '0' && (*itr) <= '9') - temp += *itr++; - if (( *itr) == 'e') { - temp += *itr++; - if ((*itr) == '-' || - (*itr) == '+') - temp += *itr++; - } - while ((*itr) >= '0' && (*itr) <= '9') - temp += *itr++; - while ((*itr) == ' ') - ++itr; - if ((*itr) == ',') - ++itr; - points.append(temp.toDouble()); - //eat the rest of space - while ((*itr) == ' ') - ++itr; - } - - return points; -} - -static QList<QPointF> parsePoints(const QByteArray &line) -{ - QList<QPointF> res; - - QByteArray::const_iterator it = line.constBegin(); - if (*it == ',') - ++it; - - QList<qreal> nums = parseNumbersList(it); - QList<qreal>::const_iterator nitr; - for (nitr = nums.begin(); nitr != nums.end(); ++nitr) { - qreal x = *nitr; - ++nitr; - if (nitr == nums.end()) { - qWarning() << "parsePoints: Even number of co-ordinates required, odd number found: skipping last point"; - break; - } - qreal y = *nitr; - res.append(QPointF(x, y)); - } - - return res; -} - -QList< QVector<QPointF> > parseData(const QByteArray &contents) -{ - QList<QByteArray> lines = contents.split('\n'); - QList<QByteArray>::const_iterator itr; - - QList< QVector<QPointF> > res; - QVector<QPointF> current; - - for (itr = lines.begin(); itr != lines.end(); ++itr) { - QByteArray line = (*itr).trimmed(); - if (line.isEmpty() || line.startsWith('/')) { - if (!current.isEmpty()) { - res.append(current); - current = QVector<QPointF>(); - } - continue; - } else { - QList<QPointF> lst = parsePoints(line); - current << lst.toVector(); - } - } - return res; -} - -QList< QVector<QPointF> > parseFile(const QString &fileName) -{ - QList< QVector<QPointF> > res; - QFile file(fileName); - - if (!file.open(QIODevice::ReadOnly)) { - qDebug()<<"couldn't open "<<fileName; - return res; - } - - QVector<QPointF> current; - - while (!file.atEnd()) { - QByteArray line = file.readLine().trimmed(); - if (line.isEmpty() || line.startsWith('/')) { - if (!current.isEmpty()) { - res.append(current); - current = QVector<QPointF>(); - } - continue; - } else { - QList<QPointF> lst = parsePoints(line); - current << lst.toVector(); - } - } - - return res; -} diff --git a/tests/auto/qtessellator/dataparser.h b/tests/auto/qtessellator/dataparser.h deleted file mode 100644 index 33b920ee732..00000000000 --- a/tests/auto/qtessellator/dataparser.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef DATAPARSER_H -#define DATAPARSER_H - -#include <QList> -#include <QVector> -#include <QPointF> - -QList< QVector<QPointF> > parseData(const QByteArray &contents); -QList< QVector<QPointF> > parseFile(const QString &fileName); - -#endif diff --git a/tests/auto/qtessellator/oldtessellator.cpp b/tests/auto/qtessellator/oldtessellator.cpp deleted file mode 100644 index fd39d20d945..00000000000 --- a/tests/auto/qtessellator/oldtessellator.cpp +++ /dev/null @@ -1,435 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "oldtessellator.h" -#include <QPointF> -#include <QVector> -#include <QList> -#include <QVariant> -#include <QVarLengthArray> -#include <qdebug.h> - -#include "limits.h" -#include "utils.h" - -#include "qnum.h" -#include "XrenderFake.h" - -/* - * Polygon tesselator - can probably be optimized a bit more - */ - -//#define QT_DEBUG_TESSELATOR -#define FloatToXFixed(i) (int)((i) * 65536) -#define IntToXFixed(i) ((i) << 16) - -//inline int qrealToXFixed(qreal f) -//{ return f << 8; } - -struct QEdge { - inline QEdge() - {} - inline QEdge(const QPointF &pt1, - const QPointF &pt2) - { - p1.x = XDoubleToFixed(pt1.x()); - p1.y = XDoubleToFixed(pt1.y()); - p2.x = XDoubleToFixed(pt2.x()); - p2.y = XDoubleToFixed(pt2.y()); - m = (pt1.x() - pt2.x()) ? (pt1.y() - pt2.y()) / (pt1.x() - pt2.x()) : 0; - im = m ? 1/m : 0; - b = pt1.y() - m * pt1.x(); - vertical = p1.x == p2.x; - horizontal = p1.y == p2.y; - } - - QPointF pf1, pf2; - XPointFixed p1, p2; - qreal m; - qreal im; - qreal b; - qreal intersection; - signed short winding; - bool vertical; - bool horizontal; -}; - -struct QVrtx { - typedef QList<QEdge> Edges; - XPointFixed coords; - Edges startingEdges; - Edges endingEdges; - Edges intersectingEdges; -}; - -struct QIntersectionPoint { - qreal x; - const QEdge *edge; -}; - -QT_BEGIN_NAMESPACE -Q_DECLARE_TYPEINFO(QEdge, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(QVrtx, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(QIntersectionPoint, Q_PRIMITIVE_TYPE); -QT_END_NAMESPACE - - -// used by the edge point sort algorithm -static qreal currentY = 0.f; - -static inline bool compareEdges(const QEdge *e1, const QEdge *e2) -{ - return e1->p1.y < e2->p1.y; -} - -static inline bool isEqual(const XPointFixed &p1, const XPointFixed &p2) -{ - return ((p1.x == p2.x) && (p1.y == p2.y)); -} - -static inline bool compareIntersections(const QIntersectionPoint &i1, const QIntersectionPoint &i2) -{ - if (qAbs(i1.x - i2.x) > 0.01) { // x != other.x in 99% of the cases - return i1.x < i2.x; - } else { - qreal x1 = (i1.edge->p1.x != i1.edge->p2.x) ? - ((currentY+1 - i1.edge->b)*i1.edge->m) : XFixedToDouble(i1.edge->p1.x); - qreal x2 = (i2.edge->p1.x != i2.edge->p2.x) ? - ((currentY+1 - i2.edge->b)*i2.edge->m) : XFixedToDouble(i2.edge->p1.x); -// qDebug() << ">>>" << currentY << i1.edge << i2.edge << x1 << x2; - return x1 < x2; - } -} - -#ifdef QT_USE_FIXED_POINT -inline int qrealToXFixed(qreal f) -{ return f.value() << 8; } -#else -#define qrealToXFixed FloatToXFixed -#endif - -static XTrapezoid QT_FASTCALL toXTrapezoid(XFixed y1, XFixed y2, const QEdge &left, const QEdge &right) -{ - XTrapezoid trap; - trap.top = y1; - trap.bottom = y2; - trap.left.p1.y = left.p1.y; - trap.left.p2.y = left.p2.y; - trap.right.p1.y = right.p1.y; - trap.right.p2.y = right.p2.y; - trap.left.p1.x = left.p1.x; - trap.left.p2.x = left.p2.x; - trap.right.p1.x = right.p1.x; - trap.right.p2.x = right.p2.x; - return trap; -} - -#ifdef QT_DEBUG_TESSELATOR -static void dump_edges(const QList<const QEdge *> &et) -{ - for (int x = 0; x < et.size(); ++x) { - qDebug() << "edge#" << x << et.at(x) << "(" - << XFixedToDouble(et.at(x)->p1.x) - << XFixedToDouble(et.at(x)->p1.y) - << ") (" - << XFixedToDouble(et.at(x)->p2.x) - << XFixedToDouble(et.at(x)->p2.y) - << ") b: " << et.at(x)->b << "m:" << et.at(x)->m; - } -} - -static void dump_trap(const XTrapezoid &t) -{ - qDebug() << "trap# t=" << t.top/65536.0 << "b=" << t.bottom/65536.0 << "h=" - << XFixedToDouble(t.bottom - t.top) << "\tleft p1: (" - << XFixedToDouble(t.left.p1.x) << ","<< XFixedToDouble(t.left.p1.y) - << ")" << "\tleft p2: (" << XFixedToDouble(t.left.p2.x) << "," - << XFixedToDouble(t.left.p2.y) << ")" << "\n\t\t\t\tright p1:(" - << XFixedToDouble(t.right.p1.x) << "," << XFixedToDouble(t.right.p1.y) << ")" - << "\tright p2:(" << XFixedToDouble(t.right.p2.x) << "," - << XFixedToDouble(t.right.p2.y) << ")"; -} -#endif - - -typedef int Q27Dot5; -#define Q27Dot5ToDouble(i) (i/32.) -#define FloatToQ27Dot5(i) (int)((i) * 32) -#define IntToQ27Dot5(i) ((i) << 5) -#define Q27Dot5ToXFixed(i) ((i) << 11) -#define Q27Dot5Factor 32 - -void old_tesselate_polygon(QVector<XTrapezoid> *traps, const QPointF *pg, int pgSize, - bool winding) -{ - QVector<QEdge> edges; - edges.reserve(128); - qreal ymin(INT_MAX/256); - qreal ymax(INT_MIN/256); - - //painter.begin(pg, pgSize); - if (pg[0] != pg[pgSize-1]) - qWarning() << Q_FUNC_INFO << "Malformed polygon (first and last points must be identical)"; - // generate edge table -// qDebug() << "POINTS:"; - for (int x = 0; x < pgSize-1; ++x) { - QEdge edge; - QPointF p1(Q27Dot5ToDouble(FloatToQ27Dot5(pg[x].x())), - Q27Dot5ToDouble(FloatToQ27Dot5(pg[x].y()))); - QPointF p2(Q27Dot5ToDouble(FloatToQ27Dot5(pg[x+1].x())), - Q27Dot5ToDouble(FloatToQ27Dot5(pg[x+1].y()))); - -// qDebug() << " " -// << p1; - edge.winding = p1.y() > p2.y() ? 1 : -1; - if (edge.winding > 0) - qSwap(p1, p2); - edge.p1.x = XDoubleToFixed(p1.x()); - edge.p1.y = XDoubleToFixed(p1.y()); - edge.p2.x = XDoubleToFixed(p2.x()); - edge.p2.y = XDoubleToFixed(p2.y()); - - edge.m = (p1.y() - p2.y()) / (p1.x() - p2.x()); // line derivative - edge.b = p1.y() - edge.m * p1.x(); // intersection with y axis - edge.m = edge.m != 0.0 ? 1.0 / edge.m : 0.0; // inverted derivative - edges.append(edge); - ymin = qMin(ymin, qreal(XFixedToDouble(edge.p1.y))); - ymax = qMax(ymax, qreal(XFixedToDouble(edge.p2.y))); - } - - QList<const QEdge *> et; // edge list - for (int i = 0; i < edges.size(); ++i) - et.append(&edges.at(i)); - - // sort edge table by min y value - qSort(et.begin(), et.end(), compareEdges); - - // eliminate shared edges - for (int i = 0; i < et.size(); ++i) { - for (int k = i+1; k < et.size(); ++k) { - const QEdge *edgeI = et.at(i); - const QEdge *edgeK = et.at(k); - if (edgeK->p1.y > edgeI->p1.y) - break; - if (edgeI->winding != edgeK->winding && - isEqual(edgeI->p1, edgeK->p1) && isEqual(edgeI->p2, edgeK->p2) - ) { - et.removeAt(k); - et.removeAt(i); - --i; - break; - } - } - } - - if (ymax <= ymin) - return; - QList<const QEdge *> aet; // edges that intersects the current scanline - -// if (ymin < 0) -// ymin = 0; -// if (paintEventClipRegion) // don't scan more lines than we have to -// ymax = paintEventClipRegion->boundingRect().height(); - -#ifdef QT_DEBUG_TESSELATOR - qDebug("==> ymin = %f, ymax = %f", ymin, ymax); -#endif // QT_DEBUG_TESSELATOR - - currentY = ymin; // used by the less than op - for (qreal y = ymin; y < ymax;) { - // fill active edge table with edges that intersect the current line - for (int i = 0; i < et.size(); ++i) { - const QEdge *edge = et.at(i); - if (edge->p1.y > XDoubleToFixed(y)) - break; - aet.append(edge); - et.removeAt(i); - --i; - } - - // remove processed edges from active edge table - for (int i = 0; i < aet.size(); ++i) { - if (aet.at(i)->p2.y <= XDoubleToFixed(y)) { - aet.removeAt(i); - --i; - } - } - if (aet.size()%2 != 0) { -#ifndef QT_NO_DEBUG - qWarning("QX11PaintEngine: aet out of sync - this should not happen."); -#endif - return; - } - - // done? - if (!aet.size()) { - if (!et.size()) { - break; - } else { - y = currentY = XFixedToDouble(et.at(0)->p1.y); - continue; - } - } - - // calculate the next y where we have to start a new set of trapezoids - qreal next_y(INT_MAX/256); - for (int i = 0; i < aet.size(); ++i) { - const QEdge *edge = aet.at(i); - if (XFixedToDouble(edge->p2.y) < next_y) - next_y = XFixedToDouble(edge->p2.y); - } - - if (et.size() && next_y > XFixedToDouble(et.at(0)->p1.y)) - next_y = XFixedToDouble(et.at(0)->p1.y); - - int aetSize = aet.size(); - for (int i = 0; i < aetSize; ++i) { - for (int k = i+1; k < aetSize; ++k) { - const QEdge *edgeI = aet.at(i); - const QEdge *edgeK = aet.at(k); - qreal m1 = edgeI->m; - qreal b1 = edgeI->b; - qreal m2 = edgeK->m; - qreal b2 = edgeK->b; - - if (qAbs(m1 - m2) < 0.001) - continue; - - // ### intersect is not calculated correctly when optimized with -O2 (gcc) - volatile qreal intersect = 0; - if (!qIsFinite(b1)) - intersect = (1.f / m2) * XFixedToDouble(edgeI->p1.x) + b2; - else if (!qIsFinite(b2)) - intersect = (1.f / m1) * XFixedToDouble(edgeK->p1.x) + b1; - else - intersect = (b1*m1 - b2*m2) / (m1 - m2); - - if (intersect > y && intersect < next_y) - next_y = intersect; - } - } - - XFixed yf, next_yf; - yf = qrealToXFixed(y); - next_yf = qrealToXFixed(next_y); - - if (yf == next_yf) { - y = currentY = next_y; - continue; - } - -#ifdef QT_DEBUG_TESSELATOR - qDebug("###> y = %f, next_y = %f, %d active edges", y, next_y, aet.size()); - qDebug("===> edges"); - dump_edges(et); - qDebug("===> active edges"); - dump_edges(aet); -#endif - // calc intersection points - QVarLengthArray<QIntersectionPoint> isects(aet.size()+1); - for (int i = 0; i < isects.size()-1; ++i) { - const QEdge *edge = aet.at(i); - isects[i].x = (edge->p1.x != edge->p2.x) ? - ((y - edge->b)*edge->m) : XFixedToDouble(edge->p1.x); - isects[i].edge = edge; - } - - if (isects.size()%2 != 1) - qFatal("%s: number of intersection points must be odd", Q_FUNC_INFO); - - // sort intersection points - qSort(&isects[0], &isects[isects.size()-1], compareIntersections); -// qDebug() << "INTERSECTION_POINTS:"; -// for (int i = 0; i < isects.size(); ++i) -// qDebug() << isects[i].edge << isects[i].x; - - if (winding) { - // winding fill rule - for (int i = 0; i < isects.size()-1;) { - int winding = 0; - const QEdge *left = isects[i].edge; - const QEdge *right = 0; - winding += isects[i].edge->winding; - for (++i; i < isects.size()-1 && winding != 0; ++i) { - winding += isects[i].edge->winding; - right = isects[i].edge; - } - if (!left || !right) - break; - //painter.addTrapezoid(&toXTrapezoid(yf, next_yf, *left, *right)); - traps->append(toXTrapezoid(yf, next_yf, *left, *right)); - } - } else { - // odd-even fill rule - for (int i = 0; i < isects.size()-2; i += 2) { - //painter.addTrapezoid(&toXTrapezoid(yf, next_yf, *isects[i].edge, *isects[i+1].edge)); - traps->append(toXTrapezoid(yf, next_yf, *isects[i].edge, *isects[i+1].edge)); - } - } - y = currentY = next_y; - } - -#ifdef QT_DEBUG_TESSELATOR - qDebug("==> number of trapezoids: %d - edge table size: %d\n", traps->size(), et.size()); - - for (int i = 0; i < traps->size(); ++i) - dump_trap(traps->at(i)); -#endif - - // optimize by unifying trapezoids that share left/right lines - // and have a common top/bottom edge -// for (int i = 0; i < tps.size(); ++i) { -// for (int k = i+1; k < tps.size(); ++k) { -// if (i != k && tps.at(i).right == tps.at(k).right -// && tps.at(i).left == tps.at(k).left -// && (tps.at(i).top == tps.at(k).bottom -// || tps.at(i).bottom == tps.at(k).top)) -// { -// tps[i].bottom = tps.at(k).bottom; -// tps.removeAt(k); -// i = 0; -// break; -// } -// } -// } - //static int i = 0; - //QImage img = painter.end(); - //img.save(QString("res%1.png").arg(i++), "PNG"); -} diff --git a/tests/auto/qtessellator/oldtessellator.h b/tests/auto/qtessellator/oldtessellator.h deleted file mode 100644 index 2023dee16ee..00000000000 --- a/tests/auto/qtessellator/oldtessellator.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef NEWTESSELATOR_H -#define NEWTESSELATOR_H - -#include <QVector> -#include <QPointF> -#include "XrenderFake.h" - -void old_tesselate_polygon(QVector<XTrapezoid> *traps, const QPointF *pg, int pgSize, - bool winding); - - -#endif diff --git a/tests/auto/qtessellator/qnum.h b/tests/auto/qtessellator/qnum.h deleted file mode 100644 index 4027bc69489..00000000000 --- a/tests/auto/qtessellator/qnum.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#ifndef QNUM_H -#define QNUM_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 "QtCore/qglobal.h" - -static const unsigned char qt_be_inf_bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }; -static const unsigned char qt_le_inf_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; -static inline double qtInf() -{ - return *reinterpret_cast<const double *>(QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_inf_bytes : qt_le_inf_bytes); -} -#define Q_INFINITY (::qtInf()) - -// Signaling NAN -static const unsigned char qt_be_snan_bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }; -static const unsigned char qt_le_snan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }; -static inline double qtSnan() -{ - return *reinterpret_cast<const double *>(QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_snan_bytes : qt_le_snan_bytes); -} -#define Q_SNAN (::qtSnan()) - -// Quiet NAN -static const unsigned char qt_be_qnan_bytes[] = { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 }; -static const unsigned char qt_le_qnan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0xff }; -static inline double qtQnan() -{ - return *reinterpret_cast<const double *>(QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_qnan_bytes : qt_le_qnan_bytes); -} -#define Q_QNAN (::qtQnan()) - -static inline bool qIsInf(double d) -{ - uchar *ch = (uchar *)&d; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) == 0x7f && ch[1] == 0xf0; - } else { - return (ch[7] & 0x7f) == 0x7f && ch[6] == 0xf0; - } -} - -static inline bool qIsNaN(double d) -{ - uchar *ch = (uchar *)&d; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) == 0x7f && ch[1] > 0xf0; - } else { - return (ch[7] & 0x7f) == 0x7f && ch[6] > 0xf0; - } -} - -static inline bool qIsFinite(double d) -{ - uchar *ch = (uchar *)&d; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) != 0x7f || (ch[1] & 0xf0) != 0xf0; - } else { - return (ch[7] & 0x7f) != 0x7f || (ch[6] & 0xf0) != 0xf0; - } -} - -static inline bool qIsInf(float d) -{ - uchar *ch = (uchar *)&d; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) == 0x7f && ch[1] == 0x80; - } else { - return (ch[3] & 0x7f) == 0x7f && ch[2] == 0x80; - } -} - -static inline bool qIsNaN(float d) -{ - uchar *ch = (uchar *)&d; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) == 0x7f && ch[1] > 0x80; - } else { - return (ch[3] & 0x7f) == 0x7f && ch[2] > 0x80; - } -} - -static inline bool qIsFinite(float d) -{ - uchar *ch = (uchar *)&d; - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { - return (ch[0] & 0x7f) != 0x7f || (ch[1] & 0x80) != 0x80; - } else { - return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0x80) != 0x80; - } -} - -#endif // QNUMERIC_P_H diff --git a/tests/auto/qtessellator/qtessellator.pro b/tests/auto/qtessellator/qtessellator.pro deleted file mode 100644 index 6821d0e9093..00000000000 --- a/tests/auto/qtessellator/qtessellator.pro +++ /dev/null @@ -1,10 +0,0 @@ -load(qttest_p4) - -QT += gui-private - -SOURCES += tst_tessellator.cpp testtessellator.cpp oldtessellator.cpp utils.cpp simple.cpp dataparser.cpp arc.cpp -HEADERS += oldtessellator.h testtessellator.h utils.h XRenderFake.h simple.h qnum.h dataparser.h arc.h - -RESOURCES += datafiles.qrc - - diff --git a/tests/auto/qtessellator/sample_data.h b/tests/auto/qtessellator/sample_data.h deleted file mode 100644 index 245911aae7f..00000000000 --- a/tests/auto/qtessellator/sample_data.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SAMPLE_DATA_H -#define SAMPLE_DATA_H - -#include <QVector> -#include <QPointF> -#include <QList> - -typedef QVector<QPointF> SampleData; -typedef QList< SampleData > FullData; - -#endif diff --git a/tests/auto/qtessellator/simple.data b/tests/auto/qtessellator/simple.data deleted file mode 100644 index ab46f3969b5..00000000000 --- a/tests/auto/qtessellator/simple.data +++ /dev/null @@ -1,195 +0,0 @@ -16.000000,6.000000, 16.000000,18.000000, 16.000000,1.000000, 16.000000,14.000000, 10.000000,17.000000, 16.000000,6.000000, - -10,10,16,18,18,14,21,18,25,18,25,11,15,7,15,12,13,12,10,10 - -10,10,20,10,20,20,10,20,10,10 - -0,0,0,10,12,10,12,0,0,0,4,2,4,6,10,6,10,2,4,2,0,0 - -0,0,0,10,12,10,12,0,0,0,4,2,4,6,10,6,10,2,4,2,0,0,0,0,0,10,12,10,12,0,0,0,4,2,4,6,10,6,10,2,4,2,0,0 - -10,11,22,10,12,4,16,14,20,4,10,11 - -10,11,22,10,12,4,16,14,20,4,10,11,10,11,22,10,12,4,16,14,20,4,10,11 - -0,0,10,10,10,0,0,10,0,0 - -0,15,15,15,15,0,5,0,5,20,10,20,10,5,0,5,0,15 - -0,15,15,15,15,0,5,0,5,20,10,20,10,5,0,5,0,15,0,15,15,15,15,0,5,0,5,20,10,20,10,5,0,5,0,15 - -0,10,10,10,10,0,0,0,10,10,0,10,10,0,10,5,0,5,5,0,5,10,0,10 - -10,16,19,8,8,8,4,4,17,14,1,1,10,16 - -19,1,13,4,15,19,5,4,8,15,15,7,0,7,15,8,9,1,19,1 - -15,9,18,3,14,11,4,12,10,14,7,16,15,9 - -16,10,4,14,12,15,17,10,14,19,13,11,16,10 - -5,19,12,8,12,12,7,19,9,14,3,18,5,19 - -3,14,11,2,1,15,3,13,10,3,15,11,3,14 - -8,6,8,1,12,2,0,4,4,15,10,9,8,6 - -15,16,0,3,16,16,19,5,10,9,15,4,15,16 - -3,19,17,14,9,8,16,6,16,7,17,6,3,19 - -0,13,0,4,5,5,7,10,4,10,0,8,0,13 - -4,18,5,17,19,2,0,4,8,8,10,12,4,18 - -13,12,15,19,11,5,0,14,19,15,11,11,13,12 - -7,11,18,8,9,7,17,7,3,7,12,1,7,11 - -10,10,7,8,13,14,7,9,8,9,6,17,10,10 - -13,16,7,13,19,5,8,18,1,11,7,6,13,16 - -9,6,16,11,7,10,14,12,17,2,15,13,9,6 - -9,11,17,17,2,14,19,15,1 12,16,15,9,11 - -1,8,7,17,0,19,12,7,5,14,13,6,1,8 - -11,7,13,6,8,6,7,11,7,16,13,6,11,7 - -1,1,18,1,1,14,2,14,14,3,18,1,1,1 - -1495,174,1965,1194,622,795,1892,1044,1618,1608,1464,1758,1495,174 - -12.437167782336,18.332947529852,6.037403680384,0.577168781310,17.369421254843,3.538437001407,1.208027666435,3.512877216563,6.647234912962,10.036138510332,13.422909136862,2.474576039240,12.437167782336,18.332947529852 - -5.591339580715,19.434930747375, 10.417904593050,11.852347580716, 18.050480354577,3.041639151052, 5.511732324958,17.206167224795, 4.091005269438,17.285228203982, 14.422692870721,17.285191211849, 5.591339580715,19.434930747375 - -9.662125930190,13.671313980594, 18.663120605052,13.914435822517, 4.666417893022,0.991358347237, 5.612019170076,9.671168159693, 14.484839309007,1.828807275742, 14.513027202338,18.705772804096, 9.662125930190,13.671313980594 - -85,54,64,169,73,28,77,104,122,113,7,90,85,54 - -8,9,13,2,16,8,6,16,15,18,18,1,8,9 - -1,19,1,19,16,4,12,4,17,10,9,18,1,19 - -7,5,4,1,17,16,4,1,18,9,19,18,7,5 - -5,2,10,7,2,15,10,7,19,7,4,18,5,2 - -193.344000,167.079000,193.927000,223.478000,192.927000,224.489000,191.461000,224.489000,190.462000,223.517000,190.144000,214.550000,189.758000,207.495000,189.303000,202.313000,189.303000,202.314000,188.432000,196.134000,187.401000,191.208000,186.180000,187.421000,185.546000,186.021000,184.895000,184.970000,184.121000,184.112000,183.389000,183.504000,182.740000,183.226000,181.868000,183.160000,181.868000,183.160000,174.478000,183.160000,175.478000,182.160000,175.478000,365.969000,175.506000,372.881000,175.590000,378.848000,175.930000,387.984000,176.507000,393.460000,176.506000,393.454000,177.006000,395.653000,177.567000,397.365000,178.244000,398.733000,178.559000,399.226000,178.834000,399.548000,179.193000,399.834000,179.499000,400.046000,179.699000,400.114000,180.048000,400.119000,180.048000,400.119000,181.868000,400.119000,182.868000,401.119000,182.868000,407.673000,181.868000,408.673000,159.625000,408.673000,158.625000,407.673000,158.625000,401.119000,159.625000,400.119000,161.481000,400.119000,161.858000,400.113000,162.068000,400.029000,162.391000,399.766000,162.784000,399.401000,163.092000,398.979000,163.431000,398.358000,164.137000,396.643000,164.715000,394.484000,165.207000,391.744000,165.207000,391.744000,165.679000,386.379000,165.959000,377.809000,166.051000,365.969000,166.051000,182.160000,167.051000,183.160000,160.744000,183.160000,159.690000,183.204000,158.850000,183.365000,158.032000,183.688000,157.329000,184.077000,156.837000,184.522000,156.371000,185.190000,156.377000,185.181000,155.135000,188.005000,154.052000,192.134000,153.069000,197.733000,152.247000,204.835000,151.685000,213.407000,151.378000,223.505000,150.378000,224.489000,148.912000,224.489000,147.912000,223.478000,148.531000,167.079000,149.531000,166.090000,192.344000,166.090000,193.344000,167.079000,192.344000,168.090000,149.531000,168.090000,150.531000,167.100000,149.912000,223.500000,148.912000,222.489000,150.378000,222.489000,149.378000,223.472000,149.691000,213.305000,150.264000,204.608000,151.091000,197.438000,152.142000,191.648000,153.353000,187.164000,154.663000,184.149000,154.669000,184.139000,155.353000,183.276000,156.247000,182.469000,157.167000,181.884000,158.209000,181.511000,159.466000,181.255000,160.744000,181.160000,160.744000,181.160000,167.051000,181.160000,168.051000,182.160000,168.051000,365.969000,167.953000,377.887000,167.663000,386.600000,167.185000,392.042000,167.185000,392.043000,166.641000,394.941000,165.969000,397.395000,165.212000,399.268000,164.738000,400.056000,164.180000,400.787000,163.652000,401.319000,163.002000,401.697000,162.185000,401.997000,161.481000,402.119000,161.481000,402.119000,159.625000,402.119000,160.625000,401.119000,160.625000,407.673000,159.625000,406.673000,181.868000,406.673000,180.868000,407.673000,180.868000,401.119000,181.868000,402.119000,180.048000,402.119000,179.401000,402.020000,178.647000,401.777000,178.044000,401.471000,177.539000,401.029000,176.994000,400.418000,176.533000,399.769000,175.791000,398.232000,175.109000,396.207000,174.543000,393.839000,174.542000,393.833000,174.221000,391.520000,173.956000,388.260000,173.599000,378.945000,173.478000,365.969000,173.478000,182.160000,174.478000,181.160000,181.868000,181.160000,183.093000,181.365000,184.400000,181.902000,185.484000,182.650000,186.386000,183.691000,187.271000,185.083000,188.032000,186.667000,188.032000,186.667000,189.288000,190.589000,190.384000,195.766000,191.290000,202.082000,191.290000,202.083000,191.748000,207.310000,192.140000,214.448000,192.461000,223.460000,191.461000,222.489000,192.927000,222.489000,191.927000,223.499000,191.344000,167.100000,192.344000,168.090000,193.344000,167.079000 - -13.000000,7.000000, 8.000000,15.000000, 16.000000,2.000000, 17.000000,13.000000, 5.000000,10.000000, 19.000000,17.000000, 13.000000,7.000000 - -10.000000,6.000000, 16.000000,4.000000, 0.000000,10.000000, 14.000000,10.000000, 9.000000,5.000000, 5.000000,15.000000, 10.000000,6.000000 - -2.000000,18.000000, 14.000000,11.000000, 2.000000,14.000000, 5.000000,19.000000, 14.000000,19.000000, 2.000000,1.000000, 2.000000,18.000000 - -18.000000,14.000000, 18.000000,6.000000, 18.000000,18.000000, 3.000000,9.000000, 19.000000,10.000000, 3.000000,19.000000, 18.000000,14.000000 - -0.000000,14.000000, 5.000000,11.000000, 19.000000,5.000000, 0.000000,16.000000, 12.000000,13.000000, 0.000000,14.000000, 0.000000,14.000000 - -6.000000,9.000000, 4.000000,7.000000, 11.000000,14.000000, 4.000000,10.000000, 11.000000,8.000000, 9.000000,15.000000, 6.000000,9.000000 - -15.000000,4.000000, 15.000000,3.000000, 11.000000,13.000000, 12.000000,4.000000, 19.000000,5.000000, 6.000000,9.000000, 15.000000,4.000000 - -4.000000,2.000000, 11.000000,8.000000, 19.000000,19.000000, 1.000000,18.000000, 19.000000,0.000000, 15.000000,15.000000, 4.000000,2.000000 - -7.000000,14.000000, 18.000000,6.000000, 8.000000,2.000000, 14.000000,14.000000, 4.000000,8.000000, 9.000000,11.000000, 7.000000,14.000000 - -16.000000,8.000000, 15.000000,9.000000, 9.000000,17.000000, 9.000000,16.000000, 4.000000,3.000000, 8.000000,16.000000, 16.000000,8.000000 - -11.000000,10.000000, 12.000000,10.000000, 11.000000,2.000000, 7.000000,4.000000, 5.000000,13.000000, 11.000000,10.000000, 11.000000,10.000000 - -17.000000,1.000000, 2.000000,15.000000, 17.000000,17.000000, 7.000000,7.000000, 16.000000,19.000000, 3.000000,18.000000, 7.000000,0.000000, 7.000000,0.000000, 6.000000,4.000000, 2.000000,1.000000, 4.000000,2.000000, 7.000000,16.000000, 11.000000,16.000000, 7.000000,3.000000, 11.000000,16.000000, 5.000000,9.000000, 18.000000,8.000000, 4.000000,15.000000, 5.000000,11.000000, 17.000000,1.000000 - -10.000000,8.000000, 12.000000,3.000000, 10.000000,8.000000, 10.000000,19.000000, 2.000000,8.000000, 16.000000,11.000000, 10.000000,8.000000 - -10.000000,10.000000, 13.000000,11.000000, 18.000000,2.000000, 13.000000,11.000000, 11.000000,10.000000, 10.000000,14.000000, 10.000000,10.000000 - -8.000000,13.000000, 8.000000,7.000000, 12.000000,19.000000, 8.000000,8.000000, 8.000000,7.000000, 8.000000,2.000000, 8.000000,13.000000 - -//1.000000,7.000000, 12.000000,16.000000, 3.000000,4.000000, 16.000000,18.000000, 11.000000,3.000000, 16.000000,18.000000, 2.000000,4.000000, 11.000000,4.000000, 11.000000,16.000000, 1.000000,7.000000 - -1.000000,0.000000, 18.000000,13.000000, 0.000000,4.000000, 4.000000,6.000000, 16.000000,15.000000, 4.000000,3.000000, 4.000000,16.000000, 1.000000,0.000000 - -17.000000,17.000000, 7.000000,12.000000, 1.000000,17.000000, 8.000000,17.000000, 15.000000,15.000000, 17.000000,12.000000, 12.000000,15.000000, 5.000000,11.000000, 9.000000,13.000000, 15.000000,18.000000, 7.000000,8.000000, 17.000000,17.000000 - -//4.000000,0.000000, 15.000000,2.000000, 1.000000,2.000000, 17.000000,9.000000, 11.000000,4.000000, 3.000000,2.000000, 4.000000,8.000000, 6.000000,12.000000, 18.000000,15.000000, 15.000000,2.000000, 4.000000,0.000000 - -5.000000,14.000000, 7.000000,15.000000, 9.000000,15.000000, 5.000000,16.000000, 12.000000,2.000000, 7.000000,12.000000, 5.000000,11.000000, 10.000000,9.000000, 5.000000,4.000000, 11.000000,18.000000, 9.000000,8.000000, 5.000000,14.000000 - -//1.000000,19.000000, 6.000000,5.000000, 12.000000,6.000000, 8.000000,5.000000, 6.000000,1.000000, 8.000000,5.000000, 2.000000,5.000000, 1.000000,19.000000, - -3.000000,18.000000, 0.000000,2.000000, 13.000000,0.000000, 1.000000,0.000000, 19.000000,19.000000, 2.000000,1.000000, 17.000000,0.000000, 3.000000,18.000000, - -12.000000,10.000000, 4.000000,19.000000, 10.000000,0.000000, 6.000000,19.000000, 4.000000,16.000000, 4.000000,19.000000, 0.000000,15.000000, 4.000000,16.000000, 11.000000,5.000000, 12.000000,10.000000, - -0.000000,2.000000, 9.000000,11.000000, 13.000000,8.000000, 8.000000,7.000000, 10.000000,15.000000, 16.000000,1.000000, 9.000000,11.000000, 8.000000,14.000000, 10.000000,11.000000, 0.000000,2.000000 - -13.000000,11.000000, 5.000000,7.000000, 15.000000,15.000000, 0.000000,3.000000, 16.000000,17.000000, 3.000000,9.000000, 6.000000,6.000000, 5.000000,7.000000, 3.000000,6.000000, 13.000000,11.000000, - -6.000000,6.000000, 2.000000,5.000000, 15.000000,6.000000, 14.000000,8.000000, 10.000000,11.000000, 18.000000,3.000000, 10.000000,11.000000, 15.000000,1.000000, 15.000000,19.000000, 6.000000,6.000000, - -15.000000,15.000000, 14.000000,14.000000, 1.000000,19.000000, 19.000000,12.000000, 1.000000,19.000000, 16.000000,18.000000, 2.000000,17.000000, 14.000000,19.000000, 2.000000,14.000000, 15.000000,15.000000, - -17.000000,1.000000, 2.000000,14.000000, 19.000000,11.000000, 18.000000,11.000000, 4.000000,16.000000, 10.000000,11.000000, 8.000000,16.000000, 12.000000,12.000000, 11.000000,14.000000, 17.000000,1.000000, - -17.000000,4.000000, 18.000000,9.000000, 10.000000,1.000000, 18.000000,9.000000, 4.000000,12.000000, 14.000000,17.000000, 4.000000,1.000000, 5.000000,17.000000, 4.000000,3.000000, 17.000000,4.000000, - -6.000000,12.000000, 13.000000,1.000000, 10.000000,15.000000, 0.000000,1.000000, 12.000000,12.000000, 1.000000,2.000000, 14.000000,2.000000, 9.000000,10.000000, 10.000000,9.000000, 6.000000,12.000000, - -10.000000,2.000000, 1.000000,19.000000, 18.000000,10.000000, 5.000000,11.000000, 13.000000,3.000000, 16.000000,12.000000, 13.000000,2.000000, 19.000000,4.000000, 12.000000,16.000000, 10.000000,2.000000, - -15.000000,18.000000, 9.000000,4.000000, 17.000000,19.000000, 8.000000,2.000000, 12.000000,14.000000, 16.000000,4.000000, 17.000000,11.000000, 1.000000,13.000000, 16.000000,8.000000, 15.000000,18.000000, - -0.000000,1.000000, 3.000000,5.000000, 6.000000,18.000000, 8.000000,10.000000, 2.000000,9.000000, 12.000000,13.000000, 17.000000,0.000000, 3.000000,10.000000, 16.000000,1.000000, 0.000000,1.000000, - -2.000000,5.000000, 5.000000,12.000000, 11.000000,2.000000, 1.000000,19.000000, 6.000000,5.000000, 17.000000,1.000000, 8.000000,0.000000, 14.000000,10.000000, 2.000000,5.000000 - -12.000000,17.000000, 14.000000,7.000000, 12.000000,17.000000, 15.000000,9.000000, 3.000000,8.000000, 15.000000,2.000000, 13.000000,13.000000, 12.000000,17.000000, - -16.000000,9.000000, 12.000000,17.000000, 9.000000,7.000000, 6.000000,14.000000, 10.000000,10.000000, 0.000000,18.000000, 19.000000,9.000000, 2.000000,11.000000, 16.000000,9.000000, - -2.000000,11.000000, 8.000000,4.000000, 5.000000,15.000000, 19.000000,7.000000, 1.000000,4.000000, 11.000000,15.000000, 6.000000,0.000000, 10.000000,13.000000, 15.000000,0.000000, 5.000000,7.000000, 2.000000,11.000000, - -14.000000,16.000000, 13.000000,3.000000, 13.000000,7.000000, 13.000000,4.000000, 4.000000,19.000000, 18.000000,3.000000, 3.000000,6.000000, 14.000000,16.000000 - -1.000000,10.000000, 16.000000,11.000000, 5.000000,12.000000, 14.000000,12.000000, 1.000000,10.000000, - -3.000000,14.000000, 18.000000,13.000000, 0.000000,13.000000, 17.000000,15.000000, 3.000000,14.000000 - -113.978891,188.283650, 114.049102,188.354061, 114.028390,188.311950, 140.621311,218.434785, 113.925508,188.451788, 114.028390,188.311950, 114.038094,188.325206, 107.079712,223.213808, 113.978891,188.283650 - -149.124266,243.836328, 149.130825,243.837775, 140.462458,289.372639, 149.124266,243.836328, 174.003258,285.357827, 149.081172,244.062877, 80.895955,240.414297, 149.081172,244.062877, 149.124266,243.836328, - -29.389873,51.154090, 34.288345,59.861919, 29.364091,51.189091, 29.379701,51.200590, 15.480095,51.026265, 27.327001,60.472279, 29.361537,51.172254, 29.379701,51.200590, 29.389873,51.154090, - -23.402194,41.096844, 23.406381,41.132628, 34.465476,40.926093, 32.678424,45.608817, 23.389763,41.132654, 23.414672,41.106110, 21.719863,48.560185, 23.402194,41.096844, - -30.951431,53.763363, 30.939362,53.811917, 41.512607,48.598876, 25.528987,61.504482, 30.925582,53.773491, 30.940776,53.812269, 28.790798,63.563660, 30.921651,53.782489, 30.951431,53.763363, - -40.932299,70.331769, 33.882179,80.568702, 40.952469,70.382541, 33.906555,80.507737, 38.158710,83.200483, 40.932299,70.331769 - -37.291393,64.307940, 47.917795,74.087993, 37.307928,64.317812, 51.927660,71.285431, 34.739208,76.059738, 37.291393,64.307940 - -97.604218,162.191009, 81.519079,186.128039, 97.652864,162.308413, 81.609840,186.099213, 67.592573,182.092187, 91.591892,192.217346, 97.604218,162.191009 - -135.877528,222.962402, 135.792476,222.983126, 195.753543,234.556614, 135.814790,223.162055, 135.936349,222.995801, 135.947907,223.011493, 127.815883,264.424834, 135.877528,222.962402, - -140.157057,229.713961, 140.069413,229.735364, 201.872134,241.630761, 140.092507,229.919758, 140.217696,229.748350, 140.229617,229.764516, 131.871019,272.449909, 140.157057,229.713961 - -193.086469,312.646765, 108.189184,287.648923, 193.023897,312.936441, 237.949462,362.828686, 192.949279,312.891753, 266.364944,345.116804, 192.999843,312.928266, 192.913653,312.765449, 193.086469,312.646765 - -247.422415,396.899455, 247.217314,397.163923, 247.574394,397.118778, 142.852727,414.776640, 288.712650,464.492402, 247.228121,397.184104, 135.733401,392.254819, 233.734466,471.311838, 247.203092,397.051434, 247.355072,397.270757, 247.422415,396.899455, - -330.399757,524.281800, 330.600976,524.476466, 323.970137,422.844875, 330.540537,524.358965, 406.928779,607.813936, 330.568526,524.395792, 359.346715,616.206998, 330.399757,524.281800, - -304.198844,484.203463, 173.561956,487.759775, 436.078782,489.984415, 374.610016,561.755629, 304.198844,484.203463, 354.969812,566.668108, 304.118093,484.657714, 304.198844,484.203463, - -216.327573,348.779345, 182.153126,401.142486, 216.158855,348.851925, 194.442338,411.748517, 216.134810,348.912273, 216.267739,349.105035, 216.327573,348.779345, - -40.510823,69.635522, 40.490212,69.696716, 38.684855,81.300842, 40.530783,69.685790, 47.264190,81.490170, 40.497275,69.699095, 37.801306,82.350057, 37.762746,82.375070, 40.472263,69.660535, 40.510823,69.635522 - -/ diff --git a/tests/auto/qtessellator/simple.h b/tests/auto/qtessellator/simple.h deleted file mode 100644 index c77c6c37483..00000000000 --- a/tests/auto/qtessellator/simple.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SIMPLEDATA_H -#define SIMPLEDATA_H - -#include "sample_data.h" - -FullData simpleData(); - -#endif diff --git a/tests/auto/qtessellator/testtessellator.cpp b/tests/auto/qtessellator/testtessellator.cpp deleted file mode 100644 index c2af1ae7805..00000000000 --- a/tests/auto/qtessellator/testtessellator.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "testtessellator.h" -#include <private/qtessellator_p.h> - -#include "math.h" -#include <QtCore/QDebug> - -class TestTessellator : public QTessellator -{ -public: - QVector<XTrapezoid> *traps; - void addTrap(const Trapezoid &trap); -}; - -void TestTessellator::addTrap(const Trapezoid &trap) -{ - XTrapezoid xtrap; - xtrap.top = Q27Dot5ToXFixed(trap.top); - xtrap.bottom = Q27Dot5ToXFixed(trap.bottom); - xtrap.left.p1.x = Q27Dot5ToXFixed(trap.topLeft->x); - xtrap.left.p1.y = Q27Dot5ToXFixed(trap.topLeft->y); - xtrap.left.p2.x = Q27Dot5ToXFixed(trap.bottomLeft->x); - xtrap.left.p2.y = Q27Dot5ToXFixed(trap.bottomLeft->y); - xtrap.right.p1.x = Q27Dot5ToXFixed(trap.topRight->x); - xtrap.right.p1.y = Q27Dot5ToXFixed(trap.topRight->y); - xtrap.right.p2.x = Q27Dot5ToXFixed(trap.bottomRight->x); - xtrap.right.p2.y = Q27Dot5ToXFixed(trap.bottomRight->y); - traps->append(xtrap); -} - - -void test_tesselate_polygon(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints, - bool winding) -{ - TestTessellator t; - t.traps = traps; - t.setWinding(winding); - t.tessellate(points, nPoints); -} - - -void test_tessellate_polygon_convex(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints, - bool winding) -{ - TestTessellator t; - t.traps = traps; - t.setWinding(winding); - t.tessellateConvex(points, nPoints); -} - - -void test_tessellate_polygon_rect(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints, - bool winding) -{ - // 5 points per rect - if (nPoints % 5 != 0) - qWarning() << Q_FUNC_INFO << "multiples of 5 points expected"; - - TestTessellator t; - t.traps = traps; - t.setWinding(winding); - for (int i = 0; i < nPoints / 5; ++i) { - QPointF rectA = points[5*i]; - QPointF rectB = points[5*i+1]; - QPointF rectC = points[5*i+2]; - QPointF rectD = points[5*i+3]; - - QPointF a = (rectA + rectD) * 0.5; - QPointF b = (rectB + rectC) * 0.5; - - QPointF delta = rectA - rectD; - - qreal width = sqrt(delta.x() * delta.x() + delta.y() * delta.y()); - - t.tessellateRect(a, b, width); - } -} diff --git a/tests/auto/qtessellator/testtessellator.h b/tests/auto/qtessellator/testtessellator.h deleted file mode 100644 index 09d098f6dc6..00000000000 --- a/tests/auto/qtessellator/testtessellator.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TESTTESSELLATOR_H -#define TESTTESSELLATOR_H - -#include <QVector> -#include <QPointF> -#include "XrenderFake.h" - -typedef void (*tessellate_function)(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints, - bool winding); - -void test_tesselate_polygon(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints, - bool winding); - -void test_tessellate_polygon_convex(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints, - bool winding); - -void test_tessellate_polygon_rect(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints, - bool winding); -#endif diff --git a/tests/auto/qtessellator/tst_tessellator.cpp b/tests/auto/qtessellator/tst_tessellator.cpp deleted file mode 100644 index e8d4e2d1c6d..00000000000 --- a/tests/auto/qtessellator/tst_tessellator.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <QtTest/QtTest> -#include <QCoreApplication> -#include <QVector> -#include <qdebug.h> -#include <qpolygon.h> -#include <qmatrix.h> - -#include "oldtessellator.h" -#include "testtessellator.h" -#include "utils.h" -#include "simple.h" -#include "arc.h" - -#include "math.h" - -//TESTED_CLASS= -//TESTED_FILES= - -class tst_QTessellator : public QObject -{ - Q_OBJECT - -public: - tst_QTessellator() { - } - -private slots: - void testStandardSet(); - void testRandom(); - void testArc(); - void testRects(); - void testConvexRects(); - void testConvex(); -}; - - -QPointF creatPoint() -{ - qreal x = int(20.0 * (rand() / (RAND_MAX + 1.0))); - qreal y = int(20.0 * (rand() / (RAND_MAX + 1.0))); - return QPointF(x, y); -} - -bool test(const QPointF *pg, int pgSize, bool winding, tessellate_function tessellate = test_tesselate_polygon, qreal maxDiff = 0.005) -{ - QVector<XTrapezoid> traps; - qreal area1 = 0; - qreal area2 = 0; - - old_tesselate_polygon(&traps, pg, pgSize, winding); - area1 = compute_area_for_x(traps); - - traps.clear(); - - tessellate(&traps, pg, pgSize, winding); - area2 = compute_area_for_x(traps); - - bool result = (qAbs(area2 - area1) < maxDiff); - if (!result && area1) - result = (qAbs(area1 - area2)/area1 < maxDiff); - - if (!result) - qDebug() << area1 << area2; - - return result; -} - - -void simplifyTestFailure(QVector<QPointF> failure, bool winding) -{ - int i = 1; - while (i < failure.size() - 1) { - QVector<QPointF> t = failure; - t.remove(i); - if (test(t.data(), t.size(), winding)) { - ++i; - continue; - } - failure = t; - i = 1; - } - - for (int x = 0; x < failure.size(); ++x) { - fprintf(stderr, "%lf,%lf, ", failure[x].x(), failure[x].y()); - } - fprintf(stderr, "\n\n"); -} - -void tst_QTessellator::testStandardSet() -{ - QVector<FullData> sampleSet; - sampleSet.append(simpleData()); - - foreach(FullData data, sampleSet) { - for (int i = 0; i < data.size(); ++i) { - if (!test(data[i].data(), data[i].size(), false)) { - simplifyTestFailure(data[i], false); - QCOMPARE(true, false); - } - if (!test(data[i].data(), data[i].size(), true)) { - simplifyTestFailure(data[i], true); - QCOMPARE(true, false); - } - } - } -} - - - -void fillRandomVec(QVector<QPointF> &vec) -{ - int size = vec.size(); --size; - for (int i = 0; i < size; ++i) { - vec[i] = creatPoint(); - } - vec[size] = vec[0]; -} - -void tst_QTessellator::testRandom() -{ - int failures = 0; - for (int i = 5; i < 12; ++i) { - QVector<QPointF> vec(i); -#ifdef QT_ARCH_ARM - int k = 200; -#else - int k = 5000; -#endif - while (--k) { - fillRandomVec(vec); - if (!test(vec.data(), vec.size(), false)) { - simplifyTestFailure(vec, false); - ++failures; - } - if (!test(vec.data(), vec.size(), true)) { - simplifyTestFailure(vec, true); - ++failures; - } - } - } - QVERIFY(failures == 0); -} - - -// we need a higher threshold for failure here than in the above tests, as this basically draws -// a very thin outline, where the discretization in the new tesselator shows -bool test_arc(const QPolygonF &poly, bool winding) -{ - QVector<XTrapezoid> traps; - qreal area1 = 0; - qreal area2 = 0; - - old_tesselate_polygon(&traps, poly.data(), poly.size(), winding); - area1 = compute_area_for_x(traps); - - traps.clear(); - - test_tesselate_polygon(&traps, poly.data(), poly.size(), winding); - area2 = compute_area_for_x(traps); - - bool result = (area2 - area1 < .02); - if (!result && area1) - result = (qAbs(area1 - area2)/area1 < .02); - - return result; -} - - - -void tst_QTessellator::testArc() -{ - FullData arc = arcData(); - - QMatrix mat; -#ifdef QT_ARCH_ARM - const int stop = 5; -#else - const int stop = 1000; -#endif - for (int i = 0; i < stop; ++i) { - mat.rotate(qreal(.01)); - mat.scale(qreal(.99), qreal(.99)); - QPolygonF poly = arc.at(0); - QPolygonF vec = poly * mat; - QVERIFY(test_arc(vec, true)); - QVERIFY(test_arc(vec, false)); - } -} - -static bool isConvex(const QVector<QPointF> &v) -{ - int nPoints = v.size() - 1; - - qreal lastCross = 0; - for (int i = 0; i < nPoints; ++i) { - QPointF a = v[i]; - QPointF b = v[(i + 1) % nPoints]; - - QPointF d1 = b - a; - - for (int j = 0; j < nPoints; ++j) { - if (j == i || j == i + 1) - continue; - - QPointF p = v[j]; - QPointF d2 = p - a; - - qreal cross = d1.x() * d2.y() - d1.y() * d2.x(); - - if (!qFuzzyCompare(cross + 1, 1) - && !qFuzzyCompare(cross + 1, 1) - && (lastCross > 0) != (cross > 0)) - return false; - - lastCross = cross; - } - } - - return true; -} - -static void fillRectVec(QVector<QPointF> &v) -{ - int numRects = v.size() / 5; - - int first = 0; - v[first++] = QPointF(0, 0); - v[first++] = QPointF(10, 0); - v[first++] = QPointF(10, 10); - v[first++] = QPointF(0, 10); - v[first++] = QPointF(0, 0); - - v[first++] = QPointF(0, 0); - v[first++] = QPointF(2, 2); - v[first++] = QPointF(4, 0); - v[first++] = QPointF(2, -2); - v[first++] = QPointF(0, 0); - - v[first++] = QPointF(0, 0); - v[first++] = QPointF(4, 4); - v[first++] = QPointF(6, 2); - v[first++] = QPointF(2, -2); - v[first++] = QPointF(0, 0); - - for (int i = first / 5; i < numRects; ++i) { - QPointF a = creatPoint(); - QPointF b = creatPoint(); - - QPointF delta = a - b; - QPointF perp(delta.y(), -delta.x()); - - perp *= ((int)(20.0 * rand() / (RAND_MAX + 1.0))) / 20.0; - - int j = 5 * i; - v[j++] = a + perp; - v[j++] = a - perp; - v[j++] = b - perp; - v[j++] = b + perp; - v[j++] = a + perp; - } -} - -#ifdef QT_ARCH_ARM -const int numRects = 500; -#else -const int numRects = 5000; -#endif - -void tst_QTessellator::testConvexRects() -{ - return; - int failures = 0; - QVector<QPointF> vec(numRects * 5); - fillRectVec(vec); - for (int rect = 0; rect < numRects; ++rect) { - QVector<QPointF> v(5); - for (int i = 0; i < 5; ++i) - v[i] = vec[5 * rect + i]; - if (!test(v.data(), v.size(), false, test_tessellate_polygon_convex)) { - simplifyTestFailure(v, false); - ++failures; - } - if (!test(v.data(), v.size(), true, test_tessellate_polygon_convex)) { - simplifyTestFailure(v, true); - ++failures; - } - } - QVERIFY(failures == 0); -} - -void tst_QTessellator::testConvex() -{ - int failures = 0; - for (int i = 4; i < 10; ++i) { - QVector<QPointF> vec(i); - int k = 5000; - while (k--) { - fillRandomVec(vec); - if (!isConvex(vec)) - continue; - if (!test(vec.data(), vec.size(), false, test_tessellate_polygon_convex)) { - simplifyTestFailure(vec, false); - ++failures; - } - if (!test(vec.data(), vec.size(), true, test_tessellate_polygon_convex)) { - simplifyTestFailure(vec, true); - ++failures; - } - } - } - QVERIFY(failures == 0); -} - - -void tst_QTessellator::testRects() -{ - int failures = 0; - QVector<QPointF> vec(numRects * 5); - fillRectVec(vec); - for (int rect = 0; rect < numRects; ++rect) { - QVector<QPointF> v(5); - for (int i = 0; i < 5; ++i) - v[i] = vec[5 * rect + i]; - if (!test(v.data(), v.size(), false, test_tessellate_polygon_rect, qreal(0.05))) { - simplifyTestFailure(v, false); - ++failures; - } - if (!test(v.data(), v.size(), true, test_tessellate_polygon_rect, qreal(0.05))) { - simplifyTestFailure(v, true); - ++failures; - } - } - QVERIFY(failures == 0); -} - - -QTEST_MAIN(tst_QTessellator) -#include "tst_tessellator.moc" diff --git a/tests/auto/qtessellator/utils.cpp b/tests/auto/qtessellator/utils.cpp deleted file mode 100644 index 5790983445e..00000000000 --- a/tests/auto/qtessellator/utils.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "utils.h" - -#include <assert.h> -#include <qglobal.h> - -#include "qnum.h" - -#define FloatToXFixed(i) (int)((i) * 65536) -#define IntToXFixed(i) ((i) << 16) - -static double compute_x_at(XFixed y, XPointFixed p1, XPointFixed p2) -{ - double d = XFixedToDouble(p2.x - p1.x); - return - XFixedToDouble(p1.x) + d*XFixedToDouble(y - p1.y)/XFixedToDouble(p2.y - p1.y); -} - -double compute_area(XTrapezoid *trap) -{ - double x1 = compute_x_at(trap->top, trap->left.p1, trap->left.p2); - double x2 = compute_x_at(trap->top, trap->right.p1, trap->right.p2); - double x3 = compute_x_at(trap->bottom, trap->left.p1, trap->left.p2); - double x4 = compute_x_at(trap->bottom, trap->right.p1, trap->right.p2); - - double top = XFixedToDouble(trap->top); - double bottom = XFixedToDouble(trap->bottom); - double h = bottom - top; - - double top_base = x2 - x1; - double bottom_base = x4 - x3; - - if ((top_base < 0 && bottom_base > 0) - || (top_base > 0 && bottom_base < 0)) { - double y0 = top_base*h/(top_base - bottom_base) + top; - double area = qAbs(top_base * (y0 - top) / 2.); - area += qAbs(bottom_base * (bottom - y0) /2.); - return area; - } - - - return 0.5 * h * qAbs(top_base + bottom_base); -} - -double compute_area_for_x(const QVector<XTrapezoid> &traps) -{ - double area = 0; - - for (int i = 0; i < traps.size(); ++i) { - XTrapezoid trap = traps[i]; - area += compute_area(&trap); - } - return area; -} diff --git a/tests/auto/qtessellator/utils.h b/tests/auto/qtessellator/utils.h deleted file mode 100644 index 6a4ef150b7b..00000000000 --- a/tests/auto/qtessellator/utils.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef UTILS_H -#define UTILS_H - -#include <QVector> -#include <QPointF> -#include <QDebug> -#include "XrenderFake.h" - -double compute_area(XTrapezoid *trap); -double compute_area_for_x(const QVector<XTrapezoid> &traps); - -QT_BEGIN_NAMESPACE -Q_DECLARE_TYPEINFO(XTrapezoid, Q_PRIMITIVE_TYPE); -QT_END_NAMESPACE - -#endif diff --git a/tests/auto/qtextbrowser/qtextbrowser.pro b/tests/auto/qtextbrowser/qtextbrowser.pro index 937a13e16de..f4ae8b7b67c 100644 --- a/tests/auto/qtextbrowser/qtextbrowser.pro +++ b/tests/auto/qtextbrowser/qtextbrowser.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += tst_qtextbrowser.cpp !symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" +QT += widgets wince*|symbian: { addFiles.files = *.html diff --git a/tests/auto/qtextedit/qtextedit.pro b/tests/auto/qtextedit/qtextedit.pro index 594e53fda4e..fa10ab72a3f 100644 --- a/tests/auto/qtextedit/qtextedit.pro +++ b/tests/auto/qtextedit/qtextedit.pro @@ -1,6 +1,6 @@ load(qttest_p4) -QT += gui-private +QT += widgets widgets-private gui-private INCLUDEPATH += ../ HEADERS += diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp index 72088613946..f10879d2842 100644 --- a/tests/auto/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/qtextedit/tst_qtextedit.cpp @@ -49,7 +49,7 @@ #include <qapplication.h> #include <qclipboard.h> #include <qtextbrowser.h> -#include <private/qtextcontrol_p.h> +#include <private/qwidgettextcontrol_p.h> #include <qscrollbar.h> #include <qtextobject.h> #include <qtexttable.h> @@ -1484,7 +1484,7 @@ void tst_QTextEdit::mimeDataReimplementations() QCOMPARE(ed.insertCallCount, 0); #ifdef QT_BUILD_INTERNAL - QTextControl *control = qFindChild<QTextControl *>(&ed); + QWidgetTextControl *control = qFindChild<QWidgetTextControl *>(&ed); QVERIFY(control); control->canInsertFromMimeData(QApplication::clipboard()->mimeData()); @@ -2095,7 +2095,7 @@ void tst_QTextEdit::cursorRect() void tst_QTextEdit::setDocumentPreservesPalette() { #ifdef QT_BUILD_INTERNAL - QTextControl *control = qFindChild<QTextControl *>(ed); + QWidgetTextControl *control = qFindChild<QWidgetTextControl *>(ed); QVERIFY(control); QPalette defaultPal = ed->palette(); diff --git a/tests/auto/qtoolbar/qtoolbar.pro b/tests/auto/qtoolbar/qtoolbar.pro index 2c1176fe004..b340097d814 100644 --- a/tests/auto/qtoolbar/qtoolbar.pro +++ b/tests/auto/qtoolbar/qtoolbar.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets widgets-private QT += gui-private SOURCES += tst_qtoolbar.cpp diff --git a/tests/auto/qtoolbox/qtoolbox.pro b/tests/auto/qtoolbox/qtoolbox.pro index 00c4549ee29..24f3ea6cb98 100644 --- a/tests/auto/qtoolbox/qtoolbox.pro +++ b/tests/auto/qtoolbox/qtoolbox.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtoolbox.cpp diff --git a/tests/auto/qtoolbutton/qtoolbutton.pro b/tests/auto/qtoolbutton/qtoolbutton.pro index a40f31e6b46..a14f2e47139 100644 --- a/tests/auto/qtoolbutton/qtoolbutton.pro +++ b/tests/auto/qtoolbutton/qtoolbutton.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtoolbutton.cpp CONFIG+=insignificant_test diff --git a/tests/auto/qtooltip/qtooltip.pro b/tests/auto/qtooltip/qtooltip.pro index 0bd0e42c489..4da89179215 100644 --- a/tests/auto/qtooltip/qtooltip.pro +++ b/tests/auto/qtooltip/qtooltip.pro @@ -1,2 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtooltip.cpp + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qtreeview/qtreeview.pro b/tests/auto/qtreeview/qtreeview.pro index 75c89094d62..1c310bda761 100644 --- a/tests/auto/qtreeview/qtreeview.pro +++ b/tests/auto/qtreeview/qtreeview.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtreeview.cpp contains(QT_CONFIG,xcb):qpa:CONFIG+=insignificant_test # QTBUG-20756 crashes on qpa, xcb diff --git a/tests/auto/qtreewidget/qtreewidget.pro b/tests/auto/qtreewidget/qtreewidget.pro index bc38239c6fe..a9c7ce6b5a5 100644 --- a/tests/auto/qtreewidget/qtreewidget.pro +++ b/tests/auto/qtreewidget/qtreewidget.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtreewidget.cpp - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qtreewidgetitemiterator/qtreewidgetitemiterator.pro b/tests/auto/qtreewidgetitemiterator/qtreewidgetitemiterator.pro index 0af47a3bcc2..de7762e7731 100644 --- a/tests/auto/qtreewidgetitemiterator/qtreewidgetitemiterator.pro +++ b/tests/auto/qtreewidgetitemiterator/qtreewidgetitemiterator.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qtreewidgetitemiterator.cpp diff --git a/tests/auto/qundogroup/qundogroup.pro b/tests/auto/qundogroup/qundogroup.pro index 587143d0454..c2b6ceb038b 100644 --- a/tests/auto/qundogroup/qundogroup.pro +++ b/tests/auto/qundogroup/qundogroup.pro @@ -1,3 +1,4 @@ CONFIG += qttest_p4 +QT += widgets SOURCES += tst_qundogroup.cpp TARGET = tst_qundogroup diff --git a/tests/auto/qundostack/qundostack.pro b/tests/auto/qundostack/qundostack.pro index beb0b103b26..c8cfb700592 100644 --- a/tests/auto/qundostack/qundostack.pro +++ b/tests/auto/qundostack/qundostack.pro @@ -1,3 +1,4 @@ CONFIG += qttest_p4 +QT += widgets SOURCES += tst_qundostack.cpp TARGET = tst_qundostack diff --git a/tests/auto/qwidget/qwidget.pro b/tests/auto/qwidget/qwidget.pro index 0cd4a70e99a..df0fdec006d 100644 --- a/tests/auto/qwidget/qwidget.pro +++ b/tests/auto/qwidget/qwidget.pro @@ -1,6 +1,6 @@ load(qttest_p4) -QT += core-private gui-private +QT += widgets core-private gui-private widgets-private SOURCES += tst_qwidget.cpp RESOURCES = qwidget.qrc diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index eb110a246e2..99b069487f7 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -65,12 +65,13 @@ #include <qdockwidget.h> #include <qtoolbar.h> #include <QtGui/qpaintengine.h> -#include <private/qbackingstore_p.h> +#include <QtGui/qbackingstore.h> +#include <QtGui/qguiapplication.h> #include <qmenubar.h> #include <qtableview.h> -#include <QtGui/QGraphicsView> -#include <QtGui/QGraphicsProxyWidget> +#include <QtWidgets/QGraphicsView> +#include <QtWidgets/QGraphicsProxyWidget> #include "../../shared/util.h" @@ -102,6 +103,23 @@ #include <QtTest/QtTest> +#if defined(Q_OS_WIN) +# include <QtCore/qt_windows.h> +# include <QtGui/private/qguiapplication_p.h> +# include <QtGui/QPlatformNativeInterface> +# include <QtGui/QPlatformIntegration> + +static HWND winHandleOf(const QWidget *w) +{ + static QPlatformNativeInterface *nativeInterface + = QGuiApplicationPrivate::instance()->platformIntegration()->nativeInterface(); + if (void *handle = nativeInterface->nativeResourceForWindow("handle", w->window()->windowHandle())) + return reinterpret_cast<HWND>(handle); + qWarning() << "Cannot obtain native handle for " << w; + return 0; +} +#endif + #if defined(Q_WS_WIN) # include <qt_windows.h> # if !defined(Q_OS_WINCE) @@ -211,10 +229,6 @@ private slots: void restoreVersion1Geometry_data(); void restoreVersion1Geometry(); - void windowTitle(); - void windowModified(); - void windowIconText(); - void widgetAt(); #ifdef Q_WS_MAC void retainHIView(); @@ -322,7 +336,6 @@ private slots: void updateGeometry(); void updateGeometry_data(); void sendUpdateRequestImmediately(); - void painterRedirection(); void doubleRepaint(); #ifndef Q_WS_MAC void resizeInPaintEvent(); @@ -1245,7 +1258,7 @@ void tst_QWidget::visible_setWindowOpacity() QVERIFY( !testWidget->isVisible() ); testWidget->setWindowOpacity(0.5); #ifdef Q_OS_WIN - QVERIFY(::IsWindowVisible(testWidget->winId()) == FALSE); + QVERIFY(::IsWindowVisible(winHandleOf(testWidget)) == FALSE); #endif testWidget->setWindowOpacity(1.0); } @@ -3234,28 +3247,22 @@ void tst_QWidget::widgetAt() w2->lower(); qApp->processEvents(); - QTRY_VERIFY((wr = QApplication::widgetAt(100, 100))); - const bool match = (wr->objectName() == QString("w1")); + QTRY_VERIFY((wr = QApplication::widgetAt(100, 100)) && wr->objectName() == QString("w1")); w2->raise(); - QVERIFY(match); qApp->processEvents(); - QTRY_VERIFY((wr = QApplication::widgetAt(100, 100))); - QCOMPARE(wr->objectName(), QString("w2")); - + QTRY_VERIFY((wr = QApplication::widgetAt(100, 100)) && wr->objectName() == QString("w2")); QWidget *w3 = new QWidget(w2); w3->setGeometry(10,10,50,50); w3->setObjectName("w3"); w3->show(); qApp->processEvents(); - QTRY_VERIFY((wr = QApplication::widgetAt(100,100))); - QCOMPARE(wr->objectName(), QString("w3")); + QTRY_VERIFY((wr = QApplication::widgetAt(100,100)) && wr->objectName() == QString("w3")); w3->setAttribute(Qt::WA_TransparentForMouseEvents); qApp->processEvents(); - QTRY_VERIFY((wr = QApplication::widgetAt(100, 100))); - QCOMPARE(wr->objectName(), QString("w2")); + QTRY_VERIFY((wr = QApplication::widgetAt(100, 100)) && wr->objectName() == QString("w2")); QRegion rgn = QRect(QPoint(0,0), w2->size()); QPoint point = w2->mapFromGlobal(QPoint(100,100)); @@ -3381,249 +3388,6 @@ static CAknContextPane* ContextPane() } #endif -static QString visibleWindowTitle(QWidget *window, Qt::WindowState state = Qt::WindowNoState) -{ - QString vTitle; - -#ifdef Q_WS_WIN - Q_UNUSED(state); - const size_t maxTitleLength = 256; - wchar_t title[maxTitleLength]; - GetWindowText(window->winId(), title, maxTitleLength); - vTitle = QString::fromWCharArray(title); -#elif defined(Q_WS_X11) - /* - We can't check what the window manager displays, but we can - check what we tell the window manager to display. This will - have to do. - */ - Atom UTF8_STRING = XInternAtom(window->x11Info().display(), "UTF8_STRING", false); - Atom _NET_WM_NAME = XInternAtom(window->x11Info().display(), "_NET_WM_NAME", false); - Atom _NET_WM_ICON_NAME = XInternAtom(window->x11Info().display(), "_NET_WM_ICON_NAME", false); - uchar *data = 0; - ulong length = 0; - if (state == Qt::WindowMinimized) { - if (getProperty(window->x11Info().display(), window->winId(), - UTF8_STRING, _NET_WM_ICON_NAME, &data, &length)) { - vTitle = QString::fromUtf8((char *) data, length); - XFree(data); - } else { - XTextProperty text_prop; - if (XGetWMIconName(window->x11Info().display(), window->winId(), &text_prop)) { - vTitle = textPropertyToString(window->x11Info().display(), text_prop); - XFree((char *) text_prop.value); - } - } - } else { - if (getProperty(window->x11Info().display(), window->winId(), - UTF8_STRING, _NET_WM_NAME, &data, &length)) { - vTitle = QString::fromUtf8((char *) data, length); - XFree(data); - } else { - XTextProperty text_prop; - if (XGetWMName(window->x11Info().display(), window->winId(), &text_prop)) { - vTitle = textPropertyToString(window->x11Info().display(), text_prop); - XFree((char *) text_prop.value); - } - } - } -#elif defined(Q_WS_MAC) - vTitle = nativeWindowTitle(window, state); -#elif defined(Q_WS_QWS) - if (qwsServer) { - const QWSWindow *win = 0; - const QList<QWSWindow*> windows = qwsServer->clientWindows(); - for (int i = 0; i < windows.count(); ++i) { - const QWSWindow* w = windows.at(i); - if (w->winId() == window->winId()) { - win = w; - break; - } - } - if (win) - vTitle = win->caption(); - } -#elif defined (Q_WS_S60) - CAknTitlePane* titlePane = TitlePane(); - if(titlePane) - { - const TDesC* nTitle = titlePane->Text(); - vTitle = QString::fromUtf16(nTitle->Ptr(), nTitle->Length()); - } -#endif - - return vTitle; -} - -void tst_QWidget::windowTitle() -{ - QWidget widget(0); - widget.setWindowTitle("Application Name"); - widget.winId(); // Make sure the window is created... - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name")); - - widget.setWindowTitle("Application Name *"); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name *")); - - widget.setWindowTitle("Application Name[*]"); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name")); - - widget.setWindowTitle("Application Name[*][*]"); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*]")); - - widget.setWindowTitle("Application Name[*][*][*]"); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*]")); - - widget.setWindowTitle("Application Name[*][*][*][*]"); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*][*]")); -} - -void tst_QWidget::windowIconText() -{ -#ifdef Q_OS_SYMBIAN - QSKIP("Symbian/S60 windows don't have window icon text", SkipAll); -#endif - QWidget widget(0); - - widget.setWindowTitle("Application Name"); - widget.setWindowIconText("Application Minimized"); - widget.showNormal(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name")); - widget.showMinimized(); -#if defined(Q_WS_QWS) || defined(Q_OS_WINCE) - QEXPECT_FAIL(0, "Qt/Embedded/WinCE does not implement showMinimized()", Continue); - //See task 147193 for WinCE -#endif - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget, Qt::WindowMinimized), - QString("Application Minimized")); - - widget.setWindowTitle("Application Name[*]"); - widget.setWindowIconText("Application Minimized[*]"); - widget.showNormal(); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name")); - widget.showMinimized(); -#if defined (Q_WS_QWS) || defined(Q_OS_WINCE) - QEXPECT_FAIL(0, "Qt/Embedded/WinCE does not implement showMinimized()", Continue); - //See task 147193 for WinCE -#endif - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget, Qt::WindowMinimized), - QString("Application Minimized")); - - widget.setWindowModified(true); - widget.showNormal(); - QApplication::instance()->processEvents(); - if (widget.style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, &widget)) - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name*")); - else - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name")); - widget.showMinimized(); -#if defined (Q_WS_QWS) || defined(Q_OS_WINCE) - QEXPECT_FAIL(0, "Qt/Embedded/WinCE does not implement showMinimized()", Continue); - //See task 147193 for WinCE -#endif - QApplication::instance()->processEvents(); -#ifdef Q_WS_MAC - QCOMPARE(visibleWindowTitle(&widget, Qt::WindowMinimized), - QString("Application Minimized")); - QVERIFY(nativeWindowModified(&widget)); -#else - QCOMPARE(visibleWindowTitle(&widget, Qt::WindowMinimized), - QString("Application Minimized*")); -#endif -} - -void tst_QWidget::windowModified() -{ - QWidget widget(0); - widget.show(); - QTest::qWaitForWindowShown(&widget); -#ifndef Q_WS_MAC - QTest::ignoreMessage(QtWarningMsg, "QWidget::setWindowModified: The window title does not contain a '[*]' placeholder"); -#endif - widget.setWindowTitle("Application Name"); - QTest::qWait(10); - QTRY_COMPARE(visibleWindowTitle(&widget), QString("Application Name")); - -#ifdef Q_WS_MAC - widget.setWindowModified(true); - QVERIFY(nativeWindowModified(&widget)); -#else - widget.setWindowModified(true); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name")); - - widget.setWindowModified(false); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name")); - - widget.setWindowTitle("Application Name[*]"); - - widget.setWindowModified(true); - QApplication::instance()->processEvents(); - if (widget.style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, &widget)) - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name*")); - else - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name")); - - widget.setWindowModified(false); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name")); - - widget.setWindowTitle("Application[*] Name[*]"); - - widget.setWindowModified(true); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application* Name*")); - - widget.setWindowModified(false); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name")); - - widget.setWindowTitle("Application Name[*][*]"); - - widget.setWindowModified(true); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*]")); - - widget.setWindowModified(false); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*]")); - - widget.setWindowTitle("Application[*][*] Name[*][*]"); - - widget.setWindowModified(true); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application[*] Name[*]")); - - widget.setWindowModified(false); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application[*] Name[*]")); - - widget.setWindowTitle("Application[*] Name[*][*][*]"); - - widget.setWindowModified(true); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application* Name[*]*")); - - widget.setWindowModified(false); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*]")); - - widget.setWindowTitle("Application[*][*][*] Name[*][*][*]"); - - widget.setWindowModified(true); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application[*]* Name[*]*")); - - widget.setWindowModified(false); - QApplication::instance()->processEvents(); - QCOMPARE(visibleWindowTitle(&widget), QString("Application[*] Name[*]")); -#endif -} - void tst_QWidget::task110173() { QWidget w; @@ -5424,6 +5188,7 @@ void tst_QWidget::showAndMoveChild() QDesktopWidget desktop; QRect desktopDimensions = desktop.availableGeometry(&parent); + desktopDimensions = desktopDimensions.adjusted(64, 64, -64, -64); parent.setGeometry(desktopDimensions); parent.setPalette(Qt::red); @@ -8046,64 +7811,6 @@ void tst_QWidget::sendUpdateRequestImmediately() QCOMPARE(updateWidget.numUpdateRequestEvents, 1); } -class RedirectedWidget : public QWidget -{ -protected: - void paintEvent(QPaintEvent *) - { - // Verify that the widget has a redirection set. The widget is redirected to - // the backing store on all platforms using it; otherwise to itself if the wrect - // does not start in (0, 0) or it has a mask set. - QPaintDevice *oldRedirection = QPainter::redirected(this); -#ifndef Q_WS_MAC - QVERIFY(oldRedirection); -#endif - - QImage image(size(), QImage::Format_RGB32); - image.fill(Qt::blue); - - { - QPainter painter(this); - QCOMPARE(painter.device(), static_cast<QPaintDevice *>(this)); - } - - QPainter::setRedirected(this, &image); - QCOMPARE(QPainter::redirected(this), static_cast<QPaintDevice *>(&image)); - - QPainter painter(this); - painter.fillRect(rect(), Qt::red); - - QPainter::restoreRedirected(this); - QCOMPARE(QPainter::redirected(this), oldRedirection); - - for (int i = 0; i < image.height(); ++i) - for (int j = 0; j < image.width(); ++j) - QCOMPARE(image.pixel(j, i), QColor(Qt::red).rgb()); - } - -}; - -// Test to make sure we're compatible in the particular case where QPainter::setRedirected -// actually works. It has been broken for all other cases since Qt 4.1.4 (backing store). -// QWidget::render is the modern and more powerful way of doing the same. -void tst_QWidget::painterRedirection() -{ - RedirectedWidget widget; - // Set FramelessWindowHint and mask to trigger internal painter redirection on the Mac. - widget.setWindowFlags(widget.windowFlags() | Qt::FramelessWindowHint); - widget.setMask(QRect(10, 10, 50, 50)); - widget.setFixedSize(100, 200); - widget.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&widget); -#endif - QPixmap pixmap(widget.size()); - QPainter::setRedirected(&widget, &pixmap, QPoint()); - widget.repaint(); - QCOMPARE(QPainter::redirected(&widget), static_cast<QPaintDevice *>(&pixmap)); -} - - void tst_QWidget::doubleRepaint() { #ifdef Q_OS_IRIX @@ -9392,7 +9099,7 @@ void tst_QWidget::destroyBackingStore() QTRY_VERIFY(w.numPaintEvents > 0); w.reset(); w.update(); - qt_widget_private(&w)->topData()->backingStore.create(&w); + qt_widget_private(&w)->topData()->backingStoreTracker.create(&w); w.update(); QApplication::processEvents(); @@ -9416,7 +9123,7 @@ QWidgetBackingStore* backingStore(QWidget &widget) QWidgetBackingStore *backingStore = 0; #ifdef QT_BUILD_INTERNAL if (QTLWExtra *topExtra = qt_widget_private(&widget)->maybeTopData()) - backingStore = topExtra->backingStore.data(); + backingStore = topExtra->backingStoreTracker.data(); #endif return backingStore; } @@ -10251,12 +9958,12 @@ class scrollWidgetWBS : public QWidget public: void deleteBackingStore() { - static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore.destroy(); + static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStoreTracker.destroy(); } void enableBackingStore() { if (!static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) { - static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore.create(this); + static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStoreTracker.create(this); static_cast<QWidgetPrivate*>(d_ptr.data())->invalidateBuffer(this->rect()); repaint(); } @@ -10487,18 +10194,26 @@ void tst_QWidget::nativeChildFocus() QLineEdit *p2 = new QLineEdit; layout->addWidget(p1); layout->addWidget(p2); +#if 1 p1->setObjectName("p1"); p2->setObjectName("p2"); +#endif w.show(); +#if 1 w.activateWindow(); p1->setFocus(); p1->setAttribute(Qt::WA_NativeWindow); p2->setAttribute(Qt::WA_NativeWindow); QApplication::processEvents(); QTest::qWaitForWindowShown(&w); + QTest::qWait(10); + qDebug() << "checking active window:" << QApplication::activeWindow(); QCOMPARE(QApplication::activeWindow(), &w); QCOMPARE(QApplication::focusWidget(), static_cast<QWidget*>(p1)); +#endif + + QTest::qWait(1000); } QTEST_MAIN(tst_QWidget) diff --git a/tests/auto/qwidget_window/qwidget_window.pro b/tests/auto/qwidget_window/qwidget_window.pro index df7d68739b2..dd5837012c0 100644 --- a/tests/auto/qwidget_window/qwidget_window.pro +++ b/tests/auto/qwidget_window/qwidget_window.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qwidget_window.cpp x11 { diff --git a/tests/auto/qwidgetaction/qwidgetaction.pro b/tests/auto/qwidgetaction/qwidgetaction.pro index cc80e58fe32..3e037c2efb6 100644 --- a/tests/auto/qwidgetaction/qwidgetaction.pro +++ b/tests/auto/qwidgetaction/qwidgetaction.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qwidgetaction.cpp diff --git a/tests/auto/qwindow/qwindow.pro b/tests/auto/qwindow/qwindow.pro new file mode 100644 index 00000000000..560945322cf --- /dev/null +++ b/tests/auto/qwindow/qwindow.pro @@ -0,0 +1,6 @@ +load(qttest_p4) + +QT += core-private gui-private + +SOURCES += tst_qwindow.cpp + diff --git a/tests/auto/qtessellator/arc.cpp b/tests/auto/qwindow/tst_qwindow.cpp similarity index 69% rename from tests/auto/qtessellator/arc.cpp rename to tests/auto/qwindow/tst_qwindow.cpp index 64fe0e5199b..77e3d5f88ce 100644 --- a/tests/auto/qtessellator/arc.cpp +++ b/tests/auto/qwindow/tst_qwindow.cpp @@ -38,12 +38,37 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "arc.h" -#include "dataparser.h" -#include <QString> +#include <qwindow.h> +#include <qtest.h> -FullData arcData() +class tst_QWindow: public QObject { - return parseFile(":/arc.data"); + Q_OBJECT + +private slots: + void mapGlobal(); +}; + + +void tst_QWindow::mapGlobal() +{ + QWindow a; + QWindow b(&a); + QWindow c(&b); + + a.setGeometry(10, 10, 300, 300); + b.setGeometry(20, 20, 200, 200); + c.setGeometry(40, 40, 100, 100); + + QCOMPARE(a.mapToGlobal(QPoint(100, 100)), QPoint(110, 110)); + QCOMPARE(b.mapToGlobal(QPoint(100, 100)), QPoint(130, 130)); + QCOMPARE(c.mapToGlobal(QPoint(100, 100)), QPoint(170, 170)); + + QCOMPARE(a.mapFromGlobal(QPoint(100, 100)), QPoint(90, 90)); + QCOMPARE(b.mapFromGlobal(QPoint(100, 100)), QPoint(70, 70)); + QCOMPARE(c.mapFromGlobal(QPoint(100, 100)), QPoint(30, 30)); } + +#include <tst_qwindow.moc> +QTEST_MAIN(tst_QWindow); diff --git a/tests/auto/qwindowsurface/qwindowsurface.pro b/tests/auto/qwindowsurface/qwindowsurface.pro index f236793b910..f1e8bf6070d 100644 --- a/tests/auto/qwindowsurface/qwindowsurface.pro +++ b/tests/auto/qwindowsurface/qwindowsurface.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets widgets-private QT += gui-private SOURCES += tst_qwindowsurface.cpp diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index 5810ec3580d..11348e9162d 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -45,7 +45,7 @@ #include <QPalette> #include <QWindowsStyle> -#ifndef Q_WS_MAC +#if !defined(Q_WS_MAC) && QT_VERSION < 0x050000 // Fixme Qt 5 #include <private/qwindowsurface_p.h> #include <QDesktopWidget> diff --git a/tests/auto/qwizard/qwizard.pro b/tests/auto/qwizard/qwizard.pro index a22e45cf19d..6d508470c7f 100644 --- a/tests/auto/qwizard/qwizard.pro +++ b/tests/auto/qwizard/qwizard.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qwizard.cpp #SOURCES += /home/jasmin/dev/solutions/widgets/qtwizard/src/qtwizard.cpp #HEADERS += /home/jasmin/dev/solutions/widgets/qtwizard/src/qtwizard.h diff --git a/tests/auto/qworkspace/qworkspace.pro b/tests/auto/qworkspace/qworkspace.pro index de4d29a2290..0b8a604fe8b 100644 --- a/tests/auto/qworkspace/qworkspace.pro +++ b/tests/auto/qworkspace/qworkspace.pro @@ -1,2 +1,3 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qworkspace.cpp diff --git a/tests/auto/qwsembedwidget/qwsembedwidget.pro b/tests/auto/qwsembedwidget/qwsembedwidget.pro index c34212b06a1..640b52d384d 100644 --- a/tests/auto/qwsembedwidget/qwsembedwidget.pro +++ b/tests/auto/qwsembedwidget/qwsembedwidget.pro @@ -1,2 +1,3 @@ load(qttest_p4) +QT += widgets SOURCES += tst_qwsembedwidget.cpp diff --git a/tests/auto/sql.pro b/tests/auto/sql.pro deleted file mode 100644 index 7cfd137ae7e..00000000000 --- a/tests/auto/sql.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE=subdirs -SUBDIRS=\ - qsql \ - qsqldatabase \ - qsqldriver \ - qsqlerror \ - qsqlfield \ - qsqlquery \ - qsqlquerymodel \ - qsqlrecord \ - qsqlrelationaltablemodel \ - qsqltablemodel \ - qsqlthread \ - diff --git a/tests/auto/sql/kernel/kernel.pro b/tests/auto/sql/kernel/kernel.pro new file mode 100644 index 00000000000..579c31a01fe --- /dev/null +++ b/tests/auto/sql/kernel/kernel.pro @@ -0,0 +1,11 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qsqlfield \ + qsqldatabase \ + qsqlerror \ + qsqldriver \ + qsqlquery \ + qsqlrecord \ + qsqlthread \ + qsql \ + diff --git a/tests/auto/qsql/.gitignore b/tests/auto/sql/kernel/qsql/.gitignore similarity index 100% rename from tests/auto/qsql/.gitignore rename to tests/auto/sql/kernel/qsql/.gitignore diff --git a/tests/auto/qsql/qsql.pro b/tests/auto/sql/kernel/qsql/qsql.pro similarity index 90% rename from tests/auto/qsql/qsql.pro rename to tests/auto/sql/kernel/qsql/qsql.pro index e367a8e1c14..3357e762dcd 100644 --- a/tests/auto/qsql/qsql.pro +++ b/tests/auto/sql/kernel/qsql/qsql.pro @@ -1,7 +1,7 @@ load(qttest_p4) SOURCES += tst_qsql.cpp -QT += sql sql-private +QT += sql sql-private gui widgets wince*: { DEPLOYMENT_PLUGIN += qsqlite diff --git a/tests/auto/qsql/tst_qsql.cpp b/tests/auto/sql/kernel/qsql/tst_qsql.cpp similarity index 97% rename from tests/auto/qsql/tst_qsql.cpp rename to tests/auto/sql/kernel/qsql/tst_qsql.cpp index e8c6d14f5b3..453eb44daae 100644 --- a/tests/auto/qsql/tst_qsql.cpp +++ b/tests/auto/sql/kernel/qsql/tst_qsql.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> -#include <qapplication.h> +#include <qguiapplication.h> #include <qsqldatabase.h> #include <qsqlerror.h> #include <qsqlquery.h> @@ -117,7 +117,7 @@ void tst_QSql::cleanup() void tst_QSql::basicDriverTest() { int argc = 0; - QApplication app( argc, 0, false ); + QGuiApplication app( argc, 0, false ); tst_Databases dbs; dbs.open(); @@ -187,7 +187,7 @@ void tst_QSql::openInvalid() void tst_QSql::concurrentAccess() { int argc = 0; - QApplication app( argc, 0, false ); + QGuiApplication app( argc, 0, false ); tst_Databases dbs; dbs.open(); @@ -215,7 +215,7 @@ void tst_QSql::concurrentAccess() void tst_QSql::openErrorRecovery() { int argc = 0; - QApplication app( argc, 0, false ); + QGuiApplication app( argc, 0, false ); tst_Databases dbs; dbs.addDbs(); @@ -262,7 +262,7 @@ void tst_QSql::openErrorRecovery() void tst_QSql::registerSqlDriver() { int argc = 0; - QApplication app( argc, 0, false ); + QGuiApplication app( argc, 0, false ); QSqlDatabase::registerSqlDriver( "QSQLTESTDRIVER", new QSqlDriverCreator<QSqlNullDriver> ); QVERIFY( QSqlDatabase::drivers().contains( "QSQLTESTDRIVER" ) ); diff --git a/tests/auto/qsqldatabase/.gitignore b/tests/auto/sql/kernel/qsqldatabase/.gitignore similarity index 100% rename from tests/auto/qsqldatabase/.gitignore rename to tests/auto/sql/kernel/qsqldatabase/.gitignore diff --git a/tests/auto/qsqldatabase/qsqldatabase.pro b/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro similarity index 100% rename from tests/auto/qsqldatabase/qsqldatabase.pro rename to tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro diff --git a/tests/auto/qsqldatabase/testdata/qtest.mdb b/tests/auto/sql/kernel/qsqldatabase/testdata/qtest.mdb similarity index 100% rename from tests/auto/qsqldatabase/testdata/qtest.mdb rename to tests/auto/sql/kernel/qsqldatabase/testdata/qtest.mdb diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h similarity index 100% rename from tests/auto/qsqldatabase/tst_databases.h rename to tests/auto/sql/kernel/qsqldatabase/tst_databases.h diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp similarity index 100% rename from tests/auto/qsqldatabase/tst_qsqldatabase.cpp rename to tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp diff --git a/tests/auto/qsqldriver/qsqldriver.pro b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro similarity index 100% rename from tests/auto/qsqldriver/qsqldriver.pro rename to tests/auto/sql/kernel/qsqldriver/qsqldriver.pro diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp similarity index 100% rename from tests/auto/qsqldriver/tst_qsqldriver.cpp rename to tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp diff --git a/tests/auto/qsqlerror/.gitignore b/tests/auto/sql/kernel/qsqlerror/.gitignore similarity index 100% rename from tests/auto/qsqlerror/.gitignore rename to tests/auto/sql/kernel/qsqlerror/.gitignore diff --git a/tests/auto/qsqlerror/qsqlerror.pro b/tests/auto/sql/kernel/qsqlerror/qsqlerror.pro similarity index 100% rename from tests/auto/qsqlerror/qsqlerror.pro rename to tests/auto/sql/kernel/qsqlerror/qsqlerror.pro diff --git a/tests/auto/qsqlerror/tst_qsqlerror.cpp b/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp similarity index 100% rename from tests/auto/qsqlerror/tst_qsqlerror.cpp rename to tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp diff --git a/tests/auto/qsqlfield/.gitignore b/tests/auto/sql/kernel/qsqlfield/.gitignore similarity index 100% rename from tests/auto/qsqlfield/.gitignore rename to tests/auto/sql/kernel/qsqlfield/.gitignore diff --git a/tests/auto/qsqlfield/qsqlfield.pro b/tests/auto/sql/kernel/qsqlfield/qsqlfield.pro similarity index 100% rename from tests/auto/qsqlfield/qsqlfield.pro rename to tests/auto/sql/kernel/qsqlfield/qsqlfield.pro diff --git a/tests/auto/qsqlfield/tst_qsqlfield.cpp b/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp similarity index 100% rename from tests/auto/qsqlfield/tst_qsqlfield.cpp rename to tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp diff --git a/tests/auto/qsqlquery/.gitignore b/tests/auto/sql/kernel/qsqlquery/.gitignore similarity index 100% rename from tests/auto/qsqlquery/.gitignore rename to tests/auto/sql/kernel/qsqlquery/.gitignore diff --git a/tests/auto/qsqlquery/qsqlquery.pro b/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro similarity index 100% rename from tests/auto/qsqlquery/qsqlquery.pro rename to tests/auto/sql/kernel/qsqlquery/qsqlquery.pro diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp similarity index 100% rename from tests/auto/qsqlquery/tst_qsqlquery.cpp rename to tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp diff --git a/tests/auto/qsqlrecord/.gitignore b/tests/auto/sql/kernel/qsqlrecord/.gitignore similarity index 100% rename from tests/auto/qsqlrecord/.gitignore rename to tests/auto/sql/kernel/qsqlrecord/.gitignore diff --git a/tests/auto/qsqlrecord/qsqlrecord.pro b/tests/auto/sql/kernel/qsqlrecord/qsqlrecord.pro similarity index 100% rename from tests/auto/qsqlrecord/qsqlrecord.pro rename to tests/auto/sql/kernel/qsqlrecord/qsqlrecord.pro diff --git a/tests/auto/qsqlrecord/tst_qsqlrecord.cpp b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp similarity index 100% rename from tests/auto/qsqlrecord/tst_qsqlrecord.cpp rename to tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp diff --git a/tests/auto/qsqlthread/.gitignore b/tests/auto/sql/kernel/qsqlthread/.gitignore similarity index 100% rename from tests/auto/qsqlthread/.gitignore rename to tests/auto/sql/kernel/qsqlthread/.gitignore diff --git a/tests/auto/qsqlthread/qsqlthread.pro b/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro similarity index 100% rename from tests/auto/qsqlthread/qsqlthread.pro rename to tests/auto/sql/kernel/qsqlthread/qsqlthread.pro diff --git a/tests/auto/qsqlthread/tst_qsqlthread.cpp b/tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp similarity index 100% rename from tests/auto/qsqlthread/tst_qsqlthread.cpp rename to tests/auto/sql/kernel/qsqlthread/tst_qsqlthread.cpp diff --git a/tests/auto/sql/models/models.pro b/tests/auto/sql/models/models.pro new file mode 100644 index 00000000000..d04ba017102 --- /dev/null +++ b/tests/auto/sql/models/models.pro @@ -0,0 +1,6 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qsqlquerymodel \ + qsqlrelationaltablemodel \ + qsqltablemodel \ + diff --git a/tests/auto/qsqlquerymodel/.gitignore b/tests/auto/sql/models/qsqlquerymodel/.gitignore similarity index 100% rename from tests/auto/qsqlquerymodel/.gitignore rename to tests/auto/sql/models/qsqlquerymodel/.gitignore diff --git a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro similarity index 95% rename from tests/auto/qsqlquerymodel/qsqlquerymodel.pro rename to tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro index 4b23e94715e..0664bae6e98 100644 --- a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro +++ b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro @@ -1,7 +1,7 @@ load(qttest_p4) SOURCES += tst_qsqlquerymodel.cpp -QT += sql +QT += widgets sql wince*: { DEPLOYMENT_PLUGIN += qsqlite diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp similarity index 99% rename from tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp rename to tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp index 073f3da1374..fabba48d7cb 100644 --- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -53,7 +53,7 @@ #include <qsqlquerymodel.h> #include <qsortfilterproxymodel.h> -#include "../qsqldatabase/tst_databases.h" +#include "../../kernel/qsqldatabase/tst_databases.h" //TESTED_CLASS= //TESTED_FILES= diff --git a/tests/auto/qsqlrelationaltablemodel/.gitignore b/tests/auto/sql/models/qsqlrelationaltablemodel/.gitignore similarity index 100% rename from tests/auto/qsqlrelationaltablemodel/.gitignore rename to tests/auto/sql/models/qsqlrelationaltablemodel/.gitignore diff --git a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro similarity index 100% rename from tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro rename to tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp similarity index 99% rename from tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp rename to tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index 5f1a6211aaa..2c5af13c0ce 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -43,7 +43,7 @@ #include <QtTest/QtTest> #include <QtSql/QtSql> -#include "../qsqldatabase/tst_databases.h" +#include "../../kernel/qsqldatabase/tst_databases.h" const QString reltest1(qTableName("reltest1", __FILE__)), reltest2(qTableName("reltest2", __FILE__)), diff --git a/tests/auto/qsqltablemodel/.gitignore b/tests/auto/sql/models/qsqltablemodel/.gitignore similarity index 100% rename from tests/auto/qsqltablemodel/.gitignore rename to tests/auto/sql/models/qsqltablemodel/.gitignore diff --git a/tests/auto/qsqltablemodel/qsqltablemodel.pro b/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro similarity index 100% rename from tests/auto/qsqltablemodel/qsqltablemodel.pro rename to tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp similarity index 99% rename from tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp rename to tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp index 96a1f1caa53..07efd4a3a1e 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> -#include "../qsqldatabase/tst_databases.h" +#include "../../kernel/qsqldatabase/tst_databases.h" #include <QtSql> const QString test(qTableName("test", __FILE__)), diff --git a/tests/auto/sql/sql.pro b/tests/auto/sql/sql.pro new file mode 100644 index 00000000000..99f6e38cf82 --- /dev/null +++ b/tests/auto/sql/sql.pro @@ -0,0 +1,5 @@ +TEMPLATE=subdirs +SUBDIRS=\ + kernel \ + models \ + diff --git a/tests/auto/qsignalspy/.gitignore b/tests/auto/testlib/qsignalspy/.gitignore similarity index 100% rename from tests/auto/qsignalspy/.gitignore rename to tests/auto/testlib/qsignalspy/.gitignore diff --git a/tests/auto/qsignalspy/qsignalspy.pro b/tests/auto/testlib/qsignalspy/qsignalspy.pro similarity index 100% rename from tests/auto/qsignalspy/qsignalspy.pro rename to tests/auto/testlib/qsignalspy/qsignalspy.pro diff --git a/tests/auto/qsignalspy/tst_qsignalspy.cpp b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp similarity index 100% rename from tests/auto/qsignalspy/tst_qsignalspy.cpp rename to tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp diff --git a/tests/auto/selftests/.gitignore b/tests/auto/testlib/selftests/.gitignore similarity index 100% rename from tests/auto/selftests/.gitignore rename to tests/auto/testlib/selftests/.gitignore diff --git a/tests/auto/selftests/alive/.gitignore b/tests/auto/testlib/selftests/alive/.gitignore similarity index 100% rename from tests/auto/selftests/alive/.gitignore rename to tests/auto/testlib/selftests/alive/.gitignore diff --git a/tests/auto/selftests/alive/alive.pro b/tests/auto/testlib/selftests/alive/alive.pro similarity index 100% rename from tests/auto/selftests/alive/alive.pro rename to tests/auto/testlib/selftests/alive/alive.pro diff --git a/tests/auto/selftests/alive/qtestalive.cpp b/tests/auto/testlib/selftests/alive/qtestalive.cpp similarity index 100% rename from tests/auto/selftests/alive/qtestalive.cpp rename to tests/auto/testlib/selftests/alive/qtestalive.cpp diff --git a/tests/auto/selftests/alive/tst_alive.cpp b/tests/auto/testlib/selftests/alive/tst_alive.cpp similarity index 100% rename from tests/auto/selftests/alive/tst_alive.cpp rename to tests/auto/testlib/selftests/alive/tst_alive.cpp diff --git a/tests/auto/selftests/assert/assert.pro b/tests/auto/testlib/selftests/assert/assert.pro similarity index 100% rename from tests/auto/selftests/assert/assert.pro rename to tests/auto/testlib/selftests/assert/assert.pro diff --git a/tests/auto/selftests/assert/tst_assert.cpp b/tests/auto/testlib/selftests/assert/tst_assert.cpp similarity index 100% rename from tests/auto/selftests/assert/tst_assert.cpp rename to tests/auto/testlib/selftests/assert/tst_assert.cpp diff --git a/tests/auto/selftests/badxml/badxml.pro b/tests/auto/testlib/selftests/badxml/badxml.pro similarity index 100% rename from tests/auto/selftests/badxml/badxml.pro rename to tests/auto/testlib/selftests/badxml/badxml.pro diff --git a/tests/auto/selftests/badxml/tst_badxml.cpp b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp similarity index 100% rename from tests/auto/selftests/badxml/tst_badxml.cpp rename to tests/auto/testlib/selftests/badxml/tst_badxml.cpp diff --git a/tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro b/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro similarity index 100% rename from tests/auto/selftests/benchlibcallgrind/benchlibcallgrind.pro rename to tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro diff --git a/tests/auto/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp similarity index 100% rename from tests/auto/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp rename to tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp diff --git a/tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro b/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro similarity index 100% rename from tests/auto/selftests/benchlibeventcounter/benchlibeventcounter.pro rename to tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro diff --git a/tests/auto/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp b/tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp similarity index 100% rename from tests/auto/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp rename to tests/auto/testlib/selftests/benchlibeventcounter/tst_benchlibeventcounter.cpp diff --git a/tests/auto/selftests/benchliboptions/benchliboptions.pro b/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro similarity index 100% rename from tests/auto/selftests/benchliboptions/benchliboptions.pro rename to tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro diff --git a/tests/auto/selftests/benchliboptions/tst_benchliboptions.cpp b/tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp similarity index 100% rename from tests/auto/selftests/benchliboptions/tst_benchliboptions.cpp rename to tests/auto/testlib/selftests/benchliboptions/tst_benchliboptions.cpp diff --git a/tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro b/tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro similarity index 100% rename from tests/auto/selftests/benchlibtickcounter/benchlibtickcounter.pro rename to tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro diff --git a/tests/auto/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp b/tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp similarity index 100% rename from tests/auto/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp rename to tests/auto/testlib/selftests/benchlibtickcounter/tst_benchlibtickcounter.cpp diff --git a/tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro b/tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro similarity index 100% rename from tests/auto/selftests/benchlibwalltime/benchlibwalltime.pro rename to tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro diff --git a/tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp b/tests/auto/testlib/selftests/benchlibwalltime/tst_benchlibwalltime.cpp similarity index 100% rename from tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp rename to tests/auto/testlib/selftests/benchlibwalltime/tst_benchlibwalltime.cpp diff --git a/tests/auto/selftests/cmptest/cmptest.pro b/tests/auto/testlib/selftests/cmptest/cmptest.pro similarity index 100% rename from tests/auto/selftests/cmptest/cmptest.pro rename to tests/auto/testlib/selftests/cmptest/cmptest.pro diff --git a/tests/auto/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp similarity index 100% rename from tests/auto/selftests/cmptest/tst_cmptest.cpp rename to tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp diff --git a/tests/auto/selftests/commandlinedata/commandlinedata.pro b/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro similarity index 100% rename from tests/auto/selftests/commandlinedata/commandlinedata.pro rename to tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro diff --git a/tests/auto/selftests/commandlinedata/tst_commandlinedata.cpp b/tests/auto/testlib/selftests/commandlinedata/tst_commandlinedata.cpp similarity index 100% rename from tests/auto/selftests/commandlinedata/tst_commandlinedata.cpp rename to tests/auto/testlib/selftests/commandlinedata/tst_commandlinedata.cpp diff --git a/tests/auto/selftests/crashes/crashes.pro b/tests/auto/testlib/selftests/crashes/crashes.pro similarity index 100% rename from tests/auto/selftests/crashes/crashes.pro rename to tests/auto/testlib/selftests/crashes/crashes.pro diff --git a/tests/auto/selftests/crashes/tst_crashes.cpp b/tests/auto/testlib/selftests/crashes/tst_crashes.cpp similarity index 100% rename from tests/auto/selftests/crashes/tst_crashes.cpp rename to tests/auto/testlib/selftests/crashes/tst_crashes.cpp diff --git a/tests/auto/selftests/datatable/datatable.pro b/tests/auto/testlib/selftests/datatable/datatable.pro similarity index 100% rename from tests/auto/selftests/datatable/datatable.pro rename to tests/auto/testlib/selftests/datatable/datatable.pro diff --git a/tests/auto/selftests/datatable/tst_datatable.cpp b/tests/auto/testlib/selftests/datatable/tst_datatable.cpp similarity index 100% rename from tests/auto/selftests/datatable/tst_datatable.cpp rename to tests/auto/testlib/selftests/datatable/tst_datatable.cpp diff --git a/tests/auto/selftests/datetime/datetime.pro b/tests/auto/testlib/selftests/datetime/datetime.pro similarity index 100% rename from tests/auto/selftests/datetime/datetime.pro rename to tests/auto/testlib/selftests/datetime/datetime.pro diff --git a/tests/auto/selftests/datetime/tst_datetime.cpp b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp similarity index 100% rename from tests/auto/selftests/datetime/tst_datetime.cpp rename to tests/auto/testlib/selftests/datetime/tst_datetime.cpp diff --git a/tests/auto/selftests/differentexec/differentexec.pro b/tests/auto/testlib/selftests/differentexec/differentexec.pro similarity index 100% rename from tests/auto/selftests/differentexec/differentexec.pro rename to tests/auto/testlib/selftests/differentexec/differentexec.pro diff --git a/tests/auto/selftests/differentexec/tst_differentexec.cpp b/tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp similarity index 100% rename from tests/auto/selftests/differentexec/tst_differentexec.cpp rename to tests/auto/testlib/selftests/differentexec/tst_differentexec.cpp diff --git a/tests/auto/selftests/exceptionthrow/exceptionthrow.pro b/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro similarity index 100% rename from tests/auto/selftests/exceptionthrow/exceptionthrow.pro rename to tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro diff --git a/tests/auto/selftests/exceptionthrow/tst_exceptionthrow.cpp b/tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp similarity index 100% rename from tests/auto/selftests/exceptionthrow/tst_exceptionthrow.cpp rename to tests/auto/testlib/selftests/exceptionthrow/tst_exceptionthrow.cpp diff --git a/tests/auto/selftests/expected_alive.txt b/tests/auto/testlib/selftests/expected_alive.txt similarity index 100% rename from tests/auto/selftests/expected_alive.txt rename to tests/auto/testlib/selftests/expected_alive.txt diff --git a/tests/auto/selftests/expected_assert.lightxml b/tests/auto/testlib/selftests/expected_assert.lightxml similarity index 100% rename from tests/auto/selftests/expected_assert.lightxml rename to tests/auto/testlib/selftests/expected_assert.lightxml diff --git a/tests/auto/selftests/expected_assert.txt b/tests/auto/testlib/selftests/expected_assert.txt similarity index 100% rename from tests/auto/selftests/expected_assert.txt rename to tests/auto/testlib/selftests/expected_assert.txt diff --git a/tests/auto/selftests/expected_assert.xml b/tests/auto/testlib/selftests/expected_assert.xml similarity index 100% rename from tests/auto/selftests/expected_assert.xml rename to tests/auto/testlib/selftests/expected_assert.xml diff --git a/tests/auto/selftests/expected_assert.xunitxml b/tests/auto/testlib/selftests/expected_assert.xunitxml similarity index 100% rename from tests/auto/selftests/expected_assert.xunitxml rename to tests/auto/testlib/selftests/expected_assert.xunitxml diff --git a/tests/auto/selftests/expected_badxml.lightxml b/tests/auto/testlib/selftests/expected_badxml.lightxml similarity index 100% rename from tests/auto/selftests/expected_badxml.lightxml rename to tests/auto/testlib/selftests/expected_badxml.lightxml diff --git a/tests/auto/selftests/expected_badxml.txt b/tests/auto/testlib/selftests/expected_badxml.txt similarity index 100% rename from tests/auto/selftests/expected_badxml.txt rename to tests/auto/testlib/selftests/expected_badxml.txt diff --git a/tests/auto/selftests/expected_badxml.xml b/tests/auto/testlib/selftests/expected_badxml.xml similarity index 100% rename from tests/auto/selftests/expected_badxml.xml rename to tests/auto/testlib/selftests/expected_badxml.xml diff --git a/tests/auto/selftests/expected_badxml.xunitxml b/tests/auto/testlib/selftests/expected_badxml.xunitxml similarity index 100% rename from tests/auto/selftests/expected_badxml.xunitxml rename to tests/auto/testlib/selftests/expected_badxml.xunitxml diff --git a/tests/auto/selftests/expected_benchlibcallgrind.lightxml b/tests/auto/testlib/selftests/expected_benchlibcallgrind.lightxml similarity index 100% rename from tests/auto/selftests/expected_benchlibcallgrind.lightxml rename to tests/auto/testlib/selftests/expected_benchlibcallgrind.lightxml diff --git a/tests/auto/selftests/expected_benchlibcallgrind.txt b/tests/auto/testlib/selftests/expected_benchlibcallgrind.txt similarity index 100% rename from tests/auto/selftests/expected_benchlibcallgrind.txt rename to tests/auto/testlib/selftests/expected_benchlibcallgrind.txt diff --git a/tests/auto/selftests/expected_benchlibcallgrind.xml b/tests/auto/testlib/selftests/expected_benchlibcallgrind.xml similarity index 100% rename from tests/auto/selftests/expected_benchlibcallgrind.xml rename to tests/auto/testlib/selftests/expected_benchlibcallgrind.xml diff --git a/tests/auto/selftests/expected_benchlibcallgrind.xunitxml b/tests/auto/testlib/selftests/expected_benchlibcallgrind.xunitxml similarity index 100% rename from tests/auto/selftests/expected_benchlibcallgrind.xunitxml rename to tests/auto/testlib/selftests/expected_benchlibcallgrind.xunitxml diff --git a/tests/auto/selftests/expected_benchlibeventcounter.lightxml b/tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml similarity index 100% rename from tests/auto/selftests/expected_benchlibeventcounter.lightxml rename to tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml diff --git a/tests/auto/selftests/expected_benchlibeventcounter.txt b/tests/auto/testlib/selftests/expected_benchlibeventcounter.txt similarity index 100% rename from tests/auto/selftests/expected_benchlibeventcounter.txt rename to tests/auto/testlib/selftests/expected_benchlibeventcounter.txt diff --git a/tests/auto/selftests/expected_benchlibeventcounter.xml b/tests/auto/testlib/selftests/expected_benchlibeventcounter.xml similarity index 100% rename from tests/auto/selftests/expected_benchlibeventcounter.xml rename to tests/auto/testlib/selftests/expected_benchlibeventcounter.xml diff --git a/tests/auto/selftests/expected_benchlibeventcounter.xunitxml b/tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml similarity index 100% rename from tests/auto/selftests/expected_benchlibeventcounter.xunitxml rename to tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml diff --git a/tests/auto/selftests/expected_benchliboptions.lightxml b/tests/auto/testlib/selftests/expected_benchliboptions.lightxml similarity index 100% rename from tests/auto/selftests/expected_benchliboptions.lightxml rename to tests/auto/testlib/selftests/expected_benchliboptions.lightxml diff --git a/tests/auto/selftests/expected_benchliboptions.txt b/tests/auto/testlib/selftests/expected_benchliboptions.txt similarity index 100% rename from tests/auto/selftests/expected_benchliboptions.txt rename to tests/auto/testlib/selftests/expected_benchliboptions.txt diff --git a/tests/auto/selftests/expected_benchliboptions.xml b/tests/auto/testlib/selftests/expected_benchliboptions.xml similarity index 100% rename from tests/auto/selftests/expected_benchliboptions.xml rename to tests/auto/testlib/selftests/expected_benchliboptions.xml diff --git a/tests/auto/selftests/expected_benchliboptions.xunitxml b/tests/auto/testlib/selftests/expected_benchliboptions.xunitxml similarity index 100% rename from tests/auto/selftests/expected_benchliboptions.xunitxml rename to tests/auto/testlib/selftests/expected_benchliboptions.xunitxml diff --git a/tests/auto/selftests/expected_benchlibtickcounter.lightxml b/tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml similarity index 100% rename from tests/auto/selftests/expected_benchlibtickcounter.lightxml rename to tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml diff --git a/tests/auto/selftests/expected_benchlibtickcounter.txt b/tests/auto/testlib/selftests/expected_benchlibtickcounter.txt similarity index 100% rename from tests/auto/selftests/expected_benchlibtickcounter.txt rename to tests/auto/testlib/selftests/expected_benchlibtickcounter.txt diff --git a/tests/auto/selftests/expected_benchlibtickcounter.xml b/tests/auto/testlib/selftests/expected_benchlibtickcounter.xml similarity index 100% rename from tests/auto/selftests/expected_benchlibtickcounter.xml rename to tests/auto/testlib/selftests/expected_benchlibtickcounter.xml diff --git a/tests/auto/selftests/expected_benchlibtickcounter.xunitxml b/tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml similarity index 100% rename from tests/auto/selftests/expected_benchlibtickcounter.xunitxml rename to tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml diff --git a/tests/auto/selftests/expected_benchlibwalltime.lightxml b/tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml similarity index 100% rename from tests/auto/selftests/expected_benchlibwalltime.lightxml rename to tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml diff --git a/tests/auto/selftests/expected_benchlibwalltime.txt b/tests/auto/testlib/selftests/expected_benchlibwalltime.txt similarity index 100% rename from tests/auto/selftests/expected_benchlibwalltime.txt rename to tests/auto/testlib/selftests/expected_benchlibwalltime.txt diff --git a/tests/auto/selftests/expected_benchlibwalltime.xml b/tests/auto/testlib/selftests/expected_benchlibwalltime.xml similarity index 100% rename from tests/auto/selftests/expected_benchlibwalltime.xml rename to tests/auto/testlib/selftests/expected_benchlibwalltime.xml diff --git a/tests/auto/selftests/expected_benchlibwalltime.xunitxml b/tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml similarity index 100% rename from tests/auto/selftests/expected_benchlibwalltime.xunitxml rename to tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml diff --git a/tests/auto/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml similarity index 100% rename from tests/auto/selftests/expected_cmptest.lightxml rename to tests/auto/testlib/selftests/expected_cmptest.lightxml diff --git a/tests/auto/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt similarity index 100% rename from tests/auto/selftests/expected_cmptest.txt rename to tests/auto/testlib/selftests/expected_cmptest.txt diff --git a/tests/auto/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml similarity index 100% rename from tests/auto/selftests/expected_cmptest.xml rename to tests/auto/testlib/selftests/expected_cmptest.xml diff --git a/tests/auto/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml similarity index 100% rename from tests/auto/selftests/expected_cmptest.xunitxml rename to tests/auto/testlib/selftests/expected_cmptest.xunitxml diff --git a/tests/auto/selftests/expected_commandlinedata.lightxml b/tests/auto/testlib/selftests/expected_commandlinedata.lightxml similarity index 100% rename from tests/auto/selftests/expected_commandlinedata.lightxml rename to tests/auto/testlib/selftests/expected_commandlinedata.lightxml diff --git a/tests/auto/selftests/expected_commandlinedata.txt b/tests/auto/testlib/selftests/expected_commandlinedata.txt similarity index 100% rename from tests/auto/selftests/expected_commandlinedata.txt rename to tests/auto/testlib/selftests/expected_commandlinedata.txt diff --git a/tests/auto/selftests/expected_commandlinedata.xml b/tests/auto/testlib/selftests/expected_commandlinedata.xml similarity index 100% rename from tests/auto/selftests/expected_commandlinedata.xml rename to tests/auto/testlib/selftests/expected_commandlinedata.xml diff --git a/tests/auto/selftests/expected_commandlinedata.xunitxml b/tests/auto/testlib/selftests/expected_commandlinedata.xunitxml similarity index 100% rename from tests/auto/selftests/expected_commandlinedata.xunitxml rename to tests/auto/testlib/selftests/expected_commandlinedata.xunitxml diff --git a/tests/auto/selftests/expected_crashes.lightxml b/tests/auto/testlib/selftests/expected_crashes.lightxml similarity index 100% rename from tests/auto/selftests/expected_crashes.lightxml rename to tests/auto/testlib/selftests/expected_crashes.lightxml diff --git a/tests/auto/selftests/expected_crashes.xml b/tests/auto/testlib/selftests/expected_crashes.xml similarity index 100% rename from tests/auto/selftests/expected_crashes.xml rename to tests/auto/testlib/selftests/expected_crashes.xml diff --git a/tests/auto/selftests/expected_crashes.xunitxml b/tests/auto/testlib/selftests/expected_crashes.xunitxml similarity index 100% rename from tests/auto/selftests/expected_crashes.xunitxml rename to tests/auto/testlib/selftests/expected_crashes.xunitxml diff --git a/tests/auto/selftests/expected_crashes_1.txt b/tests/auto/testlib/selftests/expected_crashes_1.txt similarity index 100% rename from tests/auto/selftests/expected_crashes_1.txt rename to tests/auto/testlib/selftests/expected_crashes_1.txt diff --git a/tests/auto/selftests/expected_crashes_2.txt b/tests/auto/testlib/selftests/expected_crashes_2.txt similarity index 100% rename from tests/auto/selftests/expected_crashes_2.txt rename to tests/auto/testlib/selftests/expected_crashes_2.txt diff --git a/tests/auto/selftests/expected_crashes_3.txt b/tests/auto/testlib/selftests/expected_crashes_3.txt similarity index 100% rename from tests/auto/selftests/expected_crashes_3.txt rename to tests/auto/testlib/selftests/expected_crashes_3.txt diff --git a/tests/auto/selftests/expected_datatable.lightxml b/tests/auto/testlib/selftests/expected_datatable.lightxml similarity index 100% rename from tests/auto/selftests/expected_datatable.lightxml rename to tests/auto/testlib/selftests/expected_datatable.lightxml diff --git a/tests/auto/selftests/expected_datatable.txt b/tests/auto/testlib/selftests/expected_datatable.txt similarity index 100% rename from tests/auto/selftests/expected_datatable.txt rename to tests/auto/testlib/selftests/expected_datatable.txt diff --git a/tests/auto/selftests/expected_datatable.xml b/tests/auto/testlib/selftests/expected_datatable.xml similarity index 100% rename from tests/auto/selftests/expected_datatable.xml rename to tests/auto/testlib/selftests/expected_datatable.xml diff --git a/tests/auto/selftests/expected_datatable.xunitxml b/tests/auto/testlib/selftests/expected_datatable.xunitxml similarity index 100% rename from tests/auto/selftests/expected_datatable.xunitxml rename to tests/auto/testlib/selftests/expected_datatable.xunitxml diff --git a/tests/auto/selftests/expected_datetime.lightxml b/tests/auto/testlib/selftests/expected_datetime.lightxml similarity index 100% rename from tests/auto/selftests/expected_datetime.lightxml rename to tests/auto/testlib/selftests/expected_datetime.lightxml diff --git a/tests/auto/selftests/expected_datetime.txt b/tests/auto/testlib/selftests/expected_datetime.txt similarity index 100% rename from tests/auto/selftests/expected_datetime.txt rename to tests/auto/testlib/selftests/expected_datetime.txt diff --git a/tests/auto/selftests/expected_datetime.xml b/tests/auto/testlib/selftests/expected_datetime.xml similarity index 100% rename from tests/auto/selftests/expected_datetime.xml rename to tests/auto/testlib/selftests/expected_datetime.xml diff --git a/tests/auto/selftests/expected_datetime.xunitxml b/tests/auto/testlib/selftests/expected_datetime.xunitxml similarity index 100% rename from tests/auto/selftests/expected_datetime.xunitxml rename to tests/auto/testlib/selftests/expected_datetime.xunitxml diff --git a/tests/auto/selftests/expected_differentexec.txt b/tests/auto/testlib/selftests/expected_differentexec.txt similarity index 100% rename from tests/auto/selftests/expected_differentexec.txt rename to tests/auto/testlib/selftests/expected_differentexec.txt diff --git a/tests/auto/selftests/expected_exceptionthrow.lightxml b/tests/auto/testlib/selftests/expected_exceptionthrow.lightxml similarity index 100% rename from tests/auto/selftests/expected_exceptionthrow.lightxml rename to tests/auto/testlib/selftests/expected_exceptionthrow.lightxml diff --git a/tests/auto/selftests/expected_exceptionthrow.txt b/tests/auto/testlib/selftests/expected_exceptionthrow.txt similarity index 100% rename from tests/auto/selftests/expected_exceptionthrow.txt rename to tests/auto/testlib/selftests/expected_exceptionthrow.txt diff --git a/tests/auto/selftests/expected_exceptionthrow.xml b/tests/auto/testlib/selftests/expected_exceptionthrow.xml similarity index 100% rename from tests/auto/selftests/expected_exceptionthrow.xml rename to tests/auto/testlib/selftests/expected_exceptionthrow.xml diff --git a/tests/auto/selftests/expected_exceptionthrow.xunitxml b/tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml similarity index 100% rename from tests/auto/selftests/expected_exceptionthrow.xunitxml rename to tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml diff --git a/tests/auto/selftests/expected_expectfail.lightxml b/tests/auto/testlib/selftests/expected_expectfail.lightxml similarity index 100% rename from tests/auto/selftests/expected_expectfail.lightxml rename to tests/auto/testlib/selftests/expected_expectfail.lightxml diff --git a/tests/auto/selftests/expected_expectfail.txt b/tests/auto/testlib/selftests/expected_expectfail.txt similarity index 100% rename from tests/auto/selftests/expected_expectfail.txt rename to tests/auto/testlib/selftests/expected_expectfail.txt diff --git a/tests/auto/selftests/expected_expectfail.xml b/tests/auto/testlib/selftests/expected_expectfail.xml similarity index 100% rename from tests/auto/selftests/expected_expectfail.xml rename to tests/auto/testlib/selftests/expected_expectfail.xml diff --git a/tests/auto/selftests/expected_expectfail.xunitxml b/tests/auto/testlib/selftests/expected_expectfail.xunitxml similarity index 100% rename from tests/auto/selftests/expected_expectfail.xunitxml rename to tests/auto/testlib/selftests/expected_expectfail.xunitxml diff --git a/tests/auto/selftests/expected_failinit.lightxml b/tests/auto/testlib/selftests/expected_failinit.lightxml similarity index 100% rename from tests/auto/selftests/expected_failinit.lightxml rename to tests/auto/testlib/selftests/expected_failinit.lightxml diff --git a/tests/auto/selftests/expected_failinit.txt b/tests/auto/testlib/selftests/expected_failinit.txt similarity index 100% rename from tests/auto/selftests/expected_failinit.txt rename to tests/auto/testlib/selftests/expected_failinit.txt diff --git a/tests/auto/selftests/expected_failinit.xml b/tests/auto/testlib/selftests/expected_failinit.xml similarity index 100% rename from tests/auto/selftests/expected_failinit.xml rename to tests/auto/testlib/selftests/expected_failinit.xml diff --git a/tests/auto/selftests/expected_failinit.xunitxml b/tests/auto/testlib/selftests/expected_failinit.xunitxml similarity index 100% rename from tests/auto/selftests/expected_failinit.xunitxml rename to tests/auto/testlib/selftests/expected_failinit.xunitxml diff --git a/tests/auto/selftests/expected_failinitdata.lightxml b/tests/auto/testlib/selftests/expected_failinitdata.lightxml similarity index 100% rename from tests/auto/selftests/expected_failinitdata.lightxml rename to tests/auto/testlib/selftests/expected_failinitdata.lightxml diff --git a/tests/auto/selftests/expected_failinitdata.txt b/tests/auto/testlib/selftests/expected_failinitdata.txt similarity index 100% rename from tests/auto/selftests/expected_failinitdata.txt rename to tests/auto/testlib/selftests/expected_failinitdata.txt diff --git a/tests/auto/selftests/expected_failinitdata.xml b/tests/auto/testlib/selftests/expected_failinitdata.xml similarity index 100% rename from tests/auto/selftests/expected_failinitdata.xml rename to tests/auto/testlib/selftests/expected_failinitdata.xml diff --git a/tests/auto/selftests/expected_failinitdata.xunitxml b/tests/auto/testlib/selftests/expected_failinitdata.xunitxml similarity index 100% rename from tests/auto/selftests/expected_failinitdata.xunitxml rename to tests/auto/testlib/selftests/expected_failinitdata.xunitxml diff --git a/tests/auto/selftests/expected_fatal.txt b/tests/auto/testlib/selftests/expected_fatal.txt similarity index 100% rename from tests/auto/selftests/expected_fatal.txt rename to tests/auto/testlib/selftests/expected_fatal.txt diff --git a/tests/auto/selftests/expected_fetchbogus.lightxml b/tests/auto/testlib/selftests/expected_fetchbogus.lightxml similarity index 100% rename from tests/auto/selftests/expected_fetchbogus.lightxml rename to tests/auto/testlib/selftests/expected_fetchbogus.lightxml diff --git a/tests/auto/selftests/expected_fetchbogus.txt b/tests/auto/testlib/selftests/expected_fetchbogus.txt similarity index 100% rename from tests/auto/selftests/expected_fetchbogus.txt rename to tests/auto/testlib/selftests/expected_fetchbogus.txt diff --git a/tests/auto/selftests/expected_fetchbogus.xml b/tests/auto/testlib/selftests/expected_fetchbogus.xml similarity index 100% rename from tests/auto/selftests/expected_fetchbogus.xml rename to tests/auto/testlib/selftests/expected_fetchbogus.xml diff --git a/tests/auto/selftests/expected_fetchbogus.xunitxml b/tests/auto/testlib/selftests/expected_fetchbogus.xunitxml similarity index 100% rename from tests/auto/selftests/expected_fetchbogus.xunitxml rename to tests/auto/testlib/selftests/expected_fetchbogus.xunitxml diff --git a/tests/auto/selftests/expected_globaldata.lightxml b/tests/auto/testlib/selftests/expected_globaldata.lightxml similarity index 100% rename from tests/auto/selftests/expected_globaldata.lightxml rename to tests/auto/testlib/selftests/expected_globaldata.lightxml diff --git a/tests/auto/selftests/expected_globaldata.txt b/tests/auto/testlib/selftests/expected_globaldata.txt similarity index 100% rename from tests/auto/selftests/expected_globaldata.txt rename to tests/auto/testlib/selftests/expected_globaldata.txt diff --git a/tests/auto/selftests/expected_globaldata.xml b/tests/auto/testlib/selftests/expected_globaldata.xml similarity index 100% rename from tests/auto/selftests/expected_globaldata.xml rename to tests/auto/testlib/selftests/expected_globaldata.xml diff --git a/tests/auto/selftests/expected_globaldata.xunitxml b/tests/auto/testlib/selftests/expected_globaldata.xunitxml similarity index 100% rename from tests/auto/selftests/expected_globaldata.xunitxml rename to tests/auto/testlib/selftests/expected_globaldata.xunitxml diff --git a/tests/auto/selftests/expected_longstring.lightxml b/tests/auto/testlib/selftests/expected_longstring.lightxml similarity index 100% rename from tests/auto/selftests/expected_longstring.lightxml rename to tests/auto/testlib/selftests/expected_longstring.lightxml diff --git a/tests/auto/selftests/expected_longstring.txt b/tests/auto/testlib/selftests/expected_longstring.txt similarity index 100% rename from tests/auto/selftests/expected_longstring.txt rename to tests/auto/testlib/selftests/expected_longstring.txt diff --git a/tests/auto/selftests/expected_longstring.xml b/tests/auto/testlib/selftests/expected_longstring.xml similarity index 100% rename from tests/auto/selftests/expected_longstring.xml rename to tests/auto/testlib/selftests/expected_longstring.xml diff --git a/tests/auto/selftests/expected_longstring.xunitxml b/tests/auto/testlib/selftests/expected_longstring.xunitxml similarity index 100% rename from tests/auto/selftests/expected_longstring.xunitxml rename to tests/auto/testlib/selftests/expected_longstring.xunitxml diff --git a/tests/auto/selftests/expected_maxwarnings.lightxml b/tests/auto/testlib/selftests/expected_maxwarnings.lightxml similarity index 100% rename from tests/auto/selftests/expected_maxwarnings.lightxml rename to tests/auto/testlib/selftests/expected_maxwarnings.lightxml diff --git a/tests/auto/selftests/expected_maxwarnings.txt b/tests/auto/testlib/selftests/expected_maxwarnings.txt similarity index 100% rename from tests/auto/selftests/expected_maxwarnings.txt rename to tests/auto/testlib/selftests/expected_maxwarnings.txt diff --git a/tests/auto/selftests/expected_maxwarnings.xml b/tests/auto/testlib/selftests/expected_maxwarnings.xml similarity index 100% rename from tests/auto/selftests/expected_maxwarnings.xml rename to tests/auto/testlib/selftests/expected_maxwarnings.xml diff --git a/tests/auto/selftests/expected_maxwarnings.xunitxml b/tests/auto/testlib/selftests/expected_maxwarnings.xunitxml similarity index 100% rename from tests/auto/selftests/expected_maxwarnings.xunitxml rename to tests/auto/testlib/selftests/expected_maxwarnings.xunitxml diff --git a/tests/auto/selftests/expected_multiexec.lightxml b/tests/auto/testlib/selftests/expected_multiexec.lightxml similarity index 100% rename from tests/auto/selftests/expected_multiexec.lightxml rename to tests/auto/testlib/selftests/expected_multiexec.lightxml diff --git a/tests/auto/selftests/expected_multiexec.txt b/tests/auto/testlib/selftests/expected_multiexec.txt similarity index 100% rename from tests/auto/selftests/expected_multiexec.txt rename to tests/auto/testlib/selftests/expected_multiexec.txt diff --git a/tests/auto/selftests/expected_multiexec.xml b/tests/auto/testlib/selftests/expected_multiexec.xml similarity index 100% rename from tests/auto/selftests/expected_multiexec.xml rename to tests/auto/testlib/selftests/expected_multiexec.xml diff --git a/tests/auto/selftests/expected_multiexec.xunitxml b/tests/auto/testlib/selftests/expected_multiexec.xunitxml similarity index 100% rename from tests/auto/selftests/expected_multiexec.xunitxml rename to tests/auto/testlib/selftests/expected_multiexec.xunitxml diff --git a/tests/auto/selftests/expected_qexecstringlist.txt b/tests/auto/testlib/selftests/expected_qexecstringlist.txt similarity index 100% rename from tests/auto/selftests/expected_qexecstringlist.txt rename to tests/auto/testlib/selftests/expected_qexecstringlist.txt diff --git a/tests/auto/selftests/expected_singleskip.lightxml b/tests/auto/testlib/selftests/expected_singleskip.lightxml similarity index 100% rename from tests/auto/selftests/expected_singleskip.lightxml rename to tests/auto/testlib/selftests/expected_singleskip.lightxml diff --git a/tests/auto/selftests/expected_singleskip.txt b/tests/auto/testlib/selftests/expected_singleskip.txt similarity index 100% rename from tests/auto/selftests/expected_singleskip.txt rename to tests/auto/testlib/selftests/expected_singleskip.txt diff --git a/tests/auto/selftests/expected_singleskip.xml b/tests/auto/testlib/selftests/expected_singleskip.xml similarity index 100% rename from tests/auto/selftests/expected_singleskip.xml rename to tests/auto/testlib/selftests/expected_singleskip.xml diff --git a/tests/auto/selftests/expected_singleskip.xunitxml b/tests/auto/testlib/selftests/expected_singleskip.xunitxml similarity index 100% rename from tests/auto/selftests/expected_singleskip.xunitxml rename to tests/auto/testlib/selftests/expected_singleskip.xunitxml diff --git a/tests/auto/selftests/expected_skip.lightxml b/tests/auto/testlib/selftests/expected_skip.lightxml similarity index 100% rename from tests/auto/selftests/expected_skip.lightxml rename to tests/auto/testlib/selftests/expected_skip.lightxml diff --git a/tests/auto/selftests/expected_skip.txt b/tests/auto/testlib/selftests/expected_skip.txt similarity index 100% rename from tests/auto/selftests/expected_skip.txt rename to tests/auto/testlib/selftests/expected_skip.txt diff --git a/tests/auto/selftests/expected_skip.xml b/tests/auto/testlib/selftests/expected_skip.xml similarity index 100% rename from tests/auto/selftests/expected_skip.xml rename to tests/auto/testlib/selftests/expected_skip.xml diff --git a/tests/auto/selftests/expected_skip.xunitxml b/tests/auto/testlib/selftests/expected_skip.xunitxml similarity index 100% rename from tests/auto/selftests/expected_skip.xunitxml rename to tests/auto/testlib/selftests/expected_skip.xunitxml diff --git a/tests/auto/selftests/expected_skipglobal.lightxml b/tests/auto/testlib/selftests/expected_skipglobal.lightxml similarity index 100% rename from tests/auto/selftests/expected_skipglobal.lightxml rename to tests/auto/testlib/selftests/expected_skipglobal.lightxml diff --git a/tests/auto/selftests/expected_skipglobal.txt b/tests/auto/testlib/selftests/expected_skipglobal.txt similarity index 100% rename from tests/auto/selftests/expected_skipglobal.txt rename to tests/auto/testlib/selftests/expected_skipglobal.txt diff --git a/tests/auto/selftests/expected_skipglobal.xml b/tests/auto/testlib/selftests/expected_skipglobal.xml similarity index 100% rename from tests/auto/selftests/expected_skipglobal.xml rename to tests/auto/testlib/selftests/expected_skipglobal.xml diff --git a/tests/auto/selftests/expected_skipglobal.xunitxml b/tests/auto/testlib/selftests/expected_skipglobal.xunitxml similarity index 100% rename from tests/auto/selftests/expected_skipglobal.xunitxml rename to tests/auto/testlib/selftests/expected_skipglobal.xunitxml diff --git a/tests/auto/selftests/expected_skipinit.lightxml b/tests/auto/testlib/selftests/expected_skipinit.lightxml similarity index 100% rename from tests/auto/selftests/expected_skipinit.lightxml rename to tests/auto/testlib/selftests/expected_skipinit.lightxml diff --git a/tests/auto/selftests/expected_skipinit.txt b/tests/auto/testlib/selftests/expected_skipinit.txt similarity index 100% rename from tests/auto/selftests/expected_skipinit.txt rename to tests/auto/testlib/selftests/expected_skipinit.txt diff --git a/tests/auto/selftests/expected_skipinit.xml b/tests/auto/testlib/selftests/expected_skipinit.xml similarity index 100% rename from tests/auto/selftests/expected_skipinit.xml rename to tests/auto/testlib/selftests/expected_skipinit.xml diff --git a/tests/auto/selftests/expected_skipinit.xunitxml b/tests/auto/testlib/selftests/expected_skipinit.xunitxml similarity index 100% rename from tests/auto/selftests/expected_skipinit.xunitxml rename to tests/auto/testlib/selftests/expected_skipinit.xunitxml diff --git a/tests/auto/selftests/expected_skipinitdata.lightxml b/tests/auto/testlib/selftests/expected_skipinitdata.lightxml similarity index 100% rename from tests/auto/selftests/expected_skipinitdata.lightxml rename to tests/auto/testlib/selftests/expected_skipinitdata.lightxml diff --git a/tests/auto/selftests/expected_skipinitdata.txt b/tests/auto/testlib/selftests/expected_skipinitdata.txt similarity index 100% rename from tests/auto/selftests/expected_skipinitdata.txt rename to tests/auto/testlib/selftests/expected_skipinitdata.txt diff --git a/tests/auto/selftests/expected_skipinitdata.xml b/tests/auto/testlib/selftests/expected_skipinitdata.xml similarity index 100% rename from tests/auto/selftests/expected_skipinitdata.xml rename to tests/auto/testlib/selftests/expected_skipinitdata.xml diff --git a/tests/auto/selftests/expected_skipinitdata.xunitxml b/tests/auto/testlib/selftests/expected_skipinitdata.xunitxml similarity index 100% rename from tests/auto/selftests/expected_skipinitdata.xunitxml rename to tests/auto/testlib/selftests/expected_skipinitdata.xunitxml diff --git a/tests/auto/selftests/expected_sleep.lightxml b/tests/auto/testlib/selftests/expected_sleep.lightxml similarity index 100% rename from tests/auto/selftests/expected_sleep.lightxml rename to tests/auto/testlib/selftests/expected_sleep.lightxml diff --git a/tests/auto/selftests/expected_sleep.txt b/tests/auto/testlib/selftests/expected_sleep.txt similarity index 100% rename from tests/auto/selftests/expected_sleep.txt rename to tests/auto/testlib/selftests/expected_sleep.txt diff --git a/tests/auto/selftests/expected_sleep.xml b/tests/auto/testlib/selftests/expected_sleep.xml similarity index 100% rename from tests/auto/selftests/expected_sleep.xml rename to tests/auto/testlib/selftests/expected_sleep.xml diff --git a/tests/auto/selftests/expected_sleep.xunitxml b/tests/auto/testlib/selftests/expected_sleep.xunitxml similarity index 100% rename from tests/auto/selftests/expected_sleep.xunitxml rename to tests/auto/testlib/selftests/expected_sleep.xunitxml diff --git a/tests/auto/selftests/expected_strcmp.lightxml b/tests/auto/testlib/selftests/expected_strcmp.lightxml similarity index 100% rename from tests/auto/selftests/expected_strcmp.lightxml rename to tests/auto/testlib/selftests/expected_strcmp.lightxml diff --git a/tests/auto/selftests/expected_strcmp.txt b/tests/auto/testlib/selftests/expected_strcmp.txt similarity index 100% rename from tests/auto/selftests/expected_strcmp.txt rename to tests/auto/testlib/selftests/expected_strcmp.txt diff --git a/tests/auto/selftests/expected_strcmp.xml b/tests/auto/testlib/selftests/expected_strcmp.xml similarity index 100% rename from tests/auto/selftests/expected_strcmp.xml rename to tests/auto/testlib/selftests/expected_strcmp.xml diff --git a/tests/auto/selftests/expected_strcmp.xunitxml b/tests/auto/testlib/selftests/expected_strcmp.xunitxml similarity index 100% rename from tests/auto/selftests/expected_strcmp.xunitxml rename to tests/auto/testlib/selftests/expected_strcmp.xunitxml diff --git a/tests/auto/selftests/expected_subtest.lightxml b/tests/auto/testlib/selftests/expected_subtest.lightxml similarity index 100% rename from tests/auto/selftests/expected_subtest.lightxml rename to tests/auto/testlib/selftests/expected_subtest.lightxml diff --git a/tests/auto/selftests/expected_subtest.txt b/tests/auto/testlib/selftests/expected_subtest.txt similarity index 100% rename from tests/auto/selftests/expected_subtest.txt rename to tests/auto/testlib/selftests/expected_subtest.txt diff --git a/tests/auto/selftests/expected_subtest.xml b/tests/auto/testlib/selftests/expected_subtest.xml similarity index 100% rename from tests/auto/selftests/expected_subtest.xml rename to tests/auto/testlib/selftests/expected_subtest.xml diff --git a/tests/auto/selftests/expected_subtest.xunitxml b/tests/auto/testlib/selftests/expected_subtest.xunitxml similarity index 100% rename from tests/auto/selftests/expected_subtest.xunitxml rename to tests/auto/testlib/selftests/expected_subtest.xunitxml diff --git a/tests/auto/selftests/expected_waitwithoutgui.lightxml b/tests/auto/testlib/selftests/expected_waitwithoutgui.lightxml similarity index 100% rename from tests/auto/selftests/expected_waitwithoutgui.lightxml rename to tests/auto/testlib/selftests/expected_waitwithoutgui.lightxml diff --git a/tests/auto/selftests/expected_waitwithoutgui.txt b/tests/auto/testlib/selftests/expected_waitwithoutgui.txt similarity index 100% rename from tests/auto/selftests/expected_waitwithoutgui.txt rename to tests/auto/testlib/selftests/expected_waitwithoutgui.txt diff --git a/tests/auto/selftests/expected_waitwithoutgui.xml b/tests/auto/testlib/selftests/expected_waitwithoutgui.xml similarity index 100% rename from tests/auto/selftests/expected_waitwithoutgui.xml rename to tests/auto/testlib/selftests/expected_waitwithoutgui.xml diff --git a/tests/auto/selftests/expected_waitwithoutgui.xunitxml b/tests/auto/testlib/selftests/expected_waitwithoutgui.xunitxml similarity index 100% rename from tests/auto/selftests/expected_waitwithoutgui.xunitxml rename to tests/auto/testlib/selftests/expected_waitwithoutgui.xunitxml diff --git a/tests/auto/selftests/expected_warnings.lightxml b/tests/auto/testlib/selftests/expected_warnings.lightxml similarity index 100% rename from tests/auto/selftests/expected_warnings.lightxml rename to tests/auto/testlib/selftests/expected_warnings.lightxml diff --git a/tests/auto/selftests/expected_warnings.txt b/tests/auto/testlib/selftests/expected_warnings.txt similarity index 100% rename from tests/auto/selftests/expected_warnings.txt rename to tests/auto/testlib/selftests/expected_warnings.txt diff --git a/tests/auto/selftests/expected_warnings.xml b/tests/auto/testlib/selftests/expected_warnings.xml similarity index 100% rename from tests/auto/selftests/expected_warnings.xml rename to tests/auto/testlib/selftests/expected_warnings.xml diff --git a/tests/auto/selftests/expected_warnings.xunitxml b/tests/auto/testlib/selftests/expected_warnings.xunitxml similarity index 100% rename from tests/auto/selftests/expected_warnings.xunitxml rename to tests/auto/testlib/selftests/expected_warnings.xunitxml diff --git a/tests/auto/selftests/expected_xunit.lightxml b/tests/auto/testlib/selftests/expected_xunit.lightxml similarity index 100% rename from tests/auto/selftests/expected_xunit.lightxml rename to tests/auto/testlib/selftests/expected_xunit.lightxml diff --git a/tests/auto/selftests/expected_xunit.txt b/tests/auto/testlib/selftests/expected_xunit.txt similarity index 100% rename from tests/auto/selftests/expected_xunit.txt rename to tests/auto/testlib/selftests/expected_xunit.txt diff --git a/tests/auto/selftests/expected_xunit.xml b/tests/auto/testlib/selftests/expected_xunit.xml similarity index 100% rename from tests/auto/selftests/expected_xunit.xml rename to tests/auto/testlib/selftests/expected_xunit.xml diff --git a/tests/auto/selftests/expected_xunit.xunitxml b/tests/auto/testlib/selftests/expected_xunit.xunitxml similarity index 100% rename from tests/auto/selftests/expected_xunit.xunitxml rename to tests/auto/testlib/selftests/expected_xunit.xunitxml diff --git a/tests/auto/selftests/expectfail/expectfail.pro b/tests/auto/testlib/selftests/expectfail/expectfail.pro similarity index 100% rename from tests/auto/selftests/expectfail/expectfail.pro rename to tests/auto/testlib/selftests/expectfail/expectfail.pro diff --git a/tests/auto/selftests/expectfail/tst_expectfail.cpp b/tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp similarity index 100% rename from tests/auto/selftests/expectfail/tst_expectfail.cpp rename to tests/auto/testlib/selftests/expectfail/tst_expectfail.cpp diff --git a/tests/auto/selftests/failinit/failinit.pro b/tests/auto/testlib/selftests/failinit/failinit.pro similarity index 100% rename from tests/auto/selftests/failinit/failinit.pro rename to tests/auto/testlib/selftests/failinit/failinit.pro diff --git a/tests/auto/selftests/failinit/tst_failinit.cpp b/tests/auto/testlib/selftests/failinit/tst_failinit.cpp similarity index 100% rename from tests/auto/selftests/failinit/tst_failinit.cpp rename to tests/auto/testlib/selftests/failinit/tst_failinit.cpp diff --git a/tests/auto/selftests/failinitdata/failinitdata.pro b/tests/auto/testlib/selftests/failinitdata/failinitdata.pro similarity index 100% rename from tests/auto/selftests/failinitdata/failinitdata.pro rename to tests/auto/testlib/selftests/failinitdata/failinitdata.pro diff --git a/tests/auto/selftests/failinitdata/tst_failinitdata.cpp b/tests/auto/testlib/selftests/failinitdata/tst_failinitdata.cpp similarity index 100% rename from tests/auto/selftests/failinitdata/tst_failinitdata.cpp rename to tests/auto/testlib/selftests/failinitdata/tst_failinitdata.cpp diff --git a/tests/auto/selftests/fetchbogus/fetchbogus.pro b/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro similarity index 100% rename from tests/auto/selftests/fetchbogus/fetchbogus.pro rename to tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro diff --git a/tests/auto/selftests/fetchbogus/tst_fetchbogus.cpp b/tests/auto/testlib/selftests/fetchbogus/tst_fetchbogus.cpp similarity index 100% rename from tests/auto/selftests/fetchbogus/tst_fetchbogus.cpp rename to tests/auto/testlib/selftests/fetchbogus/tst_fetchbogus.cpp diff --git a/tests/auto/selftests/globaldata/globaldata.pro b/tests/auto/testlib/selftests/globaldata/globaldata.pro similarity index 100% rename from tests/auto/selftests/globaldata/globaldata.pro rename to tests/auto/testlib/selftests/globaldata/globaldata.pro diff --git a/tests/auto/selftests/globaldata/tst_globaldata.cpp b/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp similarity index 100% rename from tests/auto/selftests/globaldata/tst_globaldata.cpp rename to tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp diff --git a/tests/auto/selftests/longstring/longstring.pro b/tests/auto/testlib/selftests/longstring/longstring.pro similarity index 100% rename from tests/auto/selftests/longstring/longstring.pro rename to tests/auto/testlib/selftests/longstring/longstring.pro diff --git a/tests/auto/selftests/longstring/tst_longstring.cpp b/tests/auto/testlib/selftests/longstring/tst_longstring.cpp similarity index 100% rename from tests/auto/selftests/longstring/tst_longstring.cpp rename to tests/auto/testlib/selftests/longstring/tst_longstring.cpp diff --git a/tests/auto/selftests/maxwarnings/maxwarnings.cpp b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.cpp similarity index 100% rename from tests/auto/selftests/maxwarnings/maxwarnings.cpp rename to tests/auto/testlib/selftests/maxwarnings/maxwarnings.cpp diff --git a/tests/auto/selftests/maxwarnings/maxwarnings.pro b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro similarity index 100% rename from tests/auto/selftests/maxwarnings/maxwarnings.pro rename to tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro diff --git a/tests/auto/selftests/multiexec/multiexec.pro b/tests/auto/testlib/selftests/multiexec/multiexec.pro similarity index 100% rename from tests/auto/selftests/multiexec/multiexec.pro rename to tests/auto/testlib/selftests/multiexec/multiexec.pro diff --git a/tests/auto/selftests/multiexec/tst_multiexec.cpp b/tests/auto/testlib/selftests/multiexec/tst_multiexec.cpp similarity index 100% rename from tests/auto/selftests/multiexec/tst_multiexec.cpp rename to tests/auto/testlib/selftests/multiexec/tst_multiexec.cpp diff --git a/tests/auto/selftests/qexecstringlist/qexecstringlist.pro b/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro similarity index 100% rename from tests/auto/selftests/qexecstringlist/qexecstringlist.pro rename to tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro diff --git a/tests/auto/selftests/qexecstringlist/tst_qexecstringlist.cpp b/tests/auto/testlib/selftests/qexecstringlist/tst_qexecstringlist.cpp similarity index 100% rename from tests/auto/selftests/qexecstringlist/tst_qexecstringlist.cpp rename to tests/auto/testlib/selftests/qexecstringlist/tst_qexecstringlist.cpp diff --git a/tests/auto/selftests/selftests.pro b/tests/auto/testlib/selftests/selftests.pro similarity index 100% rename from tests/auto/selftests/selftests.pro rename to tests/auto/testlib/selftests/selftests.pro diff --git a/tests/auto/selftests/selftests.qrc b/tests/auto/testlib/selftests/selftests.qrc similarity index 100% rename from tests/auto/selftests/selftests.qrc rename to tests/auto/testlib/selftests/selftests.qrc diff --git a/tests/auto/selftests/singleskip/singleskip.pro b/tests/auto/testlib/selftests/singleskip/singleskip.pro similarity index 100% rename from tests/auto/selftests/singleskip/singleskip.pro rename to tests/auto/testlib/selftests/singleskip/singleskip.pro diff --git a/tests/auto/selftests/singleskip/tst_singleskip.cpp b/tests/auto/testlib/selftests/singleskip/tst_singleskip.cpp similarity index 100% rename from tests/auto/selftests/singleskip/tst_singleskip.cpp rename to tests/auto/testlib/selftests/singleskip/tst_singleskip.cpp diff --git a/tests/auto/selftests/skip/skip.pro b/tests/auto/testlib/selftests/skip/skip.pro similarity index 100% rename from tests/auto/selftests/skip/skip.pro rename to tests/auto/testlib/selftests/skip/skip.pro diff --git a/tests/auto/selftests/skip/tst_skip.cpp b/tests/auto/testlib/selftests/skip/tst_skip.cpp similarity index 100% rename from tests/auto/selftests/skip/tst_skip.cpp rename to tests/auto/testlib/selftests/skip/tst_skip.cpp diff --git a/tests/auto/selftests/skipglobal/skipglobal.pro b/tests/auto/testlib/selftests/skipglobal/skipglobal.pro similarity index 100% rename from tests/auto/selftests/skipglobal/skipglobal.pro rename to tests/auto/testlib/selftests/skipglobal/skipglobal.pro diff --git a/tests/auto/selftests/skipglobal/tst_skipglobal.cpp b/tests/auto/testlib/selftests/skipglobal/tst_skipglobal.cpp similarity index 100% rename from tests/auto/selftests/skipglobal/tst_skipglobal.cpp rename to tests/auto/testlib/selftests/skipglobal/tst_skipglobal.cpp diff --git a/tests/auto/selftests/skipinit/skipinit.pro b/tests/auto/testlib/selftests/skipinit/skipinit.pro similarity index 100% rename from tests/auto/selftests/skipinit/skipinit.pro rename to tests/auto/testlib/selftests/skipinit/skipinit.pro diff --git a/tests/auto/selftests/skipinit/tst_skipinit.cpp b/tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp similarity index 100% rename from tests/auto/selftests/skipinit/tst_skipinit.cpp rename to tests/auto/testlib/selftests/skipinit/tst_skipinit.cpp diff --git a/tests/auto/selftests/skipinitdata/skipinitdata.pro b/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro similarity index 100% rename from tests/auto/selftests/skipinitdata/skipinitdata.pro rename to tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro diff --git a/tests/auto/selftests/skipinitdata/tst_skipinitdata.cpp b/tests/auto/testlib/selftests/skipinitdata/tst_skipinitdata.cpp similarity index 100% rename from tests/auto/selftests/skipinitdata/tst_skipinitdata.cpp rename to tests/auto/testlib/selftests/skipinitdata/tst_skipinitdata.cpp diff --git a/tests/auto/selftests/sleep/sleep.pro b/tests/auto/testlib/selftests/sleep/sleep.pro similarity index 100% rename from tests/auto/selftests/sleep/sleep.pro rename to tests/auto/testlib/selftests/sleep/sleep.pro diff --git a/tests/auto/selftests/sleep/tst_sleep.cpp b/tests/auto/testlib/selftests/sleep/tst_sleep.cpp similarity index 100% rename from tests/auto/selftests/sleep/tst_sleep.cpp rename to tests/auto/testlib/selftests/sleep/tst_sleep.cpp diff --git a/tests/auto/selftests/strcmp/strcmp.pro b/tests/auto/testlib/selftests/strcmp/strcmp.pro similarity index 100% rename from tests/auto/selftests/strcmp/strcmp.pro rename to tests/auto/testlib/selftests/strcmp/strcmp.pro diff --git a/tests/auto/selftests/strcmp/tst_strcmp.cpp b/tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp similarity index 100% rename from tests/auto/selftests/strcmp/tst_strcmp.cpp rename to tests/auto/testlib/selftests/strcmp/tst_strcmp.cpp diff --git a/tests/auto/selftests/subtest/subtest.pro b/tests/auto/testlib/selftests/subtest/subtest.pro similarity index 100% rename from tests/auto/selftests/subtest/subtest.pro rename to tests/auto/testlib/selftests/subtest/subtest.pro diff --git a/tests/auto/selftests/subtest/tst_subtest.cpp b/tests/auto/testlib/selftests/subtest/tst_subtest.cpp similarity index 100% rename from tests/auto/selftests/subtest/tst_subtest.cpp rename to tests/auto/testlib/selftests/subtest/tst_subtest.cpp diff --git a/tests/auto/selftests/test/test.pro b/tests/auto/testlib/selftests/test/test.pro similarity index 86% rename from tests/auto/selftests/test/test.pro rename to tests/auto/testlib/selftests/test/test.pro index f0e0f7593c0..af3370bac03 100644 --- a/tests/auto/selftests/test/test.pro +++ b/tests/auto/testlib/selftests/test/test.pro @@ -14,4 +14,4 @@ win32 { RESOURCES += ../selftests.qrc - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp similarity index 100% rename from tests/auto/selftests/tst_selftests.cpp rename to tests/auto/testlib/selftests/tst_selftests.cpp diff --git a/tests/auto/selftests/waitwithoutgui/tst_waitwithoutgui.cpp b/tests/auto/testlib/selftests/waitwithoutgui/tst_waitwithoutgui.cpp similarity index 100% rename from tests/auto/selftests/waitwithoutgui/tst_waitwithoutgui.cpp rename to tests/auto/testlib/selftests/waitwithoutgui/tst_waitwithoutgui.cpp diff --git a/tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro b/tests/auto/testlib/selftests/waitwithoutgui/waitwithoutgui.pro similarity index 100% rename from tests/auto/selftests/waitwithoutgui/waitwithoutgui.pro rename to tests/auto/testlib/selftests/waitwithoutgui/waitwithoutgui.pro diff --git a/tests/auto/selftests/warnings/tst_warnings.cpp b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp similarity index 100% rename from tests/auto/selftests/warnings/tst_warnings.cpp rename to tests/auto/testlib/selftests/warnings/tst_warnings.cpp diff --git a/tests/auto/selftests/warnings/warnings.pro b/tests/auto/testlib/selftests/warnings/warnings.pro similarity index 100% rename from tests/auto/selftests/warnings/warnings.pro rename to tests/auto/testlib/selftests/warnings/warnings.pro diff --git a/tests/auto/selftests/xunit/tst_xunit.cpp b/tests/auto/testlib/selftests/xunit/tst_xunit.cpp similarity index 100% rename from tests/auto/selftests/xunit/tst_xunit.cpp rename to tests/auto/testlib/selftests/xunit/tst_xunit.cpp diff --git a/tests/auto/selftests/xunit/xunit.pro b/tests/auto/testlib/selftests/xunit/xunit.pro similarity index 100% rename from tests/auto/selftests/xunit/xunit.pro rename to tests/auto/testlib/selftests/xunit/xunit.pro diff --git a/tests/auto/testlib/testlib.pro b/tests/auto/testlib/testlib.pro new file mode 100644 index 00000000000..3a66f8cc6c6 --- /dev/null +++ b/tests/auto/testlib/testlib.pro @@ -0,0 +1,5 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qsignalspy \ + selftests \ + diff --git a/tests/auto/moc/.gitattributes b/tests/auto/tools/moc/.gitattributes similarity index 100% rename from tests/auto/moc/.gitattributes rename to tests/auto/tools/moc/.gitattributes diff --git a/tests/auto/moc/.gitignore b/tests/auto/tools/moc/.gitignore similarity index 100% rename from tests/auto/moc/.gitignore rename to tests/auto/tools/moc/.gitignore diff --git a/tests/auto/moc/Header b/tests/auto/tools/moc/Header similarity index 100% rename from tests/auto/moc/Header rename to tests/auto/tools/moc/Header diff --git a/tests/auto/moc/Test.framework/Headers/testinterface.h b/tests/auto/tools/moc/Test.framework/Headers/testinterface.h similarity index 100% rename from tests/auto/moc/Test.framework/Headers/testinterface.h rename to tests/auto/tools/moc/Test.framework/Headers/testinterface.h diff --git a/tests/auto/moc/assign-namespace.h b/tests/auto/tools/moc/assign-namespace.h similarity index 100% rename from tests/auto/moc/assign-namespace.h rename to tests/auto/tools/moc/assign-namespace.h diff --git a/tests/auto/moc/backslash-newlines.h b/tests/auto/tools/moc/backslash-newlines.h similarity index 100% rename from tests/auto/moc/backslash-newlines.h rename to tests/auto/tools/moc/backslash-newlines.h diff --git a/tests/auto/moc/c-comments.h b/tests/auto/tools/moc/c-comments.h similarity index 100% rename from tests/auto/moc/c-comments.h rename to tests/auto/tools/moc/c-comments.h diff --git a/tests/auto/moc/cstyle-enums.h b/tests/auto/tools/moc/cstyle-enums.h similarity index 100% rename from tests/auto/moc/cstyle-enums.h rename to tests/auto/tools/moc/cstyle-enums.h diff --git a/tests/auto/moc/dir-in-include-path.h b/tests/auto/tools/moc/dir-in-include-path.h similarity index 100% rename from tests/auto/moc/dir-in-include-path.h rename to tests/auto/tools/moc/dir-in-include-path.h diff --git a/tests/auto/moc/error-on-wrong-notify.h b/tests/auto/tools/moc/error-on-wrong-notify.h similarity index 100% rename from tests/auto/moc/error-on-wrong-notify.h rename to tests/auto/tools/moc/error-on-wrong-notify.h diff --git a/tests/auto/moc/escapes-in-string-literals.h b/tests/auto/tools/moc/escapes-in-string-literals.h similarity index 100% rename from tests/auto/moc/escapes-in-string-literals.h rename to tests/auto/tools/moc/escapes-in-string-literals.h diff --git a/tests/auto/moc/extraqualification.h b/tests/auto/tools/moc/extraqualification.h similarity index 100% rename from tests/auto/moc/extraqualification.h rename to tests/auto/tools/moc/extraqualification.h diff --git a/tests/auto/moc/forgotten-qinterface.h b/tests/auto/tools/moc/forgotten-qinterface.h similarity index 100% rename from tests/auto/moc/forgotten-qinterface.h rename to tests/auto/tools/moc/forgotten-qinterface.h diff --git a/tests/auto/moc/gadgetwithnoenums.h b/tests/auto/tools/moc/gadgetwithnoenums.h similarity index 100% rename from tests/auto/moc/gadgetwithnoenums.h rename to tests/auto/tools/moc/gadgetwithnoenums.h diff --git a/tests/auto/moc/interface-from-framework.h b/tests/auto/tools/moc/interface-from-framework.h similarity index 100% rename from tests/auto/moc/interface-from-framework.h rename to tests/auto/tools/moc/interface-from-framework.h diff --git a/tests/auto/moc/macro-on-cmdline.h b/tests/auto/tools/moc/macro-on-cmdline.h similarity index 100% rename from tests/auto/moc/macro-on-cmdline.h rename to tests/auto/tools/moc/macro-on-cmdline.h diff --git a/tests/auto/moc/moc.pro b/tests/auto/tools/moc/moc.pro similarity index 95% rename from tests/auto/moc/moc.pro rename to tests/auto/tools/moc/moc.pro index 056c6b09589..f91c2f5b853 100644 --- a/tests/auto/moc/moc.pro +++ b/tests/auto/tools/moc/moc.pro @@ -26,3 +26,4 @@ contains(QT_CONFIG, dbus){ QT += dbus } +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/moc/namespaced-flags.h b/tests/auto/tools/moc/namespaced-flags.h similarity index 100% rename from tests/auto/moc/namespaced-flags.h rename to tests/auto/tools/moc/namespaced-flags.h diff --git a/tests/auto/moc/no-keywords.h b/tests/auto/tools/moc/no-keywords.h similarity index 100% rename from tests/auto/moc/no-keywords.h rename to tests/auto/tools/moc/no-keywords.h diff --git a/tests/auto/moc/oldstyle-casts.h b/tests/auto/tools/moc/oldstyle-casts.h similarity index 100% rename from tests/auto/moc/oldstyle-casts.h rename to tests/auto/tools/moc/oldstyle-casts.h diff --git a/tests/auto/moc/os9-newlines.h b/tests/auto/tools/moc/os9-newlines.h similarity index 100% rename from tests/auto/moc/os9-newlines.h rename to tests/auto/tools/moc/os9-newlines.h diff --git a/tests/auto/moc/parse-boost.h b/tests/auto/tools/moc/parse-boost.h similarity index 100% rename from tests/auto/moc/parse-boost.h rename to tests/auto/tools/moc/parse-boost.h diff --git a/tests/auto/moc/pure-virtual-signals.h b/tests/auto/tools/moc/pure-virtual-signals.h similarity index 100% rename from tests/auto/moc/pure-virtual-signals.h rename to tests/auto/tools/moc/pure-virtual-signals.h diff --git a/tests/auto/moc/qinvokable.h b/tests/auto/tools/moc/qinvokable.h similarity index 100% rename from tests/auto/moc/qinvokable.h rename to tests/auto/tools/moc/qinvokable.h diff --git a/tests/auto/moc/qprivateslots.h b/tests/auto/tools/moc/qprivateslots.h similarity index 100% rename from tests/auto/moc/qprivateslots.h rename to tests/auto/tools/moc/qprivateslots.h diff --git a/tests/auto/moc/single_function_keyword.h b/tests/auto/tools/moc/single_function_keyword.h similarity index 100% rename from tests/auto/moc/single_function_keyword.h rename to tests/auto/tools/moc/single_function_keyword.h diff --git a/tests/auto/moc/slots-with-void-template.h b/tests/auto/tools/moc/slots-with-void-template.h similarity index 100% rename from tests/auto/moc/slots-with-void-template.h rename to tests/auto/tools/moc/slots-with-void-template.h diff --git a/tests/auto/moc/task189996.h b/tests/auto/tools/moc/task189996.h similarity index 100% rename from tests/auto/moc/task189996.h rename to tests/auto/tools/moc/task189996.h diff --git a/tests/auto/moc/task192552.h b/tests/auto/tools/moc/task192552.h similarity index 100% rename from tests/auto/moc/task192552.h rename to tests/auto/tools/moc/task192552.h diff --git a/tests/auto/moc/task234909.h b/tests/auto/tools/moc/task234909.h similarity index 100% rename from tests/auto/moc/task234909.h rename to tests/auto/tools/moc/task234909.h diff --git a/tests/auto/moc/task240368.h b/tests/auto/tools/moc/task240368.h similarity index 100% rename from tests/auto/moc/task240368.h rename to tests/auto/tools/moc/task240368.h diff --git a/tests/auto/qdiriterator/entrylist/directory/dummy b/tests/auto/tools/moc/task71021/dummy similarity index 100% rename from tests/auto/qdiriterator/entrylist/directory/dummy rename to tests/auto/tools/moc/task71021/dummy diff --git a/tests/auto/moc/task87883.h b/tests/auto/tools/moc/task87883.h similarity index 100% rename from tests/auto/moc/task87883.h rename to tests/auto/tools/moc/task87883.h diff --git a/tests/auto/moc/template-gtgt.h b/tests/auto/tools/moc/template-gtgt.h similarity index 100% rename from tests/auto/moc/template-gtgt.h rename to tests/auto/tools/moc/template-gtgt.h diff --git a/tests/auto/moc/testproject/Plugin/Plugin.h b/tests/auto/tools/moc/testproject/Plugin/Plugin.h similarity index 100% rename from tests/auto/moc/testproject/Plugin/Plugin.h rename to tests/auto/tools/moc/testproject/Plugin/Plugin.h diff --git a/tests/auto/moc/testproject/include/Plugin b/tests/auto/tools/moc/testproject/include/Plugin similarity index 100% rename from tests/auto/moc/testproject/include/Plugin rename to tests/auto/tools/moc/testproject/include/Plugin diff --git a/tests/auto/moc/trigraphs.h b/tests/auto/tools/moc/trigraphs.h similarity index 100% rename from tests/auto/moc/trigraphs.h rename to tests/auto/tools/moc/trigraphs.h diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp similarity index 100% rename from tests/auto/moc/tst_moc.cpp rename to tests/auto/tools/moc/tst_moc.cpp diff --git a/tests/auto/moc/using-namespaces.h b/tests/auto/tools/moc/using-namespaces.h similarity index 100% rename from tests/auto/moc/using-namespaces.h rename to tests/auto/tools/moc/using-namespaces.h diff --git a/tests/auto/moc/warn-on-multiple-qobject-subclasses.h b/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h similarity index 100% rename from tests/auto/moc/warn-on-multiple-qobject-subclasses.h rename to tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h diff --git a/tests/auto/moc/warn-on-property-without-read.h b/tests/auto/tools/moc/warn-on-property-without-read.h similarity index 100% rename from tests/auto/moc/warn-on-property-without-read.h rename to tests/auto/tools/moc/warn-on-property-without-read.h diff --git a/tests/auto/moc/win-newlines.h b/tests/auto/tools/moc/win-newlines.h similarity index 100% rename from tests/auto/moc/win-newlines.h rename to tests/auto/tools/moc/win-newlines.h diff --git a/tests/auto/qmake/.gitignore b/tests/auto/tools/qmake/.gitignore similarity index 100% rename from tests/auto/qmake/.gitignore rename to tests/auto/tools/qmake/.gitignore diff --git a/tests/auto/qmake/qmake.pro b/tests/auto/tools/qmake/qmake.pro similarity index 76% rename from tests/auto/qmake/qmake.pro rename to tests/auto/tools/qmake/qmake.pro index d0faa872b87..40cf5a81b68 100644 --- a/tests/auto/qmake/qmake.pro +++ b/tests/auto/tools/qmake/qmake.pro @@ -5,4 +5,4 @@ QT -= gui cross_compile: DEFINES += QMAKE_CROSS_COMPILED - +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/tools/qmake/testcompiler.cpp similarity index 100% rename from tests/auto/qmake/testcompiler.cpp rename to tests/auto/tools/qmake/testcompiler.cpp diff --git a/tests/auto/qmake/testcompiler.h b/tests/auto/tools/qmake/testcompiler.h similarity index 100% rename from tests/auto/qmake/testcompiler.h rename to tests/auto/tools/qmake/testcompiler.h diff --git a/tests/auto/qmake/testdata/bundle-spaces/bundle-spaces.pro b/tests/auto/tools/qmake/testdata/bundle-spaces/bundle-spaces.pro similarity index 100% rename from tests/auto/qmake/testdata/bundle-spaces/bundle-spaces.pro rename to tests/auto/tools/qmake/testdata/bundle-spaces/bundle-spaces.pro diff --git a/tests/auto/qmake/testdata/bundle-spaces/existing file b/tests/auto/tools/qmake/testdata/bundle-spaces/existing file similarity index 100% rename from tests/auto/qmake/testdata/bundle-spaces/existing file rename to tests/auto/tools/qmake/testdata/bundle-spaces/existing file diff --git a/tests/auto/qmake/testdata/bundle-spaces/main.cpp b/tests/auto/tools/qmake/testdata/bundle-spaces/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/bundle-spaces/main.cpp rename to tests/auto/tools/qmake/testdata/bundle-spaces/main.cpp diff --git a/tests/auto/qmake/testdata/bundle-spaces/some-file b/tests/auto/tools/qmake/testdata/bundle-spaces/some-file similarity index 100% rename from tests/auto/qmake/testdata/bundle-spaces/some-file rename to tests/auto/tools/qmake/testdata/bundle-spaces/some-file diff --git a/tests/auto/qmake/testdata/comments/comments.pro b/tests/auto/tools/qmake/testdata/comments/comments.pro similarity index 100% rename from tests/auto/qmake/testdata/comments/comments.pro rename to tests/auto/tools/qmake/testdata/comments/comments.pro diff --git a/tests/auto/qmake/testdata/duplicateLibraryEntries/duplib.pro b/tests/auto/tools/qmake/testdata/duplicateLibraryEntries/duplib.pro similarity index 100% rename from tests/auto/qmake/testdata/duplicateLibraryEntries/duplib.pro rename to tests/auto/tools/qmake/testdata/duplicateLibraryEntries/duplib.pro diff --git a/tests/auto/qmake/testdata/export_across_file_boundaries/.qmake.cache b/tests/auto/tools/qmake/testdata/export_across_file_boundaries/.qmake.cache similarity index 100% rename from tests/auto/qmake/testdata/export_across_file_boundaries/.qmake.cache rename to tests/auto/tools/qmake/testdata/export_across_file_boundaries/.qmake.cache diff --git a/tests/auto/qmake/testdata/export_across_file_boundaries/features/default_pre.prf b/tests/auto/tools/qmake/testdata/export_across_file_boundaries/features/default_pre.prf similarity index 100% rename from tests/auto/qmake/testdata/export_across_file_boundaries/features/default_pre.prf rename to tests/auto/tools/qmake/testdata/export_across_file_boundaries/features/default_pre.prf diff --git a/tests/auto/qmake/testdata/export_across_file_boundaries/foo.pro b/tests/auto/tools/qmake/testdata/export_across_file_boundaries/foo.pro similarity index 100% rename from tests/auto/qmake/testdata/export_across_file_boundaries/foo.pro rename to tests/auto/tools/qmake/testdata/export_across_file_boundaries/foo.pro diff --git a/tests/auto/qmake/testdata/export_across_file_boundaries/oink.pri b/tests/auto/tools/qmake/testdata/export_across_file_boundaries/oink.pri similarity index 100% rename from tests/auto/qmake/testdata/export_across_file_boundaries/oink.pri rename to tests/auto/tools/qmake/testdata/export_across_file_boundaries/oink.pri diff --git a/tests/auto/qmake/testdata/findDeps/findDeps.pro b/tests/auto/tools/qmake/testdata/findDeps/findDeps.pro similarity index 100% rename from tests/auto/qmake/testdata/findDeps/findDeps.pro rename to tests/auto/tools/qmake/testdata/findDeps/findDeps.pro diff --git a/tests/auto/qmake/testdata/findDeps/main.cpp b/tests/auto/tools/qmake/testdata/findDeps/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/findDeps/main.cpp rename to tests/auto/tools/qmake/testdata/findDeps/main.cpp diff --git a/tests/auto/qmake/testdata/findDeps/object1.h b/tests/auto/tools/qmake/testdata/findDeps/object1.h similarity index 100% rename from tests/auto/qmake/testdata/findDeps/object1.h rename to tests/auto/tools/qmake/testdata/findDeps/object1.h diff --git a/tests/auto/qmake/testdata/findDeps/object2.h b/tests/auto/tools/qmake/testdata/findDeps/object2.h similarity index 100% rename from tests/auto/qmake/testdata/findDeps/object2.h rename to tests/auto/tools/qmake/testdata/findDeps/object2.h diff --git a/tests/auto/qmake/testdata/findDeps/object3.h b/tests/auto/tools/qmake/testdata/findDeps/object3.h similarity index 100% rename from tests/auto/qmake/testdata/findDeps/object3.h rename to tests/auto/tools/qmake/testdata/findDeps/object3.h diff --git a/tests/auto/qmake/testdata/findDeps/object4.h b/tests/auto/tools/qmake/testdata/findDeps/object4.h similarity index 100% rename from tests/auto/qmake/testdata/findDeps/object4.h rename to tests/auto/tools/qmake/testdata/findDeps/object4.h diff --git a/tests/auto/qmake/testdata/findDeps/object5.h b/tests/auto/tools/qmake/testdata/findDeps/object5.h similarity index 100% rename from tests/auto/qmake/testdata/findDeps/object5.h rename to tests/auto/tools/qmake/testdata/findDeps/object5.h diff --git a/tests/auto/qmake/testdata/findDeps/object6.h b/tests/auto/tools/qmake/testdata/findDeps/object6.h similarity index 100% rename from tests/auto/qmake/testdata/findDeps/object6.h rename to tests/auto/tools/qmake/testdata/findDeps/object6.h diff --git a/tests/auto/qmake/testdata/findDeps/object7.h b/tests/auto/tools/qmake/testdata/findDeps/object7.h similarity index 100% rename from tests/auto/qmake/testdata/findDeps/object7.h rename to tests/auto/tools/qmake/testdata/findDeps/object7.h diff --git a/tests/auto/qmake/testdata/findDeps/object8.h b/tests/auto/tools/qmake/testdata/findDeps/object8.h similarity index 100% rename from tests/auto/qmake/testdata/findDeps/object8.h rename to tests/auto/tools/qmake/testdata/findDeps/object8.h diff --git a/tests/auto/qmake/testdata/findDeps/object9.h b/tests/auto/tools/qmake/testdata/findDeps/object9.h similarity index 100% rename from tests/auto/qmake/testdata/findDeps/object9.h rename to tests/auto/tools/qmake/testdata/findDeps/object9.h diff --git a/tests/auto/qmake/testdata/findMocs/findMocs.pro b/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro similarity index 100% rename from tests/auto/qmake/testdata/findMocs/findMocs.pro rename to tests/auto/tools/qmake/testdata/findMocs/findMocs.pro diff --git a/tests/auto/qmake/testdata/findMocs/main.cpp b/tests/auto/tools/qmake/testdata/findMocs/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/findMocs/main.cpp rename to tests/auto/tools/qmake/testdata/findMocs/main.cpp diff --git a/tests/auto/qmake/testdata/findMocs/object1.h b/tests/auto/tools/qmake/testdata/findMocs/object1.h similarity index 100% rename from tests/auto/qmake/testdata/findMocs/object1.h rename to tests/auto/tools/qmake/testdata/findMocs/object1.h diff --git a/tests/auto/qmake/testdata/findMocs/object2.h b/tests/auto/tools/qmake/testdata/findMocs/object2.h similarity index 100% rename from tests/auto/qmake/testdata/findMocs/object2.h rename to tests/auto/tools/qmake/testdata/findMocs/object2.h diff --git a/tests/auto/qmake/testdata/findMocs/object3.h b/tests/auto/tools/qmake/testdata/findMocs/object3.h similarity index 100% rename from tests/auto/qmake/testdata/findMocs/object3.h rename to tests/auto/tools/qmake/testdata/findMocs/object3.h diff --git a/tests/auto/qmake/testdata/findMocs/object4.h b/tests/auto/tools/qmake/testdata/findMocs/object4.h similarity index 100% rename from tests/auto/qmake/testdata/findMocs/object4.h rename to tests/auto/tools/qmake/testdata/findMocs/object4.h diff --git a/tests/auto/qmake/testdata/findMocs/object5.h b/tests/auto/tools/qmake/testdata/findMocs/object5.h similarity index 100% rename from tests/auto/qmake/testdata/findMocs/object5.h rename to tests/auto/tools/qmake/testdata/findMocs/object5.h diff --git a/tests/auto/qmake/testdata/findMocs/object6.h b/tests/auto/tools/qmake/testdata/findMocs/object6.h similarity index 100% rename from tests/auto/qmake/testdata/findMocs/object6.h rename to tests/auto/tools/qmake/testdata/findMocs/object6.h diff --git a/tests/auto/qmake/testdata/findMocs/object7.h b/tests/auto/tools/qmake/testdata/findMocs/object7.h similarity index 100% rename from tests/auto/qmake/testdata/findMocs/object7.h rename to tests/auto/tools/qmake/testdata/findMocs/object7.h diff --git a/tests/auto/qmake/testdata/func_export/func_export.pro b/tests/auto/tools/qmake/testdata/func_export/func_export.pro similarity index 100% rename from tests/auto/qmake/testdata/func_export/func_export.pro rename to tests/auto/tools/qmake/testdata/func_export/func_export.pro diff --git a/tests/auto/qmake/testdata/func_variables/func_variables.pro b/tests/auto/tools/qmake/testdata/func_variables/func_variables.pro similarity index 100% rename from tests/auto/qmake/testdata/func_variables/func_variables.pro rename to tests/auto/tools/qmake/testdata/func_variables/func_variables.pro diff --git a/tests/auto/qmake/testdata/functions/1.cpp b/tests/auto/tools/qmake/testdata/functions/1.cpp similarity index 100% rename from tests/auto/qmake/testdata/functions/1.cpp rename to tests/auto/tools/qmake/testdata/functions/1.cpp diff --git a/tests/auto/qmake/testdata/functions/2.cpp b/tests/auto/tools/qmake/testdata/functions/2.cpp similarity index 100% rename from tests/auto/qmake/testdata/functions/2.cpp rename to tests/auto/tools/qmake/testdata/functions/2.cpp diff --git a/tests/auto/qmake/testdata/functions/functions.pro b/tests/auto/tools/qmake/testdata/functions/functions.pro similarity index 100% rename from tests/auto/qmake/testdata/functions/functions.pro rename to tests/auto/tools/qmake/testdata/functions/functions.pro diff --git a/tests/auto/qmake/testdata/functions/infiletest.pro b/tests/auto/tools/qmake/testdata/functions/infiletest.pro similarity index 100% rename from tests/auto/qmake/testdata/functions/infiletest.pro rename to tests/auto/tools/qmake/testdata/functions/infiletest.pro diff --git a/tests/auto/qmake/testdata/functions/one/1.cpp b/tests/auto/tools/qmake/testdata/functions/one/1.cpp similarity index 100% rename from tests/auto/qmake/testdata/functions/one/1.cpp rename to tests/auto/tools/qmake/testdata/functions/one/1.cpp diff --git a/tests/auto/qmake/testdata/functions/one/2.cpp b/tests/auto/tools/qmake/testdata/functions/one/2.cpp similarity index 100% rename from tests/auto/qmake/testdata/functions/one/2.cpp rename to tests/auto/tools/qmake/testdata/functions/one/2.cpp diff --git a/tests/auto/qmake/testdata/functions/three/wildcard21.cpp b/tests/auto/tools/qmake/testdata/functions/three/wildcard21.cpp similarity index 100% rename from tests/auto/qmake/testdata/functions/three/wildcard21.cpp rename to tests/auto/tools/qmake/testdata/functions/three/wildcard21.cpp diff --git a/tests/auto/qmake/testdata/functions/three/wildcard22.cpp b/tests/auto/tools/qmake/testdata/functions/three/wildcard22.cpp similarity index 100% rename from tests/auto/qmake/testdata/functions/three/wildcard22.cpp rename to tests/auto/tools/qmake/testdata/functions/three/wildcard22.cpp diff --git a/tests/auto/qmake/testdata/functions/two/1.cpp b/tests/auto/tools/qmake/testdata/functions/two/1.cpp similarity index 100% rename from tests/auto/qmake/testdata/functions/two/1.cpp rename to tests/auto/tools/qmake/testdata/functions/two/1.cpp diff --git a/tests/auto/qmake/testdata/functions/two/2.cpp b/tests/auto/tools/qmake/testdata/functions/two/2.cpp similarity index 100% rename from tests/auto/qmake/testdata/functions/two/2.cpp rename to tests/auto/tools/qmake/testdata/functions/two/2.cpp diff --git a/tests/auto/qmake/testdata/functions/wildcard21.cpp b/tests/auto/tools/qmake/testdata/functions/wildcard21.cpp similarity index 100% rename from tests/auto/qmake/testdata/functions/wildcard21.cpp rename to tests/auto/tools/qmake/testdata/functions/wildcard21.cpp diff --git a/tests/auto/qmake/testdata/functions/wildcard22.cpp b/tests/auto/tools/qmake/testdata/functions/wildcard22.cpp similarity index 100% rename from tests/auto/qmake/testdata/functions/wildcard22.cpp rename to tests/auto/tools/qmake/testdata/functions/wildcard22.cpp diff --git a/tests/auto/qmake/testdata/include_dir/foo.pro b/tests/auto/tools/qmake/testdata/include_dir/foo.pro similarity index 100% rename from tests/auto/qmake/testdata/include_dir/foo.pro rename to tests/auto/tools/qmake/testdata/include_dir/foo.pro diff --git a/tests/auto/qmake/testdata/include_dir/main.cpp b/tests/auto/tools/qmake/testdata/include_dir/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/include_dir/main.cpp rename to tests/auto/tools/qmake/testdata/include_dir/main.cpp diff --git a/tests/auto/qmake/testdata/include_dir/test_file.cpp b/tests/auto/tools/qmake/testdata/include_dir/test_file.cpp similarity index 100% rename from tests/auto/qmake/testdata/include_dir/test_file.cpp rename to tests/auto/tools/qmake/testdata/include_dir/test_file.cpp diff --git a/tests/auto/qmake/testdata/include_dir/test_file.h b/tests/auto/tools/qmake/testdata/include_dir/test_file.h similarity index 100% rename from tests/auto/qmake/testdata/include_dir/test_file.h rename to tests/auto/tools/qmake/testdata/include_dir/test_file.h diff --git a/tests/auto/qmake/testdata/include_dir/untitled.ui b/tests/auto/tools/qmake/testdata/include_dir/untitled.ui similarity index 100% rename from tests/auto/qmake/testdata/include_dir/untitled.ui rename to tests/auto/tools/qmake/testdata/include_dir/untitled.ui diff --git a/tests/auto/qmake/testdata/include_dir_build/README b/tests/auto/tools/qmake/testdata/include_dir_build/README similarity index 100% rename from tests/auto/qmake/testdata/include_dir_build/README rename to tests/auto/tools/qmake/testdata/include_dir_build/README diff --git a/tests/auto/qmake/testdata/include_function/existing_file.pri b/tests/auto/tools/qmake/testdata/include_function/existing_file.pri similarity index 100% rename from tests/auto/qmake/testdata/include_function/existing_file.pri rename to tests/auto/tools/qmake/testdata/include_function/existing_file.pri diff --git a/tests/auto/qmake/testdata/include_function/include_existing_file.pro b/tests/auto/tools/qmake/testdata/include_function/include_existing_file.pro similarity index 100% rename from tests/auto/qmake/testdata/include_function/include_existing_file.pro rename to tests/auto/tools/qmake/testdata/include_function/include_existing_file.pro diff --git a/tests/auto/qmake/testdata/include_function/include_missing_file.pro b/tests/auto/tools/qmake/testdata/include_function/include_missing_file.pro similarity index 100% rename from tests/auto/qmake/testdata/include_function/include_missing_file.pro rename to tests/auto/tools/qmake/testdata/include_function/include_missing_file.pro diff --git a/tests/auto/qmake/testdata/include_function/include_missing_file2.pro b/tests/auto/tools/qmake/testdata/include_function/include_missing_file2.pro similarity index 100% rename from tests/auto/qmake/testdata/include_function/include_missing_file2.pro rename to tests/auto/tools/qmake/testdata/include_function/include_missing_file2.pro diff --git a/tests/auto/qmake/testdata/include_function/main.cpp b/tests/auto/tools/qmake/testdata/include_function/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/include_function/main.cpp rename to tests/auto/tools/qmake/testdata/include_function/main.cpp diff --git a/tests/auto/qmake/testdata/install_depends/foo.pro b/tests/auto/tools/qmake/testdata/install_depends/foo.pro similarity index 100% rename from tests/auto/qmake/testdata/install_depends/foo.pro rename to tests/auto/tools/qmake/testdata/install_depends/foo.pro diff --git a/tests/auto/qmake/testdata/install_depends/main.cpp b/tests/auto/tools/qmake/testdata/install_depends/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/install_depends/main.cpp rename to tests/auto/tools/qmake/testdata/install_depends/main.cpp diff --git a/tests/auto/qmake/testdata/install_depends/test1 b/tests/auto/tools/qmake/testdata/install_depends/test1 similarity index 100% rename from tests/auto/qmake/testdata/install_depends/test1 rename to tests/auto/tools/qmake/testdata/install_depends/test1 diff --git a/tests/auto/qmake/testdata/install_depends/test2 b/tests/auto/tools/qmake/testdata/install_depends/test2 similarity index 100% rename from tests/auto/qmake/testdata/install_depends/test2 rename to tests/auto/tools/qmake/testdata/install_depends/test2 diff --git a/tests/auto/qmake/testdata/install_depends/test_file.cpp b/tests/auto/tools/qmake/testdata/install_depends/test_file.cpp similarity index 100% rename from tests/auto/qmake/testdata/install_depends/test_file.cpp rename to tests/auto/tools/qmake/testdata/install_depends/test_file.cpp diff --git a/tests/auto/qmake/testdata/install_depends/test_file.h b/tests/auto/tools/qmake/testdata/install_depends/test_file.h similarity index 100% rename from tests/auto/qmake/testdata/install_depends/test_file.h rename to tests/auto/tools/qmake/testdata/install_depends/test_file.h diff --git a/tests/auto/qmake/testdata/one_space/main.cpp b/tests/auto/tools/qmake/testdata/one_space/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/one_space/main.cpp rename to tests/auto/tools/qmake/testdata/one_space/main.cpp diff --git a/tests/auto/qmake/testdata/one_space/one_space.pro b/tests/auto/tools/qmake/testdata/one_space/one_space.pro similarity index 100% rename from tests/auto/qmake/testdata/one_space/one_space.pro rename to tests/auto/tools/qmake/testdata/one_space/one_space.pro diff --git a/tests/auto/qmake/testdata/operators/operators.pro b/tests/auto/tools/qmake/testdata/operators/operators.pro similarity index 100% rename from tests/auto/qmake/testdata/operators/operators.pro rename to tests/auto/tools/qmake/testdata/operators/operators.pro diff --git a/tests/auto/qmake/testdata/prompt/prompt.pro b/tests/auto/tools/qmake/testdata/prompt/prompt.pro similarity index 100% rename from tests/auto/qmake/testdata/prompt/prompt.pro rename to tests/auto/tools/qmake/testdata/prompt/prompt.pro diff --git a/tests/auto/qmake/testdata/quotedfilenames/main.cpp b/tests/auto/tools/qmake/testdata/quotedfilenames/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/quotedfilenames/main.cpp rename to tests/auto/tools/qmake/testdata/quotedfilenames/main.cpp diff --git a/tests/auto/qmake/testdata/quotedfilenames/quotedfilenames.pro b/tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro similarity index 100% rename from tests/auto/qmake/testdata/quotedfilenames/quotedfilenames.pro rename to tests/auto/tools/qmake/testdata/quotedfilenames/quotedfilenames.pro diff --git a/tests/auto/qmake/testdata/quotedfilenames/rc folder/logo.png b/tests/auto/tools/qmake/testdata/quotedfilenames/rc folder/logo.png similarity index 100% rename from tests/auto/qmake/testdata/quotedfilenames/rc folder/logo.png rename to tests/auto/tools/qmake/testdata/quotedfilenames/rc folder/logo.png diff --git a/tests/auto/qmake/testdata/quotedfilenames/rc folder/test.qrc b/tests/auto/tools/qmake/testdata/quotedfilenames/rc folder/test.qrc similarity index 100% rename from tests/auto/qmake/testdata/quotedfilenames/rc folder/test.qrc rename to tests/auto/tools/qmake/testdata/quotedfilenames/rc folder/test.qrc diff --git a/tests/auto/qmake/testdata/shadow_files/foo.pro b/tests/auto/tools/qmake/testdata/shadow_files/foo.pro similarity index 100% rename from tests/auto/qmake/testdata/shadow_files/foo.pro rename to tests/auto/tools/qmake/testdata/shadow_files/foo.pro diff --git a/tests/auto/qmake/testdata/shadow_files/main.cpp b/tests/auto/tools/qmake/testdata/shadow_files/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/shadow_files/main.cpp rename to tests/auto/tools/qmake/testdata/shadow_files/main.cpp diff --git a/tests/auto/qmake/testdata/shadow_files/test.txt b/tests/auto/tools/qmake/testdata/shadow_files/test.txt similarity index 100% rename from tests/auto/qmake/testdata/shadow_files/test.txt rename to tests/auto/tools/qmake/testdata/shadow_files/test.txt diff --git a/tests/auto/qmake/testdata/shadow_files/test_file.cpp b/tests/auto/tools/qmake/testdata/shadow_files/test_file.cpp similarity index 100% rename from tests/auto/qmake/testdata/shadow_files/test_file.cpp rename to tests/auto/tools/qmake/testdata/shadow_files/test_file.cpp diff --git a/tests/auto/qmake/testdata/shadow_files/test_file.h b/tests/auto/tools/qmake/testdata/shadow_files/test_file.h similarity index 100% rename from tests/auto/qmake/testdata/shadow_files/test_file.h rename to tests/auto/tools/qmake/testdata/shadow_files/test_file.h diff --git a/tests/auto/qmake/testdata/shadow_files_build/README b/tests/auto/tools/qmake/testdata/shadow_files_build/README similarity index 100% rename from tests/auto/qmake/testdata/shadow_files_build/README rename to tests/auto/tools/qmake/testdata/shadow_files_build/README diff --git a/tests/auto/qmake/testdata/shadow_files_build/foo.bar b/tests/auto/tools/qmake/testdata/shadow_files_build/foo.bar similarity index 100% rename from tests/auto/qmake/testdata/shadow_files_build/foo.bar rename to tests/auto/tools/qmake/testdata/shadow_files_build/foo.bar diff --git a/tests/auto/qmake/testdata/simple_app/build/README b/tests/auto/tools/qmake/testdata/simple_app/build/README similarity index 100% rename from tests/auto/qmake/testdata/simple_app/build/README rename to tests/auto/tools/qmake/testdata/simple_app/build/README diff --git a/tests/auto/qmake/testdata/simple_app/main.cpp b/tests/auto/tools/qmake/testdata/simple_app/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/simple_app/main.cpp rename to tests/auto/tools/qmake/testdata/simple_app/main.cpp diff --git a/tests/auto/qmake/testdata/simple_app/simple_app.pro b/tests/auto/tools/qmake/testdata/simple_app/simple_app.pro similarity index 100% rename from tests/auto/qmake/testdata/simple_app/simple_app.pro rename to tests/auto/tools/qmake/testdata/simple_app/simple_app.pro diff --git a/tests/auto/qmake/testdata/simple_app/test.qrc b/tests/auto/tools/qmake/testdata/simple_app/test.qrc similarity index 100% rename from tests/auto/qmake/testdata/simple_app/test.qrc rename to tests/auto/tools/qmake/testdata/simple_app/test.qrc diff --git a/tests/auto/qmake/testdata/simple_app/test_file.cpp b/tests/auto/tools/qmake/testdata/simple_app/test_file.cpp similarity index 100% rename from tests/auto/qmake/testdata/simple_app/test_file.cpp rename to tests/auto/tools/qmake/testdata/simple_app/test_file.cpp diff --git a/tests/auto/qmake/testdata/simple_app/test_file.h b/tests/auto/tools/qmake/testdata/simple_app/test_file.h similarity index 100% rename from tests/auto/qmake/testdata/simple_app/test_file.h rename to tests/auto/tools/qmake/testdata/simple_app/test_file.h diff --git a/tests/auto/qmake/testdata/simple_app_build/README b/tests/auto/tools/qmake/testdata/simple_app_build/README similarity index 100% rename from tests/auto/qmake/testdata/simple_app_build/README rename to tests/auto/tools/qmake/testdata/simple_app_build/README diff --git a/tests/auto/qmake/testdata/simple_dll/simple.cpp b/tests/auto/tools/qmake/testdata/simple_dll/simple.cpp similarity index 100% rename from tests/auto/qmake/testdata/simple_dll/simple.cpp rename to tests/auto/tools/qmake/testdata/simple_dll/simple.cpp diff --git a/tests/auto/qmake/testdata/simple_dll/simple.h b/tests/auto/tools/qmake/testdata/simple_dll/simple.h similarity index 100% rename from tests/auto/qmake/testdata/simple_dll/simple.h rename to tests/auto/tools/qmake/testdata/simple_dll/simple.h diff --git a/tests/auto/qmake/testdata/simple_dll/simple_dll.pro b/tests/auto/tools/qmake/testdata/simple_dll/simple_dll.pro similarity index 100% rename from tests/auto/qmake/testdata/simple_dll/simple_dll.pro rename to tests/auto/tools/qmake/testdata/simple_dll/simple_dll.pro diff --git a/tests/auto/qmake/testdata/simple_lib/simple.cpp b/tests/auto/tools/qmake/testdata/simple_lib/simple.cpp similarity index 100% rename from tests/auto/qmake/testdata/simple_lib/simple.cpp rename to tests/auto/tools/qmake/testdata/simple_lib/simple.cpp diff --git a/tests/auto/qmake/testdata/simple_lib/simple.h b/tests/auto/tools/qmake/testdata/simple_lib/simple.h similarity index 100% rename from tests/auto/qmake/testdata/simple_lib/simple.h rename to tests/auto/tools/qmake/testdata/simple_lib/simple.h diff --git a/tests/auto/qmake/testdata/simple_lib/simple_lib.pro b/tests/auto/tools/qmake/testdata/simple_lib/simple_lib.pro similarity index 100% rename from tests/auto/qmake/testdata/simple_lib/simple_lib.pro rename to tests/auto/tools/qmake/testdata/simple_lib/simple_lib.pro diff --git a/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/main.cpp b/tests/auto/tools/qmake/testdata/subdir_via_pro_file_extra_target/simple/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/main.cpp rename to tests/auto/tools/qmake/testdata/subdir_via_pro_file_extra_target/simple/main.cpp diff --git a/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/simple.pro b/tests/auto/tools/qmake/testdata/subdir_via_pro_file_extra_target/simple/simple.pro similarity index 100% rename from tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/simple/simple.pro rename to tests/auto/tools/qmake/testdata/subdir_via_pro_file_extra_target/simple/simple.pro diff --git a/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir.pro b/tests/auto/tools/qmake/testdata/subdir_via_pro_file_extra_target/subdir.pro similarity index 100% rename from tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir.pro rename to tests/auto/tools/qmake/testdata/subdir_via_pro_file_extra_target/subdir.pro diff --git a/tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir_via_pro_file_extra_target.pro b/tests/auto/tools/qmake/testdata/subdir_via_pro_file_extra_target/subdir_via_pro_file_extra_target.pro similarity index 100% rename from tests/auto/qmake/testdata/subdir_via_pro_file_extra_target/subdir_via_pro_file_extra_target.pro rename to tests/auto/tools/qmake/testdata/subdir_via_pro_file_extra_target/subdir_via_pro_file_extra_target.pro diff --git a/tests/auto/qmake/testdata/subdirs/simple_app/main.cpp b/tests/auto/tools/qmake/testdata/subdirs/simple_app/main.cpp similarity index 100% rename from tests/auto/qmake/testdata/subdirs/simple_app/main.cpp rename to tests/auto/tools/qmake/testdata/subdirs/simple_app/main.cpp diff --git a/tests/auto/qmake/testdata/subdirs/simple_app/simple_app.pro b/tests/auto/tools/qmake/testdata/subdirs/simple_app/simple_app.pro similarity index 100% rename from tests/auto/qmake/testdata/subdirs/simple_app/simple_app.pro rename to tests/auto/tools/qmake/testdata/subdirs/simple_app/simple_app.pro diff --git a/tests/auto/qmake/testdata/subdirs/simple_app/test_file.cpp b/tests/auto/tools/qmake/testdata/subdirs/simple_app/test_file.cpp similarity index 100% rename from tests/auto/qmake/testdata/subdirs/simple_app/test_file.cpp rename to tests/auto/tools/qmake/testdata/subdirs/simple_app/test_file.cpp diff --git a/tests/auto/qmake/testdata/subdirs/simple_app/test_file.h b/tests/auto/tools/qmake/testdata/subdirs/simple_app/test_file.h similarity index 100% rename from tests/auto/qmake/testdata/subdirs/simple_app/test_file.h rename to tests/auto/tools/qmake/testdata/subdirs/simple_app/test_file.h diff --git a/tests/auto/qmake/testdata/subdirs/simple_dll/simple.cpp b/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple.cpp similarity index 100% rename from tests/auto/qmake/testdata/subdirs/simple_dll/simple.cpp rename to tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple.cpp diff --git a/tests/auto/qmake/testdata/subdirs/simple_dll/simple.h b/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple.h similarity index 100% rename from tests/auto/qmake/testdata/subdirs/simple_dll/simple.h rename to tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple.h diff --git a/tests/auto/qmake/testdata/subdirs/simple_dll/simple_dll.pro b/tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro similarity index 100% rename from tests/auto/qmake/testdata/subdirs/simple_dll/simple_dll.pro rename to tests/auto/tools/qmake/testdata/subdirs/simple_dll/simple_dll.pro diff --git a/tests/auto/qmake/testdata/subdirs/subdirs.pro b/tests/auto/tools/qmake/testdata/subdirs/subdirs.pro similarity index 100% rename from tests/auto/qmake/testdata/subdirs/subdirs.pro rename to tests/auto/tools/qmake/testdata/subdirs/subdirs.pro diff --git a/tests/auto/qmake/testdata/substitutes/sub/test2.in b/tests/auto/tools/qmake/testdata/substitutes/sub/test2.in similarity index 100% rename from tests/auto/qmake/testdata/substitutes/sub/test2.in rename to tests/auto/tools/qmake/testdata/substitutes/sub/test2.in diff --git a/tests/auto/qmake/testdata/substitutes/test.in b/tests/auto/tools/qmake/testdata/substitutes/test.in similarity index 100% rename from tests/auto/qmake/testdata/substitutes/test.in rename to tests/auto/tools/qmake/testdata/substitutes/test.in diff --git a/tests/auto/qmake/testdata/substitutes/test.pro b/tests/auto/tools/qmake/testdata/substitutes/test.pro similarity index 100% rename from tests/auto/qmake/testdata/substitutes/test.pro rename to tests/auto/tools/qmake/testdata/substitutes/test.pro diff --git a/tests/auto/qmake/testdata/substitutes/test3.txt b/tests/auto/tools/qmake/testdata/substitutes/test3.txt similarity index 100% rename from tests/auto/qmake/testdata/substitutes/test3.txt rename to tests/auto/tools/qmake/testdata/substitutes/test3.txt diff --git a/tests/auto/qmake/testdata/substitutes_build/README b/tests/auto/tools/qmake/testdata/substitutes_build/README similarity index 100% rename from tests/auto/qmake/testdata/substitutes_build/README rename to tests/auto/tools/qmake/testdata/substitutes_build/README diff --git a/tests/auto/qmake/testdata/variables/variables.pro b/tests/auto/tools/qmake/testdata/variables/variables.pro similarity index 100% rename from tests/auto/qmake/testdata/variables/variables.pro rename to tests/auto/tools/qmake/testdata/variables/variables.pro diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp similarity index 100% rename from tests/auto/qmake/tst_qmake.cpp rename to tests/auto/tools/qmake/tst_qmake.cpp diff --git a/tests/auto/rcc/.gitignore b/tests/auto/tools/rcc/.gitignore similarity index 100% rename from tests/auto/rcc/.gitignore rename to tests/auto/tools/rcc/.gitignore diff --git a/tests/auto/rcc/data/images.bin.expected b/tests/auto/tools/rcc/data/images.bin.expected similarity index 100% rename from tests/auto/rcc/data/images.bin.expected rename to tests/auto/tools/rcc/data/images.bin.expected diff --git a/tests/auto/rcc/data/images.expected b/tests/auto/tools/rcc/data/images.expected similarity index 100% rename from tests/auto/rcc/data/images.expected rename to tests/auto/tools/rcc/data/images.expected diff --git a/tests/auto/rcc/data/images.qrc b/tests/auto/tools/rcc/data/images.qrc similarity index 100% rename from tests/auto/rcc/data/images.qrc rename to tests/auto/tools/rcc/data/images.qrc diff --git a/tests/auto/rcc/data/images/circle.png b/tests/auto/tools/rcc/data/images/circle.png similarity index 100% rename from tests/auto/rcc/data/images/circle.png rename to tests/auto/tools/rcc/data/images/circle.png diff --git a/tests/auto/rcc/data/images/square.png b/tests/auto/tools/rcc/data/images/square.png similarity index 100% rename from tests/auto/rcc/data/images/square.png rename to tests/auto/tools/rcc/data/images/square.png diff --git a/tests/auto/rcc/data/images/subdir/triangle.png b/tests/auto/tools/rcc/data/images/subdir/triangle.png similarity index 100% rename from tests/auto/rcc/data/images/subdir/triangle.png rename to tests/auto/tools/rcc/data/images/subdir/triangle.png diff --git a/tests/auto/rcc/rcc.pro b/tests/auto/tools/rcc/rcc.pro similarity index 100% rename from tests/auto/rcc/rcc.pro rename to tests/auto/tools/rcc/rcc.pro diff --git a/tests/auto/rcc/tst_rcc.cpp b/tests/auto/tools/rcc/tst_rcc.cpp similarity index 100% rename from tests/auto/rcc/tst_rcc.cpp rename to tests/auto/tools/rcc/tst_rcc.cpp diff --git a/tests/auto/tools/tools.pro b/tests/auto/tools/tools.pro new file mode 100644 index 00000000000..6bf6ddf64f0 --- /dev/null +++ b/tests/auto/tools/tools.pro @@ -0,0 +1,7 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qmake \ + uic \ + moc \ + rcc \ + diff --git a/tests/auto/uic/.gitignore b/tests/auto/tools/uic/.gitignore similarity index 100% rename from tests/auto/uic/.gitignore rename to tests/auto/tools/uic/.gitignore diff --git a/tests/auto/uic/baseline/.gitattributes b/tests/auto/tools/uic/baseline/.gitattributes similarity index 100% rename from tests/auto/uic/baseline/.gitattributes rename to tests/auto/tools/uic/baseline/.gitattributes diff --git a/tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui similarity index 100% rename from tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui rename to tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui diff --git a/tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h similarity index 100% rename from tests/auto/uic/baseline/Dialog_with_Buttons_Bottom.ui.h rename to tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h diff --git a/tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui similarity index 100% rename from tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui rename to tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui diff --git a/tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h similarity index 100% rename from tests/auto/uic/baseline/Dialog_with_Buttons_Right.ui.h rename to tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h diff --git a/tests/auto/uic/baseline/Dialog_without_Buttons.ui b/tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui similarity index 100% rename from tests/auto/uic/baseline/Dialog_without_Buttons.ui rename to tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui diff --git a/tests/auto/uic/baseline/Dialog_without_Buttons.ui.h b/tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h similarity index 100% rename from tests/auto/uic/baseline/Dialog_without_Buttons.ui.h rename to tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h diff --git a/tests/auto/uic/baseline/Main_Window.ui b/tests/auto/tools/uic/baseline/Main_Window.ui similarity index 100% rename from tests/auto/uic/baseline/Main_Window.ui rename to tests/auto/tools/uic/baseline/Main_Window.ui diff --git a/tests/auto/uic/baseline/Main_Window.ui.h b/tests/auto/tools/uic/baseline/Main_Window.ui.h similarity index 100% rename from tests/auto/uic/baseline/Main_Window.ui.h rename to tests/auto/tools/uic/baseline/Main_Window.ui.h diff --git a/tests/auto/uic/baseline/Widget.ui b/tests/auto/tools/uic/baseline/Widget.ui similarity index 100% rename from tests/auto/uic/baseline/Widget.ui rename to tests/auto/tools/uic/baseline/Widget.ui diff --git a/tests/auto/uic/baseline/Widget.ui.h b/tests/auto/tools/uic/baseline/Widget.ui.h similarity index 100% rename from tests/auto/uic/baseline/Widget.ui.h rename to tests/auto/tools/uic/baseline/Widget.ui.h diff --git a/tests/auto/uic/baseline/addlinkdialog.ui b/tests/auto/tools/uic/baseline/addlinkdialog.ui similarity index 100% rename from tests/auto/uic/baseline/addlinkdialog.ui rename to tests/auto/tools/uic/baseline/addlinkdialog.ui diff --git a/tests/auto/uic/baseline/addlinkdialog.ui.h b/tests/auto/tools/uic/baseline/addlinkdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/addlinkdialog.ui.h rename to tests/auto/tools/uic/baseline/addlinkdialog.ui.h diff --git a/tests/auto/uic/baseline/addtorrentform.ui b/tests/auto/tools/uic/baseline/addtorrentform.ui similarity index 100% rename from tests/auto/uic/baseline/addtorrentform.ui rename to tests/auto/tools/uic/baseline/addtorrentform.ui diff --git a/tests/auto/uic/baseline/addtorrentform.ui.h b/tests/auto/tools/uic/baseline/addtorrentform.ui.h similarity index 100% rename from tests/auto/uic/baseline/addtorrentform.ui.h rename to tests/auto/tools/uic/baseline/addtorrentform.ui.h diff --git a/tests/auto/uic/baseline/authenticationdialog.ui b/tests/auto/tools/uic/baseline/authenticationdialog.ui similarity index 100% rename from tests/auto/uic/baseline/authenticationdialog.ui rename to tests/auto/tools/uic/baseline/authenticationdialog.ui diff --git a/tests/auto/uic/baseline/authenticationdialog.ui.h b/tests/auto/tools/uic/baseline/authenticationdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/authenticationdialog.ui.h rename to tests/auto/tools/uic/baseline/authenticationdialog.ui.h diff --git a/tests/auto/uic/baseline/backside.ui b/tests/auto/tools/uic/baseline/backside.ui similarity index 100% rename from tests/auto/uic/baseline/backside.ui rename to tests/auto/tools/uic/baseline/backside.ui diff --git a/tests/auto/uic/baseline/backside.ui.h b/tests/auto/tools/uic/baseline/backside.ui.h similarity index 100% rename from tests/auto/uic/baseline/backside.ui.h rename to tests/auto/tools/uic/baseline/backside.ui.h diff --git a/tests/auto/uic/baseline/batchtranslation.ui b/tests/auto/tools/uic/baseline/batchtranslation.ui similarity index 100% rename from tests/auto/uic/baseline/batchtranslation.ui rename to tests/auto/tools/uic/baseline/batchtranslation.ui diff --git a/tests/auto/uic/baseline/batchtranslation.ui.h b/tests/auto/tools/uic/baseline/batchtranslation.ui.h similarity index 100% rename from tests/auto/uic/baseline/batchtranslation.ui.h rename to tests/auto/tools/uic/baseline/batchtranslation.ui.h diff --git a/tests/auto/uic/baseline/bookmarkdialog.ui b/tests/auto/tools/uic/baseline/bookmarkdialog.ui similarity index 100% rename from tests/auto/uic/baseline/bookmarkdialog.ui rename to tests/auto/tools/uic/baseline/bookmarkdialog.ui diff --git a/tests/auto/uic/baseline/bookmarkdialog.ui.h b/tests/auto/tools/uic/baseline/bookmarkdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/bookmarkdialog.ui.h rename to tests/auto/tools/uic/baseline/bookmarkdialog.ui.h diff --git a/tests/auto/uic/baseline/bookwindow.ui b/tests/auto/tools/uic/baseline/bookwindow.ui similarity index 100% rename from tests/auto/uic/baseline/bookwindow.ui rename to tests/auto/tools/uic/baseline/bookwindow.ui diff --git a/tests/auto/uic/baseline/bookwindow.ui.h b/tests/auto/tools/uic/baseline/bookwindow.ui.h similarity index 100% rename from tests/auto/uic/baseline/bookwindow.ui.h rename to tests/auto/tools/uic/baseline/bookwindow.ui.h diff --git a/tests/auto/uic/baseline/browserwidget.ui b/tests/auto/tools/uic/baseline/browserwidget.ui similarity index 100% rename from tests/auto/uic/baseline/browserwidget.ui rename to tests/auto/tools/uic/baseline/browserwidget.ui diff --git a/tests/auto/uic/baseline/browserwidget.ui.h b/tests/auto/tools/uic/baseline/browserwidget.ui.h similarity index 100% rename from tests/auto/uic/baseline/browserwidget.ui.h rename to tests/auto/tools/uic/baseline/browserwidget.ui.h diff --git a/tests/auto/uic/baseline/calculator.ui b/tests/auto/tools/uic/baseline/calculator.ui similarity index 100% rename from tests/auto/uic/baseline/calculator.ui rename to tests/auto/tools/uic/baseline/calculator.ui diff --git a/tests/auto/uic/baseline/calculator.ui.h b/tests/auto/tools/uic/baseline/calculator.ui.h similarity index 100% rename from tests/auto/uic/baseline/calculator.ui.h rename to tests/auto/tools/uic/baseline/calculator.ui.h diff --git a/tests/auto/uic/baseline/calculatorform.ui b/tests/auto/tools/uic/baseline/calculatorform.ui similarity index 100% rename from tests/auto/uic/baseline/calculatorform.ui rename to tests/auto/tools/uic/baseline/calculatorform.ui diff --git a/tests/auto/uic/baseline/calculatorform.ui.h b/tests/auto/tools/uic/baseline/calculatorform.ui.h similarity index 100% rename from tests/auto/uic/baseline/calculatorform.ui.h rename to tests/auto/tools/uic/baseline/calculatorform.ui.h diff --git a/tests/auto/uic/baseline/certificateinfo.ui b/tests/auto/tools/uic/baseline/certificateinfo.ui similarity index 100% rename from tests/auto/uic/baseline/certificateinfo.ui rename to tests/auto/tools/uic/baseline/certificateinfo.ui diff --git a/tests/auto/uic/baseline/certificateinfo.ui.h b/tests/auto/tools/uic/baseline/certificateinfo.ui.h similarity index 100% rename from tests/auto/uic/baseline/certificateinfo.ui.h rename to tests/auto/tools/uic/baseline/certificateinfo.ui.h diff --git a/tests/auto/uic/baseline/chatdialog.ui b/tests/auto/tools/uic/baseline/chatdialog.ui similarity index 100% rename from tests/auto/uic/baseline/chatdialog.ui rename to tests/auto/tools/uic/baseline/chatdialog.ui diff --git a/tests/auto/uic/baseline/chatdialog.ui.h b/tests/auto/tools/uic/baseline/chatdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/chatdialog.ui.h rename to tests/auto/tools/uic/baseline/chatdialog.ui.h diff --git a/tests/auto/uic/baseline/chatmainwindow.ui b/tests/auto/tools/uic/baseline/chatmainwindow.ui similarity index 100% rename from tests/auto/uic/baseline/chatmainwindow.ui rename to tests/auto/tools/uic/baseline/chatmainwindow.ui diff --git a/tests/auto/uic/baseline/chatmainwindow.ui.h b/tests/auto/tools/uic/baseline/chatmainwindow.ui.h similarity index 100% rename from tests/auto/uic/baseline/chatmainwindow.ui.h rename to tests/auto/tools/uic/baseline/chatmainwindow.ui.h diff --git a/tests/auto/uic/baseline/chatsetnickname.ui b/tests/auto/tools/uic/baseline/chatsetnickname.ui similarity index 100% rename from tests/auto/uic/baseline/chatsetnickname.ui rename to tests/auto/tools/uic/baseline/chatsetnickname.ui diff --git a/tests/auto/uic/baseline/chatsetnickname.ui.h b/tests/auto/tools/uic/baseline/chatsetnickname.ui.h similarity index 100% rename from tests/auto/uic/baseline/chatsetnickname.ui.h rename to tests/auto/tools/uic/baseline/chatsetnickname.ui.h diff --git a/tests/auto/uic/baseline/config.ui b/tests/auto/tools/uic/baseline/config.ui similarity index 100% rename from tests/auto/uic/baseline/config.ui rename to tests/auto/tools/uic/baseline/config.ui diff --git a/tests/auto/uic/baseline/config.ui.h b/tests/auto/tools/uic/baseline/config.ui.h similarity index 100% rename from tests/auto/uic/baseline/config.ui.h rename to tests/auto/tools/uic/baseline/config.ui.h diff --git a/tests/auto/uic/baseline/connectdialog.ui b/tests/auto/tools/uic/baseline/connectdialog.ui similarity index 100% rename from tests/auto/uic/baseline/connectdialog.ui rename to tests/auto/tools/uic/baseline/connectdialog.ui diff --git a/tests/auto/uic/baseline/connectdialog.ui.h b/tests/auto/tools/uic/baseline/connectdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/connectdialog.ui.h rename to tests/auto/tools/uic/baseline/connectdialog.ui.h diff --git a/tests/auto/uic/baseline/controller.ui b/tests/auto/tools/uic/baseline/controller.ui similarity index 100% rename from tests/auto/uic/baseline/controller.ui rename to tests/auto/tools/uic/baseline/controller.ui diff --git a/tests/auto/uic/baseline/controller.ui.h b/tests/auto/tools/uic/baseline/controller.ui.h similarity index 100% rename from tests/auto/uic/baseline/controller.ui.h rename to tests/auto/tools/uic/baseline/controller.ui.h diff --git a/tests/auto/uic/baseline/cookies.ui b/tests/auto/tools/uic/baseline/cookies.ui similarity index 100% rename from tests/auto/uic/baseline/cookies.ui rename to tests/auto/tools/uic/baseline/cookies.ui diff --git a/tests/auto/uic/baseline/cookies.ui.h b/tests/auto/tools/uic/baseline/cookies.ui.h similarity index 100% rename from tests/auto/uic/baseline/cookies.ui.h rename to tests/auto/tools/uic/baseline/cookies.ui.h diff --git a/tests/auto/uic/baseline/cookiesexceptions.ui b/tests/auto/tools/uic/baseline/cookiesexceptions.ui similarity index 100% rename from tests/auto/uic/baseline/cookiesexceptions.ui rename to tests/auto/tools/uic/baseline/cookiesexceptions.ui diff --git a/tests/auto/uic/baseline/cookiesexceptions.ui.h b/tests/auto/tools/uic/baseline/cookiesexceptions.ui.h similarity index 100% rename from tests/auto/uic/baseline/cookiesexceptions.ui.h rename to tests/auto/tools/uic/baseline/cookiesexceptions.ui.h diff --git a/tests/auto/uic/baseline/default.ui b/tests/auto/tools/uic/baseline/default.ui similarity index 100% rename from tests/auto/uic/baseline/default.ui rename to tests/auto/tools/uic/baseline/default.ui diff --git a/tests/auto/uic/baseline/default.ui.h b/tests/auto/tools/uic/baseline/default.ui.h similarity index 100% rename from tests/auto/uic/baseline/default.ui.h rename to tests/auto/tools/uic/baseline/default.ui.h diff --git a/tests/auto/uic/baseline/dialog.ui b/tests/auto/tools/uic/baseline/dialog.ui similarity index 100% rename from tests/auto/uic/baseline/dialog.ui rename to tests/auto/tools/uic/baseline/dialog.ui diff --git a/tests/auto/uic/baseline/dialog.ui.h b/tests/auto/tools/uic/baseline/dialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/dialog.ui.h rename to tests/auto/tools/uic/baseline/dialog.ui.h diff --git a/tests/auto/uic/baseline/downloaditem.ui b/tests/auto/tools/uic/baseline/downloaditem.ui similarity index 100% rename from tests/auto/uic/baseline/downloaditem.ui rename to tests/auto/tools/uic/baseline/downloaditem.ui diff --git a/tests/auto/uic/baseline/downloaditem.ui.h b/tests/auto/tools/uic/baseline/downloaditem.ui.h similarity index 100% rename from tests/auto/uic/baseline/downloaditem.ui.h rename to tests/auto/tools/uic/baseline/downloaditem.ui.h diff --git a/tests/auto/uic/baseline/downloads.ui b/tests/auto/tools/uic/baseline/downloads.ui similarity index 100% rename from tests/auto/uic/baseline/downloads.ui rename to tests/auto/tools/uic/baseline/downloads.ui diff --git a/tests/auto/uic/baseline/downloads.ui.h b/tests/auto/tools/uic/baseline/downloads.ui.h similarity index 100% rename from tests/auto/uic/baseline/downloads.ui.h rename to tests/auto/tools/uic/baseline/downloads.ui.h diff --git a/tests/auto/uic/baseline/embeddeddialog.ui b/tests/auto/tools/uic/baseline/embeddeddialog.ui similarity index 100% rename from tests/auto/uic/baseline/embeddeddialog.ui rename to tests/auto/tools/uic/baseline/embeddeddialog.ui diff --git a/tests/auto/uic/baseline/embeddeddialog.ui.h b/tests/auto/tools/uic/baseline/embeddeddialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/embeddeddialog.ui.h rename to tests/auto/tools/uic/baseline/embeddeddialog.ui.h diff --git a/tests/auto/uic/baseline/filespage.ui b/tests/auto/tools/uic/baseline/filespage.ui similarity index 100% rename from tests/auto/uic/baseline/filespage.ui rename to tests/auto/tools/uic/baseline/filespage.ui diff --git a/tests/auto/uic/baseline/filespage.ui.h b/tests/auto/tools/uic/baseline/filespage.ui.h similarity index 100% rename from tests/auto/uic/baseline/filespage.ui.h rename to tests/auto/tools/uic/baseline/filespage.ui.h diff --git a/tests/auto/uic/baseline/filternamedialog.ui b/tests/auto/tools/uic/baseline/filternamedialog.ui similarity index 100% rename from tests/auto/uic/baseline/filternamedialog.ui rename to tests/auto/tools/uic/baseline/filternamedialog.ui diff --git a/tests/auto/uic/baseline/filternamedialog.ui.h b/tests/auto/tools/uic/baseline/filternamedialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/filternamedialog.ui.h rename to tests/auto/tools/uic/baseline/filternamedialog.ui.h diff --git a/tests/auto/uic/baseline/filterpage.ui b/tests/auto/tools/uic/baseline/filterpage.ui similarity index 100% rename from tests/auto/uic/baseline/filterpage.ui rename to tests/auto/tools/uic/baseline/filterpage.ui diff --git a/tests/auto/uic/baseline/filterpage.ui.h b/tests/auto/tools/uic/baseline/filterpage.ui.h similarity index 100% rename from tests/auto/uic/baseline/filterpage.ui.h rename to tests/auto/tools/uic/baseline/filterpage.ui.h diff --git a/tests/auto/uic/baseline/finddialog.ui b/tests/auto/tools/uic/baseline/finddialog.ui similarity index 100% rename from tests/auto/uic/baseline/finddialog.ui rename to tests/auto/tools/uic/baseline/finddialog.ui diff --git a/tests/auto/uic/baseline/finddialog.ui.h b/tests/auto/tools/uic/baseline/finddialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/finddialog.ui.h rename to tests/auto/tools/uic/baseline/finddialog.ui.h diff --git a/tests/auto/uic/baseline/form.ui b/tests/auto/tools/uic/baseline/form.ui similarity index 100% rename from tests/auto/uic/baseline/form.ui rename to tests/auto/tools/uic/baseline/form.ui diff --git a/tests/auto/uic/baseline/form.ui.h b/tests/auto/tools/uic/baseline/form.ui.h similarity index 100% rename from tests/auto/uic/baseline/form.ui.h rename to tests/auto/tools/uic/baseline/form.ui.h diff --git a/tests/auto/uic/baseline/formwindowsettings.ui b/tests/auto/tools/uic/baseline/formwindowsettings.ui similarity index 100% rename from tests/auto/uic/baseline/formwindowsettings.ui rename to tests/auto/tools/uic/baseline/formwindowsettings.ui diff --git a/tests/auto/uic/baseline/formwindowsettings.ui.h b/tests/auto/tools/uic/baseline/formwindowsettings.ui.h similarity index 100% rename from tests/auto/uic/baseline/formwindowsettings.ui.h rename to tests/auto/tools/uic/baseline/formwindowsettings.ui.h diff --git a/tests/auto/uic/baseline/generalpage.ui b/tests/auto/tools/uic/baseline/generalpage.ui similarity index 100% rename from tests/auto/uic/baseline/generalpage.ui rename to tests/auto/tools/uic/baseline/generalpage.ui diff --git a/tests/auto/uic/baseline/generalpage.ui.h b/tests/auto/tools/uic/baseline/generalpage.ui.h similarity index 100% rename from tests/auto/uic/baseline/generalpage.ui.h rename to tests/auto/tools/uic/baseline/generalpage.ui.h diff --git a/tests/auto/uic/baseline/gridalignment.ui b/tests/auto/tools/uic/baseline/gridalignment.ui similarity index 100% rename from tests/auto/uic/baseline/gridalignment.ui rename to tests/auto/tools/uic/baseline/gridalignment.ui diff --git a/tests/auto/uic/baseline/gridalignment.ui.h b/tests/auto/tools/uic/baseline/gridalignment.ui.h similarity index 100% rename from tests/auto/uic/baseline/gridalignment.ui.h rename to tests/auto/tools/uic/baseline/gridalignment.ui.h diff --git a/tests/auto/uic/baseline/gridpanel.ui b/tests/auto/tools/uic/baseline/gridpanel.ui similarity index 100% rename from tests/auto/uic/baseline/gridpanel.ui rename to tests/auto/tools/uic/baseline/gridpanel.ui diff --git a/tests/auto/uic/baseline/gridpanel.ui.h b/tests/auto/tools/uic/baseline/gridpanel.ui.h similarity index 100% rename from tests/auto/uic/baseline/gridpanel.ui.h rename to tests/auto/tools/uic/baseline/gridpanel.ui.h diff --git a/tests/auto/uic/baseline/helpdialog.ui b/tests/auto/tools/uic/baseline/helpdialog.ui similarity index 100% rename from tests/auto/uic/baseline/helpdialog.ui rename to tests/auto/tools/uic/baseline/helpdialog.ui diff --git a/tests/auto/uic/baseline/helpdialog.ui.h b/tests/auto/tools/uic/baseline/helpdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/helpdialog.ui.h rename to tests/auto/tools/uic/baseline/helpdialog.ui.h diff --git a/tests/auto/uic/baseline/history.ui b/tests/auto/tools/uic/baseline/history.ui similarity index 100% rename from tests/auto/uic/baseline/history.ui rename to tests/auto/tools/uic/baseline/history.ui diff --git a/tests/auto/uic/baseline/history.ui.h b/tests/auto/tools/uic/baseline/history.ui.h similarity index 100% rename from tests/auto/uic/baseline/history.ui.h rename to tests/auto/tools/uic/baseline/history.ui.h diff --git a/tests/auto/uic/baseline/icontheme.ui b/tests/auto/tools/uic/baseline/icontheme.ui similarity index 100% rename from tests/auto/uic/baseline/icontheme.ui rename to tests/auto/tools/uic/baseline/icontheme.ui diff --git a/tests/auto/uic/baseline/icontheme.ui.h b/tests/auto/tools/uic/baseline/icontheme.ui.h similarity index 100% rename from tests/auto/uic/baseline/icontheme.ui.h rename to tests/auto/tools/uic/baseline/icontheme.ui.h diff --git a/tests/auto/uic/baseline/identifierpage.ui b/tests/auto/tools/uic/baseline/identifierpage.ui similarity index 100% rename from tests/auto/uic/baseline/identifierpage.ui rename to tests/auto/tools/uic/baseline/identifierpage.ui diff --git a/tests/auto/uic/baseline/identifierpage.ui.h b/tests/auto/tools/uic/baseline/identifierpage.ui.h similarity index 100% rename from tests/auto/uic/baseline/identifierpage.ui.h rename to tests/auto/tools/uic/baseline/identifierpage.ui.h diff --git a/tests/auto/uic/baseline/imagedialog.ui b/tests/auto/tools/uic/baseline/imagedialog.ui similarity index 100% rename from tests/auto/uic/baseline/imagedialog.ui rename to tests/auto/tools/uic/baseline/imagedialog.ui diff --git a/tests/auto/uic/baseline/imagedialog.ui.h b/tests/auto/tools/uic/baseline/imagedialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/imagedialog.ui.h rename to tests/auto/tools/uic/baseline/imagedialog.ui.h diff --git a/tests/auto/uic/baseline/inputpage.ui b/tests/auto/tools/uic/baseline/inputpage.ui similarity index 100% rename from tests/auto/uic/baseline/inputpage.ui rename to tests/auto/tools/uic/baseline/inputpage.ui diff --git a/tests/auto/uic/baseline/inputpage.ui.h b/tests/auto/tools/uic/baseline/inputpage.ui.h similarity index 100% rename from tests/auto/uic/baseline/inputpage.ui.h rename to tests/auto/tools/uic/baseline/inputpage.ui.h diff --git a/tests/auto/uic/baseline/installdialog.ui b/tests/auto/tools/uic/baseline/installdialog.ui similarity index 100% rename from tests/auto/uic/baseline/installdialog.ui rename to tests/auto/tools/uic/baseline/installdialog.ui diff --git a/tests/auto/uic/baseline/installdialog.ui.h b/tests/auto/tools/uic/baseline/installdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/installdialog.ui.h rename to tests/auto/tools/uic/baseline/installdialog.ui.h diff --git a/tests/auto/uic/baseline/languagesdialog.ui b/tests/auto/tools/uic/baseline/languagesdialog.ui similarity index 100% rename from tests/auto/uic/baseline/languagesdialog.ui rename to tests/auto/tools/uic/baseline/languagesdialog.ui diff --git a/tests/auto/uic/baseline/languagesdialog.ui.h b/tests/auto/tools/uic/baseline/languagesdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/languagesdialog.ui.h rename to tests/auto/tools/uic/baseline/languagesdialog.ui.h diff --git a/tests/auto/uic/baseline/listwidgeteditor.ui b/tests/auto/tools/uic/baseline/listwidgeteditor.ui similarity index 100% rename from tests/auto/uic/baseline/listwidgeteditor.ui rename to tests/auto/tools/uic/baseline/listwidgeteditor.ui diff --git a/tests/auto/uic/baseline/listwidgeteditor.ui.h b/tests/auto/tools/uic/baseline/listwidgeteditor.ui.h similarity index 100% rename from tests/auto/uic/baseline/listwidgeteditor.ui.h rename to tests/auto/tools/uic/baseline/listwidgeteditor.ui.h diff --git a/tests/auto/uic/baseline/mainwindow.ui b/tests/auto/tools/uic/baseline/mainwindow.ui similarity index 100% rename from tests/auto/uic/baseline/mainwindow.ui rename to tests/auto/tools/uic/baseline/mainwindow.ui diff --git a/tests/auto/uic/baseline/mainwindow.ui.h b/tests/auto/tools/uic/baseline/mainwindow.ui.h similarity index 100% rename from tests/auto/uic/baseline/mainwindow.ui.h rename to tests/auto/tools/uic/baseline/mainwindow.ui.h diff --git a/tests/auto/uic/baseline/mydialog.ui b/tests/auto/tools/uic/baseline/mydialog.ui similarity index 100% rename from tests/auto/uic/baseline/mydialog.ui rename to tests/auto/tools/uic/baseline/mydialog.ui diff --git a/tests/auto/uic/baseline/mydialog.ui.h b/tests/auto/tools/uic/baseline/mydialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/mydialog.ui.h rename to tests/auto/tools/uic/baseline/mydialog.ui.h diff --git a/tests/auto/uic/baseline/myform.ui b/tests/auto/tools/uic/baseline/myform.ui similarity index 100% rename from tests/auto/uic/baseline/myform.ui rename to tests/auto/tools/uic/baseline/myform.ui diff --git a/tests/auto/uic/baseline/myform.ui.h b/tests/auto/tools/uic/baseline/myform.ui.h similarity index 100% rename from tests/auto/uic/baseline/myform.ui.h rename to tests/auto/tools/uic/baseline/myform.ui.h diff --git a/tests/auto/uic/baseline/newactiondialog.ui b/tests/auto/tools/uic/baseline/newactiondialog.ui similarity index 100% rename from tests/auto/uic/baseline/newactiondialog.ui rename to tests/auto/tools/uic/baseline/newactiondialog.ui diff --git a/tests/auto/uic/baseline/newactiondialog.ui.h b/tests/auto/tools/uic/baseline/newactiondialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/newactiondialog.ui.h rename to tests/auto/tools/uic/baseline/newactiondialog.ui.h diff --git a/tests/auto/uic/baseline/newdynamicpropertydialog.ui b/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui similarity index 100% rename from tests/auto/uic/baseline/newdynamicpropertydialog.ui rename to tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui diff --git a/tests/auto/uic/baseline/newdynamicpropertydialog.ui.h b/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/newdynamicpropertydialog.ui.h rename to tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h diff --git a/tests/auto/uic/baseline/newform.ui b/tests/auto/tools/uic/baseline/newform.ui similarity index 100% rename from tests/auto/uic/baseline/newform.ui rename to tests/auto/tools/uic/baseline/newform.ui diff --git a/tests/auto/uic/baseline/newform.ui.h b/tests/auto/tools/uic/baseline/newform.ui.h similarity index 100% rename from tests/auto/uic/baseline/newform.ui.h rename to tests/auto/tools/uic/baseline/newform.ui.h diff --git a/tests/auto/uic/baseline/orderdialog.ui b/tests/auto/tools/uic/baseline/orderdialog.ui similarity index 100% rename from tests/auto/uic/baseline/orderdialog.ui rename to tests/auto/tools/uic/baseline/orderdialog.ui diff --git a/tests/auto/uic/baseline/orderdialog.ui.h b/tests/auto/tools/uic/baseline/orderdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/orderdialog.ui.h rename to tests/auto/tools/uic/baseline/orderdialog.ui.h diff --git a/tests/auto/uic/baseline/outputpage.ui b/tests/auto/tools/uic/baseline/outputpage.ui similarity index 100% rename from tests/auto/uic/baseline/outputpage.ui rename to tests/auto/tools/uic/baseline/outputpage.ui diff --git a/tests/auto/uic/baseline/outputpage.ui.h b/tests/auto/tools/uic/baseline/outputpage.ui.h similarity index 100% rename from tests/auto/uic/baseline/outputpage.ui.h rename to tests/auto/tools/uic/baseline/outputpage.ui.h diff --git a/tests/auto/uic/baseline/pagefold.ui b/tests/auto/tools/uic/baseline/pagefold.ui similarity index 100% rename from tests/auto/uic/baseline/pagefold.ui rename to tests/auto/tools/uic/baseline/pagefold.ui diff --git a/tests/auto/uic/baseline/pagefold.ui.h b/tests/auto/tools/uic/baseline/pagefold.ui.h similarity index 100% rename from tests/auto/uic/baseline/pagefold.ui.h rename to tests/auto/tools/uic/baseline/pagefold.ui.h diff --git a/tests/auto/uic/baseline/paletteeditor.ui b/tests/auto/tools/uic/baseline/paletteeditor.ui similarity index 100% rename from tests/auto/uic/baseline/paletteeditor.ui rename to tests/auto/tools/uic/baseline/paletteeditor.ui diff --git a/tests/auto/uic/baseline/paletteeditor.ui.h b/tests/auto/tools/uic/baseline/paletteeditor.ui.h similarity index 100% rename from tests/auto/uic/baseline/paletteeditor.ui.h rename to tests/auto/tools/uic/baseline/paletteeditor.ui.h diff --git a/tests/auto/uic/baseline/passworddialog.ui b/tests/auto/tools/uic/baseline/passworddialog.ui similarity index 100% rename from tests/auto/uic/baseline/passworddialog.ui rename to tests/auto/tools/uic/baseline/passworddialog.ui diff --git a/tests/auto/uic/baseline/passworddialog.ui.h b/tests/auto/tools/uic/baseline/passworddialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/passworddialog.ui.h rename to tests/auto/tools/uic/baseline/passworddialog.ui.h diff --git a/tests/auto/uic/baseline/pathpage.ui b/tests/auto/tools/uic/baseline/pathpage.ui similarity index 100% rename from tests/auto/uic/baseline/pathpage.ui rename to tests/auto/tools/uic/baseline/pathpage.ui diff --git a/tests/auto/uic/baseline/pathpage.ui.h b/tests/auto/tools/uic/baseline/pathpage.ui.h similarity index 100% rename from tests/auto/uic/baseline/pathpage.ui.h rename to tests/auto/tools/uic/baseline/pathpage.ui.h diff --git a/tests/auto/uic/baseline/phrasebookbox.ui b/tests/auto/tools/uic/baseline/phrasebookbox.ui similarity index 100% rename from tests/auto/uic/baseline/phrasebookbox.ui rename to tests/auto/tools/uic/baseline/phrasebookbox.ui diff --git a/tests/auto/uic/baseline/phrasebookbox.ui.h b/tests/auto/tools/uic/baseline/phrasebookbox.ui.h similarity index 100% rename from tests/auto/uic/baseline/phrasebookbox.ui.h rename to tests/auto/tools/uic/baseline/phrasebookbox.ui.h diff --git a/tests/auto/uic/baseline/plugindialog.ui b/tests/auto/tools/uic/baseline/plugindialog.ui similarity index 100% rename from tests/auto/uic/baseline/plugindialog.ui rename to tests/auto/tools/uic/baseline/plugindialog.ui diff --git a/tests/auto/uic/baseline/plugindialog.ui.h b/tests/auto/tools/uic/baseline/plugindialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/plugindialog.ui.h rename to tests/auto/tools/uic/baseline/plugindialog.ui.h diff --git a/tests/auto/uic/baseline/preferencesdialog.ui b/tests/auto/tools/uic/baseline/preferencesdialog.ui similarity index 100% rename from tests/auto/uic/baseline/preferencesdialog.ui rename to tests/auto/tools/uic/baseline/preferencesdialog.ui diff --git a/tests/auto/uic/baseline/preferencesdialog.ui.h b/tests/auto/tools/uic/baseline/preferencesdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/preferencesdialog.ui.h rename to tests/auto/tools/uic/baseline/preferencesdialog.ui.h diff --git a/tests/auto/uic/baseline/previewconfigurationwidget.ui b/tests/auto/tools/uic/baseline/previewconfigurationwidget.ui similarity index 100% rename from tests/auto/uic/baseline/previewconfigurationwidget.ui rename to tests/auto/tools/uic/baseline/previewconfigurationwidget.ui diff --git a/tests/auto/uic/baseline/previewconfigurationwidget.ui.h b/tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h similarity index 100% rename from tests/auto/uic/baseline/previewconfigurationwidget.ui.h rename to tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h diff --git a/tests/auto/uic/baseline/previewdialogbase.ui b/tests/auto/tools/uic/baseline/previewdialogbase.ui similarity index 100% rename from tests/auto/uic/baseline/previewdialogbase.ui rename to tests/auto/tools/uic/baseline/previewdialogbase.ui diff --git a/tests/auto/uic/baseline/previewdialogbase.ui.h b/tests/auto/tools/uic/baseline/previewdialogbase.ui.h similarity index 100% rename from tests/auto/uic/baseline/previewdialogbase.ui.h rename to tests/auto/tools/uic/baseline/previewdialogbase.ui.h diff --git a/tests/auto/uic/baseline/previewwidget.ui b/tests/auto/tools/uic/baseline/previewwidget.ui similarity index 100% rename from tests/auto/uic/baseline/previewwidget.ui rename to tests/auto/tools/uic/baseline/previewwidget.ui diff --git a/tests/auto/uic/baseline/previewwidget.ui.h b/tests/auto/tools/uic/baseline/previewwidget.ui.h similarity index 100% rename from tests/auto/uic/baseline/previewwidget.ui.h rename to tests/auto/tools/uic/baseline/previewwidget.ui.h diff --git a/tests/auto/uic/baseline/proxy.ui b/tests/auto/tools/uic/baseline/proxy.ui similarity index 100% rename from tests/auto/uic/baseline/proxy.ui rename to tests/auto/tools/uic/baseline/proxy.ui diff --git a/tests/auto/uic/baseline/proxy.ui.h b/tests/auto/tools/uic/baseline/proxy.ui.h similarity index 100% rename from tests/auto/uic/baseline/proxy.ui.h rename to tests/auto/tools/uic/baseline/proxy.ui.h diff --git a/tests/auto/uic/baseline/qfiledialog.ui b/tests/auto/tools/uic/baseline/qfiledialog.ui similarity index 100% rename from tests/auto/uic/baseline/qfiledialog.ui rename to tests/auto/tools/uic/baseline/qfiledialog.ui diff --git a/tests/auto/uic/baseline/qfiledialog.ui.h b/tests/auto/tools/uic/baseline/qfiledialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/qfiledialog.ui.h rename to tests/auto/tools/uic/baseline/qfiledialog.ui.h diff --git a/tests/auto/uic/baseline/qpagesetupwidget.ui b/tests/auto/tools/uic/baseline/qpagesetupwidget.ui similarity index 100% rename from tests/auto/uic/baseline/qpagesetupwidget.ui rename to tests/auto/tools/uic/baseline/qpagesetupwidget.ui diff --git a/tests/auto/uic/baseline/qpagesetupwidget.ui.h b/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h similarity index 100% rename from tests/auto/uic/baseline/qpagesetupwidget.ui.h rename to tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h diff --git a/tests/auto/uic/baseline/qprintpropertieswidget.ui b/tests/auto/tools/uic/baseline/qprintpropertieswidget.ui similarity index 100% rename from tests/auto/uic/baseline/qprintpropertieswidget.ui rename to tests/auto/tools/uic/baseline/qprintpropertieswidget.ui diff --git a/tests/auto/uic/baseline/qprintpropertieswidget.ui.h b/tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h similarity index 100% rename from tests/auto/uic/baseline/qprintpropertieswidget.ui.h rename to tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h diff --git a/tests/auto/uic/baseline/qprintsettingsoutput.ui b/tests/auto/tools/uic/baseline/qprintsettingsoutput.ui similarity index 100% rename from tests/auto/uic/baseline/qprintsettingsoutput.ui rename to tests/auto/tools/uic/baseline/qprintsettingsoutput.ui diff --git a/tests/auto/uic/baseline/qprintsettingsoutput.ui.h b/tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h similarity index 100% rename from tests/auto/uic/baseline/qprintsettingsoutput.ui.h rename to tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h diff --git a/tests/auto/uic/baseline/qprintwidget.ui b/tests/auto/tools/uic/baseline/qprintwidget.ui similarity index 100% rename from tests/auto/uic/baseline/qprintwidget.ui rename to tests/auto/tools/uic/baseline/qprintwidget.ui diff --git a/tests/auto/uic/baseline/qprintwidget.ui.h b/tests/auto/tools/uic/baseline/qprintwidget.ui.h similarity index 100% rename from tests/auto/uic/baseline/qprintwidget.ui.h rename to tests/auto/tools/uic/baseline/qprintwidget.ui.h diff --git a/tests/auto/uic/baseline/qsqlconnectiondialog.ui b/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui similarity index 100% rename from tests/auto/uic/baseline/qsqlconnectiondialog.ui rename to tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui diff --git a/tests/auto/uic/baseline/qsqlconnectiondialog.ui.h b/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/qsqlconnectiondialog.ui.h rename to tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h diff --git a/tests/auto/uic/baseline/qtgradientdialog.ui b/tests/auto/tools/uic/baseline/qtgradientdialog.ui similarity index 100% rename from tests/auto/uic/baseline/qtgradientdialog.ui rename to tests/auto/tools/uic/baseline/qtgradientdialog.ui diff --git a/tests/auto/uic/baseline/qtgradientdialog.ui.h b/tests/auto/tools/uic/baseline/qtgradientdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/qtgradientdialog.ui.h rename to tests/auto/tools/uic/baseline/qtgradientdialog.ui.h diff --git a/tests/auto/uic/baseline/qtgradienteditor.ui b/tests/auto/tools/uic/baseline/qtgradienteditor.ui similarity index 100% rename from tests/auto/uic/baseline/qtgradienteditor.ui rename to tests/auto/tools/uic/baseline/qtgradienteditor.ui diff --git a/tests/auto/uic/baseline/qtgradienteditor.ui.h b/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h similarity index 100% rename from tests/auto/uic/baseline/qtgradienteditor.ui.h rename to tests/auto/tools/uic/baseline/qtgradienteditor.ui.h diff --git a/tests/auto/uic/baseline/qtgradientview.ui b/tests/auto/tools/uic/baseline/qtgradientview.ui similarity index 100% rename from tests/auto/uic/baseline/qtgradientview.ui rename to tests/auto/tools/uic/baseline/qtgradientview.ui diff --git a/tests/auto/uic/baseline/qtgradientview.ui.h b/tests/auto/tools/uic/baseline/qtgradientview.ui.h similarity index 100% rename from tests/auto/uic/baseline/qtgradientview.ui.h rename to tests/auto/tools/uic/baseline/qtgradientview.ui.h diff --git a/tests/auto/uic/baseline/qtgradientviewdialog.ui b/tests/auto/tools/uic/baseline/qtgradientviewdialog.ui similarity index 100% rename from tests/auto/uic/baseline/qtgradientviewdialog.ui rename to tests/auto/tools/uic/baseline/qtgradientviewdialog.ui diff --git a/tests/auto/uic/baseline/qtgradientviewdialog.ui.h b/tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/qtgradientviewdialog.ui.h rename to tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h diff --git a/tests/auto/uic/baseline/qtresourceeditordialog.ui b/tests/auto/tools/uic/baseline/qtresourceeditordialog.ui similarity index 100% rename from tests/auto/uic/baseline/qtresourceeditordialog.ui rename to tests/auto/tools/uic/baseline/qtresourceeditordialog.ui diff --git a/tests/auto/uic/baseline/qtresourceeditordialog.ui.h b/tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/qtresourceeditordialog.ui.h rename to tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h diff --git a/tests/auto/uic/baseline/qttoolbardialog.ui b/tests/auto/tools/uic/baseline/qttoolbardialog.ui similarity index 100% rename from tests/auto/uic/baseline/qttoolbardialog.ui rename to tests/auto/tools/uic/baseline/qttoolbardialog.ui diff --git a/tests/auto/uic/baseline/qttoolbardialog.ui.h b/tests/auto/tools/uic/baseline/qttoolbardialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/qttoolbardialog.ui.h rename to tests/auto/tools/uic/baseline/qttoolbardialog.ui.h diff --git a/tests/auto/uic/baseline/querywidget.ui b/tests/auto/tools/uic/baseline/querywidget.ui similarity index 100% rename from tests/auto/uic/baseline/querywidget.ui rename to tests/auto/tools/uic/baseline/querywidget.ui diff --git a/tests/auto/uic/baseline/querywidget.ui.h b/tests/auto/tools/uic/baseline/querywidget.ui.h similarity index 100% rename from tests/auto/uic/baseline/querywidget.ui.h rename to tests/auto/tools/uic/baseline/querywidget.ui.h diff --git a/tests/auto/uic/baseline/remotecontrol.ui b/tests/auto/tools/uic/baseline/remotecontrol.ui similarity index 100% rename from tests/auto/uic/baseline/remotecontrol.ui rename to tests/auto/tools/uic/baseline/remotecontrol.ui diff --git a/tests/auto/uic/baseline/remotecontrol.ui.h b/tests/auto/tools/uic/baseline/remotecontrol.ui.h similarity index 100% rename from tests/auto/uic/baseline/remotecontrol.ui.h rename to tests/auto/tools/uic/baseline/remotecontrol.ui.h diff --git a/tests/auto/uic/baseline/saveformastemplate.ui b/tests/auto/tools/uic/baseline/saveformastemplate.ui similarity index 100% rename from tests/auto/uic/baseline/saveformastemplate.ui rename to tests/auto/tools/uic/baseline/saveformastemplate.ui diff --git a/tests/auto/uic/baseline/saveformastemplate.ui.h b/tests/auto/tools/uic/baseline/saveformastemplate.ui.h similarity index 100% rename from tests/auto/uic/baseline/saveformastemplate.ui.h rename to tests/auto/tools/uic/baseline/saveformastemplate.ui.h diff --git a/tests/auto/uic/baseline/settings.ui b/tests/auto/tools/uic/baseline/settings.ui similarity index 100% rename from tests/auto/uic/baseline/settings.ui rename to tests/auto/tools/uic/baseline/settings.ui diff --git a/tests/auto/uic/baseline/settings.ui.h b/tests/auto/tools/uic/baseline/settings.ui.h similarity index 100% rename from tests/auto/uic/baseline/settings.ui.h rename to tests/auto/tools/uic/baseline/settings.ui.h diff --git a/tests/auto/uic/baseline/signalslotdialog.ui b/tests/auto/tools/uic/baseline/signalslotdialog.ui similarity index 100% rename from tests/auto/uic/baseline/signalslotdialog.ui rename to tests/auto/tools/uic/baseline/signalslotdialog.ui diff --git a/tests/auto/uic/baseline/signalslotdialog.ui.h b/tests/auto/tools/uic/baseline/signalslotdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/signalslotdialog.ui.h rename to tests/auto/tools/uic/baseline/signalslotdialog.ui.h diff --git a/tests/auto/uic/baseline/sslclient.ui b/tests/auto/tools/uic/baseline/sslclient.ui similarity index 100% rename from tests/auto/uic/baseline/sslclient.ui rename to tests/auto/tools/uic/baseline/sslclient.ui diff --git a/tests/auto/uic/baseline/sslclient.ui.h b/tests/auto/tools/uic/baseline/sslclient.ui.h similarity index 100% rename from tests/auto/uic/baseline/sslclient.ui.h rename to tests/auto/tools/uic/baseline/sslclient.ui.h diff --git a/tests/auto/uic/baseline/sslerrors.ui b/tests/auto/tools/uic/baseline/sslerrors.ui similarity index 100% rename from tests/auto/uic/baseline/sslerrors.ui rename to tests/auto/tools/uic/baseline/sslerrors.ui diff --git a/tests/auto/uic/baseline/sslerrors.ui.h b/tests/auto/tools/uic/baseline/sslerrors.ui.h similarity index 100% rename from tests/auto/uic/baseline/sslerrors.ui.h rename to tests/auto/tools/uic/baseline/sslerrors.ui.h diff --git a/tests/auto/uic/baseline/statistics.ui b/tests/auto/tools/uic/baseline/statistics.ui similarity index 100% rename from tests/auto/uic/baseline/statistics.ui rename to tests/auto/tools/uic/baseline/statistics.ui diff --git a/tests/auto/uic/baseline/statistics.ui.h b/tests/auto/tools/uic/baseline/statistics.ui.h similarity index 100% rename from tests/auto/uic/baseline/statistics.ui.h rename to tests/auto/tools/uic/baseline/statistics.ui.h diff --git a/tests/auto/uic/baseline/stringlisteditor.ui b/tests/auto/tools/uic/baseline/stringlisteditor.ui similarity index 100% rename from tests/auto/uic/baseline/stringlisteditor.ui rename to tests/auto/tools/uic/baseline/stringlisteditor.ui diff --git a/tests/auto/uic/baseline/stringlisteditor.ui.h b/tests/auto/tools/uic/baseline/stringlisteditor.ui.h similarity index 100% rename from tests/auto/uic/baseline/stringlisteditor.ui.h rename to tests/auto/tools/uic/baseline/stringlisteditor.ui.h diff --git a/tests/auto/uic/baseline/stylesheeteditor.ui b/tests/auto/tools/uic/baseline/stylesheeteditor.ui similarity index 100% rename from tests/auto/uic/baseline/stylesheeteditor.ui rename to tests/auto/tools/uic/baseline/stylesheeteditor.ui diff --git a/tests/auto/uic/baseline/stylesheeteditor.ui.h b/tests/auto/tools/uic/baseline/stylesheeteditor.ui.h similarity index 100% rename from tests/auto/uic/baseline/stylesheeteditor.ui.h rename to tests/auto/tools/uic/baseline/stylesheeteditor.ui.h diff --git a/tests/auto/uic/baseline/tabbedbrowser.ui b/tests/auto/tools/uic/baseline/tabbedbrowser.ui similarity index 100% rename from tests/auto/uic/baseline/tabbedbrowser.ui rename to tests/auto/tools/uic/baseline/tabbedbrowser.ui diff --git a/tests/auto/uic/baseline/tabbedbrowser.ui.h b/tests/auto/tools/uic/baseline/tabbedbrowser.ui.h similarity index 100% rename from tests/auto/uic/baseline/tabbedbrowser.ui.h rename to tests/auto/tools/uic/baseline/tabbedbrowser.ui.h diff --git a/tests/auto/uic/baseline/tablewidgeteditor.ui b/tests/auto/tools/uic/baseline/tablewidgeteditor.ui similarity index 100% rename from tests/auto/uic/baseline/tablewidgeteditor.ui rename to tests/auto/tools/uic/baseline/tablewidgeteditor.ui diff --git a/tests/auto/uic/baseline/tablewidgeteditor.ui.h b/tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h similarity index 100% rename from tests/auto/uic/baseline/tablewidgeteditor.ui.h rename to tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h diff --git a/tests/auto/uic/baseline/tetrixwindow.ui b/tests/auto/tools/uic/baseline/tetrixwindow.ui similarity index 100% rename from tests/auto/uic/baseline/tetrixwindow.ui rename to tests/auto/tools/uic/baseline/tetrixwindow.ui diff --git a/tests/auto/uic/baseline/tetrixwindow.ui.h b/tests/auto/tools/uic/baseline/tetrixwindow.ui.h similarity index 100% rename from tests/auto/uic/baseline/tetrixwindow.ui.h rename to tests/auto/tools/uic/baseline/tetrixwindow.ui.h diff --git a/tests/auto/uic/baseline/textfinder.ui b/tests/auto/tools/uic/baseline/textfinder.ui similarity index 100% rename from tests/auto/uic/baseline/textfinder.ui rename to tests/auto/tools/uic/baseline/textfinder.ui diff --git a/tests/auto/uic/baseline/textfinder.ui.h b/tests/auto/tools/uic/baseline/textfinder.ui.h similarity index 100% rename from tests/auto/uic/baseline/textfinder.ui.h rename to tests/auto/tools/uic/baseline/textfinder.ui.h diff --git a/tests/auto/uic/baseline/topicchooser.ui b/tests/auto/tools/uic/baseline/topicchooser.ui similarity index 100% rename from tests/auto/uic/baseline/topicchooser.ui rename to tests/auto/tools/uic/baseline/topicchooser.ui diff --git a/tests/auto/uic/baseline/topicchooser.ui.h b/tests/auto/tools/uic/baseline/topicchooser.ui.h similarity index 100% rename from tests/auto/uic/baseline/topicchooser.ui.h rename to tests/auto/tools/uic/baseline/topicchooser.ui.h diff --git a/tests/auto/uic/baseline/translatedialog.ui b/tests/auto/tools/uic/baseline/translatedialog.ui similarity index 100% rename from tests/auto/uic/baseline/translatedialog.ui rename to tests/auto/tools/uic/baseline/translatedialog.ui diff --git a/tests/auto/uic/baseline/translatedialog.ui.h b/tests/auto/tools/uic/baseline/translatedialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/translatedialog.ui.h rename to tests/auto/tools/uic/baseline/translatedialog.ui.h diff --git a/tests/auto/uic/baseline/translationsettings.ui b/tests/auto/tools/uic/baseline/translationsettings.ui similarity index 100% rename from tests/auto/uic/baseline/translationsettings.ui rename to tests/auto/tools/uic/baseline/translationsettings.ui diff --git a/tests/auto/uic/baseline/translationsettings.ui.h b/tests/auto/tools/uic/baseline/translationsettings.ui.h similarity index 100% rename from tests/auto/uic/baseline/translationsettings.ui.h rename to tests/auto/tools/uic/baseline/translationsettings.ui.h diff --git a/tests/auto/uic/baseline/treewidgeteditor.ui b/tests/auto/tools/uic/baseline/treewidgeteditor.ui similarity index 100% rename from tests/auto/uic/baseline/treewidgeteditor.ui rename to tests/auto/tools/uic/baseline/treewidgeteditor.ui diff --git a/tests/auto/uic/baseline/treewidgeteditor.ui.h b/tests/auto/tools/uic/baseline/treewidgeteditor.ui.h similarity index 100% rename from tests/auto/uic/baseline/treewidgeteditor.ui.h rename to tests/auto/tools/uic/baseline/treewidgeteditor.ui.h diff --git a/tests/auto/uic/baseline/trpreviewtool.ui b/tests/auto/tools/uic/baseline/trpreviewtool.ui similarity index 100% rename from tests/auto/uic/baseline/trpreviewtool.ui rename to tests/auto/tools/uic/baseline/trpreviewtool.ui diff --git a/tests/auto/uic/baseline/trpreviewtool.ui.h b/tests/auto/tools/uic/baseline/trpreviewtool.ui.h similarity index 100% rename from tests/auto/uic/baseline/trpreviewtool.ui.h rename to tests/auto/tools/uic/baseline/trpreviewtool.ui.h diff --git a/tests/auto/uic/baseline/validators.ui b/tests/auto/tools/uic/baseline/validators.ui similarity index 100% rename from tests/auto/uic/baseline/validators.ui rename to tests/auto/tools/uic/baseline/validators.ui diff --git a/tests/auto/uic/baseline/validators.ui.h b/tests/auto/tools/uic/baseline/validators.ui.h similarity index 100% rename from tests/auto/uic/baseline/validators.ui.h rename to tests/auto/tools/uic/baseline/validators.ui.h diff --git a/tests/auto/uic/baseline/wateringconfigdialog.ui b/tests/auto/tools/uic/baseline/wateringconfigdialog.ui similarity index 100% rename from tests/auto/uic/baseline/wateringconfigdialog.ui rename to tests/auto/tools/uic/baseline/wateringconfigdialog.ui diff --git a/tests/auto/uic/baseline/wateringconfigdialog.ui.h b/tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h similarity index 100% rename from tests/auto/uic/baseline/wateringconfigdialog.ui.h rename to tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h diff --git a/tests/auto/uic/generated_ui/placeholder b/tests/auto/tools/uic/generated_ui/placeholder similarity index 100% rename from tests/auto/uic/generated_ui/placeholder rename to tests/auto/tools/uic/generated_ui/placeholder diff --git a/tests/auto/uic/tst_uic.cpp b/tests/auto/tools/uic/tst_uic.cpp similarity index 100% rename from tests/auto/uic/tst_uic.cpp rename to tests/auto/tools/uic/tst_uic.cpp diff --git a/tests/auto/uic/uic.pro b/tests/auto/tools/uic/uic.pro similarity index 75% rename from tests/auto/uic/uic.pro rename to tests/auto/tools/uic/uic.pro index 00450154578..37c9a1e430a 100644 --- a/tests/auto/uic/uic.pro +++ b/tests/auto/tools/uic/uic.pro @@ -5,3 +5,5 @@ TARGET = tst_uic # This test is not run on wince (I think) DEFINES += SRCDIR=\\\"$$PWD/\\\" + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/uiloader/uiloader/uiloader.pro b/tests/auto/uiloader/uiloader/uiloader.pro index b959d438b7a..12624703ff8 100644 --- a/tests/auto/uiloader/uiloader/uiloader.pro +++ b/tests/auto/uiloader/uiloader/uiloader.pro @@ -13,7 +13,7 @@ win32 { } } -QT += xml svg network +QT += widgets network wince*|symbian: { configuration.files = ../*.ini diff --git a/tests/auto/v8/v8.pro b/tests/auto/v8/v8.pro index feda53bf501..599aeef9c67 100644 --- a/tests/auto/v8/v8.pro +++ b/tests/auto/v8/v8.pro @@ -7,3 +7,5 @@ HEADERS += v8test.h CONFIG += parallel_test QT += v8-private + +CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/windowsmobile/test/test.pro b/tests/auto/windowsmobile/test/test.pro index b0536a5e79d..595a619d2aa 100644 --- a/tests/auto/windowsmobile/test/test.pro +++ b/tests/auto/windowsmobile/test/test.pro @@ -1,6 +1,6 @@ load(qttest_p4) - +QT += widgets HEADERS += ddhelper.h SOURCES += tst_windowsmobile.cpp ddhelper.cpp RESOURCES += windowsmobile.qrc diff --git a/tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro b/tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro index 87986e4d961..6b84ae937c4 100644 --- a/tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro +++ b/tests/auto/windowsmobile/testQMenuBar/testQMenuBar.pro @@ -1,3 +1,4 @@ SOURCES += main.cpp +QT += widgets TARGET = ../testQMenuBar diff --git a/tests/auto/xml.pro b/tests/auto/xml.pro deleted file mode 100644 index 76afec89cd0..00000000000 --- a/tests/auto/xml.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE=subdirs -SUBDIRS=\ - qdom \ - qxml \ - qxmlinputsource \ - qxmlsimplereader \ - qxmlstream \ - diff --git a/tests/auto/xml/dom/dom.pro b/tests/auto/xml/dom/dom.pro new file mode 100644 index 00000000000..17cfafcea7b --- /dev/null +++ b/tests/auto/xml/dom/dom.pro @@ -0,0 +1,4 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qdom \ + diff --git a/tests/auto/qdom/.gitattributes b/tests/auto/xml/dom/qdom/.gitattributes similarity index 100% rename from tests/auto/qdom/.gitattributes rename to tests/auto/xml/dom/qdom/.gitattributes diff --git a/tests/auto/qdom/.gitignore b/tests/auto/xml/dom/qdom/.gitignore similarity index 100% rename from tests/auto/qdom/.gitignore rename to tests/auto/xml/dom/qdom/.gitignore diff --git a/tests/auto/qdom/doubleNamespaces.xml b/tests/auto/xml/dom/qdom/doubleNamespaces.xml similarity index 100% rename from tests/auto/qdom/doubleNamespaces.xml rename to tests/auto/xml/dom/qdom/doubleNamespaces.xml diff --git a/tests/auto/qdom/qdom.pro b/tests/auto/xml/dom/qdom/qdom.pro similarity index 100% rename from tests/auto/qdom/qdom.pro rename to tests/auto/xml/dom/qdom/qdom.pro diff --git a/tests/auto/qdom/testdata/excludedCodecs.txt b/tests/auto/xml/dom/qdom/testdata/excludedCodecs.txt similarity index 100% rename from tests/auto/qdom/testdata/excludedCodecs.txt rename to tests/auto/xml/dom/qdom/testdata/excludedCodecs.txt diff --git a/tests/auto/qdom/testdata/toString_01/doc01.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc01.xml similarity index 100% rename from tests/auto/qdom/testdata/toString_01/doc01.xml rename to tests/auto/xml/dom/qdom/testdata/toString_01/doc01.xml diff --git a/tests/auto/qdom/testdata/toString_01/doc02.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc02.xml similarity index 100% rename from tests/auto/qdom/testdata/toString_01/doc02.xml rename to tests/auto/xml/dom/qdom/testdata/toString_01/doc02.xml diff --git a/tests/auto/qdom/testdata/toString_01/doc03.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc03.xml similarity index 100% rename from tests/auto/qdom/testdata/toString_01/doc03.xml rename to tests/auto/xml/dom/qdom/testdata/toString_01/doc03.xml diff --git a/tests/auto/qdom/testdata/toString_01/doc04.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc04.xml similarity index 100% rename from tests/auto/qdom/testdata/toString_01/doc04.xml rename to tests/auto/xml/dom/qdom/testdata/toString_01/doc04.xml diff --git a/tests/auto/qdom/testdata/toString_01/doc05.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc05.xml similarity index 100% rename from tests/auto/qdom/testdata/toString_01/doc05.xml rename to tests/auto/xml/dom/qdom/testdata/toString_01/doc05.xml diff --git a/tests/auto/qdom/testdata/toString_01/doc_euc-jp.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc_euc-jp.xml similarity index 100% rename from tests/auto/qdom/testdata/toString_01/doc_euc-jp.xml rename to tests/auto/xml/dom/qdom/testdata/toString_01/doc_euc-jp.xml diff --git a/tests/auto/qdom/testdata/toString_01/doc_iso-2022-jp.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc_iso-2022-jp.xml similarity index 100% rename from tests/auto/qdom/testdata/toString_01/doc_iso-2022-jp.xml rename to tests/auto/xml/dom/qdom/testdata/toString_01/doc_iso-2022-jp.xml diff --git a/tests/auto/qdom/testdata/toString_01/doc_little-endian.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc_little-endian.xml similarity index 100% rename from tests/auto/qdom/testdata/toString_01/doc_little-endian.xml rename to tests/auto/xml/dom/qdom/testdata/toString_01/doc_little-endian.xml diff --git a/tests/auto/qdom/testdata/toString_01/doc_utf-16.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc_utf-16.xml similarity index 100% rename from tests/auto/qdom/testdata/toString_01/doc_utf-16.xml rename to tests/auto/xml/dom/qdom/testdata/toString_01/doc_utf-16.xml diff --git a/tests/auto/qdom/testdata/toString_01/doc_utf-8.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc_utf-8.xml similarity index 100% rename from tests/auto/qdom/testdata/toString_01/doc_utf-8.xml rename to tests/auto/xml/dom/qdom/testdata/toString_01/doc_utf-8.xml diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp similarity index 100% rename from tests/auto/qdom/tst_qdom.cpp rename to tests/auto/xml/dom/qdom/tst_qdom.cpp diff --git a/tests/auto/qdom/umlaut.xml b/tests/auto/xml/dom/qdom/umlaut.xml similarity index 100% rename from tests/auto/qdom/umlaut.xml rename to tests/auto/xml/dom/qdom/umlaut.xml diff --git a/tests/auto/qxml/.gitignore b/tests/auto/xml/sax/qxml/.gitignore similarity index 100% rename from tests/auto/qxml/.gitignore rename to tests/auto/xml/sax/qxml/.gitignore diff --git a/tests/auto/qxml/0x010D.xml b/tests/auto/xml/sax/qxml/0x010D.xml similarity index 100% rename from tests/auto/qxml/0x010D.xml rename to tests/auto/xml/sax/qxml/0x010D.xml diff --git a/tests/auto/qxml/qxml.pro b/tests/auto/xml/sax/qxml/qxml.pro similarity index 100% rename from tests/auto/qxml/qxml.pro rename to tests/auto/xml/sax/qxml/qxml.pro diff --git a/tests/auto/qxml/tst_qxml.cpp b/tests/auto/xml/sax/qxml/tst_qxml.cpp similarity index 100% rename from tests/auto/qxml/tst_qxml.cpp rename to tests/auto/xml/sax/qxml/tst_qxml.cpp diff --git a/tests/auto/qxmlinputsource/.gitignore b/tests/auto/xml/sax/qxmlinputsource/.gitignore similarity index 100% rename from tests/auto/qxmlinputsource/.gitignore rename to tests/auto/xml/sax/qxmlinputsource/.gitignore diff --git a/tests/auto/qxmlinputsource/qxmlinputsource.pro b/tests/auto/xml/sax/qxmlinputsource/qxmlinputsource.pro similarity index 100% rename from tests/auto/qxmlinputsource/qxmlinputsource.pro rename to tests/auto/xml/sax/qxmlinputsource/qxmlinputsource.pro diff --git a/tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp similarity index 100% rename from tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp rename to tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp diff --git a/tests/auto/qxmlsimplereader/.gitattributes b/tests/auto/xml/sax/qxmlsimplereader/.gitattributes similarity index 100% rename from tests/auto/qxmlsimplereader/.gitattributes rename to tests/auto/xml/sax/qxmlsimplereader/.gitattributes diff --git a/tests/auto/qxmlsimplereader/.gitignore b/tests/auto/xml/sax/qxmlsimplereader/.gitignore similarity index 100% rename from tests/auto/qxmlsimplereader/.gitignore rename to tests/auto/xml/sax/qxmlsimplereader/.gitignore diff --git a/tests/auto/qxmlsimplereader/encodings/doc_euc-jp.xml b/tests/auto/xml/sax/qxmlsimplereader/encodings/doc_euc-jp.xml similarity index 100% rename from tests/auto/qxmlsimplereader/encodings/doc_euc-jp.xml rename to tests/auto/xml/sax/qxmlsimplereader/encodings/doc_euc-jp.xml diff --git a/tests/auto/qxmlsimplereader/encodings/doc_iso-2022-jp.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/encodings/doc_iso-2022-jp.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/encodings/doc_iso-2022-jp.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/encodings/doc_iso-2022-jp.xml.ref diff --git a/tests/auto/qxmlsimplereader/encodings/doc_little-endian.xml b/tests/auto/xml/sax/qxmlsimplereader/encodings/doc_little-endian.xml similarity index 100% rename from tests/auto/qxmlsimplereader/encodings/doc_little-endian.xml rename to tests/auto/xml/sax/qxmlsimplereader/encodings/doc_little-endian.xml diff --git a/tests/auto/qxmlsimplereader/encodings/doc_utf-16.xml b/tests/auto/xml/sax/qxmlsimplereader/encodings/doc_utf-16.xml similarity index 100% rename from tests/auto/qxmlsimplereader/encodings/doc_utf-16.xml rename to tests/auto/xml/sax/qxmlsimplereader/encodings/doc_utf-16.xml diff --git a/tests/auto/qxmlsimplereader/encodings/doc_utf-8.xml b/tests/auto/xml/sax/qxmlsimplereader/encodings/doc_utf-8.xml similarity index 100% rename from tests/auto/qxmlsimplereader/encodings/doc_utf-8.xml rename to tests/auto/xml/sax/qxmlsimplereader/encodings/doc_utf-8.xml diff --git a/tests/auto/qxmlsimplereader/generate_ref_files.sh b/tests/auto/xml/sax/qxmlsimplereader/generate_ref_files.sh similarity index 100% rename from tests/auto/qxmlsimplereader/generate_ref_files.sh rename to tests/auto/xml/sax/qxmlsimplereader/generate_ref_files.sh diff --git a/tests/auto/qxmlsimplereader/parser/main.cpp b/tests/auto/xml/sax/qxmlsimplereader/parser/main.cpp similarity index 100% rename from tests/auto/qxmlsimplereader/parser/main.cpp rename to tests/auto/xml/sax/qxmlsimplereader/parser/main.cpp diff --git a/tests/auto/qxmlsimplereader/parser/parser.cpp b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp similarity index 100% rename from tests/auto/qxmlsimplereader/parser/parser.cpp rename to tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp diff --git a/tests/auto/qxmlsimplereader/parser/parser.h b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h similarity index 100% rename from tests/auto/qxmlsimplereader/parser/parser.h rename to tests/auto/xml/sax/qxmlsimplereader/parser/parser.h diff --git a/tests/auto/qxmlsimplereader/parser/parser.pro b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.pro similarity index 100% rename from tests/auto/qxmlsimplereader/parser/parser.pro rename to tests/auto/xml/sax/qxmlsimplereader/parser/parser.pro diff --git a/tests/auto/qxmlsimplereader/qxmlsimplereader.pro b/tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro similarity index 100% rename from tests/auto/qxmlsimplereader/qxmlsimplereader.pro rename to tests/auto/xml/sax/qxmlsimplereader/qxmlsimplereader.pro diff --git a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp similarity index 100% rename from tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp rename to tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/001.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/001.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/001.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/001.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/001.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/001.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/001.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/002.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/002.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/002.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/002.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/002.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/002.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/002.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/003.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/003.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/003.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/003.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/003.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/003.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/003.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/004.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/004.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/004.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/004.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/004.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/004.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/004.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/005.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/005.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/005.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/005.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/005.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/005.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/005.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/006.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/006.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/006.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/006.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/006.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/006.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/006.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/007.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/007.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/007.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/007.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/007.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/007.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/007.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/008.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/008.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/008.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/008.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/008.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/008.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/008.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/008.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/009.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/009.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/009.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/009.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/009.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/009.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/009.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/009.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/010.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/010.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/010.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/010.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/010.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/010.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/010.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/011.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/011.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/011.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/011.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/011.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/011.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/011.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/011.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/012.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/012.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/012.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/012.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/012.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/012.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/012.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/012.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/013.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/013.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/013.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/013.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/013.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/013.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/013.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/013.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/014.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/014.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/014.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/014.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/014.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/014.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/014.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/014.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/015.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/015.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/015.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/015.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/015.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/015.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/015.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/015.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/016.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/016.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/016.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/016.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/016.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/016.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/016.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/016.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/017.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/017.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/017.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/017.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/017.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/017.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/017.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/017.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/018.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/018.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/018.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/018.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/018.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/018.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/018.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/018.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/019.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/019.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/019.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/019.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/019.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/019.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/019.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/019.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/020.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/020.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/020.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/020.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/020.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/020.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/020.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/020.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/021.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/021.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/021.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/021.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/021.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/021.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/021.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/021.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/022.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/022.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/022.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/022.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/022.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/022.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/022.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/022.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/023.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/023.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/023.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/023.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/023.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/023.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/023.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/023.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/024.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/024.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/024.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/024.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/024.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/024.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/024.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/024.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/025.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/025.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/025.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/025.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/025.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/025.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/025.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/025.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/026.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/026.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/026.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/026.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/026.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/026.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/026.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/026.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/027.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/027.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/027.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/027.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/027.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/027.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/027.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/027.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/028.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/028.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/028.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/028.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/028.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/028.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/028.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/028.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/029.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/029.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/029.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/029.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/029.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/029.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/029.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/029.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/030.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/030.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/030.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/030.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/030.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/030.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/030.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/030.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/031.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/031.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/031.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/031.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/031.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/031.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/031.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/031.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/032.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/032.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/032.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/032.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/032.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/032.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/032.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/032.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/033.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/033.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/033.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/033.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/033.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/033.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/033.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/033.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/034.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/034.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/034.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/034.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/034.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/034.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/034.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/034.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/035.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/035.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/035.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/035.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/035.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/035.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/035.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/035.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/036.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/036.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/036.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/036.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/036.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/036.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/036.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/036.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/037.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/037.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/037.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/037.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/037.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/037.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/037.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/037.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/038.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/038.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/038.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/038.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/038.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/038.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/038.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/038.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/039.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/039.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/039.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/039.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/039.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/039.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/039.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/039.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/040.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/040.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/040.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/040.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/040.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/040.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/040.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/040.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/041.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/041.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/041.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/041.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/041.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/041.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/041.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/041.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/042.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/042.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/042.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/042.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/042.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/042.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/042.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/042.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/043.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/043.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/043.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/043.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/043.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/043.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/043.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/043.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/044.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/044.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/044.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/044.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/044.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/044.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/044.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/044.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/045.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/045.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/045.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/045.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/045.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/045.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/045.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/045.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/046.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/046.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/046.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/046.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/046.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/046.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/046.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/046.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/047.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/047.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/047.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/047.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/047.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/047.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/047.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/047.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/048.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/048.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/048.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/048.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/048.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/048.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/048.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/048.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/049.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/049.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/049.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/049.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/049.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/049.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/049.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/049.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/050.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/050.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/050.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/050.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/050.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/050.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/050.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/050.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/051.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/051.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/051.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/051.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/051.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/051.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/051.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/051.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/052.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/052.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/052.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/052.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/052.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/052.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/052.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/052.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/053.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/053.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/053.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/053.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/053.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/053.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/053.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/053.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/054.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/054.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/054.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/054.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/054.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/054.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/054.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/054.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/055.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/055.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/055.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/055.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/055.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/055.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/055.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/055.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/056.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/056.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/056.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/056.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/056.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/056.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/056.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/056.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/057.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/057.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/057.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/057.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/057.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/057.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/057.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/057.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/058.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/058.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/058.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/058.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/058.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/058.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/058.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/058.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/059.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/059.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/059.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/059.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/059.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/059.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/059.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/059.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/060.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/060.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/060.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/060.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/060.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/060.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/060.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/060.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/061.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/061.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/061.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/061.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/061.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/061.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/061.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/061.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/062.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/062.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/062.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/062.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/062.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/062.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/062.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/062.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/063.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/063.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/063.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/063.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/063.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/063.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/063.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/063.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/064.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/064.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/064.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/064.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/064.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/064.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/064.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/064.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/065.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/065.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/065.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/065.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/065.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/065.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/065.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/065.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/066.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/066.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/066.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/066.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/066.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/066.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/066.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/066.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/067.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/067.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/067.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/067.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/067.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/067.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/067.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/067.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/068.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/068.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/068.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/068.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/068.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/068.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/068.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/068.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/069.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/069.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/069.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/069.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/069.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/069.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/069.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/069.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/070.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/070.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/070.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/070.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/070.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/070.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/070.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/070.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/071.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/071.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/071.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/071.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/071.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/071.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/071.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/071.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/072.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/072.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/072.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/072.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/072.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/072.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/072.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/072.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/073.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/073.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/073.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/073.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/073.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/073.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/073.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/073.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/074.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/074.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/074.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/074.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/074.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/074.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/074.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/074.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/075.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/075.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/075.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/075.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/075.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/075.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/075.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/075.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/076.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/076.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/076.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/076.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/076.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/076.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/076.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/076.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/077.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/077.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/077.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/077.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/077.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/077.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/077.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/077.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/078.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/078.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/078.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/078.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/078.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/078.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/078.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/078.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/079.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/079.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/079.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/079.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/079.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/079.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/079.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/079.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/080.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/080.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/080.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/080.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/080.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/080.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/080.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/080.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/081.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/081.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/081.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/081.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/081.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/081.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/081.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/081.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/082.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/082.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/082.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/082.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/082.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/082.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/082.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/082.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/083.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/083.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/083.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/083.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/083.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/083.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/083.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/083.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/084.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/084.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/084.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/084.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/084.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/084.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/084.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/084.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/085.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/085.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/085.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/085.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/085.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/085.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/085.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/085.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/086.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/086.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/086.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/086.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/086.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/086.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/086.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/086.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/087.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/087.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/087.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/087.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/087.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/087.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/087.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/087.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/088.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/088.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/088.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/088.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/088.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/088.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/088.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/088.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/089.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/089.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/089.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/089.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/089.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/089.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/089.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/089.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/090.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/090.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/090.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/090.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/090.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/090.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/090.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/090.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/091.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/091.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/091.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/091.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/091.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/091.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/091.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/091.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/092.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/092.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/092.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/092.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/092.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/092.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/092.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/092.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/093.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/093.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/093.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/093.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/093.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/093.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/093.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/093.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/094.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/094.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/094.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/094.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/094.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/094.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/094.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/094.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/095.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/095.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/095.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/095.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/095.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/095.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/095.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/095.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/096.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/096.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/096.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/096.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/096.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/096.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/096.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/096.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/097.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/097.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/097.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/097.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/097.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/097.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/097.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/097.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/098.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/098.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/098.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/098.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/098.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/098.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/098.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/098.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/099.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/099.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/099.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/099.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/099.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/099.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/099.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/099.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/100.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/100.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/100.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/100.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/100.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/100.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/100.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/100.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/101.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/101.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/101.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/101.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/101.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/101.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/101.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/101.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/102.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/102.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/102.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/102.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/102.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/102.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/102.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/102.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/103.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/103.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/103.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/103.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/103.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/103.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/103.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/103.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/104.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/104.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/104.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/104.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/104.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/104.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/104.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/104.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/105.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/105.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/105.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/105.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/105.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/105.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/105.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/105.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/106.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/106.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/106.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/106.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/106.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/106.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/106.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/106.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/107.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/107.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/107.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/107.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/107.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/107.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/107.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/107.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/108.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/108.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/108.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/108.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/108.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/108.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/108.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/108.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/109.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/109.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/109.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/109.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/109.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/109.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/109.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/109.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/110.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/110.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/110.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/110.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/110.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/110.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/110.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/110.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/111.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/111.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/111.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/111.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/111.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/111.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/111.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/111.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/112.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/112.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/112.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/112.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/112.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/112.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/112.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/112.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/113.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/113.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/113.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/113.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/113.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/113.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/113.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/113.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/114.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/114.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/114.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/114.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/114.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/114.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/114.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/114.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/115.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/115.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/115.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/115.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/115.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/115.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/115.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/115.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/116.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/116.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/116.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/116.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/116.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/116.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/116.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/116.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/117.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/117.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/117.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/117.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/117.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/117.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/117.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/117.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/118.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/118.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/118.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/118.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/118.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/118.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/118.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/118.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/119.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/119.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/119.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/119.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/119.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/119.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/119.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/119.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/120.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/120.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/120.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/120.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/120.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/120.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/120.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/120.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/121.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/121.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/121.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/121.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/121.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/121.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/121.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/121.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/122.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/122.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/122.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/122.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/122.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/122.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/122.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/122.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/123.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/123.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/123.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/123.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/123.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/123.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/123.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/123.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/124.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/124.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/124.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/124.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/124.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/124.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/124.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/124.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/125.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/125.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/125.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/125.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/125.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/125.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/125.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/125.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/126.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/126.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/126.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/126.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/126.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/126.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/126.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/126.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/127.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/127.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/127.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/127.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/127.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/127.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/127.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/127.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/128.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/128.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/128.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/128.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/128.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/128.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/128.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/128.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/129.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/129.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/129.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/129.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/129.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/129.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/129.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/129.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/130.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/130.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/130.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/130.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/130.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/130.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/130.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/130.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/131.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/131.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/131.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/131.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/131.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/131.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/131.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/131.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/132.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/132.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/132.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/132.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/132.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/132.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/132.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/132.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/133.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/133.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/133.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/133.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/133.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/133.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/133.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/133.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/134.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/134.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/134.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/134.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/134.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/134.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/134.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/134.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/135.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/135.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/135.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/135.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/135.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/135.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/135.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/135.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/136.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/136.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/136.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/136.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/136.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/136.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/136.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/136.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/137.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/137.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/137.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/137.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/137.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/137.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/137.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/137.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/138.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/138.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/138.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/138.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/138.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/138.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/138.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/138.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/139.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/139.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/139.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/139.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/139.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/139.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/139.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/139.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/140.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/140.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/140.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/140.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/140.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/140.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/140.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/140.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/141.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/141.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/141.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/141.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/141.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/141.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/141.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/141.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/142.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/142.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/142.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/142.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/142.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/142.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/142.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/142.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/143.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/143.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/143.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/143.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/143.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/143.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/143.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/143.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/144.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/144.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/144.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/144.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/144.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/144.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/144.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/144.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/145.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/145.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/145.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/145.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/145.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/145.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/145.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/145.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/146.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/146.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/146.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/146.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/146.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/146.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/146.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/146.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/147.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/147.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/147.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/147.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/147.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/147.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/147.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/147.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/148.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/148.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/148.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/148.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/148.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/148.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/148.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/148.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/149.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/149.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/149.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/149.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/149.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/149.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/149.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/149.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/150.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/150.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/150.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/150.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/150.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/150.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/150.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/150.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/151.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/151.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/151.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/151.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/151.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/151.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/151.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/151.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/152.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/152.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/152.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/152.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/152.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/152.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/152.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/152.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/153.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/153.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/153.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/153.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/153.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/153.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/153.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/153.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/154.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/154.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/154.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/154.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/154.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/154.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/154.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/154.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/155.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/155.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/155.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/155.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/155.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/155.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/155.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/155.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/156.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/156.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/156.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/156.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/156.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/156.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/156.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/156.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/157.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/157.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/157.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/157.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/157.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/157.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/157.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/157.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/158.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/158.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/158.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/158.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/158.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/158.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/158.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/158.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/159.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/159.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/159.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/159.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/159.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/159.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/159.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/159.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/160.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/160.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/160.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/160.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/160.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/160.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/160.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/160.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/161.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/161.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/161.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/161.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/161.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/161.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/161.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/161.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/162.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/162.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/162.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/162.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/162.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/162.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/162.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/162.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/163.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/163.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/163.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/163.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/163.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/163.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/163.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/163.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/164.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/164.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/164.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/164.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/164.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/164.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/164.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/164.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/165.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/165.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/165.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/165.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/165.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/165.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/165.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/165.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/166.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/166.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/166.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/166.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/166.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/166.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/166.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/166.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/167.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/167.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/167.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/167.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/167.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/167.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/167.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/167.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/168.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/168.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/168.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/168.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/168.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/168.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/168.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/168.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/169.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/169.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/169.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/169.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/169.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/169.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/169.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/169.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/170.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/170.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/170.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/170.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/170.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/170.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/170.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/170.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/171.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/171.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/171.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/171.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/171.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/171.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/171.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/171.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/172.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/172.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/172.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/172.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/172.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/172.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/172.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/172.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/173.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/173.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/173.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/173.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/173.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/173.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/173.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/173.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/174.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/174.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/174.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/174.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/174.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/174.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/174.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/174.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/175.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/175.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/175.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/175.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/175.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/175.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/175.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/175.xml.ref diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/176.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/176.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/176.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/176.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/176.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/176.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/176.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/176.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/177.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/177.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/177.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/177.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/177.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/177.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/177.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/177.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/178.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/178.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/178.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/178.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/178.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/178.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/178.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/178.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/179.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/179.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/179.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/179.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/179.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/179.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/179.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/179.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/180.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/180.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/180.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/180.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/180.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/180.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/180.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/180.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/181.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/181.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/181.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/181.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/181.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/181.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/181.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/181.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/182.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/182.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/182.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/182.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/182.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/182.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/182.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/182.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/183.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/183.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/183.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/183.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/183.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/183.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/183.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/183.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/184.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/184.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/184.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/184.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/184.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/184.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/184.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/184.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/185.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/185.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/185.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/185.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/185.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/185.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/185.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/185.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/185.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/185.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/185.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/185.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/186.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/186.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/186.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/186.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/186.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/186.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/not-wf/sa/186.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/186.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/null.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/null.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/not-wf/sa/null.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/not-wf/sa/null.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/001.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/001.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/001.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/001.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/001.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/001.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/001.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/001.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/001.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/001.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/001.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/002.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/002.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/002.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/002.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/002.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/002.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/002.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/002.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/002.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/002.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/002.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/003.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/003.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/003.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/003.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/003.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/003.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/003.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/003.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/003.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/003.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/003.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/004.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/004.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/004.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/004.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/004.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/004.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/004.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/004.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/004.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/004.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/004.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/005.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/005.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/005.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/005.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/005.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/005.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/005.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/005.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/005.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/005.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/005.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/006.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/006.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/006.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/006.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/006.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/006.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/006.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/006.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/006.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/006.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/006.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/007.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/007.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/007.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/007.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/007.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/007.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/007.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/007.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/007.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/007.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/007.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/008.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/008.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/008.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/008.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/008.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/008.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/008.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/008.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/008.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/008.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/008.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/008.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/009.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/009.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/009.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/009.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/009.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/009.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/009.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/009.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/009.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/009.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/009.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/009.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/010.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/010.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/010.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/010.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/010.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/010.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/010.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/010.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/010.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/010.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/010.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/011.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/011.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/011.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/011.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/011.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/011.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/011.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/011.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/011.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/011.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/011.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/011.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/012.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/012.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/012.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/012.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/012.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/012.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/012.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/012.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/012.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/012.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/012.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/012.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/013.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/013.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/013.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/013.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/013.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/013.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/013.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/013.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/013.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/013.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/013.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/013.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/014.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/014.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/014.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/014.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/014.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/014.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/ext-sa/014.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/014.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/014.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/014.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/014.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/014.xml.ref diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_1.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_1.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_1.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_1.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_1.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_1.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_1.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_1.xml.ref diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_2.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_2.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_2.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_2.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_2.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_2.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_2.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_2.xml.ref diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_3.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_3.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_3.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_3.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_3.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_3.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_3.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/ext-sa/undef_entity_3.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/001.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/001.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/001.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/001.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/001.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/001.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/001.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/001.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/001.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/001.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/001.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/002.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/002.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/002.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/002.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/002.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/002.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/002.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/002.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/002.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/002.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/002.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003-1.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/003-1.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003-1.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/003-1.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003-2.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/003-2.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003-2.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/003-2.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/003.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/003.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/003.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/003.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/003.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/003.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004-1.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/004-1.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004-1.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/004-1.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004-2.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/004-2.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004-2.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/004-2.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/004.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/004.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/004.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/004.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/004.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/004.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005-1.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/005-1.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005-1.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/005-1.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005-2.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/005-2.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005-2.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/005-2.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/005.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/005.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/005.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/005.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/005.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/005.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/006.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/006.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/006.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/006.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/006.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/006.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/006.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/006.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/006.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/006.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/006.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/007.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/007.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/007.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/007.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/007.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/007.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/007.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/007.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/007.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/007.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/007.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/008.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/008.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/008.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/008.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/008.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/008.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/008.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/008.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/008.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/008.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/008.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/008.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/009.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/009.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/009.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/009.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/009.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/009.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/009.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/009.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/009.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/009.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/009.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/009.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/010.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/010.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/010.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/010.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/010.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/010.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/010.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/010.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/010.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/010.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/010.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/011.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/011.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/011.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/011.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/011.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/011.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/011.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/011.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/011.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/011.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/011.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/011.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/012.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/012.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/012.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/012.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/012.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/012.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/012.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/012.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/012.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/012.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/012.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/012.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/013.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/013.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/013.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/013.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/013.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/013.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/013.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/013.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/013.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/013.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/013.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/013.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/014.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/014.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/014.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/014.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/014.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/014.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/014.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/014.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/014.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/014.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/014.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/014.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/015.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/015.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/015.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/015.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/015.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/015.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/015.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/015.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/015.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/015.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/015.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/015.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/016.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/016.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/016.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/016.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/016.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/016.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/016.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/016.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/016.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/016.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/016.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/016.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/017.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/017.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/017.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/017.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/017.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/017.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/017.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/017.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/017.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/017.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/017.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/017.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/018.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/018.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/018.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/018.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/018.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/018.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/018.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/018.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/018.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/018.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/018.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/018.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/019.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/019.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/019.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/019.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/019.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/019.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/019.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/019.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/019.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/019.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/019.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/019.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/020.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/020.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/020.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/020.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/020.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/020.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/020.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/020.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/020.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/020.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/020.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/020.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/021.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/021.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/021.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/021.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/021.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/021.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/021.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/021.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/021.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/021.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/021.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/021.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/022.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/022.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/022.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/022.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/022.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/022.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/invalid/not-sa/022.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/022.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/022.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/022.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/022.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/022.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/023.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/023.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/023.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/023.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/023.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/023.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/023.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/023.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/023.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/023.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/023.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/023.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/024.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/024.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/024.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/024.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/024.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/024.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/024.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/024.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/024.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/024.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/024.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/024.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/025.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/025.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/025.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/025.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/025.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/025.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/025.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/025.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/025.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/025.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/025.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/025.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/026.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/026.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/026.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/026.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/026.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/026.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/026.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/026.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/026.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/026.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/026.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/026.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/027.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/027.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/027.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/027.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/027.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/027.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/027.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/027.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/027.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/027.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/027.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/027.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/028.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/028.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/028.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/028.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/028.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/028.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/028.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/028.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/028.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/028.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/028.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/028.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/029.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/029.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/029.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/029.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/029.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/029.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/029.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/029.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/029.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/029.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/029.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/029.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/030.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/030.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/030.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/030.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/030.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/030.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/030.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/030.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/030.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/030.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/030.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/030.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031-1.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/031-1.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031-1.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/031-1.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031-2.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/031-2.ent old mode 100644 new mode 100755 similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031-2.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/031-2.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/031.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/not-sa/031.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/031.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/031.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/031.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/not-sa/031.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/not-sa/031.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/001.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/001.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/001.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/001.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/001.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/001.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/001.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/001.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/002.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/002.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/002.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/002.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/002.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/002.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/002.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/002.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/003.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/003.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/003.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/003.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/003.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/003.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/003.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/003.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/004.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/004.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/004.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/004.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/004.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/004.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/004.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/004.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/005.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/005.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/005.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/005.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/005.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/005.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/005.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/005.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/006.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/006.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/006.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/006.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/006.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/006.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/006.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/006.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/007.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/007.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/007.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/007.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/007.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/007.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/007.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/007.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/008.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/008.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/008.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/008.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/008.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/008.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/008.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/008.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/009.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/009.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/009.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/009.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/009.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/009.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/009.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/009.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/010.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/010.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/010.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/010.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/010.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/010.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/010.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/010.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/011.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/011.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/011.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/011.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/011.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/011.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/011.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/011.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/012.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/012.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/012.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/012.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/012.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/012.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/012.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/012.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/013.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/013.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/013.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/013.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/013.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/013.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/013.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/013.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/014.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/014.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/014.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/014.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/014.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/014.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/014.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/014.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/015.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/015.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/015.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/015.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/015.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/015.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/015.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/015.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/016.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/016.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/016.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/016.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/016.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/016.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/016.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/016.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/017.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/017.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/017.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/017.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/017.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/017.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/017.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/017.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/018.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/018.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/018.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/018.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/018.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/018.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/018.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/018.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/019.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/019.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/019.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/019.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/019.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/019.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/019.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/019.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/020.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/020.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/020.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/020.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/020.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/020.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/020.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/020.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/021.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/021.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/021.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/021.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/021.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/021.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/021.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/021.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/022.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/022.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/022.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/022.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/022.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/022.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/022.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/022.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/023.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/023.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/023.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/023.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/023.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/023.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/023.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/023.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/024.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/024.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/024.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/024.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/024.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/024.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/024.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/024.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/025.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/025.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/025.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/025.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/025.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/025.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/025.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/025.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/026.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/026.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/026.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/026.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/026.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/026.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/026.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/026.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/027.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/027.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/027.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/027.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/027.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/027.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/027.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/027.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/028.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/028.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/028.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/028.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/028.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/028.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/028.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/028.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/029.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/029.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/029.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/029.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/029.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/029.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/029.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/029.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/030.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/030.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/030.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/030.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/030.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/030.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/030.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/030.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/031.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/031.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/031.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/031.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/031.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/031.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/031.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/031.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/032.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/032.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/032.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/032.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/032.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/032.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/032.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/032.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/033.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/033.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/033.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/033.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/033.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/033.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/033.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/033.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/034.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/034.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/034.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/034.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/034.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/034.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/034.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/034.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/035.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/035.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/035.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/035.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/035.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/035.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/035.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/035.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/036.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/036.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/036.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/036.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/036.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/036.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/036.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/036.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/037.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/037.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/037.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/037.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/037.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/037.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/037.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/037.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/038.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/038.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/038.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/038.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/038.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/038.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/038.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/038.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/039.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/039.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/039.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/039.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/039.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/039.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/039.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/039.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/040.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/040.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/040.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/040.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/040.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/040.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/040.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/040.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/041.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/041.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/041.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/041.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/041.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/041.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/041.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/041.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/042.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/042.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/042.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/042.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/042.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/042.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/042.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/042.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/043.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/043.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/043.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/043.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/043.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/043.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/043.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/043.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/044.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/044.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/044.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/044.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/044.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/044.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/044.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/044.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/045.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/045.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/045.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/045.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/045.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/045.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/045.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/045.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/046.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/046.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/046.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/046.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/046.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/046.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/046.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/046.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/047.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/047.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/047.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/047.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/047.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/047.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/047.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/047.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/048.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/048.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/048.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/048.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/048.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/048.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/048.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/048.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/049.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/049.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/049.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/049.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/049.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/049.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/049.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/049.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/050.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/050.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/050.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/050.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/050.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/050.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/050.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/050.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/051.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/051.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/051.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/051.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/051.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/051.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/051.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/051.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/052.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/052.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/052.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/052.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/052.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/052.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/052.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/052.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/053.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/053.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/053.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/053.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/053.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/053.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/053.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/053.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/054.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/054.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/054.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/054.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/054.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/054.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/054.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/054.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/055.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/055.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/055.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/055.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/055.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/055.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/055.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/055.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/056.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/056.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/056.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/056.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/056.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/056.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/056.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/056.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/057.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/057.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/057.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/057.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/057.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/057.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/057.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/057.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/058.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/058.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/058.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/058.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/058.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/058.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/058.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/058.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/059.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/059.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/059.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/059.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/059.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/059.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/059.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/059.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/060.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/060.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/060.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/060.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/060.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/060.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/060.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/060.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/061.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/061.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/061.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/061.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/061.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/061.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/061.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/061.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/062.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/062.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/062.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/062.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/062.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/062.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/062.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/062.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/063.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/063.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/063.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/063.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/063.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/063.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/063.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/063.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/064.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/064.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/064.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/064.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/064.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/064.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/064.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/064.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/065.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/065.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/065.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/065.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/065.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/065.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/065.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/065.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/066.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/066.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/066.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/066.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/066.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/066.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/066.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/066.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/067.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/067.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/067.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/067.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/067.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/067.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/067.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/067.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/068.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/068.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/068.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/068.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/068.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/068.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/068.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/068.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/069.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/069.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/069.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/069.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/069.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/069.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/069.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/069.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/070.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/070.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/070.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/070.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/070.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/070.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/070.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/070.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/071.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/071.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/071.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/071.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/071.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/071.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/071.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/071.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/072.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/072.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/072.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/072.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/072.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/072.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/072.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/072.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/073.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/073.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/073.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/073.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/073.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/073.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/073.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/073.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/074.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/074.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/074.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/074.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/074.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/074.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/074.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/074.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/075.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/075.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/075.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/075.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/075.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/075.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/075.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/075.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/076.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/076.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/076.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/076.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/076.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/076.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/076.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/076.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/077.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/077.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/077.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/077.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/077.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/077.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/077.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/077.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/078.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/078.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/078.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/078.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/078.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/078.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/078.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/078.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/079.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/079.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/079.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/079.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/079.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/079.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/079.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/079.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/080.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/080.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/080.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/080.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/080.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/080.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/080.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/080.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/081.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/081.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/081.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/081.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/081.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/081.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/081.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/081.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/082.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/082.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/082.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/082.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/082.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/082.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/082.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/082.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/083.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/083.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/083.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/083.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/083.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/083.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/083.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/083.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/084.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/084.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/084.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/084.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/084.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/084.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/084.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/084.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/085.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/085.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/085.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/085.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/085.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/085.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/085.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/085.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/086.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/086.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/086.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/086.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/086.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/086.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/086.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/086.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/087.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/087.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/087.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/087.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/087.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/087.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/087.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/087.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/088.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/088.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/088.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/088.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/088.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/088.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/088.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/088.xml.ref diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/089.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/089.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/089.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/089.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/089.xml.bak b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/089.xml.bak similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/089.xml.bak rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/089.xml.bak diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/089.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/089.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/089.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/089.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/090.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/090.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/090.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/090.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/090.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/090.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/090.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/090.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/091.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/091.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/091.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/091.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/091.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/091.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/091.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/091.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/092.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/092.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/092.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/092.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/092.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/092.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/092.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/092.xml.ref diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/093.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/093.xml similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/093.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/093.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/093.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/093.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/093.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/093.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/094.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/094.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/094.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/094.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/094.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/094.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/094.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/094.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/095.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/095.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/095.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/095.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/095.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/095.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/095.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/095.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/096.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/096.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/096.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/096.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/096.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/096.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/096.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/096.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/097.ent b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/097.ent similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/097.ent rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/097.ent diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/097.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/097.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/097.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/097.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/097.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/097.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/097.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/097.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/098.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/098.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/098.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/098.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/098.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/098.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/098.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/098.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/099.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/099.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/099.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/099.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/099.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/099.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/099.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/099.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/100.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/100.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/100.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/100.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/100.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/100.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/100.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/100.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/101.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/101.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/101.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/101.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/101.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/101.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/101.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/101.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/102.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/102.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/102.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/102.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/102.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/102.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/102.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/102.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/103.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/103.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/103.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/103.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/103.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/103.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/103.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/103.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/104.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/104.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/104.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/104.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/104.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/104.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/104.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/104.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/105.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/105.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/105.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/105.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/105.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/105.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/105.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/105.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/106.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/106.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/106.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/106.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/106.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/106.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/106.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/106.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/107.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/107.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/107.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/107.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/107.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/107.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/107.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/107.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/108.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/108.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/108.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/108.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/108.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/108.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/108.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/108.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/109.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/109.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/109.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/109.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/109.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/109.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/109.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/109.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/110.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/110.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/110.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/110.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/110.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/110.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/110.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/110.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/111.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/111.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/111.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/111.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/111.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/111.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/111.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/111.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/112.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/112.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/112.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/112.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/112.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/112.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/112.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/112.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/113.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/113.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/113.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/113.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/113.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/113.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/113.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/113.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/114.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/114.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/114.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/114.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/114.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/114.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/114.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/114.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/115.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/115.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/115.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/115.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/115.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/115.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/115.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/115.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/116.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/116.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/116.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/116.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/116.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/116.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/116.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/116.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/117.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/117.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/117.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/117.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/117.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/117.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/117.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/117.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/118.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/118.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/118.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/118.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/118.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/118.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/118.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/118.xml.ref diff --git a/tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/119.xml b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/119.xml similarity index 100% rename from tests/auto/qxmlstream/XML-Test-Suite/xmlconf/xmltest/valid/sa/119.xml rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/119.xml diff --git a/tests/auto/qxmlsimplereader/xmldocs/valid/sa/119.xml.ref b/tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/119.xml.ref similarity index 100% rename from tests/auto/qxmlsimplereader/xmldocs/valid/sa/119.xml.ref rename to tests/auto/xml/sax/qxmlsimplereader/xmldocs/valid/sa/119.xml.ref diff --git a/tests/auto/xml/sax/sax.pro b/tests/auto/xml/sax/sax.pro new file mode 100644 index 00000000000..13aeb21d07d --- /dev/null +++ b/tests/auto/xml/sax/sax.pro @@ -0,0 +1,6 @@ +TEMPLATE=subdirs +SUBDIRS=\ + qxmlinputsource \ + qxml \ + qxmlsimplereader \ + diff --git a/tests/auto/xml/xml.pro b/tests/auto/xml/xml.pro new file mode 100644 index 00000000000..4b90ffbe139 --- /dev/null +++ b/tests/auto/xml/xml.pro @@ -0,0 +1,5 @@ +TEMPLATE=subdirs +SUBDIRS=\ + dom \ + sax \ + diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro index 0831e6257ee..60d7e6f6399 100644 --- a/tests/benchmarks/benchmarks.pro +++ b/tests/benchmarks/benchmarks.pro @@ -4,7 +4,7 @@ SUBDIRS = \ gui \ network \ -contains(QT_CONFIG, opengl): SUBDIRS += opengl +# removed-by-refactor contains(QT_CONFIG, opengl): SUBDIRS += opengl contains(QT_CONFIG, dbus): SUBDIRS += dbus check-trusted.CONFIG += recursive diff --git a/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp b/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp index 79615c67ff8..4214a41f5c8 100644 --- a/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp +++ b/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ #include <QtCore> -#include <QtGui> +#include <QtWidgets/QTreeView> #include <qtest.h> class LotsOfSignals : public QObject diff --git a/tests/benchmarks/corelib/kernel/qobject/main.cpp b/tests/benchmarks/corelib/kernel/qobject/main.cpp index 33f1ac7d1c8..7ca4144a19e 100644 --- a/tests/benchmarks/corelib/kernel/qobject/main.cpp +++ b/tests/benchmarks/corelib/kernel/qobject/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ #include <QtCore> -#include <QtGui> +#include <QtWidgets/QTreeView> #include <qtest.h> #include "object.h" #include <qcoreapplication.h> diff --git a/tests/benchmarks/corelib/kernel/qobject/qobject.pro b/tests/benchmarks/corelib/kernel/qobject/qobject.pro index f54fae50594..991c965f569 100644 --- a/tests/benchmarks/corelib/kernel/qobject/qobject.pro +++ b/tests/benchmarks/corelib/kernel/qobject/qobject.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/animation/qanimation/main.cpp b/tests/benchmarks/gui/animation/qanimation/main.cpp index 7132bd7c78f..9c016ba765f 100644 --- a/tests/benchmarks/gui/animation/qanimation/main.cpp +++ b/tests/benchmarks/gui/animation/qanimation/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include <QtGui> +#include <QtWidgets> #include <qtest.h> #include "dummyobject.h" diff --git a/tests/benchmarks/gui/animation/qanimation/qanimation.pro b/tests/benchmarks/gui/animation/qanimation/qanimation.pro index ce4853f5108..c18c7b077a7 100644 --- a/tests/benchmarks/gui/animation/qanimation/qanimation.pro +++ b/tests/benchmarks/gui/animation/qanimation/qanimation.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro index b5de1c3f7a0..f888b45e81f 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 8edd1232a78..2380ed3e6c8 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -40,10 +40,10 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include <QtGui/qgraphicsanchorlayout.h> -#include <QtGui/qgraphicslinearlayout.h> -#include <QtGui/qgraphicswidget.h> -#include <QtGui/qgraphicsview.h> +#include <QtWidgets/qgraphicsanchorlayout.h> +#include <QtWidgets/qgraphicslinearlayout.h> +#include <QtWidgets/qgraphicswidget.h> +#include <QtWidgets/qgraphicsview.h> class tst_QGraphicsAnchorLayout : public QObject { diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro index f15ac530a4e..f0049fca91b 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro index 795fbcd171b..223e63126bc 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.cpp index 6ffcbbfee16..62ddcfc5ef6 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.cpp @@ -41,7 +41,7 @@ #include "chip.h" -#include <QtGui> +#include <QtWidgets> Chip::Chip(const QColor &color, int x, int y) { diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.h index b6338d99160..3e4ef6fe24a 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.h +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.h @@ -43,7 +43,7 @@ #define CHIP_H #include <QtGui/QColor> -#include <QtGui/QGraphicsItem> +#include <QtWidgets/QGraphicsItem> class Chip : public QGraphicsItem { diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h index 4c75a67fd23..bcab432092e 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h @@ -42,7 +42,9 @@ #ifndef CHIPTESTER_H #define CHIPTESTER_H -#include <QtGui> +#include <QtWidgets/QGraphicsView> +#include <QtCore/QEventLoop> +#include <QtCore/QTime> QT_FORWARD_DECLARE_CLASS(QGraphicsScene) QT_FORWARD_DECLARE_CLASS(QGraphicsView) diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.pri b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.pri index a9e0bf82723..8d02504b73f 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.pri +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.pri @@ -9,4 +9,5 @@ HEADERS += \ RESOURCES += \ chiptester/images.qrc +QT += widgets contains(QT_CONFIG, opengl) QT += opengl diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro index 22278870533..1d46ab9407b 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 3b690da6e1a..4ff6b15faea 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -40,11 +40,13 @@ ****************************************************************************/ #include <qtest.h> -#include <QDebug> -#include <QGraphicsItem> -#include <QGraphicsScene> -#include <QGraphicsView> -#include <QImage> +#include <QtCore/QDebug> +#include <QtWidgets/QGraphicsItem> +#include <QtWidgets/QGraphicsScene> +#include <QtWidgets/QGraphicsView> +#include <QtGui/QImage> +#include <QtGui/QPixmapCache> +#include <QtWidgets/QDesktopWidget> #include "chiptester/chiptester.h" //#define CALLGRIND_DEBUG diff --git a/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro b/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro index 2d2f47983d5..6e191a767e6 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/gui.pro b/tests/benchmarks/gui/gui.pro index d8254583c59..9cf701fa335 100644 --- a/tests/benchmarks/gui/gui.pro +++ b/tests/benchmarks/gui/gui.pro @@ -15,4 +15,4 @@ TRUSTED_BENCHMARKS += \ graphicsview/qgraphicsview \ painting/qtracebench -include(../trusted-benchmarks.pri) \ No newline at end of file +include(../trusted-benchmarks.pri) diff --git a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro index 37f150ea50e..9334ee13749 100644 --- a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro +++ b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp b/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp index 2ea6d23ba3c..904177bff71 100644 --- a/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp @@ -76,8 +76,8 @@ Q_DECLARE_METATYPE(Qt::TransformationMode) QPixmap rasterPixmap(int width, int height) { - QPixmapData *data = - new QRasterPixmapData(QPixmapData::PixmapType); + QPlatformPixmap *data = + new QRasterPlatformPixmap(QPlatformPixmap::PixmapType); data->resize(width, height); @@ -91,8 +91,8 @@ QPixmap rasterPixmap(const QSize &size) QPixmap rasterPixmap(const QImage &image) { - QPixmapData *data = - new QRasterPixmapData(QPixmapData::PixmapType); + QPlatformPixmap *data = + new QRasterPlatformPixmap(QPlatformPixmap::PixmapType); data->fromImage(image, Qt::AutoColor); diff --git a/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro b/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro index 1bdbe0199d2..800ce8f7568 100644 --- a/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro +++ b/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/kernel/qapplication/qapplication.pro b/tests/benchmarks/gui/kernel/qapplication/qapplication.pro index 0a5a394eb80..33f90bd228b 100644 --- a/tests/benchmarks/gui/kernel/qapplication/qapplication.pro +++ b/tests/benchmarks/gui/kernel/qapplication/qapplication.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/kernel/qwidget/qwidget.pro b/tests/benchmarks/gui/kernel/qwidget/qwidget.pro index 0be7f07a439..ea68f942b5c 100644 --- a/tests/benchmarks/gui/kernel/qwidget/qwidget.pro +++ b/tests/benchmarks/gui/kernel/qwidget/qwidget.pro @@ -1,5 +1,6 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp index 1912b97ab11..841036b8bc9 100644 --- a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp +++ b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp @@ -40,7 +40,9 @@ ****************************************************************************/ #include <qtest.h> -#include <QtGui> + +#include <QtWidgets/QLayout> +#include <QtGui/QPainter> static void processEvents() { diff --git a/tests/benchmarks/gui/painting/qpainter/qpainter.pro b/tests/benchmarks/gui/painting/qpainter/qpainter.pro index 9f5fdf44cad..8d3d7c9549d 100644 --- a/tests/benchmarks/gui/painting/qpainter/qpainter.pro +++ b/tests/benchmarks/gui/painting/qpainter/qpainter.pro @@ -1,10 +1,10 @@ load(qttest_p4) +QT += widgets +QT += gui-private widgets-private # do not run benchmarks by default in 'make check' CONFIG -= testcase -QT += gui-private - TEMPLATE = app TARGET = tst_bench_qpainter diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp index 27e307b8bc6..37a8329151c 100644 --- a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp @@ -45,6 +45,7 @@ #include <QDialog> #include <QImage> #include <QPaintEngine> +#include <QTileRules> #include <math.h> #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -129,8 +130,8 @@ struct PrimitiveSet { QPixmap rasterPixmap(int width, int height) { - QPixmapData *data = - new QRasterPixmapData(QPixmapData::PixmapType); + QPlatformPixmap *data = + new QRasterPlatformPixmap(QPlatformPixmap::PixmapType); data->resize(width, height); @@ -144,8 +145,8 @@ QPixmap rasterPixmap(const QSize &size) QPixmap rasterPixmap(const QImage &image) { - QPixmapData *data = - new QRasterPixmapData(QPixmapData::PixmapType); + QPlatformPixmap *data = + new QRasterPlatformPixmap(QPlatformPixmap::PixmapType); data->fromImage(image, Qt::AutoColor); diff --git a/tests/benchmarks/gui/painting/qtbench/qtbench.pro b/tests/benchmarks/gui/painting/qtbench/qtbench.pro index 21ed8e0121f..8c76c587b0c 100644 --- a/tests/benchmarks/gui/painting/qtbench/qtbench.pro +++ b/tests/benchmarks/gui/painting/qtbench/qtbench.pro @@ -1,4 +1,5 @@ load(qttest_p4) +QT += widgets # do not run benchmarks by default in 'make check' CONFIG -= testcase diff --git a/tests/benchmarks/gui/painting/qtracebench/qtracebench.pro b/tests/benchmarks/gui/painting/qtracebench/qtracebench.pro index 6d2c783746f..64c1c58293c 100644 --- a/tests/benchmarks/gui/painting/qtracebench/qtracebench.pro +++ b/tests/benchmarks/gui/painting/qtracebench/qtracebench.pro @@ -1,10 +1,10 @@ load(qttest_p4) +QT += widgets +QT += core-private gui-private widgets-private # do not run benchmarks by default in 'make check' CONFIG -= testcase -QT += core-private gui-private - TEMPLATE = app TARGET = tst_qtracebench diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp index 72f5ea531f0..106247806d8 100644 --- a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp +++ b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp @@ -40,7 +40,16 @@ ****************************************************************************/ // This file contains benchmarks for QRect/QRectF functions. -#include <QtGui> +#include <QtWidgets/QWidget> +#include <QtWidgets/QGridLayout> +#include <QtWidgets/QPushButton> +#include <QtWidgets/QComboBox> +#include <QtWidgets/QSpinBox> +#include <QtWidgets/QCheckBox> +#include <QtWidgets/QRadioButton> +#include <QtWidgets/QLabel> +#include <QtWidgets/QProgressBar> +#include <QtWidgets/QLineEdit> #include <qtest.h> class tst_qstylesheetstyle : public QObject diff --git a/tests/benchmarks/gui/text/qtext/qtext.pro b/tests/benchmarks/gui/text/qtext/qtext.pro index 602cc54c57a..b1daf692107 100644 --- a/tests/benchmarks/gui/text/qtext/qtext.pro +++ b/tests/benchmarks/gui/text/qtext/qtext.pro @@ -1,10 +1,10 @@ load(qttest_p4) +QT += widgets +QT += gui-private widgets-private # do not run benchmarks by default in 'make check' CONFIG -= testcase -QT += gui-private - TEMPLATE = app TARGET = tst_bench_QText diff --git a/tests/benchmarks/network/network.pro b/tests/benchmarks/network/network.pro index 692a0a1b7e1..ec812407f7a 100644 --- a/tests/benchmarks/network/network.pro +++ b/tests/benchmarks/network/network.pro @@ -2,12 +2,16 @@ TEMPLATE = subdirs SUBDIRS = \ access \ kernel \ - ssl \ socket TRUSTED_BENCHMARKS += \ kernel/qhostinfo \ - socket/qtcpserver \ - ssl/qsslsocket + socket/qtcpserver + +contains(QT_CONFIG, openssl) { + SUBDIRS += ssl + TRUSTED_BENCHMARKS += ssl/qsslsocket +} + +include(../trusted-benchmarks.pri) -include(../trusted-benchmarks.pri) \ No newline at end of file diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 24284a3b979..a6b87a336f2 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -344,7 +344,7 @@ Configure::Configure(int& argc, char** argv) dictionary[ "LIBMNG" ] = "auto"; dictionary[ "FREETYPE" ] = "no"; - dictionary[ "QT3SUPPORT" ] = "yes"; + dictionary[ "QT3SUPPORT" ] = "no"; dictionary[ "ACCESSIBILITY" ] = "yes"; dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENVG" ] = "no"; diff --git a/tools/uilib/abstractformbuilder.cpp b/tools/uilib/abstractformbuilder.cpp index 72c1d6ff308..da64a5ee270 100644 --- a/tools/uilib/abstractformbuilder.cpp +++ b/tools/uilib/abstractformbuilder.cpp @@ -56,48 +56,14 @@ #include <QtCore/qdebug.h> #include <QtCore/QCoreApplication> -#include <QtGui/QAction> -#include <QtGui/QActionGroup> -#include <QtGui/QButtonGroup> -#include <QtGui/QComboBox> -#include <QtGui/QFontComboBox> -#include <QtGui/QGridLayout> -#ifndef QT_NO_FORMLAYOUT -# include <QtGui/QFormLayout> -#endif -#include <QtGui/QIcon> -#include <QtGui/QListWidget> -#include <QtGui/QMainWindow> -#include <QtGui/QPixmap> -#include <QtGui/QStatusBar> -#include <QtGui/QTreeWidget> -#include <QtGui/QTableWidget> -#include <QtGui/QWidget> -#include <QtGui/QSplitter> -#include <QtGui/QScrollArea> -#include <QtGui/QAbstractButton> -#include <QtGui/QAbstractItemView> -#include <QtGui/QHeaderView> +#include <QtGui/QtGui> +#include <QtWidgets/QtWidgets> #ifndef QFORMINTERNAL_NAMESPACE # include <private/qlayout_p.h> // Compiling within Designer #endif #include <QtCore/QXmlStreamReader> -#include <QtGui/QDialog> - -// containers -#include <QtGui/QToolBox> -#include <QtGui/QStackedWidget> -#include <QtGui/QTabWidget> -#include <QtGui/QToolBar> -#include <QtGui/QMenuBar> -#include <QtGui/QDockWidget> -#include <QtGui/QMdiArea> -#include <QtGui/QWorkspace> -#include <QtGui/QWizard> -#include <QtGui/QWizardPage> - #include <QtCore/qdebug.h> #include <limits.h> diff --git a/tools/uilib/abstractformbuilder.h b/tools/uilib/abstractformbuilder.h index 74d38d21341..d0882500be9 100644 --- a/tools/uilib/abstractformbuilder.h +++ b/tools/uilib/abstractformbuilder.h @@ -49,7 +49,7 @@ #include <QtCore/QDir> #include <QtCore/QScopedPointer> -#include <QtGui/QSizePolicy> +#include <QtWidgets/QSizePolicy> #include <QtGui/QPalette> QT_BEGIN_HEADER diff --git a/tools/uilib/customwidget.h b/tools/uilib/customwidget.h index a6899cca891..43cc0550463 100644 --- a/tools/uilib/customwidget.h +++ b/tools/uilib/customwidget.h @@ -45,7 +45,7 @@ #include "extension.h" #include <QtCore/QObject> #include <QtCore/QString> -#include <QtGui/QIcon> +#include <QtWidgets/QIcon> QT_BEGIN_HEADER diff --git a/tools/uilib/formbuilder.cpp b/tools/uilib/formbuilder.cpp index 4f9a54d4221..5e22ddb998b 100644 --- a/tools/uilib/formbuilder.cpp +++ b/tools/uilib/formbuilder.cpp @@ -45,6 +45,7 @@ #include "ui4_p.h" #include <QtGui/QtGui> +#include <QtWidgets/QtWidgets> #include <QtCore/QCoreApplication> QT_BEGIN_NAMESPACE diff --git a/tools/uilib/formbuilderextra.cpp b/tools/uilib/formbuilderextra.cpp index c53001825c0..3d34a20bffa 100644 --- a/tools/uilib/formbuilderextra.cpp +++ b/tools/uilib/formbuilderextra.cpp @@ -45,9 +45,9 @@ #include "textbuilder_p.h" #include "ui4_p.h" -#include <QtGui/QLabel> -#include <QtGui/QBoxLayout> -#include <QtGui/QGridLayout> +#include <QtWidgets/QLabel> +#include <QtWidgets/QBoxLayout> +#include <QtWidgets/QGridLayout> #include <QtCore/QVariant> #include <QtCore/qdebug.h> diff --git a/tools/uilib/formscriptrunner.cpp b/tools/uilib/formscriptrunner.cpp index cf4e1533b80..8efb12f9e3c 100644 --- a/tools/uilib/formscriptrunner.cpp +++ b/tools/uilib/formscriptrunner.cpp @@ -44,7 +44,7 @@ #include "ui4_p.h" #include <QtScript/QScriptEngine> -#include <QtGui/QWidget> +#include <QtWidgets/QWidget> #include <QtCore/QDebug> #include <QtCore/QCoreApplication> diff --git a/tools/uilib/properties.cpp b/tools/uilib/properties.cpp index ebec22221a1..88cd455d65e 100644 --- a/tools/uilib/properties.cpp +++ b/tools/uilib/properties.cpp @@ -49,11 +49,11 @@ #include <QtCore/QUrl> #include <QtCore/qdebug.h> -#include <QtGui/QIcon> +#include <QtWidgets/QIcon> #include <QtGui/QPixmap> #include <QtGui/QFont> -#include <QtGui/QFrame> -#include <QtGui/QAbstractScrollArea> +#include <QtWidgets/QFrame> +#include <QtWidgets/QAbstractScrollArea> QT_BEGIN_NAMESPACE diff --git a/tools/uilib/properties_p.h b/tools/uilib/properties_p.h index c6d2781bad5..98b84fce9f4 100644 --- a/tools/uilib/properties_p.h +++ b/tools/uilib/properties_p.h @@ -60,7 +60,7 @@ #include <QtCore/QLocale> #include <QtCore/QCoreApplication> -#include <QtGui/QWidget> +#include <QtWidgets/QWidget> #include "formbuilderextra_p.h" diff --git a/tools/uilib/resourcebuilder.cpp b/tools/uilib/resourcebuilder.cpp index b24266eada3..72921c636bf 100644 --- a/tools/uilib/resourcebuilder.cpp +++ b/tools/uilib/resourcebuilder.cpp @@ -46,7 +46,7 @@ #include <QtCore/QDir> #include <QtCore/QDebug> #include <QtGui/QPixmap> -#include <QtGui/QIcon> +#include <QtWidgets/QIcon> QT_BEGIN_NAMESPACE diff --git a/tools/uilib/uilib.pri b/tools/uilib/uilib.pri index 2072fbce8fa..75904c2f66a 100644 --- a/tools/uilib/uilib.pri +++ b/tools/uilib/uilib.pri @@ -4,6 +4,8 @@ INCLUDEPATH += $$PWD DEFINES += QT_DESIGNER !contains(QT_CONFIG, script): DEFINES += QT_FORMBUILDER_NO_SCRIPT +QT += gui widgets + # Input HEADERS += \ $$PWD/ui4_p.h \